@cydm/pie 4.9.0 → 4.10.1

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.
Files changed (31) hide show
  1. package/dist/builtin/extensions/ask-user/index.js +4 -4
  2. package/dist/builtin/extensions/im-forward/index.js +126 -74
  3. package/dist/builtin/extensions/memory/index.js +5 -5
  4. package/dist/builtin/extensions/pie-ipc/index.js +5 -5
  5. package/dist/builtin/extensions/pie-proc/index.js +336 -102
  6. package/dist/builtin/extensions/plan-mode/index.js +4 -4
  7. package/dist/builtin/extensions/subagent/index.js +5 -5
  8. package/dist/builtin/extensions/todo/index.js +4 -4
  9. package/dist/builtin/skills/computer-use-axi/computer-use-axi-broker.js +83 -10
  10. package/dist/chunks/{chunk-LRHNAG4V.js → chunk-5QMS6RQC.js} +7 -2
  11. package/dist/chunks/{chunk-EEC5PJTC.js → chunk-7LICWWUE.js} +3 -3
  12. package/dist/chunks/chunk-BB7ETSJK.js +463 -0
  13. package/dist/chunks/{chunk-BA4Z27XT.js → chunk-BQWHLYYZ.js} +1 -1
  14. package/dist/chunks/{chunk-Z5KL6AO2.js → chunk-BTUMBUDU.js} +2 -2
  15. package/dist/chunks/{chunk-WYXUF4MP.js → chunk-FC5AN5QP.js} +22 -1
  16. package/dist/chunks/{chunk-4UIUMTHG.js → chunk-G2K4GY6N.js} +1 -1
  17. package/dist/chunks/{chunk-DBDU3RRN.js → chunk-HK3FHIAH.js} +3 -3
  18. package/dist/chunks/{chunk-WBL73KRI.js → chunk-KWK7KTSZ.js} +1 -0
  19. package/dist/chunks/{chunk-PN6B54VT.js → chunk-XMTRKMBG.js} +6 -6
  20. package/dist/chunks/{host-image-fallback-RASJSVZY.js → host-image-fallback-3TEMOQM5.js} +1 -1
  21. package/dist/chunks/{manager-cli-Y6HM3MHA.js → manager-cli-UU6SDS3F.js} +1 -1
  22. package/dist/chunks/{manager-upgrade-LSTOHBUV.js → manager-upgrade-XPFXKO7A.js} +64 -39
  23. package/dist/chunks/{model-registry-5TLYILYR.js → model-registry-QKJ3YVDS.js} +2 -2
  24. package/dist/chunks/{read-file-understanding-VPKDBV23.js → read-file-understanding-N2ZZQLTZ.js} +5 -5
  25. package/dist/chunks/{src-6QGGDHIW.js → src-3PSR2AAX.js} +3 -3
  26. package/dist/chunks/{src-2XI5P62J.js → src-D5GN4Q5O.js} +2 -2
  27. package/dist/chunks/{src-DI4MCAGT.js → src-F5N6O2HR.js} +4 -4
  28. package/dist/chunks/{src-CCEENRKC.js → src-TIDKYA5F.js} +1 -1
  29. package/dist/chunks/{test-stream-SYVWIPPW.js → test-stream-JAJHK44G.js} +1 -1
  30. package/dist/cli.js +2379 -1045
  31. package/package.json +1 -1
@@ -1,4 +1,10 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
+ import {
3
+ normalizePreInstallStopOutcome,
4
+ resolveDefaultTuiUsePidFile,
5
+ runWindowsPreInstallStop,
6
+ scanBlockingWindowsPeers
7
+ } from "./chunk-BB7ETSJK.js";
2
8
  import {
3
9
  readProcessCommandLine
4
10
  } from "./chunk-7RJXKN7N.js";
@@ -245,22 +251,28 @@ async function performUpgrade(paths, effects, options) {
245
251
  stage = s;
246
252
  }, build));
