@synergenius/flow-weaver-pack-weaver 0.9.59 → 0.9.77
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/ai-chat-provider.d.ts +12 -0
- package/dist/ai-chat-provider.d.ts.map +1 -1
- package/dist/ai-chat-provider.js +351 -335
- package/dist/ai-chat-provider.js.map +1 -1
- package/dist/bot/agent-loop.d.ts +20 -0
- package/dist/bot/agent-loop.d.ts.map +1 -0
- package/dist/bot/agent-loop.js +331 -0
- package/dist/bot/agent-loop.js.map +1 -0
- package/dist/bot/ai-router.d.ts +19 -0
- package/dist/bot/ai-router.d.ts.map +1 -0
- package/dist/bot/ai-router.js +104 -0
- package/dist/bot/ai-router.js.map +1 -0
- package/dist/bot/assistant-tools.d.ts.map +1 -1
- package/dist/bot/assistant-tools.js +49 -33
- package/dist/bot/assistant-tools.js.map +1 -1
- package/dist/bot/async-mutex.d.ts +13 -0
- package/dist/bot/async-mutex.d.ts.map +1 -0
- package/dist/bot/async-mutex.js +37 -0
- package/dist/bot/async-mutex.js.map +1 -0
- package/dist/bot/bot-manager.d.ts +2 -2
- package/dist/bot/bot-manager.d.ts.map +1 -1
- package/dist/bot/bot-manager.js +3 -3
- package/dist/bot/bot-manager.js.map +1 -1
- package/dist/bot/bot-registry.js +2 -2
- package/dist/bot/bot-registry.js.map +1 -1
- package/dist/bot/conversation-store.d.ts +1 -0
- package/dist/bot/conversation-store.d.ts.map +1 -1
- package/dist/bot/conversation-store.js.map +1 -1
- package/dist/bot/dashboard.d.ts.map +1 -1
- package/dist/bot/dashboard.js +17 -8
- package/dist/bot/dashboard.js.map +1 -1
- package/dist/bot/improve-loop.js.map +1 -1
- package/dist/bot/index.d.ts +2 -4
- package/dist/bot/index.d.ts.map +1 -1
- package/dist/bot/index.js +1 -2
- package/dist/bot/index.js.map +1 -1
- package/dist/bot/instance-manager.d.ts +31 -0
- package/dist/bot/instance-manager.d.ts.map +1 -0
- package/dist/bot/instance-manager.js +115 -0
- package/dist/bot/instance-manager.js.map +1 -0
- package/dist/bot/orchestrator.d.ts +36 -0
- package/dist/bot/orchestrator.d.ts.map +1 -0
- package/dist/bot/orchestrator.js +176 -0
- package/dist/bot/orchestrator.js.map +1 -0
- package/dist/bot/profile-store.d.ts +36 -0
- package/dist/bot/profile-store.d.ts.map +1 -0
- package/dist/bot/profile-store.js +208 -0
- package/dist/bot/profile-store.js.map +1 -0
- package/dist/bot/profile-types.d.ts +126 -0
- package/dist/bot/profile-types.d.ts.map +1 -0
- package/dist/bot/profile-types.js +7 -0
- package/dist/bot/profile-types.js.map +1 -0
- package/dist/bot/run-store.d.ts.map +1 -1
- package/dist/bot/run-store.js +8 -0
- package/dist/bot/run-store.js.map +1 -1
- package/dist/bot/runner.d.ts +4 -0
- package/dist/bot/runner.d.ts.map +1 -1
- package/dist/bot/runner.js +5 -1
- package/dist/bot/runner.js.map +1 -1
- package/dist/bot/swarm-controller.d.ts +109 -0
- package/dist/bot/swarm-controller.d.ts.map +1 -0
- package/dist/bot/swarm-controller.js +640 -0
- package/dist/bot/swarm-controller.js.map +1 -0
- package/dist/bot/swarm-event-log.d.ts +28 -0
- package/dist/bot/swarm-event-log.d.ts.map +1 -0
- package/dist/bot/swarm-event-log.js +54 -0
- package/dist/bot/swarm-event-log.js.map +1 -0
- package/dist/bot/task-prompt-builder.d.ts +22 -0
- package/dist/bot/task-prompt-builder.d.ts.map +1 -0
- package/dist/bot/task-prompt-builder.js +240 -0
- package/dist/bot/task-prompt-builder.js.map +1 -0
- package/dist/bot/task-store.d.ts +21 -0
- package/dist/bot/task-store.d.ts.map +1 -0
- package/dist/bot/task-store.js +364 -0
- package/dist/bot/task-store.js.map +1 -0
- package/dist/bot/task-types.d.ts +79 -0
- package/dist/bot/task-types.d.ts.map +1 -0
- package/dist/bot/task-types.js +6 -0
- package/dist/bot/task-types.js.map +1 -0
- package/dist/bot/types.d.ts +8 -0
- package/dist/bot/types.d.ts.map +1 -1
- package/dist/cli-handlers.d.ts.map +1 -1
- package/dist/cli-handlers.js +79 -54
- package/dist/cli-handlers.js.map +1 -1
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +749 -0
- package/dist/cli.js.map +1 -0
- package/dist/docs/docs/weaver-bot-usage.md +35 -18
- package/dist/docs/docs/weaver-config.md +20 -0
- package/dist/docs/docs/weaver-task-queue.md +31 -19
- package/dist/docs/weaver-config.md +15 -9
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-tools.d.ts +17 -0
- package/dist/mcp-tools.d.ts.map +1 -1
- package/dist/mcp-tools.js +98 -279
- package/dist/mcp-tools.js.map +1 -1
- package/dist/node-types/bot-report.d.ts.map +1 -1
- package/dist/node-types/bot-report.js +6 -24
- package/dist/node-types/bot-report.js.map +1 -1
- package/dist/node-types/orchestrator-dispatch.d.ts +17 -0
- package/dist/node-types/orchestrator-dispatch.d.ts.map +1 -0
- package/dist/node-types/orchestrator-dispatch.js +63 -0
- package/dist/node-types/orchestrator-dispatch.js.map +1 -0
- package/dist/node-types/orchestrator-load-state.d.ts +16 -0
- package/dist/node-types/orchestrator-load-state.d.ts.map +1 -0
- package/dist/node-types/orchestrator-load-state.js +60 -0
- package/dist/node-types/orchestrator-load-state.js.map +1 -0
- package/dist/node-types/orchestrator-route.d.ts +16 -0
- package/dist/node-types/orchestrator-route.d.ts.map +1 -0
- package/dist/node-types/orchestrator-route.js +28 -0
- package/dist/node-types/orchestrator-route.js.map +1 -0
- package/dist/node-types/receive-task.d.ts +2 -3
- package/dist/node-types/receive-task.d.ts.map +1 -1
- package/dist/node-types/receive-task.js +3 -48
- package/dist/node-types/receive-task.js.map +1 -1
- package/dist/templates/weaver-template.d.ts +11 -0
- package/dist/templates/weaver-template.d.ts.map +1 -0
- package/dist/templates/weaver-template.js +53 -0
- package/dist/templates/weaver-template.js.map +1 -0
- package/dist/ui/bot-activity.js +2 -2
- package/dist/ui/bot-constants.d.ts +14 -0
- package/dist/ui/bot-constants.d.ts.map +1 -0
- package/dist/ui/bot-constants.js +189 -0
- package/dist/ui/bot-constants.js.map +1 -0
- package/dist/ui/bot-panel.js +207 -245
- package/dist/ui/bot-slot-card.js +141 -0
- package/dist/ui/budget-bar.js +59 -0
- package/dist/ui/chat-task-result.js +178 -0
- package/dist/ui/decision-log.js +136 -0
- package/dist/ui/profile-card.js +158 -0
- package/dist/ui/profile-editor.js +597 -0
- package/dist/ui/swarm-controls.js +245 -0
- package/dist/ui/swarm-dashboard.js +3012 -0
- package/dist/ui/task-create-form.js +98 -0
- package/dist/ui/task-detail-view.js +1044 -0
- package/dist/ui/task-pool-list.js +156 -0
- package/dist/workflows/orchestrator.d.ts +21 -0
- package/dist/workflows/orchestrator.d.ts.map +1 -0
- package/dist/workflows/orchestrator.js +281 -0
- package/dist/workflows/orchestrator.js.map +1 -0
- package/dist/workflows/weaver-bot-session.d.ts +65 -0
- package/dist/workflows/weaver-bot-session.d.ts.map +1 -0
- package/dist/workflows/weaver-bot-session.js +68 -0
- package/dist/workflows/weaver-bot-session.js.map +1 -0
- package/dist/workflows/weaver.d.ts +24 -0
- package/dist/workflows/weaver.d.ts.map +1 -0
- package/dist/workflows/weaver.js +28 -0
- package/dist/workflows/weaver.js.map +1 -0
- package/flowweaver.manifest.json +547 -133
- package/package.json +1 -1
- package/src/ai-chat-provider.ts +378 -371
- package/src/bot/ai-router.ts +132 -0
- package/src/bot/assistant-tools.ts +47 -29
- package/src/bot/async-mutex.ts +37 -0
- package/src/bot/bot-manager.ts +3 -3
- package/src/bot/bot-registry.ts +2 -2
- package/src/bot/conversation-store.ts +2 -1
- package/src/bot/dashboard.ts +17 -8
- package/src/bot/improve-loop.ts +6 -6
- package/src/bot/index.ts +2 -4
- package/src/bot/instance-manager.ts +128 -0
- package/src/bot/orchestrator.ts +244 -0
- package/src/bot/profile-store.ts +225 -0
- package/src/bot/profile-types.ts +141 -0
- package/src/bot/run-store.ts +8 -0
- package/src/bot/runner.ts +9 -1
- package/src/bot/swarm-controller.ts +780 -0
- package/src/bot/swarm-event-log.ts +57 -0
- package/src/bot/task-prompt-builder.ts +309 -0
- package/src/bot/task-store.ts +407 -0
- package/src/bot/task-types.ts +100 -0
- package/src/bot/types.ts +8 -0
- package/src/cli-handlers.ts +78 -53
- package/src/docs/weaver-bot-usage.md +35 -18
- package/src/docs/weaver-config.md +20 -0
- package/src/docs/weaver-task-queue.md +31 -19
- package/src/index.ts +5 -4
- package/src/mcp-tools.ts +129 -372
- package/src/node-types/bot-report.ts +6 -24
- package/src/node-types/orchestrator-dispatch.ts +71 -0
- package/src/node-types/orchestrator-load-state.ts +66 -0
- package/src/node-types/orchestrator-route.ts +33 -0
- package/src/node-types/receive-task.ts +3 -57
- package/src/ui/bot-activity.tsx +2 -2
- package/src/ui/bot-constants.ts +192 -0
- package/src/ui/bot-panel.tsx +213 -247
- package/src/ui/bot-slot-card.tsx +139 -0
- package/src/ui/budget-bar.tsx +30 -0
- package/src/ui/chat-task-result.tsx +236 -0
- package/src/ui/decision-log.tsx +148 -0
- package/src/ui/profile-card.tsx +157 -0
- package/src/ui/profile-editor.tsx +384 -0
- package/src/ui/swarm-controls.tsx +260 -0
- package/src/ui/swarm-dashboard.tsx +647 -0
- package/src/ui/task-create-form.tsx +87 -0
- package/src/ui/task-detail-view.tsx +841 -0
- package/src/ui/task-pool-list.tsx +187 -0
- package/src/workflows/orchestrator.ts +302 -0
- package/dist/docs/weaver-bot-usage.md +0 -34
- package/dist/docs/weaver-genesis.md +0 -32
- package/dist/docs/weaver-task-queue.md +0 -34
- package/dist/ui/bot-workspace.js +0 -1015
- package/dist/ui/chat-bot-result.js +0 -71
- package/dist/ui/queue-input.js +0 -82
- package/dist/ui/session-bar.js +0 -174
- package/src/bot/error-guide.ts +0 -4
- package/src/bot/retry-utils.ts +0 -4
- package/src/bot/session-state.ts +0 -116
- package/src/bot/task-queue.ts +0 -262
- package/src/ui/bot-workspace.tsx +0 -442
- package/src/ui/chat-bot-result.tsx +0 -81
- package/src/ui/queue-input.tsx +0 -56
- package/src/ui/session-bar.tsx +0 -157
package/dist/ui/bot-panel.js
CHANGED
|
@@ -9,11 +9,9 @@ var {
|
|
|
9
9
|
Button,
|
|
10
10
|
IconButton,
|
|
11
11
|
Icon,
|
|
12
|
-
Input,
|
|
13
12
|
EmptyState,
|
|
14
13
|
ScrollArea,
|
|
15
14
|
StatusIcon,
|
|
16
|
-
toast,
|
|
17
15
|
usePackWorkspace
|
|
18
16
|
} = require("@fw/plugin-ui-kit");
|
|
19
17
|
function parseToolResult(raw) {
|
|
@@ -26,181 +24,113 @@ function parseToolResult(raw) {
|
|
|
26
24
|
}
|
|
27
25
|
return raw;
|
|
28
26
|
}
|
|
29
|
-
function
|
|
30
|
-
switch (
|
|
31
|
-
case "
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
function statusToIconStatus(status) {
|
|
28
|
+
switch (status) {
|
|
29
|
+
case "executing":
|
|
30
|
+
case "running":
|
|
31
|
+
return "running";
|
|
32
|
+
case "paused":
|
|
33
|
+
return "pending";
|
|
34
|
+
case "stopped":
|
|
35
|
+
case "stopping":
|
|
36
|
+
return "failed";
|
|
37
37
|
default:
|
|
38
|
-
return
|
|
38
|
+
return "completed";
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
+
function statusLabel(status) {
|
|
42
|
+
switch (status) {
|
|
43
|
+
case "executing":
|
|
44
|
+
return "Executing";
|
|
45
|
+
case "running":
|
|
46
|
+
return "Running";
|
|
47
|
+
case "paused":
|
|
48
|
+
return "Paused";
|
|
49
|
+
case "stopped":
|
|
50
|
+
return "Stopped";
|
|
51
|
+
case "stopping":
|
|
52
|
+
return "Stopping";
|
|
53
|
+
default:
|
|
54
|
+
return "Idle";
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function formatTokens(n) {
|
|
58
|
+
if (n >= 1e6) return `${(n / 1e6).toFixed(1)}M`;
|
|
59
|
+
if (n >= 1e3) return `${(n / 1e3).toFixed(1)}k`;
|
|
60
|
+
return String(n);
|
|
61
|
+
}
|
|
62
|
+
function formatCost(n) {
|
|
63
|
+
return `$${n.toFixed(2)}`;
|
|
64
|
+
}
|
|
65
|
+
var POLL_INTERVAL_MS = 5e3;
|
|
41
66
|
function BotPanel() {
|
|
42
67
|
const ctx = usePackWorkspace();
|
|
43
|
-
const { callTool
|
|
68
|
+
const { callTool } = ctx;
|
|
44
69
|
const packId = ctx.packId;
|
|
45
|
-
const [
|
|
70
|
+
const [swarm, setSwarm] = useState(null);
|
|
46
71
|
const [loading, setLoading] = useState(true);
|
|
47
72
|
const [error, setError] = useState(null);
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const
|
|
73
|
+
const mountedRef = useRef(true);
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
mountedRef.current = true;
|
|
76
|
+
return () => {
|
|
77
|
+
mountedRef.current = false;
|
|
78
|
+
};
|
|
79
|
+
}, []);
|
|
80
|
+
const fetchStatus = useCallback(async () => {
|
|
56
81
|
try {
|
|
57
82
|
setError(null);
|
|
58
|
-
const raw = await callTool("
|
|
83
|
+
const raw = await callTool("fw_weaver_swarm_status", {});
|
|
84
|
+
if (!mountedRef.current) return;
|
|
59
85
|
const parsed = parseToolResult(raw);
|
|
60
|
-
if (
|
|
61
|
-
setBots(parsed);
|
|
62
|
-
} else {
|
|
63
|
-
setBots([]);
|
|
64
|
-
}
|
|
86
|
+
if (parsed) setSwarm(parsed);
|
|
65
87
|
} catch (err) {
|
|
66
|
-
|
|
88
|
+
if (!mountedRef.current) return;
|
|
89
|
+
const msg = err instanceof Error ? err.message : "Failed to load swarm status";
|
|
67
90
|
setError(msg);
|
|
68
91
|
} finally {
|
|
69
|
-
setLoading(false);
|
|
92
|
+
if (mountedRef.current) setLoading(false);
|
|
70
93
|
}
|
|
71
94
|
}, [callTool]);
|
|
72
|
-
const mountedRef = useRef(false);
|
|
73
95
|
useEffect(() => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
setRegExport("");
|
|
93
|
-
setShowRegForm(false);
|
|
94
|
-
await loadBots();
|
|
95
|
-
} catch (err) {
|
|
96
|
-
toast(err instanceof Error ? err.message : "Registration failed", { type: "error" });
|
|
97
|
-
} finally {
|
|
98
|
-
setRegistering(false);
|
|
99
|
-
}
|
|
100
|
-
}, [regName, regFilePath, regExport, callTool, loadBots]);
|
|
101
|
-
const handleUnregister = useCallback(async (id) => {
|
|
102
|
-
setUnregistering(true);
|
|
103
|
-
try {
|
|
104
|
-
await callTool("fw_weaver_unregister_bot", { id });
|
|
105
|
-
toast("Bot unregistered", { type: "warning" });
|
|
106
|
-
setConfirmUnregId(null);
|
|
107
|
-
await loadBots();
|
|
108
|
-
} catch (err) {
|
|
109
|
-
toast(err instanceof Error ? err.message : "Unregister failed", { type: "error" });
|
|
110
|
-
} finally {
|
|
111
|
-
setUnregistering(false);
|
|
112
|
-
}
|
|
113
|
-
}, [callTool, loadBots]);
|
|
114
|
-
const handleOpenWorkspace = useCallback((botId) => {
|
|
115
|
-
dispatchEvent("fw:open-bot-workspace", { botId, packId, live: false });
|
|
116
|
-
}, [dispatchEvent, packId]);
|
|
117
|
-
const hasBots = bots.length > 0;
|
|
96
|
+
fetchStatus();
|
|
97
|
+
const timer = setInterval(fetchStatus, POLL_INTERVAL_MS);
|
|
98
|
+
return () => clearInterval(timer);
|
|
99
|
+
}, [fetchStatus]);
|
|
100
|
+
const handleOpenDashboard = useCallback(() => {
|
|
101
|
+
ctx.openWindow({
|
|
102
|
+
type: "custom",
|
|
103
|
+
title: "Swarm Dashboard",
|
|
104
|
+
icon: "dashboard",
|
|
105
|
+
contentType: "bot-workspace",
|
|
106
|
+
displayState: "docked",
|
|
107
|
+
dockZone: "center",
|
|
108
|
+
definitionId: "bot-workspace",
|
|
109
|
+
size: { width: 1e3, height: 700 },
|
|
110
|
+
singleton: true,
|
|
111
|
+
data: { packId }
|
|
112
|
+
});
|
|
113
|
+
}, [ctx, packId]);
|
|
118
114
|
const header = React.createElement(
|
|
119
115
|
Flex,
|
|
120
116
|
{
|
|
121
|
-
variant: "row-center-between-nowrap-8",
|
|
117
|
+
variant: "row-center-space-between-nowrap-8",
|
|
122
118
|
style: { padding: "8px 12px", borderBottom: "1px solid var(--color-border-default)", flexShrink: 0 }
|
|
123
119
|
},
|
|
124
120
|
React.createElement(
|
|
125
121
|
Flex,
|
|
126
122
|
{ variant: "row-center-start-nowrap-6" },
|
|
127
123
|
React.createElement(Icon, { name: "smartToy", size: 16, color: "color-text-medium" }),
|
|
128
|
-
React.createElement(Typography, { variant: "caption-thick", color: "color-text-high" }, "
|
|
124
|
+
React.createElement(Typography, { variant: "caption-thick", color: "color-text-high" }, "Swarm")
|
|
129
125
|
),
|
|
130
|
-
React.createElement(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
onClick: loadBots,
|
|
138
|
-
title: "Refresh"
|
|
139
|
-
}),
|
|
140
|
-
React.createElement(IconButton, {
|
|
141
|
-
icon: "add",
|
|
142
|
-
size: "xs",
|
|
143
|
-
variant: "clear",
|
|
144
|
-
onClick: () => setShowRegForm((v) => !v),
|
|
145
|
-
title: "Register bot"
|
|
146
|
-
})
|
|
147
|
-
)
|
|
126
|
+
React.createElement(IconButton, {
|
|
127
|
+
icon: "reset",
|
|
128
|
+
size: "xs",
|
|
129
|
+
variant: "clear",
|
|
130
|
+
onClick: fetchStatus,
|
|
131
|
+
title: "Refresh"
|
|
132
|
+
})
|
|
148
133
|
);
|
|
149
|
-
const regForm = showRegForm ? React.createElement(
|
|
150
|
-
Flex,
|
|
151
|
-
{
|
|
152
|
-
variant: "column-start-start-nowrap-8",
|
|
153
|
-
style: {
|
|
154
|
-
padding: "10px 12px",
|
|
155
|
-
borderBottom: "1px solid var(--color-border-default)",
|
|
156
|
-
backgroundColor: "var(--color-surface-low)"
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
React.createElement(Typography, { variant: "smallCaption-thick", color: "color-text-medium" }, "Register Existing Workflow"),
|
|
160
|
-
React.createElement(Input, {
|
|
161
|
-
type: "text",
|
|
162
|
-
size: "small",
|
|
163
|
-
placeholder: "Bot name",
|
|
164
|
-
value: regName,
|
|
165
|
-
onChange: setRegName
|
|
166
|
-
}),
|
|
167
|
-
React.createElement(Input, {
|
|
168
|
-
type: "text",
|
|
169
|
-
size: "small",
|
|
170
|
-
placeholder: "File path (e.g. my-bot.ts)",
|
|
171
|
-
value: regFilePath,
|
|
172
|
-
onChange: setRegFilePath
|
|
173
|
-
}),
|
|
174
|
-
React.createElement(Input, {
|
|
175
|
-
type: "text",
|
|
176
|
-
size: "small",
|
|
177
|
-
placeholder: "Export name (e.g. myBot)",
|
|
178
|
-
value: regExport,
|
|
179
|
-
onChange: setRegExport
|
|
180
|
-
}),
|
|
181
|
-
React.createElement(
|
|
182
|
-
Flex,
|
|
183
|
-
{ variant: "row-center-start-nowrap-6" },
|
|
184
|
-
React.createElement(Button, {
|
|
185
|
-
size: "xs",
|
|
186
|
-
variant: "fill",
|
|
187
|
-
color: "primary",
|
|
188
|
-
onClick: handleRegister,
|
|
189
|
-
disabled: registering || !regName.trim() || !regFilePath.trim() || !regExport.trim()
|
|
190
|
-
}, registering ? "Registering..." : "Register"),
|
|
191
|
-
React.createElement(Button, {
|
|
192
|
-
size: "xs",
|
|
193
|
-
variant: "clear",
|
|
194
|
-
color: "secondary",
|
|
195
|
-
onClick: () => {
|
|
196
|
-
setShowRegForm(false);
|
|
197
|
-
setRegName("");
|
|
198
|
-
setRegFilePath("");
|
|
199
|
-
setRegExport("");
|
|
200
|
-
}
|
|
201
|
-
}, "Cancel")
|
|
202
|
-
)
|
|
203
|
-
) : null;
|
|
204
134
|
if (loading) {
|
|
205
135
|
return React.createElement(
|
|
206
136
|
Flex,
|
|
@@ -213,9 +143,9 @@ function BotPanel() {
|
|
|
213
143
|
Flex,
|
|
214
144
|
{
|
|
215
145
|
variant: "column-center-center-nowrap-8",
|
|
216
|
-
style: { flex: 1
|
|
146
|
+
style: { flex: 1 }
|
|
217
147
|
},
|
|
218
|
-
React.createElement(Typography, { variant: "caption-regular", color: "color-text-subtle" }, "Loading
|
|
148
|
+
React.createElement(Typography, { variant: "caption-regular", color: "color-text-subtle" }, "Loading swarm status...")
|
|
219
149
|
)
|
|
220
150
|
);
|
|
221
151
|
}
|
|
@@ -231,60 +161,113 @@ function BotPanel() {
|
|
|
231
161
|
Flex,
|
|
232
162
|
{
|
|
233
163
|
variant: "column-center-center-nowrap-8",
|
|
234
|
-
style: { flex: 1
|
|
164
|
+
style: { flex: 1 }
|
|
235
165
|
},
|
|
236
|
-
React.createElement(Typography, { variant: "caption-regular", color: "color-
|
|
237
|
-
React.createElement(Button, { size: "xs", variant: "outlined", onClick:
|
|
166
|
+
React.createElement(Typography, { variant: "caption-regular", color: "color-status-negative" }, error),
|
|
167
|
+
React.createElement(Button, { size: "xs", variant: "outlined", onClick: fetchStatus }, "Retry")
|
|
238
168
|
)
|
|
239
169
|
);
|
|
240
170
|
}
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
171
|
+
const swarmStatus = swarm?.status ?? "idle";
|
|
172
|
+
const statusRow = React.createElement(
|
|
173
|
+
Flex,
|
|
174
|
+
{
|
|
175
|
+
variant: "row-center-space-between-nowrap-8",
|
|
176
|
+
style: { padding: "8px 12px", borderBottom: "1px solid var(--color-border-default)" }
|
|
177
|
+
},
|
|
178
|
+
React.createElement(
|
|
179
|
+
Flex,
|
|
180
|
+
{ variant: "row-center-start-nowrap-6" },
|
|
181
|
+
React.createElement(StatusIcon, {
|
|
182
|
+
status: statusToIconStatus(swarmStatus),
|
|
183
|
+
size: "sm"
|
|
184
|
+
}),
|
|
185
|
+
React.createElement(
|
|
186
|
+
Typography,
|
|
187
|
+
{ variant: "caption-thick", color: "color-text-high" },
|
|
188
|
+
statusLabel(swarmStatus)
|
|
189
|
+
)
|
|
190
|
+
),
|
|
191
|
+
React.createElement(Button, {
|
|
192
|
+
size: "xs",
|
|
193
|
+
variant: "outlined",
|
|
194
|
+
color: "primary",
|
|
195
|
+
onClick: handleOpenDashboard
|
|
196
|
+
}, "Open Dashboard")
|
|
197
|
+
);
|
|
198
|
+
const statsRow = React.createElement(
|
|
199
|
+
Flex,
|
|
200
|
+
{
|
|
201
|
+
variant: "row-center-space-between-nowrap-8",
|
|
202
|
+
style: { padding: "8px 12px", borderBottom: "1px solid var(--color-border-default)", backgroundColor: "var(--color-surface-low)" }
|
|
203
|
+
},
|
|
204
|
+
React.createElement(
|
|
205
|
+
Flex,
|
|
206
|
+
{ variant: "column-center-center-nowrap-1" },
|
|
207
|
+
React.createElement(
|
|
208
|
+
Typography,
|
|
209
|
+
{ variant: "smallCaption-thick", color: "color-text-high" },
|
|
210
|
+
String(swarm?.tasksCompleted ?? 0)
|
|
211
|
+
),
|
|
212
|
+
React.createElement(Typography, { variant: "smallCaption-regular", color: "color-text-subtle" }, "Done")
|
|
213
|
+
),
|
|
214
|
+
React.createElement(
|
|
215
|
+
Flex,
|
|
216
|
+
{ variant: "column-center-center-nowrap-1" },
|
|
217
|
+
React.createElement(
|
|
218
|
+
Typography,
|
|
219
|
+
{ variant: "smallCaption-thick", color: "color-text-high" },
|
|
220
|
+
String(swarm?.tasksFailed ?? 0)
|
|
221
|
+
),
|
|
222
|
+
React.createElement(Typography, { variant: "smallCaption-regular", color: "color-text-subtle" }, "Failed")
|
|
223
|
+
),
|
|
224
|
+
React.createElement(
|
|
225
|
+
Flex,
|
|
226
|
+
{ variant: "column-center-center-nowrap-1" },
|
|
227
|
+
React.createElement(
|
|
228
|
+
Typography,
|
|
229
|
+
{ variant: "smallCaption-thick", color: "color-text-high" },
|
|
230
|
+
formatTokens(swarm?.totalTokensUsed ?? 0)
|
|
231
|
+
),
|
|
232
|
+
React.createElement(Typography, { variant: "smallCaption-regular", color: "color-text-subtle" }, "Tokens")
|
|
233
|
+
),
|
|
234
|
+
React.createElement(
|
|
235
|
+
Flex,
|
|
236
|
+
{ variant: "column-center-center-nowrap-1" },
|
|
237
|
+
React.createElement(
|
|
238
|
+
Typography,
|
|
239
|
+
{ variant: "smallCaption-thick", color: "color-text-high" },
|
|
240
|
+
formatCost(swarm?.totalCost ?? 0)
|
|
241
|
+
),
|
|
242
|
+
React.createElement(Typography, { variant: "smallCaption-regular", color: "color-text-subtle" }, "Cost")
|
|
243
|
+
)
|
|
244
|
+
);
|
|
245
|
+
const instanceEntries = Object.values(swarm?.instances ?? {});
|
|
246
|
+
const hasBots = instanceEntries.length > 0;
|
|
247
|
+
const botCards = instanceEntries.map(
|
|
248
|
+
(inst) => React.createElement(
|
|
246
249
|
Flex,
|
|
247
250
|
{
|
|
248
|
-
key:
|
|
251
|
+
key: inst.instanceId,
|
|
249
252
|
variant: "row-center-start-nowrap-8",
|
|
250
|
-
style: {
|
|
251
|
-
padding: "7px 8px",
|
|
252
|
-
borderRadius: "var(--border-radius-secondary)",
|
|
253
|
-
border: "1px solid var(--color-border-default)",
|
|
254
|
-
cursor: "pointer",
|
|
255
|
-
transition: "background-color 0.12s"
|
|
256
|
-
},
|
|
257
|
-
onClick: () => handleOpenWorkspace(bot.id),
|
|
258
|
-
onMouseEnter: (e) => {
|
|
259
|
-
e.currentTarget.style.backgroundColor = "var(--color-surface-raised)";
|
|
260
|
-
},
|
|
261
|
-
onMouseLeave: (e) => {
|
|
262
|
-
e.currentTarget.style.backgroundColor = "";
|
|
263
|
-
}
|
|
253
|
+
style: { padding: "8px", borderRadius: "var(--border-radius-regular)", border: "1px solid var(--color-border-default)" }
|
|
264
254
|
},
|
|
265
|
-
//
|
|
255
|
+
// Bot icon
|
|
266
256
|
React.createElement(
|
|
267
|
-
|
|
257
|
+
Flex,
|
|
268
258
|
{
|
|
259
|
+
variant: "row-center-center-nowrap-0",
|
|
269
260
|
style: {
|
|
270
|
-
width:
|
|
271
|
-
height:
|
|
261
|
+
width: 26,
|
|
262
|
+
height: 26,
|
|
272
263
|
borderRadius: "var(--border-radius-compact)",
|
|
273
|
-
display: "flex",
|
|
274
|
-
alignItems: "center",
|
|
275
|
-
justifyContent: "center",
|
|
276
264
|
flexShrink: 0,
|
|
277
|
-
background:
|
|
265
|
+
background: "var(--color-surface-low)"
|
|
278
266
|
}
|
|
279
267
|
},
|
|
280
|
-
React.createElement(Icon, {
|
|
281
|
-
name: bot.icon || "smartToy",
|
|
282
|
-
size: 14,
|
|
283
|
-
color: bot.color ? void 0 : "color-text-medium",
|
|
284
|
-
style: bot.color ? { color: bot.color } : void 0
|
|
285
|
-
})
|
|
268
|
+
React.createElement(Icon, { name: "smartToy", size: 14, color: "color-text-medium" })
|
|
286
269
|
),
|
|
287
|
-
// Name +
|
|
270
|
+
// Name + status + task
|
|
288
271
|
React.createElement(
|
|
289
272
|
Flex,
|
|
290
273
|
{
|
|
@@ -296,82 +279,60 @@ function BotPanel() {
|
|
|
296
279
|
{ variant: "row-center-start-nowrap-4" },
|
|
297
280
|
React.createElement(Typography, {
|
|
298
281
|
variant: "caption-thick",
|
|
299
|
-
color: "color-text-high"
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
282
|
+
color: "color-text-high"
|
|
283
|
+
}, `${inst.profileId} #${inst.index}`),
|
|
284
|
+
React.createElement(StatusIcon, {
|
|
285
|
+
status: statusToIconStatus(inst.status),
|
|
286
|
+
size: "sm"
|
|
287
|
+
}),
|
|
288
|
+
React.createElement(Typography, {
|
|
289
|
+
variant: "smallCaption-regular",
|
|
290
|
+
color: "color-text-subtle"
|
|
291
|
+
}, statusLabel(inst.status))
|
|
308
292
|
),
|
|
309
|
-
|
|
293
|
+
inst.currentTaskId ? React.createElement(Typography, {
|
|
310
294
|
variant: "smallCaption-regular",
|
|
311
295
|
color: "color-text-medium",
|
|
312
|
-
|
|
313
|
-
},
|
|
296
|
+
truncate: true
|
|
297
|
+
}, `Task: ${inst.currentTaskId}`) : null
|
|
314
298
|
),
|
|
315
|
-
//
|
|
316
|
-
|
|
317
|
-
Flex,
|
|
318
|
-
{
|
|
319
|
-
variant: "row-center-start-nowrap-4",
|
|
320
|
-
onClick: (e) => e.stopPropagation()
|
|
321
|
-
},
|
|
322
|
-
React.createElement(Button, {
|
|
323
|
-
size: "xs",
|
|
324
|
-
variant: "fill",
|
|
325
|
-
color: "danger",
|
|
326
|
-
onClick: () => handleUnregister(bot.id),
|
|
327
|
-
disabled: unregistering
|
|
328
|
-
}, unregistering ? "..." : "Yes"),
|
|
329
|
-
React.createElement(Button, {
|
|
330
|
-
size: "xs",
|
|
331
|
-
variant: "clear",
|
|
332
|
-
color: "secondary",
|
|
333
|
-
onClick: () => setConfirmUnregId(null)
|
|
334
|
-
}, "No")
|
|
335
|
-
) : React.createElement(
|
|
299
|
+
// Per-instance stats
|
|
300
|
+
React.createElement(
|
|
336
301
|
Flex,
|
|
337
302
|
{
|
|
338
|
-
variant: "
|
|
339
|
-
|
|
303
|
+
variant: "column-end-end-nowrap-1",
|
|
304
|
+
style: { flexShrink: 0 }
|
|
340
305
|
},
|
|
341
|
-
React.createElement(
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
variant: "clear",
|
|
352
|
-
onClick: () => setConfirmUnregId(bot.id),
|
|
353
|
-
title: "Unregister"
|
|
354
|
-
})
|
|
306
|
+
React.createElement(
|
|
307
|
+
Typography,
|
|
308
|
+
{ variant: "smallCaption-regular", color: "color-text-subtle" },
|
|
309
|
+
formatTokens(inst.tokensUsed)
|
|
310
|
+
),
|
|
311
|
+
React.createElement(
|
|
312
|
+
Typography,
|
|
313
|
+
{ variant: "smallCaption-regular", color: "color-text-subtle" },
|
|
314
|
+
formatCost(inst.cost)
|
|
315
|
+
)
|
|
355
316
|
)
|
|
356
|
-
)
|
|
357
|
-
|
|
317
|
+
)
|
|
318
|
+
);
|
|
358
319
|
const content = hasBots ? React.createElement(
|
|
359
320
|
ScrollArea,
|
|
360
321
|
{ style: { flex: 1 } },
|
|
361
322
|
React.createElement(Flex, {
|
|
362
|
-
variant: "column-
|
|
323
|
+
variant: "column-stretch-start-nowrap-6",
|
|
363
324
|
style: { padding: "8px 12px" }
|
|
364
325
|
}, ...botCards)
|
|
365
326
|
) : React.createElement(
|
|
366
327
|
Flex,
|
|
367
328
|
{
|
|
368
329
|
variant: "column-center-center-nowrap-0",
|
|
369
|
-
style: { flex: 1
|
|
330
|
+
style: { flex: 1 }
|
|
370
331
|
},
|
|
371
332
|
React.createElement(EmptyState, {
|
|
372
333
|
icon: "smartToy",
|
|
373
|
-
message: "No bots
|
|
374
|
-
description: "
|
|
334
|
+
message: swarmStatus === "idle" ? "Swarm idle" : "No bots active",
|
|
335
|
+
description: "Open the dashboard to configure and start the swarm."
|
|
375
336
|
})
|
|
376
337
|
);
|
|
377
338
|
return React.createElement(
|
|
@@ -381,7 +342,8 @@ function BotPanel() {
|
|
|
381
342
|
style: { width: "100%", height: "100%", overflow: "hidden" }
|
|
382
343
|
},
|
|
383
344
|
header,
|
|
384
|
-
|
|
345
|
+
statusRow,
|
|
346
|
+
statsRow,
|
|
385
347
|
content
|
|
386
348
|
);
|
|
387
349
|
}
|