@burdenoff/fe-libs 2026.909.2 → 2026.909.3

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 +1 @@
1
- {"version":3,"file":"AssistantChatArea.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantChatArea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;AAyEf,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAoLvE;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACpC;AAED,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAk1DxD,CAAC"}
1
+ {"version":3,"file":"AssistantChatArea.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantChatArea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;AAyEf,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAoLvE;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACpC;AAED,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAi6DxD,CAAC"}
@@ -18,53 +18,53 @@ import { useAssistantStore as x } from "../store.js";
18
18
  import { isTurnInFlight as ge, planAbandonedTurn as _e, planTurnAbort as ve } from "../turnState.js";
19
19
  import { parseToolActivity as ye } from "./AssistantToolActivity.js";
20
20
  import { useVoiceSession as be } from "./useVoiceSession.js";
21
- import { getOrganizationId as xe, getWorkspaceId as Se } from "../context.js";
22
- import { createReadinessTracker as Ce } from "../sandboxReadiness.js";
23
- import { AssistantSpokenTurnsNotice as we } from "./AssistantSpokenTurnsNotice.js";
24
- import { VoiceTranscriptDrawer as Te } from "./voice/VoiceTranscriptDrawer.js";
25
- import { downloadFile as Ee } from "../exportConversation.js";
26
- import { AssistantEmptyState as De } from "./AssistantEmptyState.js";
27
- import { AssistantMessageList as Oe } from "./AssistantMessageList.js";
28
- import { AssistantVoiceSession as ke } from "./voice/AssistantVoiceSession.js";
29
- import { useAssistantApiAccess as Ae } from "../useAssistantApiAccess.js";
30
- import { useConversationTurns as je } from "../useConversationTurns.js";
31
- import { isMultimodalBodyRejection as Me, isRecoverableAssistantError as Ne } from "../transportErrors.js";
32
- import { dispatchAssistantQuotaExhausted as Pe, notifyAiCreditsUpdated as Fe } from "../aiCredits.js";
33
- import { useAssistantAttachments as Ie } from "../useAssistantAttachments.js";
34
- import { AssistantComposer as Le } from "./composer/AssistantComposer.js";
35
- import { isProdRuntime as Re } from "../env.js";
36
- import { AssistantApiCallsConsentDialog as ze } from "./AssistantApiCallsConsentDialog.js";
37
- import { useCallback as S, useEffect as C, useMemo as w, useRef as T, useState as Be } from "react";
38
- import { jsx as E, jsxs as Ve } from "react/jsx-runtime";
21
+ import { getOrganizationId as S, getWorkspaceId as xe } from "../context.js";
22
+ import { createReadinessTracker as Se } from "../sandboxReadiness.js";
23
+ import { AssistantSpokenTurnsNotice as Ce } from "./AssistantSpokenTurnsNotice.js";
24
+ import { VoiceTranscriptDrawer as we } from "./voice/VoiceTranscriptDrawer.js";
25
+ import { downloadFile as Te } from "../exportConversation.js";
26
+ import { AssistantEmptyState as Ee } from "./AssistantEmptyState.js";
27
+ import { AssistantMessageList as De } from "./AssistantMessageList.js";
28
+ import { AssistantVoiceSession as Oe } from "./voice/AssistantVoiceSession.js";
29
+ import { useAssistantApiAccess as ke } from "../useAssistantApiAccess.js";
30
+ import { useConversationTurns as Ae } from "../useConversationTurns.js";
31
+ import { isMultimodalBodyRejection as je, isRecoverableAssistantError as Me } from "../transportErrors.js";
32
+ import { dispatchAssistantQuotaExhausted as Ne, notifyAiCreditsUpdated as Pe } from "../aiCredits.js";
33
+ import { useAssistantAttachments as Fe } from "../useAssistantAttachments.js";
34
+ import { AssistantComposer as Ie } from "./composer/AssistantComposer.js";
35
+ import { isProdRuntime as Le } from "../env.js";
36
+ import { AssistantApiCallsConsentDialog as Re } from "./AssistantApiCallsConsentDialog.js";
37
+ import { useCallback as C, useEffect as w, useMemo as T, useRef as E, useState as ze } from "react";
38
+ import { jsx as D, jsxs as Be } from "react/jsx-runtime";
39
39
  //#region src/shared/assistant/ui/AssistantChatArea.tsx
