@cydm/pie 4.7.0 → 4.8.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.
@@ -96,7 +96,12 @@ function sweepStaleOwners(state, dir, opts = {}) {
96
96
  let sidecar;
97
97
  try {
98
98
  sidecar = fs.readFileSync(liveness, "utf8");
99
- } catch {
99
+ } catch (error) {
100
+ const code = error.code;
101
+ if (code !== "ENOENT") {
102
+ opts.warn?.(`cron: keeping owner ${key}; liveness sidecar read failed (${code ?? "unknown error"})`);
103
+ continue;
104
+ }
100
105
  }
101
106
  if (sidecar === void 0) {
102
107
  if (row.registeredAt === void 0 || now - row.registeredAt > legacyOrCrashWindowMs) {
@@ -1039,7 +1044,7 @@ var Runtime = class {
1039
1044
  }
1040
1045
  persistOwner(sessionId) {
1041
1046
  this.store.transaction((state) => {
1042
- sweepStaleOwners(state, this.store.dir, { sessionId, keepKey: this.id });
1047
+ sweepStaleOwners(state, this.store.dir, { sessionId, keepKey: this.id, warn: (message) => this.ctx.log(message) });
1043
1048
  state.owners[this.id] = { sessionId, cwd: this.cwd, busy: !this.ctx.isIdle(), registeredAt: Date.now() };
1044
1049
  });
1045
1050
  try {
@@ -1615,9 +1620,10 @@ WARNING: change applied but the audit log could not be written (${String(e)})`;
1615
1620
  return `${action}: ${jobId}${note}`;
1616
1621
  }
1617
1622
  if (action === "reap-owners") {
1618
- const reaped = store.transaction((state) => sweepStaleOwners(state, store.dir, {}));
1623
+ const warnings = [];
1624
+ const reaped = store.transaction((state) => sweepStaleOwners(state, store.dir, { warn: (message) => warnings.push(message) }));
1619
1625
  const note = auditNote({ kind: "remove", detail: `reap-owners: ${reaped.length} owner row(s) reaped`, authorization: authorizationNow() });
1620
- return JSON.stringify({ reaped, total: reaped.length }, null, 2) + note;
1626
+ return JSON.stringify({ reaped, total: reaped.length, ...warnings.length ? { warnings } : {} }, null, 2) + note;
1621
1627
  }
1622
1628
  throw new Error('Usage: /tools/cron list | reap-owners | add {"prompt":"...","schedule":{"every":3600}} | pause|resume|remove <id>');
1623
1629
  };
@@ -287,6 +287,10 @@ path no longer truncates bodies.
287
287
  text reply can overtake an earlier multi-image download. Wait for acceptance
288
288
  before sending a follow-up that depends on those images.
289
289
 
290
+ Context and Compact buttons are shown only for peers advertising those controls.
291
+ A Compact receipt confirms submission, not a committed checkpoint. If the peer
292
+ sent no verifiable receipt, check Context before requesting compaction again.
293
+
290
294
  ## Panel actions (script-backed custom buttons)
291
295
 
292
296
  11-23, user-settled design. A custom panel button is the trigger for a
@@ -309,17 +313,28 @@ execution (zero LLM, zero token spend).
309
313
  over a deliberately minimal environment (manager bootstrap/model identity
310
314
  never leaks into scripts); stdout IS the result (markdown posted to IM);
311
315
  exit 0 = success, non-zero = failure with the stderr tail; per-action
312
- timeout (default 5 min) kills the whole process tree.
316
+ timeout defaults to 5 min. On POSIX the executor verifies the per-launch identity
317
+ of live members of the script's process group before TERM/KILL and waits for
318
+ that group to stop before releasing the action slot. A subprocess that starts
319
+ a separate process group is outside this guarantee. Unknown ownership is not
320
+ permission to signal. On IM configuration retirement, a script still awaiting
321
+ its initial card receipt is not started; an already running script is cancelled.
322
+ The old connection stays available for up to 7 s for terminal card updates.
323
+ A pending name lookup is cancelled so a finished script can report its actual
324
+ result using the captured identity. A receipt arriving after that window is
325
+ not replayed or patched via the new connection.
313
326
  - Execution: the callback acks fast (<500ms contract), runs in the
314
327
  background, then patches the SAME ack card with the result (one click, one
315
328
  card). The per-action execution lock is a cross-process mkdir + link-CAS
316
329
  protocol (the pie-proc registry's primitive): write-once info.json,
317
330
  token-merged renew.json (deadline re-arm + childPid fencing record),
318
331
  generation-checked release/rearm, and rename-aside reaping with
319
- last-moment revalidation. A reaper kills the recorded child tree BEFORE
320
- freeing the slot (argv-marker verified; leader-absent/group-alive and any
321
- unverifiable identity read as UNKNOWN and keep the slot with an operator
322
- recovery note — fail closed, never overlap two runs).
332
+ last-moment revalidation. The stale-lock reaper uses a separate check: an
333
+ unverifiable recorded child leaves the slot locked with a recovery note.
334
+ On POSIX that reaper checks signal delivery, not that all descendants have
335
+ exited. Ordinary script completion also does not wait for background jobs
336
+ whose pipes have closed. Scripts should join their background work. Windows
337
+ timeout cleanup is best effort; it does not verify that a whole tree exited.
323
338
  - Governance is attribution, not permission (user decision): the registry
324
339
  records the creator, every result card bylines the triggerer ("由 张三 触
325
340
  发"), and every run appends to `audit.jsonl`. There is deliberately NO