@workerdeck/ui 2.8.0 → 2.10.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.
Files changed (42) hide show
  1. package/build/{SessionPanel-_lQLhWOw.d.mts → SessionPanel-BVbau2eR.d.mts} +68 -4
  2. package/build/index.d.mts +62 -9
  3. package/build/index.mjs +24 -10
  4. package/build/index.mjs.map +1 -1
  5. package/build/scoped.css +44 -0
  6. package/build/{SessionPanel-Dg4xf-ql.mjs → use-path-links-CvcxdUXL.mjs} +1080 -497
  7. package/build/use-path-links-CvcxdUXL.mjs.map +1 -0
  8. package/build/workspace.d.mts +3 -2
  9. package/build/workspace.mjs +5 -86
  10. package/build/workspace.mjs.map +1 -1
  11. package/package.json +4 -4
  12. package/src/components/agent/Composer.tsx +88 -83
  13. package/src/components/agent/PromptTokenText.tsx +11 -3
  14. package/src/components/agent/SessionInfoDialog.tsx +1 -1
  15. package/src/components/agent/SessionItem.tsx +12 -6
  16. package/src/components/agent/SessionList.tsx +1 -1
  17. package/src/components/agent/SessionPanel.tsx +308 -225
  18. package/src/components/agent/SessionWorkspace.tsx +3 -0
  19. package/src/components/agent/StatusBar.tsx +1 -1
  20. package/src/components/agent/Transcript.tsx +83 -79
  21. package/src/components/agent/TranscriptItemView.tsx +1 -1
  22. package/src/components/agent/UsageDialog.tsx +87 -6
  23. package/src/components/agent/UsageMeters.tsx +17 -4
  24. package/src/components/agent/composer-commands.ts +154 -0
  25. package/src/components/agent/use-path-links.ts +7 -26
  26. package/src/components/prompt-area/clipboard-helpers.ts +13 -4
  27. package/src/components/prompt-area/dom-helpers.ts +10 -1
  28. package/src/components/prompt-area/index.ts +10 -1
  29. package/src/components/prompt-area/prompt-area-engine.ts +23 -14
  30. package/src/components/prompt-area/types.ts +20 -0
  31. package/src/components/prompt-area/use-prompt-area-keydown.ts +2 -1
  32. package/src/components/prompt-area/use-prompt-area.ts +8 -2
  33. package/src/components/terminal/StatusLine.tsx +3 -2
  34. package/src/components/terminal/file-link.tsx +20 -0
  35. package/src/components/terminal/items.tsx +3 -2
  36. package/src/components/terminal/markdown.tsx +31 -5
  37. package/src/index.ts +14 -2
  38. package/src/lib/file-link.ts +70 -0
  39. package/src/lib/path-match.ts +51 -0
  40. package/src/lib/session-cost.ts +65 -0
  41. package/src/styles/terminal.css +15 -0
  42. package/build/SessionPanel-Dg4xf-ql.mjs.map +0 -1
@@ -1,8 +1,58 @@
1
1
  import { ComponentType, ReactNode } from "react";
2
2
  import { LucideIcon } from "lucide-react";
3
- import { ModelOption, PermissionMode, PermissionRequest, SessionTask, SkillInfo, SubagentInfo } from "@workerdeck/protocol";
3
+ import { ModelOption, PermissionMode, PermissionRequest, SessionTask, SkillInfo, SlashCommandInfo, SubagentInfo } from "@workerdeck/protocol";
4
4
  import { ClientToolHandler, ConnectionState, TranscriptState, UseToolCallHostOptions } from "@workerdeck/react";
5
5
  import { WorkerDeckClient } from "@workerdeck/client";
6
+ //#region src/components/agent/composer-commands.d.ts
7
+ type ClientCommand = {
8
+ name: string;
9
+ description: string;
10
+ argumentHint?: string;
11
+ requiresArgs?: boolean;
12
+ run: (args: string) => boolean;
13
+ };
14
+ type ComposerRow = {
15
+ kind: 'command';
16
+ name: string;
17
+ description?: string;
18
+ argumentHint?: string;
19
+ aliases?: string[];
20
+ } | {
21
+ kind: 'client';
22
+ name: string;
23
+ description?: string;
24
+ argumentHint?: string;
25
+ command: ClientCommand;
26
+ } | {
27
+ kind: 'skill';
28
+ name: string;
29
+ label: string;
30
+ description?: string;
31
+ enabled: boolean;
32
+ scope?: string;
33
+ skill: SkillInfo;
34
+ };
35
+ declare function skillPrompt(skill: SkillInfo): string;
36
+ declare function mergeComposerRows(sources: {
37
+ commands?: readonly SlashCommandInfo[];
38
+ clientCommands?: readonly ClientCommand[];
39
+ skills?: readonly SkillInfo[];
40
+ }): ComposerRow[];
41
+ declare function rankComposerRows(query: string, rows: readonly ComposerRow[]): ComposerRow[];
42
+ declare function matchClientCommand(text: string, commands: readonly ClientCommand[]): {
43
+ command: ClientCommand;
44
+ args: string;
45
+ } | undefined;
46
+ type ComposerCommandRow = {
47
+ kind: ComposerRow['kind'];
48
+ name: string;
49
+ label: string;
50
+ description?: string;
51
+ scope?: string;
52
+ enabled: boolean;
53
+ insertText: string;
54
+ };
55
+ //#endregion
6
56
  //#region src/components/agent/PermissionModeSelect.d.ts
