@workerdeck/ui 2.2.1 → 2.4.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-ErvQUyHe.mjs → SessionPanel-B5FfiBxE.mjs} +45 -41
- package/build/SessionPanel-B5FfiBxE.mjs.map +1 -0
- package/build/{SessionPanel-My98j9RZ.d.mts → SessionPanel-_lQLhWOw.d.mts} +11 -5
- package/build/{format-TVRJzYUj.d.mts → format-eS_oUry-.d.mts} +9 -2
- package/build/format.d.mts +2 -2
- package/build/format.mjs +2 -2
- package/build/index.d.mts +5 -8
- package/build/index.mjs +3 -12
- package/build/index.mjs.map +1 -1
- package/build/scoped.css +13 -0
- package/build/{status-C4TAgVSc.mjs → status-BO9wJloK.mjs} +13 -2
- package/build/status-BO9wJloK.mjs.map +1 -0
- package/build/workspace.d.mts +1 -1
- package/build/workspace.mjs +2 -2
- package/package.json +4 -4
- package/src/components/agent/Loader.tsx +0 -2
- package/src/components/agent/QuestionPrompt.tsx +10 -26
- package/src/components/agent/SessionPanel.tsx +27 -1
- package/src/components/agent/Transcript.tsx +1 -5
- package/src/components/agent/TranscriptItemView.tsx +6 -4
- package/src/components/terminal/PermissionPrompt.tsx +5 -1
- package/src/components/terminal/QuestionPrompt.tsx +5 -1
- package/src/components/terminal/TerminalTranscript.tsx +1 -1
- package/src/components/terminal/height.ts +2 -2
- package/src/components/terminal/items.tsx +5 -4
- package/src/components/terminal/prompt.tsx +6 -2
- package/src/index.ts +1 -0
- package/src/lib/format.ts +25 -0
- package/src/styles/terminal.css +24 -2
- package/build/SessionPanel-ErvQUyHe.mjs.map +0 -1
- package/build/status-C4TAgVSc.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as rateLimitWindowSeconds, _ as formatDuration, a as meterTintClass, b as formatRelativeTime, f as compactionText, g as formatCountdown, h as formatCost, m as formatBytes, p as formatAgoPrecise, r as meterColorClass, w as toolInputPreview, x as formatTokens, y as formatRateLimitWindowLong } from "./status-BO9wJloK.mjs";
|
|
2
2
|
import { Fragment, createContext, forwardRef, memo, useCallback, useContext, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
4
|
import { clsx } from "clsx";
|
|
@@ -9,7 +9,7 @@ import { ArrowDown, ArrowDownCircle, ArrowLeft, ArrowRight, ArrowUp, AtSign, Bra
|
|
|
9
9
|
import { Menu } from "@base-ui/react/menu";
|
|
10
10
|
import { Dialog } from "@base-ui/react/dialog";
|
|
11
11
|
import { Tooltip } from "@base-ui/react/tooltip";
|
|
12
|
-
import { PROTOCOL_VERSION, mergeUsage, orderUsageWindows, parseTodoWriteInput, sessionTasks, subagentLabel, taskCountLabel, taskSummary, toolTitle, usageInfos, visibleTasks } from "@workerdeck/protocol";
|
|
12
|
+
import { PROTOCOL_VERSION, mergeUsage, orderUsageWindows, parseTodoWriteInput, parseUserQuestions, sessionTasks, subagentLabel, taskCountLabel, taskSummary, toolTitle, usageInfos, visibleTasks } from "@workerdeck/protocol";
|
|
13
13
|
import { recapLine, scanPromptTokens, summarizeSince, useAttachments, useClaudeSession, useDraft, useHostFileSearch, useProfileUsage, useToolCallHost } from "@workerdeck/react";
|
|
14
14
|
import { Streamdown } from "streamdown";
|
|
15
15
|
import { StickToBottom, useStickToBottomContext } from "use-stick-to-bottom";
|
|
@@ -117,6 +117,15 @@ const Input = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("
|
|
|
117
117
|
}));
|
|
118
118
|
Input.displayName = "Input";
|
|
119
119
|
//#endregion
|
|
120
|
+
//#region src/components/ui/Textarea.tsx
|
|
121
|
+
const Textarea = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("textarea", {
|
|
122
|
+
ref,
|
|
123
|
+
"data-slot": "textarea",
|
|
124
|
+
className: cn("w-full resize-none rounded-md border border-border bg-bg px-2.5 py-2 text-body-sm text-text", "placeholder:text-fg-4 transition-colors outline-none", "hover:border-border-strong focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/40", "disabled:pointer-events-none disabled:opacity-50", className),
|
|
125
|
+
...props
|
|
126
|
+
}));
|
|
127
|
+
Textarea.displayName = "Textarea";
|
|
128
|
+
//#endregion
|
|
120
129
|
//#region src/components/ui/PortalScope.tsx
|
|
121
130
|
const PortalScope = ({ children }) => /* @__PURE__ */ jsx("div", {
|
|
122
131
|
className: "wd-root",
|
|
@@ -5451,12 +5460,13 @@ function TurnResultRow$1({ item }) {
|
|
|
5451
5460
|
children: message
|
|
5452
5461
|
}, index))] });
|
|
5453
5462
|
}
|
|
5454
|
-
function CompactionRow$1() {
|
|
5463
|
+
function CompactionRow$1({ item }) {
|
|
5464
|
+
const failed = item.error !== void 0;
|
|
5455
5465
|
return /* @__PURE__ */ jsx(Row, {
|
|
5456
|
-
glyph: "≡",
|
|
5457
|
-
glyphTone: "yellow",
|
|
5458
|
-
tone: "faint",
|
|
5459
|
-
children:
|
|
5466
|
+
glyph: item.pending ? "⋯" : "≡",
|
|
5467
|
+
glyphTone: failed ? "red" : "yellow",
|
|
5468
|
+
tone: failed ? "red" : "faint",
|
|
5469
|
+
children: compactionText(item)
|
|
5460
5470
|
});
|
|
5461
5471
|
}
|
|
5462
5472
|
function NoticeRow$1({ item }) {
|
|
@@ -7322,20 +7332,6 @@ const QUESTION_BEHAVIORS = [
|
|
|
7322
7332
|
description: "the agent is told to decide on its own"
|
|
7323
7333
|
}
|
|
7324
7334
|
];
|
|
7325
|
-
function parseUserQuestions(input) {
|
|
7326
|
-
return (Array.isArray(input.questions) ? input.questions : []).flatMap((entry) => {
|
|
7327
|
-
const q = entry;
|
|
7328
|
-
if (typeof q.question !== "string" || !Array.isArray(q.options)) return [];
|
|
7329
|
-
const options = q.options.filter((o) => typeof o?.label === "string");
|
|
7330
|
-
if (options.length === 0) return [];
|
|
7331
|
-
return [{
|
|
7332
|
-
question: q.question,
|
|
7333
|
-
header: typeof q.header === "string" ? q.header : "",
|
|
7334
|
-
options,
|
|
7335
|
-
multiSelect: q.multiSelect === true
|
|
7336
|
-
}];
|
|
7337
|
-
});
|
|
7338
|
-
}
|
|
7339
7335
|
const EMPTY_SELECTION = {
|
|
7340
7336
|
labels: [],
|
|
7341
7337
|
other: "",
|
|
@@ -7426,12 +7422,13 @@ function QuestionPrompt({ request, onAnswer, onDismiss, className }) {
|
|
|
7426
7422
|
onClick: () => update(index, { otherActive: !selection.otherActive }),
|
|
7427
7423
|
className: cn("shrink-0 rounded-md border px-2.5 py-1.5 text-body-sm font-medium transition-colors", selection.otherActive ? "border-info bg-bg text-fg-1" : "border-border bg-bg/50 text-fg-3 hover:border-border-strong hover:bg-bg"),
|
|
7428
7424
|
children: "Other…"
|
|
7429
|
-
}), selection.otherActive ? /* @__PURE__ */ jsx(
|
|
7425
|
+
}), selection.otherActive ? /* @__PURE__ */ jsx(Textarea, {
|
|
7430
7426
|
autoFocus: true,
|
|
7427
|
+
rows: 1,
|
|
7431
7428
|
value: selection.other,
|
|
7432
7429
|
onChange: (e) => update(index, { other: e.target.value }),
|
|
7433
7430
|
placeholder: "Type your own answer",
|
|
7434
|
-
className: "flex-1"
|
|
7431
|
+
className: "max-h-40 flex-1 overflow-y-auto py-1.5 field-sizing-content"
|
|
7435
7432
|
}) : null]
|
|
7436
7433
|
})]
|
|
7437
7434
|
})]
|
|
@@ -7575,13 +7572,14 @@ function PromptInput({ value, onChange, onSubmit, onCancel, placeholder }) {
|
|
|
7575
7572
|
columns: 5,
|
|
7576
7573
|
glyph: " ›",
|
|
7577
7574
|
glyphTone: "dim",
|
|
7578
|
-
children: /* @__PURE__ */ jsx("
|
|
7575
|
+
children: /* @__PURE__ */ jsx("textarea", {
|
|
7579
7576
|
autoFocus: true,
|
|
7577
|
+
rows: 1,
|
|
7580
7578
|
value,
|
|
7581
7579
|
placeholder,
|
|
7582
7580
|
onChange: (event) => onChange(event.target.value),
|
|
7583
7581
|
onKeyDown: (event) => {
|
|
7584
|
-
if (event.key === "Enter") {
|
|
7582
|
+
if (event.key === "Enter" && !event.shiftKey && !event.nativeEvent.isComposing) {
|
|
7585
7583
|
event.preventDefault();
|
|
7586
7584
|
onSubmit();
|
|
7587
7585
|
}
|
|
@@ -7722,7 +7720,7 @@ function TerminalPermissionPrompt({ request, onApprove, onDeny, className }) {
|
|
|
7722
7720
|
}
|
|
7723
7721
|
}),
|
|
7724
7722
|
/* @__PURE__ */ jsx(Blank, {}),
|
|
7725
|
-
/* @__PURE__ */ jsx(Hint, { children: "Enter to select · ↑/↓ to navigate · 1–3 to choose · Esc to cancel" })
|
|
7723
|
+
/* @__PURE__ */ jsx(Hint, { children: denying ? "Enter to send · Shift+Enter for a new line · Esc to go back" : "Enter to select · ↑/↓ to navigate · 1–3 to choose · Esc to cancel" })
|
|
7726
7724
|
]
|
|
7727
7725
|
});
|
|
7728
7726
|
}
|
|
@@ -7827,7 +7825,7 @@ function TerminalQuestionPrompt({ request, onAnswer, onDismiss, className }) {
|
|
|
7827
7825
|
onDismiss: dismiss
|
|
7828
7826
|
}, tab),
|
|
7829
7827
|
/* @__PURE__ */ jsx(Blank, {}),
|
|
7830
|
-
/* @__PURE__ */ jsx(Hint, { children: "Enter to select · ↑/↓ to navigate · Tab to switch questions · Esc to cancel" })
|
|
7828
|
+
/* @__PURE__ */ jsx(Hint, { children: !review && selection.otherActive ? "Enter to submit · Shift+Enter for a new line · Tab to switch questions · Esc to cancel" : "Enter to select · ↑/↓ to navigate · Tab to switch questions · Esc to cancel" })
|
|
7831
7829
|
]
|
|
7832
7830
|
});
|
|
7833
7831
|
}
|
|
@@ -9021,7 +9019,7 @@ function itemHeight(item, m) {
|
|
|
9021
9019
|
return acc;
|
|
9022
9020
|
}
|
|
9023
9021
|
case "notice": return rowH(item.text, m, { extraPx });
|
|
9024
|
-
case "compaction": return rowH(
|
|
9022
|
+
case "compaction": return rowH(compactionText(item), m, { extraPx });
|
|
9025
9023
|
case "file_delivered": return rowH(`${item.path} · ${formatBytes(item.bytes)}` + (item.description ? ` · ${item.description}` : ""), m, { extraPx });
|
|
9026
9024
|
default: return {
|
|
9027
9025
|
px: 0,
|
|
@@ -9949,7 +9947,7 @@ function TerminalItemView({ item, fileUrl }) {
|
|
|
9949
9947
|
case "tool_call": return /* @__PURE__ */ jsx(ToolRow, { item });
|
|
9950
9948
|
case "turn_result": return /* @__PURE__ */ jsx(TurnResultRow$1, { item });
|
|
9951
9949
|
case "notice": return /* @__PURE__ */ jsx(NoticeRow$1, { item });
|
|
9952
|
-
case "compaction": return /* @__PURE__ */ jsx(CompactionRow$1, {});
|
|
9950
|
+
case "compaction": return /* @__PURE__ */ jsx(CompactionRow$1, { item });
|
|
9953
9951
|
case "file_delivered": return /* @__PURE__ */ jsx(FileRow, {
|
|
9954
9952
|
item,
|
|
9955
9953
|
href: fileUrl?.(item.path)
|
|
@@ -10485,7 +10483,7 @@ function TranscriptItemView({ item, fileUrl, attachmentUrl, hostImage, terminal
|
|
|
10485
10483
|
});
|
|
10486
10484
|
case "turn_result": return /* @__PURE__ */ jsx(TurnResultRow, { item });
|
|
10487
10485
|
case "notice": return /* @__PURE__ */ jsx(NoticeRow, { item });
|
|
10488
|
-
case "compaction": return /* @__PURE__ */ jsx(CompactionRow, {});
|
|
10486
|
+
case "compaction": return /* @__PURE__ */ jsx(CompactionRow, { item });
|
|
10489
10487
|
case "file_delivered": return /* @__PURE__ */ jsx(FileCard, {
|
|
10490
10488
|
item,
|
|
10491
10489
|
href: fileUrl?.(item.path)
|
|
@@ -10493,15 +10491,19 @@ function TranscriptItemView({ item, fileUrl, attachmentUrl, hostImage, terminal
|
|
|
10493
10491
|
default: return null;
|
|
10494
10492
|
}
|
|
10495
10493
|
}
|
|
10496
|
-
function CompactionRow() {
|
|
10494
|
+
function CompactionRow({ item }) {
|
|
10497
10495
|
return /* @__PURE__ */ jsxs("div", {
|
|
10498
10496
|
"data-slot": "compaction",
|
|
10499
10497
|
className: "flex items-center gap-2 py-1",
|
|
10500
10498
|
children: [
|
|
10501
10499
|
/* @__PURE__ */ jsx("div", { className: "h-px flex-1 bg-border" }),
|
|
10502
10500
|
/* @__PURE__ */ jsxs("span", {
|
|
10503
|
-
className:
|
|
10504
|
-
children: [
|
|
10501
|
+
className: `font-mono text-label ${item.error === void 0 ? "text-fg-3" : "text-danger"}`,
|
|
10502
|
+
children: [
|
|
10503
|
+
item.pending ? "⋯" : "≡",
|
|
10504
|
+
" ",
|
|
10505
|
+
compactionText(item)
|
|
10506
|
+
]
|
|
10505
10507
|
}),
|
|
10506
10508
|
/* @__PURE__ */ jsx("div", { className: "h-px flex-1 bg-border" })
|
|
10507
10509
|
]
|
|
@@ -10956,11 +10958,7 @@ function Transcript({ state, fileUrl, attachmentUrl, canBrowseFiles, hostImage,
|
|
|
10956
10958
|
label: state.status === "starting" ? "Starting…" : "Working…",
|
|
10957
10959
|
startedAt: runStartedAt,
|
|
10958
10960
|
tokens: state.contextUsage?.totalTokens
|
|
10959
|
-
})] }) : /* @__PURE__ */ jsx(Loader, {
|
|
10960
|
-
label: state.status === "starting" ? "Starting session…" : void 0,
|
|
10961
|
-
startedAt: runStartedAt,
|
|
10962
|
-
tokens: state.contextUsage?.totalTokens
|
|
10963
|
-
}) : null
|
|
10961
|
+
})] }) : /* @__PURE__ */ jsx(Loader, { label: state.status === "starting" ? "Starting session…" : void 0 }) : null
|
|
10964
10962
|
]
|
|
10965
10963
|
})
|
|
10966
10964
|
}),
|
|
@@ -11137,7 +11135,7 @@ const INTERACTIVE = [
|
|
|
11137
11135
|
"[role=\"radio\"]",
|
|
11138
11136
|
"[role=\"tab\"]"
|
|
11139
11137
|
].join(",");
|
|
11140
|
-
function SessionPanel({ client, sessionId, header, panelSurface = "internal", statusSurface = "internal", statusPlacement = "top", onOpenPanel, onVitals, transcriptVariant = "cards", transcriptDensity = "comfortable", transcriptFont = "sans", affordances, terminalMetrics, scrubber = false, bookmarks, onToggleBookmark, reveal, subagents, openSubagent, onSubagentChange, stickyPrompt = false, controlsSurface = "internal", onControls, focusComposerOnClick = false, unseen, readOnly = false, toolHost, clientTools, cacheTranscript, emptyState, onLinkClick, fontSize, className }) {
|
|
11138
|
+
function SessionPanel({ client, sessionId, header, panelSurface = "internal", statusSurface = "internal", statusPlacement = "top", onOpenPanel, onVitals, transcriptVariant = "cards", transcriptDensity = "comfortable", transcriptFont = "sans", affordances, terminalMetrics, scrubber = false, bookmarks, onToggleBookmark, reveal, subagents, openSubagent, onSubagentChange, stickyPrompt = false, controlsSurface = "internal", onControls, focusComposerOnClick = false, unseen, readOnly = false, approvalPrompts, toolHost, clientTools, cacheTranscript, emptyState, onLinkClick, fontSize, className }) {
|
|
11141
11139
|
const effectiveTermFontSize = terminalMetrics?.fontSize ?? fontSize;
|
|
11142
11140
|
const effectiveTermLineHeight = terminalMetrics?.lineHeight ?? (fontSize !== void 0 ? Math.round(fontSize * (18 / 13)) : void 0);
|
|
11143
11141
|
const external = panelSurface === "external";
|
|
@@ -11525,6 +11523,12 @@ function SessionPanel({ client, sessionId, header, panelSurface = "internal", st
|
|
|
11525
11523
|
},
|
|
11526
11524
|
affordances,
|
|
11527
11525
|
children: state.pendingApprovals.map((request) => {
|
|
11526
|
+
const HostPrompt = approvalPrompts?.[request.toolName];
|
|
11527
|
+
if (HostPrompt) return /* @__PURE__ */ jsx(HostPrompt, {
|
|
11528
|
+
request,
|
|
11529
|
+
onApprove: approve,
|
|
11530
|
+
onDeny: deny
|
|
11531
|
+
}, request.id);
|
|
11528
11532
|
const isQuestion = request.toolName === "AskUserQuestion" && parseUserQuestions(request.input).length > 0;
|
|
11529
11533
|
if (terminal) return isQuestion ? /* @__PURE__ */ jsx(TerminalQuestionPrompt, {
|
|
11530
11534
|
request,
|
|
@@ -11692,6 +11696,6 @@ function Notice({ level, onDismiss, children }) {
|
|
|
11692
11696
|
});
|
|
11693
11697
|
}
|
|
11694
11698
|
//#endregion
|
|
11695
|
-
export { Ink as $, PERMISSION_MODES as A, DialogContent as At, TaskList as B, SelectContent as Bt, TerminalPermissionPrompt as C, copyText as Ct, SubagentStrip as D, Dialog$1 as Dt, parseUserQuestions as E, TooltipProvider as Et, SkillsDialog as F, MenuContent as Ft, TerminalSurface as G, PortalScope as Gt, contextNote as H, SelectItemText as Ht, McpDialog as I, MenuItem as It, TerminalMarkdown as J,
|
|
11699
|
+
export { Ink as $, PERMISSION_MODES as A, DialogContent as At, TaskList as B, SelectContent as Bt, TerminalPermissionPrompt as C, copyText as Ct, SubagentStrip as D, Dialog$1 as Dt, parseUserQuestions as E, TooltipProvider as Et, SkillsDialog as F, MenuContent as Ft, TerminalSurface as G, PortalScope as Gt, contextNote as H, SelectItemText as Ht, McpDialog as I, MenuItem as It, TerminalMarkdown as J, Badge as Jt, ToolTitleProvider as K, Textarea as Kt, HostFilesDialog as L, MenuSeparator as Lt, permissionModeChoices as M, DialogRow as Mt, permissionModeMeta as N, DialogTrigger as Nt, PermissionPrompt as O, DialogBody as Ot, ModelSelect as P, Menu$1 as Pt, Blank as Q, cn as Qt, EntryIcon as R, MenuTrigger as Rt, TerminalQuestionPrompt as S, CopyButton as St, QuestionPrompt as T, TooltipContent as Tt, Composer as U, SelectTrigger as Ut, ContextDialog as V, SelectItem as Vt, skillPrompt as W, SelectValue as Wt, previewPatch as X, Button as Xt, TerminalDiff as Y, badgeVariants as Yt, Band as Z, buttonVariants as Zt, ConversationContent as _, segmentsToPlainText as _t, Transcript as a, toolIcon as at, STATUS_META as b, CodeBlock as bt, PromptTokenText as c, useTranscriptDensity as ct, FileCard as d, hashtagTrigger as dt, Row as et, TerminalItemView as f, launchTrigger as ft, Conversation as g, plainTextToSegments as gt, Loader as h, PromptArea as ht, useMinuteClock as i, isMutatingTool as it, PermissionModeSelect as j, DialogHeader as jt, Response as k, DialogClose as kt, Message as l, useTranscriptVariant as lt, SessionEmptyState as m, usePromptAreaState as mt, UsageDialog as n, WithActions as nt, ToolCallCard as o, TranscriptDensityProvider as ot, TerminalTranscript as p, mentionTrigger as pt, useToolTitle as q, Input as qt, UsageMeters as r, useAffordances as rt, Reasoning as s, TranscriptVariantProvider as st, SessionPanel as t, CopyAction as tt, MessageContent as u, commandTrigger as ut, ConversationScrollButton as v, ProgressRing as vt, QUESTION_BEHAVIORS as w, Tip as wt, SessionInfoDialog as x, Spinner as xt, StatusBar as y, Splitter as yt, TasksDialog as z, Select$1 as zt };
|
|
11696
11700
|
|
|
11697
|
-
//# sourceMappingURL=SessionPanel-
|
|
11701
|
+
//# sourceMappingURL=SessionPanel-B5FfiBxE.mjs.map
|