@agent-native/dispatch 0.16.7 → 0.17.1

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 (35) hide show
  1. package/dist/actions/provider-api-register.d.ts +12 -12
  2. package/dist/components/automation-run-history-dialog.d.ts +9 -0
  3. package/dist/components/automation-run-history-dialog.d.ts.map +1 -0
  4. package/dist/components/automation-run-history-dialog.js +61 -0
  5. package/dist/components/automation-run-history-dialog.js.map +1 -0
  6. package/dist/components/connected-app-card.d.ts +5 -0
  7. package/dist/components/connected-app-card.d.ts.map +1 -0
  8. package/dist/components/connected-app-card.js +12 -0
  9. package/dist/components/connected-app-card.js.map +1 -0
  10. package/dist/components/dispatch-control-plane.d.ts.map +1 -1
  11. package/dist/components/dispatch-control-plane.js +12 -4
  12. package/dist/components/dispatch-control-plane.js.map +1 -1
  13. package/dist/lib/automation-display.d.ts +2 -0
  14. package/dist/lib/automation-display.d.ts.map +1 -1
  15. package/dist/lib/automation-display.js +17 -3
  16. package/dist/lib/automation-display.js.map +1 -1
  17. package/dist/lib/automations.d.ts +3 -0
  18. package/dist/lib/automations.d.ts.map +1 -1
  19. package/dist/lib/automations.js.map +1 -1
  20. package/dist/routes/pages/apps.d.ts.map +1 -1
  21. package/dist/routes/pages/apps.js +3 -10
  22. package/dist/routes/pages/apps.js.map +1 -1
  23. package/dist/routes/pages/automations.d.ts.map +1 -1
  24. package/dist/routes/pages/automations.js +19 -13
  25. package/dist/routes/pages/automations.js.map +1 -1
  26. package/package.json +3 -3
  27. package/src/components/automation-run-history-dialog.tsx +242 -0
  28. package/src/components/connected-app-card.tsx +42 -0
  29. package/src/components/dispatch-control-plane.spec.tsx +79 -2
  30. package/src/components/dispatch-control-plane.tsx +38 -3
  31. package/src/lib/automation-display.spec.ts +40 -0
  32. package/src/lib/automation-display.ts +23 -3
  33. package/src/lib/automations.ts +3 -0
  34. package/src/routes/pages/apps.tsx +2 -39
  35. package/src/routes/pages/automations.tsx +41 -10
@@ -47,8 +47,10 @@ declare const _default: import("node_modules/@agent-native/core/dist").ActionDef
47
47
  notes?: string | undefined;
48
48
  scope?: "org" | "user" | undefined;
