@burdenoff/microfe-ecoimpacthub 2026.709.1 → 2026.713.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.
@@ -1,17 +1,11 @@
1
1
  /**
2
- * EcoImpactHub transport adapter for the shared fe-libs AssistantWidget.
2
+ * ecoimpacthub adapter for the shared fe-libs AssistantWidget transport.
3
3
  *
4
- * The floating widget (fe-libs, Layer 1) is backend-agnostic — it calls an
5
- * injected `AssistantTransport`. This hook builds a transport that returns
6
- * contextual, screen-aware guidance for the EcoImpactHub domain. It is a
7
- * lightweight first-mile implementation: it does not require a warm sandbox or
8
- * agent runtime, so it works out of the box while the product backend is being
9
- * extended with an AI assistant capability.
10
- *
11
- * Future iterations can swap the local `respond` function for a call to the
12
- * workspace AI orchestrator (e.g. `microfe-sandbox` assistant APIs or a
13
- * dedicated `ecoimpacthub.assistant` GraphQL mutation) without changing the
14
- * host AppShell contract.
4
+ * The sandbox lifecycle + poll/stream loop now lives in
5
+ * `@burdenoff/fe-libs/shared/assistant` (one implementation for all products);
6
+ * this is a thin wrapper. The exported name/shape are unchanged so app-shell
7
+ * imports don't move. The public return type is a LOCALLY-declared structural
8
+ * mirror — never re-export fe-libs types (vite-plugin-dts path rewriting).
15
9
  */
