@cydm/pie 4.15.0 → 4.15.2

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.
@@ -29,7 +29,7 @@ import {
29
29
  readDistillWorkerLog,
30
30
  spawnDistillAutoWorker,
31
31
  spawnWikiGcWorker
32
- } from "../../../chunks/chunk-6AYPNTCO.js";
32
+ } from "../../../chunks/chunk-NCO26FXT.js";
33
33
  import {
34
34
  readCuratedMemoryGitLog
35
35
  } from "../../../chunks/chunk-VWDCKHCC.js";
@@ -60,7 +60,7 @@ import {
60
60
  cronActiveCount,
61
61
  cronBlockedSummary,
62
62
  currentCronPanelBridge
63
- } from "../../../chunks/chunk-CAPBTMLI.js";
63
+ } from "../../../chunks/chunk-F2F4QXPE.js";
64
64
  import {
65
65
  Type
66
66
  } from "../../../chunks/chunk-XXGYUYXI.js";
@@ -1165,20 +1165,50 @@ function compileCard(spec) {
1165
1165
  }
1166
1166
  for (const item of items) {
1167
1167
  const rowActions = item.actions ?? [];
1168
+ if (rowActions.length >= 2) {
1169
+ elements.push({
1170
+ tag: "column_set",
1171
+ flex_mode: "none",
1172
+ background_style: "grey-50",
1173
+ columns: [
1174
+ {
1175
+ tag: "column",
1176
+ width: "weighted",
1177
+ weight: 1,
1178
+ padding: "8px 10px",
1179
+ vertical_spacing: "small",
1180
+ elements: [
1181
+ { tag: "markdown", content: item.text },
1182
+ {
1183
+ tag: "column_set",
1184
+ flex_mode: "flow",
1185
+ horizontal_spacing: "small",
1186
+ columns: rowActions.map((action) => ({
1187
+ tag: "column",
1188
+ width: "auto",
1189
+ elements: [buildButton(action, "small")]
1190
+ }))
1191
+ }
1192
+ ]
1193
+ }
1194
+ ]
1195
+ });
1196
+ continue;
1197
+ }
1168
1198
  const columns = [
1169
1199
  {
1170
1200
  tag: "column",
1171
1201
  width: "weighted",
1172
1202
  weight: 1,
1173
1203
  vertical_align: "center",
1174
- padding: rowActions.length > 0 ? "6px 0px 6px 8px" : "6px 8px",
1204
+ padding: rowActions.length > 0 ? "8px 0px 8px 10px" : "8px 10px",
1175
1205
  elements: [{ tag: "markdown", content: item.text }]
1176
1206
  },
1177
- ...rowActions.map((action, idx) => ({
1207
+ ...rowActions.map((action) => ({
1178
1208
  tag: "column",
1179
1209
  width: "auto",
1180
1210
  vertical_align: "center",
1181
- padding: idx === rowActions.length - 1 ? "6px 8px 6px 0px" : "6px 0px",
1211
+ padding: "8px 10px 8px 0px",
1182
1212
  elements: [buildButton(action, "small")]
1183
1213
  }))
1184
1214
  ];
@@ -1199,7 +1229,7 @@ function compileCard(spec) {
1199
1229
  elements.push({
1200
1230
  tag: "column_set",
1201
1231
  flex_mode: "flow",
1202
- ...i === 0 ? {} : { horizontal_spacing: "medium" },
1232
+ horizontal_spacing: "medium",
1203
1233
  columns: row.map((action) => ({
1204
1234
  tag: "column",
1205
1235
  width: "weighted",
@@ -3274,20 +3304,22 @@ ${sanitizeLiteralMarkdown(receipt.detail)}`;
3274
3304
  const ack = JSON.parse(receipt.detail.slice(ackStart));
3275
3305
  if (ack.ok !== true || typeof ack.message !== "string") return fallback;
3276
3306
  const r = JSON.parse(ack.message);
3277
- const safeOutcome = typeof r.lastCompactOutcome === "string" && r.lastCompactOutcome ? sanitizeLiteralMarkdown(r.lastCompactOutcome).replace(/\|/g, "\uFF5C") : void 0;
3278
- return `\u{1F4CA} **Context estimate** \xB7 ${safePeer}
3279
-
3280
- | | |
3281
- |---|---|
3282
- | Estimated tokens | ${typeof r.estimatedTokens === "number" ? r.estimatedTokens.toLocaleString() : "?"} |
3283
- | Context window | ${r.contextWindow ? r.contextWindow.toLocaleString() : "unknown"} |
3284
- | Usage | ${typeof r.percent === "number" ? `${r.percent}%` : "unknown"} |
3285
- | Auto-compact | ${r.autoCompactEnabled ? `at ${(r.autoCompactLimitTokens ?? 0).toLocaleString()} tokens` : "off"} |
3286
- | Queued inputs | ${r.pendingQueuedInputs ?? 0} |
3287
- | State | ${r.compactionRunning ? "compacting" : r.isStreaming ? "working" : "idle"} |${safeOutcome ? `
3288
- | Last compact | ${safeOutcome} |` : ""}
3289
-
3290
- _Estimate (bytes/4 heuristic) \u2014 same basis as the TUI's /debugs/context report._`;
3307
+ const safeOutcome = typeof r.lastCompactOutcome === "string" && r.lastCompactOutcome ? sanitizeLiteralMarkdown(r.lastCompactOutcome) : void 0;
3308
+ const est = typeof r.estimatedTokens === "number" ? r.estimatedTokens.toLocaleString() : "?";
3309
+ const win = r.contextWindow ? r.contextWindow.toLocaleString() : "unknown";
3310
+ const usage = typeof r.percent === "number" ? `${r.percent}%` : "unknown";
3311
+ const autoCompact = r.autoCompactEnabled ? `at ${(r.autoCompactLimitTokens ?? 0).toLocaleString()} tokens` : "off";
3312
+ const stateText = r.compactionRunning ? "compacting" : r.isStreaming ? "working" : "idle";
3313
+ return [
3314
+ `\u{1F4CA} **Context estimate** \xB7 ${safePeer}`,
3315
+ "",
3316
+ `- **Estimated tokens**\uFF1A${est} / ${win}\uFF08**${usage}**\uFF09`,
3317
+ `- **State**\uFF1A${stateText} \xB7 **Queued inputs**\uFF1A${r.pendingQueuedInputs ?? 0}`,
3318
+ `- **Auto-compact**\uFF1A${autoCompact}`,
3319
+ ...safeOutcome ? [`- **Last compact**\uFF1A${safeOutcome}`] : [],
3320
+ "",
3321
+ "_Estimate (bytes/4 heuristic) \u2014 same basis as the TUI's /debugs/context report._"
3322
+ ].join("\n");
3291
3323
  } catch {
3292
3324
  return fallback;
3293
3325
  }
@@ -6527,10 +6559,6 @@ function workerDisplayTitle(peer) {
6527
6559
  if (peer.isManager) return "manager";
6528
6560
  return peer.name;
6529
6561
  }
6530
- function sanitizeTableCell(text, max = 64) {
6531
- const cleaned = sanitizeLiteralMarkdown(text).replace(/\|/g, "\uFF5C");
6532
- return cleaned.length <= max ? cleaned : `${cleaned.slice(0, max - 1)}\u2026`;
6533
- }
6534
6562
  function cleanInline(text, max = 48) {
6535
6563
  const cleaned = sanitizeLiteralMarkdown(text);
6536
6564
  return cleaned.length <= max ? cleaned : `${cleaned.slice(0, max - 1)}\u2026`;
@@ -6667,20 +6695,19 @@ ${a.runs} \u6B21 \xB7 \u6700\u8FD1 ${cleanInline(a.lastRunBy ?? "\u2014", 24)}`,
6667
6695
  }));
6668
6696
  const footer = wActions.length > maxCustom ? `\u66F4\u591A\u52A8\u4F5C\u53EF\u590D\u5236\u89E6\u53D1\uFF1A${wActions.slice(maxCustom).map((a) => `\`/card panel.action.${cleanCodeSpan(a.id, 32)} ${cleanCodeSpan(JSON.stringify({ worker: { ref: peer.instanceId } }), 80)}\``).join(" \xB7 ")}` : wActions.length === 0 ? "\u6682\u65E0\u81EA\u5B9A\u4E49 Worker \u52A8\u4F5C\uFF08\u914D\u7F6E scope=worker \u7684\u52A8\u4F5C\u4F1A\u663E\u793A\u5728\u8FD9\u91CC\uFF09\u3002" : "\u4E0A\u65B9\u884C\u5185\u6309\u94AE\u5E26\u5F53\u524D Worker \u4E0A\u4E0B\u6587\u6267\u884C\uFF08zero LLM\uFF09\u3002";
6669
6697
  const threadUrl = resolveSessionThreadUrl(peer.sessionId);
6698
+ const infoLines = [
6699
+ `- **name**\uFF1A${cleanInline(peer.name, 48)} \xB7 **state**\uFF1A${cleanInline(state, 48)}`,
6700
+ `- **model**\uFF1A\`${cleanCodeSpan(modelDisplay, 56)}\``,
6701
+ `- **host**\uFF1A${cleanInline(managedLabel, 48)} \xB7 **version**\uFF1A${cleanInline(peer.version ?? "\u2014", 24)}`,
6702
+ ...peer.cwd ? [`- **cwd**\uFF1A\`${cleanCodeSpan(peer.cwd, 96)}\``] : [],
6703
+ ...threadUrl ? [`- **thread**\uFF1A[\u{1F4AC} \u6253\u5F00\u8BDD\u9898 \u2197](${threadUrl})`] : []
6704
+ ];
6670
6705
  return {
6671
6706
  title: `\u{1F527} ${title}`,
6672
6707
  subtitle: `${peer.project ?? "\u2014"} \xB7 ${modelDisplay} \xB7 ${state}`,
6673
6708
  color: peer.state === "working" ? "blue" : "green",
6674
6709
  columnsPerRow: opts.inThread ? 2 : 3,
6675
- body: `| Field | Value |
6676
- |---|---|
6677
- | name | ${sanitizeTableCell(peer.name, 48)} |
6678
- | state | ${sanitizeTableCell(state, 48)} |
6679
- | model | \`${cleanCodeSpan(modelDisplay, 56)}\` |
6680
- | host | ${sanitizeTableCell(managedLabel, 48)} |
6681
- | version | ${sanitizeTableCell(peer.version ?? "\u2014", 24)} |${peer.cwd ? `
6682
- | cwd | \`${cleanCodeSpan(peer.cwd, 96)}\` |` : ""}${threadUrl ? `
6683
- | thread | [\u{1F4AC} \u6253\u5F00\u8BDD\u9898 \u2197](${threadUrl}) |` : ""}`,
6710
+ body: infoLines.join("\n"),
6684
6711
  ...items.length > 0 ? { items } : {},
6685
6712
  footer,
6686
6713
  actions: [
@@ -6860,12 +6887,9 @@ function composeWorkerQuitConfirmCard(peer, opts = {}) {
6860
6887
  color: "red",
6861
6888
  columnsPerRow: opts.inThread ? 2 : 3,
6862
6889
  body: [
6863
- `| Field | Value |
6864
- |---|---|
6865
- | name | ${sanitizeTableCell(peer.name, 48)} |
6866
- | session | \`${cleanCodeSpan(peer.sessionId, 64)}\` |
6867
- | state | ${sanitizeTableCell(state, 48)} |${peer.cwd ? `
6868
- | cwd | \`${cleanCodeSpan(peer.cwd, 96)}\` |` : ""}`,
6890
+ `- **name**\uFF1A${cleanInline(peer.name, 48)} \xB7 **state**\uFF1A${cleanInline(state, 48)}`,
6891
+ `- **session**\uFF1A\`${cleanCodeSpan(peer.sessionId, 64)}\``,
6892
+ ...peer.cwd ? [`- **cwd**\uFF1A\`${cleanCodeSpan(peer.cwd, 96)}\``] : [],
6869
6893
  ``,
6870
6894
  peer.state === "working" ? "\u26A0\uFE0F \u8BE5 worker \u5F53\u524D\u6B63\u5728\u6267\u884C\u56DE\u5408\uFF1B\u4F18\u96C5\u9000\u51FA\u4F1A\u5148\u4E2D\u65AD\u5F53\u524D\u56DE\u5408\u3001\u843D\u76D8\u5E76\u91CA\u653E\u9501\u3002" : "\u4F18\u96C5\u9000\u51FA\u4F1A\u901A\u77E5\u8BE5 worker \u843D\u76D8\u3001\u91CA\u653E IPC \u9501\u5E76\u5E72\u51C0\u9000\u51FA\uFF08\u4F1A\u8BDD\u8BB0\u5F55\u4FDD\u7559\uFF0C\u53EF\u968F\u65F6 Resume\uFF09\u3002"
6871
6895
  ].join("\n"),
@@ -6884,11 +6908,12 @@ function composeOfflineWorkerCard(sessionId, opts = {}) {
6884
6908
  sessionId ? `\u8BE5 thread \u5173\u8054\u7684 worker \u4F1A\u8BDD \`${cleanCodeSpan(sessionId, 64)}\` \u5F53\u524D\u4E0D\u5728\u7EBF\uFF08\u53EF\u80FD\u5DF2\u9000\u51FA\u6216\u88AB TTL \u56DE\u6536\uFF09\u3002` : "\u8BE5 session \u5F53\u524D\u4E0D\u5728\u7EBF\uFF08\u53EF\u80FD\u5DF2\u9000\u51FA\u6216\u88AB TTL \u56DE\u6536\uFF09\u3002"
6885
6909
  ];
6886
6910
  if (resumable) {
6887
- lines.push("", `| Field | Value |
6888
- |---|---|
6889
- | name | ${sanitizeTableCell(resumable.name, 48)} |
6890
- | cwd | \`${cleanCodeSpan(resumable.cwd, 96)}\` |
6891
- | resume | ${resumable.allowed ? "ready" : `unavailable (${sanitizeTableCell(resumable.reason ?? "blocked", 64)})`} |`);
6911
+ lines.push(
6912
+ "",
6913
+ `- **name**\uFF1A${cleanInline(resumable.name, 48)}`,
6914
+ `- **cwd**\uFF1A\`${cleanCodeSpan(resumable.cwd, 96)}\``,
6915
+ `- **resume**\uFF1A${resumable.allowed ? "ready" : `unavailable (${cleanInline(resumable.reason ?? "blocked", 64)})`}`
6916
+ );
6892
6917
  }
6893
6918
  const actions = [];
6894
6919
  if (resumable?.allowed && sessionId) {
@@ -7309,9 +7334,6 @@ function clipText(text, max) {
7309
7334
  function cleanInline3(text, max = 44) {
7310
7335
  return clipText(sanitizeLiteralMarkdown(text), max);
7311
7336
  }
7312
- function sanitizeTableCell2(text, max = 64) {
7313
- return clipText(sanitizeLiteralMarkdown(text).replace(/\|/g, "\uFF5C"), max);
7314
- }
7315
7337
  function cleanArchiveTitle(raw) {
7316
7338
  let s = raw.trim();
7317
7339
  if (s.startsWith("[pie-ipc]")) {
@@ -7508,18 +7530,15 @@ function composeArchiveDetailCard(sessionId, opts = {}) {
7508
7530
  const livePeer = findPeerBySessionId(s.sessionId);
7509
7531
  const threadUrl = resolveSessionThreadUrl(s.sessionId);
7510
7532
  const shortCwd = formatShortCwd(s.cwd);
7511
- const statusText = livePeer ? livePeer.state === "working" ? "\u{1F7E1} \u8FD0\u884C\u4E2D\uFF08\u5728\u7EBF\uFF09" : "\u{1F7E2} \u5728\u7EBF" : s.livePid ? `\u{1F7E1} \u5DF2\u88AB\u5360\u7528 (pid ${s.livePid})` : s.resumable ? "\u{1F4A4} \u79BB\u7EBF \xB7 \u53EF\u4E00\u952E\u5524\u9192" : `\u{1F512} \u4E0D\u53EF\u5524\u9192 (${sanitizeTableCell2(s.resumeReason ?? "\u53D7 allowCwd \u9650\u5236", 48)})`;
7512
- const tableRows = [
7513
- `| Field | Value |`,
7514
- `|---|---|`,
7515
- `| title | ${sanitizeTableCell2(cleanArchiveTitle(s.name), 72)} |`,
7516
- `| session | \`${cleanCodeSpan(s.sessionId, 64)}\` |`,
7517
- ...s.workerName ? [`| worker | ${sanitizeTableCell2(s.workerName, 48)} |`] : [],
7518
- ...shortCwd ? [`| cwd | \`${cleanCodeSpan(shortCwd, 88)}\` |`] : [],
7519
- ...s.model ? [`| model | \`${cleanCodeSpan(s.model + (s.thinkingLevel ? ` (${s.thinkingLevel})` : ""), 56)}\` |`] : [],
7520
- `| updated | ${formatClock(s.updatedAt)} (${formatRelativeTime(s.updatedAt)}) \xB7 ${s.messageCount} msgs |`,
7521
- `| status | ${statusText} |`,
7522
- ...threadUrl ? [`| thread | [\u{1F4AC} \u6253\u5F00\u539F\u8BDD\u9898 \u2197](${threadUrl}) |`] : []
7533
+ const statusText = livePeer ? livePeer.state === "working" ? "\u{1F7E1} \u8FD0\u884C\u4E2D\uFF08\u5728\u7EBF\uFF09" : "\u{1F7E2} \u5728\u7EBF" : s.livePid ? `\u{1F7E1} \u5DF2\u88AB\u5360\u7528 (pid ${s.livePid})` : s.resumable ? "\u{1F4A4} \u79BB\u7EBF \xB7 \u53EF\u4E00\u952E\u5524\u9192" : `\u{1F512} \u4E0D\u53EF\u5524\u9192 (${cleanInline3(s.resumeReason ?? "\u53D7 allowCwd \u9650\u5236", 48)})`;
7534
+ const infoLines = [
7535
+ `- **title**\uFF1A${cleanInline3(cleanArchiveTitle(s.name), 72)}`,
7536
+ `- **session**\uFF1A\`${cleanCodeSpan(s.sessionId, 64)}\`${s.workerName ? ` \xB7 **worker**\uFF1A${cleanInline3(s.workerName, 48)}` : ""}`,
7537
+ ...shortCwd ? [`- **cwd**\uFF1A\`${cleanCodeSpan(shortCwd, 88)}\``] : [],
7538
+ ...s.model ? [`- **model**\uFF1A\`${cleanCodeSpan(s.model + (s.thinkingLevel ? ` (${s.thinkingLevel})` : ""), 56)}\``] : [],
7539
+ `- **updated**\uFF1A${formatClock(s.updatedAt)} (${formatRelativeTime(s.updatedAt)}) \xB7 ${s.messageCount} msgs`,
7540
+ `- **status**\uFF1A${statusText}`,
7541
+ ...threadUrl ? [`- **thread**\uFF1A[\u{1F4AC} \u6253\u5F00\u539F\u8BDD\u9898 \u2197](${threadUrl})`] : []
7523
7542
  ];
7524
7543
  const actions = [];
7525
7544
  if (livePeer && !livePeer.isManager) {
@@ -7543,7 +7562,7 @@ function composeArchiveDetailCard(sessionId, opts = {}) {
7543
7562
  subtitle: `${projectTag ?? s.sessionId.slice(0, 12)} \xB7 ${formatRelativeTime(s.updatedAt)} \xB7 ${s.messageCount} msgs`,
7544
7563
  color: livePeer ? "green" : "violet",
7545
7564
  columnsPerRow: cols,
7546
- body: `${tableRows.join("\n")}
7565
+ body: `${infoLines.join("\n")}
7547
7566
 
7548
7567
  ---
7549
7568
  **\u6700\u8FD1\u5BF9\u8BDD\u6458\u8981**\uFF08\u79BB\u7EBF\u8BFB\u53D6\uFF0Czero LLM\uFF09
@@ -8619,12 +8638,9 @@ function composeCronStopConfirmCard(job, opts) {
8619
8638
  color: "red",
8620
8639
  columnsPerRow: cols,
8621
8640
  body: [
8622
- `| Field | Value |
8623
- |---|---|
8624
- | task | ${cleanCell(job.summary, 64)} |
8625
- | schedule | ${formatScheduleCell(job)} |
8626
- | state | ${formatJobState(job)} |${job.ownerLabel ? `
8627
- | owner | ${cleanCell(job.ownerLabel, 32)} |` : ""}`,
8641
+ `- **task**\uFF1A${cleanCell(job.summary, 64)}`,
8642
+ `- **schedule**\uFF1A${formatScheduleCell(job)} \xB7 **state**\uFF1A${formatJobState(job)}`,
8643
+ ...job.ownerLabel ? [`- **owner**\uFF1A${cleanCell(job.ownerLabel, 32)}`] : [],
8628
8644
  ``,
8629
8645
  job.state === "running" ? "\u26A0\uFE0F \u8BE5\u4EFB\u52A1\u5F53\u524D\u6B63\u5728\u6267\u884C\uFF1B\u786E\u8BA4\u540E\u5C06\u6392\u961F\u7B49\u5F85\u672C\u8F6E\u7ED3\u675F\u5E76\u81EA\u52A8\u505C\u6B62\u5220\u9664\u3002" : job.managedBy ? `\u505C\u6B62\u540E\u5C06\u79FB\u9664\u53D7\u7BA1\u5B9A\u65F6\u4EFB\u52A1 \`${cleanCodeSpan(job.managedBy, 64)}\` \u5E76\u8BB0\u4F4F\u5173\u95ED\u610F\u56FE\uFF08\u91CD\u542F\u4E0D\u4F1A\u81EA\u52A8\u6062\u590D\uFF09\u3002` : "\u505C\u6B62\u540E\u5C06\u6C38\u4E45\u5220\u9664\u8BE5\u5B9A\u65F6\u4EFB\u52A1\uFF08\u540E\u7EED\u9700\u8981\u53EF\u5728\u5BF9\u8BDD\u4E2D\u91CD\u65B0\u521B\u5EFA\uFF09\u3002"
8630
8646
  ].join("\n"),
@@ -8854,9 +8870,6 @@ function clipText3(text, max) {
8854
8870
  function cleanInline4(text, max = 72) {
8855
8871
  return clipText3(sanitizeLiteralMarkdown(text), max);
8856
8872
  }
8857
- function sanitizeTableCell3(text, max = 72) {
8858
- return clipText3(sanitizeLiteralMarkdown(text).replace(/\|/g, "\uFF5C"), max);
8859
- }
8860
8873
  function formatNodeClock(timestamp) {
8861
8874
  if (!Number.isFinite(timestamp) || timestamp <= 0) return "\u2014";
8862
8875
  const d = new Date(timestamp);
@@ -9107,11 +9120,9 @@ function composeTreeBranchConfirmCard(peer, detail, opts) {
9107
9120
  color: "red",
9108
9121
  columnsPerRow: cols,
9109
9122
  body: [
9110
- `| Field | Value |
9111
- |---|---|
9112
- | session | ${sanitizeTableCell3(displayTitle, 48)} |
9113
- | target | #${entry.seq} (${kindBadge(entry.kind)} \xB7 ${formatNodeClock(entry.timestamp)}) |
9114
- | preview | ${sanitizeTableCell3(entry.preview || "(\u7A7A)", 72)} |`,
9123
+ `- **session**\uFF1A${cleanInline4(displayTitle, 48)}`,
9124
+ `- **target**\uFF1A#${entry.seq} (${kindBadge(entry.kind)} \xB7 ${formatNodeClock(entry.timestamp)})`,
9125
+ `- **preview**\uFF1A${cleanInline4(entry.preview || "(\u7A7A)", 72)}`,
9115
9126
  "",
9116
9127
  impactLine,
9117
9128
  "\u2705 **\u65E0\u635F\u64CD\u4F5C**\uFF1A\u539F\u6709\u5206\u652F\u5B8C\u6574\u4FDD\u7559\u5728\u4F1A\u8BDD\u6811\u4E2D\uFF0C\u968F\u65F6\u53EF\u901A\u8FC7 Tree \u518D\u5207\u56DE\u3002",
@@ -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.0",
3
+ "version": "4.15.2",
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",