sidekick-agent-hub 0.21.1 → 0.21.2

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/README.md CHANGED
@@ -8,7 +8,7 @@ Sidekick CLI reads from `~/.config/sidekick/` — the same data files the [VS Co
8
8
 
9
9
  ## What's New
10
10
 
11
- - **`sidekick quota --provider zai`** — *estimated* z.ai Coding Plan quota (5-Hour / Weekly) derived from observed OpenCode traffic, with `--tier lite|pro|max|auto`. It's an estimate, not authoritative (z.ai has no usage API); see Quota & Rate Limits below.
11
+ - **`sidekick quota --provider zai`** — authoritative z.ai Coding Plan quota (5-Hour / Weekly) from z.ai's quota API, using OpenCode's stored z.ai token when available.
12
12
  - **`sidekick extract`** — pull URLs, file paths, commands, and plans out of recent Claude Code and Codex chats, with `--json` and an interactive picker.
13
13
  - **`sidekick quota history`** — a 13-week, per-workspace, GitHub-style heatmap of session-limit utilization.
14
14
  - **`sidekick status` & `sidekick peak`** — one-shot Claude/OpenAI API health checks and a Claude peak-hours indicator.
@@ -158,7 +158,7 @@ Provider-aware quota and rate-limit display. The command auto-detects the active
158
158
 
159
159
  - **Claude Code**: Shows Claude Max subscription quota — 5-hour and 7-day windows with color-coded progress bars, projections, and reset countdowns. Includes a peak-hours summary line.
160
160
  - **Codex**: Shows rate limits from Codex `token_count.rate_limits` events — primary and secondary windows with progress bars and reset countdowns. The default path is local-only: current workspace rollout, recent account-level rollouts, then the active account's cached snapshot. Add `--refresh` to explicitly refresh from Codex's usage API before falling back to local data.
161
- - **OpenCode / z.ai**: OpenCode has no native rate-limit data, but when it routes to a **z.ai Coding Plan** (GLM), `sidekick quota --provider opencode` auto-routes to an **estimated** z.ai quota (5-Hour / Weekly). Use `--provider zai` to request it explicitly and `--tier lite|pro|max|auto` to override the tier. The figure is an estimate, not authoritative — z.ai exposes no usage API, so utilization is derived from observed OpenCode traffic against provisional per-tier budgets, z.ai is observed-only (not a selectable inference provider) with no account management yet, and reset times are approximate unless a rate-limit error is trapped.
161
+ - **OpenCode / z.ai**: OpenCode has no native rate-limit data, but when z.ai Coding Plan credentials are available, `sidekick quota --provider opencode` can auto-route to authoritative z.ai quota (5-Hour / Weekly). Use `--provider zai` to request it explicitly. z.ai quota is read from z.ai's quota API using OpenCode's stored token, with fallback support for `ANTHROPIC_BASE_URL` and `ANTHROPIC_AUTH_TOKEN`.
162
162
 
163
163
  ```
164
164
  Subscription Quota
@@ -173,7 +173,7 @@ Use `--json` for machine-readable output. Use `--provider codex` to explicitly c
173
173
 
174
174
  When multi-account is enabled, `sidekick quota` shows the active account email above the quota bars.
175
175
 
176
- Use `sidekick quota --all` to show Claude and Codex quota together in a single run (plus the estimated z.ai section when z.ai traffic is active). Each provider degrades independently — if one provider's quota can't be fetched, its error is shown inline and the others still render (the command never aborts on a single provider's failure). `--all --json` emits a provider-keyed payload for dashboards and automation.
176
+ Use `sidekick quota --all` to show Claude and Codex quota together in a single run, plus z.ai when API quota is available or z.ai traffic is active. Each provider degrades independently — if one provider's quota can't be fetched, its error is shown inline and the others still render (the command never aborts on a single provider's failure). `--all --json` emits a provider-keyed payload for dashboards and automation.
177
177
 
178
178
  ### Quota History
179
179
 
@@ -9451,13 +9451,13 @@ var require_zaiQuota = __commonJS({
9451
9451
  exports.ZAI_PROVIDER_IDS = exports.ZAI_PROMPT_INVOCATIONS = exports.ZAI_TIER_BUDGETS = void 0;
9452
9452
  exports.isZaiProviderId = isZaiProviderId;
9453
9453
  exports.turnTokenWeight = turnTokenWeight;
9454
- exports.accumulateZaiUsage = accumulateZaiUsage2;
9455
- exports.resolveZaiTier = resolveZaiTier2;
9456
- exports.inferZaiQuotaState = inferZaiQuotaState2;
9457
- exports.parseZaiQuotaError = parseZaiQuotaError2;
9454
+ exports.accumulateZaiUsage = accumulateZaiUsage;
9455
+ exports.resolveZaiTier = resolveZaiTier;
9456
+ exports.inferZaiQuotaState = inferZaiQuotaState;
9457
+ exports.parseZaiQuotaError = parseZaiQuotaError;
9458
9458
  exports.extractNextFlushTime = extractNextFlushTime;
9459
- exports.makeUnavailableZaiQuotaState = makeUnavailableZaiQuotaState2;
9460
- exports.rowsToZaiTurnsAndErrors = rowsToZaiTurnsAndErrors2;
9459
+ exports.makeUnavailableZaiQuotaState = makeUnavailableZaiQuotaState;
9460
+ exports.rowsToZaiTurnsAndErrors = rowsToZaiTurnsAndErrors;
9461
9461
  exports.ZAI_TIER_BUDGETS = {
9462
9462
  lite: { fiveHour: 80, weekly: 400 },
9463
9463
  pro: { fiveHour: 400, weekly: 2e3 },
@@ -9473,7 +9473,7 @@ var require_zaiQuota = __commonJS({
9473
9473
  function turnTokenWeight(turn) {
9474
9474
  return turn.inputTokens + turn.outputTokens + Math.round(turn.cacheReadTokens * 0.1) + turn.cacheWriteTokens + (turn.reasoningTokens || 0);
9475
9475
  }
9476
- function accumulateZaiUsage2(turns, nowMs = Date.now()) {
9476
+ function accumulateZaiUsage(turns, nowMs = Date.now()) {
9477
9477
  const fiveHourCutoff = nowMs - FIVE_HOUR_MS;
9478
9478
  const weeklyCutoff = nowMs - SEVEN_DAY_MS;
9479
9479
  let fiveHourTurns = 0;
@@ -9509,7 +9509,7 @@ var require_zaiQuota = __commonJS({
9509
9509
  weeklyStartedAtMs
9510
9510
  };
9511
9511
  }
9512
- function resolveZaiTier2(configured, accumulated) {
9512
+ function resolveZaiTier(configured, accumulated) {
9513
9513
  if (configured !== "auto")
9514
9514
  return configured;
9515
9515
  if (accumulated.weeklyPrompts > exports.ZAI_TIER_BUDGETS.pro.weekly)
@@ -9518,7 +9518,7 @@ var require_zaiQuota = __commonJS({
9518
9518
  return "pro";
9519
9519
  return "lite";
9520
9520
  }
9521
- function inferZaiQuotaState2(accumulated, tier, options = {}) {
9521
+ function inferZaiQuotaState(accumulated, tier, options = {}) {
9522
9522
  const budget = exports.ZAI_TIER_BUDGETS[tier];
9523
9523
  const capturedAt = options.capturedAt ?? (/* @__PURE__ */ new Date()).toISOString();
9524
9524
  const fiveHourUtil = budget.fiveHour > 0 ? Math.min(accumulated.fiveHourPrompts / budget.fiveHour * 100, 200) : 0;
@@ -9559,7 +9559,7 @@ var require_zaiQuota = __commonJS({
9559
9559
  "1309": "expired"
9560
9560
  // GLM Coding Plan package has expired
9561
9561
  };
9562
- function parseZaiQuotaError2(error) {
9562
+ function parseZaiQuotaError(error) {
9563
9563
  if (!error)
9564
9564
  return null;
9565
9565
  const code = String(error.code ?? "");
@@ -9595,7 +9595,7 @@ var require_zaiQuota = __commonJS({
9595
9595
  }
9596
9596
  return void 0;
9597
9597
  }
9598
- function makeUnavailableZaiQuotaState2(error = "No z.ai usage observed yet", tier = "lite", capturedAt = (/* @__PURE__ */ new Date()).toISOString()) {
9598
+ function makeUnavailableZaiQuotaState(error = "No z.ai usage observed yet", tier = "lite", capturedAt = (/* @__PURE__ */ new Date()).toISOString()) {
9599
9599
  return {
9600
9600
  fiveHour: { utilization: 0, resetsAt: "" },
9601
9601
  sevenDay: { utilization: 0, resetsAt: "" },
@@ -9610,7 +9610,7 @@ var require_zaiQuota = __commonJS({
9610
9610
  planType: tier
9611
9611
  };
9612
9612
  }
9613
- function rowsToZaiTurnsAndErrors2(rows) {
9613
+ function rowsToZaiTurnsAndErrors(rows) {
9614
9614
  const turns = [];
9615
9615
  const errors = [];
9616
9616
  for (const row of rows) {
@@ -9624,7 +9624,7 @@ var require_zaiQuota = __commonJS({
9624
9624
  reasoningTokens: row.reasoningTokens || 0
9625
9625
  });
9626
9626
  if (row.errorCode != null || row.errorMessage) {
9627
- const parsed = parseZaiQuotaError2({
9627
+ const parsed = parseZaiQuotaError({
9628
9628
  code: row.errorCode ?? void 0,
9629
9629
  message: row.errorMessage ?? void 0
9630
9630
  });
@@ -10953,15 +10953,15 @@ var require_openCode = __commonJS({
10953
10953
  this.sessionMetaCache.clear();
10954
10954
  this.dynamicContextWindowLimit = null;
10955
10955
  }
10956
- // --- z.ai (GLM Coding Plan) quota derivation ---
10956
+ // --- z.ai (GLM Coding Plan) compatibility quota derivation ---
10957
10957
  /**
10958
10958
  * Derives a z.ai coding-plan `QuotaState` from OpenCode assistant turns
10959
10959
  * tagged with `providerID ∈ {zai, zai-coding-plan}`.
10960
10960
  *
10961
- * z.ai does not expose a quota API (verified vs. docs.z.ai/openapi.json),
10962
- * so this method accumulates observed per-turn tokens from OpenCode's DB
10963
- * into 5-hour / 7-day rolling windows and infers utilization against the
10964
- * configured tier budget. Returns null when no z.ai routing is detected.
10961
+ * This compatibility estimator predates the authoritative z.ai quota API.
10962
+ * New product code should use `zaiQuotaApi.ts`; this method remains for
10963
+ * consumers that still want a local OpenCode DB-derived estimate. Returns
10964
+ * null when no z.ai routing is detected.
10965
10965
  *
10966
10966
  * @param tier Plan tier; `'auto'` infers from observed weekly volume.
10967
10967
  * When the caller has no opinion, the heuristic falls back to
@@ -23172,6 +23172,272 @@ var require_zaiQuotaWatcher = __commonJS({
23172
23172
  }
23173
23173
  });
23174
23174
 
23175
+ // ../sidekick-shared/dist/zaiQuotaApi.js
23176
+ var require_zaiQuotaApi = __commonJS({
23177
+ "../sidekick-shared/dist/zaiQuotaApi.js"(exports) {
23178
+ "use strict";
23179
+ var __importDefault = exports && exports.__importDefault || function(mod) {
23180
+ return mod && mod.__esModule ? mod : { "default": mod };
23181
+ };
23182
+ Object.defineProperty(exports, "__esModule", { value: true });
23183
+ exports.readZaiCredentials = readZaiCredentials;
23184
+ exports.quotaStateFromZaiQuotaLimitPayload = quotaStateFromZaiQuotaLimitPayload;
23185
+ exports.fetchZaiQuotaFromApi = fetchZaiQuotaFromApi;
23186
+ exports.resolveZaiQuota = resolveZaiQuota2;
23187
+ var fs_1 = __importDefault(__require("fs"));
23188
+ var os_1 = __importDefault(__require("os"));
23189
+ var path_1 = __importDefault(__require("path"));
23190
+ var quotaSnapshots_1 = require_quotaSnapshots();
23191
+ var DEFAULT_ZAI_BASE_URL = "https://api.z.ai/api/anthropic";
23192
+ var QUOTA_PATH = "/api/monitor/usage/quota/limit";
23193
+ var DEFAULT_ACCOUNT_ID = "default";
23194
+ var DEFAULT_TIMEOUT_MS = 1e4;
23195
+ function unavailableZaiQuotaState(error, meta = {}, capturedAt = (/* @__PURE__ */ new Date()).toISOString()) {
23196
+ return {
23197
+ fiveHour: { utilization: 0, resetsAt: "" },
23198
+ sevenDay: { utilization: 0, resetsAt: "" },
23199
+ available: false,
23200
+ error,
23201
+ providerId: "zai",
23202
+ source: "api",
23203
+ capturedAt,
23204
+ fiveHourLabel: "5-Hour",
23205
+ sevenDayLabel: "Weekly",
23206
+ ...meta
23207
+ };
23208
+ }
23209
+ function openCodeDataDirCandidates() {
23210
+ const candidates = [];
23211
+ const xdg = process.env.XDG_DATA_HOME;
23212
+ if (xdg)
23213
+ candidates.push(path_1.default.join(xdg, "opencode"));
23214
+ candidates.push(path_1.default.join(os_1.default.homedir(), ".local", "share", "opencode"));
23215
+ if (process.platform === "darwin") {
23216
+ candidates.push(path_1.default.join(os_1.default.homedir(), "Library", "Application Support", "opencode"));
23217
+ } else if (process.platform === "win32") {
23218
+ candidates.push(path_1.default.join(process.env.LOCALAPPDATA || process.env.APPDATA || path_1.default.join(os_1.default.homedir(), "AppData", "Local"), "opencode"));
23219
+ }
23220
+ return Array.from(new Set(candidates));
23221
+ }
23222
+ function readOpenCodeAuthToken(openCodeDataDir) {
23223
+ const candidates = openCodeDataDir ? [openCodeDataDir] : openCodeDataDirCandidates();
23224
+ for (const dataDir of candidates) {
23225
+ try {
23226
+ const parsed = JSON.parse(fs_1.default.readFileSync(path_1.default.join(dataDir, "auth.json"), "utf8"));
23227
+ const codingPlan = parsed["zai-coding-plan"];
23228
+ const zai = parsed.zai;
23229
+ if (typeof codingPlan?.key === "string" && codingPlan.key.trim())
23230
+ return codingPlan.key.trim();
23231
+ if (typeof zai?.key === "string" && zai.key.trim())
23232
+ return zai.key.trim();
23233
+ } catch {
23234
+ }
23235
+ }
23236
+ return null;
23237
+ }
23238
+ function platformFromBaseUrl(baseUrl) {
23239
+ if (baseUrl.includes("api.z.ai"))
23240
+ return "ZAI";
23241
+ if (baseUrl.includes("open.bigmodel.cn") || baseUrl.includes("dev.bigmodel.cn"))
23242
+ return "ZHIPU";
23243
+ return null;
23244
+ }
23245
+ function readZaiCredentials(options = {}) {
23246
+ const openCodeToken = readOpenCodeAuthToken(options.openCodeDataDir);
23247
+ if (openCodeToken) {
23248
+ return {
23249
+ authToken: openCodeToken,
23250
+ baseUrl: DEFAULT_ZAI_BASE_URL,
23251
+ platform: "ZAI",
23252
+ source: "opencode"
23253
+ };
23254
+ }
23255
+ const env3 = options.env ?? process.env;
23256
+ const authToken = env3.ANTHROPIC_AUTH_TOKEN?.trim();
23257
+ const baseUrl = env3.ANTHROPIC_BASE_URL?.trim();
23258
+ if (!authToken || !baseUrl)
23259
+ return null;
23260
+ const platform4 = platformFromBaseUrl(baseUrl);
23261
+ if (!platform4)
23262
+ return null;
23263
+ return {
23264
+ authToken,
23265
+ baseUrl,
23266
+ platform: platform4,
23267
+ source: "env"
23268
+ };
23269
+ }
23270
+ function quotaLimitUrl(baseUrl) {
23271
+ try {
23272
+ const parsed = new URL(baseUrl);
23273
+ return `${parsed.protocol}//${parsed.host}${QUOTA_PATH}`;
23274
+ } catch {
23275
+ return null;
23276
+ }
23277
+ }
23278
+ function tokenLimitEntries(payload) {
23279
+ const limits = payload.data?.limits ?? payload.limits ?? [];
23280
+ return limits.filter((item) => item?.type === "TOKENS_LIMIT" && typeof item.percentage === "number");
23281
+ }
23282
+ function isFiveHourLimit(item) {
23283
+ return item.type === "TOKENS_LIMIT" && item.unit === 3 && item.number === 5;
23284
+ }
23285
+ function isWeeklyLimit(item) {
23286
+ return item.type === "TOKENS_LIMIT" && item.unit === 6 && item.number === 1;
23287
+ }
23288
+ function isoFromEpochMs(value) {
23289
+ if (value == null)
23290
+ return "";
23291
+ const ms = typeof value === "number" ? value : Number(value);
23292
+ if (!Number.isFinite(ms) || ms <= 0)
23293
+ return "";
23294
+ return new Date(ms).toISOString();
23295
+ }
23296
+ function displayPlanName(level) {
23297
+ if (!level)
23298
+ return "z.ai Coding Plan";
23299
+ return `z.ai ${level.charAt(0).toUpperCase()}${level.slice(1)}`;
23300
+ }
23301
+ function quotaStateFromZaiQuotaLimitPayload(payload, capturedAt = (/* @__PURE__ */ new Date()).toISOString()) {
23302
+ const data = payload;
23303
+ const tokenLimits = tokenLimitEntries(data);
23304
+ const fiveHourLimit = tokenLimits.find(isFiveHourLimit) ?? tokenLimits[0];
23305
+ const weeklyLimit = tokenLimits.find(isWeeklyLimit) ?? tokenLimits.find((item) => item !== fiveHourLimit);
23306
+ const level = data.data?.level;
23307
+ if (!fiveHourLimit || !weeklyLimit) {
23308
+ return unavailableZaiQuotaState("z.ai quota API returned no token quota windows.", {
23309
+ failureKind: "unknown"
23310
+ }, capturedAt);
23311
+ }
23312
+ return {
23313
+ fiveHour: {
23314
+ utilization: fiveHourLimit.percentage ?? 0,
23315
+ resetsAt: isoFromEpochMs(fiveHourLimit.nextResetTime)
23316
+ },
23317
+ sevenDay: {
23318
+ utilization: weeklyLimit.percentage ?? 0,
23319
+ resetsAt: isoFromEpochMs(weeklyLimit.nextResetTime)
23320
+ },
23321
+ available: true,
23322
+ providerId: "zai",
23323
+ source: "api",
23324
+ capturedAt,
23325
+ fiveHourLabel: "5-Hour",
23326
+ sevenDayLabel: "Weekly",
23327
+ planType: level,
23328
+ limitId: level ? `zai-${level}` : "zai-coding-plan",
23329
+ limitName: displayPlanName(level)
23330
+ };
23331
+ }
23332
+ function parseRetryAfterMs(retryAfter) {
23333
+ if (!retryAfter)
23334
+ return void 0;
23335
+ const seconds = Number(retryAfter);
23336
+ if (Number.isFinite(seconds) && seconds >= 0)
23337
+ return seconds * 1e3;
23338
+ const dateMs = Date.parse(retryAfter);
23339
+ if (Number.isFinite(dateMs))
23340
+ return Math.max(0, dateMs - Date.now());
23341
+ return void 0;
23342
+ }
23343
+ function failureKindForStatus(status) {
23344
+ if (status === 401 || status === 403)
23345
+ return "auth";
23346
+ if (status === 429)
23347
+ return "rate_limit";
23348
+ if (status >= 500)
23349
+ return "server";
23350
+ return "unknown";
23351
+ }
23352
+ function sanitizeErrorMessage(message, authToken) {
23353
+ let result = message;
23354
+ if (authToken) {
23355
+ result = result.split(authToken).join("<redacted>");
23356
+ }
23357
+ return result.replace(/Bearer\s+[A-Za-z0-9._~+/=-]+/g, "Bearer <redacted>");
23358
+ }
23359
+ async function fetchZaiQuotaFromApi(options = {}) {
23360
+ const capturedAt = options.capturedAt ?? (/* @__PURE__ */ new Date()).toISOString();
23361
+ const credentials = options.credentials ?? readZaiCredentials(options);
23362
+ if (!credentials) {
23363
+ return unavailableZaiQuotaState("No z.ai credentials found. Sign in to OpenCode with z.ai or set ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN.", { failureKind: "auth" }, capturedAt);
23364
+ }
23365
+ const url = quotaLimitUrl(credentials.baseUrl);
23366
+ if (!url) {
23367
+ return unavailableZaiQuotaState("Invalid z.ai base URL.", { failureKind: "unknown" }, capturedAt);
23368
+ }
23369
+ const fetchImpl = options.fetchImpl ?? fetch;
23370
+ const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
23371
+ const controller = new AbortController();
23372
+ const timeout = setTimeout(() => controller.abort(), timeoutMs);
23373
+ timeout.unref?.();
23374
+ try {
23375
+ const response = await fetchImpl(url, {
23376
+ method: "GET",
23377
+ headers: {
23378
+ Authorization: credentials.authToken,
23379
+ "Accept-Language": "en-US,en",
23380
+ Accept: "application/json",
23381
+ "Content-Type": "application/json"
23382
+ },
23383
+ signal: controller.signal
23384
+ });
23385
+ const body = await response.text();
23386
+ let parsed;
23387
+ try {
23388
+ parsed = JSON.parse(body);
23389
+ } catch {
23390
+ parsed = null;
23391
+ }
23392
+ if (!response.ok) {
23393
+ const failureKind = failureKindForStatus(response.status);
23394
+ const retryAfterMs = parseRetryAfterMs(response.headers.get("retry-after"));
23395
+ const detail = parsed && typeof parsed === "object" && "msg" in parsed ? String(parsed.msg ?? "") : "";
23396
+ const baseMessage = failureKind === "auth" ? `z.ai quota API rejected credentials (HTTP ${response.status}).` : `z.ai quota API error (HTTP ${response.status}).`;
23397
+ return unavailableZaiQuotaState(sanitizeErrorMessage([baseMessage, detail].filter(Boolean).join(" "), credentials.authToken), { failureKind, httpStatus: response.status, retryAfterMs }, capturedAt);
23398
+ }
23399
+ return quotaStateFromZaiQuotaLimitPayload(parsed, capturedAt);
23400
+ } catch (error) {
23401
+ const isAbort = error instanceof Error && error.name === "AbortError";
23402
+ return unavailableZaiQuotaState(isAbort ? "z.ai quota API timed out." : "z.ai quota API network error.", { failureKind: "network" }, capturedAt);
23403
+ } finally {
23404
+ clearTimeout(timeout);
23405
+ }
23406
+ }
23407
+ function enrichZaiQuota(state) {
23408
+ return {
23409
+ ...state,
23410
+ runtimeProvider: "zai",
23411
+ providerId: "zai",
23412
+ fiveHourLabel: state.fiveHourLabel ?? "5-Hour",
23413
+ sevenDayLabel: state.sevenDayLabel ?? "Weekly"
23414
+ };
23415
+ }
23416
+ async function resolveZaiQuota2(options = {}) {
23417
+ const accountId = options.accountId ?? DEFAULT_ACCOUNT_ID;
23418
+ const readSnapshot = options.readSnapshot ?? quotaSnapshots_1.readQuotaSnapshot;
23419
+ const writeSnapshot = options.writeSnapshot ?? quotaSnapshots_1.writeQuotaSnapshot;
23420
+ const apiQuota = await fetchZaiQuotaFromApi(options);
23421
+ if (apiQuota.available) {
23422
+ writeSnapshot("zai", accountId, apiQuota);
23423
+ return enrichZaiQuota(apiQuota);
23424
+ }
23425
+ const cached = readSnapshot("zai", accountId);
23426
+ if (cached) {
23427
+ return enrichZaiQuota({
23428
+ ...cached,
23429
+ providerId: "zai",
23430
+ source: "cache",
23431
+ stale: true,
23432
+ fiveHourLabel: cached.fiveHourLabel ?? "5-Hour",
23433
+ sevenDayLabel: cached.sevenDayLabel ?? "Weekly"
23434
+ });
23435
+ }
23436
+ return enrichZaiQuota(apiQuota);
23437
+ }
23438
+ }
23439
+ });
23440
+
23175
23441
  // ../sidekick-shared/dist/peakHours.js
