@agent-native/dispatch 0.23.2 → 0.23.3

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 (47) hide show
  1. package/dist/components/app-open-actions.d.ts.map +1 -1
  2. package/dist/components/app-open-actions.js +3 -2
  3. package/dist/components/app-open-actions.js.map +1 -1
  4. package/dist/components/layout/Layout.d.ts +4 -2
  5. package/dist/components/layout/Layout.d.ts.map +1 -1
  6. package/dist/components/layout/Layout.js +83 -12
  7. package/dist/components/layout/Layout.js.map +1 -1
  8. package/dist/components/layout/workspace-apps-rail.d.ts.map +1 -1
  9. package/dist/components/layout/workspace-apps-rail.js +2 -22
  10. package/dist/components/layout/workspace-apps-rail.js.map +1 -1
  11. package/dist/components/workspace-app-card.d.ts.map +1 -1
  12. package/dist/components/workspace-app-card.js +3 -4
  13. package/dist/components/workspace-app-card.js.map +1 -1
  14. package/dist/components/workspace-template-card.d.ts.map +1 -1
  15. package/dist/components/workspace-template-card.js +1 -1
  16. package/dist/components/workspace-template-card.js.map +1 -1
  17. package/dist/lib/workspace-apps.d.ts +1 -0
  18. package/dist/lib/workspace-apps.d.ts.map +1 -1
  19. package/dist/lib/workspace-apps.js +13 -0
  20. package/dist/lib/workspace-apps.js.map +1 -1
  21. package/dist/routes/index.js +1 -1
  22. package/dist/routes/index.js.map +1 -1
  23. package/dist/routes/pages/agent-integrations.d.ts +5 -0
  24. package/dist/routes/pages/agent-integrations.d.ts.map +1 -0
  25. package/dist/routes/pages/agent-integrations.js +15 -0
  26. package/dist/routes/pages/agent-integrations.js.map +1 -0
  27. package/dist/routes/pages/apps.$appId.d.ts.map +1 -1
  28. package/dist/routes/pages/apps.$appId.js +14 -2
  29. package/dist/routes/pages/apps.$appId.js.map +1 -1
  30. package/dist/routes/pages/overview.d.ts +2 -2
  31. package/dist/routes/pages/settings.d.ts.map +1 -1
  32. package/dist/routes/pages/settings.js +1 -1
  33. package/dist/routes/pages/settings.js.map +1 -1
  34. package/package.json +2 -2
  35. package/src/components/app-open-actions.tsx +3 -2
  36. package/src/components/layout/Layout.tsx +111 -16
  37. package/src/components/layout/workspace-apps-rail.tsx +2 -25
  38. package/src/components/workspace-app-card.spec.tsx +6 -6
  39. package/src/components/workspace-app-card.tsx +4 -7
  40. package/src/components/workspace-template-card.spec.tsx +4 -16
  41. package/src/components/workspace-template-card.tsx +0 -1
  42. package/src/lib/workspace-apps.spec.ts +21 -0
  43. package/src/lib/workspace-apps.ts +12 -0
  44. package/src/routes/index.ts +1 -1
  45. package/src/routes/pages/agent-integrations.tsx +24 -0
  46. package/src/routes/pages/apps.$appId.tsx +19 -1
  47. package/src/routes/pages/settings.tsx +1 -19
@@ -1 +1 @@
1
- {"version":3,"file":"app-open-actions.d.ts","sourceRoot":"","sources":["../../src/components/app-open-actions.tsx"],"names":[],"mappings":"AAUA,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AASD,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,GAAG,EACH,MAAM,EAAE,cAAc,EACtB,QAAQ,EACR,YAAY,EACZ,gBAAwB,EACxB,gBAAwB,GACzB,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,mDAoEA"}
1
+ {"version":3,"file":"app-open-actions.d.ts","sourceRoot":"","sources":["../../src/components/app-open-actions.tsx"],"names":[],"mappings":"AAUA,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AASD,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,GAAG,EACH,MAAM,EAAE,cAAc,EACtB,QAAQ,EACR,YAAY,EACZ,gBAAwB,EACxB,gBAAwB,GACzB,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,mDAqEA"}
@@ -10,11 +10,12 @@ const DEFAULT_LABELS = {
10
10
  };
