@burdenoff/microfe-bigconsole 2026.714.1 → 2026.714.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.
- package/dist/bigconsole/BigConsoleRoot.js +102 -97
- package/dist/bigconsole/BigConsoleRoot.js.map +1 -1
- package/dist/bigconsole/assistant/assistantRunStore.js +89 -0
- package/dist/bigconsole/assistant/assistantRunStore.js.map +1 -0
- package/dist/bigconsole/assistant/createSandboxAssistantTransport.js +181 -172
- package/dist/bigconsole/assistant/createSandboxAssistantTransport.js.map +1 -1
- package/dist/bigconsole/components/dashboard/DashboardCanvas.js +24 -24
- package/dist/bigconsole/components/preview/AiPreviewPanel.js +283 -0
- package/dist/bigconsole/components/preview/AiPreviewPanel.js.map +1 -0
- package/dist/bigconsole/components/widgets/PropertiesPanel.js +9 -9
- package/dist/bigconsole/hooks/index.js +5 -5
- package/dist/bigconsole/hooks/useWidgetCatalog.js +11 -11
- package/dist/bigconsole/pages/DashboardBuilderPage.js +3 -3
- package/dist/bigconsole/pages/DashboardViewPage.js +3 -3
- package/package.json +1 -1
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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
|
|
5
|
-
import { useAuthToken as
|
|
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
|
|
8
|
-
function
|
|
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
|
|
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
|
|
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
|
|
33
|
-
return new URLSearchParams(window.location.search).get("workspace") ??
|
|
33
|
+
function E(e) {
|
|
34
|
+
return new URLSearchParams(window.location.search).get("workspace") ?? T("workspaceId") ?? e ?? "";
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
-
return new URLSearchParams(window.location.search).get("org") ??
|
|
36
|
+
function D() {
|
|
37
|
+
return new URLSearchParams(window.location.search).get("org") ?? T("organizationId");
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
+
function O(e) {
|
|
39
40
|
return e.info?.role ?? e.role;
|
|
40
41
|
}
|
|
41
|
-
function
|
|
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
|
|
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
|
|
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
|
|
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
|
|
79
|
+
function N(e) {
|
|
79
80
|
return typeof e == "object" && e ? e : void 0;
|
|
80
81
|
}
|
|
81
|
-
function
|
|
82
|
-
let t = e.tool ?? "tool", n =
|
|
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 =
|
|
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
|
|
90
|
+
return M[t] ?? `Running ${t}`;
|
|
90
91
|
}
|
|
91
|
-
function
|
|
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 =
|
|
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
|
|
98
|
-
let i = e.filter((e) =>
|
|
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) =>
|
|
103
|
-
messageTimestamps: e.map((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(
|
|
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 = !!
|
|
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
|
|
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,233 +140,241 @@ function ae(e) {
|
|
|
139
140
|
"unexpected error"
|
|
140
141
|
].some((e) => t.includes(e));
|
|
141
142
|
}
|
|
142
|
-
function
|
|
143
|
-
let { getAccessToken:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
S
|
|
147
|
-
], []),
|
|
148
|
-
|
|
149
|
-
}, []),
|
|
150
|
-
|
|
151
|
-
}, []),
|
|
152
|
-
|
|
153
|
-
}, []),
|
|
154
|
-
let a =
|
|
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:
|
|
158
|
+
workspaceId: e
|
|
158
159
|
}), !a) {
|
|
159
|
-
if (!
|
|
160
|
-
if (console.log("[BigConsole-Assistant] findExistingSandbox called"), a = await
|
|
161
|
-
console.log("[BigConsole-Assistant] waitForSandboxReady called (reused)", { sandboxId: a }), await
|
|
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
|
|
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
|
|
171
|
+
let o = z.current;
|
|
171
172
|
return console.log("[BigConsole-Assistant] session check", {
|
|
172
|
-
sessionId:
|
|
173
|
+
sessionId: o,
|
|
173
174
|
sandboxId: a
|
|
174
|
-
}),
|
|
175
|
+
}), o || (console.log("[BigConsole-Assistant] createAssistantSession called", {
|
|
175
176
|
sandboxId: a,
|
|
176
|
-
workspaceId:
|
|
177
|
-
}),
|
|
177
|
+
workspaceId: e
|
|
178
|
+
}), o = (await n(a, e, g, r)).sessionId, U(o)), {
|
|
178
179
|
sandboxId: a,
|
|
179
|
-
sessionId:
|
|
180
|
+
sessionId: o
|
|
180
181
|
};
|
|
181
|
-
}, [
|
|
182
|
-
let
|
|
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:
|
|
185
|
-
workspaceId:
|
|
186
|
-
hasCtxWorkspaceId: !!
|
|
185
|
+
promptLength: t.length,
|
|
186
|
+
workspaceId: s,
|
|
187
|
+
hasCtxWorkspaceId: !!M,
|
|
187
188
|
authContextKeys: {
|
|
188
|
-
hasAccessToken: !!
|
|
189
|
-
hasWorkspaceToken: !!
|
|
190
|
-
hasUserId: !!
|
|
189
|
+
hasAccessToken: !!T(),
|
|
190
|
+
hasWorkspaceToken: !!A(),
|
|
191
|
+
hasUserId: !!j
|
|
191
192
|
},
|
|
192
193
|
locationSearch: window.location.search
|
|
193
|
-
}), !
|
|
194
|
-
let
|
|
195
|
-
accessToken:
|
|
196
|
-
workspaceToken:
|
|
197
|
-
userId:
|
|
198
|
-
organizationId:
|
|
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: !!
|
|
202
|
-
hasWorkspaceToken: !!
|
|
203
|
-
hasUserId: !!
|
|
204
|
-
hasOrgId: !!
|
|
205
|
-
});
|
|
206
|
-
let
|
|
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",
|
|
209
|
-
let { sandboxId:
|
|
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:
|
|
214
|
+
sandboxId: n,
|
|
212
215
|
sessionId: u
|
|
213
216
|
});
|
|
214
|
-
let d =
|
|
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:
|
|
217
|
-
workspaceId:
|
|
219
|
+
sandboxId: n,
|
|
220
|
+
workspaceId: s,
|
|
218
221
|
sessionId: u,
|
|
219
222
|
promptLength: f.length,
|
|
220
223
|
replayed: !!d
|
|
221
|
-
}), await
|
|
222
|
-
let m = Date.now() + ne,
|
|
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 (
|
|
225
|
-
let e = await
|
|
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) =>
|
|
230
|
-
firstFewTimestamps: e.slice(0, 3).map((e) =>
|
|
231
|
-
}), y =
|
|
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()),
|
|
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() -
|
|
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 =
|
|
243
|
-
|
|
245
|
+
let b = L(y.content);
|
|
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.");
|
|
247
|
+
V.current = null;
|
|
244
248
|
try {
|
|
245
|
-
|
|
246
|
-
conversationId:
|
|
247
|
-
prompt:
|
|
249
|
+
W((await ee({
|
|
250
|
+
conversationId: B.current,
|
|
251
|
+
prompt: t,
|
|
248
252
|
reply: b,
|
|
249
253
|
agentSessionId: u
|
|
250
|
-
},
|
|
254
|
+
}, s, c)).id);
|
|
251
255
|
} catch (e) {
|
|
252
256
|
console.warn("[BigConsole-Assistant] could not save turn to history", { error: e instanceof Error ? e.message : String(e) });
|
|
253
257
|
}
|
|
254
258
|
return { text: b };
|
|
255
|
-
} catch (
|
|
259
|
+
} catch (t) {
|
|
256
260
|
if (console.error("[BigConsole-Assistant] run error", {
|
|
257
|
-
attempt:
|
|
258
|
-
error:
|
|
259
|
-
stack:
|
|
260
|
-
sandboxId:
|
|
261
|
-
sessionId:
|
|
262
|
-
}),
|
|
263
|
-
throw
|
|
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;
|
|
264
268
|
}
|
|
265
269
|
};
|
|
266
|
-
|
|
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
|
+
}
|
|
267
276
|
}, [
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
k,
|
|
277
|
+
M,
|
|
278
|
+
G,
|
|
279
|
+
T,
|
|
272
280
|
A,
|
|
273
|
-
|
|
281
|
+
j,
|
|
274
282
|
H,
|
|
275
|
-
U
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
283
|
+
U,
|
|
284
|
+
W
|
|
285
|
+
]), q = f(() => ({
|
|
286
|
+
accessToken: T(),
|
|
287
|
+
workspaceToken: A(),
|
|
288
|
+
userId: j,
|
|
289
|
+
organizationId: D()
|
|
281
290
|
}), [
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
]),
|
|
291
|
+
T,
|
|
292
|
+
A,
|
|
293
|
+
j
|
|
294
|
+
]), J = f((e) => e.length === 0 ? null : [
|
|
286
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.",
|
|
287
296
|
"--- earlier in this conversation ---",
|
|
288
|
-
e.map((e) => `${e.role === "user" ? "User" : "Assistant"}: ${e.content}`).join("\n\n").slice(-
|
|
297
|
+
e.map((e) => `${e.role === "user" ? "User" : "Assistant"}: ${e.content}`).join("\n\n").slice(-y),
|
|
289
298
|
"--- end ---"
|
|
290
|
-
].join("\n\n"), []),
|
|
299
|
+
].join("\n\n"), []), Y = f((e) => e.map((e) => ({
|
|
291
300
|
id: e.id,
|
|
292
301
|
role: e.role === "ASSISTANT" ? "assistant" : "user",
|
|
293
|
-
content:
|
|
294
|
-
})), []),
|
|
295
|
-
let r =
|
|
296
|
-
return
|
|
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;
|
|
297
306
|
}, [
|
|
298
|
-
|
|
307
|
+
Y,
|
|
308
|
+
W,
|
|
299
309
|
U,
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
let t = K();
|
|
310
|
+
J
|
|
311
|
+
]), Z = f(async () => {
|
|
312
|
+
let e = E(M);
|
|
313
|
+
if (!e || !T()) return [];
|
|
314
|
+
let t = q();
|
|
306
315
|
try {
|
|
307
|
-
let n = await
|
|
308
|
-
return i ? await
|
|
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) : [];
|
|
309
318
|
} catch (e) {
|
|
310
319
|
return console.warn("[BigConsole-Assistant] could not restore history", { error: e instanceof Error ? e.message : String(e) }), [];
|
|
311
320
|
}
|
|
312
321
|
}, [
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
]),
|
|
318
|
-
let e =
|
|
319
|
-
if (!e || !
|
|
322
|
+
M,
|
|
323
|
+
T,
|
|
324
|
+
q,
|
|
325
|
+
X
|
|
326
|
+
]), Q = f(async () => {
|
|
327
|
+
let e = E(M);
|
|
328
|
+
if (!e || !T()) return [];
|
|
320
329
|
try {
|
|
321
|
-
return (await
|
|
330
|
+
return (await d(e, q(), v)).map((e) => ({
|
|
322
331
|
id: e.id,
|
|
323
332
|
title: e.title?.trim() || "New chat",
|
|
324
333
|
updatedAt: Date.parse(e.updatedAt) || void 0,
|
|
325
|
-
active: e.id ===
|
|
334
|
+
active: e.id === B.current
|
|
326
335
|
}));
|
|
327
336
|
} catch {
|
|
328
337
|
return [];
|
|
329
338
|
}
|
|
330
339
|
}, [
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
]),
|
|
335
|
-
let t =
|
|
336
|
-
t && (await
|
|
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));
|
|
337
346
|
}, [
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
]),
|
|
343
|
-
let t =
|
|
347
|
+
M,
|
|
348
|
+
q,
|
|
349
|
+
W,
|
|
350
|
+
U
|
|
351
|
+
]), se = f(async (e) => {
|
|
352
|
+
let t = E(M);
|
|
344
353
|
if (!t) return [];
|
|
345
|
-
let n =
|
|
346
|
-
return r ?
|
|
354
|
+
let n = q(), r = (await d(t, n, v)).find((t) => t.id === e);
|
|
355
|
+
return r ? X(r, t, n) : [];
|
|
347
356
|
}, [
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
357
|
+
M,
|
|
358
|
+
q,
|
|
359
|
+
X
|
|
351
360
|
]);
|
|
352
|
-
return
|
|
353
|
-
sendPrompt:
|
|
354
|
-
loadHistory:
|
|
355
|
-
listSessions:
|
|
356
|
-
newSession:
|
|
357
|
-
deleteSession:
|
|
358
|
-
selectSession:
|
|
361
|
+
return p(() => ({
|
|
362
|
+
sendPrompt: K,
|
|
363
|
+
loadHistory: Z,
|
|
364
|
+
listSessions: Q,
|
|
365
|
+
newSession: $,
|
|
366
|
+
deleteSession: oe,
|
|
367
|
+
selectSession: se
|
|
359
368
|
}), [
|
|
360
|
-
|
|
361
|
-
X,
|
|
369
|
+
K,
|
|
362
370
|
Z,
|
|
363
371
|
Q,
|
|
364
372
|
$,
|
|
365
|
-
oe
|
|
373
|
+
oe,
|
|
374
|
+
se
|
|
366
375
|
]);
|
|
367
376
|
}
|
|
368
377
|
//#endregion
|
|
369
|
-
export {
|
|
378
|
+
export { R as useSandboxAssistantTransport };
|
|
370
379
|
|
|
371
380
|
//# sourceMappingURL=createSandboxAssistantTransport.js.map
|