@lemonriver/core 0.1.1 → 0.3.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 (161) hide show
  1. package/dist/{build-f-fM2ZY4.js → build-Bqo69DWP.js} +1 -1
  2. package/dist/cli/bin.js +4 -4
  3. package/dist/{config-DO45GU3e.js → config-DJ5rkMMg.js} +3123 -523
  4. package/dist/{config-B6JaKJM4.d.ts → config-teo3kWz7.d.ts} +6 -2
  5. package/dist/{dev-CqS2xpgE.js → dev-B2FJD5bJ.js} +2 -2
  6. package/dist/index.d.ts +3 -3
  7. package/dist/index.js +4 -3
  8. package/dist/locale/index.d.ts +5 -2
  9. package/dist/locale/index.js +2 -2
  10. package/dist/{preview-BihgMlEl.js → preview-C93BOZL1.js} +1 -1
  11. package/dist/{types-BjW4glip.d.ts → types-DFK02XVv.d.ts} +120 -27
  12. package/dist/{update-C_R0ycVC.js → update-DsxZBtwv.js} +154 -90
  13. package/dist/vite/index.d.ts +1 -1
  14. package/dist/vite/index.js +1 -1
  15. package/dist/{zh-tw-Ci0jK8eg.js → zh-tw-DwTAZKa6.js} +1091 -104
  16. package/package.json +13 -6
  17. package/skills/apply-comments/SKILL.md +10 -6
  18. package/skills/create-slide/SKILL.md +2 -0
  19. package/skills/current-slide/SKILL.md +1 -0
  20. package/skills/slide-authoring/SKILL.md +31 -1
  21. package/src/agent/prompt.ts +141 -0
  22. package/src/agent/provider.ts +123 -0
  23. package/src/agent/types.ts +151 -0
  24. package/src/app/app.tsx +7 -18
  25. package/src/app/assets/open-slide.svg +39 -0
  26. package/src/app/components/agent/agent-dock.tsx +35 -0
  27. package/src/app/components/agent/agent-markdown.tsx +45 -0
  28. package/src/app/components/agent/agent-panel.tsx +695 -0
  29. package/src/app/components/agent/agent-presence.tsx +74 -0
  30. package/src/app/components/agent/composer.tsx +120 -0
  31. package/src/app/components/agent/connect-view.tsx +184 -0
  32. package/src/app/components/agent/history-view.tsx +136 -0
  33. package/src/app/components/agent/provider-logo.tsx +34 -0
  34. package/src/app/components/agent/transcript.tsx +620 -0
  35. package/src/app/components/asset-view.tsx +6 -6
  36. package/src/app/components/command/command-menu.tsx +2 -1
  37. package/src/app/components/command/slide-command-menu.tsx +10 -0
  38. package/src/app/components/icon-switcher-indicator.tsx +1 -1
  39. package/src/app/components/inspector/asset-picker-dialog.tsx +7 -5
  40. package/src/app/components/inspector/comment-layer.tsx +1012 -0
  41. package/src/app/components/inspector/image-crop-dialog.tsx +1 -5
  42. package/src/app/components/inspector/inspect-overlay.tsx +2 -39
  43. package/src/app/components/inspector/inspector-panel.tsx +12 -95
  44. package/src/app/components/inspector/inspector-provider.tsx +121 -47
  45. package/src/app/components/panel/editor-sidebar.tsx +85 -16
  46. package/src/app/components/panel/panel-shell.tsx +2 -2
  47. package/src/app/components/panel/resize-handle.tsx +129 -0
  48. package/src/app/components/player.tsx +0 -1
  49. package/src/app/components/preview-step-host.tsx +16 -0
  50. package/src/app/components/sidebar/sidebar-footer.tsx +1 -1
  51. package/src/app/components/sidebar/sidebar.tsx +4 -3
  52. package/src/app/components/style-panel/style-panel.tsx +3 -2
  53. package/src/app/components/themes/theme-detail.tsx +4 -2
  54. package/src/app/components/thumbnail-rail.tsx +77 -29
  55. package/src/app/favicon.ico +0 -0
  56. package/src/app/favicon.svg +39 -0
  57. package/src/app/index.html +2 -1
  58. package/src/app/lemonriver/agent/lemon.tsx +64 -0
  59. package/src/app/{components → lemonriver}/board/board-canvas.tsx +154 -23
  60. package/src/app/{routes/board.tsx → lemonriver/board/board-page.tsx} +63 -25
  61. package/src/app/{components → lemonriver}/board/board.css +51 -0
  62. package/src/app/{components → lemonriver}/board/layout.test.ts +53 -1
  63. package/src/app/{components → lemonriver}/board/layout.ts +51 -3
  64. package/src/app/lemonriver/board/model/cards.test.ts +239 -0
  65. package/src/app/lemonriver/board/model/cards.ts +234 -0
  66. package/src/app/lemonriver/board/model/structure.test.ts +101 -0
  67. package/src/app/lemonriver/board/model/structure.ts +82 -0
  68. package/src/app/lemonriver/board/page-node.tsx +481 -0
  69. package/src/app/lemonriver/board/use-board-cards.ts +210 -0
  70. package/src/app/{components → lemonriver}/board/use-board-columns.ts +7 -7
  71. package/src/app/{components → lemonriver}/board/use-page-order.ts +27 -15
  72. package/src/app/lemonriver/brand/app-icon.svg +44 -0
  73. package/src/app/lemonriver/brand/apple-touch-icon.png +0 -0
  74. package/src/app/lemonriver/brand/favicon-32.png +0 -0
  75. package/src/app/lemonriver/brand/mascot.tsx +59 -0
  76. package/src/app/lemonriver/brand/mascots/lemon-done.png +0 -0
  77. package/src/app/lemonriver/brand/mascots/lemon-idle.png +0 -0
  78. package/src/app/lemonriver/brand/mascots/lemon-needs-you.png +0 -0
  79. package/src/app/lemonriver/brand/mascots/lemon-thinking.png +0 -0
  80. package/src/app/lemonriver/brand/mascots/lemon-working.png +0 -0
  81. package/src/app/lemonriver/chrome/app-chrome.tsx +99 -0
  82. package/src/app/lemonriver/chrome/nav-row.tsx +34 -0
  83. package/src/app/lemonriver/chrome/not-found.tsx +34 -0
  84. package/src/app/lemonriver/chrome/sidebar-extras.tsx +57 -0
  85. package/src/app/lemonriver/chrome/use-slot.ts +23 -0
  86. package/src/app/lemonriver/features.test.ts +29 -0
  87. package/src/app/lemonriver/features.ts +26 -0
  88. package/src/app/lemonriver/feedback/export.ts +7 -0
  89. package/src/app/lemonriver/feedback/lemon-empty.tsx +54 -0
  90. package/src/app/lemonriver/feedback/offline-banner.tsx +41 -0
  91. package/src/app/lemonriver/feedback/pending-toast.test.ts +44 -0
  92. package/src/app/lemonriver/feedback/pending-toast.ts +39 -0
  93. package/src/app/lemonriver/feedback/toaster.tsx +34 -0
  94. package/src/app/lemonriver/feedback/upload.test.ts +26 -0
  95. package/src/app/lemonriver/feedback/upload.ts +19 -0
  96. package/src/app/lemonriver/home/brief-card.tsx +63 -0
  97. package/src/app/lemonriver/home/brief.test.ts +38 -0
  98. package/src/app/lemonriver/home/brief.ts +34 -0
  99. package/src/app/lemonriver/home/controls.tsx +93 -0
  100. package/src/app/lemonriver/home/deck-card.tsx +183 -0
  101. package/src/app/lemonriver/home/dialogs.tsx +292 -0
  102. package/src/app/lemonriver/home/home-page.tsx +335 -0
  103. package/src/app/lemonriver/home/sorting.test.ts +24 -0
  104. package/src/app/lemonriver/home/sorting.ts +59 -0
  105. package/src/app/lemonriver/home/time.test.ts +33 -0
  106. package/src/app/lemonriver/home/time.ts +33 -0
  107. package/src/app/lemonriver/home/use-deck-times.ts +27 -0
  108. package/src/app/lemonriver/home/use-delayed.ts +15 -0
  109. package/src/app/lemonriver/routes.test.tsx +37 -0
  110. package/src/app/lemonriver/routes.tsx +38 -0
  111. package/src/app/lemonriver/settings/settings-page.tsx +103 -0
  112. package/src/app/lemonriver/slide-extensions.tsx +73 -0
  113. package/src/app/lemonriver/text/all.ts +19 -0
  114. package/src/app/lemonriver/text/en.ts +106 -0
  115. package/src/app/lemonriver/text/es.ts +108 -0
  116. package/src/app/lemonriver/text/index.ts +9 -0
  117. package/src/app/lemonriver/text/ja.ts +106 -0
  118. package/src/app/lemonriver/text/text.test.ts +57 -0
  119. package/src/app/lemonriver/text/types.ts +111 -0
  120. package/src/app/lemonriver/text/zh-cn.ts +101 -0
  121. package/src/app/lemonriver/text/zh-tw.ts +101 -0
  122. package/src/app/lemonriver/theme/app.css +288 -0
  123. package/src/app/lemonriver/theme/controls.css +463 -0
  124. package/src/app/lemonriver/theme/index.css +3 -0
  125. package/src/app/lemonriver/theme/motion.ts +52 -0
  126. package/src/app/lemonriver/theme/pages.test.ts +66 -0
  127. package/src/app/lemonriver/theme/pages.ts +56 -0
  128. package/src/app/lemonriver/theme/theme-menu.tsx +64 -0
  129. package/src/app/lemonriver/theme/themes.test.ts +18 -0
  130. package/src/app/lemonriver/theme/themes.ts +16 -0
  131. package/src/app/lemonriver/theme/tokens.css +226 -0
  132. package/src/app/lemonriver/theme/use-theme.tsx +49 -0
  133. package/src/app/lemonriver/trash/api.test.ts +19 -0
  134. package/src/app/lemonriver/trash/api.ts +77 -0
  135. package/src/app/lemonriver/trash/trash-page.tsx +131 -0
  136. package/src/app/lib/agent/use-agent.ts +543 -0
  137. package/src/app/lib/inspector/freeze-motion.ts +61 -0
  138. package/src/app/lib/inspector/use-comments.ts +32 -3
  139. package/src/app/lib/locale-store.ts +6 -1
  140. package/src/app/lib/pptx/raster.ts +1 -1
  141. package/src/app/lib/print-ready.ts +9 -6
  142. package/src/app/lib/use-auto-grow.ts +15 -0
  143. package/src/app/lib/utils.ts +4 -0
  144. package/src/app/main.tsx +8 -1
  145. package/src/app/routes/home-shell.tsx +4 -2
  146. package/src/app/routes/home.tsx +43 -7
  147. package/src/app/routes/presenter.tsx +1 -16
  148. package/src/app/routes/preview.tsx +169 -0
  149. package/src/app/routes/slide.tsx +232 -188
  150. package/src/app/styles.css +235 -80
  151. package/src/editing/placeholder-id.ts +1 -0
  152. package/src/locale/en.ts +113 -26
  153. package/src/locale/es.ts +658 -0
  154. package/src/locale/index.ts +1 -0
  155. package/src/locale/ja.ts +106 -26
  156. package/src/locale/types.ts +119 -28
  157. package/src/locale/zh-cn.ts +106 -28
  158. package/src/locale/zh-tw.ts +106 -28
  159. package/src/app/assets/open-slide.png +0 -0
  160. package/src/app/components/board/page-node.tsx +0 -204
  161. package/src/app/components/inspector/comment-widget.tsx +0 -119
