@cydm/pie 4.15.2 → 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.
@@ -144,7 +144,7 @@ function formatIpcInputHeader(rawUserText) {
144
144
  const doneMatch = /^\[ipc-done\]\s+requestId=\S+(?:\s+outcome=(\S+))?[^\n]*(?:\n([\s\S]*))?$/.exec(body);
145
145
  if (doneMatch) {
146
146
  const outcome = doneMatch[1];
147
- tag = outcome && outcome !== "done" ? `IPC \u5B8C\u6210 (${outcome}) \xB7 ${fromPeer}` : `IPC \u5B8C\u6210 \xB7 ${fromPeer}`;
147
+ tag = outcome && outcome !== "done" ? `IPC Done (${outcome}) \xB7 ${fromPeer}` : `IPC Done \xB7 ${fromPeer}`;
148
148
  body = (doneMatch[2] ?? "").trim();
149
149
  }
150
150
  if (!body) return `> [${tag}]`;
@@ -1136,10 +1136,11 @@ var COLOR_TEMPLATE = {
1136
1136
  red: "red",
1137
1137
  violet: "violet"
1138
1138
  };
1139
- function buildButton(action, size) {
1139
+ function buildButton(action, size, fill) {
1140
1140
  return {
1141
1141
  tag: "button",
1142
1142
  ...size ? { size } : {},
1143
+ ...fill ? { width: "fill" } : {},
1143
1144
  text: { tag: "plain_text", content: action.label },
1144
1145
  type: action.style ?? "default",
1145
1146
  behaviors: [{
@@ -1224,18 +1225,38 @@ function compileCard(spec) {
1224
1225
  elements.push({ tag: "markdown", content: spec.footer, text_size: "notation" });
1225
1226
  }
1226
1227
  const perRow = spec.columnsPerRow ?? 3;
1228
+ const totalRows = Math.ceil(spec.actions.length / perRow);
1227
1229
  for (let i = 0; i < spec.actions.length; i += perRow) {
1228
1230
  const row = spec.actions.slice(i, i + perRow);
1229
- elements.push({
1230
- tag: "column_set",
1231
- flex_mode: "flow",
1232
- horizontal_spacing: "medium",
1233
- columns: row.map((action) => ({
1231
+ const makeCol = (action) => ({
1232
+ tag: "column",
1233
+ width: "weighted",
1234
+ weight: 1,
1235
+ elements: [buildButton(action, void 0, true)]
1236
+ });
1237
+ let columns;
1238
+ if (totalRows > 1 && row.length < perRow) {
1239
+ const startActions = row.filter((a) => a.align !== "end");
1240
+ const endActions = row.filter((a) => a.align === "end");
1241
+ const spacers = Array.from({ length: perRow - row.length }, () => ({
1234
1242
  tag: "column",
1235
1243
  width: "weighted",
1236
1244
  weight: 1,
1237
- elements: [buildButton(action)]
1238
- }))
1245
+ elements: []
1246
+ }));
1247
+ columns = [
1248
+ ...startActions.map(makeCol),
1249
+ ...spacers,
1250
+ ...endActions.map(makeCol)
1251
+ ];
1252
+ } else {
1253
+ columns = row.map(makeCol);
1254
+ }
1255
+ elements.push({
1256
+ tag: "column_set",
1257
+ flex_mode: "none",
1258
+ horizontal_spacing: "medium",
1259
+ columns
1239
1260
  });
1240
1261
  }
1241
1262
  const doc = {
@@ -3253,10 +3274,10 @@ Malformed verified Peek response.`;
3253
3274
  if (turnEntries.length > 0) {
3254
3275
  const meta = parsePeekMeta(receipt);
3255
3276
  const modelTag = typeof report.model === "string" && report.model ? ` \xB7 \`${cleanCodeSpan(report.model, 56)}\`` : "";
3256
- const pageTag = meta.totalPages > 1 ? ` \xB7 \u7B2C ${meta.page}/${meta.totalPages} \u9875` : "";
3277
+ const pageTag = meta.totalPages > 1 ? ` \xB7 Page ${meta.page}/${meta.totalPages}` : "";
3257
3278
  const header = `**Live status:** ${report.active ? "working" : "idle"}${modelTag} \xB7 snapshot ${age(report.generatedAt)}${report.active && report.startedAt ? ` \xB7 active ${age(report.startedAt)}` : ""}${pageTag}`;
3258
3279
  const blocks = turnEntries.map((e) => {
3259
- const roleLabel = e.role === "user" ? e.tag === "ipc-done" ? "\u{1F4E8} Worker \u56DE\u62A5" : e.tag === "ipc-check" ? "\u23F1 \u8FDB\u5EA6\u68C0\u67E5" : "\u{1F464} \u7528\u6237" : e.tag === "error" ? "\u26A0\uFE0F \u52A9\u624B\uFF08\u9519\u8BEF\uFF09" : e.tag === "aborted" ? "\u23F9 \u52A9\u624B\uFF08\u5DF2\u4E2D\u6B62\uFF09" : "\u{1F916} \u52A9\u624B";
3280
+ const roleLabel = e.role === "user" ? e.tag === "ipc-done" ? "\u{1F4E8} Worker Report" : e.tag === "ipc-check" ? "\u23F1 Progress Check" : "\u{1F464} User" : e.tag === "error" ? "\u26A0\uFE0F Assistant (error)" : e.tag === "aborted" ? "\u23F9 Assistant (aborted)" : "\u{1F916} Assistant";
3260
3281
  const when = typeof e.at === "number" ? ` \xB7 ${age(e.at)}` : "";
3261
3282
  return `**${roleLabel}${when}**
3262
3283
  ${e.text}`;
@@ -3264,17 +3285,17 @@ ${e.text}`;
3264
3285
  const sections = [header, ...blocks];
3265
3286
  if (report.active && meta.page === 1 && items.length > 0) {
3266
3287
  const lastTurnAssistant = [...turnEntries].reverse().find((e) => e.role === "assistant")?.text;
3267
- const liveLines = items.filter((i) => !(i.kind === "assistant" && i.text === lastTurnAssistant)).map((i) => i.kind === "tool" ? `- \u{1F527} ${age(i.at)} \xB7 ${i.text}` : `**\u26A1 \u5B9E\u65F6\u8F93\u51FA \xB7 ${age(i.at)}**
3288
+ const liveLines = items.filter((i) => !(i.kind === "assistant" && i.text === lastTurnAssistant)).map((i) => i.kind === "tool" ? `- \u{1F527} ${age(i.at)} \xB7 ${i.text}` : `**\u26A1 Live Output \xB7 ${age(i.at)}**
3268
3289
  ${i.text}`);
3269
3290
  if (liveLines.length > 0) {
3270
3291
  sections.push(`---
3271
- **\u26A1 \u5F53\u524D\u6267\u884C\u4E2D**
3292
+ **\u26A1 Running Now**
3272
3293
  ${liveLines.join("\n\n")}`);
3273
3294
  }
3274
3295
  }
3275
3296
  const budget = typeof report.turns?.charBudget === "number" ? report.turns.charBudget : 1e3;
3276
3297
  const total = typeof report.turns?.totalEntries === "number" ? report.turns.totalEntries : turnEntries.length;
3277
- sections.push(`_Calm \u6B63\u6587\u5FEB\u7167\uFF08\u7EA6 ${budget} \u5B57/\u9875\uFF0C\u5171 ${total} \u6761\u6B63\u6587\uFF09\xB7 \u4E0D\u542B thinking \u4E0E\u5DE5\u5177\u8BE6\u60C5_`);
3298
+ sections.push(`_Calm text snapshot (~${budget} chars/page, ${total} entries) \xB7 thinking & tool details omitted_`);
3278
3299
  return sections.join("\n\n");
3279
3300
  }
3280
3301
  const live = items.map((i) => i.kind === "tool" ? `- \u{1F527} ${age(i.at)} \xB7 ${i.text}` : `**Assistant activity \xB7 ${age(i.at)}**
@@ -5480,13 +5501,13 @@ function createAutoWakeCoordinator(ctx) {
5480
5501
  if (!info || !info.allowed) {
5481
5502
  if (!hasLivePeer(sessionId)) {
5482
5503
  cooldownUntil.set(sessionId, nowFn() + cooldownMs);
5483
- const reason = sanitizeLiteralMarkdown(info?.reason ?? "\u672A\u627E\u5230\u53EF\u6062\u590D\u7684\u4F1A\u8BDD\u8BB0\u5F55");
5504
+ const reason = sanitizeLiteralMarkdown(info?.reason ?? "no resumable session history found");
5484
5505
  ctx.log(`im-forward: auto-wake refused for ${sessionId}: ${reason}`);
5485
5506
  await sendNotice(
5486
5507
  sessionId,
5487
5508
  first.event,
5488
5509
  first.meta,
5489
- `\u{1F4A4} \u8BE5\u8BDD\u9898\u5BF9\u5E94\u7684 Worker \u5DF2\u79BB\u7EBF\u4E14\u65E0\u6CD5\u81EA\u52A8\u5524\u9192\uFF1A${reason}`,
5510
+ `\u{1F4A4} The worker for this thread is offline and cannot auto-wake: ${reason}`,
5490
5511
  "unresumable"
5491
5512
  );
5492
5513
  return;
@@ -5503,7 +5524,7 @@ function createAutoWakeCoordinator(ctx) {
5503
5524
  sessionId,
5504
5525
  first.event,
5505
5526
  first.meta,
5506
- `\u26A0\uFE0F \u81EA\u52A8\u5524\u9192 Worker \u5931\u8D25\uFF1A${sanitizeLiteralMarkdown(res.detail)}`,
5527
+ `\u26A0\uFE0F Failed to auto-wake worker: ${sanitizeLiteralMarkdown(res.detail)}`,
5507
5528
  "spawn-failed"
5508
5529
  );
5509
5530
  return;
@@ -5536,7 +5557,7 @@ function createAutoWakeCoordinator(ctx) {
5536
5557
  sessionId,
5537
5558
  next.event,
5538
5559
  next.meta,
5539
- "\u23F1\uFE0F Worker \u81EA\u52A8\u5524\u9192\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u53D1\u6D88\u606F\u6216\u5728 `/panel` \u4E2D\u67E5\u770B\u72B6\u6001\u3002",
5560
+ "\u23F1\uFE0F Worker auto-wake timed out. Resend your message shortly or check status in `/panel`.",
5540
5561
  "timeout"
5541
5562
  );
5542
5563
  }
@@ -5552,7 +5573,7 @@ function createAutoWakeCoordinator(ctx) {
5552
5573
  sessionId,
5553
5574
  first.event,
5554
5575
  first.meta,
5555
- `\u26A0\uFE0F \u81EA\u52A8\u5524\u9192 Worker \u5F02\u5E38\uFF1A${sanitizeLiteralMarkdown(error instanceof Error ? error.message : String(error))}`,
5576
+ `\u26A0\uFE0F Worker auto-wake error: ${sanitizeLiteralMarkdown(error instanceof Error ? error.message : String(error))}`,
5556
5577
  "error"
5557
5578
  );
5558
5579
  } finally {
@@ -5570,7 +5591,7 @@ function createAutoWakeCoordinator(ctx) {
5570
5591
  sessionId,
5571
5592
  event,
5572
5593
  meta,
5573
- "\u26D4\uFE0F \u8BE5\u8BDD\u9898\u5BF9\u5E94\u7684 Worker \u5F53\u524D\u5DF2\u79BB\u7EBF\uFF0C\u4F60\u6CA1\u6709\u81EA\u52A8\u5524\u9192\u6743\u9650\uFF08\u53D7 panelAccess=allowUsers \u9650\u5236\uFF09\u3002",
5594
+ "\u26D4\uFE0F The worker for this thread is offline and you lack permission to auto-wake it (restricted by panelAccess=allowUsers).",
5574
5595
  "denied"
5575
5596
  );
5576
5597
  }
@@ -5585,7 +5606,7 @@ function createAutoWakeCoordinator(ctx) {
5585
5606
  sessionId,
5586
5607
  event,
5587
5608
  meta,
5588
- "\u23F3 Worker \u6B63\u5728\u5524\u9192\u4E14\u5F85\u53D1\u961F\u5217\u5DF2\u6EE1\uFF0C\u8BF7\u7B49\u51E0\u79D2\u5C31\u7EEA\u540E\u518D\u53D1\u3002",
5609
+ "\u23F3 Worker is waking up and the pending queue is full. Wait a few seconds and retry.",
5589
5610
  "queue-full"
5590
5611
  );
5591
5612
  return;
@@ -5613,7 +5634,7 @@ function createAutoWakeCoordinator(ctx) {
5613
5634
  sessionId,
5614
5635
  event,
5615
5636
  meta,
5616
- "\u23F3 \u5F53\u524D\u540C\u65F6\u5524\u9192\u7684 Worker \u8F83\u591A\uFF0C\u8BF7\u51E0\u79D2\u540E\u91CD\u8BD5\u3002",
5637
+ "\u23F3 Too many workers are waking up concurrently. Retry in a few seconds.",
5617
5638
  "busy-cap"
5618
5639
  );
5619
5640
  return;
@@ -6506,7 +6527,7 @@ async function acquireLock(actionId, triggerName, timeoutMs = DEFAULT_TIMEOUT_MS
6506
6527
  holder: {
6507
6528
  triggerName: existing.triggerName,
6508
6529
  startedAt: existing.startedAt,
6509
- note: `\u4E0A\u4E00\u6B21\u6267\u884C\u7684\u8FDB\u7A0B\u8EAB\u4EFD\u65E0\u6CD5\u786E\u8BA4\uFF08\u53EF\u80FD\u7528\u4E86 exec \u5305\u88C5\u6539\u53D8\u4E86 argv\uFF09\u3002\u4E3A\u5B89\u5168\u8D77\u89C1\u4E0D\u81EA\u52A8\u91CA\u653E\u3002\u4EBA\u5DE5\u786E\u8BA4\u65E7\u8FDB\u7A0B\u5DF2\u505C\u6B62\u540E\uFF0C\u5220\u9664 ${dir} \u5373\u53EF\u6062\u590D\u3002`
6530
+ note: `Previous run's process identity could not be verified (argv may have changed via exec wrapper). Not auto-releasing for safety. Confirm the old process stopped, then delete ${dir} to recover.`
6510
6531
  }
6511
6532
  };
6512
6533
  }
@@ -6670,13 +6691,12 @@ function composeWorkerCard(peer, opts = {}) {
6670
6691
  { id: `panel.worker.models.${peer.instanceId}`, label: "\u{1F39A} Model" },
6671
6692
  ...peer.sessionControls ? [
6672
6693
  { id: `panel.context.${peer.instanceId}`, label: "\u{1F4CA} Context", payload: fromWorker },
6673
- { id: `panel.compact.${peer.instanceId}`, label: "\u{1F9F9} Compact", payload: fromWorker },
6674
6694
  { id: `panel.tree.${peer.instanceId}`, label: "\u{1F333} Tree", payload: fromWorker }
6675
6695
  ] : [],
6676
6696
  { id: `panel.worker.cron.${peer.instanceId}`, label: workerCron > 0 ? `\u23F0 Cron (${workerCron})` : "\u23F0 Cron" },
6697
+ ...peer.workerPeek && peer.sessionId ? [{ id: `panel.peek.${peer.instanceId}`, label: "\u{1F440} Peek", payload: peekCtx }] : [],
6677
6698
  { id: `panel.stop.${peer.instanceId}`, label: "\u23F9 Stop", payload: fromWorker },
6678
- ...canQuit ? [{ id: `panel.quit.${peer.instanceId}`, label: "\u{1F6AA} Quit", style: "danger" }] : [],
6679
- ...peer.workerPeek && peer.sessionId ? [{ id: `panel.peek.${peer.instanceId}`, label: "\u{1F440} Peek", payload: peekCtx }] : []
6699
+ ...canQuit ? [{ id: `panel.quit.${peer.instanceId}`, label: "\u{1F6AA} Quit", style: "danger" }] : []
6680
6700
  ];
6681
6701
  const title = workerDisplayTitle(peer);
6682
6702
  const modelDisplay = formatPeerModel(peer);
@@ -6686,21 +6706,21 @@ function composeWorkerCard(peer, opts = {}) {
6686
6706
  const visibleActions = wActions.slice(0, maxCustom);
6687
6707
  const items = visibleActions.map((a) => ({
6688
6708
  text: `**${cleanInline(a.label, 36)}**
6689
- ${a.runs} \u6B21 \xB7 \u6700\u8FD1 ${cleanInline(a.lastRunBy ?? "\u2014", 24)}`,
6709
+ ${a.runs} run(s) \xB7 last ${cleanInline(a.lastRunBy ?? "\u2014", 24)}`,
6690
6710
  actions: [{
6691
6711
  id: `panel.action.${a.id}`,
6692
- label: "\u25B6\uFE0F \u8FD0\u884C",
6712
+ label: "\u25B6\uFE0F Run",
6693
6713
  payload: workerCtx
6694
6714
  }]
6695
6715
  }));
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";
6716
+ const footer = wActions.length > maxCustom ? `More actions (copy to run): ${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 ? "No custom worker actions yet (actions with scope=worker appear here)." : "Inline buttons run in this worker's context (zero LLM).";
6697
6717
  const threadUrl = resolveSessionThreadUrl(peer.sessionId);
6698
6718
  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})`] : []
6719
+ `- **name**: ${cleanInline(peer.name, 48)} \xB7 **state**: ${cleanInline(state, 48)}`,
6720
+ `- **model**: \`${cleanCodeSpan(modelDisplay, 56)}\``,
6721
+ `- **host**: ${cleanInline(managedLabel, 48)} \xB7 **version**: ${cleanInline(peer.version ?? "\u2014", 24)}`,
6722
+ ...peer.cwd ? [`- **cwd**: \`${cleanCodeSpan(peer.cwd, 96)}\``] : [],
6723
+ ...threadUrl ? [`- **thread**: [\u{1F4AC} Open Thread \u2197](${threadUrl})`] : []
6704
6724
  ];
6705
6725
  return {
6706
6726
  title: `\u{1F527} ${title}`,
@@ -6712,14 +6732,14 @@ ${a.runs} \u6B21 \xB7 \u6700\u8FD1 ${cleanInline(a.lastRunBy ?? "\u2014", 24)}`,
6712
6732
  footer,
6713
6733
  actions: [
6714
6734
  ...fixedActions,
6715
- ...hideHome ? [] : [{ id: "panel.home", label: "\u{1F4CB} \u603B\u9762\u677F" }]
6735
+ ...hideHome ? [] : [{ id: "panel.home", label: "\u{1F4CB} Home", align: "end" }]
6716
6736
  ]
6717
6737
  };
6718
6738
  }
6719
6739
  function composeTargetModelsCard(peer, catalog, opts) {
6720
6740
  const isManager = opts.scope === "manager";
6721
6741
  const navCmd = isManager ? "panel.models" : `panel.worker.models.${peer.instanceId}`;
6722
- const backAction = isManager ? { id: "panel.home", label: "\u21A9\uFE0F \u603B\u9762\u677F" } : { id: `panel.worker.${peer.instanceId}`, label: "\u21A9\uFE0F Worker" };
6742
+ const backAction = isManager ? { id: "panel.home", label: "\u21A9\uFE0F Home" } : { id: `panel.worker.${peer.instanceId}`, label: "\u21A9\uFE0F Worker" };
6723
6743
  const controlMeta = { from: opts.scope, peer: peer.instanceId };
6724
6744
  const displayTitle = isManager ? "Manager" : workerDisplayTitle(peer);
6725
6745
  const safeDisplayTitle = cleanInline(displayTitle, 36);
@@ -6745,15 +6765,15 @@ ${cleanInline(m.name, 48)}` : "";
6745
6765
  text: `${isCur ? "\u2605 " : ""}\`${cleanCodeSpan(m.id, 44)}\`${subtitleLine}`,
6746
6766
  actions: [{
6747
6767
  id: `panel.model.${peer.instanceId}.${m.ref}`,
6748
- label: isCur ? "\u2713 \u5F53\u524D" : "\u5207\u6362",
6768
+ label: isCur ? "\u2713 Active" : "Select",
6749
6769
  ...isCur ? { style: "primary" } : {},
6750
6770
  payload: { ...controlMeta, provider: selectedGroup.provider, page: page2 }
6751
6771
  }]
6752
6772
  };
6753
6773
  });
6754
6774
  const navButtons2 = [];
6755
- if (page2 > 1) navButtons2.push({ id: navCmd, label: `\u25C0\uFE0F \u7B2C ${page2 - 1} \u9875`, payload: { provider: selectedGroup.provider, page: page2 - 1 } });
6756
- if (page2 < totalPages2) navButtons2.push({ id: navCmd, label: `\u7B2C ${page2 + 1} \u9875 \u25B6\uFE0F`, payload: { provider: selectedGroup.provider, page: page2 + 1 } });
6775
+ if (page2 > 1) navButtons2.push({ id: navCmd, label: `\u25C0\uFE0F Page ${page2 - 1}`, payload: { provider: selectedGroup.provider, page: page2 - 1 } });
6776
+ if (page2 < totalPages2) navButtons2.push({ id: navCmd, label: `Page ${page2 + 1} \u25B6\uFE0F`, payload: { provider: selectedGroup.provider, page: page2 + 1 } });
6757
6777
  return {
6758
6778
  title: `\u{1F39A} ${selectedGroup.provider} \xB7 ${displayTitle}`,
6759
6779
  subtitle: `${selectedGroup.models.length} model(s)${totalPages2 > 1 ? ` \xB7 p${page2}/${totalPages2}` : ""} \xB7 Current: ${currentSummary}`,
@@ -6761,10 +6781,10 @@ ${cleanInline(m.name, 48)}` : "";
6761
6781
  columnsPerRow: cols,
6762
6782
  body: headerInfo,
6763
6783
  items: items2,
6764
- footer: "\u70B9\u51FB\u53F3\u4FA7\u6309\u94AE\u5373\u5207\uFF0C\u4E0B\u6B21\u6267\u884C\u751F\u6548\uFF08zero LLM\uFF09\u3002",
6784
+ footer: "Tap a button to switch immediately; applies on the next turn (zero LLM).",
6765
6785
  actions: [
6766
6786
  ...navButtons2,
6767
- { id: navCmd, label: "\u21A9\uFE0F \u5168\u90E8 Provider", payload: {} },
6787
+ { id: navCmd, label: "\u21A9\uFE0F All Providers", payload: {} },
6768
6788
  backAction
6769
6789
  ].slice(0, 6)
6770
6790
  };
@@ -6772,7 +6792,7 @@ ${cleanInline(m.name, 48)}` : "";
6772
6792
  const advertisedThinkingLevels = peer.supportedThinkingLevels;
6773
6793
  const dynamicThinkingLevels = Array.isArray(advertisedThinkingLevels) ? advertisedThinkingLevels.length === 0 || advertisedThinkingLevels.length === 1 && advertisedThinkingLevels[0] === "off" ? [] : advertisedThinkingLevels.slice(0, 7) : THINKING_LEVELS;
6774
6794
  const activeThinkingDisplay = peer.effectiveThinkingLevel ?? peer.thinkingLevel;
6775
- const thinkingHint = Array.isArray(advertisedThinkingLevels) && dynamicThinkingLevels.length === 0 ? advertisedThinkingLevels.length === 0 ? "\n_\u5F53\u524D\u6A21\u578B\u4F7F\u7528\u56FA\u5B9A\u5185\u7F6E\u63A8\u7406\uFF08\u4E0D\u652F\u6301\u6309\u6863\u4F4D\u5207\u6362\uFF09_" : "\n_\u5F53\u524D\u6A21\u578B\u4E0D\u652F\u6301\u601D\u8003\u6863\u4F4D_" : "";
6795
+ const thinkingHint = Array.isArray(advertisedThinkingLevels) && dynamicThinkingLevels.length === 0 ? advertisedThinkingLevels.length === 0 ? "\n_Current model uses fixed built-in reasoning (thinking levels cannot be switched)._" : "\n_Current model does not support thinking levels._" : "";
6776
6796
  const makeThinkingButtons = (overviewPage) => dynamicThinkingLevels.map((level) => {
6777
6797
  const isCur = activeThinkingDisplay === level;
6778
6798
  return {
@@ -6792,7 +6812,7 @@ ${cleanInline(m.name, 48)}` : "";
6792
6812
  text: `${isCur ? "\u2605 " : ""}\`${cleanCodeSpan(m.ref, 48)}\`${subtitleLine}`,
6793
6813
  actions: [{
6794
6814
  id: `panel.model.${peer.instanceId}.${m.ref}`,
6795
- label: isCur ? "\u2713 \u5F53\u524D" : "\u5207\u6362",
6815
+ label: isCur ? "\u2713 Active" : "Select",
6796
6816
  ...isCur ? { style: "primary" } : {},
6797
6817
  payload: controlMeta
6798
6818
  }]
@@ -6805,9 +6825,9 @@ ${cleanInline(m.name, 48)}` : "";
6805
6825
  columnsPerRow: cols,
6806
6826
  body: allModels.length > 0 ? `${headerInfo}${thinkingHint}` : `${headerInfo}${thinkingHint}
6807
6827
 
6808
- _models.json \u4E2D\u672A\u627E\u5230\u53EF\u7528\u6A21\u578B_`,
6828
+ _No available models found in models.json._`,
6809
6829
  ...items2.length > 0 ? { items: items2 } : {},
6810
- footer: "\u884C\u5185\u6309\u94AE\u5207\u6A21\u578B\uFF0C\u4E0B\u65B9 \u{1F9E0} \u6309\u94AE\u76F4\u63A5\u5207 Thinking\uFF0C\u4E0B\u6B21\u6267\u884C\u751F\u6548\uFF08zero LLM\uFF09\u3002",
6830
+ footer: "Use inline buttons for Model and \u{1F9E0} buttons below for Thinking; applies next turn (zero LLM).",
6811
6831
  actions: [
6812
6832
  ...makeThinkingButtons(),
6813
6833
  backAction
@@ -6827,12 +6847,12 @@ _models.json \u4E2D\u672A\u627E\u5230\u53EF\u7528\u6A21\u578B_`,
6827
6847
  const preview = overflow > 0 ? `${sample.join(", ")} (+${overflow} more)` : sample.join(", ");
6828
6848
  const action = g.models.length === 1 ? {
6829
6849
  id: `panel.model.${peer.instanceId}.${g.models[0].ref}`,
6830
- label: currentModel === g.models[0].ref ? "\u2713 \u5F53\u524D" : "\u5207\u6362",
6850
+ label: currentModel === g.models[0].ref ? "\u2713 Active" : "Select",
6831
6851
  ...currentModel === g.models[0].ref ? { style: "primary" } : {},
6832
6852
  payload: { ...controlMeta, page }
6833
6853
  } : {
6834
6854
  id: navCmd,
6835
- label: hasCur ? "\u2605 \u5C55\u5F00" : "\u5C55\u5F00",
6855
+ label: hasCur ? "\u2605 Expand" : "Expand",
6836
6856
  ...hasCur ? { style: "primary" } : {},
6837
6857
  payload: { provider: g.provider, page: 1 }
6838
6858
  };
@@ -6843,8 +6863,8 @@ _models.json \u4E2D\u672A\u627E\u5230\u53EF\u7528\u6A21\u578B_`,
6843
6863
  };
6844
6864
  });
6845
6865
  const navButtons = [];
6846
- if (page > 1) navButtons.push({ id: navCmd, label: `\u25C0\uFE0F \u7B2C ${page - 1} \u9875`, payload: { page: page - 1 } });
6847
- if (page < totalPages) navButtons.push({ id: navCmd, label: `\u7B2C ${page + 1} \u9875 \u25B6\uFE0F`, payload: { page: page + 1 } });
6866
+ if (page > 1) navButtons.push({ id: navCmd, label: `\u25C0\uFE0F Page ${page - 1}`, payload: { page: page - 1 } });
6867
+ if (page < totalPages) navButtons.push({ id: navCmd, label: `Page ${page + 1} \u25B6\uFE0F`, payload: { page: page + 1 } });
6848
6868
  return {
6849
6869
  title: `\u{1F39A} Model & Thinking \xB7 ${displayTitle}`,
6850
6870
  subtitle: `Current: ${currentSummary} \xB7 ${catalog.length} providers / ${totalModels} models${totalPages > 1 ? ` \xB7 p${page}/${totalPages}` : ""}`,
@@ -6852,7 +6872,7 @@ _models.json \u4E2D\u672A\u627E\u5230\u53EF\u7528\u6A21\u578B_`,
6852
6872
  columnsPerRow: cols,
6853
6873
  body: `${headerInfo}${thinkingHint}`,
6854
6874
  items,
6855
- footer: "\u5355\u6A21\u578B Provider \u70B9\u51FB\u76F4\u5207\uFF0C\u591A\u6A21\u578B Provider \u70B9\u51FB\u5C55\u5F00\uFF1B\u4E0B\u65B9 \u{1F9E0} \u6309\u94AE\u76F4\u63A5\u5207 Thinking\uFF08zero LLM\uFF09\u3002",
6875
+ footer: "Single-model providers switch in one tap; multi-model providers expand. Use \u{1F9E0} buttons below for Thinking (zero LLM).",
6856
6876
  actions: [
6857
6877
  ...navButtons,
6858
6878
  ...makeThinkingButtons(page),
@@ -6869,34 +6889,34 @@ function composeWorkerQuitConfirmCard(peer, opts = {}) {
6869
6889
  const canQuit = canRemotelyQuitPeer(peer);
6870
6890
  if (!canQuit) {
6871
6891
  return {
6872
- title: "\u26D4\uFE0F \u4E0D\u53EF\u8FDC\u7A0B\u9000\u51FA",
6892
+ title: "\u26D4\uFE0F Remote Quit Unavailable",
6873
6893
  color: "red",
6874
6894
  columnsPerRow: opts.inThread ? 2 : 3,
6875
- body: `${peer.isManager ? "Manager \u5BBF\u4E3B" : "\u4EA4\u4E92\u5F0F TUI \u4F1A\u8BDD"}\u4E0D\u5141\u8BB8\u4ECE\u98DE\u4E66\u8FDC\u7A0B\u9000\u51FA\uFF08\u4ECD\u53EF\u4F7F\u7528 Stop / Model / Context / Compact\uFF09\u3002`,
6895
+ body: `${peer.isManager ? "The manager host" : "Interactive TUI sessions"} cannot be quit remotely from IM (you can still use Stop / Model / Context / Tree).`,
6876
6896
  actions: [
6877
6897
  { id: `panel.worker.${peer.instanceId}`, label: "\u21A9\uFE0F Back" },
6878
- ...hideHome ? [] : [{ id: "panel.home", label: "\u{1F4CB} \u603B\u9762\u677F" }]
6898
+ ...hideHome ? [] : [{ id: "panel.home", label: "\u{1F4CB} Home" }]
6879
6899
  ]
6880
6900
  };
6881
6901
  }
6882
6902
  const state = peer.state === "working" && peer.currentTool ? `working\xB7${peer.currentTool}` : peer.state;
6883
6903
  const quitPayload = { quit: { ref: peer.instanceId, session: peer.sessionId, ...managed?.generation ? { generation: managed.generation } : {} } };
6884
6904
  return {
6885
- title: `\u{1F6AA} \u786E\u8BA4\u9000\u51FA \xB7 ${workerDisplayTitle(peer)}`,
6905
+ title: `\u{1F6AA} Confirm Quit \xB7 ${workerDisplayTitle(peer)}`,
6886
6906
  subtitle: `${peer.name} \xB7 ${state}`,
6887
6907
  color: "red",
6888
6908
  columnsPerRow: opts.inThread ? 2 : 3,
6889
6909
  body: [
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)}\``] : [],
6910
+ `- **name**: ${cleanInline(peer.name, 48)} \xB7 **state**: ${cleanInline(state, 48)}`,
6911
+ `- **session**: \`${cleanCodeSpan(peer.sessionId, 64)}\``,
6912
+ ...peer.cwd ? [`- **cwd**: \`${cleanCodeSpan(peer.cwd, 96)}\``] : [],
6893
6913
  ``,
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"
6914
+ peer.state === "working" ? "\u26A0\uFE0F This worker is currently running a turn. Graceful quit will abort the turn, flush state, and release locks." : "Graceful quit tells this worker to flush state, release IPC locks, and exit cleanly (session history is preserved for Resume)."
6895
6915
  ].join("\n"),
6896
6916
  actions: [
6897
- { id: `panel.quit.confirm.${peer.instanceId}`, label: "\u2705 \u786E\u8BA4\u4F18\u96C5\u9000\u51FA", style: "danger", payload: quitPayload },
6898
- ...managed ? [{ id: `panel.quit.force.${peer.instanceId}`, label: "\u{1F480} \u5F3A\u5236\u7EC8\u6B62", style: "danger", payload: quitPayload }] : [],
6899
- { id: `panel.worker.${peer.instanceId}`, label: "\u21A9\uFE0F \u53D6\u6D88" }
6917
+ { id: `panel.quit.confirm.${peer.instanceId}`, label: "\u2705 Graceful Quit", style: "danger", payload: quitPayload },
6918
+ ...managed ? [{ id: `panel.quit.force.${peer.instanceId}`, label: "\u{1F480} Force Kill", style: "danger", payload: quitPayload }] : [],
6919
+ { id: `panel.worker.${peer.instanceId}`, label: "\u21A9\uFE0F Cancel" }
6900
6920
  ]
6901
6921
  };
6902
6922
  }
@@ -6905,14 +6925,14 @@ function composeOfflineWorkerCard(sessionId, opts = {}) {
6905
6925
  const bridge = currentWorkerLifecycleBridge();
6906
6926
  const resumable = sessionId ? bridge?.inspectResumable(sessionId) : void 0;
6907
6927
  const lines = [
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"
6928
+ sessionId ? `Worker session \`${cleanCodeSpan(sessionId, 64)}\` for this thread is offline (it may have exited or expired via TTL).` : "This session is currently offline (it may have exited or expired via TTL)."
6909
6929
  ];
6910
6930
  if (resumable) {
6911
6931
  lines.push(
6912
6932
  "",
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)})`}`
6933
+ `- **name**: ${cleanInline(resumable.name, 48)}`,
6934
+ `- **cwd**: \`${cleanCodeSpan(resumable.cwd, 96)}\``,
6935
+ `- **resume**: ${resumable.allowed ? "ready" : `unavailable (${cleanInline(resumable.reason ?? "blocked", 64)})`}`
6916
6936
  );
6917
6937
  }
6918
6938
  const actions = [];
@@ -6927,10 +6947,10 @@ function composeOfflineWorkerCard(sessionId, opts = {}) {
6927
6947
  actions.push({ id: `panel.worker.${opts.peerId}`, label: "\u{1F504} Refresh" });
6928
6948
  }
6929
6949
  if (!hideHome) {
6930
- actions.push({ id: "panel.home", label: "\u{1F4CB} \u603B\u9762\u677F" });
6950
+ actions.push({ id: "panel.home", label: "\u{1F4CB} Home" });
6931
6951
  }
6932
6952
  return {
6933
- title: "\u{1F4A4} Worker \u5DF2\u79BB\u7EBF",
6953
+ title: "\u{1F4A4} Worker Offline",
6934
6954
  subtitle: resumable ? `${resumable.name} \xB7 offline` : "offline",
6935
6955
  color: "grey",
6936
6956
  columnsPerRow: opts.inThread ? 2 : 3,
@@ -7067,61 +7087,60 @@ function composePanel(opts = {}) {
7067
7087
  const label = formatPeerSessionLabel(p);
7068
7088
  const verDrift = p.version && currentVer !== "unknown" && p.version !== currentVer ? ` \xB7 v${p.version}` : "";
7069
7089
  const threadUrl = resolveSessionThreadUrl(p.sessionId);
7070
- const threadLink = threadUrl ? ` \xB7 [\u{1F4AC} \u8BDD\u9898](${threadUrl})` : "";
7090
+ const threadLink = threadUrl ? ` \xB7 [\u{1F4AC} Thread](${threadUrl})` : "";
7071
7091
  const meta = `\`${cleanCodeSpan(formatPeerModel(p), 44)}\` \xB7 ${formatPeerState(p.state, p.currentTool, verDrift)}${threadLink}`;
7072
7092
  const rowActions = p === managerPeer ? [
7073
7093
  { id: "panel.models", label: "\u{1F39A} Model" },
7074
7094
  ...p.sessionControls ? [{ id: `panel.tree.${p.instanceId}`, label: "\u{1F333} Tree", payload: { from: "home" } }] : [],
7075
7095
  ...p.workerPeek && p.sessionId ? [{ id: `panel.peek.${p.instanceId}`, label: "\u{1F440} Peek", payload: { peek: { ref: p.instanceId, session: p.sessionId, isManager: true } } }] : []
7076
- ] : [{ id: `panel.worker.${p.instanceId}`, label: "\u{1F527} \u7BA1\u7406" }];
7096
+ ] : [{ id: `panel.worker.${p.instanceId}`, label: "\u{1F527} Manage" }];
7077
7097
  return { text: `${label}
7078
7098
  ${meta}`, actions: rowActions };
7079
7099
  });
7080
7100
  const nav = [];
7081
- if (page > 1) nav.push({ id: "panel.home", label: `\u25C0\uFE0F \u7B2C ${page - 1} \u9875`, payload: { page: page - 1 } });
7082
- if (page < totalPages) nav.push({ id: "panel.home", label: `\u7B2C ${page + 1} \u9875 \u25B6\uFE0F`, payload: { page: page + 1 } });
7101
+ if (page > 1) nav.push({ id: "panel.home", label: `\u25C0\uFE0F Page ${page - 1}`, payload: { page: page - 1 } });
7102
+ if (page < totalPages) nav.push({ id: "panel.home", label: `Page ${page + 1} \u25B6\uFE0F`, payload: { page: page + 1 } });
7083
7103
  const upgradeLine = upgradeSummaryLine();
7084
7104
  const footerParts = [];
7085
- if (totalPages > 1) footerParts.push(`\u7B2C ${page}/${totalPages} \u9875`);
7105
+ if (totalPages > 1) footerParts.push(`Page ${page}/${totalPages}`);
7086
7106
  footerParts.push(`${upgradeLine} \xB7 ${peers.length} session(s) \xB7 ${(/* @__PURE__ */ new Date()).toLocaleTimeString("en-GB", { hour12: false })}`);
7087
7107
  const activeCron = cronActiveCount();
7088
7108
  const blockedCron = cronBlockedSummary();
7089
7109
  if (blockedCron.memoryBlocked) {
7090
7110
  const errNote = blockedCron.memoryError ? ` (${cleanCodeSpan(blockedCron.memoryError).slice(0, 60)})` : "";
7091
- footerParts.unshift(`\u26A0\uFE0F Memory \u5B9A\u65F6\u84B8\u998F\u5DF2\u963B\u585E${errNote}\uFF0C\u8BF7\u70B9 Cron \u67E5\u770B/\u6062\u590D`);
7111
+ footerParts.unshift(`\u26A0\uFE0F Memory distillation cron is blocked${errNote} \u2014 open Cron to inspect or resume`);
7092
7112
  } else if (blockedCron.blockedCount > 0) {
7093
- footerParts.unshift(`\u26A0\uFE0F ${blockedCron.blockedCount} \u4E2A Cron \u4EFB\u52A1\u5904\u4E8E blocked \u72B6\u6001`);
7113
+ footerParts.unshift(`\u26A0\uFE0F ${blockedCron.blockedCount} cron job(s) blocked`);
7094
7114
  }
7095
- const cronLabel = blockedCron.blockedCount > 0 ? `\u26A0\uFE0F Cron (${blockedCron.blockedCount}\u963B)` : activeCron > 0 ? `\u23F0 Cron (${activeCron})` : "\u23F0 Cron";
7115
+ const cronLabel = blockedCron.blockedCount > 0 ? `\u26A0\uFE0F Cron (${blockedCron.blockedCount}!)` : activeCron > 0 ? `\u23F0 Cron (${activeCron})` : "\u23F0 Cron";
7096
7116
  const fixed = [
7097
7117
  { id: "panel.refresh", label: "\u{1F504} Refresh", ...totalPages > 1 ? { payload: { page } } : {} },
7098
- { id: "panel.summon", label: "\u{1F4CB} Resummon" },
7099
- { id: "panel.archive", label: "\u{1F4DA} \u5F52\u6863" },
7118
+ { id: "panel.archive", label: "\u{1F4DA} Archive" },
7100
7119
  ...!managerPeer ? [{ id: "panel.models", label: "\u{1F39A} Model" }] : [],
7101
7120
  { id: "panel.context", label: "\u{1F4CA} Context" },
7102
7121
  { id: "panel.memory", label: "\u{1F9E0} Memory" },
7103
7122
  { id: "panel.cron", label: cronLabel },
7104
- { id: "panel.upgrade", label: "\u2B06\uFE0F Upgrade" },
7105
- { id: "panel.help", label: "\u2753 Help" }
7123
+ { id: "panel.upgrade", label: "\u2B06\uFE0F Upgrade" }
7106
7124
  ];
7125
+ const helpAction = { id: "panel.help", label: "\u2753 Help", align: "end" };
7107
7126
  const CARD_ACTION_BUDGET = 18;
7108
7127
  const inlineCount = items.reduce((sum, item) => sum + (item.actions?.length ?? 0), 0);
7109
7128
  const custom = managerActions();
7110
- const slots = Math.max(0, CARD_ACTION_BUDGET - inlineCount - fixed.length - nav.length);
7129
+ const slots = Math.max(0, CARD_ACTION_BUDGET - inlineCount - fixed.length - 1 - nav.length);
7111
7130
  const inline = custom.length <= slots ? custom : custom.slice(0, Math.max(0, slots - 1));
7112
7131
  const customButtons = inline.map((a) => ({ id: `panel.action.${a.id}`, label: a.label.slice(0, 20) }));
7113
- if (custom.length > inline.length && slots > 0) customButtons.push({ id: "panel.actions", label: `\u26A1 \u5168\u90E8\u52A8\u4F5C (${custom.length})` });
7132
+ if (custom.length > inline.length && slots > 0) customButtons.push({ id: "panel.actions", label: `\u26A1 All Actions (${custom.length})` });
7114
7133
  return {
7115
7134
  title: "Pie Panel",
7116
7135
  subtitle: `${os6.hostname()} \xB7 ${peers.length} session(s)${totalPages > 1 ? ` \xB7 p${page}/${totalPages}` : ""} \xB7 pie ${pieVersion()}`,
7117
7136
  color: "blue",
7118
7137
  columnsPerRow: opts.inThread ? 2 : 3,
7119
- body: peers.length === 0 ? "_\u5F53\u524D\u6682\u65E0\u5728\u7EBF Pie \u4F1A\u8BDD_" : "",
7138
+ body: peers.length === 0 ? "_No online Pie sessions._" : "",
7120
7139
  ...items.length > 0 ? { items } : {},
7121
7140
  footer: footerParts.join(" \xB7 "),
7122
7141
  // r1-P2: only REGISTERED commands get buttons — unmapped ids would fall
7123
7142
  // through to an LLM turn (a button press must never spend a model turn).
7124
- actions: [...nav, ...fixed, ...customButtons]
7143
+ actions: [...nav, ...fixed, ...customButtons, helpAction]
7125
7144
  };
7126
7145
  }
7127
7146
  function pieVersion() {
@@ -7183,7 +7202,7 @@ function executePanelCommand(input) {
7183
7202
  color: "violet",
7184
7203
  columnsPerRow: cols,
7185
7204
  body: "_No live manager session found._",
7186
- actions: [{ id: "panel.home", label: "\u21A9\uFE0F \u603B\u9762\u677F" }]
7205
+ actions: [{ id: "panel.home", label: "\u21A9\uFE0F Home" }]
7187
7206
  },
7188
7207
  patchOrigin: patchInPlace
7189
7208
  };
@@ -7205,22 +7224,22 @@ function executePanelCommand(input) {
7205
7224
  text: `${formatPeerSessionLabel(p)}
7206
7225
  \`${cleanCodeSpan(formatPeerModel(p), 44)}\` \xB7 ${formatPeerState(p.state, p.currentTool)}`,
7207
7226
  actions: isCompactOnly ? [{ id: `panel.compact.${p.instanceId}`, label: "\u{1F9F9} Compact" }] : [
7208
- { id: `panel.context.${p.instanceId}`, label: "\u{1F4CA} \u67E5\u770B" },
7209
- { id: `panel.compact.${p.instanceId}`, label: "\u{1F9F9} \u538B\u7F29" }
7227
+ { id: `panel.context.${p.instanceId}`, label: "\u{1F4CA} Inspect" },
7228
+ { id: `panel.compact.${p.instanceId}`, label: "\u{1F9F9} Compact" }
7210
7229
  ]
7211
7230
  }));