11
11
  export function AppOpenActions({ name, href, target, rel, labels: labelOverrides, onAddApp, onOpenInline, showInlineOption = false, showNewTabOption = false, }) {
12
12
  const labels = { ...DEFAULT_LABELS, ...labelOverrides };
13
+ const canOfferNewTab = showNewTabOption && target !== "_blank";
13
14
  const hasMenu = Boolean(onAddApp) ||
14
- (Boolean(href) && (showInlineOption || showNewTabOption));
15
+ (Boolean(href) && (showInlineOption || canOfferNewTab));
15
16
  if (!href && !hasMenu) {
16
17
  return (_jsx(Button, { size: "sm", variant: "outline", disabled: true, children: labels.openApp }));
17
18
  }
18
- return (_jsxs("div", { className: "flex shrink-0 overflow-hidden rounded-md border border-border focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2", children: [_jsx(Button, { asChild: Boolean(href), size: "sm", variant: "outline", className: "rounded-none border-0 border-e border-border", disabled: !href, children: href ? (_jsx("a", { href: href, target: target, rel: rel, children: labels.openApp })) : (_jsx("span", { children: labels.openApp })) }), hasMenu ? (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { type: "button", size: "sm", variant: "outline", className: "size-9 rounded-none border-0 p-0", "aria-label": `Open options for ${name}`, children: _jsx(IconChevronDown, { size: 15 }) }) }), _jsxs(DropdownMenuContent, { align: "end", className: "min-w-40", children: [onAddApp ? (_jsxs(DropdownMenuItem, { onSelect: onAddApp, children: [_jsx(IconPlus, { size: 14, className: "mr-2" }), labels.addApp] })) : null, showInlineOption && href ? (_jsx(DropdownMenuItem, { onSelect: onOpenInline, children: labels.openInline })) : null, showNewTabOption && href ? (_jsx(DropdownMenuItem, { asChild: true, children: _jsx("a", { href: href, target: "_blank", rel: "noreferrer", children: labels.openInNewTab }) })) : null] })] })) : null] }));
19
+ return (_jsxs("div", { className: "flex shrink-0 overflow-hidden rounded-md border border-border focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2", children: [_jsx(Button, { asChild: Boolean(href), size: "sm", variant: "outline", className: "rounded-none border-0 border-e border-border", disabled: !href, children: href ? (_jsx("a", { href: href, target: target, rel: rel, children: labels.openApp })) : (_jsx("span", { children: labels.openApp })) }), hasMenu ? (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { type: "button", size: "sm", variant: "outline", className: "size-9 rounded-none border-0 p-0", "aria-label": `Open options for ${name}`, children: _jsx(IconChevronDown, { size: 15 }) }) }), _jsxs(DropdownMenuContent, { align: "end", className: "min-w-40", children: [onAddApp ? (_jsxs(DropdownMenuItem, { onSelect: onAddApp, children: [_jsx(IconPlus, { size: 14, className: "mr-2" }), labels.addApp] })) : null, showInlineOption && href ? (_jsx(DropdownMenuItem, { onSelect: onOpenInline, children: labels.openInline })) : null, canOfferNewTab && href ? (_jsx(DropdownMenuItem, { asChild: true, children: _jsx("a", { href: href, target: "_blank", rel: "noreferrer", children: labels.openInNewTab }) })) : null] })] })) : null] }));
19
20
  }
