@burdenoff/microfe-bigconsole 2026.1012.7 → 2026.1012.9

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.
@@ -1,4 +1,4 @@
1
- import { CustomWidgetProposal } from './proposalContract';
1
+ import { CustomWidgetProposal, ProposableWidgetType } from './proposalContract';
2
2
 
3
3
  /** A sink the current user may bind to, as the panel knows it. */
4
4
  export interface ProposalCandidateSink {
@@ -33,6 +33,8 @@ export interface CustomWidgetProposalSource {
33
33
  readonly id: string;
34
34
  propose(request: ProposalRequest): Promise<CustomWidgetProposal>;
35
35
  }
36
+ /** Keep shared human edits while removing mappings the new renderer cannot use. */
37
+ export declare function changeProposalWidgetType(proposal: CustomWidgetProposal, widgetType: ProposableWidgetType): CustomWidgetProposal;
36
38
  /**
37
39
  * Derives a proposal from the prompt and the workspace's real, permitted sinks
38
40
  * and parsers. Deterministic, so the review UI and its tests behave predictably.
@@ -1,12 +1,13 @@
1
+ import { PROPOSABLE_WIDGET_TYPES as e } from "./proposalContract.js";
1
2
  //#region src/bigconsole/customWidget/proposalSource.ts
2
- function e(e) {
3
+ function t(e) {
3
4
  return e.filter((e) => !e.deletedAt && e.isActive !== !1).map(({ id: e, key: t, name: n }) => ({
4
5
  id: e,
5
6
  key: t,
6
7
  name: n
7
8
  }));
8
9
  }
9
- var t = [
10
+ var n = [
10
11
  {
11
12
  type: "funnel_chart",
12
13
  words: [
@@ -65,7 +66,7 @@ var t = [
65
66
  "graph"
66
67
  ]
67
68
  }
68
- ], n = [
69
+ ], r = [
69
70
  {
70
71
  chartType: "bar",
71
72
  words: ["bar"]
@@ -92,17 +93,17 @@ var t = [
92
93
  ]
93
94
  }
94
95
  ];
95
- function r(e) {
96
- let n = e.toLowerCase();
97
- for (let { type: e, words: r } of t) if (r.some((e) => n.includes(e))) return e;
96
+ function i(e) {
97
+ let t = e.toLowerCase();
98
+ for (let { type: e, words: r } of n) if (r.some((e) => t.includes(e))) return e;
98
99
  return "chart";
99
100
  }
100
- function i(e) {
101
+ function a(e) {
101
102
  let t = e.toLowerCase();
102
- for (let { chartType: e, words: r } of n) if (r.some((e) => t.includes(e))) return e;
103
+ for (let { chartType: e, words: n } of r) if (n.some((e) => t.includes(e))) return e;
103
104
  return "line";
104
105
  }
105
- function a(e, t) {
106
+ function o(e, t) {
106
107
  if (t.length === 0) return;
107
108
  let n = e.toLowerCase().split(/[^a-z0-9]+/).filter((e) => e.length > 2), r;
108
109
  for (let e of t) {
@@ -114,7 +115,7 @@ function a(e, t) {
114
115
  }
115
116
  return r?.sink ?? t[0];
116
117
  }
117
- function o(e) {
118
+ function s(e) {
118
119
  switch (e) {
119
120
  case "heatmap": return {
120
121
  xAxisField: "column",
@@ -138,7 +139,20 @@ function o(e) {
138
139
  };
139
140
  }
140
141
  }
141
- function s(e, t) {
142
+ function c(t, n) {
143
+ if (t.widgetType === n) return t;
144
+ let r = s(n), i = Object.fromEntries(Object.entries(r).map(([e, n]) => [e, t.fieldMapping[e] ?? n])), a = new Set(e.flatMap((e) => Object.keys(s(e)))), o = new Set([...a].filter((e) => !Object.hasOwn(r, e)));
145
+ return {
146
+ ...t,
147
+ widgetType: n,
148
+ fieldMapping: i,
149
+ presentation: {
150
+ ...t.presentation,
151
+ config: Object.fromEntries(Object.entries(t.presentation.config).filter(([e]) => !o.has(e)))
152
+ }
153
+ };
154
+ }
155
+ function l(e, t) {
142
156
  let n = {
143
157
  showLegend: !0,
144
158
  showTooltip: !0
@@ -146,7 +160,7 @@ function s(e, t) {
146
160
  switch (e) {
147
161
  case "chart": return {
148
162
  ...n,
149
- chartType: i(t),
163
+ chartType: a(t),
150
164
  showGrid: !0
151
165
  };
152
166
  case "funnel_chart": return {
@@ -173,37 +187,37 @@ function s(e, t) {
173
187
  default: return n;
174
188
  }
175
189
  }
176
- function c(e) {
190
+ function u(e) {
177
191
  let t = e.trim().replace(/^(please\s+)?(create|build|make|add|show me|show|give me)\s+(an?\s+|the\s+)?/i, "").split(/[.;\n]/)[0].trim();
178
192
  if (!t) return "Custom widget";
179
193
  let n = t.charAt(0).toUpperCase() + t.slice(1);
180
194
  return n.length > 60 ? `${n.slice(0, 57)}…` : n;
181
195
  }
182
- var l = 0, u = {
196
+ var d = 0, f = {
183
197
  id: "local-heuristic-v1",
184
198
  async propose({ prompt: e, sinks: t, parsers: n }) {
185
- let i = r(e), d = a(e, t), f = d ? n.find((e) => e.inputSinkKey === d.key) : void 0;
186
- return l += 1, {
199
+ let r = i(e), a = o(e, t), c = a ? n.find((e) => e.inputSinkKey === a.key) : void 0;
200
+ return d += 1, {
187
201
  version: "1.0",
188
- id: `proposal-${l}`,
202
+ id: `proposal-${d}`,
189
203
  sourcePrompt: e,
190
- generatedBy: u.id,
191
- widgetType: i,
204
+ generatedBy: f.id,
205
+ widgetType: r,
192
206
  binding: {
193
- dataSinkId: d?.id ?? "",
194
- dataSinkKey: d?.key,
195
- parserId: f?.id,
196
- parserName: f?.name
207
+ dataSinkId: a?.id ?? "",
208
+ dataSinkKey: a?.key,
209
+ parserId: c?.id,
210
+ parserName: c?.name
197
211
  },
198
- fieldMapping: o(i),
212
+ fieldMapping: s(r),
199
213
  presentation: {
200
- title: c(e),
214
+ title: u(e),
201
215
  description: `Generated from: "${e}"`,
202
- config: s(i, e)
216
+ config: l(r, e)
203
217
  },
204
- rationale: d ? `Matched DataSink "${d.key}"${f ? ` and parser "${f.name}"` : " (no parser found for this sink)"}.` : "No DataSink is available in this workspace — create one before saving this widget."
218
+ rationale: a ? `Matched DataSink "${a.key}"${c ? ` and parser "${c.name}"` : " (no parser found for this sink)"}.` : "No DataSink is available in this workspace — create one before saving this widget."
205
219
  };
206
220
  }
207
221
  };
208
222
  //#endregion
209
- export { u as localProposalSource, e as selectActiveProposalSinks };
223
+ export { c as changeProposalWidgetType, f as localProposalSource, t as selectActiveProposalSinks };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-bigconsole",
3
- "version": "2026.1012.7",
3
+ "version": "2026.1012.9",
4
4
  "description": "BigConsole - AI-powered analytics and dashboard platform",
5
5
  "type": "module",
6
6
  "files": [