@workerdeck/ui 0.9.0 → 0.12.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 +81 -3
- package/build/SessionPanel-Dy9lQrOV.d.mts +319 -0
- package/build/SessionPanel-NQ8ksCfj.mjs +8474 -0
- package/build/SessionPanel-NQ8ksCfj.mjs.map +1 -0
- package/build/format-DqR56Y8l.mjs +162 -0
- package/build/format-DqR56Y8l.mjs.map +1 -0
- package/build/format-ljc3lKpA.d.mts +59 -0
- package/build/format.d.mts +66 -0
- package/build/format.mjs +119 -0
- package/build/format.mjs.map +1 -0
- package/build/index.d.mts +671 -88
- package/build/index.mjs +387 -5160
- package/build/index.mjs.map +1 -1
- package/build/workspace.d.mts +226 -0
- package/build/workspace.mjs +861 -0
- package/build/workspace.mjs.map +1 -0
- package/package.json +22 -4
- package/src/components/agent/CodeEditor.tsx +300 -0
- package/src/components/agent/Composer.tsx +522 -87
- package/src/components/agent/ContextDialog.tsx +99 -0
- package/src/components/agent/Conversation.tsx +11 -3
- package/src/components/agent/EditorTabs.tsx +165 -0
- package/src/components/agent/FileCard.tsx +26 -0
- package/src/components/agent/FileTree.tsx +287 -0
- package/src/components/agent/FileViewer.tsx +148 -0
- package/src/components/agent/HostFilesDialog.tsx +218 -0
- package/src/components/agent/Loader.tsx +82 -14
- package/src/components/agent/McpDialog.tsx +363 -0
- package/src/components/agent/Message.tsx +51 -17
- package/src/components/agent/ModelSelect.tsx +34 -6
- package/src/components/agent/PermissionModeSelect.tsx +133 -22
- package/src/components/agent/PermissionPrompt.tsx +164 -6
- package/src/components/agent/PromptTokenText.tsx +39 -0
- package/src/components/agent/QuestionPrompt.tsx +122 -0
- package/src/components/agent/Reasoning.tsx +20 -5
- package/src/components/agent/Response.tsx +128 -0
- package/src/components/agent/SessionBrowser.tsx +428 -0
- package/src/components/agent/SessionEmptyState.tsx +65 -0
- package/src/components/agent/SessionInfoDialog.tsx +163 -0
- package/src/components/agent/SessionPanel.tsx +783 -91
- package/src/components/agent/SessionWorkspace.tsx +317 -0
- package/src/components/agent/SkillsDialog.tsx +195 -0
- package/src/components/agent/StatusBar.tsx +85 -18
- package/src/components/agent/ToolCallCard.tsx +252 -30
- package/src/components/agent/Transcript.tsx +513 -30
- package/src/components/agent/UsageDialog.tsx +168 -0
- package/src/components/agent/line-prompt.tsx +249 -0
- package/src/components/agent/pulse.tsx +60 -0
- package/src/components/agent/transcript-variant.tsx +123 -0
- package/src/components/prompt-area/prompt-area-engine.ts +53 -0
- package/src/components/prompt-area/types.ts +15 -0
- package/src/components/prompt-area/use-prompt-area.ts +20 -0
- package/src/components/ui/CodeBlock.tsx +40 -2
- package/src/components/ui/CopyButton.tsx +28 -3
- package/src/components/ui/Dialog.tsx +92 -0
- package/src/components/ui/Menu.tsx +55 -0
- package/src/components/ui/Splitter.tsx +133 -0
- package/src/components/ui/Tooltip.tsx +22 -5
- package/src/format.ts +11 -0
- package/src/index.ts +67 -2
- package/src/lib/clipboard.ts +56 -0
- package/src/lib/format.ts +114 -0
- package/src/lib/status.ts +124 -0
- package/src/lib/tool-icon.ts +96 -0
- package/src/workspace.ts +28 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { r as SessionPanelProps } from "./SessionPanel-Dy9lQrOV.mjs";
|
|
2
|
+
import * as _$react from "react";
|
|
3
|
+
import { CSSProperties } from "react";
|
|
4
|
+
import { OpenFile, UseHostFileSearchResult, UseHostFileTreeResult } from "@workerdeck/react";
|
|
5
|
+
import { WorkerDeckClient } from "@workerdeck/client";
|
|
6
|
+
|
|
7
|
+
//#region src/components/agent/SessionWorkspace.d.ts
|
|
8
|
+
interface SessionWorkspaceProps {
|
|
9
|
+
client: WorkerDeckClient;
|
|
10
|
+
sessionId: string | undefined;
|
|
11
|
+
/** Passed straight through to {@link SessionPanel} — including the render-prop
|
|
12
|
+
* form that claims the session-actions menu. */
|
|
13
|
+
header?: SessionPanelProps['header'];
|
|
14
|
+
/**
|
|
15
|
+
* Panel seams the workspace does not interpret, forwarded verbatim.
|
|
16
|
+
*
|
|
17
|
+
* They are listed rather than spread so the workspace stays explicit about
|
|
18
|
+
* what it passes on: the panel owns the session's one attach, and a seam that
|
|
19
|
+
* silently arrived here would be a second place to look for why a session
|
|
20
|
+
* renders the way it does.
|
|
21
|
+
*/
|
|
22
|
+
transcriptVariant?: SessionPanelProps['transcriptVariant'];
|
|
23
|
+
transcriptDensity?: SessionPanelProps['transcriptDensity'];
|
|
24
|
+
unseen?: SessionPanelProps['unseen'];
|
|
25
|
+
onVitals?: SessionPanelProps['onVitals'];
|
|
26
|
+
/** Rail width in pixels on first render. */
|
|
27
|
+
defaultRailWidth?: number;
|
|
28
|
+
/** Start with the file rail collapsed even on a wide viewport. */
|
|
29
|
+
defaultRailCollapsed?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The rail moved. Paired with the two defaults so an embedder can persist the
|
|
32
|
+
* layout — the workspace deliberately does not, because *where* to keep it (a
|
|
33
|
+
* Memento, localStorage, a workspace file) is the embedder's call, and a
|
|
34
|
+
* component that picked one would be wrong in the other hosts.
|
|
35
|
+
*/
|
|
36
|
+
onRailChange?: (rail: {
|
|
37
|
+
width: number;
|
|
38
|
+
collapsed: boolean;
|
|
39
|
+
}) => void;
|
|
40
|
+
className?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A VS Code-shaped workspace around a live session: file tree on the left, open
|
|
44
|
+
* files above, the agent below.
|
|
45
|
+
*
|
|
46
|
+
* **Strictly additive.** {@link SessionPanel} is untouched and still the whole
|
|
47
|
+
* session surface on its own — an embedder picks one or the other, and one that
|
|
48
|
+
* has its own file tree keeps using the panel.
|
|
49
|
+
*
|
|
50
|
+
* Two things here are load-bearing and easy to break:
|
|
51
|
+
*
|
|
52
|
+
* 1. **The editor region is absent from the layout when nothing is open**, not
|
|
53
|
+
* collapsed to zero height. A zero-height pane leaves a draggable splitter and
|
|
54
|
+
* parks the composer at an odd offset; absence is what makes the agent's
|
|
55
|
+
* "claims the full column" state actually look like the panel alone.
|
|
56
|
+
* 2. **`SessionPanel` keeps its position in the tree across that transition.** It
|
|
57
|
+
* holds the WebSocket attach and the entire transcript, so moving it between
|
|
58
|
+
* parents — or wrapping it conditionally — would remount it and drop the
|
|
59
|
+
* session's rendered history on the floor the first time someone opens a file.
|
|
60
|
+
* The conditional children before it are `? :` expressions that leave a null in
|
|
61
|
+
* their slot, which is exactly what keeps its index stable.
|
|
62
|
+
*/
|
|
63
|
+
declare function SessionWorkspace({
|
|
64
|
+
client,
|
|
65
|
+
sessionId,
|
|
66
|
+
header,
|
|
67
|
+
transcriptVariant,
|
|
68
|
+
transcriptDensity,
|
|
69
|
+
unseen,
|
|
70
|
+
onVitals,
|
|
71
|
+
defaultRailWidth,
|
|
72
|
+
defaultRailCollapsed,
|
|
73
|
+
onRailChange,
|
|
74
|
+
className
|
|
75
|
+
}: SessionWorkspaceProps): _$react.JSX.Element;
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/components/agent/FileTree.d.ts
|
|
78
|
+
interface FileTreeProps {
|
|
79
|
+
/** Tree state from `useHostFileTree` — this component holds none of its own. */
|
|
80
|
+
tree: UseHostFileTreeResult;
|
|
81
|
+
/** Optional search from `useHostFileSearch`; omit and the box is not offered. */
|
|
82
|
+
search?: UseHostFileSearchResult;
|
|
83
|
+
/** Path of the focused file, highlighted in the tree. */
|
|
84
|
+
activePath?: string;
|
|
85
|
+
onOpenFile: (path: string) => void;
|
|
86
|
+
/** Offered as a button in the header when given. */
|
|
87
|
+
onCollapse?: () => void;
|
|
88
|
+
style?: CSSProperties;
|
|
89
|
+
className?: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The workspace's left rail: an expandable tree of the session's project,
|
|
93
|
+
* with a search box over the same fuzzy route `@file` completion uses.
|
|
94
|
+
*
|
|
95
|
+
* Presentational by construction — every piece of state it renders comes from
|
|
96
|
+
* the hooks in `@workerdeck/react`, and the only thing it owns is the search
|
|
97
|
+
* query, which is the text in its own input.
|
|
98
|
+
*
|
|
99
|
+
* Searching replaces the tree with matches rather than filtering it: the route
|
|
100
|
+
* answers with paths from all over the project, and threading those back into
|
|
101
|
+
* tree positions would mean expanding a dozen directories to show six results.
|
|
102
|
+
*/
|
|
103
|
+
declare function FileTree({
|
|
104
|
+
tree,
|
|
105
|
+
search,
|
|
106
|
+
activePath,
|
|
107
|
+
onOpenFile,
|
|
108
|
+
onCollapse,
|
|
109
|
+
style,
|
|
110
|
+
className
|
|
111
|
+
}: FileTreeProps): _$react.JSX.Element;
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/components/agent/EditorTabs.d.ts
|
|
114
|
+
interface EditorTabsProps {
|
|
115
|
+
files: OpenFile[];
|
|
116
|
+
activePath?: string;
|
|
117
|
+
onActivate: (path: string) => void;
|
|
118
|
+
onClose: (path: string) => void;
|
|
119
|
+
className?: string;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* The open-file tab strip.
|
|
123
|
+
*
|
|
124
|
+
* Hand-rolled rather than built on `@base-ui/react`'s `Tabs`: a VS Code tab
|
|
125
|
+
* carries a close button, and a `<button>` inside a `<button>` is invalid HTML —
|
|
126
|
+
* getting the primitive to render something else costs more than the roving
|
|
127
|
+
* tabindex it would have provided. So that part is here, explicitly, along with
|
|
128
|
+
* the two affordances that actually make a tab strip feel right: middle-click to
|
|
129
|
+
* close, and the active tab scrolling itself into view.
|
|
130
|
+
*
|
|
131
|
+
* Deliberately state-free. Which files are open, which is focused and what
|
|
132
|
+
* closing does are all decided by `useOpenFiles`.
|
|
133
|
+
*/
|
|
134
|
+
declare function EditorTabs({
|
|
135
|
+
files,
|
|
136
|
+
activePath,
|
|
137
|
+
onActivate,
|
|
138
|
+
onClose,
|
|
139
|
+
className
|
|
140
|
+
}: EditorTabsProps): _$react.JSX.Element;
|
|
141
|
+
//#endregion
|
|
142
|
+
//#region src/components/agent/FileViewer.d.ts
|
|
143
|
+
interface FileViewerProps {
|
|
144
|
+
file: OpenFile | undefined;
|
|
145
|
+
/** From `/fs/roots`. False renders the editor read-only rather than letting
|
|
146
|
+
* someone type into a file this gateway will refuse to write. */
|
|
147
|
+
canWrite?: boolean;
|
|
148
|
+
onChange?: (path: string, content: string) => void;
|
|
149
|
+
onSave?: (path: string) => void;
|
|
150
|
+
/** Discard this tab's edits — local only, no re-read. */
|
|
151
|
+
onRevert?: (path: string) => void;
|
|
152
|
+
/** Take the version on disk, discarding this tab's edits. */
|
|
153
|
+
onReload?: (path: string) => void;
|
|
154
|
+
/** Take this tab's version, over whatever is on disk now. */
|
|
155
|
+
onOverwrite?: (path: string) => void;
|
|
156
|
+
onDismissConflict?: (path: string) => void;
|
|
157
|
+
className?: string;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* The focused file: Monaco, plus the states a file can be in that are not
|
|
161
|
+
* "here is some text".
|
|
162
|
+
*
|
|
163
|
+
* No path row — the tab's tooltip carries the path and the size, and a line of
|
|
164
|
+
* monospace above every file is chrome that never earns its height.
|
|
165
|
+
*/
|
|
166
|
+
declare function FileViewer({
|
|
167
|
+
file,
|
|
168
|
+
canWrite,
|
|
169
|
+
onChange,
|
|
170
|
+
onSave,
|
|
171
|
+
onRevert,
|
|
172
|
+
onReload,
|
|
173
|
+
onOverwrite,
|
|
174
|
+
onDismissConflict,
|
|
175
|
+
className
|
|
176
|
+
}: FileViewerProps): _$react.JSX.Element | null;
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/components/agent/CodeEditor.d.ts
|
|
179
|
+
interface CodeEditorProps {
|
|
180
|
+
/** Absolute path — decides the language and identifies the model. */
|
|
181
|
+
path: string;
|
|
182
|
+
/** Text to show. Applied to the model when it differs from what is on screen,
|
|
183
|
+
* so an external reload lands without fighting the user's cursor. */
|
|
184
|
+
value: string;
|
|
185
|
+
onChange?: (value: string) => void;
|
|
186
|
+
/** Ctrl/Cmd+S. Wired inside Monaco because the editor swallows keydown. */
|
|
187
|
+
onSave?: () => void;
|
|
188
|
+
readOnly?: boolean;
|
|
189
|
+
className?: string;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Monaco — VS Code's own editor — behind a small React surface.
|
|
193
|
+
*
|
|
194
|
+
* Two deliberate choices, both about `@workerdeck/ui` being a **published
|
|
195
|
+
* library** rather than an app:
|
|
196
|
+
*
|
|
197
|
+
* 1. **Loaded on demand.** The `import()` is inside an effect, so Monaco is a
|
|
198
|
+
* separate chunk that arrives when someone first opens a file. A dashboard
|
|
199
|
+
* that never opens one never pays for it, and Monaco's ~90 language grammars
|
|
200
|
+
* are themselves lazy (each `registerLanguage` carries an `import()` loader),
|
|
201
|
+
* so opening a `.ts` file fetches the TypeScript grammar and nothing else.
|
|
202
|
+
* 2. **No `MonacoEnvironment` is configured here, and none is needed.** Workers
|
|
203
|
+
* in a library become every embedder's bootstrapping problem, and
|
|
204
|
+
* `packages/web` ships prebuilt static files at a domain root, which is
|
|
205
|
+
* exactly where hardcoded worker URLs break. The editor is configured so it
|
|
206
|
+
* never asks for one: `wordBasedSuggestions` and `quickSuggestions` off,
|
|
207
|
+
* no diff editor. A host that wants the worker-backed language services
|
|
208
|
+
* (TypeScript IntelliSense, JSON schema validation) sets `MonacoEnvironment`
|
|
209
|
+
* itself before the first file is opened — Monaco is a singleton and nothing
|
|
210
|
+
* here fights that.
|
|
211
|
+
*
|
|
212
|
+
* One model per path, kept across tab switches, so undo history and view state
|
|
213
|
+
* survive clicking away and back — which is most of what makes tabs feel like
|
|
214
|
+
* tabs rather than like re-opening a file.
|
|
215
|
+
*/
|
|
216
|
+
declare function CodeEditor({
|
|
217
|
+
path,
|
|
218
|
+
value,
|
|
219
|
+
onChange,
|
|
220
|
+
onSave,
|
|
221
|
+
readOnly,
|
|
222
|
+
className
|
|
223
|
+
}: CodeEditorProps): _$react.JSX.Element;
|
|
224
|
+
//#endregion
|
|
225
|
+
export { CodeEditor, type CodeEditorProps, EditorTabs, type EditorTabsProps, FileTree, type FileTreeProps, FileViewer, type FileViewerProps, SessionWorkspace, type SessionWorkspaceProps };
|
|
226
|
+
//# sourceMappingURL=workspace.d.mts.map
|