@linxiraos/pi-tui 1.4.0 → 1.4.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.
Files changed (105) hide show
  1. package/CHANGELOG.md +178 -182
  2. package/dist/types/autocomplete.d.ts +6 -0
  3. package/dist/types/components/sparkline.d.ts +34 -0
  4. package/dist/types/index.d.ts +1 -0
  5. package/dist/types/native/describe.d.ts +7 -1
  6. package/dist/types/native/overlay.d.ts +2 -0
  7. package/dist/types/native/tone.d.ts +2 -0
  8. package/dist/types/overlays/agent-hub.d.ts +3 -3
  9. package/dist/types/overlays/approval-dialog.d.ts +15 -1
  10. package/dist/types/overlays/jobs-panel.d.ts +3 -0
  11. package/dist/types/overlays/model-browser.d.ts +1 -1
  12. package/dist/types/render/output-block.d.ts +2 -0
  13. package/dist/types/render/tool-card.d.ts +2 -0
  14. package/dist/types/sixel.d.ts +28 -0
  15. package/dist/types/status-line/host.d.ts +3 -0
  16. package/dist/types/terminal-capabilities.d.ts +5 -0
  17. package/dist/types/tools/bash.d.ts +2 -0
  18. package/dist/types/tools/default-renderer.d.ts +3 -0
  19. package/dist/types/tools/eval.d.ts +9 -8
  20. package/dist/types/tools/irc.d.ts +6 -0
  21. package/dist/types/tools/job-widget.d.ts +226 -0
  22. package/dist/types/tools/json-tree.d.ts +2 -0
  23. package/dist/types/tools/line-ranges.d.ts +8 -1
  24. package/dist/types/tools/mcp.d.ts +23 -0
  25. package/dist/types/tools/output-meta.d.ts +1 -1
  26. package/dist/types/tools/read.d.ts +8 -2
  27. package/dist/types/tools/renderer.d.ts +8 -2
  28. package/dist/types/tools/result-card.d.ts +1 -1
  29. package/dist/types/tools/streaming-output.d.ts +1 -0
  30. package/dist/types/tools/task.d.ts +12 -0
  31. package/dist/types/tools/wait.d.ts +5 -0
  32. package/package.json +9 -9
  33. package/src/autocomplete.d.ts +6 -0
  34. package/src/autocomplete.ts +21 -6
  35. package/src/chat/skill-message.ts +16 -17
  36. package/src/chat/tool-execution.ts +35 -0
  37. package/src/chrome/transcript-container.ts +85 -13
  38. package/src/components/editor.ts +17 -7
  39. package/src/components/image.ts +5 -4
  40. package/src/components/markdown.ts +11 -3
  41. package/src/components/sparkline.d.ts +34 -0
  42. package/src/components/sparkline.ts +89 -0
  43. package/src/index.d.ts +1 -0
  44. package/src/index.ts +1 -0
  45. package/src/native/backend.ts +32 -6
  46. package/src/native/describe.d.ts +7 -1
  47. package/src/native/describe.ts +18 -1
  48. package/src/native/overlay.d.ts +2 -0
  49. package/src/native/overlay.ts +3 -0
  50. package/src/native/tone.d.ts +2 -0
  51. package/src/native/tone.ts +22 -0
  52. package/src/overlays/agent-hub.ts +14 -10
  53. package/src/overlays/agent-transcript-viewer.ts +2 -2
  54. package/src/overlays/agents-hub.ts +2 -1
  55. package/src/overlays/approval-dialog.ts +59 -13
  56. package/src/overlays/hub-frame.ts +2 -1
  57. package/src/overlays/jobs-panel.ts +24 -2
  58. package/src/overlays/model-browser.ts +3 -0
  59. package/src/overlays/model-hub.ts +2 -1
  60. package/src/prompt/attachment-chips.ts +1 -1
  61. package/src/render/output-block.d.ts +2 -0
  62. package/src/render/output-block.ts +25 -12
  63. package/src/render/tool-card.d.ts +2 -0
  64. package/src/render/tool-card.ts +6 -0
  65. package/src/sixel.d.ts +28 -0
  66. package/src/sixel.ts +185 -0
  67. package/src/status-line/component.ts +19 -2
  68. package/src/status-line/host.ts +3 -0
  69. package/src/terminal-capabilities.d.ts +5 -0
  70. package/src/terminal-capabilities.ts +43 -3
  71. package/src/theme/symbols.ts +5 -3
  72. package/src/tools/bash.d.ts +2 -0
  73. package/src/tools/bash.ts +25 -9
  74. package/src/tools/default-renderer.d.ts +3 -0
  75. package/src/tools/default-renderer.ts +54 -17
  76. package/src/tools/eval.d.ts +9 -8
  77. package/src/tools/eval.ts +32 -14
  78. package/src/tools/find.ts +4 -5
  79. package/src/tools/glob.ts +4 -6
  80. package/src/tools/grep.ts +2 -4
  81. package/src/tools/irc.d.ts +6 -0
  82. package/src/tools/irc.ts +6 -0
  83. package/src/tools/job-widget.d.ts +226 -0
  84. package/src/tools/job-widget.ts +1036 -0
  85. package/src/tools/json-tree.d.ts +2 -0
  86. package/src/tools/json-tree.ts +8 -0
  87. package/src/tools/line-ranges.d.ts +8 -1
  88. package/src/tools/line-ranges.ts +23 -13
  89. package/src/tools/mcp.d.ts +23 -0
  90. package/src/tools/mcp.ts +44 -1
  91. package/src/tools/output-meta.d.ts +1 -1
  92. package/src/tools/output-meta.ts +1 -1
  93. package/src/tools/read.d.ts +8 -2
  94. package/src/tools/read.ts +64 -21
  95. package/src/tools/renderer.d.ts +8 -2
  96. package/src/tools/renderer.ts +8 -2
  97. package/src/tools/result-card.d.ts +1 -1
  98. package/src/tools/result-card.ts +1 -2
  99. package/src/tools/streaming-output.d.ts +1 -0
  100. package/src/tools/streaming-output.ts +11 -9
  101. package/src/tools/task.d.ts +12 -0
  102. package/src/tools/task.ts +25 -1
  103. package/src/tools/wait.d.ts +5 -0
  104. package/src/tools/wait.ts +290 -147
  105. package/src/tui.ts +45 -5