7212
7231
  const nav = [];
7213
- if (page > 1) nav.push({ id: input.cmd, label: `\u25C0\uFE0F \u7B2C ${page - 1} \u9875`, payload: { page: page - 1 } });
7214
- if (page < totalPages) nav.push({ id: input.cmd, label: `\u7B2C ${page + 1} \u9875 \u25B6\uFE0F`, payload: { page: page + 1 } });
7232
+ if (page > 1) nav.push({ id: input.cmd, label: `\u25C0\uFE0F Page ${page - 1}`, payload: { page: page - 1 } });
7233
+ if (page < totalPages) nav.push({ id: input.cmd, label: `Page ${page + 1} \u25B6\uFE0F`, payload: { page: page + 1 } });
7215
7234
  return { spec: {
7216
7235
  title: isCompactOnly ? "Compact Context" : "Context & Compact",
7217
- subtitle: `${peers.length} session(s)${totalPages > 1 ? ` \xB7 p${page}/${totalPages}` : ""} \xB7 ${isCompactOnly ? "\u624B\u52A8\u538B\u7F29\u4E0A\u4E0B\u6587\u5386\u53F2" : "\u67E5\u770B\u4E0A\u4E0B\u6587\u4F30\u7B97\u6216\u624B\u52A8\u538B\u7F29\u5386\u53F2"}`,
7236
+ subtitle: `${peers.length} session(s)${totalPages > 1 ? ` \xB7 p${page}/${totalPages}` : ""} \xB7 ${isCompactOnly ? "Manually compact context history" : "Inspect context usage or compact history"}`,
7218
7237
  color: "violet",
7219
7238
  columnsPerRow: cols,
7220
- body: peers.length === 0 ? "_\u5F53\u524D\u6682\u65E0\u652F\u6301\u8BE5\u63A7\u5236\u7684\u5728\u7EBF\u4F1A\u8BDD_" : "",
7239
+ body: peers.length === 0 ? "_No online sessions currently support this control._" : "",
7221
7240
  ...items.length > 0 ? { items } : {},
7222
- footer: isCompactOnly ? "\u538B\u7F29\u4F1A\u5C06\u65E7\u5386\u53F2\u603B\u7ED3\u4E3A checkpoint \u5E76\u4FDD\u7559\u5C3E\u90E8\uFF08\u4E0E /sessions/compact \u76F8\u540C\uFF09\uFF1B\u4F1A\u8BDD\u5FD9\u788C\u65F6\u4F1A\u62D2\u7EDD\uFF0C\u8BF7\u7A7A\u95F2\u65F6\u91CD\u8BD5\u3002" : "\u300C\u{1F4CA} \u67E5\u770B\u300D\u67E5\u8BE2\u5B9E\u65F6\u4E0A\u4E0B\u6587\u5360\u7528\uFF08zero LLM\uFF09\uFF1B\u300C\u{1F9F9} \u538B\u7F29\u300D\u603B\u7ED3\u65E7\u5386\u53F2\u5E76\u4FDD\u7559\u5C3E\u90E8\uFF08\u4F1A\u8BDD\u7A7A\u95F2\u65F6\u53EF\u6267\u884C\uFF09\u3002",
7223
- actions: [...nav, { id: "panel.home", label: "\u21A9\uFE0F \u603B\u9762\u677F" }]
7241
+ footer: isCompactOnly ? "Compaction summarizes older history into a checkpoint while keeping recent turns (same as /sessions/compact). Refused while busy; retry when idle." : "Inspect checks live context usage (zero LLM). Compact summarizes older history while keeping recent turns (available when idle).",
7242
+ actions: [...nav, { id: "panel.home", label: "\u21A9\uFE0F Home" }]
7224
7243
  }, patchOrigin: patchInPlace };
7225
7244
  }
