@burdenoff/fe-libs 2026.1113.11 → 2026.1114.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.
Files changed (42) hide show
  1. package/README.md +55 -8
  2. package/dist/node_modules/pdfjs-dist/build/pdf.js +21 -0
  3. package/dist/node_modules/pdfjs-dist/build/pdf.worker.min.js +21 -0
  4. package/dist/platform-pages/AcceptShareRoute.js +15 -16
  5. package/dist/platform-pages/AffiliatesPage.js +4 -5
  6. package/dist/shared/assistant/createSandboxAssistantTransport.js +0 -1
  7. package/dist/shared/assistant/index.d.ts +1 -0
  8. package/dist/shared/assistant/ui/AssistantMarkdownRenderer.d.ts +4 -23
  9. package/dist/shared/assistant/ui/AssistantMarkdownRenderer.js +52 -55
  10. package/dist/shared/assistant/ui/AssistantMessageItem.js +37 -38
  11. package/dist/shared/assistant/ui/AssistantSpeechProvider.js +24 -25
  12. package/dist/shared/assistant/ui/composer/AssistantConnectSourceItem.js +3 -3
  13. package/dist/shared/assistant/ui/composer/connectSource.js +1 -2
  14. package/dist/shared/assistant/uiActions/assistantHref.d.ts +2 -30
  15. package/dist/shared/assistant/uiActions/assistantHref.js +7 -43
  16. package/dist/shared/assistant/uiActions/assistantLinkNavigation.d.ts +12 -0
  17. package/dist/shared/assistant/uiActions/assistantLinkNavigation.js +42 -0
  18. package/dist/shared/assistant/uiActions/inAppLinks.js +9 -8
  19. package/dist/shared/components/ContextConversationWidget.js +6 -7
  20. package/dist/shared/components/assistantWidget/MessageContent.js +3 -4
  21. package/dist/shared/components/contextConversationWidget/Composer.js +9 -10
  22. package/dist/shared/components/contextConversationWidget/MessageItem.js +0 -1
  23. package/dist/shared/components/contextConversationWidget/NoWorkspaceCard.js +0 -1
  24. package/dist/shared/components/contextConversationWidget/PendingAttachmentsBar.js +0 -1
  25. package/dist/shared/components/contextConversationWidget/ReplyBanner.js +0 -1
  26. package/dist/shared/components/contextConversationWidget/WidgetHeader.js +8 -9
  27. package/dist/shared/hooks/usePushDeviceRegistration.js +9 -10
  28. package/dist/shared/hooks/useRecordProductVisit.js +8 -9
  29. package/dist/shared/tours/ToursContext.js +6 -7
  30. package/dist/shared-assistant.js +160 -159
  31. package/dist/shared-hooks.js +10 -12
  32. package/dist/shared-plugins.js +0 -1
  33. package/dist/shared-providers-shell.js +7 -8
  34. package/dist/shared.js +83 -87
  35. package/dist/third-party/pdfjs-dist/ATTRIBUTION.txt +54 -0
  36. package/dist/third-party/pdfjs-dist/LICENSE +177 -0
  37. package/dist/third-party/pdfjs-dist/manifest.json +19 -0
  38. package/dist/utils/index.js +1 -1
  39. package/package.json +29 -2
  40. package/dist/shared/actors/index.js +0 -3
  41. package/dist/shared/assistant/speech/index.js +0 -6
  42. package/dist/shared/plugins/iframe-mount/index.js +0 -5
@@ -1,26 +1,25 @@
1
1
  import { useAssistantChromeLabels as e } from "../../providers/shell/useAssistantShellLabels.js";
2
2
  import { useAuthToken as t } from "../../providers/shell/AuthTokenProvider.js";
3
3
  import "../../../shared-providers-shell.js";
4
- import "../../../storage/index.js";
5
- import { AssistantAvatar as n } from "./AssistantAvatar.js";
6
- import { AssistantMarkdownRenderer as r } from "./AssistantMarkdownRenderer.js";
7
- import { AssistantRichContent as i } from "../openui/AssistantRichContent.js";
8
- import { useAssistantGenerativeUi as a } from "../openui/generativeUi.js";
9
- import { stripOpenUiBlocks as o } from "../openui/segments.js";
10
- import { AssistantPendingWriteCard as s } from "./AssistantPendingWriteCard.js";
11
- import { AssistantMessageAttachments as ee } from "./AssistantMessageAttachments.js";
12
- import { AssistantFocusBadge as te } from "./composer/AssistantFocusChip.js";
13
- import { readMessageFocus as c } from "../askAbout/focus.js";
14
- import { AssistantSpeakButton as l } from "./AssistantSpeakButton.js";
15
- import { useAssistantStorageFolders as ne } from "../product.js";
16
- import { useAssistantSpeech as re } from "./AssistantSpeechProvider.js";
17
- import { AssistantToolActivity as ie, parseToolActivity as ae } from "./AssistantToolActivity.js";
18
- import { AssistantTurnActivity as oe } from "./AssistantTurnActivity.js";
4
+ import { SaveToFilesButton as n } from "../../../storage/SaveToFilesButton.js";
5
+ import { AssistantAvatar as r } from "./AssistantAvatar.js";
6
+ import { AssistantMarkdownRenderer as i } from "./AssistantMarkdownRenderer.js";
7
+ import { AssistantRichContent as a } from "../openui/AssistantRichContent.js";
8
+ import { useAssistantGenerativeUi as o } from "../openui/generativeUi.js";
9
+ import { stripOpenUiBlocks as s } from "../openui/segments.js";
10
+ import { AssistantPendingWriteCard as ee } from "./AssistantPendingWriteCard.js";
11
+ import { AssistantMessageAttachments as te } from "./AssistantMessageAttachments.js";
12
+ import { AssistantFocusBadge as c } from "./composer/AssistantFocusChip.js";
13
+ import { readMessageFocus as l } from "../askAbout/focus.js";
14
+ import { AssistantSpeakButton as ne } from "./AssistantSpeakButton.js";
15
+ import { useAssistantStorageFolders as re } from "../product.js";
16
+ import { useAssistantSpeech as ie } from "./AssistantSpeechProvider.js";
17
+ import { AssistantToolActivity as ae, parseToolActivity as oe } from "./AssistantToolActivity.js";
18
+ import { AssistantTurnActivity as se } from "./AssistantTurnActivity.js";
19
19
  import { usePrefersReducedMotion as u } from "./usePrefersReducedMotion.js";
