@cydm/pie 2.8.1 → 4.0.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.
Files changed (42) hide show
  1. package/dist/builtin/extensions/ask-user/index.js +8 -4
  2. package/dist/builtin/extensions/changelog/index.js +2 -2
  3. package/dist/builtin/extensions/cron/index.js +295 -33
  4. package/dist/builtin/extensions/document-attachments/index.js +1 -1
  5. package/dist/builtin/extensions/herdr-agent-state/index.js +2 -2
  6. package/dist/builtin/extensions/im-forward/README.md +20 -5
  7. package/dist/builtin/extensions/im-forward/index.js +415 -142
  8. package/dist/builtin/extensions/memory/index.js +83 -30
  9. package/dist/builtin/extensions/pie-ipc/README.md +2 -2
  10. package/dist/builtin/extensions/pie-ipc/index.js +269 -30
  11. package/dist/builtin/extensions/pie-proc/README.md +93 -0
  12. package/dist/builtin/extensions/pie-proc/index.js +630 -0
  13. package/dist/builtin/extensions/pie-proc/package.json +11 -0
  14. package/dist/builtin/extensions/plan-mode/index.js +4 -4
  15. package/dist/builtin/extensions/subagent/index.js +6 -6
  16. package/dist/builtin/extensions/todo/index.js +4 -4
  17. package/dist/builtin/skills/chrome-devtools-axi/chrome-devtools-axi-bridge.js +106 -2
  18. package/dist/builtin/skills/chrome-devtools-axi/chrome-devtools-axi-cli.js +1 -0
  19. package/dist/builtin/skills/chrome-devtools-axi/chrome-devtools-axi-runtime.js +1 -1
  20. package/dist/builtin/skills/chrome-devtools-axi/{chunk-BNSAEVRT.js → chunk-WOGAQ4P5.js} +2 -2
  21. package/dist/builtin/skills/chrome-devtools-axi/{cli-AO2ZTPRM.js → cli-CHC7XYFU.js} +27 -3
  22. package/dist/builtin/skills/computer-use-axi/computer-use-axi-broker.js +2 -2
  23. package/dist/builtin/skills/computer-use-axi/computer-use-axi-cli.js +1 -0
  24. package/dist/builtin/skills/computer-use-axi/scripts/setup-helper.mjs +6 -2
  25. package/dist/builtin/skills/tui-use/tui-use-daemon.cjs +179 -9
  26. package/dist/chunks/{chunk-PK72LVWQ.js → chunk-FDLLNPIE.js} +143 -53
  27. package/dist/chunks/{chunk-3BC5KGDQ.js → chunk-JQRZLVPY.js} +12 -1
  28. package/dist/chunks/{chunk-GH4VW2OT.js → chunk-NCP264ZE.js} +8 -2
  29. package/dist/chunks/{chunk-YRR6C43W.js → chunk-QX6WS73C.js} +1 -1
  30. package/dist/chunks/{chunk-3NHP7HK5.js → chunk-TDKNKNPL.js} +6 -5
  31. package/dist/chunks/{chunk-GDIYSMTS.js → chunk-UOZHQ73X.js} +25 -17
  32. package/dist/chunks/{chunk-RSL7E4R7.js → chunk-WK4N5HT5.js} +66 -23
  33. package/dist/chunks/chunk-X6LBWHK3.js +37 -0
  34. package/dist/chunks/concierge-cli-PIOGXKDR.js +939 -0
  35. package/dist/chunks/{model-registry-LI5THXV4.js → model-registry-YA6U366L.js} +2 -2
  36. package/dist/chunks/{src-BPSQMSSC.js → src-AB7PLORG.js} +6 -4
  37. package/dist/chunks/{src-YG5M2H44.js → src-ODLT57PQ.js} +2 -2
  38. package/dist/chunks/{src-66XSMIAM.js → src-XSLD2IQ2.js} +1 -1
  39. package/dist/chunks/{src-OPPYTPWG.js → src-ZZZO4HSR.js} +11 -3
  40. package/dist/chunks/{test-stream-JBWXKOQA.js → test-stream-GIUD5JWS.js} +1 -1
  41. package/dist/cli.js +1433 -235
  42. package/package.json +105 -105
@@ -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-GH4VW2OT.js";
5
+ } from "./chunk-NCP264ZE.js";
6
6
  import {
7
7
  FileSystemGateway,
8
8
  detectPlatform,
9
9
  getFileSystemGateway,
10
10
  getPlatformConfig,
11
11
  streamSimple
12
- } from "./chunk-3BC5KGDQ.js";
12
+ } from "./chunk-JQRZLVPY.js";
13
13
  import {
14
14
  Type
15
15
  } from "./chunk-XXGYUYXI.js";
@@ -5083,17 +5083,17 @@ var AgentSessionQueueDispatcher = class {
5083
5083
  }
5084
5084
  options;
5085
5085
  dispatchTimer;
5086
+ /** Epoch-ms deadline of the armed dispatch timer (replacement test). */
5087
+ dispatchTimerDeadline;
5086
5088
  generation = 0;
