@cydm/pie 4.11.0 → 4.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builtin/extensions/ask-user/index.js +2 -2
- package/dist/builtin/extensions/cron/index.js +1 -1
- package/dist/builtin/extensions/im-forward/index.js +8670 -7364
- package/dist/builtin/extensions/mcp-adapter/index.js +1 -1
- package/dist/builtin/extensions/memory/index.js +171 -66
- package/dist/builtin/extensions/pie-ipc/index.js +1 -1
- package/dist/builtin/extensions/pie-proc/index.js +533 -50
- package/dist/builtin/extensions/plan-mode/index.js +2 -2
- package/dist/builtin/extensions/subagent/README.md +1 -1
- package/dist/builtin/extensions/subagent/index.js +3 -3
- package/dist/builtin/extensions/todo/index.js +2 -2
- package/dist/chunks/{auth-storage-C3FZMT7J.js → auth-storage-IJEJ2TGE.js} +1 -1
- package/dist/chunks/chunk-26ILLZKQ.js +400 -0
- package/dist/chunks/{chunk-KWK7KTSZ.js → chunk-322WLBDY.js} +1 -1
- package/dist/chunks/{chunk-OU33ROFD.js → chunk-3GG342QY.js} +78 -78
- package/dist/chunks/{chunk-BB7ETSJK.js → chunk-6U6UGM4C.js} +119 -3
- package/dist/chunks/{chunk-ZPJ3BNQB.js → chunk-BSITHT43.js} +1 -0
- package/dist/chunks/{chunk-IZKHSUNQ.js → chunk-CAPBTMLI.js} +18 -1
- package/dist/chunks/{chunk-B5GKDXVG.js → chunk-IZ4DYCJ7.js} +246 -80
- package/dist/chunks/{chunk-HK3FHIAH.js → chunk-KW46ND3S.js} +1999 -767
- package/dist/chunks/{chunk-SW2E33UL.js → chunk-LMDWWT43.js} +123 -4
- package/dist/chunks/{chunk-EWPPGYBU.js → chunk-OGGL6LUN.js} +55 -16
- package/dist/chunks/{chunk-BTUMBUDU.js → chunk-QSXBPTOA.js} +1 -1
- package/dist/chunks/{chunk-5QMS6RQC.js → chunk-SXBX2P5R.js} +160 -5
- package/dist/chunks/{chunk-7LICWWUE.js → chunk-W37NAT3N.js} +2 -2
- package/dist/chunks/chunk-WTBLV6F5.js +476 -0
- package/dist/chunks/{host-image-fallback-3TEMOQM5.js → host-image-fallback-NXY36VO2.js} +1 -1
- package/dist/chunks/{manager-cli-BXI4UFTJ.js → manager-cli-B6GIYTI7.js} +35 -13
- package/dist/chunks/{manager-upgrade-XPFXKO7A.js → manager-upgrade-WHER3WTJ.js} +284 -109
- package/dist/chunks/memory-git-C3S276QJ.js +19 -0
- package/dist/chunks/{model-registry-MGZO2RBN.js → model-registry-QNEPISBJ.js} +11 -3
- package/dist/chunks/{read-file-understanding-N2ZZQLTZ.js → read-file-understanding-ZCBNCQHG.js} +3 -3
- package/dist/chunks/{src-F5N6O2HR.js → src-7CU7OTQS.js} +36 -36
- package/dist/chunks/{src-3PSR2AAX.js → src-7MZZJVOG.js} +1 -1
- package/dist/cli.js +740 -512
- package/package.json +2 -2
- package/dist/chunks/chunk-L7XXKNZW.js +0 -386
|
@@ -101,8 +101,92 @@ function formatBlockingWindowsPeers(peers) {
|
|
|
101
101
|
function isWindowsTaskAlreadyStoppedDetail(detail) {
|
|
102
102
|
return /not currently running|not running|cannot find|does not exist|not found|当前未运行|尚未运行|没有正在运行|找不到指定的文件|系统找不到/i.test(detail);
|
|
103
103
|
}
|
|
104
|
+
function parseWindowsTaskNumericState(status, stdout, _stderr = "") {
|
|
105
|
+
if (status !== 0) return "unknown";
|
|
106
|
+
const m = /^\s*STATE=(NOT_FOUND|[0-4])\s*$/im.exec(stdout);
|
|
107
|
+
if (!m) return "unknown";
|
|
108
|
+
const raw = m[1].toUpperCase();
|
|
109
|
+
if (raw === "NOT_FOUND" || raw === "1" || raw === "3") return "stopped";
|
|
110
|
+
if (raw === "2" || raw === "4") return "running";
|
|
111
|
+
return "unknown";
|
|
112
|
+
}
|
|
113
|
+
var WINDOWS_TASK_STATE_PS = [
|
|
114
|
+
"[Console]::OutputEncoding = [System.Text.Encoding]::UTF8;",
|
|
115
|
+
"$svc = New-Object -ComObject 'Schedule.Service';",
|
|
116
|
+
"$svc.Connect();",
|
|
117
|
+
"try {",
|
|
118
|
+
" $t = $svc.GetFolder('\\').GetTask('dev.pie.manager');",
|
|
119
|
+
" Write-Output ('STATE=' + [int]$t.State);",
|
|
120
|
+
"} catch {",
|
|
121
|
+
" if ($_.Exception.HResult -eq -2147024894 -or $_.Exception.Message -match '0x80070002|0x80070003') { Write-Output 'STATE=NOT_FOUND' }",
|
|
122
|
+
" else { Write-Error $_.Exception.Message; exit 2 }",
|
|
123
|
+
"}"
|
|
124
|
+
].join(" ");
|
|
125
|
+
function queryWindowsServiceTaskState(runQuery) {
|
|
126
|
+
const exec = runQuery ?? ((cmd, args) => spawnSync(cmd, args, {
|
|
127
|
+
encoding: "utf8",
|
|
128
|
+
timeout: 15e3,
|
|
129
|
+
windowsHide: true
|
|
130
|
+
}));
|
|
131
|
+
try {
|
|
132
|
+
const ps = exec("powershell.exe", ["-NoProfile", "-NonInteractive", "-Command", WINDOWS_TASK_STATE_PS]);
|
|
133
|
+
if (!ps.error) {
|
|
134
|
+
return parseWindowsTaskNumericState(ps.status, ps.stdout ?? "", ps.stderr ?? "");
|
|
135
|
+
}
|
|
136
|
+
const r = exec("schtasks", ["/Query", "/TN", "dev.pie.manager", "/FO", "LIST"]);
|
|
137
|
+
const combined = `${r.stdout ?? ""}
|
|
138
|
+
${r.stderr ?? ""}`;
|
|
139
|
+
if (r.error) return "unknown";
|
|
140
|
+
if (r.status !== 0) {
|
|
141
|
+
return isWindowsTaskAlreadyStoppedDetail(combined) ? "stopped" : "unknown";
|
|
142
|
+
}
|
|
143
|
+
const statusLine = /^\s*(?:Status|状态)\s*:\s*(.+)$/im.exec(combined)?.[1]?.trim();
|
|
144
|
+
if (!statusLine) return "unknown";
|
|
145
|
+
if (/^(?:Running|正在运行)$/i.test(statusLine)) return "running";
|
|
146
|
+
if (/^(?:Ready|Disabled|Could not start|就绪|已禁用|禁用)$/i.test(statusLine)) return "stopped";
|
|
147
|
+
return "unknown";
|
|
148
|
+
} catch {
|
|
149
|
+
return "unknown";
|
|
150
|
+
}
|
|
151
|
+
}
|
|
104
152
|
function runWindowsPreInstallStop(state, deps) {
|
|
153
|
+
const checkManagerIdle = () => {
|
|
154
|
+
const liveManager = deps.findManagerResident(state.sessionId);
|
|
155
|
+
if (liveManager) {
|
|
156
|
+
if (liveManager.state !== "idle") {
|
|
157
|
+
return {
|
|
158
|
+
status: "refused",
|
|
159
|
+
detail: `refused: manager resident (pid ${liveManager.pid}) is ${liveManager.state ?? "unknown"} before Windows pre-install stop; retry when idle.`
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
return void 0;
|
|
163
|
+
}
|
|
164
|
+
if (typeof state.pid === "number" && state.pid > 0 && deps.residentStatus(state) === "alive") {
|
|
165
|
+
return {
|
|
166
|
+
status: "refused",
|
|
167
|
+
detail: `refused: manager resident (pid ${state.pid}) is alive but discovery cannot confirm idle state; retry when idle.`
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
if (state.service !== true && deps.residentStatus(state) === "alive") {
|
|
171
|
+
return {
|
|
172
|
+
status: "refused",
|
|
173
|
+
detail: "refused: manager resident is alive but discovery cannot confirm idle state; retry when idle."
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
if (state.service === true && deps.isServiceTaskRunning) {
|
|
177
|
+
const taskState = deps.isServiceTaskRunning();
|
|
178
|
+
if (taskState !== "stopped") {
|
|
179
|
+
return {
|
|
180
|
+
status: "refused",
|
|
181
|
+
detail: `refused: manager service task is ${taskState} without discovery idle proof; retry when idle.`
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return void 0;
|
|
186
|
+
};
|
|
105
187
|
const checkBlockers = () => {
|
|
188
|
+
const managerRefusal = checkManagerIdle();
|
|
189
|
+
if (managerRefusal) return managerRefusal;
|
|
106
190
|
const blockers = deps.scanBlockingPeers(state);
|
|
107
191
|
if (blockers.length > 0) {
|
|
108
192
|
return {
|
|
@@ -172,8 +256,31 @@ function runWindowsPreInstallStop(state, deps) {
|
|
|
172
256
|
if (preStopRefusal) return preStopRefusal;
|
|
173
257
|
if (state.service === true) {
|
|
174
258
|
const liveBefore = deps.findManagerResident(state.sessionId);
|
|
175
|
-
|
|
176
|
-
|
|
259
|
+
if (liveBefore && liveBefore.state !== "idle") {
|
|
260
|
+
return {
|
|
261
|
+
status: "refused",
|
|
262
|
+
detail: `refused: manager service resident (pid ${liveBefore.pid}) became ${liveBefore.state ?? "unknown"} right before schtasks /End; retry when idle.`
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
if (!liveBefore) {
|
|
266
|
+
if (typeof state.pid === "number" && state.pid > 0 && deps.residentStatus(state) === "alive") {
|
|
267
|
+
return {
|
|
268
|
+
status: "refused",
|
|
269
|
+
detail: `refused: manager service resident (pid ${state.pid}) is alive without discovery idle proof right before schtasks /End; retry when idle.`
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
if (deps.isServiceTaskRunning) {
|
|
273
|
+
const taskState = deps.isServiceTaskRunning();
|
|
274
|
+
if (taskState !== "stopped") {
|
|
275
|
+
return {
|
|
276
|
+
status: "refused",
|
|
277
|
+
detail: `refused: manager service task is ${taskState} without discovery idle proof right before schtasks /End; retry when idle.`
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
return { status: touched ? "stopped" : "unnecessary" };
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
const targetPid = liveBefore?.pid;
|
|
177
284
|
const end = deps.endServiceTask();
|
|
178
285
|
if (end.spawnError) {
|
|
179
286
|
return {
|
|
@@ -207,7 +314,14 @@ function runWindowsPreInstallStop(state, deps) {
|
|
|
207
314
|
};
|
|
208
315
|
}
|
|
209
316
|
if (status === "alive") {
|
|
210
|
-
const
|
|
317
|
+
const liveManual = deps.findManagerResident(state.sessionId);
|
|
318
|
+
if (!liveManual || liveManual.state !== "idle") {
|
|
319
|
+
return {
|
|
320
|
+
status: "refused",
|
|
321
|
+
detail: `refused: manager resident${liveManual ? ` (pid ${liveManual.pid})` : ""} cannot be confirmed idle right before stop (state: ${liveManual?.state ?? "discovery unavailable"}); retry when idle.`
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
const targetPid = typeof state.pid === "number" && state.pid > 0 ? state.pid : liveManual.pid;
|
|
211
325
|
const stopped = deps.terminateResident(state);
|
|
212
326
|
if (stopped !== "terminated" && stopped !== "dead") {
|
|
213
327
|
return {
|
|
@@ -456,6 +570,8 @@ export {
|
|
|
456
570
|
normalizePreInstallStopOutcome,
|
|
457
571
|
resolveDefaultTuiUsePidFile,
|
|
458
572
|
scanBlockingWindowsPeers,
|
|
573
|
+
parseWindowsTaskNumericState,
|
|
574
|
+
queryWindowsServiceTaskState,
|
|
459
575
|
runWindowsPreInstallStop,
|
|
460
576
|
isWindowsServiceManager,
|
|
461
577
|
resolveAbsoluteActorEnv,
|
|
@@ -22,9 +22,26 @@ function cronActiveCount(sessionId) {
|
|
|
22
22
|
return 0;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
+
function cronBlockedSummary(sessionId) {
|
|
26
|
+
const bridge = activeBridge?.bridge;
|
|
27
|
+
if (!bridge) return { blockedCount: 0, memoryBlocked: false };
|
|
28
|
+
try {
|
|
29
|
+
const res = bridge.listJobs(sessionId ? { sessionId } : void 0);
|
|
30
|
+
const blocked = res.jobs.filter((j) => j.state === "blocked");
|
|
31
|
+
const mem = blocked.find((j) => j.isProcess && j.managedBy === "memory");
|
|
32
|
+
return {
|
|
33
|
+
blockedCount: blocked.length,
|
|
34
|
+
memoryBlocked: Boolean(mem),
|
|
35
|
+
...mem?.error ? { memoryError: mem.error } : {}
|
|
36
|
+
};
|
|
37
|
+
} catch {
|
|
38
|
+
return { blockedCount: 0, memoryBlocked: false };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
25
41
|
|
|
26
42
|
export {
|
|
27
43
|
registerCronPanelBridge,
|
|
28
44
|
currentCronPanelBridge,
|
|
29
|
-
cronActiveCount
|
|
45
|
+
cronActiveCount,
|
|
46
|
+
cronBlockedSummary
|
|
30
47
|
};
|