@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
package/dist/index.js
CHANGED
|
@@ -17414,6 +17414,9 @@ function AgentWorkbenchSidebar({ viewModel, className, classNames, onIntent }) {
|
|
|
17414
17414
|
const { locale } = useMonkeysLocale();
|
|
17415
17415
|
const messages = useMonkeysLocaleMessages().agentWorkbench.navigation;
|
|
17416
17416
|
const searchRef = React2.useRef(null);
|
|
17417
|
+
const renameInputRef = React2.useRef(null);
|
|
17418
|
+
const [editingSessionId, setEditingSessionId] = React2.useState();
|
|
17419
|
+
const [editingTitle, setEditingTitle] = React2.useState("");
|
|
17417
17420
|
const query = viewModel.searchQuery.trim().toLocaleLowerCase();
|
|
17418
17421
|
const agents = React2.useMemo(
|
|
17419
17422
|
() => viewModel.agents.items.filter((item) => !query || `${item.name} ${item.description ?? ""}`.toLocaleLowerCase().includes(query)),
|
|
@@ -17433,6 +17436,26 @@ function AgentWorkbenchSidebar({ viewModel, className, classNames, onIntent }) {
|
|
|
17433
17436
|
window.addEventListener("keydown", handleShortcut);
|
|
17434
17437
|
return () => window.removeEventListener("keydown", handleShortcut);
|
|
17435
17438
|
}, []);
|
|
17439
|
+
React2.useEffect(() => {
|
|
17440
|
+
if (!editingSessionId) return;
|
|
17441
|
+
renameInputRef.current?.focus();
|
|
17442
|
+
renameInputRef.current?.select();
|
|
17443
|
+
}, [editingSessionId]);
|
|
17444
|
+
const beginRenameSession = (item) => {
|
|
17445
|
+
setEditingSessionId(item.id);
|
|
17446
|
+
setEditingTitle(item.title);
|
|
17447
|
+
};
|
|
17448
|
+
const cancelRenameSession = () => {
|
|
17449
|
+
setEditingSessionId(void 0);
|
|
17450
|
+
setEditingTitle("");
|
|
17451
|
+
};
|
|
17452
|
+
const saveRenameSession = (item) => {
|
|
17453
|
+
const title = editingTitle.trim();
|
|
17454
|
+
if (title && title !== item.title) {
|
|
17455
|
+
onIntent?.({ type: "rename-session", sessionId: item.id, title });
|
|
17456
|
+
}
|
|
17457
|
+
cancelRenameSession();
|
|
17458
|
+
};
|
|
17436
17459
|
return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": messages.tabsLabel, className: cn2("h-full min-h-0", classNames?.root, className), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17437
17460
|
Tabs,
|
|
17438
17461
|
{
|
|
@@ -17527,9 +17550,36 @@ function AgentWorkbenchSidebar({ viewModel, className, classNames, onIntent }) {
|
|
|
17527
17550
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "mb-2 px-3 text-xs font-medium text-muted-foreground", children: messages.recentSessions }),
|
|
17528
17551
|
/* @__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" }) }),
|
|
17529
17552
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: sessions.map((item) => {
|
|
17530
|
-
const percent = item.contextUsage ? Math.min(100, Math.round(item.contextUsage.usedTokens / item.contextUsage.maxTokens * 100)) : void 0;
|
|
17553
|
+
const percent = item.contextUsage && item.contextUsage.maxTokens > 0 ? Math.min(100, Math.round(item.contextUsage.usedTokens / item.contextUsage.maxTokens * 100)) : void 0;
|
|
17531
17554
|
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: [
|
|
17532
|
-
/* @__PURE__ */ jsxRuntime.jsxs("
|
|
17555
|
+
editingSessionId === item.id ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-3", children: [
|
|
17556
|
+
/* @__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 }) }),
|
|
17557
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
17558
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17559
|
+
"input",
|
|
17560
|
+
{
|
|
17561
|
+
ref: renameInputRef,
|
|
17562
|
+
value: editingTitle,
|
|
17563
|
+
"aria-label": messages.rename,
|
|
17564
|
+
className: "h-6 w-full rounded border border-primary bg-background px-1.5 text-sm font-medium outline-none",
|
|
17565
|
+
onChange: (event) => setEditingTitle(event.target.value),
|
|
17566
|
+
onClick: (event) => event.stopPropagation(),
|
|
17567
|
+
onBlur: () => saveRenameSession(item),
|
|
17568
|
+
onKeyDown: (event) => {
|
|
17569
|
+
event.stopPropagation();
|
|
17570
|
+
if (event.key === "Enter") {
|
|
17571
|
+
event.preventDefault();
|
|
17572
|
+
saveRenameSession(item);
|
|
17573
|
+
} else if (event.key === "Escape") {
|
|
17574
|
+
event.preventDefault();
|
|
17575
|
+
cancelRenameSession();
|
|
17576
|
+
}
|
|
17577
|
+
}
|
|
17578
|
+
}
|
|
17579
|
+
),
|
|
17580
|
+
/* @__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)) })
|
|
17581
|
+
] })
|
|
17582
|
+
] }) : /* @__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: [
|
|
17533
17583
|
/* @__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 }) }),
|
|
17534
17584
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
17535
17585
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate text-sm font-medium", children: item.title }),
|
|
@@ -17545,7 +17595,7 @@ function AgentWorkbenchSidebar({ viewModel, className, classNames, onIntent }) {
|
|
|
17545
17595
|
event.stopPropagation();
|
|
17546
17596
|
onIntent?.({ type: "toggle-session-pin", sessionId: item.id, pinned: !item.pinned });
|
|
17547
17597
|
}, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pin, { className: cn2("size-4", item.pinned && "fill-current") }) }) : null,
|
|
17548
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { onClick: (event) => event.stopPropagation(), onKeyDown: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsxRuntime.jsx(SessionActions, { item, capabilities: viewModel.capabilities, onIntent }) })
|
|
17598
|
+
/* @__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) }) })
|
|
17549
17599
|
] })
|
|
17550
17600
|
] }, item.id);
|
|
17551
17601
|
}) })
|