@agent-native/dispatch 0.13.10 → 0.13.12

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 (254) hide show
  1. package/dist/actions/navigate.js +1 -1
  2. package/dist/actions/navigate.js.map +1 -1
  3. package/dist/components/agents-panel.js +3 -3
  4. package/dist/components/agents-panel.js.map +1 -1
  5. package/dist/components/app-keys-popover.d.ts.map +1 -1
  6. package/dist/components/app-keys-popover.js +3 -3
  7. package/dist/components/app-keys-popover.js.map +1 -1
  8. package/dist/components/create-app-popover.d.ts.map +1 -1
  9. package/dist/components/create-app-popover.js +2 -2
  10. package/dist/components/create-app-popover.js.map +1 -1
  11. package/dist/components/dispatch-control-plane.d.ts.map +1 -1
  12. package/dist/components/dispatch-control-plane.js +19 -7
  13. package/dist/components/dispatch-control-plane.js.map +1 -1
  14. package/dist/components/dispatch-shell.d.ts.map +1 -1
  15. package/dist/components/dispatch-shell.js +2 -2
  16. package/dist/components/dispatch-shell.js.map +1 -1
  17. package/dist/components/layout/Header.js +2 -1
  18. package/dist/components/layout/Header.js.map +1 -1
  19. package/dist/components/layout/Layout.d.ts.map +1 -1
  20. package/dist/components/layout/Layout.js +12 -5
  21. package/dist/components/layout/Layout.js.map +1 -1
  22. package/dist/components/messaging-setup-panel.d.ts.map +1 -1
  23. package/dist/components/messaging-setup-panel.js +4 -4
  24. package/dist/components/messaging-setup-panel.js.map +1 -1
  25. package/dist/components/task-queue-health.d.ts +2 -0
  26. package/dist/components/task-queue-health.d.ts.map +1 -0
  27. package/dist/components/task-queue-health.js +49 -0
  28. package/dist/components/task-queue-health.js.map +1 -0
  29. package/dist/components/ui/accordion.js.map +1 -1
  30. package/dist/components/ui/alert-dialog.js +1 -1
  31. package/dist/components/ui/alert-dialog.js.map +1 -1
  32. package/dist/components/ui/alert.js.map +1 -1
  33. package/dist/components/ui/avatar.js.map +1 -1
  34. package/dist/components/ui/badge.js.map +1 -1
  35. package/dist/components/ui/breadcrumb.js.map +1 -1
  36. package/dist/components/ui/button.js.map +1 -1
  37. package/dist/components/ui/calendar.js +1 -1
  38. package/dist/components/ui/calendar.js.map +1 -1
  39. package/dist/components/ui/card.js.map +1 -1
  40. package/dist/components/ui/carousel.d.ts +2 -2
  41. package/dist/components/ui/carousel.d.ts.map +1 -1
  42. package/dist/components/ui/carousel.js +1 -1
  43. package/dist/components/ui/carousel.js.map +1 -1
  44. package/dist/components/ui/chart.js.map +1 -1
  45. package/dist/components/ui/checkbox.js.map +1 -1
  46. package/dist/components/ui/command.js +1 -1
  47. package/dist/components/ui/command.js.map +1 -1
  48. package/dist/components/ui/context-menu.js.map +1 -1
  49. package/dist/components/ui/dialog.js.map +1 -1
  50. package/dist/components/ui/drawer.js.map +1 -1
  51. package/dist/components/ui/dropdown-menu.js.map +1 -1
  52. package/dist/components/ui/form.js +1 -1
  53. package/dist/components/ui/form.js.map +1 -1
  54. package/dist/components/ui/hover-card.js.map +1 -1
  55. package/dist/components/ui/input-otp.js.map +1 -1
  56. package/dist/components/ui/input.js.map +1 -1
  57. package/dist/components/ui/label.js.map +1 -1
  58. package/dist/components/ui/menubar.js.map +1 -1
  59. package/dist/components/ui/navigation-menu.js.map +1 -1
  60. package/dist/components/ui/pagination.d.ts +1 -1
  61. package/dist/components/ui/pagination.d.ts.map +1 -1
  62. package/dist/components/ui/pagination.js +1 -1
  63. package/dist/components/ui/pagination.js.map +1 -1
  64. package/dist/components/ui/popover.js.map +1 -1
  65. package/dist/components/ui/progress.js.map +1 -1
  66. package/dist/components/ui/radio-group.js.map +1 -1
  67. package/dist/components/ui/resizable.js.map +1 -1
  68. package/dist/components/ui/scroll-area.js.map +1 -1
  69. package/dist/components/ui/select.js.map +1 -1
  70. package/dist/components/ui/separator.js.map +1 -1
  71. package/dist/components/ui/sheet.js.map +1 -1
  72. package/dist/components/ui/sidebar.d.ts +2 -2
  73. package/dist/components/ui/sidebar.d.ts.map +1 -1
  74. package/dist/components/ui/sidebar.js +6 -6
  75. package/dist/components/ui/sidebar.js.map +1 -1
  76. package/dist/components/ui/skeleton.js.map +1 -1
  77. package/dist/components/ui/slider.js.map +1 -1
  78. package/dist/components/ui/sonner.js.map +1 -1
  79. package/dist/components/ui/spinner.js.map +1 -1
  80. package/dist/components/ui/switch.js.map +1 -1
  81. package/dist/components/ui/table.js.map +1 -1
  82. package/dist/components/ui/tabs.js.map +1 -1
  83. package/dist/components/ui/textarea.js.map +1 -1
  84. package/dist/components/ui/toast.js.map +1 -1
  85. package/dist/components/ui/toaster.js +1 -1
  86. package/dist/components/ui/toaster.js.map +1 -1
  87. package/dist/components/ui/toggle-group.js +1 -1
  88. package/dist/components/ui/toggle-group.js.map +1 -1
  89. package/dist/components/ui/toggle.js.map +1 -1
  90. package/dist/components/ui/tooltip.js.map +1 -1
  91. package/dist/components/ui/use-toast.d.ts.map +1 -1
  92. package/dist/components/ui/use-toast.js.map +1 -1
  93. package/dist/components/workspace-app-card.d.ts.map +1 -1
  94. package/dist/components/workspace-app-card.js +10 -10
  95. package/dist/components/workspace-app-card.js.map +1 -1
  96. package/dist/components/workspace-resource-effective-stack.js +1 -1
  97. package/dist/components/workspace-resource-effective-stack.js.map +1 -1
  98. package/dist/components/workspace-resource-impact-preview.d.ts.map +1 -1
  99. package/dist/components/workspace-resource-impact-preview.js +2 -2
  100. package/dist/components/workspace-resource-impact-preview.js.map +1 -1
  101. package/dist/hooks/use-navigation-state.js +5 -0
  102. package/dist/hooks/use-navigation-state.js.map +1 -1
  103. package/dist/hooks/use-toast.d.ts.map +1 -1
  104. package/dist/hooks/use-toast.js.map +1 -1
  105. package/dist/lib/automation-display.d.ts +13 -0
  106. package/dist/lib/automation-display.d.ts.map +1 -0
  107. package/dist/lib/automation-display.js +62 -0
  108. package/dist/lib/automation-display.js.map +1 -0
  109. package/dist/lib/task-queue.d.ts +19 -0
  110. package/dist/lib/task-queue.d.ts.map +1 -0
  111. package/dist/lib/task-queue.js +54 -0
  112. package/dist/lib/task-queue.js.map +1 -0
  113. package/dist/routes/index.d.ts.map +1 -1
  114. package/dist/routes/index.js +1 -0
  115. package/dist/routes/index.js.map +1 -1
  116. package/dist/routes/pages/_index.js.map +1 -1
  117. package/dist/routes/pages/agents.d.ts.map +1 -1
  118. package/dist/routes/pages/agents.js +1 -1
  119. package/dist/routes/pages/agents.js.map +1 -1
  120. package/dist/routes/pages/approval.js.map +1 -1
  121. package/dist/routes/pages/approvals.js.map +1 -1
  122. package/dist/routes/pages/apps.$appId.js.map +1 -1
  123. package/dist/routes/pages/apps.js.map +1 -1
  124. package/dist/routes/pages/audit.js.map +1 -1
  125. package/dist/routes/pages/automations.d.ts +5 -0
  126. package/dist/routes/pages/automations.d.ts.map +1 -0
  127. package/dist/routes/pages/automations.js +106 -0
  128. package/dist/routes/pages/automations.js.map +1 -0
  129. package/dist/routes/pages/chat.js.map +1 -1
  130. package/dist/routes/pages/destinations.d.ts.map +1 -1
  131. package/dist/routes/pages/destinations.js +31 -27
  132. package/dist/routes/pages/destinations.js.map +1 -1
  133. package/dist/routes/pages/dreams.d.ts.map +1 -1
  134. package/dist/routes/pages/dreams.js +1 -1
  135. package/dist/routes/pages/dreams.js.map +1 -1
  136. package/dist/routes/pages/identities.js.map +1 -1
  137. package/dist/routes/pages/integrations.js.map +1 -1
  138. package/dist/routes/pages/messaging.js.map +1 -1
  139. package/dist/routes/pages/metrics.js.map +1 -1
  140. package/dist/routes/pages/new-app.js.map +1 -1
  141. package/dist/routes/pages/overview.d.ts +2 -2
  142. package/dist/routes/pages/overview.js.map +1 -1
  143. package/dist/routes/pages/settings.d.ts.map +1 -1
  144. package/dist/routes/pages/settings.js +2 -2
  145. package/dist/routes/pages/settings.js.map +1 -1
  146. package/dist/routes/pages/thread-debug.d.ts.map +1 -1
  147. package/dist/routes/pages/thread-debug.js +1 -1
  148. package/dist/routes/pages/thread-debug.js.map +1 -1
  149. package/dist/routes/pages/vault.d.ts.map +1 -1
  150. package/dist/routes/pages/vault.js +1 -1
  151. package/dist/routes/pages/vault.js.map +1 -1
  152. package/dist/routes/pages/workspace.d.ts.map +1 -1
  153. package/dist/routes/pages/workspace.js +1 -1
  154. package/dist/routes/pages/workspace.js.map +1 -1
  155. package/dist/server/lib/pre-auth-routing.d.ts.map +1 -1
  156. package/dist/server/lib/pre-auth-routing.js +1 -0
  157. package/dist/server/lib/pre-auth-routing.js.map +1 -1
  158. package/dist/server/lib/usage-metrics-store.d.ts.map +1 -1
  159. package/dist/server/lib/usage-metrics-store.js +12 -3
  160. package/dist/server/lib/usage-metrics-store.js.map +1 -1
  161. package/package.json +7 -7
  162. package/src/actions/navigate.ts +1 -1
  163. package/src/components/agents-panel.tsx +3 -3
  164. package/src/components/app-keys-popover.tsx +3 -7
  165. package/src/components/create-app-popover.tsx +2 -6
  166. package/src/components/dispatch-control-plane.tsx +48 -7
  167. package/src/components/dispatch-shell.tsx +2 -6
  168. package/src/components/layout/Header.tsx +2 -2
  169. package/src/components/layout/Layout.tsx +13 -15
  170. package/src/components/messaging-setup-panel.tsx +4 -8
  171. package/src/components/task-queue-health.tsx +166 -0
  172. package/src/components/ui/accordion.tsx +1 -1
  173. package/src/components/ui/alert-dialog.tsx +2 -2
  174. package/src/components/ui/alert.tsx +1 -1
  175. package/src/components/ui/avatar.tsx +1 -1
  176. package/src/components/ui/badge.tsx +1 -1
  177. package/src/components/ui/breadcrumb.tsx +1 -1
  178. package/src/components/ui/button.tsx +1 -1
  179. package/src/components/ui/calendar.tsx +2 -2
  180. package/src/components/ui/card.tsx +1 -1
  181. package/src/components/ui/carousel.tsx +2 -2
  182. package/src/components/ui/chart.tsx +1 -1
  183. package/src/components/ui/checkbox.tsx +1 -1
  184. package/src/components/ui/command.tsx +2 -2
  185. package/src/components/ui/context-menu.tsx +1 -1
  186. package/src/components/ui/dialog.tsx +1 -1
  187. package/src/components/ui/drawer.tsx +1 -1
  188. package/src/components/ui/dropdown-menu.tsx +1 -1
  189. package/src/components/ui/form.tsx +2 -2
  190. package/src/components/ui/hover-card.tsx +1 -1
  191. package/src/components/ui/input-otp.tsx +1 -1
  192. package/src/components/ui/input.tsx +1 -1
  193. package/src/components/ui/label.tsx +1 -1
  194. package/src/components/ui/menubar.tsx +1 -1
  195. package/src/components/ui/navigation-menu.tsx +1 -1
  196. package/src/components/ui/pagination.tsx +2 -2
  197. package/src/components/ui/popover.tsx +1 -1
  198. package/src/components/ui/progress.tsx +1 -1
  199. package/src/components/ui/radio-group.tsx +1 -1
  200. package/src/components/ui/resizable.tsx +1 -1
  201. package/src/components/ui/scroll-area.tsx +1 -1
  202. package/src/components/ui/select.tsx +1 -1
  203. package/src/components/ui/separator.tsx +1 -1
  204. package/src/components/ui/sheet.tsx +1 -1
  205. package/src/components/ui/sidebar.tsx +8 -13
  206. package/src/components/ui/skeleton.tsx +1 -1
  207. package/src/components/ui/slider.tsx +1 -1
  208. package/src/components/ui/sonner.tsx +1 -1
  209. package/src/components/ui/spinner.tsx +1 -1
  210. package/src/components/ui/switch.tsx +1 -1
  211. package/src/components/ui/table.tsx +1 -1
  212. package/src/components/ui/tabs.tsx +1 -1
  213. package/src/components/ui/textarea.tsx +1 -1
  214. package/src/components/ui/toast.tsx +1 -1
  215. package/src/components/ui/toaster.tsx +2 -2
  216. package/src/components/ui/toggle-group.tsx +2 -2
  217. package/src/components/ui/toggle.tsx +1 -1
  218. package/src/components/ui/tooltip.tsx +1 -1
  219. package/src/components/ui/use-toast.ts +1 -1
  220. package/src/components/workspace-app-card.tsx +16 -20
  221. package/src/components/workspace-resource-effective-stack.tsx +2 -2
  222. package/src/components/workspace-resource-impact-preview.tsx +2 -3
  223. package/src/hooks/use-navigation-state.spec.ts +7 -0
  224. package/src/hooks/use-navigation-state.ts +4 -0
  225. package/src/hooks/use-toast.ts +1 -1
  226. package/src/lib/automation-display.spec.ts +95 -0
  227. package/src/lib/automation-display.ts +70 -0
  228. package/src/lib/task-queue.spec.ts +57 -0
  229. package/src/lib/task-queue.ts +72 -0
  230. package/src/routes/index.ts +1 -0
  231. package/src/routes/pages/_index.tsx +1 -1
  232. package/src/routes/pages/agents.tsx +8 -5
  233. package/src/routes/pages/approval.tsx +4 -4
  234. package/src/routes/pages/approvals.tsx +4 -4
  235. package/src/routes/pages/apps.$appId.tsx +5 -5
  236. package/src/routes/pages/apps.tsx +8 -8
  237. package/src/routes/pages/audit.tsx +1 -1
  238. package/src/routes/pages/automations.tsx +280 -0
  239. package/src/routes/pages/chat.tsx +1 -1
  240. package/src/routes/pages/destinations.tsx +163 -154
  241. package/src/routes/pages/dreams.tsx +22 -18
  242. package/src/routes/pages/identities.tsx +2 -2
  243. package/src/routes/pages/integrations.tsx +8 -8
  244. package/src/routes/pages/messaging.tsx +2 -2
  245. package/src/routes/pages/metrics.tsx +6 -6
  246. package/src/routes/pages/new-app.tsx +1 -1
  247. package/src/routes/pages/overview.tsx +1 -1
  248. package/src/routes/pages/settings.tsx +37 -6
  249. package/src/routes/pages/thread-debug.tsx +14 -9
  250. package/src/routes/pages/vault.tsx +17 -12
  251. package/src/routes/pages/workspace.tsx +17 -12
  252. package/src/server/lib/pre-auth-routing.ts +1 -0
  253. package/src/server/lib/usage-metrics-store.spec.ts +102 -0
  254. package/src/server/lib/usage-metrics-store.ts +12 -3
