@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.
Files changed (181) hide show
  1. package/dist/ai-chat-provider.js +5 -5
  2. package/dist/ai-chat-provider.js.map +1 -1
  3. package/dist/bot/acceptance-merge.d.ts +21 -0
  4. package/dist/bot/acceptance-merge.d.ts.map +1 -0
  5. package/dist/bot/acceptance-merge.js +46 -0
  6. package/dist/bot/acceptance-merge.js.map +1 -0
  7. package/dist/bot/ai-client.d.ts +14 -2
  8. package/dist/bot/ai-client.d.ts.map +1 -1
  9. package/dist/bot/ai-client.js +71 -24
  10. package/dist/bot/ai-client.js.map +1 -1
  11. package/dist/bot/assistant-tools.js +3 -3
  12. package/dist/bot/assistant-tools.js.map +1 -1
  13. package/dist/bot/audit-logger.d.ts.map +1 -1
  14. package/dist/bot/audit-logger.js +34 -14
  15. package/dist/bot/audit-logger.js.map +1 -1
  16. package/dist/bot/audit-trail.d.ts +67 -0
  17. package/dist/bot/audit-trail.d.ts.map +1 -0
  18. package/dist/bot/audit-trail.js +153 -0
  19. package/dist/bot/audit-trail.js.map +1 -0
  20. package/dist/bot/behavior-defaults.d.ts +1 -1
  21. package/dist/bot/behavior-defaults.d.ts.map +1 -1
  22. package/dist/bot/behavior-defaults.js +7 -3
  23. package/dist/bot/behavior-defaults.js.map +1 -1
  24. package/dist/bot/capability-registry.d.ts +9 -0
  25. package/dist/bot/capability-registry.d.ts.map +1 -1
  26. package/dist/bot/capability-registry.js +81 -27
  27. package/dist/bot/capability-registry.js.map +1 -1
  28. package/dist/bot/capability-types.d.ts +10 -0
  29. package/dist/bot/capability-types.d.ts.map +1 -1
  30. package/dist/bot/cli-provider.d.ts.map +1 -1
  31. package/dist/bot/cli-provider.js +8 -7
  32. package/dist/bot/cli-provider.js.map +1 -1
  33. package/dist/bot/preflight.d.ts +48 -0
  34. package/dist/bot/preflight.d.ts.map +1 -0
  35. package/dist/bot/preflight.js +247 -0
  36. package/dist/bot/preflight.js.map +1 -0
  37. package/dist/bot/provider-shim.d.ts +74 -0
  38. package/dist/bot/provider-shim.d.ts.map +1 -0
  39. package/dist/bot/provider-shim.js +176 -0
  40. package/dist/bot/provider-shim.js.map +1 -0
  41. package/dist/bot/runner.d.ts +2 -0
  42. package/dist/bot/runner.d.ts.map +1 -1
  43. package/dist/bot/runner.js +60 -17
  44. package/dist/bot/runner.js.map +1 -1
  45. package/dist/bot/step-executor.d.ts.map +1 -1
  46. package/dist/bot/step-executor.js +72 -115
  47. package/dist/bot/step-executor.js.map +1 -1
  48. package/dist/bot/swarm-controller.d.ts +2 -0
  49. package/dist/bot/swarm-controller.d.ts.map +1 -1
  50. package/dist/bot/swarm-controller.js +92 -20
  51. package/dist/bot/swarm-controller.js.map +1 -1
  52. package/dist/bot/task-create-handler.d.ts +37 -0
  53. package/dist/bot/task-create-handler.d.ts.map +1 -0
  54. package/dist/bot/task-create-handler.js +124 -0
  55. package/dist/bot/task-create-handler.js.map +1 -0
  56. package/dist/bot/task-store.d.ts +1 -0
  57. package/dist/bot/task-store.d.ts.map +1 -1
  58. package/dist/bot/task-store.js +67 -0
  59. package/dist/bot/task-store.js.map +1 -1
  60. package/dist/bot/types.d.ts +1 -1
  61. package/dist/bot/types.d.ts.map +1 -1
  62. package/dist/bot/weaver-tools.d.ts.map +1 -1
  63. package/dist/bot/weaver-tools.js +7 -39
  64. package/dist/bot/weaver-tools.js.map +1 -1
  65. package/dist/node-types/agent-execute.d.ts +25 -8
  66. package/dist/node-types/agent-execute.d.ts.map +1 -1
  67. package/dist/node-types/agent-execute.js +89 -23
  68. package/dist/node-types/agent-execute.js.map +1 -1
  69. package/dist/node-types/bot-report.d.ts.map +1 -1
  70. package/dist/node-types/bot-report.js +24 -3
  71. package/dist/node-types/bot-report.js.map +1 -1
  72. package/dist/node-types/plan-task.d.ts +8 -17
  73. package/dist/node-types/plan-task.d.ts.map +1 -1
  74. package/dist/node-types/plan-task.js +217 -256
  75. package/dist/node-types/plan-task.js.map +1 -1
  76. package/dist/node-types/review-result.js +8 -6
  77. package/dist/node-types/review-result.js.map +1 -1
  78. package/dist/palindrome.d.ts +9 -0
  79. package/dist/palindrome.d.ts.map +1 -0
  80. package/dist/palindrome.js +14 -0
  81. package/dist/palindrome.js.map +1 -0
  82. package/dist/ui/approval-card.js +91 -82
  83. package/dist/ui/bot-activity.js +73 -56
  84. package/dist/ui/bot-config.js +48 -31
  85. package/dist/ui/bot-dashboard.js +52 -36
  86. package/dist/ui/bot-panel.js +230 -228
  87. package/dist/ui/bot-slot-card.js +100 -90
  88. package/dist/ui/bot-status.js +37 -15
  89. package/dist/ui/budget-bar.js +57 -31
  90. package/dist/ui/capability-editor.js +447 -378
  91. package/dist/ui/chat-task-result.js +78 -71
  92. package/dist/ui/decision-log.js +68 -81
  93. package/dist/ui/genesis-block.js +86 -95
  94. package/dist/ui/instance-stream-view.js +722 -0
  95. package/dist/ui/profile-card.js +96 -221
  96. package/dist/ui/profile-editor.js +532 -575
  97. package/dist/ui/settings-section.js +41 -45
  98. package/dist/ui/swarm-controls.js +212 -135
  99. package/dist/ui/swarm-dashboard.js +3992 -2715
  100. package/dist/ui/task-detail-view.js +415 -521
  101. package/dist/ui/task-editor.js +339 -390
  102. package/dist/ui/task-pool-list.js +60 -55
  103. package/dist/workflows/src/palindrome.d.ts +11 -0
  104. package/dist/workflows/src/palindrome.d.ts.map +1 -0
  105. package/dist/workflows/src/palindrome.js +16 -0
  106. package/dist/workflows/src/palindrome.js.map +1 -0
  107. package/dist/workflows/tests/palindrome.test.d.ts +2 -0
  108. package/dist/workflows/tests/palindrome.test.d.ts.map +1 -0
  109. package/dist/workflows/tests/palindrome.test.js +41 -0
  110. package/dist/workflows/tests/palindrome.test.js.map +1 -0
  111. package/dist/workflows/weaver-bot-batch.js +1 -1
  112. package/dist/workflows/weaver-bot-batch.js.map +1 -1
  113. package/dist/workflows/weaver-bot.js +1 -1
  114. package/dist/workflows/weaver-bot.js.map +1 -1
  115. package/flowweaver.manifest.json +1 -1
  116. package/package.json +8 -2
  117. package/src/ai-chat-provider.ts +5 -5
  118. package/src/bot/acceptance-merge.ts +62 -0
  119. package/src/bot/ai-client.ts +77 -21
  120. package/src/bot/assistant-tools.ts +3 -3
  121. package/src/bot/audit-logger.ts +42 -14
  122. package/src/bot/audit-trail.ts +211 -0
  123. package/src/bot/behavior-defaults.ts +7 -2
  124. package/src/bot/capability-registry.ts +84 -28
  125. package/src/bot/capability-types.ts +11 -0
  126. package/src/bot/cli-provider.ts +8 -7
  127. package/src/bot/preflight.ts +285 -0
  128. package/src/bot/provider-shim.ts +218 -0
  129. package/src/bot/runner.ts +68 -20
  130. package/src/bot/step-executor.ts +69 -127
  131. package/src/bot/swarm-controller.ts +94 -20
  132. package/src/bot/task-create-handler.ts +164 -0
  133. package/src/bot/task-store.ts +83 -0
  134. package/src/bot/types.ts +4 -1
  135. package/src/bot/weaver-tools.ts +7 -45
  136. package/src/node-types/agent-execute.ts +102 -16
  137. package/src/node-types/bot-report.ts +24 -3
  138. package/src/node-types/plan-task.ts +238 -280
  139. package/src/node-types/review-result.ts +8 -6
  140. package/src/palindrome.ts +14 -0
  141. package/src/ui/approval-card.tsx +78 -62
  142. package/src/ui/bot-activity.tsx +12 -10
  143. package/src/ui/bot-config.tsx +12 -10
  144. package/src/ui/bot-dashboard.tsx +13 -11
  145. package/src/ui/bot-panel.tsx +189 -171
  146. package/src/ui/bot-slot-card.tsx +125 -70
  147. package/src/ui/bot-status.tsx +4 -4
  148. package/src/ui/budget-bar.tsx +86 -25
  149. package/src/ui/capability-editor.tsx +392 -257
  150. package/src/ui/chat-task-result.tsx +81 -78
  151. package/src/ui/decision-log.tsx +76 -73
  152. package/src/ui/genesis-block.tsx +91 -61
  153. package/src/ui/instance-stream-view.tsx +861 -0
  154. package/src/ui/profile-card.tsx +195 -168
  155. package/src/ui/profile-editor.tsx +453 -370
  156. package/src/ui/settings-section.tsx +46 -39
  157. package/src/ui/swarm-controls.tsx +252 -123
  158. package/src/ui/swarm-dashboard.tsx +999 -466
  159. package/src/ui/task-detail-view.tsx +485 -428
  160. package/src/ui/task-editor.tsx +329 -271
  161. package/src/ui/task-pool-list.tsx +68 -62
  162. package/src/workflows/src/palindrome.ts +16 -0
  163. package/src/workflows/tests/palindrome.test.ts +49 -0
  164. package/src/workflows/weaver-bot-batch.ts +1 -1
  165. package/src/workflows/weaver-bot.ts +1 -1
  166. package/dist/ui/bot-constants.d.ts +0 -14
  167. package/dist/ui/bot-constants.d.ts.map +0 -1
  168. package/dist/ui/bot-constants.js +0 -189
  169. package/dist/ui/bot-constants.js.map +0 -1
  170. package/dist/ui/steer-api.d.ts +0 -7
  171. package/dist/ui/steer-api.d.ts.map +0 -1
  172. package/dist/ui/steer-api.js +0 -11
  173. package/dist/ui/steer-api.js.map +0 -1
  174. package/dist/ui/trace-to-timeline.d.ts +0 -91
  175. package/dist/ui/trace-to-timeline.d.ts.map +0 -1
  176. package/dist/ui/trace-to-timeline.js +0 -116
  177. package/dist/ui/trace-to-timeline.js.map +0 -1
  178. package/dist/ui/use-stream-timeline.d.ts +0 -50
  179. package/dist/ui/use-stream-timeline.d.ts.map +0 -1
  180. package/dist/ui/use-stream-timeline.js +0 -245
  181. package/dist/ui/use-stream-timeline.js.map +0 -1
