@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
|
@@ -24,22 +24,22 @@ __export(settings_section_exports, {
|
|
|
24
24
|
default: () => settings_section_default
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(settings_section_exports);
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
var
|
|
27
|
+
var import_react = require("react");
|
|
28
|
+
var import_plugin_ui_kit = require("@fw/plugin-ui-kit");
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
30
|
function SettingsSection({ callTool, dispatchEvent }) {
|
|
31
|
-
const [providers, setProviders] = useState([]);
|
|
32
|
-
const [insights, setInsights] = useState(null);
|
|
33
|
-
const handleClear = useCallback(() => {
|
|
31
|
+
const [providers, setProviders] = (0, import_react.useState)([]);
|
|
32
|
+
const [insights, setInsights] = (0, import_react.useState)(null);
|
|
33
|
+
const handleClear = (0, import_react.useCallback)(() => {
|
|
34
34
|
if (!confirm("Clear all bot run history? This action cannot be undone.")) return;
|
|
35
35
|
callTool("fw_weaver_history", { clear: true }).then(() => {
|
|
36
36
|
dispatchEvent("fw:refresh-bot-workspace");
|
|
37
|
-
toast("Run history cleared", { type: "success" });
|
|
37
|
+
(0, import_plugin_ui_kit.toast)("Run history cleared", { type: "success" });
|
|
38
38
|
}).catch(() => {
|
|
39
|
-
toast("Failed to clear history", { type: "error" });
|
|
39
|
+
(0, import_plugin_ui_kit.toast)("Failed to clear history", { type: "error" });
|
|
40
40
|
});
|
|
41
41
|
}, [callTool, dispatchEvent]);
|
|
42
|
-
useEffect(() => {
|
|
42
|
+
(0, import_react.useEffect)(() => {
|
|
43
43
|
Promise.all([
|
|
44
44
|
callTool("fw_weaver_providers"),
|
|
45
45
|
callTool("fw_weaver_insights")
|
|
@@ -51,54 +51,50 @@ function SettingsSection({ callTool, dispatchEvent }) {
|
|
|
51
51
|
const activeProvider = providers.find((p) => p.envVarsSet) ?? providers[0];
|
|
52
52
|
const trustScore = insights?.trust?.score;
|
|
53
53
|
const trustDisplay = trustScore != null ? (trustScore <= 1 ? (trustScore * 100).toFixed(0) : Math.round(trustScore)) + "%" : "\u2014";
|
|
54
|
-
return
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
variant: "list",
|
|
59
|
-
defaultExpanded: false
|
|
60
|
-
},
|
|
61
|
-
React.createElement(
|
|
62
|
-
Flex,
|
|
63
|
-
{ variant: "column-start-start-nowrap-4", style: { width: "100%" } },
|
|
64
|
-
activeProvider && React.createElement(KeyValueRow, {
|
|
54
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.CollapsibleSection, { title: "Settings", variant: "list", defaultExpanded: false, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "column-start-start-nowrap-4", style: { width: "100%" }, children: [
|
|
55
|
+
activeProvider && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
56
|
+
import_plugin_ui_kit.KeyValueRow,
|
|
57
|
+
{
|
|
65
58
|
keyName: "Provider",
|
|
66
59
|
value: `${activeProvider.name} (${activeProvider.source})`,
|
|
67
60
|
size: "small"
|
|
68
|
-
}
|
|
69
|
-
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
insights?.trust && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
64
|
+
import_plugin_ui_kit.KeyValueRow,
|
|
65
|
+
{
|
|
70
66
|
keyName: "Trust",
|
|
71
67
|
value: `Phase ${insights.trust.phase} \xB7 ${trustDisplay}`,
|
|
72
68
|
size: "small"
|
|
73
|
-
}
|
|
74
|
-
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
insights?.health && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
72
|
+
import_plugin_ui_kit.KeyValueRow,
|
|
73
|
+
{
|
|
75
74
|
keyName: "Health",
|
|
76
75
|
value: `${insights.health.overall}/100`,
|
|
77
76
|
size: "small"
|
|
78
|
-
}
|
|
79
|
-
|
|
77
|
+
}
|
|
78
|
+
),
|
|
79
|
+
insights?.cost && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
80
|
+
import_plugin_ui_kit.KeyValueRow,
|
|
81
|
+
{
|
|
80
82
|
keyName: "Cost (7d)",
|
|
81
83
|
value: `$${insights.cost.last7Days?.toFixed(2) ?? "0.00"} \xB7 ${insights.cost.trend ?? "stable"}`,
|
|
82
84
|
size: "small"
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
size: "xs",
|
|
92
|
-
variant: "
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}, "Clear Run History"),
|
|
96
|
-
React.createElement(Typography, {
|
|
97
|
-
variant: "smallCaption-regular",
|
|
98
|
-
color: "color-text-subtle"
|
|
99
|
-
}, "Edit settings in .weaver.json")
|
|
100
|
-
)
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
88
|
+
import_plugin_ui_kit.Flex,
|
|
89
|
+
{
|
|
90
|
+
variant: "row-center-space-between-nowrap-8",
|
|
91
|
+
style: { width: "100%", marginTop: "4px" },
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Button, { size: "xs", variant: "outlined", color: "danger", onClick: handleClear, children: "Clear Run History" }),
|
|
94
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-subtle", children: "Edit settings in .weaver.json" })
|
|
95
|
+
]
|
|
96
|
+
}
|
|
101
97
|
)
|
|
102
|
-
);
|
|
98
|
+
] }) });
|
|
103
99
|
}
|
|
104
100
|
var settings_section_default = SettingsSection;
|
|
@@ -24,17 +24,9 @@ __export(swarm_controls_exports, {
|
|
|
24
24
|
default: () => swarm_controls_default
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(swarm_controls_exports);
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
Flex,
|
|
31
|
-
Button,
|
|
32
|
-
Typography,
|
|
33
|
-
IconButton,
|
|
34
|
-
StatusIcon,
|
|
35
|
-
toast,
|
|
36
|
-
usePackWorkspace
|
|
37
|
-
} = require("@fw/plugin-ui-kit");
|
|
27
|
+
var import_react = require("react");
|
|
28
|
+
var import_plugin_ui_kit = require("@fw/plugin-ui-kit");
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
30
|
function swarmStatusToIconStatus(status) {
|
|
39
31
|
switch (status) {
|
|
40
32
|
case "running":
|
|
@@ -67,10 +59,16 @@ function countActiveInstances(instances) {
|
|
|
67
59
|
return { active, total: entries.length };
|
|
68
60
|
}
|
|
69
61
|
function SwarmControls({ swarmStatus, onRefresh }) {
|
|
70
|
-
const ctx = usePackWorkspace();
|
|
71
|
-
const [starting, setStarting] = useState(false);
|
|
72
|
-
const [pausing, setPausing] = useState(false);
|
|
73
|
-
const [stopping, setStopping] = useState(false);
|
|
62
|
+
const ctx = (0, import_plugin_ui_kit.usePackWorkspace)();
|
|
63
|
+
const [starting, setStarting] = (0, import_react.useState)(false);
|
|
64
|
+
const [pausing, setPausing] = (0, import_react.useState)(false);
|
|
65
|
+
const [stopping, setStopping] = (0, import_react.useState)(false);
|
|
66
|
+
const [showStartConfig, setShowStartConfig] = (0, import_react.useState)(false);
|
|
67
|
+
const [maxConcurrent, setMaxConcurrent] = (0, import_react.useState)(5);
|
|
68
|
+
const [sessionTokenBudget, setSessionTokenBudget] = (0, import_react.useState)("");
|
|
69
|
+
const [sessionCostBudget, setSessionCostBudget] = (0, import_react.useState)("");
|
|
70
|
+
const [editingConcurrency, setEditingConcurrency] = (0, import_react.useState)(false);
|
|
71
|
+
const [liveConcurrency, setLiveConcurrency] = (0, import_react.useState)("");
|
|
74
72
|
const status = swarmStatus?.status ?? "idle";
|
|
75
73
|
const instances = swarmStatus?.instances ?? {};
|
|
76
74
|
const { active, total } = countActiveInstances(instances);
|
|
@@ -78,58 +76,52 @@ function SwarmControls({ swarmStatus, onRefresh }) {
|
|
|
78
76
|
const isRunning = status === "running";
|
|
79
77
|
const isPaused = status === "paused";
|
|
80
78
|
const isStopping = status === "stopping";
|
|
81
|
-
const
|
|
79
|
+
const handleStartWithConfig = (0, import_react.useCallback)(async () => {
|
|
82
80
|
setStarting(true);
|
|
83
81
|
try {
|
|
84
|
-
const
|
|
82
|
+
const args = {};
|
|
83
|
+
if (maxConcurrent > 0) args.maxConcurrent = maxConcurrent;
|
|
84
|
+
const st = parseInt(sessionTokenBudget, 10);
|
|
85
|
+
if (st > 0) args.sessionBudgetTokens = st;
|
|
86
|
+
const sc = parseFloat(sessionCostBudget);
|
|
87
|
+
if (sc > 0) args.sessionBudgetCost = sc;
|
|
88
|
+
const result = await ctx.callTool("fw_weaver_swarm_start", args);
|
|
85
89
|
const data = result;
|
|
86
90
|
if (data?.error) {
|
|
87
|
-
toast(String(data.error), { type: "error" });
|
|
91
|
+
(0, import_plugin_ui_kit.toast)(String(data.error), { type: "error" });
|
|
88
92
|
} else {
|
|
89
|
-
toast("Swarm started", { type: "success" });
|
|
93
|
+
(0, import_plugin_ui_kit.toast)("Swarm started", { type: "success" });
|
|
94
|
+
setShowStartConfig(false);
|
|
90
95
|
}
|
|
91
96
|
onRefresh();
|
|
92
97
|
} catch (err) {
|
|
93
|
-
|
|
94
|
-
toast(msg, { type: "error" });
|
|
98
|
+
(0, import_plugin_ui_kit.toast)(err instanceof Error ? err.message : "Failed to start swarm", { type: "error" });
|
|
95
99
|
}
|
|
96
100
|
setStarting(false);
|
|
97
|
-
}, [ctx, onRefresh]);
|
|
98
|
-
const handlePause = useCallback(async () => {
|
|
101
|
+
}, [ctx, onRefresh, maxConcurrent, sessionTokenBudget, sessionCostBudget]);
|
|
102
|
+
const handlePause = (0, import_react.useCallback)(async () => {
|
|
99
103
|
setPausing(true);
|
|
100
104
|
try {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (data?.error) {
|
|
104
|
-
toast(String(data.error), { type: "error" });
|
|
105
|
-
} else {
|
|
106
|
-
toast("Swarm paused", { type: "info" });
|
|
107
|
-
}
|
|
105
|
+
await ctx.callTool("fw_weaver_swarm_pause", {});
|
|
106
|
+
(0, import_plugin_ui_kit.toast)("Swarm paused", { type: "info" });
|
|
108
107
|
onRefresh();
|
|
109
108
|
} catch (err) {
|
|
110
|
-
|
|
111
|
-
toast(msg, { type: "error" });
|
|
109
|
+
(0, import_plugin_ui_kit.toast)(err instanceof Error ? err.message : "Failed to pause", { type: "error" });
|
|
112
110
|
}
|
|
113
111
|
setPausing(false);
|
|
114
112
|
}, [ctx, onRefresh]);
|
|
115
|
-
const handleResume = useCallback(async () => {
|
|
113
|
+
const handleResume = (0, import_react.useCallback)(async () => {
|
|
116
114
|
setStarting(true);
|
|
117
115
|
try {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
if (data?.error) {
|
|
121
|
-
toast(String(data.error), { type: "error" });
|
|
122
|
-
} else {
|
|
123
|
-
toast("Swarm resumed", { type: "success" });
|
|
124
|
-
}
|
|
116
|
+
await ctx.callTool("fw_weaver_swarm_start", {});
|
|
117
|
+
(0, import_plugin_ui_kit.toast)("Swarm resumed", { type: "success" });
|
|
125
118
|
onRefresh();
|
|
126
119
|
} catch (err) {
|
|
127
|
-
|
|
128
|
-
toast(msg, { type: "error" });
|
|
120
|
+
(0, import_plugin_ui_kit.toast)(err instanceof Error ? err.message : "Failed to resume", { type: "error" });
|
|
129
121
|
}
|
|
130
122
|
setStarting(false);
|
|
131
123
|
}, [ctx, onRefresh]);
|
|
132
|
-
const handleStop = useCallback(async () => {
|
|
124
|
+
const handleStop = (0, import_react.useCallback)(async () => {
|
|
133
125
|
setStopping(true);
|
|
134
126
|
const ok = await ctx.confirm("This will stop all running instances and abort active tasks.", {
|
|
135
127
|
title: "Stop Swarm",
|
|
@@ -141,105 +133,190 @@ function SwarmControls({ swarmStatus, onRefresh }) {
|
|
|
141
133
|
return;
|
|
142
134
|
}
|
|
143
135
|
try {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
if (data?.error) {
|
|
147
|
-
toast(String(data.error), { type: "error" });
|
|
148
|
-
} else {
|
|
149
|
-
toast("Swarm stopped", { type: "info" });
|
|
150
|
-
}
|
|
136
|
+
await ctx.callTool("fw_weaver_swarm_stop", {});
|
|
137
|
+
(0, import_plugin_ui_kit.toast)("Swarm stopped", { type: "info" });
|
|
151
138
|
onRefresh();
|
|
152
139
|
} catch (err) {
|
|
153
|
-
|
|
154
|
-
toast(msg, { type: "error" });
|
|
140
|
+
(0, import_plugin_ui_kit.toast)(err instanceof Error ? err.message : "Failed to stop", { type: "error" });
|
|
155
141
|
}
|
|
156
142
|
setStopping(false);
|
|
157
143
|
}, [ctx, onRefresh]);
|
|
144
|
+
const handleConcurrencyChange = (0, import_react.useCallback)(async () => {
|
|
145
|
+
const mc = parseInt(liveConcurrency, 10);
|
|
146
|
+
if (!mc || mc < 1) {
|
|
147
|
+
setEditingConcurrency(false);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
try {
|
|
151
|
+
await ctx.callTool("fw_weaver_swarm_config", { maxConcurrent: mc });
|
|
152
|
+
(0, import_plugin_ui_kit.toast)(`Max concurrency set to ${mc}`, { type: "success" });
|
|
153
|
+
onRefresh();
|
|
154
|
+
} catch (err) {
|
|
155
|
+
(0, import_plugin_ui_kit.toast)(err instanceof Error ? err.message : "Failed to update config", { type: "error" });
|
|
156
|
+
}
|
|
157
|
+
setEditingConcurrency(false);
|
|
158
|
+
}, [ctx, onRefresh, liveConcurrency]);
|
|
158
159
|
const anyLoading = starting || pausing || stopping;
|
|
159
|
-
return
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
variant: "row-center-space-between-nowrap-10",
|
|
163
|
-
style: {
|
|
164
|
-
padding: "8px 16px",
|
|
165
|
-
borderBottom: "1px solid var(--color-border-default)",
|
|
166
|
-
flexShrink: 0,
|
|
167
|
-
backgroundColor: isRunning ? "var(--color-brand-main-alpha-10)" : isPaused ? "var(--color-status-caution-alpha-10)" : "transparent"
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
// Left: status icon + label
|
|
171
|
-
React.createElement(
|
|
172
|
-
Flex,
|
|
173
|
-
{ variant: "row-center-start-nowrap-8", style: { flexShrink: 0 } },
|
|
174
|
-
React.createElement(StatusIcon, {
|
|
175
|
-
status: swarmStatusToIconStatus(status),
|
|
176
|
-
size: "sm"
|
|
177
|
-
}),
|
|
178
|
-
React.createElement(Typography, {
|
|
179
|
-
variant: "caption-bold"
|
|
180
|
-
}, statusLabel(status))
|
|
181
|
-
),
|
|
182
|
-
// Center: bot count + stats
|
|
183
|
-
React.createElement(
|
|
184
|
-
Flex,
|
|
160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "column-stretch-start-nowrap-0", children: [
|
|
161
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
162
|
+
import_plugin_ui_kit.Section,
|
|
185
163
|
{
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
variant: "
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
164
|
+
padding: "compact",
|
|
165
|
+
border: "bottom",
|
|
166
|
+
shrink: true,
|
|
167
|
+
background: isRunning ? "none" : isPaused ? "none" : "none",
|
|
168
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "row-center-space-between-nowrap-10", children: [
|
|
169
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "row-center-start-nowrap-8", children: [
|
|
170
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
171
|
+
import_plugin_ui_kit.StatusIcon,
|
|
172
|
+
{
|
|
173
|
+
status: swarmStatusToIconStatus(status),
|
|
174
|
+
size: "sm"
|
|
175
|
+
}
|
|
176
|
+
),
|
|
177
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-bold", children: statusLabel(status) })
|
|
178
|
+
] }),
|
|
179
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "row-center-start-nowrap-12", children: [
|
|
180
|
+
total > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-regular", color: "color-text-medium", children: `${active}/${total} bots active` }),
|
|
181
|
+
(isRunning || isPaused) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-regular", color: "color-text-subtle", children: `max ${swarmStatus?.maxConcurrent ?? "?"}` }),
|
|
182
|
+
swarmStatus && swarmStatus.tasksCompleted > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-regular", color: "color-text-subtle", children: `${swarmStatus.tasksCompleted} done` }),
|
|
183
|
+
swarmStatus && swarmStatus.runsIncomplete > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-regular", color: "color-status-negative", children: `${swarmStatus.runsIncomplete} incomplete` })
|
|
184
|
+
] }),
|
|
185
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "row-center-start-nowrap-4", children: [
|
|
186
|
+
isIdle && !showStartConfig && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
187
|
+
import_plugin_ui_kit.Button,
|
|
188
|
+
{
|
|
189
|
+
size: "xs",
|
|
190
|
+
variant: "outlined",
|
|
191
|
+
color: "primary",
|
|
192
|
+
onClick: () => setShowStartConfig(true),
|
|
193
|
+
disabled: anyLoading,
|
|
194
|
+
children: "Start"
|
|
195
|
+
}
|
|
196
|
+
),
|
|
197
|
+
isPaused && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
198
|
+
import_plugin_ui_kit.Button,
|
|
199
|
+
{
|
|
200
|
+
size: "xs",
|
|
201
|
+
variant: "outlined",
|
|
202
|
+
color: "primary",
|
|
203
|
+
onClick: handleResume,
|
|
204
|
+
loading: starting,
|
|
205
|
+
disabled: anyLoading,
|
|
206
|
+
children: "Resume"
|
|
207
|
+
}
|
|
208
|
+
),
|
|
209
|
+
isRunning && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
210
|
+
import_plugin_ui_kit.Button,
|
|
211
|
+
{
|
|
212
|
+
size: "xs",
|
|
213
|
+
variant: "outlined",
|
|
214
|
+
color: "warning",
|
|
215
|
+
onClick: handlePause,
|
|
216
|
+
loading: pausing,
|
|
217
|
+
disabled: anyLoading,
|
|
218
|
+
children: "Pause"
|
|
219
|
+
}
|
|
220
|
+
),
|
|
221
|
+
(isRunning || isPaused) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
222
|
+
import_plugin_ui_kit.Button,
|
|
223
|
+
{
|
|
224
|
+
size: "xs",
|
|
225
|
+
variant: "outlined",
|
|
226
|
+
color: "danger",
|
|
227
|
+
onClick: handleStop,
|
|
228
|
+
loading: stopping,
|
|
229
|
+
disabled: anyLoading || isStopping,
|
|
230
|
+
children: "Stop"
|
|
231
|
+
}
|
|
232
|
+
),
|
|
233
|
+
isIdle && showStartConfig && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
234
|
+
import_plugin_ui_kit.IconButton,
|
|
235
|
+
{
|
|
236
|
+
icon: "close",
|
|
237
|
+
size: "xs",
|
|
238
|
+
variant: "clear",
|
|
239
|
+
onClick: () => setShowStartConfig(false)
|
|
240
|
+
}
|
|
241
|
+
),
|
|
242
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
243
|
+
import_plugin_ui_kit.IconButton,
|
|
244
|
+
{
|
|
245
|
+
icon: "reset",
|
|
246
|
+
size: "xs",
|
|
247
|
+
variant: "outlined",
|
|
248
|
+
onClick: onRefresh,
|
|
249
|
+
disabled: anyLoading
|
|
250
|
+
}
|
|
251
|
+
)
|
|
252
|
+
] })
|
|
253
|
+
] })
|
|
254
|
+
}
|
|
201
255
|
),
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
Flex,
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
256
|
+
isIdle && showStartConfig && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Section, { padding: "default", border: "bottom", shrink: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "column-stretch-start-nowrap-8", children: [
|
|
257
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-thick", color: "color-text-high", children: "Start Configuration" }),
|
|
258
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "row-center-start-nowrap-12", children: [
|
|
259
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "row-center-start-nowrap-8", children: [
|
|
260
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-subtle", children: "Max" }),
|
|
261
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
262
|
+
import_plugin_ui_kit.Slider,
|
|
263
|
+
{
|
|
264
|
+
value: maxConcurrent,
|
|
265
|
+
min: 1,
|
|
266
|
+
max: 20,
|
|
267
|
+
step: 1,
|
|
268
|
+
onChange: (val) => setMaxConcurrent(val)
|
|
269
|
+
}
|
|
270
|
+
),
|
|
271
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-thick", color: "color-text-high", children: maxConcurrent })
|
|
272
|
+
] }),
|
|
273
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Field, { label: "Token Budget", labelWidth: 100, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
274
|
+
import_plugin_ui_kit.Input,
|
|
275
|
+
{
|
|
276
|
+
value: sessionTokenBudget,
|
|
277
|
+
onChange: (value) => setSessionTokenBudget(value),
|
|
278
|
+
type: "number",
|
|
279
|
+
size: "small",
|
|
280
|
+
placeholder: "No limit"
|
|
281
|
+
}
|
|
282
|
+
) }),
|
|
283
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Field, { label: "Cost Budget ($)", labelWidth: 100, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
284
|
+
import_plugin_ui_kit.Input,
|
|
285
|
+
{
|
|
286
|
+
value: sessionCostBudget,
|
|
287
|
+
onChange: (value) => setSessionCostBudget(value),
|
|
288
|
+
type: "number",
|
|
289
|
+
size: "small",
|
|
290
|
+
placeholder: "No limit"
|
|
291
|
+
}
|
|
292
|
+
) })
|
|
293
|
+
] }),
|
|
294
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "row-center-start-nowrap-8", children: [
|
|
295
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
296
|
+
import_plugin_ui_kit.Button,
|
|
297
|
+
{
|
|
298
|
+
size: "xs",
|
|
299
|
+
variant: "fill",
|
|
300
|
+
color: "primary",
|
|
301
|
+
onClick: handleStartWithConfig,
|
|
302
|
+
loading: starting,
|
|
303
|
+
disabled: anyLoading,
|
|
304
|
+
leftIcon: "playArrow",
|
|
305
|
+
children: "Start Swarm"
|
|
306
|
+
}
|
|
307
|
+
),
|
|
308
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
309
|
+
import_plugin_ui_kit.Button,
|
|
310
|
+
{
|
|
311
|
+
size: "xs",
|
|
312
|
+
variant: "clear",
|
|
313
|
+
color: "secondary",
|
|
314
|
+
onClick: () => setShowStartConfig(false),
|
|
315
|
+
children: "Cancel"
|
|
316
|
+
}
|
|
317
|
+
)
|
|
318
|
+
] })
|
|
319
|
+
] }) })
|
|
320
|
+
] });
|
|
243
321
|
}
|
|
244
322
|
var swarm_controls_default = SwarmControls;
|
|
245
|
-
module.exports = SwarmControls;
|