@synergenius/flow-weaver-pack-weaver 0.9.18 → 0.9.20

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.
@@ -6,12 +6,19 @@ var React = require("react");
6
6
  var { useState, useEffect, useCallback } = React;
7
7
  var { Typography } = require("@fw/plugin-ui-kit");
8
8
  var { Icon } = require("@fw/plugin-ui-kit");
9
- var { KeyValueRow } = require("@fw/plugin-ui-kit");
10
9
  var { CollapsibleSection } = require("@fw/plugin-ui-kit");
11
10
  var { LoadingSpinner } = require("@fw/plugin-ui-kit");
12
11
  var { Banner } = require("@fw/plugin-ui-kit");
13
- var { Badge } = require("@fw/plugin-ui-kit");
14
12
  var { IconButton } = require("@fw/plugin-ui-kit");
13
+ var { styled } = require("@fw/plugin-theme");
14
+ var ConfigRow = styled.div({
15
+ display: "flex",
16
+ justifyContent: "space-between",
17
+ alignItems: "center",
18
+ padding: "6px 0",
19
+ borderBottom: "1px solid $color-border-default",
20
+ "&:last-of-type": { borderBottom: "none" }
21
+ });
15
22
  var TOOL_URL = "/api/pack-tool/@synergenius/flow-weaver-pack-weaver/fw_weaver_insights";
16
23
  function BotConfig({ packName, botId }) {
17
24
  const [data, setData] = useState(null);
@@ -47,18 +54,33 @@ function BotConfig({ packName, botId }) {
47
54
  useEffect(() => {
48
55
  fetchData();
49
56
  }, [fetchData]);
50
- if (loading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadingSpinner, { size: "sm" });
51
- if (error) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: "8px 12px" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Banner, { variant: "error", size: "compact", children: error }) });
57
+ if (loading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadingSpinner, { size: "small" });
58
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: "8px 12px" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Banner, { status: "danger", size: "small", children: error }) });
52
59
  const bot = data?.bots?.find((b) => b.name === botId) ?? data?.bots?.[0];
53
60
  const provider = bot?.provider ?? "Not configured";
54
61
  const approval = bot?.approvalMode ?? "auto";
55
62
  const hasBots = (data?.bots?.length ?? 0) > 0;
56
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsibleSection, { title: "Configuration", defaultOpen: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { padding: "4px 12px 12px" }, children: [
57
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(KeyValueRow, { label: "Provider", value: provider }),
58
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(KeyValueRow, { label: "Approval", value: approval }),
59
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(KeyValueRow, { label: "Trust Phase", value: `P${data?.trust?.phase ?? "?"} (${data?.trust?.score ?? 0}/100)` }),
63
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsibleSection, { title: "Configuration", defaultExpanded: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { padding: "4px 12px 12px" }, children: [
64
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ConfigRow, { children: [
65
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "smallCaption-bold", color: "color-text-subtle", children: "Provider" }),
66
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "caption-regular", color: "color-text-high", children: provider })
67
+ ] }),
68
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ConfigRow, { children: [
69
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "smallCaption-bold", color: "color-text-subtle", children: "Approval" }),
70
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "caption-regular", color: "color-text-high", children: approval })
71
+ ] }),
72
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ConfigRow, { children: [
73
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "smallCaption-bold", color: "color-text-subtle", children: "Trust Phase" }),
74
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Typography, { variant: "caption-regular", color: "color-text-high", children: [
75
+ "P",
76
+ data?.trust?.phase ?? "?",
77
+ " (",
78
+ data?.trust?.score ?? 0,
79
+ "/100)"
80
+ ] })
81
+ ] }),
60
82
  !hasBots && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { marginTop: 12 }, children: [
61
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Banner, { variant: "info", size: "compact", children: "No .weaver.json detected. Create one to configure providers and approval modes." }),
83
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Banner, { status: "info", size: "small", children: "No .weaver.json detected. Create one to configure providers and approval modes." }),
62
84
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "caption-regular", color: "color-text-subtle", style: { marginTop: 6, fontFamily: "var(--typography-family-mono)" }, children: "npx flow-weaver weaver init" })
63
85
  ] }),
64
86
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { marginTop: 10, display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconButton, { icon: "refresh", size: "xs", variant: "clear", onClick: fetchData, title: "Refresh" }) })
@@ -23,7 +23,11 @@ function callTool(tool, body = {}) {
23
23
  if (!res.ok) throw new Error("Request failed");
24
24
  const json = await res.json();
25
25
  if (json.isError) throw new Error(json.result);
26
- return JSON.parse(json.result);
26
+ try {
27
+ return JSON.parse(json.result);
28
+ } catch {
29
+ return json.result;
30
+ }
27
31
  });
28
32
  }
