nexrall-code 0.5.201 → 0.5.203

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 (2) hide show
  1. package/dist/index.js +27 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -79764,6 +79764,9 @@ function statusColor(status) {
79764
79764
  }
79765
79765
  var TERMINAL = /* @__PURE__ */ new Set(["done", "failed", "stopped"]);
79766
79766
  var sleep = (ms) => new Promise((r2) => setTimeout(r2, ms));
79767
+ var writeRaw = (s2) => {
79768
+ process.stdout.write(s2);
79769
+ };
79767
79770
  function openUrl(url) {
79768
79771
  const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
79769
79772
  const args = process.platform === "win32" ? ["/c", "start", "", url] : [url];
@@ -79775,11 +79778,14 @@ function openUrl(url) {
79775
79778
  } catch {
79776
79779
  }
79777
79780
  }
79781
+ function fmtCostUsd(cost) {
79782
+ return `$${cost < 0.01 ? cost.toFixed(4) : cost.toFixed(2)}`;
79783
+ }
79778
79784
  function deliverableBits(s2) {
79779
79785
  const bits = [
79780
79786
  s2.branch ? `branch ${s2.branch}` : "",
79781
79787
  s2.prUrl ?? "",
79782
- s2.costUsd != null ? `$${s2.costUsd.toFixed(2)}` : ""
79788
+ s2.costUsd != null ? fmtCostUsd(s2.costUsd) : ""
79783
79789
  ].filter(Boolean);
79784
79790
  return bits.join(" \xB7 ");
79785
79791
  }
@@ -79845,22 +79851,38 @@ async function cloudLogsCommand(id, opts) {
79845
79851
  console.log(JSON.stringify(r2, null, 2));
79846
79852
  return;
79847
79853
  }
79854
+ if (r2.note) {
79855
+ console.log(paint.dim(` ${r2.note}`));
79856
+ }
79848
79857
  if (r2.log) {
79849
79858
  console.log(r2.log.endsWith("\n") ? r2.log.slice(0, -1) : r2.log);
79850
- } else {
79851
- console.log(paint.dim(` ${r2.note ?? "No log available."}`));
79859
+ } else if (!r2.note) {
79860
+ console.log(paint.dim(" No log available."));
79852
79861
  }
79853
79862
  return;
79854
79863
  }
79855
79864
  let prev = "";
79856
79865
  let lastStatus = "";
79857
79866
  let printedGapNote = false;
79867
+ let consecutiveErrors = 0;
79868
+ const MAX_CONSECUTIVE_ERRORS = 60;
79858
79869
  for (; ; ) {
79859
79870
  let r2;
79860
79871
  try {
79861
79872
  r2 = await (0, import_code_core5.getCloudSessionLogs)(id, tail ?? 1e3);
79873
+ consecutiveErrors = 0;
79862
79874
  } catch (e2) {
79863
- return fail2(errText2(e2));
79875
+ const msg = errText2(e2);
79876
+ if (/not found/i.test(msg))
79877
+ return fail2(msg);
79878
+ consecutiveErrors++;
79879
+ if (consecutiveErrors === 1)
79880
+ console.log(paint.dim(` Waiting for pod logs\u2026 (${msg})`));
79881
+ if (consecutiveErrors > MAX_CONSECUTIVE_ERRORS) {
79882
+ return fail2(`Gave up after ${consecutiveErrors} failed polls: ${msg}`);
79883
+ }
79884
+ await sleep(2e3);
79885
+ continue;
79864
79886
  }
79865
79887
  const s2 = r2.session;
79866
79888
  if (s2.status !== lastStatus) {
@@ -79872,7 +79894,7 @@ async function cloudLogsCommand(id, opts) {
79872
79894
  if (text.length < prev.length)
79873
79895
  prev = "";
79874
79896
  if (text.length > prev.length) {
79875
- process.stdout.write(text.slice(prev.length));
79897
+ writeRaw(text.slice(prev.length));
79876
79898
  prev = text;
79877
79899
  }
79878
79900
  } else if (TERMINAL.has(s2.status) && !printedGapNote && !prev) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexrall-code",
3
- "version": "0.5.201",
3
+ "version": "0.5.203",
4
4
  "description": "Nexrall Code \u2014 AI coding assistant for your terminal (headless agent for scripts, CI and automation)",
5
5
  "keywords": [
6
6
  "ai",