@youdie006/prodex 0.27.2 → 0.27.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tui-run.js CHANGED
@@ -7,7 +7,7 @@
7
7
  * what keeps the interactive path from drifting away from the documented flags.
8
8
  */
9
9
  import readline from "node:readline";
10
- import { consultArgsFromChoices, moveCursor, renderContextPanel, renderProgressBar, renderSelectList, toggleSelection } from "./tui.js";
10
+ import { consultArgsFromChoices, moveCursor, progressLabel, renderContextPanel, renderProgressBar, renderSelectList, toggleSelection } from "./tui.js";
11
11
  const ESC = "";
12
12
  const CLEAR = `${ESC}[2J${ESC}[H`;
13
13
  // The alternate screen buffer: the terminal comes back exactly as it was, so a
@@ -272,7 +272,7 @@ export async function runInteractiveConsult(io, deps) {
272
272
  }, 250);
273
273
  try {
274
274
  const code = await deps.runConsult(args, (line) => {
275
- label = line.replace(/^progress:\s*/, "").slice(0, 60);
275
+ label = progressLabel(line).slice(0, 60);
276
276
  });
277
277
  clearInterval(timer);
278
278
  io.write(CLEAR_LINE);
package/dist/tui.js CHANGED
@@ -115,6 +115,25 @@ function formatElapsed(ms) {
115
115
  const rest = seconds % 60;
116
116
  return rest === 0 ? `${minutes}m` : `${minutes}m ${rest}s`;
117
117
  }
118
+ /**
119
+ * Turn a `progress:` line from the send into the label beside the bar.
120
+ *
121
+ * The bar already carries the elapsed clock, so a label that opens with
122
+ * "waiting 2m 57s" prints the same number twice and pushes the part worth
123
+ * reading off to the right. Keep the detail, drop the duplicate.
124
+ */
125
+ export function progressLabel(line) {
126
+ const text = line.replace(/^progress:\s*/, "").trim();
127
+ const waiting = /^waiting\s+[0-9]+[a-z]*(?:\s+[0-9]+[a-z]*)*\s*(.*)$/i.exec(text);
128
+ if (!waiting)
129
+ return text;
130
+ const detail = waiting[1].trim();
131
+ if (detail.length === 0)
132
+ return "waiting";
133
+ // The send wraps its detail in parentheses; the bar reads better without them.
134
+ const unwrapped = /^\((.*)\)$/.exec(detail);
135
+ return (unwrapped ? unwrapped[1] : detail).trim();
136
+ }
118
137
  const SPINNER = ["|", "/", "-", "\\"];
119
138
  /**
120
139
  * A Pro consult can run for many minutes with nothing on screen. The bar fills
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@youdie006/prodex",
3
- "version": "0.27.2",
3
+ "version": "0.27.3",
4
4
  "description": "Local receipt bus for coordinating Codex execution with ChatGPT Pro/Projects consultation.",
5
5
  "author": "youdie006",
6
6
  "license": "MIT",