@cydm/pie 4.4.2 → 4.5.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 (48) hide show
  1. package/dist/builtin/extensions/ask-user/index.js +6 -6
  2. package/dist/builtin/extensions/changelog/index.js +1 -1
  3. package/dist/builtin/extensions/cron/index.js +55 -7
  4. package/dist/builtin/extensions/document-attachments/index.js +1 -1
  5. package/dist/builtin/extensions/herdr-agent-state/index.js +1 -1
  6. package/dist/builtin/extensions/im-forward/README.md +3 -1
  7. package/dist/builtin/extensions/im-forward/index.js +364 -118
  8. package/dist/builtin/extensions/init/index.js +1 -1
  9. package/dist/builtin/extensions/mcp-adapter/index.js +2 -2
  10. package/dist/builtin/extensions/memory/index.js +9 -11
  11. package/dist/builtin/extensions/pie-ipc/index.js +70 -19
  12. package/dist/builtin/extensions/pie-proc/index.js +27 -13
  13. package/dist/builtin/extensions/plan-mode/index.js +6 -6
  14. package/dist/builtin/extensions/subagent/index.js +9 -11
  15. package/dist/builtin/extensions/todo/index.js +6 -6
  16. package/dist/builtin/skills/chrome-devtools-axi/SKILL.md +24 -1
  17. package/dist/builtin/skills/chrome-devtools-axi/chrome-devtools-axi-bridge.js +86 -21
  18. package/dist/builtin/skills/chrome-devtools-axi/chrome-devtools-axi-cli.js +6 -1
  19. package/dist/builtin/skills/chrome-devtools-axi/chrome-devtools-axi-runtime.js +1 -1
  20. package/dist/builtin/skills/chrome-devtools-axi/{cli-CHC7XYFU.js → cli-NLPMVDGG.js} +32 -4
  21. package/dist/builtin/skills/computer-use-axi/computer-use-axi-broker.js +220 -22
  22. package/dist/chunks/{auth-storage-RABPRJ6T.js → auth-storage-C3FZMT7J.js} +3 -3
  23. package/dist/chunks/{chunk-OFLKAWI4.js → chunk-2CJIENLY.js} +90 -100
  24. package/dist/chunks/{chunk-R7VO46EK.js → chunk-3W3SXVPB.js} +5 -4
  25. package/dist/chunks/{chunk-IPLMGAML.js → chunk-5KI4Y4LA.js} +1 -1
  26. package/dist/chunks/{chunk-YNTIOWCD.js → chunk-BLDI2GRF.js} +5 -5
  27. package/dist/chunks/{chunk-UCKOXAME.js → chunk-CBDQJMUI.js} +9 -44
  28. package/dist/chunks/chunk-CGSFBWOM.js +100 -0
  29. package/dist/chunks/{chunk-7LTQLJJF.js → chunk-LAJXWOKS.js} +15 -10
  30. package/dist/chunks/{chunk-RZGYXAJU.js → chunk-LZQXQOPJ.js} +1 -12
  31. package/dist/chunks/{chunk-EQOI6RZV.js → chunk-NHV2CALB.js} +3 -5
  32. package/dist/chunks/{chunk-OV7SLSHR.js → chunk-SW2E33UL.js} +2 -4
  33. package/dist/chunks/{chunk-BPSCGGVF.js → chunk-XXGYUYXI.js} +1 -1
  34. package/dist/chunks/{chunk-XO3NM7BB.js → chunk-Y3I2UV5Y.js} +3 -3
  35. package/dist/chunks/{chunk-IZDNZW3S.js → chunk-Z2FKA2ZH.js} +8 -8
  36. package/dist/chunks/chunk-ZPJ3BNQB.js +126 -0
  37. package/dist/chunks/{config-HF2PDLN5.js → config-4EOI5NOU.js} +2 -4
  38. package/dist/chunks/{manager-cli-BYCF4RKN.js → manager-cli-2ATPC47M.js} +35 -5
  39. package/dist/chunks/manager-upgrade-5CPKTRJ7.js +562 -0
  40. package/dist/chunks/{model-registry-7FNIUYPF.js → model-registry-3XAHXXTA.js} +5 -5
  41. package/dist/chunks/{src-OVWRBWKU.js → src-B44QWSGM.js} +4 -4
  42. package/dist/chunks/{src-A5YI46OD.js → src-CLE5ILN4.js} +6 -6
  43. package/dist/chunks/{src-OA3TP6DS.js → src-EGXFJ3WA.js} +5 -5
  44. package/dist/chunks/{src-TF2RAGRU.js → src-Q7LU27C2.js} +3 -3
  45. package/dist/chunks/{test-stream-7YZDGBPO.js → test-stream-OR3EJBNF.js} +3 -3
  46. package/dist/cli.js +173 -136
  47. package/package.json +3 -3
  48. package/dist/chunks/chunk-7KLWHWZD.js +0 -164