16
10
  interface AssistantSendArgs {
17
11
  prompt: string;
@@ -22,12 +16,9 @@ export interface AssistantTransport {
22
16
  sendPrompt: (args: AssistantSendArgs) => Promise<{
23
17
  text: string;
24
18
  }>;
19
+ prewarm?: (level?: 'probe' | 'full') => void;
20
+ suspend?: () => void;
25
21
  }
26
- /**
27
- * Returns a memoized `AssistantTransport` wired to a lightweight, page-aware
28
- * EcoImpactHub responder. The transport fulfills the fe-libs AssistantWidget
29
- * contract and degrades gracefully when no AI backend is configured.
30
- */
31
22
  export declare function useSandboxAssistantTransport(): AssistantTransport;
32
23
  export {};
33
24
  //# sourceMappingURL=createSandboxAssistantTransport.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createSandboxAssistantTransport.d.ts","sourceRoot":"","sources":["../../../src/ecoimpacthub/services/createSandboxAssistantTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,UAAU,iBAAiB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpE;AAuDD;;;;GAIG;AACH,wBAAgB,4BAA4B,IAAI,kBAAkB,CA0BjE"}
1
+ {"version":3,"file":"createSandboxAssistantTransport.d.ts","sourceRoot":"","sources":["../../../src/ecoimpacthub/services/createSandboxAssistantTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,UAAU,iBAAiB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnE,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC;IAC7C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,4BAA4B,IAAI,kBAAkB,CAMjE"}
@@ -1,42 +1,12 @@
1
- import { useCallback as e, useMemo as t } from "react";
2
- import { useLocation as n } from "react-router-dom";
1
+ import { useSandboxAssistantTransport as e } from "@burdenoff/fe-libs/shared/assistant";
3
2
  //#region src/ecoimpacthub/services/createSandboxAssistantTransport.ts
4
- function r(e) {
5
- let t = e.split("/").filter(Boolean), n = t.findIndex((e) => e === "ecoimpacthub"), [r, i] = n >= 0 ? t.slice(n + 1) : t;
6
- return {
7
- path: e,
8
- page: r ?? "dashboard",
9
- entityId: i
10
- };
11
- }
12
- function i(e, t) {
13
- let { page: n, entityId: r } = t, i = e.toLowerCase(), a = {
14
- dashboard: "Dashboard",
15
- sites: "Environmental Sites",
16
- monitoring: "Monitoring",
17
- species: "Species",
18
- observations: "Observations",
19
- habitat: "Habitat Projects",
20
- carbon: "Carbon Ledger",
21
- reports: "ESG Reports"
22
- }[n] ?? "EcoImpactHub";
23
- return i.includes("help") || i.includes("what") || i.includes("how") ? `You're on the **${a}** page in EcoImpactHub.\n\nYou can ask me to:\n- Explain the current screen\n- Suggest next steps for sustainability or conservation workflows\n- Summarize what actions are available here\n\n${r ? `Context: viewing a specific record (${r}).` : "Context: list/overview view."}` : i.includes("create") || i.includes("add") || i.includes("new") ? `To create a new record in **${a}**, use the primary action button on the page. If you don't see one, you may need additional permissions in this workspace.` : i.includes("delete") || i.includes("remove") ? `Deletion in **${a}** is typically available from the row-level actions or the detail page. Items are soft-deleted so they can be restored by a workspace admin if needed.` : i.includes("report") || i.includes("export") ? "EcoImpactHub can generate ESG and sustainability reports from the **Reports** page. You can also export list views using the export action where available." : `Thanks for your message. I'm the EcoImpactHub assistant, currently viewing **${a}**.\n\nI can help explain this screen, suggest workflows, or point you to the right module. For live data operations, use the controls on the page directly.`;
24
- }
25
- function a(e) {
26
- return new Promise((t) => setTimeout(t, e));
27
- }
28
- function o() {
29
- let { pathname: o } = n(), s = t(() => r(o), [o]), c = e(async ({ prompt: e, onProgress: t, signal: n }) => {
30
- let r = i(e, s), o = r.split(" "), c = "";
31
- for (let e = 0; e < o.length; e++) {
32
- if (n.aborted) throw Error("Cancelled");
33
- c += (e === 0 ? "" : " ") + o[e], t(c), await a(12);
34
- }
35
- return { text: r };
36
- }, [s]);
37
- return t(() => ({ sendPrompt: c }), [c]);
3
+ function t() {
4
+ return e({
5
+ product: "ecoimpacthub",
6
+ enableCredits: !0
7
+ });
38
8
  }
39
9
  //#endregion
40
- export { o as useSandboxAssistantTransport };
10
+ export { t as useSandboxAssistantTransport };
41
11
 
42
12
  //# sourceMappingURL=createSandboxAssistantTransport.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createSandboxAssistantTransport.js","names":[],"sources":["../../../src/ecoimpacthub/services/createSandboxAssistantTransport.ts"],"sourcesContent":["/**\n * EcoImpactHub transport adapter for the shared fe-libs AssistantWidget.\n *\n * The floating widget (fe-libs, Layer 1) is backend-agnostic — it calls an\n * injected `AssistantTransport`. This hook builds a transport that returns\n * contextual, screen-aware guidance for the EcoImpactHub domain. It is a\n * lightweight first-mile implementation: it does not require a warm sandbox or\n * agent runtime, so it works out of the box while the product backend is being\n * extended with an AI assistant capability.\n *\n * Future iterations can swap the local `respond` function for a call to the\n * workspace AI orchestrator (e.g. `microfe-sandbox` assistant APIs or a\n * dedicated `ecoimpacthub.assistant` GraphQL mutation) without changing the\n * host AppShell contract.\n */\n\nimport { useCallback, useMemo } from 'react';\nimport { useLocation } from 'react-router-dom';\n\ninterface AssistantSendArgs {\n prompt: string;\n onProgress: (partialText: string) => void;\n signal: AbortSignal;\n}\n\nexport interface AssistantTransport {\n sendPrompt: (args: AssistantSendArgs) => Promise<{ text: string }>;\n}\n\ninterface PageContext {\n path: string;\n page: string;\n entityId?: string;\n}\n\nfunction resolvePageContext(pathname: string): PageContext {\n const segments = pathname.split('/').filter(Boolean);\n const productIndex = segments.findIndex((s) => s === 'ecoimpacthub');\n const productSegments = productIndex >= 0 ? segments.slice(productIndex + 1) : segments;\n const [page, entityId] = productSegments;\n return { path: pathname, page: page ?? 'dashboard', entityId };\n}\n\nfunction buildContextualResponse(prompt: string, context: PageContext): string {\n const { page, entityId } = context;\n const lower = prompt.toLowerCase();\n\n const pageName =\n {\n dashboard: 'Dashboard',\n sites: 'Environmental Sites',\n monitoring: 'Monitoring',\n species: 'Species',\n observations: 'Observations',\n habitat: 'Habitat Projects',\n carbon: 'Carbon Ledger',\n reports: 'ESG Reports',\n }[page] ?? 'EcoImpactHub';\n\n if (lower.includes('help') || lower.includes('what') || lower.includes('how')) {\n return `You're on the **${pageName}** page in EcoImpactHub.\\n\\nYou can ask me to:\\n- Explain the current screen\\n- Suggest next steps for sustainability or conservation workflows\\n- Summarize what actions are available here\\n\\n${entityId ? `Context: viewing a specific record (${entityId}).` : 'Context: list/overview view.'}`;\n }\n\n if (lower.includes('create') || lower.includes('add') || lower.includes('new')) {\n return `To create a new record in **${pageName}**, use the primary action button on the page. If you don't see one, you may need additional permissions in this workspace.`;\n }\n\n if (lower.includes('delete') || lower.includes('remove')) {\n return `Deletion in **${pageName}** is typically available from the row-level actions or the detail page. Items are soft-deleted so they can be restored by a workspace admin if needed.`;\n }\n\n if (lower.includes('report') || lower.includes('export')) {\n return `EcoImpactHub can generate ESG and sustainability reports from the **Reports** page. You can also export list views using the export action where available.`;\n }\n\n return `Thanks for your message. I'm the EcoImpactHub assistant, currently viewing **${pageName}**.\\n\\nI can help explain this screen, suggest workflows, or point you to the right module. For live data operations, use the controls on the page directly.`;\n}\n\nfunction delay(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * Returns a memoized `AssistantTransport` wired to a lightweight, page-aware\n * EcoImpactHub responder. The transport fulfills the fe-libs AssistantWidget\n * contract and degrades gracefully when no AI backend is configured.\n */\nexport function useSandboxAssistantTransport(): AssistantTransport {\n const { pathname } = useLocation();\n const context = useMemo(() => resolvePageContext(pathname), [pathname]);\n\n const sendPrompt = useCallback(\n async ({ prompt, onProgress, signal }: AssistantSendArgs): Promise<{ text: string }> => {\n const response = buildContextualResponse(prompt, context);\n\n // Simulate a short streaming response so the widget UI shows progress.\n const words = response.split(' ');\n let partial = '';\n for (let i = 0; i < words.length; i++) {\n if (signal.aborted) {\n throw new Error('Cancelled');\n }\n partial += (i === 0 ? '' : ' ') + words[i];\n onProgress(partial);\n await delay(12);\n }\n\n return { text: response };\n },\n [context]\n );\n\n return useMemo<AssistantTransport>(() => ({ sendPrompt }), [sendPrompt]);\n}\n"],"mappings":";;;AAmCA,SAAS,EAAmB,GAA+B;CACzD,IAAM,IAAW,EAAS,MAAM,IAAI,CAAC,OAAO,QAAQ,EAC9C,IAAe,EAAS,WAAW,MAAM,MAAM,eAAe,EAE9D,CAAC,GAAM,KADW,KAAgB,IAAI,EAAS,MAAM,IAAe,EAAE,GAAG;AAE/E,QAAO;EAAE,MAAM;EAAU,MAAM,KAAQ;EAAa;EAAU;;AAGhE,SAAS,EAAwB,GAAgB,GAA8B;CAC7E,IAAM,EAAE,SAAM,gBAAa,GACrB,IAAQ,EAAO,aAAa,EAE5B,IACJ;EACE,WAAW;EACX,OAAO;EACP,YAAY;EACZ,SAAS;EACT,cAAc;EACd,SAAS;EACT,QAAQ;EACR,SAAS;EACV,CAAC,MAAS;AAkBb,QAhBI,EAAM,SAAS,OAAO,IAAI,EAAM,SAAS,OAAO,IAAI,EAAM,SAAS,MAAM,GACpE,mBAAmB,EAAS,kMAAkM,IAAW,uCAAuC,EAAS,MAAM,mCAGpS,EAAM,SAAS,SAAS,IAAI,EAAM,SAAS,MAAM,IAAI,EAAM,SAAS,MAAM,GACrE,+BAA+B,EAAS,+HAG7C,EAAM,SAAS,SAAS,IAAI,EAAM,SAAS,SAAS,GAC/C,iBAAiB,EAAS,2JAG/B,EAAM,SAAS,SAAS,IAAI,EAAM,SAAS,SAAS,GAC/C,gKAGF,gFAAgF,EAAS;;AAGlG,SAAS,EAAM,GAA2B;AACxC,QAAO,IAAI,SAAS,MAAY,WAAW,GAAS,EAAG,CAAC;;AAQ1D,SAAgB,IAAmD;CACjE,IAAM,EAAE,gBAAa,GAAa,EAC5B,IAAU,QAAc,EAAmB,EAAS,EAAE,CAAC,EAAS,CAAC,EAEjE,IAAa,EACjB,OAAO,EAAE,WAAQ,eAAY,gBAA2D;EACtF,IAAM,IAAW,EAAwB,GAAQ,EAAQ,EAGnD,IAAQ,EAAS,MAAM,IAAI,EAC7B,IAAU;AACd,OAAK,IAAI,IAAI,GAAG,IAAI,EAAM,QAAQ,KAAK;AACrC,OAAI,EAAO,QACT,OAAU,MAAM,YAAY;AAI9B,GAFA,MAAY,MAAM,IAAI,KAAK,OAAO,EAAM,IACxC,EAAW,EAAQ,EACnB,MAAM,EAAM,GAAG;;AAGjB,SAAO,EAAE,MAAM,GAAU;IAE3B,CAAC,EAAQ,CACV;AAED,QAAO,SAAmC,EAAE,eAAY,GAAG,CAAC,EAAW,CAAC"}
1
+ {"version":3,"file":"createSandboxAssistantTransport.js","names":[],"sources":["../../../src/ecoimpacthub/services/createSandboxAssistantTransport.ts"],"sourcesContent":["/**\n * ecoimpacthub adapter for the shared fe-libs AssistantWidget transport.\n *\n * The sandbox lifecycle + poll/stream loop now lives in\n * `@burdenoff/fe-libs/shared/assistant` (one implementation for all products);\n * this is a thin wrapper. The exported name/shape are unchanged so app-shell\n * imports don't move. The public return type is a LOCALLY-declared structural\n * mirror — never re-export fe-libs types (vite-plugin-dts path rewriting).\n */\n\nimport { useSandboxAssistantTransport as useSharedTransport } from '@burdenoff/fe-libs/shared/assistant';\n\n\ninterface AssistantSendArgs {\n prompt: string;\n onProgress: (partialText: string) => void;\n signal: AbortSignal;\n}\n\nexport interface AssistantTransport {\n sendPrompt: (args: AssistantSendArgs) => Promise<{ text: string }>;\n prewarm?: (level?: 'probe' | 'full') => void;\n suspend?: () => void;\n}\n\nexport function useSandboxAssistantTransport(): AssistantTransport {\n return useSharedTransport({\n product: 'ecoimpacthub',\n \n enableCredits: true,\n });\n}\n"],"mappings":";;AAyBA,SAAgB,IAAmD;AACjE,QAAO,EAAmB;EACxB,SAAS;EAET,eAAe;EAChB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-ecoimpacthub",
3
- "version": "2026.709.1",
3
+ "version": "2026.713.1",
4
4
  "description": "Burdenoff EcoImpactHub Microfrontend",
5
5
  "type": "module",
6
6
  "files": [
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@apollo/client": "^4.0.11",
46
- "@burdenoff/fe-libs": "2026.703.3",
46
+ "@burdenoff/fe-libs": "2026.713.6",
47
47
  "@tanstack/react-query": "^5.90.16",
48
48
  "clsx": "^2.1.1",
49
49
  "graphql": "^16.10.0",