29
33
  var KpiRow = styled.div({
@@ -71,9 +75,9 @@ function healthColor(score) {
71
75
  return "var(--color-status-negative)";
72
76
  }
73
77
  var severityToVariant = {
74
- critical: "negative",
75
- warning: "caution",
76
- info: "neutral"
78
+ critical: "error",
79
+ warning: "warning",
80
+ info: "default"
77
81
  };
78
82
  var outcomeToIcon = {
79
83
  completed: { name: "taskAlt", color: "color-status-positive" },
@@ -125,15 +129,15 @@ function BotDashboard({ packName, botId }) {
125
129
  timerRef.current = setInterval(fetchData, 3e4);
126
130
  return () => clearInterval(timerRef.current);
127
131
  }, [fetchData]);
128
- if (loading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: 16, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadingSpinner, { size: "sm" }) });
129
- if (error && !insights) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Banner, { variant: "error", size: "compact", children: error }) });
132
+ if (loading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: 16, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadingSpinner, { size: "small" }) });
133
+ if (error && !insights) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Banner, { status: "danger", size: "small", children: error }) });
130
134
  if (!insights) return null;
131
135
  const healthScore = insights.health?.overall ?? 0;
132
136
  const trust = insights.trust ?? { phase: 1, score: 0 };
133
137
  const cost = insights.cost ?? { last7Days: 0, trend: "stable" };
134
138
  const topInsights = (insights.insights ?? []).slice(0, 3);
135
139
  const recentRuns = history.slice(0, 5);
