dal-code 1.0.42 → 1.0.44
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 +16 -0
- package/dist/core/agent-session.js +9 -9
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/types.d.ts +19 -0
- package/dist/core/permissions/tool-policy.d.ts +2 -1
- package/dist/core/permissions/tool-policy.js +1 -1
- package/dist/core/sandbox/shell-sandbox.js +7 -5
- package/dist/core/tool-denial.d.ts +13 -0
- package/dist/core/tool-denial.js +1 -0
- package/dist/core/tools/bash.d.ts +1 -0
- package/dist/core/tools/bash.js +14 -14
- package/dist/core/tools/index.d.ts +1 -1
- package/dist/core/tools/index.js +1 -1
- package/dist/dal/manifest.js +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/main.js +3 -3
- package/dist/modes/rpc/approvals.js +1 -0
- package/dist/modes/rpc/message-meta.js +1 -0
- package/dist/modes/rpc/rpc-client.d.ts +15 -1
- package/dist/modes/rpc/rpc-client.js +3 -3
- package/dist/modes/rpc/rpc-mode.js +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +55 -1
- 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-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/index.js +2 -1
- package/dist/node_modules/@dalcode/dal-guard/src/workspace.js +2 -2
- 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 +3 -3
- package/dist/node_modules/@dalcode/dal-mcp/package.json +5 -5
- package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +2 -2
- package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +1 -1
- 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/LICENSE +21 -0
- package/dist/node_modules/@dalcode/dal-remote/package.json +32 -0
- package/dist/node_modules/@dalcode/dal-remote/src/cli.js +15 -0
- package/dist/node_modules/@dalcode/dal-remote/src/index.js +1 -0
- package/dist/node_modules/@dalcode/dal-remote/src/install.js +8 -0
- package/dist/node_modules/@dalcode/dal-remote/src/paths.js +1 -0
- package/dist/node_modules/@dalcode/dal-remote/src/processes.js +2 -0
- package/dist/node_modules/@dalcode/dal-remote/src/service.js +8 -0
- package/dist/node_modules/@dalcode/dal-remote/src/spec.js +1 -0
- 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 +4 -4
- 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-subagent/src/background.js +8 -8
- package/dist/node_modules/@dalcode/dal-subagent/src/index.js +20 -20
- package/dist/node_modules/@dalcode/dal-subagent/src/progress.js +1 -0
- package/dist/node_modules/@dalcode/dal-telemetry/package.json +3 -3
- 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/chord/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +1 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +1 -0
- 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/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/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/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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-plugins",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.44",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
]
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
25
|
-
"@dalcode/dal-skills": "1.0.
|
|
26
|
-
"@dalcode/deepailab": "1.0.
|
|
24
|
+
"@dalcode/dal-pi-kit": "1.0.44",
|
|
25
|
+
"@dalcode/dal-skills": "1.0.44",
|
|
26
|
+
"@dalcode/deepailab": "1.0.44",
|
|
27
27
|
"typebox": "1.3.27"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-recall",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.44",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Search past sessions: a local full-text index of earlier conversations the model can query with session_search. Adapted from @henryqw/pi-session-recall 5.1.4 (MIT).",
|
|
6
6
|
"license": "MIT",
|
|
@@ -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.44",
|
|
24
24
|
"typebox": "1.3.27"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Mario Zechner
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dalcode/dal-remote",
|
|
3
|
+
"version": "1.0.44",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "`dal remote enable|disable|status|pair|logs`: installs the phone daemon (a pinned, integrity-checked npm package) and runs it as a systemd user service or a launchd agent, so the DAL Code phone app can reach this machine.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./src/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./src/index.js",
|
|
10
|
+
"./cli": "./src/cli.js",
|
|
11
|
+
"./package.json": "./package.json"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"src"
|
|
15
|
+
],
|
|
16
|
+
"pi": {
|
|
17
|
+
"extensions": [
|
|
18
|
+
"./src/index.js"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@dalcode/dal-pi-kit": "1.0.44"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"@earendil-works/pi-coding-agent": "^1.0.9"
|
|
26
|
+
},
|
|
27
|
+
"peerDependenciesMeta": {
|
|
28
|
+
"@earendil-works/pi-coding-agent": {
|
|
29
|
+
"optional": false
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var Fu=Object.defineProperty;var o=(u,e)=>Fu(u,"name",{value:e,configurable:!0});var lu=Object.defineProperty,s=o((u,e)=>lu(u,"name",{value:e,configurable:!0}),"o");import{chmodSync as cu,existsSync as A,mkdirSync as v,readFileSync as y,rmSync as du,writeFileSync as w}from"node:fs";import{homedir as pu,userInfo as Du}from"node:os";import{dirname as Au}from"node:path";import{t}from"@dalcode/dal-pi-kit";import{daemonBinPath as L,installDaemon as mu,installedDaemonDir as J,runCommand as fu}from"./install.js";import{remotePaths as m}from"./paths.js";import{daemonProcesses as Eu,leftoverProcesses as Bu,listProcesses as W,processTree as G,reapProcesses as gu}from"./processes.js";import{forgetService as Cu,serviceDir as hu,serviceFileContent as vu,serviceFilePath as yu,serviceKind as b,servicePid as K,serviceRestarts as U,serviceState as q,startService as wu,stopService as bu}from"./service.js";import{daemonPairArgs as Su,daemonRunArgs as $u,ENV_ACCOUNT_TOKEN_FILE as ku,resolveDaemonSpec as S}from"./spec.js";const H="DAL_CODING_AGENT_DIR";function f(u){try{return JSON.parse(y(u.stateFile,"utf8"))}catch{return}}o(f,"D"),s(f,"readState");function $(u,e){v(u.root,{recursive:!0}),w(u.stateFile,`${JSON.stringify(e,null,2)}
|
|
2
|
+
`)}o($,"L"),s($,"writeState");function k(u){return`'${u.replace(/'/g,"'\\''")}'`}o(k,"T"),s(k,"shellQuote");function P(u,e,r){const n={DAL_COMMAND:u.dalWrapper,[ku]:u.accountTokenFile,HOME:r.home,PATH:[Au(r.nodePath),"/usr/local/bin","/usr/bin","/bin"].join(":")},a=r.env[H]?.trim();return a&&(n[H]=a),{program:r.nodePath,args:[e,...$u(u.home)],env:n,workingDirectory:r.home,logFile:u.logFile}}o(P,"de"),s(P,"launchSpecFor");function E(u,e){return{kind:u,file:yu(u,e.home,e.env),run:e.run,uid:e.uid,user:e.user,sleep:B(e),now:g(e)}}o(E,"y"),s(E,"serviceContext");function B(u){return u.sleep??(e=>new Promise(r=>setTimeout(r,e)))}o(B,"w"),s(B,"sleeper");function g(u){return u.now??Date.now}o(g,"k"),s(g,"clock");function N(u){return u.err(t("dal remote \u76EE\u524D\u53EA\u652F\u6301 Linux\uFF08systemd\uFF09\u548C macOS\u3002")),1}o(N,"M"),s(N,"unsupported");function R(u){return u.out([t("\u7528\u6CD5\uFF1Adal remote <\u547D\u4EE4>"),"",t(" enable \u5B89\u88C5\u5E76\u542F\u52A8\u624B\u673A\u7AEF\u5B88\u62A4\u8FDB\u7A0B\uFF0C\u663E\u793A\u914D\u5BF9\u4FE1\u606F"),t(" disable \u505C\u6B62\u5E76\u79FB\u9664\u624B\u673A\u7AEF\u5B88\u62A4\u8FDB\u7A0B\u7684\u670D\u52A1\uFF08\u4FDD\u7559\u914D\u5BF9\u4FE1\u606F\uFF09"),t(" status \u67E5\u770B\u662F\u5426\u5F00\u542F\u3001\u662F\u5426\u5728\u8FD0\u884C\uFF08--json \u8F93\u51FA\u673A\u5668\u53EF\u8BFB\u7ED3\u679C\uFF09"),t(" pair \u518D\u6B21\u663E\u793A\u914D\u5BF9\u4FE1\u606F"),t(" logs \u67E5\u770B\u5B88\u62A4\u8FDB\u7A0B\u65E5\u5FD7\uFF08-n \u884C\u6570\uFF0C\u9ED8\u8BA4 50\uFF09"),"",t("\u9ED8\u8BA4\u4E0D\u5F00\u542F\uFF1B\u53EA\u6709\u8FD0\u884C dal remote enable \u540E\u624D\u4F1A\u5B89\u88C5\u548C\u542F\u52A8\u3002")].join(`
|
|
3
|
+
`)),0}o(R,"j"),s(R,"help");async function O(u,e,r){const n=await r.run(r.nodePath,[u,...Su(e.home)],{env:r.env}),a=(n.stderr.trim()||n.stdout.trim()).split(`
|
|
4
|
+
`).slice(-3).join(`
|
|
5
|
+
`);if(n.code!==0)return{detail:a};try{const i=JSON.parse(n.stdout);return i.url?{offer:i,detail:a}:{detail:a}}catch{return{detail:a}}}o(O,"K"),s(O,"fetchPairingResult");async function Q(u,e,r){return(await O(u,e,r)).offer}o(Q,"pe"),s(Q,"fetchPairing");function V(u,e=8){try{return y(u.logFile,"utf8").split(`
|
|
6
|
+
`).filter(r=>r.trim()!=="").slice(-e).map(r=>` ${r.length>300?`${r.slice(0,300)}\u2026`:r}`).join(`
|
|
7
|
+
`)}catch{return""}}o(V,"he"),s(V,"logTail");const X=5e3,Pu=1e4,Nu=3;async function z(u,e,r,n){const a=B(n),i=g(n),F=i(),c=F+(n.pairWaitMs??12e4);let l=F+X,d,p="";const iu=await U(r);for(n.out(t("\u6B63\u5728\u7B49\u5F85\u5B88\u62A4\u8FDB\u7A0B\u5C31\u7EEA\u2026"));;){const h=await O(u,e,n);if(h.offer)return j(h.offer,n),0;p=h.detail||p;const{state:x}=await q(r),D=i();if(x==="stopped"||x==="failed"?d??=D:d=void 0,await U(r)-iu>=Nu||d!==void 0&&D-d>=Pu){n.err(t("\u5B88\u62A4\u8FDB\u7A0B\u6CA1\u80FD\u542F\u52A8\uFF08\u5DF2\u9000\u51FA\u6216\u53CD\u590D\u5D29\u6E83\uFF09\u3002\u65E5\u5FD7\u6700\u540E\u51E0\u884C\uFF1A"));const ou=V(e);return n.err(ou||` ${p||t("\uFF08\u6CA1\u6709\u65E5\u5FD7\uFF09")}`),n.err(t("\u4FEE\u597D\u540E\u518D\u8FD0\u884C dal remote enable\uFF1B\u5B8C\u6574\u65E5\u5FD7\uFF1Adal remote logs")),1}if(D>=c)break;D>=l&&(n.out(t("\u4ECD\u5728\u7B49\u5F85\u5B88\u62A4\u8FDB\u7A0B\u5C31\u7EEA\uFF08\u5DF2 {s} \u79D2\uFF09\u2026").replace("{s}",String(Math.round((D-F)/1e3)))),l=D+X),await a(500)}return n.err(t("\u5B88\u62A4\u8FDB\u7A0B {s} \u79D2\u5185\u6CA1\u6709\u5C31\u7EEA\uFF0C\u670D\u52A1\u4ECD\u5728\u8FD0\u884C\u3002\u7A0D\u540E\u8FD0\u884C dal remote pair\uFF0C\u6216\u7528 dal remote logs \u67E5\u770B\u65E5\u5FD7\u3002").replace("{s}",String(Math.round((c-F)/1e3)))),p&&n.err(` ${p}`),1}o(z,"Re"),s(z,"waitForPairing");function j(u,e){e.out(t("\u5728\u624B\u673A\u4E0A\u6253\u5F00 DAL Code\uFF0C\u626B\u63CF\u4E0B\u9762\u7684\u4E8C\u7EF4\u7801\uFF0C\u6216\u6253\u5F00\u914D\u5BF9\u94FE\u63A5\uFF1A")),u.qr&&e.out(u.qr),u.url&&e.out(u.url)}o(j,"W"),s(j,"printPairing");function Y(u,e){const r=J(u,e);return r?L(r,e):void 0}o(Y,"Se"),s(Y,"installedBin");async function Z(u){const e=b(u.platform);if(!e)return N(u);const r=m(u.agentDir);let n;try{n=S(u.env)}catch(l){return u.err(l instanceof Error?l.message:String(l)),1}let a;try{a=await mu(r,n,{fetch:u.fetch,run:u.run,env:u.env,npm:u.npm,progress:s(l=>u.out(l),"progress")})}catch(l){return u.err(l instanceof Error?l.message:String(l)),1}const i=L(a,n);if(!i)return u.err(t("{pkg} \u91CC\u6CA1\u6709\u547D\u4EE4 {bin}\uFF0C\u65E0\u6CD5\u542F\u52A8\u3002").replace("{pkg}",n.packageName).replace("{bin}",n.bin)),1;for(const l of[r.home,r.logDir,r.binDir])v(l,{recursive:!0,mode:448});w(r.dalWrapper,`#!/bin/sh
|
|
8
|
+
exec ${k(u.nodePath)} ${k(u.dalEntry)} "$@"
|
|
9
|
+
`),cu(r.dalWrapper,493);const F=E(e,u);v(hu(F.file),{recursive:!0}),w(F.file,vu(e,P(r,i,u)));let c;try{c=await wu(F)}catch(l){return u.err(`${t("\u670D\u52A1\u6CA1\u80FD\u542F\u52A8\uFF1A")}${l instanceof Error?l.message:String(l)}`),e==="systemd"&&u.err(t("\u5982\u679C\u662F\u901A\u8FC7 ssh \u767B\u5F55\u7684\u670D\u52A1\u5668\uFF0C\u786E\u8BA4\u6709\u7528\u6237\u4F1A\u8BDD\uFF08XDG_RUNTIME_DIR\uFF09\uFF0C\u6216\u5148\u8FD0\u884C loginctl enable-linger\u3002")),1}return $(r,{packageName:n.packageName,version:n.version,...n.integrity?{integrity:n.integrity}:{},enabled:!0,kind:e,serviceFile:F.file,enabledAt:new Date().toISOString()}),u.out(t("\u624B\u673A\u7AEF\u8FDC\u7A0B\u5DF2\u5F00\u542F\uFF08{pkg}\uFF09\u3002").replace("{pkg}",`${n.packageName}@${n.version}`)),c.includes("linger-enabled")&&u.out(t("\u5DF2\u5F00\u542F lingering\uFF1A\u6CE8\u9500\u540E\u3001\u91CD\u542F\u540E\u5B88\u62A4\u8FDB\u7A0B\u4E5F\u4F1A\u8FD0\u884C\u3002")),c.includes("linger-failed")&&u.out(t("\u6CA1\u80FD\u5F00\u542F lingering\uFF1A\u6CE8\u9500\u540E\u5B88\u62A4\u8FDB\u7A0B\u4F1A\u505C\u6B62\u3002\u53EF\u8BF7\u7BA1\u7406\u5458\u8FD0\u884C sudo loginctl enable-linger {user}\u3002").replace("{user}",u.user)),z(i,r,F,u)}o(Z,"Pe"),s(Z,"enable");async function M(u,e,r){const n=await W(r.run),a=await K(e),i=new Map;if(a)for(const F of G(n,a))i.set(F.pid,F);for(const F of Eu(n,u.daemonRoot,r.pid??process.pid))for(const c of G(n,F.pid))i.set(c.pid,c);return[...i.values()]}o(M,"G"),s(M,"daemonProcessesNow");function I(u,e,r=1e4){return gu(u,{run:e.run,kill:e.kill??((n,a)=>process.kill(n,a)),sleep:B(e),now:g(e)},{graceMs:r,termMs:5e3})}o(I,"B"),s(I,"reap");function T(u,e){return u.killed.length>0&&(e.out(t("\u6709 {n} \u4E2A\u5B88\u62A4\u8FDB\u7A0B\u7684\u8FDB\u7A0B\u6CA1\u6709\u6309\u65F6\u9000\u51FA\uFF0C\u5DF2\u5F3A\u5236\u7ED3\u675F\uFF1A").replace("{n}",String(u.killed.length))),e.out(C(u.killed))),u.remaining.length>0?(e.err(t("\u8FD9\u4E9B\u8FDB\u7A0B\u4ECD\u5728\u8FD0\u884C\uFF0C\u8BF7\u624B\u52A8\u7ED3\u675F\uFF1A")),e.err(C(u.remaining)),!1):!0}o(T,"U"),s(T,"reportReaped");function C(u){return u.map(e=>` pid ${e.pid}: ${e.command.length>160?`${e.command.slice(0,160)}\u2026`:e.command}`).join(`
|
|
10
|
+
`)}o(C,"$"),s(C,"describeProcesses");async function uu(u){const e=b(u.platform);if(!e)return N(u);const r=m(u.agentDir),n=E(e,u),a=f(r);if(!A(n.file)&&!a?.enabled){const F=A(r.daemonRoot)?await M(r,n,u):[];return F.length===0?(u.out(t("\u624B\u673A\u7AEF\u8FDC\u7A0B\u672C\u6765\u5C31\u6CA1\u6709\u5F00\u542F\u3002")),0):T(await I(F,u,0),u)?0:1}const i=await M(r,n,u);return await bu(n),du(n.file,{force:!0}),await Cu(n),a&&$(r,{...a,enabled:!1,disabledAt:new Date().toISOString()}),T(await I(i,u),u)?(u.out(t("\u624B\u673A\u7AEF\u8FDC\u7A0B\u5DF2\u5173\u95ED\u3002\u5B88\u62A4\u8FDB\u7A0B\u548C\u914D\u5BF9\u4FE1\u606F\u4ECD\u4FDD\u7559\u5728 {dir}\uFF0C\u518D\u6B21\u5F00\u542F\u65E0\u9700\u91CD\u65B0\u914D\u5BF9\u3002").replace("{dir}",r.root)),0):1}o(uu,"De"),s(uu,"disable");async function _(u){const e=m(u.agentDir),r=f(e);let n;try{n=S(u.env)}catch{n=void 0}const a=b(u.platform);let i=null;if(a){const c=E(a,u),l=A(c.file),d=l?await q(c):{state:"not-installed"};if(d.state==="running"&&d.pid===void 0&&a==="systemd"){const p=await K(c);p&&(d.pid=p)}i={kind:a,file:c.file,installed:l,...d}}const F=A(e.daemonRoot)?Bu(await W(u.run),e.daemonRoot,u.pid??process.pid,i?.state==="running"&&i.pid?i.pid:void 0).map(({pid:c,command:l})=>({pid:c,command:l})):[];return{enabled:!!(r?.enabled&&i?.installed),installed:n?J(e,n)!==void 0:!1,packageName:r?.packageName??n?.packageName??"",version:r?.version??n?.version??"",service:i,leftovers:F,home:e.home,logFile:e.logFile}}o(_,"ye"),s(_,"remoteStatus");function eu(u){switch(u){case"running":return t("\u8FD0\u884C\u4E2D");case"stopped":return t("\u5DF2\u505C\u6B62");case"failed":return t("\u51FA\u9519\u505C\u6B62\uFF08\u7528 dal remote logs \u67E5\u770B\u539F\u56E0\uFF09");case"not-installed":return t("\u672A\u5B89\u88C5");default:return t("\u672A\u77E5")}}o(eu,"we"),s(eu,"stateLabel");async function ru(u,e){const r=await _(e);if(u.includes("--json"))return e.out(JSON.stringify(r,null,2)),0;const n=[`${t("\u624B\u673A\u7AEF\u8FDC\u7A0B\uFF1A")}${r.enabled?t("\u5DF2\u5F00\u542F"):t("\u672A\u5F00\u542F")}`,`${t("\u5B88\u62A4\u8FDB\u7A0B\uFF1A")}${r.packageName}@${r.version}\uFF08${r.installed?t("\u5DF2\u5B89\u88C5"):t("\u672A\u5B89\u88C5")}\uFF09`];return r.service?(n.push(`${t("\u670D\u52A1\uFF1A")}${r.service.kind==="systemd"?"systemd --user":"launchd"} \u2014 ${eu(r.service.state)}${r.service.pid?` (pid ${r.service.pid})`:""}`),r.service.installed&&n.push(`${t("\u670D\u52A1\u6587\u4EF6\uFF1A")}${r.service.file}`)):n.push(t("dal remote \u76EE\u524D\u53EA\u652F\u6301 Linux\uFF08systemd\uFF09\u548C macOS\u3002")),r.leftovers.length>0&&(n.push(t("\u6B8B\u7559\u8FDB\u7A0B\uFF08\u4E0D\u5C5E\u4E8E\u6B63\u5728\u8FD0\u884C\u7684\u670D\u52A1\uFF09\uFF1A")),n.push(C(r.leftovers)),n.push(t("\u8FD0\u884C dal remote disable \u4F1A\u7ED3\u675F\u5B83\u4EEC\u3002"))),n.push(`${t("\u65E5\u5FD7\uFF1A")}${r.logFile}`),r.enabled||n.push(t("\u5F00\u542F\uFF1Adal remote enable")),e.out(n.join(`
|
|
11
|
+
`)),0}o(ru,"ke"),s(ru,"status");async function nu(u,e){const r=m(e.agentDir);let n;try{n=S(e.env)}catch(F){return e.err(F instanceof Error?F.message:String(F)),1}const a=Y(r,n);if(!a||!f(r)?.enabled)return e.err(t("\u624B\u673A\u7AEF\u8FDC\u7A0B\u6CA1\u6709\u5F00\u542F\u3002\u5148\u8FD0\u884C dal remote enable\u3002")),1;const i=await Q(a,r,e);return i?(u.includes("--json")?e.out(JSON.stringify(i,null,2)):j(i,e),0):(e.err(t("\u62FF\u4E0D\u5230\u914D\u5BF9\u4FE1\u606F\uFF1A\u5B88\u62A4\u8FDB\u7A0B\u53EF\u80FD\u6CA1\u6709\u5728\u8FD0\u884C\u3002\u7528 dal remote status \u548C dal remote logs \u67E5\u770B\u3002")),1)}o(nu,"$e"),s(nu,"pair");function tu(u,e){const r=m(e.agentDir),n=u.indexOf("-n"),a=n>=0?Number(u[n+1]):50;if(!Number.isInteger(a)||a<=0)return e.err(t("-n \u9700\u8981\u4E00\u4E2A\u6B63\u6574\u6570\u3002")),2;if(!A(r.logFile))return e.out(t("\u8FD8\u6CA1\u6709\u65E5\u5FD7\uFF1A{file}").replace("{file}",r.logFile)),0;const i=y(r.logFile,"utf8").split(`
|
|
12
|
+
`);return i.at(-1)===""&&i.pop(),e.out(i.slice(-a).join(`
|
|
13
|
+
`)),0}o(tu,"Ne"),s(tu,"logs");function au(u){let e=process.env.USER??"";try{e=Du().username}catch{}return{agentDir:u,home:pu(),env:process.env,platform:process.platform,uid:typeof process.getuid=="function"?process.getuid():0,user:e,nodePath:process.execPath,dalEntry:process.argv[1]??"",fetch:s((r,n)=>fetch(r,n),"fetch"),run:fu,kill:s((r,n)=>process.kill(r,n),"kill"),pid:process.pid,npm:process.platform==="win32"?"npm.cmd":"npm",out:s(r=>process.stdout.write(`${r}
|
|
14
|
+
`),"out"),err:s(r=>process.stderr.write(`${r}
|
|
15
|
+
`),"err")}}o(au,"je"),s(au,"defaultRemoteDeps");async function su(u,e){const[r,...n]=u;switch(r){case"enable":return Z(e);case"disable":return uu(e);case"status":return ru(n,e);case"pair":return nu(n,e);case"logs":return tu(n,e);case void 0:case"help":case"-h":case"--help":return R(e);default:return e.err(t("\u672A\u77E5\u7684\u5B50\u547D\u4EE4\uFF1A{name}").replace("{name}",r)),R(e),2}}o(su,"Ke"),s(su,"runRemoteCommand");export{au as defaultRemoteDeps,P as launchSpecFor,_ as remoteStatus,su as runRemoteCommand};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var i=Object.defineProperty;var r=(u,a)=>i(u,"name",{value:a,configurable:!0});var d=Object.defineProperty,F=r((u,a)=>d(u,"name",{value:a,configurable:!0}),"n");import{t as e}from"@dalcode/dal-pi-kit";import{getAgentDir as l}from"@earendil-works/pi-coding-agent";import{defaultRemoteDeps as E,remoteStatus as A}from"./cli.js";import{defaultRemoteDeps as D,remoteStatus as f,runRemoteCommand as C}from"./cli.js";import{REMOTE_DAEMON as p}from"./spec.js";function n(u){u.registerCommand("remote",{description:e("\u67E5\u770B\u624B\u673A\u7AEF\u8FDC\u7A0B\u662F\u5426\u5F00\u542F\uFF08\u5F00\u542F\uFF1A\u5728\u7EC8\u7AEF\u8FD0\u884C dal remote enable\uFF09"),handler:F(async(a,m)=>{const t=await A(E(l())),o=t.service?.state,s=t.enabled?`${e("\u624B\u673A\u7AEF\u8FDC\u7A0B\u5DF2\u5F00\u542F")} \u2014 ${o==="running"?e("\u8FD0\u884C\u4E2D"):e("\u6CA1\u6709\u5728\u8FD0\u884C\uFF08\u7528 dal remote logs \u67E5\u770B\u539F\u56E0\uFF09")}`:e("\u624B\u673A\u7AEF\u8FDC\u7A0B\u672A\u5F00\u542F\u3002\u5728\u7EC8\u7AEF\u8FD0\u884C dal remote enable \u5F00\u542F\u3002");m.ui.notify(s,t.enabled&&o!=="running"?"warning":"info")},"handler")})}r(n,"u"),F(n,"default");export{p as REMOTE_DAEMON,n as default,D as defaultRemoteDeps,f as remoteStatus,C as runRemoteCommand};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var P=Object.defineProperty;var p=(e,u)=>P(e,"name",{value:u,configurable:!0});var j=Object.defineProperty,g=p((e,u)=>j(e,"name",{value:u,configurable:!0}),"d");import{spawn as L}from"node:child_process";import{createHash as O}from"node:crypto";import{existsSync as R,mkdirSync as A,readFileSync as C,realpathSync as x,renameSync as T,rmSync as m,writeFileSync as B}from"node:fs";import{join as F}from"node:path";import{t as i}from"@dalcode/dal-pi-kit";import{daemonInstallDir as h}from"./paths.js";const H=200*1024*1024,k=12e4,$=".dal-remote-installed";class l extends Error{static{p(this,"l")}static{g(this,"RemoteInstallError")}code;constructor(u,t){super(t),this.code=u}}const J=g((e,u,t)=>new Promise(o=>{let r="",s="",n;try{n=L(e,[...u],{cwd:t?.cwd,env:t?.env??process.env,stdio:["ignore","pipe","pipe"]})}catch(a){o({code:127,stdout:r,stderr:a instanceof Error?a.message:String(a)});return}n.stdout?.on("data",a=>{r+=String(a)}),n.stderr?.on("data",a=>{s+=String(a)}),n.on("error",a=>o({code:127,stdout:r,stderr:s||a.message})),n.on("close",a=>o({code:a??1,stdout:r,stderr:s}))}),"runCommand");function E(e){return`sha512-${O("sha512").update(e).digest("base64")}`}p(E,"F"),g(E,"sha512Integrity");function v(e){const u=(e.PI_OFFLINE??e.DAL_OFFLINE)?.toLowerCase();return u==="1"||u==="true"||u==="yes"}p(v,"L"),g(v,"offline");function y(e,u){const t=h(e,u.version);try{const o=JSON.parse(C(F(t,$),"utf8"));return o.name===u.packageName&&o.integrity===u.integrity?t:void 0}catch{return}}p(y,"T"),g(y,"installedDaemonDir");function w(e,u){const t=F(e,"node_modules",".bin",u.bin);if(R(t))try{return x(t)}catch{return}}p(w,"A"),g(w,"daemonBinPath");async function b(e,u){const t=[];let o=0;for(const r of e.registries){const s=`${r.replace(/\/+$/,"")}/${e.packageName}/${e.version}`;try{const n=await u(s,{signal:AbortSignal.timeout(k)});if(n.status===404){o++,await n.body?.cancel();continue}if(!n.ok){t.push(`${r}: HTTP ${n.status}`),await n.body?.cancel();continue}const a=await n.json(),c=typeof a.dist?.tarball=="string"?a.dist.tarball:void 0;if(!c){t.push(`${r}: ${i("\u6CA1\u6709\u4E0B\u8F7D\u5730\u5740")}`);continue}return{registry:r,tarball:c,integrity:typeof a.dist?.integrity=="string"?a.dist.integrity:void 0}}catch(n){t.push(`${r}: ${n instanceof Error?n.message:String(n)}`)}}throw o>0&&t.length===0?new l("not-published",i("\u624B\u673A\u7AEF\u5B88\u62A4\u8FDB\u7A0B {pkg} \u8FD8\u6CA1\u6709\u53D1\u5E03\uFF0C\u6682\u65F6\u65E0\u6CD5\u5F00\u542F\u3002\u53D1\u5E03\u540E\u5347\u7EA7 dal \u5373\u53EF\u4F7F\u7528\u3002").replace("{pkg}",`${e.packageName}@${e.version}`)):new l("network",`${i("\u65E0\u6CD5\u4ECE\u8F6F\u4EF6\u6E90\u83B7\u53D6\u624B\u673A\u7AEF\u5B88\u62A4\u8FDB\u7A0B\uFF1A")}
|
|
2
|
+
${t.map(r=>` ${r}`).join(`
|
|
3
|
+
`)}`)}p(b,"C"),g(b,"lookUp");async function S(e,u){const t=await u(e,{signal:AbortSignal.timeout(k)});if(!t.ok)throw await t.body?.cancel(),new l("network",`${e}: HTTP ${t.status}`);const o=t.body?.getReader();if(!o)throw new l("network",`${e}: ${i("\u54CD\u5E94\u6CA1\u6709\u5185\u5BB9")}`);const r=[];let s=0;for(;;){const{done:n,value:a}=await o.read();if(n)break;if(s+=a.byteLength,s>H)throw await o.cancel(),new l("network",i("\u5B88\u62A4\u8FDB\u7A0B\u5B89\u88C5\u5305\u8D85\u8FC7 200 MB\uFF0C\u5DF2\u505C\u6B62\u4E0B\u8F7D"));r.push(a)}return Buffer.concat(r)}p(S,"B"),g(S,"download");async function N(e,u,t){const o=y(e,u);if(o)return o;const r=`${u.packageName}@${u.version}`;let s,n;if(u.tarball)s=C(u.tarball);else{if(v(t.env))throw new l("offline",i("\u79BB\u7EBF\u6A21\u5F0F\u4E0B\u65E0\u6CD5\u4E0B\u8F7D\u624B\u673A\u7AEF\u5B88\u62A4\u8FDB\u7A0B\u3002"));t.progress?.(i("\u6B63\u5728\u67E5\u627E {pkg} \u2026").replace("{pkg}",r));const d=await b(u,t.fetch);if(!u.integrity)throw new l("not-pinned",i("\u8FD9\u4E2A\u7248\u672C\u7684 dal \u6CA1\u6709\u8BB0\u5F55 {pkg} \u7684\u6821\u9A8C\u503C\uFF0C\u4E0D\u80FD\u5B89\u88C5\u3002\u8BF7\u5347\u7EA7 dal \u540E\u518D\u8BD5\u3002").replace("{pkg}",r));if(d.integrity&&d.integrity!==u.integrity)throw new l("integrity",i("\u8F6F\u4EF6\u6E90\u4E0A\u7684 {pkg} \u4E0E dal \u8BB0\u5F55\u7684\u6821\u9A8C\u503C\u4E0D\u4E00\u81F4\uFF0C\u5DF2\u505C\u6B62\u5B89\u88C5\u3002").replace("{pkg}",r));n=d.registry,t.progress?.(i("\u6B63\u5728\u4E0B\u8F7D {pkg} \u2026").replace("{pkg}",r)),s=await S(d.tarball,t.fetch)}const a=E(s);if(a!==u.integrity)throw new l("integrity",i("\u4E0B\u8F7D\u5230\u7684 {pkg} \u6821\u9A8C\u503C\u4E0D\u7B26\uFF08{got}\uFF09\uFF0C\u5DF2\u4E22\u5F03\u3002").replace("{pkg}",r).replace("{got}",a.slice(0,20)));A(e.daemonRoot,{recursive:!0});const c=F(e.daemonRoot,`.stage-${process.pid}-${Date.now()}`);A(c,{recursive:!0});try{const d=F(c,"daemon.tgz");B(d,s),B(F(c,"package.json"),`${JSON.stringify({name:"dal-remote-host",private:!0})}
|
|
4
|
+
`),t.progress?.(i("\u6B63\u5728\u5B89\u88C5 {pkg} \u2026").replace("{pkg}",r));const D=await t.run(t.npm,["install","--prefix",c,"--no-audit","--no-fund","--ignore-scripts","--omit=dev",...n?["--registry",n]:[],d],{cwd:c,env:t.env});if(D.code!==0){const I=D.stderr.trim().split(`
|
|
5
|
+
`).slice(-8).join(`
|
|
6
|
+
`);throw new l("npm",`${i("npm \u5B89\u88C5\u624B\u673A\u7AEF\u5B88\u62A4\u8FDB\u7A0B\u5931\u8D25\uFF1A")}
|
|
7
|
+
${I}`)}if(!w(c,u))throw new l("bin",i("{pkg} \u91CC\u6CA1\u6709\u547D\u4EE4 {bin}\uFF0C\u65E0\u6CD5\u542F\u52A8\u3002").replace("{pkg}",r).replace("{bin}",u.bin));m(d,{force:!0}),B(F(c,$),`${JSON.stringify({name:u.packageName,version:u.version,integrity:u.integrity})}
|
|
8
|
+
`);const f=h(e,u.version);return m(f,{recursive:!0,force:!0}),T(c,f),f}finally{m(c,{recursive:!0,force:!0})}}p(N,"K"),g(N,"installDaemon");export{l as RemoteInstallError,w as daemonBinPath,N as installDaemon,y as installedDaemonDir,J as runCommand,E as sha512Integrity};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s=Object.defineProperty;var t=(a,o)=>s(a,"name",{value:o,configurable:!0});var d=Object.defineProperty,l=t((a,o)=>d(a,"name",{value:o,configurable:!0}),"n");import{join as e}from"node:path";const c="dal-remote",u="com.deepailab.dal-remote";function m(a){const o=e(a,"remote"),n=e(o,"logs"),r=e(o,"bin");return{root:o,daemonRoot:e(o,"daemon"),home:e(o,"home"),binDir:r,dalWrapper:e(r,"dal"),logDir:n,logFile:e(n,"daemon.log"),stateFile:e(o,"state.json"),accountTokenFile:e(o,"account-token")}}t(m,"c"),l(m,"remotePaths");function i(a,o){return e(a.daemonRoot,o)}t(i,"d"),l(i,"daemonInstallDir");export{u as LAUNCHD_LABEL,c as SERVICE_NAME,i as daemonInstallDir,m as remotePaths};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var S=Object.defineProperty;var p=(s,e)=>S(s,"name",{value:e,configurable:!0});var b=Object.defineProperty,d=p((s,e)=>b(s,"name",{value:e,configurable:!0}),"a");async function m(s){const e=await s("ps",["-A","-o","pid=,ppid=,pgid=,command="]);if(e.code!==0)return[];const n=[];for(const r of e.stdout.split(`
|
|
2
|
+
`)){const t=/^\s*(\d+)\s+(\d+)\s+(\d+)\s+(.*)$/.exec(r);t&&n.push({pid:Number(t[1]),ppid:Number(t[2]),pgid:Number(t[3]),command:t[4]})}return n}p(m,"g"),d(m,"listProcesses");function g(s,e){const n=new Map;for(const a of s){const c=n.get(a.ppid)??[];c.push(a),n.set(a.ppid,c)}const r=s.find(a=>a.pid===e),t=r?[r]:[],i=[e],f=new Set(i);for(;i.length>0;){const a=i.shift();for(const c of n.get(a)??[])f.has(c.pid)||(f.add(c.pid),t.push(c),i.push(c.pid))}return t}p(g,"P"),d(g,"processTree");function w(s,e,n){const r=e.endsWith("/")?e:`${e}/`;return s.filter(t=>t.pid!==n&&t.command.includes(r))}p(w,"b"),d(w,"daemonProcesses");function P(s,e,n,r){const t=new Set(r?g(s,r).map(i=>i.pid):[]);return w(s,e,n).filter(i=>!t.has(i.pid))}p(P,"h"),d(P,"leftoverProcesses");function u(s,e,n){try{s(e,n)}catch{}}p(u,"f"),d(u,"signal");async function k(s,e,n){const r=d(async()=>{if(s.length===0)return[];const o=new Map((await m(e.run)).map(l=>[l.pid,l]));return s.filter(l=>o.get(l.pid)?.command===l.command)},"alive"),t=d(async o=>{const l=e.now()+o;for(;;){const h=await r();if(h.length===0||e.now()>=l)return h;await e.sleep(200)}},"waitGone");let i=await t(n.graceMs);if(i.length===0)return{killed:[],remaining:[]};for(const o of i)u(e.kill,o.pid,"SIGTERM");if(i=await t(n.termMs),i.length===0)return{killed:[],remaining:[]};const f=i,a=new Set(s.map(o=>o.pid)),c=new Set(i.map(o=>o.pgid).filter(o=>o>1&&a.has(o)));for(const o of c)u(e.kill,-o,"SIGKILL");for(const o of i)u(e.kill,o.pid,"SIGKILL");return{killed:f,remaining:await t(n.killMs??2e3)}}p(k,"w"),d(k,"reapProcesses");export{w as daemonProcesses,P as leftoverProcesses,m as listProcesses,g as processTree,k as reapProcesses};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var N=Object.defineProperty;var s=(t,e)=>N(t,"name",{value:e,configurable:!0});var x=Object.defineProperty,a=s((t,e)=>x(t,"name",{value:e,configurable:!0}),"i");import{dirname as A,join as y}from"node:path";import{LAUNCHD_LABEL as o,SERVICE_NAME as k}from"./paths.js";function $(t){if(t==="linux")return"systemd";if(t==="darwin")return"launchd"}s($,"D"),a($,"serviceKind");function b(t,e,r){if(t==="launchd")return y(e,"Library","LaunchAgents",`${o}.plist`);const n=r.XDG_CONFIG_HOME?.trim()||y(e,".config");return y(n,"systemd","user",`${k}.service`)}s(b,"L"),a(b,"serviceFilePath");function l(t,e=!1){const r=t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/%/g,"%%");return`"${e?r.replace(/\$/g,"$$$$"):r}"`}s(l,"l"),a(l,"systemdQuote");function g(t){const e=[t.program,...t.args].map(n=>l(n,!0)).join(" "),r=Object.entries(t.env).map(([n,i])=>`Environment=${l(`${n}=${i}`)}`);return["# Written by `dal remote enable`; removed by `dal remote disable`.","[Unit]","Description=DAL Code remote daemon (phone app)","After=network-online.target","Wants=network-online.target","","[Service]","Type=simple",`ExecStart=${e}`,...r,`WorkingDirectory=${l(t.workingDirectory)}`,"Restart=on-failure","RestartSec=5",`StandardOutput=append:${t.logFile}`,`StandardError=append:${t.logFile}`,"","[Install]","WantedBy=default.target",""].join(`
|
|
2
|
+
`)}s(g,"w"),a(g,"systemdUnit");function c(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}s(c,"u"),a(c,"xml");function p(t){const e=a(n=>n.map(i=>` <string>${c(i)}</string>`).join(`
|
|
3
|
+
`),"strings"),r=Object.entries(t.env).map(([n,i])=>` <key>${c(n)}</key>
|
|
4
|
+
<string>${c(i)}</string>`).join(`
|
|
5
|
+
`);return['<?xml version="1.0" encoding="UTF-8"?>','<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">',"<!-- Written by `dal remote enable`; removed by `dal remote disable`. -->",'<plist version="1.0">',"<dict>"," <key>Label</key>",` <string>${o}</string>`," <key>ProgramArguments</key>"," <array>",e([t.program,...t.args])," </array>"," <key>EnvironmentVariables</key>"," <dict>",r," </dict>"," <key>WorkingDirectory</key>",` <string>${c(t.workingDirectory)}</string>`," <key>RunAtLoad</key>"," <true/>"," <key>KeepAlive</key>"," <dict>"," <key>SuccessfulExit</key>"," <false/>"," </dict>"," <key>ThrottleInterval</key>"," <integer>5</integer>"," <key>ProcessType</key>"," <string>Interactive</string>"," <key>StandardOutPath</key>",` <string>${c(t.logFile)}</string>`," <key>StandardErrorPath</key>",` <string>${c(t.logFile)}</string>`,"</dict>","</plist>",""].join(`
|
|
6
|
+
`)}s(p,"b"),a(p,"launchdPlist");function h(t,e){return t==="systemd"?g(e):p(e)}s(h,"C"),a(h,"serviceFileContent");const d=`${k}.service`;function m(t){return(t.stderr.trim()||t.stdout.trim()).split(`
|
|
7
|
+
`).slice(-4).join(`
|
|
8
|
+
`)}s(m,"p"),a(m,"describe");async function S(t){const e=[];if(t.kind==="systemd"){for(const u of[["--user","daemon-reload"],["--user","enable","--now",d]]){const w=await t.run("systemctl",u);if(w.code!==0)throw new Error(`systemctl ${u.join(" ")}: ${m(w)}`)}const i=await t.run("loginctl",["show-user",t.user,"--property=Linger"]);if(!/Linger=yes/.test(i.stdout)){const u=await t.run("loginctl",["enable-linger",t.user]);e.push(u.code===0?"linger-enabled":"linger-failed")}return e}const r=`gui/${t.uid}`;await t.run("launchctl",["bootout",`${r}/${o}`]),await f(t);const n=await t.run("launchctl",["bootstrap",r,t.file]);if(n.code!==0)throw new Error(`launchctl bootstrap ${r}: ${m(n)}`);return e}s(S,"E"),a(S,"startService");const I=1e4;async function f(t){const e=t.sleep??(i=>new Promise(u=>setTimeout(u,i))),r=t.now??Date.now,n=r()+I;for(;r()<n;){if((await t.run("launchctl",["print",`gui/${t.uid}/${o}`])).code!==0)return;await e(200)}}s(f,"y"),a(f,"waitUnloaded");async function D(t){if(t.kind==="systemd"){await t.run("systemctl",["--user","disable","--now",d]);return}await t.run("launchctl",["bootout",`gui/${t.uid}/${o}`]),await f(t)}s(D,"N"),a(D,"stopService");async function P(t){if(t.kind==="systemd"){const n=await t.run("systemctl",["--user","show","--property=NRestarts","--value",d]),i=Number(n.stdout.trim());return n.code===0&&Number.isInteger(i)?i:0}const e=await t.run("launchctl",["print",`gui/${t.uid}/${o}`]),r=Number(/\bruns = (\d+)/.exec(e.stdout)?.[1]??0);return Math.max(0,r-1)}s(P,"A"),a(P,"serviceRestarts");async function E(t){if(t.kind==="systemd"){const e=await t.run("systemctl",["--user","show","--property=MainPID","--value",d]),r=Number(e.stdout.trim());return e.code===0&&Number.isInteger(r)&&r>0?r:void 0}return(await v(t)).pid}s(E,"I"),a(E,"servicePid");async function L(t){t.kind==="systemd"&&await t.run("systemctl",["--user","daemon-reload"])}s(L,"T"),a(L,"forgetService");async function v(t){if(t.kind==="systemd"){const i=(await t.run("systemctl",["--user","is-active",d])).stdout.trim();return i==="active"||i==="activating"||i==="reloading"?{state:"running"}:i==="failed"?{state:"failed"}:i==="inactive"||i==="deactivating"?{state:"stopped"}:{state:"unknown"}}const e=await t.run("launchctl",["print",`gui/${t.uid}/${o}`]);if(e.code!==0)return{state:"stopped"};const r=/\bpid = (\d+)/.exec(e.stdout)?.[1];if(/\bstate = running\b/.test(e.stdout))return{state:"running",...r?{pid:Number(r)}:{}};const n=/last exit code = (\d+)/.exec(e.stdout)?.[1];return{state:n&&n!=="0"?"failed":"stopped"}}s(v,"S"),a(v,"serviceState");function j(t){return A(t)}s(j,"j"),a(j,"serviceDir");export{L as forgetService,p as launchdPlist,j as serviceDir,h as serviceFileContent,b as serviceFilePath,$ as serviceKind,E as servicePid,P as serviceRestarts,v as serviceState,S as startService,D as stopService,g as systemdUnit};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var u=Object.defineProperty;var t=(e,r)=>u(e,"name",{value:r,configurable:!0});var p=Object.defineProperty,o=t((e,r)=>p(e,"name",{value:r,configurable:!0}),"o");const T={packageName:"@deepailab/dal-remote-daemon",version:"0.1.1",integrity:"sha512-KOOHn9PMTQYr+RU5tiHrJ577pPF/gKt63Wqzb2Ku0RJFqW54jdguznFyf712GlPjYCAYU2O9wSQhKCVX/S2KFQ==",bin:"dal-remote-daemon"},N=["https://registry.npmmirror.com","https://registry.npmjs.org"],s="DAL_REMOTE_DAEMON_PACKAGE",i="DAL_REMOTE_DAEMON_TARBALL",m="DAL_REMOTE_DAEMON_INTEGRITY",g="DAL_REMOTE_DAEMON_REGISTRY",D="DAL_REMOTE_ACCOUNT_TOKEN_FILE";function c(e){return["daemon","run","--home",e]}t(c,"T"),o(c,"daemonRunArgs");function d(e){return["daemon","pair","--home",e,"--relay","--json"]}t(d,"d"),o(d,"daemonPairArgs");function l(e,r=T){const A=[e[g]?.trim(),...N].filter(n=>!!n),a=e[s]?.trim(),E=e[i]?.trim(),_=e[m]?.trim();if(!a&&!E)return{...r,registries:A};if(!_)throw new Error(`${s} / ${i} need ${m} (the sha512 SRI they must match)`);let O=r.packageName,R=r.version;if(a){const n=a.lastIndexOf("@");if(n<=0)throw new Error(`${s} must be name@version, got ${a}`);O=a.slice(0,n),R=a.slice(n+1)}return{...r,packageName:O,version:R,integrity:_,registries:A,...E?{tarball:E}:{}}}t(l,"D"),o(l,"resolveDaemonSpec");export{D as ENV_ACCOUNT_TOKEN_FILE,m as ENV_INTEGRITY,s as ENV_PACKAGE,g as ENV_REGISTRY,i as ENV_TARBALL,T as REMOTE_DAEMON,N as REMOTE_DAEMON_REGISTRIES,d as daemonPairArgs,c as daemonRunArgs,l as resolveDaemonSpec};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-review",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.44",
|
|
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.44",
|
|
23
|
+
"@dalcode/dal-subagent": "1.0.44",
|
|
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.44",
|
|
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.44"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@earendil-works/pi-coding-agent": "^1.0.9"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-router",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.44",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
]
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
31
|
-
"@dalcode/deepailab": "1.0.
|
|
32
|
-
"@earendil-works/pi-tui": "^1.0.
|
|
30
|
+
"@dalcode/dal-pi-kit": "1.0.44",
|
|
31
|
+
"@dalcode/deepailab": "1.0.44",
|
|
32
|
+
"@earendil-works/pi-tui": "^1.0.44"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@earendil-works/pi-coding-agent": "^1.0.0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-rtk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.44",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Uses rtk, when the user has installed it, to compress the output of shell commands the agent runs. Does nothing when rtk is not installed; never installs it.",
|
|
6
6
|
"type": "module",
|
|
@@ -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.44"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@earendil-works/pi-coding-agent": "^1.0.9"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-skills",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.44",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
]
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
25
|
-
"@dalcode/deepailab": "1.0.
|
|
24
|
+
"@dalcode/dal-pi-kit": "1.0.44",
|
|
25
|
+
"@dalcode/deepailab": "1.0.44",
|
|
26
26
|
"typebox": "1.3.7"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-statusline",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.44",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "A scriptable status line under the footer: a template or a command of the user's choosing. Grown from the status-line and custom-footer extension examples.",
|
|
6
6
|
"type": "module",
|
|
@@ -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.44"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@earendil-works/pi-coding-agent": "^1.0.9"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-structured",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.44",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "dal -p --output-schema: the final answer as JSON that matches a JSON Schema, with a non-zero exit when it does not. Grown from the structured-output extension example.",
|
|
6
6
|
"type": "module",
|
|
@@ -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.44",
|
|
22
22
|
"typebox": "1.3.27"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-subagent",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.44",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
]
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
22
|
-
"@dalcode/dal-guard": "1.0.
|
|
23
|
-
"@earendil-works/pi-agent-core": "^1.0.
|
|
24
|
-
"@earendil-works/pi-ai": "^1.0.
|
|
21
|
+
"@dalcode/dal-pi-kit": "1.0.44",
|
|
22
|
+
"@dalcode/dal-guard": "1.0.44",
|
|
23
|
+
"@earendil-works/pi-agent-core": "^1.0.44",
|
|
24
|
+
"@earendil-works/pi-ai": "^1.0.44",
|
|
25
25
|
"typebox": "1.3.7"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
`):typeof
|
|
3
|
-
${
|
|
4
|
-
${s}`};const
|
|
1
|
+
var S=Object.defineProperty;var d=(e,u)=>S(e,"name",{value:u,configurable:!0});var v=Object.defineProperty,a=d((e,u)=>v(e,"name",{value:u,configurable:!0}),"u");import{t as n}from"@dalcode/dal-pi-kit";import{SubagentProgress as T}from"./progress.js";const g="dal-subagent-result",h=6e3,B="subagents_status",E=5e3,F=500;function f(e){return Array.isArray(e)?e.filter(u=>u?.type==="text"&&typeof u.text=="string").map(u=>u.text).join(`
|
|
2
|
+
`):typeof e=="string"?e:""}d(f,"v"),a(f,"textOfContent");function C(e){const u=e.trim();return u.length<=F?u:`\u2026${u.slice(-(F-1))}`}d(C,"y"),a(C,"capOutput");const D=a(e=>e.totalTokens>0||e.cost.total>0,"hasUsage");function m(e){return e.length<=h?e:`${e.slice(0,h)}
|
|
3
|
+
${n("\u2026\u2026\uFF08\u62A5\u544A\u8FC7\u957F\uFF0C\u5DF2\u622A\u65AD\uFF09")}`}d(m,"A"),a(m,"capReport");function A(e,u){const t=a(l=>`[${n("\u540E\u53F0\u5B50\u52A9\u624B")} ${e.id.slice(0,8)} \xB7 ${e.description} \xB7 ${l}]`,"head"),s=`${n("[\u5B50 agent ID\uFF1A")}${e.id}${n("\uFF0C\u53EF\u7528 resume \u53C2\u6570\u7EE7\u7EED]")}`;if(u.stop==="aborted")return{status:"stopped",text:`${t(n("\u5DF2\u505C\u6B62"))}
|
|
4
|
+
${s}`};const r=[];u.stop==="idle"&&r.push(n("\u5B50 agent \u8D85\u8FC7 10 \u5206\u949F\u6CA1\u6709\u4EFB\u4F55\u8FDB\u5C55\uFF0C\u5DF2\u505C\u6B62\u3002")),u.stop==="turn-limit"&&r.push(n("\u8FBE\u5230\u8F6E\u6B21\u4E0A\u9650\u4ECD\u672A\u7ED9\u51FA\u7ED3\u679C\uFF0C\u5DF2\u505C\u6B62\u3002")),u.failure&&r.push(`${n("\u5B50 agent \u8FD0\u884C\u51FA\u9519\uFF1A")}${u.failure}`),u.toolErrors&&r.push(`${n("\u8FDE\u7EED\u5931\u8D25\u7684\u8C03\u7528\uFF1A")}
|
|
5
5
|
${u.toolErrors.map(l=>`- ${l}`).join(`
|
|
6
|
-
`)}`);const
|
|
6
|
+
`)}`);const i=u.stop!==void 0||u.failure!==void 0,c=m(u.text||n("\u5B50 agent \u6CA1\u6709\u4EA7\u751F\u4EFB\u4F55\u8F93\u51FA\u3002")),p=i?"failed":"done",o=i?n("\u672A\u5B8C\u6210"):u.toolErrors?n("\u53D7\u963B"):n("\u5DF2\u5B8C\u6210");return{status:p,text:[t(o),...r,c,s].join(`
|
|
7
7
|
|
|
8
|
-
`)}}d(A,"
|
|
8
|
+
`)}}d(A,"$"),a(A,"backgroundReport");class b{static{d(this,"I")}static{a(this,"BackgroundSubagents")}pi;pool;runInProcess;records=new Map;closed=!1;lastSnapshot="";statusTimer;constructor(u,t,s){this.pi=u,this.pool=t,this.runInProcess=s}active(){return[...this.records.values()].filter(u=>u.status==="queued"||u.status==="running")}start(u){const t=new AbortController,s={id:u.id,description:u.description,...u.agent?{agent:u.agent}:{},status:"queued",startedAt:Date.now(),usage:{input:0,output:0,cost:0},controller:t,progress:new T(this.pi,{...u.parentToolCallId?{parentToolCallId:u.parentToolCallId}:{},description:u.description,background:!0})};s.progress?.start(s.id,{...u.agent?{agent:u.agent}:{},status:"queued"}),this.records.set(s.id,s),this.publishStatus();const r=u.signal?AbortSignal.any([t.signal,u.signal]):t.signal;return this.drive(s,u,r),s}async drive(u,t,s){let r;try{r=await this.pool.acquire(s)}catch{this.setStatus(u,"stopped"),this.report(u,"stopped",`[${n("\u540E\u53F0\u5B50\u52A9\u624B")} ${u.id.slice(0,8)} \xB7 ${u.description} \xB7 ${n("\u5DF2\u505C\u6B62")}]`);return}this.setStatus(u,"running");try{const i=await this.runInProcess({...t.run,signal:s,onEvent:a(o=>{t.run.onEvent?.(o),this.observe(u,o)},"onEvent"),onStarted:a(o=>{u.handle=o},"onStarted"),onBlocked:a(o=>{this.closed||t.parentIdle()||this.send({customType:g,content:`[${n("\u540E\u53F0\u5B50\u52A9\u624B")} ${u.id.slice(0,8)} \xB7 ${u.description} \xB7 ${n("\u53D7\u963B")}]
|
|
9
9
|
${o.map(l=>`- ${l}`).join(`
|
|
10
10
|
`)}
|
|
11
|
-
${
|
|
11
|
+
${n("\u5B83\u6B63\u5728\u505C\u4E0B\u6765\u6C47\u62A5\u539F\u56E0\uFF1B\u4E0D\u8981\u91CD\u590D\u6D3E\u53D1\u540C\u6837\u7684\u5B50\u4EFB\u52A1\u3002")}`,display:!0,details:{subagentId:u.id,description:u.description,status:"running"}},{deliverAs:"steer"})},"onBlocked")});u.handle=void 0,D(i.usage)&&this.pi.appendUsage(i.usage,{kind:"subagent",provider:t.run.model.provider,model:t.run.model.id,note:u.description}),i.accountLimit&&t.onAccountLimit?.(i.failure??"account limit");const{status:c,text:p}=A(u,i);this.setStatus(u,c,i.failure??(i.text||void 0)),this.report(u,c,p,D(i.usage)?i.usage:void 0)}catch(i){u.handle=void 0;const c=i instanceof Error?i.message:String(i);this.setStatus(u,"failed",c),this.report(u,"failed",`[${n("\u540E\u53F0\u5B50\u52A9\u624B")} ${u.id.slice(0,8)} \xB7 ${u.description} \xB7 ${n("\u672A\u5B8C\u6210")}]
|
|
12
12
|
|
|
13
|
-
${
|
|
13
|
+
${n("\u5B50 agent \u8FD0\u884C\u51FA\u9519\uFF1A")}${c}`)}finally{r?.()}}observe(u,t){if(t.type==="tool_execution_start"){u.progress?.step(String(t.toolName),t.args);return}if(t.type!=="message_end"&&t.type!=="message_update")return;const s=t.message;if(s?.role!=="assistant")return;const r=f(s.content);r.trim()&&(u.lastOutput=C(r)),t.type==="message_end"&&s.usage?.cost&&(u.usage.input+=s.usage.input,u.usage.output+=s.usage.output,u.usage.cost+=s.usage.cost.total)}setStatus(u,t,s){u.status=t,t!=="queued"&&t!=="running"&&(u.endedAt=Date.now()),t==="running"?u.progress?.running():t!=="queued"&&u.progress?.finish(t,s??u.lastOutput),this.publishStatus()}snapshot(){return{subagents:[...this.records.values()].map(u=>({id:u.id,description:u.description,...u.agent?{agent:u.agent}:{},status:u.status,startedAt:u.startedAt,...u.endedAt!==void 0?{endedAt:u.endedAt}:{},usage:{...u.usage},...u.lastOutput?{lastOutput:u.lastOutput}:{}}))}}publishStatus(){if(this.closed)return;const u=this.snapshot(),t=JSON.stringify(u);if(t!==this.lastSnapshot){this.lastSnapshot=t;try{this.pi.emitHostEvent(B,u)}catch{}}const s=this.active().length>0;s&&!this.statusTimer?(this.statusTimer=setInterval(()=>this.publishStatus(),E),this.statusTimer.unref?.()):!s&&this.statusTimer&&(clearInterval(this.statusTimer),this.statusTimer=void 0)}report(u,t,s,r){this.closed||this.send({customType:g,content:s,display:!0,details:{subagentId:u.id,description:u.description,status:t,...r?{usage:r}:{},...$(u)}},{deliverAs:"followUp",triggerTurn:!0})}send(u,t){try{this.pi.sendMessage(u,t)}catch{this.closed=!0}}find(u){const t=u.trim();if(!t)return;const s=this.records.get(t);if(s)return s;const r=[...this.records.values()].filter(i=>i.id.startsWith(t));return r.length===1?r[0]:void 0}async steer(u,t){const s=this.find(u);if(!s)return`${n("\u6CA1\u6709\u8FD9\u4E2A\u540E\u53F0\u5B50\u52A9\u624B\uFF1A")}${u}`;if(s.status==="queued")return n("\u8FD9\u4E2A\u540E\u53F0\u5B50\u52A9\u624B\u8FD8\u5728\u6392\u961F\uFF0C\u5C1A\u672A\u5F00\u59CB\uFF1B\u7A0D\u540E\u518D\u8C03\u6574\uFF0C\u6216\u505C\u6B62\u540E\u91CD\u65B0\u6D3E\u53D1\u3002");if(s.status!=="running"||!s.handle)return n("\u8FD9\u4E2A\u5B50\u52A9\u624B\u5DF2\u7ECF\u7ED3\u675F\uFF1B\u8981\u7EE7\u7EED\u5B83\uFF0C\u7528 resume \u53C2\u6570\u3002");await s.handle.steer(t)}stop(u){const t=this.find(u);return!t||t.status!=="queued"&&t.status!=="running"?!1:(t.controller.abort(),!0)}close(){this.closed=!0,this.statusTimer&&clearInterval(this.statusTimer),this.statusTimer=void 0;for(const u of this.active())u.controller.abort()}}function $(e){const u=e.progress?.snapshot();return u?{subagents:[u]}:{}}d($,"R"),a($,"subagentsDetail");export{g as BACKGROUND_RESULT_TYPE,b as BackgroundSubagents,h as MAX_BACKGROUND_REPORT_CHARS,F as MAX_STATUS_OUTPUT_CHARS,B as SUBAGENTS_STATUS_EVENT,E as SUBAGENTS_STATUS_INTERVAL_MS,A as backgroundReport};
|