@agent-native/dispatch 0.41.1-nightly-20261104110058 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -55
- package/dist/actions/get-hosted-apps-settings.d.ts +5 -0
- package/dist/actions/get-hosted-apps-settings.d.ts.map +1 -0
- package/dist/actions/get-hosted-apps-settings.js +25 -0
- package/dist/actions/get-hosted-apps-settings.js.map +1 -0
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/index.js +4 -0
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/list-connected-agents.d.ts +1 -0
- package/dist/actions/list-connected-agents.js +11 -10
- package/dist/actions/list-connected-agents.js.map +1 -1
- package/dist/actions/list_apps.js +3 -2
- package/dist/actions/list_apps.js.map +1 -1
- package/dist/actions/provider-api-register.d.ts +10 -10
- package/dist/actions/set-hosted-apps-settings.d.ts +7 -0
- package/dist/actions/set-hosted-apps-settings.d.ts.map +1 -0
- package/dist/actions/set-hosted-apps-settings.js +35 -0
- package/dist/actions/set-hosted-apps-settings.js.map +1 -0
- package/dist/components/app-card-tiers.d.ts +13 -0
- package/dist/components/app-card-tiers.d.ts.map +1 -0
- package/dist/components/app-card-tiers.js +22 -0
- package/dist/components/app-card-tiers.js.map +1 -0
- package/dist/components/app-list-row.d.ts +12 -4
- package/dist/components/app-list-row.d.ts.map +1 -1
- package/dist/components/app-list-row.js +19 -4
- package/dist/components/app-list-row.js.map +1 -1
- package/dist/components/app-open-actions.d.ts +4 -0
- package/dist/components/app-open-actions.d.ts.map +1 -1
- package/dist/components/app-open-actions.js +9 -0
- package/dist/components/app-open-actions.js.map +1 -1
- package/dist/components/app-pin-button.d.ts +9 -0
- package/dist/components/app-pin-button.d.ts.map +1 -0
- package/dist/components/app-pin-button.js +29 -0
- package/dist/components/app-pin-button.js.map +1 -0
- package/dist/components/app-tier-sections.d.ts +27 -0
- package/dist/components/app-tier-sections.d.ts.map +1 -0
- package/dist/components/app-tier-sections.js +44 -0
- package/dist/components/app-tier-sections.js.map +1 -0
- package/dist/components/chat-home-apps.d.ts.map +1 -1
- package/dist/components/chat-home-apps.js +19 -26
- package/dist/components/chat-home-apps.js.map +1 -1
- package/dist/components/connected-app-card.d.ts +3 -1
- package/dist/components/connected-app-card.d.ts.map +1 -1
- package/dist/components/connected-app-card.js +6 -3
- package/dist/components/connected-app-card.js.map +1 -1
- package/dist/components/create-app-popover.d.ts +4 -0
- package/dist/components/create-app-popover.d.ts.map +1 -1
- package/dist/components/create-app-popover.js +6 -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 +25 -35
- package/dist/components/dispatch-control-plane.js.map +1 -1
- package/dist/components/hosted-apps-settings-group.d.ts +6 -0
- package/dist/components/hosted-apps-settings-group.d.ts.map +1 -0
- package/dist/components/hosted-apps-settings-group.js +76 -0
- package/dist/components/hosted-apps-settings-group.js.map +1 -0
- package/dist/components/layout/Layout.d.ts +6 -4
- package/dist/components/layout/Layout.d.ts.map +1 -1
- package/dist/components/layout/Layout.js +97 -80
- package/dist/components/layout/Layout.js.map +1 -1
- package/dist/components/workspace-app-card.d.ts.map +1 -1
- package/dist/components/workspace-app-card.js +9 -20
- package/dist/components/workspace-app-card.js.map +1 -1
- package/dist/components/workspace-app-layout-notice.d.ts +9 -0
- package/dist/components/workspace-app-layout-notice.d.ts.map +1 -0
- package/dist/components/workspace-app-layout-notice.js +27 -0
- package/dist/components/workspace-app-layout-notice.js.map +1 -0
- package/dist/components/workspace-app-search.d.ts.map +1 -1
- package/dist/components/workspace-app-search.js +11 -5
- package/dist/components/workspace-app-search.js.map +1 -1
- package/dist/components/workspace-template-card.d.ts.map +1 -1
- package/dist/components/workspace-template-card.js +7 -2
- package/dist/components/workspace-template-card.js.map +1 -1
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +1 -0
- package/dist/db/index.js.map +1 -1
- package/dist/lib/other-apps.d.ts +10 -1
- package/dist/lib/other-apps.d.ts.map +1 -1
- package/dist/lib/other-apps.js +7 -1
- package/dist/lib/other-apps.js.map +1 -1
- package/dist/lib/workspace-app-layout.d.ts +62 -6
- package/dist/lib/workspace-app-layout.d.ts.map +1 -1
- package/dist/lib/workspace-app-layout.js +196 -41
- package/dist/lib/workspace-app-layout.js.map +1 -1
- package/dist/lib/workspace-app-lists.d.ts +17 -0
- package/dist/lib/workspace-app-lists.d.ts.map +1 -0
- package/dist/lib/workspace-app-lists.js +21 -0
- package/dist/lib/workspace-app-lists.js.map +1 -0
- package/dist/lib/workspace-apps.d.ts +3 -1
- package/dist/lib/workspace-apps.d.ts.map +1 -1
- package/dist/lib/workspace-apps.js +5 -1
- 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 +23 -35
- package/dist/routes/pages/apps.js.map +1 -1
- package/dist/routes/pages/settings-page.d.ts.map +1 -1
- package/dist/routes/pages/settings-page.js +24 -3
- package/dist/routes/pages/settings-page.js.map +1 -1
- package/dist/server/lib/app-creation-store.d.ts.map +1 -1
- package/dist/server/lib/app-creation-store.js +13 -18
- package/dist/server/lib/app-creation-store.js.map +1 -1
- package/dist/server/lib/app-roles.d.ts +2 -0
- package/dist/server/lib/app-roles.d.ts.map +1 -1
- package/dist/server/lib/app-roles.js +26 -7
- package/dist/server/lib/app-roles.js.map +1 -1
- package/dist/server/lib/hosted-apps-settings-schema.d.ts +6 -0
- package/dist/server/lib/hosted-apps-settings-schema.d.ts.map +1 -0
- package/dist/server/lib/hosted-apps-settings-schema.js +6 -0
- package/dist/server/lib/hosted-apps-settings-schema.js.map +1 -0
- package/dist/server/lib/hosted-apps-settings.d.ts +27 -0
- package/dist/server/lib/hosted-apps-settings.d.ts.map +1 -0
- package/dist/server/lib/hosted-apps-settings.js +72 -0
- package/dist/server/lib/hosted-apps-settings.js.map +1 -0
- package/dist/server/plugins/agent-chat.js +6 -3
- package/dist/server/plugins/agent-chat.js.map +1 -1
- package/dist/server/plugins/integrations.js +3 -3
- package/dist/server/plugins/integrations.js.map +1 -1
- package/dist/shared/hosted-apps-settings.d.ts +3 -0
- package/dist/shared/hosted-apps-settings.d.ts.map +1 -0
- package/dist/shared/hosted-apps-settings.js +3 -0
- package/dist/shared/hosted-apps-settings.js.map +1 -0
- package/package.json +4 -4
- package/src/actions/get-hosted-apps-settings.ts +29 -0
- package/src/actions/hosted-apps-settings.spec.ts +100 -0
- package/src/actions/index.ts +4 -0
- package/src/actions/list-connected-agents.spec.ts +67 -0
- package/src/actions/list-connected-agents.ts +14 -15
- package/src/actions/list_apps.spec.ts +16 -0
- package/src/actions/list_apps.ts +5 -2
- package/src/actions/set-hosted-apps-settings.ts +42 -0
- package/src/components/app-card-tiers.tsx +85 -0
- package/src/components/app-list-row.spec.tsx +54 -0
- package/src/components/app-list-row.tsx +50 -8
- package/src/components/app-open-actions.tsx +16 -0
- package/src/components/app-pin-button.spec.tsx +68 -0
- package/src/components/app-pin-button.tsx +66 -0
- package/src/components/app-tier-sections.spec.tsx +155 -0
- package/src/components/app-tier-sections.tsx +158 -0
- package/src/components/chat-home-apps.spec.tsx +135 -29
- package/src/components/chat-home-apps.tsx +115 -111
- package/src/components/connected-app-card.spec.tsx +18 -2
- package/src/components/connected-app-card.tsx +18 -1
- package/src/components/create-app-popover.tsx +22 -0
- package/src/components/dispatch-control-plane.spec.tsx +89 -20
- package/src/components/dispatch-control-plane.tsx +91 -125
- package/src/components/hosted-apps-settings-group.spec.tsx +218 -0
- package/src/components/hosted-apps-settings-group.tsx +189 -0
- package/src/components/layout/Layout.spec.tsx +356 -49
- package/src/components/layout/Layout.tsx +189 -142
- package/src/components/workspace-app-card.spec.tsx +33 -29
- package/src/components/workspace-app-card.tsx +13 -31
- package/src/components/workspace-app-layout-notice.spec.tsx +106 -0
- package/src/components/workspace-app-layout-notice.tsx +65 -0
- package/src/components/workspace-app-search.spec.tsx +53 -0
- package/src/components/workspace-app-search.tsx +39 -32
- package/src/components/workspace-template-card.spec.tsx +10 -0
- package/src/components/workspace-template-card.tsx +7 -2
- package/src/db/index.spec.ts +9 -0
- package/src/db/index.ts +1 -0
- package/src/lib/other-apps.spec.ts +25 -0
- package/src/lib/other-apps.ts +9 -0
- package/src/lib/workspace-app-layout.spec.ts +61 -3
- package/src/lib/workspace-app-layout.store.spec.tsx +261 -0
- package/src/lib/workspace-app-layout.ts +265 -48
- package/src/lib/workspace-app-lists.ts +32 -0
- package/src/lib/workspace-apps.ts +10 -2
- package/src/routes/pages/apps.spec.tsx +133 -5
- package/src/routes/pages/apps.tsx +79 -140
- package/src/routes/pages/chat.spec.tsx +66 -49
- package/src/routes/pages/settings-page.tsx +31 -3
- package/src/routes/pages/settings.spec.tsx +37 -0
- package/src/server/lib/app-creation-store.spec.ts +14 -0
- package/src/server/lib/app-creation-store.ts +16 -29
- package/src/server/lib/app-creation-store.write-observation.spec.ts +216 -0
- package/src/server/lib/app-roles.spec.ts +48 -1
- package/src/server/lib/app-roles.ts +44 -12
- package/src/server/lib/hosted-apps-settings-schema.ts +6 -0
- package/src/server/lib/hosted-apps-settings.spec.ts +154 -0
- package/src/server/lib/hosted-apps-settings.ts +108 -0
- package/src/server/plugins/agent-chat.spec.ts +16 -0
- package/src/server/plugins/agent-chat.ts +7 -2
- package/src/server/plugins/integrations.ts +3 -3
- package/src/shared/hosted-apps-settings.ts +3 -0
- package/src/styles/dispatch.css +40 -11
- package/dist/components/available-apps-section.d.ts +0 -9
- package/dist/components/available-apps-section.d.ts.map +0 -1
- package/dist/components/available-apps-section.js +0 -97
- package/dist/components/available-apps-section.js.map +0 -1
- package/dist/components/other-apps-section.d.ts +0 -35
- package/dist/components/other-apps-section.d.ts.map +0 -1
- package/dist/components/other-apps-section.js +0 -79
- package/dist/components/other-apps-section.js.map +0 -1
- package/src/components/available-apps-section.tsx +0 -239
- package/src/components/other-apps-section.spec.ts +0 -50
- package/src/components/other-apps-section.tsx +0 -254
|
@@ -3,6 +3,7 @@ import { type FeatureFlagState } from "@agent-native/core/client/feature-flags";
|
|
|
3
3
|
import type { ChatFirstPrimaryTab } from "@agent-native/toolkit/app/chat/chat-first/primary-nav";
|
|
4
4
|
import type { ChatFirstAppItem, ChatFirstCopy } from "@agent-native/toolkit/app/chat/chat-first/types";
|
|
5
5
|
import { type ComponentType, type ReactNode } from "react";
|
|
6
|
+
import { type WorkspaceAppsStatus } from "../../lib/workspace-app-layout.js";
|
|
6
7
|
import { type WorkspaceAppSummary } from "../../lib/workspace-apps.js";
|
|
7
8
|
export { buildChatFirstEmbedSessionInput } from "../workspace-app-host.js";
|
|
8
9
|
export type DispatchNavSection = "primary" | "operations";
|
|
@@ -37,9 +38,9 @@ export interface DispatchNavContentProps extends DispatchSidebarBrandProps {
|
|
|
37
38
|
collapsible?: boolean;
|
|
38
39
|
onCollapsedChange?: (collapsed: boolean) => void;
|
|
39
40
|
chatFirstAppLayout?: ChatFirstAppLayoutPreference;
|
|
40
|
-
|
|
41
|
+
onChatFirstTogglePinned?: (appId: string) => void;
|
|
41
42
|
chatFirstApps?: readonly ChatFirstAppItem[];
|
|
42
|
-
|
|
43
|
+
chatFirstAppsStatus?: WorkspaceAppsStatus;
|
|
43
44
|
chatFirstAppsError?: string | null;
|
|
44
45
|
chatFirstActiveAppId?: string;
|
|
45
46
|
chatFirstActivePrimaryTab?: ChatFirstPrimaryTab;
|
|
@@ -55,8 +56,9 @@ export interface DispatchLayoutProps extends DispatchSidebarBrandProps {
|
|
|
55
56
|
}
|
|
56
57
|
export declare const CHAT_FIRST_SURFACE_PANEL_TOGGLE_CLASS_NAME = "absolute right-3 top-2 z-20";
|
|
57
58
|
interface DispatchWorkspaceAppLauncher {
|
|
59
|
+
/** Empty until `workspaceAppsStatus` is "ready". */
|
|
58
60
|
workspaceApps: readonly WorkspaceAppSummary[];
|
|
59
|
-
|
|
61
|
+
workspaceAppsStatus: WorkspaceAppsStatus;
|
|
60
62
|
error?: unknown;
|
|
61
63
|
errorQueryName?: "list-workspace-apps" | "list-connected-agents";
|
|
62
64
|
openApp: (app: ChatFirstAppItem) => void;
|
|
@@ -74,7 +76,7 @@ export declare function shouldQueryChatFirstApps(isChatRoute: boolean, chatFirst
|
|
|
74
76
|
*/
|
|
75
77
|
export declare function isRedesignedSettingsPath(pathname: string, settingsRedesign: FeatureFlagState): boolean;
|
|
76
78
|
export declare function dispatchNavLinkTarget(path: string): string;
|
|
77
|
-
export declare function NavContent({ onNavigate, extensions, brandName, brandIcon, chatFirstMode, chatFirstEmbedded, collapsed, collapsible, onCollapsedChange, chatFirstAppLayout,
|
|
79
|
+
export declare function NavContent({ onNavigate, extensions, brandName, brandIcon, chatFirstMode, chatFirstEmbedded, collapsed, collapsible, onCollapsedChange, chatFirstAppLayout, onChatFirstTogglePinned, chatFirstApps, chatFirstAppsStatus, chatFirstAppsError, chatFirstActiveAppId, chatFirstActivePrimaryTab, onChatFirstNewChat, onChatFirstAppOpen, onChatFirstAppsRetry, }: DispatchNavContentProps): import("node_modules/@types/react").JSX.Element;
|
|
78
80
|
export declare function renderChatFirstAppSurfaceTab({ registration, embedPath, loading, isMobileSurface, copy, }: {
|
|
79
81
|
registration: ChatFirstAppRegistration | null;
|
|
80
82
|
embedPath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Layout.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAgBL,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EAWlC,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,yCAAyC,CAAC;AAWjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAC;AACjG,OAAO,KAAK,EAEV,gBAAgB,EAEhB,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E_CHANGED_EVENT, chatFirstSurfaceTabId, closeChatFirstSessionWatch, emitChatFirstSessionWatch, getChatFirstSurfaceTabsStore, navigateWithAgentChatViewTransition,
|
|
2
|
+
import { CHAT_FIRST_MODE_CHANGED_EVENT, chatFirstSurfaceTabId, closeChatFirstSessionWatch, emitChatFirstSessionWatch, getChatFirstSurfaceTabsStore, navigateWithAgentChatViewTransition, readChatFirstMode, resolveChatFirstBrowserTarget, resolveChatFirstAppTarget, subscribeChatFirstOpenBrowser, subscribeChatFirstOpenApp, useChatFirstSessionWatch, useChatFirstSurfacePanel, useChatFirstSurfaceResize, useChatFirstSurfaceTabs, useAgentChatHomeHandoff, useAgentChatHomeHandoffLinks, useChatThreads, } from "@agent-native/core/client/agent-chat";
|
|
3
3
|
import { appBasePath, appPath } from "@agent-native/core/client/api-path";
|
|
4
4
|
import { readClientAppState, writeClientAppState, } from "@agent-native/core/client/application-state";
|
|
5
5
|
import { useFeatureFlagState, } from "@agent-native/core/client/feature-flags";
|
|
@@ -24,7 +24,7 @@ import { useIsMobile } from "../../hooks/use-mobile.js";
|
|
|
24
24
|
import { getDispatchRunThreadContext } from "../../lib/dispatch-run-thread.js";
|
|
25
25
|
import { filterBuiltInApps, } from "../../lib/other-apps.js";
|
|
26
26
|
import { cn } from "../../lib/utils.js";
|
|
27
|
-
import {
|
|
27
|
+
import { tierWorkspaceApps, useWorkspaceAppLayout, appListsStatus, } from "../../lib/workspace-app-layout.js";
|
|
28
28
|
import { isDispatchWorkspaceAppId, isPathMountedWorkspaceApp, isWorkspaceAppVisibleInDefaultLaunchers, isWorkspaceSsoApp, mergeChatFirstWorkspaceApps, navigateToWorkspaceApp, shouldOpenWorkspaceAppInTopWindow, workspaceAppIdFromRoute, workspaceAppDirectHref, workspaceAppDirectLaunchHref, workspaceAppRoute, workspaceAppTargetPath, } from "../../lib/workspace-apps.js";
|
|
29
29
|
import { CHAT_FIRST_PANE_STATE_KEY } from "../../shared/chat-first-pane.js";
|
|
30
30
|
import { AppIcon } from "../app-icon.js";
|
|
@@ -34,6 +34,7 @@ import { Button } from "../ui/button.js";
|
|
|
34
34
|
import { Sheet, SheetContent, SheetDescription, SheetTitle } from "../ui/sheet.js";
|
|
35
35
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "../ui/tooltip.js";
|
|
36
36
|
import { WorkspaceAppChatRail, WorkspaceAppFrame, WorkspaceAppKeepAlive, } from "../workspace-app-host.js";
|
|
37
|
+
import { AppNotice, WorkspaceAppLayoutNotice, } from "../workspace-app-layout-notice.js";
|
|
37
38
|
import { Header } from "./Header.js";
|
|
38
39
|
import { HeaderActionsProvider, useHeaderActions, useHeaderTitle, } from "./HeaderActions.js";
|
|
39
40
|
export { buildChatFirstEmbedSessionInput } from "../workspace-app-host.js";
|
|
@@ -84,9 +85,18 @@ const BOTTOM_NAV_ITEMS = [
|
|
|
84
85
|
const EMPTY_NAV_ITEMS = [];
|
|
85
86
|
const DISPATCH_SIDEBAR_LABEL = "Dispatch";
|
|
86
87
|
const CHROMELESS_PATHS = ["/approval", "/browser-chat", "/browser-connect"];
|
|
88
|
+
// With nothing pinned, the sidebar suggests this many apps; All apps has the rest.
|
|
89
|
+
const CHAT_FIRST_RAIL_SUGGESTED_APPS = 3;
|
|
90
|
+
const NO_CHAT_FIRST_APPS = [];
|
|
87
91
|
const SIDEBAR_COLLAPSE_KEY = "dispatch.sidebar.collapsed";
|
|
88
92
|
const CHAT_HISTORY_SOURCE_KEY = "dispatch.chat-history.source";
|
|
89
93
|
export const CHAT_FIRST_SURFACE_PANEL_TOGGLE_CLASS_NAME = "absolute right-3 top-2 z-20";
|
|
94
|
+
function appIds(apps) {
|
|
95
|
+
return apps.map((app) => app.id);
|
|
96
|
+
}
|
|
97
|
+
function renderChatFirstRailIcon(app) {
|
|
98
|
+
return (_jsx(AppIcon, { id: app.id, name: app.name, size: "sm", className: "size-7 rounded-lg" }));
|
|
99
|
+
}
|
|
90
100
|
const DispatchExtensionsContext = createContext(undefined);
|
|
91
101
|
const DispatchWorkspaceAppLauncherContext = createContext(null);
|
|
92
102
|
export function useDispatchExtensions() {
|
|
@@ -201,11 +211,8 @@ const DISPATCH_CHAT_FIRST_COPY_KEYS = {
|
|
|
201
211
|
noWorkspaceApps: "chatFirstNoWorkspaceApps",
|
|
202
212
|
createApp: "chatFirstCreateApp",
|
|
203
213
|
retry: "chatFirstRetry",
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
pinApp: "chatFirstPinApp",
|
|
207
|
-
removePinned: "chatFirstRemovePinned",
|
|
208
|
-
pinTop: "chatFirstPinTop",
|
|
214
|
+
unpinApp: "unpinApp",
|
|
215
|
+
pinApp: "pinApp",
|
|
209
216
|
openSideSurfaces: "chatFirstOpenSideSurfaces",
|
|
210
217
|
closeTab: "chatFirstCloseTab",
|
|
211
218
|
close: "chatFirstClose",
|
|
@@ -223,30 +230,11 @@ const DISPATCH_CHAT_FIRST_COPY_KEYS = {
|
|
|
223
230
|
browserClose: "chatFirstBrowserClose",
|
|
224
231
|
browserPage: "chatFirstBrowserPage",
|
|
225
232
|
browserInvalidUrl: "chatFirstBrowserInvalidUrl",
|
|
226
|
-
browserPreviewStarting: "chatFirstBrowserPreviewStarting",
|
|
227
|
-
browserPreviewError: "chatFirstBrowserPreviewError",
|
|
228
233
|
appUnavailable: "chatFirstAppUnavailable",
|
|
229
234
|
appLoading: "chatFirstLoadingApp",
|
|
230
|
-
agentActivityEyebrow: "chatFirstAgentActivityEyebrow",
|
|
231
|
-
agentActivityTitle: "chatFirstAgentActivityTitle",
|
|
232
|
-
agentActivityDescription: "chatFirstAgentActivityDescription",
|
|
233
|
-
refreshAgentActivity: "chatFirstRefreshAgentActivity",
|
|
234
|
-
noAgentSessions: "chatFirstNoAgentSessions",
|
|
235
|
-
startAgentSession: "chatFirstStartAgentSession",
|
|
236
235
|
watchSession: "chatFirstWatchSession",
|
|
237
236
|
copySessionId: "chatFirstCopySessionId",
|
|
238
|
-
copySessionIdFor: "chatFirstCopySessionIdFor",
|
|
239
237
|
sessionIdCopied: "chatFirstSessionIdCopied",
|
|
240
|
-
sessionIdShort: "chatFirstSessionIdShort",
|
|
241
|
-
copied: "chatFirstCopied",
|
|
242
|
-
agentActivityStatusQueued: "chatFirstAgentActivityStatusQueued",
|
|
243
|
-
agentActivityStatusRunning: "chatFirstAgentActivityStatusRunning",
|
|
244
|
-
agentActivityStatusPaused: "chatFirstAgentActivityStatusPaused",
|
|
245
|
-
agentActivityStatusNeedsApproval: "chatFirstAgentActivityStatusNeedsApproval",
|
|
246
|
-
agentActivityStatusCompleted: "chatFirstAgentActivityStatusCompleted",
|
|
247
|
-
agentActivityStatusErrored: "chatFirstAgentActivityStatusErrored",
|
|
248
|
-
agentActivityStatusRecent: "chatFirstAgentActivityStatusRecent",
|
|
249
|
-
agentActivityStatusUnknown: "chatFirstAgentActivityStatusUnknown",
|
|
250
238
|
watchingSession: "chatFirstWatchingSession",
|
|
251
239
|
session: "chatFirstSession",
|
|
252
240
|
stopWatchingSession: "chatFirstStopWatchingSession",
|
|
@@ -296,8 +284,12 @@ function createDispatchChatFirstCopy(t) {
|
|
|
296
284
|
}
|
|
297
285
|
}
|
|
298
286
|
const translationKey = DISPATCH_CHAT_FIRST_COPY_KEYS[key];
|
|
299
|
-
if (!translationKey)
|
|
300
|
-
return
|
|
287
|
+
if (!translationKey) {
|
|
288
|
+
return t(`agentChat.chatFirst.${key}`, {
|
|
289
|
+
...(values ?? {}),
|
|
290
|
+
defaultValue: defaultChatFirstCopy(key, values),
|
|
291
|
+
});
|
|
292
|
+
}
|
|
301
293
|
return t(`dispatch.pages.${translationKey}`, {
|
|
302
294
|
...(values ?? {}),
|
|
303
295
|
defaultValue: defaultChatFirstCopy(key, values),
|
|
@@ -357,7 +349,7 @@ function readChatHistoryIncludesExternal() {
|
|
|
357
349
|
return false;
|
|
358
350
|
}
|
|
359
351
|
}
|
|
360
|
-
function DispatchChatsSection({ onNavigate, showNewChat = false,
|
|
352
|
+
function DispatchChatsSection({ onNavigate, showNewChat = false, appsRail, chatFirstMode = false, chatFirstEmbedded = false, collapsed = false, chatFirstNavigation, }) {
|
|
361
353
|
const t = useT();
|
|
362
354
|
const chatFirstCopy = useMemo(() => createDispatchChatFirstCopy(t), [t]);
|
|
363
355
|
const navigate = useNavigate();
|
|
@@ -436,13 +428,21 @@ function DispatchChatsSection({ onNavigate, showNewChat = false, prelude, chatFi
|
|
|
436
428
|
? t("dispatch.sidebar.showLocalChats")
|
|
437
429
|
: t("dispatch.sidebar.showAllChats") })] }));
|
|
438
430
|
const collapsedChatFirst = collapsed && chatFirstMode;
|
|
439
|
-
|
|
431
|
+
const showChatFirstHistory = !collapsedChatFirst &&
|
|
432
|
+
chatFirstMode &&
|
|
433
|
+
(history.loading ||
|
|
434
|
+
history.sections.some((section) => section.items.length > 0 || section.error != null));
|
|
435
|
+
// The source toggle filters every section, so it sits in the first header.
|
|
436
|
+
const chatFirstHistorySections = history.sections.map((section, index) => index === 0
|
|
437
|
+
? {
|
|
438
|
+
...section,
|
|
439
|
+
label: (_jsxs("div", { className: "flex flex-1 items-center justify-between gap-2", children: [_jsx("span", { children: section.label }), sourceToggle] })),
|
|
440
|
+
}
|
|
441
|
+
: section);
|
|
442
|
+
return (_jsxs("div", { className: cn("min-w-0", showNewChat ? "dispatch-chat-first-chats" : "space-y-0.5"), children: [showNewChat && chatFirstNavigation ? (_jsx("nav", { className: cn("space-y-0.5 py-2", collapsed ? "px-1.5" : "px-2"), children: _jsx(ChatFirstPrimaryNavigation, { copy: chatFirstCopy, onNewChat: () => {
|
|
440
443
|
chatFirstNavigation.onNewChat?.();
|
|
441
444
|
void handleNewChat();
|
|
442
|
-
}, onOpenIntegrations: chatFirstNavigation.onOpenIntegrations, onOpenScheduled: chatFirstNavigation.onOpenScheduled, onSearch: openCommandMenu, activeTab: chatFirstNavigation.activeTab, collapsed: collapsed }) })) : null,
|
|
443
|
-
chatFirstMode &&
|
|
444
|
-
(history.loading ||
|
|
445
|
-
history.sections.some((section) => section.items.length > 0 || section.error)) ? (_jsx(ChatFirstChatHistory, { sections: history.sections, ...history.listProps, onDelete: listProps.onDelete, onNewChat: () => void handleNewChat(), showNewChat: false, railLabels: history.railLabels, activeId: displayedActiveThreadId, label: t("dispatch.sidebar.chats"), onSelect: (threadId) => openThread(threadId), renameMaxLength: 160, labels: {
|
|
445
|
+
}, onOpenIntegrations: chatFirstNavigation.onOpenIntegrations, onOpenScheduled: chatFirstNavigation.onOpenScheduled, onSearch: openCommandMenu, activeTab: chatFirstNavigation.activeTab, collapsed: collapsed }) })) : null, !collapsedChatFirst && !showChatFirstHistory ? (_jsx("div", { className: "flex justify-end px-2 pt-0.5", children: sourceToggle })) : null, showChatFirstHistory ? (_jsx(ChatFirstChatHistory, { sections: chatFirstHistorySections, ...history.listProps, onDelete: listProps.onDelete, onNewChat: () => void handleNewChat(), showNewChat: false, railLabels: history.railLabels, activeId: displayedActiveThreadId, label: t("dispatch.sidebar.chats"), onSelect: (threadId) => openThread(threadId), renameMaxLength: 160, labels: {
|
|
446
446
|
options: (item) => t("dispatch.sidebar.chatOptions", {
|
|
447
447
|
title: item.titleText ?? "",
|
|
448
448
|
}),
|
|
@@ -492,9 +492,9 @@ function DispatchChatsSection({ onNavigate, showNewChat = false, prelude, chatFi
|
|
|
492
492
|
kind: "agent-chat",
|
|
493
493
|
sourceSessionId: displayedActiveThreadId ?? undefined,
|
|
494
494
|
});
|
|
495
|
-
}, children: chatFirstCopy("watchSession") })) : null] })), className: "min-w-0 px-2" })) : null] }));
|
|
495
|
+
}, children: chatFirstCopy("watchSession") })) : null] })), className: "min-w-0 px-2" })) : null, appsRail] }));
|
|
496
496
|
}
|
|
497
|
-
export function NavContent({ onNavigate, extensions, brandName = DISPATCH_SIDEBAR_LABEL, brandIcon, chatFirstMode = false, chatFirstEmbedded = false, collapsed = false, collapsible = false, onCollapsedChange, chatFirstAppLayout,
|
|
497
|
+
export function NavContent({ onNavigate, extensions, brandName = DISPATCH_SIDEBAR_LABEL, brandIcon, chatFirstMode = false, chatFirstEmbedded = false, collapsed = false, collapsible = false, onCollapsedChange, chatFirstAppLayout, onChatFirstTogglePinned, chatFirstApps = NO_CHAT_FIRST_APPS, chatFirstAppsStatus = "ready", chatFirstAppsError, chatFirstActiveAppId, chatFirstActivePrimaryTab, onChatFirstNewChat, onChatFirstAppOpen, onChatFirstAppsRetry, }) {
|
|
498
498
|
const t = useT();
|
|
499
499
|
const chatFirstCopy = useMemo(() => createDispatchChatFirstCopy(t), [t]);
|
|
500
500
|
const location = useLocation();
|
|
@@ -517,14 +517,51 @@ export function NavContent({ onNavigate, extensions, brandName = DISPATCH_SIDEBA
|
|
|
517
517
|
? t("sidebar.expandSidebar")
|
|
518
518
|
: t("sidebar.collapseSidebar"), className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-sidebar-foreground/65 transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground", children: collapsed ? (_jsx(IconLayoutSidebarLeftExpand, { className: "h-4 w-4 rtl:-scale-x-100" })) : (_jsx(IconLayoutSidebarLeftCollapse, { className: "h-4 w-4 rtl:-scale-x-100" })) }) }), _jsx(TooltipContent, { side: "right", children: collapsed ? t("sidebar.expandSidebar") : t("sidebar.collapseSidebar") })] })) : null;
|
|
519
519
|
const feedbackButton = (_jsx(FeedbackButton, { variant: collapsed ? "icon" : "sidebar", side: "right" }));
|
|
520
|
-
const chatFirstCreateAppTrigger = (_jsx(CreateAppPopover, { align: "start", trigger: _jsx("button", { type: "button", className: "flex size-6 items-center justify-center rounded text-sidebar-foreground/55 hover:bg-sidebar-accent hover:text-sidebar-foreground", "aria-label": chatFirstCopy("createWorkspaceApp"), title: chatFirstCopy("createWorkspaceApp"), children: _jsx(IconPlus, { size: 14, "aria-hidden": "true" }) }) }));
|
|
521
|
-
const
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
520
|
+
const chatFirstCreateAppTrigger = useMemo(() => (_jsx(CreateAppPopover, { align: "start", trigger: _jsx("button", { type: "button", className: "flex size-6 items-center justify-center rounded text-sidebar-foreground/55 hover:bg-sidebar-accent hover:text-sidebar-foreground", "aria-label": chatFirstCopy("createWorkspaceApp"), title: chatFirstCopy("createWorkspaceApp"), children: _jsx(IconPlus, { size: 14, "aria-hidden": "true" }) }) })), [chatFirstCopy]);
|
|
521
|
+
const chatFirstAppTiers = useMemo(() => tierWorkspaceApps(chatFirstApps, chatFirstAppLayout ?? { pinnedIds: [], orderedIds: [] }), [chatFirstAppLayout, chatFirstApps]);
|
|
522
|
+
// One section: the user's pins, or until they pin something, a few apps
|
|
523
|
+
// (workspace apps first, else hosted ones). The open app always shows.
|
|
524
|
+
const chatFirstAppSections = useMemo(() => {
|
|
525
|
+
const { pinned, apps, hosted } = chatFirstAppTiers;
|
|
526
|
+
const ids = appIds(pinned.length > 0
|
|
527
|
+
? pinned
|
|
528
|
+
: (apps.length > 0 ? apps : hosted).slice(0, CHAT_FIRST_RAIL_SUGGESTED_APPS));
|
|
529
|
+
if (chatFirstActiveAppId &&
|
|
530
|
+
!ids.includes(chatFirstActiveAppId) &&
|
|
531
|
+
chatFirstApps.some((app) => app.id === chatFirstActiveAppId)) {
|
|
532
|
+
ids.push(chatFirstActiveAppId);
|
|
533
|
+
}
|
|
534
|
+
return [
|
|
535
|
+
{
|
|
536
|
+
id: pinned.length > 0 ? "pinned" : "apps",
|
|
537
|
+
label: pinned.length > 0
|
|
538
|
+
? t("dispatch.pages.pinnedApps")
|
|
539
|
+
: t("dispatch.nav.apps"),
|
|
540
|
+
appIds: ids,
|
|
541
|
+
action: chatFirstCreateAppTrigger,
|
|
542
|
+
...(chatFirstAppsStatus === "ready" && ids.length === 0
|
|
543
|
+
? { emptyLabel: chatFirstCopy("noWorkspaceApps") }
|
|
544
|
+
: {}),
|
|
545
|
+
},
|
|
546
|
+
];
|
|
547
|
+
}, [
|
|
548
|
+
chatFirstActiveAppId,
|
|
549
|
+
chatFirstAppTiers,
|
|
550
|
+
chatFirstApps,
|
|
551
|
+
chatFirstAppsStatus,
|
|
552
|
+
chatFirstCopy,
|
|
553
|
+
chatFirstCreateAppTrigger,
|
|
554
|
+
t,
|
|
555
|
+
]);
|
|
556
|
+
const openChatFirstRailApp = useCallback((app) => {
|
|
557
|
+
onChatFirstAppOpen?.(app);
|
|
558
|
+
onNavigate?.();
|
|
559
|
+
}, [onChatFirstAppOpen, onNavigate]);
|
|
560
|
+
const openChatFirstAllApps = useCallback(() => {
|
|
561
|
+
void navigate(dispatchNavLinkTarget("/apps"));
|
|
562
|
+
onNavigate?.();
|
|
563
|
+
}, [navigate, onNavigate]);
|
|
564
|
+
const chatFirstAppsRail = (_jsx(ChatFirstAppsRail, { apps: chatFirstApps, sections: chatFirstAppSections, activeAppId: chatFirstActiveAppId, activeTab: chatFirstActivePrimaryTab, collapsed: collapsed, grayscaleInactiveIcons: false, loading: chatFirstAppsStatus === "loading", error: chatFirstAppsError, layout: chatFirstAppLayout, onTogglePinned: onChatFirstTogglePinned, onRetry: onChatFirstAppsRetry, onOpenApp: openChatFirstRailApp, onOpenAllApps: openChatFirstAllApps, createAppTrigger: chatFirstCreateAppTrigger, renderIcon: renderChatFirstRailIcon, copy: chatFirstCopy }));
|
|
528
565
|
const renderNavItem = (item) => {
|
|
529
566
|
const Icon = item.icon;
|
|
530
567
|
const itemMatchesLocalPath = navItemMatchesPath(item, localPathname);
|
|
@@ -573,7 +610,7 @@ export function NavContent({ onNavigate, extensions, brandName = DISPATCH_SIDEBA
|
|
|
573
610
|
void navigate(dispatchNavLinkTarget("/admin/automations"));
|
|
574
611
|
onNavigate?.();
|
|
575
612
|
},
|
|
576
|
-
},
|
|
613
|
+
}, appsRail: chatFirstAppsRail }) })) : null, !chatFirstMode ? (_jsx("div", { className: "min-h-0 flex-1 overflow-y-auto", children: _jsx("nav", { className: cn("py-2", collapsed ? "px-1.5" : "px-2"), children: _jsx("ul", { className: cn(collapsed ? "flex flex-col items-center gap-1" : "space-y-0.5"), children: primaryNavItems.map(renderNavItem) }) }) })) : null, _jsxs("div", { className: "mt-auto shrink-0", "data-dispatch-sidebar-footer": chatFirstMode ? "chat-first" : "standard", children: [bottomNavigation, _jsx(AppSidebarFooter, { collapsed: collapsed, collapsible: false, feedback: feedbackButton, orgSwitcher: _jsx(OrgSwitcher, { compact: collapsed, reserveSpace: true, currentAppId: "dispatch", className: cn("!bg-transparent !text-primary hover:!bg-accent/60 hover:!text-primary", collapsed ? "!size-9 !p-0 [&>svg]:!size-4" : "min-w-0 flex-1") }), footerExtras: collapseButton })] })] }));
|
|
577
614
|
}
|
|
578
615
|
export function renderChatFirstAppSurfaceTab({ registration, embedPath, loading, isMobileSurface, copy, }) {
|
|
579
616
|
if (!registration) {
|
|
@@ -643,18 +680,18 @@ function DispatchLayout({ children, extensions, agentPageHref, notice, brandName
|
|
|
643
680
|
url.searchParams.set("electron", "1");
|
|
644
681
|
window.history.replaceState(window.history.state, "", `${url.pathname}${url.search}${url.hash}`);
|
|
645
682
|
}, [electronEmbedded, location.pathname, location.search]);
|
|
646
|
-
const
|
|
647
|
-
|
|
683
|
+
const { layout: chatFirstAppLayout, togglePinned: toggleChatFirstAppPinned } = useWorkspaceAppLayout({
|
|
684
|
+
hydrate: chatFirstMode,
|
|
685
|
+
});
|
|
648
686
|
const chatFirstAppsQuery = useActionQuery("list-workspace-apps", { includeAgentCards: false, includeArchived: true }, {
|
|
649
687
|
enabled: shouldQueryChatFirstApps(isChatRoute, chatFirstMode) ||
|
|
650
688
|
workspaceAppRouteActive,
|
|
651
689
|
});
|
|
652
690
|
const chatFirstConnectedAppsQuery = useActionQuery("list-connected-agents", {}, { enabled: shouldQueryChatFirstApps(isChatRoute, chatFirstMode) });
|
|
653
|
-
const chatFirstBuiltinApps = useMemo(() => filterBuiltInApps(chatFirstConnectedAppsQuery.data ?? [], chatFirstAppsQuery.data ?? []), [chatFirstAppsQuery.data, chatFirstConnectedAppsQuery.data]);
|
|
691
|
+
const chatFirstBuiltinApps = useMemo(() => filterBuiltInApps(chatFirstConnectedAppsQuery.data ?? [], chatFirstAppsQuery.data ?? [], { includeHiddenFromLaunchers: true }), [chatFirstAppsQuery.data, chatFirstConnectedAppsQuery.data]);
|
|
654
692
|
const chatFirstEnabledBuiltinAppIds = useMemo(() => chatFirstBuiltinApps.map((app) => app.id), [chatFirstBuiltinApps]);
|
|
655
693
|
const chatFirstWorkspaceAppsLoading = chatFirstAppsQuery.isLoading;
|
|
656
694
|
const chatFirstConnectedAppsLoading = chatFirstConnectedAppsQuery.isLoading;
|
|
657
|
-
const chatFirstAppsLoading = chatFirstWorkspaceAppsLoading || chatFirstConnectedAppsLoading;
|
|
658
695
|
const chatFirstAppsFailed = chatFirstAppsQuery.isError;
|
|
659
696
|
const chatFirstAppsError = chatFirstAppsQuery.error ?? chatFirstConnectedAppsQuery.error;
|
|
660
697
|
const chatFirstAppsErrorQueryName = chatFirstAppsQuery.error != null
|
|
@@ -662,18 +699,22 @@ function DispatchLayout({ children, extensions, agentPageHref, notice, brandName
|
|
|
662
699
|
: chatFirstConnectedAppsQuery.error != null
|
|
663
700
|
? "list-connected-agents"
|
|
664
701
|
: undefined;
|
|
702
|
+
const chatFirstWorkspaceAppsStatus = appListsStatus(chatFirstAppsQuery, chatFirstConnectedAppsQuery);
|
|
665
703
|
const chatFirstResolvableApps = useMemo(() => mergeChatFirstWorkspaceApps(chatFirstAppsQuery.data, chatFirstEnabledBuiltinAppIds, chatFirstBuiltinApps.map((app) => ({
|
|
666
704
|
id: app.id,
|
|
667
705
|
name: app.name,
|
|
668
706
|
description: app.description,
|
|
669
707
|
url: app.homeUrl?.trim() || app.url,
|
|
670
708
|
source: "builtin",
|
|
709
|
+
hiddenFromLaunchers: app.hiddenFromLaunchers,
|
|
671
710
|
}))).filter((app) => app.status !== "pending" && app.archived !== true), [
|
|
672
711
|
chatFirstAppsQuery.data,
|
|
673
712
|
chatFirstBuiltinApps,
|
|
674
713
|
chatFirstEnabledBuiltinAppIds,
|
|
675
714
|
]);
|
|
676
|
-
const chatFirstWorkspaceApps = useMemo(() =>
|
|
715
|
+
const chatFirstWorkspaceApps = useMemo(() => chatFirstWorkspaceAppsStatus === "ready"
|
|
716
|
+
? chatFirstResolvableApps.filter(isWorkspaceAppVisibleInDefaultLaunchers)
|
|
717
|
+
: [], [chatFirstResolvableApps, chatFirstWorkspaceAppsStatus]);
|
|
677
718
|
const chatFirstAppRegistrations = useMemo(() => {
|
|
678
719
|
return chatFirstResolvableApps.map((app) => ({
|
|
679
720
|
id: app.id,
|
|
@@ -722,7 +763,7 @@ function DispatchLayout({ children, extensions, agentPageHref, notice, brandName
|
|
|
722
763
|
}, [chatFirstAppRegistrations, navigate]);
|
|
723
764
|
const chatHomeAppLauncher = useMemo(() => ({
|
|
724
765
|
workspaceApps: chatFirstWorkspaceApps,
|
|
725
|
-
|
|
766
|
+
workspaceAppsStatus: chatFirstWorkspaceAppsStatus,
|
|
726
767
|
error: chatFirstAppsError,
|
|
727
768
|
errorQueryName: chatFirstAppsErrorQueryName,
|
|
728
769
|
openApp: openChatFirstApp,
|
|
@@ -733,10 +774,10 @@ function DispatchLayout({ children, extensions, agentPageHref, notice, brandName
|
|
|
733
774
|
}), [
|
|
734
775
|
chatFirstAppsError,
|
|
735
776
|
chatFirstAppsErrorQueryName,
|
|
736
|
-
chatFirstAppsLoading,
|
|
737
777
|
chatFirstAppsQuery.refetch,
|
|
738
778
|
chatFirstConnectedAppsQuery.refetch,
|
|
739
779
|
chatFirstWorkspaceApps,
|
|
780
|
+
chatFirstWorkspaceAppsStatus,
|
|
740
781
|
openChatFirstApp,
|
|
741
782
|
]);
|
|
742
783
|
const chatFirstCopy = useMemo(() => createDispatchChatFirstCopy(t), [t]);
|
|
@@ -945,30 +986,6 @@ function DispatchLayout({ children, extensions, agentPageHref, notice, brandName
|
|
|
945
986
|
window.addEventListener(CHAT_FIRST_MODE_CHANGED_EVENT, handleModeChange);
|
|
946
987
|
return () => window.removeEventListener(CHAT_FIRST_MODE_CHANGED_EVENT, handleModeChange);
|
|
947
988
|
}, []);
|
|
948
|
-
useEffect(() => {
|
|
949
|
-
if (!chatFirstMode ||
|
|
950
|
-
!isChatRoute ||
|
|
951
|
-
chatFirstAppLayoutHydratedRef.current) {
|
|
952
|
-
return;
|
|
953
|
-
}
|
|
954
|
-
chatFirstAppLayoutHydratedRef.current = true;
|
|
955
|
-
void readClientAppState("chat-first-app-layout")
|
|
956
|
-
.then((value) => {
|
|
957
|
-
if (!value || typeof value !== "object")
|
|
958
|
-
return;
|
|
959
|
-
setChatFirstAppLayout(normalizeWorkspaceAppLayout(value));
|
|
960
|
-
})
|
|
961
|
-
.catch(() => {
|
|
962
|
-
// Device-local layout remains the fallback when workspace state is unavailable.
|
|
963
|
-
});
|
|
964
|
-
}, [chatFirstMode, isChatRoute]);
|
|
965
|
-
const persistChatFirstAppLayout = useCallback((layout) => {
|
|
966
|
-
const normalizedLayout = normalizeWorkspaceAppLayout(layout);
|
|
967
|
-
setChatFirstAppLayout(normalizedLayout);
|
|
968
|
-
void writeClientAppState("chat-first-app-layout", normalizedLayout).catch(() => {
|
|
969
|
-
setChatFirstNotice("App order changed locally, but workspace state could not be synced.");
|
|
970
|
-
});
|
|
971
|
-
}, []);
|
|
972
989
|
useEffect(() => {
|
|
973
990
|
if (!chatFirstMode) {
|
|
974
991
|
setChatFirstPane(null);
|
|
@@ -1305,7 +1322,7 @@ function DispatchLayout({ children, extensions, agentPageHref, notice, brandName
|
|
|
1305
1322
|
return _jsx(_Fragment, { children: children });
|
|
1306
1323
|
}
|
|
1307
1324
|
if (electronEmbedded) {
|
|
1308
|
-
return (_jsx(DispatchExtensionsContext.Provider, { value: extensions, children: _jsx(DispatchWorkspaceAppLauncherContext.Provider, { value: chatHomeAppLauncher, 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 }), notice, _jsx(InvitationBanner, {}), _jsxs("main", { className: "relative flex min-h-0 flex-1 overflow-hidden", children: [_jsx("div", { className: "min-w-0 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 }) }), isChatRoute &&
|
|
1325
|
+
return (_jsx(DispatchExtensionsContext.Provider, { value: extensions, children: _jsx(DispatchWorkspaceAppLauncherContext.Provider, { value: chatHomeAppLauncher, 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 }), notice, _jsx(WorkspaceAppLayoutNotice, {}), _jsx(InvitationBanner, {}), _jsxs("main", { className: "relative flex min-h-0 flex-1 overflow-hidden", children: [_jsx("div", { className: "min-w-0 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 }) }), isChatRoute &&
|
|
1309
1326
|
chatFirstMode &&
|
|
1310
1327
|
chatFirstHasActiveChat &&
|
|
1311
1328
|
chatFirstSurfacePanel.open ? (_jsxs(ChatFirstSurfacePanel, { width: chatFirstSurfaceResize.width, onResizePointerDown: chatFirstSurfaceResize.onPointerDown, copy: chatFirstCopy, children: [chatFirstSurfaceTabsBar, chatFirstSurfaceContent] })) : null, isChatRoute && chatFirstMode && chatFirstHasActiveChat ? (_jsx(ChatFirstSurfacePanelToggle, { open: chatFirstSurfacePanel.open, onToggle: chatFirstSurfacePanel.toggle, className: CHAT_FIRST_SURFACE_PANEL_TOGGLE_CLASS_NAME })) : null] })] }) }) }) }) }));
|
|
@@ -1336,7 +1353,7 @@ function DispatchLayout({ children, extensions, agentPageHref, notice, brandName
|
|
|
1336
1353
|
t("dispatch.sidebar.suggestionRouteSlack"),
|
|
1337
1354
|
t("dispatch.sidebar.suggestionGrantKey"),
|
|
1338
1355
|
];
|
|
1339
|
-
const appContent = (_jsxs("div", { className: "relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden", children: [notice, _jsx(InvitationBanner, {}), isChatRoute && chatFirstMode && chatFirstNotice ? (
|
|
1356
|
+
const appContent = (_jsxs("div", { className: "relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden", children: [notice, _jsx(WorkspaceAppLayoutNotice, {}), _jsx(InvitationBanner, {}), isChatRoute && chatFirstMode && chatFirstNotice ? (_jsx(AppNotice, { onDismiss: () => setChatFirstNotice(null), children: chatFirstNotice })) : null, _jsx("main", { className: cn("min-h-0 flex-1", isChatRoute || isWorkspaceAppRoute
|
|
1340
1357
|
? "overflow-hidden"
|
|
1341
1358
|
: "overflow-y-auto"), children: showAgentControls ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "pointer-events-none sticky top-0 z-10 flex justify-end px-4 pt-2 lg:px-6", children: [_jsx(Button, { variant: "ghost", size: "icon-sm", className: "pointer-events-auto absolute start-4 top-2 lg:hidden", onClick: () => setMobileOpen(true), "aria-label": "Open navigation", children: _jsx(IconLayoutSidebar, { className: "h-4 w-4" }) }), _jsxs("div", { className: "pointer-events-auto flex items-center gap-1", children: [_jsx(RunsTray, { limit: 8, onOpenThread: openRunThread }), _jsx(AgentToggleButton, { className: "h-8 w-8 rounded-md bg-background/80 hover:bg-accent" })] })] }), _jsxs("div", { className: "mx-auto max-w-7xl space-y-10 px-4 py-6 sm:px-6", children: [localPathname !== "/overview" && (pageTitle || headerActions) ? (_jsxs("div", { className: "flex min-w-0 items-center justify-between gap-3", children: [_jsx("div", { className: "min-w-0 flex-1", children: pageTitle }), headerActions ? (_jsx("div", { className: "flex shrink-0 items-center gap-2", children: headerActions })) : null] })) : null, children] })] })) : (children) })] }));
|
|
1342
1359
|
const workspaceAppChatRegistration = workspaceAppId
|
|
@@ -1346,7 +1363,7 @@ function DispatchLayout({ children, extensions, agentPageHref, notice, brandName
|
|
|
1346
1363
|
const content = isChatRoute ? (_jsx("div", { className: cn("agent-layout-main-surface flex h-full min-w-0 flex-1 overflow-hidden", chatFirstMode && "dispatch-chat-first-surface"), children: chatFirstAppTakesMain ? (_jsx("div", { className: "flex min-w-0 flex-1 flex-col overflow-hidden", "data-dispatch-chat-first-main-app": true, children: chatFirstSurfaceContent })) : (_jsxs(_Fragment, { children: [appContent, chatFirstMode &&
|
|
1347
1364
|
chatFirstHasActiveChat &&
|
|
1348
1365
|
chatFirstSurfacePanel.open ? (_jsxs(ChatFirstSurfacePanel, { width: chatFirstSurfaceResize.width, onResizePointerDown: chatFirstSurfaceResize.onPointerDown, copy: chatFirstCopy, children: [chatFirstSurfaceTabsBar, chatFirstSurfaceContent] })) : null] })) })) : workspaceAppRouteActive ? null : isWorkspaceAppRoute ? (appContent) : (_jsx(AgentSidebar, { position: "right", defaultOpen: false, agentPageHref: agentPageHref, chatViewTransition: true, storageKey: "dispatch", openOnChatRunning: chatHomeHandoffActive, onFullscreenRequest: openAskAgentFullscreen, emptyStateText: t("dispatch.sidebar.emptyAgentText"), suggestions: sidebarSuggestions, children: appContent }));
|
|
1349
|
-
return (_jsx(DispatchExtensionsContext.Provider, { value: extensions, children: _jsx(DispatchWorkspaceAppLauncherContext.Provider, { value: chatHomeAppLauncher, children: _jsx(HeaderActionsProvider, { children: _jsxs("div", { className: "agent-layout-shell flex h-screen w-full overflow-hidden bg-background", children: [isRedesignedSettingsRoute ? null : (_jsx("aside", { "data-collapsed": sidebarCollapsed ? "true" : "false", className: cn("agent-layout-left-drawer hidden shrink-0 flex-col border-e !border-e-sidebar-border bg-sidebar text-sidebar-foreground transition-[width] duration-200 ease-out lg:flex", sidebarCollapsed ? "w-14" : "w-[260px]"), children: _jsx(NavContent, { extensions: extensions, brandName: brandName, brandIcon: brandIcon, chatFirstMode: chatFirstMode, chatFirstEmbedded: chatFirstEmbedded, collapsed: sidebarCollapsed, chatFirstAppLayout: chatFirstAppLayout,
|
|
1366
|
+
return (_jsx(DispatchExtensionsContext.Provider, { value: extensions, children: _jsx(DispatchWorkspaceAppLauncherContext.Provider, { value: chatHomeAppLauncher, children: _jsx(HeaderActionsProvider, { children: _jsxs("div", { className: "agent-layout-shell flex h-screen w-full overflow-hidden bg-background", children: [isRedesignedSettingsRoute ? null : (_jsx("aside", { "data-collapsed": sidebarCollapsed ? "true" : "false", className: cn("agent-layout-left-drawer hidden shrink-0 flex-col border-e !border-e-sidebar-border bg-sidebar text-sidebar-foreground transition-[width] duration-200 ease-out lg:flex", sidebarCollapsed ? "w-14" : "w-[260px]"), children: _jsx(NavContent, { extensions: extensions, brandName: brandName, brandIcon: brandIcon, chatFirstMode: chatFirstMode, chatFirstEmbedded: chatFirstEmbedded, collapsed: sidebarCollapsed, chatFirstAppLayout: chatFirstAppLayout, onChatFirstTogglePinned: toggleChatFirstAppPinned, chatFirstApps: chatFirstAppItems, chatFirstAppsStatus: chatFirstWorkspaceAppsStatus, chatFirstAppsError: chatFirstAppsError ? chatFirstCopy("appsLoadError") : null, chatFirstActiveAppId: chatFirstActiveAppId, chatFirstActivePrimaryTab: chatFirstActivePrimaryTab, onChatFirstNewChat: () => {
|
|
1350
1367
|
closeChatFirstSessionWatch();
|
|
1351
1368
|
chatFirstSurfaceTabsStore.closeAll();
|
|
1352
1369
|
setChatFirstSurfacePanelOpen(false);
|
|
@@ -1358,7 +1375,7 @@ function DispatchLayout({ children, extensions, agentPageHref, notice, brandName
|
|
|
1358
1375
|
}, onChatFirstAppsRetry: () => {
|
|
1359
1376
|
void chatFirstAppsQuery.refetch();
|
|
1360
1377
|
void chatFirstConnectedAppsQuery.refetch();
|
|
1361
|
-
}, 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, brandName: brandName, brandIcon: brandIcon, chatFirstMode: chatFirstMode, chatFirstEmbedded: chatFirstEmbedded, collapsed: false, chatFirstAppLayout: chatFirstAppLayout,
|
|
1378
|
+
}, 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, brandName: brandName, brandIcon: brandIcon, chatFirstMode: chatFirstMode, chatFirstEmbedded: chatFirstEmbedded, collapsed: false, chatFirstAppLayout: chatFirstAppLayout, onChatFirstTogglePinned: toggleChatFirstAppPinned, chatFirstApps: chatFirstAppItems, chatFirstAppsStatus: chatFirstWorkspaceAppsStatus, chatFirstAppsError: chatFirstAppsError ? chatFirstCopy("appsLoadError") : null, chatFirstActiveAppId: chatFirstActiveAppId, chatFirstActivePrimaryTab: chatFirstActivePrimaryTab, onChatFirstNewChat: () => {
|
|
1362
1379
|
closeChatFirstSessionWatch();
|
|
1363
1380
|
chatFirstSurfaceTabsStore.closeAll();
|
|
1364
1381
|
setChatFirstSurfacePanelOpen(false);
|