@burtson-labs/bandit-engine 2.0.149 → 2.0.150

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/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  chat_default
3
- } from "./chunk-ANX33XAO.mjs";
3
+ } from "./chunk-YEPJ7DWZ.mjs";
4
4
  import {
5
5
  chat_provider_default
6
6
  } from "./chunk-PU74BI6Y.mjs";
@@ -10,8 +10,8 @@ import {
10
10
  useGatewayHealth,
11
11
  useGatewayMemory,
12
12
  useGatewayModels
13
- } from "./chunk-JQSZNGII.mjs";
14
- import "./chunk-P5IJLX6I.mjs";
13
+ } from "./chunk-IJTDHBHP.mjs";
14
+ import "./chunk-7P7IS6UA.mjs";
15
15
  import "./chunk-F7JXIW6T.mjs";
16
16
  import "./chunk-K2JGFKEB.mjs";
17
17
  import {
@@ -20,7 +20,7 @@ import {
20
20
  import {
21
21
  FeedbackButton,
22
22
  chat_modal_default
23
- } from "./chunk-K6IV4LYZ.mjs";
23
+ } from "./chunk-L37EUHMZ.mjs";
24
24
  import {
25
25
  FeedbackModal,
26
26
  StreamingTTSClient,
@@ -37,7 +37,7 @@ import {
37
37
  useTTS,
38
38
  useVoiceStore,
39
39
  voiceService
40
- } from "./chunk-F735W34E.mjs";
40
+ } from "./chunk-FFVGZK5D.mjs";
41
41
  import {
42
42
  DEFAULT_TIER_FEATURES,
43
43
  FeatureFlagContext,
@@ -11834,6 +11834,46 @@ var init_knowledge_file_modal = __esm({
11834
11834
  }
11835
11835
  });
11836
11836
 
11837
+ // src/utils/openFileLink.ts
11838
+ var FILE_EXT_RE, isStandalonePwa, isFileLink, maybeHandleFileLinkClick;
11839
+ var init_openFileLink = __esm({
11840
+ "src/utils/openFileLink.ts"() {
11841
+ "use strict";
11842
+ init_debugLogger();
11843
+ FILE_EXT_RE = /\.(docx|pptx|xlsx|csv|json|md|txt|html|xml|ya?ml|pdf|zip)(?:[?#]|$)/i;
11844
+ isStandalonePwa = () => typeof window !== "undefined" && (window.matchMedia?.("(display-mode: standalone)").matches || window.navigator.standalone === true);
11845
+ isFileLink = (href) => Boolean(href && FILE_EXT_RE.test(href));
11846
+ maybeHandleFileLinkClick = (event, href) => {
11847
+ if (!href || !isStandalonePwa() || !isFileLink(href)) return;
11848
+ event.preventDefault();
11849
+ void (async () => {
11850
+ try {
11851
+ const res = await fetch(href);
11852
+ if (!res.ok) throw new Error(`fetch ${res.status}`);
11853
+ const blob = await res.blob();
11854
+ const rawName = new URL(href, window.location.href).pathname.split("/").pop() || "download";
11855
+ const name = decodeURIComponent(rawName);
11856
+ const file = new File([blob], name, {
11857
+ type: blob.type || "application/octet-stream"
11858
+ });
11859
+ const nav = navigator;
11860
+ if (nav.canShare?.({ files: [file] }) && nav.share) {
11861
+ await nav.share({ files: [file], title: name });
11862
+ return;
11863
+ }
11864
+ window.location.href = URL.createObjectURL(blob);
11865
+ } catch (error) {
11866
+ debugLogger.warn("openFileLink: share flow failed, falling back", {
11867
+ error: error instanceof Error ? error.message : String(error)
11868
+ });
11869
+ if (error?.name === "AbortError") return;
11870
+ window.open(href, "_blank", "noopener");
11871
+ }
11872
+ })();
11873
+ };
11874
+ }
11875
+ });
11876
+
11837
11877
  // src/services/tts/voiceService.ts
11838
11878
  var VoiceService, voiceService;
11839
11879
  var init_voiceService = __esm({
@@ -12859,6 +12899,7 @@ var init_ai_response_text_field = __esm({
12859
12899
  init_lowlight();
12860
12900
  init_markdownRendering();
12861
12901
  init_lucide_icons();
12902
+ init_openFileLink();
12862
12903
  init_ai_response_action_bar();
12863
12904
  import_jsx_runtime9 = require("react/jsx-runtime");
12864
12905
  brainIcon = "https://cdn.burtson.ai/images/brain-icon.png";
@@ -13291,6 +13332,7 @@ ${sourcesMarkdownList.join("\n")}`;
13291
13332
  },
13292
13333
  target: "_blank",
13293
13334
  rel: "noopener noreferrer",
13335
+ onClick: (e) => maybeHandleFileLinkClick(e, href),
13294
13336
  children
13295
13337
  }
13296
13338
  );
@@ -18968,6 +19010,7 @@ var init_StreamingMarkdown = __esm({
18968
19010
  init_lowlight();
18969
19011
  init_markdownRendering();
18970
19012
  init_lucide_icons();
19013
+ init_openFileLink();
18971
19014
  import_jsx_runtime24 = require("react/jsx-runtime");
18972
19015
  StreamingMarkdown = ({
18973
19016
  content,
@@ -19121,6 +19164,7 @@ ${listMarkdown}`;
19121
19164
  href,
19122
19165
  target: "_blank",
19123
19166
  rel: "noopener noreferrer",
19167
+ onClick: (e) => maybeHandleFileLinkClick(e, href),
19124
19168
  style: {
19125
19169
  color: theme.palette.info?.main ?? theme.palette.primary.main,
19126
19170
  textDecoration: "underline",