136
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsibleSection, { title: "Dashboard", defaultOpen: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { padding: "4px 12px 12px" }, children: [
140
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsibleSection, { title: "Dashboard", defaultExpanded: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { padding: "4px 12px 12px" }, children: [
137
141
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(KpiRow, { children: [
138
142
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(KpiCard, { children: [
139
143
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(KpiValue, { style: { color: healthColor(healthScore) }, children: healthScore }),
@@ -161,7 +165,7 @@ function BotDashboard({ packName, botId }) {
161
165
  topInsights.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { marginBottom: 12 }, children: [
162
166
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "smallCaption-bold", color: "color-text-subtle", style: { marginBottom: 6, textTransform: "uppercase", letterSpacing: "0.04em" }, children: "Insights" }),
163
167
  topInsights.map((ins, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(InsightRow, { children: [
164
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { variant: severityToVariant[ins.severity] ?? "neutral", size: "sm", children: ins.severity }),
168
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { variant: severityToVariant[ins.severity] ?? "default", children: ins.severity }),
165
169
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Typography, { variant: "caption-regular", color: "color-text-medium", style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: ins.title })
166
170
  ] }, i))
167
171
  ] }),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifestVersion": 2,
3
3
  "name": "@synergenius/flow-weaver-pack-weaver",
4
- "version": "0.9.18",
4
+ "version": "0.9.20",
5
5
  "description": "AI bot for Flow Weaver. Execute tasks, run workflows, evolve autonomously.",
6
6
  "engineVersion": ">=0.22.10",
7
7
  "categories": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synergenius/flow-weaver-pack-weaver",
3
- "version": "0.9.18",
3
+ "version": "0.9.20",
4
4
  "description": "AI bot for Flow Weaver. Execute tasks, run workflows, evolve autonomously.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -6,12 +6,20 @@ const React = require('react');
6
6
  const { useState, useEffect, useCallback } = React;
7
7
  const { Typography } = require('@fw/plugin-ui-kit');
8
8
  const { Icon } = require('@fw/plugin-ui-kit');
9
- const { KeyValueRow } = require('@fw/plugin-ui-kit');
10
9
  const { CollapsibleSection } = require('@fw/plugin-ui-kit');
11
10
  const { LoadingSpinner } = require('@fw/plugin-ui-kit');
12
11
  const { Banner } = require('@fw/plugin-ui-kit');
13
- const { Badge } = require('@fw/plugin-ui-kit');
14
12
  const { IconButton } = require('@fw/plugin-ui-kit');
13
+ const { styled } = require('@fw/plugin-theme');
14
+
15
+ const ConfigRow = styled.div({
16
+ display: 'flex',
17
+ justifyContent: 'space-between',
18
+ alignItems: 'center',
19
+ padding: '6px 0',
20
+ borderBottom: '1px solid $color-border-default',
21
+ '&:last-of-type': { borderBottom: 'none' },
22
+ });
15
23
 
16
24
  const TOOL_URL = '/api/pack-tool/@synergenius/flow-weaver-pack-weaver/fw_weaver_insights';
17
25
 
@@ -48,29 +56,38 @@ function BotConfig({ packName, botId }: { packName: string; botId: string }) {
48
56
 
49
57
  useEffect(() => { fetchData(); }, [fetchData]);
50
58
 
51
- if (loading) return <LoadingSpinner size="sm" />;
59
+ if (loading) return <LoadingSpinner size="small" />;
52
60
 
53
61
  if (error) return (
54
62
  <div style={{ padding: '8px 12px' }}>
55
- <Banner variant="error" size="compact">{error}</Banner>
63
+ <Banner status="danger" size="small">{error}</Banner>
56
64
  </div>
57
65
  );
58
66
 
59
- const bot = data?.bots?.find(b => b.name === botId) ?? data?.bots?.[0];
67
+ const bot = data?.bots?.find((b: any) => b.name === botId) ?? data?.bots?.[0];
60
68
  const provider = bot?.provider ?? 'Not configured';
61
69
  const approval = bot?.approvalMode ?? 'auto';
62
70
  const hasBots = (data?.bots?.length ?? 0) > 0;
63
71
 
64
72
  return (
65
- <CollapsibleSection title="Configuration" defaultOpen>
73
+ <CollapsibleSection title="Configuration" defaultExpanded>
66
74
  <div style={{ padding: '4px 12px 12px' }}>
67
- <KeyValueRow label="Provider" value={provider} />
68
- <KeyValueRow label="Approval" value={approval} />
69
- <KeyValueRow label="Trust Phase" value={`P${data?.trust?.phase ?? '?'} (${data?.trust?.score ?? 0}/100)`} />
75
+ <ConfigRow>
76
+ <Typography variant="smallCaption-bold" color="color-text-subtle">Provider</Typography>
77
+ <Typography variant="caption-regular" color="color-text-high">{provider}</Typography>
78
+ </ConfigRow>
79
+ <ConfigRow>
80
+ <Typography variant="smallCaption-bold" color="color-text-subtle">Approval</Typography>
81
+ <Typography variant="caption-regular" color="color-text-high">{approval}</Typography>
82
+ </ConfigRow>
83
+ <ConfigRow>
84
+ <Typography variant="smallCaption-bold" color="color-text-subtle">Trust Phase</Typography>
85
+ <Typography variant="caption-regular" color="color-text-high">P{data?.trust?.phase ?? '?'} ({data?.trust?.score ?? 0}/100)</Typography>
86
+ </ConfigRow>
70
87
 
71
88
  {!hasBots && (
72
89
  <div style={{ marginTop: 12 }}>
73
- <Banner variant="info" size="compact">
90
+ <Banner status="info" size="small">
74
91
  No .weaver.json detected. Create one to configure providers and approval modes.
75
92
  </Banner>
76
93
  <Typography variant="caption-regular" color="color-text-subtle" style={{ marginTop: 6, fontFamily: 'var(--typography-family-mono)' }}>
@@ -43,7 +43,7 @@ function callTool(tool: string, body: Record<string, unknown> = {}) {
43
43
  if (!res.ok) throw new Error('Request failed');
44
44
  const json = await res.json();
45
45
  if (json.isError) throw new Error(json.result);
46
- return JSON.parse(json.result);
46
+ try { return JSON.parse(json.result); } catch { return json.result; }
47
47
  });
48
48
  }
49
49
 
@@ -105,9 +105,9 @@ function healthColor(score: number): string {
105
105
  }
106
106
 
107
107
  const severityToVariant: Record<string, string> = {
108
- critical: 'negative',
109
- warning: 'caution',
110
- info: 'neutral',
108
+ critical: 'error',
109
+ warning: 'warning',
110
+ info: 'default',
111
111
  };
112
112
 
113
113
  const outcomeToIcon: Record<string, { name: TIconNameType; color: string }> = {
@@ -163,11 +163,11 @@ function BotDashboard({ packName, botId }: { packName: string; botId: string })
163
163
  return () => clearInterval(timerRef.current);
164
164
  }, [fetchData]);
165
165
 
166
- if (loading) return <div style={{ padding: 16, textAlign: 'center' }}><LoadingSpinner size="sm" /></div>;
166
+ if (loading) return <div style={{ padding: 16, textAlign: 'center' }}><LoadingSpinner size="small" /></div>;
167
167
 
168
168
  if (error && !insights) return (
169
169
  <div style={{ padding: 12 }}>
170
- <Banner variant="error" size="compact">{error}</Banner>
170
+ <Banner status="danger" size="small">{error}</Banner>
171
171
  </div>
172
172
  );
173
173
 
@@ -180,7 +180,7 @@ function BotDashboard({ packName, botId }: { packName: string; botId: string })
180
180
  const recentRuns = history.slice(0, 5);
181
181
 
182
182
  return (
183
- <CollapsibleSection title="Dashboard" defaultOpen>
183
+ <CollapsibleSection title="Dashboard" defaultExpanded>
184
184
  <div style={{ padding: '4px 12px 12px' }}>
185
185
  {/* KPI cards */}
186
186
  <KpiRow>
@@ -206,7 +206,7 @@ function BotDashboard({ packName, botId }: { packName: string; botId: string })
206
206
  </Typography>
207
207
  {topInsights.map((ins, i) => (
208
208
  <InsightRow key={i}>
209
- <Badge variant={(severityToVariant[ins.severity] ?? 'neutral') as any} size="sm">
209
+ <Badge variant={(severityToVariant[ins.severity] ?? 'default') as any}>
210
210
  {ins.severity}
211
211
  </Badge>
212
212
  <Typography variant="caption-regular" color="color-text-medium" style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>