@inf-monkeys-tech/monkeys-design 1.0.12 → 1.0.13
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.js +53 -3
- package/dist/components/agent-workbench/index.js.map +1 -1
- package/dist/components/agent-workbench/index.mjs +54 -4
- package/dist/components/agent-workbench/index.mjs.map +1 -1
- package/dist/index.js +53 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -730,6 +730,9 @@ function AgentWorkbenchSidebar({ viewModel, className, classNames, onIntent }) {
|
|
|
730
730
|
const { locale } = useMonkeysLocale();
|
|
731
731
|
const messages = useMonkeysLocaleMessages().agentWorkbench.navigation;
|
|
732
732
|
const searchRef = React2.useRef(null);
|
|
733
|
+
const renameInputRef = React2.useRef(null);
|
|
734
|
+
const [editingSessionId, setEditingSessionId] = React2.useState();
|
|
735
|
+
const [editingTitle, setEditingTitle] = React2.useState("");
|
|
733
736
|
const query = viewModel.searchQuery.trim().toLocaleLowerCase();
|
|
734
737
|
const agents = React2.useMemo(
|
|
735
738
|
() => viewModel.agents.items.filter((item) => !query || `${item.name} ${item.description ?? ""}`.toLocaleLowerCase().includes(query)),
|
|
@@ -749,6 +752,26 @@ function AgentWorkbenchSidebar({ viewModel, className, classNames, onIntent }) {
|
|
|
749
752
|
window.addEventListener("keydown", handleShortcut);
|
|
750
753
|
return () => window.removeEventListener("keydown", handleShortcut);
|
|
751
754
|
}, []);
|
|
755
|
+
React2.useEffect(() => {
|
|
756
|
+
if (!editingSessionId) return;
|
|
757
|
+
renameInputRef.current?.focus();
|
|
758
|
+
renameInputRef.current?.select();
|
|
759
|
+
}, [editingSessionId]);
|
|
760
|
+
const beginRenameSession = (item) => {
|
|
761
|
+
setEditingSessionId(item.id);
|
|
762
|
+
setEditingTitle(item.title);
|
|
763
|
+
};
|
|
764
|
+
const cancelRenameSession = () => {
|
|
765
|
+
setEditingSessionId(void 0);
|
|
766
|
+
setEditingTitle("");
|
|
767
|
+
};
|
|
768
|
+
const saveRenameSession = (item) => {
|
|
769
|
+
const title = editingTitle.trim();
|
|
770
|
+
if (title && title !== item.title) {
|
|
771
|
+
onIntent?.({ type: "rename-session", sessionId: item.id, title });
|
|
772
|
+
}
|
|
773
|
+
cancelRenameSession();
|
|
774
|
+
};
|
|
752
775
|
return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": messages.tabsLabel, className: cn2("h-full min-h-0", classNames?.root, className), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
753
776
|
Tabs,
|
|
754
777
|
{
|
|
@@ -843,9 +866,36 @@ function AgentWorkbenchSidebar({ viewModel, className, classNames, onIntent }) {
|
|
|
843
866
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "mb-2 px-3 text-xs font-medium text-muted-foreground", children: messages.recentSessions }),
|
|
844
867
|
/* @__PURE__ */ jsxRuntime.jsx(CollectionState, { status: viewModel.sessions.status, empty: messages.emptySessions, noResults: messages.noResults, hasItems: sessions.length > 0, query, error: viewModel.sessions.error, onRetry: () => onIntent?.({ type: "retry-sessions" }) }),
|
|
845
868
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: sessions.map((item) => {
|
|
846
|
-
const percent = item.contextUsage ? Math.min(100, Math.round(item.contextUsage.usedTokens / item.contextUsage.maxTokens * 100)) : void 0;
|
|
869
|
+
const percent = item.contextUsage && item.contextUsage.maxTokens > 0 ? Math.min(100, Math.round(item.contextUsage.usedTokens / item.contextUsage.maxTokens * 100)) : void 0;
|
|
847
870
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "aria-current": item.id === viewModel.selectedSessionItem ? "page" : void 0, className: cn2("group flex w-full items-center gap-3 rounded-lg border border-transparent px-3 py-2 text-left hover:bg-muted aria-[current=page]:border-primary aria-[current=page]:bg-muted", classNames?.item), children: [
|
|
848
|
-
/* @__PURE__ */ jsxRuntime.jsxs("
|
|
871
|
+
editingSessionId === item.id ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-3", children: [
|
|
872
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted", children: /* @__PURE__ */ jsxRuntime.jsx(SessionAvatar, { item }) }),
|
|
873
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
874
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
875
|
+
"input",
|
|
876
|
+
{
|
|
877
|
+
ref: renameInputRef,
|
|
878
|
+
value: editingTitle,
|
|
879
|
+
"aria-label": messages.rename,
|
|
880
|
+
className: "h-6 w-full rounded border border-primary bg-background px-1.5 text-sm font-medium outline-none",
|
|
881
|
+
onChange: (event) => setEditingTitle(event.target.value),
|
|
882
|
+
onClick: (event) => event.stopPropagation(),
|
|
883
|
+
onBlur: () => saveRenameSession(item),
|
|
884
|
+
onKeyDown: (event) => {
|
|
885
|
+
event.stopPropagation();
|
|
886
|
+
if (event.key === "Enter") {
|
|
887
|
+
event.preventDefault();
|
|
888
|
+
saveRenameSession(item);
|
|
889
|
+
} else if (event.key === "Escape") {
|
|
890
|
+
event.preventDefault();
|
|
891
|
+
cancelRenameSession();
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
),
|
|
896
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate text-xs text-foreground/80", children: new Intl.DateTimeFormat(locale, { dateStyle: "medium", timeStyle: "short" }).format(new Date(item.updatedAt)) })
|
|
897
|
+
] })
|
|
898
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "flex min-w-0 flex-1 items-center gap-3 text-left", onClick: () => onIntent?.({ type: "select-session", sessionId: item.id }), children: [
|
|
849
899
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted", children: /* @__PURE__ */ jsxRuntime.jsx(SessionAvatar, { item }) }),
|
|
850
900
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
851
901
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate text-sm font-medium", children: item.title }),
|
|
@@ -861,7 +911,7 @@ function AgentWorkbenchSidebar({ viewModel, className, classNames, onIntent }) {
|
|
|
861
911
|
event.stopPropagation();
|
|
862
912
|
onIntent?.({ type: "toggle-session-pin", sessionId: item.id, pinned: !item.pinned });
|
|
863
913
|
}, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pin, { className: cn2("size-4", item.pinned && "fill-current") }) }) : null,
|
|
864
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { onClick: (event) => event.stopPropagation(), onKeyDown: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsxRuntime.jsx(SessionActions, { item, capabilities: viewModel.capabilities, onIntent }) })
|
|
914
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { onClick: (event) => event.stopPropagation(), onKeyDown: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsxRuntime.jsx(SessionActions, { item, capabilities: viewModel.capabilities, onIntent: (intent) => intent.type === "rename-session" ? beginRenameSession(item) : onIntent?.(intent) }) })
|
|
865
915
|
] })
|
|
866
916
|
] }, item.id);
|
|
867
917
|
}) })
|