@agent-native/dispatch 0.40.36 → 0.40.38
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 +25 -14
- package/dist/actions/provider-api-register.d.ts +11 -11
- package/dist/components/layout/Layout.d.ts +0 -1
- package/dist/components/layout/Layout.d.ts.map +1 -1
- package/dist/components/layout/Layout.js +57 -101
- package/dist/components/layout/Layout.js.map +1 -1
- package/dist/routes/pages/overview.d.ts +2 -2
- package/dist/server/lib/app-creation-store.d.ts.map +1 -1
- package/dist/server/lib/app-creation-store.js +9 -5
- package/dist/server/lib/app-creation-store.js.map +1 -1
- package/dist/server/lib/community-apps.js +1 -1
- package/dist/server/lib/community-apps.js.map +1 -1
- package/dist/server/lib/usage-metrics-store.js +2 -2
- package/dist/server/lib/usage-metrics-store.js.map +1 -1
- package/package.json +3 -3
- package/src/components/layout/Layout.spec.tsx +348 -26
- package/src/components/layout/Layout.tsx +119 -193
- package/src/server/lib/app-creation-store.spec.ts +26 -5
- package/src/server/lib/app-creation-store.ts +10 -6
- package/src/server/lib/community-apps.ts +1 -1
- package/src/server/lib/usage-metrics-store.spec.ts +6 -2
- package/src/server/lib/usage-metrics-store.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @agent-native/dispatch
|
|
2
2
|
|
|
3
|
+
## 0.40.38
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- de3f844: Sign Dispatch's own workspace apps gateway read as the signed-in member with the deployment secret, so the receiver keeps the member's identity. Signing it with the organization secret made the registry refuse it, and a Dispatch with no deployment manifest to fall back on showed "Couldn't load data" (`workspace_gateway_rejected`).
|
|
8
|
+
- Release all public npm packages with a patch version bump.
|
|
9
|
+
- 84e4b2e: Show owned and shared chats in separate Dispatch history sections with independent paging and owner and access details.
|
|
10
|
+
- Updated dependencies [84e4b2e]
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- Updated dependencies [84e4b2e]
|
|
13
|
+
- Updated dependencies [fc038a0]
|
|
14
|
+
- @agent-native/toolkit@0.218.0
|
|
15
|
+
|
|
16
|
+
## 0.40.37
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- b07c13b: `describe-workspace-apps` now shows each app's authored "when to use" guidance, so the agent sees the same text the ranking matched on. Workspace usage tools now say plainly that they have no customer data and point to the app's own customer or billing actions or the owning app, instead of leading with the owner/admin permission rule.
|
|
21
|
+
- Release all public npm packages with a patch version bump.
|
|
22
|
+
- Updated dependencies [6c3f3cb]
|
|
23
|
+
- Updated dependencies [4c43f86]
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
- Updated dependencies [9e4119f]
|
|
26
|
+
- @agent-native/toolkit@0.217.0
|
|
27
|
+
|
|
3
28
|
## 0.40.36
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
|
@@ -1315,18 +1340,4 @@
|
|
|
1315
1340
|
|
|
1316
1341
|
- 330cf77: Keep impersonal HTML redirects eligible for the shared SSR edge cache.
|
|
1317
1342
|
|
|
1318
|
-
## 0.30.1
|
|
1319
|
-
|
|
1320
|
-
### Patch Changes
|
|
1321
|
-
|
|
1322
|
-
- a2f21dc: Keep workspace apps inline outside Builder.io embeds.
|
|
1323
|
-
- Updated dependencies [a2f21dc]
|
|
1324
|
-
- @agent-native/toolkit@0.16.6
|
|
1325
|
-
|
|
1326
|
-
## 0.30.0
|
|
1327
|
-
|
|
1328
|
-
### Minor Changes
|
|
1329
|
-
|
|
1330
|
-
- a688849: Add organization groups and privacy controls for workspace apps. New apps use the organization default (organization-wide by default), while creators and organization admins can manage individual, group, and organization access from the shared popover.
|
|
1331
|
-
|
|
1332
1343
|
For the full list of releases, see the [changelog archive](./changelog/archive/CHANGELOG.md).
|
|
@@ -47,10 +47,10 @@ declare const _default: import("node_modules/@agent-native/core/dist").ActionDef
|
|
|
47
47
|
notes?: string | undefined;
|
|
48
48
|
scope?: "org" | "user" | undefined;
|
|
49
49
|
}, {
|
|
50
|
+
message?: undefined;
|
|
50
51
|
id?: undefined;
|
|
51
|
-
deleted?: undefined;
|
|
52
52
|
provider?: undefined;
|
|
53
|
-
|
|
53
|
+
deleted?: undefined;
|
|
54
54
|
providers: {
|
|
55
55
|
id: string;
|
|
56
56
|
label: string;
|
|
@@ -61,45 +61,45 @@ declare const _default: import("node_modules/@agent-native/core/dist").ActionDef
|
|
|
61
61
|
updatedAt: number;
|
|
62
62
|
}[];
|
|
63
63
|
count: number;
|
|
64
|
+
found?: undefined;
|
|
64
65
|
registered?: undefined;
|
|
65
66
|
label?: undefined;
|
|
66
|
-
message?: undefined;
|
|
67
67
|
} | {
|
|
68
|
+
message?: undefined;
|
|
68
69
|
id?: undefined;
|
|
69
|
-
deleted?: undefined;
|
|
70
70
|
count?: undefined;
|
|
71
|
+
deleted?: undefined;
|
|
71
72
|
providers?: undefined;
|
|
72
73
|
found: boolean;
|
|
73
74
|
provider: import("node_modules/@agent-native/core/dist/provider-api").CustomProviderConfig;
|
|
74
75
|
registered?: undefined;
|
|
75
76
|
label?: undefined;
|
|
76
|
-
message?: undefined;
|
|
77
77
|
} | {
|
|
78
|
-
|
|
78
|
+
message?: undefined;
|
|
79
79
|
provider?: undefined;
|
|
80
80
|
count?: undefined;
|
|
81
|
+
deleted?: undefined;
|
|
81
82
|
providers?: undefined;
|
|
82
83
|
found: boolean;
|
|
83
84
|
id: string;
|
|
84
85
|
registered?: undefined;
|
|
85
86
|
label?: undefined;
|
|
86
|
-
message?: undefined;
|
|
87
87
|
} | {
|
|
88
|
+
message?: undefined;
|
|
88
89
|
provider?: undefined;
|
|
89
90
|
count?: undefined;
|
|
90
|
-
found?: undefined;
|
|
91
91
|
providers?: undefined;
|
|
92
|
+
found?: undefined;
|
|
92
93
|
deleted: boolean;
|
|
93
94
|
id: string;
|
|
94
95
|
registered?: undefined;
|
|
95
96
|
label?: undefined;
|
|
96
|
-
message?: undefined;
|
|
97
97
|
} | {
|
|
98
|
-
deleted?: undefined;
|
|
99
98
|
provider?: undefined;
|
|
100
99
|
count?: undefined;
|
|
101
|
-
|
|
100
|
+
deleted?: undefined;
|
|
102
101
|
providers?: undefined;
|
|
102
|
+
found?: undefined;
|
|
103
103
|
registered: boolean;
|
|
104
104
|
id: string;
|
|
105
105
|
label: string;
|
|
@@ -73,7 +73,6 @@ export declare function shouldQueryChatFirstApps(isChatRoute: boolean, chatFirst
|
|
|
73
73
|
*/
|
|
74
74
|
export declare function isRedesignedSettingsPath(pathname: string, settingsRedesign: FeatureFlagState): boolean;
|
|
75
75
|
export declare function dispatchNavLinkTarget(path: string): string;
|
|
76
|
-
export declare function formatThreadAge(updatedAt: number, now?: number): string;
|
|
77
76
|
export declare function NavContent({ onNavigate, extensions, brandName, brandIcon, chatFirstMode, chatFirstEmbedded, collapsed, collapsible, onCollapsedChange, chatFirstAppLayout, onChatFirstAppLayoutChange, chatFirstApps, chatFirstAppsLoading, chatFirstAppsError, chatFirstActiveAppId, chatFirstActivePrimaryTab, onChatFirstNewChat, onChatFirstAppOpen, onChatFirstAppsRetry, }: DispatchNavContentProps): import("node_modules/@types/react").JSX.Element;
|
|
78
77
|
export declare function renderChatFirstAppSurfaceTab({ registration, embedPath, loading, isMobileSurface, copy, }: {
|
|
79
78
|
registration: ChatFirstAppRegistration | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAiBL,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,
|
|
1
|
+
{"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAiBL,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EAWlC,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,yCAAyC,CAAC;AA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E3E;AAED,wBAAgB,+BAA+B,wCAE9C;AA0CD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEhE;AAED,wBAAgB,iCAAiC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE3E;AAED,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,OAAO,EACpB,aAAa,EAAE,OAAO,GACrB,OAAO,CAET;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,gBAAgB,GACjC,OAAO,CAKT;AAyBD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ1D;AAshBD,wBAAgB,UAAU,CAAC,EACzB,UAAU,EACV,UAAU,EACV,SAAkC,EAClC,SAAS,EACT,aAAqB,EACrB,iBAAyB,EACzB,SAAiB,EACjB,WAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,0BAA0B,EAC1B,aAAkB,EAClB,oBAA4B,EAC5B,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,GACrB,EAAE,uBAAuB,mDAsRzB;AAED,wBAAgB,4BAA4B,CAAC,EAC3C,YAAY,EACZ,SAAS,EACT,OAAO,EACP,eAAe,EACf,IAAI,GACL,EAAE;IACD,YAAY,EAAE,wBAAwB,GAAG,IAAI,CAAC;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,OAAO,CAAC;IACzB,IAAI,EAAE,aAAa,CAAC;CACrB,GAAG,SAAS,CAuCZ;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,mBAAmB,mDAMhD"}
|
|
@@ -8,12 +8,12 @@ import { useT } from "@agent-native/core/client/i18n";
|
|
|
8
8
|
import { SETTINGS_REDESIGN_FLAG } from "@agent-native/core/feature-flags/registry";
|
|
9
9
|
import { AgentToggleButton, AgentSidebar, focusAgentChat, } from "@agent-native/toolkit/app/chat/AgentSidebar";
|
|
10
10
|
import { defaultChatFirstCopy } from "@agent-native/toolkit/app/chat/chat-first-copy";
|
|
11
|
+
import { OwnershipChatHistoryRail, ownDraftRows, useOwnershipChatHistory, } from "@agent-native/toolkit/app/chat/ownership-history";
|
|
11
12
|
import { FeedbackButton } from "@agent-native/toolkit/app/feedback";
|
|
12
13
|
import { InvitationBanner, OrgSwitcher } from "@agent-native/toolkit/app/org";
|
|
13
14
|
import { RunsTray } from "@agent-native/toolkit/app/progress";
|
|
14
15
|
import { isSettingsPathname } from "@agent-native/toolkit/app/settings";
|
|
15
16
|
import { AppSidebarFooter, AppSidebarHeader, openCommandMenu, } from "@agent-native/toolkit/app/shared";
|
|
16
|
-
import { ChatHistoryRail, } from "@agent-native/toolkit/chat-history";
|
|
17
17
|
import { writeClipboardText } from "@agent-native/toolkit/clipboard";
|
|
18
18
|
import { IconApps, IconBrandSlack, IconBrandTelegram, IconCopy, IconEye, IconHierarchy2, IconMessageQuestion, IconBroadcast, IconLayoutSidebar, IconLayoutSidebarLeftCollapse, IconLayoutSidebarLeftExpand, IconSettings, IconShield, IconWorld, IconDeviceDesktop, IconPlus, } from "@tabler/icons-react";
|
|
19
19
|
import { createContext, useEffect, useMemo, useRef, useState, useContext, useCallback, } from "react";
|
|
@@ -31,7 +31,6 @@ import { CreateAppPopover } from "../create-app-popover.js";
|
|
|
31
31
|
import { AgentChatSurface, ChatFirstAgentsPane, ChatFirstAppPane, ChatFirstAppsRail, ChatFirstBrowserPane, ChatFirstChatHistory, ChatFirstPrimaryNavigation, ChatFirstSessionWatchPane, ChatFirstSurfaceContent, ChatFirstSurfacePanel, ChatFirstSurfacePanelToggle, ChatFirstSurfaceTabs, } from "../deferred-chat-components.js";
|
|
32
32
|
import { Button } from "../ui/button.js";
|
|
33
33
|
import { Sheet, SheetContent, SheetDescription, SheetTitle } from "../ui/sheet.js";
|
|
34
|
-
import { Skeleton } from "../ui/skeleton.js";
|
|
35
34
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "../ui/tooltip.js";
|
|
36
35
|
import { WorkspaceAppChatRail, WorkspaceAppFrame, WorkspaceAppKeepAlive, } from "../workspace-app-host.js";
|
|
37
36
|
import { Header } from "./Header.js";
|
|
@@ -334,26 +333,6 @@ function threadIdFromPath(pathname) {
|
|
|
334
333
|
return null;
|
|
335
334
|
}
|
|
336
335
|
}
|
|
337
|
-
export function formatThreadAge(updatedAt, now = Date.now()) {
|
|
338
|
-
const diffMs = Math.max(0, now - updatedAt);
|
|
339
|
-
const minutes = Math.floor(diffMs / 60_000);
|
|
340
|
-
if (minutes < 1)
|
|
341
|
-
return "now";
|
|
342
|
-
if (minutes < 60)
|
|
343
|
-
return `${minutes}m`;
|
|
344
|
-
const hours = Math.floor(minutes / 60);
|
|
345
|
-
if (hours < 24)
|
|
346
|
-
return `${hours}h`;
|
|
347
|
-
const days = Math.floor(hours / 24);
|
|
348
|
-
if (days < 14)
|
|
349
|
-
return `${days}d`;
|
|
350
|
-
if (days < 365)
|
|
351
|
-
return `${Math.floor(days / 7)}w`;
|
|
352
|
-
return `${Math.floor(days / 365)}y`;
|
|
353
|
-
}
|
|
354
|
-
function threadTitle(thread, fallback) {
|
|
355
|
-
return thread.title || thread.preview || fallback;
|
|
356
|
-
}
|
|
357
336
|
function threadSourceIcon(platform) {
|
|
358
337
|
const normalized = platform?.trim().toLowerCase();
|
|
359
338
|
if (!normalized)
|
|
@@ -377,13 +356,6 @@ function readChatHistoryIncludesExternal() {
|
|
|
377
356
|
return false;
|
|
378
357
|
}
|
|
379
358
|
}
|
|
380
|
-
function threadUpdatedAt(thread) {
|
|
381
|
-
return Number.isFinite(thread.updatedAt)
|
|
382
|
-
? thread.updatedAt
|
|
383
|
-
: Number.isFinite(thread.createdAt)
|
|
384
|
-
? thread.createdAt
|
|
385
|
-
: 0;
|
|
386
|
-
}
|
|
387
359
|
function DispatchChatsSection({ onNavigate, showNewChat = false, prelude, chatFirstMode = false, chatFirstEmbedded = false, collapsed = false, chatFirstNavigation, }) {
|
|
388
360
|
const t = useT();
|
|
389
361
|
const chatFirstCopy = useMemo(() => createDispatchChatFirstCopy(t), [t]);
|
|
@@ -391,35 +363,45 @@ function DispatchChatsSection({ onNavigate, showNewChat = false, prelude, chatFi
|
|
|
391
363
|
const location = useLocation();
|
|
392
364
|
const [includeExternal, setIncludeExternal] = useState(false);
|
|
393
365
|
const [historyPreferenceReady, setHistoryPreferenceReady] = useState(false);
|
|
394
|
-
const
|
|
395
|
-
const { threads, activeThreadId, isLoading: chatsLoading, threadsLoadError, createThread, switchThread, renameThread, refreshThreads, } = useChatThreads(undefined, "dispatch", undefined, {
|
|
366
|
+
const { threads, activeThreadId, createThread, switchThread, renameThread, pinThread, archiveThread, isNewThread, } = useChatThreads(undefined, "dispatch", undefined, {
|
|
396
367
|
autoCreate: false,
|
|
397
368
|
includeExternal,
|
|
398
369
|
});
|
|
399
|
-
const visibleThreads = useMemo(() => threads
|
|
400
|
-
.filter((thread) => thread.messageCount > 0 || thread.id === activeThreadId)
|
|
401
|
-
.sort((a, b) => threadUpdatedAt(b) - threadUpdatedAt(a))
|
|
402
|
-
.slice(0, 8), [activeThreadId, threads]);
|
|
403
370
|
const localPathname = localDispatchPath(location.pathname);
|
|
404
371
|
const displayedActiveThreadId = threadIdFromPath(localPathname) ??
|
|
405
372
|
(localPathname === "/chat" ? null : activeThreadId);
|
|
406
|
-
const
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
373
|
+
const history = useOwnershipChatHistory({
|
|
374
|
+
getThreadUrl: (threadId) => appPath(chatThreadPath(threadId)),
|
|
375
|
+
includeExternal,
|
|
376
|
+
activeId: displayedActiveThreadId,
|
|
377
|
+
localMineRows: ownDraftRows({
|
|
378
|
+
threads,
|
|
379
|
+
isNewThread,
|
|
380
|
+
activeId: activeThreadId,
|
|
381
|
+
}),
|
|
382
|
+
mutations: { pin: pinThread, rename: renameThread, archive: archiveThread },
|
|
383
|
+
onMutationFailed: () => toast.error(t("dispatch.integrations.failedToSave")),
|
|
384
|
+
decorateItem: (item, row) => {
|
|
385
|
+
const source = "source" in row ? row.source : undefined;
|
|
386
|
+
const sourceLabel = source?.platform
|
|
387
|
+
? source.platform[0].toUpperCase() + source.platform.slice(1)
|
|
388
|
+
: undefined;
|
|
389
|
+
const sourceIcon = threadSourceIcon(source?.platform);
|
|
390
|
+
return {
|
|
391
|
+
...item,
|
|
392
|
+
title: (_jsxs("span", { className: "flex min-w-0 items-center gap-1", title: sourceLabel ? `${sourceLabel}: ${item.titleText}` : item.titleText, children: [sourceIcon ? (_jsx("span", { className: "shrink-0 text-sidebar-foreground/55", "aria-label": sourceLabel, children: sourceIcon })) : null, _jsx("span", { className: "truncate", children: item.title })] })),
|
|
393
|
+
};
|
|
394
|
+
},
|
|
421
395
|
});
|
|
422
|
-
const
|
|
396
|
+
const listProps = {
|
|
397
|
+
...history.listProps,
|
|
398
|
+
onDelete: async (threadId) => {
|
|
399
|
+
const archived = await history.listProps.onDelete?.(threadId);
|
|
400
|
+
if (archived && threadId === displayedActiveThreadId)
|
|
401
|
+
await handleNewChat();
|
|
402
|
+
return archived === true;
|
|
403
|
+
},
|
|
404
|
+
};
|
|
423
405
|
useEffect(() => {
|
|
424
406
|
setIncludeExternal(readChatHistoryIncludesExternal());
|
|
425
407
|
setHistoryPreferenceReady(true);
|
|
@@ -431,27 +413,7 @@ function DispatchChatsSection({ onNavigate, showNewChat = false, prelude, chatFi
|
|
|
431
413
|
localStorage.setItem(CHAT_HISTORY_SOURCE_KEY, includeExternal ? "all" : "local");
|
|
432
414
|
}
|
|
433
415
|
catch { } // coercion-ok: localStorage is optional browser persistence.
|
|
434
|
-
|
|
435
|
-
historyModeRef.current = includeExternal;
|
|
436
|
-
refreshThreads();
|
|
437
|
-
}
|
|
438
|
-
}, [historyPreferenceReady, includeExternal, refreshThreads]);
|
|
439
|
-
useEffect(() => {
|
|
440
|
-
const refresh = () => refreshThreads();
|
|
441
|
-
const handleRunning = (event) => {
|
|
442
|
-
const detail = event.detail;
|
|
443
|
-
if (detail?.isRunning === false)
|
|
444
|
-
refreshThreads();
|
|
445
|
-
};
|
|
446
|
-
window.addEventListener("agent-chat:threads-updated", refresh);
|
|
447
|
-
window.addEventListener("agentNative.chatRunning", handleRunning);
|
|
448
|
-
window.addEventListener("focus", refresh);
|
|
449
|
-
return () => {
|
|
450
|
-
window.removeEventListener("agent-chat:threads-updated", refresh);
|
|
451
|
-
window.removeEventListener("agentNative.chatRunning", handleRunning);
|
|
452
|
-
window.removeEventListener("focus", refresh);
|
|
453
|
-
};
|
|
454
|
-
}, [refreshThreads]);
|
|
416
|
+
}, [historyPreferenceReady, includeExternal]);
|
|
455
417
|
function openThread(threadId, options) {
|
|
456
418
|
switchThread(threadId);
|
|
457
419
|
navigateWithAgentChatViewTransition(navigate, dispatchNavLinkTarget(options?.isNew ? "/chat" : chatThreadPath(threadId)));
|
|
@@ -467,29 +429,19 @@ function DispatchChatsSection({ onNavigate, showNewChat = false, prelude, chatFi
|
|
|
467
429
|
if (threadId)
|
|
468
430
|
openThread(threadId, { isNew: true });
|
|
469
431
|
}
|
|
432
|
+
const sourceToggle = (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { type: "button", "data-dispatch-chat-source-toggle": true, "aria-pressed": includeExternal, "aria-label": includeExternal
|
|
433
|
+
? t("dispatch.sidebar.showLocalChats")
|
|
434
|
+
: t("dispatch.sidebar.showAllChats"), onClick: () => setIncludeExternal((current) => !current), className: "flex size-6 items-center justify-center rounded-md text-sidebar-foreground/55 transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground", children: includeExternal ? (_jsx(IconWorld, { size: 14, "aria-hidden": "true" })) : (_jsx(IconDeviceDesktop, { size: 14, "aria-hidden": "true" })) }) }), _jsx(TooltipContent, { side: "right", children: includeExternal
|
|
435
|
+
? t("dispatch.sidebar.showLocalChats")
|
|
436
|
+
: t("dispatch.sidebar.showAllChats") })] }));
|
|
470
437
|
const collapsedChatFirst = collapsed && chatFirstMode;
|
|
471
438
|
return (_jsxs("div", { className: cn("min-w-0 space-y-0.5", showNewChat && "dispatch-chat-first-chats"), 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: () => {
|
|
472
439
|
chatFirstNavigation.onNewChat?.();
|
|
473
440
|
void handleNewChat();
|
|
474
|
-
}, onOpenIntegrations: chatFirstNavigation.onOpenIntegrations, onOpenScheduled: chatFirstNavigation.onOpenScheduled, onSearch: openCommandMenu, activeTab: chatFirstNavigation.activeTab, collapsed: collapsed }) })) : null, prelude, !collapsedChatFirst
|
|
475
|
-
? t("dispatch.sidebar.showLocalChats", {
|
|
476
|
-
defaultValue: "Show local chats",
|
|
477
|
-
})
|
|
478
|
-
: t("dispatch.sidebar.showAllChats", {
|
|
479
|
-
defaultValue: "Show all chats",
|
|
480
|
-
}), onClick: () => setIncludeExternal((current) => !current), className: "flex size-6 items-center justify-center rounded-md text-sidebar-foreground/55 transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground", children: includeExternal ? (_jsx(IconWorld, { size: 14, "aria-hidden": "true" })) : (_jsx(IconDeviceDesktop, { size: 14, "aria-hidden": "true" })) }) }), _jsx(TooltipContent, { side: "right", children: includeExternal
|
|
481
|
-
? t("dispatch.sidebar.showLocalChats", {
|
|
482
|
-
defaultValue: "Show local chats",
|
|
483
|
-
})
|
|
484
|
-
: t("dispatch.sidebar.showAllChats", {
|
|
485
|
-
defaultValue: "Show all chats",
|
|
486
|
-
}) })] }) })) : null, !collapsedChatFirst &&
|
|
487
|
-
!chatFirstMode &&
|
|
488
|
-
chatsLoading &&
|
|
489
|
-
visibleThreads.length === 0 &&
|
|
490
|
-
Array.from({ length: 3 }).map((_, index) => (_jsxs("div", { className: "flex items-center gap-2 px-3 py-1", children: [_jsx(Skeleton, { className: "size-3.5 shrink-0 rounded-sm" }), _jsx(Skeleton, { className: "h-3 w-3/4 rounded" })] }, `chat-skeleton-${index}`))), !collapsedChatFirst &&
|
|
441
|
+
}, onOpenIntegrations: chatFirstNavigation.onOpenIntegrations, onOpenScheduled: chatFirstNavigation.onOpenScheduled, onSearch: openCommandMenu, activeTab: chatFirstNavigation.activeTab, collapsed: collapsed }) })) : null, prelude, !collapsedChatFirst ? (_jsx("div", { className: "flex justify-end px-2 pt-0.5", children: sourceToggle })) : null, !collapsedChatFirst &&
|
|
491
442
|
chatFirstMode &&
|
|
492
|
-
(
|
|
443
|
+
(history.loading ||
|
|
444
|
+
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: {
|
|
493
445
|
options: (item) => t("dispatch.sidebar.chatOptions", {
|
|
494
446
|
title: item.titleText ?? "",
|
|
495
447
|
}),
|
|
@@ -497,14 +449,17 @@ function DispatchChatsSection({ onNavigate, showNewChat = false, prelude, chatFi
|
|
|
497
449
|
title: item.titleText ?? "",
|
|
498
450
|
}),
|
|
499
451
|
rename: t("dispatch.sidebar.renameChat"),
|
|
452
|
+
pin: t("agentChat.contextXray.pin"),
|
|
453
|
+
unpin: t("agentChat.contextXray.unpin"),
|
|
454
|
+
delete: t("extensions.delete"),
|
|
500
455
|
}, renderAdditionalRowActions: (item, closeMenu) => (_jsxs(_Fragment, { children: [_jsxs("button", { type: "button", role: "menuitem", className: "an-chat-history-row__menu-item", onClick: () => {
|
|
501
456
|
closeMenu();
|
|
502
457
|
void writeClipboardText(item.id).then((copied) => {
|
|
503
458
|
toast[copied ? "success" : "error"](copied
|
|
504
|
-
? "
|
|
505
|
-
: "
|
|
459
|
+
? chatFirstCopy("sessionIdCopied")
|
|
460
|
+
: t("agentChat.recovery.copyFailed"));
|
|
506
461
|
});
|
|
507
|
-
}, children: [_jsx(IconCopy, { size: 13, strokeWidth: 1.8 }), _jsx("span", { children: "
|
|
462
|
+
}, children: [_jsx(IconCopy, { size: 13, strokeWidth: 1.8 }), _jsx("span", { children: chatFirstCopy("copySessionId") })] }), !chatFirstEmbedded ? (_jsxs("button", { type: "button", role: "menuitem", className: "an-chat-history-row__menu-item", onClick: () => {
|
|
508
463
|
closeMenu();
|
|
509
464
|
emitChatFirstSessionWatch({
|
|
510
465
|
sessionId: item.id,
|
|
@@ -512,11 +467,9 @@ function DispatchChatsSection({ onNavigate, showNewChat = false, prelude, chatFi
|
|
|
512
467
|
kind: "agent-chat",
|
|
513
468
|
sourceSessionId: displayedActiveThreadId ?? undefined,
|
|
514
469
|
});
|
|
515
|
-
}, children: [_jsx(IconEye, { size: 13, strokeWidth: 1.8 }), _jsx("span", { children: "
|
|
470
|
+
}, children: [_jsx(IconEye, { size: 13, strokeWidth: 1.8 }), _jsx("span", { children: chatFirstCopy("watchSession") })] })) : null] })), className: "min-w-0 px-2" })) : !collapsedChatFirst && !chatFirstMode ? (_jsx(OwnershipChatHistoryRail, { sections: history.sections, listProps: listProps, activeId: displayedActiveThreadId, onSelect: (threadId) => openThread(threadId), onNewChat: () => void handleNewChat(), railLabels: {
|
|
516
471
|
newChat: t("dispatch.sidebar.newChat"),
|
|
517
|
-
|
|
518
|
-
showLess: t("dispatch.sidebar.chats"),
|
|
519
|
-
}, error: chatHistoryError, renameMaxLength: 160, onRename: (threadId, title) => void renameThread(threadId, title), labels: {
|
|
472
|
+
}, renameMaxLength: 160, labels: {
|
|
520
473
|
options: (item) => t("dispatch.sidebar.chatOptions", {
|
|
521
474
|
title: item.titleText ?? "",
|
|
522
475
|
}),
|
|
@@ -524,14 +477,17 @@ function DispatchChatsSection({ onNavigate, showNewChat = false, prelude, chatFi
|
|
|
524
477
|
title: item.titleText ?? "",
|
|
525
478
|
}),
|
|
526
479
|
rename: t("dispatch.sidebar.renameChat"),
|
|
480
|
+
pin: t("agentChat.contextXray.pin"),
|
|
481
|
+
unpin: t("agentChat.contextXray.unpin"),
|
|
482
|
+
delete: t("extensions.delete"),
|
|
527
483
|
}, renderAdditionalRowActions: (item, closeMenu) => (_jsxs(_Fragment, { children: [_jsxs("button", { type: "button", role: "menuitem", className: "an-chat-history-row__menu-item", onClick: () => {
|
|
528
484
|
closeMenu();
|
|
529
485
|
void writeClipboardText(item.id).then((copied) => {
|
|
530
486
|
toast[copied ? "success" : "error"](copied
|
|
531
|
-
? "
|
|
532
|
-
: "
|
|
487
|
+
? chatFirstCopy("sessionIdCopied")
|
|
488
|
+
: t("agentChat.recovery.copyFailed"));
|
|
533
489
|
});
|
|
534
|
-
}, children: [_jsx(IconCopy, { size: 13, strokeWidth: 1.8 }), _jsx("span", { children: "
|
|
490
|
+
}, children: [_jsx(IconCopy, { size: 13, strokeWidth: 1.8 }), _jsx("span", { children: chatFirstCopy("copySessionId") })] }), chatFirstMode && !chatFirstEmbedded ? (_jsxs("button", { type: "button", role: "menuitem", className: "an-chat-history-row__menu-item", onClick: () => {
|
|
535
491
|
closeMenu();
|
|
536
492
|
emitChatFirstSessionWatch({
|
|
537
493
|
sessionId: item.id,
|
|
@@ -539,7 +495,7 @@ function DispatchChatsSection({ onNavigate, showNewChat = false, prelude, chatFi
|
|
|
539
495
|
kind: "agent-chat",
|
|
540
496
|
sourceSessionId: displayedActiveThreadId ?? undefined,
|
|
541
497
|
});
|
|
542
|
-
}, children: [_jsx(IconEye, { size: 13, strokeWidth: 1.8 }), _jsx("span", { children: "
|
|
498
|
+
}, children: [_jsx(IconEye, { size: 13, strokeWidth: 1.8 }), _jsx("span", { children: chatFirstCopy("watchSession") })] })) : null] })), className: "min-w-0 px-2" })) : null] }));
|
|
543
499
|
}
|
|
544
500
|
export function NavContent({ onNavigate, extensions, brandName = DISPATCH_SIDEBAR_LABEL, brandIcon, chatFirstMode = false, chatFirstEmbedded = false, collapsed = false, collapsible = false, onCollapsedChange, chatFirstAppLayout, onChatFirstAppLayoutChange, chatFirstApps = [], chatFirstAppsLoading = false, chatFirstAppsError, chatFirstActiveAppId, chatFirstActivePrimaryTab, onChatFirstNewChat, onChatFirstAppOpen, onChatFirstAppsRetry, }) {
|
|
545
501
|
const t = useT();
|