pi-landstrip 0.20.27 → 0.20.29
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.
- package/dist/index.ts +552 -49
- package/package.json +3 -3
package/dist/index.ts
CHANGED
|
@@ -254,18 +254,17 @@ import { fileURLToPath } from "node:url";
|
|
|
254
254
|
import { gte, parse, valid } from "semver";
|
|
255
255
|
import {
|
|
256
256
|
getAgentDir as getAgentDir4,
|
|
257
|
-
keyHint,
|
|
258
257
|
SessionManager
|
|
259
258
|
} from "@earendil-works/pi-coding-agent";
|
|
260
259
|
import {
|
|
260
|
+
Box,
|
|
261
261
|
fuzzyFilter as fuzzyFilter2,
|
|
262
262
|
matchesKey,
|
|
263
263
|
Input,
|
|
264
264
|
SettingsList,
|
|
265
265
|
Text,
|
|
266
|
-
truncateToWidth,
|
|
267
|
-
visibleWidth
|
|
268
|
-
wrapTextWithAnsi
|
|
266
|
+
truncateToWidth as truncateToWidth2,
|
|
267
|
+
visibleWidth as visibleWidth2
|
|
269
268
|
} from "@earendil-works/pi-tui";
|
|
270
269
|
import {
|
|
271
270
|
canonicalizeHost as canonicalizeHost2,
|
|
@@ -2613,6 +2612,292 @@ async function collectWorkerResourceReadPaths({
|
|
|
2613
2612
|
return [...paths];
|
|
2614
2613
|
}
|
|
2615
2614
|
|
|
2615
|
+
// markdown-view.ts
|
|
2616
|
+
import { highlightCode, keyHint } from "@earendil-works/pi-coding-agent";
|
|
2617
|
+
import {
|
|
2618
|
+
Markdown,
|
|
2619
|
+
truncateToWidth,
|
|
2620
|
+
visibleWidth,
|
|
2621
|
+
wrapTextWithAnsi
|
|
2622
|
+
} from "@earendil-works/pi-tui";
|
|
2623
|
+
var DEFAULT_FALLBACK_WIDTH = 80;
|
|
2624
|
+
var LOG_TOOL_RESULT_PREVIEW_LINES = 8;
|
|
2625
|
+
var TASK_ENVELOPE_RE = /^(?:([^\n]*)\n\n)?<task id="([^"]*)" state="([^"]*)">\n<(task_result|task_error)>\n([\s\S]*)\n<\/\4>\n<\/task>\s*$/;
|
|
2626
|
+
var STREAM_STATUS_PLACEHOLDER_RE = /^(?:\(no output\)|Queued|Starting subagent|Subagent running|Running [^\n]+|Retry \d+)$/;
|
|
2627
|
+
function normalizeRenderWidth(width, fallback = DEFAULT_FALLBACK_WIDTH) {
|
|
2628
|
+
return typeof width === "number" && Number.isFinite(width) && width > 0 ? Math.floor(width) : fallback;
|
|
2629
|
+
}
|
|
2630
|
+
function clampLineToWidth(line, width) {
|
|
2631
|
+
return visibleWidth(line) <= width ? line : truncateToWidth(line, width);
|
|
2632
|
+
}
|
|
2633
|
+
function formatExpandHint(source) {
|
|
2634
|
+
if (typeof source?.keyHint === "function") {
|
|
2635
|
+
const formatted = source.keyHint("app.tools.expand", "to expand");
|
|
2636
|
+
if (formatted && formatted !== "to expand")
|
|
2637
|
+
return formatted;
|
|
2638
|
+
}
|
|
2639
|
+
try {
|
|
2640
|
+
const fallback = keyHint("app.tools.expand", "to expand");
|
|
2641
|
+
if (fallback && fallback !== "to expand")
|
|
2642
|
+
return fallback;
|
|
2643
|
+
} catch {}
|
|
2644
|
+
return "Ctrl+O to expand";
|
|
2645
|
+
}
|
|
2646
|
+
function isStreamStatusPlaceholder(text) {
|
|
2647
|
+
return STREAM_STATUS_PLACEHOLDER_RE.test(text.trim());
|
|
2648
|
+
}
|
|
2649
|
+
function parseTaskEnvelope(raw) {
|
|
2650
|
+
const match = TASK_ENVELOPE_RE.exec(raw);
|
|
2651
|
+
if (!match)
|
|
2652
|
+
return;
|
|
2653
|
+
const [, preamble, taskId, state, tag, body] = match;
|
|
2654
|
+
return {
|
|
2655
|
+
preamble: preamble || undefined,
|
|
2656
|
+
taskId: taskId || undefined,
|
|
2657
|
+
state: state || undefined,
|
|
2658
|
+
isError: tag === "task_error",
|
|
2659
|
+
isCommand: Boolean(preamble?.startsWith("Background command ")),
|
|
2660
|
+
body: body ?? ""
|
|
2661
|
+
};
|
|
2662
|
+
}
|
|
2663
|
+
function markdownThemeFrom(theme) {
|
|
2664
|
+
const fg = typeof theme?.fg === "function" ? theme.fg.bind(theme) : (_color, text) => text;
|
|
2665
|
+
const bold = typeof theme?.bold === "function" ? theme.bold.bind(theme) : (text) => text;
|
|
2666
|
+
const italic = typeof theme?.italic === "function" ? theme.italic.bind(theme) : (text) => text;
|
|
2667
|
+
const underline = typeof theme?.underline === "function" ? theme.underline.bind(theme) : (text) => text;
|
|
2668
|
+
const strikethrough = typeof theme?.strikethrough === "function" ? theme.strikethrough.bind(theme) : (text) => text;
|
|
2669
|
+
return {
|
|
2670
|
+
heading: (text) => fg("mdHeading", text),
|
|
2671
|
+
link: (text) => fg("mdLink", text),
|
|
2672
|
+
linkUrl: (text) => fg("mdLinkUrl", text),
|
|
2673
|
+
code: (text) => fg("mdCode", text),
|
|
2674
|
+
codeBlock: (text) => fg("mdCodeBlock", text),
|
|
2675
|
+
codeBlockBorder: (text) => fg("mdCodeBlockBorder", text),
|
|
2676
|
+
quote: (text) => fg("mdQuote", text),
|
|
2677
|
+
quoteBorder: (text) => fg("mdQuoteBorder", text),
|
|
2678
|
+
hr: (text) => fg("mdHr", text),
|
|
2679
|
+
listBullet: (text) => fg("mdListBullet", text),
|
|
2680
|
+
bold,
|
|
2681
|
+
italic,
|
|
2682
|
+
underline,
|
|
2683
|
+
strikethrough,
|
|
2684
|
+
highlightCode: (code, lang) => {
|
|
2685
|
+
if (!lang)
|
|
2686
|
+
return code.split(`
|
|
2687
|
+
`).map((line) => fg("mdCodeBlock", line));
|
|
2688
|
+
try {
|
|
2689
|
+
return highlightCode(code, lang);
|
|
2690
|
+
} catch {
|
|
2691
|
+
return code.split(`
|
|
2692
|
+
`).map((line) => fg("mdCodeBlock", line));
|
|
2693
|
+
}
|
|
2694
|
+
}
|
|
2695
|
+
};
|
|
2696
|
+
}
|
|
2697
|
+
function cleanMarkdownOutputLines(rawLines, width) {
|
|
2698
|
+
const cleaned = rawLines.map((line) => clampLineToWidth(line.replace(/ +$/, ""), width));
|
|
2699
|
+
while (cleaned.length > 0 && cleaned[cleaned.length - 1] === "") {
|
|
2700
|
+
cleaned.pop();
|
|
2701
|
+
}
|
|
2702
|
+
return cleaned;
|
|
2703
|
+
}
|
|
2704
|
+
function renderMarkdownLines(markdown, width, theme, colorToken = "toolOutput") {
|
|
2705
|
+
const trimmed = markdown.trimEnd();
|
|
2706
|
+
if (!trimmed)
|
|
2707
|
+
return [];
|
|
2708
|
+
const normalized = normalizeRenderWidth(width);
|
|
2709
|
+
const fg = typeof theme?.fg === "function" ? theme.fg.bind(theme) : (_color, text) => text;
|
|
2710
|
+
const md = new Markdown(trimmed, 0, 0, markdownThemeFrom(theme), {
|
|
2711
|
+
color: (text) => fg(colorToken, text)
|
|
2712
|
+
});
|
|
2713
|
+
return cleanMarkdownOutputLines(md.render(normalized), normalized);
|
|
2714
|
+
}
|
|
2715
|
+
function renderPlainLines(text, width, theme, colorToken = "toolOutput") {
|
|
2716
|
+
const trimmed = text.trimEnd();
|
|
2717
|
+
if (!trimmed)
|
|
2718
|
+
return [];
|
|
2719
|
+
const normalized = normalizeRenderWidth(width);
|
|
2720
|
+
const fg = typeof theme?.fg === "function" ? theme.fg.bind(theme) : (_color, value) => value;
|
|
2721
|
+
const out = [];
|
|
2722
|
+
for (const rawLine of trimmed.split(`
|
|
2723
|
+
`)) {
|
|
2724
|
+
const wrapped = wrapTextWithAnsi(fg(colorToken, rawLine), normalized);
|
|
2725
|
+
if (wrapped.length === 0) {
|
|
2726
|
+
out.push("");
|
|
2727
|
+
continue;
|
|
2728
|
+
}
|
|
2729
|
+
for (const line of wrapped)
|
|
2730
|
+
out.push(clampLineToWidth(line, normalized));
|
|
2731
|
+
}
|
|
2732
|
+
return out;
|
|
2733
|
+
}
|
|
2734
|
+
function extractLogMessageParts(message) {
|
|
2735
|
+
const content = message.content;
|
|
2736
|
+
if (typeof content === "string") {
|
|
2737
|
+
return content ? [{ type: "text", text: content }] : [];
|
|
2738
|
+
}
|
|
2739
|
+
if (!Array.isArray(content))
|
|
2740
|
+
return [];
|
|
2741
|
+
const parts = [];
|
|
2742
|
+
for (const item of content) {
|
|
2743
|
+
if (typeof item !== "object" || item === null)
|
|
2744
|
+
continue;
|
|
2745
|
+
const record = item;
|
|
2746
|
+
if (record.type === "text" && typeof record.text === "string" && record.text) {
|
|
2747
|
+
parts.push({ type: "text", text: record.text });
|
|
2748
|
+
} else if (record.type === "toolCall" && typeof record.name === "string" && record.name) {
|
|
2749
|
+
parts.push({ type: "toolCall", text: record.name });
|
|
2750
|
+
}
|
|
2751
|
+
}
|
|
2752
|
+
return parts;
|
|
2753
|
+
}
|
|
2754
|
+
function renderSubagentSessionLog(entries, width, theme, agentLabel = "assistant") {
|
|
2755
|
+
const normalized = normalizeRenderWidth(width);
|
|
2756
|
+
const fg = typeof theme?.fg === "function" ? theme.fg.bind(theme) : (_color, value) => value;
|
|
2757
|
+
const bold = typeof theme?.bold === "function" ? theme.bold.bind(theme) : (value) => value;
|
|
2758
|
+
const bodyWidth = Math.max(1, normalized - 2);
|
|
2759
|
+
const indent = normalized > 4 ? " " : "";
|
|
2760
|
+
const indentWidth = indent.length;
|
|
2761
|
+
const innerWidth = Math.max(1, normalized - indentWidth);
|
|
2762
|
+
const lines = [];
|
|
2763
|
+
for (const entry of entries) {
|
|
2764
|
+
if (entry.parts.length === 0)
|
|
2765
|
+
continue;
|
|
2766
|
+
if (lines.length > 0)
|
|
2767
|
+
lines.push("");
|
|
2768
|
+
if (entry.role === "toolResult") {
|
|
2769
|
+
const label = entry.toolName ? `tool:${entry.toolName}` : "tool";
|
|
2770
|
+
lines.push(clampLineToWidth(fg("dim", label), normalized));
|
|
2771
|
+
const rawText = entry.parts.filter((part) => part.type === "text").map((part) => part.text).join(`
|
|
2772
|
+
`).trimEnd();
|
|
2773
|
+
if (!rawText)
|
|
2774
|
+
continue;
|
|
2775
|
+
const wrapped = renderPlainLines(rawText, innerWidth, theme, "dim");
|
|
2776
|
+
const shown = wrapped.slice(0, LOG_TOOL_RESULT_PREVIEW_LINES);
|
|
2777
|
+
for (const line of shown) {
|
|
2778
|
+
lines.push(clampLineToWidth(`${indent}${line}`, normalized));
|
|
2779
|
+
}
|
|
2780
|
+
const hidden = wrapped.length - shown.length;
|
|
2781
|
+
if (hidden > 0) {
|
|
2782
|
+
lines.push(clampLineToWidth(`${indent}${fg("muted", `… +${hidden} line${hidden === 1 ? "" : "s"}`)}`, normalized));
|
|
2783
|
+
}
|
|
2784
|
+
continue;
|
|
2785
|
+
}
|
|
2786
|
+
const header = entry.role === "user" ? fg("accent", bold("user")) : entry.role === "assistant" ? fg("success", bold(agentLabel)) : fg("muted", bold(entry.role));
|
|
2787
|
+
lines.push(clampLineToWidth(header, normalized));
|
|
2788
|
+
const colorToken = entry.role === "user" ? "text" : "toolOutput";
|
|
2789
|
+
for (const part of entry.parts) {
|
|
2790
|
+
if (part.type === "toolCall") {
|
|
2791
|
+
lines.push(clampLineToWidth(`${indent}${fg("muted", `→ ${part.text}`)}`, normalized));
|
|
2792
|
+
continue;
|
|
2793
|
+
}
|
|
2794
|
+
const mdLines = renderMarkdownLines(part.text, indentWidth > 0 ? innerWidth : bodyWidth, theme, colorToken);
|
|
2795
|
+
for (const mdLine of mdLines) {
|
|
2796
|
+
lines.push(mdLine ? clampLineToWidth(`${indent}${mdLine}`, normalized) : "");
|
|
2797
|
+
}
|
|
2798
|
+
}
|
|
2799
|
+
}
|
|
2800
|
+
return lines;
|
|
2801
|
+
}
|
|
2802
|
+
|
|
2803
|
+
class SubagentReportComponent {
|
|
2804
|
+
options;
|
|
2805
|
+
md;
|
|
2806
|
+
mdThemeRef;
|
|
2807
|
+
mdBody = "";
|
|
2808
|
+
cachedWidth;
|
|
2809
|
+
cachedLines;
|
|
2810
|
+
constructor(options) {
|
|
2811
|
+
this.options = options;
|
|
2812
|
+
}
|
|
2813
|
+
update(options) {
|
|
2814
|
+
this.options = options;
|
|
2815
|
+
this.cachedWidth = undefined;
|
|
2816
|
+
this.cachedLines = undefined;
|
|
2817
|
+
}
|
|
2818
|
+
invalidate() {
|
|
2819
|
+
this.cachedWidth = undefined;
|
|
2820
|
+
this.cachedLines = undefined;
|
|
2821
|
+
this.md?.invalidate();
|
|
2822
|
+
}
|
|
2823
|
+
renderMarkdownBody(text, width) {
|
|
2824
|
+
const fg = typeof this.options.theme?.fg === "function" ? this.options.theme.fg.bind(this.options.theme) : (_color, value) => value;
|
|
2825
|
+
if (!this.md || this.mdThemeRef !== this.options.theme) {
|
|
2826
|
+
this.md = new Markdown(text, 0, 0, markdownThemeFrom(this.options.theme), {
|
|
2827
|
+
color: (value) => fg("toolOutput", value)
|
|
2828
|
+
});
|
|
2829
|
+
this.mdThemeRef = this.options.theme;
|
|
2830
|
+
this.mdBody = text;
|
|
2831
|
+
} else if (this.mdBody !== text) {
|
|
2832
|
+
this.md.setText(text);
|
|
2833
|
+
this.mdBody = text;
|
|
2834
|
+
}
|
|
2835
|
+
return cleanMarkdownOutputLines(this.md.render(width), width);
|
|
2836
|
+
}
|
|
2837
|
+
render(width) {
|
|
2838
|
+
const normalized = normalizeRenderWidth(width, this.options.fallbackWidth);
|
|
2839
|
+
if (this.cachedLines && this.cachedWidth === normalized) {
|
|
2840
|
+
return this.cachedLines;
|
|
2841
|
+
}
|
|
2842
|
+
const fg = typeof this.options.theme?.fg === "function" ? this.options.theme.fg.bind(this.options.theme) : (_color, value) => value;
|
|
2843
|
+
const out = [];
|
|
2844
|
+
for (const header of this.options.headerLines ?? []) {
|
|
2845
|
+
for (const rawLine of header.split(`
|
|
2846
|
+
`)) {
|
|
2847
|
+
for (const wrapped of wrapTextWithAnsi(rawLine, normalized)) {
|
|
2848
|
+
out.push(clampLineToWidth(wrapped, normalized));
|
|
2849
|
+
}
|
|
2850
|
+
}
|
|
2851
|
+
}
|
|
2852
|
+
const trimmedBody = (this.options.body ?? "").trimEnd();
|
|
2853
|
+
if (trimmedBody) {
|
|
2854
|
+
const bodyKind = this.options.bodyKind ?? "markdown";
|
|
2855
|
+
const renderedBody = bodyKind === "markdown" ? this.renderMarkdownBody(trimmedBody, normalized) : renderPlainLines(trimmedBody, normalized, this.options.theme, bodyKind === "error" ? "error" : "toolOutput");
|
|
2856
|
+
if (renderedBody.length > 0) {
|
|
2857
|
+
if (this.options.expanded) {
|
|
2858
|
+
if (out.length > 0 && bodyKind === "markdown" && renderedBody.length > 1) {
|
|
2859
|
+
out.push("");
|
|
2860
|
+
}
|
|
2861
|
+
out.push(...renderedBody);
|
|
2862
|
+
if ((this.options.footerLines?.length ?? 0) > 0 && bodyKind === "markdown" && renderedBody.length > 1) {
|
|
2863
|
+
out.push("");
|
|
2864
|
+
}
|
|
2865
|
+
} else {
|
|
2866
|
+
const previewLimit = Math.max(1, this.options.previewLines ?? 3);
|
|
2867
|
+
const shown = renderedBody.slice(0, previewLimit);
|
|
2868
|
+
const hidden = renderedBody.length > shown.length;
|
|
2869
|
+
if (hidden) {
|
|
2870
|
+
while (shown.length > 1 && shown[shown.length - 1] === "") {
|
|
2871
|
+
shown.pop();
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2874
|
+
out.push(...shown);
|
|
2875
|
+
if (hidden) {
|
|
2876
|
+
const hint = this.options.expandHint || formatExpandHint();
|
|
2877
|
+
out.push(clampLineToWidth(fg("muted", `… ${hint}`), normalized));
|
|
2878
|
+
}
|
|
2879
|
+
}
|
|
2880
|
+
}
|
|
2881
|
+
}
|
|
2882
|
+
for (const footer of this.options.footerLines ?? []) {
|
|
2883
|
+
for (const rawLine of footer.split(`
|
|
2884
|
+
`)) {
|
|
2885
|
+
out.push(clampLineToWidth(rawLine, normalized));
|
|
2886
|
+
}
|
|
2887
|
+
}
|
|
2888
|
+
this.cachedWidth = normalized;
|
|
2889
|
+
this.cachedLines = out;
|
|
2890
|
+
return out;
|
|
2891
|
+
}
|
|
2892
|
+
}
|
|
2893
|
+
function upsertSubagentReportComponent(lastComponent, options) {
|
|
2894
|
+
if (lastComponent instanceof SubagentReportComponent) {
|
|
2895
|
+
lastComponent.update(options);
|
|
2896
|
+
return lastComponent;
|
|
2897
|
+
}
|
|
2898
|
+
return new SubagentReportComponent(options);
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2616
2901
|
// subagents.ts
|
|
2617
2902
|
var TASK_ENTRY = "landstrip.task";
|
|
2618
2903
|
var TASK_WIDGET = "landstrip.subagents";
|
|
@@ -2642,15 +2927,15 @@ function dialogKeys(theme, hints) {
|
|
|
2642
2927
|
}
|
|
2643
2928
|
function paneTop(theme, width, title) {
|
|
2644
2929
|
if (width < 3)
|
|
2645
|
-
return
|
|
2930
|
+
return truncateToWidth2(theme.fg("accent", title), Math.max(1, width));
|
|
2646
2931
|
const label = theme.fg("accent", theme.bold(` ${title} `));
|
|
2647
|
-
return `${label}${theme.fg("border", "─".repeat(Math.max(0, width -
|
|
2932
|
+
return `${label}${theme.fg("border", "─".repeat(Math.max(0, width - visibleWidth2(label))))}`;
|
|
2648
2933
|
}
|
|
2649
2934
|
function paneRow(_theme, width, content = "") {
|
|
2650
2935
|
if (width < 2)
|
|
2651
2936
|
return " ".repeat(Math.max(0, width));
|
|
2652
|
-
const line =
|
|
2653
|
-
return ` ${line}${" ".repeat(Math.max(0, width -
|
|
2937
|
+
const line = truncateToWidth2(content, Math.max(1, width - 2));
|
|
2938
|
+
return ` ${line}${" ".repeat(Math.max(0, width - visibleWidth2(line) - 1))}`;
|
|
2654
2939
|
}
|
|
2655
2940
|
var PI_THINKING_LEVELS = new Set(["off", "minimal", "low", "medium", "high", "xhigh", "max"]);
|
|
2656
2941
|
var FALLBACK_THINKING_LEVEL = "medium";
|
|
@@ -3148,6 +3433,76 @@ function taskTranscript(task) {
|
|
|
3148
3433
|
return [`Could not read child session: ${formatError(error)}`];
|
|
3149
3434
|
}
|
|
3150
3435
|
}
|
|
3436
|
+
function taskLogCacheKey(task, contentWidth) {
|
|
3437
|
+
let fileStamp = 0;
|
|
3438
|
+
const filePath = task.kind === "command" ? task.outputFile : task.sessionFile;
|
|
3439
|
+
if (filePath) {
|
|
3440
|
+
try {
|
|
3441
|
+
const st = lstatSync(filePath);
|
|
3442
|
+
fileStamp = st.mtimeMs * 1e6 + st.size;
|
|
3443
|
+
} catch {}
|
|
3444
|
+
}
|
|
3445
|
+
return [
|
|
3446
|
+
task.id,
|
|
3447
|
+
contentWidth,
|
|
3448
|
+
task.state,
|
|
3449
|
+
task.toolCalls ?? 0,
|
|
3450
|
+
task.finishedAt ?? 0,
|
|
3451
|
+
fileStamp,
|
|
3452
|
+
(task.output ?? "").length,
|
|
3453
|
+
(task.error ?? "").length
|
|
3454
|
+
].join(":");
|
|
3455
|
+
}
|
|
3456
|
+
function renderFormattedTaskLog(task, contentWidth, theme) {
|
|
3457
|
+
if (task.kind === "command") {
|
|
3458
|
+
if (task.outputFile) {
|
|
3459
|
+
try {
|
|
3460
|
+
const content = readFileSync6(task.outputFile, "utf8");
|
|
3461
|
+
if (content.trim() !== "") {
|
|
3462
|
+
return renderPlainLines(content, contentWidth, theme, "toolOutput");
|
|
3463
|
+
}
|
|
3464
|
+
return [theme.fg("muted", "Command running... (no output yet)")];
|
|
3465
|
+
} catch {}
|
|
3466
|
+
}
|
|
3467
|
+
if (task.error)
|
|
3468
|
+
return renderPlainLines(task.error, contentWidth, theme, "error");
|
|
3469
|
+
if (task.output)
|
|
3470
|
+
return renderPlainLines(task.output, contentWidth, theme, "toolOutput");
|
|
3471
|
+
return [theme.fg("muted", "Command output is not available yet.")];
|
|
3472
|
+
}
|
|
3473
|
+
if (!task.sessionFile || !existsSync5(task.sessionFile)) {
|
|
3474
|
+
if (task.error)
|
|
3475
|
+
return renderPlainLines(task.error, contentWidth, theme, "error");
|
|
3476
|
+
if (task.output)
|
|
3477
|
+
return renderMarkdownLines(task.output, contentWidth, theme, "toolOutput");
|
|
3478
|
+
return [theme.fg("muted", "Child session is not available yet.")];
|
|
3479
|
+
}
|
|
3480
|
+
try {
|
|
3481
|
+
const session = SessionManager.open(task.sessionFile, task.sessionDir);
|
|
3482
|
+
const entries = [];
|
|
3483
|
+
for (const entry of session.buildContextEntries()) {
|
|
3484
|
+
if (entry.type !== "message")
|
|
3485
|
+
continue;
|
|
3486
|
+
const message = entry.message;
|
|
3487
|
+
if (!isRecord2(message) || typeof message.role !== "string")
|
|
3488
|
+
continue;
|
|
3489
|
+
const parts = extractLogMessageParts(message);
|
|
3490
|
+
if (parts.length === 0)
|
|
3491
|
+
continue;
|
|
3492
|
+
entries.push({
|
|
3493
|
+
role: message.role,
|
|
3494
|
+
toolName: typeof message.toolName === "string" ? message.toolName : undefined,
|
|
3495
|
+
parts
|
|
3496
|
+
});
|
|
3497
|
+
}
|
|
3498
|
+
if (entries.length === 0) {
|
|
3499
|
+
return [theme.fg("muted", "Child session has no messages yet.")];
|
|
3500
|
+
}
|
|
3501
|
+
return renderSubagentSessionLog(entries, contentWidth, theme, `@${task.agent}`);
|
|
3502
|
+
} catch (error) {
|
|
3503
|
+
return renderPlainLines(`Could not read child session: ${formatError(error)}`, contentWidth, theme, "error");
|
|
3504
|
+
}
|
|
3505
|
+
}
|
|
3151
3506
|
function endpointHost(baseUrl) {
|
|
3152
3507
|
if (!baseUrl)
|
|
3153
3508
|
return;
|
|
@@ -3712,6 +4067,7 @@ class SubagentRuntime {
|
|
|
3712
4067
|
this.pi.registerTool(this.createTaskTool());
|
|
3713
4068
|
this.pi.registerTool(this.createTasksTool());
|
|
3714
4069
|
registerLandstripCommands(this.pi, this, this.integration);
|
|
4070
|
+
this.pi.registerMessageRenderer?.("landstrip.task.result", (message, options, theme) => this.renderTaskResultMessage(message, options, theme));
|
|
3715
4071
|
this.pi.registerShortcut("ctrl+shift+a", {
|
|
3716
4072
|
description: "Cycle to the next primary agent",
|
|
3717
4073
|
handler: async (ctx) => this.cyclePrimaryAgent(ctx)
|
|
@@ -4075,7 +4431,7 @@ ${this.primaryAgent.prompt}` };
|
|
|
4075
4431
|
const listedAgents = agentsForTab();
|
|
4076
4432
|
const agentRows = listRowBudget(tui.terminal?.rows, AGENT_LIST_ROWS, AGENT_TAB_CHROME_ROWS);
|
|
4077
4433
|
const { shown, start, status } = listWindow(listedAgents, selectedAgent, agentRows);
|
|
4078
|
-
const nameWidth = Math.min(20, Math.max(5, ...listedAgents.map((agent) =>
|
|
4434
|
+
const nameWidth = Math.min(20, Math.max(5, ...listedAgents.map((agent) => visibleWidth2(`@${agent.name}`))));
|
|
4079
4435
|
const modelWidth = Math.max(10, Math.min(24, Math.floor((contentWidth - 2) / 3)));
|
|
4080
4436
|
const enabledWidth = 13;
|
|
4081
4437
|
const runtimeWidth = Math.max(12, contentWidth - 2 - nameWidth - 1 - modelWidth - 1 - enabledWidth - 1);
|
|
@@ -4316,6 +4672,7 @@ ${this.primaryAgent.prompt}` };
|
|
|
4316
4672
|
};
|
|
4317
4673
|
const item = (label, value) => ` ${theme.fg("dim", label.padEnd(20))} ${value}`;
|
|
4318
4674
|
const shellReadLabel = (current) => current.windowsMode !== undefined ? "Policy (required)" : current.shellReadMode === "host" ? "Host-aligned" : "Policy";
|
|
4675
|
+
let cachedTaskLog;
|
|
4319
4676
|
const renderTab = {
|
|
4320
4677
|
overview: (frame) => renderSandboxTab(frame, () => {
|
|
4321
4678
|
if (!overview)
|
|
@@ -4339,10 +4696,10 @@ ${this.primaryAgent.prompt}` };
|
|
|
4339
4696
|
"",
|
|
4340
4697
|
theme.fg("accent", "Configuration"),
|
|
4341
4698
|
item("Change scope", overview.changeScope === "project" ? "Project" : "Global"),
|
|
4342
|
-
item("Change file",
|
|
4343
|
-
item("Project file",
|
|
4344
|
-
item("Global file",
|
|
4345
|
-
item("Landstrip binary",
|
|
4699
|
+
item("Change file", truncateToWidth2(changePath, valueWidth)),
|
|
4700
|
+
item("Project file", truncateToWidth2(overview.paths.project, valueWidth)),
|
|
4701
|
+
item("Global file", truncateToWidth2(overview.paths.global, valueWidth)),
|
|
4702
|
+
item("Landstrip binary", truncateToWidth2(overview.paths.binary, valueWidth))
|
|
4346
4703
|
];
|
|
4347
4704
|
if (overview.windowsMode !== undefined)
|
|
4348
4705
|
body.push(item("Windows mode", overview.windowsMode));
|
|
@@ -4438,7 +4795,14 @@ ${this.primaryAgent.prompt}` };
|
|
|
4438
4795
|
const task = tasks[selectedTask];
|
|
4439
4796
|
if (!task)
|
|
4440
4797
|
return pane([tabs, "", "No task sessions in this session."]);
|
|
4441
|
-
const
|
|
4798
|
+
const logKey = taskLogCacheKey(task, contentWidth);
|
|
4799
|
+
if (!cachedTaskLog || cachedTaskLog.key !== logKey) {
|
|
4800
|
+
cachedTaskLog = {
|
|
4801
|
+
key: logKey,
|
|
4802
|
+
lines: renderFormattedTaskLog(task, contentWidth, theme)
|
|
4803
|
+
};
|
|
4804
|
+
}
|
|
4805
|
+
const transcript = cachedTaskLog.lines;
|
|
4442
4806
|
const usage = formatTaskUsage(task.usage);
|
|
4443
4807
|
const baseChrome = 7 + (usage ? 1 : 0);
|
|
4444
4808
|
const rawBodyLines = paneHeight === undefined ? INSPECTOR_BODY_LINES : Math.max(1, paneHeight - baseChrome);
|
|
@@ -4463,7 +4827,7 @@ ${this.primaryAgent.prompt}` };
|
|
|
4463
4827
|
`${taskState(theme, task)} ${theme.fg("dim", metrics.join(" · "))} ${theme.fg("dim", "·")} ${theme.fg(follow ? "accent" : "muted", `Follow: ${follow ? "on" : "off"}`)}`,
|
|
4464
4828
|
...usage ? [theme.fg("dim", usage)] : [],
|
|
4465
4829
|
"",
|
|
4466
|
-
...shown
|
|
4830
|
+
...shown
|
|
4467
4831
|
];
|
|
4468
4832
|
const headerAndBodyTarget = (usage ? 6 : 5) + bodyLines;
|
|
4469
4833
|
while (lines.length < headerAndBodyTarget)
|
|
@@ -4472,7 +4836,7 @@ ${this.primaryAgent.prompt}` };
|
|
|
4472
4836
|
lines.push(theme.fg("dim", `${scroll + 1}–${scroll + shown.length} of ${transcript.length}`));
|
|
4473
4837
|
}
|
|
4474
4838
|
if (steering) {
|
|
4475
|
-
const input = steering.render(Math.max(2, contentWidth -
|
|
4839
|
+
const input = steering.render(Math.max(2, contentWidth - visibleWidth2("Steer ")))[0] ?? "";
|
|
4476
4840
|
lines.push(`${theme.fg("accent", "Steer")} ${input.replace(/^>/, "›")}`);
|
|
4477
4841
|
} else {
|
|
4478
4842
|
const keys = [["↑ / ↓", "scroll"]];
|
|
@@ -4485,18 +4849,18 @@ ${this.primaryAgent.prompt}` };
|
|
|
4485
4849
|
keys.push(["F", "follow"], ["Esc", "tasks"]);
|
|
4486
4850
|
lines.push(dialogKeys(theme, keys));
|
|
4487
4851
|
}
|
|
4488
|
-
return pane(lines.map((line) =>
|
|
4852
|
+
return pane(lines.map((line) => truncateToWidth2(line, contentWidth)));
|
|
4489
4853
|
},
|
|
4490
4854
|
help: (frame) => {
|
|
4491
4855
|
const { tabs, pane, contentWidth, pad } = frame;
|
|
4492
4856
|
const helpRows = viewScope === "sandbox" ? SANDBOX_HELP_ROWS : AGENTS_HELP_ROWS;
|
|
4493
|
-
const shortcutWidth = Math.max(
|
|
4857
|
+
const shortcutWidth = Math.max(visibleWidth2("Shortcut"), ...helpRows.map(([shortcut]) => visibleWidth2(shortcut)));
|
|
4494
4858
|
const descriptionWidth = Math.max(1, contentWidth - shortcutWidth - 4);
|
|
4495
4859
|
const lines = [
|
|
4496
4860
|
tabs,
|
|
4497
4861
|
"",
|
|
4498
4862
|
theme.fg("dim", ` ${pad("Shortcut", shortcutWidth)} Description`),
|
|
4499
|
-
...helpRows.map(([shortcut, description]) => ` ${theme.fg("accent", pad(shortcut, shortcutWidth))} ${theme.fg("text",
|
|
4863
|
+
...helpRows.map(([shortcut, description]) => ` ${theme.fg("accent", pad(shortcut, shortcutWidth))} ${theme.fg("text", truncateToWidth2(description, descriptionWidth))}`)
|
|
4500
4864
|
];
|
|
4501
4865
|
return pane(lines);
|
|
4502
4866
|
}
|
|
@@ -4770,12 +5134,12 @@ ${this.primaryAgent.prompt}` };
|
|
|
4770
5134
|
return rows.slice(0, paneHeight);
|
|
4771
5135
|
};
|
|
4772
5136
|
const pad = (value, cellWidth) => {
|
|
4773
|
-
const clipped =
|
|
4774
|
-
return `${clipped}${" ".repeat(Math.max(0, cellWidth -
|
|
5137
|
+
const clipped = truncateToWidth2(value, cellWidth);
|
|
5138
|
+
return `${clipped}${" ".repeat(Math.max(0, cellWidth - visibleWidth2(clipped)))}`;
|
|
4775
5139
|
};
|
|
4776
5140
|
const listValue = (values) => {
|
|
4777
5141
|
const value = values.join(", ") || "none";
|
|
4778
|
-
return
|
|
5142
|
+
return truncateToWidth2(value, Math.max(10, contentWidth - 23));
|
|
4779
5143
|
};
|
|
4780
5144
|
refreshTasks();
|
|
4781
5145
|
const tabs = dialogTabs(theme, TAB_ORDER.map((key) => TAB_LABELS[key]), TAB_LABELS[tab]);
|
|
@@ -5026,6 +5390,74 @@ ${outputText}` }
|
|
|
5026
5390
|
};
|
|
5027
5391
|
}
|
|
5028
5392
|
throw new Error(`Unknown action: ${action}`);
|
|
5393
|
+
},
|
|
5394
|
+
renderResult: (result, options, theme, context) => {
|
|
5395
|
+
const expanded = context?.expanded ?? options?.expanded ?? false;
|
|
5396
|
+
const text = result.content.find((item) => item.type === "text")?.text ?? "";
|
|
5397
|
+
const details = result.details;
|
|
5398
|
+
if (details && "state" in details && "taskId" in details) {
|
|
5399
|
+
const marker = `
|
|
5400
|
+
|
|
5401
|
+
Recent Output:
|
|
5402
|
+
`;
|
|
5403
|
+
const markerIndex = text.indexOf(marker);
|
|
5404
|
+
const stateView = {
|
|
5405
|
+
id: details.taskId,
|
|
5406
|
+
agent: details.agent,
|
|
5407
|
+
description: details.description ?? "",
|
|
5408
|
+
state: details.state
|
|
5409
|
+
};
|
|
5410
|
+
const modeBadge = theme.fg(details.background ? "accent" : "muted", details.background ? "[bg]" : "[fg]");
|
|
5411
|
+
const tag = details.kind === "command" ? "$ bash" : `@${details.agent}`;
|
|
5412
|
+
const desc = details.description ? `${theme.fg("muted", " — ")}${theme.fg("text", details.description)}` : "";
|
|
5413
|
+
const headerLines = [
|
|
5414
|
+
`${taskState(theme, stateView)} ${modeBadge} ${theme.fg("accent", theme.bold(tag))}${desc}`
|
|
5415
|
+
];
|
|
5416
|
+
const metrics = [];
|
|
5417
|
+
if (details.toolCalls !== undefined) {
|
|
5418
|
+
metrics.push(`${details.toolCalls} tool call${details.toolCalls === 1 ? "" : "s"}`);
|
|
5419
|
+
}
|
|
5420
|
+
const duration = taskDuration(details);
|
|
5421
|
+
if (duration)
|
|
5422
|
+
metrics.push(duration);
|
|
5423
|
+
const usage = formatTaskUsage(details.usage);
|
|
5424
|
+
if (usage)
|
|
5425
|
+
metrics.push(usage);
|
|
5426
|
+
if (metrics.length > 0)
|
|
5427
|
+
headerLines.push(theme.fg("dim", metrics.join(" · ")));
|
|
5428
|
+
if (markerIndex !== -1) {
|
|
5429
|
+
const recentOutput = text.slice(markerIndex + marker.length);
|
|
5430
|
+
const bodyKind = details.kind === "command" ? details.state === "error" ? "error" : "plain" : details.state === "error" && !recentOutput.includes(`
|
|
5431
|
+
`) ? "error" : "markdown";
|
|
5432
|
+
return upsertSubagentReportComponent(context?.lastComponent, {
|
|
5433
|
+
headerLines,
|
|
5434
|
+
body: recentOutput,
|
|
5435
|
+
bodyKind,
|
|
5436
|
+
expanded,
|
|
5437
|
+
previewLines: 5,
|
|
5438
|
+
expandHint: formatExpandHint(context),
|
|
5439
|
+
footerLines: [
|
|
5440
|
+
theme.fg("dim", `↳ /landstrip-subagents ${details.taskId.slice(0, 8)} to inspect`)
|
|
5441
|
+
],
|
|
5442
|
+
theme
|
|
5443
|
+
});
|
|
5444
|
+
}
|
|
5445
|
+
return new Text(text || headerLines.join(`
|
|
5446
|
+
`), 0, 0);
|
|
5447
|
+
}
|
|
5448
|
+
if (details && "count" in details && typeof details.count === "number") {
|
|
5449
|
+
const summary = theme.fg("dim", `↳ ${details.count} task${details.count === 1 ? "" : "s"}`);
|
|
5450
|
+
if (!expanded || details.count === 0)
|
|
5451
|
+
return new Text(summary, 0, 0);
|
|
5452
|
+
return upsertSubagentReportComponent(context?.lastComponent, {
|
|
5453
|
+
headerLines: [summary],
|
|
5454
|
+
body: text,
|
|
5455
|
+
bodyKind: "plain",
|
|
5456
|
+
expanded: true,
|
|
5457
|
+
theme
|
|
5458
|
+
});
|
|
5459
|
+
}
|
|
5460
|
+
return new Text(theme.fg("toolOutput", text), 0, 0);
|
|
5029
5461
|
}
|
|
5030
5462
|
};
|
|
5031
5463
|
}
|
|
@@ -5048,7 +5480,7 @@ ${outputText}` }
|
|
|
5048
5480
|
mkdirSync3(sessionDir, { recursive: true });
|
|
5049
5481
|
const outputFile = join7(sessionDir, "output.txt");
|
|
5050
5482
|
const outputFd = openSync(outputFile, "w");
|
|
5051
|
-
const label = params.name?.trim() ||
|
|
5483
|
+
const label = params.name?.trim() || truncateToWidth2(params.command.trim(), 60);
|
|
5052
5484
|
const task = {
|
|
5053
5485
|
version: 1,
|
|
5054
5486
|
id: taskId,
|
|
@@ -5216,11 +5648,22 @@ ${descriptions}` : ""),
|
|
|
5216
5648
|
details: taskDetails(result.task, result.state)
|
|
5217
5649
|
};
|
|
5218
5650
|
},
|
|
5219
|
-
renderResult: (result,
|
|
5651
|
+
renderResult: (result, options, theme, context) => {
|
|
5652
|
+
const expanded = context?.expanded ?? options?.expanded ?? false;
|
|
5653
|
+
const isPartial = context?.isPartial ?? options?.isPartial ?? false;
|
|
5220
5654
|
const details = result.details;
|
|
5221
5655
|
const fallback = result.content.find((item) => item.type === "text")?.text ?? "(no output)";
|
|
5222
|
-
if (!details)
|
|
5223
|
-
|
|
5656
|
+
if (!details) {
|
|
5657
|
+
const parsed = parseTaskEnvelope(fallback);
|
|
5658
|
+
return upsertSubagentReportComponent(context?.lastComponent, {
|
|
5659
|
+
body: parsed ? parsed.body : fallback,
|
|
5660
|
+
bodyKind: parsed?.isError ? "error" : parsed?.isCommand ? "plain" : "markdown",
|
|
5661
|
+
expanded,
|
|
5662
|
+
previewLines: 3,
|
|
5663
|
+
expandHint: formatExpandHint(context),
|
|
5664
|
+
theme
|
|
5665
|
+
});
|
|
5666
|
+
}
|
|
5224
5667
|
const stateView = {
|
|
5225
5668
|
id: details.taskId,
|
|
5226
5669
|
agent: details.agent,
|
|
@@ -5228,11 +5671,12 @@ ${descriptions}` : ""),
|
|
|
5228
5671
|
state: details.state
|
|
5229
5672
|
};
|
|
5230
5673
|
const modeBadge = theme.fg(details.background ? "accent" : "muted", details.background ? "[bg]" : "[fg]");
|
|
5231
|
-
let
|
|
5674
|
+
let statusLine = `${taskState(theme, stateView)} ${modeBadge}`;
|
|
5232
5675
|
if (details.currentTool)
|
|
5233
|
-
|
|
5676
|
+
statusLine += theme.fg("muted", ` → ${details.currentTool}`);
|
|
5234
5677
|
if (details.retryAttempt)
|
|
5235
|
-
|
|
5678
|
+
statusLine += theme.fg("warning", ` retry ${details.retryAttempt}`);
|
|
5679
|
+
const headerLines = [statusLine];
|
|
5236
5680
|
const metrics = [];
|
|
5237
5681
|
if (details.toolCalls !== undefined) {
|
|
5238
5682
|
metrics.push(`${details.toolCalls} tool call${details.toolCalls === 1 ? "" : "s"}`);
|
|
@@ -5244,24 +5688,29 @@ ${descriptions}` : ""),
|
|
|
5244
5688
|
if (usage)
|
|
5245
5689
|
metrics.push(usage);
|
|
5246
5690
|
if (metrics.length > 0)
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
if (
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
if (!expanded && lines.length > shown.length) {
|
|
5258
|
-
text += `
|
|
5259
|
-
${theme.fg("muted", `… ${keyHint("app.tools.expand", "to expand")}`)}`;
|
|
5260
|
-
}
|
|
5691
|
+
headerLines.push(theme.fg("dim", metrics.join(" · ")));
|
|
5692
|
+
let body = "";
|
|
5693
|
+
let bodyKind = details.kind === "command" ? "plain" : "markdown";
|
|
5694
|
+
if (details.error) {
|
|
5695
|
+
body = details.error;
|
|
5696
|
+
bodyKind = "error";
|
|
5697
|
+
} else if (details.output) {
|
|
5698
|
+
body = details.output;
|
|
5699
|
+
} else if (isPartial && fallback && !isStreamStatusPlaceholder(fallback)) {
|
|
5700
|
+
body = fallback;
|
|
5261
5701
|
}
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5702
|
+
return upsertSubagentReportComponent(context?.lastComponent, {
|
|
5703
|
+
headerLines,
|
|
5704
|
+
body,
|
|
5705
|
+
bodyKind,
|
|
5706
|
+
expanded,
|
|
5707
|
+
previewLines: 3,
|
|
5708
|
+
expandHint: formatExpandHint(context),
|
|
5709
|
+
footerLines: [
|
|
5710
|
+
theme.fg("dim", `↳ /landstrip-subagents ${details.taskId.slice(0, 8)} to inspect`)
|
|
5711
|
+
],
|
|
5712
|
+
theme
|
|
5713
|
+
});
|
|
5265
5714
|
}
|
|
5266
5715
|
};
|
|
5267
5716
|
}
|
|
@@ -5538,6 +5987,9 @@ ${prompt}`;
|
|
|
5538
5987
|
let streamedText = "";
|
|
5539
5988
|
let workerError;
|
|
5540
5989
|
worker.rpc.onEvent((event) => {
|
|
5990
|
+
if (event.type === "message_start" && isRecord2(event.message) && event.message.role === "assistant") {
|
|
5991
|
+
streamedText = "";
|
|
5992
|
+
}
|
|
5541
5993
|
if (event.type === "message_update" && isRecord2(event.assistantMessageEvent)) {
|
|
5542
5994
|
const messageEvent = event.assistantMessageEvent;
|
|
5543
5995
|
if (messageEvent.type === "text_delta" && typeof messageEvent.delta === "string") {
|
|
@@ -6023,6 +6475,57 @@ ${renderTaskResult(task.id, task.state, message)}`);
|
|
|
6023
6475
|
}, { triggerTurn: true, deliverAs: "followUp" });
|
|
6024
6476
|
return true;
|
|
6025
6477
|
}
|
|
6478
|
+
renderTaskResultMessage(message, options, theme) {
|
|
6479
|
+
const rawContent = typeof message.content === "string" ? message.content : messageContentText(message);
|
|
6480
|
+
const parsed = parseTaskEnvelope(rawContent);
|
|
6481
|
+
const detailsTaskId = isRecord2(message.details) && typeof message.details.taskId === "string" ? message.details.taskId : undefined;
|
|
6482
|
+
const taskId = parsed?.taskId ?? detailsTaskId;
|
|
6483
|
+
const task = taskId ? this.tasks.get(taskId) : undefined;
|
|
6484
|
+
const resolvedState = parsed?.state === "completed" || parsed?.state === "running" || parsed?.state === "queued" || parsed?.state === "cancelled" || parsed?.state === "interrupted" || parsed?.state === "error" ? parsed.state : task?.state ?? (parsed?.isError ? "error" : "completed");
|
|
6485
|
+
const stateBadge = taskState(theme, {
|
|
6486
|
+
id: taskId ?? "",
|
|
6487
|
+
agent: task?.agent ?? "subagent",
|
|
6488
|
+
description: task?.description ?? "",
|
|
6489
|
+
state: resolvedState
|
|
6490
|
+
});
|
|
6491
|
+
const modeBadge = theme.fg("accent", "[bg]");
|
|
6492
|
+
const headerLines = [];
|
|
6493
|
+
if (task) {
|
|
6494
|
+
const tag = task.kind === "command" ? "$ bash" : `@${task.agent}`;
|
|
6495
|
+
headerLines.push(`${stateBadge} ${modeBadge} ${theme.fg("accent", theme.bold(tag))}${theme.fg("muted", " — ")}${theme.fg("text", task.description)}`);
|
|
6496
|
+
const details = taskDetails(task, resolvedState);
|
|
6497
|
+
const metrics = [];
|
|
6498
|
+
if (details.toolCalls !== undefined) {
|
|
6499
|
+
metrics.push(`${details.toolCalls} tool call${details.toolCalls === 1 ? "" : "s"}`);
|
|
6500
|
+
}
|
|
6501
|
+
const duration = taskDuration(details);
|
|
6502
|
+
if (duration)
|
|
6503
|
+
metrics.push(duration);
|
|
6504
|
+
const usage = formatTaskUsage(details.usage);
|
|
6505
|
+
if (usage)
|
|
6506
|
+
metrics.push(usage);
|
|
6507
|
+
if (metrics.length > 0)
|
|
6508
|
+
headerLines.push(theme.fg("dim", metrics.join(" · ")));
|
|
6509
|
+
} else {
|
|
6510
|
+
const preamble = parsed?.preamble ? `${theme.fg("muted", " — ")}${theme.fg("text", parsed.preamble)}` : "";
|
|
6511
|
+
headerLines.push(`${stateBadge} ${modeBadge}${preamble}`);
|
|
6512
|
+
}
|
|
6513
|
+
const bodyKind = parsed?.isError ? "error" : task?.kind === "command" || parsed?.isCommand ? "plain" : "markdown";
|
|
6514
|
+
const outputPad = typeof options?.outputPad === "number" ? options.outputPad : 1;
|
|
6515
|
+
const bgFn = typeof theme.bg === "function" ? (text) => theme.bg("customMessageBg", text) : undefined;
|
|
6516
|
+
const box = new Box(outputPad, 1, bgFn);
|
|
6517
|
+
box.addChild(new SubagentReportComponent({
|
|
6518
|
+
headerLines,
|
|
6519
|
+
body: parsed ? parsed.body : rawContent,
|
|
6520
|
+
bodyKind,
|
|
6521
|
+
expanded: Boolean(options?.expanded),
|
|
6522
|
+
previewLines: 5,
|
|
6523
|
+
expandHint: formatExpandHint(options),
|
|
6524
|
+
footerLines: taskId ? [theme.fg("dim", `↳ /landstrip-subagents ${taskId.slice(0, 8)} to inspect`)] : [],
|
|
6525
|
+
theme
|
|
6526
|
+
}));
|
|
6527
|
+
return box;
|
|
6528
|
+
}
|
|
6026
6529
|
storeTaskText(task, value, kind) {
|
|
6027
6530
|
if (Buffer.byteLength(value) <= MAX_TASK_OUTPUT_BYTES)
|
|
6028
6531
|
return value;
|
|
@@ -6070,8 +6573,8 @@ ${renderTaskResult(task.id, task.state, message)}`);
|
|
|
6070
6573
|
const progress = taskProgress(record);
|
|
6071
6574
|
const suffix = progress.length > 0 ? theme.fg("dim", ` · ${progress.join(" · ")}`) : "";
|
|
6072
6575
|
const indentWidth = 3 + Math.max(0, record.depth) * 3;
|
|
6073
|
-
const descriptionWidth = Math.max(1, width - indentWidth -
|
|
6074
|
-
const description = theme.fg("text",
|
|
6576
|
+
const descriptionWidth = Math.max(1, width - indentWidth - visibleWidth2(`${state} ${mode} ${agent} ${suffix}`));
|
|
6577
|
+
const description = theme.fg("text", truncateToWidth2(task.description, descriptionWidth));
|
|
6075
6578
|
return `${state} ${mode} ${agent} ${description}${suffix}`;
|
|
6076
6579
|
});
|
|
6077
6580
|
const shown = tree.slice(0, 8);
|
|
@@ -6086,7 +6589,7 @@ ${renderTaskResult(task.id, task.state, message)}`);
|
|
|
6086
6589
|
shown.push(` ${icon} ${theme.fg("dim", comp.text)}`);
|
|
6087
6590
|
}
|
|
6088
6591
|
}
|
|
6089
|
-
return [header, ...shown].map((line) =>
|
|
6592
|
+
return [header, ...shown].map((line) => truncateToWidth2(line, Math.max(1, width)));
|
|
6090
6593
|
},
|
|
6091
6594
|
invalidate() {}
|
|
6092
6595
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-landstrip",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.29",
|
|
4
4
|
"description": "Sandboxed Bash and process-backed agents for Pi",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"landstrip",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"ci:test": "npm run test"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@landstrip/landstrip-api": "^0.20.
|
|
42
|
+
"@landstrip/landstrip-api": "^0.20.29",
|
|
43
43
|
"jsonc-parser": "^3.3.1",
|
|
44
44
|
"minimatch": "^10.2.5",
|
|
45
45
|
"semver": "^7.8.6",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@types/node": "^26.4.1",
|
|
55
55
|
"@types/semver": "^7.8.0",
|
|
56
56
|
"@types/shell-quote": "^1.7.5",
|
|
57
|
-
"oxfmt": "^0.
|
|
57
|
+
"oxfmt": "^0.78.0",
|
|
58
58
|
"oxlint": "^1.68.0",
|
|
59
59
|
"typebox": "^1.3.6",
|
|
60
60
|
"typescript": "^5.0.0",
|