20
- import { getAssistantDisplayContent as se, isAssistantMessageLive as ce } from "../displayContent.js";
21
- import { downloadAssistantArtifact as le } from "../api.js";
22
- import { useAssistantTr as ue } from "../i18n.js";
23
- import { SaveToFilesButton as d } from "../../../storage/SaveToFilesButton.js";
20
+ import { getAssistantDisplayContent as ce, isAssistantMessageLive as le } from "../displayContent.js";
21
+ import { downloadAssistantArtifact as ue } from "../api.js";
22
+ import { useAssistantTr as d } from "../i18n.js";
24
23
  import { useI18n as de } from "../../providers/shell/I18nProvider.js";
25
24
  import { languageConfirmationCopy as fe } from "../appControls/languageReply.js";
26
25
  import { copyToClipboard as pe } from "../clipboard.js";
@@ -51,14 +50,14 @@ var S = () => {
51
50
  className: "ms-0.5 inline-block h-4 w-1.5 rounded-sm bg-text-secondary align-middle" + (e ? "" : " motion-safe:animate-pulse")
52
51
  });
53
52
  }, C = ({ onApprovePendingWrite: u, approvingWriteRef: x = null, pendingWriteExpired: C = !1, pendingWriteApproved: ve = !1, pendingWriteGoAheadSent: ye = !1, message: w, processing: T, isStreaming: E, isFailed: D, isLastAssistant: O, isNewestAssistant: k, onRetry: A, legacyWriteCardHidden: j = !1, writeProposals: M, uiOffers: N, onStopTurn: P, stopTurnLabel: F = "Stop" }) => {
54
- let be = e(), I = ue(), { locale: xe } = de(), L = fe(w, I), R = L ? L.translated ? xe : "en" : w.metadata?.lang, z = L ? `${w.id}:language:${R}` : w.id, B = p(z), Se = ne(), { getAccessToken: Ce, getWorkspaceToken: we } = t(), V = re(), [Te, H] = m(null), [Ee, U] = m(!1), W = w.role === "user", G = f(() => he(w), [w]), K = f(() => ge(G), [G]), q = T === void 0 ? E ? {
53
+ let be = e(), I = d(), { locale: xe } = de(), L = fe(w, I), R = L ? L.translated ? xe : "en" : w.metadata?.lang, z = L ? `${w.id}:language:${R}` : w.id, B = p(z), Se = re(), { getAccessToken: Ce, getWorkspaceToken: we } = t(), V = ie(), [Te, H] = m(null), [Ee, U] = m(!1), W = w.role === "user", G = f(() => he(w), [w]), K = f(() => ge(G), [G]), q = T === void 0 ? E ? {
55
54
  status: "streaming",
56
55
  messageId: w.id,
57
56
  updatedAt: w.timestamp
58
- } : null : T, J = se(w, q, I), { steps: Y, text: X } = f(() => W ? {
57
+ } : null : T, J = ce(w, q, I), { steps: Y, text: X } = f(() => W ? {
59
58
  steps: [],
60
59
  text: w.content
61
- } : J.kind === "output" ? ae(J.text) : {
60
+ } : J.kind === "output" ? oe(J.text) : {
62
61
  steps: [],
63
62
  text: ""
64
63
  }, [
@@ -66,7 +65,7 @@ var S = () => {
66
65
  w.content,
67
66
  J.kind,
68
67
  J.text
69
- ]), Z = a(), Q = f(() => Z ? o(X) : X, [Z, X]), De = () => {
68
+ ]), Z = o(), Q = f(() => Z ? s(X) : X, [Z, X]), De = () => {
70
69
  pe(X).then((e) => {
71
70
  e && (U(!0), setTimeout(() => U(!1), 2e3));
72
71
  });
@@ -76,7 +75,7 @@ var S = () => {
76
75
  if (t) {
77
76
  H(e.path);
78
77
  try {
79
- let n = await le(G.sandboxId, t, G.sessionId, e.path, G.mode, {
78
+ let n = await ue(G.sandboxId, t, G.sessionId, e.path, G.mode, {
80
79
  accessToken: Ce(),
81
80
  workspaceToken: we()
82
81
  });
@@ -95,14 +94,14 @@ var S = () => {
95
94
  children: w.metadata?.localAction?.kind === "navigate" ? /* @__PURE__ */ y("div", {
96
95
  className: "max-w-[90%] break-words rounded-lg border border-border-subtle bg-bg-sunken/60 px-3 py-2 text-center text-xs leading-relaxed text-text-muted",
97
96
  "data-testid": "assistant-message-system-navigation",
98
- children: /* @__PURE__ */ y(r, { content: w.content })
97
+ children: /* @__PURE__ */ y(i, { content: w.content })
99
98
  }) : /* @__PURE__ */ y("p", {
100
99
  className: "max-w-[90%] whitespace-pre-wrap break-words rounded-lg border border-border-subtle bg-bg-sunken/60 px-3 py-2 text-center text-xs leading-relaxed text-text-muted",
101
100
  children: w.content
102
101
  })
103
102
  });
104
103
  if (W) {
105
- let e = w.metadata?.attachments ?? [], t = c(w.metadata?.askAbout);
104
+ let e = w.metadata?.attachments ?? [], t = l(w.metadata?.askAbout);
106
105
  return /* @__PURE__ */ y("div", {
107
106
  className: "flex justify-end",
108
107
  "data-testid": "assistant-message-user",
@@ -119,9 +118,9 @@ var S = () => {
119
118
  t ? /* @__PURE__ */ y("div", {
120
119
  className: "mt-1 flex justify-end",
121
120
  "data-testid": "assistant-message-focus",
122
- children: /* @__PURE__ */ y(te, { focus: t })
121
+ children: /* @__PURE__ */ y(c, { focus: t })
123
122
  }) : null,
124
- /* @__PURE__ */ y(ee, { attachments: e }),
123
+ /* @__PURE__ */ y(te, { attachments: e }),
125
124
  /* @__PURE__ */ y("div", {
126
125
  className: "mt-1 pe-1 text-end text-[10px] text-text-muted",
127
126
  children: $
@@ -133,14 +132,14 @@ var S = () => {
133
132
  return /* @__PURE__ */ b("div", {
134
133
  className: "flex gap-2.5",
135
134
  "data-testid": "assistant-message-assistant",
136
- children: [/* @__PURE__ */ y(n, { active: E }), /* @__PURE__ */ b("div", {
135
+ children: [/* @__PURE__ */ y(r, { active: E }), /* @__PURE__ */ b("div", {
137
136
  className: "min-w-0 flex-1",
138
137
  children: [
139
- Y.length > 0 && /* @__PURE__ */ y(ie, {
138
+ Y.length > 0 && /* @__PURE__ */ y(ae, {
140
139
  steps: Y,
141
- live: ce(w, q)
140
+ live: le(w, q)
142
141
  }),
143
- G?.pendingWrite && !j ? /* @__PURE__ */ y(s, {
142
+ G?.pendingWrite && !j ? /* @__PURE__ */ y(ee, {
144
143
  pendingWrite: G.pendingWrite,
145
144
  onApprove: u,
146
145
  approving: x !== null && x === G.pendingWrite.reference,
@@ -152,12 +151,12 @@ var S = () => {
152
151
  M,
153
152
  X && /* @__PURE__ */ y("div", {
154
153
  className: "text-[15px] leading-relaxed text-text-primary",
155
- children: /* @__PURE__ */ y(i, {
154
+ children: /* @__PURE__ */ y(a, {
156
155
  content: X,
157
156
  streaming: !!E
158
157
  })
159
158
  }),
160
- J.kind === "working" && /* @__PURE__ */ y(oe, { processing: q }),
159
+ J.kind === "working" && /* @__PURE__ */ y(se, { processing: q }),
161
160
  J.kind === "stopped" && /* @__PURE__ */ y("p", {
162
161
  className: "text-[15px] leading-relaxed text-text-secondary",
163
162
  "data-testid": "assistant-turn-stopped",
@@ -186,10 +185,10 @@ var S = () => {
186
185
  }), /* @__PURE__ */ y("div", {
187
186
  className: "flex flex-wrap gap-2",
188
187
  children: K.map((e) => {
189
- let t = `${e.name}${e.type === "directory" ? ".tar.gz" : ""}`, n = Te === e.path;
190
- return /* @__PURE__ */ y(d, {
188
+ let t = `${e.name}${e.type === "directory" ? ".tar.gz" : ""}`, r = Te === e.path;
189
+ return /* @__PURE__ */ y(n, {
191
190
  label: t,
192
- disabled: n,
191
+ disabled: r,
193
192
  testId: `assistant-artifact-${e.name}`,
194
193
  source: {
195
194
  kind: "sandbox-artifact",
@@ -218,7 +217,7 @@ var S = () => {
218
217
  Q.trim() && V.isSupported && (() => {
219
218
  let e = V.blockedFor(z) ?? V.disabledReason, t = V.isSpeaking(w.id) || V.isSpeaking(B.current), n = !!e && !!k, r = n ? `speak-reason-${w.id}` : void 0, i = n ? null : V.deviceFallbackFor(z), a = i ? `speak-fallback-${w.id}` : void 0;
220
219
  return /* @__PURE__ */ b(v, { children: [
221
- /* @__PURE__ */ y(l, {
220
+ /* @__PURE__ */ y(ne, {
222
221
  isSpeaking: t,
223
222
  disabled: e !== null,
224
223
  disabledReason: e,
@@ -1,10 +1,9 @@
1
1
  import { useI18n as e } from "../../providers/shell/I18nProvider.js";
2
2
  import { useAssistantStore as t } from "../store.js";
3
3
  import { voicePreviewText as n } from "../voice/voicePreview.js";
4
- import "../speech/index.js";
5
- import { HOSTED_VOICES as r } from "../speech/hostedVoiceCatalogue.js";
6
- import { speechFeed as i } from "../speech/speechFeed.js";
7
- import { getSpeechEngine as a, subscribeSpeechEngine as o } from "../speech/createSpeechEngine.js";
4
+ import { getSpeechEngine as r, subscribeSpeechEngine as i } from "../speech/createSpeechEngine.js";
5
+ import { HOSTED_VOICES as a } from "../speech/hostedVoiceCatalogue.js";
6
+ import { speechFeed as o } from "../speech/speechFeed.js";
8
7
  import { hasPendingReplyRequests as s, releaseReplyRequestsOutside as c, replyWantsAvatar as ee, settleReplyRequest as l, subscribeReplyRequests as u } from "../speech/replySpeechRequests.js";
9
8
  import { chunkForSpeech as te, toSpeakableText as d } from "../voice/speakableText.js";
10
9
  import { createPhrasePlayback as ne } from "../voice/phrasePlayback.js";
@@ -86,7 +85,7 @@ function D() {
86
85
  return xe(je);
87
86
  }
88
87
  var O = ({ children: s, visible: u = !0, engine: be }) => {
89
- let xe = Ce(o, a, a), E = be ?? xe, D = ye(), { locale: O } = e(), [k, A] = Se(y, _), [j, M] = T(() => E.listVoices()), [N, Me] = T(!1), [Ne, P] = T(() => /* @__PURE__ */ new Map()), [Pe, Fe] = T(() => /* @__PURE__ */ new Set()), [Ie, Le] = T(null), F = w(0), Re = w(null), ze = w(null), I = w(void 0), L = w(null), R = w(null), z = w(/* @__PURE__ */ new Set()), B = w(null);
88
+ let xe = Ce(i, r, r), E = be ?? xe, D = ye(), { locale: O } = e(), [k, A] = Se(y, _), [j, M] = T(() => E.listVoices()), [N, Me] = T(!1), [Ne, P] = T(() => /* @__PURE__ */ new Map()), [Pe, Fe] = T(() => /* @__PURE__ */ new Set()), [Ie, Le] = T(null), F = w(0), Re = w(null), ze = w(null), I = w(void 0), L = w(null), R = w(null), z = w(/* @__PURE__ */ new Set()), B = w(null);
90
89
  S(() => () => {
91
90
  B.current !== null && clearTimeout(B.current);
92
91
  }, []);
@@ -161,13 +160,13 @@ var O = ({ children: s, visible: u = !0, engine: be }) => {
161
160
  o = E.subscribeVoices(() => s(E.listVoices())), V.current = () => {
162
161
  a || (a = !0, clearTimeout(c), o(), V.current = null, l(e, "stopped"));
163
162
  };
164
- }, [H, E]), ct = x((e, t, n, a, o = !1, s, c = !1) => {
163
+ }, [H, E]), ct = x((e, t, n, r, i = !1, s, c = !1) => {
165
164
  let u = n;
166
165
  if (u.length === 0) {
167
166
  let e = E.listVoices();
168
167
  e.length > 0 && (u = e, M(e));
169
168
  }
170
- let d = $e(a), f = oe(ce(!0, u, a, N));
169
+ let d = $e(r), f = oe(ce(!0, u, r, N));
171
170
  if (f === "block") {
172
171
  let t = D("speech.noVoiceForReply", "This reply is in {{language}}, and no {{language}} voice is installed on this device.", { language: ie(d, O) });
173
172
  P((n) => new Map(n).set(e, t)), l(e, "declined");
@@ -175,15 +174,15 @@ var O = ({ children: s, visible: u = !0, engine: be }) => {
175
174
  }
176
175
  if (c && (f !== "speak" || !E.open)) return;
177
176
  if (f === "wait-for-voices") {
178
- st(e, t, a, o, s);
177
+ st(e, t, r, i, s);
179
178
  return;
180
179
  }
181
180
  let p = {
182
- voice: ae(u, d, K[a]),
181
+ voice: ae(u, d, K[r]),
183
182
  lang: d,
184
- rate: et(a)
183
+ rate: et(r)
185
184
  }, re = ut.current;
186
- if (o && !re.autoSpeakEnabled && !re.sessionSpeaking && ee(e)) {
185
+ if (i && !re.autoSpeakEnabled && !re.sessionSpeaking && ee(e)) {
187
186
  if (E.wouldSpeakOnAvatar?.(p) !== !0) {
188
187
  l(e, "declined");
189
188
  return;
@@ -195,7 +194,7 @@ var O = ({ children: s, visible: u = !0, engine: be }) => {
195
194
  let n = new Map(t);
196
195
  return n.delete(e), n;
197
196
  });
198
- let se = K[a], le = typeof se == "string" && r.some((e) => e.name === se) && !u.some((e) => e.name === se);
197
+ let se = K[r], le = typeof se == "string" && a.some((e) => e.name === se) && !u.some((e) => e.name === se);
199
198
  Fe((t) => {
200
199
  if (t.has(e) === le) return t;
201
200
  let n = new Set(t);
@@ -206,8 +205,8 @@ var O = ({ children: s, visible: u = !0, engine: be }) => {
206
205
  type: "start",
207
206
  messageId: e,
208
207
  requestId: m
209
- }), ze.current = o ? m : null, o && ge(e, "ttsStarted"), b(I.current, "stopped");
210
- let h = o ? void 0 : me(e);
208
+ }), ze.current = i ? m : null, i && ge(e, "ttsStarted"), b(I.current, "stopped");
209
+ let h = i ? void 0 : me(e);
211
210
  I.current = h;
212
211
  let g = s === void 0 ? te(t) : te(t, void 0, void 0, { firstChunkMaxChars: s });
213
212
  Ve({
@@ -218,7 +217,7 @@ var O = ({ children: s, visible: u = !0, engine: be }) => {
218
217
  c || Ve((e) => e?.requestId === m && e.index < 0 ? null : e);
219
218
  }, Ee);
220
219
  let _ = !1, v = (t = "ended") => {
221
- _ || (_ = !0, c && F.current === m && (R.current = null, i.audio(e, t)));
220
+ _ || (_ = !0, c && F.current === m && (R.current = null, o.audio(e, t)));
222
221
  }, ue = () => {
223
222
  b(h, "failed"), v(), F.current === m && B.current !== null && (clearTimeout(B.current), B.current = null), l(e, "failed"), A({
224
223
  type: "failed",
@@ -231,7 +230,7 @@ var O = ({ children: s, visible: u = !0, engine: be }) => {
231
230
  F.current === m && b(h, "answered"), F.current === m && ze.current === m && ge(e, "firstAudio");
232
231
  },
233
232
  onChunkStart: (t) => {
234
- y = !0, c && F.current === m && (i.peek(e)?.final === !1 && he(e, { spokeNarration: !0 }), i.audio(e, "started")), F.current === m && B.current !== null && (clearTimeout(B.current), B.current = null), Ve((e) => e?.requestId === m ? {
233
+ y = !0, c && F.current === m && (o.peek(e)?.final === !1 && he(e, { spokeNarration: !0 }), o.audio(e, "started")), F.current === m && B.current !== null && (clearTimeout(B.current), B.current = null), Ve((e) => e?.requestId === m ? {
235
234
  ...e,
236
235
  index: t
237
236
  } : F.current === m ? {
@@ -241,7 +240,7 @@ var O = ({ children: s, visible: u = !0, engine: be }) => {
241
240
  } : e);
242
241
  },
243
242
  onPause: () => {
244
- c && F.current === m && i.audio(e, "paused");
243
+ c && F.current === m && o.audio(e, "paused");
245
244
  },
246
245
  onDeviceFallback: () => {
247
246
  F.current === m && Fe((t) => t.has(e) ? t : new Set(t).add(e));
@@ -264,21 +263,21 @@ var O = ({ children: s, visible: u = !0, engine: be }) => {
264
263
  }
265
264
  };
266
265
  if (c && E.open) {
267
- let r = E.open.bind(E);
268
- i.audio(e, "queued");
269
- let o = ne((e) => r(p, e), n, (e) => {
266
+ let i = E.open.bind(E);
267
+ o.audio(e, "queued");
268
+ let a = ne((e) => i(p, e), n, (e) => {
270
269
  g = [...e], Ve((e) => e?.requestId === m ? {
271
270
  ...e,
272
271
  chunks: g
273
272
  } : e);
274
273
  }, () => he(e, { speechDivergence: !0 }));
275
- _ ? o.cancel() : (R.current = {
274
+ _ ? a.cancel() : (R.current = {
276
275
  messageId: e,
277
276
  requestId: m,
278
- locale: a,
279
- playback: o,
277
+ locale: r,
278
+ playback: a,
280
279
  notifyEnded: v
281
- }, o.append(t));
280
+ }, a.append(t));
282
281
  } else E.speak(g, p, n);
283
282
  } catch {
284
283
  ue();
@@ -474,7 +473,7 @@ var O = ({ children: s, visible: u = !0, engine: be }) => {
474
473
  E,
475
474
  nt
476
475
  ]);
477
- S(() => i.subscribe(ht), [ht]);
476
+ S(() => o.subscribe(ht), [ht]);
478
477
  let gt = C(() => le(j, q.tag), [j, q]), _t = C(() => ae(j, q.tag, K[J]), [
479
478
  j,
480
479
  q,
@@ -1,5 +1,5 @@
1
- import { useAssistantTr as e } from "../../i18n.js";
2
- import { assistantRoutePath as t, classifyAssistantHref as n } from "../../uiActions/assistantHref.js";
1
+ import { assistantRoutePath as e, classifyAssistantHref as t } from "../../uiActions/assistantLinkNavigation.js";
2
+ import { useAssistantTr as n } from "../../i18n.js";
3
3
  import { useAssistantNavigate as r } from "../AssistantMarkdownRenderer.js";
4
4
  import { connectSourceHrefRenders as i, useAssistantConnectSource as a } from "./connectSource.js";
5
5
  import { useCallback as o } from "react";
@@ -15,7 +15,7 @@ var d = "flex w-full items-center gap-2.5 border-t border-border-subtle px-3 py-
15
15
  menuitem: "assistant-connect-source",
16
16
  action: "assistant-connect-source-action"
17
17
  }, m = ({ onActivate: m, presentation: h = "menuitem" }) => {
18
- let g = e(), { href: _, open: v } = a(), y = r(), b = n(_), x = b === "internal" ? t(_) : null, S = o((e) => {
18
+ let g = n(), { href: _, open: v } = a(), y = r(), b = t(_), x = b === "internal" ? e(_) : null, S = o((e) => {
19
19
  e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || (m?.(), y && x && (e.preventDefault(), Promise.resolve(y(x, "person", { surface: "connect-source" })).catch(() => void 0)));
20
20
  }, [
21
21
  y,
@@ -1,5 +1,4 @@
1
- import { assistantRoutePath as e, classifyAssistantHref as t } from "../../uiActions/assistantHref.js";
2
- import "../AssistantMarkdownRenderer.js";
1
+ import { assistantRoutePath as e, classifyAssistantHref as t } from "../../uiActions/assistantLinkNavigation.js";
3
2
  import { createContext as n, useContext as r, useMemo as i } from "react";
4
3
  import { jsx as a } from "react/jsx-runtime";
5
4
  // src/shared/assistant/ui/composer/connectSource.tsx
@@ -1,35 +1,7 @@
1
1
  import { Options } from 'react-markdown';
2
+ export { assistantRoutePath, classifyAssistantHref } from './assistantLinkNavigation';
3
+ export type { AssistantLinkKind } from './assistantLinkNavigation';
2
4
  /** @internal Exported for unit tests; not part of the module's public surface. */
3
5
  export declare function transformAssistantUrl(url: string, key: string, tagName: string): string;
4
6
  /** @internal The react-markdown option form of `transformAssistantUrl`. */
5
7
  export declare const assistantUrlTransform: Options['urlTransform'];
6
- /**
7
- * How a link in an assistant reply should be treated.
8
- *
9
- * ★★ `href.startsWith("/")` IS NOT AN INTERNAL TEST. A protocol-relative URL —
10
- * `//evil.example/path` — has no colon, so react-markdown's `defaultUrlTransform`
11
- * returns it verbatim and the sanitizer passes it through; the browser then
12
- * resolves it against the page's SCHEME and lands on another origin. Treating
13
- * that as internal would hand an attacker-authored destination to the router.
14
- * So the decision is made by RESOLVING the href and comparing origins.
15
- *
16
- * ★ This runs AFTER the sanitizer, so anything with an unsafe scheme has already
17
- * been reduced to an empty string upstream — `blocked` here is the empty case,
18
- * not a second scheme allow-list. The scheme policy stays in one place.
19
- */
20
- export type AssistantLinkKind = 'internal' | 'external' | 'fragment' | 'blocked';
21
- export declare function classifyAssistantHref(href: string | null | undefined, baseOrigin?: string): AssistantLinkKind;
22
- /**
23
- * The router-ready path for an href already classified as `internal`, or null if
24
- * it cannot be resolved.
25
- *
26
- * ★★ WHY THIS IS NOT THE HREF. An internal link may be written absolutely —
27
- * `https://app.example.com/fields?q=1#top` is same-origin, so it classifies as
28
- * internal — and every SPA router reads a `to`/`navigate()` string as a PATH.
29
- * Handing it the absolute form routes to a literal `/https://app.example.com/...`
30
- * segment. Resolving here means each product wires one line and cannot get this
31
- * wrong; the alternative is the same five lines re-derived in every product,
32
- * with only the ones whose assistant happened to emit an absolute URL finding
33
- * out they got it wrong.
34
- */
35
- export declare function assistantRoutePath(href: string | null | undefined, baseOrigin?: string): string | null;
@@ -1,45 +1,9 @@
1
- import { defaultUrlTransform as e } from "../../../node_modules/react-markdown/lib/index.js";
2
- import { isSafeRedirectTarget as t } from "../../graphql/security.js";
1
+ import { assistantRoutePath as e, classifyAssistantHref as t } from "./assistantLinkNavigation.js";
2
+ import { defaultUrlTransform as n } from "../../../node_modules/react-markdown/lib/index.js";
3
3
  // src/shared/assistant/uiActions/assistantHref.ts
4
- var n = /^data:image\/(?:png|jpe?g|gif|webp|avif|bmp);base64,[A-Za-z0-9+/=\s]+$/;
5
- function r(t, r, i) {
6
- return r === "src" && i === "img" && n.test(t) ? t : e(t);
4
+ var r = /^data:image\/(?:png|jpe?g|gif|webp|avif|bmp);base64,[A-Za-z0-9+/=\s]+$/;
5
+ function i(e, t, i) {
6
+ return t === "src" && i === "img" && r.test(e) ? e : n(e);
7
7
  }
8
- var i = (e, t, n) => r(e, t, n.tagName);
9
- function a() {
10
- try {
11
- return typeof window > "u" ? null : window.location.origin;
12
- } catch {
13
- return null;
14
- }
15
- }
16
- function o(e, t) {
17
- try {
18
- let n = new URL(t);
19
- if (n.protocol === "https:" || n.protocol === "http:" || !n.host) return !1;
20
- let r = new URL(e, t);
21
- return r.protocol === n.protocol && r.host === n.host;
22
- } catch {
23
- return !1;
24
- }
25
- }
26
- function s(e, n) {
27
- let r = (e ?? "").trim();
28
- if (!r) return "blocked";
29
- if (r.startsWith("#")) return "fragment";
30
- let i = n ?? a();
31
- return i && (t(r, i) || o(r, i)) ? "internal" : "external";
32
- }
33
- function c(e, t) {
34
- let n = (e ?? "").trim();
35
- if (!n) return null;
36
- let r = t ?? a();
37
- if (!r) return null;
38
- try {
39
- let e = new URL(n, r), t = `${e.pathname}${e.search}${e.hash}`;
40
- return t.startsWith("//") || t.startsWith("/\\") ? null : t;
41
- } catch {
42
- return null;
43
- }
44
- }
45
- export { c as assistantRoutePath, i as assistantUrlTransform, s as classifyAssistantHref, r as transformAssistantUrl };
8
+ var a = (e, t, n) => i(e, t, n.tagName);
9
+ export { e as assistantRoutePath, a as assistantUrlTransform, t as classifyAssistantHref, i as transformAssistantUrl };
@@ -0,0 +1,12 @@
1
+ import { MouseEvent } from 'react';
2
+ export type AssistantLinkKind = 'internal' | 'external' | 'fragment' | 'blocked';
3
+ /**
4
+ * Runs after the renderer's sanitizer. This is origin classification, not a
5
+ * scheme allowlist: the lightweight widget retains its separate https-only
6
+ * external-link gate. Never replace resolved-origin comparison with a prefix.
7
+ */
8
+ export declare function classifyAssistantHref(href: string | null | undefined, baseOrigin?: string): AssistantLinkKind;
9
+ /** Resolve internal links to a router-ready path, with the same escape guard. */
10
+ export declare function assistantRoutePath(href: string | null | undefined, baseOrigin?: string): string | null;
11
+ /** Modified/default-prevented/non-primary clicks remain owned by the browser. */
12
+ export declare function browserShouldHandle(event: Pick<MouseEvent<HTMLAnchorElement>, 'defaultPrevented' | 'button' | 'metaKey' | 'ctrlKey' | 'shiftKey' | 'altKey'>): boolean;
@@ -0,0 +1,42 @@
1
+ import { isSafeRedirectTarget as e } from "../../graphql/security.js";
2
+ // src/shared/assistant/uiActions/assistantLinkNavigation.ts
3
+ function t() {
4
+ try {
5
+ return typeof window > "u" ? null : window.location.origin;
6
+ } catch {
7
+ return null;
8
+ }
9
+ }
10
+ function n(e, t) {
11
+ try {
12
+ let n = new URL(t);
13
+ if (n.protocol === "https:" || n.protocol === "http:" || !n.host) return !1;
14
+ let r = new URL(e, t);
15
+ return r.protocol === n.protocol && r.host === n.host;
16
+ } catch {
17
+ return !1;
18
+ }
19
+ }
20
+ function r(r, i) {
21
+ let a = (r ?? "").trim();
22
+ if (!a) return "blocked";
23
+ if (a.startsWith("#")) return "fragment";
24
+ let o = i ?? t();
25
+ return o && (e(a, o) || n(a, o)) ? "internal" : "external";
26
+ }
27
+ function i(e, n) {
28
+ let r = (e ?? "").trim();
29
+ if (!r) return null;
30
+ let i = n ?? t();
31
+ if (!i) return null;
32
+ try {
33
+ let e = new URL(r, i), t = `${e.pathname}${e.search}${e.hash}`;
34
+ return t.startsWith("//") || t.startsWith("/\\") ? null : t;
35
+ } catch {
36
+ return null;
37
+ }
38
+ }
39
+ function a(e) {
40
+ return e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey;
41
+ }
42
+ export { i as assistantRoutePath, a as browserShouldHandle, r as classifyAssistantHref };
@@ -1,9 +1,10 @@
1
- import e from "../../../node_modules/remark-gfm/lib/index.js";
2
- import t from "../../../node_modules/remark-parse/lib/index.js";
3
- import { unified as n } from "../../../node_modules/unified/lib/index.js";
4
- import { assistantRoutePath as r, classifyAssistantHref as i, transformAssistantUrl as a } from "./assistantHref.js";
1
+ import { assistantRoutePath as e, classifyAssistantHref as t } from "./assistantLinkNavigation.js";
2
+ import n from "../../../node_modules/remark-gfm/lib/index.js";
3
+ import r from "../../../node_modules/remark-parse/lib/index.js";
4
+ import { unified as i } from "../../../node_modules/unified/lib/index.js";
5
+ import { transformAssistantUrl as a } from "./assistantHref.js";
5
6
  // src/shared/assistant/uiActions/inAppLinks.ts
6
- var o = 80, s = n().use(t).use(e), c = (e) => e.trim().replace(/\s+/g, " ").toLowerCase(), l = /* @__PURE__ */ new Set([
7
+ var o = 80, s = i().use(r).use(n), c = (e) => e.trim().replace(/\s+/g, " ").toLowerCase(), l = /* @__PURE__ */ new Set([
7
8
  "code",
8
9
  "inlineCode",
9
10
  "html",
@@ -21,9 +22,9 @@ function d(e, t) {
21
22
  }
22
23
  for (let n of e.children ?? []) d(n, t);
23
24
  }
24
- function f(e) {
25
- let t = a(e, "href", "a");
26
- return i(t) === "internal" ? r(t) : null;
25
+ function f(n) {
26
+ let r = a(n, "href", "a");
27
+ return t(r) === "internal" ? e(r) : null;
27
28
  }
28
29
  function p(e) {
29
30
  if (!e.trim()) return [];
@@ -1,9 +1,8 @@
1
1
  import { useI18n as e } from "../providers/shell/I18nProvider.js";
2
2
  import { useGatewayClient as t } from "../graphql/GatewayContext.js";
3
- import "../../ui.js";
4
- import { useAuth as n } from "../providers/shell/AuthProvider.js";
5
- import { useActiveContext as r } from "../providers/shell/ActiveContextProvider.js";
6
- import { Card as ee, CardContent as te } from "../../ui/card.js";
3
+ import { Card as n, CardContent as r } from "../../ui/card.js";
4
+ import { useAuth as ee } from "../providers/shell/AuthProvider.js";
5
+ import { useActiveContext as te } from "../providers/shell/ActiveContextProvider.js";
7
6
  import "../../shared-graphql.js";
8
7
  import { usePageConversationContext as ne } from "../providers/shell/PageConversationContextProvider.js";
9
8
  import "../../shared-providers-shell.js";
@@ -26,7 +25,7 @@ import { useNavigate as ge } from "react-router";
26
25
  import { useQuery as h } from "@apollo/client/react";
27
26
  // src/shared/components/ContextConversationWidget.tsx
28
27
  function g({ className: g, widgetKey: _ }) {
29
- let { t: v } = e(), { workspaceId: y } = r(), b = n(), x = ne(), S = t("workspace"), C = ge(), [w, T] = f(null), [E, D] = f(null), [O, k] = f(""), [A, _e] = f(() => typeof window < "u" && window.innerWidth < 768), [j, M] = f(null), [N, P] = f(null), [F, I] = f(""), [L, R] = f(null), [z, B] = f([]), V = he(null), H = d(() => (e, t) => {
28
+ let { t: v } = e(), { workspaceId: y } = te(), b = ee(), x = ne(), S = t("workspace"), C = ge(), [w, T] = f(null), [E, D] = f(null), [O, k] = f(""), [A, _e] = f(() => typeof window < "u" && window.innerWidth < 768), [j, M] = f(null), [N, P] = f(null), [F, I] = f(""), [L, R] = f(null), [z, B] = f([]), V = he(null), H = d(() => (e, t) => {
30
29
  let n = v(e);
31
30
  return n === e ? t : n;
32
31
  }, [v]), U = b.user?.id ?? null, W = _ ?? x.widgetKey ?? "default", G = d(() => {
@@ -139,7 +138,7 @@ function g({ className: g, widgetKey: _ }) {
139
138
  }, Se = async () => {
140
139
  N && F.trim() && (await X.saveEdit(N, F.trim()), P(null), I(""));
141
140
  };
142
- return /* @__PURE__ */ m(ee, {
141
+ return /* @__PURE__ */ m(n, {
143
142
  className: g,
144
143
  children: [/* @__PURE__ */ p(me, {
145
144
  conversationTitle: K.data?.conversation?.title,
@@ -159,7 +158,7 @@ function g({ className: g, widgetKey: _ }) {
159
158
  },
160
159
  onOpenInbox: () => w && C(`/conversations/${w}`),
161
160
  tr: H
162
- }), !A && /* @__PURE__ */ m(te, {
161
+ }), !A && /* @__PURE__ */ m(r, {
163
162
  className: "space-y-4",
164
163
  children: [
165
164
  L && /* @__PURE__ */ p("div", {
@@ -2,8 +2,7 @@ import { useAssistantGenerativeUi as e } from "../../assistant/openui/generative
2
2
  import t from "../../assistant/openui/OpenUiBoundary.js";
3
3
  import { splitOpenUiSegments as n } from "../../assistant/openui/segments.js";
4
4
  import { lazyWithRetry as r } from "../../utils/lazyWithRetry.js";
5
- import { assistantRoutePath as i, classifyAssistantHref as a } from "../../assistant/uiActions/assistantHref.js";
6
- import { browserShouldHandle as o } from "../../assistant/ui/AssistantMarkdownRenderer.js";
5
+ import { assistantRoutePath as i, browserShouldHandle as a, classifyAssistantHref as o } from "../../assistant/uiActions/assistantLinkNavigation.js";
7
6
  import { Fragment as s, Suspense as c, useMemo as l } from "react";
8
7
  import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
9
8
  // src/shared/components/assistantWidget/MessageContent.tsx
@@ -12,12 +11,12 @@ function _(e) {
12
11
  return e.startsWith("https://");
13
12
  }
14
13
  function v(e, t, n, r, c) {
15
- let l = r ? a(r) : "blocked", u = l === "internal" && r ? i(r) : null, f = l === "external" && r !== void 0 && _(r);
14
+ let l = r ? o(r) : "blocked", u = l === "internal" && r ? i(r) : null, f = l === "external" && r !== void 0 && _(r);
16
15
  return n && r && (u || f) ? /* @__PURE__ */ d("a", {
17
16
  href: u ?? r,
18
17
  "data-testid": "assistant-message-link",
19
18
  ...u ? { onClick: c ? (e) => {
20
- o(e) || (e.preventDefault(), c(u));
19
+ a(e) || (e.preventDefault(), c(u));
21
20
  } : void 0 } : {
22
21
  target: "_blank",
23
22
  rel: "noopener noreferrer"
@@ -1,7 +1,6 @@
1
- import { Button as e } from "../../../ui/button.js";
2
- import { Badge as t } from "../../../ui/badge.js";
1
+ import { Badge as e } from "../../../ui/badge.js";
2
+ import { Button as t } from "../../../ui/button.js";
3
3
  import { Textarea as n } from "../../../ui/textarea.js";
4
- import "../../../ui.js";
5
4
  import { Loader2 as r, Paperclip as i, SendHorizontal as a, SmilePlus as o } from "lucide-react";
6
5
  import { jsx as s, jsxs as c } from "react/jsx-runtime";
7
6
  // src/shared/components/contextConversationWidget/Composer.tsx
@@ -19,13 +18,13 @@ function l({ composerValue: l, onComposerChange: u, fileInputRef: d, onFilesSele
19
18
  }),
20
19
  _.mentions && v.length > 0 ? /* @__PURE__ */ c("div", {
21
20
  className: "flex flex-wrap gap-2 rounded-md border border-border bg-muted/20 p-2",
22
- children: [/* @__PURE__ */ s(o, { className: "mt-0.5 size-4 text-muted-foreground" }), v.map((t) => /* @__PURE__ */ c(e, {
21
+ children: [/* @__PURE__ */ s(o, { className: "mt-0.5 size-4 text-muted-foreground" }), v.map((e) => /* @__PURE__ */ c(t, {
23
22
  type: "button",
24
23
  variant: "outline",
25
24
  size: "sm",
26
- onClick: () => y(t),
27
- children: ["@", t.label]
28
- }, t.id))]
25
+ onClick: () => y(e),
26
+ children: ["@", e.label]
27
+ }, e.id))]
29
28
  }) : null,
30
29
  /* @__PURE__ */ c("div", {
31
30
  className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between",
@@ -39,7 +38,7 @@ function l({ composerValue: l, onComposerChange: u, fileInputRef: d, onFilesSele
39
38
  className: "hidden",
40
39
  onChange: (e) => f(e.target.files)
41
40
  }),
42
- /* @__PURE__ */ c(e, {
41
+ /* @__PURE__ */ c(t, {
43
42
  type: "button",
44
43
  variant: "outline",
45
44
  size: "sm",
@@ -47,12 +46,12 @@ function l({ composerValue: l, onComposerChange: u, fileInputRef: d, onFilesSele
47
46
  disabled: h,
48
47
  children: [h ? /* @__PURE__ */ s(r, { className: "me-2 size-4 animate-spin" }) : /* @__PURE__ */ s(i, { className: "me-2 size-4" }), b("conversationWidget.attach", "Attach files")]
49
48
  }),
50
- _.mentions ? /* @__PURE__ */ s(t, {
49
+ _.mentions ? /* @__PURE__ */ s(e, {
51
50
  variant: "outline",
52
51
  children: b("conversationWidget.mentionsHint", "Type @ to mention participants")
53
52
  }) : null
54
53
  ]
55
- }), /* @__PURE__ */ c(e, {
54
+ }), /* @__PURE__ */ c(t, {
56
55
  type: "button",
57
56
  onClick: m,
58
57
  disabled: g || h || !l.trim(),
@@ -1,6 +1,5 @@
1
1
  import { Button as e } from "../../../ui/button.js";
2
2
  import { Textarea as t } from "../../../ui/textarea.js";
3
- import "../../../ui.js";
4
3
  import { QUICK_REACTIONS as n } from "./types.js";
5
4
  import { formatFileSize as r, formatTimestamp as i } from "./utils.js";
6
5
  import { Pencil as a, Pin as o, PinOff as s, Reply as c, Trash2 as l } from "lucide-react";