dal-code 1.0.37 → 1.0.39
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 +14 -0
- package/dal-docs/settings.md +1 -1
- package/dist/core/agent-session.js +4 -4
- package/dist/core/auth-storage.js +1 -1
- package/dist/core/compaction/compaction.js +31 -13
- package/dist/core/package-manager.d.ts +4 -0
- package/dist/core/package-manager.js +2 -2
- package/dist/core/permissions/tool-policy.js +1 -1
- package/dist/core/project-facts.d.ts +16 -0
- package/dist/core/project-facts.js +2 -0
- package/dist/core/sandbox/policy.js +1 -1
- package/dist/core/sandbox/windows.js +1 -1
- package/dist/core/session-manager.d.ts +3 -0
- package/dist/core/session-manager.js +12 -12
- package/dist/core/settings-diagnostics.js +1 -1
- package/dist/core/settings-manager.d.ts +3 -0
- package/dist/core/settings-manager.js +1 -1
- package/dist/core/shared-data.js +1 -0
- package/dist/core/system-prompt.d.ts +1 -0
- package/dist/core/system-prompt.js +13 -13
- package/dist/core/trust-manager.js +2 -2
- package/dist/core/workspace-lock.d.ts +29 -0
- package/dist/core/workspace-lock.js +3 -0
- package/dist/dal/reviewed/endorsed-cli.js +1 -0
- package/dist/dal/reviewed/endorsed-plan.js +1 -0
- package/dist/dal/reviewed/endorsed.js +1 -0
- package/dist/dal/reviewed/version.js +1 -0
- package/dist/extensions/mcp/config.js +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/main.js +3 -3
- package/dist/modes/print-mode.js +5 -5
- package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-goal/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-guard/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-guard/src/attribution.js +1 -0
- package/dist/node_modules/@dalcode/dal-guard/src/credentials.js +1 -1
- package/dist/node_modules/@dalcode/dal-guard/src/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-guard/src/mode.js +2 -2
- package/dist/node_modules/@dalcode/dal-guard/src/package-manager.js +1 -0
- package/dist/node_modules/@dalcode/dal-guard/src/workspace.js +2 -0
- 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-lsp/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-mcp/package.json +5 -5
- package/dist/node_modules/@dalcode/dal-mcp/src/config-edit.js +2 -2
- package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +4 -2
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/shared-data.js +1 -0
- package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +4 -2
- package/dist/node_modules/@dalcode/dal-pi-kit/src/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/src/shared-data.js +1 -0
- package/dist/node_modules/@dalcode/dal-plugins/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-plugins/src/state.js +2 -2
- 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 +5 -4
- package/dist/node_modules/@dalcode/dal-router/src/commands.js +7 -7
- package/dist/node_modules/@dalcode/dal-router/src/config.d.ts +3 -1
- package/dist/node_modules/@dalcode/dal-router/src/config.js +2 -2
- package/dist/node_modules/@dalcode/dal-router/src/index.js +4 -4
- package/dist/node_modules/@dalcode/dal-router/src/runtime.js +1 -1
- package/dist/node_modules/@dalcode/dal-router/src/subagent.js +1 -1
- package/dist/node_modules/@dalcode/dal-router/src/suggest.js +2 -0
- package/dist/node_modules/@dalcode/dal-skills/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-subagent/package.json +5 -5
- package/dist/node_modules/@dalcode/dal-subagent/src/index.js +12 -12
- package/dist/node_modules/@dalcode/dal-telemetry/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-telemetry/src/config.js +2 -2
- 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-web/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-workflow/src/completion-check.js +4 -0
- package/dist/node_modules/@dalcode/dal-workflow/src/index.js +4 -4
- package/dist/node_modules/@dalcode/dal-workflow/src/ledger.js +3 -0
- package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
- package/dist/node_modules/@earendil-works/chord/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
- 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/opencode-go.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.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/vercel-ai-gateway.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-client/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-protocol/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-server/package.json +3 -3
- 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/dist/package-manager-cli.js +72 -72
- package/dist/utils/version-check.d.ts +1 -0
- package/dist/utils/version-check.js +2 -2
- 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/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/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
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./i18n.js";
|
|
1
|
+
export*from"./i18n.js";export*from"./shared-data.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var N=Object.defineProperty;var t=(r,e)=>N(r,"name",{value:e,configurable:!0});var g=Object.defineProperty,o=t((r,e)=>g(r,"name",{value:e,configurable:!0}),"n");import{closeSync as $,fchmodSync as T,fsyncSync as j,lstatSync as x,mkdirSync as m,openSync as R,realpathSync as C,renameSync as I,rmdirSync as L,rmSync as y,statSync as l,writeFileSync as O}from"node:fs";import{basename as P,dirname as u,join as Y}from"node:path";const w="formatVersion";function S(r){if(typeof r!="object"||r===null||Array.isArray(r))return 1;const e=r[w];return typeof e=="number"&&Number.isInteger(e)&&e>0?e:1}t(S,"I"),o(S,"declaredDataFormat");const f=new Set,d=[];function h(r){f.has(r)||(f.add(r),d.push(r))}t(h,"K"),o(h,"reportNewerDataFormat");function p(){return d.splice(0)}t(p,"Y"),o(p,"drainNewerDataFormatFiles");function F(r){return f.has(r)}t(F,"j"),o(F,"isNewerDataFormatFile");function D(r){try{if(x(r).isSymbolicLink())return C(r)}catch{}return r}t(D,"T"),o(D,"resolveWriteTarget");const _=new Set(["EPERM","EACCES","EBUSY"]);function b(r,e){for(let n=0;;n++)try{I(r,e);return}catch(a){const c=a.code;if(process.platform!=="win32"||!c||!_.has(c)||n>=9)throw a;const i=Date.now()+20*(n+1);for(;Date.now()<i;);}}t(b,"N"),o(b,"renameWithRetry");function E(r){try{return l(r).mode&511}catch{return}}t(E,"O"),o(E,"existingMode");function k(r,e,n={}){const a=D(r),c=Y(u(a),`.${P(a)}.${process.pid}.${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}.tmp`),i=E(a),s=R(c,"wx",i??n.mode??420);try{try{i!==void 0&&process.platform!=="win32"&&T(s,i),O(s,e,"utf-8"),j(s)}finally{$(s)}b(c,a)}catch(M){throw y(c,{force:!0}),M}}t(k,"J"),o(k,"writeFileAtomicSync");const K=1e4,W=1e4;function A(r){try{return l(r).mtimeMs}catch{return}}t(A,"C"),o(A,"lockMtimeMs");function v(r,e){const n=`${r}.lock`;m(u(r),{recursive:!0});const a=Date.now()+W;for(;;)try{m(n);break}catch(c){if(c.code!=="EEXIST")throw c;const i=A(n);if(i!==void 0&&i<Date.now()-K){y(n,{recursive:!0,force:!0});continue}if(Date.now()>a)throw new Error(`${r} is locked by another process`);const s=Date.now()+15;for(;Date.now()<s;);}try{return e()}finally{try{L(n)}catch{}}}t(v,"P"),o(v,"withFileLockSync");export{w as DATA_FORMAT_KEY,S as declaredDataFormat,p as drainNewerDataFormatFiles,F as isNewerDataFormatFile,h as reportNewerDataFormat,v as withFileLockSync,k as writeFileAtomicSync};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-plugins",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
]
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
26
|
-
"@dalcode/dal-skills": "1.0.
|
|
27
|
-
"@dalcode/deepailab": "1.0.
|
|
25
|
+
"@dalcode/dal-pi-kit": "1.0.39",
|
|
26
|
+
"@dalcode/dal-skills": "1.0.39",
|
|
27
|
+
"@dalcode/deepailab": "1.0.39",
|
|
28
28
|
"typebox": "1.3.27"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var f=Object.defineProperty;var a=(e,t)=>f(e,"name",{value:t,configurable:!0});var
|
|
2
|
-
`)
|
|
1
|
+
var f=Object.defineProperty;var a=(e,t)=>f(e,"name",{value:t,configurable:!0});var m=Object.defineProperty,i=a((e,t)=>m(e,"name",{value:t,configurable:!0}),"r");import{mkdirSync as g,readFileSync as y}from"node:fs";import{dirname as U,join as n}from"node:path";import{withFileLockSync as S,writeFileAtomicSync as j}from"@dalcode/dal-pi-kit";function r(e){return n(e,"dal-plugins")}a(r,"n"),i(r,"pluginDataDir");function l(e){return n(r(e),"state.json")}a(l,"v"),i(l,"statePath");function h(e){return n(r(e),"registry.json")}a(h,"x"),i(h,"registryCachePath");function o(e){try{const t=JSON.parse(y(e,"utf8"));return{...typeof t=="object"&&t!==null?t:{},lastUsed:t.lastUsed&&typeof t.lastUsed=="object"?t.lastUsed:{},lastUpdateCheck:typeof t.lastUpdateCheck=="string"?t.lastUpdateCheck:void 0,failedUpdates:t.failedUpdates&&typeof t.failedUpdates=="object"?t.failedUpdates:{},hostTools:Array.isArray(t.hostTools)?t.hostTools.filter(s=>typeof s=="string"):void 0}}catch{return{lastUsed:{},failedUpdates:{}}}}a(o,"f"),i(o,"readState");function c(e,t){g(U(e),{recursive:!0}),j(e,`${JSON.stringify(t,null,2)}
|
|
2
|
+
`)}a(c,"h"),i(c,"writeState");function d(e,t){return S(e,()=>{const s=o(e);return t(s),c(e,s),s})}a(d,"m"),i(d,"updateState");const v=2e3;class w{static{a(this,"j")}static{i(this,"UsageRecorder")}path;pending=new Map;timer;constructor(t){this.path=t}record(t,s=new Date){this.pending.set(t,s.toISOString()),!this.timer&&(this.timer=setTimeout(()=>this.flush(),v),this.timer.unref?.())}flush(){if(this.timer&&clearTimeout(this.timer),this.timer=void 0,this.pending.size===0)return;const t=[...this.pending];this.pending.clear();try{d(this.path,s=>{for(const[p,u]of t)s.lastUsed[p]=u})}catch{}}}export{w as UsageRecorder,r as pluginDataDir,o as readState,h as registryCachePath,l as statePath,d as updateState,c as writeState};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-review",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Code review: a read-only reviewer sub-agent over uncommitted changes, a base branch, a commit, a PR or a supplied diff, returning structured, deduplicated findings. /review in the TUI, dal -p, RPC and the SDK.",
|
|
6
6
|
"type": "module",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
]
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
23
|
-
"@dalcode/dal-subagent": "1.0.
|
|
22
|
+
"@dalcode/dal-pi-kit": "1.0.39",
|
|
23
|
+
"@dalcode/dal-subagent": "1.0.39",
|
|
24
24
|
"typebox": "1.3.7"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-rewind",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Git checkpoints for DAL: a snapshot after every turn that changes files, /rewind, Esc+Esc, safe restore, undo. Adapted from pi-rewind 0.5.0 (MIT, arpagon).",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
]
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
24
|
+
"@dalcode/dal-pi-kit": "1.0.39"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@earendil-works/pi-coding-agent": "^1.0.9"
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-router",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./src/index.js",
|
|
9
9
|
"./subagent": "./src/subagent.js",
|
|
10
|
+
"./suggest": "./src/suggest.js",
|
|
10
11
|
"./config": "./src/config.js",
|
|
11
12
|
"./jev": "./src/jev.js",
|
|
12
13
|
"./router": "./src/router.js",
|
|
@@ -25,9 +26,9 @@
|
|
|
25
26
|
]
|
|
26
27
|
},
|
|
27
28
|
"dependencies": {
|
|
28
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
29
|
-
"@dalcode/deepailab": "1.0.
|
|
30
|
-
"@earendil-works/pi-tui": "^1.0.
|
|
29
|
+
"@dalcode/dal-pi-kit": "1.0.39",
|
|
30
|
+
"@dalcode/deepailab": "1.0.39",
|
|
31
|
+
"@earendil-works/pi-tui": "^1.0.39"
|
|
31
32
|
},
|
|
32
33
|
"peerDependencies": {
|
|
33
34
|
"@earendil-works/pi-coding-agent": "^1.0.0"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
`),"info")}i(
|
|
3
|
-
`):` ${u("\u6682\u65E0\u8DEF\u7531\u51B3\u7B56\u3002")}`;
|
|
1
|
+
var y=Object.defineProperty;var i=(e,t)=>y(e,"name",{value:t,configurable:!0});var d=Object.defineProperty,D=i((e,t)=>d(e,"name",{value:t,configurable:!0}),"c");import{t as u}from"@dalcode/dal-pi-kit";import{patchFactoryConfig as g}from"./config.js";import{resolveJevRequestConfig as m}from"./jev.js";import{autoRouteActive as $,candidates as p,config as v,configWarning as M,persistMainAutoRoute as h,reloadConfig as j,router as E}from"./runtime.js";function B(e){e.ui.notify([u("\u7528\u6CD5\uFF1A/factory [status]"),u("\u7528\u6CD5\uFF1A/factory auto on|off \u2014 \u4E3B\u5BF9\u8BDD\u81EA\u52A8\u8DEF\u7531\u5F00\u5173"),u("\u7528\u6CD5\uFF1A/factory levels \u2014 \u6700\u8FD1\u51B3\u7B56\u4F9D\u636E"),u("\u7528\u6CD5\uFF1A/factory pool \u2014 \u5019\u9009\u6A21\u578B\u6C60"),u("\u7528\u6CD5\uFF1A/factory suggest on|off \u2014 \u590D\u6742\u4EFB\u52A1\u65F6\u63D0\u793A\u6539\u7528\u81EA\u52A8")].join(`
|
|
2
|
+
`),"info")}i(B,"k"),D(B,"usage");async function l(e,t){const[C,...f]=e.trim().split(/\s+/).filter(Boolean),c=M();c&&t.ui.notify(c,"warning");const r=v(),s=p();switch(C??"status"){case"status":{const F=r.enabled?$()?u("\u4E3B\u5BF9\u8BDD\u81EA\u52A8\u8DEF\u7531\u5DF2\u5F00\u542F"):u("\u4EC5\u8F85\u52A9\u4EFB\u52A1\u8DEF\u7531\uFF08\u4E3B\u5BF9\u8BDD\u81EA\u52A8\u8DEF\u7531\u5173\u95ED\uFF0C/factory auto on \u5F00\u542F\uFF09"):u("\u5DF2\u7981\u7528"),o=r.classifier.enabled?m(r.classifier)?u("\u5206\u7C7B\u5668\uFF1Ajev\uFF08\u672C\u673A Key\uFF09"):u("\u5206\u7C7B\u5668\uFF1Ajev\uFF08\u7ECF DeepAILab \u8D26\u53F7\uFF1B\u4E0D\u53EF\u7528\u65F6\u4FDD\u6301\u9ED8\u8BA4\u6A21\u578B\uFF09"):u("\u5206\u7C7B\u5668\uFF1A\u5DF2\u5173\u95ED"),n=E().decisionLog().slice(-5).reverse(),a=n.length?n.map(A=>` \u2192 ${A.modelId??"?"} \u2014 ${A.reason}`).join(`
|
|
3
|
+
`):` ${u("\u6682\u65E0\u8DEF\u7531\u51B3\u7B56\u3002")}`;t.ui.notify(`${u("\u6A21\u578B\u5DE5\u5382\uFF1A")}${F}
|
|
4
4
|
${o}
|
|
5
|
-
${
|
|
6
|
-
`),"info");return}case"pool":{if(!
|
|
7
|
-
${
|
|
8
|
-
`)}`,"info");return}case"auto":{const
|
|
5
|
+
${a}`,"info");return}case"levels":{const F=E().decisionLog().slice(-8).reverse();if(F.length===0){t.ui.notify(u("\u6682\u65E0\u8DEF\u7531\u51B3\u7B56\u3002"),"info");return}t.ui.notify(F.map(o=>{const n=o.source==="jev"&&typeof o.confidence=="number"?`\uFF08${u("\u7F6E\u4FE1\u5EA6 ")}${Math.round(o.confidence*100)}%\uFF09`:"";return`\u2192 ${o.modelId??"?"} \u2014 ${o.reason}${n}`}).join(`
|
|
6
|
+
`),"info");return}case"pool":{if(!s||s.length===0){t.ui.notify(u("\u5019\u9009\u6C60\u5C1A\u672A\u6784\u5EFA\uFF08\u7B49\u5F85\u4F1A\u8BDD\u542F\u52A8\uFF09\u3002"),"info");return}const F=[...s].sort((o,n)=>o.costPerMtok-n.costPerMtok||o.id.localeCompare(n.id)).map(o=>{const n=o.contextWindow>=1e6?"1M":`${Math.round(o.contextWindow/1e3)}K`,a=o.costPerMtok>0?`~$${o.costPerMtok.toFixed(2)}/Mtok`:u("\u4EF7\u683C\u672A\u77E5");return` ${o.id} (${n}${o.reasoning?`, ${u("\u63A8\u7406")}`:""}, ${a})`});t.ui.notify(`${u("\u5019\u9009\u6A21\u578B\u6C60\uFF1A")}
|
|
7
|
+
${F.join(`
|
|
8
|
+
`)}`,"info");return}case"auto":{const F=f[0];if(F!=="on"&&F!=="off"){t.ui.notify(u("\u7528\u6CD5\uFF1A/factory auto on|off"),"info");return}h(F==="on"),t.ui.notify(F==="on"?u("\u4E3B\u5BF9\u8BDD\u81EA\u52A8\u8DEF\u7531\u5DF2\u5F00\u542F\uFF08\u5168\u5C40\u6301\u4E45\u5316\uFF09\u3002"):u("\u4E3B\u5BF9\u8BDD\u81EA\u52A8\u8DEF\u7531\u5DF2\u5173\u95ED\uFF08\u5168\u5C40\u6301\u4E45\u5316\uFF09\u3002"),"info");return}case"suggest":{const F=f[0];if(F!=="on"&&F!=="off"){t.ui.notify(u("\u7528\u6CD5\uFF1A/factory suggest on|off \u2014 \u590D\u6742\u4EFB\u52A1\u65F6\u63D0\u793A\u6539\u7528\u81EA\u52A8"),"info");return}try{g({suggestAuto:F==="on"}),j()}catch(o){t.ui.notify(o instanceof Error?o.message:String(o),"error");return}t.ui.notify(F==="on"?u("\u590D\u6742\u4EFB\u52A1\u65F6\u4F1A\u63D0\u793A\u6539\u7528\u81EA\u52A8\u3002"):u("\u4E0D\u518D\u63D0\u793A\u6539\u7528\u81EA\u52A8\u3002"),"info");return}default:B(t)}}i(l,"W"),D(l,"runFactoryCommand");export{l as runFactoryCommand};
|
|
@@ -15,6 +15,8 @@ export interface FactoryConfig {
|
|
|
15
15
|
subagent: boolean;
|
|
16
16
|
compaction: boolean;
|
|
17
17
|
};
|
|
18
|
+
subagentModel: string;
|
|
19
|
+
suggestAuto: boolean;
|
|
18
20
|
classifier: ClassifierConfig;
|
|
19
21
|
affinity: {
|
|
20
22
|
margin: number;
|
|
@@ -45,6 +47,6 @@ export declare function loadFactoryConfig(): {
|
|
|
45
47
|
mainAutoRouteExplicit: boolean;
|
|
46
48
|
warning?: string;
|
|
47
49
|
};
|
|
48
|
-
export declare function
|
|
50
|
+
export declare function patchFactoryConfig(patch: Partial<FactoryConfig>): void;
|
|
49
51
|
export declare function userPinnedThinking(cwd: string, argv?: readonly string[]): boolean;
|
|
50
52
|
export declare function userPinnedModel(cwd: string, argv?: readonly string[]): boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
1
|
+
var S=Object.defineProperty;var i=(t,e)=>S(t,"name",{value:e,configurable:!0});var k=Object.defineProperty,s=i((t,e)=>k(t,"name",{value:e,configurable:!0}),"i");import{existsSync as y,readFileSync as g}from"node:fs";import{join as f}from"node:path";import{t as m,withFileLockSync as x,writeFileAtomicSync as _}from"@dalcode/dal-pi-kit";import{CONFIG_DIR_NAME as E,getAgentDir as b}from"@earendil-works/pi-coding-agent";const N={pluginRank:"DAL_JEV_PLUGIN_RANK",subagentRole:"DAL_JEV_SUBAGENT_ROLE",compactDefer:"DAL_JEV_COMPACT_DEFER",guardReview:"DAL_JEV_GUARD_REVIEW"};function R(t,e,o=process.env){if(!t.enabled||!t.classifier.enabled)return!1;const n=o[N[e]]?.trim().toLowerCase();return n==="off"||n==="0"||n==="false"?!1:n==="on"||n==="1"||n==="true"?!0:t.jevAssist[e]}i(R,"J"),s(R,"jevFeatureEnabled");const l={enabled:!0,mainAutoRoute:!0,auxRoute:{subagent:!0,compaction:!0},subagentModel:"route",suggestAuto:!0,classifier:{enabled:!0,timeoutMs:2500,jev:{baseUrl:"https://api.typesafe.ai",model:"jev-latest",apiKey:""}},affinity:{margin:.15},turnAssist:{enabled:!0,tools:!0,skills:!0,thinking:!0,minConfidence:.7},jevAssist:{pluginRank:!0,subagentRole:!0,compactDefer:!1,guardReview:!0,minConfidence:.7,compactMaxDefer:3}};function d(){return f(b(),"factory.json")}i(d,"y"),s(d,"factoryConfigPath");function u(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}i(u,"s"),s(u,"isRecord");function c(t,e,o){return typeof t=="number"&&Number.isFinite(t)&&t>=e&&t<=o?t:void 0}i(c,"f"),s(c,"numberInRange");function v(t,e){const o={...t};if(typeof e.enabled=="boolean"&&(o.enabled=e.enabled),typeof e.mainAutoRoute=="boolean"&&(o.mainAutoRoute=e.mainAutoRoute),u(e.auxRoute)&&(o.auxRoute={subagent:typeof e.auxRoute.subagent=="boolean"?e.auxRoute.subagent:t.auxRoute.subagent,compaction:typeof e.auxRoute.compaction=="boolean"?e.auxRoute.compaction:t.auxRoute.compaction}),typeof e.subagentModel=="string"&&e.subagentModel.trim()&&(o.subagentModel=e.subagentModel.trim()),typeof e.suggestAuto=="boolean"&&(o.suggestAuto=e.suggestAuto),u(e.classifier)){const n=u(e.classifier.jev)?e.classifier.jev:{};o.classifier={enabled:typeof e.classifier.enabled=="boolean"?e.classifier.enabled:t.classifier.enabled,timeoutMs:c(e.classifier.timeoutMs,100,1e4)??t.classifier.timeoutMs,jev:{baseUrl:typeof n.baseUrl=="string"?n.baseUrl:t.classifier.jev.baseUrl,model:typeof n.model=="string"?n.model:t.classifier.jev.model,apiKey:typeof n.apiKey=="string"?n.apiKey:t.classifier.jev.apiKey}}}if(u(e.affinity)&&(o.affinity={margin:c(e.affinity.margin,0,.45)??t.affinity.margin}),u(e.turnAssist)){const n=e.turnAssist,a=s(r=>typeof n[r]=="boolean"?n[r]:t.turnAssist[r],"flag");o.turnAssist={enabled:a("enabled"),tools:a("tools"),skills:a("skills"),thinking:a("thinking"),minConfidence:c(n.minConfidence,.5,1)??t.turnAssist.minConfidence}}if(u(e.jevAssist)){const n=e.jevAssist,a=s(p=>typeof n[p]=="boolean"?n[p]:t.jevAssist[p],"flag"),r=c(n.compactMaxDefer,0,10);o.jevAssist={pluginRank:a("pluginRank"),subagentRole:a("subagentRole"),compactDefer:a("compactDefer"),guardReview:a("guardReview"),minConfidence:c(n.minConfidence,.7,1)??t.jevAssist.minConfidence,compactMaxDefer:r===void 0?t.jevAssist.compactMaxDefer:Math.floor(r)}}return o}i(v,"k"),s(v,"mergeConfig");function F(t,e=process.env){const o=e.DAL_FACTORY_ASSIST?.trim().toLowerCase();return o==="off"||o==="0"||o==="false"?!1:o==="on"||o==="1"||o==="true"?!0:t.turnAssist.enabled}i(F,"S"),s(F,"turnAssistEnabled");function D(){const t=d();if(!y(t))return{config:l,mainAutoRouteExplicit:!1};try{const e=JSON.parse(g(t,"utf8"));return u(e)?{config:v(l,e),mainAutoRouteExplicit:typeof e.mainAutoRoute=="boolean"}:{config:l,mainAutoRouteExplicit:!1,warning:m(`${t}: \u9876\u5C42\u4E0D\u662F JSON \u5BF9\u8C61\uFF0C\u5DF2\u4F7F\u7528\u9ED8\u8BA4\u914D\u7F6E\u3002`)}}catch(e){const o=e instanceof Error?e.message:String(e);return{config:l,mainAutoRouteExplicit:!1,warning:`${t}: ${m("JSON \u89E3\u6790\u5931\u8D25\uFF0C\u5DF2\u4F7F\u7528\u9ED8\u8BA4\u914D\u7F6E\u3002")}${o}`}}}i(D,"_"),s(D,"loadFactoryConfig");function C(t){const e=d();x(e,()=>{let o={};if(y(e)){let n;try{n=JSON.parse(g(e,"utf8"))}catch(a){const r=a instanceof Error?a.message:String(a);throw new Error(`${e}: ${m("JSON \u89E3\u6790\u5931\u8D25\uFF0C\u62D2\u7EDD\u4FEE\u6539\u4EE5\u907F\u514D\u8986\u76D6\u73B0\u6709\u914D\u7F6E\u3002")}${r}`)}if(!u(n))throw new Error(`${e}: ${m("\u9876\u5C42\u4E0D\u662F JSON \u5BF9\u8C61\uFF0C\u62D2\u7EDD\u4FEE\u6539\u3002")}`);o=n}_(e,`${JSON.stringify({...o,...t},null,2)}
|
|
2
|
+
`)})}i(C,"N"),s(C,"patchFactoryConfig");function A(t){try{const e=JSON.parse(g(t,"utf8"));return u(e)&&typeof e.defaultModel=="string"&&e.defaultModel.length>0?e.defaultModel:void 0}catch{return}}i(A,"R"),s(A,"readDefaultModel");function h(t){try{const e=JSON.parse(g(t,"utf8"));return u(e)?e:void 0}catch{return}}i(h,"E"),s(h,"readSettings");function j(t,e=process.argv){return e.some(o=>o==="--thinking"||o.startsWith("--thinking="))?!0:[f(b(),"settings.json"),f(t,E,"settings.json")].some(o=>{const n=h(o);return n?typeof n.defaultThinkingLevel=="string"?!0:u(n.modelThinkingLevels)&&Object.keys(n.modelThinkingLevels).length>0:!1})}i(j,"O"),s(j,"userPinnedThinking");function M(t,e=process.argv){return e.some(o=>o==="--model"||o==="--models"||o.startsWith("--model="))?!0:A(f(b(),"settings.json"))!==void 0||A(f(t,E,"settings.json"))!==void 0}i(M,"L"),s(M,"userPinnedModel");export{l as DEFAULT_CONFIG,d as factoryConfigPath,R as jevFeatureEnabled,D as loadFactoryConfig,C as patchFactoryConfig,F as turnAssistEnabled,M as userPinnedModel,j as userPinnedThinking};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
2
|
-
`),!
|
|
3
|
-
`);const
|
|
4
|
-
`),
|
|
1
|
+
var ee=Object.defineProperty;var g=(n,d)=>ee(n,"name",{value:d,configurable:!0});var te=Object.defineProperty,l=g((n,d)=>te(n,"name",{value:d,configurable:!0}),"l");import{t as v}from"@dalcode/dal-pi-kit";import{getSupportedThinkingLevels as se}from"@earendil-works/pi-ai";import{compact as ne}from"@earendil-works/pi-coding-agent";import{fuzzyFilter as oe}from"@earendil-works/pi-tui";import{ASSIST_THINKING_LEVELS as ie,assistMessage as ae,buildAssistQuestions as re,interpretAssist as ue,MAX_SKILL_CANDIDATES as le,planIsEmpty as ce,skillSearchApi as de,toolCatalogApi as W}from"./assist.js";import{runFactoryCommand as pe}from"./commands.js";import{decideCompactionDeferral as me}from"./compact-defer.js";import{jevFeatureEnabled as K,turnAssistEnabled as fe,userPinnedModel as ge,userPinnedThinking as ve}from"./config.js";import{jevTimeoutMs as ye,noteJevProxyFailure as Ae,resolveJevRoute as N,selectWithJev as he,warmJevRoute as Fe}from"./jev.js";import{curatePool as ke}from"./pool.js";import{autoRouteActive as w,candidates as x,candidatesStale as be,clearUnavailable as Ee,config as A,configWarning as Ce,mainAutoRouteExplicit as H,markUnavailable as De,persistMainAutoRoute as z,pickCheapestAvailable as we,reloadConfig as Se,resetThinkingAssist as Re,router as Te,setAutoRouteRuntime as G,setCandidates as xe,setThinkingAssistState as $,thinkingAssistState as S,unavailableSet as M}from"./runtime.js";import{createJevService as $e,publishJevService as Me}from"./services.js";import{autoSuggestionText as Be,isLightModel as Le,looksComplex as _e}from"./suggest.js";function U(n){const d=[];return n.groups.length>0&&d.push(`${v("\u5DE5\u5177 ")}${n.groups.join("/")}`),n.skills.length>0&&d.push(`${v("\u6280\u80FD ")}${n.skills.map(h=>h.name).join("/")}`),n.thinking&&d.push(`${v("\u601D\u8003 ")}${n.thinking}`),d.join(" \xB7 ")}g(U,"Ie"),l(U,"describeAssist");const Y="deepailab",Ie="auto";function B(n){const d=(n.modelRegistry?.getAvailable?.()??[]).filter(o=>o.provider===Y&&o.id!==Ie&&!M().has(o.id)).map(o=>({model:o,id:o.id,name:o.name,costPerMtok:o.cost&&typeof o.cost.input=="number"&&typeof o.cost.output=="number"?(o.cost.input+o.cost.output)/2:0})),h=ke(d).map(({model:o})=>o).map(o=>{const y=o.cost,b=y&&typeof y.input=="number"&&typeof y.output=="number"?(y.input+y.output)/2:0;return{id:o.id,provider:Y,contextWindow:o.contextWindow??128e3,maxTokens:o.maxTokens??8192,reasoning:!!o.reasoning,costPerMtok:b}});h.length!==0&&xe(h)}g(B,"G"),l(B,"buildCandidatesFrom");function Q(n){let d=!1,h,o=0,y=!1;const b=$e({config:A,enabled:K,credentials:l(()=>h,"credentials")});Me(b),n.on("session_start",async(t,e)=>{Se(),Ee(),h=e.modelRegistry,o=0,y=!1;const s=Ce();s&&process.stderr.write(`dal-router: ${s}
|
|
2
|
+
`),!H()&&ge(e.cwd)&&G(!1),Re(ve(e.cwd)),B(e);const i=A();i.enabled&&i.classifier.enabled&&N(i.classifier,e.modelRegistry).then(c=>c&&Fe(c))});function R(t){w()&&(H()&&A().mainAutoRoute?z(!1):G(!1),t.ui.setStatus?.("factory",void 0),t.ui.notify?.(v("\u5DF2\u5207\u6362\u5230\u4F60\u9009\u7684\u6A21\u578B\uFF0C\u4E0D\u518D\u81EA\u52A8\u8DEF\u7531\uFF08\u5728 /model \u91CC\u9009\u201C\u81EA\u52A8\u201D\u53EF\u6062\u590D\uFF09"),"info"))}g(R,"C"),l(R,"stopAutoRoute"),n.on("model_select",async(t,e)=>{d||t.source==="restore"||R(e)}),n.registerModelPickerEntry("auto",{getState:l(()=>{const t=A();if(!(!t.enabled||!t.classifier.enabled||(x()?.length??0)===0))return{label:v("\u81EA\u52A8\uFF08\u667A\u80FD\u8DEF\u7531\uFF09"),description:v("\u6BCF\u8F6E\u6309\u4EFB\u52A1\u4ECE\u6A21\u578B\u6C60\u91CC\u6311\u9009\u5408\u9002\u7684\u6A21\u578B"),current:w()}},"getState"),onSelect:l(t=>{z(!0),t.ui.notify(v("\u4E3B\u5BF9\u8BDD\u81EA\u52A8\u8DEF\u7531\u5DF2\u5F00\u542F\uFF08\u5168\u5C40\u6301\u4E45\u5316\uFF09\u3002"),"info")},"onSelect"),onModelChosen:l((t,e)=>R(e),"onModelChosen")}),n.on("before_agent_start",async(t,e)=>{if(t.messageType!=="user"||!A().enabled)return;L(t.prompt,e);const s=S();!s.pinned&&s.last!==void 0&&n.getThinkingLevel()!==s.last&&$({pinned:!0});try{return await _(t,e)}finally{S().pinned||$({last:n.getThinkingLevel()})}});function L(t,e){const s=A();if(y||!s.suggestAuto||w()||!s.classifier.enabled||(x()?.length??0)===0)return;const i=e.model?.id;!i||!Le(i)||!_e(t)||(y=!0,e.ui.notify?.(Be(i),"info"))}g(L,"I"),l(L,"maybeSuggestAuto");async function _(t,e){const s=A();let i=w();const c=fe(s);if(!i&&!c)return;const a=await N(s.classifier,e.modelRegistry);if(!a)return;let u=[];i&&(B(e),u=(be()?[]:x()??[]).filter(m=>!M().has(m.id)),u.length===0&&(i=!1));const p=c?I(t.prompt,e):void 0,F=p&&!ce(p)?re(p):{},E=Object.keys(F).length>0;if(!i&&!E)return;const V=Date.now();let C;const J=l(async m=>{try{const f=await he(t.prompt,a,ye(a,s.classifier.timeoutMs),m,F);return C=f.answers,f}catch(f){throw a.via==="deepailab"&&Ae(f),f}},"ask");let r;if(i)r=await Te().route({prompt:t.prompt,candidates:u,currentModelId:e.model?.id,margin:s.affinity.margin,select:{run:l(async(m,f)=>{const{model:O,modelError:Z}=await J(f);if(!O)throw Z??new Error("jev returned no model");return O},"run")}});else try{await J(void 0)}catch{}const X=Date.now()-V;let T=!1;if(r){if(r.modelId&&r.provider&&r.modelId!==e.model?.id){const m=e.modelRegistry?.find(r.provider,r.modelId);if(m){d=!0;let f;try{f=await n.setModel(m)}finally{d=!1}f?T=!0:(De(r.modelId),e.ui.setStatus("factory",void 0))}}T&&e.ui.setStatus?.("factory",`\u2192 ${r.modelId} \xB7 ${r.reason}`)}const q=p&&C?ue(p,C,s.turnAssist.minConfidence):void 0,k=j(q,p,e),D=U(k);if(r&&r.source!=="degraded"){const m=typeof r.confidence=="number"?` \xB7 ${v("\u7F6E\u4FE1\u5EA6 ")}${Math.round(r.confidence*100)}%`:"";e.ui.notify?.(`${r.reason}${m}${D?` \xB7 ${D}`:""}`,"info")}else D&&e.ui.notify?.(D,"info");process.env.DAL_FACTORY_TRACE==="1"&&process.stderr.write(`dal-router trace ${JSON.stringify({jevMs:X,model:r?{id:r.modelId,source:r.source,switched:T}:void 0,asked:Object.keys(F),answered:C!==void 0,groups:k.groups,skills:k.skills.map(m=>m.name),thinking:k.thinking})}
|
|
3
|
+
`);const P=ae(k.groups,k.skills);if(P)return{message:{customType:"dal-router-assist",content:[{type:"text",text:P}],display:!1}}}g(_,"Y"),l(_,"routeTurn");function I(t,e){const s=A().turnAssist,i=s.tools?W()?.inactiveGroups()??[]:[];let c=[];if(s.skills)try{c=de()?.search(t,e.cwd,le)??[]}catch{c=[]}let a=[];if(s.thinking&&e.model?.reasoning&&!S().pinned){const u=new Set(se(e.model));a=ie.filter(p=>u.has(p)),a.length<2&&(a=[])}return{groups:i,skills:c,thinkingLevels:a}}g(I,"H"),l(I,"planAssist");function j(t,e,s){const i=[],c=W();for(const u of t?.groups??[])c&&c.activate(u).length>0&&i.push(u);let a;if(e&&e.thinkingLevels.length>0&&s.model?.reasoning){const u=S(),p=n.getThinkingLevel(),F=u.base??p,E=t?.thinking??F;E!==p&&(n.setThinkingLevel(E),a=n.getThinkingLevel()),$({base:F})}return{groups:i,skills:t?.skills??[],thinking:a}}g(j,"U"),l(j,"applyAssist"),n.on("session_before_compact",async(t,e)=>{const s=A();if(K(s,"compactDefer")&&t.preparation){const a=await me({reason:t.reason,tokens:t.preparation.tokensBefore,contextWindow:e.model?.contextWindow,deferredSoFar:o,maxDefer:s.jevAssist.compactMaxDefer,entries:t.branchEntries,minConfidence:s.jevAssist.minConfidence,ask:l((u,p)=>b.ask("compactDefer",u,p,{credentials:e.modelRegistry}),"ask")});if(process.env.DAL_FACTORY_TRACE==="1"&&process.stderr.write(`dal-router trace ${JSON.stringify({compactDefer:{...a,deferredSoFar:o}})}
|
|
4
|
+
`),a.defer)return o+=1,e.ui.notify?.(`${v("\u6B63\u5904\u5728\u591A\u6B65\u64CD\u4F5C\u4E2D\uFF0C\u81EA\u52A8\u538B\u7F29\u63A8\u8FDF\u5230\u4E0B\u4E00\u8F6E")} (${o}/${s.jevAssist.compactMaxDefer})`,"info"),{cancel:!0}}if(!s.enabled||!s.auxRoute.compaction||n.getSettings().compaction?.summaryModel)return;const i=we(M()),c=t.preparation;if(!(!i||!c))try{const a=e.modelRegistry?.find(i.provider,i.id);if(!a)return;const u=e.modelRegistry?.getApiKeyAndHeaders?await e.modelRegistry.getApiKeyAndHeaders(a):void 0;return u&&!u.ok?void 0:{compaction:await ne(c,a,u?.apiKey,u?.headers,t.customInstructions,t.signal,"off")}}catch{return}}),n.on("session_compact",async()=>{o=0}),n.registerCommand("factory",{description:v("\u67E5\u770B/\u914D\u7F6E\u6A21\u578B\u5DE5\u5382\uFF08status | auto on|off | levels | pool\uFF09"),getArgumentCompletions:l(t=>oe([{value:"status",label:"status"},{value:"auto on",label:"auto on"},{value:"levels",label:"levels"},{value:"pool",label:"pool"},{value:"suggest off",label:"suggest off"}],t,e=>e.value).map(e=>({value:e.value,label:e.label})),"getArgumentCompletions"),handler:l(async(t,e)=>pe(t,e),"handler")})}g(Q,"De"),l(Q,"default");export{Q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var w=Object.defineProperty;var
|
|
1
|
+
var w=Object.defineProperty;var i=(n,e)=>w(n,"name",{value:e,configurable:!0});var y=Object.defineProperty,a=i((n,e)=>y(n,"name",{value:e,configurable:!0}),"e");import{loadFactoryConfig as c,patchFactoryConfig as B}from"./config.js";import{Router as L}from"./router.js";const l=Symbol.for("dalcode.router.runtime");function d(){const n=c();return{config:n.config,configWarning:n.warning,mainAutoRouteExplicit:n.mainAutoRouteExplicit,router:new L,candidates:void 0,unavailable:new Set,autoRouteRuntime:void 0,thinkingBase:void 0,thinkingLast:void 0,thinkingPinned:!1}}i(d,"g"),a(d,"freshState");const f=globalThis;f[l]??=d();const t=f[l];function g(){return t.config}i(g,"k"),a(g,"config");function v(){return t.configWarning}i(v,"v"),a(v,"configWarning");function u(){const{config:n,mainAutoRouteExplicit:e,warning:s}=c();t.config=n,t.configWarning=s,t.mainAutoRouteExplicit=e}i(u,"p"),a(u,"reloadConfig");function h(){return t.mainAutoRouteExplicit}i(h,"h"),a(h,"mainAutoRouteExplicit");function k(){return t.router}i(k,"A"),a(k,"router");function R(){return t.candidates}i(R,"C"),a(R,"candidates");function m(n){t.candidates=n}i(m,"S"),a(m,"setCandidates");function A(){return t.candidates===void 0}i(A,"M"),a(A,"candidatesStale");function p(n){t.unavailable.add(n)}i(p,"y"),a(p,"markUnavailable");function b(){t.unavailable.clear()}i(b,"P"),a(b,"clearUnavailable");function S(n){return t.unavailable.has(n)}i(S,"E"),a(S,"isUnavailable");function C(){return t.autoRouteRuntime??t.config.mainAutoRoute}i(C,"T"),a(C,"autoRouteActive");function P(n){t.autoRouteRuntime=n}i(P,"w"),a(P,"setAutoRouteRuntime");function x(n){B({mainAutoRoute:n}),u(),t.autoRouteRuntime=n}i(x,"L"),a(x,"persistMainAutoRoute");function E(){return t.unavailable}i(E,"W"),a(E,"unavailableSet");function U(n){const e=t.candidates?.filter(o=>!n.has(o.id))??[],s=e.filter(o=>o.costPerMtok>0);return[...s.length>0?s:e].sort((o,r)=>o.costPerMtok-r.costPerMtok||o.id.localeCompare(r.id))[0]}i(U,"B"),a(U,"pickCheapestAvailable");function M(n){t.thinkingBase=void 0,t.thinkingLast=void 0,t.thinkingPinned=n}i(M,"F"),a(M,"resetThinkingAssist");function T(){return{base:t.thinkingBase,last:t.thinkingLast,pinned:t.thinkingPinned}}i(T,"U"),a(T,"thinkingAssistState");function W(n){"base"in n&&(t.thinkingBase=n.base),"last"in n&&(t.thinkingLast=n.last),n.pinned!==void 0&&(t.thinkingPinned=n.pinned)}i(W,"I"),a(W,"setThinkingAssistState");export{C as autoRouteActive,R as candidates,A as candidatesStale,b as clearUnavailable,g as config,v as configWarning,S as isUnavailable,h as mainAutoRouteExplicit,p as markUnavailable,x as persistMainAutoRoute,U as pickCheapestAvailable,u as reloadConfig,M as resetThinkingAssist,k as router,P as setAutoRouteRuntime,m as setCandidates,W as setThinkingAssistState,T as thinkingAssistState,E as unavailableSet};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var p=Object.defineProperty;var o=(e,r)=>p(e,"name",{value:r,configurable:!0});var v=Object.defineProperty,l=o((e,r)=>v(e,"name",{value:r,configurable:!0}),"d");import{t as g}from"@dalcode/dal-pi-kit";import{applyDomesticPreference as M,jevTimeoutMs as h,noteJevProxyFailure as y,resolveJevRoute as P,selectModelWithJev as k}from"./jev.js";import{candidates as x,config as c,unavailableSet as F}from"./runtime.js";async function f(e,r={}){const i=c();if(!i.enabled||!i.auxRoute.subagent)return;const u=e.taskText?.trim();if(!u)return;const a=r.request?{...r.request,via:"direct"}:await P(i.classifier,e.credentials);if(!a)return;const n=r.pool??x()?.filter(t=>!F().has(t.id))??[];if(n.length!==0)try{const t=await k(u.slice(0,8e3),a,h(a,i.classifier.timeoutMs),n,r),d=n.find(b=>b.id===t.modelId);if(!d)return;const s=M(d.id,t.probabilities,n,i.affinity.margin);return{modelId:s.id,provider:s.provider,reason:`${g("\u6309\u5B50\u4EFB\u52A1\u5224\u578B\uFF1A")}${s.id}`}}catch(t){a.via==="deepailab"&&y(t);return}}o(f,"P"),l(f,"routeSubagentModel");function m(){const e=c().subagentModel.trim();return e===""||e==="route"?{kind:"route"}:e==="inherit"?{kind:"inherit"}:{kind:"model",spec:e}}o(m,"q"),l(m,"subagentModelPreference");export{f as routeSubagentModel,m as subagentModelPreference};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var a=Object.defineProperty;var e=(u,t)=>a(u,"name",{value:t,configurable:!0});var r=Object.defineProperty,o=e((u,t)=>r(u,"name",{value:t,configurable:!0}),"n");import{t as f}from"@dalcode/dal-pi-kit";const g=/(?:^|[-_/.:])(?:flash|mini|lite|nano|haiku|small|air|tiny|instant)(?:$|[-_/.:\d])/i;function s(u){return typeof u=="string"&&g.test(u)}e(s,"c"),o(s,"isLightModel");const A=/全部(?:都)?(?:做|完成|弄|搞|处理|修)|都(?:要)?(?:做好|做完|完成|修好|搞定)|每一(?:项|个|条)都|逐条做完|一次(?:性)?(?:做|搞)完|\ball of (?:them|it|these)\b|\beverything\b|\beach of (?:them|these)\b/i,h=/^\s*(?:\(?\d{1,2}[.、))]|[-*•]\s)/;function i(u){const t=u.trim(),n=t.split(`
|
|
2
|
+
`).filter(F=>h.test(F)).length;return n>=4||t.length>=1500?!0:A.test(t)&&(n>=2||t.length>=300)}e(i,"h"),o(i,"looksComplex");function l(u){return f("\u8FD9\u9879\u4EFB\u52A1\u8F83\u5927\uFF08\u591A\u9879\u3001\u591A\u6761\u7EBF\uFF09\uFF0C\u5F53\u524D\u56FA\u5B9A\u5728 {model} \u4E0A\u3002\u53EF\u4EE5\u5728 /model \u9009\u300C\u81EA\u52A8\u300D\uFF0C\u8BA9\u6BCF\u8F6E\u6309\u4EFB\u52A1\u6311\u6A21\u578B\uFF1B\u5B50\u4EFB\u52A1\u6A21\u578B\u53EF\u5728 factory.json \u7684 subagentModel \u8BBE\u7F6E\u3002\u4E0D\u518D\u63D0\u793A\uFF1A/factory suggest off").replace("{model}",u)}e(l,"m"),o(l,"autoSuggestionText");export{l as autoSuggestionText,s as isLightModel,i as looksComplex};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-skills",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
]
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
24
|
-
"@dalcode/deepailab": "1.0.
|
|
23
|
+
"@dalcode/dal-pi-kit": "1.0.39",
|
|
24
|
+
"@dalcode/deepailab": "1.0.39",
|
|
25
25
|
"typebox": "1.3.7"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-subagent",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
]
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
21
|
-
"@dalcode/dal-guard": "1.0.
|
|
22
|
-
"@earendil-works/pi-agent-core": "^1.0.
|
|
23
|
-
"@earendil-works/pi-ai": "^1.0.
|
|
20
|
+
"@dalcode/dal-pi-kit": "1.0.39",
|
|
21
|
+
"@dalcode/dal-guard": "1.0.39",
|
|
22
|
+
"@earendil-works/pi-agent-core": "^1.0.39",
|
|
23
|
+
"@earendil-works/pi-ai": "^1.0.39",
|
|
24
24
|
"typebox": "1.3.7"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var su=Object.defineProperty;var c=(u,t)=>su(u,"name",{value:t,configurable:!0});var iu=Object.defineProperty,
|
|
2
|
-
`).trim();if(
|
|
1
|
+
var su=Object.defineProperty;var c=(u,t)=>su(u,"name",{value:t,configurable:!0});var iu=Object.defineProperty,r=c((u,t)=>iu(u,"name",{value:t,configurable:!0}),"r");import{randomUUID as au}from"node:crypto";import{mkdirSync as Fu,readFileSync as cu,writeFileSync as lu}from"node:fs";import{join as du}from"node:path";import{t as e}from"@dalcode/dal-pi-kit";import{routeSubagentModel as Eu,subagentModelPreference as gu}from"@dalcode/dal-router/subagent";import{Type as E}from"typebox";import{formatAgentList as G,loadAgents as J,projectAgentsDir as pu,READ_ONLY_TOOL_NAMES as q,userAgentsDir as mu}from"./agents.js";import{addUsage as Au,assistantUsage as Du,currentSubagentDepth as Bu,emptyUsage as fu,endedOnAccountLimit as hu,findSubagentSessionFile as z,finishedNormally as Cu,MAX_SUBAGENT_DEPTH as $u,pruneSubagentSessions as wu,runResumableSubagent as yu,subagentSessionDir as Su}from"./process-runner.js";import{pickRoleWithJev as bu}from"./role-pick.js";export*from"./agents.js";export*from"./process-runner.js";export*from"./role-pick.js";const H=['Several separate items (modules, packages, repositories, documents, questions) that each need real work: dispatch one sub-agent per item with task, in your first response, all at once, without reading the items yourself first; there is no limit on how many ("review A, B and C" is three calls). Quick lookups you do yourself',"Sub-agents cannot see this conversation: each prompt states the goal, exact paths or inputs, constraints and what to report. Running together they share the working tree: give each different files, and let only one run installs, builds or git","Build on their reports; verify only what your answer depends on. Follow up with task resume=<the id in its result> and a prompt holding only the new instruction (resume alone continues one that failed)"],vu=E.Object({agent:E.Optional(E.String({description:e("\u8FD9\u4E00\u6B65\u7684\u89D2\u8272\u540D")})),prompt:E.String({description:e("\u8FD9\u4E00\u6B65\u7684\u4EFB\u52A1\uFF1B{previous} \u4E3A\u4E0A\u4E00\u6B65\u7684\u8F93\u51FA")})}),xu=E.Object({description:E.String({description:e("\u5B50\u4EFB\u52A1\u7684\u7B80\u77ED\u6807\u9898\uFF083-5 \u4E2A\u5B57\uFF0C\u7528\u4E8E\u5C55\u793A\u8FDB\u5EA6\uFF09")}),prompt:E.Optional(E.String({description:e("\u5B8C\u6574\u3001\u81EA\u5305\u542B\u7684\u4EFB\u52A1\u8BF4\u660E")})),resume:E.Optional(E.String({description:e("\u7EE7\u7EED\u67D0\u4E2A\u5B50 agent\uFF1A\u586B\u7ED3\u679C\u91CC\u7684\u5B50 agent ID\uFF1Bprompt \u53EA\u5199\u65B0\u6307\u793A\uFF0C\u4E0D\u586B\u5219\u4ECE\u4E2D\u65AD\u5904\u7EE7\u7EED")})),agent:E.Optional(E.String({description:e("\u89D2\u8272\u540D\uFF08\u89C1\u5DE5\u5177\u8BF4\u660E\uFF09\uFF1B\u4E0D\u586B\u4E3A\u901A\u7528\u5B50 agent")})),readOnly:E.Optional(E.Boolean({description:e("\u53EA\u7ED9\u53EA\u8BFB\u5DE5\u5177\uFF08read/grep/find/ls\uFF09")})),chain:E.Optional(E.Array(vu,{description:e("\u6309\u987A\u5E8F\u8FD0\u884C\u7684\u6B65\u9AA4\uFF1B\u4E0E prompt \u4E8C\u9009\u4E00")}))});function b(u){return`${e("[\u5B50 agent ID\uFF1A")}${u}${e("\uFF0C\u53EF\u7528 resume \u53C2\u6570\u7EE7\u7EED]")}`}c(b,"M"),r(b,"subagentIdLine");function x(){return e("\u4E0A\u4E00\u6B21\u8FD0\u884C\u4E2D\u65AD\u4E86\u3002\u8BF7\u4ECE\u4E2D\u65AD\u5904\u7EE7\u7EED\u5B8C\u6210\u539F\u6765\u7684\u4EFB\u52A1\uFF0C\u4E0D\u8981\u91CD\u590D\u5DF2\u7ECF\u5B8C\u6210\u7684\u6B65\u9AA4\uFF0C\u5B8C\u6210\u540E\u7ED9\u51FA\u6700\u7EC8\u7ED3\u679C\u3002")}c(x,"C"),r(x,"continuePrompt");const K=r((u,t)=>du(u,`${t}.meta.json`),"metaPath");function Q(u,t){const n=r(()=>new Error(`${e("\u627E\u4E0D\u5230\u5B50 agent\uFF1A")}${t}${e("\uFF08ID \u4E0D\u5B58\u5728\uFF0C\u6216\u4F1A\u8BDD\u5DF2\u8FC7\u671F\u88AB\u6E05\u7406\uFF09")}`),"missing");if(!/^[A-Za-z0-9-]+$/.test(t)||!z(u,t))throw n();try{return JSON.parse(cu(K(u,t),"utf8"))}catch{throw n()}}c(Q,"he"),r(Q,"loadSubagentMeta");function O(u){return`${e("[\u672A\u6307\u5B9A\u89D2\u8272\uFF0C\u5DF2\u81EA\u52A8\u9009\u62E9\uFF1A")}${u.agent.name}${e("\uFF0C\u7F6E\u4FE1\u5EA6 ")}${Math.round(u.confidence*100)}%]`}c(O,"ye"),r(O,"autoRoleNote");function P(u){for(let t=u.length-1;t>=0;t--){const n=u[t];if(n.role!=="assistant")continue;const o=n.content.filter(a=>a.type==="text").map(a=>a.text).join(`
|
|
2
|
+
`).trim();if(o)return o;if(n.errorMessage)return`${e("\u5B50 agent \u8FD0\u884C\u51FA\u9519\uFF1A")}${n.errorMessage}`}return e("\u5B50 agent \u6CA1\u6709\u4EA7\u751F\u4EFB\u4F55\u8F93\u51FA\u3002")}c(P,"we"),r(P,"lastAssistantText");const ku=new Set(["write","edit","multi_edit","notebook_edit"]);function R(u){for(const t of["file_path","path","filePath"]){const n=u[t];if(typeof n=="string"&&n.length>0)return n}}c(R,"U"),r(R,"filePathFromInput");function W(u,t){const n=R(t);if(n)return`${u} ${n.split("/").slice(-2).join("/")}`;const o=t??{};for(const a of["command","pattern","query"]){const i=o[a];if(typeof i=="string"&&i.trim()){const s=i.replace(/\s+/g," ").trim();return`${u} ${s.length>40?`${s.slice(0,39)}\u2026`:s}`}}return u}c(W,"$e"),r(W,"describeSubagentStep");function M(u){const t=e("\u4F60\u662F\u4E00\u4E2A\u4E13\u6CE8\u7684\u5B50 agent\uFF0C\u8D1F\u8D23\u5B8C\u6210\u7236\u4EFB\u52A1\u6D3E\u53D1\u7ED9\u4F60\u7684\u4E00\u4E2A\u72EC\u7ACB\u5B50\u4EFB\u52A1\u3002")+e("\u5B8C\u6210\u540E\u7528\u7B80\u6D01\u7684\u4E2D\u6587\u6587\u5B57\u7ED9\u51FA\u6700\u7EC8\u7ED3\u679C\uFF0C\u4E0D\u8981\u53CD\u95EE\uFF0C\u4E0D\u8981\u5F81\u6C42\u786E\u8BA4\u3002");return u?.systemPrompt?`${u.systemPrompt}
|
|
3
3
|
|
|
4
|
-
${t}`:t}c(
|
|
5
|
-
${e("\u8D26\u6237\u6216\u6A21\u578B\u901A\u9053\u4F59\u989D\u4E0D\u8DB3\uFF0C\u5DF2\u505C\u6B62\u672C\u8F6E\u5168\u90E8\u5B50 agent\u3002\u4F59\u989D\u6062\u590D\u524D\u4E0D\u8981\u518D\u6D3E\u53D1\u5B50\u4EFB\u52A1\u6216\u91CD\u8BD5\u3002")}`}c(v,"P"),
|
|
6
|
-
`));const A=[];let C=0;const B=
|
|
7
|
-
${b(F)}`:
|
|
4
|
+
${t}`:t}c(M,"be"),r(M,"buildSubagentSystemPrompt");function X(u,t,n){const o=n?` \xB7 ${n}`:"";return`${u} \u2014 ${t} ${e("\u6B65")}${o}`}c(X,"ke"),r(X,"progressLine");function k(u,t,n){const o=u.indexOf("/");if(o>0){const s=t.find(u.slice(0,o),u.slice(o+1));if(s)return s}const a=t.find(n.provider,u);if(a)return a;const i=t.getAll().filter(s=>s.id===u);if(i.length===1)return i[0];throw new Error(`${e("\u627E\u4E0D\u5230\u89D2\u8272\u6307\u5B9A\u7684\u6A21\u578B\uFF1A")}${u}`)}c(k,"L"),r(k,"resolveAgentModel");async function Y(u,t){const n=t.model;if(!n)throw new Error(e("\u6CA1\u6709\u53EF\u7528\u7684\u5F53\u524D\u6A21\u578B\uFF0C\u65E0\u6CD5\u6D3E\u53D1\u5B50 agent\u3002"));let o=n;const a=gu();if(u.agent?.model)o=k(u.agent.model,t.modelRegistry,n);else if(a.kind==="model")o=k(a.spec,t.modelRegistry,n);else if(a.kind==="route")try{const F=await Eu({taskText:u.prompt,credentials:t.modelRegistry});if(F?.modelId&&F.provider){const l=t.modelRegistry?.find(F.provider,F.modelId);l&&(o=l)}}catch{}const i=u.agent?.tools,s=u.readOnly?(i??q).filter(F=>q.includes(F)):i;return{cwd:t.cwd,model:`${o.provider}/${o.id}`,thinking:u.agent?.thinking??"off",...s?{tools:s}:{},appendSystemPrompt:M(u.agent),...u.agent?{agent:u.agent.name}:{}}}c(Y,"Ae"),r(Y,"newSubagentMeta");class Z{static{c(this,"xe")}static{r(this,"AccountLimitStop")}controller=new AbortController;tripped;get signal(){return this.controller.signal}get reason(){return this.tripped}trip(t){this.tripped===void 0&&(this.tripped=t,this.controller.abort())}reset(){this.tripped=void 0,this.controller=new AbortController}}function v(u){return`${e("\u5B50 agent \u8FD0\u884C\u51FA\u9519\uFF1A")}${u}
|
|
5
|
+
${e("\u8D26\u6237\u6216\u6A21\u578B\u901A\u9053\u4F59\u989D\u4E0D\u8DB3\uFF0C\u5DF2\u505C\u6B62\u672C\u8F6E\u5168\u90E8\u5B50 agent\u3002\u4F59\u989D\u6062\u590D\u524D\u4E0D\u8981\u518D\u6D3E\u53D1\u5B50\u4EFB\u52A1\u6216\u91CD\u8BD5\u3002")}`}c(v,"P"),r(v,"accountLimitMessage");async function j(u,t,n,o,a,i){if(i?.reason!==void 0)throw new Error(v(i.reason));const s=Su();let F,l;u.resume?(F=u.resume.trim(),l=Q(s,F)):(l=await Y(u,t),F=au(),Fu(s,{recursive:!0}),wu(s),lu(K(s,F),`${JSON.stringify(l)}
|
|
6
|
+
`));const A=[];let C=0;const B=r(d=>new Error(z(s,F)?`${d}
|
|
7
|
+
${b(F)}`:d),"failed"),D=await yu({cwd:l.cwd,prompt:u.prompt||x(),session:{dir:s,id:F},resumePrompt:x(),model:l.model,thinking:l.thinking,tools:l.tools,...a?{excludeTools:a}:{},appendSystemPrompt:l.appendSystemPrompt,projectTrusted:t.isProjectTrusted(),signal:i?t.signal?AbortSignal.any([t.signal,i.signal]):i.signal:t.signal,attribution:{sessionId:t.sessionManager.getSessionId(),subagentId:F,label:u.description},onResume:r(()=>o?.(`${u.description} \u2014 ${e("\u4E2D\u65AD\uFF0C\u6B63\u5728\u81EA\u52A8\u7EED\u8DD1")}`),"onResume"),onEvent:r(d=>{const h=Du(d);if(h&&Au(n,h),d.type!=="tool_execution_start")return;const y=String(d.toolName),g=d.args??{};if(C+=1,o?.(X(u.description,C,W(y,g))),ku.has(y)){const p=R(g);p&&A.push(p)}},"onEvent")}).catch(d=>{throw t.signal?.aborted?d:i?.reason!==void 0?B(v(i.reason)):B(`${e("\u5B50 agent \u8FD0\u884C\u51FA\u9519\uFF1A")}${d instanceof Error?d.message:String(d)}`)});if(D.idleTimedOut)throw B(e("\u5B50 agent \u8D85\u8FC7 10 \u5206\u949F\u6CA1\u6709\u4EFB\u4F55\u8FDB\u5C55\uFF0C\u5DF2\u505C\u6B62\u3002"));if(hu(D)){const d=D.messages.at(-1),h=d?.role==="assistant"&&d.errorMessage||"account limit";throw i?.trip(h),B(v(h))}const f=D.messages.at(-1),w=f?.role==="assistant"&&f.stopReason==="length";if(!w&&!Cu(D)){const d=f?.role==="assistant"&&f.errorMessage||D.stderr.trim().split(`
|
|
8
8
|
`).slice(-3).join(`
|
|
9
|
-
`)||`exit ${D.exitCode}`;throw B(`${e("\u5B50 agent \u8FD0\u884C\u51FA\u9519\uFF1A")}${
|
|
9
|
+
`)||`exit ${D.exitCode}`;throw B(`${e("\u5B50 agent \u8FD0\u884C\u51FA\u9519\uFF1A")}${d}`)}const $=P(D.messages);return{text:w?`${$}
|
|
10
10
|
|
|
11
|
-
${e("\uFF08\u5B50 agent \u7684\u56DE\u7B54\u8FBE\u5230\u4E86\u6A21\u578B\u8F93\u51FA\u957F\u5EA6\u4E0A\u9650\uFF0C\u5185\u5BB9\u4E0D\u5B8C\u6574\u3002\uFF09")}`:$,changedFiles:[...new Set(A)],subagentId:F,...
|
|
11
|
+
${e("\uFF08\u5B50 agent \u7684\u56DE\u7B54\u8FBE\u5230\u4E86\u6A21\u578B\u8F93\u51FA\u957F\u5EA6\u4E0A\u9650\uFF0C\u5185\u5BB9\u4E0D\u5B8C\u6574\u3002\uFF09")}`:$,changedFiles:[...new Set(A)],subagentId:F,...l.agent?{agent:l.agent}:{},autoResumed:D.autoResumed}}c(j,"N"),r(j,"runSubagent");function T(u){return J({cwd:u.cwd,projectTrusted:u.isProjectTrusted()})}c(T,"R"),r(T,"agentsFor");function _(u,t){if(t===void 0||t.trim()==="")return;const n=u.find(o=>o.name===t.trim());if(!n)throw new Error(`${e("\u672A\u77E5\u7684\u5B50 agent \u89D2\u8272\uFF1A")}${t}${e("\u3002\u53EF\u7528\u89D2\u8272\uFF1A")}${u.map(o=>o.name).join(", ")}`);return n}c(_,"B"),r(_,"findAgent");function L(u,t){return u.split("{previous}").join(t)}c(L,"Te"),r(L,"fillPrevious");function V(u){return e("\u6D3E\u53D1\u4E00\u4E2A\u5B50 agent \u5B8C\u6210\u81EA\u5305\u542B\u7684\u5B50\u4EFB\u52A1\uFF1B\u540C\u4E00\u8F6E\u591A\u6B21\u8C03\u7528\u5373\u5E76\u884C\u8FD0\u884C\u3002\u5B50 agent \u7528\u5F53\u524D\u6A21\u578B\u548C\u5B8C\u6574\u5DE5\u5177\uFF08\u540C\u6837\u7ECF\u8FC7\u5B89\u5168\u5BA1\u6279\uFF09\uFF0C\u770B\u4E0D\u5230\u672C\u5BF9\u8BDD\u3002")+`
|
|
12
12
|
`+e("\u89D2\u8272\uFF08agent \u53C2\u6570\uFF09\uFF1A")+`
|
|
13
13
|
`+G(u)+`
|
|
14
|
-
`+e("chain\uFF1A\u6309\u987A\u5E8F\u8FD0\u884C\u591A\u6B65\uFF08\u5982 scout \u2192 worker \u2192 reviewer\uFF09\u3002")}c(V,"
|
|
14
|
+
`+e("chain\uFF1A\u6309\u987A\u5E8F\u8FD0\u884C\u591A\u6B65\uFF08\u5982 scout \u2192 worker \u2192 reviewer\uFF09\u3002")}c(V,"Ie"),r(V,"taskToolDescription");const N=new Map,uu=r(u=>u.totalTokens>0||u.cost.total>0,"hasUsage");function U(u,t,n){u.registerTool({name:"task",label:e("\u6D3E\u53D1\u5B50\u4EFB\u52A1"),description:V(t),promptSnippet:e("task - \u6D3E\u53D1\u5B50 agent \u5E76\u884C\u5904\u7406\u72EC\u7ACB\u5B50\u4EFB\u52A1"),promptGuidelines:H,parameters:xu,executionMode:"parallel",execute:r(async(o,a,i,s,F)=>{const l=fu();try{return await tu(a,F,l,A=>{s?.({content:[{type:"text",text:A}],details:{description:a.description}})},u.getToolDenylist?.(),n)}catch(A){throw uu(l)&&N.set(o,l),A}},"execute")})}c(U,"J"),r(U,"registerTaskTool");async function tu(u,t,n,o,a,i){const{agents:s}=T(t),F=Array.isArray(u.chain)&&u.chain.length>0,l=typeof u.prompt=="string"&&u.prompt.trim()!=="",A=u.resume?.trim();if(A&&F)throw new Error(e("resume \u4E0D\u80FD\u548C chain \u4E00\u8D77\u4F7F\u7528\u3002"));if(!A&&F===l)throw new Error(e("task \u9700\u8981\u4E14\u53EA\u80FD\u63D0\u4F9B prompt \u6216 chain \u5176\u4E2D\u4E4B\u4E00\u3002"));const C=r(()=>uu(n)?{usage:n}:{},"usage");if(!F){let g=A?void 0:_(s,u.agent);const p=!A&&g===void 0?await bu(u.prompt??"",s,{credentials:t.modelRegistry}):void 0;p&&(g=p.agent);const m=await j({description:u.description,prompt:l?u.prompt??"":"",readOnly:u.readOnly===!0,agent:g,resume:A},t,n,o,a,i);return{content:[{type:"text",text:`${p?`${O(p)}
|
|
15
15
|
${m.text}`:m.text}
|
|
16
16
|
|
|
17
|
-
${b(m.subagentId)}`}],details:{description:u.description,...m.agent?{agent:m.agent}:{},subagentId:m.subagentId,...m.autoResumed?{autoResumed:!0}:{},...C(),...p?{autoAgent:{name:p.agent.name,confidence:p.confidence}}:{},...m.changedFiles.length>0?{changedFiles:m.changedFiles}:{}},...C()}}const B=u.chain??[],D=B.map(g=>_(
|
|
17
|
+
${b(m.subagentId)}`}],details:{description:u.description,...m.agent?{agent:m.agent}:{},subagentId:m.subagentId,...m.autoResumed?{autoResumed:!0}:{},...C(),...p?{autoAgent:{name:p.agent.name,confidence:p.confidence}}:{},...m.changedFiles.length>0?{changedFiles:m.changedFiles}:{}},...C()}}const B=u.chain??[],D=B.map(g=>_(s,g.agent??u.agent));let f="";const w=[],$=[];let d=!1;for(const[g,p]of B.entries()){const m=D[g],nu=`${u.description} [${g+1}/${B.length}${m?` ${m.name}`:""}]`;try{const{text:S,changedFiles:I,subagentId:ou,autoResumed:ru}=await j({description:nu,prompt:L(p.prompt,f),readOnly:u.readOnly===!0,agent:m},t,n,o,a,i);f=S,w.push(...I),$.push(ou),d||=ru}catch(S){const I=S instanceof Error?S.message:String(S);throw new Error(`${e("\u4E32\u884C\u94FE\u5728\u7B2C")} ${g+1} ${e("\u6B65\u4E2D\u65AD\uFF1A")}${I}`)}}const h=[...new Set(w)],y=$[$.length-1]??"";return{content:[{type:"text",text:`${f}
|
|
18
18
|
|
|
19
|
-
${b(y)}`}],details:{description:u.description,subagentId:y,...
|
|
20
|
-
`),i.length>0?"warning":"info")},"handler")})}c(eu,"
|
|
19
|
+
${b(y)}`}],details:{description:u.description,subagentId:y,...d?{autoResumed:!0}:{},...C(),chain:D.map((g,p)=>({...g?{agent:g.name}:{},subagentId:$[p]})),...h.length>0?{changedFiles:h}:{}},...C()}}c(tu,"Me"),r(tu,"executeTask");function eu(u){if(Bu()>=$u)return;const t=new Z;U(u,J({cwd:process.cwd(),projectTrusted:!1}).agents,t),u.on("session_start",async(n,o)=>{U(u,T(o).agents,t)}),u.on("agent_start",()=>{t.reset()}),u.on("tool_result",n=>{const o=n.toolName==="task"&&n.isError?N.get(n.toolCallId):void 0;if(N.delete(n.toolCallId),!o)return;const a=n.input.description??"";return{usage:o,details:{description:a,usage:o}}}),u.registerCommand("agents",{description:e("\u5217\u51FA\u53EF\u7528\u7684\u5B50 agent \u89D2\u8272\u53CA\u5176\u6765\u6E90"),handler:r(async(n,o)=>{const{agents:a,diagnostics:i}=T(o),s=[e("\u53EF\u7528\u7684\u5B50 agent \u89D2\u8272\uFF1A"),G(a,!0),"",`${e("\u7528\u6237\u89D2\u8272\u76EE\u5F55\uFF1A")}${mu()}`,`${e("\u9879\u76EE\u89D2\u8272\u76EE\u5F55\uFF1A")}${pu(o.cwd)}${o.isProjectTrusted()?"":e("\uFF08\u9879\u76EE\u672A\u4FE1\u4EFB\uFF0C\u672A\u8BFB\u53D6\uFF09")}`];i.length>0&&s.push("",e("\u4EE5\u4E0B\u89D2\u8272\u6587\u4EF6\u6709\u95EE\u9898\uFF1A"),...i.map(F=>`- ${F}`)),o.ui.notify(s.join(`
|
|
20
|
+
`),i.length>0?"warning":"info")},"handler")})}c(eu,"Pe"),r(eu,"default");export{Z as AccountLimitStop,H as TASK_TOOL_GUIDELINES,v as accountLimitMessage,O as autoRoleNote,M as buildSubagentSystemPrompt,x as continuePrompt,eu as default,L as fillPrevious,P as lastAssistantText,k as resolveAgentModel,b as subagentIdLine};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-telemetry",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
]
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
23
|
+
"@dalcode/dal-pi-kit": "1.0.39"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"@earendil-works/pi-coding-agent": "^1.0.9"
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
`,{mode:384}),
|
|
1
|
+
var T=Object.defineProperty;var a=(t,e)=>T(t,"name",{value:e,configurable:!0});var p=Object.defineProperty,i=a((t,e)=>p(t,"name",{value:e,configurable:!0}),"i");import{randomUUID as l}from"node:crypto";import{existsSync as A,mkdirSync as E,readFileSync as I,renameSync as S,writeFileSync as b}from"node:fs";import{join as h}from"node:path";import{DEFAULT_ENDPOINT as D}from"./reporter.js";function u(t=process.env){const e=t.DAL_TELEMETRY_ENDPOINT??D;return e.length>0?e:void 0}a(u,"g"),i(u,"resolveEndpoint");function y(t){return!!(t.CI||t.GITHUB_ACTIONS||t.GITLAB_CI||t.BUILDKITE||t.JENKINS_URL)}a(y,"A"),i(y,"isCi");function s(t){return h(t,"telemetry.json")}a(s,"a"),i(s,"telemetryPath");function f(t){try{const e=JSON.parse(I(t,"utf8"));return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0}catch{return}}a(f,"d"),i(f,"readRaw");function c(t){const e=f(t);if(!(!e||typeof e.anonymousId!="string"||typeof e.enabled!="boolean"))return{enabled:e.enabled,anonymousId:e.anonymousId,notifiedAt:typeof e.notifiedAt=="string"?e.notifiedAt:void 0}}a(c,"u"),i(c,"readState");function d(t,e){try{E(t,{recursive:!0});const o=s(t),r=`${o}.${process.pid}.tmp`,n={...f(o),...e};return e.notifiedAt===void 0&&delete n.notifiedAt,b(r,`${JSON.stringify(n,null," ")}
|
|
2
|
+
`,{mode:384}),S(r,o),!0}catch{return!1}}a(d,"s"),i(d,"writeState");function m(t,e=process.env){const o=s(t),r=c(o),n=r??{enabled:!0,anonymousId:l()};return!r&&A(o)?{state:{...n,enabled:!1},active:!1,shouldNotify:!1,reason:"unreadable"}:r&&!r.enabled?{state:n,active:!1,shouldNotify:!1,reason:"opted-out"}:e.DO_NOT_TRACK==="1"||e.DO_NOT_TRACK==="true"?{state:n,active:!1,shouldNotify:!1,reason:"do-not-track"}:e.DAL_TELEMETRY==="0"||e.DAL_TELEMETRY==="off"?{state:n,active:!1,shouldNotify:!1,reason:"env"}:y(e)?{state:n,active:!1,shouldNotify:!1,reason:"ci"}:u(e)?!r&&!d(t,n)?{state:n,active:!1,shouldNotify:!1,reason:"unreadable"}:n.notifiedAt?{state:n,active:!0,shouldNotify:!1}:{state:n,active:!0,shouldNotify:!0}:{state:n,active:!1,shouldNotify:!1,reason:"unconfigured"}}a(m,"_"),i(m,"resolveTelemetry");function v(t,e){const o={...e,notifiedAt:new Date().toISOString()};return d(t,o),o}a(v,"v"),i(v,"markNotified");function N(t,e){const o=c(s(t))??{enabled:e,anonymousId:l()},r={...o,enabled:e,notifiedAt:o.notifiedAt??new Date().toISOString()};return d(t,r),r}a(N,"D"),i(N,"setTelemetryEnabled");export{v as markNotified,u as resolveEndpoint,m as resolveTelemetry,N as setTelemetryEnabled,s as telemetryPath,d as writeState};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-terminal",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Host terminal context: a terminal_read tool and @terminal mentions, registered only when the embedding host advertises the terminal capability.",
|
|
6
6
|
"type": "module",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
]
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
22
|
+
"@dalcode/dal-pi-kit": "1.0.39",
|
|
23
23
|
"typebox": "1.3.7"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-tool-catalog",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
]
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
21
|
+
"@dalcode/dal-pi-kit": "1.0.39",
|
|
22
22
|
"typebox": "1.3.7"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-web",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
]
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
27
|
-
"@dalcode/deepailab": "1.0.
|
|
26
|
+
"@dalcode/dal-pi-kit": "1.0.39",
|
|
27
|
+
"@dalcode/deepailab": "1.0.39",
|
|
28
28
|
"typebox": "1.3.27"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-workflow",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
]
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
20
|
+
"@dalcode/dal-pi-kit": "1.0.39",
|
|
21
21
|
"typebox": "1.3.27"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var l=Object.defineProperty;var n=(u,e)=>l(u,"name",{value:e,configurable:!0});var B=Object.defineProperty,o=n((u,e)=>B(u,"name",{value:e,configurable:!0}),"o");import{t as m}from"@dalcode/dal-pi-kit";import{assistantText as p,fill as A,isAssistantMessage as f}from"./shared.js";import{formatTodo as D}from"./todo.js";const c="dal-completion-check",d=new RegExp(["(?:\u5168\u90E8|\u90FD|\u5747|\u7EDF\u7EDF|\u6240\u6709(?:\u7684)?[^\u3002\\n]{0,12}?)(?:\u5DF2\u7ECF?|\u5DF2)?(?:\u5B8C\u6210|\u505A\u5B8C|\u505A\u597D|\u641E\u5B9A|\u5BA1\u67E5\u5B8C|\u5BA1\u5B8C|\u5904\u7406\u5B8C|\u4FEE\u5B8C|\u6539\u5B8C|\u5F04\u597D|\u7ED3\u675F)","\u5DF2(?:\u5168\u90E8|\u7ECF\u5168\u90E8)(?:\u5B8C\u6210|\u505A\u5B8C|\u5904\u7406|\u4FEE\u590D)","\\ball (?:\\w+ )?(?:done|complete|completed|finished|fixed|reviewed)\\b","\\beverything (?:is |has been )?(?:done|complete|finished)\\b","\\bfully (?:done|complete|completed|reviewed)\\b"].join("|"),"i");function i(u){return d.test(u)}n(i,"m"),o(i,"claimsAllDone");function F(u){return u.filter(e=>e.status!=="done")}n(F,"g"),o(F,"openTodos");function E(u){return A(m(`[\u5B8C\u6210\u6838\u5BF9] \u4F60\u521A\u624D\u8BF4\u5168\u90E8\u5B8C\u6210\uFF0C\u4F46\u5F85\u529E\u91CC\u8FD8\u6709 {count} \u9879\u6CA1\u6709\u6807\u4E3A\u5B8C\u6210\uFF1A
|
|
2
|
+
{items}
|
|
3
|
+
\u4E0D\u8981\u8BF4\u5168\u90E8\u5B8C\u6210\u3002\u9010\u9879\u5BF9\u7167\u7528\u6237\u8981\u6C42\u7684\u6BCF\u4E00\u9879\uFF1A\u5DF2\u5B8C\u6210\u7684\u5199\u51FA\u8BC1\u636E\uFF08\u547D\u4EE4\u8F93\u51FA\u3001\u6D4B\u8BD5\u3001\u6587\u4EF6\uFF09\uFF0C\u6CA1\u505A\u7684\u5199\u201C\u672A\u505A\u201D\uFF0C\u53EA\u505A\u4E86\u4E00\u90E8\u5206\u7684\u5199\u201C\u90E8\u5206\u5B8C\u6210\u201D\u5E76\u8BF4\u660E\u5DEE\u4EC0\u4E48\uFF1B\u7136\u540E\u7528 todo \u628A\u72B6\u6001\u6539\u5BF9\u3002`),{count:u.length,items:u.map(D).join(`
|
|
4
|
+
`)})}n(E,"x"),o(E,"completionCheckText");function a(u){for(let e=u.length-1;e>=0;e--){const t=u[e];if(f(t))return p(t);if(t.role==="user")return""}return""}n(a,"y"),o(a,"lastAssistantText");function C(u,e){let t=!1;u.on("agent_start",async()=>{t=!1}),u.on("agent_before_settle",async s=>{if(t||s.outcome!=="completed"||s.context.pendingMessages.length>0)return;const r=F(e());if(r.length!==0&&i(a(s.context.contextMessages)))return t=!0,{entries:[{type:"custom_message",customType:c,content:E(r),display:!1}],continue:!0}})}n(C,"E"),o(C,"registerCompletionCheck");export{c as COMPLETION_CHECK_MESSAGE,i as claimsAllDone,E as completionCheckText,F as openTodos,C as registerCompletionCheck};
|