247
253
  }
254
+ let stoppedBeforeInstall = false;
248
255
  if (effects.preInstallStop) {
249
- const stopped = effects.preInstallStop(state);
250
- if (stopped === "refused") {
251
- return finish(build("install", "refused: could not stop the resident/workers before install (Windows file locks); check pie manager status and retry"));
256
+ const stopped = normalizePreInstallStopOutcome(effects.preInstallStop(state));
257
+ if (stopped.status === "refused") {
258
+ return finish(build("install", stopped.detail || "refused: could not stop the resident/workers before install (Windows file locks); check pie manager status and retry"));
259
+ }
260
+ if (stopped.status === "stopped") {
261
+ stoppedBeforeInstall = true;
262
+ effects.log("windows: resident/workers stopped before install (native-module file locks)");
252
263
  }
253
- if (stopped === "stopped") effects.log("windows: resident/workers stopped before install (native-module file locks)");
254
264
  }
255
265
  const install = effects.npmInstall(toVersion);
256
266
  if (install.code !== 0) {
267
+ const recovery = stoppedBeforeInstall ? "\n(Windows: manager was stopped before install; run `pie manager start` or retry `pie manager upgrade`.)" : "";
257
268
  return finish(build("install", `npm install @cydm/pie@${toVersion} failed (exit ${install.code}):
258
- ${install.tail}`));
269
+ ${install.tail}${recovery}`));
259
270
  }
260
271
  const target = effects.installTargetCheck();
261
272
  if (!target.ok) {
273
+ const recovery = stoppedBeforeInstall ? "\n(Windows: manager was stopped before install; run `pie manager start` or retry `pie manager upgrade`.)" : "";
262
274
  return finish(build("install", `install target mismatch \u2014 restart skipped:
263
- ${target.detail}`));
275
+ ${target.detail}${recovery}`));
264
276
  }