20
21
  //# sourceMappingURL=app-open-actions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"app-open-actions.js","sourceRoot":"","sources":["../../src/components/app-open-actions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAS5B,MAAM,cAAc,GAAwB;IAC1C,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,UAAU;IACnB,UAAU,EAAE,aAAa;IACzB,YAAY,EAAE,iBAAiB;CAChC,CAAC;AAEF,MAAM,UAAU,cAAc,CAAC,EAC7B,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,GAAG,EACH,MAAM,EAAE,cAAc,EACtB,QAAQ,EACR,YAAY,EACZ,gBAAgB,GAAG,KAAK,EACxB,gBAAgB,GAAG,KAAK,GAWzB;IACC,MAAM,MAAM,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,cAAc,EAAE,CAAC;IACxD,MAAM,OAAO,GACX,OAAO,CAAC,QAAQ,CAAC;QACjB,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,IAAI,gBAAgB,CAAC,CAAC,CAAC;IAE5D,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACtB,OAAO,CACL,KAAC,MAAM,IAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAC,SAAS,EAAC,QAAQ,kBACzC,MAAM,CAAC,OAAO,GACR,CACV,CAAC;IACJ,CAAC;IAED,OAAO,CACL,eAAK,SAAS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AAC,GAAG,EAAC,YAAY,YAC5C,MAAM,CAAC,YAAY,GAClB,GACa,CACpB,CAAC,CAAC,CAAC,IAAI,IACY,IACT,CAChB,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { IconChevronDown, IconPlus } from \"@tabler/icons-react\";\n\nimport { Button } from \"./ui/button\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from \"./ui/dropdown-menu\";\n\nexport interface AppOpenActionLabels {\n addApp: string;\n openApp: string;\n openInline: string;\n openInNewTab: string;\n}\n\nconst DEFAULT_LABELS: AppOpenActionLabels = {\n addApp: \"Add app\",\n openApp: \"Open app\",\n openInline: \"Open inline\",\n openInNewTab: \"Open in new tab\",\n};\n\nexport function AppOpenActions({\n name,\n href,\n target,\n rel,\n labels: labelOverrides,\n onAddApp,\n onOpenInline,\n showInlineOption = false,\n showNewTabOption = false,\n}: {\n name: string;\n href: string | null;\n target?: \"_blank\";\n rel?: string;\n labels?: Partial<AppOpenActionLabels>;\n onAddApp?: () => void;\n onOpenInline?: () => void;\n showInlineOption?: boolean;\n showNewTabOption?: boolean;\n}) {\n const labels = { ...DEFAULT_LABELS, ...labelOverrides };\n const hasMenu =\n Boolean(onAddApp) ||\n (Boolean(href) && (showInlineOption || showNewTabOption));\n\n if (!href && !hasMenu) {\n return (\n <Button size=\"sm\" variant=\"outline\" disabled>\n {labels.openApp}\n </Button>\n );\n }\n\n return (\n <div className=\"flex shrink-0 overflow-hidden rounded-md border border-border focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2\">\n <Button\n asChild={Boolean(href)}\n size=\"sm\"\n variant=\"outline\"\n className=\"rounded-none border-0 border-e border-border\"\n disabled={!href}\n >\n {href ? (\n <a href={href} target={target} rel={rel}>\n {labels.openApp}\n </a>\n ) : (\n <span>{labels.openApp}</span>\n )}\n </Button>\n {hasMenu ? (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n className=\"size-9 rounded-none border-0 p-0\"\n aria-label={`Open options for ${name}`}\n >\n <IconChevronDown size={15} />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"min-w-40\">\n {onAddApp ? (\n <DropdownMenuItem onSelect={onAddApp}>\n <IconPlus size={14} className=\"mr-2\" />\n {labels.addApp}\n </DropdownMenuItem>\n ) : null}\n {showInlineOption && href ? (\n <DropdownMenuItem onSelect={onOpenInline}>\n {labels.openInline}\n </DropdownMenuItem>\n ) : null}\n {showNewTabOption && href ? (\n <DropdownMenuItem asChild>\n <a href={href} target=\"_blank\" rel=\"noreferrer\">\n {labels.openInNewTab}\n </a>\n </DropdownMenuItem>\n ) : null}\n </DropdownMenuContent>\n </DropdownMenu>\n ) : null}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"app-open-actions.js","sourceRoot":"","sources":["../../src/components/app-open-actions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAS5B,MAAM,cAAc,GAAwB;IAC1C,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,UAAU;IACnB,UAAU,EAAE,aAAa;IACzB,YAAY,EAAE,iBAAiB;CAChC,CAAC;AAEF,MAAM,UAAU,cAAc,CAAC,EAC7B,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,GAAG,EACH,MAAM,EAAE,cAAc,EACtB,QAAQ,EACR,YAAY,EACZ,gBAAgB,GAAG,KAAK,EACxB,gBAAgB,GAAG,KAAK,GAWzB;IACC,MAAM,MAAM,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,cAAc,EAAE,CAAC;IACxD,MAAM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ClC,KAAC,QAAQ,IAAC,IAAI,EAAE,EAAE,EAAE,SAAS,EAAC,MAAM,GAAG,EACtC,MAAM,CAAC,MAAM,IACG,CACpB,CAAC,CAAC,CAAC,IAAI,EACP,gBAAgB,IAAI,IAAI,CAAC,CAAC,CAAC,CAC1B,KAAC,gBAAgB,IAAC,QAAQ,EAAE,YAAY,YACrC,MAAM,CAAC,UAAU,GACD,CACpB,CAAC,CAAC,CAAC,IAAI,EACP,cAAc,IAAI,IAAI,CAAC,CAAC,CAAC,CACxB,KAAC,gBAAgB,IAAC,OAAO,kBACvB,YAAG,IAAI,EAAE,IAAI,EAAE,MAAM,EAAC,QAAQ,EAAC,GAAG,EAAC,YAAY,YAC5C,MAAM,CAAC,YAAY,GAClB,GACa,CACpB,CAAC,CAAC,CAAC,IAAI,IACY,IACT,CAChB,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { IconChevronDown, IconPlus } from \"@tabler/icons-react\";\n\nimport { Button } from \"./ui/button\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from \"./ui/dropdown-menu\";\n\nexport interface AppOpenActionLabels {\n addApp: string;\n openApp: string;\n openInline: string;\n openInNewTab: string;\n}\n\nconst DEFAULT_LABELS: AppOpenActionLabels = {\n addApp: \"Add app\",\n openApp: \"Open app\",\n openInline: \"Open inline\",\n openInNewTab: \"Open in new tab\",\n};\n\nexport function AppOpenActions({\n name,\n href,\n target,\n rel,\n labels: labelOverrides,\n onAddApp,\n onOpenInline,\n showInlineOption = false,\n showNewTabOption = false,\n}: {\n name: string;\n href: string | null;\n target?: \"_blank\";\n rel?: string;\n labels?: Partial<AppOpenActionLabels>;\n onAddApp?: () => void;\n onOpenInline?: () => void;\n showInlineOption?: boolean;\n showNewTabOption?: boolean;\n}) {\n const labels = { ...DEFAULT_LABELS, ...labelOverrides };\n const canOfferNewTab = showNewTabOption && target !== \"_blank\";\n const hasMenu =\n Boolean(onAddApp) ||\n (Boolean(href) && (showInlineOption || canOfferNewTab));\n\n if (!href && !hasMenu) {\n return (\n <Button size=\"sm\" variant=\"outline\" disabled>\n {labels.openApp}\n </Button>\n );\n }\n\n return (\n <div className=\"flex shrink-0 overflow-hidden rounded-md border border-border focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2\">\n <Button\n asChild={Boolean(href)}\n size=\"sm\"\n variant=\"outline\"\n className=\"rounded-none border-0 border-e border-border\"\n disabled={!href}\n >\n {href ? (\n <a href={href} target={target} rel={rel}>\n {labels.openApp}\n </a>\n ) : (\n <span>{labels.openApp}</span>\n )}\n </Button>\n {hasMenu ? (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n className=\"size-9 rounded-none border-0 p-0\"\n aria-label={`Open options for ${name}`}\n >\n <IconChevronDown size={15} />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"min-w-40\">\n {onAddApp ? (\n <DropdownMenuItem onSelect={onAddApp}>\n <IconPlus size={14} className=\"mr-2\" />\n {labels.addApp}\n </DropdownMenuItem>\n ) : null}\n {showInlineOption && href ? (\n <DropdownMenuItem onSelect={onOpenInline}>\n {labels.openInline}\n </DropdownMenuItem>\n ) : null}\n {canOfferNewTab && href ? (\n <DropdownMenuItem asChild>\n <a href={href} target=\"_blank\" rel=\"noreferrer\">\n {labels.openInNewTab}\n </a>\n </DropdownMenuItem>\n ) : null}\n </DropdownMenuContent>\n </DropdownMenu>\n ) : null}\n </div>\n );\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { type ChatFirstAppLayoutPreference } from "@agent-native/core/client/agent-chat";
