@phnx-labs/agents-cli 1.23.47 → 1.23.49

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.23.49
4
+
5
+ - **You hear the seat count before the names.** The daemon now notifies you once when the seat count differs from your active accounts at low confidence ("claude: about 5 of 8 accounts cover your usage"), saying when it will name which ones. Before, it stayed silent until every account had 3 weeks of readings. Source: `cli/src/lib/accounting/advise.ts`.
6
+
7
+ ## 1.23.48
8
+
9
+ - **`agents accounts usage --json` reports the rules it applied.** A new `thresholds` object carries the target share, the coverage needed before a seat count (`minCoverage`, `minMeasured`), the weeks each account needs before accounts are named (`weeksNeeded`) and the limit percent, so the AGI Menu Accounts tab can show why it recommends what it does. Source: `cli/src/lib/accounting/advise.ts`.
10
+
11
+ - **AGI Menu 1.21.0: the Accounts tab draws its answer.** The `menubar` helper floor rises to 1.21.0. The tab shows a verdict card with a confidence chip, weekly demand against the seats you would keep, a heat strip of weekly peaks per account, and the rules behind the advice with your numbers. You can filter by harness, 4/8/12 weeks and a 70/80/90% target, and Pause/Resume now works, with an inline confirm. Source: `cli/src/lib/helper-versions.ts`.
12
+
3
13
  ## 1.23.47
4
14
 
5
15
  - **`agents accounts usage` no longer recommends a seat count from a few accounts.** With fewer than
@@ -29,6 +29,13 @@ export interface AccountsAdvice {
29
29
  measured: number;
30
30
  total: number;
31
31
  };