265
277
  return finish(await restartAndRecycle(effects, paths, state, fromVersion, toVersion, (s) => {
266
278
  stage = s;
@@ -589,54 +601,67 @@ function cliEffects(paths, log) {
589
601
  },
590
602
  scanWorkers: () => scanWorkers(paths.discoveryDir),
591
603
  retireWorkerIfStillIdle: (peer) => {
604
+ const isPidAlive = (pid) => {
605
+ try {
606
+ process.kill(pid, 0);
607
+ return true;
608
+ } catch (error) {
609
+ return error.code !== "ESRCH";
610
+ }
611
+ };
592
612
  const fresh = readDiscoveryEntry(paths.discoveryDir, peer.file);
593
- if (!fresh || fresh.pid !== peer.pid) return "gone";
613
+ if (!fresh || fresh.pid !== peer.pid) return isPidAlive(peer.pid) ? "unknown" : "gone";
594
614
  if (fresh.unattended !== true || fresh.isManager === true) return "foreign";
595
615
  if (fresh.state !== "idle") return "busy";
596
- if (residentCommandLineLooksLikePie(peer.pid) === void 0) return "foreign";
616
+ const cmdline = readProcessCommandLine(peer.pid);
617
+ if (cmdline === void 0) return isPidAlive(peer.pid) ? "unknown" : "gone";
618
+ if (!cmdline || !/json-events/.test(cmdline) || !/--idle/.test(cmdline)) return "foreign";
597
619
  const updatedAt = typeof fresh.updatedAt === "number" ? fresh.updatedAt : peer.updatedAt;
598
620
  const startedAt = processStartedAt(peer.pid);
599
621
  if (updatedAt !== void 0 && startedAt !== void 0 && startedAt > updatedAt + 1e4) return "foreign";
600
622
  try {
601
623
  process.kill(peer.pid, process.platform === "win32" ? void 0 : "SIGTERM");
602
624
  return "retired";
603
- } catch {
604
- return "gone";
625
+ } catch (error) {
626
+ return error.code === "ESRCH" ? "gone" : "failed";
605
627
  }
606
628
  },
607
629
  writeResult: (result) => writeResultAtomic(paths.resultFile, result, log),
608
630
  tryLock: () => tryLockWithReclamation(paths.lockFile),
609
631
  unlock: () => unlockOwned(paths.lockFile),
610
- ...process.platform === "win32" ? { preInstallStop: (state) => {
611
- let touched = false;
612
- for (const peer of partitionWorkers(effects.scanWorkers()).recycle) {
613
- if (effects.retireWorkerIfStillIdle(peer) === "retired") {
614
- touched = true;
615
- effects.log(`windows pre-install: retired idle worker pid ${peer.pid} (${peer.name})`);
616
- }
617
- }
618
- if (state.service === true) {
619
- try {
620
- spawnSync("schtasks", ["/End", "/TN", "dev.pie.manager"], { encoding: "utf8", timeout: 2e4, windowsHide: true });
621
- touched = true;
622
- } catch (error) {
623
- log(`windows pre-install: schtasks /End failed: ${error instanceof Error ? error.message : String(error)}`);
624
- return "refused";
625
- }
626
- } else {
627
- const status = effects.residentStatus(state);
628
- if (status === "foreign" || status === "unknown") return "refused";
629
- if (status === "alive") {
630
- const stopped = effects.terminateResident(state);
631
- if (stopped !== "terminated" && stopped !== "dead") return "refused";
632
- if (stopped === "terminated" && typeof state.pid === "number") {
633
- if (!effects.waitExit(state.pid, 2e4)) log(`windows pre-install: resident pid ${state.pid} did not exit within 20s; npm may still hit file locks`);
632
+ ...process.platform === "win32" ? {
633
+ preInstallStop: (state) => runWindowsPreInstallStop(state, {
634
+ scanBlockingPeers: (s) => scanBlockingWindowsPeers(paths.discoveryDir, s.sessionId, s.pid, {
635
+ tuiUsePidFile: resolveDefaultTuiUsePidFile()
636
+ }),
637
+ scanIdleWorkers: () => partitionWorkers(effects.scanWorkers()).recycle,
638
+ retireWorkerIfStillIdle: (peer) => effects.retireWorkerIfStillIdle(peer),
639
+ findManagerResident: (sid) => findManagerResident(paths.discoveryDir, sid),
640
+ residentStatus: (s) => effects.residentStatus(s),
641
+ terminateResident: (s) => effects.terminateResident(s),
642
+ endServiceTask: () => {
643
+ const r = spawnSync("schtasks", ["/End", "/TN", "dev.pie.manager"], { encoding: "utf8", timeout: 2e4, windowsHide: true });
644
+ return {
645
+ status: r.status,
646
+ detail: `${r.stdout ?? ""} ${r.stderr ?? ""}`.trim().slice(0, 200),
647
+ ...r.error ? { spawnError: r.error.message } : {}
648
+ };
649
+ },
650
+ waitExit: (pid, timeoutMs) => effects.waitExit(pid, timeoutMs),
651
+ isPidAlive: (pid) => {
652
+ try {
653
+ process.kill(pid, 0);
654
+ return true;
655
+ } catch (error) {
656
+ return error.code !== "ESRCH";
634
657
  }
635
- touched = true;
636
- }
637
- }
638
- return touched ? "stopped" : "unnecessary";
639
- } } : {},
658
+ },
659
+ settleAfterStop: () => {
660
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 300);
661
+ },
662
+ log
663
+ })
664
+ } : {},
640
665
  log
641
666
  };
642
667
  return effects;
@@ -4,9 +4,9 @@ import {
4
4
  assertNoSecretSubstrings,
5
5
  configuredRemoteCredentialValues,
6
6
  loadResolvedModelsConfig
7
- } from "./chunk-WYXUF4MP.js";
7
+ } from "./chunk-FC5AN5QP.js";
8
8
  import "./chunk-CBDQJMUI.js";
9
- import "./chunk-4UIUMTHG.js";
9
+ import "./chunk-G2K4GY6N.js";
10
10
  import "./chunk-XXGYUYXI.js";
11
11
  import "./chunk-LZQXQOPJ.js";
12
12
  export {
@@ -1,12 +1,12 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  understandReadFile
4
- } from "./chunk-Z5KL6AO2.js";
5
- import "./chunk-DBDU3RRN.js";
6
- import "./chunk-LRHNAG4V.js";
7
- import "./chunk-BA4Z27XT.js";
4
+ } from "./chunk-BTUMBUDU.js";
5
+ import "./chunk-HK3FHIAH.js";
6
+ import "./chunk-5QMS6RQC.js";
7
+ import "./chunk-BQWHLYYZ.js";
8
8
  import "./chunk-F7EBZTZO.js";