7226
7245
  if (input.cmd === "panel.actions") {
@@ -7231,21 +7250,21 @@ function executePanelCommand(input) {
7231
7250
  const slice = all.slice((page - 1) * PAGE_SIZE2, page * PAGE_SIZE2);
7232
7251
  const items = slice.map((a) => ({
7233
7252
  text: `**${cleanInline2(a.label, 36)}**
7234
- ${a.runs} \u6B21 \xB7 \u6700\u8FD1 ${cleanInline2(a.lastRunBy ?? "\u2014", 20)} \xB7 \u521B\u5EFA ${cleanInline2(a.creator?.name ?? "\u2014", 20)}`,
7235
- actions: [{ id: `panel.action.${a.id}`, label: "\u25B6\uFE0F \u8FD0\u884C" }]
7253
+ ${a.runs} run(s) \xB7 last ${cleanInline2(a.lastRunBy ?? "\u2014", 20)} \xB7 by ${cleanInline2(a.creator?.name ?? "\u2014", 20)}`,
7254
+ actions: [{ id: `panel.action.${a.id}`, label: "\u25B6\uFE0F Run" }]
7236
7255
  }));
7237
7256
  const nav = [];
7238
- if (page > 1) nav.push({ id: "panel.actions", label: `\u25C0\uFE0F \u7B2C ${page - 1} \u9875`, payload: { page: page - 1 } });
7239
- if (page < totalPages) nav.push({ id: "panel.actions", label: `\u7B2C ${page + 1} \u9875 \u25B6\uFE0F`, payload: { page: page + 1 } });
7257
+ if (page > 1) nav.push({ id: "panel.actions", label: `\u25C0\uFE0F Page ${page - 1}`, payload: { page: page - 1 } });
7258
+ if (page < totalPages) nav.push({ id: "panel.actions", label: `Page ${page + 1} \u25B6\uFE0F`, payload: { page: page + 1 } });
7240
7259
  return { spec: {
7241
- title: "\u5168\u90E8\u52A8\u4F5C",
7242
- subtitle: `${all.length} registered${totalPages > 1 ? ` \xB7 p${page}/${totalPages}` : ""} \xB7 \u70B9\u51FB\u884C\u5185\u6309\u94AE\u76F4\u63A5\u8FD0\u884C\uFF08zero LLM\uFF09`,
7260
+ title: "All Actions",
7261
+ subtitle: `${all.length} registered${totalPages > 1 ? ` \xB7 p${page}/${totalPages}` : ""} \xB7 tap inline buttons to run (zero LLM)`,
7243
7262
  color: "violet",
7244
7263
  columnsPerRow: cols,
7245
- body: all.length === 0 ? "_\u6682\u65E0\u81EA\u5B9A\u4E49\u52A8\u4F5C \u2014 \u53EF\u76F4\u63A5\u5728\u5BF9\u8BDD\u4E2D\u8BA9 Manager \u521B\u5EFA\uFF08\u4F8B\u5982\u300C\u5E2E\u6211\u505A\u4E2A\u6309\u94AE\uFF0C\u80FD\u2026\u300D\uFF09_" : "",
7264
+ body: all.length === 0 ? "_No custom actions yet \u2014 ask Manager in chat to create one._" : "",
7246
7265
  ...items.length > 0 ? { items } : {},
7247
- footer: "\u6BCF\u6B21\u6267\u884C\u90FD\u4F1A\u8BB0\u5F55\u89E6\u53D1\u4EBA\u4E0E\u5BA1\u8BA1\u65E5\u5FD7\uFF08zero LLM\uFF0C\u76F4\u63A5\u8FD0\u884C\u811A\u672C\uFF09\u3002",
7248
- actions: [...nav, { id: "panel.home", label: "\u21A9\uFE0F \u603B\u9762\u677F" }]
7266
+ footer: "Each run records the caller and audit log (zero LLM, runs script directly).",
7267
+ actions: [...nav, { id: "panel.home", label: "\u21A9\uFE0F Home" }]
7249
7268
  }, patchOrigin: patchInPlace };
7250
7269
  }
7251
7270
  if (input.cmd === "panel.worker.offline") {
@@ -7306,7 +7325,7 @@ ${a.runs} \u6B21 \xB7 \u6700\u8FD1 ${cleanInline2(a.lastRunBy ?? "\u2014", 20)}
7306
7325
  ].join("\n"),
7307
7326
  actions: [
7308
7327
  { id: "panel.upgrade.confirm", label: "\u2B06\uFE0F Install latest + restart", style: "primary", requireAllowUsers: true },
7309
- { id: "panel.home", label: "\u21A9\uFE0F \u603B\u9762\u677F" }
7328
+ { id: "panel.home", label: "\u21A9\uFE0F Home" }
7310
7329
  ]
7311
7330
  }, patchOrigin: patchInPlace };
7312
7331
  }
@@ -7314,8 +7333,8 @@ ${a.runs} \u6B21 \xB7 \u6700\u8FD1 ${cleanInline2(a.lastRunBy ?? "\u2014", 20)}
7314
7333
  return { spec: {
7315
7334
  title: "Panel Commands",
7316
7335
  columnsPerRow: cols,
7317
- body: "`/panel` summons the status panel (inside a worker thread, opens that worker's dedicated panel in-thread). Controls: \u{1F504} Refresh, \u{1F4DA} \u5F52\u6863 (browse recent historical sessions across directories, inspect offline summaries, and one-click Resume workers), \u{1F39A} Model & Thinking, \u{1F4CA} Context (inspect context usage & one-tap Compact), \u{1F333} Tree (inspect session tree & lossless rewind/branch switch; also via `/panel.tree`), \u{1F9E0} Memory (Wiki status, curated page preview, distill/GC triggers, and logs), \u23F0 Cron (list / pause / resume / stop scheduled jobs; create new jobs in chat), \u23F9 Stop (abort current turn), \u{1F6AA} Quit (graceful shutdown / force kill), \u267B\uFE0F Resume (when offline), \u{1F440} Peek (live snapshot). Navigation updates the card in place.",
7318
- actions: [{ id: "panel.home", label: "\u21A9\uFE0F \u603B\u9762\u677F" }]
7336
+ body: "`/panel` summons the status panel (inside a worker thread, opens that worker's dedicated panel in-thread). Controls: \u{1F504} Refresh, \u{1F4DA} Archive (browse recent historical sessions across directories, inspect offline summaries, and one-click Resume workers), \u{1F39A} Model & Thinking, \u{1F4CA} Context (inspect context usage & one-tap Compact), \u{1F333} Tree (inspect session tree & lossless rewind/branch switch; also via `/panel.tree`), \u{1F9E0} Memory (Wiki status, curated page preview, distill/GC triggers, and logs), \u23F0 Cron (list / pause / resume / stop scheduled jobs; create new jobs in chat), \u23F9 Stop (abort current turn), \u{1F6AA} Quit (resident workers: graceful shutdown / force kill), \u267B\uFE0F Resume (when offline), \u{1F440} Peek (live snapshot). Navigation updates the card in place.",
7337
+ actions: [{ id: "panel.home", label: "\u21A9\uFE0F Home" }]
7319
7338
  }, patchOrigin: patchInPlace };
7320
7339
  }
7321
7340
  const homePage = input.cmd === "panel.home" || input.cmd === "panel.refresh" ? parsePage(input.payload) : 1;
@@ -7350,10 +7369,10 @@ function formatRelativeTime(timestamp) {
7350
7369
  const mins = Math.floor(diffMs / 6e4);
7351
7370
  const hours = Math.floor(diffMs / 36e5);
7352
7371
  const days = Math.floor(diffMs / 864e5);
7353
- if (mins < 1) return "\u521A\u521A";
7354
- if (mins < 60) return `${mins}m\u524D`;
7355
- if (hours < 24) return `${hours}h\u524D`;
7356
- if (days < 7) return `${days}d\u524D`;
7372
+ if (mins < 1) return "just now";
7373
+ if (mins < 60) return `${mins}m ago`;
7374
+ if (hours < 24) return `${hours}h ago`;
7375
+ if (days < 7) return `${days}d ago`;
7357
7376
  const d = new Date(timestamp);
7358
7377
  const mm = String(d.getMonth() + 1).padStart(2, "0");
7359
7378
  const dd = String(d.getDate()).padStart(2, "0");
@@ -7404,11 +7423,11 @@ function composeArchiveListCard(opts = {}) {
7404
7423
  const bridge = currentWorkerLifecycleBridge();
7405
7424
  if (!bridge?.listRecentSessions) {
7406
7425
  return {
7407
- title: "\u{1F4DA} \u5F52\u6863\u4F1A\u8BDD",
7426
+ title: "\u{1F4DA} Session Archive",
7408
7427
  color: "grey",
7409
7428
  columnsPerRow: cols,
7410
- body: "\u5F53\u524D\u8FDB\u7A0B\u672A\u6302\u8F7D `pie-proc` \u5F52\u6863\u7D22\u5F15\uFF0C\u65E0\u6CD5\u5217\u51FA\u5386\u53F2\u4F1A\u8BDD\u3002",
7411
- actions: [{ id: "panel.home", label: "\u21A9\uFE0F \u603B\u9762\u677F" }]
7429
+ body: "`pie-proc` archive index is not attached on this host; historical sessions cannot be listed.",
7430
+ actions: [{ id: "panel.home", label: "\u21A9\uFE0F Home" }]
7412
7431
  };
7413
7432
  }
7414
7433
  const livePeers = scanPeers();
@@ -7434,18 +7453,18 @@ function composeArchiveListCard(opts = {}) {
7434
7453
  const items = listed.sessions.map((s) => {
7435
7454
  const livePeer = liveBySession.get(s.sessionId);
7436
7455
  const threadUrl = resolveSessionThreadUrl(s.sessionId);
7437
- const statusBadge = livePeer ? livePeer.state === "working" ? "\u{1F7E1} \u8FD0\u884C\u4E2D" : "\u{1F7E2} \u5728\u7EBF" : s.livePid ? `\u{1F7E1} \u5360\u7528(pid ${s.livePid})` : s.resumable ? "\u{1F4A4} \u53EF\u5524\u9192" : "\u{1F512} \u53EA\u8BFB";
7456
+ const statusBadge = livePeer ? livePeer.state === "working" ? "\u{1F7E1} Working" : "\u{1F7E2} Online" : s.livePid ? `\u{1F7E1} Busy (pid ${s.livePid})` : s.resumable ? "\u{1F4A4} Resumable" : "\u{1F512} Read-only";
7438
7457
  const metaParts = [
7439
7458
  statusBadge,
7440
7459
  formatRelativeTime(s.updatedAt),
7441
7460
  `${s.messageCount} msgs`,
7442
- ...threadUrl ? [`[\u{1F4AC} \u8BDD\u9898](${threadUrl})`] : []
7461
+ ...threadUrl ? [`[\u{1F4AC} Thread](${threadUrl})`] : []
7443
7462
  ];
7444
7463
  const rowActions = [
7445
- { id: `panel.archive.view.${s.sessionId}`, label: "\u{1F440} \u6458\u8981", payload: { page, scope } }
7464
+ { id: `panel.archive.view.${s.sessionId}`, label: "\u{1F440} Summary", payload: { page, scope } }
7446
7465
  ];
7447
7466
  if (livePeer && !livePeer.isManager) {
7448
- rowActions.push({ id: `panel.worker.${livePeer.instanceId}`, label: "\u{1F527} \u7BA1\u7406" });
7467
+ rowActions.push({ id: `panel.worker.${livePeer.instanceId}`, label: "\u{1F527} Manage" });
7449
7468
  } else if (!livePeer && s.resumable) {
7450
7469
  rowActions.push({
7451
7470
  id: `panel.resume.${s.sessionId}`,
@@ -7460,30 +7479,30 @@ ${metaParts.join(" \xB7 ")}`,
7460
7479
  };
7461
7480
  });
7462
7481
  const nav = [];
7463
- if (page > 1) nav.push({ id: "panel.archive", label: `\u25C0\uFE0F \u7B2C ${page - 1} \u9875`, payload: { page: page - 1, scope } });
7464
- if (page < totalPages) nav.push({ id: "panel.archive", label: `\u7B2C ${page + 1} \u9875 \u25B6\uFE0F`, payload: { page: page + 1, scope } });
7465
- const toggleAction = scope === "all" ? { id: "panel.archive", label: "\u{1F4AC} \u4EC5 IM \u8BDD\u9898", payload: { page: 1, scope: "im" } } : { id: "panel.archive", label: "\u{1F310} \u5168\u90E8\u76EE\u5F55", payload: { page: 1, scope: "all" } };
7466
- const scopeLabel = scope === "im" ? "\u4EC5 IM \u8BDD\u9898" : "\u5168\u90E8\u76EE\u5F55";
7467
- const emptyText = scope === "im" ? "_\u6682\u65E0\u5E26 IM \u8BDD\u9898\u8BB0\u5F55\u7684\u5386\u53F2\u4F1A\u8BDD \u2014 \u53EF\u5207\u6362\u300C\u{1F310} \u5168\u90E8\u76EE\u5F55\u300D\u67E5\u770B\u5168\u90E8\u9879\u76EE\u4F1A\u8BDD\u3002_" : "_\u6682\u65E0\u53EF\u5C55\u793A\u7684\u5386\u53F2\u4F1A\u8BDD\u8BB0\u5F55\u3002_";
7482
+ if (page > 1) nav.push({ id: "panel.archive", label: `\u25C0\uFE0F Page ${page - 1}`, payload: { page: page - 1, scope } });
7483
+ if (page < totalPages) nav.push({ id: "panel.archive", label: `Page ${page + 1} \u25B6\uFE0F`, payload: { page: page + 1, scope } });
7484
+ const toggleAction = scope === "all" ? { id: "panel.archive", label: "\u{1F4AC} IM Threads", payload: { page: 1, scope: "im" } } : { id: "panel.archive", label: "\u{1F310} All Dirs", payload: { page: 1, scope: "all" } };
7485
+ const scopeLabel = scope === "im" ? "IM Threads" : "All Dirs";
7486
+ const emptyText = scope === "im" ? '_No archived sessions with IM threads yet \u2014 switch to "\u{1F310} All Dirs" to browse all project sessions._' : "_No archived sessions available._";
7468
7487
  return {
7469
- title: "\u{1F4DA} \u5F52\u6863\u4F1A\u8BDD",
7470
- subtitle: `${scopeLabel} \xB7 ${listed.total} \u6761${listed.truncated ? "+" : ""}${totalPages > 1 ? ` \xB7 p${page}/${totalPages}` : ""}`,
7488
+ title: "\u{1F4DA} Session Archive",
7489
+ subtitle: `${scopeLabel} \xB7 ${listed.total}${listed.truncated ? "+" : ""} session(s)${totalPages > 1 ? ` \xB7 p${page}/${totalPages}` : ""}`,
7471
7490
  color: "violet",
7472
7491
  columnsPerRow: cols,
7473
7492
  body: items.length === 0 ? emptyText : "",
7474
7493
  ...items.length > 0 ? { items } : {},
7475
- footer: "\u70B9\u51FB \u{1F440} \u6458\u8981\u79BB\u7EBF\u67E5\u770B\u6700\u8FD1\u5BF9\u8BDD\uFF08zero LLM\uFF09\uFF1B\u70B9\u51FB \u267B\uFE0F Resume \u5524\u9192\u5BF9\u5E94 Worker\uFF08\u65E0\u8BDD\u9898\u4F1A\u81EA\u52A8\u5EFA\u8BDD\u9898\uFF09\u3002",
7494
+ footer: "Tap \u{1F440} Summary to read recent turns offline (zero LLM), or \u267B\uFE0F Resume to wake the worker (auto-opens a thread if needed).",
7476
7495
  actions: [
7477
7496
  ...nav,
7478
7497
  toggleAction,
7479
7498
  { id: "panel.archive", label: "\u{1F504} Refresh", payload: { page, scope } },
7480
- { id: "panel.home", label: "\u21A9\uFE0F \u603B\u9762\u677F" }
7499
+ { id: "panel.home", label: "\u21A9\uFE0F Home" }
7481
7500
  ]
7482
7501
  };
7483
7502
  }
7484
7503
  function renderRecentTurnsMarkdown(turns) {
7485
7504
  if (turns.length === 0) {
7486
- return "_\u6700\u8FD1\u672A\u627E\u5230\u53EF\u8BFB\u6587\u672C\u5BF9\u8BDD\uFF08\u53EF\u80FD\u5168\u662F\u5DE5\u5177\u8C03\u7528\u6216\u5DF2\u538B\u7F29\uFF09\u3002_";
7505
+ return "_No readable text turns found recently (may contain only tool calls or compacted entries)._";
7487
7506
  }
7488
7507
  const blocks = [];
7489
7508
  let used = 0;
@@ -7504,25 +7523,25 @@ function composeArchiveDetailCard(sessionId, opts = {}) {
7504
7523
  const cols = opts.inThread ? 2 : 3;
7505
7524
  const page = Math.max(1, Math.floor(opts.page ?? 1));
7506
7525
  const scope = opts.scope === "im" ? "im" : "all";
7507
- const backAction = { id: "panel.archive", label: "\u21A9\uFE0F \u8FD4\u56DE\u5F52\u6863", payload: { page, scope } };
7508
- const homeAction = { id: "panel.home", label: "\u{1F4CB} \u603B\u9762\u677F" };
7526
+ const backAction = { id: "panel.archive", label: "\u21A9\uFE0F Archive", payload: { page, scope } };
7527
+ const homeAction = { id: "panel.home", label: "\u{1F4CB} Home" };
7509
7528
  const bridge = currentWorkerLifecycleBridge();
7510
7529
  if (!bridge?.readSessionRecentTurns) {
7511
7530
  return {
7512
- title: "\u{1F4C4} \u4F1A\u8BDD\u6458\u8981\u4E0D\u53EF\u7528",
7531
+ title: "\u{1F4C4} Summary Unavailable",
7513
7532
  color: "grey",
7514
7533
  columnsPerRow: cols,
7515
- body: "\u5F53\u524D\u8FDB\u7A0B\u672A\u6302\u8F7D `pie-proc` \u5F52\u6863\u8BFB\u53D6\u5668\u3002",
7534
+ body: "`pie-proc` archive reader is not attached on this host.",
7516
7535
  actions: [backAction, homeAction]
7517
7536
  };
7518
7537
  }
7519
7538
  const res = bridge.readSessionRecentTurns(sessionId, { maxTurns: 6, maxCharsPerTurn: 300 });
7520
7539
  if (!res.ok || !res.session) {
7521
7540
  return {
7522
- title: "\u26A0\uFE0F \u65E0\u6CD5\u8BFB\u53D6\u4F1A\u8BDD",
7541
+ title: "\u26A0\uFE0F Cannot Read Session",
7523
7542
  color: "red",
7524
7543
  columnsPerRow: cols,
7525
- body: sanitizeLiteralMarkdown(res.error ?? `\u672A\u627E\u5230\u4F1A\u8BDD ${sessionId}`),
7544
+ body: sanitizeLiteralMarkdown(res.error ?? `Session ${sessionId} not found`),
7526
7545
  actions: [backAction, homeAction]
7527
7546
  };
7528
7547
  }
@@ -7530,19 +7549,19 @@ function composeArchiveDetailCard(sessionId, opts = {}) {
7530
7549
  const livePeer = findPeerBySessionId(s.sessionId);
7531
7550
  const threadUrl = resolveSessionThreadUrl(s.sessionId);
7532
7551
  const shortCwd = formatShortCwd(s.cwd);
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)})`;
7552
+ const statusText = livePeer ? livePeer.state === "working" ? "\u{1F7E1} Working (online)" : "\u{1F7E2} Online" : s.livePid ? `\u{1F7E1} Busy (pid ${s.livePid})` : s.resumable ? "\u{1F4A4} Offline \xB7 Resumable" : `\u{1F512} Not resumable (${cleanInline3(s.resumeReason ?? "blocked by allowCwd", 48)})`;
7534
7553
  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})`] : []
7554
+ `- **title**: ${cleanInline3(cleanArchiveTitle(s.name), 72)}`,
7555
+ `- **session**: \`${cleanCodeSpan(s.sessionId, 64)}\`${s.workerName ? ` \xB7 **worker**: ${cleanInline3(s.workerName, 48)}` : ""}`,
7556
+ ...shortCwd ? [`- **cwd**: \`${cleanCodeSpan(shortCwd, 88)}\``] : [],
7557
+ ...s.model ? [`- **model**: \`${cleanCodeSpan(s.model + (s.thinkingLevel ? ` (${s.thinkingLevel})` : ""), 56)}\``] : [],
7558
+ `- **updated**: ${formatClock(s.updatedAt)} (${formatRelativeTime(s.updatedAt)}) \xB7 ${s.messageCount} msgs`,
7559
+ `- **status**: ${statusText}`,
7560
+ ...threadUrl ? [`- **thread**: [\u{1F4AC} Open Thread \u2197](${threadUrl})`] : []
7542
7561
  ];
7543
7562
  const actions = [];
