@project-ava-supernova/core 0.2.195 → 0.2.197

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/docs/content/concepts.d.ts.map +1 -1
  2. package/dist/docs/content/concepts.js +14 -2
  3. package/dist/docs/content/concepts.js.map +1 -1
  4. package/dist/docs/i18n/translations.d.ts.map +1 -1
  5. package/dist/docs/i18n/translations.js +1 -1
  6. package/dist/docs/i18n/translations.js.map +1 -1
  7. package/dist/i18n/keep-english.d.ts.map +1 -1
  8. package/dist/i18n/keep-english.js +4 -0
  9. package/dist/i18n/keep-english.js.map +1 -1
  10. package/dist/i18n/locales/ar.d.ts.map +1 -1
  11. package/dist/i18n/locales/ar.js +48 -0
  12. package/dist/i18n/locales/ar.js.map +1 -1
  13. package/dist/i18n/locales/de.d.ts.map +1 -1
  14. package/dist/i18n/locales/de.js +48 -0
  15. package/dist/i18n/locales/de.js.map +1 -1
  16. package/dist/i18n/locales/en.d.ts +47 -0
  17. package/dist/i18n/locales/en.d.ts.map +1 -1
  18. package/dist/i18n/locales/en.js +48 -0
  19. package/dist/i18n/locales/en.js.map +1 -1
  20. package/dist/i18n/locales/es.d.ts.map +1 -1
  21. package/dist/i18n/locales/es.js +48 -0
  22. package/dist/i18n/locales/es.js.map +1 -1
  23. package/dist/i18n/locales/fr.d.ts.map +1 -1
  24. package/dist/i18n/locales/fr.js +48 -0
  25. package/dist/i18n/locales/fr.js.map +1 -1
  26. package/dist/i18n/locales/hi.d.ts.map +1 -1
  27. package/dist/i18n/locales/hi.js +48 -0
  28. package/dist/i18n/locales/hi.js.map +1 -1
  29. package/dist/i18n/locales/id.d.ts.map +1 -1
  30. package/dist/i18n/locales/id.js +48 -0
  31. package/dist/i18n/locales/id.js.map +1 -1
  32. package/dist/i18n/locales/it.d.ts.map +1 -1
  33. package/dist/i18n/locales/it.js +48 -0
  34. package/dist/i18n/locales/it.js.map +1 -1
  35. package/dist/i18n/locales/ja.d.ts.map +1 -1
  36. package/dist/i18n/locales/ja.js +48 -0
  37. package/dist/i18n/locales/ja.js.map +1 -1
  38. package/dist/i18n/locales/ko.d.ts.map +1 -1
  39. package/dist/i18n/locales/ko.js +48 -0
  40. package/dist/i18n/locales/ko.js.map +1 -1
  41. package/dist/i18n/locales/nl.d.ts.map +1 -1
  42. package/dist/i18n/locales/nl.js +48 -0
  43. package/dist/i18n/locales/nl.js.map +1 -1
  44. package/dist/i18n/locales/pl.d.ts.map +1 -1
  45. package/dist/i18n/locales/pl.js +48 -0
  46. package/dist/i18n/locales/pl.js.map +1 -1
  47. package/dist/i18n/locales/pt.d.ts.map +1 -1
  48. package/dist/i18n/locales/pt.js +48 -0
  49. package/dist/i18n/locales/pt.js.map +1 -1
  50. package/dist/i18n/locales/ru.d.ts.map +1 -1
  51. package/dist/i18n/locales/ru.js +48 -0
  52. package/dist/i18n/locales/ru.js.map +1 -1
  53. package/dist/i18n/locales/th.d.ts.map +1 -1
  54. package/dist/i18n/locales/th.js +48 -0
  55. package/dist/i18n/locales/th.js.map +1 -1
  56. package/dist/i18n/locales/tr.d.ts.map +1 -1
  57. package/dist/i18n/locales/tr.js +48 -0
  58. package/dist/i18n/locales/tr.js.map +1 -1
  59. package/dist/i18n/locales/uk.d.ts.map +1 -1
  60. package/dist/i18n/locales/uk.js +48 -0
  61. package/dist/i18n/locales/uk.js.map +1 -1
  62. package/dist/i18n/locales/vi.d.ts.map +1 -1
  63. package/dist/i18n/locales/vi.js +48 -0
  64. package/dist/i18n/locales/vi.js.map +1 -1
  65. package/dist/i18n/locales/zh-CN.d.ts.map +1 -1
  66. package/dist/i18n/locales/zh-CN.js +48 -0
  67. package/dist/i18n/locales/zh-CN.js.map +1 -1
  68. package/dist/i18n/locales/zh-TW.d.ts.map +1 -1
  69. package/dist/i18n/locales/zh-TW.js +48 -0
  70. package/dist/i18n/locales/zh-TW.js.map +1 -1
  71. package/dist/index.d.ts +2 -2
  72. package/dist/index.d.ts.map +1 -1
  73. package/dist/index.js +2 -1
  74. package/dist/index.js.map +1 -1
  75. package/dist/usage/ledger.d.ts +13 -63
  76. package/dist/usage/ledger.d.ts.map +1 -1
  77. package/dist/usage/ledger.js +34 -101
  78. package/dist/usage/ledger.js.map +1 -1
  79. package/dist/usage/view.d.ts +168 -0
  80. package/dist/usage/view.d.ts.map +1 -0
  81. package/dist/usage/view.js +346 -0
  82. package/dist/usage/view.js.map +1 -0
  83. package/package.json +6 -1