@@ -1,6 +1,7 @@
1
1
  import type { Component } from "../tui.js";
2
2
  import type { DescribeContext, NativeNode, NativeUiEvent } from "../native/node.js";
3
3
  import { type JobTreeAgent } from "./job-tree.js";
4
+ import { type JobWidgetView } from "../tools/job-widget.js";
4
5
  /** One async job as the session snapshots it. */
5
6
  export interface JobsPanelJob {
6
7
  readonly id: string;
@@ -35,6 +36,8 @@ export interface JobsPanelDetail {
35
36
  readonly output?: string;
36
37
  /** Artifact holding the full output when `output` is cut. */
37
38
  readonly artifactId?: string;
39
+ /** The job's live widget (frozen once it settles), drawn above the output. */
40
+ readonly widget?: JobWidgetView;
38
41
  }
39
42
  /** The session behind a {@link JobsSheet}. */
40
43
  export interface JobsSheetSource {
@@ -7,7 +7,7 @@ import { type ThemeColor } from "../theme/theme.js";
7
7
  import type { TspPickerColumn, TspPickerGroup, TspPickerItem, TspPickerMark } from "@linxiraos/pi-wire";
8
8
  import type { NativeChild, NativeNode, NativeUiEvent } from "../native/node.js";
9
9
  /** Canonical display ordering of built-in model roles. */
10
- export type ModelRole = "default" | "smol" | "slow" | "vision" | "plan" | "commit" | "tiny" | "memory" | "task" | "advisor" | "image" | "web" | "speech" | "dictation" | "judge";
10
+ export type ModelRole = "default" | "smol" | "slow" | "vision" | "plan" | "commit" | "tiny" | "memory" | "task" | "advisor" | "widget" | "image" | "web" | "speech" | "dictation" | "judge";
11
11
  export declare const MODEL_ROLE_IDS: ModelRole[];
12
12
  export declare const CHAT_MODEL_ROLE_IDS: ModelRole[];
13
13
  export declare const KIND_ROLE_IDS: ModelRole[];
@@ -10,6 +10,8 @@ import type { State } from "./types.js";
10
10
  export interface OutputBlockOptions {
11
11
  header?: string;
12
12
  headerMeta?: string;
13
+ /** Facts drawn inside the bottom border (`╰── Wall 0.16s · Timeout 300s ──╯`). */
14
+ footerMeta?: string;
13
15
  state?: State;
14
16
  sections?: Array<{
15
17
  label?: string;
@@ -22,6 +22,8 @@ export interface ToolCardSnapshot {
22
22
  /** Structured status header, rendered by the shared status-line primitive. */
23
23
  status?: StatusLineOptions;
24
24
  headerMeta?: string;
25
+ /** Short facts drawn inside the frame's bottom border (framed); a trailing row otherwise. */
26
+ footerMeta?: string;
25
27
  phase?: ToolCardPhase;
26
28
  body?: ToolCardContent;
27
29
  sections?: readonly ToolCardSection[];
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Give an empty first band an explicit transparent width. Zellij derives the
3
+ * decoded image width from its first pixel row, ignoring the raster minimum
4
+ * for transparent images; an omitted band otherwise makes the image invisible.
5
+ * Palette definitions stay before drawing so cropping can still parse them.
6
+ */
7
+ export declare function ensureSixelRasterWidth(sequence: string): string;
8
+ /**
9
+ * Crop integer pixel rows from a raw (not tmux-wrapped) SIXEL DCS image.
10
+ * Runs are shifted between adjacent six-pixel bands, never decoded to pixels.
11
+ * Palette selections, overdraw order, transparent gaps and DCS background mode
12
+ * are retained. A nonpositive crop returns the original sequence unchanged.
13
+ *
14
+ * The supported grammar is the native icy_sixel encoder's: one leading raster
15
+ * declaration with positive dimensions and square pixels, prefix RGB/HLS palette
16
+ * definitions, register selections, sixel characters, repeats, `$` and `-`.
17
+ * ESC DCS/ST framing only, as the TUI emits it. Palette definitions after
18
+ * drawing, additional raster declarations, other controls and malformed input
19
+ * throw; forwarding an unsupported image uncropped would reintroduce raster
20
+ * overflow.
21
+ *
22
+ * Without maxHeightPixels the crop is exact, including a partial final band with
23
+ * zero padding bits and the exact declared raster height. Some terminals still
24
+ * allocate all six rows of that final band. The TUI supplies its available pixel
25
+ * height to cap the result at a whole-band boundary, matching the native encoder's
26
+ * policy of dropping bottom pixels rather than overwriting the following row.
27
+ */
28
+ export declare function cropSixelTop(sequence: string, pixels: number, maxHeightPixels?: number): string;
@@ -1,6 +1,7 @@
1
1
  import type { AgentMessage, ThinkingLevel } from "@linxiraos/pi-agent-core";
2
2
  import type { Tool, UsageLimit, UsageReport } from "@linxiraos/pi-ai";
3
3
  import type { Model } from "@linxiraos/pi-catalog/types";
4
+ import type { JobWidgetEntry } from "../tools/job-widget.js";
4
5
  import type { CompactionBoundaries } from "./context-usage.js";
5
6
  import type { StatusLineSettings, StatusResetExpiry } from "./types.js";
6
7
  export interface StatusAccountIdentity {
@@ -74,6 +75,8 @@ export interface StatusLineSession {
74
75
  agentId?: string;
75
76
  }[];
76
77
  } | null | undefined;
78
+ /** Widgets of the running background jobs, in job order; the jobs segment appends the freshest one's glance. */
79
+ getRunningJobWidgets?(): readonly JobWidgetEntry[];
77
80
  getGoalModeState(): {
78
81
  goal?: {
79
82
  status: string;
@@ -401,6 +401,11 @@ export declare function encodeITerm2(base64Data: string, options?: {
401
401
  preserveAspectRatio?: boolean;
402
402
  inline?: boolean;
403
403
  }): string;
404
+ /**
405
+ * The encoded image `encodeITerm2` wrote into `line`, without the size
406
+ * parameters a rewrap changes; undefined for a line without one.
407
+ */
408
+ export declare function iterm2ImagePayload(line: string): string | undefined;
404
409
  export declare function calculateImageRows(imageDimensions: ImageDimensions, targetWidthCells: number, cellDimensions?: CellDimensions): number;
405
410
  export declare function getPngDimensions(base64Data: string): ImageDimensions | null;
406
411
  export declare function getJpegDimensions(base64Data: string): ImageDimensions | null;
@@ -117,6 +117,7 @@ export declare function createShellRenderer<TArgs>(config: ShellRendererConfig<T
117
117
  }, args?: TArgs): NativeToolView;
118
118
  mergeCallAndResult: true;
119
119
  inline: true;
120
+ tickElapsed: true;
120
121
  };
121
122
  /** Renders bash command previews and output. */
122
123
  export declare const bashToolRenderer: {
@@ -146,4 +147,5 @@ export declare const bashToolRenderer: {
146
147
  }, args?: BashRenderArgs | undefined): NativeToolView;
147
148
  mergeCallAndResult: true;
148
149
  inline: true;
150
+ tickElapsed: true;
149
151
  };
@@ -23,6 +23,9 @@ export declare function formatDefaultToolExecution(input: DefaultToolRenderInput
23
23
  /**
24
24
  * TSP view of the generic fallback card: the tool label with a one-line args
25
25
  * summary as the head target; the result as a JSON tree or raw `ansi` output.
26
+ * The complete output goes over the wire — the card-level disclosure clamp the
27
+ * terminal applies is the only bound, so an expanded card keeps every row. JSON
28
+ * the tree's depth, node or scalar caps would cut keeps the raw path instead.
26
29
  */
27
30
  export declare function describeDefaultToolExecution(input: DefaultToolRenderInput): NativeToolView;
28
31
  /** Render the generic fallback as the state-tinted card used by direct custom tools. */
@@ -61,7 +61,7 @@ export interface EvalCellResult {
61
61
  durationMs?: number;
62
62
  exitCode?: number;
63
63
  statusEvents?: EvalStatusEvent[];
64
- /** Discrete events dropped from the front of `statusEvents` (see {@link recordStatusEvent}). */
64
+ /** Evictable events dropped from the front of `statusEvents` (see {@link recordStatusEvent}). */
65
65
  statusEventsElided?: number;
66
66
  }
67
67
  /** Tool result detail object surfaced to the UI/transcript. */
@@ -69,7 +69,7 @@ export interface EvalToolDetails {
69
69
  cells?: EvalCellResult[];
70
70
  images?: ImageContent[];
71
71
  statusEvents?: EvalStatusEvent[];
72
- /** Discrete events dropped from the front of `statusEvents` (see {@link recordStatusEvent}). */
72
+ /** Evictable events dropped from the front of `statusEvents` (see {@link recordStatusEvent}). */
73
73
  statusEventsElided?: number;
74
74
  isError?: boolean;
75
75
  meta?: OutputMeta;
@@ -104,7 +104,7 @@ interface EvalRenderContext {
104
104
  timeout?: number;
105
105
  }
106
106
  /**
107
- * Coalescing key of a progress-snapshot event: `agent` and `judge_batch`
107
+ * Coalescing key of a progress-snapshot event: `agent`, `judge_batch`, and `mcp_progress`
108
108
  * events keyed by `id`, where only the newest snapshot matters. Discrete
109
109
  * actions (everything else) have no key. Shared by {@link upsertStatusEvent}
110
110
  * and the executors' display collectors so both coalesce identically.
@@ -114,12 +114,12 @@ export declare function statusEventKey(event: {
114
114
  [key: string]: unknown;
115
115
  }): string | undefined;
116
116
  /**
117
- * Discrete status events a log keeps. A cell polling a helper in a loop emits
117
+ * Evictable status events a log keeps. A cell polling a helper in a loop emits
118
118
  * one event per call (hundreds of thousands), and every live update and the
119
119
  * persisted tool result would otherwise carry them all.
120
120
  */
121
121
  export declare const MAX_STATUS_EVENTS = 200;
122
- /** A status event list plus the count of discrete events dropped from its front. */
122
+ /** A status event list plus the count of evictable events dropped from its front. */
123
123
  export type StatusEventLog = Pick<EvalCellResult, "statusEvents" | "statusEventsElided">;
124
124
  /**
125
125
  * Append or replace a status event. Progress snapshots (see
@@ -129,9 +129,10 @@ export type StatusEventLog = Pick<EvalCellResult, "statusEvents" | "statusEvents
129
129
  export declare function upsertStatusEvent(events: EvalStatusEvent[], event: EvalStatusEvent): void;
130
130
  /**
131
131
  * {@link upsertStatusEvent} into a bounded log. Past {@link MAX_STATUS_EVENTS},
132
- * the oldest discrete event is dropped and counted. Snapshots stay, since agent
133
- * cards read them, and so does the newest committed `todo` result, which the
134
- * session todo panel refreshes from. Renderers already show only the newest
132
+ * the oldest discrete event or MCP progress snapshot is dropped and counted.
133
+ * Agent/judgment-batch snapshots stay, since agent cards read them, and so does
134
+ * the newest committed `todo` result, which the session todo panel refreshes
135
+ * from. Renderers already show only the newest
135
136
  * events behind an "… N earlier" row.
136
137
  */
137
138
  export declare function recordStatusEvent(log: StatusEventLog, event: EvalStatusEvent): void;
@@ -19,6 +19,12 @@ export interface IrcMessage {
19
19
  * ping-pong forever.
20
20
  */
21
21
  wakeRelay?: boolean;
22
+ /**
23
+ * One leg of an `all` broadcast. Like relays, broadcasts never draw an
24
+ * automatic wake-turn reply: every woken idle peer would otherwise answer
25
+ * the broadcaster, mostly to say the message was not for it.
26
+ */
27
+ broadcast?: boolean;
22
28
  }
23
29
  /** Delivery outcome for one peer recipient. */
24
30
  export interface IrcDeliveryReceipt {
@@ -0,0 +1,226 @@
1
+ /**
2
+ * Live widgets for background jobs: the rendered state of what a job is
3
+ * doing (a benchmark's requests/s over time, tests passed per model, CI jobs
4
+ * green so far), shown in the `wait` card, the HUD's jobs pill and the jobs
5
+ * sheet.
6
+ *
7
+ * A widget is data, not code. In coding-agent, a cheap model writes a
8
+ * `JobWidgetSpec` once per job (rules that pull numbers out of the job's
9
+ * output streams, and the blocks to draw them with); the job-widgets runtime
10
+ * then applies those rules to every new line and recomputes a
11
+ * {@link JobWidgetView}. Renderers here draw that view as TSP nodes (Tern) or
12
+ * ANSI lines, and never see a rule or a regex.
13
+ */
14
+ import type { TspPropNode, TspSpan, TspTone } from "@linxiraos/pi-wire";
15
+ import type { NativeNode } from "../native/node.js";
16
+ import type { Theme } from "../theme/theme.js";
17
+ /** Where a widget's view stands. */
18
+ export type JobWidgetState =
19
+ /** The cheap model is writing the spec; the view holds the model-free fallback meanwhile. */
20
+ "authoring"
21
+ /** The spec's rules drive the view. */
22
+ | "live"
23
+ /** No spec (no model, authoring failed, nothing to read yet): last line and rates only. */
24
+ | "fallback";
25
+ /** A formatted number with the direction it moved, for headlines and stats. */
26
+ export interface JobWidgetTrend {
27
+ /** `▲ 15%`, `▼ 3.2 ms`. */
28
+ text: string;
29
+ /** `success` when the move is toward `better`, `error` away from it, `muted` without a direction. */
30
+ tone: "success" | "error" | "muted";
31
+ }
32
+ /** The headline value: the one number a glance should take away (`186 tok/s`). */
33
+ export interface JobWidgetHeadline {
34
+ /** Formatted value with its unit. */
35
+ text: string;
36
+ /** What the value is, when the title does not already say it (`decode`, `p50`). */
37
+ label?: string;
38
+ trend?: JobWidgetTrend;
39
+ }
40
+ /** A time series drawn as columns, newest right, with optional reference lines. */
41
+ export interface JobWidgetSparkBlock {
42
+ kind: "spark";
43
+ /** What the series measures (`tok/s · nvfp4 b1`). */
44
+ label: string;
45
+ /** At most 48 values, oldest first, already downsampled. */
46
+ values: number[];
47
+ /** Domain of the chart; covers the values and every mark. */
48
+ min: number;
49
+ max: number;
50
+ /** Horizontal reference lines in value units (a target, a baseline). */
51
+ marks?: {
52
+ value: number;
53
+ label: string;
54
+ tone?: TspTone;
55
+ }[];
56
+ /** Latest value, formatted (`186 tok/s`). */
57
+ last: string;
58
+ /** Per-point tooltip text, same length as `values` (`12:04:31 · 186 tok/s`). */
59
+ tips?: string[];
60
+ tone?: TspTone;
61
+ }
62
+ /** One bar per key (a model, a shard): a value against a common maximum. */
63
+ export interface JobWidgetBarsBlock {
64
+ kind: "bars";
65
+ label: string;
66
+ items: {
67
+ label: string;
68
+ value: number;
69
+ text: string;
70
+ tone?: TspTone;
71
+ }[];
72
+ /** The value a full bar stands for. */
73
+ max: number;
74
+ }
75
+ /** Progress of a countable whole (`7/9 trials`). */
76
+ export interface JobWidgetMeterBlock {
77
+ kind: "meter";
78
+ label: string;
79
+ /** 0–1. */
80
+ value: number;
81
+ /** `7/9 trials`. */
82
+ text: string;
83
+ tone?: TspTone;
84
+ }
85
+ /** A few labelled numbers on one line (`p50 41 ms · p99 212 ms · errors 0`). */
86
+ export interface JobWidgetStatBlock {
87
+ kind: "stat";
88
+ items: {
89
+ label: string;
90
+ text: string;
91
+ tone?: TspTone;
92
+ trend?: JobWidgetTrend;
93
+ }[];
94
+ }
95
+ /** One cell per key with its latest state (CI jobs, shards, workers). */
96
+ export interface JobWidgetGridBlock {
97
+ kind: "grid";
98
+ label: string;
99
+ items: {
100
+ label: string;
101
+ text: string;
102
+ tone: TspTone;
103
+ }[];
104
+ }
105
+ /** The latest line a rule captured (the test now running, the current phase). */
106
+ export interface JobWidgetTextBlock {
107
+ kind: "text";
108
+ text: string;
109
+ }
110
+ export type JobWidgetBlock = JobWidgetSparkBlock | JobWidgetBarsBlock | JobWidgetMeterBlock | JobWidgetStatBlock | JobWidgetGridBlock | JobWidgetTextBlock;
111
+ /**
112
+ * Everything a renderer needs to draw one job's widget. Plain JSON: it rides
113
+ * on `JobSnapshot.widget` through `wait` progress updates and is persisted
114
+ * with the final `wait` result, so a sealed card redraws the last state after
115
+ * a session reload.
116
+ */
117
+ export interface JobWidgetView {
118
+ /** Short name of what is being watched (`verb-bench · 3 models`). */
119
+ title: string;
120
+ headline?: JobWidgetHeadline;
121
+ /** What the job is doing now: a subagent's stage, or the last line of output. */
122
+ stage?: string;
123
+ /** Top to bottom; the first block is the primary one, and compact views show only it. */
124
+ blocks: JobWidgetBlock[];
125
+ state: JobWidgetState;
126
+ /** Epoch ms of the newest data the view reflects. */
127
+ updatedAt: number;
128
+ }
129
+ /** A running job's widget, as the HUD and the status line list them. */
130
+ export interface JobWidgetEntry {
131
+ id: string;
132
+ type: JobTileType;
133
+ view: JobWidgetView;
134
+ }
135
+ /** What a glance at a widget reads: its headline, else the primary figure of its blocks. */
136
+ export interface JobWidgetGlance {
137
+ text: string;
138
+ label?: string;
139
+ trend?: JobWidgetTrend;
140
+ }
141
+ /** What one glance at the widget reads: the headline, else the latest figure of its first spark or meter. */
142
+ export declare function jobWidgetGlance(view: JobWidgetView): JobWidgetGlance | undefined;
143
+ /** The widget's first spark cut to its newest `points` values (the HUD's mini chart); undefined without data. */
144
+ export declare function jobWidgetSpark(view: JobWidgetView, points?: number): JobWidgetSparkBlock | undefined;
145
+ /** The entry whose live widget (one a spec drives) saw data last. */
146
+ export declare function latestJobWidget<T extends JobWidgetEntry>(entries: readonly T[]): T | undefined;
147
+ /** The widget as one plain line for tooltips: `verb-bench · 3 models — decode 186 tok/s ▲ 15%`. */
148
+ export declare function jobWidgetSummary(view: JobWidgetView): string;
149
+ /** Spans of a glance: muted label, strong number, toned trend. */
150
+ export declare function jobWidgetGlanceSpans(glance: JobWidgetGlance): TspSpan[];
151
+ /**
152
+ * A glance for the ANSI status line: the figure with its trend, then a
153
+ * `cells`-wide sparkline of the primary spark when there is one.
154
+ */
155
+ export declare function formatJobWidgetGlance(view: JobWidgetView, theme: Theme, cells?: number): string;
156
+ /**
157
+ * A job's whole widget as a TSP subtree (role `zeta.job.widget`), as the jobs
158
+ * sheet details it: a head row (title, stage, headline) over every block.
159
+ */
160
+ export declare function describeJobWidget(view: JobWidgetView): NativeNode;
161
+ /**
162
+ * The HUD jobs pill's hover card: up to four running jobs as tiles, then a
163
+ * count of the rest; undefined without widgets. Its tiles carry no clock:
164
+ * Tern draws the card only once hovered, and a clock drawn then would start
165
+ * from the last time the program wrote.
166
+ */
167
+ export declare function describeJobWidgetsHovercard(entries: readonly JobWidgetEntry[]): TspPropNode | undefined;
168
+ /** The HUD's mini chart: the newest values of the widget's first spark; undefined without one. */
169
+ export declare function describeJobWidgetMiniSpark(view: JobWidgetView): NativeNode | undefined;
170
+ /** Where a tiled job stands. */
171
+ export type JobTileStatus = "running" | "completed" | "failed" | "cancelled";
172
+ /** What kind of job a tile shows: a subagent (`task`) goes by its name, any other job by what it runs. */
173
+ export type JobTileType = "bash" | "task" | "eval";
174
+ /** One job as a tile draws it: who it is, how long it has run, and its widget when it has one. */
175
+ export interface JobTile {
176
+ id: string;
177
+ type: JobTileType;
178
+ status: JobTileStatus;
179
+ /** The job's label (a command): the title of a job that is no subagent, before a widget names it. */
180
+ label: string;
181
+ /** How long the job has run; a tile without it shows no clock. */
182
+ durationMs?: number;
183
+ /** Whether the job is live (its dot pulses, its clock runs); settled and sealed tiles freeze. */
184
+ live: boolean;
185
+ /** The job's widget; only a live one (a spec drives it) draws figures and charts, any lends its stage. */
186
+ widget?: JobWidgetView;
187
+ /** A task's own completion estimate (0–100), drawn as a ring. */
188
+ completionPercent?: number;
189
+ /** What the job is doing now, when its widget names nothing: a task's stage in its own words. */
190
+ stage?: string;
191
+ exitCode?: number;
192
+ }
193
+ /**
194
+ * Jobs as one frame of equal tiles (role `zeta.job.tiles`) that wraps onto
195
+ * more rows when the frame runs out of width.
196
+ */
197
+ export declare function describeJobTiles(tiles: readonly JobTile[]): NativeNode;
198
+ /**
199
+ * One job as a tile (role `zeta.job.tile`): a head line (status, name, id,
200
+ * a task's own completion estimate as a ring, clock), then what a live
201
+ * widget shows (the figure a glance takes away, its primary block, quiet
202
+ * lines of stats) and the stage. With nothing to chart, the stage is the
203
+ * tile's body.
204
+ */
205
+ export declare function describeJobTile(tile: JobTile): NativeNode;
206
+ /**
207
+ * A job's whole widget as terminal lines, each within `width` (capped at 80
208
+ * so bars stay next to their labels): the head line (title, stage, headline
209
+ * at the right), then every block under a shared label column.
210
+ */
211
+ export declare function renderJobWidgetLines(view: JobWidgetView, width: number, theme: Theme): string[];
212
+ /** How the ANSI wait card draws a tile. */
213
+ export interface JobTileLineOptions {
214
+ /** Opens the title line: the caller's status icon and type badge. */
215
+ lead: string;
216
+ /** Closes the title line at the right, after the figure: the duration. */
217
+ meta: string;
218
+ /** Every block rather than the primary one alone (an expanded card). */
219
+ full?: boolean;
220
+ }
221
+ /**
222
+ * A tile as terminal lines within `width`: the lead, name and id with the
223
+ * figure and meta at the right, then a live widget's primary block (every
224
+ * block when `full`) and dim lines of stats and stage, capped at 80 cells.
225
+ */
226
+ export declare function renderJobTileLines(tile: JobTile, width: number, theme: Theme, options: JobTileLineOptions): string[];
@@ -70,6 +70,8 @@ export interface JsonTreeDescribeOptions {
70
70
  openDepth?: number;
71
71
  /** Root object keys omitted. Defaults to internal tool argument metadata. */
72
72
  hiddenRootKeys?: readonly string[];
73
+ /** Called after the tree is built if a depth, node or scalar cap left part of the value out. */
74
+ onTruncated?: () => void;
73
75
  }
74
76
  /**
75
77
  * TSP `tree` of a JSON value: containers become expandable nodes labelled with
@@ -10,12 +10,19 @@ export interface LineRange {
10
10
  export declare const LINE_RANGE_CHUNK_SOURCE: string;
11
11
  /** Parse a single `N`, `N-M`, `N-`, `N+K`, or `..`-aliased (`N..M`, `N..`) chunk. Throws via {@link ToolError} on invalid bounds. */
12
12
  export declare function parseLineRangeChunk(sel: string): LineRange | null;
13
+ /** What a bare `N` selects in a one-chunk list: lines `N` onward (`:50`), or the single line `N`. */
14
+ export type BareLineMode = "onward" | "single";
13
15
  /**
14
16
  * Parse a comma-separated list of line ranges (e.g. `5-16,960-973` or `19,59`). Returns
15
17
  * the ranges in ascending order with overlapping/adjacent ranges merged so
16
18
  * downstream consumers can stream the file in a single forward pass per range.
17
19
  */
18
- export declare function parseLineRanges(sel: string): [LineRange, ...LineRange[]] | null;
20
+ export declare function parseLineRanges(sel: string, bare?: BareLineMode): [LineRange, ...LineRange[]] | null;
21
+ /**
22
+ * Sort non-empty `ranges` by start line and merge the ones that overlap or touch;
23
+ * an open-ended range (`endLine` undefined) reaches EOF and absorbs every later one.
24
+ */
25
+ export declare function mergeLineRanges(ranges: readonly LineRange[]): [LineRange, ...LineRange[]];
19
26
  /**
20
27
  * Extract the line-range component from a read-tool selector that may also
21
28
  * carry a verbatim/index display mode (`raw`, `conflicts`) — alone or compounded
@@ -63,6 +63,27 @@ export interface MCPResourceContent {
63
63
  }
64
64
  /** Supported MCP result content blocks retained in display metadata. */
65
65
  export type MCPContent = MCPTextContent | MCPImageContent | MCPResourceContent;
66
+ /** Server-reported progress of an in-flight MCP request. */
67
+ export interface MCPProgress {
68
+ progress: number;
69
+ total?: number;
70
+ message?: string;
71
+ }
72
+ /**
73
+ * Read MCP progress fields from an untrusted record: `progress` must be a
74
+ * finite number; `total` is kept only when finite and `message` only when a
75
+ * string. Shared by the transports, the Eval bridge, and the status renderer.
76
+ */
77
+ export declare function parseMCPProgress(value: unknown): MCPProgress | undefined;
78
+ /**
79
+ * One-line display text for MCP progress, at most `maxWidth` cells: the
80
+ * message, with `progress/total` when the server reports a total. The bare
81
+ * progress value appears only when there is no message: without a total it is
82
+ * an opaque counter, not a percentage. Home paths in the message show as `~`,
83
+ * and a long message is cut before the count, so the count stays visible.
84
+ * Every progress display (tool card and both Eval status renderers) uses it.
85
+ */
86
+ export declare function formatMCPProgress(progress: MCPProgress, maxWidth?: number): string;
66
87
  /** MCP result details shared by renderers and programmatic tool consumers. */
67
88
  export interface MCPToolDetails {
68
89
  /** Server name */
@@ -81,6 +102,8 @@ export interface MCPToolDetails {
81
102
  provider?: string;
82
103
  /** Provider display name (e.g., "Claude Code", "MCP Config") */
83
104
  providerName?: string;
105
+ /** Latest progress of a running call; present only on partial updates. */
106
+ progress?: MCPProgress;
84
107
  /** Structured output metadata (set by the spill wrapper when output is truncated to an artifact). */
85
108
  meta?: OutputMeta;
86
109
  }
@@ -110,7 +110,7 @@ export interface OutputMeta {
110
110
  /** Capture failure of this output itself; aggregate reports keep source failures on their entries. */
111
111
  artifactError?: OutputArtifactError;
112
112
  source?: SourceMeta;
113
- /** The output is a bounded page of session artifact storage its `source` re-reads with line selectors; spill-to-artifact skips it. */
113
+ /** The output is a bounded page of a file or session artifact its `source` re-reads with line selectors; spill-to-artifact skips it. */
114
114
  pagedSource?: true;
115
115
  diagnostics?: DiagnosticMeta;
116
116
  limits?: LimitsMeta;
@@ -71,8 +71,14 @@ export interface ReadToolDetails {
71
71
  */
72
72
  displayReadTargetLinks?: Array<string | null>;
73
73
  }
74
- /** Split a filesystem path from its trailing read selector. */
75
- export declare function splitPathAndSel(rawPath: string): {
74
+ /**
75
+ * Split a filesystem path from its trailing read selector. `foldListColons: false`
76
+ * keeps a colon repeated inside a list as part of the path (`a:1-30,:-30` peels
77
+ * only `:-30`), for callers checking whether that shorter split names a real file.
78
+ */
79
+ export declare function splitPathAndSel(rawPath: string, options?: {
80
+ foldListColons?: boolean;
81
+ }): {
76
82
  path: string;
77
83
  sel?: string;
78
84
  };
@@ -27,8 +27,9 @@ export interface RenderResultOptions {
27
27
  executionStarted?: boolean;
28
28
  /**
29
29
  * Milliseconds since this call began executing (`tool_execution_start`),
30
- * or its total once settled; undefined before it starts. Native describe
31
- * hooks only.
30
+ * or its total once settled; undefined before it starts. The terminal
31
+ * transcript's options object computes it on read, so a render-time read
32
+ * is live while the block's spinner ticks.
32
33
  */
33
34
  elapsedMs?: number;
34
35
  /** The call was abandoned without a final result (turn aborted, sealed). Native describe hooks only. */
@@ -177,6 +178,11 @@ export interface ToolRenderer<TArgs = unknown, TDetails = unknown> {
177
178
  * `options.spinnerFrame`.
178
179
  */
179
180
  animatedPartialResult?: boolean | ((args: TArgs) => boolean);
181
+ /**
182
+ * Repaint the block once a second while its call executes, for renderers
183
+ * that show live `options.elapsedMs` without consuming the spinner frame.
184
+ */
185
+ tickElapsed?: boolean;
180
186
  /**
181
187
  * Whether replacing a pending call render with the first result requires a
182
188
  * full viewport repaint. Use for merged renderers whose pending rows can be
@@ -16,5 +16,5 @@ export interface CardToolResult {
16
16
  export declare function firstText(result: CardToolResult): string;
17
17
  /** Sanitize one display line: tabs become spaces, carriage returns are dropped. */
18
18
  export declare function safe(value: string): string;
19
- /** Padded card whose lines are sanitized and truncated, re-rendered when the expanded state flips. */
19
+ /** Card whose lines are sanitized and truncated, re-rendered when the expanded state flips. */
20
20
  export declare function card(lines: (width: number, expanded: boolean) => string[], options: RenderResultOptions): Component;
@@ -261,6 +261,7 @@ export declare class OutputSink {
261
261
  * Replace the in-memory buffer with the given text. Used when an upstream
262
262
  * minimizer rewrites the captured output after the raw bytes have already
263
263
  * been streamed.
264
+ * The replacement is held to the per-line column cap like streamed output.
264
265
  *
265
266
  * After this call the buffer is authoritative: streaming counters realign
266
267
  * to the replacement, the retained head window is cleared, and head
@@ -264,6 +264,18 @@ export interface AgentProgress {
264
264
  advisor?: boolean;
265
265
  /** The agent's latest self-estimate of task completion (0–100), from the periodic `task.completionProbe` side request. */
266
266
  completionPercent?: number;
267
+ /**
268
+ * The agent's current step in its own words (one line, ≤ 80 chars), from the
269
+ * same probe reply as {@link completionPercent}. Running rows prefer it over
270
+ * `lastIntent`; the job widget uses it as its stage line.
271
+ */
272
+ stage?: string;
273
+ /**
274
+ * What the agent says shows its progress live (one line, ≤ 200 chars), e.g.
275
+ * "BENCH lines in bg_2 pipe:1, tok_s higher is better, target 70% of roofline";
276
+ * from the probe reply. Feeds the job widget author's brief; never rendered.
277
+ */
278
+ watch?: string;
267
279
  /** Data extracted by registered subprocess tool handlers (keyed by tool name) */
268
280
  extractedToolData?: Record<string, unknown[]>;
269
281
  /**
@@ -3,6 +3,7 @@ import type { Theme } from "../theme/theme.js";
3
3
  import { type OutputMeta } from "./output-meta.js";
4
4
  import { type ConfiguredThinkingLevel } from "../render/render-utils.js";
5
5
  import type { StructuredSubagentOutput } from "./task.js";
6
+ import { type JobWidgetView } from "./job-widget.js";
6
7
  import type { RenderResultOptions, ToolActivitySummary } from "./renderer.js";
7
8
  import type { IrcDeliveryReceipt, IrcMessage } from "./irc.js";
8
9
  import type { NativeToolView, ToolRenderResult } from "./renderer.js";
@@ -29,6 +30,10 @@ export interface JobSnapshot {
29
30
  advisor?: boolean;
30
31
  /** The task agent's latest self-estimated completion (0–100); see `AgentProgress.completionPercent`. */
31
32
  completionPercent?: number;
33
+ /** The task agent's latest stage in its own words; see `AgentProgress.stage`. */
34
+ stage?: string;
35
+ /** The job's live widget, while one is being drawn; frozen at its last state once the job settles. */
36
+ widget?: JobWidgetView;
32
37
  resultText?: string;
33
38
  errorText?: string;
34
39
  /** Source-output metadata retained for per-job warnings and persisted row rendering. */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@linxiraos/pi-tui",
4
- "version": "1.4.0",
4
+ "version": "1.4.1",
5
5
  "description": "Terminal User Interface library with differential rendering for efficient text-based applications",
6
6
  "homepage": "https://linxira-os.github.io/zeta/",
7
7
  "author": "Linxira-OS",
@@ -38,14 +38,14 @@
38
38
  "gen:glyphs": "bun scripts/gen-glyphs.ts"
39
39
  },
40
40
  "dependencies": {
41
- "@linxiraos/pi-omptype": "1.4.0",
42
- "@linxiraos/pi-agent-core": "1.4.0",
43
- "@linxiraos/pi-ai": "1.4.0",
44
- "@linxiraos/pi-catalog": "1.4.0",
45
- "@linxiraos/pi-natives": "1.4.0",
46
- "@linxiraos/pi-utils": "1.4.0",
47
- "@linxiraos/pi-wire": "1.4.0",
48
- "@linxiraos/pi-snapcompact": "1.4.0"
41
+ "@linxiraos/pi-omptype": "1.4.1",
42
+ "@linxiraos/pi-agent-core": "1.4.1",
43
+ "@linxiraos/pi-ai": "1.4.1",
44
+ "@linxiraos/pi-catalog": "1.4.1",
45
+ "@linxiraos/pi-natives": "1.4.1",
46
+ "@linxiraos/pi-utils": "1.4.1",
47
+ "@linxiraos/pi-wire": "1.4.1",
48
+ "@linxiraos/pi-snapcompact": "1.4.1"
49
49
  },
50
50
  "devDependencies": {
51
51
  "kitty-vt-wasm": "^0.2.0"