2
- import { type ChatFirstAppItem } from "@agent-native/core/client/chat-first";
2
+ import { type ChatFirstAppItem, type ChatFirstPrimaryTab } from "@agent-native/core/client/chat-first";
3
3
  import { type ComponentType, type ReactNode } from "react";
4
4
  export type DispatchNavSection = "primary" | "operations";
5
5
  export type DispatchNavIcon = ComponentType<{
@@ -37,7 +37,7 @@ interface ChatFirstEmbedSessionInput {
37
37
  export declare function buildChatFirstEmbedSessionInput(appId: string, path: string): ChatFirstEmbedSessionInput;
38
38
  export declare function useDispatchExtensions(): DispatchExtensionConfig | undefined;
39
39
  export declare function formatThreadAge(updatedAt: number, now?: number): string;
40
- export declare function NavContent({ onNavigate, extensions, chatFirstMode, chatFirstEmbedded, collapsed, collapsible, onCollapsedChange, chatFirstAppLayout, onChatFirstAppLayoutChange, chatFirstApps, chatFirstAppsLoading, chatFirstAppsError, chatFirstActiveAppId, onChatFirstAppOpen, onChatFirstAppsRetry, }: {
40
+ export declare function NavContent({ onNavigate, extensions, chatFirstMode, chatFirstEmbedded, collapsed, collapsible, onCollapsedChange, chatFirstAppLayout, onChatFirstAppLayoutChange, chatFirstApps, chatFirstAppsLoading, chatFirstAppsError, chatFirstActiveAppId, chatFirstActivePrimaryTab, onChatFirstNewChat, onChatFirstAppOpen, onChatFirstAppsRetry, }: {
41
41
  onNavigate?: () => void;
42
42
  extensions?: DispatchExtensionConfig;
43
43
  chatFirstMode?: boolean;
@@ -51,6 +51,8 @@ export declare function NavContent({ onNavigate, extensions, chatFirstMode, chat
51
51
  chatFirstAppsLoading?: boolean;
52
52
  chatFirstAppsError?: string | null;
53
53
  chatFirstActiveAppId?: string;
54
+ chatFirstActivePrimaryTab?: ChatFirstPrimaryTab;
55
+ onChatFirstNewChat?: () => void;
54
56
  onChatFirstAppOpen?: (app: ChatFirstAppItem) => void;
55
57
  onChatFirstAppsRetry?: () => void;
56
58
  }): import("node_modules/@types/react").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAuBL,KAAK,4BAA4B,EAYlC,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EAaL,KAAK,gBAAgB,EAGtB,MAAM,sCAAsC,CAAC;AAgC9C,OA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mDA0VA;AAED,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,UAAU,EACV,aAAa,GACd,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,uBAAuB,CAAC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,mDAwnCA"}
@@ -16,7 +16,7 @@ import { createContext, useEffect, useMemo, useRef, useState, useContext, useCal
16
16
  import { Link, useLocation, useNavigate } from "react-router";
17
17
  import { toast } from "sonner";
18
18
  import { cn } from "../../lib/utils.js";
19
- import { mergeChatFirstWorkspaceApps, } from "../../lib/workspace-apps.js";
19
+ import { mergeChatFirstWorkspaceApps, workspaceAppIdFromRoute, workspaceAppRoute, } from "../../lib/workspace-apps.js";
20
20
  import { AppIcon } from "../app-icon.js";
21
21
  import { CreateAppPopover } from "../create-app-popover.js";
22
22
  import { Sheet, SheetContent, SheetDescription, SheetTitle } from "../ui/sheet.js";
@@ -115,6 +115,24 @@ function localDispatchPath(pathname) {
115
115
  }
116
116
  return pathname;
117
117
  }
118
+ function chatFirstPrimaryTabForPath(pathname) {
119
+ if (pathname === "/chat" || pathname.startsWith("/chat/")) {
120
+ return "new-chat";
121
+ }
122
+ if (pathname === "/integrations" ||
123
+ pathname.startsWith("/integrations/") ||
124
+ pathname === "/admin/integrations" ||
125
+ pathname.startsWith("/admin/integrations/")) {
126
+ return "integrations";
127
+ }
128
+ if (pathname === "/automations" ||
129
+ pathname.startsWith("/automations/") ||
130
+ pathname === "/admin/automations" ||
131
+ pathname.startsWith("/admin/automations/")) {
132
+ return "scheduled";
133
+ }
134
+ return undefined;
135
+ }
118
136
  function dispatchNavLinkTarget(path) {
119
137
  if (typeof window === "undefined")
120
138
  return path;
@@ -420,7 +438,10 @@ function DispatchChatsSection({ onNavigate, showNewChat = false, prelude, chatFi
420
438
  if (threadId)
421
439
  openThread(threadId, { isNew: true });
422
440
  }
423
- return (_jsxs("div", { className: cn("min-w-0 space-y-0.5", showNewChat && "dispatch-chat-first-chats"), children: [showNewChat && chatFirstNavigation ? (_jsx("nav", { className: "space-y-0.5 px-0 py-2", children: _jsx(ChatFirstPrimaryNavigation, { copy: chatFirstCopy, onNewChat: () => void handleNewChat(), onOpenIntegrations: chatFirstNavigation.onOpenIntegrations, onOpenScheduled: chatFirstNavigation.onOpenScheduled, onSearch: openCommandMenu }) })) : null, prelude, !chatFirstMode ? (_jsx("div", { className: "flex justify-end px-2 pt-0.5", children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { type: "button", "data-dispatch-chat-source-toggle": true, "aria-pressed": includeExternal, "aria-label": includeExternal
441
+ return (_jsxs("div", { className: cn("min-w-0 space-y-0.5", showNewChat && "dispatch-chat-first-chats"), children: [showNewChat && chatFirstNavigation ? (_jsx("nav", { className: "space-y-0.5 px-2 py-2", children: _jsx(ChatFirstPrimaryNavigation, { copy: chatFirstCopy, onNewChat: () => {
442
+ chatFirstNavigation.onNewChat?.();
443
+ void handleNewChat();
444
+ }, onOpenIntegrations: chatFirstNavigation.onOpenIntegrations, onOpenScheduled: chatFirstNavigation.onOpenScheduled, onSearch: openCommandMenu, activeTab: chatFirstNavigation.activeTab }) })) : null, prelude, !chatFirstMode ? (_jsx("div", { className: "flex justify-end px-2 pt-0.5", children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { type: "button", "data-dispatch-chat-source-toggle": true, "aria-pressed": includeExternal, "aria-label": includeExternal
424
445
  ? t("dispatch.sidebar.showLocalChats", {
425
446
  defaultValue: "Show local chats",
426
447
  })
@@ -458,7 +479,7 @@ function DispatchChatsSection({ onNavigate, showNewChat = false, prelude, chatFi
458
479
  kind: "agent-chat",
459
480
  sourceSessionId: displayedActiveThreadId ?? undefined,
460
481
  });
461
- }, children: [_jsx(IconEye, { size: 13, strokeWidth: 1.8 }), _jsx("span", { children: "Watch and message session" })] })) : null] })), className: "min-w-0" })) : (_jsx(ChatHistoryRail, { items: chatItems, activeId: displayedActiveThreadId, onSelect: (threadId) => openThread(threadId), onNewChat: () => void handleNewChat(), railLabels: {
482
+ }, children: [_jsx(IconEye, { size: 13, strokeWidth: 1.8 }), _jsx("span", { children: "Watch and message session" })] })) : null] })), className: "min-w-0 px-2" })) : (_jsx(ChatHistoryRail, { items: chatItems, activeId: displayedActiveThreadId, onSelect: (threadId) => openThread(threadId), onNewChat: () => void handleNewChat(), railLabels: {
462
483
  newChat: t("dispatch.sidebar.newChat"),
463
484
  showMore: t("dispatch.sidebar.chats"),
464
485
  showLess: t("dispatch.sidebar.chats"),
@@ -485,9 +506,9 @@ function DispatchChatsSection({ onNavigate, showNewChat = false, prelude, chatFi
485
506
  kind: "agent-chat",
486
507
  sourceSessionId: displayedActiveThreadId ?? undefined,
487
508
  });
488
- }, children: [_jsx(IconEye, { size: 13, strokeWidth: 1.8 }), _jsx("span", { children: "Watch and message session" })] })) : null] })), className: "min-w-0" }))] }));
509
+ }, children: [_jsx(IconEye, { size: 13, strokeWidth: 1.8 }), _jsx("span", { children: "Watch and message session" })] })) : null] })), className: cn("min-w-0", chatFirstMode && "px-2") }))] }));
489
510
  }
