@iloveagents/foundry-web-ui 0.29.0 → 0.30.0
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/ag-ui-runtime-provider.d.ts +8 -3
- package/dist/components/ag-ui-runtime-provider.js +76 -33
- package/dist/components/assistant-chat.d.ts +1 -15
- package/dist/components/assistant-chat.js +3 -4
- package/dist/components/chat-bubble.js +3 -4
- package/dist/components/chat-context-items.d.ts +6 -0
- package/dist/components/chat-context-items.js +25 -0
- package/dist/components/chat-context.js +10 -2
- package/dist/components/chat-empty-state.js +1 -1
- package/dist/components/chat-header.js +2 -1
- package/dist/components/composer-add-menu.d.ts +0 -19
- package/dist/components/composer-add-menu.js +2 -10
- package/dist/components/context-badges.d.ts +0 -14
- package/dist/components/context-badges.js +2 -29
- package/dist/components/context-bar.d.ts +1 -21
- package/dist/components/context-bar.js +3 -74
- package/dist/components/focus-chat-pane.js +1 -1
- package/dist/components/sidebar.js +39 -10
- package/dist/index.d.ts +4 -3
- package/dist/index.js +4 -3
- package/dist/lib/ag-ui-adapter.d.ts +3 -0
- package/dist/lib/ag-ui-adapter.js +75 -11
- package/dist/lib/chat-runs-store.d.ts +40 -0
- package/dist/lib/chat-runs-store.js +173 -0
- package/dist/lib/merge-chat-state.d.ts +3 -0
- package/dist/lib/merge-chat-state.js +21 -0
- package/dist/lib/nav-config.js +47 -20
- package/dist/lib/use-new-conversation.js +4 -8
- package/dist/workbench/chat-header.js +4 -3
- package/dist/workbench/conversation-history.d.ts +1 -1
- package/dist/workbench/conversation-history.js +75 -19
- package/dist/workbench/running-chats-menu.d.ts +3 -0
- package/dist/workbench/running-chats-menu.js +20 -0
- package/dist/workbench/use-workbench-state.d.ts +1 -2
- package/dist/workbench/use-workbench-state.js +15 -18
- package/dist/workbench/welcome-intro.js +1 -1
- package/dist/workbench/workbench-styles.js +63 -11
- package/dist/workbench/workbench.js +1 -1
- package/package.json +3 -3
|
@@ -4,22 +4,12 @@ import { useAuiState } from "@assistant-ui/react";
|
|
|
4
4
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { Button } from "@iloveagents/foundry-web-primitives";
|
|
6
6
|
import { useSidebarStore, useChatBubbleStore, useToolPanelStore, useNewConversation, useNavStore, useAppStore, } from "../index.js";
|
|
7
|
-
import {
|
|
7
|
+
import { MessagesSquare, Settings, Layers } from "lucide-react";
|
|
8
8
|
import { useChatWidth } from "./use-chat-width.js";
|
|
9
|
+
import { findNavItem } from "../lib/nav-config.js";
|
|
9
10
|
export function normalizeWorkbenchPath(path) {
|
|
10
11
|
return path === "/" ? path : path.replace(/\/+$/, "");
|
|
11
12
|
}
|
|
12
|
-
function findExactWorkbenchItem(items, pathname) {
|
|
13
|
-
const target = normalizeWorkbenchPath(pathname);
|
|
14
|
-
for (const item of items) {
|
|
15
|
-
if (normalizeWorkbenchPath(item.to) === target)
|
|
16
|
-
return item;
|
|
17
|
-
const nested = item.children && findExactWorkbenchItem(item.children, pathname);
|
|
18
|
-
if (nested)
|
|
19
|
-
return nested;
|
|
20
|
-
}
|
|
21
|
-
return undefined;
|
|
22
|
-
}
|
|
23
13
|
function useWorkbenchNavigation() {
|
|
24
14
|
const navGroups = useNavStore((s) => s.config);
|
|
25
15
|
const workspaceGroups = useMemo(() => {
|
|
@@ -33,9 +23,12 @@ function useWorkbenchNavigation() {
|
|
|
33
23
|
const space = workspaceGroups[0];
|
|
34
24
|
const root = space.items.find((item) => item.to === space.focusOn) ?? space.items[0];
|
|
35
25
|
return [
|
|
26
|
+
...navGroups
|
|
27
|
+
.filter((group) => group.meta?.showInWorkspaceNavigation)
|
|
28
|
+
.map((group) => ({ ...group, priority: 1100 })),
|
|
36
29
|
{
|
|
37
30
|
...space,
|
|
38
|
-
label: "
|
|
31
|
+
label: "All spaces",
|
|
39
32
|
icon: Layers,
|
|
40
33
|
priority: 1000,
|
|
41
34
|
items: root
|
|
@@ -56,7 +49,7 @@ function useWorkbenchNavigation() {
|
|
|
56
49
|
...navGroups
|
|
57
50
|
.filter((group) => !["recent-chats", "pinned-chats"].includes(String(group.meta?.type)))
|
|
58
51
|
.map((group) => group.meta?.type === "spaces-workspaces"
|
|
59
|
-
? { ...group, label: "
|
|
52
|
+
? { ...group, label: "All spaces", icon: Layers, createActions: undefined }
|
|
60
53
|
: group.label === "Admin"
|
|
61
54
|
? { ...group, icon: Settings }
|
|
62
55
|
: group.label === "Activity"
|
|
@@ -72,9 +65,13 @@ export function useWorkbenchState(chatRoute) {
|
|
|
72
65
|
const chatOnly = chatRoute && !panelOpen;
|
|
73
66
|
const location = useLocation();
|
|
74
67
|
const { navGroups, workspaceGroups, staticNavigationGroups } = useWorkbenchNavigation();
|
|
75
|
-
const routeItem = useMemo(() =>
|
|
76
|
-
|
|
77
|
-
|
|
68
|
+
const routeItem = useMemo(() => {
|
|
69
|
+
const item = findNavItem(navGroups, location.pathname + location.search)?.item;
|
|
70
|
+
return item &&
|
|
71
|
+
normalizeWorkbenchPath(item.to.split("?")[0]) === normalizeWorkbenchPath(location.pathname)
|
|
72
|
+
? item
|
|
73
|
+
: undefined;
|
|
74
|
+
}, [location.pathname, location.search, navGroups]);
|
|
78
75
|
const pageLabel = useAppStore((s) => s.navContext.label);
|
|
79
76
|
const entityId = routeItem?.meta?.spacesEntityId;
|
|
80
77
|
const chatWidth = useChatWidth();
|
|
@@ -108,7 +105,7 @@ export function useWorkbenchState(chatRoute) {
|
|
|
108
105
|
const openHistory = () => {
|
|
109
106
|
setHistoryOpen(true);
|
|
110
107
|
};
|
|
111
|
-
const historyShortcut = (_jsxs(Button, { variant: "ghost", size: "sm", onClick: openHistory, className: "h-9 w-fit gap-2 px-2 text-sm font-normal text-muted-foreground [@media(pointer:coarse)]:min-h-11", children: [_jsx(
|
|
108
|
+
const historyShortcut = (_jsxs(Button, { variant: "ghost", size: "sm", onClick: openHistory, className: "h-9 w-fit gap-2 px-2 text-sm font-normal text-muted-foreground [@media(pointer:coarse)]:min-h-11", children: [_jsx(MessagesSquare, { className: "size-4", "aria-hidden": true }), "Conversation history"] }));
|
|
112
109
|
const toggleNavigation = useSidebarStore((s) => s.toggleMobile);
|
|
113
110
|
useEffect(() => {
|
|
114
111
|
if (panelOpen) {
|
|
@@ -4,7 +4,7 @@ import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuIte
|
|
|
4
4
|
import { ChatHomeStartersSlot } from "../components/chat-slots.js";
|
|
5
5
|
import { Layers } from "lucide-react";
|
|
6
6
|
export function WelcomeIntro({ navGroups, historyShortcut, }) {
|
|
7
|
-
return (_jsxs("div", { className: "mb-4 text-center", children: [_jsx("h1", { className: "text-2xl font-semibold tracking-tight", children: "What would you like to get done?" }), _jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: "Find information, create or edit content, and run actions across your spaces." }), _jsx("div", { className: "mx-auto mt-4 max-w-sm text-left", children: _jsx(ChatHomeStartersSlot, { priority: 10 }) }), _jsxs("div", { className: "mt-4 flex flex-wrap items-center justify-center gap-2", children: [historyShortcut, navGroups.some((group) => group.meta?.type === "spaces-workspaces" && group.createActions?.length) && (_jsx("div", { children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", size: "sm", className: "h-
|
|
7
|
+
return (_jsxs("div", { className: "mb-4 text-center", children: [_jsx("h1", { className: "text-2xl font-semibold tracking-tight", children: "What would you like to get done?" }), _jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: "Find information, create or edit content, and run actions across your spaces." }), _jsx("div", { className: "mx-auto mt-4 max-w-sm text-left", children: _jsx(ChatHomeStartersSlot, { priority: 10 }) }), _jsxs("div", { className: "mt-4 flex flex-wrap items-center justify-center gap-2", children: [historyShortcut, navGroups.some((group) => group.meta?.type === "spaces-workspaces" && group.createActions?.length) && (_jsx("div", { children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", size: "sm", className: "h-9 gap-2 px-2 text-sm font-normal text-muted-foreground [@media(pointer:coarse)]:min-h-11", children: [_jsx(Layers, { className: "size-4", "aria-hidden": "true" }), "Create a space"] }) }), _jsx(DropdownMenuContent, { align: "center", children: navGroups
|
|
8
8
|
.filter((group) => group.meta?.type === "spaces-workspaces")
|
|
9
9
|
.flatMap((group) => group.createActions ?? [])
|
|
10
10
|
.map((action) => (_jsx(DropdownMenuItem, { onSelect: () => action.handler(), children: action.label }, action.id))) })] }) }))] })] }));
|
|
@@ -231,10 +231,10 @@ export function WorkbenchStyles() {
|
|
|
231
231
|
}
|
|
232
232
|
.workbench-preview [data-conversation-row],
|
|
233
233
|
.workbench-preview [data-sidebar-surface]:not([data-sidebar-collapsed]) [data-nav-depth] {
|
|
234
|
-
min-height:
|
|
235
|
-
padding-top:
|
|
236
|
-
padding-bottom:
|
|
237
|
-
gap:
|
|
234
|
+
min-height: 32px;
|
|
235
|
+
padding-top: 4px;
|
|
236
|
+
padding-bottom: 4px;
|
|
237
|
+
gap: 8px;
|
|
238
238
|
border-radius: 8px;
|
|
239
239
|
}
|
|
240
240
|
.workbench-preview:not([data-workspace-navigation]) [data-sidebar-surface]:not([data-sidebar-collapsed]) [data-nav-depth="0"] {
|
|
@@ -252,18 +252,17 @@ export function WorkbenchStyles() {
|
|
|
252
252
|
}
|
|
253
253
|
.workbench-preview:not([data-workspace-navigation]) [data-sidebar-surface]:not([data-sidebar-collapsed]) div[data-nav-depth="0"] > button:not([data-nav-twisty]) {
|
|
254
254
|
padding-left: 12px;
|
|
255
|
-
min-height:
|
|
256
|
-
gap:
|
|
255
|
+
min-height: 32px;
|
|
256
|
+
gap: 8px;
|
|
257
257
|
}
|
|
258
|
-
[data-workspace-navigation] [data-nav-group-label="Spaces"] > :first-child,
|
|
259
258
|
.workbench-preview [data-sidebar-surface] nav > [data-nav-group-label]:first-child > div:has(> [data-nav-group-header]) {
|
|
260
259
|
padding-top: 0;
|
|
261
260
|
}
|
|
262
|
-
[data-workspace-navigation] [data-nav-group-label="
|
|
263
|
-
font-size:
|
|
261
|
+
[data-workspace-navigation] [data-nav-group-label="All spaces"] [data-nav-depth="0"] > button {
|
|
262
|
+
font-size: 14px;
|
|
264
263
|
font-weight: 600;
|
|
265
|
-
letter-spacing:
|
|
266
|
-
line-height:
|
|
264
|
+
letter-spacing: normal;
|
|
265
|
+
line-height: 20px;
|
|
267
266
|
}
|
|
268
267
|
[data-workspace-navigation] [data-nav-group-label="Recent chats"] > :first-child {
|
|
269
268
|
padding-top: 10px;
|
|
@@ -271,6 +270,38 @@ export function WorkbenchStyles() {
|
|
|
271
270
|
[data-workspace-navigation] [data-nav-group-label="Content"] {
|
|
272
271
|
margin-top: 0;
|
|
273
272
|
}
|
|
273
|
+
.workbench-preview [data-nav-group-label="All spaces"] > div:has(> [data-nav-group-header]) {
|
|
274
|
+
padding-top: 8px;
|
|
275
|
+
}
|
|
276
|
+
.workbench-preview [data-nav-group-label="All spaces"] [data-nav-group-header] {
|
|
277
|
+
height: 32px;
|
|
278
|
+
min-height: 32px;
|
|
279
|
+
padding-top: 0;
|
|
280
|
+
padding-bottom: 0;
|
|
281
|
+
}
|
|
282
|
+
.workbench-preview [data-nav-group-label="All spaces"] [data-nav-group-items] {
|
|
283
|
+
animation: none;
|
|
284
|
+
}
|
|
285
|
+
/* The first utility row shares the heading line in both scopes. */
|
|
286
|
+
.workbench-preview [data-sidebar-surface]:not([data-sidebar-collapsed]) nav:has(> [data-nav-group-label="Activity"]:first-child) {
|
|
287
|
+
padding-top: 8px;
|
|
288
|
+
}
|
|
289
|
+
.workbench-preview [data-sidebar-surface]:not([data-sidebar-collapsed]) [data-nav-group-label="Activity"] [data-nav-depth="0"] {
|
|
290
|
+
padding-left: 12px;
|
|
291
|
+
}
|
|
292
|
+
.workbench-preview [data-nav-group-label="Activity"] [data-nav-twisty-cell]:not(:has([data-nav-twisty])) {
|
|
293
|
+
display: none;
|
|
294
|
+
}
|
|
295
|
+
.workbench-preview[data-workspace-navigation]:not(:has([data-page-title-row])) [data-chat-empty-state] {
|
|
296
|
+
padding-top: 28px;
|
|
297
|
+
}
|
|
298
|
+
.workbench-preview[data-workspace-navigation] [data-preview-entity-header] > [data-entity-header-row] {
|
|
299
|
+
padding-top: 24px;
|
|
300
|
+
min-height: 76px;
|
|
301
|
+
}
|
|
302
|
+
.workbench-preview[data-workspace-navigation] [data-entity-header-identity]:not(:has([aria-label="Page location"])) {
|
|
303
|
+
padding-top: 18px;
|
|
304
|
+
}
|
|
274
305
|
|
|
275
306
|
[data-workspace-navigation] [data-sidebar-surface]:not([data-sidebar-collapsed]) [data-nav-group-label="Content"] button[data-nav-depth],
|
|
276
307
|
[data-workspace-navigation] [data-sidebar-surface]:not([data-sidebar-collapsed]) [data-nav-group-label="Content"] div[data-nav-depth] > button:not([data-nav-twisty]) {
|
|
@@ -280,11 +311,32 @@ export function WorkbenchStyles() {
|
|
|
280
311
|
left: calc(12px + var(--nav-depth, 0) * 16px);
|
|
281
312
|
}
|
|
282
313
|
|
|
314
|
+
@media (pointer: fine) {
|
|
315
|
+
.workbench-preview [data-sidebar-surface]:not([data-sidebar-collapsed]) [data-nav-depth] {
|
|
316
|
+
height: 32px;
|
|
317
|
+
min-height: 32px;
|
|
318
|
+
padding-top: 0;
|
|
319
|
+
padding-bottom: 0;
|
|
320
|
+
}
|
|
321
|
+
.workbench-preview [data-sidebar-surface]:not([data-sidebar-collapsed]) div[data-nav-depth] > button:not([data-nav-twisty]) {
|
|
322
|
+
height: 30px;
|
|
323
|
+
min-height: 30px;
|
|
324
|
+
padding-top: 0;
|
|
325
|
+
padding-bottom: 0;
|
|
326
|
+
}
|
|
327
|
+
.workbench-preview:not([data-workspace-navigation]) [data-sidebar-surface]:not([data-sidebar-collapsed]) div[data-nav-depth="0"] > button:not([data-nav-twisty]) {
|
|
328
|
+
min-height: 30px;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
283
332
|
@media (pointer: coarse) {
|
|
284
333
|
.workbench-preview [data-conversation-row],
|
|
285
334
|
.workbench-preview [data-sidebar-surface]:not([data-sidebar-collapsed]) [data-nav-depth] {
|
|
286
335
|
min-height: 44px;
|
|
287
336
|
}
|
|
337
|
+
.workbench-preview [data-sidebar-surface]:not([data-sidebar-collapsed]) div[data-nav-depth] > button:not([data-nav-twisty]) {
|
|
338
|
+
min-height: 44px;
|
|
339
|
+
}
|
|
288
340
|
}
|
|
289
341
|
` }));
|
|
290
342
|
}
|
|
@@ -39,5 +39,5 @@ export function WorkbenchPreview({ page, chatOnly: chatRoute = false, }) {
|
|
|
39
39
|
}, children: [_jsx(WorkbenchChatHeader, { collapsed: collapsed, running: running, chatWidth: chatWidth, buttonClass: buttonClass, toggleNavigation: toggleNavigation, setCollapsed: setCollapsed, showHistory: showHistory, startChat: startChat, returnToChat: returnToChat, openHistory: openHistory, chatOnly: chatOnly, setContentCollapsed: setContentCollapsed }), !collapsed && showHistory && (_jsx(ConversationHistory, { groups: navGroups, workspaceId: workspaceId, onClose: returnToChat, showBack: true })), !chatWidth.compact && !collapsed && !contentCollapsed && (_jsx(ChatResizeHandle, { chatWidth: chatWidth })), _jsx("div", { className: "min-h-0 flex-1 flex-col", style: {
|
|
40
40
|
display: collapsed || showHistory ? "none" : "flex",
|
|
41
41
|
paddingBottom: spaciousChat && emptyChat && !historyOpen ? "clamp(32px, 10vh, 96px)" : undefined,
|
|
42
|
-
}, children: _jsx(ChatContent, { centerComposer: spaciousChat && emptyChat && !historyOpen, composerIntro: spaciousChat && emptyChat ? (_jsx(WelcomeIntro, { navGroups: navGroups, historyShortcut: emptyChatFooter })) : undefined, compactComposer: !spaciousChat,
|
|
42
|
+
}, children: _jsx(ChatContent, { centerComposer: spaciousChat && emptyChat && !historyOpen, composerIntro: spaciousChat && emptyChat ? (_jsx(WelcomeIntro, { navGroups: navGroups, historyShortcut: emptyChatFooter })) : undefined, compactComposer: !spaciousChat, starterSuggestions: [], emptyState: _jsx(ChatEmptyState, { pageLabel: pageLabel, showHomeStarters: !spaciousChat, children: emptyChatFooter }) }) })] }), _jsx(WorkbenchContentPane, { contentHidden: contentHidden, panelOpen: panelOpen, chatWidth: chatWidth, contentCollapsed: contentCollapsed, collapsed: collapsed, buttonClass: buttonClass, setCollapsed: setCollapsed, setContentCollapsed: setContentCollapsed, closePanel: closePanel, page: page }), contentCollapsed && !chatOnly && !chatWidth.compact && (_jsx("aside", { "aria-label": "Collapsed content", className: "flex w-11 shrink-0 flex-col items-center", style: { width: 44 }, children: _jsx("div", { className: "flex h-full w-full flex-col items-center", "data-chat-rail": true, children: _jsx("div", { className: "flex items-center justify-center", style: { height: 60 }, children: _jsx(TooltipIconButton, { tooltip: "Expand content", className: buttonClass, "aria-label": "Expand content", onClick: () => setContentCollapsed(false), children: _jsx(FileText, { size: 18 }) }) }) }) }))] })] })] }));
|
|
43
43
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iloveagents/foundry-web-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React agent UI core for Foundry UI — chat, composer, AG-UI adapter for assistant-ui, tool cards, panels, sidebar, theme runtime, and UI stores.",
|
|
6
6
|
"keywords": [
|
|
@@ -80,8 +80,8 @@
|
|
|
80
80
|
"recharts": "^3.10.1",
|
|
81
81
|
"remark-gfm": "^4.0.0",
|
|
82
82
|
"tailwind-merge": "^3.5.0",
|
|
83
|
-
"@iloveagents/foundry-agent": "^0.
|
|
84
|
-
"@iloveagents/foundry-web-primitives": "^0.
|
|
83
|
+
"@iloveagents/foundry-agent": "^0.30.0",
|
|
84
|
+
"@iloveagents/foundry-web-primitives": "^0.30.0"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@ag-ui/client": "^0.0.52",
|