9
- import "./chunk-4UIUMTHG.js";
9
+ import "./chunk-G2K4GY6N.js";
10
10
  import "./chunk-XXGYUYXI.js";
11
11
  import "./chunk-LZQXQOPJ.js";
12
12
  export {
@@ -142,9 +142,9 @@ import {
142
142
  substituteArgs,
143
143
  validateRetainedTailEntries,
144
144
  verifyPreparedCompactionCommit
145
- } from "./chunk-LRHNAG4V.js";
146
- import "./chunk-BA4Z27XT.js";
147
- import "./chunk-4UIUMTHG.js";
145
+ } from "./chunk-5QMS6RQC.js";
146
+ import "./chunk-BQWHLYYZ.js";
147
+ import "./chunk-G2K4GY6N.js";
148
148
  import "./chunk-XXGYUYXI.js";
149
149
  import "./chunk-LZQXQOPJ.js";
150
150
  export {
@@ -8,8 +8,8 @@ import {
8
8
  createToolCallerIdentity,
9
9
  getAgentFailureMetadata,
10
10
  getToolCallerIdentity
11
- } from "./chunk-BA4Z27XT.js";
12
- import "./chunk-4UIUMTHG.js";
11
+ } from "./chunk-BQWHLYYZ.js";
12
+ import "./chunk-G2K4GY6N.js";
13
13
  import "./chunk-XXGYUYXI.js";
14
14
  import "./chunk-LZQXQOPJ.js";
15
15
  export {
@@ -221,12 +221,12 @@ import {
221
221
  understandFileWithModel,
222
222
  validateTodos,
223
223
  writeJournalNarrative
224
- } from "./chunk-DBDU3RRN.js";
225
- import "./chunk-LRHNAG4V.js";
226
- import "./chunk-BA4Z27XT.js";
224
+ } from "./chunk-HK3FHIAH.js";
225
+ import "./chunk-5QMS6RQC.js";
226
+ import "./chunk-BQWHLYYZ.js";
227
227
  import {
228
228
  hashText
229
- } from "./chunk-4UIUMTHG.js";
229
+ } from "./chunk-G2K4GY6N.js";
230
230
  import "./chunk-XXGYUYXI.js";
231
231
  import "./chunk-LZQXQOPJ.js";
232
232
  export {
@@ -77,7 +77,7 @@ import {
77
77
  validateExplicitThinkingSelection,
78
78
  validateToolArguments,
79
79
  validateToolCall
80
- } from "./chunk-4UIUMTHG.js";
80
+ } from "./chunk-G2K4GY6N.js";
81
81
  import {
82
82
  Type
83
83
  } from "./chunk-XXGYUYXI.js";
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  EventStream
4
- } from "./chunk-4UIUMTHG.js";
4
+ } from "./chunk-G2K4GY6N.js";
5
5
  import "./chunk-XXGYUYXI.js";
6
6
  import "./chunk-LZQXQOPJ.js";
7
7