@adecore/agents-react 0.53.3 → 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/agents/AgentIcon.js +1 -1
- package/dist/agents/AgentModelLabel.js +1 -1
- package/dist/agents/accounts.js +1 -1
- package/dist/chat/attachments.js +1 -1
- package/dist/chat/forks.js +1 -1
- package/dist/chat/logic/limit.js +1 -1
- package/dist/chat/logic/scrubber.js +1 -1
- package/dist/chat/logic/selection-switch.d.ts +6 -0
- package/dist/chat/logic/selection-switch.js +42 -0
- package/dist/chat/logic/timeline-target.d.ts +1 -1
- package/dist/chat/logic/timeline.d.ts +6 -1
- package/dist/chat/logic/timeline.js +16 -2
- package/dist/chat/logic/tool-looks.js +1 -1
- package/dist/chat/logic/tools.js +1 -1
- package/dist/chat/logic/workflow.js +1 -1
- package/dist/chat/preferences.js +1 -1
- package/dist/chat/runtime-modes.js +1 -1
- package/dist/chat/send-key.js +1 -1
- package/dist/chat/stash.js +2 -2
- package/dist/chat/subagent-list.js +1 -1
- package/dist/chat/ui/AccountPill.js +3 -3
- package/dist/chat/ui/BookmarkMarker.js +6 -6
- package/dist/chat/ui/BookmarkSubmenu.js +5 -5
- package/dist/chat/ui/ChatActivity.js +15 -14
- package/dist/chat/ui/CodeBlock.js +9 -7
- package/dist/chat/ui/Composer.js +13 -13
- package/dist/chat/ui/ComposerInput.d.ts +1 -1
- package/dist/chat/ui/ComposerInput.js +35 -18
- package/dist/chat/ui/DiffPool.js +1 -1
- package/dist/chat/ui/EditDiff.js +2 -2
- package/dist/chat/ui/GoalDock.js +5 -5
- package/dist/chat/ui/ImageView.js +4 -4
- package/dist/chat/ui/LimitState.js +12 -12
- package/dist/chat/ui/Markdown.d.ts +1 -1
- package/dist/chat/ui/Markdown.js +11 -10
- package/dist/chat/ui/MermaidBlock.js +7 -6
- package/dist/chat/ui/MessageActions.js +7 -7
- package/dist/chat/ui/ModelMarks.js +2 -2
- package/dist/chat/ui/Pickers.d.ts +1 -1
- package/dist/chat/ui/Pickers.js +32 -27
- package/dist/chat/ui/PromptComposer.d.ts +1 -1
- package/dist/chat/ui/PromptComposer.js +5 -5
- package/dist/chat/ui/PromptEditor.js +3 -3
- package/dist/chat/ui/QuoteButton.js +2 -2
- package/dist/chat/ui/ReferenceChip.js +3 -3
- package/dist/chat/ui/ReferenceTrail.js +2 -2
- package/dist/chat/ui/ResumeCompactionDock.js +3 -3
- package/dist/chat/ui/RunSettings.js +11 -11
- package/dist/chat/ui/Scrubber.js +4 -4
- package/dist/chat/ui/SessionLine.js +2 -2
- package/dist/chat/ui/ShellCommand.d.ts +1 -1
- package/dist/chat/ui/ShellCommand.js +2 -2
- package/dist/chat/ui/SubagentControls.js +3 -3
- package/dist/chat/ui/SubagentInfo.js +5 -5
- package/dist/chat/ui/SubagentStopButton.js +2 -2
- package/dist/chat/ui/SubagentTimeline.js +18 -16
- package/dist/chat/ui/Timeline.js +231 -145
- package/dist/chat/ui/TimelineMenu.js +7 -7
- package/dist/chat/ui/UnifiedDiff.js +2 -2
- package/dist/chat/ui/VisualDialogs.js +1 -1
- package/dist/chat/ui/VisualFrame.js +4 -4
- package/dist/chat/ui/WorkflowAgentLine.d.ts +1 -1
- package/dist/chat/ui/WorkflowAgentLine.js +3 -3
- package/dist/chat/ui/chip-clipboard.d.ts +1 -1
- package/dist/chat/ui/composer/ComposerControls.d.ts +1 -1
- package/dist/chat/ui/composer/ComposerControls.js +4 -4
- package/dist/chat/ui/composer/ComposerMenu.js +5 -4
- package/dist/chat/ui/composer/DraftParts.js +2 -2
- package/dist/chat/ui/composer/QueuedMessages.js +2 -2
- package/dist/chat/ui/composer/chip-paste.d.ts +1 -1
- package/dist/chat/ui/composer/chips.d.ts +1 -1
- package/dist/chat/ui/composer/chips.js +2 -2
- package/dist/chat/ui/composer/key-handler.js +1 -1
- package/dist/chat/ui/composer/placeholder.js +1 -1
- package/dist/chat/ui/composer/use-composer-menus.d.ts +1 -1
- package/dist/chat/ui/composer/use-composer-menus.js +1 -1
- package/dist/chat/ui/composer/use-composer-submit.d.ts +1 -1
- package/dist/chat/ui/composer/use-draft-files.d.ts +2 -2
- package/dist/chat/ui/composer/use-draft-files.js +1 -1
- package/dist/chat/ui/composer/use-effort-stepper.js +1 -1
- package/dist/chat/ui/composer/use-prompt-menus.d.ts +2 -2
- package/dist/chat/ui/composer/use-prompt-menus.js +1 -1
- package/dist/chat/ui/diff/ApprovalReview.js +2 -2
- package/dist/chat/ui/diff/DiffOmitted.js +1 -1
- package/dist/chat/ui/diff/DiffStack.js +2 -2
- package/dist/chat/ui/diff/EditorEditDiff.d.ts +1 -1
- package/dist/chat/ui/diff/EditorEditDiff.js +5 -5
- package/dist/chat/ui/diff/EditorPatchDiff.d.ts +1 -1
- package/dist/chat/ui/diff/EditorPatchDiff.js +1 -1
- package/dist/chat/ui/diff/LegacyEditDiff.js +47 -31
- package/dist/chat/ui/diff/LegacyUnifiedDiff.js +93 -69
- package/dist/chat/ui/diff/RawDiff.js +54 -35
- package/dist/chat/ui/diff/syntax-runtime.d.ts +1 -1
- package/dist/chat/ui/highlighter.d.ts +1 -1
- package/dist/chat/ui/highlighter.js +1 -1
- package/dist/chat/ui/icons.js +1 -1
- package/dist/chat/ui/intelligent-ui/UiBlockFrame.d.ts +1 -1
- package/dist/chat/ui/intelligent-ui/UiBlockFrame.js +4 -4
- package/dist/chat/ui/intelligent-ui/UiFallbackPart.js +2 -2
- package/dist/chat/ui/intelligent-ui/UiReply.d.ts +2 -2
- package/dist/chat/ui/intelligent-ui/UiReply.js +8 -8
- package/dist/chat/ui/intelligent-ui/node-text.d.ts +1 -1
- package/dist/chat/ui/intelligent-ui/render-context.d.ts +1 -1
- package/dist/chat/ui/intelligent-ui/renderers/chart.js +28 -15
- package/dist/chat/ui/intelligent-ui/renderers/choices.js +4 -4
- package/dist/chat/ui/intelligent-ui/renderers/content.js +6 -6
- package/dist/chat/ui/intelligent-ui/renderers/data.js +104 -87
- package/dist/chat/ui/intelligent-ui/renderers/inputs.js +3 -3
- package/dist/chat/ui/intelligent-ui/renderers/links.js +2 -2
- package/dist/chat/ui/intelligent-ui/renderers/map-view.js +4 -4
- package/dist/chat/ui/intelligent-ui/renderers/map.js +3 -3
- package/dist/chat/ui/intelligent-ui/renderers/structure.js +2 -2
- package/dist/chat/ui/intelligent-ui/renderers/text.js +5 -5
- package/dist/chat/ui/intelligent-ui/tones.d.ts +1 -1
- package/dist/chat/ui/intelligent-ui/use-ui-links.d.ts +1 -1
- package/dist/chat/ui/intelligent-ui/use-ui-links.js +2 -2
- package/dist/chat/ui/intelligent-ui/use-ui-queries.js +1 -1
- package/dist/chat/ui/reference-icons.d.ts +1 -1
- package/dist/chat/ui/reference-icons.js +2 -2
- package/dist/chat/ui/reply-context.d.ts +1 -1
- package/dist/chat/ui/rows/ForksRow.js +3 -3
- package/dist/chat/ui/rows/GeneratedImageRow.js +5 -5
- package/dist/chat/ui/rows/MessageRows.d.ts +6 -1
- package/dist/chat/ui/rows/MessageRows.js +151 -22
- package/dist/chat/ui/rows/Rows.js +39 -21
- package/dist/chat/ui/rows/SubagentRow.js +16 -16
- package/dist/chat/ui/rows/TaskRow.js +3 -3
- package/dist/chat/ui/rows/VisualRow.js +2 -2
- package/dist/chat/ui/rows/WorkRows.d.ts +2 -2
- package/dist/chat/ui/rows/WorkRows.js +37 -25
- package/dist/chat/ui/rows/WorkflowRow.js +8 -8
- package/dist/chat/ui/use-diff-source-tokens.js +1 -1
- package/dist/chat/ui/visual-theme.d.ts +1 -1
- package/dist/chat/ui/visual-theme.js +2 -2
- package/dist/chat/workflow-list.js +1 -1
- package/dist/host.d.ts +4 -4
- package/dist/host.js +1 -1
- package/dist/lazy.js +1 -1
- package/dist/locales/en/agent-chat.d.ts +4 -0
- package/dist/locales/en/agent-chat.js +4 -0
- package/dist/locales/nl/agent-chat.d.ts +4 -0
- package/dist/locales/nl/agent-chat.js +4 -0
- package/dist/port-transport.js +1 -1
- package/dist/prompts/logic/subjects.d.ts +1 -1
- package/dist/prompts/ui/ApprovalBody.js +16 -7
- package/dist/prompts/ui/PromptActions.js +2 -2
- package/dist/prompts/ui/PromptCard.js +5 -4
- package/dist/prompts/ui/PromptView.js +1 -1
- package/dist/prompts/ui/QuestionBody.js +4 -4
- package/dist/providers/AccountDetail.js +4 -4
- package/dist/providers/AccountOrderList.js +2 -2
- package/dist/providers/AccountVariables.js +3 -3
- package/dist/providers/AddAccountForm.js +6 -6
- package/dist/providers/CliDetail.js +8 -8
- package/dist/providers/InstallPage.js +3 -3
- package/dist/providers/ProviderList.js +2 -2
- package/dist/providers/ProvidersPane.d.ts +1 -1
- package/dist/providers/ProvidersPane.js +5 -5
- package/dist/providers/install-steps.d.ts +1 -1
- package/dist/settings/sections.d.ts +2 -2
- package/dist/state/chats.js +1 -1
- package/dist/state/usage.js +2 -2
- package/dist/theme.css +4 -4
- package/dist/transport.d.ts +1 -1
- package/dist/usage/LimitsList.js +4 -4
- package/dist/usage/UsageBreakdown.js +5 -5
- package/dist/usage/UsageChart.js +1 -1
- package/dist/usage/UsageDialog.js +1 -1
- package/dist/usage/UsageLimits.js +6 -6
- package/dist/usage/UsageLimitsCard.js +2 -2
- package/dist/usage/UsagePage.js +202 -191
- package/dist/usage/UsagePane.js +4 -3
- package/dist/usage/UsageSummary.js +1 -1
- package/dist/usage/UsageTiles.js +1 -1
- package/dist/usage/format.d.ts +1 -0
- package/dist/usage/format.js +5 -0
- package/dist/usage/limit-groups.js +2 -2
- package/dist/usage/summary.js +1 -1
- package/package.json +9 -8
- package/src/agents/AgentIcon.tsx +1 -1
- package/src/agents/AgentModelLabel.tsx +2 -2
- package/src/agents/ProviderLogo.tsx +1 -1
- package/src/agents/accounts.ts +1 -1
- package/src/agents/option-words.ts +1 -1
- package/src/chat/attachments.ts +1 -1
- package/src/chat/bookmarks.ts +1 -1
- package/src/chat/drafts.ts +1 -1
- package/src/chat/forks.ts +1 -1
- package/src/chat/logic/fork.ts +1 -1
- package/src/chat/logic/limit.ts +1 -1
- package/src/chat/logic/scrubber.ts +1 -1
- package/src/chat/logic/selection-switch.ts +47 -0
- package/src/chat/logic/timeline-copy.ts +1 -1
- package/src/chat/logic/timeline-target.ts +1 -1
- package/src/chat/logic/timeline.ts +28 -4
- package/src/chat/logic/tool-looks.ts +1 -1
- package/src/chat/logic/tools.ts +1 -1
- package/src/chat/logic/workflow.ts +1 -1
- package/src/chat/pending-prompts.ts +1 -1
- package/src/chat/preferences.ts +1 -1
- package/src/chat/reading-width.ts +1 -1
- package/src/chat/runtime-modes.ts +1 -1
- package/src/chat/send-key.ts +1 -1
- package/src/chat/stash.ts +2 -2
- package/src/chat/subagent-conversation.ts +1 -1
- package/src/chat/subagent-list.ts +1 -1
- package/src/chat/subagent-view.ts +1 -1
- package/src/chat/thumbnails.ts +1 -1
- package/src/chat/ui/AccountPill.tsx +4 -4
- package/src/chat/ui/BookmarkMarker.tsx +6 -6
- package/src/chat/ui/BookmarkSubmenu.tsx +5 -5
- package/src/chat/ui/ChatActivity.tsx +15 -15
- package/src/chat/ui/CodeBlock.tsx +10 -8
- package/src/chat/ui/Composer.tsx +13 -13
- package/src/chat/ui/ComposerInput.tsx +10 -2
- package/src/chat/ui/DiffPool.tsx +1 -1
- package/src/chat/ui/EditDiff.tsx +3 -4
- package/src/chat/ui/GoalDock.tsx +6 -6
- package/src/chat/ui/ImageView.tsx +4 -4
- package/src/chat/ui/LimitState.tsx +13 -13
- package/src/chat/ui/Markdown.tsx +12 -12
- package/src/chat/ui/MermaidBlock.tsx +6 -6
- package/src/chat/ui/MessageActions.tsx +7 -7
- package/src/chat/ui/ModelMarks.tsx +2 -2
- package/src/chat/ui/Pickers.tsx +10 -10
- package/src/chat/ui/PromptComposer.tsx +6 -6
- package/src/chat/ui/PromptEditor.tsx +4 -4
- package/src/chat/ui/QuoteButton.tsx +2 -2
- package/src/chat/ui/ReferenceChip.tsx +3 -3
- package/src/chat/ui/ReferenceTrail.tsx +2 -2
- package/src/chat/ui/ResumeCompactionDock.tsx +3 -3
- package/src/chat/ui/RunSettings.tsx +13 -13
- package/src/chat/ui/Scrubber.tsx +4 -4
- package/src/chat/ui/SessionLine.tsx +2 -2
- package/src/chat/ui/ShellCommand.tsx +2 -2
- package/src/chat/ui/SubagentControls.tsx +3 -3
- package/src/chat/ui/SubagentInfo.tsx +5 -5
- package/src/chat/ui/SubagentStopButton.tsx +3 -3
- package/src/chat/ui/SubagentTimeline.tsx +20 -17
- package/src/chat/ui/Timeline.tsx +232 -143
- package/src/chat/ui/TimelineMenu.tsx +7 -7
- package/src/chat/ui/UnifiedDiff.tsx +3 -3
- package/src/chat/ui/VisualDialogs.tsx +2 -2
- package/src/chat/ui/VisualFrame.tsx +4 -4
- package/src/chat/ui/WorkflowAgentLine.tsx +4 -4
- package/src/chat/ui/chip-clipboard.ts +1 -1
- package/src/chat/ui/composer/ComposerControls.tsx +4 -4
- package/src/chat/ui/composer/ComposerMenu.tsx +6 -6
- package/src/chat/ui/composer/DraftParts.tsx +2 -2
- package/src/chat/ui/composer/QueuedMessages.tsx +2 -2
- package/src/chat/ui/composer/chip-paste.ts +1 -1
- package/src/chat/ui/composer/chips.ts +2 -2
- package/src/chat/ui/composer/key-handler.ts +2 -2
- package/src/chat/ui/composer/placeholder.ts +1 -1
- package/src/chat/ui/composer/use-chat-controls.ts +1 -1
- package/src/chat/ui/composer/use-compaction-offer.ts +1 -1
- package/src/chat/ui/composer/use-composer-menus.ts +2 -2
- package/src/chat/ui/composer/use-composer-submit.ts +2 -2
- package/src/chat/ui/composer/use-draft-files.ts +3 -3
- package/src/chat/ui/composer/use-effort-stepper.ts +2 -2
- package/src/chat/ui/composer/use-pending-requests.ts +1 -1
- package/src/chat/ui/composer/use-prompt-menus.ts +3 -3
- package/src/chat/ui/composer/use-take-back.ts +1 -1
- package/src/chat/ui/diff/ApprovalReview.tsx +3 -3
- package/src/chat/ui/diff/DiffOmitted.tsx +1 -1
- package/src/chat/ui/diff/DiffStack.tsx +2 -2
- package/src/chat/ui/diff/EditorEditDiff.tsx +5 -5
- package/src/chat/ui/diff/EditorPatchDiff.tsx +1 -1
- package/src/chat/ui/diff/LegacyDiffPool.tsx +1 -1
- package/src/chat/ui/diff/LegacyEditDiff.tsx +18 -9
- package/src/chat/ui/diff/LegacyUnifiedDiff.tsx +24 -13
- package/src/chat/ui/diff/RawDiff.tsx +8 -5
- package/src/chat/ui/diff/syntax-runtime.ts +1 -1
- package/src/chat/ui/highlighter.ts +1 -1
- package/src/chat/ui/icons.tsx +2 -2
- package/src/chat/ui/intelligent-ui/UiBlockFrame.tsx +5 -5
- package/src/chat/ui/intelligent-ui/UiFallbackPart.tsx +2 -2
- package/src/chat/ui/intelligent-ui/UiReply.tsx +18 -18
- package/src/chat/ui/intelligent-ui/node-text.ts +1 -1
- package/src/chat/ui/intelligent-ui/render-context.ts +1 -1
- package/src/chat/ui/intelligent-ui/renderers/chart.tsx +15 -7
- package/src/chat/ui/intelligent-ui/renderers/choices.tsx +4 -4
- package/src/chat/ui/intelligent-ui/renderers/content.tsx +7 -7
- package/src/chat/ui/intelligent-ui/renderers/data.tsx +8 -7
- package/src/chat/ui/intelligent-ui/renderers/inputs.tsx +3 -3
- package/src/chat/ui/intelligent-ui/renderers/links.tsx +4 -4
- package/src/chat/ui/intelligent-ui/renderers/map-view.tsx +4 -4
- package/src/chat/ui/intelligent-ui/renderers/map.tsx +5 -5
- package/src/chat/ui/intelligent-ui/renderers/structure.tsx +3 -3
- package/src/chat/ui/intelligent-ui/renderers/text.tsx +5 -5
- package/src/chat/ui/intelligent-ui/tones.ts +1 -1
- package/src/chat/ui/intelligent-ui/use-ui-links.ts +2 -2
- package/src/chat/ui/intelligent-ui/use-ui-queries.ts +1 -1
- package/src/chat/ui/reference-icons.ts +2 -2
- package/src/chat/ui/reply-context.ts +1 -1
- package/src/chat/ui/rows/ForksRow.tsx +3 -3
- package/src/chat/ui/rows/GeneratedImageRow.tsx +7 -7
- package/src/chat/ui/rows/MessageRows.tsx +57 -33
- package/src/chat/ui/rows/RowContainer.tsx +1 -1
- package/src/chat/ui/rows/Rows.tsx +7 -4
- package/src/chat/ui/rows/SubagentRow.tsx +16 -16
- package/src/chat/ui/rows/TaskRow.tsx +4 -4
- package/src/chat/ui/rows/VisualRow.tsx +2 -2
- package/src/chat/ui/rows/WorkRows.tsx +44 -32
- package/src/chat/ui/rows/WorkflowRow.tsx +9 -9
- package/src/chat/ui/rows/row-rhythm.ts +1 -1
- package/src/chat/ui/use-diff-source-tokens.ts +1 -1
- package/src/chat/ui/visual-theme.ts +2 -2
- package/src/chat/workflow-list.ts +1 -1
- package/src/host.ts +6 -6
- package/src/lazy.tsx +1 -1
- package/src/locales/en/agent-chat.ts +4 -0
- package/src/locales/nl/agent-chat.ts +4 -0
- package/src/port-transport.ts +1 -1
- package/src/prompts/logic/subjects.ts +1 -1
- package/src/prompts/ui/ApprovalBody.tsx +19 -9
- package/src/prompts/ui/PromptActions.tsx +2 -2
- package/src/prompts/ui/PromptCard.tsx +4 -4
- package/src/prompts/ui/PromptView.tsx +1 -1
- package/src/prompts/ui/QuestionBody.tsx +5 -5
- package/src/providers/AccountDetail.tsx +5 -5
- package/src/providers/AccountOrderList.tsx +2 -2
- package/src/providers/AccountVariables.tsx +4 -4
- package/src/providers/AddAccountForm.tsx +7 -7
- package/src/providers/CliDetail.tsx +9 -9
- package/src/providers/InstallPage.tsx +4 -4
- package/src/providers/ProviderList.tsx +4 -4
- package/src/providers/ProvidersPane.tsx +7 -7
- package/src/providers/account-actions.ts +1 -1
- package/src/providers/install-steps.ts +1 -1
- package/src/providers/parts.tsx +1 -1
- package/src/providers/provider-abilities.ts +1 -1
- package/src/providers/provider-groups.ts +1 -1
- package/src/providers/variables.ts +1 -1
- package/src/settings/sections.ts +2 -2
- package/src/state/chats.ts +2 -2
- package/src/state/provider-accounts.ts +1 -1
- package/src/state/providers.ts +1 -1
- package/src/state/usage.ts +2 -2
- package/src/theme.css +4 -4
- package/src/transport.ts +1 -1
- package/src/usage/LimitsList.tsx +5 -5
- package/src/usage/UsageBreakdown.tsx +6 -6
- package/src/usage/UsageChart.tsx +2 -2
- package/src/usage/UsageDialog.tsx +2 -2
- package/src/usage/UsageLimits.tsx +7 -7
- package/src/usage/UsageLimitsCard.tsx +2 -2
- package/src/usage/UsagePage.tsx +8 -7
- package/src/usage/UsagePane.tsx +4 -4
- package/src/usage/UsageSummary.tsx +2 -2
- package/src/usage/UsageTiles.tsx +1 -1
- package/src/usage/format.ts +7 -0
- package/src/usage/limit-groups.ts +2 -2
- package/src/usage/limits.ts +1 -1
- package/src/usage/summary.ts +1 -1
- package/dist/chat/logic/json.d.ts +0 -1
- package/dist/chat/logic/json.js +0 -4
- package/src/chat/logic/json.ts +0 -4
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { UsageModel, UsageProject, UsageProvider, UsageSummaryResult } from '@adecore/agent-contracts';
|
|
2
|
+
import { USAGE_PROVIDERS, totalTokensOf } from '@adecore/agent-contracts';
|
|
3
|
+
import { EmptyState, Icon, SectionLabel, Segmented, Tooltip } from '@adecore/ui';
|
|
2
4
|
import clsx from 'clsx';
|
|
3
5
|
import { CircleHelp, Folder, Info } from 'lucide-react';
|
|
6
|
+
import { useState } from 'react';
|
|
4
7
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
8
|
+
import { useModelName } from '../agents/model-name';
|
|
9
|
+
import { useHostProjectLook } from '../host-hooks';
|
|
7
10
|
import { useChatScope } from '../scope';
|
|
8
11
|
import type { UsageMetric } from '../state/usage';
|
|
9
|
-
import { USAGE_PROVIDERS, totalTokensOf } from '@adecore/agent-contracts';
|
|
10
12
|
import { ChartLogo } from './ChartLogo';
|
|
11
|
-
import { useModelName } from '../agents/model-name';
|
|
12
13
|
import { formatCount, formatTokens, PROVIDER_COLORS, PROVIDER_LABELS, shortPath, slotLabel } from './format';
|
|
13
14
|
import { useMoney } from './money';
|
|
14
15
|
import { deriveDays } from './summary';
|
|
15
|
-
import { useHostProjectLook } from '../host-hooks';
|
|
16
16
|
|
|
17
17
|
type Breakdown = 'models' | 'projects' | 'day';
|
|
18
18
|
|
package/src/usage/UsageChart.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import { useTranslation } from 'react-i18next';
|
|
3
1
|
import type { UsageProvider } from '@adecore/agent-contracts';
|
|
4
2
|
import { Surface, useMeasuredWidth } from '@adecore/ui';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { PROVIDER_COLORS, PROVIDER_LABELS, slotAxisLabel, slotLabel } from './format';
|
|
6
6
|
import { niceScale, type ChartSlot } from './summary';
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import i18next from 'i18next';
|
|
3
1
|
import { Dialog } from '@adecore/ui';
|
|
2
|
+
import i18next from 'i18next';
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
* The frame of the usage page, wider than the settings for the chart and the breakdown. What goes in
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
+
import type { UsageProvider } from '@adecore/agent-contracts';
|
|
2
|
+
import { Button, Icon, SectionLabel, Segmented, Tooltip, useNow } from '@adecore/ui';
|
|
3
|
+
import { LogIn } from 'lucide-react';
|
|
1
4
|
import { useState } from 'react';
|
|
2
5
|
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import { LogIn } from 'lucide-react';
|
|
4
|
-
import type { UsageProvider } from '@adecore/agent-contracts';
|
|
5
6
|
import { AccountDot } from '../agents/AccountDot';
|
|
6
|
-
import { Button, Icon, SectionLabel, Segmented, Tooltip, useNow } from '@adecore/ui';
|
|
7
7
|
import { useChatHost } from '../host';
|
|
8
|
+
import { useHostLoginBlocked } from '../host-hooks';
|
|
9
|
+
import { useChatScope } from '../scope';
|
|
10
|
+
import { useProviderAccounts } from '../state/provider-accounts';
|
|
8
11
|
import { ChartLogo } from './ChartLogo';
|
|
9
12
|
import { PROVIDER_LABELS } from './format';
|
|
10
13
|
import { accountNote, checkedLabel, hasSeveralAccounts, isSignedOut, type LimitAccount } from './limit-groups';
|
|
11
|
-
import { WindowBar } from './LimitsList';
|
|
12
14
|
import { useLimitGroups, useUsageLimits } from './limits';
|
|
13
|
-
import {
|
|
14
|
-
import { useChatScope } from '../scope';
|
|
15
|
-
import { useHostLoginBlocked } from '../host-hooks';
|
|
15
|
+
import { WindowBar } from './LimitsList';
|
|
16
16
|
|
|
17
17
|
const MINUTE_MS = 60_000;
|
|
18
18
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { useNow, PreviewCard } from '@adecore/ui';
|
|
1
2
|
import i18next from 'i18next';
|
|
2
3
|
import { useState, type ReactElement } from 'react';
|
|
3
|
-
import { AccountLimitsList } from './LimitsList';
|
|
4
4
|
import { useLimitGroups, useUsageLimits } from './limits';
|
|
5
|
-
import {
|
|
5
|
+
import { AccountLimitsList } from './LimitsList';
|
|
6
6
|
|
|
7
7
|
const MINUTE_MS = 60_000;
|
|
8
8
|
|
package/src/usage/UsagePage.tsx
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { USAGE_PROVIDERS, type UsageAccount } from '@adecore/agent-contracts';
|
|
2
|
+
import { Button, CloseButton, Dialog, EmptyState, FormError, IconButton, ScrollArea, Segmented, Select, Skeleton } from '@adecore/ui';
|
|
3
|
+
import { ChartNoAxesColumn, RefreshCw } from 'lucide-react';
|
|
1
4
|
import { useCallback, useEffect, useState, useSyncExternalStore, type ReactNode } from 'react';
|
|
2
5
|
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import { ChartNoAxesColumn, RefreshCw } from 'lucide-react';
|
|
4
|
-
import { USAGE_PROVIDERS, type UsageAccount } from '@adecore/agent-contracts';
|
|
5
|
-
import { Button, CloseButton, Dialog, EmptyState, FormError, IconButton, Segmented, Select, Skeleton } from '@adecore/ui';
|
|
6
6
|
import { AccountDot } from '../agents/AccountDot';
|
|
7
7
|
import { useChatHost } from '../host';
|
|
8
8
|
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">
|
|
@@ -235,7 +236,7 @@ export function UsagePage({ pickers, notice }: UsagePageProps) {
|
|
|
235
236
|
<CloseButton label={t('dialog.close')} dialog />
|
|
236
237
|
</div>
|
|
237
238
|
</header>
|
|
238
|
-
<
|
|
239
|
+
<ScrollArea className="grow" viewportClassName="flex flex-col gap-6 px-6 pt-4 pb-6 max-[960px]:px-4">
|
|
239
240
|
{notice?.(shown !== null)}
|
|
240
241
|
{noRoots && (
|
|
241
242
|
<EmptyState className={DIALOG_CENTER} icon={ChartNoAxesColumn} action={<HostAgents />}>
|
|
@@ -268,7 +269,7 @@ export function UsagePage({ pickers, notice }: UsagePageProps) {
|
|
|
268
269
|
)}
|
|
269
270
|
{/* Last in a column that fills the dialog, so it sits at the bottom even under a short page. */}
|
|
270
271
|
<Provenance />
|
|
271
|
-
</
|
|
272
|
+
</ScrollArea>
|
|
272
273
|
</div>
|
|
273
274
|
);
|
|
274
275
|
}
|
package/src/usage/UsagePane.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { Segmented, Button, Icon } from '@adecore/ui';
|
|
2
|
+
import { SettingsRow, SettingsSection } from '@adecore/ui/settings';
|
|
1
3
|
import { ChartNoAxesColumn } from 'lucide-react';
|
|
2
4
|
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import { SettingsRow, SettingsSection } from '@adecore/ui/settings';
|
|
4
|
-
import { Segmented, Button, Icon } from '@adecore/ui';
|
|
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
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useTranslation } from 'react-i18next';
|
|
2
1
|
import type { UsageTotals } from '@adecore/agent-contracts';
|
|
3
|
-
import type { UsageMetric } from '../state/usage';
|
|
4
2
|
import { totalTokensOf } from '@adecore/agent-contracts';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import type { UsageMetric } from '../state/usage';
|
|
5
5
|
import { ChartLogo } from './ChartLogo';
|
|
6
6
|
import { formatCount, formatTokens, PROVIDER_LABELS } from './format';
|
|
7
7
|
import { useMoney } from './money';
|
package/src/usage/UsageTiles.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useTranslation } from 'react-i18next';
|
|
2
1
|
import type { UsageTotals } from '@adecore/agent-contracts';
|
|
3
2
|
import { totalTokensOf } from '@adecore/agent-contracts';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { formatTokens } from './format';
|
|
5
5
|
import { useMoney } from './money';
|
|
6
6
|
|
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);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import i18next from 'i18next';
|
|
2
1
|
import {
|
|
3
2
|
evenPace,
|
|
4
3
|
USAGE_PROVIDERS,
|
|
@@ -9,9 +8,10 @@ import {
|
|
|
9
8
|
type UsageProvider,
|
|
10
9
|
type UsageWindow
|
|
11
10
|
} from '@adecore/agent-contracts';
|
|
11
|
+
import { formatDuration } from '@adecore/ui/format';
|
|
12
|
+
import i18next from 'i18next';
|
|
12
13
|
import { limitsAccountId } from '../agents/account-limits';
|
|
13
14
|
import { accountName, accountsOfKind, accountStatusLine } from '../agents/accounts';
|
|
14
|
-
import { formatDuration } from '@adecore/ui/format';
|
|
15
15
|
import { PROVIDER_LABELS } from './format';
|
|
16
16
|
|
|
17
17
|
export { evenPace, type EvenPace, type PaceStanding } from '@adecore/agent-contracts';
|
package/src/usage/limits.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
1
|
import type { UsageLimitsSnapshot } from '@adecore/agent-contracts';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
3
|
import { useChatScope, type ChatScope } from '../scope';
|
|
4
4
|
import { useProviderAccounts } from '../state/provider-accounts';
|
|
5
5
|
import { useUsage, useUsageStore } from '../state/usage';
|
package/src/usage/summary.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { UsageProvider, UsageSummaryResult, UsageTotals } from '@adecore/agent-contracts';
|
|
2
|
-
import { dayOf, type UsageMetric } from '../state/usage';
|
|
3
2
|
import { EMPTY_TOTALS, USAGE_PROVIDERS, addTotals, totalTokensOf } from '@adecore/agent-contracts';
|
|
3
|
+
import { dayOf, type UsageMetric } from '../state/usage';
|
|
4
4
|
|
|
5
5
|
/* One bar of the chart, what each provider put in this slot, and the height of the stack. */
|
|
6
6
|
export interface ChartSlot {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
package/dist/chat/logic/json.js
DELETED
package/src/chat/logic/json.ts
DELETED