@@ -0,0 +1,620 @@
1
+ import { Check, ChevronRight, Copy, Pencil } from 'lucide-react';
2
+ import { type ReactNode, useEffect, useLayoutEffect, useRef, useState } from 'react';
3
+ import { Button } from '@/components/ui/button';
4
+ import { useAutoGrow } from '@/lib/use-auto-grow';
5
+ import { format, plural, useLocale } from '@/lib/use-locale';
6
+ import { cn } from '@/lib/utils';
7
+ import { stripDeckSlug } from '../../../agent/prompt';
8
+ import type { AgentItem, AgentQuestion, AgentSession, RespondPayload } from '../../../agent/types';
9
+ import { ConfirmWho, ErrorLemon, ResultLemon, WorkingLemon } from '../../lemonriver/agent/lemon';
10
+ import { AgentMarkdown } from './agent-markdown';
11
+
12
+ export function Transcript({
13
+ session,
14
+ onRespond,
15
+ onEdit,
16
+ }: {
17
+ session: AgentSession;
18
+ onRespond: (itemId: string, payload: RespondPayload) => Promise<void>;
19
+ onEdit: (itemId: string, text: string) => Promise<void>;
20
+ }) {
21
+ const scrollRef = useRef<HTMLDivElement>(null);
22
+ const stickRef = useRef(true);
23
+ const lastItem = session.items.at(-1);
24
+ const lastText = lastItem?.kind === 'assistant' ? lastItem.text.length : 0;
25
+ const running = session.status === 'running';
26
+ const replies = replyTexts(session.items, running);
27
+
28
+ // Follow the stream while the user is parked at the bottom; stop once they
29
+ // scroll up to read, like a terminal.
30
+ // biome-ignore lint/correctness/useExhaustiveDependencies: re-run as the transcript grows or streams
31
+ useLayoutEffect(() => {
32
+ const node = scrollRef.current;
33
+ if (!node || !stickRef.current) return;
34
+ node.scrollTop = node.scrollHeight;
35
+ }, [session.items.length, lastText, session.status]);
36
+
37
+ return (
38
+ <div
39
+ ref={scrollRef}
40
+ onScroll={(e) => {
41
+ const node = e.currentTarget;
42
+ stickRef.current = node.scrollHeight - node.scrollTop - node.clientHeight < 48;
43
+ }}
44
+ className="min-h-0 flex-1 overflow-y-auto px-4 py-4"
45
+ >
46
+ <ol className="flex flex-col gap-3">
47
+ {toBlocks(session.items).map((block) => (
48
+ <li key={block.key}>
49
+ {'tools' in block ? (
50
+ <ToolGroup tools={block.tools} />
51
+ ) : (
52
+ <TranscriptItem
53
+ item={block.item}
54
+ running={running}
55
+ replyText={replies.get(block.item.id)}
56
+ onRespond={(payload) => onRespond(block.item.id, payload)}
57
+ onEdit={(text) => onEdit(block.item.id, text)}
58
+ />
59
+ )}
60
+ </li>
61
+ ))}
62
+ {running && !(lastItem?.kind === 'assistant' && lastItem.streaming) && (
63
+ <li>
64
+ <WorkingIndicator />
65
+ </li>
66
+ )}
67
+ </ol>
68
+ </div>
69
+ );
70
+ }
71
+
72
+ function WorkingIndicator() {
73
+ const t = useLocale();
74
+ return (
75
+ <div className="text-[11.5px]">
76
+ <WorkingLemon />
77
+ <span className="agent-shimmer">{t.agent.working}…</span>
78
+ </div>
79
+ );
80
+ }
81
+
82
+ // One reply spans every assistant text between a user message and the turn's
83
+ // result. Its copy button sits on the last of them and copies them all.
84
+ function replyTexts(items: AgentItem[], running: boolean): Map<string, string> {
85
+ const replies = new Map<string, string>();
86
+ let parts: { id: string; text: string }[] = [];
87
+ const flush = () => {
88
+ const last = parts.at(-1);
89
+ const text = parts
90
+ .map((p) => p.text.trim())
91
+ .filter(Boolean)
92
+ .join('\n\n');
93
+ if (last && text) replies.set(last.id, text);
94
+ parts = [];
95
+ };
96
+ for (const item of items) {
97
+ if (item.kind === 'assistant') parts.push({ id: item.id, text: stripDeckSlug(item.text) });
98
+ else if (item.kind === 'user' || item.kind === 'result') flush();
99
+ }
100
+ if (!running) flush();
101
+ return replies;
102
+ }
103
+
104
+ function TranscriptItem({
105
+ item,
106
+ running,
107
+ replyText,
108
+ onRespond,
109
+ onEdit,
110
+ }: {
111
+ item: AgentItem;
112
+ running: boolean;
113
+ replyText?: string;
114
+ onRespond: (payload: RespondPayload) => Promise<void>;
115
+ onEdit: (text: string) => Promise<void>;
116
+ }) {
117
+ switch (item.kind) {
118
+ case 'user':
119
+ return <UserItem text={item.text} running={running} onEdit={onEdit} />;
120
+ case 'assistant':
121
+ if (!item.text && item.streaming) return <WorkingIndicator />;
122
+ return <AssistantItem text={stripDeckSlug(item.text)} replyText={replyText} />;
123
+ case 'question':
124
+ return <QuestionItem item={item} onRespond={onRespond} />;
125
+ case 'permission':
126
+ return <PermissionItem item={item} onRespond={onRespond} />;
127
+ case 'error':
128
+ return <ErrorItem text={item.text} />;
129
+ case 'result':
130
+ return <ResultItem item={item} />;
131
+ default:
132
+ return null;
133
+ }
134
+ }
135
+
136
+ function ActionButton({
137
+ label,
138
+ onClick,
139
+ children,
140
+ }: {
141
+ label: string;
142
+ onClick: () => void;
143
+ children: ReactNode;
144
+ }) {
145
+ return (
146
+ <button
147
+ type="button"
148
+ aria-label={label}
149
+ title={label}
150
+ onClick={onClick}
151
+ className="grid size-6 place-items-center rounded-[5px] text-muted-foreground outline-none transition-colors duration-100 hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/30 [&_svg]:size-3"
152
+ >
153
+ {children}
154
+ </button>
155
+ );
156
+ }
157
+
158
+ function CopyButton({ text }: { text: string }) {
159
+ const t = useLocale();
160
+ const [copied, setCopied] = useState(false);
161
+ useEffect(() => {
162
+ if (!copied) return;
163
+ const timer = setTimeout(() => setCopied(false), 1500);
164
+ return () => clearTimeout(timer);
165
+ }, [copied]);
166
+ return (
167
+ <ActionButton
168
+ label={copied ? t.agent.copied : t.agent.copyMessage}
169
+ onClick={() => {
170
+ navigator.clipboard.writeText(text).then(
171
+ () => setCopied(true),
172
+ () => {},
173
+ );
174
+ }}
175
+ >
176
+ {copied ? <Check /> : <Copy />}
177
+ </ActionButton>
178
+ );
179
+ }
180
+
181
+ const ACTIONS_REVEAL =
182
+ 'flex opacity-0 transition-opacity duration-100 focus-within:opacity-100 group-hover/message:opacity-100 motion-reduce:transition-none';
183
+
184
+ function AssistantItem({ text, replyText }: { text: string; replyText?: string }) {
185
+ return (
186
+ <div className="group/message">
187
+ <AgentMarkdown text={text} />
188
+ {replyText && (
189
+ <div className={cn(ACTIONS_REVEAL, '-mb-2 -ml-1.5')}>
190
+ <CopyButton text={replyText} />
191
+ </div>
192
+ )}
193
+ </div>
194
+ );
195
+ }
196
+
197
+ function UserItem({
198
+ text,
199
+ running,
200
+ onEdit,
201
+ }: {
202
+ text: string;
203
+ running: boolean;
204
+ onEdit: (text: string) => Promise<void>;
205
+ }) {
206
+ const t = useLocale();
207
+ const [editing, setEditing] = useState(false);
208
+
209
+ if (editing) {
210
+ return (
211
+ <UserEditor
212
+ text={text}
213
+ running={running}
214
+ onCancel={() => setEditing(false)}
215
+ onSend={onEdit}
216
+ />
217
+ );
218
+ }
219
+
220
+ return (
221
+ <div className="group/message flex flex-col items-end">
222
+ <div className="max-w-[88%] whitespace-pre-wrap rounded-[8px] rounded-br-[3px] bg-muted px-3 py-2 text-[12.5px] leading-[1.5]">
223
+ {text}
224
+ </div>
225
+ <div className={cn(ACTIONS_REVEAL, '-mr-1.5 -mb-2 mt-0.5')}>
226
+ <CopyButton text={text} />
227
+ {!running && (
228
+ <ActionButton label={t.agent.editMessage} onClick={() => setEditing(true)}>
229
+ <Pencil />
230
+ </ActionButton>
231
+ )}
232
+ </div>
233
+ </div>
234
+ );
235
+ }
236
+
237
+ function UserEditor({
238
+ text,
239
+ running,
240
+ onCancel,
241
+ onSend,
242
+ }: {
243
+ text: string;
244
+ running: boolean;
245
+ onCancel: () => void;
246
+ onSend: (text: string) => Promise<void>;
247
+ }) {
248
+ const t = useLocale();
249
+ const [value, setValue] = useState(text);
250
+ const [busy, runBusy] = useBusy();
251
+ const ref = useRef<HTMLTextAreaElement>(null);
252
+ const canSend = !running && !busy && value.trim().length > 0 && value.trim() !== text.trim();
253
+
254
+ useAutoGrow(ref, value, 200);
255
+
256
+ useEffect(() => {
257
+ const node = ref.current;
258
+ if (!node) return;
259
+ node.focus();
260
+ node.setSelectionRange(node.value.length, node.value.length);
261
+ }, []);
262
+
263
+ const submit = async () => {
264
+ if (!canSend) return;
265
+ await runBusy(() => onSend(value.trim()));
266
+ };
267
+
268
+ return (
269
+ <div
270
+ data-agent-message-editor
271
+ className="rounded-[8px] border border-border bg-background shadow-edge transition-colors duration-100 focus-within:border-foreground/40 focus-within:ring-2 focus-within:ring-ring/30"
272
+ >
273
+ <textarea
274
+ ref={ref}
275
+ value={value}
276
+ rows={1}
277
+ aria-label={t.agent.editMessage}
278
+ onChange={(e) => setValue(e.target.value)}
279
+ onKeyDown={(e) => {
280
+ if (e.nativeEvent.isComposing) return;
281
+ if (e.key === 'Escape') {
282
+ e.preventDefault();
283
+ e.stopPropagation();
284
+ onCancel();
285
+ } else if (e.key === 'Enter' && !e.shiftKey) {
286
+ e.preventDefault();
287
+ void submit();
288
+ }
289
+ }}
290
+ className="w-full resize-none bg-transparent px-3 pt-2.5 text-[12.5px] leading-[1.5] outline-none"
291
+ />
292
+ <p className="px-3 pt-0.5 text-[11px] leading-snug text-muted-foreground">
293
+ {t.agent.editHint}
294
+ </p>
295
+ <div className="flex justify-end gap-1 px-2 pt-2 pb-2">
296
+ <Button size="xs" variant="ghost" disabled={busy} onClick={onCancel}>
297
+ {t.agent.cancelEdit}
298
+ </Button>
299
+ <Button size="xs" disabled={!canSend} onClick={() => void submit()}>
300
+ {t.agent.sendEdit}
301
+ </Button>
302
+ </div>
303
+ </div>
304
+ );
305
+ }
306
+
307
+ function useBusy() {
308
+ const [busy, setBusy] = useState(false);
309
+ const run = async (task: () => Promise<void>) => {
310
+ setBusy(true);
311
+ try {
312
+ await task();
313
+ } finally {
314
+ setBusy(false);
315
+ }
316
+ };
317
+ return [busy, run] as const;
318
+ }
319
+
320
+ type ToolEntry = Extract<AgentItem, { kind: 'tool' }>;
321
+
322
+ type Block = { key: string; item: AgentItem } | { key: string; tools: ToolEntry[] };
323
+
324
+ function toBlocks(items: AgentItem[]): Block[] {
325
+ const blocks: Block[] = [];
326
+ for (const item of items) {
327
+ const last = blocks.at(-1);
328
+ if (item.kind === 'tool' && last && 'tools' in last) last.tools.push(item);
329
+ else if (item.kind === 'tool') blocks.push({ key: item.id, tools: [item] });
330
+ else blocks.push({ key: item.id, item });
331
+ }
332
+ return blocks;
333
+ }
334
+
335
+ function ToolRow({ item }: { item: ToolEntry }) {
336
+ return (
337
+ <div className="flex min-w-0 items-center gap-2 text-[11.5px] leading-5 text-muted-foreground">
338
+ <span
339
+ aria-hidden
340
+ className={cn(
341
+ 'size-1 shrink-0 rounded-full',
342
+ item.status === 'running'
343
+ ? 'animate-pulse bg-foreground/70 motion-reduce:animate-none'
344
+ : item.status === 'error'
345
+ ? 'bg-destructive'
346
+ : 'bg-muted-foreground/40',
347
+ )}
348
+ />
349
+ <span
350
+ className={cn(
351
+ 'shrink-0',
352
+ item.status === 'running' && 'agent-shimmer',
353
+ item.status === 'error' && 'text-destructive',
354
+ )}
355
+ >
356
+ {item.title}
357
+ </span>
358
+ {item.detail && (
359
+ <span
360
+ className="min-w-0 truncate font-mono text-[10.5px] text-muted-foreground/70"
361
+ title={item.detail}
362
+ >
363
+ {item.detail}
364
+ </span>
365
+ )}
366
+ </div>
367
+ );
368
+ }
369
+
370
+ function ToolGroup({ tools }: { tools: ToolEntry[] }) {
371
+ const t = useLocale();
372
+ const [open, setOpen] = useState(false);
373
+ if (tools.length === 1) return <ToolRow item={tools[0]} />;
374
+ const live = [...tools].reverse().find((tool) => tool.status === 'running');
375
+ const failed = tools.some((tool) => tool.status === 'error');
376
+ return (
377
+ <div>
378
+ <button
379
+ type="button"
380
+ aria-expanded={open}
381
+ onClick={() => setOpen((v) => !v)}
382
+ className="flex items-center gap-1 rounded-[4px] text-[11.5px] leading-5 text-muted-foreground outline-none transition-colors duration-100 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/30"
383
+ >
384
+ <ChevronRight
385
+ aria-hidden
386
+ className={cn(
387
+ 'size-3 transition-transform duration-150 motion-reduce:transition-none',
388
+ open && 'rotate-90',
389
+ )}
390
+ />
391
+ {format(plural(tools.length, t.agent.steps), { count: tools.length })}
392
+ {failed && <span aria-hidden className="ml-0.5 size-1 rounded-full bg-destructive" />}
393
+ </button>
394
+ {(open || live) && (
395
+ <div className="mt-0.5 ml-1.5 flex flex-col border-l border-hairline pl-3">
396
+ {open ? (
397
+ tools.map((tool) => <ToolRow key={tool.id} item={tool} />)
398
+ ) : live ? (
399
+ <ToolRow item={live} />
400
+ ) : null}
401
+ </div>
402
+ )}
403
+ </div>
404
+ );
405
+ }
406
+
407
+ function ErrorItem({ text }: { text: string }) {
408
+ const t = useLocale();
409
+ return (
410
+ <div className="rounded-[6px] border border-destructive/30 bg-destructive/5 px-3 py-2">
411
+ <span className="eyebrow flex items-center gap-1 text-destructive/80">
412
+ <ErrorLemon />
413
+ {t.agent.errorEyebrow}
414
+ </span>
415
+ <pre className="mt-1 whitespace-pre-wrap font-mono text-[11px] leading-relaxed text-foreground/85">
416
+ {text}
417
+ </pre>
418
+ </div>
419
+ );
420
+ }
421
+
422
+ function ResultItem({ item }: { item: Extract<AgentItem, { kind: 'result' }> }) {
423
+ const t = useLocale();
424
+ const parts = [item.aborted ? t.agent.resultStopped : t.agent.resultDone];
425
+ if (item.durationMs !== null) {
426
+ parts.push(
427
+ format(t.agent.resultSeconds, { seconds: Math.max(1, Math.round(item.durationMs / 1000)) }),
428
+ );
429
+ }
430
+ if (item.costUsd !== null && item.costUsd > 0) parts.push(`$${item.costUsd.toFixed(2)}`);
431
+ return (
432
+ <p className="folio text-muted-foreground/70">
433
+ <ResultLemon aborted={item.aborted} />
434
+ {parts.join(' · ')}
435
+ </p>
436
+ );
437
+ }
438
+
439
+ function PermissionItem({
440
+ item,
441
+ onRespond,
442
+ }: {
443
+ item: Extract<AgentItem, { kind: 'permission' }>;
444
+ onRespond: (payload: RespondPayload) => Promise<void>;
445
+ }) {
446
+ const t = useLocale();
447
+ const [busy, runBusy] = useBusy();
448
+ const decide = (allow: boolean) => runBusy(() => onRespond({ allow }));
449
+
450
+ if (item.status !== 'pending') {
451
+ return (
452
+ <p className="flex min-w-0 items-center gap-2 text-[11.5px] leading-5 text-muted-foreground">
453
+ <span
454
+ aria-hidden
455
+ className={cn(
456
+ 'size-1 shrink-0 rounded-full',
457
+ item.status === 'allowed' ? 'bg-muted-foreground/40' : 'bg-destructive',
458
+ )}
459
+ />
460
+ <span className="shrink-0">
461
+ {item.status === 'allowed' ? t.agent.allowed : t.agent.denied}
462
+ </span>
463
+ <span className="min-w-0 truncate text-foreground/70">{item.title}</span>
464
+ </p>
465
+ );
466
+ }
467
+
468
+ return (
469
+ <div className="rounded-[8px] border border-hairline bg-background px-3 py-2.5">
470
+ <p className="text-[11.5px] text-muted-foreground">{t.agent.permissionTitle}</p>
471
+ <p className="mt-0.5 text-[12.5px] font-medium leading-snug">{item.title}</p>
472
+ {item.detail && (
473
+ <pre className="mt-1.5 line-clamp-4 whitespace-pre-wrap break-all font-mono text-[10.5px] leading-relaxed text-muted-foreground">
474
+ {item.detail}
475
+ </pre>
476
+ )}
477
+ <div className="mt-2.5 flex justify-end gap-1">
478
+ <Button size="xs" variant="ghost" disabled={busy} onClick={() => decide(false)}>
479
+ {t.agent.deny}
480
+ </Button>
481
+ <Button size="xs" disabled={busy} onClick={() => decide(true)}>
482
+ {t.agent.allow}
483
+ </Button>
484
+ </div>
485
+ </div>
486
+ );
487
+ }
488
+
489
+ function QuestionItem({
490
+ item,
491
+ onRespond,
492
+ }: {
493
+ item: Extract<AgentItem, { kind: 'question' }>;
494
+ onRespond: (payload: RespondPayload) => Promise<void>;
495
+ }) {
496
+ const t = useLocale();
497
+ const [picked, setPicked] = useState<Record<string, string[]>>({});
498
+ const [other, setOther] = useState<Record<string, string>>({});
499
+ const [busy, runBusy] = useBusy();
500
+
501
+ const answerFor = (q: AgentQuestion): string | null => {
502
+ const custom = other[q.question]?.trim();
503
+ const chosen = picked[q.question] ?? [];
504
+ const parts = [...chosen, ...(custom ? [custom] : [])];
505
+ return parts.length ? parts.join(', ') : null;
506
+ };
507
+ const complete = item.questions.every((q) => answerFor(q) !== null);
508
+
509
+ const reply = (payload: RespondPayload) => runBusy(() => onRespond(payload));
510
+ const submit = () => {
511
+ const answers: Record<string, string> = {};
512
+ for (const q of item.questions) answers[q.question] = answerFor(q) ?? '';
513
+ void reply({ answers });
514
+ };
515
+ const toggle = (q: AgentQuestion, label: string) =>
516
+ setPicked((prev) => {
517
+ const current = prev[q.question] ?? [];
518
+ const on = current.includes(label);
519
+ const next = q.multiSelect
520
+ ? on
521
+ ? current.filter((l) => l !== label)
522
+ : [...current, label]
523
+ : on
524
+ ? []
525
+ : [label];
526
+ return { ...prev, [q.question]: next };
527
+ });
528
+
529
+ if (item.status !== 'pending') {
530
+ return (
531
+ <div className="flex flex-col gap-0.5">
532
+ {item.questions.map((q) => (
533
+ <p key={q.question} className="text-[11.5px] leading-5 text-muted-foreground">
534
+ <span>{q.header || q.question}</span>
535
+ <span aria-hidden className="mx-1.5">
536
+ ·
537
+ </span>
538
+ <span className="text-foreground/80">
539
+ {item.status === 'answered'
540
+ ? item.answers?.[q.question] || '—'
541
+ : t.agent.questionCancelled}
542
+ </span>
543
+ </p>
544
+ ))}
545
+ </div>
546
+ );
547
+ }
548
+
549
+ return (
550
+ <div
551
+ data-lr-confirm
552
+ className="rounded-[8px] border border-hairline bg-background px-1.5 pt-2.5 pb-2"
553
+ >
554
+ <ConfirmWho />
555
+ <div className="flex flex-col gap-3">
556
+ {item.questions.map((q) => (
557
+ <fieldset key={q.question} className="min-w-0">
558
+ <legend className="px-1.5 text-[12.5px] font-medium leading-snug">{q.question}</legend>
559
+ <div className="mt-1 flex flex-col">
560
+ {q.options.map((option) => {
561
+ const selected = (picked[q.question] ?? []).includes(option.label);
562
+ return (
563
+ <button
564
+ key={option.label}
565
+ type="button"
566
+ aria-pressed={selected}
567
+ onClick={() => toggle(q, option.label)}
568
+ className="flex items-start gap-2 rounded-[5px] px-1.5 py-1 text-left outline-none transition-colors duration-100 hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring/30"
569
+ >
570
+ <span
571
+ aria-hidden
572
+ className={cn(
573
+ 'mt-[3px] grid size-3 shrink-0 place-items-center border transition-colors duration-100',
574
+ q.multiSelect ? 'rounded-[3px]' : 'rounded-full',
575
+ selected
576
+ ? 'border-foreground bg-foreground text-background'
577
+ : 'border-muted-foreground/40',
578
+ )}
579
+ >
580
+ {selected && <Check className="size-2" strokeWidth={3} />}
581
+ </span>
582
+ <span className="min-w-0">
583
+ <span className="block text-[12px] leading-snug">{option.label}</span>
584
+ {option.description && (
585
+ <span className="block text-[11px] leading-snug text-muted-foreground">
586
+ {option.description}
587
+ </span>
588
+ )}
589
+ </span>
590
+ </button>
591
+ );
592
+ })}
593
+ <input
594
+ value={other[q.question] ?? ''}
595
+ onChange={(e) => setOther((prev) => ({ ...prev, [q.question]: e.target.value }))}
596
+ onKeyDown={(e) => {
597
+ if (e.key === 'Enter' && !e.nativeEvent.isComposing && complete && !busy) {
598
+ e.preventDefault();
599
+ submit();
600
+ }
601
+ }}
602
+ placeholder={`${t.agent.questionOther}…`}
603
+ aria-label={t.agent.questionOtherPlaceholder}
604
+ className="mx-1.5 mt-1 h-7 border-b border-hairline bg-transparent text-[12px] outline-none placeholder:text-muted-foreground/60 focus-visible:border-foreground/40"
605
+ />
606
+ </div>
607
+ </fieldset>
608
+ ))}
609
+ </div>
610
+ <div className="mt-2.5 flex justify-end gap-1 px-1">
611
+ <Button size="xs" variant="ghost" disabled={busy} onClick={() => reply({ cancel: true })}>
612
+ {t.agent.questionSkip}
613
+ </Button>
614
+ <Button size="xs" disabled={busy || !complete} onClick={submit}>
615
+ {t.agent.questionSubmit}
616
+ </Button>
617
+ </div>
618
+ </div>
619
+ );
620
+ }
@@ -75,6 +75,8 @@ import {
75
75
  import { dragHasFiles } from '@/lib/dom';
76
76
  import { format, useLocale } from '@/lib/use-locale';
77
77
  import { cn, pad2 } from '@/lib/utils';
78
+ import { EmptyLemon } from '../lemonriver/agent/lemon';
79
+ import { toastUploadFailed } from '../lemonriver/feedback/upload';
78
80
 
79
81
  type Props = { slideId: string | null };
80
82
 
@@ -239,18 +241,18 @@ export function AssetView({ slideId }: Props) {
239
241
  if (decision === 'cancel') return;
240
242
  if (decision === 'replace') {
241
243
  const res = await upload(file, { overwrite: true });
242
- if (!res.ok) toast.error(format(t.asset.toastUploadFailed, { status: res.status }));
244
+ if (!res.ok) toastUploadFailed(t, res.status);
243
245
  else toast.success(format(t.asset.toastReplaced, { name: file.name }));
244
246
  return;
245
247
  }
246
248
  const next = renamedCopy(file, existingNames);
247
249
  const res = await upload(next, { overwrite: false });
248
- if (!res.ok) toast.error(format(t.asset.toastUploadFailed, { status: res.status }));
250
+ if (!res.ok) toastUploadFailed(t, res.status);
249
251
  else toast.success(format(t.asset.toastUploadedAs, { name: next.name }));
250
252
  return;
251
253
  }
252
254
  const res = await upload(file);
253
- if (!res.ok) toast.error(format(t.asset.toastUploadFailed, { status: res.status }));
255
+ if (!res.ok) toastUploadFailed(t, res.status);
254
256
  else toast.success(format(t.asset.toastUploaded, { name: file.name }));
255
257
  }
