@cydm/pie 4.15.1 → 4.15.3

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.
@@ -3,7 +3,7 @@ import {
3
3
  distillWorkerLogPath,
4
4
  readDistillWorkerLog,
5
5
  spawnDistillWorker
6
- } from "../../../chunks/chunk-6AYPNTCO.js";
6
+ } from "../../../chunks/chunk-NCO26FXT.js";
7
7
  import {
8
8
  commitCuratedMemoryBestEffort
9
9
  } from "../../../chunks/chunk-VWDCKHCC.js";
@@ -28,7 +28,7 @@ function cronBlockedSummary(sessionId) {
28
28
  try {
29
29
  const res = bridge.listJobs(sessionId ? { sessionId } : void 0);
30
30
  const blocked = res.jobs.filter((j) => j.state === "blocked");
31
- const mem = blocked.find((j) => j.isProcess && j.managedBy === "memory");
31
+ const mem = blocked.find((j) => j.storeKey === "host" && j.isProcess && j.managedBy === "memory");
32
32
  return {
33
33
  blockedCount: blocked.length,
34
34
  memoryBlocked: Boolean(mem),
@@ -270,8 +270,9 @@ function isWikiDreamResultRetryable(dreamRes) {
270
270
  const sessionsAllTransient = !dreamRes.failedSessions?.length || dreamRes.failedSessions.every((f) => isTransientDistillError(f.error));
271
271
  const hasHarvestFail = Boolean(dreamRes.error?.includes("harvest failed"));
272
272
  const isExtractionOnlyWrapper = Boolean(dreamRes.failedSessions?.length) && Boolean(dreamRes.error) && (dreamRes.error.startsWith("partial dream failure") || /^all \d+ session signal extractions failed/i.test(dreamRes.error));
273
- const hasStageFailure = Boolean(dreamRes.violations?.length) || hasHarvestFail || Boolean(dreamRes.error) && !isExtractionOnlyWrapper;
274
- const stageTransient = !hasStageFailure || !dreamRes.violations?.length && !hasHarvestFail && isTransientDistillError(err);
273
+ const isAntiBloatValidationFailure = err === "dream updates violated anti-bloat limits" && !hasHarvestFail;
274
+ const hasStageFailure = Boolean(dreamRes.violations?.length) && !isAntiBloatValidationFailure || hasHarvestFail || Boolean(dreamRes.error) && !isExtractionOnlyWrapper && !isAntiBloatValidationFailure;
275
+ const stageTransient = !hasStageFailure || isAntiBloatValidationFailure || !dreamRes.violations?.length && !hasHarvestFail && isTransientDistillError(err);
275
276
  return sessionsAllTransient && stageTransient;
276
277
  }
277
278
  function normalizeCwdPath(value) {
@@ -313,7 +314,7 @@ function isTransientDistillError(message) {
313
314
  }
314
315
  if (/^(?:distill:[^:]+:\s*)?distill (?:response contains no json array|response contains invalid json|response is not an array|candidate is not an object|candidate has invalid shape|quote is implausibly long)/i.test(
315
316
  message.trim()
316
- ) || /^(?:wiki (?:signal extractor returned (?:no json array|malformed json|non-array json)|dream response (?:contains no json object|contains invalid json|missing updates array)|dream update entry (?:is not an object|requires non-empty path and content)|dream batch overflow))/i.test(
317
+ ) || /^(?:wiki (?:signal extractor returned (?:no json array|malformed json|non-array json)|dream response (?:contains no json object|contains invalid json|missing updates array)|dream update entry (?:is not an object|requires non-empty path and content)|dream batch overflow)|dream updates violated anti-bloat limits$)/i.test(
317
318
  message.trim()
318
319
  )) {
319
320
  return true;
@@ -400,7 +401,8 @@ async function runDistillWorkerMain(memoryRoot, date, noExit = false, sessionsDi
400
401
  });
401
402
  const batchNote = dreamRes.batchesRun > 1 ? ` batches=${dreamRes.batchesRun}` : "";
402
403
  const inboxNote = dreamRes.inboxMerged ? ` inbox=${dreamRes.inboxMerged}` : "";
403
- log(`[wiki] dream ${inboxOnly ? "inbox" : date}: ok=${dreamRes.ok} sessions=${dreamRes.sessionsHarvested} signals=${dreamRes.signalsAuthenticated} written=${dreamRes.written.length}${batchNote}${inboxNote}${dreamRes.error ? ` error=${dreamRes.error}` : ""}`);
404
+ const violationsNote = dreamRes.violations?.length ? ` violations=${dreamRes.violations.slice(0, 3).join("; ")}` : "";
405
+ log(`[wiki] dream ${inboxOnly ? "inbox" : date}: ok=${dreamRes.ok} sessions=${dreamRes.sessionsHarvested} signals=${dreamRes.signalsAuthenticated} written=${dreamRes.written.length}${batchNote}${inboxNote}${dreamRes.error ? ` error=${dreamRes.error}` : ""}${violationsNote}`);
404
406
  let gcWrote = false;
405
407
  if (!inboxOnly && wiki.exists()) {
406
408
  const meta = wiki.readMeta();
@@ -448,7 +450,7 @@ async function runDistillWorkerMain(memoryRoot, date, noExit = false, sessionsDi
448
450
  }
449
451
  return result;
450
452
  }
451
- async function runDistillAuto(memoryRoot, days = 7, runner, sessionsDir) {
453
+ async function runDistillAuto(memoryRoot, days = 7, runner, sessionsDir, timeBudgetMs = 20 * 60 * 1e3) {
452
454
  const log = (message) => {
453
455
  try {
454
456
  fs.appendFileSync(distillWorkerLogPath(memoryRoot), `[${(/* @__PURE__ */ new Date()).toISOString()}] ${message}
@@ -477,9 +479,19 @@ async function runDistillAuto(memoryRoot, days = 7, runner, sessionsDir) {
477
479
  const runTargets = dates.length > 0 ? dates : ["__inbox__"];
478
480
  log(dates.length > 0 ? `auto: ${dates.length} missing date(s): ${dates.join(", ")}` : `auto: draining ${pendingInbox} pending inbox item(s)`);
479
481
  const lines = [];
482
+ const startedAt = Date.now();
480
483
  let failures = 0;
481
484
  let hasPermanentFailure = false;
482
- for (const date of runTargets) {
485
+ let deferredByBudget = 0;
486
+ for (let idx = 0; idx < runTargets.length; idx += 1) {
487
+ const date = runTargets[idx];
488
+ if (idx > 0 && timeBudgetMs > 0 && Date.now() - startedAt >= timeBudgetMs) {
489
+ deferredByBudget = runTargets.length - idx;
490
+ const remainingDates = runTargets.slice(idx).join(", ");
491
+ log(`auto: soft time budget (${Math.round(timeBudgetMs / 6e4)}m) reached with ${deferredByBudget} date(s) remaining (${remainingDates}); deferring to next retry`);
492
+ lines.push(`deferred ${deferredByBudget} date(s) (${remainingDates}) after soft time budget; next retry continues`);
493
+ break;
494
+ }
483
495
  const result = await (runner ?? runDistillWorkerMain)(memoryRoot, date, true, sessionsDir);
484
496
  if (!result.ok && result.busy) {
485
497
  lines.push(`${date}: busy \u2014 another distillation worker is running; next schedule retries`);
@@ -498,8 +510,8 @@ async function runDistillAuto(memoryRoot, days = 7, runner, sessionsDir) {
498
510
  hasPermanentFailure ? `${failures} date(s) failed (includes permanent config/storage failure; inspect log)` : `${failures} date(s) failed (transient/retryable; next run retries them)`
499
511
  );
500
512
  }
501
- const succeeded = failures === 0;
502
- const retryable = failures > 0 && !hasPermanentFailure;
513
+ const succeeded = failures === 0 && deferredByBudget === 0;
514
+ const retryable = !succeeded && !hasPermanentFailure;
503
515
  if (!process.env.NODE_TEST_CONTEXT) {
504
516
  const code = distillExitCode({ ok: succeeded, retryable });
505
517
  setTimeout(() => process.exit(code), 50).unref?.();
package/dist/cli.js CHANGED
@@ -52,7 +52,7 @@ import {
52
52
  runDistillWorkerMain,
53
53
  spawnDistillAutoWorker,
54
54
  spawnDistillWorker
55
- } from "./chunks/chunk-6AYPNTCO.js";
55
+ } from "./chunks/chunk-NCO26FXT.js";
56
56
  import {
57
57
  commitCuratedMemoryBestEffort,
58
58
  isMemoryGitInitialized,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cydm/pie",
3
- "version": "4.15.1",
3
+ "version": "4.15.3",
4
4
  "description": "Pie AI Agent CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -20,6 +20,7 @@
20
20
  "test:skill-regressions": "node --test --test-force-exit --import tsx test/axi-bridge-lifecycle.test.ts test/bash-lifecycle.test.ts test/bash-powershell-display.test.ts test/skill-creator-runner.test.ts test/tui-use-contract.test.ts test/tui-use-runtime.test.ts test/tui-use-reap.test.ts test/tui-use-kill-escalation.test.ts test/browser-runtime.test.ts test/axi-stop-semantics.test.ts test/axi-page-routing.test.ts test/computer-use-axi.test.ts test/computer-evidence.test.ts test/interactive-lifecycle.test.ts",
21
21
  "test:offline:post": "node --test --test-force-exit --import tsx test/remote-model-catalog.test.ts",
22
22
  "test:offline": "node ../../scripts/run-cli-offline.mjs",
23
+ "test:fast:guards": "node --test --import tsx test/source-size-guard.test.ts test/architecture-boundaries.test.ts test/builtin-extensions.test.ts test/builtin-command-catalog.test.ts test/extensions-enablement.test.ts test/tools-registry.test.ts test/im-forward-card-compiler.test.ts test/system-prompt-contract.test.ts",
23
24
  "test:offline:main": "node --test --test-concurrency=2 --test-force-exit --import tsx test/cli-attention.test.ts test/cron.test.ts test/cron-process.test.ts test/cron-poll-gate.test.ts test/memory-distill.test.ts test/memory-wiki-cli.test.ts test/memory-injection-budget.test.ts test/memory-injection-freeze.test.ts test/memory-consumption-e2e.test.ts test/memory-frozen-matching.test.ts test/memory-soul-injection.test.ts test/config-dir-fail-closed.test.ts test/cron-concurrency.test.ts test/cron-dogfood.test.ts test/cron.terminal.test.ts test/cron-journey.terminal.test.ts test/builtin-extensions.test.ts test/im-forward.test.ts test/im-forward-cli.test.ts test/im-forward-userassigned.test.ts test/im-forward-bus-health.test.ts test/im-forward-panel-fastpath.test.ts test/im-forward-worker-panel.test.ts test/im-forward-cron-panel.test.ts test/im-forward-tree-panel.test.ts test/im-forward-memory-panel.test.ts test/im-forward-archive-panel.test.ts test/im-forward-auto-wake.test.ts test/im-forward-provider-boundary.test.ts test/im-forward-self-heal.test.ts test/im-forward-thread-steal.test.ts test/im-forward-panel-v3.test.ts test/headless-session-commands.test.ts test/headless-compact-audit.test.ts test/builtin-command-catalog.test.ts test/im-forward-consumer.test.ts test/im-forward-settled-reaction.test.ts test/im-forward-card-compiler.test.ts test/im-forward-integration.test.ts test/user-input-scope-vision-fallback.test.ts test/im-forward-anchor-ttl.test.ts test/im-forward-anchor-ttl.dogfood.test.ts test/im-forward-group-mention.test.ts test/im-forward-onboarding.test.ts test/ownership-concurrency.test.ts test/pie-ipc-windows-security.test.ts test/im-forward-dogfood.terminal.test.ts test/thread-registry.test.ts test/im-forward-event-hub.test.ts test/im-forward-hub-routing.test.ts test/im-forward-session-anchors.test.ts test/im-forward-session-roots-ads.test.ts test/extension-user-input.test.ts test/pie-ipc-pure.test.ts test/pie-ipc-resolve.test.ts test/pie-ipc-discovery.test.ts test/pie-ipc-transport.test.ts test/pie-ipc-delivery.test.ts test/pie-ipc-extension.test.ts test/pie-ipc-e2e.test.ts test/pie-ipc-security.test.ts test/pie-ipc-dogfood.test.ts test/pie-ipc-resident-dispatch.test.ts test/pie-proc.test.ts test/pie-proc-resume.test.ts test/session-ownership.test.ts test/initial-session.test.ts test/pie-ipc-host.terminal.test.ts test/core-services.test.ts test/cli.test.ts test/cli-json-events.test.ts test/cli-auto-compaction.test.ts test/execution-state-manager.test.ts test/queued-steer-execution-state.test.ts test/todo-steering-ownership.test.ts test/architecture-boundaries.test.ts test/attachment-resolver.test.ts test/kimi-attachment-provider.test.ts test/document-attachment-extension.test.ts test/auto-compact-overflow.test.ts test/auto-compaction-ui.test.ts test/tool-compaction-dogfood.terminal.test.ts test/hierarchical-command-system.test.ts test/mcp-adapter.test.ts test/herdr-agent-state.test.ts test/extensions-enablement.test.ts test/extension-selector-shortcuts.test.ts test/skill-tool-enablement.test.ts test/message-queue-unit.test.ts test/evals-harness.test.ts test/session-trace.test.ts test/json-events-event-sink.test.ts test/json-events-lifecycle-bridge.test.ts test/json-events-self-input.test.ts test/json-events-idle-mode.test.ts test/manager-cli.test.ts test/manager-upgrade.test.ts test/json-events-sidechat-diagnostics.test.ts test/json-events-sidechat-service.test.ts test/json-events-prewarm-shutdown.test.ts test/json-envelope-composition.test.ts test/subagent-session-store.test.ts test/subagent-resolution.test.ts test/supervisor-anchor-inject.test.ts test/runtime-mode-context.test.ts test/tool-policy.test.ts test/retry-policy.test.ts test/yolo-command.test.ts test/footer-lifecycle.test.ts test/footer-waiting-for-user.test.ts test/files-utils.test.ts test/source-size-guard.test.ts test/runtime-logger.test.ts test/release-readiness.test.ts test/package-artifacts.test.ts test/init-extension-contract.test.ts test/skills-runtime.test.ts test/skills-agents-discovery.test.ts test/skills-symlink.test.ts test/model-overrides.test.ts test/auth-storage.test.ts test/extension-register-provider.test.ts test/extension-reload.test.ts test/extension-terminal-input.test.ts test/extension-session-before-events.test.ts test/extension-widgets.test.ts test/extension-render-hint.test.ts test/extension-oauth-restore.test.ts test/cross-host-parity.test.ts test/tool-name-rendering.test.ts test/session-selector.test.ts test/tree-selector-pagination.test.ts test/context-report.test.ts test/context-signals.test.ts test/plan-cache-stability.test.ts test/cache-invalidation-trace.test.ts test/cache-retention.test.ts test/trace-report.test.ts test/boot-report.test.ts test/compaction-diff.test.ts test/entry-body-and-usage.test.ts test/session-control.test.ts test/terminal-title.test.ts test/interactive-controller-title.test.ts test/todo-title.terminal.test.ts test/host-envelope-dogfood.terminal.test.ts test/host-envelope-cross-mode.test.ts test/host-envelope-registry-lifecycle.test.ts test/host-envelope-migration-roundtrip.test.ts test/host-envelope-intake-order.test.ts test/plan-mode-extension.test.ts test/extension-interaction-signals.test.ts test/rendered-page-reader.test.ts test/tools-registry.test.ts test/system-prompt-contract.test.ts test/bash-yolo.test.ts test/terminal-state-hygiene.test.ts test/terminal-mode-filter-families.test.ts test/manager-model-env.test.ts test/bash-mode-sequence-boundary.test.ts test/bash-contract.test.ts test/bash-confirm-pending.test.ts test/interaction-status-lifecycle.test.ts test/bash-process-group.test.ts test/bash-artifact-sink.test.ts test/direct-bash.test.ts test/terminal-bell.test.ts test/ctrl-d-exit.test.ts test/session-display-title.test.ts test/calm-mode.test.ts test/stream-render-throttle.test.ts test/assistant-message-performance.test.ts test/streaming-split-parity.test.ts test/message-display-resync.test.ts test/project-root.test.ts test/guard-advisory-context.test.ts test/clear-command-usage.test.ts test/daily-agent-smoke.terminal.test.ts test/slash-menu-toggles.terminal.test.ts test/cli-args.test.ts test/session-resume-cwd.test.ts test/session-resume-restart.test.ts test/session-resume-picker.test.ts test/extensions-configured-paths.test.ts test/extensions-loader-path.test.ts test/file-picker.test.ts test/interrupt-recovery.test.ts test/mention-insert-regression.test.ts test/image-paste.test.ts test/clipboard-read-image.test.ts test/clipboard-races.test.ts test/clipboard-dogfood.terminal.test.ts test/mention-picker-navigation.test.ts test/pie-unity-rpc-skill.test.ts test/skill-creator-scripts.test.ts test/interactive-compact-command.test.ts test/computer-use-broker.test.ts test/computer-use-review-regressions.test.ts test/computer-use-safety.test.ts test/axi-connection-order.test.ts test/confirm-yolo-grant.test.ts test/yolo-grant.test.ts test/yolo-shortcut.test.ts test/host-idle.test.ts test/im-forward-anchor-reclaim.test.ts test/im-forward-browser.test.ts test/im-forward-dispatch-claim.test.ts test/im-forward-dispatch-verify.test.ts test/im-forward-existing-app-terminal.test.ts test/im-forward-panel-actions.test.ts test/manager-seed.test.ts test/pending-tools-turn-boundary.test.ts test/pie-ipc-results.test.ts test/session-display-name.test.ts test/session-model-metadata.test.ts test/thinking-capabilities.test.ts ../../scripts/node-test-diagnostics.test.js ../../scripts/offline-test-runner.test.js ../../scripts/unity-consumer.test.mjs ../../scripts/owned-process-cleanup.test.mjs",
24
25
  "test:all": "npm run test:offline && npm run test:terminal:vitest",
25
26
  "test:cron:tui": "node ../../scripts/run-with-env.mjs PIE_REAL_CRON_TUI=1 -- --test --import tsx test/cron.terminal.test.ts test/cron-journey.terminal.test.ts",