@burdenoff/microfe-bigconsole 2026.912.4 → 2026.915.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,25 +1,33 @@
1
1
  import { useAssistantRunStore as e } from "./assistantRunStore.js";
2
- import { createAssistantSandbox as t, createAssistantSession as n, extendAssistantSandboxTTL as r, findExistingSandbox as i, getAssistantMessages as a, sendAssistantPromptAsync as o, waitForAssistantServiceReady as s, waitForSandboxReady as c } from "./assistantApi.js";
3
- import { buildAttachmentBlock as l } from "./attachmentExtract.js";
4
- import { deleteAssistantConversation as u, getAssistantConversationMessages as d, listAssistantConversations as f, saveAssistantTurn as ee } from "./conversationHistoryApi.js";
2
+ import { createAssistantSandbox as t, createAssistantSession as n, extendAssistantSandboxTTL as r, findExistingSandbox as i, getAssistantMessages as a, isCachedAssistantSandboxReusable as o, sendAssistantPromptAsync as s, waitForAssistantServiceReady as c, waitForSandboxReady as l } from "./assistantApi.js";
3
+ import { ASSISTANT_SANDBOX_ID_KEY as u, ASSISTANT_SESSION_ID_KEY as d, LEGACY_ASSISTANT_RUNTIME_KEYS as f, resolveAssistantRuntime as p } from "./assistantRuntime.js";
4
+ import { buildAttachmentBlock as m } from "./attachmentExtract.js";
5
+ import { deleteAssistantConversation as h, getAssistantConversationMessages as g, listAssistantConversations as _, saveAssistantTurn as ee } from "./conversationHistoryApi.js";
5
6
  import { gatherPageContext as te } from "./pageContext.js";
6
- import { useCallback as p, useMemo as m, useRef as h } from "react";
7
- import { useAuthToken as g } from "@burdenoff/fe-libs/shared/providers/shell";
7
+ import { useCallback as v, useMemo as y, useRef as b } from "react";
8
+ import { useAuthToken as x } from "@burdenoff/fe-libs/shared/providers/shell";
8
9
  //#region src/bigconsole/assistant/createSandboxAssistantTransport.ts
