blade-code 0.5.20 → 0.6.1
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-1t0cavth.js +28 -0
- package/dist/{chunk-x9zj0r7s.js → chunk-21zps3hb.js} +1 -1
- package/dist/{chunk-16n5hhnx.js → chunk-2ncjrcgb.js} +1 -1
- package/dist/{chunk-7ycmx7c2.js → chunk-39h8jdm3.js} +1 -1
- package/dist/{chunk-yddnm9n2.js → chunk-3ak4p05x.js} +1 -1
- package/dist/{chunk-5dprrzex.js → chunk-43et0hmr.js} +1 -1
- package/dist/chunk-563zye36.js +1 -0
- package/dist/{chunk-pfsft4nd.js → chunk-63954vzc.js} +1 -1
- package/dist/{chunk-w9gtgz08.js → chunk-65jg6hh5.js} +1 -1
- package/dist/{chunk-mz6n4w13.js → chunk-67dzm8te.js} +1 -1
- package/dist/chunk-6j51sw65.js +1 -0
- package/dist/{chunk-bhjw4b73.js → chunk-7rjrzngk.js} +1 -1
- package/dist/{chunk-16phf0ej.js → chunk-7zffps74.js} +2 -2
- package/dist/{chunk-5mqvwzj8.js → chunk-8a2z6mgp.js} +1 -1
- package/dist/{chunk-rr5p05rj.js → chunk-8zsr8vfz.js} +1 -1
- package/dist/{chunk-g6hftss3.js → chunk-9bzyfdpb.js} +1 -1
- package/dist/{chunk-8fqg3c10.js → chunk-9krqc9hn.js} +1 -1
- package/dist/{chunk-szp6w6e0.js → chunk-aeccd2wk.js} +1 -1
- package/dist/{chunk-adaxybvz.js → chunk-az0gxvcj.js} +1 -1
- package/dist/{chunk-68ctb04g.js → chunk-b5nhr3na.js} +1 -1
- package/dist/chunk-caw1bxy6.js +1 -0
- package/dist/chunk-g7xh4e99.js +1 -0
- package/dist/{chunk-f38xkfg6.js → chunk-gj13a4b0.js} +1 -1
- package/dist/{chunk-g5pasj7t.js → chunk-gn1acna6.js} +1 -1
- package/dist/{chunk-gjx50fr1.js → chunk-hg60qxhf.js} +351 -330
- package/dist/chunk-j1ehsp0x.js +3 -0
- package/dist/{chunk-zxame725.js → chunk-kevt8v3j.js} +1 -1
- package/dist/{chunk-q5yn875m.js → chunk-m7xm1ssb.js} +1 -1
- package/dist/chunk-n9mwp62v.js +1 -0
- package/dist/chunk-pex1hq3x.js +613 -0
- package/dist/chunk-rbj6kay8.js +6 -0
- package/dist/{chunk-j2ag7hh6.js → chunk-s53zeref.js} +1 -1
- package/dist/{chunk-yk91w5p2.js → chunk-t44946na.js} +3 -3
- package/dist/{chunk-37rethcy.js → chunk-t7hd45rg.js} +2 -2
- package/dist/chunk-xbwztgcz.js +2 -0
- package/dist/{chunk-k2h94jvh.js → chunk-xp4a56jz.js} +1 -1
- package/dist/{chunk-k65n39by.js → chunk-y57hcnk6.js} +1 -1
- package/dist/{chunk-qwfywxs2.js → chunk-zfy765hj.js} +1 -1
- package/dist/{chunk-3e7tfpmx.js → chunk-zxfgsb8m.js} +1 -1
- package/package.json +3 -2
- package/dist/chunk-bx4d9898.js +0 -1
- package/dist/chunk-cy8kd1cf.js +0 -2
- package/dist/chunk-fe7g701v.js +0 -1
- package/dist/chunk-fjvhbve8.js +0 -1
- package/dist/chunk-ktpzvmxg.js +0 -602
- package/dist/chunk-mxrre2n3.js +0 -24
- package/dist/chunk-set7v1rf.js +0 -3
- package/dist/chunk-tdjwh8xv.js +0 -6
- package/dist/chunk-th432d0b.js +0 -1
- package/dist/chunk-zh3ndtvg.js +0 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{Kb as w}from"./chunk-s53zeref.js";import{appendFileSync as B,existsSync as N,mkdirSync as R,readdirSync as x,statSync as k,unlinkSync as j}from"node:fs";import Y from"node:path";import{execSync as z}from"node:child_process";import*as O from"node:os";import*as Q from"node:path";function F(q){return Q.resolve(q).replace(/[/\\]/g,"-").replace(/:/g,"_")}function S(q){let G=q.replace(/_/g,":");if(G.startsWith("-"))G="/"+G.slice(1);return G.replace(/-/g,"/")}function A(q){let G=F(q);return Q.join(W(),"projects",G)}function D(q,G){return Q.join(A(q),`${G}.jsonl`)}function P(q){try{return z("git rev-parse --abbrev-ref HEAD",{cwd:q,encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{return}}function W(){return process.env.BLADE_STORAGE_ROOT||Q.join(O.homedir(),".blade")}async function v(){let{readdir:q}=await import("node:fs/promises");try{let G=Q.join(W(),"projects");return(await q(G,{withFileTypes:!0})).filter((H)=>H.isDirectory()).map((H)=>H.name)}catch{return[]}}var Z;((J)=>{J[J.DEBUG=0]="DEBUG";J[J.INFO=1]="INFO";J[J.WARN=2]="WARN";J[J.ERROR=3]="ERROR"})(Z||={});var X=null,U=null,_=!1;function y(q){if(X!==q)X=q}async function c(){}function V(){if(_)return U;_=!0;try{let q=Y.join(W(),"logs");if(!N(q))R(q,{recursive:!0,mode:493});if(k(q).uid===0&&process.getuid&&process.getuid()!==0)return console.error(""),console.error("[FAIL] 权限错误:~/.blade/logs 目录属于 root 用户"),console.error(""),console.error("这通常是因为您曾经使用 sudo 运行过 blade。"),console.error(""),console.error("解决方法:"),console.error(" sudo chown -R $USER:$USER ~/.blade/"),console.error(""),console.error("然后重新运行 blade(不要使用 sudo)"),console.error(""),null;return m(q,30),U=q,q}catch(q){return console.error("[Logger] 无法创建日志目录:",q),null}}function m(q,G){try{let K=x(q),H=Date.now(),J=G*24*60*60*1000;for(let T of K){if(!T.startsWith("blade-")||!T.endsWith(".log")&&!T.endsWith(".jsonl"))continue;let $=Y.join(q,T);try{let E=k($);if(H-E.mtimeMs>J)j($)}catch(E){}}}catch(K){}}function I(){let q=V();if(!q)return null;let G=X||"default";return Y.join(q,`blade-${G}.jsonl`)}function C(q,G,K){let H=I();if(!H)return;try{let J={timestamp:new Date().toISOString(),level:Z[G],category:q,message:K};B(H,JSON.stringify(J)+`
|
|
2
|
+
`)}catch(J){}}class M{static globalDebugConfig=null;enabled;minLevel;category;constructor(q={}){if(q.enabled!==void 0)this.enabled=q.enabled;else if(M.globalDebugConfig!==null)this.enabled=Boolean(M.globalDebugConfig);else this.enabled=!1;this.minLevel=q.minLevel??0,this.category=q.category??"General"}static setGlobalDebug(q){M.globalDebugConfig=q}static clearGlobalDebug(){M.globalDebugConfig=null}setEnabled(q){this.enabled=q}parseDebugFilter(q){if(!q)return{enabled:!1};if(q===!0||q==="true"||q==="1")return{enabled:!0};let G=String(q).trim();if(!G)return{enabled:!0};if(G.startsWith("!"))return{enabled:!0,filter:{mode:"exclude",categories:G.split(",").map((J)=>J.trim().replace(/^!/,"")).filter(Boolean)}};return{enabled:!0,filter:{mode:"include",categories:G.split(",").map((H)=>H.trim()).filter(Boolean)}}}shouldLogCategory(q){if(!q)return!0;let G=this.category.toLowerCase();if(q.mode==="include")return q.categories.some((K)=>G.includes(K.toLowerCase()));return!q.categories.some((K)=>G.includes(K.toLowerCase()))}shouldLogToConsole(q){if(M.globalDebugConfig!==null){let{enabled:G,filter:K}=this.parseDebugFilter(M.globalDebugConfig);if(!G)return!1;if(q<this.minLevel)return!1;return this.shouldLogCategory(K)}return this.enabled&&q>=this.minLevel}log(q,...G){let K=G.map((H)=>typeof H==="object"?JSON.stringify(H):String(H)).join(" ");if(C(this.category,q,K),this.shouldLogToConsole(q)){let H=Z[q],J=`[${this.category}] [${H}]`;console.error(J,...G)}}debug(...q){this.log(0,...q)}info(...q){this.log(1,...q)}warn(...q){this.log(2,...q)}error(...q){this.log(3,...q)}}function d(q,G){return new M({...G,category:q})}var L=new M({category:"General"});
|
|
3
|
+
export{S as zb,A as Ab,D as Bb,P as Cb,W as Db,v as Eb,y as Fb,c as Gb,M as Hb,d as Ib,L as Jb};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Aa as g,Ba as h,Ca as i,Da as j,Ea as k,Fa as l,Ga as m,ua as a,va as b,wa as c,xa as d,ya as e,za as f}from"./chunk-
|
|
1
|
+
import{Aa as g,Ba as h,Ca as i,Da as j,Ea as k,Fa as l,Ga as m,ua as a,va as b,wa as c,xa as d,ya as e,za as f}from"./chunk-21zps3hb.js";import"./chunk-67dzm8te.js";import"./chunk-39h8jdm3.js";import"./chunk-j1ehsp0x.js";import"./chunk-s53zeref.js";export{a as vanillaStore,c as sessionActions,l as getThinkingModeEnabled,b as getState,j as getModelById,e as getMessages,k as getMcpServers,i as getCurrentModel,f as getConfig,h as getAllModels,g as ensureStoreInitialized,m as configActions,d as appActions};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{pb as Q,qb as W,rb as Y}from"./chunk-t7hd45rg.js";import{Ib as X}from"./chunk-j1ehsp0x.js";var J=X("Service"),$="https://models.dev/api.json",j=3600000,G=null,Z=async()=>{if(G&&Date.now()-G.timestamp<j)return G.data;try{J.info("Fetching models.dev data...");let q=await fetch($,{headers:{"User-Agent":"Blade-CLI/1.0"}});if(!q.ok)throw Error(`HTTP ${q.status}: ${q.statusText}`);let x=await q.json();return G={data:x,timestamp:Date.now()},J.info(`Loaded ${Object.keys(x).length} providers from models.dev`),x}catch(q){throw J.error("Failed to fetch models.dev data:",q),q}},y=async()=>{let q=await Z(),x=[];for(let[w,k]of Object.entries(q)){let z=Object.keys(k.models||{}).length;if(z===0)continue;x.push({id:w,name:k.name||w,icon:W[w]||W.default,description:`${z} 个模型`,envVars:k.env||[],docUrl:k.doc,defaultBaseUrl:Y[w]})}return x.sort((w,k)=>{let z=Q.indexOf(w.id),K=Q.indexOf(k.id);if(z!==-1&&K!==-1)return z-K;if(z!==-1)return-1;if(K!==-1)return 1;return w.name.localeCompare(k.name)})},f=async(q)=>{let w=(await Z())[q];if(!w?.models)return J.warn(`No models found for provider: ${q}`),[];return Object.values(w.models).map((k)=>({id:k.id,name:k.name||k.id,contextWindow:k.limit?.context,maxOutput:k.limit?.output,inputCost:k.cost?.input,outputCost:k.cost?.output}))};
|
|
2
2
|
export{y as e,f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as a,h as b,i as c,j as d,k as e}from"./chunk-zfy765hj.js";import"./chunk-s53zeref.js";export{b as setSkipUntilVersion,d as performUpgrade,c as getUpgradeCommand,e as checkVersionOnStartup,a as checkVersion};
|