32
+ thresholds: {
33
+ target: number;
34
+ minCoverage: number;
35
+ minMeasured: number;
36
+ weeksNeeded: number;
37
+ limitPercent: number;
38
+ };
32
39
  advice: {
33
40
  keep: number;
34
41
  pause: string[];
@@ -46,6 +53,7 @@ export interface AdviseOptions {
46
53
  export declare const DEFAULT_ADVISE_WEEKS = 4;
47
54
  export declare const DEFAULT_ADVISE_TARGET = 0.8;
48
55
  export declare const MIN_ADVISE_COVERAGE = 0.75;
56
+ export declare const LIMIT_PERCENT = 100;
49
57
  export declare function weekStartUtc(ms: number): number;
50
58
  export declare function adviseAccounts(accounts: readonly AdviseAccountInput[], peaks: readonly UsagePeak[], options?: AdviseOptions): AccountsAdvice;
51
59
  export interface CollectAdviceOptions extends AdviseOptions {
@@ -7,6 +7,7 @@ import { getUsageHistoryPath, mergeUsagePeaks, parseUsagePeaks, peaksFromCacheRo
7
7
  export const DEFAULT_ADVISE_WEEKS = 4;
8
8
  export const DEFAULT_ADVISE_TARGET = 0.8;
9
9
  export const MIN_ADVISE_COVERAGE = 0.75;
10
+ export const LIMIT_PERCENT = 100;
10
11
  const DAY_MS = 24 * 60 * 60 * 1000;
11
12
  const WEEK_MS = 7 * DAY_MS;
12
13
  export function weekStartUtc(ms) {
@@ -41,7 +42,7 @@ export function adviseAccounts(accounts, peaks, options = {}) {
41
42
  let pace = null;
42
43
  let limitedWeeks = 0;
43
44
  for (const p of byKey.get(account.usageKey) ?? []) {
44
- if (p.peak >= 100)
45
+ if (p.peak >= LIMIT_PERCENT)
45
46
  limitedWeeks += 1;
46
47
  if (Date.parse(p.resetsAt) > now.getTime()) {
47
48
  thisWeek = Math.max(thisWeek ?? 0, p.peak);
@@ -89,6 +90,8 @@ export function adviseAccounts(accounts, peaks, options = {}) {
89
90
  const coverage = { measured, total: active.length };
90
91
  const weeksLabel = weekStarts.map((w) => new Date(w).toISOString().slice(0, 10));
91
92
  const minMeasured = Math.ceil(active.length * MIN_ADVISE_COVERAGE);
93
+ const weeksNeeded = Math.min(3, weekCount);
94
+ const thresholds = { target, minCoverage: MIN_ADVISE_COVERAGE, minMeasured, weeksNeeded, limitPercent: LIMIT_PERCENT };
92
95
  if (peakDemand === null || measured < minMeasured) {
93
96
  const unmeasured = active.filter((r) => !hasReading(r)).map((r) => r.name);
94
97
  const reason = peakDemand === null
@@ -96,7 +99,7 @@ export function adviseAccounts(accounts, peaks, options = {}) {
96
99
  : `Only ${measured} of ${active.length} active accounts have a weekly reading; a seat count needs ${minMeasured}. `
97
100
  + `No reading for ${unmeasured.join(', ')}.`;
98
101
  return {
99
- weeks: weeksLabel, rows, demand, currentDemand, peakDemand, target, coverage,
102
+ weeks: weeksLabel, rows, demand, currentDemand, peakDemand, target, coverage, thresholds,
100
103
  advice: { keep: active.length, pause: [], resume: [], add: 0, confidence: 'none', reason },
101
104
  };
102
105
  }
@@ -123,7 +126,6 @@ export function adviseAccounts(accounts, peaks, options = {}) {
123
126
  .map((r) => r.name);
124
127
  add = short - resume.length;
125
128
  }
126
- const weeksNeeded = Math.min(3, weekCount);
127
129
  const thinHistory = active.filter((r) => r.peaks.filter((v) => v !== null).length < weeksNeeded).map((r) => r.name);
128
130
  const confidence = thinHistory.length === 0 ? 'high' : 'low';
129
131
  if (confidence === 'low') {
@@ -144,7 +146,7 @@ export function adviseAccounts(accounts, peaks, options = {}) {
144
146
  parts.push(`Accounts to ${need < active.length ? 'pause' : 'resume'} are named once every active account has readings in ${weeksNeeded} of the last ${weekCount} weeks.`);
145
147
  }
146
148
  return {
147
- weeks: weeksLabel, rows, demand, currentDemand, peakDemand, target, coverage,
149
+ weeks: weeksLabel, rows, demand, currentDemand, peakDemand, target, coverage, thresholds,
148
150
  advice: { keep: need, pause, resume, add, confidence, reason: parts.join(' ') },
149
151
  };
150
152
  }
@@ -215,7 +217,25 @@ export function renderAccountsAdvice(result) {
215
217
  return lines;
216
218
  }
217
219
  export function accountsAdviceNotification(result, lastNotified, now = new Date()) {
218
- const { harness, advice, coverage, peakDemand } = result;
220
+ const { harness, advice, coverage, peakDemand, thresholds } = result;
221
+ const week = new Date(weekStartUtc(now.getTime())).toISOString().slice(0, 10);
222
+ const demand = peakDemand === null ? '' : ` Peak weekly demand was ${peakDemand.toFixed(2)} account-weeks.`;
223
+ if (advice.confidence === 'low') {
224
+ if (advice.keep === coverage.total)
225
+ return null;
226
+ const fingerprint = [harness, 'low', advice.keep, coverage.total].join('|');
227
+ if (fingerprint === lastNotified)
228
+ return null;
229
+ const title = advice.keep < coverage.total
230
+ ? `${harness}: about ${advice.keep} of ${coverage.total} accounts cover your usage`
231
+ : `${harness}: you may need ${advice.keep} accounts, ${coverage.total} are active`;
232
+ return {
233
+ fingerprint,
234
+ title,
235
+ body: `Which accounts to ${advice.keep < coverage.total ? 'pause' : 'resume'} is named once each has readings in ${thresholds.weeksNeeded} of the last ${result.weeks.length} weeks.${demand} Details: agents accounts usage ${harness}`,
236
+ dedupKey: `accounts-advice:${harness}:${week}:low:${advice.keep}`,
237
+ };
238
+ }
219
239
  if (advice.confidence !== 'high')
220
240
  return null;
221
241
  if (advice.pause.length === 0 && advice.resume.length === 0 && advice.add === 0)
@@ -223,8 +243,6 @@ export function accountsAdviceNotification(result, lastNotified, now = new Date(
223
243
  const fingerprint = [harness, advice.keep, [...advice.pause].sort().join(','), [...advice.resume].sort().join(','), advice.add].join('|');
224
244
  if (fingerprint === lastNotified)
225
245
  return null;
226
- const week = new Date(weekStartUtc(now.getTime())).toISOString().slice(0, 10);
227
- const demand = peakDemand === null ? '' : ` Peak weekly demand was ${peakDemand.toFixed(2)} account-weeks.`;
228
246
  let title;
229
247
  let action;
230
248
  if (advice.pause.length > 0) {
@@ -1,5 +1,5 @@
1
1
  export const HELPER_RELEASES = {
2
- menubar: { tagPrefix: 'menubar', floor: '1.20.0' },
2
+ menubar: { tagPrefix: 'menubar', floor: '1.21.0' },
3
3
  };
4
4
  export function helperTag(helper, version) {
5
5
  const release = HELPER_RELEASES[helper];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phnx-labs/agents-cli",
3
- "version": "1.23.47",
3
+ "version": "1.23.49",
4
4
  "description": "One CLI for all your AI coding agents - versions, config, cloud dispatch, sessions, and teams (now with first-class Grok Build CLI support)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",