@agent-native/dispatch 0.23.3 → 0.23.5
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/actions/provider-api-register.d.ts +11 -11
- package/dist/components/app-list-row.d.ts +1 -1
- package/dist/components/app-list-row.d.ts.map +1 -1
- package/dist/components/app-list-row.js +2 -2
- package/dist/components/app-list-row.js.map +1 -1
- package/dist/components/create-app-popover.d.ts.map +1 -1
- package/dist/components/create-app-popover.js +11 -0
- package/dist/components/create-app-popover.js.map +1 -1
- package/dist/components/dispatch-control-plane.d.ts.map +1 -1
- package/dist/components/dispatch-control-plane.js +3 -2
- package/dist/components/dispatch-control-plane.js.map +1 -1
- package/dist/components/layout/Layout.d.ts +1 -0
- package/dist/components/layout/Layout.d.ts.map +1 -1
- package/dist/components/layout/Layout.js +41 -3
- package/dist/components/layout/Layout.js.map +1 -1
- package/dist/components/layout/workspace-apps-rail.d.ts.map +1 -1
- package/dist/components/layout/workspace-apps-rail.js +2 -2
- package/dist/components/layout/workspace-apps-rail.js.map +1 -1
- package/dist/components/other-apps-section.d.ts.map +1 -1
- package/dist/components/other-apps-section.js +5 -1
- package/dist/components/other-apps-section.js.map +1 -1
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/lib/other-apps.d.ts.map +1 -1
- package/dist/lib/other-apps.js +2 -0
- package/dist/lib/other-apps.js.map +1 -1
- package/dist/lib/workspace-apps.d.ts +3 -0
- package/dist/lib/workspace-apps.d.ts.map +1 -1
- package/dist/lib/workspace-apps.js +10 -0
- package/dist/lib/workspace-apps.js.map +1 -1
- package/dist/routes/pages/apps.d.ts.map +1 -1
- package/dist/routes/pages/apps.js +2 -1
- package/dist/routes/pages/apps.js.map +1 -1
- package/dist/server/plugins/auth.d.ts.map +1 -1
- package/dist/server/plugins/auth.js +1 -0
- package/dist/server/plugins/auth.js.map +1 -1
- package/package.json +3 -3
- package/src/components/app-list-row.tsx +3 -2
- package/src/components/create-app-popover.spec.tsx +26 -2
- package/src/components/create-app-popover.tsx +10 -0
- package/src/components/dispatch-control-plane.spec.tsx +1 -0
- package/src/components/dispatch-control-plane.tsx +8 -2
- package/src/components/layout/Layout.spec.tsx +9 -0
- package/src/components/layout/Layout.tsx +71 -4
- package/src/components/layout/workspace-apps-rail.tsx +2 -1
- package/src/components/other-apps-section.tsx +8 -1
- package/src/config.ts +2 -0
- package/src/lib/other-apps.spec.ts +26 -0
- package/src/lib/other-apps.ts +3 -0
- package/src/lib/workspace-apps.spec.ts +24 -1
- package/src/lib/workspace-apps.ts +15 -0
- package/src/routes/pages/apps.tsx +5 -2
- package/src/server/plugins/auth.spec.ts +45 -0
- package/src/server/plugins/auth.ts +1 -0
|
@@ -16,7 +16,7 @@ import { createContext, useEffect, useMemo, useRef, useState, useContext, useCal
|
|
|
16
16
|
import { Link, useLocation, useNavigate } from "react-router";
|
|
17
17
|
import { toast } from "sonner";
|
|
18
18
|
import { cn } from "../../lib/utils.js";
|
|
19
|
-
import { mergeChatFirstWorkspaceApps, workspaceAppIdFromRoute, workspaceAppRoute, } from "../../lib/workspace-apps.js";
|
|
19
|
+
import { isDispatchWorkspaceAppId, isWorkspaceAppVisibleInDefaultLaunchers, mergeChatFirstWorkspaceApps, workspaceAppIdFromRoute, workspaceAppRoute, } from "../../lib/workspace-apps.js";
|
|
20
20
|
import { AppIcon } from "../app-icon.js";
|
|
21
21
|
import { CreateAppPopover } from "../create-app-popover.js";
|
|
22
22
|
import { Sheet, SheetContent, SheetDescription, SheetTitle } from "../ui/sheet.js";
|
|
@@ -115,6 +115,9 @@ function localDispatchPath(pathname) {
|
|
|
115
115
|
}
|
|
116
116
|
return pathname;
|
|
117
117
|
}
|
|
118
|
+
export function isElectronEmbeddedSearch(search) {
|
|
119
|
+
return new URLSearchParams(search).get("electron") === "1";
|
|
120
|
+
}
|
|
118
121
|
function chatFirstPrimaryTabForPath(pathname) {
|
|
119
122
|
if (pathname === "/chat" || pathname.startsWith("/chat/")) {
|
|
120
123
|
return "new-chat";
|
|
@@ -608,6 +611,9 @@ export function Layout({ children, extensions, agentPageHref, }) {
|
|
|
608
611
|
}
|
|
609
612
|
});
|
|
610
613
|
const localPathname = localDispatchPath(location.pathname);
|
|
614
|
+
const [electronEmbedded] = useState(() => typeof window !== "undefined"
|
|
615
|
+
? isElectronEmbeddedSearch(window.location.search)
|
|
616
|
+
: false);
|
|
611
617
|
const isChatRoute = localPathname === "/chat" || localPathname.startsWith("/chat/");
|
|
612
618
|
const chatFirstSurfaceScope = threadIdFromPath(localPathname) ?? "new";
|
|
613
619
|
const isWorkspaceAppRoute = localPathname.startsWith("/apps/");
|
|
@@ -619,6 +625,15 @@ export function Layout({ children, extensions, agentPageHref, }) {
|
|
|
619
625
|
new URLSearchParams(window.location.search).get("chatFirst") === "1";
|
|
620
626
|
const chatFirstMode = extensions?.chatFirst === true || chatFirstPreference || chatFirstEmbedded;
|
|
621
627
|
const chatFirstHasActiveChat = chatFirstSurfaceScope !== "new";
|
|
628
|
+
useEffect(() => {
|
|
629
|
+
if (!electronEmbedded || typeof window === "undefined")
|
|
630
|
+
return;
|
|
631
|
+
const url = new URL(window.location.href);
|
|
632
|
+
if (isElectronEmbeddedSearch(url.search))
|
|
633
|
+
return;
|
|
634
|
+
url.searchParams.set("electron", "1");
|
|
635
|
+
window.history.replaceState(window.history.state, "", `${url.pathname}${url.search}${url.hash}`);
|
|
636
|
+
}, [electronEmbedded, location.pathname, location.search]);
|
|
622
637
|
useEffect(() => {
|
|
623
638
|
if (!chatFirstMode || chatFirstEmbedded || localPathname !== "/overview") {
|
|
624
639
|
return;
|
|
@@ -655,7 +670,7 @@ export function Layout({ children, extensions, agentPageHref, }) {
|
|
|
655
670
|
return [...registrations.values()];
|
|
656
671
|
}, [chatFirstGrantedAppsQuery.data?.apps, chatFirstWorkspaceApps]);
|
|
657
672
|
const chatFirstAppItems = useMemo(() => chatFirstAppRegistrations
|
|
658
|
-
.filter((app) => app.enabled)
|
|
673
|
+
.filter((app) => app.enabled && isWorkspaceAppVisibleInDefaultLaunchers(app))
|
|
659
674
|
.map((app) => ({
|
|
660
675
|
id: app.id,
|
|
661
676
|
name: app.name ?? app.id,
|
|
@@ -893,13 +908,28 @@ export function Layout({ children, extensions, agentPageHref, }) {
|
|
|
893
908
|
setChatFirstNotice(chatFirstResolutionMessage(resolution.reason));
|
|
894
909
|
return;
|
|
895
910
|
}
|
|
911
|
+
if (isDispatchWorkspaceAppId(resolution.target.appId)) {
|
|
912
|
+
closeChatFirstSessionWatch();
|
|
913
|
+
chatFirstSurfaceTabsStore.closeAll();
|
|
914
|
+
setChatFirstSurfacePanelOpen(false);
|
|
915
|
+
persistChatFirstPane(null);
|
|
916
|
+
if (resolution.target.path) {
|
|
917
|
+
navigateWithAgentChatViewTransition(navigate, dispatchNavLinkTarget(resolution.target.path));
|
|
918
|
+
}
|
|
919
|
+
return;
|
|
920
|
+
}
|
|
896
921
|
openChatFirstPane(resolution.target);
|
|
897
922
|
}, [
|
|
898
923
|
chatFirstAppRegistrations,
|
|
899
924
|
chatFirstAppsQuery.isError,
|
|
900
925
|
chatFirstAppsQuery.isLoading,
|
|
901
926
|
chatFirstGrantedAppsQuery.isLoading,
|
|
927
|
+
chatFirstSurfaceTabsStore,
|
|
928
|
+
closeChatFirstSessionWatch,
|
|
902
929
|
openChatFirstPane,
|
|
930
|
+
navigate,
|
|
931
|
+
persistChatFirstPane,
|
|
932
|
+
setChatFirstSurfacePanelOpen,
|
|
903
933
|
]);
|
|
904
934
|
const chatHomeHandoffActive = useAgentChatHomeHandoff({
|
|
905
935
|
storageKey: "dispatch",
|
|
@@ -1228,6 +1258,9 @@ export function Layout({ children, extensions, agentPageHref, }) {
|
|
|
1228
1258
|
if (CHROMELESS_PATHS.some((path) => localPathname === path)) {
|
|
1229
1259
|
return _jsx(_Fragment, { children: children });
|
|
1230
1260
|
}
|
|
1261
|
+
if (electronEmbedded) {
|
|
1262
|
+
return (_jsx(DispatchExtensionsContext.Provider, { value: extensions, children: _jsx(HeaderActionsProvider, { children: _jsx("div", { "data-dispatch-electron-control-plane": true, className: "flex h-screen w-full overflow-hidden bg-background", children: _jsxs("div", { className: "relative flex min-w-0 flex-1 flex-col overflow-hidden", children: [_jsx(Header, { showAgentToggle: false }), _jsx(InvitationBanner, {}), _jsx("main", { className: "flex-1 overflow-y-auto", children: _jsx("div", { className: "mx-auto max-w-7xl space-y-10 px-4 py-6 sm:px-6", children: children }) })] }) }) }) }));
|
|
1263
|
+
}
|
|
1231
1264
|
if (isWorkspaceAppHostRoute) {
|
|
1232
1265
|
return (_jsx(DispatchExtensionsContext.Provider, { value: extensions, children: _jsx(HeaderActionsProvider, { children: _jsx("div", { "data-dispatch-workspace-app-chrome-less": true, className: "h-screen w-full overflow-hidden bg-background", children: children }) }) }));
|
|
1233
1266
|
}
|
|
@@ -1264,7 +1297,12 @@ export function Layout({ children, extensions, agentPageHref, }) {
|
|
|
1264
1297
|
closeChatFirstSessionWatch();
|
|
1265
1298
|
chatFirstSurfaceTabsStore.closeAll();
|
|
1266
1299
|
setChatFirstSurfacePanelOpen(false);
|
|
1267
|
-
}, onChatFirstAppOpen: (app) =>
|
|
1300
|
+
}, onChatFirstAppOpen: (app) => {
|
|
1301
|
+
if (isDispatchWorkspaceAppId(app.id))
|
|
1302
|
+
return;
|
|
1303
|
+
setSidebarCollapsed(true);
|
|
1304
|
+
navigate(dispatchNavLinkTarget(workspaceAppRoute(app.id)));
|
|
1305
|
+
}, onChatFirstAppsRetry: () => void chatFirstAppsQuery.refetch(), collapsible: true, onCollapsedChange: setSidebarCollapsed }) }), _jsx(Sheet, { open: mobileOpen, onOpenChange: setMobileOpen, children: _jsxs(SheetContent, { side: "left", className: "w-72 bg-sidebar p-0 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, chatFirstMode: chatFirstMode, chatFirstEmbedded: chatFirstEmbedded, collapsed: false, chatFirstAppLayout: chatFirstAppLayout, onChatFirstAppLayoutChange: persistChatFirstAppLayout, chatFirstApps: chatFirstAppItems, chatFirstAppsLoading: chatFirstAppsQuery.isLoading, chatFirstAppsError: chatFirstAppsQuery.isError
|
|
1268
1306
|
? chatFirstCopy("appsLoadError")
|
|
1269
1307
|
: null, chatFirstActiveAppId: chatFirstActiveAppId, chatFirstActivePrimaryTab: chatFirstActivePrimaryTab, onChatFirstNewChat: () => {
|
|
1270
1308
|
closeChatFirstSessionWatch();
|