@burdenoff/fe-libs 2026.904.20 → 2026.904.21
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/aiCredits.d.ts +21 -0
- package/dist/shared/assistant/aiCredits.d.ts.map +1 -0
- package/dist/shared/assistant/aiCredits.js +15 -0
- package/dist/shared/assistant/createSandboxAssistantTransport.js +2 -1
- package/dist/shared/assistant/gatewayClient.d.ts +15 -1
- package/dist/shared/assistant/gatewayClient.d.ts.map +1 -1
- package/dist/shared/assistant/gatewayClient.js +6 -11
- package/dist/shared/assistant/index.d.ts +3 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/quota.d.ts +65 -0
- package/dist/shared/assistant/quota.d.ts.map +1 -0
- package/dist/shared/assistant/quota.js +45 -0
- package/dist/shared/assistant/useWorkspaceWriteAccess.d.ts +29 -0
- package/dist/shared/assistant/useWorkspaceWriteAccess.d.ts.map +1 -0
- package/dist/shared/assistant/useWorkspaceWriteAccess.js +41 -0
- package/dist/shared-assistant.js +81 -78
- package/package.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { QuotaKind } from './quota';
|
|
2
|
+
/**
|
|
3
|
+
* Fired after a successful AI-token charge so a live credits meter could refetch
|
|
4
|
+
* its balance.
|
|
5
|
+
*
|
|
6
|
+
* ★ Namespaced by product, like the quota event. Nothing listens for it in any
|
|
7
|
+
* product today — verified across the repo — because no product mounts a meter.
|
|
8
|
+
* The dispatch is kept as the cheap half of that feature, not as a live path.
|
|
9
|
+
*/
|
|
10
|
+
export declare function aiCreditsUpdatedEventName(product: string): string;
|
|
11
|
+
export declare function notifyAiCreditsUpdated(product: string): void;
|
|
12
|
+
/**
|
|
13
|
+
* Opens a quota dialog for an assistant quota wall.
|
|
14
|
+
*
|
|
15
|
+
* The assistant's prompt and sandbox calls go through a raw fetch rather than an
|
|
16
|
+
* Apollo mutation, so they cannot rely on the Apollo error link that normally
|
|
17
|
+
* dispatches this — they call here directly. `kind` is `ai-credits` for the
|
|
18
|
+
* per-token gate and `sandbox` for the sandbox-environment limit.
|
|
19
|
+
*/
|
|
20
|
+
export declare function dispatchAssistantQuotaExhausted(product: string, kind: QuotaKind): void;
|
|
21
|
+
//# sourceMappingURL=aiCredits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aiCredits.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/aiCredits.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,EACf,MAAM,SAAS,CAAC;AAEjB;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAG5D;AAED;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,GACd,IAAI,CASN"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { quotaExhaustedEventName as e } from "./quota.js";
|
|
2
|
+
//#region src/shared/assistant/aiCredits.ts
|
|
3
|
+
function t(e) {
|
|
4
|
+
return `${e}:ai-credits-updated`;
|
|
5
|
+
}
|
|
6
|
+
function n(e) {
|
|
7
|
+
typeof window > "u" || window.dispatchEvent(new CustomEvent(t(e)));
|
|
8
|
+
}
|
|
9
|
+
function r(t, n) {
|
|
10
|
+
if (typeof window > "u") return;
|
|
11
|
+
let r = { kind: n };
|
|
12
|
+
window.dispatchEvent(new CustomEvent(e(t), { detail: r }));
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { t as aiCreditsUpdatedEventName, r as dispatchAssistantQuotaExhausted, n as notifyAiCreditsUpdated };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { isQuotaExhaustedError as e } from "./
|
|
1
|
+
import { isQuotaExhaustedError as e } from "./quota.js";
|
|
2
|
+
import "./gatewayClient.js";
|
|
2
3
|
import { checkAssistantAiCredits as t, getAssistantMessages as n, getAssistantStreamAccess as r, reportAssistantAiTokenUsage as i, sendAssistantPromptAsync as a, stopReapedAssistantSandbox as o } from "./api.js";
|
|
3
4
|
import { AssistantRuntimeManager as s } from "./runtime.js";
|
|
4
5
|
import { buildProgress as c, isReapedSandboxConnectionError as l, isRecoverable as u, mergeMessagesById as d, sanitize as f } from "./progress.js";
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import { AssistantSandboxAuthContext } from './types';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* ★★ Delegates to `./quota`, which is the canonical classifier.
|
|
4
|
+
*
|
|
5
|
+
* This function used to return true for ANY 429. That conflated two refusals
|
|
6
|
+
* the gateway sends with the same status: `QUOTA_EXHAUSTED` — the workspace has
|
|
7
|
+
* the quota and used it up, so upgrading fixes it — and `QUOTA_NOT_PROVISIONED`,
|
|
8
|
+
* where the workspace has no assignment row at all and nothing the user does
|
|
9
|
+
* helps. BOFF-6302 exists because those two were shown to people with the same
|
|
10
|
+
* words, sending them to buy something that would not have helped.
|
|
11
|
+
*
|
|
12
|
+
* Behaviour is otherwise unchanged: a bare 429 with no code still classifies as
|
|
13
|
+
* exhausted (the raw-fetch transport surfaces those), and an explicit code still
|
|
14
|
+
* wins over the status.
|
|
15
|
+
*/
|
|
16
|
+
export { isQuotaExhaustedError } from './quota';
|
|
3
17
|
export declare function buildSandboxContextInput(workspaceId: string, authContext?: AssistantSandboxAuthContext): Record<string, unknown>;
|
|
4
18
|
export declare function executeSandboxGraphQL<TData>(params: {
|
|
5
19
|
query: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gatewayClient.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/gatewayClient.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAe3D,
|
|
1
|
+
{"version":3,"file":"gatewayClient.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/gatewayClient.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAe3D;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEhD,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,2BAA2B,GACxC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAOzB;AAuCD,wBAAsB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,2BAA2B,CAAC;CAC3C,GAAG,OAAO,CAAC,KAAK,CAAC,CAyBjB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { graphqlFetch as e } from "../graphql/fetch.js";
|
|
2
2
|
import "../../shared-graphql.js";
|
|
3
|
+
import "./quota.js";
|
|
3
4
|
//#region src/shared/assistant/gatewayClient.ts
|
|
4
5
|
function t() {
|
|
5
6
|
try {
|
|
@@ -8,19 +9,13 @@ function t() {
|
|
|
8
9
|
return `bf-assistant-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
|
-
function n(e) {
|
|
12
|
-
let t = e;
|
|
13
|
-
if (t?.statusCode === 429 || t?.extensions?.code === "QUOTA_EXHAUSTED") return !0;
|
|
14
|
-
let n = t instanceof Error ? t.message.toLowerCase() : String(t).toLowerCase();
|
|
15
|
-
return n.includes("quota") && (n.includes("exhaust") || n.includes("exceeded"));
|
|
16
|
-
}
|
|
17
|
-
function r(e, t) {
|
|
12
|
+
function n(e, t) {
|
|
18
13
|
return {
|
|
19
14
|
workspaceId: e,
|
|
20
15
|
...t?.organizationId ? { custom: { organizationId: t.organizationId } } : {}
|
|
21
16
|
};
|
|
22
17
|
}
|
|
23
|
-
async function
|
|
18
|
+
async function r(n) {
|
|
24
19
|
let r = await e({
|
|
25
20
|
gateway: "workspace",
|
|
26
21
|
query: n.query,
|
|
@@ -40,10 +35,10 @@ async function i(n) {
|
|
|
40
35
|
if (r.data == null) throw Error("Sandbox GraphQL returned no data");
|
|
41
36
|
return r.data;
|
|
42
37
|
}
|
|
43
|
-
async function
|
|
38
|
+
async function i(e) {
|
|
44
39
|
let t;
|
|
45
40
|
for (let n = 0; n < 3; n++) try {
|
|
46
|
-
return await
|
|
41
|
+
return await r(e);
|
|
47
42
|
} catch (e) {
|
|
48
43
|
t = e;
|
|
49
44
|
let r = e instanceof Error ? e.message.toLowerCase() : String(e).toLowerCase();
|
|
@@ -53,4 +48,4 @@ async function a(e) {
|
|
|
53
48
|
throw t;
|
|
54
49
|
}
|
|
55
50
|
//#endregion
|
|
56
|
-
export {
|
|
51
|
+
export { n as buildSandboxContextInput, i as executeSandboxGraphQL };
|
|
@@ -110,4 +110,7 @@ export * from './ui/voice/AssistantVoiceSession';
|
|
|
110
110
|
export * from './useAssistantApiAccess';
|
|
111
111
|
export * from './useConversationTurns';
|
|
112
112
|
export * from './transportErrors';
|
|
113
|
+
export * from './quota';
|
|
114
|
+
export * from './aiCredits';
|
|
115
|
+
export * from './useWorkspaceWriteAccess';
|
|
113
116
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CA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AAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,qCAAqC,CAAC;AACpD,cAAc,oCAAoC,CAAC;AACnD,cAAc,sCAAsC,CAAC;AACrD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wCAAwC,CAAC;AACvD,cAAc,yBAAyB,CAAC;AACxC,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AAGzC,cAAc,WAAW,CAAC;AAE1B,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AAErC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAE1C,cAAc,kCAAkC,CAAC;AAEjD,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAElC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Quota-error detection for the assistant's raw-fetch transport.
|
|
3
|
+
*
|
|
4
|
+
* The assistant talks to the wspace gateway over `fetch` (not Apollo), so it
|
|
5
|
+
* can't rely on the Apollo error link. `isQuotaExhaustedError` inspects the
|
|
6
|
+
* thrown error for the gateway's 429 / QUOTA_EXHAUSTED signal across the shapes
|
|
7
|
+
* `executeSandboxGraphQL` surfaces (Error.message, `.statusCode`, `.result`).
|
|
8
|
+
*
|
|
9
|
+
* Only the assistant's two quota walls are modelled: `sandbox` (the
|
|
10
|
+
* sandboxes-created @usage limit hit during provisioning) and `ai-credits`
|
|
11
|
+
* (per-token budget).
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Whether this error is an EXHAUSTED quota specifically.
|
|
15
|
+
*
|
|
16
|
+
* ★ BOFF-6302 — this used to match any HTTP 429, and a workspace with no assignment row is refused
|
|
17
|
+
* `429 QUOTA_NOT_PROVISIONED`. That is not exhaustion: the farmer has not used anything up, their
|
|
18
|
+
* plan was never granted, and "you have reached your limit" sends them to buy an upgrade that would
|
|
19
|
+
* not unblock them. {@link classifyQuotaError} now owns the distinction and this delegates to it.
|
|
20
|
+
*/
|
|
21
|
+
export declare function isQuotaExhaustedError(error: unknown): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The two ways the gateway refuses a metered mutation. They are NOT the same thing and must not be
|
|
24
|
+
* shown to a farmer with the same words (BOFF-6302).
|
|
25
|
+
*
|
|
26
|
+
* - `exhausted` — the workspace has the quota and has used it up. Deleting something, or upgrading,
|
|
27
|
+
* fixes it. Actionable by the user.
|
|
28
|
+
* - `not-provisioned` — the workspace has **no assignment row for that quota at all**, so the
|
|
29
|
+
* gateway fails closed. Nothing the user does fixes it: they have not hit a limit, their plan was
|
|
30
|
+
* never granted. Measured in prod 2026-08-13, this is why `createHealthyBowlFarm` returns
|
|
31
|
+
* `429 QUOTA_NOT_PROVISIONED` on several workspaces — the core create path is simply dead there.
|
|
32
|
+
*
|
|
33
|
+
* ★ Keyed on `extensions.code`, never on the HTTP status or the message text. Both refusals are
|
|
34
|
+
* `429`, so status alone cannot tell them apart — which is exactly how "no active subscription
|
|
35
|
+
* covers this" would otherwise be reported to a farmer as "you have reached your limit".
|
|
36
|
+
*/
|
|
37
|
+
export type QuotaRefusal = "exhausted" | "not-provisioned";
|
|
38
|
+
/**
|
|
39
|
+
* Which refusal this is, or null when the error is not a quota wall at all.
|
|
40
|
+
*
|
|
41
|
+
* `not-provisioned` wins when both appear: it is the more specific and the more serious of the two,
|
|
42
|
+
* and telling someone to upgrade when their plan was never granted sends them to buy something that
|
|
43
|
+
* would not help.
|
|
44
|
+
*/
|
|
45
|
+
export declare function classifyQuotaError(error: unknown): QuotaRefusal | null;
|
|
46
|
+
export type QuotaKind = "sandbox" | "ai-credits" | "generic";
|
|
47
|
+
/**
|
|
48
|
+
* Event the assistant dispatches on a quota wall, namespaced by product.
|
|
49
|
+
*
|
|
50
|
+
* ★ A function rather than a constant: the shared code owns the mechanism, the
|
|
51
|
+
* product owns its namespace — the same rule as translation keys. Passing the
|
|
52
|
+
* product keeps HealthyBowl's existing `healthybowl:quota-exhausted` byte for
|
|
53
|
+
* byte, and stops two products in one page colliding.
|
|
54
|
+
*
|
|
55
|
+
* ★ Nothing listens for it yet, in any product — verified across the repo. The
|
|
56
|
+
* chat area surfaces the wall inline instead. Kept because the dispatch is the
|
|
57
|
+
* cheap half of a future upgrade dialog, but do not mistake it for a live path.
|
|
58
|
+
*/
|
|
59
|
+
export declare function quotaExhaustedEventName(product: string): string;
|
|
60
|
+
export interface QuotaExhaustedEventDetail {
|
|
61
|
+
kind: QuotaKind;
|
|
62
|
+
message?: string;
|
|
63
|
+
operationName?: string | null;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=quota.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quota.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/quota.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAmBH;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAmB7D;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,iBAAiB,CAAC;AA0C3D;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI,CAStE;AAED,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,CAAC;AAE7D;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//#region src/shared/assistant/quota.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
if (!e || typeof e != "object") return;
|
|
4
|
+
let n = e[t];
|
|
5
|
+
return Array.isArray(n) ? n : void 0;
|
|
6
|
+
}
|
|
7
|
+
function t(e) {
|
|
8
|
+
let t = i(e);
|
|
9
|
+
if (t) return t === "exhausted";
|
|
10
|
+
if (!(e instanceof Error)) return !1;
|
|
11
|
+
let n = e.message.toLowerCase();
|
|
12
|
+
return n.includes("quota") && (n.includes("exhaust") || n.includes("exceeded"));
|
|
13
|
+
}
|
|
14
|
+
var n = {
|
|
15
|
+
QUOTA_EXHAUSTED: "exhausted",
|
|
16
|
+
QUOTA_NOT_PROVISIONED: "not-provisioned"
|
|
17
|
+
};
|
|
18
|
+
function r(t) {
|
|
19
|
+
if (!t || typeof t != "object") return [];
|
|
20
|
+
let r = [
|
|
21
|
+
t,
|
|
22
|
+
t.result,
|
|
23
|
+
t.networkError
|
|
24
|
+
], i = [];
|
|
25
|
+
for (let t of r) {
|
|
26
|
+
let n = t?.extensions;
|
|
27
|
+
n?.code && i.push(n.code), n?.errorCode && i.push(n.errorCode);
|
|
28
|
+
for (let n of e(t, "errors") ?? []) n.extensions?.code && i.push(n.extensions.code), n.extensions?.errorCode && i.push(n.extensions.errorCode);
|
|
29
|
+
}
|
|
30
|
+
let a = t.bodyText, o = t instanceof Error ? t.message : void 0;
|
|
31
|
+
for (let e of [a, o]) if (typeof e == "string") for (let t of Object.keys(n)) e.includes(t) && i.push(t);
|
|
32
|
+
return i;
|
|
33
|
+
}
|
|
34
|
+
function i(e) {
|
|
35
|
+
let t = r(e);
|
|
36
|
+
if (t.includes("QUOTA_NOT_PROVISIONED")) return "not-provisioned";
|
|
37
|
+
if (t.includes("QUOTA_EXHAUSTED")) return "exhausted";
|
|
38
|
+
let n = e?.statusCode;
|
|
39
|
+
return typeof n == "number" && n === 429 ? "exhausted" : null;
|
|
40
|
+
}
|
|
41
|
+
function a(e) {
|
|
42
|
+
return `${e}:quota-exhausted`;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { i as classifyQuotaError, t as isQuotaExhaustedError, a as quotaExhaustedEventName };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Can this user's writes actually LAND in this workspace?
|
|
3
|
+
*
|
|
4
|
+
* ★ Separate from `useAssistantApiAccess`, and deliberately not a replacement
|
|
5
|
+
* for it. That hook asks `myRoles` at ORG scope, which is the right question for
|
|
6
|
+
* "may this person use a mode that mints an OAuth app under their identity".
|
|
7
|
+
* Execution, though, happens at WORKSPACE scope — so an org admin could enter
|
|
8
|
+
* Take-action mode, have the model plan a change, confirm it, and only then hit
|
|
9
|
+
* a permission error. The two questions have different answers and both are
|
|
10
|
+
* legitimate; this hook asks the second one.
|
|
11
|
+
*
|
|
12
|
+
* ★ Measured 2026-09-02 against prod: `checkPermissions` answers cleanly
|
|
13
|
+
* (HTTP 200, no errors) with `allowed: false`, `decisionPath: "default:deny"`,
|
|
14
|
+
* and a null role — for an org OWNER. Workspace/project scopes have no roles
|
|
15
|
+
* provisioned at all, so the honest answer today is "no, for everyone".
|
|
16
|
+
*
|
|
17
|
+
* ★ Which is exactly why this hook only WARNS. Using it to gate the mode would
|
|
18
|
+
* remove Take-action from the product entirely until an ops task lands, and
|
|
19
|
+
* dressing that up as a permissions fix would be worse than the confusion it
|
|
20
|
+
* replaces. The moment roles are provisioned this starts returning `granted`
|
|
21
|
+
* and the warning disappears on its own, with no code change.
|
|
22
|
+
*
|
|
23
|
+
* Fails OPEN on error or while loading: a network blip must not accuse someone
|
|
24
|
+
* of lacking a permission they may well have.
|
|
25
|
+
*/
|
|
26
|
+
/** `unknown` while in flight or unanswerable — never treated as a refusal. */
|
|
27
|
+
export type WorkspaceWriteAccess = "granted" | "denied" | "unknown";
|
|
28
|
+
export declare function useWorkspaceWriteAccess(actorId: string | null, workspaceId: string | null, probeResources: readonly string[]): WorkspaceWriteAccess;
|
|
29
|
+
//# sourceMappingURL=useWorkspaceWriteAccess.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWorkspaceWriteAccess.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/useWorkspaceWriteAccess.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAwBH,8EAA8E;AAC9E,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEpE,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,cAAc,EAAE,SAAS,MAAM,EAAE,GAChC,oBAAoB,CAkDtB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { graphqlFetch as e } from "../graphql/fetch.js";
|
|
2
|
+
import "../../shared-graphql.js";
|
|
3
|
+
import { useEffect as t, useState as n } from "react";
|
|
4
|
+
//#region src/shared/assistant/useWorkspaceWriteAccess.ts
|
|
5
|
+
var r = "query AssistantWorkspaceWriteAccess($inputs: [PermissionCheckInput!]!) {\n checkPermissions(inputs: $inputs) {\n allowed\n }\n}";
|
|
6
|
+
function i(i, a, o) {
|
|
7
|
+
let [s, c] = n("unknown");
|
|
8
|
+
return t(() => {
|
|
9
|
+
if (!i || !a) {
|
|
10
|
+
c("unknown");
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
let t = !1;
|
|
14
|
+
return c("unknown"), e({
|
|
15
|
+
gateway: "workspace",
|
|
16
|
+
query: r,
|
|
17
|
+
variables: { inputs: o.map((e) => ({
|
|
18
|
+
actorId: i,
|
|
19
|
+
actorType: "USER",
|
|
20
|
+
scopeId: a,
|
|
21
|
+
resourceType: e,
|
|
22
|
+
action: "create"
|
|
23
|
+
})) },
|
|
24
|
+
suppressGlobalErrorEvent: !0
|
|
25
|
+
}).then((e) => {
|
|
26
|
+
if (t) return;
|
|
27
|
+
let n = e.data?.checkPermissions;
|
|
28
|
+
if (!Array.isArray(n) || n.length === 0) {
|
|
29
|
+
c("unknown");
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
c(n.some((e) => e.allowed) ? "granted" : "denied");
|
|
33
|
+
}).catch(() => {
|
|
34
|
+
t || c("unknown");
|
|
35
|
+
}), () => {
|
|
36
|
+
t = !0;
|
|
37
|
+
};
|
|
38
|
+
}, [i, a]), s;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { i as useWorkspaceWriteAccess };
|
package/dist/shared-assistant.js
CHANGED
|
@@ -1,79 +1,82 @@
|
|
|
1
1
|
import { useVoiceInput as e } from "./shared/assistant/voice/useVoiceInput.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
66
|
-
import {
|
|
67
|
-
import {
|
|
68
|
-
import {
|
|
69
|
-
import {
|
|
70
|
-
import {
|
|
71
|
-
import {
|
|
72
|
-
import {
|
|
73
|
-
import {
|
|
74
|
-
import {
|
|
75
|
-
import {
|
|
76
|
-
import {
|
|
77
|
-
import {
|
|
78
|
-
import {
|
|
79
|
-
|
|
2
|
+
import { classifyQuotaError as t, isQuotaExhaustedError as n, quotaExhaustedEventName as r } from "./shared/assistant/quota.js";
|
|
3
|
+
import { buildSandboxContextInput as i, executeSandboxGraphQL as a } from "./shared/assistant/gatewayClient.js";
|
|
4
|
+
import { CHECK_AI_CREDITS as o, CREATE_SANDBOX as s, EXTEND_SANDBOX_TTL as c, GET_ACTIVE_SANDBOXES as l, GET_SANDBOX as u, PROXY_SANDBOX_REQUEST as d, REPORT_AI_TOKEN_USAGE as f, STOP_ASSISTANT_SANDBOX as p, WAIT_FOR_SANDBOX_RUNNING as m } from "./shared/assistant/operations.js";
|
|
5
|
+
import { ASSISTANT_API_AUTH_STRATEGY as h, getImageForMode as g, getImageTagForMode as _, getResourcesForMode as v, getSandboxImageRegistry as y, resolveSandboxAssistantMode as b } from "./shared/assistant/images.js";
|
|
6
|
+
import { getCapability as x, isUnknownFieldError as S, markSupported as C, markUnsupported as w } from "./shared/assistant/capabilities.js";
|
|
7
|
+
import { buildAssistantSandboxEnv as T, buildPromptRequestBody as E, checkAssistantAiCredits as D, createAssistantSandbox as O, createAssistantSession as k, downloadAssistantArtifact as A, extendAssistantSandboxTTL as j, findExistingSandbox as M, getAssistantArtifacts as N, getAssistantMessages as P, getAssistantSession as F, getAssistantStreamAccess as I, modeRequiresConfirmWrites as L, reportAssistantAiTokenUsage as R, selectExistingAssistantSandbox as z, sendAssistantPromptAsync as B, sendHeartbeat as V, stopReapedAssistantSandbox as H, waitForAssistantServiceReady as U, waitForSandboxRunning as W } from "./shared/assistant/api.js";
|
|
8
|
+
import { AssistantRuntimeManager as G } from "./shared/assistant/runtime.js";
|
|
9
|
+
import { buildProgress as K, getAssistantMedia as q, getAssistantText as J, getRawMessageCreatedAt as Y, getToolProgress as X, isReapedSandboxConnectionError as Z, isRecoverable as Q, mapSessionToHistory as $, mergeMessagesById as ee, sanitize as te } from "./shared/assistant/progress.js";
|
|
10
|
+
import { createSandboxAssistantTransport as ne } from "./shared/assistant/createSandboxAssistantTransport.js";
|
|
11
|
+
import { useSandboxAssistantTransport as re } from "./shared/assistant/useSandboxAssistantTransport.js";
|
|
12
|
+
import { chatTurns as ie, groupBySession as ae, groupConsecutiveBySession as oe, isVoiceTurn as se, voiceMarker as ce, voiceSessionIdOf as le, voiceTurnsOnly as ue } from "./shared/assistant/voice/turnVisibility.js";
|
|
13
|
+
import { browserSpeechEngine as de } from "./shared/assistant/speech/browserSpeechEngine.js";
|
|
14
|
+
import { HOSTED_TTS_TIER as fe, HOSTED_VOICES as pe, hostedLocaleFor as me, hostedSupportsLanguage as he } from "./shared/assistant/speech/hostedVoiceCatalogue.js";
|
|
15
|
+
import { HOSTED_TTS_MAX_CHARS as ge, SPEAKING_RATE_MAX as _e, SPEAKING_RATE_MAX_STREAMING as ve, SPEAKING_RATE_MAX_SYNC as ye, SPEAKING_RATE_MIN as be, base64ToBytes as xe, buildRequest as Se, classifyHttpFailure as Ce, decodeAudioResponse as we, shouldDisableEngine as Te, splitForVendor as Ee } from "./shared/assistant/speech/hostedTtsProtocol.js";
|
|
16
|
+
import { createHostedTtsEngine as De } from "./shared/assistant/speech/hostedTtsSpeechEngine.js";
|
|
17
|
+
import { createRoutingSpeechEngine as Oe } from "./shared/assistant/speech/routingSpeechEngine.js";
|
|
18
|
+
import { configureSpeechEngine as ke, createSpeechEngines as Ae, getSpeechEngine as je, readSpeechEngineConfig as Me, resetSpeechEngine as Ne } from "./shared/assistant/speech/createSpeechEngine.js";
|
|
19
|
+
import { micIsInterrupt as Pe, showsAssistantCaption as Fe, showsUserCaption as Ie, voiceStageState as Le, waveformIsActive as Re, waveformIsSettled as ze } from "./shared/assistant/voice/voiceStageState.js";
|
|
20
|
+
import { ENDPOINT_GRACE_MS as Be, INITIAL_SESSION as Ve, INTERRUPT_MAX_MS as He, INTERRUPT_MIN_MS as Ue, SILENCE_SUBMIT_MS as We, isCapturing as Ge, isEcho as Ke, isSubmittable as qe, orbMode as Je, planReplyConsumption as Ye, spokenSoFar as Xe, voiceSessionReducer as Ze } from "./shared/assistant/voice/voiceSession.js";
|
|
21
|
+
import { SPEECH_LANG as Qe, VOICE_LIST_TIMEOUT_MS as $e, isSpeechBlocked as et, languageDisplayName as tt, normalizeLangTag as nt, primaryLanguageSubtag as rt, selectVoiceForLocale as it, speechGate as at, speechLangForLocale as ot, voiceAvailability as st, voiceQualityRank as ct, voicesForLocale as lt } from "./shared/assistant/voice/speechVoices.js";
|
|
22
|
+
import { buildContinuedFromVoiceNote as ut, buildVoiceTranscriptMarkdown as dt, voiceTranscriptFilename as ft } from "./shared/assistant/voice/voiceTranscript.js";
|
|
23
|
+
import { DEFAULT_SPEAKABLE_LABELS as pt, MAX_SPEAKABLE_CHARS as mt, MAX_SPOKEN_TABLE_ROWS as ht, SPEECH_CHUNK_CHARS as gt, SPEECH_CHUNK_CJK_CHARS as _t, chunkForSpeech as vt, containsCjk as yt, speakableEmail as bt, splitTableRow as xt, toSpeakableText as St } from "./shared/assistant/voice/speakableText.js";
|
|
24
|
+
import { PREVIEW_LANGUAGES as Ct, voicePreviewText as wt } from "./shared/assistant/voice/voicePreview.js";
|
|
25
|
+
import { POLL_FAST_MS as Tt, POLL_FAST_UNTIL_MS as Et, POLL_SLOW_MS as Dt, POLL_STEADY_MS as Ot, POLL_STEADY_UNTIL_MS as kt, pollDelayMs as At } from "./shared/assistant/voice/assistantPollSchedule.js";
|
|
26
|
+
import { toCaptionText as jt } from "./shared/assistant/voice/captionText.js";
|
|
27
|
+
import { ASSISTANT_LANGUAGES as Mt, DEFAULT_SPEECH_RATE as Nt, findAssistantLanguage as Pt, resolveAssistantLanguage as Ft } from "./shared/assistant/voice/languages.js";
|
|
28
|
+
import { replyFollowsInput as It, resolveLanguagePair as Lt } from "./shared/assistant/voice/languagePair.js";
|
|
29
|
+
import { findPendingWrite as Rt, parseConfirmationRefusal as zt } from "./shared/assistant/pendingWrite.js";
|
|
30
|
+
import { AssistantProductProvider as Bt, resolveModeConfig as Vt, useAssistantProduct as Ht, useAssistantProductOrNull as Ut } from "./shared/assistant/product.js";
|
|
31
|
+
import { AssistantI18nProvider as Wt, assistantTranslationKey as Gt, useAssistantI18nNamespace as Kt, useAssistantTr as qt } from "./shared/assistant/i18n.js";
|
|
32
|
+
import { SPOKEN_LABEL_LANGUAGES as Jt, speechLabelsFor as Yt } from "./shared/assistant/voice/speechLabels.js";
|
|
33
|
+
import { detectScriptLocale as Xt, resolveSpeechLocale as Zt } from "./shared/assistant/voice/replyLanguage.js";
|
|
34
|
+
import { IDLE_PLAYBACK as Qt, isSpeakingMessage as $t, requiresCancel as en, speechPlaybackReducer as tn } from "./shared/assistant/voice/speechPlayback.js";
|
|
35
|
+
import { MAX_INLINE_IMAGE_BASE64_BYTES as nn, MAX_REQUEST_BODY_BYTES as rn } from "./shared/assistant/gatewayLimits.js";
|
|
36
|
+
import { BOILERPLATE_PAGE_SHARE as an, MAX_BOILERPLATE_LINE_CHARS as on, MAX_EXTRACTED_CHARS as sn, MAX_PDF_PAGES_SCANNED as cn, MIN_PAGE_TEXT_CHARS as ln, MIN_TEXT_PAGE_SHARE as un, columnLetterToIndex as dn, decodeXmlEntities as fn, docxXmlToText as pn, fitPdfPages as mn, formatPageRanges as hn, isMostlyImagePages as gn, joinSheets as _n, pageMarker as vn, parseSharedStrings as yn, parseWorkbookSheets as bn, pdfTextItemsToPage as xn, sheetXmlToRows as Sn, summarisePageText as Cn, truncatePagesForInline as wn } from "./shared/assistant/documentText.js";
|
|
37
|
+
import { ATTACHMENT_ACCEPT as Tn, AttachmentRejectedError as En, INLINE_IMAGE_MAX_DIM as Dn, INLINE_IMAGE_QUALITY as On, MAX_ATTACHMENTS as kn, MAX_FILE_BYTES as An, MAX_INLINE_CHARS_PER_FILE as jn, MAX_INLINE_CHARS_TOTAL as Mn, MAX_INLINE_IMAGE_BASE64_CHARS as Nn, MAX_INLINE_IMAGE_PARTS as Pn, MAX_INLINE_TURN_BODY_BYTES as Fn, MAX_TURN_BODY_BYTES as In, PROMPT_ENVELOPE_RESERVE_BYTES as Ln, TURN_BODY_HEADROOM_BYTES as Rn, buildAttachmentPromptBlock as zn, buildPromptParts as Bn, buildPromptWithAttachments as Vn, classifyAttachment as Hn, countInlineImageCandidates as Un, countInlinedImageParts as Wn, detectDocumentFormat as Gn, estimateTurnBodyBytes as Kn, formatBytes as qn, getAttachmentSendBlocker as Jn, getExtension as Yn, getSendableAttachments as Xn, hasAttachmentWorkInFlight as Zn, parseDataUrl as Qn, toMessageAttachment as $n, truncateForInline as er, validateFile as tr } from "./shared/assistant/attachments.js";
|
|
38
|
+
import { useAssistantStore as nr } from "./shared/assistant/store.js";
|
|
39
|
+
import { isTurnInFlight as rr } from "./shared/assistant/turnState.js";
|
|
40
|
+
import { AssistantToolActivity as ir, parseToolActivity as ar } from "./shared/assistant/ui/AssistantToolActivity.js";
|
|
41
|
+
import { AssistantSpeechProvider as or, useAssistantSpeech as sr } from "./shared/assistant/ui/AssistantSpeechProvider.js";
|
|
42
|
+
import { useVoiceSession as cr } from "./shared/assistant/ui/useVoiceSession.js";
|
|
43
|
+
import { copyToClipboard as lr } from "./shared/assistant/clipboard.js";
|
|
44
|
+
import { getActorId as ur, getOrganizationId as dr, getWorkspaceId as fr } from "./shared/assistant/context.js";
|
|
45
|
+
import { ATTACHMENT_SOURCES as pr, availableAttachmentSources as mr, deviceHasCamera as hr } from "./shared/assistant/attachmentSources.js";
|
|
46
|
+
import { SANDBOX_READY_TTL_MS as gr, createReadinessTracker as _r, isRecentlyVerified as vr } from "./shared/assistant/sandboxReadiness.js";
|
|
47
|
+
import { AssistantAutoSpeakToggle as yr } from "./shared/assistant/ui/AssistantAutoSpeakToggle.js";
|
|
48
|
+
import { AssistantMarkdownImage as br, imageHostLabel as xr, isRemoteImageSrc as Sr } from "./shared/assistant/ui/AssistantMarkdownImage.js";
|
|
49
|
+
import { AssistantMarkdownRenderer as Cr, assistantUrlTransform as wr } from "./shared/assistant/ui/AssistantMarkdownRenderer.js";
|
|
50
|
+
import { AssistantMessageAttachments as Tr } from "./shared/assistant/ui/AssistantMessageAttachments.js";
|
|
51
|
+
import { AssistantPendingWriteCard as Er } from "./shared/assistant/ui/AssistantPendingWriteCard.js";
|
|
52
|
+
import { AssistantReplyLanguageSelector as Dr } from "./shared/assistant/ui/AssistantReplyLanguageSelector.js";
|
|
53
|
+
import { AssistantSpeakButton as Or } from "./shared/assistant/ui/AssistantSpeakButton.js";
|
|
54
|
+
import { AssistantSpokenTurnsNotice as kr } from "./shared/assistant/ui/AssistantSpokenTurnsNotice.js";
|
|
55
|
+
import { AssistantAttachmentButton as Ar } from "./shared/assistant/ui/composer/AssistantAttachmentButton.js";
|
|
56
|
+
import { AssistantAttachmentChips as jr } from "./shared/assistant/ui/composer/AssistantAttachmentChips.js";
|
|
57
|
+
import { AssistantLanguageSelector as Mr, FOLLOW_APP_LOCALE as Nr } from "./shared/assistant/ui/composer/AssistantLanguageSelector.js";
|
|
58
|
+
import { ASSISTANT_MODE_META as Pr, AssistantModeSelector as Fr, nextModeIndex as Ir } from "./shared/assistant/ui/composer/AssistantModeSelector.js";
|
|
59
|
+
import { AssistantVoiceButton as Lr } from "./shared/assistant/ui/composer/AssistantVoiceButton.js";
|
|
60
|
+
import { AUTO_VOICE as Rr, AssistantVoiceSelector as zr } from "./shared/assistant/ui/composer/AssistantVoiceSelector.js";
|
|
61
|
+
import { AssistantVoiceOrb as Br } from "./shared/assistant/ui/voice/AssistantVoiceOrb.js";
|
|
62
|
+
import { AssistantVoiceSessionButton as Vr } from "./shared/assistant/ui/voice/AssistantVoiceSessionButton.js";
|
|
63
|
+
import { VoiceCaption as Hr } from "./shared/assistant/ui/voice/VoiceCaption.js";
|
|
64
|
+
import { VoiceConversationView as Ur } from "./shared/assistant/ui/voice/VoiceConversationView.js";
|
|
65
|
+
import { VoiceWaveform as Wr } from "./shared/assistant/ui/voice/VoiceWaveform.js";
|
|
66
|
+
import { VoiceMiniController as Gr } from "./shared/assistant/ui/voice/VoiceMiniController.js";
|
|
67
|
+
import { VoiceStage as Kr } from "./shared/assistant/ui/voice/VoiceStage.js";
|
|
68
|
+
import { VoiceTranscriptDrawer as qr } from "./shared/assistant/ui/voice/VoiceTranscriptDrawer.js";
|
|
69
|
+
import { downloadFile as Jr, exportConversation as Yr } from "./shared/assistant/exportConversation.js";
|
|
70
|
+
import { AssistantMoreMenu as Xr } from "./shared/assistant/ui/AssistantMoreMenu.js";
|
|
71
|
+
import { AssistantHeader as Zr } from "./shared/assistant/ui/AssistantHeader.js";
|
|
72
|
+
import { AssistantConversationList as Qr } from "./shared/assistant/ui/AssistantConversationList.js";
|
|
73
|
+
import { AssistantEmptyState as $r } from "./shared/assistant/ui/AssistantEmptyState.js";
|
|
74
|
+
import { AssistantMessageItem as ei } from "./shared/assistant/ui/AssistantMessageItem.js";
|
|
75
|
+
import { AssistantMessageList as ti } from "./shared/assistant/ui/AssistantMessageList.js";
|
|
76
|
+
import { AssistantVoiceSession as ni } from "./shared/assistant/ui/voice/AssistantVoiceSession.js";
|
|
77
|
+
import { useAssistantApiAccess as ri } from "./shared/assistant/useAssistantApiAccess.js";
|
|
78
|
+
import { useConversationTurns as ii } from "./shared/assistant/useConversationTurns.js";
|
|
79
|
+
import { isMultimodalBodyRejection as ai, isRecoverableAssistantError as oi } from "./shared/assistant/transportErrors.js";
|
|
80
|
+
import { aiCreditsUpdatedEventName as si, dispatchAssistantQuotaExhausted as ci, notifyAiCreditsUpdated as li } from "./shared/assistant/aiCredits.js";
|
|
81
|
+
import { useWorkspaceWriteAccess as ui } from "./shared/assistant/useWorkspaceWriteAccess.js";
|
|
82
|
+
export { h as ASSISTANT_API_AUTH_STRATEGY, Mt as ASSISTANT_LANGUAGES, Pr as ASSISTANT_MODE_META, Tn as ATTACHMENT_ACCEPT, pr as ATTACHMENT_SOURCES, Rr as AUTO_VOICE, Ar as AssistantAttachmentButton, jr as AssistantAttachmentChips, yr as AssistantAutoSpeakToggle, Qr as AssistantConversationList, $r as AssistantEmptyState, Zr as AssistantHeader, Wt as AssistantI18nProvider, Mr as AssistantLanguageSelector, br as AssistantMarkdownImage, Cr as AssistantMarkdownRenderer, Tr as AssistantMessageAttachments, ei as AssistantMessageItem, ti as AssistantMessageList, Fr as AssistantModeSelector, Xr as AssistantMoreMenu, Er as AssistantPendingWriteCard, Bt as AssistantProductProvider, Dr as AssistantReplyLanguageSelector, G as AssistantRuntimeManager, Or as AssistantSpeakButton, or as AssistantSpeechProvider, kr as AssistantSpokenTurnsNotice, ir as AssistantToolActivity, Lr as AssistantVoiceButton, Br as AssistantVoiceOrb, zr as AssistantVoiceSelector, ni as AssistantVoiceSession, Vr as AssistantVoiceSessionButton, En as AttachmentRejectedError, an as BOILERPLATE_PAGE_SHARE, o as CHECK_AI_CREDITS, s as CREATE_SANDBOX, pt as DEFAULT_SPEAKABLE_LABELS, Nt as DEFAULT_SPEECH_RATE, Be as ENDPOINT_GRACE_MS, c as EXTEND_SANDBOX_TTL, Nr as FOLLOW_APP_LOCALE, l as GET_ACTIVE_SANDBOXES, u as GET_SANDBOX, ge as HOSTED_TTS_MAX_CHARS, fe as HOSTED_TTS_TIER, pe as HOSTED_VOICES, Qt as IDLE_PLAYBACK, Ve as INITIAL_SESSION, Dn as INLINE_IMAGE_MAX_DIM, On as INLINE_IMAGE_QUALITY, He as INTERRUPT_MAX_MS, Ue as INTERRUPT_MIN_MS, kn as MAX_ATTACHMENTS, on as MAX_BOILERPLATE_LINE_CHARS, sn as MAX_EXTRACTED_CHARS, An as MAX_FILE_BYTES, jn as MAX_INLINE_CHARS_PER_FILE, Mn as MAX_INLINE_CHARS_TOTAL, nn as MAX_INLINE_IMAGE_BASE64_BYTES, Nn as MAX_INLINE_IMAGE_BASE64_CHARS, Pn as MAX_INLINE_IMAGE_PARTS, Fn as MAX_INLINE_TURN_BODY_BYTES, cn as MAX_PDF_PAGES_SCANNED, rn as MAX_REQUEST_BODY_BYTES, mt as MAX_SPEAKABLE_CHARS, ht as MAX_SPOKEN_TABLE_ROWS, In as MAX_TURN_BODY_BYTES, ln as MIN_PAGE_TEXT_CHARS, un as MIN_TEXT_PAGE_SHARE, Tt as POLL_FAST_MS, Et as POLL_FAST_UNTIL_MS, Dt as POLL_SLOW_MS, Ot as POLL_STEADY_MS, kt as POLL_STEADY_UNTIL_MS, Ct as PREVIEW_LANGUAGES, Ln as PROMPT_ENVELOPE_RESERVE_BYTES, d as PROXY_SANDBOX_REQUEST, f as REPORT_AI_TOKEN_USAGE, gr as SANDBOX_READY_TTL_MS, We as SILENCE_SUBMIT_MS, _e as SPEAKING_RATE_MAX, ve as SPEAKING_RATE_MAX_STREAMING, ye as SPEAKING_RATE_MAX_SYNC, be as SPEAKING_RATE_MIN, gt as SPEECH_CHUNK_CHARS, _t as SPEECH_CHUNK_CJK_CHARS, Qe as SPEECH_LANG, Jt as SPOKEN_LABEL_LANGUAGES, p as STOP_ASSISTANT_SANDBOX, Rn as TURN_BODY_HEADROOM_BYTES, $e as VOICE_LIST_TIMEOUT_MS, Hr as VoiceCaption, Ur as VoiceConversationView, Gr as VoiceMiniController, Kr as VoiceStage, qr as VoiceTranscriptDrawer, Wr as VoiceWaveform, m as WAIT_FOR_SANDBOX_RUNNING, si as aiCreditsUpdatedEventName, Gt as assistantTranslationKey, wr as assistantUrlTransform, mr as availableAttachmentSources, xe as base64ToBytes, de as browserSpeechEngine, T as buildAssistantSandboxEnv, zn as buildAttachmentPromptBlock, ut as buildContinuedFromVoiceNote, K as buildProgress, Bn as buildPromptParts, E as buildPromptRequestBody, Vn as buildPromptWithAttachments, Se as buildRequest, i as buildSandboxContextInput, dt as buildVoiceTranscriptMarkdown, ie as chatTurns, D as checkAssistantAiCredits, vt as chunkForSpeech, Hn as classifyAttachment, Ce as classifyHttpFailure, t as classifyQuotaError, dn as columnLetterToIndex, ke as configureSpeechEngine, yt as containsCjk, lr as copyToClipboard, Un as countInlineImageCandidates, Wn as countInlinedImageParts, O as createAssistantSandbox, k as createAssistantSession, De as createHostedTtsEngine, _r as createReadinessTracker, Oe as createRoutingSpeechEngine, ne as createSandboxAssistantTransport, Ae as createSpeechEngines, we as decodeAudioResponse, fn as decodeXmlEntities, Gn as detectDocumentFormat, Xt as detectScriptLocale, hr as deviceHasCamera, ci as dispatchAssistantQuotaExhausted, pn as docxXmlToText, A as downloadAssistantArtifact, Jr as downloadFile, Kn as estimateTurnBodyBytes, a as executeSandboxGraphQL, Yr as exportConversation, j as extendAssistantSandboxTTL, Pt as findAssistantLanguage, M as findExistingSandbox, Rt as findPendingWrite, mn as fitPdfPages, qn as formatBytes, hn as formatPageRanges, ur as getActorId, N as getAssistantArtifacts, q as getAssistantMedia, P as getAssistantMessages, F as getAssistantSession, I as getAssistantStreamAccess, J as getAssistantText, Jn as getAttachmentSendBlocker, x as getCapability, Yn as getExtension, g as getImageForMode, _ as getImageTagForMode, dr as getOrganizationId, Y as getRawMessageCreatedAt, v as getResourcesForMode, y as getSandboxImageRegistry, Xn as getSendableAttachments, je as getSpeechEngine, X as getToolProgress, fr as getWorkspaceId, ae as groupBySession, oe as groupConsecutiveBySession, Zn as hasAttachmentWorkInFlight, me as hostedLocaleFor, he as hostedSupportsLanguage, xr as imageHostLabel, Ge as isCapturing, Ke as isEcho, gn as isMostlyImagePages, ai as isMultimodalBodyRejection, n as isQuotaExhaustedError, Z as isReapedSandboxConnectionError, vr as isRecentlyVerified, Q as isRecoverable, oi as isRecoverableAssistantError, Sr as isRemoteImageSrc, $t as isSpeakingMessage, et as isSpeechBlocked, qe as isSubmittable, rr as isTurnInFlight, S as isUnknownFieldError, se as isVoiceTurn, _n as joinSheets, tt as languageDisplayName, $ as mapSessionToHistory, C as markSupported, w as markUnsupported, ee as mergeMessagesById, Pe as micIsInterrupt, L as modeRequiresConfirmWrites, Ir as nextModeIndex, nt as normalizeLangTag, li as notifyAiCreditsUpdated, Je as orbMode, vn as pageMarker, zt as parseConfirmationRefusal, Qn as parseDataUrl, yn as parseSharedStrings, ar as parseToolActivity, bn as parseWorkbookSheets, xn as pdfTextItemsToPage, Ye as planReplyConsumption, At as pollDelayMs, rt as primaryLanguageSubtag, r as quotaExhaustedEventName, Me as readSpeechEngineConfig, It as replyFollowsInput, R as reportAssistantAiTokenUsage, en as requiresCancel, Ne as resetSpeechEngine, Ft as resolveAssistantLanguage, Lt as resolveLanguagePair, Vt as resolveModeConfig, b as resolveSandboxAssistantMode, Zt as resolveSpeechLocale, te as sanitize, z as selectExistingAssistantSandbox, it as selectVoiceForLocale, B as sendAssistantPromptAsync, V as sendHeartbeat, Sn as sheetXmlToRows, Te as shouldDisableEngine, Fe as showsAssistantCaption, Ie as showsUserCaption, bt as speakableEmail, at as speechGate, Yt as speechLabelsFor, ot as speechLangForLocale, tn as speechPlaybackReducer, Ee as splitForVendor, xt as splitTableRow, Xe as spokenSoFar, H as stopReapedAssistantSandbox, Cn as summarisePageText, jt as toCaptionText, $n as toMessageAttachment, St as toSpeakableText, er as truncateForInline, wn as truncatePagesForInline, ri as useAssistantApiAccess, Kt as useAssistantI18nNamespace, Ht as useAssistantProduct, Ut as useAssistantProductOrNull, sr as useAssistantSpeech, nr as useAssistantStore, qt as useAssistantTr, ii as useConversationTurns, re as useSandboxAssistantTransport, e as useVoiceInput, cr as useVoiceSession, ui as useWorkspaceWriteAccess, tr as validateFile, st as voiceAvailability, ce as voiceMarker, wt as voicePreviewText, ct as voiceQualityRank, le as voiceSessionIdOf, Ze as voiceSessionReducer, Le as voiceStageState, ft as voiceTranscriptFilename, ue as voiceTurnsOnly, lt as voicesForLocale, U as waitForAssistantServiceReady, W as waitForSandboxRunning, Re as waveformIsActive, ze as waveformIsSettled };
|