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