@@ -0,0 +1,95 @@
1
+ import { describe, expect, it } from "vitest";
2
+
3
+ import {
4
+ automationIdentity,
5
+ automationNextRun,
6
+ automationStatus,
7
+ automationTarget,
8
+ sortAutomations,
9
+ } from "./automation-display.js";
10
+ import type { DispatchAutomationItem } from "./automations.js";
11
+
12
+ function item(
13
+ overrides: Partial<DispatchAutomationItem> &
14
+ Pick<DispatchAutomationItem, "id" | "name" | "path" | "owner">,
15
+ ): DispatchAutomationItem {
16
+ return {
17
+ enabled: true,
18
+ ...overrides,
19
+ };
20
+ }
21
+
22
+ describe("automation-display", () => {
23
+ it("builds a stable owner:path identity", () => {
24
+ expect(
25
+ automationIdentity({ owner: "user@example.com", path: "jobs/digest.md" }),
26
+ ).toBe("user@example.com:jobs/digest.md");
27
+ });
28
+
29
+ it("prefers event names, then schedule descriptions", () => {
30
+ expect(
31
+ automationTarget(
32
+ item({
33
+ id: "1",
34
+ name: "Alert",
35
+ path: "jobs/alert.md",
36
+ owner: "user@example.com",
37
+ triggerType: "event",
38
+ event: "calendar.booking.created",
39
+ }),
40
+ ),
41
+ ).toBe("calendar.booking.created");
42
+
43
+ expect(
44
+ automationTarget(
45
+ item({
46
+ id: "2",
47
+ name: "Digest",
48
+ path: "jobs/digest.md",
49
+ owner: "user@example.com",
50
+ scheduleDescription: "Weekdays at 9am",
51
+ schedule: "0 9 * * 1-5",
52
+ }),
53
+ ),
54
+ ).toBe("Weekdays at 9am");
55
+ });
56
+
57
+ it("reports paused next-run and status for disabled automations", () => {
58
+ const paused = item({
59
+ id: "3",
60
+ name: "Paused",
61
+ path: "jobs/paused.md",
62
+ owner: "user@example.com",
63
+ enabled: false,
64
+ lastStatus: "success",
65
+ });
66
+ expect(automationNextRun(paused)).toBe("paused");
67
+ expect(automationStatus(paused)).toEqual({
68
+ label: "Paused",
69
+ tone: "muted",
70
+ });
71
+ });
72
+
73
+ it("sorts enabled errors ahead of healthy runs", () => {
74
+ const healthy = item({
75
+ id: "healthy",
76
+ name: "Healthy",
77
+ path: "jobs/healthy.md",
78
+ owner: "user@example.com",
79
+ lastStatus: "success",
80
+ lastRun: "2026-07-08T10:00:00.000Z",
81
+ });
82
+ const errored = item({
83
+ id: "error",
84
+ name: "Broken",
85
+ path: "jobs/broken.md",
86
+ owner: "user@example.com",
87
+ lastStatus: "error",
88
+ lastRun: "2026-07-08T09:00:00.000Z",
89
+ });
90
+ expect(sortAutomations([healthy, errored]).map((row) => row.id)).toEqual([
91
+ "error",
92
+ "healthy",
93
+ ]);
94
+ });
95
+ });
@@ -0,0 +1,70 @@
1
+ import type { DispatchAutomationItem } from "./automations.js";
2
+
3
+ export type AutomationStatusTone =
4
+ | "default"
5
+ | "success"
6
+ | "warning"
7
+ | "danger"
8
+ | "muted";
9
+
10
+ export function automationIdentity(
11
+ item: Pick<DispatchAutomationItem, "owner" | "path">,
12
+ ): string {
13
+ return `${item.owner}:${item.path}`;
14
+ }
15
+
16
+ export function automationTarget(item: DispatchAutomationItem): string {
17
+ if (item.triggerType === "event" && item.event) return item.event;
18
+ if (item.scheduleDescription) return item.scheduleDescription;
19
+ if (item.schedule) return item.schedule;
20
+ return item.triggerType || "schedule";
21
+ }
22
+
23
+ export function relativeRunTime(value: string | null | undefined): string {
24
+ if (!value) return "never";
25
+ const timestamp = new Date(value).getTime();
26
+ if (!Number.isFinite(timestamp)) return "never";
27
+ const diff = timestamp - Date.now();
28
+ const abs = Math.abs(diff);
29
+ const suffix = diff >= 0 ? "from now" : "ago";
30
+ if (abs < 60_000) return diff >= 0 ? "soon" : "now";
31
+ if (abs < 3_600_000) return `${Math.floor(abs / 60_000)}m ${suffix}`;
32
+ if (abs < 86_400_000) return `${Math.floor(abs / 3_600_000)}h ${suffix}`;
33
+ return `${Math.floor(abs / 86_400_000)}d ${suffix}`;
34
+ }
35
+
36
+ export function automationLastRun(item: DispatchAutomationItem): string {
37
+ return item.lastRun ? relativeRunTime(item.lastRun) : "never";
38
+ }
39
+
40
+ export function automationNextRun(item: DispatchAutomationItem): string {
41
+ if (!item.enabled) return "paused";
42
+ if (item.triggerType === "event") return "on event";
43
+ return item.nextRun ? relativeRunTime(item.nextRun) : "not scheduled";
44
+ }
45
+
46
+ export function automationStatus(item: DispatchAutomationItem): {
47
+ label: string;
48
+ tone: AutomationStatusTone;
49
+ } {
50
+ if (!item.enabled) return { label: "Paused", tone: "muted" };
51
+ if (item.lastStatus === "error") return { label: "Error", tone: "danger" };
52
+ if (item.lastStatus === "running")
53
+ return { label: "Running", tone: "warning" };
54
+ if (item.lastStatus === "skipped")
55
+ return { label: "Skipped", tone: "warning" };
56
+ if (item.lastStatus === "success")
57
+ return { label: "Healthy", tone: "success" };
58
+ return { label: "Ready", tone: "default" };
59
+ }
60
+
61
+ export function sortAutomations(
62
+ automations: DispatchAutomationItem[],
63
+ ): DispatchAutomationItem[] {
64
+ return [...automations].sort((a, b) => {
65
+ const aError = a.enabled && a.lastStatus === "error" ? 1 : 0;
66
+ const bError = b.enabled && b.lastStatus === "error" ? 1 : 0;
67
+ if (aError !== bError) return bError - aError;
68
+ return (b.lastRun || "").localeCompare(a.lastRun || "");
69
+ });
70
+ }
@@ -0,0 +1,57 @@
1
+ import { describe, expect, it } from "vitest";
2
+
3
+ import {
4
+ formatQueueAgeSeconds,
5
+ normalizeTaskQueueStats,
6
+ ZERO_TASK_QUEUE_STATS,
7
+ } from "./task-queue";
8
+
9
+ describe("normalizeTaskQueueStats", () => {
10
+ it("returns zeros for invalid payloads", () => {
11
+ expect(normalizeTaskQueueStats(null)).toEqual(ZERO_TASK_QUEUE_STATS);
12
+ expect(normalizeTaskQueueStats("bad")).toEqual(ZERO_TASK_QUEUE_STATS);
13
+ });
14
+
15
+ it("normalizes numeric fields and recent failures", () => {
16
+ expect(
17
+ normalizeTaskQueueStats({
18
+ pending: "2",
19
+ processing: 1,
20
+ completed_last_hour: 4,
21
+ failed_last_hour: "1",
22
+ oldest_pending_age_seconds: 90,
23
+ recent_failures: [
24
+ {
25
+ id: "f1",
26
+ platform: "slack",
27
+ error: "rate limited",
28
+ attempts: "3",
29
+ },
30
+ ],
31
+ }),
32
+ ).toEqual({
33
+ pending: 2,
34
+ processing: 1,
35
+ completed_last_hour: 4,
36
+ failed_last_hour: 1,
37
+ oldest_pending_age_seconds: 90,
38
+ recent_failures: [
39
+ {
40
+ id: "f1",
41
+ platform: "slack",
42
+ error: "rate limited",
43
+ attempts: 3,
44
+ },
45
+ ],
46
+ });
47
+ });
48
+ });
49
+
50
+ describe("formatQueueAgeSeconds", () => {
51
+ it("formats common ages", () => {
52
+ expect(formatQueueAgeSeconds(0)).toBe("none");
53
+ expect(formatQueueAgeSeconds(12)).toBe("12s");
54
+ expect(formatQueueAgeSeconds(120)).toBe("2m");
55
+ expect(formatQueueAgeSeconds(7200)).toBe("2.0h");
56
+ });
57
+ });
@@ -0,0 +1,72 @@
1
+ import { agentNativePath } from "@agent-native/core/client";
2
+
3
+ export interface TaskQueueFailure {
4
+ id: string;
5
+ platform: string;
6
+ error: string;
7
+ attempts: number;
8
+ }
9
+
10
+ export interface TaskQueueStats {
11
+ pending: number;
12
+ processing: number;
13
+ completed_last_hour: number;
14
+ failed_last_hour: number;
15
+ oldest_pending_age_seconds: number;
16
+ recent_failures: TaskQueueFailure[];
17
+ }
18
+
19
+ export const ZERO_TASK_QUEUE_STATS: TaskQueueStats = {
20
+ pending: 0,
21
+ processing: 0,
22
+ completed_last_hour: 0,
23
+ failed_last_hour: 0,
24
+ oldest_pending_age_seconds: 0,
25
+ recent_failures: [],
26
+ };
27
+
28
+ function asNumber(value: unknown): number {
29
+ const n = Number(value ?? 0);
30
+ return Number.isFinite(n) ? n : 0;
31
+ }
32
+
33
+ export function normalizeTaskQueueStats(value: unknown): TaskQueueStats {
34
+ if (!value || typeof value !== "object") return ZERO_TASK_QUEUE_STATS;
35
+ const stats = value as Record<string, unknown>;
36
+ return {
37
+ pending: asNumber(stats.pending),
38
+ processing: asNumber(stats.processing),
39
+ completed_last_hour: asNumber(stats.completed_last_hour),
40
+ failed_last_hour: asNumber(stats.failed_last_hour),
41
+ oldest_pending_age_seconds: asNumber(stats.oldest_pending_age_seconds),
42
+ recent_failures: Array.isArray(stats.recent_failures)
43
+ ? stats.recent_failures.map((failure, index) => {
44
+ const row =
45
+ failure && typeof failure === "object"
46
+ ? (failure as Record<string, unknown>)
47
+ : {};
48
+ return {
49
+ id: String(row.id ?? `failure-${index}`),
50
+ platform: String(row.platform ?? ""),
51
+ error: String(row.error ?? ""),
52
+ attempts: asNumber(row.attempts),
53
+ };
54
+ })
55
+ : [],
56
+ };
57
+ }
58
+
59
+ export async function getDispatchTaskQueueStats(): Promise<TaskQueueStats> {
60
+ const response = await fetch(
61
+ agentNativePath("/_agent-native/integrations/task-queue/status"),
62
+ );
63
+ if (!response.ok) return ZERO_TASK_QUEUE_STATS;
64
+ return normalizeTaskQueueStats(await response.json().catch(() => null));
65
+ }
66
+
67
+ export function formatQueueAgeSeconds(seconds: number): string {
68
+ if (!Number.isFinite(seconds) || seconds <= 0) return "none";
69
+ if (seconds < 60) return `${Math.round(seconds)}s`;
70
+ if (seconds < 3600) return `${Math.round(seconds / 60)}m`;
71
+ return `${(seconds / 3600).toFixed(1)}h`;
72
+ }
@@ -47,6 +47,7 @@ export const dispatchRoutes: RouteConfig = [
47
47
  route("identities", "./pages/identities.js"),
48
48
  route("approval", "./pages/approval.js"),
49
49
  route("approvals", "./pages/approvals.js"),
50
+ route("automations", "./pages/automations.js"),
50
51
  route("audit", "./pages/audit.js"),
51
52
  route("settings", "./pages/settings.js"),
52
53
  route("dreams", "./pages/dreams.js"),
@@ -1,7 +1,7 @@
1
1
  import { appPath } from "@agent-native/core/client";
2
2
  import { redirect, type LoaderFunctionArgs } from "react-router";
3
3
 
4
- import { Spinner } from "@/components/ui/spinner";
4
+ import { Spinner } from "../../components/ui/spinner";
5
5
 
6
6
  const SEO_TITLE =
7
7
  "Agent-Native Dispatch - Open Source workspace control plane for AI agents";
@@ -8,11 +8,14 @@ import { IconCheck, IconCopy, IconPlugConnected } from "@tabler/icons-react";
8
8
  import { useMemo, useState } from "react";
9
9
  import { toast } from "sonner";
10
10
 
11
- import { AgentsPanel, type ConnectedAgent } from "@/components/agents-panel";
12
- import { DispatchShell } from "@/components/dispatch-shell";
13
- import { Button } from "@/components/ui/button";
14
- import { Input } from "@/components/ui/input";
15
- import { Switch } from "@/components/ui/switch";
11
+ import {
12
+ AgentsPanel,
13
+ type ConnectedAgent,
14
+ } from "../../components/agents-panel";
15
+ import { DispatchShell } from "../../components/dispatch-shell";
16
+ import { Button } from "../../components/ui/button";
17
+ import { Input } from "../../components/ui/input";
18
+ import { Switch } from "../../components/ui/switch";
16
19
 
17
20
  export function meta() {
18
21
  return [{ title: "Agents — Dispatch" }];
@@ -19,10 +19,10 @@ import { toast } from "sonner";
19
19
  import {
20
20
  ApprovalValueBlock,
21
21
  parseApprovalValue,
22
- } from "@/components/approval-value-block";
23
- import { Badge } from "@/components/ui/badge";
24
- import { Button } from "@/components/ui/button";
25
- import { Skeleton } from "@/components/ui/skeleton";
22
+ } from "../../components/approval-value-block";
23
+ import { Badge } from "../../components/ui/badge";
24
+ import { Button } from "../../components/ui/button";
25
+ import { Skeleton } from "../../components/ui/skeleton";
26
26
 
27
27
  export function meta() {
28
28
  return [{ title: "Approval — Dispatch" }];
@@ -3,10 +3,10 @@ import { useOrg } from "@agent-native/core/client/org";
3
3
  import { useMemo, useState } from "react";
4
4
  import { toast } from "sonner";
5
5
 
6
- import { DispatchShell } from "@/components/dispatch-shell";
7
- import { Button } from "@/components/ui/button";
8
- import { Input } from "@/components/ui/input";
9
- import { Switch } from "@/components/ui/switch";
6
+ import { DispatchShell } from "../../components/dispatch-shell";
7
+ import { Button } from "../../components/ui/button";
8
+ import { Input } from "../../components/ui/input";
9
+ import { Switch } from "../../components/ui/switch";
10
10
 
11
11
  export function meta() {
12
12
  return [{ title: "Approvals — Dispatch" }];
@@ -7,14 +7,14 @@ import {
7
7
  import { useEffect, useMemo } from "react";
8
8
  import { Link, useParams } from "react-router";
9
9
 
10
- import { DispatchShell } from "@/components/dispatch-shell";
11
- import { Badge } from "@/components/ui/badge";
12
- import { Button } from "@/components/ui/button";
13
- import { Skeleton } from "@/components/ui/skeleton";
10
+ import { DispatchShell } from "../../components/dispatch-shell";
11
+ import { Badge } from "../../components/ui/badge";
12
+ import { Button } from "../../components/ui/button";
13
+ import { Skeleton } from "../../components/ui/skeleton";
14
14
  import {
15
15
  workspaceAppHref,
16
16
  type WorkspaceAppSummary,
17
- } from "@/lib/workspace-apps";
17
+ } from "../../lib/workspace-apps";
18
18
 
19
19
  export function meta() {
20
20
  return [{ title: "Workspace app - Dispatch" }];
@@ -25,18 +25,18 @@ import {
25
25
  import { useState } from "react";
26
26
  import { toast } from "sonner";
27
27
 
28
- import { CreateAppPopover } from "@/components/create-app-popover";
29
- import { DispatchShell } from "@/components/dispatch-shell";
30
- import { Button } from "@/components/ui/button";
28
+ import { CreateAppPopover } from "../../components/create-app-popover";
29
+ import { DispatchShell } from "../../components/dispatch-shell";
30
+ import { Button } from "../../components/ui/button";
31
31
  import {
32
32
  Collapsible,
33
33
  CollapsibleContent,
34
34
  CollapsibleTrigger,
35
- } from "@/components/ui/collapsible";
36
- import { Skeleton } from "@/components/ui/skeleton";
37
- import { WorkspaceAppCard } from "@/components/workspace-app-card";
38
- import { cn } from "@/lib/utils";
39
- import type { WorkspaceAppSummary } from "@/lib/workspace-apps";
35
+ } from "../../components/ui/collapsible";
36
+ import { Skeleton } from "../../components/ui/skeleton";
37
+ import { WorkspaceAppCard } from "../../components/workspace-app-card";
38
+ import { cn } from "../../lib/utils";
39
+ import type { WorkspaceAppSummary } from "../../lib/workspace-apps";
40
40
 
41
41
  export function meta() {
42
42
  return [{ title: "Apps — Dispatch" }];
@@ -1,6 +1,6 @@
1
1
  import { useActionQuery } from "@agent-native/core/client";
2
2
 
3
- import { DispatchShell } from "@/components/dispatch-shell";
3
+ import { DispatchShell } from "../../components/dispatch-shell";
4
4
 
5
5
  export function meta() {
6
6
  return [{ title: "Audit — Dispatch" }];