@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
|
@@ -7,7 +7,7 @@ var tailwindMerge = require('tailwind-merge');
|
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
8
|
var AccordionPrimitive = require('@radix-ui/react-accordion');
|
|
9
9
|
var CheckboxPrimitive = require('@radix-ui/react-checkbox');
|
|
10
|
-
var
|
|
10
|
+
var PopoverPrimitive2 = require('@radix-ui/react-popover');
|
|
11
11
|
var ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
|
|
12
12
|
var reactSlot = require('@radix-ui/react-slot');
|
|
13
13
|
var SwitchPrimitive = require('@radix-ui/react-switch');
|
|
@@ -15,6 +15,10 @@ var TabsPrimitive = require('@radix-ui/react-tabs');
|
|
|
15
15
|
var TooltipPrimitive = require('@radix-ui/react-tooltip');
|
|
16
16
|
var classVarianceAuthority = require('class-variance-authority');
|
|
17
17
|
var SelectPrimitive = require('@radix-ui/react-select');
|
|
18
|
+
var CollapsiblePrimitive = require('@radix-ui/react-collapsible');
|
|
19
|
+
var core = require('@dnd-kit/core');
|
|
20
|
+
var sortable = require('@dnd-kit/sortable');
|
|
21
|
+
var utilities = require('@dnd-kit/utilities');
|
|
18
22
|
|
|
19
23
|
function _interopNamespace(e) {
|
|
20
24
|
if (e && e.__esModule) return e;
|
|
@@ -38,12 +42,13 @@ var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
|
38
42
|
var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMenuPrimitive);
|
|
39
43
|
var AccordionPrimitive__namespace = /*#__PURE__*/_interopNamespace(AccordionPrimitive);
|
|
40
44
|
var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
|
|
41
|
-
var
|
|
45
|
+
var PopoverPrimitive2__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive2);
|
|
42
46
|
var ScrollAreaPrimitive__namespace = /*#__PURE__*/_interopNamespace(ScrollAreaPrimitive);
|
|
43
47
|
var SwitchPrimitive__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitive);
|
|
44
48
|
var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
|
|
45
49
|
var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
|
|
46
50
|
var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
|
|
51
|
+
var CollapsiblePrimitive__namespace = /*#__PURE__*/_interopNamespace(CollapsiblePrimitive);
|
|
47
52
|
|
|
48
53
|
// src/components/agent-workbench/AgentWorkbenchComposer.tsx
|
|
49
54
|
|
|
@@ -198,6 +203,23 @@ var enUS = {
|
|
|
198
203
|
stopping: "Stopping...",
|
|
199
204
|
stoppedAfter: ({ duration }) => `You stopped after ${duration}`
|
|
200
205
|
},
|
|
206
|
+
process: {
|
|
207
|
+
running: "Working",
|
|
208
|
+
processed: "Processed",
|
|
209
|
+
processedFor: ({ duration }) => `Processed for ${duration}`,
|
|
210
|
+
completedCount: ({ completed, total }) => `${completed}/${total} completed`
|
|
211
|
+
},
|
|
212
|
+
artifactWorkspace: {
|
|
213
|
+
outputs: "Outputs",
|
|
214
|
+
sources: "Sources",
|
|
215
|
+
viewAll: "View all",
|
|
216
|
+
toggleSummary: "Toggle files",
|
|
217
|
+
tabs: "Open files",
|
|
218
|
+
closeTab: ({ name }) => `Close ${name}`,
|
|
219
|
+
closeWorkspace: "Close workspace",
|
|
220
|
+
download: ({ name }) => `Download ${name}`,
|
|
221
|
+
openExternal: ({ name }) => `Open ${name} in a new window`
|
|
222
|
+
},
|
|
201
223
|
usage: {
|
|
202
224
|
label: "Context usage",
|
|
203
225
|
context: ({ used, total }) => `${used} / ${total} tokens`
|
|
@@ -453,8 +475,8 @@ var Button = React2__namespace.forwardRef(
|
|
|
453
475
|
}
|
|
454
476
|
);
|
|
455
477
|
Button.displayName = "Button";
|
|
456
|
-
var PopoverContent = React2__namespace.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
457
|
-
|
|
478
|
+
var PopoverContent = React2__namespace.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive2__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
479
|
+
PopoverPrimitive2__namespace.Content,
|
|
458
480
|
{
|
|
459
481
|
ref,
|
|
460
482
|
align,
|
|
@@ -2429,9 +2451,465 @@ function AgentWorkbenchThread({
|
|
|
2429
2451
|
}
|
|
2430
2452
|
);
|
|
2431
2453
|
}
|
|
2454
|
+
function formatDuration3(durationMs) {
|
|
2455
|
+
const totalSeconds = Math.max(0, Math.floor(durationMs / 1e3));
|
|
2456
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
2457
|
+
const seconds = totalSeconds % 60;
|
|
2458
|
+
if (minutes === 0) return `${seconds}s`;
|
|
2459
|
+
return `${minutes}m ${seconds}s`;
|
|
2460
|
+
}
|
|
2461
|
+
function isActive(status) {
|
|
2462
|
+
return status === "queued" || status === "running" || status === "waiting_approval";
|
|
2463
|
+
}
|
|
2464
|
+
function AgentWorkbenchProcess({
|
|
2465
|
+
status,
|
|
2466
|
+
children,
|
|
2467
|
+
durationMs,
|
|
2468
|
+
completedCount,
|
|
2469
|
+
totalCount,
|
|
2470
|
+
open,
|
|
2471
|
+
defaultOpen,
|
|
2472
|
+
onOpenChange,
|
|
2473
|
+
className,
|
|
2474
|
+
contentClassName,
|
|
2475
|
+
label
|
|
2476
|
+
}) {
|
|
2477
|
+
const messages = useMonkeysLocaleMessages().agentWorkbench;
|
|
2478
|
+
const controlled = open !== void 0;
|
|
2479
|
+
const [internalOpen, setInternalOpen] = React2.useState(defaultOpen ?? isActive(status));
|
|
2480
|
+
const userChangedOpen = React2.useRef(false);
|
|
2481
|
+
const previousStatus = React2.useRef(status);
|
|
2482
|
+
const resolvedOpen = controlled ? open : internalOpen;
|
|
2483
|
+
React2.useEffect(() => {
|
|
2484
|
+
if (controlled || userChangedOpen.current || previousStatus.current === status) return;
|
|
2485
|
+
previousStatus.current = status;
|
|
2486
|
+
setInternalOpen(isActive(status));
|
|
2487
|
+
}, [controlled, status]);
|
|
2488
|
+
const handleOpenChange = (nextOpen) => {
|
|
2489
|
+
userChangedOpen.current = true;
|
|
2490
|
+
if (!controlled) setInternalOpen(nextOpen);
|
|
2491
|
+
onOpenChange?.(nextOpen);
|
|
2492
|
+
};
|
|
2493
|
+
const duration = durationMs === void 0 ? void 0 : formatDuration3(durationMs);
|
|
2494
|
+
const title = label ?? (isActive(status) ? messages.process.running : duration ? messages.process.processedFor({ duration }) : messages.process.processed);
|
|
2495
|
+
const showCount = totalCount !== void 0 && totalCount > 0;
|
|
2496
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2497
|
+
CollapsiblePrimitive__namespace.Root,
|
|
2498
|
+
{
|
|
2499
|
+
open: resolvedOpen,
|
|
2500
|
+
onOpenChange: handleOpenChange,
|
|
2501
|
+
className: cn2("group/process w-full min-w-0", className),
|
|
2502
|
+
"data-agent-process-status": status,
|
|
2503
|
+
children: [
|
|
2504
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2505
|
+
CollapsiblePrimitive__namespace.Trigger,
|
|
2506
|
+
{
|
|
2507
|
+
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",
|
|
2508
|
+
children: [
|
|
2509
|
+
isActive(status) ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-4 shrink-0 animate-spin", "aria-hidden": "true" }) : status === "failed" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleAlert, { className: "size-4 shrink-0 text-destructive-text", "aria-hidden": "true" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clock3, { className: "size-4 shrink-0", "aria-hidden": "true" }),
|
|
2510
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 flex-1 truncate", children: title }),
|
|
2511
|
+
showCount ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs text-foreground", children: messages.process.completedCount({
|
|
2512
|
+
completed: completedCount ?? 0,
|
|
2513
|
+
total: totalCount
|
|
2514
|
+
}) }) : null,
|
|
2515
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2516
|
+
lucideReact.ChevronRight,
|
|
2517
|
+
{
|
|
2518
|
+
className: "size-4 shrink-0 transition-transform group-data-[state=open]/process:rotate-90",
|
|
2519
|
+
"aria-hidden": "true"
|
|
2520
|
+
}
|
|
2521
|
+
)
|
|
2522
|
+
]
|
|
2523
|
+
}
|
|
2524
|
+
),
|
|
2525
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2526
|
+
CollapsiblePrimitive__namespace.Content,
|
|
2527
|
+
{
|
|
2528
|
+
className: cn2(
|
|
2529
|
+
"overflow-hidden data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down",
|
|
2530
|
+
contentClassName
|
|
2531
|
+
),
|
|
2532
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-w-0 flex-col gap-3 py-4", children })
|
|
2533
|
+
}
|
|
2534
|
+
)
|
|
2535
|
+
]
|
|
2536
|
+
}
|
|
2537
|
+
);
|
|
2538
|
+
}
|
|
2539
|
+
var ACTION_ICONS = {
|
|
2540
|
+
read: lucideReact.BookOpen,
|
|
2541
|
+
search: lucideReact.Search,
|
|
2542
|
+
tool: lucideReact.Wrench,
|
|
2543
|
+
command: lucideReact.TerminalSquare,
|
|
2544
|
+
file: lucideReact.FileText
|
|
2545
|
+
};
|
|
2546
|
+
function ActionStatusIcon({ status }) {
|
|
2547
|
+
if (status === "running" || status === "pending") {
|
|
2548
|
+
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-3.5 shrink-0 animate-spin", "aria-hidden": "true" });
|
|
2549
|
+
}
|
|
2550
|
+
if (status === "failed" || status === "denied") {
|
|
2551
|
+
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleAlert, { className: "size-3.5 shrink-0 text-destructive-text", "aria-hidden": "true" });
|
|
2552
|
+
}
|
|
2553
|
+
if (status === "completed") {
|
|
2554
|
+
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "size-3.5 shrink-0", "aria-hidden": "true" });
|
|
2555
|
+
}
|
|
2556
|
+
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Circle, { className: "size-3.5 shrink-0", "aria-hidden": "true" });
|
|
2557
|
+
}
|
|
2558
|
+
function AgentWorkbenchAction({
|
|
2559
|
+
summary,
|
|
2560
|
+
kind = "tool",
|
|
2561
|
+
status = "completed",
|
|
2562
|
+
children,
|
|
2563
|
+
open,
|
|
2564
|
+
defaultOpen = false,
|
|
2565
|
+
onOpenChange,
|
|
2566
|
+
icon,
|
|
2567
|
+
className,
|
|
2568
|
+
contentClassName
|
|
2569
|
+
}) {
|
|
2570
|
+
const Icon2 = icon ?? ACTION_ICONS[kind];
|
|
2571
|
+
const row = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2572
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "size-4 shrink-0", "aria-hidden": "true" }),
|
|
2573
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 flex-1 truncate", children: summary }),
|
|
2574
|
+
/* @__PURE__ */ jsxRuntime.jsx(ActionStatusIcon, { status }),
|
|
2575
|
+
children ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2576
|
+
lucideReact.ChevronRight,
|
|
2577
|
+
{
|
|
2578
|
+
className: "size-3.5 shrink-0 transition-transform group-data-[state=open]/action:rotate-90",
|
|
2579
|
+
"aria-hidden": "true"
|
|
2580
|
+
}
|
|
2581
|
+
) : null
|
|
2582
|
+
] });
|
|
2583
|
+
if (!children) {
|
|
2584
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2585
|
+
"div",
|
|
2586
|
+
{
|
|
2587
|
+
className: cn2("flex min-h-7 min-w-0 items-center gap-2 text-[13px] text-muted-foreground", className),
|
|
2588
|
+
"data-agent-action-status": status,
|
|
2589
|
+
children: row
|
|
2590
|
+
}
|
|
2591
|
+
);
|
|
2592
|
+
}
|
|
2593
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2594
|
+
CollapsiblePrimitive__namespace.Root,
|
|
2595
|
+
{
|
|
2596
|
+
open,
|
|
2597
|
+
defaultOpen,
|
|
2598
|
+
onOpenChange,
|
|
2599
|
+
className: cn2("group/action min-w-0", className),
|
|
2600
|
+
"data-agent-action-status": status,
|
|
2601
|
+
children: [
|
|
2602
|
+
/* @__PURE__ */ jsxRuntime.jsx(CollapsiblePrimitive__namespace.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 }),
|
|
2603
|
+
/* @__PURE__ */ jsxRuntime.jsx(CollapsiblePrimitive__namespace.Content, { className: "overflow-hidden data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn2("ml-6 mt-2 min-w-0 border-l border-border pl-3", contentClassName), children }) })
|
|
2604
|
+
]
|
|
2605
|
+
}
|
|
2606
|
+
);
|
|
2607
|
+
}
|
|
2608
|
+
var ARTIFACT_ICONS = {
|
|
2609
|
+
audio: lucideReact.Music2,
|
|
2610
|
+
file: lucideReact.File,
|
|
2611
|
+
html: lucideReact.FileCode2,
|
|
2612
|
+
image: lucideReact.FileImage,
|
|
2613
|
+
markdown: lucideReact.FileText,
|
|
2614
|
+
pdf: lucideReact.FileText,
|
|
2615
|
+
presentation: lucideReact.Presentation,
|
|
2616
|
+
video: lucideReact.Film,
|
|
2617
|
+
web: lucideReact.Globe2
|
|
2618
|
+
};
|
|
2619
|
+
function ArtifactThumbnail({ artifact }) {
|
|
2620
|
+
if (artifact.thumbnailUrl) {
|
|
2621
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2622
|
+
"img",
|
|
2623
|
+
{
|
|
2624
|
+
src: artifact.thumbnailUrl,
|
|
2625
|
+
alt: "",
|
|
2626
|
+
loading: "lazy",
|
|
2627
|
+
className: "size-7 rounded object-cover"
|
|
2628
|
+
}
|
|
2629
|
+
);
|
|
2630
|
+
}
|
|
2631
|
+
const Icon2 = ARTIFACT_ICONS[artifact.kind];
|
|
2632
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex size-7 items-center justify-center rounded bg-muted text-muted-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "size-4", "aria-hidden": "true" }) });
|
|
2633
|
+
}
|
|
2634
|
+
function ArtifactGroup({
|
|
2635
|
+
title,
|
|
2636
|
+
artifacts,
|
|
2637
|
+
maxItems,
|
|
2638
|
+
onArtifactOpen
|
|
2639
|
+
}) {
|
|
2640
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "flex min-w-0 flex-col gap-2", children: [
|
|
2641
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { role: "heading", "aria-level": 2, className: "text-sm font-medium text-muted-foreground", children: title }),
|
|
2642
|
+
artifacts.slice(0, maxItems).map((artifact) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2643
|
+
"button",
|
|
2644
|
+
{
|
|
2645
|
+
type: "button",
|
|
2646
|
+
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",
|
|
2647
|
+
disabled: !onArtifactOpen || artifact.status === "loading",
|
|
2648
|
+
onClick: () => onArtifactOpen?.(artifact),
|
|
2649
|
+
children: [
|
|
2650
|
+
/* @__PURE__ */ jsxRuntime.jsx(ArtifactThumbnail, { artifact }),
|
|
2651
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 flex-1 truncate text-muted-foreground", children: artifact.name })
|
|
2652
|
+
]
|
|
2653
|
+
},
|
|
2654
|
+
artifact.id
|
|
2655
|
+
))
|
|
2656
|
+
] });
|
|
2657
|
+
}
|
|
2658
|
+
function AgentWorkbenchArtifactSummary({
|
|
2659
|
+
artifacts,
|
|
2660
|
+
open,
|
|
2661
|
+
defaultOpen = false,
|
|
2662
|
+
maxItemsPerGroup = 3,
|
|
2663
|
+
showAll = false,
|
|
2664
|
+
className,
|
|
2665
|
+
contentClassName,
|
|
2666
|
+
onOpenChange,
|
|
2667
|
+
onArtifactOpen,
|
|
2668
|
+
onViewAll
|
|
2669
|
+
}) {
|
|
2670
|
+
const messages = useMonkeysLocaleMessages().agentWorkbench.artifactWorkspace;
|
|
2671
|
+
const outputs = artifacts.filter((artifact) => artifact.origin === "output");
|
|
2672
|
+
const sources = artifacts.filter((artifact) => artifact.origin === "source");
|
|
2673
|
+
if (artifacts.length === 0) return null;
|
|
2674
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(PopoverPrimitive2__namespace.Root, { open, defaultOpen, onOpenChange, children: [
|
|
2675
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2676
|
+
PopoverPrimitive2__namespace.Trigger,
|
|
2677
|
+
{
|
|
2678
|
+
type: "button",
|
|
2679
|
+
className: cn2(
|
|
2680
|
+
"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",
|
|
2681
|
+
className
|
|
2682
|
+
),
|
|
2683
|
+
"aria-label": messages.toggleSummary,
|
|
2684
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ListFilter, { className: "size-4", "aria-hidden": "true" })
|
|
2685
|
+
}
|
|
2686
|
+
),
|
|
2687
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2688
|
+
PopoverPrimitive2__namespace.Content,
|
|
2689
|
+
{
|
|
2690
|
+
"aria-label": messages.toggleSummary,
|
|
2691
|
+
side: "bottom",
|
|
2692
|
+
align: "end",
|
|
2693
|
+
sideOffset: 8,
|
|
2694
|
+
collisionPadding: 12,
|
|
2695
|
+
className: cn2(
|
|
2696
|
+
"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",
|
|
2697
|
+
contentClassName
|
|
2698
|
+
),
|
|
2699
|
+
children: [
|
|
2700
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex max-h-[min(34rem,calc(100vh-5rem))] min-w-0 flex-col gap-4 overflow-y-auto", children: [
|
|
2701
|
+
outputs.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2702
|
+
ArtifactGroup,
|
|
2703
|
+
{
|
|
2704
|
+
title: messages.outputs,
|
|
2705
|
+
artifacts: outputs,
|
|
2706
|
+
maxItems: showAll ? outputs.length : maxItemsPerGroup,
|
|
2707
|
+
onArtifactOpen
|
|
2708
|
+
}
|
|
2709
|
+
) : null,
|
|
2710
|
+
outputs.length > 0 && sources.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-px bg-border" }) : null,
|
|
2711
|
+
sources.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2712
|
+
ArtifactGroup,
|
|
2713
|
+
{
|
|
2714
|
+
title: messages.sources,
|
|
2715
|
+
artifacts: sources,
|
|
2716
|
+
maxItems: showAll ? sources.length : maxItemsPerGroup,
|
|
2717
|
+
onArtifactOpen
|
|
2718
|
+
}
|
|
2719
|
+
) : null,
|
|
2720
|
+
onViewAll && !showAll && (outputs.length > maxItemsPerGroup || sources.length > maxItemsPerGroup) ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2721
|
+
"button",
|
|
2722
|
+
{
|
|
2723
|
+
type: "button",
|
|
2724
|
+
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",
|
|
2725
|
+
onClick: onViewAll,
|
|
2726
|
+
children: [
|
|
2727
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Link2, { className: "size-4", "aria-hidden": "true" }),
|
|
2728
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: messages.viewAll })
|
|
2729
|
+
]
|
|
2730
|
+
}
|
|
2731
|
+
) : null
|
|
2732
|
+
] }),
|
|
2733
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive2__namespace.Arrow, { className: "fill-popover" })
|
|
2734
|
+
]
|
|
2735
|
+
}
|
|
2736
|
+
)
|
|
2737
|
+
] });
|
|
2738
|
+
}
|
|
2739
|
+
var ARTIFACT_ICONS2 = {
|
|
2740
|
+
audio: lucideReact.Music2,
|
|
2741
|
+
file: lucideReact.File,
|
|
2742
|
+
html: lucideReact.FileCode2,
|
|
2743
|
+
image: lucideReact.FileImage,
|
|
2744
|
+
markdown: lucideReact.FileText,
|
|
2745
|
+
pdf: lucideReact.FileText,
|
|
2746
|
+
presentation: lucideReact.Presentation,
|
|
2747
|
+
video: lucideReact.Film,
|
|
2748
|
+
web: lucideReact.Globe2
|
|
2749
|
+
};
|
|
2750
|
+
function SortableArtifactTab({
|
|
2751
|
+
artifact,
|
|
2752
|
+
selected,
|
|
2753
|
+
onClose
|
|
2754
|
+
}) {
|
|
2755
|
+
const messages = useMonkeysLocaleMessages().agentWorkbench.artifactWorkspace;
|
|
2756
|
+
const Icon2 = ARTIFACT_ICONS2[artifact.kind];
|
|
2757
|
+
const { attributes, listeners, setNodeRef, setActivatorNodeRef, transform, transition, isDragging } = sortable.useSortable({
|
|
2758
|
+
id: artifact.id
|
|
2759
|
+
});
|
|
2760
|
+
const { role: _sortableRole, tabIndex: _sortableTabIndex, ...sortableA11y } = attributes;
|
|
2761
|
+
const setTabRef = (node) => {
|
|
2762
|
+
setNodeRef(node);
|
|
2763
|
+
setActivatorNodeRef(node);
|
|
2764
|
+
};
|
|
2765
|
+
const handleMouseDown = (event) => {
|
|
2766
|
+
if (event.button !== 1) return;
|
|
2767
|
+
event.preventDefault();
|
|
2768
|
+
onClose();
|
|
2769
|
+
};
|
|
2770
|
+
const handleClick = (event) => {
|
|
2771
|
+
if (!(event.target instanceof Element) || !event.target.closest("[data-close-artifact-tab]")) return;
|
|
2772
|
+
event.preventDefault();
|
|
2773
|
+
onClose();
|
|
2774
|
+
};
|
|
2775
|
+
const handleKeyDown = (event) => {
|
|
2776
|
+
listeners?.onKeyDown?.(event);
|
|
2777
|
+
if (event.key !== "Delete" && event.key !== "Backspace") return;
|
|
2778
|
+
event.preventDefault();
|
|
2779
|
+
onClose();
|
|
2780
|
+
};
|
|
2781
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2782
|
+
TabsPrimitive__namespace.Trigger,
|
|
2783
|
+
{
|
|
2784
|
+
ref: setTabRef,
|
|
2785
|
+
value: artifact.id,
|
|
2786
|
+
style: { transform: utilities.CSS.Transform.toString(transform), transition },
|
|
2787
|
+
className: cn2(
|
|
2788
|
+
"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",
|
|
2789
|
+
selected ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:bg-background/60",
|
|
2790
|
+
isDragging && "opacity-60"
|
|
2791
|
+
),
|
|
2792
|
+
onMouseDown: handleMouseDown,
|
|
2793
|
+
onClick: handleClick,
|
|
2794
|
+
...sortableA11y,
|
|
2795
|
+
...listeners,
|
|
2796
|
+
onKeyDown: handleKeyDown,
|
|
2797
|
+
children: [
|
|
2798
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "size-4 shrink-0", "aria-hidden": "true" }),
|
|
2799
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: artifact.name }),
|
|
2800
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2801
|
+
"span",
|
|
2802
|
+
{
|
|
2803
|
+
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",
|
|
2804
|
+
"data-selected": selected,
|
|
2805
|
+
"data-close-artifact-tab": "",
|
|
2806
|
+
title: messages.closeTab({ name: artifact.name }),
|
|
2807
|
+
"aria-hidden": "true",
|
|
2808
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-3.5", "aria-hidden": "true" })
|
|
2809
|
+
}
|
|
2810
|
+
)
|
|
2811
|
+
]
|
|
2812
|
+
}
|
|
2813
|
+
);
|
|
2814
|
+
}
|
|
2815
|
+
function AgentWorkbenchArtifactWorkspace({
|
|
2816
|
+
artifacts,
|
|
2817
|
+
activeArtifactId,
|
|
2818
|
+
className,
|
|
2819
|
+
renderArtifact,
|
|
2820
|
+
onIntent
|
|
2821
|
+
}) {
|
|
2822
|
+
const messages = useMonkeysLocaleMessages().agentWorkbench.artifactWorkspace;
|
|
2823
|
+
const activeArtifact = artifacts.find((artifact) => artifact.id === activeArtifactId) ?? artifacts[0];
|
|
2824
|
+
const sensors = core.useSensors(
|
|
2825
|
+
core.useSensor(core.PointerSensor, { activationConstraint: { distance: 5 } }),
|
|
2826
|
+
core.useSensor(core.KeyboardSensor, { coordinateGetter: sortable.sortableKeyboardCoordinates })
|
|
2827
|
+
);
|
|
2828
|
+
if (!activeArtifact) return null;
|
|
2829
|
+
const handleDragEnd = ({ active, over }) => {
|
|
2830
|
+
if (!over || active.id === over.id) return;
|
|
2831
|
+
onIntent?.({ type: "reorder", artifactId: String(active.id), overArtifactId: String(over.id) });
|
|
2832
|
+
};
|
|
2833
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2834
|
+
TabsPrimitive__namespace.Root,
|
|
2835
|
+
{
|
|
2836
|
+
value: activeArtifact.id,
|
|
2837
|
+
onValueChange: (artifactId) => onIntent?.({ type: "select", artifactId }),
|
|
2838
|
+
className: cn2("flex size-full min-h-0 min-w-0 flex-col bg-background text-foreground", className),
|
|
2839
|
+
orientation: "horizontal",
|
|
2840
|
+
children: [
|
|
2841
|
+
/* @__PURE__ */ jsxRuntime.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: [
|
|
2842
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.DndContext, { sensors, collisionDetection: core.closestCenter, onDragEnd: handleDragEnd, children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: artifacts.map((artifact) => artifact.id), strategy: sortable.horizontalListSortingStrategy, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2843
|
+
TabsPrimitive__namespace.List,
|
|
2844
|
+
{
|
|
2845
|
+
className: "flex min-w-0 flex-1 items-center gap-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
2846
|
+
"aria-label": messages.tabs,
|
|
2847
|
+
children: artifacts.map((artifact) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2848
|
+
SortableArtifactTab,
|
|
2849
|
+
{
|
|
2850
|
+
artifact,
|
|
2851
|
+
selected: artifact.id === activeArtifact.id,
|
|
2852
|
+
onClose: () => onIntent?.({ type: "close", artifactId: artifact.id })
|
|
2853
|
+
},
|
|
2854
|
+
artifact.id
|
|
2855
|
+
))
|
|
2856
|
+
}
|
|
2857
|
+
) }) }),
|
|
2858
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative z-20 flex shrink-0 items-center gap-2", children: [
|
|
2859
|
+
activeArtifact.url ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2860
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2861
|
+
"button",
|
|
2862
|
+
{
|
|
2863
|
+
type: "button",
|
|
2864
|
+
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",
|
|
2865
|
+
"aria-label": messages.download({ name: activeArtifact.name }),
|
|
2866
|
+
onClick: () => onIntent?.({ type: "download", artifactId: activeArtifact.id }),
|
|
2867
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Download, { className: "size-4", "aria-hidden": "true" })
|
|
2868
|
+
}
|
|
2869
|
+
),
|
|
2870
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2871
|
+
"button",
|
|
2872
|
+
{
|
|
2873
|
+
type: "button",
|
|
2874
|
+
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",
|
|
2875
|
+
"aria-label": messages.openExternal({ name: activeArtifact.name }),
|
|
2876
|
+
onClick: () => onIntent?.({ type: "open-external", artifactId: activeArtifact.id }),
|
|
2877
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ExternalLink, { className: "size-4", "aria-hidden": "true" })
|
|
2878
|
+
}
|
|
2879
|
+
)
|
|
2880
|
+
] }) : null,
|
|
2881
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2882
|
+
"button",
|
|
2883
|
+
{
|
|
2884
|
+
type: "button",
|
|
2885
|
+
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",
|
|
2886
|
+
"aria-label": messages.closeWorkspace,
|
|
2887
|
+
onClick: () => onIntent?.({ type: "close-workspace" }),
|
|
2888
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelRightClose, { className: "size-4", "aria-hidden": "true" })
|
|
2889
|
+
}
|
|
2890
|
+
)
|
|
2891
|
+
] })
|
|
2892
|
+
] }),
|
|
2893
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-0 min-w-0 flex-1 overflow-hidden", children: artifacts.map((artifact) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2894
|
+
TabsPrimitive__namespace.Content,
|
|
2895
|
+
{
|
|
2896
|
+
value: artifact.id,
|
|
2897
|
+
className: "size-full min-h-0 min-w-0 outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",
|
|
2898
|
+
children: artifact.id === activeArtifact.id ? renderArtifact(artifact) : null
|
|
2899
|
+
},
|
|
2900
|
+
artifact.id
|
|
2901
|
+
)) })
|
|
2902
|
+
]
|
|
2903
|
+
}
|
|
2904
|
+
);
|
|
2905
|
+
}
|
|
2432
2906
|
|
|
2907
|
+
exports.AgentWorkbenchAction = AgentWorkbenchAction;
|
|
2433
2908
|
exports.AgentWorkbenchActivity = AgentWorkbenchActivity;
|
|
2909
|
+
exports.AgentWorkbenchArtifactSummary = AgentWorkbenchArtifactSummary;
|
|
2910
|
+
exports.AgentWorkbenchArtifactWorkspace = AgentWorkbenchArtifactWorkspace;
|
|
2434
2911
|
exports.AgentWorkbenchComposer = AgentWorkbenchComposer;
|
|
2912
|
+
exports.AgentWorkbenchProcess = AgentWorkbenchProcess;
|
|
2435
2913
|
exports.AgentWorkbenchSidebar = AgentWorkbenchSidebar;
|
|
2436
2914
|
exports.AgentWorkbenchTaskDetails = AgentWorkbenchTaskDetails;
|
|
2437
2915
|
exports.AgentWorkbenchThread = AgentWorkbenchThread;
|