@burdenoff/microfe-semanticfed 2026.1109.14 → 2026.1109.16
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/README.md +33 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/semanticfed/components/AskQuestionPanel.d.ts +0 -14
- package/dist/semanticfed/components/AskQuestionPanel.js +198 -160
- package/dist/semanticfed/components/AskQuestionPanel.js.map +1 -1
- package/dist/semanticfed/components/NlAssistSettings.js +4 -4
- package/dist/semanticfed/components/NlAssistSettings.js.map +1 -1
- package/dist/semanticfed/components/OnboardingChecklist.js +172 -128
- package/dist/semanticfed/components/OnboardingChecklist.js.map +1 -1
- package/dist/semanticfed/components/PageHeader.d.ts +11 -0
- package/dist/semanticfed/components/PageHeader.js +21 -0
- package/dist/semanticfed/components/PageHeader.js.map +1 -0
- package/dist/semanticfed/components/SavedQueryRunsPanel.js +224 -200
- package/dist/semanticfed/components/SavedQueryRunsPanel.js.map +1 -1
- package/dist/semanticfed/components/SummaryCard.d.ts +10 -0
- package/dist/semanticfed/components/SummaryCard.js +21 -0
- package/dist/semanticfed/components/SummaryCard.js.map +1 -0
- package/dist/semanticfed/components/TableHeaders.d.ts +16 -0
- package/dist/semanticfed/components/TableHeaders.js +21 -0
- package/dist/semanticfed/components/TableHeaders.js.map +1 -0
- package/dist/semanticfed/components/askConversation.d.ts +16 -0
- package/dist/semanticfed/components/askConversation.js +7 -0
- package/dist/semanticfed/components/askConversation.js.map +1 -0
- package/dist/semanticfed/components/lineage/LineageDetails.d.ts +15 -0
- package/dist/semanticfed/components/lineage/LineageDetails.js +155 -0
- package/dist/semanticfed/components/lineage/LineageDetails.js.map +1 -0
- package/dist/semanticfed/components/lineage/LineageLanes.d.ts +11 -0
- package/dist/semanticfed/components/lineage/LineageLanes.js +78 -0
- package/dist/semanticfed/components/lineage/LineageLanes.js.map +1 -0
- package/dist/semanticfed/components/lineage/LineageToolbar.d.ts +14 -0
- package/dist/semanticfed/components/lineage/LineageToolbar.js +69 -0
- package/dist/semanticfed/components/lineage/LineageToolbar.js.map +1 -0
- package/dist/semanticfed/components/lineage/LineageWarnings.d.ts +13 -0
- package/dist/semanticfed/components/lineage/LineageWarnings.js +43 -0
- package/dist/semanticfed/components/lineage/LineageWarnings.js.map +1 -0
- package/dist/semanticfed/components/lineage/lineageModel.d.ts +30 -0
- package/dist/semanticfed/components/lineage/lineageModel.js +110 -0
- package/dist/semanticfed/components/lineage/lineageModel.js.map +1 -0
- package/dist/semanticfed/components/lineage/useLineageTrace.d.ts +17 -0
- package/dist/semanticfed/components/lineage/useLineageTrace.js +34 -0
- package/dist/semanticfed/components/lineage/useLineageTrace.js.map +1 -0
- package/dist/semanticfed/components/queryConsole/QueryHistoryCard.d.ts +10 -0
- package/dist/semanticfed/components/queryConsole/QueryHistoryCard.js +47 -0
- package/dist/semanticfed/components/queryConsole/QueryHistoryCard.js.map +1 -0
- package/dist/semanticfed/components/queryConsole/SchemaBrowser.d.ts +13 -0
- package/dist/semanticfed/components/queryConsole/SchemaBrowser.js +89 -0
- package/dist/semanticfed/components/queryConsole/SchemaBrowser.js.map +1 -0
- package/dist/semanticfed/components/queryConsole/SqlEditorCard.d.ts +14 -0
- package/dist/semanticfed/components/queryConsole/SqlEditorCard.js +69 -0
- package/dist/semanticfed/components/queryConsole/SqlEditorCard.js.map +1 -0
- package/dist/semanticfed/components/queryConsole/SqlResultCard.d.ts +14 -0
- package/dist/semanticfed/components/queryConsole/SqlResultCard.js +71 -0
- package/dist/semanticfed/components/queryConsole/SqlResultCard.js.map +1 -0
- package/dist/semanticfed/components/queryConsole/consoleHistory.d.ts +23 -0
- package/dist/semanticfed/components/queryConsole/consoleHistory.js +19 -0
- package/dist/semanticfed/components/queryConsole/consoleHistory.js.map +1 -0
- package/dist/semanticfed/hooks/useLineage.d.ts +2 -1
- package/dist/semanticfed/hooks/useLineage.js +24 -23
- package/dist/semanticfed/hooks/useLineage.js.map +1 -1
- package/dist/semanticfed/hooks/useNlQuery.js +13 -10
- package/dist/semanticfed/hooks/useNlQuery.js.map +1 -1
- package/dist/semanticfed/hooks/useSqlConsole.d.ts +2 -1
- package/dist/semanticfed/hooks/useSqlConsole.js +28 -27
- package/dist/semanticfed/hooks/useSqlConsole.js.map +1 -1
- package/dist/semanticfed/pages/AgentsPage.js +119 -148
- package/dist/semanticfed/pages/AgentsPage.js.map +1 -1
- package/dist/semanticfed/pages/AuditPage.js +95 -76
- package/dist/semanticfed/pages/AuditPage.js.map +1 -1
- package/dist/semanticfed/pages/CollaborationPage.js +60 -64
- package/dist/semanticfed/pages/CollaborationPage.js.map +1 -1
- package/dist/semanticfed/pages/ConfigurationPage.js +86 -67
- package/dist/semanticfed/pages/ConfigurationPage.js.map +1 -1
- package/dist/semanticfed/pages/DashboardPage.js +1 -1
- package/dist/semanticfed/pages/DashboardPage.js.map +1 -1
- package/dist/semanticfed/pages/HelpPage.js +1 -1
- package/dist/semanticfed/pages/HelpPage.js.map +1 -1
- package/dist/semanticfed/pages/KnowledgeGraphPage.js +129 -128
- package/dist/semanticfed/pages/KnowledgeGraphPage.js.map +1 -1
- package/dist/semanticfed/pages/LineagePage.js +110 -424
- package/dist/semanticfed/pages/LineagePage.js.map +1 -1
- package/dist/semanticfed/pages/MonitoringPage.js +76 -76
- package/dist/semanticfed/pages/MonitoringPage.js.map +1 -1
- package/dist/semanticfed/pages/OntologyPage.js +71 -98
- package/dist/semanticfed/pages/OntologyPage.js.map +1 -1
- package/dist/semanticfed/pages/PerformancePage.js +2 -2
- package/dist/semanticfed/pages/PerformancePage.js.map +1 -1
- package/dist/semanticfed/pages/PoliciesPage.js +112 -141
- package/dist/semanticfed/pages/PoliciesPage.js.map +1 -1
- package/dist/semanticfed/pages/ProtocolPage.js +93 -94
- package/dist/semanticfed/pages/ProtocolPage.js.map +1 -1
- package/dist/semanticfed/pages/QueryConsolePage.js +160 -327
- package/dist/semanticfed/pages/QueryConsolePage.js.map +1 -1
- package/dist/semanticfed/pages/RegistryPage.js +94 -105
- package/dist/semanticfed/pages/RegistryPage.js.map +1 -1
- package/dist/semanticfed/pages/TechStackPage.js +1 -1
- package/dist/semanticfed/pages/TechStackPage.js.map +1 -1
- package/dist/semanticfed/pages/TopologyPage.js +68 -99
- package/dist/semanticfed/pages/TopologyPage.js.map +1 -1
- package/dist/semanticfed/pages/VisualizationPage.js +7 -7
- package/dist/semanticfed/pages/VisualizationPage.js.map +1 -1
- package/dist/semanticfed/translations/english.js +514 -0
- package/dist/semanticfed/translations/english.js.map +1 -0
- package/dist/semanticfed/translations/english.json.d.ts +513 -0
- package/dist/semanticfed/utils/contentKeys.d.ts +16 -0
- package/dist/semanticfed/utils/contentKeys.js +14 -0
- package/dist/semanticfed/utils/contentKeys.js.map +1 -0
- package/dist/semanticfed/utils/requestErrorI18n.d.ts +3 -0
- package/dist/semanticfed/utils/requestErrorI18n.js +15 -0
- package/dist/semanticfed/utils/requestErrorI18n.js.map +1 -0
- package/package.json +9 -3
package/README.md
CHANGED
|
@@ -34,3 +34,36 @@ commit tests with browser fetch disabled. Native context changes reset local
|
|
|
34
34
|
result/history/editor state and query data; ordinary bearer renewal in the same
|
|
35
35
|
context preserves that state. The tests are protocol and state fixtures, separate
|
|
36
36
|
from deployed doctor and Playwright acceptance. They are part of `sanity`.
|
|
37
|
+
|
|
38
|
+
## Product translations and RTL
|
|
39
|
+
|
|
40
|
+
`bun run i18n:extract` statically extracts the literal translation calls and the
|
|
41
|
+
finite onboarding, guide, lineage and label maps into
|
|
42
|
+
`src/semanticfed/translations/english.json`. It never imports or executes product
|
|
43
|
+
source. An unclassified dynamic call or conflicting English fallback fails the
|
|
44
|
+
command. `bun run i18n:check` verifies the checked-in catalog and extraction
|
|
45
|
+
regressions; `sanity` runs it after generating the GraphQL artifacts required by
|
|
46
|
+
the client tests.
|
|
47
|
+
|
|
48
|
+
The package exports `semanticfedEnglishCatalog`, a flat map of dot-notated keys
|
|
49
|
+
to their current English fallback values. The dedicated
|
|
50
|
+
`@burdenoff/microfe-semanticfed/translations/english` default export lets shells
|
|
51
|
+
load this data without eagerly importing the product component entry.
|
|
52
|
+
App shells can reconcile their bundled
|
|
53
|
+
fallbacks against the catalog of the exact package they pin. This catalog is
|
|
54
|
+
English source extraction, not a complete translation-seed bundle or proof that
|
|
55
|
+
online dictionaries or non-English translations are complete. Online changes
|
|
56
|
+
belong to the global i18n service's in-place seeder and reviewed plan, preserving
|
|
57
|
+
existing values and history.
|
|
58
|
+
|
|
59
|
+
Product spacing and text alignment use logical utilities. Pagination chevrons
|
|
60
|
+
mirror under the platform RTL mode; source/target graph direction and technical
|
|
61
|
+
SQL identifiers retain their meaning. The platform owns document direction:
|
|
62
|
+
use its supported `?dir=rtl` preview for browser acceptance rather than setting
|
|
63
|
+
`document.dir` in product components. Actual locale and RTL browser receipts are
|
|
64
|
+
separate from successful extraction and build checks.
|
|
65
|
+
|
|
66
|
+
Known fixed client request messages also use product translation keys. SQL parser
|
|
67
|
+
and service-provided diagnostic text remain verbatim; unknown messages are not
|
|
68
|
+
translated by guessing. The extraction gate rejects nonliteral metadata labels,
|
|
69
|
+
conflicting or duplicate fields, unsafe paths and unclassified dynamic calls.
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -2,4 +2,5 @@ import { useSemanticFed as e } from "./semanticfed/providers/SemanticFedProvider
|
|
|
2
2
|
import { SemanticFedRoot as t } from "./semanticfed/SemanticFedRoot.js";
|
|
3
3
|
import { useSemanticFedStore as n } from "./semanticfed/store/semanticfedStore.js";
|
|
4
4
|
import "./semanticfed/index.js";
|
|
5
|
-
|
|
5
|
+
import r from "./semanticfed/translations/english.js";
|
|
6
|
+
export { t as SemanticFedRoot, r as semanticfedEnglishCatalog, e as useSemanticFed, n as useSemanticFedStore };
|
|
@@ -1,17 +1,4 @@
|
|
|
1
1
|
import { SemNlAnswer } from '../hooks/useNlQuery';
|
|
2
|
-
/** One question of the conversation and what it got back. */
|
|
3
|
-
interface Turn {
|
|
4
|
-
id: number;
|
|
5
|
-
question: string;
|
|
6
|
-
answer: SemNlAnswer | null;
|
|
7
|
-
error: string | null;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* The questions a follow-up refines: the answered ones, oldest first. A turn
|
|
11
|
-
* the AI provider reworded is carried as its rewrite, which uses the model's
|
|
12
|
-
* own names.
|
|
13
|
-
*/
|
|
14
|
-
export declare function conversationHistory(turns: Turn[]): string[];
|
|
15
2
|
export interface AskQuestionPanelProps {
|
|
16
3
|
modelId: string | null;
|
|
17
4
|
maxRows: number;
|
|
@@ -32,4 +19,3 @@ export interface AskQuestionPanelProps {
|
|
|
32
19
|
* the answer can be checked, and opened in the SQL editor.
|
|
33
20
|
*/
|
|
34
21
|
export declare function AskQuestionPanel({ modelId, maxRows, onAnswer, onError, onOpenInEditor, }: AskQuestionPanelProps): import('react').JSX.Element;
|
|
35
|
-
export {};
|
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
import { useSemAskQuestion as e, useSemNlSuggestions as t } from "../hooks/useNlQuery.js";
|
|
2
2
|
import { NlAssistSettings as n } from "./NlAssistSettings.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
3
|
+
import { conversationHistory as r } from "./askConversation.js";
|
|
4
|
+
import { withContentKeys as i } from "../utils/contentKeys.js";
|
|
5
|
+
import { sqlErrorMessage as a } from "../hooks/useSqlConsole.js";
|
|
6
|
+
import { useTr as o } from "../hooks/useTr.js";
|
|
7
|
+
import { useRef as s, useState as c } from "react";
|
|
8
|
+
import { CornerDownRight as l, HelpCircle as u, Loader2 as d, MessageSquareText as f, PencilLine as p, RotateCcw as m, Send as h, Sparkles as g } from "lucide-react";
|
|
9
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
10
|
+
import { Badge as y, Button as b, Card as x, CardContent as S, CardHeader as C, CardTitle as w } from "@burdenoff/fe-libs/ui";
|
|
9
11
|
// src/semanticfed/components/AskQuestionPanel.tsx
|
|
10
|
-
var
|
|
11
|
-
function
|
|
12
|
-
return e.filter((e) => e.answer?.translation.status === "TRANSLATED").map((e) => e.answer?.translation.rephrasedQuestion ?? e.question).slice(-10);
|
|
13
|
-
}
|
|
14
|
-
function E(e) {
|
|
12
|
+
var T = 1e3, E = 6;
|
|
13
|
+
function D(e) {
|
|
15
14
|
return e == null ? "NULL" : typeof e == "string" ? `'${e}'` : typeof e == "object" ? JSON.stringify(e) : String(e);
|
|
16
15
|
}
|
|
17
|
-
function
|
|
16
|
+
function O(e, t) {
|
|
18
17
|
let n = [e.entity, e.field].filter(Boolean).join(".");
|
|
19
18
|
switch (e.kind) {
|
|
20
19
|
case "MEASURE": return `${e.aggregation ?? ""}(${n})${e.governed ? ` ${t}` : ""}`;
|
|
21
|
-
case "FILTER": return `${n} ${e.operator ?? "="} ${
|
|
20
|
+
case "FILTER": return `${n} ${e.operator ?? "="} ${D(e.value)}`;
|
|
22
21
|
case "ORDER": return `${n} ${e.direction ?? ""}`.trim();
|
|
23
22
|
case "LIMIT": return String(e.count ?? "");
|
|
24
23
|
case "JOIN": return e.relationship ? `${n} (${e.relationship})` : n;
|
|
25
24
|
default: return n;
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
|
-
function
|
|
27
|
+
function k(e, t) {
|
|
29
28
|
return {
|
|
30
29
|
REPHRASED: {
|
|
31
30
|
text: t("semanticfed.queryConsole.ask.assist.rephrased", "Reworded by your AI provider ({provider}) as: “{question}”", {
|
|
@@ -56,216 +55,255 @@ function O(e, t) {
|
|
|
56
55
|
}
|
|
57
56
|
}[e.assist] ?? null;
|
|
58
57
|
}
|
|
59
|
-
function
|
|
60
|
-
let a =
|
|
58
|
+
function A({ translation: e, governedLabel: t, onOpenInEditor: n, latest: r }) {
|
|
59
|
+
let a = o(), s = /* @__PURE__ */ _("pre", {
|
|
61
60
|
className: "overflow-x-auto rounded bg-muted p-3 font-mono text-xs text-foreground",
|
|
62
61
|
"data-testid": r ? "nl-ask-sql" : void 0,
|
|
63
62
|
children: e.sql
|
|
64
63
|
});
|
|
65
|
-
return /* @__PURE__ */
|
|
64
|
+
return /* @__PURE__ */ v("div", {
|
|
66
65
|
className: "space-y-2 rounded border p-3",
|
|
67
66
|
"data-testid": r ? "nl-ask-interpretation" : void 0,
|
|
68
67
|
children: [
|
|
69
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ v("div", {
|
|
70
69
|
className: "flex flex-wrap items-center justify-between gap-2",
|
|
71
|
-
children: [/* @__PURE__ */
|
|
70
|
+
children: [/* @__PURE__ */ v("div", {
|
|
72
71
|
className: "flex flex-wrap items-center gap-2 text-xs",
|
|
73
72
|
children: [
|
|
74
|
-
/* @__PURE__ */
|
|
73
|
+
/* @__PURE__ */ _("span", {
|
|
75
74
|
className: "font-medium",
|
|
76
75
|
children: a("semanticfed.queryConsole.ask.interpretation", "Interpretation")
|
|
77
76
|
}),
|
|
78
|
-
e.followUp && /* @__PURE__ */
|
|
77
|
+
e.followUp && /* @__PURE__ */ v(y, {
|
|
79
78
|
variant: "outline",
|
|
80
79
|
"data-testid": r ? "nl-ask-followup" : void 0,
|
|
81
|
-
children: [/* @__PURE__ */
|
|
80
|
+
children: [/* @__PURE__ */ _(l, { className: "me-1 h-3 w-3 rtl:-scale-x-100" }), a("semanticfed.queryConsole.ask.followUp", "Follow-up")]
|
|
82
81
|
}),
|
|
83
|
-
/* @__PURE__ */
|
|
82
|
+
/* @__PURE__ */ _(y, {
|
|
84
83
|
variant: "outline",
|
|
85
84
|
"data-testid": r ? "nl-ask-confidence" : void 0,
|
|
86
85
|
children: a("semanticfed.queryConsole.ask.confidence", "Confidence {value}%", { value: Math.round(e.confidence * 100) })
|
|
87
86
|
}),
|
|
88
|
-
e.steps.map((e, n) => /* @__PURE__ */
|
|
87
|
+
i(e.steps, (e) => `${e.kind}:${O(e, t)}`).map(({ key: e, item: n }) => /* @__PURE__ */ v(y, {
|
|
89
88
|
variant: "secondary",
|
|
90
89
|
className: "font-mono",
|
|
91
90
|
children: [
|
|
92
|
-
|
|
91
|
+
n.kind.replace("_", " "),
|
|
93
92
|
": ",
|
|
94
|
-
|
|
93
|
+
O(n, t)
|
|
95
94
|
]
|
|
96
|
-
},
|
|
95
|
+
}, e))
|
|
97
96
|
]
|
|
98
|
-
}), /* @__PURE__ */
|
|
97
|
+
}), /* @__PURE__ */ v(b, {
|
|
99
98
|
size: "sm",
|
|
100
99
|
variant: "outline",
|
|
101
100
|
onClick: () => n(e.sql ?? ""),
|
|
102
101
|
"data-testid": r ? "nl-ask-open-editor" : void 0,
|
|
103
|
-
children: [/* @__PURE__ */
|
|
102
|
+
children: [/* @__PURE__ */ _(p, { className: "me-2 h-4 w-4" }), a("semanticfed.queryConsole.ask.openInEditor", "Edit as SQL")]
|
|
104
103
|
})]
|
|
105
104
|
}),
|
|
106
|
-
r ?
|
|
105
|
+
r ? s : /* @__PURE__ */ v("details", { children: [/* @__PURE__ */ _("summary", {
|
|
107
106
|
className: "cursor-pointer text-xs text-muted-foreground",
|
|
108
107
|
children: a("semanticfed.queryConsole.ask.showSql", "Show SQL")
|
|
109
|
-
}),
|
|
110
|
-
e.unmatchedTerms.length > 0 && /* @__PURE__ */
|
|
108
|
+
}), s] }),
|
|
109
|
+
e.unmatchedTerms.length > 0 && /* @__PURE__ */ _("p", {
|
|
111
110
|
className: "text-xs text-muted-foreground",
|
|
112
111
|
children: a("semanticfed.queryConsole.ask.ignored", "Ignored words: {terms}", { terms: e.unmatchedTerms.join(", ") })
|
|
113
112
|
})
|
|
114
113
|
]
|
|
115
114
|
});
|
|
116
115
|
}
|
|
117
|
-
function
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
116
|
+
function j({ translation: e, latest: t, tr: n }) {
|
|
117
|
+
return /* @__PURE__ */ v("div", {
|
|
118
|
+
className: "flex items-start gap-2 rounded border border-dashed p-3 text-sm",
|
|
119
|
+
"data-testid": t ? "nl-ask-clarification" : void 0,
|
|
120
|
+
children: [/* @__PURE__ */ _(u, { className: "mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" }), /* @__PURE__ */ v("div", {
|
|
121
|
+
className: "min-w-0 space-y-1",
|
|
122
|
+
children: [/* @__PURE__ */ _("p", { children: e.clarification }), e.unmatchedTerms.length > 0 && /* @__PURE__ */ _("p", {
|
|
123
|
+
className: "text-xs text-muted-foreground",
|
|
124
|
+
children: n("semanticfed.queryConsole.ask.unmatched", "Not found in the model: {terms}", { terms: e.unmatchedTerms.join(", ") })
|
|
125
|
+
})]
|
|
126
|
+
})]
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function M({ turn: e, latest: t, governedLabel: n, onOpenInEditor: r, tr: i }) {
|
|
130
|
+
let a = e.answer?.translation ?? null, o = a ? k(a, i) : null;
|
|
131
|
+
return /* @__PURE__ */ v("li", {
|
|
132
|
+
className: "space-y-2",
|
|
133
|
+
"data-testid": "nl-ask-turn",
|
|
134
|
+
children: [
|
|
135
|
+
/* @__PURE__ */ _("p", {
|
|
136
|
+
className: "w-fit max-w-full rounded-lg bg-muted px-3 py-2 text-sm",
|
|
137
|
+
children: e.question
|
|
138
|
+
}),
|
|
139
|
+
e.error && /* @__PURE__ */ _("p", {
|
|
140
|
+
className: "text-xs text-destructive",
|
|
141
|
+
children: e.error
|
|
142
|
+
}),
|
|
143
|
+
o && /* @__PURE__ */ v("p", {
|
|
144
|
+
className: `flex items-start gap-1 text-xs ${o.tone === "warn" ? "text-muted-foreground" : "text-primary"}`,
|
|
145
|
+
"data-testid": t ? "nl-ask-assist-note" : void 0,
|
|
146
|
+
children: [/* @__PURE__ */ _(g, { className: "mt-0.5 h-3 w-3 shrink-0" }), o.text]
|
|
147
|
+
}),
|
|
148
|
+
a?.status === "NEEDS_CLARIFICATION" && /* @__PURE__ */ _(j, {
|
|
149
|
+
translation: a,
|
|
150
|
+
latest: t,
|
|
151
|
+
tr: i
|
|
152
|
+
}),
|
|
153
|
+
a?.status === "TRANSLATED" && a.sql && /* @__PURE__ */ _(A, {
|
|
154
|
+
translation: a,
|
|
155
|
+
governedLabel: n,
|
|
156
|
+
onOpenInEditor: r,
|
|
157
|
+
latest: t
|
|
158
|
+
})
|
|
159
|
+
]
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
function N({ hasTurns: e, busy: t, showSettings: n, onNewConversation: r, onToggleSettings: i, tr: a }) {
|
|
163
|
+
return /* @__PURE__ */ v(C, {
|
|
164
|
+
className: "pb-3",
|
|
165
|
+
children: [/* @__PURE__ */ v("div", {
|
|
166
|
+
className: "flex flex-wrap items-center justify-between gap-2",
|
|
167
|
+
children: [/* @__PURE__ */ v(w, {
|
|
168
|
+
className: "flex items-center gap-2 text-base",
|
|
169
|
+
children: [/* @__PURE__ */ _(f, { className: "h-4 w-4" }), a("semanticfed.queryConsole.ask.title", "Ask a question")]
|
|
170
|
+
}), /* @__PURE__ */ v("div", {
|
|
171
|
+
className: "flex flex-wrap gap-2",
|
|
172
|
+
children: [e && /* @__PURE__ */ v(b, {
|
|
173
|
+
size: "sm",
|
|
174
|
+
variant: "ghost",
|
|
175
|
+
onClick: r,
|
|
176
|
+
disabled: t,
|
|
177
|
+
"data-testid": "nl-ask-new-conversation",
|
|
178
|
+
children: [/* @__PURE__ */ _(m, { className: "me-2 h-4 w-4" }), a("semanticfed.queryConsole.ask.newConversation", "New conversation")]
|
|
179
|
+
}), /* @__PURE__ */ v(b, {
|
|
180
|
+
size: "sm",
|
|
181
|
+
variant: n ? "secondary" : "ghost",
|
|
182
|
+
onClick: i,
|
|
183
|
+
"aria-expanded": n,
|
|
184
|
+
"data-testid": "nl-assist-toggle",
|
|
185
|
+
children: [/* @__PURE__ */ _(g, { className: "me-2 h-4 w-4" }), a("semanticfed.queryConsole.ask.assistSettings", "AI assistance")]
|
|
186
|
+
})]
|
|
187
|
+
})]
|
|
188
|
+
}), /* @__PURE__ */ _("p", {
|
|
189
|
+
className: "text-xs text-muted-foreground",
|
|
190
|
+
children: a("semanticfed.queryConsole.ask.conversationDescription", "Ask in plain English, then refine with follow-ups such as “and by status?”, “only EU” or “top 3 instead”. Answers come from the model’s governed metrics and dimensions, with your access policies applied, and the SQL that ran is shown.")
|
|
191
|
+
})]
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
function P({ question: e, onQuestionChange: t, onSubmit: n, isFollowUp: r, disabled: i, busy: a, tr: o }) {
|
|
195
|
+
return /* @__PURE__ */ v("form", {
|
|
196
|
+
className: "flex flex-col gap-2 sm:flex-row",
|
|
197
|
+
onSubmit: (e) => {
|
|
198
|
+
e.preventDefault(), n();
|
|
199
|
+
},
|
|
200
|
+
children: [
|
|
201
|
+
/* @__PURE__ */ _("label", {
|
|
202
|
+
className: "sr-only",
|
|
203
|
+
htmlFor: "nl-ask-input",
|
|
204
|
+
children: o("semanticfed.queryConsole.ask.inputLabel", "Your question")
|
|
205
|
+
}),
|
|
206
|
+
/* @__PURE__ */ _("input", {
|
|
207
|
+
id: "nl-ask-input",
|
|
208
|
+
"data-testid": "nl-ask-input",
|
|
209
|
+
className: "min-w-0 flex-1 rounded border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary",
|
|
210
|
+
value: e,
|
|
211
|
+
maxLength: T,
|
|
212
|
+
onChange: (e) => t(e.target.value),
|
|
213
|
+
placeholder: r ? o("semanticfed.queryConsole.ask.followUpPlaceholder", "Ask a follow-up, e.g. and by status?") : o("semanticfed.queryConsole.ask.placeholder", "e.g. top 5 regions by revenue"),
|
|
214
|
+
disabled: i
|
|
215
|
+
}),
|
|
216
|
+
/* @__PURE__ */ v(b, {
|
|
217
|
+
type: "submit",
|
|
218
|
+
size: "sm",
|
|
219
|
+
className: "sm:self-stretch",
|
|
220
|
+
disabled: i || e.trim() === "" || a,
|
|
221
|
+
"data-testid": "nl-ask-submit",
|
|
222
|
+
children: [a ? /* @__PURE__ */ _(d, { className: "me-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ _(h, { className: "me-2 h-4 w-4" }), o("semanticfed.queryConsole.ask.submit", "Ask")]
|
|
223
|
+
})
|
|
224
|
+
]
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
function F(e, t) {
|
|
228
|
+
let n = e.at(-1)?.answer?.translation ?? null;
|
|
229
|
+
return n?.status === "NEEDS_CLARIFICATION" ? n.suggestions.slice(0, E) : e.length === 0 ? (t ?? []).slice(0, E) : [];
|
|
230
|
+
}
|
|
231
|
+
function I({ modelId: i, maxRows: l, onAnswer: u, onError: d, onOpenInEditor: f }) {
|
|
232
|
+
let p = o(), [m, h] = c(""), [g, y] = c([]), [b, C] = c(i), [w, T] = c(!1), E = s(0), D = t(i), O = e();
|
|
233
|
+
b !== i && (C(i), y([]));
|
|
234
|
+
let k = async (e) => {
|
|
121
235
|
let t = e.trim();
|
|
122
|
-
if (!
|
|
123
|
-
let n =
|
|
124
|
-
|
|
125
|
-
let
|
|
236
|
+
if (!i || t === "" || O.isPending) return;
|
|
237
|
+
let n = r(g);
|
|
238
|
+
E.current += 1;
|
|
239
|
+
let o = E.current;
|
|
126
240
|
try {
|
|
127
|
-
let e = await
|
|
241
|
+
let e = await O.mutateAsync({
|
|
128
242
|
question: t,
|
|
129
|
-
modelId:
|
|
130
|
-
maxRows:
|
|
243
|
+
modelId: i,
|
|
244
|
+
maxRows: l,
|
|
131
245
|
...n.length > 0 ? { history: n } : {}
|
|
132
246
|
});
|
|
133
|
-
|
|
134
|
-
id:
|
|
247
|
+
y((n) => [...n, {
|
|
248
|
+
id: o,
|
|
135
249
|
question: t,
|
|
136
250
|
answer: e,
|
|
137
251
|
error: null
|
|
138
|
-
}]),
|
|
252
|
+
}]), h(""), u(e);
|
|
139
253
|
} catch (e) {
|
|
140
|
-
let n =
|
|
141
|
-
|
|
142
|
-
id:
|
|
254
|
+
let n = a(e, p);
|
|
255
|
+
y((e) => [...e, {
|
|
256
|
+
id: o,
|
|
143
257
|
question: t,
|
|
144
258
|
answer: null,
|
|
145
259
|
error: n
|
|
146
|
-
}]),
|
|
260
|
+
}]), d(n);
|
|
147
261
|
}
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
},
|
|
151
|
-
return /* @__PURE__ */
|
|
262
|
+
}, A = (e) => {
|
|
263
|
+
h(e), k(e);
|
|
264
|
+
}, j = F(g, D.data), I = p("semanticfed.queryConsole.ask.governed", "(governed)");
|
|
265
|
+
return /* @__PURE__ */ v(x, {
|
|
152
266
|
"data-testid": "nl-ask-panel",
|
|
153
|
-
children: [/* @__PURE__ */
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
className: "flex flex-wrap gap-2",
|
|
162
|
-
children: [N.length > 0 && /* @__PURE__ */ g(v, {
|
|
163
|
-
size: "sm",
|
|
164
|
-
variant: "ghost",
|
|
165
|
-
onClick: () => P([]),
|
|
166
|
-
disabled: V.isPending,
|
|
167
|
-
"data-testid": "nl-ask-new-conversation",
|
|
168
|
-
children: [/* @__PURE__ */ h(f, { className: "mr-2 h-4 w-4" }), A("semanticfed.queryConsole.ask.newConversation", "New conversation")]
|
|
169
|
-
}), /* @__PURE__ */ g(v, {
|
|
170
|
-
size: "sm",
|
|
171
|
-
variant: L ? "secondary" : "ghost",
|
|
172
|
-
onClick: () => R((e) => !e),
|
|
173
|
-
"aria-expanded": L,
|
|
174
|
-
"data-testid": "nl-assist-toggle",
|
|
175
|
-
children: [/* @__PURE__ */ h(m, { className: "mr-2 h-4 w-4" }), A("semanticfed.queryConsole.ask.assistSettings", "AI assistance")]
|
|
176
|
-
})]
|
|
177
|
-
})]
|
|
178
|
-
}), /* @__PURE__ */ h("p", {
|
|
179
|
-
className: "text-xs text-muted-foreground",
|
|
180
|
-
children: A("semanticfed.queryConsole.ask.conversationDescription", "Ask in plain English, then refine with follow-ups such as “and by status?”, “only EU” or “top 3 instead”. Answers come from the model’s governed metrics and dimensions, with your access policies applied, and the SQL that ran is shown.")
|
|
181
|
-
})]
|
|
182
|
-
}), /* @__PURE__ */ g(b, {
|
|
267
|
+
children: [/* @__PURE__ */ _(N, {
|
|
268
|
+
hasTurns: g.length > 0,
|
|
269
|
+
busy: O.isPending,
|
|
270
|
+
showSettings: w,
|
|
271
|
+
onNewConversation: () => y([]),
|
|
272
|
+
onToggleSettings: () => T((e) => !e),
|
|
273
|
+
tr: p
|
|
274
|
+
}), /* @__PURE__ */ v(S, {
|
|
183
275
|
className: "space-y-3",
|
|
184
276
|
children: [
|
|
185
|
-
|
|
186
|
-
|
|
277
|
+
w && /* @__PURE__ */ _(n, {}),
|
|
278
|
+
g.length > 0 && /* @__PURE__ */ _("ol", {
|
|
187
279
|
className: "space-y-3",
|
|
188
280
|
"data-testid": "nl-ask-thread",
|
|
189
281
|
"aria-live": "polite",
|
|
190
|
-
children:
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
className: "w-fit max-w-full rounded-lg bg-muted px-3 py-2 text-sm",
|
|
198
|
-
children: e.question
|
|
199
|
-
}),
|
|
200
|
-
e.error && /* @__PURE__ */ h("p", {
|
|
201
|
-
className: "text-xs text-destructive",
|
|
202
|
-
children: e.error
|
|
203
|
-
}),
|
|
204
|
-
i && /* @__PURE__ */ g("p", {
|
|
205
|
-
className: `flex items-start gap-1 text-xs ${i.tone === "warn" ? "text-muted-foreground" : "text-primary"}`,
|
|
206
|
-
"data-testid": n ? "nl-ask-assist-note" : void 0,
|
|
207
|
-
children: [/* @__PURE__ */ h(m, { className: "mt-0.5 h-3 w-3 shrink-0" }), i.text]
|
|
208
|
-
}),
|
|
209
|
-
r?.status === "NEEDS_CLARIFICATION" && /* @__PURE__ */ g("div", {
|
|
210
|
-
className: "flex items-start gap-2 rounded border border-dashed p-3 text-sm",
|
|
211
|
-
"data-testid": n ? "nl-ask-clarification" : void 0,
|
|
212
|
-
children: [/* @__PURE__ */ h(c, { className: "mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" }), /* @__PURE__ */ g("div", {
|
|
213
|
-
className: "min-w-0 space-y-1",
|
|
214
|
-
children: [/* @__PURE__ */ h("p", { children: r.clarification }), r.unmatchedTerms.length > 0 && /* @__PURE__ */ h("p", {
|
|
215
|
-
className: "text-xs text-muted-foreground",
|
|
216
|
-
children: A("semanticfed.queryConsole.ask.unmatched", "Not found in the model: {terms}", { terms: r.unmatchedTerms.join(", ") })
|
|
217
|
-
})]
|
|
218
|
-
})]
|
|
219
|
-
}),
|
|
220
|
-
r?.status === "TRANSLATED" && r.sql && /* @__PURE__ */ h(k, {
|
|
221
|
-
translation: r,
|
|
222
|
-
governedLabel: K,
|
|
223
|
-
onOpenInEditor: D,
|
|
224
|
-
latest: n
|
|
225
|
-
})
|
|
226
|
-
]
|
|
227
|
-
}, e.id);
|
|
228
|
-
})
|
|
282
|
+
children: g.map((e, t) => /* @__PURE__ */ _(M, {
|
|
283
|
+
turn: e,
|
|
284
|
+
latest: t === g.length - 1,
|
|
285
|
+
governedLabel: I,
|
|
286
|
+
onOpenInEditor: f,
|
|
287
|
+
tr: p
|
|
288
|
+
}, e.id))
|
|
229
289
|
}),
|
|
230
|
-
/* @__PURE__ */
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
htmlFor: "nl-ask-input",
|
|
239
|
-
children: A("semanticfed.queryConsole.ask.inputLabel", "Your question")
|
|
240
|
-
}),
|
|
241
|
-
/* @__PURE__ */ h("input", {
|
|
242
|
-
id: "nl-ask-input",
|
|
243
|
-
"data-testid": "nl-ask-input",
|
|
244
|
-
className: "min-w-0 flex-1 rounded border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary",
|
|
245
|
-
value: j,
|
|
246
|
-
maxLength: C,
|
|
247
|
-
onChange: (e) => M(e.target.value),
|
|
248
|
-
placeholder: N.length > 0 ? A("semanticfed.queryConsole.ask.followUpPlaceholder", "Ask a follow-up, e.g. and by status?") : A("semanticfed.queryConsole.ask.placeholder", "e.g. top 5 regions by revenue"),
|
|
249
|
-
disabled: !s
|
|
250
|
-
}),
|
|
251
|
-
/* @__PURE__ */ g(v, {
|
|
252
|
-
type: "submit",
|
|
253
|
-
size: "sm",
|
|
254
|
-
className: "sm:self-stretch",
|
|
255
|
-
disabled: !s || j.trim() === "" || V.isPending,
|
|
256
|
-
"data-testid": "nl-ask-submit",
|
|
257
|
-
children: [V.isPending ? /* @__PURE__ */ h(l, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ h(p, { className: "mr-2 h-4 w-4" }), A("semanticfed.queryConsole.ask.submit", "Ask")]
|
|
258
|
-
})
|
|
259
|
-
]
|
|
290
|
+
/* @__PURE__ */ _(P, {
|
|
291
|
+
question: m,
|
|
292
|
+
onQuestionChange: h,
|
|
293
|
+
onSubmit: () => void k(m),
|
|
294
|
+
isFollowUp: g.length > 0,
|
|
295
|
+
disabled: !i,
|
|
296
|
+
busy: O.isPending,
|
|
297
|
+
tr: p
|
|
260
298
|
}),
|
|
261
|
-
|
|
299
|
+
j.length > 0 && /* @__PURE__ */ _("div", {
|
|
262
300
|
className: "flex flex-wrap gap-2",
|
|
263
301
|
"data-testid": "nl-ask-suggestions",
|
|
264
|
-
children:
|
|
302
|
+
children: j.map((e) => /* @__PURE__ */ _("button", {
|
|
265
303
|
type: "button",
|
|
266
304
|
className: "rounded-full border px-3 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
267
|
-
onClick: () =>
|
|
268
|
-
disabled:
|
|
305
|
+
onClick: () => A(e),
|
|
306
|
+
disabled: O.isPending,
|
|
269
307
|
children: e
|
|
270
308
|
}, e))
|
|
271
309
|
})
|
|
@@ -273,6 +311,6 @@ function A({ modelId: s, maxRows: d, onAnswer: _, onError: E, onOpenInEditor: D
|
|
|
273
311
|
})]
|
|
274
312
|
});
|
|
275
313
|
}
|
|
276
|
-
export {
|
|
314
|
+
export { I as AskQuestionPanel };
|
|
277
315
|
|
|
278
316
|
//# sourceMappingURL=AskQuestionPanel.js.map
|