@synergenius/flow-weaver-pack-weaver 0.9.201 → 0.9.203

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 (38) hide show
  1. package/dist/bot/preflight.d.ts.map +1 -1
  2. package/dist/bot/preflight.js +26 -0
  3. package/dist/bot/preflight.js.map +1 -1
  4. package/dist/bot/task-create-handler.d.ts +9 -0
  5. package/dist/bot/task-create-handler.d.ts.map +1 -1
  6. package/dist/bot/task-create-handler.js +26 -0
  7. package/dist/bot/task-create-handler.js.map +1 -1
  8. package/dist/node-types/agent-execute.d.ts.map +1 -1
  9. package/dist/node-types/agent-execute.js +26 -9
  10. package/dist/node-types/agent-execute.js.map +1 -1
  11. package/dist/node-types/plan-task.d.ts.map +1 -1
  12. package/dist/node-types/plan-task.js +28 -2
  13. package/dist/node-types/plan-task.js.map +1 -1
  14. package/dist/ui/bot-slot-card.js +10 -0
  15. package/dist/ui/budget-bar.js +5 -3
  16. package/dist/ui/budget-strip.js +156 -0
  17. package/dist/ui/chat-task-result.js +22 -27
  18. package/dist/ui/instance-stream-view.js +36 -0
  19. package/dist/ui/swarm-dashboard.js +1596 -1654
  20. package/dist/ui/task-detail-view.js +973 -485
  21. package/dist/ui/task-editor.js +32 -34
  22. package/dist/ui/task-pool-list.js +11 -3
  23. package/flowweaver.manifest.json +1 -1
  24. package/package.json +3 -2
  25. package/src/bot/preflight.ts +26 -0
  26. package/src/bot/task-create-handler.ts +39 -0
  27. package/src/node-types/agent-execute.ts +27 -10
  28. package/src/node-types/plan-task.ts +25 -2
  29. package/src/ui/bot-slot-card.tsx +23 -0
  30. package/src/ui/budget-bar.tsx +13 -5
  31. package/src/ui/budget-strip.tsx +199 -0
  32. package/src/ui/chat-task-result.tsx +5 -25
  33. package/src/ui/instance-stream-view.tsx +50 -1
  34. package/src/ui/swarm-dashboard.tsx +89 -84
  35. package/src/ui/task-detail-view.tsx +376 -442
  36. package/src/ui/task-editor.tsx +65 -96
  37. package/src/ui/task-pool-list.tsx +3 -12
  38. package/src/ui/task-status.ts +60 -0
