@adecore/agents-react 0.54.0 → 0.54.1
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/dist/usage/UsagePage.js
CHANGED
|
@@ -10,7 +10,7 @@ import { useChatScope } from '../scope.js';
|
|
|
10
10
|
import { useProvidersStore } from '../state/providers.js';
|
|
11
11
|
import { askedKey, summaryPayload, USAGE_PERIODS, useUsage, useUsageStore } from '../state/usage.js';
|
|
12
12
|
import { whenOpen } from '../transport.js';
|
|
13
|
-
import { formatClock, formatCount, formatDate, formatTokens, PROVIDER_LABELS } from './format.js';
|
|
13
|
+
import { formatClock, formatCount, formatDate, formatRateDate, formatTokens, PROVIDER_LABELS } from './format.js';
|
|
14
14
|
import { useMoney } from './money.js';
|
|
15
15
|
import { deriveUsage, labelEveryFor } from './summary.js';
|
|
16
16
|
import { UsageBreakdown } from './UsageBreakdown.js';
|
|
@@ -281,7 +281,7 @@ function Provenance() {
|
|
|
281
281
|
if ($[7] !== currency || $[8] !== summary.rate || $[9] !== t) {
|
|
282
282
|
t1 = currency === "USD" || summary.rate === null ? null : t("provenance.rate", {
|
|
283
283
|
currency: summary.rate.currency,
|
|
284
|
-
date: summary.rate.date
|
|
284
|
+
date: formatRateDate(summary.rate.date)
|
|
285
285
|
});
|
|
286
286
|
$[7] = currency;
|
|
287
287
|
$[8] = summary.rate;
|
package/dist/usage/UsagePane.js
CHANGED
|
@@ -4,6 +4,7 @@ import { SettingsRow, SettingsSection } from '@adecore/ui/settings';
|
|
|
4
4
|
import { ChartNoAxesColumn } from 'lucide-react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import { useUsage, useUsageStore } from '../state/usage.js';
|
|
7
|
+
import { formatRateDate } from './format.js';
|
|
7
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
9
|
const CURRENCIES = ['USD', 'EUR'];
|
|
9
10
|
/*
|
|
@@ -31,7 +32,7 @@ export function UsagePane(t0) {
|
|
|
31
32
|
let t2;
|
|
32
33
|
if ($[2] !== currency || $[3] !== rate || $[4] !== t) {
|
|
33
34
|
t2 = currency === "USD" ? t("settings.currency.dollars") : rate === null ? t("settings.currency.noRate") : t("settings.currency.converted", {
|
|
34
|
-
date: rate.date
|
|
35
|
+
date: formatRateDate(rate.date)
|
|
35
36
|
});
|
|
36
37
|
$[2] = currency;
|
|
37
38
|
$[3] = rate;
|
package/dist/usage/format.d.ts
CHANGED
|
@@ -10,4 +10,5 @@ export declare const PROVIDER_COLORS: Record<UsageProvider, string>;
|
|
|
10
10
|
export declare function slotLabel(slot: string): string;
|
|
11
11
|
export declare function slotAxisLabel(slot: string): string;
|
|
12
12
|
export declare function formatDate(at: number): string;
|
|
13
|
+
export declare function formatRateDate(date: string): string;
|
|
13
14
|
export declare function shortPath(path: string): string;
|
package/dist/usage/format.js
CHANGED
|
@@ -62,6 +62,11 @@ export function slotAxisLabel(slot) {
|
|
|
62
62
|
export function formatDate(at) {
|
|
63
63
|
return formatDay(at);
|
|
64
64
|
}
|
|
65
|
+
/* The bank's day of a rate (`YYYY-MM-DD`), read in UTC so no zone moves it to the day before. */
|
|
66
|
+
export function formatRateDate(date) {
|
|
67
|
+
const at = Date.parse(`${date}T00:00:00Z`);
|
|
68
|
+
return Number.isNaN(at) ? date : formatDay(at, 'UTC');
|
|
69
|
+
}
|
|
65
70
|
/* Enough of a path's tail to tell two checkouts of the same repository apart, under a row that already carries the name. */
|
|
66
71
|
export function shortPath(path) {
|
|
67
72
|
const parts = path.split('/').filter(Boolean);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adecore/agents-react",
|
|
3
|
-
"version": "0.54.
|
|
3
|
+
"version": "0.54.1",
|
|
4
4
|
"description": "React agent chat threads, composers, approvals, provider accounts and usage views.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -72,12 +72,12 @@
|
|
|
72
72
|
"test:visuals": "bun --config=integration.bunfig.toml --conditions=source test ./src/chat/visual-viewport.integration.test.ts"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@adecore/agent-contracts": "0.54.
|
|
76
|
-
"@adecore/editor": "0.54.
|
|
77
|
-
"@adecore/editor-react": "0.54.
|
|
78
|
-
"@adecore/intelligent-ui": "0.54.
|
|
79
|
-
"@adecore/merge": "0.54.
|
|
80
|
-
"@adecore/utils": "0.54.
|
|
75
|
+
"@adecore/agent-contracts": "0.54.1",
|
|
76
|
+
"@adecore/editor": "0.54.1",
|
|
77
|
+
"@adecore/editor-react": "0.54.1",
|
|
78
|
+
"@adecore/intelligent-ui": "0.54.1",
|
|
79
|
+
"@adecore/merge": "0.54.1",
|
|
80
|
+
"@adecore/utils": "0.54.1",
|
|
81
81
|
"@codemirror/commands": "^6.11.1",
|
|
82
82
|
"@codemirror/language": "^6.13.1",
|
|
83
83
|
"@codemirror/state": "^6.7.6",
|
|
@@ -101,14 +101,14 @@
|
|
|
101
101
|
"zustand": "^5.0.16"
|
|
102
102
|
},
|
|
103
103
|
"peerDependencies": {
|
|
104
|
-
"@adecore/ui": "^0.54.
|
|
104
|
+
"@adecore/ui": "^0.54.1",
|
|
105
105
|
"i18next": "^26.4.2",
|
|
106
106
|
"react": "^19.3.0",
|
|
107
107
|
"react-dom": "^19.3.0",
|
|
108
108
|
"react-i18next": "^17.0.15"
|
|
109
109
|
},
|
|
110
110
|
"devDependencies": {
|
|
111
|
-
"@adecore/ui": "0.54.
|
|
111
|
+
"@adecore/ui": "0.54.1",
|
|
112
112
|
"@types/bun": "^1.4.4",
|
|
113
113
|
"@types/react": "^19.3.0",
|
|
114
114
|
"@types/react-dom": "^19.3.0",
|
package/src/usage/UsagePage.tsx
CHANGED
|
@@ -9,7 +9,7 @@ import { useChatScope } from '../scope';
|
|
|
9
9
|
import { useProvidersStore } from '../state/providers';
|
|
10
10
|
import { askedKey, summaryPayload, USAGE_PERIODS, useUsage, useUsageStore, type UsageMetric, type UsagePeriod } from '../state/usage';
|
|
11
11
|
import { whenOpen, type ChatTransport } from '../transport';
|
|
12
|
-
import { formatClock, formatCount, formatDate, formatTokens, PROVIDER_LABELS } from './format';
|
|
12
|
+
import { formatClock, formatCount, formatDate, formatRateDate, formatTokens, PROVIDER_LABELS } from './format';
|
|
13
13
|
import { useMoney } from './money';
|
|
14
14
|
import { deriveUsage, labelEveryFor } from './summary';
|
|
15
15
|
import { UsageBreakdown } from './UsageBreakdown';
|
|
@@ -121,7 +121,8 @@ function Provenance() {
|
|
|
121
121
|
summary.pricing.fetchedAt === null ? t('provenance.bundledPrices') : t('provenance.fetchedPrices', { date: formatDate(summary.pricing.fetchedAt) });
|
|
122
122
|
|
|
123
123
|
// The rate is named only when it is being used, so a page in dollars says nothing about euros.
|
|
124
|
-
const rate =
|
|
124
|
+
const rate =
|
|
125
|
+
currency === 'USD' || summary.rate === null ? null : t('provenance.rate', { currency: summary.rate.currency, date: formatRateDate(summary.rate.date) });
|
|
125
126
|
|
|
126
127
|
return (
|
|
127
128
|
<p className="mt-auto text-center text-xs text-text-muted">
|
package/src/usage/UsagePane.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { SettingsRow, SettingsSection } from '@adecore/ui/settings';
|
|
|
3
3
|
import { ChartNoAxesColumn } from 'lucide-react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { useUsage, useUsageStore } from '../state/usage';
|
|
6
|
-
import type
|
|
6
|
+
import { formatRateDate, type UsageCurrency } from './format';
|
|
7
7
|
|
|
8
8
|
const CURRENCIES: readonly UsageCurrency[] = ['USD', 'EUR'];
|
|
9
9
|
|
|
@@ -26,7 +26,7 @@ export function UsagePane({ onOpenPage }: { onOpenPage(): void }) {
|
|
|
26
26
|
? t('settings.currency.dollars')
|
|
27
27
|
: rate === null
|
|
28
28
|
? t('settings.currency.noRate')
|
|
29
|
-
: t('settings.currency.converted', { date: rate.date })
|
|
29
|
+
: t('settings.currency.converted', { date: formatRateDate(rate.date) })
|
|
30
30
|
}
|
|
31
31
|
control={
|
|
32
32
|
<Segmented
|
package/src/usage/format.ts
CHANGED
|
@@ -84,6 +84,13 @@ export function formatDate(at: number): string {
|
|
|
84
84
|
return formatDay(at);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
/* The bank's day of a rate (`YYYY-MM-DD`), read in UTC so no zone moves it to the day before. */
|
|
88
|
+
export function formatRateDate(date: string): string {
|
|
89
|
+
const at = Date.parse(`${date}T00:00:00Z`);
|
|
90
|
+
|
|
91
|
+
return Number.isNaN(at) ? date : formatDay(at, 'UTC');
|
|
92
|
+
}
|
|
93
|
+
|
|
87
94
|
/* Enough of a path's tail to tell two checkouts of the same repository apart, under a row that already carries the name. */
|
|
88
95
|
export function shortPath(path: string): string {
|
|
89
96
|
const parts = path.split('/').filter(Boolean);
|