49
49
  }, {
50
- found?: undefined;
50
+ id?: undefined;
51
+ provider?: undefined;
51
52
  deleted?: undefined;
53
+ found?: undefined;
52
54
  providers: {
53
55
  id: string;
54
56
  label: string;
@@ -59,47 +61,45 @@ declare const _default: import("node_modules/@agent-native/core/dist").ActionDef
59
61
  updatedAt: number;
60
62
  }[];
61
63
  count: number;
62
- provider?: undefined;
63
64
  registered?: undefined;
64
- id?: undefined;
65
65
  label?: undefined;
66
66
  message?: undefined;
67
67
  } | {
68
+ count?: undefined;
69
+ id?: undefined;
68
70
  deleted?: undefined;
69
71
  providers?: undefined;
70
- count?: undefined;
71
72
  found: boolean;
72
73
  provider: import("node_modules/@agent-native/core/dist/provider-api").CustomProviderConfig;
73
74
  registered?: undefined;
74
- id?: undefined;
75
75
  label?: undefined;
76
76
  message?: undefined;
77
77
  } | {
78
- deleted?: undefined;
79
- providers?: undefined;
80
78
  count?: undefined;
81
79
  provider?: undefined;
80
+ deleted?: undefined;
81
+ providers?: undefined;
82
82
  found: boolean;
83
83
  id: string;
84
84
  registered?: undefined;
85
85
  label?: undefined;
86
86
  message?: undefined;
87
87
  } | {
88
- found?: undefined;
89
- providers?: undefined;
90
88
  count?: undefined;
91
89
  provider?: undefined;
90
+ found?: undefined;
91
+ providers?: undefined;
92
92
  deleted: boolean;
93
93
  id: string;
94
94
  registered?: undefined;
95
95
  label?: undefined;
96
96
  message?: undefined;
97
97
  } | {
98
- found?: undefined;
99
- deleted?: undefined;
100
- providers?: undefined;
101
98
  count?: undefined;
102
99
  provider?: undefined;
100
+ deleted?: undefined;
101
+ found?: undefined;
102
+ providers?: undefined;
103
103
  registered: boolean;
104
104
  id: string;
105
105
  label: string;
@@ -0,0 +1,9 @@
1
+ import type { DispatchAutomationItem } from "../lib/automations.js";
2
+ interface AutomationRunHistoryDialogProps {
3
+ automation: DispatchAutomationItem | null;
4
+ open: boolean;
5
+ onOpenChange: (open: boolean) => void;
6
+ }
7
+ export declare function AutomationRunHistoryDialog({ automation, open, onOpenChange, }: AutomationRunHistoryDialogProps): import("node_modules/@types/react").JSX.Element;
8
+ export {};
9
+ //# sourceMappingURL=automation-run-history-dialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"automation-run-history-dialog.d.ts","sourceRoot":"","sources":["../../src/components/automation-run-history-dialog.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAqBjE,UAAU,+BAA+B;IACvC,UAAU,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAC1C,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACvC;AAgCD,wBAAgB,0BAA0B,CAAC,EACzC,UAAU,EACV,IAAI,EACJ,YAAY,GACb,EAAE,+BAA+B,mDAuKjC"}
@@ -0,0 +1,61 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useActionQuery } from "@agent-native/core/client/hooks";
3
+ import { IconAlertTriangle, IconClock, IconExternalLink, IconLoader2, } from "@tabler/icons-react";
4
+ import { Link } from "react-router";
5
+ import { automationScopeLabel, automationTarget, } from "../lib/automation-display.js";
6
+ import { ActionQueryError } from "./action-query-error.js";
7
+ import { Badge } from "./ui/badge.js";
8
+ import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "./ui/dialog.js";
9
+ function runStatusVariant(status) {
10
+ if (status === "error")
11
+ return "destructive";
12
+ if (status === "success")
13
+ return "default";
14
+ return "outline";
15
+ }
16
+ function formatTimestamp(value) {
17
+ const date = new Date(value);
18
+ return Number.isNaN(date.getTime()) ? "Unknown time" : date.toLocaleString();
19
+ }
20
+ function formatDuration(run) {
21
+ if (!run.finishedAt)
22
+ return null;
23
+ const seconds = Math.max(0, Math.round((run.finishedAt - run.startedAt) / 1000));
24
+ return `${seconds}s`;
25
+ }
26
+ function runDebugPath(run) {
27
+ const params = new URLSearchParams();
28
+ if (run.runId)
29
+ params.set("runId", run.runId);
30
+ else if (run.threadId)
31
+ params.set("threadId", run.threadId);
32
+ else
33
+ return null;
34
+ return `/thread-debug?${params.toString()}`;
35
+ }
36
+ export function AutomationRunHistoryDialog({ automation, open, onOpenChange, }) {
37
+ const scope = automation?.scope === "organization" ||
38
+ automation?.owner.startsWith("__organization__:") ||
39
+ automation?.owner === "__shared__"
40
+ ? "organization"
41
+ : "personal";
42
+ const runsQuery = useActionQuery("list-automation-runs", {
43
+ name: automation?.name ?? "",
44
+ scope,
45
+ }, {
46
+ enabled: open && Boolean(automation),
47
+ staleTime: 5_000,
48
+ });
49
+ const runs = runsQuery.data ?? [];
50
+ return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { className: "max-h-[85vh] max-w-2xl overflow-y-auto", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: automation?.name ?? "Automation details" }), _jsx(DialogDescription, { children: automation
51
+ ? `${automationTarget(automation)} · ${automationScopeLabel(automation)}`
52
+ : "Execution history" })] }), automation ? (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "grid grid-cols-2 gap-x-4 gap-y-3 rounded-lg border bg-muted/20 p-3 text-sm", children: [_jsxs("div", { children: [_jsx("div", { className: "text-[11px] uppercase tracking-wide text-muted-foreground", children: "Status" }), _jsx("div", { className: "mt-1 font-medium", children: automation.lastStatus ??
53
+ (automation.enabled ? "ready" : "paused") })] }), _jsxs("div", { children: [_jsx("div", { className: "text-[11px] uppercase tracking-wide text-muted-foreground", children: "Last check" }), _jsx("div", { className: "mt-1 font-medium", children: automation.lastCheck
54
+ ? formatTimestamp(new Date(automation.lastCheck).getTime())
55
+ : "Not recorded" })] }), _jsxs("div", { children: [_jsx("div", { className: "text-[11px] uppercase tracking-wide text-muted-foreground", children: "Created by" }), _jsx("div", { className: "mt-1 break-words font-medium", children: automation.createdBy ?? "Unknown" })] }), _jsxs("div", { children: [_jsx("div", { className: "text-[11px] uppercase tracking-wide text-muted-foreground", children: "Timezone" }), _jsx("div", { className: "mt-1 font-medium", children: automation.timezone ?? "Account default" })] })] }), automation.lastError ? (_jsxs("div", { className: "flex items-start gap-2 rounded-lg border border-destructive/30 bg-destructive/5 p-3", children: [_jsx(IconAlertTriangle, { className: "mt-0.5 size-4 shrink-0 text-destructive" }), _jsxs("div", { className: "min-w-0", children: [_jsx("p", { className: "text-sm font-medium text-destructive", children: "Latest scheduler result" }), _jsx("p", { className: "mt-1 break-words text-sm text-muted-foreground", children: automation.lastError })] })] })) : null, _jsxs("div", { children: [_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsxs("div", { children: [_jsx("h3", { className: "text-sm font-semibold text-foreground", children: "Past runs" }), _jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: "Only executions that actually started appear here. Blocked or skipped scheduler checks are shown above, not as fake runs." })] }), runs.length > 0 ? (_jsxs(Badge, { variant: "outline", children: [runs.length, " shown"] })) : null] }), _jsx("div", { className: "mt-3", children: runsQuery.isLoading ? (_jsxs("div", { className: "flex items-center gap-2 rounded-lg border p-4 text-sm text-muted-foreground", children: [_jsx(IconLoader2, { className: "size-4 animate-spin" }), "Loading run history..."] })) : runsQuery.isError ? (_jsx(ActionQueryError, { error: runsQuery.error, onRetry: () => void runsQuery.refetch() })) : runs.length === 0 ? (_jsx("div", { className: "rounded-lg border border-dashed p-4 text-sm text-muted-foreground", children: "This automation has not recorded an execution yet. If it is enabled but shows no runs, inspect the latest scheduler result and last check above." })) : (_jsx("ul", { className: "divide-y rounded-lg border", children: runs.map((run) => {
56
+ const debugPath = runDebugPath(run);
57
+ const duration = formatDuration(run);
58
+ return (_jsxs("li", { className: "space-y-2 p-3", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2 text-sm", children: [_jsx(Badge, { variant: runStatusVariant(run.status), children: run.status }), _jsx("span", { className: "text-muted-foreground", children: formatTimestamp(run.startedAt) }), duration ? (_jsxs("span", { className: "inline-flex items-center gap-1 text-xs text-muted-foreground", children: [_jsx(IconClock, { className: "size-3.5" }), duration] })) : null, debugPath ? (_jsxs(Link, { to: debugPath, className: "ml-auto inline-flex items-center gap-1 text-xs font-medium text-foreground underline-offset-4 hover:underline", children: [_jsx(IconExternalLink, { className: "size-3.5" }), "Open debug"] })) : null] }), run.error ? (_jsx("p", { className: "break-words text-sm text-destructive", children: run.error })) : null] }, run.id));
59
+ }) })) })] })] })) : null] }) }));
60
+ }
61
+ //# sourceMappingURL=automation-run-history-dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"automation-run-history-dialog.js","sourceRoot":"","sources":["../../src/components/automation-run-history-dialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,WAAW,GACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EACL,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EACL,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,WAAW,GACZ,MAAM,aAAa,CAAC;AAkBrB,SAAS,gBAAgB,CACvB,MAA+B;IAE/B,IAAI,MAAM,KAAK,OAAO;QAAE,OAAO,aAAa,CAAC;IAC7C,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC3C,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,eAAe,CAAC,KAAa;IACpC,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CA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AAE;4CAChB,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;4CACpC,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;4CACrC,OAAO,CACL,cAAiB,SAAS,EAAC,eAAe,aACxC,eAAK,SAAS,EAAC,2CAA2C,aACxD,KAAC,KAAK,IAAC,OAAO,EAAE,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,YACzC,GAAG,CAAC,MAAM,GACL,EACR,eAAM,SAAS,EAAC,uBAAuB,YACpC,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,GAC1B,EACN,QAAQ,CAAC,CAAC,CAAC,CACV,gBAAM,SAAS,EAAC,8DAA8D,aAC5E,KAAC,SAAS,IAAC,SAAS,EAAC,UAAU,GAAG,EACjC,QAAQ,IACJ,CACR,CAAC,CAAC,CAAC,IAAI,EACP,SAAS,CAAC,CAAC,CAAC,CACX,MAAC,IAAI,IACH,EAAE,EAAE,SAAS,EACb,SAAS,EAAC,+GAA+G,aAEzH,KAAC,gBAAgB,IAAC,SAAS,EAAC,UAAU,GAAG,kBAEpC,CACR,CAAC,CAAC,CAAC,IAAI,IACJ,EACL,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CACX,YAAG,SAAS,EAAC,sCAAsC,YAChD,GAAG,CAAC,KAAK,GACR,CACL,CAAC,CAAC,CAAC,IAAI,KA5BD,GAAG,CAAC,EAAE,CA6BV,CACN,CAAC;wCACJ,CAAC,CAAC,GACC,CACN,GACG,IACF,IACF,CACP,CAAC,CAAC,CAAC,IAAI,IACM,GACT,CACV,CAAC;AACJ,CAAC","sourcesContent":["import { useActionQuery } from \"@agent-native/core/client/hooks\";\nimport {\n IconAlertTriangle,\n IconClock,\n IconExternalLink,\n IconLoader2,\n} from \"@tabler/icons-react\";\nimport { Link } from \"react-router\";\n\nimport {\n automationScopeLabel,\n automationTarget,\n} from \"../lib/automation-display\";\nimport type { DispatchAutomationItem } from \"../lib/automations\";\nimport { ActionQueryError } from \"./action-query-error\";\nimport { Badge } from \"./ui/badge\";\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from \"./ui/dialog\";\n\ninterface AutomationRun {\n id: string;\n runId: string | null;\n threadId: string | null;\n status: \"running\" | \"success\" | \"error\" | \"interrupted\";\n startedAt: number;\n finishedAt: number | null;\n error: string | null;\n}\n\ninterface AutomationRunHistoryDialogProps {\n automation: DispatchAutomationItem | null;\n open: boolean;\n onOpenChange: (open: boolean) => void;\n}\n\nfunction runStatusVariant(\n status: AutomationRun[\"status\"],\n): \"default\" | \"destructive\" | \"outline\" {\n if (status === \"error\") return \"destructive\";\n if (status === \"success\") return \"default\";\n return \"outline\";\n}\n\nfunction formatTimestamp(value: number): string {\n const date = new Date(value);\n return Number.isNaN(date.getTime()) ? \"Unknown time\" : date.toLocaleString();\n}\n\nfunction formatDuration(run: AutomationRun): string | null {\n if (!run.finishedAt) return null;\n const seconds = Math.max(\n 0,\n Math.round((run.finishedAt - run.startedAt) / 1000),\n );\n return `${seconds}s`;\n}\n\nfunction runDebugPath(run: AutomationRun): string | null {\n const params = new URLSearchParams();\n if (run.runId) params.set(\"runId\", run.runId);\n else if (run.threadId) params.set(\"threadId\", run.threadId);\n else return null;\n return `/thread-debug?${params.toString()}`;\n}\n\nexport function AutomationRunHistoryDialog({\n automation,\n open,\n onOpenChange,\n}: AutomationRunHistoryDialogProps) {\n const scope =\n automation?.scope === \"organization\" ||\n automation?.owner.startsWith(\"__organization__:\") ||\n automation?.owner === \"__shared__\"\n ? \"organization\"\n : \"personal\";\n const runsQuery = useActionQuery<AutomationRun[]>(\n \"list-automation-runs\",\n {\n name: automation?.name ?? \"\",\n scope,\n },\n {\n enabled: open && Boolean(automation),\n staleTime: 5_000,\n },\n );\n const runs = runsQuery.data ?? [];\n\n return (\n <Dialog open={open} onOpenChange={onOpenChange}>\n <DialogContent className=\"max-h-[85vh] max-w-2xl overflow-y-auto\">\n <DialogHeader>\n <DialogTitle>{automation?.name ?? \"Automation details\"}</DialogTitle>\n <DialogDescription>\n {automation\n ? `${automationTarget(automation)} · ${automationScopeLabel(automation)}`\n : \"Execution history\"}\n </DialogDescription>\n </DialogHeader>\n\n {automation ? (\n <div className=\"space-y-4\">\n <div className=\"grid grid-cols-2 gap-x-4 gap-y-3 rounded-lg border bg-muted/20 p-3 text-sm\">\n <div>\n <div className=\"text-[11px] uppercase tracking-wide text-muted-foreground\">\n Status\n </div>\n <div className=\"mt-1 font-medium\">\n {automation.lastStatus ??\n (automation.enabled ? \"ready\" : \"paused\")}\n </div>\n </div>\n <div>\n <div className=\"text-[11px] uppercase tracking-wide text-muted-foreground\">\n Last check\n </div>\n <div className=\"mt-1 font-medium\">\n {automation.lastCheck\n ? formatTimestamp(new Date(automation.lastCheck).getTime())\n : \"Not recorded\"}\n </div>\n </div>\n <div>\n <div className=\"text-[11px] uppercase tracking-wide text-muted-foreground\">\n Created by\n </div>\n <div className=\"mt-1 break-words font-medium\">\n {automation.createdBy ?? \"Unknown\"}\n </div>\n </div>\n <div>\n <div className=\"text-[11px] uppercase tracking-wide text-muted-foreground\">\n Timezone\n </div>\n <div className=\"mt-1 font-medium\">\n {automation.timezone ?? \"Account default\"}\n </div>\n </div>\n </div>\n\n {automation.lastError ? (\n <div className=\"flex items-start gap-2 rounded-lg border border-destructive/30 bg-destructive/5 p-3\">\n <IconAlertTriangle className=\"mt-0.5 size-4 shrink-0 text-destructive\" />\n <div className=\"min-w-0\">\n <p className=\"text-sm font-medium text-destructive\">\n Latest scheduler result\n </p>\n <p className=\"mt-1 break-words text-sm text-muted-foreground\">\n {automation.lastError}\n </p>\n </div>\n </div>\n ) : null}\n\n <div>\n <div className=\"flex items-center justify-between gap-3\">\n <div>\n <h3 className=\"text-sm font-semibold text-foreground\">\n Past runs\n </h3>\n <p className=\"mt-1 text-xs text-muted-foreground\">\n Only executions that actually started appear here. Blocked\n or skipped scheduler checks are shown above, not as fake\n runs.\n </p>\n </div>\n {runs.length > 0 ? (\n <Badge variant=\"outline\">{runs.length} shown</Badge>\n ) : null}\n </div>\n\n <div className=\"mt-3\">\n {runsQuery.isLoading ? (\n <div className=\"flex items-center gap-2 rounded-lg border p-4 text-sm text-muted-foreground\">\n <IconLoader2 className=\"size-4 animate-spin\" />\n Loading run history...\n </div>\n ) : runsQuery.isError ? (\n <ActionQueryError\n error={runsQuery.error}\n onRetry={() => void runsQuery.refetch()}\n />\n ) : runs.length === 0 ? (\n <div className=\"rounded-lg border border-dashed p-4 text-sm text-muted-foreground\">\n This automation has not recorded an execution yet. If it is\n enabled but shows no runs, inspect the latest scheduler\n result and last check above.\n </div>\n ) : (\n <ul className=\"divide-y rounded-lg border\">\n {runs.map((run) => {\n const debugPath = runDebugPath(run);\n const duration = formatDuration(run);\n return (\n <li key={run.id} className=\"space-y-2 p-3\">\n <div className=\"flex flex-wrap items-center gap-2 text-sm\">\n <Badge variant={runStatusVariant(run.status)}>\n {run.status}\n </Badge>\n <span className=\"text-muted-foreground\">\n {formatTimestamp(run.startedAt)}\n </span>\n {duration ? (\n <span className=\"inline-flex items-center gap-1 text-xs text-muted-foreground\">\n <IconClock className=\"size-3.5\" />\n {duration}\n </span>\n ) : null}\n {debugPath ? (\n <Link\n to={debugPath}\n className=\"ml-auto inline-flex items-center gap-1 text-xs font-medium text-foreground underline-offset-4 hover:underline\"\n >\n <IconExternalLink className=\"size-3.5\" />\n Open debug\n </Link>\n ) : null}\n </div>\n {run.error ? (\n <p className=\"break-words text-sm text-destructive\">\n {run.error}\n </p>\n ) : null}\n </li>\n );\n })}\n </ul>\n )}\n </div>\n </div>\n </div>\n ) : null}\n </DialogContent>\n </Dialog>\n );\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import type { ConnectedAppSummary } from "../lib/other-apps.js";
2
+ export declare function ConnectedAppCard({ app }: {
3
+ app: ConnectedAppSummary;
4
+ }): import("node_modules/@types/react").JSX.Element;
5
+ //# sourceMappingURL=connected-app-card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connected-app-card.d.ts","sourceRoot":"","sources":["../../src/components/connected-app-card.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,wBAAgB,gBAAgB,CAAC,EAAE,GAAG,EAAE,EAAE;IAAE,GAAG,EAAE,mBAAmB,CAAA;CAAE,mDAmCrE"}
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useT } from "@agent-native/core/client/i18n";
3
+ import { withBuilderUtmTrackingParams } from "@agent-native/core/shared/builder-link-tracking";
4
+ import { IconArrowUpRight } from "@tabler/icons-react";
5
+ export function ConnectedAppCard({ app }) {
6
+ const t = useT();
7
+ return (_jsxs("a", { href: withBuilderUtmTrackingParams(app.url, {
8
+ campaign: "product",
9
+ content: "dispatch_app",
10
+ }), target: "_blank", rel: "noopener noreferrer", className: "group flex min-h-[116px] items-start gap-3 rounded-xl bg-card/40 p-4 transition-[background-color] hover:bg-accent/15 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: [_jsx("span", { className: "flex size-8 shrink-0 items-center justify-center rounded-md bg-muted text-xs font-semibold text-muted-foreground", children: app.name.charAt(0).toUpperCase() }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsxs("span", { className: "flex items-start justify-between gap-3", children: [_jsx("span", { className: "truncate text-sm font-semibold text-foreground", children: app.name }), _jsx(IconArrowUpRight, { size: 15, className: "shrink-0 text-muted-foreground transition-transform group-hover:-translate-y-0.5 group-hover:translate-x-0.5" })] }), _jsx("span", { className: "mt-2 line-clamp-2 block text-[13px] leading-5 text-muted-foreground", children: app.description || app.url }), _jsx("span", { className: "mt-3 block text-xs font-medium text-foreground", children: t("dispatch.pages.openApp") })] })] }));
11
+ }
12
+ //# sourceMappingURL=connected-app-card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connected-app-card.js","sourceRoot":"","sources":["../../src/components/connected-app-card.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,iDAAiD,CAAC;AAC/F,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIvD,MAAM,UAAU,gBAAgB,CAAC,EAAE,GAAG,EAAgC;IACpE,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC;IAEjB,OAAO,CACL,aACE,IAAI,EAAE,4BAA4B,CAAC,GAAG,CAAC,GAAG,EAAE;YAC1C,QAAQ,EAAE,SAAS;YACnB,OAAO,EAAE,cAAc;SACxB,CAAC,EACF,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,EACzB,SAAS,EAAC,+LAA+L,aAEzM,eAAM,SAAS,EAAC,kHAAkH,YAC/H,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAC5B,EACP,gBAAM,SAAS,EAAC,gBAAgB,aAC9B,gBAAM,SAAS,EAAC,wCAAwC,aACtD,eAAM,SAAS,EAAC,gDAAgD,YAC7D,GAAG,CAAC,IAAI,GACJ,EACP,KAAC,gBAAgB,IACf,IAAI,EAAE,EAAE,EACR,SAAS,EAAC,8GAA8G,GACxH,IACG,EACP,eAAM,SAAS,EAAC,qEAAqE,YAClF,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,GAAG,GACtB,EACP,eAAM,SAAS,EAAC,gDAAgD,YAC7D,CAAC,CAAC,wBAAwB,CAAC,GACvB,IACF,IACL,CACL,CAAC;AACJ,CAAC","sourcesContent":["import { useT } from \"@agent-native/core/client/i18n\";\nimport { withBuilderUtmTrackingParams } from \"@agent-native/core/shared/builder-link-tracking\";\nimport { IconArrowUpRight } from \"@tabler/icons-react\";\n\nimport type { ConnectedAppSummary } from \"../lib/other-apps\";\n\nexport function ConnectedAppCard({ app }: { app: ConnectedAppSummary }) {\n const t = useT();\n\n return (\n <a\n href={withBuilderUtmTrackingParams(app.url, {\n campaign: \"product\",\n content: \"dispatch_app\",\n })}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"group flex min-h-[116px] items-start gap-3 rounded-xl bg-card/40 p-4 transition-[background-color] hover:bg-accent/15 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <span className=\"flex size-8 shrink-0 items-center justify-center rounded-md bg-muted text-xs font-semibold text-muted-foreground\">\n {app.name.charAt(0).toUpperCase()}\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"flex items-start justify-between gap-3\">\n <span className=\"truncate text-sm font-semibold text-foreground\">\n {app.name}\n </span>\n <IconArrowUpRight\n size={15}\n className=\"shrink-0 text-muted-foreground transition-transform group-hover:-translate-y-0.5 group-hover:translate-x-0.5\"\n />\n </span>\n <span className=\"mt-2 line-clamp-2 block text-[13px] leading-5 text-muted-foreground\">\n {app.description || app.url}\n </span>\n <span className=\"mt-3 block text-xs font-medium text-foreground\">\n {t(\"dispatch.pages.openApp\")}\n </span>\n </span>\n </a>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"dispatch-control-plane.d.ts","sourceRoot":"","sources":["../../src/components/dispatch-control-plane.tsx"],"names":[],"mappings":"AAkPA,wBAAgB,oBAAoB,oDAqBnC"}
1
+ {"version":3,"file":"dispatch-control-plane.d.ts","sourceRoot":"","sources":["../../src/components/dispatch-control-plane.tsx"],"names":[],"mappings":"AAsQA,wBAAgB,oBAAoB,oDAoCnC"}
@@ -7,8 +7,10 @@ import { useT } from "@agent-native/core/client/i18n";
7
7
  import { IconArrowUpRight, IconChevronDown, IconClockHour4, } from "@tabler/icons-react";
8
8
  import { useState } from "react";
9
9
  import { Link, useNavigate } from "react-router";
10
+ import { filterOtherApps } from "../lib/other-apps.js";
10
11
  import { submitOverviewPrompt } from "../lib/overview-chat.js";
11
12
  import { ActionQueryError } from "./action-query-error.js";
13
+ import { ConnectedAppCard } from "./connected-app-card.js";
12
14
  import { CreateAppPopover } from "./create-app-popover.js";
13
15
  import { useSetPageTitle } from "./layout/HeaderActions.js";
14
16
  import { Button } from "./ui/button.js";
@@ -61,14 +63,18 @@ function CommandPanel() {
61
63
  defaultValue: "Ask Dispatch anything...",
62
64
  }), selectedEffort: selectedEffort, selectedEngine: selectedEngine, selectedModel: selectedModel, onEffortChange: onEffortChange, onModelChange: onModelChange, onSubmit: (text) => send(text) }), _jsx("div", { className: "mt-3 flex flex-wrap justify-center gap-2", children: promptSuggestions.map((suggestion) => (_jsx("button", { type: "button", onClick: () => send(suggestion), className: "cursor-pointer rounded-md border border-transparent bg-muted/60 px-2.5 py-1.5 text-xs text-muted-foreground transition-[background-color,color] hover:bg-muted hover:text-foreground", children: suggestion }, suggestion))) })] }) }));
