@inf-monkeys-tech/monkeys-design 1.0.14 → 1.0.15
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 +41 -168
- package/dist/components/agent-workbench/index.d.ts +41 -168
- package/dist/components/agent-workbench/index.js +335 -4
- package/dist/components/agent-workbench/index.js.map +1 -1
- package/dist/components/agent-workbench/index.mjs +336 -6
- package/dist/components/agent-workbench/index.mjs.map +1 -1
- package/dist/components/base/index.js +32 -1
- package/dist/components/base/index.js.map +1 -1
- package/dist/components/base/index.mjs +32 -1
- package/dist/components/base/index.mjs.map +1 -1
- package/dist/components/data-explorer/index.js +32 -1
- package/dist/components/data-explorer/index.js.map +1 -1
- package/dist/components/data-explorer/index.mjs +32 -1
- package/dist/components/data-explorer/index.mjs.map +1 -1
- package/dist/components/layout/index.js +32 -1
- package/dist/components/layout/index.js.map +1 -1
- package/dist/components/layout/index.mjs +32 -1
- package/dist/components/layout/index.mjs.map +1 -1
- package/dist/components/runtime/index.js +32 -1
- package/dist/components/runtime/index.js.map +1 -1
- package/dist/components/runtime/index.mjs +32 -1
- 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 +32 -1
- package/dist/components/toast/index.js.map +1 -1
- package/dist/components/toast/index.mjs +32 -1
- package/dist/components/toast/index.mjs.map +1 -1
- package/dist/components/toolbar/index.js +32 -1
- package/dist/components/toolbar/index.js.map +1 -1
- package/dist/components/toolbar/index.mjs +32 -1
- package/dist/components/toolbar/index.mjs.map +1 -1
- package/dist/components/workbench/index.js +32 -1
- package/dist/components/workbench/index.js.map +1 -1
- package/dist/components/workbench/index.mjs +32 -1
- package/dist/components/workbench/index.mjs.map +1 -1
- package/dist/details-model-f2034b78b458.d.mts +199 -0
- package/dist/details-model-f2034b78b458.d.ts +199 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +142 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +142 -5
- package/dist/index.mjs.map +1 -1
- package/dist/locale/index.d.mts +88 -2
- package/dist/locale/index.d.ts +88 -2
- package/dist/locale/index.js +72 -2
- package/dist/locale/index.js.map +1 -1
- package/dist/locale/index.mjs +72 -2
- 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 +72 -2
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/index.mjs +72 -2
- package/dist/provider/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/{types-37967a434f7c.d.mts → types-a81dc2d284e3.d.mts} +37 -0
- package/dist/{types-37967a434f7c.d.ts → types-a81dc2d284e3.d.ts} +37 -0
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChevronDown, Check, ChevronRight, Circle, ChevronUp,
|
|
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, Loader2, CheckCircle2, AlertCircle, Ellipsis, XCircle, CircleStop, GitFork, PencilLine, Copy, RotateCcw, FileCode2, Files, TestTube2 } 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';
|
|
@@ -15,7 +15,7 @@ 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
17
|
|
|
18
|
-
// src/components/agent-workbench/
|
|
18
|
+
// src/components/agent-workbench/AgentWorkbenchComposer.tsx
|
|
19
19
|
|
|
20
20
|
// src/locale/en-US.ts
|
|
21
21
|
var enUS = {
|
|
@@ -116,6 +116,30 @@ var enUS = {
|
|
|
116
116
|
reasoning: "Reasoning",
|
|
117
117
|
plan: "Plan",
|
|
118
118
|
taskNoDetail: "No additional details",
|
|
119
|
+
modes: { chatbot: "Chatbot", agent: "Agent" },
|
|
120
|
+
composer: {
|
|
121
|
+
send: "Send message",
|
|
122
|
+
stop: "Stop generating",
|
|
123
|
+
queue: "Queue message",
|
|
124
|
+
attach: "Add photos or files",
|
|
125
|
+
voice: "Start voice input",
|
|
126
|
+
webSearch: "Web search",
|
|
127
|
+
model: "Model",
|
|
128
|
+
reasoning: "Reasoning effort",
|
|
129
|
+
permissions: "Permissions",
|
|
130
|
+
removeAttachment: "Remove attachment",
|
|
131
|
+
editQueued: "Edit queued message",
|
|
132
|
+
deleteQueued: "Delete queued message",
|
|
133
|
+
moveUp: "Move message up",
|
|
134
|
+
moveDown: "Move message down",
|
|
135
|
+
queued: "Queued messages",
|
|
136
|
+
uploading: "Uploading",
|
|
137
|
+
noModels: "No models available",
|
|
138
|
+
message: "Message",
|
|
139
|
+
attachmentOnly: "Attachment",
|
|
140
|
+
reasoningOptions: { low: "Low", medium: "Medium", high: "High", xhigh: "Extra high" },
|
|
141
|
+
permissionOptions: { "approval-required": "Approval required", "auto-approve": "Auto approve", "full-access": "Full access" }
|
|
142
|
+
},
|
|
119
143
|
tool: {
|
|
120
144
|
input: "Input",
|
|
121
145
|
output: "Output",
|
|
@@ -184,6 +208,10 @@ var enUS = {
|
|
|
184
208
|
description: "Summary and workspace activity",
|
|
185
209
|
duration: "Duration",
|
|
186
210
|
updated: "Updated",
|
|
211
|
+
model: "Model",
|
|
212
|
+
mode: "Mode",
|
|
213
|
+
permissions: "Permissions",
|
|
214
|
+
tokenUsage: "Token usage",
|
|
187
215
|
summary: "Summary",
|
|
188
216
|
summaryEmpty: "No summary is available yet.",
|
|
189
217
|
summaryFailed: "The summary could not be generated.",
|
|
@@ -213,7 +241,10 @@ var enUS = {
|
|
|
213
241
|
copySummary: "Copy summary",
|
|
214
242
|
retry: "Retry",
|
|
215
243
|
retrySummary: "Retry summary",
|
|
216
|
-
resume: "Resume"
|
|
244
|
+
resume: "Resume",
|
|
245
|
+
continueInNewTask: "Continue in new task",
|
|
246
|
+
editAndRerun: "Edit and rerun",
|
|
247
|
+
export: "Export"
|
|
217
248
|
},
|
|
218
249
|
workspace: {
|
|
219
250
|
diffs: "Code changes",
|
|
@@ -611,6 +642,238 @@ var SelectSeparator = React2.forwardRef(
|
|
|
611
642
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Separator, { ref, className: cn("-mx-1 my-1 h-px bg-muted", className), ...props })
|
|
612
643
|
);
|
|
613
644
|
SelectSeparator.displayName = "SelectSeparator";
|
|
645
|
+
var iconButtonClass = "inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-40";
|
|
646
|
+
function modelOptionValue(option) {
|
|
647
|
+
return `${option.mode}:${option.id}`;
|
|
648
|
+
}
|
|
649
|
+
function AgentWorkbenchComposer({
|
|
650
|
+
viewModel,
|
|
651
|
+
className,
|
|
652
|
+
classNames,
|
|
653
|
+
onIntent
|
|
654
|
+
}) {
|
|
655
|
+
const messages = useMonkeysLocaleMessages().agentWorkbench;
|
|
656
|
+
const fileInputRef = useRef(null);
|
|
657
|
+
const surfaceRef = useRef(null);
|
|
658
|
+
const [editingDraftId, setEditingDraftId] = useState();
|
|
659
|
+
const [editingText, setEditingText] = useState("");
|
|
660
|
+
const [isNarrow, setIsNarrow] = useState(false);
|
|
661
|
+
const isBusy = viewModel.status === "loading" || viewModel.status === "streaming" || viewModel.status === "stopping";
|
|
662
|
+
const isStopping = viewModel.status === "stopping";
|
|
663
|
+
const isUploading = viewModel.attachments.some((attachment) => attachment.status === "uploading");
|
|
664
|
+
const canSubmit = !isStopping && !isUploading && (viewModel.value.trim().length > 0 || viewModel.attachments.some((item) => item.status === "ready"));
|
|
665
|
+
const showSubmitButton = !isBusy || canSubmit;
|
|
666
|
+
const selectedModelValue = useMemo(() => {
|
|
667
|
+
const selected = viewModel.model.options.find((option) => option.id === viewModel.model.selectedId);
|
|
668
|
+
return selected ? modelOptionValue(selected) : "";
|
|
669
|
+
}, [viewModel.model.options, viewModel.model.selectedId]);
|
|
670
|
+
useEffect(() => {
|
|
671
|
+
const surface = surfaceRef.current;
|
|
672
|
+
if (!surface) return void 0;
|
|
673
|
+
const updateLayout = () => setIsNarrow(surface.getBoundingClientRect().width <= 704);
|
|
674
|
+
updateLayout();
|
|
675
|
+
window.addEventListener("resize", updateLayout);
|
|
676
|
+
if (typeof ResizeObserver === "undefined") {
|
|
677
|
+
const interval = window.setInterval(updateLayout, 250);
|
|
678
|
+
return () => {
|
|
679
|
+
window.clearInterval(interval);
|
|
680
|
+
window.removeEventListener("resize", updateLayout);
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
const observer = new ResizeObserver(updateLayout);
|
|
684
|
+
observer.observe(surface);
|
|
685
|
+
return () => {
|
|
686
|
+
observer.disconnect();
|
|
687
|
+
window.removeEventListener("resize", updateLayout);
|
|
688
|
+
};
|
|
689
|
+
}, []);
|
|
690
|
+
const submit = () => {
|
|
691
|
+
if (canSubmit) onIntent?.({ type: "submit" });
|
|
692
|
+
};
|
|
693
|
+
return /* @__PURE__ */ jsxs(
|
|
694
|
+
"form",
|
|
695
|
+
{
|
|
696
|
+
className: cn2("agent-workbench-composer flex min-w-0 w-full flex-col gap-2", className, classNames?.root),
|
|
697
|
+
"aria-label": messages.composer.message,
|
|
698
|
+
onSubmit: (event) => {
|
|
699
|
+
event.preventDefault();
|
|
700
|
+
submit();
|
|
701
|
+
},
|
|
702
|
+
children: [
|
|
703
|
+
viewModel.capabilities.queue && viewModel.queuedDrafts.length > 0 ? /* @__PURE__ */ jsx(
|
|
704
|
+
"section",
|
|
705
|
+
{
|
|
706
|
+
"aria-label": messages.composer.queued,
|
|
707
|
+
className: cn2("min-w-0 max-w-full rounded-md border border-border bg-muted/40 p-2", classNames?.queue),
|
|
708
|
+
children: /* @__PURE__ */ jsx("ol", { className: "space-y-1.5", children: viewModel.queuedDrafts.map((draft, index) => /* @__PURE__ */ jsxs("li", { className: "flex min-h-9 min-w-0 max-w-full items-center gap-2 overflow-hidden rounded-md bg-background px-2 py-1.5 text-sm", children: [
|
|
709
|
+
/* @__PURE__ */ jsx("span", { className: "w-5 shrink-0 text-center text-xs text-muted-foreground", children: index + 1 }),
|
|
710
|
+
editingDraftId === draft.id ? /* @__PURE__ */ jsx(
|
|
711
|
+
"input",
|
|
712
|
+
{
|
|
713
|
+
autoFocus: true,
|
|
714
|
+
value: editingText,
|
|
715
|
+
"aria-label": messages.composer.editQueued,
|
|
716
|
+
className: "min-w-0 flex-1 rounded border border-input bg-background px-2 py-1 outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
717
|
+
onChange: (event) => setEditingText(event.target.value),
|
|
718
|
+
onBlur: () => {
|
|
719
|
+
if (editingText.trim()) onIntent?.({ type: "edit-queued-draft", draftId: draft.id, text: editingText });
|
|
720
|
+
setEditingDraftId(void 0);
|
|
721
|
+
},
|
|
722
|
+
onKeyDown: (event) => {
|
|
723
|
+
if (event.key === "Escape") setEditingDraftId(void 0);
|
|
724
|
+
if (event.key === "Enter" && editingText.trim()) {
|
|
725
|
+
event.preventDefault();
|
|
726
|
+
onIntent?.({ type: "edit-queued-draft", draftId: draft.id, text: editingText });
|
|
727
|
+
setEditingDraftId(void 0);
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
) : /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: draft.text || messages.composer.attachmentOnly }),
|
|
732
|
+
/* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-0.5", children: [
|
|
733
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: iconButtonClass, "aria-label": messages.composer.moveUp, disabled: index === 0, onClick: () => onIntent?.({ type: "move-queued-draft", draftId: draft.id, direction: "up" }), children: /* @__PURE__ */ jsx(ArrowUp, { className: "size-3.5" }) }),
|
|
734
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: iconButtonClass, "aria-label": messages.composer.moveDown, disabled: index === viewModel.queuedDrafts.length - 1, onClick: () => onIntent?.({ type: "move-queued-draft", draftId: draft.id, direction: "down" }), children: /* @__PURE__ */ jsx(ArrowDown, { className: "size-3.5" }) }),
|
|
735
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: iconButtonClass, "aria-label": messages.composer.editQueued, onClick: () => {
|
|
736
|
+
setEditingDraftId(draft.id);
|
|
737
|
+
setEditingText(draft.text);
|
|
738
|
+
}, children: /* @__PURE__ */ jsx(Pencil, { className: "size-3.5" }) }),
|
|
739
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: cn2(iconButtonClass, "text-destructive-text"), "aria-label": messages.composer.deleteQueued, onClick: () => onIntent?.({ type: "delete-queued-draft", draftId: draft.id }), children: /* @__PURE__ */ jsx(Trash2, { className: "size-3.5" }) })
|
|
740
|
+
] })
|
|
741
|
+
] }, draft.id)) })
|
|
742
|
+
}
|
|
743
|
+
) : null,
|
|
744
|
+
/* @__PURE__ */ jsxs("div", { ref: surfaceRef, className: "agent-workbench-composer__surface min-w-0 max-w-full rounded-lg border border-input bg-background p-3 shadow-sm focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/30", children: [
|
|
745
|
+
viewModel.attachments.length > 0 ? /* @__PURE__ */ jsx("div", { className: cn2("mb-2 flex max-w-full gap-2 overflow-x-auto", classNames?.attachments), children: viewModel.attachments.map((attachment) => /* @__PURE__ */ jsxs("div", { className: "relative flex size-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-muted", children: [
|
|
746
|
+
attachment.previewUrl && attachment.mediaType?.startsWith("image/") ? /* @__PURE__ */ jsx("img", { src: attachment.previewUrl, alt: "", className: "size-full object-cover" }) : attachment.mediaType?.startsWith("image/") ? /* @__PURE__ */ jsx(Image, { className: "size-5 text-muted-foreground" }) : /* @__PURE__ */ jsx(File, { className: "size-5 text-muted-foreground" }),
|
|
747
|
+
attachment.status === "uploading" ? /* @__PURE__ */ jsx("span", { className: "absolute inset-0 flex items-center justify-center bg-background/80 text-[10px] font-medium", children: messages.composer.uploading }) : null,
|
|
748
|
+
/* @__PURE__ */ jsx(
|
|
749
|
+
"button",
|
|
750
|
+
{
|
|
751
|
+
type: "button",
|
|
752
|
+
className: "absolute right-1 top-1 flex size-5 items-center justify-center rounded-full bg-background/90 text-foreground shadow",
|
|
753
|
+
"aria-label": messages.composer.removeAttachment,
|
|
754
|
+
onClick: () => onIntent?.({ type: "remove-attachment", attachmentId: attachment.id }),
|
|
755
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-3" })
|
|
756
|
+
}
|
|
757
|
+
),
|
|
758
|
+
/* @__PURE__ */ jsx("span", { className: "absolute inset-x-0 bottom-0 truncate bg-background/85 px-1 py-0.5 text-[9px]", children: attachment.name })
|
|
759
|
+
] }, attachment.id)) }) : null,
|
|
760
|
+
/* @__PURE__ */ jsx(
|
|
761
|
+
"textarea",
|
|
762
|
+
{
|
|
763
|
+
value: viewModel.value,
|
|
764
|
+
rows: 2,
|
|
765
|
+
"aria-label": messages.composer.message,
|
|
766
|
+
placeholder: viewModel.placeholder,
|
|
767
|
+
className: cn2("max-h-64 min-h-14 min-w-0 w-full resize-none border-0 bg-transparent text-sm leading-relaxed text-foreground outline-none placeholder:text-muted-foreground", classNames?.textarea),
|
|
768
|
+
onChange: (event) => onIntent?.({ type: "change-value", value: event.target.value }),
|
|
769
|
+
onKeyDown: (event) => {
|
|
770
|
+
if (event.key === "Enter" && !event.shiftKey && !event.nativeEvent.isComposing) {
|
|
771
|
+
event.preventDefault();
|
|
772
|
+
submit();
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
),
|
|
777
|
+
/* @__PURE__ */ jsxs("div", { className: cn2("agent-workbench-composer__toolbar mt-2 flex min-h-8 min-w-0 max-w-full items-center gap-2", isNarrow ? "flex-wrap" : "flex-nowrap", classNames?.toolbar), children: [
|
|
778
|
+
/* @__PURE__ */ jsxs("div", { className: cn2("agent-workbench-composer__controls flex min-w-0 max-w-full flex-1 items-center gap-1.5", isNarrow ? "w-full flex-wrap" : "flex-nowrap"), children: [
|
|
779
|
+
viewModel.capabilities.attachments ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
780
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: iconButtonClass, "aria-label": messages.composer.attach, onClick: () => fileInputRef.current?.click(), children: /* @__PURE__ */ jsx(Paperclip, { className: "size-4" }) }),
|
|
781
|
+
/* @__PURE__ */ jsx(
|
|
782
|
+
"input",
|
|
783
|
+
{
|
|
784
|
+
ref: fileInputRef,
|
|
785
|
+
type: "file",
|
|
786
|
+
className: "hidden",
|
|
787
|
+
multiple: true,
|
|
788
|
+
onChange: (event) => {
|
|
789
|
+
const files = Array.from(event.target.files || []);
|
|
790
|
+
if (files.length > 0) onIntent?.({ type: "request-attachments", files });
|
|
791
|
+
event.target.value = "";
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
)
|
|
795
|
+
] }) : null,
|
|
796
|
+
viewModel.capabilities.voiceInput ? /* @__PURE__ */ jsx("button", { type: "button", className: iconButtonClass, "aria-label": messages.composer.voice, onClick: () => onIntent?.({ type: "request-voice-input" }), children: /* @__PURE__ */ jsx(Mic, { className: "size-4" }) }) : null,
|
|
797
|
+
viewModel.capabilities.webSearch ? /* @__PURE__ */ jsxs("label", { className: "flex shrink-0 items-center gap-1.5 whitespace-nowrap px-1 text-xs font-medium text-foreground", children: [
|
|
798
|
+
messages.composer.webSearch,
|
|
799
|
+
/* @__PURE__ */ jsx(Switch, { checked: viewModel.webSearchEnabled, onCheckedChange: (enabled) => onIntent?.({ type: "toggle-web-search", enabled }) })
|
|
800
|
+
] }) : null,
|
|
801
|
+
viewModel.capabilities.modelSelection ? /* @__PURE__ */ jsx("label", { className: "sr-only", htmlFor: "agent-workbench-model", children: messages.composer.model }) : null,
|
|
802
|
+
viewModel.capabilities.modelSelection ? /* @__PURE__ */ jsxs(
|
|
803
|
+
"select",
|
|
804
|
+
{
|
|
805
|
+
id: "agent-workbench-model",
|
|
806
|
+
value: selectedModelValue,
|
|
807
|
+
"aria-label": messages.composer.model,
|
|
808
|
+
className: "h-8 w-48 min-w-36 shrink rounded-md border border-border bg-background px-2 text-xs font-medium text-foreground",
|
|
809
|
+
onChange: (event) => {
|
|
810
|
+
const option = viewModel.model.options.find((item) => modelOptionValue(item) === event.target.value);
|
|
811
|
+
if (option) onIntent?.({ type: "select-model", modelId: option.id, mode: option.mode });
|
|
812
|
+
},
|
|
813
|
+
children: [
|
|
814
|
+
viewModel.model.options.length === 0 ? /* @__PURE__ */ jsx("option", { value: "", children: messages.composer.noModels }) : null,
|
|
815
|
+
viewModel.model.options.map((option) => /* @__PURE__ */ jsxs("option", { value: modelOptionValue(option), disabled: option.disabled, children: [
|
|
816
|
+
option.label,
|
|
817
|
+
" \xB7 ",
|
|
818
|
+
messages.modes[option.mode]
|
|
819
|
+
] }, modelOptionValue(option)))
|
|
820
|
+
]
|
|
821
|
+
}
|
|
822
|
+
) : null,
|
|
823
|
+
viewModel.capabilities.reasoning && viewModel.reasoning ? /* @__PURE__ */ jsx(
|
|
824
|
+
"select",
|
|
825
|
+
{
|
|
826
|
+
value: viewModel.reasoning.value,
|
|
827
|
+
"aria-label": messages.composer.reasoning,
|
|
828
|
+
className: "h-8 w-32 min-w-24 shrink rounded-md border border-border bg-background px-2 text-xs font-medium text-foreground",
|
|
829
|
+
onChange: (event) => onIntent?.({ type: "change-reasoning", value: event.target.value }),
|
|
830
|
+
children: viewModel.reasoning.options.map((value) => /* @__PURE__ */ jsx("option", { value, children: messages.composer.reasoningOptions[value] }, value))
|
|
831
|
+
}
|
|
832
|
+
) : null,
|
|
833
|
+
viewModel.capabilities.permissions && viewModel.permissionProfile ? /* @__PURE__ */ jsx(
|
|
834
|
+
"select",
|
|
835
|
+
{
|
|
836
|
+
value: viewModel.permissionProfile,
|
|
837
|
+
"aria-label": messages.composer.permissions,
|
|
838
|
+
className: "h-8 w-40 min-w-32 shrink rounded-md border border-border bg-background px-2 text-xs font-medium text-foreground",
|
|
839
|
+
onChange: (event) => onIntent?.({ type: "change-permission", value: event.target.value }),
|
|
840
|
+
children: ["approval-required", "auto-approve", "full-access"].map((value) => /* @__PURE__ */ jsx("option", { value, children: messages.composer.permissionOptions[value] }, value))
|
|
841
|
+
}
|
|
842
|
+
) : null
|
|
843
|
+
] }),
|
|
844
|
+
/* @__PURE__ */ jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-1.5", children: [
|
|
845
|
+
showSubmitButton ? /* @__PURE__ */ jsx(
|
|
846
|
+
"button",
|
|
847
|
+
{
|
|
848
|
+
type: "submit",
|
|
849
|
+
className: cn2(
|
|
850
|
+
iconButtonClass,
|
|
851
|
+
"bg-primary text-primary-foreground hover:bg-primary/90 hover:text-primary-foreground disabled:bg-primary/40 disabled:!opacity-100"
|
|
852
|
+
),
|
|
853
|
+
"aria-label": isBusy && viewModel.capabilities.queue ? messages.composer.queue : messages.composer.send,
|
|
854
|
+
disabled: !canSubmit,
|
|
855
|
+
children: /* @__PURE__ */ jsx(Send, { className: "size-4" })
|
|
856
|
+
}
|
|
857
|
+
) : null,
|
|
858
|
+
isBusy && !canSubmit && viewModel.capabilities.stop ? /* @__PURE__ */ jsx(
|
|
859
|
+
"button",
|
|
860
|
+
{
|
|
861
|
+
type: "button",
|
|
862
|
+
className: cn2(iconButtonClass, "border border-border"),
|
|
863
|
+
"aria-label": isStopping ? messages.run.stopping : messages.composer.stop,
|
|
864
|
+
disabled: isStopping,
|
|
865
|
+
onClick: () => onIntent?.({ type: "stop" }),
|
|
866
|
+
children: /* @__PURE__ */ jsx(Square, { className: "size-3 fill-current" })
|
|
867
|
+
}
|
|
868
|
+
) : null
|
|
869
|
+
] })
|
|
870
|
+
] })
|
|
871
|
+
] }),
|
|
872
|
+
viewModel.status === "error" && viewModel.error ? /* @__PURE__ */ jsx("p", { role: "alert", className: "text-sm text-destructive-text", children: viewModel.error }) : null
|
|
873
|
+
]
|
|
874
|
+
}
|
|
875
|
+
);
|
|
876
|
+
}
|
|
614
877
|
function ItemAvatar({ item }) {
|
|
615
878
|
const [failed, setFailed] = useState(false);
|
|
616
879
|
if (item.iconUrl && !failed) {
|
|
@@ -1445,14 +1708,20 @@ function createAgentWorkbenchDetailsModel(viewModel) {
|
|
|
1445
1708
|
);
|
|
1446
1709
|
return {
|
|
1447
1710
|
mode: viewModel.snapshot.mode,
|
|
1711
|
+
modelId: viewModel.snapshot.modelId,
|
|
1712
|
+
permissionProfile: viewModel.snapshot.permissionProfile,
|
|
1448
1713
|
status: viewModel.status,
|
|
1449
1714
|
sessionId: viewModel.sessionId,
|
|
1715
|
+
capabilities,
|
|
1450
1716
|
resumable: capabilities.resume === true && viewModel.resumable,
|
|
1451
1717
|
summary,
|
|
1452
1718
|
error: [...viewModel.events].reverse().find(
|
|
1453
1719
|
(event) => event.eventType === "error"
|
|
1454
1720
|
),
|
|
1455
1721
|
run,
|
|
1722
|
+
usage: capabilities.usage ? [...viewModel.events].reverse().find(
|
|
1723
|
+
(event) => event.eventType === "usage"
|
|
1724
|
+
) : void 0,
|
|
1456
1725
|
workspace: {
|
|
1457
1726
|
diffs: latestBy2(workspaceEvents, "diff", (event) => event.payload.path),
|
|
1458
1727
|
files: latestBy2(
|
|
@@ -1563,13 +1832,17 @@ function SummaryPanel({
|
|
|
1563
1832
|
model,
|
|
1564
1833
|
onIntent
|
|
1565
1834
|
}) {
|
|
1566
|
-
const
|
|
1835
|
+
const workbenchMessages = useMonkeysLocaleMessages().agentWorkbench;
|
|
1836
|
+
const messages = workbenchMessages.details;
|
|
1567
1837
|
const locale = useMonkeysLocale().locale;
|
|
1568
1838
|
const summary = model.summary;
|
|
1569
1839
|
const run = model.run?.payload;
|
|
1570
1840
|
const error = model.error;
|
|
1571
1841
|
const retryable = model.status === "failed" && error?.payload.retryable;
|
|
1572
1842
|
const canResume = model.resumable && ["stopped", "completed", "failed"].includes(model.status);
|
|
1843
|
+
const canContinueInNewTask = model.capabilities.threadForking;
|
|
1844
|
+
const canEditAndRerun = model.capabilities.editAndRerun;
|
|
1845
|
+
const tokenUsage = model.usage?.payload.totalTokens ?? (model.usage?.payload.inputTokens !== void 0 || model.usage?.payload.outputTokens !== void 0 ? (model.usage.payload.inputTokens ?? 0) + (model.usage.payload.outputTokens ?? 0) : void 0);
|
|
1573
1846
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
1574
1847
|
/* @__PURE__ */ jsxs("section", { className: "rounded-lg border border-border bg-muted/40 p-3", children: [
|
|
1575
1848
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
@@ -1587,7 +1860,23 @@ function SummaryPanel({
|
|
|
1587
1860
|
run?.stoppedAt ?? run?.completedAt ?? run?.failedAt,
|
|
1588
1861
|
locale
|
|
1589
1862
|
) })
|
|
1590
|
-
] })
|
|
1863
|
+
] }),
|
|
1864
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1865
|
+
/* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: messages.model }),
|
|
1866
|
+
/* @__PURE__ */ jsx("dd", { className: "mt-0.5 truncate font-medium", children: model.modelId })
|
|
1867
|
+
] }),
|
|
1868
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1869
|
+
/* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: messages.mode }),
|
|
1870
|
+
/* @__PURE__ */ jsx("dd", { className: "mt-0.5 font-medium", children: workbenchMessages.modes[model.mode] })
|
|
1871
|
+
] }),
|
|
1872
|
+
model.permissionProfile ? /* @__PURE__ */ jsxs("div", { children: [
|
|
1873
|
+
/* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: messages.permissions }),
|
|
1874
|
+
/* @__PURE__ */ jsx("dd", { className: "mt-0.5 font-medium", children: workbenchMessages.composer.permissionOptions[model.permissionProfile] })
|
|
1875
|
+
] }) : null,
|
|
1876
|
+
tokenUsage !== void 0 ? /* @__PURE__ */ jsxs("div", { children: [
|
|
1877
|
+
/* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: messages.tokenUsage }),
|
|
1878
|
+
/* @__PURE__ */ jsx("dd", { className: "mt-0.5 font-medium", children: new Intl.NumberFormat(locale).format(tokenUsage) })
|
|
1879
|
+
] }) : null
|
|
1591
1880
|
] }),
|
|
1592
1881
|
error ? /* @__PURE__ */ jsx("div", { className: "mt-3 rounded-md border border-destructive/30 bg-destructive/5 p-2.5 text-sm text-destructive-text", role: "alert", children: error.payload.message }) : null,
|
|
1593
1882
|
retryable || canResume ? /* @__PURE__ */ jsxs("div", { className: "mt-3 flex flex-wrap gap-2", children: [
|
|
@@ -1613,6 +1902,47 @@ function SummaryPanel({
|
|
|
1613
1902
|
) : null
|
|
1614
1903
|
] }) : null
|
|
1615
1904
|
] }),
|
|
1905
|
+
/* @__PURE__ */ jsxs("section", { className: "flex flex-wrap gap-2 rounded-lg border border-border bg-card p-3 text-card-foreground", children: [
|
|
1906
|
+
canContinueInNewTask ? /* @__PURE__ */ jsxs(
|
|
1907
|
+
"button",
|
|
1908
|
+
{
|
|
1909
|
+
type: "button",
|
|
1910
|
+
className: "inline-flex items-center gap-1.5 rounded-md border border-border bg-background px-2.5 py-1.5 text-xs font-medium outline-none hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring",
|
|
1911
|
+
disabled: !onIntent,
|
|
1912
|
+
onClick: () => onIntent?.({ type: "continue-in-new-task", sessionId: model.sessionId }),
|
|
1913
|
+
children: [
|
|
1914
|
+
/* @__PURE__ */ jsx(GitFork, { className: "size-3.5", "aria-hidden": "true" }),
|
|
1915
|
+
messages.actions.continueInNewTask
|
|
1916
|
+
]
|
|
1917
|
+
}
|
|
1918
|
+
) : null,
|
|
1919
|
+
canEditAndRerun ? /* @__PURE__ */ jsxs(
|
|
1920
|
+
"button",
|
|
1921
|
+
{
|
|
1922
|
+
type: "button",
|
|
1923
|
+
className: "inline-flex items-center gap-1.5 rounded-md border border-border bg-background px-2.5 py-1.5 text-xs font-medium outline-none hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring",
|
|
1924
|
+
disabled: !onIntent,
|
|
1925
|
+
onClick: () => onIntent?.({ type: "edit-and-rerun", sessionId: model.sessionId }),
|
|
1926
|
+
children: [
|
|
1927
|
+
/* @__PURE__ */ jsx(PencilLine, { className: "size-3.5", "aria-hidden": "true" }),
|
|
1928
|
+
messages.actions.editAndRerun
|
|
1929
|
+
]
|
|
1930
|
+
}
|
|
1931
|
+
) : null,
|
|
1932
|
+
/* @__PURE__ */ jsxs(
|
|
1933
|
+
"button",
|
|
1934
|
+
{
|
|
1935
|
+
type: "button",
|
|
1936
|
+
className: "inline-flex items-center gap-1.5 rounded-md border border-border bg-background px-2.5 py-1.5 text-xs font-medium outline-none hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring",
|
|
1937
|
+
disabled: !onIntent,
|
|
1938
|
+
onClick: () => onIntent?.({ type: "export", sessionId: model.sessionId }),
|
|
1939
|
+
children: [
|
|
1940
|
+
/* @__PURE__ */ jsx(Download, { className: "size-3.5", "aria-hidden": "true" }),
|
|
1941
|
+
messages.actions.export
|
|
1942
|
+
]
|
|
1943
|
+
}
|
|
1944
|
+
)
|
|
1945
|
+
] }),
|
|
1616
1946
|
/* @__PURE__ */ jsxs("section", { className: "rounded-lg border border-border bg-card p-3 text-card-foreground", children: [
|
|
1617
1947
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
1618
1948
|
/* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: messages.summary }),
|
|
@@ -1856,6 +2186,6 @@ function AgentWorkbenchTaskDetails({
|
|
|
1856
2186
|
);
|
|
1857
2187
|
}
|
|
1858
2188
|
|
|
1859
|
-
export { AgentWorkbenchActivity, AgentWorkbenchSidebar, AgentWorkbenchTaskDetails, AgentWorkbenchTool, createAgentWorkbenchActivityModel, createAgentWorkbenchDetailsModel };
|
|
2189
|
+
export { AgentWorkbenchActivity, AgentWorkbenchComposer, AgentWorkbenchSidebar, AgentWorkbenchTaskDetails, AgentWorkbenchTool, createAgentWorkbenchActivityModel, createAgentWorkbenchDetailsModel };
|
|
1860
2190
|
//# sourceMappingURL=index.mjs.map
|
|
1861
2191
|
//# sourceMappingURL=index.mjs.map
|