dal-code 1.0.59 → 1.0.61
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/CHANGELOG.md +8 -0
- package/dist/bundle/chunks/account-REEBP4XX.js +1 -0
- package/dist/bundle/chunks/{anthropic-messages-HVFHIIGX.js → anthropic-messages-FFHN77YO.js} +1 -1
- package/dist/bundle/chunks/{azure-openai-responses-RMWKIGFW.js → azure-openai-responses-XMVXFFRW.js} +1 -1
- package/dist/bundle/chunks/bedrock-converse-stream.js +1 -1
- package/dist/bundle/chunks/{chunk-TPOKZ2EU.js → chunk-3UVUVPDJ.js} +1 -1
- package/dist/bundle/chunks/{chunk-IONGABQF.js → chunk-46A3CZG4.js} +1 -1
- package/dist/bundle/chunks/{chunk-BBNE2TWS.js → chunk-4PE5FX77.js} +1 -1
- package/dist/bundle/chunks/{chunk-4BOWD7PQ.js → chunk-5DM5CSLU.js} +1 -1
- package/dist/bundle/chunks/chunk-5VVKJ7N6.js +9 -0
- package/dist/bundle/chunks/chunk-7FEAO2PW.js +2 -0
- package/dist/bundle/chunks/{chunk-HF334NQU.js → chunk-B66W54NL.js} +1 -1
- package/dist/bundle/chunks/chunk-CVSK7HIR.js +1 -0
- package/dist/bundle/chunks/{chunk-VDPDHGGJ.js → chunk-DM37LCOU.js} +1 -1
- package/dist/bundle/chunks/{chunk-PMFHJN7I.js → chunk-HDE7XZW5.js} +1 -1
- package/dist/bundle/chunks/{chunk-MPLE6M5C.js → chunk-KV7HXJIS.js} +1 -1
- package/dist/bundle/chunks/{chunk-4PBY6OYS.js → chunk-LBVJMXG6.js} +1 -1
- package/dist/bundle/chunks/{chunk-F5SIUTR7.js → chunk-LGD3AMTG.js} +1 -1
- package/dist/bundle/chunks/{chunk-KT7CXVDN.js → chunk-M4QINYHM.js} +9 -9
- package/dist/bundle/chunks/{chunk-YOQ3KBG5.js → chunk-MOBJIVPU.js} +1 -1
- package/dist/bundle/chunks/{chunk-KQRRELCF.js → chunk-NBRVYUIG.js} +1 -1
- package/dist/bundle/chunks/{chunk-AL3DFAIM.js → chunk-NRQYSXAU.js} +1 -1
- package/dist/bundle/chunks/{chunk-GZJEAFRS.js → chunk-O4KJ5UE4.js} +1 -1
- package/dist/bundle/chunks/{chunk-IKSSB5ZJ.js → chunk-OLTY5TDX.js} +1 -1
- package/dist/bundle/chunks/{chunk-R47JBGS3.js → chunk-QM5JU2GS.js} +1 -1
- package/dist/bundle/chunks/{chunk-XQF5XDEM.js → chunk-RRAXQWE3.js} +2 -2
- package/dist/bundle/chunks/{chunk-J6H2LYOZ.js → chunk-TLYT7KXA.js} +1 -1
- package/dist/bundle/chunks/{chunk-QU2VEHMW.js → chunk-XIF7O6UG.js} +3 -3
- package/dist/bundle/chunks/{chunk-F52JQCLE.js → chunk-XKOYUKPQ.js} +1 -1
- package/dist/bundle/chunks/{chunk-X63WCLSX.js → chunk-ZLZHK7BO.js} +274 -274
- package/dist/bundle/chunks/{chunk-C5ELI234.js → chunk-ZVMXRMIH.js} +1 -1
- package/dist/bundle/chunks/{cli-BFWJUYZ5.js → cli-4VML7NOW.js} +1 -1
- package/dist/bundle/chunks/cli-RJETLDQ5.js +30 -0
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-RXFI2EBV.js → cloudflare-workers-ai-system-one-63ASD4MS.js} +1 -1
- package/dist/bundle/chunks/{easter-egg-3d-W2F3ROZ6.js → easter-egg-3d-JQUBBOXE.js} +1 -1
- package/dist/bundle/chunks/{execute-NJRE4WBO.js → execute-ZIFT667Q.js} +1 -1
- package/dist/bundle/chunks/{google-generative-ai-5F5544G4.js → google-generative-ai-4T6TSKGZ.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-4PSVELDG.js → google-vertex-Z2AJIOKJ.js} +1 -1
- package/dist/bundle/chunks/{llama-cpp-classify-IPNT4VOW.js → llama-cpp-classify-UD7L3OEZ.js} +1 -1
- package/dist/bundle/chunks/{mcp-F3BQ6MQW.js → mcp-7W2PZMFF.js} +1 -1
- package/dist/bundle/chunks/{mistral-conversations-RSYLYGE4.js → mistral-conversations-W4M2WAFU.js} +1 -1
- package/dist/bundle/chunks/{office-UBOUFRAU.js → office-FIY2WQ2K.js} +1 -1
- package/dist/bundle/chunks/oidc-WQ64R7RE.js +1 -0
- package/dist/bundle/chunks/{openai-codex-responses-OKPZLYIS.js → openai-codex-responses-NYZACUJQ.js} +1 -1
- package/dist/bundle/chunks/{openai-completions-BFCQZRZ2.js → openai-completions-GOZT4TOU.js} +1 -1
- package/dist/bundle/chunks/{openai-decisions-RJ4MH5XI.js → openai-decisions-ZJSAGWHI.js} +1 -1
- package/dist/bundle/chunks/{openai-responses-PT5MXG3Q.js → openai-responses-ZVECOLDP.js} +1 -1
- package/dist/bundle/chunks/{openrouter-images-ICCH2YHW.js → openrouter-images-BOGEFLXU.js} +1 -1
- package/dist/bundle/chunks/{pi-messages-Z2XWHIYT.js → pi-messages-XDGHAFKO.js} +1 -1
- package/dist/bundle/chunks/{review-WTYIVWYR.js → review-ESZWG3ID.js} +1 -1
- package/dist/bundle/chunks/{router-V3EIAYOF.js → router-ZQ7UPIHA.js} +1 -1
- package/dist/bundle/chunks/{runtime-FNCZJKOC.js → runtime-KHMBKDP7.js} +1 -1
- package/dist/bundle/chunks/{sdk-32L63XRF.js → sdk-6F6YIKOL.js} +1 -1
- package/dist/bundle/chunks/src-TVUSERYE.js +3 -0
- package/dist/bundle/chunks/{sync-Z5USQ7AN.js → sync-F7N6C6RF.js} +1 -1
- package/dist/bundle/chunks/{typesafe-system-one-6UYWINOZ.js → typesafe-system-one-NSQNXICI.js} +1 -1
- package/dist/bundle/chunks/{usage-JODQIC2H.js → usage-5VHK66HK.js} +1 -1
- package/dist/bundle/chunks/{virtual-modules-ERCLFZEY.js → virtual-modules-ABFE2KKD.js} +1 -1
- package/dist/bundle/cli-runtime.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/main.js +4 -4
- package/dist/node_modules/@dalcode/dal-advisor/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-awake/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-bridge/src/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-capabilities/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-codeindex/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-compat/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-dap/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-goal/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-guard/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-guard/src/attribution.js +1 -1
- package/dist/node_modules/@dalcode/dal-guard/src/index.js +4 -4
- package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-interactive/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-learn/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-lsp/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-mcp/package.json +6 -6
- package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +4 -4
- package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +4 -4
- package/dist/node_modules/@dalcode/dal-plugins/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-recall/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-remote/package.json +3 -2
- package/dist/node_modules/@dalcode/dal-remote/src/account.js +2 -0
- package/dist/node_modules/@dalcode/dal-remote/src/cli.js +13 -13
- package/dist/node_modules/@dalcode/dal-remote/src/install.js +2 -2
- package/dist/node_modules/@dalcode/dal-remote/src/spec.js +1 -1
- package/dist/node_modules/@dalcode/dal-review/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-router/package.json +6 -6
- package/dist/node_modules/@dalcode/dal-rtk/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-skills/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-statusline/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-structured/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-subagent/package.json +5 -5
- package/dist/node_modules/@dalcode/dal-sync/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-telemetry/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-terminal/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-usage/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-web/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
- package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/radius.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-codemode/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-schema/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/dist/bundle/chunks/chunk-WLQ33LIH.js +0 -9
- package/dist/bundle/chunks/cli-NQ7B7BGV.js +0 -30
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var E=Object.defineProperty;var n=(r,e)=>E(r,"name",{value:e,configurable:!0});import{createRequire as w}from"node:module";const X=w(import.meta.url);import{DEFAULT_CONFIG as v,DEFAULT_ROLE_MODELS as k,resolveRoles as x}from"./chunk-
|
|
1
|
+
var E=Object.defineProperty;var n=(r,e)=>E(r,"name",{value:e,configurable:!0});import{createRequire as w}from"node:module";const X=w(import.meta.url);import{DEFAULT_CONFIG as v,DEFAULT_ROLE_MODELS as k,resolveRoles as x}from"./chunk-LBVJMXG6.js";import"./chunk-5VVKJ7N6.js";import"./chunk-ZLZHK7BO.js";import"./chunk-TLYT7KXA.js";import"./chunk-M4QINYHM.js";import"./chunk-MOBJIVPU.js";import"./chunk-RRAXQWE3.js";import"./chunk-JUUJCOIR.js";import"./chunk-NJDCSLWK.js";import"./chunk-ZVMXRMIH.js";import"./chunk-5DM5CSLU.js";import"./chunk-B66W54NL.js";import"./chunk-G5AMLGXC.js";import"./chunk-LGD3AMTG.js";import"./chunk-NRQYSXAU.js";import"./chunk-6QGV3IWD.js";import"./chunk-QM5JU2GS.js";import"./chunk-XJFQKN3N.js";import"./chunk-XIF7O6UG.js";import"./chunk-IEBK4HQA.js";import"./chunk-5AGIVGSV.js";import"./chunk-723ZGEZ2.js";import"./chunk-ZG74NES2.js";import"./chunk-TMTOQ7H7.js";import"./chunk-7DDKXS2Q.js";import"./chunk-FFMDRXC4.js";import"./chunk-DM37LCOU.js";import"./chunk-4LDEEFCY.js";import"./chunk-XKOYUKPQ.js";import"./chunk-JXWJOIH4.js";var y=/\s*\([^)]*upstream id\)\s*$/i,b=/\bexp\b|\(exp\)|experimental/i,d=/-\d{6,8}$/,f=/\bv(\d+(?:\.\d+)*)\b/i;function T(r){return(r.name??r.id).replace(y,"").trim().toLowerCase()}n(T,"canonicalName");function _(r){let e=f.exec(r);return e?e[1].split(".").map(Number):void 0}n(_,"versionOf");function I(r,e){for(let i=0;i<Math.max(r.length,e.length);i++){let s=(r[i]??0)-(e[i]??0);if(s!==0)return s}return 0}n(I,"compareVersions");var N=[{model:/^deepseek-v4-pro(?:-ga-\d{6,8})?$/,by:"deepseek-flash"}];function R(r){let e=new Set(r.map(t=>t.id)),i=r.filter(t=>!b.test(t.name??"")&&!b.test(t.id)&&!N.some(o=>o.model.test(t.id)&&e.has(o.by))),s=new Map;for(let t of i){let o=T(t),a=s.get(o);(!a||d.test(a.id)&&!d.test(t.id)||d.test(a.id)===d.test(t.id)&&t.id.length<a.id.length)&&s.set(o,t)}let p=new Map,m=[];for(let[t,o]of s){let a=_(t);if(!a){m.push(o);continue}let u=`${t.replace(f,"").replace(/\s+/g," ").trim()}@${o.costPerMtok}`,h=p.get(u);(!h||I(a,h.version)>0)&&p.set(u,{model:o,version:a})}let c=new Set([...m,...[...p.values()].map(t=>t.model)]);return i.filter(t=>c.has(t))}n(R,"curatePool");var S=/全部(?:都)?(?:做|完成|弄|搞|处理|修)|都(?:要)?(?:做好|做完|完成|修好|搞定)|每一(?:项|个|条)都|逐条做完|一次(?:性)?(?:做|搞)完|\ball of (?:them|it|these)\b|\beverything\b|\beach of (?:them|these)\b/i,L=/^\s*(?:\(?\d{1,2}[.、))]|[-*•]\s)/;function D(r){let e=r.trim(),i=e.split(`
|
|
2
2
|
`).filter(s=>L.test(s)).length;return i>=4||e.length>=1500?!0:S.test(e)&&(i>=2||e.length>=300)}n(D,"looksComplex");var M=/(?:实现|添加|增加|新增|加上|修复|修改|改成|改为|重构|迁移|替换|重命名|删除|拆分|合并|优化|编写|写一?个|写出|生成|创建|做一?[个份套]|整理成|补充|补上|测试|支持)|\b(?:add|implement|fix|change|refactor|migrate|replace|rename|remove|delete|split|merge|optimi[sz]e|write|create|generate|build|make|convert|support|test|update)\b/gi,O=/[??]\s*$|^(?:为什么|怎么|如何|什么|哪|是否|有没有|能不能|请问|解释|说明|介绍)|^(?:why|how|what|which|where|when|explain|describe)\b/i,A=/^\s*(?:\(?\d{1,2}[.、))]|[-*•]\s)/;function C(r){let e=r.trim();if(!e)return!1;let i=new Set((e.match(M)??[]).map(s=>s.toLowerCase()));return i.size===0||O.test(e)&&i.size===1&&e.length<300?!1:D(e)||e.split(`
|
|
3
3
|
`).filter(s=>A.test(s)).length>=2||e.length>=600?!0:i.size>=3&&e.length>=120}n(C,"needsPlanning");var P=/先(?:做|出|给|写|列)?(?:个|一个|一份)?(?:规划|计划|方案|设计)|(?:规划|计划|设计)一下(?:再|然后)|先想清楚(?:再|然后)|\bplan (?:it |this |the change |the work )?(?:first|before)\b|\b(?:make|write|draft|propose) a plan\b|\bwork out the design\b|\bdesign (?:it |this )?before\b/i,q=/(?:做|制作|生成|写|出一份|出个|创建|整理成|准备|起草|导出|帮我弄|改成|美化|排版)|\b(?:make|create|generate|build|write|prepare|draft|produce|put together|export)\b/i,U=/(?:PPT|幻灯片|演示文稿|课件|汇报材料|简历|报告|周报|月报|调研|方案书|白皮书|Word\s*文档|docx|Excel|xlsx|电子表格|表格|图表|可视化|仪表盘)|\b(?:pptx?|slides?|slide deck|deck|presentation|resume|cv|report|white ?paper|docx|word document|excel|xlsx|spreadsheet|workbook|chart|dashboard)\b/i,$=/(?:架构|系统设计|技术方案|设计(?:一个|一套|方案)|数据模型设计|接口设计)|\b(?:architecture|architect|system design|design (?:a|an|the) (?:system|api|schema|module|architecture))\b/i,F=/(?:多个文件|多文件|跨文件|跨模块|所有(?:模块|文件|调用)|整个(?:项目|仓库|代码库)|全(?:仓库|项目)|几个模块|重构|迁移)|\b(?:across (?:the )?(?:codebase|code base|repo|repository|project|modules|files)|multi-?file|every (?:caller|call site|module)|all (?:callers|call sites|modules)|codebase-wide|refactor|migrate|migration|everywhere)\b/i,V=/(?:规范|规格|按(?:照)?文档|严格按|边界(?:情况|条件)|所有(?:错误|异常)情况|每一种(?:错误|情况))|\b(?:spec(?:ification)?|exactly|edge cases?|every error case|error cases|corner cases?|the rules below)\b/i,z=/[??]\s*$|^(?:为什么|怎么|如何|什么|哪|是否|有没有|能不能|请问|解释|说明|介绍|总结|概括|看看|读一下)|^(?:why|how|what|which|where|when|who|explain|describe|summari[sz]e|tell me)\b/i,G=/(?:实现|添加|增加|新增|加上|修复|修改|改成|改为|重构|迁移|替换|重命名|删除|拆分|合并|优化|编写|写一?个|生成|创建|补充|补上|支持|修好|修一下|改一下)|\b(?:add|implement|fix|change|refactor|migrate|replace|rename|remove|delete|split|merge|optimi[sz]e|write|create|generate|build|make|convert|support|update|rewrite)\b/i,g=800;function l(r,e){let i=r.exec(e);return i?i[0].trim():void 0}n(l,"firstMatch");var B=/\.(?:m?[jt]sx?|py|go|rs|java|kt|rb|php|c|cc|cpp|h|cs|swift|vue|sql|sh)\b|\b(?:src|tests?|lib|pkg|cmd)\/|\b(?:npm|pnpm|yarn) (?:run |test)|\bunittest\b|\bpytest\b|\bgo test\b|\bcargo\b|\bregression tests?\b|单测|测试用例/i;function H(r){let e=r.trim();if(!e)return{route:"direct",kind:"empty",reasons:[]};let i=l(P,e);if(i)return{route:"split",kind:"plan-requested",reasons:[i]};let s=l(G,e),p=l(q,e),m=l(U,e),c=z.test(e);if(m&&p&&!(c&&!s)&&!B.test(e))return{route:"split",kind:"deliverable",reasons:[p,m]};if(!s)return{route:"direct",kind:c?"question":"small-change",reasons:[]};let t=l($,e);if(t)return{route:"split",kind:"design",reasons:[t]};let o=l(F,e);if(o)return{route:"direct",kind:"multi-file",reasons:[o]};let a=l(V,e);return a?{route:"direct",kind:"spec",reasons:[a]}:e.length>=g||C(e)?{route:"direct",kind:"multi-step",reasons:[e.length>=g?`${e.length} chars`:"several steps"]}:{route:"direct",kind:c?"question":"small-change",reasons:[s]}}n(H,"classifyTask");export{v as DEFAULT_CONFIG,k as DEFAULT_ROLE_MODELS,H as classifyTask,R as curatePool,x as resolveRoles};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as r}from"node:module";const u=r(import.meta.url);import{McpOAuthAuthorizationRequiredError as e,McpOAuthCredentialStore as t,McpServerConnection as o,McpServerLog as i,McpSignInCancelledError as p,createDefaultTransport as m,createMcpAuthProvider as c,signInMcpServer as n}from"./chunk-
|
|
1
|
+
import{createRequire as r}from"node:module";const u=r(import.meta.url);import{McpOAuthAuthorizationRequiredError as e,McpOAuthCredentialStore as t,McpServerConnection as o,McpServerLog as i,McpSignInCancelledError as p,createDefaultTransport as m,createMcpAuthProvider as c,signInMcpServer as n}from"./chunk-HDE7XZW5.js";import"./chunk-ZVMXRMIH.js";import"./chunk-5DM5CSLU.js";import"./chunk-B66W54NL.js";import"./chunk-G5AMLGXC.js";import"./chunk-QM5JU2GS.js";import"./chunk-XJFQKN3N.js";import"./chunk-XIF7O6UG.js";import"./chunk-JXWJOIH4.js";export{e as McpOAuthAuthorizationRequiredError,t as McpOAuthCredentialStore,o as McpServerConnection,i as McpServerLog,p as McpSignInCancelledError,m as createDefaultTransport,c as createMcpAuthProvider,n as signInMcpServer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var m=Object.defineProperty;var t=(r,o)=>m(r,"name",{value:o,configurable:!0});import{createRequire as p}from"node:module";const Z=p(import.meta.url);import{BUILTIN_AGENT_DESCRIPTIONS as i,READ_ONLY_TOOL_NAMES as a}from"./chunk-
|
|
1
|
+
var m=Object.defineProperty;var t=(r,o)=>m(r,"name",{value:o,configurable:!0});import{createRequire as p}from"node:module";const Z=p(import.meta.url);import{BUILTIN_AGENT_DESCRIPTIONS as i,READ_ONLY_TOOL_NAMES as a}from"./chunk-46A3CZG4.js";import"./chunk-LBVJMXG6.js";import{DAL_HOOK_ENTRY_TYPE as n,dalHookActivity as s,isDalHookActivity as l,runDalHookEvent as E,runNotificationHooks as _,runUserPromptSubmitHooks as N}from"./chunk-5VVKJ7N6.js";import{BUNDLED_EXTENSION_PACKAGES as O,DAL_TOOL_NAMES as A,DefaultPackageManager as S,HOST_CAPABILITIES_ENV as T,HOST_TOKEN_ENV as I,HOST_TOKEN_HEADER as c,HOST_URL_ENV as u,RpcClient as D,RpcCommandError as R,SettingsManager as L,buildProjectMap as d,formatProjectMapPrompt as P,listBundledExtensions as H,listToolCatalog as f,loadProjectContextFiles as C,loadSkills as g,parseFrontmatter as k,toolDisplayLabel as M}from"./chunk-ZLZHK7BO.js";import{SessionManager as v,getDefaultSessionDirs as B,parseSessionEntries as w}from"./chunk-TLYT7KXA.js";import{ModelRuntime as y,PROJECT_HOOKS_FILE_ENV as F,loadDalHooks as K,projectHooksFileFromEnv as V}from"./chunk-M4QINYHM.js";import"./chunk-MOBJIVPU.js";import"./chunk-RRAXQWE3.js";import"./chunk-JUUJCOIR.js";import"./chunk-NJDCSLWK.js";import"./chunk-ZVMXRMIH.js";import"./chunk-5DM5CSLU.js";import"./chunk-B66W54NL.js";import"./chunk-G5AMLGXC.js";import"./chunk-LGD3AMTG.js";import"./chunk-NRQYSXAU.js";import"./chunk-6QGV3IWD.js";import{CONFIG_DIR_NAME as b,SHARED_SKILL_CONFIG_DIRS as x,VERSION as Y,getAgentDir as j,getExamplesPath as G}from"./chunk-QM5JU2GS.js";import"./chunk-XJFQKN3N.js";import{getLanguage as U,translate as e}from"./chunk-XIF7O6UG.js";import"./chunk-IEBK4HQA.js";import"./chunk-5AGIVGSV.js";import"./chunk-723ZGEZ2.js";import"./chunk-ZG74NES2.js";import"./chunk-TMTOQ7H7.js";import"./chunk-7DDKXS2Q.js";import"./chunk-FFMDRXC4.js";import"./chunk-DM37LCOU.js";import"./chunk-4LDEEFCY.js";import"./chunk-XKOYUKPQ.js";import"./chunk-JXWJOIH4.js";var q=/(?<![\w@./\\~-])(?:pi|Pi)(?![\w/-]|\.\w)/g;function h(r){return r.replace(q,"DAL")}t(h,"brandText");var J="terminal",X=1;function z(r=U()){let o=[...a];return[{name:"scout",description:e(i.scout,r),tools:o,readOnly:!0},{name:"worker",description:e(i.worker,r),readOnly:!1},{name:"reviewer",description:e(i.reviewer,r),tools:o,readOnly:!0}]}t(z,"listBuiltinSubagents");export{O as BUNDLED_EXTENSION_PACKAGES,b as CONFIG_DIR_NAME,n as DAL_HOOK_ENTRY_TYPE,A as DAL_TOOL_NAMES,S as DefaultPackageManager,T as HOST_CAPABILITIES_ENV,I as HOST_TOKEN_ENV,c as HOST_TOKEN_HEADER,u as HOST_URL_ENV,y as ModelRuntime,F as PROJECT_HOOKS_FILE_ENV,D as RpcClient,R as RpcCommandError,x as SHARED_SKILL_CONFIG_DIRS,v as SessionManager,L as SettingsManager,J as TERMINAL_CAPABILITY,X as TERMINAL_CAPABILITY_VERSION,Y as VERSION,h as brandText,d as buildProjectMap,s as dalHookActivity,P as formatProjectMapPrompt,j as getAgentDir,B as getDefaultSessionDirs,G as getExamplesPath,l as isDalHookActivity,z as listBuiltinSubagents,H as listBundledExtensions,f as listToolCatalog,K as loadDalHooks,C as loadProjectContextFiles,g as loadSkills,k as parseFrontmatter,w as parseSessionEntries,V as projectHooksFileFromEnv,E as runDalHookEvent,_ as runNotificationHooks,N as runUserPromptSubmitHooks,M as toolDisplayLabel};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var z=Object.defineProperty;var n=(e,t)=>z(e,"name",{value:t,configurable:!0});import{createRequire as Z}from"node:module";const je=Z(import.meta.url);import{OAuthError as Q,defaultConfig as w,discover as S,fetchMembership as X,pollDeviceToken as ee,refresh as te,startDeviceFlow as ue}from"./chunk-CVSK7HIR.js";import"./chunk-5VVKJ7N6.js";import{SettingsManager as re}from"./chunk-ZLZHK7BO.js";import"./chunk-TLYT7KXA.js";import{builtinProviders as ne}from"./chunk-M4QINYHM.js";import"./chunk-MOBJIVPU.js";import"./chunk-RRAXQWE3.js";import"./chunk-JUUJCOIR.js";import{isAccountLimitAssistantError as ie}from"./chunk-NJDCSLWK.js";import"./chunk-ZVMXRMIH.js";import"./chunk-5DM5CSLU.js";import"./chunk-B66W54NL.js";import"./chunk-G5AMLGXC.js";import"./chunk-LGD3AMTG.js";import"./chunk-NRQYSXAU.js";import"./chunk-6QGV3IWD.js";import{getAgentDir as L}from"./chunk-QM5JU2GS.js";import"./chunk-XJFQKN3N.js";import{t as p}from"./chunk-XIF7O6UG.js";import"./chunk-IEBK4HQA.js";import"./chunk-5AGIVGSV.js";import"./chunk-723ZGEZ2.js";import"./chunk-ZG74NES2.js";import"./chunk-TMTOQ7H7.js";import"./chunk-7DDKXS2Q.js";import"./chunk-FFMDRXC4.js";import"./chunk-DM37LCOU.js";import"./chunk-4LDEEFCY.js";import"./chunk-XKOYUKPQ.js";import"./chunk-JXWJOIH4.js";import{createHash as oe}from"node:crypto";import{mkdirSync as ae,readFileSync as se,renameSync as le,writeFileSync as ce}from"node:fs";import{dirname as pe,join as de}from"node:path";function $(e){return de(L(),"cache",`${e}.json`)}n($,"cachePath");function me(e){return oe("sha256").update(e).digest("hex").slice(0,16)}n(me,"accountTag");function fe(e,t){let u;try{u=JSON.parse(se($(e),"utf8"))}catch{return}if(!(typeof u.savedAt!="number"||!t(u.value)))return{value:u.value,savedAt:u.savedAt}}n(fe,"readCache");function ge(e,t){let u=$(e);ae(pe(u),{recursive:!0,mode:448});let r=`${u}.${process.pid}.tmp`;ce(r,JSON.stringify({savedAt:Date.now(),value:t}),{mode:384}),le(r,u)}n(ge,"writeCache");var Fe={thinkingFormat:"openrouter",supportsReasoningEffort:!0},Ae={supportsDeveloperRole:!1},De={input:0,output:0,cacheRead:0,cacheWrite:0};function he(e){if(!e)return;let{input_per_1m:t,output_per_1m:u,currency:r}=e;if(typeof t!="number"||typeof u!="number"||!Number.isFinite(t)||!Number.isFinite(u)||t<0||u<0||r!==void 0&&r.toUpperCase()!=="USD")return;let o=n(i=>typeof i=="number"&&Number.isFinite(i)&&i>=0?i:0,"rate");return{input:t,output:u,cacheRead:o(e.cache_read_per_1m),cacheWrite:o(e.cache_write_per_1m)}}n(he,"costFromGateway");var Ee={"User-Agent":"dal-coding-agent"},D;function ye(e){if(!D){D=new Map;for(let t of ne()){let u;try{u=t.getModels()}catch{continue}for(let r of u)D.has(r.id)||D.set(r.id,r)}}return D.get(e)}n(ye,"lookupBuiltin");function ve(e){let t=e.toLowerCase();if(t.includes("glm")){let u=t.includes("1m");return{reasoning:!0,input:["text"],contextWindow:u?1e6:2e5,maxTokens:131072}}return t.includes("deepseek")?{reasoning:!t.includes("chat"),input:["text"],contextWindow:128e3,maxTokens:32e3}:t.includes("grok")?{reasoning:!0,input:["text","image"],contextWindow:2e5,maxTokens:32e3}:t.includes("claude")?{reasoning:!0,input:["text","image"],contextWindow:2e5,maxTokens:32e3}:t.includes("gemini")?{reasoning:!0,input:["text","image"],contextWindow:1e6,maxTokens:65536}:t.includes("gpt")||/^o[0-9]/.test(t)?{reasoning:!0,input:["text","image"],contextWindow:4e5,maxTokens:128e3}:t.includes("kimi")||t.includes("qwen")||t.includes("minimax")?{reasoning:!0,input:["text"],contextWindow:2e5,maxTokens:32e3}:{reasoning:!1,input:["text"],contextWindow:128e3,maxTokens:8192}}n(ve,"familyDefaults");function I(e,t){let u=e.toLowerCase().includes("deepseek");return{...Ae,...t?Fe:{},...u?{supportsStore:!1,requiresReasoningContentOnAssistantMessages:!0}:{}}}n(I,"gatewayCompat");function Be(e,t){if(!e)return;let u=new Set(e.map(o=>o.toLowerCase())),r={xhigh:u.has("xhigh")?"xhigh":null,max:u.has("max")?"max":null};return t?.thinkingLevelMap?.off===null&&(r.off=null,r.minimal=null,r.low=null,r.medium=null,r.high=null),r}n(Be,"thinkingMapFromGateway");function we(e){if(!e)return{};let t=e.capabilities;return{...typeof e.contextWindow=="number"&&e.contextWindow>0?{contextWindow:e.contextWindow}:{},...typeof e.maxTokens=="number"&&e.maxTokens>0?{maxTokens:e.maxTokens}:{},...t?.some(u=>u.toLowerCase()==="reasoning")?{reasoning:!0}:{},...t?.some(u=>u.toLowerCase()==="vision")?{input:["text","image"]}:{}}}n(we,"metaFromGateway");function M(e,t,u){let r=ye(e),o={...r?{reasoning:r.reasoning,input:[...r.input],contextWindow:r.contextWindow,maxTokens:r.maxTokens}:ve(e),...we(u)},i=Be(u?.reasoningEfforts,r);return{id:e,name:t||r?.name||e,reasoning:o.reasoning,...i?{thinkingLevelMap:i}:r?.thinkingLevelMap?{thinkingLevelMap:r.thinkingLevelMap}:{},input:o.input,headers:{...Ee},cost:he(u?.pricing)??{...De},contextWindow:o.contextWindow,maxTokens:o.maxTokens,...I(e,o.reasoning)?{compat:I(e,o.reasoning)}:{}}}n(M,"gatewayModelDefaults");var _="auto",Ce=["deepseek-v4-pro","deepseek-flash"];function R(e){let t=e.filter(d=>d.id!==_),u={};for(let d of t){let f=d.cost;!f||f.input<=0&&f.output<=0||(u[d.id]={input:f.input,output:f.output,cacheRead:f.cacheRead,cacheWrite:f.cacheWrite})}let r=n(d=>Object.keys(u).length===0?d:{...d,compat:{...d.compat??{},responseModelCosts:u}},"priced"),o=e.find(d=>d.id===_),i=Ce.map(d=>t.find(f=>f.id===d)).find(d=>d),g=i&&(!o||o.name===W)?{...i,id:_,name:W,headers:{...i.headers}}:o;return[...t.map(r),...g?[r(g)]:[]]}n(R,"completeGatewayCatalog");var W="DeepAILab Auto";function ke(e,t,u){return{models:t.map(r=>({...r,api:"openai-completions",provider:e,baseUrl:u})),checkedAt:Date.now()}}n(ke,"toCatalogStoreEntry");function be(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.id=="string"&&t.id.length>0&&typeof t.name=="string"&&typeof t.reasoning=="boolean"&&Array.isArray(t.input)&&typeof t.cost=="object"&&t.cost!==null&&typeof t.contextWindow=="number"&&typeof t.maxTokens=="number"}n(be,"isGatewayModel");function _e(e){let t=(e?.models??[]).filter(be).map(u=>{let{provider:r,baseUrl:o,...i}=u;return i});return t.length>0?R(t):t}n(_e,"restoreCatalog");function O(e,t){return{access:e.accessToken,refresh:e.refreshToken??"",expires:t?e.expiresAt:0,vk:t}}n(O,"toCredentials");async function P(e,t){let u=await fetch(`${e}/portal/keys/lifecycle`,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},body:JSON.stringify({operation:"create",name:"dal-cli",allowedModels:[]})});if(!u.ok)throw new Error(`Virtual key exchange failed (${u.status}): ${await u.text()}`);let r=(await u.json()).oneTimeCredential?.value;if(!r)throw new Error("Bridge did not return a virtual key secret.");return r}n(P,"createVirtualKey");async function xe(e){let t=w(),u=await S(t.issuer),r=await ue(t,u);e.onAuth({url:r.verificationUriComplete,instructions:p("\u8BF7\u5728\u6D4F\u89C8\u5668\u4E2D\u786E\u8BA4\u767B\u5F55\u8BF7\u6C42\uFF0C\u4EE5\u8FDE\u63A5 DeepAILab\u3002")}),e.onDeviceCode({userCode:r.userCode,verificationUri:r.verificationUri,intervalSeconds:r.interval,expiresInSeconds:r.expiresIn});let o=await ee(t,u,r,{signal:e.signal});o.refreshToken||e.onProgress?.(p("\u8B66\u544A\uFF1A\u672A\u7B7E\u53D1\u5237\u65B0\u4EE4\u724C \u2014 \u8BF7\u68C0\u67E5 offline_access \u6388\u6743\u8303\u56F4\u3002")),e.onProgress?.(p("\u6B63\u5728\u5F00\u901A DeepAILab \u8BBF\u95EE\u5BC6\u94A5\u2026"));let i="";for(let g=0;g<2&&!i;g++)try{i=await P(t.apiBase,o.accessToken)}catch(d){g===1&&e.onProgress?.(`${p("\u8BBF\u95EE\u5BC6\u94A5\u5F00\u901A\u5931\u8D25\uFF08")}${d instanceof Error?d.message:String(d)}${p("\uFF09\uFF0C\u4E0B\u6B21\u4F7F\u7528\u65F6\u5C06\u81EA\u52A8\u91CD\u8BD5\u3002")}`)}return O(o,i)}n(xe,"loginDeepAILab");async function U(e,t){let u=new AbortController,r=setTimeout(()=>u.abort(),1e4);try{let o=await fetch(`${e}/portal/skills`,{headers:{"x-bf-vk":t,Accept:"application/json"},signal:u.signal});return o.status!==401&&o.status!==403}catch{return!0}finally{clearTimeout(r)}}n(U,"isVirtualKeyLive");var Te=1440*60*1e3;function Se(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.issuer=="string"&&typeof t.tokenEndpoint=="string"}n(Se,"isEndpoints");async function Le(e){let t=`oidc-discovery-${me(e)}`,u=fe(t,Se);if(u&&Date.now()-u.savedAt<Te)return u.value;let r=await S(e);try{ge(t,r)}catch{}return r}n(Le,"discoverCached");var N=420*1e3;function j(e){return e instanceof Q?/^http_5\d\d$/.test(e.code)||e.code==="server_error"||e.code==="temporarily_unavailable":!0}n(j,"isTransientRefreshFailure");async function G(e){let t=String(e.vk??"");try{return await $e(e)}catch(u){if(t&&j(u))return{...e,expires:Date.now()+N};throw u}}n(G,"refreshDeepAILab");async function $e(e){let t=w(),u=await Le(t.issuer),r=String(e.vk??""),[o,i]=await Promise.all([te(t,u,e.refresh),r?U(t.apiBase,r):Promise.resolve(!1)]);return i||(r=await P(t.apiBase,o.accessToken)),O(o,r)}n($e,"renewDeepAILab");var H=[],K=900*1e3;function Ie(e){if(e?.type==="oauth")return String(e.vk||e.access||"")||void 0;if(e?.type==="api_key")return e.key||void 0}n(Ie,"gatewayKey");async function Me(e,t,u){let r;try{r=await fetch(`${e}/models`,{headers:{Authorization:`Bearer ${t}`,"x-bf-vk":t,Accept:"application/json"},signal:AbortSignal.any([u,AbortSignal.timeout(2e4)])})}catch(i){if(i instanceof Error&&(i.name==="AbortError"||i.name==="TimeoutError"))throw new Error(`${p("\u65E0\u6CD5\u83B7\u53D6\u6A21\u578B\u5217\u8868")}\uFF1A${p("\u8BF7\u6C42\u8D85\u65F6")}`);let g=i instanceof Error?i.cause:void 0,d=g?.code??g?.message;throw new Error(`${p("\u65E0\u6CD5\u83B7\u53D6\u6A21\u578B\u5217\u8868")}\uFF1A${p("\u65E0\u6CD5\u8FDE\u63A5 DeepAILab \u7F51\u5173")}${d?` (${d})`:""}`)}if(!r.ok)throw new Error(`${p("\u65E0\u6CD5\u83B7\u53D6\u6A21\u578B\u5217\u8868")}\uFF1A${p("\u7F51\u5173\u62D2\u7EDD\u4E86\u8BF7\u6C42")} (HTTP ${r.status})`);let o=await r.json();return R((o.data??[]).filter(i=>typeof i.id=="string"&&i.id.length>0).map(i=>M(i.id,i.display_name??i.name,{contextWindow:i.context_window,maxTokens:i.max_output_tokens,capabilities:i.capabilities,reasoningEfforts:i.reasoning_efforts,pricing:i.pricing})))}n(Me,"fetchGatewayCatalog");function Re(){let e=re.create(process.cwd(),L(),{projectTrusted:!1}),t=e.getDefaultModel();return e.getDefaultProvider()!=="deepailab"||!t?[]:[M(t)]}n(Re,"configuredDefaultCatalog");var q=Symbol.for("dalcode.deepailab.credentials"),V=globalThis;V[q]??={};var h=V[q];function Y(){let e=h.current?.access;return typeof e=="string"&&e.length>0?e:void 0}n(Y,"currentDeepAILabAccessToken");async function We(e){try{if(!await e.getApiKeyForProvider("deepailab"))return}catch{return}return Y()}n(We,"resolveDeepAILabAccessToken");function Oe(){return w().apiBase.replace(/\/+$/,"")}n(Oe,"deepAILabApiBase");function Pe(e){let t=w(),u=H,r=0,o,i,g=n(async(a,l)=>{let s=ke("deepailab",a,t.apiBase);u=a,r=s.checkedAt??Date.now();let c=!1;try{c=await l({persist:s})}catch{}o=c?void 0:s},"persist");e.registerProvider("deepailab",{name:"DeepAILab",baseUrl:t.apiBase,apiKey:"$DAL_VK",api:"openai-completions",models:H,refreshModels:n(async({credential:a,allowNetwork:l,force:s,signal:c,stored:m,publish:F})=>{let v=Ie(a);if(!v)return u;if(o)try{await F({persist:o})&&(o=void 0)}catch{}let B=m?.checkedAt??0;if(B>r){let T=_e(m);T.length>0&&(u=T,r=B)}if(!l)return u.length===0&&(u=Re()),u;if(!s&&r>0&&Date.now()-r<K)return u;let k=Me(t.apiBase,v,c);i=k;let b;try{b=await k}finally{i===k&&(i=void 0)}return b.length>0&&await g(b,F),u},"refreshModels"),oauth:{name:"DeepAILab",login:xe,refreshToken:G,getApiKey:n(a=>(h.current=a,a.vk?String(a.vk):String(a.access)),"getApiKey"),modifyModels:n((a,l)=>a.map(s=>({...s,headers:{...s.headers,"x-bf-vk":String(l.vk??"")}})),"modifyModels")}}),e.on("before_agent_start",(a,l)=>{if(i||r===0||Date.now()-r<K)return;let s=l.modelRegistry?.getRuntime?.();s?.refreshCatalogsInPlace&&s.refreshCatalogsInPlace({providers:["deepailab"],signal:AbortSignal.timeout(2e4)}).catch(()=>{})}),e.on("provider_authenticated",async(a,l)=>{if(a.providerId!=="deepailab")return;let s=await l.modelRegistry.refresh({providers:["deepailab"],force:!0,signal:AbortSignal.timeout(2e4)}),c=s.errors.get("deepailab"),m=c?c.message:s.aborted?`${p("\u65E0\u6CD5\u83B7\u53D6\u6A21\u578B\u5217\u8868")}\uFF1A${p("\u8BF7\u6C42\u8D85\u65F6")}`:void 0;m&&(l.hasUI?l.ui.notify(m,"error"):process.stderr.write(`${m}
|
|
2
|
+
`))}),e.registerCommand("account",{description:p("\u67E5\u770B DeepAILab \u4F1A\u5458\u548C\u5957\u9910\u72B6\u6001"),handler:n(async(a,l)=>{let s=await l.modelRegistry.getApiKeyForProvider("deepailab");if(!s){l.ui.notify(p("\u5C1A\u672A\u767B\u5F55\u3002\u8BF7\u8FD0\u884C /login \u5E76\u9009\u62E9 DeepAILab\u3002"),"warning");return}try{let c=await X(t,String(h.current?.access??s)),m=c.membership.plan??"free",F=c.membership.active?p("\u5DF2\u6FC0\u6D3B"):p("\u672A\u6FC0\u6D3B"),v=c.membership.expiresAt?` \xB7 ${p("\u81F3")} ${c.membership.expiresAt}`:"",B=c.principal?.email??c.principal?.username??"";l.ui.notify(`DeepAILab ${B} \u2014 ${m}\uFF08${F}\uFF09${v}`,"info")}catch(c){l.ui.notify(`${p("\u65E0\u6CD5\u52A0\u8F7D\u4F1A\u5458\u4FE1\u606F\uFF1A")}${c instanceof Error?c.message:String(c)}`,"error")}},"handler")});let d=0,f=0,C=n((a,l)=>{a.hasUI?a.ui.notify(l.message,l.level):process.stderr.write(`${l.message}
|
|
3
|
+
`)},"notify");e.on("after_provider_response",(a,l)=>{if(a.status<400||a.status===d)return;if(d=a.status,a.status===401||a.status===402||a.status===403){f=a.status;return}let s=y(a.status,!!h.current?.vk);s&&C(l,s)});let A=!1,x=n((a,l,s)=>{A||(A=!0,e.emitHostEvent(J,{source:a,scope:E(l)==="upstream"?"upstream":"account",message:s,reason:(l??"").slice(0,500)}))},"reportAccountLimit");e.on("message_end",(a,l)=>{let s=a.message;if(s.role!=="assistant")return;let c=f;f=0;let m=c===402||ie(s)||(c===401||c===403)&&E(s.errorMessage)==="suspended",F=c?y(c,!!h.current?.vk,s.errorMessage):m&&!A?y(402,!0,s.errorMessage):null;F&&C(l,F),m&&F&&x("agent",s.errorMessage,F.message)}),e.on("turn_end",(a,l)=>{for(let s of a.toolResults){let c=s.details?.accountLimit;if(!c||A)continue;let m=y(402,!0,c.reason);m&&(C(l,m),x("subagent",c.reason,m.message))}}),e.on("agent_start",()=>{A=!1}),e.on("turn_start",()=>{d=0,f=0})}n(Pe,"src_default");var J="account_limit";function E(e){return e?/api[ _-]?key is inactive|"type"\s*:\s*"api_key_(?:inactive|blocked)"/i.test(e)?"suspended":/"type"\s*:\s*"api_key_(?:required|not_found|expired|revoked|disabled|invalid)"/i.test(e)||/x-bf-vk|virtual[ _-]?key|用户额度不足|用户剩余额度|预扣费额度失败/i.test(e)?"user":/authentication_error|invalid_api_key|incorrect api key|invalid api key|your api key[:\s]|api key[^"]{0,40}is invalid|insufficient[ _]balance|credit balance is too low|permission_error|account[^"]{0,40}(?:suspended|deactivated|disabled)/i.test(e)?"upstream":"unknown":"unknown"}n(E,"classifyGatewayAuthFailure");function y(e,t=!0,u){if(e===401||e===403){let r=E(u);return r==="upstream"?{message:p("\u8BE5\u6A21\u578B\u7684\u670D\u52A1\u901A\u9053\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u8BF7\u7528 /model \u6362\u4E00\u4E2A\u6A21\u578B\uFF0C\u6216\u7A0D\u540E\u518D\u8BD5\u3002"),level:"error"}:r==="suspended"?{message:p("DAL \u8D26\u6237\u7684\u6A21\u578B\u8C03\u7528\u5DF2\u6682\u505C\uFF08\u4F59\u989D\u4E0D\u8DB3\u6216\u8FBE\u5230\u82B1\u8D39\u4E0A\u9650\uFF09\u3002\u524D\u5F80 deepailab.ai \u5145\u503C\u6216\u8C03\u6574\u82B1\u8D39\u4E0A\u9650\u540E\u4F1A\u81EA\u52A8\u6062\u590D\u3002"),level:"error"}:t?{message:p("\u767B\u5F55\u72B6\u6001\u5DF2\u5931\u6548\uFF0C\u8BF7\u8FD0\u884C /login \u91CD\u65B0\u767B\u5F55 DeepAILab\u3002"),level:"error"}:{message:p("\u8D26\u6237\u7F3A\u5C11\u8BBF\u95EE\u5BC6\u94A5\uFF08\u4E0A\u6B21\u5F00\u901A\u672A\u6210\u529F\uFF09\u3002\u8FD0\u884C /login \u91CD\u65B0\u767B\u5F55\u5373\u53EF\u8865\u53D1\u3002"),level:"error"}}return e===402?E(u)==="upstream"?{message:p("\u8BE5\u6A21\u578B\u7684\u4E0A\u6E38\u670D\u52A1\u901A\u9053\u4F59\u989D\u4E0D\u8DB3\uFF0C\u6682\u65F6\u65E0\u6CD5\u4F7F\u7528\u3002\u8BF7\u7528 /model \u6362\u4E00\u4E2A\u6A21\u578B\uFF0C\u6216\u7A0D\u540E\u518D\u8BD5\u3002"),level:"error"}:{message:p("\u8D26\u6237\u4F59\u989D\u4E0D\u8DB3\uFF0C\u8BF7\u5145\u503C\u540E\u91CD\u8BD5\u3002\u8FD0\u884C /account \u67E5\u770B\u5957\u9910\uFF0C\u6216\u524D\u5F80 deepailab.ai \u5145\u503C\u3002"),level:"error"}:e===429?{message:p("\u8BF7\u6C42\u592A\u9891\u7E41\uFF0C\u7F51\u5173\u6B63\u5728\u9650\u6D41\u3002\u8BF7\u7A0D\u7B49\u51E0\u79D2\u518D\u8BD5\u3002"),level:"warning"}:e===404?{message:p("\u5F53\u524D\u6A21\u578B\u5728\u7F51\u5173\u4E0A\u4E0D\u53EF\u7528\uFF08\u53EF\u80FD\u672A\u7ED1\u5B9A\u5BC6\u94A5\uFF09\u3002\u7528 /model \u6362\u4E00\u4E2A\u6A21\u578B\u8BD5\u8BD5\u3002"),level:"warning"}:e>=500?{message:p("DeepAILab \u7F51\u5173\u6682\u65F6\u4E0D\u53EF\u7528\uFF08\u670D\u52A1\u7AEF\u9519\u8BEF\uFF09\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"),level:"error"}:null}n(y,"gatewayStatusNotice");export{J as ACCOUNT_LIMIT_EVENT,N as REFRESH_RETRY_AFTER_MS,E as classifyGatewayAuthFailure,Y as currentDeepAILabAccessToken,Oe as deepAILabApiBase,Pe as default,y as gatewayStatusNotice,j as isTransientRefreshFailure,U as isVirtualKeyLive,G as refreshDeepAILab,We as resolveDeepAILabAccessToken};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var wt=Object.defineProperty;var a=(e,t)=>wt(e,"name",{value:t,configurable:!0});import{createRequire as Et}from"node:module";const Yn=Et(import.meta.url);import{getDefaultSessionDir as vt}from"./chunk-
|
|
1
|
+
var wt=Object.defineProperty;var a=(e,t)=>wt(e,"name",{value:t,configurable:!0});import{createRequire as Et}from"node:module";const Yn=Et(import.meta.url);import{getDefaultSessionDir as vt}from"./chunk-TLYT7KXA.js";import"./chunk-MOBJIVPU.js";import"./chunk-NJDCSLWK.js";import"./chunk-5DM5CSLU.js";import"./chunk-G5AMLGXC.js";import"./chunk-QM5JU2GS.js";import{DATA_FORMAT_KEY as At,declaredDataFormat as re,reportNewerDataFormat as $e,t as B,withFileLockSync as ie,writeFileAtomicSync as P}from"./chunk-XIF7O6UG.js";import"./chunk-IEBK4HQA.js";import"./chunk-723ZGEZ2.js";import"./chunk-ZG74NES2.js";import"./chunk-7DDKXS2Q.js";import"./chunk-FFMDRXC4.js";import"./chunk-DM37LCOU.js";import"./chunk-4LDEEFCY.js";import"./chunk-XKOYUKPQ.js";import"./chunk-JXWJOIH4.js";import{existsSync as xt,readFileSync as kt}from"node:fs";import{join as _t}from"node:path";import{createHash as jt,randomBytes as $t}from"node:crypto";import{existsSync as Oe,mkdirSync as ae,readdirSync as Ot,readFileSync as Ne,rmSync as Nt,statSync as It}from"node:fs";import{join as T}from"node:path";import{join as Tt}from"node:path";import{homedir as Rt}from"node:os";var Ct=[[/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?(?:-----END [A-Z ]*PRIVATE KEY-----|$)/g,"<private-key>"],[/\b(?:sk|pk|rk)-[A-Za-z0-9_-]{8,}/g,"<secret>"],[/\bBearer\s+[A-Za-z0-9._~+/=-]{8,}/gi,"Bearer <secret>"],[/\beyJ[A-Za-z0-9._-]{16,}/g,"<secret>"],[/\b(?:ghp|gho|ghu|ghs|ghr|github_pat)_[A-Za-z0-9_]{8,}/g,"<secret>"],[/\bglpat-[A-Za-z0-9_-]{8,}/g,"<secret>"],[/\bAKIA[0-9A-Z]{12,}/g,"<secret>"],[/\bxox[abposr]-[A-Za-z0-9-]{8,}/g,"<secret>"],[/\bnpm_[A-Za-z0-9]{20,}/g,"<secret>"],[/\b([A-Za-z0-9_.-]*(?:token|secret|password|passwd|api[_-]?key|access[_-]?key|private[_-]?key|auth|cookie|session)[A-Za-z0-9_.-]*)(["']?\s*[:=]\s*["']?)([^\s"',;]{4,})/gi,"$1$2<secret>"],[/(\b[a-z][a-z0-9+.-]*:\/\/)[^\s/@:]+:[^\s/@]+@/gi,"$1<secret>@"],[/[A-Za-z0-9+/_-]{40,}={0,2}/g,"<opaque>"]];function U(e){let t=e;for(let[r,n]of Ct)t=t.replace(r,n);let s=Rt();return s&&s.length>1&&(t=t.split(s).join("~")),t=t.replace(/(?:\/Users\/|\/home\/|[A-Za-z]:\\Users\\)[^\s/\\]+/g,"~"),t}a(U,"redact");var Ft=[{reason:"weakens_safety",pattern:/\b(?:skip|bypass|disable|ignore|override|turn off|circumvent)\b[^\n]{0,40}\b(?:approvals?|permissions?|sandbox(?:es)?|safety|guards?|confirmations?|hooks?|polic(?:y|ies)|protections?)\b/i},{reason:"weakens_safety",pattern:/(?:跳过|绕过|关闭|禁用|忽略|无视)[^。\n]{0,12}(?:审批|权限|确认|沙箱|安全|保护|钩子|拦截)/u},{reason:"weakens_safety",pattern:/(?:不要|不必|无需)(?![^。\n]{0,6}未经)[^。\n]{0,6}(?:审批|确认|沙箱)/u},{reason:"weakens_safety",pattern:/\b(?:skip|disable)\b[^\n]{0,20}\btests?\b|--no-verify\b/i},{reason:"weakens_safety",pattern:/--dangerously|\byolo\b|bypassPermissions|\bsudo\b|chmod\s+777|rm\s+-rf\s+[/~]/i},{reason:"exfiltrates",pattern:/\b(?:curl|wget|scp|rsync|nc|upload|send|post|exfiltrate|share)\b[^\n]{0,60}\b(?:tokens?|keys?|secrets?|passwords?|credentials?|cookies?|env|\.ssh|sessions?)\b/i},{reason:"exfiltrates",pattern:/(?:上传|发送|发到|外发|分享|传到)[^。\n]{0,20}(?:密钥|令牌|密码|凭据|凭证|cookie|环境变量|私钥)/iu},{reason:"installs",pattern:/\b(?:npm|pnpm|bun)\s+(?:i|install|add)\b[^\n]*?(?:\s-g\b|--global\b)|\byarn\s+global\s+add\b/i},{reason:"installs",pattern:/\b(?:brew|apt(?:-get)?|yum|dnf|pacman|apk|choco|winget|scoop|snap|cargo|gem|pipx)\s+(?:install|add)\b|\bgo\s+install\b|\buv\s+tool\s+install\b/i},{reason:"installs",pattern:/\b(?:npm\s+(?:i|install)|pnpm\s+(?:add|i|install)|yarn\s+add|bun\s+add)\s+(?!(?:in|at|from|first|before|after|then|and|again|once|for|inside|to|with|when|so|instead|works|fails|succeeds)\b)[@a-z][\w@./-]*/i},{reason:"installs",pattern:/\|\s*(?:sudo\s+)?(?:ba|z)?sh\b|\binstall(?:er)?\s+script\b/i},{reason:"installs",pattern:/\b(?:npx|npm\s+exec)\b[^\n`]*?\s(?:-y|--yes)\b|\bnpx\s+(?:-\S+\s+)*@?[a-z][\w./-]*@[\w.^~*-]+|\b(?:pnpm|yarn)\s+dlx\b|\bbunx\b|\buvx\b|\bpipx\s+run\b/i},{reason:"installs",pattern:/全局安装|从[^。\n]{1,30}下载|下载(?:并|后)?(?:运行|执行|安装)/u},{reason:"concrete_value",pattern:/\bhttps?:\/\/|\bwww\./i},{reason:"concrete_value",pattern:/<(?:secret|opaque|private-key)>/},{reason:"concrete_value",pattern:/[A-Za-z0-9+/=_-]{40,}/},{reason:"concrete_value",pattern:/\b\d{1,3}(?:\.\d{1,3}){3}\b/},{reason:"concrete_value",pattern:/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/},{reason:"concrete_value",pattern:/(?:\/Users\/|\/home\/|[A-Za-z]:\\Users\\)[^\s/\\]+/}];function Dt(e){let t=[e.content,e.rootCause??"",e.note??""].join(`
|
|
2
2
|
`);for(let{reason:r,pattern:n}of Ft)if(n.test(t))return r;let s=e.content.trim().length;if(s<6||s>320)return"length"}a(Dt,"rejectLesson");var Mt=[{category:"deletion",pattern:/\b(?:rm|rmdir|del|unlink|truncate|shred)\b|\bdelet(?:e|es|ed|ing)\b|\bremov(?:e|es|ed|ing)\b|\bdrop\s+(?:table|database|schema)\b|\bgit\s+(?:clean|reset\s+--hard|push\s+[^\n]*--force|branch\s+-D)\b|\bwip(?:e|ing)\b|\bpurge\b|删除|删掉|清空|清除|覆盖(?!率)|重置/iu},{category:"permissions",pattern:/\b(?:chmod|chown|sudo|setfacl|icacls)\b|\bpermissions?\b|\bapprov(?:al|e)s?\b|\bsandbox\b|\bguard\b|\bescalat\w*|权限|审批|放行|沙箱|提权/iu},{category:"credentials",pattern:/\b(?:tokens?|secrets?|passwords?|passwd|credentials?|api[\s_-]?keys?|private\s+keys?|ssh\s+keys?|auth(?:\.json)?|login|cookies?|\.env)\b|凭据|凭证|密钥|密码|令牌|登录|私钥/iu},{category:"network",pattern:/\b(?:curl|wget|http|https|proxy|download|upload|dns|ssh|scp|rsync|webhook)\b|联网|下载|上传|代理|外网/iu},{category:"publishing",pattern:/\b(?:publish|release|deploy|push|git\s+tag|merge\s+to\s+main)\b|发布|发版|上线|部署|推送|合并到主/iu}],oe=String.raw`(?:package\.json|package-lock\.json|lock\s?files?|pnpm-lock|yarn\.lock|requirements[\w.-]*\.txt|pyproject\.toml|Cargo\.toml|go\.mod|\.github\/workflows[\w./-]*|CI\s+config(?:uration)?)`,Ie=/\b(?:npm|pnpm|yarn|bun)[ \t]+(?:i|install|add)[ \t]+(?:-{1,2}[\w-]+[ \t]+)*[@a-z][\w@./-]*|\bpip3?[ \t]+install[ \t]+(?!-r\b)[a-z]|--save-dev\b|\binstall(?:ing)?\s+(?:the\s+|a\s+|an\s+|it\s+)?(?:missing\s+)?(?:tool|package|module|librar\w*|runner|linter|dependenc\w*)|as\s+a\s+dev-?dependency|(?:安装|装上|装一下|补装)\s*(?:缺少的|缺失的)?\s*(?:工具|依赖|包|插件|运行器)|装依赖/iu,qt=new RegExp(String.raw`\b(?:fix|edit|change|modify|update|rewrite|patch|add\b[^.;\n]{0,40}?\bto)\b[^.;\n]{0,40}?${oe}|\b(?:fix|edit|change|modify|update|rewrite|patch)\b[^.;\n]{0,12}?\b(?:the\s+)?(?:npm\s+|test\s+|lint\s+|build\s+)?scripts?\b|(?:改|修改|改写|修复)[^。;;\n]{0,6}?(?:测试|npm|lint|构建)?\s*脚本|${oe}[^.;\n]{0,20}?\b(?:should|must)\s+be\s+(?:changed|edited|updated|fixed)|(?:改|修改|编辑|调整|修复|补上|加到|写进)[^。;;\n]{0,12}?${oe}`,"iu"),Te=/\b(?:before|instead\s+of|rather\s+than|don'?t|do\s+not|never|avoid|without)\b[^.;\n]{0,24}$|(?:不要|别|不许|先别|而不是|避免|不用)[^。;;\n]{0,8}$/iu;function Lt(e){if(Ie.test(e)){let s=e.search(Ie);if(!Te.test(e.slice(Math.max(0,s-30),s)))return!0}let t=qt.exec(e);return!!(t&&!Te.test(e.slice(Math.max(0,t.index-30),t.index)))}a(Lt,"prescribesDependencyChange");function zt(e){let t=Mt.filter(({pattern:s})=>Ht(e,s)).map(({category:s})=>s);return Lt(e)?[...t,"dependencies"]:t}a(zt,"riskOf");var Bt=/[。;;,,!?!?\n]|\.(?=\s|$)/u,Pt=/\b(?:don'?t|do\s+not|never|avoid|stop|instead\s+of|rather\s+than|refuse|no\s+longer)\b|不要|不得|不能|不应|不该|(?<![区分类级识特个差告])别(?![的处人名])|切勿|勿|禁止|避免|停止|不再|而不是|而非|拒绝|不可|严禁|防止/iu,Ut=/^\s*(?:当|如果|若|假如|一旦|万一|when\b|if\b|once\b|whenever\b)/iu,Re=/就|则|便|\bthen\b/iu,Jt=/(?:时|之后|以后|的时候)\s*$/u;function Gt(e){return Ut.test(e)?Re.test(e)?[e]:[]:Jt.test(e)&&!Re.test(e)?[]:[e]}a(Gt,"prescriptiveParts");function Ht(e,t){let s=new RegExp(t.source,t.flags.includes("g")?t.flags:`${t.flags}g`);for(let r of e.split(Bt))for(let n of Gt(r))for(let i of n.matchAll(s))if(!Pt.test(n.slice(0,i.index)))return!0;return!1}a(Ht,"prescribedIn");function Y(e){let t=String.raw`(?:\s+(?:-{1,2}[\w-]+(?:=\S+|\s+[^\s-]\S*)?|workspace\s+\S+|workspaces(?:\s+foreach)?))*`;return[String.raw`\b(?:npm|pnpm|yarn|bun)${t}\s+(?:run\s+)?(?:${e})\b`,String.raw`\bturbo\s+(?:run\s+)?(?:[^\s-]\S*\s+)*?(?:${e})(?![\w-])`,String.raw`\bnx\s+(?:run\s+\S+:|(?:run-many|affected)\b.*?(?:-t|--targets?)(?:=|\s+)(?:\S*,)?)?(?:${e})(?![\w-])`].join("|")}a(Y,"scriptPattern");var Kt=[["typecheck",new RegExp(String.raw`\btsc\b(?!.*--build)|\bmypy\b|\bpyright\b|${Y("typecheck|type-check|check-types")}`)],["test",new RegExp(String.raw`\b(?:vitest|jest|mocha|ava|pytest|tox|rspec|phpunit)\b|${Y("test")}|\bnode\s+--test\b|\b(?:go|cargo|dotnet|mix|deno)\s+test\b|\bmake\s+test\b|\bgradlew?\s+test\b|\bmvn\s+test\b`)],["lint",new RegExp(String.raw`\b(?:eslint|biome|ruff|flake8|pylint|golangci-lint|clippy|prettier\s+--check)\b|${Y("lint|check")}`)],["build",new RegExp(String.raw`${Y("build")}|\b(?:cargo|go|dotnet|swift)\s+build\b|\bmake\b(?!\s+test)|\bgradlew?\s+(?:build|assemble)\b|\bmvn\s+(?:package|install)\b|\btsc\s+--build\b|\bvite\s+build\b|\bwebpack\b`)],["install",/^(?:npm\s+(?:ci|install|i)|pnpm\s+(?:install|i)|yarn(?:\s+install)?|bun\s+install|pip3?\s+install\s+(?:-r|-e|\.)|poetry\s+install|uv\s+sync|bundle\s+install|composer\s+install|go\s+mod\s+download)(?:\s|$)/]],Zt=/^(?:tail|head|grep|egrep|fgrep|cat|less|more|tee|wc|sort|uniq|cut|column|sed|awk|nl)\b/,Wt=/^(?:head|grep|egrep|fgrep|cut|sed|awk)\b/,Yt=/^(?:echo|printf|cat|ls|pwd|true|false|:|#|sed|awk|grep|rg|head|tail|wc|find|git\s+(?:diff|status|log|show|stash|add)|set|export|printenv|which|whereis|type|command\s+-v|test\s|\[|stat|file|(?:node|npm|pnpm|yarn|bun|npx)\s+(?:-v|--version)|(?:npm|pnpm|yarn)\s+(?:ls|list|view|info|bin|root|config|why))(?:\b|(?=\s|$))/;function Vt(e){let t=e.replace(/<<-?\s*(['"]?)(\w+)\1([^\n]*)\n[\s\S]*?\n[ \t]*\2[ \t]*(?=\n|$)/g,"<<$2$3").replace(/\s*\d*>&\d+/g,""),s=[],r=[],n="",i,o=a(()=>{r.push(n.trim()),n=""},"endStage"),l=a(()=>{o();let d=r.filter(Boolean);d.length&&s.push(d),r=[]},"endStatement");for(let d=0;d<t.length;d++){let h=t[d];if(i){if(h==="\\"&&i==='"'){n+=h+(t[d+1]??""),d++;continue}h===i&&(i=void 0),n+=h;continue}h==="'"||h==='"'?(i=h,n+=h):h==="\\"?(n+=h+(t[d+1]??""),d++):h===";"||h===`
|
|
3
3
|
`?l():(h==="&"||h==="|")&&t[d+1]===h?(l(),d++):h==="&"?l():h==="|"?o():n+=h}return l(),s}a(Vt,"splitStatements");function Xt(e){let t=[],s=!1;for(let r of Vt(e)){let n=[...r],i=!1;for(;n.length>1&&Zt.test(n.at(-1));)Wt.test(n.at(-1))&&(i=!0),n.pop();let o=n.join(" | ").replace(/\s+/g," ");/^cd\s/.test(o)?t.push(o):!Yt.test(o)&&Ce(o)&&(t.push(o),i&&(s=!0))}for(;t.length&&/^cd\s/.test(t.at(-1));)t.pop();return{statements:t,selected:s}}a(Xt,"checkParts");function Ce(e){for(let[t,s]of Kt)if(s.test(e))return t}a(Ce,"intentOf");var Fe=120,De=/^(?:at\s|\S+\s\(\S+:\d+:\d+\)$|(?:file:\/\/)?\S+\.(?:[cm]?[jt]sx?|py|go|rs|rb|java|kt|php)(?::\d+){1,2}$|.*\bnode:internal\/|Node\.js v\d)/,Me=/^(?:>?\s*\d+\s*\|.*|[\s|]*\^+[\s^~]*|(?:if|else|for|while|switch|const|let|var|return|function|class|import|export|async|await|def|try|catch)\b.*|\}.*)$|\bthrow new\b|=>|[;{]$/,qe=/^(?:(?:duration_ms|type|location|failureType|code|stack|operator|expected|actual|generatedMessage|name):|\.{3}$|-{3}$|TAP version|Subtest:|1\.\.\d+$|(?:tests|suites|pass|fail|cancelled|skipped|todo|duration_ms)\s+\d|Command exited with code)/,Qt=/^(?:E\s+)?(?:Uncaught\s+)?(?:[A-Z][\w.]*(?:Error|Exception)|Error|error(?: TS\d+|\[E\d+\])?)(?:\s*\[[\w-]+\])?:\s*\S|\berror TS\d+:\s*\S/,es=/^(?:expected\b.*\b(?:received|to (?:be|equal)|but got)\b|(?:Expected|Received)(?: value)?:\s*\S|.+\s!==?\s.+)/i,ts=/^(?:FAIL(?:ED)?\b|not ok \d+|[✖×✗]\s|--- FAIL:?)/,ss=/not found|no such|cannot|can't|unable|error|fail|missing|denied|unknown|invalid|找不到|不存在|失败|错误/i;function ns(e){let t=e.trim().replace(/^#\s?/,"").trim();return t!==""&&(De.test(t)||Me.test(t)||qe.test(t))}a(ns,"isUntellingReason");function rs(e){let t=e.findIndex(n=>es.test(n));if(t<0)return;let s=e[t],r=/^Expected(?: value)?:/i.test(s)?e.slice(t+1,t+4).find(n=>/^Received(?: value)?:/i.test(n)):void 0;return r?`${s}, ${r}`:s}a(rs,"comparison");function is(e){let t=U(e).replace(/\s+/g," ").trim();return t.length>Fe?`${t.slice(0,Fe-1)}\u2026`:t}a(is,"clipReason");function as(e){let t=[];for(let s=0;s<e.length;s++){let r=/^error:\s*(.*)$/.exec(e[s]);if(!r)continue;let n=r[1].replace(/^'(.*)'$/,"$1").replace(/^"(.*)"$/,"$1");if(/^\|-?$/.test(n)){let o=[];for(let l=s+1;l<e.length&&o.length<2&&!/^[a-z_]+:\s/i.test(e[l]);l++)o.push(e[l]);n=o.join(" ")}if(!n||n==="test failed")continue;let i="";for(let o=s+1;o<Math.min(e.length,s+12)&&!/^(?:\.{3}|not ok|ok)\b/.test(e[o]);o++){let l=/^name:\s*'?([\w.]+)'?$/.exec(e[o]);if(l){i=l[1];break}}t.push(i&&!n.startsWith(i)?`${i}: ${n}`:n)}return t}a(as,"tapErrors");function os(e){let t=e.split(/\r?\n/).map(n=>n.trim().replace(/^#\s?/,"").trim()).filter(Boolean),s=t.filter(n=>!De.test(n)&&!Me.test(n)&&!qe.test(n)),r=as(t)[0]??s.find(n=>Qt.test(n))??rs(s)??s.find(n=>ts.test(n))??s.find(n=>ss.test(n))??"";return is(r)}a(os,"failureReason");var J=a(e=>e,"asIs"),V=a(e=>`dir:${e.replace(/^\.\//,"").replace(/\/+$/,"")||"."}`,"dirTarget"),Le={pnpm:[{names:["-F","--filter","--filter-prod"],value:!0,target:J},{names:["-r","--recursive"],value:!1,target:a(()=>"*","target")},{names:["-C","--dir"],value:!0,target:V},{names:["-w","--workspace-root"],value:!1,target:a(()=>"root","target")}],npm:[{names:["-w","--workspace"],value:!0,target:J},{names:["-ws","--workspaces"],value:!1,target:a(()=>"*","target")},{names:["--prefix"],value:!0,target:V}],yarn:[{names:["--cwd"],value:!0,target:V}],bun:[{names:["-F","--filter"],value:!0,target:J},{names:["--cwd"],value:!0,target:V}]};function D(e,t,s){let r=e[t];for(let n of s)for(let i of n.names){if(n.value&&r.startsWith(`${i}=`))return{target:n.target(r.slice(i.length+1)),next:t+1};if(r!==i)continue;if(!n.value)return{target:n.target(""),next:t+1};let o=e[t+1];return o===void 0?void 0:{target:n.target(o),next:t+2}}}a(D,"targetOption");var us=/^(?:add|audit|bin|cache|ci|config|create|dedupe|deploy|dlx|env|exec|fetch|help|i|import|info|init|install|link|list|ls|login|logout|outdated|pack|patch|prune|publish|rebuild|remove|rm|root|set|setup|store|unlink|up|update|upgrade|version|view|why|x)$/;function ls(e,t){if(e==="npm")return/^(?:test|t|tst)$/.test(t)?"test":void 0;if(e!=="bun")return us.test(t)?void 0:t}a(ls,"scriptOf");function cs(e){let t=e[0],s=Le[t],r=[],n=[],i=1;for(;i<e.length;){let m=e[i],f=D(e,i,s);if(f)r.push(f.target),i=f.next;else if(t==="yarn"&&m==="workspace"&&e[i+1])r.push(e[i+1]),i+=2;else if(t==="yarn"&&m==="workspaces")for(r.push("*"),i+=e[i+1]==="foreach"?2:1;e[i]?.startsWith("-");)n.push(e[i++]);else if(m.startsWith("-"))n.push(m),i++;else break}let o=e[i];if(!o)return;let l=o==="run"||o==="run-script",d=l?e[i+1]:ls(t,o);if(l&&!d)return;i+=l?2:1;let h=[];for(;i<e.length;){let m=t==="npm"&&e[i]!=="--"?D(e,i,s):void 0;if(e[i]==="--"){h.push(...e.slice(i));break}m?(r.push(m.target),i=m.next):h.push(e[i++])}return{base:[...d?[t,...n,"run",d]:[t,...n,o],...h].join(" "),targets:r}}a(cs,"packageShape");function ds(e,t){let s=[{names:["-F","--filter"],value:!0,target:J}],r=[],n=[],i=[];for(let o=t[0]==="run"?1:0;o<t.length;){let l=D(t,o,s);l?(r.push(l.target),o=l.next):t[o].startsWith("-")||i.length>0?i.push(t[o++]):n.push(t[o++])}return{base:[...e,"turbo","run",...n.sort(),...i].join(" "),targets:r}}a(ds,"turboShape");var fs=/^(?:add|connect|daemon|exec|format(?::\w+)?|g|generate|graph|init|list|migrate|release|repair|report|reset|show|sync|view-logs|watch)$/;function ps(e,t){let[s,r]=t;if(!s||fs.test(s))return;let n=[...e,"nx"];if(s==="run-many"||s==="affected"){let o=[],l=[],d=[],h=[{names:["-p","--projects"],value:!0,target:J},{names:["-t","--target","--targets"],value:!0,target:a(m=>`task:${m}`,"target")}];for(let m=1;m<t.length;){let f=D(t,m,h);if(!f){d.push(t[m++]);continue}let p=f.target.replace(/^task:/,"").split(",").filter(Boolean);(f.target.startsWith("task:")?l:o).push(...p),m=f.next}return{base:[...n,s,...l.sort(),...d].join(" "),targets:o}}if(s==="run"){let o=r?.indexOf(":")??-1;return!r||o<0?void 0:{base:[...n,"run",r.slice(o),...t.slice(2)].join(" "),targets:o>0?[r.slice(0,o)]:[]}}let i=r&&!r.startsWith("-")?r:void 0;return{base:[...n,"run",`:${s}`,...t.slice(i?2:1)].join(" "),targets:i?[i]:[]}}a(ps,"nxShape");function ms(e){let t=[{names:["-p","--package"],value:!0,target:J}],s=[],r=[];for(let n=0;n<e.length;){let i=D(e,n,t);i?(s.push(i.target),n=i.next):r.push(e[n++])}return{base:r.join(" "),targets:s}}a(ms,"cargoShape");var ze=new Set(["-bench","-benchtime","-count","-coverpkg","-coverprofile","-covermode","-cpu","-exec","-o","-p","-parallel","-shuffle","-tags","-timeout","-vet"]);function hs(e){let t=[{names:["-run","--run"],value:!0,target:a(n=>`run:${n}`,"target")},{names:["-skip","--skip"],value:!0,target:a(n=>`skip:${n}`,"target")}],s=[],r=[];for(let n=2;n<e.length;){let i=e[n],o=D(e,n,t);o?(s.push(o.target),n=o.next):i.startsWith("-")?(r.push(ze.has(i)&&e[n+1]?`${i}=${e[n+1]}`:i),n+=ze.has(i)&&e[n+1]?2:1):(s.push(i),n++)}return{base:[...e.slice(0,2),...r].join(" "),targets:s}}a(hs,"goShape");var gs=new Set(["-c","-n","-o","-p","-W","--basetemp","--cov","--cov-report","--deselect","--durations","--ignore","--junitxml","--log-level","--maxfail","--rootdir","--tb"]);function ys(e,t){let s=[{names:["-k"],value:!0,target:a(i=>`k:${i}`,"target")},{names:["-m"],value:!0,target:a(i=>`m:${i}`,"target")}],r=[],n=[];for(let i=0;i<t.length;){let o=t[i],l=D(t,i,s);l?(r.push(l.target),i=l.next):gs.has(o)&&t[i+1]?(n.push(`${o}=${t[i+1]}`),i+=2):o.startsWith("-")?(n.push(o),i++):(r.push(o.replace(/^\.\//,"")),i++)}return{base:[...e,...n.sort()].join(" "),targets:r}}a(ys,"pytestShape");function bs(e){let t=[],s="",r,n=!1;for(let i of e)if(r)i===r?r=void 0:s+=i;else if(i==="'"||i==='"')r=i,n=!0;else if(/\s/.test(i))n&&t.push(s),s="",n=!1;else{if(/[|<>`$()]/.test(i))return;s+=i,n=!0}if(!r)return n&&t.push(s),t}a(bs,"words");function Ss(e){let t=bs(e),s={base:e,targets:[]};if(!t?.length)return s;let r=t.findIndex(n=>/^(?:turbo|nx|pytest|py\.test)$/.test(n));if(r>=0&&r<=3){let n=t.slice(0,r),i=t.slice(r+1);return t[r]==="turbo"?ds(n,i):t[r]==="nx"?ps(n,i)??s:ys([...n,"pytest"],i)}return Le[t[0]]?cs(t)??s:t[0]==="cargo"?ms(t):t[0]==="go"&&/^(?:test|build|vet)$/.test(t[1]??"")?hs(t):s}a(Ss,"shapeOf");function Be(e){let t="",s=[];for(let r of Xt(e).statements){let n=/^cd\s+("[^"]+"|'[^']+'|\S+)$/.exec(r);if(n){let m=n[1].replace(/^["']|["']$/g,"");t=t&&!m.startsWith("/")?`${t}/${m}`:m;continue}let i=r.replace(/\s+/g," ").trim(),o=Ss(i),l=[...new Set(o.targets)].sort(),d=l.length?`${o.base} \u27E8${l.join(" ")}\u27E9`:o.base;if(s.some(m=>m.dir===t&&m.key===d))continue;let h=Ce(i);s.push({dir:t,check:i,base:o.base,targets:l,key:d,...h?{intent:h}:{}})}return s}a(Be,"segmentsOf");function ws(e,t){let s=a((r,n)=>r.every(i=>n.includes(i)),"nested");return e.base===t.base&&(s(e.targets,t.targets)||s(t.targets,e.targets))?!0:e.check===t.check||` ${e.check} `.includes(` ${t.check} `)||` ${t.check} `.includes(` ${e.check} `)}a(ws,"overlaps");var Pe=/^(?:\/|~|\$)/;function Es(e,t){let s=Be(e),r=Be(t),n=a((u,c)=>u.dir===c.dir&&u.key===c.key,"same"),i=s.filter(u=>!r.some(c=>n(u,c)));if(i.length===0)return;let o=new Set(i.map(u=>u.intent)),l=r.filter(u=>!s.some(c=>n(u,c))||o.has(u.intent)),d=i.filter(u=>l.some(c=>c.intent===u.intent));if(d.length===0||l.length===0)return;let h=a(u=>Pe.test(u.dir)||u.targets.some(c=>c.startsWith("dir:")&&Pe.test(c.slice(4))),"elsewhere");if([...d,...l].some(h)||d.some(u=>l.some(c=>c.dir===u.dir&&ws(u,c))))return;let m=a(u=>{let c=u[0].dir;if(u.some(w=>w.dir!==c))return;let y=u.map(w=>w.check).join(" && ");return c?`cd ${c} && ${y}`:y},"joined"),f=m(d),p=m(l);if(!f||!p||f===p)return;let g=l.every(u=>d.some(c=>c.dir===u.dir&&c.base===u.base));return{bad:f,good:p,...g?{retargeted:!0}:{}}}a(Es,"fixCommands");var vs=/command not found|: not found|is not (?:set|defined)|Missing script|Cannot find (?:module|package)|ERR_MODULE_NOT_FOUND|ENOENT|No such file|unknown (?:option|command|script|flag)|not recognized as|No test files|No tests found|permission denied|EACCES|找不到|未设置|不存在|未找到/i,As=/AssertionError|^\s*(?:Expected|Received)(?: value)?:|\bexpected\b.*\b(?:received|to (?:be|equal)|but got)\b|\s!==?\s|^not ok \d+|^#\s*fail\s+[1-9]|^\s*\d+ (?:failing|failed)\b|Tests?:\s+\d+ failed|\berror TS\d+:|\d+ problems? \(\d+ errors?/im;function xs(e){return As.test(e)&&!vs.test(e)}a(xs,"codeFailed");import{mkdirSync as ks,readFileSync as _s}from"node:fs";import{dirname as js}from"node:path";var ue=1;function Ue(e){let t;try{t=_s(e,"utf8")}catch{return}try{let s=JSON.parse(t);return s&&typeof s=="object"&&!Array.isArray(s)?s:void 0}catch{return}}a(Ue,"readRaw");function $s(e,t){let s=Ue(e),r=s!==void 0&&re(s)>ue;return r&&$e(e),{value:t(s),readOnly:r}}a($s,"readDoc");function Os(e,t,s){return ks(js(e),{recursive:!0,mode:448}),ie(e,()=>{let r=Ue(e);if(r!==void 0&&re(r)>ue){$e(e);return}let n=s(t(r));if(n===void 0)return;let i={...r??{},...n,[At]:ue};return P(e,`${JSON.stringify(i,null," ")}
|
|
4
4
|
`,{mode:384}),n})}a(Os,"updateDoc");function E(e,t){return typeof e=="string"?e.trim().slice(0,t):""}a(E,"str");function M(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?Math.floor(e):0}a(M,"num");function le(e,t,s){return Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.length>0).map(r=>r.slice(0,s)).slice(-t):[]}a(le,"strList");function ce(e){return Array.isArray(e)?e.filter(t=>!!t&&typeof t=="object"&&!Array.isArray(t)):[]}a(ce,"records");var Or=10080*60*1e3,Ns=["harmful","ineffective","unused","user","malformed","outdated"],Is=6,Ts=12,Rs=20,Cs=["candidate","active","awaiting_user","retired","undone","expired"],Fs=["failure_then_fix","user_correction","repeated_detour","guard_denial","success_workflow","imported"],Ds=["helpful","harmful","neutral"],Ms=["deletion","permissions","credentials","network","publishing","dependencies"];function Je(e){return Tt(e,"lessons.json")}a(Je,"lessonsPath");function qs(e){let t=E(e.id,16),s=E(e.content,400);if(!/^[lu]-\d{4,6}$/.test(t)||!s)return;let r=Cs.includes(e.status)?e.status:"candidate",n=e.fix,i=e.proof,o=e.origin;return{...e,id:t,scope:e.scope==="user"?"user":"project",section:E(e.section,40)||"general",content:s,rootCause:E(e.rootCause,400),...E(e.signature,300)?{signature:E(e.signature,300)}:{},...n&&typeof n.good=="string"?{fix:{intent:E(n.intent,20),bad:E(n.bad,200),good:E(n.good,200),...E(n.dir,200)?{dir:E(n.dir,200)}:{}}}:{},status:r,risk:le(e.risk,5,20).filter(l=>Ms.includes(l)),sessions:le(e.sessions,Ts,80),evidence:ce(e.evidence).map(l=>({sessionId:E(l.sessionId,80),at:E(l.at,32),signal:Fs.includes(l.signal)?l.signal:"user_correction",note:E(l.note,300)})).slice(-Is),...i&&typeof i.at=="string"?{proof:{kind:i.kind==="outcome"?"outcome":"test",at:E(i.at,32),sessionId:E(i.sessionId,80),note:E(i.note,300)}}:{},helpful:M(e.helpful),harmful:M(e.harmful),...M(e.neutral)>0?{neutral:M(e.neutral)}:{},...M(e.injections)>0?{injections:M(e.injections)}:{},...E(e.lastInjectedAt,32)?{lastInjectedAt:E(e.lastInjectedAt,32)}:{},feedback:ce(e.feedback).filter(l=>Ds.includes(l.tag)).map(l=>({sessionId:E(l.sessionId,80),tag:l.tag,at:E(l.at,32),why:E(l.why,200)})).slice(-Rs),created:E(e.created,32),updated:E(e.updated,32),...E(e.activatedAt,32)?{activatedAt:E(e.activatedAt,32)}:{},...["sessions","proof","user","import","trial"].includes(e.activatedBy)?{activatedBy:e.activatedBy}:{},...E(e.lastHelpfulAt,32)?{lastHelpfulAt:E(e.lastHelpfulAt,32)}:{},...E(e.retiredAt,32)?{retiredAt:E(e.retiredAt,32)}:{},...Ns.includes(e.retiredReason)?{retiredReason:e.retiredReason}:{},...o&&o.kind==="desktop"?{origin:{kind:"desktop",projectId:E(o.projectId,32),ruleId:E(o.ruleId,16)}}:{}}}a(qs,"parseLesson");var X=a(e=>e.replace(/\s+/g," ").trim(),"fold");function Ls(e){if(!e.fix||!e.signature?.startsWith("fix:")||e.activatedBy==="user"||e.activatedBy==="import")return!1;let t=Es(e.fix.bad,e.fix.good);return!t||X(t.bad)!==X(e.fix.bad)||X(t.good)!==X(e.fix.good)||ns(e.rootCause)||e.rootCause.trim()&&!os(e.rootCause)||xs(e.rootCause)?!0:Dt({content:e.content})!==void 0}a(Ls,"isMalformed");var zs=["candidate","active","awaiting_user"];function Bs(e){return!zs.includes(e.status)||!Ls(e)?e:{...e,status:"retired",retiredAt:e.updated||e.created,retiredReason:"malformed"}}a(Bs,"retireMalformed");function Ps(e){if(e.activatedBy==="user"||e.activatedBy==="import")return e;let t=zt(e.fix?`${e.fix.good}
|
package/dist/bundle/chunks/{typesafe-system-one-6UYWINOZ.js → typesafe-system-one-NSQNXICI.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
var p=Object.defineProperty;var r=(e,t)=>p(e,"name",{value:t,configurable:!0});import{createRequire as a}from"node:module";const d=a(import.meta.url);import{classifySystemOne as s}from"./chunk-
|
|
1
|
+
var p=Object.defineProperty;var r=(e,t)=>p(e,"name",{value:t,configurable:!0});import{createRequire as a}from"node:module";const d=a(import.meta.url);import{classifySystemOne as s}from"./chunk-KV7HXJIS.js";import{isRecord as i}from"./chunk-OLTY5TDX.js";import"./chunk-ML5DIOWR.js";import"./chunk-4PE5FX77.js";import"./chunk-UTB4DTYQ.js";import"./chunk-DM37LCOU.js";import"./chunk-4LDEEFCY.js";import"./chunk-XKOYUKPQ.js";import"./chunk-JXWJOIH4.js";var m={api:"typesafe-system-one",label:"System One API",detectCompat:r(e=>e.provider==="openrouter"||e.baseUrl.includes("openrouter.ai")?{imageInput:"state-image-urls",sendImageOptInHeader:!1}:{imageInput:"assets",sendImageOptInHeader:!0},"detectCompat"),url:r(e=>new URL("systemone",`${e.baseUrl.replace(/\/+$/u,"")}/`),"url"),payload:r((e,t)=>({model:e.id,...t}),"payload"),output:r(e=>{if(!i(e))throw new Error("System One API returned an unexpected response");return e},"output")},n=r((e,t,o)=>s(m,e,t,o),"classify");export{n as classify};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var k=Object.defineProperty;var a=(e,t)=>k(e,"name",{value:t,configurable:!0});import{createRequire as v}from"node:module";const pe=v(import.meta.url);import"./chunk-
|
|
1
|
+
var k=Object.defineProperty;var a=(e,t)=>k(e,"name",{value:t,configurable:!0});import{createRequire as v}from"node:module";const pe=v(import.meta.url);import"./chunk-5VVKJ7N6.js";import"./chunk-ZLZHK7BO.js";import"./chunk-TLYT7KXA.js";import"./chunk-M4QINYHM.js";import"./chunk-MOBJIVPU.js";import"./chunk-RRAXQWE3.js";import"./chunk-JUUJCOIR.js";import"./chunk-NJDCSLWK.js";import"./chunk-ZVMXRMIH.js";import"./chunk-5DM5CSLU.js";import"./chunk-B66W54NL.js";import"./chunk-G5AMLGXC.js";import"./chunk-LGD3AMTG.js";import"./chunk-NRQYSXAU.js";import"./chunk-6QGV3IWD.js";import{getAgentDir as F}from"./chunk-QM5JU2GS.js";import"./chunk-XJFQKN3N.js";import{declaredDataFormat as B,reportNewerDataFormat as C,t as U,writeFileAtomicSync as L}from"./chunk-XIF7O6UG.js";import"./chunk-IEBK4HQA.js";import"./chunk-5AGIVGSV.js";import"./chunk-723ZGEZ2.js";import"./chunk-ZG74NES2.js";import"./chunk-TMTOQ7H7.js";import"./chunk-7DDKXS2Q.js";import"./chunk-FFMDRXC4.js";import"./chunk-DM37LCOU.js";import"./chunk-4LDEEFCY.js";import"./chunk-XKOYUKPQ.js";import"./chunk-JXWJOIH4.js";import{readdir as W,readFile as I,stat as x}from"node:fs/promises";import{homedir as z}from"node:os";import{join as E}from"node:path";var P="sessions",V="usage-cache.json",w=1,T="dal-tool-repair",H=10,q=['"role":"assistant"','"type":"session"','"type":"usage"','"type":"compaction"','"type":"branch_summary"',`"customType":"${T}"`].flatMap(e=>[Buffer.from(e),Buffer.from(e.replace(":",": "))]),G=[Buffer.from('"role":"toolResult"'),Buffer.from('"role": "toolResult"')],J=[Buffer.from('"usage":{'),Buffer.from('"usage": {')],D=a((e,t)=>t.some(r=>e.includes(r)),"includesAny");function Y(e){let t=e.length>1024?e.subarray(0,1024):e;if(D(t,q))return!0;if(!D(t,G))return!1;let r=e.length>4096?e.subarray(e.length-4096):e;return D(r,J)}a(Y,"mightCarryUsage");var g=a(e=>typeof e=="number"&&Number.isFinite(e)?e:0,"finite");function A(e){if(!e||typeof e!="object")return;let t=e,r=t.cost,i={input:g(t.input),output:g(t.output),cacheRead:g(t.cacheRead),cacheWrite:g(t.cacheWrite),cost:typeof r=="number"?g(r):r&&typeof r=="object"?g(r.total):0};return i.cost===0&&i.input+i.output+i.cacheRead+i.cacheWrite===0?void 0:i}a(A,"amountOf");function S(...e){for(let t of e){let r=typeof t=="number"?t:Date.parse(String(t??""));if(Number.isFinite(r)&&r>0)return r}return 0}a(S,"timeOf");var j=a(e=>`${e.input}:${e.output}:${e.cacheRead}:${e.cacheWrite}`,"fingerprint");function K(e){let t={sessionId:"",cwd:"",records:[],toolRepairs:[]},r=a((n,d,o,f,s)=>{let p=n==="model"&&!s?`${d}:${f}:${j(o)}`:`${n}:${s}:${f}:${j(o)}`;t.records.push({source:n,label:d,timestamp:f,key:p,...o})},"add"),i=0;for(;i<e.length;){let n=e.indexOf(H,i);n===-1&&(n=e.length);let d=e.subarray(i,n);if(i=n+1,d.length===0||!Y(d))continue;let o;try{o=JSON.parse(d.toString("utf8"))}catch{continue}let f=typeof o.id=="string"?o.id:"";if(o.type==="session"){typeof o.id=="string"&&(t.sessionId=o.id),typeof o.cwd=="string"&&(t.cwd=o.cwd);continue}if(o.type==="usage"){let u=A(o.usage);u&&o.provider&&o.model&&r("model",`${o.provider}/${o.model}`,u,S(o.timestamp),f);continue}if(o.type==="custom"&&o.customType===T){let u=Array.isArray(o.data?.repairs)?o.data.repairs.length:0;u>0&&t.toolRepairs?.push({timestamp:S(o.timestamp),key:f,count:u});continue}if(o.type==="compaction"||o.type==="branch_summary"){let u=A(o.usage);u&&r("housekeeping","",u,S(o.timestamp),f);continue}let s=o.message;if(o.type!=="message"||!s)continue;let p=A(s.usage);if(!p)continue;let y=S(s.timestamp,o.timestamp);if(s.role==="assistant"&&s.provider&&s.model)r("model",`${s.provider}/${s.model}`,p,y,"");else if(s.role==="toolResult"){let u=s.toolName??"";r(u==="task"?"subagents":"tools",u,p,y,f)}}return t}a(K,"parseSessionBuffer");async function O(e,t=[]){let r;try{r=await W(e,{withFileTypes:!0})}catch{return t}for(let i of r){let n=E(e,i.name);i.isDirectory()?await O(n,t):i.isFile()&&i.name.endsWith(".jsonl")&&t.push(n)}return t}a(O,"sessionFiles");async function Q(e){try{let t=JSON.parse(await I(e,"utf8"));if(B(t)>w)return C(e),{doc:{formatVersion:w,files:{}},writable:!1};let r=t.files;if(r&&typeof r=="object")return{doc:{formatVersion:w,files:r},writable:!0}}catch{}return{doc:{formatVersion:w,files:{}},writable:!0}}a(Q,"readCache");async function X(e){let t=E(e,V),{doc:r,writable:i}=await Q(t),n={},d=!1,o=(await O(E(e,P))).sort(),f=[];for(let s of o){let p;try{p=await x(s)}catch{continue}let y=r.files[s];if(y&&y.size===p.size&&y.mtimeMs===p.mtimeMs&&y.parsed)n[s]=y;else{let u;try{u=await I(s)}catch{continue}n[s]={size:p.size,mtimeMs:p.mtimeMs,parsed:K(u)},d=!0}f.push(n[s].parsed)}if(Object.keys(r.files).length!==Object.keys(n).length&&(d=!0),i&&d)try{L(t,JSON.stringify({formatVersion:w,files:n}))}catch{}return f}a(X,"loadSessions");function Z(e){if(!e)return"?";let t=z(),r;e===t||e.startsWith(`${t}/`)?r=t:r=/^(\/Users\/[^/]+|\/home\/[^/]+)(?=\/|$)/.exec(e)?.[1];let i=(r===void 0?e:e.slice(r.length)).split(/[\\/]/).filter(Boolean).slice(0,2);return r===void 0?`/${i.join("/")}`:i.length>0?`~/${i.join("/")}`:"~"}a(Z,"projectLabel");function ee(e){let t=e.trim().toLowerCase();if(t==="")return{kind:"days",days:30,label:"30d"};if(t==="today")return{kind:"today",label:"today"};if(t==="all")return{kind:"all",label:"all"};let r=/^(\d{1,4})d$/.exec(t);if(r){let i=Number(r[1]);if(i>=1)return{kind:"days",days:i,label:`${i}d`}}}a(ee,"parseUsageRange");var _=a(()=>({input:0,output:0,cacheRead:0,cacheWrite:0,cost:0}),"empty");function M(e,t){e.input+=t.input,e.output+=t.output,e.cacheRead+=t.cacheRead,e.cacheWrite+=t.cacheWrite,e.cost+=t.cost}a(M,"addInto");function te(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}a(te,"startOfLocalDay");function re(e){let t=new Date(e),r=a(i=>String(i).padStart(2,"0"),"pad");return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}`}a(re,"dayKey");function oe(e,t){if(e.kind==="all")return Number.NEGATIVE_INFINITY;let r=te(t);if(e.kind==="today")return r;let i=new Date(r);return i.setDate(i.getDate()-(e.days-1)),i.getTime()}a(oe,"rangeStart");function ie(e){return e.source==="model"?e.label:e.source}a(ie,"modelKey");var ae={subagents:"\u5B50\u52A9\u624B",tools:"\u5DE5\u5177",housekeeping:"\u4E0A\u4E0B\u6587\u6574\u7406"};function se(e,t,r){let i=oe(t,r),n=new Set,d=_(),o={day:new Map,model:new Map,project:new Map},f={day:new Map,model:new Map,project:new Map},s=new Set,p=a((l,c,m,$,R)=>{let h=o[l].get(c);h||(h={key:c,label:m,sessions:0,..._()},o[l].set(c,h)),M(h,R);let b=f[l].get(c);b||(b=new Set,f[l].set(c,b)),b.add($),h.sessions=b.size},"bump");for(let l of e){if(!l.sessionId)continue;let c=Z(l.cwd);for(let m of l.records){if(m.timestamp<i||m.timestamp>r||n.has(m.key))continue;n.add(m.key),M(d,m),s.add(l.sessionId);let $=ie(m),R=re(m.timestamp);p("day",R,R,l.sessionId,m),p("model",$,m.source==="model"?m.label:U(ae[m.source]),l.sessionId,m),p("project",c,c,l.sessionId,m)}}let y=0,u=new Set;for(let l of e)for(let c of l.toolRepairs??[])c.timestamp<i||c.timestamp>r||u.has(c.key)||(u.add(c.key),y+=c.count);let N=a((l,c)=>c.cost-l.cost||l.label.localeCompare(c.label),"byCost");return{range:t,sessions:s.size,total:d,byDay:[...o.day.values()].sort((l,c)=>c.key.localeCompare(l.key)),byModel:[...o.model.values()].sort(N),byProject:[...o.project.values()].sort(N),toolRepairs:y}}a(se,"buildReport");async function ne(e){let t=await X(e.agentDir??F());return se(t,e.range,e.now??Date.now())}a(ne,"collectUsage");async function le(e){let t=ee(e.range);if(!t)throw new Error(`Unknown usage range: ${String(e.range)}`);return ne({range:t,...e.agentDir?{agentDir:e.agentDir}:{}})}a(le,"collectUsage2");export{le as collectUsage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var c=Object.defineProperty;var e=(r,t)=>c(r,"name",{value:t,configurable:!0});import{createRequire as u}from"node:module";const Tr=u(import.meta.url);import{dist_exports as o}from"./chunk-WLQ33LIH.js";import{DAL_ENGINE_PACKAGE_NAMES as n,dist_exports as p}from"./chunk-X63WCLSX.js";import"./chunk-J6H2LYOZ.js";import{all_exports as l,anthropicMessagesApi as M,azureOpenAIResponsesApi as S,bedrockConverseStreamApi as v,compile_exports as m,complete as R,completeSimple as N,generateImages as O,generateImagesOpenRouter as P,getApiProvider as y,getApiProviders as h,getImageModel as x,getImageModels as f,getImageProviders as D,getImagesApiProvider as H,getModel as V,getModels as G,getProviders as L,googleGenerativeAIApi as k,googleVertexApi as w,mistralConversationsApi as b,openAICodexResponsesApi as U,openAICompletionsApi as z,openAIResponsesApi as K,piMessagesApi as W,registerApiProvider as B,registerBuiltInApiProviders as F,registerBuiltInImagesApiProviders as Y,registerFauxProvider as q,registerImagesApiProvider as J,resetApiProviders as X,setBedrockProviderLoader as j,setBedrockProviderModule as Z,stream as $,streamAnthropic as Q,streamAzureOpenAIResponses as ee,streamGoogle as te,streamGoogleVertex as re,streamMistral as se,streamOpenAICodexResponses as oe,streamOpenAICompletions as ie,streamOpenAIResponses as ae,streamSimple as ne,streamSimpleAnthropic as pe,streamSimpleAzureOpenAIResponses as le,streamSimpleGoogle as me,streamSimpleGoogleVertex as Ae,streamSimpleMistral as ge,streamSimpleOpenAICodexResponses as de,streamSimpleOpenAICompletions as Ie,streamSimpleOpenAIResponses as _e,unregisterApiProviders as Te,value_exports as A}from"./chunk-KT7CXVDN.js";import{CACHE_WARMING_IDLE_CONTINUATION_PROBABILITY as Ce,CACHE_WARMING_MAX_AGE_MS as Ee,CACHE_WARMING_MAX_IDLE_AGE_MS as ce,CACHE_WARMING_MINIMUM_EXPECTED_SAVINGS as ue,createFauxCore as Me,envApiKeyAuth as Se,evaluateCacheWarming as ve,fauxAssistantMessage as Re,fauxProvider as Ne,fauxText as Oe,fauxThinking as Pe,fauxToolCall as ye,getCacheWarmingDelayMs as he,getCacheWarmingRequestOptions as xe,getOverflowPatterns as fe,getPromptCacheTtlMs as De,isCacheWarmingReplayable as He,isContextOverflow as Ve,isRecoverableLength as Ge,lazyOAuth as Le,validateToolArguments as ke,validateToolCall as we}from"./chunk-YOQ3KBG5.js";import"./chunk-XQF5XDEM.js";import{build_exports as g,typebox_exports as d}from"./chunk-JUUJCOIR.js";import{DEFAULT_MAX_AGENT_RETRY_DELAY_MS as be,isAccountLimitAssistantError as Ue,isNetworkAssistantError as ze,isRetryableAssistantError as Ke,retryAssistantCall as We,retryDelayMs as Be}from"./chunk-NJDCSLWK.js";import"./chunk-C5ELI234.js";import"./chunk-4BOWD7PQ.js";import"./chunk-HF334NQU.js";import"./chunk-G5AMLGXC.js";import"./chunk-F5SIUTR7.js";import{dist_exports as I}from"./chunk-AL3DFAIM.js";import"./chunk-6QGV3IWD.js";import"./chunk-R47JBGS3.js";import"./chunk-XJFQKN3N.js";import"./chunk-QU2VEHMW.js";import{uuidv7 as Fe}from"./chunk-IEBK4HQA.js";import"./chunk-5AGIVGSV.js";import{ANTHROPIC_API_KEY_ENV as Ye,ANTHROPIC_AUTH_TOKEN_ENV as qe,ANTHROPIC_FEDERATION_RULE_ID_ENV as Je,ANTHROPIC_IDENTITY_TOKEN_FILE_ENV as Xe,ANTHROPIC_OAUTH_TOKEN_ENV as je,ANTHROPIC_ORGANIZATION_ID_ENV as Ze,ANTHROPIC_SERVICE_ACCOUNT_ID_ENV as $e,ANTHROPIC_WORKSPACE_ID_ENV as Qe,findEnvKeys as et,getEnvApiKey as tt,setEnvApiKeyPolicy as rt}from"./chunk-723ZGEZ2.js";import{cleanupSessionResources as st,registerSessionResourceCleanup as ot}from"./chunk-ZG74NES2.js";import"./chunk-TMTOQ7H7.js";import"./chunk-7DDKXS2Q.js";import{StreamingJsonParser as it,ToolCallArgumentsStream as at,parseJsonWithRepair as nt,parseStreamingJson as pt,parseToolCallArguments as lt,repairJson as mt}from"./chunk-FFMDRXC4.js";import{AI_TELEMETRY_SCHEMA as At,InMemoryCredentialStore as gt,InMemoryModelsStore as dt,ModelsError as It,calculateCost as _t,clampThinkingLevel as Tt,collapseSystemMessages as Ct,createInitialSystemMessage as Et,createModels as ct,createProvider as ut,declarationsEqual as Mt,defaultProviderAuthContext as St,getCurrentSystemMessage as vt,getCurrentSystemPrompt as Rt,getCurrentTools as Nt,getDeclaredTools as Ot,getInitialSystemMessage as Pt,getModelType as yt,getSupportedThinkingLevels as ht,getToolStateChanges as xt,hasApi as ft,hasNonAdditiveToolChanges as Dt,hasToolRedefinitions as Ht,isModelType as Vt,lazyApi as Gt,lazyStream as Lt,modelsAreEqual as kt,models_exports as _,normalizeContext as wt,resolveTranscript as bt,resolveTranscriptTools as Ut,setAmbientAuthPolicy as zt,toToolDeclaration as Kt,withoutInitialSystemMessage as Wt}from"./chunk-VDPDHGGJ.js";import{AssistantMessageEventStream as Bt,EventStream as Ft,appendAssistantMessageDiagnostic as Yt,createAssistantMessageDiagnostic as qt,createAssistantMessageEventStream as Jt,extractDiagnosticError as Xt,firstTokenTimeoutMessage as jt,formatThrownValue as Zt,withFirstTokenTimeout as $t}from"./chunk-4LDEEFCY.js";import{PI_AI_VERSION as Qt,PI_ATTRIBUTION as er,contentText as tr,formatUserAgent as rr,getAttributionHeaders as sr,getClientVersion as or,getIdentityHeaders as ir,getOpenCodeSessionHeaders as ar,getSystemMessageText as nr,mergeClientIdentity as pr,renderSystemMessageUpdate as lr,withClientIdentity as mr}from"./chunk-F52JQCLE.js";import{__export as Ar}from"./chunk-JXWJOIH4.js";var T={},s={};Ar(s,{AI_TELEMETRY_SCHEMA:e(()=>At,"AI_TELEMETRY_SCHEMA"),ANTHROPIC_API_KEY_ENV:e(()=>Ye,"ANTHROPIC_API_KEY_ENV"),ANTHROPIC_AUTH_TOKEN_ENV:e(()=>qe,"ANTHROPIC_AUTH_TOKEN_ENV"),ANTHROPIC_FEDERATION_RULE_ID_ENV:e(()=>Je,"ANTHROPIC_FEDERATION_RULE_ID_ENV"),ANTHROPIC_IDENTITY_TOKEN_FILE_ENV:e(()=>Xe,"ANTHROPIC_IDENTITY_TOKEN_FILE_ENV"),ANTHROPIC_OAUTH_TOKEN_ENV:e(()=>je,"ANTHROPIC_OAUTH_TOKEN_ENV"),ANTHROPIC_ORGANIZATION_ID_ENV:e(()=>Ze,"ANTHROPIC_ORGANIZATION_ID_ENV"),ANTHROPIC_SERVICE_ACCOUNT_ID_ENV:e(()=>$e,"ANTHROPIC_SERVICE_ACCOUNT_ID_ENV"),ANTHROPIC_WORKSPACE_ID_ENV:e(()=>Qe,"ANTHROPIC_WORKSPACE_ID_ENV"),AssistantMessageEventStream:e(()=>Bt,"AssistantMessageEventStream"),CACHE_WARMING_IDLE_CONTINUATION_PROBABILITY:e(()=>Ce,"CACHE_WARMING_IDLE_CONTINUATION_PROBABILITY"),CACHE_WARMING_MAX_AGE_MS:e(()=>Ee,"CACHE_WARMING_MAX_AGE_MS"),CACHE_WARMING_MAX_IDLE_AGE_MS:e(()=>ce,"CACHE_WARMING_MAX_IDLE_AGE_MS"),CACHE_WARMING_MINIMUM_EXPECTED_SAVINGS:e(()=>ue,"CACHE_WARMING_MINIMUM_EXPECTED_SAVINGS"),DEFAULT_MAX_AGENT_RETRY_DELAY_MS:e(()=>be,"DEFAULT_MAX_AGENT_RETRY_DELAY_MS"),EventStream:e(()=>Ft,"EventStream"),InMemoryCredentialStore:e(()=>gt,"InMemoryCredentialStore"),InMemoryModelsStore:e(()=>dt,"InMemoryModelsStore"),ModelsError:e(()=>It,"ModelsError"),PI_AI_VERSION:e(()=>Qt,"PI_AI_VERSION"),PI_ATTRIBUTION:e(()=>er,"PI_ATTRIBUTION"),StreamingJsonParser:e(()=>it,"StreamingJsonParser"),StringEnum:e(()=>gr,"StringEnum"),ToolCallArgumentsStream:e(()=>at,"ToolCallArgumentsStream"),Type:e(()=>d,"Type"),anthropicMessagesApi:e(()=>M,"anthropicMessagesApi"),appendAssistantMessageDiagnostic:e(()=>Yt,"appendAssistantMessageDiagnostic"),azureOpenAIResponsesApi:e(()=>S,"azureOpenAIResponsesApi"),bedrockConverseStreamApi:e(()=>v,"bedrockConverseStreamApi"),calculateCost:e(()=>_t,"calculateCost"),clampThinkingLevel:e(()=>Tt,"clampThinkingLevel"),cleanupSessionResources:e(()=>st,"cleanupSessionResources"),collapseSystemMessages:e(()=>Ct,"collapseSystemMessages"),complete:e(()=>R,"complete"),completeSimple:e(()=>N,"completeSimple"),contentText:e(()=>tr,"contentText"),createAssistantMessageDiagnostic:e(()=>qt,"createAssistantMessageDiagnostic"),createAssistantMessageEventStream:e(()=>Jt,"createAssistantMessageEventStream"),createFauxCore:e(()=>Me,"createFauxCore"),createInitialSystemMessage:e(()=>Et,"createInitialSystemMessage"),createModels:e(()=>ct,"createModels"),createProvider:e(()=>ut,"createProvider"),declarationsEqual:e(()=>Mt,"declarationsEqual"),defaultProviderAuthContext:e(()=>St,"defaultProviderAuthContext"),envApiKeyAuth:e(()=>Se,"envApiKeyAuth"),evaluateCacheWarming:e(()=>ve,"evaluateCacheWarming"),extractDiagnosticError:e(()=>Xt,"extractDiagnosticError"),fauxAssistantMessage:e(()=>Re,"fauxAssistantMessage"),fauxProvider:e(()=>Ne,"fauxProvider"),fauxText:e(()=>Oe,"fauxText"),fauxThinking:e(()=>Pe,"fauxThinking"),fauxToolCall:e(()=>ye,"fauxToolCall"),findEnvKeys:e(()=>et,"findEnvKeys"),firstTokenTimeoutMessage:e(()=>jt,"firstTokenTimeoutMessage"),formatThrownValue:e(()=>Zt,"formatThrownValue"),formatUserAgent:e(()=>rr,"formatUserAgent"),generateImages:e(()=>O,"generateImages"),generateImagesOpenRouter:e(()=>P,"generateImagesOpenRouter"),getApiProvider:e(()=>y,"getApiProvider"),getApiProviders:e(()=>h,"getApiProviders"),getAttributionHeaders:e(()=>sr,"getAttributionHeaders"),getCacheWarmingDelayMs:e(()=>he,"getCacheWarmingDelayMs"),getCacheWarmingRequestOptions:e(()=>xe,"getCacheWarmingRequestOptions"),getClientVersion:e(()=>or,"getClientVersion"),getCurrentSystemMessage:e(()=>vt,"getCurrentSystemMessage"),getCurrentSystemPrompt:e(()=>Rt,"getCurrentSystemPrompt"),getCurrentTools:e(()=>Nt,"getCurrentTools"),getDeclaredTools:e(()=>Ot,"getDeclaredTools"),getEnvApiKey:e(()=>tt,"getEnvApiKey"),getIdentityHeaders:e(()=>ir,"getIdentityHeaders"),getImageModel:e(()=>x,"getImageModel"),getImageModels:e(()=>f,"getImageModels"),getImageProviders:e(()=>D,"getImageProviders"),getImagesApiProvider:e(()=>H,"getImagesApiProvider"),getInitialSystemMessage:e(()=>Pt,"getInitialSystemMessage"),getModel:e(()=>V,"getModel"),getModelType:e(()=>yt,"getModelType"),getModels:e(()=>G,"getModels"),getOpenCodeSessionHeaders:e(()=>ar,"getOpenCodeSessionHeaders"),getOverflowPatterns:e(()=>fe,"getOverflowPatterns"),getPromptCacheTtlMs:e(()=>De,"getPromptCacheTtlMs"),getProviders:e(()=>L,"getProviders"),getSupportedThinkingLevels:e(()=>ht,"getSupportedThinkingLevels"),getSystemMessageText:e(()=>nr,"getSystemMessageText"),getToolStateChanges:e(()=>xt,"getToolStateChanges"),googleGenerativeAIApi:e(()=>k,"googleGenerativeAIApi"),googleVertexApi:e(()=>w,"googleVertexApi"),hasApi:e(()=>ft,"hasApi"),hasNonAdditiveToolChanges:e(()=>Dt,"hasNonAdditiveToolChanges"),hasToolRedefinitions:e(()=>Ht,"hasToolRedefinitions"),isAccountLimitAssistantError:e(()=>Ue,"isAccountLimitAssistantError"),isCacheWarmingReplayable:e(()=>He,"isCacheWarmingReplayable"),isContextOverflow:e(()=>Ve,"isContextOverflow"),isModelType:e(()=>Vt,"isModelType"),isNetworkAssistantError:e(()=>ze,"isNetworkAssistantError"),isRecoverableLength:e(()=>Ge,"isRecoverableLength"),isRetryableAssistantError:e(()=>Ke,"isRetryableAssistantError"),lazyApi:e(()=>Gt,"lazyApi"),lazyOAuth:e(()=>Le,"lazyOAuth"),lazyStream:e(()=>Lt,"lazyStream"),mergeClientIdentity:e(()=>pr,"mergeClientIdentity"),mistralConversationsApi:e(()=>b,"mistralConversationsApi"),modelsAreEqual:e(()=>kt,"modelsAreEqual"),normalizeContext:e(()=>wt,"normalizeContext"),openAICodexResponsesApi:e(()=>U,"openAICodexResponsesApi"),openAICompletionsApi:e(()=>z,"openAICompletionsApi"),openAIResponsesApi:e(()=>K,"openAIResponsesApi"),parseJsonWithRepair:e(()=>nt,"parseJsonWithRepair"),parseStreamingJson:e(()=>pt,"parseStreamingJson"),parseToolCallArguments:e(()=>lt,"parseToolCallArguments"),piMessagesApi:e(()=>W,"piMessagesApi"),registerApiProvider:e(()=>B,"registerApiProvider"),registerBuiltInApiProviders:e(()=>F,"registerBuiltInApiProviders"),registerBuiltInImagesApiProviders:e(()=>Y,"registerBuiltInImagesApiProviders"),registerFauxProvider:e(()=>q,"registerFauxProvider"),registerImagesApiProvider:e(()=>J,"registerImagesApiProvider"),registerSessionResourceCleanup:e(()=>ot,"registerSessionResourceCleanup"),renderSystemMessageUpdate:e(()=>lr,"renderSystemMessageUpdate"),repairJson:e(()=>mt,"repairJson"),resetApiProviders:e(()=>X,"resetApiProviders"),resolveTranscript:e(()=>bt,"resolveTranscript"),resolveTranscriptTools:e(()=>Ut,"resolveTranscriptTools"),retryAssistantCall:e(()=>We,"retryAssistantCall"),retryDelayMs:e(()=>Be,"retryDelayMs"),setAmbientAuthPolicy:e(()=>zt,"setAmbientAuthPolicy"),setBedrockProviderLoader:e(()=>j,"setBedrockProviderLoader"),setBedrockProviderModule:e(()=>Z,"setBedrockProviderModule"),setEnvApiKeyPolicy:e(()=>rt,"setEnvApiKeyPolicy"),stream:e(()=>$,"stream"),streamAnthropic:e(()=>Q,"streamAnthropic"),streamAzureOpenAIResponses:e(()=>ee,"streamAzureOpenAIResponses"),streamGoogle:e(()=>te,"streamGoogle"),streamGoogleVertex:e(()=>re,"streamGoogleVertex"),streamMistral:e(()=>se,"streamMistral"),streamOpenAICodexResponses:e(()=>oe,"streamOpenAICodexResponses"),streamOpenAICompletions:e(()=>ie,"streamOpenAICompletions"),streamOpenAIResponses:e(()=>ae,"streamOpenAIResponses"),streamSimple:e(()=>ne,"streamSimple"),streamSimpleAnthropic:e(()=>pe,"streamSimpleAnthropic"),streamSimpleAzureOpenAIResponses:e(()=>le,"streamSimpleAzureOpenAIResponses"),streamSimpleGoogle:e(()=>me,"streamSimpleGoogle"),streamSimpleGoogleVertex:e(()=>Ae,"streamSimpleGoogleVertex"),streamSimpleMistral:e(()=>ge,"streamSimpleMistral"),streamSimpleOpenAICodexResponses:e(()=>de,"streamSimpleOpenAICodexResponses"),streamSimpleOpenAICompletions:e(()=>Ie,"streamSimpleOpenAICompletions"),streamSimpleOpenAIResponses:e(()=>_e,"streamSimpleOpenAIResponses"),toToolDeclaration:e(()=>Kt,"toToolDeclaration"),unregisterApiProviders:e(()=>Te,"unregisterApiProviders"),uuidv7:e(()=>Fe,"uuidv7"),validateToolArguments:e(()=>ke,"validateToolArguments"),validateToolCall:e(()=>we,"validateToolCall"),withClientIdentity:e(()=>mr,"withClientIdentity"),withFirstTokenTimeout:e(()=>$t,"withFirstTokenTimeout"),withoutInitialSystemMessage:e(()=>Wt,"withoutInitialSystemMessage")});function gr(r,t){return d.Unsafe({type:"string",enum:r,...t?.description&&{description:t.description},...t?.default&&{default:t.default}})}e(gr,"StringEnum");var i={typebox:g,"typebox/compile":m,"typebox/value":A,"@sinclair/typebox":g,"@sinclair/typebox/compile":m,"@sinclair/typebox/value":A,"@earendil-works/pi-agent-core":p,"@earendil-works/pi-tui":I,"@earendil-works/pi-ai":s,"@earendil-works/pi-ai/compat":s,"@earendil-works/pi-ai/models":_,"@earendil-works/pi-ai/oauth":T,"@earendil-works/pi-ai/providers/all":l,"@earendil-works/pi-coding-agent":o,"@mariozechner/pi-agent-core":p,"@mariozechner/pi-tui":I,"@mariozechner/pi-ai":s,"@mariozechner/pi-ai/compat":s,"@mariozechner/pi-ai/models":_,"@mariozechner/pi-ai/oauth":T,"@mariozechner/pi-ai/providers/all":l,"@mariozechner/pi-coding-agent":o},dr={sdk:e(()=>import("./sdk-32L63XRF.js"),"sdk"),office:e(()=>import("./office-UBOUFRAU.js"),"office"),mcp:e(()=>import("./mcp-F3BQ6MQW.js"),"mcp"),router:e(()=>import("./router-V3EIAYOF.js"),"router"),rewind:e(()=>import("./rewind-2OYLDDHH.js"),"rewind"),review:e(()=>import("./review-WTYIVWYR.js"),"review"),usage:e(()=>import("./usage-JODQIC2H.js"),"usage"),sync:e(()=>import("./sync-Z5USQ7AN.js"),"sync")};for(let r of n)i[r]=o;for(let[r,t]of Object.entries(dr)){let a,C={enumerable:!0,get:e(()=>(a??=t(),a),"get")};for(let E of n)Object.defineProperty(i,`${E}/${r}`,C)}export{i as VIRTUAL_MODULES};
|
|
1
|
+
var c=Object.defineProperty;var e=(r,t)=>c(r,"name",{value:t,configurable:!0});import{createRequire as u}from"node:module";const Tr=u(import.meta.url);import{dist_exports as o}from"./chunk-5VVKJ7N6.js";import{DAL_ENGINE_PACKAGE_NAMES as n,dist_exports as p}from"./chunk-ZLZHK7BO.js";import"./chunk-TLYT7KXA.js";import{all_exports as l,anthropicMessagesApi as M,azureOpenAIResponsesApi as S,bedrockConverseStreamApi as v,compile_exports as m,complete as R,completeSimple as N,generateImages as O,generateImagesOpenRouter as P,getApiProvider as y,getApiProviders as h,getImageModel as x,getImageModels as f,getImageProviders as D,getImagesApiProvider as H,getModel as V,getModels as G,getProviders as L,googleGenerativeAIApi as k,googleVertexApi as w,mistralConversationsApi as b,openAICodexResponsesApi as U,openAICompletionsApi as z,openAIResponsesApi as K,piMessagesApi as W,registerApiProvider as B,registerBuiltInApiProviders as F,registerBuiltInImagesApiProviders as Y,registerFauxProvider as q,registerImagesApiProvider as J,resetApiProviders as X,setBedrockProviderLoader as j,setBedrockProviderModule as Z,stream as $,streamAnthropic as Q,streamAzureOpenAIResponses as ee,streamGoogle as te,streamGoogleVertex as re,streamMistral as se,streamOpenAICodexResponses as oe,streamOpenAICompletions as ie,streamOpenAIResponses as ae,streamSimple as ne,streamSimpleAnthropic as pe,streamSimpleAzureOpenAIResponses as le,streamSimpleGoogle as me,streamSimpleGoogleVertex as Ae,streamSimpleMistral as ge,streamSimpleOpenAICodexResponses as de,streamSimpleOpenAICompletions as Ie,streamSimpleOpenAIResponses as _e,unregisterApiProviders as Te,value_exports as A}from"./chunk-M4QINYHM.js";import{CACHE_WARMING_IDLE_CONTINUATION_PROBABILITY as Ce,CACHE_WARMING_MAX_AGE_MS as Ee,CACHE_WARMING_MAX_IDLE_AGE_MS as ce,CACHE_WARMING_MINIMUM_EXPECTED_SAVINGS as ue,createFauxCore as Me,envApiKeyAuth as Se,evaluateCacheWarming as ve,fauxAssistantMessage as Re,fauxProvider as Ne,fauxText as Oe,fauxThinking as Pe,fauxToolCall as ye,getCacheWarmingDelayMs as he,getCacheWarmingRequestOptions as xe,getOverflowPatterns as fe,getPromptCacheTtlMs as De,isCacheWarmingReplayable as He,isContextOverflow as Ve,isRecoverableLength as Ge,lazyOAuth as Le,validateToolArguments as ke,validateToolCall as we}from"./chunk-MOBJIVPU.js";import"./chunk-RRAXQWE3.js";import{build_exports as g,typebox_exports as d}from"./chunk-JUUJCOIR.js";import{DEFAULT_MAX_AGENT_RETRY_DELAY_MS as be,isAccountLimitAssistantError as Ue,isNetworkAssistantError as ze,isRetryableAssistantError as Ke,retryAssistantCall as We,retryDelayMs as Be}from"./chunk-NJDCSLWK.js";import"./chunk-ZVMXRMIH.js";import"./chunk-5DM5CSLU.js";import"./chunk-B66W54NL.js";import"./chunk-G5AMLGXC.js";import"./chunk-LGD3AMTG.js";import{dist_exports as I}from"./chunk-NRQYSXAU.js";import"./chunk-6QGV3IWD.js";import"./chunk-QM5JU2GS.js";import"./chunk-XJFQKN3N.js";import"./chunk-XIF7O6UG.js";import{uuidv7 as Fe}from"./chunk-IEBK4HQA.js";import"./chunk-5AGIVGSV.js";import{ANTHROPIC_API_KEY_ENV as Ye,ANTHROPIC_AUTH_TOKEN_ENV as qe,ANTHROPIC_FEDERATION_RULE_ID_ENV as Je,ANTHROPIC_IDENTITY_TOKEN_FILE_ENV as Xe,ANTHROPIC_OAUTH_TOKEN_ENV as je,ANTHROPIC_ORGANIZATION_ID_ENV as Ze,ANTHROPIC_SERVICE_ACCOUNT_ID_ENV as $e,ANTHROPIC_WORKSPACE_ID_ENV as Qe,findEnvKeys as et,getEnvApiKey as tt,setEnvApiKeyPolicy as rt}from"./chunk-723ZGEZ2.js";import{cleanupSessionResources as st,registerSessionResourceCleanup as ot}from"./chunk-ZG74NES2.js";import"./chunk-TMTOQ7H7.js";import"./chunk-7DDKXS2Q.js";import{StreamingJsonParser as it,ToolCallArgumentsStream as at,parseJsonWithRepair as nt,parseStreamingJson as pt,parseToolCallArguments as lt,repairJson as mt}from"./chunk-FFMDRXC4.js";import{AI_TELEMETRY_SCHEMA as At,InMemoryCredentialStore as gt,InMemoryModelsStore as dt,ModelsError as It,calculateCost as _t,clampThinkingLevel as Tt,collapseSystemMessages as Ct,createInitialSystemMessage as Et,createModels as ct,createProvider as ut,declarationsEqual as Mt,defaultProviderAuthContext as St,getCurrentSystemMessage as vt,getCurrentSystemPrompt as Rt,getCurrentTools as Nt,getDeclaredTools as Ot,getInitialSystemMessage as Pt,getModelType as yt,getSupportedThinkingLevels as ht,getToolStateChanges as xt,hasApi as ft,hasNonAdditiveToolChanges as Dt,hasToolRedefinitions as Ht,isModelType as Vt,lazyApi as Gt,lazyStream as Lt,modelsAreEqual as kt,models_exports as _,normalizeContext as wt,resolveTranscript as bt,resolveTranscriptTools as Ut,setAmbientAuthPolicy as zt,toToolDeclaration as Kt,withoutInitialSystemMessage as Wt}from"./chunk-DM37LCOU.js";import{AssistantMessageEventStream as Bt,EventStream as Ft,appendAssistantMessageDiagnostic as Yt,createAssistantMessageDiagnostic as qt,createAssistantMessageEventStream as Jt,extractDiagnosticError as Xt,firstTokenTimeoutMessage as jt,formatThrownValue as Zt,withFirstTokenTimeout as $t}from"./chunk-4LDEEFCY.js";import{PI_AI_VERSION as Qt,PI_ATTRIBUTION as er,contentText as tr,formatUserAgent as rr,getAttributionHeaders as sr,getClientVersion as or,getIdentityHeaders as ir,getOpenCodeSessionHeaders as ar,getSystemMessageText as nr,mergeClientIdentity as pr,renderSystemMessageUpdate as lr,withClientIdentity as mr}from"./chunk-XKOYUKPQ.js";import{__export as Ar}from"./chunk-JXWJOIH4.js";var T={},s={};Ar(s,{AI_TELEMETRY_SCHEMA:e(()=>At,"AI_TELEMETRY_SCHEMA"),ANTHROPIC_API_KEY_ENV:e(()=>Ye,"ANTHROPIC_API_KEY_ENV"),ANTHROPIC_AUTH_TOKEN_ENV:e(()=>qe,"ANTHROPIC_AUTH_TOKEN_ENV"),ANTHROPIC_FEDERATION_RULE_ID_ENV:e(()=>Je,"ANTHROPIC_FEDERATION_RULE_ID_ENV"),ANTHROPIC_IDENTITY_TOKEN_FILE_ENV:e(()=>Xe,"ANTHROPIC_IDENTITY_TOKEN_FILE_ENV"),ANTHROPIC_OAUTH_TOKEN_ENV:e(()=>je,"ANTHROPIC_OAUTH_TOKEN_ENV"),ANTHROPIC_ORGANIZATION_ID_ENV:e(()=>Ze,"ANTHROPIC_ORGANIZATION_ID_ENV"),ANTHROPIC_SERVICE_ACCOUNT_ID_ENV:e(()=>$e,"ANTHROPIC_SERVICE_ACCOUNT_ID_ENV"),ANTHROPIC_WORKSPACE_ID_ENV:e(()=>Qe,"ANTHROPIC_WORKSPACE_ID_ENV"),AssistantMessageEventStream:e(()=>Bt,"AssistantMessageEventStream"),CACHE_WARMING_IDLE_CONTINUATION_PROBABILITY:e(()=>Ce,"CACHE_WARMING_IDLE_CONTINUATION_PROBABILITY"),CACHE_WARMING_MAX_AGE_MS:e(()=>Ee,"CACHE_WARMING_MAX_AGE_MS"),CACHE_WARMING_MAX_IDLE_AGE_MS:e(()=>ce,"CACHE_WARMING_MAX_IDLE_AGE_MS"),CACHE_WARMING_MINIMUM_EXPECTED_SAVINGS:e(()=>ue,"CACHE_WARMING_MINIMUM_EXPECTED_SAVINGS"),DEFAULT_MAX_AGENT_RETRY_DELAY_MS:e(()=>be,"DEFAULT_MAX_AGENT_RETRY_DELAY_MS"),EventStream:e(()=>Ft,"EventStream"),InMemoryCredentialStore:e(()=>gt,"InMemoryCredentialStore"),InMemoryModelsStore:e(()=>dt,"InMemoryModelsStore"),ModelsError:e(()=>It,"ModelsError"),PI_AI_VERSION:e(()=>Qt,"PI_AI_VERSION"),PI_ATTRIBUTION:e(()=>er,"PI_ATTRIBUTION"),StreamingJsonParser:e(()=>it,"StreamingJsonParser"),StringEnum:e(()=>gr,"StringEnum"),ToolCallArgumentsStream:e(()=>at,"ToolCallArgumentsStream"),Type:e(()=>d,"Type"),anthropicMessagesApi:e(()=>M,"anthropicMessagesApi"),appendAssistantMessageDiagnostic:e(()=>Yt,"appendAssistantMessageDiagnostic"),azureOpenAIResponsesApi:e(()=>S,"azureOpenAIResponsesApi"),bedrockConverseStreamApi:e(()=>v,"bedrockConverseStreamApi"),calculateCost:e(()=>_t,"calculateCost"),clampThinkingLevel:e(()=>Tt,"clampThinkingLevel"),cleanupSessionResources:e(()=>st,"cleanupSessionResources"),collapseSystemMessages:e(()=>Ct,"collapseSystemMessages"),complete:e(()=>R,"complete"),completeSimple:e(()=>N,"completeSimple"),contentText:e(()=>tr,"contentText"),createAssistantMessageDiagnostic:e(()=>qt,"createAssistantMessageDiagnostic"),createAssistantMessageEventStream:e(()=>Jt,"createAssistantMessageEventStream"),createFauxCore:e(()=>Me,"createFauxCore"),createInitialSystemMessage:e(()=>Et,"createInitialSystemMessage"),createModels:e(()=>ct,"createModels"),createProvider:e(()=>ut,"createProvider"),declarationsEqual:e(()=>Mt,"declarationsEqual"),defaultProviderAuthContext:e(()=>St,"defaultProviderAuthContext"),envApiKeyAuth:e(()=>Se,"envApiKeyAuth"),evaluateCacheWarming:e(()=>ve,"evaluateCacheWarming"),extractDiagnosticError:e(()=>Xt,"extractDiagnosticError"),fauxAssistantMessage:e(()=>Re,"fauxAssistantMessage"),fauxProvider:e(()=>Ne,"fauxProvider"),fauxText:e(()=>Oe,"fauxText"),fauxThinking:e(()=>Pe,"fauxThinking"),fauxToolCall:e(()=>ye,"fauxToolCall"),findEnvKeys:e(()=>et,"findEnvKeys"),firstTokenTimeoutMessage:e(()=>jt,"firstTokenTimeoutMessage"),formatThrownValue:e(()=>Zt,"formatThrownValue"),formatUserAgent:e(()=>rr,"formatUserAgent"),generateImages:e(()=>O,"generateImages"),generateImagesOpenRouter:e(()=>P,"generateImagesOpenRouter"),getApiProvider:e(()=>y,"getApiProvider"),getApiProviders:e(()=>h,"getApiProviders"),getAttributionHeaders:e(()=>sr,"getAttributionHeaders"),getCacheWarmingDelayMs:e(()=>he,"getCacheWarmingDelayMs"),getCacheWarmingRequestOptions:e(()=>xe,"getCacheWarmingRequestOptions"),getClientVersion:e(()=>or,"getClientVersion"),getCurrentSystemMessage:e(()=>vt,"getCurrentSystemMessage"),getCurrentSystemPrompt:e(()=>Rt,"getCurrentSystemPrompt"),getCurrentTools:e(()=>Nt,"getCurrentTools"),getDeclaredTools:e(()=>Ot,"getDeclaredTools"),getEnvApiKey:e(()=>tt,"getEnvApiKey"),getIdentityHeaders:e(()=>ir,"getIdentityHeaders"),getImageModel:e(()=>x,"getImageModel"),getImageModels:e(()=>f,"getImageModels"),getImageProviders:e(()=>D,"getImageProviders"),getImagesApiProvider:e(()=>H,"getImagesApiProvider"),getInitialSystemMessage:e(()=>Pt,"getInitialSystemMessage"),getModel:e(()=>V,"getModel"),getModelType:e(()=>yt,"getModelType"),getModels:e(()=>G,"getModels"),getOpenCodeSessionHeaders:e(()=>ar,"getOpenCodeSessionHeaders"),getOverflowPatterns:e(()=>fe,"getOverflowPatterns"),getPromptCacheTtlMs:e(()=>De,"getPromptCacheTtlMs"),getProviders:e(()=>L,"getProviders"),getSupportedThinkingLevels:e(()=>ht,"getSupportedThinkingLevels"),getSystemMessageText:e(()=>nr,"getSystemMessageText"),getToolStateChanges:e(()=>xt,"getToolStateChanges"),googleGenerativeAIApi:e(()=>k,"googleGenerativeAIApi"),googleVertexApi:e(()=>w,"googleVertexApi"),hasApi:e(()=>ft,"hasApi"),hasNonAdditiveToolChanges:e(()=>Dt,"hasNonAdditiveToolChanges"),hasToolRedefinitions:e(()=>Ht,"hasToolRedefinitions"),isAccountLimitAssistantError:e(()=>Ue,"isAccountLimitAssistantError"),isCacheWarmingReplayable:e(()=>He,"isCacheWarmingReplayable"),isContextOverflow:e(()=>Ve,"isContextOverflow"),isModelType:e(()=>Vt,"isModelType"),isNetworkAssistantError:e(()=>ze,"isNetworkAssistantError"),isRecoverableLength:e(()=>Ge,"isRecoverableLength"),isRetryableAssistantError:e(()=>Ke,"isRetryableAssistantError"),lazyApi:e(()=>Gt,"lazyApi"),lazyOAuth:e(()=>Le,"lazyOAuth"),lazyStream:e(()=>Lt,"lazyStream"),mergeClientIdentity:e(()=>pr,"mergeClientIdentity"),mistralConversationsApi:e(()=>b,"mistralConversationsApi"),modelsAreEqual:e(()=>kt,"modelsAreEqual"),normalizeContext:e(()=>wt,"normalizeContext"),openAICodexResponsesApi:e(()=>U,"openAICodexResponsesApi"),openAICompletionsApi:e(()=>z,"openAICompletionsApi"),openAIResponsesApi:e(()=>K,"openAIResponsesApi"),parseJsonWithRepair:e(()=>nt,"parseJsonWithRepair"),parseStreamingJson:e(()=>pt,"parseStreamingJson"),parseToolCallArguments:e(()=>lt,"parseToolCallArguments"),piMessagesApi:e(()=>W,"piMessagesApi"),registerApiProvider:e(()=>B,"registerApiProvider"),registerBuiltInApiProviders:e(()=>F,"registerBuiltInApiProviders"),registerBuiltInImagesApiProviders:e(()=>Y,"registerBuiltInImagesApiProviders"),registerFauxProvider:e(()=>q,"registerFauxProvider"),registerImagesApiProvider:e(()=>J,"registerImagesApiProvider"),registerSessionResourceCleanup:e(()=>ot,"registerSessionResourceCleanup"),renderSystemMessageUpdate:e(()=>lr,"renderSystemMessageUpdate"),repairJson:e(()=>mt,"repairJson"),resetApiProviders:e(()=>X,"resetApiProviders"),resolveTranscript:e(()=>bt,"resolveTranscript"),resolveTranscriptTools:e(()=>Ut,"resolveTranscriptTools"),retryAssistantCall:e(()=>We,"retryAssistantCall"),retryDelayMs:e(()=>Be,"retryDelayMs"),setAmbientAuthPolicy:e(()=>zt,"setAmbientAuthPolicy"),setBedrockProviderLoader:e(()=>j,"setBedrockProviderLoader"),setBedrockProviderModule:e(()=>Z,"setBedrockProviderModule"),setEnvApiKeyPolicy:e(()=>rt,"setEnvApiKeyPolicy"),stream:e(()=>$,"stream"),streamAnthropic:e(()=>Q,"streamAnthropic"),streamAzureOpenAIResponses:e(()=>ee,"streamAzureOpenAIResponses"),streamGoogle:e(()=>te,"streamGoogle"),streamGoogleVertex:e(()=>re,"streamGoogleVertex"),streamMistral:e(()=>se,"streamMistral"),streamOpenAICodexResponses:e(()=>oe,"streamOpenAICodexResponses"),streamOpenAICompletions:e(()=>ie,"streamOpenAICompletions"),streamOpenAIResponses:e(()=>ae,"streamOpenAIResponses"),streamSimple:e(()=>ne,"streamSimple"),streamSimpleAnthropic:e(()=>pe,"streamSimpleAnthropic"),streamSimpleAzureOpenAIResponses:e(()=>le,"streamSimpleAzureOpenAIResponses"),streamSimpleGoogle:e(()=>me,"streamSimpleGoogle"),streamSimpleGoogleVertex:e(()=>Ae,"streamSimpleGoogleVertex"),streamSimpleMistral:e(()=>ge,"streamSimpleMistral"),streamSimpleOpenAICodexResponses:e(()=>de,"streamSimpleOpenAICodexResponses"),streamSimpleOpenAICompletions:e(()=>Ie,"streamSimpleOpenAICompletions"),streamSimpleOpenAIResponses:e(()=>_e,"streamSimpleOpenAIResponses"),toToolDeclaration:e(()=>Kt,"toToolDeclaration"),unregisterApiProviders:e(()=>Te,"unregisterApiProviders"),uuidv7:e(()=>Fe,"uuidv7"),validateToolArguments:e(()=>ke,"validateToolArguments"),validateToolCall:e(()=>we,"validateToolCall"),withClientIdentity:e(()=>mr,"withClientIdentity"),withFirstTokenTimeout:e(()=>$t,"withFirstTokenTimeout"),withoutInitialSystemMessage:e(()=>Wt,"withoutInitialSystemMessage")});function gr(r,t){return d.Unsafe({type:"string",enum:r,...t?.description&&{description:t.description},...t?.default&&{default:t.default}})}e(gr,"StringEnum");var i={typebox:g,"typebox/compile":m,"typebox/value":A,"@sinclair/typebox":g,"@sinclair/typebox/compile":m,"@sinclair/typebox/value":A,"@earendil-works/pi-agent-core":p,"@earendil-works/pi-tui":I,"@earendil-works/pi-ai":s,"@earendil-works/pi-ai/compat":s,"@earendil-works/pi-ai/models":_,"@earendil-works/pi-ai/oauth":T,"@earendil-works/pi-ai/providers/all":l,"@earendil-works/pi-coding-agent":o,"@mariozechner/pi-agent-core":p,"@mariozechner/pi-tui":I,"@mariozechner/pi-ai":s,"@mariozechner/pi-ai/compat":s,"@mariozechner/pi-ai/models":_,"@mariozechner/pi-ai/oauth":T,"@mariozechner/pi-ai/providers/all":l,"@mariozechner/pi-coding-agent":o},dr={sdk:e(()=>import("./sdk-6F6YIKOL.js"),"sdk"),office:e(()=>import("./office-FIY2WQ2K.js"),"office"),mcp:e(()=>import("./mcp-7W2PZMFF.js"),"mcp"),router:e(()=>import("./router-ZQ7UPIHA.js"),"router"),rewind:e(()=>import("./rewind-2OYLDDHH.js"),"rewind"),review:e(()=>import("./review-ESZWG3ID.js"),"review"),usage:e(()=>import("./usage-5VHK66HK.js"),"usage"),sync:e(()=>import("./sync-F7N6C6RF.js"),"sync")};for(let r of n)i[r]=o;for(let[r,t]of Object.entries(dr)){let a,C={enumerable:!0,get:e(()=>(a??=t(),a),"get")};for(let E of n)Object.defineProperty(i,`${E}/${r}`,C)}export{i as VIRTUAL_MODULES};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var o=Object.defineProperty;var r=(i,t)=>o(i,"name",{value:t,configurable:!0});import{createRequire as p}from"node:module";const a=p(import.meta.url);import{configureHttpDispatcher as m,main as e}from"./chunks/chunk-
|
|
2
|
+
var o=Object.defineProperty;var r=(i,t)=>o(i,"name",{value:t,configurable:!0});import{createRequire as p}from"node:module";const a=p(import.meta.url);import{configureHttpDispatcher as m,main as e}from"./chunks/chunk-ZLZHK7BO.js";import"./chunks/chunk-TLYT7KXA.js";import"./chunks/chunk-M4QINYHM.js";import"./chunks/chunk-MOBJIVPU.js";import"./chunks/chunk-RRAXQWE3.js";import"./chunks/chunk-JUUJCOIR.js";import"./chunks/chunk-NJDCSLWK.js";import"./chunks/chunk-ZVMXRMIH.js";import"./chunks/chunk-5DM5CSLU.js";import"./chunks/chunk-B66W54NL.js";import"./chunks/chunk-G5AMLGXC.js";import"./chunks/chunk-LGD3AMTG.js";import"./chunks/chunk-NRQYSXAU.js";import"./chunks/chunk-6QGV3IWD.js";import{APP_NAME as s}from"./chunks/chunk-QM5JU2GS.js";import"./chunks/chunk-XJFQKN3N.js";import"./chunks/chunk-XIF7O6UG.js";import"./chunks/chunk-IEBK4HQA.js";import"./chunks/chunk-5AGIVGSV.js";import"./chunks/chunk-723ZGEZ2.js";import"./chunks/chunk-ZG74NES2.js";import"./chunks/chunk-TMTOQ7H7.js";import"./chunks/chunk-7DDKXS2Q.js";import"./chunks/chunk-FFMDRXC4.js";import"./chunks/chunk-DM37LCOU.js";import"./chunks/chunk-4LDEEFCY.js";import"./chunks/chunk-XKOYUKPQ.js";import"./chunks/chunk-JXWJOIH4.js";function n(){process.title=s,process.env.PI_CODING_AGENT="true",process.env.AI_AGENT="pi",process.emitWarning=(()=>{}),m()}r(n,"setupCli"),n(),e(process.argv.slice(2));
|
package/dist/bundle/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as e}from"node:module";const ci=e(import.meta.url);import{DAL_HOOK_ENTRY_TYPE as o,DAL_HOOK_NOTIFICATION_CHANNEL as t,STALE_AFTER_MS as r,ShowImagesSelectorComponent as i,ThemeSelectorComponent as n,WORKSPACE_LOCK_DIR_NAME as a,WORKSPACE_LOCK_FILE as s,buildDalHookInput as l,claimWorkspace as m,dalHookActivity as c,dalHooksExtension as p,decideDalHooks as S,defaultWorkspaceLockDir as d,engineToolInput as E,formatDalHookActivity as T,gitDirOf as u,hookToolInput as g,hookToolName as C,isDalHookActivity as D,readWorkspaceLock as R,releaseWorkspace as _,reportDalHookProblems as A,runDalCommandHook as h,runDalHookEvent as k,runDalHooks as P,runNotificationHooks as L,runPostToolUseHooks as O,runPreToolUseHooks as f,runSessionStartHooks as H,runStopHooks as I,runUserPromptSubmitHooks as M,selectDalHooks as N,shellCommandDirectory as F,toolMatchNames as y,workspaceLockIsLive as x,workspaceLockPath as v,workspaceOwnerSessionId as U}from"./chunks/chunk-WLQ33LIH.js";import{ADAPTATION_FILE as b,AgentSession as B,AgentSessionRuntime as w,AssistantMessageComponent as K,BackgroundProcessManager as W,BashExecutionComponent as j,BorderedLoader as V,BranchSummaryMessageComponent as G,CompactionSummaryMessageComponent as z,CustomEditor as X,CustomMessageComponent as q,DEFAULT_COMPACTION_SETTINGS as Y,DefaultPackageManager as J,DefaultResourceLoader as Q,DynamicBorder as Z,ENGINE_MARKET_CACHE_FILE as $,ExtensionEditorComponent as ee,ExtensionFatalError as oe,ExtensionInputComponent as te,ExtensionRunner as re,ExtensionSelectorComponent as ie,FooterComponent as ne,HOST_CAPABILITIES_ENV as ae,HOST_TOKEN_ENV as se,HOST_TOKEN_HEADER as le,HOST_URL_ENV as me,HostCallError as ce,HostCapabilities as pe,InteractiveMode as Se,LoginDialogComponent as de,MARKET_SECTIONS as Ee,MAX_BACKGROUND_PROCESSES as Te,ModelRegistry as ue,ModelSelectorComponent as ge,OAuthSelectorComponent as Ce,PROTECTED_WRITE_NAMES as De,REQUIRED_EXTENSION_FAILED as Re,RequiredExtensionError as _e,RpcClient as Ae,RpcCommandError as he,SANDBOX_ENV as ke,SessionSelectorComponent as Pe,SettingsManager as Le,SettingsSelectorComponent as Oe,ShellSandbox as fe,SkillInvocationMessageComponent as He,ThinkingSelectorComponent as Ie,ToolExecutionComponent as Me,TreeSelectorComponent as Ne,UserMessageComponent as Fe,UserMessageSelectorComponent as ye,adaptPackage as xe,adaptationState as ve,agentLogPath as Ue,appendAgentLog as be,applyCommunityEnv as Be,buildProjectMap as we,buildRuleSet as Ke,calculateContextTokens as We,collectEntriesForBranchSummary as je,communityEnv as Ve,compact as Ge,convertToPng as ze,copyToClipboard as Xe,createAgentSession as qe,createAgentSessionFromServices as Ye,createAgentSessionRuntime as Je,createAgentSessionServices as Qe,createBashTool as Ze,createBashToolDefinition as $e,createCodemodeExtension as eo,createCodingTools as oo,createEditTool as to,createEditToolDefinition as ro,createEventBus as io,createExtensionRuntime as no,createFindTool as ao,createFindToolDefinition as so,createGrepTool as lo,createGrepToolDefinition as mo,createLocalBashOperations as co,createLocalPowerShellOperations as po,createLsTool as So,createLsToolDefinition as Eo,createMcpExtension as To,createPowerShellTool as uo,createPowerShellToolDefinition as go,createProcessToolDefinition as Co,createReadOnlyTools as Do,createReadTool as Ro,createReadToolDefinition as _o,createSyntheticSourceInfo as Ao,createToolSearchExtension as ho,createWriteTool as ko,createWriteToolDefinition as Po,defineTool as Lo,describeProjectFacts as Oo,detectProjectFacts as fo,detectSandboxAvailability as Ho,detectSupportedImageMimeTypeFromFile as Io,discoverAndLoadExtensions as Mo,ensurePackageAdapted as No,estimateTokens as Fo,evaluateToolPolicy as yo,expandTempDirVariable as xo,fetchSignedMarket as vo,findCutPoint as Uo,findTurnStartIndex as bo,formatDimensionNote as Bo,formatProjectMapPrompt as wo,formatSkillsForPrompt as Ko,generateBranchSummary as Wo,generateDiffString as jo,generateSummary as Vo,generateSummaryWithUsage as Go,generateUnifiedPatch as zo,getHostCapabilities as Xo,getLastAssistantUsage as qo,getProcessShellSandbox as Yo,getToolDenial as Jo,isAdaptablePackage as Qo,isBashToolResult as Zo,isEditToolResult as $o,isFatalExtensionError as et,isFindToolResult as ot,isGrepToolResult as tt,isHostExtensionPath as rt,isLsToolResult as it,isPowerShellToolResult as nt,isReadOnlyBashCommand as at,isReadToolResult as st,isToolCallEventType as lt,isWriteToolResult as mt,loadMcpRuntime as ct,loadProjectContextFiles as pt,loadSkills as St,loadSkillsFromDir as dt,main as Et,markHostExtensionPaths as Tt,marketCacheDir as ut,matchPermissionRules as gt,normalizeForFuzzyMatch as Ct,parseArgs as Dt,parseFrontmatter as Rt,parseHostCapabilities as _t,parsePermissionRule as At,parseSkillBlock as ht,prepareBranchEntries as kt,projectPackageManager as Pt,readAccessDenial as Lt,readAdaptation as Ot,readSignedSection as ft,registerPermissionAskHandler as Ht,registerSandboxEscalationHandler as It,registerShellExecutionGuard as Mt,renderDiff as Nt,resizeImage as Ft,resolveCliModel as yt,resolveMarketEndpoint as xt,resolveModelScopeWithDiagnostics as vt,resolveSandboxPolicy as Ut,resolveToCwd as bt,runPrintMode as Bt,runRpcMode as wt,scanHardcodedPiPaths as Kt,serializeConversation as Wt,shellExecutionRefusal as jt,shouldCompact as Vt,simpleCommands as Gt,stripFrontmatter as zt,systemTempDirs as Xt,tryEnsurePackageAdapted as qt,unwrapCommand as Yt,verifyAdaptation as Jt,verifySignedSection as Qt,withFileMutationQueue as Zt,wrapRegisteredTool as $t,wrapRegisteredTools as er}from"./chunks/chunk-X63WCLSX.js";import{CURRENT_SESSION_VERSION as or,SessionManager as tr,buildContextEntries as rr,buildSessionContext as ir,buildSessionProjection as nr,convertToLlm as ar,getDefaultSessionDir as sr,getDefaultSessionDirs as lr,getLatestCompactionEntry as mr,migrateSessionEntries as cr,parseSessionEntries as pr,sessionEntryToContextMessages as Sr}from"./chunks/chunk-J6H2LYOZ.js";import{CredentialSynchronizationError as dr,DALCODE_PROJECT_DIR_NAME as Er,DEFAULT_HOOK_TIMEOUT_SECONDS as Tr,ModelRuntime as ur,PROJECT_HOOKS_FILE_ENV as gr,ProjectTrustStore as Cr,TRUST_REQUIRING_PROJECT_HOOK_FILES as Dr,VIRTUAL_MODEL_STATE_ENTRY as Rr,dalHookSourceFiles as _r,deriveHookName as Ar,hasTrustRequiringProjectResources as hr,loadDalHooks as kr,openBrowser as Pr,projectFileDeclaresHooks as Lr,projectHooksFileFromEnv as Or}from"./chunks/chunk-KT7CXVDN.js";import"./chunks/chunk-YOQ3KBG5.js";import{formatReadLineRange as fr,truncateToVisualLines as Hr}from"./chunks/chunk-XQF5XDEM.js";import"./chunks/chunk-JUUJCOIR.js";import"./chunks/chunk-NJDCSLWK.js";import{readStoredCredential as Ir}from"./chunks/chunk-C5ELI234.js";import"./chunks/chunk-4BOWD7PQ.js";import{DEFAULT_MAX_BYTES as Mr,DEFAULT_MAX_LINES as Nr,DEFAULT_SHELL_ENV_EXCLUDES as Fr,applyShellEnvironmentPolicy as yr,formatSize as xr,getPowerShellConfig as vr,getShellConfig as Ur,getShellEnv as br,isDalCodeCredentialName as Br,truncateHead as wr,truncateLine as Kr,truncateTail as Wr,withoutDalCodeCredentials as jr}from"./chunks/chunk-HF334NQU.js";import"./chunks/chunk-G5AMLGXC.js";import{ArminComponent as Vr}from"./chunks/chunk-F5SIUTR7.js";import{Theme as Gr,getLanguageFromPath as zr,getMarkdownTheme as Xr,getSelectListTheme as qr,getSettingsListTheme as Yr,highlightCode as Jr,initTheme as Qr,keyHint as Zr,keyText as $r,rawKeyHint as ei}from"./chunks/chunk-AL3DFAIM.js";import"./chunks/chunk-6QGV3IWD.js";import{CONFIG_DIR_NAME as oi,SHARED_SKILL_CONFIG_DIRS as ti,VERSION as ri,getAgentDir as ii,getDocsPath as ni,getExamplesPath as ai,getPackageDir as si,getReadmePath as li}from"./chunks/chunk-R47JBGS3.js";import"./chunks/chunk-XJFQKN3N.js";import"./chunks/chunk-QU2VEHMW.js";import"./chunks/chunk-IEBK4HQA.js";import"./chunks/chunk-5AGIVGSV.js";import"./chunks/chunk-723ZGEZ2.js";import"./chunks/chunk-ZG74NES2.js";import"./chunks/chunk-TMTOQ7H7.js";import"./chunks/chunk-7DDKXS2Q.js";import"./chunks/chunk-FFMDRXC4.js";import"./chunks/chunk-VDPDHGGJ.js";import"./chunks/chunk-4LDEEFCY.js";import"./chunks/chunk-F52JQCLE.js";import"./chunks/chunk-JXWJOIH4.js";export{b as ADAPTATION_FILE,B as AgentSession,w as AgentSessionRuntime,Vr as ArminComponent,K as AssistantMessageComponent,W as BackgroundProcessManager,j as BashExecutionComponent,V as BorderedLoader,G as BranchSummaryMessageComponent,oi as CONFIG_DIR_NAME,or as CURRENT_SESSION_VERSION,z as CompactionSummaryMessageComponent,dr as CredentialSynchronizationError,X as CustomEditor,q as CustomMessageComponent,Er as DALCODE_PROJECT_DIR_NAME,o as DAL_HOOK_ENTRY_TYPE,t as DAL_HOOK_NOTIFICATION_CHANNEL,Y as DEFAULT_COMPACTION_SETTINGS,Tr as DEFAULT_HOOK_TIMEOUT_SECONDS,Mr as DEFAULT_MAX_BYTES,Nr as DEFAULT_MAX_LINES,Fr as DEFAULT_SHELL_ENV_EXCLUDES,J as DefaultPackageManager,Q as DefaultResourceLoader,Z as DynamicBorder,$ as ENGINE_MARKET_CACHE_FILE,ee as ExtensionEditorComponent,oe as ExtensionFatalError,te as ExtensionInputComponent,re as ExtensionRunner,ie as ExtensionSelectorComponent,ne as FooterComponent,ae as HOST_CAPABILITIES_ENV,se as HOST_TOKEN_ENV,le as HOST_TOKEN_HEADER,me as HOST_URL_ENV,ce as HostCallError,pe as HostCapabilities,Se as InteractiveMode,de as LoginDialogComponent,Ee as MARKET_SECTIONS,Te as MAX_BACKGROUND_PROCESSES,ue as ModelRegistry,ur as ModelRuntime,ge as ModelSelectorComponent,Ce as OAuthSelectorComponent,gr as PROJECT_HOOKS_FILE_ENV,De as PROTECTED_WRITE_NAMES,Cr as ProjectTrustStore,Re as REQUIRED_EXTENSION_FAILED,_e as RequiredExtensionError,Ae as RpcClient,he as RpcCommandError,ke as SANDBOX_ENV,ti as SHARED_SKILL_CONFIG_DIRS,r as STALE_AFTER_MS,tr as SessionManager,Pe as SessionSelectorComponent,Le as SettingsManager,Oe as SettingsSelectorComponent,fe as ShellSandbox,i as ShowImagesSelectorComponent,He as SkillInvocationMessageComponent,Dr as TRUST_REQUIRING_PROJECT_HOOK_FILES,Gr as Theme,n as ThemeSelectorComponent,Ie as ThinkingSelectorComponent,Me as ToolExecutionComponent,Ne as TreeSelectorComponent,Fe as UserMessageComponent,ye as UserMessageSelectorComponent,ri as VERSION,Rr as VIRTUAL_MODEL_STATE_ENTRY,a as WORKSPACE_LOCK_DIR_NAME,s as WORKSPACE_LOCK_FILE,xe as adaptPackage,ve as adaptationState,Ue as agentLogPath,be as appendAgentLog,Be as applyCommunityEnv,yr as applyShellEnvironmentPolicy,rr as buildContextEntries,l as buildDalHookInput,we as buildProjectMap,Ke as buildRuleSet,ir as buildSessionContext,nr as buildSessionProjection,We as calculateContextTokens,m as claimWorkspace,je as collectEntriesForBranchSummary,Ve as communityEnv,Ge as compact,ar as convertToLlm,ze as convertToPng,Xe as copyToClipboard,qe as createAgentSession,Ye as createAgentSessionFromServices,Je as createAgentSessionRuntime,Qe as createAgentSessionServices,Ze as createBashTool,$e as createBashToolDefinition,eo as createCodemodeExtension,oo as createCodingTools,to as createEditTool,ro as createEditToolDefinition,io as createEventBus,no as createExtensionRuntime,ao as createFindTool,so as createFindToolDefinition,lo as createGrepTool,mo as createGrepToolDefinition,co as createLocalBashOperations,po as createLocalPowerShellOperations,So as createLsTool,Eo as createLsToolDefinition,To as createMcpExtension,uo as createPowerShellTool,go as createPowerShellToolDefinition,Co as createProcessToolDefinition,Do as createReadOnlyTools,Ro as createReadTool,_o as createReadToolDefinition,Ao as createSyntheticSourceInfo,ho as createToolSearchExtension,ko as createWriteTool,Po as createWriteToolDefinition,c as dalHookActivity,_r as dalHookSourceFiles,p as dalHooksExtension,S as decideDalHooks,d as defaultWorkspaceLockDir,Lo as defineTool,Ar as deriveHookName,Oo as describeProjectFacts,fo as detectProjectFacts,Ho as detectSandboxAvailability,Io as detectSupportedImageMimeTypeFromFile,Mo as discoverAndLoadExtensions,E as engineToolInput,No as ensurePackageAdapted,Fo as estimateTokens,yo as evaluateToolPolicy,xo as expandTempDirVariable,vo as fetchSignedMarket,Uo as findCutPoint,bo as findTurnStartIndex,T as formatDalHookActivity,Bo as formatDimensionNote,wo as formatProjectMapPrompt,fr as formatReadLineRange,xr as formatSize,Ko as formatSkillsForPrompt,Wo as generateBranchSummary,jo as generateDiffString,Vo as generateSummary,Go as generateSummaryWithUsage,zo as generateUnifiedPatch,ii as getAgentDir,sr as getDefaultSessionDir,lr as getDefaultSessionDirs,ni as getDocsPath,ai as getExamplesPath,Xo as getHostCapabilities,zr as getLanguageFromPath,qo as getLastAssistantUsage,mr as getLatestCompactionEntry,Xr as getMarkdownTheme,si as getPackageDir,vr as getPowerShellConfig,Yo as getProcessShellSandbox,li as getReadmePath,qr as getSelectListTheme,Yr as getSettingsListTheme,Ur as getShellConfig,br as getShellEnv,Jo as getToolDenial,u as gitDirOf,hr as hasTrustRequiringProjectResources,Jr as highlightCode,g as hookToolInput,C as hookToolName,Qr as initTheme,Qo as isAdaptablePackage,Zo as isBashToolResult,Br as isDalCodeCredentialName,D as isDalHookActivity,$o as isEditToolResult,et as isFatalExtensionError,ot as isFindToolResult,tt as isGrepToolResult,rt as isHostExtensionPath,it as isLsToolResult,nt as isPowerShellToolResult,at as isReadOnlyBashCommand,st as isReadToolResult,lt as isToolCallEventType,mt as isWriteToolResult,Zr as keyHint,$r as keyText,kr as loadDalHooks,ct as loadMcpRuntime,pt as loadProjectContextFiles,St as loadSkills,dt as loadSkillsFromDir,Et as main,Tt as markHostExtensionPaths,ut as marketCacheDir,gt as matchPermissionRules,cr as migrateSessionEntries,Ct as normalizeForFuzzyMatch,Pr as openBrowser,Dt as parseArgs,Rt as parseFrontmatter,_t as parseHostCapabilities,At as parsePermissionRule,pr as parseSessionEntries,ht as parseSkillBlock,kt as prepareBranchEntries,Lr as projectFileDeclaresHooks,Or as projectHooksFileFromEnv,Pt as projectPackageManager,ei as rawKeyHint,Lt as readAccessDenial,Ot as readAdaptation,ft as readSignedSection,Ir as readStoredCredential,R as readWorkspaceLock,Ht as registerPermissionAskHandler,It as registerSandboxEscalationHandler,Mt as registerShellExecutionGuard,_ as releaseWorkspace,Nt as renderDiff,A as reportDalHookProblems,Ft as resizeImage,yt as resolveCliModel,xt as resolveMarketEndpoint,vt as resolveModelScopeWithDiagnostics,Ut as resolveSandboxPolicy,bt as resolveToCwd,h as runDalCommandHook,k as runDalHookEvent,P as runDalHooks,L as runNotificationHooks,O as runPostToolUseHooks,f as runPreToolUseHooks,Bt as runPrintMode,wt as runRpcMode,H as runSessionStartHooks,I as runStopHooks,M as runUserPromptSubmitHooks,Kt as scanHardcodedPiPaths,N as selectDalHooks,Wt as serializeConversation,Sr as sessionEntryToContextMessages,F as shellCommandDirectory,jt as shellExecutionRefusal,Vt as shouldCompact,Gt as simpleCommands,zt as stripFrontmatter,Xt as systemTempDirs,y as toolMatchNames,wr as truncateHead,Kr as truncateLine,Wr as truncateTail,Hr as truncateToVisualLines,qt as tryEnsurePackageAdapted,Yt as unwrapCommand,Jt as verifyAdaptation,Qt as verifySignedSection,Zt as withFileMutationQueue,jr as withoutDalCodeCredentials,x as workspaceLockIsLive,v as workspaceLockPath,U as workspaceOwnerSessionId,$t as wrapRegisteredTool,er as wrapRegisteredTools};
|
|
1
|
+
import{createRequire as e}from"node:module";const pi=e(import.meta.url);import{DAL_HOOK_ENTRY_TYPE as o,DAL_HOOK_NOTIFICATION_CHANNEL as t,STALE_AFTER_MS as r,ShowImagesSelectorComponent as i,ThemeSelectorComponent as n,WORKSPACE_LOCK_DIR_NAME as a,WORKSPACE_LOCK_FILE as s,buildDalHookInput as l,claimWorkspace as m,dalHookActivity as c,dalHooksExtension as p,decideDalHooks as E,defaultWorkspaceLockDir as S,engineToolInput as d,formatDalHookActivity as T,gitDirOf as u,hookToolInput as g,hookToolName as C,isDalHookActivity as D,readWorkspaceLock as R,releaseWorkspace as _,reportDalHookProblems as A,runDalCommandHook as P,runDalHookEvent as h,runDalHooks as k,runNotificationHooks as L,runPostToolUseHooks as O,runPreToolUseHooks as I,runSessionStartHooks as f,runStopHooks as H,runUserPromptSubmitHooks as M,selectDalHooks as N,shellCommandDirectory as F,toolMatchNames as y,workspaceLockIsLive as x,workspaceLockPath as v,workspaceOwnerSessionId as U}from"./chunks/chunk-5VVKJ7N6.js";import{ADAPTATION_FILE as b,AgentSession as B,AgentSessionRuntime as w,AssistantMessageComponent as K,BackgroundProcessManager as W,BashExecutionComponent as j,BorderedLoader as V,BranchSummaryMessageComponent as G,CompactionSummaryMessageComponent as z,CustomEditor as X,CustomMessageComponent as q,DEFAULT_COMPACTION_SETTINGS as Y,DefaultPackageManager as J,DefaultResourceLoader as Q,DynamicBorder as Z,ENGINE_MARKET_CACHE_FILE as $,ExtensionEditorComponent as ee,ExtensionFatalError as oe,ExtensionInputComponent as te,ExtensionRunner as re,ExtensionSelectorComponent as ie,FooterComponent as ne,HOST_CAPABILITIES_ENV as ae,HOST_TOKEN_ENV as se,HOST_TOKEN_HEADER as le,HOST_URL_ENV as me,HostCallError as ce,HostCapabilities as pe,InteractiveMode as Ee,LoginDialogComponent as Se,MARKET_SECTIONS as de,MAX_BACKGROUND_PROCESSES as Te,ModelRegistry as ue,ModelSelectorComponent as ge,OAuthSelectorComponent as Ce,PROTECTED_WRITE_NAMES as De,REQUIRED_EXTENSION_FAILED as Re,RequiredExtensionError as _e,RpcClient as Ae,RpcCommandError as Pe,SANDBOX_ENV as he,SessionSelectorComponent as ke,SettingsManager as Le,SettingsSelectorComponent as Oe,ShellSandbox as Ie,SkillInvocationMessageComponent as fe,ThinkingSelectorComponent as He,ToolExecutionComponent as Me,TreeSelectorComponent as Ne,UserMessageComponent as Fe,UserMessageSelectorComponent as ye,adaptPackage as xe,adaptationState as ve,agentLogPath as Ue,appendAgentLog as be,applyCommunityEnv as Be,buildProjectMap as we,buildRuleSet as Ke,calculateContextTokens as We,collectEntriesForBranchSummary as je,communityEnv as Ve,compact as Ge,convertToPng as ze,copyToClipboard as Xe,createAgentSession as qe,createAgentSessionFromServices as Ye,createAgentSessionRuntime as Je,createAgentSessionServices as Qe,createBashTool as Ze,createBashToolDefinition as $e,createCodemodeExtension as eo,createCodingTools as oo,createEditTool as to,createEditToolDefinition as ro,createEventBus as io,createExtensionRuntime as no,createFindTool as ao,createFindToolDefinition as so,createGrepTool as lo,createGrepToolDefinition as mo,createLocalBashOperations as co,createLocalPowerShellOperations as po,createLsTool as Eo,createLsToolDefinition as So,createMcpExtension as To,createPowerShellTool as uo,createPowerShellToolDefinition as go,createProcessToolDefinition as Co,createReadOnlyTools as Do,createReadTool as Ro,createReadToolDefinition as _o,createSyntheticSourceInfo as Ao,createToolSearchExtension as Po,createWriteTool as ho,createWriteToolDefinition as ko,defineTool as Lo,describeProjectFacts as Oo,detectProjectFacts as Io,detectSandboxAvailability as fo,detectSupportedImageMimeTypeFromFile as Ho,discoverAndLoadExtensions as Mo,ensurePackageAdapted as No,estimateTokens as Fo,evaluateToolPolicy as yo,expandTempDirVariable as xo,fetchSignedMarket as vo,findCutPoint as Uo,findTurnStartIndex as bo,formatDimensionNote as Bo,formatProjectMapPrompt as wo,formatSkillsForPrompt as Ko,generateBranchSummary as Wo,generateDiffString as jo,generateSummary as Vo,generateSummaryWithUsage as Go,generateUnifiedPatch as zo,getHostCapabilities as Xo,getLastAssistantUsage as qo,getProcessShellSandbox as Yo,getToolDenial as Jo,isAdaptablePackage as Qo,isBashToolResult as Zo,isEditToolResult as $o,isFatalExtensionError as et,isFindToolResult as ot,isGrepToolResult as tt,isHostExtensionPath as rt,isLsToolResult as it,isPowerShellToolResult as nt,isReadOnlyBashCommand as at,isReadToolResult as st,isToolCallEventType as lt,isWriteToolResult as mt,loadMcpRuntime as ct,loadProjectContextFiles as pt,loadSkills as Et,loadSkillsFromDir as St,main as dt,markHostExtensionPaths as Tt,marketCacheDir as ut,matchPermissionRules as gt,normalizeForFuzzyMatch as Ct,parseArgs as Dt,parseFrontmatter as Rt,parseHostCapabilities as _t,parsePermissionRule as At,parseSkillBlock as Pt,prepareBranchEntries as ht,projectPackageManager as kt,readAccessDenial as Lt,readAdaptation as Ot,readSignedSection as It,registerPermissionAskHandler as ft,registerSandboxEscalationHandler as Ht,registerShellExecutionGuard as Mt,renderDiff as Nt,resizeImage as Ft,resolveCliModel as yt,resolveMarketEndpoint as xt,resolveModelScopeWithDiagnostics as vt,resolveSandboxPolicy as Ut,resolveToCwd as bt,runPrintMode as Bt,runRpcMode as wt,scanHardcodedPiPaths as Kt,serializeConversation as Wt,shellExecutionRefusal as jt,shouldCompact as Vt,simpleCommands as Gt,stripFrontmatter as zt,systemTempDirs as Xt,tryEnsurePackageAdapted as qt,unwrapCommand as Yt,verifyAdaptation as Jt,verifySignedSection as Qt,withFileMutationQueue as Zt,wrapRegisteredTool as $t,wrapRegisteredTools as er}from"./chunks/chunk-ZLZHK7BO.js";import{CURRENT_SESSION_VERSION as or,SessionManager as tr,buildContextEntries as rr,buildSessionContext as ir,buildSessionProjection as nr,convertToLlm as ar,getDefaultSessionDir as sr,getDefaultSessionDirs as lr,getLatestCompactionEntry as mr,migrateSessionEntries as cr,parseSessionEntries as pr,sessionEntryToContextMessages as Er}from"./chunks/chunk-TLYT7KXA.js";import{CredentialSynchronizationError as Sr,DALCODE_PROJECT_DIR_NAME as dr,DEFAULT_HOOK_TIMEOUT_SECONDS as Tr,ModelRuntime as ur,PROJECT_HOOKS_FILE_ENV as gr,ProjectTrustStore as Cr,TRUST_REQUIRING_PROJECT_HOOK_FILES as Dr,VIRTUAL_MODEL_STATE_ENTRY as Rr,dalHookSourceFiles as _r,deriveHookName as Ar,hasTrustRequiringProjectResources as Pr,loadDalHooks as hr,openBrowser as kr,projectFileDeclaresHooks as Lr,projectHooksFileFromEnv as Or}from"./chunks/chunk-M4QINYHM.js";import"./chunks/chunk-MOBJIVPU.js";import{formatReadLineRange as Ir,truncateToVisualLines as fr}from"./chunks/chunk-RRAXQWE3.js";import"./chunks/chunk-JUUJCOIR.js";import"./chunks/chunk-NJDCSLWK.js";import{readStoredCredential as Hr}from"./chunks/chunk-ZVMXRMIH.js";import"./chunks/chunk-5DM5CSLU.js";import{DEFAULT_MAX_BYTES as Mr,DEFAULT_MAX_LINES as Nr,DEFAULT_SHELL_ENV_EXCLUDES as Fr,applyShellEnvironmentPolicy as yr,formatSize as xr,getPowerShellConfig as vr,getShellConfig as Ur,getShellEnv as br,isDalCodeCredentialName as Br,truncateHead as wr,truncateLine as Kr,truncateTail as Wr,withoutDalCodeCredentials as jr}from"./chunks/chunk-B66W54NL.js";import"./chunks/chunk-G5AMLGXC.js";import{ArminComponent as Vr}from"./chunks/chunk-LGD3AMTG.js";import{Theme as Gr,getLanguageFromPath as zr,getMarkdownTheme as Xr,getSelectListTheme as qr,getSettingsListTheme as Yr,highlightCode as Jr,initTheme as Qr,keyHint as Zr,keyText as $r,rawKeyHint as ei}from"./chunks/chunk-NRQYSXAU.js";import"./chunks/chunk-6QGV3IWD.js";import{APP_TITLE as oi,CONFIG_DIR_NAME as ti,SHARED_SKILL_CONFIG_DIRS as ri,VERSION as ii,getAgentDir as ni,getDocsPath as ai,getExamplesPath as si,getPackageDir as li,getReadmePath as mi}from"./chunks/chunk-QM5JU2GS.js";import"./chunks/chunk-XJFQKN3N.js";import"./chunks/chunk-XIF7O6UG.js";import"./chunks/chunk-IEBK4HQA.js";import"./chunks/chunk-5AGIVGSV.js";import"./chunks/chunk-723ZGEZ2.js";import"./chunks/chunk-ZG74NES2.js";import"./chunks/chunk-TMTOQ7H7.js";import"./chunks/chunk-7DDKXS2Q.js";import"./chunks/chunk-FFMDRXC4.js";import"./chunks/chunk-DM37LCOU.js";import"./chunks/chunk-4LDEEFCY.js";import"./chunks/chunk-XKOYUKPQ.js";import"./chunks/chunk-JXWJOIH4.js";export{b as ADAPTATION_FILE,oi as APP_TITLE,B as AgentSession,w as AgentSessionRuntime,Vr as ArminComponent,K as AssistantMessageComponent,W as BackgroundProcessManager,j as BashExecutionComponent,V as BorderedLoader,G as BranchSummaryMessageComponent,ti as CONFIG_DIR_NAME,or as CURRENT_SESSION_VERSION,z as CompactionSummaryMessageComponent,Sr as CredentialSynchronizationError,X as CustomEditor,q as CustomMessageComponent,dr as DALCODE_PROJECT_DIR_NAME,o as DAL_HOOK_ENTRY_TYPE,t as DAL_HOOK_NOTIFICATION_CHANNEL,Y as DEFAULT_COMPACTION_SETTINGS,Tr as DEFAULT_HOOK_TIMEOUT_SECONDS,Mr as DEFAULT_MAX_BYTES,Nr as DEFAULT_MAX_LINES,Fr as DEFAULT_SHELL_ENV_EXCLUDES,J as DefaultPackageManager,Q as DefaultResourceLoader,Z as DynamicBorder,$ as ENGINE_MARKET_CACHE_FILE,ee as ExtensionEditorComponent,oe as ExtensionFatalError,te as ExtensionInputComponent,re as ExtensionRunner,ie as ExtensionSelectorComponent,ne as FooterComponent,ae as HOST_CAPABILITIES_ENV,se as HOST_TOKEN_ENV,le as HOST_TOKEN_HEADER,me as HOST_URL_ENV,ce as HostCallError,pe as HostCapabilities,Ee as InteractiveMode,Se as LoginDialogComponent,de as MARKET_SECTIONS,Te as MAX_BACKGROUND_PROCESSES,ue as ModelRegistry,ur as ModelRuntime,ge as ModelSelectorComponent,Ce as OAuthSelectorComponent,gr as PROJECT_HOOKS_FILE_ENV,De as PROTECTED_WRITE_NAMES,Cr as ProjectTrustStore,Re as REQUIRED_EXTENSION_FAILED,_e as RequiredExtensionError,Ae as RpcClient,Pe as RpcCommandError,he as SANDBOX_ENV,ri as SHARED_SKILL_CONFIG_DIRS,r as STALE_AFTER_MS,tr as SessionManager,ke as SessionSelectorComponent,Le as SettingsManager,Oe as SettingsSelectorComponent,Ie as ShellSandbox,i as ShowImagesSelectorComponent,fe as SkillInvocationMessageComponent,Dr as TRUST_REQUIRING_PROJECT_HOOK_FILES,Gr as Theme,n as ThemeSelectorComponent,He as ThinkingSelectorComponent,Me as ToolExecutionComponent,Ne as TreeSelectorComponent,Fe as UserMessageComponent,ye as UserMessageSelectorComponent,ii as VERSION,Rr as VIRTUAL_MODEL_STATE_ENTRY,a as WORKSPACE_LOCK_DIR_NAME,s as WORKSPACE_LOCK_FILE,xe as adaptPackage,ve as adaptationState,Ue as agentLogPath,be as appendAgentLog,Be as applyCommunityEnv,yr as applyShellEnvironmentPolicy,rr as buildContextEntries,l as buildDalHookInput,we as buildProjectMap,Ke as buildRuleSet,ir as buildSessionContext,nr as buildSessionProjection,We as calculateContextTokens,m as claimWorkspace,je as collectEntriesForBranchSummary,Ve as communityEnv,Ge as compact,ar as convertToLlm,ze as convertToPng,Xe as copyToClipboard,qe as createAgentSession,Ye as createAgentSessionFromServices,Je as createAgentSessionRuntime,Qe as createAgentSessionServices,Ze as createBashTool,$e as createBashToolDefinition,eo as createCodemodeExtension,oo as createCodingTools,to as createEditTool,ro as createEditToolDefinition,io as createEventBus,no as createExtensionRuntime,ao as createFindTool,so as createFindToolDefinition,lo as createGrepTool,mo as createGrepToolDefinition,co as createLocalBashOperations,po as createLocalPowerShellOperations,Eo as createLsTool,So as createLsToolDefinition,To as createMcpExtension,uo as createPowerShellTool,go as createPowerShellToolDefinition,Co as createProcessToolDefinition,Do as createReadOnlyTools,Ro as createReadTool,_o as createReadToolDefinition,Ao as createSyntheticSourceInfo,Po as createToolSearchExtension,ho as createWriteTool,ko as createWriteToolDefinition,c as dalHookActivity,_r as dalHookSourceFiles,p as dalHooksExtension,E as decideDalHooks,S as defaultWorkspaceLockDir,Lo as defineTool,Ar as deriveHookName,Oo as describeProjectFacts,Io as detectProjectFacts,fo as detectSandboxAvailability,Ho as detectSupportedImageMimeTypeFromFile,Mo as discoverAndLoadExtensions,d as engineToolInput,No as ensurePackageAdapted,Fo as estimateTokens,yo as evaluateToolPolicy,xo as expandTempDirVariable,vo as fetchSignedMarket,Uo as findCutPoint,bo as findTurnStartIndex,T as formatDalHookActivity,Bo as formatDimensionNote,wo as formatProjectMapPrompt,Ir as formatReadLineRange,xr as formatSize,Ko as formatSkillsForPrompt,Wo as generateBranchSummary,jo as generateDiffString,Vo as generateSummary,Go as generateSummaryWithUsage,zo as generateUnifiedPatch,ni as getAgentDir,sr as getDefaultSessionDir,lr as getDefaultSessionDirs,ai as getDocsPath,si as getExamplesPath,Xo as getHostCapabilities,zr as getLanguageFromPath,qo as getLastAssistantUsage,mr as getLatestCompactionEntry,Xr as getMarkdownTheme,li as getPackageDir,vr as getPowerShellConfig,Yo as getProcessShellSandbox,mi as getReadmePath,qr as getSelectListTheme,Yr as getSettingsListTheme,Ur as getShellConfig,br as getShellEnv,Jo as getToolDenial,u as gitDirOf,Pr as hasTrustRequiringProjectResources,Jr as highlightCode,g as hookToolInput,C as hookToolName,Qr as initTheme,Qo as isAdaptablePackage,Zo as isBashToolResult,Br as isDalCodeCredentialName,D as isDalHookActivity,$o as isEditToolResult,et as isFatalExtensionError,ot as isFindToolResult,tt as isGrepToolResult,rt as isHostExtensionPath,it as isLsToolResult,nt as isPowerShellToolResult,at as isReadOnlyBashCommand,st as isReadToolResult,lt as isToolCallEventType,mt as isWriteToolResult,Zr as keyHint,$r as keyText,hr as loadDalHooks,ct as loadMcpRuntime,pt as loadProjectContextFiles,Et as loadSkills,St as loadSkillsFromDir,dt as main,Tt as markHostExtensionPaths,ut as marketCacheDir,gt as matchPermissionRules,cr as migrateSessionEntries,Ct as normalizeForFuzzyMatch,kr as openBrowser,Dt as parseArgs,Rt as parseFrontmatter,_t as parseHostCapabilities,At as parsePermissionRule,pr as parseSessionEntries,Pt as parseSkillBlock,ht as prepareBranchEntries,Lr as projectFileDeclaresHooks,Or as projectHooksFileFromEnv,kt as projectPackageManager,ei as rawKeyHint,Lt as readAccessDenial,Ot as readAdaptation,It as readSignedSection,Hr as readStoredCredential,R as readWorkspaceLock,ft as registerPermissionAskHandler,Ht as registerSandboxEscalationHandler,Mt as registerShellExecutionGuard,_ as releaseWorkspace,Nt as renderDiff,A as reportDalHookProblems,Ft as resizeImage,yt as resolveCliModel,xt as resolveMarketEndpoint,vt as resolveModelScopeWithDiagnostics,Ut as resolveSandboxPolicy,bt as resolveToCwd,P as runDalCommandHook,h as runDalHookEvent,k as runDalHooks,L as runNotificationHooks,O as runPostToolUseHooks,I as runPreToolUseHooks,Bt as runPrintMode,wt as runRpcMode,f as runSessionStartHooks,H as runStopHooks,M as runUserPromptSubmitHooks,Kt as scanHardcodedPiPaths,N as selectDalHooks,Wt as serializeConversation,Er as sessionEntryToContextMessages,F as shellCommandDirectory,jt as shellExecutionRefusal,Vt as shouldCompact,Gt as simpleCommands,zt as stripFrontmatter,Xt as systemTempDirs,y as toolMatchNames,wr as truncateHead,Kr as truncateLine,Wr as truncateTail,fr as truncateToVisualLines,qt as tryEnsurePackageAdapted,Yt as unwrapCommand,Jt as verifyAdaptation,Qt as verifySignedSection,Zt as withFileMutationQueue,jr as withoutDalCodeCredentials,x as workspaceLockIsLive,v as workspaceLockPath,U as workspaceOwnerSessionId,$t as wrapRegisteredTool,er as wrapRegisteredTools};
|
package/dist/bundle/rpc-entry.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as r}from"node:module";const m=r(import.meta.url);import{configureHttpDispatcher as i,main as o}from"./chunks/chunk-
|
|
2
|
+
import{createRequire as r}from"node:module";const m=r(import.meta.url);import{configureHttpDispatcher as i,main as o}from"./chunks/chunk-ZLZHK7BO.js";import"./chunks/chunk-TLYT7KXA.js";import"./chunks/chunk-M4QINYHM.js";import"./chunks/chunk-MOBJIVPU.js";import"./chunks/chunk-RRAXQWE3.js";import"./chunks/chunk-JUUJCOIR.js";import"./chunks/chunk-NJDCSLWK.js";import"./chunks/chunk-ZVMXRMIH.js";import"./chunks/chunk-5DM5CSLU.js";import"./chunks/chunk-B66W54NL.js";import"./chunks/chunk-G5AMLGXC.js";import"./chunks/chunk-LGD3AMTG.js";import"./chunks/chunk-NRQYSXAU.js";import"./chunks/chunk-6QGV3IWD.js";import{APP_NAME as p}from"./chunks/chunk-QM5JU2GS.js";import"./chunks/chunk-XJFQKN3N.js";import"./chunks/chunk-XIF7O6UG.js";import"./chunks/chunk-IEBK4HQA.js";import"./chunks/chunk-5AGIVGSV.js";import"./chunks/chunk-723ZGEZ2.js";import"./chunks/chunk-ZG74NES2.js";import"./chunks/chunk-TMTOQ7H7.js";import"./chunks/chunk-7DDKXS2Q.js";import"./chunks/chunk-FFMDRXC4.js";import"./chunks/chunk-DM37LCOU.js";import"./chunks/chunk-4LDEEFCY.js";import"./chunks/chunk-XKOYUKPQ.js";import"./chunks/chunk-JXWJOIH4.js";process.title=`${p}-rpc`,process.env.PI_CODING_AGENT="true",process.env.AI_AGENT="pi",process.emitWarning=(()=>{}),i(),o(["--mode","rpc",...process.argv.slice(2)]);
|
package/dist/config.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export type InstallChange = {
|
|
|
52
52
|
export declare function detectInstallChange(packageJsonPath?: string | undefined): InstallChange | undefined;
|
|
53
53
|
export declare const PACKAGE_NAME: string;
|
|
54
54
|
export declare const APP_NAME: string;
|
|
55
|
+
export declare function hostProductTitle(value: string | undefined): string | undefined;
|
|
55
56
|
export declare const APP_TITLE: string;
|
|
56
57
|
export declare const CONFIG_DIR_NAME: string;
|
|
57
58
|
export declare const IS_WHITE_LABEL_BUILD: boolean;
|
package/dist/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var K=Object.defineProperty;var n=(e,t)=>K(e,"name",{value:t,configurable:!0});import{accessSync as v,constants as U,existsSync as f,readFileSync as S,realpathSync as H}from"fs";import{createRequire as V}from"module";import{homedir as A}from"os";import{basename as C,dirname as u,join as i,resolve as h,sep as w,win32 as z}from"path";import{fileURLToPath as Q}from"url";import{spawnProcessSync as X}from"./utils/child-process.js";import{normalizePath as R}from"./utils/paths.js";import{stripBom as k}from"./utils/text.js";const Y=Q(import.meta.url),L=u(Y),x=import.meta.url.includes("$bunfs")||import.meta.url.includes("~BUN")||import.meta.url.includes("%7EBUN"),Z=!!process.versions.bun,ee=typeof PI_BUNDLED_NODE<"u"&&PI_BUNDLED_NODE;function te(e){return e.startsWith("https://")||e.startsWith("http://")}n(te,"isUrlInstallSpec");function O(e){return typeof e=="string"?{packageName:e,installSpec:e}:{packageName:e.packageName,installSpec:e.installSpec??e.packageName}}n(O,"normalizeSelfUpdatePackageTarget");function P(e,t){return t?{...e,display:`${t.display} && ${e.display}`,steps:[t,e]}:e}n(P,"makeSelfUpdateCommand");function m(e,t){return{command:e,args:t,display:[e,...t].map(o=>/\s/.test(o)?`"${o}"`:o).join(" ")}}n(m,"makeSelfUpdateCommandStep");function y(){if(x)return"bun-binary";const e=`${L}\0${process.execPath||""}`.toLowerCase().replace(/\\/g,"/");return e.includes("/pnpm/")||e.includes("/.pnpm/")?"pnpm":e.includes("/yarn/")||e.includes("/.yarn/")?"yarn":Z||e.includes("/install/global/node_modules/")?"bun":e.includes("/npm/")||e.includes("/node_modules/")?"npm":"unknown"}n(y,"detectInstallMethod");function $(){const e=c(),t=process.platform==="win32"||e.includes("\\")?z:{basename:C,dirname:u},o=t.dirname(e);let r;if(t.basename(o).startsWith("@")&&t.basename(t.dirname(o))==="node_modules"?r=t.dirname(o):t.basename(o)==="node_modules"&&(r=o),!r)return;const s=t.dirname(r);if(t.basename(s)==="lib")return{root:r,prefix:t.dirname(s)}}n($,"getInferredNpmInstall");function I(e,t,o=t,r){const s=O(o),a=s.packageName===me&&!te(s.installSpec)?[`--${ge}:registry=${be}/`]:[];switch(e){case"bun-binary":return;case"pnpm":{const p=_("pnpm",["root","-g"])?void 0:/^(.*[\\/]global[\\/][^\\/]+)[\\/]\.pnpm[\\/]/.exec(c()),d=p?[`--config.global-bin-dir=${process.env.PNPM_HOME||u(u(p[1]))}`]:[];return P(m("pnpm",["install","-g","--ignore-scripts","--config.minimumReleaseAge=0",...d,...a,s.installSpec]),s.packageName===t?void 0:m("pnpm",["remove","-g",...d,t]))}case"yarn":return P(m("yarn",["global","add","--ignore-scripts",...a,s.installSpec]),s.packageName===t?void 0:m("yarn",["global","remove",t]));case"bun":return P(m("bun",["install","-g","--ignore-scripts","--minimum-release-age=0",...a,s.installSpec]),s.packageName===t?void 0:m("bun",["uninstall","-g",t]));case"npm":{const[p="npm",...d]=r??[],l=r?.length?void 0:$(),D=[...d,...l?["--prefix",l.prefix]:[]],J=m(p,[...D,"install","-g","--ignore-scripts","--min-release-age=0",...a,s.installSpec]),q=s.packageName===t?void 0:m(p,[...D,"uninstall","-g",t]);return P(J,q)}case"unknown":return}}n(I,"getSelfUpdateCommandForMethod");function _(e,t,o={}){const r=X(e,t,{encoding:"utf-8",stdio:["ignore","pipe","pipe"]});if(r.status===0)return r.stdout.trim()||void 0;if(o.requireSuccess){const s=r.error?.message||r.stderr.trim()||`exit code ${r.status??"unknown"}`;throw new Error(`Failed to run ${[e,...t].join(" ")}: ${s}`)}}n(_,"readCommandOutput");function ne(e,t,o){switch(e){case"npm":{const r=!!o?.length,[s="npm",...a]=o??[];if(r&&s==="bun"){const l=_(s,[...a,"pm","bin","-g"],{requireSuccess:!0}),D=[i(A(),".bun","install","global","node_modules")];return l&&D.push(i(u(l),"install","global","node_modules")),D}const p=_(s,[...a,"root","-g"],{requireSuccess:r}),d=r?void 0:$();return[p,d?.root].filter(l=>!!l)}case"pnpm":{const r=_("pnpm",["root","-g"]);if(r)return[r,u(r)];const s=/^(.*[\\/]global[\\/][^\\/]+)[\\/]\.pnpm[\\/]/.exec(c());return s?[s[1]]:[]}case"yarn":{const r=_("yarn",["global","dir"]);return r?[r,i(r,"node_modules")]:[]}case"bun":{const r=_("bun",["pm","bin","-g"]),s=[i(A(),".bun","install","global","node_modules")];return r&&s.push(i(u(r),"install","global","node_modules")),s}case"bun-binary":case"unknown":return[]}}n(ne,"getGlobalPackageRoots");function T(e,t){const o=h(e);if(!f(o))return;let r=o;if(t)try{r=H(o)}catch{return}return process.platform==="win32"&&(r=r.toLowerCase()),r}n(T,"normalizeExistingPathForComparison");function B(e){return Array.from(new Set([T(e,!1),T(e,!0)].filter(t=>!!t)))}n(B,"getPathComparisonCandidates");function re(){const e=process.argv[1];if(!e)return;let t=u(e);for(;t!==u(t);){if(f(i(t,"package.json")))return t;t=u(t)}}n(re,"getEntrypointPackageDir");function W(){const e=c();try{return v(e,U.W_OK),v(u(e),U.W_OK),!0}catch{return!1}}n(W,"isSelfUpdatePathWritable");function G(e,t,o){const s=[c(),re()].filter(a=>!!a).flatMap(a=>B(a));return ne(e,t,o).some(a=>B(a).some(p=>{const d=p.endsWith(w)?p:`${p}${w}`;return s.some(l=>l.startsWith(d))}))}n(G,"isManagedByGlobalPackageManager");function Ue(e,t,o=e){const r=y(),s=I(r,e,o,t);if(!(!s||!G(r,e,t)||!W()))return s}n(Ue,"getSelfUpdateCommand");function Ce(e){const t=process.env.PI_SELF_UPDATE_COMMAND?.trim().split(/\s+/).filter(Boolean);return t?.length?t:e?.length?e:void 0}n(Ce,"getConfiguredSelfUpdateArgv");function we(e,t){const o={packageName:t.packageName,version:t.version,installSpec:`${t.packageName}@${t.version}`},[r="",...s]=e.map(a=>a.replace(/\{(packageName|version|installSpec)\}/g,(p,d)=>o[d]));return m(r,s)}n(we,"makeConfiguredSelfUpdateCommand");function oe(e,t,o=e){const r=y(),s=O(o);if(r==="bun-binary")return`Download from: ${E==="pi"?"https://github.com/earendil-works/pi/releases/latest":xe}`;const a=I(r,e,s,t);return a&&G(r,e,t)&&!W()?`This installation is managed by a global ${r} install, but the install path is not writable. Update it yourself with: ${a.display}`:`Update ${s.installSpec} using the package manager, wrapper, or source checkout that provides this installation.`}n(oe,"getSelfUpdateUnavailableInstruction");function Re(e){const t=y(),o=I(t,e);return o?`Run: ${o.display}`:oe(e)}n(Re,"getUpdateInstruction");function ie(e){let t=e;for(;t!==u(t);){if(f(i(t,"package.json"))){const o=u(t);return C(t)==="dist"&&f(i(o,"package.json"))?o:t}t=u(t)}return e}n(ie,"findNodePackageDir");function c(){const e=process.env.PI_PACKAGE_DIR;return e?R(e):x?u(process.execPath):ie(L)}n(c,"getPackageDir");function Le(){if(x)return i(c(),"theme");const e=c(),t=f(i(e,"src"))?"src":"dist";return i(e,t,"modes","interactive","theme")}n(Le,"getThemesDir");function Oe(){if(x)return i(c(),"export-html");const e=c(),t=f(i(e,"src"))?"src":"dist";return i(e,t,"core","export-html")}n(Oe,"getExportTemplateDir");function se(){return i(c(),"package.json")}n(se,"getPackageJsonPath");function $e(){return h(i(c(),"README.md"))}n($e,"getReadmePath");function Te(){return h(i(c(),"docs"))}n(Te,"getDocsPath");function ae(){return h(i(c(),"examples"))}n(ae,"getExamplesPath");function ce(){return h(i(c(),"dal-docs"))}n(ce,"getDalDocsPath");function Be(){return i(ce(),"examples","extensions")}n(Be,"getDalExtensionExamplesPath");function We(){return h(i(ae(),"extensions","official"))}n(We,"getOfficialExtensionsPath");const ue="@deepailab/dal-official-extensions";function Ge(e){try{return JSON.parse(k(S(i(e,"package.json"),"utf-8"))).name===ue}catch{return!1}}n(Ge,"isOfficialExtensionsPackage");function Me(){return h(i(c(),"CHANGELOG.md"))}n(Me,"getChangelogPath");function pe(){if(x)return i(c(),"assets");const e=c(),t=f(i(e,"src"))?"src":"dist";return i(e,t,"modes","interactive","assets")}n(pe,"getInteractiveAssetsDir");function je(e){return i(pe(),e)}n(je,"getBundledInteractiveAssetPath");let N;function Fe(e){N=e}n(Fe,"setEmbeddedQuickJSWasmPath");function Je(){return N??=V(import.meta.url).resolve("quickjs-wasi/quickjs.wasm"),N}n(Je,"getQuickJSWasmPath");function de(e,t){if(e==="bun-binary")return"./src/extensions/codemode/worker.ts";if(e==="bundled-node")return new URL("./codemode-worker.js",t)}n(de,"resolveCodemodeWorkerSpecifier");let M;function qe(){const e=x?"bun-binary":ee?"bundled-node":"unbundled",t=de(e,import.meta.url);return e!=="bundled-node"||!(t instanceof URL)?t:(M??=new URL(`data:text/javascript;base64,${S(t).toString("base64")}`),M)}n(qe,"getCodemodeWorkerSpecifier");function Ke(e=j){if(x||!e)return;let t;try{t=JSON.parse(k(S(e,"utf-8")))}catch(o){return o.code==="ENOENT"?{kind:"removed"}:void 0}return t.version&&t.version!==fe?{kind:"updated",version:t.version}:void 0}n(Ke,"detectInstallChange");let b={},j;try{const e=se();b=JSON.parse(k(S(e,"utf-8"))),j=e}catch(e){if(e.code!=="ENOENT")throw e}const F=b.piConfig?.name,He=b.name||"@earendil-works/pi-coding-agent",E=F||"pi",Ve=b.piConfig?.title||(F?E:"\u03C0"),le=b.piConfig?.configDir||".dal",ze=E!=="pi",Qe=[".agents",".claude"],fe=b.version||"0.0.0",Xe=b.piConfig?.upstreamPi,me="@deepailab/dal",ge="@deepailab",he="DeepAILab-Team/dal-dist",xe=`https://github.com/${he}/releases`,be="https://git.siweibot.com/api/packages/gitea/npm",_e=`${E.toUpperCase()}_CODING_AGENT_DIR`,Ye=`${E.toUpperCase()}_CODING_AGENT_SESSION_DIR`;function Ee(e){return R(e)}n(Ee,"expandTildePath");function Ze(e,t=`https://gist.github.com/${e}`){const o=process.env.DAL_SHARE_VIEWER_URL||process.env.PI_SHARE_VIEWER_URL;return o?`${o}#${e}`:t}n(Ze,"getShareViewerUrl");function g(){const e=process.env[_e];return e?Ee(e):i(A(),le,"agent")}n(g,"getAgentDir");function et(){return i(g(),"themes")}n(et,"getCustomThemesDir");function tt(){return i(g(),"models.json")}n(tt,"getModelsPath");function nt(){return i(g(),"auth.json")}n(nt,"getAuthPath");function rt(){return i(g(),"settings.json")}n(rt,"getSettingsPath");function ot(){return i(g(),"tools")}n(ot,"getToolsDir");function it(){return i(g(),"bin")}n(it,"getBinDir");function st(){return i(g(),"prompts")}n(st,"getPromptsDir");function at(e){const t=i(e,"prompts"),o=i(e,"commands");return!f(t)&&f(o)?o:t}n(at,"getProjectPromptsDir");function ct(){return i(g(),"sessions")}n(ct,"getSessionsDir");function ut(){return i(g(),`${E}-debug.log`)}n(ut,"getDebugLogPath");export{E as APP_NAME,Ve as APP_TITLE,le as CONFIG_DIR_NAME,xe as DAL_RELEASES_URL,he as DAL_RELEASE_REPO,me as DAL_UPDATE_PACKAGE,be as DAL_UPDATE_REGISTRY,ge as DAL_UPDATE_SCOPE,_e as ENV_AGENT_DIR,Ye as ENV_SESSION_DIR,ze as IS_WHITE_LABEL_BUILD,ue as OFFICIAL_EXTENSIONS_PACKAGE_NAME,He as PACKAGE_NAME,Qe as SHARED_SKILL_CONFIG_DIRS,Xe as UPSTREAM_PI,fe as VERSION,Ke as detectInstallChange,y as detectInstallMethod,Ee as expandTildePath,ie as findNodePackageDir,g as getAgentDir,nt as getAuthPath,it as getBinDir,je as getBundledInteractiveAssetPath,Me as getChangelogPath,qe as getCodemodeWorkerSpecifier,Ce as getConfiguredSelfUpdateArgv,et as getCustomThemesDir,ce as getDalDocsPath,Be as getDalExtensionExamplesPath,ut as getDebugLogPath,Te as getDocsPath,ae as getExamplesPath,Oe as getExportTemplateDir,pe as getInteractiveAssetsDir,tt as getModelsPath,We as getOfficialExtensionsPath,c as getPackageDir,se as getPackageJsonPath,at as getProjectPromptsDir,st as getPromptsDir,Je as getQuickJSWasmPath,$e as getReadmePath,Ue as getSelfUpdateCommand,oe as getSelfUpdateUnavailableInstruction,ct as getSessionsDir,rt as getSettingsPath,Ze as getShareViewerUrl,Le as getThemesDir,ot as getToolsDir,Re as getUpdateInstruction,x as isBunBinary,Z as isBunRuntime,ee as isBundledNode,Ge as isOfficialExtensionsPackage,we as makeConfiguredSelfUpdateCommand,de as resolveCodemodeWorkerSpecifier,Fe as setEmbeddedQuickJSWasmPath};
|
|
1
|
+
var K=Object.defineProperty;var n=(e,t)=>K(e,"name",{value:t,configurable:!0});import{accessSync as v,constants as U,existsSync as f,readFileSync as P,realpathSync as H}from"fs";import{createRequire as V}from"module";import{homedir as A}from"os";import{basename as C,dirname as u,join as i,resolve as h,sep as w,win32 as z}from"path";import{fileURLToPath as Q}from"url";import{spawnProcessSync as X}from"./utils/child-process.js";import{normalizePath as L}from"./utils/paths.js";import{stripBom as k}from"./utils/text.js";const Y=Q(import.meta.url),R=u(Y),x=import.meta.url.includes("$bunfs")||import.meta.url.includes("~BUN")||import.meta.url.includes("%7EBUN"),Z=!!process.versions.bun,ee=typeof PI_BUNDLED_NODE<"u"&&PI_BUNDLED_NODE;function te(e){return e.startsWith("https://")||e.startsWith("http://")}n(te,"isUrlInstallSpec");function O(e){return typeof e=="string"?{packageName:e,installSpec:e}:{packageName:e.packageName,installSpec:e.installSpec??e.packageName}}n(O,"normalizeSelfUpdatePackageTarget");function S(e,t){return t?{...e,display:`${t.display} && ${e.display}`,steps:[t,e]}:e}n(S,"makeSelfUpdateCommand");function m(e,t){return{command:e,args:t,display:[e,...t].map(o=>/\s/.test(o)?`"${o}"`:o).join(" ")}}n(m,"makeSelfUpdateCommandStep");function y(){if(x)return"bun-binary";const e=`${R}\0${process.execPath||""}`.toLowerCase().replace(/\\/g,"/");return e.includes("/pnpm/")||e.includes("/.pnpm/")?"pnpm":e.includes("/yarn/")||e.includes("/.yarn/")?"yarn":Z||e.includes("/install/global/node_modules/")?"bun":e.includes("/npm/")||e.includes("/node_modules/")?"npm":"unknown"}n(y,"detectInstallMethod");function $(){const e=c(),t=process.platform==="win32"||e.includes("\\")?z:{basename:C,dirname:u},o=t.dirname(e);let r;if(t.basename(o).startsWith("@")&&t.basename(t.dirname(o))==="node_modules"?r=t.dirname(o):t.basename(o)==="node_modules"&&(r=o),!r)return;const s=t.dirname(r);if(t.basename(s)==="lib")return{root:r,prefix:t.dirname(s)}}n($,"getInferredNpmInstall");function I(e,t,o=t,r){const s=O(o),a=s.packageName===ge&&!te(s.installSpec)?[`--${he}:registry=${_e}/`]:[];switch(e){case"bun-binary":return;case"pnpm":{const p=_("pnpm",["root","-g"])?void 0:/^(.*[\\/]global[\\/][^\\/]+)[\\/]\.pnpm[\\/]/.exec(c()),d=p?[`--config.global-bin-dir=${process.env.PNPM_HOME||u(u(p[1]))}`]:[];return S(m("pnpm",["install","-g","--ignore-scripts","--config.minimumReleaseAge=0",...d,...a,s.installSpec]),s.packageName===t?void 0:m("pnpm",["remove","-g",...d,t]))}case"yarn":return S(m("yarn",["global","add","--ignore-scripts",...a,s.installSpec]),s.packageName===t?void 0:m("yarn",["global","remove",t]));case"bun":return S(m("bun",["install","-g","--ignore-scripts","--minimum-release-age=0",...a,s.installSpec]),s.packageName===t?void 0:m("bun",["uninstall","-g",t]));case"npm":{const[p="npm",...d]=r??[],l=r?.length?void 0:$(),D=[...d,...l?["--prefix",l.prefix]:[]],J=m(p,[...D,"install","-g","--ignore-scripts","--min-release-age=0",...a,s.installSpec]),q=s.packageName===t?void 0:m(p,[...D,"uninstall","-g",t]);return S(J,q)}case"unknown":return}}n(I,"getSelfUpdateCommandForMethod");function _(e,t,o={}){const r=X(e,t,{encoding:"utf-8",stdio:["ignore","pipe","pipe"]});if(r.status===0)return r.stdout.trim()||void 0;if(o.requireSuccess){const s=r.error?.message||r.stderr.trim()||`exit code ${r.status??"unknown"}`;throw new Error(`Failed to run ${[e,...t].join(" ")}: ${s}`)}}n(_,"readCommandOutput");function ne(e,t,o){switch(e){case"npm":{const r=!!o?.length,[s="npm",...a]=o??[];if(r&&s==="bun"){const l=_(s,[...a,"pm","bin","-g"],{requireSuccess:!0}),D=[i(A(),".bun","install","global","node_modules")];return l&&D.push(i(u(l),"install","global","node_modules")),D}const p=_(s,[...a,"root","-g"],{requireSuccess:r}),d=r?void 0:$();return[p,d?.root].filter(l=>!!l)}case"pnpm":{const r=_("pnpm",["root","-g"]);if(r)return[r,u(r)];const s=/^(.*[\\/]global[\\/][^\\/]+)[\\/]\.pnpm[\\/]/.exec(c());return s?[s[1]]:[]}case"yarn":{const r=_("yarn",["global","dir"]);return r?[r,i(r,"node_modules")]:[]}case"bun":{const r=_("bun",["pm","bin","-g"]),s=[i(A(),".bun","install","global","node_modules")];return r&&s.push(i(u(r),"install","global","node_modules")),s}case"bun-binary":case"unknown":return[]}}n(ne,"getGlobalPackageRoots");function T(e,t){const o=h(e);if(!f(o))return;let r=o;if(t)try{r=H(o)}catch{return}return process.platform==="win32"&&(r=r.toLowerCase()),r}n(T,"normalizeExistingPathForComparison");function B(e){return Array.from(new Set([T(e,!1),T(e,!0)].filter(t=>!!t)))}n(B,"getPathComparisonCandidates");function re(){const e=process.argv[1];if(!e)return;let t=u(e);for(;t!==u(t);){if(f(i(t,"package.json")))return t;t=u(t)}}n(re,"getEntrypointPackageDir");function W(){const e=c();try{return v(e,U.W_OK),v(u(e),U.W_OK),!0}catch{return!1}}n(W,"isSelfUpdatePathWritable");function G(e,t,o){const s=[c(),re()].filter(a=>!!a).flatMap(a=>B(a));return ne(e,t,o).some(a=>B(a).some(p=>{const d=p.endsWith(w)?p:`${p}${w}`;return s.some(l=>l.startsWith(d))}))}n(G,"isManagedByGlobalPackageManager");function Ce(e,t,o=e){const r=y(),s=I(r,e,o,t);if(!(!s||!G(r,e,t)||!W()))return s}n(Ce,"getSelfUpdateCommand");function we(e){const t=process.env.PI_SELF_UPDATE_COMMAND?.trim().split(/\s+/).filter(Boolean);return t?.length?t:e?.length?e:void 0}n(we,"getConfiguredSelfUpdateArgv");function Le(e,t){const o={packageName:t.packageName,version:t.version,installSpec:`${t.packageName}@${t.version}`},[r="",...s]=e.map(a=>a.replace(/\{(packageName|version|installSpec)\}/g,(p,d)=>o[d]));return m(r,s)}n(Le,"makeConfiguredSelfUpdateCommand");function oe(e,t,o=e){const r=y(),s=O(o);if(r==="bun-binary")return`Download from: ${E==="pi"?"https://github.com/earendil-works/pi/releases/latest":be}`;const a=I(r,e,s,t);return a&&G(r,e,t)&&!W()?`This installation is managed by a global ${r} install, but the install path is not writable. Update it yourself with: ${a.display}`:`Update ${s.installSpec} using the package manager, wrapper, or source checkout that provides this installation.`}n(oe,"getSelfUpdateUnavailableInstruction");function Re(e){const t=y(),o=I(t,e);return o?`Run: ${o.display}`:oe(e)}n(Re,"getUpdateInstruction");function ie(e){let t=e;for(;t!==u(t);){if(f(i(t,"package.json"))){const o=u(t);return C(t)==="dist"&&f(i(o,"package.json"))?o:t}t=u(t)}return e}n(ie,"findNodePackageDir");function c(){const e=process.env.PI_PACKAGE_DIR;return e?L(e):x?u(process.execPath):ie(R)}n(c,"getPackageDir");function Oe(){if(x)return i(c(),"theme");const e=c(),t=f(i(e,"src"))?"src":"dist";return i(e,t,"modes","interactive","theme")}n(Oe,"getThemesDir");function $e(){if(x)return i(c(),"export-html");const e=c(),t=f(i(e,"src"))?"src":"dist";return i(e,t,"core","export-html")}n($e,"getExportTemplateDir");function se(){return i(c(),"package.json")}n(se,"getPackageJsonPath");function Te(){return h(i(c(),"README.md"))}n(Te,"getReadmePath");function Be(){return h(i(c(),"docs"))}n(Be,"getDocsPath");function ae(){return h(i(c(),"examples"))}n(ae,"getExamplesPath");function ce(){return h(i(c(),"dal-docs"))}n(ce,"getDalDocsPath");function We(){return i(ce(),"examples","extensions")}n(We,"getDalExtensionExamplesPath");function Ge(){return h(i(ae(),"extensions","official"))}n(Ge,"getOfficialExtensionsPath");const ue="@deepailab/dal-official-extensions";function Me(e){try{return JSON.parse(k(P(i(e,"package.json"),"utf-8"))).name===ue}catch{return!1}}n(Me,"isOfficialExtensionsPackage");function je(){return h(i(c(),"CHANGELOG.md"))}n(je,"getChangelogPath");function pe(){if(x)return i(c(),"assets");const e=c(),t=f(i(e,"src"))?"src":"dist";return i(e,t,"modes","interactive","assets")}n(pe,"getInteractiveAssetsDir");function Fe(e){return i(pe(),e)}n(Fe,"getBundledInteractiveAssetPath");let N;function Je(e){N=e}n(Je,"setEmbeddedQuickJSWasmPath");function qe(){return N??=V(import.meta.url).resolve("quickjs-wasi/quickjs.wasm"),N}n(qe,"getQuickJSWasmPath");function de(e,t){if(e==="bun-binary")return"./src/extensions/codemode/worker.ts";if(e==="bundled-node")return new URL("./codemode-worker.js",t)}n(de,"resolveCodemodeWorkerSpecifier");let M;function Ke(){const e=x?"bun-binary":ee?"bundled-node":"unbundled",t=de(e,import.meta.url);return e!=="bundled-node"||!(t instanceof URL)?t:(M??=new URL(`data:text/javascript;base64,${P(t).toString("base64")}`),M)}n(Ke,"getCodemodeWorkerSpecifier");function He(e=j){if(x||!e)return;let t;try{t=JSON.parse(k(P(e,"utf-8")))}catch(o){return o.code==="ENOENT"?{kind:"removed"}:void 0}return t.version&&t.version!==me?{kind:"updated",version:t.version}:void 0}n(He,"detectInstallChange");let b={},j;try{const e=se();b=JSON.parse(k(P(e,"utf-8"))),j=e}catch(e){if(e.code!=="ENOENT")throw e}const F=b.piConfig?.name,Ve=b.name||"@earendil-works/pi-coding-agent",E=F||"pi";function le(e){const t=e?.trim();if(!(!t||t.length>40||/[\u0000-\u001f\u007f<>]/.test(t)))return t}n(le,"hostProductTitle");const ze=le(process.env.DAL_PRODUCT_TITLE)||b.piConfig?.title||(F?E:"\u03C0"),fe=b.piConfig?.configDir||".dal",Qe=E!=="pi",Xe=[".agents",".claude"],me=b.version||"0.0.0",Ye=b.piConfig?.upstreamPi,ge="@deepailab/dal",he="@deepailab",xe="DeepAILab-Team/dal-dist",be=`https://github.com/${xe}/releases`,_e="https://git.siweibot.com/api/packages/gitea/npm",Ee=`${E.toUpperCase()}_CODING_AGENT_DIR`,Ze=`${E.toUpperCase()}_CODING_AGENT_SESSION_DIR`;function De(e){return L(e)}n(De,"expandTildePath");function et(e,t=`https://gist.github.com/${e}`){const o=process.env.DAL_SHARE_VIEWER_URL||process.env.PI_SHARE_VIEWER_URL;return o?`${o}#${e}`:t}n(et,"getShareViewerUrl");function g(){const e=process.env[Ee];return e?De(e):i(A(),fe,"agent")}n(g,"getAgentDir");function tt(){return i(g(),"themes")}n(tt,"getCustomThemesDir");function nt(){return i(g(),"models.json")}n(nt,"getModelsPath");function rt(){return i(g(),"auth.json")}n(rt,"getAuthPath");function ot(){return i(g(),"settings.json")}n(ot,"getSettingsPath");function it(){return i(g(),"tools")}n(it,"getToolsDir");function st(){return i(g(),"bin")}n(st,"getBinDir");function at(){return i(g(),"prompts")}n(at,"getPromptsDir");function ct(e){const t=i(e,"prompts"),o=i(e,"commands");return!f(t)&&f(o)?o:t}n(ct,"getProjectPromptsDir");function ut(){return i(g(),"sessions")}n(ut,"getSessionsDir");function pt(){return i(g(),`${E}-debug.log`)}n(pt,"getDebugLogPath");export{E as APP_NAME,ze as APP_TITLE,fe as CONFIG_DIR_NAME,be as DAL_RELEASES_URL,xe as DAL_RELEASE_REPO,ge as DAL_UPDATE_PACKAGE,_e as DAL_UPDATE_REGISTRY,he as DAL_UPDATE_SCOPE,Ee as ENV_AGENT_DIR,Ze as ENV_SESSION_DIR,Qe as IS_WHITE_LABEL_BUILD,ue as OFFICIAL_EXTENSIONS_PACKAGE_NAME,Ve as PACKAGE_NAME,Xe as SHARED_SKILL_CONFIG_DIRS,Ye as UPSTREAM_PI,me as VERSION,He as detectInstallChange,y as detectInstallMethod,De as expandTildePath,ie as findNodePackageDir,g as getAgentDir,rt as getAuthPath,st as getBinDir,Fe as getBundledInteractiveAssetPath,je as getChangelogPath,Ke as getCodemodeWorkerSpecifier,we as getConfiguredSelfUpdateArgv,tt as getCustomThemesDir,ce as getDalDocsPath,We as getDalExtensionExamplesPath,pt as getDebugLogPath,Be as getDocsPath,ae as getExamplesPath,$e as getExportTemplateDir,pe as getInteractiveAssetsDir,nt as getModelsPath,Ge as getOfficialExtensionsPath,c as getPackageDir,se as getPackageJsonPath,ct as getProjectPromptsDir,at as getPromptsDir,qe as getQuickJSWasmPath,Te as getReadmePath,Ce as getSelfUpdateCommand,oe as getSelfUpdateUnavailableInstruction,ut as getSessionsDir,ot as getSettingsPath,et as getShareViewerUrl,Oe as getThemesDir,it as getToolsDir,Re as getUpdateInstruction,le as hostProductTitle,x as isBunBinary,Z as isBunRuntime,ee as isBundledNode,Me as isOfficialExtensionsPackage,Le as makeConfiguredSelfUpdateCommand,de as resolveCodemodeWorkerSpecifier,Je as setEmbeddedQuickJSWasmPath};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { type Args, parseArgs } from "./cli/args.ts";
|
|
2
|
-
export { CONFIG_DIR_NAME, getAgentDir, getDocsPath, getExamplesPath, getPackageDir, getReadmePath, SHARED_SKILL_CONFIG_DIRS, VERSION, } from "./config.ts";
|
|
2
|
+
export { APP_TITLE, CONFIG_DIR_NAME, getAgentDir, getDocsPath, getExamplesPath, getPackageDir, getReadmePath, SHARED_SKILL_CONFIG_DIRS, VERSION, } from "./config.ts";
|
|
3
3
|
export { agentLogPath, appendAgentLog } from "./core/agent-log.ts";
|
|
4
4
|
export { AgentSession, type AgentSessionConfig, type AgentSessionEvent, type AgentSessionEventListener, type ModelCycleResult, type ParsedSkillBlock, type PromptOptions, parseSkillBlock, type SessionStats, } from "./core/agent-session.ts";
|
|
5
5
|
export { readStoredCredential } from "./core/auth-storage.ts";
|