40
- var He = {
40
+ var Ve = {
41
41
  general: 18e4,
42
42
  assistant: 18e4,
43
43
  "api-calls": 18e4,
44
44
  "vibe-plugins": 6e5
45
- }, Ue = 18e4, We = 600, Ge = 2e4;
46
- function D() {
45
+ }, He = 18e4, Ue = 600, We = 2e4;
46
+ function O() {
47
47
  return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
48
48
  }
49
- function O(e) {
49
+ function k(e) {
50
50
  return e.info?.time?.created ?? 0;
51
51
  }
52
- function k(e) {
52
+ function A(e) {
53
53
  return (e ?? []).filter((e) => e.type === "text" && typeof e.text == "string").map((e) => e.text?.trim() ?? "").filter(Boolean).join("\n");
54
54
  }
55
- function A(e) {
55
+ function j(e) {
56
56
  return (e ?? []).filter((e) => e.type === "tool" && e.tool).map((e) => {
57
57
  let t = e.state?.status ?? "running", n = e.tool ?? "tool";
58
58
  return t === "completed" ? `Completed: ${n}` : t === "failed" ? `Failed: ${n}` : `Running: ${n}`;
59
59
  });
60
60
  }
61
- function Ke(e, t) {
62
- let n = e.filter((e) => e.info?.role === "assistant" && O(e) > t).sort((e, t) => O(e) - O(t));
61
+ function Ge(e, t) {
62
+ let n = e.filter((e) => e.info?.role === "assistant" && k(e) > t).sort((e, t) => k(e) - k(t));
63
63
  if (n.length === 0) return {
64
64
  content: "Thinking...",
65
65
  done: !1
66
66
  };
67
- let r = n[n.length - 1], i = k(r.parts), a = h(r.parts), o = A(r.parts), s = se(r.parts), c = [
67
+ let r = n[n.length - 1], i = A(r.parts), a = h(r.parts), o = j(r.parts), s = se(r.parts), c = [
68
68
  i,
69
69
  ...a,
70
70
  ...o
@@ -78,7 +78,7 @@ function Ke(e, t) {
78
78
  ...s ? { pendingWrite: s } : {}
79
79
  };
80
80
  }
81
- function qe(e) {
81
+ function Ke(e) {
82
82
  switch (e) {
83
83
  case "provisioning": return "Starting assistant environment...";
84
84
  case "connecting": return "Connecting to assistant...";
@@ -86,24 +86,24 @@ function qe(e) {
86
86
  default: return "";
87
87
  }
88
88
  }
89
- var j = ({ visible: h = !0, writeAccess: se = "unknown" }) => {
90
- let k = le(), { product: A, modes: j, gatherPageContext: Je, buildPrompt: Ye, reportTokenUsage: Xe } = ce(), { getAccessToken: M, getWorkspaceToken: N, userId: P } = t(), { locale: Ze } = e(), Qe = x((e) => e.assistantLanguage), $e = x((e) => e.replyLanguage), et = w(() => oe(Qe, $e, Ze), [
89
+ var M = ({ visible: h = !0, writeAccess: se = "unknown" }) => {
90
+ let A = le(), { product: j, modes: M, gatherPageContext: qe, buildPrompt: Je, reportTokenUsage: Ye } = ce(), { getAccessToken: N, getWorkspaceToken: P, userId: F } = t(), { locale: Xe } = e(), Ze = x((e) => e.assistantLanguage), Qe = x((e) => e.replyLanguage), $e = T(() => oe(Ze, Qe, Xe), [
91
+ Ze,
91
92
  Qe,
92
- $e,
93
- Ze
94
- ]), tt = et.reply.english, nt = et.replyIsExplicit, rt = et.reply.code, { conversations: it, activeConversationId: F, mode: I, processingByConversationId: at, setMode: L, setConversationMode: R, setActiveConversation: ot, createConversation: z, addMessage: B, updateMessage: st, patchMessage: V, mergeMessageMetadata: ct, setConversationProcessing: H, clearConversationProcessing: lt, setBackendSessionId: ut, clearBackendSessionId: U, setSandbox: W, clearSandbox: dt, acknowledgeApiCalls: ft } = x(), pt = it.find((e) => e.id === F), G = je(pt), mt = G.all, ht = F ? at[F] : void 0, gt = ge(ht?.status), _t = gt ? ht?.messageId ?? null : null, vt = ht?.status === "error" ? ht.messageId : null, { canUseApiCalls: yt, loading: bt } = Ae(xe()), xt = w(() => j.filter((e) => !e.requiresAdmin || yt), [j, yt]), [St, Ct] = Be(null), [wt, Tt] = Be(!1), Et = T({}), Dt = T(Ce()), Ot = T(/* @__PURE__ */ new Set()), kt = w(() => j.find((e) => e.id === I), [j, I]);
95
- C(() => {
96
- bt || (!kt || kt.requiresAdmin && !yt) && I !== "assistant" && L("assistant");
93
+ Xe
94
+ ]), et = $e.reply.english, tt = $e.replyIsExplicit, nt = $e.reply.code, { conversations: rt, activeConversationId: I, mode: L, processingByConversationId: it, setMode: R, setConversationMode: z, setActiveConversation: at, createConversation: B, addMessage: V, updateMessage: ot, patchMessage: H, mergeMessageMetadata: st, setConversationProcessing: U, clearConversationProcessing: ct, setBackendSessionId: lt, clearBackendSessionId: ut, setSandbox: W, clearSandbox: dt, acknowledgeApiCalls: ft } = x(), pt = rt.find((e) => e.id === I), G = Ae(pt), mt = G.all, ht = I ? it[I] : void 0, gt = ge(ht?.status), _t = gt ? ht?.messageId ?? null : null, vt = ht?.status === "error" ? ht.messageId : null, { canUseApiCalls: yt, loading: bt } = ke(S()), xt = T(() => M.filter((e) => !e.requiresAdmin || yt), [M, yt]), [St, Ct] = ze(null), [wt, Tt] = ze(!1), Et = E({}), Dt = E(Se()), Ot = E(/* @__PURE__ */ new Set()), kt = T(() => M.find((e) => e.id === L), [M, L]);
95
+ w(() => {
96
+ bt || (!kt || kt.requiresAdmin && !yt) && L !== "assistant" && R("assistant");
97
97
  }, [
98
- I,
98
+ L,
99
99
  kt,
100
100
  yt,
101
101
  bt,
102
- L
102
+ R
103
103
  ]);
104
- let K = S((e, t, n, r) => {
105
- H(e, n, t, null), r ? st(e, t, r) : st(e, t, qe(n));
106
- }, [H, st]), At = S(async (e, t, n, r, i) => {
104
+ let K = C((e, t, n, r) => {
105
+ U(e, n, t, null), r ? ot(e, t, r) : ot(e, t, Ke(n));
106
+ }, [U, ot]), At = C(async (e, t, n, r, i) => {
107
107
  let s = x.getState().sandboxesByMode[n]?.sandboxId ?? null, l = async (e) => {
108
108
  if (Dt.current.isFresh(e)) return !0;
109
109
  try {
@@ -114,12 +114,12 @@ var j = ({ visible: h = !0, writeAccess: se = "unknown" }) => {
114
114
  };
115
115
  if (s && (W(n, s, "provisioning"), K(e, t, "provisioning", "Reusing assistant environment..."), await l(s) || (W(n, null, "provisioning"), s = null)), !s) {
116
116
  K(e, t, "provisioning", "Looking for existing environment...");
117
- let a = await c(r, A, n, Re(), i);
117
+ let a = await c(r, j, n, Le(), i);
118
118
  a && (W(n, a, "provisioning"), K(e, t, "provisioning", "Reusing assistant environment..."), await l(a) ? s = a : W(n, null, "provisioning"));
119
119
  }
120
120
  if (!s) {
121
- if (n === "api-calls" && !M()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
122
- K(e, t, "provisioning", "Starting assistant environment..."), W(n, null, "provisioning"), await f(r, A, n, Re(), i), s = await a(A, n, r, Re(), We, i), W(n, s, "provisioning"), await m(s, r, i, 3e5), await p(s, r, i, 9e4);
121
+ if (n === "api-calls" && !N()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
122
+ K(e, t, "provisioning", "Starting assistant environment..."), W(n, null, "provisioning"), await f(r, j, n, Le(), i), s = await a(j, n, r, Le(), Ue, i), W(n, s, "provisioning"), await m(s, r, i, 3e5), await p(s, r, i, 9e4);
123
123
  }
124
124
  W(n, s, "running");
125
125
  let u = x.getState().conversations.find((t) => t.id === e)?.backendSessionId ?? null;
@@ -127,79 +127,91 @@ var j = ({ visible: h = !0, writeAccess: se = "unknown" }) => {
127
127
  let e = await d(s, r, u, i);
128
128
  if (e.mode !== n) throw Error(`Session mode mismatch: expected ${n}, received ${e.mode}`);
129
129
  } catch {
130
- U(e), u = null;
130
+ ut(e), u = null;
131
131
  }
132
- return u || (K(e, t, "connecting", "Preparing session..."), u = (await o(s, r, n, i)).sessionId, ut(e, u)), {
132
+ return u || (K(e, t, "connecting", "Preparing session..."), u = (await o(s, r, n, i)).sessionId, lt(e, u)), {
133
133
  sandboxId: s,
134
134
  sessionId: u
135
135
  };
136
136
  }, [
137
- U,
138
- M,
139
- A,
140
137
  ut,
138
+ N,
139
+ j,
140
+ lt,
141
141
  W,
142
142
  K
143
- ]), [jt, Mt] = Be(null), Nt = T(/* @__PURE__ */ new Set()), Pt = S(() => {
143
+ ]), [jt, Mt] = ze(null), q = E(/* @__PURE__ */ new Set()), Nt = E(null), Pt = C(() => {
144
144
  let e = x.getState(), t = e.activeConversationId;
145
145
  if (!t) return;
146
146
  let n = e.processingByConversationId[t], i = ge(n?.status) ? n?.messageId ?? null : null;
147
147
  if (!ve({
148
148
  interruptedTurnId: i,
149
149
  activeTurnId: i,
150
- alreadyRequested: i ? Nt.current.has(i) : !1
150
+ alreadyRequested: i ? q.current.has(i) : !1
151
151
  }).send || !i) return;
152
- Nt.current.add(i);
153
- let a = e.sandboxesByMode[e.mode]?.sandboxId, o = Se(), s = e.conversations.find((e) => e.id === t)?.backendSessionId;
152
+ q.current.add(i);
153
+ let a = e.sandboxesByMode[e.mode]?.sandboxId, o = xe(), s = e.conversations.find((e) => e.id === t)?.backendSessionId;
154
154
  !a || !o || !s || r(a, o, s, {
155
- accessToken: M(),
156
- workspaceToken: N(),
157
- userId: P,
158
- organizationId: xe()
155
+ accessToken: N(),
156
+ workspaceToken: P(),
157
+ userId: F,
158
+ organizationId: S()
159
159
  });
160
160
  }, [
161
- P,
162
- M,
163
- N
164
- ]), Ft = S(async (e) => {
165
- let t = x.getState(), n = t.sandboxesByMode[t.mode]?.sandboxId, r = Se(), a = t.activeConversationId;
161
+ F,
162
+ N,
163
+ P
164
+ ]), Ft = C(async (e) => {
165
+ let t = x.getState(), n = t.sandboxesByMode[t.mode]?.sandboxId, r = xe(), a = t.activeConversationId;
166
166
  if (!(!n || !r || !a)) {
167
167
  Mt(e);
168
168
  try {
169
169
  await i(n, r, e, {
170
- accessToken: M(),
171
- workspaceToken: N(),
172
- userId: P,
173
- organizationId: xe()
170
+ accessToken: N(),
171
+ workspaceToken: P(),
172
+ userId: F,
173
+ organizationId: S()
174
174
  });
175
175
  } catch (e) {
176
- Mt(null), B(a, {
177
- id: D(),
176
+ Mt(null), V(a, {
177
+ id: O(),
178
178
  role: "system",
179
179
  content: e instanceof Error ? e.message : "The change could not be approved.",
180
180
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
181
181
  });
182
182
  return;
183
183
  }
184
- Mt(null), J.current(k("pendingWrite.approvedPrompt", "I approved that change — go ahead."));
184
+ Mt(null), Y.current(A("pendingWrite.approvedPrompt", "I approved that change — go ahead."));
185
185
  }
186
186
  }, [
187
- P,
188
- B,
189
- k
190
- ]), q = S(async (e, t = [], r = {}) => {
191
- let i = r.voiceSessionId !== void 0, a = x.getState(), o = a.activeConversationId ?? F;
192
- if (o && (ge(a.processingByConversationId[o]?.status) || Ot.current.has(o))) return;
193
- let c = a.mode, d = F, f = d ? x.getState().conversations.find((e) => e.id === d) : void 0;
194
- if (d ? f && f.mode !== c && (f.messages.length > 0 || f.backendSessionId) ? d = z(void 0, c) : f && f.mode !== c && R(d, c) : d = z(void 0, c), !d) return;
187
+ F,
188
+ V,
189
+ A
190
+ ]), J = C(async (e, t = [], r = {}) => {
191
+ let i = r.voiceSessionId !== void 0, a = x.getState(), o = a.activeConversationId ?? I;
192
+ if (o) {
193
+ if (ge(a.processingByConversationId[o]?.status)) {
194
+ let n = a.processingByConversationId[o]?.messageId ?? null;
195
+ n && q.current.has(n) && (Nt.current = {
196
+ conversationId: o,
197
+ content: e,
198
+ attachments: t,
199
+ options: r
200
+ });
201
+ return;
202
+ }
203
+ if (Ot.current.has(o)) return;
204
+ }
205
+ let c = a.mode, d = I, f = d ? x.getState().conversations.find((e) => e.id === d) : void 0;
206
+ if (d ? f && f.mode !== c && (f.messages.length > 0 || f.backendSessionId) ? d = B(void 0, c) : f && f.mode !== c && z(d, c) : d = B(void 0, c), !d) return;
195
207
  Et.current[d] = t;
196
- let p = Se(), m = {
197
- accessToken: M(),
198
- workspaceToken: N(),
199
- userId: P,
200
- organizationId: xe()
208
+ let p = xe(), m = {
209
+ accessToken: N(),
210
+ workspaceToken: P(),
211
+ userId: F,
212
+ organizationId: S()
201
213
  }, h = {
202
- id: D(),
214
+ id: O(),
203
215
  role: "user",
204
216
  content: e,
205
217
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -208,20 +220,20 @@ var j = ({ visible: h = !0, writeAccess: se = "unknown" }) => {
208
220
  ..._(r.voiceSessionId)
209
221
  }
210
222
  };
211
- B(d, h);
212
- let g = D();
213
- B(d, {
223
+ V(d, h);
224
+ let g = O();
225
+ V(d, {
214
226
  id: g,
215
227
  role: "assistant",
216
228
  content: "",
217
229
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
218
230
  metadata: {
219
- lang: rt,
231
+ lang: nt,
220
232
  ..._(r.voiceSessionId)
221
233
  }
222
- }), H(d, "provisioning", g, null);
223
- let ne = (e, t, n, i, a = rt) => {
224
- V(d, g, { content: te(e) }), ct(d, g, {
234
+ }), U(d, "provisioning", g, null);
235
+ let ne = (e, t, n, i, a = nt) => {
236
+ H(d, g, { content: te(e) }), st(d, g, {
225
237
  lang: a,
226
238
  ...t?.length ? { artifacts: t } : {},
227
239
  ...t?.length || n || i ? { mode: c } : {},
@@ -232,31 +244,31 @@ var j = ({ visible: h = !0, writeAccess: se = "unknown" }) => {
232
244
  }, v = async (n = 1) => {
233
245
  let r = !1;
234
246
  try {
235
- let { sandboxId: n, sessionId: a } = await At(d, g, c, p, m), o = (await u(n, p, a, m, { limit: 50 }).catch(() => [])).reduce((e, t) => Math.max(e, O(t)), 0);
247
+ let { sandboxId: n, sessionId: a } = await At(d, g, c, p, m), o = (await u(n, p, a, m, { limit: 50 }).catch(() => [])).reduce((e, t) => Math.max(e, k(t)), 0);
236
248
  K(d, g, "streaming", "Thinking...");
237
- let f = de(e, t), h = Ye?.(c, f, tt, nt, i) ?? f, _ = ue(h, t), v = pe(_), y = v > 0, re = Je?.();
249
+ let f = de(e, t), h = Je?.(c, f, et, tt, i) ?? f, _ = ue(h, t), v = pe(_), y = v > 0, re = qe?.();
238
250
  r = fe(t) > v;
239
251
  try {
240
252
  await ee(n, p, a, h, c, re, m, _?.length ? { parts: _ } : void 0);
241
253
  } catch (e) {
242
- if (!_ || !Me(e)) throw e;
254
+ if (!_ || !je(e)) throw e;
243
255
  await ee(n, p, a, h, c, re, m, void 0), r ||= y;
244
256
  }
245
- let b = Ke([], o), ae = Date.now() + (He[c] ?? Ue), oe = Date.now(), se = Date.now(), ce = () => _e({
257
+ let b = Ge([], o), ae = Date.now() + (Ve[c] ?? He), oe = Date.now(), se = Date.now(), ce = () => _e({
246
258
  turnId: g,
247
- abortRequested: Nt.current.has(g),
259
+ abortRequested: q.current.has(g),
248
260
  activeTurnId: x.getState().processingByConversationId[d]?.messageId ?? null
249
261
  });
250
262
  for (; Date.now() < ae;) {
251
263
  let e = ce();
252
264
  if (e.abandon) {
253
- e.clearProcessing && lt(d);
265
+ e.clearProcessing && ct(d);
254
266
  return;
255
267
  }
256
- if (b = Ke(await u(n, p, a, m, {
268
+ if (b = Ge(await u(n, p, a, m, {
257
269
  limit: 50,
258
270
  sinceMs: o
259
- }), o), V(d, g, { content: te(b.content) }), b.pendingWrite && ct(d, g, { pendingWrite: b.pendingWrite }), b.done) break;
271
+ }), o), H(d, g, { content: te(b.content) }), b.pendingWrite && st(d, g, { pendingWrite: b.pendingWrite }), b.done) break;
260
272
  Date.now() - oe > 3e4 && (await s(n, p, 600, m).catch(() => void 0), oe = Date.now()), await new Promise((e) => setTimeout(e, ie(Date.now() - se)));
261
273
  }
262
274
  if (!b.done && c !== "vibe-plugins") throw Error("Assistant response timed out while streaming progress");
@@ -266,27 +278,27 @@ var j = ({ visible: h = !0, writeAccess: se = "unknown" }) => {
266
278
  content: `${b.content}\n\n_Still building in the background — any artifacts below will finish shortly. Re-open this conversation to pick up the completed plugin._`
267
279
  }), r && (b = {
268
280
  ...b,
269
- content: `${b.content}\n\n${k("attachments.imagesNotSent", "_Your photo was too large to include with this message, so the answer above is from the text and the file link only. Try a smaller or more tightly cropped photo._")}`
281
+ content: `${b.content}\n\n${A("attachments.imagesNotSent", "_Your photo was too large to include with this message, so the answer above is from the text and the file link only. Try a smaller or more tightly cropped photo._")}`
270
282
  }), ne(b.content, le, a, n), b.tokens) {
271
- V(d, g, { tokens: b.tokens });
283
+ H(d, g, { tokens: b.tokens });
272
284
  try {
273
- await Xe?.({
285
+ await Ye?.({
274
286
  workspaceId: p,
275
287
  sessionId: a,
276
288
  messageId: b.messageId,
277
289
  model: b.model,
278
290
  tokens: b.tokens
279
- }), Fe(A);
291
+ }), Pe(j);
280
292
  } catch {}
281
293
  }
282
294
  let me = ce();
283
295
  if (me.abandon) {
284
- me.clearProcessing && lt(d);
296
+ me.clearProcessing && ct(d);
285
297
  return;
286
298
  }
287
- H(d, "complete", g, null);
299
+ U(d, "complete", g, null);
288
300
  } catch (e) {
289
- if (n === 1 && Ne(e)) return U(d), dt(c), v(2);
301
+ if (n === 1 && Me(e)) return ut(d), dt(c), v(2);
290
302
  throw e;
291
303
  }
292
304
  }, y = d;
@@ -298,62 +310,64 @@ var j = ({ visible: h = !0, writeAccess: se = "unknown" }) => {
298
310
  Dt.current.invalidate(x.getState().sandboxesByMode[c]?.sandboxId ?? null);
299
311
  let t = n(e);
300
312
  if (t) {
301
- t.refusal === "exhausted" && Pe(A, "sandbox");
313
+ t.refusal === "exhausted" && Ne(j, "sandbox");
302
314
  let e = [t.quotaName, t.traceId ? `reference ${t.traceId}` : null].filter(Boolean).join(" · "), n = t.refusal === "exhausted" ? "You've reached your sandbox limit on the current plan. Upgrade to start the AI assistant." : "This workspace has no sandbox allowance provisioned, so the AI assistant cannot start. Upgrading will not help — ask an administrator to provision it.";
303
- ne(e ? `${n}\n\n${e}` : n, void 0, void 0, void 0, "en"), H(d, "error", g, null);
315
+ ne(e ? `${n}\n\n${e}` : n, void 0, void 0, void 0, "en"), U(d, "error", g, null);
304
316
  return;
305
317
  }
306
318
  let i = e instanceof Error ? e.message : "Something went wrong";
307
- H(d, "error", g, i), V(d, g, { content: `Sorry, an error occurred: ${i}. Please try again.` }), ct(d, g, {
319
+ U(d, "error", g, i), H(d, g, { content: `Sorry, an error occurred: ${i}. Please try again.` }), st(d, g, {
308
320
  lang: "en",
309
321
  ..._(r.voiceSessionId)
310
322
  });
311
323
  } finally {
312
324
  Ot.current.delete(y);
325
+ let e = Nt.current;
326
+ Nt.current = null, e && e.conversationId === y && Y.current(e.content, e.attachments, e.options);
313
327
  }
314
328
  }, [
315
- F,
316
- B,
317
- Ye,
318
- U,
329
+ I,
330
+ V,
331
+ Je,
332
+ ut,
319
333
  dt,
320
- it,
321
- z,
334
+ rt,
335
+ B,
322
336
  At,
323
- Je,
324
- M,
337
+ qe,
325
338
  N,
326
- V,
327
- A,
328
- Xe,
329
- nt,
330
- rt,
331
- tt,
332
- ut,
333
- R,
339
+ P,
334
340
  H,
341
+ j,
342
+ Ye,
343
+ tt,
344
+ nt,
345
+ et,
335
346
  lt,
336
- k,
347
+ z,
348
+ U,
349
+ ct,
350
+ A,
337
351
  K,
338
- P
339
- ]), It = S((e) => {
340
- q(e);
341
- }, [q]), Lt = S(() => {
342
- let e = [...G.chat].reverse().find((e) => e.role === "user"), t = F ? Et.current[F] ?? [] : [];
343
- e && q(e.content, t);
352
+ F
353
+ ]), It = C((e) => {
354
+ J(e);
355
+ }, [J]), Lt = C(() => {
356
+ let e = [...G.chat].reverse().find((e) => e.role === "user"), t = I ? Et.current[I] ?? [] : [];
357
+ e && J(e.content, t);
344
358
  }, [
345
359
  mt,
346
- q,
347
- F
348
- ]), J = T(q);
349
- C(() => {
350
- J.current = q;
351
- }, [q]);
352
- let Rt = w(() => {
360
+ J,
361
+ I
362
+ ]), Y = E(J);
363
+ w(() => {
364
+ Y.current = J;
365
+ }, [J]);
366
+ let Rt = T(() => {
353
367
  if (gt) return null;
354
368
  for (let e = mt.length - 1; e >= 0; --e) {
355
369
  let t = mt[e];
356
- if (t?.role !== "assistant" || !g(t)) continue;
370
+ if (t?.role !== "assistant" || !g(t) || q.current.has(t.id)) continue;
357
371
  let n = ye(t.content).text.trim();
358
372
  return n ? {
359
373
  id: t.id,
@@ -361,133 +375,133 @@ var j = ({ visible: h = !0, writeAccess: se = "unknown" }) => {
361
375
  } : null;
362
376
  }
363
377
  return null;
364
- }, [mt, gt]), zt = w(() => Rt ? b(Rt.text) : null, [Rt]), Bt = G.chat, Y = w(() => G.voice.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
378
+ }, [mt, gt]), zt = T(() => Rt ? b(Rt.text) : null, [Rt]), Bt = G.chat, X = T(() => G.voice.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
365
379
  id: e.id,
366
380
  role: e.role,
367
381
  text: ye(e.content).text.trim(),
368
382
  sessionId: ne(e),
369
383
  timestamp: e.timestamp
370
- })).filter((e) => e.text.length > 0), [G.voice]), Vt = S(() => {
371
- if (Y.length === 0) return;
384
+ })).filter((e) => e.text.length > 0), [G.voice]), Vt = C(() => {
385
+ if (X.length === 0) return;
372
386
  let e = /* @__PURE__ */ new Date();
373
- Ee(y(Y, {
374
- title: k("voiceSession.transcript", "Voice conversation"),
375
- savedAt: k("voiceSession.savedAt", "Saved"),
376
- session: k("voiceSession.sessionLabel", "Session"),
377
- earlier: k("voiceSession.earlierLabel", "Earlier"),
378
- you: k("voiceSession.speakerYou", "You"),
379
- assistant: k("voiceSession.speakerAssistant", "Assistant")
380
- }, e), re(A, e), "text/markdown");
387
+ Te(y(X, {
388
+ title: A("voiceSession.transcript", "Voice conversation"),
389
+ savedAt: A("voiceSession.savedAt", "Saved"),
390
+ session: A("voiceSession.sessionLabel", "Session"),
391
+ earlier: A("voiceSession.earlierLabel", "Earlier"),
392
+ you: A("voiceSession.speakerYou", "You"),
393
+ assistant: A("voiceSession.speakerAssistant", "Assistant")
394
+ }, e), re(j, e), "text/markdown");
381
395
  }, [
382
- A,
383
- Y,
384
- k
385
- ]), X = Ie(), Z = T(X);
386
- Z.current = X;
387
- let Q = be({
388
- onSubmit: S((e, t) => {
396
+ j,
397
+ X,
398
+ A
399
+ ]), Z = Fe(), Q = E(Z);
400
+ Q.current = Z;
401
+ let $ = be({
402
+ onSubmit: C((e, t) => {
389
403
  let n = () => {
390
- let n = Z.current, r = me(n.attachments);
391
- J.current(e, r, { voiceSessionId: t }), n.clear();
404
+ let n = Q.current, r = me(n.attachments);
405
+ Y.current(e, r, { voiceSessionId: t }), n.clear();
392
406
  };
393
- if (!Z.current.isBusy) {
407
+ if (!Q.current.isBusy) {
394
408
  n();
395
409
  return;
396
410
  }
397
411
  let r = Date.now(), i = window.setInterval(() => {
398
- Z.current.isBusy && Date.now() - r < Ge || (window.clearInterval(i), n());
412
+ Q.current.isBusy && Date.now() - r < We || (window.clearInterval(i), n());
399
413
  }, 200);
400
414
  }, []),
401
415
  latestReply: Rt,
402
- language: ae(Qe, Ze).tag
403
- }), Ht = w(() => (pt?.messages ?? []).reduce((e, t) => Math.max(e, t.metadata?.continuedVoiceTurns ?? 0), 0), [pt?.messages]), Ut = Y.length > Ht, Wt = S(() => {
416
+ language: ae(Ze, Xe).tag
417
+ }), Ht = T(() => (pt?.messages ?? []).reduce((e, t) => Math.max(e, t.metadata?.continuedVoiceTurns ?? 0), 0), [pt?.messages]), Ut = X.length > Ht, Wt = C(() => {
404
418
  let e = x.getState().activeConversationId;
405
- !e || Y.length === 0 || (B(e, {
406
- id: D(),
419
+ !e || X.length === 0 || (V(e, {
420
+ id: O(),
407
421
  role: "system",
408
- content: v(Y.slice(Ht), {
409
- intro: k("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
410
- nothing: k("voiceSession.continuedNothing", "Continued from a voice conversation."),
411
- more: (e) => k("voiceSession.continuedMore", "…and {{count}} more", { count: e })
422
+ content: v(X.slice(Ht), {
423
+ intro: A("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
424
+ nothing: A("voiceSession.continuedNothing", "Continued from a voice conversation."),
425
+ more: (e) => A("voiceSession.continuedMore", "…and {{count}} more", { count: e })
412
426
  }),
413
427
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
414
- metadata: { continuedVoiceTurns: Y.length }
415
- }), Tt(!1), Q.end());
428
+ metadata: { continuedVoiceTurns: X.length }
429
+ }), Tt(!1), $.end());
416
430
  }, [
417
- Y,
431
+ X,
418
432
  Ht,
419
- B,
420
- k,
421
- Q
422
- ]), Gt = T(0);
423
- C(() => {
424
- Q.active && (Gt.current = Y.length);
425
- }, [Q.active]);
426
- let Kt = S(() => {
427
- let e = Y.length > Gt.current;
428
- Q.end(), e && Tt(!0);
429
- }, [Y, Q]);
430
- C(() => {
431
- !h && Q.active && Q.end();
432
- }, [h, Q]), C(() => {
433
- Q.active || Z.current.clear();
434
- }, [Q.active]), C(() => {
433
+ V,
434
+ A,
435
+ $
436
+ ]), Gt = E(0);
437
+ w(() => {
438
+ $.active && (Gt.current = X.length);
439
+ }, [$.active]);
440
+ let Kt = C(() => {
441
+ let e = X.length > Gt.current;
442
+ $.end(), e && Tt(!0);
443
+ }, [X, $]);
444
+ w(() => {
445
+ !h && $.active && $.end();
446
+ }, [h, $]), w(() => {
447
+ $.active || (Q.current.clear(), Nt.current = null);
448
+ }, [$.active]), w(() => {
435
449
  let e = x.getState().consumePendingPrompt();
436
- return e && J.current(e), x.subscribe((e, t) => {
450
+ return e && Y.current(e), x.subscribe((e, t) => {
437
451
  if (e.pendingPrompt && e.pendingPrompt !== t.pendingPrompt) {
438
452
  let e = x.getState().consumePendingPrompt();
439
- e && J.current(e);
453
+ e && Y.current(e);
440
454
  }
441
455
  });
442
456
  }, []);
443
- let $ = S((e) => {
444
- let t = F ? x.getState().conversations.find((e) => e.id === F) : void 0;
457
+ let qt = C((e) => {
458
+ let t = I ? x.getState().conversations.find((e) => e.id === I) : void 0;
445
459
  if (t && (t.messages.length > 0 || t.backendSessionId)) {
446
460
  if (t.mode !== e) {
447
461
  let t = x.getState().conversations.find((t) => t.mode === e && t.messages.length === 0 && !t.backendSessionId && !x.getState().processingByConversationId[t.id]);
448
- t ? ot(t.id) : z(void 0, e);
462
+ t ? at(t.id) : B(void 0, e);
449
463
  }
450
- } else F && R(F, e);
451
- L(e);
464
+ } else I && z(I, e);
465
+ R(e);
452
466
  }, [
453
- F,
467
+ I,
468
+ B,
469
+ at,
454
470
  z,
455
- ot,
456
- R,
457
- L
458
- ]), qt = S((e) => {
459
- if (j.find((t) => t.id === e)?.writeCapable && !x.getState().apiCallsAcknowledged) {
471
+ R
472
+ ]), Jt = C((e) => {
473
+ if (M.find((t) => t.id === e)?.writeCapable && !x.getState().apiCallsAcknowledged) {
460
474
  Ct(e);
461
475
  return;
462
476
  }
463
- $(e);
464
- }, [$, j]), Jt = S(() => {
477
+ qt(e);
478
+ }, [qt, M]), Yt = C(() => {
465
479
  let e = St;
466
- Ct(null), ft(), e && $(e);
480
+ Ct(null), ft(), e && qt(e);
467
481
  }, [
468
482
  St,
469
483
  ft,
470
- $
471
- ]), Yt = S(() => {
484
+ qt
485
+ ]), Xt = C(() => {
472
486
  Ct(null);
473
487
  }, []);
474
- return /* @__PURE__ */ Ve("div", {
488
+ return /* @__PURE__ */ Be("div", {
475
489
  className: "relative flex flex-1 flex-col overflow-hidden",
476
490
  children: [
477
- /* @__PURE__ */ Ve("div", {
491
+ /* @__PURE__ */ Be("div", {
478
492
  className: "contents",
479
- inert: Q.active || void 0,
493
+ inert: $.active || void 0,
480
494
  children: [
481
- Y.length > 0 && !Q.active ? /* @__PURE__ */ E(we, {
482
- count: Y.length,
495
+ X.length > 0 && !$.active ? /* @__PURE__ */ D(Ce, {
496
+ count: X.length,
483
497
  onOpenTranscript: () => Tt(!0)
484
498
  }) : null,
485
- Bt.length === 0 ? /* @__PURE__ */ E(De, {
486
- mode: I,
499
+ Bt.length === 0 ? /* @__PURE__ */ D(Ee, {
500
+ mode: L,
487
501
  onSuggestionClick: It
488
- }) : /* @__PURE__ */ E("div", {
502
+ }) : /* @__PURE__ */ D("div", {
489
503
  className: "flex min-h-0 flex-1 flex-col",
490
- children: /* @__PURE__ */ E(Oe, {
504
+ children: /* @__PURE__ */ D(De, {
491
505
  onApprovePendingWrite: Ft,
492
506
  approvingWriteRef: jt,
493
507
  messages: Bt,
@@ -496,55 +510,55 @@ var j = ({ visible: h = !0, writeAccess: se = "unknown" }) => {
496
510
  onRetry: Lt
497
511
  })
498
512
  }),
499
- /* @__PURE__ */ E(Le, {
500
- onStartVoiceSession: Q.available && I !== "api-calls" ? Q.start : void 0,
501
- onSend: (e, t) => void q(e, t),
513
+ /* @__PURE__ */ D(Ie, {
514
+ onStartVoiceSession: $.available && L !== "api-calls" ? $.start : void 0,
515
+ onSend: (e, t) => void J(e, t),
502
516
  disabled: gt,
503
- placeholder: I === "api-calls" ? k("chatArea.placeholderActions", "What would you like me to do?") : k("chatArea.placeholderGeneral", "Ask me anything…"),
504
- mode: I,
517
+ placeholder: L === "api-calls" ? A("chatArea.placeholderActions", "What would you like me to do?") : A("chatArea.placeholderGeneral", "Ask me anything…"),
518
+ mode: L,
505
519
  writeAccessDenied: se === "denied" && !!kt?.writeCapable,
506
520
  availableModes: xt,
507
- onModeChange: qt
521
+ onModeChange: Jt
508
522
  })
509
523
  ]
510
524
  }),
511
- wt && !Q.active ? /* @__PURE__ */ E(Te, {
512
- turns: Y,
525
+ wt && !$.active ? /* @__PURE__ */ D(we, {
526
+ turns: X,
513
527
  onClose: () => Tt(!1),
514
528
  onSave: Vt,
515
529
  onContinueInChat: Ut ? Wt : void 0,
516
530
  closeOnEscape: !0
517
531
  }) : null,
518
- Q.active && /* @__PURE__ */ E(ke, {
519
- session: Q.session,
520
- notice: Q.notice,
521
- capturing: Q.capturing,
522
- interrupting: Q.interrupting,
523
- awaitingEndpoint: Q.awaitingEndpoint,
524
- turns: Y,
525
- spokenChunks: Q.spokenChunks,
526
- attachments: X.attachments,
527
- onAttachFiles: X.addFiles,
528
- onRemoveAttachment: X.remove,
529
- onRetryAttachment: X.retry,
530
- canAttachMore: X.canAddMore,
531
- preparingAttachments: X.preparingCount,
532
+ $.active && /* @__PURE__ */ D(Oe, {
533
+ session: $.session,
534
+ notice: $.notice,
535
+ capturing: $.capturing,
536
+ interrupting: $.interrupting,
537
+ awaitingEndpoint: $.awaitingEndpoint,
538
+ turns: X,
539
+ spokenChunks: $.spokenChunks,
540
+ attachments: Z.attachments,
541
+ onAttachFiles: Z.addFiles,
542
+ onRemoveAttachment: Z.remove,
543
+ onRetryAttachment: Z.retry,
544
+ canAttachMore: Z.canAddMore,
545
+ preparingAttachments: Z.preparingCount,
532
546
  onSaveTranscript: Vt,
533
547
  onContinueInChat: Wt,
534
548
  onInterrupt: () => {
535
- Q.interrupt(), Pt();
549
+ $.interrupt(), Pt();
536
550
  },
537
551
  spoken: zt,
538
- onToggleMute: Q.toggleMute,
552
+ onToggleMute: $.toggleMute,
539
553
  onEnd: Kt
540
554
  }),
541
- /* @__PURE__ */ E(ze, {
555
+ /* @__PURE__ */ D(Re, {
542
556
  open: St !== null,
543
- onConfirm: Jt,
544
- onCancel: Yt
557
+ onConfirm: Yt,
558
+ onCancel: Xt
545
559
  })
546
560
  ]
547
561
  });
548
562
  };
549
563
  //#endregion
550
- export { j as AssistantChatArea };
564
+ export { M as AssistantChatArea };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/fe-libs",
3
- "version": "2026.909.2",
3
+ "version": "2026.909.3",
4
4
  "description": "Burdenoff frontend primitives and domain libraries",
5
5
  "type": "module",
6
6
  "bin": {