@agent-native/core 0.178.1 → 0.178.2-nightly-20260910195009

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.
Files changed (48) hide show
  1. package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +108 -121
  2. package/corpus/templates/assets/app/components/layout/Sidebar.tsx +87 -220
  3. package/corpus/templates/brain/app/components/layout/Sidebar.tsx +83 -221
  4. package/corpus/templates/calendar/app/components/layout/Sidebar.tsx +324 -460
  5. package/corpus/templates/chat/app/components/layout/Sidebar.tsx +57 -247
  6. package/corpus/templates/clips/app/components/library/library-layout.tsx +15 -48
  7. package/corpus/templates/clips/changelog/2026-09-10-open-mcp-connections-in-new-tabs.md +1 -0
  8. package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +84 -94
  9. package/corpus/templates/crm/app/components/layout/CrmLayout.tsx +1 -1
  10. package/corpus/templates/crm/app/components/layout/CrmSidebar.tsx +108 -296
  11. package/corpus/templates/design/app/components/layout/Sidebar.tsx +55 -212
  12. package/corpus/templates/factory/app/components/layout/Sidebar.tsx +72 -260
  13. package/corpus/templates/forms/app/components/layout/Sidebar.tsx +143 -362
  14. package/corpus/templates/macros/app/components/layout/AppLayout.tsx +64 -159
  15. package/corpus/templates/mail/app/components/layout/AppLayout.tsx +152 -165
  16. package/corpus/templates/plan/app/components/layout/Sidebar.tsx +82 -207
  17. package/corpus/templates/slides/app/components/layout/Sidebar.tsx +61 -234
  18. package/corpus/templates/tasks/app/components/layout/Sidebar.tsx +73 -225
  19. package/dist/automation/index.d.ts +1 -1
  20. package/dist/client/EnvironmentBadge.d.ts +7 -4
  21. package/dist/client/EnvironmentBadge.js +26 -18
  22. package/dist/client/FeedbackButton.js +23 -8
  23. package/dist/client/app-providers.js +1 -1
  24. package/dist/client/auth/AuthPage.js +0 -38
  25. package/dist/client/components/icons/AgentNativeIcon.js +1 -1
  26. package/dist/client/index.d.ts +1 -0
  27. package/dist/client/index.js +1 -0
  28. package/dist/client/ui/AppSidebar.d.ts +15 -0
  29. package/dist/client/ui/AppSidebar.js +34 -0
  30. package/dist/client/ui/index.d.ts +1 -0
  31. package/dist/client/ui/index.js +1 -0
  32. package/dist/collab/awareness.d.ts +2 -2
  33. package/dist/collab/struct-routes.d.ts +1 -1
  34. package/dist/config.d.ts +4 -0
  35. package/dist/config.js +19 -3
  36. package/dist/progress/routes.d.ts +1 -1
  37. package/dist/provider-api/actions/custom-provider-registration.d.ts +9 -9
  38. package/dist/provider-api/actions/provider-api.d.ts +15 -15
  39. package/dist/provider-api/corpus-jobs.d.ts +2 -2
  40. package/dist/resources/handlers.d.ts +1 -1
  41. package/dist/secrets/routes.d.ts +9 -9
  42. package/dist/server/beta-opt-out-html.js +2 -2
  43. package/dist/templates/chat/app/components/layout/Sidebar.tsx +57 -247
  44. package/dist/vite/client.js +4 -1
  45. package/docs/content/template-clips-anonymous-intake.mdx +7 -5
  46. package/docs/content/template-clips-developers.mdx +1 -1
  47. package/package.json +3 -3
  48. package/src/templates/chat/app/components/layout/Sidebar.tsx +57 -247