@@ -1,12 +1,12 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  createAskUserCapability
4
- } from "../../../chunks/chunk-YNTIOWCD.js";
5
- import "../../../chunks/chunk-XO3NM7BB.js";
6
- import "../../../chunks/chunk-IPLMGAML.js";
7
- import "../../../chunks/chunk-R7VO46EK.js";
8
- import "../../../chunks/chunk-BPSCGGVF.js";
9
- import "../../../chunks/chunk-RZGYXAJU.js";
4
+ } from "../../../chunks/chunk-BLDI2GRF.js";
5
+ import "../../../chunks/chunk-Y3I2UV5Y.js";
6
+ import "../../../chunks/chunk-5KI4Y4LA.js";
7
+ import "../../../chunks/chunk-3W3SXVPB.js";
8
+ import "../../../chunks/chunk-XXGYUYXI.js";
9
+ import "../../../chunks/chunk-LZQXQOPJ.js";
10
10
 
11
11
  // builtin/extensions/ask-user/index.ts
12
12
  function askUserExtension(ctx) {
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
- import "../../../chunks/chunk-RZGYXAJU.js";
2
+ import "../../../chunks/chunk-LZQXQOPJ.js";
3
3
 
4
4
  // builtin/extensions/changelog/index.ts
5
5
  import * as fs from "node:fs";
@@ -1,8 +1,8 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  Type
4
- } from "../../../chunks/chunk-BPSCGGVF.js";
5
- import "../../../chunks/chunk-RZGYXAJU.js";
4
+ } from "../../../chunks/chunk-XXGYUYXI.js";
5
+ import "../../../chunks/chunk-LZQXQOPJ.js";
6
6
 
7
7
  // builtin/extensions/cron/index.ts
8
8
  import * as path4 from "node:path";