5087
5089
  pendingDispatch;
5088
5090
  resolvePendingDispatch;
5089
5091
  /** Single-flight: at most one dispatchNext at a time; a wakeup during
5090
- * execution (end hook racing the busy-poll) is remembered and served after
5091
- * it settles instead of overlapping a second concurrent dispatch. */
5092
+ * execution is served after it settles. */
5092
5093
  executing = false;
5093
5094
  wakeupRequested = false;
5094
- /** Busy/policy re-arm backoff (100ms → 800ms cap): streaming can last
5095
- * minutes and a policy hold indefinitely; a flat 100ms poll wakes the
5096
- * process ~10×/s for nothing. Enqueue still re-arms via schedule(). */
5095
+ /** Busy/policy re-arm backoff (100ms → 800ms cap) so a long stream does
5096
+ * not pin a 100ms poll; enqueue still re-arms via schedule(). */
5097
5097
  backoffDelayMs = 100;
5098
5098
  get hasPendingDispatch() {
5099
5099
  return this.dispatchTimer !== void 0 || this.pendingDispatch !== void 0;
@@ -5105,16 +5105,27 @@ var AgentSessionQueueDispatcher = class {
5105
5105
  this.backoffDelayMs = 100;
5106
5106
  this.armTimer(delayMs);
5107
5107
  }
5108
- /** Timer-arming core shared by schedule() and the busy re-arm. */
5108
+ /** Timer-arming core. Replaces an armed timer only for a strictly
5109
+ * earlier deadline: fresh public work never sits out a busy backoff. */
5109
5110
  armTimer(delayMs) {
5110
- if (this.options.getDisposed() || this.options.getRuntimeGuardTriggered() || this.dispatchTimer !== void 0) {
5111
+ if (this.options.getDisposed() || this.options.getRuntimeGuardTriggered()) {
5111
5112
  return;
5112
5113
  }
5114
+ const deadline = Date.now() + Math.max(0, delayMs);
5115
+ if (this.dispatchTimer !== void 0) {
5116
+ if (this.dispatchTimerDeadline === void 0 || deadline >= this.dispatchTimerDeadline) {
5117
+ return;
5118
+ }
5119
+ (this.options.retry?.clearTimeout ?? defaultClearTimeout3)(this.dispatchTimer);
5120
+ this.dispatchTimer = void 0;
5121
+ this.dispatchTimerDeadline = void 0;
5122
+ }
5113
5123
  this.ensurePending();
5114
- const setTimer = this.options.retry?.setTimeout ?? defaultSetTimeout3;
5115
5124
  const generation = this.generation;
5116
- this.dispatchTimer = setTimer(() => {
5125
+ this.dispatchTimerDeadline = deadline;
5126
+ this.dispatchTimer = (this.options.retry?.setTimeout ?? defaultSetTimeout3)(() => {
5117
5127
  this.dispatchTimer = void 0;
5128
+ this.dispatchTimerDeadline = void 0;
5118
5129
  if (this.executing) {
5119
5130
  this.wakeupRequested = true;
5120
5131
  return;
@@ -5135,15 +5146,14 @@ var AgentSessionQueueDispatcher = class {
5135
5146
  cancel() {
5136
5147
  this.generation++;
5137
5148
  if (this.dispatchTimer !== void 0) {
5138
- const clearTimer = this.options.retry?.clearTimeout ?? defaultClearTimeout3;
5139
- clearTimer(this.dispatchTimer);
5149
+ (this.options.retry?.clearTimeout ?? defaultClearTimeout3)(this.dispatchTimer);
5140
5150
  this.dispatchTimer = void 0;
5141
5151
  }
5152
+ this.dispatchTimerDeadline = void 0;
5142
5153
  this.resolvePending();
5143
5154
  }
5144
- /** Busy/policy re-arm: exponential backoff, 100ms → 800ms cap. Bypasses
5145
- * schedule() so the ladder is not reset. True (not-dispatched) when
5146
- * streaming/policy obstruction was found. */
5155
+ /** Busy/policy re-arm: exponential backoff, 100ms → 800ms cap; bypasses
5156
+ * schedule() so the ladder is not reset. */
5147
5157
  busyRearm() {
5148
5158
  if (!this.options.isStreaming() && !this.options.isBlockedByRuntimePolicy()) return false;
5149
5159
  const delay = this.backoffDelayMs;
@@ -5164,9 +5174,7 @@ var AgentSessionQueueDispatcher = class {
5164
5174
  if (generation !== this.generation) return false;
5165
5175
  if (this.options.getDisposed() || this.busyRearm()) return false;
5166
5176
  const queuedInput = this.options.queue.peek();
5167
- if (!queuedInput) {
5168
- return false;
5169
- }
5177
+ if (!queuedInput) return false;
5170
5178
  const decision = await this.options.canDispatchQueuedTurn?.({
5171
5179
  agent: this.options.agent,
5172
5180
  sessionManager: this.options.sessionManager,
@@ -5190,9 +5198,7 @@ var AgentSessionQueueDispatcher = class {
5190
5198
  if (generation !== this.generation) return false;
5191
5199
  if (this.options.getDisposed() || this.busyRearm()) return false;
5192
5200
  const dispatched = this.options.queue.shift();
5193
- if (!dispatched) {
5194
- return false;
5195
- }
5201
+ if (!dispatched) return false;
5196
5202
  this.options.emit({ type: "queued_turn_dispatched", queuedInput: cloneQueuedInput(dispatched) });
5197
5203
  if (!dispatched.deliveredToAgent) {
5198
5204
  const originalMessages = dispatched.messages;
@@ -5228,6 +5234,10 @@ var AgentSessionQueueDispatcher = class {
5228
5234
  }
5229
5235
  return true;
5230
5236
  }
5237
+ /** Test hook: drive one busy re-arm directly. */
5238
+ busyRearmForTest() {
5239
+ return this.busyRearm();
5240
+ }
5231
5241
  ensurePending() {
5232
5242
  if (this.pendingDispatch) return;
5233
5243
  this.pendingDispatch = new Promise((resolve) => {
@@ -9492,6 +9502,35 @@ function observeDelegationTool(observation, event) {
9492
9502
  if (observation.receipts.length > 32) observation.receipts.shift();
9493
9503
  }
9494
9504
 
9505
+ // ../../packages/agent-framework/src/supervisor-anchor.ts
9506
+ var SUPERVISOR_PID_ENV = "PIE_SUPERVISOR_PID";
9507
+ var SUPERVISOR_START_TIME_ENV = "PIE_SUPERVISOR_START_TIME";
9508
+ function parseSupervisorAnchor(env = process.env) {
9509
+ const pidText = env[SUPERVISOR_PID_ENV]?.trim();
9510
+ if (!pidText || !/^\d+$/.test(pidText)) return void 0;
9511
+ const pid = Number(pidText);
9512
+ if (!Number.isSafeInteger(pid) || pid <= 0) return void 0;
9513
+ const startTime = env[SUPERVISOR_START_TIME_ENV]?.trim();
9514
+ return startTime ? { pid, startTime } : { pid };
9515
+ }
9516
+ function isSupervisorGone(anchor, readIdentity) {
9517
+ try {
9518
+ process.kill(anchor.pid, 0);
9519
+ } catch (error) {
9520
+ return error.code === "ESRCH";
9521
+ }
9522
+ if (!readIdentity) return false;
9523
+ let identity;
9524
+ try {
9525
+ identity = readIdentity(anchor.pid);
9526
+ } catch {
9527
+ return false;
9528
+ }
9529
+ if (identity.startTime === void 0) return false;
9530
+ if (anchor.startTime === void 0) return false;
9531
+ return identity.startTime !== anchor.startTime;
9532
+ }
9533
+
9495
9534
  export {
9496
9535
  parseSkillFile,
9497
9536
  createSkill,
@@ -9630,5 +9669,9 @@ export {
9630
9669
  parseDelegationReport,
9631
9670
  observeDelegationPhase,
9632
9671
  createDelegationObservation,
9633
- observeDelegationTool
9672
+ observeDelegationTool,
9673
+ SUPERVISOR_PID_ENV,
9674
+ SUPERVISOR_START_TIME_ENV,
9675
+ parseSupervisorAnchor,
9676
+ isSupervisorGone
9634
9677
  };
@@ -0,0 +1,37 @@
1
+ import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
+
3
+ // src/core/process-identity.ts
4
+ import { execFileSync } from "node:child_process";
5
+ function windowsProbeSpecs(pid) {
6
+ return [
7
+ { file: "wmic", args: ["process", "where", `ProcessId=${pid}`, "get", "CommandLine"] },
8
+ { file: "powershell", args: ["-NoProfile", "-NonInteractive", "-Command", `(Get-CimInstance Win32_Process -Filter "ProcessId=${pid}").CommandLine`] }
9
+ ];
10
+ }
11
+ function probeWindows(pid, exec) {
12
+ let sawTool = false;
13
+ for (const spec of windowsProbeSpecs(pid)) {
14
+ let out;
15
+ try {
16
+ out = exec(spec.file, spec.args, { encoding: "utf8", timeout: 3e3, stdio: ["ignore", "pipe", "pipe"] });
17
+ } catch (error) {
18
+ const code = error.code;
19
+ if (code === "ENOENT") continue;
20
+ continue;
21
+ }
22
+ return out;
23
+ }
24
+ return void 0;
25
+ }
26
+ function readProcessCommandLine(pid, exec = execFileSync) {
27
+ if (process.platform === "win32") return probeWindows(pid, exec);
28
+ try {
29
+ return exec("ps", ["-p", String(pid), "-o", "command="], { encoding: "utf8", timeout: 3e3 });
30
+ } catch {
31
+ return void 0;
32
+ }
33
+ }
34
+
35
+ export {
36
+ readProcessCommandLine
37
+ };