@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-slot-card.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// src/ui/bot-slot-card.tsx
|
|
@@ -34,8 +24,34 @@ __export(bot_slot_card_exports, {
|
|
|
34
24
|
default: () => bot_slot_card_default
|
|
35
25
|
});
|
|
36
26
|
module.exports = __toCommonJS(bot_slot_card_exports);
|
|
37
|
-
var import_react = __toESM(require("react"), 1);
|
|
38
27
|
var import_plugin_ui_kit = require("@fw/plugin-ui-kit");
|
|
28
|
+
var import_plugin_theme = require("@fw/plugin-theme");
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
+
var Row = import_plugin_theme.styled.div({
|
|
31
|
+
display: "flex",
|
|
32
|
+
alignItems: "center",
|
|
33
|
+
gap: "$gap-tight",
|
|
34
|
+
padding: "6px 16px",
|
|
35
|
+
minHeight: "38px",
|
|
36
|
+
borderBottom: "1px solid $color-border-default",
|
|
37
|
+
transition: "background-color 0.15s ease",
|
|
38
|
+
variants: {
|
|
39
|
+
clickable: {
|
|
40
|
+
true: {
|
|
41
|
+
cursor: "pointer",
|
|
42
|
+
"&:hover": { backgroundColor: "$color-surface-hover" },
|
|
43
|
+
"&:active": { backgroundColor: "$color-surface-active" }
|
|
44
|
+
},
|
|
45
|
+
false: {}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
var WorkerCol = import_plugin_theme.styled.div({ width: "120px", flexShrink: 0 });
|
|
50
|
+
var BotCol = import_plugin_theme.styled.div({ width: "110px", flexShrink: 0, display: "flex", alignItems: "center", gap: "4px" });
|
|
51
|
+
var StatusCol = import_plugin_theme.styled.div({ width: "70px", flexShrink: 0 });
|
|
52
|
+
var TaskCol = import_plugin_theme.styled.div({ flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" });
|
|
53
|
+
var StatCol = import_plugin_theme.styled.div({ width: "50px", flexShrink: 0, textAlign: "right" });
|
|
54
|
+
var ActionsCol = import_plugin_theme.styled.div({ width: "50px", flexShrink: 0 });
|
|
39
55
|
var statusToLabel = {
|
|
40
56
|
idle: "Idle",
|
|
41
57
|
executing: "Executing",
|
|
@@ -51,91 +67,85 @@ function formatCost(n) {
|
|
|
51
67
|
if (n < 0.01 && n > 0) return "<$0.01";
|
|
52
68
|
return `$${n.toFixed(2)}`;
|
|
53
69
|
}
|
|
54
|
-
function BotSlotCard({ bot, currentTaskTitle, profileName, botDisplayName, botIcon, botColor, onPause, onResume, onStop }) {
|
|
70
|
+
function BotSlotCard({ bot, currentTaskTitle, profileName, botDisplayName, botIcon, botColor, onView, onPause, onResume, onStop }) {
|
|
55
71
|
const { botId, botName, status, currentTaskId, tokensUsed, cost } = bot;
|
|
56
72
|
const isExecuting = status === "executing";
|
|
57
73
|
const isPaused = status === "paused";
|
|
58
74
|
const label = statusToLabel[status] ?? status;
|
|
59
75
|
const taskText = isExecuting ? currentTaskTitle || currentTaskId || "-" : "-";
|
|
60
|
-
|
|
61
|
-
|
|
76
|
+
const clickable = isExecuting && onView;
|
|
77
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
78
|
+
Row,
|
|
62
79
|
{
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
size: "xs",
|
|
133
|
-
variant: "clear",
|
|
134
|
-
color: "danger",
|
|
135
|
-
onClick: () => onStop(botId),
|
|
136
|
-
title: "Stop"
|
|
137
|
-
})
|
|
138
|
-
)
|
|
80
|
+
clickable: !!clickable,
|
|
81
|
+
onClick: clickable ? () => onView(botId) : void 0,
|
|
82
|
+
children: [
|
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(WorkerCol, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-high", children: profileName ? `${profileName} #${botId.split("-").pop() ?? "0"}` : botName }) }),
|
|
84
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(BotCol, { children: [
|
|
85
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Icon, { name: botIcon || "smartToy", size: 12, color: botColor || "color-text-subtle" }),
|
|
86
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-subtle", children: botDisplayName || "-" })
|
|
87
|
+
] }),
|
|
88
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusCol, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
89
|
+
import_plugin_ui_kit.Typography,
|
|
90
|
+
{
|
|
91
|
+
variant: "smallCaption-regular",
|
|
92
|
+
color: isExecuting ? "color-brand-main" : "color-text-subtle",
|
|
93
|
+
children: label
|
|
94
|
+
}
|
|
95
|
+
) }),
|
|
96
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TaskCol, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
97
|
+
import_plugin_ui_kit.Typography,
|
|
98
|
+
{
|
|
99
|
+
variant: "smallCaption-regular",
|
|
100
|
+
color: isExecuting ? "color-text-medium" : "color-text-subtle",
|
|
101
|
+
truncate: true,
|
|
102
|
+
children: taskText
|
|
103
|
+
}
|
|
104
|
+
) }),
|
|
105
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatCol, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-subtle", children: formatTokens(tokensUsed) }) }),
|
|
106
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatCol, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-subtle", children: formatCost(cost) }) }),
|
|
107
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionsCol, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
108
|
+
import_plugin_ui_kit.Flex,
|
|
109
|
+
{
|
|
110
|
+
variant: "row-center-end-nowrap-1",
|
|
111
|
+
onClick: (e) => e.stopPropagation(),
|
|
112
|
+
children: [
|
|
113
|
+
isExecuting && onPause && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
114
|
+
import_plugin_ui_kit.IconButton,
|
|
115
|
+
{
|
|
116
|
+
icon: "pause",
|
|
117
|
+
size: "xs",
|
|
118
|
+
variant: "clear",
|
|
119
|
+
onClick: () => onPause(botId),
|
|
120
|
+
title: "Pause"
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
isPaused && onResume && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
124
|
+
import_plugin_ui_kit.IconButton,
|
|
125
|
+
{
|
|
126
|
+
icon: "playArrow",
|
|
127
|
+
size: "xs",
|
|
128
|
+
variant: "clear",
|
|
129
|
+
onClick: () => onResume(botId),
|
|
130
|
+
title: "Resume"
|
|
131
|
+
}
|
|
132
|
+
),
|
|
133
|
+
(isExecuting || isPaused) && onStop && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
134
|
+
import_plugin_ui_kit.IconButton,
|
|
135
|
+
{
|
|
136
|
+
icon: "stop",
|
|
137
|
+
size: "xs",
|
|
138
|
+
variant: "clear",
|
|
139
|
+
color: "danger",
|
|
140
|
+
onClick: () => onStop(botId),
|
|
141
|
+
title: "Stop"
|
|
142
|
+
}
|
|
143
|
+
)
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
) })
|
|
147
|
+
]
|
|
148
|
+
}
|
|
139
149
|
);
|
|
140
150
|
}
|
|
141
151
|
var bot_slot_card_default = BotSlotCard;
|
package/dist/ui/bot-status.js
CHANGED
|
@@ -1,10 +1,32 @@
|
|
|
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-status.tsx
|
|
21
|
+
var bot_status_exports = {};
|
|
22
|
+
__export(bot_status_exports, {
|
|
23
|
+
BotStatus: () => BotStatus,
|
|
24
|
+
default: () => bot_status_default
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(bot_status_exports);
|
|
27
|
+
var import_react = require("react");
|
|
28
|
+
var import_plugin_ui_kit = require("@fw/plugin-ui-kit");
|
|
4
29
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
-
var React = require("react");
|
|
6
|
-
var { useState, useEffect, useCallback, useRef } = React;
|
|
7
|
-
var { Typography, Icon } = require("@fw/plugin-ui-kit");
|
|
8
30
|
var TOOL_URL = "/api/pack-tool/@synergenius/flow-weaver-pack-weaver/fw_weaver_status";
|
|
9
31
|
var stateToDot = {
|
|
10
32
|
idle: "neutral",
|
|
@@ -25,10 +47,10 @@ var stateToIcon = {
|
|
|
25
47
|
paused: "pause"
|
|
26
48
|
};
|
|
27
49
|
function BotStatus({ packName, botId }) {
|
|
28
|
-
const [data, setData] = useState(null);
|
|
29
|
-
const [error, setError] = useState(null);
|
|
30
|
-
const timerRef = useRef();
|
|
31
|
-
const fetchData = useCallback(async () => {
|
|
50
|
+
const [data, setData] = (0, import_react.useState)(null);
|
|
51
|
+
const [error, setError] = (0, import_react.useState)(null);
|
|
52
|
+
const timerRef = (0, import_react.useRef)();
|
|
53
|
+
const fetchData = (0, import_react.useCallback)(async () => {
|
|
32
54
|
try {
|
|
33
55
|
const res = await fetch(TOOL_URL, {
|
|
34
56
|
method: "POST",
|
|
@@ -51,13 +73,13 @@ function BotStatus({ packName, botId }) {
|
|
|
51
73
|
setError(e.message ?? "Failed to load");
|
|
52
74
|
}
|
|
53
75
|
}, []);
|
|
54
|
-
useEffect(() => {
|
|
76
|
+
(0, import_react.useEffect)(() => {
|
|
55
77
|
fetchData();
|
|
56
78
|
timerRef.current = setInterval(fetchData, 5e3);
|
|
57
79
|
return () => clearInterval(timerRef.current);
|
|
58
80
|
}, [fetchData]);
|
|
59
|
-
if (error) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: "6px 12px" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "caption-regular", color: "color-status-negative", children: error }) });
|
|
60
|
-
if (!data) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: "6px 12px" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "caption-regular", color: "color-text-subtle", children: "Loading status..." }) });
|
|
81
|
+
if (error) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: "6px 12px" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-regular", color: "color-status-negative", children: error }) });
|
|
82
|
+
if (!data) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: "6px 12px" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-regular", color: "color-text-subtle", children: "Loading status..." }) });
|
|
61
83
|
const state = data.state ?? "idle";
|
|
62
84
|
const dotStatus = stateToDot[state] ?? "neutral";
|
|
63
85
|
const iconName = stateToIcon[state] ?? "pending";
|
|
@@ -71,10 +93,10 @@ function BotStatus({ packName, botId }) {
|
|
|
71
93
|
borderBottom: "1px solid var(--color-border-default)",
|
|
72
94
|
background: "var(--color-surface-elevated)"
|
|
73
95
|
}, children: [
|
|
74
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { name: iconName, size: 14, color: `color-status-${dotStatus === "neutral" ? "info" : dotStatus}` }),
|
|
75
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "caption-bold", style: { textTransform: "capitalize" }, children: state }),
|
|
96
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Icon, { name: iconName, size: 14, color: `color-status-${dotStatus === "neutral" ? "info" : dotStatus}` }),
|
|
97
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "caption-bold", style: { textTransform: "capitalize" }, children: state }),
|
|
76
98
|
data.currentTask && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
77
|
-
Typography,
|
|
99
|
+
import_plugin_ui_kit.Typography,
|
|
78
100
|
{
|
|
79
101
|
variant: "caption-regular",
|
|
80
102
|
color: "color-text-medium",
|
|
@@ -82,11 +104,11 @@ function BotStatus({ packName, botId }) {
|
|
|
82
104
|
children: data.currentTask
|
|
83
105
|
}
|
|
84
106
|
),
|
|
85
|
-
total > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Typography, { variant: "smallCaption-regular", color: "color-text-subtle", children: [
|
|
107
|
+
total > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-subtle", children: [
|
|
86
108
|
completed,
|
|
87
109
|
"/",
|
|
88
110
|
total
|
|
89
111
|
] })
|
|
90
112
|
] });
|
|
91
113
|
}
|
|
92
|
-
|
|
114
|
+
var bot_status_default = BotStatus;
|
package/dist/ui/budget-bar.js
CHANGED
|
@@ -24,36 +24,62 @@ __export(budget_bar_exports, {
|
|
|
24
24
|
default: () => budget_bar_default
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(budget_bar_exports);
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
+
function BudgetBar({ label, used, limit, unit, onLimitChange }) {
|
|
31
|
+
const [editing, setEditing] = (0, import_react.useState)(false);
|
|
32
|
+
const [editValue, setEditValue] = (0, import_react.useState)("");
|
|
33
|
+
const handleStartEdit = (0, import_react.useCallback)(() => {
|
|
34
|
+
setEditValue(String(limit));
|
|
35
|
+
setEditing(true);
|
|
36
|
+
}, [limit]);
|
|
37
|
+
const handleCommit = (0, import_react.useCallback)(() => {
|
|
38
|
+
const val = parseFloat(editValue);
|
|
39
|
+
if (val > 0 && onLimitChange) {
|
|
40
|
+
onLimitChange(val);
|
|
41
|
+
}
|
|
42
|
+
setEditing(false);
|
|
43
|
+
}, [editValue, onLimitChange]);
|
|
44
|
+
const limitDisplay = unit === "USD" ? `$${limit.toLocaleString()}` : limit.toLocaleString();
|
|
45
|
+
const usedDisplay = unit === "USD" ? `$${used.toFixed(2)}` : used.toLocaleString();
|
|
46
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "column-start-start-nowrap-2", children: [
|
|
47
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "row-center-space-between-nowrap-4", children: [
|
|
48
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-subtle", children: label }),
|
|
49
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Flex, { variant: "row-center-start-nowrap-4", children: editing ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "row-center-start-nowrap-4", children: [
|
|
50
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-subtle", children: `${usedDisplay} /` }),
|
|
51
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
52
|
+
import_plugin_ui_kit.Input,
|
|
53
|
+
{
|
|
54
|
+
type: "number",
|
|
55
|
+
value: editValue,
|
|
56
|
+
onChange: (value) => setEditValue(value),
|
|
57
|
+
onKeyDown: (e) => {
|
|
58
|
+
if (e.key === "Enter") handleCommit();
|
|
59
|
+
if (e.key === "Escape") setEditing(false);
|
|
60
|
+
},
|
|
61
|
+
onBlur: handleCommit,
|
|
62
|
+
type: "number",
|
|
63
|
+
size: "small",
|
|
64
|
+
autoFocus: true
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-subtle", children: unit })
|
|
68
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "row-center-start-nowrap-4", children: [
|
|
69
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-subtle", children: `${usedDisplay} / ${limitDisplay} ${unit === "USD" ? "" : unit}` }),
|
|
70
|
+
onLimitChange && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
71
|
+
import_plugin_ui_kit.IconButton,
|
|
72
|
+
{
|
|
73
|
+
icon: "edit",
|
|
74
|
+
size: "xs",
|
|
75
|
+
variant: "clear",
|
|
76
|
+
onClick: handleStartEdit,
|
|
77
|
+
title: `Edit ${label.toLowerCase()} limit`
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
] }) })
|
|
81
|
+
] }),
|
|
82
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.UsageBar, { used, limit })
|
|
83
|
+
] });
|
|
57
84
|
}
|
|
58
85
|
var budget_bar_default = BudgetBar;
|
|
59
|
-
module.exports = BudgetBar;
|