7544
7563
  if (livePeer && !livePeer.isManager) {
7545
- actions.push({ id: `panel.worker.${livePeer.instanceId}`, label: "\u{1F527} \u7BA1\u7406 Worker", style: "primary" });
7564
+ actions.push({ id: `panel.worker.${livePeer.instanceId}`, label: "\u{1F527} Manage Worker", style: "primary" });
7546
7565
  } else if (!livePeer && s.resumable) {
7547
7566
  actions.push({
7548
7567
  id: `panel.resume.${s.sessionId}`,
@@ -7565,7 +7584,7 @@ function composeArchiveDetailCard(sessionId, opts = {}) {
7565
7584
  body: `${infoLines.join("\n")}
7566
7585
 
7567
7586
  ---
7568
- **\u6700\u8FD1\u5BF9\u8BDD\u6458\u8981**\uFF08\u79BB\u7EBF\u8BFB\u53D6\uFF0Czero LLM\uFF09
7587
+ **Recent Conversation Summary** (offline read, zero LLM)
7569
7588
 
7570
7589
  ${renderRecentTurnsMarkdown(res.turns)}`,
7571
7590
  actions
@@ -7581,11 +7600,11 @@ function runArchivePanelCommand(panelCmd, opts) {
7581
7600
  handled: true,
7582
7601
  keyPrefix: "panel-archive-denied",
7583
7602
  spec: {
7584
- title: "\u{1F4DA} \u5F52\u6863\u4E0D\u53EF\u7528",
7603
+ title: "\u{1F4DA} Archive Unavailable",
7585
7604
  color: "red",
7586
7605
  columnsPerRow: cols,
7587
- body: "\u26D4\uFE0F \u5F52\u6863\u4F1A\u8BDD\u67E5\u8BE2\u4EC5\u9650\u5DF2\u6388\u6743\u7684\u79C1\u804A\u6216\u7ED1\u5B9A\u7FA4\u804A\u4F7F\u7528\u3002",
7588
- actions: [{ id: "panel.home", label: "\u21A9\uFE0F \u603B\u9762\u677F" }]
7606
+ body: "\u26D4\uFE0F Session archive is restricted to authorized DMs or the bound group chat.",
7607
+ actions: [{ id: "panel.home", label: "\u21A9\uFE0F Home" }]
7589
7608
  }
7590
7609
  };
7591
7610
  }
@@ -7603,11 +7622,11 @@ function runArchivePanelCommand(panelCmd, opts) {
7603
7622
  handled: true,
7604
7623
  keyPrefix: "panel-archive-invalid",
7605
7624
  spec: {
7606
- title: "\u26A0\uFE0F \u65E0\u6548\u4F1A\u8BDD ID",
7625
+ title: "\u26A0\uFE0F Invalid Session ID",
7607
7626
  color: "red",
7608
7627
  columnsPerRow: cols,
7609
- body: "\u65E0\u6548\u7684\u4F1A\u8BDD\u6807\u8BC6\u7B26\u3002",
7610
- actions: [{ id: "panel.archive", label: "\u21A9\uFE0F \u8FD4\u56DE\u5F52\u6863", payload: nav }]
7628
+ body: "Invalid session identifier.",
7629
+ actions: [{ id: "panel.archive", label: "\u21A9\uFE0F Archive", payload: nav }]
7611
7630
  }
7612
7631
  };
7613
7632
  }
@@ -7629,8 +7648,8 @@ async function ensureResumedSessionTopic(opts) {
7629
7648
  }
7630
7649
  const dirName = formatProjectName(opts.cwd);
7631
7650
  const displayName = opts.workerName?.trim() || opts.sessionId.slice(0, 12);
7632
- const readyText = `\u267B\uFE0F \u5DF2\u5524\u9192\u5F52\u6863\u4F1A\u8BDD **${cleanInline3(displayName, 40)}**${dirName ? ` (\`${cleanCodeSpan(dirName, 32)}\`)` : ""}
7633
- \u76F4\u63A5\u5728\u672C\u8BDD\u9898\u56DE\u590D\u5373\u53EF\u7EE7\u7EED\u5BF9\u8BDD\u3002`;
7651
+ const readyText = `\u267B\uFE0F Resumed archived session **${cleanInline3(displayName, 40)}**${dirName ? ` (\`${cleanCodeSpan(dirName, 32)}\`)` : ""}
7652
+ Reply in this thread to continue.`;
7634
7653
  const baseKey = `panel-resume-topic-${opts.eventId}-${opts.sessionId}`;
7635
7654
  try {
7636
7655
  let anchorMessageId;
@@ -7644,7 +7663,7 @@ async function ensureResumedSessionTopic(opts) {
7644
7663
  } else {
7645
7664
  const sent = await opts.connection.send(opts.recipient, readyText, baseKey);
7646
7665
  if (!sent?.messageId) {
7647
- return { opened: false, note: "\u81EA\u52A8\u5EFA\u8BDD\u9898\u5931\u8D25\uFF08\u6D88\u606F\u53D1\u9001\u672A\u8FD4\u56DE messageId\uFF09\uFF0C\u53EF\u5728\u603B\u9762\u677F\u8FDB\u5165\u6216\u4F7F\u7528 `\u540D\u5B57: \u6D88\u606F` \u5BF9\u8BDD\u3002" };
7666
+ return { opened: false, note: "Failed to auto-open a thread (no messageId returned). Open it from Home or address it with `name: message`." };
7648
7667
  }
7649
7668
  anchorMessageId = sent.messageId;
7650
7669
  threadId = sent.threadId ?? null;
@@ -7688,7 +7707,7 @@ async function ensureResumedSessionTopic(opts) {
7688
7707
  };
7689
7708
  } catch (error) {
7690
7709
  opts.log(`im-forward: auto-open topic for resumed session ${opts.sessionId} failed: ${error instanceof Error ? error.message : String(error)}`);
7691
- return { opened: false, note: "\u81EA\u52A8\u5EFA\u8BDD\u9898\u5931\u8D25\uFF0C\u53EF\u5728\u603B\u9762\u677F\u6253\u5F00\u8BE5 Worker \u6216\u4F7F\u7528 `\u540D\u5B57: \u6D88\u606F` \u5BF9\u8BDD\u3002" };
7710
+ return { opened: false, note: "Failed to auto-open a thread. Open this worker from Home or address it with `name: message`." };
7692
7711
  }
7693
7712
  }
7694
7713
 
@@ -7924,23 +7943,23 @@ function composeUpdatedModelsCard(opts) {
7924
7943
  banner: opts.banner
7925
7944
  });
7926
7945
  }
7927
- const homeOpt = opts.hideHome ? [] : [{ id: "panel.home", label: "\u{1F4CB} \u603B\u9762\u677F" }];
7946
+ const homeOpt = opts.hideHome ? [] : [{ id: "panel.home", label: "\u{1F4CB} Home" }];
7928
7947
  return {
7929
- title: opts.receipt.ok ? "\u2705 \u5DF2\u66F4\u65B0\u914D\u7F6E" : "\u26A0\uFE0F \u66F4\u65B0\u5931\u8D25",
7948
+ title: opts.receipt.ok ? "\u2705 Settings Updated" : "\u26A0\uFE0F Update Failed",
7930
7949
  color: opts.receipt.ok ? "green" : "red",
7931
7950
  columnsPerRow: cols,
7932
7951
  body: `${opts.banner}
7933
7952
 
7934
7953
  ${sanitizeLiteralMarkdown(opts.receipt.detail)}`,
7935
- actions: effectiveScope === "manager" ? [{ id: "panel.models", label: "\u{1F39A} Model & Thinking" }, { id: "panel.home", label: "\u{1F4CB} \u603B\u9762\u677F" }] : opts.hideHome ? panelHomeAction(true, opts.threadWorkerSessionId, opts.peerRef) : [{ id: `panel.worker.${opts.peerRef}`, label: "\u21A9\uFE0F Worker" }, ...homeOpt]
7954
+ actions: effectiveScope === "manager" ? [{ id: "panel.models", label: "\u{1F39A} Model & Thinking" }, { id: "panel.home", label: "\u{1F4CB} Home" }] : opts.hideHome ? panelHomeAction(true, opts.threadWorkerSessionId, opts.peerRef) : [{ id: `panel.worker.${opts.peerRef}`, label: "\u21A9\uFE0F Worker" }, ...homeOpt]
7936
7955
  };
7937
7956
  }
7938
7957
  function panelHomeAction(inThread, threadWorkerSessionId, peerRef) {
7939
- if (!inThread) return [{ id: "panel.home", label: "\u{1F4CB} \u603B\u9762\u677F" }];
7958
+ if (!inThread) return [{ id: "panel.home", label: "\u{1F4CB} Home" }];
7940
7959
  if (peerRef) return [{ id: `panel.worker.${peerRef}`, label: "\u21A9\uFE0F Worker" }];
7941
7960
  if (threadWorkerSessionId) {
7942
7961
  const live = findPeerBySessionId(threadWorkerSessionId);
7943
- return live ? [{ id: `panel.worker.${live.instanceId}`, label: "\u21A9\uFE0F Worker" }] : [{ id: "panel.worker.offline", label: "\u{1F504} Worker \u9762\u677F", payload: { sessionId: threadWorkerSessionId } }];
7962
+ return live ? [{ id: `panel.worker.${live.instanceId}`, label: "\u21A9\uFE0F Worker" }] : [{ id: "panel.worker.offline", label: "\u{1F504} Worker Panel", payload: { sessionId: threadWorkerSessionId } }];
7944
7963
  }
7945
7964
  return [];
7946
7965
  }
@@ -7971,7 +7990,7 @@ function guardThreadWorkerScope(panelCmd, workerScoped, inThread, pinnedWorkerSe
7971
7990
  const deny = (reason) => ({
7972
7991
  blocked: true,
7973
7992
  spec: {
7974
- title: "\u26D4\uFE0F \u4EC5\u9650\u5F53\u524D Worker \u9762\u677F",
7993
+ title: "\u26D4\uFE0F Worker Panel Only",
7975
7994
  color: "red",
7976
7995
  columnsPerRow: cols,
7977
7996
  body: reason,
@@ -7979,24 +7998,24 @@ function guardThreadWorkerScope(panelCmd, workerScoped, inThread, pinnedWorkerSe
7979
7998
  }
7980
7999
  });
7981
8000
  if (THREAD_FORBIDDEN_GLOBAL_CMDS.has(panelCmd.cmd) || panelCmd.cmd.startsWith("panel.archive.view.")) {
7982
- return deny("Thread \u5185\u7684 Worker \u9762\u677F\u4E0D\u80FD\u64CD\u4F5C\u603B\u9762\u677F\u3001\u5F52\u6863\u6216 Manager\uFF0C\u8BF7\u5728\u4E3B\u7FA4/\u79C1\u804A\u4F7F\u7528 `/panel`\u3002");
8001
+ return deny("In-thread worker panels cannot access Home, Archive, or Manager. Use `/panel` in the main chat or DM.");
7983
8002
  }
7984
8003
  if (panelCmd.cmd === "panel.worker.offline" || panelCmd.cmd === "panel.worker.cron.offline") {
7985
8004
  const rawSid = panelCmd.payload && typeof panelCmd.payload === "object" && !Array.isArray(panelCmd.payload) ? panelCmd.payload.sessionId : void 0;
7986
8005
  if (typeof rawSid === "string" && rawSid.trim() && rawSid.trim() !== pinnedWorkerSessionId) {
7987
- return deny("Thread \u5185\u7684 Worker \u9762\u677F\u4E0D\u80FD\u8BBF\u95EE\u5176\u4ED6 Worker \u4F1A\u8BDD\u3002");
8006
+ return deny("In-thread worker panels cannot access other worker sessions.");
7988
8007
  }
7989
8008
  return { blocked: false };
7990
8009
  }
7991
8010
  const resumeMatch = /^panel\.resume\.([A-Za-z0-9][A-Za-z0-9-_]{5,63})$/.exec(panelCmd.cmd);
7992
8011
  if (resumeMatch && resumeMatch[1] !== pinnedWorkerSessionId) {
7993
- return deny("Thread \u5185\u7684 Worker \u9762\u677F\u53EA\u80FD\u6062\u590D\u5F53\u524D thread \u5BF9\u5E94\u7684 Worker\u3002");
8012
+ return deny("In-thread worker panels can only resume the worker belonging to this thread.");
7994
8013
  }
7995
8014
  const actionMatch = /^panel\.action\.([a-z0-9][a-z0-9-]{0,31})$/.exec(panelCmd.cmd);
7996
8015
  if (actionMatch) {
7997
8016
  const action = findAction(actionMatch[1]);
7998
8017
  if (action?.scope === "manager") {
7999
- return deny("Thread \u5185\u7684 Worker \u9762\u677F\u4E0D\u80FD\u6267\u884C Manager \u7EA7\u52A8\u4F5C\u3002");
8018
+ return deny("In-thread worker panels cannot run manager-scoped actions.");
8000
8019
  }
8001
8020
  return { blocked: false };
8002
8021
  }
@@ -8004,21 +8023,21 @@ function guardThreadWorkerScope(panelCmd, workerScoped, inThread, pinnedWorkerSe
8004
8023
  if (viewPeerMatch) {
8005
8024
  const peer = scanPeers().find((p) => p.instanceId === viewPeerMatch[1]);
8006
8025
  if (peer && (peer.isManager || peer.sessionId !== pinnedWorkerSessionId)) {
8007
- return deny("Thread \u5185\u7684 Worker \u9762\u677F\u53EA\u80FD\u67E5\u770B\u6216\u64CD\u4F5C\u5F53\u524D Worker\u3002");
8026
+ return deny("In-thread worker panels can only inspect or control the current worker.");
8008
8027
  }
8009
8028
  return { blocked: false };
8010
8029
  }
8011
8030
  const cronJobMatch = /^panel\.cron\.(?:pause|resume|stop(?:\.confirm)?)\.([A-Za-z0-9-]{8,64})$/.exec(panelCmd.cmd);
8012
8031
  if (cronJobMatch) {
8013
8032
  if (panelCmd.cmd.startsWith("panel.cron.stop.confirm.") && verifiedCronStopSessionId && verifiedCronStopSessionId !== pinnedWorkerSessionId) {
8014
- return deny("Thread \u5185\u7684 Worker \u9762\u677F\u53EA\u80FD\u64CD\u4F5C\u5F53\u524D Worker \u7684\u5B9A\u65F6\u4EFB\u52A1\u3002");
8033
+ return deny("In-thread worker panels can only manage this worker's scheduled jobs.");
8015
8034
  }
8016
8035
  const bridge = currentCronPanelBridge();
8017
8036
  if (bridge) {
8018
8037
  const jobId = cronJobMatch[1];
8019
8038
  const allMatches = bridge.listJobs().jobs.filter((j) => j.id === jobId);
8020
8039
  if (allMatches.length > 0 && !allMatches.some((j) => j.sessionId === pinnedWorkerSessionId)) {
8021
- return deny("Thread \u5185\u7684 Worker \u9762\u677F\u53EA\u80FD\u64CD\u4F5C\u5F53\u524D Worker \u7684\u5B9A\u65F6\u4EFB\u52A1\uFF0C\u4E0D\u80FD\u64CD\u4F5C Manager\u3001\u7CFB\u7EDF\u6216\u5176\u4ED6 Worker \u7684\u4EFB\u52A1\u3002");
8040
+ return deny("In-thread worker panels can only manage this worker's scheduled jobs, not manager, system, or other workers' jobs.");
8022
8041
  }
8023
8042
  }
8024
8043
  return { blocked: false };
@@ -8027,10 +8046,10 @@ function guardThreadWorkerScope(panelCmd, workerScoped, inThread, pinnedWorkerSe
8027
8046
  if (quitExecMatch) {
8028
8047
  const peer = scanPeers().find((p) => p.instanceId === quitExecMatch[1]);
8029
8048
  if (peer && (peer.isManager || peer.sessionId !== pinnedWorkerSessionId)) {
8030
- return deny("Thread \u5185\u7684 Worker \u9762\u677F\u4E0D\u80FD\u9000\u51FA Manager \u6216\u5176\u4ED6 Worker\u3002");
8049
+ return deny("In-thread worker panels cannot quit Manager or other workers.");
8031
8050
  }
8032
8051
  if (verifiedQuitSessionId && verifiedQuitSessionId !== pinnedWorkerSessionId) {
8033
- return deny("Thread \u5185\u7684 Worker \u9762\u677F\u4E0D\u80FD\u9000\u51FA\u5176\u4ED6 Worker\u3002");
8052
+ return deny("In-thread worker panels cannot quit other workers.");
8034
8053
  }
8035
8054
  return { blocked: false };
8036
8055
  }
@@ -8039,10 +8058,10 @@ function guardThreadWorkerScope(panelCmd, workerScoped, inThread, pinnedWorkerSe
8039
8058
  const peer = scanPeers().find((p) => p.instanceId === treePeerMatch[1]);
8040
8059
  if (peer) {
8041
8060
  if (peer.isManager || peer.sessionId !== pinnedWorkerSessionId) {
8042
- return deny("Thread \u5185\u7684 Worker \u9762\u677F\u53EA\u80FD\u67E5\u770B\u6216\u64CD\u4F5C\u5F53\u524D Worker \u7684\u4F1A\u8BDD\u6811\u3002");
8061
+ return deny("In-thread worker panels can only view or control this worker's session tree.");
8043
8062
  }
8044
8063
  if (panelCmd.cmd.startsWith("panel.tree.branch.confirm.") && verifiedTreeBranchSessionId && verifiedTreeBranchSessionId !== pinnedWorkerSessionId) {
8045
- return deny("Thread \u5185\u7684 Worker \u9762\u677F\u53EA\u80FD\u5207\u6362\u5F53\u524D Worker \u7684\u4F1A\u8BDD\u5206\u652F\u3002");
8064
+ return deny("In-thread worker panels can only switch this worker's session branch.");
8046
8065
  }
8047
8066
  return { blocked: false };
8048
8067
  }
@@ -8053,7 +8072,7 @@ function guardThreadWorkerScope(panelCmd, workerScoped, inThread, pinnedWorkerSe
8053
8072
  const peer = scanPeers().find((p) => p.instanceId === ctrlPeerMatch[1]);
8054
8073
  if (peer) {
8055
8074
  if (peer.isManager || peer.sessionId !== pinnedWorkerSessionId) {
8056
- return deny("Thread \u5185\u7684 Worker \u9762\u677F\u53EA\u80FD\u64CD\u4F5C\u5F53\u524D Worker\uFF0C\u4E0D\u80FD\u64CD\u4F5C Manager \u6216\u5176\u4ED6 Worker\u3002");
8075
+ return deny("In-thread worker panels can only control the current worker, not Manager or other workers.");
8057
8076
  }
8058
8077
  return { blocked: false };
8059
8078
  }
@@ -8066,7 +8085,7 @@ function isMutatingWorkerLifecycleCommand(cmd) {
8066
8085
  }
8067
8086
  async function runWorkerLifecycleCommand(panelCmd, inThread, verifiedQuit, threadWorkerSessionId, hideHome = inThread, onResumed) {
8068
8087
  const cols = inThread ? 2 : 3;
8069
- const homeOpt = hideHome ? [] : [{ id: "panel.home", label: "\u{1F4CB} \u603B\u9762\u677F" }];
8088
+ const homeOpt = hideHome ? [] : [{ id: "panel.home", label: "\u{1F4CB} Home" }];
8070
8089
  const homeOrWorker = (peerRef) => panelHomeAction(hideHome, threadWorkerSessionId, peerRef);
8071
8090
  const thinkingAction = /^panel\.thinking\.([A-Za-z0-9-]+)\.(off|minimal|low|medium|high|xhigh|max)$/.exec(panelCmd.cmd);
8072
8091
  if (thinkingAction) {
@@ -8076,7 +8095,7 @@ async function runWorkerLifecycleCommand(panelCmd, inThread, verifiedQuit, threa
8076
8095
  const rec = panelCmd.payload && typeof panelCmd.payload === "object" && !Array.isArray(panelCmd.payload) ? panelCmd.payload : void 0;
8077
8096
  const fromManager = !hideHome && rec?.from === "manager";
8078
8097
  const page = typeof rec?.page === "number" && Number.isFinite(rec.page) ? Math.floor(rec.page) : void 0;
8079
- const banner = receipt.ok ? `\u2705 \u5DF2\u5207\u6362\u4E3A \`thinking=${level}\`\uFF08\u4E0B\u6B21\u6267\u884C\u751F\u6548\uFF09` : `\u26A0\uFE0F \u5207\u6362 \`thinking=${level}\` \u5931\u8D25\uFF1A${sanitizeLiteralMarkdown(receipt.detail)}`;
8098
+ const banner = receipt.ok ? `\u2705 Switched to \`thinking=${level}\` (applies next turn)` : `\u26A0\uFE0F Failed to switch \`thinking=${level}\`: ${sanitizeLiteralMarkdown(receipt.detail)}`;
8080
8099
  return {
8081
8100
  handled: true,
8082
8101
  keyPrefix: "panel-thinking",
@@ -8123,10 +8142,10 @@ ${sanitizeLiteralMarkdown(receipt.detail)}`,
8123
8142
  handled: true,
8124
8143
  keyPrefix: "panel-quit-unverified",
8125
8144
  spec: {
8126
- title: "\u26D4\uFE0F \u9000\u51FA\u786E\u8BA4\u5DF2\u5931\u6548",
8145
+ title: "\u26D4\uFE0F Quit Confirmation Expired",
8127
8146
  color: "red",
8128
8147
  columnsPerRow: cols,
8129
- body: "\u7F3A\u5C11\u6709\u6548\u7684\u9000\u51FA\u786E\u8BA4\u5361\u7247\u7ED1\u5B9A\uFF08\u6216\u5DF2\u8FC7\u671F\uFF09\u3002\u8BF7\u4ECE /panel \u91CD\u65B0\u6253\u5F00\u76EE\u6807 worker \u540E\u518D\u64CD\u4F5C\u3002",
8148
+ body: "Missing or expired quit confirmation binding. Re-open the target worker from `/panel` and try again.",
8130
8149
  actions: homeOrWorker()
8131
8150
  }
8132
8151
  };
@@ -8147,10 +8166,10 @@ ${sanitizeLiteralMarkdown(receipt.detail)}`,
8147
8166
  handled: true,
8148
8167
  keyPrefix: "panel-quit-stale",
8149
8168
  spec: {
8150
- title: "\u26A0\uFE0F Worker \u4F1A\u8BDD\u5DF2\u53D8\u66F4",
8169
+ title: "\u26A0\uFE0F Worker Session Changed",
8151
8170
  color: "red",
8152
8171
  columnsPerRow: cols,
8153
- body: "\u76EE\u6807\u5361\u7247\u7ED1\u5B9A\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u5237\u65B0\u9762\u677F\u540E\u91CD\u8BD5\u3002",
8172
+ body: "This card's target binding expired. Refresh the panel and try again.",
8154
8173
  actions: [
8155
8174
  { id: `panel.worker.${peerRef}`, label: "\u{1F504} Refresh" },
8156
8175
  ...homeOpt
@@ -8163,10 +8182,10 @@ ${sanitizeLiteralMarkdown(receipt.detail)}`,
8163
8182
  handled: true,
8164
8183
  keyPrefix: "panel-quit-refused",
8165
8184
  spec: {
8166
- title: "\u26D4\uFE0F \u4E0D\u53EF\u8FDC\u7A0B\u9000\u51FA",
8185
+ title: "\u26D4\uFE0F Remote Quit Unavailable",
8167
8186
  color: "red",
8168
8187
  columnsPerRow: cols,
8169
- body: `${peer.isManager ? "Manager \u5BBF\u4E3B" : "\u4EA4\u4E92\u5F0F TUI \u4F1A\u8BDD"}\u4E0D\u5141\u8BB8\u4ECE\u98DE\u4E66\u8FDC\u7A0B\u9000\u51FA\u3002`,
8188
+ body: `${peer.isManager ? "The manager host" : "Interactive TUI sessions"} cannot be quit remotely from IM.`,
8170
8189
  actions: [
8171
8190
  { id: `panel.worker.${peerRef}`, label: "\u21A9\uFE0F Back" },
8172
8191
  ...homeOpt
@@ -8194,7 +8213,7 @@ ${sanitizeLiteralMarkdown(receipt.detail)}`,
8194
8213
  actions2.push({ id: `panel.resume.${peer.sessionId}`, label: "\u267B\uFE0F Resume Worker", style: "primary" });
8195
8214
  }
8196
8215
  if (!exited && managed) {
8197
- actions2.push({ id: `panel.quit.force.${peer.instanceId}`, label: "\u{1F480} \u5F3A\u5236\u7EC8\u6B62", style: "danger", payload: { quit: { ref: peer.instanceId, session: peer.sessionId, generation: managed.generation } } });
8216
+ actions2.push({ id: `panel.quit.force.${peer.instanceId}`, label: "\u{1F480} Force Kill", style: "danger", payload: { quit: { ref: peer.instanceId, session: peer.sessionId, generation: managed.generation } } });
8198
8217
  }
8199
8218
  actions2.push({ id: "panel.worker.offline", label: "\u{1F504} Refresh", payload: { sessionId: peer.sessionId } });
8200
8219
  actions2.push(...homeOpt);
@@ -8202,17 +8221,17 @@ ${sanitizeLiteralMarkdown(receipt.detail)}`,
8202
8221
  handled: true,
8203
8222
  keyPrefix: "panel-quit-ok",
8204
8223
  spec: {
8205
- title: exited ? `\u2705 Worker \u5DF2\u9000\u51FA \xB7 ${peer.name}` : `\u23F3 \u4F18\u96C5\u9000\u51FA\u5DF2\u4E0B\u53D1 \xB7 ${peer.name}`,
8224
+ title: exited ? `\u2705 Worker Exited \xB7 ${peer.name}` : `\u23F3 Graceful Quit Sent \xB7 ${peer.name}`,
8206
8225
  color: exited ? "green" : "blue",
8207
8226
  columnsPerRow: cols,
8208
- body: exited ? resumable?.allowed ? `\u5DF2\u4F18\u96C5\u9000\u51FA \`${cleanCodeSpan(peer.name, 48)}\`\uFF08\u4F1A\u8BDD \`${cleanCodeSpan(peer.sessionId, 64)}\` \u5DF2\u4FDD\u5B58\uFF0C\u53EF\u968F\u65F6 Resume\uFF09\u3002` : `\u5DF2\u4F18\u96C5\u9000\u51FA \`${cleanCodeSpan(peer.name, 48)}\`\uFF08\u4F1A\u8BDD \`${cleanCodeSpan(peer.sessionId, 64)}\` ${resumable?.reason ? `\u6682\u4E0D\u53EF Resume\uFF1A${sanitizeLiteralMarkdown(resumable.reason)}` : "\u5C1A\u672A\u4EA7\u751F\u53EF\u6062\u590D\u7684\u6301\u4E45\u5316\u4F1A\u8BDD\u8BB0\u5F55"}\uFF09\u3002` : `\u5DF2\u5411 \`${cleanCodeSpan(peer.name, 48)}\` \u4E0B\u53D1\u4F18\u96C5\u9000\u51FA\u6307\u4EE4\uFF0C\u6B63\u5728\u6536\u5C3E\u843D\u76D8\u3002\u7A0D\u540E\u70B9 \u{1F504} Refresh \u786E\u8BA4${managed ? "\uFF0C\u82E5\u65E0\u54CD\u5E94\u53EF\u70B9 \u{1F480} \u5F3A\u5236\u7EC8\u6B62" : ""}\u3002`,
8227
+ body: exited ? resumable?.allowed ? `Gracefully exited \`${cleanCodeSpan(peer.name, 48)}\` (session \`${cleanCodeSpan(peer.sessionId, 64)}\` saved; ready to Resume anytime).` : `Gracefully exited \`${cleanCodeSpan(peer.name, 48)}\` (session \`${cleanCodeSpan(peer.sessionId, 64)}\` ${resumable?.reason ? `cannot be resumed yet: ${sanitizeLiteralMarkdown(resumable.reason)}` : "has no persisted resumable history yet"}).` : `Sent graceful quit to \`${cleanCodeSpan(peer.name, 48)}\`; flushing state. Tap \u{1F504} Refresh shortly to verify${managed ? ", or tap \u{1F480} Force Kill if unresponsive" : ""}.`,
8209
8228
  actions: actions2
8210
8229
  }
8211
8230
  };
8212
8231
  }
8213
8232
  const actions = [];
8214
8233
  if (managed) {
8215
- actions.push({ id: `panel.quit.force.${peer.instanceId}`, label: "\u{1F480} \u5F3A\u5236\u7EC8\u6B62", style: "danger", payload: { quit: { ref: peer.instanceId, session: peer.sessionId, generation: managed.generation } } });
8234
+ actions.push({ id: `panel.quit.force.${peer.instanceId}`, label: "\u{1F480} Force Kill", style: "danger", payload: { quit: { ref: peer.instanceId, session: peer.sessionId, generation: managed.generation } } });
8216
8235
  }
8217
8236
  actions.push({ id: `panel.worker.${peer.instanceId}`, label: "\u21A9\uFE0F Back" });
8218
8237
  actions.push(...homeOpt);
@@ -8220,10 +8239,10 @@ ${sanitizeLiteralMarkdown(receipt.detail)}`,
8220
8239
  handled: true,
8221
8240
  keyPrefix: "panel-quit-fail",
8222
8241
  spec: {
8223
- title: `\u26A0\uFE0F \u4F18\u96C5\u9000\u51FA\u672A\u54CD\u5E94 \xB7 ${peer.name}`,
8242
+ title: `\u26A0\uFE0F Graceful Quit Unresponsive \xB7 ${peer.name}`,
8224
8243
  color: "red",
8225
8244
  columnsPerRow: cols,
8226
- body: `${sanitizeLiteralMarkdown(receipt.detail)}${managed ? "\n\n\u8BE5 worker \u7531 `pie-proc` \u6258\u7BA1\uFF0C\u53EF\u70B9\u51FB\u4E0B\u65B9 **\u{1F480} \u5F3A\u5236\u7EC8\u6B62**\uFF08\u6309 launchToken \u4E25\u683C\u6821\u9A8C\u540E\u6E05\u7406\u8FDB\u7A0B\u7EC4\uFF09\u3002" : ""}`,
8245
+ body: `${sanitizeLiteralMarkdown(receipt.detail)}${managed ? "\n\nThis worker is supervised by `pie-proc`; tap **\u{1F480} Force Kill** below to terminate its process group (verified by launchToken)." : ""}`,
8227
8246
  actions
8228
8247
  }
8229
8248
  };
@@ -8236,10 +8255,10 @@ ${sanitizeLiteralMarkdown(receipt.detail)}`,
8236
8255
  handled: true,
8237
8256
  keyPrefix: "panel-quit-force-unverified",
8238
8257
  spec: {
8239
- title: "\u26D4\uFE0F \u5F3A\u5236\u7EC8\u6B62\u7ED1\u5B9A\u5DF2\u5931\u6548",
8258
+ title: "\u26D4\uFE0F Force Kill Binding Expired",
8240
8259
  color: "red",
8241
8260
  columnsPerRow: cols,
8242
- body: "\u7F3A\u5C11\u6709\u6548\u7684\u5F3A\u5236\u7EC8\u6B62\u5361\u7247\u7ED1\u5B9A\uFF08\u6216\u5DF2\u8FC7\u671F\uFF09\u3002\u8BF7\u4ECE /panel \u91CD\u65B0\u6253\u5F00\u76EE\u6807 worker \u540E\u518D\u64CD\u4F5C\u3002",
8261
+ body: "Missing or expired force-kill card binding. Re-open the target worker from `/panel` and try again.",
8243
8262
  actions: homeOrWorker()
8244
8263
  }
8245
8264
  };
@@ -8251,10 +8270,10 @@ ${sanitizeLiteralMarkdown(receipt.detail)}`,
8251
8270
  handled: true,
8252
8271
  keyPrefix: "panel-quit-force-refused",
8253
8272
  spec: {
8254
- title: "\u26D4\uFE0F \u4E0D\u53EF\u5F3A\u5236\u7EC8\u6B62",
8273
+ title: "\u26D4\uFE0F Force Kill Unavailable",
8255
8274
  color: "red",
8256
8275
  columnsPerRow: cols,
8257
- body: "Manager \u6216\u4EA4\u4E92\u5F0F TUI \u4F1A\u8BDD\u4E0D\u652F\u6301\u8FDC\u7A0B\u5F3A\u5236\u7EC8\u6B62\u3002",
8276
+ body: "Manager and interactive TUI sessions do not support remote force kill.",
8258
8277
  actions: homeOrWorker(peerRef)
8259
8278
  }
8260
8279
  };
@@ -8264,10 +8283,10 @@ ${sanitizeLiteralMarkdown(receipt.detail)}`,
8264
8283
  handled: true,
8265
8284
  keyPrefix: "panel-quit-force-stale",
8266
8285
  spec: {
8267
- title: "\u26A0\uFE0F Worker \u4F1A\u8BDD\u5DF2\u53D8\u66F4",
8286
+ title: "\u26A0\uFE0F Worker Session Changed",
8268
8287
  color: "red",
8269
8288
  columnsPerRow: cols,
8270
- body: "\u76EE\u6807\u5361\u7247\u7ED1\u5B9A\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u5237\u65B0\u9762\u677F\u540E\u91CD\u8BD5\u3002",
8289
+ body: "This card's target binding expired. Refresh the panel and try again.",
8271
8290
  actions: homeOrWorker()
8272
8291
  }
8273
8292
  };
@@ -8280,10 +8299,10 @@ ${sanitizeLiteralMarkdown(receipt.detail)}`,
8280
8299
  handled: true,
8281
8300
  keyPrefix: "panel-quit-force-unmanaged",
8282
8301
  spec: {
8283
- title: "\u26A0\uFE0F \u65E0\u6CD5\u5F3A\u5236\u7EC8\u6B62",
8302
+ title: "\u26A0\uFE0F Cannot Force Kill",
8284
8303
  color: "red",
8285
8304
  columnsPerRow: cols,
8286
- body: "\u672A\u5728\u5F53\u524D manager \u7684 `pie-proc` \u6CE8\u518C\u8868\u4E2D\u627E\u5230\u8BE5\u6258\u7BA1 worker\uFF08\u53EF\u80FD\u5DF2\u9000\u51FA\u6216\u5E76\u975E\u7531 manager \u62C9\u8D77\uFF09\u3002",
8305
+ body: "Managed worker not found in this manager's `pie-proc` registry (it may have exited or was not spawned by this manager).",
8287
8306
  actions: [
8288
8307
  { id: "panel.worker.offline", label: "\u{1F504} Refresh", payload: { sessionId: targetSession } },
8289
8308
  ...homeOpt
@@ -8296,10 +8315,10 @@ ${sanitizeLiteralMarkdown(receipt.detail)}`,
8296
8315
  handled: true,
8297
8316
  keyPrefix: "panel-quit-force-incarnation",