@@ -311,6 +311,8 @@ var Store = class {
311
311
  validateState(s) {
312
312
  if (s.version !== 1 || !Array.isArray(s.jobs) || !s.owners || typeof s.owners !== "object") throw new Error("invalid cron state; manual recovery required");
313
313
  if (Array.isArray(s.owners) || s.jobs.length > 100 || Object.keys(s.owners).length > 1e3) throw new Error("cron state exceeds record limit");
314
+ if (s.managedEnabled !== void 0 && (!s.managedEnabled || typeof s.managedEnabled !== "object" || Array.isArray(s.managedEnabled) || Object.keys(s.managedEnabled).length > 100 || Object.entries(s.managedEnabled).some(([key, value]) => !this.validManagedKey(key) || typeof value !== "boolean")))
315
+ throw new Error("invalid managed schedule intent; manual recovery required");
314
316
  const ids = /* @__PURE__ */ new Set();
315
317
  for (const j of s.jobs) {
316
318
  if (!j || typeof j.id !== "string" || ids.has(j.id) || typeof j.sessionId !== "string" || !j.sessionId || j.sessionId.length > 256 || typeof j.cwd !== "string" || !path.isAbsolute(j.cwd) || typeof j.prompt !== "string" || !j.prompt.trim() || j.prompt.length > 16e3 || typeof j.enabled !== "boolean" || !["ready", "running", "blocked"].includes(j.state) || j.remaining !== void 0 && (!Number.isSafeInteger(j.remaining) || j.remaining < 0 || j.remaining > 1e3) || j.next !== null && !Number.isSafeInteger(j.next) || j.authorization !== void 0 && !["dialog", "yolo", "unattended"].includes(j.authorization) || j.retriedOnce !== void 0 && typeof j.retriedOnce !== "boolean" || j.noticedError !== void 0 && typeof j.noticedError !== "string") throw new Error("invalid cron job; manual recovery required");
@@ -393,6 +395,37 @@ var Store = class {
393
395
  * replaced: removing its reservation would let another execution start
394
396
  * while the original worker is still alive (single-outstanding invariant). */
395
397
  addProcess(command, managedBy, cwd, schedule, now = Date.now(), opts) {
398
+ return this.registerProcess(command, managedBy, cwd, schedule, now, opts);
399
+ }
400
+ /** Default registration never replaces an existing record, including paused/blocked. */
401
+ ensureProcess(command, managedBy, cwd, schedule, now = Date.now()) {
402
+ return this.registerProcess(command, managedBy, cwd, schedule, now, { onlyIfAbsent: true });
403
+ }
404
+ /** Opt-out and removal share the state writer mutex with on/default registration. */
405
+ disableProcess(managedBy) {
406
+ this.disabledMarker(managedBy);
407
+ const removed = this.transaction((s) => {
408
+ const existing = s.jobs.find((j) => j.sessionId === PROCESS_SESSION_ID && parseProcessCommand(j)?.managedBy === managedBy);
409
+ if (existing?.state === "running") throw new Error("managed job is currently running; try again after it finishes");
410
+ s.managedEnabled = { ...s.managedEnabled, [managedBy]: false };
411
+ s.jobs = s.jobs.filter((j) => j !== existing);
412
+ return !!existing;
413
+ });
414
+ try {
415
+ fs.writeFileSync(this.disabledMarker(managedBy), (/* @__PURE__ */ new Date()).toISOString(), { mode: 384 });
416
+ } catch {
417
+ }
418
+ return removed;
419
+ }
420
+ validManagedKey(key) {
421
+ return /^[a-zA-Z0-9_-]{1,64}$/.test(key) && !["__proto__", "constructor", "prototype"].includes(key);
422
+ }
423
+ disabledMarker(managedBy) {
424
+ if (!this.validManagedKey(managedBy)) throw new Error("invalid managed marker identity");
425
+ return path.join(this.dir, `${managedBy}-disabled`);
426
+ }
427
+ registerProcess(command, managedBy, cwd, schedule, now, opts) {
428
+ this.disabledMarker(managedBy);
396
429
  const validated = validateSchedule(schedule), next = nextTime(validated, now);
397
430
  if (next === null) throw new Error("at must be in the future");
398
431
  const count = validated.count;
@@ -411,8 +444,10 @@ var Store = class {
411
444
  if (command.some((part) => part.includes("\0"))) throw new Error("process command arguments must not contain NUL bytes");
412
445
  if (probe.prompt.length > 16e3) throw new Error("process command exceeds the 16000-character job budget");
413
446
  const job = { ...probe };
414
- return this.transaction((s) => {
447
+ const registered = this.transaction((s) => {
415
448
  const existing = s.jobs.find((j) => j.sessionId === PROCESS_SESSION_ID && parseProcessCommand(j)?.managedBy === managedBy);
449
+ const intent = s.managedEnabled && Object.hasOwn(s.managedEnabled, managedBy) ? s.managedEnabled[managedBy] : void 0;
450
+ if (opts?.onlyIfAbsent && (existing || intent === false || intent === void 0 && fs.existsSync(this.disabledMarker(managedBy)))) return void 0;
416
451
  if (existing?.state === "running") throw new Error("managed job is currently running; try again after it finishes");
417
452
  if (!opts?.forceReplace) {
418
453
  if (existing?.state === "blocked") throw new Error("managed job is blocked; resume or recover it explicitly instead of re-registering");
@@ -423,8 +458,16 @@ var Store = class {
423
458
  s.jobs = s.jobs.filter((j) => j !== existing);
424
459
  if (s.jobs.length >= 100) throw new Error("maximum 100 jobs");
425
460
  s.jobs.push(job);
461
+ if (opts?.forceReplace) s.managedEnabled = { ...s.managedEnabled, [managedBy]: true };
426
462
  return job;
427
463
  });
464
+ if (registered && opts?.forceReplace) {
465
+ try {
466
+ fs.rmSync(this.disabledMarker(managedBy), { force: true });
467
+ } catch {
468
+ }
469
+ }
470
+ return registered;
428
471
  }
429
472
  /** Find the managed process job for a manager identity, if present. */
430
473
  findProcess(managedBy) {
@@ -855,13 +898,12 @@ var Runtime = class {
855
898
  try {
856
899
  const existing = this.store.findProcess("memory");
857
900
  if (existing) return;
858
- if (fs3.existsSync(path3.join(this.store.dir, "memory-disabled"))) return;
859
901
  const { managedMemoryCommand: managedMemoryCommand2, localTimeToCronUtc: localTimeToCronUtc2 } = await import("./index.js");
860
902
  const command = managedMemoryCommand2();
861
903
  const cronSpec = localTimeToCronUtc2("03:00");
862
904
  if ("error" in cronSpec) throw new Error(cronSpec.error);
863
- this.store.addProcess(command, "memory", process.cwd(), cronSpec);
864
- this.ctx.log("cron: registered the default daily memory distillation (03:00)");
905
+ if (this.store.ensureProcess(command, "memory", process.cwd(), cronSpec))
906
+ this.ctx.log("cron: registered the default daily memory distillation (03:00)");
865
907
  } catch (error) {
866
908
  const message = String(error instanceof Error ? error.message : error);
867
909
  if (/managed job is (blocked|paused|currently running)/.test(message)) return;
@@ -1429,7 +1471,13 @@ function localTimeToCronUtc(time) {
1429
1471
  function managedMemoryCommand() {
1430
1472
  const entry = process.argv[1] ? path4.resolve(process.argv[1]) : path4.join(configPath(), "..", "cli.js");
1431
1473
  const resolved = fs4.existsSync(entry) ? entry : path4.join(configPath(), "cli.js");
1432
- const loaderArgs = process.execArgv.filter((a) => a.startsWith("--import") || a.startsWith("--loader"));
1474
+ const loaderArgs = [];
1475
+ for (let i = 0; i < process.execArgv.length; i++) {
1476
+ const arg = process.execArgv[i];
1477
+ if (/^--(?:import|loader|experimental-loader)=/.test(arg)) loaderArgs.push(arg);
1478
+ else if (/^--(?:import|loader|experimental-loader)$/.test(arg) && i + 1 < process.execArgv.length)
1479
+ loaderArgs.push(arg, process.execArgv[++i]);
1480
+ }
1433
1481
  return [process.execPath, ...loaderArgs, resolved, "memory", "distill", "--worker", "--auto", "--memory-root", path4.join(configPath(), "memory")];
1434
1482
  }
1435
1483
  function cron(ctx) {
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
- import "../../../chunks/chunk-RZGYXAJU.js";
2
+ import "../../../chunks/chunk-LZQXQOPJ.js";
3
3
 
4
4
  // builtin/extensions/document-attachments/index.ts
5
5
  import * as fs from "node:fs";
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
- import "../../../chunks/chunk-RZGYXAJU.js";
2
+ import "../../../chunks/chunk-LZQXQOPJ.js";
3
3
 
4
4
  // builtin/extensions/herdr-agent-state/index.ts
5
5
  import { spawn } from "node:child_process";
@@ -22,7 +22,7 @@ otherwise it toggles the desired enabled flag. Replies/thread posts associated
22
22
  with this process's forwarded messages enter their originating live session.
23
23
  COLD-START note: replaced 11-08 by the user routing design — an UNANCHORED message (a true DM root: no explicit address, no replyTo, no threadId) binds to the UNATTENDED RESIDENT host (json-events --idle, the concierge) statelessly, for the resident's whole life; interactive/embedded hosts never claim unanchored messages. A message that REPLIED to something or sits in a THREAD whose attribution fails to resolve is NOT unanchored — it drops on every host (no ack reaction is the user-visible signal). A retry chain never re-binds across a session switch (released for redelivery instead).
24
24
 
25
- EXPLICIT ADDRESSING (`<session name>: body`) is exclusive: the address space is the set of session names advertised by LIVE local sessions in the pie-ipc discovery directory (`<PIE_IPC_CONFIG_DIR ?? agent dir>/run/ipc`), scanned per candidate message (no negative cache). A name owned by another live session is dropped here; a name advertised by two live sessions, or an address-shaped message while the book is unreadable, drops too (ambiguous → nobody acts). Without pie-ipc running, no foreign names are known, so exclusivity degrades to own-name-only — pie-ipc is the local session registry.
25
+ EXPLICIT ADDRESSING (`<session name>: body`) is exclusive: the address space is the set of session names advertised by LIVE local sessions in the pie-ipc discovery directory (`<PIE_IPC_CONFIG_DIR ?? agent dir>/run/ipc`), scanned per candidate message (no negative cache). The unique consumer forwards a foreign explicit address to its unique live session owner over IPC, before thread routing; non-consumer hosts do not re-dispatch it. Targets must advertise the same active IM app binding. A name advertised by two live sessions, or an address-shaped message while the book is unreadable, drops (ambiguous → nobody acts). Without pie-ipc running, no foreign names are known, so exclusivity degrades to own-name-only — pie-ipc is the local session registry.
26
26
 
27
27
  Feishu (Lark) is the only implemented platform. The wizard always shows a generic
28
28
  platform picker with implemented platforms and Cancel, before provider setup. See [Feishu setup and transport](providers/feishu/README.md).
@@ -81,6 +81,8 @@ lark-cli daemon automatically; the warning gives the operator the explicit
81
81
  `event stop --force` recovery command. Optional card/menu consumers respawn
82
82
  on bounded backoff, reset only at their ready marker; dead children are removed.
83
83
 
84
+ Only an explicitly identified manager advertising the same active IM app binding suppresses stand-in acquisition; ordinary unattended workers (including oneself) and managers on another app never do. Binding changes publish immediately through IPC discovery, not only at its heartbeat. Consumer ownership is generation-checked under a short directory mutex; heartbeat age is diagnostic, never permission to steal from a live PID. Provider shutdown must complete before release; see [ownership and upgrade rules](../../../../../docs/ownership-locks.md).
85
+
84
86
  On a machine where a resident holds the consumer slot, non-holder runtimes
85
87
  operate in dispatch mode: they never spawn a consumer and receive events over
86
88
  pie-ipc. For such runtimes the tag answers a delivery question, not a