@inf-monkeys-tech/monkeys-design 1.0.30 → 1.0.31
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/agent-workbench/index.d.mts +94 -2
- package/dist/components/agent-workbench/index.d.ts +94 -2
- package/dist/components/agent-workbench/index.js +482 -4
- package/dist/components/agent-workbench/index.js.map +1 -1
- package/dist/components/agent-workbench/index.mjs +478 -5
- package/dist/components/agent-workbench/index.mjs.map +1 -1
- package/dist/components/base/index.js +17 -0
- package/dist/components/base/index.js.map +1 -1
- package/dist/components/base/index.mjs +17 -0
- package/dist/components/base/index.mjs.map +1 -1
- package/dist/components/data-explorer/index.js +17 -0
- package/dist/components/data-explorer/index.js.map +1 -1
- package/dist/components/data-explorer/index.mjs +17 -0
- package/dist/components/data-explorer/index.mjs.map +1 -1
- package/dist/components/layout/index.js +17 -0
- package/dist/components/layout/index.js.map +1 -1
- package/dist/components/layout/index.mjs +17 -0
- package/dist/components/layout/index.mjs.map +1 -1
- package/dist/components/runtime/index.js +17 -0
- package/dist/components/runtime/index.js.map +1 -1
- package/dist/components/runtime/index.mjs +17 -0
- package/dist/components/runtime/index.mjs.map +1 -1
- package/dist/components/toast/index.d.mts +1 -1
- package/dist/components/toast/index.d.ts +1 -1
- package/dist/components/toast/index.js +17 -0
- package/dist/components/toast/index.js.map +1 -1
- package/dist/components/toast/index.mjs +17 -0
- package/dist/components/toast/index.mjs.map +1 -1
- package/dist/components/toolbar/index.js +17 -0
- package/dist/components/toolbar/index.js.map +1 -1
- package/dist/components/toolbar/index.mjs +17 -0
- package/dist/components/toolbar/index.mjs.map +1 -1
- package/dist/components/workbench/index.js +17 -0
- package/dist/components/workbench/index.js.map +1 -1
- package/dist/components/workbench/index.mjs +17 -0
- package/dist/components/workbench/index.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -0
- package/dist/index.mjs.map +1 -1
- package/dist/locale/index.d.mts +58 -2
- package/dist/locale/index.d.ts +58 -2
- package/dist/locale/index.js +42 -0
- package/dist/locale/index.js.map +1 -1
- package/dist/locale/index.mjs +42 -0
- package/dist/locale/index.mjs.map +1 -1
- package/dist/provider/index.d.mts +2 -2
- package/dist/provider/index.d.ts +2 -2
- package/dist/provider/index.js +42 -0
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/index.mjs +42 -0
- package/dist/provider/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/{types-5d94bcf4b6cd.d.mts → types-8f8d24939b8e.d.mts} +30 -0
- package/dist/{types-5d94bcf4b6cd.d.ts → types-8f8d24939b8e.d.ts} +30 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChevronDown, Check, ChevronRight, Circle, ChevronUp, ArrowUp, ArrowDown, Pencil, Trash2, Image, File, X, Paperclip, Mic, Send, Square, Search, Plus, Pin, SquarePen, Blocks, Settings, TerminalSquare, Clock3, FileOutput, Download, RefreshCw, Bot,
|
|
1
|
+
import { ChevronDown, Check, ChevronRight, Circle, ChevronUp, ArrowUp, ArrowDown, Pencil, Trash2, Image, File, X, Paperclip, Mic, Send, Square, Search, Plus, Pin, SquarePen, Blocks, Settings, TerminalSquare, Clock3, FileOutput, Download, Loader2, CircleAlert, ListFilter, Link2, ExternalLink, PanelRightClose, FileText, Wrench, BookOpen, RefreshCw, Bot, CheckCircle2, AlertCircle, Ellipsis, XCircle, CircleStop, GitFork, PencilLine, Copy, RotateCcw, FileCode2, Files, TestTube2, Globe2, Film, Presentation, FileImage, Music2 } from 'lucide-react';
|
|
2
2
|
import * as React2 from 'react';
|
|
3
3
|
import { createContext, useRef, useState, useMemo, useEffect, useContext } from 'react';
|
|
4
4
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
@@ -6,7 +6,7 @@ import { twMerge } from 'tailwind-merge';
|
|
|
6
6
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
7
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
8
8
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
9
|
-
import * as
|
|
9
|
+
import * as PopoverPrimitive2 from '@radix-ui/react-popover';
|
|
10
10
|
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
11
11
|
import { Slot } from '@radix-ui/react-slot';
|
|
12
12
|
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
@@ -14,6 +14,10 @@ import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
|
14
14
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
15
15
|
import { cva } from 'class-variance-authority';
|
|
16
16
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
17
|
+
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
18
|
+
import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter } from '@dnd-kit/core';
|
|
19
|
+
import { sortableKeyboardCoordinates, SortableContext, horizontalListSortingStrategy, useSortable } from '@dnd-kit/sortable';
|
|
20
|
+
import { CSS } from '@dnd-kit/utilities';
|
|
17
21
|
|
|
18
22
|
// src/components/agent-workbench/AgentWorkbenchComposer.tsx
|
|
19
23
|
|
|
@@ -168,6 +172,23 @@ var enUS = {
|
|
|
168
172
|
stopping: "Stopping...",
|
|
169
173
|
stoppedAfter: ({ duration }) => `You stopped after ${duration}`
|
|
170
174
|
},
|
|
175
|
+
process: {
|
|
176
|
+
running: "Working",
|
|
177
|
+
processed: "Processed",
|
|
178
|
+
processedFor: ({ duration }) => `Processed for ${duration}`,
|
|
179
|
+
completedCount: ({ completed, total }) => `${completed}/${total} completed`
|
|
180
|
+
},
|
|
181
|
+
artifactWorkspace: {
|
|
182
|
+
outputs: "Outputs",
|
|
183
|
+
sources: "Sources",
|
|
184
|
+
viewAll: "View all",
|
|
185
|
+
toggleSummary: "Toggle files",
|
|
186
|
+
tabs: "Open files",
|
|
187
|
+
closeTab: ({ name }) => `Close ${name}`,
|
|
188
|
+
closeWorkspace: "Close workspace",
|
|
189
|
+
download: ({ name }) => `Download ${name}`,
|
|
190
|
+
openExternal: ({ name }) => `Open ${name} in a new window`
|
|
191
|
+
},
|
|
171
192
|
usage: {
|
|
172
193
|
label: "Context usage",
|
|
173
194
|
context: ({ used, total }) => `${used} / ${total} tokens`
|
|
@@ -423,8 +444,8 @@ var Button = React2.forwardRef(
|
|
|
423
444
|
}
|
|
424
445
|
);
|
|
425
446
|
Button.displayName = "Button";
|
|
426
|
-
var PopoverContent = React2.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
427
|
-
|
|
447
|
+
var PopoverContent = React2.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive2.Portal, { children: /* @__PURE__ */ jsx(
|
|
448
|
+
PopoverPrimitive2.Content,
|
|
428
449
|
{
|
|
429
450
|
ref,
|
|
430
451
|
align,
|
|
@@ -2399,7 +2420,459 @@ function AgentWorkbenchThread({
|
|
|
2399
2420
|
}
|
|
2400
2421
|
);
|
|
2401
2422
|
}
|
|
2423
|
+
function formatDuration3(durationMs) {
|
|
2424
|
+
const totalSeconds = Math.max(0, Math.floor(durationMs / 1e3));
|
|
2425
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
2426
|
+
const seconds = totalSeconds % 60;
|
|
2427
|
+
if (minutes === 0) return `${seconds}s`;
|
|
2428
|
+
return `${minutes}m ${seconds}s`;
|
|
2429
|
+
}
|
|
2430
|
+
function isActive(status) {
|
|
2431
|
+
return status === "queued" || status === "running" || status === "waiting_approval";
|
|
2432
|
+
}
|
|
2433
|
+
function AgentWorkbenchProcess({
|
|
2434
|
+
status,
|
|
2435
|
+
children,
|
|
2436
|
+
durationMs,
|
|
2437
|
+
completedCount,
|
|
2438
|
+
totalCount,
|
|
2439
|
+
open,
|
|
2440
|
+
defaultOpen,
|
|
2441
|
+
onOpenChange,
|
|
2442
|
+
className,
|
|
2443
|
+
contentClassName,
|
|
2444
|
+
label
|
|
2445
|
+
}) {
|
|
2446
|
+
const messages = useMonkeysLocaleMessages().agentWorkbench;
|
|
2447
|
+
const controlled = open !== void 0;
|
|
2448
|
+
const [internalOpen, setInternalOpen] = useState(defaultOpen ?? isActive(status));
|
|
2449
|
+
const userChangedOpen = useRef(false);
|
|
2450
|
+
const previousStatus = useRef(status);
|
|
2451
|
+
const resolvedOpen = controlled ? open : internalOpen;
|
|
2452
|
+
useEffect(() => {
|
|
2453
|
+
if (controlled || userChangedOpen.current || previousStatus.current === status) return;
|
|
2454
|
+
previousStatus.current = status;
|
|
2455
|
+
setInternalOpen(isActive(status));
|
|
2456
|
+
}, [controlled, status]);
|
|
2457
|
+
const handleOpenChange = (nextOpen) => {
|
|
2458
|
+
userChangedOpen.current = true;
|
|
2459
|
+
if (!controlled) setInternalOpen(nextOpen);
|
|
2460
|
+
onOpenChange?.(nextOpen);
|
|
2461
|
+
};
|
|
2462
|
+
const duration = durationMs === void 0 ? void 0 : formatDuration3(durationMs);
|
|
2463
|
+
const title = label ?? (isActive(status) ? messages.process.running : duration ? messages.process.processedFor({ duration }) : messages.process.processed);
|
|
2464
|
+
const showCount = totalCount !== void 0 && totalCount > 0;
|
|
2465
|
+
return /* @__PURE__ */ jsxs(
|
|
2466
|
+
CollapsiblePrimitive.Root,
|
|
2467
|
+
{
|
|
2468
|
+
open: resolvedOpen,
|
|
2469
|
+
onOpenChange: handleOpenChange,
|
|
2470
|
+
className: cn2("group/process w-full min-w-0", className),
|
|
2471
|
+
"data-agent-process-status": status,
|
|
2472
|
+
children: [
|
|
2473
|
+
/* @__PURE__ */ jsxs(
|
|
2474
|
+
CollapsiblePrimitive.Trigger,
|
|
2475
|
+
{
|
|
2476
|
+
className: "flex min-h-9 w-full min-w-0 items-center gap-2 border-b border-border/70 py-2 text-left text-sm text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",
|
|
2477
|
+
children: [
|
|
2478
|
+
isActive(status) ? /* @__PURE__ */ jsx(Loader2, { className: "size-4 shrink-0 animate-spin", "aria-hidden": "true" }) : status === "failed" ? /* @__PURE__ */ jsx(CircleAlert, { className: "size-4 shrink-0 text-destructive-text", "aria-hidden": "true" }) : /* @__PURE__ */ jsx(Clock3, { className: "size-4 shrink-0", "aria-hidden": "true" }),
|
|
2479
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: title }),
|
|
2480
|
+
showCount ? /* @__PURE__ */ jsx("span", { className: "shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs text-foreground", children: messages.process.completedCount({
|
|
2481
|
+
completed: completedCount ?? 0,
|
|
2482
|
+
total: totalCount
|
|
2483
|
+
}) }) : null,
|
|
2484
|
+
/* @__PURE__ */ jsx(
|
|
2485
|
+
ChevronRight,
|
|
2486
|
+
{
|
|
2487
|
+
className: "size-4 shrink-0 transition-transform group-data-[state=open]/process:rotate-90",
|
|
2488
|
+
"aria-hidden": "true"
|
|
2489
|
+
}
|
|
2490
|
+
)
|
|
2491
|
+
]
|
|
2492
|
+
}
|
|
2493
|
+
),
|
|
2494
|
+
/* @__PURE__ */ jsx(
|
|
2495
|
+
CollapsiblePrimitive.Content,
|
|
2496
|
+
{
|
|
2497
|
+
className: cn2(
|
|
2498
|
+
"overflow-hidden data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down",
|
|
2499
|
+
contentClassName
|
|
2500
|
+
),
|
|
2501
|
+
children: /* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-col gap-3 py-4", children })
|
|
2502
|
+
}
|
|
2503
|
+
)
|
|
2504
|
+
]
|
|
2505
|
+
}
|
|
2506
|
+
);
|
|
2507
|
+
}
|
|
2508
|
+
var ACTION_ICONS = {
|
|
2509
|
+
read: BookOpen,
|
|
2510
|
+
search: Search,
|
|
2511
|
+
tool: Wrench,
|
|
2512
|
+
command: TerminalSquare,
|
|
2513
|
+
file: FileText
|
|
2514
|
+
};
|
|
2515
|
+
function ActionStatusIcon({ status }) {
|
|
2516
|
+
if (status === "running" || status === "pending") {
|
|
2517
|
+
return /* @__PURE__ */ jsx(Loader2, { className: "size-3.5 shrink-0 animate-spin", "aria-hidden": "true" });
|
|
2518
|
+
}
|
|
2519
|
+
if (status === "failed" || status === "denied") {
|
|
2520
|
+
return /* @__PURE__ */ jsx(CircleAlert, { className: "size-3.5 shrink-0 text-destructive-text", "aria-hidden": "true" });
|
|
2521
|
+
}
|
|
2522
|
+
if (status === "completed") {
|
|
2523
|
+
return /* @__PURE__ */ jsx(Check, { className: "size-3.5 shrink-0", "aria-hidden": "true" });
|
|
2524
|
+
}
|
|
2525
|
+
return /* @__PURE__ */ jsx(Circle, { className: "size-3.5 shrink-0", "aria-hidden": "true" });
|
|
2526
|
+
}
|
|
2527
|
+
function AgentWorkbenchAction({
|
|
2528
|
+
summary,
|
|
2529
|
+
kind = "tool",
|
|
2530
|
+
status = "completed",
|
|
2531
|
+
children,
|
|
2532
|
+
open,
|
|
2533
|
+
defaultOpen = false,
|
|
2534
|
+
onOpenChange,
|
|
2535
|
+
icon,
|
|
2536
|
+
className,
|
|
2537
|
+
contentClassName
|
|
2538
|
+
}) {
|
|
2539
|
+
const Icon2 = icon ?? ACTION_ICONS[kind];
|
|
2540
|
+
const row = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2541
|
+
/* @__PURE__ */ jsx(Icon2, { className: "size-4 shrink-0", "aria-hidden": "true" }),
|
|
2542
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: summary }),
|
|
2543
|
+
/* @__PURE__ */ jsx(ActionStatusIcon, { status }),
|
|
2544
|
+
children ? /* @__PURE__ */ jsx(
|
|
2545
|
+
ChevronRight,
|
|
2546
|
+
{
|
|
2547
|
+
className: "size-3.5 shrink-0 transition-transform group-data-[state=open]/action:rotate-90",
|
|
2548
|
+
"aria-hidden": "true"
|
|
2549
|
+
}
|
|
2550
|
+
) : null
|
|
2551
|
+
] });
|
|
2552
|
+
if (!children) {
|
|
2553
|
+
return /* @__PURE__ */ jsx(
|
|
2554
|
+
"div",
|
|
2555
|
+
{
|
|
2556
|
+
className: cn2("flex min-h-7 min-w-0 items-center gap-2 text-[13px] text-muted-foreground", className),
|
|
2557
|
+
"data-agent-action-status": status,
|
|
2558
|
+
children: row
|
|
2559
|
+
}
|
|
2560
|
+
);
|
|
2561
|
+
}
|
|
2562
|
+
return /* @__PURE__ */ jsxs(
|
|
2563
|
+
CollapsiblePrimitive.Root,
|
|
2564
|
+
{
|
|
2565
|
+
open,
|
|
2566
|
+
defaultOpen,
|
|
2567
|
+
onOpenChange,
|
|
2568
|
+
className: cn2("group/action min-w-0", className),
|
|
2569
|
+
"data-agent-action-status": status,
|
|
2570
|
+
children: [
|
|
2571
|
+
/* @__PURE__ */ jsx(CollapsiblePrimitive.Trigger, { className: "flex min-h-7 w-full min-w-0 items-center gap-2 text-left text-[13px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring", children: row }),
|
|
2572
|
+
/* @__PURE__ */ jsx(CollapsiblePrimitive.Content, { className: "overflow-hidden data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down", children: /* @__PURE__ */ jsx("div", { className: cn2("ml-6 mt-2 min-w-0 border-l border-border pl-3", contentClassName), children }) })
|
|
2573
|
+
]
|
|
2574
|
+
}
|
|
2575
|
+
);
|
|
2576
|
+
}
|
|
2577
|
+
var ARTIFACT_ICONS = {
|
|
2578
|
+
audio: Music2,
|
|
2579
|
+
file: File,
|
|
2580
|
+
html: FileCode2,
|
|
2581
|
+
image: FileImage,
|
|
2582
|
+
markdown: FileText,
|
|
2583
|
+
pdf: FileText,
|
|
2584
|
+
presentation: Presentation,
|
|
2585
|
+
video: Film,
|
|
2586
|
+
web: Globe2
|
|
2587
|
+
};
|
|
2588
|
+
function ArtifactThumbnail({ artifact }) {
|
|
2589
|
+
if (artifact.thumbnailUrl) {
|
|
2590
|
+
return /* @__PURE__ */ jsx(
|
|
2591
|
+
"img",
|
|
2592
|
+
{
|
|
2593
|
+
src: artifact.thumbnailUrl,
|
|
2594
|
+
alt: "",
|
|
2595
|
+
loading: "lazy",
|
|
2596
|
+
className: "size-7 rounded object-cover"
|
|
2597
|
+
}
|
|
2598
|
+
);
|
|
2599
|
+
}
|
|
2600
|
+
const Icon2 = ARTIFACT_ICONS[artifact.kind];
|
|
2601
|
+
return /* @__PURE__ */ jsx("span", { className: "flex size-7 items-center justify-center rounded bg-muted text-muted-foreground", children: /* @__PURE__ */ jsx(Icon2, { className: "size-4", "aria-hidden": "true" }) });
|
|
2602
|
+
}
|
|
2603
|
+
function ArtifactGroup({
|
|
2604
|
+
title,
|
|
2605
|
+
artifacts,
|
|
2606
|
+
maxItems,
|
|
2607
|
+
onArtifactOpen
|
|
2608
|
+
}) {
|
|
2609
|
+
return /* @__PURE__ */ jsxs("section", { className: "flex min-w-0 flex-col gap-2", children: [
|
|
2610
|
+
/* @__PURE__ */ jsx("div", { role: "heading", "aria-level": 2, className: "text-sm font-medium text-muted-foreground", children: title }),
|
|
2611
|
+
artifacts.slice(0, maxItems).map((artifact) => /* @__PURE__ */ jsxs(
|
|
2612
|
+
"button",
|
|
2613
|
+
{
|
|
2614
|
+
type: "button",
|
|
2615
|
+
className: "flex min-w-0 items-center gap-2 rounded-md px-0.5 py-0.5 text-left text-sm outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-default",
|
|
2616
|
+
disabled: !onArtifactOpen || artifact.status === "loading",
|
|
2617
|
+
onClick: () => onArtifactOpen?.(artifact),
|
|
2618
|
+
children: [
|
|
2619
|
+
/* @__PURE__ */ jsx(ArtifactThumbnail, { artifact }),
|
|
2620
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-muted-foreground", children: artifact.name })
|
|
2621
|
+
]
|
|
2622
|
+
},
|
|
2623
|
+
artifact.id
|
|
2624
|
+
))
|
|
2625
|
+
] });
|
|
2626
|
+
}
|
|
2627
|
+
function AgentWorkbenchArtifactSummary({
|
|
2628
|
+
artifacts,
|
|
2629
|
+
open,
|
|
2630
|
+
defaultOpen = false,
|
|
2631
|
+
maxItemsPerGroup = 3,
|
|
2632
|
+
showAll = false,
|
|
2633
|
+
className,
|
|
2634
|
+
contentClassName,
|
|
2635
|
+
onOpenChange,
|
|
2636
|
+
onArtifactOpen,
|
|
2637
|
+
onViewAll
|
|
2638
|
+
}) {
|
|
2639
|
+
const messages = useMonkeysLocaleMessages().agentWorkbench.artifactWorkspace;
|
|
2640
|
+
const outputs = artifacts.filter((artifact) => artifact.origin === "output");
|
|
2641
|
+
const sources = artifacts.filter((artifact) => artifact.origin === "source");
|
|
2642
|
+
if (artifacts.length === 0) return null;
|
|
2643
|
+
return /* @__PURE__ */ jsxs(PopoverPrimitive2.Root, { open, defaultOpen, onOpenChange, children: [
|
|
2644
|
+
/* @__PURE__ */ jsx(
|
|
2645
|
+
PopoverPrimitive2.Trigger,
|
|
2646
|
+
{
|
|
2647
|
+
type: "button",
|
|
2648
|
+
className: cn2(
|
|
2649
|
+
"flex size-9 items-center justify-center rounded-xl bg-muted text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:text-foreground",
|
|
2650
|
+
className
|
|
2651
|
+
),
|
|
2652
|
+
"aria-label": messages.toggleSummary,
|
|
2653
|
+
children: /* @__PURE__ */ jsx(ListFilter, { className: "size-4", "aria-hidden": "true" })
|
|
2654
|
+
}
|
|
2655
|
+
),
|
|
2656
|
+
/* @__PURE__ */ jsxs(
|
|
2657
|
+
PopoverPrimitive2.Content,
|
|
2658
|
+
{
|
|
2659
|
+
"aria-label": messages.toggleSummary,
|
|
2660
|
+
side: "bottom",
|
|
2661
|
+
align: "end",
|
|
2662
|
+
sideOffset: 8,
|
|
2663
|
+
collisionPadding: 12,
|
|
2664
|
+
className: cn2(
|
|
2665
|
+
"z-50 w-[min(22rem,calc(100vw-1.5rem))] rounded-3xl border border-border bg-popover p-4 text-popover-foreground shadow-xl outline-none",
|
|
2666
|
+
contentClassName
|
|
2667
|
+
),
|
|
2668
|
+
children: [
|
|
2669
|
+
/* @__PURE__ */ jsxs("div", { className: "flex max-h-[min(34rem,calc(100vh-5rem))] min-w-0 flex-col gap-4 overflow-y-auto", children: [
|
|
2670
|
+
outputs.length > 0 ? /* @__PURE__ */ jsx(
|
|
2671
|
+
ArtifactGroup,
|
|
2672
|
+
{
|
|
2673
|
+
title: messages.outputs,
|
|
2674
|
+
artifacts: outputs,
|
|
2675
|
+
maxItems: showAll ? outputs.length : maxItemsPerGroup,
|
|
2676
|
+
onArtifactOpen
|
|
2677
|
+
}
|
|
2678
|
+
) : null,
|
|
2679
|
+
outputs.length > 0 && sources.length > 0 ? /* @__PURE__ */ jsx("div", { className: "h-px bg-border" }) : null,
|
|
2680
|
+
sources.length > 0 ? /* @__PURE__ */ jsx(
|
|
2681
|
+
ArtifactGroup,
|
|
2682
|
+
{
|
|
2683
|
+
title: messages.sources,
|
|
2684
|
+
artifacts: sources,
|
|
2685
|
+
maxItems: showAll ? sources.length : maxItemsPerGroup,
|
|
2686
|
+
onArtifactOpen
|
|
2687
|
+
}
|
|
2688
|
+
) : null,
|
|
2689
|
+
onViewAll && !showAll && (outputs.length > maxItemsPerGroup || sources.length > maxItemsPerGroup) ? /* @__PURE__ */ jsxs(
|
|
2690
|
+
"button",
|
|
2691
|
+
{
|
|
2692
|
+
type: "button",
|
|
2693
|
+
className: "flex min-h-8 items-center gap-2 rounded-md text-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",
|
|
2694
|
+
onClick: onViewAll,
|
|
2695
|
+
children: [
|
|
2696
|
+
/* @__PURE__ */ jsx(Link2, { className: "size-4", "aria-hidden": "true" }),
|
|
2697
|
+
/* @__PURE__ */ jsx("span", { children: messages.viewAll })
|
|
2698
|
+
]
|
|
2699
|
+
}
|
|
2700
|
+
) : null
|
|
2701
|
+
] }),
|
|
2702
|
+
/* @__PURE__ */ jsx(PopoverPrimitive2.Arrow, { className: "fill-popover" })
|
|
2703
|
+
]
|
|
2704
|
+
}
|
|
2705
|
+
)
|
|
2706
|
+
] });
|
|
2707
|
+
}
|
|
2708
|
+
var ARTIFACT_ICONS2 = {
|
|
2709
|
+
audio: Music2,
|
|
2710
|
+
file: File,
|
|
2711
|
+
html: FileCode2,
|
|
2712
|
+
image: FileImage,
|
|
2713
|
+
markdown: FileText,
|
|
2714
|
+
pdf: FileText,
|
|
2715
|
+
presentation: Presentation,
|
|
2716
|
+
video: Film,
|
|
2717
|
+
web: Globe2
|
|
2718
|
+
};
|
|
2719
|
+
function SortableArtifactTab({
|
|
2720
|
+
artifact,
|
|
2721
|
+
selected,
|
|
2722
|
+
onClose
|
|
2723
|
+
}) {
|
|
2724
|
+
const messages = useMonkeysLocaleMessages().agentWorkbench.artifactWorkspace;
|
|
2725
|
+
const Icon2 = ARTIFACT_ICONS2[artifact.kind];
|
|
2726
|
+
const { attributes, listeners, setNodeRef, setActivatorNodeRef, transform, transition, isDragging } = useSortable({
|
|
2727
|
+
id: artifact.id
|
|
2728
|
+
});
|
|
2729
|
+
const { role: _sortableRole, tabIndex: _sortableTabIndex, ...sortableA11y } = attributes;
|
|
2730
|
+
const setTabRef = (node) => {
|
|
2731
|
+
setNodeRef(node);
|
|
2732
|
+
setActivatorNodeRef(node);
|
|
2733
|
+
};
|
|
2734
|
+
const handleMouseDown = (event) => {
|
|
2735
|
+
if (event.button !== 1) return;
|
|
2736
|
+
event.preventDefault();
|
|
2737
|
+
onClose();
|
|
2738
|
+
};
|
|
2739
|
+
const handleClick = (event) => {
|
|
2740
|
+
if (!(event.target instanceof Element) || !event.target.closest("[data-close-artifact-tab]")) return;
|
|
2741
|
+
event.preventDefault();
|
|
2742
|
+
onClose();
|
|
2743
|
+
};
|
|
2744
|
+
const handleKeyDown = (event) => {
|
|
2745
|
+
listeners?.onKeyDown?.(event);
|
|
2746
|
+
if (event.key !== "Delete" && event.key !== "Backspace") return;
|
|
2747
|
+
event.preventDefault();
|
|
2748
|
+
onClose();
|
|
2749
|
+
};
|
|
2750
|
+
return /* @__PURE__ */ jsxs(
|
|
2751
|
+
TabsPrimitive.Trigger,
|
|
2752
|
+
{
|
|
2753
|
+
ref: setTabRef,
|
|
2754
|
+
value: artifact.id,
|
|
2755
|
+
style: { transform: CSS.Transform.toString(transform), transition },
|
|
2756
|
+
className: cn2(
|
|
2757
|
+
"group/tab relative flex h-9 max-w-56 shrink-0 items-center gap-2 rounded-lg pl-3 pr-8 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
2758
|
+
selected ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:bg-background/60",
|
|
2759
|
+
isDragging && "opacity-60"
|
|
2760
|
+
),
|
|
2761
|
+
onMouseDown: handleMouseDown,
|
|
2762
|
+
onClick: handleClick,
|
|
2763
|
+
...sortableA11y,
|
|
2764
|
+
...listeners,
|
|
2765
|
+
onKeyDown: handleKeyDown,
|
|
2766
|
+
children: [
|
|
2767
|
+
/* @__PURE__ */ jsx(Icon2, { className: "size-4 shrink-0", "aria-hidden": "true" }),
|
|
2768
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: artifact.name }),
|
|
2769
|
+
/* @__PURE__ */ jsx(
|
|
2770
|
+
"span",
|
|
2771
|
+
{
|
|
2772
|
+
className: "absolute right-1.5 flex size-6 items-center justify-center rounded-md opacity-0 hover:bg-muted group-focus/tab:opacity-100 group-hover/tab:opacity-100 data-[selected=true]:opacity-100",
|
|
2773
|
+
"data-selected": selected,
|
|
2774
|
+
"data-close-artifact-tab": "",
|
|
2775
|
+
title: messages.closeTab({ name: artifact.name }),
|
|
2776
|
+
"aria-hidden": "true",
|
|
2777
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-3.5", "aria-hidden": "true" })
|
|
2778
|
+
}
|
|
2779
|
+
)
|
|
2780
|
+
]
|
|
2781
|
+
}
|
|
2782
|
+
);
|
|
2783
|
+
}
|
|
2784
|
+
function AgentWorkbenchArtifactWorkspace({
|
|
2785
|
+
artifacts,
|
|
2786
|
+
activeArtifactId,
|
|
2787
|
+
className,
|
|
2788
|
+
renderArtifact,
|
|
2789
|
+
onIntent
|
|
2790
|
+
}) {
|
|
2791
|
+
const messages = useMonkeysLocaleMessages().agentWorkbench.artifactWorkspace;
|
|
2792
|
+
const activeArtifact = artifacts.find((artifact) => artifact.id === activeArtifactId) ?? artifacts[0];
|
|
2793
|
+
const sensors = useSensors(
|
|
2794
|
+
useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
|
|
2795
|
+
useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })
|
|
2796
|
+
);
|
|
2797
|
+
if (!activeArtifact) return null;
|
|
2798
|
+
const handleDragEnd = ({ active, over }) => {
|
|
2799
|
+
if (!over || active.id === over.id) return;
|
|
2800
|
+
onIntent?.({ type: "reorder", artifactId: String(active.id), overArtifactId: String(over.id) });
|
|
2801
|
+
};
|
|
2802
|
+
return /* @__PURE__ */ jsxs(
|
|
2803
|
+
TabsPrimitive.Root,
|
|
2804
|
+
{
|
|
2805
|
+
value: activeArtifact.id,
|
|
2806
|
+
onValueChange: (artifactId) => onIntent?.({ type: "select", artifactId }),
|
|
2807
|
+
className: cn2("flex size-full min-h-0 min-w-0 flex-col bg-background text-foreground", className),
|
|
2808
|
+
orientation: "horizontal",
|
|
2809
|
+
children: [
|
|
2810
|
+
/* @__PURE__ */ jsxs("header", { className: "relative z-10 flex h-12 shrink-0 items-center gap-2 border-b border-border bg-muted/50 px-2", children: [
|
|
2811
|
+
/* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children: /* @__PURE__ */ jsx(SortableContext, { items: artifacts.map((artifact) => artifact.id), strategy: horizontalListSortingStrategy, children: /* @__PURE__ */ jsx(
|
|
2812
|
+
TabsPrimitive.List,
|
|
2813
|
+
{
|
|
2814
|
+
className: "flex min-w-0 flex-1 items-center gap-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
2815
|
+
"aria-label": messages.tabs,
|
|
2816
|
+
children: artifacts.map((artifact) => /* @__PURE__ */ jsx(
|
|
2817
|
+
SortableArtifactTab,
|
|
2818
|
+
{
|
|
2819
|
+
artifact,
|
|
2820
|
+
selected: artifact.id === activeArtifact.id,
|
|
2821
|
+
onClose: () => onIntent?.({ type: "close", artifactId: artifact.id })
|
|
2822
|
+
},
|
|
2823
|
+
artifact.id
|
|
2824
|
+
))
|
|
2825
|
+
}
|
|
2826
|
+
) }) }),
|
|
2827
|
+
/* @__PURE__ */ jsxs("div", { className: "relative z-20 flex shrink-0 items-center gap-2", children: [
|
|
2828
|
+
activeArtifact.url ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2829
|
+
/* @__PURE__ */ jsx(
|
|
2830
|
+
"button",
|
|
2831
|
+
{
|
|
2832
|
+
type: "button",
|
|
2833
|
+
className: "flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",
|
|
2834
|
+
"aria-label": messages.download({ name: activeArtifact.name }),
|
|
2835
|
+
onClick: () => onIntent?.({ type: "download", artifactId: activeArtifact.id }),
|
|
2836
|
+
children: /* @__PURE__ */ jsx(Download, { className: "size-4", "aria-hidden": "true" })
|
|
2837
|
+
}
|
|
2838
|
+
),
|
|
2839
|
+
/* @__PURE__ */ jsx(
|
|
2840
|
+
"button",
|
|
2841
|
+
{
|
|
2842
|
+
type: "button",
|
|
2843
|
+
className: "flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",
|
|
2844
|
+
"aria-label": messages.openExternal({ name: activeArtifact.name }),
|
|
2845
|
+
onClick: () => onIntent?.({ type: "open-external", artifactId: activeArtifact.id }),
|
|
2846
|
+
children: /* @__PURE__ */ jsx(ExternalLink, { className: "size-4", "aria-hidden": "true" })
|
|
2847
|
+
}
|
|
2848
|
+
)
|
|
2849
|
+
] }) : null,
|
|
2850
|
+
/* @__PURE__ */ jsx(
|
|
2851
|
+
"button",
|
|
2852
|
+
{
|
|
2853
|
+
type: "button",
|
|
2854
|
+
className: "flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",
|
|
2855
|
+
"aria-label": messages.closeWorkspace,
|
|
2856
|
+
onClick: () => onIntent?.({ type: "close-workspace" }),
|
|
2857
|
+
children: /* @__PURE__ */ jsx(PanelRightClose, { className: "size-4", "aria-hidden": "true" })
|
|
2858
|
+
}
|
|
2859
|
+
)
|
|
2860
|
+
] })
|
|
2861
|
+
] }),
|
|
2862
|
+
/* @__PURE__ */ jsx("div", { className: "min-h-0 min-w-0 flex-1 overflow-hidden", children: artifacts.map((artifact) => /* @__PURE__ */ jsx(
|
|
2863
|
+
TabsPrimitive.Content,
|
|
2864
|
+
{
|
|
2865
|
+
value: artifact.id,
|
|
2866
|
+
className: "size-full min-h-0 min-w-0 outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",
|
|
2867
|
+
children: artifact.id === activeArtifact.id ? renderArtifact(artifact) : null
|
|
2868
|
+
},
|
|
2869
|
+
artifact.id
|
|
2870
|
+
)) })
|
|
2871
|
+
]
|
|
2872
|
+
}
|
|
2873
|
+
);
|
|
2874
|
+
}
|
|
2402
2875
|
|
|
2403
|
-
export { AgentWorkbenchActivity, AgentWorkbenchComposer, AgentWorkbenchSidebar, AgentWorkbenchTaskDetails, AgentWorkbenchThread, AgentWorkbenchTool, createAgentWorkbenchActivityModel, createAgentWorkbenchDetailsModel };
|
|
2876
|
+
export { AgentWorkbenchAction, AgentWorkbenchActivity, AgentWorkbenchArtifactSummary, AgentWorkbenchArtifactWorkspace, AgentWorkbenchComposer, AgentWorkbenchProcess, AgentWorkbenchSidebar, AgentWorkbenchTaskDetails, AgentWorkbenchThread, AgentWorkbenchTool, createAgentWorkbenchActivityModel, createAgentWorkbenchDetailsModel };
|
|
2404
2877
|
//# sourceMappingURL=index.mjs.map
|
|
2405
2878
|
//# sourceMappingURL=index.mjs.map
|