@agent-native/dispatch 0.12.1 → 0.12.3
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/dispatch-shell.d.ts.map +1 -1
- package/dist/components/dispatch-shell.js +3 -1
- package/dist/components/dispatch-shell.js.map +1 -1
- package/dist/components/layout/Layout.d.ts.map +1 -1
- package/dist/components/layout/Layout.js +39 -20
- package/dist/components/layout/Layout.js.map +1 -1
- package/dist/routes/pages/$appId.d.ts.map +1 -1
- package/dist/routes/pages/$appId.js +3 -2
- package/dist/routes/pages/$appId.js.map +1 -1
- package/dist/routes/pages/agents.d.ts.map +1 -1
- package/dist/routes/pages/agents.js +14 -8
- package/dist/routes/pages/agents.js.map +1 -1
- package/dist/routes/pages/apps.$appId.d.ts.map +1 -1
- package/dist/routes/pages/apps.$appId.js +3 -2
- package/dist/routes/pages/apps.$appId.js.map +1 -1
- package/dist/routes/pages/apps.d.ts.map +1 -1
- package/dist/routes/pages/apps.js +29 -11
- package/dist/routes/pages/apps.js.map +1 -1
- package/dist/routes/pages/destinations.d.ts.map +1 -1
- package/dist/routes/pages/destinations.js +18 -12
- package/dist/routes/pages/destinations.js.map +1 -1
- package/dist/routes/pages/metrics.d.ts.map +1 -1
- package/dist/routes/pages/metrics.js +8 -5
- package/dist/routes/pages/metrics.js.map +1 -1
- package/dist/routes/pages/new-app.d.ts.map +1 -1
- package/dist/routes/pages/new-app.js +3 -2
- package/dist/routes/pages/new-app.js.map +1 -1
- package/package.json +2 -2
- package/src/components/dispatch-shell.tsx +3 -1
- package/src/components/layout/Layout.tsx +63 -28
- package/src/routes/pages/$appId.tsx +15 -12
- package/src/routes/pages/agents.tsx +21 -14
- package/src/routes/pages/apps.$appId.tsx +15 -14
- package/src/routes/pages/apps.tsx +41 -20
- package/src/routes/pages/destinations.tsx +35 -24
- package/src/routes/pages/metrics.tsx +13 -10
- package/src/routes/pages/new-app.tsx +4 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch-shell.d.ts","sourceRoot":"","sources":["../../src/components/dispatch-shell.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"dispatch-shell.d.ts","sourceRoot":"","sources":["../../src/components/dispatch-shell.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAUvC;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,WAAW,EACX,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,SAAS,CAAC;CACrB,2CA+BA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Popover, PopoverContent, PopoverTrigger, } from "../components/ui/popover.js";
|
|
3
|
+
import { useT } from "@agent-native/core/client";
|
|
3
4
|
import { IconInfoCircle } from "@tabler/icons-react";
|
|
4
5
|
import { useSetPageTitle } from "../components/layout/HeaderActions.js";
|
|
5
6
|
/**
|
|
@@ -9,7 +10,8 @@ import { useSetPageTitle } from "../components/layout/HeaderActions.js";
|
|
|
9
10
|
* is provided by `Layout` mounted in `root.tsx`.
|
|
10
11
|
*/
|
|
11
12
|
export function DispatchShell({ title, description, children, }) {
|
|
12
|
-
|
|
13
|
+
const t = useT();
|
|
14
|
+
useSetPageTitle(_jsxs("div", { className: "flex items-center gap-2 min-w-0", children: [_jsx("h1", { className: "text-lg font-semibold tracking-tight truncate text-foreground", children: title }), description ? (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx("button", { type: "button", className: "inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground/70 hover:bg-accent hover:text-foreground cursor-pointer", "aria-label": t("dispatch.sidebar.aboutPage", { title }), children: _jsx(IconInfoCircle, { className: "h-3.5 w-3.5" }) }) }), _jsx(PopoverContent, { side: "bottom", align: "start", className: "max-w-72 text-xs leading-relaxed", children: description })] })) : null] }));
|
|
13
15
|
return _jsx(_Fragment, { children: children });
|
|
14
16
|
}
|
|
15
17
|
//# sourceMappingURL=dispatch-shell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch-shell.js","sourceRoot":"","sources":["../../src/components/dispatch-shell.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,GACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,KAAK,EACL,WAAW,EACX,QAAQ,GAKT;IACC,eAAe,CACb,eAAK,SAAS,EAAC,iCAAiC,aAC9C,aAAI,SAAS,EAAC,+DAA+D,YAC1E,KAAK,GACH,EACJ,WAAW,CAAC,CAAC,CAAC,CACb,MAAC,OAAO,eACN,KAAC,cAAc,IAAC,OAAO,kBACrB,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,0IAA0I,gBACxI,
|
|
1
|
+
{"version":3,"file":"dispatch-shell.js","sourceRoot":"","sources":["../../src/components/dispatch-shell.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,GACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,KAAK,EACL,WAAW,EACX,QAAQ,GAKT;IACC,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC;IACjB,eAAe,CACb,eAAK,SAAS,EAAC,iCAAiC,aAC9C,aAAI,SAAS,EAAC,+DAA+D,YAC1E,KAAK,GACH,EACJ,WAAW,CAAC,CAAC,CAAC,CACb,MAAC,OAAO,eACN,KAAC,cAAc,IAAC,OAAO,kBACrB,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,0IAA0I,gBACxI,CAAC,CAAC,4BAA4B,EAAE,EAAE,KAAK,EAAE,CAAC,YAEtD,KAAC,cAAc,IAAC,SAAS,EAAC,aAAa,GAAG,GACnC,GACM,EACjB,KAAC,cAAc,IACb,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,OAAO,EACb,SAAS,EAAC,kCAAkC,YAE3C,WAAW,GACG,IACT,CACX,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;IAEF,OAAO,4BAAG,QAAQ,GAAI,CAAC;AACzB,CAAC","sourcesContent":["import { type ReactNode } from \"react\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@/components/ui/popover\";\nimport { useT } from \"@agent-native/core/client\";\nimport { IconInfoCircle } from \"@tabler/icons-react\";\nimport { useSetPageTitle } from \"@/components/layout/HeaderActions\";\n\n/**\n * DispatchShell renders the per-page title (with an optional click-to-open\n * description popover) into the global header via the HeaderActions store.\n * The actual chrome (sidebar, AgentSidebar, header bar with AgentToggleButton)\n * is provided by `Layout` mounted in `root.tsx`.\n */\nexport function DispatchShell({\n title,\n description,\n children,\n}: {\n title: string;\n description?: string;\n children: ReactNode;\n}) {\n const t = useT();\n useSetPageTitle(\n <div className=\"flex items-center gap-2 min-w-0\">\n <h1 className=\"text-lg font-semibold tracking-tight truncate text-foreground\">\n {title}\n </h1>\n {description ? (\n <Popover>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n className=\"inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground/70 hover:bg-accent hover:text-foreground cursor-pointer\"\n aria-label={t(\"dispatch.sidebar.aboutPage\", { title })}\n >\n <IconInfoCircle className=\"h-3.5 w-3.5\" />\n </button>\n </PopoverTrigger>\n <PopoverContent\n side=\"bottom\"\n align=\"start\"\n className=\"max-w-72 text-xs leading-relaxed\"\n >\n {description}\n </PopoverContent>\n </Popover>\n ) : null}\n </div>,\n );\n\n return <>{children}</>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,aAAa,EAElB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,aAAa,EAElB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAgEf,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,YAAY,CAAC;AAE1D,MAAM,MAAM,eAAe,GAAG,aAAa,CAAC;IAC1C,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC,CAAC;AAEH,MAAM,WAAW,eAAe;IAC9B,uEAAuE;IACvE,EAAE,EAAE,MAAM,CAAC;IACX,iFAAiF;IACjF,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,mFAAmF;IACnF,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,gEAAgE;IAChE,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;CACvC;AAED,MAAM,WAAW,uBAAuB;IACtC,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IACtC,kFAAkF;IAClF,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/B;AAieD,wBAAgB,UAAU,CAAC,EACzB,UAAU,EACV,UAAU,GACX,EAAE;IACD,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,UAAU,CAAC,EAAE,uBAAuB,CAAC;CACtC,2CA0JA;AAED,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,UAAU,GACX,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,uBAAuB,CAAC;CACtC,2CAyGA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useMemo, useRef, useState, } from "react";
|
|
3
3
|
import { NavLink, useLocation, useNavigate } from "react-router";
|
|
4
|
-
import { AgentSidebar, FeedbackButton, appBasePath, appPath, focusAgentChat, navigateWithAgentChatViewTransition, useActionQuery, useAgentChatHomeHandoff, useAgentChatHomeHandoffLinks, useChatThreads, } from "@agent-native/core/client";
|
|
4
|
+
import { AgentSidebar, FeedbackButton, appBasePath, appPath, focusAgentChat, navigateWithAgentChatViewTransition, useActionQuery, useAgentChatHomeHandoff, useAgentChatHomeHandoffLinks, useChatThreads, useFormatters, useT, } from "@agent-native/core/client";
|
|
5
5
|
import { ExtensionsSidebarSection } from "@agent-native/core/client/extensions";
|
|
6
6
|
import { InvitationBanner, OrgSwitcher } from "@agent-native/core/client/org";
|
|
7
7
|
import { IconArrowUpRight, IconApps, IconBrain, IconChartBar, IconBrandTelegram, IconKey, IconChevronDown, IconDots, IconEdit, IconLayersSubtract, IconMessageQuestion, IconMessages, IconPlus, IconPlugConnected, IconBroadcast, IconFingerprint, IconHistory, IconPuzzle, IconSettings, IconShieldCheck, IconUsersGroup, } from "@tabler/icons-react";
|
|
@@ -136,11 +136,6 @@ const OPERATIONS_NAV_ITEMS = [
|
|
|
136
136
|
},
|
|
137
137
|
];
|
|
138
138
|
const EMPTY_NAV_ITEMS = [];
|
|
139
|
-
const SIDEBAR_SUGGESTIONS = [
|
|
140
|
-
"Build a workspace app for X",
|
|
141
|
-
"Route Slack mentions to my analytics app",
|
|
142
|
-
"Grant my OpenAI key to this app",
|
|
143
|
-
];
|
|
144
139
|
const CHROMELESS_PATHS = ["/approval"];
|
|
145
140
|
// Routes whose page renders its own toolbar (with NotificationsBell + AgentToggleButton).
|
|
146
141
|
// Layout still mounts the sidebar + AgentSidebar, but skips its own Header so
|
|
@@ -212,7 +207,7 @@ function threadIdFromPath(pathname) {
|
|
|
212
207
|
return null;
|
|
213
208
|
}
|
|
214
209
|
}
|
|
215
|
-
function formatThreadAge(updatedAt) {
|
|
210
|
+
function formatThreadAge(updatedAt, formatDate) {
|
|
216
211
|
const diffMs = Math.max(0, Date.now() - updatedAt);
|
|
217
212
|
const minutes = Math.floor(diffMs / 60_000);
|
|
218
213
|
if (minutes < 1)
|
|
@@ -225,13 +220,13 @@ function formatThreadAge(updatedAt) {
|
|
|
225
220
|
const days = Math.floor(hours / 24);
|
|
226
221
|
if (days < 7)
|
|
227
222
|
return `${days}d`;
|
|
228
|
-
return
|
|
223
|
+
return formatDate(updatedAt, {
|
|
229
224
|
month: "short",
|
|
230
225
|
day: "numeric",
|
|
231
226
|
});
|
|
232
227
|
}
|
|
233
|
-
function threadTitle(thread) {
|
|
234
|
-
return thread.title || thread.preview ||
|
|
228
|
+
function threadTitle(thread, fallback) {
|
|
229
|
+
return thread.title || thread.preview || fallback;
|
|
235
230
|
}
|
|
236
231
|
function threadUpdatedAt(thread) {
|
|
237
232
|
return Number.isFinite(thread.updatedAt)
|
|
@@ -241,6 +236,8 @@ function threadUpdatedAt(thread) {
|
|
|
241
236
|
: 0;
|
|
242
237
|
}
|
|
243
238
|
function DispatchChatsSection({ onNavigate }) {
|
|
239
|
+
const t = useT();
|
|
240
|
+
const { formatDate } = useFormatters();
|
|
244
241
|
const navigate = useNavigate();
|
|
245
242
|
const location = useLocation();
|
|
246
243
|
const { threads, activeThreadId, createThread, switchThread, renameThread, refreshThreads, } = useChatThreads(undefined, "dispatch", undefined, { autoCreate: false });
|
|
@@ -293,7 +290,7 @@ function DispatchChatsSection({ onNavigate }) {
|
|
|
293
290
|
}
|
|
294
291
|
function startRenameThread(thread) {
|
|
295
292
|
committingRenameRef.current = false;
|
|
296
|
-
setRenameDraft(threadTitle(thread));
|
|
293
|
+
setRenameDraft(threadTitle(thread, t("dispatch.sidebar.newChat")));
|
|
297
294
|
setRenamingThreadId(thread.id);
|
|
298
295
|
}
|
|
299
296
|
function cancelRenameThread() {
|
|
@@ -319,7 +316,7 @@ function DispatchChatsSection({ onNavigate }) {
|
|
|
319
316
|
event.preventDefault();
|
|
320
317
|
void commitRenameThread();
|
|
321
318
|
}
|
|
322
|
-
return (_jsxs("div", { className: "mt-2 border-s border-sidebar-border/70 ps-3", children: [_jsxs("div", { className: "mb-1 flex h-7 items-center gap-2 pe-1", children: [_jsx("div", { className: "min-w-0 flex-1 text-xs font-medium text-sidebar-foreground/70", children: "
|
|
319
|
+
return (_jsxs("div", { className: "mt-2 border-s border-sidebar-border/70 ps-3", children: [_jsxs("div", { className: "mb-1 flex h-7 items-center gap-2 pe-1", children: [_jsx("div", { className: "min-w-0 flex-1 text-xs font-medium text-sidebar-foreground/70", children: t("dispatch.sidebar.chats") }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { type: "button", onClick: handleNewChat, className: "flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md text-sidebar-foreground/65 transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground", "aria-label": t("dispatch.sidebar.newDispatchChat"), children: _jsx(IconPlus, { className: "size-3.5" }) }) }), _jsx(TooltipContent, { children: t("dispatch.sidebar.newChat") })] })] }), _jsx("div", { className: "grid gap-0.5", children: visibleThreads.length > 0 ? (visibleThreads.map((thread) => {
|
|
323
320
|
const localPathname = localDispatchPath(location.pathname);
|
|
324
321
|
const isActive = thread.id ===
|
|
325
322
|
(threadIdFromPath(localPathname) ??
|
|
@@ -332,12 +329,17 @@ function DispatchChatsSection({ onNavigate }) {
|
|
|
332
329
|
event.preventDefault();
|
|
333
330
|
cancelRenameThread();
|
|
334
331
|
}
|
|
335
|
-
}, maxLength: 160, "aria-label":
|
|
332
|
+
}, maxLength: 160, "aria-label": t("dispatch.sidebar.renameThread", {
|
|
333
|
+
title: threadTitle(thread, t("dispatch.sidebar.newChat")),
|
|
334
|
+
}), className: "h-6 min-w-0 rounded-sm border-sidebar-border bg-background px-1.5 text-xs" }) })) : (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", onClick: () => openThread(thread.id), className: "flex h-full min-w-0 flex-1 cursor-pointer items-center px-2 text-start outline-none focus-visible:ring-2 focus-visible:ring-ring", children: _jsx("span", { className: "min-w-0 flex-1 truncate", children: threadTitle(thread, t("dispatch.sidebar.newChat")) }) }), _jsxs("div", { className: "relative flex size-7 shrink-0 items-center justify-end pe-1", children: [_jsx("span", { className: "text-[11px] text-sidebar-foreground/50 transition-opacity group-hover:opacity-0 group-focus-within:opacity-0", children: isActive
|
|
336
335
|
? ""
|
|
337
|
-
: formatThreadAge(threadUpdatedAt(thread)) }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx("button", { type: "button", "aria-label":
|
|
338
|
-
|
|
336
|
+
: formatThreadAge(threadUpdatedAt(thread), formatDate) }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx("button", { type: "button", "aria-label": t("dispatch.sidebar.chatOptions", {
|
|
337
|
+
title: threadTitle(thread, t("dispatch.sidebar.newChat")),
|
|
338
|
+
}), className: "absolute end-1 flex size-6 cursor-pointer items-center justify-center rounded-md text-sidebar-foreground/65 opacity-0 transition-opacity hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover:opacity-100 group-focus-within:opacity-100 data-[state=open]:opacity-100", children: _jsx(IconDots, { className: "size-4" }) }) }), _jsx(DropdownMenuContent, { align: "end", side: "right", sideOffset: 6, children: _jsxs(DropdownMenuItem, { onSelect: () => startRenameThread(thread), children: [_jsx(IconEdit, { className: "size-4" }), t("dispatch.sidebar.renameChat")] }) })] })] })] })) }, thread.id));
|
|
339
|
+
})) : (_jsx("button", { type: "button", onClick: handleNewChat, className: "flex h-8 cursor-pointer items-center rounded-md px-2 text-start text-sm text-sidebar-foreground/70 transition-colors hover:bg-sidebar-accent/65 hover:text-sidebar-accent-foreground", children: _jsx("span", { className: "truncate", children: t("dispatch.sidebar.newChat") }) })) })] }));
|
|
339
340
|
}
|
|
340
341
|
export function NavContent({ onNavigate, extensions, }) {
|
|
342
|
+
const t = useT();
|
|
341
343
|
const location = useLocation();
|
|
342
344
|
const navigate = useNavigate();
|
|
343
345
|
const { data: workspace } = useActionQuery("get-workspace-info", {}, { staleTime: 60_000 });
|
|
@@ -354,9 +356,18 @@ export function NavContent({ onNavigate, extensions, }) {
|
|
|
354
356
|
];
|
|
355
357
|
const localPathname = localDispatchPath(location.pathname);
|
|
356
358
|
const operationsOpen = operationsNavItems.some((item) => navItemMatchesPath(item, localPathname));
|
|
359
|
+
const navLabel = (item) => {
|
|
360
|
+
const key = item.id === "thread-debug"
|
|
361
|
+
? "threadDebug"
|
|
362
|
+
: item.id === "workspace"
|
|
363
|
+
? "resources"
|
|
364
|
+
: item.id;
|
|
365
|
+
return t(`dispatch.nav.${key}`, { defaultValue: item.label });
|
|
366
|
+
};
|
|
357
367
|
const renderNavItem = (item) => {
|
|
358
368
|
const Icon = item.icon;
|
|
359
369
|
const itemMatchesLocalPath = navItemMatchesPath(item, localPathname);
|
|
370
|
+
const label = navLabel(item);
|
|
360
371
|
return (_jsxs("li", { children: [_jsxs(NavLink, { to: dispatchNavLinkTarget(item.to), onClick: (event) => {
|
|
361
372
|
if (item.id === "chat" &&
|
|
362
373
|
localPathname !== "/chat" &&
|
|
@@ -375,13 +386,16 @@ export function NavContent({ onNavigate, extensions, }) {
|
|
|
375
386
|
return cn("flex h-8 w-full items-center gap-2 rounded-md px-2 text-sm", active
|
|
376
387
|
? "bg-sidebar-accent font-medium text-sidebar-accent-foreground"
|
|
377
388
|
: "text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground");
|
|
378
|
-
}, children: [Icon ? (_jsx(Icon, { size: 16, className: "shrink-0" })) : (_jsx("span", { className: "h-4 w-4 shrink-0", "aria-hidden": "true" })), _jsx("span", { className: "truncate", children:
|
|
389
|
+
}, children: [Icon ? (_jsx(Icon, { size: 16, className: "shrink-0" })) : (_jsx("span", { className: "h-4 w-4 shrink-0", "aria-hidden": "true" })), _jsx("span", { className: "truncate", children: label })] }), item.id === "chat" && itemMatchesLocalPath ? (_jsx(DispatchChatsSection, { onNavigate: onNavigate })) : null] }, item.id));
|
|
379
390
|
};
|
|
380
391
|
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "border-b px-4 py-3", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsxs("div", { className: "flex h-9 w-9 items-center justify-center rounded-xl border bg-card text-foreground", children: [_jsx("img", { src: appPath("/agent-native-icon-light.svg"), alt: "", "aria-hidden": "true", className: "block h-4 w-auto shrink-0 dark:hidden" }), _jsx("img", { src: appPath("/agent-native-icon-dark.svg"), alt: "", "aria-hidden": "true", className: "hidden h-4 w-auto shrink-0 dark:block" })] }), _jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "truncate text-sm font-semibold text-foreground", children: workspaceLabel ?? "Dispatch" }), _jsx("div", { className: "truncate text-xs text-muted-foreground", children: workspaceLabel
|
|
381
|
-
?
|
|
382
|
-
|
|
392
|
+
? t("dispatch.sidebar.workspaceSubtitle", {
|
|
393
|
+
count: ws?.appCount ?? 0,
|
|
394
|
+
})
|
|
395
|
+
: t("dispatch.sidebar.workspaceControlPlane") })] })] }) }), _jsxs("div", { className: "flex min-h-0 flex-1 flex-col overflow-y-auto", children: [_jsx("nav", { className: "px-2 py-3", children: _jsx("ul", { className: "space-y-0.5", children: primaryNavItems.map(renderNavItem) }) }), _jsxs("div", { className: "mt-auto shrink-0", children: [_jsx("div", { className: "border-t px-2 py-2", children: _jsxs("details", { className: "group", open: operationsOpen, children: [_jsxs("summary", { className: "flex h-8 cursor-pointer list-none items-center justify-between rounded-md px-2 text-xs font-medium uppercase text-sidebar-foreground/50 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground [&::-webkit-details-marker]:hidden", children: [_jsx("span", { children: t("dispatch.nav.operations") }), _jsx(IconChevronDown, { size: 14, className: "transition-transform group-open:rotate-180" })] }), _jsx("ul", { className: "mt-1 space-y-0.5", children: operationsNavItems.map(renderNavItem) })] }) }), _jsx("div", { className: "border-t px-2 py-1", children: _jsx(ExtensionsSidebarSection, {}) }), _jsx("div", { className: "border-t px-3 py-2", children: _jsx(OrgSwitcher, {}) }), _jsx("div", { className: "border-t px-3 py-2", children: _jsx(FeedbackButton, {}) })] })] })] }));
|
|
383
396
|
}
|
|
384
397
|
export function Layout({ children, extensions, }) {
|
|
398
|
+
const t = useT();
|
|
385
399
|
const location = useLocation();
|
|
386
400
|
const navigate = useNavigate();
|
|
387
401
|
const [mobileOpen, setMobileOpen] = useState(false);
|
|
@@ -405,8 +419,13 @@ export function Layout({ children, extensions, }) {
|
|
|
405
419
|
focusAgentChat();
|
|
406
420
|
navigateWithAgentChatViewTransition(navigate, dispatchNavLinkTarget("/chat"));
|
|
407
421
|
}
|
|
422
|
+
const sidebarSuggestions = [
|
|
423
|
+
t("dispatch.sidebar.suggestionBuildApp"),
|
|
424
|
+
t("dispatch.sidebar.suggestionRouteSlack"),
|
|
425
|
+
t("dispatch.sidebar.suggestionGrantKey"),
|
|
426
|
+
];
|
|
408
427
|
const appContent = (_jsxs("div", { className: "flex h-full min-w-0 flex-1 flex-col overflow-hidden", children: [showHeader ? _jsx(Header, { onOpenMobile: () => setMobileOpen(true) }) : null, _jsx(InvitationBanner, {}), _jsx("main", { className: cn("flex-1", isChatRoute ? "min-h-0 overflow-hidden" : "overflow-y-auto"), children: showHeader ? (_jsx("div", { className: "mx-auto max-w-7xl space-y-10 px-4 py-6 sm:px-6", children: children })) : (children) })] }));
|
|
409
|
-
const content = isChatRoute ? (appContent) : (_jsx(AgentSidebar, { position: "right", defaultOpen: false, chatViewTransition: true, storageKey: "dispatch", openOnChatRunning: chatHomeHandoffActive, onFullscreenRequest: openAskAgentFullscreen, emptyStateText: "
|
|
410
|
-
return (_jsx(HeaderActionsProvider, { children: _jsxs("div", { className: "flex h-screen w-full overflow-hidden bg-background", children: [_jsx("aside", { className: "hidden lg:flex w-64 shrink-0 flex-col border-e bg-sidebar text-sidebar-foreground", children: _jsx(NavContent, { extensions: extensions }) }), _jsx(Sheet, { open: mobileOpen, onOpenChange: setMobileOpen, children: _jsxs(SheetContent, { side: "left", className: "w-72 p-0 bg-sidebar text-sidebar-foreground [&>button]:hidden", children: [_jsx(SheetTitle, { className: "sr-only", children: "
|
|
428
|
+
const content = isChatRoute ? (appContent) : (_jsx(AgentSidebar, { position: "right", defaultOpen: false, chatViewTransition: true, storageKey: "dispatch", openOnChatRunning: chatHomeHandoffActive, onFullscreenRequest: openAskAgentFullscreen, emptyStateText: t("dispatch.sidebar.emptyAgentText"), suggestions: sidebarSuggestions, children: appContent }));
|
|
429
|
+
return (_jsx(HeaderActionsProvider, { children: _jsxs("div", { className: "flex h-screen w-full overflow-hidden bg-background", children: [_jsx("aside", { className: "hidden lg:flex w-64 shrink-0 flex-col border-e bg-sidebar text-sidebar-foreground", children: _jsx(NavContent, { extensions: extensions }) }), _jsx(Sheet, { open: mobileOpen, onOpenChange: setMobileOpen, children: _jsxs(SheetContent, { side: "left", className: "w-72 p-0 bg-sidebar text-sidebar-foreground [&>button]:hidden", children: [_jsx(SheetTitle, { className: "sr-only", children: t("dispatch.nav.navigation") }), _jsx(SheetDescription, { className: "sr-only", children: t("dispatch.nav.navigationDescription") }), _jsx("div", { className: "flex h-full w-full flex-col", children: _jsx(NavContent, { extensions: extensions, onNavigate: () => setMobileOpen(false) }) })] }) }), content] }) }));
|
|
411
430
|
}
|
|
412
431
|
//# sourceMappingURL=Layout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layout.js","sourceRoot":"","sources":["../../../src/components/layout/Layout.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,GAIT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EACL,YAAY,EACZ,cAAc,EACd,WAAW,EACX,OAAO,EACP,cAAc,EACd,mCAAmC,EACnC,cAAc,EACd,uBAAuB,EACvB,4BAA4B,EAC5B,cAAc,GAEf,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,OAAO,EACP,eAAe,EACf,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,WAAW,EACX,UAAU,EACV,YAAY,EACZ,eAAe,EACf,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EACL,KAAK,EACL,YAAY,EACZ,gBAAgB,EAChB,UAAU,GACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,OA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U,EACtB,UAAU,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,GACtC,GACE,IACO,GACT,EAEP,OAAO,IACJ,GACgB,CACzB,CAAC;AACJ,CAAC","sourcesContent":["import {\n useEffect,\n useMemo,\n useRef,\n useState,\n type ComponentType,\n type FormEvent,\n type ReactNode,\n} from \"react\";\nimport { NavLink, useLocation, useNavigate } from \"react-router\";\nimport {\n AgentSidebar,\n FeedbackButton,\n appBasePath,\n appPath,\n focusAgentChat,\n navigateWithAgentChatViewTransition,\n useActionQuery,\n useAgentChatHomeHandoff,\n useAgentChatHomeHandoffLinks,\n useChatThreads,\n type ChatThreadSummary,\n} from \"@agent-native/core/client\";\nimport { ExtensionsSidebarSection } from \"@agent-native/core/client/extensions\";\nimport { InvitationBanner, OrgSwitcher } from \"@agent-native/core/client/org\";\nimport {\n IconArrowUpRight,\n IconApps,\n IconBrain,\n IconChartBar,\n IconBrandTelegram,\n IconKey,\n IconChevronDown,\n IconDots,\n IconEdit,\n IconLayersSubtract,\n IconMessageQuestion,\n IconMessages,\n IconPlus,\n IconPlugConnected,\n IconBroadcast,\n IconFingerprint,\n IconHistory,\n IconPuzzle,\n IconSettings,\n IconShieldCheck,\n IconUsersGroup,\n} from \"@tabler/icons-react\";\nimport { cn } from \"@/lib/utils\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from \"@/components/ui/dropdown-menu\";\nimport { Input } from \"@/components/ui/input\";\nimport {\n Sheet,\n SheetContent,\n SheetDescription,\n SheetTitle,\n} from \"@/components/ui/sheet\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@/components/ui/tooltip\";\nimport { Header } from \"./Header\";\nimport { HeaderActionsProvider } from \"./HeaderActions\";\n\nexport type DispatchNavSection = \"primary\" | \"operations\";\n\nexport type DispatchNavIcon = ComponentType<{\n size?: number | string;\n className?: string;\n}>;\n\nexport interface DispatchNavItem {\n /** Stable id used for keys and navigation.view. Avoid built-in ids. */\n id: string;\n /** React Router path for the tab, usually backed by an app/routes/*.tsx file. */\n to: string;\n label: string;\n icon?: DispatchNavIcon;\n /** Defaults to \"operations\", which is where local management tools usually fit. */\n section?: DispatchNavSection;\n /** Override active matching for nested or multi-route tools. */\n match?: (pathname: string) => boolean;\n}\n\nexport interface DispatchExtensionConfig {\n /** Extra sidebar tabs supplied by the generated workspace. */\n navItems?: readonly DispatchNavItem[];\n /** Extra React Query keys to invalidate when Dispatch receives DB sync events. */\n queryKeys?: readonly string[];\n}\n\nconst PRIMARY_NAV_ITEMS = [\n {\n id: \"chat\",\n to: \"/chat\",\n label: \"Chat\",\n icon: IconMessageQuestion,\n section: \"primary\",\n },\n {\n id: \"overview\",\n to: \"/overview\",\n label: \"Overview\",\n icon: IconBroadcast,\n section: \"primary\",\n },\n {\n id: \"apps\",\n to: \"/apps\",\n label: \"Apps\",\n icon: IconApps,\n section: \"primary\",\n },\n {\n id: \"metrics\",\n to: \"/metrics\",\n label: \"Metrics\",\n icon: IconChartBar,\n section: \"primary\",\n },\n {\n id: \"vault\",\n to: \"/vault\",\n label: \"Vault\",\n icon: IconKey,\n section: \"primary\",\n },\n {\n id: \"integrations\",\n to: \"/integrations\",\n label: \"Integrations\",\n icon: IconPuzzle,\n section: \"primary\",\n },\n {\n id: \"agents\",\n to: \"/agents\",\n label: \"Agents\",\n icon: IconPlugConnected,\n section: \"primary\",\n },\n] as const satisfies readonly DispatchNavItem[];\n\nconst OPERATIONS_NAV_ITEMS = [\n {\n id: \"workspace\",\n to: \"/workspace\",\n label: \"Resources\",\n icon: IconLayersSubtract,\n section: \"operations\",\n },\n {\n id: \"messaging\",\n to: \"/messaging\",\n label: \"Messaging\",\n icon: IconBrandTelegram,\n section: \"operations\",\n },\n {\n id: \"destinations\",\n to: \"/destinations\",\n label: \"Destinations\",\n icon: IconArrowUpRight,\n section: \"operations\",\n },\n {\n id: \"identities\",\n to: \"/identities\",\n label: \"Identities\",\n icon: IconFingerprint,\n section: \"operations\",\n },\n {\n id: \"approvals\",\n to: \"/approvals\",\n label: \"Approvals\",\n icon: IconShieldCheck,\n section: \"operations\",\n },\n {\n id: \"audit\",\n to: \"/audit\",\n label: \"Audit\",\n icon: IconHistory,\n section: \"operations\",\n },\n {\n id: \"dreams\",\n to: \"/dreams\",\n label: \"Dreams\",\n icon: IconBrain,\n section: \"operations\",\n },\n {\n id: \"thread-debug\",\n to: \"/thread-debug\",\n label: \"Thread Debug\",\n icon: IconMessages,\n section: \"operations\",\n },\n {\n id: \"settings\",\n to: \"/settings\",\n label: \"Settings\",\n icon: IconSettings,\n section: \"operations\",\n },\n {\n id: \"team\",\n to: \"/team\",\n label: \"Team\",\n icon: IconUsersGroup,\n section: \"operations\",\n },\n] as const satisfies readonly DispatchNavItem[];\n\nconst EMPTY_NAV_ITEMS: readonly DispatchNavItem[] = [];\n\nconst SIDEBAR_SUGGESTIONS = [\n \"Build a workspace app for X\",\n \"Route Slack mentions to my analytics app\",\n \"Grant my OpenAI key to this app\",\n];\n\nconst CHROMELESS_PATHS = [\"/approval\"];\n\n// Routes whose page renders its own toolbar (with NotificationsBell + AgentToggleButton).\n// Layout still mounts the sidebar + AgentSidebar, but skips its own Header so\n// there's no double-header.\nfunction pageOwnsToolbar(pathname: string): boolean {\n if (pathname === \"/tools\" || pathname.startsWith(\"/tools/\")) return true;\n if (pathname === \"/extensions\" || pathname.startsWith(\"/extensions/\"))\n return true;\n return false;\n}\n\ninterface WorkspaceInfo {\n name: string | null;\n displayName: string | null;\n appCount: number;\n}\n\nfunction sectionFor(item: DispatchNavItem): DispatchNavSection {\n return item.section ?? \"operations\";\n}\n\nfunction navItemMatchesPath(item: DispatchNavItem, pathname: string): boolean {\n if (item.match) {\n try {\n if (item.match(pathname)) return true;\n } catch {\n return false;\n }\n }\n return pathname === item.to || pathname.startsWith(`${item.to}/`);\n}\n\nfunction navItemsForSection(\n items: readonly DispatchNavItem[],\n section: DispatchNavSection,\n): DispatchNavItem[] {\n return items.filter((item) => sectionFor(item) === section);\n}\n\nfunction localDispatchPath(pathname: string): string {\n const basePath = appBasePath();\n if (!basePath) return pathname;\n if (pathname === basePath) return \"/\";\n if (pathname.startsWith(`${basePath}/`)) {\n return pathname.slice(basePath.length) || \"/\";\n }\n return pathname;\n}\n\nfunction dispatchNavLinkTarget(path: string): string {\n if (typeof window === \"undefined\") return path;\n const basePath = appBasePath();\n if (!basePath) return path;\n // Mirror the basename calculation entry.client.tsx uses to configure the\n // router (basePath iff the current URL is under that mount, \"\" otherwise).\n // Reading the live URL directly avoids races with the previous check on\n // `__reactRouterContext.basename`, which could read undefined before the\n // entry script set it — that race produced /dispatch/dispatch/<route>\n // history entries that 404'd on back-button navigation.\n const pathname = window.location.pathname;\n const routerHasBasename =\n pathname === basePath || pathname.startsWith(`${basePath}/`);\n return routerHasBasename ? path : appPath(path);\n}\n\nfunction chatThreadPath(threadId: string): string {\n return `/chat/${encodeURIComponent(threadId)}`;\n}\n\nfunction threadIdFromPath(pathname: string): string | null {\n const match = pathname.match(/^\\/chat\\/([^/]+)/);\n if (!match) return null;\n try {\n const value = decodeURIComponent(match[1]).trim();\n return value || null;\n } catch {\n return null;\n }\n}\n\nfunction formatThreadAge(updatedAt: number) {\n const diffMs = Math.max(0, Date.now() - updatedAt);\n const minutes = Math.floor(diffMs / 60_000);\n if (minutes < 1) return \"now\";\n if (minutes < 60) return `${minutes}m`;\n const hours = Math.floor(minutes / 60);\n if (hours < 24) return `${hours}h`;\n const days = Math.floor(hours / 24);\n if (days < 7) return `${days}d`;\n return new Date(updatedAt).toLocaleDateString([], {\n month: \"short\",\n day: \"numeric\",\n });\n}\n\nfunction threadTitle(thread: ChatThreadSummary) {\n return thread.title || thread.preview || \"New chat\";\n}\n\nfunction threadUpdatedAt(thread: ChatThreadSummary) {\n return Number.isFinite(thread.updatedAt)\n ? thread.updatedAt\n : Number.isFinite(thread.createdAt)\n ? thread.createdAt\n : 0;\n}\n\nfunction DispatchChatsSection({ onNavigate }: { onNavigate?: () => void }) {\n const navigate = useNavigate();\n const location = useLocation();\n const {\n threads,\n activeThreadId,\n createThread,\n switchThread,\n renameThread,\n refreshThreads,\n } = useChatThreads(undefined, \"dispatch\", undefined, { autoCreate: false });\n const [renamingThreadId, setRenamingThreadId] = useState<string | null>(null);\n const [renameDraft, setRenameDraft] = useState(\"\");\n const renameInputRef = useRef<HTMLInputElement | null>(null);\n const committingRenameRef = useRef(false);\n\n const visibleThreads = useMemo(\n () =>\n threads\n .filter(\n (thread) => thread.messageCount > 0 || thread.id === activeThreadId,\n )\n .sort((a, b) => threadUpdatedAt(b) - threadUpdatedAt(a))\n .slice(0, 8),\n [activeThreadId, threads],\n );\n\n useEffect(() => {\n const refresh = () => refreshThreads();\n const handleRunning = (event: Event) => {\n const detail = (event as CustomEvent).detail as\n | { isRunning?: unknown }\n | undefined;\n if (detail?.isRunning === false) refreshThreads();\n };\n\n window.addEventListener(\"agent-chat:threads-updated\", refresh);\n window.addEventListener(\"agentNative.chatRunning\", handleRunning);\n window.addEventListener(\"focus\", refresh);\n return () => {\n window.removeEventListener(\"agent-chat:threads-updated\", refresh);\n window.removeEventListener(\"agentNative.chatRunning\", handleRunning);\n window.removeEventListener(\"focus\", refresh);\n };\n }, [refreshThreads]);\n\n useEffect(() => {\n if (!renamingThreadId) return;\n requestAnimationFrame(() => {\n renameInputRef.current?.focus();\n renameInputRef.current?.select();\n });\n }, [renamingThreadId]);\n\n function openThread(threadId: string, options?: { isNew?: boolean }) {\n switchThread(threadId);\n navigateWithAgentChatViewTransition(\n navigate,\n dispatchNavLinkTarget(\n options?.isNew ? \"/chat\" : chatThreadPath(threadId),\n ),\n );\n onNavigate?.();\n window.requestAnimationFrame(() => {\n window.dispatchEvent(\n new CustomEvent(\"agent-chat:open-thread\", {\n detail: { threadId, newThread: options?.isNew === true },\n }),\n );\n });\n }\n\n async function handleNewChat() {\n const threadId = await createThread();\n if (threadId) openThread(threadId, { isNew: true });\n }\n\n function startRenameThread(thread: ChatThreadSummary) {\n committingRenameRef.current = false;\n setRenameDraft(threadTitle(thread));\n setRenamingThreadId(thread.id);\n }\n\n function cancelRenameThread() {\n committingRenameRef.current = true;\n setRenamingThreadId(null);\n setRenameDraft(\"\");\n }\n\n async function commitRenameThread() {\n if (committingRenameRef.current) return;\n const threadId = renamingThreadId;\n const title = renameDraft.trim();\n if (!threadId) return;\n committingRenameRef.current = true;\n setRenamingThreadId(null);\n setRenameDraft(\"\");\n if (title) await renameThread(threadId, title);\n committingRenameRef.current = false;\n }\n\n function handleRenameSubmit(event: FormEvent<HTMLFormElement>) {\n event.preventDefault();\n void commitRenameThread();\n }\n\n return (\n <div className=\"mt-2 border-s border-sidebar-border/70 ps-3\">\n <div className=\"mb-1 flex h-7 items-center gap-2 pe-1\">\n <div className=\"min-w-0 flex-1 text-xs font-medium text-sidebar-foreground/70\">\n Chats\n </div>\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n onClick={handleNewChat}\n className=\"flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md text-sidebar-foreground/65 transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground\"\n aria-label=\"New Dispatch chat\"\n >\n <IconPlus className=\"size-3.5\" />\n </button>\n </TooltipTrigger>\n <TooltipContent>New chat</TooltipContent>\n </Tooltip>\n </div>\n <div className=\"grid gap-0.5\">\n {visibleThreads.length > 0 ? (\n visibleThreads.map((thread) => {\n const localPathname = localDispatchPath(location.pathname);\n const isActive =\n thread.id ===\n (threadIdFromPath(localPathname) ??\n (localPathname === \"/chat\" ? null : activeThreadId));\n const isRenaming = thread.id === renamingThreadId;\n return (\n <div\n key={thread.id}\n className={cn(\n \"group flex h-8 min-w-0 items-center rounded-md text-sm transition-colors\",\n isActive\n ? \"bg-sidebar-accent text-sidebar-accent-foreground\"\n : \"text-sidebar-foreground/80 hover:bg-sidebar-accent/65 hover:text-sidebar-accent-foreground\",\n )}\n >\n {isRenaming ? (\n <form\n onSubmit={handleRenameSubmit}\n className=\"flex h-full min-w-0 flex-1 items-center px-1.5\"\n >\n <Input\n ref={renameInputRef}\n value={renameDraft}\n onChange={(event) => setRenameDraft(event.target.value)}\n onBlur={() => void commitRenameThread()}\n onKeyDown={(event) => {\n if (event.key === \"Escape\") {\n event.preventDefault();\n cancelRenameThread();\n }\n }}\n maxLength={160}\n aria-label={`Rename ${threadTitle(thread)}`}\n className=\"h-6 min-w-0 rounded-sm border-sidebar-border bg-background px-1.5 text-xs\"\n />\n </form>\n ) : (\n <>\n <button\n type=\"button\"\n onClick={() => openThread(thread.id)}\n className=\"flex h-full min-w-0 flex-1 cursor-pointer items-center px-2 text-start outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <span className=\"min-w-0 flex-1 truncate\">\n {threadTitle(thread)}\n </span>\n </button>\n <div className=\"relative flex size-7 shrink-0 items-center justify-end pe-1\">\n <span className=\"text-[11px] text-sidebar-foreground/50 transition-opacity group-hover:opacity-0 group-focus-within:opacity-0\">\n {isActive\n ? \"\"\n : formatThreadAge(threadUpdatedAt(thread))}\n </span>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <button\n type=\"button\"\n aria-label={`Chat options for ${threadTitle(thread)}`}\n className=\"absolute end-1 flex size-6 cursor-pointer items-center justify-center rounded-md text-sidebar-foreground/65 opacity-0 transition-opacity hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover:opacity-100 group-focus-within:opacity-100 data-[state=open]:opacity-100\"\n >\n <IconDots className=\"size-4\" />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent\n align=\"end\"\n side=\"right\"\n sideOffset={6}\n >\n <DropdownMenuItem\n onSelect={() => startRenameThread(thread)}\n >\n <IconEdit className=\"size-4\" />\n Rename chat\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n </>\n )}\n </div>\n );\n })\n ) : (\n <button\n type=\"button\"\n onClick={handleNewChat}\n className=\"flex h-8 cursor-pointer items-center rounded-md px-2 text-start text-sm text-sidebar-foreground/70 transition-colors hover:bg-sidebar-accent/65 hover:text-sidebar-accent-foreground\"\n >\n <span className=\"truncate\">New chat</span>\n </button>\n )}\n </div>\n </div>\n );\n}\n\nexport function NavContent({\n onNavigate,\n extensions,\n}: {\n onNavigate?: () => void;\n extensions?: DispatchExtensionConfig;\n}) {\n const location = useLocation();\n const navigate = useNavigate();\n const { data: workspace } = useActionQuery(\n \"get-workspace-info\",\n {},\n { staleTime: 60_000 },\n );\n const ws = workspace as WorkspaceInfo | undefined;\n const workspaceLabel = ws?.displayName ?? ws?.name ?? null;\n const extensionNavItems = extensions?.navItems ?? EMPTY_NAV_ITEMS;\n const primaryNavItems = [\n ...PRIMARY_NAV_ITEMS,\n ...navItemsForSection(extensionNavItems, \"primary\"),\n ];\n const operationsNavItems = [\n ...OPERATIONS_NAV_ITEMS,\n ...navItemsForSection(extensionNavItems, \"operations\"),\n ];\n const localPathname = localDispatchPath(location.pathname);\n const operationsOpen = operationsNavItems.some((item) =>\n navItemMatchesPath(item, localPathname),\n );\n\n const renderNavItem = (item: DispatchNavItem) => {\n const Icon = item.icon;\n const itemMatchesLocalPath = navItemMatchesPath(item, localPathname);\n return (\n <li key={item.id}>\n <NavLink\n to={dispatchNavLinkTarget(item.to)}\n onClick={(event) => {\n if (\n item.id === \"chat\" &&\n localPathname !== \"/chat\" &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.shiftKey &&\n !event.altKey\n ) {\n event.preventDefault();\n navigateWithAgentChatViewTransition(\n navigate,\n dispatchNavLinkTarget(\"/chat\"),\n );\n onNavigate?.();\n return;\n }\n onNavigate?.();\n }}\n className={({ isActive }) => {\n const active = isActive || itemMatchesLocalPath;\n return cn(\n \"flex h-8 w-full items-center gap-2 rounded-md px-2 text-sm\",\n active\n ? \"bg-sidebar-accent font-medium text-sidebar-accent-foreground\"\n : \"text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground\",\n );\n }}\n >\n {Icon ? (\n <Icon size={16} className=\"shrink-0\" />\n ) : (\n <span className=\"h-4 w-4 shrink-0\" aria-hidden=\"true\" />\n )}\n <span className=\"truncate\">{item.label}</span>\n </NavLink>\n {item.id === \"chat\" && itemMatchesLocalPath ? (\n <DispatchChatsSection onNavigate={onNavigate} />\n ) : null}\n </li>\n );\n };\n\n return (\n <>\n <div className=\"border-b px-4 py-3\">\n <div className=\"flex items-center gap-3\">\n <div className=\"flex h-9 w-9 items-center justify-center rounded-xl border bg-card text-foreground\">\n <img\n src={appPath(\"/agent-native-icon-light.svg\")}\n alt=\"\"\n aria-hidden=\"true\"\n className=\"block h-4 w-auto shrink-0 dark:hidden\"\n />\n <img\n src={appPath(\"/agent-native-icon-dark.svg\")}\n alt=\"\"\n aria-hidden=\"true\"\n className=\"hidden h-4 w-auto shrink-0 dark:block\"\n />\n </div>\n <div className=\"min-w-0\">\n <div className=\"truncate text-sm font-semibold text-foreground\">\n {workspaceLabel ?? \"Dispatch\"}\n </div>\n <div className=\"truncate text-xs text-muted-foreground\">\n {workspaceLabel\n ? `Workspace · ${ws?.appCount ?? 0} app${ws?.appCount === 1 ? \"\" : \"s\"}`\n : \"Workspace control plane\"}\n </div>\n </div>\n </div>\n </div>\n\n <div className=\"flex min-h-0 flex-1 flex-col overflow-y-auto\">\n <nav className=\"px-2 py-3\">\n <ul className=\"space-y-0.5\">{primaryNavItems.map(renderNavItem)}</ul>\n </nav>\n\n <div className=\"mt-auto shrink-0\">\n <div className=\"border-t px-2 py-2\">\n <details className=\"group\" open={operationsOpen}>\n <summary className=\"flex h-8 cursor-pointer list-none items-center justify-between rounded-md px-2 text-xs font-medium uppercase text-sidebar-foreground/50 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground [&::-webkit-details-marker]:hidden\">\n <span>Operations</span>\n <IconChevronDown\n size={14}\n className=\"transition-transform group-open:rotate-180\"\n />\n </summary>\n <ul className=\"mt-1 space-y-0.5\">\n {operationsNavItems.map(renderNavItem)}\n </ul>\n </details>\n </div>\n\n <div className=\"border-t px-2 py-1\">\n <ExtensionsSidebarSection />\n </div>\n\n <div className=\"border-t px-3 py-2\">\n <OrgSwitcher />\n </div>\n\n <div className=\"border-t px-3 py-2\">\n <FeedbackButton />\n </div>\n </div>\n </div>\n </>\n );\n}\n\nexport function Layout({\n children,\n extensions,\n}: {\n children: ReactNode;\n extensions?: DispatchExtensionConfig;\n}) {\n const location = useLocation();\n const navigate = useNavigate();\n const [mobileOpen, setMobileOpen] = useState(false);\n const localPathname = localDispatchPath(location.pathname);\n const isChatRoute =\n localPathname === \"/chat\" || localPathname.startsWith(\"/chat/\");\n const chatHomeHandoffActive = useAgentChatHomeHandoff({\n storageKey: \"dispatch\",\n activePath: localPathname,\n enabled: !isChatRoute,\n });\n const chatHandoffLinkOptions = {\n storageKey: \"dispatch\",\n isChatPath: (pathname: string) =>\n pathname === \"/chat\" || pathname.startsWith(\"/chat/\"),\n };\n useAgentChatHomeHandoffLinks(chatHandoffLinkOptions);\n\n if (CHROMELESS_PATHS.some((path) => localPathname === path)) {\n return <>{children}</>;\n }\n\n const showHeader = !isChatRoute && !pageOwnsToolbar(localPathname);\n function openAskAgentFullscreen() {\n focusAgentChat();\n navigateWithAgentChatViewTransition(\n navigate,\n dispatchNavLinkTarget(\"/chat\"),\n );\n }\n const appContent = (\n <div className=\"flex h-full min-w-0 flex-1 flex-col overflow-hidden\">\n {showHeader ? <Header onOpenMobile={() => setMobileOpen(true)} /> : null}\n <InvitationBanner />\n <main\n className={cn(\n \"flex-1\",\n isChatRoute ? \"min-h-0 overflow-hidden\" : \"overflow-y-auto\",\n )}\n >\n {showHeader ? (\n <div className=\"mx-auto max-w-7xl space-y-10 px-4 py-6 sm:px-6\">\n {children}\n </div>\n ) : (\n children\n )}\n </main>\n </div>\n );\n const content = isChatRoute ? (\n appContent\n ) : (\n <AgentSidebar\n position=\"right\"\n defaultOpen={false}\n chatViewTransition\n storageKey=\"dispatch\"\n openOnChatRunning={chatHomeHandoffActive}\n onFullscreenRequest={openAskAgentFullscreen}\n emptyStateText=\"Create apps, manage vault keys, and route work across the workspace.\"\n suggestions={SIDEBAR_SUGGESTIONS}\n >\n {appContent}\n </AgentSidebar>\n );\n\n return (\n <HeaderActionsProvider>\n <div className=\"flex h-screen w-full overflow-hidden bg-background\">\n <aside className=\"hidden lg:flex w-64 shrink-0 flex-col border-e bg-sidebar text-sidebar-foreground\">\n <NavContent extensions={extensions} />\n </aside>\n\n <Sheet open={mobileOpen} onOpenChange={setMobileOpen}>\n <SheetContent\n side=\"left\"\n className=\"w-72 p-0 bg-sidebar text-sidebar-foreground [&>button]:hidden\"\n >\n <SheetTitle className=\"sr-only\">Navigation</SheetTitle>\n <SheetDescription className=\"sr-only\">\n Workspace navigation links\n </SheetDescription>\n <div className=\"flex h-full w-full flex-col\">\n <NavContent\n extensions={extensions}\n onNavigate={() => setMobileOpen(false)}\n />\n </div>\n </SheetContent>\n </Sheet>\n\n {content}\n </div>\n </HeaderActionsProvider>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Layout.js","sourceRoot":"","sources":["../../../src/components/layout/Layout.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,GAIT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EACL,YAAY,EACZ,cAAc,EACd,WAAW,EACX,OAAO,EACP,cAAc,EACd,mCAAmC,EACnC,cAAc,EACd,uBAAuB,EACvB,4BAA4B,EAC5B,cAAc,EACd,aAAa,EACb,IAAI,GAEL,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR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AAC,UAAU,IAAC,UAAU,EAAE,UAAU,GAAI,GAChC,EAER,KAAC,KAAK,IAAC,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,YAClD,MAAC,YAAY,IACX,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,+DAA+D,aAEzE,KAAC,UAAU,IAAC,SAAS,EAAC,SAAS,YAC5B,CAAC,CAAC,yBAAyB,CAAC,GAClB,EACb,KAAC,gBAAgB,IAAC,SAAS,EAAC,SAAS,YAClC,CAAC,CAAC,oCAAoC,CAAC,GACvB,EACnB,cAAK,SAAS,EAAC,6BAA6B,YAC1C,KAAC,UAAU,IACT,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,GACtC,GACE,IACO,GACT,EAEP,OAAO,IACJ,GACgB,CACzB,CAAC;AACJ,CAAC","sourcesContent":["import {\n useEffect,\n useMemo,\n useRef,\n useState,\n type ComponentType,\n type FormEvent,\n type ReactNode,\n} from \"react\";\nimport { NavLink, useLocation, useNavigate } from \"react-router\";\nimport {\n AgentSidebar,\n FeedbackButton,\n appBasePath,\n appPath,\n focusAgentChat,\n navigateWithAgentChatViewTransition,\n useActionQuery,\n useAgentChatHomeHandoff,\n useAgentChatHomeHandoffLinks,\n useChatThreads,\n useFormatters,\n useT,\n type ChatThreadSummary,\n} from \"@agent-native/core/client\";\nimport { ExtensionsSidebarSection } from \"@agent-native/core/client/extensions\";\nimport { InvitationBanner, OrgSwitcher } from \"@agent-native/core/client/org\";\nimport {\n IconArrowUpRight,\n IconApps,\n IconBrain,\n IconChartBar,\n IconBrandTelegram,\n IconKey,\n IconChevronDown,\n IconDots,\n IconEdit,\n IconLayersSubtract,\n IconMessageQuestion,\n IconMessages,\n IconPlus,\n IconPlugConnected,\n IconBroadcast,\n IconFingerprint,\n IconHistory,\n IconPuzzle,\n IconSettings,\n IconShieldCheck,\n IconUsersGroup,\n} from \"@tabler/icons-react\";\nimport { cn } from \"@/lib/utils\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from \"@/components/ui/dropdown-menu\";\nimport { Input } from \"@/components/ui/input\";\nimport {\n Sheet,\n SheetContent,\n SheetDescription,\n SheetTitle,\n} from \"@/components/ui/sheet\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@/components/ui/tooltip\";\nimport { Header } from \"./Header\";\nimport { HeaderActionsProvider } from \"./HeaderActions\";\n\nexport type DispatchNavSection = \"primary\" | \"operations\";\n\nexport type DispatchNavIcon = ComponentType<{\n size?: number | string;\n className?: string;\n}>;\n\nexport interface DispatchNavItem {\n /** Stable id used for keys and navigation.view. Avoid built-in ids. */\n id: string;\n /** React Router path for the tab, usually backed by an app/routes/*.tsx file. */\n to: string;\n label: string;\n icon?: DispatchNavIcon;\n /** Defaults to \"operations\", which is where local management tools usually fit. */\n section?: DispatchNavSection;\n /** Override active matching for nested or multi-route tools. */\n match?: (pathname: string) => boolean;\n}\n\nexport interface DispatchExtensionConfig {\n /** Extra sidebar tabs supplied by the generated workspace. */\n navItems?: readonly DispatchNavItem[];\n /** Extra React Query keys to invalidate when Dispatch receives DB sync events. */\n queryKeys?: readonly string[];\n}\n\nconst PRIMARY_NAV_ITEMS = [\n {\n id: \"chat\",\n to: \"/chat\",\n label: \"Chat\",\n icon: IconMessageQuestion,\n section: \"primary\",\n },\n {\n id: \"overview\",\n to: \"/overview\",\n label: \"Overview\",\n icon: IconBroadcast,\n section: \"primary\",\n },\n {\n id: \"apps\",\n to: \"/apps\",\n label: \"Apps\",\n icon: IconApps,\n section: \"primary\",\n },\n {\n id: \"metrics\",\n to: \"/metrics\",\n label: \"Metrics\",\n icon: IconChartBar,\n section: \"primary\",\n },\n {\n id: \"vault\",\n to: \"/vault\",\n label: \"Vault\",\n icon: IconKey,\n section: \"primary\",\n },\n {\n id: \"integrations\",\n to: \"/integrations\",\n label: \"Integrations\",\n icon: IconPuzzle,\n section: \"primary\",\n },\n {\n id: \"agents\",\n to: \"/agents\",\n label: \"Agents\",\n icon: IconPlugConnected,\n section: \"primary\",\n },\n] as const satisfies readonly DispatchNavItem[];\n\nconst OPERATIONS_NAV_ITEMS = [\n {\n id: \"workspace\",\n to: \"/workspace\",\n label: \"Resources\",\n icon: IconLayersSubtract,\n section: \"operations\",\n },\n {\n id: \"messaging\",\n to: \"/messaging\",\n label: \"Messaging\",\n icon: IconBrandTelegram,\n section: \"operations\",\n },\n {\n id: \"destinations\",\n to: \"/destinations\",\n label: \"Destinations\",\n icon: IconArrowUpRight,\n section: \"operations\",\n },\n {\n id: \"identities\",\n to: \"/identities\",\n label: \"Identities\",\n icon: IconFingerprint,\n section: \"operations\",\n },\n {\n id: \"approvals\",\n to: \"/approvals\",\n label: \"Approvals\",\n icon: IconShieldCheck,\n section: \"operations\",\n },\n {\n id: \"audit\",\n to: \"/audit\",\n label: \"Audit\",\n icon: IconHistory,\n section: \"operations\",\n },\n {\n id: \"dreams\",\n to: \"/dreams\",\n label: \"Dreams\",\n icon: IconBrain,\n section: \"operations\",\n },\n {\n id: \"thread-debug\",\n to: \"/thread-debug\",\n label: \"Thread Debug\",\n icon: IconMessages,\n section: \"operations\",\n },\n {\n id: \"settings\",\n to: \"/settings\",\n label: \"Settings\",\n icon: IconSettings,\n section: \"operations\",\n },\n {\n id: \"team\",\n to: \"/team\",\n label: \"Team\",\n icon: IconUsersGroup,\n section: \"operations\",\n },\n] as const satisfies readonly DispatchNavItem[];\n\nconst EMPTY_NAV_ITEMS: readonly DispatchNavItem[] = [];\n\nconst CHROMELESS_PATHS = [\"/approval\"];\n\n// Routes whose page renders its own toolbar (with NotificationsBell + AgentToggleButton).\n// Layout still mounts the sidebar + AgentSidebar, but skips its own Header so\n// there's no double-header.\nfunction pageOwnsToolbar(pathname: string): boolean {\n if (pathname === \"/tools\" || pathname.startsWith(\"/tools/\")) return true;\n if (pathname === \"/extensions\" || pathname.startsWith(\"/extensions/\"))\n return true;\n return false;\n}\n\ninterface WorkspaceInfo {\n name: string | null;\n displayName: string | null;\n appCount: number;\n}\n\nfunction sectionFor(item: DispatchNavItem): DispatchNavSection {\n return item.section ?? \"operations\";\n}\n\nfunction navItemMatchesPath(item: DispatchNavItem, pathname: string): boolean {\n if (item.match) {\n try {\n if (item.match(pathname)) return true;\n } catch {\n return false;\n }\n }\n return pathname === item.to || pathname.startsWith(`${item.to}/`);\n}\n\nfunction navItemsForSection(\n items: readonly DispatchNavItem[],\n section: DispatchNavSection,\n): DispatchNavItem[] {\n return items.filter((item) => sectionFor(item) === section);\n}\n\nfunction localDispatchPath(pathname: string): string {\n const basePath = appBasePath();\n if (!basePath) return pathname;\n if (pathname === basePath) return \"/\";\n if (pathname.startsWith(`${basePath}/`)) {\n return pathname.slice(basePath.length) || \"/\";\n }\n return pathname;\n}\n\nfunction dispatchNavLinkTarget(path: string): string {\n if (typeof window === \"undefined\") return path;\n const basePath = appBasePath();\n if (!basePath) return path;\n // Mirror the basename calculation entry.client.tsx uses to configure the\n // router (basePath iff the current URL is under that mount, \"\" otherwise).\n // Reading the live URL directly avoids races with the previous check on\n // `__reactRouterContext.basename`, which could read undefined before the\n // entry script set it — that race produced /dispatch/dispatch/<route>\n // history entries that 404'd on back-button navigation.\n const pathname = window.location.pathname;\n const routerHasBasename =\n pathname === basePath || pathname.startsWith(`${basePath}/`);\n return routerHasBasename ? path : appPath(path);\n}\n\nfunction chatThreadPath(threadId: string): string {\n return `/chat/${encodeURIComponent(threadId)}`;\n}\n\nfunction threadIdFromPath(pathname: string): string | null {\n const match = pathname.match(/^\\/chat\\/([^/]+)/);\n if (!match) return null;\n try {\n const value = decodeURIComponent(match[1]).trim();\n return value || null;\n } catch {\n return null;\n }\n}\n\nfunction formatThreadAge(\n updatedAt: number,\n formatDate: ReturnType<typeof useFormatters>[\"formatDate\"],\n) {\n const diffMs = Math.max(0, Date.now() - updatedAt);\n const minutes = Math.floor(diffMs / 60_000);\n if (minutes < 1) return \"now\";\n if (minutes < 60) return `${minutes}m`;\n const hours = Math.floor(minutes / 60);\n if (hours < 24) return `${hours}h`;\n const days = Math.floor(hours / 24);\n if (days < 7) return `${days}d`;\n return formatDate(updatedAt, {\n month: \"short\",\n day: \"numeric\",\n });\n}\n\nfunction threadTitle(thread: ChatThreadSummary, fallback: string) {\n return thread.title || thread.preview || fallback;\n}\n\nfunction threadUpdatedAt(thread: ChatThreadSummary) {\n return Number.isFinite(thread.updatedAt)\n ? thread.updatedAt\n : Number.isFinite(thread.createdAt)\n ? thread.createdAt\n : 0;\n}\n\nfunction DispatchChatsSection({ onNavigate }: { onNavigate?: () => void }) {\n const t = useT();\n const { formatDate } = useFormatters();\n const navigate = useNavigate();\n const location = useLocation();\n const {\n threads,\n activeThreadId,\n createThread,\n switchThread,\n renameThread,\n refreshThreads,\n } = useChatThreads(undefined, \"dispatch\", undefined, { autoCreate: false });\n const [renamingThreadId, setRenamingThreadId] = useState<string | null>(null);\n const [renameDraft, setRenameDraft] = useState(\"\");\n const renameInputRef = useRef<HTMLInputElement | null>(null);\n const committingRenameRef = useRef(false);\n\n const visibleThreads = useMemo(\n () =>\n threads\n .filter(\n (thread) => thread.messageCount > 0 || thread.id === activeThreadId,\n )\n .sort((a, b) => threadUpdatedAt(b) - threadUpdatedAt(a))\n .slice(0, 8),\n [activeThreadId, threads],\n );\n\n useEffect(() => {\n const refresh = () => refreshThreads();\n const handleRunning = (event: Event) => {\n const detail = (event as CustomEvent).detail as\n | { isRunning?: unknown }\n | undefined;\n if (detail?.isRunning === false) refreshThreads();\n };\n\n window.addEventListener(\"agent-chat:threads-updated\", refresh);\n window.addEventListener(\"agentNative.chatRunning\", handleRunning);\n window.addEventListener(\"focus\", refresh);\n return () => {\n window.removeEventListener(\"agent-chat:threads-updated\", refresh);\n window.removeEventListener(\"agentNative.chatRunning\", handleRunning);\n window.removeEventListener(\"focus\", refresh);\n };\n }, [refreshThreads]);\n\n useEffect(() => {\n if (!renamingThreadId) return;\n requestAnimationFrame(() => {\n renameInputRef.current?.focus();\n renameInputRef.current?.select();\n });\n }, [renamingThreadId]);\n\n function openThread(threadId: string, options?: { isNew?: boolean }) {\n switchThread(threadId);\n navigateWithAgentChatViewTransition(\n navigate,\n dispatchNavLinkTarget(\n options?.isNew ? \"/chat\" : chatThreadPath(threadId),\n ),\n );\n onNavigate?.();\n window.requestAnimationFrame(() => {\n window.dispatchEvent(\n new CustomEvent(\"agent-chat:open-thread\", {\n detail: { threadId, newThread: options?.isNew === true },\n }),\n );\n });\n }\n\n async function handleNewChat() {\n const threadId = await createThread();\n if (threadId) openThread(threadId, { isNew: true });\n }\n\n function startRenameThread(thread: ChatThreadSummary) {\n committingRenameRef.current = false;\n setRenameDraft(threadTitle(thread, t(\"dispatch.sidebar.newChat\")));\n setRenamingThreadId(thread.id);\n }\n\n function cancelRenameThread() {\n committingRenameRef.current = true;\n setRenamingThreadId(null);\n setRenameDraft(\"\");\n }\n\n async function commitRenameThread() {\n if (committingRenameRef.current) return;\n const threadId = renamingThreadId;\n const title = renameDraft.trim();\n if (!threadId) return;\n committingRenameRef.current = true;\n setRenamingThreadId(null);\n setRenameDraft(\"\");\n if (title) await renameThread(threadId, title);\n committingRenameRef.current = false;\n }\n\n function handleRenameSubmit(event: FormEvent<HTMLFormElement>) {\n event.preventDefault();\n void commitRenameThread();\n }\n\n return (\n <div className=\"mt-2 border-s border-sidebar-border/70 ps-3\">\n <div className=\"mb-1 flex h-7 items-center gap-2 pe-1\">\n <div className=\"min-w-0 flex-1 text-xs font-medium text-sidebar-foreground/70\">\n {t(\"dispatch.sidebar.chats\")}\n </div>\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n onClick={handleNewChat}\n className=\"flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md text-sidebar-foreground/65 transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground\"\n aria-label={t(\"dispatch.sidebar.newDispatchChat\")}\n >\n <IconPlus className=\"size-3.5\" />\n </button>\n </TooltipTrigger>\n <TooltipContent>{t(\"dispatch.sidebar.newChat\")}</TooltipContent>\n </Tooltip>\n </div>\n <div className=\"grid gap-0.5\">\n {visibleThreads.length > 0 ? (\n visibleThreads.map((thread) => {\n const localPathname = localDispatchPath(location.pathname);\n const isActive =\n thread.id ===\n (threadIdFromPath(localPathname) ??\n (localPathname === \"/chat\" ? null : activeThreadId));\n const isRenaming = thread.id === renamingThreadId;\n return (\n <div\n key={thread.id}\n className={cn(\n \"group flex h-8 min-w-0 items-center rounded-md text-sm transition-colors\",\n isActive\n ? \"bg-sidebar-accent text-sidebar-accent-foreground\"\n : \"text-sidebar-foreground/80 hover:bg-sidebar-accent/65 hover:text-sidebar-accent-foreground\",\n )}\n >\n {isRenaming ? (\n <form\n onSubmit={handleRenameSubmit}\n className=\"flex h-full min-w-0 flex-1 items-center px-1.5\"\n >\n <Input\n ref={renameInputRef}\n value={renameDraft}\n onChange={(event) => setRenameDraft(event.target.value)}\n onBlur={() => void commitRenameThread()}\n onKeyDown={(event) => {\n if (event.key === \"Escape\") {\n event.preventDefault();\n cancelRenameThread();\n }\n }}\n maxLength={160}\n aria-label={t(\"dispatch.sidebar.renameThread\", {\n title: threadTitle(\n thread,\n t(\"dispatch.sidebar.newChat\"),\n ),\n })}\n className=\"h-6 min-w-0 rounded-sm border-sidebar-border bg-background px-1.5 text-xs\"\n />\n </form>\n ) : (\n <>\n <button\n type=\"button\"\n onClick={() => openThread(thread.id)}\n className=\"flex h-full min-w-0 flex-1 cursor-pointer items-center px-2 text-start outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <span className=\"min-w-0 flex-1 truncate\">\n {threadTitle(thread, t(\"dispatch.sidebar.newChat\"))}\n </span>\n </button>\n <div className=\"relative flex size-7 shrink-0 items-center justify-end pe-1\">\n <span className=\"text-[11px] text-sidebar-foreground/50 transition-opacity group-hover:opacity-0 group-focus-within:opacity-0\">\n {isActive\n ? \"\"\n : formatThreadAge(\n threadUpdatedAt(thread),\n formatDate,\n )}\n </span>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <button\n type=\"button\"\n aria-label={t(\"dispatch.sidebar.chatOptions\", {\n title: threadTitle(\n thread,\n t(\"dispatch.sidebar.newChat\"),\n ),\n })}\n className=\"absolute end-1 flex size-6 cursor-pointer items-center justify-center rounded-md text-sidebar-foreground/65 opacity-0 transition-opacity hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover:opacity-100 group-focus-within:opacity-100 data-[state=open]:opacity-100\"\n >\n <IconDots className=\"size-4\" />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent\n align=\"end\"\n side=\"right\"\n sideOffset={6}\n >\n <DropdownMenuItem\n onSelect={() => startRenameThread(thread)}\n >\n <IconEdit className=\"size-4\" />\n {t(\"dispatch.sidebar.renameChat\")}\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n </>\n )}\n </div>\n );\n })\n ) : (\n <button\n type=\"button\"\n onClick={handleNewChat}\n className=\"flex h-8 cursor-pointer items-center rounded-md px-2 text-start text-sm text-sidebar-foreground/70 transition-colors hover:bg-sidebar-accent/65 hover:text-sidebar-accent-foreground\"\n >\n <span className=\"truncate\">{t(\"dispatch.sidebar.newChat\")}</span>\n </button>\n )}\n </div>\n </div>\n );\n}\n\nexport function NavContent({\n onNavigate,\n extensions,\n}: {\n onNavigate?: () => void;\n extensions?: DispatchExtensionConfig;\n}) {\n const t = useT();\n const location = useLocation();\n const navigate = useNavigate();\n const { data: workspace } = useActionQuery(\n \"get-workspace-info\",\n {},\n { staleTime: 60_000 },\n );\n const ws = workspace as WorkspaceInfo | undefined;\n const workspaceLabel = ws?.displayName ?? ws?.name ?? null;\n const extensionNavItems = extensions?.navItems ?? EMPTY_NAV_ITEMS;\n const primaryNavItems = [\n ...PRIMARY_NAV_ITEMS,\n ...navItemsForSection(extensionNavItems, \"primary\"),\n ];\n const operationsNavItems = [\n ...OPERATIONS_NAV_ITEMS,\n ...navItemsForSection(extensionNavItems, \"operations\"),\n ];\n const localPathname = localDispatchPath(location.pathname);\n const operationsOpen = operationsNavItems.some((item) =>\n navItemMatchesPath(item, localPathname),\n );\n const navLabel = (item: DispatchNavItem) => {\n const key =\n item.id === \"thread-debug\"\n ? \"threadDebug\"\n : item.id === \"workspace\"\n ? \"resources\"\n : item.id;\n return t(`dispatch.nav.${key}`, { defaultValue: item.label });\n };\n\n const renderNavItem = (item: DispatchNavItem) => {\n const Icon = item.icon;\n const itemMatchesLocalPath = navItemMatchesPath(item, localPathname);\n const label = navLabel(item);\n return (\n <li key={item.id}>\n <NavLink\n to={dispatchNavLinkTarget(item.to)}\n onClick={(event) => {\n if (\n item.id === \"chat\" &&\n localPathname !== \"/chat\" &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.shiftKey &&\n !event.altKey\n ) {\n event.preventDefault();\n navigateWithAgentChatViewTransition(\n navigate,\n dispatchNavLinkTarget(\"/chat\"),\n );\n onNavigate?.();\n return;\n }\n onNavigate?.();\n }}\n className={({ isActive }) => {\n const active = isActive || itemMatchesLocalPath;\n return cn(\n \"flex h-8 w-full items-center gap-2 rounded-md px-2 text-sm\",\n active\n ? \"bg-sidebar-accent font-medium text-sidebar-accent-foreground\"\n : \"text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground\",\n );\n }}\n >\n {Icon ? (\n <Icon size={16} className=\"shrink-0\" />\n ) : (\n <span className=\"h-4 w-4 shrink-0\" aria-hidden=\"true\" />\n )}\n <span className=\"truncate\">{label}</span>\n </NavLink>\n {item.id === \"chat\" && itemMatchesLocalPath ? (\n <DispatchChatsSection onNavigate={onNavigate} />\n ) : null}\n </li>\n );\n };\n\n return (\n <>\n <div className=\"border-b px-4 py-3\">\n <div className=\"flex items-center gap-3\">\n <div className=\"flex h-9 w-9 items-center justify-center rounded-xl border bg-card text-foreground\">\n <img\n src={appPath(\"/agent-native-icon-light.svg\")}\n alt=\"\"\n aria-hidden=\"true\"\n className=\"block h-4 w-auto shrink-0 dark:hidden\"\n />\n <img\n src={appPath(\"/agent-native-icon-dark.svg\")}\n alt=\"\"\n aria-hidden=\"true\"\n className=\"hidden h-4 w-auto shrink-0 dark:block\"\n />\n </div>\n <div className=\"min-w-0\">\n <div className=\"truncate text-sm font-semibold text-foreground\">\n {workspaceLabel ?? \"Dispatch\"}\n </div>\n <div className=\"truncate text-xs text-muted-foreground\">\n {workspaceLabel\n ? t(\"dispatch.sidebar.workspaceSubtitle\", {\n count: ws?.appCount ?? 0,\n })\n : t(\"dispatch.sidebar.workspaceControlPlane\")}\n </div>\n </div>\n </div>\n </div>\n\n <div className=\"flex min-h-0 flex-1 flex-col overflow-y-auto\">\n <nav className=\"px-2 py-3\">\n <ul className=\"space-y-0.5\">{primaryNavItems.map(renderNavItem)}</ul>\n </nav>\n\n <div className=\"mt-auto shrink-0\">\n <div className=\"border-t px-2 py-2\">\n <details className=\"group\" open={operationsOpen}>\n <summary className=\"flex h-8 cursor-pointer list-none items-center justify-between rounded-md px-2 text-xs font-medium uppercase text-sidebar-foreground/50 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground [&::-webkit-details-marker]:hidden\">\n <span>{t(\"dispatch.nav.operations\")}</span>\n <IconChevronDown\n size={14}\n className=\"transition-transform group-open:rotate-180\"\n />\n </summary>\n <ul className=\"mt-1 space-y-0.5\">\n {operationsNavItems.map(renderNavItem)}\n </ul>\n </details>\n </div>\n\n <div className=\"border-t px-2 py-1\">\n <ExtensionsSidebarSection />\n </div>\n\n <div className=\"border-t px-3 py-2\">\n <OrgSwitcher />\n </div>\n\n <div className=\"border-t px-3 py-2\">\n <FeedbackButton />\n </div>\n </div>\n </div>\n </>\n );\n}\n\nexport function Layout({\n children,\n extensions,\n}: {\n children: ReactNode;\n extensions?: DispatchExtensionConfig;\n}) {\n const t = useT();\n const location = useLocation();\n const navigate = useNavigate();\n const [mobileOpen, setMobileOpen] = useState(false);\n const localPathname = localDispatchPath(location.pathname);\n const isChatRoute =\n localPathname === \"/chat\" || localPathname.startsWith(\"/chat/\");\n const chatHomeHandoffActive = useAgentChatHomeHandoff({\n storageKey: \"dispatch\",\n activePath: localPathname,\n enabled: !isChatRoute,\n });\n const chatHandoffLinkOptions = {\n storageKey: \"dispatch\",\n isChatPath: (pathname: string) =>\n pathname === \"/chat\" || pathname.startsWith(\"/chat/\"),\n };\n useAgentChatHomeHandoffLinks(chatHandoffLinkOptions);\n\n if (CHROMELESS_PATHS.some((path) => localPathname === path)) {\n return <>{children}</>;\n }\n\n const showHeader = !isChatRoute && !pageOwnsToolbar(localPathname);\n function openAskAgentFullscreen() {\n focusAgentChat();\n navigateWithAgentChatViewTransition(\n navigate,\n dispatchNavLinkTarget(\"/chat\"),\n );\n }\n const sidebarSuggestions = [\n t(\"dispatch.sidebar.suggestionBuildApp\"),\n t(\"dispatch.sidebar.suggestionRouteSlack\"),\n t(\"dispatch.sidebar.suggestionGrantKey\"),\n ];\n const appContent = (\n <div className=\"flex h-full min-w-0 flex-1 flex-col overflow-hidden\">\n {showHeader ? <Header onOpenMobile={() => setMobileOpen(true)} /> : null}\n <InvitationBanner />\n <main\n className={cn(\n \"flex-1\",\n isChatRoute ? \"min-h-0 overflow-hidden\" : \"overflow-y-auto\",\n )}\n >\n {showHeader ? (\n <div className=\"mx-auto max-w-7xl space-y-10 px-4 py-6 sm:px-6\">\n {children}\n </div>\n ) : (\n children\n )}\n </main>\n </div>\n );\n const content = isChatRoute ? (\n appContent\n ) : (\n <AgentSidebar\n position=\"right\"\n defaultOpen={false}\n chatViewTransition\n storageKey=\"dispatch\"\n openOnChatRunning={chatHomeHandoffActive}\n onFullscreenRequest={openAskAgentFullscreen}\n emptyStateText={t(\"dispatch.sidebar.emptyAgentText\")}\n suggestions={sidebarSuggestions}\n >\n {appContent}\n </AgentSidebar>\n );\n\n return (\n <HeaderActionsProvider>\n <div className=\"flex h-screen w-full overflow-hidden bg-background\">\n <aside className=\"hidden lg:flex w-64 shrink-0 flex-col border-e bg-sidebar text-sidebar-foreground\">\n <NavContent extensions={extensions} />\n </aside>\n\n <Sheet open={mobileOpen} onOpenChange={setMobileOpen}>\n <SheetContent\n side=\"left\"\n className=\"w-72 p-0 bg-sidebar text-sidebar-foreground [&>button]:hidden\"\n >\n <SheetTitle className=\"sr-only\">\n {t(\"dispatch.nav.navigation\")}\n </SheetTitle>\n <SheetDescription className=\"sr-only\">\n {t(\"dispatch.nav.navigationDescription\")}\n </SheetDescription>\n <div className=\"flex h-full w-full flex-col\">\n <NavContent\n extensions={extensions}\n onNavigate={() => setMobileOpen(false)}\n />\n </div>\n </SheetContent>\n </Sheet>\n\n {content}\n </div>\n </HeaderActionsProvider>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"$appId.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/$appId.tsx"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AAiBtB,wBAAgB,IAAI;;IAEnB;AA2CD,wBAAsB,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,kBAAkB,iBAQ1D;AAED,wBAAsB,YAAY,CAAC,EACjC,MAAM,EACN,YAAY,GACb,EAAE,wBAAwB,oBAS1B;AAED,MAAM,CAAC,OAAO,UAAU,yBAAyB,
|
|
1
|
+
{"version":3,"file":"$appId.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/$appId.tsx"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AAiBtB,wBAAgB,IAAI;;IAEnB;AA2CD,wBAAsB,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,kBAAkB,iBAQ1D;AAED,wBAAsB,YAAY,CAAC,EACjC,MAAM,EACN,YAAY,GACb,EAAE,wBAAwB,oBAS1B;AAED,MAAM,CAAC,OAAO,UAAU,yBAAyB,4CAmGhD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useMemo } from "react";
|
|
3
3
|
import { Link, Navigate, redirect, useParams, } from "react-router";
|
|
4
|
-
import { useActionQuery, appPath } from "@agent-native/core/client";
|
|
4
|
+
import { useActionQuery, appPath, useT } from "@agent-native/core/client";
|
|
5
5
|
import { IconArrowLeft, IconArrowUpRight, IconClockHour4, } from "@tabler/icons-react";
|
|
6
6
|
import { DispatchShell } from "../../components/dispatch-shell.js";
|
|
7
7
|
import { Spinner } from "../../components/ui/spinner.js";
|
|
@@ -77,6 +77,7 @@ export async function clientLoader({ params, serverLoader, }) {
|
|
|
77
77
|
return serverLoader();
|
|
78
78
|
}
|
|
79
79
|
export default function WorkspaceAppCatchAllRoute() {
|
|
80
|
+
const t = useT();
|
|
80
81
|
const { appId } = useParams();
|
|
81
82
|
const { data: apps = [], isLoading } = useActionQuery("list-workspace-apps", { includeAgentCards: false }, { refetchInterval: 2_000 });
|
|
82
83
|
const app = useMemo(() => apps.find((item) => item.id === appId) ?? null, [appId, apps]);
|
|
@@ -95,6 +96,6 @@ export default function WorkspaceAppCatchAllRoute() {
|
|
|
95
96
|
if ((isLoading && !app) || (app && app.status !== "pending" && href)) {
|
|
96
97
|
return (_jsx("div", { className: "flex h-screen w-full items-center justify-center", children: _jsx(Spinner, { className: "size-8" }) }));
|
|
97
98
|
}
|
|
98
|
-
return (_jsx(DispatchShell, { title: app?.name || "
|
|
99
|
+
return (_jsx(DispatchShell, { title: app?.name || t("dispatch.pages.pageNotFound"), description: t("dispatch.pages.pageNotFoundDescription"), children: _jsxs("div", { className: "max-w-2xl rounded-lg border bg-card p-5", children: [_jsx(Button, { asChild: true, size: "sm", variant: "ghost", className: "-ml-2 mb-4", children: _jsxs(Link, { to: appPath("/overview"), children: [_jsx(IconArrowLeft, { size: 15, className: "mr-1.5" }), t("dispatch.nav.overview")] }) }), app?.status === "pending" ? (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("h2", { className: "text-base font-semibold text-foreground", children: app.name }), _jsxs(Badge, { variant: "outline", className: "gap-1 border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300", children: [_jsx(IconClockHour4, { size: 12 }), t("dispatch.pages.building")] })] }), _jsxs("p", { className: "text-sm text-muted-foreground", children: [t("dispatch.pages.appBuildingPrefix"), " ", _jsx("span", { className: "font-mono text-foreground", children: app.path }), " ", t("dispatch.pages.appBuildingSuffix")] }), app.branchName ? (_jsx("p", { className: "text-xs text-muted-foreground", children: t("dispatch.pages.branch", { branch: app.branchName }) })) : null, app.builderUrl ? (_jsx(Button, { asChild: true, children: _jsxs("a", { href: app.builderUrl, target: "_blank", rel: "noreferrer", children: [t("dispatch.pages.openBuilderBranch"), _jsx(IconArrowUpRight, { size: 15, className: "ml-1.5" })] }) })) : null] })) : (_jsxs("div", { className: "space-y-3", children: [_jsx("h2", { className: "text-base font-semibold text-foreground", children: t("dispatch.pages.pageNotFound") }), _jsxs("p", { className: "text-sm text-muted-foreground", children: [_jsxs("span", { className: "font-mono text-foreground", children: ["/", appId] }), " isn't", t("dispatch.pages.notDispatchOrWorkspaceApp")] }), _jsx(Button, { asChild: true, children: _jsx(Link, { to: appPath("/apps"), children: t("dispatch.pages.browseApps") }) })] }))] }) }));
|
|
99
100
|
}
|
|
100
101
|
//# sourceMappingURL=$appId.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"$appId.js","sourceRoot":"","sources":["../../../src/routes/pages/$appId.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,SAAS,GAGV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,2B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AC,IAAI,EACP,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAChB,KAAC,MAAM,IAAC,OAAO,kBACb,aAAG,IAAI,EAAE,GAAG,CAAC,UAAU,EAAE,MAAM,EAAC,QAAQ,EAAC,GAAG,EAAC,YAAY,oCAEvD,KAAC,gBAAgB,IAAC,IAAI,EAAE,EAAE,EAAE,SAAS,EAAC,QAAQ,GAAG,IAC/C,GACG,CACV,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC,CAAC,CAAC,CACF,eAAK,SAAS,EAAC,WAAW,aACxB,aAAI,SAAS,EAAC,yCAAyC,+BAElD,EACL,aAAG,SAAS,EAAC,+BAA+B,aAC1C,gBAAM,SAAS,EAAC,2BAA2B,kBAAG,KAAK,IAAQ,mEAEzD,EACJ,KAAC,MAAM,IAAC,OAAO,kBACb,KAAC,IAAI,IAAC,EAAE,EAAE,OAAO,CAAC,OAAO,CAAC,4BAAoB,GACvC,IACL,CACP,IACG,GACQ,CACjB,CAAC;AACJ,CAAC","sourcesContent":["import { useEffect, useMemo } from \"react\";\nimport {\n Link,\n Navigate,\n redirect,\n useParams,\n type ClientLoaderFunctionArgs,\n type LoaderFunctionArgs,\n} from \"react-router\";\nimport { useActionQuery, appPath } from \"@agent-native/core/client\";\nimport {\n IconArrowLeft,\n IconArrowUpRight,\n IconClockHour4,\n} from \"@tabler/icons-react\";\nimport { DispatchShell } from \"@/components/dispatch-shell\";\nimport { Spinner } from \"@/components/ui/spinner\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { Button } from \"@/components/ui/button\";\nimport { resolveServerCatchAllTarget } from \"@/lib/catch-all-target\";\nimport {\n workspaceAppHref,\n type WorkspaceAppSummary,\n} from \"@/lib/workspace-apps\";\n\nexport function meta() {\n return [{ title: \"Workspace app - Dispatch\" }];\n}\n\n/**\n * Catch-all for `/dispatch/<segment>` paths that don't match an explicit\n * Dispatch route. When `<segment>` is the id of a workspace app sibling\n * (e.g. `/dispatch/todo` after Builder.io routes a \"navigate to /todo\"\n * call through Dispatch's mount point), bounce to the absolute `/<appId>`\n * so the user lands on the actual app instead of a 404 inside Dispatch.\n *\n * Server-side redirect: we resolve the workspace app manifest via the\n * shared `loadWorkspaceAppsManifest()` helper, which checks the\n * `AGENT_NATIVE_WORKSPACE_APPS_JSON` env var, then the\n * `.agent-native/workspace-apps.json` file written by `workspace-deploy.ts`,\n * then a live filesystem scan of `apps/` for local dev. We then throw\n * `redirect(\"/<appId>\")`. React Router 7 does not prepend the basename to\n * absolute paths returned from a loader, so the redirect escapes Dispatch's\n * `/dispatch` mount cleanly.\n *\n * Why a catch-all instead of fixing the agent prompt: Builder.io currently\n * resolves \"navigate to /todo\" relative to Dispatch's mount, sending the\n * user to /dispatch/todo. The same wrong path then gets captured as the\n * OAuth callbackURL, so Google sign-in completes back at /dispatch/todo\n * and looks broken. This route fixes both the post-creation navigation\n * and the OAuth round-trip from a single place.\n *\n * Built-in template fallback: when no workspace manifest is available\n * (framework dev with each template on its own port, hosted dispatch with\n * no sibling apps), redirect to the matching first-party template's deploy\n * URL — `http://localhost:<devPort>` in dev, `https://<id>.agent-native.com`\n * in production. Without this, a user visiting `/forms` on dispatch is\n * forced to sign in (auth guard) and then lands on this route's \"Page not\n * found\" pane after the post-login reload.\n *\n * `appId === \"dispatch\"` short-circuit: when the segment matches Dispatch\n * itself (e.g. `/dispatch/dispatch`), we go straight to the overview rather\n * than chaining through `/dispatch` (which polled `useActionQuery` re-fired\n * `window.location.assign` against and looped forever in production).\n */\nfunction dispatchSelfRedirect(appId: string | undefined): string | null {\n if (appId === \"dispatch\") return appPath(\"/overview\");\n return null;\n}\n\nexport async function loader({ params }: LoaderFunctionArgs) {\n const appId = params.appId;\n if (!appId) return null;\n const selfTarget = dispatchSelfRedirect(appId);\n if (selfTarget) throw redirect(selfTarget);\n const target = await resolveServerCatchAllTarget(appId);\n if (target) throw redirect(target);\n return null;\n}\n\nexport async function clientLoader({\n params,\n serverLoader,\n}: ClientLoaderFunctionArgs) {\n const selfTarget = dispatchSelfRedirect(params.appId);\n if (selfTarget) throw redirect(selfTarget);\n // Defer to the server loader so the built-in template fallback runs on\n // SPA navigations too (e.g. clicking a `/<template-id>` link inside\n // dispatch). Without this the client side would only check the workspace\n // apps query, which never lists the static first-party templates and so\n // the user would land on the \"Page not found\" pane.\n return serverLoader();\n}\n\nexport default function WorkspaceAppCatchAllRoute() {\n const { appId } = useParams();\n const { data: apps = [], isLoading } = useActionQuery(\n \"list-workspace-apps\",\n { includeAgentCards: false },\n { refetchInterval: 2_000 },\n );\n const app = useMemo(\n () =>\n (apps as WorkspaceAppSummary[]).find((item) => item.id === appId) ?? null,\n [appId, apps],\n );\n const href = app ? workspaceAppHref(app) : null;\n const isSelfReference = appId === \"dispatch\";\n\n useEffect(() => {\n if (isSelfReference) return;\n if (!app || app.status === \"pending\" || !href) return;\n window.location.assign(href);\n }, [app, href, isSelfReference]);\n\n if (isSelfReference) {\n return <Navigate to={appPath(\"/overview\")} replace />;\n }\n\n if ((isLoading && !app) || (app && app.status !== \"pending\" && href)) {\n return (\n <div className=\"flex h-screen w-full items-center justify-center\">\n <Spinner className=\"size-8\" />\n </div>\n );\n }\n\n return (\n <DispatchShell\n title={app?.name || \"Page not found\"}\n description=\"This route is not in the workspace app list yet.\"\n >\n <div className=\"max-w-2xl rounded-lg border bg-card p-5\">\n <Button asChild size=\"sm\" variant=\"ghost\" className=\"-ml-2 mb-4\">\n <Link to={appPath(\"/overview\")}>\n <IconArrowLeft size={15} className=\"mr-1.5\" />\n Overview\n </Link>\n </Button>\n\n {app?.status === \"pending\" ? (\n <div className=\"space-y-4\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <h2 className=\"text-base font-semibold text-foreground\">\n {app.name}\n </h2>\n <Badge\n variant=\"outline\"\n className=\"gap-1 border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300\"\n >\n <IconClockHour4 size={12} />\n Building\n </Badge>\n </div>\n <p className=\"text-sm text-muted-foreground\">\n This app is being created. It will be available at{\" \"}\n <span className=\"font-mono text-foreground\">{app.path}</span>{\" \"}\n after its branch is merged and the workspace deploy finishes.\n </p>\n {app.branchName ? (\n <p className=\"text-xs text-muted-foreground\">\n Branch: {app.branchName}\n </p>\n ) : null}\n {app.builderUrl ? (\n <Button asChild>\n <a href={app.builderUrl} target=\"_blank\" rel=\"noreferrer\">\n Open Builder branch\n <IconArrowUpRight size={15} className=\"ml-1.5\" />\n </a>\n </Button>\n ) : null}\n </div>\n ) : (\n <div className=\"space-y-3\">\n <h2 className=\"text-base font-semibold text-foreground\">\n Page not found\n </h2>\n <p className=\"text-sm text-muted-foreground\">\n <span className=\"font-mono text-foreground\">/{appId}</span> isn't\n a Dispatch tab or a workspace app in this workspace.\n </p>\n <Button asChild>\n <Link to={appPath(\"/apps\")}>Browse apps</Link>\n </Button>\n </div>\n )}\n </div>\n </DispatchShell>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"$appId.js","sourceRoot":"","sources":["../../../src/routes/pages/$appId.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,SAAS,GAGV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EACL,gBAAgB,GAEjB,MAAM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EAAE,MAAM,EAAC,QAAQ,EAAC,GAAG,EAAC,YAAY,aACtD,CAAC,CAAC,kCAAkC,CAAC,EACtC,KAAC,gBAAgB,IAAC,IAAI,EAAE,EAAE,EAAE,SAAS,EAAC,QAAQ,GAAG,IAC/C,GACG,CACV,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC,CAAC,CAAC,CACF,eAAK,SAAS,EAAC,WAAW,aACxB,aAAI,SAAS,EAAC,yCAAyC,YACpD,CAAC,CAAC,6BAA6B,CAAC,GAC9B,EACL,aAAG,SAAS,EAAC,+BAA+B,aAC1C,gBAAM,SAAS,EAAC,2BAA2B,kBAAG,KAAK,IAAQ,YAC1D,CAAC,CAAC,0CAA0C,CAAC,IAC5C,EACJ,KAAC,MAAM,IAAC,OAAO,kBACb,KAAC,IAAI,IAAC,EAAE,EAAE,OAAO,CAAC,OAAO,CAAC,YACvB,CAAC,CAAC,2BAA2B,CAAC,GAC1B,GACA,IACL,CACP,IACG,GACQ,CACjB,CAAC;AACJ,CAAC","sourcesContent":["import { useEffect, useMemo } from \"react\";\nimport {\n Link,\n Navigate,\n redirect,\n useParams,\n type ClientLoaderFunctionArgs,\n type LoaderFunctionArgs,\n} from \"react-router\";\nimport { useActionQuery, appPath, useT } from \"@agent-native/core/client\";\nimport {\n IconArrowLeft,\n IconArrowUpRight,\n IconClockHour4,\n} from \"@tabler/icons-react\";\nimport { DispatchShell } from \"@/components/dispatch-shell\";\nimport { Spinner } from \"@/components/ui/spinner\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { Button } from \"@/components/ui/button\";\nimport { resolveServerCatchAllTarget } from \"@/lib/catch-all-target\";\nimport {\n workspaceAppHref,\n type WorkspaceAppSummary,\n} from \"@/lib/workspace-apps\";\n\nexport function meta() {\n return [{ title: \"Workspace app - Dispatch\" }];\n}\n\n/**\n * Catch-all for `/dispatch/<segment>` paths that don't match an explicit\n * Dispatch route. When `<segment>` is the id of a workspace app sibling\n * (e.g. `/dispatch/todo` after Builder.io routes a \"navigate to /todo\"\n * call through Dispatch's mount point), bounce to the absolute `/<appId>`\n * so the user lands on the actual app instead of a 404 inside Dispatch.\n *\n * Server-side redirect: we resolve the workspace app manifest via the\n * shared `loadWorkspaceAppsManifest()` helper, which checks the\n * `AGENT_NATIVE_WORKSPACE_APPS_JSON` env var, then the\n * `.agent-native/workspace-apps.json` file written by `workspace-deploy.ts`,\n * then a live filesystem scan of `apps/` for local dev. We then throw\n * `redirect(\"/<appId>\")`. React Router 7 does not prepend the basename to\n * absolute paths returned from a loader, so the redirect escapes Dispatch's\n * `/dispatch` mount cleanly.\n *\n * Why a catch-all instead of fixing the agent prompt: Builder.io currently\n * resolves \"navigate to /todo\" relative to Dispatch's mount, sending the\n * user to /dispatch/todo. The same wrong path then gets captured as the\n * OAuth callbackURL, so Google sign-in completes back at /dispatch/todo\n * and looks broken. This route fixes both the post-creation navigation\n * and the OAuth round-trip from a single place.\n *\n * Built-in template fallback: when no workspace manifest is available\n * (framework dev with each template on its own port, hosted dispatch with\n * no sibling apps), redirect to the matching first-party template's deploy\n * URL — `http://localhost:<devPort>` in dev, `https://<id>.agent-native.com`\n * in production. Without this, a user visiting `/forms` on dispatch is\n * forced to sign in (auth guard) and then lands on this route's \"Page not\n * found\" pane after the post-login reload.\n *\n * `appId === \"dispatch\"` short-circuit: when the segment matches Dispatch\n * itself (e.g. `/dispatch/dispatch`), we go straight to the overview rather\n * than chaining through `/dispatch` (which polled `useActionQuery` re-fired\n * `window.location.assign` against and looped forever in production).\n */\nfunction dispatchSelfRedirect(appId: string | undefined): string | null {\n if (appId === \"dispatch\") return appPath(\"/overview\");\n return null;\n}\n\nexport async function loader({ params }: LoaderFunctionArgs) {\n const appId = params.appId;\n if (!appId) return null;\n const selfTarget = dispatchSelfRedirect(appId);\n if (selfTarget) throw redirect(selfTarget);\n const target = await resolveServerCatchAllTarget(appId);\n if (target) throw redirect(target);\n return null;\n}\n\nexport async function clientLoader({\n params,\n serverLoader,\n}: ClientLoaderFunctionArgs) {\n const selfTarget = dispatchSelfRedirect(params.appId);\n if (selfTarget) throw redirect(selfTarget);\n // Defer to the server loader so the built-in template fallback runs on\n // SPA navigations too (e.g. clicking a `/<template-id>` link inside\n // dispatch). Without this the client side would only check the workspace\n // apps query, which never lists the static first-party templates and so\n // the user would land on the \"Page not found\" pane.\n return serverLoader();\n}\n\nexport default function WorkspaceAppCatchAllRoute() {\n const t = useT();\n const { appId } = useParams();\n const { data: apps = [], isLoading } = useActionQuery(\n \"list-workspace-apps\",\n { includeAgentCards: false },\n { refetchInterval: 2_000 },\n );\n const app = useMemo(\n () =>\n (apps as WorkspaceAppSummary[]).find((item) => item.id === appId) ?? null,\n [appId, apps],\n );\n const href = app ? workspaceAppHref(app) : null;\n const isSelfReference = appId === \"dispatch\";\n\n useEffect(() => {\n if (isSelfReference) return;\n if (!app || app.status === \"pending\" || !href) return;\n window.location.assign(href);\n }, [app, href, isSelfReference]);\n\n if (isSelfReference) {\n return <Navigate to={appPath(\"/overview\")} replace />;\n }\n\n if ((isLoading && !app) || (app && app.status !== \"pending\" && href)) {\n return (\n <div className=\"flex h-screen w-full items-center justify-center\">\n <Spinner className=\"size-8\" />\n </div>\n );\n }\n\n return (\n <DispatchShell\n title={app?.name || t(\"dispatch.pages.pageNotFound\")}\n description={t(\"dispatch.pages.pageNotFoundDescription\")}\n >\n <div className=\"max-w-2xl rounded-lg border bg-card p-5\">\n <Button asChild size=\"sm\" variant=\"ghost\" className=\"-ml-2 mb-4\">\n <Link to={appPath(\"/overview\")}>\n <IconArrowLeft size={15} className=\"mr-1.5\" />\n {t(\"dispatch.nav.overview\")}\n </Link>\n </Button>\n\n {app?.status === \"pending\" ? (\n <div className=\"space-y-4\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <h2 className=\"text-base font-semibold text-foreground\">\n {app.name}\n </h2>\n <Badge\n variant=\"outline\"\n className=\"gap-1 border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300\"\n >\n <IconClockHour4 size={12} />\n {t(\"dispatch.pages.building\")}\n </Badge>\n </div>\n <p className=\"text-sm text-muted-foreground\">\n {t(\"dispatch.pages.appBuildingPrefix\")}{\" \"}\n <span className=\"font-mono text-foreground\">{app.path}</span>{\" \"}\n {t(\"dispatch.pages.appBuildingSuffix\")}\n </p>\n {app.branchName ? (\n <p className=\"text-xs text-muted-foreground\">\n {t(\"dispatch.pages.branch\", { branch: app.branchName })}\n </p>\n ) : null}\n {app.builderUrl ? (\n <Button asChild>\n <a href={app.builderUrl} target=\"_blank\" rel=\"noreferrer\">\n {t(\"dispatch.pages.openBuilderBranch\")}\n <IconArrowUpRight size={15} className=\"ml-1.5\" />\n </a>\n </Button>\n ) : null}\n </div>\n ) : (\n <div className=\"space-y-3\">\n <h2 className=\"text-base font-semibold text-foreground\">\n {t(\"dispatch.pages.pageNotFound\")}\n </h2>\n <p className=\"text-sm text-muted-foreground\">\n <span className=\"font-mono text-foreground\">/{appId}</span> isn't\n {t(\"dispatch.pages.notDispatchOrWorkspaceApp\")}\n </p>\n <Button asChild>\n <Link to={appPath(\"/apps\")}>\n {t(\"dispatch.pages.browseApps\")}\n </Link>\n </Button>\n </div>\n )}\n </div>\n </DispatchShell>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/agents.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/agents.tsx"],"names":[],"mappings":"AAeA,wBAAgB,IAAI;;IAEnB;AAgLD,MAAM,CAAC,OAAO,UAAU,WAAW,4CAkBlC"}
|