7
57
  type PermissionModeMeta = {
8
58
  value: PermissionMode;
@@ -49,6 +99,18 @@ declare function CopyAction({ text, label }: {
49
99
  label?: string;
50
100
  }): import("react").JSX.Element;
51
101
  //#endregion
102
+ //#region src/components/terminal/file-link.d.ts
103
+ type FileLinkOpener = (path: string, line?: number) => void;
104
+ type FileLinkHandle = {
105
+ cwd?: string;
106
+ open: FileLinkOpener;
107
+ };
108
+ declare function FileLinkProvider({ value, children }: {
109
+ value: FileLinkHandle | undefined;
110
+ children: ReactNode;
111
+ }): import("react").JSX.Element;
112
+ declare function useFileLinks(): FileLinkHandle | undefined;
113
+ //#endregion
52
114
  //#region src/components/agent/transcript-variant.d.ts
53
115
  type TranscriptVariant = 'cards' | 'terminal';
54
116
  declare function TranscriptVariantProvider({ value, children }: {
@@ -91,6 +153,7 @@ interface SessionPanelProps {
91
153
  scrubber?: boolean;
92
154
  bookmarks?: readonly string[];
93
155
  onToggleBookmark?: (itemId: string) => void;
156
+ onOpenFile?: FileLinkOpener;
94
157
  reveal?: {
95
158
  toolUseId: string;
96
159
  nonce: number;
@@ -139,6 +202,7 @@ type SessionVitals = {
139
202
  permissionMode: TranscriptState['permissionMode'];
140
203
  permissionModes: PermissionModeChoice[];
141
204
  skills: SkillInfo[] | undefined;
205
+ composerCommands: ComposerCommandRow[];
142
206
  cwd: TranscriptState['cwd'];
143
207
  contextUsage: TranscriptState['contextUsage'];
144
208
  tasks: SessionTask[];
@@ -147,7 +211,7 @@ type SessionVitals = {
147
211
  itemCount: number;
148
212
  totalCostUsd: number;
149
213
  };
150
- declare function SessionPanel({ client, sessionId, header, panelSurface, statusSurface, statusPlacement, onOpenPanel, onVitals, transcriptVariant, transcriptDensity, transcriptFont, affordances, terminalMetrics, scrubber, bookmarks, onToggleBookmark, reveal, subagents, openSubagent, onSubagentChange, stickyPrompt, controlsSurface, onControls, focusComposerOnClick, unseen, readOnly, approvalPrompts, toolHost, clientTools, cacheTranscript, emptyState, onLinkClick, fontSize, className }: SessionPanelProps): import("react").JSX.Element;
214
+ declare function SessionPanel({ client, sessionId, header, panelSurface, statusSurface, statusPlacement, onOpenPanel, onVitals, transcriptVariant, transcriptDensity, transcriptFont, affordances, terminalMetrics, scrubber, bookmarks, onToggleBookmark, reveal, subagents, openSubagent, onSubagentChange, stickyPrompt, controlsSurface, onControls, focusComposerOnClick, unseen, readOnly, approvalPrompts, toolHost, clientTools, cacheTranscript, emptyState, onLinkClick, onOpenFile, fontSize, className }: SessionPanelProps): import("react").JSX.Element;
151
215
  //#endregion
152
- export { PermissionModeSelectProps as C, PermissionModeSelect as S, permissionModeMeta as T, WithActions as _, SessionSurfacePanel as a, PermissionModeChoice as b, TranscriptDensity as c, TranscriptVariant as d, TranscriptVariantProvider as f, TerminalAffordances as g, CopyAction as h, SessionPanelProps as i, TranscriptDensityProvider as l, useTranscriptVariant as m, SessionControls as n, SessionVitals as o, useTranscriptDensity as p, SessionPanel as r, TerminalMetrics as s, ApprovalPromptProps as t, TranscriptFont as u, useAffordances as v, permissionModeChoices as w, PermissionModeMeta as x, PERMISSION_MODES as y };
153
- //# sourceMappingURL=SessionPanel-_lQLhWOw.d.mts.map
216
+ export { ClientCommand as A, PERMISSION_MODES as C, PermissionModeSelectProps as D, PermissionModeSelect as E, skillPrompt as F, matchClientCommand as M, mergeComposerRows as N, permissionModeChoices as O, rankComposerRows as P, useAffordances as S, PermissionModeMeta as T, FileLinkProvider as _, SessionSurfacePanel as a, TerminalAffordances as b, TranscriptDensity as c, TranscriptVariant as d, TranscriptVariantProvider as f, FileLinkOpener as g, FileLinkHandle as h, SessionPanelProps as i, ComposerRow as j, permissionModeMeta as k, TranscriptDensityProvider as l, useTranscriptVariant as m, SessionControls as n, SessionVitals as o, useTranscriptDensity as p, SessionPanel as r, TerminalMetrics as s, ApprovalPromptProps as t, TranscriptFont as u, useFileLinks as v, PermissionModeChoice as w, WithActions as x, CopyAction as y };
217
+ //# sourceMappingURL=SessionPanel-BVbau2eR.d.mts.map
package/build/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as formatCost, c as formatRateLimitWindow, d as formatTokens, f as friendlyModel, i as formatBytes, l as formatRateLimitWindowLong, m as toolInputPreview, o as formatCountdown, p as rateLimitWindowSeconds, r as formatAgoPrecise, s as formatDuration, u as formatRelativeTime } from "./format-eS_oUry-.mjs";
2
- import { C as PermissionModeSelectProps, S as PermissionModeSelect, T as permissionModeMeta, _ as WithActions, a as SessionSurfacePanel, b as PermissionModeChoice, c as TranscriptDensity, d as TranscriptVariant, f as TranscriptVariantProvider, g as TerminalAffordances, h as CopyAction, i as SessionPanelProps, l as TranscriptDensityProvider, m as useTranscriptVariant, n as SessionControls, o as SessionVitals, p as useTranscriptDensity, r as SessionPanel, s as TerminalMetrics, t as ApprovalPromptProps, u as TranscriptFont, v as useAffordances, w as permissionModeChoices, x as PermissionModeMeta, y as PERMISSION_MODES } from "./SessionPanel-_lQLhWOw.mjs";
2
+ import { A as ClientCommand, C as PERMISSION_MODES, D as PermissionModeSelectProps, E as PermissionModeSelect, F as skillPrompt, M as matchClientCommand, N as mergeComposerRows, O as permissionModeChoices, P as rankComposerRows, S as useAffordances, T as PermissionModeMeta, _ as FileLinkProvider, a as SessionSurfacePanel, b as TerminalAffordances, c as TranscriptDensity, d as TranscriptVariant, f as TranscriptVariantProvider, g as FileLinkOpener, h as FileLinkHandle, i as SessionPanelProps, j as ComposerRow, k as permissionModeMeta, l as TranscriptDensityProvider, m as useTranscriptVariant, n as SessionControls, o as SessionVitals, p as useTranscriptDensity, r as SessionPanel, s as TerminalMetrics, t as ApprovalPromptProps, u as TranscriptFont, v as useFileLinks, w as PermissionModeChoice, x as WithActions, y as CopyAction } from "./SessionPanel-BVbau2eR.mjs";
3
3
  import { ButtonHTMLAttributes, FunctionComponent, HTMLAttributes, InputHTMLAttributes, ReactElement, ReactNode, Ref, RefObject, TextareaHTMLAttributes } from "react";
4
4
  import { VariantProps } from "class-variance-authority";
5
5
  import { ClassValue } from "clsx";
@@ -10,7 +10,7 @@ import { Menu as Menu$1 } from "@base-ui/react/menu";
10
10
  import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
11
11
  import { Tooltip } from "@base-ui/react/tooltip";
12
12
  import { toast } from "sonner";
13
- import { ContextReading, ContextUsage, FilePatch, ModelOption, PermissionRequest, ProfileEngine, ProjectIcon as ProjectIcon$1, QuestionBehavior, RateLimitInfo, SessionInfo, SessionRow, SessionStatus, SessionTask, SkillInfo, SlashCommandInfo, UsageWindowRow, ViewConfig, WorkspaceScope, parseUserQuestions } from "@workerdeck/protocol";
13
+ import { ByModel, ContextReading, ContextUsage, FilePatch, ModelOption, PermissionRequest, ProfileEngine, ProfileSpend, ProjectIcon as ProjectIcon$1, QuestionBehavior, RateLimitInfo, SessionInfo, SessionRow, SessionStatus, SessionTask, SkillInfo, SlashCommandInfo, UsageWindowRow, ViewConfig, WorkspaceScope, parseUserQuestions } from "@workerdeck/protocol";
14
14
  import { ConnectionState, TranscriptItem, TranscriptState, UseAttachmentsResult } from "@workerdeck/react";
15
15
  import { WorkerDeckClient } from "@workerdeck/client";
16
16
  //#region src/components/ui/Button.d.ts
@@ -182,6 +182,12 @@ type ChipSegment = {
182
182
  value: string;
183
183
  /** The display text shown in the chip */
184
184
  displayText: string;
185
+ /**
186
+ * The character the chip serialises and renders with, when it differs from
187
+ * `trigger`. The trigger is the menu the chip came from; the sigil is the
188
+ * token the host parses. Unset, the trigger character is the sigil.
189
+ */
190
+ sigil?: string;
185
191
  /** Optional data payload attached to the chip */
186
192
  data?: unknown;
187
193
  /**
@@ -227,6 +233,10 @@ type TriggerSuggestion = {
227
233
  /** Optional arbitrary data passed through on selection */
228
234
  data?: unknown;
229
235
  };
236
+ type ChipOptions = {
237
+ sigil?: string;
238
+ trailingText?: string;
239
+ };
230
240
  /**
231
241
  * Configuration for a trigger character.
232
242
  */
@@ -268,6 +278,15 @@ type TriggerConfig = {
268
278
  * `onChipAdd` does not fire either.
269
279
  */
270
280
  insertAsText?: (suggestion: TriggerSuggestion) => string | undefined;
281
+ /**
282
+ * For 'dropdown' mode: per-suggestion overrides for the chip a selection
283
+ * resolves to. `sigil` replaces the trigger character in the chip's text and
284
+ * serialisation (a `/` menu inserting a `$name` token); `trailingText` is
285
+ * the editable text placed after the chip in place of the default single
286
+ * space (it is inserted verbatim, so include the leading space). Return
287
+ * undefined for the plain chip.
288
+ */
289
+ chipOptions?: (suggestion: TriggerSuggestion) => ChipOptions | undefined;
271
290
  /**
272
291
  * For 'callback' and 'launch' modes: called when the trigger is activated.
273
292
  * Receives the full input text and cursor position. For 'launch' it fires on
@@ -639,7 +658,7 @@ declare function launchTrigger(opts: LaunchTriggerOptions): TriggerConfig;
639
658
  //#region src/components/prompt-area/prompt-area-engine.d.ts
640
659
  /**
641
660
  * Converts an array of segments to a plain text string.
642
- * Chips are represented as `{trigger}{displayText}` (e.g., "@Alice").
661
+ * Chips are represented by {@link chipPlainText}.
643
662
  */
644
663
  declare function segmentsToPlainText(segments: Segment[]): string;
645
664
  /**
@@ -781,6 +800,32 @@ declare function Ink({ tone, bold, className, ...props }: HTMLAttributes<HTMLSpa
781
800
  bold?: boolean;
782
801
  }): import("react").JSX.Element;
783
802
  //#endregion
803
+ //#region src/lib/file-link.d.ts
804
+ type FileLink = {
805
+ path: string;
806
+ line?: number;
807
+ };
808
+ declare function parseFileLink(href: string | undefined, cwd: string | undefined): FileLink | undefined;
809
+ //#endregion
810
+ //#region src/lib/path-match.d.ts
811
+ type PathHit = {
812
+ path: string;
813
+ line?: number;
814
+ };
815
+ type PathMatch = PathHit & {
816
+ length: number;
817
+ };
818
+ declare function matchPath(text: string | null | undefined, inCode?: boolean): PathMatch | undefined;
819
+ //#endregion
820
+ //#region src/components/agent/use-path-links.d.ts
821
+ declare function usePathLinks({ container, onOpen, enabled, ignore }: {
822
+ container: RefObject<HTMLElement | null>;
823
+ onOpen: (hit: PathHit) => void;
824
+ enabled?: boolean;
825
+ ignore?: string;
826
+ }): void;
827
+ declare function resolveAgainstCwd(path: string, cwd: string | undefined): string;
828
+ //#endregion
784
829
  //#region src/components/agent/Conversation.d.ts
785
830
  interface ConversationProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
786
831
  children: ReactNode;
@@ -894,6 +939,7 @@ interface ComposerProps {
894
939
  placeholder?: string;
895
940
  commands?: SlashCommandInfo[];
896
941
  skills?: SkillInfo[];
942
+ clientCommands?: ClientCommand[];
897
943
  onSearchFiles?: (query: string, options: {
898
944
  signal: AbortSignal;
899
945
  }) => Promise<ComposerFileMatch[]>;
@@ -912,8 +958,7 @@ interface ComposerProps {
912
958
  className?: string;
913
959
  ref?: Ref<ComposerHandle>;
914
960
  }
915
- declare function skillPrompt(skill: SkillInfo): string;
916
- declare function Composer({ onSend, onInterrupt, busy, disabled, placeholder, commands, skills, onSearchFiles, onShellCommand, attachments, toolbar, layout, fontSize, lineHeight, affordances, draft, className, ref }: ComposerProps): import("react").JSX.Element;
961
+ declare function Composer({ onSend, onInterrupt, busy, disabled, placeholder, commands, skills, clientCommands, onSearchFiles, onShellCommand, attachments, toolbar, layout, fontSize, lineHeight, affordances, draft, className, ref }: ComposerProps): import("react").JSX.Element;
917
962
  //#endregion
918
963
  //#region src/components/agent/ModelSelect.d.ts
919
964
  interface ModelSelectProps {
@@ -960,13 +1005,16 @@ interface UsageDialogProps {
960
1005
  rateLimits: UsageWindowRow[];
961
1006
  subscriptionType?: string;
962
1007
  engine: ProfileEngine;
963
- totalCostUsd: number;
1008
+ totalCostUsd?: number;
1009
+ costUsd?: number;
1010
+ usageByModel?: ByModel;
1011
+ spend?: ProfileSpend;
964
1012
  updatedAt?: number;
965
1013
  open: boolean;
966
1014
  onOpenChange: (open: boolean) => void;
967
1015
  className?: string;
968
1016
  }
969
- declare function UsageDialog({ rateLimits, subscriptionType, engine, totalCostUsd, updatedAt, open, onOpenChange, className }: UsageDialogProps): import("react").JSX.Element;
1017
+ declare function UsageDialog({ rateLimits, subscriptionType, engine, totalCostUsd, costUsd, usageByModel, spend, updatedAt, open, onOpenChange, className }: UsageDialogProps): import("react").JSX.Element;
970
1018
  //#endregion
971
1019
  //#region src/components/agent/TaskList.d.ts
972
1020
  interface TaskListProps {
@@ -1085,6 +1133,11 @@ declare function rowShapeClass(active: boolean): string;
1085
1133
  declare function SessionBrowser({ rows, config, onConfigChange, scope, activeId, activeSubagentId, onSelect, onDelete, onRename, onClearContext, onSelectSubagent, emptyState, showControls, projectIcons, className }: SessionBrowserProps): import("react").JSX.Element;
1086
1134
  //#endregion
1087
1135
  //#region src/components/agent/SessionItem.d.ts
1136
+ type SelectModifiers = {
1137
+ meta: boolean;
1138
+ ctrl: boolean;
1139
+ alt: boolean;
1140
+ };
1088
1141
  interface SessionItemProps {
1089
1142
  row: SessionRow;
1090
1143
  active?: boolean;
@@ -1094,7 +1147,7 @@ interface SessionItemProps {
1094
1147
  projectIcons?: Record<string, string>;
1095
1148
  expanded?: boolean;
1096
1149
  onExpandedChange?: (expanded: boolean) => void;
1097
- onSelect?: () => void;
1150
+ onSelect?: (modifiers: SelectModifiers) => void;
1098
1151
  onSelectSubagent?: (toolUseId: string) => void;
1099
1152
  onRename?: (title: string) => void;
1100
1153
  renameOn?: 'doubleClick' | 'external';
@@ -1200,5 +1253,5 @@ declare function copyText(value: string): Promise<boolean>;
1200
1253
  declare function toolIcon(toolName: string): LucideIcon;
1201
1254
  declare function isMutatingTool(toolName: string): boolean;
1202
1255
  //#endregion
1203
- export { AlertDialog, AlertDialogClose, AlertDialogContent, AlertDialogDescription, AlertDialogTitle, AlertDialogTrigger, type ApprovalPromptProps, Badge, type BadgeProps, Band, Blank, Button, type ButtonProps, Card, CardContent, CardHeader, CardTitle, type ChipSegment, CodeBlock, type CodeBlockProps, Composer, type ComposerFileMatch, type ComposerHandle, type ComposerProps, ContextDialog, type ContextDialogProps, ContextRing, Conversation, ConversationContent, type ConversationProps, ConversationScrollButton, CopyAction, CopyButton, type CopyButtonProps, Dialog, DialogBody, DialogClose, DialogContent, DialogHeader, DialogRow, DialogTrigger, Empty, EmptyKey, EngineIcon, FileCard, type FileCardProps, type FileDeliveredItem, HostFilesDialog, type HostFilesDialogProps, Ink, Input, Loader, McpDialog, type McpDialogProps, Menu, MenuContent, MenuItem, MenuSeparator, MenuTrigger, Message, MessageContent, type MessageProps, ModelSelect, type ModelSelectProps, PERMISSION_MODES, type PermissionModeChoice, type PermissionModeMeta, PermissionModeSelect, type PermissionModeSelectProps, PermissionPrompt, type PermissionPromptProps, ProgressRing, type ProgressRingProps, ProjectIcon, PromptArea, type PromptAreaHandle, type PromptAreaProps, PromptTokenText, QUESTION_BEHAVIORS, type QuestionBehaviorMeta, QuestionPrompt, type QuestionPromptProps, Reasoning, type ReasoningProps, Response, type ResponseProps, Row, type RowProps, STATUS_META, type Segment, Select, SelectContent, SelectItem, SelectItemText, SelectTrigger, SelectValue, SessionBrowser, type SessionBrowserProps, type SessionControls, SessionEmptyState, type SessionEmptyStateProps, SessionInfoDialog, type SessionInfoDialogProps, SessionItem, type SessionItemProps, SessionList, SessionListItem, type SessionListItemProps, type SessionListProps, SessionPanel, type SessionPanelProps, SessionStatusIcon, type SessionSurfacePanel, type SessionVitals, SkillsDialog, type SkillsDialogProps, Spinner, Splitter, type SplitterProps, StatusBar, type StatusBarProps, type Step, StepRow, StepToggle, SubagentStrip, TaskList, type TaskListProps, TasksDialog, type TasksDialogProps, type TerminalAffordances, TerminalDiff, TerminalItemView, TerminalMarkdown, type TerminalMarkdownProps, type TerminalMetrics, TerminalPermissionPrompt, type TerminalPermissionPromptProps, TerminalQuestionPrompt, type TerminalQuestionPromptProps, TerminalStatusLine, type TerminalStatusLineProps, TerminalSurface, type TerminalSurfaceProps, TerminalTranscript, type TerminalTranscriptProps, type TextSegment, Textarea, Tip, Toaster, type Tone, ToolCallCard, type ToolCallCardProps, type ToolCallItem, ToolTitleProvider, TooltipContent, TooltipProvider, Transcript, type TranscriptDensity, TranscriptDensityProvider, type TranscriptFont, type TranscriptProps, type TranscriptVariant, TranscriptVariantProvider, type TriggerConfig, type TriggerSuggestion, UsageDialog, type UsageDialogProps, UsageMeters, WithActions, badgeVariants, buttonVariants, cn, commandTrigger, copyText, engineMark, formatAgoPrecise, formatBytes, formatCost, formatCountdown, formatDuration, formatRateLimitWindow, formatRateLimitWindowLong, formatRelativeTime, formatTokens, friendlyModel, getChipsByTrigger, hashtagTrigger, isMutatingTool, isSegmentsEmpty, launchTrigger, mentionTrigger, parseUserQuestions, permissionModeChoices, permissionModeMeta, plainTextToSegments, previewPatch, rateLimitWindowSeconds, rowShapeClass, runningSteps, segmentsToPlainText, sessionSteps, skillPrompt, toast, toolIcon, toolInputPreview, useAffordances, useMinuteClock, usePromptAreaState, useToolTitle, useTranscriptDensity, useTranscriptVariant, vendorMarkClass, vendorTextClass };
1256
+ export { AlertDialog, AlertDialogClose, AlertDialogContent, AlertDialogDescription, AlertDialogTitle, AlertDialogTrigger, type ApprovalPromptProps, Badge, type BadgeProps, Band, Blank, Button, type ButtonProps, Card, CardContent, CardHeader, CardTitle, type ChipSegment, type ClientCommand, CodeBlock, type CodeBlockProps, Composer, type ComposerFileMatch, type ComposerHandle, type ComposerProps, type ComposerRow, ContextDialog, type ContextDialogProps, ContextRing, Conversation, ConversationContent, type ConversationProps, ConversationScrollButton, CopyAction, CopyButton, type CopyButtonProps, Dialog, DialogBody, DialogClose, DialogContent, DialogHeader, DialogRow, DialogTrigger, Empty, EmptyKey, EngineIcon, FileCard, type FileCardProps, type FileDeliveredItem, type FileLink, type FileLinkHandle, type FileLinkOpener, FileLinkProvider, HostFilesDialog, type HostFilesDialogProps, Ink, Input, Loader, McpDialog, type McpDialogProps, Menu, MenuContent, MenuItem, MenuSeparator, MenuTrigger, Message, MessageContent, type MessageProps, ModelSelect, type ModelSelectProps, PERMISSION_MODES, type PathHit, type PathMatch, type PermissionModeChoice, type PermissionModeMeta, PermissionModeSelect, type PermissionModeSelectProps, PermissionPrompt, type PermissionPromptProps, ProgressRing, type ProgressRingProps, ProjectIcon, PromptArea, type PromptAreaHandle, type PromptAreaProps, PromptTokenText, QUESTION_BEHAVIORS, type QuestionBehaviorMeta, QuestionPrompt, type QuestionPromptProps, Reasoning, type ReasoningProps, Response, type ResponseProps, Row, type RowProps, STATUS_META, type Segment, Select, SelectContent, SelectItem, SelectItemText, type SelectModifiers, SelectTrigger, SelectValue, SessionBrowser, type SessionBrowserProps, type SessionControls, SessionEmptyState, type SessionEmptyStateProps, SessionInfoDialog, type SessionInfoDialogProps, SessionItem, type SessionItemProps, SessionList, SessionListItem, type SessionListItemProps, type SessionListProps, SessionPanel, type SessionPanelProps, SessionStatusIcon, type SessionSurfacePanel, type SessionVitals, SkillsDialog, type SkillsDialogProps, Spinner, Splitter, type SplitterProps, StatusBar, type StatusBarProps, type Step, StepRow, StepToggle, SubagentStrip, TaskList, type TaskListProps, TasksDialog, type TasksDialogProps, type TerminalAffordances, TerminalDiff, TerminalItemView, TerminalMarkdown, type TerminalMarkdownProps, type TerminalMetrics, TerminalPermissionPrompt, type TerminalPermissionPromptProps, TerminalQuestionPrompt, type TerminalQuestionPromptProps, TerminalStatusLine, type TerminalStatusLineProps, TerminalSurface, type TerminalSurfaceProps, TerminalTranscript, type TerminalTranscriptProps, type TextSegment, Textarea, Tip, Toaster, type Tone, ToolCallCard, type ToolCallCardProps, type ToolCallItem, ToolTitleProvider, TooltipContent, TooltipProvider, Transcript, type TranscriptDensity, TranscriptDensityProvider, type TranscriptFont, type TranscriptProps, type TranscriptVariant, TranscriptVariantProvider, type TriggerConfig, type TriggerSuggestion, UsageDialog, type UsageDialogProps, UsageMeters, WithActions, badgeVariants, buttonVariants, cn, commandTrigger, copyText, engineMark, formatAgoPrecise, formatBytes, formatCost, formatCountdown, formatDuration, formatRateLimitWindow, formatRateLimitWindowLong, formatRelativeTime, formatTokens, friendlyModel, getChipsByTrigger, hashtagTrigger, isMutatingTool, isSegmentsEmpty, launchTrigger, matchClientCommand, matchPath, mentionTrigger, mergeComposerRows, parseFileLink, parseUserQuestions, permissionModeChoices, permissionModeMeta, plainTextToSegments, previewPatch, rankComposerRows, rateLimitWindowSeconds, resolveAgainstCwd, rowShapeClass, runningSteps, segmentsToPlainText, sessionSteps, skillPrompt, toast, toolIcon, toolInputPreview, useAffordances, useFileLinks, useMinuteClock, usePathLinks, usePromptAreaState, useToolTitle, useTranscriptDensity, useTranscriptVariant, vendorMarkClass, vendorTextClass };
1204
1257
  //# sourceMappingURL=index.d.mts.map
package/build/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as Ink, A as PERMISSION_MODES, At as DialogContent, B as TaskList, Bt as SelectContent, C as TerminalPermissionPrompt, Ct as copyText, D as SubagentStrip, Dt as Dialog, E as parseUserQuestions, Et as TooltipProvider, F as SkillsDialog, Ft as MenuContent, G as TerminalSurface, Gt as PortalScope, H as contextNote, Ht as SelectItemText, I as McpDialog, It as MenuItem, J as TerminalMarkdown, Jt as Badge, K as ToolTitleProvider, Kt as Textarea, L as HostFilesDialog, Lt as MenuSeparator, M as permissionModeChoices, Mt as DialogRow, N as permissionModeMeta, Nt as DialogTrigger, O as PermissionPrompt, Ot as DialogBody, P as ModelSelect, Pt as Menu, Q as Blank, Qt as cn, Rt as MenuTrigger, S as TerminalQuestionPrompt, St as CopyButton, T as QuestionPrompt, Tt as TooltipContent, U as Composer, Ut as SelectTrigger, V as ContextDialog, Vt as SelectItem, W as skillPrompt, Wt as SelectValue, X as previewPatch, Xt as Button, Y as TerminalDiff, Yt as badgeVariants, Z as Band, Zt as buttonVariants, _ as ConversationContent, _t as segmentsToPlainText, a as Transcript, at as toolIcon, b as STATUS_META, bt as CodeBlock, c as PromptTokenText, ct as useTranscriptDensity, d as FileCard, dt as hashtagTrigger, et as Row, f as TerminalItemView, ft as launchTrigger, g as Conversation, gt as plainTextToSegments, h as Loader, ht as PromptArea, i as useMinuteClock, it as isMutatingTool, j as PermissionModeSelect, jt as DialogHeader, k as Response, kt as DialogClose, l as Message, lt as useTranscriptVariant, m as SessionEmptyState, mt as usePromptAreaState, n as UsageDialog, nt as WithActions, o as ToolCallCard, ot as TranscriptDensityProvider, p as TerminalTranscript, pt as mentionTrigger, q as useToolTitle, qt as Input, r as UsageMeters, rt as useAffordances, s as Reasoning, st as TranscriptVariantProvider, t as SessionPanel, tt as CopyAction, u as MessageContent, ut as commandTrigger, v as ConversationScrollButton, vt as ProgressRing, w as QUESTION_BEHAVIORS, wt as Tip, x as SessionInfoDialog, xt as Spinner, y as StatusBar, yt as Splitter, z as TasksDialog, zt as Select } from "./SessionPanel-Dg4xf-ql.mjs";
1
+ import { $ as TerminalDiff, $t as SelectValue, A as PermissionPrompt, At as Spinner, Bt as DialogHeader, C as SessionInfoDialog, Ct as usePromptAreaState, D as QuestionPrompt, Dt as ProgressRing, E as QUESTION_BEHAVIORS, Et as segmentsToPlainText, F as permissionModeMeta, Ft as TooltipProvider, G as Composer, Gt as MenuItem, H as TaskList, Ht as DialogTrigger, I as ModelSelect, It as Dialog, J as useToolTitle, Jt as Select, K as TerminalSurface, Kt as MenuSeparator, L as SkillsDialog, Lt as DialogBody, M as PERMISSION_MODES, Mt as copyText, N as PermissionModeSelect, Nt as Tip, O as parseUserQuestions, Ot as Splitter, P as permissionModeChoices, Pt as TooltipContent, Q as parseFileLink, Qt as SelectTrigger, R as McpDialog, Rt as DialogClose, S as STATUS_META, St as mentionTrigger, T as TerminalPermissionPrompt, Tt as plainTextToSegments, U as ContextDialog, Ut as Menu, V as TasksDialog, Vt as DialogRow, W as contextNote, Wt as MenuContent, X as FileLinkProvider, Xt as SelectItem, Y as TerminalMarkdown, Yt as SelectContent, Z as useFileLinks, Zt as SelectItemText, _ as Loader, _t as rankComposerRows, a as UsageDialog, an as Button, at as CopyAction, b as ConversationScrollButton, bt as hashtagTrigger, c as Transcript, ct as PromptTokenText, d as Message, dt as TranscriptDensityProvider, en as PortalScope, et as previewPatch, f as MessageContent, ft as TranscriptVariantProvider, g as SessionEmptyState, gt as mergeComposerRows, h as TerminalTranscript, ht as matchClientCommand, i as SessionPanel, in as badgeVariants, it as Row, j as Response, jt as CopyButton, k as SubagentStrip, kt as CodeBlock, l as ToolCallCard, lt as isMutatingTool, m as TerminalItemView, mt as useTranscriptVariant, n as usePathLinks, nn as Input, nt as Blank, o as UsageMeters, on as buttonVariants, ot as WithActions, p as FileCard, pt as useTranscriptDensity, q as ToolTitleProvider, qt as MenuTrigger, r as matchPath, rn as Badge, rt as Ink, s as useMinuteClock, sn as cn, st as useAffordances, t as resolveAgainstCwd, tn as Textarea, tt as Band, u as Reasoning, ut as toolIcon, v as Conversation, vt as skillPrompt, w as TerminalQuestionPrompt, wt as PromptArea, x as StatusBar, xt as launchTrigger, y as ConversationContent, yt as commandTrigger, z as HostFilesDialog, zt as DialogContent } from "./use-path-links-CvcxdUXL.mjs";
2
2
  import { C as rateLimitWindowSeconds, S as friendlyModel, _ as formatDuration, b as formatRelativeTime, c as tightestWindow, g as formatCountdown, h as formatCost, i as meterSeverity, m as formatBytes, o as modelLabel, p as formatAgoPrecise, r as meterColorClass, s as statusPresentation, t as contextSeverity, u as windowLabel, v as formatRateLimitWindow, w as toolInputPreview, x as formatTokens, y as formatRateLimitWindowLong } from "./status-kmsBhuFG.mjs";
3
3
  import { Fragment, useEffect, useMemo, useRef, useState } from "react";
4
4
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -172,9 +172,10 @@ function TerminalStatusLine({ className, state, rateLimits, connection, onOpenSt
172
172
  windowLabel(window.key)
173
173
  ]
174
174
  }, "usage"));
175
- if (state.totalCostUsd > 0) parts.push(/* @__PURE__ */ jsx(Ink, {
175
+ const costUsd = state.costUsd ?? (state.totalCostUsd || void 0);
176
+ if (costUsd !== void 0 && costUsd > 0) parts.push(/* @__PURE__ */ jsx(Ink, {
176
177
  tone: "faint",
177
- children: formatCost(state.totalCostUsd)
178
+ children: formatCost(costUsd)
178
179
  }, "cost"));
179
180
  if (model) parts.push(/* @__PURE__ */ jsx(Ink, {
180
181
  tone: "faint",
@@ -230,7 +231,7 @@ function SessionListItem({ session, active, onSelect, onDelete, className }) {
230
231
  }) : null,
231
232
  /* @__PURE__ */ jsx("span", {
232
233
  className: "shrink-0",
233
- children: formatCost(session.totalCostUsd)
234
+ children: formatCost(session.costUsd ?? session.totalCostUsd)
234
235
  }),
235
236
  /* @__PURE__ */ jsx("span", {
236
237
  className: "shrink-0",
@@ -587,6 +588,11 @@ function StepIcon({ state }) {
587
588
  }
588
589
  //#endregion
589
590
  //#region src/components/agent/SessionItem.tsx
591
+ const NO_MODIFIERS = {
592
+ meta: false,
593
+ ctrl: false,
594
+ alt: false
595
+ };
590
596
  function SessionItem({ row, active = false, activeStepKey, showGateway, showProject = true, projectIcons, expanded, onExpandedChange, onSelect, onSelectSubagent, onRename, renameOn = "doubleClick", editing, onEditingChange, actions, className }) {
591
597
  const { info } = row;
592
598
  const [ownExpanded, setOwnExpanded] = useState(false);
@@ -605,7 +611,7 @@ function SessionItem({ row, active = false, activeStepKey, showGateway, showProj
605
611
  const project = showProject ? projectLabel(row) : projectSubpath(row);
606
612
  const projectIcon = showProject ? info.project?.icon : void 0;
607
613
  const iconSrc = projectIcon?.type === "image" ? projectIcons?.[projectIcon.hash] : void 0;
608
- const cost = formatCost(info.totalCostUsd);
614
+ const cost = formatCost(info.costUsd ?? info.totalCostUsd);
609
615
  const extras = [
610
616
  showGateway ? row.hostName : void 0,
611
617
  info.profile ? `@${info.profile}` : void 0,
@@ -624,7 +630,7 @@ function SessionItem({ row, active = false, activeStepKey, showGateway, showProj
624
630
  className: "mr-1.5 size-4 align-[-0.3em]"
625
631
  }), project] }, "project"));
626
632
  for (const extra of extras) parts.push(/* @__PURE__ */ jsx("span", { children: extra }, extra));
627
- const steps = sessionSteps(info, (toolUseId) => onSelectSubagent ? onSelectSubagent(toolUseId) : onSelect?.());
633
+ const steps = sessionSteps(info, (toolUseId) => onSelectSubagent ? onSelectSubagent(toolUseId) : onSelect?.(NO_MODIFIERS));
628
634
  const holdsOpenAgent = steps.some((s) => s.key === activeStepKey);
629
635
  return /* @__PURE__ */ jsxs("div", {
630
636
  "data-slot": "session-item",
@@ -633,13 +639,21 @@ function SessionItem({ row, active = false, activeStepKey, showGateway, showProj
633
639
  tabIndex: 0,
634
640
  onClick: (e) => {
635
641
  if (e.detail > 1 || isEditing) return;
636
- onSelect?.();
642
+ onSelect?.({
643
+ meta: e.metaKey,
644
+ ctrl: e.ctrlKey,
645
+ alt: e.altKey
646
+ });
637
647
  },
638
648
  onKeyDown: (e) => {
639
649
  if (e.target !== e.currentTarget) return;
640
650
  if (e.key === "Enter" || e.key === " ") {
641
651
  e.preventDefault();
642
- onSelect?.();
652
+ onSelect?.({
653
+ meta: e.metaKey,
654
+ ctrl: e.ctrlKey,
655
+ alt: e.altKey
656
+ });
643
657
  }
644
658
  },
645
659
  className: cn("group flex w-full cursor-pointer flex-col p-1 text-left outline-none", "rounded-[4px] transition-colors focus-visible:ring-2 focus-visible:ring-ring", holdsOpenAgent ? "bg-row-selected-weak" : active ? "bg-row-selected" : "hover:bg-row-hover", className),
@@ -666,7 +680,7 @@ function SessionItem({ row, active = false, activeStepKey, showGateway, showProj
666
680
  }),
667
681
  row.unseen > 0 ? /* @__PURE__ */ jsx("span", {
668
682
  title: `${row.unseen} new message${row.unseen === 1 ? "" : "s"}`,
669
- className: cn("flex h-4 min-w-6 shrink-0 items-center justify-center rounded-full px-2", "text-[0.75rem] leading-none tracking-[-0.005em] tabular-nums", row.state === "working" || row.state === "attention" ? "bg-accent text-accent-fg" : "bg-badge text-badge-fg"),
683
+ className: cn("flex h-4 min-w-6 shrink-0 items-center justify-center rounded-full px-2", "text-[0.75rem] leading-none tracking-[-0.005em] tabular-nums", row.state === "working" ? "bg-badge text-badge-fg" : "bg-accent text-accent-fg"),
670
684
  children: row.unseen
671
685
  }) : null,
672
686
  /* @__PURE__ */ jsx(ContextRing, {
@@ -1080,6 +1094,6 @@ function OneOfSelect({ label, value, options, onChange }) {
1080
1094
  });
1081
1095
  }
1082
1096
  //#endregion
1083
- export { AlertDialog, AlertDialogClose, AlertDialogContent, AlertDialogDescription, AlertDialogTitle, AlertDialogTrigger, Badge, Band, Blank, Button, Card, CardContent, CardHeader, CardTitle, CodeBlock, Composer, ContextDialog, ContextRing, Conversation, ConversationContent, ConversationScrollButton, CopyAction, CopyButton, Dialog, DialogBody, DialogClose, DialogContent, DialogHeader, DialogRow, DialogTrigger, Empty, EmptyKey, EngineIcon, FileCard, HostFilesDialog, Ink, Input, Loader, McpDialog, Menu, MenuContent, MenuItem, MenuSeparator, MenuTrigger, Message, MessageContent, ModelSelect, PERMISSION_MODES, PermissionModeSelect, PermissionPrompt, ProgressRing, ProjectIcon, PromptArea, PromptTokenText, QUESTION_BEHAVIORS, QuestionPrompt, Reasoning, Response, Row, STATUS_META, Select, SelectContent, SelectItem, SelectItemText, SelectTrigger, SelectValue, SessionBrowser, SessionEmptyState, SessionInfoDialog, SessionItem, SessionList, SessionListItem, SessionPanel, SessionStatusIcon, SkillsDialog, Spinner, Splitter, StatusBar, StepRow, StepToggle, SubagentStrip, TaskList, TasksDialog, TerminalDiff, TerminalItemView, TerminalMarkdown, TerminalPermissionPrompt, TerminalQuestionPrompt, TerminalStatusLine, TerminalSurface, TerminalTranscript, Textarea, Tip, Toaster, ToolCallCard, ToolTitleProvider, TooltipContent, TooltipProvider, Transcript, TranscriptDensityProvider, TranscriptVariantProvider, UsageDialog, UsageMeters, WithActions, badgeVariants, buttonVariants, cn, commandTrigger, copyText, engineMark, formatAgoPrecise, formatBytes, formatCost, formatCountdown, formatDuration, formatRateLimitWindow, formatRateLimitWindowLong, formatRelativeTime, formatTokens, friendlyModel, getChipsByTrigger, hashtagTrigger, isMutatingTool, isSegmentsEmpty, launchTrigger, mentionTrigger, parseUserQuestions, permissionModeChoices, permissionModeMeta, plainTextToSegments, previewPatch, rateLimitWindowSeconds, rowShapeClass, runningSteps, segmentsToPlainText, sessionSteps, skillPrompt, toast, toolIcon, toolInputPreview, useAffordances, useMinuteClock, usePromptAreaState, useToolTitle, useTranscriptDensity, useTranscriptVariant, vendorMarkClass, vendorTextClass };
1097
+ export { AlertDialog, AlertDialogClose, AlertDialogContent, AlertDialogDescription, AlertDialogTitle, AlertDialogTrigger, Badge, Band, Blank, Button, Card, CardContent, CardHeader, CardTitle, CodeBlock, Composer, ContextDialog, ContextRing, Conversation, ConversationContent, ConversationScrollButton, CopyAction, CopyButton, Dialog, DialogBody, DialogClose, DialogContent, DialogHeader, DialogRow, DialogTrigger, Empty, EmptyKey, EngineIcon, FileCard, FileLinkProvider, HostFilesDialog, Ink, Input, Loader, McpDialog, Menu, MenuContent, MenuItem, MenuSeparator, MenuTrigger, Message, MessageContent, ModelSelect, PERMISSION_MODES, PermissionModeSelect, PermissionPrompt, ProgressRing, ProjectIcon, PromptArea, PromptTokenText, QUESTION_BEHAVIORS, QuestionPrompt, Reasoning, Response, Row, STATUS_META, Select, SelectContent, SelectItem, SelectItemText, SelectTrigger, SelectValue, SessionBrowser, SessionEmptyState, SessionInfoDialog, SessionItem, SessionList, SessionListItem, SessionPanel, SessionStatusIcon, SkillsDialog, Spinner, Splitter, StatusBar, StepRow, StepToggle, SubagentStrip, TaskList, TasksDialog, TerminalDiff, TerminalItemView, TerminalMarkdown, TerminalPermissionPrompt, TerminalQuestionPrompt, TerminalStatusLine, TerminalSurface, TerminalTranscript, Textarea, Tip, Toaster, ToolCallCard, ToolTitleProvider, TooltipContent, TooltipProvider, Transcript, TranscriptDensityProvider, TranscriptVariantProvider, UsageDialog, UsageMeters, WithActions, badgeVariants, buttonVariants, cn, commandTrigger, copyText, engineMark, formatAgoPrecise, formatBytes, formatCost, formatCountdown, formatDuration, formatRateLimitWindow, formatRateLimitWindowLong, formatRelativeTime, formatTokens, friendlyModel, getChipsByTrigger, hashtagTrigger, isMutatingTool, isSegmentsEmpty, launchTrigger, matchClientCommand, matchPath, mentionTrigger, mergeComposerRows, parseFileLink, parseUserQuestions, permissionModeChoices, permissionModeMeta, plainTextToSegments, previewPatch, rankComposerRows, rateLimitWindowSeconds, resolveAgainstCwd, rowShapeClass, runningSteps, segmentsToPlainText, sessionSteps, skillPrompt, toast, toolIcon, toolInputPreview, useAffordances, useFileLinks, useMinuteClock, usePathLinks, usePromptAreaState, useToolTitle, useTranscriptDensity, useTranscriptVariant, vendorMarkClass, vendorTextClass };
1084
1098
 
1085
1099
  //# sourceMappingURL=index.mjs.map