@burdenoff/fe-libs 2026.1021.11 → 2026.1021.13
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 +2 -0
- package/dist/shared/assistant/api.js +133 -132
- package/dist/shared/assistant/index.d.ts +1 -0
- package/dist/shared/assistant/pageContextKeys.d.ts +46 -0
- package/dist/shared/assistant/pageContextKeys.js +46 -0
- package/dist/shared/events/fluidgrids.d.ts +75 -0
- package/dist/shared/events/fluidgrids.js +14 -0
- package/dist/shared/events/index.d.ts +5 -2
- package/dist/shared/events/sinks/RybbitSink.d.ts +16 -1
- package/dist/shared/events/sinks/RybbitSink.js +81 -77
- package/dist/shared/events/sinks/index.d.ts +1 -0
- package/dist/shared/events/sinks/index.js +1 -0
- package/dist/shared/events/sinks/rybbitRoutes.d.ts +21 -0
- package/dist/shared/events/sinks/rybbitRoutes.js +20 -0
- package/dist/shared/providers/AppShellProvider.d.ts +26 -0
- package/dist/shared/providers/AppShellProvider.js +419 -153
- package/dist/shared-assistant.js +298 -297
- package/dist/shared-events.js +34 -32
- package/dist/shared.js +55 -53
- package/package.json +2 -2
|
@@ -427,6 +427,8 @@ export declare const PROMPT_CONVERSATION_ID_PATTERN: RegExp;
|
|
|
427
427
|
* is one the sandbox accepts — a proposal-v1 sandbox binds the session's
|
|
428
428
|
* proposals to it; any other ignores it — and `writeReply` only when set.
|
|
429
429
|
* A sandbox that predates them ignores both unknown keys.
|
|
430
|
+
* - G52: `pageContext` carries only the allow-listed keys
|
|
431
|
+
* (`ASSISTANT_PAGE_CONTEXT_KEYS`); every other key stays in the browser.
|
|
430
432
|
*/
|
|
431
433
|
export declare function buildPromptRequestBody(args: {
|
|
432
434
|
mode: AssistantMode;
|
|
@@ -4,13 +4,14 @@ import { buildSandboxContextInput as r, executeAssistantGraphQLOnce as i, execut
|
|
|
4
4
|
import { CHECK_AI_CREDITS as o, CREATE_SANDBOX as s, EXTEND_MY_ASSISTANT_SANDBOX_TTL as c, EXTEND_SANDBOX_TTL as l, GET_ACTIVE_SANDBOXES as u, GET_SANDBOX as d, PROVISION_ASSISTANT_SANDBOX as f, PROXY_SANDBOX_REQUEST as p, REPORT_AI_TOKEN_USAGE as ee, STOP_ASSISTANT_SANDBOX as te, STOP_MY_ASSISTANT_SANDBOX as ne, WAIT_FOR_SANDBOX_RUNNING as re } from "./operations.js";
|
|
5
5
|
import { ASSISTANT_API_AUTH_STRATEGY as ie, getImageForMode as m, getImageTagForMode as ae, getResourcesForMode as oe, resolveSandboxAssistantMode as h } from "./images.js";
|
|
6
6
|
import { STREAM_MINT_BACKOFF_ERROR_MS as g, STREAM_MINT_BACKOFF_UNAVAILABLE_MS as _, backOffStreamMint as v, clearStreamMintBackoff as se, getCapability as y, isMissingGatewayFieldError as b, isUnknownFieldError as ce, markSupported as x, markUnsupported as S, streamMintBackedOff as le } from "./capabilities.js";
|
|
7
|
+
import { filterAssistantPageContext as ue } from "./pageContextKeys.js";
|
|
7
8
|
import { useAssistantStore as C } from "./store.js";
|
|
8
|
-
import { REQUEST_TOO_LARGE_REFUSAL as
|
|
9
|
+
import { REQUEST_TOO_LARGE_REFUSAL as de } from "./gatewayLimits.js";
|
|
9
10
|
//#region src/shared/assistant/api.ts
|
|
10
|
-
function
|
|
11
|
+
function fe(e) {
|
|
11
12
|
return e === "assistant" || e === "api-calls";
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
+
function w(e, t, n, i, a, o, s) {
|
|
14
15
|
return {
|
|
15
16
|
query: p,
|
|
16
17
|
operationName: "ProxySandboxRequest",
|
|
@@ -20,16 +21,16 @@ function T(e, t, n, i, a, o, s) {
|
|
|
20
21
|
method: i,
|
|
21
22
|
body: a,
|
|
22
23
|
context: r(t, s),
|
|
23
|
-
...
|
|
24
|
+
...fe(o) ? {
|
|
24
25
|
forwardedAuthToken: s?.accessToken ?? void 0,
|
|
25
26
|
forwardedWorkspaceToken: s?.workspaceToken ?? void 0
|
|
26
27
|
} : {}
|
|
27
28
|
} }
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
|
-
async function
|
|
31
|
+
async function T(t, n, r, i, o, s, c) {
|
|
31
32
|
let l = (await a({
|
|
32
|
-
...
|
|
33
|
+
...w(t, n, r, i, o, s, c),
|
|
33
34
|
workspaceId: n,
|
|
34
35
|
authContext: c
|
|
35
36
|
})).proxySandboxRequest;
|
|
@@ -39,9 +40,9 @@ async function E(t, n, r, i, o, s, c) {
|
|
|
39
40
|
}
|
|
40
41
|
return l.body;
|
|
41
42
|
}
|
|
42
|
-
async function
|
|
43
|
+
async function E(e, t, n, r, a, o, s) {
|
|
43
44
|
let c = (await i({
|
|
44
|
-
...
|
|
45
|
+
...w(e, t, n, r, a, o, s),
|
|
45
46
|
workspaceId: t,
|
|
46
47
|
authContext: s
|
|
47
48
|
})).proxySandboxRequest;
|
|
@@ -51,10 +52,10 @@ async function D(e, t, n, r, a, o, s) {
|
|
|
51
52
|
body: "body" in c ? c.body ?? null : null
|
|
52
53
|
};
|
|
53
54
|
}
|
|
54
|
-
async function
|
|
55
|
-
return (await
|
|
55
|
+
async function pe(e, t, n, r, i, a = /* @__PURE__ */ new Set(), o = "legacy") {
|
|
56
|
+
return (await D(e, t, n, r, i, a, o))?.id ?? null;
|
|
56
57
|
}
|
|
57
|
-
async function
|
|
58
|
+
async function D(e, t, n, i, o, s = /* @__PURE__ */ new Set(), c = "legacy") {
|
|
58
59
|
let l = (await a({
|
|
59
60
|
query: u,
|
|
60
61
|
operationName: "GetActiveSandboxes",
|
|
@@ -62,33 +63,33 @@ async function O(e, t, n, i, o, s = /* @__PURE__ */ new Set(), c = "legacy") {
|
|
|
62
63
|
workspaceId: e,
|
|
63
64
|
authContext: o
|
|
64
65
|
})).getActiveSandboxes ?? [];
|
|
65
|
-
|
|
66
|
-
let d =
|
|
66
|
+
L(l);
|
|
67
|
+
let d = k(l, t, n, i, o, s, B(c));
|
|
67
68
|
return d ? {
|
|
68
69
|
id: d,
|
|
69
|
-
status:
|
|
70
|
+
status: O(l, d)
|
|
70
71
|
} : null;
|
|
71
72
|
}
|
|
72
|
-
function
|
|
73
|
+
function O(e, t) {
|
|
73
74
|
return e.find((e) => e.id === t)?.status ?? "UNKNOWN";
|
|
74
75
|
}
|
|
75
|
-
function
|
|
76
|
-
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 && (!
|
|
76
|
+
function k(e, t, n, r, i, a = /* @__PURE__ */ new Set(), o = "legacy") {
|
|
77
|
+
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 && (!N(n) || M(e.metadata, o)) && A(e, n, o))?.id ?? null;
|
|
77
78
|
}
|
|
78
|
-
function
|
|
79
|
-
return t !== "assistant" || n !== "proposal-v1" ? !0 :
|
|
79
|
+
function A(e, t, n) {
|
|
80
|
+
return t !== "assistant" || n !== "proposal-v1" ? !0 : I(e);
|
|
80
81
|
}
|
|
81
|
-
function
|
|
82
|
+
function j(e) {
|
|
82
83
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
83
84
|
}
|
|
84
|
-
function
|
|
85
|
+
function M(e, t) {
|
|
85
86
|
let n = e?.assistantAuth;
|
|
86
|
-
return
|
|
87
|
+
return j(n) && n.accessProfile === "member" ? !0 : (e?.writeApproval ?? "legacy") === t ? e?.confirmWrites === (t === "proposal-v1" ? "proposal-v1" : !0) : !1;
|
|
87
88
|
}
|
|
88
|
-
function
|
|
89
|
+
function N(e) {
|
|
89
90
|
return e === "api-calls";
|
|
90
91
|
}
|
|
91
|
-
function
|
|
92
|
+
function P(e, t, n, r) {
|
|
92
93
|
let i = [
|
|
93
94
|
{
|
|
94
95
|
name: "AI_ASSISTANT_MODE",
|
|
@@ -116,41 +117,41 @@ function F(e, t, n, r) {
|
|
|
116
117
|
}), r.workspaceToken && i.push({
|
|
117
118
|
name: "WORKSPACE_AUTH_TOKEN",
|
|
118
119
|
value: r.workspaceToken
|
|
119
|
-
})),
|
|
120
|
+
})), N(t) && i.push({
|
|
120
121
|
name: "AI_ASSISTANT_CONFIRM_WRITES",
|
|
121
122
|
value: "1"
|
|
122
123
|
}), i;
|
|
123
124
|
}
|
|
124
|
-
var
|
|
125
|
+
var me = "assistant.errors.assistantProvisioningUnavailable", he = "provisionAssistantSandbox", ge = [
|
|
125
126
|
"ProvisionAssistantSandboxInput",
|
|
126
127
|
"SandboxAssistantMode",
|
|
127
128
|
"SandboxAssistantWriteApproval"
|
|
128
|
-
],
|
|
129
|
-
function
|
|
129
|
+
], F = /* @__PURE__ */ new Set();
|
|
130
|
+
function I(e) {
|
|
130
131
|
let t = e.metadata?.assistantAuth;
|
|
131
|
-
return
|
|
132
|
+
return j(t) && t.provisionedVia === he;
|
|
133
|
+
}
|
|
134
|
+
function L(e) {
|
|
135
|
+
for (let t of e) I(t) && F.add(t.id);
|
|
132
136
|
}
|
|
133
137
|
function R(e) {
|
|
134
|
-
|
|
138
|
+
return F.has(e);
|
|
135
139
|
}
|
|
136
|
-
function z(e) {
|
|
137
|
-
return
|
|
140
|
+
function z(e, t) {
|
|
141
|
+
return q(t) === "proposal-v1" && (e === "assistant" || e === "api-calls") && y("provisionAssistantSandbox") !== "unsupported";
|
|
138
142
|
}
|
|
139
|
-
function B(e
|
|
140
|
-
return
|
|
143
|
+
function B(e) {
|
|
144
|
+
return q(e) === "proposal-v1" && y("provisionAssistantSandbox") !== "unsupported" ? "proposal-v1" : "legacy";
|
|
141
145
|
}
|
|
142
146
|
function V(e) {
|
|
143
|
-
return
|
|
144
|
-
}
|
|
145
|
-
function H(e) {
|
|
146
|
-
return n(e).some((e) => e.i18nKey === fe || e.code === "SERVICE_UNAVAILABLE");
|
|
147
|
+
return n(e).some((e) => e.i18nKey === me || e.code === "SERVICE_UNAVAILABLE");
|
|
147
148
|
}
|
|
148
|
-
function
|
|
149
|
+
function H(e, t) {
|
|
149
150
|
if (t <= 600) return !1;
|
|
150
151
|
let n = e instanceof Error ? e.message.toLowerCase() : String(e);
|
|
151
152
|
return n.includes("ttl") || n.includes("validation") || n.includes("maximum");
|
|
152
153
|
}
|
|
153
|
-
function
|
|
154
|
+
function U(e, t, n, i, a, o) {
|
|
154
155
|
if (t !== "assistant" && t !== "api-calls") throw Error(`Mode ${t} is not provisioned through the assistant path`);
|
|
155
156
|
return {
|
|
156
157
|
mode: t === "assistant" ? "ASSISTANT" : "API_CALLS",
|
|
@@ -175,40 +176,40 @@ function W(e, t, n, i, a, o) {
|
|
|
175
176
|
context: r(n, o)
|
|
176
177
|
};
|
|
177
178
|
}
|
|
178
|
-
async function
|
|
179
|
+
async function W(e, t, n, r, i, o) {
|
|
179
180
|
let s = (await a({
|
|
180
181
|
query: f,
|
|
181
182
|
operationName: "ProvisionAssistantSandbox",
|
|
182
|
-
variables: { input:
|
|
183
|
+
variables: { input: U(e, t, n, r, i, o) },
|
|
183
184
|
workspaceId: n,
|
|
184
185
|
authContext: o
|
|
185
186
|
}))?.provisionAssistantSandbox?.id;
|
|
186
187
|
if (!s) throw Error("provisionAssistantSandbox returned empty response");
|
|
187
188
|
return s;
|
|
188
189
|
}
|
|
189
|
-
async function
|
|
190
|
+
async function _e(e, t, n, r, i, a) {
|
|
190
191
|
try {
|
|
191
|
-
return await
|
|
192
|
+
return await W(e, t, n, r, i, a);
|
|
192
193
|
} catch (o) {
|
|
193
|
-
if (
|
|
194
|
-
return
|
|
194
|
+
if (V(o) || G(o) || !H(o, i)) throw o;
|
|
195
|
+
return W(e, t, n, r, 600, a);
|
|
195
196
|
}
|
|
196
197
|
}
|
|
197
|
-
function
|
|
198
|
-
return b(e, "provisionAssistantSandbox",
|
|
198
|
+
function G(e) {
|
|
199
|
+
return b(e, "provisionAssistantSandbox", ge);
|
|
199
200
|
}
|
|
200
|
-
async function
|
|
201
|
-
if (
|
|
202
|
-
let o = await
|
|
203
|
-
return x("provisionAssistantSandbox"),
|
|
201
|
+
async function ve(e, t, n, r, i, a, o = {}) {
|
|
202
|
+
if (z(t, o.writeApproval)) try {
|
|
203
|
+
let o = await _e(e, t, n, r, i, a);
|
|
204
|
+
return x("provisionAssistantSandbox"), F.add(o), o;
|
|
204
205
|
} catch (e) {
|
|
205
|
-
if (!
|
|
206
|
+
if (!G(e)) throw e;
|
|
206
207
|
S("provisionAssistantSandbox");
|
|
207
208
|
}
|
|
208
|
-
return
|
|
209
|
+
return ye(e, t, n, r, i, a);
|
|
209
210
|
}
|
|
210
|
-
async function
|
|
211
|
-
let l = oe(t), u =
|
|
211
|
+
async function ye(e, t, n, i, o, c) {
|
|
212
|
+
let l = oe(t), u = P(e, t, n, c), d = (a) => ({
|
|
212
213
|
name: `ai-assistant-${t}-${Date.now()}`,
|
|
213
214
|
description: `AI Assistant sandbox (${t} mode)`,
|
|
214
215
|
template: "AI_BUILDER",
|
|
@@ -231,7 +232,7 @@ async function _e(e, t, n, i, o, c) {
|
|
|
231
232
|
assistantOrganizationId: c.organizationId ?? null,
|
|
232
233
|
authStrategy: ie,
|
|
233
234
|
imageTag: ae(t, i),
|
|
234
|
-
confirmWrites:
|
|
235
|
+
confirmWrites: N(t)
|
|
235
236
|
},
|
|
236
237
|
context: r(n, c)
|
|
237
238
|
}), f = (e) => a({
|
|
@@ -244,13 +245,13 @@ async function _e(e, t, n, i, o, c) {
|
|
|
244
245
|
try {
|
|
245
246
|
p = await f(o);
|
|
246
247
|
} catch (e) {
|
|
247
|
-
if (
|
|
248
|
+
if (H(e, o)) p = await f(600);
|
|
248
249
|
else throw e;
|
|
249
250
|
}
|
|
250
251
|
if (!p?.createSandbox?.id) throw Error("createSandbox returned empty response");
|
|
251
252
|
return p.createSandbox.id;
|
|
252
253
|
}
|
|
253
|
-
async function
|
|
254
|
+
async function be(e, t, n) {
|
|
254
255
|
return (await a({
|
|
255
256
|
query: d,
|
|
256
257
|
operationName: "GetSandbox",
|
|
@@ -262,10 +263,10 @@ async function ve(e, t, n) {
|
|
|
262
263
|
authContext: n
|
|
263
264
|
})).getSandbox;
|
|
264
265
|
}
|
|
265
|
-
function
|
|
266
|
+
function K(e, t) {
|
|
266
267
|
if (e === "FAILED" || e === "STOPPED" || e === "EXPIRED") throw Error(t ? `Sandbox ${e.toLowerCase()}: ${t}` : `Sandbox ${e.toLowerCase()}`);
|
|
267
268
|
}
|
|
268
|
-
async function
|
|
269
|
+
async function xe(e, t, n, i = 3e5) {
|
|
269
270
|
let o = Date.now();
|
|
270
271
|
if (y("waitForSandboxRunning") !== "unsupported") for (; Date.now() - o < i;) try {
|
|
271
272
|
let i = await a({
|
|
@@ -282,7 +283,7 @@ async function ye(e, t, n, i = 3e5) {
|
|
|
282
283
|
x("waitForSandboxRunning");
|
|
283
284
|
let o = i.waitForSandboxRunning;
|
|
284
285
|
if (o?.status === "RUNNING") return;
|
|
285
|
-
|
|
286
|
+
K(o?.status, o?.errorMessage);
|
|
286
287
|
} catch (e) {
|
|
287
288
|
if (ce(e)) {
|
|
288
289
|
S("waitForSandboxRunning");
|
|
@@ -291,18 +292,18 @@ async function ye(e, t, n, i = 3e5) {
|
|
|
291
292
|
throw e;
|
|
292
293
|
}
|
|
293
294
|
for (; Date.now() - o < i;) {
|
|
294
|
-
let r = await
|
|
295
|
+
let r = await be(e, t, n);
|
|
295
296
|
if (r?.status === "RUNNING") return;
|
|
296
|
-
|
|
297
|
+
K(r?.status, r?.errorMessage), await new Promise((e) => setTimeout(e, 2e3));
|
|
297
298
|
}
|
|
298
299
|
throw Error("Sandbox startup timed out");
|
|
299
300
|
}
|
|
300
|
-
async function
|
|
301
|
+
async function Se(e, t, n, r, i = 9e4, a) {
|
|
301
302
|
let o = Date.now();
|
|
302
303
|
for (; Date.now() - o < i;) {
|
|
303
304
|
try {
|
|
304
|
-
let i = await
|
|
305
|
-
return C.getState().setSandboxWriteCapabilities(e,
|
|
305
|
+
let i = await T(e, t, "/health", "GET", void 0, n, r);
|
|
306
|
+
return C.getState().setSandboxWriteCapabilities(e, Y(i)), i;
|
|
306
307
|
} catch (e) {
|
|
307
308
|
let t = e instanceof Error ? e.message : String(e);
|
|
308
309
|
if (!/proxy error: 502|proxy error: 503|proxy error: 404|service not available|starting/i.test(t)) throw e;
|
|
@@ -312,53 +313,53 @@ async function be(e, t, n, r, i = 9e4, a) {
|
|
|
312
313
|
}
|
|
313
314
|
throw Error("Assistant service did not become healthy before timeout");
|
|
314
315
|
}
|
|
315
|
-
function
|
|
316
|
+
function q(e) {
|
|
316
317
|
return e === "proposal-v1" ? "proposal-v1" : "legacy";
|
|
317
318
|
}
|
|
318
|
-
function
|
|
319
|
+
function J(e, t) {
|
|
319
320
|
return e === "enabled" || e === void 0 && !t ? "enabled" : "fenced";
|
|
320
321
|
}
|
|
321
|
-
var
|
|
322
|
+
var Ce = new Set([
|
|
322
323
|
"relay",
|
|
323
324
|
"delegated",
|
|
324
325
|
"direct",
|
|
325
326
|
"unconfigured"
|
|
326
327
|
]);
|
|
327
|
-
function
|
|
328
|
+
function Y(e) {
|
|
328
329
|
let t = typeof e == "object" && e && !Array.isArray(e) ? e.capabilities : void 0, n = typeof t == "object" && t && !Array.isArray(t) ? t : {}, r = n.writeProposals !== void 0 || n.writeApprovalMode !== void 0 || n.writeExecution !== void 0, i = n.writeRiskVersion, a = n.sessionCredentials;
|
|
329
330
|
return {
|
|
330
331
|
proposals: n.writeProposals === "v1",
|
|
331
|
-
writeApprovalMode:
|
|
332
|
-
writeExecution:
|
|
332
|
+
writeApprovalMode: q(n.writeApprovalMode),
|
|
333
|
+
writeExecution: J(n.writeExecution, r),
|
|
333
334
|
replyApproval: "off",
|
|
334
335
|
...typeof i == "string" && i ? { writeRiskVersion: i } : {},
|
|
335
|
-
...typeof a == "string" &&
|
|
336
|
+
...typeof a == "string" && Ce.has(a) ? { sessionCredentials: a } : {},
|
|
336
337
|
...n.uiOffers === 1 ? { uiOffers: !0 } : {}
|
|
337
338
|
};
|
|
338
339
|
}
|
|
339
|
-
async function
|
|
340
|
+
async function we(e, t, n, r) {
|
|
340
341
|
let i;
|
|
341
342
|
try {
|
|
342
|
-
i = await
|
|
343
|
+
i = await E(e, t, "/health", "GET", void 0, n, r);
|
|
343
344
|
} catch {
|
|
344
345
|
return null;
|
|
345
346
|
}
|
|
346
347
|
let a = i.body;
|
|
347
348
|
if (i.status < 200 || i.status >= 300 || typeof a != "object" || !a || Array.isArray(a)) return null;
|
|
348
|
-
let o =
|
|
349
|
+
let o = Y(a);
|
|
349
350
|
return C.getState().setSandboxWriteCapabilities(e, o), o;
|
|
350
351
|
}
|
|
351
|
-
async function
|
|
352
|
-
return { sessionId: (await
|
|
352
|
+
async function Te(e, t, n, r) {
|
|
353
|
+
return { sessionId: (await T(e, t, "/sessions", "POST", { mode: n }, n, r)).session.id };
|
|
353
354
|
}
|
|
354
|
-
async function
|
|
355
|
-
let a = await
|
|
355
|
+
async function Ee(e, t, n, r, i) {
|
|
356
|
+
let a = await T(e, t, `/write-confirmations/${encodeURIComponent(n)}/approve`, "POST", {}, r, i);
|
|
356
357
|
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.");
|
|
357
358
|
}
|
|
358
|
-
function
|
|
359
|
-
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 && (!
|
|
359
|
+
function X(e, t, n, r, i, a = /* @__PURE__ */ new Set(), o = "legacy") {
|
|
360
|
+
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 && (!N(n) || M(e.metadata, o)) && A(e, n, o))).map((e) => e.id) : [];
|
|
360
361
|
}
|
|
361
|
-
async function
|
|
362
|
+
async function De(e, t, n, i, o, s = /* @__PURE__ */ new Set(), c = "legacy") {
|
|
362
363
|
let l, d = /* @__PURE__ */ new Set();
|
|
363
364
|
try {
|
|
364
365
|
let f = (await a({
|
|
@@ -368,9 +369,9 @@ async function Te(e, t, n, i, o, s = /* @__PURE__ */ new Set(), c = "legacy") {
|
|
|
368
369
|
workspaceId: e,
|
|
369
370
|
authContext: o
|
|
370
371
|
})).getActiveSandboxes ?? [];
|
|
371
|
-
|
|
372
|
-
let p =
|
|
373
|
-
if (l =
|
|
372
|
+
L(f);
|
|
373
|
+
let p = B(c);
|
|
374
|
+
if (l = X(f, t, n, i, o, s, p), p === "proposal-v1") {
|
|
374
375
|
let e = new Set(l);
|
|
375
376
|
for (let t of f) {
|
|
376
377
|
let n = h(t);
|
|
@@ -382,14 +383,14 @@ async function Te(e, t, n, i, o, s = /* @__PURE__ */ new Set(), c = "legacy") {
|
|
|
382
383
|
}
|
|
383
384
|
return (await Promise.all(l.map(async (t) => {
|
|
384
385
|
try {
|
|
385
|
-
return await
|
|
386
|
+
return await Z(t, e, o, { ownerScoped: d.has(t) }), t;
|
|
386
387
|
} catch {
|
|
387
388
|
return null;
|
|
388
389
|
}
|
|
389
390
|
}))).filter((e) => e !== null);
|
|
390
391
|
}
|
|
391
|
-
async function
|
|
392
|
-
if ((i.ownerScoped === !0 ||
|
|
392
|
+
async function Z(e, t, n, i = {}) {
|
|
393
|
+
if ((i.ownerScoped === !0 || R(e)) && y("stopMyAssistantSandbox") !== "unsupported") try {
|
|
393
394
|
await a({
|
|
394
395
|
query: ne,
|
|
395
396
|
operationName: "StopMyAssistantSandbox",
|
|
@@ -416,46 +417,46 @@ async function Q(e, t, n, i = {}) {
|
|
|
416
417
|
authContext: n
|
|
417
418
|
});
|
|
418
419
|
}
|
|
419
|
-
var
|
|
420
|
+
var Q = /^[A-Za-z0-9_-]{1,128}$/, Oe = new Set([
|
|
420
421
|
"affirm",
|
|
421
422
|
"decline",
|
|
422
423
|
"other"
|
|
423
|
-
]),
|
|
424
|
+
]), ke = new Set([
|
|
424
425
|
"typed",
|
|
425
426
|
"spoken",
|
|
426
427
|
"chip",
|
|
427
428
|
"host_queued",
|
|
428
429
|
"retry",
|
|
429
430
|
"proposal_result"
|
|
430
|
-
]),
|
|
431
|
-
function
|
|
432
|
-
return !e || !
|
|
431
|
+
]), Ae = /^wp_[0-9a-f]{32}$/;
|
|
432
|
+
function je(e) {
|
|
433
|
+
return !e || !Oe.has(e.kind) || !ke.has(e.origin) ? null : e.proposalId === void 0 ? {
|
|
433
434
|
kind: e.kind,
|
|
434
435
|
origin: e.origin
|
|
435
|
-
} :
|
|
436
|
+
} : Ae.test(e.proposalId) ? {
|
|
436
437
|
kind: e.kind,
|
|
437
438
|
origin: e.origin,
|
|
438
439
|
proposalId: e.proposalId
|
|
439
440
|
} : null;
|
|
440
441
|
}
|
|
441
442
|
function $(e) {
|
|
442
|
-
let { mode: t, prompt: n,
|
|
443
|
+
let { mode: t, prompt: n, parts: r } = e, i = {
|
|
443
444
|
mode: t,
|
|
444
445
|
prompt: n,
|
|
445
|
-
pageContext:
|
|
446
|
+
pageContext: ue(e.pageContext)
|
|
446
447
|
};
|
|
447
|
-
|
|
448
|
-
let
|
|
449
|
-
return
|
|
450
|
-
}
|
|
451
|
-
function je(e) {
|
|
452
|
-
return T(e.sandboxId, e.workspaceId, `/sessions/${e.sessionId}/prompt-async`, "POST", $(e), e.mode, e.authContext);
|
|
448
|
+
r && r.length > 0 && (i.parts = r), typeof e.conversationId == "string" && Q.test(e.conversationId) && (i.conversationId = e.conversationId);
|
|
449
|
+
let a = je(e.writeReply);
|
|
450
|
+
return a && (i.writeReply = a), e.uiCatalogue && (i.uiCatalogue = e.uiCatalogue), i;
|
|
453
451
|
}
|
|
454
452
|
function Me(e) {
|
|
455
|
-
return
|
|
453
|
+
return w(e.sandboxId, e.workspaceId, `/sessions/${e.sessionId}/prompt-async`, "POST", $(e), e.mode, e.authContext);
|
|
456
454
|
}
|
|
457
|
-
|
|
458
|
-
|
|
455
|
+
function Ne(e) {
|
|
456
|
+
return new TextEncoder().encode(JSON.stringify(Me(e))).byteLength;
|
|
457
|
+
}
|
|
458
|
+
async function Pe(e, t, n, r, i, a, o, s) {
|
|
459
|
+
if (Ne({
|
|
459
460
|
sandboxId: e,
|
|
460
461
|
workspaceId: t,
|
|
461
462
|
sessionId: n,
|
|
@@ -467,8 +468,8 @@ async function Ne(e, t, n, r, i, a, o, s) {
|
|
|
467
468
|
conversationId: s?.conversationId,
|
|
468
469
|
writeReply: s?.writeReply,
|
|
469
470
|
uiCatalogue: s?.uiCatalogue
|
|
470
|
-
}) > 262144) throw Error(
|
|
471
|
-
let c = await
|
|
471
|
+
}) > 262144) throw Error(de);
|
|
472
|
+
let c = await T(e, t, `/sessions/${n}/prompt-async`, "POST", $({
|
|
472
473
|
mode: i,
|
|
473
474
|
prompt: r,
|
|
474
475
|
pageContext: a,
|
|
@@ -479,10 +480,10 @@ async function Ne(e, t, n, r, i, a, o, s) {
|
|
|
479
480
|
}), i, o);
|
|
480
481
|
return { messageID: typeof c.messageID == "string" ? c.messageID : void 0 };
|
|
481
482
|
}
|
|
482
|
-
async function
|
|
483
|
+
async function Fe(e, n, r, i, a, o) {
|
|
483
484
|
let s = `/sessions/${r}/messages?limit=${o?.limit ?? 50}`;
|
|
484
485
|
o?.sinceMs && y("sinceParam") !== "unsupported" && (s += `&since=${o.sinceMs}`);
|
|
485
|
-
let c = await
|
|
486
|
+
let c = await T(e, n, s, "GET", void 0, i, a);
|
|
486
487
|
if (typeof c.now == "number" && x("sinceParam"), o?.surfaceUiOffers) try {
|
|
487
488
|
o.surfaceUiOffers(c.uiOffers, typeof c.now == "number" ? c.now : NaN);
|
|
488
489
|
} catch {}
|
|
@@ -492,10 +493,10 @@ async function Pe(e, n, r, i, a, o) {
|
|
|
492
493
|
}
|
|
493
494
|
return c.messages ?? [];
|
|
494
495
|
}
|
|
495
|
-
async function
|
|
496
|
+
async function Ie(e, t, n, r, i) {
|
|
496
497
|
if (y("sse") === "unsupported") return null;
|
|
497
498
|
try {
|
|
498
|
-
let a = await
|
|
499
|
+
let a = await T(e, t, `/sessions/${n}/stream-url`, "GET", void 0, r, i);
|
|
499
500
|
return typeof a.url == "string" && typeof a.expiresAt == "number" ? (x("sse"), {
|
|
500
501
|
url: a.url,
|
|
501
502
|
expiresAt: a.expiresAt
|
|
@@ -504,13 +505,13 @@ async function Fe(e, t, n, r, i) {
|
|
|
504
505
|
return S("sse"), null;
|
|
505
506
|
}
|
|
506
507
|
}
|
|
507
|
-
async function
|
|
508
|
+
async function Le(e, t, n, r, i, a = Date.now) {
|
|
508
509
|
if (le(a())) return null;
|
|
509
510
|
try {
|
|
510
|
-
let { status: o, body: s } = await
|
|
511
|
+
let { status: o, body: s } = await E(e, t, `/sessions/${n}/stream-url`, "GET", void 0, r, i);
|
|
511
512
|
if (o === 404) return v(_, a()), null;
|
|
512
513
|
let c = o >= 200 && o < 300 && typeof s == "object" && s ? s : null;
|
|
513
|
-
return c && c.transport === "relay" && typeof c.url == "string" && typeof c.expiresAt == "number" &&
|
|
514
|
+
return c && c.transport === "relay" && typeof c.url == "string" && typeof c.expiresAt == "number" && Re(c.url) ? (se(), {
|
|
514
515
|
url: c.url,
|
|
515
516
|
expiresAt: c.expiresAt
|
|
516
517
|
}) : (v(c ? _ : g, a()), null);
|
|
@@ -518,7 +519,7 @@ async function Ie(e, t, n, r, i, a = Date.now) {
|
|
|
518
519
|
return v(g, a()), null;
|
|
519
520
|
}
|
|
520
521
|
}
|
|
521
|
-
function
|
|
522
|
+
function Re(e) {
|
|
522
523
|
try {
|
|
523
524
|
let { protocol: t } = new URL(e);
|
|
524
525
|
return t === "https:" || t === "http:";
|
|
@@ -526,8 +527,8 @@ function Le(e) {
|
|
|
526
527
|
return !1;
|
|
527
528
|
}
|
|
528
529
|
}
|
|
529
|
-
async function
|
|
530
|
-
if (
|
|
530
|
+
async function ze(e, t, n, i) {
|
|
531
|
+
if (R(e) && y("extendMyAssistantSandboxTTL") !== "unsupported") try {
|
|
531
532
|
await a({
|
|
532
533
|
query: c,
|
|
533
534
|
operationName: "ExtendMyAssistantSandboxTtl",
|
|
@@ -556,28 +557,28 @@ async function Re(e, t, n, i) {
|
|
|
556
557
|
authContext: i
|
|
557
558
|
});
|
|
558
559
|
}
|
|
559
|
-
async function ze(e, t, n, r, i) {
|
|
560
|
-
await E(e, t, `/sessions/${n}/heartbeat`, "POST", void 0, r, i).catch(() => void 0);
|
|
561
|
-
}
|
|
562
560
|
async function Be(e, t, n, r, i) {
|
|
561
|
+
await T(e, t, `/sessions/${n}/heartbeat`, "POST", void 0, r, i).catch(() => void 0);
|
|
562
|
+
}
|
|
563
|
+
async function Ve(e, t, n, r, i) {
|
|
563
564
|
try {
|
|
564
|
-
return (await
|
|
565
|
+
return (await T(e, t, `/sessions/${n}/abort`, "POST", void 0, r, i))?.aborted === !0;
|
|
565
566
|
} catch {
|
|
566
567
|
return !1;
|
|
567
568
|
}
|
|
568
569
|
}
|
|
569
|
-
async function Ve(e, t, n, r, i) {
|
|
570
|
-
return ((await E(e, t, `/sessions/${n}/artifacts`, "GET", void 0, r, i)).artifacts ?? []).filter((e) => !e.name.startsWith("."));
|
|
571
|
-
}
|
|
572
570
|
async function He(e, t, n, r, i) {
|
|
573
|
-
|
|
571
|
+
return ((await T(e, t, `/sessions/${n}/artifacts`, "GET", void 0, r, i)).artifacts ?? []).filter((e) => !e.name.startsWith("."));
|
|
572
|
+
}
|
|
573
|
+
async function Ue(e, t, n, r, i) {
|
|
574
|
+
let a = await T(e, t, `/sessions/${n}`, "GET", void 0, r, i);
|
|
574
575
|
return {
|
|
575
576
|
id: a.session?.id ?? n,
|
|
576
577
|
mode: a.mode ?? "unknown"
|
|
577
578
|
};
|
|
578
579
|
}
|
|
579
|
-
async function
|
|
580
|
-
let o = (await
|
|
580
|
+
async function We(e, t, n, r, i, a) {
|
|
581
|
+
let o = (await T(e, t, `/sessions/${n}/artifacts/download?path=${encodeURIComponent(r)}`, "GET", void 0, i, a)).artifact;
|
|
581
582
|
if (!o) throw Error("Artifact download returned an empty response");
|
|
582
583
|
return {
|
|
583
584
|
filename: o.filename,
|
|
@@ -585,7 +586,7 @@ async function Ue(e, t, n, r, i, a) {
|
|
|
585
586
|
contentBase64: o.contentBase64
|
|
586
587
|
};
|
|
587
588
|
}
|
|
588
|
-
async function
|
|
589
|
+
async function Ge(e, t) {
|
|
589
590
|
return (await a({
|
|
590
591
|
query: o,
|
|
591
592
|
operationName: "CheckAiCredits",
|
|
@@ -594,7 +595,7 @@ async function We(e, t) {
|
|
|
594
595
|
authContext: t
|
|
595
596
|
})).checkAiCredits;
|
|
596
597
|
}
|
|
597
|
-
async function
|
|
598
|
+
async function Ke(e, t, n, r, o, s) {
|
|
598
599
|
let c = Math.max(0, Math.round(o.input ?? 0)), l = Math.max(0, Math.round(o.output ?? 0)), u = Math.max(0, Math.round(o.cache?.read ?? 0)), d = Math.max(0, Math.round(o.cache?.write ?? 0));
|
|
599
600
|
if (c + l + u + d === 0 || !r) return;
|
|
600
601
|
let f = !1;
|
|
@@ -626,4 +627,4 @@ async function Ge(e, t, n, r, o, s) {
|
|
|
626
627
|
});
|
|
627
628
|
}
|
|
628
629
|
//#endregion
|
|
629
|
-
export {
|
|
630
|
+
export { Q as PROMPT_CONVERSATION_ID_PATTERN, Ve as abortAssistantTurn, Ee as approvePendingWrite, A as askReuseMatchesProvisioning, P as buildAssistantSandboxEnv, Me as buildPromptGatewayRequest, $ as buildPromptRequestBody, U as buildProvisionAssistantSandboxInput, Ge as checkAssistantAiCredits, ve as createAssistantSandbox, Te as createAssistantSession, We as downloadAssistantArtifact, ze as extendAssistantSandboxTTL, pe as findExistingSandbox, D as findExistingSandboxWithStatus, fe as forwardsUserTokensToSandbox, He as getAssistantArtifacts, Fe as getAssistantMessages, Ue as getAssistantSession, Ie as getAssistantStreamAccess, V as isAssistantProvisioningUnavailable, R as isDedicatedAssistantSandbox, I as isDedicatedAssistantSandboxRow, Le as mintAssistantTurnStream, N as modeRequiresConfirmWrites, Ne as promptGatewayRequestBytes, E as proxySandboxRaw, Y as readSandboxWriteCapabilities, we as readSandboxWriteCapabilitiesOnce, De as releaseSupersededAssistantSandboxes, Ke as reportAssistantAiTokenUsage, O as sandboxStatusOf, k as selectExistingAssistantSandbox, X as selectSupersededAssistantSandboxes, Pe as sendAssistantPromptAsync, Be as sendHeartbeat, Z as stopReapedAssistantSandbox, z as usesDedicatedAssistantProvisioning, Se as waitForAssistantServiceReady, xe as waitForSandboxRunning, q as writeApprovalModeOf, M as writeApprovalReuseMatches, J as writeExecutionOf };
|
|
@@ -36,6 +36,7 @@ export * from './gatewayClient';
|
|
|
36
36
|
export * from './progress';
|
|
37
37
|
export * from './streamBudget';
|
|
38
38
|
export * from './api';
|
|
39
|
+
export * from './pageContextKeys';
|
|
39
40
|
export * from './types';
|
|
40
41
|
export * from './voice/turnVisibility';
|
|
41
42
|
export * from './speech/types';
|