8298
8317
  spec: {
8299
- title: "\u26D4\uFE0F Worker \u5B9E\u4F8B\u4EE3\u9645\u5DF2\u53D8\u66F4",
8318
+ title: "\u26D4\uFE0F Worker Generation Changed",
8300
8319
  color: "red",
8301
8320
  columnsPerRow: cols,
8302
- body: "\u8BE5\u5F3A\u5236\u7EC8\u6B62\u5361\u7247\u7B7E\u53D1\u81EA\u66F4\u65E9\u7684 worker \u8FDB\u7A0B\u4EE3\u9645\uFF08\u53EF\u80FD\u5DF2\u91CD\u542F/Resume \u4E3A\u65B0\u5B9E\u4F8B\uFF09\uFF0C\u5DF2\u62D2\u7EDD\u8BEF\u6740\u65B0\u8FDB\u7A0B\u3002\u8BF7\u5237\u65B0\u9762\u677F\u540E\u91CD\u8BD5\u3002",
8321
+ body: "This force-kill card was issued for an earlier worker generation (the worker may have restarted or resumed). Refused to kill the new process; refresh and retry.",
8303
8322
  actions: [
8304
8323
  { id: "panel.worker.offline", label: "\u{1F504} Refresh", payload: { sessionId: targetSession } },
8305
8324
  ...homeOpt
@@ -8313,7 +8332,7 @@ ${sanitizeLiteralMarkdown(receipt.detail)}`,
8313
8332
  handled: true,
8314
8333
  keyPrefix: "panel-quit-force-result",
8315
8334
  spec: {
8316
- title: res.ok ? `\u2705 \u5DF2\u5F3A\u5236\u7EC8\u6B62 \xB7 ${managed.name}` : `\u26A0\uFE0F \u5F3A\u5236\u7EC8\u6B62\u672A\u786E\u8BA4 \xB7 ${managed.name}`,
8335
+ title: res.ok ? `\u2705 Force Killed \xB7 ${managed.name}` : `\u26A0\uFE0F Force Kill Unconfirmed \xB7 ${managed.name}`,
8317
8336
  color: res.ok ? "green" : "red",
8318
8337
  columnsPerRow: cols,
8319
8338
  body: sanitizeLiteralMarkdown(res.detail),
@@ -8331,7 +8350,7 @@ ${sanitizeLiteralMarkdown(receipt.detail)}`,
8331
8350
  const rec = isRecord(panelCmd.payload) ? panelCmd.payload : void 0;
8332
8351
  const archiveBack = !hideHome && rec?.from === "archive" ? [{
8333
8352
  id: "panel.archive",
8334
- label: "\u21A9\uFE0F \u8FD4\u56DE\u5F52\u6863",
8353
+ label: "\u21A9\uFE0F Archive",
8335
8354
  payload: {
8336
8355
  page: typeof rec.page === "number" && Number.isFinite(rec.page) && rec.page >= 1 ? Math.floor(rec.page) : 1,
8337
8356
  scope: rec.scope === "im" ? "im" : "all"
@@ -8344,14 +8363,14 @@ ${sanitizeLiteralMarkdown(receipt.detail)}`,
8344
8363
  handled: true,
8345
8364
  keyPrefix: "panel-resume-live",
8346
8365
  spec: {
8347
- title: `\u{1F7E2} Worker \u5DF2\u5728\u7EBF \xB7 ${sanitizeLiteralMarkdown(alreadyLive.name)}`,
8366
+ title: `\u{1F7E2} Worker Already Online \xB7 ${sanitizeLiteralMarkdown(alreadyLive.name)}`,
8348
8367
  color: "green",
8349
8368
  columnsPerRow: cols,
8350
- body: `\u4F1A\u8BDD \`${cleanCodeSpan(sessionId, 64)}\` \u5F53\u524D\u5DF2\u5728\u7EBF\uFF08\u72B6\u6001\uFF1A${sanitizeLiteralMarkdown(alreadyLive.state)}\uFF09\uFF0C\u65E0\u9700\u91CD\u590D\u5524\u9192\u3002${liveThread ? `
8369
+ body: `Session \`${cleanCodeSpan(sessionId, 64)}\` is already online (state: ${sanitizeLiteralMarkdown(alreadyLive.state)}).${liveThread ? `
8351
8370
 
8352
- [\u{1F4AC} \u6253\u5F00\u8BDD\u9898 \u2197](${liveThread})` : ""}`,
8371
+ [\u{1F4AC} Open Thread \u2197](${liveThread})` : ""}`,
8353
8372
  actions: [
8354
- { id: `panel.worker.${alreadyLive.instanceId}`, label: "\u{1F527} \u6253\u5F00 Worker \u9762\u677F", style: "primary" },
8373
+ { id: `panel.worker.${alreadyLive.instanceId}`, label: "\u{1F527} Open Worker Panel", style: "primary" },
8355
8374
  ...archiveBack,
8356
8375
  ...homeOpt
8357
8376
  ]
@@ -8364,10 +8383,10 @@ ${sanitizeLiteralMarkdown(receipt.detail)}`,
8364
8383
  handled: true,
8365
8384
  keyPrefix: "panel-resume-unavailable",
8366
8385
  spec: {
8367
- title: "\u26A0\uFE0F Resume \u4E0D\u53EF\u7528",
8386
+ title: "\u26A0\uFE0F Resume Unavailable",
8368
8387
  color: "red",
8369
8388
  columnsPerRow: cols,
8370
- body: "\u5F53\u524D\u8FDB\u7A0B\u672A\u6302\u8F7D `pie-proc` \u751F\u547D\u5468\u671F\u7BA1\u7406\u5668\uFF0C\u65E0\u6CD5\u8FDC\u7A0B\u62C9\u8D77 worker\u3002",
8389
+ body: "`pie-proc` lifecycle manager is not attached on this host; cannot resume workers remotely.",
8371
8390
  actions: [...archiveBack, ...homeOrWorker()]
8372
8391
  }
8373
8392
  };
@@ -8380,11 +8399,11 @@ ${sanitizeLiteralMarkdown(receipt.detail)}`,
8380
8399
  if (topic.threadUrl) {
8381
8400
  topicLine = topic.opened ? `
8382
8401
 
8383
- \u{1F195} \u5DF2\u81EA\u52A8\u521B\u5EFA\u65B0\u8BDD\u9898\uFF1A[\u{1F4AC} \u6253\u5F00\u8BDD\u9898 \u2197](${topic.threadUrl})` : `
8402
+ \u{1F195} Opened a new thread: [\u{1F4AC} Open Thread \u2197](${topic.threadUrl})` : `
8384
8403
 
8385
- \u{1F4AC} \u5DF2\u5173\u8054\u539F\u8BDD\u9898\uFF1A[\u{1F4AC} \u6253\u5F00\u539F\u8BDD\u9898 \u2197](${topic.threadUrl})`;
8404
+ \u{1F4AC} Linked existing thread: [\u{1F4AC} Open Thread \u2197](${topic.threadUrl})`;
8386
8405
  } else if (topic.opened) {
8387
- topicLine = "\n\n\u{1F195} \u5DF2\u81EA\u52A8\u53D1\u9001\u5C31\u7EEA\u6D88\u606F\u5E76\u521B\u5EFA\u65B0\u8BDD\u9898\uFF0C\u53EF\u76F4\u63A5\u5728\u65B0\u8BDD\u9898\u91CC\u56DE\u590D\u7EE7\u7EED\u5BF9\u8BDD\u3002";
8406
+ topicLine = "\n\n\u{1F195} Sent a ready message and opened a new thread \u2014 reply there to continue.";
8388
8407
  } else if (topic.note) {
8389
8408
  topicLine = `
8390
8409
 
@@ -8395,14 +8414,14 @@ _${sanitizeLiteralMarkdown(topic.note)}_`;
8395
8414
  handled: true,
8396
8415
  keyPrefix: "panel-resume-result",
8397
8416
  spec: {
8398
- title: res.ok ? `\u267B\uFE0F Worker \u5DF2\u62C9\u8D77${res.name ? ` \xB7 ${res.name}` : ""}` : "\u26A0\uFE0F Resume \u5931\u8D25",
8417
+ title: res.ok ? `\u267B\uFE0F Worker Resumed${res.name ? ` \xB7 ${res.name}` : ""}` : "\u26A0\uFE0F Resume Failed",
8399
8418
  color: res.ok ? "green" : "red",
8400
8419
  columnsPerRow: cols,
8401
8420
  body: res.ok ? `${sanitizeLiteralMarkdown(res.detail)}${topicLine}
8402
8421
 
8403
- \u7B49\u5F85 1-2 \u79D2\u5F85 worker \u5C31\u7EEA\u540E\uFF0C\u70B9\u4E0B\u65B9 **\u{1F504} \u6253\u5F00 Worker \u9762\u677F** \u67E5\u770B\u5B9E\u65F6\u72B6\u6001\uFF0C\u6216\u76F4\u63A5\u8FDB\u5165\u8BDD\u9898\u7EE7\u7EED\u53D1\u6D88\u606F\u3002` : sanitizeLiteralMarkdown(res.detail),
8422
+ Wait 1\u20132s for the worker to connect, then tap **\u{1F504} Open Worker Panel** below or continue in its thread.` : sanitizeLiteralMarkdown(res.detail),
8404
8423
  actions: [
8405
- { id: "panel.worker.offline", label: "\u{1F504} \u6253\u5F00 Worker \u9762\u677F", payload: { sessionId } },
8424
+ { id: "panel.worker.offline", label: "\u{1F504} Open Worker Panel", payload: { sessionId } },
8406
8425
  ...archiveBack,
8407
8426
  ...homeOpt
8408
8427
  ]
@@ -8428,21 +8447,21 @@ function buildPeekCardSpec(targetRef, targetSession, isManagerTarget, cols, rece
8428
8447
  const actions = [
8429
8448
  {
8430
8449
  id: `panel.peek.refresh.${targetRef}`,
8431
- label: meta.page > 1 ? "\u23ED \u6700\u65B0" : "\u{1F504} Refresh",
8450
+ label: meta.page > 1 ? "\u23ED Latest" : "\u{1F504} Refresh",
8432
8451
  payload: { peek: { ref: targetRef, session: targetSession, page: 1 } }
8433
8452
  }
8434
8453
  ];
8435
8454
  if (meta.page < meta.totalPages) {
8436
8455
  actions.push({
8437
8456
  id: `panel.peek.refresh.${targetRef}`,
8438
- label: "\u25C0\uFE0F \u66F4\u65E9",
8457
+ label: "\u25C0\uFE0F Older",
8439
8458
  payload: { peek: { ref: targetRef, session: targetSession, page: meta.page + 1 } }
8440
8459
  });
8441
8460
  }
8442
8461
  if (meta.page > 2) {
8443
8462
  actions.push({
8444
8463
  id: `panel.peek.refresh.${targetRef}`,
8445
- label: "\u8F83\u65B0 \u25B6\uFE0F",
8464
+ label: "Newer \u25B6\uFE0F",
8446
8465
  payload: { peek: { ref: targetRef, session: targetSession, page: meta.page - 1 } }
8447
8466
  });
8448
8467
  }
@@ -8450,7 +8469,7 @@ function buildPeekCardSpec(targetRef, targetSession, isManagerTarget, cols, rece
8450
8469
  actions.push({ id: `panel.worker.${targetRef}`, label: "\u21A9\uFE0F Worker" });
8451
8470
  }
8452
8471
  if (!inThread) {
8453
- actions.push({ id: "panel.home", label: "\u{1F4CB} \u603B\u9762\u677F" });
8472
+ actions.push({ id: "panel.home", label: "\u{1F4CB} Home" });
8454
8473
  }
8455
8474
  return {
8456
8475
  title: isManagerTarget ? "\u{1F440} Manager Peek" : "\u{1F440} Worker Peek",
@@ -8515,13 +8534,13 @@ function formatNextTime(next, enabled, state) {
8515
8534
  }
8516
8535
  function formatJobState(job) {
8517
8536
  if (job.state === "running") {
8518
- if (job.pendingAction === "remove") return "\u23F3 \u5F85\u505C\u6B62";
8519
- if (job.pendingAction === "pause") return "\u23F3 \u5F85\u6682\u505C";
8537
+ if (job.pendingAction === "remove") return "\u23F3 stopping";
8538
+ if (job.pendingAction === "pause") return "\u23F3 pausing";
8520
8539
  return "\u{1F7E1} running";
8521
8540
  }
8522
8541
  if (job.state === "blocked") return "\u{1F534} blocked";
8523
8542
  if (!job.enabled) {
8524
- if (job.remaining !== void 0 && job.remaining <= 0) return "\u2705 \u5DF2\u5B8C\u6210";
8543
+ if (job.remaining !== void 0 && job.remaining <= 0) return "\u2705 done";
8525
8544
  return "\u23F8 paused";
8526
8545
  }
8527
8546
  return "\u{1F7E2} ready";
@@ -8547,15 +8566,15 @@ function composeCronListCard(opts) {
8547
8566
  const baseMeta = isWorker ? { from: "worker", ...opts.peer ? { peer: opts.peer.instanceId } : {}, ...targetSessionId ? { sessionId: targetSessionId } : {} } : { from: "global" };
8548
8567
  const backActions = isWorker ? [
8549
8568
  ...opts.peer ? [{ id: `panel.worker.${opts.peer.instanceId}`, label: "\u21A9\uFE0F Worker" }] : targetSessionId ? [{ id: "panel.worker.offline", label: "\u21A9\uFE0F Worker", payload: { sessionId: targetSessionId } }] : [],
8550
- ...hideHome ? [] : [{ id: "panel.home", label: "\u{1F4CB} \u603B\u9762\u677F" }]
8551
- ] : [{ id: "panel.home", label: "\u21A9\uFE0F \u603B\u9762\u677F" }];
8569
+ ...hideHome ? [] : [{ id: "panel.home", label: "\u{1F4CB} Home" }]
8570
+ ] : [{ id: "panel.home", label: "\u21A9\uFE0F Home" }];
8552
8571
  const bridge = currentCronPanelBridge();
8553
8572
  if (!bridge) {
8554
8573
  return {
8555
8574
  title: `\u23F0 Cron${titleSuffix}`,
8556
8575
  color: "grey",
8557
8576
  columnsPerRow: cols,
8558
- body: "\u5F53\u524D\u8FDB\u7A0B\u672A\u542F\u7528 `cron` \u6269\u5C55\uFF0C\u65E0\u6CD5\u8BFB\u53D6\u5B9A\u65F6\u4EFB\u52A1\u3002",
8577
+ body: "The `cron` extension is not enabled on this host; scheduled jobs cannot be listed.",
8559
8578
  actions: backActions
8560
8579
  };
8561
8580
  }
@@ -8580,35 +8599,35 @@ function composeCronListCard(opts) {
8580
8599
  const rowActions = [];
8581
8600
  if (job.state === "running") {
8582
8601
  if (job.pendingAction !== "pause" && job.pendingAction !== "remove") {
8583
- rowActions.push({ id: `panel.cron.pause.${job.id}`, label: "\u23F8 \u6682\u505C", payload: actionPayload });
8602
+ rowActions.push({ id: `panel.cron.pause.${job.id}`, label: "\u23F8 Pause", payload: actionPayload });
8584
8603
  }
8585
8604
  if (job.pendingAction !== "remove") {
8586
- rowActions.push({ id: `panel.cron.stop.${job.id}`, label: "\u23F9 \u505C\u6B62", style: "danger", payload: actionPayload });
8605
+ rowActions.push({ id: `panel.cron.stop.${job.id}`, label: "\u23F9 Stop", style: "danger", payload: actionPayload });
8587
8606
  }
8588
8607
  } else if (job.enabled && job.state !== "blocked") {
8589
- rowActions.push({ id: `panel.cron.pause.${job.id}`, label: "\u23F8 \u6682\u505C", payload: actionPayload });
8590
- rowActions.push({ id: `panel.cron.stop.${job.id}`, label: "\u23F9 \u505C\u6B62", style: "danger", payload: actionPayload });
8608
+ rowActions.push({ id: `panel.cron.pause.${job.id}`, label: "\u23F8 Pause", payload: actionPayload });
8609
+ rowActions.push({ id: `panel.cron.stop.${job.id}`, label: "\u23F9 Stop", style: "danger", payload: actionPayload });
8591
8610
  } else {
8592
8611
  if (canResumeJob(job)) {
8593
- rowActions.push({ id: `panel.cron.resume.${job.id}`, label: "\u25B6\uFE0F \u6062\u590D", style: "primary", payload: actionPayload });
8612
+ rowActions.push({ id: `panel.cron.resume.${job.id}`, label: "\u25B6\uFE0F Resume", style: "primary", payload: actionPayload });
8594
8613
  }
8595
- rowActions.push({ id: `panel.cron.stop.${job.id}`, label: "\u23F9 \u505C\u6B62", style: "danger", payload: actionPayload });
8614
+ rowActions.push({ id: `panel.cron.stop.${job.id}`, label: "\u23F9 Stop", style: "danger", payload: actionPayload });
8596
8615
  }
8597
8616
  return { text: lines.join("\n"), actions: rowActions };
8598
8617
  });
8599
8618
  const bodyParts = [];
8600
8619
  if (opts.banner) bodyParts.push(opts.banner);
8601
8620
  if (jobs.length === 0) {
8602
- bodyParts.push(isWorker ? "_\u5F53\u524D Worker \u6682\u65E0\u5B9A\u65F6\u4EFB\u52A1_" : "_\u5F53\u524D\u6682\u65E0\u5B9A\u65F6\u4EFB\u52A1_");
8621
+ bodyParts.push(isWorker ? "_No scheduled jobs for this worker._" : "_No scheduled jobs._");
8603
8622
  }
8604
8623
  const footerParts = [];
8605
8624
  if (listed.warnings && listed.warnings.length > 0) {
8606
8625
  footerParts.push(`\u26A0\uFE0F _${cleanInlineText(listed.warnings.join(" \xB7 "), 160)}_`);
8607
8626
  }
8608
- footerParts.push("\u65B0\u589E\u5B9A\u65F6\u4EFB\u52A1\u8BF7\u76F4\u63A5\u5728\u5BF9\u8BDD\u4E2D\u544A\u8BC9 Pie\uFF1B\u884C\u5185\u6309\u94AE\u53EF\u76F4\u63A5\u6682\u505C\u3001\u6062\u590D\u6216\u505C\u6B62\uFF08zero LLM\uFF09\u3002");
8627
+ footerParts.push("Create new scheduled jobs in chat; inline buttons pause, resume, or stop jobs directly (zero LLM).");
8609
8628
  const navButtons = [];
8610
- if (page > 1) navButtons.push({ id: navCmd, label: `\u25C0\uFE0F \u7B2C ${page - 1} \u9875`, payload: { ...baseMeta, page: page - 1 } });
8611
- if (page < totalPages) navButtons.push({ id: navCmd, label: `\u7B2C ${page + 1} \u9875 \u25B6\uFE0F`, payload: { ...baseMeta, page: page + 1 } });
8629
+ if (page > 1) navButtons.push({ id: navCmd, label: `\u25C0\uFE0F Page ${page - 1}`, payload: { ...baseMeta, page: page - 1 } });
8630
+ if (page < totalPages) navButtons.push({ id: navCmd, label: `Page ${page + 1} \u25B6\uFE0F`, payload: { ...baseMeta, page: page + 1 } });
8612
8631
  navButtons.push({ id: navCmd, label: "\u{1F504} Refresh", payload: { ...baseMeta, page } });
8613
8632
  return {
8614
8633
  title: `\u23F0 Cron${titleSuffix}`,
@@ -8633,20 +8652,20 @@ function composeCronStopConfirmCard(job, opts) {
8633
8652
  cronStop: { jobId: job.id, sessionId: job.sessionId, storeKey: job.storeKey }
8634
8653
  };
8635
8654
  return {
8636
- title: "\u23F9 \u786E\u8BA4\u505C\u6B62\u5B9A\u65F6\u4EFB\u52A1",
8655
+ title: "\u23F9 Confirm Stop Cron Job",
8637
8656
  subtitle: `${cleanCell(job.schedule.text, 48)} \xB7 ${formatJobState(job)}`,
8638
8657
  color: "red",
8639
8658
  columnsPerRow: cols,
8640
8659
  body: [
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)}`] : [],
8660
+ `- **task**: ${cleanCell(job.summary, 64)}`,
8661
+ `- **schedule**: ${formatScheduleCell(job)} \xB7 **state**: ${formatJobState(job)}`,
8662
+ ...job.ownerLabel ? [`- **owner**: ${cleanCell(job.ownerLabel, 32)}`] : [],
8644
8663
  ``,
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"
8664
+ job.state === "running" ? "\u26A0\uFE0F This job is currently running. Confirming will queue removal as soon as this turn finishes." : job.managedBy ? `Stopping removes managed job \`${cleanCodeSpan(job.managedBy, 64)}\` and remembers the opt-out (it will not auto-recreate on restart).` : "Stopping permanently removes this scheduled job (you can recreate it in chat anytime)."
8646
8665
  ].join("\n"),
8647
8666
  actions: [
8648
- { id: `panel.cron.stop.confirm.${job.id}`, label: "\u2705 \u786E\u8BA4\u505C\u6B62\u5220\u9664", style: "danger", payload: stopPayload },
8649
- { id: backListCmd, label: "\u21A9\uFE0F \u53D6\u6D88", payload: baseMeta }
8667
+ { id: `panel.cron.stop.confirm.${job.id}`, label: "\u2705 Confirm Stop", style: "danger", payload: stopPayload },
8668
+ { id: backListCmd, label: "\u21A9\uFE0F Cancel", payload: baseMeta }
8650
8669
  ]
8651
8670
  };
8652
8671
  }
@@ -8715,10 +8734,10 @@ function runCronPanelCommand(panelCmd, opts) {
8715
8734
  handled: true,
8716
8735
  keyPrefix: "panel-worker-cron-offline",
8717
8736
  spec: {
8718
- title: "\u23F0 Cron \xB7 Worker \u5DF2\u79BB\u7EBF",
8737
+ title: "\u23F0 Cron \xB7 Worker Offline",
8719
8738
  color: "grey",
8720
8739
  columnsPerRow: cols,
8721
- body: "\u672A\u627E\u5230\u8BE5 Worker \u4F1A\u8BDD\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u8BD5\u3002",
8740
+ body: "Worker session not found. Please refresh and try again.",
8722
8741
  actions: panelHomeAction(opts.hideHome, opts.pinnedWorkerSessionId)
8723
8742
  }
8724
8743
  };
@@ -8762,7 +8781,7 @@ function runCronPanelCommand(panelCmd, opts) {
8762
8781
  inThread: opts.inThread,
8763
8782
  hideHome: opts.hideHome,
8764
8783
  page: meta.page,
8765
- banner: "\u26A0\uFE0F \u672A\u627E\u5230\u8BE5\u5B9A\u65F6\u4EFB\u52A1\uFF08\u53EF\u80FD\u5DF2\u88AB\u505C\u6B62\u6216\u5DF2\u5B8C\u6210\uFF09\u3002"
8784
+ banner: "\u26A0\uFE0F Scheduled job not found (it may have already stopped or completed)."
8766
8785
  })
8767
8786
  };
8768
8787
  }
@@ -8803,7 +8822,7 @@ function runCronPanelCommand(panelCmd, opts) {
8803
8822
  inThread: opts.inThread,
8804
8823
  hideHome: opts.hideHome,
8805
8824
  page: meta.page,
8806
- banner: "\u26D4\uFE0F \u505C\u6B62\u786E\u8BA4\u7ED1\u5B9A\u5DF2\u5931\u6548\u6216\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u70B9\u51FB \u23F9 \u505C\u6B62\u6309\u94AE\u3002"
8825
+ banner: "\u26D4\uFE0F Stop confirmation expired or invalid. Please tap \u23F9 Stop again."
8807
8826
  })
8808
8827
  };
8809
8828
  }
@@ -8824,8 +8843,9 @@ function runCronPanelCommand(panelCmd, opts) {
8824
8843
  ...opts.senderId ? { senderId: opts.senderId } : {},
8825
8844
  ...storeKey ? { storeKey } : {}
8826
8845
  });