63
65
  }
64
- function AppsPanel({ apps, isLoading, }) {
66
+ function AppsPanel({ apps, isLoading, otherApps, otherAppsError, otherAppsLoading, onRetryOtherApps, }) {
65
67
  const t = useT();
66
68
  const [showPending, setShowPending] = useState(false);
67
69
  const visibleApps = apps.filter((app) => !app.isDispatch && !app.archived);
68
70
  const activeApps = visibleApps.filter((app) => app.status !== "pending");
69
71
  const pendingApps = visibleApps.filter((app) => app.status === "pending");
70
- const showSkeletons = isLoading && activeApps.length === 0 && pendingApps.length === 0;
71
- return (_jsxs("section", { className: "flex flex-col gap-3", children: [_jsx(SectionHeader, { title: "Apps", action: _jsx(Button, { variant: "outline", size: "sm", asChild: true, children: _jsxs(Link, { to: "/apps", children: ["View all", _jsx(IconArrowUpRight, { size: 14 })] }) }) }), showSkeletons ? (_jsx("div", { className: "grid gap-3 md:grid-cols-2", children: Array.from({ length: 4 }).map((_, index) => (_jsxs("div", { className: "rounded-xl bg-card/40 p-4", children: [_jsx(Skeleton, { className: "h-4 w-32" }), _jsx(Skeleton, { className: "mt-3 h-3 w-24" }), _jsx(Skeleton, { className: "mt-3 h-3 w-full" })] }, index))) })) : activeApps.length > 0 ? (_jsx("div", { className: "grid gap-3 md:grid-cols-2", children: activeApps.map((app) => (_jsx(WorkspaceAppCard, { app: app, className: "min-h-32" }, app.id))) })) : (_jsx(CreateAppPopover, {})), pendingApps.length > 0 ? (_jsx(Collapsible, { open: showPending, onOpenChange: setShowPending, children: _jsxs("div", { className: "space-y-3 border-t pt-3", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx(IconClockHour4, { size: 15, className: "shrink-0 text-muted-foreground" }), _jsxs("div", { className: "min-w-0", children: [_jsx("h3", { className: "text-xs font-semibold text-foreground", children: t("dispatch.pages.pendingApps") }), _jsx("p", { className: "text-xs text-muted-foreground", children: t("dispatch.pages.pendingAppsDescription", {
72
+ const hasActiveApps = activeApps.length > 0 || otherApps.length > 0;
73
+ const showSkeletons = (isLoading || otherAppsLoading) &&
74
+ activeApps.length === 0 &&
75
+ otherApps.length === 0 &&
76
+ pendingApps.length === 0;
77
+ return (_jsxs("section", { className: "flex flex-col gap-3", children: [_jsx(SectionHeader, { title: "Apps", action: _jsx(Button, { variant: "outline", size: "sm", asChild: true, children: _jsxs(Link, { to: "/apps", children: ["View all", _jsx(IconArrowUpRight, { size: 14 })] }) }) }), showSkeletons ? (_jsx("div", { className: "grid gap-3 md:grid-cols-2", children: Array.from({ length: 4 }).map((_, index) => (_jsxs("div", { className: "rounded-xl bg-card/40 p-4", children: [_jsx(Skeleton, { className: "h-4 w-32" }), _jsx(Skeleton, { className: "mt-3 h-3 w-24" }), _jsx(Skeleton, { className: "mt-3 h-3 w-full" })] }, index))) })) : hasActiveApps ? (_jsxs("div", { className: "grid gap-3 md:grid-cols-2", children: [activeApps.map((app) => (_jsx(WorkspaceAppCard, { app: app, className: "min-h-32" }, app.id))), otherApps.map((app) => (_jsx(ConnectedAppCard, { app: app }, app.id)))] })) : (_jsx(CreateAppPopover, {})), otherAppsError ? (_jsx(ActionQueryError, { error: otherAppsError, onRetry: onRetryOtherApps })) : null, pendingApps.length > 0 ? (_jsx(Collapsible, { open: showPending, onOpenChange: setShowPending, children: _jsxs("div", { className: "space-y-3 border-t pt-3", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx(IconClockHour4, { size: 15, className: "shrink-0 text-muted-foreground" }), _jsxs("div", { className: "min-w-0", children: [_jsx("h3", { className: "text-xs font-semibold text-foreground", children: t("dispatch.pages.pendingApps") }), _jsx("p", { className: "text-xs text-muted-foreground", children: t("dispatch.pages.pendingAppsDescription", {
72
78
  count: pendingApps.length,
73
79
  }) })] })] }), _jsx(CollapsibleTrigger, { asChild: true, children: _jsxs(Button, { type: "button", variant: "ghost", size: "sm", className: "h-7 gap-1.5 px-2 text-xs", children: [showPending
74
80
  ? t("dispatch.pages.hidePendingApps")
@@ -77,7 +83,9 @@ function AppsPanel({ apps, isLoading, }) {
77
83
  export function DispatchControlPlane() {
78
84
  useSetPageTitle(_jsx("span", { "aria-hidden": true }));
79
85
  const appsQuery = useActionQuery("list-workspace-apps", { includeAgentCards: false, includeArchived: true });
86
+ const connectedAppsQuery = useActionQuery("list-connected-agents", {});
80
87
  const { data: workspaceApps = [], isLoading: appsLoading } = appsQuery;
81
- return (_jsxs("div", { className: "flex flex-col gap-8", children: [_jsx(CommandPanel, {}), appsQuery.isError ? (_jsx(ActionQueryError, { error: appsQuery.error, onRetry: () => void appsQuery.refetch() })) : (_jsx(AppsPanel, { apps: workspaceApps ?? [], isLoading: appsLoading }))] }));
88
+ const otherApps = filterOtherApps(connectedAppsQuery.data ?? [], workspaceApps ?? []);
89
+ return (_jsxs("div", { className: "flex flex-col gap-8", children: [_jsx(CommandPanel, {}), appsQuery.isError ? (_jsx(ActionQueryError, { error: appsQuery.error, onRetry: () => void appsQuery.refetch() })) : (_jsx(AppsPanel, { apps: workspaceApps ?? [], isLoading: appsLoading, otherApps: otherApps, otherAppsError: connectedAppsQuery.error, otherAppsLoading: connectedAppsQuery.isLoading, onRetryOtherApps: () => void connectedAppsQuery.refetch() }))] }));
82
90
  }
83
91
  //# sourceMappingURL=dispatch-control-plane.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dispatch-control-plane.js","sourceRoot":"","sources":["../../src/components/dispatch-control-plane.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,mCAAmC,EACnC,aAAa,GACd,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,cAAc,GACf,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,SAAS,aAAa,CAAC,EACrB,KAAK,EACL,MAAM,GAIP;IACC,OAAO,CACL,eAAK,SAAS,EAAC,iDAAiD,aAC9D,aAAI,SAAS,EAAC,gDAAgD,YAC3D,KAAK,GACH,EACJ,MAAM,CAAC,CAAC,C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gB,IAEf,GAAG,EAAE,GAAG,EACR,SAAS,EAAC,UAAU,IAFf,GAAG,CAAC,EAAE,CAGX,CACH,CAAC,GACE,GACa,IACjB,GACM,CACf,CAAC,CAAC,CAAC,IAAI,IACA,CACX,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oBAAoB;IAClC,eAAe,CAAC,qCAAoB,CAAC,CAAC;IACtC,MAAM,SAAS,GAAG,cAAc,CAC9B,qBAAqB,EACrB,EAAE,iBAAiB,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,CACpD,CAAC;IACF,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC;IAEvE,OAAO,CACL,eAAK,SAAS,EAAC,qBAAqB,aAClC,KAAC,YAAY,KAAG,EACf,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CACnB,KAAC,gBAAgB,IACf,KAAK,EAAE,SAAS,CAAC,KAAK,EACtB,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,SAAS,CAAC,OAAO,EAAE,GACvC,CACH,CAAC,CAAC,CAAC,CACF,KAAC,SAAS,IAAC,IAAI,EAAE,aAAa,IAAI,EAAE,EAAE,SAAS,EAAE,WAAW,GAAI,CACjE,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["import {\n navigateWithAgentChatViewTransition,\n useChatModels,\n} from \"@agent-native/core/client/agent-chat\";\nimport { PromptComposer } from \"@agent-native/core/client/composer\";\nimport { useActionQuery } from \"@agent-native/core/client/hooks\";\nimport { isInBuilderFrame } from \"@agent-native/core/client/host\";\nimport { useT } from \"@agent-native/core/client/i18n\";\nimport {\n IconArrowUpRight,\n IconChevronDown,\n IconClockHour4,\n} from \"@tabler/icons-react\";\nimport type { ReactNode } from \"react\";\nimport { useState } from \"react\";\nimport { Link, useNavigate } from \"react-router\";\n\nimport { submitOverviewPrompt } from \"../lib/overview-chat\";\nimport type { WorkspaceAppSummary } from \"../lib/workspace-apps\";\nimport { ActionQueryError } from \"./action-query-error\";\nimport { CreateAppPopover } from \"./create-app-popover\";\nimport { useSetPageTitle } from \"./layout/HeaderActions\";\nimport { Button } from \"./ui/button\";\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from \"./ui/collapsible\";\nimport { Skeleton } from \"./ui/skeleton\";\nimport { WorkspaceAppCard } from \"./workspace-app-card\";\n\nfunction SectionHeader({\n title,\n action,\n}: {\n title: string;\n action?: ReactNode;\n}) {\n return (\n <div className=\"flex min-w-0 items-center justify-between gap-3\">\n <h2 className=\"truncate text-sm font-semibold text-foreground\">\n {title}\n </h2>\n {action ? <div className=\"shrink-0\">{action}</div> : null}\n </div>\n );\n}\n\nfunction CommandPanel() {\n const t = useT();\n const {\n availableModels,\n isLoading: modelListLoading,\n onEffortChange,\n onModelChange,\n selectedEffort,\n selectedEngine,\n selectedModel,\n } = useChatModels({ storageKey: \"dispatch\" });\n const navigate = useNavigate();\n const promptSuggestions = [\n t(\"dispatch.pages.suggestionWorkspaceHealth\", {\n defaultValue: \"Summarize the current workspace health\",\n }),\n t(\"dispatch.pages.suggestionOnboardingApp\", {\n defaultValue: \"Create an app for onboarding requests\",\n }),\n t(\"dispatch.pages.suggestionAnalyticsAgents\", {\n defaultValue: \"Check which agents can help with analytics\",\n }),\n ];\n\n function send(message: string) {\n const trimmed = message.trim();\n if (!trimmed) return;\n\n if (isInBuilderFrame()) {\n submitOverviewPrompt(trimmed, selectedModel);\n return;\n }\n\n navigateWithAgentChatViewTransition(navigate, \"/chat\", {\n state: {\n dispatchPrompt: {\n id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,\n message: trimmed,\n selectedModel,\n selectedEngine,\n selectedEffort,\n },\n },\n });\n }\n\n return (\n <section className=\"flex flex-col\">\n <div className=\"mx-auto flex w-full max-w-3xl flex-col pt-4 sm:pt-6\">\n <div className=\"mb-5 text-center\">\n <h2 className=\"text-2xl font-semibold tracking-tight text-foreground sm:text-3xl\">\n {t(\"dispatch.pages.chatAcrossApps\", {\n defaultValue: \"Chat across your apps\",\n })}\n </h2>\n <p className=\"mx-auto mt-2 max-w-xl text-sm leading-6 text-muted-foreground\">\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 <PromptComposer\n availableModels={availableModels}\n modelListLoading={modelListLoading}\n placeholder={t(\"dispatch.pages.overviewPromptPlaceholder\", {\n defaultValue: \"Ask Dispatch anything...\",\n })}\n selectedEffort={selectedEffort}\n selectedEngine={selectedEngine}\n selectedModel={selectedModel}\n onEffortChange={onEffortChange}\n onModelChange={onModelChange}\n onSubmit={(text) => send(text)}\n />\n <div className=\"mt-3 flex flex-wrap justify-center gap-2\">\n {promptSuggestions.map((suggestion) => (\n <button\n key={suggestion}\n type=\"button\"\n onClick={() => send(suggestion)}\n className=\"cursor-pointer rounded-md border border-transparent bg-muted/60 px-2.5 py-1.5 text-xs text-muted-foreground transition-[background-color,color] hover:bg-muted hover:text-foreground\"\n >\n {suggestion}\n </button>\n ))}\n </div>\n </div>\n </section>\n );\n}\n\nfunction AppsPanel({\n apps,\n isLoading,\n}: {\n apps: WorkspaceAppSummary[];\n isLoading: boolean;\n}) {\n const t = useT();\n const [showPending, setShowPending] = useState(false);\n const visibleApps = apps.filter((app) => !app.isDispatch && !app.archived);\n const activeApps = visibleApps.filter((app) => app.status !== \"pending\");\n const pendingApps = visibleApps.filter((app) => app.status === \"pending\");\n const showSkeletons =\n isLoading && activeApps.length === 0 && pendingApps.length === 0;\n\n return (\n <section className=\"flex flex-col gap-3\">\n <SectionHeader\n title=\"Apps\"\n action={\n <Button variant=\"outline\" size=\"sm\" asChild>\n <Link to=\"/apps\">\n View all\n <IconArrowUpRight size={14} />\n </Link>\n </Button>\n }\n />\n {showSkeletons ? (\n <div className=\"grid gap-3 md:grid-cols-2\">\n {Array.from({ length: 4 }).map((_, index) => (\n <div key={index} className=\"rounded-xl bg-card/40 p-4\">\n <Skeleton className=\"h-4 w-32\" />\n <Skeleton className=\"mt-3 h-3 w-24\" />\n <Skeleton className=\"mt-3 h-3 w-full\" />\n </div>\n ))}\n </div>\n ) : activeApps.length > 0 ? (\n <div className=\"grid gap-3 md:grid-cols-2\">\n {activeApps.map((app) => (\n <WorkspaceAppCard key={app.id} app={app} className=\"min-h-32\" />\n ))}\n </div>\n ) : (\n <CreateAppPopover />\n )}\n {pendingApps.length > 0 ? (\n <Collapsible open={showPending} onOpenChange={setShowPending}>\n <div className=\"space-y-3 border-t pt-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div className=\"flex min-w-0 items-center gap-2\">\n <IconClockHour4\n size={15}\n className=\"shrink-0 text-muted-foreground\"\n />\n <div className=\"min-w-0\">\n <h3 className=\"text-xs font-semibold text-foreground\">\n {t(\"dispatch.pages.pendingApps\")}\n </h3>\n <p className=\"text-xs text-muted-foreground\">\n {t(\"dispatch.pages.pendingAppsDescription\", {\n count: pendingApps.length,\n })}\n </p>\n </div>\n </div>\n <CollapsibleTrigger asChild>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-7 gap-1.5 px-2 text-xs\"\n >\n {showPending\n ? t(\"dispatch.pages.hidePendingApps\")\n : t(\"dispatch.pages.showPendingApps\")}\n <IconChevronDown\n size={13}\n className={showPending ? \"rotate-180\" : undefined}\n />\n </Button>\n </CollapsibleTrigger>\n </div>\n <CollapsibleContent>\n <div className=\"grid gap-3 md:grid-cols-2\">\n {pendingApps.map((app) => (\n <WorkspaceAppCard\n key={app.id}\n app={app}\n className=\"min-h-32\"\n />\n ))}\n </div>\n </CollapsibleContent>\n </div>\n </Collapsible>\n ) : null}\n </section>\n );\n}\n\nexport function DispatchControlPlane() {\n useSetPageTitle(<span aria-hidden />);\n const appsQuery = useActionQuery<WorkspaceAppSummary[]>(\n \"list-workspace-apps\",\n { includeAgentCards: false, includeArchived: true },\n );\n const { data: workspaceApps = [], isLoading: appsLoading } = appsQuery;\n\n return (\n <div className=\"flex flex-col gap-8\">\n <CommandPanel />\n {appsQuery.isError ? (\n <ActionQueryError\n error={appsQuery.error}\n onRetry={() => void appsQuery.refetch()}\n />\n ) : (\n <AppsPanel apps={workspaceApps ?? []} isLoading={appsLoading} />\n )}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"dispatch-control-plane.js","sourceRoot":"","sources":["../../src/components/dispatch-control-plane.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,mCAAmC,EACnC,aAAa,GACd,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,cAAc,GACf,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,eAAe,EAA4B,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC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AG,eAAe,CAC/B,kBAAkB,CAAC,IAAI,IAAI,EAAE,EAC7B,aAAa,IAAI,EAAE,CACpB,CAAC;IAEF,OAAO,CACL,eAAK,SAAS,EAAC,qBAAqB,aAClC,KAAC,YAAY,KAAG,EACf,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CACnB,KAAC,gBAAgB,IACf,KAAK,EAAE,SAAS,CAAC,KAAK,EACtB,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,SAAS,CAAC,OAAO,EAAE,GACvC,CACH,CAAC,CAAC,CAAC,CACF,KAAC,SAAS,IACR,IAAI,EAAE,aAAa,IAAI,EAAE,EACzB,SAAS,EAAE,WAAW,EACtB,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,kBAAkB,CAAC,KAAK,EACxC,gBAAgB,EAAE,kBAAkB,CAAC,SAAS,EAC9C,gBAAgB,EAAE,GAAG,EAAE,CAAC,KAAK,kBAAkB,CAAC,OAAO,EAAE,GACzD,CACH,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["import {\n navigateWithAgentChatViewTransition,\n useChatModels,\n} from \"@agent-native/core/client/agent-chat\";\nimport { PromptComposer } from \"@agent-native/core/client/composer\";\nimport { useActionQuery } from \"@agent-native/core/client/hooks\";\nimport { isInBuilderFrame } from \"@agent-native/core/client/host\";\nimport { useT } from \"@agent-native/core/client/i18n\";\nimport {\n IconArrowUpRight,\n IconChevronDown,\n IconClockHour4,\n} from \"@tabler/icons-react\";\nimport type { ReactNode } from \"react\";\nimport { useState } from \"react\";\nimport { Link, useNavigate } from \"react-router\";\n\nimport { filterOtherApps, type ConnectedAppSummary } from \"../lib/other-apps\";\nimport { submitOverviewPrompt } from \"../lib/overview-chat\";\nimport type { WorkspaceAppSummary } from \"../lib/workspace-apps\";\nimport { ActionQueryError } from \"./action-query-error\";\nimport { ConnectedAppCard } from \"./connected-app-card\";\nimport { CreateAppPopover } from \"./create-app-popover\";\nimport { useSetPageTitle } from \"./layout/HeaderActions\";\nimport { Button } from \"./ui/button\";\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from \"./ui/collapsible\";\nimport { Skeleton } from \"./ui/skeleton\";\nimport { WorkspaceAppCard } from \"./workspace-app-card\";\n\nfunction SectionHeader({\n title,\n action,\n}: {\n title: string;\n action?: ReactNode;\n}) {\n return (\n <div className=\"flex min-w-0 items-center justify-between gap-3\">\n <h2 className=\"truncate text-sm font-semibold text-foreground\">\n {title}\n </h2>\n {action ? <div className=\"shrink-0\">{action}</div> : null}\n </div>\n );\n}\n\nfunction CommandPanel() {\n const t = useT();\n const {\n availableModels,\n isLoading: modelListLoading,\n onEffortChange,\n onModelChange,\n selectedEffort,\n selectedEngine,\n selectedModel,\n } = useChatModels({ storageKey: \"dispatch\" });\n const navigate = useNavigate();\n const promptSuggestions = [\n t(\"dispatch.pages.suggestionWorkspaceHealth\", {\n defaultValue: \"Summarize the current workspace health\",\n }),\n t(\"dispatch.pages.suggestionOnboardingApp\", {\n defaultValue: \"Create an app for onboarding requests\",\n }),\n t(\"dispatch.pages.suggestionAnalyticsAgents\", {\n defaultValue: \"Check which agents can help with analytics\",\n }),\n ];\n\n function send(message: string) {\n const trimmed = message.trim();\n if (!trimmed) return;\n\n if (isInBuilderFrame()) {\n submitOverviewPrompt(trimmed, selectedModel);\n return;\n }\n\n navigateWithAgentChatViewTransition(navigate, \"/chat\", {\n state: {\n dispatchPrompt: {\n id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,\n message: trimmed,\n selectedModel,\n selectedEngine,\n selectedEffort,\n },\n },\n });\n }\n\n return (\n <section className=\"flex flex-col\">\n <div className=\"mx-auto flex w-full max-w-3xl flex-col pt-4 sm:pt-6\">\n <div className=\"mb-5 text-center\">\n <h2 className=\"text-2xl font-semibold tracking-tight text-foreground sm:text-3xl\">\n {t(\"dispatch.pages.chatAcrossApps\", {\n defaultValue: \"Chat across your apps\",\n })}\n </h2>\n <p className=\"mx-auto mt-2 max-w-xl text-sm leading-6 text-muted-foreground\">\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 <PromptComposer\n availableModels={availableModels}\n modelListLoading={modelListLoading}\n placeholder={t(\"dispatch.pages.overviewPromptPlaceholder\", {\n defaultValue: \"Ask Dispatch anything...\",\n })}\n selectedEffort={selectedEffort}\n selectedEngine={selectedEngine}\n selectedModel={selectedModel}\n onEffortChange={onEffortChange}\n onModelChange={onModelChange}\n onSubmit={(text) => send(text)}\n />\n <div className=\"mt-3 flex flex-wrap justify-center gap-2\">\n {promptSuggestions.map((suggestion) => (\n <button\n key={suggestion}\n type=\"button\"\n onClick={() => send(suggestion)}\n className=\"cursor-pointer rounded-md border border-transparent bg-muted/60 px-2.5 py-1.5 text-xs text-muted-foreground transition-[background-color,color] hover:bg-muted hover:text-foreground\"\n >\n {suggestion}\n </button>\n ))}\n </div>\n </div>\n </section>\n );\n}\n\nfunction AppsPanel({\n apps,\n isLoading,\n otherApps,\n otherAppsError,\n otherAppsLoading,\n onRetryOtherApps,\n}: {\n apps: WorkspaceAppSummary[];\n isLoading: boolean;\n otherApps: ConnectedAppSummary[];\n otherAppsError?: Error | null;\n otherAppsLoading: boolean;\n onRetryOtherApps: () => void;\n}) {\n const t = useT();\n const [showPending, setShowPending] = useState(false);\n const visibleApps = apps.filter((app) => !app.isDispatch && !app.archived);\n const activeApps = visibleApps.filter((app) => app.status !== \"pending\");\n const pendingApps = visibleApps.filter((app) => app.status === \"pending\");\n const hasActiveApps = activeApps.length > 0 || otherApps.length > 0;\n const showSkeletons =\n (isLoading || otherAppsLoading) &&\n activeApps.length === 0 &&\n otherApps.length === 0 &&\n pendingApps.length === 0;\n\n return (\n <section className=\"flex flex-col gap-3\">\n <SectionHeader\n title=\"Apps\"\n action={\n <Button variant=\"outline\" size=\"sm\" asChild>\n <Link to=\"/apps\">\n View all\n <IconArrowUpRight size={14} />\n </Link>\n </Button>\n }\n />\n {showSkeletons ? (\n <div className=\"grid gap-3 md:grid-cols-2\">\n {Array.from({ length: 4 }).map((_, index) => (\n <div key={index} className=\"rounded-xl bg-card/40 p-4\">\n <Skeleton className=\"h-4 w-32\" />\n <Skeleton className=\"mt-3 h-3 w-24\" />\n <Skeleton className=\"mt-3 h-3 w-full\" />\n </div>\n ))}\n </div>\n ) : hasActiveApps ? (\n <div className=\"grid gap-3 md:grid-cols-2\">\n {activeApps.map((app) => (\n <WorkspaceAppCard key={app.id} app={app} className=\"min-h-32\" />\n ))}\n {otherApps.map((app) => (\n <ConnectedAppCard key={app.id} app={app} />\n ))}\n </div>\n ) : (\n <CreateAppPopover />\n )}\n {otherAppsError ? (\n <ActionQueryError error={otherAppsError} onRetry={onRetryOtherApps} />\n ) : null}\n {pendingApps.length > 0 ? (\n <Collapsible open={showPending} onOpenChange={setShowPending}>\n <div className=\"space-y-3 border-t pt-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div className=\"flex min-w-0 items-center gap-2\">\n <IconClockHour4\n size={15}\n className=\"shrink-0 text-muted-foreground\"\n />\n <div className=\"min-w-0\">\n <h3 className=\"text-xs font-semibold text-foreground\">\n {t(\"dispatch.pages.pendingApps\")}\n </h3>\n <p className=\"text-xs text-muted-foreground\">\n {t(\"dispatch.pages.pendingAppsDescription\", {\n count: pendingApps.length,\n })}\n </p>\n </div>\n </div>\n <CollapsibleTrigger asChild>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-7 gap-1.5 px-2 text-xs\"\n >\n {showPending\n ? t(\"dispatch.pages.hidePendingApps\")\n : t(\"dispatch.pages.showPendingApps\")}\n <IconChevronDown\n size={13}\n className={showPending ? \"rotate-180\" : undefined}\n />\n </Button>\n </CollapsibleTrigger>\n </div>\n <CollapsibleContent>\n <div className=\"grid gap-3 md:grid-cols-2\">\n {pendingApps.map((app) => (\n <WorkspaceAppCard\n key={app.id}\n app={app}\n className=\"min-h-32\"\n />\n ))}\n </div>\n </CollapsibleContent>\n </div>\n </Collapsible>\n ) : null}\n </section>\n );\n}\n\nexport function DispatchControlPlane() {\n useSetPageTitle(<span aria-hidden />);\n const appsQuery = useActionQuery<WorkspaceAppSummary[]>(\n \"list-workspace-apps\",\n { includeAgentCards: false, includeArchived: true },\n );\n const connectedAppsQuery = useActionQuery<ConnectedAppSummary[]>(\n \"list-connected-agents\",\n {},\n );\n const { data: workspaceApps = [], isLoading: appsLoading } = appsQuery;\n const otherApps = filterOtherApps(\n connectedAppsQuery.data ?? [],\n workspaceApps ?? [],\n );\n\n return (\n <div className=\"flex flex-col gap-8\">\n <CommandPanel />\n {appsQuery.isError ? (\n <ActionQueryError\n error={appsQuery.error}\n onRetry={() => void appsQuery.refetch()}\n />\n ) : (\n <AppsPanel\n apps={workspaceApps ?? []}\n isLoading={appsLoading}\n otherApps={otherApps}\n otherAppsError={connectedAppsQuery.error}\n otherAppsLoading={connectedAppsQuery.isLoading}\n onRetryOtherApps={() => void connectedAppsQuery.refetch()}\n />\n )}\n </div>\n );\n}\n"]}
@@ -3,8 +3,10 @@ export type AutomationStatusTone = "default" | "success" | "warning" | "danger"
3
3
  export declare function automationIdentity(item: Pick<DispatchAutomationItem, "owner" | "path">): string;
4
4
  export declare function automationTroubleshootPath(item: Pick<DispatchAutomationItem, "name">): string;
5
5
  export declare function automationTarget(item: DispatchAutomationItem): string;
6
+ export declare function automationScopeLabel(item: Pick<DispatchAutomationItem, "owner" | "scope">): string;
6
7
  export declare function relativeRunTime(value: string | null | undefined): string;
7
8
  export declare function automationLastRun(item: DispatchAutomationItem): string;
9
+ export declare function automationLastCheck(item: DispatchAutomationItem): string;
8
10
  export declare function automationNextRun(item: DispatchAutomationItem): string;
9
11
  export declare function automationStatus(item: DispatchAutomationItem): {
10
12
  label: string;
@@ -1 +1 @@
1
- {"version":3,"file":"automation-display.d.ts","sourceRoot":"","sources":["../../src/lib/automation-display.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAA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zC,MAAM,CAGR;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAKrE;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,IAAI,CAAC,sBAAsB,EAAE,OAAO,GAAG,OAAO,CAAC,GACpD,MAAM,CAMR;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAWxE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAEtE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAExE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAItE;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,sBAAsB,GAAG;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,oBAAoB,CAAC;CAC5B,CAUA;AAED,wBAAgB,eAAe,CAC7B,WAAW,EAAE,sBAAsB,EAAE,GACpC,sBAAsB,EAAE,CAa1B"}
@@ -14,6 +14,13 @@ export function automationTarget(item) {
14
14
  return item.schedule;
15
15
  return item.triggerType || "schedule";
16
16
  }
17
+ export function automationScopeLabel(item) {
18
+ return item.scope === "organization" ||
19
+ item.owner.startsWith("__organization__:") ||
20
+ item.owner === "__shared__"
21
+ ? "Organization"
22
+ : "Personal";
23
+ }
17
24
  export function relativeRunTime(value) {
18
25
  if (!value)
19
26
  return "never";
@@ -34,6 +41,9 @@ export function relativeRunTime(value) {
34
41
  export function automationLastRun(item) {
35
42
  return item.lastRun ? relativeRunTime(item.lastRun) : "never";
36
43
  }
44
+ export function automationLastCheck(item) {
45
+ return item.lastCheck ? relativeRunTime(item.lastCheck) : "never";
46
+ }
37
47
  export function automationNextRun(item) {
38
48
  if (!item.enabled)
39
49
  return "paused";
@@ -49,15 +59,19 @@ export function automationStatus(item) {
49
59
  if (item.lastStatus === "running")
50
60
  return { label: "Running", tone: "warning" };
51
61
  if (item.lastStatus === "skipped")
52
- return { label: "Skipped", tone: "warning" };
62
+ return { label: "Blocked", tone: "warning" };
53
63
  if (item.lastStatus === "success")
54
64
  return { label: "Healthy", tone: "success" };
55
65
  return { label: "Ready", tone: "default" };
56
66
  }
57
67
  export function sortAutomations(automations) {
58
68
  return [...automations].sort((a, b) => {
59
- const aError = a.enabled && a.lastStatus === "error" ? 1 : 0;
60
- const bError = b.enabled && b.lastStatus === "error" ? 1 : 0;
69
+ const aError = a.enabled && (a.lastStatus === "error" || a.lastStatus === "skipped")
70
+ ? 1
71
+ : 0;
72
+ const bError = b.enabled && (b.lastStatus === "error" || b.lastStatus === "skipped")
73
+ ? 1
74
+ : 0;
61
75
  if (aError !== bError)
62
76
  return bError - aError;
63
77
  return (b.lastRun || "").localeCompare(a.lastRun || "");
@@ -1 +1 @@
1
- {"version":3,"file":"automation-display.js","sourceRoot":"","sources":["../../src/lib/automation-display.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,kBAAkB,CAChC,IAAoD;IAEpD,OAAO,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,IAA0C;IAE1C,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACzD,OAAO,iBAAiB,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAA4B;IAC3D,IAAI,IAAI,CAAC,WAAW,KAAK,OAAO,IAAI,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC;IAClE,IAAI,IAAI,CAAC,mBAAmB;QAAE,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAC9D,IAAI,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC,QAAQ,CA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AAI,CAAC,CAAC,UAAU,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7D,IAAI,MAAM,KAAK,MAAM;YAAE,OAAO,MAAM,GAAG,MAAM,CAAC;QAC9C,OAAO,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { DispatchAutomationItem } from \"./automations.js\";\n\nexport type AutomationStatusTone =\n | \"default\"\n | \"success\"\n | \"warning\"\n | \"danger\"\n | \"muted\";\n\nexport function automationIdentity(\n item: Pick<DispatchAutomationItem, \"owner\" | \"path\">,\n): string {\n return `${item.owner}:${item.path}`;\n}\n\nexport function automationTroubleshootPath(\n item: Pick<DispatchAutomationItem, \"name\">,\n): string {\n const params = new URLSearchParams({ query: item.name });\n return `/thread-debug?${params.toString()}`;\n}\n\nexport function automationTarget(item: DispatchAutomationItem): string {\n if (item.triggerType === \"event\" && item.event) return item.event;\n if (item.scheduleDescription) return item.scheduleDescription;\n if (item.schedule) return item.schedule;\n return item.triggerType || \"schedule\";\n}\n\nexport function relativeRunTime(value: string | null | undefined): string {\n if (!value) return \"never\";\n const timestamp = new Date(value).getTime();\n if (!Number.isFinite(timestamp)) return \"never\";\n const diff = timestamp - Date.now();\n const abs = Math.abs(diff);\n const suffix = diff >= 0 ? \"from now\" : \"ago\";\n if (abs < 60_000) return diff >= 0 ? \"soon\" : \"now\";\n if (abs < 3_600_000) return `${Math.floor(abs / 60_000)}m ${suffix}`;\n if (abs < 86_400_000) return `${Math.floor(abs / 3_600_000)}h ${suffix}`;\n return `${Math.floor(abs / 86_400_000)}d ${suffix}`;\n}\n\nexport function automationLastRun(item: DispatchAutomationItem): string {\n return item.lastRun ? relativeRunTime(item.lastRun) : \"never\";\n}\n\nexport function automationNextRun(item: DispatchAutomationItem): string {\n if (!item.enabled) return \"paused\";\n if (item.triggerType === \"event\") return \"on event\";\n return item.nextRun ? relativeRunTime(item.nextRun) : \"not scheduled\";\n}\n\nexport function automationStatus(item: DispatchAutomationItem): {\n label: string;\n tone: AutomationStatusTone;\n} {\n if (!item.enabled) return { label: \"Paused\", tone: \"muted\" };\n if (item.lastStatus === \"error\") return { label: \"Error\", tone: \"danger\" };\n if (item.lastStatus === \"running\")\n return { label: \"Running\", tone: \"warning\" };\n if (item.lastStatus === \"skipped\")\n return { label: \"Skipped\", tone: \"warning\" };\n if (item.lastStatus === \"success\")\n return { label: \"Healthy\", tone: \"success\" };\n return { label: \"Ready\", tone: \"default\" };\n}\n\nexport function sortAutomations(\n automations: DispatchAutomationItem[],\n): DispatchAutomationItem[] {\n return [...automations].sort((a, b) => {\n const aError = a.enabled && a.lastStatus === \"error\" ? 1 : 0;\n const bError = b.enabled && b.lastStatus === \"error\" ? 1 : 0;\n if (aError !== bError) return bError - aError;\n return (b.lastRun || \"\").localeCompare(a.lastRun || \"\");\n });\n}\n"]}
1
+ {"version":3,"file":"automation-display.js","sourceRoot":"","sources":["../../src/lib/automation-display.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,kBAAkB,CAChC,IAAoD;IAEpD,OAAO,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,IAA0C;IAE1C,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACzD,OAAO,iBAAiB,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAA4B;IAC3D,IAAI,IAAI,CAAC,WAAW,KAAK,OAAO,IAAI,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC;IAClE,IAAI,IAAI,CAAC,mBAAmB;QAAE,OAAO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,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS;QAC/B,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAC/C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,WAAqC;IAErC,OAAO,CAAC,GAAG,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACpC,MAAM,MAAM,GACV,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,UAAU,KAAK,OAAO,IAAI,CAAC,CAAC,UAAU,KAAK,SAAS,CAAC;YACnE,CAAC,CAAC,CAAC;YACH,CAAC,CAAC,CAAC,CAAC;QACR,MAAM,MAAM,GACV,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,UAAU,KAAK,OAAO,IAAI,CAAC,CAAC,UAAU,KAAK,SAAS,CAAC;YACnE,CAAC,CAAC,CAAC;YACH,CAAC,CAAC,CAAC,CAAC;QACR,IAAI,MAAM,KAAK,MAAM;YAAE,OAAO,MAAM,GAAG,MAAM,CAAC;QAC9C,OAAO,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { DispatchAutomationItem } from \"./automations.js\";\n\nexport type AutomationStatusTone =\n | \"default\"\n | \"success\"\n | \"warning\"\n | \"danger\"\n | \"muted\";\n\nexport function automationIdentity(\n item: Pick<DispatchAutomationItem, \"owner\" | \"path\">,\n): string {\n return `${item.owner}:${item.path}`;\n}\n\nexport function automationTroubleshootPath(\n item: Pick<DispatchAutomationItem, \"name\">,\n): string {\n const params = new URLSearchParams({ query: item.name });\n return `/thread-debug?${params.toString()}`;\n}\n\nexport function automationTarget(item: DispatchAutomationItem): string {\n if (item.triggerType === \"event\" && item.event) return item.event;\n if (item.scheduleDescription) return item.scheduleDescription;\n if (item.schedule) return item.schedule;\n return item.triggerType || \"schedule\";\n}\n\nexport function automationScopeLabel(\n item: Pick<DispatchAutomationItem, \"owner\" | \"scope\">,\n): string {\n return item.scope === \"organization\" ||\n item.owner.startsWith(\"__organization__:\") ||\n item.owner === \"__shared__\"\n ? \"Organization\"\n : \"Personal\";\n}\n\nexport function relativeRunTime(value: string | null | undefined): string {\n if (!value) return \"never\";\n const timestamp = new Date(value).getTime();\n if (!Number.isFinite(timestamp)) return \"never\";\n const diff = timestamp - Date.now();\n const abs = Math.abs(diff);\n const suffix = diff >= 0 ? \"from now\" : \"ago\";\n if (abs < 60_000) return diff >= 0 ? \"soon\" : \"now\";\n if (abs < 3_600_000) return `${Math.floor(abs / 60_000)}m ${suffix}`;\n if (abs < 86_400_000) return `${Math.floor(abs / 3_600_000)}h ${suffix}`;\n return `${Math.floor(abs / 86_400_000)}d ${suffix}`;\n}\n\nexport function automationLastRun(item: DispatchAutomationItem): string {\n return item.lastRun ? relativeRunTime(item.lastRun) : \"never\";\n}\n\nexport function automationLastCheck(item: DispatchAutomationItem): string {\n return item.lastCheck ? relativeRunTime(item.lastCheck) : \"never\";\n}\n\nexport function automationNextRun(item: DispatchAutomationItem): string {\n if (!item.enabled) return \"paused\";\n if (item.triggerType === \"event\") return \"on event\";\n return item.nextRun ? relativeRunTime(item.nextRun) : \"not scheduled\";\n}\n\nexport function automationStatus(item: DispatchAutomationItem): {\n label: string;\n tone: AutomationStatusTone;\n} {\n if (!item.enabled) return { label: \"Paused\", tone: \"muted\" };\n if (item.lastStatus === \"error\") return { label: \"Error\", tone: \"danger\" };\n if (item.lastStatus === \"running\")\n return { label: \"Running\", tone: \"warning\" };\n if (item.lastStatus === \"skipped\")\n return { label: \"Blocked\", tone: \"warning\" };\n if (item.lastStatus === \"success\")\n return { label: \"Healthy\", tone: \"success\" };\n return { label: \"Ready\", tone: \"default\" };\n}\n\nexport function sortAutomations(\n automations: DispatchAutomationItem[],\n): DispatchAutomationItem[] {\n return [...automations].sort((a, b) => {\n const aError =\n a.enabled && (a.lastStatus === \"error\" || a.lastStatus === \"skipped\")\n ? 1\n : 0;\n const bError =\n b.enabled && (b.lastStatus === \"error\" || b.lastStatus === \"skipped\")\n ? 1\n : 0;\n if (aError !== bError) return bError - aError;\n return (b.lastRun || \"\").localeCompare(a.lastRun || \"\");\n });\n}\n"]}
@@ -3,6 +3,7 @@ export interface DispatchAutomationItem {
3
3
  name: string;
4
4
  path: string;
5
5
  owner: string;
6
+ scope?: "personal" | "organization";
6
7
  canUpdate?: boolean;
7
8
  triggerType?: "schedule" | "event" | string;
8
9
  event?: string;
@@ -12,8 +13,10 @@ export interface DispatchAutomationItem {
12
13
  mode?: string;
13
14
  domain?: string;
14
15
  enabled?: boolean;
16
+ timezone?: string;
15
17
  lastStatus?: string;
16
18
  lastRun?: string;
19
+ lastCheck?: string;
17
20
  lastError?: string;
18
21
  nextRun?: string;
19
22
  createdBy?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"automations.d.ts","sourceRoot":"","sources":["../../src/lib/automations.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IA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AC;QACzB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,IAAgC,CAAC;AAC1C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,KAAwC;IAExC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,eAAe,CAAC,4BAA4B,CAAC,EAAE;QAC1E,MAAM,EAAE,OAAO;QACf,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;KAC5B,CAAC,CAAC;IACH,OAAO,sBAAsB,CAAyB,QAAQ,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import { agentNativePath } from \"@agent-native/core/client/api-path\";\n\nexport interface DispatchAutomationItem {\n id: string;\n name: string;\n path: string;\n owner: string;\n canUpdate?: boolean;\n triggerType?: \"schedule\" | \"event\" | string;\n event?: string;\n schedule?: string;\n scheduleDescription?: string;\n condition?: string;\n mode?: string;\n domain?: string;\n enabled?: boolean;\n lastStatus?: string;\n lastRun?: string;\n lastError?: string;\n nextRun?: string;\n createdBy?: string;\n}\n\nexport interface SetDispatchAutomationEnabledInput {\n owner: string;\n path: string;\n enabled: boolean;\n}\n\nasync function readAutomationResponse<T>(response: Response): Promise<T> {\n const data = await response.json().catch(() => null);\n if (!response.ok) {\n const message =\n data && typeof data === \"object\" && \"error\" in data\n ? String((data as { error?: unknown }).error)\n : \"Automation request failed\";\n throw new Error(message);\n }\n return data as T;\n}\n\nexport async function listDispatchAutomations(): Promise<\n DispatchAutomationItem[]\n> {\n const response = await fetch(agentNativePath(\"/_agent-native/automations\"));\n const rows = await readAutomationResponse<unknown>(response);\n if (!Array.isArray(rows)) {\n throw new Error(\"Automation list returned an invalid response\");\n }\n return rows as DispatchAutomationItem[];\n}\n\nexport async function setDispatchAutomationEnabled(\n input: SetDispatchAutomationEnabledInput,\n): Promise<DispatchAutomationItem> {\n const response = await fetch(agentNativePath(\"/_agent-native/automations\"), {\n method: \"PATCH\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify(input),\n });\n return readAutomationResponse<DispatchAutomationItem>(response);\n}\n"]}
1
+ {"version":3,"file":"automations.js","sourceRoot":"","sources":["../../src/lib/automations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAgCrE,KAAK,UAAU,sBAAsB,CAAI,QAAkB;IACzD,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IACrD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,OAAO,GACX,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,IAAI,IAAI;YACjD,CAAC,CAAC,MAAM,CAAE,IAA4B,CAAC,KAAK,CAAC;YAC7C,CAAC,CAAC,2BAA2B,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,IAAS,CAAC;AACnB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,uBAAuB;IAG3C,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,eAAe,CAAC,4BAA4B,CAAC,CAAC,CAAC;IAC5E,MAAM,IAAI,GAAG,MAAM,sBAAsB,CAAU,QAAQ,CAAC,CAAC;IAC7D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,IAAgC,CAAC;AAC1C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,KAAwC;IAExC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,eAAe,CAAC,4BAA4B,CAAC,EAAE;QAC1E,MAAM,EAAE,OAAO;QACf,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;KAC5B,CAAC,CAAC;IACH,OAAO,sBAAsB,CAAyB,QAAQ,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import { agentNativePath } from \"@agent-native/core/client/api-path\";\n\nexport interface DispatchAutomationItem {\n id: string;\n name: string;\n path: string;\n owner: string;\n scope?: \"personal\" | \"organization\";\n canUpdate?: boolean;\n triggerType?: \"schedule\" | \"event\" | string;\n event?: string;\n schedule?: string;\n scheduleDescription?: string;\n condition?: string;\n mode?: string;\n domain?: string;\n enabled?: boolean;\n timezone?: string;\n lastStatus?: string;\n lastRun?: string;\n lastCheck?: string;\n lastError?: string;\n nextRun?: string;\n createdBy?: string;\n}\n\nexport interface SetDispatchAutomationEnabledInput {\n owner: string;\n path: string;\n enabled: boolean;\n}\n\nasync function readAutomationResponse<T>(response: Response): Promise<T> {\n const data = await response.json().catch(() => null);\n if (!response.ok) {\n const message =\n data && typeof data === \"object\" && \"error\" in data\n ? String((data as { error?: unknown }).error)\n : \"Automation request failed\";\n throw new Error(message);\n }\n return data as T;\n}\n\nexport async function listDispatchAutomations(): Promise<\n DispatchAutomationItem[]\n> {\n const response = await fetch(agentNativePath(\"/_agent-native/automations\"));\n const rows = await readAutomationResponse<unknown>(response);\n if (!Array.isArray(rows)) {\n throw new Error(\"Automation list returned an invalid response\");\n }\n return rows as DispatchAutomationItem[];\n}\n\nexport async function setDispatchAutomationEnabled(\n input: SetDispatchAutomationEnabledInput,\n): Promise<DispatchAutomationItem> {\n const response = await fetch(agentNativePath(\"/_agent-native/automations\"), {\n method: \"PATCH\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify(input),\n });\n return readAutomationResponse<DispatchAutomationItem>(response);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/apps.tsx"],"names":[],"mappings":"AAqCA,wBAAgB,IAAI;;IAEnB;AAQD,MAAM,CAAC,OAAO,UAAU,SAAS,oDAwShC"}
1
+ {"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/apps.tsx"],"names":[],"mappings":"AAoCA,wBAAgB,IAAI;;IAEnB;AAQD,MAAM,CAAC,OAAO,UAAU,SAAS,oDAwShC"}
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useActionQuery } from "@agent-native/core/client/hooks";
3
3
  import { useT } from "@agent-native/core/client/i18n";
4
- import { withBuilderUtmTrackingParams } from "@agent-native/core/shared/builder-link-tracking";
5
- import { IconApps, IconArrowUpRight, IconChevronDown, IconClockHour4, IconEyeOff, IconPlus, IconStack2, } from "@tabler/icons-react";
4
+ import { IconApps, IconChevronDown, IconClockHour4, IconEyeOff, IconPlus, IconStack2, } from "@tabler/icons-react";
6
5
  import { useState } from "react";
7
6
  import { ActionQueryError } from "../../components/action-query-error.js";
7
+ import { ConnectedAppCard } from "../../components/connected-app-card.js";
8
8
  import { CreateAppPopover } from "../../components/create-app-popover.js";
9
9
  import { DispatchShell } from "../../components/dispatch-shell.js";
10
10
  import { Button } from "../../components/ui/button.js";
@@ -77,7 +77,7 @@ export default function AppsRoute() {
77
77
  : t("dispatch.pages.showPendingApps"), _jsx(IconChevronDown, { size: 14, className: cn("transition-transform", showPending && "rotate-180") })] }) })] }), _jsx(CollapsibleContent, { children: _jsx("div", { className: "grid auto-rows-fr gap-3 md:grid-cols-2 xl:grid-cols-3", children: pendingApps.map((app) => (_jsx(WorkspaceAppCard, { app: app, className: "h-full" }, app.id))) }) })] }) })) : null, curatedTemplatesQuery.isError ? (_jsx("section", { className: "space-y-3 border-t pt-4", children: _jsx(ActionQueryError, { error: curatedTemplatesQuery.error, onRetry: () => void curatedTemplatesQuery.refetch() }) })) : curatedTemplatesQuery.data ? (_jsxs("section", { className: "space-y-3 border-t pt-4", children: [_jsxs("div", { className: "flex min-w-0 items-start gap-2", children: [_jsx(IconStack2, { size: 16, className: "mt-0.5 shrink-0 text-muted-foreground" }), _jsxs("div", { className: "min-w-0", children: [_jsx("h2", { className: "truncate text-sm font-semibold text-foreground", children: t("dispatch.pages.curatedTemplates") }), _jsx("p", { className: "mt-0.5 text-xs text-muted-foreground", children: t("dispatch.pages.curatedTemplatesDescription") })] })] }), _jsx(WorkspaceTemplatesSection, { templates: curatedTemplatesQuery.data, labels: templateLabels, onRemixSuccess: () => {
78
78
  void appsQuery.refetch();
79
79
  void curatedTemplatesQuery.refetch();
80
- } })] })) : null, connectedAppsQuery.isError ? (_jsxs("section", { className: "space-y-3 border-t pt-4", children: [_jsx(OtherAppsHeading, { count: 0 }), _jsx(ActionQueryError, { error: connectedAppsQuery.error, onRetry: () => void connectedAppsQuery.refetch() })] })) : connectedAppsQuery.isLoading || otherApps.length > 0 ? (_jsxs("section", { className: "space-y-3 border-t pt-4", children: [_jsx(OtherAppsHeading, { count: otherApps.length }), connectedAppsQuery.isLoading ? (_jsx(OtherAppsSkeletonGrid, {})) : (_jsx("div", { className: "grid auto-rows-fr gap-3 md:grid-cols-2 xl:grid-cols-3", children: otherApps.map((app) => (_jsx(OtherAppCard, { app: app }, app.id))) }))] })) : null, archivedApps.length > 0 ? (_jsx(Collapsible, { open: showHidden, onOpenChange: setShowHidden, children: _jsxs("section", { className: "space-y-3", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3 border-t pt-4", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx(IconEyeOff, { size: 16, className: "shrink-0 text-muted-foreground" }), _jsxs("div", { className: "min-w-0", children: [_jsx("h2", { className: "text-sm font-semibold text-foreground", children: t("dispatch.pages.hiddenApps") }), _jsx("p", { className: "text-xs text-muted-foreground", children: t("dispatch.pages.hiddenAppCount", {
80
+ } })] })) : null, connectedAppsQuery.isError ? (_jsxs("section", { className: "space-y-3 border-t pt-4", children: [_jsx(OtherAppsHeading, { count: 0 }), _jsx(ActionQueryError, { error: connectedAppsQuery.error, onRetry: () => void connectedAppsQuery.refetch() })] })) : connectedAppsQuery.isLoading || otherApps.length > 0 ? (_jsxs("section", { className: "space-y-3 border-t pt-4", children: [_jsx(OtherAppsHeading, { count: otherApps.length }), connectedAppsQuery.isLoading ? (_jsx(OtherAppsSkeletonGrid, {})) : (_jsx("div", { className: "grid auto-rows-fr gap-3 md:grid-cols-2 xl:grid-cols-3", children: otherApps.map((app) => (_jsx(ConnectedAppCard, { app: app }, app.id))) }))] })) : null, archivedApps.length > 0 ? (_jsx(Collapsible, { open: showHidden, onOpenChange: setShowHidden, children: _jsxs("section", { className: "space-y-3", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3 border-t pt-4", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx(IconEyeOff, { size: 16, className: "shrink-0 text-muted-foreground" }), _jsxs("div", { className: "min-w-0", children: [_jsx("h2", { className: "text-sm font-semibold text-foreground", children: t("dispatch.pages.hiddenApps") }), _jsx("p", { className: "text-xs text-muted-foreground", children: t("dispatch.pages.hiddenAppCount", {
81
81
  count: archivedApps.length,
82
82
  }) })] })] }), _jsx(CollapsibleTrigger, { asChild: true, children: _jsxs(Button, { type: "button", variant: "outline", size: "sm", className: "gap-1.5", children: [showHidden
83
83
  ? t("dispatch.pages.hide")
@@ -92,13 +92,6 @@ function OtherAppsHeading({ count }) {
92
92
  function OtherAppsSkeletonGrid() {
93
93
  return (_jsx("div", { className: "grid gap-3 md:grid-cols-2 xl:grid-cols-3", children: Array.from({ length: 3 }).map((_, index) => (_jsx("div", { className: "rounded-lg bg-card p-4", children: _jsxs("div", { className: "flex items-start gap-3", children: [_jsx(Skeleton, { className: "size-8 rounded-md" }), _jsxs("div", { className: "flex-1 space-y-3", children: [_jsx(Skeleton, { className: "h-4 w-32" }), _jsx(Skeleton, { className: "h-3 w-full" }), _jsx(Skeleton, { className: "h-3 w-2/3" })] })] }) }, index))) }));
94
94
  }
95
- function OtherAppCard({ app }) {
96
- const t = useT();
97
- return (_jsxs("a", { href: withBuilderUtmTrackingParams(app.url, {
98
- campaign: "product",
99
- content: "dispatch_app",
100
- }), target: "_blank", rel: "noopener noreferrer", className: "group flex min-h-[116px] items-start gap-3 rounded-xl bg-card/40 p-4 transition-[background-color] hover:bg-accent/15 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: [_jsx("span", { className: "flex size-8 shrink-0 items-center justify-center rounded-md bg-muted text-xs font-semibold text-muted-foreground", children: app.name.charAt(0).toUpperCase() }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsxs("span", { className: "flex items-start justify-between gap-3", children: [_jsx("span", { className: "truncate text-sm font-semibold text-foreground", children: app.name }), _jsx(IconArrowUpRight, { size: 15, className: "shrink-0 text-muted-foreground transition-transform group-hover:-translate-y-0.5 group-hover:translate-x-0.5" })] }), _jsx("span", { className: "mt-2 line-clamp-2 block text-[13px] leading-5 text-muted-foreground", children: app.description || app.url }), _jsx("span", { className: "mt-3 block text-xs font-medium text-foreground", children: t("dispatch.pages.openApp") })] })] }));
101
- }
102
95
  function AppsSkeletonGrid() {
103
96
  return (_jsx("div", { className: "grid gap-3 md:grid-cols-2 xl:grid-cols-3", children: Array.from({ length: 3 }).map((_, index) => (_jsx("div", { className: "rounded-lg bg-card p-4", children: _jsxs("div", { className: "flex items-start justify-between gap-3", children: [_jsxs("div", { className: "min-w-0 flex-1 space-y-3", children: [_jsx(Skeleton, { className: "h-4 w-32" }), _jsx(Skeleton, { className: "h-3 w-24" }), _jsxs("div", { className: "space-y-2 pt-1", children: [_jsx(Skeleton, { className: "h-3 w-full" }), _jsx(Skeleton, { className: "h-3 w-2/3" })] })] }), _jsx(Skeleton, { className: "h-7 w-7 rounded-md" })] }) }, index))) }));
104
97
  }