@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.mjs
CHANGED
|
@@ -17379,6 +17379,9 @@ function AgentWorkbenchSidebar({ viewModel, className, classNames, onIntent }) {
|
|
|
17379
17379
|
const { locale } = useMonkeysLocale();
|
|
17380
17380
|
const messages = useMonkeysLocaleMessages().agentWorkbench.navigation;
|
|
17381
17381
|
const searchRef = useRef(null);
|
|
17382
|
+
const renameInputRef = useRef(null);
|
|
17383
|
+
const [editingSessionId, setEditingSessionId] = useState();
|
|
17384
|
+
const [editingTitle, setEditingTitle] = useState("");
|
|
17382
17385
|
const query = viewModel.searchQuery.trim().toLocaleLowerCase();
|
|
17383
17386
|
const agents = useMemo(
|
|
17384
17387
|
() => viewModel.agents.items.filter((item) => !query || `${item.name} ${item.description ?? ""}`.toLocaleLowerCase().includes(query)),
|
|
@@ -17398,6 +17401,26 @@ function AgentWorkbenchSidebar({ viewModel, className, classNames, onIntent }) {
|
|
|
17398
17401
|
window.addEventListener("keydown", handleShortcut);
|
|
17399
17402
|
return () => window.removeEventListener("keydown", handleShortcut);
|
|
17400
17403
|
}, []);
|
|
17404
|
+
useEffect(() => {
|
|
17405
|
+
if (!editingSessionId) return;
|
|
17406
|
+
renameInputRef.current?.focus();
|
|
17407
|
+
renameInputRef.current?.select();
|
|
17408
|
+
}, [editingSessionId]);
|
|
17409
|
+
const beginRenameSession = (item) => {
|
|
17410
|
+
setEditingSessionId(item.id);
|
|
17411
|
+
setEditingTitle(item.title);
|
|
17412
|
+
};
|
|
17413
|
+
const cancelRenameSession = () => {
|
|
17414
|
+
setEditingSessionId(void 0);
|
|
17415
|
+
setEditingTitle("");
|
|
17416
|
+
};
|
|
17417
|
+
const saveRenameSession = (item) => {
|
|
17418
|
+
const title = editingTitle.trim();
|
|
17419
|
+
if (title && title !== item.title) {
|
|
17420
|
+
onIntent?.({ type: "rename-session", sessionId: item.id, title });
|
|
17421
|
+
}
|
|
17422
|
+
cancelRenameSession();
|
|
17423
|
+
};
|
|
17401
17424
|
return /* @__PURE__ */ jsx("nav", { "aria-label": messages.tabsLabel, className: cn2("h-full min-h-0", classNames?.root, className), children: /* @__PURE__ */ jsxs(
|
|
17402
17425
|
Tabs,
|
|
17403
17426
|
{
|
|
@@ -17492,9 +17515,36 @@ function AgentWorkbenchSidebar({ viewModel, className, classNames, onIntent }) {
|
|
|
17492
17515
|
/* @__PURE__ */ jsx("h3", { className: "mb-2 px-3 text-xs font-medium text-muted-foreground", children: messages.recentSessions }),
|
|
17493
17516
|
/* @__PURE__ */ 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" }) }),
|
|
17494
17517
|
/* @__PURE__ */ jsx("div", { className: "space-y-1", children: sessions.map((item) => {
|
|
17495
|
-
const percent = item.contextUsage ? Math.min(100, Math.round(item.contextUsage.usedTokens / item.contextUsage.maxTokens * 100)) : void 0;
|
|
17518
|
+
const percent = item.contextUsage && item.contextUsage.maxTokens > 0 ? Math.min(100, Math.round(item.contextUsage.usedTokens / item.contextUsage.maxTokens * 100)) : void 0;
|
|
17496
17519
|
return /* @__PURE__ */ 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: [
|
|
17497
|
-
/* @__PURE__ */ jsxs("
|
|
17520
|
+
editingSessionId === item.id ? /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-3", children: [
|
|
17521
|
+
/* @__PURE__ */ jsx("span", { className: "flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted", children: /* @__PURE__ */ jsx(SessionAvatar, { item }) }),
|
|
17522
|
+
/* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
17523
|
+
/* @__PURE__ */ jsx(
|
|
17524
|
+
"input",
|
|
17525
|
+
{
|
|
17526
|
+
ref: renameInputRef,
|
|
17527
|
+
value: editingTitle,
|
|
17528
|
+
"aria-label": messages.rename,
|
|
17529
|
+
className: "h-6 w-full rounded border border-primary bg-background px-1.5 text-sm font-medium outline-none",
|
|
17530
|
+
onChange: (event) => setEditingTitle(event.target.value),
|
|
17531
|
+
onClick: (event) => event.stopPropagation(),
|
|
17532
|
+
onBlur: () => saveRenameSession(item),
|
|
17533
|
+
onKeyDown: (event) => {
|
|
17534
|
+
event.stopPropagation();
|
|
17535
|
+
if (event.key === "Enter") {
|
|
17536
|
+
event.preventDefault();
|
|
17537
|
+
saveRenameSession(item);
|
|
17538
|
+
} else if (event.key === "Escape") {
|
|
17539
|
+
event.preventDefault();
|
|
17540
|
+
cancelRenameSession();
|
|
17541
|
+
}
|
|
17542
|
+
}
|
|
17543
|
+
}
|
|
17544
|
+
),
|
|
17545
|
+
/* @__PURE__ */ jsx("span", { className: "block truncate text-xs text-foreground/80", children: new Intl.DateTimeFormat(locale, { dateStyle: "medium", timeStyle: "short" }).format(new Date(item.updatedAt)) })
|
|
17546
|
+
] })
|
|
17547
|
+
] }) : /* @__PURE__ */ 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: [
|
|
17498
17548
|
/* @__PURE__ */ jsx("span", { className: "flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted", children: /* @__PURE__ */ jsx(SessionAvatar, { item }) }),
|
|
17499
17549
|
/* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
17500
17550
|
/* @__PURE__ */ jsx("span", { className: "block truncate text-sm font-medium", children: item.title }),
|
|
@@ -17510,7 +17560,7 @@ function AgentWorkbenchSidebar({ viewModel, className, classNames, onIntent }) {
|
|
|
17510
17560
|
event.stopPropagation();
|
|
17511
17561
|
onIntent?.({ type: "toggle-session-pin", sessionId: item.id, pinned: !item.pinned });
|
|
17512
17562
|
}, children: /* @__PURE__ */ jsx(Pin, { className: cn2("size-4", item.pinned && "fill-current") }) }) : null,
|
|
17513
|
-
/* @__PURE__ */ jsx("span", { onClick: (event) => event.stopPropagation(), onKeyDown: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx(SessionActions, { item, capabilities: viewModel.capabilities, onIntent }) })
|
|
17563
|
+
/* @__PURE__ */ jsx("span", { onClick: (event) => event.stopPropagation(), onKeyDown: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx(SessionActions, { item, capabilities: viewModel.capabilities, onIntent: (intent) => intent.type === "rename-session" ? beginRenameSession(item) : onIntent?.(intent) }) })
|
|
17514
17564
|
] })
|
|
17515
17565
|
] }, item.id);
|
|
17516
17566
|
}) })
|