8827
- const verb = action === "pause" ? "\u6682\u505C" : action === "resume" ? "\u6062\u590D" : "\u505C\u6B62\u5220\u9664";
8828
- const banner = res.ok ? res.outcome === "deferred" ? `\u23F3 \u5DF2\u6392\u961F${verb}\uFF08\u4EFB\u52A1\u8FD0\u884C\u4E2D\uFF0C\u672C\u8F6E\u7ED3\u675F\u540E\u81EA\u52A8\u751F\u6548\uFF09` : `\u2705 \u5DF2${verb}\u5B9A\u65F6\u4EFB\u52A1${res.job ? `\uFF1A${cleanInlineText(res.job.summary, 40)}` : ""}` : `\u26A0\uFE0F ${verb}\u5931\u8D25\uFF1A${cleanInlineText(res.detail, 120)}`;
8846
+ const verb = action === "pause" ? "pause" : action === "resume" ? "resume" : "stop";
8847
+ const pastVerb = action === "pause" ? "Paused" : action === "resume" ? "Resumed" : "Stopped";
8848
+ const banner = res.ok ? res.outcome === "deferred" ? `\u23F3 Queued ${verb} (job is running; takes effect after this turn)` : `\u2705 ${pastVerb} cron job${res.job ? `: ${cleanInlineText(res.job.summary, 40)}` : ""}` : `\u26A0\uFE0F Failed to ${verb}: ${cleanInlineText(res.detail, 120)}`;
8829
8849
  return {
8830
8850
  handled: true,
8831
8851
  keyPrefix: `panel-cron-${action}`,
@@ -8882,17 +8902,17 @@ function formatNodeClock(timestamp) {
8882
8902
  function kindBadge(kind) {
8883
8903
  switch (kind) {
8884
8904
  case "user":
8885
- return "\u{1F464} \u7528\u6237";
8905
+ return "\u{1F464} User";
8886
8906
  case "assistant":
8887
- return "\u{1F916} \u52A9\u624B";
8907
+ return "\u{1F916} Assistant";
8888
8908
  case "tool":
8889
- return "\u{1F527} \u5DE5\u5177";
8909
+ return "\u{1F527} Tool";
8890
8910
  case "compaction":
8891
- return "\u{1F9F9} \u538B\u7F29";
8911
+ return "\u{1F9F9} Compact";
8892
8912
  case "fork":
8893
- return "\u{1F33F} \u5206\u53C9";
8913
+ return "\u{1F33F} Fork";
8894
8914
  default:
8895
- return "\u{1F4CC} \u8BB0\u5F55";
8915
+ return "\u{1F4CC} Entry";
8896
8916
  }
8897
8917
  }
8898
8918
  function parseTreeMeta(payload) {
@@ -8990,17 +9010,17 @@ function backActionsFor(peer, opts) {
8990
9010
  return [{ id: `panel.worker.${peer.instanceId}`, label: "\u21A9\uFE0F Worker" }];
8991
9011
  }
8992
9012
  if (opts.from === "home" || peer.isManager) {
8993
- return [{ id: "panel.home", label: "\u21A9\uFE0F \u603B\u9762\u677F" }];
9013
+ return [{ id: "panel.home", label: "\u21A9\uFE0F Home" }];
8994
9014
  }
8995
9015
  return [
8996
9016
  { id: `panel.worker.${peer.instanceId}`, label: "\u21A9\uFE0F Worker" },
8997
- { id: "panel.home", label: "\u{1F4CB} \u603B\u9762\u677F" }
9017
+ { id: "panel.home", label: "\u{1F4CB} Home" }
8998
9018
  ];
8999
9019
  }
9000
9020
  function formatPeerErrorDetail(detail) {
9001
9021
  const unwrapped = unwrapControlReceiptMessage(detail)?.message ?? detail;
9002
9022
  if (/unknown control:\s*session\.(?:tree|branch)/i.test(unwrapped)) {
9003
- return "\u8BE5\u4F1A\u8BDD\u8FD0\u884C\u7684 Pie \u7248\u672C\u8F83\u65E7\uFF0C\u6682\u4E0D\u652F\u6301\u8FDC\u7A0B Tree\uFF08\u5347\u7EA7\u540E\u53EF\u7528\uFF09\u3002";
9023
+ return "This session is running an older version of Pie that does not support remote Tree (upgrade to enable).";
9004
9024
  }
9005
9025
  return sanitizeLiteralMarkdown(unwrapped);
9006
9026
  }
@@ -9013,17 +9033,17 @@ function composeTreeListCard(peer, report, opts) {
9013
9033
  const items = report.nodes.map((node) => {
9014
9034
  const marker = node.isHead ? "\u2605" : node.onActivePath ? "\u25CF" : "\u{1F33F}";
9015
9035
  const tags = [];
9016
- if (node.isHead) tags.push("\u5F53\u524D");
9036
+ if (node.isHead) tags.push("current");
9017
9037
  if (node.isBranchPoint) tags.push(`\u2442\xD7${node.childCount}`);
9018
- if (node.isBranchTip) tags.push("\u5206\u652F\u672B");
9038
+ if (node.isBranchTip) tags.push("branch tip");
9019
9039
  if (node.label) tags.push(`\u{1F3F7}\uFE0F${cleanInline4(node.label, 20)}`);
9020
9040
  const tagSuffix = tags.length > 0 ? ` \xB7 ${tags.join(" ")}` : "";
9021
- const preview = cleanInline4(node.preview || "(\u7A7A)", 72);
9041
+ const preview = cleanInline4(node.preview || "(empty)", 72);
9022
9042
  const text = `${marker} **#${node.seq}** ${kindBadge(node.kind)} \xB7 ${formatNodeClock(node.timestamp)}${tagSuffix}
9023
9043
  ${preview}`;
9024
9044
  const actions = node.isHead ? [] : [{
9025
9045
  id: `panel.tree.branch.${peer.instanceId}`,
9026
- label: node.onActivePath ? "\u23EA \u56DE\u9000" : "\u{1F33F} \u5207\u5206\u652F",
9046
+ label: node.onActivePath ? "\u23EA Rewind" : "\u{1F33F} Switch",
9027
9047
  payload: { entryId: node.id, page: report.page, filter: report.filter, from: fromVal }
9028
9048
  }];
9029
9049
  return { text, ...actions.length > 0 ? { actions } : {} };
@@ -9031,37 +9051,37 @@ ${preview}`;
9031
9051
  const bodyLines = [];
9032
9052
  if (opts.banner) bodyLines.push(opts.banner);
9033
9053
  if (!report.isIdle || report.compactionRunning) {
9034
- bodyLines.push("\u26A0\uFE0F \u4F1A\u8BDD\u5F53\u524D\u5FD9\u788C\u4E2D\uFF08\u8F93\u51FA\u6216\u538B\u7F29\u8FDB\u884C\u4E2D\uFF09\uFF0C\u5207\u6362\u524D\u8BF7\u5148\u505C\u6B62\u5F53\u524D\u8F93\u51FA\u3002");
9054
+ bodyLines.push("\u26A0\uFE0F Session is currently busy (streaming or compacting). Stop the current turn before switching branches.");
9035
9055
  }
9036
9056
  if (report.truncated) {
9037
- bodyLines.push("\u2139\uFE0F \u4F1A\u8BDD\u8282\u70B9\u8F83\u591A\uFF0C\u4EC5\u626B\u63CF\u6700\u8FD1\u7A97\u53E3\uFF08\u4ECD\u53EF\u901A\u8FC7\u8FC7\u6EE4\u67E5\u770B\u6700\u65B0\u5173\u952E\u8282\u70B9\uFF09\u3002");
9057
+ bodyLines.push("\u2139\uFE0F Large session tree \u2014 scanning only the most recent window (filter still shows latest key entries).");
9038
9058
  }
9039
9059
  if (items.length === 0) {
9040
- bodyLines.push(report.filter === "key" ? "_\u6682\u65E0\u5173\u952E\u8282\u70B9\uFF0C\u53EF\u70B9\u51FB\u4E0B\u65B9\u300C\u{1F50D} \u663E\u793A\u5168\u90E8\u300D\u67E5\u770B\u6240\u6709\u8BB0\u5F55\u3002_" : "_\u5F53\u524D\u4F1A\u8BDD\u6682\u65E0\u6811\u8282\u70B9\u3002_");
9060
+ bodyLines.push(report.filter === "key" ? '_No key entries yet \u2014 tap "\u{1F50D} Show All" below to view all entries._' : "_No tree entries in this session yet._");
9041
9061
  }
9042
9062
  const navButtons = [];
9043
9063
  if (report.page > 1) {
9044
- navButtons.push({ id: `panel.tree.${peer.instanceId}`, label: `\u25C0\uFE0F \u7B2C ${report.page - 1} \u9875`, payload: { ...navBase, page: report.page - 1 } });
9064
+ navButtons.push({ id: `panel.tree.${peer.instanceId}`, label: `\u25C0\uFE0F Page ${report.page - 1}`, payload: { ...navBase, page: report.page - 1 } });
9045
9065
  }
9046
9066
  if (report.page < report.totalPages) {
9047
- navButtons.push({ id: `panel.tree.${peer.instanceId}`, label: `\u7B2C ${report.page + 1} \u9875 \u25B6\uFE0F`, payload: { ...navBase, page: report.page + 1 } });
9067
+ navButtons.push({ id: `panel.tree.${peer.instanceId}`, label: `Page ${report.page + 1} \u25B6\uFE0F`, payload: { ...navBase, page: report.page + 1 } });
9048
9068
  }
9049
- const toggleFilter = report.filter === "key" ? { id: `panel.tree.${peer.instanceId}`, label: "\u{1F50D} \u663E\u793A\u5168\u90E8", payload: { filter: "all", page: 1, from: fromVal } } : { id: `panel.tree.${peer.instanceId}`, label: "\u2728 \u4EC5\u5173\u952E\u8282\u70B9", payload: { filter: "key", page: 1, from: fromVal } };
9069
+ const toggleFilter = report.filter === "key" ? { id: `panel.tree.${peer.instanceId}`, label: "\u{1F50D} Show All", payload: { filter: "all", page: 1, from: fromVal } } : { id: `panel.tree.${peer.instanceId}`, label: "\u2728 Key Only", payload: { filter: "key", page: 1, from: fromVal } };
9050
9070
  const subtitleParts = [
9051
- headSeq !== void 0 ? `\u5F53\u524D #${headSeq}` : "\u65E0\u6D3B\u52A8\u8282\u70B9",
9052
- `${report.totalEntries} \u8282\u70B9`,
9053
- ...report.branchPointCount > 0 ? [`${report.branchPointCount} \u5206\u53C9`] : [],
9054
- ...report.otherBranchTipCount > 0 ? [`${report.otherBranchTipCount} \u5176\u4ED6\u5206\u652F`] : [],
9071
+ headSeq !== void 0 ? `HEAD #${headSeq}` : "no active entry",
9072
+ `${report.totalEntries} entries`,
9073
+ ...report.branchPointCount > 0 ? [`${report.branchPointCount} forks`] : [],
9074
+ ...report.otherBranchTipCount > 0 ? [`${report.otherBranchTipCount} other branches`] : [],
9055
9075
  `p${report.page}/${report.totalPages}`
9056
9076
  ];
9057
9077
  return {
9058
- title: `\u{1F333} \u4F1A\u8BDD\u6811 \xB7 ${displayTitle}`,
9078
+ title: `\u{1F333} Session Tree \xB7 ${displayTitle}`,
9059
9079
  subtitle: subtitleParts.join(" \xB7 "),
9060
9080
  color: !report.isIdle || report.compactionRunning ? "violet" : "blue",
9061
9081
  columnsPerRow: cols,
9062
9082
  body: bodyLines.join("\n\n"),
9063
9083
  ...items.length > 0 ? { items } : {},
9064
- footer: "\u2605\u5F53\u524D \u25CF\u4E3B\u7EBF \u{1F33F}\u5176\u4ED6\u5206\u652F \xB7 \u56DE\u9000\u4E3A\u65E0\u635F\u5207\u5206\u652F\uFF0C\u65E7\u5206\u652F\u5B8C\u6574\u4FDD\u7559\u53EF\u968F\u65F6\u5207\u56DE\uFF08zero LLM\uFF09\u3002",
9084
+ footer: "\u2605 current \u25CF active path \u{1F33F} other branch \xB7 Rewind is lossless; old branches stay intact to switch back anytime (zero LLM).",
9065
9085
  actions: [
9066
9086
  ...navButtons,
9067
9087
  toggleFilter,
@@ -9076,62 +9096,62 @@ function composeTreeBranchConfirmCard(peer, detail, opts) {
9076
9096
  const fromVal = opts.from ?? (peer.isManager ? "home" : "worker");
9077
9097
  const cancelAction = {
9078
9098
  id: `panel.tree.${peer.instanceId}`,
9079
- label: "\u21A9\uFE0F \u8FD4\u56DE\u4F1A\u8BDD\u6811",
9099
+ label: "\u21A9\uFE0F Tree",
9080
9100
  payload: { page: opts.page, filter: opts.filter, from: fromVal }
9081
9101
  };
9082
9102
  const entry = detail.entry;
9083
9103
  if (!entry) {
9084
9104
  return {
9085
- title: "\u26A0\uFE0F \u8282\u70B9\u4E0D\u5B58\u5728",
9105
+ title: "\u26A0\uFE0F Entry Not Found",
9086
9106
  subtitle: displayTitle,
9087
9107
  color: "grey",
9088
9108
  columnsPerRow: cols,
9089
- body: "\u76EE\u6807\u8282\u70B9\u5728\u5F53\u524D\u4F1A\u8BDD\u4E2D\u5DF2\u4E0D\u5B58\u5728\uFF0C\u8BF7\u5237\u65B0\u4F1A\u8BDD\u6811\u91CD\u8BD5\u3002",
9109
+ body: "The target entry no longer exists in this session. Refresh the session tree and try again.",
9090
9110
  actions: [cancelAction]
9091
9111
  };
9092
9112
  }
9093
9113
  if (entry.isHead) {
9094
9114
  return {
9095
- title: `\u{1F333} \u5DF2\u5728\u76EE\u6807\u8282\u70B9 #${entry.seq}`,
9115
+ title: `\u{1F333} Already at Entry #${entry.seq}`,
9096
9116
  subtitle: displayTitle,
9097
9117
  color: "green",
9098
9118
  columnsPerRow: cols,
9099
- body: "\u5F53\u524D\u4F1A\u8BDD\u6307\u9488\u5DF2\u7ECF\u4F4D\u4E8E\u8BE5\u8282\u70B9\uFF0C\u65E0\u9700\u5207\u6362\u3002",
9119
+ body: "The session pointer is already on this entry \u2014 no switch needed.",
9100
9120
  actions: [cancelAction]
9101
9121
  };
9102
9122
  }
9103
9123
  if (!detail.isIdle || detail.compactionRunning) {
9104
9124
  return {
9105
- title: "\u26A0\uFE0F \u4F1A\u8BDD\u5FD9\u788C\uFF0C\u6682\u4E0D\u53EF\u5207\u6362\u5206\u652F",
9106
- subtitle: `${displayTitle} \xB7 \u76EE\u6807 #${entry.seq}`,
9125
+ title: "\u26A0\uFE0F Session Busy \u2014 Cannot Switch Branch",
9126
+ subtitle: `${displayTitle} \xB7 target #${entry.seq}`,
9107
9127
  color: "red",
9108
9128
  columnsPerRow: cols,
9109
- body: detail.compactionRunning ? "\u5F53\u524D\u6B63\u5728\u6267\u884C\u4E0A\u4E0B\u6587\u538B\u7F29\uFF08Compaction\uFF09\uFF0C\u8BF7\u7B49\u5F85\u538B\u7F29\u5B8C\u6210\u540E\u518D\u5207\u6362\u5206\u652F\u3002" : "\u5F53\u524D\u6709\u6B63\u5728\u8FDB\u884C\u6216\u6392\u961F\u7684\u56DE\u590D\uFF0C\u8BF7\u5148\u505C\u6B62\u5F53\u524D\u8F93\u51FA\u540E\u518D\u6267\u884C\u65E0\u635F\u56DE\u9000\u3002",
9129
+ body: detail.compactionRunning ? "Context compaction is currently running. Wait for it to finish before switching branches." : "A turn is currently running or queued. Stop the current turn before rewinding.",
9110
9130
  actions: [
9111
9131
  ...!detail.compactionRunning ? [{ id: `panel.stop.${peer.instanceId}`, label: "\u23F9 Stop", payload: { from: fromVal, peer: peer.instanceId } }] : [],
9112
9132
  cancelAction
9113
9133
  ]
9114
9134
  };
9115
9135
  }
9116
- const impactLine = entry.onActivePath ? `\u5C06\u628A\u4F1A\u8BDD\u6307\u9488\u56DE\u9000\u5230 **#${entry.seq}**\uFF08\u8DF3\u8FC7\u5F53\u524D\u4E3B\u7EBF\u540E\u7EED **${entry.activePathAfterCount}** \u6761\u8BB0\u5F55\uFF09\u3002` : `\u5C06\u628A\u4F1A\u8BDD\u6307\u9488\u5207\u6362\u5230\u53E6\u4E00\u5206\u652F\u7684 **#${entry.seq}**\u3002`;
9136
+ const impactLine = entry.onActivePath ? `Rewinds the session pointer to **#${entry.seq}** (skipping **${entry.activePathAfterCount}** subsequent entry/entries on the current path).` : `Switches the session pointer to **#${entry.seq}** on another branch.`;
9117
9137
  return {
9118
- title: entry.onActivePath ? `\u23EA \u786E\u8BA4\u56DE\u9000\u5230 #${entry.seq}` : `\u{1F33F} \u786E\u8BA4\u5207\u6362\u5230\u5206\u652F #${entry.seq}`,
9138
+ title: entry.onActivePath ? `\u23EA Confirm Rewind to #${entry.seq}` : `\u{1F33F} Confirm Switch to Branch #${entry.seq}`,
9119
9139
  subtitle: `${displayTitle} \xB7 ${kindBadge(entry.kind)} \xB7 ${formatNodeClock(entry.timestamp)}`,
9120
9140
  color: "red",
9121
9141
  columnsPerRow: cols,
9122
9142
  body: [
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)}`,
9143
+ `- **session**: ${cleanInline4(displayTitle, 48)}`,
9144
+ `- **target**: #${entry.seq} (${kindBadge(entry.kind)} \xB7 ${formatNodeClock(entry.timestamp)})`,
9145
+ `- **preview**: ${cleanInline4(entry.preview || "(empty)", 72)}`,
9126
9146
  "",
9127
9147
  impactLine,
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",
9129
- "\u2139\uFE0F \u4EC5\u5207\u6362 Agent \u7684\u4F1A\u8BDD\u8BB0\u5FC6\u4E0A\u4E0B\u6587\uFF0C\u804A\u5929\u8BB0\u5F55\u4E2D\u5DF2\u53D1\u51FA\u7684\u5386\u53F2\u6D88\u606F\u4E0D\u4F1A\u88AB\u64A4\u56DE\u3002"
9148
+ "\u2705 **Lossless**: the previous branch stays intact in the session tree and can be restored via Tree anytime.",
9149
+ "\u2139\uFE0F Switches only the agent's session context \u2014 previously sent chat messages are not recalled."
9130
9150
  ].join("\n"),
9131
9151
  actions: [
9132
9152
  {
9133
9153
  id: `panel.tree.branch.confirm.${peer.instanceId}`,
9134
- label: "\u2705 \u786E\u8BA4\u5207\u6362",
9154
+ label: "\u2705 Confirm Switch",
9135
9155
  style: "danger",
9136
9156
  payload: {
9137
9157
  treeBranch: { ref: peer.instanceId, session: detail.sessionId, entryId: entry.id },
@@ -9142,7 +9162,7 @@ function composeTreeBranchConfirmCard(peer, detail, opts) {
9142
9162
  },
9143
9163
  {
9144
9164
  id: `panel.tree.${peer.instanceId}`,
9145
- label: "\u21A9\uFE0F \u53D6\u6D88",
9165
+ label: "\u21A9\uFE0F Cancel",
9146
9166
  payload: { page: opts.page, filter: opts.filter, from: fromVal }
9147
9167
  }
9148
9168
  ]
@@ -9157,10 +9177,10 @@ async function runTreePanelCommand(panelCmd, opts) {
9157
9177
  handled: true,
9158
9178
  keyPrefix: "panel-tree-denied",
9159
9179
  spec: {
9160
- title: "\u{1F333} \u4F1A\u8BDD\u6811\u4E0D\u53EF\u7528",
9180
+ title: "\u{1F333} Session Tree Unavailable",
9161
9181
  color: "red",
9162
9182
  columnsPerRow: cols,
9163
- body: "\u26D4\uFE0F \u4F1A\u8BDD\u6811\u5305\u542B\u5BF9\u8BDD\u6458\u8981\uFF0C\u4EC5\u9650\u5DF2\u6388\u6743\u7FA4\u804A\u6216\u79C1\u804A\u8BBF\u95EE\u3002",
9183
+ body: "\u26D4\uFE0F Session tree contains conversation previews and is restricted to authorized chats or DMs.",
9164
9184
  actions: panelHomeAction(opts.hideHome, opts.pinnedWorkerSessionId)
9165
9185
  }
9166
9186
  };
@@ -9181,10 +9201,10 @@ async function runTreePanelCommand(panelCmd, opts) {
9181
9201
  return composeOfflineWorkerCard(opts.pinnedWorkerSessionId, { inThread: opts.inThread, hideHome: true });
9182
9202
  }
9183
9203
  return {
9184
- title: "\u{1F333} \u4F1A\u8BDD\u5DF2\u79BB\u7EBF",
9204
+ title: "\u{1F333} Session Offline",
9185
9205
  color: "grey",
9186
9206
  columnsPerRow: cols,
9187
- body: peerRef2 ? `\u672A\u627E\u5230\u5728\u7EBF\u4F1A\u8BDD \`${cleanCodeSpan(peerRef2, 40)}\`\uFF0C\u53EF\u80FD\u5DF2\u9000\u51FA\u6216\u6B63\u5728\u91CD\u542F\u3002` : "\u672A\u627E\u5230\u5728\u7EBF\u7684 Manager \u4F1A\u8BDD\uFF0C\u8BF7\u5237\u65B0\u603B\u9762\u677F\u540E\u91CD\u8BD5\u3002",
9207
+ body: peerRef2 ? `Online session \`${cleanCodeSpan(peerRef2, 40)}\` was not found (it may have exited or be restarting).` : "No online manager session found. Refresh Home and try again.",
9188
9208
  actions: panelHomeAction(opts.hideHome, opts.pinnedWorkerSessionId)
9189
9209
  };
9190
9210
  };
@@ -9206,11 +9226,11 @@ async function runTreePanelCommand(panelCmd, opts) {
9206
9226
  handled: true,
9207
9227
  keyPrefix: "panel-tree-confirm-stale",
9208
9228
  spec: {
9209
- title: "\u26A0\uFE0F \u786E\u8BA4\u5361\u7247\u5DF2\u5931\u6548",
9229
+ title: "\u26A0\uFE0F Confirmation Expired",
9210
9230
  color: "grey",
9211
9231
  columnsPerRow: cols,
9212
- body: "\u8BE5\u5207\u6362\u786E\u8BA4\u5DF2\u8FC7\u671F\u3001\u88AB\u6D88\u8D39\u6216\u4F1A\u8BDD\u5DF2\u53D8\u66F4\uFF0C\u8BF7\u91CD\u65B0\u6253\u5F00\u4F1A\u8BDD\u6811\u9009\u62E9\u76EE\u6807\u8282\u70B9\u3002",
9213
- actions: livePeer ? [{ id: `panel.tree.${livePeer.instanceId}`, label: "\u{1F333} \u8FD4\u56DE\u4F1A\u8BDD\u6811", payload: { page: meta.page, filter: meta.filter, from: meta.from } }] : panelHomeAction(opts.hideHome, opts.pinnedWorkerSessionId)
9232
+ body: "This branch switch confirmation expired, was already used, or the session changed. Open Session Tree again to pick a target.",
9233
+ actions: livePeer ? [{ id: `panel.tree.${livePeer.instanceId}`, label: "\u{1F333} Back to Tree", payload: { page: meta.page, filter: meta.filter, from: meta.from } }] : panelHomeAction(opts.hideHome, opts.pinnedWorkerSessionId)
9214
9234
  }
9215
9235
  };
9216
9236
  }
@@ -9235,19 +9255,19 @@ async function runTreePanelCommand(panelCmd, opts) {
9235
9255
  keyPrefix: "panel-tree-branch-failed",
9236
9256
  clearIssuedBranch: true,
9237
9257
  spec: {
9238
- title: receipt2.unknown ? "\u26A0\uFE0F \u5206\u652F\u5207\u6362\u72B6\u6001\u672A\u77E5" : "\u26A0\uFE0F \u5206\u652F\u5207\u6362\u5DF2\u62D2\u7EDD",
9258
+ title: receipt2.unknown ? "\u26A0\uFE0F Branch Switch Status Unknown" : "\u26A0\uFE0F Branch Switch Refused",
9239
9259
  color: "red",
9240
9260
  columnsPerRow: cols,
9241
- body: `${formatPeerErrorDetail(receipt2.detail)}${receipt2.unknown ? "\n\n\u8BF7\u5148\u5237\u65B0\u4F1A\u8BDD\u6811\u786E\u8BA4\u5F53\u524D\u6307\u9488\u540E\u518D\u51B3\u5B9A\u662F\u5426\u91CD\u8BD5\u3002" : ""}`,
9261
+ body: `${formatPeerErrorDetail(receipt2.detail)}${receipt2.unknown ? "\n\nRefresh the session tree to check the current pointer before retrying." : ""}`,
9242
9262
  actions: [
9243
- { id: `panel.tree.${peer2.instanceId}`, label: "\u{1F333} \u8FD4\u56DE\u4F1A\u8BDD\u6811", payload: { page: meta.page, filter: meta.filter, from: meta.from } },
9263
+ { id: `panel.tree.${peer2.instanceId}`, label: "\u{1F333} Back to Tree", payload: { page: meta.page, filter: meta.filter, from: meta.from } },
9244
9264
  ...backActionsFor(peer2, { hideHome: opts.hideHome, from: meta.from, pinnedWorkerSessionId: opts.pinnedWorkerSessionId })
9245
9265
  ]
9246
9266
  }
9247
9267
  };
9248
9268
  }
9249
9269
  const switched = parseBranchSuccess(receipt2.detail, verified.sessionId, verified.entryId);
9250
- const banner = switched ? switched.alreadyActive ? `\u2139\uFE0F \u5F53\u524D\u5DF2\u4F4D\u4E8E **#${switched.seq}**\u3002` : `\u2705 \u5DF2\u65E0\u635F\u5207\u6362\u81F3 **#${switched.seq}**\uFF08\u5F53\u524D\u8DEF\u5F84 ${switched.pathLength} \u6761\u8BB0\u5F55\uFF0C\u65E7\u5206\u652F\u5DF2\u4FDD\u7559\uFF09\u3002` : "\u26A0\uFE0F \u76EE\u6807\u4F1A\u8BDD\u8FD4\u56DE\u4E86\u975E\u9884\u671F\u56DE\u6267\uFF0C\u5DF2\u5237\u65B0\u6700\u65B0\u4F1A\u8BDD\u6811\uFF0C\u8BF7\u6838\u5BF9\u5F53\u524D \u2605 \u6307\u9488\u3002";
9270
+ const banner = switched ? switched.alreadyActive ? `\u2139\uFE0F Already at **#${switched.seq}**.` : `\u2705 Losslessly switched to **#${switched.seq}** (${switched.pathLength} entries on active path; previous branch preserved).` : "\u26A0\uFE0F Received an unexpected receipt; refreshed the session tree \u2014 please verify the current \u2605 pointer.";
9251
9271
  const refreshReceipt = await applyPeerControl(
9252
9272
  peer2.instanceId,
9253
9273
  "session.tree",
@@ -9274,12 +9294,12 @@ async function runTreePanelCommand(panelCmd, opts) {
9274
9294
  keyPrefix: "panel-tree-switched",
9275
9295
  clearIssuedBranch: true,
9276
9296
  spec: {
9277
- title: "\u{1F333} \u5206\u652F\u5DF2\u5207\u6362",
9297
+ title: "\u{1F333} Branch Switched",
9278
9298
  color: "green",
9279
9299
  columnsPerRow: cols,
9280
9300
  body: banner,
9281
9301
  actions: [
9282
- { id: `panel.tree.${peer2.instanceId}`, label: "\u{1F333} \u67E5\u770B\u4F1A\u8BDD\u6811", payload: { page: 1, filter: meta.filter, from: meta.from } },
9302
+ { id: `panel.tree.${peer2.instanceId}`, label: "\u{1F333} View Tree", payload: { page: 1, filter: meta.filter, from: meta.from } },
9283
9303
  ...backActionsFor(peer2, { hideHome: opts.hideHome, from: meta.from, pinnedWorkerSessionId: opts.pinnedWorkerSessionId })
9284
9304
  ]
9285
9305
  }
@@ -9304,11 +9324,11 @@ async function runTreePanelCommand(panelCmd, opts) {
9304
9324
  handled: true,
9305
9325
  keyPrefix: "panel-tree-invalid-entry",
9306
9326
  spec: {
9307
- title: "\u26A0\uFE0F \u65E0\u6548\u8282\u70B9",
9327
+ title: "\u26A0\uFE0F Invalid Entry",
9308
9328
  color: "red",
9309
9329
  columnsPerRow: cols,
9310
- body: "\u7F3A\u5C11\u6709\u6548\u7684\u76EE\u6807\u8282\u70B9 ID\uFF0C\u8BF7\u4ECE\u4F1A\u8BDD\u6811\u5217\u8868\u91CD\u65B0\u9009\u62E9\u3002",
9311
- actions: [{ id: `panel.tree.${peer2.instanceId}`, label: "\u21A9\uFE0F \u8FD4\u56DE\u4F1A\u8BDD\u6811", payload: { page: meta.page, filter: meta.filter, from: meta.from } }]
9330
+ body: "Missing valid target entry ID. Please pick an entry from the session tree.",
9331
+ actions: [{ id: `panel.tree.${peer2.instanceId}`, label: "\u21A9\uFE0F Tree", payload: { page: meta.page, filter: meta.filter, from: meta.from } }]
9312
9332
  }
9313
9333
  };
9314
9334
  }
@@ -9324,11 +9344,11 @@ async function runTreePanelCommand(panelCmd, opts) {
9324
9344
  handled: true,
9325
9345
  keyPrefix: "panel-tree-entry-error",
9326
9346
  spec: {
9327
- title: "\u26A0\uFE0F \u65E0\u6CD5\u8BFB\u53D6\u76EE\u6807\u8282\u70B9",
9347
+ title: "\u26A0\uFE0F Cannot Read Target Entry",
9328
9348
  color: "red",
9329
9349
  columnsPerRow: cols,
9330
9350
  body: formatPeerErrorDetail(receipt2.detail),
9331
- actions: [{ id: `panel.tree.${peer2.instanceId}`, label: "\u21A9\uFE0F \u8FD4\u56DE\u4F1A\u8BDD\u6811", payload: { page: meta.page, filter: meta.filter, from: meta.from } }]
9351
+ actions: [{ id: `panel.tree.${peer2.instanceId}`, label: "\u21A9\uFE0F Tree", payload: { page: meta.page, filter: meta.filter, from: meta.from } }]
9332
9352
  }
9333
9353
  };
9334
9354
  }
@@ -9362,12 +9382,12 @@ async function runTreePanelCommand(panelCmd, opts) {
9362
9382
  handled: true,
9363
9383
  keyPrefix: "panel-tree-error",
9364
9384
  spec: {
9365
- title: `\u{1F333} \u4F1A\u8BDD\u6811 \xB7 ${peer.isManager ? "Manager" : workerDisplayTitle(peer)}`,
9385
+ title: `\u{1F333} Session Tree \xB7 ${peer.isManager ? "Manager" : workerDisplayTitle(peer)}`,
9366
9386
  color: "red",
9367
9387
  columnsPerRow: cols,
9368
9388
  body: formatPeerErrorDetail(receipt.detail),
9369
9389
  actions: [
9370
- { id: `panel.tree.${peer.instanceId}`, label: "\u{1F504} \u91CD\u8BD5", payload: { page: meta.page, filter: meta.filter, from: meta.from } },
9390
+ { id: `panel.tree.${peer.instanceId}`, label: "\u{1F504} Retry", payload: { page: meta.page, filter: meta.filter, from: meta.from } },
9371
9391
  ...backActionsFor(peer, { hideHome: opts.hideHome, from: meta.from, pinnedWorkerSessionId: opts.pinnedWorkerSessionId })
9372
9392
  ]
9373
9393
  }
@@ -9403,7 +9423,7 @@ function parsePage2(payload, field = "page") {
9403
9423
  return Math.floor(raw);
9404
9424
  }
9405
9425
  function formatDateTime(ts) {
9406
- if (typeof ts !== "number" || !Number.isFinite(ts) || ts <= 0) return "\u5C1A\u672A\u8FD0\u884C";
9426
+ if (typeof ts !== "number" || !Number.isFinite(ts) || ts <= 0) return "never";
9407
9427
  const d = new Date(ts);
9408
9428
  const mm = String(d.getMonth() + 1).padStart(2, "0");
9409
9429
  const dd = String(d.getDate()).padStart(2, "0");
@@ -9445,7 +9465,7 @@ function enumerateCuratedPages(memoryRoot, wiki) {
9445
9465
  if (userContent !== null) {
9446
9466
  entries.push({
9447
9467
  key: USER_PAGE_KEY,
9448
- label: "\u{1F464} USER.md\uFF08\u7528\u6237\u753B\u50CF\u4E0E\u504F\u597D\uFF09",
9468
+ label: "\u{1F464} USER.md (Profile & Preferences)",
9449
9469
  category: "user",
9450
9470
  tokens: estimateWikiTokens(userContent)
9451
9471
  });
@@ -9464,7 +9484,7 @@ function enumerateCuratedPages(memoryRoot, wiki) {
9464
9484
  const content = wiki.readPage(rel) ?? "";
9465
9485
  entries.push({
9466
9486
  key: `wiki/${rel}`,
9467
- label: `\u{1F4E6} wiki/${rel}\uFF08\u5F52\u6863\uFF09`,
9487
+ label: `\u{1F4E6} wiki/${rel} (archived)`,
9468
9488
  category: "archived",
9469
9489
  tokens: estimateWikiTokens(content)
9470
9490
  });
@@ -9482,22 +9502,22 @@ function readAllowlistedPage(memoryRoot, wiki, pageKey) {
9482
9502
  function summarizeMemoryCron() {
9483
9503
  try {
9484
9504
  const bridge = currentCronPanelBridge();
9485
- if (!bridge) return "\u672A\u63A5\u5165 Cron \u6865\u63A5";
9505
+ if (!bridge) return "Cron bridge unavailable";
9486
9506
  const job = bridge.listJobs().jobs.find((j) => j.isProcess && j.managedBy === "memory");
9487
- if (!job) return "\u672A\u542F\u7528\uFF08\u53EF\u7528 `pie memory schedule on` \u5F00\u542F\uFF09";
9488
- if (job.state === "running") return "\u{1F7E1} \u8FD0\u884C\u4E2D";
9507
+ if (!job) return "Not enabled (run `pie memory schedule on`)";
9508
+ if (job.state === "running") return "\u{1F7E1} Running";
9489
9509
  if (job.state === "blocked") {
9490
- const detail = job.error ? `\uFF08${cleanCodeSpan(job.error, 80)}\uFF09` : "";
9491
- return `\u{1F534} \u5DF2\u963B\u585E${detail}`;
9510
+ const detail = job.error ? ` (${cleanCodeSpan(job.error, 80)})` : "";
9511
+ return `\u{1F534} Blocked${detail}`;
9492
9512
  }
9493
- if (!job.enabled) return "\u23F8 \u5DF2\u6682\u505C";
9513
+ if (!job.enabled) return "\u23F8 Paused";
9494
9514
  const nextText = job.next !== null ? formatDateTime(job.next) : "\u2014";
9495
9515
  if (job.error && job.error.startsWith("degraded")) {
9496
- return `\u{1F7E0} \u9000\u907F\u91CD\u8BD5\u4E2D \xB7 \u4E0B\u6B21 ${nextText}`;
9516
+ return `\u{1F7E0} Retrying \xB7 next ${nextText}`;
9497
9517
  }
9498
- return `\u{1F7E2} \u6B63\u5E38\uFF08\`${cleanCodeSpan(job.schedule.text, 24)}\` \xB7 \u4E0B\u6B21 ${nextText}\uFF09`;
9518
+ return `\u{1F7E2} Active (\`${cleanCodeSpan(job.schedule.text, 24)}\` \xB7 next ${nextText})`;
9499
9519
  } catch {
9500
- return "\u72B6\u6001\u4E0D\u53EF\u8BFB";
9520
+ return "Unavailable";
9501
9521
  }
9502
9522
  }
9503
9523
  function composeMemoryCard(opts) {
@@ -9516,26 +9536,26 @@ function composeMemoryCard(opts) {
9516
9536
  const slice = allEntries.slice((page - 1) * MEMORY_PAGE_SIZE, page * MEMORY_PAGE_SIZE);
9517
9537
  const items = slice.map((entry) => ({
9518
9538
  text: `**${sanitizeLiteralMarkdown(entry.label)}**
9519
- \u7EA6 ${entry.tokens} tokens`,
9539
+ ~${entry.tokens} tokens`,
9520
9540
  actions: [{
9521
9541
  id: "panel.memory.view",
9522
- label: "\u{1F4D6} \u67E5\u770B",
9542
+ label: "\u{1F4D6} View",
9523
9543
  payload: { pageKey: entry.key, returnPage: page }
9524
9544
  }]
9525
9545
  }));
9526
- const missingLine = missingDates.length === 0 ? "\u8FD1 7 \u5929\u5DF2\u5B8C\u6574\u8986\u76D6 \u2705" : `\u8FD1 7 \u5929\u7F3A\u65E5 ${missingDates.length} \u5929\uFF08${missingDates.slice(-4).map((d) => d.slice(5)).join(", ")}${missingDates.length > 4 ? "\u2026" : ""}\uFF09`;
9527
- const lastFailLine = meta.lastDreamError ? `- **\u6700\u8FD1\u5931\u8D25**\uFF1A\`${cleanCodeSpan(meta.lastDreamError, 100)}\`${meta.lastDreamFailedDate ? ` (${meta.lastDreamFailedDate})` : ""}` : void 0;
9546
+ const missingLine = missingDates.length === 0 ? "7-day coverage complete \u2705" : `missing ${missingDates.length} day(s) in last 7d (${missingDates.slice(-4).map((d) => d.slice(5)).join(", ")}${missingDates.length > 4 ? "\u2026" : ""})`;
9547
+ const lastFailLine = meta.lastDreamError ? `- **Last failure**: \`${cleanCodeSpan(meta.lastDreamError, 100)}\`${meta.lastDreamFailedDate ? ` (${meta.lastDreamFailedDate})` : ""}` : void 0;
9528
9548
  const bodyLines = [
9529
9549
  ...opts.banner ? [opts.banner, ""] : [],
9530
- `- **Wiki**\uFF1A${exists ? `\u6D3B\u8DC3 ${activePages.length}/${DEFAULT_WIKI_LIMITS.maxActivePages} \u9875 \xB7 \u5F52\u6863 ${archivedPages.length} \u9875` : "\u5C1A\u672A\u521D\u59CB\u5316\uFF08\u9996\u6B21\u84B8\u998F\u81EA\u52A8\u521B\u5EFA\uFF09"} \xB7 index \u7EA6 ${indexTokens}/${DEFAULT_WIKI_LIMITS.maxIndexTokens} tokens`,
9531
- `- **Dream**\uFF1A\u4E0A\u6B21 ${formatDateTime(meta.lastDreamAt)} \xB7 ${missingLine}`,
9550
+ `- **Wiki**: ${exists ? `${activePages.length}/${DEFAULT_WIKI_LIMITS.maxActivePages} active \xB7 ${archivedPages.length} archived` : "Not initialized yet (created on first distill)"} \xB7 index ~${indexTokens}/${DEFAULT_WIKI_LIMITS.maxIndexTokens} tokens`,
9551
+ `- **Dream**: last ${formatDateTime(meta.lastDreamAt)} \xB7 ${missingLine}`,
9532
9552
  ...lastFailLine ? [lastFailLine] : [],
9533
- `- **GC**\uFF1A\u4E0A\u6B21 ${formatDateTime(meta.lastGcAt)} \xB7 **\u5B9A\u65F6\u4EFB\u52A1**\uFF1A${summarizeMemoryCron()}`,
9534
- ...allEntries.length === 0 ? ["", "_\u5F53\u524D\u6682\u65E0\u53EF\u6D4F\u89C8\u7684\u8BB0\u5FC6\u9875\u9762\u3002_"] : []
9553
+ `- **GC**: last ${formatDateTime(meta.lastGcAt)} \xB7 **Schedule**: ${summarizeMemoryCron()}`,
9554
+ ...allEntries.length === 0 ? ["", "_No memory pages available yet._"] : []
9535
9555
  ];
9536
9556
  const nav = [];
9537
- if (page > 1) nav.push({ id: "panel.memory", label: `\u25C0\uFE0F \u7B2C ${page - 1} \u9875`, payload: { page: page - 1 } });
9538
- if (page < totalPages) nav.push({ id: "panel.memory", label: `\u7B2C ${page + 1} \u9875 \u25B6\uFE0F`, payload: { page: page + 1 } });
9557
+ if (page > 1) nav.push({ id: "panel.memory", label: `\u25C0\uFE0F Page ${page - 1}`, payload: { page: page - 1 } });
9558
+ if (page < totalPages) nav.push({ id: "panel.memory", label: `Page ${page + 1} \u25B6\uFE0F`, payload: { page: page + 1 } });
9539
9559
  const defaultColor = meta.lastDreamError ? "red" : "violet";
9540
9560
  return {
9541
9561
  title: "\u{1F9E0} Memory \xB7 Wiki & Dreaming",
@@ -9544,14 +9564,14 @@ function composeMemoryCard(opts) {
9544
9564
  columnsPerRow: cols,
9545
9565
  body: bodyLines.join("\n"),
9546
9566
  ...items.length > 0 ? { items } : {},
9547
- footer: "\u70B9\u51FB\u884C\u5185\u300C\u{1F4D6} \u67E5\u770B\u300D\u9884\u89C8\u9875\u9762\uFF1B\u300C\u{1F319} \u7ACB\u5373\u84B8\u998F\u300D\u4E0E\u300C\u{1F9F9} \u89E6\u53D1 GC\u300D\u5747\u5728\u540E\u53F0\u72EC\u7ACB\u8FD0\u884C\uFF0C\u4E0D\u5360\u7528\u5F53\u524D\u4F1A\u8BDD\u3002",
9567
+ footer: "Tap \u{1F4D6} View to preview a page. \u{1F319} Dream Now and \u{1F9F9} Run GC run detached in the background.",
9548
9568
  actions: [
9549
9569
  ...nav,
9550
- { id: "panel.memory.dream", label: "\u{1F319} \u7ACB\u5373\u84B8\u998F", style: "primary" },
9551
- { id: "panel.memory.gc", label: "\u{1F9F9} \u89E6\u53D1 GC" },
9552
- { id: "panel.memory.logs", label: "\u{1F4DC} \u84B8\u998F\u65E5\u5FD7" },
9570
+ { id: "panel.memory.dream", label: "\u{1F319} Dream Now", style: "primary" },
9571
+ { id: "panel.memory.gc", label: "\u{1F9F9} Run GC" },
9572
+ { id: "panel.memory.logs", label: "\u{1F4DC} Logs" },
9553
9573
  { id: "panel.memory", label: "\u{1F504} Refresh", payload: { page } },
9554
- { id: "panel.home", label: "\u21A9\uFE0F \u603B\u9762\u677F" }
9574
+ { id: "panel.home", label: "\u21A9\uFE0F Home" }
9555
9575
  ]
9556
9576
  };
9557
9577
  }
@@ -9563,28 +9583,28 @@ function composeMemoryPageCard(opts) {
9563
9583
  const found = readAllowlistedPage(memoryRoot, wiki, opts.pageKey);
9564
9584
  if (!found) {
9565
9585
  return {
9566
- title: "\u26A0\uFE0F \u9875\u9762\u4E0D\u53EF\u7528",
9586
+ title: "\u26A0\uFE0F Page Unavailable",
9567
9587
  color: "grey",
9568
9588
  columnsPerRow: cols,
9569
- body: `\u672A\u627E\u5230\u6216\u65E0\u6743\u8BBF\u95EE\u9875\u9762 \`${cleanCodeSpan(opts.pageKey, 80)}\`\u3002\u8BF7\u8FD4\u56DE Memory \u5217\u8868\u91CD\u65B0\u9009\u62E9\u3002`,
9589
+ body: `Page \`${cleanCodeSpan(opts.pageKey, 80)}\` was not found or is not accessible. Return to Memory to select another page.`,
9570
9590
  actions: [
9571
- { id: "panel.memory", label: "\u21A9\uFE0F \u8FD4\u56DE Memory", payload: { page: returnPage } },
9572
- { id: "panel.home", label: "\u{1F4CB} \u603B\u9762\u677F" }
9591
+ { id: "panel.memory", label: "\u21A9\uFE0F Memory", payload: { page: returnPage } },
9592
+ { id: "panel.home", label: "\u{1F4CB} Home" }
9573
9593
  ]
9574
9594
  };
9575
9595
  }
9576
- const preview = truncateMarkdown(found.content.trim() || "_(\u7A7A\u9875\u9762)_", PAGE_PREVIEW_CHAR_BUDGET);
9596
+ const preview = truncateMarkdown(found.content.trim() || "_(empty page)_", PAGE_PREVIEW_CHAR_BUDGET);
9577
9597
  return {
9578
9598
  title: `\u{1F4D6} ${cleanCodeSpan(found.entry.key, 48)}`,
9579
- subtitle: `\u7EA6 ${found.entry.tokens} tokens \xB7 ${found.content.length} chars \xB7 \u53EA\u8BFB\u9884\u89C8`,
9599
+ subtitle: `~${found.entry.tokens} tokens \xB7 ${found.content.length} chars \xB7 read-only`,
9580
9600
  color: "blue",
9581
9601
  columnsPerRow: cols,
9582
9602
  body: preview,
9583
- footer: "\u5982\u9700\u4FEE\u6539\u6216\u5220\u9664\u8BB0\u5FC6\uFF0C\u76F4\u63A5\u5728\u5BF9\u8BDD\u4E2D\u544A\u8BC9 Manager \u5373\u53EF\u3002",
9603
+ footer: "To edit or delete memories, tell Manager directly in chat.",
9584
9604
  actions: [
9585
9605
  { id: "panel.memory.view", label: "\u{1F504} Refresh", payload: { pageKey: found.entry.key, returnPage } },
9586
- { id: "panel.memory", label: "\u21A9\uFE0F \u8FD4\u56DE Memory", payload: { page: returnPage } },
9587
- { id: "panel.home", label: "\u{1F4CB} \u603B\u9762\u677F" }
9606
+ { id: "panel.memory", label: "\u21A9\uFE0F Memory", payload: { page: returnPage } },
9607
+ { id: "panel.home", label: "\u{1F4CB} Home" }
9588
9608
  ]
9589
9609
  };
9590
9610
  }
@@ -9593,27 +9613,27 @@ function composeMemoryLogsCard(opts) {
9593
9613
  const memoryRoot = resolveMemoryRoot(opts.memoryRoot);
9594
9614
  const workerLines = (opts.hooks?.readWorkerLog ?? readDistillWorkerLog)(memoryRoot, LOG_LINE_LIMIT);
9595
9615
  const gitLines = (opts.hooks?.readGitLog ?? readCuratedMemoryGitLog)(memoryRoot, GIT_LOG_LIMIT);
9596
- const workerSection = workerLines.length > 0 ? `**distill-worker.log\uFF08\u6700\u8FD1 ${workerLines.length} \u884C\uFF09**
9616
+ const workerSection = workerLines.length > 0 ? `**distill-worker.log (last ${workerLines.length} lines)**
9597
9617
  \`\`\`
9598
9618
  ${sanitizeFenceContent(workerLines.join("\n"), 1500)}
9599
- \`\`\`` : "**distill-worker.log**\uFF1A_\u6682\u65E0\u8BB0\u5F55_";
9600
- const gitSection = gitLines.length > 0 ? `**Curated Git \u53D8\u66F4\uFF08\u6700\u8FD1\uFF09**
9619
+ \`\`\`` : "**distill-worker.log**: _no entries yet_";
9620
+ const gitSection = gitLines.length > 0 ? `**Curated Git History (recent)**
9601
9621
  \`\`\`
9602
9622
  ${sanitizeFenceContent(gitLines.join("\n"), 900)}
9603
- \`\`\`` : "**Curated Git \u53D8\u66F4**\uFF1A_\u6682\u65E0\u63D0\u4EA4_";
9623
+ \`\`\`` : "**Curated Git History**: _no commits yet_";
9604
9624
  return {
9605
- title: "\u{1F4DC} Memory \u84B8\u998F\u65E5\u5FD7",
9606
- subtitle: "worker \u65E5\u5FD7 + curated git \u5386\u53F2 \xB7 zero LLM",
9625
+ title: "\u{1F4DC} Memory Distillation Logs",
9626
+ subtitle: "worker log + curated git history \xB7 zero LLM",
9607
9627
  color: "blue",
9608
9628
  columnsPerRow: cols,
9609
9629
  body: `${workerSection}
9610
9630
 
9611
9631
  ${gitSection}`,
9612
9632
  actions: [
9613
- { id: "panel.memory.dream", label: "\u{1F319} \u7ACB\u5373\u84B8\u998F", style: "primary" },
9633
+ { id: "panel.memory.dream", label: "\u{1F319} Dream Now", style: "primary" },
9614
9634
  { id: "panel.memory.logs", label: "\u{1F504} Refresh" },
9615
- { id: "panel.memory", label: "\u21A9\uFE0F \u8FD4\u56DE Memory" },
9616
- { id: "panel.home", label: "\u{1F4CB} \u603B\u9762\u677F" }
9635
+ { id: "panel.memory", label: "\u21A9\uFE0F Memory" },
9636
+ { id: "panel.home", label: "\u{1F4CB} Home" }
9617
9637
  ]
9618
9638
  };
9619
9639
  }
@@ -9636,11 +9656,11 @@ function runMemoryPanelCommand(panelCmd, opts) {
9636
9656
  handled: true,
9637
9657
  keyPrefix: "panel-memory-denied",
9638
9658
  spec: {
9639
- title: "\u{1F9E0} Memory \u4E0D\u53EF\u7528",
9659
+ title: "\u{1F9E0} Memory Unavailable",
9640
9660
  color: "red",
9641
9661
  columnsPerRow: cols,
9642
- body: "\u26D4\uFE0F Memory \u9762\u677F\u4EC5\u9650\u5DF2\u6388\u6743\u7684\u5BF9\u8BDD\u6216\u7BA1\u7406\u5458\u79C1\u804A\u67E5\u770B\u3002",
9643
- actions: [{ id: "panel.home", label: "\u21A9\uFE0F \u603B\u9762\u677F" }]
9662
+ body: "\u26D4\uFE0F The Memory panel is restricted to authorized chats or admin DMs.",
9663
+ actions: [{ id: "panel.home", label: "\u21A9\uFE0F Home" }]
9644
9664
  }
9645
9665
  };
9646
9666
  }
@@ -9672,7 +9692,7 @@ function runMemoryPanelCommand(panelCmd, opts) {
9672
9692
  if (!opts.canMutate) {
9673
9693
  return {
9674
9694
  handled: true,
9675
- refusedText: "\u26D4\uFE0F \u89E6\u53D1 Memory \u84B8\u998F\u6216 GC \u9700\u8981\u7BA1\u7406\u5458\u6743\u9650\uFF08panelAccess=allowUsers\uFF09\u3002"
9695
+ refusedText: "\u26D4\uFE0F Triggering Memory distillation or GC requires admin rights (panelAccess=allowUsers)."
9676
9696
  };
9677
9697
  }
9678
9698
  const probeLockFree = opts.hooks?.probeLockFree ?? defaultProbeLockFree;
@@ -9684,7 +9704,7 @@ function runMemoryPanelCommand(panelCmd, opts) {
9684
9704
  memoryRoot,
9685
9705
  inThread: opts.inThread,
9686
9706
  page,
9687
- banner: "\u23F3 **\u5DF2\u6709 Memory \u540E\u53F0\u4EFB\u52A1\u6B63\u5728\u8FD0\u884C**\uFF08\u6301\u6709 `distill.lock`\uFF09\uFF0C\u8BF7\u7A0D\u5019\u70B9\u300C\u{1F4DC} \u84B8\u998F\u65E5\u5FD7\u300D\u67E5\u770B\u8FDB\u5EA6\u3002",
9707
+ banner: '\u23F3 **A Memory background job is already running** (holding `distill.lock`). Tap "\u{1F4DC} Logs" shortly to check progress.',
9688
9708
  bannerColor: "grey"
9689
9709
  })
9690
9710
  };
@@ -9700,7 +9720,7 @@ function runMemoryPanelCommand(panelCmd, opts) {
9700
9720
  memoryRoot,
9701
9721
  inThread: opts.inThread,
9702
9722
  page,
9703
- banner: ok2 ? "\u{1F319} **\u5DF2\u5728\u540E\u53F0\u542F\u52A8\u8865\u84B8\u998F (`--auto`)**\uFF0C\u5B8C\u6210\u540E\u81EA\u52A8\u66F4\u65B0 Wiki \u4E0E Git\uFF08\u70B9\u300C\u{1F4DC} \u84B8\u998F\u65E5\u5FD7\u300D\u67E5\u770B\u5B9E\u65F6\u8FDB\u5EA6\uFF09\u3002" : "\u274C **\u540E\u53F0\u84B8\u998F\u8FDB\u7A0B\u542F\u52A8\u5931\u8D25**\uFF0C\u8BF7\u70B9\u300C\u{1F4DC} \u84B8\u998F\u65E5\u5FD7\u300D\u6392\u67E5\u539F\u56E0\u3002",
9723
+ banner: ok2 ? '\u{1F319} **Started background distillation (`--auto`)**. Wiki and Git will update automatically when done (tap "\u{1F4DC} Logs" to monitor).' : '\u274C **Failed to start background distillation worker**. Tap "\u{1F4DC} Logs" to inspect.',
9704
9724
  bannerColor: ok2 ? "green" : "red"
9705
9725
  })
9706
9726
  };
@@ -9714,7 +9734,7 @@ function runMemoryPanelCommand(panelCmd, opts) {
9714
9734
  memoryRoot,
9715
9735
  inThread: opts.inThread,
9716
9736
  page,
9717
- banner: ok ? "\u{1F9F9} **\u5DF2\u5728\u540E\u53F0\u542F\u52A8 Wiki GC**\uFF08\u5F52\u6863\u4E0D\u6D3B\u8DC3\u9879\u76EE\u3001\u6E05\u7406\u8FC7\u671F\u951A\u70B9\u3001\u538B\u7F29\u8D85\u9884\u7B97\u9875\u9762\uFF09\uFF0C\u70B9\u300C\u{1F4DC} \u84B8\u998F\u65E5\u5FD7\u300D\u67E5\u770B\u8FDB\u5EA6\u3002" : "\u274C **\u540E\u53F0 Wiki GC \u542F\u52A8\u5931\u8D25**\uFF0C\u8BF7\u70B9\u300C\u{1F4DC} \u84B8\u998F\u65E5\u5FD7\u300D\u6392\u67E5\u539F\u56E0\u3002",
9737
+ banner: ok ? '\u{1F9F9} **Started background Wiki GC** (archives stale projects, prunes expired anchors, compacts over-budget pages). Tap "\u{1F4DC} Logs" to monitor.' : '\u274C **Failed to start background Wiki GC**. Tap "\u{1F4DC} Logs" to inspect.',
9718
9738
  bannerColor: ok ? "green" : "red"
9719
9739
  })
9720
9740
  };
@@ -10172,7 +10192,7 @@ function createPanelExecutor(ctx) {
10172
10192
  return true;
10173
10193
  };
10174
10194
  const payloadFromWorker = isRecord(panelCmd.payload) && panelCmd.payload.from === "worker" && typeof panelCmd.payload.peer === "string" ? panelCmd.payload.peer : void 0;
10175
- const homeOpt = hideHome ? [] : [{ id: "panel.home", label: "\u{1F4CB} \u603B\u9762\u677F" }];
10195
+ const homeOpt = hideHome ? [] : [{ id: "panel.home", label: "\u{1F4CB} Home" }];
10176
10196
  if (event.message_id && (panelCmd.cmd.startsWith("panel.cron.stop.confirm.") || panelCmd.cmd.startsWith("panel.tree.branch.confirm."))) {
10177
10197
  await ctx.cards.enqueueCardPatch(event.message_id, async () => void 0);
10178
10198
  if (!isCurrent()) return;
@@ -10221,7 +10241,7 @@ function createPanelExecutor(ctx) {
10221
10241
  const modelProvider = isRecord(panelCmd.payload) && typeof panelCmd.payload.provider === "string" && panelCmd.payload.provider.trim() ? panelCmd.payload.provider.trim() : void 0;
10222
10242
  const modelPage = isRecord(panelCmd.payload) && typeof panelCmd.payload.page === "number" && Number.isFinite(panelCmd.payload.page) ? Math.floor(panelCmd.payload.page) : void 0;
10223
10243
  const scope = workerScoped || hideHome || payloadFromWorker ? "worker" : "manager";
10224
- const banner = receipt.ok ? `\u2705 \u5DF2\u5207\u6362\u6A21\u578B\u4E3A \`${cleanCodeSpan(model, 56)}\`\uFF08\u4E0B\u6B21\u6267\u884C\u751F\u6548\uFF09` : `\u26A0\uFE0F \u5207\u6362\u6A21\u578B \`${cleanCodeSpan(model, 56)}\` \u5931\u8D25\uFF1A${sanitizeLiteralMarkdown(receipt.detail)}`;
10244
+ const banner = receipt.ok ? `\u2705 Switched model to \`${cleanCodeSpan(model, 56)}\` (applies next turn)` : `\u26A0\uFE0F Failed to switch model \`${cleanCodeSpan(model, 56)}\`: ${sanitizeLiteralMarkdown(receipt.detail)}`;
10225
10245
  const spec = composeUpdatedModelsCard({
10226
10246
  peerRef,
10227
10247
  scope,
@@ -10500,10 +10520,10 @@ function createPanelExecutor(ctx) {
10500
10520
  actions: [
10501
10521
  {
10502
10522
  id: `panel.compact.${contextAction[1]}`,
10503
- label: "\u{1F9F9} \u538B\u7F29",
10523
+ label: "\u{1F9F9} Compact",
10504
10524
  ...workerScoped || payloadFromWorker ? { payload: { from: "worker", peer: workerScoped ? contextAction[1] : payloadFromWorker } } : {}
10505
10525
  },
10506
- ...workerScoped ? [{ id: `panel.worker.${contextAction[1]}`, label: "\u21A9\uFE0F Back to worker" }] : payloadFromWorker ? [{ id: `panel.worker.${payloadFromWorker}`, label: "\u21A9\uFE0F Back to worker" }, ...homeOpt] : hideHome ? panelHomeAction(true, threadWorkerSessionId, contextAction[1]) : [{ id: "panel.context", label: "\u21A9\uFE0F Back to context list" }, { id: "panel.home", label: "\u{1F4CB} \u603B\u9762\u677F" }]
10526
+ ...workerScoped ? [{ id: `panel.worker.${contextAction[1]}`, label: "\u21A9\uFE0F Back to worker" }] : payloadFromWorker ? [{ id: `panel.worker.${payloadFromWorker}`, label: "\u21A9\uFE0F Back to worker" }, ...homeOpt] : hideHome ? panelHomeAction(true, threadWorkerSessionId, contextAction[1]) : [{ id: "panel.context", label: "\u21A9\uFE0F Back to context list" }, { id: "panel.home", label: "\u{1F4CB} Home" }]
10507
10527
  ]
10508
10528
  };
10509
10529
  await deliverPanelSpec(spec, `panel-context-${event.event_id}`, true, navGen);
@@ -10574,11 +10594,11 @@ ${receipt.ok ? "Compaction runs on the target host (LLM summary \u2014 may take
10574
10594
  const action = findAction(actionId);
10575
10595
  if (!action) {
10576
10596
  await deliverPanelSpec({
10577
- title: "\u26A0\uFE0F \u52A8\u4F5C\u5DF2\u79FB\u9664",
10578
- body: `\`${actionId}\` \u4E0D\u5728\u6CE8\u518C\u8868\u91CC\uFF08\u53EF\u80FD\u5DF2\u88AB\u5220\u9664\uFF09\u3002
10597
+ title: "\u26A0\uFE0F Action Removed",
10598
+ body: `\`${actionId}\` is not in the registry (it may have been removed).
10579
10599
 
10580
- \u70B9 /panel \u7684 \u26A1 \u5168\u90E8\u52A8\u4F5C \u67E5\u770B\u5F53\u524D\u53EF\u7528\u7684\u6309\u94AE\u3002`,
10581
- actions: hideHome ? panelHomeAction(true, threadWorkerSessionId) : [{ id: "panel.actions", label: "\u26A1 \u5168\u90E8\u52A8\u4F5C" }, { id: "panel.home", label: "\u21A9\uFE0F \u603B\u9762\u677F" }]
10600
+ Open \u26A1 All Actions from /panel to see currently available actions.`,
10601
+ actions: hideHome ? panelHomeAction(true, threadWorkerSessionId) : [{ id: "panel.actions", label: "\u26A1 All Actions" }, { id: "panel.home", label: "\u21A9\uFE0F Home" }]
10582
10602
  }, `panel-action-gone-${event.event_id}`, true);
10583
10603
  return;
10584
10604
  }
@@ -10604,7 +10624,7 @@ ${receipt.ok ? "Compaction runs on the target host (LLM summary \u2014 may take
10604
10624
  const ambName = cleanCodeSpan(action.scope.startsWith("worker:") ? action.scope.slice("worker:".length) : payloadWorker?.name ?? "", 64);
10605
10625
  await deliverPanelSpec({
10606
10626
  title: `\u26A0\uFE0F ${action.label}`,
10607
- body: `\u540D\u5B57 \`${ambName}\` \u540C\u65F6\u547D\u4E2D\u591A\u4E2A\u5728\u7EBF session\u2014\u2014\u4ECE /panel \u2192 \u{1F4C2} \u70B9\u76EE\u6807 worker \u7684\u5361\u8FDB\u53BB\u518D\u70B9\uFF08\u6309\u94AE\u5E26\u7CBE\u786E\u5730\u5740\uFF09\u3002`,
10627
+ body: `Name \`${ambName}\` matched multiple online sessions \u2014 open the target worker card from /panel and run it there (cards carry an exact address).`,
10608
10628
  actions: panelHomeAction(hideHome, threadWorkerSessionId)
10609
10629
  }, `panel-action-ambiguous-${event.event_id}`, true);
10610
10630
  return;
@@ -10614,13 +10634,13 @@ ${receipt.ok ? "Compaction runs on the target host (LLM summary \u2014 may take
10614
10634
  const generic = action.scope === "worker" && !payloadWorker?.name && !payloadWorker?.ref;
10615
10635
  await deliverPanelSpec({
10616
10636
  title: `\u26A0\uFE0F ${action.label}`,
10617
- body: generic ? "\u8FD9\u662F worker \u901A\u7528\u6309\u94AE\u2014\u2014\u8BF7\u5728\u67D0\u4E2A worker \u7684\u5361\u7247\u4E0A\u70B9\u51FB\uFF08/panel \u2192 \u{1F4C2} \u9009\u62E9 worker\uFF09\uFF0C\u811A\u672C\u9700\u8981\u77E5\u9053\u66FF\u54EA\u4E2A worker \u8DD1\u3002" : `worker \`${cleanCodeSpan(wanted, 64)}\` \u4E0D\u5728\u7EBF\uFF08worker \u6709 TTL \u56DE\u6536\uFF09\u3002\u7B49\u5B83\u5728\u7EBF\u65F6\u518D\u4ECE\u5B83\u7684\u5361\u7247\u89E6\u53D1\u3002`,
10637
+ body: generic ? "This is a generic worker action \u2014 open a specific worker card from /panel to run it with that worker's context." : `Worker \`${cleanCodeSpan(wanted, 64)}\` is offline (workers expire via TTL). Wait until it is online and trigger from its card.`,
10618
10638
  actions: panelHomeAction(hideHome, threadWorkerSessionId)
10619
10639
  }, `panel-action-offline-${event.event_id}`, true);
10620
10640
  return;
10621
10641
  }
10622
10642
  if (workerScoped && pinnedThreadWorkerSession && peer.sessionId !== pinnedThreadWorkerSession) {
10623
- await deliverPanelSpec({ title: "\u26D4\uFE0F \u4EC5\u9650\u5F53\u524D Worker \u9762\u677F", color: "red", body: "Thread \u5185\u7684 Worker \u9762\u677F\u4E0D\u80FD\u5BF9\u5176\u4ED6 Worker \u6267\u884C\u52A8\u4F5C\u3002", actions: panelHomeAction(true, pinnedThreadWorkerSession) }, `panel-action-scope-${event.event_id}`, true);
10643
+ await deliverPanelSpec({ title: "\u26D4\uFE0F Worker Panel Only", color: "red", body: "In-thread worker panels cannot run actions on other workers.", actions: panelHomeAction(true, pinnedThreadWorkerSession) }, `panel-action-scope-${event.event_id}`, true);
10624
10644
  return;
10625
10645
  }
10626
10646
  workerCtx = { name: peer.name, ref: peer.instanceId, ...peer.cwd ? { dir: peer.cwd } : {} };
@@ -10632,7 +10652,7 @@ ${receipt.ok ? "Compaction runs on the target host (LLM summary \u2014 may take
10632
10652
  const since = lock.holder.startedAt > 0 ? new Date(lock.holder.startedAt).toLocaleTimeString("en-GB", { hour12: false }) : "?";
10633
10653
  await deliverPanelSpec({
10634
10654
  title: `\u23F3 ${action.label}`,
10635
- body: lock.holder.note ? `\u26A0\uFE0F ${sanitizeLiteralMarkdown(lock.holder.note)}` : `\u6B63\u5728\u8FD0\u884C\u4E2D\uFF08\u7531 ${sanitizeLiteralMarkdown(lock.holder.triggerName)} \u89E6\u53D1\u4E8E ${since}\uFF09\u3002\u540C\u4E00\u52A8\u4F5C\u540C\u65F6\u53EA\u8DD1\u4E00\u4E2A\u2014\u2014\u7B49\u5B83\u5B8C\u6210\u6216\u8D85\u65F6\u540E\u518D\u70B9\u3002`,
10655
+ body: lock.holder.note ? `\u26A0\uFE0F ${sanitizeLiteralMarkdown(lock.holder.note)}` : `Already running (triggered by ${sanitizeLiteralMarkdown(lock.holder.triggerName)} at ${since}). Only one run of this action can execute at a time \u2014 wait for it to finish or time out.`,
10636
10656
  actions: panelHomeAction(hideHome, threadWorkerSessionId, workerCtx?.ref)
10637
10657
  }, `panel-action-busy-${event.event_id}`, true);
10638
10658
  return;
@@ -10653,7 +10673,7 @@ ${receipt.ok ? "Compaction runs on the target host (LLM summary \u2014 may take
10653
10673
  title: `\u26A0\uFE0F ${action.label}`,
10654
10674
  color: "red",
10655
10675
  body,
10656
- actions: [{ id: `panel.action.${actionId}`, label: "\u{1F501} \u91CD\u8BD5", ...workerCtx ? { payload: { worker: { name: workerCtx.name, ...workerCtx.ref ? { ref: workerCtx.ref } : {} } } } : {} }, ...panelHomeAction(hideHome, threadWorkerSessionId, workerCtx?.ref)]
10676
+ actions: [{ id: `panel.action.${actionId}`, label: "\u{1F501} Retry", ...workerCtx ? { payload: { worker: { name: workerCtx.name, ...workerCtx.ref ? { ref: workerCtx.ref } : {} } } } : {} }, ...panelHomeAction(hideHome, threadWorkerSessionId, workerCtx?.ref)]
10657
10677
  }, `panel-action-cancel-${event.event_id}`);
10658
10678
  if (!runtimeAlive() || !isCurrent()) {
10659
10679
  lock.release();
@@ -10667,9 +10687,9 @@ ${receipt.ok ? "Compaction runs on the target host (LLM summary \u2014 may take
10667
10687
  ackMessageId = await sendActionCard({
10668
10688
  title: `\u{1F680} ${action.label}`,
10669
10689
  color: "blue",
10670
- body: `\u7531 ${sanitizeLiteralMarkdown(triggerQuick)} \u89E6\u53D1 \xB7 \u8FD0\u884C\u4E2D\u2026\uFF08\u8D85\u65F6\u4E0A\u9650 ${timeoutS}s\uFF09
10690
+ body: `Triggered by ${sanitizeLiteralMarkdown(triggerQuick)} \xB7 running\u2026 (timeout ${timeoutS}s)
10671
10691
 
10672
- \u5B8C\u6210\u540E\u672C\u5361\u81EA\u52A8\u66F4\u65B0\u4E3A\u7ED3\u679C\u3002`,
10692
+ This card will update automatically when done.`,
10673
10693
  actions: []
10674
10694
  }, `panel-action-${event.event_id}`, isCurrent);
10675
10695
  return true;
@@ -10678,13 +10698,13 @@ ${receipt.ok ? "Compaction runs on the target host (LLM summary \u2014 may take
10678
10698
  try {
10679
10699
  if (!await initialAck) return;
10680
10700
  if (actionAbort.signal.aborted) {
10681
- if (ackMessageId) await publishCancellation("\u8FD0\u884C\u65F6\u5DF2\u9000\u51FA\uFF0C\u672C\u6B21\u64CD\u4F5C\u672A\u6267\u884C\u3002");
10701
+ if (ackMessageId) await publishCancellation("Runtime exited before execution started; action was not run.");
10682
10702
  else ctx.log(`im-forward: panel action ${actionId} retired with no initial card receipt; script not started`);
10683
10703
  return;
10684
10704
  }
10685
10705
  actionAbort.signal.removeEventListener("abort", lock.release);
10686
10706
  if (!lock.rearm(action.timeoutMs ?? DEFAULT_TIMEOUT_MS)) {
10687
- await publishCancellation("\u6267\u884C\u69FD\u5728\u542F\u52A8\u524D\u6613\u4E3B\uFF0C\u672C\u6B21\u89E6\u53D1\u5DF2\u53D6\u6D88\uFF08\u672A\u6267\u884C\uFF09\u3002\u8BF7\u91CD\u8BD5\u3002");
10707
+ await publishCancellation("Execution slot changed hands before launch; cancelled (not run). Please retry.");
10688
10708
  return;
10689
10709
  }
10690
10710
  ctx.log(`im-forward: panel action ${actionId} triggered by ${triggerQuick} (${triggerOpenId ?? "no-openid"})${workerCtx ? ` as worker ${workerCtx.name}` : ""}`);
@@ -10710,7 +10730,7 @@ ${receipt.ok ? "Compaction runs on the target host (LLM summary \u2014 may take
10710
10730
  ok: false,
10711
10731
  logFile: result2.logFile
10712
10732
  });
10713
- await publishCancellation(ctx.isTerminated() ? "\u8FD0\u884C\u65F6\u5DF2\u9000\u51FA\uFF0C\u672C\u6B21\u64CD\u4F5C\u5DF2\u53D6\u6D88\u3002\u82E5\u811A\u672C\u6B64\u524D\u4EA7\u751F\u4E86\u8F93\u51FA\uFF0C\u8BF7\u5148\u6838\u5BF9\u7ED3\u679C\u518D\u91CD\u8BD5\u3002" : "\u6267\u884C\u69FD\u5728\u811A\u672C\u542F\u52A8\u4E00\u523B\u6613\u4E3B\uFF0C\u672C\u6B21\u89E6\u53D1\u5DF2\u53D6\u6D88\uFF08\u811A\u672C\u5DF2\u5728\u542F\u52A8\u65F6\u7EC8\u6B62\uFF1B\u53EF\u80FD\u5DF2\u6709\u90E8\u5206\u8F93\u51FA\uFF09\u3002\u8BF7\u91CD\u8BD5\u3002");
10733
+ await publishCancellation(ctx.isTerminated() ? "Runtime exited; action cancelled. Check for partial output before retrying." : "Execution slot changed hands at launch; script terminated (partial output may exist). Please retry.");
10714
10734
  return;
10715
10735
  }
10716
10736
  const triggerName = ctx.isTerminated() ? triggerQuick : await resolveUserName(triggerOpenId, {
@@ -10733,16 +10753,16 @@ ${receipt.ok ? "Compaction runs on the target host (LLM summary \u2014 may take
10733
10753
  });
10734
10754
  if (!actionCanDeliver()) return;
10735
10755
  const icon = result2.timedOut ? "\u23F1\uFE0F" : result2.ok ? "\u2705" : "\u274C";
10736
- const statusLine = result2.timedOut ? `\u8D85\u65F6\uFF08>${timeoutS}s\uFF09\uFF0C\u5DF2\u7EC8\u6B62` : result2.ok ? `\u8017\u65F6 ${(result2.durationMs / 1e3).toFixed(1)}s` : `exit ${result2.exitCode ?? "?"} \xB7 \u8017\u65F6 ${(result2.durationMs / 1e3).toFixed(1)}s`;
10756
+ const statusLine = result2.timedOut ? `timed out (>${timeoutS}s), terminated` : result2.ok ? `took ${(result2.durationMs / 1e3).toFixed(1)}s` : `exit ${result2.exitCode ?? "?"} \xB7 took ${(result2.durationMs / 1e3).toFixed(1)}s`;
10737
10757
  const outBody = truncateMarkdown(result2.stdout.trim() || (result2.ok ? "_(no output)_" : ""));
10738
10758
  const logNote = result2.logDegraded ? `
10739
- _(\u65E5\u5FD7\u4E0D\u5B8C\u6574\uFF1A\u8D85\u9650\u6216\u5199\u5165\u5931\u8D25\uFF1B\u5DF2\u6709\u90E8\u5206\u89C1 ${result2.logFile})_` : result2.stdoutTruncated || result2.stderrTruncated ? `
10740
- _(\u8F93\u51FA\u8FC7\u957F\u5DF2\u622A\u65AD;\u5B8C\u6574\u89C1 ${result2.logFile})_` : "";
10759
+ _(log incomplete: over limit or write failed; partial log at ${result2.logFile})_` : result2.stdoutTruncated || result2.stderrTruncated ? `
10760
+ _(output truncated; full log at ${result2.logFile})_` : "";
10741
10761
  const resultSpec = {
10742
10762
  title: `${icon} ${action.label}`,
10743
10763
  color: result2.ok ? "green" : "red",
10744
10764
  body: [
10745
- `\u7531 ${sanitizeLiteralMarkdown(triggerName)} \u89E6\u53D1 \xB7 ${statusLine}${workerCtx ? ` \xB7 as ${sanitizeLiteralMarkdown(workerCtx.name)}` : ""}`,
10765
+ `Triggered by ${sanitizeLiteralMarkdown(triggerName)} \xB7 ${statusLine}${workerCtx ? ` \xB7 as ${sanitizeLiteralMarkdown(workerCtx.name)}` : ""}`,
10746
10766
  ``,
10747
10767
  outBody,
10748
10768
  result2.stderrTail.trim() && !result2.ok ? `
@@ -10752,7 +10772,7 @@ ${result2.stderrTail.trim().slice(0, 1500).replace(/`/g, "'").replace(/</g, "\u2
10752
10772
  \`\`\`` : "",
10753
10773
  logNote
10754
10774
  ].filter((line) => line !== "").join("\n"),
10755
- actions: [{ id: `panel.action.${actionId}`, label: "\u{1F501} \u518D\u8DD1\u4E00\u6B21", ...workerCtx ? { payload: { worker: { name: workerCtx.name, ...workerCtx.ref ? { ref: workerCtx.ref } : {} } } } : {} }, ...panelHomeAction(hideHome, threadWorkerSessionId, workerCtx?.ref)]
10775
+ actions: [{ id: `panel.action.${actionId}`, label: "\u{1F501} Run Again", ...workerCtx ? { payload: { worker: { name: workerCtx.name, ...workerCtx.ref ? { ref: workerCtx.ref } : {} } } } : {} }, ...panelHomeAction(hideHome, threadWorkerSessionId, workerCtx?.ref)]
10756
10776
  };
10757
10777
  await publishTerminal(resultSpec, `panel-action-result-${event.event_id}`);
10758
10778
  } catch (error) {
@@ -10760,7 +10780,7 @@ ${result2.stderrTail.trim().slice(0, 1500).replace(/`/g, "'").replace(/</g, "\u2
10760
10780
  await publishTerminal({
10761
10781
  title: `\u274C ${action.label}`,
10762
10782
  color: "red",
10763
- body: `\u6267\u884C\u5668\u81EA\u8EAB\u51FA\u9519\uFF1A${sanitizeLiteralMarkdown(error instanceof Error ? error.message : String(error))}`,
10783
+ body: `Runner error: ${sanitizeLiteralMarkdown(error instanceof Error ? error.message : String(error))}`,
10764
10784
  actions: panelHomeAction(hideHome, threadWorkerSessionId, workerCtx?.ref)
10765
10785
  }, `panel-action-error-${event.event_id}`);
10766
10786
  } finally {
@@ -11807,9 +11827,9 @@ function initializeImForward(ctx, providers = implementedProviders, runtimeFacto
11807
11827
  ...typeof args.id === "string" && args.id.trim() ? { id: args.id.trim() } : {},
11808
11828
  ...args.creatorName || args.creatorOpenId ? { creator: { ...typeof args.creatorOpenId === "string" ? { openId: args.creatorOpenId } : {}, ...typeof args.creatorName === "string" ? { name: args.creatorName } : {} } } : {}
11809
11829
  });
11810
- return text(`\u2705 \u6309\u94AE\u5DF2\u6CE8\u518C:\u3010${created.label}\u3011id=\`${created.id}\` scope=${created.scope}
11830
+ return text(`\u2705 Registered button: [${created.label}] id=\`${created.id}\` scope=${created.scope}
11811
11831
 
11812
- \u4E0B\u6B21 /panel \u5373\u53EF\u89C1(\u4E3B\u5361\u6309\u4F7F\u7528\u9891\u6B21\u5185\u8054,\u6216 \u26A1 \u5168\u90E8\u52A8\u4F5C \u91CC)\u3002\u70B9\u51FB\u5373\u8DD1\u811A\u672C,\u96F6 LLM\u3002`);
11832
+ Visible on the next /panel (inlined by usage frequency, or under \u26A1 All Actions). Runs script directly with zero LLM.`);
11813
11833
  } catch (error) {
11814
11834
  return text(`add failed: ${error instanceof Error ? error.message : String(error)}`, true);
11815
11835
  }
@@ -11818,7 +11838,7 @@ function initializeImForward(ctx, providers = implementedProviders, runtimeFacto
11818
11838
  const id = typeof args.id === "string" ? args.id.trim() : "";
11819
11839
  if (!id) return text("remove requires id", true);
11820
11840
  const removed = removeAction(id);
11821
- return removed ? text(`\u{1F5D1} \u6309\u94AE\u3010${removed.label}\u3011(${id}) \u5DF2\u4ECE\u6CE8\u518C\u8868\u79FB\u9664(\u811A\u672C\u6587\u4EF6\u4FDD\u7559\u5728\u78C1\u76D8,\u6309\u94AE\u4E0D\u518D\u51FA\u73B0)\u3002`) : text(`action id "${id}" not found`, true);
11841
+ return removed ? text(`\u{1F5D1} Removed button [${removed.label}] (${id}) from the registry (script file stays on disk; button no longer shown).`) : text(`action id "${id}" not found`, true);
11822
11842
  }
11823
11843
  return text(`unknown action "${act}"`, true);
11824
11844
  }