9
- var _ = "api-calls", ne = 42e4, re = 1500, ie = 3e4, v = 200, y = 25, b = 6e3, x = "bc-assistant-sandbox-id", S = "bc-assistant-session-id", C = "bc-assistant-conversation-id";
10
- function w(e) {
10
+ var S = "api-calls", ne = 42e4, re = 1500, ie = 3e4, C = 200, w = 25, ae = 6e3, T = "bc-assistant-conversation-id", oe = {
11
+ isCachedAssistantSandboxReusable: o,
12
+ findExistingSandbox: i,
13
+ createAssistantSandbox: t,
14
+ waitForSandboxReady: l,
15
+ waitForAssistantServiceReady: c,
16
+ createAssistantSession: n
17
+ };
18
+ function E(e) {
11
19
  try {
12
20
  return window.sessionStorage.getItem(e);
13
21
  } catch {
14
22
  return null;
15
23
  }
16
24
  }
17
- function T(e, t) {
25
+ function D(e, t) {
18
26
  try {
19
27
  t ? window.sessionStorage.setItem(e, t) : window.sessionStorage.removeItem(e);
20
28
  } catch {}
21
29
  }
22
- function E(e) {
30
+ function O(e) {
23
31
  try {
24
32
  let t = e === "workspaceId" ? "burdenoff-active-context-workspace" : "burdenoff-active-context-organization", n = localStorage.getItem(t);
25
33
  if (n) return n;
@@ -31,16 +39,16 @@ function E(e) {
31
39
  return "";
32
40
  }
33
41
  }
34
- function D(e) {
35
- return new URLSearchParams(window.location.search).get("workspace") ?? E("workspaceId") ?? e ?? "";
42
+ function k(e) {
43
+ return new URLSearchParams(window.location.search).get("workspace") ?? O("workspaceId") ?? e ?? "";
36
44
  }
37
- function O() {
38
- return new URLSearchParams(window.location.search).get("org") ?? E("organizationId");
45
+ function A() {
46
+ return new URLSearchParams(window.location.search).get("org") ?? O("organizationId");
39
47
  }
40
- function k(e) {
48
+ function j(e) {
41
49
  return e.info?.role ?? e.role;
42
50
  }
43
- function A(e) {
51
+ function M(e) {
44
52
  let t = e.info?.time?.created;
45
53
  if (t !== void 0) return t;
46
54
  let n = e.createdAt;
@@ -51,7 +59,7 @@ function A(e) {
51
59
  }
52
60
  return n;
53
61
  }
54
- function j(e) {
62
+ function N(e) {
55
63
  let t = e.info?.time?.completed;
56
64
  if (t !== void 0) return t;
57
65
  let n = e.completedAt;
@@ -63,10 +71,10 @@ function j(e) {
63
71
  return n;
64
72
  }
65
73
  }
66
- function M(e) {
74
+ function P(e) {
67
75
  return (e.parts ?? [] ?? []).filter((e) => e.type === "text" && typeof e.text == "string").map((e) => e.text?.trim() ?? "").filter(Boolean).join("\n") || (typeof e.content == "string" ? e.content.trim() : "");
68
76
  }
69
- var N = {
77
+ var F = {
70
78
  bash: "Running a command",
71
79
  webfetch: "Fetching a page",
72
80
  "file.read": "Reading files",
@@ -77,42 +85,42 @@ var N = {
77
85
  todowrite: "Planning the steps",
78
86
  todoread: "Reviewing the plan"
79
87
  };
80
- function P(e) {
88
+ function I(e) {
81
89
  return typeof e == "object" && e ? e : void 0;
82
90
  }
83
- function F(e) {
84
- let t = e.tool ?? "tool", n = P(e.state?.input), r = n?.description;
91
+ function L(e) {
92
+ let t = e.tool ?? "tool", n = I(e.state?.input), r = n?.description;
85
93
  if (typeof r == "string" && r.trim()) return r.trim();
86
94
  let i = n?.todos;
87
95
  if (Array.isArray(i)) {
88
- let e = P(i.find((e) => P(e)?.status === "in_progress") ?? i[0])?.content;
96
+ let e = I(i.find((e) => I(e)?.status === "in_progress") ?? i[0])?.content;
89
97
  if (typeof e == "string" && e.trim()) return e.trim();
90
98
  }
91
- return N[t] ?? `Running ${t}`;
99
+ return F[t] ?? `Running ${t}`;
92
100
  }
93
- function I(e) {
101
+ function R(e) {
94
102
  return (e.parts ?? []).filter((e) => e.type === "tool" && e.tool).map((e) => {
95
- let t = e.state?.status ?? "running", n = F(e);
103
+ let t = e.state?.status ?? "running", n = L(e);
96
104
  return t === "completed" ? `✓ ${n}` : t === "failed" ? `⚠ ${n}` : `⏳ ${n}…`;
97
105
  });
98
106
  }
99
- function L(e, t, n, r) {
100
- let i = e.filter((e) => k(e) === "assistant" && A(e) >= t).sort((e, t) => A(e) - A(t));
107
+ function z(e, t, n, r) {
108
+ let i = e.filter((e) => j(e) === "assistant" && M(e) >= t).sort((e, t) => M(e) - M(t));
101
109
  i.length === 0 && e.length > 0 && console.log("[BigConsole-Assistant] buildProgress: no relevant messages", {
102
110
  totalMessages: e.length,
103
111
  sinceMs: t,
104
- messageRoles: e.map((e) => k(e)),
105
- messageTimestamps: e.map((e) => A(e))
112
+ messageRoles: e.map((e) => j(e)),
113
+ messageTimestamps: e.map((e) => M(e))
106
114
  });
107
115
  let a, o;
108
116
  if (i.length === 0) {
109
117
  a = "";
110
- let t = e.some((e) => k(e) === "assistant"), i = n === a && r !== void 0 ? Date.now() - r : 0;
118
+ let t = e.some((e) => j(e) === "assistant"), i = n === a && r !== void 0 ? Date.now() - r : 0;
111
119
  o = t ? i >= 9e4 : i >= 15e4;
112
120
  } else {
113
- let e = i[i.length - 1], t = i.map(M).filter(Boolean), s = I(e);
121
+ let e = i[i.length - 1], t = i.map(P).filter(Boolean), s = R(e);
114
122
  a = [...t, ...s].join("\n\n");
115
- let c = !!j(e) && a.length > 0, l = (e.parts ?? []).some((e) => e.type === "tool" && e.state?.status !== "completed" && e.state?.status !== "failed"), u = !c && !l && n === a && r !== void 0 && Date.now() - r >= 45e3;
123
+ let c = !!N(e) && a.length > 0, l = (e.parts ?? []).some((e) => e.type === "tool" && e.state?.status !== "completed" && e.state?.status !== "failed"), u = !c && !l && n === a && r !== void 0 && Date.now() - r >= 45e3;
116
124
  o = c || u;
117
125
  }
118
126
  return {
@@ -120,10 +128,10 @@ function L(e, t, n, r) {
120
128
  done: o
121
129
  };
122
130
  }
123
- function R(e) {
131
+ function B(e) {
124
132
  return e.replace(/(Authorization\s*:\s*Bearer\s+)[^\s\n]+/gi, "$1[REDACTED]").replace(/(X-Workspace-Authorization\s*:\s*Bearer\s+)[^\s\n]+/gi, "$1[REDACTED]").replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9._-]+\.[A-Za-z0-9._-]+\b/g, "[REDACTED_JWT]").replace(/\bsk-ant-[A-Za-z0-9-]+\b/g, "[REDACTED_API_KEY]");
125
133
  }
126
- function ae(e) {
134
+ function se(e) {
127
135
  let t = e instanceof Error ? e.message.toLowerCase() : String(e).toLowerCase();
128
136
  return t.includes("rate limit exceeded") || t.includes("unauthorized") || t.includes("k8s api error 401") ? !1 : [
129
137
  "sandbox not found",
@@ -145,118 +153,113 @@ function ae(e) {
145
153
  "the assistant runtime did not respond"
146
154
  ].some((e) => t.includes(e));
147
155
  }
148
- function z() {
149
- let { getAccessToken: E, getWorkspaceToken: j, userId: M, workspaceId: N } = g(), [P, F, I] = m(() => [
150
- w(x),
151
- w(S),
152
- w(C)
153
- ], []), z = h(P), B = h(F), V = h(I), H = h(null), U = p((e) => {
154
- z.current = e, T(x, e);
155
- }, []), W = p((e) => {
156
- B.current = e, T(S, e);
157
- }, []), G = p((e) => {
158
- V.current = e, T(C, e);
159
- }, []), K = p(async (e, r) => {
160
- let a = z.current;
161
- if (console.log("[BigConsole-Assistant] ensureRuntime start", {
162
- sandboxId: a,
163
- workspaceId: e
164
- }), !a) {
165
- if (!E()) throw Error("The assistant requires an authenticated session. Please sign in again.");
166
- if (console.log("[BigConsole-Assistant] findExistingSandbox called"), a = await i(e, _, r), console.log("[BigConsole-Assistant] findExistingSandbox result", { sandboxId: a }), a) try {
167
- console.log("[BigConsole-Assistant] waitForSandboxReady called (reused)", { sandboxId: a }), await c(a, e, r), console.log("[BigConsole-Assistant] waitForSandboxReady done (reused)", { sandboxId: a }), console.log("[BigConsole-Assistant] waitForAssistantServiceReady called (reused)", { sandboxId: a }), await s(a, e, _, r), console.log("[BigConsole-Assistant] waitForAssistantServiceReady done (reused)", { sandboxId: a });
168
- } catch (e) {
169
- console.warn("[BigConsole-Assistant] existing sandbox unusable, falling back to fresh sandbox", {
170
- sandboxId: a,
171
- error: e instanceof Error ? e.message : String(e)
172
- }), a = null;
156
+ function V() {
157
+ let { getAccessToken: t, getWorkspaceToken: n, userId: i, workspaceId: o } = x(), [c, l, O] = y(() => {
158
+ for (let e of f) D(e, null);
159
+ return [
160
+ E(u),
161
+ E(d),
162
+ E(T)
163
+ ];
164
+ }, []), N = b(c), P = b(l), F = b(O), I = b(null), L = b(null), R = v((e) => {
165
+ N.current = e, D(u, e);
166
+ }, []), V = v((e) => {
167
+ P.current = e, D(d, e);
168
+ }, []), H = v((e) => {
169
+ F.current = e, D(T, e);
170
+ }, []), U = v(async (e, n) => p({
171
+ workspaceId: e,
172
+ mode: S,
173
+ authContext: n,
174
+ api: oe,
175
+ hasAccessToken: () => !!t(),
176
+ store: {
177
+ getSandboxId: () => N.current,
178
+ setSandboxId: R,
179
+ getSessionId: () => P.current,
180
+ setSessionId: V,
181
+ getVerifiedSandboxKey: () => I.current,
182
+ setVerifiedSandboxKey: (e) => {
183
+ I.current = e;
173
184
  }
174
- a || (console.log("[BigConsole-Assistant] createAssistantSandbox called"), a = await t(_, e, r), console.log("[BigConsole-Assistant] createAssistantSandbox result", { sandboxId: a }), console.log("[BigConsole-Assistant] waitForSandboxReady called (fresh)", { sandboxId: a }), await c(a, e, r), console.log("[BigConsole-Assistant] waitForSandboxReady done (fresh)", { sandboxId: a }), console.log("[BigConsole-Assistant] waitForAssistantServiceReady called (fresh)", { sandboxId: a }), await s(a, e, _, r), console.log("[BigConsole-Assistant] waitForAssistantServiceReady done (fresh)", { sandboxId: a })), U(a);
175
185
  }
176
- let o = B.current;
177
- return console.log("[BigConsole-Assistant] session check", {
178
- sessionId: o,
179
- sandboxId: a
180
- }), o || (console.log("[BigConsole-Assistant] createAssistantSession called", {
181
- sandboxId: a,
182
- workspaceId: e
183
- }), o = (await n(a, e, _, r)).sessionId, W(o)), {
184
- sandboxId: a,
185
- sessionId: o
186
- };
187
- }, [E]), q = p(async ({ prompt: t, attachments: n, onProgress: i, signal: s }) => {
188
- let c = D(N);
186
+ }), [
187
+ t,
188
+ R,
189
+ V
190
+ ]), W = v(async ({ prompt: c, attachments: l, onProgress: u, signal: d }) => {
191
+ let f = k(o);
189
192
  if (console.log("[BigConsole-Assistant] sendPrompt called", {
190
- promptLength: t.length,
191
- workspaceId: c,
192
- hasCtxWorkspaceId: !!N,
193
+ promptLength: c.length,
194
+ workspaceId: f,
195
+ hasCtxWorkspaceId: !!o,
193
196
  authContextKeys: {
194
- hasAccessToken: !!E(),
195
- hasWorkspaceToken: !!j(),
196
- hasUserId: !!M
197
+ hasAccessToken: !!t(),
198
+ hasWorkspaceToken: !!n(),
199
+ hasUserId: !!i
197
200
  },
198
201
  locationSearch: window.location.search
199
- }), !c) throw Error("The assistant needs an active workspace. Open a workspace and try again.");
200
- let u = {
201
- accessToken: E(),
202
- workspaceToken: j(),
203
- userId: M,
204
- organizationId: O()
202
+ }), !f) throw Error("The assistant needs an active workspace. Open a workspace and try again.");
203
+ let p = {
204
+ accessToken: t(),
205
+ workspaceToken: n(),
206
+ userId: i,
207
+ organizationId: A()
205
208
  };
206
209
  console.log("[BigConsole-Assistant] authContext prepared", {
207
- hasAccessToken: !!u.accessToken,
208
- hasWorkspaceToken: !!u.workspaceToken,
209
- hasUserId: !!u.userId,
210
- hasOrgId: !!u.organizationId
211
- }), e.getState().startRun(t);
212
- let d = (t) => {
213
- i(t), e.getState().applyProgress(t);
214
- }, f = async (e) => {
210
+ hasAccessToken: !!p.accessToken,
211
+ hasWorkspaceToken: !!p.workspaceToken,
212
+ hasUserId: !!p.userId,
213
+ hasOrgId: !!p.organizationId
214
+ }), e.getState().startRun(c);
215
+ let h = (t) => {
216
+ u(t), e.getState().applyProgress(t);
217
+ }, g = async (e) => {
215
218
  try {
216
219
  console.log("[BigConsole-Assistant] run attempt", e);
217
- let { sandboxId: i, sessionId: f } = await K(c, u);
220
+ let { sandboxId: t, sessionId: n } = await U(f, p);
218
221
  console.log("[BigConsole-Assistant] ensureRuntime resolved", {
219
- sandboxId: i,
220
- sessionId: f
222
+ sandboxId: t,
223
+ sessionId: n
221
224
  });
222
- let p = H.current, m = n && n.length > 0 ? await l(n) : "", h = m ? `${t}\n\n${m}` : t, g = p ? `${p}\n\n---\n\n${h}` : h, v = Date.now();
225
+ let i = L.current, o = l && l.length > 0 ? await m(l) : "", u = o ? `${c}\n\n${o}` : c, g = i ? `${i}\n\n---\n\n${u}` : u, _ = Date.now();
223
226
  console.log("[BigConsole-Assistant] calling sendAssistantPromptAsync", {
224
- sandboxId: i,
225
- workspaceId: c,
226
- sessionId: f,
227
+ sandboxId: t,
228
+ workspaceId: f,
229
+ sessionId: n,
227
230
  promptLength: g.length,
228
- replayed: !!p
229
- }), await o(i, c, f, g, _, te(), u);
230
- let y = Date.now() + ne, b = Date.now(), x = "", S = Date.now(), C = L([], v);
231
- for (; Date.now() < y;) {
232
- if (s.aborted) throw Error("Cancelled");
233
- let e = await a(i, c, f, u, 50);
231
+ replayed: !!i
232
+ }), await s(t, f, n, g, S, te(), p);
233
+ let v = Date.now() + ne, y = Date.now(), b = "", x = Date.now(), C = z([], _);
234
+ for (; Date.now() < v;) {
235
+ if (d.aborted) throw Error("Cancelled");
236
+ let e = await a(t, f, n, p, 50);
234
237
  if (console.log("[BigConsole-Assistant] poll", {
235
- elapsedMs: Date.now() - v,
238
+ elapsedMs: Date.now() - _,
236
239
  messageCount: e.length,
237
- firstFewRoles: e.slice(0, 3).map((e) => k(e)),
238
- firstFewTimestamps: e.slice(0, 3).map((e) => A(e))
239
- }), C = L(e, v, x, S), console.log("[BigConsole-Assistant] progress", {
240
+ firstFewRoles: e.slice(0, 3).map((e) => j(e)),
241
+ firstFewTimestamps: e.slice(0, 3).map((e) => M(e))
242
+ }), C = z(e, _, b, x), console.log("[BigConsole-Assistant] progress", {
240
243
  contentPreview: C.content.slice(0, 100),
241
244
  done: C.done,
242
- lastContentChangeAt: Date.now() - S
243
- }), C.content !== x && (x = C.content, S = Date.now()), d(R(C.content)), C.done) {
245
+ lastContentChangeAt: Date.now() - x
246
+ }), C.content !== b && (b = C.content, x = Date.now()), h(B(C.content)), C.done) {
244
247
  console.log("[BigConsole-Assistant] progress.done=true, breaking poll loop");
245
248
  break;
246
249
  }
247
- Date.now() - b > ie && (await r(i, c, 600, u).catch(() => void 0), b = Date.now()), await new Promise((e) => setTimeout(e, re));
250
+ Date.now() - y > ie && (await r(t, f, 600, p).catch(() => void 0), y = Date.now()), await new Promise((e) => setTimeout(e, re));
248
251
  }
249
252
  if (!C.done) throw Error("I stopped waiting for a reply, but I may still be working — anything I already created will be there. Check your dashboards and data sinks before asking again, so you do not end up with duplicates.");
250
- let w = R(C.content);
253
+ let w = B(C.content);
251
254
  if (!w.trim()) throw Error("I could not produce a reply — the assistant runtime did not respond. It may be out of capacity right now. Nothing was changed; please try again shortly.");
252
- H.current = null;
255
+ L.current = null;
253
256
  try {
254
- G((await ee({
255
- conversationId: V.current,
256
- prompt: t,
257
+ H((await ee({
258
+ conversationId: F.current,
259
+ prompt: c,
257
260
  reply: w,
258
- agentSessionId: f
259
- }, c, u)).id);
261
+ agentSessionId: n
262
+ }, f, p)).id);
260
263
  } catch (e) {
261
264
  console.warn("[BigConsole-Assistant] could not save turn to history", { error: e instanceof Error ? e.message : String(e) });
262
265
  }
@@ -266,120 +269,120 @@ function z() {
266
269
  attempt: e,
267
270
  error: t instanceof Error ? t.message : String(t),
268
271
  stack: t instanceof Error ? t.stack : void 0,
269
- sandboxId: z.current,
270
- sessionId: B.current
271
- }), e === 1 && ae(t)) return U(null), W(null), f(2);
272
+ sandboxId: N.current,
273
+ sessionId: P.current
274
+ }), e === 1 && se(t)) return R(null), V(null), g(2);
272
275
  throw t;
273
276
  }
274
277
  };
275
278
  try {
276
- let t = await f(1);
279
+ let t = await g(1);
277
280
  return e.getState().finishRun(null), t;
278
281
  } catch (t) {
279
282
  throw e.getState().finishRun(t instanceof Error ? t.message : String(t)), t;
280
283
  }
281
284
  }, [
282
- N,
283
- K,
284
- E,
285
- j,
286
- M,
285
+ o,
287
286
  U,
288
- W,
289
- G
290
- ]), J = p(() => ({
291
- accessToken: E(),
292
- workspaceToken: j(),
293
- userId: M,
294
- organizationId: O()
287
+ t,
288
+ n,
289
+ i,
290
+ R,
291
+ V,
292
+ H
293
+ ]), G = v(() => ({
294
+ accessToken: t(),
295
+ workspaceToken: n(),
296
+ userId: i,
297
+ organizationId: A()
295
298
  }), [
296
- E,
297
- j,
298
- M
299
- ]), Y = p((e) => e.length === 0 ? null : [
299
+ t,
300
+ n,
301
+ i
302
+ ]), K = v((e) => e.length === 0 ? null : [
300
303
  "You are resuming an earlier conversation. What follows is what was said in it — treat it as your own memory and continue seamlessly. Do not mention this replay, and do not redo work that was already completed.",
301
304
  "--- earlier in this conversation ---",
302
- e.map((e) => `${e.role === "user" ? "User" : "Assistant"}: ${e.content}`).join("\n\n").slice(-b),
305
+ e.map((e) => `${e.role === "user" ? "User" : "Assistant"}: ${e.content}`).join("\n\n").slice(-ae),
303
306
  "--- end ---"
304
- ].join("\n\n"), []), X = p((e) => e.map((e) => ({
307
+ ].join("\n\n"), []), q = v((e) => e.map((e) => ({
305
308
  id: e.id,
306
309
  role: e.role === "ASSISTANT" ? "assistant" : "user",
307
- content: R(e.content)
308
- })), []), Z = p(async (e, t, n) => {
309
- let r = X(await d(e.id, t, n, v));
310
- return G(e.id), W(null), H.current = Y(r), r;
310
+ content: B(e.content)
311
+ })), []), J = v(async (e, t, n) => {
312
+ let r = q(await g(e.id, t, n, C));
313
+ return H(e.id), V(null), L.current = K(r), r;
311
314
  }, [
312
- X,
313
- G,
314
- W,
315
- Y
316
- ]), Q = p(async () => {
317
- let e = D(N);
318
- if (!e || !E()) return [];
319
- let t = J();
315
+ q,
316
+ H,
317
+ V,
318
+ K
319
+ ]), Y = v(async () => {
320
+ let e = k(o);
321
+ if (!e || !t()) return [];
322
+ let n = G();
320
323
  try {
321
- let n = await f(e, t, y), r = V.current, i = n.find((e) => e.id === r) ?? n[0];
322
- return i ? await Z(i, e, t) : [];
324
+ let t = await _(e, n, w), r = F.current, i = t.find((e) => e.id === r) ?? t[0];
325
+ return i ? await J(i, e, n) : [];
323
326
  } catch (e) {
324
327
  return console.warn("[BigConsole-Assistant] could not restore history", { error: e instanceof Error ? e.message : String(e) }), [];
325
328
  }
326
329
  }, [
327
- N,
328
- E,
329
- J,
330
- Z
331
- ]), $ = p(async () => {
332
- let e = D(N);
333
- if (!e || !E()) return [];
330
+ o,
331
+ t,
332
+ G,
333
+ J
334
+ ]), X = v(async () => {
335
+ let e = k(o);
336
+ if (!e || !t()) return [];
334
337
  try {
335
- return (await f(e, J(), y)).map((e) => ({
338
+ return (await _(e, G(), w)).map((e) => ({
336
339
  id: e.id,
337
340
  title: e.title?.trim() || "New chat",
338
341
  updatedAt: Date.parse(e.updatedAt) || void 0,
339
- active: e.id === V.current
342
+ active: e.id === F.current
340
343
  }));
341
344
  } catch {
342
345
  return [];
343
346
  }
344
347
  }, [
345
- N,
346
- E,
347
- J
348
- ]), oe = p(async () => (G(null), W(null), H.current = null, Promise.resolve()), [G, W]), se = p(async (e) => {
349
- let t = D(N);
350
- t && (await u(e, t, J()), V.current === e && (G(null), W(null), H.current = null));
348
+ o,
349
+ t,
350
+ G
351
+ ]), Z = v(async () => (H(null), V(null), L.current = null, Promise.resolve()), [H, V]), Q = v(async (e) => {
352
+ let t = k(o);
353
+ t && (await h(e, t, G()), F.current === e && (H(null), V(null), L.current = null));
351
354
  }, [
352
- N,
353
- J,
355
+ o,
354
356
  G,
355
- W
356
- ]), ce = p(async (e) => {
357
- let t = D(N);
357
+ H,
358
+ V
359
+ ]), $ = v(async (e) => {
360
+ let t = k(o);
358
361
  if (!t) return [];
359
- let n = J(), r = (await f(t, n, y)).find((t) => t.id === e);
360
- return r ? Z(r, t, n) : [];
362
+ let n = G(), r = (await _(t, n, w)).find((t) => t.id === e);
363
+ return r ? J(r, t, n) : [];
361
364
  }, [
362
- N,
363
- J,
364
- Z
365
+ o,
366
+ G,
367
+ J
365
368
  ]);
366
- return m(() => ({
367
- sendPrompt: q,
368
- loadHistory: Q,
369
- listSessions: $,
370
- newSession: oe,
371
- deleteSession: se,
372
- selectSession: ce
369
+ return y(() => ({
370
+ sendPrompt: W,
371
+ loadHistory: Y,
372
+ listSessions: X,
373
+ newSession: Z,
374
+ deleteSession: Q,
375
+ selectSession: $
373
376
  }), [
374
- q,
377
+ W,
378
+ Y,
379
+ X,
380
+ Z,
375
381
  Q,
376
- $,
377
- oe,
378
- se,
379
- ce
382
+ $
380
383
  ]);
381
384
  }
382
385
  //#endregion
383
- export { z as useSandboxAssistantTransport };
386
+ export { V as useSandboxAssistantTransport };
384
387
 
385
388
  //# sourceMappingURL=createSandboxAssistantTransport.js.map