@burdenoff/microfe-bigconsole 2026.1031.3 → 2026.1101.1

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.
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Active prompt-generation context (BOFF-3718).
3
+ *
4
+ * A `PromptGeneration` is not addressable from the route: the Insights page
5
+ * keeps the generation the user is previewing or refining in component state.
6
+ * So the assistant could not resolve "this generation" — the page tells this
7
+ * module which generation is currently in focus, and `gatherPageContext()`
8
+ * reads it back when the user is on the Insights route.
9
+ *
10
+ * Deliberately a module-level holder, not a zustand store: it has exactly one
11
+ * writer (the Insights page's preview/refine effects) and one reader
12
+ * (`pageContext.ts`), no subscription is ever needed, and a store would tempt
13
+ * components to render from it. Setting `null` clears the context; the writer
14
+ * owns clearing on unmount so a stale generation is never reported from
15
+ * another page.
16
+ */
17
+ /** Called by the Insights page when the previewed/refined generation changes. */
18
+ export declare function setActiveGenerationContext(generationId: string | null): void;
19
+ /** The generation currently in focus, or null. Read by `gatherPageContext()`. */
20
+ export declare function getActiveGenerationContext(): string | null;
@@ -0,0 +1,10 @@
1
+ //#region src/bigconsole/assistant/generationContext.ts
2
+ var e = null;
3
+ function t(t) {
4
+ e = t;
5
+ }
6
+ function n() {
7
+ return e;
8
+ }
9
+ //#endregion
10
+ export { n as getActiveGenerationContext, t as setActiveGenerationContext };
@@ -35,10 +35,30 @@ export type PageContext = {
35
35
  platform: string;
36
36
  version: string;
37
37
  viewportSize: string;
38
- userAgent: string;
39
- timestamp: string;
40
38
  };
41
39
  export declare function gatherPageContext(): PageContext;
40
+ /**
41
+ * Entity context that the route cannot express (BOFF-3718): in the builder, the
42
+ * selected Widget and the current DashboardPage are component state, and on
43
+ * Insights the generation being previewed/refined is page state. Without this,
44
+ * "why is this chart empty?" / "delete this widget" / "retry this generation"
45
+ * cost a follow-up question asking for an id the user should never have to
46
+ * know.
47
+ *
48
+ * Precedence is narrow on purpose — the route table stays authoritative
49
+ * everywhere else, so `/dashboards/:id` still resolves `BIGCONSOLE_DASHBOARD`
50
+ * exactly as before:
51
+ *
52
+ * - a selected widget on a dashboard view/builder route → `BIGCONSOLE_WIDGET`
53
+ * - the active page on a **builder** route → `BIGCONSOLE_PAGE` (the view route
54
+ * keeps reporting the dashboard: pages there are tabs, not the focus)
55
+ * - a previewed/refined generation on the Insights route → `BIGCONSOLE_GENERATION`
56
+ *
57
+ * Returns null when no selection state applies, and never throws: a store that
58
+ * has not been hydrated (or a test environment without one) must degrade to
59
+ * the route resolution, not break the prompt.
60
+ */
61
+ export declare function resolveSelectionEntityContext(pathname: string): ConversationContextShape | null;
42
62
  /**
43
63
  * Route segment → human label.
44
64
  *
@@ -1,21 +1,56 @@
1
- import { BIGCONSOLE_PRODUCT as e } from "./product.js";
1
+ import { useWidgetStore as e } from "../store/widgetStore.js";
2
+ import { useDashboardStore as t } from "../store/dashboardStore.js";
3
+ import { BIGCONSOLE_PRODUCT as n } from "./product.js";
4
+ import { getActiveGenerationContext as r } from "./generationContext.js";
2
5
  //#region src/bigconsole/assistant/pageContext.ts
3
- function t() {
4
- let t = window.location.href, n = window.location.pathname.split("/").filter(Boolean).slice(0, 3).join("/") || "home", r = o(window.location.pathname, window.location.search);
6
+ function i() {
7
+ let e = window.location.href, t = window.location.pathname.split("/").filter(Boolean).slice(0, 3).join("/") || "home", r = a(window.location.pathname) ?? u(window.location.pathname, window.location.search);
5
8
  return {
6
- currentUrl: t,
7
- currentPage: n,
9
+ currentUrl: e,
10
+ currentPage: t,
8
11
  entityType: r.entityType,
9
12
  entityId: r.entityId,
10
- platform: e,
13
+ platform: n,
11
14
  version: "2026.430.500",
12
- viewportSize: `${window.innerWidth}x${window.innerHeight}`,
13
- userAgent: navigator.userAgent,
14
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
15
+ viewportSize: `${window.innerWidth}x${window.innerHeight}`
15
16
  };
16
17
  }
17
- var n = "Home", r = {
18
- home: n,
18
+ function a(n) {
19
+ try {
20
+ let i = n.match(/^\/bigconsole\/dashboards\/([^/]+)(\/builder)?$/);
21
+ if (i && !d(i[1])) {
22
+ let n = i[1], r = i[2] === "/builder", a = e.getState().selectedWidgetId;
23
+ if (a) return {
24
+ entityType: "BIGCONSOLE_WIDGET",
25
+ entityId: a,
26
+ metadata: {
27
+ dashboardId: n,
28
+ source: "builder-selection"
29
+ }
30
+ };
31
+ let o = t.getState().activePageId;
32
+ return r && o ? {
33
+ entityType: "BIGCONSOLE_PAGE",
34
+ entityId: o,
35
+ metadata: {
36
+ dashboardId: n,
37
+ source: "builder-selection"
38
+ }
39
+ } : null;
40
+ }
41
+ if (/^\/bigconsole\/insights(?:\/|$)/.test(n)) {
42
+ let e = r();
43
+ if (e) return {
44
+ entityType: "BIGCONSOLE_GENERATION",
45
+ entityId: e,
46
+ metadata: { source: "insights-preview" }
47
+ };
48
+ }
49
+ } catch {}
50
+ return null;
51
+ }
52
+ var o = "Home", s = {
53
+ home: o,
19
54
  dashboards: "Dashboards",
20
55
  datasinks: "Data sinks",
21
56
  datasources: "Data sources",
@@ -27,14 +62,14 @@ var n = "Home", r = {
27
62
  workflows: "Workflows",
28
63
  workflow: "Workflows"
29
64
  };
30
- function i() {
31
- let { currentPage: e } = t(), i = e.split("/").filter(Boolean), a = (i[0] === "bigconsole" ? i[1] : i[0]) ?? "";
32
- return !a || a === "home" ? n : r[a] ?? a.split("-").map((e) => e && e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
65
+ function c() {
66
+ let { currentPage: e } = i(), t = e.split("/").filter(Boolean), n = (t[0] === "bigconsole" ? t[1] : t[0]) ?? "";
67
+ return !n || n === "home" ? o : s[n] ?? n.split("-").map((e) => e && e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
33
68
  }
34
- function a(e, t) {
69
+ function l(e, t) {
35
70
  return t.match(e);
36
71
  }
37
- function o(e, t) {
72
+ function u(e, t) {
38
73
  let n = new URLSearchParams(t);
39
74
  for (let [t, n] of [
40
75
  [/^\/bigconsole\/dashboards\/[^/]+\/parsers\/([^/]+)(?:\/edit)?$/, "BIGCONSOLE_PARSER"],
@@ -44,8 +79,8 @@ function o(e, t) {
44
79
  [/^\/bigconsole\/pipelines\/([^/]+)(?:\/edit)?$/, "BIGCONSOLE_PIPELINE"],
45
80
  [/^\/bigconsole\/workflows\/([^/]+)(?:\/edit)?$/, "BIGCONSOLE_WORKFLOW"]
46
81
  ]) {
47
- let r = a(t, e);
48
- if (r && r[1] && !s(r[1])) return {
82
+ let r = l(t, e);
83
+ if (r && r[1] && !d(r[1])) return {
49
84
  entityType: n,
50
85
  entityId: r[1],
51
86
  metadata: { routePattern: t.source }
@@ -60,8 +95,8 @@ function o(e, t) {
60
95
  metadata: { ...r ? { activeTab: r } : {} }
61
96
  };
62
97
  }
63
- function s(e) {
98
+ function d(e) {
64
99
  return e === "new" || e === "builder" || e === "list";
65
100
  }
66
101
  //#endregion
67
- export { r as BIGCONSOLE_PAGE_LABELS, i as describeCurrentPage, t as gatherPageContext, o as resolveBigConsoleConversationContext };
102
+ export { s as BIGCONSOLE_PAGE_LABELS, c as describeCurrentPage, i as gatherPageContext, u as resolveBigConsoleConversationContext, a as resolveSelectionEntityContext };