23176
23442
  var require_peakHours = __commonJS({
23177
23443
  "../sidekick-shared/dist/peakHours.js"(exports) {
@@ -40942,8 +41208,8 @@ var require_dist = __commonJS({
40942
41208
  exports.highlightEvent = exports.formatSessionJson = exports.formatSessionMarkdown = exports.formatSessionText = exports.classifyNoise = exports.shouldMergeWithPrevious = exports.classifyFollowEvent = exports.classifyMessage = exports.getSoftNoiseReason = exports.isHardNoiseFollowEvent = exports.isHardNoise = exports.formatToolSummary = exports.formatTokenCount = exports.formatDurationMs = exports.createJsonlTail = exports.toFollowEvents = exports.createWatcher = exports.parseChangelog = exports.extractProposedPlanShared = exports.parsePlanMarkdownShared = exports.PlanExtractor = exports.segmentAssistantTurn = exports.reasoningSummary = exports.isAssistantTurnSubagentTool = exports.extractTurnSubagents = exports.assistantTurnEventsFromSessionEvents = exports.readSessionContextSnapshot = exports.createSessionContextProjector = exports.calculateSessionContextPressure = exports.buildSessionContextSnapshot = exports.composeContext = exports.FilterEngine = exports.searchSessions = exports.CodexDatabase = exports.OpenCodeDatabase = exports.discoverDebugLogs = exports.collapseDuplicates = exports.filterByLevel = exports.parseDebugLog = exports.scanSubagentTraces = exports.findAllSessionsWithWorktrees = exports.discoverWorktreeSiblings = exports.resolveWorktreeMainRepo = exports.getAllClaudeProjectFolders = exports.decodeEncodedPath = exports.getMostRecentlyActiveSessionDir = exports.findSubdirectorySessionDirs = exports.findSessionsInDirectory = exports.findAllClaudeSessions = exports.findActiveClaudeSession = void 0;
40943
41209
  exports.setActiveSavedAccount = exports.upsertSavedAccountProfile = exports.getActiveSavedAccount = exports.listSavedAccountProfiles = exports.writeSavedAccountRegistry = exports.readSavedAccountRegistry = exports.getAccountsDir = exports.resolveClaudeLoginCommand = exports.listAllAccounts = exports.switchAccount = exports.spawnAccountLogin = exports.finalizeAccountLogin = exports.getAccountLoginStatus = exports.beginAccountLogin = exports.isMultiAccountEnabled = exports.getActiveAccount = exports.listAccounts = exports.removeAccount = exports.reconcileClaudeAuthState = exports.applyActiveClaudeToLiveHome = exports.resolveActiveClaudeHome = exports.switchToAccount = exports.addCurrentAccount = exports.readActiveClaudeAccount = exports.writeAccountRegistry = exports.readAccountRegistry = exports.ensureDefaultAccounts = exports.readClaudeMaxAccessTokenSync = exports.readClaudeMaxCredentials = exports.writeActiveCredentials = exports.readActiveCredentials = exports.openInBrowser = exports.parseTranscriptFromEvents = exports.parseTranscript = exports.generateHtmlReport = exports.PatternExtractor = exports.HeatmapTracker = exports.FrequencyTracker = exports.getSnapshotPath = exports.isSnapshotValid = exports.deleteSnapshot = exports.loadSnapshot = exports.saveSnapshot = exports.parseTodoDependencies = exports.EventAggregator = exports.getRandomPhrase = exports.PHRASE_CATEGORIES = exports.ALL_PHRASES = exports.HIGHLIGHT_CSS = exports.clearHighlightCache = void 0;
40944
41210
  exports.isZaiProviderId = exports.inferZaiQuotaState = exports.extractNextFlushTime = exports.accumulateZaiUsage = exports.CodexQuotaWatcher = exports.resolveCodexQuotaFromLocalSources = exports.resolveCodexQuota = exports.readLatestCodexQuotaFromRollouts = exports.quotaFromCodexRateLimits = exports.fetchCodexQuotaFromApi = exports.getWorkspaceIdFromPath = exports.pruneQuotaHistory = exports.readQuotaHistoryDailyBuckets = exports.readQuotaHistoryRange = exports.appendQuotaHistorySample = exports.writeQuotaSnapshot = exports.readQuotaSnapshot = exports.QuotaPoller = exports.describeQuotaFailure = exports.fetchQuota = exports.AutoSwitchController = exports.decideAutoSwitch = exports.DEFAULT_AUTO_SWITCH_CONFIG = exports.removeLauncher = exports.writeLauncher = exports.isShellHookInstalled = exports.uninstallShellHook = exports.installShellHook = exports.setTerminalActiveProfile = exports.removeCodexAccount = exports.switchToCodexAccount = exports.finalizeCodexAccount = exports.prepareCodexAccount = exports.getCodexExecutionEnv = exports.resolveSidekickCodexHome = exports.getActiveCodexAccount = exports.listCodexAccounts = exports.getSystemCodexHome = exports.getCodexMonitoringHomes = exports.getCodexProfileHome = exports.getCodexProfilesDir = exports.readClaudeProfileIdentity = exports.isClaudeProfileAuthenticated = exports.claudeKeychainService = exports.claudeKeychainSuffix = exports.getClaudeProfileHome = exports.getClaudeProfilesDir = exports.getActiveAccountStatus = exports.removeSavedAccountProfile = exports.replaceSavedAccountProfiles = void 0;
40945
- exports.quotaFailureDescriptorSchema = exports.peakHoursStateSchema = exports.quotaSourceSchema = exports.quotaProviderIdSchema = exports.quotaFailureKindSchema = exports.quotaStateSchema = exports.quotaWindowSchema = exports.extractSessionEvents = exports.permissionModeSchema = exports.sessionEventSchema = exports.sessionMessageSchema = exports.messageUsageSchema = exports.gatherAssetsForCwd = exports.codexSessions = exports.readCodexAssets = exports.claudeSessions = exports.readClaudeAssets = exports.extractCommands = exports.extractFilePaths = exports.extractUrls = exports.extractToolCalls = exports.extractToolCall = exports.extractTokenUsage = exports.LITELLM_CATALOG_URL = exports.normalizeLiteLlmCatalog = exports.hydratePricingCatalog = exports.formatCost = exports.sortModelIds = exports.compareModelIds = exports.getModelDisplayInfo = exports.shortModelName = exports.mergeCostSources = exports.calculateCostWithProvenance = exports.calculateCostWithPricing = exports.calculateCost = exports.getModelInfo = exports.getModelPricing = exports.parseModelId = exports.DEFAULT_CONTEXT_WINDOW = exports.getModelContextWindowSize = exports.MultiProviderQuotaService = exports.ZaiQuotaWatcher = exports.ZAI_TIER_BUDGETS = exports.ZAI_PROVIDER_IDS = exports.ZAI_PROMPT_INVOCATIONS = exports.turnTokenWeight = exports.rowsToZaiTurnsAndErrors = exports.resolveZaiTier = exports.parseZaiQuotaError = exports.makeUnavailableZaiQuotaState = void 0;
40946
- exports.scopePeakHoursToSessionProvider = exports.isClaudeCodeSessionProvider = exports.fetchPeakHoursStatus = exports.createPeakHoursNotApplicableState = exports.fetchOpenAIStatus = exports.fetchProviderStatus = exports.assistantTurnToolRefSchema = exports.assistantTurnToolGroupStepSchema = exports.assistantTurnTimelineItemSchema = exports.assistantTurnSubagentStatusSchema = exports.assistantTurnSubagentSchema = exports.assistantTurnReasoningTimelineItemSchema = exports.assistantTurnProjectionSchema = exports.assistantTurnProcessStepSchema = exports.assistantTurnProcessSchema = exports.assistantTurnNarrationStepSchema = exports.assistantTurnEventTypeSchema = exports.assistantTurnEventSchema = exports.listAllAccountsResultSchema = exports.savedAccountProfileSchema = exports.accountEntrySchema = exports.accountLoginStatusSchema = exports.beginAccountLoginResultSchema = exports.accountManagerResultSchema = exports.accountProviderIdSchema = exports.activeAccountStatusSchema = exports.activeProviderAccountStatusSchema = exports.quotaHistoryDailyBucketSchema = exports.quotaHistorySampleSchema = exports.quotaHistoryRuntimeProviderSchema = exports.providerQuotaMapSchema = exports.zaiProviderQuotaStateSchema = exports.codexProviderQuotaStateSchema = exports.claudeProviderQuotaStateSchema = exports.providerQuotaStateSchema = exports.runtimeQuotaProviderSchema = void 0;
41211
+ exports.quotaFailureKindSchema = exports.quotaStateSchema = exports.quotaWindowSchema = exports.extractSessionEvents = exports.permissionModeSchema = exports.sessionEventSchema = exports.sessionMessageSchema = exports.messageUsageSchema = exports.gatherAssetsForCwd = exports.codexSessions = exports.readCodexAssets = exports.claudeSessions = exports.readClaudeAssets = exports.extractCommands = exports.extractFilePaths = exports.extractUrls = exports.extractToolCalls = exports.extractToolCall = exports.extractTokenUsage = exports.LITELLM_CATALOG_URL = exports.normalizeLiteLlmCatalog = exports.hydratePricingCatalog = exports.formatCost = exports.sortModelIds = exports.compareModelIds = exports.getModelDisplayInfo = exports.shortModelName = exports.mergeCostSources = exports.calculateCostWithProvenance = exports.calculateCostWithPricing = exports.calculateCost = exports.getModelInfo = exports.getModelPricing = exports.parseModelId = exports.DEFAULT_CONTEXT_WINDOW = exports.getModelContextWindowSize = exports.MultiProviderQuotaService = exports.resolveZaiQuota = exports.readZaiCredentials = exports.quotaStateFromZaiQuotaLimitPayload = exports.fetchZaiQuotaFromApi = exports.ZaiQuotaWatcher = exports.ZAI_TIER_BUDGETS = exports.ZAI_PROVIDER_IDS = exports.ZAI_PROMPT_INVOCATIONS = exports.turnTokenWeight = exports.rowsToZaiTurnsAndErrors = exports.resolveZaiTier = exports.parseZaiQuotaError = exports.makeUnavailableZaiQuotaState = void 0;
41212
+ exports.scopePeakHoursToSessionProvider = exports.isClaudeCodeSessionProvider = exports.fetchPeakHoursStatus = exports.createPeakHoursNotApplicableState = exports.fetchOpenAIStatus = exports.fetchProviderStatus = exports.assistantTurnToolRefSchema = exports.assistantTurnToolGroupStepSchema = exports.assistantTurnTimelineItemSchema = exports.assistantTurnSubagentStatusSchema = exports.assistantTurnSubagentSchema = exports.assistantTurnReasoningTimelineItemSchema = exports.assistantTurnProjectionSchema = exports.assistantTurnProcessStepSchema = exports.assistantTurnProcessSchema = exports.assistantTurnNarrationStepSchema = exports.assistantTurnEventTypeSchema = exports.assistantTurnEventSchema = exports.listAllAccountsResultSchema = exports.savedAccountProfileSchema = exports.accountEntrySchema = exports.accountLoginStatusSchema = exports.beginAccountLoginResultSchema = exports.accountManagerResultSchema = exports.accountProviderIdSchema = exports.activeAccountStatusSchema = exports.activeProviderAccountStatusSchema = exports.quotaHistoryDailyBucketSchema = exports.quotaHistorySampleSchema = exports.quotaHistoryRuntimeProviderSchema = exports.providerQuotaMapSchema = exports.zaiProviderQuotaStateSchema = exports.codexProviderQuotaStateSchema = exports.claudeProviderQuotaStateSchema = exports.providerQuotaStateSchema = exports.runtimeQuotaProviderSchema = exports.quotaFailureDescriptorSchema = exports.peakHoursStateSchema = exports.quotaSourceSchema = exports.quotaProviderIdSchema = void 0;
40947
41213
  var taskPersistence_1 = require_taskPersistence();
40948
41214
  Object.defineProperty(exports, "TASK_PERSISTENCE_SCHEMA_VERSION", { enumerable: true, get: function() {
40949
41215
  return taskPersistence_1.TASK_PERSISTENCE_SCHEMA_VERSION;
@@ -41639,6 +41905,19 @@ var require_dist = __commonJS({
41639
41905
  Object.defineProperty(exports, "ZaiQuotaWatcher", { enumerable: true, get: function() {
41640
41906
  return zaiQuotaWatcher_1.ZaiQuotaWatcher;
41641
41907
  } });
41908
+ var zaiQuotaApi_1 = require_zaiQuotaApi();
41909
+ Object.defineProperty(exports, "fetchZaiQuotaFromApi", { enumerable: true, get: function() {
41910
+ return zaiQuotaApi_1.fetchZaiQuotaFromApi;
41911
+ } });
41912
+ Object.defineProperty(exports, "quotaStateFromZaiQuotaLimitPayload", { enumerable: true, get: function() {
41913
+ return zaiQuotaApi_1.quotaStateFromZaiQuotaLimitPayload;
41914
+ } });
41915
+ Object.defineProperty(exports, "readZaiCredentials", { enumerable: true, get: function() {
41916
+ return zaiQuotaApi_1.readZaiCredentials;
41917
+ } });
41918
+ Object.defineProperty(exports, "resolveZaiQuota", { enumerable: true, get: function() {
41919
+ return zaiQuotaApi_1.resolveZaiQuota;
41920
+ } });
41642
41921
  var multiProviderQuotaService_1 = require_multiProviderQuotaService();
41643
41922
  Object.defineProperty(exports, "MultiProviderQuotaService", { enumerable: true, get: function() {
41644
41923
  return multiProviderQuotaService_1.MultiProviderQuotaService;
@@ -44123,7 +44402,7 @@ var init_UpdateCheckService = __esm({
44123
44402
  /** Run the update check (one-shot). */
44124
44403
  async check() {
44125
44404
  try {
44126
- const current = "0.21.1";
44405
+ const current = "0.21.2";
44127
44406
  const cached = this.readCache();
44128
44407
  let latest;
44129
44408
  if (cached && Date.now() - cached.checkedAt < CACHE_TTL_MS) {
@@ -84740,7 +85019,7 @@ function StatusBar({
84740
85019
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: parseBlessedTags(BRAND_INLINE) }),
84741
85020
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { dimColor: true, children: [
84742
85021
  " v",
84743
- "0.21.1"
85022
+ "0.21.2"
84744
85023
  ] }),
84745
85024
  updateInfo && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: "yellow", children: [
84746
85025
  " (v",
@@ -85130,7 +85409,7 @@ function ChangelogOverlay({ entries, scrollOffset }) {
85130
85409
  " ",
85131
85410
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { bold: true, color: "cyan", children: [
85132
85411
  "Terminal Dashboard v",
85133
- "0.21.1"
85412
+ "0.21.2"
85134
85413
  ] }),
85135
85414
  latestDate ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { color: "gray", children: [
85136
85415
  " \u2014 ",
@@ -85452,7 +85731,7 @@ var init_mouse = __esm({
85452
85731
  var CHANGELOG_default;
85453
85732
  var init_CHANGELOG = __esm({
85454
85733
  "CHANGELOG.md"() {
85455
- CHANGELOG_default = '# Changelog\n\nAll notable changes to the Sidekick Agent Hub CLI will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## [0.21.1] - 2026-06-21\n\n### Added\n\n- **z.ai Coding Plan quota**: `sidekick quota --provider zai` derives and renders z.ai plan utilization from OpenCode traffic already on disk (5-Hour / Weekly windows with per-tier prompt budgets). `--tier lite|pro|max|auto` overrides the assumed plan tier (default `auto`). `sidekick quota --provider opencode` now auto-routes to z.ai quota when z.ai traffic is detected. `sidekick quota --all` includes the z.ai section when active\n- **z.ai quota history heatmap**: `sidekick quota history --provider zai` renders a 13-week z.ai utilization heatmap for the current workspace, alongside the existing Claude and Codex heatmaps (now also in `--all`)\n\n### Changed\n\n- **Bundled `sidekick-shared` 0.21.1**: Picks up z.ai quota derivation and the OpenCode data directory resolution fix.\n\n### Limitations\n\n- z.ai quota is **estimated, not authoritative** \u2014 it reflects only the OpenCode traffic Sidekick observed on this machine/workspace (z.ai exposes no usage API) compared against provisional per-tier prompt budgets. z.ai is observed-only (no z.ai inference provider) and has no account management yet; with `--tier auto`, the tier is under-detected early in a cycle (use an explicit `--tier`); reset times are approximate unless a rate-limit error is trapped.\n\n## [0.21.0] - 2026-06-21\n\n### Added\n\n- **Account login**: `sidekick account --login` starts the provider-isolated login flow for Claude Max or Codex and saves the authenticated profile without disturbing the active account until finalization\n- **All-provider account view**: `sidekick account --provider all` lists Claude and Codex saved accounts together, including active state. JSON output returns provider-keyed account arrays and active ids\n- **Terminal account helpers**: `sidekick account --launcher <name>` creates opt-in launchers for the selected account, and `--auto-switch <pct|off>` persists the CLI auto-switch threshold preference\n- **Multi-provider quota output**: `sidekick quota --all` shows Claude and Codex quota state together \u2014 each provider degrades independently, so one provider\'s quota still prints even when the other is unavailable; `--all --json` emits a provider-keyed payload for automation\n\n### Changed\n\n- **Bundled `sidekick-shared` 0.21.0**: Picks up Account Management 2.0 acquisition, switching, terminal sync, quota auto-switch, and account schema exports.\n\n## [0.20.0] - 2026-06-17\n\n### Added\n\n- **`sidekick extract`**: New one-shot command for pulling actionable assets out of recent Claude Code and Codex chats for exactly the current cwd. It extracts URLs, filesystem-validated file paths, commands the agent suggested for the user to run, and plan-mode plans. Output is grouped and colored by default, labels each item with its source agent, validates invalid `--type` and `--limit` values, preserves `inChat` and per-item provenance in `--json`, and offers `-i/--interactive` for a picker that opens URLs or copies selected paths, commands, and plans. `--provider claude-code` and `--provider codex` scope extraction to one agent; OpenCode is reported as unsupported for now\n\nThanks to [@B33pBeeps](https://github.com/B33pBeeps) (Juan Fourie) for contributing this feature in [#17](https://github.com/cesarandreslopez/sidekick-agent-hub/pull/17), adapted from his MIT-licensed [`trawl`](https://github.com/B33pBeeps/trawl) project.\n\n## [0.19.3] - 2026-06-17\n\n### Changed\n\n- **Bundled `sidekick-shared` projection contract**: The shared assistant-turn projection now exposes a v2 `timeline` array for interleaved reasoning, narration, and tool groups. This is a shared-library contract update for downstream consumers and does not change CLI behavior by itself\n\n## [0.19.2] - 2026-06-15\n\n### Changed\n\n- **Bundled `sidekick-shared` 0.19.2**: The shared library gains a browser-safe assistant-turn projection module (`segmentAssistantTurn()`, `assistantTurnEventsFromSessionEvents()`, and mirrored Zod schemas) that segments an assistant turn into a compact Process + Answer shape, with Claude `Task` subagent refs surfaced without leaking prompt text \u2014 internal additions that don\'t change CLI behavior\n\n## [0.19.1] - 2026-06-09\n\n### Changed\n\n- **Bundled `sidekick-shared` 0.19.1**: Model-ID pricing and context-window lookups (behind the dashboard\'s cost and context gauges) now tolerate padded or mixed-case IDs. The shared library also gains Zod boundary schemas, an `extractSessionEvents()` progress-unwrapping helper, and a `/schemas` subpath export for downstream consumers \u2014 internal additions that don\'t change CLI behavior\n\n## [0.19.0] - 2026-06-09\n\n### Added\n\n- **Claude Opus 4.8 & Fable 5 support**: The dashboard\'s context-window gauge and cost estimates recognize `claude-opus-4-8` and `claude-fable-5` (both 1M-token context; Opus 4.8: $5/$25 per MTok, Fable 5: $10/$50 per MTok) via the shared model catalog\n\n### Changed\n\n- **Codex account switching now swaps `~/.codex/auth.json`**: `sidekick account --provider codex --switch-to <id>` (and `--add`) activates the account by atomically swapping its backed-up credentials into the system `~/.codex/` home, mirroring the Claude switch pattern \u2014 codex terminals outside Sidekick pick up the switch. Profile directories become pure credential backups, with a one-time startup migration for installs created under the old `CODEX_HOME`-redirection model. The command surfaces swap warnings on add, switch, and remove: a running codex process that needs restarting, stale credentials, or OS-keyring credential storage that Sidekick cannot swap\n\n### Fixed\n\n- **Opus 4.6/4.7 cost over-estimation**: Dashed model IDs fell back to the Opus 4.0 pricing tier ($15/$75 instead of $5/$25), inflating estimated costs 3\xD7\n- **Haiku 4.5 unpriced under dashed IDs**: Costs for `claude-haiku-4-5-*` sessions could render as "\u2014" because no dashed static pricing key existed\n\n## [0.18.5] - 2026-06-04\n\n### Changed\n\n- **Consistent Codex transcripts**: `sidekick dashboard` and `sidekick report` now parse Codex sessions via `parseTranscriptFromEvents()`, matching the canonical `SessionEvent` pipeline used by the other providers\n- **Bundled `sidekick-shared` 0.18.5**: Picks up the new session context evidence snapshot API (`buildSessionContextSnapshot`, `readSessionContextSnapshot`, `SessionContextSnapshot` and related types) and the Codex session evidence gap closures \u2014 `system` audit events, normalized `token_count` rate limits, per-file `apply_patch` expansion, tool-emission dedupe, MCP server attribution, and the new `ProviderReaderSessionWatcher`\n\n## [0.18.4] - 2026-05-27\n\n### Added\n\n- **`sidekick peak --provider <id>`**: New flag gates peak-hours output on the session provider. When the resolved provider is not `claude-code`, the command prints a "not applicable" message instead of calling the upstream endpoint\n\n### Changed\n\n- **Bundled `sidekick-shared` 0.18.4**: Picks up `scopePeakHoursToSessionProvider()`, `isClaudeCodeSessionProvider()`, `createPeakHoursNotApplicableState()` for peak-hours scoping, the improved Codex quota snapshot selection logic (`isPreferredQuotaHit`, `findAccountRolloutFiles`, `shouldKeepExistingSnapshot`), and the `notApplicable` field on `PeakHoursState`\n\n## [0.18.3] - 2026-05-19\n\n### Added\n\n- **`sidekick quota history`**: New subcommand that renders a 13-week GitHub-contributions-style heatmap of quota utilization for the current workspace. Flags: `--weeks <n>` (1-26, default 13), `--provider claude|codex` (default both), `--workspace <path>` (default cwd). Bucketed glyphs (`\xB7 \u2591 \u2592 \u2593 \u2588`) are color-coded by utilization band (\u22640 / <25 / <50 / <75 / \u226575), with per-provider rows and a peak / avg / unavailable-days / samples footer. Days that hit `available: false` render as a red `\xD7`. With `--json`, emits a `{ workspaceId, weeks, providers: { claude?, codex? }, generatedAt }` payload \u2014 the same shape consumed by the VS Code dashboard\n\n### Changed\n\n- **Bundled `sidekick-shared` 0.18.3**: Picks up the new per-workspace quota history surface (`appendQuotaHistorySample`, `readQuotaHistoryRange`, `readQuotaHistoryDailyBuckets`, `pruneQuotaHistory`, `getWorkspaceIdFromPath`) and the optional `workspaceId` / `appendHistorySample` hooks on `CodexQuotaWatcher`\n\n## [0.18.2] - 2026-05-19\n\n### Added\n\n- **`sidekick quota --refresh`**: New flag on the `quota` command that, for Codex, explicitly refreshes from the ChatGPT usage API before falling back to local rollout data and cached snapshots. Without the flag, the Codex quota path stays fully local and makes no upstream network call\n\n### Changed\n\n- **Codex quota is local-only by default**: `sidekick quota --provider codex` now delegates to the new `resolveCodexQuota` orchestrator in `sidekick-shared`. It checks the current workspace\'s most recent rollout, then recent account-level rollouts under `CODEX_HOME/sessions`, then the active account\'s cached snapshot \u2014 no upstream network call unless `--refresh` is passed. Failure output continues to include structured `failureKind` / `httpStatus` / `retryAfterMs` fields under `--json`\n- **Bundled `sidekick-shared` 0.18.2**: Picks up the new Codex quota orchestrator (`resolveCodexQuota`, `resolveCodexQuotaFromLocalSources`, `readLatestCodexQuotaFromRollouts`, `fetchCodexQuotaFromApi`), the relaxed `CodexRateLimits` shape (nullable `resets_at` / `window_minutes`), the rate-limit-only `token_count` event emission in `JsonlSessionWatcher`, and `state_N.sqlite` discovery in `CodexDatabase` + provider auto-detect\n\n## [0.18.1] - 2026-05-08\n\n### Changed\n\n- **Shared dashboard formatting**: terminal dashboard `fmtNum()` and `formatDuration()` now delegate to `formatTokenCount()` and `formatDurationMs()` from `sidekick-shared`, keeping the existing CLI surface (uppercase `K`/`M` suffix, compact `1m5s` style) while removing forked rounding logic\n\n## [0.18.0] - 2026-05-08\n\n### Changed\n\n- **Bundled `sidekick-shared` 0.18.0**: Picks up the new provider-aware quota orchestration surface \u2014 `MultiProviderQuotaService`, `CodexQuotaWatcher`, `getActiveAccountStatus()`, `extractToolCall()`, cost-provenance helpers (`calculateCostWithProvenance`, `mergeCostSources`), and model display helpers (`shortModelName`, `getModelDisplayInfo`, `compareModelIds`, `sortModelIds`). `parseModelId()` also now recognizes legacy Claude IDs such as `claude-3-opus-20240229` and `claude-3-5-sonnet-20241022`\n- **No CLI runtime changes**: This release ships the shared library upgrade for downstream tooling alignment; `sidekick quota`, `sidekick status`, and the live dashboard keep using the existing polling path. Wiring the new orchestrator into the CLI will land in a follow-up release\n\n## [0.17.7] - 2026-04-28\n\n### Fixed\n\n- **Quota snapshot write race**: Updated the bundled `sidekick-shared` snapshot writer so concurrent `sidekick quota` / Codex session updates no longer collide on `quota-snapshots.json.tmp` or throw `ENOENT`. Failed writes now also clean up their partial temp files instead of leaving orphans in `~/.config/sidekick/`\n\n## [0.17.6] - 2026-04-19\n\n### Added\n\n- **`sidekick peak` command**: One-shot check for Claude\'s current peak-hours state \u2014 weekdays 13:00\u201319:00 UTC, when session limits drain faster on Free/Pro/Max/Team subscriptions. Prints a color-coded status block with a countdown to the next transition. Data comes from the public `promoclock.co/api/status` endpoint (third-party, unaffiliated with Anthropic) with a graceful fallback when unreachable. `--json` emits the full raw state\n- **Peak-hours block in `sidekick status`**: When the active provider is `claude-code`, the Claude + OpenAI health blocks are now followed by a **Claude Peak Hours** block (off-peak or in-peak, with countdown). Gated on the provider so OpenCode / Codex users don\'t trigger an unnecessary third-party fetch. `--json` output includes the new `peak` field\n- **Peak-hours summary in `sidekick quota`**: Claude subscription quota output now shows a **Peak** line under the 5-hour / 7-day bars \u2014 green dot off-peak, orange dot during an active peak, with a countdown to the next transition. `--json` output includes the new `peak` field\n\n## [0.17.5] - 2026-04-18\n\n### Added\n\n- **Default account bootstrap at CLI startup**: The CLI now calls `ensureDefaultAccounts()` from `sidekick-shared` at module load and awaits the result inside a Commander `preAction` hook, so the first real subcommand blocks briefly on the bootstrap while `--version` and `--help` stay instant. When a system Claude Code or Codex credential exists and no saved account is active for that provider yet, the CLI registers it as "Default" \u2014 `sidekick quota`, `sidekick account`, and `sidekick stats` now reflect the active account on first run without requiring an explicit `sidekick account --add` first. Idempotent, never overwrites manually saved accounts, and all errors are swallowed so startup is never blocked\n\nThanks to [@B33pBeeps](https://github.com/B33pBeeps) (Juan Fourie) for contributing this feature in [#16](https://github.com/cesarandreslopez/sidekick-agent-hub/pull/16).\n\n## [0.17.4] - 2026-04-17\n\n### Changed\n\n- **Pricing hydration import migrated to `sidekick-shared/node`**: `cli.ts` now imports `hydratePricingCatalog` from the new Node-only subpath and keeps `detectProvider` on the package root. Runtime behavior is unchanged; the split makes the CLI\'s import surface self-documenting (hydration is explicitly a Node API) and aligns the CLI with the shared library\'s new versioned public API contract\n\n## [0.17.3] - 2026-04-17\n\n### Changed\n\n- **Version sync with the VS Code extension**: Republished to keep CLI, extension, and shared-library versions aligned after a cosmetic changelog fix in 0.17.3. No CLI code changes \u2014 functionally identical to 0.17.2\n\n## [0.17.2] - 2026-04-17\n\n### Added\n\n- **LiteLLM pricing hydration on startup**: The CLI now fetches the LiteLLM pricing catalog on startup and caches to `~/.config/sidekick/pricing-catalog.json` with a 24-hour TTL, 3s timeout, and stale-cache fallback \u2014 new model prices are picked up without a CLI upgrade\n- **Expanded pricing coverage**: GPT-4o, GPT-4.1, GPT-5.x, o1, o3, and o3-mini families are now priced alongside the existing Claude entries\n- **Real-dollar Codex / Claude Code costs**: `EventAggregator` computes cost from the pricing table when the session provider doesn\'t report one, so `sidekick` live dashboards now show actual dollars for Codex and Claude Code sessions\n- **`stats` footer lists unpriced models**: `sidekick stats` prints any models encountered with no pricing entry so missing coverage is visible\n\n### Fixed\n\n- **Context-gauge % wrong for Opus 4.7 (1M) and other new models**: The dashboard\'s context gauge was dividing by 200K for Claude Opus 4.7 (native 1M), inflating the displayed %. The shared model \u2192 context-window map now includes Opus/Sonnet 4.7 (1M), GPT-5.4 (1.05M), GPT-5.3-Codex (400K), and GPT-5.3-Codex-Spark (128K). Claude Code\'s `[1m]` suffix is now also honored as an explicit 1M marker\n- **Silent Sonnet-priced fallback for unknown models**: Codex, GPT-5.x, and o-series rows were being rendered at Sonnet rates. Unknown-model rows now render as `\u2014` in yellow instead of inventing a dollar figure\n\n### Changed\n\n- **`historical-data.json` schema v2**: reads `priced` flag and `unpricedModelIds` from records written by the latest VS Code extension; v1 records still read correctly\n\n## [0.17.1] - 2026-04-13\n\n### Fixed\n\n- **Codex multi-home session discovery**: Provider detection now scans all candidate Codex home directories, fixing missed sessions when the managed profile home is empty but the system `~/.codex/` has activity\n\n## [0.17.0] - 2026-04-13\n\n### Added\n\n- **Multi-provider account management**: `sidekick account` now supports `--provider codex` for Codex profile management alongside Claude Code accounts\n- **Codex account lifecycle**: `--add` prepares a profile and spawns `codex login`; `--switch-to` and `--remove` accept email, label, or profile ID\n- **Quota snapshot fallback**: `sidekick quota` for Codex shows cached rate-limit snapshots when no active session exists, with "cached from" timestamp\n\n### Fixed\n\n- **Email normalization**: Claude account lookup normalizes email case for reliable matching\n\n## [0.16.1] - 2026-03-27\n\n### Fixed\n\n- **Dashboard provider status scoping**: The TUI now shows degraded-service notices only for the monitored provider \u2014 Claude for Claude Code sessions, OpenAI for Codex sessions, and no status banner for OpenCode\n\n## [0.16.0] - 2026-03-23\n\n### Changed\n\n- **Consistent cost formatting**: All cost displays (`stats`, `context`, Sessions panel, narrative prompt) now use shared `formatCost()` with intelligent decimal precision (4 places for < $0.01, 2 otherwise)\n- **QuotaService**: Rewritten to wrap shared `QuotaPoller` with exponential backoff instead of manual polling loop\n- **modelContext**: Now re-exports `getModelInfo` from shared library alongside `getContextWindowSize`\n\n## [0.15.2] - 2026-03-18\n\n### Fixed\n\n- **CLI help descriptions**: Updated `quota` and `status` command descriptions to reflect provider-aware behavior\n- **`sidekick quota --provider`**: Added local `--provider` option so `sidekick quota --provider codex` works naturally\n\n## [0.15.0] - 2026-03-18\n\n### Added\n\n- **OpenAI status page monitoring**: CLI dashboard now shows OpenAI API status alongside Claude API status\n- **Codex rate limits in dashboard**: Sessions panel displays Codex rate-limit data with "Rate Limits" header instead of "Quota"\n- **Provider-aware `sidekick quota` command**: Detects active provider and shows Codex rate limits, Claude subscription quota, or an informational message for OpenCode\n\n### Fixed\n\n- **QuotaService polling for Codex**: Dashboard no longer starts Claude OAuth quota polling when the active provider is Codex\n\n## [0.14.2] - 2026-03-16\n\n### Fixed\n\n- **Quota polling interval**: Reduced quota refresh from every 30 seconds to every 5 minutes to avoid unnecessary API calls\n- **SessionsPanel `detailWidth()` call**: Removed unused parameter from `detailWidth()` in the Sessions panel quota rendering\n\n## [0.14.1] - 2026-03-14\n\n### Fixed\n\n- **Per-model context window sizes**: Dashboard context gauge now shows correct utilization for Claude Opus 4.6 (1M context) and other models with non-200K windows\n\n### Changed\n\n- **Shared model context lookup**: CLI dashboard now uses the centralized `getModelContextWindowSize()` from `sidekick-shared` instead of a local duplicate map\n\n## [0.14.0] - 2026-03-12\n\n### Added\n\n- **`sidekick account` Command**: Manage Claude Code accounts from the terminal \u2014 list saved accounts, add the current account with an optional label, switch to the next or a specific account, and remove accounts. Supports `--json` output for scripting\n- **Quota Account Label**: `sidekick quota` now shows the active account email and label above the quota bars when multi-account is enabled\n- **macOS Keychain Support**: `sidekick account` and `sidekick quota` now read and write credentials via the system Keychain on macOS, fixing account switching and quota checks on Mac\n\n## [0.13.8] - 2026-03-12\n\n### Changed\n\n- **Structured quota failure output**: `sidekick quota` now renders consistent auth, rate-limit, server, network, and unexpected-failure copy from shared quota failure descriptors while preserving `--json` machine-readable output\n- **Dashboard unavailable quota rendering**: The Sessions panel now shows Claude Code quota failures inline instead of hiding the quota section whenever subscription data is unavailable\n- **Quota transition toasts**: The Ink dashboard now fires low-noise toast notifications only when Claude Code quota failure state changes, avoiding repeated alerts every polling interval\n\n## [0.13.7] - 2026-03-11\n\n### Changed\n\n- **npm README sync**: Updated the published CLI package README to reflect current OpenCode monitoring behavior, platform-specific data directories, and the `sqlite3` runtime requirement\n- **README badge cleanup**: Removed the Ask DeepWiki badge from the published CLI package README; the repo root README still keeps it\n\n## [0.13.6] - 2026-03-11\n\n### Changed\n\n- **Refreshed CLI Dashboard Wordmark**: Updated the dashboard wordmark/header styling for a cleaner splash and dashboard identity\n\n### Fixed\n\n- **OpenCode dashboard startup**: OpenCode DB-backed session discovery now resolves projects by worktree, sandboxes, and session directory instead of quietly behaving like no session exists\n- **OpenCode runtime notices**: The CLI now prints an OpenCode-only actionable notice when `opencode.db` exists but `sqlite3` is missing, blocked, or otherwise unusable in the current shell environment\n\n## [0.13.5] - 2026-03-10\n\n### Added\n\n- **`sidekick status` Command**: One-shot Claude API status check with color-coded text output and `--json` mode\n- **Dashboard Status Banner**: Status bar shows a colored `\u25CF API minor/major/critical` indicator when Claude is degraded; Sessions panel Summary tab shows an "API Status" section with affected components and active incident details. Polls every 60s\n\n## [0.13.4] - 2026-03-08\n\n### Fixed\n\n- **Onboarding Phrase Spam**: Splash screen and detail pane motivational phrases memoized \u2014 no longer flicker every render tick (fixes [#13](https://github.com/cesarandreslopez/sidekick-agent-hub/issues/13))\n\n### Changed\n\n- **Simplified Logo**: Replaced 6-line ASCII robot art with compact text header in splash, help, and changelog overlays\n- **Removed Dead Code**: Removed unused `getSplashContent()` and `HELP_HEADER` exports from branding module\n\n## [0.13.3] - 2026-03-04\n\n_No CLI-specific changes in this release._\n\n## [0.13.2] - 2026-03-04\n\n_No CLI-specific changes in this release._\n\n## [0.13.1] - 2026-03-04\n\n### Added\n\n- **`sidekick quota` Command**: One-shot subscription quota check showing 5-hour and 7-day utilization with color-coded progress bars and reset countdowns \u2014 supports `--json` for machine-readable output\n- **Quota Projections**: Elapsed-time projections shown in `sidekick quota` output and TUI dashboard quota section \u2014 displays projected end-of-window utilization next to current value (e.g., `40% \u2192 100%`), included in `--json` output as `projectedFiveHour` / `projectedSevenDay`\n\n## [0.13.0] - 2026-03-03\n\n_No CLI-specific changes in this release._\n\n## [0.12.10] - 2026-03-01\n\n### Added\n\n- **Events Panel** (key 7): Scrollable live event stream with colored type badges (`[USR]`, `[AST]`, `[TOOL]`, `[RES]`), timestamps, and keyword-highlighted summaries; detail tabs for full event JSON and surrounding context\n- **Charts Panel** (key 8): Tool frequency horizontal bars, event type distribution, 60-minute activity heatmap using `\u2591\u2592\u2593\u2588` intensity characters, and pattern analysis with frequency bars and template text\n- **Multi-Mode Filter**: `/` filter overlay now supports four modes \u2014 substring, fuzzy, regex, and date range \u2014 Tab cycles modes, regex mode shows red validation errors\n- **Search Term Highlighting**: Active filter terms highlighted in blue within side list items\n- **Timeline Keyword Coloring**: Event summaries in the Sessions panel Timeline tab now use semantic keyword coloring \u2014 errors red, success green, tool names cyan, file paths magenta\n\n### Removed\n\n- **Search Panel**: Removed redundant Search panel (previously key 7) \u2014 the `/` filter with multi-mode support serves the same purpose\n\n## [0.12.9] - 2026-02-28\n\n### Added\n\n- **Standalone Data Commands**: `sidekick tasks`, `sidekick decisions`, `sidekick notes`, `sidekick stats`, `sidekick handoff` for accessing project data without launching the TUI\n- **`sidekick search <query>`**: Cross-session full-text search from the terminal\n- **`sidekick context`**: Composite output of tasks, decisions, notes, and handoff for piping into other tools\n- **`--list` flag on `sidekick dump`**: Discover available session IDs before requiring `--session <id>`\n- **Search Panel**: Search panel (panel 7) wired into the TUI dashboard\n\n### Changed\n\n- **`taskMerger` utility**: Duplicate `mergeTasks` logic extracted into shared `taskMerger` utility\n- **Model constants**: Hardcoded model IDs extracted to named constants\n\n### Fixed\n\n- **`convention` icon**: Notes panel icon replaced with valid `tip` type\n- **Linux clipboard**: Now supports Wayland (`wl-copy`) and `xsel` fallbacks, with error messages instead of silent failure\n- **`provider.dispose()`**: Added to `dump` and `report` commands (prevents SQLite connection leaks)\n\n## [0.12.8] - 2026-02-28\n\n### Changed\n\n- **Dashboard UI/UX Polish**: Visual overhaul for better hierarchy, consistency, and readability\n - Splash screen and help overlay now display the robot ASCII logo\n - Toast notifications show severity icons (\u2718 error, \u26A0 warning, \u25CF info) with inner padding\n - Focused pane uses double-border for clear focus indication\n - Section dividers (`\u2500\u2500 Title \u2500\u2500\u2500\u2500`) replace bare bold headers in summary, agents, and context attribution\n - Tab bar: active tab underlined in magenta, inactive tabs dimmed, bracket syntax removed\n - Status bar: segmented layout with `\u2502` separators; keys bold, labels dim\n - Summary metrics condensed: elapsed/events/compactions on one line, tokens on one line with cache rate and cost\n - Sparklines display peak metadata annotations\n - Progress bars use blessed color tags for consistent coloring\n - Help overlay uses dot-leader alignment for all keybinding rows\n - Empty state hints per panel (e.g. "Tasks appear as your agent works.")\n - Session picker groups sessions by provider with section headers when multiple providers are present\n\n## [0.12.7] - 2026-02-27\n\n### Added\n\n- **HTML Session Report**: `sidekick report` command generates a self-contained HTML report and opens it in the default browser\n - Options: `--session`, `--output`, `--theme` (dark/light), `--no-open`, `--no-thinking`\n - TUI Dashboard: press `r` to generate and open an HTML report for the current session\n\n## [0.12.6] - 2026-02-26\n\n### Added\n\n- **Session Dump Command**: `sidekick dump` exports session data in text, markdown, or JSON format with `--format`, `--width`, and `--expand` options\n- **Plans Panel Re-enabled**: Plans panel restored in CLI dashboard with plan file discovery from `~/.claude/plans/`\n- **Enhanced Status Bar**: Session info display improved with richer metadata\n\n### Fixed\n\n- **Old snapshot format migration**: Restoring pre-0.12.3 session snapshots no longer shows empty timeline entries\n\n### Changed\n\n- **Phrase library moved to shared**: CLI-specific phrase formatting kept local, all phrase content now from `sidekick-shared`\n\n## [0.12.5] - 2026-02-24\n\n### Fixed\n\n- **Update check too slow to notice new versions**: Reduced npm registry cache TTL from 24 hours to 4 hours so upgrade notices appear sooner after a new release\n\n## [0.12.4] - 2026-02-24\n\n### Fixed\n\n- **Session crash on upgrade**: Fixed `d.timestamp.getTime is not a function` error when restoring tool call data from session snapshots \u2014 `Date` objects were serialized to strings by JSON but not rehydrated on restore, causing the session monitor to crash on first run after upgrading from 0.12.2 to 0.12.3\n\n## [0.12.3] - 2026-02-24\n\n### Added\n\n- **Latest-node indicator**: The most recently added node in tree and boxed mind map views is now marked with a yellow indicator\n- **Plan analytics in mind map**: Tree and boxed views now display plan progress and per-step metrics\n - Tree view: plan header shows completion stats; steps show complexity, duration, tokens, tool calls, and errors in metadata brackets\n - Box view: progress bar with completion percentage; steps show right-aligned metrics; subtitle shows step count and total duration\n- **Cross-provider plan extraction**: Shared `PlanExtractor` now handles Claude Code (EnterPlanMode/ExitPlanMode) and OpenCode (`<proposed_plan>` XML) plans \u2014 previously only Codex plans were shown\n- **Enriched plan data model**: Plan steps include duration, token count, tool call count, and error messages\n- **Phase-grouped plan display**: When a plan has phase structure, tree and boxed views group steps under phase headers with context lines from the original plan markdown\n- **Node type filter**: Press `f` on the Mind Map tab to cycle through node type filters (file, tool, task, subagent, command, plan, knowledge-note) \u2014 non-matching sections render dimmed in grey\n\n### Fixed\n\n- **Kanban board regression**: Subagent and plan-step tasks now correctly appear in the kanban board\n\n### Changed\n\n- **Plans panel temporarily disabled**: The Plans panel in the CLI dashboard is disabled until plan-mode event capture is reliably working end-to-end. Plan nodes in the mind map remain active.\n- `DashboardState` now delegates to shared `EventAggregator` instead of maintaining its own aggregation logic\n\n## [0.12.2] - 2026-02-23\n\n### Added\n\n- **Update notifications**: The dashboard now checks the npm registry for newer versions on startup and shows a yellow banner in the status bar when an update is available (e.g., `v0.13.0 available \u2014 npm i -g sidekick-agent-hub`). Results are cached for 24 hours to avoid repeated network requests.\n\n## [0.12.1] - 2026-02-23\n\n### Fixed\n\n- **VS Code integration**: Fixed exit code 127 when the extension launches the CLI dashboard on systems using nvm or volta (node binary not found when shell init is bypassed)\n\n## [0.12.0] - 2026-02-22\n\n### Added\n\n- **"Open CLI Dashboard" VS Code Integration**: New VS Code command `Sidekick: Open CLI Dashboard` launches the TUI dashboard in an integrated terminal\n - Install the CLI with `npm install -g sidekick-agent-hub`\n\n## [0.11.0] - 2026-02-19\n\n### Added\n\n- **Initial Release**: Full-screen TUI dashboard for monitoring agent sessions from the terminal\n - Ink-based terminal UI with panels for sessions, tasks, kanban, mind map, notes, decisions, search, files, and git diff\n - Multi-provider support: auto-detects Claude Code, OpenCode, and Codex sessions\n - Reads from `~/.config/sidekick/` \u2014 the same data files the VS Code extension writes\n - Usage: `sidekick dashboard [--project <path>] [--provider <id>]`\n';
85734
+ CHANGELOG_default = '# Changelog\n\nAll notable changes to the Sidekick Agent Hub CLI will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## [0.21.2] - 2026-06-22\n\n### Changed\n\n- **`sidekick quota --provider zai`** now renders authoritative z.ai plan utilization from z.ai\'s quota API (5-Hour / Weekly windows with real reset times) instead of estimating from observed OpenCode traffic, falling back to a cached snapshot when the API is unavailable. `sidekick quota --all` and `sidekick quota history --provider zai` use the same authoritative source\n- **`--tier lite|pro|max|auto`** is deprecated and no longer affects the displayed utilization\n\n## [0.21.1] - 2026-06-21\n\n### Added\n\n- **z.ai Coding Plan quota**: `sidekick quota --provider zai` derives and renders z.ai plan utilization from OpenCode traffic already on disk (5-Hour / Weekly windows with per-tier prompt budgets). `--tier lite|pro|max|auto` overrides the assumed plan tier (default `auto`). `sidekick quota --provider opencode` now auto-routes to z.ai quota when z.ai traffic is detected. `sidekick quota --all` includes the z.ai section when active\n- **z.ai quota history heatmap**: `sidekick quota history --provider zai` renders a 13-week z.ai utilization heatmap for the current workspace, alongside the existing Claude and Codex heatmaps (now also in `--all`)\n\n### Changed\n\n- **Bundled `sidekick-shared` 0.21.1**: Picks up z.ai quota derivation and the OpenCode data directory resolution fix.\n\n### Limitations\n\n- z.ai quota is **estimated, not authoritative** \u2014 it reflects only the OpenCode traffic Sidekick observed on this machine/workspace (z.ai exposes no usage API) compared against provisional per-tier prompt budgets. z.ai is observed-only (no z.ai inference provider) and has no account management yet; with `--tier auto`, the tier is under-detected early in a cycle (use an explicit `--tier`); reset times are approximate unless a rate-limit error is trapped.\n\n## [0.21.0] - 2026-06-21\n\n### Added\n\n- **Account login**: `sidekick account --login` starts the provider-isolated login flow for Claude Max or Codex and saves the authenticated profile without disturbing the active account until finalization\n- **All-provider account view**: `sidekick account --provider all` lists Claude and Codex saved accounts together, including active state. JSON output returns provider-keyed account arrays and active ids\n- **Terminal account helpers**: `sidekick account --launcher <name>` creates opt-in launchers for the selected account, and `--auto-switch <pct|off>` persists the CLI auto-switch threshold preference\n- **Multi-provider quota output**: `sidekick quota --all` shows Claude and Codex quota state together \u2014 each provider degrades independently, so one provider\'s quota still prints even when the other is unavailable; `--all --json` emits a provider-keyed payload for automation\n\n### Changed\n\n- **Bundled `sidekick-shared` 0.21.0**: Picks up Account Management 2.0 acquisition, switching, terminal sync, quota auto-switch, and account schema exports.\n\n## [0.20.0] - 2026-06-17\n\n### Added\n\n- **`sidekick extract`**: New one-shot command for pulling actionable assets out of recent Claude Code and Codex chats for exactly the current cwd. It extracts URLs, filesystem-validated file paths, commands the agent suggested for the user to run, and plan-mode plans. Output is grouped and colored by default, labels each item with its source agent, validates invalid `--type` and `--limit` values, preserves `inChat` and per-item provenance in `--json`, and offers `-i/--interactive` for a picker that opens URLs or copies selected paths, commands, and plans. `--provider claude-code` and `--provider codex` scope extraction to one agent; OpenCode is reported as unsupported for now\n\nThanks to [@B33pBeeps](https://github.com/B33pBeeps) (Juan Fourie) for contributing this feature in [#17](https://github.com/cesarandreslopez/sidekick-agent-hub/pull/17), adapted from his MIT-licensed [`trawl`](https://github.com/B33pBeeps/trawl) project.\n\n## [0.19.3] - 2026-06-17\n\n### Changed\n\n- **Bundled `sidekick-shared` projection contract**: The shared assistant-turn projection now exposes a v2 `timeline` array for interleaved reasoning, narration, and tool groups. This is a shared-library contract update for downstream consumers and does not change CLI behavior by itself\n\n## [0.19.2] - 2026-06-15\n\n### Changed\n\n- **Bundled `sidekick-shared` 0.19.2**: The shared library gains a browser-safe assistant-turn projection module (`segmentAssistantTurn()`, `assistantTurnEventsFromSessionEvents()`, and mirrored Zod schemas) that segments an assistant turn into a compact Process + Answer shape, with Claude `Task` subagent refs surfaced without leaking prompt text \u2014 internal additions that don\'t change CLI behavior\n\n## [0.19.1] - 2026-06-09\n\n### Changed\n\n- **Bundled `sidekick-shared` 0.19.1**: Model-ID pricing and context-window lookups (behind the dashboard\'s cost and context gauges) now tolerate padded or mixed-case IDs. The shared library also gains Zod boundary schemas, an `extractSessionEvents()` progress-unwrapping helper, and a `/schemas` subpath export for downstream consumers \u2014 internal additions that don\'t change CLI behavior\n\n## [0.19.0] - 2026-06-09\n\n### Added\n\n- **Claude Opus 4.8 & Fable 5 support**: The dashboard\'s context-window gauge and cost estimates recognize `claude-opus-4-8` and `claude-fable-5` (both 1M-token context; Opus 4.8: $5/$25 per MTok, Fable 5: $10/$50 per MTok) via the shared model catalog\n\n### Changed\n\n- **Codex account switching now swaps `~/.codex/auth.json`**: `sidekick account --provider codex --switch-to <id>` (and `--add`) activates the account by atomically swapping its backed-up credentials into the system `~/.codex/` home, mirroring the Claude switch pattern \u2014 codex terminals outside Sidekick pick up the switch. Profile directories become pure credential backups, with a one-time startup migration for installs created under the old `CODEX_HOME`-redirection model. The command surfaces swap warnings on add, switch, and remove: a running codex process that needs restarting, stale credentials, or OS-keyring credential storage that Sidekick cannot swap\n\n### Fixed\n\n- **Opus 4.6/4.7 cost over-estimation**: Dashed model IDs fell back to the Opus 4.0 pricing tier ($15/$75 instead of $5/$25), inflating estimated costs 3\xD7\n- **Haiku 4.5 unpriced under dashed IDs**: Costs for `claude-haiku-4-5-*` sessions could render as "\u2014" because no dashed static pricing key existed\n\n## [0.18.5] - 2026-06-04\n\n### Changed\n\n- **Consistent Codex transcripts**: `sidekick dashboard` and `sidekick report` now parse Codex sessions via `parseTranscriptFromEvents()`, matching the canonical `SessionEvent` pipeline used by the other providers\n- **Bundled `sidekick-shared` 0.18.5**: Picks up the new session context evidence snapshot API (`buildSessionContextSnapshot`, `readSessionContextSnapshot`, `SessionContextSnapshot` and related types) and the Codex session evidence gap closures \u2014 `system` audit events, normalized `token_count` rate limits, per-file `apply_patch` expansion, tool-emission dedupe, MCP server attribution, and the new `ProviderReaderSessionWatcher`\n\n## [0.18.4] - 2026-05-27\n\n### Added\n\n- **`sidekick peak --provider <id>`**: New flag gates peak-hours output on the session provider. When the resolved provider is not `claude-code`, the command prints a "not applicable" message instead of calling the upstream endpoint\n\n### Changed\n\n- **Bundled `sidekick-shared` 0.18.4**: Picks up `scopePeakHoursToSessionProvider()`, `isClaudeCodeSessionProvider()`, `createPeakHoursNotApplicableState()` for peak-hours scoping, the improved Codex quota snapshot selection logic (`isPreferredQuotaHit`, `findAccountRolloutFiles`, `shouldKeepExistingSnapshot`), and the `notApplicable` field on `PeakHoursState`\n\n## [0.18.3] - 2026-05-19\n\n### Added\n\n- **`sidekick quota history`**: New subcommand that renders a 13-week GitHub-contributions-style heatmap of quota utilization for the current workspace. Flags: `--weeks <n>` (1-26, default 13), `--provider claude|codex` (default both), `--workspace <path>` (default cwd). Bucketed glyphs (`\xB7 \u2591 \u2592 \u2593 \u2588`) are color-coded by utilization band (\u22640 / <25 / <50 / <75 / \u226575), with per-provider rows and a peak / avg / unavailable-days / samples footer. Days that hit `available: false` render as a red `\xD7`. With `--json`, emits a `{ workspaceId, weeks, providers: { claude?, codex? }, generatedAt }` payload \u2014 the same shape consumed by the VS Code dashboard\n\n### Changed\n\n- **Bundled `sidekick-shared` 0.18.3**: Picks up the new per-workspace quota history surface (`appendQuotaHistorySample`, `readQuotaHistoryRange`, `readQuotaHistoryDailyBuckets`, `pruneQuotaHistory`, `getWorkspaceIdFromPath`) and the optional `workspaceId` / `appendHistorySample` hooks on `CodexQuotaWatcher`\n\n## [0.18.2] - 2026-05-19\n\n### Added\n\n- **`sidekick quota --refresh`**: New flag on the `quota` command that, for Codex, explicitly refreshes from the ChatGPT usage API before falling back to local rollout data and cached snapshots. Without the flag, the Codex quota path stays fully local and makes no upstream network call\n\n### Changed\n\n- **Codex quota is local-only by default**: `sidekick quota --provider codex` now delegates to the new `resolveCodexQuota` orchestrator in `sidekick-shared`. It checks the current workspace\'s most recent rollout, then recent account-level rollouts under `CODEX_HOME/sessions`, then the active account\'s cached snapshot \u2014 no upstream network call unless `--refresh` is passed. Failure output continues to include structured `failureKind` / `httpStatus` / `retryAfterMs` fields under `--json`\n- **Bundled `sidekick-shared` 0.18.2**: Picks up the new Codex quota orchestrator (`resolveCodexQuota`, `resolveCodexQuotaFromLocalSources`, `readLatestCodexQuotaFromRollouts`, `fetchCodexQuotaFromApi`), the relaxed `CodexRateLimits` shape (nullable `resets_at` / `window_minutes`), the rate-limit-only `token_count` event emission in `JsonlSessionWatcher`, and `state_N.sqlite` discovery in `CodexDatabase` + provider auto-detect\n\n## [0.18.1] - 2026-05-08\n\n### Changed\n\n- **Shared dashboard formatting**: terminal dashboard `fmtNum()` and `formatDuration()` now delegate to `formatTokenCount()` and `formatDurationMs()` from `sidekick-shared`, keeping the existing CLI surface (uppercase `K`/`M` suffix, compact `1m5s` style) while removing forked rounding logic\n\n## [0.18.0] - 2026-05-08\n\n### Changed\n\n- **Bundled `sidekick-shared` 0.18.0**: Picks up the new provider-aware quota orchestration surface \u2014 `MultiProviderQuotaService`, `CodexQuotaWatcher`, `getActiveAccountStatus()`, `extractToolCall()`, cost-provenance helpers (`calculateCostWithProvenance`, `mergeCostSources`), and model display helpers (`shortModelName`, `getModelDisplayInfo`, `compareModelIds`, `sortModelIds`). `parseModelId()` also now recognizes legacy Claude IDs such as `claude-3-opus-20240229` and `claude-3-5-sonnet-20241022`\n- **No CLI runtime changes**: This release ships the shared library upgrade for downstream tooling alignment; `sidekick quota`, `sidekick status`, and the live dashboard keep using the existing polling path. Wiring the new orchestrator into the CLI will land in a follow-up release\n\n## [0.17.7] - 2026-04-28\n\n### Fixed\n\n- **Quota snapshot write race**: Updated the bundled `sidekick-shared` snapshot writer so concurrent `sidekick quota` / Codex session updates no longer collide on `quota-snapshots.json.tmp` or throw `ENOENT`. Failed writes now also clean up their partial temp files instead of leaving orphans in `~/.config/sidekick/`\n\n## [0.17.6] - 2026-04-19\n\n### Added\n\n- **`sidekick peak` command**: One-shot check for Claude\'s current peak-hours state \u2014 weekdays 13:00\u201319:00 UTC, when session limits drain faster on Free/Pro/Max/Team subscriptions. Prints a color-coded status block with a countdown to the next transition. Data comes from the public `promoclock.co/api/status` endpoint (third-party, unaffiliated with Anthropic) with a graceful fallback when unreachable. `--json` emits the full raw state\n- **Peak-hours block in `sidekick status`**: When the active provider is `claude-code`, the Claude + OpenAI health blocks are now followed by a **Claude Peak Hours** block (off-peak or in-peak, with countdown). Gated on the provider so OpenCode / Codex users don\'t trigger an unnecessary third-party fetch. `--json` output includes the new `peak` field\n- **Peak-hours summary in `sidekick quota`**: Claude subscription quota output now shows a **Peak** line under the 5-hour / 7-day bars \u2014 green dot off-peak, orange dot during an active peak, with a countdown to the next transition. `--json` output includes the new `peak` field\n\n## [0.17.5] - 2026-04-18\n\n### Added\n\n- **Default account bootstrap at CLI startup**: The CLI now calls `ensureDefaultAccounts()` from `sidekick-shared` at module load and awaits the result inside a Commander `preAction` hook, so the first real subcommand blocks briefly on the bootstrap while `--version` and `--help` stay instant. When a system Claude Code or Codex credential exists and no saved account is active for that provider yet, the CLI registers it as "Default" \u2014 `sidekick quota`, `sidekick account`, and `sidekick stats` now reflect the active account on first run without requiring an explicit `sidekick account --add` first. Idempotent, never overwrites manually saved accounts, and all errors are swallowed so startup is never blocked\n\nThanks to [@B33pBeeps](https://github.com/B33pBeeps) (Juan Fourie) for contributing this feature in [#16](https://github.com/cesarandreslopez/sidekick-agent-hub/pull/16).\n\n## [0.17.4] - 2026-04-17\n\n### Changed\n\n- **Pricing hydration import migrated to `sidekick-shared/node`**: `cli.ts` now imports `hydratePricingCatalog` from the new Node-only subpath and keeps `detectProvider` on the package root. Runtime behavior is unchanged; the split makes the CLI\'s import surface self-documenting (hydration is explicitly a Node API) and aligns the CLI with the shared library\'s new versioned public API contract\n\n## [0.17.3] - 2026-04-17\n\n### Changed\n\n- **Version sync with the VS Code extension**: Republished to keep CLI, extension, and shared-library versions aligned after a cosmetic changelog fix in 0.17.3. No CLI code changes \u2014 functionally identical to 0.17.2\n\n## [0.17.2] - 2026-04-17\n\n### Added\n\n- **LiteLLM pricing hydration on startup**: The CLI now fetches the LiteLLM pricing catalog on startup and caches to `~/.config/sidekick/pricing-catalog.json` with a 24-hour TTL, 3s timeout, and stale-cache fallback \u2014 new model prices are picked up without a CLI upgrade\n- **Expanded pricing coverage**: GPT-4o, GPT-4.1, GPT-5.x, o1, o3, and o3-mini families are now priced alongside the existing Claude entries\n- **Real-dollar Codex / Claude Code costs**: `EventAggregator` computes cost from the pricing table when the session provider doesn\'t report one, so `sidekick` live dashboards now show actual dollars for Codex and Claude Code sessions\n- **`stats` footer lists unpriced models**: `sidekick stats` prints any models encountered with no pricing entry so missing coverage is visible\n\n### Fixed\n\n- **Context-gauge % wrong for Opus 4.7 (1M) and other new models**: The dashboard\'s context gauge was dividing by 200K for Claude Opus 4.7 (native 1M), inflating the displayed %. The shared model \u2192 context-window map now includes Opus/Sonnet 4.7 (1M), GPT-5.4 (1.05M), GPT-5.3-Codex (400K), and GPT-5.3-Codex-Spark (128K). Claude Code\'s `[1m]` suffix is now also honored as an explicit 1M marker\n- **Silent Sonnet-priced fallback for unknown models**: Codex, GPT-5.x, and o-series rows were being rendered at Sonnet rates. Unknown-model rows now render as `\u2014` in yellow instead of inventing a dollar figure\n\n### Changed\n\n- **`historical-data.json` schema v2**: reads `priced` flag and `unpricedModelIds` from records written by the latest VS Code extension; v1 records still read correctly\n\n## [0.17.1] - 2026-04-13\n\n### Fixed\n\n- **Codex multi-home session discovery**: Provider detection now scans all candidate Codex home directories, fixing missed sessions when the managed profile home is empty but the system `~/.codex/` has activity\n\n## [0.17.0] - 2026-04-13\n\n### Added\n\n- **Multi-provider account management**: `sidekick account` now supports `--provider codex` for Codex profile management alongside Claude Code accounts\n- **Codex account lifecycle**: `--add` prepares a profile and spawns `codex login`; `--switch-to` and `--remove` accept email, label, or profile ID\n- **Quota snapshot fallback**: `sidekick quota` for Codex shows cached rate-limit snapshots when no active session exists, with "cached from" timestamp\n\n### Fixed\n\n- **Email normalization**: Claude account lookup normalizes email case for reliable matching\n\n## [0.16.1] - 2026-03-27\n\n### Fixed\n\n- **Dashboard provider status scoping**: The TUI now shows degraded-service notices only for the monitored provider \u2014 Claude for Claude Code sessions, OpenAI for Codex sessions, and no status banner for OpenCode\n\n## [0.16.0] - 2026-03-23\n\n### Changed\n\n- **Consistent cost formatting**: All cost displays (`stats`, `context`, Sessions panel, narrative prompt) now use shared `formatCost()` with intelligent decimal precision (4 places for < $0.01, 2 otherwise)\n- **QuotaService**: Rewritten to wrap shared `QuotaPoller` with exponential backoff instead of manual polling loop\n- **modelContext**: Now re-exports `getModelInfo` from shared library alongside `getContextWindowSize`\n\n## [0.15.2] - 2026-03-18\n\n### Fixed\n\n- **CLI help descriptions**: Updated `quota` and `status` command descriptions to reflect provider-aware behavior\n- **`sidekick quota --provider`**: Added local `--provider` option so `sidekick quota --provider codex` works naturally\n\n## [0.15.0] - 2026-03-18\n\n### Added\n\n- **OpenAI status page monitoring**: CLI dashboard now shows OpenAI API status alongside Claude API status\n- **Codex rate limits in dashboard**: Sessions panel displays Codex rate-limit data with "Rate Limits" header instead of "Quota"\n- **Provider-aware `sidekick quota` command**: Detects active provider and shows Codex rate limits, Claude subscription quota, or an informational message for OpenCode\n\n### Fixed\n\n- **QuotaService polling for Codex**: Dashboard no longer starts Claude OAuth quota polling when the active provider is Codex\n\n## [0.14.2] - 2026-03-16\n\n### Fixed\n\n- **Quota polling interval**: Reduced quota refresh from every 30 seconds to every 5 minutes to avoid unnecessary API calls\n- **SessionsPanel `detailWidth()` call**: Removed unused parameter from `detailWidth()` in the Sessions panel quota rendering\n\n## [0.14.1] - 2026-03-14\n\n### Fixed\n\n- **Per-model context window sizes**: Dashboard context gauge now shows correct utilization for Claude Opus 4.6 (1M context) and other models with non-200K windows\n\n### Changed\n\n- **Shared model context lookup**: CLI dashboard now uses the centralized `getModelContextWindowSize()` from `sidekick-shared` instead of a local duplicate map\n\n## [0.14.0] - 2026-03-12\n\n### Added\n\n- **`sidekick account` Command**: Manage Claude Code accounts from the terminal \u2014 list saved accounts, add the current account with an optional label, switch to the next or a specific account, and remove accounts. Supports `--json` output for scripting\n- **Quota Account Label**: `sidekick quota` now shows the active account email and label above the quota bars when multi-account is enabled\n- **macOS Keychain Support**: `sidekick account` and `sidekick quota` now read and write credentials via the system Keychain on macOS, fixing account switching and quota checks on Mac\n\n## [0.13.8] - 2026-03-12\n\n### Changed\n\n- **Structured quota failure output**: `sidekick quota` now renders consistent auth, rate-limit, server, network, and unexpected-failure copy from shared quota failure descriptors while preserving `--json` machine-readable output\n- **Dashboard unavailable quota rendering**: The Sessions panel now shows Claude Code quota failures inline instead of hiding the quota section whenever subscription data is unavailable\n- **Quota transition toasts**: The Ink dashboard now fires low-noise toast notifications only when Claude Code quota failure state changes, avoiding repeated alerts every polling interval\n\n## [0.13.7] - 2026-03-11\n\n### Changed\n\n- **npm README sync**: Updated the published CLI package README to reflect current OpenCode monitoring behavior, platform-specific data directories, and the `sqlite3` runtime requirement\n- **README badge cleanup**: Removed the Ask DeepWiki badge from the published CLI package README; the repo root README still keeps it\n\n## [0.13.6] - 2026-03-11\n\n### Changed\n\n- **Refreshed CLI Dashboard Wordmark**: Updated the dashboard wordmark/header styling for a cleaner splash and dashboard identity\n\n### Fixed\n\n- **OpenCode dashboard startup**: OpenCode DB-backed session discovery now resolves projects by worktree, sandboxes, and session directory instead of quietly behaving like no session exists\n- **OpenCode runtime notices**: The CLI now prints an OpenCode-only actionable notice when `opencode.db` exists but `sqlite3` is missing, blocked, or otherwise unusable in the current shell environment\n\n## [0.13.5] - 2026-03-10\n\n### Added\n\n- **`sidekick status` Command**: One-shot Claude API status check with color-coded text output and `--json` mode\n- **Dashboard Status Banner**: Status bar shows a colored `\u25CF API minor/major/critical` indicator when Claude is degraded; Sessions panel Summary tab shows an "API Status" section with affected components and active incident details. Polls every 60s\n\n## [0.13.4] - 2026-03-08\n\n### Fixed\n\n- **Onboarding Phrase Spam**: Splash screen and detail pane motivational phrases memoized \u2014 no longer flicker every render tick (fixes [#13](https://github.com/cesarandreslopez/sidekick-agent-hub/issues/13))\n\n### Changed\n\n- **Simplified Logo**: Replaced 6-line ASCII robot art with compact text header in splash, help, and changelog overlays\n- **Removed Dead Code**: Removed unused `getSplashContent()` and `HELP_HEADER` exports from branding module\n\n## [0.13.3] - 2026-03-04\n\n_No CLI-specific changes in this release._\n\n## [0.13.2] - 2026-03-04\n\n_No CLI-specific changes in this release._\n\n## [0.13.1] - 2026-03-04\n\n### Added\n\n- **`sidekick quota` Command**: One-shot subscription quota check showing 5-hour and 7-day utilization with color-coded progress bars and reset countdowns \u2014 supports `--json` for machine-readable output\n- **Quota Projections**: Elapsed-time projections shown in `sidekick quota` output and TUI dashboard quota section \u2014 displays projected end-of-window utilization next to current value (e.g., `40% \u2192 100%`), included in `--json` output as `projectedFiveHour` / `projectedSevenDay`\n\n## [0.13.0] - 2026-03-03\n\n_No CLI-specific changes in this release._\n\n## [0.12.10] - 2026-03-01\n\n### Added\n\n- **Events Panel** (key 7): Scrollable live event stream with colored type badges (`[USR]`, `[AST]`, `[TOOL]`, `[RES]`), timestamps, and keyword-highlighted summaries; detail tabs for full event JSON and surrounding context\n- **Charts Panel** (key 8): Tool frequency horizontal bars, event type distribution, 60-minute activity heatmap using `\u2591\u2592\u2593\u2588` intensity characters, and pattern analysis with frequency bars and template text\n- **Multi-Mode Filter**: `/` filter overlay now supports four modes \u2014 substring, fuzzy, regex, and date range \u2014 Tab cycles modes, regex mode shows red validation errors\n- **Search Term Highlighting**: Active filter terms highlighted in blue within side list items\n- **Timeline Keyword Coloring**: Event summaries in the Sessions panel Timeline tab now use semantic keyword coloring \u2014 errors red, success green, tool names cyan, file paths magenta\n\n### Removed\n\n- **Search Panel**: Removed redundant Search panel (previously key 7) \u2014 the `/` filter with multi-mode support serves the same purpose\n\n## [0.12.9] - 2026-02-28\n\n### Added\n\n- **Standalone Data Commands**: `sidekick tasks`, `sidekick decisions`, `sidekick notes`, `sidekick stats`, `sidekick handoff` for accessing project data without launching the TUI\n- **`sidekick search <query>`**: Cross-session full-text search from the terminal\n- **`sidekick context`**: Composite output of tasks, decisions, notes, and handoff for piping into other tools\n- **`--list` flag on `sidekick dump`**: Discover available session IDs before requiring `--session <id>`\n- **Search Panel**: Search panel (panel 7) wired into the TUI dashboard\n\n### Changed\n\n- **`taskMerger` utility**: Duplicate `mergeTasks` logic extracted into shared `taskMerger` utility\n- **Model constants**: Hardcoded model IDs extracted to named constants\n\n### Fixed\n\n- **`convention` icon**: Notes panel icon replaced with valid `tip` type\n- **Linux clipboard**: Now supports Wayland (`wl-copy`) and `xsel` fallbacks, with error messages instead of silent failure\n- **`provider.dispose()`**: Added to `dump` and `report` commands (prevents SQLite connection leaks)\n\n## [0.12.8] - 2026-02-28\n\n### Changed\n\n- **Dashboard UI/UX Polish**: Visual overhaul for better hierarchy, consistency, and readability\n - Splash screen and help overlay now display the robot ASCII logo\n - Toast notifications show severity icons (\u2718 error, \u26A0 warning, \u25CF info) with inner padding\n - Focused pane uses double-border for clear focus indication\n - Section dividers (`\u2500\u2500 Title \u2500\u2500\u2500\u2500`) replace bare bold headers in summary, agents, and context attribution\n - Tab bar: active tab underlined in magenta, inactive tabs dimmed, bracket syntax removed\n - Status bar: segmented layout with `\u2502` separators; keys bold, labels dim\n - Summary metrics condensed: elapsed/events/compactions on one line, tokens on one line with cache rate and cost\n - Sparklines display peak metadata annotations\n - Progress bars use blessed color tags for consistent coloring\n - Help overlay uses dot-leader alignment for all keybinding rows\n - Empty state hints per panel (e.g. "Tasks appear as your agent works.")\n - Session picker groups sessions by provider with section headers when multiple providers are present\n\n## [0.12.7] - 2026-02-27\n\n### Added\n\n- **HTML Session Report**: `sidekick report` command generates a self-contained HTML report and opens it in the default browser\n - Options: `--session`, `--output`, `--theme` (dark/light), `--no-open`, `--no-thinking`\n - TUI Dashboard: press `r` to generate and open an HTML report for the current session\n\n## [0.12.6] - 2026-02-26\n\n### Added\n\n- **Session Dump Command**: `sidekick dump` exports session data in text, markdown, or JSON format with `--format`, `--width`, and `--expand` options\n- **Plans Panel Re-enabled**: Plans panel restored in CLI dashboard with plan file discovery from `~/.claude/plans/`\n- **Enhanced Status Bar**: Session info display improved with richer metadata\n\n### Fixed\n\n- **Old snapshot format migration**: Restoring pre-0.12.3 session snapshots no longer shows empty timeline entries\n\n### Changed\n\n- **Phrase library moved to shared**: CLI-specific phrase formatting kept local, all phrase content now from `sidekick-shared`\n\n## [0.12.5] - 2026-02-24\n\n### Fixed\n\n- **Update check too slow to notice new versions**: Reduced npm registry cache TTL from 24 hours to 4 hours so upgrade notices appear sooner after a new release\n\n## [0.12.4] - 2026-02-24\n\n### Fixed\n\n- **Session crash on upgrade**: Fixed `d.timestamp.getTime is not a function` error when restoring tool call data from session snapshots \u2014 `Date` objects were serialized to strings by JSON but not rehydrated on restore, causing the session monitor to crash on first run after upgrading from 0.12.2 to 0.12.3\n\n## [0.12.3] - 2026-02-24\n\n### Added\n\n- **Latest-node indicator**: The most recently added node in tree and boxed mind map views is now marked with a yellow indicator\n- **Plan analytics in mind map**: Tree and boxed views now display plan progress and per-step metrics\n - Tree view: plan header shows completion stats; steps show complexity, duration, tokens, tool calls, and errors in metadata brackets\n - Box view: progress bar with completion percentage; steps show right-aligned metrics; subtitle shows step count and total duration\n- **Cross-provider plan extraction**: Shared `PlanExtractor` now handles Claude Code (EnterPlanMode/ExitPlanMode) and OpenCode (`<proposed_plan>` XML) plans \u2014 previously only Codex plans were shown\n- **Enriched plan data model**: Plan steps include duration, token count, tool call count, and error messages\n- **Phase-grouped plan display**: When a plan has phase structure, tree and boxed views group steps under phase headers with context lines from the original plan markdown\n- **Node type filter**: Press `f` on the Mind Map tab to cycle through node type filters (file, tool, task, subagent, command, plan, knowledge-note) \u2014 non-matching sections render dimmed in grey\n\n### Fixed\n\n- **Kanban board regression**: Subagent and plan-step tasks now correctly appear in the kanban board\n\n### Changed\n\n- **Plans panel temporarily disabled**: The Plans panel in the CLI dashboard is disabled until plan-mode event capture is reliably working end-to-end. Plan nodes in the mind map remain active.\n- `DashboardState` now delegates to shared `EventAggregator` instead of maintaining its own aggregation logic\n\n## [0.12.2] - 2026-02-23\n\n### Added\n\n- **Update notifications**: The dashboard now checks the npm registry for newer versions on startup and shows a yellow banner in the status bar when an update is available (e.g., `v0.13.0 available \u2014 npm i -g sidekick-agent-hub`). Results are cached for 24 hours to avoid repeated network requests.\n\n## [0.12.1] - 2026-02-23\n\n### Fixed\n\n- **VS Code integration**: Fixed exit code 127 when the extension launches the CLI dashboard on systems using nvm or volta (node binary not found when shell init is bypassed)\n\n## [0.12.0] - 2026-02-22\n\n### Added\n\n- **"Open CLI Dashboard" VS Code Integration**: New VS Code command `Sidekick: Open CLI Dashboard` launches the TUI dashboard in an integrated terminal\n - Install the CLI with `npm install -g sidekick-agent-hub`\n\n## [0.11.0] - 2026-02-19\n\n### Added\n\n- **Initial Release**: Full-screen TUI dashboard for monitoring agent sessions from the terminal\n - Ink-based terminal UI with panels for sessions, tasks, kanban, mind map, notes, decisions, search, files, and git diff\n - Multi-provider support: auto-detects Claude Code, OpenCode, and Codex sessions\n - Reads from `~/.config/sidekick/` \u2014 the same data files the VS Code extension writes\n - Usage: `sidekick dashboard [--project <path>] [--provider <id>]`\n';
85456
85735
  }
85457
85736
  });
85458
85737
 
@@ -87792,11 +88071,6 @@ function printCodexQuota(quota, activeAccount = (0, import_sidekick_shared29.get
87792
88071
  `);
87793
88072
  }
87794
88073
  }
87795
- function resolveZaiTierOption(localOpts) {
87796
- const raw = localOpts.tier;
87797
- if (raw === "lite" || raw === "pro" || raw === "max") return raw;
87798
- return "auto";
87799
- }
87800
88074
  async function detectZaiRouting() {
87801
88075
  try {
87802
88076
  const db = new import_sidekick_shared29.OpenCodeDatabase((0, import_sidekick_shared29.getOpenCodeDataDir)());
@@ -87810,53 +88084,11 @@ async function detectZaiRouting() {
87810
88084
  return false;
87811
88085
  }
87812
88086
  }
87813
- async function fetchZaiQuotaPayload(localOpts) {
87814
- const sinceMs = Date.now() - 7 * 864e5;
87815
- let rows = [];
87816
- let detected = false;
87817
- try {
87818
- const db = new import_sidekick_shared29.OpenCodeDatabase((0, import_sidekick_shared29.getOpenCodeDataDir)());
87819
- if (db.isAvailable() && db.open()) {
87820
- const rawRows = db.getAssistantMessagesByProviderId([...import_sidekick_shared29.ZAI_PROVIDER_IDS], sinceMs);
87821
- detected = rawRows.length > 0;
87822
- const parsed = (0, import_sidekick_shared29.rowsToZaiTurnsAndErrors)(rawRows);
87823
- rows = parsed.turns;
87824
- }
87825
- } catch {
87826
- }
87827
- if (rows.length === 0) {
87828
- return {
87829
- quota: (0, import_sidekick_shared29.makeUnavailableZaiQuotaState)("No z.ai usage observed in the last 7 days."),
87830
- detected
87831
- };
87832
- }
87833
- const accumulated = (0, import_sidekick_shared29.accumulateZaiUsage)(rows, Date.now());
87834
- const configuredTier = resolveZaiTierOption(localOpts);
87835
- const tier = (0, import_sidekick_shared29.resolveZaiTier)(configuredTier, accumulated);
87836
- let authoritativeFiveHourResetAt;
87837
- let authoritativeWeeklyResetAt;
87838
- try {
87839
- const db = new import_sidekick_shared29.OpenCodeDatabase((0, import_sidekick_shared29.getOpenCodeDataDir)());
87840
- if (db.isAvailable() && db.open()) {
87841
- const rawRows = db.getAssistantMessagesByProviderId([...import_sidekick_shared29.ZAI_PROVIDER_IDS], sinceMs);
87842
- for (const row of rawRows) {
87843
- const parsed = (0, import_sidekick_shared29.parseZaiQuotaError)({
87844
- code: row.errorCode ?? void 0,
87845
- message: row.errorMessage ?? void 0
87846
- });
87847
- if (!parsed?.resetsAt) continue;
87848
- if (parsed.kind === "exhausted") {
87849
- authoritativeFiveHourResetAt = parsed.resetsAt;
87850
- if (String(parsed.code) === "1310") authoritativeWeeklyResetAt = parsed.resetsAt;
87851
- }
87852
- }
87853
- }
87854
- } catch {
87855
- }
87856
- const quota = (0, import_sidekick_shared29.inferZaiQuotaState)(accumulated, tier, {
87857
- authoritativeFiveHourResetAt,
87858
- authoritativeWeeklyResetAt
87859
- });
88087
+ async function fetchZaiQuotaPayload(_localOpts) {
88088
+ const [quota, detected] = await Promise.all([
88089
+ (0, import_sidekick_shared29.resolveZaiQuota)(),
88090
+ detectZaiRouting()
88091
+ ]);
87860
88092
  return { quota, detected };
87861
88093
  }
87862
88094
  async function zaiQuotaAction(_globalOpts, localOpts, jsonOutput) {
@@ -87882,19 +88114,18 @@ function printZaiQuota(quota) {
87882
88114
  const fiveReset = quota.fiveHour.resetsAt ? formatTimeUntil(quota.fiveHour.resetsAt) : "";
87883
88115
  const sevenReset = quota.sevenDay.resetsAt ? formatTimeUntil(quota.sevenDay.resetsAt) : "";
87884
88116
  const tier = quota.planType ?? "auto";
87885
- const tierBudget = tier === "auto" ? null : import_sidekick_shared29.ZAI_TIER_BUDGETS[tier];
87886
- process.stdout.write(source_default.bold("z.ai Coding Plan") + source_default.dim(` (estimated, tier: ${tier})
88117
+ process.stdout.write(source_default.bold("z.ai Coding Plan") + (tier !== "auto" ? source_default.dim(` (plan: ${tier})
88118
+ `) : "\n"));
88119
+ if (quota.stale) {
88120
+ process.stdout.write(source_default.yellow(`Using cached z.ai quota snapshot from ${formatSnapshotTime(quota.capturedAt)}.
87887
88121
  `));
88122
+ }
87888
88123
  process.stdout.write(source_default.dim("\u2500".repeat(50) + "\n"));
87889
88124
  process.stdout.write(` ${source_default.dim("5-Hour")} ${makeChalkBar(fivePct, barWidth)} ${String(fivePct).padStart(3)}% ${fiveReset ? source_default.dim("resets " + fiveReset) : ""}
87890
88125
  `);
87891
88126
  process.stdout.write(` ${source_default.dim("Weekly")} ${makeChalkBar(sevenPct, barWidth)} ${String(sevenPct).padStart(3)}% ${sevenReset ? source_default.dim("resets " + sevenReset) : ""}
87892
88127
  `);
87893
- if (tierBudget) {
87894
- process.stdout.write(source_default.dim(` budgets: ${tierBudget.fiveHour}/5h, ${tierBudget.weekly}/week (prompts)
87895
- `));
87896
- }
87897
- process.stdout.write(source_default.dim(" z.ai exposes no quota API; utilization is derived from observed traffic.\n"));
88128
+ process.stdout.write(source_default.dim(quota.stale ? " Source: cached z.ai API snapshot.\n" : " Source: z.ai quota API.\n"));
87898
88129
  }
87899
88130
  async function allQuotaAction(globalOpts, localOpts, jsonOutput) {
87900
88131
  const codexProvider = new import_sidekick_shared29.CodexProvider();
@@ -89191,7 +89422,7 @@ var init_cli = __esm({
89191
89422
  defaultAccountsReady = (0, import_sidekick_shared36.ensureDefaultAccounts)().catch(() => {
89192
89423
  });
89193
89424
  program2 = new Command();
89194
- program2.name("sidekick").description("Query Sidekick project intelligence from the command line").version("0.21.1").option("--json", "Output as JSON").option("--project <path>", "Override project path (default: cwd)").option("--provider <id>", "Provider: claude-code, opencode, codex, auto (default: auto)");
89425
+ program2.name("sidekick").description("Query Sidekick project intelligence from the command line").version("0.21.2").option("--json", "Output as JSON").option("--project <path>", "Override project path (default: cwd)").option("--provider <id>", "Provider: claude-code, opencode, codex, auto (default: auto)");
89195
89426
  program2.hook("preAction", async () => {
89196
89427
  await defaultAccountsReady;
89197
89428
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sidekick-agent-hub",
3
- "version": "0.21.1",
3
+ "version": "0.21.2",
4
4
  "description": "Terminal dashboard for monitoring AI coding agent sessions",
5
5
  "type": "module",
6
6
  "bin": {