@@ -0,0 +1,156 @@
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);
19
+
20
+ // src/ui/budget-strip.tsx
21
+ var budget_strip_exports = {};
22
+ __export(budget_strip_exports, {
23
+ BudgetStrip: () => BudgetStrip,
24
+ default: () => budget_strip_default
25
+ });
26
+ module.exports = __toCommonJS(budget_strip_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");
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ var Strip = import_plugin_theme.styled.div({
32
+ display: "flex",
33
+ alignItems: "center",
34
+ gap: "$gap-cluster",
35
+ padding: "$gap-list-tight $gap-card-content",
36
+ borderRadius: "$border-radius-container",
37
+ backgroundColor: "$color-surface-float",
38
+ border: "1px solid $color-border-subtle",
39
+ minHeight: "34px"
40
+ });
41
+ var PopoverOverlay = import_plugin_theme.styled.div({
42
+ position: "fixed",
43
+ inset: 0,
44
+ zIndex: 999
45
+ });
46
+ var PopoverCard = import_plugin_theme.styled.div({
47
+ position: "absolute",
48
+ zIndex: 1e3,
49
+ backgroundColor: "$color-surface-main",
50
+ border: "1px solid $color-border-default",
51
+ borderRadius: "$border-radius-popover",
52
+ padding: "$gap-card-content",
53
+ boxShadow: "0 4px 16px rgba(0,0,0,0.4)"
54
+ });
55
+ function formatCost(n) {
56
+ if (n >= 1) return `$${n.toFixed(2)}`;
57
+ if (n >= 0.01) return `$${n.toFixed(2)}`;
58
+ if (n > 0) return `$${n.toFixed(4)}`;
59
+ return "$0";
60
+ }
61
+ function BudgetStrip({
62
+ costUsed,
63
+ costLimit,
64
+ costSource,
65
+ tokenLimit,
66
+ tasksDone = 0,
67
+ tasksFailed = 0,
68
+ tasksOpen = 0,
69
+ onLimitsChange
70
+ }) {
71
+ const [popoverOpen, setPopoverOpen] = (0, import_react.useState)(false);
72
+ const [editCost, setEditCost] = (0, import_react.useState)("");
73
+ const [editTokens, setEditTokens] = (0, import_react.useState)("");
74
+ const editRef = (0, import_react.useRef)(null);
75
+ const handleOpenPopover = (0, import_react.useCallback)(() => {
76
+ setEditCost(String(costLimit));
77
+ setEditTokens(String(tokenLimit));
78
+ setPopoverOpen(true);
79
+ }, [costLimit, tokenLimit]);
80
+ const handleSave = (0, import_react.useCallback)(() => {
81
+ const c = parseFloat(editCost);
82
+ const t = parseFloat(editTokens);
83
+ if (c > 0 && t > 0 && onLimitsChange) {
84
+ onLimitsChange(c, t);
85
+ }
86
+ setPopoverOpen(false);
87
+ }, [editCost, editTokens, onLimitsChange]);
88
+ const sourceTag = costSource === "cli" ? "actual" : costSource === "estimated" ? "est." : null;
89
+ const tallyParts = [];
90
+ if (tasksDone > 0) tallyParts.push({ count: tasksDone, label: "done", chipStatus: "success", icon: "check" });
91
+ if (tasksFailed > 0) tallyParts.push({ count: tasksFailed, label: "failed", chipStatus: "error", icon: "close" });
92
+ if (tasksOpen > 0) tallyParts.push({ count: tasksOpen, label: "open", chipStatus: "info", icon: "schedule" });
93
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Strip, { children: [
94
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Flex, { variant: "row-center-start-nowrap-4", style: { flexShrink: 0 }, children: tallyParts.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.StatusChip, { status: p.chipStatus, icon: p.icon, children: [
95
+ p.count,
96
+ " ",
97
+ p.label
98
+ ] }, i)) }),
99
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "row-center-center-nowrap-4", style: { flex: 1, minWidth: 0 }, children: [
100
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-thick", color: "color-text-high", children: costLimit > 0 ? `${Math.round(costUsed / costLimit * 100)}%` : "0%" }),
101
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-border-default", children: "|" }),
102
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-subtle", children: [
103
+ formatCost(costUsed),
104
+ " / ",
105
+ formatCost(costLimit)
106
+ ] }),
107
+ sourceTag && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: costSource === "cli" ? "color-status-positive" : "color-text-subtle", children: [
108
+ "(",
109
+ sourceTag,
110
+ ")"
111
+ ] })
112
+ ] }),
113
+ onLimitsChange && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ref: editRef, style: { position: "relative", flexShrink: 0 }, children: [
114
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Button, { size: "xs", variant: "outlined", onClick: handleOpenPopover, children: "Edit Budget" }),
115
+ popoverOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
116
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverOverlay, { onClick: () => setPopoverOpen(false) }),
117
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverCard, { style: { top: "100%", right: 0, marginTop: "4px" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "column-stretch-start-nowrap-6", children: [
118
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-thick", color: "color-text-high", children: "Budget Limits" }),
119
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "row-center-space-between-nowrap-4", style: { whiteSpace: "nowrap" }, children: [
120
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-subtle", style: { flexShrink: 0 }, children: "Cost ($)" }),
121
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
122
+ import_plugin_ui_kit.Input,
123
+ {
124
+ type: "number",
125
+ size: "extraSmall",
126
+ value: editCost,
127
+ onChange: (v) => setEditCost(v),
128
+ autoFocus: true
129
+ }
130
+ )
131
+ ] }),
132
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "row-center-space-between-nowrap-4", style: { whiteSpace: "nowrap" }, children: [
133
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "smallCaption-regular", color: "color-text-subtle", style: { flexShrink: 0 }, children: "Tokens" }),
134
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
135
+ import_plugin_ui_kit.Input,
136
+ {
137
+ type: "number",
138
+ size: "extraSmall",
139
+ value: editTokens,
140
+ onChange: (v) => setEditTokens(v),
141
+ onKeyDown: (e) => {
142
+ if (e.key === "Enter") handleSave();
143
+ }
144
+ }
145
+ )
146
+ ] }),
147
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_plugin_ui_kit.Flex, { variant: "row-center-end-nowrap-4", children: [
148
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Button, { size: "xs", variant: "clear", onClick: () => setPopoverOpen(false), children: "Cancel" }),
149
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Button, { size: "xs", variant: "fill", color: "primary", onClick: handleSave, children: "Save" })
150
+ ] })
151
+ ] }) })
152
+ ] })
153
+ ] })
154
+ ] });
155
+ }
156
+ var budget_strip_default = BudgetStrip;
@@ -26,6 +26,25 @@ __export(chat_task_result_exports, {
26
26
  module.exports = __toCommonJS(chat_task_result_exports);
27
27
  var import_react = require("react");
28
28
  var import_plugin_ui_kit = require("@fw/plugin-ui-kit");
29
+
30
+ // src/ui/task-status.ts
31
+ var TASK_STATUS_ICON = {
32
+ "open": "pending",
33
+ "in-progress": "running",
34
+ "done": "completed",
35
+ "cancelled": "failed"
36
+ };
37
+ var TASK_STATUS_ICON_OVERRIDE = {
38
+ "in-progress": "pendingActions"
39
+ };
40
+ var TASK_STATUS_LABEL = {
41
+ "open": "Open",
42
+ "in-progress": "In Progress",
43
+ "done": "Done",
44
+ "cancelled": "Cancelled"
45
+ };
46
+
47
+ // src/ui/chat-task-result.tsx
29
48
  var import_jsx_runtime = require("react/jsx-runtime");
30
49
  function parseResult(result) {
31
50
  try {
@@ -39,33 +58,9 @@ function parseResult(result) {
39
58
  return { task: null, subtasks: [] };
40
59
  }
41
60
  }
42
- function statusToIcon(status) {
43
- switch (status) {
44
- case "open":
45
- return "pending";
46
- case "in-progress":
47
- return "running";
48
- case "done":
49
- return "completed";
50
- case "cancelled":
51
- return "failed";
52
- default:
53
- return "pending";
54
- }
55
- }
56
61
  function statusLabel(status) {
57
- switch (status) {
58
- case "open":
59
- return "Open";
60
- case "in-progress":
61
- return "Running";
62
- case "done":
63
- return "Done";
64
- case "cancelled":
65
- return "Cancelled";
66
- default:
67
- return status;
68
- }
62
+ if (status === "in-progress") return "Running";
63
+ return TASK_STATUS_LABEL[status] ?? status;
69
64
  }
70
65
  function isTerminal(status) {
71
66
  return status === "done" || status === "cancelled";
@@ -141,7 +136,7 @@ function ChatTaskResult(props) {
141
136
  backgroundColor: "var(--color-surface-low)"
142
137
  },
143
138
  children: [
144
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.StatusIcon, { status: statusToIcon(task.status), size: "sm" }),
139
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.StatusIcon, { status: TASK_STATUS_ICON[task.status] || "pending", icon: TASK_STATUS_ICON_OVERRIDE[task.status], size: "sm" }),
145
140
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
146
141
  import_plugin_ui_kit.Flex,
147
142
  {
@@ -220,6 +220,27 @@ function buildConversation(events) {
220
220
  });
221
221
  lastType = "bot-failed";
222
222
  break;
223
+ // ── Session/bridge warnings (from CliSession markDead, active turn kill) ──
224
+ case "session-warning":
225
+ flushThinking(false);
226
+ flushText(false);
227
+ blocks.push({
228
+ kind: "warning",
229
+ label: d.label ?? "Session warning",
230
+ detail: d.detail ?? d.stderr ?? void 0
231
+ });
232
+ lastType = "session-warning";
233
+ break;
234
+ case "audit:bridge-tool-filtered":
235
+ if (d.textToolCallDetected > 0) {
236
+ blocks.push({
237
+ kind: "warning",
238
+ label: `MCP tools not connected \u2014 ${d.textToolCallDetected} tool calls output as text`,
239
+ detail: "The CLI session does not have MCP tools registered. Tool calls were output as text instead of structured tool_use."
240
+ });
241
+ }
242
+ lastType = "audit:bridge-tool-filtered";
243
+ break;
223
244
  // ── Swarm/workflow-level events (emitted by runner + swarm-controller) ──
224
245
  case "task-claimed":
225
246
  blocks.push({
@@ -361,6 +382,8 @@ function useConversationTypewriter(blocks) {
361
382
  }
362
383
  case "status":
363
384
  return (block.detail ?? "").length;
385
+ case "warning":
386
+ return (block.detail ?? "").length;
364
387
  default:
365
388
  return 0;
366
389
  }
@@ -674,6 +697,19 @@ function InstanceStreamView({
674
697
  }
675
698
  );
676
699
  }
700
+ case "warning":
701
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
702
+ import_plugin_ui_kit.CollapsibleBlock,
703
+ {
704
+ status: "error",
705
+ label: block.label,
706
+ expanded: !!block.detail,
707
+ canExpand: !!block.detail,
708
+ onToggle: () => {
709
+ },
710
+ children: block.detail && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Section, { padding: "compact", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_plugin_ui_kit.Typography, { variant: "body-regular", color: "color-danger-main", children: block.detail }) })
711
+ }
712
+ );
677
713
  default:
678
714
  return null;
679
715
  }