@@ -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
- return import_react.default.createElement(
61
- import_plugin_ui_kit.Flex,
76
+ const clickable = isExecuting && onView;
77
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
78
+ Row,
62
79
  {
63
- variant: "row-center-start-nowrap-8",
64
- style: { padding: "6px 16px", minHeight: "38px", borderBottom: "1px solid var(--color-border-default)" }
65
- },
66
- // Instance name
67
- import_react.default.createElement(import_plugin_ui_kit.Typography, {
68
- variant: "smallCaption-regular",
69
- color: "color-text-high",
70
- style: { width: "120px", flexShrink: 0 }
71
- }, profileName ? `${profileName} #${botId.split("-").pop() ?? "0"}` : botName),
72
- // Bot (icon + name)
73
- import_react.default.createElement(
74
- import_plugin_ui_kit.Flex,
75
- {
76
- variant: "row-center-start-nowrap-4",
77
- style: { width: "110px", flexShrink: 0, color: botColor ? `var(--${botColor})` : void 0 }
78
- },
79
- import_react.default.createElement(import_plugin_ui_kit.Icon, { name: botIcon || "smartToy", size: 12 }),
80
- import_react.default.createElement(import_plugin_ui_kit.Typography, {
81
- variant: "smallCaption-regular",
82
- color: "color-text-subtle"
83
- }, botDisplayName || "-")
84
- ),
85
- // Status
86
- import_react.default.createElement(import_plugin_ui_kit.Typography, {
87
- variant: "smallCaption-regular",
88
- color: isExecuting ? "color-brand-main" : "color-text-subtle",
89
- style: { width: "70px", flexShrink: 0 }
90
- }, label),
91
- // Current task
92
- import_react.default.createElement(import_plugin_ui_kit.Typography, {
93
- variant: "smallCaption-regular",
94
- color: isExecuting ? "color-text-medium" : "color-text-subtle",
95
- style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }
96
- }, taskText),
97
- // Tokens
98
- import_react.default.createElement(import_plugin_ui_kit.Typography, {
99
- variant: "smallCaption-regular",
100
- color: "color-text-subtle",
101
- style: { width: "50px", flexShrink: 0, textAlign: "right" }
102
- }, formatTokens(tokensUsed)),
103
- // Cost
104
- import_react.default.createElement(import_plugin_ui_kit.Typography, {
105
- variant: "smallCaption-regular",
106
- color: "color-text-subtle",
107
- style: { width: "50px", flexShrink: 0, textAlign: "right" }
108
- }, formatCost(cost)),
109
- // Actions
110
- import_react.default.createElement(
111
- import_plugin_ui_kit.Flex,
112
- {
113
- variant: "row-center-end-nowrap-1",
114
- style: { width: "50px", flexShrink: 0 }
115
- },
116
- isExecuting && onPause && import_react.default.createElement(import_plugin_ui_kit.IconButton, {
117
- icon: "pause",
118
- size: "xs",
119
- variant: "clear",
120
- onClick: () => onPause(botId),
121
- title: "Pause"
122
- }),
123
- isPaused && onResume && import_react.default.createElement(import_plugin_ui_kit.IconButton, {
124
- icon: "playArrow",
125
- size: "xs",
126
- variant: "clear",
127
- onClick: () => onResume(botId),
128
- title: "Resume"
129
- }),
130
- (isExecuting || isPaused) && onStop && import_react.default.createElement(import_plugin_ui_kit.IconButton, {
131
- icon: "stop",
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;
@@ -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
- module.exports = BotStatus;
114
+ var bot_status_default = BotStatus;
@@ -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 React = require("react");
28
- var { Flex, Typography } = require("@fw/plugin-ui-kit");
29
- function BudgetBar({ label, used, limit, unit }) {
30
- const pct = limit > 0 ? Math.min(100, used / limit * 100) : 0;
31
- const color = pct > 90 ? "var(--color-status-negative)" : pct > 70 ? "var(--color-status-caution)" : "var(--color-brand-main)";
32
- return React.createElement(
33
- Flex,
34
- { variant: "column-start-start-nowrap-2", style: { width: "100%" } },
35
- React.createElement(
36
- Flex,
37
- { variant: "row-center-space-between-nowrap-4" },
38
- React.createElement(Typography, { variant: "smallCaption-regular", color: "color-text-subtle" }, label),
39
- React.createElement(
40
- Typography,
41
- { variant: "smallCaption-regular", color: "color-text-subtle" },
42
- `${used.toLocaleString()} / ${limit.toLocaleString()} ${unit}`
43
- )
44
- ),
45
- React.createElement(
46
- Flex,
47
- {
48
- variant: "row-start-start-nowrap-0",
49
- style: { width: "100%", height: "4px", borderRadius: "2px", backgroundColor: "var(--color-surface-raised)", overflow: "hidden" }
50
- },
51
- React.createElement(Flex, {
52
- variant: "row-start-start-nowrap-0",
53
- style: { width: `${pct}%`, height: "100%", borderRadius: "2px", backgroundColor: color, transition: "width 0.3s" }
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;