fleetlens 1.0.8 → 1.0.9

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 (54) hide show
  1. package/app/apps/web/.next/BUILD_ID +1 -1
  2. package/app/apps/web/.next/build-manifest.json +3 -3
  3. package/app/apps/web/.next/prerender-manifest.json +3 -3
  4. package/app/apps/web/.next/server/app/_global-error.html +1 -1
  5. package/app/apps/web/.next/server/app/_global-error.rsc +1 -1
  6. package/app/apps/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  7. package/app/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/app/apps/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  9. package/app/apps/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  10. package/app/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  11. package/app/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  12. package/app/apps/web/.next/server/app/agent/page_client-reference-manifest.js +1 -1
  13. package/app/apps/web/.next/server/app/changelog/page_client-reference-manifest.js +1 -1
  14. package/app/apps/web/.next/server/app/day/[date]/page_client-reference-manifest.js +1 -1
  15. package/app/apps/web/.next/server/app/day/page_client-reference-manifest.js +1 -1
  16. package/app/apps/web/.next/server/app/digest/[date]/page_client-reference-manifest.js +1 -1
  17. package/app/apps/web/.next/server/app/digest/page_client-reference-manifest.js +1 -1
  18. package/app/apps/web/.next/server/app/insights/[key]/page_client-reference-manifest.js +1 -1
  19. package/app/apps/web/.next/server/app/insights/page_client-reference-manifest.js +1 -1
  20. package/app/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
  21. package/app/apps/web/.next/server/app/parallelism/page_client-reference-manifest.js +1 -1
  22. package/app/apps/web/.next/server/app/print/[key]/page_client-reference-manifest.js +1 -1
  23. package/app/apps/web/.next/server/app/projects/[slug]/page_client-reference-manifest.js +1 -1
  24. package/app/apps/web/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  25. package/app/apps/web/.next/server/app/runs/page_client-reference-manifest.js +1 -1
  26. package/app/apps/web/.next/server/app/sessions/[id]/page_client-reference-manifest.js +1 -1
  27. package/app/apps/web/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  28. package/app/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  29. package/app/apps/web/.next/server/app/team/onboarding/page_client-reference-manifest.js +1 -1
  30. package/app/apps/web/.next/server/app/team/page_client-reference-manifest.js +1 -1
  31. package/app/apps/web/.next/server/app/usage/page_client-reference-manifest.js +1 -1
  32. package/app/apps/web/.next/server/chunks/[root-of-the-server]__02.51sr._.js +1 -1
  33. package/app/apps/web/.next/server/chunks/[root-of-the-server]__0zyh554._.js +1 -1
  34. package/app/apps/web/.next/server/chunks/ssr/_0k8yioi._.js +1 -1
  35. package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_changelog_ts_0n7_p1d._.js +1 -1
  36. package/app/apps/web/.next/server/chunks/ssr/apps_web_lib_changelog_ts_0nb5_-s._.js +1 -1
  37. package/app/apps/web/.next/server/middleware-build-manifest.js +3 -3
  38. package/app/apps/web/.next/server/middleware-manifest.json +5 -5
  39. package/app/apps/web/.next/server/pages/500.html +1 -1
  40. package/app/apps/web/.next/server/server-reference-manifest.js +1 -1
  41. package/app/apps/web/.next/server/server-reference-manifest.json +1 -1
  42. package/app/apps/web/.next/static/chunks/16ng0.1m2m026.js +1 -0
  43. package/app/apps/web/lib/changelog-data.generated.ts +1 -1
  44. package/app/apps/web/package.json +1 -1
  45. package/app/apps/web/tsconfig.tsbuildinfo +1 -1
  46. package/dist/daemon-worker.js +6 -6
  47. package/dist/index.js +158 -68
  48. package/menubar/Fleetlens.app/Contents/Info.plist +2 -2
  49. package/menubar/Fleetlens.app/Contents/MacOS/FleetlensMenubar +0 -0
  50. package/package.json +1 -1
  51. package/app/apps/web/.next/static/chunks/17s-kgtdv385l.js +0 -1
  52. /package/app/apps/web/.next/static/{qeUfJEEwWX-_kBAEMzh_M → vYFdh4rRszFyu8bKNXN4N}/_buildManifest.js +0 -0
  53. /package/app/apps/web/.next/static/{qeUfJEEwWX-_kBAEMzh_M → vYFdh4rRszFyu8bKNXN4N}/_clientMiddlewareManifest.js +0 -0
  54. /package/app/apps/web/.next/static/{qeUfJEEwWX-_kBAEMzh_M → vYFdh4rRszFyu8bKNXN4N}/_ssgManifest.js +0 -0
