@workerdeck/ui 2.7.2 → 2.9.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/README.md +30 -30
- package/build/{SessionPanel-B5FfiBxE.mjs → SessionPanel-BClL7zUS.mjs} +694 -413
- package/build/SessionPanel-BClL7zUS.mjs.map +1 -0
- package/build/{SessionPanel-_lQLhWOw.d.mts → SessionPanel-BVbau2eR.d.mts} +68 -4
- package/build/format.mjs +1 -1
- package/build/index.d.mts +22 -15
- package/build/index.mjs +6 -6
- package/build/index.mjs.map +1 -1
- package/build/scoped.css +26 -2
- package/build/{status-BO9wJloK.mjs → status-kmsBhuFG.mjs} +3 -3
- package/build/status-kmsBhuFG.mjs.map +1 -0
- package/build/workspace.d.mts +3 -2
- package/build/workspace.mjs +7 -8
- package/build/workspace.mjs.map +1 -1
- package/package.json +18 -18
- package/src/components/agent/Composer.tsx +86 -84
- package/src/components/agent/ContextDialog.tsx +1 -1
- package/src/components/agent/EntryIcon.tsx +1 -1
- package/src/components/agent/FileTree.tsx +1 -1
- package/src/components/agent/FileViewer.tsx +1 -1
- package/src/components/agent/HostFilesDialog.tsx +2 -2
- package/src/components/agent/PermissionModeSelect.tsx +2 -2
- package/src/components/agent/PermissionPrompt.tsx +2 -2
- package/src/components/agent/SessionBrowser.tsx +1 -1
- package/src/components/agent/SessionItem.tsx +4 -2
- package/src/components/agent/SessionPanel.tsx +306 -226
- package/src/components/agent/SessionWorkspace.tsx +3 -0
- package/src/components/agent/SkillsDialog.tsx +3 -3
- package/src/components/agent/StatusBar.tsx +1 -1
- package/src/components/agent/TaskList.tsx +2 -2
- package/src/components/agent/TranscriptRows.tsx +1 -1
- package/src/components/agent/UsageDialog.tsx +1 -1
- package/src/components/agent/UsageMeters.tsx +17 -4
- package/src/components/agent/composer-commands.ts +142 -0
- package/src/components/agent/use-path-links.ts +2 -7
- package/src/components/agent/use-subagent-frame.ts +2 -2
- package/src/components/agent/use-transcript-jumps.ts +2 -2
- package/src/components/prompt-area/clipboard-helpers.ts +2 -2
- package/src/components/prompt-area/cursor-helpers.ts +7 -7
- package/src/components/prompt-area/dom-helpers.ts +8 -8
- package/src/components/prompt-area/html-to-markdown.ts +2 -2
- package/src/components/prompt-area/prompt-area-engine.ts +4 -4
- package/src/components/prompt-area/prompt-area-list-ops.ts +10 -10
- package/src/components/prompt-area/prompt-area.tsx +2 -2
- package/src/components/prompt-area/trigger-presets.ts +6 -6
- package/src/components/prompt-area/types.ts +6 -6
- package/src/components/prompt-area/use-chip-editing.ts +8 -8
- package/src/components/prompt-area/use-markdown-mode.ts +3 -3
- package/src/components/prompt-area/use-prompt-area-events.ts +3 -3
- package/src/components/prompt-area/use-prompt-area-keydown.ts +3 -3
- package/src/components/prompt-area/use-prompt-area-state.ts +4 -4
- package/src/components/prompt-area/use-prompt-area.ts +5 -5
- package/src/components/prompt-area/use-trigger-search.ts +1 -1
- package/src/components/terminal/PermissionPrompt.tsx +4 -4
- package/src/components/terminal/affordances.tsx +1 -1
- package/src/components/terminal/file-link.tsx +20 -0
- package/src/components/terminal/height.ts +2 -2
- package/src/components/terminal/items.tsx +2 -2
- package/src/components/terminal/markdown.tsx +31 -5
- package/src/components/terminal/scrubber.tsx +1 -1
- package/src/components/terminal/todos.ts +1 -1
- package/src/components/ui/Splitter.tsx +1 -1
- package/src/index.ts +11 -1
- package/src/lib/context-note.ts +3 -3
- package/src/lib/file-link.ts +70 -0
- package/src/lib/format.ts +2 -2
- package/src/styles/scoped.entry.css +2 -2
- package/src/styles/terminal.css +94 -79
- package/src/styles/theme.css +39 -39
- package/build/SessionPanel-B5FfiBxE.mjs.map +0 -1
- package/build/status-BO9wJloK.mjs.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
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-
|
|
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-kmsBhuFG.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";
|
|
5
5
|
import { extendTailwindMerge } from "tailwind-merge";
|
|
6
6
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { Select } from "@base-ui/react/select";
|
|
8
|
-
import { ArrowDown, ArrowDownCircle, ArrowLeft, ArrowRight, ArrowUp, AtSign, Brain, ChartPie, Check, CheckSquare, ChevronDown, ChevronLeft, ChevronRight, ChevronsUpDown, Circle, CircleAlert, ClipboardList, Clock, Code, Copy, Download, File, FileDiff, FileText, Folder, FolderSearch, FolderTree, Gauge, Globe, Hand, Image, Info, Link2, LoaderCircle, MessageCircleQuestion, MessageSquareText, MoreHorizontal, Paperclip, PencilLine, Plug, Power, PowerOff, Puzzle, RefreshCw, RotateCcw, RotateCw, Search, ShieldCheck, SlashSquare, Sparkles, Square, SquarePen, Terminal, TriangleAlert, UsersRound, WifiOff, Wrench, X, Zap } from "lucide-react";
|
|
8
|
+
import { ArrowDown, ArrowDownCircle, ArrowLeft, ArrowRight, ArrowUp, AtSign, Brain, ChartPie, Check, CheckSquare, ChevronDown, ChevronLeft, ChevronRight, ChevronsUpDown, Circle, CircleAlert, ClipboardList, Clock, Code, Copy, Download, File, FileDiff, FileText, Folder, FolderSearch, FolderTree, Gauge, Globe, Hand, Image, Info, Link2, LoaderCircle, MessageCircleQuestion, MessageSquareText, MoreHorizontal, Paperclip, PencilLine, Plug, Power, PowerOff, Puzzle, RefreshCw, RotateCcw, RotateCw, Search, ShieldCheck, SlashSquare, SlidersHorizontal, Sparkles, Square, SquarePen, Terminal, TriangleAlert, UsersRound, WifiOff, Wrench, X, Zap } from "lucide-react";
|
|
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, parseUserQuestions, sessionTasks, subagentLabel, taskCountLabel, taskSummary, toolTitle, usageInfos, visibleTasks } from "@workerdeck/protocol";
|
|
12
|
+
import { PROTOCOL_VERSION, mergeUsage, orderUsageWindows, parseTodoWriteInput, parseUserQuestions, sessionTasks, subagentLabel, taskCountLabel, taskSummary, toolTitle, usageInfos, usageIsStale, 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";
|
|
@@ -521,7 +521,7 @@ function truncateSegmentsToLength(segments, maxLength) {
|
|
|
521
521
|
* in the editor model: a space, newline, or tab.
|
|
522
522
|
*
|
|
523
523
|
* Trigger detection, paste auto-resolution, and position validation all rely
|
|
524
|
-
* on the *same* notion of a boundary
|
|
524
|
+
* on the *same* notion of a boundary - keeping it here prevents the three
|
|
525
525
|
* call sites from silently drifting apart (e.g. one handling tabs and the
|
|
526
526
|
* others not).
|
|
527
527
|
*/
|
|
@@ -659,7 +659,7 @@ function resolveChip(segments, activeTrigger, chip) {
|
|
|
659
659
|
* The sibling of {@link resolveChip}, for suggestions that are a typing aid
|
|
660
660
|
* rather than a token: what lands in the document is ordinary editable text the
|
|
661
661
|
* user is expected to finish and change, and it must not look or behave like a
|
|
662
|
-
* resolved chip
|
|
662
|
+
* resolved chip - no immutability, no trigger character, nothing for a consumer
|
|
663
663
|
* to parse back out. The caret is left at the end of the inserted text so typing
|
|
664
664
|
* continues from there.
|
|
665
665
|
*/
|
|
@@ -1014,7 +1014,7 @@ function autoFormatListPrefix(segments, cursorPos) {
|
|
|
1014
1014
|
};
|
|
1015
1015
|
}
|
|
1016
1016
|
/**
|
|
1017
|
-
* Handles Enter key in a list line
|
|
1017
|
+
* Handles Enter key in a list line - continues the list or exits.
|
|
1018
1018
|
*/
|
|
1019
1019
|
function insertListContinuation(segments, cursorPos) {
|
|
1020
1020
|
const plainText = segmentsToPlainText(segments);
|
|
@@ -1051,8 +1051,8 @@ function getPrevListLineLevel(text, lineStart) {
|
|
|
1051
1051
|
/**
|
|
1052
1052
|
* Indents a list item by one level (adds 2 spaces before the prefix), capped at
|
|
1053
1053
|
* one level deeper than the line above. An item can only nest under a preceding
|
|
1054
|
-
* sibling, so the first item of a list
|
|
1055
|
-
* parent
|
|
1054
|
+
* sibling, so the first item of a list - or an item already one level below its
|
|
1055
|
+
* parent - cannot indent further (returns null). This keeps sub-items visually
|
|
1056
1056
|
* connected to a parent instead of drifting arbitrarily deep.
|
|
1057
1057
|
*/
|
|
1058
1058
|
function indentListItem(segments, cursorPos) {
|
|
@@ -1099,8 +1099,8 @@ function swapListPrefixLine(line, markdownEnabled) {
|
|
|
1099
1099
|
/**
|
|
1100
1100
|
* Returns the set of line indices that sit inside a *balanced* fenced code
|
|
1101
1101
|
* block (a ```…``` pair), so their leading "- "/"• " markers are preserved
|
|
1102
|
-
* verbatim. An unterminated (unpaired) fence marker is NOT protective
|
|
1103
|
-
* following lines still normalize
|
|
1102
|
+
* verbatim. An unterminated (unpaired) fence marker is NOT protective - its
|
|
1103
|
+
* following lines still normalize - so a stray "```" in prose does not silently
|
|
1104
1104
|
* suppress bullet normalization for the rest of the text.
|
|
1105
1105
|
*/
|
|
1106
1106
|
function fenceProtectedLineIndices(lines) {
|
|
@@ -1161,12 +1161,12 @@ function normalizeListPrefixes(segments, markdownEnabled) {
|
|
|
1161
1161
|
return changed ? result : segments;
|
|
1162
1162
|
}
|
|
1163
1163
|
/**
|
|
1164
|
-
* Whether the text holds a genuine ordered-list run worth renumbering
|
|
1164
|
+
* Whether the text holds a genuine ordered-list run worth renumbering - a run
|
|
1165
1165
|
* of 2+ consecutive same-level numbered lines that either starts at 1 or is
|
|
1166
1166
|
* already a contiguous `n, n+1, …` sequence. Used to gate the paste path so a
|
|
1167
1167
|
* copied list fragment (`3. 4. 5.` → renumber, or a broken `1. 1. 1.`) is
|
|
1168
1168
|
* rebuilt, while incidental numeric-leading prose that `parseListLine` would
|
|
1169
|
-
* otherwise treat as a list
|
|
1169
|
+
* otherwise treat as a list - `1985. Born / 2020. Died`, `5. / 10. / 15.` - is
|
|
1170
1170
|
* left untouched.
|
|
1171
1171
|
*/
|
|
1172
1172
|
function hasOrderedListRun(text) {
|
|
@@ -1199,7 +1199,7 @@ function hasOrderedListRun(text) {
|
|
|
1199
1199
|
* Recomputes ordered-list numbering across the whole text. Returns the new text
|
|
1200
1200
|
* plus the list of changed digit runs (ascending by `oldStart`) for cursor
|
|
1201
1201
|
* remapping. When nothing changes, returns the SAME text reference and an empty
|
|
1202
|
-
* `edits` array
|
|
1202
|
+
* `edits` array - the no-op guard that keeps this off the typing hot path.
|
|
1203
1203
|
*/
|
|
1204
1204
|
function renumberOrderedListLines(text) {
|
|
1205
1205
|
if (!/^[ \t]*\d+\. /m.test(text)) return {
|
|
@@ -1441,11 +1441,11 @@ function indexOfChildNode(parent, child) {
|
|
|
1441
1441
|
* `readSegmentsFromDOM` in use-prompt-area.ts. This is the single predicate
|
|
1442
1442
|
* shared with `domChildIndexToSegmentIndex` below, so a DOM child index can
|
|
1443
1443
|
* never map to a different segment index than the one the reader actually
|
|
1444
|
-
* produces
|
|
1444
|
+
* produces - decoration elements (the URL `<a>` from `decorateURLsInEditor`,
|
|
1445
1445
|
* the markdown `<span data-md>` from `decorateMarkdownInEditor`) fall through
|
|
1446
1446
|
* to the reader's "unknown element" branch and DO produce a text segment, so
|
|
1447
1447
|
* they must count here too, not just chips/text/`<br>`. A chip element only
|
|
1448
|
-
* counts if `chipNodeToSegment` would actually accept it
|
|
1448
|
+
* counts if `chipNodeToSegment` would actually accept it - the reader skips a
|
|
1449
1449
|
* chip missing a required attribute (trigger/value/display), so this must too.
|
|
1450
1450
|
*/
|
|
1451
1451
|
function childProducesSegment(child) {
|
|
@@ -1536,7 +1536,7 @@ function normalizeEditorDOM(editor) {
|
|
|
1536
1536
|
* Walks direct-child text nodes in the editor and wraps URL text in
|
|
1537
1537
|
* `<a>` elements for visual styling and clickability.
|
|
1538
1538
|
*
|
|
1539
|
-
* This is a DOM-only decoration
|
|
1539
|
+
* This is a DOM-only decoration - it does NOT modify the segment model.
|
|
1540
1540
|
* The `<a>` elements are stripped by `normalizeEditorDOM` on every input cycle,
|
|
1541
1541
|
* so they are re-applied fresh each time.
|
|
1542
1542
|
*
|
|
@@ -1600,7 +1600,7 @@ function decorateURLsInEditor(editor) {
|
|
|
1600
1600
|
* Walks direct-child text nodes in the editor and wraps markdown-formatted
|
|
1601
1601
|
* text (`**bold**`, `*italic*`, `***bold-italic***`) in styled `<span>` elements.
|
|
1602
1602
|
*
|
|
1603
|
-
* This is a DOM-only decoration
|
|
1603
|
+
* This is a DOM-only decoration - it does NOT modify the segment model.
|
|
1604
1604
|
* The `<span>` elements are stripped by `normalizeEditorDOM` on every input cycle,
|
|
1605
1605
|
* so they are re-applied fresh each time.
|
|
1606
1606
|
*
|
|
@@ -1727,7 +1727,7 @@ function decorateBulletsInEditor(editor) {
|
|
|
1727
1727
|
* unchanged) and is stripped by {@link normalizeEditorDOM} each input cycle.
|
|
1728
1728
|
* Must run BEFORE the node-splitting passes ({@link decorateURLsInEditor},
|
|
1729
1729
|
* {@link decorateMarkdownInEditor}, {@link decorateBulletsInEditor}) so every
|
|
1730
|
-
* direct-child text node is still a whole line
|
|
1730
|
+
* direct-child text node is still a whole line - otherwise a mid-line split
|
|
1731
1731
|
* fragment beginning with whitespace would let the `^` anchor false-match
|
|
1732
1732
|
* non-line-leading whitespace.
|
|
1733
1733
|
*
|
|
@@ -1811,12 +1811,12 @@ function getSelectionRange() {
|
|
|
1811
1811
|
*
|
|
1812
1812
|
* Invariants:
|
|
1813
1813
|
* - All functions are synchronous. Never return a promise or cross a microtask
|
|
1814
|
-
* boundary after a DOM mutation
|
|
1814
|
+
* boundary after a DOM mutation - that can cause the browser to fire
|
|
1815
1815
|
* `selectionchange` and reset the caret.
|
|
1816
1816
|
* - Never cache a `Selection` or `Range` across calls. Ranges become detached
|
|
1817
1817
|
* after DOM mutations. Each function calls `window.getSelection()` or
|
|
1818
1818
|
* `getSelectionRange()` fresh.
|
|
1819
|
-
* - Chip nodes are treated atomically via `isChipElement`
|
|
1819
|
+
* - Chip nodes are treated atomically via `isChipElement` - we never descend
|
|
1820
1820
|
* into a contentEditable=false subtree when mapping offsets.
|
|
1821
1821
|
*/
|
|
1822
1822
|
function getCursorOffset(editor) {
|
|
@@ -1844,11 +1844,11 @@ function createRangeAtOffset(editor, targetOffset) {
|
|
|
1844
1844
|
* Where the caret is on screen, in viewport coordinates.
|
|
1845
1845
|
*
|
|
1846
1846
|
* A collapsed range usually measures fine, but not when it sits *between* child
|
|
1847
|
-
* nodes of an element
|
|
1847
|
+
* nodes of an element - which is exactly where a freshly inserted newline puts
|
|
1848
1848
|
* it, because this editor's content is a flat run of text nodes and `<br>`s
|
|
1849
1849
|
* directly under the editor element. There `getBoundingClientRect()` is all
|
|
1850
1850
|
* zeros, and the obvious fallback (measure `startContainer`'s element) resolves
|
|
1851
|
-
* to the editor itself, whose rect is the viewport box
|
|
1851
|
+
* to the editor itself, whose rect is the viewport box - so it reports the
|
|
1852
1852
|
* caret as trivially visible and scrolls nothing.
|
|
1853
1853
|
*
|
|
1854
1854
|
* So measure the neighbour instead: the child the caret sits before, or failing
|
|
@@ -1877,14 +1877,14 @@ function caretRect(range) {
|
|
|
1877
1877
|
* The editor is its own scroll container once it hits `maxHeight`
|
|
1878
1878
|
* (`prompt-area.tsx` sets `overflowY: auto` there). Typing scrolls the caret
|
|
1879
1879
|
* into view for free, because that is the browser's own behaviour for a native
|
|
1880
|
-
* edit
|
|
1880
|
+
* edit - but every path that calls `preventDefault()` and rebuilds the DOM
|
|
1881
1881
|
* itself (Shift+Enter, list continuation, undo/redo, the bold/italic wrap,
|
|
1882
1882
|
* paste) places the caret with a Range instead, and setting a selection does
|
|
1883
1883
|
* not scroll anything. The symptom is a prompt that has grown past its cap and
|
|
1884
1884
|
* stops following what you are writing: type and it scrolls, press Shift+Enter
|
|
1885
1885
|
* and the new line appears below the fold.
|
|
1886
1886
|
*
|
|
1887
|
-
* A no-op when the caret is already visible, so it is safe on every call
|
|
1887
|
+
* A no-op when the caret is already visible, so it is safe on every call - it
|
|
1888
1888
|
* corrects an off-screen caret rather than scrolling to one.
|
|
1889
1889
|
*/
|
|
1890
1890
|
function scrollCaretIntoView(editor) {
|
|
@@ -2345,7 +2345,7 @@ function normalizeOutput(markdown) {
|
|
|
2345
2345
|
/**
|
|
2346
2346
|
* Converts an HTML string to markdown source text. Returns '' for empty or
|
|
2347
2347
|
* body-less input. Block markdown (headings, lists, quotes, fences, tables,
|
|
2348
|
-
* links) is emitted as literal markdown text
|
|
2348
|
+
* links) is emitted as literal markdown text - that is the editor's intended
|
|
2349
2349
|
* display; only `*`/`**`/`***` and bare URLs get visually decorated inline.
|
|
2350
2350
|
*/
|
|
2351
2351
|
function htmlToMarkdown(html) {
|
|
@@ -4411,6 +4411,116 @@ function launchTrigger(opts) {
|
|
|
4411
4411
|
};
|
|
4412
4412
|
}
|
|
4413
4413
|
//#endregion
|
|
4414
|
+
//#region src/components/agent/composer-commands.ts
|
|
4415
|
+
const KIND_ORDER = {
|
|
4416
|
+
command: 0,
|
|
4417
|
+
client: 1,
|
|
4418
|
+
skill: 2
|
|
4419
|
+
};
|
|
4420
|
+
function cleanCommandName(name) {
|
|
4421
|
+
return name.replace(/\s*\(MCP\)$/i, "");
|
|
4422
|
+
}
|
|
4423
|
+
function skillPrompt(skill) {
|
|
4424
|
+
const base = skill.defaultPrompt?.trim() || `Use the ${skill.displayName ?? skill.name} skill:`;
|
|
4425
|
+
return /\s$/.test(base) ? base : base + " ";
|
|
4426
|
+
}
|
|
4427
|
+
function mergeComposerRows(sources) {
|
|
4428
|
+
const rows = [];
|
|
4429
|
+
const engineNames = /* @__PURE__ */ new Set();
|
|
4430
|
+
for (const command of sources.commands ?? []) {
|
|
4431
|
+
const name = cleanCommandName(command.name);
|
|
4432
|
+
if (engineNames.has(name)) continue;
|
|
4433
|
+
engineNames.add(name);
|
|
4434
|
+
for (const alias of command.aliases ?? []) engineNames.add(cleanCommandName(alias));
|
|
4435
|
+
rows.push({
|
|
4436
|
+
kind: "command",
|
|
4437
|
+
name,
|
|
4438
|
+
description: command.description,
|
|
4439
|
+
argumentHint: command.argumentHint,
|
|
4440
|
+
aliases: command.aliases
|
|
4441
|
+
});
|
|
4442
|
+
}
|
|
4443
|
+
for (const command of sources.clientCommands ?? []) {
|
|
4444
|
+
if (engineNames.has(command.name)) continue;
|
|
4445
|
+
rows.push({
|
|
4446
|
+
kind: "client",
|
|
4447
|
+
name: command.name,
|
|
4448
|
+
description: command.description,
|
|
4449
|
+
argumentHint: command.argumentHint,
|
|
4450
|
+
command
|
|
4451
|
+
});
|
|
4452
|
+
}
|
|
4453
|
+
for (const skill of sources.skills ?? []) rows.push({
|
|
4454
|
+
kind: "skill",
|
|
4455
|
+
name: skill.name,
|
|
4456
|
+
label: skill.displayName ?? skill.name,
|
|
4457
|
+
description: skill.shortDescription ?? skill.description,
|
|
4458
|
+
enabled: skill.enabled,
|
|
4459
|
+
scope: skill.scope,
|
|
4460
|
+
skill
|
|
4461
|
+
});
|
|
4462
|
+
return rows;
|
|
4463
|
+
}
|
|
4464
|
+
function haystacks(row) {
|
|
4465
|
+
if (row.kind === "skill") return [
|
|
4466
|
+
row.name,
|
|
4467
|
+
row.label,
|
|
4468
|
+
...row.name.split(/[-:_]/)
|
|
4469
|
+
];
|
|
4470
|
+
return [
|
|
4471
|
+
row.name,
|
|
4472
|
+
...row.kind === "command" ? row.aliases ?? [] : [],
|
|
4473
|
+
...row.name.split(":")
|
|
4474
|
+
];
|
|
4475
|
+
}
|
|
4476
|
+
function matchScore(query, candidates) {
|
|
4477
|
+
const needle = query.toLowerCase();
|
|
4478
|
+
const lowered = candidates.map((s) => s.toLowerCase());
|
|
4479
|
+
if (lowered.some((h) => h.startsWith(needle))) return 2;
|
|
4480
|
+
return lowered.some((h) => h.includes(needle)) ? 1 : 0;
|
|
4481
|
+
}
|
|
4482
|
+
function rankComposerRows(query, rows) {
|
|
4483
|
+
const scored = [];
|
|
4484
|
+
rows.forEach((row, index) => {
|
|
4485
|
+
if (row.kind === "skill" && !row.enabled) return;
|
|
4486
|
+
const score = matchScore(query, haystacks(row));
|
|
4487
|
+
if (score > 0) scored.push({
|
|
4488
|
+
score,
|
|
4489
|
+
index,
|
|
4490
|
+
row
|
|
4491
|
+
});
|
|
4492
|
+
});
|
|
4493
|
+
scored.sort((a, b) => b.score - a.score || KIND_ORDER[a.row.kind] - KIND_ORDER[b.row.kind] || a.index - b.index);
|
|
4494
|
+
return scored.map(({ row }) => row);
|
|
4495
|
+
}
|
|
4496
|
+
function matchClientCommand(text, commands) {
|
|
4497
|
+
const match = /^\/([\w:-]+)[ \t]*([\s\S]*)$/.exec(text.trim());
|
|
4498
|
+
if (!match) return;
|
|
4499
|
+
const command = commands.find((c) => c.name === match[1]);
|
|
4500
|
+
return command ? {
|
|
4501
|
+
command,
|
|
4502
|
+
args: match[2].trim()
|
|
4503
|
+
} : void 0;
|
|
4504
|
+
}
|
|
4505
|
+
function composerCommandRows(rows) {
|
|
4506
|
+
return rows.map((row) => row.kind === "skill" ? {
|
|
4507
|
+
kind: row.kind,
|
|
4508
|
+
name: row.name,
|
|
4509
|
+
label: row.label,
|
|
4510
|
+
description: row.description,
|
|
4511
|
+
scope: row.scope,
|
|
4512
|
+
enabled: row.enabled,
|
|
4513
|
+
insertText: skillPrompt(row.skill)
|
|
4514
|
+
} : {
|
|
4515
|
+
kind: row.kind,
|
|
4516
|
+
name: row.name,
|
|
4517
|
+
label: `/${row.name}`,
|
|
4518
|
+
description: row.description,
|
|
4519
|
+
enabled: true,
|
|
4520
|
+
insertText: `/${row.name} `
|
|
4521
|
+
});
|
|
4522
|
+
}
|
|
4523
|
+
//#endregion
|
|
4414
4524
|
//#region src/components/agent/transcript-variant.tsx
|
|
4415
4525
|
const VariantContext = createContext("cards");
|
|
4416
4526
|
function TranscriptVariantProvider({ value, children }) {
|
|
@@ -4749,6 +4859,69 @@ function TerminalDiff({ patch }) {
|
|
|
4749
4859
|
});
|
|
4750
4860
|
}
|
|
4751
4861
|
//#endregion
|
|
4862
|
+
//#region src/lib/file-link.ts
|
|
4863
|
+
const SCHEME = /^[a-zA-Z][a-zA-Z0-9+.-]*:/;
|
|
4864
|
+
const TRAILING_LINE = /^(.*?):(\d+)(?::\d+)?$/;
|
|
4865
|
+
const FRAGMENT_LINE = /^L(\d+)/;
|
|
4866
|
+
function parseFileLink(href, cwd) {
|
|
4867
|
+
const raw = href?.trim();
|
|
4868
|
+
if (!raw || raw.startsWith("#") || raw.startsWith("//")) return;
|
|
4869
|
+
let target = raw;
|
|
4870
|
+
if (SCHEME.test(target)) {
|
|
4871
|
+
if (!target.startsWith("file:")) return;
|
|
4872
|
+
try {
|
|
4873
|
+
target = decodeURIComponent(new URL(target).pathname);
|
|
4874
|
+
} catch {
|
|
4875
|
+
return;
|
|
4876
|
+
}
|
|
4877
|
+
}
|
|
4878
|
+
let line;
|
|
4879
|
+
const hash = target.indexOf("#");
|
|
4880
|
+
if (hash !== -1) {
|
|
4881
|
+
line = readLine(FRAGMENT_LINE.exec(target.slice(hash + 1))?.[1]);
|
|
4882
|
+
target = target.slice(0, hash);
|
|
4883
|
+
}
|
|
4884
|
+
const suffix = TRAILING_LINE.exec(target);
|
|
4885
|
+
if (suffix) {
|
|
4886
|
+
target = suffix[1];
|
|
4887
|
+
line ??= readLine(suffix[2]);
|
|
4888
|
+
}
|
|
4889
|
+
if (!target) return;
|
|
4890
|
+
const path = target.startsWith("/") ? normalize(target) : cwd ? normalize(`${cwd}/${target}`) : void 0;
|
|
4891
|
+
return path ? {
|
|
4892
|
+
path,
|
|
4893
|
+
...line === void 0 ? {} : { line }
|
|
4894
|
+
} : void 0;
|
|
4895
|
+
}
|
|
4896
|
+
function readLine(value) {
|
|
4897
|
+
const parsed = value === void 0 ? NaN : Number(value);
|
|
4898
|
+
return Number.isInteger(parsed) && parsed > 0 ? parsed : void 0;
|
|
4899
|
+
}
|
|
4900
|
+
function normalize(path) {
|
|
4901
|
+
const out = [];
|
|
4902
|
+
for (const part of path.split("/")) {
|
|
4903
|
+
if (part === "" || part === ".") continue;
|
|
4904
|
+
if (part === "..") {
|
|
4905
|
+
out.pop();
|
|
4906
|
+
continue;
|
|
4907
|
+
}
|
|
4908
|
+
out.push(part);
|
|
4909
|
+
}
|
|
4910
|
+
return `/${out.join("/")}`;
|
|
4911
|
+
}
|
|
4912
|
+
//#endregion
|
|
4913
|
+
//#region src/components/terminal/file-link.tsx
|
|
4914
|
+
const FileLinkContext = createContext(void 0);
|
|
4915
|
+
function FileLinkProvider({ value, children }) {
|
|
4916
|
+
return /* @__PURE__ */ jsx(FileLinkContext.Provider, {
|
|
4917
|
+
value,
|
|
4918
|
+
children
|
|
4919
|
+
});
|
|
4920
|
+
}
|
|
4921
|
+
function useFileLinks() {
|
|
4922
|
+
return useContext(FileLinkContext);
|
|
4923
|
+
}
|
|
4924
|
+
//#endregion
|
|
4752
4925
|
//#region src/components/terminal/markdown.tsx
|
|
4753
4926
|
function codeText(node) {
|
|
4754
4927
|
if (node === null || node === void 0 || typeof node === "boolean") return "";
|
|
@@ -4788,6 +4961,29 @@ function heading(tone) {
|
|
|
4788
4961
|
});
|
|
4789
4962
|
};
|
|
4790
4963
|
}
|
|
4964
|
+
function Link({ href, children }) {
|
|
4965
|
+
const links = useFileLinks();
|
|
4966
|
+
const file = links ? parseFileLink(href, links.cwd) : void 0;
|
|
4967
|
+
if (file) return /* @__PURE__ */ jsx("button", {
|
|
4968
|
+
type: "button",
|
|
4969
|
+
className: "term-link",
|
|
4970
|
+
"data-tone": "blue",
|
|
4971
|
+
title: file.line === void 0 ? file.path : `${file.path}:${file.line}`,
|
|
4972
|
+
onClick: (event) => {
|
|
4973
|
+
event.stopPropagation();
|
|
4974
|
+
links?.open(file.path, file.line);
|
|
4975
|
+
},
|
|
4976
|
+
children
|
|
4977
|
+
});
|
|
4978
|
+
return /* @__PURE__ */ jsx("a", {
|
|
4979
|
+
className: "term-link",
|
|
4980
|
+
"data-tone": "blue",
|
|
4981
|
+
href,
|
|
4982
|
+
target: "_blank",
|
|
4983
|
+
rel: "noreferrer",
|
|
4984
|
+
children
|
|
4985
|
+
});
|
|
4986
|
+
}
|
|
4791
4987
|
const TERMINAL_COMPONENTS = {
|
|
4792
4988
|
p: ({ children }) => /* @__PURE__ */ jsx("div", {
|
|
4793
4989
|
className: "term-block",
|
|
@@ -4844,12 +5040,8 @@ const TERMINAL_COMPONENTS = {
|
|
|
4844
5040
|
className: "term-em",
|
|
4845
5041
|
children
|
|
4846
5042
|
}),
|
|
4847
|
-
a: ({ children, href }) => /* @__PURE__ */ jsx(
|
|
4848
|
-
className: "term-link",
|
|
4849
|
-
"data-tone": "blue",
|
|
5043
|
+
a: ({ children, href }) => /* @__PURE__ */ jsx(Link, {
|
|
4850
5044
|
href,
|
|
4851
|
-
target: "_blank",
|
|
4852
|
-
rel: "noreferrer",
|
|
4853
5045
|
children
|
|
4854
5046
|
}),
|
|
4855
5047
|
table: ({ children }) => /* @__PURE__ */ jsx("div", {
|
|
@@ -5358,7 +5550,7 @@ function ToolRow({ item }) {
|
|
|
5358
5550
|
setFetching(true);
|
|
5359
5551
|
fetchResult(item.id).finally(() => setFetching(false));
|
|
5360
5552
|
},
|
|
5361
|
-
children: truncated ? `… +${missing.toLocaleString()} chars
|
|
5553
|
+
children: truncated ? `… +${missing.toLocaleString()} chars - fetch the rest` : `… +${hidden} line${hidden === 1 ? "" : "s"} - show all ${text.length.toLocaleString()} chars`
|
|
5362
5554
|
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
5363
5555
|
"… +",
|
|
5364
5556
|
hidden,
|
|
@@ -5557,20 +5749,7 @@ function TerminalSurface({ fontSize, lineHeight, bleed, affordances, className,
|
|
|
5557
5749
|
//#region src/components/agent/Composer.tsx
|
|
5558
5750
|
const SHELL_PLACEHOLDER = "Run a command on the host…";
|
|
5559
5751
|
const SHELL_HINT = "! shell mode · esc to exit";
|
|
5560
|
-
function
|
|
5561
|
-
return name.replace(/\s*\(MCP\)$/i, "");
|
|
5562
|
-
}
|
|
5563
|
-
function skillPrompt(skill) {
|
|
5564
|
-
const base = skill.defaultPrompt?.trim() || `$${skill.name}`;
|
|
5565
|
-
return /\s$/.test(base) ? base : base + " ";
|
|
5566
|
-
}
|
|
5567
|
-
function matchScore(query, haystacks) {
|
|
5568
|
-
const needle = query.toLowerCase();
|
|
5569
|
-
const lowered = haystacks.map((s) => s.toLowerCase());
|
|
5570
|
-
if (lowered.some((h) => h.startsWith(needle))) return 2;
|
|
5571
|
-
return lowered.some((h) => h.includes(needle)) ? 1 : 0;
|
|
5572
|
-
}
|
|
5573
|
-
function Composer({ onSend, onInterrupt, busy, disabled, placeholder = "Message the agent…", commands, skills, onSearchFiles, onShellCommand, attachments, toolbar, layout = "stacked", fontSize, lineHeight, affordances, draft, className, ref }) {
|
|
5752
|
+
function Composer({ onSend, onInterrupt, busy, disabled, placeholder = "Message the agent…", commands, skills, clientCommands, onSearchFiles, onShellCommand, attachments, toolbar, layout = "stacked", fontSize, lineHeight, affordances, draft, className, ref }) {
|
|
5574
5753
|
const inline = layout === "inline";
|
|
5575
5754
|
const terminal = useTranscriptVariant() === "terminal";
|
|
5576
5755
|
const [initialDraft] = useState(() => draft?.initialText ?? "");
|
|
@@ -5578,6 +5757,7 @@ function Composer({ onSend, onInterrupt, busy, disabled, placeholder = "Message
|
|
|
5578
5757
|
const fileInput = useRef(null);
|
|
5579
5758
|
const [dragging, setDragging] = useState(false);
|
|
5580
5759
|
const [shellMode, setShellMode] = useState(false);
|
|
5760
|
+
const [helpOpen, setHelpOpen] = useState(false);
|
|
5581
5761
|
useImperativeHandle(ref, () => ({
|
|
5582
5762
|
insertText: (text) => {
|
|
5583
5763
|
const prefix = plainText.length > 0 && !/\s$/.test(plainText) ? " " : "";
|
|
@@ -5592,71 +5772,36 @@ function Composer({ onSend, onInterrupt, busy, disabled, placeholder = "Message
|
|
|
5592
5772
|
]);
|
|
5593
5773
|
const triggers = useMemo(() => {
|
|
5594
5774
|
const configured = [];
|
|
5595
|
-
const
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
return [{
|
|
5603
|
-
...c,
|
|
5604
|
-
name
|
|
5605
|
-
}];
|
|
5606
|
-
});
|
|
5775
|
+
const rows = mergeComposerRows({
|
|
5776
|
+
commands,
|
|
5777
|
+
clientCommands,
|
|
5778
|
+
skills
|
|
5779
|
+
});
|
|
5780
|
+
if (rows.length > 0) {
|
|
5781
|
+
const byTag = new Map(rows.map((row) => [`${row.kind}:${row.name}`, row]));
|
|
5607
5782
|
configured.push(commandTrigger({
|
|
5608
|
-
onSearch: (query) => {
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
}
|
|
5626
|
-
scored.sort((a, b) => b.score - a.score);
|
|
5627
|
-
return scored.map(({ suggestion }) => suggestion);
|
|
5783
|
+
onSearch: (query) => rankComposerRows(query, rows).map((row) => row.kind === "skill" ? {
|
|
5784
|
+
value: row.name,
|
|
5785
|
+
label: row.label,
|
|
5786
|
+
description: row.description ? `Skill · ${row.description}` : "Skill · inserts a message you can edit",
|
|
5787
|
+
icon: /* @__PURE__ */ jsx(Sparkles, { className: "size-3.5 text-fg-3" }),
|
|
5788
|
+
data: `${row.kind}:${row.name}`
|
|
5789
|
+
} : {
|
|
5790
|
+
value: row.name,
|
|
5791
|
+
label: `/${row.name}${row.argumentHint ? ` ${row.argumentHint}` : ""}`,
|
|
5792
|
+
description: row.description,
|
|
5793
|
+
icon: row.kind === "client" ? /* @__PURE__ */ jsx(SlidersHorizontal, { className: "size-3.5 text-fg-3" }) : void 0,
|
|
5794
|
+
data: `${row.kind}:${row.name}`
|
|
5795
|
+
}),
|
|
5796
|
+
insertAsText: (suggestion) => {
|
|
5797
|
+
const row = byTag.get(String(suggestion.data));
|
|
5798
|
+
if (row?.kind === "skill") return skillPrompt(row.skill);
|
|
5799
|
+
return row?.kind === "client" && row.command.requiresArgs ? `/${row.name} ` : void 0;
|
|
5628
5800
|
},
|
|
5629
5801
|
onSelect: (suggestion) => suggestion.value,
|
|
5630
5802
|
chipClassName: "font-mono"
|
|
5631
5803
|
}));
|
|
5632
5804
|
}
|
|
5633
|
-
if (usableSkills.length > 0) configured.push(commandTrigger({
|
|
5634
|
-
char: "$",
|
|
5635
|
-
accessibilityLabel: "skill",
|
|
5636
|
-
onSearch: (query) => {
|
|
5637
|
-
const scored = [];
|
|
5638
|
-
for (const skill of usableSkills) {
|
|
5639
|
-
const score = matchScore(query, [skill.name, ...skill.name.split(/[-:_]/)]);
|
|
5640
|
-
if (score === 0) continue;
|
|
5641
|
-
const summary = skill.shortDescription ?? skill.description;
|
|
5642
|
-
scored.push({
|
|
5643
|
-
score,
|
|
5644
|
-
suggestion: {
|
|
5645
|
-
value: skill.name,
|
|
5646
|
-
label: skill.displayName ?? skill.name,
|
|
5647
|
-
description: summary ? `Skill · ${summary}` : "Skill · inserts a message you can edit",
|
|
5648
|
-
icon: /* @__PURE__ */ jsx(Sparkles, { className: "size-3.5 text-fg-3" })
|
|
5649
|
-
}
|
|
5650
|
-
});
|
|
5651
|
-
}
|
|
5652
|
-
scored.sort((a, b) => b.score - a.score);
|
|
5653
|
-
return scored.map(({ suggestion }) => suggestion);
|
|
5654
|
-
},
|
|
5655
|
-
insertAsText: (suggestion) => {
|
|
5656
|
-
const skill = usableSkills.find((s) => s.name === suggestion.value);
|
|
5657
|
-
return skill ? skillPrompt(skill) : `$${suggestion.value} `;
|
|
5658
|
-
}
|
|
5659
|
-
}));
|
|
5660
5805
|
if (onSearchFiles) configured.push(mentionTrigger({
|
|
5661
5806
|
searchDebounceMs: 150,
|
|
5662
5807
|
onSearch: async (query, options) => {
|
|
@@ -5680,6 +5825,7 @@ function Composer({ onSend, onInterrupt, busy, disabled, placeholder = "Message
|
|
|
5680
5825
|
}, [
|
|
5681
5826
|
commands,
|
|
5682
5827
|
skills,
|
|
5828
|
+
clientCommands,
|
|
5683
5829
|
onSearchFiles,
|
|
5684
5830
|
onShellCommand
|
|
5685
5831
|
]);
|
|
@@ -5711,6 +5857,24 @@ function Composer({ onSend, onInterrupt, busy, disabled, placeholder = "Message
|
|
|
5711
5857
|
setShellMode(false);
|
|
5712
5858
|
focus();
|
|
5713
5859
|
};
|
|
5860
|
+
const hints = [
|
|
5861
|
+
triggers?.some((t) => t.char === "/") ? {
|
|
5862
|
+
key: "/",
|
|
5863
|
+
what: "commands and skills"
|
|
5864
|
+
} : void 0,
|
|
5865
|
+
onSearchFiles ? {
|
|
5866
|
+
key: "@",
|
|
5867
|
+
what: "mention a file"
|
|
5868
|
+
} : void 0,
|
|
5869
|
+
onShellCommand ? {
|
|
5870
|
+
key: "!",
|
|
5871
|
+
what: "run a shell command"
|
|
5872
|
+
} : void 0,
|
|
5873
|
+
{
|
|
5874
|
+
key: "?",
|
|
5875
|
+
what: "this list, on an empty composer"
|
|
5876
|
+
}
|
|
5877
|
+
].filter((h) => h !== void 0);
|
|
5714
5878
|
const shellKeys = shellMode ? {
|
|
5715
5879
|
onEscape: leaveShellMode,
|
|
5716
5880
|
onKeyDown: (e) => {
|
|
@@ -5719,7 +5883,30 @@ function Composer({ onSend, onInterrupt, busy, disabled, placeholder = "Message
|
|
|
5719
5883
|
leaveShellMode();
|
|
5720
5884
|
}
|
|
5721
5885
|
}
|
|
5722
|
-
} : {
|
|
5886
|
+
} : {
|
|
5887
|
+
onEscape: helpOpen ? () => setHelpOpen(false) : void 0,
|
|
5888
|
+
onKeyDown: (e) => {
|
|
5889
|
+
if (e.key === "?" && isEmpty && !e.metaKey && !e.ctrlKey) {
|
|
5890
|
+
e.preventDefault();
|
|
5891
|
+
setHelpOpen(true);
|
|
5892
|
+
return;
|
|
5893
|
+
}
|
|
5894
|
+
if (helpOpen) setHelpOpen(false);
|
|
5895
|
+
}
|
|
5896
|
+
};
|
|
5897
|
+
const helpHints = helpOpen ? /* @__PURE__ */ jsx(Fragment$1, { children: hints.map((hint) => /* @__PURE__ */ jsxs("span", {
|
|
5898
|
+
className: "flex items-center gap-1",
|
|
5899
|
+
children: [/* @__PURE__ */ jsx("kbd", {
|
|
5900
|
+
className: "font-mono text-text",
|
|
5901
|
+
children: hint.key
|
|
5902
|
+
}), hint.what]
|
|
5903
|
+
}, hint.key)) }) : null;
|
|
5904
|
+
const helpRow = helpOpen ? /* @__PURE__ */ jsx("div", {
|
|
5905
|
+
role: "note",
|
|
5906
|
+
"aria-label": "Composer shortcuts",
|
|
5907
|
+
className: "mx-auto mb-1 flex w-full max-w-[var(--wd-transcript-max-width)] flex-wrap items-center gap-x-3 gap-y-1 text-label text-fg-3",
|
|
5908
|
+
children: helpHints
|
|
5909
|
+
}) : null;
|
|
5723
5910
|
const pick = (files) => {
|
|
5724
5911
|
if (files && files.length > 0) attachments?.add(files);
|
|
5725
5912
|
};
|
|
@@ -5862,6 +6049,18 @@ function Composer({ onSend, onInterrupt, busy, disabled, placeholder = "Message
|
|
|
5862
6049
|
})
|
|
5863
6050
|
]
|
|
5864
6051
|
}),
|
|
6052
|
+
helpOpen ? /* @__PURE__ */ jsxs("div", {
|
|
6053
|
+
role: "note",
|
|
6054
|
+
"aria-label": "Composer shortcuts",
|
|
6055
|
+
className: "term-row",
|
|
6056
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
6057
|
+
"aria-hidden": true,
|
|
6058
|
+
className: "term-gutter"
|
|
6059
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
6060
|
+
className: "flex min-w-0 flex-wrap items-center gap-x-[2ch] text-fg-3",
|
|
6061
|
+
children: helpHints
|
|
6062
|
+
})]
|
|
6063
|
+
}) : null,
|
|
5865
6064
|
shellMode ? /* @__PURE__ */ jsxs("div", {
|
|
5866
6065
|
className: "term-row",
|
|
5867
6066
|
children: [/* @__PURE__ */ jsx("span", {
|
|
@@ -5889,55 +6088,59 @@ function Composer({ onSend, onInterrupt, busy, disabled, placeholder = "Message
|
|
|
5889
6088
|
return /* @__PURE__ */ jsxs("div", {
|
|
5890
6089
|
"data-slot": "composer",
|
|
5891
6090
|
className: cn("px-[var(--wd-composer-padding)] pb-[var(--wd-composer-padding)]", className),
|
|
5892
|
-
children: [
|
|
5893
|
-
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
className: "
|
|
5897
|
-
children: [
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
|
|
5932
|
-
|
|
5933
|
-
className: "flex
|
|
5934
|
-
children: [
|
|
5935
|
-
className: "
|
|
5936
|
-
children:
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
6091
|
+
children: [
|
|
6092
|
+
helpRow,
|
|
6093
|
+
/* @__PURE__ */ jsxs("div", {
|
|
6094
|
+
...dropHandlers,
|
|
6095
|
+
className: cn("mx-auto w-full max-w-[var(--wd-transcript-max-width)] overflow-hidden border border-border bg-bg", "transition-colors rounded-lg shadow-(--shadow-xs)", "focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/30", dragging && "border-ring ring-2 ring-ring/30", shellMode && "border-[var(--wd-shell-accent)] focus-within:border-[var(--wd-shell-accent)] focus-within:ring-[var(--wd-shell-accent)]/30", disabled && "opacity-60"),
|
|
6096
|
+
children: [staged.length > 0 && attachments ? /* @__PURE__ */ jsx(AttachmentStrip, { attachments }) : null, inline ? /* @__PURE__ */ jsxs("div", {
|
|
6097
|
+
className: "flex items-end gap-1 p-1",
|
|
6098
|
+
children: [
|
|
6099
|
+
shellMode ? /* @__PURE__ */ jsx(ShellBadge, { onLeave: leaveShellMode }) : attach,
|
|
6100
|
+
/* @__PURE__ */ jsx(PromptArea, {
|
|
6101
|
+
...bind,
|
|
6102
|
+
triggers,
|
|
6103
|
+
markdown: false,
|
|
6104
|
+
normalizeBullets: false,
|
|
6105
|
+
onSubmit: submit,
|
|
6106
|
+
disabled,
|
|
6107
|
+
placeholder: disabled ? "Session ended" : shellMode ? SHELL_PLACEHOLDER : placeholder,
|
|
6108
|
+
minHeight: 20,
|
|
6109
|
+
maxHeight: 192,
|
|
6110
|
+
"aria-label": shellMode ? "Run a shell command" : "Message the agent",
|
|
6111
|
+
className: "min-w-0 flex-1 py-1 text-body-sm text-text",
|
|
6112
|
+
onImagePaste: (file) => attachments?.add([file]),
|
|
6113
|
+
...shellKeys
|
|
6114
|
+
}),
|
|
6115
|
+
submitButton
|
|
6116
|
+
]
|
|
6117
|
+
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(PromptArea, {
|
|
6118
|
+
...bind,
|
|
6119
|
+
triggers,
|
|
6120
|
+
markdown: false,
|
|
6121
|
+
normalizeBullets: false,
|
|
6122
|
+
onSubmit: submit,
|
|
6123
|
+
disabled,
|
|
6124
|
+
placeholder: disabled ? "Session ended" : shellMode ? SHELL_PLACEHOLDER : placeholder,
|
|
6125
|
+
minHeight: 28,
|
|
6126
|
+
maxHeight: 192,
|
|
6127
|
+
"aria-label": shellMode ? "Run a shell command" : "Message the agent",
|
|
6128
|
+
className: "px-3 pt-2.5 pb-0 text-body-sm text-text",
|
|
6129
|
+
onImagePaste: (file) => attachments?.add([file]),
|
|
6130
|
+
...shellKeys
|
|
6131
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
6132
|
+
className: "flex items-center justify-between gap-2 px-2 pb-2",
|
|
6133
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
6134
|
+
className: "flex min-w-0 items-center gap-1",
|
|
6135
|
+
children: [shellMode ? /* @__PURE__ */ jsx(ShellBadge, { onLeave: leaveShellMode }) : attach, shellMode ? /* @__PURE__ */ jsx("span", {
|
|
6136
|
+
className: "text-label text-text-muted",
|
|
6137
|
+
children: SHELL_HINT
|
|
6138
|
+
}) : toolbar]
|
|
6139
|
+
}), submitButton]
|
|
6140
|
+
})] })]
|
|
6141
|
+
}),
|
|
6142
|
+
errorRow
|
|
6143
|
+
]
|
|
5941
6144
|
});
|
|
5942
6145
|
}
|
|
5943
6146
|
function GlyphButton({ tone, label, disabled, onClick, gutter, className, children }) {
|
|
@@ -5970,7 +6173,7 @@ function AttachmentChip({ item, onRetry, onRemove }) {
|
|
|
5970
6173
|
const round = terminal ? "" : "rounded-md";
|
|
5971
6174
|
return /* @__PURE__ */ jsxs("div", {
|
|
5972
6175
|
className: "group relative shrink-0",
|
|
5973
|
-
title: failed ? `${item.name}
|
|
6176
|
+
title: failed ? `${item.name} - ${item.error}` : `${item.name} · ${formatBytes(item.bytes)}`,
|
|
5974
6177
|
children: [
|
|
5975
6178
|
/* @__PURE__ */ jsx("div", {
|
|
5976
6179
|
className: cn("flex size-14 items-center justify-center overflow-hidden bg-surface", round, terminal ? "term-attachment" : "border border-border", failed && "border-danger/50"),
|
|
@@ -6030,9 +6233,9 @@ function cssColor(color) {
|
|
|
6030
6233
|
//#endregion
|
|
6031
6234
|
//#region src/lib/context-note.ts
|
|
6032
6235
|
const CODEX_CONTEXT_NOTE = {
|
|
6033
|
-
summary: "Codex budgets 272K input by default and reports 95% of it, so a 1M-class model reads ~258k. That is codex’s price tier, not the model’s ceiling
|
|
6034
|
-
hint: "Raising it is yours to set: model_context_window in ~/.codex/config.toml
|
|
6035
|
-
detail: ["To raise it, set model_context_window in ~/.codex/config.toml, up to 872000 (reported as 828400). Codex clamps to its own max_context_window, itself below OpenAI’s stated 922,000 max input.", "Above 272K input, a request bills at 2x input / 1.5x output for the whole request. WorkerDeck never writes this setting
|
|
6236
|
+
summary: "Codex budgets 272K input by default and reports 95% of it, so a 1M-class model reads ~258k. That is codex’s price tier, not the model’s ceiling - and it is the number auto-compaction fires on, so the meter is honest.",
|
|
6237
|
+
hint: "Raising it is yours to set: model_context_window in ~/.codex/config.toml - and watch for auto-compaction failing afterwards.",
|
|
6238
|
+
detail: ["To raise it, set model_context_window in ~/.codex/config.toml, up to 872000 (reported as 828400). Codex clamps to its own max_context_window, itself below OpenAI’s stated 922,000 max input.", "Above 272K input, a request bills at 2x input / 1.5x output for the whole request. WorkerDeck never writes this setting - it is a cost decision on your account."],
|
|
6036
6239
|
caveat: "Raise it and watch for auto-compaction failing: openai/codex #16068 reports it stops firing after the first overflow. Unverified here on 0.149.0."
|
|
6037
6240
|
};
|
|
6038
6241
|
function contextNote(engine) {
|
|
@@ -6052,7 +6255,7 @@ function ContextDialog({ usage, engine, open, onOpenChange, className }) {
|
|
|
6052
6255
|
description: usage?.model
|
|
6053
6256
|
}), /* @__PURE__ */ jsxs(DialogBody, { children: [!usage ? /* @__PURE__ */ jsx("p", {
|
|
6054
6257
|
className: "py-6 text-center text-body-sm text-fg-4",
|
|
6055
|
-
children: "No reading yet
|
|
6258
|
+
children: "No reading yet - the context window is measured after a turn completes."
|
|
6056
6259
|
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
6057
6260
|
/* @__PURE__ */ jsxs("div", {
|
|
6058
6261
|
className: "flex items-baseline justify-between gap-4",
|
|
@@ -6167,7 +6370,7 @@ function TaskList({ tasks, showCompleted, onShowCompletedChange, onSelectTask, c
|
|
|
6167
6370
|
}) : null]
|
|
6168
6371
|
}), shown.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
6169
6372
|
className: "py-6 text-center text-body-sm text-fg-4",
|
|
6170
|
-
children: tasks.length === 0 ? "No tasks yet
|
|
6373
|
+
children: tasks.length === 0 ? "No tasks yet - a checklist appears once the agent plans one." : `${hidden} completed, all hidden.`
|
|
6171
6374
|
}) : /* @__PURE__ */ jsx("div", {
|
|
6172
6375
|
className: "flex flex-col",
|
|
6173
6376
|
children: shown.map((task) => /* @__PURE__ */ jsx(TaskRow$1, {
|
|
@@ -6305,7 +6508,7 @@ function HostFilesDialog({ client, cwd, open, onOpenChange }) {
|
|
|
6305
6508
|
setFile({
|
|
6306
6509
|
path: response.path,
|
|
6307
6510
|
bytes: response.bytes,
|
|
6308
|
-
content: response.encoding === "utf8" ? response.content : "(binary file
|
|
6511
|
+
content: response.encoding === "utf8" ? response.content : "(binary file - not shown)"
|
|
6309
6512
|
});
|
|
6310
6513
|
} catch (e) {
|
|
6311
6514
|
setError(e instanceof Error ? e.message : "Could not read that file");
|
|
@@ -6391,7 +6594,7 @@ function HostFilesDialog({ client, cwd, open, onOpenChange }) {
|
|
|
6391
6594
|
}),
|
|
6392
6595
|
truncated && !matches ? /* @__PURE__ */ jsx("p", {
|
|
6393
6596
|
className: "text-label text-fg-4",
|
|
6394
|
-
children: "More entries than the server will return
|
|
6597
|
+
children: "More entries than the server will return - use the search box."
|
|
6395
6598
|
}) : null
|
|
6396
6599
|
] })]
|
|
6397
6600
|
})]
|
|
@@ -6689,7 +6892,7 @@ function SkillsDialog({ skills, open, onOpenChange, onUse, className }) {
|
|
|
6689
6892
|
className,
|
|
6690
6893
|
children: [/* @__PURE__ */ jsx(DialogHeader, {
|
|
6691
6894
|
title: skill ? skill.displayName ?? skill.name : "Skills",
|
|
6692
|
-
description: skill ? skill.name !== (skill.displayName ?? skill.name) ? skill.name : void 0 : "Capabilities the agent can choose to use. Not commands
|
|
6895
|
+
description: skill ? skill.name !== (skill.displayName ?? skill.name) ? skill.name : void 0 : "Capabilities the agent can choose to use. Not commands - the model picks them from their descriptions.",
|
|
6693
6896
|
actions: skill ? /* @__PURE__ */ jsxs(Button, {
|
|
6694
6897
|
variant: "ghost",
|
|
6695
6898
|
size: "xs",
|
|
@@ -6710,7 +6913,7 @@ function SkillsDialog({ skills, open, onOpenChange, onUse, className }) {
|
|
|
6710
6913
|
function SkillList({ skills, onSelect }) {
|
|
6711
6914
|
if (!skills) return /* @__PURE__ */ jsx("p", {
|
|
6712
6915
|
className: "py-6 text-center text-body-sm text-fg-4",
|
|
6713
|
-
children: "Skills are listed once the session connects
|
|
6916
|
+
children: "Skills are listed once the session connects - send a message first."
|
|
6714
6917
|
});
|
|
6715
6918
|
if (skills.length === 0) return /* @__PURE__ */ jsx("p", {
|
|
6716
6919
|
className: "py-6 text-center text-body-sm text-fg-4",
|
|
@@ -6785,7 +6988,7 @@ function SkillView({ skill, onUse, onUsed }) {
|
|
|
6785
6988
|
children: "Use this skill"
|
|
6786
6989
|
}), /* @__PURE__ */ jsx("p", {
|
|
6787
6990
|
className: "mt-1.5 text-label text-fg-4",
|
|
6788
|
-
children: "Writes an opening message into the composer for you to edit
|
|
6991
|
+
children: "Writes an opening message into the composer for you to edit - it isn’t sent, and there is no command that runs a skill directly."
|
|
6789
6992
|
})] }) : null
|
|
6790
6993
|
]
|
|
6791
6994
|
});
|
|
@@ -6884,14 +7087,14 @@ const PERMISSION_MODES = [
|
|
|
6884
7087
|
value: "dontAsk",
|
|
6885
7088
|
label: "Don't ask",
|
|
6886
7089
|
shortLabel: "Don't ask",
|
|
6887
|
-
description: "Never ask
|
|
7090
|
+
description: "Never ask - deny anything not pre-approved",
|
|
6888
7091
|
icon: ShieldCheck
|
|
6889
7092
|
},
|
|
6890
7093
|
{
|
|
6891
7094
|
value: "bypassPermissions",
|
|
6892
7095
|
label: "Bypass permissions",
|
|
6893
7096
|
shortLabel: "Bypass",
|
|
6894
|
-
description: "Skip every approval
|
|
7097
|
+
description: "Skip every approval - the agent is unsupervised",
|
|
6895
7098
|
icon: TriangleAlert,
|
|
6896
7099
|
dangerous: true
|
|
6897
7100
|
}
|
|
@@ -7080,7 +7283,7 @@ function PermissionPrompt({ request, onApprove, onDeny, className }) {
|
|
|
7080
7283
|
if (e.key === "Enter") deny(false);
|
|
7081
7284
|
if (e.key === "Escape") setDenying(false);
|
|
7082
7285
|
},
|
|
7083
|
-
placeholder: plan ? "What should change? (optional)
|
|
7286
|
+
placeholder: plan ? "What should change? (optional) - the agent keeps planning and reads this" : "Reason (optional) - the agent reads this and can try something else",
|
|
7084
7287
|
className: "h-7 flex-1"
|
|
7085
7288
|
}),
|
|
7086
7289
|
/* @__PURE__ */ jsx(Button, {
|
|
@@ -7638,7 +7841,7 @@ function TerminalPermissionPrompt({ request, onApprove, onDeny, className }) {
|
|
|
7638
7841
|
onChange: setReason,
|
|
7639
7842
|
onSubmit: () => deny(false),
|
|
7640
7843
|
onCancel: () => setDenying(false),
|
|
7641
|
-
placeholder: plan ? "What should change? (optional)
|
|
7844
|
+
placeholder: plan ? "What should change? (optional) - the agent keeps planning and reads this" : "Reason (optional) - the agent reads this and can try something else"
|
|
7642
7845
|
}) : void 0;
|
|
7643
7846
|
const options = plan ? [
|
|
7644
7847
|
{
|
|
@@ -7647,7 +7850,7 @@ function TerminalPermissionPrompt({ request, onApprove, onDeny, className }) {
|
|
|
7647
7850
|
},
|
|
7648
7851
|
{
|
|
7649
7852
|
key: "deny",
|
|
7650
|
-
label: "Keep planning
|
|
7853
|
+
label: "Keep planning - tell it what to change",
|
|
7651
7854
|
detail: reasonInput
|
|
7652
7855
|
},
|
|
7653
7856
|
{
|
|
@@ -7720,7 +7923,7 @@ function TerminalPermissionPrompt({ request, onApprove, onDeny, className }) {
|
|
|
7720
7923
|
}
|
|
7721
7924
|
}),
|
|
7722
7925
|
/* @__PURE__ */ jsx(Blank, {}),
|
|
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
|
|
7926
|
+
/* @__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" })
|
|
7724
7927
|
]
|
|
7725
7928
|
});
|
|
7726
7929
|
}
|
|
@@ -8208,7 +8411,7 @@ function RateLimitMeter({ label, info, now }) {
|
|
|
8208
8411
|
className: "flex items-center justify-between gap-2",
|
|
8209
8412
|
children: [/* @__PURE__ */ jsxs("span", { children: [label, " usage"] }), /* @__PURE__ */ jsx("span", {
|
|
8210
8413
|
className: "font-mono text-fg-3",
|
|
8211
|
-
children: pct !== void 0 ? `${pct.toFixed(1)}%` : "
|
|
8414
|
+
children: pct !== void 0 ? `${pct.toFixed(1)}%` : "-"
|
|
8212
8415
|
})]
|
|
8213
8416
|
}),
|
|
8214
8417
|
resetsAtMs !== void 0 ? /* @__PURE__ */ jsxs("div", {
|
|
@@ -8506,8 +8709,8 @@ function clusterCells(cluster) {
|
|
|
8506
8709
|
const TAB_SIZE = 2;
|
|
8507
8710
|
const BREAK_AFTER = /* @__PURE__ */ new Set([
|
|
8508
8711
|
"-",
|
|
8509
|
-
"
|
|
8510
|
-
"
|
|
8712
|
+
"-",
|
|
8713
|
+
"-",
|
|
8511
8714
|
"?"
|
|
8512
8715
|
]);
|
|
8513
8716
|
const PLAIN_ASCII = /^[\x20-\x7e]*$/;
|
|
@@ -11009,6 +11212,7 @@ function UsageMeters({ windows, now, className }) {
|
|
|
11009
11212
|
function UsageMeter({ window, now }) {
|
|
11010
11213
|
const { key: windowKey, info, updatedAt, inferredReset } = window;
|
|
11011
11214
|
const utilization = info.utilization ?? 0;
|
|
11215
|
+
const stale = usageIsStale(window, now);
|
|
11012
11216
|
const resetsAtMs = info.resetsAt !== void 0 ? info.resetsAt * 1e3 : void 0;
|
|
11013
11217
|
const duration = rateLimitWindowSeconds(windowKey);
|
|
11014
11218
|
const remaining = resetsAtMs !== void 0 ? (resetsAtMs - now) / 1e3 : void 0;
|
|
@@ -11020,14 +11224,14 @@ function UsageMeter({ window, now }) {
|
|
|
11020
11224
|
className: "truncate text-body-sm text-fg-1",
|
|
11021
11225
|
children: formatRateLimitWindowLong(windowKey)
|
|
11022
11226
|
}), /* @__PURE__ */ jsxs("span", {
|
|
11023
|
-
className: cn("shrink-0 font-mono text-body-sm font-medium", info.status === "rejected" ? "text-danger" : "text-fg-1"),
|
|
11227
|
+
className: cn("shrink-0 font-mono text-body-sm font-medium", info.status === "rejected" ? "text-danger" : stale ? "text-fg-4" : "text-fg-1"),
|
|
11024
11228
|
children: [utilization.toFixed(0), "% used"]
|
|
11025
11229
|
})]
|
|
11026
11230
|
}),
|
|
11027
11231
|
/* @__PURE__ */ jsxs("div", {
|
|
11028
11232
|
className: "relative mt-2 h-2 rounded-full bg-border",
|
|
11029
11233
|
children: [/* @__PURE__ */ jsx("div", {
|
|
11030
|
-
className: cn("h-full rounded-full", meterTintClass(utilization)),
|
|
11234
|
+
className: cn("h-full rounded-full", meterTintClass(utilization), stale && "opacity-40"),
|
|
11031
11235
|
style: { width: `${Math.min(100, Math.max(2, utilization))}%` }
|
|
11032
11236
|
}), pace !== void 0 ? /* @__PURE__ */ jsx("span", {
|
|
11033
11237
|
"aria-hidden": true,
|
|
@@ -11056,7 +11260,10 @@ function UsageMeter({ window, now }) {
|
|
|
11056
11260
|
children: "limit reached"
|
|
11057
11261
|
}) : null,
|
|
11058
11262
|
inferredReset ? /* @__PURE__ */ jsx("span", { children: "window reset · nothing reported since" }) : null,
|
|
11059
|
-
updatedAt && !inferredReset ? /* @__PURE__ */
|
|
11263
|
+
updatedAt && !inferredReset ? /* @__PURE__ */ jsxs("span", {
|
|
11264
|
+
className: cn(stale && "text-warning"),
|
|
11265
|
+
children: [stale ? "last reported " : "", formatAgoPrecise(updatedAt, now)]
|
|
11266
|
+
}) : null
|
|
11060
11267
|
]
|
|
11061
11268
|
})
|
|
11062
11269
|
] });
|
|
@@ -11081,7 +11288,7 @@ function UsageDialog({ rateLimits, subscriptionType, engine, totalCostUsd, updat
|
|
|
11081
11288
|
}), /* @__PURE__ */ jsxs(DialogBody, { children: [
|
|
11082
11289
|
rateLimits.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
11083
11290
|
className: "py-6 text-center text-body-sm text-fg-4",
|
|
11084
|
-
children: engine === "claude" ? "This session reports no plan windows
|
|
11291
|
+
children: engine === "claude" ? "This session reports no plan windows - API-key sessions have none, and a subscription session reports them once a turn has run." : `Plan windows are a claude.ai subscription thing; this session runs on the ${engine} engine.`
|
|
11085
11292
|
}) : /* @__PURE__ */ jsx(UsageMeters, {
|
|
11086
11293
|
windows: rateLimits,
|
|
11087
11294
|
now
|
|
@@ -11135,7 +11342,7 @@ const INTERACTIVE = [
|
|
|
11135
11342
|
"[role=\"radio\"]",
|
|
11136
11343
|
"[role=\"tab\"]"
|
|
11137
11344
|
].join(",");
|
|
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 }) {
|
|
11345
|
+
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, onOpenFile, fontSize, className }) {
|
|
11139
11346
|
const effectiveTermFontSize = terminalMetrics?.fontSize ?? fontSize;
|
|
11140
11347
|
const effectiveTermLineHeight = terminalMetrics?.lineHeight ?? (fontSize !== void 0 ? Math.round(fontSize * (18 / 13)) : void 0);
|
|
11141
11348
|
const external = panelSurface === "external";
|
|
@@ -11146,7 +11353,7 @@ function SessionPanel({ client, sessionId, header, panelSurface = "internal", st
|
|
|
11146
11353
|
const [panel, setPanel] = useState();
|
|
11147
11354
|
const [showCompletedTasks, setShowCompletedTasks] = useState(false);
|
|
11148
11355
|
const [taskReveal, setTaskReveal] = useState();
|
|
11149
|
-
const { state, connection, replaying, protocolMismatch, shell, models, effectiveModel, handle, send, runShell, approve, deny, interrupt, setModel, setPermissionMode, reconnectNow, loadFullResult } = useClaudeSession(client, sessionId, {
|
|
11356
|
+
const { state, connection, replaying, protocolMismatch, shell, models, effectiveModel, handle, send, runShell, approve, deny, interrupt, clearContext, setModel, setPermissionMode, reconnectNow, loadFullResult } = useClaudeSession(client, sessionId, {
|
|
11150
11357
|
onProtocolError: setProtocolError,
|
|
11151
11358
|
cacheTranscript
|
|
11152
11359
|
});
|
|
@@ -11208,6 +11415,86 @@ function SessionPanel({ client, sessionId, header, panelSurface = "internal", st
|
|
|
11208
11415
|
subagents,
|
|
11209
11416
|
state.session?.subagents
|
|
11210
11417
|
]);
|
|
11418
|
+
const clientCommands = useMemo(() => {
|
|
11419
|
+
const modes = capabilities.permissionModes;
|
|
11420
|
+
const built = [];
|
|
11421
|
+
if (models.length > 0) built.push({
|
|
11422
|
+
name: "model",
|
|
11423
|
+
description: "Switch the model for this session",
|
|
11424
|
+
argumentHint: "<model>",
|
|
11425
|
+
requiresArgs: true,
|
|
11426
|
+
run: (args) => {
|
|
11427
|
+
const wanted = args.split(/\s+/)[0];
|
|
11428
|
+
if (!wanted) return false;
|
|
11429
|
+
setModel(wanted);
|
|
11430
|
+
return true;
|
|
11431
|
+
}
|
|
11432
|
+
});
|
|
11433
|
+
if (modes.length > 1) built.push({
|
|
11434
|
+
name: "permissions",
|
|
11435
|
+
description: `Set the permission mode (${modes.join(", ")})`,
|
|
11436
|
+
argumentHint: "<mode>",
|
|
11437
|
+
requiresArgs: true,
|
|
11438
|
+
run: (args) => {
|
|
11439
|
+
const wanted = args.split(/\s+/)[0];
|
|
11440
|
+
if (!modes.includes(wanted)) return false;
|
|
11441
|
+
setPermissionMode(wanted);
|
|
11442
|
+
return true;
|
|
11443
|
+
}
|
|
11444
|
+
});
|
|
11445
|
+
if (capabilities.clearContext) built.push({
|
|
11446
|
+
name: "clear",
|
|
11447
|
+
description: "Clear the conversation - the session keeps running and the old one stays resumable",
|
|
11448
|
+
run: () => {
|
|
11449
|
+
clearContext();
|
|
11450
|
+
return true;
|
|
11451
|
+
}
|
|
11452
|
+
});
|
|
11453
|
+
if (capabilities.mcpStatus) built.push({
|
|
11454
|
+
name: "mcp",
|
|
11455
|
+
description: "MCP servers and their status",
|
|
11456
|
+
run: () => (openPanel("mcp"), true)
|
|
11457
|
+
});
|
|
11458
|
+
if (capabilities.contextUsage) built.push({
|
|
11459
|
+
name: "context",
|
|
11460
|
+
description: "Context window usage",
|
|
11461
|
+
run: () => (openPanel("context"), true)
|
|
11462
|
+
});
|
|
11463
|
+
built.push({
|
|
11464
|
+
name: "status",
|
|
11465
|
+
description: "Session details",
|
|
11466
|
+
run: () => (openPanel("info"), true)
|
|
11467
|
+
});
|
|
11468
|
+
if (capabilities.rateLimits) built.push({
|
|
11469
|
+
name: "usage",
|
|
11470
|
+
description: "Rate limits and spend",
|
|
11471
|
+
run: () => (openPanel("usage"), true)
|
|
11472
|
+
});
|
|
11473
|
+
if (capabilities.skillsList) built.push({
|
|
11474
|
+
name: "skills",
|
|
11475
|
+
description: "Browse the skills this session can use",
|
|
11476
|
+
run: () => (openPanel("skills"), true)
|
|
11477
|
+
});
|
|
11478
|
+
return built;
|
|
11479
|
+
}, [
|
|
11480
|
+
capabilities,
|
|
11481
|
+
models.length,
|
|
11482
|
+
openPanel,
|
|
11483
|
+
clearContext,
|
|
11484
|
+
setModel,
|
|
11485
|
+
setPermissionMode
|
|
11486
|
+
]);
|
|
11487
|
+
const composerCommands = useMemo(() => composerCommandRows(mergeComposerRows({
|
|
11488
|
+
commands: capabilities.slashCommands ? state.commands : void 0,
|
|
11489
|
+
clientCommands,
|
|
11490
|
+
skills: capabilities.skillsList ? state.skills : void 0
|
|
11491
|
+
})), [
|
|
11492
|
+
capabilities.slashCommands,
|
|
11493
|
+
capabilities.skillsList,
|
|
11494
|
+
state.commands,
|
|
11495
|
+
state.skills,
|
|
11496
|
+
clientCommands
|
|
11497
|
+
]);
|
|
11211
11498
|
const onVitalsRef = useRef(onVitals);
|
|
11212
11499
|
onVitalsRef.current = onVitals;
|
|
11213
11500
|
const vitalsModel = effectiveModel ?? state.model;
|
|
@@ -11223,6 +11510,7 @@ function SessionPanel({ client, sessionId, header, panelSurface = "internal", st
|
|
|
11223
11510
|
permissionMode: state.permissionMode,
|
|
11224
11511
|
permissionModes,
|
|
11225
11512
|
skills: state.skills,
|
|
11513
|
+
composerCommands,
|
|
11226
11514
|
cwd: state.cwd,
|
|
11227
11515
|
contextUsage: state.contextUsage,
|
|
11228
11516
|
tasks,
|
|
@@ -11241,6 +11529,7 @@ function SessionPanel({ client, sessionId, header, panelSurface = "internal", st
|
|
|
11241
11529
|
state.permissionMode,
|
|
11242
11530
|
permissionModes,
|
|
11243
11531
|
state.skills,
|
|
11532
|
+
composerCommands,
|
|
11244
11533
|
state.cwd,
|
|
11245
11534
|
state.contextUsage,
|
|
11246
11535
|
tasks,
|
|
@@ -11296,26 +11585,10 @@ function SessionPanel({ client, sessionId, header, panelSurface = "internal", st
|
|
|
11296
11585
|
const composerRef = useRef(null);
|
|
11297
11586
|
const jumpToRecap = useRef(null);
|
|
11298
11587
|
const repinTranscript = useRef(null);
|
|
11299
|
-
const commands = useMemo(() => {
|
|
11300
|
-
if (!state.commands) return;
|
|
11301
|
-
if (state.commands.some((c) => c.name === "model")) return state.commands;
|
|
11302
|
-
return [{
|
|
11303
|
-
name: "model",
|
|
11304
|
-
description: "Switch the model for this session",
|
|
11305
|
-
argumentHint: "<model>"
|
|
11306
|
-
}, ...state.commands];
|
|
11307
|
-
}, [state.commands]);
|
|
11308
11588
|
const handleSend = (text, attachmentIds) => {
|
|
11309
11589
|
if (attachmentIds.length === 0) {
|
|
11310
|
-
const
|
|
11311
|
-
if (
|
|
11312
|
-
setModel(modelCommand[1]);
|
|
11313
|
-
return;
|
|
11314
|
-
}
|
|
11315
|
-
if (capabilities.mcpStatus && text.trim() === "/mcp") {
|
|
11316
|
-
openPanel("mcp");
|
|
11317
|
-
return;
|
|
11318
|
-
}
|
|
11590
|
+
const local = matchClientCommand(text, clientCommands);
|
|
11591
|
+
if (local && local.command.run(local.args)) return;
|
|
11319
11592
|
}
|
|
11320
11593
|
setCaughtUp(true);
|
|
11321
11594
|
repinTranscript.current?.();
|
|
@@ -11381,6 +11654,10 @@ function SessionPanel({ client, sessionId, header, panelSurface = "internal", st
|
|
|
11381
11654
|
onOpenTasks: external && !onOpenPanel ? void 0 : () => openPanel("tasks"),
|
|
11382
11655
|
actions: headerTakesActions ? void 0 : menu
|
|
11383
11656
|
});
|
|
11657
|
+
const fileLinks = useMemo(() => onOpenFile ? {
|
|
11658
|
+
cwd: state.cwd,
|
|
11659
|
+
open: onOpenFile
|
|
11660
|
+
} : void 0, [onOpenFile, state.cwd]);
|
|
11384
11661
|
const panelRef = useRef(null);
|
|
11385
11662
|
useEffect(() => {
|
|
11386
11663
|
if (!onLinkClick) return;
|
|
@@ -11409,224 +11686,228 @@ function SessionPanel({ client, sessionId, header, panelSurface = "internal", st
|
|
|
11409
11686
|
value: transcriptVariant,
|
|
11410
11687
|
children: /* @__PURE__ */ jsx(TranscriptDensityProvider, {
|
|
11411
11688
|
value: transcriptDensity,
|
|
11412
|
-
children: /* @__PURE__ */ jsx(
|
|
11413
|
-
value:
|
|
11414
|
-
children: /* @__PURE__ */ jsx(
|
|
11415
|
-
value:
|
|
11416
|
-
children: /* @__PURE__ */ jsx(
|
|
11417
|
-
value:
|
|
11418
|
-
children: /* @__PURE__ */
|
|
11419
|
-
|
|
11420
|
-
|
|
11421
|
-
|
|
11422
|
-
|
|
11423
|
-
|
|
11424
|
-
|
|
11425
|
-
|
|
11426
|
-
|
|
11427
|
-
|
|
11428
|
-
|
|
11429
|
-
|
|
11430
|
-
|
|
11431
|
-
|
|
11432
|
-
protocolMismatch,
|
|
11433
|
-
", this build renders v",
|
|
11434
|
-
PROTOCOL_VERSION,
|
|
11435
|
-
". Some events may not render."
|
|
11436
|
-
]
|
|
11437
|
-
}) : null,
|
|
11438
|
-
protocolError ? /* @__PURE__ */ jsx(Notice, {
|
|
11439
|
-
level: "error",
|
|
11440
|
-
onDismiss: () => setProtocolError(void 0),
|
|
11441
|
-
children: protocolError
|
|
11442
|
-
}) : null,
|
|
11443
|
-
subagentId !== void 0 ? /* @__PURE__ */ jsx(SubagentStrip, {
|
|
11444
|
-
task: subagentTask,
|
|
11445
|
-
items: subagentFrameItems,
|
|
11446
|
-
label: subagentFallbackLabel,
|
|
11447
|
-
onBack: leaveSubagent,
|
|
11448
|
-
terminal,
|
|
11449
|
-
fontSize: effectiveTermFontSize,
|
|
11450
|
-
lineHeight: effectiveTermLineHeight
|
|
11451
|
-
}) : null,
|
|
11452
|
-
/* @__PURE__ */ jsx(BookmarkProvider, {
|
|
11453
|
-
value: bookmarkHandle,
|
|
11454
|
-
children: /* @__PURE__ */ jsx(Transcript, {
|
|
11455
|
-
state,
|
|
11456
|
-
fileUrl: sessionId ? (path) => client.sessionFileUrl(sessionId, path) : void 0,
|
|
11457
|
-
attachmentUrl: sessionId ? (id) => client.attachmentUrl(sessionId, id) : void 0,
|
|
11458
|
-
canBrowseFiles: hostFiles.available,
|
|
11459
|
-
hostImage,
|
|
11460
|
-
variant: transcriptVariant,
|
|
11461
|
-
density: transcriptDensity,
|
|
11462
|
-
fontSize: effectiveTermFontSize,
|
|
11463
|
-
lineHeight: effectiveTermLineHeight,
|
|
11464
|
-
affordances,
|
|
11465
|
-
stickyPrompt,
|
|
11466
|
-
scrubber,
|
|
11467
|
-
bookmarks,
|
|
11468
|
-
replaying,
|
|
11469
|
-
catchUp: catchUp && newCount > 0 ? {
|
|
11470
|
-
from: catchUp.itemCount,
|
|
11471
|
-
since: catchUp.since
|
|
11472
|
-
} : void 0,
|
|
11473
|
-
reveal: taskReveal ?? returnReveal ?? reveal,
|
|
11474
|
-
frame: subagentId === void 0 ? void 0 : { parentToolUseId: subagentId },
|
|
11475
|
-
onOpenSubagent: enterSubagent,
|
|
11476
|
-
emptyState,
|
|
11477
|
-
jumpToRecapRef: jumpToRecap,
|
|
11478
|
-
repinRef: repinTranscript
|
|
11479
|
-
}, subagentId ?? "session")
|
|
11480
|
-
}),
|
|
11481
|
-
catchUp && newCount > 0 && !replaying && subagentId === void 0 ? /* @__PURE__ */ jsx("div", {
|
|
11482
|
-
className: "px-3 pb-1",
|
|
11483
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
11484
|
-
"data-slot": "catch-up",
|
|
11485
|
-
className: "mx-auto flex w-full max-w-[var(--wd-transcript-max-width)] items-center gap-2 text-label text-fg-3",
|
|
11689
|
+
children: /* @__PURE__ */ jsx(FileLinkProvider, {
|
|
11690
|
+
value: fileLinks,
|
|
11691
|
+
children: /* @__PURE__ */ jsx(ToolResultFetchProvider, {
|
|
11692
|
+
value: loadFullResult,
|
|
11693
|
+
children: /* @__PURE__ */ jsx(ToolTitleProvider, {
|
|
11694
|
+
value: state.toolTitles,
|
|
11695
|
+
children: /* @__PURE__ */ jsx(ToolResultImageProvider, {
|
|
11696
|
+
value: resultImages,
|
|
11697
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
11698
|
+
ref: panelRef,
|
|
11699
|
+
"data-slot": "session-panel",
|
|
11700
|
+
"data-agent-font": transcriptFont,
|
|
11701
|
+
onClick: handleClick,
|
|
11702
|
+
className: cn("flex h-full min-h-0 flex-col overflow-hidden bg-bg", className),
|
|
11703
|
+
style: fontSize !== void 0 ? { "--wd-font-size": `${Math.round(fontSize)}px` } : void 0,
|
|
11704
|
+
children: [
|
|
11705
|
+
headerTakesActions ? header({ actions: menu }) : header,
|
|
11706
|
+
statusPlacement === "top" ? statusBar : null,
|
|
11707
|
+
protocolMismatch !== void 0 ? /* @__PURE__ */ jsxs(Notice, {
|
|
11708
|
+
level: "warning",
|
|
11486
11709
|
children: [
|
|
11487
|
-
|
|
11488
|
-
|
|
11489
|
-
|
|
11490
|
-
|
|
11491
|
-
|
|
11492
|
-
/* @__PURE__ */ jsxs("span", {
|
|
11493
|
-
className: "min-w-0 flex-1 truncate",
|
|
11494
|
-
children: [
|
|
11495
|
-
newCount,
|
|
11496
|
-
" new ",
|
|
11497
|
-
newCount === 1 ? "row" : "rows",
|
|
11498
|
-
catchUp.since !== void 0 ? ` since you were last here` : ""
|
|
11499
|
-
]
|
|
11500
|
-
}),
|
|
11501
|
-
/* @__PURE__ */ jsx("button", {
|
|
11502
|
-
type: "button",
|
|
11503
|
-
onClick: () => jumpToRecap.current?.(),
|
|
11504
|
-
className: "shrink-0 underline-offset-2 hover:text-fg-1 hover:underline",
|
|
11505
|
-
children: "jump"
|
|
11506
|
-
}),
|
|
11507
|
-
/* @__PURE__ */ jsx("button", {
|
|
11508
|
-
type: "button",
|
|
11509
|
-
onClick: () => setCaughtUp(true),
|
|
11510
|
-
className: "shrink-0 underline-offset-2 hover:text-fg-1 hover:underline",
|
|
11511
|
-
children: "dismiss"
|
|
11512
|
-
})
|
|
11710
|
+
"Server speaks protocol v",
|
|
11711
|
+
protocolMismatch,
|
|
11712
|
+
", this build renders v",
|
|
11713
|
+
PROTOCOL_VERSION,
|
|
11714
|
+
". Some events may not render."
|
|
11513
11715
|
]
|
|
11514
|
-
})
|
|
11515
|
-
|
|
11516
|
-
|
|
11517
|
-
|
|
11518
|
-
|
|
11716
|
+
}) : null,
|
|
11717
|
+
protocolError ? /* @__PURE__ */ jsx(Notice, {
|
|
11718
|
+
level: "error",
|
|
11719
|
+
onDismiss: () => setProtocolError(void 0),
|
|
11720
|
+
children: protocolError
|
|
11721
|
+
}) : null,
|
|
11722
|
+
subagentId !== void 0 ? /* @__PURE__ */ jsx(SubagentStrip, {
|
|
11723
|
+
task: subagentTask,
|
|
11724
|
+
items: subagentFrameItems,
|
|
11725
|
+
label: subagentFallbackLabel,
|
|
11726
|
+
onBack: leaveSubagent,
|
|
11519
11727
|
terminal,
|
|
11520
|
-
|
|
11728
|
+
fontSize: effectiveTermFontSize,
|
|
11729
|
+
lineHeight: effectiveTermLineHeight
|
|
11730
|
+
}) : null,
|
|
11731
|
+
/* @__PURE__ */ jsx(BookmarkProvider, {
|
|
11732
|
+
value: bookmarkHandle,
|
|
11733
|
+
children: /* @__PURE__ */ jsx(Transcript, {
|
|
11734
|
+
state,
|
|
11735
|
+
fileUrl: sessionId ? (path) => client.sessionFileUrl(sessionId, path) : void 0,
|
|
11736
|
+
attachmentUrl: sessionId ? (id) => client.attachmentUrl(sessionId, id) : void 0,
|
|
11737
|
+
canBrowseFiles: hostFiles.available,
|
|
11738
|
+
hostImage,
|
|
11739
|
+
variant: transcriptVariant,
|
|
11740
|
+
density: transcriptDensity,
|
|
11521
11741
|
fontSize: effectiveTermFontSize,
|
|
11522
|
-
lineHeight: effectiveTermLineHeight
|
|
11523
|
-
|
|
11524
|
-
|
|
11525
|
-
|
|
11526
|
-
|
|
11527
|
-
|
|
11528
|
-
|
|
11529
|
-
|
|
11530
|
-
|
|
11531
|
-
},
|
|
11532
|
-
|
|
11533
|
-
|
|
11534
|
-
|
|
11535
|
-
|
|
11536
|
-
|
|
11537
|
-
|
|
11538
|
-
|
|
11539
|
-
onApprove: approve,
|
|
11540
|
-
onDeny: deny
|
|
11541
|
-
}, request.id);
|
|
11542
|
-
return isQuestion ? /* @__PURE__ */ jsx(QuestionPrompt, {
|
|
11543
|
-
request,
|
|
11544
|
-
onAnswer: approve,
|
|
11545
|
-
onDismiss: (id) => deny(id, "Question dismissed by user")
|
|
11546
|
-
}, request.id) : /* @__PURE__ */ jsx(PermissionPrompt, {
|
|
11547
|
-
request,
|
|
11548
|
-
onApprove: approve,
|
|
11549
|
-
onDeny: deny
|
|
11550
|
-
}, request.id);
|
|
11551
|
-
})
|
|
11552
|
-
})
|
|
11553
|
-
}) : null,
|
|
11554
|
-
readOnly || subagentId !== void 0 ? null : /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Composer, {
|
|
11555
|
-
ref: composerRef,
|
|
11556
|
-
onSend: handleSend,
|
|
11557
|
-
onInterrupt: interrupt,
|
|
11558
|
-
busy,
|
|
11559
|
-
disabled: ended || !sessionId,
|
|
11560
|
-
commands: capabilities.slashCommands ? commands : void 0,
|
|
11561
|
-
skills: capabilities.skillsList ? state.skills : void 0,
|
|
11562
|
-
attachments,
|
|
11563
|
-
draft,
|
|
11564
|
-
onSearchFiles: hostFiles.available ? searchComposerFiles : void 0,
|
|
11565
|
-
onShellCommand: shell ? runShell : void 0,
|
|
11566
|
-
layout: controlsExternal ? "inline" : "stacked",
|
|
11567
|
-
toolbar: controlsExternal ? void 0 : sessionControls,
|
|
11568
|
-
fontSize: effectiveTermFontSize,
|
|
11569
|
-
lineHeight: effectiveTermLineHeight,
|
|
11570
|
-
affordances
|
|
11571
|
-
}) }),
|
|
11572
|
-
statusPlacement === "bottom" ? statusBar : null,
|
|
11573
|
-
!external ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
11574
|
-
/* @__PURE__ */ jsx(SessionInfoDialog, {
|
|
11575
|
-
state,
|
|
11576
|
-
client,
|
|
11577
|
-
sessionId,
|
|
11578
|
-
open: panel === "info",
|
|
11579
|
-
onOpenChange: (next) => setPanel(next ? "info" : void 0)
|
|
11580
|
-
}),
|
|
11581
|
-
/* @__PURE__ */ jsx(ContextDialog, {
|
|
11582
|
-
usage: state.contextUsage,
|
|
11583
|
-
engine: state.engine ?? "claude",
|
|
11584
|
-
open: panel === "context",
|
|
11585
|
-
onOpenChange: (next) => setPanel(next ? "context" : void 0)
|
|
11586
|
-
}),
|
|
11587
|
-
/* @__PURE__ */ jsx(UsageDialog, {
|
|
11588
|
-
rateLimits: windows,
|
|
11589
|
-
subscriptionType: state.subscriptionType,
|
|
11590
|
-
engine: state.engine ?? "claude",
|
|
11591
|
-
totalCostUsd: state.totalCostUsd,
|
|
11592
|
-
updatedAt: usageUpdatedAt,
|
|
11593
|
-
open: panel === "usage",
|
|
11594
|
-
onOpenChange: (next) => setPanel(next ? "usage" : void 0)
|
|
11595
|
-
}),
|
|
11596
|
-
/* @__PURE__ */ jsx(McpDialog, {
|
|
11597
|
-
client,
|
|
11598
|
-
sessionId,
|
|
11599
|
-
canManageServers: capabilities.mcpServerActions,
|
|
11600
|
-
open: panel === "mcp",
|
|
11601
|
-
onOpenChange: (next) => setPanel(next ? "mcp" : void 0)
|
|
11742
|
+
lineHeight: effectiveTermLineHeight,
|
|
11743
|
+
affordances,
|
|
11744
|
+
stickyPrompt,
|
|
11745
|
+
scrubber,
|
|
11746
|
+
bookmarks,
|
|
11747
|
+
replaying,
|
|
11748
|
+
catchUp: catchUp && newCount > 0 ? {
|
|
11749
|
+
from: catchUp.itemCount,
|
|
11750
|
+
since: catchUp.since
|
|
11751
|
+
} : void 0,
|
|
11752
|
+
reveal: taskReveal ?? returnReveal ?? reveal,
|
|
11753
|
+
frame: subagentId === void 0 ? void 0 : { parentToolUseId: subagentId },
|
|
11754
|
+
onOpenSubagent: enterSubagent,
|
|
11755
|
+
emptyState,
|
|
11756
|
+
jumpToRecapRef: jumpToRecap,
|
|
11757
|
+
repinRef: repinTranscript
|
|
11758
|
+
}, subagentId ?? "session")
|
|
11602
11759
|
}),
|
|
11603
|
-
/* @__PURE__ */ jsx(
|
|
11604
|
-
|
|
11605
|
-
|
|
11606
|
-
|
|
11607
|
-
|
|
11608
|
-
|
|
11609
|
-
|
|
11610
|
-
|
|
11611
|
-
|
|
11612
|
-
|
|
11613
|
-
|
|
11614
|
-
|
|
11615
|
-
|
|
11616
|
-
|
|
11617
|
-
|
|
11618
|
-
|
|
11619
|
-
|
|
11620
|
-
|
|
11621
|
-
|
|
11622
|
-
|
|
11623
|
-
|
|
11624
|
-
|
|
11625
|
-
|
|
11626
|
-
|
|
11627
|
-
|
|
11628
|
-
|
|
11629
|
-
|
|
11760
|
+
catchUp && newCount > 0 && !replaying && subagentId === void 0 ? /* @__PURE__ */ jsx("div", {
|
|
11761
|
+
className: "px-3 pb-1",
|
|
11762
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
11763
|
+
"data-slot": "catch-up",
|
|
11764
|
+
className: "mx-auto flex w-full max-w-[var(--wd-transcript-max-width)] items-center gap-2 text-label text-fg-3",
|
|
11765
|
+
children: [
|
|
11766
|
+
/* @__PURE__ */ jsx("span", {
|
|
11767
|
+
"aria-hidden": true,
|
|
11768
|
+
className: cn("select-none", terminal ? "text-fg-3" : "text-accent"),
|
|
11769
|
+
children: "※"
|
|
11770
|
+
}),
|
|
11771
|
+
/* @__PURE__ */ jsxs("span", {
|
|
11772
|
+
className: "min-w-0 flex-1 truncate",
|
|
11773
|
+
children: [
|
|
11774
|
+
newCount,
|
|
11775
|
+
" new ",
|
|
11776
|
+
newCount === 1 ? "row" : "rows",
|
|
11777
|
+
catchUp.since !== void 0 ? ` since you were last here` : ""
|
|
11778
|
+
]
|
|
11779
|
+
}),
|
|
11780
|
+
/* @__PURE__ */ jsx("button", {
|
|
11781
|
+
type: "button",
|
|
11782
|
+
onClick: () => jumpToRecap.current?.(),
|
|
11783
|
+
className: "shrink-0 underline-offset-2 hover:text-fg-1 hover:underline",
|
|
11784
|
+
children: "jump"
|
|
11785
|
+
}),
|
|
11786
|
+
/* @__PURE__ */ jsx("button", {
|
|
11787
|
+
type: "button",
|
|
11788
|
+
onClick: () => setCaughtUp(true),
|
|
11789
|
+
className: "shrink-0 underline-offset-2 hover:text-fg-1 hover:underline",
|
|
11790
|
+
children: "dismiss"
|
|
11791
|
+
})
|
|
11792
|
+
]
|
|
11793
|
+
})
|
|
11794
|
+
}) : null,
|
|
11795
|
+
!readOnly && capabilities.interactiveApprovals && state.pendingApprovals.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
11796
|
+
className: cn(terminal ? "pb-2" : "px-3 pb-2"),
|
|
11797
|
+
children: /* @__PURE__ */ jsx(PromptSurface, {
|
|
11798
|
+
terminal,
|
|
11799
|
+
metrics: {
|
|
11800
|
+
fontSize: effectiveTermFontSize,
|
|
11801
|
+
lineHeight: effectiveTermLineHeight
|
|
11802
|
+
},
|
|
11803
|
+
affordances,
|
|
11804
|
+
children: state.pendingApprovals.map((request) => {
|
|
11805
|
+
const HostPrompt = approvalPrompts?.[request.toolName];
|
|
11806
|
+
if (HostPrompt) return /* @__PURE__ */ jsx(HostPrompt, {
|
|
11807
|
+
request,
|
|
11808
|
+
onApprove: approve,
|
|
11809
|
+
onDeny: deny
|
|
11810
|
+
}, request.id);
|
|
11811
|
+
const isQuestion = request.toolName === "AskUserQuestion" && parseUserQuestions(request.input).length > 0;
|
|
11812
|
+
if (terminal) return isQuestion ? /* @__PURE__ */ jsx(TerminalQuestionPrompt, {
|
|
11813
|
+
request,
|
|
11814
|
+
onAnswer: approve,
|
|
11815
|
+
onDismiss: (id) => deny(id, "Question dismissed by user")
|
|
11816
|
+
}, request.id) : /* @__PURE__ */ jsx(TerminalPermissionPrompt, {
|
|
11817
|
+
request,
|
|
11818
|
+
onApprove: approve,
|
|
11819
|
+
onDeny: deny
|
|
11820
|
+
}, request.id);
|
|
11821
|
+
return isQuestion ? /* @__PURE__ */ jsx(QuestionPrompt, {
|
|
11822
|
+
request,
|
|
11823
|
+
onAnswer: approve,
|
|
11824
|
+
onDismiss: (id) => deny(id, "Question dismissed by user")
|
|
11825
|
+
}, request.id) : /* @__PURE__ */ jsx(PermissionPrompt, {
|
|
11826
|
+
request,
|
|
11827
|
+
onApprove: approve,
|
|
11828
|
+
onDeny: deny
|
|
11829
|
+
}, request.id);
|
|
11830
|
+
})
|
|
11831
|
+
})
|
|
11832
|
+
}) : null,
|
|
11833
|
+
readOnly || subagentId !== void 0 ? null : /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Composer, {
|
|
11834
|
+
ref: composerRef,
|
|
11835
|
+
onSend: handleSend,
|
|
11836
|
+
onInterrupt: interrupt,
|
|
11837
|
+
busy,
|
|
11838
|
+
disabled: ended || !sessionId,
|
|
11839
|
+
commands: capabilities.slashCommands ? state.commands : void 0,
|
|
11840
|
+
skills: capabilities.skillsList ? state.skills : void 0,
|
|
11841
|
+
clientCommands,
|
|
11842
|
+
attachments,
|
|
11843
|
+
draft,
|
|
11844
|
+
onSearchFiles: hostFiles.available ? searchComposerFiles : void 0,
|
|
11845
|
+
onShellCommand: shell ? runShell : void 0,
|
|
11846
|
+
layout: controlsExternal ? "inline" : "stacked",
|
|
11847
|
+
toolbar: controlsExternal ? void 0 : sessionControls,
|
|
11848
|
+
fontSize: effectiveTermFontSize,
|
|
11849
|
+
lineHeight: effectiveTermLineHeight,
|
|
11850
|
+
affordances
|
|
11851
|
+
}) }),
|
|
11852
|
+
statusPlacement === "bottom" ? statusBar : null,
|
|
11853
|
+
!external ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
11854
|
+
/* @__PURE__ */ jsx(SessionInfoDialog, {
|
|
11855
|
+
state,
|
|
11856
|
+
client,
|
|
11857
|
+
sessionId,
|
|
11858
|
+
open: panel === "info",
|
|
11859
|
+
onOpenChange: (next) => setPanel(next ? "info" : void 0)
|
|
11860
|
+
}),
|
|
11861
|
+
/* @__PURE__ */ jsx(ContextDialog, {
|
|
11862
|
+
usage: state.contextUsage,
|
|
11863
|
+
engine: state.engine ?? "claude",
|
|
11864
|
+
open: panel === "context",
|
|
11865
|
+
onOpenChange: (next) => setPanel(next ? "context" : void 0)
|
|
11866
|
+
}),
|
|
11867
|
+
/* @__PURE__ */ jsx(UsageDialog, {
|
|
11868
|
+
rateLimits: windows,
|
|
11869
|
+
subscriptionType: state.subscriptionType,
|
|
11870
|
+
engine: state.engine ?? "claude",
|
|
11871
|
+
totalCostUsd: state.totalCostUsd,
|
|
11872
|
+
updatedAt: usageUpdatedAt,
|
|
11873
|
+
open: panel === "usage",
|
|
11874
|
+
onOpenChange: (next) => setPanel(next ? "usage" : void 0)
|
|
11875
|
+
}),
|
|
11876
|
+
/* @__PURE__ */ jsx(McpDialog, {
|
|
11877
|
+
client,
|
|
11878
|
+
sessionId,
|
|
11879
|
+
canManageServers: capabilities.mcpServerActions,
|
|
11880
|
+
open: panel === "mcp",
|
|
11881
|
+
onOpenChange: (next) => setPanel(next ? "mcp" : void 0)
|
|
11882
|
+
}),
|
|
11883
|
+
/* @__PURE__ */ jsx(TasksDialog, {
|
|
11884
|
+
tasks,
|
|
11885
|
+
showCompleted: showCompletedTasks,
|
|
11886
|
+
onShowCompletedChange: setShowCompletedTasks,
|
|
11887
|
+
onSelectTask: (task) => {
|
|
11888
|
+
if (task.toolUseId) setTaskReveal({
|
|
11889
|
+
toolUseId: task.toolUseId,
|
|
11890
|
+
nonce: Date.now()
|
|
11891
|
+
});
|
|
11892
|
+
},
|
|
11893
|
+
open: panel === "tasks",
|
|
11894
|
+
onOpenChange: (next) => setPanel(next ? "tasks" : void 0)
|
|
11895
|
+
}),
|
|
11896
|
+
/* @__PURE__ */ jsx(SkillsDialog, {
|
|
11897
|
+
skills: state.skills,
|
|
11898
|
+
open: panel === "skills",
|
|
11899
|
+
onOpenChange: (next) => setPanel(next ? "skills" : void 0),
|
|
11900
|
+
onUse: (skill) => composerRef.current?.insertText(skillPrompt(skill))
|
|
11901
|
+
}),
|
|
11902
|
+
/* @__PURE__ */ jsx(HostFilesDialog, {
|
|
11903
|
+
client,
|
|
11904
|
+
cwd: state.cwd,
|
|
11905
|
+
open: panel === "files",
|
|
11906
|
+
onOpenChange: (next) => setPanel(next ? "files" : void 0)
|
|
11907
|
+
})
|
|
11908
|
+
] }) : null
|
|
11909
|
+
]
|
|
11910
|
+
})
|
|
11630
11911
|
})
|
|
11631
11912
|
})
|
|
11632
11913
|
})
|
|
@@ -11696,6 +11977,6 @@ function Notice({ level, onDismiss, children }) {
|
|
|
11696
11977
|
});
|
|
11697
11978
|
}
|
|
11698
11979
|
//#endregion
|
|
11699
|
-
export {
|
|
11980
|
+
export { Band as $, Input as $t, PERMISSION_MODES as A, Tip as At, TaskList as B, Menu$1 as Bt, TerminalPermissionPrompt as C, segmentsToPlainText as Ct, SubagentStrip as D, Spinner as Dt, parseUserQuestions as E, CodeBlock as Et, SkillsDialog as F, DialogClose as Ft, ToolTitleProvider as G, Select$1 as Gt, contextNote as H, MenuItem as Ht, McpDialog as I, DialogContent as It, FileLinkProvider as J, SelectItemText as Jt, useToolTitle as K, SelectContent as Kt, HostFilesDialog as L, DialogHeader as Lt, permissionModeChoices as M, TooltipProvider as Mt, permissionModeMeta as N, Dialog$1 as Nt, PermissionPrompt as O, CopyButton as Ot, ModelSelect as P, DialogBody as Pt, previewPatch as Q, Textarea as Qt, EntryIcon as R, DialogRow as Rt, TerminalQuestionPrompt as S, plainTextToSegments as St, QuestionPrompt as T, Splitter as Tt, Composer as U, MenuSeparator as Ut, ContextDialog as V, MenuContent as Vt, TerminalSurface as W, MenuTrigger as Wt, parseFileLink as X, SelectValue as Xt, useFileLinks as Y, SelectTrigger as Yt, TerminalDiff as Z, PortalScope as Zt, ConversationContent as _, hashtagTrigger as _t, Transcript as a, useAffordances as at, STATUS_META as b, usePromptAreaState as bt, PromptTokenText as c, TranscriptDensityProvider as ct, FileCard as d, useTranscriptVariant as dt, Badge as en, Blank as et, TerminalItemView as f, matchClientCommand as ft, Conversation as g, commandTrigger as gt, Loader as h, skillPrompt as ht, useMinuteClock as i, cn as in, WithActions as it, PermissionModeSelect as j, TooltipContent as jt, Response as k, copyText as kt, Message as l, TranscriptVariantProvider as lt, SessionEmptyState as m, rankComposerRows as mt, UsageDialog as n, Button as nn, Row as nt, ToolCallCard as o, isMutatingTool as ot, TerminalTranscript as p, mergeComposerRows as pt, TerminalMarkdown as q, SelectItem as qt, UsageMeters as r, buttonVariants as rn, CopyAction as rt, Reasoning as s, toolIcon as st, SessionPanel as t, badgeVariants as tn, Ink as tt, MessageContent as u, useTranscriptDensity as ut, ConversationScrollButton as v, launchTrigger as vt, QUESTION_BEHAVIORS as w, ProgressRing as wt, SessionInfoDialog as x, PromptArea as xt, StatusBar as y, mentionTrigger as yt, TasksDialog as z, DialogTrigger as zt };
|
|
11700
11981
|
|
|
11701
|
-
//# sourceMappingURL=SessionPanel-
|
|
11982
|
+
//# sourceMappingURL=SessionPanel-BClL7zUS.mjs.map
|