@burdenoff/fe-libs 2026.906.5 → 2026.907.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.
- package/dist/shared/assistant/api.d.ts +52 -0
- package/dist/shared/assistant/api.d.ts.map +1 -1
- package/dist/shared/assistant/api.js +43 -14
- package/dist/shared/assistant/pendingWrite.d.ts +13 -0
- package/dist/shared/assistant/pendingWrite.d.ts.map +1 -1
- package/dist/shared/assistant/pendingWrite.js +48 -42
- package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantChatArea.js +299 -271
- package/dist/shared/assistant/ui/AssistantMessageItem.d.ts +4 -0
- package/dist/shared/assistant/ui/AssistantMessageItem.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantMessageItem.js +54 -50
- package/dist/shared/assistant/ui/AssistantMessageList.d.ts +3 -0
- package/dist/shared/assistant/ui/AssistantMessageList.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantMessageList.js +19 -17
- package/dist/shared/assistant/ui/AssistantPendingWriteCard.d.ts +25 -10
- package/dist/shared/assistant/ui/AssistantPendingWriteCard.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantPendingWriteCard.js +53 -39
- package/dist/shared-assistant.js +87 -87
- package/package.json +1 -1
|
@@ -41,6 +41,58 @@ export declare function waitForAssistantServiceReady(sandboxId: string, workspac
|
|
|
41
41
|
export declare function createAssistantSession(sandboxId: string, workspaceId: string, mode: AssistantMode, authContext: AssistantSandboxAuthContext): Promise<{
|
|
42
42
|
sessionId: string;
|
|
43
43
|
}>;
|
|
44
|
+
/**
|
|
45
|
+
* Tell the sandbox the user approved a pending write.
|
|
46
|
+
*
|
|
47
|
+
* ★★ This is the frontend half of the write gate. The sandbox no longer puts
|
|
48
|
+
* the confirmation token in anything the model can read — the refusal carries a
|
|
49
|
+
* reference that NAMES the pending change and authorises nothing — so the only
|
|
50
|
+
* way a refused write becomes executable is this call, made because a person
|
|
51
|
+
* pressed a button. The model is not in this path.
|
|
52
|
+
*
|
|
53
|
+
* ★ The reference is not a secret and is validated as hex by the parser before
|
|
54
|
+
* it reaches here, so it can safely sit in the URL.
|
|
55
|
+
*
|
|
56
|
+
* ★ Throws on failure rather than resolving quietly. A 404 means the pending
|
|
57
|
+
* write expired or was already spent, and the user must see that their approval
|
|
58
|
+
* did NOT land — silently swallowing it would leave them believing a change was
|
|
59
|
+
* authorised when it was not.
|
|
60
|
+
*/
|
|
61
|
+
export declare function approvePendingWrite(sandboxId: string, workspaceId: string, reference: string, authContext: AssistantSandboxAuthContext): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Our own assistant sandboxes in this workspace that are for a DIFFERENT mode.
|
|
64
|
+
*
|
|
65
|
+
* ★★ Pure and exported so the ownership rules below are testable without a
|
|
66
|
+
* network. Getting these wrong stops somebody else's container.
|
|
67
|
+
*/
|
|
68
|
+
export declare function selectSupersededAssistantSandboxes(sandboxes: readonly ExistingAssistantSandbox[], product: string, mode: AssistantMode, isProd: boolean, authContext: AssistantSandboxAuthContext): string[];
|
|
69
|
+
/**
|
|
70
|
+
* Free the workspace's sandbox slot before provisioning a different mode.
|
|
71
|
+
*
|
|
72
|
+
* ★★ THE BUG THIS FIXES. Sandbox reuse keys on mode and image tag, so "Ask" and
|
|
73
|
+
* "Take action" need DIFFERENT containers — but a Free workspace holds exactly
|
|
74
|
+
* ONE concurrent sandbox, and nothing ever released it. Every session provisions
|
|
75
|
+
* a read-only Ask sandbox, the panel heartbeat then extends its TTL for as long
|
|
76
|
+
* as the panel is open, and switching to "Take action" asks for a second
|
|
77
|
+
* container against a quota of one. It fails, and the failure surfaces as
|
|
78
|
+
* "You've reached your sandbox limit on the current plan" — which reads like a
|
|
79
|
+
* billing problem and is actually us holding our own slot.
|
|
80
|
+
*
|
|
81
|
+
* So: before provisioning, stop the assistant sandboxes that can no longer be
|
|
82
|
+
* reused. This is not an optimisation, it is the difference between "Take
|
|
83
|
+
* action" working and not working on the plan almost every workspace is on.
|
|
84
|
+
*
|
|
85
|
+
* ★ Best-effort by design. A failure to stop is not a failure to answer: the
|
|
86
|
+
* provision that follows may still succeed (a paid workspace has room), and if
|
|
87
|
+
* it does not, the quota error is the right thing for the user to see. Throwing
|
|
88
|
+
* here would replace a specific, actionable error with a vaguer one.
|
|
89
|
+
*
|
|
90
|
+
* ★ Consequence worth stating: with a one-slot quota, a second tab in the other
|
|
91
|
+
* mode loses its sandbox. That is forced by the quota rather than chosen here —
|
|
92
|
+
* the alternative is that the second mode never works at all — and the tab
|
|
93
|
+
* recovers by provisioning again on its next turn.
|
|
94
|
+
*/
|
|
95
|
+
export declare function releaseSupersededAssistantSandboxes(workspaceId: string, product: string, mode: AssistantMode, isProd: boolean, authContext: AssistantSandboxAuthContext): Promise<string[]>;
|
|
44
96
|
/**
|
|
45
97
|
* Terminalize a sandbox whose Cloudflare data plane was reaped while its DB
|
|
46
98
|
* record remained RUNNING. Invoked only for Cloudflare's exact connection-
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA8BH,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,2BAA2B,EAC3B,iBAAiB,EACjB,oBAAoB,EACpB,2BAA2B,EAC3B,YAAY,EACb,MAAM,SAAS,CAAC;AA+CjB,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,OAAO,EACf,WAAW,EAAE,2BAA2B,EACxC,kBAAkB,GAAE,WAAW,CAAC,MAAM,CAAa,GAClD,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAkBxB;AAED,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MA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AE,2BAA2B,GACvC,OAAO,CAAC,oBAAoB,CAAC,CAc/B;AAED,wBAAsB,yBAAyB,CAC7C,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,2BAA2B,GACvC,OAAO,CAAC,2BAA2B,CAAC,CAkBtC;AAED,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,2BAA2B,GACvC,OAAO,CAAC,OAAO,CAAC,CASlB;AAED,wBAAsB,2BAA2B,CAC/C,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EACzC,WAAW,EAAE,2BAA2B,GACvC,OAAO,CAAC,IAAI,CAAC,CAaf"}
|
|
@@ -181,7 +181,36 @@ async function k(e, t, n, r = 9e4) {
|
|
|
181
181
|
async function A(e, t, n, r) {
|
|
182
182
|
return { sessionId: (await b(e, t, "/sessions", "POST", { mode: n }, r)).session.id };
|
|
183
183
|
}
|
|
184
|
-
async function j(n, r
|
|
184
|
+
async function j(e, t, n, r) {
|
|
185
|
+
let i = await b(e, t, `/write-confirmations/${encodeURIComponent(n)}/approve`, "POST", {}, r);
|
|
186
|
+
if (i?.approved !== !0) throw Error(typeof i?.error == "string" ? i.error : "The change could not be approved. It may have expired — ask the assistant to try again.");
|
|
187
|
+
}
|
|
188
|
+
function M(e, t, n, r, i) {
|
|
189
|
+
let a = p(n, r);
|
|
190
|
+
return e.filter((e) => e.metadata?.authStrategy === "sandbox-app-client-headers-v1" && e.metadata?.assistantProduct === t && (!i.userId || e.createdBy === i.userId) && !(h(e) === n && e.metadata?.imageTag === a)).map((e) => e.id);
|
|
191
|
+
}
|
|
192
|
+
async function N(n, r, i, o, s) {
|
|
193
|
+
let c;
|
|
194
|
+
try {
|
|
195
|
+
c = M((await t({
|
|
196
|
+
query: a,
|
|
197
|
+
operationName: "GetActiveSandboxes",
|
|
198
|
+
variables: { context: e(n, s) },
|
|
199
|
+
workspaceId: n,
|
|
200
|
+
authContext: s
|
|
201
|
+
})).getActiveSandboxes ?? [], r, i, o, s);
|
|
202
|
+
} catch {
|
|
203
|
+
return [];
|
|
204
|
+
}
|
|
205
|
+
return (await Promise.all(c.map(async (e) => {
|
|
206
|
+
try {
|
|
207
|
+
return await P(e, n, s), e;
|
|
208
|
+
} catch {
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
}))).filter((e) => e !== null);
|
|
212
|
+
}
|
|
213
|
+
async function P(n, r, i) {
|
|
185
214
|
await t({
|
|
186
215
|
query: l,
|
|
187
216
|
operationName: "StopAssistantSandbox",
|
|
@@ -193,7 +222,7 @@ async function j(n, r, i) {
|
|
|
193
222
|
authContext: i
|
|
194
223
|
});
|
|
195
224
|
}
|
|
196
|
-
function
|
|
225
|
+
function F(e) {
|
|
197
226
|
let { mode: t, prompt: n, pageContext: r, parts: i } = e, a = {
|
|
198
227
|
mode: t,
|
|
199
228
|
prompt: n,
|
|
@@ -201,8 +230,8 @@ function M(e) {
|
|
|
201
230
|
};
|
|
202
231
|
return i && i.length > 0 && (a.parts = i), a;
|
|
203
232
|
}
|
|
204
|
-
async function
|
|
205
|
-
let c = await b(e, t, `/sessions/${n}/prompt-async`, "POST",
|
|
233
|
+
async function I(e, t, n, r, i, a, o, s) {
|
|
234
|
+
let c = await b(e, t, `/sessions/${n}/prompt-async`, "POST", F({
|
|
206
235
|
mode: i,
|
|
207
236
|
prompt: r,
|
|
208
237
|
pageContext: a,
|
|
@@ -210,13 +239,13 @@ async function N(e, t, n, r, i, a, o, s) {
|
|
|
210
239
|
}), o);
|
|
211
240
|
return { messageID: typeof c.messageID == "string" ? c.messageID : void 0 };
|
|
212
241
|
}
|
|
213
|
-
async function
|
|
242
|
+
async function L(e, t, n, r, i) {
|
|
214
243
|
let a = `/sessions/${n}/messages?limit=${i?.limit ?? 50}`;
|
|
215
244
|
i?.sinceMs && g("sinceParam") !== "unsupported" && (a += `&since=${i.sinceMs}`);
|
|
216
245
|
let o = await b(e, t, a, "GET", void 0, r);
|
|
217
246
|
return typeof o.now == "number" && v("sinceParam"), o.messages ?? [];
|
|
218
247
|
}
|
|
219
|
-
async function
|
|
248
|
+
async function R(e, t, n, r) {
|
|
220
249
|
if (g("sse") === "unsupported") return null;
|
|
221
250
|
try {
|
|
222
251
|
let i = await b(e, t, `/sessions/${n}/stream-url`, "GET", void 0, r);
|
|
@@ -228,7 +257,7 @@ async function F(e, t, n, r) {
|
|
|
228
257
|
return y("sse"), null;
|
|
229
258
|
}
|
|
230
259
|
}
|
|
231
|
-
async function
|
|
260
|
+
async function z(n, r, a, o) {
|
|
232
261
|
await t({
|
|
233
262
|
query: i,
|
|
234
263
|
operationName: "ExtendSandboxTtl",
|
|
@@ -241,20 +270,20 @@ async function I(n, r, a, o) {
|
|
|
241
270
|
authContext: o
|
|
242
271
|
});
|
|
243
272
|
}
|
|
244
|
-
async function
|
|
273
|
+
async function B(e, t, n, r) {
|
|
245
274
|
await b(e, t, `/sessions/${n}/heartbeat`, "POST", void 0, r).catch(() => void 0);
|
|
246
275
|
}
|
|
247
|
-
async function
|
|
276
|
+
async function V(e, t, n, r) {
|
|
248
277
|
return ((await b(e, t, `/sessions/${n}/artifacts`, "GET", void 0, r)).artifacts ?? []).filter((e) => !e.name.startsWith("."));
|
|
249
278
|
}
|
|
250
|
-
async function
|
|
279
|
+
async function H(e, t, n, r) {
|
|
251
280
|
let i = await b(e, t, `/sessions/${n}`, "GET", void 0, r);
|
|
252
281
|
return {
|
|
253
282
|
id: i.session?.id ?? n,
|
|
254
283
|
mode: i.mode ?? "unknown"
|
|
255
284
|
};
|
|
256
285
|
}
|
|
257
|
-
async function
|
|
286
|
+
async function U(e, t, n, r, i) {
|
|
258
287
|
let a = (await b(e, t, `/sessions/${n}/artifacts/download?path=${encodeURIComponent(r)}`, "GET", void 0, i)).artifact;
|
|
259
288
|
if (!a) throw Error("Artifact download returned an empty response");
|
|
260
289
|
return {
|
|
@@ -263,7 +292,7 @@ async function B(e, t, n, r, i) {
|
|
|
263
292
|
contentBase64: a.contentBase64
|
|
264
293
|
};
|
|
265
294
|
}
|
|
266
|
-
async function
|
|
295
|
+
async function W(e, r) {
|
|
267
296
|
return (await t({
|
|
268
297
|
query: n,
|
|
269
298
|
operationName: "CheckAiCredits",
|
|
@@ -272,7 +301,7 @@ async function V(e, r) {
|
|
|
272
301
|
authContext: r
|
|
273
302
|
})).checkAiCredits;
|
|
274
303
|
}
|
|
275
|
-
async function
|
|
304
|
+
async function G(e, n, r, i, a, o) {
|
|
276
305
|
let s = Math.max(0, Math.round(a.input ?? 0)), l = Math.max(0, Math.round(a.output ?? 0));
|
|
277
306
|
s + l === 0 || !i || await t({
|
|
278
307
|
query: c,
|
|
@@ -289,4 +318,4 @@ async function H(e, n, r, i, a, o) {
|
|
|
289
318
|
});
|
|
290
319
|
}
|
|
291
320
|
//#endregion
|
|
292
|
-
export { w as buildAssistantSandboxEnv,
|
|
321
|
+
export { j as approvePendingWrite, w as buildAssistantSandboxEnv, F as buildPromptRequestBody, W as checkAssistantAiCredits, T as createAssistantSandbox, A as createAssistantSession, U as downloadAssistantArtifact, z as extendAssistantSandboxTTL, x as findExistingSandbox, V as getAssistantArtifacts, L as getAssistantMessages, H as getAssistantSession, R as getAssistantStreamAccess, C as modeRequiresConfirmWrites, N as releaseSupersededAssistantSandboxes, G as reportAssistantAiTokenUsage, S as selectExistingAssistantSandbox, M as selectSupersededAssistantSandboxes, I as sendAssistantPromptAsync, B as sendHeartbeat, P as stopReapedAssistantSandbox, k as waitForAssistantServiceReady, O as waitForSandboxRunning };
|
|
@@ -38,6 +38,19 @@ export interface PendingWrite {
|
|
|
38
38
|
* naming the operation alone rather than implying there is nothing to send.
|
|
39
39
|
*/
|
|
40
40
|
values: PendingWriteValue[] | null;
|
|
41
|
+
/**
|
|
42
|
+
* The pending change's public reference, when the sandbox emitted one.
|
|
43
|
+
*
|
|
44
|
+
* ★★ NOT a token, and the distinction is the whole design. The reference
|
|
45
|
+
* NAMES the pending write so the panel can approve that exact one; it
|
|
46
|
+
* authorises nothing on its own. The token never leaves the sandbox — being
|
|
47
|
+
* shown it is what used to let the model approve itself.
|
|
48
|
+
*
|
|
49
|
+
* `null` on a sandbox running an image from before the approval endpoint
|
|
50
|
+
* existed, in which case the card has nothing to approve WITH and correctly
|
|
51
|
+
* falls back to asking the user to reply in prose.
|
|
52
|
+
*/
|
|
53
|
+
reference: string | null;
|
|
41
54
|
}
|
|
42
55
|
/**
|
|
43
56
|
* A tool part as the transport delivers it. Deliberately loose: `state.output`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pendingWrite.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/pendingWrite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,MAAM,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"pendingWrite.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/pendingWrite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,MAAM,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAC;IACnC;;;;;;;;;;;OAWG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AASD;;;;GAIG;AACH,UAAU,YAAY;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,SAAS,CAAC;CAClE;AAqCD;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAgE1E;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,YAAY,EAAE,GAAG,SAAS,GACzC,YAAY,GAAG,IAAI,CAWrB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/shared/assistant/pendingWrite.ts
|
|
2
|
-
var e = "CONFIRMATION_REQUIRED", t = /CONFIRMATION_REQUIRED: the write "([^"]+)" was NOT sent/, n = "Values you were about to send:"
|
|
3
|
-
function
|
|
2
|
+
var e = "CONFIRMATION_REQUIRED", t = /CONFIRMATION_REQUIRED: the write "([^"]+)" was NOT sent/, n = "Values you were about to send:", r = /Pending change reference:\s*([0-9a-f]{6,64})\b/;
|
|
3
|
+
function i(e) {
|
|
4
4
|
if (typeof e == "string") return e;
|
|
5
5
|
if (e && typeof e == "object" && "output" in e) {
|
|
6
6
|
let t = e.output;
|
|
@@ -8,7 +8,7 @@ function r(e) {
|
|
|
8
8
|
}
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function a(e) {
|
|
12
12
|
if (!e || typeof e != "object" || Array.isArray(e)) return null;
|
|
13
13
|
let t = Object.entries(e);
|
|
14
14
|
return t.length === 0 ? null : t.map(([e, t]) => ({
|
|
@@ -16,70 +16,76 @@ function i(e) {
|
|
|
16
16
|
value: typeof t == "string" ? t : t == null ? "—" : JSON.stringify(t)
|
|
17
17
|
}));
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
if (!
|
|
21
|
-
let
|
|
22
|
-
if (!
|
|
23
|
-
let
|
|
24
|
-
if (
|
|
25
|
-
operation:
|
|
26
|
-
values: null
|
|
19
|
+
function o(i) {
|
|
20
|
+
if (!i.includes(e)) return null;
|
|
21
|
+
let o = t.exec(i)?.[1]?.trim();
|
|
22
|
+
if (!o) return null;
|
|
23
|
+
let s = r.exec(i)?.[1] ?? null, c = i.indexOf(n);
|
|
24
|
+
if (c === -1) return {
|
|
25
|
+
operation: o,
|
|
26
|
+
values: null,
|
|
27
|
+
reference: s
|
|
27
28
|
};
|
|
28
|
-
let
|
|
29
|
-
if (!
|
|
30
|
-
operation:
|
|
31
|
-
values: null
|
|
29
|
+
let l = i.slice(c + 30).trim();
|
|
30
|
+
if (!l || l.startsWith("(no variables)")) return {
|
|
31
|
+
operation: o,
|
|
32
|
+
values: null,
|
|
33
|
+
reference: s
|
|
32
34
|
};
|
|
33
|
-
let
|
|
34
|
-
if (
|
|
35
|
-
operation:
|
|
36
|
-
values: null
|
|
35
|
+
let u = l.indexOf("{");
|
|
36
|
+
if (u === -1) return {
|
|
37
|
+
operation: o,
|
|
38
|
+
values: null,
|
|
39
|
+
reference: s
|
|
37
40
|
};
|
|
38
|
-
let
|
|
39
|
-
for (let e =
|
|
40
|
-
let t =
|
|
41
|
-
if (
|
|
42
|
-
|
|
41
|
+
let d = 0, f = -1, p = !1, m = !1;
|
|
42
|
+
for (let e = u; e < l.length; e += 1) {
|
|
43
|
+
let t = l[e];
|
|
44
|
+
if (m) {
|
|
45
|
+
m = !1;
|
|
43
46
|
continue;
|
|
44
47
|
}
|
|
45
|
-
if (t === "\\" &&
|
|
46
|
-
|
|
48
|
+
if (t === "\\" && p) {
|
|
49
|
+
m = !0;
|
|
47
50
|
continue;
|
|
48
51
|
}
|
|
49
|
-
if (t === "\"")
|
|
50
|
-
else if (!
|
|
51
|
-
else if (!
|
|
52
|
-
|
|
52
|
+
if (t === "\"") p = !p;
|
|
53
|
+
else if (!p && t === "{") d += 1;
|
|
54
|
+
else if (!p && t === "}" && (--d, d === 0)) {
|
|
55
|
+
f = e + 1;
|
|
53
56
|
break;
|
|
54
57
|
}
|
|
55
58
|
}
|
|
56
|
-
if (
|
|
57
|
-
operation:
|
|
58
|
-
values: null
|
|
59
|
+
if (f === -1) return {
|
|
60
|
+
operation: o,
|
|
61
|
+
values: null,
|
|
62
|
+
reference: s
|
|
59
63
|
};
|
|
60
64
|
try {
|
|
61
65
|
return {
|
|
62
|
-
operation:
|
|
63
|
-
values:
|
|
66
|
+
operation: o,
|
|
67
|
+
values: a(JSON.parse(l.slice(u, f))),
|
|
68
|
+
reference: s
|
|
64
69
|
};
|
|
65
70
|
} catch {
|
|
66
71
|
return {
|
|
67
|
-
operation:
|
|
68
|
-
values: null
|
|
72
|
+
operation: o,
|
|
73
|
+
values: null,
|
|
74
|
+
reference: s
|
|
69
75
|
};
|
|
70
76
|
}
|
|
71
77
|
}
|
|
72
|
-
function
|
|
78
|
+
function s(e) {
|
|
73
79
|
if (!e) return null;
|
|
74
80
|
let t = null;
|
|
75
81
|
for (let n of e) {
|
|
76
82
|
if (n?.type !== "tool") continue;
|
|
77
|
-
let e =
|
|
83
|
+
let e = i(n.state?.output);
|
|
78
84
|
if (!e) continue;
|
|
79
|
-
let
|
|
80
|
-
|
|
85
|
+
let r = o(e);
|
|
86
|
+
r && (t = r);
|
|
81
87
|
}
|
|
82
88
|
return t;
|
|
83
89
|
}
|
|
84
90
|
//#endregion
|
|
85
|
-
export {
|
|
91
|
+
export { s as findPendingWrite, o as parseConfirmationRefusal };
|
|
@@ -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;
|
|
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;AAoEf,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,CA4rDxD,CAAC"}
|