@agent-native/dispatch 0.11.1 → 0.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/provider-api-catalog.d.ts +2 -2
- package/dist/actions/start-workspace-app-creation.js +1 -1
- package/dist/actions/start-workspace-app-creation.js.map +1 -1
- package/dist/components/create-app-popover.js +3 -3
- package/dist/components/create-app-popover.js.map +1 -1
- package/dist/components/dispatch-control-plane.d.ts +2 -0
- package/dist/components/dispatch-control-plane.d.ts.map +1 -0
- package/dist/components/dispatch-control-plane.js +432 -0
- package/dist/components/dispatch-control-plane.js.map +1 -0
- package/dist/components/layout/Header.d.ts.map +1 -1
- package/dist/components/layout/Header.js +19 -2
- package/dist/components/layout/Header.js.map +1 -1
- package/dist/lib/automations.d.ts +28 -0
- package/dist/lib/automations.d.ts.map +1 -0
- package/dist/lib/automations.js +27 -0
- package/dist/lib/automations.js.map +1 -0
- package/dist/routes/pages/overview.d.ts.map +1 -1
- package/dist/routes/pages/overview.js +3 -213
- package/dist/routes/pages/overview.js.map +1 -1
- package/dist/server/lib/provider-api.d.ts +2 -2
- package/dist/server/plugins/agent-chat.js +1 -1
- package/dist/server/plugins/agent-chat.js.map +1 -1
- package/dist/server/plugins/integrations.js +2 -2
- package/dist/server/plugins/integrations.js.map +1 -1
- package/package.json +2 -2
- package/src/actions/start-workspace-app-creation.ts +1 -1
- package/src/components/create-app-popover.tsx +3 -3
- package/src/components/dispatch-control-plane.tsx +1282 -0
- package/src/components/layout/Header.tsx +22 -1
- package/src/lib/automations.ts +60 -0
- package/src/routes/pages/overview.tsx +2 -755
- package/src/server/plugins/agent-chat.ts +1 -1
- package/src/server/plugins/integrations.ts +2 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { useLocation } from "react-router";
|
|
1
|
+
import { useLocation, useNavigate } from "react-router";
|
|
2
2
|
import { useHeaderTitle, useHeaderActions } from "./HeaderActions";
|
|
3
3
|
import { AgentToggleButton } from "@agent-native/core/client";
|
|
4
|
+
import { RunsTray } from "@agent-native/core/client/progress";
|
|
4
5
|
import { Button } from "@/components/ui/button";
|
|
5
6
|
import { IconLayoutSidebar } from "@tabler/icons-react";
|
|
6
7
|
|
|
@@ -35,9 +36,28 @@ export function Header({
|
|
|
35
36
|
showAgentToggle?: boolean;
|
|
36
37
|
}) {
|
|
37
38
|
const location = useLocation();
|
|
39
|
+
const navigate = useNavigate();
|
|
38
40
|
const title = useHeaderTitle();
|
|
39
41
|
const actions = useHeaderActions();
|
|
40
42
|
|
|
43
|
+
function openRunThread(threadId: string) {
|
|
44
|
+
navigate("/chat", {
|
|
45
|
+
state: {
|
|
46
|
+
dispatchThread: {
|
|
47
|
+
id: `${Date.now()}-${threadId}`,
|
|
48
|
+
threadId,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
window.requestAnimationFrame(() => {
|
|
53
|
+
window.dispatchEvent(
|
|
54
|
+
new CustomEvent("agent-chat:open-thread", {
|
|
55
|
+
detail: { threadId },
|
|
56
|
+
}),
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
41
61
|
return (
|
|
42
62
|
<header className="flex h-12 shrink-0 items-center gap-3 border-b border-border bg-background px-4 lg:px-6">
|
|
43
63
|
{onOpenMobile ? (
|
|
@@ -60,6 +80,7 @@ export function Header({
|
|
|
60
80
|
</div>
|
|
61
81
|
<div className="flex items-center gap-2 shrink-0">
|
|
62
82
|
{actions}
|
|
83
|
+
<RunsTray limit={8} onOpenThread={openRunThread} />
|
|
63
84
|
{showAgentToggle ? (
|
|
64
85
|
<AgentToggleButton className="h-8 w-8 rounded-md hover:bg-accent" />
|
|
65
86
|
) : null}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { agentNativePath } from "@agent-native/core/client";
|
|
2
|
+
|
|
3
|
+
export interface DispatchAutomationItem {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
path: string;
|
|
7
|
+
owner: string;
|
|
8
|
+
canUpdate?: boolean;
|
|
9
|
+
triggerType?: "schedule" | "event" | string;
|
|
10
|
+
event?: string;
|
|
11
|
+
schedule?: string;
|
|
12
|
+
scheduleDescription?: string;
|
|
13
|
+
condition?: string;
|
|
14
|
+
mode?: string;
|
|
15
|
+
domain?: string;
|
|
16
|
+
enabled?: boolean;
|
|
17
|
+
lastStatus?: string;
|
|
18
|
+
lastRun?: string;
|
|
19
|
+
lastError?: string;
|
|
20
|
+
nextRun?: string;
|
|
21
|
+
createdBy?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface SetDispatchAutomationEnabledInput {
|
|
25
|
+
owner: string;
|
|
26
|
+
path: string;
|
|
27
|
+
enabled: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async function readAutomationResponse<T>(response: Response): Promise<T> {
|
|
31
|
+
const data = await response.json().catch(() => null);
|
|
32
|
+
if (!response.ok) {
|
|
33
|
+
const message =
|
|
34
|
+
data && typeof data === "object" && "error" in data
|
|
35
|
+
? String((data as { error?: unknown }).error)
|
|
36
|
+
: "Automation request failed";
|
|
37
|
+
throw new Error(message);
|
|
38
|
+
}
|
|
39
|
+
return data as T;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export async function listDispatchAutomations(): Promise<
|
|
43
|
+
DispatchAutomationItem[]
|
|
44
|
+
> {
|
|
45
|
+
const response = await fetch(agentNativePath("/_agent-native/automations"));
|
|
46
|
+
if (!response.ok) return [];
|
|
47
|
+
const rows = await response.json().catch(() => []);
|
|
48
|
+
return Array.isArray(rows) ? rows : [];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export async function setDispatchAutomationEnabled(
|
|
52
|
+
input: SetDispatchAutomationEnabledInput,
|
|
53
|
+
): Promise<DispatchAutomationItem> {
|
|
54
|
+
const response = await fetch(agentNativePath("/_agent-native/automations"), {
|
|
55
|
+
method: "PATCH",
|
|
56
|
+
headers: { "content-type": "application/json" },
|
|
57
|
+
body: JSON.stringify(input),
|
|
58
|
+
});
|
|
59
|
+
return readAutomationResponse<DispatchAutomationItem>(response);
|
|
60
|
+
}
|