@burdenoff/fe-libs 2026.920.1 → 2026.920.2
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 +17 -0
- package/dist/shared/assistant/api.d.ts.map +1 -1
- package/dist/shared/assistant/api.js +88 -66
- package/dist/shared/assistant/attachmentTurn.d.ts +21 -0
- package/dist/shared/assistant/attachmentTurn.d.ts.map +1 -0
- package/dist/shared/assistant/attachmentTurn.js +48 -0
- package/dist/shared/assistant/attachments.d.ts +85 -6
- package/dist/shared/assistant/attachments.d.ts.map +1 -1
- package/dist/shared/assistant/attachments.js +165 -112
- package/dist/shared/assistant/conversation.d.ts +21 -0
- package/dist/shared/assistant/conversation.d.ts.map +1 -1
- package/dist/shared/assistant/documentExtract.d.ts +11 -2
- package/dist/shared/assistant/documentExtract.d.ts.map +1 -1
- package/dist/shared/assistant/documentExtract.js +39 -37
- package/dist/shared/assistant/gatewayLimits.d.ts +10 -0
- package/dist/shared/assistant/gatewayLimits.d.ts.map +1 -1
- package/dist/shared/assistant/gatewayLimits.js +2 -2
- package/dist/shared/assistant/index.d.ts +1 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantChatArea.js +342 -325
- package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts +12 -0
- package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts.map +1 -1
- package/dist/shared/assistant/ui/composer/AssistantComposer.js +57 -57
- package/dist/shared/assistant/useAssistantAttachments.d.ts +12 -1
- package/dist/shared/assistant/useAssistantAttachments.d.ts.map +1 -1
- package/dist/shared/assistant/useAssistantAttachments.js +98 -98
- package/dist/shared-assistant.js +116 -115
- package/package.json +1 -1
|
@@ -150,6 +150,23 @@ export declare function buildPromptRequestBody(args: {
|
|
|
150
150
|
pageContext: Record<string, unknown> | undefined;
|
|
151
151
|
parts?: AssistantPromptPart[];
|
|
152
152
|
}): Record<string, unknown>;
|
|
153
|
+
export interface AssistantPromptGatewayRequest {
|
|
154
|
+
sandboxId: string;
|
|
155
|
+
workspaceId: string;
|
|
156
|
+
sessionId: string;
|
|
157
|
+
mode: AssistantMode;
|
|
158
|
+
prompt: string;
|
|
159
|
+
pageContext: Record<string, unknown> | undefined;
|
|
160
|
+
authContext: AssistantSandboxAuthContext;
|
|
161
|
+
parts?: AssistantPromptPart[];
|
|
162
|
+
}
|
|
163
|
+
/** The actual unbatched GraphQL body, including context and forwarded-token overhead. */
|
|
164
|
+
export declare function buildPromptGatewayRequest(args: AssistantPromptGatewayRequest): {
|
|
165
|
+
query: string;
|
|
166
|
+
operationName: string;
|
|
167
|
+
variables: Record<string, unknown>;
|
|
168
|
+
};
|
|
169
|
+
export declare function promptGatewayRequestBytes(args: AssistantPromptGatewayRequest): number;
|
|
153
170
|
export declare function sendAssistantPromptAsync(sandboxId: string, workspaceId: string, sessionId: string, prompt: string, mode: AssistantMode, pageContext: Record<string, unknown> | undefined, authContext: AssistantSandboxAuthContext,
|
|
154
171
|
/** Multimodal extras. Optional + trailing, so every existing call site is unaffected. */
|
|
155
172
|
options?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAkCH,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,2BAA2B,EAC3B,iBAAiB,EACjB,oBAAoB,EACpB,2BAA2B,EAC3B,YAAY,EACb,MAAM,SAAS,CAAC;AAMjB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,GACrC,O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42 @@ import { buildSandboxContextInput as e, executeSandboxGraphQL as t } from "./gat
|
|
|
2
2
|
import { CHECK_AI_CREDITS as n, CREATE_SANDBOX as r, EXTEND_SANDBOX_TTL as i, GET_ACTIVE_SANDBOXES as a, GET_SANDBOX as o, PROXY_SANDBOX_REQUEST as s, REPORT_AI_TOKEN_USAGE as c, STOP_ASSISTANT_SANDBOX as l, WAIT_FOR_SANDBOX_RUNNING as u } from "./operations.js";
|
|
3
3
|
import { ASSISTANT_API_AUTH_STRATEGY as d, getImageForMode as f, getImageTagForMode as p, getResourcesForMode as m, resolveSandboxAssistantMode as h } from "./images.js";
|
|
4
4
|
import { getCapability as g, isUnknownFieldError as _, markSupported as v, markUnsupported as y } from "./capabilities.js";
|
|
5
|
+
import { REQUEST_TOO_LARGE_REFUSAL as b } from "./gatewayLimits.js";
|
|
5
6
|
//#region src/shared/assistant/api.ts
|
|
6
|
-
function
|
|
7
|
+
function x(e) {
|
|
7
8
|
return e === "assistant";
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
function S(t, n, r, i, a, o, c) {
|
|
11
|
+
return {
|
|
11
12
|
query: s,
|
|
12
13
|
operationName: "ProxySandboxRequest",
|
|
13
14
|
variables: { input: {
|
|
14
|
-
sandboxId:
|
|
15
|
-
path:
|
|
16
|
-
method:
|
|
17
|
-
body:
|
|
18
|
-
context: e(
|
|
19
|
-
...
|
|
20
|
-
forwardedAuthToken:
|
|
21
|
-
forwardedWorkspaceToken:
|
|
15
|
+
sandboxId: t,
|
|
16
|
+
path: r,
|
|
17
|
+
method: i,
|
|
18
|
+
body: a,
|
|
19
|
+
context: e(n, c),
|
|
20
|
+
...x(o) ? {
|
|
21
|
+
forwardedAuthToken: c?.accessToken ?? void 0,
|
|
22
|
+
forwardedWorkspaceToken: c?.workspaceToken ?? void 0
|
|
22
23
|
} : {}
|
|
23
|
-
} }
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
} }
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
async function C(e, n, r, i, a, o, s) {
|
|
28
|
+
let c = (await t({
|
|
29
|
+
...S(e, n, r, i, a, o, s),
|
|
30
|
+
workspaceId: n,
|
|
31
|
+
authContext: s
|
|
26
32
|
})).proxySandboxRequest;
|
|
27
|
-
if (!
|
|
28
|
-
let e =
|
|
29
|
-
throw Error(e?.error ?? `Proxy error: ${
|
|
33
|
+
if (!c || c.status >= 400) {
|
|
34
|
+
let e = c?.body;
|
|
35
|
+
throw Error(e?.error ?? `Proxy error: ${c?.status ?? "unknown"}`);
|
|
30
36
|
}
|
|
31
|
-
return
|
|
37
|
+
return c.body;
|
|
32
38
|
}
|
|
33
|
-
async function
|
|
34
|
-
return
|
|
39
|
+
async function w(n, r, i, o, s, c = /* @__PURE__ */ new Set()) {
|
|
40
|
+
return T((await t({
|
|
35
41
|
query: a,
|
|
36
42
|
operationName: "GetActiveSandboxes",
|
|
37
43
|
variables: { context: e(n, s) },
|
|
@@ -39,13 +45,13 @@ async function S(n, r, i, o, s, c = /* @__PURE__ */ new Set()) {
|
|
|
39
45
|
authContext: s
|
|
40
46
|
})).getActiveSandboxes ?? [], r, i, o, s, c);
|
|
41
47
|
}
|
|
42
|
-
function
|
|
43
|
-
return e.find((e) => !a.has(e.id) && (e.status === "RUNNING" || e.status === "PROVISIONING" || e.status === "PENDING") && e.template === "AI_BUILDER" && h(e, [n]) === n && (!i.userId || e.createdBy === i.userId) && e.metadata?.authStrategy === "sandbox-app-client-headers-v1" && e.metadata?.assistantProduct === t && (!
|
|
48
|
+
function T(e, t, n, r, i, a = /* @__PURE__ */ new Set()) {
|
|
49
|
+
return e.find((e) => !a.has(e.id) && (e.status === "RUNNING" || e.status === "PROVISIONING" || e.status === "PENDING") && e.template === "AI_BUILDER" && h(e, [n]) === n && (!i.userId || e.createdBy === i.userId) && e.metadata?.authStrategy === "sandbox-app-client-headers-v1" && e.metadata?.assistantProduct === t && (!E(n) || e.metadata?.confirmWrites === !0))?.id ?? null;
|
|
44
50
|
}
|
|
45
|
-
function
|
|
51
|
+
function E(e) {
|
|
46
52
|
return e === "api-calls";
|
|
47
53
|
}
|
|
48
|
-
function
|
|
54
|
+
function D(e, t, n, r) {
|
|
49
55
|
let i = [
|
|
50
56
|
{
|
|
51
57
|
name: "AI_ASSISTANT_MODE",
|
|
@@ -73,13 +79,13 @@ function T(e, t, n, r) {
|
|
|
73
79
|
}), r.workspaceToken && i.push({
|
|
74
80
|
name: "WORKSPACE_AUTH_TOKEN",
|
|
75
81
|
value: r.workspaceToken
|
|
76
|
-
})),
|
|
82
|
+
})), E(t) && i.push({
|
|
77
83
|
name: "AI_ASSISTANT_CONFIRM_WRITES",
|
|
78
84
|
value: "1"
|
|
79
85
|
}), i;
|
|
80
86
|
}
|
|
81
|
-
async function
|
|
82
|
-
let l = m(i), u =
|
|
87
|
+
async function O(n, i, a, o, s, c) {
|
|
88
|
+
let l = m(i), u = D(n, i, a, c), h = (t) => ({
|
|
83
89
|
name: `ai-assistant-${i}-${Date.now()}`,
|
|
84
90
|
description: `AI Assistant sandbox (${i} mode)`,
|
|
85
91
|
template: "AI_BUILDER",
|
|
@@ -102,7 +108,7 @@ async function E(n, i, a, o, s, c) {
|
|
|
102
108
|
assistantOrganizationId: c.organizationId ?? null,
|
|
103
109
|
authStrategy: d,
|
|
104
110
|
imageTag: p(i, o),
|
|
105
|
-
confirmWrites:
|
|
111
|
+
confirmWrites: E(i)
|
|
106
112
|
},
|
|
107
113
|
context: e(a, c)
|
|
108
114
|
}), g = (e) => t({
|
|
@@ -122,7 +128,7 @@ async function E(n, i, a, o, s, c) {
|
|
|
122
128
|
if (!_?.createSandbox?.id) throw Error("createSandbox returned empty response");
|
|
123
129
|
return _.createSandbox.id;
|
|
124
130
|
}
|
|
125
|
-
async function
|
|
131
|
+
async function k(n, r, i) {
|
|
126
132
|
return (await t({
|
|
127
133
|
query: o,
|
|
128
134
|
operationName: "GetSandbox",
|
|
@@ -134,10 +140,10 @@ async function D(n, r, i) {
|
|
|
134
140
|
authContext: i
|
|
135
141
|
})).getSandbox;
|
|
136
142
|
}
|
|
137
|
-
function
|
|
143
|
+
function A(e, t) {
|
|
138
144
|
if (e === "FAILED" || e === "STOPPED" || e === "EXPIRED") throw Error(t ? `Sandbox ${e.toLowerCase()}: ${t}` : `Sandbox ${e.toLowerCase()}`);
|
|
139
145
|
}
|
|
140
|
-
async function
|
|
146
|
+
async function j(n, r, i, a = 3e5) {
|
|
141
147
|
let o = Date.now();
|
|
142
148
|
if (g("waitForSandboxRunning") !== "unsupported") for (; Date.now() - o < a;) try {
|
|
143
149
|
let a = await t({
|
|
@@ -154,7 +160,7 @@ async function k(n, r, i, a = 3e5) {
|
|
|
154
160
|
v("waitForSandboxRunning");
|
|
155
161
|
let o = a.waitForSandboxRunning;
|
|
156
162
|
if (o?.status === "RUNNING") return;
|
|
157
|
-
|
|
163
|
+
A(o?.status, o?.errorMessage);
|
|
158
164
|
} catch (e) {
|
|
159
165
|
if (_(e)) {
|
|
160
166
|
y("waitForSandboxRunning");
|
|
@@ -163,17 +169,17 @@ async function k(n, r, i, a = 3e5) {
|
|
|
163
169
|
throw e;
|
|
164
170
|
}
|
|
165
171
|
for (; Date.now() - o < a;) {
|
|
166
|
-
let e = await
|
|
172
|
+
let e = await k(n, r, i);
|
|
167
173
|
if (e?.status === "RUNNING") return;
|
|
168
|
-
|
|
174
|
+
A(e?.status, e?.errorMessage), await new Promise((e) => setTimeout(e, 2e3));
|
|
169
175
|
}
|
|
170
176
|
throw Error("Sandbox startup timed out");
|
|
171
177
|
}
|
|
172
|
-
async function
|
|
178
|
+
async function M(e, t, n, r, i = 9e4) {
|
|
173
179
|
let a = Date.now();
|
|
174
180
|
for (; Date.now() - a < i;) {
|
|
175
181
|
try {
|
|
176
|
-
await
|
|
182
|
+
await C(e, t, "/health", "GET", void 0, n, r);
|
|
177
183
|
return;
|
|
178
184
|
} catch (e) {
|
|
179
185
|
let t = e instanceof Error ? e.message : String(e);
|
|
@@ -183,20 +189,20 @@ async function A(e, t, n, r, i = 9e4) {
|
|
|
183
189
|
}
|
|
184
190
|
throw Error("Assistant service did not become healthy before timeout");
|
|
185
191
|
}
|
|
186
|
-
async function
|
|
187
|
-
return { sessionId: (await
|
|
192
|
+
async function N(e, t, n, r) {
|
|
193
|
+
return { sessionId: (await C(e, t, "/sessions", "POST", { mode: n }, n, r)).session.id };
|
|
188
194
|
}
|
|
189
|
-
async function
|
|
190
|
-
let a = await
|
|
195
|
+
async function P(e, t, n, r, i) {
|
|
196
|
+
let a = await C(e, t, `/write-confirmations/${encodeURIComponent(n)}/approve`, "POST", {}, r, i);
|
|
191
197
|
if (a?.approved !== !0) throw Error(typeof a?.error == "string" ? a.error : "The change could not be approved. It may have expired — ask the assistant to try again.");
|
|
192
198
|
}
|
|
193
|
-
function
|
|
199
|
+
function F(e, t, n, r, i, a = /* @__PURE__ */ new Set()) {
|
|
194
200
|
return i.userId ? e.filter((e) => e.metadata?.authStrategy === "sandbox-app-client-headers-v1" && e.createdBy === i.userId && !(!a.has(e.id) && e.metadata?.assistantProduct === t && h(e, [n]) === n)).map((e) => e.id) : [];
|
|
195
201
|
}
|
|
196
|
-
async function
|
|
202
|
+
async function I(n, r, i, o, s, c = /* @__PURE__ */ new Set()) {
|
|
197
203
|
let l;
|
|
198
204
|
try {
|
|
199
|
-
l =
|
|
205
|
+
l = F((await t({
|
|
200
206
|
query: a,
|
|
201
207
|
operationName: "GetActiveSandboxes",
|
|
202
208
|
variables: { context: e(n, s) },
|
|
@@ -208,13 +214,13 @@ async function P(n, r, i, o, s, c = /* @__PURE__ */ new Set()) {
|
|
|
208
214
|
}
|
|
209
215
|
return (await Promise.all(l.map(async (e) => {
|
|
210
216
|
try {
|
|
211
|
-
return await
|
|
217
|
+
return await L(e, n, s), e;
|
|
212
218
|
} catch {
|
|
213
219
|
return null;
|
|
214
220
|
}
|
|
215
221
|
}))).filter((e) => e !== null);
|
|
216
222
|
}
|
|
217
|
-
async function
|
|
223
|
+
async function L(n, r, i) {
|
|
218
224
|
await t({
|
|
219
225
|
query: l,
|
|
220
226
|
operationName: "StopAssistantSandbox",
|
|
@@ -226,7 +232,7 @@ async function F(n, r, i) {
|
|
|
226
232
|
authContext: i
|
|
227
233
|
});
|
|
228
234
|
}
|
|
229
|
-
function
|
|
235
|
+
function R(e) {
|
|
230
236
|
let { mode: t, prompt: n, pageContext: r, parts: i } = e, a = {
|
|
231
237
|
mode: t,
|
|
232
238
|
prompt: n,
|
|
@@ -234,8 +240,24 @@ function I(e) {
|
|
|
234
240
|
};
|
|
235
241
|
return i && i.length > 0 && (a.parts = i), a;
|
|
236
242
|
}
|
|
237
|
-
|
|
238
|
-
|
|
243
|
+
function z(e) {
|
|
244
|
+
return S(e.sandboxId, e.workspaceId, `/sessions/${e.sessionId}/prompt-async`, "POST", R(e), e.mode, e.authContext);
|
|
245
|
+
}
|
|
246
|
+
function B(e) {
|
|
247
|
+
return new TextEncoder().encode(JSON.stringify(z(e))).byteLength;
|
|
248
|
+
}
|
|
249
|
+
async function V(e, t, n, r, i, a, o, s) {
|
|
250
|
+
if (B({
|
|
251
|
+
sandboxId: e,
|
|
252
|
+
workspaceId: t,
|
|
253
|
+
sessionId: n,
|
|
254
|
+
prompt: r,
|
|
255
|
+
mode: i,
|
|
256
|
+
pageContext: a,
|
|
257
|
+
authContext: o,
|
|
258
|
+
parts: s?.parts
|
|
259
|
+
}) > 262144) throw Error(b);
|
|
260
|
+
let c = await C(e, t, `/sessions/${n}/prompt-async`, "POST", R({
|
|
239
261
|
mode: i,
|
|
240
262
|
prompt: r,
|
|
241
263
|
pageContext: a,
|
|
@@ -243,16 +265,16 @@ async function L(e, t, n, r, i, a, o, s) {
|
|
|
243
265
|
}), i, o);
|
|
244
266
|
return { messageID: typeof c.messageID == "string" ? c.messageID : void 0 };
|
|
245
267
|
}
|
|
246
|
-
async function
|
|
268
|
+
async function H(e, t, n, r, i, a) {
|
|
247
269
|
let o = `/sessions/${n}/messages?limit=${a?.limit ?? 50}`;
|
|
248
270
|
a?.sinceMs && g("sinceParam") !== "unsupported" && (o += `&since=${a.sinceMs}`);
|
|
249
|
-
let s = await
|
|
271
|
+
let s = await C(e, t, o, "GET", void 0, r, i);
|
|
250
272
|
return typeof s.now == "number" && v("sinceParam"), s.messages ?? [];
|
|
251
273
|
}
|
|
252
|
-
async function
|
|
274
|
+
async function U(e, t, n, r, i) {
|
|
253
275
|
if (g("sse") === "unsupported") return null;
|
|
254
276
|
try {
|
|
255
|
-
let a = await
|
|
277
|
+
let a = await C(e, t, `/sessions/${n}/stream-url`, "GET", void 0, r, i);
|
|
256
278
|
return typeof a.url == "string" && typeof a.expiresAt == "number" ? (v("sse"), {
|
|
257
279
|
url: a.url,
|
|
258
280
|
expiresAt: a.expiresAt
|
|
@@ -261,7 +283,7 @@ async function z(e, t, n, r, i) {
|
|
|
261
283
|
return y("sse"), null;
|
|
262
284
|
}
|
|
263
285
|
}
|
|
264
|
-
async function
|
|
286
|
+
async function W(n, r, a, o) {
|
|
265
287
|
await t({
|
|
266
288
|
query: i,
|
|
267
289
|
operationName: "ExtendSandboxTtl",
|
|
@@ -274,28 +296,28 @@ async function B(n, r, a, o) {
|
|
|
274
296
|
authContext: o
|
|
275
297
|
});
|
|
276
298
|
}
|
|
277
|
-
async function
|
|
278
|
-
await
|
|
299
|
+
async function G(e, t, n, r, i) {
|
|
300
|
+
await C(e, t, `/sessions/${n}/heartbeat`, "POST", void 0, r, i).catch(() => void 0);
|
|
279
301
|
}
|
|
280
|
-
async function
|
|
302
|
+
async function K(e, t, n, r, i) {
|
|
281
303
|
try {
|
|
282
|
-
return (await
|
|
304
|
+
return (await C(e, t, `/sessions/${n}/abort`, "POST", void 0, r, i))?.aborted === !0;
|
|
283
305
|
} catch {
|
|
284
306
|
return !1;
|
|
285
307
|
}
|
|
286
308
|
}
|
|
287
|
-
async function
|
|
288
|
-
return ((await
|
|
309
|
+
async function q(e, t, n, r, i) {
|
|
310
|
+
return ((await C(e, t, `/sessions/${n}/artifacts`, "GET", void 0, r, i)).artifacts ?? []).filter((e) => !e.name.startsWith("."));
|
|
289
311
|
}
|
|
290
|
-
async function
|
|
291
|
-
let a = await
|
|
312
|
+
async function J(e, t, n, r, i) {
|
|
313
|
+
let a = await C(e, t, `/sessions/${n}`, "GET", void 0, r, i);
|
|
292
314
|
return {
|
|
293
315
|
id: a.session?.id ?? n,
|
|
294
316
|
mode: a.mode ?? "unknown"
|
|
295
317
|
};
|
|
296
318
|
}
|
|
297
|
-
async function
|
|
298
|
-
let o = (await
|
|
319
|
+
async function Y(e, t, n, r, i, a) {
|
|
320
|
+
let o = (await C(e, t, `/sessions/${n}/artifacts/download?path=${encodeURIComponent(r)}`, "GET", void 0, i, a)).artifact;
|
|
299
321
|
if (!o) throw Error("Artifact download returned an empty response");
|
|
300
322
|
return {
|
|
301
323
|
filename: o.filename,
|
|
@@ -303,7 +325,7 @@ async function G(e, t, n, r, i, a) {
|
|
|
303
325
|
contentBase64: o.contentBase64
|
|
304
326
|
};
|
|
305
327
|
}
|
|
306
|
-
async function
|
|
328
|
+
async function X(e, r) {
|
|
307
329
|
return (await t({
|
|
308
330
|
query: n,
|
|
309
331
|
operationName: "CheckAiCredits",
|
|
@@ -312,7 +334,7 @@ async function K(e, r) {
|
|
|
312
334
|
authContext: r
|
|
313
335
|
})).checkAiCredits;
|
|
314
336
|
}
|
|
315
|
-
async function
|
|
337
|
+
async function Z(e, n, r, i, a, o) {
|
|
316
338
|
let s = Math.max(0, Math.round(a.input ?? 0)), l = Math.max(0, Math.round(a.output ?? 0));
|
|
317
339
|
s + l === 0 || !i || await t({
|
|
318
340
|
query: c,
|
|
@@ -329,4 +351,4 @@ async function q(e, n, r, i, a, o) {
|
|
|
329
351
|
});
|
|
330
352
|
}
|
|
331
353
|
//#endregion
|
|
332
|
-
export {
|
|
354
|
+
export { K as abortAssistantTurn, P as approvePendingWrite, D as buildAssistantSandboxEnv, z as buildPromptGatewayRequest, R as buildPromptRequestBody, X as checkAssistantAiCredits, O as createAssistantSandbox, N as createAssistantSession, Y as downloadAssistantArtifact, W as extendAssistantSandboxTTL, w as findExistingSandbox, x as forwardsUserTokensToSandbox, q as getAssistantArtifacts, H as getAssistantMessages, J as getAssistantSession, U as getAssistantStreamAccess, E as modeRequiresConfirmWrites, B as promptGatewayRequestBytes, I as releaseSupersededAssistantSandboxes, Z as reportAssistantAiTokenUsage, T as selectExistingAssistantSandbox, F as selectSupersededAssistantSandboxes, V as sendAssistantPromptAsync, G as sendHeartbeat, L as stopReapedAssistantSandbox, M as waitForAssistantServiceReady, j as waitForSandboxRunning };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AssistantAttachment, AssistantInlineLimits } from './attachments';
|
|
2
|
+
import { AssistantPromptPart } from './types';
|
|
3
|
+
export interface BoundedAttachmentTurn {
|
|
4
|
+
prompt: string;
|
|
5
|
+
parts: AssistantPromptPart[] | undefined;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Fit the FINAL request, after the product preamble and page context are known.
|
|
9
|
+
* The caller measures the real GraphQL envelope; character counts and a fixed
|
|
10
|
+
* headroom allowance cannot account for arbitrary URLs, metadata or Unicode.
|
|
11
|
+
* Ordinary turns keep the existing prompt/parts byte-for-byte.
|
|
12
|
+
*/
|
|
13
|
+
export declare function buildBoundedAttachmentTurn({ content, attachments, limits, wrapPrompt, requestBytes, }: {
|
|
14
|
+
content: string;
|
|
15
|
+
attachments: AssistantAttachment[];
|
|
16
|
+
limits: AssistantInlineLimits;
|
|
17
|
+
/** Pure product preamble; evaluated for each candidate budget. */
|
|
18
|
+
wrapPrompt: (text: string) => string;
|
|
19
|
+
requestBytes: (prompt: string, parts?: AssistantPromptPart[]) => number;
|
|
20
|
+
}): BoundedAttachmentTurn;
|
|
21
|
+
//# sourceMappingURL=attachmentTurn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachmentTurn.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/attachmentTurn.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC3B,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,mBAAmB,EAAE,GAAG,SAAS,CAAC;CAC1C;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,OAAO,EACP,WAAW,EACX,MAAM,EACN,UAAU,EACV,YAAY,GACb,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,mBAAmB,EAAE,CAAC;IACnC,MAAM,EAAE,qBAAqB,CAAC;IAC9B,kEAAkE;IAClE,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACrC,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,mBAAmB,EAAE,KAAK,MAAM,CAAC;CACzE,GAAG,qBAAqB,CAiExB"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { REQUEST_TOO_LARGE_REFUSAL as e } from "./gatewayLimits.js";
|
|
2
|
+
import { MAX_TURN_BODY_BYTES as t, buildPromptParts as n, buildPromptWithAttachments as r, getSendableAttachments as i } from "./attachments.js";
|
|
3
|
+
//#region src/shared/assistant/attachmentTurn.ts
|
|
4
|
+
function a({ content: a, attachments: o, limits: s, wrapPrompt: c, requestBytes: l }) {
|
|
5
|
+
let u = (e, n) => l(e, n) <= t, d = (e) => {
|
|
6
|
+
let t = n(e, o);
|
|
7
|
+
return u(e, t) ? t : void 0;
|
|
8
|
+
}, f = (e) => c(r(a, o, {
|
|
9
|
+
...s,
|
|
10
|
+
totalChars: e
|
|
11
|
+
})), p = f(s.totalChars), m = n(p, o);
|
|
12
|
+
if (m) {
|
|
13
|
+
if (u(p, m)) return {
|
|
14
|
+
prompt: p,
|
|
15
|
+
parts: m
|
|
16
|
+
};
|
|
17
|
+
if (u(p)) return {
|
|
18
|
+
prompt: p,
|
|
19
|
+
parts: void 0
|
|
20
|
+
};
|
|
21
|
+
} else if (u(p)) return {
|
|
22
|
+
prompt: p,
|
|
23
|
+
parts: void 0
|
|
24
|
+
};
|
|
25
|
+
let h = f(0);
|
|
26
|
+
if (u(h)) {
|
|
27
|
+
let e = 0, t = s.totalChars, n = h;
|
|
28
|
+
for (; e < t;) {
|
|
29
|
+
let r = Math.ceil((e + t) / 2), i = f(r);
|
|
30
|
+
u(i) ? (e = r, n = i) : t = r - 1;
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
prompt: n,
|
|
34
|
+
parts: d(n)
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
let g = i(o).length;
|
|
38
|
+
if (g > 0) {
|
|
39
|
+
let e = c(`${a}\n\n${g} attachment(s) omitted from this turn to fit the request-size limit. Their contents and links were not sent. Do not guess their contents; ask the user to resend them with a shorter message.`);
|
|
40
|
+
if (u(e)) return {
|
|
41
|
+
prompt: e,
|
|
42
|
+
parts: void 0
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
throw Error(e);
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { a as buildBoundedAttachmentTurn };
|
|
@@ -3,7 +3,6 @@ import { AssistantPromptPart } from './types';
|
|
|
3
3
|
export declare const MAX_ATTACHMENTS = 5;
|
|
4
4
|
/** Per-file ceiling before downscaling (images) / rejection (everything else). */
|
|
5
5
|
export declare const MAX_FILE_BYTES: number;
|
|
6
|
-
/** Per-file inline budget for text-like content, in characters. */
|
|
7
6
|
/**
|
|
8
7
|
* Media types a provider will accept as a URL-only `file` part.
|
|
9
8
|
*
|
|
@@ -27,9 +26,41 @@ export declare const PROVIDER_READABLE_FILE_MEDIA_TYPES: readonly ["application/
|
|
|
27
26
|
* they normally travel as `image` parts with inline bytes.
|
|
28
27
|
*/
|
|
29
28
|
export declare function isProviderReadableFilePart(mimeType: string | undefined): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Per-file inline budget for text-like content, in characters — the DEFAULT. A
|
|
31
|
+
* mode may set its own (`AssistantModeConfig.maxInlineCharsPerFile`); see
|
|
32
|
+
* `resolveAssistantInlineLimits`.
|
|
33
|
+
*/
|
|
30
34
|
export declare const MAX_INLINE_CHARS_PER_FILE = 8000;
|
|
31
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Total inline budget across all attachments in one turn — the DEFAULT. A mode
|
|
37
|
+
* may set its own (`AssistantModeConfig.maxInlineCharsTotal`).
|
|
38
|
+
*/
|
|
32
39
|
export declare const MAX_INLINE_CHARS_TOTAL = 20000;
|
|
40
|
+
/**
|
|
41
|
+
* How much attachment TEXT one turn may carry inline: per file, and across all
|
|
42
|
+
* of them (BOFF-7334).
|
|
43
|
+
*
|
|
44
|
+
* ★★ Per mode, because one size did not fit. 8,000 characters a file is right
|
|
45
|
+
* for a question about a spreadsheet and far too little for a mode that BUILDS
|
|
46
|
+
* from one — BigConsole's Build designs a data sink from the CSV it is handed,
|
|
47
|
+
* and its own transport used to send 100,000 characters of it (decision D13:
|
|
48
|
+
* "per-mode inline cap for BC Build"). Every other mode keeps the defaults, and
|
|
49
|
+
* with them this module's behaviour byte for byte.
|
|
50
|
+
*/
|
|
51
|
+
export interface AssistantInlineLimits {
|
|
52
|
+
/** Characters of any one file's text that may travel inline. */
|
|
53
|
+
readonly perFileChars: number;
|
|
54
|
+
/** Characters of text, across every file in the turn, that may travel inline. */
|
|
55
|
+
readonly totalChars: number;
|
|
56
|
+
}
|
|
57
|
+
/** What every mode gets unless it says otherwise. */
|
|
58
|
+
export declare const DEFAULT_INLINE_LIMITS: AssistantInlineLimits;
|
|
59
|
+
/** The fields of a mode's config that set its limits. */
|
|
60
|
+
export interface AssistantInlineLimitsConfig {
|
|
61
|
+
readonly maxInlineCharsPerFile?: number;
|
|
62
|
+
readonly maxInlineCharsTotal?: number;
|
|
63
|
+
}
|
|
33
64
|
export type AssistantAttachmentKind = "image" | "text" | "document";
|
|
34
65
|
export type AssistantAttachmentStatus = "pending" | "uploading" | "ready" | "error";
|
|
35
66
|
export type AttachmentRejection = "too-many" | "too-large" | "empty" | "unreadable" | "unsupported-image";
|
|
@@ -67,8 +98,10 @@ export interface AssistantAttachment {
|
|
|
67
98
|
/** Short-lived presigned URL, resolved at send time. */
|
|
68
99
|
downloadUrl?: string;
|
|
69
100
|
/**
|
|
70
|
-
* Inlined content for this attachment, already truncated to
|
|
71
|
-
*
|
|
101
|
+
* Inlined content for this attachment, already truncated to the per-file
|
|
102
|
+
* limit it was prepared with (`largestInlineCharsPerFile` of the modes on
|
|
103
|
+
* offer; `MAX_INLINE_CHARS_PER_FILE` by default). The send cuts it again to
|
|
104
|
+
* the sending mode's limit. Text files carry the file itself; PDF/DOCX/XLSX
|
|
72
105
|
* carry whatever `extractDocumentText` pulled out of them (BOFF-6291).
|
|
73
106
|
*/
|
|
74
107
|
textContent?: string;
|
|
@@ -257,14 +290,17 @@ export declare const PROMPT_ENVELOPE_RESERVE_BYTES = 2048;
|
|
|
257
290
|
* Attachments that failed to upload are omitted: the user already sees the
|
|
258
291
|
* failure in the composer, and a half-described file only confuses the model.
|
|
259
292
|
*/
|
|
260
|
-
export declare function buildAttachmentPromptBlock(attachments: AssistantAttachment[], userText?: string): string;
|
|
293
|
+
export declare function buildAttachmentPromptBlock(attachments: AssistantAttachment[], userText?: string, limits?: AssistantInlineLimits): string;
|
|
261
294
|
/**
|
|
262
295
|
* Compose the text actually sent to the agent: the user's words, then the
|
|
263
296
|
* attachment block. The user-facing bubble keeps the raw text (attachments are
|
|
264
297
|
* rendered as chips there), matching how `buildPromptForMode` already separates
|
|
265
298
|
* agent-only preamble from displayed content.
|
|
299
|
+
*
|
|
300
|
+
* `limits` are the sending MODE's (`resolveAssistantInlineLimits`); the default
|
|
301
|
+
* is what every mode had before modes could choose.
|
|
266
302
|
*/
|
|
267
|
-
export declare function buildPromptWithAttachments(content: string, attachments: AssistantAttachment[]): string;
|
|
303
|
+
export declare function buildPromptWithAttachments(content: string, attachments: AssistantAttachment[], limits?: AssistantInlineLimits): string;
|
|
268
304
|
export type { AssistantPromptPart };
|
|
269
305
|
/**
|
|
270
306
|
* How many images may travel INLINE in one turn.
|
|
@@ -313,6 +349,49 @@ export declare const MAX_TURN_BODY_BYTES = 262144;
|
|
|
313
349
|
export declare const TURN_BODY_HEADROOM_BYTES = 32768;
|
|
314
350
|
/** What the modelled part of the body must fit inside. */
|
|
315
351
|
export declare const MAX_INLINE_TURN_BODY_BYTES: number;
|
|
352
|
+
/**
|
|
353
|
+
* The most text, per file or per turn, a mode may ask to inline: 200,000
|
|
354
|
+
* characters.
|
|
355
|
+
*
|
|
356
|
+
* ★ Bounded by the request body, which is where an over-large turn dies. Every
|
|
357
|
+
* character is at least one byte, so more characters than the body has bytes
|
|
358
|
+
* left after the prompt envelope can never travel. It is also no more than a
|
|
359
|
+
* document extraction ever holds (`MAX_EXTRACTED_CHARS`), so a document can use
|
|
360
|
+
* all of it. Within the ceiling, whether a given turn fits is still MEASURED —
|
|
361
|
+
* non-ASCII text and JSON escaping cost more than a byte a character — by
|
|
362
|
+
* `capTextToBody`.
|
|
363
|
+
*/
|
|
364
|
+
export declare const MAX_CONFIGURABLE_INLINE_CHARS: number;
|
|
365
|
+
/**
|
|
366
|
+
* The inline limits of the mode a turn is sent in (BOFF-7334).
|
|
367
|
+
*
|
|
368
|
+
* - Neither field set (or no config at all): `DEFAULT_INLINE_LIMITS`, the very
|
|
369
|
+
* object, so every existing mode keeps today's budget.
|
|
370
|
+
* - `maxInlineCharsPerFile` alone: that per file, and a total of at least the
|
|
371
|
+
* default — never less than one such file. Asking for 100,000 a file should
|
|
372
|
+
* not be silently held to a 20,000 total.
|
|
373
|
+
* - `maxInlineCharsTotal` alone: that total, per file unchanged.
|
|
374
|
+
* - Per file never exceeds the total; both are bounded by
|
|
375
|
+
* `MAX_CONFIGURABLE_INLINE_CHARS`.
|
|
376
|
+
*
|
|
377
|
+
* ★ Pass the config for EXACTLY the mode being sent in (`findAssistantModeConfig`),
|
|
378
|
+
* never a display fallback to another mode's — the same rule as
|
|
379
|
+
* `resolveAssistantModeCapabilities`, for the same reason: one mode's budget must
|
|
380
|
+
* not be lent to another.
|
|
381
|
+
*/
|
|
382
|
+
export declare function resolveAssistantInlineLimits(config?: AssistantInlineLimitsConfig | null): AssistantInlineLimits;
|
|
383
|
+
/**
|
|
384
|
+
* How much of one file to KEEP when it is attached, before anyone knows which
|
|
385
|
+
* mode it will be sent in: the largest per-file limit among the modes offered.
|
|
386
|
+
*
|
|
387
|
+
* ★ Not the current mode's. A file attached in Ask and sent after switching to
|
|
388
|
+
* a mode with a larger limit would otherwise arrive already cut to Ask's 8,000
|
|
389
|
+
* characters. Keeping the largest costs only memory — at most
|
|
390
|
+
* `MAX_ATTACHMENTS` × `MAX_CONFIGURABLE_INLINE_CHARS` — because the send cuts
|
|
391
|
+
* every file to the SENDING mode's limit (`applyInlineBudget`). A product whose
|
|
392
|
+
* modes all use the defaults keeps exactly 8,000, as before.
|
|
393
|
+
*/
|
|
394
|
+
export declare function largestInlineCharsPerFile(modes: readonly AssistantInlineLimitsConfig[] | null | undefined): number;
|
|
316
395
|
/**
|
|
317
396
|
* Encode settings for the copy of an image that travels INSIDE the turn.
|
|
318
397
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachments.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/attachments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,OAAO,
|
|
1
|
+
{"version":3,"file":"attachments.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/attachments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,OAAO,EAKL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAExB,eAAO,MA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