@workerdeck/ui 0.9.0 → 0.11.0

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