@@ -0,0 +1,168 @@
1
+ /** Which program spent it. 'unreal' is the Assistant panel inside Unreal. */
2
+ export type UsageSurface = 'ext' | 'ide' | 'cli' | 'unreal';
3
+ /** One paid call. Short keys: this is written thousands of times a month. */
4
+ export interface UsageEntry {
5
+ /** When, ISO 8601 with the user's own offset — a day is THEIR day, not UTC's. */
6
+ t: string;
7
+ surface: UsageSurface;
8
+ /** main, health, learning, design, social, brainstorm — or 'background' for
9
+ * a call made outside any turn (memory upkeep and the like). */
10
+ room: string;
11
+ /** The mode or room id the turn ran in: work, plan, chat, health, gym…
12
+ * ('background' as above). */
13
+ mode: string;
14
+ provider: string;
15
+ model: string;
16
+ /** Input (prompt) tokens. */
17
+ in: number;
18
+ /** Output (completion) tokens. */
19
+ out: number;
20
+ /** Prompt tokens served from the provider's cache — only when it said so.
21
+ * Absent means the provider reported nothing, not zero. */
22
+ cached?: number;
23
+ /** Estimated USD at the moment of spend. Absent when no rate was known. */
24
+ usd?: number;
25
+ /** How many calls this line stands for. Absent = 1. Only an imported
26
+ * month (below) is more than one. */
27
+ n?: number;
28
+ /** 'month': a whole month's total from the counters kept before daily
29
+ * records began (imported once, 21 Nov 2026). Stamped on the 1st; its
30
+ * room and mode are 'earlier' because the old counters never knew them. */
31
+ span?: 'month';
32
+ }
33
+ /** Totals for a group of entries. */
34
+ export interface UsageTotals {
35
+ usd: number;
36
+ in: number;
37
+ out: number;
38
+ replies: number;
39
+ /** Calls whose cost is unknown (no rate) — so a $ total is never silently short. */
40
+ unpriced: number;
41
+ }
42
+ export interface UsageSummary {
43
+ totals: UsageTotals;
44
+ /** One per local day that had usage, oldest first. */
45
+ byDay: Array<{
46
+ day: string;
47
+ } & UsageTotals>;
48
+ byModel: Array<{
49
+ model: string;
50
+ provider: string;
51
+ } & UsageTotals>;
52
+ byRoom: Array<{
53
+ room: string;
54
+ } & UsageTotals>;
55
+ byMode: Array<{
56
+ mode: string;
57
+ } & UsageTotals>;
58
+ bySurface: Array<{
59
+ surface: string;
60
+ } & UsageTotals>;
61
+ }
62
+ /** The local calendar day of an entry, 'YYYY-MM-DD' — read off its own stamp,
63
+ * so a day stays the day it was spent even if the user later travels. */
64
+ export declare function entryDay(e: Pick<UsageEntry, 't'>): string;
65
+ /** Parse one month file. A broken line (a crash mid-write) is skipped. */
66
+ export declare function parseUsageLines(text: string): UsageEntry[];
67
+ /** Keep the entries whose local day is within [from, to] (inclusive; either
68
+ * end may be open), oldest first. */
69
+ export declare function filterUsage(entries: UsageEntry[], from?: string, to?: string): UsageEntry[];
70
+ /** The month files a range needs, 'YYYY-MM', from the months present. */
71
+ export declare function monthsForRange(available: string[], from?: string, to?: string): string[];
72
+ export declare function emptyTotals(): UsageTotals;
73
+ /** Sum entries every way the page needs. Biggest spend first, except days. */
74
+ export declare function summariseUsage(entries: UsageEntry[]): UsageSummary;
75
+ export type UsageRangeKey = 'today' | '7d' | '30d' | 'month' | 'last_month' | 'all' | 'custom';
76
+ export declare const USAGE_RANGE_KEYS: UsageRangeKey[];
77
+ /** A local calendar day as 'YYYY-MM-DD'. */
78
+ export declare function dayKey(d: Date): string;
79
+ /** 'YYYY-MM-DD' → a local Date at midday (midday, so a clock change never
80
+ * pushes it into the next or previous day). */
81
+ export declare function parseDay(day: string): Date;
82
+ export interface DayRange {
83
+ from?: string;
84
+ to?: string;
85
+ }
86
+ /**
87
+ * The days a preset covers, on the user's own calendar. 'all' is open at the
88
+ * start (the page fills it from the first entry). 'custom' passes through.
89
+ */
90
+ export declare function rangeFor(key: UsageRangeKey, now?: Date, custom?: DayRange): DayRange;
91
+ /**
92
+ * The period a range is compared against. Months compare with the same days
93
+ * of the month before (1–21 Nov against 1–21 Oct), because "this month so far"
94
+ * against the 21 days before it would mix two months and mean nothing. Every
95
+ * other range compares with the same number of days just before it. 'all' and
96
+ * an open range have nothing before them.
97
+ */
98
+ export declare function previousRange(key: UsageRangeKey, range: DayRange): DayRange | null;
99
+ /** Percentage change, or null when there is nothing to compare with. */
100
+ export declare function changePct(now: number, before: number): number | null;
101
+ export type UsageBucket = 'day' | 'week' | 'month';
102
+ /** Days up to two months, weeks up to about a year, months beyond. Keeps the
103
+ * bar count readable (≤ ~60) whatever the range. */
104
+ export declare function bucketFor(from: string, to: string): UsageBucket;
105
+ /** The first day of the bucket a day falls in. Weeks start on Monday. */
106
+ export declare function bucketStart(day: string, bucket: UsageBucket): string;
107
+ export interface UsageBar extends UsageTotals {
108
+ /** First day of the bar. */
109
+ start: string;
110
+ /** Last day of the bar, clipped to the range. */
111
+ end: string;
112
+ /** Holds a month total from before daily records (span 'month') — drawn
113
+ * apart and labelled, so a month's total never passes for one day's. */
114
+ earlier?: boolean;
115
+ }
116
+ /** One bar per bucket across the WHOLE range — empty days show as empty, so a
117
+ * quiet week reads as quiet, not as missing. */
118
+ export declare function usageBars(entries: UsageEntry[], from: string, to: string, bucket?: UsageBucket): UsageBar[];
119
+ export interface UsageView {
120
+ range: {
121
+ from: string;
122
+ to: string;
123
+ };
124
+ bucket: UsageBucket;
125
+ summary: UsageSummary;
126
+ /** The period before, for "vs previous period"; null when there is none. */
127
+ previous: {
128
+ range: DayRange;
129
+ totals: UsageTotals;
130
+ } | null;
131
+ bars: UsageBar[];
132
+ }
133
+ /**
134
+ * Everything the page shows for a range. `entries` must cover the range and,
135
+ * when there is one, the period before it (see previousRange).
136
+ */
137
+ export declare function buildUsageView(entries: UsageEntry[], key: UsageRangeKey, range: DayRange, now?: Date): UsageView;
138
+ /** The days the page must load for a range: the range plus the period before. */
139
+ export declare function daysToLoad(key: UsageRangeKey, range: DayRange): DayRange;
140
+ /** Every line in the range as CSV — the same lines every total is summed from. */
141
+ export declare function usageCsv(entries: UsageEntry[]): string;
142
+ /** What a call cost, in USD, at today's rate card. Falls back to the cost the
143
+ * model definition worked out, when the rate card does not know the model. */
144
+ export declare function usageCost(model: string, provider: string | undefined, input: number, output: number, fallback?: number): number | undefined;
145
+ /** A month from the old counters (extension: VS Code storage; IDE: browser
146
+ * storage) — tokens per model, no days, no rooms, no prices. */
147
+ export interface LegacyMonth {
148
+ month: string;
149
+ models: Array<{
150
+ model: string;
151
+ provider?: string;
152
+ in: number;
153
+ out: number;
154
+ requests: number;
155
+ }>;
156
+ }
157
+ /**
158
+ * The ledger lines that bring one program's old monthly totals into the
159
+ * timeline — one line per model per month, marked span 'month'.
160
+ *
161
+ * `recorded` is what the ledger already holds. The old counters kept running
162
+ * alongside the ledger from the day it began until this import, so whatever
163
+ * the ledger recorded from the same program in a month is taken off that
164
+ * month's old total: nothing is counted twice. Priced at today's rates — the
165
+ * only price there is for a month that never stored one.
166
+ */
167
+ export declare function legacyUsageLines(surface: UsageSurface, months: LegacyMonth[], recorded: UsageEntry[]): UsageEntry[];
168
+ //# sourceMappingURL=view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/usage/view.ts"],"names":[],"mappings":"AASA,6EAA6E;AAC7E,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE5D,6EAA6E;AAC7E,MAAM,WAAW,UAAU;IACzB,iFAAiF;IACjF,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,YAAY,CAAC;IACtB;qEACiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb;mCAC+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,EAAE,EAAE,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AAC,OAAO,EAAE,UAAU,EAAE,GAAG,MAAM,CAOtD;AAID;+EAC+E;AAC/E,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAI3I;AAID;iEACiE;AACjE,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAChG;AAYD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,UAAU,EAAE,CAwCnH"}
@@ -0,0 +1,346 @@
1
+ // Usage timeline — everything the page works out, with no file access, so the
2
+ // extension's dashboard and the IDE (which reads ~/.ava/usage itself through
3
+ // Tauri) run the SAME code and cannot show different figures.
4
+ //
5
+ // The record itself is in ledger.ts. His call, 21 Nov 2026: a timeline where
6
+ // you look up what you spent over any period, money and tokens together, with
7
+ // a comparison against the period before, a breakdown by model, room and mode,
8
+ // and a CSV of the lines behind it.
9
+ import { usdRateFor } from '../audit/cost.js';
10
+ // ─── Lines ──────────────────────────────────────────────────────────────────
11
+ function isEntry(v) {
12
+ const e = v;
13
+ return !!e && typeof e.t === 'string' && typeof e.model === 'string'
14
+ && typeof e.in === 'number' && typeof e.out === 'number';
15
+ }
16
+ /** The local calendar day of an entry, 'YYYY-MM-DD' — read off its own stamp,
17
+ * so a day stays the day it was spent even if the user later travels. */
18
+ export function entryDay(e) {
19
+ return e.t.slice(0, 10);
20
+ }
21
+ /** Parse one month file. A broken line (a crash mid-write) is skipped. */
22
+ export function parseUsageLines(text) {
23
+ const out = [];
24
+ for (const line of text.split('\n')) {
25
+ if (!line.trim())
26
+ continue;
27
+ try {
28
+ const e = JSON.parse(line);
29
+ if (isEntry(e))
30
+ out.push(e);
31
+ }
32
+ catch { /* skipped */ }
33
+ }
34
+ return out;
35
+ }
36
+ /** Keep the entries whose local day is within [from, to] (inclusive; either
37
+ * end may be open), oldest first. */
38
+ export function filterUsage(entries, from, to) {
39
+ return entries
40
+ .filter((e) => { const d = entryDay(e); return (!from || d >= from) && (!to || d <= to); })
41
+ .sort((a, b) => a.t.localeCompare(b.t));
42
+ }
43
+ /** The month files a range needs, 'YYYY-MM', from the months present. */
44
+ export function monthsForRange(available, from, to) {
45
+ return available.filter((m) => (!from || m >= from.slice(0, 7)) && (!to || m <= to.slice(0, 7)));
46
+ }
47
+ // ─── Totals ─────────────────────────────────────────────────────────────────
48
+ export function emptyTotals() {
49
+ return { usd: 0, in: 0, out: 0, replies: 0, unpriced: 0 };
50
+ }
51
+ function add(t, e) {
52
+ const n = typeof e.n === 'number' && e.n >= 0 ? e.n : 1;
53
+ t.in += e.in;
54
+ t.out += e.out;
55
+ t.replies += n;
56
+ if (typeof e.usd === 'number')
57
+ t.usd += e.usd;
58
+ else
59
+ t.unpriced += Math.max(n, 1);
60
+ }
61
+ function grouped(entries, keyOf, name) {
62
+ const map = new Map();
63
+ for (const e of entries) {
64
+ const k = keyOf(e);
65
+ let t = map.get(k);
66
+ if (!t) {
67
+ t = emptyTotals();
68
+ map.set(k, t);
69
+ }
70
+ add(t, e);
71
+ }
72
+ return [...map.entries()].map(([k, t]) => ({ [name]: k, ...t }));
73
+ }
74
+ const bySpend = (a, b) => (b.usd - a.usd) || ((b.in + b.out) - (a.in + a.out));
75
+ /** Sum entries every way the page needs. Biggest spend first, except days. */
76
+ export function summariseUsage(entries) {
77
+ const totals = emptyTotals();
78
+ for (const e of entries)
79
+ add(totals, e);
80
+ const models = new Map();
81
+ for (const e of entries) {
82
+ const k = `${e.provider}\u0000${e.model}`;
83
+ let t = models.get(k);
84
+ if (!t) {
85
+ t = { model: e.model, provider: e.provider, ...emptyTotals() };
86
+ models.set(k, t);
87
+ }
88
+ add(t, e);
89
+ }
90
+ return {
91
+ totals,
92
+ byDay: grouped(entries, entryDay, 'day').sort((a, b) => a.day.localeCompare(b.day)),
93
+ byModel: [...models.values()].sort(bySpend),
94
+ byRoom: grouped(entries, (e) => e.room, 'room').sort(bySpend),
95
+ byMode: grouped(entries, (e) => e.mode, 'mode').sort(bySpend),
96
+ bySurface: grouped(entries, (e) => e.surface, 'surface').sort(bySpend),
97
+ };
98
+ }
99
+ export const USAGE_RANGE_KEYS = ['today', '7d', '30d', 'month', 'last_month', 'all', 'custom'];
100
+ /** A local calendar day as 'YYYY-MM-DD'. */
101
+ export function dayKey(d) {
102
+ return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
103
+ }
104
+ /** 'YYYY-MM-DD' → a local Date at midday (midday, so a clock change never
105
+ * pushes it into the next or previous day). */
106
+ export function parseDay(day) {
107
+ const [y, m, d] = day.split('-').map(Number);
108
+ return new Date(y, (m || 1) - 1, d || 1, 12);
109
+ }
110
+ function addDays(day, n) {
111
+ const d = parseDay(day);
112
+ d.setDate(d.getDate() + n);
113
+ return dayKey(d);
114
+ }
115
+ function daysBetween(from, to) {
116
+ return Math.round((parseDay(to).getTime() - parseDay(from).getTime()) / 86_400_000);
117
+ }
118
+ /**
119
+ * The days a preset covers, on the user's own calendar. 'all' is open at the
120
+ * start (the page fills it from the first entry). 'custom' passes through.
121
+ */
122
+ export function rangeFor(key, now = new Date(), custom) {
123
+ const today = dayKey(now);
124
+ switch (key) {
125
+ case 'today': return { from: today, to: today };
126
+ case '7d': return { from: addDays(today, -6), to: today };
127
+ case '30d': return { from: addDays(today, -29), to: today };
128
+ case 'month': return { from: `${today.slice(0, 7)}-01`, to: today };
129
+ case 'last_month': {
130
+ const first = new Date(now.getFullYear(), now.getMonth() - 1, 1, 12);
131
+ const last = new Date(now.getFullYear(), now.getMonth(), 0, 12);
132
+ return { from: dayKey(first), to: dayKey(last) };
133
+ }
134
+ case 'all': return { to: today };
135
+ case 'custom': {
136
+ let { from, to } = custom ?? {};
137
+ if (from && to && from > to)
138
+ [from, to] = [to, from];
139
+ return { from, to: to ?? today };
140
+ }
141
+ }
142
+ }
143
+ /**
144
+ * The period a range is compared against. Months compare with the same days
145
+ * of the month before (1–21 Nov against 1–21 Oct), because "this month so far"
146
+ * against the 21 days before it would mix two months and mean nothing. Every
147
+ * other range compares with the same number of days just before it. 'all' and
148
+ * an open range have nothing before them.
149
+ */
150
+ export function previousRange(key, range) {
151
+ const { from, to } = range;
152
+ if (key === 'all' || !from || !to)
153
+ return null;
154
+ if (key === 'month' || key === 'last_month') {
155
+ const f = parseDay(from);
156
+ const t = parseDay(to);
157
+ const pf = new Date(f.getFullYear(), f.getMonth() - 1, 1, 12);
158
+ const lastOfPrev = new Date(f.getFullYear(), f.getMonth(), 0, 12).getDate();
159
+ const pt = new Date(f.getFullYear(), f.getMonth() - 1, Math.min(t.getDate(), lastOfPrev), 12);
160
+ return { from: dayKey(pf), to: dayKey(pt) };
161
+ }
162
+ const span = daysBetween(from, to);
163
+ return { from: addDays(from, -(span + 1)), to: addDays(from, -1) };
164
+ }
165
+ /** Percentage change, or null when there is nothing to compare with. */
166
+ export function changePct(now, before) {
167
+ if (!(before > 0))
168
+ return null;
169
+ return ((now - before) / before) * 100;
170
+ }
171
+ /** Days up to two months, weeks up to about a year, months beyond. Keeps the
172
+ * bar count readable (≤ ~60) whatever the range. */
173
+ export function bucketFor(from, to) {
174
+ const span = daysBetween(from, to) + 1;
175
+ if (span <= 62)
176
+ return 'day';
177
+ if (span <= 371)
178
+ return 'week';
179
+ return 'month';
180
+ }
181
+ /** The first day of the bucket a day falls in. Weeks start on Monday. */
182
+ export function bucketStart(day, bucket) {
183
+ if (bucket === 'day')
184
+ return day;
185
+ if (bucket === 'month')
186
+ return `${day.slice(0, 7)}-01`;
187
+ const d = parseDay(day);
188
+ const back = (d.getDay() + 6) % 7; // Monday → 0
189
+ return addDays(day, -back);
190
+ }
191
+ function nextBucket(start, bucket) {
192
+ if (bucket === 'day')
193
+ return addDays(start, 1);
194
+ if (bucket === 'week')
195
+ return addDays(start, 7);
196
+ const d = parseDay(start);
197
+ return dayKey(new Date(d.getFullYear(), d.getMonth() + 1, 1, 12));
198
+ }
199
+ /** One bar per bucket across the WHOLE range — empty days show as empty, so a
200
+ * quiet week reads as quiet, not as missing. */
201
+ export function usageBars(entries, from, to, bucket = bucketFor(from, to)) {
202
+ const bars = [];
203
+ const index = new Map();
204
+ for (let s = bucketStart(from, bucket); s <= to; s = nextBucket(s, bucket)) {
205
+ const end = addDays(nextBucket(s, bucket), -1);
206
+ const bar = { start: s < from ? from : s, end: end > to ? to : end, ...emptyTotals() };
207
+ bars.push(bar);
208
+ index.set(s, bar);
209
+ if (bars.length > 2000)
210
+ break; // a guard, never reached by a sane range
211
+ }
212
+ for (const e of entries) {
213
+ const day = entryDay(e);
214
+ if (day < from || day > to)
215
+ continue;
216
+ const bar = index.get(bucketStart(day, bucket));
217
+ if (bar) {
218
+ add(bar, e);
219
+ if (e.span === 'month')
220
+ bar.earlier = true;
221
+ }
222
+ }
223
+ return bars;
224
+ }
225
+ /**
226
+ * Everything the page shows for a range. `entries` must cover the range and,
227
+ * when there is one, the period before it (see previousRange).
228
+ */
229
+ export function buildUsageView(entries, key, range, now = new Date()) {
230
+ const sorted = [...entries].sort((a, b) => a.t.localeCompare(b.t));
231
+ const to = range.to ?? dayKey(now);
232
+ // An open start ('all') begins at the first thing ever recorded.
233
+ const from = range.from ?? (sorted.length ? entryDay(sorted[0]) : to);
234
+ const inRange = filterUsage(sorted, from, to);
235
+ const prev = previousRange(key, { from, to });
236
+ const bucket = bucketFor(from, to);
237
+ return {
238
+ range: { from, to },
239
+ bucket,
240
+ summary: summariseUsage(inRange),
241
+ previous: prev ? { range: prev, totals: summariseUsage(filterUsage(sorted, prev.from, prev.to)).totals } : null,
242
+ bars: usageBars(inRange, from, to, bucket),
243
+ };
244
+ }
245
+ /** The days the page must load for a range: the range plus the period before. */
246
+ export function daysToLoad(key, range) {
247
+ const prev = previousRange(key, range);
248
+ return { from: prev?.from ?? range.from, to: range.to };
249
+ }
250
+ // ─── Export ─────────────────────────────────────────────────────────────────
251
+ function csvCell(v) {
252
+ const s = v === undefined || v === null ? '' : String(v);
253
+ // Quote anything with a comma, quote or newline, and anything a spreadsheet
254
+ // would read as a formula (=, +, -, @), so a model name can never run as one.
255
+ if (/[",\n\r]/.test(s) || /^[=+\-@]/.test(s))
256
+ return `"${s.replace(/"/g, '""')}"`;
257
+ return s;
258
+ }
259
+ /** Every line in the range as CSV — the same lines every total is summed from. */
260
+ export function usageCsv(entries) {
261
+ const head = ['time', 'program', 'room', 'mode', 'provider', 'model', 'input_tokens', 'output_tokens', 'cached_tokens', 'estimated_usd', 'calls', 'period'];
262
+ const rows = entries.map((e) => [
263
+ e.t, e.surface, e.room, e.mode, e.provider, e.model, e.in, e.out, e.cached, e.usd,
264
+ typeof e.n === 'number' ? e.n : 1, e.span === 'month' ? 'month total (before daily records)' : 'call',
265
+ ].map(csvCell).join(','));
266
+ return [head.join(','), ...rows].join('\r\n') + '\r\n';
267
+ }
268
+ // ─── Pricing ────────────────────────────────────────────────────────────────
269
+ /** What a call cost, in USD, at today's rate card. Falls back to the cost the
270
+ * model definition worked out, when the rate card does not know the model. */
271
+ export function usageCost(model, provider, input, output, fallback) {
272
+ const rate = usdRateFor(model, provider && provider !== 'unknown' ? provider : undefined);
273
+ if (rate)
274
+ return (input / 1_000_000) * rate.inputPerMillion + (output / 1_000_000) * rate.outputPerMillion;
275
+ return typeof fallback === 'number' && Number.isFinite(fallback) ? fallback : undefined;
276
+ }
277
+ /** Midnight on the 1st of a month, local time, as a ledger stamp. */
278
+ function monthStamp(month) {
279
+ const [y, m] = month.split('-').map(Number);
280
+ const d = new Date(y, (m || 1) - 1, 1, 0, 0, 0, 0);
281
+ const off = -d.getTimezoneOffset();
282
+ const sign = off >= 0 ? '+' : '-';
283
+ const pad = (n) => String(Math.abs(Math.trunc(n))).padStart(2, '0');
284
+ return `${month}-01T00:00:00.000${sign}${pad(off / 60)}:${pad(off % 60)}`;
285
+ }
286
+ /**
287
+ * The ledger lines that bring one program's old monthly totals into the
288
+ * timeline — one line per model per month, marked span 'month'.
289
+ *
290
+ * `recorded` is what the ledger already holds. The old counters kept running
291
+ * alongside the ledger from the day it began until this import, so whatever
292
+ * the ledger recorded from the same program in a month is taken off that
293
+ * month's old total: nothing is counted twice. Priced at today's rates — the
294
+ * only price there is for a month that never stored one.
295
+ */
296
+ export function legacyUsageLines(surface, months, recorded) {
297
+ const seen = new Map();
298
+ for (const e of recorded) {
299
+ if (e.surface !== surface || e.span === 'month')
300
+ continue;
301
+ const k = `${e.t.slice(0, 7)}\u0000${e.model}`;
302
+ const v = seen.get(k) ?? { in: 0, out: 0, n: 0 };
303
+ v.in += e.in;
304
+ v.out += e.out;
305
+ v.n += typeof e.n === 'number' ? e.n : 1;
306
+ seen.set(k, v);
307
+ }
308
+ const out = [];
309
+ const done = new Set();
310
+ for (const m of [...months].sort((a, b) => a.month.localeCompare(b.month))) {
311
+ if (!/^\d{4}-\d{2}$/.test(m.month) || done.has(m.month))
312
+ continue;
313
+ done.add(m.month);
314
+ // The same model can appear more than once in an old record (once per
315
+ // provider spelling); merged so the subtraction is against the whole.
316
+ const merged = new Map();
317
+ for (const x of m.models) {
318
+ if (!x || typeof x.model !== 'string')
319
+ continue;
320
+ const v = merged.get(x.model) ?? { model: x.model, provider: x.provider, in: 0, out: 0, requests: 0 };
321
+ v.in += Number(x.in) || 0;
322
+ v.out += Number(x.out) || 0;
323
+ v.requests += Number(x.requests) || 0;
324
+ v.provider = v.provider ?? x.provider;
325
+ merged.set(x.model, v);
326
+ }
327
+ for (const x of merged.values()) {
328
+ const already = seen.get(`${m.month}\u0000${x.model}`);
329
+ const input = Math.max(0, x.in - (already?.in ?? 0));
330
+ const output = Math.max(0, x.out - (already?.out ?? 0));
331
+ if (input <= 0 && output <= 0)
332
+ continue;
333
+ const provider = x.provider && x.provider !== 'unknown' ? x.provider : 'unknown';
334
+ const line = {
335
+ t: monthStamp(m.month), surface, room: 'earlier', mode: 'earlier', provider, model: x.model,
336
+ in: input, out: output, n: Math.max(0, x.requests - (already?.n ?? 0)), span: 'month',
337
+ };
338
+ const usd = usageCost(x.model, provider, input, output);
339
+ if (usd !== undefined)
340
+ line.usd = Math.round(usd * 1e8) / 1e8;
341
+ out.push(line);
342
+ }
343
+ }
344
+ return out;
345
+ }
346
+ //# sourceMappingURL=view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view.js","sourceRoot":"","sources":["../../src/usage/view.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,6EAA6E;AAC7E,8DAA8D;AAC9D,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,+EAA+E;AAC/E,oCAAoC;AAwDpC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,+EAA+E;AAE/E,SAAS,OAAO,CAAC,CAAU;IACzB,MAAM,CAAC,GAAG,CAAe,CAAC;IAC1B,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ;WAC/D,OAAO,CAAC,CAAC,EAAE,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,GAAG,KAAK,QAAQ,CAAC;AAC7D,CAAC;AAED;0EAC0E;AAC1E,MAAM,UAAU,QAAQ,CAAC,CAAwB;IAC/C,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC1B,CAAC;AAED,0EAA0E;AAC1E,MAAM,UA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AM,IAAI,GAAe;gBACvB,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK;gBAC3F,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,GAAG,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO;aACtF,CAAC;YACF,MAAM,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;YACxD,IAAI,GAAG,KAAK,SAAS;gBAAE,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;YAC9D,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@project-ava-supernova/core",
3
- "version": "0.2.195",
3
+ "version": "0.2.197",
4
4
  "description": "Core engine for Ava Supernova — agent, providers, tools, config",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -199,6 +199,11 @@
199
199
  "require": "./dist/health/starters.js",
200
200
  "types": "./dist/health/starters.d.ts"
201
201
  },
202
+ "./usage/view": {
203
+ "import": "./dist/usage/view.js",
204
+ "require": "./dist/usage/view.js",
205
+ "types": "./dist/usage/view.d.ts"
206
+ },
202
207
  "./usage": {
203
208
  "import": "./dist/usage/ledger.js",
204
209
  "require": "./dist/usage/ledger.js",