@@ -6,48 +6,32 @@ import {
6
6
  import { useT } from "@agent-native/core/client/i18n";
7
7
  import { openCommandMenu } from "@agent-native/core/client/navigation";
8
8
  import { OrgSwitcher } from "@agent-native/core/client/org";
9
- import { AgentNativeIcon, FeedbackButton } from "@agent-native/core/client/ui";
10
- import { SidebarFooterActions } from "@agent-native/toolkit/app-shell";
9
+ import {
10
+ AppSidebar,
11
+ AppSidebarNavItem,
12
+ FeedbackButton,
13
+ type AppSidebarItemDefinition,
14
+ } from "@agent-native/core/client/ui";
11
15
  import {
12
16
  ChatHistoryRail,
13
17
  type ChatHistoryItem,
14
18
  } from "@agent-native/toolkit/chat-history";
15
19
  import {
16
- IconLayoutSidebarLeftCollapse,
17
- IconLayoutSidebarLeftExpand,
18
20
  IconMessageCircle,
19
21
  IconSearch,
20
22
  IconSettings,
21
23
  } from "@tabler/icons-react";
22
24
  import { useEffect, useMemo } from "react";
23
- import { Link, useLocation, useNavigate } from "react-router";
25
+ import { useLocation, useNavigate } from "react-router";
24
26
  import { toast } from "sonner";
25
27
 
28
+ import { Button } from "@/components/ui/button";
26
29
  import {
27
30
  Tooltip,
28
31
  TooltipContent,
29
32
  TooltipTrigger,
30
33
  } from "@/components/ui/tooltip";
31
34
  import { APP_TITLE } from "@/lib/app-config";
32
- import { cn } from "@/lib/utils";
33
-
34
- const navItems = [
35
- {
36
- icon: IconMessageCircle,
37
- labelKey: "navigation.chat",
38
- href: "/home",
39
- view: "chat",
40
- },
41
- ];
42
-
43
- const bottomNavItems = [
44
- {
45
- icon: IconSettings,
46
- labelKey: "navigation.settings",
47
- href: "/settings",
48
- view: "settings",
49
- },
50
- ];
51
35
 
52
36
  const CHAT_STORAGE_KEY = "chat";
53
37
  const CHAT_ACTIVE_THREAD_KEY = `agent-chat-active-thread:${CHAT_STORAGE_KEY}`;
@@ -275,245 +259,71 @@ export function Sidebar({
275
259
  const t = useT();
276
260
  const isChatRoute =
277
261
  location.pathname === "/home" || location.pathname.startsWith("/chat/");
278
- const ToggleIcon = collapsed
279
- ? IconLayoutSidebarLeftExpand
280
- : IconLayoutSidebarLeftCollapse;
281
- const navClass = ({ isActive }: { isActive: boolean }) =>
282
- cn(
283
- "flex items-center text-sm transition-colors",
284
- collapsed
285
- ? "relative h-10 w-full justify-center rounded-none px-0"
286
- : "h-9 rounded-md gap-3 px-3",
287
- isActive
288
- ? collapsed
289
- ? "bg-sidebar-accent text-sidebar-accent-foreground"
290
- : "bg-sidebar-accent text-sidebar-accent-foreground"
291
- : collapsed
292
- ? "text-sidebar-foreground/70 hover:bg-sidebar-accent/55 hover:text-sidebar-accent-foreground"
293
- : "text-sidebar-foreground hover:bg-sidebar-accent/65 hover:text-sidebar-accent-foreground",
294
- );
295
- const collapseButton = collapsible ? (
296
- <Tooltip>
297
- <TooltipTrigger asChild>
298
- <button
299
- type="button"
300
- onClick={() => onCollapsedChange?.(!collapsed)}
301
- className={cn(
302
- "flex shrink-0 items-center justify-center rounded-md text-sidebar-foreground/65 transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
303
- collapsed ? "size-8" : "size-7",
304
- )}
305
- aria-label={
306
- collapsed
307
- ? t("navigation.expandSidebar")
308
- : t("navigation.collapseSidebar")
309
- }
310
- >
311
- <ToggleIcon className="size-4" />
312
- </button>
313
- </TooltipTrigger>
314
- <TooltipContent side="right">
315
- {collapsed
316
- ? t("navigation.expandSidebar")
317
- : t("navigation.collapseSidebar")}
318
- </TooltipContent>
319
- </Tooltip>
320
- ) : null;
262
+
263
+ const secondaryItems: AppSidebarItemDefinition[] = [
264
+ {
265
+ to: "/settings",
266
+ label: t("navigation.settings"),
267
+ icon: IconSettings,
268
+ active: location.pathname.startsWith("/settings"),
269
+ },
270
+ ];
271
+
272
+ const feedbackButton = (
273
+ <FeedbackButton variant={collapsed ? "icon" : "sidebar"} side="right" />
274
+ );
275
+
276
+ const orgSwitcher = <OrgSwitcher compact={collapsed} reserveSpace />;
277
+
321
278
  const searchButton = (
322
279
  <Tooltip>
323
280
  <TooltipTrigger asChild>
324
- <button
281
+ <Button
325
282
  type="button"
283
+ variant="ghost"
284
+ size="icon"
285
+ className="size-9 shrink-0 text-primary hover:bg-accent/60 hover:text-primary"
326
286
  onClick={openCommandMenu}
327
287
  aria-label={t("root.commandSearch")}
328
- className="flex size-8 items-center justify-center rounded-md text-sidebar-foreground/65 transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
329
288
  >
330
289
  <IconSearch className="size-4" />
331
- </button>
290
+ </Button>
332
291
  </TooltipTrigger>
333
292
  <TooltipContent side="right">{t("root.commandSearch")}</TooltipContent>
334
293
  </Tooltip>
335
294
  );
336
- const feedbackButton = (
337
- <FeedbackButton
338
- variant={collapsed ? "icon" : "sidebar"}
339
- side="right"
340
- className={collapsed ? "h-8 w-8" : "min-w-0"}
341
- />
342
- );
343
295
 
344
296
  return (
345
- <aside
346
- data-collapsed={collapsed ? "true" : "false"}
347
- className={cn(
348
- "flex h-full min-w-0 shrink-0 flex-col overflow-hidden border-e border-sidebar-border bg-sidebar text-sidebar-foreground transition-[width] duration-200 ease-out",
349
- collapsed ? "w-12" : "w-60",
350
- )}
297
+ <AppSidebar
298
+ collapsed={collapsed}
299
+ collapsible={collapsible}
300
+ onCollapsedChange={onCollapsedChange}
301
+ brandName={APP_TITLE}
302
+ brandHref="/home"
303
+ secondaryItems={secondaryItems}
304
+ feedback={feedbackButton}
305
+ orgSwitcher={orgSwitcher}
306
+ footerExtras={searchButton}
351
307
  >
352
- <div
353
- className={cn(
354
- "flex shrink-0 items-center border-b border-sidebar-border",
355
- collapsed ? "h-12 justify-center px-0" : "h-14 px-3",
356
- )}
357
- >
358
- <Link
359
- to="/home"
360
- onClick={(event) => {
361
- if (
362
- !collapsible ||
363
- !onCollapsedChange ||
364
- event.metaKey ||
365
- event.ctrlKey ||
366
- event.shiftKey ||
367
- event.altKey ||
368
- event.button !== 0
369
- ) {
370
- return;
371
- }
308
+ <AppSidebarNavItem
309
+ to="/home"
310
+ label={t("navigation.chat")}
311
+ icon={IconMessageCircle}
312
+ active={isChatRoute}
313
+ onClick={(event) => {
314
+ if (
315
+ !isChatRoute &&
316
+ !event.metaKey &&
317
+ !event.ctrlKey &&
318
+ !event.shiftKey &&
319
+ !event.altKey
320
+ ) {
372
321
  event.preventDefault();
373
- onCollapsedChange(!collapsed);
374
- }}
375
- className={cn(
376
- "flex min-w-0 items-center rounded outline-none focus-visible:ring-2 focus-visible:ring-ring",
377
- collapsed ? "size-7 justify-center" : "flex-1 gap-3",
378
- )}
379
- aria-label={
380
- collapsible && onCollapsedChange
381
- ? collapsed
382
- ? t("navigation.expandSidebar")
383
- : t("navigation.collapseSidebar")
384
- : collapsed
385
- ? APP_TITLE
386
- : undefined
322
+ navigateWithAgentChatViewTransition(navigate, "/home");
387
323
  }
388
- >
389
- <AgentNativeIcon
390
- aria-hidden="true"
391
- className="h-3.5 w-6 shrink-0 text-sidebar-accent-foreground"
392
- />
393
- <div className={cn("min-w-0", collapsed && "sr-only")}>
394
- <p className="truncate text-sm font-semibold text-sidebar-accent-foreground">
395
- {APP_TITLE}
396
- </p>
397
- </div>
398
- </Link>
399
- </div>
400
-
401
- <nav
402
- className={cn(
403
- "flex-1 overflow-y-auto",
404
- collapsed ? "px-0 py-2" : "px-2 py-3",
405
- )}
406
- >
407
- <div className={cn("grid", collapsed ? "gap-0" : "gap-1")}>
408
- {navItems.map((item) => {
409
- const Icon = item.icon;
410
- const isActive =
411
- item.href === "/home"
412
- ? isChatRoute
413
- : location.pathname.startsWith(item.href);
414
- const link = (
415
- <Link
416
- to={item.href}
417
- onClick={(event) => {
418
- if (
419
- item.href === "/home" &&
420
- !isChatRoute &&
421
- !event.metaKey &&
422
- !event.ctrlKey &&
423
- !event.shiftKey &&
424
- !event.altKey
425
- ) {
426
- event.preventDefault();
427
- navigateWithAgentChatViewTransition(navigate, "/home");
428
- }
429
- }}
430
- className={navClass({ isActive })}
431
- aria-current={isActive ? "page" : undefined}
432
- aria-label={collapsed ? t(item.labelKey) : undefined}
433
- >
434
- <Icon className="size-4 shrink-0" />
435
- <span className={collapsed ? "sr-only" : "truncate"}>
436
- {t(item.labelKey)}
437
- </span>
438
- </Link>
439
- );
440
- return (
441
- <div key={item.href}>
442
- {collapsed ? (
443
- <Tooltip>
444
- <TooltipTrigger asChild>{link}</TooltipTrigger>
445
- <TooltipContent side="right">
446
- {t(item.labelKey)}
447
- </TooltipContent>
448
- </Tooltip>
449
- ) : (
450
- link
451
- )}
452
- {!collapsed && item.view === "chat" ? (
453
- <ChatThreadsSection open={isChatRoute} />
454
- ) : null}
455
- </div>
456
- );
457
- })}
458
- </div>
459
- </nav>
460
-
461
- <div className={cn("mt-auto shrink-0", collapsed && "py-2")}>
462
- <nav
463
- className={cn(
464
- "grid",
465
- collapsed ? "gap-0 px-1 py-1" : "gap-1 px-2 py-1",
466
- )}
467
- >
468
- {bottomNavItems.map((item) => {
469
- const Icon = item.icon;
470
- const isActive = location.pathname.startsWith(item.href);
471
- const link = (
472
- <Link
473
- to={item.href}
474
- className={navClass({ isActive })}
475
- aria-current={isActive ? "page" : undefined}
476
- aria-label={collapsed ? t(item.labelKey) : undefined}
477
- >
478
- <Icon className="size-4 shrink-0" />
479
- <span className={collapsed ? "sr-only" : "truncate"}>
480
- {t(item.labelKey)}
481
- </span>
482
- </Link>
483
- );
484
- return collapsed ? (
485
- <Tooltip key={item.href}>
486
- <TooltipTrigger asChild>{link}</TooltipTrigger>
487
- <TooltipContent side="right">{t(item.labelKey)}</TooltipContent>
488
- </Tooltip>
489
- ) : (
490
- <div key={item.href}>{link}</div>
491
- );
492
- })}
493
- </nav>
494
-
495
- <div
496
- className={cn(
497
- collapsed ? "px-1 py-1 empty:hidden" : "px-3 py-2 empty:hidden",
498
- )}
499
- >
500
- <OrgSwitcher
501
- reserveSpace
502
- className={
503
- collapsed
504
- ? "h-8 justify-center px-0 [&>span]:sr-only [&>svg:last-child]:hidden"
505
- : undefined
506
- }
507
- />
508
- </div>
509
-
510
- <SidebarFooterActions
511
- collapsed={collapsed}
512
- feedback={feedbackButton}
513
- search={searchButton}
514
- collapse={collapseButton}
515
- />
516
- </div>
517
- </aside>
324
+ }}
325
+ />
326
+ {!collapsed && <ChatThreadsSection open={isChatRoute} />}
327
+ </AppSidebar>
518
328
  );
519
329
  }