@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
@@ -7,28 +7,28 @@ import { DevDatabaseLink } from "@agent-native/core/client/db-admin";
7
7
  import { useT } from "@agent-native/core/client/i18n";
8
8
  import { openCommandMenu } from "@agent-native/core/client/navigation";
9
9
  import { OrgSwitcher } from "@agent-native/core/client/org";
10
- import { AgentNativeIcon, FeedbackButton } from "@agent-native/core/client/ui";
11
- import { SidebarFooterActions } from "@agent-native/toolkit/app-shell";
10
+ import {
11
+ AppSidebar,
12
+ AppSidebarNavItem,
13
+ FeedbackButton,
14
+ type AppSidebarItemDefinition,
15
+ } from "@agent-native/core/client/ui";
12
16
  import {
13
17
  ChatHistoryRail,
14
18
  type ChatHistoryItem,
15
19
  } from "@agent-native/toolkit/chat-history";
16
- import {
17
- IconLayoutSidebarLeftCollapse,
18
- IconLayoutSidebarLeftExpand,
19
- IconSearch,
20
- } from "@tabler/icons-react";
20
+ import { IconSearch } from "@tabler/icons-react";
21
21
  import { useEffect, useMemo } from "react";
22
- import { Link, NavLink, useLocation, useNavigate } from "react-router";
22
+ import { useLocation, useNavigate } from "react-router";
23
23
  import { toast } from "sonner";
24
24
 
25
+ import { Button } from "@/components/ui/button";
25
26
  import {
26
27
  Tooltip,
27
28
  TooltipContent,
28
29
  TooltipTrigger,
29
30
  } from "@/components/ui/tooltip";
30
31
  import { navItems } from "@/lib/brain";
31
- import { cn } from "@/lib/utils";
32
32
 
