@burdenoff/microfe-bigconsole 2026.1103.7 → 2026.1103.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.
- package/dist/bigconsole/components/insights/PromptAnalysisPreview.d.ts +21 -0
- package/dist/bigconsole/components/insights/PromptAnalysisPreview.js +203 -0
- package/dist/bigconsole/pages/InsightsPage.js +583 -559
- package/dist/bigconsole/utils/generationRevisions.d.ts +29 -0
- package/dist/bigconsole/utils/generationRevisions.js +16 -0
- package/dist/generated/global-operations.d.ts +10 -24
- package/dist/generated/global-types.d.ts +6088 -1928
- package/dist/generated/wspace-operations.d.ts +5 -1
- package/dist/generated/wspace-types.d.ts +23844 -475
- package/package.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
export interface PromptAnalysis {
|
|
3
|
+
detectedIntent: string;
|
|
4
|
+
suggestedCategory: string;
|
|
5
|
+
estimatedWidgetCount: number;
|
|
6
|
+
suggestedWidgetTypes: string[];
|
|
7
|
+
detectedMetrics: string[];
|
|
8
|
+
dataRequirements: string[];
|
|
9
|
+
confidence: number;
|
|
10
|
+
suggestedRefinements?: string[] | null;
|
|
11
|
+
}
|
|
12
|
+
/** `BAR_CHART` -> `Bar chart`; a short single word stays an acronym (`KPI`). */
|
|
13
|
+
export declare function humanizeEnum(value: string): string;
|
|
14
|
+
interface Props {
|
|
15
|
+
/** The prompt as currently typed. */
|
|
16
|
+
prompt: string;
|
|
17
|
+
/** Disable the control while a generation is being submitted. */
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare const PromptAnalysisPreview: FC<Props>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { reportBigConsoleQuotaError as e } from "../../utils/quota.js";
|
|
2
|
+
import { SECTION_FOCUS_RING as t } from "../common/sectionStyles.js";
|
|
3
|
+
import "../common/index.js";
|
|
4
|
+
import { memo as n, useCallback as r, useState as i } from "react";
|
|
5
|
+
import { Loader2 as a, ScanSearch as o } from "lucide-react";
|
|
6
|
+
import { useI18n as s } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
7
|
+
import { useApolloClient as c } from "@apollo/client/react";
|
|
8
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
9
|
+
import { gql as d } from "@apollo/client";
|
|
10
|
+
//#region src/bigconsole/components/insights/PromptAnalysisPreview.tsx
|
|
11
|
+
var f = d`
|
|
12
|
+
query PreviewPromptAnalysis($prompt: String!) {
|
|
13
|
+
previewPromptAnalysis(prompt: $prompt) {
|
|
14
|
+
detectedIntent
|
|
15
|
+
suggestedCategory
|
|
16
|
+
estimatedWidgetCount
|
|
17
|
+
suggestedWidgetTypes
|
|
18
|
+
detectedMetrics
|
|
19
|
+
dataRequirements
|
|
20
|
+
confidence
|
|
21
|
+
suggestedRefinements
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
function p(e) {
|
|
26
|
+
let t = e.split("_").filter(Boolean);
|
|
27
|
+
if (t.length === 1 && t[0].length <= 3) return t[0].toUpperCase();
|
|
28
|
+
let n = t.join(" ").toLowerCase();
|
|
29
|
+
return n.charAt(0).toUpperCase() + n.slice(1);
|
|
30
|
+
}
|
|
31
|
+
var m = {
|
|
32
|
+
display: "inline-flex",
|
|
33
|
+
alignItems: "center",
|
|
34
|
+
gap: "var(--space-iconGap)",
|
|
35
|
+
minHeight: "var(--size-controlHeight-md)",
|
|
36
|
+
padding: "0 var(--space-formGap)",
|
|
37
|
+
borderRadius: "var(--radius-button)",
|
|
38
|
+
border: "1px solid var(--color-border-default)",
|
|
39
|
+
backgroundColor: "transparent",
|
|
40
|
+
color: "var(--color-text-primary)",
|
|
41
|
+
fontSize: "var(--font-size-body-sm)",
|
|
42
|
+
fontWeight: "var(--font-weight-medium)"
|
|
43
|
+
}, h = {
|
|
44
|
+
display: "flex",
|
|
45
|
+
flexDirection: "column",
|
|
46
|
+
gap: "var(--space-iconGap)",
|
|
47
|
+
padding: "var(--space-controlGap) var(--space-formGap)",
|
|
48
|
+
borderRadius: "var(--radius-input)",
|
|
49
|
+
border: "1px solid var(--color-border-subtle)",
|
|
50
|
+
backgroundColor: "var(--color-bg-sunken)",
|
|
51
|
+
fontSize: "var(--font-size-body-sm)",
|
|
52
|
+
color: "var(--color-text-secondary)"
|
|
53
|
+
}, g = {
|
|
54
|
+
padding: "0 var(--space-iconGap)",
|
|
55
|
+
borderRadius: "var(--radius-button)",
|
|
56
|
+
border: "1px solid var(--color-border-subtle)",
|
|
57
|
+
color: "var(--color-text-primary)"
|
|
58
|
+
}, _ = n(function({ prompt: n, disabled: d = !1 }) {
|
|
59
|
+
let { t: _ } = s(), v = c(), [y, b] = i(null), [x, S] = i(null), [C, w] = i(!1), T = n.trim(), E = r(async () => {
|
|
60
|
+
if (!(!T || C)) {
|
|
61
|
+
w(!0), S(null);
|
|
62
|
+
try {
|
|
63
|
+
let t = await v.query({
|
|
64
|
+
query: f,
|
|
65
|
+
variables: { prompt: T },
|
|
66
|
+
fetchPolicy: "network-only"
|
|
67
|
+
});
|
|
68
|
+
if (e(t, "command")) return;
|
|
69
|
+
let n = t.data?.previewPromptAnalysis;
|
|
70
|
+
n ? b({
|
|
71
|
+
prompt: T,
|
|
72
|
+
result: n
|
|
73
|
+
}) : S(_("bigconsole.insights.analysis.failed", "Could not analyse this prompt. Please try again."));
|
|
74
|
+
} catch (t) {
|
|
75
|
+
if (e(t, "command")) return;
|
|
76
|
+
S(t instanceof Error ? t.message : _("bigconsole.insights.analysis.failed", "Could not analyse this prompt. Please try again."));
|
|
77
|
+
} finally {
|
|
78
|
+
w(!1);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}, [
|
|
82
|
+
C,
|
|
83
|
+
v,
|
|
84
|
+
_,
|
|
85
|
+
T
|
|
86
|
+
]), D = y && y.prompt === T ? y.result : null, O = y !== null && D === null, k = "prompt-analysis-hint";
|
|
87
|
+
return /* @__PURE__ */ u("div", {
|
|
88
|
+
style: {
|
|
89
|
+
display: "flex",
|
|
90
|
+
flexDirection: "column",
|
|
91
|
+
gap: "var(--space-controlGap)"
|
|
92
|
+
},
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ u("div", {
|
|
95
|
+
style: {
|
|
96
|
+
display: "flex",
|
|
97
|
+
alignItems: "center",
|
|
98
|
+
flexWrap: "wrap",
|
|
99
|
+
gap: "var(--space-controlGap)"
|
|
100
|
+
},
|
|
101
|
+
children: [/* @__PURE__ */ u("button", {
|
|
102
|
+
type: "button",
|
|
103
|
+
onClick: () => void E(),
|
|
104
|
+
disabled: !T || C || d,
|
|
105
|
+
"aria-describedby": k,
|
|
106
|
+
className: t,
|
|
107
|
+
style: {
|
|
108
|
+
...m,
|
|
109
|
+
cursor: !T || C || d ? "not-allowed" : "pointer",
|
|
110
|
+
opacity: !T || C || d ? .5 : 1
|
|
111
|
+
},
|
|
112
|
+
children: [C ? /* @__PURE__ */ l(a, {
|
|
113
|
+
size: 16,
|
|
114
|
+
className: "animate-spin",
|
|
115
|
+
"aria-hidden": "true"
|
|
116
|
+
}) : /* @__PURE__ */ l(o, {
|
|
117
|
+
size: 16,
|
|
118
|
+
"aria-hidden": "true"
|
|
119
|
+
}), _("bigconsole.insights.analysis.button", "Preview analysis")]
|
|
120
|
+
}), /* @__PURE__ */ l("span", {
|
|
121
|
+
id: k,
|
|
122
|
+
style: {
|
|
123
|
+
fontSize: "var(--font-size-body-sm)",
|
|
124
|
+
color: "var(--color-text-muted)"
|
|
125
|
+
},
|
|
126
|
+
children: _("bigconsole.insights.analysis.hint", "See the detected intent and widget estimate. Uses 1 AI command.")
|
|
127
|
+
})]
|
|
128
|
+
}),
|
|
129
|
+
x && /* @__PURE__ */ l("p", {
|
|
130
|
+
role: "alert",
|
|
131
|
+
style: {
|
|
132
|
+
margin: 0,
|
|
133
|
+
fontSize: "var(--font-size-body-sm)",
|
|
134
|
+
color: "var(--color-status-error-text)"
|
|
135
|
+
},
|
|
136
|
+
children: x
|
|
137
|
+
}),
|
|
138
|
+
O && !x && /* @__PURE__ */ l("p", {
|
|
139
|
+
style: {
|
|
140
|
+
margin: 0,
|
|
141
|
+
fontSize: "var(--font-size-body-sm)",
|
|
142
|
+
color: "var(--color-text-muted)"
|
|
143
|
+
},
|
|
144
|
+
children: _("bigconsole.insights.analysis.stale", "The prompt changed since the last analysis. Preview it again.")
|
|
145
|
+
}),
|
|
146
|
+
D && /* @__PURE__ */ u("div", {
|
|
147
|
+
role: "status",
|
|
148
|
+
"data-testid": "prompt-analysis",
|
|
149
|
+
style: h,
|
|
150
|
+
children: [
|
|
151
|
+
/* @__PURE__ */ u("div", { children: [
|
|
152
|
+
/* @__PURE__ */ u("strong", {
|
|
153
|
+
style: { color: "var(--color-text-primary)" },
|
|
154
|
+
children: [_("bigconsole.insights.analysis.intent", "Detected intent"), ":"]
|
|
155
|
+
}),
|
|
156
|
+
" ",
|
|
157
|
+
D.detectedIntent,
|
|
158
|
+
" (",
|
|
159
|
+
p(D.suggestedCategory),
|
|
160
|
+
")"
|
|
161
|
+
] }),
|
|
162
|
+
/* @__PURE__ */ u("div", { children: [
|
|
163
|
+
/* @__PURE__ */ u("strong", {
|
|
164
|
+
style: { color: "var(--color-text-primary)" },
|
|
165
|
+
children: [_("bigconsole.insights.analysis.widgetCount", "Estimated widgets"), ":"]
|
|
166
|
+
}),
|
|
167
|
+
" ",
|
|
168
|
+
D.estimatedWidgetCount
|
|
169
|
+
] }),
|
|
170
|
+
D.suggestedWidgetTypes.length > 0 && /* @__PURE__ */ l("div", {
|
|
171
|
+
style: {
|
|
172
|
+
display: "flex",
|
|
173
|
+
flexWrap: "wrap",
|
|
174
|
+
gap: "var(--space-iconGap)"
|
|
175
|
+
},
|
|
176
|
+
children: D.suggestedWidgetTypes.map((e) => /* @__PURE__ */ l("span", {
|
|
177
|
+
style: g,
|
|
178
|
+
children: p(e)
|
|
179
|
+
}, e))
|
|
180
|
+
}),
|
|
181
|
+
D.detectedMetrics.length > 0 && /* @__PURE__ */ u("div", { children: [
|
|
182
|
+
/* @__PURE__ */ u("strong", {
|
|
183
|
+
style: { color: "var(--color-text-primary)" },
|
|
184
|
+
children: [_("bigconsole.insights.analysis.metrics", "Metrics"), ":"]
|
|
185
|
+
}),
|
|
186
|
+
" ",
|
|
187
|
+
D.detectedMetrics.join(", ")
|
|
188
|
+
] }),
|
|
189
|
+
(D.suggestedRefinements?.length ?? 0) > 0 && /* @__PURE__ */ u("div", { children: [
|
|
190
|
+
/* @__PURE__ */ u("strong", {
|
|
191
|
+
style: { color: "var(--color-text-primary)" },
|
|
192
|
+
children: [_("bigconsole.insights.analysis.suggestions", "Suggestions"), ":"]
|
|
193
|
+
}),
|
|
194
|
+
" ",
|
|
195
|
+
D.suggestedRefinements?.join("; ")
|
|
196
|
+
] })
|
|
197
|
+
]
|
|
198
|
+
})
|
|
199
|
+
]
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
//#endregion
|
|
203
|
+
export { _ as PromptAnalysisPreview, p as humanizeEnum };
|