@@ -7014,9 +7014,9 @@ function onDiskVersion() {
7014
7014
  try {
7015
7015
  const here = dirname14(fileURLToPath(import.meta.url));
7016
7016
  const pkg = JSON.parse(readFileSync22(join14(here, "..", "package.json"), "utf8"));
7017
- return pkg.version ?? "1.0.8";
7017
+ return pkg.version ?? "1.0.9";
7018
7018
  } catch {
7019
- return "1.0.8";
7019
+ return "1.0.9";
7020
7020
  }
7021
7021
  }
7022
7022
  function getServerStatus() {
@@ -9369,7 +9369,7 @@ function buildIngestPayload(inputs) {
9369
9369
  return {
9370
9370
  ingestId: randomUUID(),
9371
9371
  observedAt: (/* @__PURE__ */ new Date()).toISOString(),
9372
- cliVersion: "1.0.8",
9372
+ cliVersion: "1.0.9",
9373
9373
  ...richRollup || inputs.enrichedExtras || inputs.artifactSignals ? { schemaVersion: RICH_ROLLUP_SCHEMA_VERSION } : {},
9374
9374
  ...inputs.rollup ? { dailyRollup: inputs.rollup } : {},
9375
9375
  ...richRollup ? { richRollup } : {},
@@ -18352,14 +18352,14 @@ async function getUpdateAvailability() {
18352
18352
  if (isDevMode()) return null;
18353
18353
  const latest = await fetchLatestVersion();
18354
18354
  if (latest === null) return {
18355
- current: "1.0.8",
18355
+ current: "1.0.9",
18356
18356
  latest: null,
18357
18357
  updateAvailable: false
18358
18358
  };
18359
18359
  return {
18360
- current: "1.0.8",
18360
+ current: "1.0.9",
18361
18361
  latest,
18362
- updateAvailable: shouldUpdate("1.0.8", latest)
18362
+ updateAvailable: shouldUpdate("1.0.9", latest)
18363
18363
  };
18364
18364
  }
18365
18365
 
package/dist/index.js CHANGED
@@ -6298,9 +6298,9 @@ function onDiskVersion() {
6298
6298
  try {
6299
6299
  const here = dirname3(fileURLToPath(import.meta.url));
6300
6300
  const pkg = JSON.parse(readFileSync5(join3(here, "..", "package.json"), "utf8"));
6301
- return pkg.version ?? "1.0.8";
6301
+ return pkg.version ?? "1.0.9";
6302
6302
  } catch {
6303
- return "1.0.8";
6303
+ return "1.0.9";
6304
6304
  }
6305
6305
  }
6306
6306
  function getServerStatus() {
@@ -6312,7 +6312,7 @@ function getServerStatus() {
6312
6312
  return { running: false };
6313
6313
  }
6314
6314
  function isServerStale(status2) {
6315
- return status2.running === true && status2.version !== "1.0.8";
6315
+ return status2.running === true && status2.version !== "1.0.9";
6316
6316
  }
6317
6317
  async function ensureCurrentServer(opts = {}) {
6318
6318
  const status2 = getServerStatus();
@@ -6828,9 +6828,9 @@ Installed: ${PACKAGE_NAME}@${verify.installedVersion} at ${verify.installedPath
6828
6828
  console.warn(
6829
6829
  ` \u2022 reinstall in the correct Node env: 'npm install -g ${PACKAGE_NAME}@latest'`
6830
6830
  );
6831
- } else if (verify.installedVersion !== "1.0.8") {
6831
+ } else if (verify.installedVersion !== "1.0.9") {
6832
6832
  console.log(
6833
- ` \u2192 This process is still running ${"1.0.8"}. Next invocation will use ${verify.installedVersion}.`
6833
+ ` \u2192 This process is still running ${"1.0.9"}. Next invocation will use ${verify.installedVersion}.`
6834
6834
  );
6835
6835
  }
6836
6836
  }
@@ -6865,14 +6865,14 @@ async function getUpdateAvailability() {
6865
6865
  if (isDevMode()) return null;
6866
6866
  const latest = await fetchLatestVersion();
6867
6867
  if (latest === null) return {
6868
- current: "1.0.8",
6868
+ current: "1.0.9",
6869
6869
  latest: null,
6870
6870
  updateAvailable: false
6871
6871
  };
6872
6872
  return {
6873
- current: "1.0.8",
6873
+ current: "1.0.9",
6874
6874
  latest,
6875
- updateAvailable: shouldUpdate("1.0.8", latest)
6875
+ updateAvailable: shouldUpdate("1.0.9", latest)
6876
6876
  };
6877
6877
  }
6878
6878
  async function checkForUpdate() {
@@ -6962,7 +6962,7 @@ async function restartServices(state) {
6962
6962
  }
6963
6963
  async function forceUpdate() {
6964
6964
  const latest = await fetchLatestVersion();
6965
- const current = "1.0.8";
6965
+ const current = "1.0.9";
6966
6966
  if (latest === null) {
6967
6967
  console.error("Could not reach npm registry. Check your network.");
6968
6968
  process.exit(1);
@@ -7383,7 +7383,7 @@ async function status() {
7383
7383
  }
7384
7384
  if (isServerStale(server)) {
7385
7385
  console.log(
7386
- ` \u26A0 serving stale ${ver} (CLI is ${"1.0.8"}) \u2014 run 'fleetlens start' to restart on the current version`
7386
+ ` \u26A0 serving stale ${ver} (CLI is ${"1.0.9"}) \u2014 run 'fleetlens start' to restart on the current version`
7387
7387
  );
7388
7388
  }
7389
7389
  } else {
@@ -8930,56 +8930,95 @@ var init_zai = __esm({
8930
8930
  });
8931
8931
 
8932
8932
  // src/usage/format.ts
8933
+ function barWidthFor(columns, labelWidth) {
8934
+ return Math.max(4, columns - labelWidth - 12);
8935
+ }
8936
+ function layoutForColumns(columns) {
8937
+ const cols = Number.isFinite(columns) && columns > 0 ? Math.floor(columns) : 80;
8938
+ if (cols < 36) {
8939
+ return {
8940
+ mode: "narrow",
8941
+ barWidth: 0,
8942
+ labelWidth: 4,
8943
+ shortLabels: true,
8944
+ columns: cols
8945
+ };
8946
+ }
8947
+ if (cols < 72) {
8948
+ const labelWidth2 = 4;
8949
+ return {
8950
+ mode: "medium",
8951
+ barWidth: barWidthFor(cols, labelWidth2),
8952
+ labelWidth: labelWidth2,
8953
+ shortLabels: true,
8954
+ columns: cols
8955
+ };
8956
+ }
8957
+ const labelWidth = 16;
8958
+ return {
8959
+ mode: "wide",
8960
+ barWidth: barWidthFor(cols, labelWidth),
8961
+ labelWidth,
8962
+ shortLabels: false,
8963
+ columns: cols
8964
+ };
8965
+ }
8966
+ function resolveColumns(explicit) {
8967
+ if (explicit !== void 0 && Number.isFinite(explicit) && explicit > 0) {
8968
+ return Math.floor(explicit);
8969
+ }
8970
+ const c = process.stdout.columns;
8971
+ if (typeof c === "number" && c > 0) return c;
8972
+ const env = parseInt(process.env.COLUMNS ?? "", 10);
8973
+ if (Number.isFinite(env) && env > 0) return env;
8974
+ return 80;
8975
+ }
8933
8976
  function formatMultiAgentUsage(byAgent, opts = {}) {
8934
8977
  const kinds = Object.keys(byAgent).sort(compareAgents);
8935
8978
  if (kinds.length === 0) return "";
8979
+ const layout = layoutForColumns(resolveColumns(opts.columns));
8936
8980
  const lines = [];
8937
8981
  lines.push("");
8938
8982
  if (opts.watch) {
8939
8983
  const sec = opts.intervalSec ?? 2;
8940
8984
  lines.push(
8941
- ` ${BOLD}Fleetlens Usage${RESET} ${DIM}live \xB7 every ${sec}s \xB7 Ctrl+C to quit${RESET}`
8985
+ layout.mode === "narrow" ? ` ${BOLD}Usage${RESET} ${DIM}live ${sec}s \xB7 ^C quit${RESET}` : ` ${BOLD}Fleetlens Usage${RESET} ${DIM}live \xB7 every ${sec}s \xB7 Ctrl+C to quit${RESET}`
8942
8986
  );
8943
8987
  } else {
8944
- lines.push(` ${BOLD}Fleetlens Usage${RESET}`);
8988
+ lines.push(
8989
+ layout.mode === "narrow" ? ` ${BOLD}Usage${RESET}` : ` ${BOLD}Fleetlens Usage${RESET}`
8990
+ );
8945
8991
  }
8946
8992
  lines.push("");
8947
8993
  for (const kind of kinds) {
8948
8994
  const snap = byAgent[kind];
8949
- lines.push(...formatAgentBlock(kind, snap));
8995
+ lines.push(...formatAgentBlock(kind, snap, layout));
8950
8996
  }
8951
8997
  lines.push("");
8952
8998
  return lines.join("\n");
8953
8999
  }
8954
- function formatAgentBlock(kind, snapshot) {
9000
+ function formatAgentBlock(kind, snapshot, layout) {
8955
9001
  const lines = [];
8956
- const title = agentTitle(kind);
8957
- const plan = snapshot.plan_type ? ` ${DIM}${snapshot.plan_type}${RESET}` : "";
9002
+ const title = layout.shortLabels && isAgentKind(kind) ? getAgentMetadata(kind)?.shortLabel ?? agentTitle(kind) : agentTitle(kind);
9003
+ const plan = snapshot.plan_type && layout.mode !== "narrow" ? ` ${DIM}${snapshot.plan_type}${RESET}` : "";
8958
9004
  lines.push(` ${BOLD}${title}${RESET}${plan}`);
8959
9005
  let renderedMeter = false;
8960
- for (const [label, window] of agentWindows(kind, snapshot)) {
9006
+ for (const [label, window] of agentWindows(kind, snapshot, layout.shortLabels)) {
8961
9007
  if (!window || window.utilization === null) continue;
8962
9008
  renderedMeter = true;
8963
- const pct = window.utilization;
8964
- const bar = renderBar(pct);
8965
- const pctStr = `${pct.toFixed(1)}%`.padStart(6);
8966
- const labelStr = label.padEnd(16);
8967
- lines.push(` ${labelStr}${bar} ${BOLD}${pctStr}${RESET}`);
8968
- if (window.resets_at) {
8969
- lines.push(` ${" ".repeat(16)}${DIM}resets ${formatRelative(window.resets_at)}${RESET}`);
8970
- }
9009
+ lines.push(...formatMeterRow(label, window.utilization, window.resets_at, layout));
8971
9010
  }
8972
9011
  if ((kind === "claude-code" || !kind) && snapshot.extra_usage?.is_enabled) {
8973
9012
  renderedMeter = true;
8974
9013
  const extra = snapshot.extra_usage;
8975
9014
  if (extra.utilization !== null) {
8976
- lines.push(
8977
- ` ${"Extra usage".padEnd(16)}${renderBar(extra.utilization)} ${BOLD}${extra.utilization.toFixed(1)}%${RESET}`
8978
- );
9015
+ const label = layout.shortLabels ? "xtra" : "Extra usage";
9016
+ lines.push(...formatMeterRow(label, extra.utilization, null, layout));
8979
9017
  }
8980
9018
  if (extra.used_credits !== null && extra.monthly_limit !== null) {
9019
+ const pad2 = layout.mode === "narrow" ? 2 : layout.labelWidth + 2;
8981
9020
  lines.push(
8982
- ` ${" ".repeat(16)}${DIM}${extra.used_credits} / ${extra.monthly_limit} credits${RESET}`
9021
+ ` ${" ".repeat(pad2)}${DIM}${extra.used_credits} / ${extra.monthly_limit} credits${RESET}`
8983
9022
  );
8984
9023
  }
8985
9024
  }
@@ -8987,25 +9026,26 @@ function formatAgentBlock(kind, snapshot) {
8987
9026
  const used = snapshot.web_search_quota.used;
8988
9027
  if (used !== null && used !== void 0) {
8989
9028
  renderedMeter = true;
8990
- lines.push(
8991
- ` ${"Web search".padEnd(16)}${renderBar(used)} ${BOLD}${used.toFixed(0)}%${RESET}`
8992
- );
9029
+ const label = layout.shortLabels ? "web" : "Web search";
9030
+ lines.push(...formatMeterRow(label, used, null, layout, { wholePct: true }));
8993
9031
  }
8994
9032
  }
8995
9033
  if (kind === "copilot" && snapshot.monthly_quota) {
8996
9034
  const q = snapshot.monthly_quota;
8997
9035
  const unit = q.unit === "premium-requests" ? "premium requests" : "AI credits";
9036
+ const pad2 = layout.mode === "narrow" ? 2 : layout.labelWidth + 2;
8998
9037
  if (q.unlimited) {
8999
9038
  renderedMeter = true;
9000
- lines.push(` ${"Monthly".padEnd(16)}${BOLD}Limit not reported${RESET}`);
9039
+ const lab = layout.shortLabels ? "mo" : "Monthly";
9040
+ lines.push(` ${lab.padEnd(layout.labelWidth)}${BOLD}Limit not reported${RESET}`);
9001
9041
  if (q.used !== null) {
9002
9042
  lines.push(
9003
- ` ${" ".repeat(16)}${DIM}${q.used.toLocaleString("en-US")} ${unit} reported by Copilot${RESET}`
9043
+ ` ${" ".repeat(pad2)}${DIM}${q.used.toLocaleString("en-US")} ${unit}${RESET}`
9004
9044
  );
9005
9045
  }
9006
9046
  } else if (q.used !== null && q.limit !== null) {
9007
9047
  lines.push(
9008
- ` ${" ".repeat(16)}${DIM}${q.used} / ${q.limit} ${unit}${RESET}`
9048
+ ` ${" ".repeat(pad2)}${DIM}${q.used} / ${q.limit} ${unit}${RESET}`
9009
9049
  );
9010
9050
  }
9011
9051
  }
@@ -9018,32 +9058,57 @@ function formatAgentBlock(kind, snapshot) {
9018
9058
  lines.push("");
9019
9059
  return lines;
9020
9060
  }
9021
- function agentWindows(kind, snapshot) {
9061
+ function formatMeterRow(label, utilization, resetsAt, layout, opts = {}) {
9062
+ const pctStr = opts.wholePct ? `${utilization.toFixed(0)}%`.padStart(5) : `${utilization.toFixed(1)}%`.padStart(6);
9063
+ const labelStr = label.padEnd(layout.labelWidth);
9064
+ if (layout.mode === "narrow" && layout.barWidth <= 0) {
9065
+ const reset = resetsAt ? ` ${DIM}r${formatRelativeShort(resetsAt)}${RESET}` : "";
9066
+ return [` ${labelStr}${BOLD}${pctStr}${RESET}${reset}`];
9067
+ }
9068
+ const bar = renderBar(utilization, layout.barWidth);
9069
+ const lines = [` ${labelStr}${bar} ${BOLD}${pctStr}${RESET} `];
9070
+ if (resetsAt) {
9071
+ lines.push(
9072
+ ` ${" ".repeat(layout.labelWidth)}${DIM}resets ${formatRelative(resetsAt)}${RESET}`
9073
+ );
9074
+ }
9075
+ return lines;
9076
+ }
9077
+ function agentWindows(kind, snapshot, shortLabels) {
9078
+ const L = shortLabels ? { five: "5h", seven: "7d", monthly: "mo", opus: "opus", sonnet: "son", oauth: "oath", cowork: "cowk" } : {
9079
+ five: "5 hour",
9080
+ seven: "7 day",
9081
+ monthly: "Monthly",
9082
+ opus: "7 day (Opus)",
9083
+ sonnet: "7 day (Sonnet)",
9084
+ oauth: "7 day (OAuth apps)",
9085
+ cowork: "7 day (Cowork)"
9086
+ };
9022
9087
  if (kind === "copilot") {
9023
- return [["Monthly", snapshot.monthly]];
9088
+ return [[L.monthly, snapshot.monthly]];
9024
9089
  }
9025
9090
  if (kind === "grok") {
9026
- return [["7 day", snapshot.seven_day]];
9091
+ return [[L.seven, snapshot.seven_day]];
9027
9092
  }
9028
9093
  if (kind === "codex" && snapshot.five_hour?.utilization == null) {
9029
- return [["7 day", snapshot.seven_day]];
9094
+ return [[L.seven, snapshot.seven_day]];
9030
9095
  }
9031
9096
  const rows = [
9032
- ["5 hour", snapshot.five_hour],
9033
- ["7 day", snapshot.seven_day]
9097
+ [L.five, snapshot.five_hour],
9098
+ [L.seven, snapshot.seven_day]
9034
9099
  ];
9035
9100
  if (kind === "claude-code" || !snapshot.agent) {
9036
9101
  if (snapshot.seven_day_opus?.utilization != null) {
9037
- rows.push(["7 day (Opus)", snapshot.seven_day_opus]);
9102
+ rows.push([L.opus, snapshot.seven_day_opus]);
9038
9103
  }
9039
9104
  if (snapshot.seven_day_sonnet?.utilization != null) {
9040
- rows.push(["7 day (Sonnet)", snapshot.seven_day_sonnet]);
9105
+ rows.push([L.sonnet, snapshot.seven_day_sonnet]);
9041
9106
  }
9042
9107
  if (snapshot.seven_day_oauth_apps?.utilization != null) {
9043
- rows.push(["7 day (OAuth apps)", snapshot.seven_day_oauth_apps]);
9108
+ rows.push([L.oauth, snapshot.seven_day_oauth_apps]);
9044
9109
  }
9045
9110
  if (snapshot.seven_day_cowork?.utilization != null) {
9046
- rows.push(["7 day (Cowork)", snapshot.seven_day_cowork]);
9111
+ rows.push([L.cowork, snapshot.seven_day_cowork]);
9047
9112
  }
9048
9113
  }
9049
9114
  return rows;
@@ -9064,15 +9129,16 @@ function compareAgents(a, b) {
9064
9129
  }
9065
9130
  return a.localeCompare(b);
9066
9131
  }
9067
- function renderBar(utilization) {
9132
+ function renderBar(utilization, barWidth) {
9133
+ if (barWidth <= 0) return "";
9068
9134
  const clamped = Math.max(0, Math.min(100, utilization));
9069
9135
  const color = clamped >= 90 ? RED : clamped >= 70 ? YELLOW : GREEN;
9070
- const totalEighths = Math.round(clamped / 100 * BAR_WIDTH * 8);
9136
+ const totalEighths = Math.round(clamped / 100 * barWidth * 8);
9071
9137
  const fullBlocks = Math.floor(totalEighths / 8);
9072
9138
  const remainder = totalEighths % 8;
9073
9139
  const partial = EIGHTHS[remainder];
9074
9140
  const filledCells = fullBlocks + (partial ? 1 : 0);
9075
- const emptyCells = BAR_WIDTH - filledCells;
9141
+ const emptyCells = Math.max(0, barWidth - filledCells);
9076
9142
  const filled = "\u2588".repeat(fullBlocks) + partial;
9077
9143
  const empty = "\xB7".repeat(emptyCells);
9078
9144
  return `${color}${filled}${RESET}${DIM}${empty}${RESET}`;
@@ -9099,7 +9165,16 @@ function formatRelative(iso) {
9099
9165
  }
9100
9166
  return past ? `${value} ago` : `in ${value}`;
9101
9167
  }
9102
- var DIM, BOLD, RESET, GREEN, YELLOW, RED, BAR_WIDTH, EIGHTHS, AGENT_PRIORITY;
9168
+ function formatRelativeShort(iso) {
9169
+ const then = new Date(iso).getTime();
9170
+ const now = Date.now();
9171
+ const abs = Math.abs(Math.round((then - now) / 1e3));
9172
+ if (abs < 60) return `${abs}s`;
9173
+ if (abs < 3600) return `${Math.floor(abs / 60)}m`;
9174
+ if (abs < 86400) return `${Math.floor(abs / 3600)}h`;
9175
+ return `${Math.floor(abs / 86400)}d`;
9176
+ }
9177
+ var DIM, BOLD, RESET, GREEN, YELLOW, RED, EIGHTHS, AGENT_PRIORITY;
9103
9178
  var init_format = __esm({
9104
9179
  "src/usage/format.ts"() {
9105
9180
  "use strict";
@@ -9110,7 +9185,6 @@ var init_format = __esm({
9110
9185
  GREEN = "\x1B[32m";
9111
9186
  YELLOW = "\x1B[33m";
9112
9187
  RED = "\x1B[31m";
9113
- BAR_WIDTH = 40;
9114
9188
  EIGHTHS = ["", "\u258F", "\u258E", "\u258D", "\u258C", "\u258B", "\u258A", "\u2589"];
9115
9189
  AGENT_PRIORITY = ["claude-code", "codex", "copilot", "zai", "grok"];
9116
9190
  }
@@ -9527,10 +9601,12 @@ stays fresh without hammering provider APIs.`);
9527
9601
  process.exitCode = 1;
9528
9602
  return;
9529
9603
  }
9530
- process.stdout.write(formatMultiAgentUsage(byAgent));
9604
+ const columns = typeof process.stdout.columns === "number" && process.stdout.columns > 0 ? process.stdout.columns : void 0;
9605
+ process.stdout.write(formatMultiAgentUsage(byAgent, { columns }));
9531
9606
  if (!save) {
9607
+ const narrow = columns !== void 0 && columns < 48 || columns === void 0 && parseInt(process.env.COLUMNS ?? "", 10) < 48;
9532
9608
  process.stdout.write(
9533
- " (tip: --watch for a live view \xB7 --history for the token table \xB7 --save to poll APIs)\n"
9609
+ narrow ? " (tip: --watch \xB7 --history \xB7 --save)\n" : " (tip: --watch for a live view \xB7 --history for the token table \xB7 --save to poll APIs)\n"
9534
9610
  );
9535
9611
  }
9536
9612
  }
@@ -9545,28 +9621,29 @@ async function runWatch(opts) {
9545
9621
  return;
9546
9622
  }
9547
9623
  }
9624
+ const tty = Boolean(process.stdout.isTTY);
9548
9625
  let stopping = false;
9549
- const stop2 = () => {
9550
- if (stopping) return;
9551
- stopping = true;
9552
- process.stdout.write("\x1B[?25h");
9553
- process.stdout.write("\n");
9554
- process.exit(0);
9626
+ const leaveScreen = () => {
9627
+ if (!tty) return;
9628
+ process.stdout.write("\x1B[?25h\x1B[?1049l");
9555
9629
  };
9556
- process.on("SIGINT", stop2);
9557
- process.on("SIGTERM", stop2);
9558
- if (process.stdout.isTTY) process.stdout.write("\x1B[?25l");
9630
+ if (tty) {
9631
+ process.stdout.write("\x1B[?1049h\x1B[?25l");
9632
+ }
9559
9633
  const draw = () => {
9560
9634
  if (stopping) return;
9561
9635
  const byAgent = filterAgents(latestSnapshotsByAgent(USAGE_LOG2), opts.agentFilter);
9562
- if (process.stdout.isTTY) {
9563
- process.stdout.write("\x1B[2J\x1B[H");
9636
+ const columns = typeof process.stdout.columns === "number" && process.stdout.columns > 0 ? process.stdout.columns : void 0;
9637
+ if (tty) {
9638
+ process.stdout.write("\x1B[H\x1B[2J");
9639
+ } else {
9640
+ process.stdout.write("\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n");
9564
9641
  }
9565
9642
  if (Object.keys(byAgent).length === 0) {
9566
9643
  process.stdout.write(
9567
9644
  `
9568
9645
  ${opts.agentFilter ? `No samples for ${opts.agentFilter}` : "Waiting for usage samples\u2026"}
9569
- ${" ".repeat(0)}Start the daemon: fleetlens daemon start
9646
+ Start the daemon: fleetlens daemon start
9570
9647
 
9571
9648
  live \xB7 every ${opts.intervalSec}s \xB7 Ctrl+C to quit
9572
9649
  `
@@ -9576,14 +9653,27 @@ async function runWatch(opts) {
9576
9653
  process.stdout.write(
9577
9654
  formatMultiAgentUsage(byAgent, {
9578
9655
  watch: true,
9579
- intervalSec: opts.intervalSec
9656
+ intervalSec: opts.intervalSec,
9657
+ columns
9580
9658
  })
9581
9659
  );
9582
9660
  };
9661
+ if (tty) {
9662
+ process.stdout.on("resize", draw);
9663
+ }
9583
9664
  draw();
9584
9665
  const timer = setInterval(draw, opts.intervalSec * 1e3);
9666
+ const stop2 = () => {
9667
+ if (stopping) return;
9668
+ stopping = true;
9669
+ clearInterval(timer);
9670
+ leaveScreen();
9671
+ process.stdout.write("\n");
9672
+ process.exit(0);
9673
+ };
9674
+ process.on("SIGINT", stop2);
9675
+ process.on("SIGTERM", stop2);
9585
9676
  await new Promise(() => {
9586
- void timer;
9587
9677
  });
9588
9678
  }
9589
9679
  var USAGE_LOG2;
@@ -20485,7 +20575,7 @@ function buildIngestPayload(inputs) {
20485
20575
  return {
20486
20576
  ingestId: randomUUID2(),
20487
20577
  observedAt: (/* @__PURE__ */ new Date()).toISOString(),
20488
- cliVersion: "1.0.8",
20578
+ cliVersion: "1.0.9",
20489
20579
  ...richRollup || inputs.enrichedExtras || inputs.artifactSignals ? { schemaVersion: RICH_ROLLUP_SCHEMA_VERSION } : {},
20490
20580
  ...inputs.rollup ? { dailyRollup: inputs.rollup } : {},
20491
20581
  ...richRollup ? { richRollup } : {},
@@ -22529,7 +22619,7 @@ async function main() {
22529
22619
  case "version":
22530
22620
  case "--version":
22531
22621
  case "-v":
22532
- console.log(`fleetlens ${"1.0.8"}`);
22622
+ console.log(`fleetlens ${"1.0.9"}`);
22533
22623
  break;
22534
22624
  case "help":
22535
22625
  case "--help":
@@ -10,8 +10,8 @@
10
10
  <key>CFBundleName</key><string>Fleetlens</string>
11
11
  <key>CFBundleDisplayName</key><string>Fleetlens</string>
12
12
  <key>CFBundlePackageType</key><string>APPL</string>
13
- <key>CFBundleShortVersionString</key><string>1.0.8</string>
14
- <key>CFBundleVersion</key><string>1.0.8</string>
13
+ <key>CFBundleShortVersionString</key><string>1.0.9</string>
14
+ <key>CFBundleVersion</key><string>1.0.9</string>
15
15
  <key>LSApplicationCategoryType</key><string>public.app-category.developer-tools</string>
16
16
  <key>LSMinimumSystemVersion</key><string>14.0</string>
17
17
  <key>LSUIElement</key><true/>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetlens",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "fleetlens — local-only dashboard and usage tracker for Claude Code sessions and agent fleets",
5
5
  "license": "MIT",
6
6
  "author": "cowcow02",