@dosu/cli 0.53.0-beta.10 → 0.53.0-beta.12

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/bin/dosu.js +73 -35
  2. package/package.json +1 -1
package/bin/dosu.js CHANGED
@@ -5018,7 +5018,7 @@ function isNpxInvocation(channel = INSTALL_CHANNEL, env = process.env) {
5018
5018
  function getVersionString() {
5019
5019
  return `v${VERSION}`;
5020
5020
  }
5021
- var VERSION = "0.53.0-beta.10", INSTALL_CHANNEL = "npm";
5021
+ var VERSION = "0.53.0-beta.12", INSTALL_CHANNEL = "npm";
5022
5022
 
5023
5023
  // src/debug/logger.ts
5024
5024
  import {
@@ -5712,12 +5712,34 @@ function answeredEcho(message, answer) {
5712
5712
  function optionLabel(option) {
5713
5713
  return option.label ?? String(option.value);
5714
5714
  }
5715
+ function viewport(count, cursor3, top, rows, chrome) {
5716
+ const visible = Math.min(count, Math.max(4, (rows ?? 24) - chrome));
5717
+ let next = top;
5718
+ if (cursor3 < next)
5719
+ next = cursor3;
5720
+ if (cursor3 >= next + visible)
5721
+ next = cursor3 - visible + 1;
5722
+ next = Math.max(0, Math.min(next, count - visible));
5723
+ return { top: next, visible, above: next, below: count - next - visible };
5724
+ }
5725
+ function moreAbove(n2) {
5726
+ return n2 > 0 ? [import_picocolors11.default.dim(` ↑ ${n2} more`)] : [];
5727
+ }
5728
+ function moreBelow(n2) {
5729
+ return n2 > 0 ? [import_picocolors11.default.dim(` ↓ ${n2} more`)] : [];
5730
+ }
5715
5731
  function select(opts, io = {}) {
5732
+ const { output } = resolveIO(io);
5716
5733
  let selected = 0;
5734
+ let top = 0;
5717
5735
  const labelWidth = Math.max(...opts.options.map((o2) => optionLabel(o2).length));
5718
5736
  return runInteractive({
5719
5737
  render() {
5720
- const rows = opts.options.map((option, index) => {
5738
+ const count = opts.options.length;
5739
+ const view = viewport(count, selected, top, output.rows, 8);
5740
+ top = view.top;
5741
+ const rows = opts.options.slice(top, top + view.visible).map((option, offset) => {
5742
+ const index = top + offset;
5721
5743
  const label = optionLabel(option).padEnd(labelWidth);
5722
5744
  const hint = option.hint ? ` ${import_picocolors11.default.dim(option.hint)}` : "";
5723
5745
  return index === selected ? `${brand(POINTER2)} ${import_picocolors11.default.bold(brand(label))}${hint}` : ` ${import_picocolors11.default.dim(label)}${hint}`;
@@ -5725,7 +5747,9 @@ function select(opts, io = {}) {
5725
5747
  return [
5726
5748
  import_picocolors11.default.bold(opts.message),
5727
5749
  "",
5750
+ ...moreAbove(view.above),
5728
5751
  ...rows,
5752
+ ...moreBelow(view.below),
5729
5753
  "",
5730
5754
  import_picocolors11.default.dim(`↑↓ move ${DOT} enter select ${DOT} esc cancel`)
5731
5755
  ];
@@ -5763,13 +5787,9 @@ function multiselect2(opts, io = {}) {
5763
5787
  return runInteractive({
5764
5788
  render() {
5765
5789
  const count = opts.options.length;
5766
- const visible = Math.min(count, Math.max(4, (output.rows ?? 24) - 9));
5767
- if (cursor3 < top)
5768
- top = cursor3;
5769
- if (cursor3 >= top + visible)
5770
- top = cursor3 - visible + 1;
5771
- top = Math.max(0, Math.min(top, count - visible));
5772
- const rows = opts.options.slice(top, top + visible).map((option, offset) => {
5790
+ const view = viewport(count, cursor3, top, output.rows, 9);
5791
+ top = view.top;
5792
+ const rows = opts.options.slice(top, top + view.visible).map((option, offset) => {
5773
5793
  const index = top + offset;
5774
5794
  const isPicked = picked.has(option.value);
5775
5795
  const box = isPicked ? brand(BOX_ON) : import_picocolors11.default.dim(BOX_OFF);
@@ -5778,15 +5798,13 @@ function multiselect2(opts, io = {}) {
5778
5798
  const suffix = status ? ` ${status}` : "";
5779
5799
  return index === cursor3 ? `${brand(POINTER2)} ${box} ${import_picocolors11.default.bold(brand(label))}${suffix}` : ` ${box} ${import_picocolors11.default.dim(label)}${suffix}`;
5780
5800
  });
5781
- const above = top;
5782
- const below = count - top - visible;
5783
5801
  const summary = opts.summary?.(pickedValues());
5784
5802
  return [
5785
5803
  import_picocolors11.default.bold(opts.message),
5786
5804
  "",
5787
- ...above > 0 ? [import_picocolors11.default.dim(` ↑ ${above} more`)] : [],
5805
+ ...moreAbove(view.above),
5788
5806
  ...rows,
5789
- ...below > 0 ? [import_picocolors11.default.dim(` ↓ ${below} more`)] : [],
5807
+ ...moreBelow(view.below),
5790
5808
  "",
5791
5809
  ...error ? [import_picocolors11.default.yellow(error)] : summary ? [import_picocolors11.default.dim(summary)] : [],
5792
5810
  import_picocolors11.default.dim(`↑↓ move ${DOT} space toggle ${DOT} a all ${DOT} enter confirm ${DOT} esc cancel`)
@@ -73519,7 +73537,7 @@ var init_settings = __esm(() => {
73519
73537
  });
73520
73538
 
73521
73539
  // src/telemetry/debug-id.ts
73522
- var BUNDLE_DEBUG_ID_PLACEHOLDER = "6096b455-0361-b435-6475-6e2164756e21";
73540
+ var BUNDLE_DEBUG_ID_PLACEHOLDER = "acac034b-488b-746c-6475-6e2164756e21";
73523
73541
 
73524
73542
  // src/telemetry/telemetry.ts
73525
73543
  import { randomUUID as randomUUID4 } from "node:crypto";
@@ -75456,9 +75474,9 @@ function syncConfirmMode(status) {
75456
75474
  return "resume";
75457
75475
  return "start";
75458
75476
  }
75459
- function formatActivityLine(line, width) {
75477
+ function formatActivityLine(line, width, full = false) {
75460
75478
  const compact = stripAnsiCodes(line).replace(/^\[(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2})[^\]]*\]/, (_match, _date2, time3) => time3);
75461
- if (compact.length <= width)
75479
+ if (full || compact.length <= width)
75462
75480
  return compact;
75463
75481
  return `${compact.slice(0, Math.max(0, width - 1))}…`;
75464
75482
  }
@@ -75636,12 +75654,12 @@ function renderActivityFrame(status, activity, width, backlog = null, pane = DEF
75636
75654
  }
75637
75655
  const refusal = !status.running && status.state.last_refusal;
75638
75656
  const refusalLines = refusal ? wrapLine(`! Mining paused: ${refusal.message} (${localTime(refusal.at)})`, width).map((line) => import_picocolors30.default.yellow(line)) : [];
75639
- const fullRows = Boolean(pane.fullRows) && pane.tab !== "activity";
75657
+ const fullRows = Boolean(pane.fullRows);
75640
75658
  const minedRows = (status.state.mined_sessions ?? []).map((record2) => fullRows ? formatMinedRow(record2, true) : formatActivityLine(formatMinedRow(record2), width));
75641
75659
  const sessionRow = (session) => fullRows ? formatQueuedRow(session, true) : formatActivityLine(formatQueuedRow(session), width);
75642
75660
  const queuedRows = queued.map(sessionRow);
75643
75661
  const openRows = open5.map(sessionRow);
75644
- const source = pane.tab === "activity" ? activity.map((line) => formatActivityLine(line, width)) : pane.tab === "queued" ? queuedRows : pane.tab === "open" ? openRows : minedRows;
75662
+ const source = pane.tab === "activity" ? activity.map((line) => formatActivityLine(line, width, fullRows)) : pane.tab === "queued" ? queuedRows : pane.tab === "open" ? openRows : minedRows;
75645
75663
  const emptyMined = status.state.watermark ? "No sessions recorded yet. History starts with the next mining run." : "No mined sessions yet.";
75646
75664
  const empty = pane.tab === "activity" ? "No sync activity in the log yet." : pane.tab === "queued" ? "Queue empty. Finished agent sessions appear here." : pane.tab === "open" ? "No open sessions. Live agent sessions sit here until they go quiet." : emptyMined;
75647
75665
  const height = fullRows ? ACTIVITY_VIEW_FULL_LIST_ROWS : ACTIVITY_VIEW_LIST_LINES;
@@ -75653,9 +75671,6 @@ function renderActivityFrame(status, activity, width, backlog = null, pane = DEF
75653
75671
  scrollParts.push(`↑ ${above} earlier`);
75654
75672
  if (below > 0)
75655
75673
  scrollParts.push(`↓ ${below} newer`);
75656
- if (pane.tab !== "activity" && visible.length > 0) {
75657
- scrollParts.push(fullRows ? `f clip · copy: dosu knowledge sessions --${pane.tab}` : `f full rows · dosu knowledge sessions --${pane.tab}`);
75658
- }
75659
75674
  const lines = [
75660
75675
  breadcrumb(["Home", "Activity"], width),
75661
75676
  "",
@@ -75673,6 +75688,7 @@ function renderActivityFrame(status, activity, width, backlog = null, pane = DEF
75673
75688
  import_picocolors30.default.dim([
75674
75689
  "tab switch",
75675
75690
  "↑↓ scroll",
75691
+ fullRows ? "f clip" : "f full rows",
75676
75692
  status.running ? "s stop" : status.state.paused ? "s resume" : "s sync now",
75677
75693
  "esc back"
75678
75694
  ].join(" · "))
@@ -75726,7 +75742,7 @@ function runActivityView(io2 = {}) {
75726
75742
  return sessions.open.length;
75727
75743
  return (status.state.mined_sessions ?? []).length;
75728
75744
  };
75729
- const listHeight = () => fullRows && tab !== "activity" ? ACTIVITY_VIEW_FULL_LIST_ROWS : ACTIVITY_VIEW_LIST_LINES;
75745
+ const listHeight = () => fullRows ? ACTIVITY_VIEW_FULL_LIST_ROWS : ACTIVITY_VIEW_LIST_LINES;
75730
75746
  let lastFrame = null;
75731
75747
  let minedBeforeRun = null;
75732
75748
  const draw = () => {
@@ -75832,11 +75848,9 @@ ${CLEAR_BELOW}`);
75832
75848
  sessions = listBacklog();
75833
75849
  draw();
75834
75850
  } else if (action === "full") {
75835
- if (tab !== "activity") {
75836
- fullRows = !fullRows;
75837
- scroll = 0;
75838
- draw();
75839
- }
75851
+ fullRows = !fullRows;
75852
+ scroll = 0;
75853
+ draw();
75840
75854
  } else if (action === "up") {
75841
75855
  const maxScroll = Math.max(0, activeListLength() - listHeight());
75842
75856
  if (scroll < maxScroll) {
@@ -77759,7 +77773,7 @@ function checklistRows(ctx) {
77759
77773
  const rows = [["workspace", ctx.directory]];
77760
77774
  rows.push([
77761
77775
  "account",
77762
- ctx.signedIn ? `${on2} signed in` : `${off} ${import_picocolors33.default.dim("not signed in · run Setup")}`
77776
+ ctx.sessionExpired ? `${off} ${import_picocolors33.default.yellow("session expired")} ${import_picocolors33.default.dim(`${DOT3} run Log in`)}` : ctx.signedIn ? `${on2} signed in` : `${off} ${import_picocolors33.default.dim(`not signed in ${DOT3} run Setup`)}`
77763
77777
  ]);
77764
77778
  const missing = new Set(ctx.setupMissing ?? []);
77765
77779
  const warnRow = `${off} ${import_picocolors33.default.yellow("not configured")} ${import_picocolors33.default.dim(`${DOT3} run Setup`)}`;
@@ -78178,7 +78192,17 @@ __export(exports_tui, {
78178
78192
  });
78179
78193
  import { homedir as homedir10 } from "node:os";
78180
78194
  import { basename as basename4 } from "node:path";
78181
- function bannerContext(cfg) {
78195
+ async function probeSession(cfg) {
78196
+ if (!isAuthenticated(cfg) || !isTokenExpired(cfg))
78197
+ return { expired: false };
78198
+ try {
78199
+ await new Client(cfg).refreshToken();
78200
+ return { expired: false };
78201
+ } catch (err) {
78202
+ return { expired: err instanceof SessionExpiredError };
78203
+ }
78204
+ }
78205
+ function bannerContext(cfg, session) {
78182
78206
  let webAppHost = "app.dosu.dev";
78183
78207
  try {
78184
78208
  webAppHost = new URL(getWebAppURL()).host;
@@ -78196,9 +78220,10 @@ function bannerContext(cfg) {
78196
78220
  webAppHost,
78197
78221
  directory: basename4(process.cwd()),
78198
78222
  signedIn: isAuthenticated(cfg),
78223
+ sessionExpired: session.expired,
78199
78224
  deploymentName: cfg.active_account?.target?.deployment_name,
78200
78225
  libraryName: cfg.active_account?.target?.library_name,
78201
- setupMissing: isAuthenticated(cfg) ? missingSetupSteps(cfg) : [],
78226
+ setupMissing: isAuthenticated(cfg) && !session.expired ? missingSetupSteps(cfg) : [],
78202
78227
  ...inGitWorkTree() ? { repoAgentsMd: dosuAgentsSectionState() } : {},
78203
78228
  agents,
78204
78229
  mining: isMining(),
@@ -78275,17 +78300,18 @@ function isMining() {
78275
78300
  return false;
78276
78301
  }
78277
78302
  }
78278
- function drawHome(cfg) {
78303
+ function drawHome(cfg, session) {
78279
78304
  if (process.stdout.isTTY) {
78280
78305
  process.stdout.write(CLEAR_SCREEN);
78281
78306
  process.stdout.write(`
78282
78307
  `.repeat(frameTopMargin()));
78283
78308
  }
78284
- process.stdout.write(`${renderBanner(bannerContext(cfg))}
78309
+ process.stdout.write(`${renderBanner(bannerContext(cfg, session))}
78285
78310
  `);
78286
78311
  }
78287
78312
  async function runMainMenu() {
78288
78313
  const cfg = loadConfig();
78314
+ const session = await probeSession(cfg);
78289
78315
  const runSetupAndReload = async () => {
78290
78316
  await runSetup();
78291
78317
  const fresh = loadConfig();
@@ -78293,6 +78319,16 @@ async function runMainMenu() {
78293
78319
  cfg.active_account = fresh.active_account;
78294
78320
  };
78295
78321
  const buildOptions = () => {
78322
+ if (session.expired) {
78323
+ return [
78324
+ {
78325
+ label: "Log in again",
78326
+ hint: "(session expired · opens your browser)",
78327
+ value: "auth"
78328
+ },
78329
+ { label: "Exit", value: "exit" }
78330
+ ];
78331
+ }
78296
78332
  if (!isAuthenticated(cfg)) {
78297
78333
  return [
78298
78334
  { label: "Log in / Sign up", hint: "(opens your browser)", value: "auth" },
@@ -78318,9 +78354,9 @@ async function runMainMenu() {
78318
78354
  { label: "Exit", value: "exit" }
78319
78355
  ];
78320
78356
  };
78321
- const home = () => drawHome(cfg);
78357
+ const home = () => drawHome(cfg, session);
78322
78358
  home();
78323
- if (isAuthenticated(cfg) && !isSetUp(cfg)) {
78359
+ if (isAuthenticated(cfg) && !session.expired && !isSetUp(cfg)) {
78324
78360
  await runSetupAndReload();
78325
78361
  home();
78326
78362
  }
@@ -78354,6 +78390,7 @@ async function runMainMenu() {
78354
78390
  break;
78355
78391
  case "auth":
78356
78392
  await handleAuthenticate(cfg);
78393
+ session.expired = session.expired && isTokenExpired(cfg);
78357
78394
  home();
78358
78395
  if (isAuthenticated(cfg) && !isSetUp(cfg)) {
78359
78396
  await runSetupAndReload();
@@ -78502,6 +78539,7 @@ function handleLogout(cfg) {
78502
78539
  }
78503
78540
  var import_picocolors35, ESC10, CLEAR_SCREEN;
78504
78541
  var init_tui = __esm(() => {
78542
+ init_client();
78505
78543
  init_config();
78506
78544
  init_agents();
78507
78545
  init_providers();
@@ -84616,4 +84654,4 @@ execute().catch((err) => {
84616
84654
  process.exit(1);
84617
84655
  });
84618
84656
 
84619
- //# debugId=6096b455-0361-b435-6475-6e2164756e21
84657
+ //# debugId=acac034b-488b-746c-6475-6e2164756e21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosu/cli",
3
- "version": "0.53.0-beta.10",
3
+ "version": "0.53.0-beta.12",
4
4
  "type": "module",
5
5
  "description": "Dosu CLI - Manage MCP servers for AI tools",
6
6
  "license": "MIT",