490
- export function NavContent({ onNavigate, extensions, chatFirstMode = false, chatFirstEmbedded = false, collapsed = false, collapsible = false, onCollapsedChange, chatFirstAppLayout, onChatFirstAppLayoutChange, chatFirstApps = [], chatFirstAppsLoading = false, chatFirstAppsError, chatFirstActiveAppId, onChatFirstAppOpen, onChatFirstAppsRetry, }) {
511
+ export function NavContent({ onNavigate, extensions, chatFirstMode = false, chatFirstEmbedded = false, collapsed = false, collapsible = false, onCollapsedChange, chatFirstAppLayout, onChatFirstAppLayoutChange, chatFirstApps = [], chatFirstAppsLoading = false, chatFirstAppsError, chatFirstActiveAppId, chatFirstActivePrimaryTab, onChatFirstNewChat, onChatFirstAppOpen, onChatFirstAppsRetry, }) {
491
512
  const t = useT();
492
513
  const chatFirstCopy = useMemo(() => createDispatchChatFirstCopy(t), [t]);
493
514
  const location = useLocation();
@@ -559,6 +580,8 @@ export function NavContent({ onNavigate, extensions, chatFirstMode = false, chat
559
580
  const organizationPicker = (_jsx("div", { className: cn("py-2", collapsed ? "flex justify-center px-1" : "px-3"), children: _jsx(OrgSwitcher, { compact: collapsed, reserveSpace: true }) }));
560
581
  const sidebarFooterActions = (_jsx(SidebarFooterActions, { collapsed: collapsed, feedback: feedbackButton, search: searchButton, collapse: collapseButton }));
561
582
  return (_jsxs(_Fragment, { children: [_jsx("div", { className: cn("flex h-12 shrink-0 items-center border-b border-sidebar-border", collapsed ? "justify-center px-0" : "px-4"), children: _jsxs("div", { className: cn("flex items-center", collapsed ? "justify-center" : "gap-2"), children: [_jsx("img", { src: appPath("/agent-native-icon-light.svg"), alt: "", "aria-hidden": "true", width: 35, height: 20, className: cn("block shrink-0 object-contain object-center dark:hidden", collapsed ? "h-4 w-7" : "h-5 w-[35px]") }), _jsx("img", { src: appPath("/agent-native-icon-dark.svg"), alt: "", "aria-hidden": "true", width: 35, height: 20, className: cn("hidden shrink-0 object-contain object-center dark:block", collapsed ? "h-4 w-7" : "h-5 w-[35px]") }), !collapsed && (_jsx("div", { className: "min-w-0 flex-1", children: _jsx("div", { "data-dispatch-sidebar-label": true, className: "truncate text-lg font-bold tracking-tight text-foreground", children: DISPATCH_SIDEBAR_LABEL }) }))] }) }), chatFirstMode ? (_jsx("div", { className: "flex min-h-0 flex-1 flex-col overflow-y-auto", children: !collapsed ? (_jsx(DispatchChatsSection, { onNavigate: onNavigate, showNewChat: true, chatFirstMode: true, chatFirstEmbedded: chatFirstEmbedded, chatFirstNavigation: {
583
+ activeTab: chatFirstActivePrimaryTab,
584
+ onNewChat: onChatFirstNewChat,
562
585
  onOpenIntegrations: () => {
563
586
  navigate(dispatchNavLinkTarget("/admin/integrations"));
564
587
  onNavigate?.();
@@ -596,6 +619,12 @@ export function Layout({ children, extensions, agentPageHref, }) {
596
619
  new URLSearchParams(window.location.search).get("chatFirst") === "1";
597
620
  const chatFirstMode = extensions?.chatFirst === true || chatFirstPreference || chatFirstEmbedded;
598
621
  const chatFirstHasActiveChat = chatFirstSurfaceScope !== "new";
622
+ useEffect(() => {
623
+ if (!chatFirstMode || chatFirstEmbedded || localPathname !== "/overview") {
624
+ return;
625
+ }
626
+ navigate(dispatchNavLinkTarget("/chat"), { replace: true });
627
+ }, [chatFirstEmbedded, chatFirstMode, localPathname, navigate]);
599
628
  const [chatFirstAppLayout, setChatFirstAppLayout] = useState(() => readChatFirstAppLayout());
600
629
  const chatFirstAppLayoutHydratedRef = useRef(false);
601
630
  const chatFirstAppsQuery = useActionQuery("list-workspace-apps", { includeAgentCards: false }, { enabled: chatFirstMode });
@@ -637,6 +666,7 @@ export function Layout({ children, extensions, agentPageHref, }) {
637
666
  const [chatFirstEmbedUrl, setChatFirstEmbedUrl] = useState(null);
638
667
  const [chatFirstEmbedError, setChatFirstEmbedError] = useState(null);
639
668
  const [chatFirstEmbedAttempt, setChatFirstEmbedAttempt] = useState(0);
669
+ const chatFirstAppFrameRef = useRef(null);
640
670
  const [chatFirstNotice, setChatFirstNotice] = useState(null);
641
671
  const chatFirstSessionWatch = useChatFirstSessionWatch();
642
672
  const chatFirstSurfaceTabs = useChatFirstSurfaceTabs(chatFirstSurfaceScope);
@@ -658,6 +688,18 @@ export function Layout({ children, extensions, agentPageHref, }) {
658
688
  isChatRoute &&
659
689
  activeChatFirstSurfaceTab?.kind === "app" &&
660
690
  activeChatFirstSurfaceTab.placement === "main";
691
+ const chatFirstAppSelected = chatFirstMode && activeChatFirstSurfaceTab?.kind === "app";
692
+ const chatFirstActivePrimaryTab = chatFirstAppSelected
693
+ ? activeChatFirstSurfaceTab?.kind === "app" &&
694
+ activeChatFirstSurfaceTab.appId === "dispatch"
695
+ ? chatFirstPrimaryTabForPath(activeChatFirstSurfaceTab.path ?? "")
696
+ : undefined
697
+ : chatFirstPrimaryTabForPath(localPathname);
698
+ const chatFirstActiveAppId = isWorkspaceAppRoute
699
+ ? (workspaceAppIdFromRoute(localPathname) ?? undefined)
700
+ : chatFirstAppSelected && activeChatFirstSurfaceTab?.kind === "app"
701
+ ? activeChatFirstSurfaceTab.appId
702
+ : undefined;
661
703
  const activeChatFirstAppRegistration = useMemo(() => activeChatFirstSurfaceTab?.kind === "app" &&
662
704
  activeChatFirstSurfaceTab.appId
663
705
  ? (chatFirstAppRegistrations.find((app) => app.id === activeChatFirstSurfaceTab.appId) ?? null)
@@ -721,12 +763,37 @@ export function Layout({ children, extensions, agentPageHref, }) {
721
763
  createChatFirstEmbedSession.mutateAsync,
722
764
  isChatRoute,
723
765
  ]);
766
+ useEffect(() => {
767
+ if (!chatFirstMode || !isChatRoute || !activeChatFirstApp)
768
+ return;
769
+ const handleEmbedSessionExpired = (event) => {
770
+ if (event.data?.type !== "agentNative.embedSessionExpired" ||
771
+ event.source !== chatFirstAppFrameRef.current?.contentWindow) {
772
+ return;
773
+ }
774
+ setChatFirstEmbedAttempt((attempt) => attempt + 1);
775
+ };
776
+ window.addEventListener("message", handleEmbedSessionExpired);
777
+ return () => window.removeEventListener("message", handleEmbedSessionExpired);
778
+ }, [activeChatFirstApp, chatFirstMode, isChatRoute]);
724
779
  const persistChatFirstPane = useCallback((pane) => {
725
780
  setChatFirstPane(pane);
726
781
  void writeClientAppState(CHAT_FIRST_PANE_STATE_KEY, pane).catch(() => {
727
782
  setChatFirstNotice("The app pane opened locally, but its focus could not be synced.");
728
783
  });
729
784
  }, []);
785
+ useEffect(() => {
786
+ if (!chatFirstMode || isChatRoute)
787
+ return;
788
+ persistChatFirstPane(null);
789
+ closeChatFirstSessionWatch();
790
+ chatFirstSurfaceTabsStore.closeAll();
791
+ }, [
792
+ chatFirstMode,
793
+ chatFirstSurfaceTabsStore,
794
+ isChatRoute,
795
+ persistChatFirstPane,
796
+ ]);
730
797
  const openChatFirstPane = useCallback((pane, placement = "side") => {
731
798
  if (placement === "side" && !chatFirstHasActiveChat)
732
799
  return;
@@ -1120,7 +1187,7 @@ export function Layout({ children, extensions, agentPageHref, }) {
1120
1187
  ? "loading"
1121
1188
  : app
1122
1189
  ? "loading"
1123
- : "unresolved", embedUrl: chatFirstEmbedUrl, errorMessage: chatFirstEmbedError, onRetry: () => setChatFirstEmbedAttempt((value) => value + 1), renderEmbed: ({ url, title }) => (_jsx("iframe", { "data-dispatch-chat-first-app-frame": true, src: url, title: title ?? chatFirstCopy("appUnavailable"), referrerPolicy: "no-referrer", allow: "clipboard-read; clipboard-write", className: "h-full w-full border-0 bg-background" })), copy: chatFirstCopy }));
1190
+ : "unresolved", embedUrl: chatFirstEmbedUrl, errorMessage: chatFirstEmbedError, onRetry: () => setChatFirstEmbedAttempt((value) => value + 1), renderEmbed: ({ url, title }) => (_jsx("iframe", { "data-dispatch-chat-first-app-frame": true, src: url, title: title ?? chatFirstCopy("appUnavailable"), ref: chatFirstAppFrameRef, referrerPolicy: "no-referrer", allow: "clipboard-read; clipboard-write", className: "h-full w-full border-0 bg-background" })), copy: chatFirstCopy }));
1124
1191
  }
1125
1192
  if (tab.kind === "browser" && tab.url) {
1126
1193
  return (_jsx(ChatFirstBrowserPane, { url: tab.url, title: tab.title, onClose: () => closeChatFirstSurfaceTab(tab), renderEmbed: ({ url, title, key }) => (_jsx("iframe", { src: url, title: title ?? chatFirstCopy("browserPage"), referrerPolicy: "no-referrer", allow: "clipboard-read; clipboard-write", className: "h-full w-full border-0 bg-background" }, key)), copy: chatFirstCopy }));
@@ -1193,12 +1260,16 @@ export function Layout({ children, extensions, agentPageHref, }) {
1193
1260
  chatFirstSurfacePanel.open ? (_jsxs(ChatFirstSurfacePanel, { width: chatFirstSurfaceResize.width, onResizePointerDown: chatFirstSurfaceResize.onPointerDown, copy: chatFirstCopy, children: [chatFirstSurfaceTabsBar, chatFirstSurfaceContent] })) : 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 }));
1194
1261
  return (_jsx(DispatchExtensionsContext.Provider, { value: extensions, children: _jsx(HeaderActionsProvider, { children: _jsxs("div", { className: "agent-layout-shell flex h-screen w-full overflow-hidden bg-background", children: [_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-56"), children: _jsx(NavContent, { extensions: extensions, chatFirstMode: chatFirstMode, chatFirstEmbedded: chatFirstEmbedded, collapsed: sidebarCollapsed, chatFirstAppLayout: chatFirstAppLayout, onChatFirstAppLayoutChange: persistChatFirstAppLayout, chatFirstApps: chatFirstAppItems, chatFirstAppsLoading: chatFirstAppsQuery.isLoading, chatFirstAppsError: chatFirstAppsQuery.isError
1195
1262
  ? chatFirstCopy("appsLoadError")
1196
- : null, chatFirstActiveAppId: activeChatFirstSurfaceTab?.kind === "app"
1197
- ? activeChatFirstSurfaceTab.appId
1198
- : undefined, onChatFirstAppOpen: (app) => openChatFirstPane({ appId: app.id }, "main"), onChatFirstAppsRetry: () => void chatFirstAppsQuery.refetch(), collapsible: true, onCollapsedChange: setSidebarCollapsed }) }), _jsx(Sheet, { open: mobileOpen, onOpenChange: setMobileOpen, children: _jsxs(SheetContent, { side: "left", className: "w-72 bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden", children: [_jsx(SheetTitle, { className: "sr-only", children: t("dispatch.nav.navigation") }), _jsx(SheetDescription, { className: "sr-only", children: t("dispatch.nav.navigationDescription") }), _jsx("div", { className: "flex h-full w-full flex-col", children: _jsx(NavContent, { extensions: extensions, chatFirstMode: chatFirstMode, chatFirstEmbedded: chatFirstEmbedded, collapsed: false, chatFirstAppLayout: chatFirstAppLayout, onChatFirstAppLayoutChange: persistChatFirstAppLayout, chatFirstApps: chatFirstAppItems, chatFirstAppsLoading: chatFirstAppsQuery.isLoading, chatFirstAppsError: chatFirstAppsQuery.isError
1263
+ : null, chatFirstActiveAppId: chatFirstActiveAppId, chatFirstActivePrimaryTab: chatFirstActivePrimaryTab, onChatFirstNewChat: () => {
1264
+ closeChatFirstSessionWatch();
1265
+ chatFirstSurfaceTabsStore.closeAll();
1266
+ setChatFirstSurfacePanelOpen(false);
1267
+ }, onChatFirstAppOpen: (app) => navigate(dispatchNavLinkTarget(workspaceAppRoute(app.id))), onChatFirstAppsRetry: () => void chatFirstAppsQuery.refetch(), collapsible: true, onCollapsedChange: setSidebarCollapsed }) }), _jsx(Sheet, { open: mobileOpen, onOpenChange: setMobileOpen, children: _jsxs(SheetContent, { side: "left", className: "w-72 bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden", children: [_jsx(SheetTitle, { className: "sr-only", children: t("dispatch.nav.navigation") }), _jsx(SheetDescription, { className: "sr-only", children: t("dispatch.nav.navigationDescription") }), _jsx("div", { className: "flex h-full w-full flex-col", children: _jsx(NavContent, { extensions: extensions, chatFirstMode: chatFirstMode, chatFirstEmbedded: chatFirstEmbedded, collapsed: false, chatFirstAppLayout: chatFirstAppLayout, onChatFirstAppLayoutChange: persistChatFirstAppLayout, chatFirstApps: chatFirstAppItems, chatFirstAppsLoading: chatFirstAppsQuery.isLoading, chatFirstAppsError: chatFirstAppsQuery.isError
1199
1268
  ? chatFirstCopy("appsLoadError")
1200
- : null, chatFirstActiveAppId: activeChatFirstSurfaceTab?.kind === "app"
1201
- ? activeChatFirstSurfaceTab.appId
1202
- : undefined, onChatFirstAppOpen: (app) => openChatFirstPane({ appId: app.id }, "main"), onChatFirstAppsRetry: () => void chatFirstAppsQuery.refetch(), onNavigate: () => setMobileOpen(false) }) })] }) }), content] }) }) }));
1269
+ : null, chatFirstActiveAppId: chatFirstActiveAppId, chatFirstActivePrimaryTab: chatFirstActivePrimaryTab, onChatFirstNewChat: () => {
1270
+ closeChatFirstSessionWatch();
1271
+ chatFirstSurfaceTabsStore.closeAll();
1272
+ setChatFirstSurfacePanelOpen(false);
1273
+ }, onChatFirstAppOpen: (app) => navigate(dispatchNavLinkTarget(workspaceAppRoute(app.id))), onChatFirstAppsRetry: () => void chatFirstAppsQuery.refetch(), onNavigate: () => setMobileOpen(false) }) })] }) }), content] }) }) }));
1203
1274
  }
1204
1275
  //# sourceMappingURL=Layout.js.map