@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
@@ -6,10 +6,10 @@ import {
6
6
  createPlanCapability,
7
7
  markCompletedPlanSteps,
8
8
  restoreExecutionState
9
- } from "../../../chunks/chunk-DBDU3RRN.js";
10
- import "../../../chunks/chunk-LRHNAG4V.js";
11
- import "../../../chunks/chunk-BA4Z27XT.js";
12
- import "../../../chunks/chunk-4UIUMTHG.js";
9
+ } from "../../../chunks/chunk-HK3FHIAH.js";
10
+ import "../../../chunks/chunk-5QMS6RQC.js";
11
+ import "../../../chunks/chunk-BQWHLYYZ.js";
12
+ import "../../../chunks/chunk-G2K4GY6N.js";
13
13
  import {
14
14
  Type
15
15
  } from "../../../chunks/chunk-XXGYUYXI.js";
@@ -5,19 +5,19 @@ import {
5
5
  createCliRetryPolicy,
6
6
  formatTransportLifecycle,
7
7
  logTransportLifecycle
8
- } from "../../../chunks/chunk-EEC5PJTC.js";
8
+ } from "../../../chunks/chunk-7LICWWUE.js";
9
9
  import {
10
10
  SUBAGENT_SESSION_RECORD_VERSION,
11
11
  createPolicyEnforcedTools,
12
12
  createSharedFileSystemTools,
13
13
  createSubagentCapability
14
- } from "../../../chunks/chunk-DBDU3RRN.js";
15
- import "../../../chunks/chunk-LRHNAG4V.js";
16
- import "../../../chunks/chunk-BA4Z27XT.js";
14
+ } from "../../../chunks/chunk-HK3FHIAH.js";
15
+ import "../../../chunks/chunk-5QMS6RQC.js";
16
+ import "../../../chunks/chunk-BQWHLYYZ.js";
17
17
  import {
18
18
  getConfigDir
19
19
  } from "../../../chunks/chunk-CBDQJMUI.js";
20
- import "../../../chunks/chunk-4UIUMTHG.js";
20
+ import "../../../chunks/chunk-G2K4GY6N.js";
21
21
  import "../../../chunks/chunk-XXGYUYXI.js";
22
22
  import "../../../chunks/chunk-LZQXQOPJ.js";
23
23
 
@@ -8,10 +8,10 @@ import {
8
8
  executeManageTodoList,
9
9
  executionStateToTodos,
10
10
  restoreExecutionState
11
- } from "../../../chunks/chunk-DBDU3RRN.js";
12
- import "../../../chunks/chunk-LRHNAG4V.js";
13
- import "../../../chunks/chunk-BA4Z27XT.js";
14
- import "../../../chunks/chunk-4UIUMTHG.js";
11
+ } from "../../../chunks/chunk-HK3FHIAH.js";
12
+ import "../../../chunks/chunk-5QMS6RQC.js";
13
+ import "../../../chunks/chunk-BQWHLYYZ.js";
14
+ import "../../../chunks/chunk-G2K4GY6N.js";
15
15
  import "../../../chunks/chunk-XXGYUYXI.js";
16
16
  import "../../../chunks/chunk-LZQXQOPJ.js";
17
17
 
@@ -8395,7 +8395,7 @@ async function verifyProfileHolderDetailed(pid, profile) {
8395
8395
  }