33
33
  const primaryNavItems = navItems.filter(
34
34
  (item) => item.view !== "agent" && item.view !== "settings",
@@ -234,234 +234,96 @@ export function Sidebar({
234
234
  const navigate = useNavigate();
235
235
  const t = useT();
236
236
  const isAskRoute = location.pathname === "/home";
237
- const ToggleIcon = collapsed
238
- ? IconLayoutSidebarLeftExpand
239
- : IconLayoutSidebarLeftCollapse;
240
- const navClass = ({ isActive }: { isActive: boolean }) =>
241
- cn(
242
- "flex items-center text-sm transition-colors",
243
- collapsed
244
- ? "h-10 w-10 justify-center rounded-md"
245
- : "h-9 gap-3 rounded-md px-3",
246
- isActive
247
- ? "bg-sidebar-accent text-sidebar-accent-foreground"
248
- : "text-sidebar-foreground hover:bg-sidebar-accent/65 hover:text-sidebar-accent-foreground",
249
- );
250
- const collapseButton = collapsible ? (
251
- <Tooltip>
252
- <TooltipTrigger asChild>
253
- <button
254
- type="button"
255
- onClick={() => onCollapsedChange?.(!collapsed)}
256
- className="flex size-8 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"
257
- aria-label={
258
- collapsed
259
- ? t("navigation.expandSidebar")
260
- : t("navigation.collapseSidebar")
261
- }
262
- >
263
- <ToggleIcon className="size-4" />
264
- </button>
265
- </TooltipTrigger>
266
- <TooltipContent side="right">
267
- {collapsed
268
- ? t("navigation.expandSidebar")
269
- : t("navigation.collapseSidebar")}
270
- </TooltipContent>
271
- </Tooltip>
272
- ) : null;
237
+
238
+ const secondaryItems: AppSidebarItemDefinition[] = bottomNavItems.map(
239
+ (item) => ({
240
+ to: item.href,
241
+ label:
242
+ item.view === "agent"
243
+ ? t("settings.agentTitle")
244
+ : t(`navigation.${item.view}`),
245
+ icon: item.icon,
246
+ active: location.pathname.startsWith(item.href),
247
+ }),
248
+ );
249
+
250
+ const feedbackButton = (
251
+ <FeedbackButton variant={collapsed ? "icon" : "sidebar"} side="right" />
252
+ );
253
+
254
+ const orgSwitcher = <OrgSwitcher compact={collapsed} />;
255
+
273
256
  const searchButton = (
274
257
  <Tooltip>
275
258
  <TooltipTrigger asChild>
276
- <button
259
+ <Button
277
260
  type="button"
261
+ variant="ghost"
262
+ size="icon"
263
+ className="size-9 shrink-0 text-primary hover:bg-accent/60 hover:text-primary"
278
264
  onClick={openCommandMenu}
279
265
  aria-label={t("navigation.search")}
280
- 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"
281
266
  >
282
267
  <IconSearch className="size-4" />
283
- </button>
268
+ </Button>
284
269
  </TooltipTrigger>
285
270
  <TooltipContent side="right">{t("navigation.search")}</TooltipContent>
286
271
  </Tooltip>
287
272
  );
288
- const feedbackButton = (
289
- <FeedbackButton
290
- variant={collapsed ? "icon" : "sidebar"}
291
- side="right"
292
- className={collapsed ? "h-8 w-8" : "min-w-0"}
293
- />
294
- );
295
273
 
296
274
  return (
297
- <aside
298
- data-collapsed={collapsed ? "true" : "false"}
299
- className={cn(
300
- "flex h-full min-w-0 shrink-0 flex-col overflow-hidden border-r border-sidebar-border bg-sidebar text-sidebar-foreground transition-[width] duration-200 ease-out",
301
- collapsed ? "w-12" : "w-60",
302
- )}
275
+ <AppSidebar
276
+ collapsed={collapsed}
277
+ collapsible={collapsible}
278
+ onCollapsedChange={onCollapsedChange}
279
+ brandName={t("navigation.brand")}
280
+ brandHref="/home"
281
+ secondaryItems={secondaryItems}
282
+ feedback={feedbackButton}
283
+ orgSwitcher={orgSwitcher}
284
+ footerExtras={
285
+ <>
286
+ {searchButton}
287
+ <DevDatabaseLink />
288
+ </>
289
+ }
303
290
  >
304
- <div
305
- className={cn(
306
- "flex h-14 shrink-0 items-center border-b border-sidebar-border",
307
- collapsed ? "justify-center px-0" : "gap-3 px-4",
308
- )}
309
- >
310
- <Link
311
- to="/home"
312
- onClick={(event) => {
313
- if (
314
- !collapsible ||
315
- !onCollapsedChange ||
316
- event.metaKey ||
317
- event.ctrlKey ||
318
- event.shiftKey ||
319
- event.altKey ||
320
- event.button !== 0
321
- ) {
322
- return;
323
- }
324
- event.preventDefault();
325
- onCollapsedChange(!collapsed);
326
- }}
327
- className={cn(
328
- "flex min-w-0 items-center rounded outline-none focus-visible:ring-2 focus-visible:ring-ring",
329
- collapsed ? "size-8 justify-center" : "flex-1 gap-3",
330
- )}
331
- aria-label={
332
- collapsible && onCollapsedChange
333
- ? collapsed
334
- ? t("navigation.expandSidebar")
335
- : t("navigation.collapseSidebar")
336
- : collapsed
337
- ? t("navigation.brand")
338
- : undefined
339
- }
340
- >
341
- <AgentNativeIcon
342
- aria-hidden="true"
343
- className="h-3.5 w-6 shrink-0 text-sidebar-accent-foreground"
344
- />
345
- <div className={cn("min-w-0", collapsed && "sr-only")}>
346
- <p className="truncate text-sm font-semibold text-sidebar-accent-foreground">
347
- {t("navigation.brand")}
348
- </p>
349
- </div>
350
- </Link>
351
- </div>
352
-
353
- <nav
354
- className={cn(
355
- "flex-1 overflow-y-auto",
356
- collapsed ? "px-1 py-2" : "px-2 py-3",
357
- )}
358
- >
359
- <div
360
- className={cn(
361
- "grid",
362
- collapsed ? "justify-items-center gap-1" : "gap-1",
363
- )}
364
- >
365
- {primaryNavItems.map((item) => {
366
- const Icon = item.icon;
367
- const label =
368
- item.view === "agent"
369
- ? t("settings.agentTitle")
370
- : t(`navigation.${item.view}`);
371
- const link = (
372
- <NavLink
373
- to={item.href}
374
- end={item.href === "/home"}
375
- onClick={(event) => {
376
- if (
377
- item.view === "ask" &&
378
- !isAskRoute &&
379
- !event.metaKey &&
380
- !event.ctrlKey &&
381
- !event.shiftKey &&
382
- !event.altKey
383
- ) {
384
- event.preventDefault();
385
- navigateWithAgentChatViewTransition(navigate, "/home");
386
- }
387
- }}
388
- className={navClass}
389
- aria-label={collapsed ? label : undefined}
390
- >
391
- <Icon className="size-4 shrink-0" />
392
- <span className={collapsed ? "sr-only" : "truncate"}>
393
- {label}
394
- </span>
395
- </NavLink>
396
- );
397
- return (
398
- <div key={item.href}>
399
- {collapsed ? (
400
- <Tooltip>
401
- <TooltipTrigger asChild>{link}</TooltipTrigger>
402
- <TooltipContent side="right">{label}</TooltipContent>
403
- </Tooltip>
404
- ) : (
405
- link
406
- )}
407
- {!collapsed && item.view === "ask" ? (
408
- <BrainChatsSection open={isAskRoute} />
409
- ) : null}
410
- </div>
411
- );
412
- })}
413
- </div>
414
- </nav>
415
-
416
- <nav className="grid shrink-0 gap-1 px-2 py-1">
417
- {bottomNavItems.map((item) => {
418
- const Icon = item.icon;
419
- const label =
420
- item.view === "agent"
421
- ? t("settings.agentTitle")
422
- : t(`navigation.${item.view}`);
423
- const link = (
424
- <NavLink
291
+ {primaryNavItems.map((item) => {
292
+ const label =
293
+ item.view === "agent"
294
+ ? t("settings.agentTitle")
295
+ : t(`navigation.${item.view}`);
296
+ const isActive =
297
+ item.href === "/home"
298
+ ? isAskRoute
299
+ : location.pathname.startsWith(item.href);
300
+ return (
301
+ <div key={item.href}>
302
+ <AppSidebarNavItem
425
303
  to={item.href}
426
- className={navClass}
427
- aria-label={collapsed ? label : undefined}
428
- >
429
- <Icon className="size-4 shrink-0" />
430
- <span className={collapsed ? "sr-only" : "truncate"}>
431
- {label}
432
- </span>
433
- </NavLink>
434
- );
435
- return collapsed ? (
436
- <Tooltip key={item.href}>
437
- <TooltipTrigger asChild>{link}</TooltipTrigger>
438
- <TooltipContent side="right">{label}</TooltipContent>
439
- </Tooltip>
440
- ) : (
441
- <div key={item.href}>{link}</div>
442
- );
443
- })}
444
- </nav>
445
-
446
- <div className="mt-auto shrink-0">
447
- {!collapsed ? (
448
- <div className="px-3 py-2 empty:hidden">
449
- <OrgSwitcher />
304
+ label={label}
305
+ icon={item.icon}
306
+ active={isActive}
307
+ onClick={(event) => {
308
+ if (
309
+ item.view === "ask" &&
310
+ !isAskRoute &&
311
+ !event.metaKey &&
312
+ !event.ctrlKey &&
313
+ !event.shiftKey &&
314
+ !event.altKey
315
+ ) {
316
+ event.preventDefault();
317
+ navigateWithAgentChatViewTransition(navigate, "/home");
318
+ }
319
+ }}
320
+ />
321
+ {!collapsed && item.view === "ask" ? (
322
+ <BrainChatsSection open={isAskRoute} />
323
+ ) : null}
450
324
  </div>
451
- ) : null}
452
-
453
- {!collapsed ? (
454
- <div className="px-3 py-2 empty:hidden">
455
- <DevDatabaseLink />
456
- </div>
457
- ) : null}
458
- <SidebarFooterActions
459
- collapsed={collapsed}
460
- feedback={feedbackButton}
461
- search={searchButton}
462
- collapse={collapseButton}
463
- />
464
- </div>
465
- </aside>
325
+ );
326
+ })}
327
+ </AppSidebar>
466
328
  );
467
329
  }