@burdenoff/microfe-bigconsole 2026.714.2 → 2026.714.4

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