8396
8396
  if (process.platform === "darwin") {
8397
8397
  return await new Promise((resolve2) => {
8398
- execFile("ps", ["-o", "command=", "-p", String(pid)], { timeout: 1500 }, (error, stdout) => {
8398
+ execFile("ps", ["-ww", "-o", "command=", "-p", String(pid)], { timeout: 1500 }, (error, stdout) => {
8399
8399
  if (error) {
8400
8400
  resolve2(pidStillAlive(pid) ? "unknown" : "no_match");
8401
8401
  return;
@@ -8405,7 +8405,7 @@ async function verifyProfileHolderDetailed(pid, profile) {
8405
8405
  resolve2(pidStillAlive(pid) ? "unknown" : "no_match");
8406
8406
  return;
8407
8407
  }
8408
- resolve2(commandIncludesExactUserDataDir(command, profile) ? "match" : "no_match");
8408
+ resolve2(evaluateMacOsPsCommand(command, profile));
8409
8409
  });
8410
8410
  });
8411
8411
  }
@@ -8468,25 +8468,97 @@ function commandIncludesExactUserDataDir(command, profile) {
8468
8468
  const exactFlag = `--user-data-dir=${profile}`;
8469
8469
  return tokens.some((arg, i) => arg === exactFlag || arg === "--user-data-dir" && tokens[i + 1] === profile);
8470
8470
  }
8471
- async function terminateVerifiedPid(pid) {
8471
+ function evaluateMacOsPsCommand(command, profile) {
8472
+ const hasAmbiguousProfileChars = /[\s'"]/.test(profile);
8473
+ if (!hasAmbiguousProfileChars && commandIncludesExactUserDataDir(command, profile)) {
8474
+ return "match";
8475
+ }
8476
+ if (hasAmbiguousProfileChars && command.includes(profile)) {
8477
+ return "unknown";
8478
+ }
8479
+ if (tokenizeCommandLine(command) === void 0) {
8480
+ return "unknown";
8481
+ }
8482
+ return "no_match";
8483
+ }
8484
+ async function readProcessStartSignature(pid) {
8472
8485
  if (process.platform === "win32") {
8486
+ return await new Promise((resolve2) => {
8487
+ execFile(
8488
+ "powershell.exe",
8489
+ [
8490
+ "-NoProfile",
8491
+ "-NonInteractive",
8492
+ "-Command",
8493
+ `Get-CimInstance Win32_Process -Filter "ProcessId=${pid}" | Select-Object -ExpandProperty CreationDate`
8494
+ ],
8495
+ { timeout: 2500, windowsHide: true },
8496
+ (error, stdout) => {
8497
+ if (error) {
8498
+ resolve2(null);
8499
+ return;
8500
+ }
8501
+ const sig = String(stdout ?? "").trim();
8502
+ resolve2(sig || null);
8503
+ }
8504
+ );
8505
+ });
8506
+ }
8507
+ return await new Promise((resolve2) => {
8508
+ execFile("ps", ["-o", "lstart=", "-p", String(pid)], { timeout: 1500 }, (error, stdout) => {
8509
+ if (error) {
8510
+ resolve2(null);
8511
+ return;
8512
+ }
8513
+ const sig = String(stdout ?? "").trim();
8514
+ resolve2(sig || null);
8515
+ });
8516
+ });
8517
+ }
8518
+ async function terminateVerifiedPid(pid, guard) {
8519
+ const verifyHolder = guard?.verifyHolder ?? verifyProfileHolderDetailed;
8520
+ const readStartSig = guard?.readStartSignature ?? readProcessStartSignature;
8521
+ const sendKill = guard?.kill ?? ((targetPid, signal) => {
8522
+ process.kill(targetPid, signal);
8523
+ });
8524
+ const sleep4 = guard?.sleep ?? ((ms) => new Promise((resolve2) => setTimeout(resolve2, ms)));
8525
+ const stillOwned = async () => {
8526
+ if (!guard) return true;
8527
+ if (await verifyHolder(pid, guard.profile) !== "match") return false;
8528
+ if (guard.expectedStartSignature) {
8529
+ const currentSig = await readStartSig(pid);
8530
+ if (!currentSig || currentSig !== guard.expectedStartSignature) return false;
8531
+ }
8532
+ return true;
8533
+ };
8534
+ if (!await stillOwned()) return false;
8535
+ if (process.platform === "win32" && !guard?.kill) {
8473
8536
  await new Promise((resolve2) => {
8474
8537
  execFile("taskkill.exe", ["/PID", String(pid), "/T", "/F"], { windowsHide: true, timeout: 3e3 }, () => resolve2());
8475
8538
  });
8476
- return;
8539
+ return true;
8477
8540
  }
8478
8541
  try {
8479
- process.kill(pid, "SIGTERM");
8542
+ sendKill(pid, "SIGTERM");
8480
8543
  } catch {
8481
8544
  }
8482
- await new Promise((resolve2) => setTimeout(resolve2, 400));
8483
- if (pidStillAlive(pid)) {
8545
+ await sleep4(400);
8546
+ let alive = false;
8547
+ try {
8548
+ sendKill(pid, 0);
8549
+ alive = true;
8550
+ } catch (error) {
8551
+ alive = error.code === "EPERM";
8552
+ }
8553
+ if (alive) {
8554
+ if (!await stillOwned()) return false;
8484
8555
  try {
8485
- process.kill(pid, "SIGKILL");
8556
+ sendKill(pid, "SIGKILL");
8486
8557
  } catch {
8487
8558
  }
8488
- await new Promise((resolve2) => setTimeout(resolve2, 300));
8559
+ await sleep4(300);
8489
8560
  }
8561
+ return true;
8490
8562
  }
8491
8563
  async function signalTreeOfProfile(profile, signal) {
8492
8564
  const scan = await scanProfileHolders(profile);
@@ -8983,11 +9055,12 @@ async function sweepOrphanedManagedBrowser() {
8983
9055
  return;
8984
9056
  }
8985
9057
  const pidVerified = pid !== void 0 && await manifestPidIsOurBrowser(pid, resolved);
9058
+ const pidStartSignature = pidVerified && pid !== void 0 ? await readProcessStartSignature(pid) : null;
8986
9059
  if (port && pidVerified) {
8987
9060
  await requestBrowserClose(port).catch(() => void 0);
8988
9061
  }
8989
9062
  if (pidVerified && pid !== void 0) {
8990
- await terminateVerifiedPid(pid);
9063
+ await terminateVerifiedPid(pid, { profile: resolved, expectedStartSignature: pidStartSignature });
8991
9064
  }
8992
9065
  await releaseOwnedBrowser(void 0, void 0, resolved);
8993
9066
  clearManagedBrowserManifest();
@@ -2,14 +2,14 @@ import { createRequire as __createRequire } from "node:module"; const require =
2
2
  import {
3
3
  createAgentOperationError,
4
4
  getAgentFailureMetadata
5
- } from "./chunk-BA4Z27XT.js";
5
+ } from "./chunk-BQWHLYYZ.js";
6
6
  import {
7
7
  FileSystemGateway,
8
8
  detectPlatform,
9
9
  getFileSystemGateway,
10
10
  getPlatformConfig,
11
11
  streamSimple
12
- } from "./chunk-4UIUMTHG.js";
12
+ } from "./chunk-G2K4GY6N.js";
13
13
  import {
14
14
  Type
15
15
  } from "./chunk-XXGYUYXI.js";
@@ -6243,6 +6243,8 @@ async function runAgentSessionControllerAutoCompact(params) {
6243
6243
  }
6244
6244
  if (!result?.aborted && runAfterAgentEndHook) {
6245
6245
  await params.handleAgentEndHook(params.agent.state.messages.slice());
6246
+ } else if (result?.aborted && !cancelOnAbort && runAfterAgentEndHook) {
6247
+ params.scheduleQueuedTurn?.();
6246
6248
  }
6247
6249
  }
6248
6250
  return result;
@@ -6615,6 +6617,9 @@ var AgentSessionController = class {
6615
6617
  await this.continue();
6616
6618
  },
6617
6619
  handleAgentEndHook: (messages) => this.handleAgentEndHook(messages),
6620
+ scheduleQueuedTurn: () => {
6621
+ if (this.queue.length > 0) this.queueDispatcher.schedule();
6622
+ },
6618
6623
  emitSettled: options?.emitSettled,
6619
6624
  runAfterAgentEndHook: options?.runAfterAgentEndHook,
6620
6625
  cancelOnAbort: options?.cancelOnAbort
@@ -6,10 +6,10 @@ import {
6
6
  createSharedWebSearchTool,
7
7
  defaultShellKindForPlatform,
8
8
  interpretShellExit
9
- } from "./chunk-DBDU3RRN.js";
9
+ } from "./chunk-HK3FHIAH.js";
10
10
  import {
11
11
  requestInteraction
12
- } from "./chunk-LRHNAG4V.js";
12
+ } from "./chunk-5QMS6RQC.js";
13
13
  import {
14
14
  getBuiltinDir,
15
15
  getConfigDir
@@ -18,7 +18,7 @@ import {
18
18
  EMPTY_ASSISTANT_CONTENT_ERROR,
19
19
  OPENAI_COMPAT_PROTOCOL_ERROR_CODE,
20
20
  getLogger
21
- } from "./chunk-4UIUMTHG.js";
21
+ } from "./chunk-G2K4GY6N.js";
22
22
  import {
23
23
  Type
24
24
  } from "./chunk-XXGYUYXI.js";