@agent-native/dispatch 0.14.3 → 0.14.4
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/README.md +114 -128
- package/dist/actions/list_apps.d.ts +1 -0
- package/dist/actions/list_apps.js +16 -8
- package/dist/actions/list_apps.js.map +1 -1
- package/dist/actions/set-mcp-app-access.js +1 -4
- package/dist/actions/set-mcp-app-access.js.map +1 -1
- package/dist/components/action-query-error.d.ts +8 -0
- package/dist/components/action-query-error.d.ts.map +1 -0
- package/dist/components/action-query-error.js +10 -0
- package/dist/components/action-query-error.js.map +1 -0
- package/dist/components/app-keys-popover.d.ts +4 -0
- package/dist/components/app-keys-popover.d.ts.map +1 -1
- package/dist/components/app-keys-popover.js +26 -14
- package/dist/components/app-keys-popover.js.map +1 -1
- package/dist/components/dispatch-control-plane.d.ts.map +1 -1
- package/dist/components/dispatch-control-plane.js +31 -27
- package/dist/components/dispatch-control-plane.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/layout/Layout.d.ts +1 -0
- package/dist/components/layout/Layout.d.ts.map +1 -1
- package/dist/components/layout/Layout.js +19 -21
- package/dist/components/layout/Layout.js.map +1 -1
- package/dist/components/ui/sheet.js +1 -1
- package/dist/components/ui/sheet.js.map +1 -1
- package/dist/components/ui/toast.js +1 -1
- package/dist/components/ui/toast.js.map +1 -1
- package/dist/components/workspace-app-card.d.ts.map +1 -1
- package/dist/components/workspace-app-card.js +8 -5
- package/dist/components/workspace-app-card.js.map +1 -1
- package/dist/components/workspace-resource-effective-stack.d.ts.map +1 -1
- package/dist/components/workspace-resource-effective-stack.js +6 -1
- package/dist/components/workspace-resource-effective-stack.js.map +1 -1
- package/dist/components/workspace-resource-impact-preview.d.ts.map +1 -1
- package/dist/components/workspace-resource-impact-preview.js +6 -1
- package/dist/components/workspace-resource-impact-preview.js.map +1 -1
- package/dist/routes/pages/$appId.d.ts.map +1 -1
- package/dist/routes/pages/$appId.js +6 -1
- package/dist/routes/pages/$appId.js.map +1 -1
- package/dist/routes/pages/agents.d.ts.map +1 -1
- package/dist/routes/pages/agents.js +5 -8
- package/dist/routes/pages/agents.js.map +1 -1
- package/dist/routes/pages/approval.d.ts.map +1 -1
- package/dist/routes/pages/approval.js +6 -1
- package/dist/routes/pages/approval.js.map +1 -1
- package/dist/routes/pages/approvals.d.ts.map +1 -1
- package/dist/routes/pages/approvals.js +8 -5
- package/dist/routes/pages/approvals.js.map +1 -1
- package/dist/routes/pages/apps.$appId.d.ts.map +1 -1
- package/dist/routes/pages/apps.$appId.js +4 -2
- package/dist/routes/pages/apps.$appId.js.map +1 -1
- package/dist/routes/pages/apps.d.ts.map +1 -1
- package/dist/routes/pages/apps.js +9 -3
- package/dist/routes/pages/apps.js.map +1 -1
- package/dist/routes/pages/audit.d.ts.map +1 -1
- package/dist/routes/pages/audit.js +4 -2
- package/dist/routes/pages/audit.js.map +1 -1
- package/dist/routes/pages/chat.d.ts.map +1 -1
- package/dist/routes/pages/chat.js +16 -2
- package/dist/routes/pages/chat.js.map +1 -1
- package/dist/routes/pages/destinations.d.ts.map +1 -1
- package/dist/routes/pages/destinations.js +5 -3
- package/dist/routes/pages/destinations.js.map +1 -1
- package/dist/routes/pages/identities.d.ts.map +1 -1
- package/dist/routes/pages/identities.js +5 -3
- package/dist/routes/pages/identities.js.map +1 -1
- package/dist/routes/pages/integrations.d.ts.map +1 -1
- package/dist/routes/pages/integrations.js +9 -3
- package/dist/routes/pages/integrations.js.map +1 -1
- package/dist/routes/pages/thread-debug.d.ts.map +1 -1
- package/dist/routes/pages/thread-debug.js +7 -6
- package/dist/routes/pages/thread-debug.js.map +1 -1
- package/dist/routes/pages/vault.d.ts.map +1 -1
- package/dist/routes/pages/vault.js +23 -7
- package/dist/routes/pages/vault.js.map +1 -1
- package/dist/routes/pages/workspace.d.ts.map +1 -1
- package/dist/routes/pages/workspace.js +9 -3
- package/dist/routes/pages/workspace.js.map +1 -1
- package/dist/server/lib/dispatch-store.d.ts.map +1 -1
- package/dist/server/lib/dispatch-store.js +2 -2
- package/dist/server/lib/dispatch-store.js.map +1 -1
- package/dist/server/lib/mcp-access-store.d.ts.map +1 -1
- package/dist/server/lib/mcp-access-store.js +30 -2
- package/dist/server/lib/mcp-access-store.js.map +1 -1
- package/dist/server/plugins/agent-chat.d.ts +1 -1
- package/package.json +2 -2
- package/src/actions/list_apps.spec.ts +52 -0
- package/src/actions/list_apps.ts +16 -8
- package/src/actions/set-mcp-app-access.spec.ts +73 -0
- package/src/actions/set-mcp-app-access.ts +1 -5
- package/src/components/action-query-error.spec.tsx +56 -0
- package/src/components/action-query-error.tsx +32 -0
- package/src/components/app-keys-popover.spec.tsx +85 -0
- package/src/components/app-keys-popover.tsx +76 -50
- package/src/components/dispatch-control-plane.spec.tsx +106 -0
- package/src/components/dispatch-control-plane.tsx +71 -115
- package/src/components/index.ts +1 -0
- package/src/components/layout/Layout.spec.tsx +42 -2
- package/src/components/layout/Layout.tsx +22 -27
- package/src/components/ui/sheet.tsx +1 -1
- package/src/components/ui/toast.tsx +1 -1
- package/src/components/workspace-app-card.spec.tsx +80 -0
- package/src/components/workspace-app-card.tsx +36 -25
- package/src/components/workspace-resource-effective-stack.tsx +13 -1
- package/src/components/workspace-resource-impact-preview.tsx +12 -1
- package/src/routes/pages/$appId.tsx +17 -1
- package/src/routes/pages/agents.tsx +24 -11
- package/src/routes/pages/approval.tsx +16 -4
- package/src/routes/pages/approvals.tsx +108 -89
- package/src/routes/pages/apps.$appId.tsx +9 -2
- package/src/routes/pages/apps.tsx +20 -7
- package/src/routes/pages/audit.tsx +29 -20
- package/src/routes/pages/chat.spec.tsx +94 -0
- package/src/routes/pages/chat.tsx +30 -10
- package/src/routes/pages/destinations.tsx +75 -62
- package/src/routes/pages/identities.tsx +74 -63
- package/src/routes/pages/integrations.tsx +17 -10
- package/src/routes/pages/thread-debug.tsx +18 -12
- package/src/routes/pages/vault.tsx +59 -26
- package/src/routes/pages/workspace.tsx +69 -55
- package/src/server/lib/approval-fencing.spec.ts +113 -2
- package/src/server/lib/dispatch-store.ts +2 -0
- package/src/server/lib/mcp-access-store.spec.ts +116 -4
- package/src/server/lib/mcp-access-store.ts +37 -2
- package/src/server/lib/mcp-gateway.spec.ts +79 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apps.js","sourceRoot":"","sources":["../../../src/routes/pages/apps.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,IAAI,GACL,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,QAAQ,EACR,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,UAAU,GACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAGrC,MAAM,UAAU,IAAI;IAClB,OAAO,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC,CAAC;AACxC,CAAC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,\n useT,\n} from \"@agent-native/core/client\";\nimport {\n IconApps,\n IconBrain,\n IconBrush,\n IconCalendarMonth,\n IconChartBar,\n IconChevronDown,\n IconClipboardList,\n IconEyeOff,\n IconFileText,\n IconLoader2,\n IconMail,\n IconPhoto,\n IconPlus,\n IconPresentation,\n IconScreenShare,\n IconSparkles,\n IconStack3,\n} from \"@tabler/icons-react\";\nimport { useState } from \"react\";\nimport { toast } from \"sonner\";\n\nimport { CreateAppPopover } from \"../../components/create-app-popover\";\nimport { DispatchShell } from \"../../components/dispatch-shell\";\nimport { Button } from \"../../components/ui/button\";\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from \"../../components/ui/collapsible\";\nimport { Skeleton } from \"../../components/ui/skeleton\";\nimport { WorkspaceAppCard } from \"../../components/workspace-app-card\";\nimport { cn } from \"../../lib/utils\";\nimport type { WorkspaceAppSummary } from \"../../lib/workspace-apps\";\n\nexport function meta() {\n return [{ title: \"Apps — Dispatch\" }];\n}\n\ninterface WorkspaceInfo {\n name: string | null;\n displayName: string | null;\n appCount: number;\n}\n\ninterface AvailableTemplate {\n name: string;\n label: string;\n hint: string;\n icon: string;\n color: string;\n colorRgb: string;\n core: boolean;\n}\n\nconst TEMPLATE_ICONS: Record<string, typeof IconMail> = {\n Mail: IconMail,\n CalendarMonth: IconCalendarMonth,\n FileText: IconFileText,\n Presentation: IconPresentation,\n ScreenShare: IconScreenShare,\n Brain: IconBrain,\n Photo: IconPhoto,\n ChartBar: IconChartBar,\n ClipboardList: IconClipboardList,\n Brush: IconBrush,\n};\n\nexport default function AppsRoute() {\n const t = useT();\n const [showHidden, setShowHidden] = useState(false);\n const [templatesOpen, setTemplatesOpen] = useState(false);\n const { data: apps = [], isLoading: appsLoading } = useActionQuery(\n \"list-workspace-apps\",\n { includeAgentCards: false, includeArchived: true },\n );\n const { data: workspace } = useActionQuery(\n \"get-workspace-info\",\n {},\n { staleTime: 60_000 },\n );\n const { data: templates = [], isLoading: templatesLoading } = useActionQuery(\n \"list-available-workspace-templates\",\n {},\n { refetchInterval: 5_000 },\n );\n\n const ws = workspace as WorkspaceInfo | undefined;\n const workspaceLabel = ws?.displayName ?? ws?.name ?? null;\n const allApps = (apps as WorkspaceAppSummary[]).filter(\n (app) => !app.isDispatch,\n );\n const visibleApps = allApps.filter((app) => !app.archived);\n const archivedApps = allApps.filter((app) => app.archived);\n const typedTemplates = templates as AvailableTemplate[];\n const showAppSkeletons = appsLoading && allApps.length === 0;\n\n return (\n <DispatchShell\n title={t(\"dispatch.nav.apps\")}\n description={\n workspaceLabel\n ? t(\"dispatch.pages.appsDescriptionWithWorkspace\", {\n workspace: workspaceLabel,\n })\n : t(\"dispatch.pages.appsDescription\")\n }\n >\n <div className=\"space-y-8\">\n <section className=\"space-y-3\">\n <div className=\"flex flex-wrap items-end justify-between gap-3\">\n <div className=\"flex min-w-0 items-start gap-2\">\n <IconApps\n size={16}\n className=\"mt-0.5 shrink-0 text-muted-foreground\"\n />\n <div className=\"min-w-0\">\n <h2 className=\"truncate text-sm font-semibold text-foreground\">\n {workspaceLabel\n ? t(\"dispatch.pages.appsInWorkspace\", {\n workspace: workspaceLabel,\n })\n : t(\"dispatch.pages.workspaceApps\")}\n </h2>\n <p className=\"mt-0.5 text-xs text-muted-foreground\">\n {t(\"dispatch.pages.activeCount\", {\n count: visibleApps.length,\n })}\n {archivedApps.length > 0\n ? ` · ${t(\"dispatch.pages.hiddenCount\", {\n count: archivedApps.length,\n })}`\n : \"\"}\n </p>\n </div>\n </div>\n {visibleApps.length > 0 ? (\n <CreateAppPopover\n align=\"end\"\n trigger={\n <Button size=\"sm\">\n <IconPlus size={15} className=\"mr-1.5\" />\n {t(\"dispatch.pages.createApp\")}\n </Button>\n }\n />\n ) : null}\n </div>\n\n {showAppSkeletons ? (\n <AppsSkeletonGrid />\n ) : visibleApps.length > 0 ? (\n <div className=\"grid auto-rows-fr gap-3 md:grid-cols-2 xl:grid-cols-3\">\n {visibleApps.map((app) => (\n <WorkspaceAppCard key={app.id} app={app} className=\"h-full\" />\n ))}\n </div>\n ) : (\n <EmptyAppsState />\n )}\n </section>\n\n {typedTemplates.length > 0 || templatesLoading ? (\n <Collapsible open={templatesOpen} onOpenChange={setTemplatesOpen}>\n <section className=\"space-y-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-3 border-t pt-4\">\n <div className=\"flex min-w-0 items-center gap-2\">\n <IconStack3\n size={16}\n className=\"shrink-0 text-muted-foreground\"\n />\n <div className=\"min-w-0\">\n <h2 className=\"text-sm font-semibold text-foreground\">\n {t(\"dispatch.pages.templates\")}\n </h2>\n <p className=\"text-xs text-muted-foreground\">\n {templatesLoading\n ? t(\"dispatch.pages.checkingTemplates\")\n : t(\"dispatch.pages.templatesAvailable\", {\n count: typedTemplates.length,\n })}\n </p>\n </div>\n </div>\n <CollapsibleTrigger asChild>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n className=\"gap-1.5\"\n >\n {templatesOpen\n ? t(\"dispatch.pages.hide\")\n : t(\"dispatch.pages.show\")}\n <IconChevronDown\n size={14}\n className={cn(\n \"transition-transform\",\n templatesOpen && \"rotate-180\",\n )}\n />\n </Button>\n </CollapsibleTrigger>\n </div>\n <CollapsibleContent>\n {templatesLoading && typedTemplates.length === 0 ? (\n <AppsSkeletonGrid />\n ) : (\n <div className=\"grid auto-rows-fr gap-3 md:grid-cols-2 xl:grid-cols-3\">\n {typedTemplates.map((template) => (\n <AddTemplateCard\n key={template.name}\n template={template}\n />\n ))}\n </div>\n )}\n </CollapsibleContent>\n </section>\n </Collapsible>\n ) : null}\n\n {archivedApps.length > 0 ? (\n <Collapsible open={showHidden} onOpenChange={setShowHidden}>\n <section className=\"space-y-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-3 border-t pt-4\">\n <div className=\"flex min-w-0 items-center gap-2\">\n <IconEyeOff\n size={16}\n className=\"shrink-0 text-muted-foreground\"\n />\n <div className=\"min-w-0\">\n <h2 className=\"text-sm font-semibold text-foreground\">\n {t(\"dispatch.pages.hiddenApps\")}\n </h2>\n <p className=\"text-xs text-muted-foreground\">\n {t(\"dispatch.pages.hiddenAppCount\", {\n count: archivedApps.length,\n })}\n </p>\n </div>\n </div>\n <CollapsibleTrigger asChild>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n className=\"gap-1.5\"\n >\n {showHidden\n ? t(\"dispatch.pages.hide\")\n : t(\"dispatch.pages.show\")}\n <IconChevronDown\n size={14}\n className={cn(\n \"transition-transform\",\n showHidden && \"rotate-180\",\n )}\n />\n </Button>\n </CollapsibleTrigger>\n </div>\n <CollapsibleContent>\n <div className=\"grid auto-rows-fr gap-3 md:grid-cols-2 xl:grid-cols-3\">\n {archivedApps.map((app) => (\n <WorkspaceAppCard\n key={app.id}\n app={app}\n className=\"h-full\"\n />\n ))}\n </div>\n </CollapsibleContent>\n </section>\n </Collapsible>\n ) : null}\n </div>\n </DispatchShell>\n );\n}\n\nfunction AppsSkeletonGrid() {\n return (\n <div className=\"grid gap-3 md:grid-cols-2 xl:grid-cols-3\">\n {Array.from({ length: 3 }).map((_, index) => (\n <div key={index} className=\"rounded-lg border bg-card p-4\">\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"min-w-0 flex-1 space-y-3\">\n <Skeleton className=\"h-4 w-32\" />\n <Skeleton className=\"h-3 w-24\" />\n <div className=\"space-y-2 pt-1\">\n <Skeleton className=\"h-3 w-full\" />\n <Skeleton className=\"h-3 w-2/3\" />\n </div>\n </div>\n <Skeleton className=\"h-7 w-7 rounded-md\" />\n </div>\n </div>\n ))}\n </div>\n );\n}\n\nfunction EmptyAppsState() {\n const t = useT();\n return (\n <div className=\"rounded-lg border border-dashed bg-card px-4 py-10 text-center\">\n <div className=\"mx-auto flex size-10 items-center justify-center rounded-lg bg-muted text-muted-foreground\">\n <IconApps size={18} />\n </div>\n <h3 className=\"mt-3 text-sm font-semibold text-foreground\">\n {t(\"dispatch.pages.noWorkspaceApps\")}\n </h3>\n <p className=\"mx-auto mt-1 max-w-sm text-sm text-muted-foreground\">\n {t(\"dispatch.pages.noWorkspaceAppsDescription\")}\n </p>\n <div className=\"mt-4\">\n <CreateAppPopover\n trigger={\n <Button size=\"sm\">\n <IconPlus size={15} className=\"mr-1.5\" />\n {t(\"dispatch.pages.createApp\")}\n </Button>\n }\n />\n </div>\n </div>\n );\n}\n\nfunction AddTemplateCard({ template }: { template: AvailableTemplate }) {\n const Icon = TEMPLATE_ICONS[template.icon] ?? IconSparkles;\n const scaffold = useActionMutation(\"scaffold-workspace-app\", {\n onSuccess: (result: any) => {\n toast.success(\n `Scaffolded apps/${result?.appId || template.name}. The gateway will pick it up shortly.`,\n );\n },\n onError: (err) => {\n toast.error(\n `Could not scaffold ${template.label}: ${\n err instanceof Error ? err.message : String(err)\n }`,\n );\n },\n });\n\n return (\n <div className=\"group relative flex h-full min-h-36 items-stretch gap-3 rounded-lg border bg-card p-4 transition hover:border-foreground/30\">\n <div\n className=\"flex h-9 w-9 shrink-0 items-center justify-center self-start rounded-md\"\n style={{\n backgroundColor: `rgb(${template.colorRgb} / 0.12)`,\n color: template.color,\n }}\n >\n <Icon size={18} />\n </div>\n <div className=\"flex min-w-0 flex-1 flex-col\">\n <div className=\"flex min-w-0 items-center gap-2\">\n <h3 className=\"truncate text-sm font-semibold text-foreground\">\n {template.label}\n </h3>\n </div>\n <p className=\"mt-1 line-clamp-2 text-xs leading-relaxed text-muted-foreground\">\n {template.hint}\n </p>\n <div className=\"mt-auto pt-3\">\n <Button\n size=\"sm\"\n variant=\"outline\"\n disabled={scaffold.isPending}\n onClick={() => scaffold.mutate({ template: template.name })}\n >\n {scaffold.isPending ? (\n <>\n <IconLoader2 size={14} className=\"mr-1.5 animate-spin\" />\n Adding...\n </>\n ) : (\n <>\n <IconPlus size={14} className=\"mr-1.5\" />\n Add to workspace\n </>\n )}\n </Button>\n </div>\n </div>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"apps.js","sourceRoot":"","sources":["../../../src/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AExD,CACJ,CAAC,CAAC,CAAC,CACF,8BACE,KAAC,QAAQ,IAAC,IAAI,EAAE,EAAE,EAAE,SAAS,EAAC,QAAQ,GAAG,wBAExC,CACJ,GACM,GACL,IACF,IACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["import {\n useActionMutation,\n useActionQuery,\n useT,\n} from \"@agent-native/core/client\";\nimport {\n IconApps,\n IconBrain,\n IconBrush,\n IconCalendarMonth,\n IconChartBar,\n IconChevronDown,\n IconClipboardList,\n IconEyeOff,\n IconFileText,\n IconLoader2,\n IconMail,\n IconPhoto,\n IconPlus,\n IconPresentation,\n IconScreenShare,\n IconSparkles,\n IconStack3,\n} from \"@tabler/icons-react\";\nimport { useState } from \"react\";\nimport { toast } from \"sonner\";\n\nimport { ActionQueryError } from \"../../components/action-query-error\";\nimport { CreateAppPopover } from \"../../components/create-app-popover\";\nimport { DispatchShell } from \"../../components/dispatch-shell\";\nimport { Button } from \"../../components/ui/button\";\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from \"../../components/ui/collapsible\";\nimport { Skeleton } from \"../../components/ui/skeleton\";\nimport { WorkspaceAppCard } from \"../../components/workspace-app-card\";\nimport { cn } from \"../../lib/utils\";\nimport type { WorkspaceAppSummary } from \"../../lib/workspace-apps\";\n\nexport function meta() {\n return [{ title: \"Apps — Dispatch\" }];\n}\n\ninterface WorkspaceInfo {\n name: string | null;\n displayName: string | null;\n appCount: number;\n}\n\ninterface AvailableTemplate {\n name: string;\n label: string;\n hint: string;\n icon: string;\n color: string;\n colorRgb: string;\n core: boolean;\n}\n\nconst TEMPLATE_ICONS: Record<string, typeof IconMail> = {\n Mail: IconMail,\n CalendarMonth: IconCalendarMonth,\n FileText: IconFileText,\n Presentation: IconPresentation,\n ScreenShare: IconScreenShare,\n Brain: IconBrain,\n Photo: IconPhoto,\n ChartBar: IconChartBar,\n ClipboardList: IconClipboardList,\n Brush: IconBrush,\n};\n\nexport default function AppsRoute() {\n const t = useT();\n const [showHidden, setShowHidden] = useState(false);\n const [templatesOpen, setTemplatesOpen] = useState(false);\n const appsQuery = useActionQuery(\"list-workspace-apps\", {\n includeAgentCards: false,\n includeArchived: true,\n });\n const { data: apps = [], isLoading: appsLoading } = appsQuery;\n const { data: workspace } = useActionQuery(\n \"get-workspace-info\",\n {},\n { staleTime: 60_000 },\n );\n const templatesQuery = useActionQuery(\n \"list-available-workspace-templates\",\n {},\n { refetchInterval: 5_000 },\n );\n const { data: templates = [], isLoading: templatesLoading } = templatesQuery;\n\n const ws = workspace as WorkspaceInfo | undefined;\n const workspaceLabel = ws?.displayName ?? ws?.name ?? null;\n const allApps = (apps as WorkspaceAppSummary[]).filter(\n (app) => !app.isDispatch,\n );\n const visibleApps = allApps.filter((app) => !app.archived);\n const archivedApps = allApps.filter((app) => app.archived);\n const typedTemplates = templates as AvailableTemplate[];\n const showAppSkeletons = appsLoading && allApps.length === 0;\n\n return (\n <DispatchShell\n title={t(\"dispatch.nav.apps\")}\n description={\n workspaceLabel\n ? t(\"dispatch.pages.appsDescriptionWithWorkspace\", {\n workspace: workspaceLabel,\n })\n : t(\"dispatch.pages.appsDescription\")\n }\n >\n <div className=\"space-y-8\">\n <section className=\"space-y-3\">\n <div className=\"flex flex-wrap items-end justify-between gap-3\">\n <div className=\"flex min-w-0 items-start gap-2\">\n <IconApps\n size={16}\n className=\"mt-0.5 shrink-0 text-muted-foreground\"\n />\n <div className=\"min-w-0\">\n <h2 className=\"truncate text-sm font-semibold text-foreground\">\n {workspaceLabel\n ? t(\"dispatch.pages.appsInWorkspace\", {\n workspace: workspaceLabel,\n })\n : t(\"dispatch.pages.workspaceApps\")}\n </h2>\n <p className=\"mt-0.5 text-xs text-muted-foreground\">\n {t(\"dispatch.pages.activeCount\", {\n count: visibleApps.length,\n })}\n {archivedApps.length > 0\n ? ` · ${t(\"dispatch.pages.hiddenCount\", {\n count: archivedApps.length,\n })}`\n : \"\"}\n </p>\n </div>\n </div>\n {visibleApps.length > 0 ? (\n <CreateAppPopover\n align=\"end\"\n trigger={\n <Button size=\"sm\">\n <IconPlus size={15} className=\"mr-1.5\" />\n {t(\"dispatch.pages.createApp\")}\n </Button>\n }\n />\n ) : null}\n </div>\n\n {appsQuery.isError ? (\n <ActionQueryError\n error={appsQuery.error}\n onRetry={() => void appsQuery.refetch()}\n />\n ) : showAppSkeletons ? (\n <AppsSkeletonGrid />\n ) : visibleApps.length > 0 ? (\n <div className=\"grid auto-rows-fr gap-3 md:grid-cols-2 xl:grid-cols-3\">\n {visibleApps.map((app) => (\n <WorkspaceAppCard key={app.id} app={app} className=\"h-full\" />\n ))}\n </div>\n ) : (\n <EmptyAppsState />\n )}\n </section>\n\n {templatesQuery.isError ? (\n <ActionQueryError\n error={templatesQuery.error}\n onRetry={() => void templatesQuery.refetch()}\n />\n ) : typedTemplates.length > 0 || templatesLoading ? (\n <Collapsible open={templatesOpen} onOpenChange={setTemplatesOpen}>\n <section className=\"space-y-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-3 border-t pt-4\">\n <div className=\"flex min-w-0 items-center gap-2\">\n <IconStack3\n size={16}\n className=\"shrink-0 text-muted-foreground\"\n />\n <div className=\"min-w-0\">\n <h2 className=\"text-sm font-semibold text-foreground\">\n {t(\"dispatch.pages.templates\")}\n </h2>\n <p className=\"text-xs text-muted-foreground\">\n {templatesLoading\n ? t(\"dispatch.pages.checkingTemplates\")\n : t(\"dispatch.pages.templatesAvailable\", {\n count: typedTemplates.length,\n })}\n </p>\n </div>\n </div>\n <CollapsibleTrigger asChild>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n className=\"gap-1.5\"\n >\n {templatesOpen\n ? t(\"dispatch.pages.hide\")\n : t(\"dispatch.pages.show\")}\n <IconChevronDown\n size={14}\n className={cn(\n \"transition-transform\",\n templatesOpen && \"rotate-180\",\n )}\n />\n </Button>\n </CollapsibleTrigger>\n </div>\n <CollapsibleContent>\n {templatesLoading && typedTemplates.length === 0 ? (\n <AppsSkeletonGrid />\n ) : (\n <div className=\"grid auto-rows-fr gap-3 md:grid-cols-2 xl:grid-cols-3\">\n {typedTemplates.map((template) => (\n <AddTemplateCard\n key={template.name}\n template={template}\n />\n ))}\n </div>\n )}\n </CollapsibleContent>\n </section>\n </Collapsible>\n ) : null}\n\n {archivedApps.length > 0 ? (\n <Collapsible open={showHidden} onOpenChange={setShowHidden}>\n <section className=\"space-y-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-3 border-t pt-4\">\n <div className=\"flex min-w-0 items-center gap-2\">\n <IconEyeOff\n size={16}\n className=\"shrink-0 text-muted-foreground\"\n />\n <div className=\"min-w-0\">\n <h2 className=\"text-sm font-semibold text-foreground\">\n {t(\"dispatch.pages.hiddenApps\")}\n </h2>\n <p className=\"text-xs text-muted-foreground\">\n {t(\"dispatch.pages.hiddenAppCount\", {\n count: archivedApps.length,\n })}\n </p>\n </div>\n </div>\n <CollapsibleTrigger asChild>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n className=\"gap-1.5\"\n >\n {showHidden\n ? t(\"dispatch.pages.hide\")\n : t(\"dispatch.pages.show\")}\n <IconChevronDown\n size={14}\n className={cn(\n \"transition-transform\",\n showHidden && \"rotate-180\",\n )}\n />\n </Button>\n </CollapsibleTrigger>\n </div>\n <CollapsibleContent>\n <div className=\"grid auto-rows-fr gap-3 md:grid-cols-2 xl:grid-cols-3\">\n {archivedApps.map((app) => (\n <WorkspaceAppCard\n key={app.id}\n app={app}\n className=\"h-full\"\n />\n ))}\n </div>\n </CollapsibleContent>\n </section>\n </Collapsible>\n ) : null}\n </div>\n </DispatchShell>\n );\n}\n\nfunction AppsSkeletonGrid() {\n return (\n <div className=\"grid gap-3 md:grid-cols-2 xl:grid-cols-3\">\n {Array.from({ length: 3 }).map((_, index) => (\n <div key={index} className=\"rounded-lg border bg-card p-4\">\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"min-w-0 flex-1 space-y-3\">\n <Skeleton className=\"h-4 w-32\" />\n <Skeleton className=\"h-3 w-24\" />\n <div className=\"space-y-2 pt-1\">\n <Skeleton className=\"h-3 w-full\" />\n <Skeleton className=\"h-3 w-2/3\" />\n </div>\n </div>\n <Skeleton className=\"h-7 w-7 rounded-md\" />\n </div>\n </div>\n ))}\n </div>\n );\n}\n\nfunction EmptyAppsState() {\n const t = useT();\n return (\n <div className=\"rounded-lg border border-dashed bg-card px-4 py-10 text-center\">\n <div className=\"mx-auto flex size-10 items-center justify-center rounded-lg bg-muted text-muted-foreground\">\n <IconApps size={18} />\n </div>\n <h3 className=\"mt-3 text-sm font-semibold text-foreground\">\n {t(\"dispatch.pages.noWorkspaceApps\")}\n </h3>\n <p className=\"mx-auto mt-1 max-w-sm text-sm text-muted-foreground\">\n {t(\"dispatch.pages.noWorkspaceAppsDescription\")}\n </p>\n <div className=\"mt-4\">\n <CreateAppPopover\n trigger={\n <Button size=\"sm\">\n <IconPlus size={15} className=\"mr-1.5\" />\n {t(\"dispatch.pages.createApp\")}\n </Button>\n }\n />\n </div>\n </div>\n );\n}\n\nfunction AddTemplateCard({ template }: { template: AvailableTemplate }) {\n const Icon = TEMPLATE_ICONS[template.icon] ?? IconSparkles;\n const scaffold = useActionMutation(\"scaffold-workspace-app\", {\n onSuccess: (result: any) => {\n toast.success(\n `Scaffolded apps/${result?.appId || template.name}. The gateway will pick it up shortly.`,\n );\n },\n onError: (err) => {\n toast.error(\n `Could not scaffold ${template.label}: ${\n err instanceof Error ? err.message : String(err)\n }`,\n );\n },\n });\n\n return (\n <div className=\"group relative flex h-full min-h-36 items-stretch gap-3 rounded-lg border bg-card p-4 transition hover:border-foreground/30\">\n <div\n className=\"flex h-9 w-9 shrink-0 items-center justify-center self-start rounded-md\"\n style={{\n backgroundColor: `rgb(${template.colorRgb} / 0.12)`,\n color: template.color,\n }}\n >\n <Icon size={18} />\n </div>\n <div className=\"flex min-w-0 flex-1 flex-col\">\n <div className=\"flex min-w-0 items-center gap-2\">\n <h3 className=\"truncate text-sm font-semibold text-foreground\">\n {template.label}\n </h3>\n </div>\n <p className=\"mt-1 line-clamp-2 text-xs leading-relaxed text-muted-foreground\">\n {template.hint}\n </p>\n <div className=\"mt-auto pt-3\">\n <Button\n size=\"sm\"\n variant=\"outline\"\n disabled={scaffold.isPending}\n onClick={() => scaffold.mutate({ template: template.name })}\n >\n {scaffold.isPending ? (\n <>\n <IconLoader2 size={14} className=\"mr-1.5 animate-spin\" />\n Adding...\n </>\n ) : (\n <>\n <IconPlus size={14} className=\"mr-1.5\" />\n Add to workspace\n </>\n )}\n </Button>\n </div>\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/audit.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/audit.tsx"],"names":[],"mappings":"AAKA,wBAAgB,IAAI;;IAEnB;AAED,MAAM,CAAC,OAAO,UAAU,UAAU,oDAyCjC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useActionQuery } from "@agent-native/core/client";
|
|
3
|
+
import { ActionQueryError } from "../../components/action-query-error.js";
|
|
3
4
|
import { DispatchShell } from "../../components/dispatch-shell.js";
|
|
4
5
|
export function meta() {
|
|
5
6
|
return [{ title: "Audit — Dispatch" }];
|
|
6
7
|
}
|
|
7
8
|
export default function AuditRoute() {
|
|
8
|
-
const
|
|
9
|
-
|
|
9
|
+
const query = useActionQuery("list-dispatch-audit", { limit: 100 });
|
|
10
|
+
const { data } = query;
|
|
11
|
+
return (_jsx(DispatchShell, { title: "Audit", description: "Change history for routes, settings, and approvals.", children: _jsx("section", { className: "rounded-2xl border bg-card p-5", children: query.isError ? (_jsx(ActionQueryError, { error: query.error, onRetry: () => void query.refetch() })) : (_jsxs("div", { className: "space-y-3", children: [(data || []).map((event) => (_jsxs("div", { className: "rounded-xl border bg-muted/30 px-4 py-3", children: [_jsx("div", { className: "text-sm font-medium text-foreground", children: event.summary }), _jsxs("div", { className: "mt-1 text-xs text-muted-foreground", children: [event.actor, " \u00B7 ", event.action, " \u00B7", " ", new Date(event.createdAt).toLocaleString()] })] }, event.id))), (data?.length || 0) === 0 && (_jsx("div", { className: "rounded-xl border border-dashed px-4 py-6 text-sm text-muted-foreground", children: "No audit entries yet." }))] })) }) }));
|
|
10
12
|
}
|
|
11
13
|
//# sourceMappingURL=audit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../../src/routes/pages/audit.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEhE,MAAM,UAAU,IAAI;IAClB,OAAO,CAAC,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,UAAU;IAChC,MAAM,
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../../src/routes/pages/audit.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEhE,MAAM,UAAU,IAAI;IAClB,OAAO,CAAC,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,UAAU;IAChC,MAAM,KAAK,GAAG,cAAc,CAAC,qBAAqB,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;IACpE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IAEvB,OAAO,CACL,KAAC,aAAa,IACZ,KAAK,EAAC,OAAO,EACb,WAAW,EAAC,qDAAqD,YAEjE,kBAAS,SAAS,EAAC,gCAAgC,YAChD,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CACf,KAAC,gBAAgB,IACf,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,GACnC,CACH,CAAC,CAAC,CAAC,CACF,eAAK,SAAS,EAAC,WAAW,aACvB,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,CAChC,eAEE,SAAS,EAAC,yCAAyC,aAEnD,cAAK,SAAS,EAAC,qCAAqC,YACjD,KAAK,CAAC,OAAO,GACV,EACN,eAAK,SAAS,EAAC,oCAAoC,aAChD,KAAK,CAAC,KAAK,cAAK,KAAK,CAAC,MAAM,aAAI,GAAG,EACnC,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,cAAc,EAAE,IACvC,KATD,KAAK,CAAC,EAAE,CAUT,CACP,CAAC,EACD,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAC5B,cAAK,SAAS,EAAC,yEAAyE,sCAElF,CACP,IACG,CACP,GACO,GACI,CACjB,CAAC;AACJ,CAAC","sourcesContent":["import { useActionQuery } from \"@agent-native/core/client\";\n\nimport { ActionQueryError } from \"../../components/action-query-error\";\nimport { DispatchShell } from \"../../components/dispatch-shell\";\n\nexport function meta() {\n return [{ title: \"Audit — Dispatch\" }];\n}\n\nexport default function AuditRoute() {\n const query = useActionQuery(\"list-dispatch-audit\", { limit: 100 });\n const { data } = query;\n\n return (\n <DispatchShell\n title=\"Audit\"\n description=\"Change history for routes, settings, and approvals.\"\n >\n <section className=\"rounded-2xl border bg-card p-5\">\n {query.isError ? (\n <ActionQueryError\n error={query.error}\n onRetry={() => void query.refetch()}\n />\n ) : (\n <div className=\"space-y-3\">\n {(data || []).map((event: any) => (\n <div\n key={event.id}\n className=\"rounded-xl border bg-muted/30 px-4 py-3\"\n >\n <div className=\"text-sm font-medium text-foreground\">\n {event.summary}\n </div>\n <div className=\"mt-1 text-xs text-muted-foreground\">\n {event.actor} · {event.action} ·{\" \"}\n {new Date(event.createdAt).toLocaleString()}\n </div>\n </div>\n ))}\n {(data?.length || 0) === 0 && (\n <div className=\"rounded-xl border border-dashed px-4 py-6 text-sm text-muted-foreground\">\n No audit entries yet.\n </div>\n )}\n </div>\n )}\n </section>\n </DispatchShell>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/chat.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/chat.tsx"],"names":[],"mappings":"AAoFA,wBAAgB,IAAI;;IAEnB;AAED,MAAM,CAAC,OAAO,UAAU,SAAS,oDA6HhC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { AgentChatSurface, appBasePath, appPath, markAgentChatHomeHandoff, } from "@agent-native/core/client";
|
|
2
|
+
import { AgentChatSurface, appBasePath, appPath, markAgentChatHomeHandoff, useT, } from "@agent-native/core/client";
|
|
3
3
|
import { useCallback, useEffect, useMemo, useRef, } from "react";
|
|
4
4
|
import { useLocation, useNavigate } from "react-router";
|
|
5
5
|
import { submitOverviewPrompt } from "../../lib/overview-chat.js";
|
|
@@ -51,6 +51,7 @@ export function meta() {
|
|
|
51
51
|
return [{ title: "Chat — Dispatch" }];
|
|
52
52
|
}
|
|
53
53
|
export default function ChatRoute() {
|
|
54
|
+
const t = useT();
|
|
54
55
|
const location = useLocation();
|
|
55
56
|
const navigate = useNavigate();
|
|
56
57
|
const routeThreadId = threadIdFromPath(location.pathname);
|
|
@@ -110,6 +111,19 @@ export default function ChatRoute() {
|
|
|
110
111
|
window.addEventListener("agentNative.chatRunning", handleChatRunning);
|
|
111
112
|
return () => window.removeEventListener("agentNative.chatRunning", handleChatRunning);
|
|
112
113
|
}, []);
|
|
113
|
-
return (_jsx("div", { className: "flex h-full min-h-0 flex-col bg-background", children: _jsx(DispatchAgentChatSurface, { mode: "page", chatViewTransition: true, className: "dispatch-chat-panel", defaultMode: "chat", storageKey: "dispatch", threadUrlSync: threadUrlSync, showHeader: false, showTabBar: false, dynamicSuggestions: false, suggestions: [], emptyStateText:
|
|
114
|
+
return (_jsx("div", { className: "flex h-full min-h-0 flex-col bg-background", children: _jsx(DispatchAgentChatSurface, { mode: "page", chatViewTransition: true, className: "dispatch-chat-panel", defaultMode: "chat", storageKey: "dispatch", threadUrlSync: threadUrlSync, showHeader: false, showTabBar: false, dynamicSuggestions: false, suggestions: [], emptyStateText: t("dispatch.pages.chatAcrossAppsDescription", {
|
|
115
|
+
defaultValue: "Route work, inspect status, or create something new from one place.",
|
|
116
|
+
}), emptyStateDisplay: "hidden", ...(!prompt?.message
|
|
117
|
+
? {
|
|
118
|
+
centerComposerWhenEmpty: true,
|
|
119
|
+
composerLayoutVariant: "hero",
|
|
120
|
+
}
|
|
121
|
+
: {}), composerPlaceholder: t("dispatch.pages.chatPromptPlaceholder", {
|
|
122
|
+
defaultValue: "Ask Dispatch...",
|
|
123
|
+
}), composerSlot: !prompt?.message ? (_jsxs("div", { className: "dispatch-chat-intro", children: [_jsx("h1", { children: t("dispatch.pages.chatAcrossApps", {
|
|
124
|
+
defaultValue: "Chat across your apps",
|
|
125
|
+
}) }), _jsx("p", { children: t("dispatch.pages.chatAcrossAppsDescription", {
|
|
126
|
+
defaultValue: "Route work, inspect status, or create something new from one place.",
|
|
127
|
+
}) })] })) : null }) }));
|
|
114
128
|
}
|
|
115
129
|
//# sourceMappingURL=chat.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../../src/rout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BAAuB,QACvB,qBAAqB,EAAC,MAAM,EAC5B,mBAAmB,EAAC,iBAAiB,EACrC,YAAY,EACV,eAAK,SAAS,EAAC,qBAAqB,aAClC,yDAAsC,EACtC,yFAEI,IACA,GAER,GACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["import {\n AgentChatSurface,\n appBasePath,\n appPath,\n markAgentChatHomeHandoff,\n} from \"@agent-native/core/client\";\nimport {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n type ComponentProps,\n} from \"react\";\nimport { useLocation, useNavigate } from \"react-router\";\n\nimport { submitOverviewPrompt } from \"../../lib/overview-chat\";\n\nfunction chatThreadPath(threadId: string | null): string {\n return threadId ? `/chat/${encodeURIComponent(threadId)}` : \"/chat\";\n}\n\nfunction stripBasePath(pathname: string): string {\n const basePath = appBasePath();\n if (!basePath) return pathname;\n if (pathname === basePath) return \"/\";\n if (pathname.startsWith(`${basePath}/`)) {\n return pathname.slice(basePath.length) || \"/\";\n }\n return pathname;\n}\n\n// The chat surface renders for both `/chat` and the `/chat/:threadId` deep\n// link. The thread id is read from the pathname (not `useParams`) because the\n// param is owned by the nested deep-link route, not this leaf component.\nfunction threadIdFromPath(pathname: string): string | null {\n const match = stripBasePath(pathname).match(/^\\/chat\\/([^/]+)/);\n if (!match) return null;\n try {\n const value = decodeURIComponent(match[1]).trim();\n return value || null;\n } catch {\n return null;\n }\n}\n\n// Mirror the basename handling Dispatch's nav links use: pass a router-local\n// path when the live URL is already under the mount, otherwise prefix it.\nfunction dispatchNavTarget(path: string): string {\n if (typeof window === \"undefined\") return path;\n const basePath = appBasePath();\n if (!basePath) return path;\n const pathname = window.location.pathname;\n const routerHasBasename =\n pathname === basePath || pathname.startsWith(`${basePath}/`);\n return routerHasBasename ? path : appPath(path);\n}\n\ninterface DispatchThreadUrlSync {\n routeThreadId: string | null;\n getPath: (threadId: string | null) => string;\n navigate: (path: string, options?: { replace?: boolean }) => void;\n}\n\ntype DispatchAgentChatSurfaceProps = ComponentProps<typeof AgentChatSurface> & {\n threadUrlSync?: DispatchThreadUrlSync;\n};\n\nfunction DispatchAgentChatSurface(props: DispatchAgentChatSurfaceProps) {\n return <AgentChatSurface {...props} />;\n}\n\ninterface DispatchChatLocationState {\n dispatchPrompt?: {\n id?: string | number;\n message?: string;\n selectedModel?: string | null;\n };\n dispatchThread?: {\n id?: string | number;\n threadId?: string;\n };\n}\n\nexport function meta() {\n return [{ title: \"Chat — Dispatch\" }];\n}\n\nexport default function ChatRoute() {\n const location = useLocation();\n const navigate = useNavigate();\n const routeThreadId = threadIdFromPath(location.pathname);\n const handledStateIds = useRef(new Set<string>());\n\n const navigateThreadUrl = useCallback(\n (path: string, options?: { replace?: boolean }) =>\n navigate(dispatchNavTarget(path), options),\n [navigate],\n );\n const threadUrlSync = useMemo<DispatchThreadUrlSync>(\n () => ({\n routeThreadId: routeThreadId ?? null,\n getPath: chatThreadPath,\n navigate: navigateThreadUrl,\n }),\n [routeThreadId, navigateThreadUrl],\n );\n const state = location.state as DispatchChatLocationState | null;\n const prompt = state?.dispatchPrompt;\n const thread = state?.dispatchThread;\n\n useEffect(() => {\n const message = prompt?.message?.trim();\n const threadId = thread?.threadId?.trim();\n if (!message && !threadId) return;\n\n const stateId = String(\n prompt?.id ?? thread?.id ?? `${message ?? \"\"}:${threadId ?? \"\"}`,\n );\n if (handledStateIds.current.has(stateId)) return;\n handledStateIds.current.add(stateId);\n\n const timer = window.setTimeout(() => {\n if (threadId) {\n window.dispatchEvent(\n new CustomEvent(\"agent-chat:open-thread\", {\n detail: { threadId },\n }),\n );\n }\n if (message) {\n submitOverviewPrompt(message, prompt?.selectedModel, {\n openSidebar: false,\n });\n }\n navigate(`${location.pathname}${location.search}${location.hash}`, {\n replace: true,\n state: null,\n });\n }, 0);\n\n return () => window.clearTimeout(timer);\n }, [\n location.hash,\n location.pathname,\n location.search,\n navigate,\n prompt?.id,\n prompt?.message,\n prompt?.selectedModel,\n thread?.id,\n thread?.threadId,\n ]);\n\n useEffect(() => {\n function handleChatRunning(event: Event) {\n const detail = (event as CustomEvent).detail;\n if (detail?.isRunning === true) markAgentChatHomeHandoff(\"dispatch\");\n }\n\n window.addEventListener(\"agentNative.chatRunning\", handleChatRunning);\n return () =>\n window.removeEventListener(\"agentNative.chatRunning\", handleChatRunning);\n }, []);\n\n return (\n <div className=\"flex h-full min-h-0 flex-col bg-background\">\n <DispatchAgentChatSurface\n mode=\"page\"\n chatViewTransition\n className=\"dispatch-chat-panel\"\n defaultMode=\"chat\"\n storageKey=\"dispatch\"\n threadUrlSync={threadUrlSync}\n showHeader={false}\n showTabBar={false}\n dynamicSuggestions={false}\n suggestions={[]}\n emptyStateText=\"Ask Dispatch to create apps, route work, or manage the workspace.\"\n emptyStateDisplay=\"hidden\"\n centerComposerWhenEmpty\n composerLayoutVariant=\"hero\"\n composerPlaceholder=\"Ask Dispatch...\"\n composerSlot={\n <div className=\"dispatch-chat-intro\">\n <h1>What should Dispatch do next?</h1>\n <p>\n Create apps, manage shared keys, and route work across agents.\n </p>\n </div>\n }\n />\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../../src/routes/pages/chat.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,OAAO,EACP,wBAAwB,EACxB,IAAI,GACL,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,WAAW,EACX,SAAS,EACT,OAAO,EACP,MAAM,GAEP,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,SAAS,cAAc,CAAC,QAAuB;IAC7C,OAAO,QAAQ,CAAC,CAAC,CAAC,SAAS,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;AACtE,CAAC;AAED,SAAS,aAAa,CAAC,QAAgB;IACrC,MAAM,QA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BACG,CAAC,CAAC,0CAA0C,EAAE;4BAC7C,YAAY,EACV,qEAAqE;yBACxE,CAAC,GACA,IACA,CACP,CAAC,CAAC,CAAC,IAAI,GAEV,GACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["import {\n AgentChatSurface,\n appBasePath,\n appPath,\n markAgentChatHomeHandoff,\n useT,\n} from \"@agent-native/core/client\";\nimport {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n type ComponentProps,\n} from \"react\";\nimport { useLocation, useNavigate } from \"react-router\";\n\nimport { submitOverviewPrompt } from \"../../lib/overview-chat\";\n\nfunction chatThreadPath(threadId: string | null): string {\n return threadId ? `/chat/${encodeURIComponent(threadId)}` : \"/chat\";\n}\n\nfunction stripBasePath(pathname: string): string {\n const basePath = appBasePath();\n if (!basePath) return pathname;\n if (pathname === basePath) return \"/\";\n if (pathname.startsWith(`${basePath}/`)) {\n return pathname.slice(basePath.length) || \"/\";\n }\n return pathname;\n}\n\n// The chat surface renders for both `/chat` and the `/chat/:threadId` deep\n// link. The thread id is read from the pathname (not `useParams`) because the\n// param is owned by the nested deep-link route, not this leaf component.\nfunction threadIdFromPath(pathname: string): string | null {\n const match = stripBasePath(pathname).match(/^\\/chat\\/([^/]+)/);\n if (!match) return null;\n try {\n const value = decodeURIComponent(match[1]).trim();\n return value || null;\n } catch {\n return null;\n }\n}\n\n// Mirror the basename handling Dispatch's nav links use: pass a router-local\n// path when the live URL is already under the mount, otherwise prefix it.\nfunction dispatchNavTarget(path: string): string {\n if (typeof window === \"undefined\") return path;\n const basePath = appBasePath();\n if (!basePath) return path;\n const pathname = window.location.pathname;\n const routerHasBasename =\n pathname === basePath || pathname.startsWith(`${basePath}/`);\n return routerHasBasename ? path : appPath(path);\n}\n\ninterface DispatchThreadUrlSync {\n routeThreadId: string | null;\n getPath: (threadId: string | null) => string;\n navigate: (path: string, options?: { replace?: boolean }) => void;\n}\n\ntype DispatchAgentChatSurfaceProps = ComponentProps<typeof AgentChatSurface> & {\n threadUrlSync?: DispatchThreadUrlSync;\n};\n\nfunction DispatchAgentChatSurface(props: DispatchAgentChatSurfaceProps) {\n return <AgentChatSurface {...props} />;\n}\n\ninterface DispatchChatLocationState {\n dispatchPrompt?: {\n id?: string | number;\n message?: string;\n selectedModel?: string | null;\n };\n dispatchThread?: {\n id?: string | number;\n threadId?: string;\n };\n}\n\nexport function meta() {\n return [{ title: \"Chat — Dispatch\" }];\n}\n\nexport default function ChatRoute() {\n const t = useT();\n const location = useLocation();\n const navigate = useNavigate();\n const routeThreadId = threadIdFromPath(location.pathname);\n const handledStateIds = useRef(new Set<string>());\n\n const navigateThreadUrl = useCallback(\n (path: string, options?: { replace?: boolean }) =>\n navigate(dispatchNavTarget(path), options),\n [navigate],\n );\n const threadUrlSync = useMemo<DispatchThreadUrlSync>(\n () => ({\n routeThreadId: routeThreadId ?? null,\n getPath: chatThreadPath,\n navigate: navigateThreadUrl,\n }),\n [routeThreadId, navigateThreadUrl],\n );\n const state = location.state as DispatchChatLocationState | null;\n const prompt = state?.dispatchPrompt;\n const thread = state?.dispatchThread;\n\n useEffect(() => {\n const message = prompt?.message?.trim();\n const threadId = thread?.threadId?.trim();\n if (!message && !threadId) return;\n\n const stateId = String(\n prompt?.id ?? thread?.id ?? `${message ?? \"\"}:${threadId ?? \"\"}`,\n );\n if (handledStateIds.current.has(stateId)) return;\n handledStateIds.current.add(stateId);\n\n const timer = window.setTimeout(() => {\n if (threadId) {\n window.dispatchEvent(\n new CustomEvent(\"agent-chat:open-thread\", {\n detail: { threadId },\n }),\n );\n }\n if (message) {\n submitOverviewPrompt(message, prompt?.selectedModel, {\n openSidebar: false,\n });\n }\n navigate(`${location.pathname}${location.search}${location.hash}`, {\n replace: true,\n state: null,\n });\n }, 0);\n\n return () => window.clearTimeout(timer);\n }, [\n location.hash,\n location.pathname,\n location.search,\n navigate,\n prompt?.id,\n prompt?.message,\n prompt?.selectedModel,\n thread?.id,\n thread?.threadId,\n ]);\n\n useEffect(() => {\n function handleChatRunning(event: Event) {\n const detail = (event as CustomEvent).detail;\n if (detail?.isRunning === true) markAgentChatHomeHandoff(\"dispatch\");\n }\n\n window.addEventListener(\"agentNative.chatRunning\", handleChatRunning);\n return () =>\n window.removeEventListener(\"agentNative.chatRunning\", handleChatRunning);\n }, []);\n\n return (\n <div className=\"flex h-full min-h-0 flex-col bg-background\">\n <DispatchAgentChatSurface\n mode=\"page\"\n chatViewTransition\n className=\"dispatch-chat-panel\"\n defaultMode=\"chat\"\n storageKey=\"dispatch\"\n threadUrlSync={threadUrlSync}\n showHeader={false}\n showTabBar={false}\n dynamicSuggestions={false}\n suggestions={[]}\n emptyStateText={t(\"dispatch.pages.chatAcrossAppsDescription\", {\n defaultValue:\n \"Route work, inspect status, or create something new from one place.\",\n })}\n emptyStateDisplay=\"hidden\"\n {...(!prompt?.message\n ? {\n centerComposerWhenEmpty: true,\n composerLayoutVariant: \"hero\" as const,\n }\n : {})}\n composerPlaceholder={t(\"dispatch.pages.chatPromptPlaceholder\", {\n defaultValue: \"Ask Dispatch...\",\n })}\n composerSlot={\n !prompt?.message ? (\n <div className=\"dispatch-chat-intro\">\n <h1>\n {t(\"dispatch.pages.chatAcrossApps\", {\n defaultValue: \"Chat across your apps\",\n })}\n </h1>\n <p>\n {t(\"dispatch.pages.chatAcrossAppsDescription\", {\n defaultValue:\n \"Route work, inspect status, or create something new from one place.\",\n })}\n </p>\n </div>\n ) : null\n }\n />\n </div>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"destinations.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/destinations.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"destinations.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/destinations.tsx"],"names":[],"mappings":"AAiCA,wBAAgB,IAAI;;IAEnB;AA4CD,MAAM,CAAC,OAAO,UAAU,iBAAiB,oDA+MxC"}
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useActionMutation, useActionQuery, useT, } from "@agent-native/core/client";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { toast } from "sonner";
|
|
5
|
+
import { ActionQueryError } from "../../components/action-query-error.js";
|
|
5
6
|
import { DispatchShell } from "../../components/dispatch-shell.js";
|
|
6
7
|
import { TaskQueueHealth } from "../../components/task-queue-health.js";
|
|
7
8
|
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "../../components/ui/alert-dialog.js";
|
|
@@ -33,7 +34,8 @@ function QuickSendRow({ destination, }) {
|
|
|
33
34
|
}
|
|
34
35
|
export default function DestinationsRoute() {
|
|
35
36
|
const t = useT();
|
|
36
|
-
const
|
|
37
|
+
const destinationsQuery = useActionQuery("list-destinations", {});
|
|
38
|
+
const { data } = destinationsQuery;
|
|
37
39
|
const [form, setForm] = useState({
|
|
38
40
|
name: "",
|
|
39
41
|
platform: "slack",
|
|
@@ -56,11 +58,11 @@ export default function DestinationsRoute() {
|
|
|
56
58
|
const remove = useActionMutation("delete-destination", {
|
|
57
59
|
onSuccess: () => toast.success(t("dispatch.pages.destinationRemoved")),
|
|
58
60
|
});
|
|
59
|
-
return (_jsx(DispatchShell, { title: t("dispatch.nav.destinations"), description: t("dispatch.pages.destinationsDescription"), children: _jsxs("div", { className: "flex flex-col gap-4", children: [_jsx(TaskQueueHealth, {}), _jsxs("div", { className: "grid gap-4 xl:grid-cols-[minmax(0,1.1fr)_minmax(0,0.9fr)]", children: [_jsxs("section", { className: "rounded-2xl border bg-card p-5", children: [_jsx("h2", { className: "text-lg font-semibold text-foreground", children: t("dispatch.pages.savedDestinations") }), _jsxs("div", { className: "mt-4 space-y-3", children: [(data || []).map((destination) => (_jsxs("div", { className: "rounded-xl border bg-muted/30 p-4", children: [_jsxs("div", { className: "flex items-start justify-between gap-3", children: [_jsxs("div", { children: [_jsx("div", { className: "text-sm font-medium text-foreground", children: destination.name }), _jsxs("div", { className: "mt-1 text-xs text-muted-foreground", children: [destination.platform, " \u00B7 ", destination.destination, destination.threadRef
|
|
61
|
+
return (_jsx(DispatchShell, { title: t("dispatch.nav.destinations"), description: t("dispatch.pages.destinationsDescription"), children: _jsxs("div", { className: "flex flex-col gap-4", children: [_jsx(TaskQueueHealth, {}), _jsxs("div", { className: "grid gap-4 xl:grid-cols-[minmax(0,1.1fr)_minmax(0,0.9fr)]", children: [_jsxs("section", { className: "rounded-2xl border bg-card p-5", children: [_jsx("h2", { className: "text-lg font-semibold text-foreground", children: t("dispatch.pages.savedDestinations") }), destinationsQuery.isError ? (_jsx(ActionQueryError, { className: "mt-4", error: destinationsQuery.error, onRetry: () => void destinationsQuery.refetch() })) : (_jsxs("div", { className: "mt-4 space-y-3", children: [(data || []).map((destination) => (_jsxs("div", { className: "rounded-xl border bg-muted/30 p-4", children: [_jsxs("div", { className: "flex items-start justify-between gap-3", children: [_jsxs("div", { children: [_jsx("div", { className: "text-sm font-medium text-foreground", children: destination.name }), _jsxs("div", { className: "mt-1 text-xs text-muted-foreground", children: [destination.platform, " \u00B7 ", destination.destination, destination.threadRef
|
|
60
62
|
? ` · thread ${destination.threadRef}`
|
|
61
63
|
: ""] }), destination.notes && (_jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: destination.notes }))] }), _jsxs(AlertDialog, { children: [_jsx(AlertDialogTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", size: "sm", children: t("dispatch.pages.delete") }) }), _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: t("dispatch.pages.deleteDestinationTitle") }), _jsx(AlertDialogDescription, { children: t("dispatch.pages.deleteDestinationDescription", {
|
|
62
64
|
name: destination.name,
|
|
63
|
-
}) })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { children: t("dispatch.pages.cancel") }), _jsx(AlertDialogAction, { onClick: () => remove.mutate({ id: destination.id }), children: t("dispatch.pages.delete") })] })] })] })] }), _jsx(QuickSendRow, { destination: destination })] }, destination.id))), (data?.length || 0) === 0 && (_jsx("div", { className: "rounded-xl border border-dashed px-4 py-8 text-sm text-muted-foreground", children: t("dispatch.pages.noDestinations") }))] })] }), _jsxs("section", { className: "rounded-2xl border bg-card p-5", children: [_jsx("h2", { className: "text-lg font-semibold text-foreground", children: t("dispatch.pages.addDestination") }), _jsxs("div", { className: "mt-4 space-y-3", children: [_jsx(Input, { value: form.name, onChange: (event) => setForm((current) => ({
|
|
65
|
+
}) })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { children: t("dispatch.pages.cancel") }), _jsx(AlertDialogAction, { onClick: () => remove.mutate({ id: destination.id }), children: t("dispatch.pages.delete") })] })] })] })] }), _jsx(QuickSendRow, { destination: destination })] }, destination.id))), (data?.length || 0) === 0 && (_jsx("div", { className: "rounded-xl border border-dashed px-4 py-8 text-sm text-muted-foreground", children: t("dispatch.pages.noDestinations") }))] }))] }), _jsxs("section", { className: "rounded-2xl border bg-card p-5", children: [_jsx("h2", { className: "text-lg font-semibold text-foreground", children: t("dispatch.pages.addDestination") }), _jsxs("div", { className: "mt-4 space-y-3", children: [_jsx(Input, { value: form.name, onChange: (event) => setForm((current) => ({
|
|
64
66
|
...current,
|
|
65
67
|
name: event.target.value,
|
|
66
68
|
})), placeholder: t("dispatch.pages.dailyDigestChannel") }), _jsxs(Select, { value: form.platform, onValueChange: (value) => setForm((current) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"destinations.js","sourceRoot":"","sources":["../../../src/routes/pages/destinations.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,IAAI,GACL,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,OAA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CAAC,iCAAiC,CAAC,GACjD,EACF,KAAC,MAAM,IACL,SAAS,EAAC,QAAQ,EAClB,OAAO,EAAE,GAAG,EAAE,CACZ,MAAM,CAAC,MAAM,CAAC;gDACZ,IAAI,EAAE,IAAI,CAAC,IAAI;gDACf,QAAQ,EAAE,IAAI,CAAC,QAA0C;gDACzD,WAAW,EAAE,IAAI,CAAC,WAAW;gDAC7B,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,SAAS;gDACtC,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,SAAS;6CAC/B,CAAC,EAEJ,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,YAExC,CAAC,CAAC,gCAAgC,CAAC,GAC7B,IACL,IACE,IACN,IACF,GACQ,CACjB,CAAC;AACJ,CAAC","sourcesContent":["import {\n useActionMutation,\n useActionQuery,\n useT,\n} from \"@agent-native/core/client\";\nimport { useState } from \"react\";\nimport { toast } from \"sonner\";\n\nimport { DispatchShell } from \"../../components/dispatch-shell\";\nimport { TaskQueueHealth } from \"../../components/task-queue-health\";\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n AlertDialogTrigger,\n} from \"../../components/ui/alert-dialog\";\nimport { Button } from \"../../components/ui/button\";\nimport { Input } from \"../../components/ui/input\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"../../components/ui/select\";\nimport { Textarea } from \"../../components/ui/textarea\";\n\nexport function meta() {\n return [{ title: \"Destinations — Dispatch\" }];\n}\n\nfunction QuickSendRow({\n destination,\n}: {\n destination: { id: string; name: string };\n}) {\n const t = useT();\n const [text, setText] = useState(\"\");\n const send = useActionMutation(\"send-platform-message\", {\n onSuccess: () => {\n toast.success(t(\"dispatch.pages.messageSent\"));\n setText(\"\");\n },\n onError: (error) => {\n toast.error(\n error instanceof Error\n ? error.message\n : t(\"dispatch.pages.unableToSendMessage\"),\n );\n },\n });\n return (\n <div className=\"mt-3 flex gap-2\">\n <Input\n value={text}\n onChange={(event) => setText(event.target.value)}\n placeholder={t(\"dispatch.pages.quickTestMessage\")}\n />\n <Button\n onClick={() =>\n send.mutate({\n destinationId: destination.id,\n text: text || `Test message to ${destination.name}`,\n })\n }\n disabled={send.isPending}\n >\n {t(\"dispatch.pages.send\")}\n </Button>\n </div>\n );\n}\n\nexport default function DestinationsRoute() {\n const t = useT();\n const { data } = useActionQuery(\"list-destinations\", {});\n const [form, setForm] = useState({\n name: \"\",\n platform: \"slack\",\n destination: \"\",\n threadRef: \"\",\n notes: \"\",\n });\n\n const upsert = useActionMutation(\"upsert-destination\", {\n onSuccess: () => {\n toast.success(t(\"dispatch.pages.destinationSaved\"));\n setForm((current) => ({\n ...current,\n name: \"\",\n destination: \"\",\n threadRef: \"\",\n notes: \"\",\n }));\n },\n });\n const remove = useActionMutation(\"delete-destination\", {\n onSuccess: () => toast.success(t(\"dispatch.pages.destinationRemoved\")),\n });\n\n return (\n <DispatchShell\n title={t(\"dispatch.nav.destinations\")}\n description={t(\"dispatch.pages.destinationsDescription\")}\n >\n <div className=\"flex flex-col gap-4\">\n <TaskQueueHealth />\n <div className=\"grid gap-4 xl:grid-cols-[minmax(0,1.1fr)_minmax(0,0.9fr)]\">\n <section className=\"rounded-2xl border bg-card p-5\">\n <h2 className=\"text-lg font-semibold text-foreground\">\n {t(\"dispatch.pages.savedDestinations\")}\n </h2>\n <div className=\"mt-4 space-y-3\">\n {(data || []).map((destination: any) => (\n <div\n key={destination.id}\n className=\"rounded-xl border bg-muted/30 p-4\"\n >\n <div className=\"flex items-start justify-between gap-3\">\n <div>\n <div className=\"text-sm font-medium text-foreground\">\n {destination.name}\n </div>\n <div className=\"mt-1 text-xs text-muted-foreground\">\n {destination.platform} · {destination.destination}\n {destination.threadRef\n ? ` · thread ${destination.threadRef}`\n : \"\"}\n </div>\n {destination.notes && (\n <p className=\"mt-2 text-sm text-muted-foreground\">\n {destination.notes}\n </p>\n )}\n </div>\n <AlertDialog>\n <AlertDialogTrigger asChild>\n <Button variant=\"outline\" size=\"sm\">\n {t(\"dispatch.pages.delete\")}\n </Button>\n </AlertDialogTrigger>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>\n {t(\"dispatch.pages.deleteDestinationTitle\")}\n </AlertDialogTitle>\n <AlertDialogDescription>\n {t(\"dispatch.pages.deleteDestinationDescription\", {\n name: destination.name,\n })}\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>\n {t(\"dispatch.pages.cancel\")}\n </AlertDialogCancel>\n <AlertDialogAction\n onClick={() =>\n remove.mutate({ id: destination.id })\n }\n >\n {t(\"dispatch.pages.delete\")}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </div>\n <QuickSendRow destination={destination} />\n </div>\n ))}\n {(data?.length || 0) === 0 && (\n <div className=\"rounded-xl border border-dashed px-4 py-8 text-sm text-muted-foreground\">\n {t(\"dispatch.pages.noDestinations\")}\n </div>\n )}\n </div>\n </section>\n\n <section className=\"rounded-2xl border bg-card p-5\">\n <h2 className=\"text-lg font-semibold text-foreground\">\n {t(\"dispatch.pages.addDestination\")}\n </h2>\n <div className=\"mt-4 space-y-3\">\n <Input\n value={form.name}\n onChange={(event) =>\n setForm((current) => ({\n ...current,\n name: event.target.value,\n }))\n }\n placeholder={t(\"dispatch.pages.dailyDigestChannel\")}\n />\n <Select\n value={form.platform}\n onValueChange={(value) =>\n setForm((current) => ({\n ...current,\n platform: value,\n }))\n }\n >\n <SelectTrigger>\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"slack\">Slack</SelectItem>\n <SelectItem value=\"telegram\">Telegram</SelectItem>\n <SelectItem value=\"email\">Email</SelectItem>\n </SelectContent>\n </Select>\n <Input\n value={form.destination}\n onChange={(event) =>\n setForm((current) => ({\n ...current,\n destination: event.target.value,\n }))\n }\n placeholder={\n form.platform === \"slack\"\n ? \"C0123456789\"\n : form.platform === \"email\"\n ? \"teammate+qa@agent-native.test\"\n : \"123456789\"\n }\n />\n <Input\n value={form.threadRef}\n onChange={(event) =>\n setForm((current) => ({\n ...current,\n threadRef: event.target.value,\n }))\n }\n placeholder={t(\"dispatch.pages.optionalThreadOrTopicId\")}\n />\n <Textarea\n value={form.notes}\n onChange={(event) =>\n setForm((current) => ({\n ...current,\n notes: event.target.value,\n }))\n }\n placeholder={t(\"dispatch.pages.destinationNotes\")}\n />\n <Button\n className=\"w-full\"\n onClick={() =>\n upsert.mutate({\n name: form.name,\n platform: form.platform as \"slack\" | \"telegram\" | \"email\",\n destination: form.destination,\n threadRef: form.threadRef || undefined,\n notes: form.notes || undefined,\n })\n }\n disabled={!form.name || !form.destination}\n >\n {t(\"dispatch.pages.saveDestination\")}\n </Button>\n </div>\n </section>\n </div>\n </div>\n </DispatchShell>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"destinations.js","sourceRoot":"","sources":["../../../src/routes/pages/destinations.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,IAAI,GACL,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,MAAM,EAA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C,CAAC,GACjD,EACF,KAAC,MAAM,IACL,SAAS,EAAC,QAAQ,EAClB,OAAO,EAAE,GAAG,EAAE,CACZ,MAAM,CAAC,MAAM,CAAC;gDACZ,IAAI,EAAE,IAAI,CAAC,IAAI;gDACf,QAAQ,EAAE,IAAI,CAAC,QAA0C;gDACzD,WAAW,EAAE,IAAI,CAAC,WAAW;gDAC7B,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,SAAS;gDACtC,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,SAAS;6CAC/B,CAAC,EAEJ,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,YAExC,CAAC,CAAC,gCAAgC,CAAC,GAC7B,IACL,IACE,IACN,IACF,GACQ,CACjB,CAAC;AACJ,CAAC","sourcesContent":["import {\n useActionMutation,\n useActionQuery,\n useT,\n} from \"@agent-native/core/client\";\nimport { useState } from \"react\";\nimport { toast } from \"sonner\";\n\nimport { ActionQueryError } from \"../../components/action-query-error\";\nimport { DispatchShell } from \"../../components/dispatch-shell\";\nimport { TaskQueueHealth } from \"../../components/task-queue-health\";\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n AlertDialogTrigger,\n} from \"../../components/ui/alert-dialog\";\nimport { Button } from \"../../components/ui/button\";\nimport { Input } from \"../../components/ui/input\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"../../components/ui/select\";\nimport { Textarea } from \"../../components/ui/textarea\";\n\nexport function meta() {\n return [{ title: \"Destinations — Dispatch\" }];\n}\n\nfunction QuickSendRow({\n destination,\n}: {\n destination: { id: string; name: string };\n}) {\n const t = useT();\n const [text, setText] = useState(\"\");\n const send = useActionMutation(\"send-platform-message\", {\n onSuccess: () => {\n toast.success(t(\"dispatch.pages.messageSent\"));\n setText(\"\");\n },\n onError: (error) => {\n toast.error(\n error instanceof Error\n ? error.message\n : t(\"dispatch.pages.unableToSendMessage\"),\n );\n },\n });\n return (\n <div className=\"mt-3 flex gap-2\">\n <Input\n value={text}\n onChange={(event) => setText(event.target.value)}\n placeholder={t(\"dispatch.pages.quickTestMessage\")}\n />\n <Button\n onClick={() =>\n send.mutate({\n destinationId: destination.id,\n text: text || `Test message to ${destination.name}`,\n })\n }\n disabled={send.isPending}\n >\n {t(\"dispatch.pages.send\")}\n </Button>\n </div>\n );\n}\n\nexport default function DestinationsRoute() {\n const t = useT();\n const destinationsQuery = useActionQuery(\"list-destinations\", {});\n const { data } = destinationsQuery;\n const [form, setForm] = useState({\n name: \"\",\n platform: \"slack\",\n destination: \"\",\n threadRef: \"\",\n notes: \"\",\n });\n\n const upsert = useActionMutation(\"upsert-destination\", {\n onSuccess: () => {\n toast.success(t(\"dispatch.pages.destinationSaved\"));\n setForm((current) => ({\n ...current,\n name: \"\",\n destination: \"\",\n threadRef: \"\",\n notes: \"\",\n }));\n },\n });\n const remove = useActionMutation(\"delete-destination\", {\n onSuccess: () => toast.success(t(\"dispatch.pages.destinationRemoved\")),\n });\n\n return (\n <DispatchShell\n title={t(\"dispatch.nav.destinations\")}\n description={t(\"dispatch.pages.destinationsDescription\")}\n >\n <div className=\"flex flex-col gap-4\">\n <TaskQueueHealth />\n <div className=\"grid gap-4 xl:grid-cols-[minmax(0,1.1fr)_minmax(0,0.9fr)]\">\n <section className=\"rounded-2xl border bg-card p-5\">\n <h2 className=\"text-lg font-semibold text-foreground\">\n {t(\"dispatch.pages.savedDestinations\")}\n </h2>\n {destinationsQuery.isError ? (\n <ActionQueryError\n className=\"mt-4\"\n error={destinationsQuery.error}\n onRetry={() => void destinationsQuery.refetch()}\n />\n ) : (\n <div className=\"mt-4 space-y-3\">\n {(data || []).map((destination: any) => (\n <div\n key={destination.id}\n className=\"rounded-xl border bg-muted/30 p-4\"\n >\n <div className=\"flex items-start justify-between gap-3\">\n <div>\n <div className=\"text-sm font-medium text-foreground\">\n {destination.name}\n </div>\n <div className=\"mt-1 text-xs text-muted-foreground\">\n {destination.platform} · {destination.destination}\n {destination.threadRef\n ? ` · thread ${destination.threadRef}`\n : \"\"}\n </div>\n {destination.notes && (\n <p className=\"mt-2 text-sm text-muted-foreground\">\n {destination.notes}\n </p>\n )}\n </div>\n <AlertDialog>\n <AlertDialogTrigger asChild>\n <Button variant=\"outline\" size=\"sm\">\n {t(\"dispatch.pages.delete\")}\n </Button>\n </AlertDialogTrigger>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>\n {t(\"dispatch.pages.deleteDestinationTitle\")}\n </AlertDialogTitle>\n <AlertDialogDescription>\n {t(\n \"dispatch.pages.deleteDestinationDescription\",\n {\n name: destination.name,\n },\n )}\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>\n {t(\"dispatch.pages.cancel\")}\n </AlertDialogCancel>\n <AlertDialogAction\n onClick={() =>\n remove.mutate({ id: destination.id })\n }\n >\n {t(\"dispatch.pages.delete\")}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </div>\n <QuickSendRow destination={destination} />\n </div>\n ))}\n {(data?.length || 0) === 0 && (\n <div className=\"rounded-xl border border-dashed px-4 py-8 text-sm text-muted-foreground\">\n {t(\"dispatch.pages.noDestinations\")}\n </div>\n )}\n </div>\n )}\n </section>\n\n <section className=\"rounded-2xl border bg-card p-5\">\n <h2 className=\"text-lg font-semibold text-foreground\">\n {t(\"dispatch.pages.addDestination\")}\n </h2>\n <div className=\"mt-4 space-y-3\">\n <Input\n value={form.name}\n onChange={(event) =>\n setForm((current) => ({\n ...current,\n name: event.target.value,\n }))\n }\n placeholder={t(\"dispatch.pages.dailyDigestChannel\")}\n />\n <Select\n value={form.platform}\n onValueChange={(value) =>\n setForm((current) => ({\n ...current,\n platform: value,\n }))\n }\n >\n <SelectTrigger>\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"slack\">Slack</SelectItem>\n <SelectItem value=\"telegram\">Telegram</SelectItem>\n <SelectItem value=\"email\">Email</SelectItem>\n </SelectContent>\n </Select>\n <Input\n value={form.destination}\n onChange={(event) =>\n setForm((current) => ({\n ...current,\n destination: event.target.value,\n }))\n }\n placeholder={\n form.platform === \"slack\"\n ? \"C0123456789\"\n : form.platform === \"email\"\n ? \"teammate+qa@agent-native.test\"\n : \"123456789\"\n }\n />\n <Input\n value={form.threadRef}\n onChange={(event) =>\n setForm((current) => ({\n ...current,\n threadRef: event.target.value,\n }))\n }\n placeholder={t(\"dispatch.pages.optionalThreadOrTopicId\")}\n />\n <Textarea\n value={form.notes}\n onChange={(event) =>\n setForm((current) => ({\n ...current,\n notes: event.target.value,\n }))\n }\n placeholder={t(\"dispatch.pages.destinationNotes\")}\n />\n <Button\n className=\"w-full\"\n onClick={() =>\n upsert.mutate({\n name: form.name,\n platform: form.platform as \"slack\" | \"telegram\" | \"email\",\n destination: form.destination,\n threadRef: form.threadRef || undefined,\n notes: form.notes || undefined,\n })\n }\n disabled={!form.name || !form.destination}\n >\n {t(\"dispatch.pages.saveDestination\")}\n </Button>\n </div>\n </section>\n </div>\n </div>\n </DispatchShell>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identities.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/identities.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"identities.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/identities.tsx"],"names":[],"mappings":"AAOA,wBAAgB,IAAI;;IAEnB;AAED,MAAM,CAAC,OAAO,UAAU,eAAe,oDA2FtC"}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useActionMutation, useActionQuery } from "@agent-native/core/client";
|
|
3
3
|
import { toast } from "sonner";
|
|
4
|
+
import { ActionQueryError } from "../../components/action-query-error.js";
|
|
4
5
|
import { DispatchShell } from "../../components/dispatch-shell.js";
|
|
5
6
|
import { Button } from "../../components/ui/button.js";
|
|
6
7
|
export function meta() {
|
|
7
8
|
return [{ title: "Identities — Dispatch" }];
|
|
8
9
|
}
|
|
9
10
|
export default function IdentitiesRoute() {
|
|
10
|
-
const
|
|
11
|
+
const query = useActionQuery("list-linked-identities", {});
|
|
12
|
+
const { data } = query;
|
|
11
13
|
const createToken = useActionMutation("create-link-token", {
|
|
12
14
|
onSuccess: () => toast.success("Link token created"),
|
|
13
15
|
});
|
|
14
|
-
return (_jsx(DispatchShell, { title: "Identities", description: "Link external senders to workspace users.", children: _jsxs("div", { className: "grid gap-4 xl:grid-cols-2", children: [_jsxs("section", { className: "rounded-2xl border bg-card p-5", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [_jsx("h2", { className: "text-lg font-semibold text-foreground", children: "Active links" }), _jsxs("div", { className: "flex shrink-0 gap-2", children: [_jsx(Button, { variant: "outline", onClick: () => createToken.mutate({ platform: "slack" }), children: "New Slack token" }), _jsx(Button, { onClick: () => createToken.mutate({ platform: "telegram" }), children: "New Telegram token" })] })] }), _jsxs("div", { className: "mt-4 space-y-3", children: [(data?.links || []).map((link) => (_jsxs("div", { className: "rounded-xl border bg-muted/30 px-4 py-3", children: [_jsx("div", { className: "text-sm font-medium text-foreground", children: link.externalUserName || link.externalUserId }), _jsxs("div", { className: "mt-1 text-xs text-muted-foreground", children: [link.platform, " \u2192 ", link.ownerEmail] })] }, link.id))), (data?.links?.length || 0) === 0 && (_jsxs("div", { className: "rounded-xl border border-dashed px-4 py-8 text-sm text-muted-foreground", children: ["No linked identities yet. Generate a token and ask the user to send ", _jsx("code", { children: "/link TOKEN" }), " from Slack or Telegram."] }))] })] }), _jsxs("section", { className: "rounded-2xl border bg-card p-5", children: [_jsx("h2", { className: "text-lg font-semibold text-foreground", children: "Link tokens" }), _jsxs("div", { className: "mt-4 space-y-3", children: [(data?.tokens || []).map((token) => (_jsxs("div", { className: "rounded-xl border px-4 py-3", children: [_jsxs("div", { className: "text-sm font-medium text-foreground", children: ["/link ", token.token] }), _jsxs("div", { className: "mt-1 text-xs text-muted-foreground", children: [token.platform, " \u00B7 expires", " ", new Date(token.expiresAt).toLocaleString(), token.claimedAt
|
|
16
|
+
return (_jsx(DispatchShell, { title: "Identities", description: "Link external senders to workspace users.", children: query.isError ? (_jsx(ActionQueryError, { error: query.error, onRetry: () => void query.refetch() })) : (_jsxs("div", { className: "grid gap-4 xl:grid-cols-2", children: [_jsxs("section", { className: "rounded-2xl border bg-card p-5", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [_jsx("h2", { className: "text-lg font-semibold text-foreground", children: "Active links" }), _jsxs("div", { className: "flex shrink-0 gap-2", children: [_jsx(Button, { variant: "outline", onClick: () => createToken.mutate({ platform: "slack" }), children: "New Slack token" }), _jsx(Button, { onClick: () => createToken.mutate({ platform: "telegram" }), children: "New Telegram token" })] })] }), _jsxs("div", { className: "mt-4 space-y-3", children: [(data?.links || []).map((link) => (_jsxs("div", { className: "rounded-xl border bg-muted/30 px-4 py-3", children: [_jsx("div", { className: "text-sm font-medium text-foreground", children: link.externalUserName || link.externalUserId }), _jsxs("div", { className: "mt-1 text-xs text-muted-foreground", children: [link.platform, " \u2192 ", link.ownerEmail] })] }, link.id))), (data?.links?.length || 0) === 0 && (_jsxs("div", { className: "rounded-xl border border-dashed px-4 py-8 text-sm text-muted-foreground", children: ["No linked identities yet. Generate a token and ask the user to send ", _jsx("code", { children: "/link TOKEN" }), " from Slack or Telegram."] }))] })] }), _jsxs("section", { className: "rounded-2xl border bg-card p-5", children: [_jsx("h2", { className: "text-lg font-semibold text-foreground", children: "Link tokens" }), _jsxs("div", { className: "mt-4 space-y-3", children: [(data?.tokens || []).map((token) => (_jsxs("div", { className: "rounded-xl border px-4 py-3", children: [_jsxs("div", { className: "text-sm font-medium text-foreground", children: ["/link ", token.token] }), _jsxs("div", { className: "mt-1 text-xs text-muted-foreground", children: [token.platform, " \u00B7 expires", " ", new Date(token.expiresAt).toLocaleString(), token.claimedAt
|
|
15
17
|
? ` · claimed by ${token.claimedByExternalUserName || token.claimedByExternalUserId}`
|
|
16
|
-
: " · waiting to be claimed"] })] }, token.id))), (data?.tokens?.length || 0) === 0 && (_jsx("div", { className: "rounded-xl border border-dashed px-4 py-8 text-sm text-muted-foreground", children: "No active link tokens." }))] })] })] }) }));
|
|
18
|
+
: " · waiting to be claimed"] })] }, token.id))), (data?.tokens?.length || 0) === 0 && (_jsx("div", { className: "rounded-xl border border-dashed px-4 py-8 text-sm text-muted-foreground", children: "No active link tokens." }))] })] })] })) }));
|
|
17
19
|
}
|
|
18
20
|
//# sourceMappingURL=identities.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identities.js","sourceRoot":"","sources":["../../../src/routes/pages/identities.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD,MAAM,UAAU,IAAI;IAClB,OAAO,CAAC,EAAE,KAAK,EAAE,uBAAuB,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,eAAe;IACrC,MAAM,
|
|
1
|
+
{"version":3,"file":"identities.js","sourceRoot":"","sources":["../../../src/routes/pages/identities.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM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N,CACP,GACa,CACjB,CAAC;AACJ,CAAC","sourcesContent":["import { useActionMutation, useActionQuery } from \"@agent-native/core/client\";\nimport { toast } from \"sonner\";\n\nimport { ActionQueryError } from \"../../components/action-query-error\";\nimport { DispatchShell } from \"../../components/dispatch-shell\";\nimport { Button } from \"../../components/ui/button\";\n\nexport function meta() {\n return [{ title: \"Identities — Dispatch\" }];\n}\n\nexport default function IdentitiesRoute() {\n const query = useActionQuery(\"list-linked-identities\", {});\n const { data } = query;\n const createToken = useActionMutation(\"create-link-token\", {\n onSuccess: () => toast.success(\"Link token created\"),\n });\n\n return (\n <DispatchShell\n title=\"Identities\"\n description=\"Link external senders to workspace users.\"\n >\n {query.isError ? (\n <ActionQueryError\n error={query.error}\n onRetry={() => void query.refetch()}\n />\n ) : (\n <div className=\"grid gap-4 xl:grid-cols-2\">\n <section className=\"rounded-2xl border bg-card p-5\">\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <h2 className=\"text-lg font-semibold text-foreground\">\n Active links\n </h2>\n <div className=\"flex shrink-0 gap-2\">\n <Button\n variant=\"outline\"\n onClick={() => createToken.mutate({ platform: \"slack\" })}\n >\n New Slack token\n </Button>\n <Button\n onClick={() => createToken.mutate({ platform: \"telegram\" })}\n >\n New Telegram token\n </Button>\n </div>\n </div>\n <div className=\"mt-4 space-y-3\">\n {(data?.links || []).map((link: any) => (\n <div\n key={link.id}\n className=\"rounded-xl border bg-muted/30 px-4 py-3\"\n >\n <div className=\"text-sm font-medium text-foreground\">\n {link.externalUserName || link.externalUserId}\n </div>\n <div className=\"mt-1 text-xs text-muted-foreground\">\n {link.platform} → {link.ownerEmail}\n </div>\n </div>\n ))}\n {(data?.links?.length || 0) === 0 && (\n <div className=\"rounded-xl border border-dashed px-4 py-8 text-sm text-muted-foreground\">\n No linked identities yet. Generate a token and ask the user to\n send <code>/link TOKEN</code> from Slack or Telegram.\n </div>\n )}\n </div>\n </section>\n\n <section className=\"rounded-2xl border bg-card p-5\">\n <h2 className=\"text-lg font-semibold text-foreground\">\n Link tokens\n </h2>\n <div className=\"mt-4 space-y-3\">\n {(data?.tokens || []).map((token: any) => (\n <div key={token.id} className=\"rounded-xl border px-4 py-3\">\n <div className=\"text-sm font-medium text-foreground\">\n /link {token.token}\n </div>\n <div className=\"mt-1 text-xs text-muted-foreground\">\n {token.platform} · expires{\" \"}\n {new Date(token.expiresAt).toLocaleString()}\n {token.claimedAt\n ? ` · claimed by ${token.claimedByExternalUserName || token.claimedByExternalUserId}`\n : \" · waiting to be claimed\"}\n </div>\n </div>\n ))}\n {(data?.tokens?.length || 0) === 0 && (\n <div className=\"rounded-xl border border-dashed px-4 py-8 text-sm text-muted-foreground\">\n No active link tokens.\n </div>\n )}\n </div>\n </section>\n </div>\n )}\n </DispatchShell>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/integrations.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/integrations.tsx"],"names":[],"mappings":"AAsCA,wBAAgB,IAAI;;IAEnB;AAyRD,MAAM,CAAC,OAAO,UAAU,gBAAgB,oDAwIvC"}
|
|
@@ -4,6 +4,7 @@ import { IconCheck, IconChevronRight, IconCircleDashed, IconKey, IconLink, IconP
|
|
|
4
4
|
import { useQueryClient } from "@tanstack/react-query";
|
|
5
5
|
import { useMemo, useState } from "react";
|
|
6
6
|
import { toast } from "sonner";
|
|
7
|
+
import { ActionQueryError } from "../../components/action-query-error.js";
|
|
7
8
|
import { DispatchShell } from "../../components/dispatch-shell.js";
|
|
8
9
|
import { Badge } from "../../components/ui/badge.js";
|
|
9
10
|
import { Button } from "../../components/ui/button.js";
|
|
@@ -118,8 +119,10 @@ function PerAppDetailRow({ app }) {
|
|
|
118
119
|
return (_jsxs("div", { className: "flex items-center justify-between border-t px-4 py-2.5 first:border-t-0", children: [_jsxs("div", { className: "flex items-center gap-2 min-w-0", children: [_jsx("div", { className: "h-5 w-5 rounded text-[10px] font-bold text-white flex items-center justify-center shrink-0", style: { backgroundColor: app.color }, children: app.appName.charAt(0).toUpperCase() }), _jsx("span", { className: "text-sm truncate", children: app.appName }), !app.reachable && (_jsx("span", { className: "text-xs text-muted-foreground", children: "offline" }))] }), _jsx("span", { className: "text-xs text-muted-foreground", children: total === 0 ? "no integrations" : `${ok}/${total}` })] }));
|
|
119
120
|
}
|
|
120
121
|
export default function ConnectionsRoute() {
|
|
121
|
-
const
|
|
122
|
-
const
|
|
122
|
+
const catalogQuery = useActionQuery("list-integrations-catalog", {});
|
|
123
|
+
const accessQuery = useActionQuery("get-vault-access-settings", {});
|
|
124
|
+
const { data: catalog, isLoading } = catalogQuery;
|
|
125
|
+
const { data: accessSettings } = accessQuery;
|
|
123
126
|
const apps = catalog || [];
|
|
124
127
|
const accessMode = accessSettings?.mode === "manual" ? "manual" : "all-apps";
|
|
125
128
|
const services = useMemo(() => {
|
|
@@ -147,6 +150,9 @@ export default function ConnectionsRoute() {
|
|
|
147
150
|
}, [apps]);
|
|
148
151
|
const available = services.filter((s) => !s.apps.some((a) => a.configured));
|
|
149
152
|
const connected = services.filter((s) => s.apps.some((a) => a.configured));
|
|
150
|
-
return (_jsxs(DispatchShell, { title: "Connections", description: "Connect services once. Apps that need them pick up the key automatically.", children: [
|
|
153
|
+
return (_jsxs(DispatchShell, { title: "Connections", description: "Connect services once. Apps that need them pick up the key automatically.", children: [catalogQuery.isError || accessQuery.isError ? (_jsx(ActionQueryError, { error: catalogQuery.error ?? accessQuery.error, onRetry: () => {
|
|
154
|
+
void catalogQuery.refetch();
|
|
155
|
+
void accessQuery.refetch();
|
|
156
|
+
} })) : null, !catalogQuery.isError && isLoading && services.length === 0 && (_jsx("div", { className: "rounded-2xl border border-dashed px-6 py-12 text-center text-sm text-muted-foreground", children: "Discovering apps and credentials\u2026" })), !catalogQuery.isError && !isLoading && services.length === 0 && (_jsx("div", { className: "rounded-2xl border border-dashed px-6 py-12 text-center text-sm text-muted-foreground", children: "No apps with declared integrations are reachable yet." })), available.length > 0 && (_jsxs("section", { children: [_jsxs("div", { className: "mb-3 flex items-baseline justify-between", children: [_jsx("h2", { className: "text-sm font-medium text-foreground", children: "Available to connect" }), _jsx("span", { className: "text-xs text-muted-foreground", children: available.length })] }), _jsx("div", { className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-3", children: available.map((service) => (_jsx(ConnectorCard, { service: service, accessMode: accessMode }, service.key))) })] })), connected.length > 0 && (_jsxs("section", { children: [_jsxs("div", { className: "mb-3 mt-2 flex items-baseline justify-between", children: [_jsx("h2", { className: "text-sm font-medium text-foreground", children: "Connected" }), _jsx("span", { className: "text-xs text-muted-foreground", children: connected.length })] }), _jsx("div", { className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-3", children: connected.map((service) => (_jsx(ConnectorCard, { service: service, accessMode: accessMode }, service.key))) })] })), apps.length > 0 && (_jsxs(Collapsible, { className: "mt-6 rounded-2xl border bg-card", children: [_jsxs(CollapsibleTrigger, { className: "group flex w-full items-center justify-between px-4 py-3 text-sm", children: [_jsxs("span", { className: "flex items-center gap-2 text-muted-foreground", children: [_jsx(IconPlugConnected, { size: 14 }), "Per-app status"] }), _jsx(IconChevronRight, { size: 14, className: "text-muted-foreground transition group-data-[state=open]:rotate-90" })] }), _jsxs(CollapsibleContent, { children: [_jsx("div", { className: "border-t", children: apps.map((app) => (_jsx(PerAppDetailRow, { app: app }, app.appId))) }), _jsxs("div", { className: "flex items-center justify-end gap-1.5 border-t px-4 py-2.5 text-xs text-muted-foreground", children: [_jsx(IconLink, { size: 12 }), _jsx("a", { href: "/vault", className: "hover:underline", children: "Open vault for advanced sharing" })] })] })] }))] }));
|
|
151
157
|
}
|
|
152
158
|
//# sourceMappingURL=integrations.js.map
|