@workerdeck/ui 0.23.0 → 1.0.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/build/{SessionPanel-DUt2VzXG.mjs → SessionPanel-DDgBkHsi.mjs} +2151 -3357
- package/build/SessionPanel-DDgBkHsi.mjs.map +1 -0
- package/build/SessionPanel-E_L_ldQ5.d.mts +207 -0
- package/build/format-B8ZM9LPy.d.mts +16 -0
- package/build/format.d.mts +8 -75
- package/build/format.mjs +2 -2
- package/build/index.d.mts +63 -1138
- package/build/index.mjs +4 -300
- package/build/index.mjs.map +1 -1
- package/build/scoped.css +15 -23
- package/build/{status-BE-zg88x.mjs → status-C0HSLZas.mjs} +14 -85
- package/build/status-C0HSLZas.mjs.map +1 -0
- package/build/workspace.d.mts +5 -126
- package/build/workspace.mjs +11 -143
- package/build/workspace.mjs.map +1 -1
- package/package.json +4 -4
- package/src/components/agent/CodeEditor.tsx +31 -103
- package/src/components/agent/Composer.tsx +114 -333
- package/src/components/agent/ContextDialog.tsx +20 -41
- package/src/components/agent/ContextRing.tsx +6 -28
- package/src/components/agent/Conversation.tsx +21 -33
- package/src/components/agent/EditorTabs.tsx +39 -67
- package/src/components/agent/EngineIcon.tsx +29 -72
- package/src/components/agent/EntryIcon.tsx +16 -0
- package/src/components/agent/FileCard.tsx +10 -16
- package/src/components/agent/FileTree.tsx +52 -125
- package/src/components/agent/FileViewer.tsx +30 -60
- package/src/components/agent/HostFilesDialog.tsx +40 -69
- package/src/components/agent/Loader.tsx +3 -24
- package/src/components/agent/McpDialog.tsx +64 -137
- package/src/components/agent/Message.tsx +2 -21
- package/src/components/agent/ModelSelect.tsx +33 -62
- package/src/components/agent/PermissionModeSelect.tsx +21 -79
- package/src/components/agent/PermissionPrompt.tsx +59 -63
- package/src/components/agent/ProjectIcon.tsx +228 -93
- package/src/components/agent/PromptTokenText.tsx +10 -16
- package/src/components/agent/QuestionPrompt.tsx +43 -64
- package/src/components/agent/Reasoning.tsx +13 -16
- package/src/components/agent/Response.tsx +3 -9
- package/src/components/agent/Scrubber.tsx +31 -80
- package/src/components/agent/SessionBrowser.tsx +64 -243
- package/src/components/agent/SessionEmptyState.tsx +10 -40
- package/src/components/agent/SessionInfoDialog.tsx +46 -78
- package/src/components/agent/SessionItem.tsx +53 -320
- package/src/components/agent/SessionList.tsx +23 -39
- package/src/components/agent/SessionPanel.tsx +315 -996
- package/src/components/agent/SessionStatusIcon.tsx +14 -28
- package/src/components/agent/SessionSteps.tsx +34 -187
- package/src/components/agent/SessionWorkspace.tsx +104 -219
- package/src/components/agent/SkillsDialog.tsx +35 -80
- package/src/components/agent/StatusBar.tsx +51 -136
- package/src/components/agent/SubagentStrip.tsx +12 -77
- package/src/components/agent/ToolCallCard.tsx +94 -135
- package/src/components/agent/Transcript.tsx +103 -1288
- package/src/components/agent/TranscriptItemView.tsx +155 -0
- package/src/components/agent/TranscriptRows.tsx +418 -0
- package/src/components/agent/UsageDialog.tsx +7 -29
- package/src/components/agent/UsageMeters.tsx +18 -73
- package/src/components/agent/pulse.tsx +9 -32
- package/src/components/agent/scrubber-marks.ts +33 -103
- package/src/components/agent/status.ts +1 -5
- package/src/components/agent/tool-result-fetch.tsx +3 -25
- package/src/components/agent/tool-result-image.tsx +32 -111
- package/src/components/agent/transcript-rows.ts +41 -118
- package/src/components/agent/transcript-variant.tsx +3 -80
- package/src/components/agent/use-height-epoch.ts +10 -24
- package/src/components/agent/use-path-links.ts +45 -63
- package/src/components/agent/use-subagent-frame.ts +106 -0
- package/src/components/agent/use-transcript-jumps.ts +49 -107
- package/src/components/prompt-area/animated-placeholder.tsx +6 -5
- package/src/components/prompt-area/clipboard-helpers.ts +26 -21
- package/src/components/prompt-area/cursor-helpers.ts +79 -37
- package/src/components/prompt-area/dom-helpers.ts +97 -69
- package/src/components/prompt-area/file-strip.tsx +90 -80
- package/src/components/prompt-area/html-to-markdown.ts +67 -46
- package/src/components/prompt-area/image-strip.tsx +8 -18
- package/src/components/prompt-area/index.ts +2 -15
- package/src/components/prompt-area/prompt-area-engine.ts +100 -115
- package/src/components/prompt-area/prompt-area-list-ops.ts +66 -59
- package/src/components/prompt-area/prompt-area.tsx +31 -38
- package/src/components/prompt-area/remove-button.tsx +3 -9
- package/src/components/prompt-area/segment-helpers.ts +4 -12
- package/src/components/prompt-area/trigger-popover.tsx +15 -27
- package/src/components/prompt-area/trigger-presets.ts +0 -10
- package/src/components/prompt-area/types.ts +3 -8
- package/src/components/prompt-area/use-chip-editing.ts +305 -0
- package/src/components/prompt-area/use-markdown-mode.ts +7 -17
- package/src/components/prompt-area/use-prompt-area-events.ts +80 -86
- package/src/components/prompt-area/use-prompt-area-keydown.ts +598 -0
- package/src/components/prompt-area/use-prompt-area-state.ts +5 -23
- package/src/components/prompt-area/use-prompt-area.ts +170 -896
- package/src/components/prompt-area/use-trigger-search.ts +21 -19
- package/src/components/terminal/PermissionPrompt.tsx +56 -59
- package/src/components/terminal/QuestionPrompt.tsx +28 -79
- package/src/components/terminal/StatusLine.tsx +13 -63
- package/src/components/terminal/TerminalTranscript.tsx +44 -160
- package/src/components/terminal/affordances.tsx +68 -98
- package/src/components/terminal/blocks.ts +20 -156
- package/src/components/terminal/diff.tsx +19 -67
- package/src/components/terminal/height.ts +163 -313
- package/src/components/terminal/image-box.ts +0 -44
- package/src/components/terminal/items.tsx +150 -305
- package/src/components/terminal/markdown.tsx +36 -95
- package/src/components/terminal/press.tsx +26 -53
- package/src/components/terminal/prompt.tsx +40 -170
- package/src/components/terminal/result-preview.ts +8 -56
- package/src/components/terminal/row.tsx +11 -98
- package/src/components/terminal/scrubber.tsx +108 -401
- package/src/components/terminal/surface.tsx +6 -54
- package/src/components/terminal/todos.ts +66 -0
- package/src/components/terminal/tool-run.ts +21 -192
- package/src/components/ui/AlertDialog.tsx +8 -23
- package/src/components/ui/Badge.tsx +18 -29
- package/src/components/ui/Button.tsx +7 -15
- package/src/components/ui/Card.tsx +2 -13
- package/src/components/ui/CodeBlock.tsx +10 -37
- package/src/components/ui/CopyButton.tsx +10 -23
- package/src/components/ui/Dialog.tsx +23 -36
- package/src/components/ui/Empty.tsx +6 -29
- package/src/components/ui/Input.tsx +14 -16
- package/src/components/ui/Menu.tsx +6 -18
- package/src/components/ui/PortalScope.tsx +1 -21
- package/src/components/ui/ProgressRing.tsx +8 -19
- package/src/components/ui/Select.tsx +18 -31
- package/src/components/ui/Sonner.tsx +1 -2
- package/src/components/ui/Spinner.tsx +1 -1
- package/src/components/ui/Splitter.tsx +30 -64
- package/src/components/ui/Textarea.tsx +2 -5
- package/src/components/ui/Tooltip.tsx +3 -13
- package/src/format.ts +0 -9
- package/src/index.ts +16 -113
- package/src/lib/clipboard.ts +8 -28
- package/src/lib/css.ts +8 -0
- package/src/lib/format.ts +101 -86
- package/src/lib/plan-request.ts +16 -0
- package/src/lib/status.ts +45 -95
- package/src/lib/tool-icon.ts +39 -47
- package/src/lib/utils.ts +1 -3
- package/src/styles/terminal.css +81 -49
- package/src/styles/theme.css +96 -32
- package/src/workspace.ts +1 -24
- package/build/SessionPanel-BobynUo4.d.mts +0 -669
- package/build/SessionPanel-DUt2VzXG.mjs.map +0 -1
- package/build/format-ljc3lKpA.d.mts +0 -59
- package/build/status-BE-zg88x.mjs.map +0 -1
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import * as _$react from "react";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { LucideIcon } from "lucide-react";
|
|
4
|
+
import { ModelOption, PermissionMode, SkillInfo } from "@workerdeck/protocol";
|
|
5
|
+
import { ClientToolHandler, ConnectionState, TranscriptState, UseToolCallHostOptions } from "@workerdeck/react";
|
|
6
|
+
import { WorkerDeckClient } from "@workerdeck/client";
|
|
7
|
+
|
|
8
|
+
//#region src/components/agent/PermissionModeSelect.d.ts
|
|
9
|
+
type PermissionModeMeta = {
|
|
10
|
+
value: PermissionMode;
|
|
11
|
+
label: string;
|
|
12
|
+
shortLabel: string;
|
|
13
|
+
description: string;
|
|
14
|
+
icon: LucideIcon;
|
|
15
|
+
dangerous?: boolean;
|
|
16
|
+
};
|
|
17
|
+
declare const PERMISSION_MODES: PermissionModeMeta[];
|
|
18
|
+
declare function permissionModeMeta(mode: PermissionMode): PermissionModeMeta | undefined;
|
|
19
|
+
type PermissionModeChoice = {
|
|
20
|
+
value: PermissionMode;
|
|
21
|
+
label: string;
|
|
22
|
+
description: string;
|
|
23
|
+
dangerous?: boolean;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
};
|
|
26
|
+
declare function permissionModeChoices(modes?: readonly PermissionMode[], canBypass?: boolean): PermissionModeChoice[];
|
|
27
|
+
interface PermissionModeSelectProps {
|
|
28
|
+
mode?: PermissionMode;
|
|
29
|
+
onModeChange: (mode: PermissionMode) => void;
|
|
30
|
+
modes?: readonly PermissionMode[];
|
|
31
|
+
canBypass?: boolean;
|
|
32
|
+
variant?: 'toolbar' | 'form';
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
className?: string;
|
|
35
|
+
}
|
|
36
|
+
declare function PermissionModeSelect({
|
|
37
|
+
mode,
|
|
38
|
+
onModeChange,
|
|
39
|
+
modes,
|
|
40
|
+
canBypass,
|
|
41
|
+
variant,
|
|
42
|
+
disabled,
|
|
43
|
+
className
|
|
44
|
+
}: PermissionModeSelectProps): _$react.JSX.Element;
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/components/terminal/affordances.d.ts
|
|
47
|
+
type TerminalAffordances = {
|
|
48
|
+
hover?: boolean;
|
|
49
|
+
actions?: boolean;
|
|
50
|
+
};
|
|
51
|
+
declare function useAffordances(): Required<TerminalAffordances>;
|
|
52
|
+
declare function WithActions({
|
|
53
|
+
actions,
|
|
54
|
+
children,
|
|
55
|
+
className
|
|
56
|
+
}: {
|
|
57
|
+
actions: ReactNode;
|
|
58
|
+
children: ReactNode;
|
|
59
|
+
className?: string;
|
|
60
|
+
}): _$react.JSX.Element;
|
|
61
|
+
declare function CopyAction({
|
|
62
|
+
text,
|
|
63
|
+
label
|
|
64
|
+
}: {
|
|
65
|
+
text: string;
|
|
66
|
+
label?: string;
|
|
67
|
+
}): _$react.JSX.Element;
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/components/agent/transcript-variant.d.ts
|
|
70
|
+
type TranscriptVariant = 'cards' | 'terminal';
|
|
71
|
+
declare function TranscriptVariantProvider({
|
|
72
|
+
value,
|
|
73
|
+
children
|
|
74
|
+
}: {
|
|
75
|
+
value: TranscriptVariant;
|
|
76
|
+
children: ReactNode;
|
|
77
|
+
}): _$react.JSX.Element;
|
|
78
|
+
declare function useTranscriptVariant(): TranscriptVariant;
|
|
79
|
+
type TranscriptDensity = 'comfortable' | 'compact';
|
|
80
|
+
declare function TranscriptDensityProvider({
|
|
81
|
+
value,
|
|
82
|
+
children
|
|
83
|
+
}: {
|
|
84
|
+
value: TranscriptDensity;
|
|
85
|
+
children: ReactNode;
|
|
86
|
+
}): _$react.JSX.Element;
|
|
87
|
+
declare function useTranscriptDensity(): TranscriptDensity;
|
|
88
|
+
type TranscriptFont = 'sans' | 'mono';
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/components/agent/SessionPanel.d.ts
|
|
91
|
+
type TerminalMetrics = {
|
|
92
|
+
fontSize?: number;
|
|
93
|
+
lineHeight?: number;
|
|
94
|
+
};
|
|
95
|
+
interface SessionPanelProps {
|
|
96
|
+
client: WorkerDeckClient;
|
|
97
|
+
sessionId: string | undefined;
|
|
98
|
+
header?: ReactNode | ((slots: {
|
|
99
|
+
actions: ReactNode;
|
|
100
|
+
}) => ReactNode);
|
|
101
|
+
panelSurface?: 'internal' | 'external';
|
|
102
|
+
statusSurface?: 'internal' | 'external';
|
|
103
|
+
statusPlacement?: 'top' | 'bottom';
|
|
104
|
+
onOpenPanel?: (panel: SessionSurfacePanel) => void;
|
|
105
|
+
onVitals?: (vitals: SessionVitals) => void;
|
|
106
|
+
transcriptVariant?: TranscriptVariant;
|
|
107
|
+
affordances?: TerminalAffordances | boolean;
|
|
108
|
+
terminalMetrics?: TerminalMetrics;
|
|
109
|
+
scrubber?: boolean;
|
|
110
|
+
/** Bookmarked transcript item ids — the host owns membership and persistence. */
|
|
111
|
+
bookmarks?: readonly string[];
|
|
112
|
+
onToggleBookmark?: (itemId: string) => void;
|
|
113
|
+
reveal?: {
|
|
114
|
+
toolUseId: string;
|
|
115
|
+
nonce: number;
|
|
116
|
+
};
|
|
117
|
+
openSubagent?: {
|
|
118
|
+
toolUseId: string;
|
|
119
|
+
nonce: number;
|
|
120
|
+
};
|
|
121
|
+
onSubagentChange?: (toolUseId: string | undefined) => void;
|
|
122
|
+
stickyPrompt?: boolean;
|
|
123
|
+
transcriptDensity?: TranscriptDensity;
|
|
124
|
+
transcriptFont?: TranscriptFont;
|
|
125
|
+
controlsSurface?: 'internal' | 'external' | 'status';
|
|
126
|
+
onControls?: (controls: SessionControls | undefined) => void;
|
|
127
|
+
focusComposerOnClick?: boolean;
|
|
128
|
+
unseen?: {
|
|
129
|
+
itemCount: number;
|
|
130
|
+
since?: number;
|
|
131
|
+
};
|
|
132
|
+
readOnly?: boolean;
|
|
133
|
+
toolHost?: UseToolCallHostOptions | false;
|
|
134
|
+
cacheTranscript?: boolean;
|
|
135
|
+
emptyState?: ReactNode;
|
|
136
|
+
onLinkClick?: (href: string) => boolean | void;
|
|
137
|
+
clientTools?: Record<string, ClientToolHandler>;
|
|
138
|
+
fontSize?: number;
|
|
139
|
+
className?: string;
|
|
140
|
+
}
|
|
141
|
+
type SessionControls = {
|
|
142
|
+
setModel: (model?: string) => void;
|
|
143
|
+
setPermissionMode: (mode: PermissionMode) => void;
|
|
144
|
+
interrupt: () => void;
|
|
145
|
+
focusComposer: () => void;
|
|
146
|
+
insertComposerText: (text: string) => void;
|
|
147
|
+
};
|
|
148
|
+
type SessionSurfacePanel = 'info' | 'context' | 'usage' | 'mcp' | 'files' | 'skills';
|
|
149
|
+
type SessionVitals = {
|
|
150
|
+
status: TranscriptState['status'];
|
|
151
|
+
connection: ConnectionState;
|
|
152
|
+
engine: TranscriptState['engine'];
|
|
153
|
+
capabilities: TranscriptState['capabilities'];
|
|
154
|
+
model: string | undefined;
|
|
155
|
+
models: ModelOption[];
|
|
156
|
+
permissionMode: TranscriptState['permissionMode'];
|
|
157
|
+
permissionModes: PermissionModeChoice[];
|
|
158
|
+
skills: SkillInfo[] | undefined;
|
|
159
|
+
cwd: TranscriptState['cwd'];
|
|
160
|
+
contextUsage: TranscriptState['contextUsage'];
|
|
161
|
+
rateLimits: TranscriptState['rateLimits'];
|
|
162
|
+
/**
|
|
163
|
+
* When the newest window in `rateLimits` was reported, as event time — not receive time. External chrome (the
|
|
164
|
+
* VS Code status bar, iOS) cannot otherwise tell a live reading from one a days-old session just replayed.
|
|
165
|
+
* Absent means unknown, which is not the same as fresh.
|
|
166
|
+
*/
|
|
167
|
+
rateLimitsUpdatedAt: number | undefined;
|
|
168
|
+
itemCount: number;
|
|
169
|
+
totalCostUsd: number;
|
|
170
|
+
};
|
|
171
|
+
declare function SessionPanel({
|
|
172
|
+
client,
|
|
173
|
+
sessionId,
|
|
174
|
+
header,
|
|
175
|
+
panelSurface,
|
|
176
|
+
statusSurface,
|
|
177
|
+
statusPlacement,
|
|
178
|
+
onOpenPanel,
|
|
179
|
+
onVitals,
|
|
180
|
+
transcriptVariant,
|
|
181
|
+
transcriptDensity,
|
|
182
|
+
transcriptFont,
|
|
183
|
+
affordances,
|
|
184
|
+
terminalMetrics,
|
|
185
|
+
scrubber,
|
|
186
|
+
bookmarks,
|
|
187
|
+
onToggleBookmark,
|
|
188
|
+
reveal,
|
|
189
|
+
openSubagent,
|
|
190
|
+
onSubagentChange,
|
|
191
|
+
stickyPrompt,
|
|
192
|
+
controlsSurface,
|
|
193
|
+
onControls,
|
|
194
|
+
focusComposerOnClick,
|
|
195
|
+
unseen,
|
|
196
|
+
readOnly,
|
|
197
|
+
toolHost,
|
|
198
|
+
clientTools,
|
|
199
|
+
cacheTranscript,
|
|
200
|
+
emptyState,
|
|
201
|
+
onLinkClick,
|
|
202
|
+
fontSize,
|
|
203
|
+
className
|
|
204
|
+
}: SessionPanelProps): _$react.JSX.Element;
|
|
205
|
+
//#endregion
|
|
206
|
+
export { permissionModeChoices as C, PermissionModeSelectProps as S, useAffordances as _, SessionVitals as a, PermissionModeMeta as b, TranscriptDensityProvider as c, TranscriptVariantProvider as d, useTranscriptDensity as f, WithActions as g, TerminalAffordances as h, SessionSurfacePanel as i, TranscriptFont as l, CopyAction as m, SessionPanel as n, TerminalMetrics as o, useTranscriptVariant as p, SessionPanelProps as r, TranscriptDensity as s, SessionControls as t, TranscriptVariant as u, PERMISSION_MODES as v, permissionModeMeta as w, PermissionModeSelect as x, PermissionModeChoice as y };
|
|
207
|
+
//# sourceMappingURL=SessionPanel-E_L_ldQ5.d.mts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/lib/format.d.ts
|
|
2
|
+
declare function formatCost(usd: number | undefined): string;
|
|
3
|
+
declare function formatDuration(ms: number): string;
|
|
4
|
+
declare function formatTokens(tokens: number): string;
|
|
5
|
+
declare function formatBytes(bytes: number): string;
|
|
6
|
+
declare function formatCountdown(untilEpochMs: number, now?: number): string;
|
|
7
|
+
declare function formatRelativeTime(epochMs: number | undefined, now?: number): string;
|
|
8
|
+
declare function formatRateLimitWindow(key: string): string;
|
|
9
|
+
declare function formatRateLimitWindowLong(key: string): string;
|
|
10
|
+
declare function rateLimitWindowSeconds(key: string): number | undefined;
|
|
11
|
+
declare function formatAgoPrecise(epochMs: number, now?: number): string;
|
|
12
|
+
declare function toolInputPreview(input: unknown, max?: number): string;
|
|
13
|
+
declare function friendlyModel(id: string | undefined): string | undefined;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { formatDuration as a, formatRelativeTime as c, rateLimitWindowSeconds as d, toolInputPreview as f, formatCountdown as i, formatTokens as l, formatBytes as n, formatRateLimitWindow as o, formatCost as r, formatRateLimitWindowLong as s, formatAgoPrecise as t, friendlyModel as u };
|
|
16
|
+
//# sourceMappingURL=format-B8ZM9LPy.d.mts.map
|
package/build/format.d.mts
CHANGED
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
import { a as formatDuration, c as formatRelativeTime, d as rateLimitWindowSeconds, f as toolInputPreview, i as formatCountdown, l as formatTokens, n as formatBytes, o as formatRateLimitWindow, r as formatCost, s as formatRateLimitWindowLong, t as formatAgoPrecise, u as friendlyModel } from "./format-
|
|
1
|
+
import { a as formatDuration, c as formatRelativeTime, d as rateLimitWindowSeconds, f as toolInputPreview, i as formatCountdown, l as formatTokens, n as formatBytes, o as formatRateLimitWindow, r as formatCost, s as formatRateLimitWindowLong, t as formatAgoPrecise, u as friendlyModel } from "./format-B8ZM9LPy.mjs";
|
|
2
2
|
import { ModelOption, RateLimitInfo, SessionStatus } from "@workerdeck/protocol";
|
|
3
3
|
|
|
4
4
|
//#region src/lib/status.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* How a session's live readings become a status line — the pure half, so every
|
|
7
|
-
* host spells "Needs approval", "80% is a warning" and "which window is the
|
|
8
|
-
* binding one" the same way.
|
|
9
|
-
*
|
|
10
|
-
* Structurally typed against `SessionVitals` rather than importing it: this file
|
|
11
|
-
* ships from the React-free `@workerdeck/ui/format` entry, and a host drawing
|
|
12
|
-
* the readings outside React (the VS Code extension host in the window status
|
|
13
|
-
* bar) must not pull a component graph in to do it. A real `SessionVitals`
|
|
14
|
-
* satisfies every shape here.
|
|
15
|
-
*/
|
|
16
5
|
type StatusSeverity = 'none' | 'warning' | 'error';
|
|
17
|
-
/** What a status slot shows, before any host's icon vocabulary gets involved.
|
|
18
|
-
* `icon` is a VS Code codicon name — the one host-shaped thing left, because the
|
|
19
|
-
* alternative is a second mapping table in the only consumer. */
|
|
20
6
|
type StatusPresentation = {
|
|
21
7
|
icon: string;
|
|
22
8
|
label: string;
|
|
@@ -24,89 +10,36 @@ type StatusPresentation = {
|
|
|
24
10
|
};
|
|
25
11
|
type StatusReadings = {
|
|
26
12
|
status: SessionStatus;
|
|
27
|
-
/** `@workerdeck/react`'s `ConnectionState`, structurally — the link state wins
|
|
28
|
-
* the slot, so it has to be part of the reading. */
|
|
29
13
|
connection?: 'live' | 'reconnecting' | 'offline';
|
|
30
14
|
};
|
|
31
|
-
/**
|
|
32
|
-
* The status slot, connection first. A session status held over a dead socket is
|
|
33
|
-
* the last thing we heard, not the current state — so a lost link takes the slot
|
|
34
|
-
* rather than letting "Running" imply a turn is still streaming.
|
|
35
|
-
*/
|
|
36
15
|
declare function statusPresentation(vitals: StatusReadings | undefined): StatusPresentation;
|
|
37
|
-
/** 0–100 → the colour a meter wears. One pair of thresholds for every surface. */
|
|
38
16
|
declare function meterSeverity(pct: number | undefined): StatusSeverity;
|
|
39
|
-
/**
|
|
40
|
-
* The three *lanes* a plan-usage reading can occupy, and the whole reason this
|
|
41
|
-
* is a rule rather than a per-client `if`.
|
|
42
|
-
*
|
|
43
|
-
* The CLI reports one window per limit (`five_hour`, `seven_day`, and a
|
|
44
|
-
* `seven_day_<model>` bucket per model-scoped limit — `seven_day_opus`,
|
|
45
|
-
* `seven_day_sonnet`, and whatever `model_scoped` names next). A surface with
|
|
46
|
-
* one slot shows the fullest of them, which is why `tightestWindow` exists —
|
|
47
|
-
* but that answers "what is closest to blocking me", not "how much of *this
|
|
48
|
-
* session's* budget have I spent", and those are different questions a reader
|
|
49
|
-
* asks at different times. A weekly window at 71% will win the single slot over
|
|
50
|
-
* a five-hour window at 60% every time, so the reading you actually watch while
|
|
51
|
-
* working is the one you can never see.
|
|
52
|
-
*
|
|
53
|
-
* Hence three lanes, each independently showable:
|
|
54
|
-
*
|
|
55
|
-
* - `'session'` — the five-hour window. The one that resets while you work.
|
|
56
|
-
* - `'weekly'` — the plain seven-day window, the account-wide ceiling.
|
|
57
|
-
* - `'model'` — the fullest of the *model-scoped* weekly buckets. Deliberately
|
|
58
|
-
* not a named model: which models have their own bucket is the plan's
|
|
59
|
-
* business and changes without notice, so a client that hardcoded
|
|
60
|
-
* `seven_day_opus` would show nothing the month it becomes something else.
|
|
61
|
-
* The label comes from the key, so this lane names whatever it found.
|
|
62
|
-
*/
|
|
63
17
|
type UsageLane = 'session' | 'weekly' | 'model';
|
|
64
|
-
/** The window a lane points at, or `undefined` when this account has none. */
|
|
65
18
|
declare function usageWindow(rateLimits: Record<string, RateLimitInfo> | undefined, lane: UsageLane): {
|
|
66
19
|
key: string;
|
|
67
20
|
info: RateLimitInfo;
|
|
68
21
|
} | undefined;
|
|
69
|
-
/** The rate-limit window that gets the one visible slot: whichever is fullest,
|
|
70
|
-
* since the binding constraint is the one worth glancing at. Still the right
|
|
71
|
-
* rule for a surface with exactly one slot; {@link usageWindow} is for one with
|
|
72
|
-
* three. */
|
|
73
22
|
declare function tightestWindow(rateLimits: Record<string, RateLimitInfo> | undefined): {
|
|
74
23
|
key: string;
|
|
75
24
|
info: RateLimitInfo;
|
|
76
25
|
} | undefined;
|
|
77
|
-
/** A rate-limit window's key, named for a human. A model-scoped bucket is named
|
|
78
|
-
* for its model alone (`seven_day_fable` → "Fable"): the lane it sits in
|
|
79
|
-
* already says weekly, and "Seven day fable" in a status bar is three words to
|
|
80
|
-
* say one. */
|
|
81
26
|
declare function windowLabel(key: string): string;
|
|
82
27
|
type ModelReadings = {
|
|
83
28
|
model?: string;
|
|
84
29
|
models: readonly ModelOption[];
|
|
85
30
|
};
|
|
86
|
-
/**
|
|
87
|
-
* The catalog row a session is actually running, or `undefined` for a model the
|
|
88
|
-
* list doesn't name. Matched leniently: a session reports the *resolved* id
|
|
89
|
-
* (`claude-sonnet-5`) where the row may be keyed on the alias (`sonnet`), and
|
|
90
|
-
* either can carry a `[1m]` context-window suffix.
|
|
91
|
-
*/
|
|
92
31
|
declare function currentModel(vitals: ModelReadings | undefined): ModelOption | undefined;
|
|
93
|
-
/** A session's model, named the way the picker names it. Falls back to the raw
|
|
94
|
-
* id, and to "Default" while the session is on the CLI's own pick. */
|
|
95
32
|
declare function modelLabel(vitals: ModelReadings | undefined): string;
|
|
96
|
-
/** Context percentage as its meter severity — the reading and the colour come
|
|
97
|
-
* from one place so a panel and a status bar never disagree.
|
|
98
|
-
*
|
|
99
|
-
* Takes only the number it reads, so the compact `ContextReading` that rides
|
|
100
|
-
* the sessions list and the full `ContextUsage` on the event stream are coloured
|
|
101
|
-
* by one rule rather than two. */
|
|
102
33
|
declare function contextSeverity(usage: {
|
|
103
34
|
percentage: number;
|
|
104
35
|
} | undefined): StatusSeverity;
|
|
105
|
-
/** {@link meterSeverity} as a text colour class. Here rather than beside each
|
|
106
|
-
* meter because the status bar, the context dialog and a sessions-list row all
|
|
107
|
-
* paint the same reading, and a fourth copy of the thresholds is a fourth
|
|
108
|
-
* chance for one surface to call 81% orange and another call it grey. */
|
|
109
36
|
declare function meterColorClass(pct: number | undefined): string;
|
|
37
|
+
/**
|
|
38
|
+
* The fill colour for a meter bar. Deliberately a different ramp from
|
|
39
|
+
* {@link meterColorClass}: a bar reads as alarming later than a number does, so the tint
|
|
40
|
+
* turns at 70/90 where the text severity turns at 80/95.
|
|
41
|
+
*/
|
|
42
|
+
declare function meterTintClass(pct: number): string;
|
|
110
43
|
//#endregion
|
|
111
|
-
export { ModelReadings, StatusPresentation, StatusReadings, StatusSeverity, UsageLane, contextSeverity, currentModel, formatAgoPrecise, formatBytes, formatCost, formatCountdown, formatDuration, formatRateLimitWindow, formatRateLimitWindowLong, formatRelativeTime, formatTokens, friendlyModel, meterColorClass, meterSeverity, modelLabel, rateLimitWindowSeconds, statusPresentation, tightestWindow, toolInputPreview, usageWindow, windowLabel };
|
|
44
|
+
export { ModelReadings, StatusPresentation, StatusReadings, StatusSeverity, UsageLane, contextSeverity, currentModel, formatAgoPrecise, formatBytes, formatCost, formatCountdown, formatDuration, formatRateLimitWindow, formatRateLimitWindowLong, formatRelativeTime, formatTokens, friendlyModel, meterColorClass, meterSeverity, meterTintClass, modelLabel, rateLimitWindowSeconds, statusPresentation, tightestWindow, toolInputPreview, usageWindow, windowLabel };
|
|
112
45
|
//# sourceMappingURL=format.d.mts.map
|
package/build/format.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
export { contextSeverity, currentModel, formatAgoPrecise, formatBytes, formatCost, formatCountdown, formatDuration, formatRateLimitWindow, formatRateLimitWindowLong, formatRelativeTime, formatTokens, friendlyModel, meterColorClass, meterSeverity, modelLabel, rateLimitWindowSeconds, statusPresentation, tightestWindow, toolInputPreview, usageWindow, windowLabel };
|
|
1
|
+
import { S as toolInputPreview, _ as formatRateLimitWindowLong, a as meterTintClass, b as friendlyModel, c as tightestWindow, d as formatAgoPrecise, f as formatBytes, g as formatRateLimitWindow, h as formatDuration, i as meterSeverity, l as usageWindow, m as formatCountdown, n as currentModel, o as modelLabel, p as formatCost, r as meterColorClass, s as statusPresentation, t as contextSeverity, u as windowLabel, v as formatRelativeTime, x as rateLimitWindowSeconds, y as formatTokens } from "./status-C0HSLZas.mjs";
|
|
2
|
+
export { contextSeverity, currentModel, formatAgoPrecise, formatBytes, formatCost, formatCountdown, formatDuration, formatRateLimitWindow, formatRateLimitWindowLong, formatRelativeTime, formatTokens, friendlyModel, meterColorClass, meterSeverity, meterTintClass, modelLabel, rateLimitWindowSeconds, statusPresentation, tightestWindow, toolInputPreview, usageWindow, windowLabel };
|