256
258
 
@@ -662,9 +664,7 @@ function EmptyState() {
662
664
  const t = useLocale();
663
665
  return (
664
666
  <div className="flex h-full flex-col items-center justify-center gap-4 px-6 py-16 text-center">
665
- <div className="flex size-12 items-center justify-center rounded-full border border-hairline bg-card text-muted-foreground">
666
- <ImageIcon className="size-5" />
667
- </div>
667
+ <EmptyLemon size={96} />
668
668
  <div>
669
669
  <p className="font-heading text-[14px] font-semibold tracking-tight">
670
670
  {t.asset.noAssetsYet}
@@ -1,5 +1,4 @@
1
1
  import { Check, Languages, Loader2, Monitor, Moon, RotateCw, Search, Sun } from 'lucide-react';
2
- import { useTheme } from 'next-themes';
3
2
  import { type ReactNode, useEffect, useMemo, useState } from 'react';
4
3
  import { IconTooltip } from '@/components/icon-tooltip';
5
4
  import { buttonVariants } from '@/components/ui/button';
@@ -8,6 +7,7 @@ import { IS_APPLE } from '@/lib/keys';
8
7
  import { LOCALE_OPTIONS, setLocale } from '@/lib/locale-store';
9
8
  import { format, useLocale } from '@/lib/use-locale';
10
9
  import { useRestartServer } from '@/lib/use-restart-server';
10
+ import { lemonRiverAppearanceCommands, useTheme } from '../../lemonriver/theme/use-theme';
11
11
  import {
12
12
  Command,
13
13
  CommandDialog,
@@ -193,6 +193,7 @@ function useSharedCommandGroups(): CommandGroupSpec[] {
193
193
  active: theme === 'system',
194
194
  run: () => setTheme('system'),
195
195
  },
196
+ ...lemonRiverAppearanceCommands(t, theme, setTheme),
196
197
  ...LOCALE_OPTIONS.map((option) => ({
197
198
  id: `locale-${option.id}`,
198
199
  label: format(t.commandMenu.languageItem, { name: option.label }),