blade-code 0.10.101 → 0.10.102
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-fvfc95g3.js → chunk-00rps629.js} +2 -2
- package/dist/{chunk-z5a8ay9s.js → chunk-19xfer55.js} +1 -1
- package/dist/{chunk-kdatgrjy.js → chunk-1wgese5c.js} +1 -1
- package/dist/chunk-4t3h306m.js +6 -0
- package/dist/{chunk-dcjh1cj6.js → chunk-6kb69vkx.js} +1 -1
- package/dist/{chunk-2f5kkhan.js → chunk-6r6yzw44.js} +404 -402
- package/dist/{chunk-zydvg30x.js → chunk-6yezrqe7.js} +1 -1
- package/dist/{chunk-zjpph3ys.js → chunk-9018357g.js} +1 -1
- package/dist/{chunk-9ajkzcqj.js → chunk-9b0896bm.js} +1 -1
- package/dist/{chunk-qjv5kz7q.js → chunk-9n5ystr6.js} +14 -14
- package/dist/{chunk-jvxskq6a.js → chunk-a5jv8pn9.js} +1 -1
- package/dist/{chunk-bswjne5v.js → chunk-a8mgzsh7.js} +1 -1
- package/dist/chunk-anez8ekm.js +169 -0
- package/dist/{chunk-z0dmm227.js → chunk-b8n5mx53.js} +1 -1
- package/dist/{chunk-tazb5tze.js → chunk-c3zcqqb7.js} +1 -1
- package/dist/{chunk-2191220r.js → chunk-cpk84yrx.js} +1 -1
- package/dist/chunk-cwnaydst.js +1 -0
- package/dist/{chunk-n5jfmzp2.js → chunk-d7rg6t0n.js} +1 -1
- package/dist/{chunk-cjgpas7y.js → chunk-enwtex3j.js} +5 -5
- package/dist/{chunk-f8z5v101.js → chunk-ffp2rn7f.js} +1 -1
- package/dist/{chunk-tp5bep1y.js → chunk-fn9cse83.js} +1 -1
- package/dist/{chunk-2cg8f38t.js → chunk-fpx3462x.js} +1 -1
- package/dist/chunk-gdp02sqp.js +1 -0
- package/dist/{chunk-3an3vxzt.js → chunk-hexj26gw.js} +1 -1
- package/dist/{chunk-mzab7qak.js → chunk-kfmh3t1r.js} +1 -1
- package/dist/{chunk-nh4jy5cs.js → chunk-kt5jqaxp.js} +1 -1
- package/dist/{chunk-b4d43ap3.js → chunk-kwkkcs4y.js} +1 -1
- package/dist/{chunk-ykf4cqpg.js → chunk-m4wnqx0e.js} +4 -4
- package/dist/{chunk-twhf09qs.js → chunk-na3jmz7f.js} +1 -1
- package/dist/{chunk-8yt4nmyb.js → chunk-pdqczfn3.js} +1 -1
- package/dist/{chunk-8z9d0zd0.js → chunk-qw57eqns.js} +1 -1
- package/dist/{chunk-fqbc1ppx.js → chunk-rkk39efr.js} +1 -1
- package/dist/{chunk-qgjgjzbx.js → chunk-ryemn19e.js} +1 -1
- package/dist/{chunk-wbf4qcws.js → chunk-v6hffjwc.js} +2 -2
- package/dist/{chunk-j22d84s7.js → chunk-vw328ehw.js} +1 -1
- package/dist/{chunk-kfcs62nw.js → chunk-xy5fmskp.js} +1 -1
- package/dist/{chunk-vc7gh3wc.js → chunk-y3anmree.js} +1 -1
- package/dist/chunk-yx4802a0.js +2 -0
- package/dist/{chunk-3c01jje5.js → chunk-zxhv8xfp.js} +1 -1
- package/dist/{chunk-c663rajb.js → chunk-zy6vm5jm.js} +1 -1
- package/dist/web/assets/ChatView-C5kVDWL0.js +58 -0
- package/dist/web/assets/{CodeBlockHighlighter-DZcVFtJE.js → CodeBlockHighlighter-BxJu15oF.js} +1 -1
- package/dist/web/assets/{FilePreview-CzNS6kfM.js → FilePreview-BDNq89O6.js} +1 -1
- package/dist/web/assets/{KanbanBoard-cdh2g0r0.js → KanbanBoard-CCn0j1Ow.js} +1 -1
- package/dist/web/assets/{MarkdownRenderer-BqBOUlXa.js → MarkdownRenderer-15FrKNPV.js} +3 -3
- package/dist/web/assets/{SettingsModal-meSWhCOP.js → SettingsModal-DCL04xT_.js} +1 -1
- package/dist/web/assets/{TaskSwitcher-CiQi64Yl.js → TaskSwitcher-Gyn_K98p.js} +1 -1
- package/dist/web/assets/{TerminalPanel-Bze9t5mz.js → TerminalPanel-Cbh0NmHM.js} +1 -1
- package/dist/web/assets/{arrow-left-DpTnLOBT.js → arrow-left-wfNAFD9Y.js} +1 -1
- package/dist/web/assets/{calendar-clock-DlAXXpl_.js → calendar-clock-BbbqqtLj.js} +1 -1
- package/dist/web/assets/{chevrons-up-down-CmAktdaR.js → chevrons-up-down-uCUY_a67.js} +1 -1
- package/dist/web/assets/{clock-3-_w8nIuEK.js → clock-3-DfiIeEEf.js} +1 -1
- package/dist/web/assets/{external-link-AlymrIfc.js → external-link-CilEshFB.js} +1 -1
- package/dist/web/assets/{folder-CrxO-9Rc.js → folder-D9K0ykgI.js} +1 -1
- package/dist/web/assets/{index-JJH0FKfo.js → index-BKBXGV6s.js} +7 -7
- package/dist/web/assets/{pause-GQZaG_P3.js → pause-D4a4_iHl.js} +1 -1
- package/dist/web/assets/{play-BPhmPVpi.js → play-D9guMjPv.js} +1 -1
- package/dist/web/assets/{session-events-CO2pRY9U.js → session-events-DelJesUm.js} +19 -19
- package/dist/web/assets/{teamService-BqS4iOx0.js → teamService-CAVeS_dL.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/chunk-2r0f3b4t.js +0 -1
- package/dist/chunk-as2ezx8p.js +0 -1
- package/dist/chunk-hz5rsfxv.js +0 -2
- package/dist/chunk-sa7t9kht.js +0 -6
- package/dist/chunk-tc9rq0st.js +0 -160
- package/dist/web/assets/ChatView-Cc4bXZ6x.js +0 -58
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Ha as H}from"./chunk-
|
|
1
|
+
import{Ha as H}from"./chunk-fpx3462x.js";import"./chunk-8hprmrd5.js";import"./chunk-s0tq8gyx.js";import{$e as T,Ve as $}from"./chunk-b8n5mx53.js";import"./chunk-v508x7cg.js";import"./chunk-dg0d3303.js";import"./chunk-6kb69vkx.js";import"./chunk-c6tq09mt.js";import"./chunk-19xfer55.js";import"./chunk-f9asjkfz.js";import"./chunk-czcxx8tb.js";import"./chunk-maebpz1j.js";import{Nh as k}from"./chunk-9sx3vsyj.js";import"./chunk-70hwyc2w.js";import"./chunk-d8wzc602.js";import"./chunk-425p4nwx.js";import"./chunk-k7vv9vne.js";import"./chunk-qw57eqns.js";import"./chunk-cp7xsjj2.js";import"./chunk-2va6ex5v.js";import"./chunk-q3vza5gt.js";import"./chunk-w9xfks7f.js";import U from"os";import J from"path";function X(z){return typeof z==="string"?z:void 0}function N(z){if(!Array.isArray(z))return;let q=[];for(let K of z)if(typeof K==="string")q.push(K);else if(K!=null)q.push(String(K));return q}function b(){console.log(`
|
|
2
2
|
blade mcp
|
|
3
3
|
`),console.log(`管理 MCP 服务器
|
|
4
4
|
`),console.log("Commands:"),console.log(" blade mcp add <name> <commandOrUrl> [args...] 添加 MCP 服务器"),console.log(" blade mcp remove <name> 删除 MCP 服务器 [aliases: rm]"),console.log(" blade mcp list 列出所有 MCP 服务器并检查健康状态 [aliases: ls]"),console.log(" blade mcp get <name> 获取服务器详情"),console.log(" blade mcp login <name> 登录远程 MCP OAuth"),console.log(" blade mcp logout <name> 清除远程 MCP OAuth 凭证"),console.log(` blade mcp add-json <name> <json> 从 JSON 字符串添加服务器
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Me as N}from"./chunk-
|
|
1
|
+
import{Me as N}from"./chunk-b8n5mx53.js";import{og as $}from"./chunk-6kb69vkx.js";import{Nh as _}from"./chunk-9sx3vsyj.js";import{li as Y,ni as Z}from"./chunk-d8wzc602.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 ue,y as ve,j as we,C as xe};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{readFileSync as l}from"node:fs";import{dirname as o,join as u}from"node:path";import{fileURLToPath as a}from"node:url";var e={name:"blade-code",version:"0.10.
|
|
1
|
+
import{readFileSync as l}from"node:fs";import{dirname as o,join as u}from"node:path";import{fileURLToPath as a}from"node:url";var e={name:"blade-code",version:"0.10.102",private:!1,description:"🗡️ Blade Code - 智能代码助手命令行工具",type:"module",bin:{blade:"dist/blade.js"},files:["dist","vendor/ripgrep/**","README.md"],scripts:{dev:"node scripts/run-bun.js --watch src/blade.tsx","dev:serve":"node scripts/run-bun.js --watch src/blade.tsx serve --port 4097",build:"rm -rf dist && node scripts/run-bun.js run scripts/build.ts",start:"node scripts/run-bun.js run dist/blade.js",test:"node scripts/test.js","test:all":"vitest run --config vitest.config.ts --project='!performance' && vitest run --config vitest.config.ts --project=performance","test:unit":"node scripts/test.js unit","test:integration":"node scripts/test.js integration","test:real-api":"node scripts/test.js realApi","test:real-api:qualification":"node scripts/test.js realApiQualification","test:cli":"node scripts/test.js cli","test:headless-core":"node scripts/test.js headlessCore","test:e2e":"node scripts/test.js e2e","test:performance":"node scripts/test.js performance","test:snapshot":"node scripts/test.js snapshot","test:security":"node scripts/test.js security","browser:install":"playwright install chromium","browser:check":"node scripts/run-bun.js run scripts/browser-check.ts","test:coverage":"node scripts/test.js all --coverage","test:watch":"vitest --watch --config vitest.config.ts","qualify:local":"node scripts/run-bun.js run scripts/qualify.ts local","qualify:production":"node scripts/run-bun.js run scripts/qualify.ts production","benchmark:repo":"node scripts/run-bun.js run scripts/run-real-repo-benchmark.ts","test:update-snapshots":"node scripts/test.js snapshot --update",lint:"biome lint src tests","lint:fix":"biome lint --write src tests","type-check":"tsc --noEmit","format:check":"biome format src tests",ready:"node scripts/run-bun.js run scripts/qualify.ts production","detect-unused":"node scripts/run-bun.js run scripts/detect-unused.ts",prepack:"node scripts/run-bun.js run build",release:"node scripts/release.js","release:dry":"node scripts/release.js --dry-run","release:major":"node scripts/release.js --major","release:minor":"node scripts/release.js --minor","release:patch":"node scripts/release.js --patch"},keywords:["cli","blade","ai","assistant","agent","llm"],author:"echoVic",license:"MIT",repository:{type:"git",url:"git+https://github.com/echoVic/blade-code.git"},homepage:"https://github.com/echoVic/blade-code#readme",bugs:{url:"https://github.com/echoVic/blade-code/issues"},engines:{node:">=22.19.0"},optionalDependencies:{"@vscode/ripgrep":"^1.18.0","better-sqlite3":"^11.8.1","bun-pty":"^0.4.8","node-pty":"1.1.0"},dependencies:{"@agentclientprotocol/sdk":"^1.3.0","@anthropic-ai/sandbox-runtime":"0.0.67","@earendil-works/pi-ai":"0.84.2","@inkjs/ui":"^2.0.0","@modelcontextprotocol/sdk":"^1.30.0",ahooks:"^3.9.7",ajv:"^8.17.1","ansi-escapes":"^7.3.0","async-mutex":"^0.5.0",axios:"^1.19.0",chalk:"^5.4.1",diff:"^8.0.2","fast-glob":"^3.3.3","fuse.js":"^7.5.0","gray-matter":"^4.0.3",hono:"^4.13.0",ink:"npm:@jrichman/ink@6.4.10","ink-big-text":"^2.0.0","ink-gradient":"^3.0.0","ink-select-input":"^6.2.0","ink-spinner":"^5.0.0","ink-text-input":"^6.0.0","js-tiktoken":"^1.0.21","lodash-es":"^4.18.1",lowlight:"^3.3.0","lru-cache":"^11.5.2",nanoid:"^5.1.6",open:"^10.1.2",picomatch:"^4.0.5",playwright:"1.62.1","proper-lockfile":"^4.1.2",react:"19.2.4","react-dom":"19.2.4",semver:"^7.8.5","string-width":"^8.2.2",typebox:"1.3.10",undici:"^7.16.0","vscode-jsonrpc":"8.2.1","vscode-languageserver-protocol":"3.17.5","vscode-languageserver-types":"3.17.5","write-file-atomic":"^7.0.0",ws:"^8.21.2",yaml:"^2.9.0",yargs:"^18.1.0",zustand:"^5.0.14"},devDependencies:{"@biomejs/biome":"2.5.7","@types/bun":"^1.3.14","@types/json-schema":"^7.0.15","@types/lodash-es":"^4.17.12","@types/node":"^22.15.24","@types/picomatch":"^4.0.3","@types/proper-lockfile":"^4.1.4","@types/react":"19.2.10","@types/react-dom":"19.2.3","@types/semver":"^7.8.0","@types/write-file-atomic":"^4.0.3","@types/ws":"^8.18.1","@types/yargs":"^17.0.35","@vitest/coverage-v8":"^4.1.10",jsdom:"^26.0.0",typescript:"^5.9.2",vitest:"^4.1.10"}};var s;function r(){if(s)return s;let i=o(a(import.meta.url));for(let n=0;n<5;n++){try{let t=JSON.parse(l(u(i,"package.json"),"utf8"));if(t.name===e.name&&typeof t.version==="string"&&typeof t.description==="string")return s=t,s}catch{}i=o(i)}return s={name:e.name,version:process.env.BLADE_VERSION??e.version,description:e.description},s}function y(){return{...r()}}function p(){return r().version}function v(){return r().name}function g(){return r().description}function f(){return`v${p()}`}function w(){return`v${p()} © 2025 Blade Code`}
|
|
2
2
|
export{y as Ai,p as Bi,v as Ci,g as Di,f as Ei,w as Fi};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{eh as H,fh as I}from"./chunk-
|
|
1
|
+
import{eh as H,fh as I}from"./chunk-19xfer55.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,4 +1,4 @@
|
|
|
1
|
-
import{a as T,b as W,c as X,d as Y}from"./chunk-
|
|
1
|
+
import{a as T,b as W,c as X,d as Y}from"./chunk-m4wnqx0e.js";import"./chunk-j00px1es.js";import"./chunk-39qzk9nm.js";import"./chunk-rkk39efr.js";import"./chunk-fn9cse83.js";import"./chunk-1wgese5c.js";import"./chunk-6r6yzw44.js";import"./chunk-0zhdjaen.js";import"./chunk-fpx3462x.js";import"./chunk-yx4802a0.js";import"./chunk-9n5ystr6.js";import"./chunk-8hprmrd5.js";import"./chunk-6yezrqe7.js";import"./chunk-s0tq8gyx.js";import"./chunk-hpjnk87v.js";import{ve as R}from"./chunk-pdqczfn3.js";import"./chunk-rej5bbbs.js";import{Re as Q}from"./chunk-b8n5mx53.js";import"./chunk-v508x7cg.js";import"./chunk-dg0d3303.js";import"./chunk-3awjdsef.js";import"./chunk-53xtssbf.js";import"./chunk-2hb222re.js";import"./chunk-cpk84yrx.js";import"./chunk-kt5jqaxp.js";import"./chunk-00rps629.js";import"./chunk-qcy79mva.js";import"./chunk-p0rvgzpx.js";import"./chunk-6kb69vkx.js";import"./chunk-c6tq09mt.js";import"./chunk-19xfer55.js";import"./chunk-f9asjkfz.js";import"./chunk-czcxx8tb.js";import"./chunk-maebpz1j.js";import"./chunk-9sx3vsyj.js";import"./chunk-70hwyc2w.js";import"./chunk-d8wzc602.js";import"./chunk-425p4nwx.js";import"./chunk-k7vv9vne.js";import{Bi as M}from"./chunk-qw57eqns.js";import"./chunk-cp7xsjj2.js";import"./chunk-2va6ex5v.js";import"./chunk-q3vza5gt.js";import"./chunk-w9xfks7f.js";import m from"chalk";import K from"open";var A=`
|
|
2
2
|
____ _ _
|
|
3
3
|
| __ )| | __ _ __| | ___
|
|
4
4
|
| _ \\| |/ _\` |/ _\` |/ _ \\
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./chunk-v508x7cg.js";import{vh as Q}from"./chunk-
|
|
2
|
-
`);try{let{rebuildProjectionIndex:z}=await import("./chunk-qjeadpj2.js"),{SessionService:B}=await import("./chunk-
|
|
1
|
+
import"./chunk-v508x7cg.js";import{vh as Q}from"./chunk-19xfer55.js";import"./chunk-f9asjkfz.js";import"./chunk-czcxx8tb.js";import"./chunk-maebpz1j.js";import{Nh as L}from"./chunk-9sx3vsyj.js";import"./chunk-70hwyc2w.js";import"./chunk-d8wzc602.js";import"./chunk-425p4nwx.js";import"./chunk-k7vv9vne.js";import"./chunk-qw57eqns.js";import"./chunk-cp7xsjj2.js";import"./chunk-2va6ex5v.js";import"./chunk-q3vza5gt.js";import{Vi as F}from"./chunk-w9xfks7f.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-qjeadpj2.js"),{SessionService:B}=await import("./chunk-kfmh3t1r.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{Bi as d,Di as h}from"./chunk-
|
|
1
|
+
import{Bi as d,Di as h}from"./chunk-qw57eqns.js";var q={debug:{alias:"d",type:"string",describe:'Enable debug mode with optional category filtering (e.g., "agent,ui" or "!chat,!loop")',group:"Debug Options:"},model:{type:"string",describe:"Override the current run model using a model config ID (TUI / print / headless)",group:"AI Options:"},print:{alias:"p",type:"boolean",describe:"Print response and exit (useful for pipes)",group:"Output Options:"},headless:{type:"boolean",describe:"Run full agent loop without Ink UI and print all events to the terminal",group:"Output Options:"},"output-format":{alias:["outputFormat"],type:"string",choices:["text","json","stream-json","jsonl"],default:"text",describe:"Output format: --print supports text|json|stream-json; --headless supports text|jsonl",group:"Output Options:"},"json-schema":{alias:["jsonSchema"],type:"string",describe:"Inline JSON Schema for the turn-scoped structured final response",group:"Output Options:"},"output-schema":{alias:["outputSchema"],type:"string",describe:"Path to a JSON Schema file for the structured final response",group:"Output Options:"},"include-partial-messages":{alias:["includePartialMessages"],type:"boolean",describe:"Include partial message chunks as they arrive",group:"Output Options:"},"input-format":{alias:["inputFormat"],type:"string",choices:["text","stream-json"],default:"text",describe:"Input format",group:"Input Options:"},"replay-user-messages":{alias:["replayUserMessages"],type:"boolean",describe:"Re-emit user messages from stdin",group:"Input Options:"},"allowed-tools":{alias:["allowedTools"],type:"array",string:!0,describe:"Comma or space-separated list of tool names to allow",group:"Security Options:"},"disallowed-tools":{alias:["disallowedTools"],type:"array",string:!0,describe:"Comma or space-separated list of tool names to deny",group:"Security Options:"},"mcp-config":{alias:["mcpConfig"],type:"array",string:!0,describe:"Load MCP servers from JSON files or strings",group:"MCP Options:"},"system-prompt":{alias:["systemPrompt"],type:"string",describe:"System prompt to use for the session (replaces default)",group:"AI Options:"},"append-system-prompt":{alias:["appendSystemPrompt"],type:"string",describe:"Append a system prompt to the default system prompt",group:"AI Options:"},"max-turns":{alias:["maxTurns"],type:"number",describe:"Maximum conversation turns (-1: unlimited, 0: disable chat, N>0: limit to N turns)",group:"AI Options:",default:void 0},"max-concurrent-tasks":{alias:["maxConcurrentTasks"],type:"number",describe:"Maximum top-level tasks running concurrently in this process",group:"AI Options:",default:void 0},"max-queued-tasks":{alias:["maxQueuedTasks"],type:"number",describe:"Maximum top-level tasks waiting for an admission slot",group:"AI Options:",default:void 0},"max-queued-task-bytes":{alias:["maxQueuedTaskBytes"],type:"number",describe:"Maximum retained bytes across queued top-level tasks",group:"AI Options:",default:void 0},"max-resident-session-runtimes":{alias:["maxResidentSessionRuntimes"],type:"number",describe:"Maximum initialized Session runtimes resident in this process",group:"AI Options:",default:void 0},"session-runtime-idle-ms":{alias:["sessionRuntimeIdleMs"],type:"number",describe:"Idle time before an evictable Web Session runtime is disposed",group:"AI Options:",default:void 0},"permission-mode":{alias:["permissionMode"],type:"string",choices:["default","autoEdit","yolo","plan"],describe:"Permission mode (default: ask for non-read tools, autoEdit: auto-approve edits, yolo: auto-approve all, plan: reserved)",group:"Security Options:"},yolo:{type:"boolean",describe:"Auto-approve all tools (shortcut for --permission-mode=yolo)",group:"Security Options:"},"trust-workspace":{alias:["trustWorkspace"],type:"boolean",describe:"Trust the current workspace before loading project models, MCP, LSP, permissions, or plugins",group:"Security Options:"},continue:{alias:"c",type:"boolean",describe:"Continue the most recent conversation",group:"Session Options:"},resume:{alias:"r",describe:"Resume a conversation - provide a session ID or interactively select a conversation to resume",group:"Session Options:",coerce:(b)=>{if(b===void 0||b===!0||b==="")return"true";return String(b)}},"fork-session":{alias:["forkSession"],type:"boolean",describe:"Create a new session ID when resuming",group:"Session Options:"},settings:{type:"string",describe:"Path to a settings JSON file or JSON string",group:"Configuration:"},"add-dir":{alias:["addDir"],type:"array",string:!0,describe:"Additional directories to allow tool access to",group:"Security Options:"},ide:{type:"boolean",describe:"Automatically connect to IDE on startup",group:"Integration:"},acp:{type:"boolean",describe:"Run in ACP (Agent Client Protocol) mode for IDE integration",group:"Integration:"},"strict-mcp-config":{alias:["strictMcpConfig"],type:"boolean",describe:"Only use MCP servers from --mcp-config",group:"MCP Options:"},"session-id":{alias:["sessionId"],type:"string",describe:"Use a specific session ID for the conversation",group:"Session Options:"},agents:{type:"string",describe:"JSON object defining custom agents",group:"AI Options:"},"setting-sources":{alias:["settingSources"],type:"string",describe:"Comma-separated list of setting sources to load",group:"Configuration:"},"plugin-dir":{alias:["pluginDir"],type:"array",string:!0,describe:"Load plugins from specified directories",group:"Plugin Options:"}},w={scriptName:"blade",usage:"$0 [command] [options]",description:h(),version:d(),locale:"en",showHelpOnFail:!0,demandCommand:!1,recommendCommands:!0,strict:!1};
|
|
2
2
|
export{q as oe,w as pe};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Bb as d,Cb as e,Db as f,Eb as g,Fb as h,Gb as i,Hb as j,Ib as k,Pb as l,Qb as m,Rb as n,Sb as o,Ub as p,Vb as q,Wb as r,ub as a,vb as b,xb as c}from"./chunk-
|
|
1
|
+
import{Bb as d,Cb as e,Db as f,Eb as g,Fb as h,Gb as i,Hb as j,Ib as k,Pb as l,Qb as m,Rb as n,Sb as o,Ub as p,Vb as q,Wb as r,ub as a,vb as b,xb as c}from"./chunk-9n5ystr6.js";import"./chunk-8hprmrd5.js";import"./chunk-6yezrqe7.js";import"./chunk-s0tq8gyx.js";import"./chunk-hpjnk87v.js";import"./chunk-dg0d3303.js";import"./chunk-3awjdsef.js";import"./chunk-2hb222re.js";import"./chunk-00rps629.js";import"./chunk-qcy79mva.js";import"./chunk-6kb69vkx.js";import"./chunk-c6tq09mt.js";import"./chunk-f9asjkfz.js";import"./chunk-czcxx8tb.js";import"./chunk-maebpz1j.js";import"./chunk-9sx3vsyj.js";import"./chunk-70hwyc2w.js";import"./chunk-d8wzc602.js";import"./chunk-425p4nwx.js";import"./chunk-k7vv9vne.js";import"./chunk-qw57eqns.js";import"./chunk-2va6ex5v.js";import"./chunk-q3vza5gt.js";import"./chunk-w9xfks7f.js";export{g as saveUserMessage,i as saveToolUse,j as saveToolResult,k as saveCompaction,h as saveAssistantMessage,d as isRootSystemPrompt,m as handleTaskListUpdate,n as handleSkillActivation,o as extractModelSwitch,r as executeLoopGenerator,f as drainLoop,c as checkStopHook,a as checkOutputRecovery,b as checkIncompleteIntent,q as checkAndCompactInLoop,p as applyToolDomainEffects,l as StreamingToolExecutor,e as ConversationState};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{sf as a,tf as b,uf as c}from"./chunk-
|
|
1
|
+
import{sf as a,tf as b,uf as c}from"./chunk-cpk84yrx.js";import"./chunk-19xfer55.js";import"./chunk-f9asjkfz.js";import"./chunk-czcxx8tb.js";import"./chunk-maebpz1j.js";import"./chunk-9sx3vsyj.js";import"./chunk-70hwyc2w.js";import"./chunk-d8wzc602.js";import"./chunk-425p4nwx.js";import"./chunk-k7vv9vne.js";import"./chunk-qw57eqns.js";import"./chunk-cp7xsjj2.js";import"./chunk-2va6ex5v.js";import"./chunk-q3vza5gt.js";import"./chunk-w9xfks7f.js";export{c as snapshotWorkspaceModelResources,b as resolveWorkspaceModelResources,a as cloneWorkspaceModelConfig};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Bh as Q,Ch as X,Dh as U,Eh as Z}from"./chunk-czcxx8tb.js";import{Fh as N,Gh as h,Ih as d}from"./chunk-maebpz1j.js";import{ni as a}from"./chunk-d8wzc602.js";import{Ti as i}from"./chunk-q3vza5gt.js";var b=[{min:0,max:59},{min:0,max:23},{min:1,max:31},{min:1,max:12},{min:0,max:7}],T={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6},E=new Map;function D($,J,K){let B=new Set;for(let W of $.split(",")){let[Y,O]=W.split("/"),V=O?Number.parseInt(O,10):1;if(!Number.isInteger(V)||V<1)throw Error(`Invalid cron step in "${$}"`);let j=J,H=K;if(Y!=="*"&&Y!=="")if(Y.includes("-")){let[k,r]=Y.split("-");j=Number.parseInt(k,10),H=Number.parseInt(r,10)}else j=Number.parseInt(Y,10),H=j;if(!Number.isInteger(j)||!Number.isInteger(H)||j<J||H>K||j>H)throw Error(`Invalid cron range "${Y}" in field "${$}"`);for(let k=j;k<=H;k+=V)B.add(k)}return B}function R($){let J=$.trim().split(/\s+/);if(J.length!==5)throw Error(`Cron expression must have 5 fields (min hour dom mon dow), got ${J.length}`);let[K,B,W,Y,O]=J,V=D(O,b[4].min,b[4].max),j=new Set([...V].map((H)=>H===7?0:H));return{minutes:D(K,b[0].min,b[0].max),hours:D(B,b[1].min,b[1].max),daysOfMonth:D(W,b[2].min,b[2].max),months:D(Y,b[3].min,b[3].max),daysOfWeek:j,domRestricted:W.trim()!=="*",dowRestricted:O.trim()!=="*"}}function y($,J){if(!J)return{minute:$.getMinutes(),hour:$.getHours(),dayOfMonth:$.getDate(),month:$.getMonth()+1,dayOfWeek:$.getDay()};let K=E.get(J);if(!K)K=new Intl.DateTimeFormat("en-US",{timeZone:J,month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",weekday:"short",hourCycle:"h23"}),E.set(J,K);let B=Object.fromEntries(K.formatToParts($).filter((W)=>W.type!=="literal").map((W)=>[W.type,W.value]));return{minute:Number(B.minute),hour:Number(B.hour),dayOfMonth:Number(B.day),month:Number(B.month),dayOfWeek:T[B.weekday]??-1}}function p($,J,K){let B=y(J,K);if(!$.minutes.has(B.minute))return!1;if(!$.hours.has(B.hour))return!1;if(!$.months.has(B.month))return!1;let W=$.daysOfMonth.has(B.dayOfMonth),Y=$.daysOfWeek.has(B.dayOfWeek);if($.domRestricted&&$.dowRestricted)return W||Y;if($.domRestricted)return W;if($.dowRestricted)return Y;return!0}function e($,J,K){let B=R($),W=new Date(J.getTime());W.setSeconds(0,0),W.setMinutes(W.getMinutes()+1);let Y=new Date(J.getTime());Y.setFullYear(Y.getFullYear()+4);while(W.getTime()<=Y.getTime()){if(p(B,W,K))return new Date(W.getTime());W.setMinutes(W.getMinutes()+1)}return null}var S={s:1000,m:60000,h:3600000,d:86400000};function F1($){let K=$.trim().toLowerCase().match(/^(\d+)\s*([smhd]?)$/);if(!K)return null;let B=Number.parseInt(K[1],10);if(!Number.isInteger(B)||B<=0)return null;let W=K[2]||"m";return B*S[W]}function Q1($){for(let J of["d","h","m","s"]){let K=S[J];if($%K===0)return`${$/K}${J}`}return`${Math.round($/1000)}s`}function F($,J,K){switch($.kind){case"cron":{if(!$.cron)return null;try{return e($.cron,J,$.timezone)}catch{return null}}case"interval":{if(!$.intervalMs||$.intervalMs<=0)return null;let W=new Date((K??J).getTime()+$.intervalMs);return W.getTime()<=J.getTime()?new Date(J.getTime()+1000):W}case"once":{if(!$.runAt)return null;let B=new Date($.runAt);if(Number.isNaN(B.getTime()))return null;return B.getTime()>J.getTime()?B:null}default:return null}}function z($){switch($.kind){case"cron":if(!$.cron)return"cron trigger requires a cron expression";try{if(R($.cron),$.timezone)new Intl.DateTimeFormat("en-US",{timeZone:$.timezone}).format();return null}catch(J){return J instanceof Error?J.message:"invalid cron expression"}case"interval":if(!$.intervalMs||$.intervalMs<60000)return"interval trigger requires intervalMs >= 60000 (1 minute)";return null;case"once":{if(!$.runAt)return"once trigger requires runAt timestamp";let J=new Date($.runAt);if(Number.isNaN(J.getTime()))return"once trigger runAt is not a valid date";return null}default:return"unknown trigger kind"}}function z1($){switch($.kind){case"cron":return`cron: ${$.cron??"?"}`;case"interval":return`every ${$.intervalMs?Q1($.intervalMs):"?"}`;case"once":return`once at ${$.runAt??"?"}`;default:return"unknown"}}import{mkdir as P1,readFile as I1}from"node:fs/promises";import t from"node:path";import{nanoid as L1}from"nanoid";import D1 from"write-file-atomic";var l=16384;function v1($){let J=/^\s*\/btw(?:\s+([\s\S]*))?\s*$/iu.exec($);if(!J)return;return{question:(J[1]??"").trim()}}var w=X(Z(["default","autoEdit","yolo","plan"]));var v=X(Z(["user","assistant","system","tool"])),$1=X(Q.Union([Q.Object({type:Q.Literal("text"),text:Q.String()}),Q.Object({type:Q.Literal("image_url"),image_url:Q.Object({url:Q.String()})})])),m=Q.Union([Q.String(),Q.Array($1)]),R1=X(Q.Object({id:Q.String(),role:v,content:m,timestamp:Q.Number(),metadata:Q.Optional(Q.Record(Q.String(),Q.Unknown())),thinkingContent:Q.Optional(Q.String()),tool_call_id:Q.Optional(Q.String()),name:Q.Optional(Q.String()),tool_calls:Q.Optional(Q.Unknown())})),J1=X(Z(["queued","running","completed","failed","cancelled","interrupted"])),A=X(Z(["local","worktree"])),x=X(Z(["high","medium","low"])),C=X(Z(["feature","bug","maintenance","research"])),X1=X(Z(["applied","discarded","conflicted"])),Z1=X(Q.Object({status:X1,updatedAt:Q.String(),sourceCommit:Q.Optional(Q.String()),changedFiles:Q.Optional(Q.Integer({minimum:0})),message:Q.Optional(Q.String())})),B1=X(Q.Object({changedFiles:Q.Integer({minimum:0}),additions:Q.Integer({minimum:0}),deletions:Q.Integer({minimum:0}),commits:Q.Integer({minimum:0})})),K1=X(Q.Object({path:Q.String({minLength:1}),patch:Q.String({maxLength:2097152}),additions:Q.Integer({minimum:0}),deletions:Q.Integer({minimum:0}),binary:Q.Boolean(),truncated:Q.Boolean()})),S1=X(Q.Object({sessionId:Q.String(),projectPath:Q.String(),baseCommit:Q.String(),files:Q.Array(K1,{maxItems:100}),truncated:Q.Boolean()})),W1=Q.Union([Q.String(),Q.Number(),Q.Boolean(),Q.Array(Q.String())]),Y1=X(Q.Object({name:Q.String(),type:Z(["string","number","integer","boolean","select","multi-select"]),title:Q.String(),description:Q.Optional(Q.String()),required:Q.Boolean(),defaultValue:Q.Optional(W1),options:Q.Optional(Q.Array(Q.Object({value:Q.String(),label:Q.String()}))),format:Q.Optional(Z(["date","uri","email","date-time"])),minimum:Q.Optional(Q.Number()),maximum:Q.Optional(Q.Number()),minLength:Q.Optional(Q.Number()),maxLength:Q.Optional(Q.Number()),minItems:Q.Optional(Q.Number()),maxItems:Q.Optional(Q.Number())})),l1=X(Q.Object({serverName:Q.String(),mode:Z(["form","url"]),message:Q.String(),fields:Q.Optional(Q.Array(Y1)),requestedSchema:Q.Optional(Q.Record(Q.String(),Q.Unknown())),url:Q.Optional(Q.String()),domain:Q.Optional(Q.String()),elicitationId:Q.Optional(Q.String())})),H1=X(Q.Object({type:Z(["permission","question","elicitation"]),requestId:Q.String()})),j1=X(Q.Object({code:Z(["authentication","permission","rate_limit","timeout","network","model_unavailable","context_limit","unsupported_input","workspace_unavailable","capacity","runtime"]),message:Q.String({minLength:1,maxLength:500}),retryable:Q.Boolean(),resource:Q.Optional(Z(["pending_count","pending_bytes","resident_runtimes"]))})),M=X(Z(["auto","off","minimal","low","medium","high","xhigh","max"])),P=X(Z(["auto","standard","fast","flex"])),I=X(Z(["auto","low","medium","high"])),G=X(Q.Union([Z(["auto","pragmatic","friendly","explanatory"]),Q.String({minLength:7,maxLength:300,pattern:"^(?:(?:user|project):[a-z0-9][a-z0-9._-]{0,63}(?::[a-z0-9][a-z0-9._-]{0,63}){0,3}|plugin:[a-z0-9][a-z0-9._-]{0,63}:[a-z0-9][a-z0-9._-]{0,63}(?::[a-z0-9][a-z0-9._-]{0,63}){0,3})$"})])),_=X(Q.Object({sessionId:Q.String(),projectPath:Q.String(),title:Q.Optional(Q.String()),gitBranch:Q.Optional(Q.String()),rootId:Q.String(),parentId:Q.Optional(Q.String()),relationType:Q.Optional(Z(["subagent","fork"])),resumedFrom:Q.Optional(Q.String()),rootAgentId:Q.Optional(Q.String()),resumeDepth:Q.Optional(Q.Integer({minimum:0})),taskStatus:U(J1,"completed"),taskStatusReason:Q.Optional(Q.String()),taskFailure:Q.Optional(j1),taskStartedAt:Q.Optional(Q.String()),taskCompletedAt:Q.Optional(Q.String()),taskPromptSummary:Q.Optional(Q.String()),taskPriority:Q.Optional(x),taskKind:Q.Optional(C),taskDueAt:Q.Optional(Q.String()),taskModelId:Q.Optional(Q.String()),selectedModelId:Q.Optional(Q.String()),permissionMode:Q.Optional(w),reasoningEffort:Q.Optional(M),serviceTier:Q.Optional(P),responseVerbosity:Q.Optional(I),communicationStyle:Q.Optional(G),communicationStyleDigest:Q.Optional(Q.String({pattern:"^[a-f0-9]{64}$"})),projectInstructionsDigest:Q.Optional(Q.String({pattern:"^[a-f0-9]{64}$"})),taskRetryAvailable:Q.Optional(Q.Boolean()),taskRetriedFrom:Q.Optional(Q.Object({sessionId:Q.String(),projectPath:Q.String()})),taskDelivery:Q.Optional(Z1),taskIsolation:Q.Optional(A),taskSourceProjectPath:Q.Optional(Q.String()),taskWorktreePath:Q.Optional(Q.String()),taskWorktreeBranch:Q.Optional(Q.String()),taskBaseCommit:Q.Optional(Q.String()),taskDiffStat:Q.Optional(B1),taskQueuePosition:Q.Optional(Q.Integer({minimum:1})),taskQueueDepth:Q.Optional(Q.Integer({minimum:0})),taskConcurrencyLimit:Q.Optional(Q.Integer({minimum:1})),archivedAt:Q.Optional(Q.String()),archivedBySessionId:Q.Optional(Q.String()),pendingInteraction:Q.Optional(H1),messageCount:Q.Number(),firstMessageTime:Q.String(),lastMessageTime:Q.String(),hasErrors:Q.Boolean()})),u1=X(Q.Object({sessions:Q.Array(_),nextCursor:Q.Optional(Q.String())})),h1=X(Q.Object({session:_,archivedSessionIds:Q.Array(Q.String())})),d1=X(Q.Object({session:_,restoredSessionIds:Q.Array(Q.String())})),m1=X(Q.Object({version:Q.Union([Q.Literal(1),Q.Literal(2)]),sessionId:Q.String(),goalId:Q.String(),objective:Q.String(),status:Z(["active","verifying","paused","blocked","usage_limited","budget_limited","complete"]),tokenBudget:Q.Optional(Q.Number()),tokensUsed:Q.Number(),timeUsedSeconds:Q.Number(),continuationCount:Q.Number(),statusReason:Q.Optional(Q.String()),completionVerification:Q.Optional(Q.Object({attempt:Q.Integer({minimum:1}),status:Z(["pending","pass","fail","partial"]),requestedAt:Q.String(),completedAt:Q.Optional(Q.String()),verifierSessionId:Q.Optional(Q.String()),summary:Q.Optional(Q.String()),evidenceSha256:Q.Optional(Q.String({pattern:"^[a-f0-9]{64}$"}))})),prematureStop:Q.Optional(Q.Object({pattern:Q.Unsafe({type:"string"}),consecutiveCount:Q.Integer({minimum:1}),detectedAt:Q.String()})),verificationStall:Q.Optional(Q.Unsafe({type:"object"})),executionFrontier:Q.Optional(Q.Object({taskListId:Q.String({minLength:1,maxLength:256}),total:Q.Integer({minimum:0}),completed:Q.Integer({minimum:0}),inProgress:Q.Integer({minimum:0}),pending:Q.Integer({minimum:0}),blocked:Q.Integer({minimum:0}),nextTask:Q.Optional(Q.Object({id:Q.String({minLength:1}),subject:Q.String({minLength:1,maxLength:512}),priority:Z(["high","medium","low"])})),digestSha256:Q.String({pattern:"^[a-f0-9]{64}$"}),observedAt:Q.String()})),createdAt:Q.String(),updatedAt:Q.String()})),c=X(Q.Object({role:v,content:m,metadata:Q.Optional(Q.Unknown()),reasoningContent:Q.Optional(Q.String()),thinkingContent:Q.Optional(Q.String()),tool_call_id:Q.Optional(Q.String()),name:Q.Optional(Q.String()),tool_calls:Q.Optional(Q.Unknown())})),c1=X(Q.Object({session:_,messages:Q.Array(c)})),n=X(Z(["conversation","code","both"])),U1=X(Q.Object({messageId:Q.String(),preview:Q.String(),createdAt:Q.String(),fileCount:Q.Integer({minimum:0})})),n1=X(Q.Object({targetMessageId:Q.String({minLength:1}),mode:U(n,"conversation")})),g1=X(Q.Object({checkpoint:U1,mode:n,removedTurns:Q.Integer({minimum:1}),restoredFiles:Q.Array(Q.String()),messages:Q.Array(c)})),k1=Z(["running","completed","failed","cancelled"]),u=X(Q.Object({id:Q.String(),subagentType:Q.String(),description:Q.String(),status:k1,background:Q.Boolean(),rootAgentId:Q.String(),resumedFrom:Q.Optional(Q.String()),resumeDepth:Q.Integer({minimum:0}),createdAt:Q.Number(),lastActiveAt:Q.Number(),completedAt:Q.Optional(Q.Number()),restartRecovery:Q.Optional(Q.Object({outcome:Z(["completed","interrupted","failed"]),recoveredAt:Q.Number()})),result:Q.Optional(Q.Object({success:Q.Boolean(),message:Q.String(),error:Q.Optional(Q.String()),verificationCommands:Q.Optional(Q.Array(Q.String())),verificationVerdict:Q.Optional(Z(["pass","fail","partial"])),modifiedFiles:Q.Optional(Q.Array(Q.String()))})),stats:Q.Optional(Q.Object({tokens:Q.Optional(Q.Number()),toolCalls:Q.Optional(Q.Number()),duration:Q.Optional(Q.Number())}))})),o1=X(Q.Object({prompt:Q.String({minLength:1,maxLength:32000,pattern:"\\S"})})),s1=X(Q.Object({source:u,session:u})),i1=X(Q.Object({sessionId:Q.String(),projectPath:Q.String()})),a1=X(Q.Object({path:Q.String(),name:Q.String(),gitBranch:Q.Optional(Q.String()),available:Q.Boolean(),isCurrent:Q.Boolean(),boundAt:Q.String()})),t1=X(Q.Union([Q.Object({cancelled:Q.Literal(!0)}),Q.Object({cancelled:Q.Literal(!1),path:Q.String({minLength:1})})])),r1=X(Q.Object({type:Q.String(),seq:Q.Optional(Q.Number()),properties:Q.Record(Q.String(),Q.Unknown())})),g=Q.Object({type:Z(["file","image","url"]),path:Q.Optional(Q.String()),url:Q.Optional(Q.String()),content:Q.Optional(Q.String({maxLength:h})),mimeType:Q.Optional(Q.String()),name:Q.Optional(Q.String())}),o=Q.Record(Q.String(),Q.Unknown()),T1=X(Q.Object({prompt:Q.String({minLength:1,maxLength:32000,pattern:"\\S"}),title:Q.Optional(Q.String({minLength:1,maxLength:200})),taskPriority:U(x,"medium"),taskKind:U(C,"feature"),taskDueAt:Q.Optional(Q.String({minLength:1,maxLength:64})),projectPath:Q.Optional(Q.String()),modelId:Q.Optional(Q.String({minLength:1,maxLength:500})),reasoningEffort:Q.Optional(M),serviceTier:Q.Optional(P),responseVerbosity:Q.Optional(I),communicationStyle:Q.Optional(G),isolation:U(A,"worktree"),permissionMode:U(w,"default"),attachments:Q.Optional(Q.Array(g,{maxItems:N})),outputSchema:Q.Optional(o)})),y1=X(Q.Object({title:Q.Optional(Q.String({minLength:1,maxLength:200})),taskPriority:Q.Optional(x),taskKind:Q.Optional(C),taskDueAt:Q.Optional(Q.Union([Q.String({minLength:1,maxLength:64}),Q.Null()]))})),p1=X(Q.Object({session:_,runId:Q.String(),messageId:Q.String(),status:Z(["queued","running"]),queuePosition:Q.Optional(Q.Integer({minimum:1})),queueDepth:Q.Optional(Q.Integer({minimum:0})),maxConcurrentTasks:Q.Optional(Q.Integer({minimum:1}))})),e1=X(Q.Object({action:Z(["apply","discard"])})),q=X(Q.Object({kind:Z(["cron","interval","once"]),cron:Q.Optional(Q.String({minLength:1,maxLength:120})),intervalMs:Q.Optional(Q.Integer({minimum:60000})),runAt:Q.Optional(Q.String({minLength:1,maxLength:40})),timezone:Q.Optional(Q.String({minLength:1,maxLength:80}))})),O1=X(Q.Object({modelId:Q.Optional(Q.String({minLength:1,maxLength:500})),reasoningEffort:Q.Optional(M),serviceTier:Q.Optional(P),responseVerbosity:Q.Optional(I),communicationStyle:Q.Optional(G),isolation:U(A,"worktree"),permissionMode:U(w,"default")})),f=X(Q.Object({id:Q.String(),title:Q.Optional(Q.String({minLength:1,maxLength:200})),prompt:Q.String({minLength:1,maxLength:32000,pattern:"\\S"}),projectPath:Q.String({minLength:1}),trigger:q,dispatch:O1,enabled:Q.Boolean(),createdAt:Q.String(),updatedAt:Q.String(),nextRunAt:Q.Union([Q.String(),Q.Null()]),expiresAt:Q.Union([Q.String(),Q.Null()]),lastRunAt:Q.Optional(Q.String()),lastRunSessionId:Q.Optional(Q.String()),lastStatus:Q.Optional(Z(["queued","running","completed","failed","cancelled","interrupted","error"])),lastError:Q.Optional(Q.String()),runCount:Q.Integer({minimum:0})})),QQ=X(Q.Object({title:Q.Optional(Q.String({minLength:1,maxLength:200})),prompt:Q.String({minLength:1,maxLength:32000,pattern:"\\S"}),projectPath:Q.String({minLength:1}),trigger:q,modelId:Q.Optional(Q.String({minLength:1,maxLength:500})),reasoningEffort:Q.Optional(M),serviceTier:Q.Optional(P),responseVerbosity:Q.Optional(I),communicationStyle:Q.Optional(G),isolation:U(A,"worktree"),permissionMode:U(w,"default"),enabled:U(Q.Boolean(),!0)})),$Q=X(Q.Object({title:Q.Optional(Q.String({minLength:1,maxLength:200})),prompt:Q.Optional(Q.String({minLength:1,maxLength:32000,pattern:"\\S"})),trigger:Q.Optional(q),modelId:Q.Optional(Q.String({minLength:1,maxLength:500})),reasoningEffort:Q.Optional(M),serviceTier:Q.Optional(P),responseVerbosity:Q.Optional(I),communicationStyle:Q.Optional(G),isolation:Q.Optional(A),permissionMode:Q.Optional(w),enabled:Q.Optional(Q.Boolean())})),JQ=X(Q.Object({schedules:Q.Array(f)})),XQ=X(Q.Object({content:Q.String({maxLength:d}),projectPath:Q.Optional(Q.String()),modelId:Q.Optional(Q.String({minLength:1,maxLength:500})),reasoningEffort:Q.Optional(M),serviceTier:Q.Optional(P),responseVerbosity:Q.Optional(I),communicationStyle:Q.Optional(G),permissionMode:Q.Optional(w),attachments:Q.Optional(Q.Array(g,{maxItems:N})),outputSchema:Q.Optional(o)})),V1=Z(["completed","failed","aborted","timed_out","spawn_error"]),b1=X(Q.Object({version:Q.Literal(1),command:Q.String(),status:V1,exitCode:Q.Union([Q.Integer(),Q.Null()]),durationMs:Q.Number({minimum:0}),stdout:Q.String(),stderr:Q.String(),stdoutOmittedBytes:Q.Integer({minimum:0}),stderrOmittedBytes:Q.Integer({minimum:0}),binaryOutput:Q.Boolean(),truncated:Q.Boolean()})),ZQ=X(Q.Object({command:Q.String({minLength:1,maxLength:32768,pattern:"^(?![\\s\\S]*\\u0000)(?=[\\s\\S]*\\S)[\\s\\S]*$"}),projectPath:Q.Optional(Q.String())})),BQ=X(Q.Object({executionId:Q.String(),messageId:Q.String(),record:b1,auxiliary:Q.Boolean(),delivery:Q.Optional(Z(["current_turn","next_turn"])),queued:Q.Optional(Q.Integer({minimum:0}))})),KQ=X(Q.Object({question:Q.String({minLength:1,maxLength:l,pattern:"^(?![\\s\\S]*\\x00)(?=[\\s\\S]*\\S)[\\s\\S]*$"}),projectPath:Q.Optional(Q.String())})),WQ=X(Q.Object({response:Q.String({minLength:1}),durationMs:Q.Number({minimum:0}),modelId:Q.Optional(Q.String()),usage:Q.Optional(Q.Object({promptTokens:Q.Number({minimum:0}),completionTokens:Q.Number({minimum:0}),totalTokens:Q.Number({minimum:0}),reasoningTokens:Q.Optional(Q.Number({minimum:0})),cacheCreationInputTokens:Q.Optional(Q.Number({minimum:0})),cacheReadInputTokens:Q.Optional(Q.Number({minimum:0})),costUsd:Q.Optional(Q.Number({minimum:0}))}))})),YQ=X(Q.Object({projectPath:Q.String(),kind:Z(["uncommitted","base","commit"]),ref:Q.Optional(Q.String({maxLength:200})),instructions:Q.Optional(Q.String({maxLength:4000})),modelId:Q.Optional(Q.String({minLength:1,maxLength:200}))})),HQ=X(Q.Object({reviewId:Q.String(),status:Q.Literal("running")})),jQ=X(Q.Object({messageId:Q.String(),role:v,content:Q.String(),timestamp:Q.String()})),UQ=X(Q.Object({approved:Q.Boolean(),remember:Q.Optional(Q.Boolean()),scope:Q.Optional(Z(["once","session","project"])),targetMode:Q.Optional(w),feedback:Q.Optional(Q.String()),answers:Q.Optional(Q.Record(Q.String(),Q.Union([Q.String(),Q.Array(Q.String())]))),elicitation:Q.Optional(Q.Object({action:Z(["accept","decline","cancel"]),content:Q.Optional(Q.Record(Q.String(),Q.Union([Q.String({maxLength:4000}),Q.Number(),Q.Boolean(),Q.Array(Q.String({maxLength:1000}),{maxItems:100})]),{maxProperties:32}))}))})),G1=X(Q.Object({id:G,name:Q.String({minLength:1,maxLength:80}),description:Q.String({minLength:1,maxLength:256}),source:Z(["built-in","user","project","plugin"]),contentSha256:Q.Optional(Q.String({pattern:"^[a-f0-9]{64}$"}))})),kQ=X(Q.Object({id:Q.String(),displayName:Q.Optional(Q.String()),provider:Q.String(),model:Q.String(),contextWindow:Q.Optional(Q.Number()),maxTokens:Q.Optional(Q.Number()),reasoning:Q.Optional(Q.Boolean()),supportedReasoningEfforts:Q.Optional(Q.Array(Z(["off","minimal","low","medium","high","xhigh","max"]))),supportedServiceTiers:Q.Optional(Q.Array(Z(["standard","fast","flex"]))),supportedResponseVerbosities:Q.Optional(Q.Array(Z(["low","medium","high"]))),communicationStyles:Q.Optional(Q.Array(G1,{maxItems:36})),input:Q.Optional(Q.Array(Z(["text","image"]))),overrides:Q.Optional(Q.Object({baseUrl:Q.Optional(Q.String()),temperature:Q.Optional(Q.Number()),maxOutputTokens:Q.Optional(Q.Number()),timeout:Q.Optional(Q.Number()),streamIdleTimeout:Q.Optional(Q.Number({minimum:1000}))}))})),OQ=X(Z(["vs-dark","vs-light","hc-black"])),w1=X(Z(["light","dark","system"])),M1=X(Q.Object({language:Q.String(),codeTheme:Q.String(),uiTheme:w1,autoSaveSessions:Q.Boolean(),notifyBuild:Q.Boolean(),notifyErrors:Q.Boolean(),notifySounds:Q.Boolean(),privacyTelemetry:Q.Boolean(),privacyCrash:Q.Boolean(),agentTeamsEnabled:Q.Boolean(),communicationStyle:Q.Optional(G)})),VQ=X(Q.Partial(M1));var s=a("Service"),A1=1;function _1(){return t.join(i(),"schedules.json")}class L{filePath;static instance;static getInstance(){if(!L.instance)L.instance=new L;return L.instance}writeChain=Promise.resolve();constructor($=_1()){this.filePath=$}async readFile(){try{let $=await I1(this.filePath,"utf-8"),J=JSON.parse($);if(!J||!Array.isArray(J.schedules))return[];let K=[],B=0;for(let W of J.schedules){let Y=f.safeParse(W);if(Y.success)K.push(Y.data);else B+=1}if(B>0)s.warn(`[ScheduleStore] Ignored ${B} invalid persisted schedule(s)`);return K}catch($){let J=$;if(J.code!=="ENOENT")s.warn("[ScheduleStore] Failed to read schedules; treating as empty:",J);return[]}}async writeFile($){await P1(t.dirname(this.filePath),{recursive:!0,mode:493});let J={version:A1,schedules:$};await D1(this.filePath,JSON.stringify(J,null,2),{mode:384})}serializeWrite($){let J=this.writeChain.then($,$);return this.writeChain=J.then(()=>{return},()=>{return}),J}async list(){return this.readFile()}async get($){return(await this.readFile()).find((K)=>K.id===$)}async create($){return this.serializeWrite(async()=>{let J=$.trigger.kind==="cron"&&!$.trigger.timezone?{...$.trigger,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}:$.trigger,K=z(J);if(K)throw Error(K);let B=new Date;if(J.kind==="once"&&new Date(J.runAt).getTime()<=B.getTime())throw Error("once trigger runAt must be in the future");let W=B.toISOString(),Y=F(J,B),O={id:L1(10),title:$.title,prompt:$.prompt,projectPath:$.projectPath,trigger:J,dispatch:{modelId:$.modelId,reasoningEffort:$.reasoningEffort,serviceTier:$.serviceTier,responseVerbosity:$.responseVerbosity,communicationStyle:$.communicationStyle,isolation:$.isolation??"worktree",permissionMode:$.permissionMode??"default"},enabled:$.enabled??!0,createdAt:W,updatedAt:W,nextRunAt:Y?Y.toISOString():null,expiresAt:null,runCount:0},V=await this.readFile();return V.push(O),await this.writeFile(V),O})}async update($,J){return this.serializeWrite(async()=>{let K=await this.readFile(),B=K.findIndex((H)=>H.id===$);if(B===-1)return;let W=K[B];if(J.trigger){let H=J.trigger.kind==="cron"&&!J.trigger.timezone?{...J.trigger,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}:J.trigger,k=z(H);if(k)throw Error(k);if(H.kind==="once"&&new Date(H.runAt).getTime()<=Date.now())throw Error("once trigger runAt must be in the future");J={...J,trigger:H}}let Y={...W,...J,dispatch:J.dispatch?{...W.dispatch,...J.dispatch}:W.dispatch,updatedAt:new Date().toISOString()},O=!W.enabled,V=Y.enabled,j=J.trigger!==void 0;if((j||O&&V)&&J.nextRunAt===void 0){let H=new Date,k=F(Y.trigger,H);if(Y.nextRunAt=k?k.toISOString():null,j)Y.expiresAt=null}return K[B]=Y,await this.writeFile(K),Y})}async remove($){return this.serializeWrite(async()=>{let J=await this.readFile(),K=J.filter((B)=>B.id!==$);if(K.length===J.length)return!1;return await this.writeFile(K),!0})}async setEnabled($,J){return this.update($,{enabled:J})}}var NQ=L.getInstance();
|
|
2
|
+
export{l as Ia,v1 as Ja,F1 as Ka,F as La,z as Ma,z1 as Na,S1 as Oa,_ as Pa,n1 as Qa,o1 as Ra,T1 as Sa,y1 as Ta,p1 as Ua,e1 as Va,f as Wa,QQ as Xa,$Q as Ya,JQ as Za,XQ as _a,ZQ as $a,KQ as ab,YQ as bb,L as cb,NQ as db};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{te as s}from"./chunk-10taec1j.js";import{Me as o}from"./chunk-
|
|
1
|
+
import{te as s}from"./chunk-10taec1j.js";import{Me as o}from"./chunk-b8n5mx53.js";import{$g as j,Wg as y,Xg as D,Zg as N,ah as F,ch as R,gh as E,hh as _,ih as f,jh as C,lh as S,mh as m,qh as c,vh as l,wh as n}from"./chunk-19xfer55.js";import{xh as Y}from"./chunk-f9asjkfz.js";import{Bh as k,Eh as Z,zh as x}from"./chunk-czcxx8tb.js";import{Lh as X}from"./chunk-9sx3vsyj.js";import{$h as G,Ph as h,Qh as A,Wh as P,Xh as T,Zh as $,_h as U,bi as L,ci as M,ei as O,fi as I}from"./chunk-70hwyc2w.js";import{ni as d}from"./chunk-d8wzc602.js";import{promises as i}from"node:fs";import t from"node:path";var e=["systemPrompt","appendSystemPrompt","initialMessage","resumeSessionId","forkSession","allowedTools","disallowedTools","mcpConfigPaths","strictMcpConfig","model","addDirs","outputFormat","inputFormat","print","includePartialMessages","replayUserMessages","agentsConfig","settingSources"],v=new Set([...Object.keys(c),...e,"providerRequestConcurrency","providerGlobalConcurrency","providerOwnerConcurrency"]),W=k.Number({exclusiveMinimum:0}),z=k.String({minLength:1}),b=k.Array(k.String()),a=k.Object({currentModelId:k.Optional(k.String()),modelProviders:k.Optional(k.Record(z,k.Object({name:z,baseUrl:z,wireApi:Z(["openai-completions","anthropic-messages"]),apiKeyEnv:k.Optional(z)}))),models:k.Optional(k.Array(k.Object({id:z,displayName:k.Optional(z),provider:z,model:z,overrides:k.Optional(k.Object({baseUrl:k.Optional(k.String()),temperature:k.Optional(k.Number()),maxOutputTokens:k.Optional(W),timeout:k.Optional(W),streamIdleTimeout:k.Optional(k.Number({minimum:1000})),apiVersion:k.Optional(k.String()),customHeaders:k.Optional(k.Record(k.String(),k.String())),maxRetries:k.Optional(k.Integer({minimum:0})),enablePromptCaching:k.Optional(k.Boolean())})),fallbackModels:k.Optional(k.Array(k.Object({provider:z,model:z,configId:k.Optional(z)})))}))),temperature:k.Optional(k.Number()),maxOutputTokens:k.Optional(W),stream:k.Optional(k.Boolean()),topP:k.Optional(k.Number()),topK:k.Optional(k.Number()),timeout:k.Optional(W),bashForegroundHandoffMs:k.Optional(k.Union([k.Literal(0),k.Integer({minimum:y,maximum:D})])),providerForegroundRecoveryMs:k.Optional(k.Union([k.Literal(0),k.Integer({minimum:h,maximum:A})])),providerCircuitBreakerOpenMs:k.Optional(k.Union([k.Literal(0),k.Integer({minimum:P,maximum:T})])),providerRequestConcurrency:k.Optional(k.Integer({minimum:$,maximum:U})),providerGlobalConcurrency:k.Optional(k.Integer({minimum:$,maximum:G})),providerOwnerConcurrency:k.Optional(k.Integer({minimum:$,maximum:G})),providerRequestAdmissionMs:k.Optional(k.Union([k.Literal(0),k.Integer({minimum:L,maximum:M})])),providerRequestPendingBytes:k.Optional(k.Integer({minimum:O,maximum:I})),agentTeamsEnabled:k.Optional(k.Boolean()),codeTheme:k.Optional(k.String()),uiTheme:k.Optional(Z(["light","dark","system"])),language:k.Optional(k.String()),fontSize:k.Optional(W),autoSaveSessions:k.Optional(k.Boolean()),notifyBuild:k.Optional(k.Boolean()),notifyErrors:k.Optional(k.Boolean()),notifySounds:k.Optional(k.Boolean()),privacyTelemetry:k.Optional(k.Boolean()),privacyCrash:k.Optional(k.Boolean()),debug:k.Optional(k.Union([k.Boolean(),k.String()])),mcpEnabled:k.Optional(k.Boolean()),mcpServers:k.Optional(k.Record(k.String(),k.Record(k.String(),k.Unknown()))),lspServers:k.Optional(k.Record(z,k.Object({command:z,args:k.Optional(k.Array(k.String())),extensionToLanguage:k.Record(z,z),env:k.Optional(k.Record(k.String(),k.String())),initializationOptions:k.Optional(k.Unknown()),settings:k.Optional(k.Unknown()),enabled:k.Optional(k.Boolean()),priority:k.Optional(k.Integer()),startupTimeout:k.Optional(k.Integer({minimum:100})),shutdownTimeout:k.Optional(k.Integer({minimum:100})),requestTimeout:k.Optional(k.Integer({minimum:100})),diagnosticWaitTimeout:k.Optional(k.Integer({minimum:0})),maxRestarts:k.Optional(k.Integer({minimum:0,maximum:10}))}))),permissionMode:k.Optional(k.Enum(Y)),maxTurns:k.Optional(k.Integer({minimum:-1})),maxConcurrentTasks:k.Optional(k.Integer({minimum:E,maximum:_})),maxQueuedTasks:k.Optional(k.Integer({minimum:f,maximum:C})),maxQueuedTaskBytes:k.Optional(k.Integer({minimum:S,maximum:m})),maxResidentSessionRuntimes:k.Optional(k.Integer({minimum:N,maximum:j})),sessionRuntimeIdleMs:k.Optional(k.Integer({minimum:F,maximum:R})),systemPrompt:k.Optional(k.String()),appendSystemPrompt:k.Optional(k.String()),initialMessage:k.Optional(k.String()),resumeSessionId:k.Optional(k.String()),forkSession:k.Optional(k.Boolean()),allowedTools:k.Optional(k.Array(z)),disallowedTools:k.Optional(k.Array(z)),mcpConfigPaths:k.Optional(k.Array(z)),strictMcpConfig:k.Optional(k.Boolean()),model:k.Optional(z),addDirs:k.Optional(k.Array(z)),outputFormat:k.Optional(Z(["text","json","stream-json","jsonl"])),inputFormat:k.Optional(Z(["text","stream-json"])),print:k.Optional(k.Boolean()),includePartialMessages:k.Optional(k.Boolean()),replayUserMessages:k.Optional(k.Boolean()),agentsConfig:k.Optional(k.String()),settingSources:k.Optional(k.String()),permissions:k.Optional(k.Object({allow:k.Optional(b),ask:k.Optional(b),deny:k.Optional(b)})),env:k.Optional(k.Record(k.String(),k.String())),hooks:k.Optional(k.Record(k.String(),k.Unknown())),enabledPlugins:k.Optional(k.Record(z,k.Boolean())),pluginSourcePolicy:k.Optional(k.Object({restrictToAllowedSources:k.Optional(k.Boolean()),requireGitCommitSha:k.Optional(k.Boolean()),allowedGitHosts:k.Optional(k.Array(z)),allowedMarketplaces:k.Optional(k.Array(z)),allowedLocalRoots:k.Optional(k.Array(z))})),disableAllHooks:k.Optional(k.Boolean())}),g=[["systemPrompt","systemPrompt"],["appendSystemPrompt","appendSystemPrompt"],["initialMessage","initialMessage"],["resumeSessionId","sessionId"],["forkSession","forkSession"],["allowedTools","allowedTools"],["disallowedTools","disallowedTools"],["mcpConfigPaths","mcpConfig"],["strictMcpConfig","strictMcpConfig"],["model","model"],["addDirs","addDir"],["outputFormat","outputFormat"],["inputFormat","inputFormat"],["print","print"],["includePartialMessages","includePartialMessages"],["replayUserMessages","replayUserMessages"],["agentsConfig","agents"],["settingSources","settingSources"],["permissionMode","permissionMode"],["maxTurns","maxTurns"],["maxConcurrentTasks","maxConcurrentTasks"],["maxQueuedTasks","maxQueuedTasks"],["maxQueuedTaskBytes","maxQueuedTaskBytes"],["maxResidentSessionRuntimes","maxResidentSessionRuntimes"],["sessionRuntimeIdleMs","sessionRuntimeIdleMs"]];function V(q,B){let w;try{w=JSON.parse(q)}catch(H){let K=H instanceof Error?`: ${H.message}`:"";throw Error(`Invalid JSON provided to --settings (${B})${K}`)}if(!w||typeof w!=="object"||Array.isArray(w))throw Error("--settings must contain a JSON object");for(let H of Object.keys(w))if(!v.has(H))throw Error(`Unknown --settings field: ${H}`);let J=x(a,w);if(!J.success){let H=J.error.issues.map((K)=>`${K.path.join(".")||"settings"}: ${K.message}`).join("; ");throw Error(`Invalid --settings value: ${H}`)}return J.data}async function p(q){if(q===void 0)return;let B=q.trim();if(!B)throw Error("--settings requires a JSON object or file path");if(B.startsWith("{"))return V(B,"inline JSON");let w=t.resolve(X(),B),J;try{J=await i.readFile(w,"utf8")}catch(H){let K=H instanceof Error?`: ${H.message}`:"";throw Error(`Unable to read --settings file ${w}${K}`)}return V(J,w)}function u(q,B){if(!B)return;let w=B;for(let[J,H]of g){if(J==="permissionMode"&&q.yolo===!0)continue;if(q[H]===void 0&&w[J]!==void 0)q[H]=w[J]}}var Q=d("General"),Dk=(q)=>{if(q.yolo){if(q.permissionMode&&q.permissionMode!=="yolo")throw Error("Cannot use both --yolo and --permission-mode with different values");q.permissionMode="yolo"}if(Array.isArray(q.allowedTools))q.allowedTools=q.allowedTools.flatMap((B)=>B.split(",").map((w)=>w.trim()).filter((w)=>w.length>0));if(Array.isArray(q.disallowedTools))q.disallowedTools=q.disallowedTools.flatMap((B)=>B.split(",").map((w)=>w.trim()).filter((w)=>w.length>0));if(Array.isArray(q.allowedTools)&&Array.isArray(q.disallowedTools)){let B=q.allowedTools.filter((w)=>q.disallowedTools.includes(w));if(B.length>0)throw Error(`Tools cannot be both allowed and disallowed: ${B.join(", ")}`)}},hk=async(q)=>{let B=await p(typeof q.settings==="string"?q.settings:void 0);if(u(q,B),typeof q.agents==="string")s(q.agents);r(q);try{let J=await l.getInstance().initialize(B),H=n(J,q);if(o().config.actions.setConfig(H),q.debug)Q.info("[CLI] 配置已加载到 Store")}catch(w){Q.error("[CLI] [FAIL] 配置初始化失败",w instanceof Error?w.message:w),console.error(`
|
|
2
2
|
[FAIL] 配置初始化失败
|
|
3
3
|
`),console.error("原因:",w instanceof Error?w.message:"未知错误"),console.error(`
|
|
4
4
|
请检查:`),console.error(" 1. 配置文件格式是否正确 (~/.blade/config.json)"),console.error(" 2. 是否需要运行 blade 进行首次配置"),console.error(` 3. 配置文件权限是否正确
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$e as q,Le as a,Me as b,Ne as c,Oe as d,Pe as e,Qe as f,Re as g,Se as h,Te as i,Ue as j,Ve as k,We as l,Xe as m,Ye as n,Ze as o,_e as p}from"./chunk-
|
|
1
|
+
import{$e as q,Le as a,Me as b,Ne as c,Oe as d,Pe as e,Qe as f,Re as g,Se as h,Te as i,Ue as j,Ve as k,We as l,Xe as m,Ye as n,Ze as o,_e as p}from"./chunk-b8n5mx53.js";import"./chunk-v508x7cg.js";import"./chunk-dg0d3303.js";import"./chunk-19xfer55.js";import"./chunk-f9asjkfz.js";import"./chunk-czcxx8tb.js";import"./chunk-maebpz1j.js";import"./chunk-9sx3vsyj.js";import"./chunk-70hwyc2w.js";import"./chunk-d8wzc602.js";import"./chunk-425p4nwx.js";import"./chunk-k7vv9vne.js";import"./chunk-qw57eqns.js";import"./chunk-cp7xsjj2.js";import"./chunk-2va6ex5v.js";import"./chunk-q3vza5gt.js";import"./chunk-w9xfks7f.js";export{a as vanillaStore,c as sessionActions,l as getThinkingModeEnabled,b as getState,n as getServiceTier,o as getResponseVerbosity,m as getReasoningEffort,j as getModelById,e as getMessages,k as getMcpServers,i as getCurrentModel,f as getConfig,p as getCommunicationStyle,h as getAllModels,g as ensureStoreInitialized,q as configActions,d as appActions};
|