@agentuity/workbench 0.0.87 → 0.0.89
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/dist/components/App.d.ts.map +1 -1
- package/dist/components/App.js +18 -2
- package/dist/components/App.js.map +1 -1
- package/dist/components/ai-elements/code-block.d.ts +3 -3
- package/dist/components/ai-elements/code-block.d.ts.map +1 -1
- package/dist/components/ai-elements/code-block.js +29 -7
- package/dist/components/ai-elements/code-block.js.map +1 -1
- package/dist/components/internal/Chat.d.ts +3 -2
- package/dist/components/internal/Chat.d.ts.map +1 -1
- package/dist/components/internal/Chat.js +23 -24
- package/dist/components/internal/Chat.js.map +1 -1
- package/dist/components/internal/MonacoJsonEditor.d.ts.map +1 -1
- package/dist/components/internal/MonacoJsonEditor.js +10 -53
- package/dist/components/internal/MonacoJsonEditor.js.map +1 -1
- package/dist/components/internal/Schema.d.ts +1 -2
- package/dist/components/internal/Schema.d.ts.map +1 -1
- package/dist/components/internal/Schema.js +2 -3
- package/dist/components/internal/Schema.js.map +1 -1
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/input.js +1 -1
- package/dist/components/ui/input.js.map +1 -1
- package/dist/index.d.ts +3 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -6
- package/dist/index.js.map +1 -1
- package/dist/{styles.css → standalone.css} +207 -1537
- package/package.json +29 -29
- package/src/{styles.css → base.css} +36 -52
- package/src/components/App.tsx +41 -5
- package/src/components/ai-elements/code-block.tsx +42 -10
- package/src/components/internal/Chat.tsx +112 -120
- package/src/components/internal/MonacoJsonEditor.tsx +15 -63
- package/src/components/internal/Schema.tsx +74 -86
- package/src/components/ui/input.tsx +2 -3
- package/src/index.ts +5 -14
- package/src/integration.css +15 -0
- package/src/standalone.css +25 -0
- package/dist/components/ConnectionStatus.d.ts +0 -7
- package/dist/components/ConnectionStatus.d.ts.map +0 -1
- package/dist/components/ConnectionStatus.js +0 -52
- package/dist/components/ConnectionStatus.js.map +0 -1
- package/dist/components/Inline.d.ts +0 -10
- package/dist/components/Inline.d.ts.map +0 -1
- package/dist/components/Inline.js +0 -11
- package/dist/components/Inline.js.map +0 -1
- package/dist/components/ai-elements/artifact.d.ts +0 -24
- package/dist/components/ai-elements/artifact.d.ts.map +0 -1
- package/dist/components/ai-elements/artifact.js +0 -21
- package/dist/components/ai-elements/artifact.js.map +0 -1
- package/dist/components/ai-elements/branch.d.ts +0 -21
- package/dist/components/ai-elements/branch.d.ts.map +0 -1
- package/dist/components/ai-elements/branch.js +0 -71
- package/dist/components/ai-elements/branch.js.map +0 -1
- package/dist/components/ai-elements/canvas.d.ts +0 -9
- package/dist/components/ai-elements/canvas.d.ts.map +0 -1
- package/dist/components/ai-elements/canvas.js +0 -6
- package/dist/components/ai-elements/canvas.js.map +0 -1
- package/dist/components/ai-elements/chain-of-thought.d.ts +0 -30
- package/dist/components/ai-elements/chain-of-thought.d.ts.map +0 -1
- package/dist/components/ai-elements/chain-of-thought.js +0 -52
- package/dist/components/ai-elements/chain-of-thought.js.map +0 -1
- package/dist/components/ai-elements/confirmation.d.ts +0 -27
- package/dist/components/ai-elements/confirmation.d.ts.map +0 -1
- package/dist/components/ai-elements/confirmation.js +0 -57
- package/dist/components/ai-elements/confirmation.js.map +0 -1
- package/dist/components/ai-elements/connection.d.ts +0 -3
- package/dist/components/ai-elements/connection.d.ts.map +0 -1
- package/dist/components/ai-elements/connection.js +0 -4
- package/dist/components/ai-elements/connection.js.map +0 -1
- package/dist/components/ai-elements/context.d.ts +0 -33
- package/dist/components/ai-elements/context.d.ts.map +0 -1
- package/dist/components/ai-elements/context.js +0 -167
- package/dist/components/ai-elements/context.js.map +0 -1
- package/dist/components/ai-elements/controls.d.ts +0 -5
- package/dist/components/ai-elements/controls.d.ts.map +0 -1
- package/dist/components/ai-elements/controls.js +0 -6
- package/dist/components/ai-elements/controls.js.map +0 -1
- package/dist/components/ai-elements/edge.d.ts +0 -6
- package/dist/components/ai-elements/edge.d.ts.map +0 -1
- package/dist/components/ai-elements/edge.js +0 -83
- package/dist/components/ai-elements/edge.js.map +0 -1
- package/dist/components/ai-elements/image.d.ts +0 -7
- package/dist/components/ai-elements/image.d.ts.map +0 -1
- package/dist/components/ai-elements/image.js +0 -4
- package/dist/components/ai-elements/image.js.map +0 -1
- package/dist/components/ai-elements/inline-citation.d.ts +0 -39
- package/dist/components/ai-elements/inline-citation.d.ts.map +0 -1
- package/dist/components/ai-elements/inline-citation.js +0 -62
- package/dist/components/ai-elements/inline-citation.js.map +0 -1
- package/dist/components/ai-elements/loader.d.ts +0 -6
- package/dist/components/ai-elements/loader.d.ts.map +0 -1
- package/dist/components/ai-elements/loader.js +0 -5
- package/dist/components/ai-elements/loader.js.map +0 -1
- package/dist/components/ai-elements/node.d.ts +0 -22
- package/dist/components/ai-elements/node.d.ts.map +0 -1
- package/dist/components/ai-elements/node.js +0 -12
- package/dist/components/ai-elements/node.js.map +0 -1
- package/dist/components/ai-elements/open-in-chat.d.ts +0 -29
- package/dist/components/ai-elements/open-in-chat.d.ts.map +0 -1
- package/dist/components/ai-elements/open-in-chat.js +0 -97
- package/dist/components/ai-elements/open-in-chat.js.map +0 -1
- package/dist/components/ai-elements/panel.d.ts +0 -6
- package/dist/components/ai-elements/panel.d.ts.map +0 -1
- package/dist/components/ai-elements/panel.js +0 -5
- package/dist/components/ai-elements/panel.js.map +0 -1
- package/dist/components/ai-elements/plan.d.ts +0 -26
- package/dist/components/ai-elements/plan.d.ts.map +0 -1
- package/dist/components/ai-elements/plan.js +0 -32
- package/dist/components/ai-elements/plan.js.map +0 -1
- package/dist/components/ai-elements/queue.d.ts +0 -62
- package/dist/components/ai-elements/queue.d.ts.map +0 -1
- package/dist/components/ai-elements/queue.js +0 -25
- package/dist/components/ai-elements/queue.js.map +0 -1
- package/dist/components/ai-elements/reasoning.d.ts +0 -17
- package/dist/components/ai-elements/reasoning.d.ts.map +0 -1
- package/dist/components/ai-elements/reasoning.js +0 -77
- package/dist/components/ai-elements/reasoning.js.map +0 -1
- package/dist/components/ai-elements/response.d.ts +0 -6
- package/dist/components/ai-elements/response.d.ts.map +0 -1
- package/dist/components/ai-elements/response.js +0 -8
- package/dist/components/ai-elements/response.js.map +0 -1
- package/dist/components/ai-elements/sources.d.ts +0 -13
- package/dist/components/ai-elements/sources.d.ts.map +0 -1
- package/dist/components/ai-elements/sources.js +0 -10
- package/dist/components/ai-elements/sources.js.map +0 -1
- package/dist/components/ai-elements/suggestion.d.ts +0 -11
- package/dist/components/ai-elements/suggestion.d.ts.map +0 -1
- package/dist/components/ai-elements/suggestion.js +0 -13
- package/dist/components/ai-elements/suggestion.js.map +0 -1
- package/dist/components/ai-elements/task.d.ts +0 -15
- package/dist/components/ai-elements/task.d.ts.map +0 -1
- package/dist/components/ai-elements/task.js +0 -11
- package/dist/components/ai-elements/task.js.map +0 -1
- package/dist/components/ai-elements/tool.d.ts +0 -24
- package/dist/components/ai-elements/tool.d.ts.map +0 -1
- package/dist/components/ai-elements/tool.js +0 -47
- package/dist/components/ai-elements/tool.js.map +0 -1
- package/dist/components/ai-elements/toolbar.d.ts +0 -6
- package/dist/components/ai-elements/toolbar.d.ts.map +0 -1
- package/dist/components/ai-elements/toolbar.js +0 -5
- package/dist/components/ai-elements/toolbar.js.map +0 -1
- package/dist/components/ai-elements/web-preview.d.ts +0 -35
- package/dist/components/ai-elements/web-preview.d.ts.map +0 -1
- package/dist/components/ai-elements/web-preview.js +0 -63
- package/dist/components/ai-elements/web-preview.js.map +0 -1
- package/dist/components/ui/alert.d.ts +0 -10
- package/dist/components/ui/alert.d.ts.map +0 -1
- package/dist/components/ui/alert.js +0 -25
- package/dist/components/ui/alert.js.map +0 -1
- package/dist/components/ui/badge.d.ts +0 -10
- package/dist/components/ui/badge.d.ts.map +0 -1
- package/dist/components/ui/badge.js +0 -23
- package/dist/components/ui/badge.js.map +0 -1
- package/dist/components/ui/card.d.ts +0 -10
- package/dist/components/ui/card.d.ts.map +0 -1
- package/dist/components/ui/card.js +0 -25
- package/dist/components/ui/card.js.map +0 -1
- package/dist/components/ui/carousel.d.ts +0 -20
- package/dist/components/ui/carousel.d.ts.map +0 -1
- package/dist/components/ui/carousel.js +0 -92
- package/dist/components/ui/carousel.js.map +0 -1
- package/dist/components/ui/checkbox.d.ts +0 -5
- package/dist/components/ui/checkbox.d.ts.map +0 -1
- package/dist/components/ui/checkbox.js +0 -9
- package/dist/components/ui/checkbox.js.map +0 -1
- package/dist/components/ui/collapsible.d.ts +0 -6
- package/dist/components/ui/collapsible.d.ts.map +0 -1
- package/dist/components/ui/collapsible.js +0 -14
- package/dist/components/ui/collapsible.js.map +0 -1
- package/dist/components/ui/field.d.ts +0 -25
- package/dist/components/ui/field.d.ts.map +0 -1
- package/dist/components/ui/field.js +0 -74
- package/dist/components/ui/field.js.map +0 -1
- package/dist/components/ui/form.d.ts +0 -25
- package/dist/components/ui/form.d.ts.map +0 -1
- package/dist/components/ui/form.js +0 -58
- package/dist/components/ui/form.js.map +0 -1
- package/dist/components/ui/label.d.ts +0 -5
- package/dist/components/ui/label.d.ts.map +0 -1
- package/dist/components/ui/label.js +0 -9
- package/dist/components/ui/label.js.map +0 -1
- package/dist/components/ui/progress.d.ts +0 -5
- package/dist/components/ui/progress.d.ts.map +0 -1
- package/dist/components/ui/progress.js +0 -9
- package/dist/components/ui/progress.js.map +0 -1
- package/dist/components/ui/separator.d.ts +0 -5
- package/dist/components/ui/separator.d.ts.map +0 -1
- package/dist/components/ui/separator.js +0 -9
- package/dist/components/ui/separator.js.map +0 -1
- package/dist/components/ui/switch.d.ts +0 -5
- package/dist/components/ui/switch.d.ts.map +0 -1
- package/dist/components/ui/switch.js +0 -8
- package/dist/components/ui/switch.js.map +0 -1
- package/dist/components/ui/tabs.d.ts +0 -8
- package/dist/components/ui/tabs.d.ts.map +0 -1
- package/dist/components/ui/tabs.js +0 -17
- package/dist/components/ui/tabs.js.map +0 -1
- package/dist/components/ui/toggle.d.ts +0 -10
- package/dist/components/ui/toggle.d.ts.map +0 -1
- package/dist/components/ui/toggle.js +0 -26
- package/dist/components/ui/toggle.js.map +0 -1
- package/dist/components.d.ts +0 -12
- package/dist/components.d.ts.map +0 -1
- package/dist/components.js +0 -13
- package/dist/components.js.map +0 -1
- package/dist/hooks/index.d.ts +0 -7
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/index.js +0 -5
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/useWorkbenchSchemas.d.ts +0 -56
- package/dist/hooks/useWorkbenchSchemas.d.ts.map +0 -1
- package/dist/hooks/useWorkbenchSchemas.js +0 -63
- package/dist/hooks/useWorkbenchSchemas.js.map +0 -1
- package/src/components/ConnectionStatus.tsx +0 -67
- package/src/components/Inline.tsx +0 -16
- package/src/components/ai-elements/artifact.tsx +0 -118
- package/src/components/ai-elements/branch.tsx +0 -187
- package/src/components/ai-elements/canvas.tsx +0 -24
- package/src/components/ai-elements/chain-of-thought.tsx +0 -198
- package/src/components/ai-elements/confirmation.tsx +0 -119
- package/src/components/ai-elements/connection.tsx +0 -16
- package/src/components/ai-elements/context.tsx +0 -357
- package/src/components/ai-elements/controls.tsx +0 -18
- package/src/components/ai-elements/edge.tsx +0 -131
- package/src/components/ai-elements/image.tsx +0 -16
- package/src/components/ai-elements/inline-citation.tsx +0 -246
- package/src/components/ai-elements/loader.tsx +0 -88
- package/src/components/ai-elements/node.tsx +0 -66
- package/src/components/ai-elements/open-in-chat.tsx +0 -333
- package/src/components/ai-elements/panel.tsx +0 -12
- package/src/components/ai-elements/plan.tsx +0 -123
- package/src/components/ai-elements/queue.tsx +0 -231
- package/src/components/ai-elements/reasoning.tsx +0 -163
- package/src/components/ai-elements/response.tsx +0 -19
- package/src/components/ai-elements/sources.tsx +0 -53
- package/src/components/ai-elements/suggestion.tsx +0 -47
- package/src/components/ai-elements/task.tsx +0 -64
- package/src/components/ai-elements/tool.tsx +0 -136
- package/src/components/ai-elements/toolbar.tsx +0 -13
- package/src/components/ai-elements/web-preview.tsx +0 -238
- package/src/components/ui/alert.tsx +0 -60
- package/src/components/ui/badge.tsx +0 -40
- package/src/components/ui/card.tsx +0 -41
- package/src/components/ui/carousel.tsx +0 -234
- package/src/components/ui/checkbox.tsx +0 -27
- package/src/components/ui/collapsible.tsx +0 -21
- package/src/components/ui/field.tsx +0 -234
- package/src/components/ui/form.tsx +0 -154
- package/src/components/ui/label.tsx +0 -21
- package/src/components/ui/progress.tsx +0 -28
- package/src/components/ui/separator.tsx +0 -28
- package/src/components/ui/switch.tsx +0 -26
- package/src/components/ui/tabs.tsx +0 -52
- package/src/components/ui/toggle.tsx +0 -44
- package/src/components.tsx +0 -29
- package/src/hooks/index.ts +0 -20
- package/src/hooks/useWorkbenchSchemas.ts +0 -69
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import Editor, { type Monaco, type OnMount } from '@monaco-editor/react';
|
|
3
3
|
import { useTheme } from '../ui/theme-provider';
|
|
4
|
-
import { bundledThemes } from 'shiki';
|
|
5
4
|
import type { JSONSchema7 } from 'ai';
|
|
6
5
|
import type * as monaco from 'monaco-editor';
|
|
6
|
+
import type { ThemeRegistration } from 'shiki';
|
|
7
|
+
import oneLightModule from '@shikijs/themes/one-light';
|
|
8
|
+
import oneDarkProModule from '@shikijs/themes/one-dark-pro';
|
|
7
9
|
|
|
8
10
|
interface MonacoJsonEditorProps {
|
|
9
11
|
value: string;
|
|
@@ -328,72 +330,22 @@ export function MonacoJsonEditor({
|
|
|
328
330
|
}
|
|
329
331
|
}, 0);
|
|
330
332
|
}}
|
|
331
|
-
beforeMount={
|
|
333
|
+
beforeMount={(monaco) => {
|
|
332
334
|
setMonacoInstance(monaco);
|
|
333
335
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
336
|
+
// Use the same direct theme imports as code-block
|
|
337
|
+
const oneLight = (
|
|
338
|
+
'default' in oneLightModule ? oneLightModule.default : oneLightModule
|
|
339
|
+
) as ThemeRegistration;
|
|
340
|
+
const oneDarkPro = (
|
|
341
|
+
'default' in oneDarkProModule ? oneDarkProModule.default : oneDarkProModule
|
|
342
|
+
) as ThemeRegistration;
|
|
338
343
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
oneLightThemeModule.default,
|
|
342
|
-
'one-light'
|
|
343
|
-
);
|
|
344
|
-
monaco.editor.defineTheme('custom-light', lightMonacoTheme);
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
if (oneDarkProThemeModule?.default) {
|
|
348
|
-
const darkMonacoTheme = convertShikiToMonaco(
|
|
349
|
-
oneDarkProThemeModule.default,
|
|
350
|
-
'one-dark-pro'
|
|
351
|
-
);
|
|
352
|
-
monaco.editor.defineTheme('custom-dark', darkMonacoTheme);
|
|
353
|
-
}
|
|
354
|
-
} catch (error) {
|
|
355
|
-
console.warn(
|
|
356
|
-
'Failed to load Shiki themes, falling back to manual themes:',
|
|
357
|
-
error
|
|
358
|
-
);
|
|
359
|
-
|
|
360
|
-
// Fallback to manual theme definitions
|
|
361
|
-
monaco.editor.defineTheme('custom-light', {
|
|
362
|
-
base: 'vs',
|
|
363
|
-
inherit: true,
|
|
364
|
-
rules: [
|
|
365
|
-
{ token: 'string.key.json', foreground: 'e45649' },
|
|
366
|
-
{ token: 'string.value.json', foreground: '50a14f' },
|
|
367
|
-
{ token: 'number.json', foreground: '986801' },
|
|
368
|
-
{ token: 'keyword.json', foreground: '986801' },
|
|
369
|
-
{ token: 'string', foreground: '50a14f' },
|
|
370
|
-
{ token: 'number', foreground: '986801' },
|
|
371
|
-
{ token: 'keyword', foreground: '986801' },
|
|
372
|
-
],
|
|
373
|
-
colors: {
|
|
374
|
-
'editor.background': '#00000000',
|
|
375
|
-
'editor.foreground': '#383a42',
|
|
376
|
-
},
|
|
377
|
-
});
|
|
344
|
+
const lightMonacoTheme = convertShikiToMonaco(oneLight, 'one-light');
|
|
345
|
+
monaco.editor.defineTheme('custom-light', lightMonacoTheme);
|
|
378
346
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
inherit: true,
|
|
382
|
-
rules: [
|
|
383
|
-
{ token: 'string.key.json', foreground: 'e06c75' },
|
|
384
|
-
{ token: 'string.value.json', foreground: '98c379' },
|
|
385
|
-
{ token: 'number.json', foreground: 'd19a66' },
|
|
386
|
-
{ token: 'keyword.json', foreground: 'c678dd' },
|
|
387
|
-
{ token: 'string', foreground: '98c379' },
|
|
388
|
-
{ token: 'number', foreground: 'd19a66' },
|
|
389
|
-
{ token: 'keyword', foreground: 'c678dd' },
|
|
390
|
-
],
|
|
391
|
-
colors: {
|
|
392
|
-
'editor.background': '#00000000',
|
|
393
|
-
'editor.foreground': '#abb2bf',
|
|
394
|
-
},
|
|
395
|
-
});
|
|
396
|
-
}
|
|
347
|
+
const darkMonacoTheme = convertShikiToMonaco(oneDarkPro, 'one-dark-pro');
|
|
348
|
+
monaco.editor.defineTheme('custom-dark', darkMonacoTheme);
|
|
397
349
|
}}
|
|
398
350
|
/>
|
|
399
351
|
</div>
|
|
@@ -3,109 +3,97 @@ import { X, FileJson } from 'lucide-react';
|
|
|
3
3
|
import { Button } from '../ui/button';
|
|
4
4
|
import { CodeBlock, CodeBlockCopyButton } from '../ai-elements/code-block';
|
|
5
5
|
import { ScrollArea } from '../ui/scroll-area';
|
|
6
|
-
import { cn } from '../../lib/utils';
|
|
7
6
|
import { useWorkbench } from './WorkbenchProvider';
|
|
8
7
|
|
|
9
8
|
export interface SchemaProps {
|
|
10
|
-
open: boolean;
|
|
11
9
|
onOpenChange: (open: boolean) => void;
|
|
12
10
|
}
|
|
13
11
|
|
|
14
|
-
export function Schema({
|
|
12
|
+
export function Schema({ onOpenChange }: SchemaProps) {
|
|
15
13
|
const { agents, selectedAgent, schemasLoading, schemasError } = useWorkbench();
|
|
16
14
|
|
|
17
15
|
const selectedAgentData =
|
|
18
16
|
Object.values(agents).find((agent) => agent.metadata.agentId === selectedAgent) || null;
|
|
19
17
|
|
|
20
18
|
return (
|
|
21
|
-
|
|
22
|
-
{/*
|
|
23
|
-
<div
|
|
24
|
-
className=
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<div>
|
|
34
|
-
<h2 className="text-lg font-semibold">Schema</h2>
|
|
35
|
-
{selectedAgentData && (
|
|
36
|
-
<p className="text-sm text-muted-foreground">
|
|
37
|
-
{selectedAgentData.metadata.name}
|
|
38
|
-
</p>
|
|
39
|
-
)}
|
|
40
|
-
</div>
|
|
19
|
+
<div className="h-full bg-background border-l border-border flex flex-col">
|
|
20
|
+
{/* Header */}
|
|
21
|
+
<div className="flex items-center justify-between p-4 border-b border-border">
|
|
22
|
+
<div className="flex items-center gap-2">
|
|
23
|
+
<FileJson className="size-5 text-muted-foreground" />
|
|
24
|
+
<div>
|
|
25
|
+
<h2 className="text-lg font-semibold">Schema</h2>
|
|
26
|
+
{selectedAgentData && (
|
|
27
|
+
<p className="text-sm text-muted-foreground">
|
|
28
|
+
{selectedAgentData.metadata.name}
|
|
29
|
+
</p>
|
|
30
|
+
)}
|
|
41
31
|
</div>
|
|
42
|
-
<Button
|
|
43
|
-
variant="ghost"
|
|
44
|
-
size="icon"
|
|
45
|
-
onClick={() => onOpenChange(false)}
|
|
46
|
-
className="size-8"
|
|
47
|
-
>
|
|
48
|
-
<X className="size-4" />
|
|
49
|
-
</Button>
|
|
50
32
|
</div>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
33
|
+
<Button
|
|
34
|
+
variant="ghost"
|
|
35
|
+
size="icon"
|
|
36
|
+
onClick={() => onOpenChange(false)}
|
|
37
|
+
className="size-8"
|
|
38
|
+
>
|
|
39
|
+
<X className="size-4" />
|
|
40
|
+
</Button>
|
|
41
|
+
</div>
|
|
42
|
+
{/* Content */}
|
|
43
|
+
<ScrollArea className="flex-1">
|
|
44
|
+
<div className="p-6 space-y-6">
|
|
45
|
+
{schemasLoading && (
|
|
46
|
+
<div className="text-center text-muted-foreground py-8">Loading schemas...</div>
|
|
47
|
+
)}
|
|
59
48
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
49
|
+
{schemasError && (
|
|
50
|
+
<div className="rounded-md bg-destructive/10 text-destructive p-4">
|
|
51
|
+
<p className="font-medium">Error loading schemas</p>
|
|
52
|
+
<p className="text-sm mt-1">{schemasError.message}</p>
|
|
53
|
+
</div>
|
|
54
|
+
)}
|
|
66
55
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
56
|
+
{!schemasLoading && !schemasError && !selectedAgentData && (
|
|
57
|
+
<div className="text-center text-muted-foreground py-8">
|
|
58
|
+
<p>No schema available for selected agent</p>
|
|
59
|
+
</div>
|
|
60
|
+
)}
|
|
72
61
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
</>
|
|
62
|
+
{!schemasLoading && !schemasError && selectedAgentData && (
|
|
63
|
+
<>
|
|
64
|
+
{/* Input Schema */}
|
|
65
|
+
{selectedAgentData.schema.input?.code ? (
|
|
66
|
+
<div className="space-y-2">
|
|
67
|
+
<h3 className="text-sm font-semibold text-muted-foreground uppercase tracking-wide">
|
|
68
|
+
Input Schema
|
|
69
|
+
</h3>
|
|
70
|
+
<CodeBlock
|
|
71
|
+
code={selectedAgentData.schema.input?.code}
|
|
72
|
+
language="typescript"
|
|
73
|
+
>
|
|
74
|
+
<CodeBlockCopyButton />
|
|
75
|
+
</CodeBlock>
|
|
76
|
+
</div>
|
|
77
|
+
) : null}
|
|
78
|
+
{/* Output Schema */}
|
|
79
|
+
{selectedAgentData.schema.output?.code ? (
|
|
80
|
+
<div className="space-y-2">
|
|
81
|
+
<h3 className="text-sm font-semibold text-muted-foreground uppercase tracking-wide">
|
|
82
|
+
Output Schema
|
|
83
|
+
</h3>
|
|
84
|
+
<CodeBlock
|
|
85
|
+
code={selectedAgentData.schema.output?.code}
|
|
86
|
+
language="typescript"
|
|
87
|
+
>
|
|
88
|
+
<CodeBlockCopyButton />
|
|
89
|
+
</CodeBlock>
|
|
90
|
+
</div>
|
|
91
|
+
) : null}
|
|
92
|
+
</>
|
|
93
|
+
)}
|
|
94
|
+
</div>
|
|
95
|
+
</ScrollArea>
|
|
96
|
+
</div>
|
|
109
97
|
);
|
|
110
98
|
}
|
|
111
99
|
|
|
@@ -8,9 +8,8 @@ function Input({ className, type, ...props }: React.ComponentProps<'input'>) {
|
|
|
8
8
|
type={type}
|
|
9
9
|
data-slot="input"
|
|
10
10
|
className={cn(
|
|
11
|
-
'file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:
|
|
12
|
-
'
|
|
13
|
-
'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',
|
|
11
|
+
'border-input file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-[3px] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
|
|
12
|
+
'aria-invalid:focus-visible:ring-0',
|
|
14
13
|
className
|
|
15
14
|
)}
|
|
16
15
|
{...props}
|
package/src/index.ts
CHANGED
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
// Export types
|
|
2
2
|
export type { WorkbenchInstance } from './types';
|
|
3
3
|
|
|
4
|
-
// Export UI components
|
|
5
|
-
export { Button } from './components/ui/button';
|
|
6
|
-
export {
|
|
7
|
-
Card,
|
|
8
|
-
CardHeader,
|
|
9
|
-
CardTitle,
|
|
10
|
-
CardDescription,
|
|
11
|
-
CardContent,
|
|
12
|
-
CardFooter,
|
|
13
|
-
} from './components/ui/card';
|
|
14
|
-
export { Input } from './components/ui/input';
|
|
15
|
-
|
|
16
4
|
// Export components
|
|
17
5
|
export { default as App } from './components/App';
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
6
|
+
export { Chat } from './components/internal/Chat';
|
|
7
|
+
export { Schema } from './components/internal/Schema';
|
|
8
|
+
export { WorkbenchProvider, useWorkbench } from './components/internal/WorkbenchProvider';
|
|
9
|
+
|
|
10
|
+
// Export workbench functions
|
|
20
11
|
export { createWorkbench } from './workbench';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* Integration version - no Tailwind import, processed by app's Tailwind */
|
|
2
|
+
/* This file should be imported in the app's CSS file (e.g., globals.css) */
|
|
3
|
+
/* The app must have Tailwind imported before importing this file */
|
|
4
|
+
|
|
5
|
+
@import './base.css';
|
|
6
|
+
|
|
7
|
+
/* Tell Tailwind to scan workbench components for class names */
|
|
8
|
+
/* Note: The path below is relative to this CSS file's location in the package */
|
|
9
|
+
@source "./**/*.{ts,tsx}";
|
|
10
|
+
|
|
11
|
+
/* Workbench base styles */
|
|
12
|
+
/* Using @layer workbench-base with lower priority than app's base layer */
|
|
13
|
+
@layer workbench-base {
|
|
14
|
+
/* No global styles - workbench components use explicit classes */
|
|
15
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* Standalone version - includes Tailwind and all styles for standalone workbench */
|
|
2
|
+
@import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@100..900&family=Geist:wght@100..900&display=block');
|
|
3
|
+
@import './base.css';
|
|
4
|
+
@import 'tailwindcss';
|
|
5
|
+
@plugin "tailwindcss-animate";
|
|
6
|
+
@variant dark (&:is(.dark *));
|
|
7
|
+
|
|
8
|
+
@layer base {
|
|
9
|
+
html,
|
|
10
|
+
body {
|
|
11
|
+
@apply h-full w-full m-0 p-0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
:root {
|
|
15
|
+
@apply font-sans;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
* {
|
|
19
|
+
@apply border-border outline-ring/50;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
#root {
|
|
23
|
+
@apply w-full h-full relative flex flex-col m-0 bg-background text-foreground;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ConnectionStatus as ConnectionStatusType } from '../types/config';
|
|
2
|
-
interface ConnectionStatusProps {
|
|
3
|
-
status: ConnectionStatusType;
|
|
4
|
-
}
|
|
5
|
-
export declare function ConnectionStatus({ status }: ConnectionStatusProps): import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
-
export {};
|
|
7
|
-
//# sourceMappingURL=ConnectionStatus.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionStatus.d.ts","sourceRoot":"","sources":["../../src/components/ConnectionStatus.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,IAAI,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEhF,UAAU,qBAAqB;IAC9B,MAAM,EAAE,oBAAoB,CAAC;CAC7B;AAED,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,EAAE,qBAAqB,kDA2DjE"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
export function ConnectionStatus({ status }) {
|
|
3
|
-
if (status === 'connected') {
|
|
4
|
-
return null; // Don't show anything when connected normally
|
|
5
|
-
}
|
|
6
|
-
const getStatusConfig = (status) => {
|
|
7
|
-
switch (status) {
|
|
8
|
-
case 'restarting':
|
|
9
|
-
return {
|
|
10
|
-
text: 'Server restarting...',
|
|
11
|
-
bgColor: 'bg-amber-100',
|
|
12
|
-
textColor: 'text-amber-800',
|
|
13
|
-
borderColor: 'border-amber-200',
|
|
14
|
-
icon: '🔄',
|
|
15
|
-
};
|
|
16
|
-
case 'disconnected':
|
|
17
|
-
return {
|
|
18
|
-
text: 'Disconnected from server',
|
|
19
|
-
bgColor: 'bg-red-100',
|
|
20
|
-
textColor: 'text-red-800',
|
|
21
|
-
borderColor: 'border-red-200',
|
|
22
|
-
icon: '⚠️',
|
|
23
|
-
};
|
|
24
|
-
case 'connected':
|
|
25
|
-
return {
|
|
26
|
-
text: 'Connected',
|
|
27
|
-
bgColor: 'bg-green-100',
|
|
28
|
-
textColor: 'text-green-800',
|
|
29
|
-
borderColor: 'border-green-200',
|
|
30
|
-
icon: '✅',
|
|
31
|
-
};
|
|
32
|
-
default:
|
|
33
|
-
return {
|
|
34
|
-
text: 'Unknown status',
|
|
35
|
-
bgColor: 'bg-gray-100',
|
|
36
|
-
textColor: 'text-gray-800',
|
|
37
|
-
borderColor: 'border-gray-200',
|
|
38
|
-
icon: '❓',
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
const config = getStatusConfig(status);
|
|
43
|
-
return (_jsxs("div", { className: `
|
|
44
|
-
fixed top-0 left-0 right-0 z-50
|
|
45
|
-
px-4 py-2
|
|
46
|
-
${config.bgColor} ${config.textColor} ${config.borderColor}
|
|
47
|
-
border-b
|
|
48
|
-
text-center text-sm font-medium
|
|
49
|
-
transition-all duration-200 ease-in-out
|
|
50
|
-
`, children: [_jsx("span", { className: "mr-2", children: config.icon }), config.text] }));
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=ConnectionStatus.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionStatus.js","sourceRoot":"","sources":["../../src/components/ConnectionStatus.tsx"],"names":[],"mappings":";AAOA,MAAM,UAAU,gBAAgB,CAAC,EAAE,MAAM,EAAyB;IACjE,IAAI,MAAM,KAAK,WAAW,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC,CAAC,8CAA8C;IAC5D,CAAC;IAED,MAAM,eAAe,GAAG,CAAC,MAA4B,EAAE,EAAE;QACxD,QAAQ,MAAM,EAAE,CAAC;YAChB,KAAK,YAAY;gBAChB,OAAO;oBACN,IAAI,EAAE,sBAAsB;oBAC5B,OAAO,EAAE,cAAc;oBACvB,SAAS,EAAE,gBAAgB;oBAC3B,WAAW,EAAE,kBAAkB;oBAC/B,IAAI,EAAE,IAAI;iBACV,CAAC;YACH,KAAK,cAAc;gBAClB,OAAO;oBACN,IAAI,EAAE,0BAA0B;oBAChC,OAAO,EAAE,YAAY;oBACrB,SAAS,EAAE,cAAc;oBACzB,WAAW,EAAE,gBAAgB;oBAC7B,IAAI,EAAE,IAAI;iBACV,CAAC;YACH,KAAK,WAAW;gBACf,OAAO;oBACN,IAAI,EAAE,WAAW;oBACjB,OAAO,EAAE,cAAc;oBACvB,SAAS,EAAE,gBAAgB;oBAC3B,WAAW,EAAE,kBAAkB;oBAC/B,IAAI,EAAE,GAAG;iBACT,CAAC;YACH;gBACC,OAAO;oBACN,IAAI,EAAE,gBAAgB;oBACtB,OAAO,EAAE,aAAa;oBACtB,SAAS,EAAE,eAAe;oBAC1B,WAAW,EAAE,iBAAiB;oBAC9B,IAAI,EAAE,GAAG;iBACT,CAAC;QACJ,CAAC;IACF,CAAC,CAAC;IAEF,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAEvC,OAAO,CACN,eACC,SAAS,EAAE;;;MAGR,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,WAAW;;;;IAI1D,aAED,eAAM,SAAS,EAAC,MAAM,YAAE,MAAM,CAAC,IAAI,GAAQ,EAC1C,MAAM,CAAC,IAAI,IACP,CACN,CAAC;AACH,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export interface InlineProps {
|
|
2
|
-
className?: string;
|
|
3
|
-
}
|
|
4
|
-
/**
|
|
5
|
-
* Inline component - just the chat area
|
|
6
|
-
* Must be used within WorkbenchProvider
|
|
7
|
-
*/
|
|
8
|
-
export declare function Inline({ className }: InlineProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export default Inline;
|
|
10
|
-
//# sourceMappingURL=Inline.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Inline.d.ts","sourceRoot":"","sources":["../../src/components/Inline.tsx"],"names":[],"mappings":"AAGA,MAAM,WAAW,WAAW;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,EAAE,SAAS,EAAE,EAAE,WAAW,2CAEhD;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Chat } from './internal/Chat';
|
|
3
|
-
/**
|
|
4
|
-
* Inline component - just the chat area
|
|
5
|
-
* Must be used within WorkbenchProvider
|
|
6
|
-
*/
|
|
7
|
-
export function Inline({ className }) {
|
|
8
|
-
return _jsx(Chat, { className: className });
|
|
9
|
-
}
|
|
10
|
-
export default Inline;
|
|
11
|
-
//# sourceMappingURL=Inline.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Inline.js","sourceRoot":"","sources":["../../src/components/Inline.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAMvC;;;GAGG;AACH,MAAM,UAAU,MAAM,CAAC,EAAE,SAAS,EAAe;IAChD,OAAO,KAAC,IAAI,IAAC,SAAS,EAAE,SAAS,GAAI,CAAC;AACvC,CAAC;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Button } from '../ui/button';
|
|
2
|
-
import { type LucideIcon } from 'lucide-react';
|
|
3
|
-
import type { ComponentProps, HTMLAttributes } from 'react';
|
|
4
|
-
export type ArtifactProps = HTMLAttributes<HTMLDivElement>;
|
|
5
|
-
export declare const Artifact: ({ className, ...props }: ArtifactProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export type ArtifactHeaderProps = HTMLAttributes<HTMLDivElement>;
|
|
7
|
-
export declare const ArtifactHeader: ({ className, ...props }: ArtifactHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export type ArtifactCloseProps = ComponentProps<typeof Button>;
|
|
9
|
-
export declare const ArtifactClose: ({ className, children, size, variant, ...props }: ArtifactCloseProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export type ArtifactTitleProps = HTMLAttributes<HTMLParagraphElement>;
|
|
11
|
-
export declare const ArtifactTitle: ({ className, ...props }: ArtifactTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export type ArtifactDescriptionProps = HTMLAttributes<HTMLParagraphElement>;
|
|
13
|
-
export declare const ArtifactDescription: ({ className, ...props }: ArtifactDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export type ArtifactActionsProps = HTMLAttributes<HTMLDivElement>;
|
|
15
|
-
export declare const ArtifactActions: ({ className, ...props }: ArtifactActionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
export type ArtifactActionProps = ComponentProps<typeof Button> & {
|
|
17
|
-
tooltip?: string;
|
|
18
|
-
label?: string;
|
|
19
|
-
icon?: LucideIcon;
|
|
20
|
-
};
|
|
21
|
-
export declare const ArtifactAction: ({ tooltip, label, icon: Icon, children, className, size, variant, ...props }: ArtifactActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
export type ArtifactContentProps = HTMLAttributes<HTMLDivElement>;
|
|
23
|
-
export declare const ArtifactContent: ({ className, ...props }: ArtifactContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
-
//# sourceMappingURL=artifact.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"artifact.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/artifact.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,OAAO,EAAE,KAAK,UAAU,EAAS,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5D,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAE3D,eAAO,MAAM,QAAQ,GAAI,yBAAyB,aAAa,4CAQ9D,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEjE,eAAO,MAAM,cAAc,GAAI,yBAAyB,mBAAmB,4CAK1E,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;AAE/D,eAAO,MAAM,aAAa,GAAI,kDAM3B,kBAAkB,4CAWpB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,oBAAoB,CAAC,CAAC;AAEtE,eAAO,MAAM,aAAa,GAAI,yBAAyB,kBAAkB,4CAExE,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,cAAc,CAAC,oBAAoB,CAAC,CAAC;AAE5E,eAAO,MAAM,mBAAmB,GAAI,yBAAyB,wBAAwB,4CAEpF,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAElE,eAAO,MAAM,eAAe,GAAI,yBAAyB,oBAAoB,4CAE5E,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,GAAG;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,UAAU,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,8EAS5B,mBAAmB,4CA4BrB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAElE,eAAO,MAAM,eAAe,GAAI,yBAAyB,oBAAoB,4CAE5E,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Button } from '../ui/button';
|
|
4
|
-
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip';
|
|
5
|
-
import { cn } from '../../lib/utils';
|
|
6
|
-
import { XIcon } from 'lucide-react';
|
|
7
|
-
export const Artifact = ({ className, ...props }) => (_jsx("div", { className: cn('flex flex-col overflow-hidden rounded-lg border bg-background shadow-sm', className), ...props }));
|
|
8
|
-
export const ArtifactHeader = ({ className, ...props }) => (_jsx("div", { className: cn('flex items-center justify-between border-b bg-muted/50 px-4 py-3', className), ...props }));
|
|
9
|
-
export const ArtifactClose = ({ className, children, size = 'sm', variant = 'ghost', ...props }) => (_jsxs(Button, { className: cn('size-8 p-0 text-muted-foreground hover:text-foreground', className), size: size, type: "button", variant: variant, ...props, children: [children ?? _jsx(XIcon, { className: "size-4" }), _jsx("span", { className: "sr-only", children: "Close" })] }));
|
|
10
|
-
export const ArtifactTitle = ({ className, ...props }) => (_jsx("p", { className: cn('font-medium text-foreground text-sm', className), ...props }));
|
|
11
|
-
export const ArtifactDescription = ({ className, ...props }) => (_jsx("p", { className: cn('text-muted-foreground text-sm', className), ...props }));
|
|
12
|
-
export const ArtifactActions = ({ className, ...props }) => (_jsx("div", { className: cn('flex items-center gap-1', className), ...props }));
|
|
13
|
-
export const ArtifactAction = ({ tooltip, label, icon: Icon, children, className, size = 'sm', variant = 'ghost', ...props }) => {
|
|
14
|
-
const button = (_jsxs(Button, { className: cn('size-8 p-0 text-muted-foreground hover:text-foreground', className), size: size, type: "button", variant: variant, ...props, children: [Icon ? _jsx(Icon, { className: "size-4" }) : children, _jsx("span", { className: "sr-only", children: label || tooltip })] }));
|
|
15
|
-
if (tooltip) {
|
|
16
|
-
return (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: button }), _jsx(TooltipContent, { children: _jsx("p", { children: tooltip }) })] }) }));
|
|
17
|
-
}
|
|
18
|
-
return button;
|
|
19
|
-
};
|
|
20
|
-
export const ArtifactContent = ({ className, ...props }) => (_jsx("div", { className: cn('flex-1 overflow-auto p-4', className), ...props }));
|
|
21
|
-
//# sourceMappingURL=artifact.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"artifact.js","sourceRoot":"","sources":["../../../src/components/ai-elements/artifact.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Button } from '../ui/button';
|
|
2
|
-
import type { UIMessage } from 'ai';
|
|
3
|
-
import type { ComponentProps, HTMLAttributes } from 'react';
|
|
4
|
-
export type BranchProps = HTMLAttributes<HTMLDivElement> & {
|
|
5
|
-
defaultBranch?: number;
|
|
6
|
-
onBranchChange?: (branchIndex: number) => void;
|
|
7
|
-
};
|
|
8
|
-
export declare const Branch: ({ defaultBranch, onBranchChange, className, ...props }: BranchProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export type BranchMessagesProps = HTMLAttributes<HTMLDivElement>;
|
|
10
|
-
export declare const BranchMessages: ({ children, ...props }: BranchMessagesProps) => import("react/jsx-runtime").JSX.Element[];
|
|
11
|
-
export type BranchSelectorProps = HTMLAttributes<HTMLDivElement> & {
|
|
12
|
-
from: UIMessage['role'];
|
|
13
|
-
};
|
|
14
|
-
export declare const BranchSelector: ({ className, from, ...props }: BranchSelectorProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
15
|
-
export type BranchPreviousProps = ComponentProps<typeof Button>;
|
|
16
|
-
export declare const BranchPrevious: ({ className, children, ...props }: BranchPreviousProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
export type BranchNextProps = ComponentProps<typeof Button>;
|
|
18
|
-
export declare const BranchNext: ({ className, children, ...props }: BranchNextProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
export type BranchPageProps = HTMLAttributes<HTMLSpanElement>;
|
|
20
|
-
export declare const BranchPage: ({ className, ...props }: BranchPageProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
-
//# sourceMappingURL=branch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/branch.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAEpC,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAgB,MAAM,OAAO,CAAC;AAwB1E,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAC1D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,wDAA4D,WAAW,4CAiC7F,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEjE,eAAO,MAAM,cAAc,GAAI,wBAAwB,mBAAmB,8CAuBzE,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAClE,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,+BAA+B,mBAAmB,mDAkBhF,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;AAEhE,eAAO,MAAM,cAAc,GAAI,mCAAmC,mBAAmB,4CAsBpF,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;AAE5D,eAAO,MAAM,UAAU,GAAI,mCAAmC,eAAe,4CAsB5E,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,eAAe,CAAC,CAAC;AAE9D,eAAO,MAAM,UAAU,GAAI,yBAAyB,eAAe,4CAWlE,CAAC"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Button } from '../ui/button';
|
|
4
|
-
import { cn } from '../../lib/utils';
|
|
5
|
-
import { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';
|
|
6
|
-
import { createContext, useContext, useEffect, useState } from 'react';
|
|
7
|
-
const BranchContext = createContext(null);
|
|
8
|
-
const useBranch = () => {
|
|
9
|
-
const context = useContext(BranchContext);
|
|
10
|
-
if (!context) {
|
|
11
|
-
throw new Error('Branch components must be used within Branch');
|
|
12
|
-
}
|
|
13
|
-
return context;
|
|
14
|
-
};
|
|
15
|
-
export const Branch = ({ defaultBranch = 0, onBranchChange, className, ...props }) => {
|
|
16
|
-
const [currentBranch, setCurrentBranch] = useState(defaultBranch);
|
|
17
|
-
const [branches, setBranches] = useState([]);
|
|
18
|
-
const handleBranchChange = (newBranch) => {
|
|
19
|
-
setCurrentBranch(newBranch);
|
|
20
|
-
onBranchChange?.(newBranch);
|
|
21
|
-
};
|
|
22
|
-
const goToPrevious = () => {
|
|
23
|
-
const newBranch = currentBranch > 0 ? currentBranch - 1 : branches.length - 1;
|
|
24
|
-
handleBranchChange(newBranch);
|
|
25
|
-
};
|
|
26
|
-
const goToNext = () => {
|
|
27
|
-
const newBranch = currentBranch < branches.length - 1 ? currentBranch + 1 : 0;
|
|
28
|
-
handleBranchChange(newBranch);
|
|
29
|
-
};
|
|
30
|
-
const contextValue = {
|
|
31
|
-
currentBranch,
|
|
32
|
-
totalBranches: branches.length,
|
|
33
|
-
goToPrevious,
|
|
34
|
-
goToNext,
|
|
35
|
-
branches,
|
|
36
|
-
setBranches,
|
|
37
|
-
};
|
|
38
|
-
return (_jsx(BranchContext.Provider, { value: contextValue, children: _jsx("div", { className: cn('grid w-full gap-2 [&>div]:pb-0', className), ...props }) }));
|
|
39
|
-
};
|
|
40
|
-
export const BranchMessages = ({ children, ...props }) => {
|
|
41
|
-
const { currentBranch, setBranches, branches } = useBranch();
|
|
42
|
-
const childrenArray = Array.isArray(children) ? children : [children];
|
|
43
|
-
// Use useEffect to update branches when they change
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
if (branches.length !== childrenArray.length) {
|
|
46
|
-
setBranches(childrenArray);
|
|
47
|
-
}
|
|
48
|
-
}, [childrenArray, branches, setBranches]);
|
|
49
|
-
return childrenArray.map((branch, index) => (_jsx("div", { className: cn('grid gap-2 overflow-hidden [&>div]:pb-0', index === currentBranch ? 'block' : 'hidden'), ...props, children: branch }, branch.key)));
|
|
50
|
-
};
|
|
51
|
-
export const BranchSelector = ({ className, from, ...props }) => {
|
|
52
|
-
const { totalBranches } = useBranch();
|
|
53
|
-
// Don't render if there's only one branch
|
|
54
|
-
if (totalBranches <= 1) {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
return (_jsx("div", { className: cn('flex items-center gap-2 self-end px-10', from === 'assistant' ? 'justify-start' : 'justify-end', className), ...props }));
|
|
58
|
-
};
|
|
59
|
-
export const BranchPrevious = ({ className, children, ...props }) => {
|
|
60
|
-
const { goToPrevious, totalBranches } = useBranch();
|
|
61
|
-
return (_jsx(Button, { "aria-label": "Previous branch", className: cn('size-7 shrink-0 rounded-full text-muted-foreground transition-colors', 'hover:bg-accent hover:text-foreground', 'disabled:pointer-events-none disabled:opacity-50', className), disabled: totalBranches <= 1, onClick: goToPrevious, size: "icon", type: "button", variant: "ghost", ...props, children: children ?? _jsx(ChevronLeftIcon, { size: 14 }) }));
|
|
62
|
-
};
|
|
63
|
-
export const BranchNext = ({ className, children, ...props }) => {
|
|
64
|
-
const { goToNext, totalBranches } = useBranch();
|
|
65
|
-
return (_jsx(Button, { "aria-label": "Next branch", className: cn('size-7 shrink-0 rounded-full text-muted-foreground transition-colors', 'hover:bg-accent hover:text-foreground', 'disabled:pointer-events-none disabled:opacity-50', className), disabled: totalBranches <= 1, onClick: goToNext, size: "icon", type: "button", variant: "ghost", ...props, children: children ?? _jsx(ChevronRightIcon, { size: 14 }) }));
|
|
66
|
-
};
|
|
67
|
-
export const BranchPage = ({ className, ...props }) => {
|
|
68
|
-
const { currentBranch, totalBranches } = useBranch();
|
|
69
|
-
return (_jsxs("span", { className: cn('font-medium text-muted-foreground text-xs tabular-nums', className), ...props, children: [currentBranch + 1, " of ", totalBranches] }));
|
|
70
|
-
};
|
|
71
|
-
//# sourceMappingURL=branch.js.map
|