@workerdeck/ui 2.15.0 → 3.1.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 +6 -5
- package/build/{SessionPanel-BVKqPs_3.d.mts → SessionPanel-BNNc8grK.d.mts} +18 -16
- package/build/index.d.mts +194 -49
- package/build/index.mjs +562 -260
- package/build/index.mjs.map +1 -1
- package/build/scoped.css +170 -21
- package/build/{use-path-links-BgWXmfAS.mjs → use-path-links-C6Fh5zdx.mjs} +3312 -2758
- package/build/use-path-links-C6Fh5zdx.mjs.map +1 -0
- package/build/workspace.d.mts +3 -3
- package/build/workspace.mjs +3 -3
- package/build/workspace.mjs.map +1 -1
- package/package.json +4 -4
- package/src/components/agent/ApprovalPrompts.tsx +87 -0
- package/src/components/agent/Composer.tsx +25 -47
- package/src/components/agent/ContextDialog.tsx +75 -67
- package/src/components/agent/FrameStrip.tsx +74 -0
- package/src/components/agent/HostFilesDialog.tsx +3 -2
- package/src/components/agent/McpDialog.tsx +112 -78
- package/src/components/agent/PermissionPrompt.tsx +22 -17
- package/src/components/agent/QuestionPrompt.tsx +6 -41
- package/src/components/agent/Response.tsx +8 -1
- package/src/components/agent/Scrubber.tsx +6 -75
- package/src/components/agent/SessionBrowser.tsx +131 -214
- package/src/components/agent/SessionFilters.tsx +266 -0
- package/src/components/agent/SessionInfoDialog.tsx +47 -63
- package/src/components/agent/SessionItem.tsx +29 -6
- package/src/components/agent/SessionPanel.tsx +249 -498
- package/src/components/agent/SessionSteps.tsx +98 -14
- package/src/components/agent/SessionWorkspace.tsx +3 -3
- package/src/components/agent/ShellStrip.tsx +43 -36
- package/src/components/agent/ShellTerminal.tsx +1 -1
- package/src/components/agent/SubagentStrip.tsx +13 -30
- package/src/components/agent/ToolCallCard.tsx +18 -41
- package/src/components/agent/Transcript.tsx +111 -93
- package/src/components/agent/TranscriptItemView.tsx +80 -67
- package/src/components/agent/TranscriptRows.tsx +4 -2
- package/src/components/agent/composer-commands.ts +80 -1
- package/src/components/agent/image-viewer.tsx +326 -0
- package/src/components/agent/markdown-image.tsx +139 -0
- package/src/components/agent/scrubber-marks.ts +33 -11
- package/src/components/agent/scrubber-peek.tsx +122 -0
- package/src/components/agent/session-panel-providers.tsx +41 -0
- package/src/components/agent/shell-actions.tsx +38 -1
- package/src/components/agent/tool-result-image.tsx +40 -0
- package/src/components/agent/transcript-variant.tsx +3 -21
- package/src/components/agent/use-catch-up.ts +20 -0
- package/src/components/agent/use-frame.ts +88 -0
- package/src/components/agent/use-host-image.ts +81 -0
- package/src/components/agent/use-shell-frame.ts +12 -70
- package/src/components/agent/use-subagent-frame.ts +19 -75
- package/src/components/prompt-area/prompt-area-engine.ts +21 -20
- package/src/components/prompt-area/prompt-area-list-ops.ts +12 -15
- package/src/components/prompt-area/use-prompt-area-keydown.ts +4 -2
- package/src/components/terminal/PermissionPrompt.tsx +31 -28
- package/src/components/terminal/QuestionPrompt.tsx +10 -46
- package/src/components/terminal/TerminalTranscript.tsx +23 -89
- package/src/components/terminal/affordances.tsx +100 -74
- package/src/components/terminal/height.ts +48 -32
- package/src/components/terminal/image-box.ts +31 -0
- package/src/components/terminal/items.tsx +70 -30
- package/src/components/terminal/markdown.tsx +4 -1
- package/src/components/terminal/scrubber.tsx +25 -272
- package/src/components/terminal/shell-row.ts +17 -3
- package/src/components/ui/Popover.tsx +29 -0
- package/src/components/ui/Select.tsx +25 -0
- package/src/index.ts +65 -12
- package/src/lib/file-link.ts +3 -16
- package/src/lib/permission-prompt.ts +57 -0
- package/src/lib/question-answers.ts +65 -0
- package/src/lib/shell-request.ts +115 -0
- package/src/lib/tool-icon.ts +13 -1
- package/src/styles/terminal.css +129 -22
- package/src/styles/theme.css +4 -0
- package/build/use-path-links-BgWXmfAS.mjs.map +0 -1
- package/src/components/prompt-area/use-markdown-mode.ts +0 -103
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook that toggles a PromptArea between its markdown and plain-text variants.
|
|
3
|
-
*
|
|
4
|
-
* PromptArea's `markdown` prop controls whether inline markdown (bold, italic,
|
|
5
|
-
* URLs, and list bullets) is rendered and whether typed list markers normalize
|
|
6
|
-
* to `•`. Flipping it at runtime is non-destructive: the segment value is kept,
|
|
7
|
-
* only its rendering changes (bullets convert `•` ↔ `-` when `normalizeBullets`
|
|
8
|
-
* is on). This hook owns that boolean as a named "mode" and hands you a `toggle`
|
|
9
|
-
* plus a `markdown` value ready to spread onto the component.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```tsx
|
|
13
|
-
* function Composer() {
|
|
14
|
-
* const { bind } = usePromptAreaState()
|
|
15
|
-
* const { markdown, mode, toggle } = useMarkdownMode()
|
|
16
|
-
*
|
|
17
|
-
* return (
|
|
18
|
-
* <>
|
|
19
|
-
* <PromptArea {...bind} markdown={markdown} />
|
|
20
|
-
* <button onClick={toggle} aria-pressed={markdown}>
|
|
21
|
-
* {mode === 'markdown' ? 'Markdown' : 'Plain text'}
|
|
22
|
-
* </button>
|
|
23
|
-
* </>
|
|
24
|
-
* )
|
|
25
|
-
* }
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
'use client'
|
|
30
|
-
|
|
31
|
-
import { useCallback, useMemo, useState } from 'react'
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* The two rendering variants of a PromptArea.
|
|
35
|
-
* - `'markdown'`: inline markdown is decorated and list markers normalize to `•`.
|
|
36
|
-
* - `'plain'`: raw source text is shown verbatim with no decoration.
|
|
37
|
-
*/
|
|
38
|
-
export type PromptAreaMode = 'markdown' | 'plain'
|
|
39
|
-
|
|
40
|
-
/** Returns the other mode. Pure - handy for building custom toggles. */
|
|
41
|
-
export function oppositeMode(mode: PromptAreaMode): PromptAreaMode {
|
|
42
|
-
return mode === 'markdown' ? 'plain' : 'markdown'
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export type UseMarkdownModeOptions = {
|
|
46
|
-
/** Starting mode for the uncontrolled hook. Defaults to `'markdown'`. */
|
|
47
|
-
initialMode?: PromptAreaMode
|
|
48
|
-
/**
|
|
49
|
-
* Controlled mode. When provided, the hook mirrors this value and never owns
|
|
50
|
-
* its own state - drive changes through `onModeChange`.
|
|
51
|
-
*/
|
|
52
|
-
mode?: PromptAreaMode
|
|
53
|
-
/** Called with the next mode whenever `toggle`/`setMode` change it. */
|
|
54
|
-
onModeChange?: (mode: PromptAreaMode) => void
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export type MarkdownModeState = {
|
|
58
|
-
/** The active mode. */
|
|
59
|
-
mode: PromptAreaMode
|
|
60
|
-
/** `true` in markdown mode - spread onto `<PromptArea markdown={markdown} />`. */
|
|
61
|
-
markdown: boolean
|
|
62
|
-
/** `true` in plain-text mode (the inverse of `markdown`). */
|
|
63
|
-
isPlainText: boolean
|
|
64
|
-
/** Switch to an explicit mode. No-op if already in it. */
|
|
65
|
-
setMode: (mode: PromptAreaMode) => void
|
|
66
|
-
/** Flip between markdown and plain text. */
|
|
67
|
-
toggle: () => void
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export function useMarkdownMode(options: UseMarkdownModeOptions = {}): MarkdownModeState {
|
|
71
|
-
const { initialMode = 'markdown', mode: controlledMode, onModeChange } = options
|
|
72
|
-
const isControlled = controlledMode !== undefined
|
|
73
|
-
|
|
74
|
-
const [internalMode, setInternalMode] = useState<PromptAreaMode>(() => controlledMode ?? initialMode)
|
|
75
|
-
|
|
76
|
-
const mode = isControlled ? controlledMode : internalMode
|
|
77
|
-
|
|
78
|
-
const setMode = useCallback(
|
|
79
|
-
(next: PromptAreaMode) => {
|
|
80
|
-
if (next === mode) {
|
|
81
|
-
return
|
|
82
|
-
}
|
|
83
|
-
if (!isControlled) {
|
|
84
|
-
setInternalMode(next)
|
|
85
|
-
}
|
|
86
|
-
onModeChange?.(next)
|
|
87
|
-
},
|
|
88
|
-
[mode, isControlled, onModeChange],
|
|
89
|
-
)
|
|
90
|
-
|
|
91
|
-
const toggle = useCallback(() => setMode(oppositeMode(mode)), [mode, setMode])
|
|
92
|
-
|
|
93
|
-
return useMemo(
|
|
94
|
-
() => ({
|
|
95
|
-
mode,
|
|
96
|
-
markdown: mode === 'markdown',
|
|
97
|
-
isPlainText: mode === 'plain',
|
|
98
|
-
setMode,
|
|
99
|
-
toggle,
|
|
100
|
-
}),
|
|
101
|
-
[mode, setMode, toggle],
|
|
102
|
-
)
|
|
103
|
-
}
|