@oh-my-pi/pi-tui 18.10.1 → 18.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -50
- package/THIRD-PARTY-NOTICES.txt +3 -3
- package/dist/types/app-keybindings.d.ts +8 -8
- package/dist/types/apps/git/diff-pane.d.ts +5 -0
- package/dist/types/apps/git/state.d.ts +11 -0
- package/dist/types/chat/assistant-message.d.ts +8 -3
- package/dist/types/chat/tool-execution.d.ts +32 -20
- package/dist/types/native/backend.d.ts +5 -4
- package/dist/types/native/blobs.d.ts +13 -1
- package/dist/types/overlays/model-browser.d.ts +6 -1
- package/dist/types/tools/bash.d.ts +2 -1
- package/dist/types/tools/eval.d.ts +2 -2
- package/dist/types/tools/native-view.d.ts +1 -1
- package/dist/types/tools/read.d.ts +7 -1
- package/dist/types/tools/renderer.d.ts +2 -0
- package/package.json +9 -9
- package/src/app-keybindings.ts +8 -8
- package/src/apps/git/diff-pane.ts +39 -35
- package/src/apps/git/git-tui.ts +53 -4
- package/src/apps/git/state.ts +12 -0
- package/src/chat/assistant-message.ts +27 -6
- package/src/chat/tool-execution.ts +73 -30
- package/src/native/backend.ts +13 -5
- package/src/native/blobs.ts +34 -1
- package/src/overlays/model-browser.ts +23 -1
- package/src/overlays/model-hub.ts +2 -9
- package/src/overlays/tree-selector.ts +117 -2
- package/src/tools/bash.ts +9 -8
- package/src/tools/eval.ts +2 -2
- package/src/tools/native-view.ts +2 -2
- package/src/tools/read.ts +12 -4
- package/src/tools/renderer.ts +2 -0
- package/src/tools/wait.ts +16 -30
|
@@ -56,7 +56,8 @@ import { resolveAssistantErrorPresentation } from "../chat/transcript-render-hel
|
|
|
56
56
|
import { OverlayPanel, PanelDivider } from "../chrome/overlay-box";
|
|
57
57
|
import { TreeView, type TreeAncestor, type TreeRow } from "../components/tree-view";
|
|
58
58
|
import { formatKeyHint, formatKeyHints } from "../app-keybindings";
|
|
59
|
-
import { boundKeys, editorKeys, interruptKey } from "../chrome/keybinding-hints";
|
|
59
|
+
import { boundKeys, editorKey, editorKeys, interruptKey } from "../chrome/keybinding-hints";
|
|
60
|
+
import { getKeybindings } from "../keybindings";
|
|
60
61
|
import type { TspPickerItem, TspPickerProps, TspSpan, TspText } from "@oh-my-pi/pi-wire";
|
|
61
62
|
import type { ThemeColor } from "../theme/schema";
|
|
62
63
|
import { col, keyed, node, span, text } from "../native/describe";
|
|
@@ -204,6 +205,7 @@ class TreeList implements Component {
|
|
|
204
205
|
#roots: TreeSelectorNode[] = [];
|
|
205
206
|
#rootIds: Set<string> = new Set();
|
|
206
207
|
#nodeById: Map<string, TreeSelectorNode> = new Map();
|
|
208
|
+
#parentById: Map<string, string | null> = new Map();
|
|
207
209
|
#filterMode: FilterMode;
|
|
208
210
|
/** The search field; its value is the fuzzy query. */
|
|
209
211
|
readonly searchInput = new Input();
|
|
@@ -236,6 +238,14 @@ class TreeList implements Component {
|
|
|
236
238
|
| { rows: readonly TreeRow<TreeSelectorNode, string>[]; labels: number; items: TspPickerItem[] }
|
|
237
239
|
| undefined;
|
|
238
240
|
#pickerOrder: { rows: readonly TreeRow<TreeSelectorNode, string>[]; order: string[] } | undefined;
|
|
241
|
+
/** Branch-navigation targets for one filtered rows snapshot; filtering replaces the rows array. */
|
|
242
|
+
#branchTargets:
|
|
243
|
+
| {
|
|
244
|
+
rows: readonly TreeRow<TreeSelectorNode, string>[];
|
|
245
|
+
targets: readonly TreeSelectorNode[];
|
|
246
|
+
targetIndexByRootId: ReadonlyMap<string, number>;
|
|
247
|
+
}
|
|
248
|
+
| undefined;
|
|
239
249
|
#previewMemo: { node: TreeSelectorNode | undefined; labels: number; preview: NativeChild[] } | undefined;
|
|
240
250
|
|
|
241
251
|
constructor(
|
|
@@ -293,8 +303,9 @@ class TreeList implements Component {
|
|
|
293
303
|
this.#containsActive.clear();
|
|
294
304
|
this.#nodeById.clear();
|
|
295
305
|
this.#activePathIds.clear();
|
|
306
|
+
this.#parentById.clear();
|
|
296
307
|
|
|
297
|
-
const parentIds =
|
|
308
|
+
const parentIds = this.#parentById;
|
|
298
309
|
const allNodes: TreeSelectorNode[] = [];
|
|
299
310
|
const visitStack: TreeSelectorNode[] = [...roots];
|
|
300
311
|
while (visitStack.length > 0) {
|
|
@@ -367,6 +378,100 @@ class TreeList implements Component {
|
|
|
367
378
|
return [...children].sort((a, b) => Number(this.#containsActive.get(b)) - Number(this.#containsActive.get(a)));
|
|
368
379
|
}
|
|
369
380
|
|
|
381
|
+
/** Visible branch targets in rendered order, keyed by every raw branch head. */
|
|
382
|
+
#visibleBranchProjection(rows: readonly TreeRow<TreeSelectorNode, string>[]): {
|
|
383
|
+
targets: readonly TreeSelectorNode[];
|
|
384
|
+
targetIndexByRootId: ReadonlyMap<string, number>;
|
|
385
|
+
} {
|
|
386
|
+
const visibleIndex = new Map<string, number>();
|
|
387
|
+
for (let index = 0; index < rows.length; index++) visibleIndex.set(rows[index]!.key, index);
|
|
388
|
+
const nodes: TreeSelectorNode[] = [];
|
|
389
|
+
const stack = [...this.#roots].reverse();
|
|
390
|
+
while (stack.length > 0) {
|
|
391
|
+
const node = stack.pop()!;
|
|
392
|
+
nodes.push(node);
|
|
393
|
+
const children = this.#orderedChildren(node);
|
|
394
|
+
for (let index = children.length - 1; index >= 0; index--) stack.push(children[index]!);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// One bottom-up pass makes filtered-head promotion O(nodes), rather than
|
|
398
|
+
// rescanning a branch subtree for every fork.
|
|
399
|
+
const firstVisibleById = new Map<string, TreeSelectorNode>();
|
|
400
|
+
for (let index = nodes.length - 1; index >= 0; index--) {
|
|
401
|
+
const node = nodes[index]!;
|
|
402
|
+
let target = visibleIndex.has(node.entry.id) ? node : undefined;
|
|
403
|
+
if (!target) {
|
|
404
|
+
for (const child of this.#orderedChildren(node)) {
|
|
405
|
+
target = firstVisibleById.get(child.entry.id);
|
|
406
|
+
if (target) break;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
if (target) firstVisibleById.set(node.entry.id, target);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
const byTargetId = new Map<string, { rootIds: string[]; target: TreeSelectorNode }>();
|
|
413
|
+
const addFork = (branches: readonly TreeSelectorNode[]) => {
|
|
414
|
+
if (branches.length < 2) return;
|
|
415
|
+
for (const branch of branches) {
|
|
416
|
+
const target = firstVisibleById.get(branch.entry.id);
|
|
417
|
+
if (!target) continue;
|
|
418
|
+
const existing = byTargetId.get(target.entry.id);
|
|
419
|
+
if (existing) existing.rootIds.push(branch.entry.id);
|
|
420
|
+
else byTargetId.set(target.entry.id, { rootIds: [branch.entry.id], target });
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
addFork(this.#roots);
|
|
424
|
+
for (const node of nodes) addFork(this.#orderedChildren(node));
|
|
425
|
+
|
|
426
|
+
const ordered = [...byTargetId.values()].sort(
|
|
427
|
+
(a, b) => visibleIndex.get(a.target.entry.id)! - visibleIndex.get(b.target.entry.id)!,
|
|
428
|
+
);
|
|
429
|
+
const targetIndexByRootId = new Map<string, number>();
|
|
430
|
+
for (let index = 0; index < ordered.length; index++) {
|
|
431
|
+
for (const rootId of ordered[index]!.rootIds) targetIndexByRootId.set(rootId, index);
|
|
432
|
+
}
|
|
433
|
+
return { targets: ordered.map(entry => entry.target), targetIndexByRootId };
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/** Raw branch root containing `entryId` at its nearest ancestor fork. */
|
|
437
|
+
#nearestBranchRootId(entryId: string): string | undefined {
|
|
438
|
+
let branchId = entryId;
|
|
439
|
+
let parentId = this.#parentById.get(branchId);
|
|
440
|
+
while (parentId !== undefined) {
|
|
441
|
+
const siblings = parentId === null ? this.#roots : this.#orderedChildren(this.#nodeById.get(parentId)!);
|
|
442
|
+
if (siblings.length > 1) return branchId;
|
|
443
|
+
if (parentId === null) break;
|
|
444
|
+
branchId = parentId;
|
|
445
|
+
parentId = this.#parentById.get(parentId);
|
|
446
|
+
}
|
|
447
|
+
return undefined;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Move through every visible branch in rendered order, crossing nested fork
|
|
452
|
+
* depths. Raw ancestry identifies branch membership; visibility only chooses
|
|
453
|
+
* the first selectable descendant when a branch head is filtered.
|
|
454
|
+
*/
|
|
455
|
+
#moveBranch(direction: -1 | 1): void {
|
|
456
|
+
const selected = this.#tree.selectedItem;
|
|
457
|
+
if (!selected) return;
|
|
458
|
+
// Projection is O(nodes); reuse it across presses until filtering replaces the rows.
|
|
459
|
+
const rows = this.#tree.rows;
|
|
460
|
+
if (this.#branchTargets?.rows !== rows) this.#branchTargets = { rows, ...this.#visibleBranchProjection(rows) };
|
|
461
|
+
const { targets, targetIndexByRootId } = this.#branchTargets;
|
|
462
|
+
|
|
463
|
+
if (targets.length === 0) return;
|
|
464
|
+
const currentRootId = this.#nearestBranchRootId(selected.entry.id);
|
|
465
|
+
const currentIndex = currentRootId === undefined ? -1 : (targetIndexByRootId.get(currentRootId) ?? -1);
|
|
466
|
+
const nextIndex =
|
|
467
|
+
currentIndex < 0
|
|
468
|
+
? direction > 0
|
|
469
|
+
? 0
|
|
470
|
+
: targets.length - 1
|
|
471
|
+
: (currentIndex + direction + targets.length) % targets.length;
|
|
472
|
+
this.#tree.setSelectedKey(targets[nextIndex]!.entry.id);
|
|
473
|
+
}
|
|
474
|
+
|
|
370
475
|
#applyFilter(): void {
|
|
371
476
|
// TreeView retains the nearest visible selection (including an anchor
|
|
372
477
|
// through empty filter results) when the predicate is replaced.
|
|
@@ -1210,6 +1315,10 @@ class TreeList implements Component {
|
|
|
1210
1315
|
(node.entry.message.role === "user" || node.entry.message.role === "assistant"),
|
|
1211
1316
|
1,
|
|
1212
1317
|
);
|
|
1318
|
+
} else if (getKeybindings().matches(keyData, "app.tree.previousBranch")) {
|
|
1319
|
+
this.#moveBranch(-1);
|
|
1320
|
+
} else if (getKeybindings().matches(keyData, "app.tree.nextBranch")) {
|
|
1321
|
+
this.#moveBranch(1);
|
|
1213
1322
|
} else if (matchesKey(keyData, "home")) {
|
|
1214
1323
|
this.#tree.setSelectionIndex(0);
|
|
1215
1324
|
} else if (matchesKey(keyData, "end")) {
|
|
@@ -1398,6 +1507,10 @@ export class TreeSelectorComponent extends OverlayPanel {
|
|
|
1398
1507
|
this.#treeContainer.addChild(this.#treeList);
|
|
1399
1508
|
|
|
1400
1509
|
this.#labelInputContainer = new Container();
|
|
1510
|
+
// Either action may be unbound; hint only the keys that still do something.
|
|
1511
|
+
const branchKeys = [editorKey("app.tree.previousBranch"), editorKey("app.tree.nextBranch")]
|
|
1512
|
+
.filter(Boolean)
|
|
1513
|
+
.join("/");
|
|
1401
1514
|
|
|
1402
1515
|
this.addChild(new Spacer(1));
|
|
1403
1516
|
this.addChild(
|
|
@@ -1407,6 +1520,7 @@ export class TreeSelectorComponent extends OverlayPanel {
|
|
|
1407
1520
|
[
|
|
1408
1521
|
`${formatKeyHint("enter")}: switch.`,
|
|
1409
1522
|
`${formatKeyHints(["alt+up", "alt+down"])}: previous/next turn.`,
|
|
1523
|
+
...(branchKeys ? [`${branchKeys}: previous/next branch.`] : []),
|
|
1410
1524
|
`${editorKeys("tui.select.pageUp", "tui.select.pageDown")} (${formatKeyHints(["left", "right"])}): page.`,
|
|
1411
1525
|
`${formatKeyHints(["home", "end"])}: first/last item.`,
|
|
1412
1526
|
`${formatKeyHint("shift+enter")}: summarize & switch.`,
|
|
@@ -1563,6 +1677,7 @@ export class TreeSelectorComponent extends OverlayPanel {
|
|
|
1563
1677
|
hintsRow([
|
|
1564
1678
|
{ keys: ["enter"], label: "switch" },
|
|
1565
1679
|
{ keys: ["alt+up", "alt+down"], label: "previous/next turn" },
|
|
1680
|
+
actionHint(["app.tree.previousBranch", "app.tree.nextBranch"], "previous/next branch"),
|
|
1566
1681
|
actionHint(["tui.select.pageUp", "tui.select.pageDown"], "page"),
|
|
1567
1682
|
{ keys: ["home", "end"], label: "first/last" },
|
|
1568
1683
|
{ keys: ["shift+enter"], label: "summarize & switch" },
|
package/src/tools/bash.ts
CHANGED
|
@@ -75,8 +75,9 @@ export interface BashToolDetails {
|
|
|
75
75
|
timedOut: boolean;
|
|
76
76
|
pid?: number;
|
|
77
77
|
};
|
|
78
|
+
/** Background job behind the call; `cancelled`: killed (`proc://<id>/kill`) before it finished. */
|
|
78
79
|
async?: {
|
|
79
|
-
state: "running" | "completed" | "failed";
|
|
80
|
+
state: "running" | "completed" | "failed" | "cancelled";
|
|
80
81
|
jobId: string;
|
|
81
82
|
type: "bash";
|
|
82
83
|
};
|
|
@@ -426,9 +427,9 @@ function shellRunState(
|
|
|
426
427
|
cancelled: boolean,
|
|
427
428
|
): RunState {
|
|
428
429
|
if (cancelled) return "cancelled";
|
|
430
|
+
if (details?.async?.state === "running") return "background";
|
|
429
431
|
if (isPartial) return "running";
|
|
430
432
|
if (details?.timedOut === true) return "timed-out";
|
|
431
|
-
if (details?.async?.state === "running") return "background";
|
|
432
433
|
if (isError || (details?.exitCode !== undefined && details.exitCode !== 0)) return "failed";
|
|
433
434
|
return "done";
|
|
434
435
|
}
|
|
@@ -677,13 +678,13 @@ export function createShellRenderer<TArgs>(config: ShellRendererConfig<TArgs>) {
|
|
|
677
678
|
const command = formatBashCommandText(toBashRenderArgs(args, config));
|
|
678
679
|
const previewLines = renderContext?.previewLines ?? BASH_DEFAULT_PREVIEW_LINES;
|
|
679
680
|
const state = shellRunState(details, isError, isPartial, options.cancelled === true);
|
|
680
|
-
//
|
|
681
|
-
|
|
682
|
-
|
|
681
|
+
// Live (a running call, or a parked job still streaming): the call's clock. Settled: the
|
|
682
|
+
// measured wall time wins. A frozen background snapshot's run time is unknown here.
|
|
683
|
+
const elapsedMs = isPartial
|
|
684
|
+
? options.elapsedMs
|
|
685
|
+
: state === "background"
|
|
683
686
|
? undefined
|
|
684
|
-
:
|
|
685
|
-
? options.elapsedMs
|
|
686
|
-
: (details?.wallTimeMs ?? options.elapsedMs);
|
|
687
|
+
: (details?.wallTimeMs ?? options.elapsedMs);
|
|
687
688
|
const meta = details?.meta;
|
|
688
689
|
const box = runBox(
|
|
689
690
|
[
|
package/src/tools/eval.ts
CHANGED
|
@@ -92,9 +92,9 @@ export interface EvalToolDetails {
|
|
|
92
92
|
languages?: EvalLanguage[];
|
|
93
93
|
/** Optional human-readable notice (e.g. fallback explanation). */
|
|
94
94
|
notice?: string;
|
|
95
|
-
/** Present when the cell was auto-backgrounded as an async job. */
|
|
95
|
+
/** Present when the cell was auto-backgrounded as an async job; `cancelled`: killed before it finished. */
|
|
96
96
|
async?: {
|
|
97
|
-
state: "running" | "completed" | "failed";
|
|
97
|
+
state: "running" | "completed" | "failed" | "cancelled";
|
|
98
98
|
jobId: string;
|
|
99
99
|
type: "eval";
|
|
100
100
|
};
|
package/src/tools/native-view.ts
CHANGED
|
@@ -213,7 +213,7 @@ export interface RunFootInput {
|
|
|
213
213
|
readonly state: RunState;
|
|
214
214
|
/** Exit code of a `failed` run; a non-zero code names the state `exit N`. */
|
|
215
215
|
readonly exitCode?: number;
|
|
216
|
-
/** Milliseconds run so far (`running`) or in total;
|
|
216
|
+
/** Milliseconds run so far (`running`, a live `background` job) or in total; omitted when undefined. */
|
|
217
217
|
readonly elapsedMs?: number;
|
|
218
218
|
/** Quiet facts (job id, service state, artifact), muted and ` · `-joined. */
|
|
219
219
|
readonly facts?: readonly string[];
|
|
@@ -247,7 +247,7 @@ export function runFoot(input: RunFootInput): NativeNode {
|
|
|
247
247
|
? undefined
|
|
248
248
|
: node(
|
|
249
249
|
"elapsed",
|
|
250
|
-
input.state === "running"
|
|
250
|
+
input.state === "running" || input.state === "background"
|
|
251
251
|
? { role: "omp.run.time", age: ms, format: "short" }
|
|
252
252
|
: { role: "omp.run.time", age: ms, stopped: ms, format: "short" },
|
|
253
253
|
undefined,
|
package/src/tools/read.ts
CHANGED
|
@@ -15,7 +15,7 @@ import type {
|
|
|
15
15
|
ToolRenderer,
|
|
16
16
|
} from "./renderer";
|
|
17
17
|
import { ansi, compact, md } from "../native/describe";
|
|
18
|
-
import { base64ImageNode } from "../native/blobs";
|
|
18
|
+
import { base64ImageNode, nativeMediaNode } from "../native/blobs";
|
|
19
19
|
import type { NativeChild, NativeNode } from "../native/node";
|
|
20
20
|
import { fileHref, footnoteText, inlineErrorView, resultText } from "./native-view";
|
|
21
21
|
import { numberedCode } from "./grouped-file-output";
|
|
@@ -54,6 +54,12 @@ export interface ReadToolDetails {
|
|
|
54
54
|
truncation?: ReadTruncationStats;
|
|
55
55
|
isDirectory?: boolean;
|
|
56
56
|
resolvedPath?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Absolute path of the disk file whose image this read returned. A native TSP host that
|
|
59
|
+
* supports `media` shows the file by path instead of the uploaded image bytes. Unset for
|
|
60
|
+
* screenshots, URL reads and other images not backed by a file. Display-only.
|
|
61
|
+
*/
|
|
62
|
+
mediaPath?: string;
|
|
57
63
|
suffixResolution?: { from: string; to: string };
|
|
58
64
|
url?: string;
|
|
59
65
|
finalUrl?: string;
|
|
@@ -659,7 +665,7 @@ export const readToolRenderer = {
|
|
|
659
665
|
*/
|
|
660
666
|
describeResult(
|
|
661
667
|
result: { content: Array<{ type: string; text?: string }>; details?: ReadToolDetails; isError?: boolean },
|
|
662
|
-
|
|
668
|
+
options: RenderResultOptions,
|
|
663
669
|
args?: ReadRenderArgs,
|
|
664
670
|
): NativeToolView {
|
|
665
671
|
const details = result.details;
|
|
@@ -695,6 +701,8 @@ export const readToolRenderer = {
|
|
|
695
701
|
);
|
|
696
702
|
|
|
697
703
|
const contentText = details?.displayContent?.text ?? stripOutputNotice(resultText(result), details?.meta);
|
|
704
|
+
// A file Tern's media viewer shows (image, model, PDF, video, audio): the host loads it by path.
|
|
705
|
+
const media = options.media && details?.mediaPath ? nativeMediaNode(details.mediaPath, "media") : undefined;
|
|
698
706
|
const imageBlock = result.content?.find(isImageBlock);
|
|
699
707
|
if (imageBlock) {
|
|
700
708
|
const detailText = contentText.trim();
|
|
@@ -703,7 +711,7 @@ export const readToolRenderer = {
|
|
|
703
711
|
tone: suffix ? "warning" : undefined,
|
|
704
712
|
inline: true,
|
|
705
713
|
body: compact<NativeChild>([
|
|
706
|
-
describeReadImage(imageBlock, shortenPath(suffix?.to ?? splitReadRenderPath(rawPath).path)),
|
|
714
|
+
media ?? describeReadImage(imageBlock, shortenPath(suffix?.to ?? splitReadRenderPath(rawPath).path)),
|
|
707
715
|
detailText.length > 0 && ansi(detailText),
|
|
708
716
|
foot,
|
|
709
717
|
]),
|
|
@@ -722,7 +730,7 @@ export const readToolRenderer = {
|
|
|
722
730
|
details?.displayContent?.lineNumbers,
|
|
723
731
|
getLanguageFromPath(renderPath.path),
|
|
724
732
|
);
|
|
725
|
-
return { tool: head, inline: true, body: compact<NativeChild>([...content, foot]) };
|
|
733
|
+
return { tool: head, inline: true, body: compact<NativeChild>([media, ...content, foot]) };
|
|
726
734
|
},
|
|
727
735
|
mergeCallAndResult: true,
|
|
728
736
|
} satisfies ToolRenderer<ReadRenderArgs, ReadToolDetails>;
|
package/src/tools/renderer.ts
CHANGED
|
@@ -34,6 +34,8 @@ export interface RenderResultOptions {
|
|
|
34
34
|
elapsedMs?: number;
|
|
35
35
|
/** The call was abandoned without a final result (turn aborted, sealed). Native describe hooks only. */
|
|
36
36
|
cancelled?: boolean;
|
|
37
|
+
/** The native host shows files by path (`cx.supports("media")`). Native describe hooks only. */
|
|
38
|
+
media?: boolean;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
/** Render options for a result, plus the tool-specific context the transcript threads through. */
|
package/src/tools/wait.ts
CHANGED
|
@@ -589,7 +589,11 @@ export function createIrcMessageCard(
|
|
|
589
589
|
return Object.assign(component, { describe: () => described });
|
|
590
590
|
}
|
|
591
591
|
|
|
592
|
-
/**
|
|
592
|
+
/**
|
|
593
|
+
* One job row on one line: type badge, id + label, terminal-clocked duration
|
|
594
|
+
* (live while running). The job's output and errors fill the card of the call
|
|
595
|
+
* that started it (`parksAsBackground`), so the row carries no preview.
|
|
596
|
+
*/
|
|
593
597
|
function describeJob(job: JobSnapshot, isPartial: boolean): NativeNode {
|
|
594
598
|
const running = job.status === "running" && isPartial;
|
|
595
599
|
const label = job.label.trim() !== job.id ? plainText(job.label.split(/\r?\n/)[0] ?? "") : "";
|
|
@@ -606,39 +610,21 @@ function describeJob(job: JobSnapshot, isPartial: boolean): NativeNode {
|
|
|
606
610
|
: job.status === "cancelled"
|
|
607
611
|
? "warning"
|
|
608
612
|
: "accent";
|
|
609
|
-
const artifactError = job.meta?.artifactError ?? job.artifactError;
|
|
610
|
-
const preview = flattenStructuredPreview(
|
|
611
|
-
stripTaskResultEnvelope(
|
|
612
|
-
stripOutputNotice(job.errorText?.trim() || job.resultText?.trim() || "", job.meta).trim(),
|
|
613
|
-
),
|
|
614
|
-
);
|
|
615
613
|
return node(
|
|
616
|
-
"
|
|
617
|
-
{ role: "omp.wait.job", tone },
|
|
614
|
+
"row",
|
|
615
|
+
{ role: "omp.wait.job", tone, gap: "sm" },
|
|
618
616
|
compact([
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
tone: "accent",
|
|
628
|
-
title: "Agent's own completion estimate",
|
|
629
|
-
})
|
|
630
|
-
: undefined,
|
|
631
|
-
elapsed(job.durationMs, !running),
|
|
632
|
-
]),
|
|
633
|
-
{ gap: "sm" },
|
|
634
|
-
),
|
|
635
|
-
artifactError && text([span(formatArtifactErrorNotice(artifactError), "warning")], { wrap: "word" }),
|
|
636
|
-
preview
|
|
637
|
-
? text([span(plainText(preview), job.errorText ? "error" : "dim")], {
|
|
638
|
-
wrap: "word",
|
|
639
|
-
lines: PREVIEW_LINES_EXPANDED,
|
|
617
|
+
node("badge", { text: job.type, tone }),
|
|
618
|
+
text(spans, { truncate: "end", grow: 1 }),
|
|
619
|
+
job.status === "running" && job.completionPercent !== undefined
|
|
620
|
+
? node("progress", {
|
|
621
|
+
value: job.completionPercent / 100,
|
|
622
|
+
label: `${job.completionPercent}%`,
|
|
623
|
+
tone: "accent",
|
|
624
|
+
title: "Agent's own completion estimate",
|
|
640
625
|
})
|
|
641
626
|
: undefined,
|
|
627
|
+
elapsed(job.durationMs, !running),
|
|
642
628
|
]),
|
|
643
629
|
job.id,
|
|
644
630
|
);
|