@kabmo-labs/kabmo 0.17.0 → 0.18.0
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/client/index.html +1 -1
- package/dist/client/index.js +538 -457
- package/dist/client/static/js/index-hp75vsv9.css +1 -0
- package/dist/client/static/js/{index-rerjq5th.js → index-tc09dtca.js} +823 -814
- package/package.json +1 -1
- package/src/client/components/common/MarkdownRenderer.tsx +136 -89
- package/src/client/components/common/anchored-menu/index.test.tsx +141 -0
- package/src/client/components/common/anchored-menu/index.tsx +143 -0
- package/src/client/components/common/markdown-review/ReviewPopover.tsx +144 -0
- package/src/client/components/common/markdown-review/ReviewSummary.tsx +108 -0
- package/src/client/components/common/markdown-review/index.tsx +129 -0
- package/src/client/components/common/server-control/Panel.tsx +33 -23
- package/src/client/components/common/server-control/index.test.tsx +11 -5
- package/src/client/components/common/server-control/index.tsx +10 -8
- package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +42 -21
- package/src/client/components/layout/session-sidebar/CategoryHeader.worktree.test.tsx +36 -17
- package/src/client/components/layout/session-sidebar/CategoryItem.tsx +8 -7
- package/src/client/components/layout/session-sidebar/about-modal/NotesDialog.tsx +94 -0
- package/src/client/components/layout/session-sidebar/about-modal/VersionLine.test.tsx +68 -0
- package/src/client/components/layout/session-sidebar/about-modal/VersionLine.tsx +36 -0
- package/src/client/components/layout/session-sidebar/about-modal/index.tsx +57 -34
- package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +28 -10
- package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +7 -6
- package/src/client/components/layout/session-sidebar/modern/workspace-header.test.tsx +1 -1
- package/src/client/components/layout/update-popup/ReleaseNotes.tsx +8 -3
- package/src/client/components/layout/update-popup/index.tsx +5 -1
- package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +13 -15
- package/src/client/components/mobile/mobile-right-sidebar/Header.tsx +23 -1
- package/src/client/components/mobile/mobile-right-sidebar/MissingFileBanner.tsx +30 -0
- package/src/client/components/mobile/mobile-right-sidebar/PreviewScroller.tsx +18 -2
- package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +22 -67
- package/src/client/components/mobile/mobile-session-sidebar/ItemMenu.tsx +110 -0
- package/src/client/components/settings/SettingsSidebarList.tsx +20 -0
- package/src/client/components/settings/categories/AgentSettings.tsx +23 -50
- package/src/client/components/settings/categories/CommandSettings.tsx +2 -2
- package/src/client/components/settings/categories/McpSettings.tsx +4 -21
- package/src/client/components/settings/categories/OmpSettings.tsx +147 -194
- package/src/client/components/settings/categories/SkillSettings.tsx +2 -2
- package/src/client/components/settings/categories/TokenUsageSettings.tsx +211 -229
- package/src/client/components/settings/categories/agent-settings/DetailPane.tsx +229 -237
- package/src/client/components/settings/categories/agent-settings/ModelPicker.tsx +71 -0
- package/src/client/components/settings/categories/agent-settings/SidebarList.tsx +9 -2
- package/src/client/components/settings/categories/agent-settings/levels.ts +38 -0
- package/src/client/components/settings/categories/behavior-settings/Editor.tsx +27 -7
- package/src/client/components/settings/categories/chat-settings/ToolRenderSection.tsx +23 -5
- package/src/client/components/settings/categories/command-settings/DetailPane.tsx +75 -33
- package/src/client/components/settings/categories/command-settings/SidebarList.tsx +7 -0
- package/src/client/components/settings/categories/mcp-settings/DetailPane.tsx +91 -76
- package/src/client/components/settings/categories/mcp-settings/EnvVarsSection.tsx +83 -0
- package/src/client/components/settings/categories/mcp-settings/ImportModal.tsx +26 -13
- package/src/client/components/settings/categories/mcp-settings/SidebarList.tsx +20 -0
- package/src/client/components/settings/categories/omp-settings/ConfigTabs.tsx +97 -36
- package/src/client/components/settings/categories/omp-settings/EngineHeader.tsx +151 -0
- package/src/client/components/settings/categories/omp-settings/ExtensionsPanel.tsx +68 -32
- package/src/client/components/settings/categories/omp-settings/OrderedChips.tsx +119 -0
- package/src/client/components/settings/categories/omp-settings/PresetBar.tsx +14 -7
- package/src/client/components/settings/categories/omp-settings/RoleEditor.tsx +15 -6
- package/src/client/components/settings/categories/omp-settings/RowEditor.tsx +165 -226
- package/src/client/components/settings/categories/omp-settings/types.ts +28 -0
- package/src/client/components/settings/categories/skill-settings/DetailHeader.tsx +35 -7
- package/src/client/components/settings/categories/skill-settings/DetailPane.tsx +34 -14
- package/src/client/components/settings/categories/skill-settings/SidebarList.tsx +21 -0
- package/src/client/components/settings/categories/skill-settings/pane.test.tsx +15 -6
- package/src/client/components/settings/categories/token-usage-settings/Breakdown.tsx +242 -102
- package/src/client/components/settings/categories/token-usage-settings/Chart.tsx +130 -56
- package/src/client/components/settings/categories/token-usage-settings/Controls.tsx +135 -0
- package/src/client/components/settings/categories/token-usage-settings/MetricsGrid.tsx +55 -33
- package/src/client/components/settings/categories/token-usage-settings/Provenance.tsx +59 -0
- package/src/client/components/settings/categories/token-usage-settings/panel.test.tsx +239 -0
- package/src/client/components/workspace/browser-panel/Screencast.test.ts +1 -0
- package/src/client/components/workspace/browser-panel/Screencast.tsx +17 -22
- package/src/client/components/workspace/browser-panel/TabStrip.test.tsx +158 -0
- package/src/client/components/workspace/browser-panel/TabStrip.tsx +90 -0
- package/src/client/components/workspace/browser-panel/index.tsx +50 -4
- package/src/client/components/workspace/browser-toolbar/index.tsx +41 -1
- package/src/client/components/workspace/chat-timeline/ThinkingSection.tsx +3 -1
- package/src/client/components/workspace/chat-timeline/ToolCallingSection.tsx +2 -0
- package/src/client/components/workspace/chat-timeline/block-chrome.test.tsx +13 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.test.ts +88 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.tsx +24 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.test.ts +34 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +5 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ArtifactChip.tsx +7 -6
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.test.tsx +237 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.tsx +191 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/styles.test.tsx +1 -1
- package/src/client/components/workspace/diff-panel/MergeDiffView.tsx +21 -7
- package/src/client/components/workspace/diff-panel/changes.test.ts +51 -0
- package/src/client/components/workspace/diff-panel/changes.ts +28 -12
- package/src/client/components/workspace/diff-panel/merge.test.ts +28 -0
- package/src/client/components/workspace/diff-panel/merge.ts +21 -1
- package/src/client/components/workspace/editor/Body.tsx +7 -0
- package/src/client/components/workspace/editor/FileDocument.tsx +15 -21
- package/src/client/components/workspace/editor/FilePane.tsx +12 -0
- package/src/client/components/workspace/editor/PreviewPane.tsx +70 -0
- package/src/client/components/workspace/editor/Toolbar.tsx +17 -1
- package/src/client/components/workspace/editor/index.tsx +25 -22
- package/src/client/components/workspace/editor/toolbar-clusters.test.ts +14 -0
- package/src/client/components/workspace/editor/toolbar-clusters.tsx +12 -86
- package/src/client/components/workspace/editor/toolbar-toggle.tsx +53 -0
- package/src/client/components/workspace/editor/toolbar-write-clusters.tsx +112 -0
- package/src/client/components/workspace/git-panel/commit-modal.test.ts +5 -3
- package/src/client/components/workspace/user-browser-panel/AddressBar.tsx +5 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateBar.test.tsx +201 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateBar.tsx +112 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateLayer.test.tsx +225 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateLayer.tsx +217 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateTarget.tsx +99 -0
- package/src/client/components/workspace/user-browser-panel/Frame.tsx +30 -1
- package/src/client/components/workspace/user-browser-panel/index.tsx +81 -2
- package/src/client/data/agent-data/builtin.ts +0 -10
- package/src/client/data/agent-data/orchestrator.ts +0 -45
- package/src/client/data/agent-data/specialist.ts +0 -100
- package/src/client/data/mock/token-usage.ts +170 -120
- package/src/client/data/settings/omp-schema.json +33 -1
- package/src/client/hooks/browser/use-annotate.test.ts +143 -0
- package/src/client/hooks/browser/use-annotate.ts +98 -0
- package/src/client/hooks/browser/use-close-tab.test.ts +148 -0
- package/src/client/hooks/browser/use-close-tab.ts +67 -0
- package/src/client/hooks/browser/use-screencast.ts +13 -1
- package/src/client/hooks/chat/composer/browser-context.test.ts +117 -0
- package/src/client/hooks/chat/composer/browser-context.ts +40 -16
- package/src/client/hooks/chat/composer/items.test.ts +1 -1
- package/src/client/hooks/chat/composer/review-context.ts +38 -0
- package/src/client/hooks/chat/composer/use-draft.test.ts +132 -0
- package/src/client/hooks/chat/composer/use-draft.ts +31 -2
- package/src/client/hooks/chat/timeline/row-window.test.ts +15 -2
- package/src/client/hooks/editor/use-document-annotations.ts +124 -0
- package/src/client/hooks/editor/use-editor-panel-ui.ts +52 -0
- package/src/client/hooks/editor/use-file-review-mode.ts +35 -0
- package/src/client/hooks/editor/use-preview-review.ts +148 -0
- package/src/client/hooks/settings/agents.ts +149 -0
- package/src/client/hooks/settings/crud-list.test.ts +28 -6
- package/src/client/hooks/settings/crud-list.ts +96 -57
- package/src/client/hooks/settings/omp-config.ts +164 -0
- package/src/client/hooks/settings/useTokenUsage.ts +125 -0
- package/src/client/hooks/settings/write-feedback.test.ts +104 -0
- package/src/client/hooks/settings/write-feedback.ts +63 -0
- package/src/client/hooks/ui/markdown-hydration.ts +125 -0
- package/src/client/hooks/ui/updates/index.test.ts +100 -1
- package/src/client/hooks/ui/updates/index.ts +50 -0
- package/src/client/hooks/ui/updates/notes.test.ts +138 -0
- package/src/client/hooks/ui/updates/notes.ts +57 -0
- package/src/client/lib/browser/element-at.test.ts +229 -0
- package/src/client/lib/browser/element-at.ts +139 -0
- package/src/client/lib/review/client.ts +73 -0
- package/src/client/lib/router/search-params.ts +42 -20
- package/src/client/tailwind.css +65 -0
- package/src/server/lib/btw/lifecycle.server.ts +2 -2
- package/src/server/lib/db/schema.ts +7 -0
- package/src/server/lib/db/seed-terminal.test.ts +4 -0
- package/src/server/lib/omp/config/agent-definitions.test.ts +273 -0
- package/src/server/lib/omp/config/agents.ts +231 -61
- package/src/server/lib/omp/config/definitions.test.ts +9 -105
- package/src/server/lib/omp/config/extensions.ts +16 -7
- package/src/server/lib/omp/config/omp-config-files.test.ts +27 -0
- package/src/server/lib/omp/rpc/constants.test.ts +11 -0
- package/src/server/lib/omp/rpc/constants.ts +15 -0
- package/src/server/lib/omp/rpc/process.ts +11 -14
- package/src/server/lib/omp/rpc/session-commands.ts +6 -3
- package/src/server/lib/omp/rpc/utility-agent-dir.test.ts +134 -0
- package/src/server/lib/omp/rpc/utility-agent-dir.ts +138 -0
- package/src/server/lib/omp/rpc/utility.ts +12 -0
- package/src/server/lib/review/schema.server.ts +45 -0
- package/src/server/lib/review/store.server.ts +138 -0
- package/src/server/lib/terminal/attach-replay.test.ts +132 -0
- package/src/server/lib/terminal/output.test.ts +166 -0
- package/src/server/lib/terminal/output.ts +104 -0
- package/src/server/lib/terminal/runtime.server.ts +5 -0
- package/src/server/lib/terminal/send-result.test.ts +33 -0
- package/src/server/lib/terminal/send-result.ts +32 -0
- package/src/server/lib/terminal/session.server.ts +45 -11
- package/src/server/lib/terminal/store-liveness.test.ts +4 -0
- package/src/server/lib/updates/active-notes.test.ts +149 -0
- package/src/server/lib/updates/active-notes.ts +75 -0
- package/src/server/lib/updates/changelog-file.ts +42 -11
- package/src/server/lib/updates/changelog.test.ts +15 -1
- package/src/server/lib/updates/omp.ts +42 -15
- package/src/server/lib/updates/release-url.ts +27 -1
- package/src/server/lib/usage/index-parse.test.ts +200 -0
- package/src/server/lib/usage/index-parse.ts +178 -0
- package/src/server/lib/usage/index-query.server.ts +248 -0
- package/src/server/lib/usage/index-scan.server.ts +343 -0
- package/src/server/lib/usage/index-schema.server.ts +82 -0
- package/src/server/lib/usage/index.test.ts +234 -0
- package/src/server/lib/usage/providers.server.ts +4 -53
- package/src/server/routes/browser/index.ts +3 -0
- package/src/server/routes/browser/stream.ts +31 -2
- package/src/server/routes/browser/tabs.test.ts +94 -0
- package/src/server/routes/browser/tabs.ts +85 -0
- package/src/server/routes/index.ts +2 -0
- package/src/server/routes/review/bindings.ts +11 -0
- package/src/server/routes/review/index.ts +127 -0
- package/src/server/routes/review/routes.test.ts +191 -0
- package/src/server/routes/settings/agents.test.ts +180 -0
- package/src/server/routes/settings/agents.ts +95 -102
- package/src/server/routes/settings/mcp.test.ts +135 -0
- package/src/server/routes/settings/mcp.ts +14 -6
- package/src/server/routes/settings/settings-store-routes.test.ts +6 -113
- package/src/server/routes/telemetry/tokens.test.ts +145 -0
- package/src/server/routes/telemetry/tokens.ts +70 -149
- package/src/server/routes/terminal/ws.ts +6 -5
- package/src/server/routes/updates/index.ts +2 -0
- package/src/server/routes/updates/notes.ts +34 -0
- package/src/server/routes/updates/routes.test.ts +49 -0
- package/src/shared/lib/browser/annotate.test.ts +283 -0
- package/src/shared/lib/browser/annotate.ts +231 -0
- package/src/shared/lib/browser/browser-viewer.test.ts +26 -4
- package/src/shared/lib/browser/frame-gate.test.ts +91 -0
- package/src/shared/lib/browser/frame-gate.ts +69 -0
- package/src/shared/lib/browser/frame-params.test.ts +43 -0
- package/src/shared/lib/browser/frame-params.ts +60 -0
- package/src/shared/lib/browser/frame-pipeline.test.ts +132 -0
- package/src/shared/lib/browser/frame-pipeline.ts +80 -0
- package/src/shared/lib/browser/page-context.ts +60 -4
- package/src/shared/lib/browser/snapshot.test.ts +115 -0
- package/src/shared/lib/browser/snapshot.ts +112 -0
- package/src/shared/lib/browser/tab-close.test.ts +74 -0
- package/src/shared/lib/browser/tab-close.ts +77 -0
- package/src/shared/lib/browser/viewer.ts +45 -26
- package/src/shared/lib/chat/timeline/block-chrome.ts +19 -0
- package/src/shared/lib/chat/timeline/tool-render-mode.ts +17 -4
- package/src/shared/lib/chat/tool/artifact.ts +55 -20
- package/src/shared/lib/chat/tool/bash-facts.ts +96 -0
- package/src/shared/lib/chat/tool/minimized.test.ts +98 -0
- package/src/shared/lib/chat/tool/minimized.ts +64 -0
- package/src/shared/lib/chat/tool/summary.test.ts +28 -8
- package/src/shared/lib/chat/tool/summary.ts +3 -32
- package/src/shared/lib/markdown/blocks/anchor.ts +63 -0
- package/src/shared/lib/markdown/blocks/blocks.test.ts +141 -0
- package/src/shared/lib/markdown/blocks/renderer.ts +120 -0
- package/src/shared/lib/markdown/blocks/scan.ts +100 -0
- package/src/shared/lib/markdown/blocks/types.ts +62 -0
- package/src/shared/lib/markdown/marked.ts +58 -147
- package/src/shared/lib/markdown/math-extensions.ts +168 -0
- package/src/shared/lib/markdown/review/prompt.ts +77 -0
- package/src/shared/lib/markdown/review/reconcile.ts +55 -0
- package/src/shared/lib/markdown/review/review.test.ts +96 -0
- package/src/shared/lib/markdown/xml-sections.test.ts +140 -0
- package/src/shared/lib/markdown/xml-sections.ts +139 -0
- package/src/shared/lib/models/provider/label.ts +57 -0
- package/src/shared/lib/omp/config/agent-file.test.ts +54 -0
- package/src/shared/lib/omp/config/agent-file.ts +43 -0
- package/src/shared/lib/omp/config/row-value.test.ts +95 -0
- package/src/shared/lib/omp/config/row-value.ts +97 -0
- package/src/shared/lib/omp/config/schema.test.ts +31 -0
- package/src/shared/lib/omp/config/schema.ts +6 -0
- package/src/shared/lib/omp/rpc/frame.test.ts +48 -47
- package/src/shared/lib/omp/rpc/frame.ts +49 -40
- package/src/shared/lib/ui/menu-anchor.test.ts +69 -0
- package/src/shared/lib/ui/menu-anchor.ts +89 -0
- package/src/shared/lib/usage/breakdown.test.ts +197 -0
- package/src/shared/lib/usage/breakdown.ts +241 -0
- package/src/shared/lib/usage/range.test.ts +204 -0
- package/src/shared/lib/usage/range.ts +240 -0
- package/src/shared/lib/usage/view.test.ts +85 -0
- package/src/shared/lib/usage/view.ts +74 -0
- package/src/shared/types/browser.ts +78 -0
- package/src/shared/types/index.ts +1 -0
- package/src/shared/types/settings/agent.ts +28 -6
- package/src/shared/types/settings/state.ts +4 -3
- package/src/shared/types/settings/write.ts +6 -0
- package/src/shared/types/tokenUsage.ts +128 -21
- package/src/shared/types/updates.ts +20 -0
- package/dist/client/static/js/index-3ve31rzx.css +0 -1
- package/src/server/lib/omp/session/usage/aggregate-shaping.test.ts +0 -149
- package/src/server/lib/omp/session/usage/aggregate.test.ts +0 -243
- package/src/server/lib/omp/session/usage/aggregate.ts +0 -330
- package/src/server/lib/omp/session/usage/shaping.ts +0 -130
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'preact/hooks';
|
|
2
2
|
import { Info } from 'lucide-preact';
|
|
3
|
-
import type { SkillItem } from '@/shared/types';
|
|
3
|
+
import type { SkillItem, WriteOutcome } from '@/shared/types';
|
|
4
|
+
import { useWriteFeedback } from '@/client/hooks/settings/write-feedback';
|
|
4
5
|
import { SkillDetailHeader } from '@/client/components/settings/categories/skill-settings/DetailHeader';
|
|
5
6
|
import { InstructionsEditor } from '@/client/components/settings/categories/skill-settings/InstructionsEditor';
|
|
6
7
|
|
|
7
8
|
interface SkillDetailPaneProps {
|
|
8
9
|
skill: SkillItem | null;
|
|
9
10
|
isCreatingNew: boolean;
|
|
10
|
-
onSave: (skillData: Partial<SkillItem>) =>
|
|
11
|
-
onDelete?: (id: string) =>
|
|
11
|
+
onSave: (skillData: Partial<SkillItem>) => Promise<WriteOutcome>;
|
|
12
|
+
onDelete?: (id: string) => Promise<WriteOutcome>;
|
|
12
13
|
onOpenCatalog?: () => void;
|
|
13
14
|
onReload?: () => void;
|
|
14
15
|
isReloading?: boolean;
|
|
@@ -51,6 +52,7 @@ export function SkillDetailPane({
|
|
|
51
52
|
const [showLineNumbers, setShowLineNumbers] = useState(true);
|
|
52
53
|
const [confirmingDelete, setConfirmingDelete] = useState(false);
|
|
53
54
|
const [savedAt, setSavedAt] = useState(0);
|
|
55
|
+
const feedback = useWriteFeedback();
|
|
54
56
|
|
|
55
57
|
const readOnly = !isCreatingNew && skill != null && skill.managed !== true;
|
|
56
58
|
const locationLabel = location === 'project' ? 'Project / .omp/skills' : 'User / omp agent';
|
|
@@ -95,17 +97,31 @@ export function SkillDetailPane({
|
|
|
95
97
|
return null;
|
|
96
98
|
}, [name, description, readOnly]);
|
|
97
99
|
|
|
100
|
+
// The timestamp is set from the WRITE'S answer, not the click: a refused save
|
|
101
|
+
// (a duplicate name, a read-only file) used to print "Last saved <time>".
|
|
98
102
|
const handleSave = () => {
|
|
99
|
-
if (readOnly || validationError) return;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
if (readOnly || validationError || feedback.saving) return;
|
|
104
|
+
void feedback.run(async () => {
|
|
105
|
+
const outcome = await onSave({
|
|
106
|
+
name: name.trim(),
|
|
107
|
+
description: description.trim(),
|
|
108
|
+
location,
|
|
109
|
+
locationLabel,
|
|
110
|
+
instructions: draftBody(instructions),
|
|
111
|
+
hidden,
|
|
112
|
+
});
|
|
113
|
+
if (outcome.ok) setSavedAt(Date.now());
|
|
114
|
+
return outcome;
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const handleDelete = () => {
|
|
119
|
+
if (!skill || !onDelete) return;
|
|
120
|
+
void feedback.run(async () => {
|
|
121
|
+
const outcome = await onDelete(skill.id);
|
|
122
|
+
if (!outcome.ok) setConfirmingDelete(false);
|
|
123
|
+
return outcome;
|
|
107
124
|
});
|
|
108
|
-
setSavedAt(Date.now());
|
|
109
125
|
};
|
|
110
126
|
|
|
111
127
|
return (
|
|
@@ -128,9 +144,13 @@ export function SkillDetailPane({
|
|
|
128
144
|
onCancelDelete={() => setConfirmingDelete(false)}
|
|
129
145
|
onConfirmDelete={() => {
|
|
130
146
|
setConfirmingDelete(false);
|
|
131
|
-
|
|
147
|
+
handleDelete();
|
|
132
148
|
}}
|
|
133
149
|
onSave={handleSave}
|
|
150
|
+
saving={feedback.saving}
|
|
151
|
+
saved={feedback.saved}
|
|
152
|
+
writeError={feedback.error}
|
|
153
|
+
onDismissWriteError={feedback.dismissError}
|
|
134
154
|
/>
|
|
135
155
|
|
|
136
156
|
{!readOnly ? (
|
|
@@ -204,7 +224,7 @@ export function SkillDetailPane({
|
|
|
204
224
|
onToggleLineNumbers={() => setShowLineNumbers(!showLineNumbers)}
|
|
205
225
|
/>
|
|
206
226
|
|
|
207
|
-
{savedAt > 0 && !dirty ? (
|
|
227
|
+
{savedAt > 0 && !dirty && !feedback.error ? (
|
|
208
228
|
<p className="text-[10px] text-ink/40">
|
|
209
229
|
Last saved {new Date(savedAt).toLocaleTimeString()} — omp sessions were told to reload their skills.
|
|
210
230
|
</p>
|
|
@@ -23,6 +23,9 @@ interface SkillSidebarListProps {
|
|
|
23
23
|
onSelectProject: (project: string) => void;
|
|
24
24
|
/** Real workspace folders; defaults to the shared placeholder list. */
|
|
25
25
|
projectOptions?: ProjectOption[];
|
|
26
|
+
/** Why the list could not be read, and how to try again. */
|
|
27
|
+
loadError?: string;
|
|
28
|
+
onRetry?: () => void;
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
/**
|
|
@@ -43,6 +46,8 @@ export function SkillSidebarList({
|
|
|
43
46
|
selectedProject,
|
|
44
47
|
onSelectProject,
|
|
45
48
|
projectOptions,
|
|
49
|
+
loadError,
|
|
50
|
+
onRetry,
|
|
46
51
|
}: SkillSidebarListProps) {
|
|
47
52
|
const [collapsedGroups, setCollapsedGroups] = useState<Record<string, boolean>>({});
|
|
48
53
|
const [query, setQuery] = useState('');
|
|
@@ -134,6 +139,22 @@ export function SkillSidebarList({
|
|
|
134
139
|
</div>
|
|
135
140
|
|
|
136
141
|
<div className="flex-1 scrollbar-overlay-container p-1.5 space-y-2">
|
|
142
|
+
{loadError ? (
|
|
143
|
+
<div className="mx-1 rounded-lg border border-error/30 bg-error/5 px-2.5 py-2 text-[11px] leading-snug text-error">
|
|
144
|
+
<div className="font-semibold">Could not read the skills</div>
|
|
145
|
+
<div className="mt-0.5 break-words text-error/80">{loadError}</div>
|
|
146
|
+
{onRetry ? (
|
|
147
|
+
<button
|
|
148
|
+
type="button"
|
|
149
|
+
onClick={onRetry}
|
|
150
|
+
className="mt-1.5 rounded border border-error/40 px-2 py-0.5 font-medium hover:bg-error/10 cursor-pointer"
|
|
151
|
+
>
|
|
152
|
+
Retry
|
|
153
|
+
</button>
|
|
154
|
+
) : null}
|
|
155
|
+
</div>
|
|
156
|
+
) : null}
|
|
157
|
+
|
|
137
158
|
{isCreatingNew ? (
|
|
138
159
|
<div className="px-2.5 py-1.5 rounded-lg bg-ink/10 text-ink font-medium text-xs">new-skill</div>
|
|
139
160
|
) : null}
|
|
@@ -22,7 +22,7 @@ import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test
|
|
|
22
22
|
import { Window } from 'happy-dom';
|
|
23
23
|
import { h, render } from 'preact';
|
|
24
24
|
import { act } from 'preact/test-utils';
|
|
25
|
-
import type { SkillItem } from '@/shared/types';
|
|
25
|
+
import type { SkillItem, WriteOutcome } from '@/shared/types';
|
|
26
26
|
import {
|
|
27
27
|
SKILL_FILTERS,
|
|
28
28
|
filterCounts,
|
|
@@ -54,6 +54,15 @@ function mount(node: h.JSX.Element): HTMLElement {
|
|
|
54
54
|
return container;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
/** A save the server accepts; the pane's badge is driven by this answer. */
|
|
58
|
+
const okSave = async (): Promise<WriteOutcome> => ({ ok: true });
|
|
59
|
+
|
|
60
|
+
/** Collect the drafts a pane sends, while answering like a healthy server. */
|
|
61
|
+
const okSaveTracking = (saved: Partial<SkillItem>[]) => async (draft: Partial<SkillItem>): Promise<WriteOutcome> => {
|
|
62
|
+
saved.push(draft);
|
|
63
|
+
return { ok: true };
|
|
64
|
+
};
|
|
65
|
+
|
|
57
66
|
function skill(overrides: Partial<SkillItem> = {}): SkillItem {
|
|
58
67
|
return {
|
|
59
68
|
id: 'omp-user-alpha',
|
|
@@ -117,12 +126,12 @@ describe('filterSkills and filterCounts', () => {
|
|
|
117
126
|
describe('SkillDetailPane', () => {
|
|
118
127
|
test('an unchanged draft cannot be saved', () => {
|
|
119
128
|
const el = mount(
|
|
120
|
-
h(SkillDetailPane, { skill: skill(), isCreatingNew: false, onSave:
|
|
129
|
+
h(SkillDetailPane, { skill: skill(), isCreatingNew: false, onSave: okSave }),
|
|
121
130
|
);
|
|
122
131
|
const save = [...el.querySelectorAll('button')].find((button) => button.textContent?.includes('Save changes'));
|
|
123
132
|
expect(save).toBeDefined();
|
|
124
133
|
expect((save as HTMLButtonElement).disabled).toBe(true);
|
|
125
|
-
expect(el.textContent).toContain('
|
|
134
|
+
expect(el.textContent).toContain('Nothing to write');
|
|
126
135
|
});
|
|
127
136
|
|
|
128
137
|
test('a draft missing its description reports that omp would not load it', () => {
|
|
@@ -130,7 +139,7 @@ describe('SkillDetailPane', () => {
|
|
|
130
139
|
h(SkillDetailPane, {
|
|
131
140
|
skill: skill({ description: '' }),
|
|
132
141
|
isCreatingNew: false,
|
|
133
|
-
onSave:
|
|
142
|
+
onSave: okSave,
|
|
134
143
|
}),
|
|
135
144
|
);
|
|
136
145
|
expect(el.textContent).toContain('omp does not load a SKILL.md without one');
|
|
@@ -140,7 +149,7 @@ describe('SkillDetailPane', () => {
|
|
|
140
149
|
|
|
141
150
|
test('a read-only skill offers no editor or save at all', () => {
|
|
142
151
|
const el = mount(
|
|
143
|
-
h(SkillDetailPane, { skill: skill({ managed: false, source: 'agents:user' }), isCreatingNew: false, onSave:
|
|
152
|
+
h(SkillDetailPane, { skill: skill({ managed: false, source: 'agents:user' }), isCreatingNew: false, onSave: okSave }),
|
|
144
153
|
);
|
|
145
154
|
expect(el.textContent).toContain('read-only');
|
|
146
155
|
expect(el.textContent).not.toContain('Save changes');
|
|
@@ -153,7 +162,7 @@ describe('SkillDetailPane', () => {
|
|
|
153
162
|
h(SkillDetailPane, {
|
|
154
163
|
skill: skill({ instructions: '---\ndescription: First skill\n---\n\ndo the thing\n' }),
|
|
155
164
|
isCreatingNew: false,
|
|
156
|
-
onSave: (
|
|
165
|
+
onSave: okSaveTracking(saved),
|
|
157
166
|
}),
|
|
158
167
|
);
|
|
159
168
|
// The pane has two textareas: the description and the SKILL.md body.
|
|
@@ -1,125 +1,265 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useMemo, useState } from 'preact/hooks';
|
|
2
|
+
import { ChevronDown, ChevronRight } from 'lucide-preact';
|
|
3
|
+
import type { BreakdownTab, BucketGranularity, UsageTotals } from '@/shared/types';
|
|
4
|
+
import type { BreakdownViewRow } from '@/shared/lib/usage/breakdown';
|
|
5
|
+
import { cacheHitLabel, costLabel, costPerMillionLabel, tokenLabel } from '@/shared/lib/usage/view';
|
|
6
|
+
import { ProviderIconPlate } from '@/client/components/common/provider-icon/Plate';
|
|
2
7
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The time tab is named for the bucket width the PERIOD implies. A month of
|
|
10
|
+
* usage is a list of days; a quarter is a list of weeks; all time is months.
|
|
11
|
+
*/
|
|
12
|
+
function tabsFor(granularity: BucketGranularity): Array<{ id: BreakdownTab; label: string }> {
|
|
13
|
+
return [
|
|
14
|
+
{ id: 'provider', label: 'PROVIDER' },
|
|
15
|
+
{ id: 'model', label: 'MODEL' },
|
|
16
|
+
{ id: 'day', label: granularity === 'week' ? 'WEEK' : granularity === 'month' ? 'MONTH' : 'DAY' },
|
|
17
|
+
{ id: 'project', label: 'PROJECT' },
|
|
18
|
+
];
|
|
9
19
|
}
|
|
10
20
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
21
|
+
/** Provider rows shown before "Show all" — twelve was the old silent ceiling. */
|
|
22
|
+
const COLLAPSED_ROWS = 8;
|
|
23
|
+
/**
|
|
24
|
+
* Time rows shown at once. A period is fully enumerated (every day of the
|
|
25
|
+
* month), so this is a scroll region, not a truncation: the table body scrolls
|
|
26
|
+
* and the count above it says how many rows the period has.
|
|
27
|
+
*/
|
|
28
|
+
const TIME_ROWS_VISIBLE = 14;
|
|
29
|
+
|
|
30
|
+
interface TokenUsageBreakdownProps {
|
|
31
|
+
tab: BreakdownTab;
|
|
32
|
+
onTab: (tab: BreakdownTab) => void;
|
|
33
|
+
rows: BreakdownViewRow[];
|
|
34
|
+
totals: UsageTotals;
|
|
35
|
+
granularity: BucketGranularity;
|
|
36
|
+
/** Provider slugs to display names, for the icon plate. */
|
|
37
|
+
providerNames: Record<string, string>;
|
|
38
|
+
}
|
|
16
39
|
|
|
40
|
+
/**
|
|
41
|
+
* The provider → model tree, the time table and the project table.
|
|
42
|
+
*
|
|
43
|
+
* The Model tab is deliberately two-level: `message.provider` was on every usage
|
|
44
|
+
* record, but the breakdown keyed on model alone, so two accounts serving
|
|
45
|
+
* `deepseek-v4-1-flash` showed up as one $1 673.86 row instead of $1 619.43 and
|
|
46
|
+
* $54.43 — the one number a multi-account user needs to see.
|
|
47
|
+
*
|
|
48
|
+
* Every cell is the selected PERIOD's total — there is no per-day/per-week
|
|
49
|
+
* number, because a period is a single span. Only the time tab's bucket width
|
|
50
|
+
* varies, and it follows the period's length (see `tabsFor`).
|
|
51
|
+
*/
|
|
17
52
|
export function TokenUsageBreakdown({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
53
|
+
tab,
|
|
54
|
+
onTab,
|
|
55
|
+
rows,
|
|
56
|
+
totals,
|
|
57
|
+
granularity,
|
|
58
|
+
providerNames,
|
|
23
59
|
}: TokenUsageBreakdownProps) {
|
|
60
|
+
// `null` means "the default": the top three providers open, the rest closed
|
|
61
|
+
// so the rows carrying the answer need no click. The first explicit toggle
|
|
62
|
+
// materialises a concrete set, and from then on the user's choice wins —
|
|
63
|
+
// including collapsing one of those three (a chevron that cannot close its
|
|
64
|
+
// own row is worse than no chevron).
|
|
65
|
+
const [expanded, setExpanded] = useState<Set<string> | null>(null);
|
|
66
|
+
const [showAll, setShowAll] = useState(false);
|
|
67
|
+
|
|
68
|
+
const isTree = tab === 'provider' || tab === 'model';
|
|
69
|
+
const defaultOpen = useMemo(
|
|
70
|
+
() => new Set(rows.filter((row) => row.kind === 'group').slice(0, 3).map((row) => row.provider ?? '')),
|
|
71
|
+
[rows],
|
|
72
|
+
);
|
|
73
|
+
const openSet = expanded ?? defaultOpen;
|
|
74
|
+
|
|
75
|
+
// A time tab lists the PERIOD, so it is never sliced: the body scrolls
|
|
76
|
+
// instead. Slicing it to eight rows is what made a month look like it had
|
|
77
|
+
// only eight days.
|
|
78
|
+
const visibleRows = useMemo(() => {
|
|
79
|
+
if (!isTree) return rows;
|
|
80
|
+
const shown: BreakdownViewRow[] = [];
|
|
81
|
+
for (const row of rows) {
|
|
82
|
+
if (row.kind === 'group' || showAll || openSet.has(row.provider ?? '')) shown.push(row);
|
|
83
|
+
}
|
|
84
|
+
return shown;
|
|
85
|
+
}, [rows, isTree, showAll, openSet]);
|
|
86
|
+
|
|
87
|
+
const toggle = (provider: string) => {
|
|
88
|
+
const next = new Set(openSet);
|
|
89
|
+
if (next.has(provider)) next.delete(provider);
|
|
90
|
+
else next.add(provider);
|
|
91
|
+
setExpanded(next);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const firstColumn = tab === 'day' ? granularity : tab === 'model' ? 'Provider / Model' : tab;
|
|
95
|
+
|
|
24
96
|
return (
|
|
25
|
-
<div className="grid grid-cols-1 xl:grid-cols-3
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
>
|
|
53
|
-
PROJECT
|
|
54
|
-
</button>
|
|
97
|
+
<div className="grid grid-cols-1 gap-3 xl:grid-cols-3">
|
|
98
|
+
<div className="rounded-lg border border-ink/15 bg-paper p-3.5 shadow-xs xl:col-span-2">
|
|
99
|
+
{/* Wraps rather than overflowing: at phone widths the four tabs were
|
|
100
|
+
14–84 px wider than the card, so PROJECT sat outside it and looked
|
|
101
|
+
like a missing tab. */}
|
|
102
|
+
<div className="mb-3 flex flex-wrap items-center justify-between gap-x-2 gap-y-1.5">
|
|
103
|
+
<span className="flex items-baseline gap-2 text-xs font-semibold text-ink">
|
|
104
|
+
Breakdown
|
|
105
|
+
<span className="font-mono text-[9px] font-normal uppercase tracking-wider text-ink/35">
|
|
106
|
+
{isTree ? 'period total' : `${rows.length} ${rows.length === 1 ? 'row' : 'rows'} · ${granularity}`}
|
|
107
|
+
</span>
|
|
108
|
+
</span>
|
|
109
|
+
<div role="tablist" aria-label="Breakdown" className="flex shrink-0 rounded bg-ink/5 p-0.5">
|
|
110
|
+
{tabsFor(granularity).map((entry) => (
|
|
111
|
+
<button
|
|
112
|
+
key={entry.id}
|
|
113
|
+
type="button"
|
|
114
|
+
role="tab"
|
|
115
|
+
aria-selected={tab === entry.id}
|
|
116
|
+
onClick={() => onTab(entry.id)}
|
|
117
|
+
className={`rounded px-2 py-0.5 text-[9px] font-bold tracking-wider transition-colors ${
|
|
118
|
+
tab === entry.id ? 'bg-paper text-ink shadow-xs' : 'text-ink/50 hover:text-ink'
|
|
119
|
+
}`}
|
|
120
|
+
>
|
|
121
|
+
{entry.label}
|
|
122
|
+
</button>
|
|
123
|
+
))}
|
|
55
124
|
</div>
|
|
56
125
|
</div>
|
|
57
126
|
|
|
58
|
-
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
</
|
|
77
|
-
<td className="py-2.5 text-right font-bold text-ink">{row.cost}</td>
|
|
78
|
-
<td className="py-2.5 text-right text-ink/60">{row.share}</td>
|
|
79
|
-
<td className="py-2.5 text-right text-ink/60">{row.tokens}</td>
|
|
127
|
+
{rows.length === 0 ? (
|
|
128
|
+
<p className="py-6 text-center text-[11px] text-ink/40">No usage recorded in this period.</p>
|
|
129
|
+
) : (
|
|
130
|
+
<div className="overflow-x-auto">
|
|
131
|
+
<div
|
|
132
|
+
// A time tab's rows scroll; the provider tree is short enough to
|
|
133
|
+
// render whole and must not nest two scroll regions.
|
|
134
|
+
className={isTree ? undefined : 'overflow-y-auto'}
|
|
135
|
+
style={isTree ? undefined : { maxHeight: `${TIME_ROWS_VISIBLE * 1.6}rem` }}
|
|
136
|
+
>
|
|
137
|
+
<table className="w-full text-[11px]">
|
|
138
|
+
<thead>
|
|
139
|
+
<tr className="border-b border-ink/10 text-ink/40">
|
|
140
|
+
<th className="pb-2 text-left font-medium capitalize">{firstColumn}</th>
|
|
141
|
+
<th className="pb-2 text-right font-medium">Cost</th>
|
|
142
|
+
<th className="pb-2 text-right font-medium">Share</th>
|
|
143
|
+
<th className="pb-2 text-right font-medium">Tokens</th>
|
|
144
|
+
<th className="hidden pb-2 text-right font-medium sm:table-cell">Cache</th>
|
|
145
|
+
<th className="hidden pb-2 text-right font-medium sm:table-cell">Turns</th>
|
|
80
146
|
</tr>
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
147
|
+
</thead>
|
|
148
|
+
<tbody className="divide-y divide-ink/5">
|
|
149
|
+
{visibleRows.map((row) => {
|
|
150
|
+
const isGroup = row.kind === 'group';
|
|
151
|
+
const providerId = row.provider ?? '';
|
|
152
|
+
const open = !isGroup || showAll || openSet.has(providerId);
|
|
153
|
+
return (
|
|
154
|
+
<tr key={row.key} className={isGroup ? 'bg-ink/[0.02]' : undefined}>
|
|
155
|
+
<td className="py-2">
|
|
156
|
+
<div className="flex items-center gap-2" style={{ paddingLeft: `${row.depth * 14}px` }}>
|
|
157
|
+
{isGroup ? (
|
|
158
|
+
<button
|
|
159
|
+
type="button"
|
|
160
|
+
aria-expanded={open}
|
|
161
|
+
aria-label={`${row.label} models`}
|
|
162
|
+
onClick={() => toggle(providerId)}
|
|
163
|
+
className="-ml-0.5 text-ink/50 transition-colors hover:text-ink"
|
|
164
|
+
>
|
|
165
|
+
{open ? <ChevronDown size={12} /> : <ChevronRight size={12} />}
|
|
166
|
+
</button>
|
|
167
|
+
) : null}
|
|
168
|
+
{row.provider && (
|
|
169
|
+
<ProviderIconPlate
|
|
170
|
+
provider={{
|
|
171
|
+
slug: row.provider,
|
|
172
|
+
name: providerNames[row.provider] ?? row.provider,
|
|
173
|
+
}}
|
|
174
|
+
size={isGroup ? 16 : 14}
|
|
175
|
+
radius={4}
|
|
176
|
+
/>
|
|
177
|
+
)}
|
|
178
|
+
<span
|
|
179
|
+
className={`whitespace-nowrap ${
|
|
180
|
+
isGroup ? 'font-semibold text-ink' : 'font-medium text-ink/85'
|
|
181
|
+
}`}
|
|
182
|
+
>
|
|
183
|
+
{row.label}
|
|
184
|
+
</span>
|
|
185
|
+
</div>
|
|
186
|
+
</td>
|
|
187
|
+
<td className={`py-2 text-right tabular-nums ${isGroup ? 'font-bold text-ink' : 'text-ink/80'}`}>
|
|
188
|
+
{costLabel(row.cost)}
|
|
189
|
+
</td>
|
|
190
|
+
<td className="py-2 text-right tabular-nums text-ink/60">{row.sharePercent.toFixed(1)}%</td>
|
|
191
|
+
<td className="py-2 text-right tabular-nums text-ink/60">{tokenLabel(row.tokens)}</td>
|
|
192
|
+
<td className="hidden py-2 text-right tabular-nums text-ink/60 sm:table-cell">{row.cacheHit}</td>
|
|
193
|
+
<td className="hidden py-2 text-right tabular-nums text-ink/60 sm:table-cell">
|
|
194
|
+
{row.records.toLocaleString('en-US')}
|
|
195
|
+
</td>
|
|
196
|
+
</tr>
|
|
197
|
+
);
|
|
198
|
+
})}
|
|
199
|
+
</tbody>
|
|
200
|
+
</table>
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
)}
|
|
85
204
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
205
|
+
<div className="mt-3 flex h-1.5 w-full overflow-hidden rounded-full bg-ink/5">
|
|
206
|
+
{rows
|
|
207
|
+
.filter((row) => row.kind === 'group' || !isTree)
|
|
208
|
+
.slice(0, COLLAPSED_ROWS)
|
|
209
|
+
.map((row, index) => (
|
|
210
|
+
<div
|
|
211
|
+
key={row.key}
|
|
212
|
+
className={index === 0 ? 'bg-ink/80' : index === 1 ? 'border-l border-paper bg-ink/45' : 'border-l border-paper bg-ink/25'}
|
|
213
|
+
style={{ width: `${row.sharePercent}%` }}
|
|
214
|
+
/>
|
|
215
|
+
))}
|
|
97
216
|
</div>
|
|
217
|
+
|
|
218
|
+
{isTree && !showAll && visibleRows.length < rows.length && (
|
|
219
|
+
<button
|
|
220
|
+
type="button"
|
|
221
|
+
onClick={() => setShowAll(true)}
|
|
222
|
+
className="mt-2 text-[10px] font-semibold text-ink/50 transition-colors hover:text-ink"
|
|
223
|
+
>
|
|
224
|
+
Show all {rows.length} rows
|
|
225
|
+
</button>
|
|
226
|
+
)}
|
|
98
227
|
</div>
|
|
99
228
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
229
|
+
<div className="rounded-lg border border-ink/15 bg-paper p-3.5 shadow-xs">
|
|
230
|
+
<div className="mb-3 flex items-baseline justify-between gap-2">
|
|
231
|
+
<span className="text-xs font-semibold text-ink">Cost quality</span>
|
|
232
|
+
<span className="font-mono text-[9px] uppercase tracking-wider text-ink/35">period total</span>
|
|
233
|
+
</div>
|
|
234
|
+
<dl className="space-y-2 text-[11px]">
|
|
235
|
+
<div className="flex items-center justify-between">
|
|
236
|
+
<dt className="text-ink/60">Cost per 1M tokens</dt>
|
|
237
|
+
<dd className="tabular-nums font-semibold text-ink">{costPerMillionLabel(totals)}</dd>
|
|
107
238
|
</div>
|
|
108
|
-
<div className="flex justify-between
|
|
109
|
-
<
|
|
110
|
-
<
|
|
239
|
+
<div className="flex items-center justify-between">
|
|
240
|
+
<dt className="text-ink/60">Cache hit rate</dt>
|
|
241
|
+
<dd className="tabular-nums font-semibold text-ink">{cacheHitLabel(totals)}</dd>
|
|
111
242
|
</div>
|
|
112
|
-
<div className="flex justify-between
|
|
113
|
-
<
|
|
114
|
-
<
|
|
243
|
+
<div className="flex items-center justify-between">
|
|
244
|
+
<dt className="text-ink/60">Unpriced turns</dt>
|
|
245
|
+
<dd className="tabular-nums font-semibold text-ink">
|
|
246
|
+
{totals.records > 0 ? `${((totals.unpriced / totals.records) * 100).toFixed(1)}%` : '—'}
|
|
247
|
+
</dd>
|
|
115
248
|
</div>
|
|
116
|
-
|
|
249
|
+
<div className="flex items-center justify-between">
|
|
250
|
+
<dt className="text-ink/60">Turns</dt>
|
|
251
|
+
<dd className="tabular-nums font-semibold text-ink">{totals.records.toLocaleString('en-US')}</dd>
|
|
252
|
+
</div>
|
|
253
|
+
</dl>
|
|
117
254
|
|
|
118
|
-
<div className="border-t border-ink/10
|
|
119
|
-
<div className="flex justify-between
|
|
120
|
-
<span className="text-ink/60">
|
|
121
|
-
<span className="font-semibold text-ink">{
|
|
255
|
+
<div className="mt-3 border-t border-ink/10 pt-2.5">
|
|
256
|
+
<div className="flex items-center justify-between text-[11px]">
|
|
257
|
+
<span className="text-ink/60">Paid for cache reads</span>
|
|
258
|
+
<span className="tabular-nums font-semibold text-ink">{costLabel(totals.cacheReadCost)}</span>
|
|
122
259
|
</div>
|
|
260
|
+
<p className="mt-1 text-[10px] leading-tight text-ink/40">
|
|
261
|
+
Provider-reported cost only. A turn with no reported rate counts as unpriced rather than free.
|
|
262
|
+
</p>
|
|
123
263
|
</div>
|
|
124
264
|
</div>
|
|
125
265
|
</div>
|