@synergenius/flow-weaver-pack-weaver 0.9.199 → 0.9.201
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.js +5 -5
- package/dist/ai-chat-provider.js.map +1 -1
- package/dist/bot/acceptance-merge.d.ts +21 -0
- package/dist/bot/acceptance-merge.d.ts.map +1 -0
- package/dist/bot/acceptance-merge.js +46 -0
- package/dist/bot/acceptance-merge.js.map +1 -0
- package/dist/bot/ai-client.d.ts +14 -2
- package/dist/bot/ai-client.d.ts.map +1 -1
- package/dist/bot/ai-client.js +71 -24
- package/dist/bot/ai-client.js.map +1 -1
- package/dist/bot/assistant-tools.js +3 -3
- package/dist/bot/assistant-tools.js.map +1 -1
- package/dist/bot/audit-logger.d.ts.map +1 -1
- package/dist/bot/audit-logger.js +34 -14
- package/dist/bot/audit-logger.js.map +1 -1
- package/dist/bot/audit-trail.d.ts +67 -0
- package/dist/bot/audit-trail.d.ts.map +1 -0
- package/dist/bot/audit-trail.js +153 -0
- package/dist/bot/audit-trail.js.map +1 -0
- package/dist/bot/behavior-defaults.d.ts +1 -1
- package/dist/bot/behavior-defaults.d.ts.map +1 -1
- package/dist/bot/behavior-defaults.js +7 -3
- package/dist/bot/behavior-defaults.js.map +1 -1
- package/dist/bot/capability-registry.d.ts +9 -0
- package/dist/bot/capability-registry.d.ts.map +1 -1
- package/dist/bot/capability-registry.js +81 -27
- package/dist/bot/capability-registry.js.map +1 -1
- package/dist/bot/capability-types.d.ts +10 -0
- package/dist/bot/capability-types.d.ts.map +1 -1
- package/dist/bot/cli-provider.d.ts.map +1 -1
- package/dist/bot/cli-provider.js +8 -7
- package/dist/bot/cli-provider.js.map +1 -1
- package/dist/bot/preflight.d.ts +48 -0
- package/dist/bot/preflight.d.ts.map +1 -0
- package/dist/bot/preflight.js +247 -0
- package/dist/bot/preflight.js.map +1 -0
- package/dist/bot/provider-shim.d.ts +74 -0
- package/dist/bot/provider-shim.d.ts.map +1 -0
- package/dist/bot/provider-shim.js +176 -0
- package/dist/bot/provider-shim.js.map +1 -0
- package/dist/bot/runner.d.ts +2 -0
- package/dist/bot/runner.d.ts.map +1 -1
- package/dist/bot/runner.js +60 -17
- package/dist/bot/runner.js.map +1 -1
- package/dist/bot/step-executor.d.ts.map +1 -1
- package/dist/bot/step-executor.js +72 -115
- package/dist/bot/step-executor.js.map +1 -1
- package/dist/bot/swarm-controller.d.ts +2 -0
- package/dist/bot/swarm-controller.d.ts.map +1 -1
- package/dist/bot/swarm-controller.js +92 -20
- package/dist/bot/swarm-controller.js.map +1 -1
- package/dist/bot/task-create-handler.d.ts +37 -0
- package/dist/bot/task-create-handler.d.ts.map +1 -0
- package/dist/bot/task-create-handler.js +124 -0
- package/dist/bot/task-create-handler.js.map +1 -0
- package/dist/bot/task-store.d.ts +1 -0
- package/dist/bot/task-store.d.ts.map +1 -1
- package/dist/bot/task-store.js +67 -0
- package/dist/bot/task-store.js.map +1 -1
- package/dist/bot/types.d.ts +1 -1
- package/dist/bot/types.d.ts.map +1 -1
- package/dist/bot/weaver-tools.d.ts.map +1 -1
- package/dist/bot/weaver-tools.js +7 -39
- package/dist/bot/weaver-tools.js.map +1 -1
- package/dist/node-types/agent-execute.d.ts +25 -8
- package/dist/node-types/agent-execute.d.ts.map +1 -1
- package/dist/node-types/agent-execute.js +89 -23
- package/dist/node-types/agent-execute.js.map +1 -1
- package/dist/node-types/bot-report.d.ts.map +1 -1
- package/dist/node-types/bot-report.js +24 -3
- package/dist/node-types/bot-report.js.map +1 -1
- package/dist/node-types/plan-task.d.ts +8 -17
- package/dist/node-types/plan-task.d.ts.map +1 -1
- package/dist/node-types/plan-task.js +217 -256
- package/dist/node-types/plan-task.js.map +1 -1
- package/dist/node-types/review-result.js +8 -6
- package/dist/node-types/review-result.js.map +1 -1
- package/dist/palindrome.d.ts +9 -0
- package/dist/palindrome.d.ts.map +1 -0
- package/dist/palindrome.js +14 -0
- package/dist/palindrome.js.map +1 -0
- package/dist/ui/approval-card.js +91 -82
- package/dist/ui/bot-activity.js +73 -56
- package/dist/ui/bot-config.js +48 -31
- package/dist/ui/bot-dashboard.js +52 -36
- package/dist/ui/bot-panel.js +230 -228
- package/dist/ui/bot-slot-card.js +100 -90
- package/dist/ui/bot-status.js +37 -15
- package/dist/ui/budget-bar.js +57 -31
- package/dist/ui/capability-editor.js +447 -378
- package/dist/ui/chat-task-result.js +78 -71
- package/dist/ui/decision-log.js +68 -81
- package/dist/ui/genesis-block.js +86 -95
- package/dist/ui/instance-stream-view.js +722 -0
- package/dist/ui/profile-card.js +96 -221
- package/dist/ui/profile-editor.js +532 -575
- package/dist/ui/settings-section.js +41 -45
- package/dist/ui/swarm-controls.js +212 -135
- package/dist/ui/swarm-dashboard.js +3992 -2715
- package/dist/ui/task-detail-view.js +415 -521
- package/dist/ui/task-editor.js +339 -390
- package/dist/ui/task-pool-list.js +60 -55
- package/dist/workflows/src/palindrome.d.ts +11 -0
- package/dist/workflows/src/palindrome.d.ts.map +1 -0
- package/dist/workflows/src/palindrome.js +16 -0
- package/dist/workflows/src/palindrome.js.map +1 -0
- package/dist/workflows/tests/palindrome.test.d.ts +2 -0
- package/dist/workflows/tests/palindrome.test.d.ts.map +1 -0
- package/dist/workflows/tests/palindrome.test.js +41 -0
- package/dist/workflows/tests/palindrome.test.js.map +1 -0
- package/dist/workflows/weaver-bot-batch.js +1 -1
- package/dist/workflows/weaver-bot-batch.js.map +1 -1
- package/dist/workflows/weaver-bot.js +1 -1
- package/dist/workflows/weaver-bot.js.map +1 -1
- package/flowweaver.manifest.json +1 -1
- package/package.json +8 -2
- package/src/ai-chat-provider.ts +5 -5
- package/src/bot/acceptance-merge.ts +62 -0
- package/src/bot/ai-client.ts +77 -21
- package/src/bot/assistant-tools.ts +3 -3
- package/src/bot/audit-logger.ts +42 -14
- package/src/bot/audit-trail.ts +211 -0
- package/src/bot/behavior-defaults.ts +7 -2
- package/src/bot/capability-registry.ts +84 -28
- package/src/bot/capability-types.ts +11 -0
- package/src/bot/cli-provider.ts +8 -7
- package/src/bot/preflight.ts +285 -0
- package/src/bot/provider-shim.ts +218 -0
- package/src/bot/runner.ts +68 -20
- package/src/bot/step-executor.ts +69 -127
- package/src/bot/swarm-controller.ts +94 -20
- package/src/bot/task-create-handler.ts +164 -0
- package/src/bot/task-store.ts +83 -0
- package/src/bot/types.ts +4 -1
- package/src/bot/weaver-tools.ts +7 -45
- package/src/node-types/agent-execute.ts +102 -16
- package/src/node-types/bot-report.ts +24 -3
- package/src/node-types/plan-task.ts +238 -280
- package/src/node-types/review-result.ts +8 -6
- package/src/palindrome.ts +14 -0
- package/src/ui/approval-card.tsx +78 -62
- package/src/ui/bot-activity.tsx +12 -10
- package/src/ui/bot-config.tsx +12 -10
- package/src/ui/bot-dashboard.tsx +13 -11
- package/src/ui/bot-panel.tsx +189 -171
- package/src/ui/bot-slot-card.tsx +125 -70
- package/src/ui/bot-status.tsx +4 -4
- package/src/ui/budget-bar.tsx +86 -25
- package/src/ui/capability-editor.tsx +392 -257
- package/src/ui/chat-task-result.tsx +81 -78
- package/src/ui/decision-log.tsx +76 -73
- package/src/ui/genesis-block.tsx +91 -61
- package/src/ui/instance-stream-view.tsx +861 -0
- package/src/ui/profile-card.tsx +195 -168
- package/src/ui/profile-editor.tsx +453 -370
- package/src/ui/settings-section.tsx +46 -39
- package/src/ui/swarm-controls.tsx +252 -123
- package/src/ui/swarm-dashboard.tsx +999 -466
- package/src/ui/task-detail-view.tsx +485 -428
- package/src/ui/task-editor.tsx +329 -271
- package/src/ui/task-pool-list.tsx +68 -62
- package/src/workflows/src/palindrome.ts +16 -0
- package/src/workflows/tests/palindrome.test.ts +49 -0
- package/src/workflows/weaver-bot-batch.ts +1 -1
- package/src/workflows/weaver-bot.ts +1 -1
- package/dist/ui/bot-constants.d.ts +0 -14
- package/dist/ui/bot-constants.d.ts.map +0 -1
- package/dist/ui/bot-constants.js +0 -189
- package/dist/ui/bot-constants.js.map +0 -1
- package/dist/ui/steer-api.d.ts +0 -7
- package/dist/ui/steer-api.d.ts.map +0 -1
- package/dist/ui/steer-api.js +0 -11
- package/dist/ui/steer-api.js.map +0 -1
- package/dist/ui/trace-to-timeline.d.ts +0 -91
- package/dist/ui/trace-to-timeline.d.ts.map +0 -1
- package/dist/ui/trace-to-timeline.js +0 -116
- package/dist/ui/trace-to-timeline.js.map +0 -1
- package/dist/ui/use-stream-timeline.d.ts +0 -50
- package/dist/ui/use-stream-timeline.d.ts.map +0 -1
- package/dist/ui/use-stream-timeline.js +0 -245
- package/dist/ui/use-stream-timeline.js.map +0 -1
package/dist/ui/bot-activity.js
CHANGED
|
@@ -1,16 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2
19
|
|
|
3
20
|
// src/ui/bot-activity.tsx
|
|
21
|
+
var bot_activity_exports = {};
|
|
22
|
+
__export(bot_activity_exports, {
|
|
23
|
+
BotActivity: () => BotActivity,
|
|
24
|
+
default: () => bot_activity_default
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(bot_activity_exports);
|
|
27
|
+
var import_react = require("react");
|
|
28
|
+
var import_plugin_ui_kit = require("@fw/plugin-ui-kit");
|
|
29
|
+
var import_plugin_theme = require("@fw/plugin-theme");
|
|
4
30
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
-
var React = require("react");
|
|
6
|
-
var { useState, useEffect, useCallback, useRef } = React;
|
|
7
|
-
var { Typography } = require("@fw/plugin-ui-kit");
|
|
8
|
-
var { Icon } = require("@fw/plugin-ui-kit");
|
|
9
|
-
var { IconButton } = require("@fw/plugin-ui-kit");
|
|
10
|
-
var { Badge } = require("@fw/plugin-ui-kit");
|
|
11
|
-
var { ScrollArea } = require("@fw/plugin-ui-kit");
|
|
12
|
-
var { LoadingSpinner } = require("@fw/plugin-ui-kit");
|
|
13
|
-
var { styled } = require("@fw/plugin-theme");
|
|
14
31
|
var REFRESH_INTERVAL = 3e4;
|
|
15
32
|
function packToolUrl(toolName) {
|
|
16
33
|
return `/api/pack-tool/@synergenius/flow-weaver-pack-weaver/${toolName}`;
|
|
@@ -31,19 +48,19 @@ async function callTool(toolName, body = {}) {
|
|
|
31
48
|
return json.result;
|
|
32
49
|
}
|
|
33
50
|
}
|
|
34
|
-
var Container = styled.div({
|
|
51
|
+
var Container = import_plugin_theme.styled.div({
|
|
35
52
|
display: "flex",
|
|
36
53
|
flexDirection: "column",
|
|
37
54
|
height: "100%",
|
|
38
55
|
overflow: "hidden"
|
|
39
56
|
});
|
|
40
|
-
var SectionHeader = styled.div({
|
|
57
|
+
var SectionHeader = import_plugin_theme.styled.div({
|
|
41
58
|
display: "flex",
|
|
42
59
|
alignItems: "center",
|
|
43
60
|
gap: "6px",
|
|
44
61
|
padding: "10px 12px 4px"
|
|
45
62
|
});
|
|
46
|
-
var RunningCard = styled.div({
|
|
63
|
+
var RunningCard = import_plugin_theme.styled.div({
|
|
47
64
|
margin: "4px 12px 8px",
|
|
48
65
|
padding: "10px 12px",
|
|
49
66
|
borderRadius: "$border-radius-compact",
|
|
@@ -52,25 +69,25 @@ var RunningCard = styled.div({
|
|
|
52
69
|
cursor: "pointer",
|
|
53
70
|
"&:hover": { opacity: 0.85 }
|
|
54
71
|
});
|
|
55
|
-
var RunningHeader = styled.div({
|
|
72
|
+
var RunningHeader = import_plugin_theme.styled.div({
|
|
56
73
|
display: "flex",
|
|
57
74
|
alignItems: "center",
|
|
58
75
|
gap: "8px",
|
|
59
76
|
marginBottom: "6px"
|
|
60
77
|
});
|
|
61
|
-
var RunningControls = styled.div({
|
|
78
|
+
var RunningControls = import_plugin_theme.styled.div({
|
|
62
79
|
display: "flex",
|
|
63
80
|
gap: "4px",
|
|
64
81
|
marginLeft: "auto"
|
|
65
82
|
});
|
|
66
|
-
var QueueItem = styled.div({
|
|
83
|
+
var QueueItem = import_plugin_theme.styled.div({
|
|
67
84
|
display: "flex",
|
|
68
85
|
alignItems: "center",
|
|
69
86
|
gap: "8px",
|
|
70
87
|
padding: "6px 12px",
|
|
71
88
|
borderBottom: "1px solid $color-border-default"
|
|
72
89
|
});
|
|
73
|
-
var RunRow = styled.div({
|
|
90
|
+
var RunRow = import_plugin_theme.styled.div({
|
|
74
91
|
display: "flex",
|
|
75
92
|
alignItems: "center",
|
|
76
93
|
gap: "8px",
|
|
@@ -79,13 +96,13 @@ var RunRow = styled.div({
|
|
|
79
96
|
borderBottom: "1px solid $color-border-default",
|
|
80
97
|
"&:hover": { backgroundColor: "$color-surface-elevated" }
|
|
81
98
|
});
|
|
82
|
-
var RunText = styled.div({
|
|
99
|
+
var RunText = import_plugin_theme.styled.div({
|
|
83
100
|
flex: 1,
|
|
84
101
|
overflow: "hidden",
|
|
85
102
|
textOverflow: "ellipsis",
|
|
86
103
|
whiteSpace: "nowrap"
|
|
87
104
|
});
|
|
88
|
-
var KpiBar = styled.div({
|
|
105
|
+
var KpiBar = import_plugin_theme.styled.div({
|
|
89
106
|
display: "flex",
|
|
90
107
|
justifyContent: "center",
|
|
91
108
|
gap: "12px",
|
|
@@ -93,7 +110,7 @@ var KpiBar = styled.div({
|
|
|
93
110
|
borderTop: "1px solid $color-border-default",
|
|
94
111
|
flexShrink: 0
|
|
95
112
|
});
|
|
96
|
-
var EmptyState = styled.div({
|
|
113
|
+
var EmptyState = import_plugin_theme.styled.div({
|
|
97
114
|
display: "flex",
|
|
98
115
|
flexDirection: "column",
|
|
99
116
|
alignItems: "center",
|
|
@@ -129,13 +146,13 @@ function healthColor(score) {
|
|
|
129
146
|
return "var(--color-status-negative)";
|
|
130
147
|
}
|
|
131
148
|
function BotActivity({ packName, botId }) {
|
|
132
|
-
const [history, setHistory] = useState([]);
|
|
133
|
-
const [queue, setQueue] = useState([]);
|
|
134
|
-
const [insights, setInsights] = useState(null);
|
|
135
|
-
const [status, setStatus] = useState(null);
|
|
136
|
-
const [loading, setLoading] = useState(true);
|
|
137
|
-
const timerRef = useRef();
|
|
138
|
-
const fetchAll = useCallback(async () => {
|
|
149
|
+
const [history, setHistory] = (0, import_react.useState)([]);
|
|
150
|
+
const [queue, setQueue] = (0, import_react.useState)([]);
|
|
151
|
+
const [insights, setInsights] = (0, import_react.useState)(null);
|
|
152
|
+
const [status, setStatus] = (0, import_react.useState)(null);
|
|
153
|
+
const [loading, setLoading] = (0, import_react.useState)(true);
|
|
154
|
+
const timerRef = (0, import_react.useRef)();
|
|
155
|
+
const fetchAll = (0, import_react.useCallback)(async () => {
|
|
139
156
|
const [hist, q, ins, st] = await Promise.allSettled([
|
|
140
157
|
callTool("fw_weaver_history", { limit: 15 }),
|
|
141
158
|
callTool("fw_weaver_task_list", { status: "pending" }),
|
|
@@ -148,12 +165,12 @@ function BotActivity({ packName, botId }) {
|
|
|
148
165
|
if (st.status === "fulfilled") setStatus(st.value);
|
|
149
166
|
setLoading(false);
|
|
150
167
|
}, []);
|
|
151
|
-
useEffect(() => {
|
|
168
|
+
(0, import_react.useEffect)(() => {
|
|
152
169
|
fetchAll();
|
|
153
170
|
timerRef.current = setInterval(fetchAll, REFRESH_INTERVAL);
|
|
154
171
|
return () => clearInterval(timerRef.current);
|
|
155
172
|
}, [fetchAll]);
|
|
156
|
-
const openWorkspace = useCallback((runId, isLive) => {
|
|
173
|
+
const openWorkspace = (0, import_react.useCallback)((runId, isLive) => {
|
|
157
174
|
window.dispatchEvent(new CustomEvent("fw:open-bot-workspace", {
|
|
158
175
|
detail: {
|
|
159
176
|
runId,
|
|
@@ -163,77 +180,77 @@ function BotActivity({ packName, botId }) {
|
|
|
163
180
|
}
|
|
164
181
|
}));
|
|
165
182
|
}, [botId]);
|
|
166
|
-
const handleRemoveQueueItem = useCallback(async (id) => {
|
|
183
|
+
const handleRemoveQueueItem = (0, import_react.useCallback)(async (id) => {
|
|
167
184
|
await callTool("fw_weaver_task_cancel", { id });
|
|
168
185
|
setQueue((prev) => prev.filter((q) => q.id !== id));
|
|
169
186
|
}, []);
|
|
170
|
-
const handlePause = useCallback(async (e) => {
|
|
187
|
+
const handlePause = (0, import_react.useCallback)(async (e) => {
|
|
171
188
|
e.stopPropagation();
|
|
172
189
|
await callTool("fw_weaver_steer", { command: "pause" });
|
|
173
190
|
}, []);
|
|
174
|
-
const handleStop = useCallback(async (e) => {
|
|
191
|
+
const handleStop = (0, import_react.useCallback)(async (e) => {
|
|
175
192
|
e.stopPropagation();
|
|
176
193
|
await callTool("fw_weaver_steer", { command: "cancel" });
|
|
177
194
|
}, []);
|
|
178
|
-
if (loading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyState, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadingSpinner, { size: "small" }) });
|
|
195
|
+
if (loading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyState, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.LoadingSpinner, { size: "small" }) });
|
|
179
196
|
const isRunning = status?.state && status.state !== "idle" && status.state !== "no active session";
|
|
180
197
|
const recentRuns = history.slice(0, 15);
|
|
181
198
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Container, { children: [
|
|
182
199
|
isRunning && status && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
183
200
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SectionHeader, { children: [
|
|
184
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: "playArrow", size: 12, color: "color-brand-main" }),
|
|
185
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "smallCaption-bold", color: "color-text-subtle", style: { textTransform: "uppercase", letterSpacing: "0.04em" }, children: "Running" })
|
|
201
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Icon, { name: "playArrow", size: 12, color: "color-brand-main" }),
|
|
202
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-bold", color: "color-text-subtle", style: { textTransform: "uppercase", letterSpacing: "0.04em" }, children: "Running" })
|
|
186
203
|
] }),
|
|
187
204
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(RunningCard, { onClick: () => openWorkspace(void 0, true), children: [
|
|
188
205
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(RunningHeader, { children: [
|
|
189
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { variant: "info", children: status.state }),
|
|
206
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Badge, { variant: "info", children: status.state }),
|
|
190
207
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(RunningControls, { children: [
|
|
191
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconButton, { icon: "pause", size: "xs", variant: "clear", onClick: handlePause, title: "Pause" }),
|
|
192
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconButton, { icon: "stop", size: "xs", variant: "clear", onClick: handleStop, title: "Stop" })
|
|
208
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.IconButton, { icon: "pause", size: "xs", variant: "clear", onClick: handlePause, title: "Pause" }),
|
|
209
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.IconButton, { icon: "stop", size: "xs", variant: "clear", onClick: handleStop, title: "Stop" })
|
|
193
210
|
] })
|
|
194
211
|
] }),
|
|
195
|
-
status.currentTask && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "caption-regular", color: "color-text-medium", style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: status.currentTask })
|
|
212
|
+
status.currentTask && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-regular", color: "color-text-medium", style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: status.currentTask })
|
|
196
213
|
] })
|
|
197
214
|
] }),
|
|
198
215
|
queue.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
199
216
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SectionHeader, { children: [
|
|
200
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: "pendingActions", size: 12, color: "color-text-subtle" }),
|
|
201
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Typography, { variant: "smallCaption-bold", color: "color-text-subtle", style: { textTransform: "uppercase", letterSpacing: "0.04em" }, children: [
|
|
217
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Icon, { name: "pendingActions", size: 12, color: "color-text-subtle" }),
|
|
218
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Typography, { variant: "smallCaption-bold", color: "color-text-subtle", style: { textTransform: "uppercase", letterSpacing: "0.04em" }, children: [
|
|
202
219
|
"Queued (",
|
|
203
220
|
queue.length,
|
|
204
221
|
")"
|
|
205
222
|
] })
|
|
206
223
|
] }),
|
|
207
224
|
queue.map((q) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(QueueItem, { children: [
|
|
208
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: "pending", size: 14, color: "color-text-subtle" }),
|
|
209
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "caption-regular", color: "color-text-medium", style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: q.instruction }),
|
|
210
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconButton, { icon: "close", size: "xs", variant: "clear", onClick: () => handleRemoveQueueItem(q.id), title: "Remove" })
|
|
225
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Icon, { name: "pending", size: 14, color: "color-text-subtle" }),
|
|
226
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-regular", color: "color-text-medium", style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: q.instruction }),
|
|
227
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.IconButton, { icon: "close", size: "xs", variant: "clear", onClick: () => handleRemoveQueueItem(q.id), title: "Remove" })
|
|
211
228
|
] }, q.id))
|
|
212
229
|
] }),
|
|
213
230
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SectionHeader, { children: [
|
|
214
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: "scheduled", size: 12, color: "color-text-subtle" }),
|
|
215
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "smallCaption-bold", color: "color-text-subtle", style: { textTransform: "uppercase", letterSpacing: "0.04em" }, children: "Recent" }),
|
|
231
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Icon, { name: "scheduled", size: 12, color: "color-text-subtle" }),
|
|
232
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-bold", color: "color-text-subtle", style: { textTransform: "uppercase", letterSpacing: "0.04em" }, children: "Recent" }),
|
|
216
233
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { flex: 1 } }),
|
|
217
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconButton, { icon: "refresh", size: "xs", variant: "clear", onClick: fetchAll, title: "Refresh" })
|
|
234
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.IconButton, { icon: "refresh", size: "xs", variant: "clear", onClick: fetchAll, title: "Refresh" })
|
|
218
235
|
] }),
|
|
219
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScrollArea, { style: { flex: 1 }, children: recentRuns.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(EmptyState, { children: [
|
|
220
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: "info", size: 20, color: "color-text-subtle" }),
|
|
221
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "caption-regular", color: "color-text-subtle", children: "No recent runs. Ask Weaver to run a bot." })
|
|
236
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.ScrollArea, { style: { flex: 1 }, children: recentRuns.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(EmptyState, { children: [
|
|
237
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Icon, { name: "info", size: 20, color: "color-text-subtle" }),
|
|
238
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-regular", color: "color-text-subtle", children: "No recent runs. Ask Weaver to run a bot." })
|
|
222
239
|
] }) : recentRuns.map((run, i) => {
|
|
223
240
|
const oc = outcomeConfig[run.outcome] ?? { icon: "help", color: "color-text-subtle" };
|
|
224
241
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(RunRow, { onClick: () => openWorkspace(run.id), children: [
|
|
225
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: oc.icon, size: 14, color: oc.color }),
|
|
226
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RunText, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "caption-regular", color: "color-text-medium", children: run.summary ?? run.workflowFile ?? run.outcome }) }),
|
|
227
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "smallCaption-regular", color: "color-text-subtle", style: { fontFamily: "var(--typography-family-mono)", flexShrink: 0 }, children: formatTime(run.startedAt) })
|
|
242
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Icon, { name: oc.icon, size: 14, color: oc.color }),
|
|
243
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RunText, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-regular", color: "color-text-medium", children: run.summary ?? run.workflowFile ?? run.outcome }) }),
|
|
244
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-subtle", style: { fontFamily: "var(--typography-family-mono)", flexShrink: 0 }, children: formatTime(run.startedAt) })
|
|
228
245
|
] }, run.id ?? i);
|
|
229
246
|
}) }),
|
|
230
247
|
insights && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(KpiBar, { children: [
|
|
231
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Typography, { variant: "smallCaption-regular", color: "color-text-subtle", children: [
|
|
248
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-subtle", children: [
|
|
232
249
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { color: healthColor(insights.health?.overall ?? 0), fontWeight: 600 }, children: insights.health?.overall ?? 0 }),
|
|
233
250
|
" ",
|
|
234
251
|
"health"
|
|
235
252
|
] }),
|
|
236
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Typography, { variant: "smallCaption-regular", color: "color-text-subtle", children: [
|
|
253
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-subtle", children: [
|
|
237
254
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { style: { fontWeight: 600 }, children: [
|
|
238
255
|
"P",
|
|
239
256
|
insights.trust?.phase ?? "?"
|
|
@@ -241,7 +258,7 @@ function BotActivity({ packName, botId }) {
|
|
|
241
258
|
" ",
|
|
242
259
|
"trust"
|
|
243
260
|
] }),
|
|
244
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Typography, { variant: "smallCaption-regular", color: "color-text-subtle", children: [
|
|
261
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-subtle", children: [
|
|
245
262
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { style: { fontWeight: 600 }, children: [
|
|
246
263
|
"$",
|
|
247
264
|
(insights.cost?.last7Days ?? 0).toFixed(2)
|
|
@@ -251,4 +268,4 @@ function BotActivity({ packName, botId }) {
|
|
|
251
268
|
] })
|
|
252
269
|
] });
|
|
253
270
|
}
|
|
254
|
-
|
|
271
|
+
var bot_activity_default = BotActivity;
|
package/dist/ui/bot-config.js
CHANGED
|
@@ -1,18 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2
19
|
|
|
3
20
|
// src/ui/bot-config.tsx
|
|
21
|
+
var bot_config_exports = {};
|
|
22
|
+
__export(bot_config_exports, {
|
|
23
|
+
BotConfig: () => BotConfig,
|
|
24
|
+
default: () => bot_config_default
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(bot_config_exports);
|
|
27
|
+
var import_react = require("react");
|
|
28
|
+
var import_plugin_ui_kit = require("@fw/plugin-ui-kit");
|
|
29
|
+
var import_plugin_theme = require("@fw/plugin-theme");
|
|
4
30
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
-
var React = require("react");
|
|
6
|
-
var { useState, useEffect, useCallback } = React;
|
|
7
|
-
var { Typography } = require("@fw/plugin-ui-kit");
|
|
8
|
-
var { CollapsibleSection } = require("@fw/plugin-ui-kit");
|
|
9
|
-
var { LoadingSpinner } = require("@fw/plugin-ui-kit");
|
|
10
|
-
var { Banner } = require("@fw/plugin-ui-kit");
|
|
11
|
-
var { IconButton } = require("@fw/plugin-ui-kit");
|
|
12
|
-
var { Badge } = require("@fw/plugin-ui-kit");
|
|
13
|
-
var { styled } = require("@fw/plugin-theme");
|
|
14
31
|
var BASE = "/api/pack-tool/@synergenius/flow-weaver-pack-weaver";
|
|
15
|
-
var ConfigRow = styled.div({
|
|
32
|
+
var ConfigRow = import_plugin_theme.styled.div({
|
|
16
33
|
display: "flex",
|
|
17
34
|
justifyContent: "space-between",
|
|
18
35
|
alignItems: "center",
|
|
@@ -20,7 +37,7 @@ var ConfigRow = styled.div({
|
|
|
20
37
|
borderBottom: "1px solid $color-border-default",
|
|
21
38
|
"&:last-of-type": { borderBottom: "none" }
|
|
22
39
|
});
|
|
23
|
-
var Footer = styled.div({
|
|
40
|
+
var Footer = import_plugin_theme.styled.div({
|
|
24
41
|
display: "flex",
|
|
25
42
|
justifyContent: "space-between",
|
|
26
43
|
alignItems: "center",
|
|
@@ -46,11 +63,11 @@ function callTool(tool, body = {}) {
|
|
|
46
63
|
});
|
|
47
64
|
}
|
|
48
65
|
function BotConfig({ packName, botId }) {
|
|
49
|
-
const [insights, setInsights] = useState(null);
|
|
50
|
-
const [providers, setProviders] = useState([]);
|
|
51
|
-
const [error, setError] = useState(null);
|
|
52
|
-
const [loading, setLoading] = useState(true);
|
|
53
|
-
const fetchData = useCallback(async () => {
|
|
66
|
+
const [insights, setInsights] = (0, import_react.useState)(null);
|
|
67
|
+
const [providers, setProviders] = (0, import_react.useState)([]);
|
|
68
|
+
const [error, setError] = (0, import_react.useState)(null);
|
|
69
|
+
const [loading, setLoading] = (0, import_react.useState)(true);
|
|
70
|
+
const fetchData = (0, import_react.useCallback)(async () => {
|
|
54
71
|
try {
|
|
55
72
|
const [ins, provs] = await Promise.allSettled([
|
|
56
73
|
callTool("fw_weaver_insights"),
|
|
@@ -65,11 +82,11 @@ function BotConfig({ packName, botId }) {
|
|
|
65
82
|
setLoading(false);
|
|
66
83
|
}
|
|
67
84
|
}, []);
|
|
68
|
-
useEffect(() => {
|
|
85
|
+
(0, import_react.useEffect)(() => {
|
|
69
86
|
fetchData();
|
|
70
87
|
}, [fetchData]);
|
|
71
|
-
if (loading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: 16, display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadingSpinner, { size: "small" }) });
|
|
72
|
-
if (error && !insights) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: "8px 12px" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Banner, { status: "danger", size: "small", children: error }) });
|
|
88
|
+
if (loading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: 16, display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.LoadingSpinner, { size: "small" }) });
|
|
89
|
+
if (error && !insights) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: "8px 12px" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Banner, { status: "danger", size: "small", children: error }) });
|
|
73
90
|
const bot = insights?.bots?.find((b) => b.name === botId) ?? insights?.bots?.[0];
|
|
74
91
|
const configuredProvider = bot?.provider;
|
|
75
92
|
const availableProvider = providers.find((p) => p.envVarsSet);
|
|
@@ -79,21 +96,21 @@ function BotConfig({ packName, botId }) {
|
|
|
79
96
|
const trustPhase = insights?.trust?.phase ?? 1;
|
|
80
97
|
const trustScore = insights?.trust?.score ?? 0;
|
|
81
98
|
const noProvider = !activeProvider;
|
|
82
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsibleSection, { title: "Configuration", defaultExpanded: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { padding: "4px 12px 12px" }, children: [
|
|
99
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.CollapsibleSection, { title: "Configuration", defaultExpanded: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { padding: "4px 12px 12px" }, children: [
|
|
83
100
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ConfigRow, { children: [
|
|
84
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "smallCaption-bold", color: "color-text-subtle", children: "Provider" }),
|
|
101
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-bold", color: "color-text-subtle", children: "Provider" }),
|
|
85
102
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
86
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "caption-regular", color: "color-text-high", children: activeProvider ?? "None detected" }),
|
|
87
|
-
isAutoDetected && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { variant: "default", children: "auto" })
|
|
103
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-regular", color: "color-text-high", children: activeProvider ?? "None detected" }),
|
|
104
|
+
isAutoDetected && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Badge, { variant: "default", children: "auto" })
|
|
88
105
|
] })
|
|
89
106
|
] }),
|
|
90
107
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ConfigRow, { children: [
|
|
91
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "smallCaption-bold", color: "color-text-subtle", children: "Approval" }),
|
|
92
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "caption-regular", color: "color-text-high", children: approval })
|
|
108
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-bold", color: "color-text-subtle", children: "Approval" }),
|
|
109
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-regular", color: "color-text-high", children: approval })
|
|
93
110
|
] }),
|
|
94
111
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ConfigRow, { children: [
|
|
95
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "smallCaption-bold", color: "color-text-subtle", children: "Trust" }),
|
|
96
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Typography, { variant: "caption-regular", color: "color-text-high", children: [
|
|
112
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-bold", color: "color-text-subtle", children: "Trust" }),
|
|
113
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Typography, { variant: "caption-regular", color: "color-text-high", children: [
|
|
97
114
|
"P",
|
|
98
115
|
trustPhase,
|
|
99
116
|
" (",
|
|
@@ -101,11 +118,11 @@ function BotConfig({ packName, botId }) {
|
|
|
101
118
|
"/100)"
|
|
102
119
|
] })
|
|
103
120
|
] }),
|
|
104
|
-
noProvider && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { marginTop: 10 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Banner, { status: "warning", size: "small", children: "No AI provider detected. Set ANTHROPIC_API_KEY or install Claude CLI." }) }),
|
|
121
|
+
noProvider && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { marginTop: 10 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Banner, { status: "warning", size: "small", children: "No AI provider detected. Set ANTHROPIC_API_KEY or install Claude CLI." }) }),
|
|
105
122
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Footer, { children: [
|
|
106
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "smallCaption-regular", color: "color-text-subtle", children: "Customize via .weaver.json" }),
|
|
107
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconButton, { icon: "refresh", size: "xs", variant: "clear", onClick: fetchData, title: "Refresh" })
|
|
123
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-subtle", children: "Customize via .weaver.json" }),
|
|
124
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.IconButton, { icon: "refresh", size: "xs", variant: "clear", onClick: fetchData, title: "Refresh" })
|
|
108
125
|
] })
|
|
109
126
|
] }) });
|
|
110
127
|
}
|
|
111
|
-
|
|
128
|
+
var bot_config_default = BotConfig;
|
package/dist/ui/bot-dashboard.js
CHANGED
|
@@ -1,17 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2
19
|
|
|
3
20
|
// src/ui/bot-dashboard.tsx
|
|
21
|
+
var bot_dashboard_exports = {};
|
|
22
|
+
__export(bot_dashboard_exports, {
|
|
23
|
+
BotDashboard: () => BotDashboard,
|
|
24
|
+
default: () => bot_dashboard_default
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(bot_dashboard_exports);
|
|
27
|
+
var import_react = require("react");
|
|
28
|
+
var import_plugin_ui_kit = require("@fw/plugin-ui-kit");
|
|
29
|
+
var import_plugin_theme = require("@fw/plugin-theme");
|
|
4
30
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
-
var React = require("react");
|
|
6
|
-
var { useState, useEffect, useCallback, useRef } = React;
|
|
7
|
-
var { Typography } = require("@fw/plugin-ui-kit");
|
|
8
|
-
var { Icon } = require("@fw/plugin-ui-kit");
|
|
9
|
-
var { Badge } = require("@fw/plugin-ui-kit");
|
|
10
|
-
var { CollapsibleSection } = require("@fw/plugin-ui-kit");
|
|
11
|
-
var { LoadingSpinner } = require("@fw/plugin-ui-kit");
|
|
12
|
-
var { Banner } = require("@fw/plugin-ui-kit");
|
|
13
|
-
var { IconButton } = require("@fw/plugin-ui-kit");
|
|
14
|
-
var { styled } = require("@fw/plugin-theme");
|
|
15
31
|
var BASE = "/api/pack-tool/@synergenius/flow-weaver-pack-weaver";
|
|
16
32
|
function callTool(tool, body = {}) {
|
|
17
33
|
return fetch(`${BASE}/${tool}`, {
|
|
@@ -30,38 +46,38 @@ function callTool(tool, body = {}) {
|
|
|
30
46
|
}
|
|
31
47
|
});
|
|
32
48
|
}
|
|
33
|
-
var KpiRow = styled.div({
|
|
49
|
+
var KpiRow = import_plugin_theme.styled.div({
|
|
34
50
|
display: "flex",
|
|
35
51
|
gap: "8px",
|
|
36
52
|
marginBottom: "12px"
|
|
37
53
|
});
|
|
38
|
-
var KpiCard = styled.div({
|
|
54
|
+
var KpiCard = import_plugin_theme.styled.div({
|
|
39
55
|
flex: 1,
|
|
40
56
|
padding: "8px 10px",
|
|
41
57
|
borderRadius: "6px",
|
|
42
58
|
border: "1px solid $color-border-default",
|
|
43
59
|
backgroundColor: "$color-surface-elevated"
|
|
44
60
|
});
|
|
45
|
-
var KpiValue = styled.div({
|
|
61
|
+
var KpiValue = import_plugin_theme.styled.div({
|
|
46
62
|
fontSize: "20px",
|
|
47
63
|
fontWeight: 700,
|
|
48
64
|
lineHeight: 1.2
|
|
49
65
|
});
|
|
50
|
-
var KpiLabel = styled.div({
|
|
66
|
+
var KpiLabel = import_plugin_theme.styled.div({
|
|
51
67
|
fontSize: "10px",
|
|
52
68
|
opacity: 0.5,
|
|
53
69
|
textTransform: "uppercase",
|
|
54
70
|
letterSpacing: "0.04em",
|
|
55
71
|
marginTop: "2px"
|
|
56
72
|
});
|
|
57
|
-
var InsightRow = styled.div({
|
|
73
|
+
var InsightRow = import_plugin_theme.styled.div({
|
|
58
74
|
display: "flex",
|
|
59
75
|
alignItems: "center",
|
|
60
76
|
gap: "8px",
|
|
61
77
|
padding: "5px 0",
|
|
62
78
|
borderBottom: "1px solid $color-border-default"
|
|
63
79
|
});
|
|
64
|
-
var RunRow = styled.div({
|
|
80
|
+
var RunRow = import_plugin_theme.styled.div({
|
|
65
81
|
display: "flex",
|
|
66
82
|
alignItems: "center",
|
|
67
83
|
gap: "8px",
|
|
@@ -100,12 +116,12 @@ function formatTime(iso) {
|
|
|
100
116
|
}
|
|
101
117
|
}
|
|
102
118
|
function BotDashboard({ packName, botId }) {
|
|
103
|
-
const [insights, setInsights] = useState(null);
|
|
104
|
-
const [history, setHistory] = useState([]);
|
|
105
|
-
const [error, setError] = useState(null);
|
|
106
|
-
const [loading, setLoading] = useState(true);
|
|
107
|
-
const timerRef = useRef();
|
|
108
|
-
const fetchData = useCallback(async () => {
|
|
119
|
+
const [insights, setInsights] = (0, import_react.useState)(null);
|
|
120
|
+
const [history, setHistory] = (0, import_react.useState)([]);
|
|
121
|
+
const [error, setError] = (0, import_react.useState)(null);
|
|
122
|
+
const [loading, setLoading] = (0, import_react.useState)(true);
|
|
123
|
+
const timerRef = (0, import_react.useRef)();
|
|
124
|
+
const fetchData = (0, import_react.useCallback)(async () => {
|
|
109
125
|
try {
|
|
110
126
|
const [ins, hist] = await Promise.allSettled([
|
|
111
127
|
callTool("fw_weaver_insights"),
|
|
@@ -124,20 +140,20 @@ function BotDashboard({ packName, botId }) {
|
|
|
124
140
|
setLoading(false);
|
|
125
141
|
}
|
|
126
142
|
}, []);
|
|
127
|
-
useEffect(() => {
|
|
143
|
+
(0, import_react.useEffect)(() => {
|
|
128
144
|
fetchData();
|
|
129
145
|
timerRef.current = setInterval(fetchData, 3e4);
|
|
130
146
|
return () => clearInterval(timerRef.current);
|
|
131
147
|
}, [fetchData]);
|
|
132
|
-
if (loading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: 16, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadingSpinner, { size: "small" }) });
|
|
133
|
-
if (error && !insights) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Banner, { status: "danger", size: "small", children: error }) });
|
|
148
|
+
if (loading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: 16, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.LoadingSpinner, { size: "small" }) });
|
|
149
|
+
if (error && !insights) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Banner, { status: "danger", size: "small", children: error }) });
|
|
134
150
|
if (!insights) return null;
|
|
135
151
|
const healthScore = insights.health?.overall ?? 0;
|
|
136
152
|
const trust = insights.trust ?? { phase: 1, score: 0 };
|
|
137
153
|
const cost = insights.cost ?? { last7Days: 0, trend: "stable" };
|
|
138
154
|
const topInsights = (insights.insights ?? []).slice(0, 3);
|
|
139
155
|
const recentRuns = history.slice(0, 5);
|
|
140
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsibleSection, { title: "Dashboard", defaultExpanded: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { padding: "4px 12px 12px" }, children: [
|
|
156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.CollapsibleSection, { title: "Dashboard", defaultExpanded: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { padding: "4px 12px 12px" }, children: [
|
|
141
157
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(KpiRow, { children: [
|
|
142
158
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(KpiCard, { children: [
|
|
143
159
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(KpiValue, { style: { color: healthColor(healthScore) }, children: healthScore }),
|
|
@@ -163,25 +179,25 @@ function BotDashboard({ packName, botId }) {
|
|
|
163
179
|
] })
|
|
164
180
|
] }),
|
|
165
181
|
topInsights.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { marginBottom: 12 }, children: [
|
|
166
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "smallCaption-bold", color: "color-text-subtle", style: { marginBottom: 6, textTransform: "uppercase", letterSpacing: "0.04em" }, children: "Insights" }),
|
|
182
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-bold", color: "color-text-subtle", style: { marginBottom: 6, textTransform: "uppercase", letterSpacing: "0.04em" }, children: "Insights" }),
|
|
167
183
|
topInsights.map((ins, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(InsightRow, { children: [
|
|
168
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { variant: severityToVariant[ins.severity] ?? "default", children: ins.severity }),
|
|
169
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "caption-regular", color: "color-text-medium", style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: ins.title })
|
|
184
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Badge, { variant: severityToVariant[ins.severity] ?? "default", children: ins.severity }),
|
|
185
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-regular", color: "color-text-medium", style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: ins.title })
|
|
170
186
|
] }, i))
|
|
171
187
|
] }),
|
|
172
188
|
recentRuns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { marginBottom: 8 }, children: [
|
|
173
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "smallCaption-bold", color: "color-text-subtle", style: { marginBottom: 6, textTransform: "uppercase", letterSpacing: "0.04em" }, children: "Recent Runs" }),
|
|
189
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-bold", color: "color-text-subtle", style: { marginBottom: 6, textTransform: "uppercase", letterSpacing: "0.04em" }, children: "Recent Runs" }),
|
|
174
190
|
recentRuns.map((run, i) => {
|
|
175
191
|
const oc = outcomeToIcon[run.outcome] ?? { name: "help", color: "color-text-subtle" };
|
|
176
192
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(RunRow, { children: [
|
|
177
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: oc.name, size: 14, color: oc.color }),
|
|
178
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "caption-regular", color: "color-text-medium", style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: run.summary ?? run.workflowFile ?? run.outcome }),
|
|
179
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "smallCaption-regular", color: "color-text-subtle", style: { fontFamily: "var(--typography-family-mono)" }, children: formatTime(run.startedAt) })
|
|
193
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Icon, { name: oc.name, size: 14, color: oc.color }),
|
|
194
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-regular", color: "color-text-medium", style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: run.summary ?? run.workflowFile ?? run.outcome }),
|
|
195
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-subtle", style: { fontFamily: "var(--typography-family-mono)" }, children: formatTime(run.startedAt) })
|
|
180
196
|
] }, run.id ?? i);
|
|
181
197
|
})
|
|
182
198
|
] }),
|
|
183
|
-
topInsights.length === 0 && recentRuns.length === 0 && healthScore === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "caption-regular", color: "color-text-subtle", style: { textAlign: "center", padding: 20 }, children: "No data yet. Run a bot to see dashboard metrics." }),
|
|
184
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { display: "flex", justifyContent: "flex-end", marginTop: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconButton, { icon: "refresh", size: "xs", variant: "clear", onClick: fetchData, title: "Refresh" }) })
|
|
199
|
+
topInsights.length === 0 && recentRuns.length === 0 && healthScore === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-regular", color: "color-text-subtle", style: { textAlign: "center", padding: 20 }, children: "No data yet. Run a bot to see dashboard metrics." }),
|
|
200
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { display: "flex", justifyContent: "flex-end", marginTop: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.IconButton, { icon: "refresh", size: "xs", variant: "clear", onClick: fetchData, title: "Refresh" }) })
|
|
185
201
|
] }) });
|
|
186
202
|
}
|
|
187
|
-
|
|
203
|
+
var bot_dashboard_default = BotDashboard;
|