@burdenoff/fe-libs 2026.909.2 → 2026.910.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/shared/assistant/index.d.ts +1 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/stageCopy.d.ts +123 -0
- package/dist/shared/assistant/stageCopy.d.ts.map +1 -0
- package/dist/shared/assistant/stageCopy.js +97 -0
- package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantChatArea.js +303 -287
- package/dist/shared-assistant.js +54 -53
- package/package.json +1 -1
|
@@ -68,6 +68,7 @@ export * from './conversation';
|
|
|
68
68
|
export * from './attachments';
|
|
69
69
|
export * from './store';
|
|
70
70
|
export * from './turnState';
|
|
71
|
+
export * from './stageCopy';
|
|
71
72
|
export * from './gatewayLimits';
|
|
72
73
|
export * from './documentText';
|
|
73
74
|
export * from './ui/AssistantToolActivity';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/index.ts"],"names":[],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { AssistantConversationStatus } from './conversation';
|
|
2
|
+
import { AssistantTr } from './i18n';
|
|
3
|
+
/**
|
|
4
|
+
* Every string the assistant shows in its own bubble while a turn is still
|
|
5
|
+
* working — and the one predicate that recognises them.
|
|
6
|
+
*
|
|
7
|
+
* ★★ THE REASON THIS IS ONE MODULE. Two features depend on the same set and
|
|
8
|
+
* they fail in opposite directions if it drifts:
|
|
9
|
+
*
|
|
10
|
+
* - the bubble rotates filler while the model thinks, so the set GROWS;
|
|
11
|
+
* - an interrupted turn must have its filler replaced, so the set must be
|
|
12
|
+
* RECOGNISED exhaustively.
|
|
13
|
+
*
|
|
14
|
+
* Add a phrase to the rotation without teaching the predicate about it and an
|
|
15
|
+
* interrupt during that phrase strands it in the transcript forever — which is
|
|
16
|
+
* precisely the defect this module exists to fix (BOFF-7229), reintroduced one
|
|
17
|
+
* word at a time. Keeping both sides here makes that impossible: the predicate
|
|
18
|
+
* is derived from the same tables the writers use, and a test asserts it.
|
|
19
|
+
*/
|
|
20
|
+
export interface StageCopyEntry {
|
|
21
|
+
/** Relative i18n key, resolved through `AssistantTr`. */
|
|
22
|
+
readonly key: string;
|
|
23
|
+
/** English copy, used when the key is unseeded or no provider is mounted. */
|
|
24
|
+
readonly fallback: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The environment steps.
|
|
28
|
+
*
|
|
29
|
+
* ★ These are INFORMATIVE, not filler: each names a different thing the runtime
|
|
30
|
+
* is actually doing, and on a cold start they are the only signal the user gets
|
|
31
|
+
* for 11-15 seconds. They are deliberately NOT part of the rotation — swapping
|
|
32
|
+
* "Starting assistant environment..." for "Pondering..." would trade real
|
|
33
|
+
* progress information for decoration.
|
|
34
|
+
*/
|
|
35
|
+
export declare const STAGE_COPY: {
|
|
36
|
+
readonly reusingEnvironment: {
|
|
37
|
+
readonly key: "stage.reusingEnvironment";
|
|
38
|
+
readonly fallback: "Reusing assistant environment...";
|
|
39
|
+
};
|
|
40
|
+
readonly lookingForEnvironment: {
|
|
41
|
+
readonly key: "stage.lookingForEnvironment";
|
|
42
|
+
readonly fallback: "Looking for existing environment...";
|
|
43
|
+
};
|
|
44
|
+
readonly startingEnvironment: {
|
|
45
|
+
readonly key: "stage.startingEnvironment";
|
|
46
|
+
readonly fallback: "Starting assistant environment...";
|
|
47
|
+
};
|
|
48
|
+
readonly preparingSession: {
|
|
49
|
+
readonly key: "stage.preparingSession";
|
|
50
|
+
readonly fallback: "Preparing session...";
|
|
51
|
+
};
|
|
52
|
+
readonly connecting: {
|
|
53
|
+
readonly key: "stage.connecting";
|
|
54
|
+
readonly fallback: "Connecting to assistant...";
|
|
55
|
+
};
|
|
56
|
+
readonly thinking: {
|
|
57
|
+
readonly key: "stage.thinking";
|
|
58
|
+
readonly fallback: "Thinking...";
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* What replaces stage copy on a turn the user cut off.
|
|
62
|
+
*
|
|
63
|
+
* ★ Deliberately NOT a member of `isStageCopy`: it is a settled outcome, not
|
|
64
|
+
* a turn still working. That asymmetry is what makes the replacement
|
|
65
|
+
* idempotent — a second pass over an already-stopped turn rewrites nothing.
|
|
66
|
+
*/
|
|
67
|
+
readonly stopped: {
|
|
68
|
+
readonly key: "stage.stopped";
|
|
69
|
+
readonly fallback: "Stopped";
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Filler shown while the model is working and has produced nothing yet.
|
|
74
|
+
*
|
|
75
|
+
* ★ `thinking` is first so the sequence always opens on the familiar word, and
|
|
76
|
+
* so index 0 is stable for tests. The rest exist because a single frozen
|
|
77
|
+
* "Thinking..." for the length of a turn reads as a hang; a phrase that moves
|
|
78
|
+
* reads as work in progress.
|
|
79
|
+
*
|
|
80
|
+
* ★ Every entry here is machine copy by construction, so `isStageCopy` covers
|
|
81
|
+
* the whole list rather than a hand-maintained subset.
|
|
82
|
+
*/
|
|
83
|
+
export declare const THINKING_PHRASES: readonly StageCopyEntry[];
|
|
84
|
+
/**
|
|
85
|
+
* How long each phrase holds.
|
|
86
|
+
*
|
|
87
|
+
* ★ Not the poll cadence. Polls land every 600-1500ms
|
|
88
|
+
* (`voice/assistantPollSchedule`), and rotating on every one of them flickers.
|
|
89
|
+
* Rotation is driven by ELAPSED TIME so the cadence is independent of how often
|
|
90
|
+
* the loop happens to write.
|
|
91
|
+
*/
|
|
92
|
+
export declare const PHRASE_ROTATE_MS = 2500;
|
|
93
|
+
/** Resolve one entry through the product's translator. */
|
|
94
|
+
export declare function stageText(tr: AssistantTr, entry: StageCopyEntry): string;
|
|
95
|
+
/**
|
|
96
|
+
* The phrase for a turn that has been working `elapsedMs`.
|
|
97
|
+
*
|
|
98
|
+
* Pure in `elapsedMs` — the caller owns the clock — so the rotation is
|
|
99
|
+
* exercised by tests without faking timers.
|
|
100
|
+
*/
|
|
101
|
+
export declare function thinkingPhrase(tr: AssistantTr, elapsedMs: number): string;
|
|
102
|
+
/**
|
|
103
|
+
* The copy for a conversation status, when a caller has none of its own.
|
|
104
|
+
*
|
|
105
|
+
* ★ Translated, where the literals it replaces were bare English. The assistant
|
|
106
|
+
* rendering English in every locale is a defect this codebase has already paid
|
|
107
|
+
* for once in the fe-libs shell.
|
|
108
|
+
*/
|
|
109
|
+
export declare function statusStageCopy(tr: AssistantTr, status: AssistantConversationStatus): string;
|
|
110
|
+
/**
|
|
111
|
+
* Is this bubble still showing machine copy rather than an answer?
|
|
112
|
+
*
|
|
113
|
+
* ★★ Both the translation AND the English fallback are compared, for two
|
|
114
|
+
* reasons that are easy to miss. A locale can change mid-turn, leaving content
|
|
115
|
+
* written under the previous one; and a key that is published but not yet
|
|
116
|
+
* ACTIVE resolves to its fallback, which is how ~9,000 assistant keys behaved
|
|
117
|
+
* in prod. Matching one form only would leave the bubble stranded in exactly
|
|
118
|
+
* the cases this predicate exists to catch.
|
|
119
|
+
*
|
|
120
|
+
* ★ Empty is machine copy too — a bubble with nothing in it is not an answer.
|
|
121
|
+
*/
|
|
122
|
+
export declare function isStageCopy(tr: AssistantTr, content: string | null | undefined): boolean;
|
|
123
|
+
//# sourceMappingURL=stageCopy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stageCopy.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/stageCopy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE1C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,cAAc;IAC7B,yDAAyD;IACzD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;IAyBrB;;;;;;OAMG;;;;;CAK8C,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,cAAc,EAWrD,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,OAAO,CAAC;AAErC,0DAA0D;AAC1D,wBAAgB,SAAS,CAAC,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,cAAc,GAAG,MAAM,CAExE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAKzE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,EAAE,EAAE,WAAW,EACf,MAAM,EAAE,2BAA2B,GAClC,MAAM,CAcR;AAeD;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CACzB,EAAE,EAAE,WAAW,EACf,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACjC,OAAO,CAOT"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
//#region src/shared/assistant/stageCopy.ts
|
|
2
|
+
var e = {
|
|
3
|
+
reusingEnvironment: {
|
|
4
|
+
key: "stage.reusingEnvironment",
|
|
5
|
+
fallback: "Reusing assistant environment..."
|
|
6
|
+
},
|
|
7
|
+
lookingForEnvironment: {
|
|
8
|
+
key: "stage.lookingForEnvironment",
|
|
9
|
+
fallback: "Looking for existing environment..."
|
|
10
|
+
},
|
|
11
|
+
startingEnvironment: {
|
|
12
|
+
key: "stage.startingEnvironment",
|
|
13
|
+
fallback: "Starting assistant environment..."
|
|
14
|
+
},
|
|
15
|
+
preparingSession: {
|
|
16
|
+
key: "stage.preparingSession",
|
|
17
|
+
fallback: "Preparing session..."
|
|
18
|
+
},
|
|
19
|
+
connecting: {
|
|
20
|
+
key: "stage.connecting",
|
|
21
|
+
fallback: "Connecting to assistant..."
|
|
22
|
+
},
|
|
23
|
+
thinking: {
|
|
24
|
+
key: "stage.thinking",
|
|
25
|
+
fallback: "Thinking..."
|
|
26
|
+
},
|
|
27
|
+
stopped: {
|
|
28
|
+
key: "stage.stopped",
|
|
29
|
+
fallback: "Stopped"
|
|
30
|
+
}
|
|
31
|
+
}, t = [
|
|
32
|
+
e.thinking,
|
|
33
|
+
{
|
|
34
|
+
key: "stage.pondering",
|
|
35
|
+
fallback: "Pondering..."
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
key: "stage.reasoning",
|
|
39
|
+
fallback: "Reasoning..."
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
key: "stage.inferring",
|
|
43
|
+
fallback: "Inferring..."
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
key: "stage.considering",
|
|
47
|
+
fallback: "Considering..."
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
key: "stage.working",
|
|
51
|
+
fallback: "Working..."
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
key: "stage.reflecting",
|
|
55
|
+
fallback: "Reflecting..."
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
key: "stage.deliberating",
|
|
59
|
+
fallback: "Deliberating..."
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
key: "stage.weighing",
|
|
63
|
+
fallback: "Weighing it up..."
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
key: "stage.piecing",
|
|
67
|
+
fallback: "Piecing it together..."
|
|
68
|
+
}
|
|
69
|
+
], n = 2500;
|
|
70
|
+
function r(e, t) {
|
|
71
|
+
return e(t.key, t.fallback);
|
|
72
|
+
}
|
|
73
|
+
function i(e, i) {
|
|
74
|
+
return r(e, t[Math.floor((Number.isFinite(i) ? Math.max(0, i) : 0) / n) % t.length]);
|
|
75
|
+
}
|
|
76
|
+
function a(t, n) {
|
|
77
|
+
switch (n) {
|
|
78
|
+
case "provisioning": return r(t, e.startingEnvironment);
|
|
79
|
+
case "connecting": return r(t, e.connecting);
|
|
80
|
+
case "streaming": return r(t, e.thinking);
|
|
81
|
+
default: return "";
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
var o = [
|
|
85
|
+
e.reusingEnvironment,
|
|
86
|
+
e.lookingForEnvironment,
|
|
87
|
+
e.startingEnvironment,
|
|
88
|
+
e.preparingSession,
|
|
89
|
+
e.connecting,
|
|
90
|
+
...t
|
|
91
|
+
];
|
|
92
|
+
function s(e, t) {
|
|
93
|
+
let n = (t ?? "").trim();
|
|
94
|
+
return n ? o.some((t) => e(t.key, t.fallback) === n || t.fallback === n) : !0;
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
export { n as PHRASE_ROTATE_MS, e as STAGE_COPY, t as THINKING_PHRASES, s as isStageCopy, r as stageText, a as statusStageCopy, i as thinkingPhrase };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantChatArea.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantChatArea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;AAyEf,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"AssistantChatArea.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantChatArea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;AAyEf,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAgLvE;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACpC;AAED,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAg9DxD,CAAC"}
|
|
@@ -10,65 +10,66 @@ import { pollDelayMs as ie } from "../voice/assistantPollSchedule.js";
|
|
|
10
10
|
import { toCaptionText as b } from "../voice/captionText.js";
|
|
11
11
|
import { resolveAssistantLanguage as ae } from "../voice/languages.js";
|
|
12
12
|
import { resolveLanguagePair as oe } from "../voice/languagePair.js";
|
|
13
|
-
import { findPendingWrite as
|
|
14
|
-
import { useAssistantProduct as
|
|
15
|
-
import { useAssistantTr as
|
|
16
|
-
import { buildPromptParts as
|
|
17
|
-
import { useAssistantStore as
|
|
18
|
-
import { isTurnInFlight as
|
|
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 {
|
|
13
|
+
import { findPendingWrite as x } from "../pendingWrite.js";
|
|
14
|
+
import { useAssistantProduct as se } from "../product.js";
|
|
15
|
+
import { useAssistantTr as ce } from "../i18n.js";
|
|
16
|
+
import { buildPromptParts as le, buildPromptWithAttachments as ue, countInlineImageCandidates as de, countInlinedImageParts as fe, getSendableAttachments as pe, toMessageAttachment as me } from "../attachments.js";
|
|
17
|
+
import { useAssistantStore as S } from "../store.js";
|
|
18
|
+
import { isTurnInFlight as he, planAbandonedTurn as ge, planTurnAbort as _e } from "../turnState.js";
|
|
19
|
+
import { STAGE_COPY as C, isStageCopy as ve, stageText as w, statusStageCopy as ye, thinkingPhrase as be } from "../stageCopy.js";
|
|
20
|
+
import { parseToolActivity as xe } from "./AssistantToolActivity.js";
|
|
21
|
+
import { useVoiceSession as Se } from "./useVoiceSession.js";
|
|
22
|
+
import { getOrganizationId as Ce, getWorkspaceId as we } from "../context.js";
|
|
23
|
+
import { createReadinessTracker as Te } from "../sandboxReadiness.js";
|
|
24
|
+
import { AssistantSpokenTurnsNotice as Ee } from "./AssistantSpokenTurnsNotice.js";
|
|
25
|
+
import { VoiceTranscriptDrawer as De } from "./voice/VoiceTranscriptDrawer.js";
|
|
26
|
+
import { downloadFile as Oe } from "../exportConversation.js";
|
|
27
|
+
import { AssistantEmptyState as ke } from "./AssistantEmptyState.js";
|
|
28
|
+
import { AssistantMessageList as Ae } from "./AssistantMessageList.js";
|
|
29
|
+
import { AssistantVoiceSession as je } from "./voice/AssistantVoiceSession.js";
|
|
30
|
+
import { useAssistantApiAccess as Me } from "../useAssistantApiAccess.js";
|
|
31
|
+
import { useConversationTurns as Ne } from "../useConversationTurns.js";
|
|
32
|
+
import { isMultimodalBodyRejection as Pe, isRecoverableAssistantError as Fe } from "../transportErrors.js";
|
|
33
|
+
import { dispatchAssistantQuotaExhausted as Ie, notifyAiCreditsUpdated as Le } from "../aiCredits.js";
|
|
34
|
+
import { useAssistantAttachments as Re } from "../useAssistantAttachments.js";
|
|
35
|
+
import { AssistantComposer as ze } from "./composer/AssistantComposer.js";
|
|
36
|
+
import { isProdRuntime as Be } from "../env.js";
|
|
37
|
+
import { AssistantApiCallsConsentDialog as Ve } from "./AssistantApiCallsConsentDialog.js";
|
|
38
|
+
import { useCallback as T, useEffect as E, useMemo as D, useRef as O, useState as He } from "react";
|
|
39
|
+
import { jsx as k, jsxs as Ue } from "react/jsx-runtime";
|
|
39
40
|
//#region src/shared/assistant/ui/AssistantChatArea.tsx
|
|
40
|
-
var
|
|
41
|
+
var We = {
|
|
41
42
|
general: 18e4,
|
|
42
43
|
assistant: 18e4,
|
|
43
44
|
"api-calls": 18e4,
|
|
44
45
|
"vibe-plugins": 6e5
|
|
45
|
-
},
|
|
46
|
-
function
|
|
46
|
+
}, Ge = 18e4, Ke = 600, qe = 2e4;
|
|
47
|
+
function Je() {
|
|
47
48
|
return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
48
49
|
}
|
|
49
|
-
function
|
|
50
|
+
function Ye(e) {
|
|
50
51
|
return e.info?.time?.created ?? 0;
|
|
51
52
|
}
|
|
52
|
-
function
|
|
53
|
+
function A(e) {
|
|
53
54
|
return (e ?? []).filter((e) => e.type === "text" && typeof e.text == "string").map((e) => e.text?.trim() ?? "").filter(Boolean).join("\n");
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
+
function j(e) {
|
|
56
57
|
return (e ?? []).filter((e) => e.type === "tool" && e.tool).map((e) => {
|
|
57
58
|
let t = e.state?.status ?? "running", n = e.tool ?? "tool";
|
|
58
59
|
return t === "completed" ? `Completed: ${n}` : t === "failed" ? `Failed: ${n}` : `Running: ${n}`;
|
|
59
60
|
});
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
-
let n = e.filter((e) => e.info?.role === "assistant" &&
|
|
62
|
+
function Xe(e, t) {
|
|
63
|
+
let n = e.filter((e) => e.info?.role === "assistant" && Ye(e) > t).sort((e, t) => Ye(e) - Ye(t));
|
|
63
64
|
if (n.length === 0) return {
|
|
64
|
-
content:
|
|
65
|
+
content: C.thinking.fallback,
|
|
65
66
|
done: !1
|
|
66
67
|
};
|
|
67
|
-
let r = n[n.length - 1], i =
|
|
68
|
+
let r = n[n.length - 1], i = A(r.parts), a = h(r.parts), o = j(r.parts), s = x(r.parts), c = [
|
|
68
69
|
i,
|
|
69
70
|
...a,
|
|
70
71
|
...o
|
|
71
|
-
].filter(Boolean).join("\n\n") ||
|
|
72
|
+
].filter(Boolean).join("\n\n") || C.thinking.fallback, l = r.info?.providerID, u = r.info?.modelID;
|
|
72
73
|
return {
|
|
73
74
|
content: c,
|
|
74
75
|
done: !!r.info?.time?.completed && (!!i || a.length > 0 || o.length > 0),
|
|
@@ -78,150 +79,159 @@ function Ke(e, t) {
|
|
|
78
79
|
...s ? { pendingWrite: s } : {}
|
|
79
80
|
};
|
|
80
81
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
var j = ({ visible: h = !0, writeAccess: se = "unknown" }) => {
|
|
90
|
-
let k = le(), { product: A, modes: j, gatherPageContext: Je, buildPrompt: Ye, reportTokenUsage: Xe } = ce(), { getAccessToken: M, getWorkspaceToken: N, userId: P } = t(), { locale: Ze } = e(), Qe = x((e) => e.assistantLanguage), $e = x((e) => e.replyLanguage), et = w(() => oe(Qe, $e, Ze), [
|
|
91
|
-
Qe,
|
|
92
|
-
$e,
|
|
93
|
-
Ze
|
|
94
|
-
]), tt = et.reply.english, nt = et.replyIsExplicit, rt = et.reply.code, { conversations: it, activeConversationId: F, mode: I, processingByConversationId: at, setMode: L, setConversationMode: R, setActiveConversation: ot, createConversation: z, addMessage: B, updateMessage: st, patchMessage: V, mergeMessageMetadata: ct, setConversationProcessing: H, clearConversationProcessing: lt, setBackendSessionId: ut, clearBackendSessionId: U, setSandbox: W, clearSandbox: dt, acknowledgeApiCalls: ft } = x(), pt = it.find((e) => e.id === F), G = je(pt), mt = G.all, ht = F ? at[F] : void 0, gt = ge(ht?.status), _t = gt ? ht?.messageId ?? null : null, vt = ht?.status === "error" ? ht.messageId : null, { canUseApiCalls: yt, loading: bt } = Ae(xe()), xt = w(() => j.filter((e) => !e.requiresAdmin || yt), [j, yt]), [St, Ct] = Be(null), [wt, Tt] = Be(!1), Et = T({}), Dt = T(Ce()), Ot = T(/* @__PURE__ */ new Set()), kt = w(() => j.find((e) => e.id === I), [j, I]);
|
|
95
|
-
C(() => {
|
|
96
|
-
bt || (!kt || kt.requiresAdmin && !yt) && I !== "assistant" && L("assistant");
|
|
82
|
+
var M = ({ visible: h = !0, writeAccess: x = "unknown" }) => {
|
|
83
|
+
let A = ce(), { product: j, modes: M, gatherPageContext: Ze, buildPrompt: Qe, reportTokenUsage: $e } = se(), { getAccessToken: N, getWorkspaceToken: P, userId: F } = t(), { locale: et } = e(), tt = S((e) => e.assistantLanguage), nt = S((e) => e.replyLanguage), rt = D(() => oe(tt, nt, et), [
|
|
84
|
+
tt,
|
|
85
|
+
nt,
|
|
86
|
+
et
|
|
87
|
+
]), it = rt.reply.english, at = rt.replyIsExplicit, ot = rt.reply.code, { conversations: st, activeConversationId: I, mode: L, processingByConversationId: ct, setMode: lt, setConversationMode: ut, setActiveConversation: dt, createConversation: R, addMessage: z, updateMessage: B, patchMessage: V, mergeMessageMetadata: ft, setConversationProcessing: H, clearConversationProcessing: pt, setBackendSessionId: mt, clearBackendSessionId: ht, setSandbox: U, clearSandbox: gt, acknowledgeApiCalls: _t } = S(), vt = st.find((e) => e.id === I), W = Ne(vt), yt = W.all, bt = I ? ct[I] : void 0, xt = he(bt?.status), St = xt ? bt?.messageId ?? null : null, Ct = bt?.status === "error" ? bt.messageId : null, { canUseApiCalls: wt, loading: Tt } = Me(Ce()), Et = D(() => M.filter((e) => !e.requiresAdmin || wt), [M, wt]), [Dt, Ot] = He(null), [kt, At] = He(!1), jt = O({}), Mt = O(Te()), Nt = O(/* @__PURE__ */ new Set()), Pt = D(() => M.find((e) => e.id === L), [M, L]);
|
|
88
|
+
E(() => {
|
|
89
|
+
Tt || (!Pt || Pt.requiresAdmin && !wt) && L !== "assistant" && lt("assistant");
|
|
97
90
|
}, [
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
91
|
+
L,
|
|
92
|
+
Pt,
|
|
93
|
+
wt,
|
|
94
|
+
Tt,
|
|
95
|
+
lt
|
|
103
96
|
]);
|
|
104
|
-
let
|
|
105
|
-
H(e, n, t, null), r ?
|
|
106
|
-
}, [
|
|
107
|
-
|
|
108
|
-
|
|
97
|
+
let G = T((e, t, n, r) => {
|
|
98
|
+
H(e, n, t, null), r ? B(e, t, r) : B(e, t, ye(A, n));
|
|
99
|
+
}, [
|
|
100
|
+
H,
|
|
101
|
+
B,
|
|
102
|
+
A
|
|
103
|
+
]), Ft = T(async (e, t, n, r, i) => {
|
|
104
|
+
let s = S.getState().sandboxesByMode[n]?.sandboxId ?? null, l = async (e) => {
|
|
105
|
+
if (Mt.current.isFresh(e)) return !0;
|
|
109
106
|
try {
|
|
110
|
-
return await m(e, r, i, 3e5), await p(e, r, i, 9e4),
|
|
107
|
+
return await m(e, r, i, 3e5), await p(e, r, i, 9e4), Mt.current.markVerified(e), !0;
|
|
111
108
|
} catch {
|
|
112
|
-
return
|
|
109
|
+
return Mt.current.invalidate(e), !1;
|
|
113
110
|
}
|
|
114
111
|
};
|
|
115
|
-
if (s && (
|
|
116
|
-
|
|
117
|
-
let a = await c(r,
|
|
118
|
-
a && (
|
|
112
|
+
if (s && (U(n, s, "provisioning"), G(e, t, "provisioning", w(A, C.reusingEnvironment)), await l(s) || (U(n, null, "provisioning"), s = null)), !s) {
|
|
113
|
+
G(e, t, "provisioning", w(A, C.lookingForEnvironment));
|
|
114
|
+
let a = await c(r, j, n, Be(), i);
|
|
115
|
+
a && (U(n, a, "provisioning"), G(e, t, "provisioning", w(A, C.reusingEnvironment)), await l(a) ? s = a : U(n, null, "provisioning"));
|
|
119
116
|
}
|
|
120
117
|
if (!s) {
|
|
121
|
-
if (n === "api-calls" && !
|
|
122
|
-
|
|
118
|
+
if (n === "api-calls" && !N()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
|
|
119
|
+
G(e, t, "provisioning", w(A, C.startingEnvironment)), U(n, null, "provisioning"), await f(r, j, n, Be(), i), s = await a(j, n, r, Be(), Ke, i), U(n, s, "provisioning"), await m(s, r, i, 3e5), await p(s, r, i, 9e4);
|
|
123
120
|
}
|
|
124
|
-
|
|
125
|
-
let u =
|
|
121
|
+
U(n, s, "running");
|
|
122
|
+
let u = S.getState().conversations.find((t) => t.id === e)?.backendSessionId ?? null;
|
|
126
123
|
if (u) try {
|
|
127
124
|
let e = await d(s, r, u, i);
|
|
128
125
|
if (e.mode !== n) throw Error(`Session mode mismatch: expected ${n}, received ${e.mode}`);
|
|
129
126
|
} catch {
|
|
130
|
-
|
|
127
|
+
ht(e), u = null;
|
|
131
128
|
}
|
|
132
|
-
return u || (
|
|
129
|
+
return u || (G(e, t, "connecting", w(A, C.preparingSession)), u = (await o(s, r, n, i)).sessionId, mt(e, u)), {
|
|
133
130
|
sandboxId: s,
|
|
134
131
|
sessionId: u
|
|
135
132
|
};
|
|
136
133
|
}, [
|
|
134
|
+
ht,
|
|
135
|
+
N,
|
|
136
|
+
j,
|
|
137
|
+
mt,
|
|
137
138
|
U,
|
|
138
|
-
M,
|
|
139
139
|
A,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
]), [jt, Mt] = Be(null), Nt = T(/* @__PURE__ */ new Set()), Pt = S(() => {
|
|
144
|
-
let e = x.getState(), t = e.activeConversationId;
|
|
140
|
+
G
|
|
141
|
+
]), [It, Lt] = He(null), K = O(/* @__PURE__ */ new Set()), Rt = O(null), zt = T(() => {
|
|
142
|
+
let e = S.getState(), t = e.activeConversationId;
|
|
145
143
|
if (!t) return;
|
|
146
|
-
let n = e.processingByConversationId[t], i =
|
|
147
|
-
if (!
|
|
144
|
+
let n = e.processingByConversationId[t], i = he(n?.status) ? n?.messageId ?? null : null;
|
|
145
|
+
if (!_e({
|
|
148
146
|
interruptedTurnId: i,
|
|
149
147
|
activeTurnId: i,
|
|
150
|
-
alreadyRequested: i ?
|
|
148
|
+
alreadyRequested: i ? K.current.has(i) : !1
|
|
151
149
|
}).send || !i) return;
|
|
152
|
-
|
|
153
|
-
let a = e.sandboxesByMode[e.mode]?.sandboxId, o =
|
|
150
|
+
K.current.add(i);
|
|
151
|
+
let a = e.sandboxesByMode[e.mode]?.sandboxId, o = we(), s = e.conversations.find((e) => e.id === t)?.backendSessionId;
|
|
154
152
|
!a || !o || !s || r(a, o, s, {
|
|
155
|
-
accessToken:
|
|
156
|
-
workspaceToken:
|
|
157
|
-
userId:
|
|
158
|
-
organizationId:
|
|
153
|
+
accessToken: N(),
|
|
154
|
+
workspaceToken: P(),
|
|
155
|
+
userId: F,
|
|
156
|
+
organizationId: Ce()
|
|
159
157
|
});
|
|
160
158
|
}, [
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
]),
|
|
165
|
-
let t =
|
|
159
|
+
F,
|
|
160
|
+
N,
|
|
161
|
+
P
|
|
162
|
+
]), Bt = T(async (e) => {
|
|
163
|
+
let t = S.getState(), n = t.sandboxesByMode[t.mode]?.sandboxId, r = we(), a = t.activeConversationId;
|
|
166
164
|
if (!(!n || !r || !a)) {
|
|
167
|
-
|
|
165
|
+
Lt(e);
|
|
168
166
|
try {
|
|
169
167
|
await i(n, r, e, {
|
|
170
|
-
accessToken:
|
|
171
|
-
workspaceToken:
|
|
172
|
-
userId:
|
|
173
|
-
organizationId:
|
|
168
|
+
accessToken: N(),
|
|
169
|
+
workspaceToken: P(),
|
|
170
|
+
userId: F,
|
|
171
|
+
organizationId: Ce()
|
|
174
172
|
});
|
|
175
173
|
} catch (e) {
|
|
176
|
-
|
|
177
|
-
id:
|
|
174
|
+
Lt(null), z(a, {
|
|
175
|
+
id: Je(),
|
|
178
176
|
role: "system",
|
|
179
177
|
content: e instanceof Error ? e.message : "The change could not be approved.",
|
|
180
178
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
181
179
|
});
|
|
182
180
|
return;
|
|
183
181
|
}
|
|
184
|
-
|
|
182
|
+
Lt(null), J.current(A("pendingWrite.approvedPrompt", "I approved that change — go ahead."));
|
|
185
183
|
}
|
|
186
184
|
}, [
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
]), q =
|
|
191
|
-
let i = r.voiceSessionId !== void 0, a =
|
|
192
|
-
if (o
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
185
|
+
F,
|
|
186
|
+
z,
|
|
187
|
+
A
|
|
188
|
+
]), q = T(async (e, t = [], r = {}) => {
|
|
189
|
+
let i = r.voiceSessionId !== void 0, a = S.getState(), o = a.activeConversationId ?? I;
|
|
190
|
+
if (o) {
|
|
191
|
+
if (he(a.processingByConversationId[o]?.status)) {
|
|
192
|
+
let n = a.processingByConversationId[o]?.messageId ?? null;
|
|
193
|
+
n && K.current.has(n) && (Rt.current = {
|
|
194
|
+
conversationId: o,
|
|
195
|
+
content: e,
|
|
196
|
+
attachments: t,
|
|
197
|
+
options: r
|
|
198
|
+
});
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (Nt.current.has(o)) return;
|
|
202
|
+
}
|
|
203
|
+
let c = a.mode, d = I, f = d ? S.getState().conversations.find((e) => e.id === d) : void 0;
|
|
204
|
+
if (d ? f && f.mode !== c && (f.messages.length > 0 || f.backendSessionId) ? d = R(void 0, c) : f && f.mode !== c && ut(d, c) : d = R(void 0, c), !d) return;
|
|
205
|
+
jt.current[d] = t;
|
|
206
|
+
let p = we(), m = {
|
|
207
|
+
accessToken: N(),
|
|
208
|
+
workspaceToken: P(),
|
|
209
|
+
userId: F,
|
|
210
|
+
organizationId: Ce()
|
|
201
211
|
}, h = {
|
|
202
|
-
id:
|
|
212
|
+
id: Je(),
|
|
203
213
|
role: "user",
|
|
204
214
|
content: e,
|
|
205
215
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
206
216
|
metadata: {
|
|
207
|
-
...t.length ? { attachments: t.map(
|
|
217
|
+
...t.length ? { attachments: t.map(me) } : {},
|
|
208
218
|
..._(r.voiceSessionId)
|
|
209
219
|
}
|
|
210
220
|
};
|
|
211
|
-
|
|
212
|
-
let g =
|
|
213
|
-
|
|
221
|
+
z(d, h);
|
|
222
|
+
let g = Je();
|
|
223
|
+
z(d, {
|
|
214
224
|
id: g,
|
|
215
225
|
role: "assistant",
|
|
216
226
|
content: "",
|
|
217
227
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
218
228
|
metadata: {
|
|
219
|
-
lang:
|
|
229
|
+
lang: ot,
|
|
220
230
|
..._(r.voiceSessionId)
|
|
221
231
|
}
|
|
222
232
|
}), H(d, "provisioning", g, null);
|
|
223
|
-
let ne = (e, t, n, i, a =
|
|
224
|
-
V(d, g, { content: te(e) }),
|
|
233
|
+
let ne = (e, t, n, i, a = ot) => {
|
|
234
|
+
V(d, g, { content: te(e) }), ft(d, g, {
|
|
225
235
|
lang: a,
|
|
226
236
|
...t?.length ? { artifacts: t } : {},
|
|
227
237
|
...t?.length || n || i ? { mode: c } : {},
|
|
@@ -232,162 +242,168 @@ var j = ({ visible: h = !0, writeAccess: se = "unknown" }) => {
|
|
|
232
242
|
}, v = async (n = 1) => {
|
|
233
243
|
let r = !1;
|
|
234
244
|
try {
|
|
235
|
-
let { sandboxId: n, sessionId: a } = await
|
|
236
|
-
|
|
237
|
-
let f =
|
|
238
|
-
r =
|
|
245
|
+
let { sandboxId: n, sessionId: a } = await Ft(d, g, c, p, m), o = (await u(n, p, a, m, { limit: 50 }).catch(() => [])).reduce((e, t) => Math.max(e, Ye(t)), 0);
|
|
246
|
+
G(d, g, "streaming", w(A, C.thinking));
|
|
247
|
+
let f = ue(e, t), h = Qe?.(c, f, it, at, i) ?? f, _ = le(h, t), v = fe(_), y = v > 0, re = Ze?.();
|
|
248
|
+
r = de(t) > v;
|
|
239
249
|
try {
|
|
240
250
|
await ee(n, p, a, h, c, re, m, _?.length ? { parts: _ } : void 0);
|
|
241
251
|
} catch (e) {
|
|
242
|
-
if (!_ || !
|
|
252
|
+
if (!_ || !Pe(e)) throw e;
|
|
243
253
|
await ee(n, p, a, h, c, re, m, void 0), r ||= y;
|
|
244
254
|
}
|
|
245
|
-
let b =
|
|
255
|
+
let b = Xe([], o), ae = Date.now() + (We[c] ?? Ge), oe = Date.now(), x = Date.now(), se = () => ge({
|
|
246
256
|
turnId: g,
|
|
247
|
-
abortRequested:
|
|
248
|
-
activeTurnId:
|
|
249
|
-
})
|
|
257
|
+
abortRequested: K.current.has(g),
|
|
258
|
+
activeTurnId: S.getState().processingByConversationId[d]?.messageId ?? null
|
|
259
|
+
}), ce = () => {
|
|
260
|
+
let e = S.getState().conversations.find((e) => e.id === d)?.messages.find((e) => e.id === g)?.content;
|
|
261
|
+
ve(A, e) && B(d, g, w(A, C.stopped));
|
|
262
|
+
};
|
|
250
263
|
for (; Date.now() < ae;) {
|
|
251
|
-
let e =
|
|
264
|
+
let e = se();
|
|
252
265
|
if (e.abandon) {
|
|
253
|
-
e.clearProcessing &&
|
|
266
|
+
ce(), e.clearProcessing && pt(d);
|
|
254
267
|
return;
|
|
255
268
|
}
|
|
256
|
-
if (b =
|
|
269
|
+
if (b = Xe(await u(n, p, a, m, {
|
|
257
270
|
limit: 50,
|
|
258
271
|
sinceMs: o
|
|
259
|
-
}), o), V(d, g, { content: te(b.content) }), b.pendingWrite &&
|
|
260
|
-
Date.now() - oe > 3e4 && (await s(n, p, 600, m).catch(() => void 0), oe = Date.now()), await new Promise((e) => setTimeout(e, ie(Date.now() -
|
|
272
|
+
}), o), V(d, g, { content: ve(A, b.content) ? be(A, Date.now() - x) : te(b.content) }), b.pendingWrite && ft(d, g, { pendingWrite: b.pendingWrite }), b.done) break;
|
|
273
|
+
Date.now() - oe > 3e4 && (await s(n, p, 600, m).catch(() => void 0), oe = Date.now()), await new Promise((e) => setTimeout(e, ie(Date.now() - x)));
|
|
261
274
|
}
|
|
262
275
|
if (!b.done && c !== "vibe-plugins") throw Error("Assistant response timed out while streaming progress");
|
|
263
|
-
let
|
|
276
|
+
let pe = c === "vibe-plugins" ? await l(n, p, a, m).then((e) => e).catch(() => []) : void 0;
|
|
264
277
|
if (b.done || (b = {
|
|
265
278
|
...b,
|
|
266
279
|
content: `${b.content}\n\n_Still building in the background — any artifacts below will finish shortly. Re-open this conversation to pick up the completed plugin._`
|
|
267
280
|
}), r && (b = {
|
|
268
281
|
...b,
|
|
269
|
-
content: `${b.content}\n\n${
|
|
270
|
-
}), ne(b.content,
|
|
282
|
+
content: `${b.content}\n\n${A("attachments.imagesNotSent", "_Your photo was too large to include with this message, so the answer above is from the text and the file link only. Try a smaller or more tightly cropped photo._")}`
|
|
283
|
+
}), ne(b.content, pe, a, n), b.tokens) {
|
|
271
284
|
V(d, g, { tokens: b.tokens });
|
|
272
285
|
try {
|
|
273
|
-
await
|
|
286
|
+
await $e?.({
|
|
274
287
|
workspaceId: p,
|
|
275
288
|
sessionId: a,
|
|
276
289
|
messageId: b.messageId,
|
|
277
290
|
model: b.model,
|
|
278
291
|
tokens: b.tokens
|
|
279
|
-
}),
|
|
292
|
+
}), Le(j);
|
|
280
293
|
} catch {}
|
|
281
294
|
}
|
|
282
|
-
let me =
|
|
295
|
+
let me = se();
|
|
283
296
|
if (me.abandon) {
|
|
284
|
-
me.clearProcessing &&
|
|
297
|
+
ce(), me.clearProcessing && pt(d);
|
|
285
298
|
return;
|
|
286
299
|
}
|
|
287
300
|
H(d, "complete", g, null);
|
|
288
301
|
} catch (e) {
|
|
289
|
-
if (n === 1 &&
|
|
302
|
+
if (n === 1 && Fe(e)) return ht(d), gt(c), v(2);
|
|
290
303
|
throw e;
|
|
291
304
|
}
|
|
292
305
|
}, y = d;
|
|
293
|
-
|
|
306
|
+
Nt.current.add(y);
|
|
294
307
|
try {
|
|
295
308
|
if (!p) throw Error("Assistant backend is unavailable without an active workspace context.");
|
|
296
309
|
await v();
|
|
297
310
|
} catch (e) {
|
|
298
|
-
|
|
311
|
+
Mt.current.invalidate(S.getState().sandboxesByMode[c]?.sandboxId ?? null);
|
|
299
312
|
let t = n(e);
|
|
300
313
|
if (t) {
|
|
301
|
-
t.refusal === "exhausted" &&
|
|
314
|
+
t.refusal === "exhausted" && Ie(j, "sandbox");
|
|
302
315
|
let e = [t.quotaName, t.traceId ? `reference ${t.traceId}` : null].filter(Boolean).join(" · "), n = t.refusal === "exhausted" ? "You've reached your sandbox limit on the current plan. Upgrade to start the AI assistant." : "This workspace has no sandbox allowance provisioned, so the AI assistant cannot start. Upgrading will not help — ask an administrator to provision it.";
|
|
303
316
|
ne(e ? `${n}\n\n${e}` : n, void 0, void 0, void 0, "en"), H(d, "error", g, null);
|
|
304
317
|
return;
|
|
305
318
|
}
|
|
306
319
|
let i = e instanceof Error ? e.message : "Something went wrong";
|
|
307
|
-
H(d, "error", g, i), V(d, g, { content: `Sorry, an error occurred: ${i}. Please try again.` }),
|
|
320
|
+
H(d, "error", g, i), V(d, g, { content: `Sorry, an error occurred: ${i}. Please try again.` }), ft(d, g, {
|
|
308
321
|
lang: "en",
|
|
309
322
|
..._(r.voiceSessionId)
|
|
310
323
|
});
|
|
311
324
|
} finally {
|
|
312
|
-
|
|
325
|
+
Nt.current.delete(y);
|
|
326
|
+
let e = Rt.current;
|
|
327
|
+
Rt.current = null, e && e.conversationId === y && J.current(e.content, e.attachments, e.options);
|
|
313
328
|
}
|
|
314
329
|
}, [
|
|
315
|
-
|
|
316
|
-
B,
|
|
317
|
-
Ye,
|
|
318
|
-
U,
|
|
319
|
-
dt,
|
|
320
|
-
it,
|
|
330
|
+
I,
|
|
321
331
|
z,
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
332
|
+
Qe,
|
|
333
|
+
ht,
|
|
334
|
+
gt,
|
|
335
|
+
st,
|
|
336
|
+
R,
|
|
337
|
+
Ft,
|
|
338
|
+
Ze,
|
|
325
339
|
N,
|
|
340
|
+
P,
|
|
326
341
|
V,
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
342
|
+
j,
|
|
343
|
+
$e,
|
|
344
|
+
at,
|
|
345
|
+
ot,
|
|
346
|
+
it,
|
|
347
|
+
mt,
|
|
332
348
|
ut,
|
|
333
|
-
R,
|
|
334
349
|
H,
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
350
|
+
pt,
|
|
351
|
+
A,
|
|
352
|
+
G,
|
|
353
|
+
B,
|
|
354
|
+
F
|
|
355
|
+
]), Vt = T((e) => {
|
|
340
356
|
q(e);
|
|
341
|
-
}, [q]),
|
|
342
|
-
let e = [...
|
|
357
|
+
}, [q]), Ht = T(() => {
|
|
358
|
+
let e = [...W.chat].reverse().find((e) => e.role === "user"), t = I ? jt.current[I] ?? [] : [];
|
|
343
359
|
e && q(e.content, t);
|
|
344
360
|
}, [
|
|
345
|
-
|
|
361
|
+
yt,
|
|
346
362
|
q,
|
|
347
|
-
|
|
348
|
-
]), J =
|
|
349
|
-
|
|
363
|
+
I
|
|
364
|
+
]), J = O(q);
|
|
365
|
+
E(() => {
|
|
350
366
|
J.current = q;
|
|
351
367
|
}, [q]);
|
|
352
|
-
let
|
|
353
|
-
if (
|
|
354
|
-
for (let e =
|
|
355
|
-
let t =
|
|
356
|
-
if (t?.role !== "assistant" || !g(t)) continue;
|
|
357
|
-
let n =
|
|
368
|
+
let Ut = D(() => {
|
|
369
|
+
if (xt) return null;
|
|
370
|
+
for (let e = yt.length - 1; e >= 0; --e) {
|
|
371
|
+
let t = yt[e];
|
|
372
|
+
if (t?.role !== "assistant" || !g(t) || K.current.has(t.id)) continue;
|
|
373
|
+
let n = xe(t.content).text.trim();
|
|
358
374
|
return n ? {
|
|
359
375
|
id: t.id,
|
|
360
376
|
text: n
|
|
361
377
|
} : null;
|
|
362
378
|
}
|
|
363
379
|
return null;
|
|
364
|
-
}, [
|
|
380
|
+
}, [yt, xt]), Wt = D(() => Ut ? b(Ut.text) : null, [Ut]), Gt = W.chat, Y = D(() => W.voice.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
|
|
365
381
|
id: e.id,
|
|
366
382
|
role: e.role,
|
|
367
|
-
text:
|
|
383
|
+
text: xe(e.content).text.trim(),
|
|
368
384
|
sessionId: ne(e),
|
|
369
385
|
timestamp: e.timestamp
|
|
370
|
-
})).filter((e) => e.text.length > 0), [
|
|
386
|
+
})).filter((e) => e.text.length > 0), [W.voice]), Kt = T(() => {
|
|
371
387
|
if (Y.length === 0) return;
|
|
372
388
|
let e = /* @__PURE__ */ new Date();
|
|
373
|
-
|
|
374
|
-
title:
|
|
375
|
-
savedAt:
|
|
376
|
-
session:
|
|
377
|
-
earlier:
|
|
378
|
-
you:
|
|
379
|
-
assistant:
|
|
380
|
-
}, e), re(
|
|
389
|
+
Oe(y(Y, {
|
|
390
|
+
title: A("voiceSession.transcript", "Voice conversation"),
|
|
391
|
+
savedAt: A("voiceSession.savedAt", "Saved"),
|
|
392
|
+
session: A("voiceSession.sessionLabel", "Session"),
|
|
393
|
+
earlier: A("voiceSession.earlierLabel", "Earlier"),
|
|
394
|
+
you: A("voiceSession.speakerYou", "You"),
|
|
395
|
+
assistant: A("voiceSession.speakerAssistant", "Assistant")
|
|
396
|
+
}, e), re(j, e), "text/markdown");
|
|
381
397
|
}, [
|
|
382
|
-
|
|
398
|
+
j,
|
|
383
399
|
Y,
|
|
384
|
-
|
|
385
|
-
]), X =
|
|
400
|
+
A
|
|
401
|
+
]), X = Re(), Z = O(X);
|
|
386
402
|
Z.current = X;
|
|
387
|
-
let Q =
|
|
388
|
-
onSubmit:
|
|
403
|
+
let Q = Se({
|
|
404
|
+
onSubmit: T((e, t) => {
|
|
389
405
|
let n = () => {
|
|
390
|
-
let n = Z.current, r =
|
|
406
|
+
let n = Z.current, r = pe(n.attachments);
|
|
391
407
|
J.current(e, r, { voiceSessionId: t }), n.clear();
|
|
392
408
|
};
|
|
393
409
|
if (!Z.current.isBusy) {
|
|
@@ -395,127 +411,127 @@ var j = ({ visible: h = !0, writeAccess: se = "unknown" }) => {
|
|
|
395
411
|
return;
|
|
396
412
|
}
|
|
397
413
|
let r = Date.now(), i = window.setInterval(() => {
|
|
398
|
-
Z.current.isBusy && Date.now() - r <
|
|
414
|
+
Z.current.isBusy && Date.now() - r < qe || (window.clearInterval(i), n());
|
|
399
415
|
}, 200);
|
|
400
416
|
}, []),
|
|
401
|
-
latestReply:
|
|
402
|
-
language: ae(
|
|
403
|
-
}),
|
|
404
|
-
let e =
|
|
405
|
-
!e || Y.length === 0 || (
|
|
406
|
-
id:
|
|
417
|
+
latestReply: Ut,
|
|
418
|
+
language: ae(tt, et).tag
|
|
419
|
+
}), qt = D(() => (vt?.messages ?? []).reduce((e, t) => Math.max(e, t.metadata?.continuedVoiceTurns ?? 0), 0), [vt?.messages]), Jt = Y.length > qt, Yt = T(() => {
|
|
420
|
+
let e = S.getState().activeConversationId;
|
|
421
|
+
!e || Y.length === 0 || (z(e, {
|
|
422
|
+
id: Je(),
|
|
407
423
|
role: "system",
|
|
408
|
-
content: v(Y.slice(
|
|
409
|
-
intro:
|
|
410
|
-
nothing:
|
|
411
|
-
more: (e) =>
|
|
424
|
+
content: v(Y.slice(qt), {
|
|
425
|
+
intro: A("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
|
|
426
|
+
nothing: A("voiceSession.continuedNothing", "Continued from a voice conversation."),
|
|
427
|
+
more: (e) => A("voiceSession.continuedMore", "…and {{count}} more", { count: e })
|
|
412
428
|
}),
|
|
413
429
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
414
430
|
metadata: { continuedVoiceTurns: Y.length }
|
|
415
|
-
}),
|
|
431
|
+
}), At(!1), Q.end());
|
|
416
432
|
}, [
|
|
417
433
|
Y,
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
434
|
+
qt,
|
|
435
|
+
z,
|
|
436
|
+
A,
|
|
421
437
|
Q
|
|
422
|
-
]),
|
|
423
|
-
|
|
424
|
-
Q.active && (
|
|
438
|
+
]), Xt = O(0);
|
|
439
|
+
E(() => {
|
|
440
|
+
Q.active && (Xt.current = Y.length);
|
|
425
441
|
}, [Q.active]);
|
|
426
|
-
let
|
|
427
|
-
let e = Y.length >
|
|
428
|
-
Q.end(), e &&
|
|
442
|
+
let Zt = T(() => {
|
|
443
|
+
let e = Y.length > Xt.current;
|
|
444
|
+
Q.end(), e && At(!0);
|
|
429
445
|
}, [Y, Q]);
|
|
430
|
-
|
|
446
|
+
E(() => {
|
|
431
447
|
!h && Q.active && Q.end();
|
|
432
|
-
}, [h, Q]),
|
|
433
|
-
Q.active || Z.current.clear();
|
|
434
|
-
}, [Q.active]),
|
|
435
|
-
let e =
|
|
436
|
-
return e && J.current(e),
|
|
448
|
+
}, [h, Q]), E(() => {
|
|
449
|
+
Q.active || (Z.current.clear(), Rt.current = null);
|
|
450
|
+
}, [Q.active]), E(() => {
|
|
451
|
+
let e = S.getState().consumePendingPrompt();
|
|
452
|
+
return e && J.current(e), S.subscribe((e, t) => {
|
|
437
453
|
if (e.pendingPrompt && e.pendingPrompt !== t.pendingPrompt) {
|
|
438
|
-
let e =
|
|
454
|
+
let e = S.getState().consumePendingPrompt();
|
|
439
455
|
e && J.current(e);
|
|
440
456
|
}
|
|
441
457
|
});
|
|
442
458
|
}, []);
|
|
443
|
-
let $ =
|
|
444
|
-
let t =
|
|
459
|
+
let $ = T((e) => {
|
|
460
|
+
let t = I ? S.getState().conversations.find((e) => e.id === I) : void 0;
|
|
445
461
|
if (t && (t.messages.length > 0 || t.backendSessionId)) {
|
|
446
462
|
if (t.mode !== e) {
|
|
447
|
-
let t =
|
|
448
|
-
t ?
|
|
463
|
+
let t = S.getState().conversations.find((t) => t.mode === e && t.messages.length === 0 && !t.backendSessionId && !S.getState().processingByConversationId[t.id]);
|
|
464
|
+
t ? dt(t.id) : R(void 0, e);
|
|
449
465
|
}
|
|
450
|
-
} else
|
|
451
|
-
|
|
466
|
+
} else I && ut(I, e);
|
|
467
|
+
lt(e);
|
|
452
468
|
}, [
|
|
453
|
-
|
|
454
|
-
z,
|
|
455
|
-
ot,
|
|
469
|
+
I,
|
|
456
470
|
R,
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
471
|
+
dt,
|
|
472
|
+
ut,
|
|
473
|
+
lt
|
|
474
|
+
]), Qt = T((e) => {
|
|
475
|
+
if (M.find((t) => t.id === e)?.writeCapable && !S.getState().apiCallsAcknowledged) {
|
|
476
|
+
Ot(e);
|
|
461
477
|
return;
|
|
462
478
|
}
|
|
463
479
|
$(e);
|
|
464
|
-
}, [$,
|
|
465
|
-
let e =
|
|
466
|
-
|
|
480
|
+
}, [$, M]), $t = T(() => {
|
|
481
|
+
let e = Dt;
|
|
482
|
+
Ot(null), _t(), e && $(e);
|
|
467
483
|
}, [
|
|
468
|
-
|
|
469
|
-
|
|
484
|
+
Dt,
|
|
485
|
+
_t,
|
|
470
486
|
$
|
|
471
|
-
]),
|
|
472
|
-
|
|
487
|
+
]), en = T(() => {
|
|
488
|
+
Ot(null);
|
|
473
489
|
}, []);
|
|
474
|
-
return /* @__PURE__ */
|
|
490
|
+
return /* @__PURE__ */ Ue("div", {
|
|
475
491
|
className: "relative flex flex-1 flex-col overflow-hidden",
|
|
476
492
|
children: [
|
|
477
|
-
/* @__PURE__ */
|
|
493
|
+
/* @__PURE__ */ Ue("div", {
|
|
478
494
|
className: "contents",
|
|
479
495
|
inert: Q.active || void 0,
|
|
480
496
|
children: [
|
|
481
|
-
Y.length > 0 && !Q.active ? /* @__PURE__ */
|
|
497
|
+
Y.length > 0 && !Q.active ? /* @__PURE__ */ k(Ee, {
|
|
482
498
|
count: Y.length,
|
|
483
|
-
onOpenTranscript: () =>
|
|
499
|
+
onOpenTranscript: () => At(!0)
|
|
484
500
|
}) : null,
|
|
485
|
-
|
|
486
|
-
mode:
|
|
487
|
-
onSuggestionClick:
|
|
488
|
-
}) : /* @__PURE__ */
|
|
501
|
+
Gt.length === 0 ? /* @__PURE__ */ k(ke, {
|
|
502
|
+
mode: L,
|
|
503
|
+
onSuggestionClick: Vt
|
|
504
|
+
}) : /* @__PURE__ */ k("div", {
|
|
489
505
|
className: "flex min-h-0 flex-1 flex-col",
|
|
490
|
-
children: /* @__PURE__ */
|
|
491
|
-
onApprovePendingWrite:
|
|
492
|
-
approvingWriteRef:
|
|
493
|
-
messages:
|
|
494
|
-
streamingMessageId:
|
|
495
|
-
failedMessageId:
|
|
496
|
-
onRetry:
|
|
506
|
+
children: /* @__PURE__ */ k(Ae, {
|
|
507
|
+
onApprovePendingWrite: Bt,
|
|
508
|
+
approvingWriteRef: It,
|
|
509
|
+
messages: Gt,
|
|
510
|
+
streamingMessageId: St,
|
|
511
|
+
failedMessageId: Ct,
|
|
512
|
+
onRetry: Ht
|
|
497
513
|
})
|
|
498
514
|
}),
|
|
499
|
-
/* @__PURE__ */
|
|
500
|
-
onStartVoiceSession: Q.available &&
|
|
515
|
+
/* @__PURE__ */ k(ze, {
|
|
516
|
+
onStartVoiceSession: Q.available && L !== "api-calls" ? Q.start : void 0,
|
|
501
517
|
onSend: (e, t) => void q(e, t),
|
|
502
|
-
disabled:
|
|
503
|
-
placeholder:
|
|
504
|
-
mode:
|
|
505
|
-
writeAccessDenied:
|
|
506
|
-
availableModes:
|
|
507
|
-
onModeChange:
|
|
518
|
+
disabled: xt,
|
|
519
|
+
placeholder: L === "api-calls" ? A("chatArea.placeholderActions", "What would you like me to do?") : A("chatArea.placeholderGeneral", "Ask me anything…"),
|
|
520
|
+
mode: L,
|
|
521
|
+
writeAccessDenied: x === "denied" && !!Pt?.writeCapable,
|
|
522
|
+
availableModes: Et,
|
|
523
|
+
onModeChange: Qt
|
|
508
524
|
})
|
|
509
525
|
]
|
|
510
526
|
}),
|
|
511
|
-
|
|
527
|
+
kt && !Q.active ? /* @__PURE__ */ k(De, {
|
|
512
528
|
turns: Y,
|
|
513
|
-
onClose: () =>
|
|
514
|
-
onSave:
|
|
515
|
-
onContinueInChat:
|
|
529
|
+
onClose: () => At(!1),
|
|
530
|
+
onSave: Kt,
|
|
531
|
+
onContinueInChat: Jt ? Yt : void 0,
|
|
516
532
|
closeOnEscape: !0
|
|
517
533
|
}) : null,
|
|
518
|
-
Q.active && /* @__PURE__ */
|
|
534
|
+
Q.active && /* @__PURE__ */ k(je, {
|
|
519
535
|
session: Q.session,
|
|
520
536
|
notice: Q.notice,
|
|
521
537
|
capturing: Q.capturing,
|
|
@@ -529,22 +545,22 @@ var j = ({ visible: h = !0, writeAccess: se = "unknown" }) => {
|
|
|
529
545
|
onRetryAttachment: X.retry,
|
|
530
546
|
canAttachMore: X.canAddMore,
|
|
531
547
|
preparingAttachments: X.preparingCount,
|
|
532
|
-
onSaveTranscript:
|
|
533
|
-
onContinueInChat:
|
|
548
|
+
onSaveTranscript: Kt,
|
|
549
|
+
onContinueInChat: Yt,
|
|
534
550
|
onInterrupt: () => {
|
|
535
|
-
Q.interrupt(),
|
|
551
|
+
Q.interrupt(), zt();
|
|
536
552
|
},
|
|
537
|
-
spoken:
|
|
553
|
+
spoken: Wt,
|
|
538
554
|
onToggleMute: Q.toggleMute,
|
|
539
|
-
onEnd:
|
|
555
|
+
onEnd: Zt
|
|
540
556
|
}),
|
|
541
|
-
/* @__PURE__ */
|
|
542
|
-
open:
|
|
543
|
-
onConfirm:
|
|
544
|
-
onCancel:
|
|
557
|
+
/* @__PURE__ */ k(Ve, {
|
|
558
|
+
open: Dt !== null,
|
|
559
|
+
onConfirm: $t,
|
|
560
|
+
onCancel: en
|
|
545
561
|
})
|
|
546
562
|
]
|
|
547
563
|
});
|
|
548
564
|
};
|
|
549
565
|
//#endregion
|
|
550
|
-
export {
|
|
566
|
+
export { M as AssistantChatArea };
|
package/dist/shared-assistant.js
CHANGED
|
@@ -38,56 +38,57 @@ import { BOILERPLATE_PAGE_SHARE as hn, MAX_BOILERPLATE_LINE_CHARS as gn, MAX_EXT
|
|
|
38
38
|
import { ATTACHMENT_ACCEPT as Fn, AttachmentRejectedError as In, INLINE_IMAGE_MAX_DIM as Ln, INLINE_IMAGE_QUALITY as Rn, MAX_ATTACHMENTS as zn, MAX_FILE_BYTES as Bn, MAX_INLINE_CHARS_PER_FILE as Vn, MAX_INLINE_CHARS_TOTAL as Hn, MAX_INLINE_IMAGE_BASE64_CHARS as Un, MAX_INLINE_IMAGE_PARTS as Wn, MAX_INLINE_TURN_BODY_BYTES as Gn, MAX_TURN_BODY_BYTES as Kn, PROMPT_ENVELOPE_RESERVE_BYTES as qn, TURN_BODY_HEADROOM_BYTES as Jn, buildAttachmentPromptBlock as Yn, buildPromptParts as Xn, buildPromptWithAttachments as Zn, classifyAttachment as Qn, countInlineImageCandidates as $n, countInlinedImageParts as er, detectDocumentFormat as tr, estimateTurnBodyBytes as nr, formatBytes as rr, getAttachmentSendBlocker as ir, getExtension as ar, getSendableAttachments as or, hasAttachmentWorkInFlight as sr, parseDataUrl as cr, toMessageAttachment as lr, truncateForInline as ur, validateFile as dr } from "./shared/assistant/attachments.js";
|
|
39
39
|
import { useAssistantStore as fr } from "./shared/assistant/store.js";
|
|
40
40
|
import { isTurnInFlight as pr, planAbandonedTurn as mr, planTurnAbort as hr } from "./shared/assistant/turnState.js";
|
|
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
|
-
import {
|
|
80
|
-
import {
|
|
81
|
-
import {
|
|
82
|
-
import {
|
|
83
|
-
import {
|
|
84
|
-
import {
|
|
85
|
-
import {
|
|
86
|
-
import {
|
|
87
|
-
import {
|
|
88
|
-
import {
|
|
89
|
-
import {
|
|
90
|
-
import {
|
|
91
|
-
import {
|
|
92
|
-
import {
|
|
93
|
-
|
|
41
|
+
import { PHRASE_ROTATE_MS as gr, STAGE_COPY as _r, THINKING_PHRASES as vr, isStageCopy as yr, stageText as br, statusStageCopy as xr, thinkingPhrase as Sr } from "./shared/assistant/stageCopy.js";
|
|
42
|
+
import { AssistantToolActivity as Cr, parseToolActivity as wr } from "./shared/assistant/ui/AssistantToolActivity.js";
|
|
43
|
+
import { AssistantSpeechProvider as Tr, useAssistantSpeech as Er } from "./shared/assistant/ui/AssistantSpeechProvider.js";
|
|
44
|
+
import { useVoiceSession as Dr } from "./shared/assistant/ui/useVoiceSession.js";
|
|
45
|
+
import { copyToClipboard as Or } from "./shared/assistant/clipboard.js";
|
|
46
|
+
import { getActorId as kr, getOrganizationId as Ar, getWorkspaceId as jr } from "./shared/assistant/context.js";
|
|
47
|
+
import { ATTACHMENT_SOURCES as Mr, availableAttachmentSources as Nr, deviceHasCamera as Pr } from "./shared/assistant/attachmentSources.js";
|
|
48
|
+
import { SANDBOX_READY_TTL_MS as Fr, createReadinessTracker as Ir, isRecentlyVerified as Lr } from "./shared/assistant/sandboxReadiness.js";
|
|
49
|
+
import { AssistantAutoSpeakToggle as Rr } from "./shared/assistant/ui/AssistantAutoSpeakToggle.js";
|
|
50
|
+
import { AssistantMarkdownImage as zr, imageHostLabel as Br, isRemoteImageSrc as Vr } from "./shared/assistant/ui/AssistantMarkdownImage.js";
|
|
51
|
+
import { AssistantMarkdownRenderer as Hr, assistantUrlTransform as Ur } from "./shared/assistant/ui/AssistantMarkdownRenderer.js";
|
|
52
|
+
import { AssistantMessageAttachments as Wr } from "./shared/assistant/ui/AssistantMessageAttachments.js";
|
|
53
|
+
import { AssistantPendingWriteCard as Gr } from "./shared/assistant/ui/AssistantPendingWriteCard.js";
|
|
54
|
+
import { AssistantLanguageMenu as Kr } from "./shared/assistant/ui/AssistantLanguageMenu.js";
|
|
55
|
+
import { AssistantReplyLanguageSelector as qr } from "./shared/assistant/ui/AssistantReplyLanguageSelector.js";
|
|
56
|
+
import { AssistantSpeakButton as Jr } from "./shared/assistant/ui/AssistantSpeakButton.js";
|
|
57
|
+
import { AssistantSpokenTurnsNotice as Yr } from "./shared/assistant/ui/AssistantSpokenTurnsNotice.js";
|
|
58
|
+
import { AssistantAttachmentButton as Xr } from "./shared/assistant/ui/composer/AssistantAttachmentButton.js";
|
|
59
|
+
import { AssistantAttachmentChips as Zr } from "./shared/assistant/ui/composer/AssistantAttachmentChips.js";
|
|
60
|
+
import { AssistantLanguageSelector as Qr, FOLLOW_APP_LOCALE as $r } from "./shared/assistant/ui/composer/AssistantLanguageSelector.js";
|
|
61
|
+
import { ASSISTANT_MODE_META as ei, AssistantModeSelector as ti, nextModeIndex as ni } from "./shared/assistant/ui/composer/AssistantModeSelector.js";
|
|
62
|
+
import { AssistantVoiceButton as ri } from "./shared/assistant/ui/composer/AssistantVoiceButton.js";
|
|
63
|
+
import { AUTO_VOICE as ii, AssistantVoiceSelector as ai } from "./shared/assistant/ui/composer/AssistantVoiceSelector.js";
|
|
64
|
+
import { AssistantVoiceOrb as oi } from "./shared/assistant/ui/voice/AssistantVoiceOrb.js";
|
|
65
|
+
import { AssistantVoiceSessionButton as si } from "./shared/assistant/ui/voice/AssistantVoiceSessionButton.js";
|
|
66
|
+
import { CAPTION_SCROLL_ATTR as ci, VoiceCaption as li } from "./shared/assistant/ui/voice/VoiceCaption.js";
|
|
67
|
+
import { VoiceConversationView as ui } from "./shared/assistant/ui/voice/VoiceConversationView.js";
|
|
68
|
+
import { VoiceWaveform as di } from "./shared/assistant/ui/voice/VoiceWaveform.js";
|
|
69
|
+
import { VoiceMiniController as fi } from "./shared/assistant/ui/voice/VoiceMiniController.js";
|
|
70
|
+
import { VoiceStage as pi } from "./shared/assistant/ui/voice/VoiceStage.js";
|
|
71
|
+
import { VoiceTranscriptDrawer as mi } from "./shared/assistant/ui/voice/VoiceTranscriptDrawer.js";
|
|
72
|
+
import { downloadFile as hi, exportConversation as gi } from "./shared/assistant/exportConversation.js";
|
|
73
|
+
import { AssistantMoreMenu as _i } from "./shared/assistant/ui/AssistantMoreMenu.js";
|
|
74
|
+
import { AssistantHeader as vi } from "./shared/assistant/ui/AssistantHeader.js";
|
|
75
|
+
import { AssistantConversationList as yi } from "./shared/assistant/ui/AssistantConversationList.js";
|
|
76
|
+
import { AssistantEmptyState as bi } from "./shared/assistant/ui/AssistantEmptyState.js";
|
|
77
|
+
import { AssistantMessageItem as xi } from "./shared/assistant/ui/AssistantMessageItem.js";
|
|
78
|
+
import { AssistantMessageList as Si } from "./shared/assistant/ui/AssistantMessageList.js";
|
|
79
|
+
import { AssistantVoiceSession as Ci } from "./shared/assistant/ui/voice/AssistantVoiceSession.js";
|
|
80
|
+
import { useAssistantApiAccess as wi } from "./shared/assistant/useAssistantApiAccess.js";
|
|
81
|
+
import { useConversationTurns as Ti } from "./shared/assistant/useConversationTurns.js";
|
|
82
|
+
import { isMultimodalBodyRejection as Ei, isRecoverableAssistantError as Di } from "./shared/assistant/transportErrors.js";
|
|
83
|
+
import { aiCreditsUpdatedEventName as Oi, dispatchAssistantQuotaExhausted as ki, notifyAiCreditsUpdated as Ai } from "./shared/assistant/aiCredits.js";
|
|
84
|
+
import { useWorkspaceWriteAccess as ji } from "./shared/assistant/useWorkspaceWriteAccess.js";
|
|
85
|
+
import { extractDocumentText as Mi } from "./shared/assistant/documentExtract.js";
|
|
86
|
+
import { useAssistantAttachments as Ni } from "./shared/assistant/useAssistantAttachments.js";
|
|
87
|
+
import { AssistantComposer as Pi } from "./shared/assistant/ui/composer/AssistantComposer.js";
|
|
88
|
+
import { isProdRuntime as Fi } from "./shared/assistant/env.js";
|
|
89
|
+
import { useAssistantHeartbeat as Ii } from "./shared/assistant/useAssistantHeartbeat.js";
|
|
90
|
+
import { useAssistantKeyboardShortcuts as Li } from "./shared/assistant/useAssistantKeyboardShortcuts.js";
|
|
91
|
+
import { AssistantApiCallsConsentDialog as Ri } from "./shared/assistant/ui/AssistantApiCallsConsentDialog.js";
|
|
92
|
+
import { AssistantChatArea as zi } from "./shared/assistant/ui/AssistantChatArea.js";
|
|
93
|
+
import { AIAssistantPanel as Bi } from "./shared/assistant/ui/AIAssistantPanel.js";
|
|
94
|
+
export { Bi as AIAssistantPanel, g as ASSISTANT_API_AUTH_STRATEGY, zt as ASSISTANT_LANGUAGES, ei as ASSISTANT_MODE_META, Fn as ATTACHMENT_ACCEPT, Mr as ATTACHMENT_SOURCES, ii as AUTO_VOICE, Ri as AssistantApiCallsConsentDialog, Xr as AssistantAttachmentButton, Zr as AssistantAttachmentChips, Rr as AssistantAutoSpeakToggle, zi as AssistantChatArea, Pi as AssistantComposer, yi as AssistantConversationList, bi as AssistantEmptyState, vi as AssistantHeader, $t as AssistantI18nProvider, Kr as AssistantLanguageMenu, Qr as AssistantLanguageSelector, zr as AssistantMarkdownImage, Hr as AssistantMarkdownRenderer, Wr as AssistantMessageAttachments, xi as AssistantMessageItem, Si as AssistantMessageList, ti as AssistantModeSelector, _i as AssistantMoreMenu, Gr as AssistantPendingWriteCard, qt as AssistantProductProvider, qr as AssistantReplyLanguageSelector, X as AssistantRuntimeManager, Jr as AssistantSpeakButton, Tr as AssistantSpeechProvider, Yr as AssistantSpokenTurnsNotice, Cr as AssistantToolActivity, ri as AssistantVoiceButton, oi as AssistantVoiceOrb, ai as AssistantVoiceSelector, Ci as AssistantVoiceSession, si as AssistantVoiceSessionButton, In as AttachmentRejectedError, hn as BOILERPLATE_PAGE_SHARE, ci as CAPTION_SCROLL_ATTR, s as CHECK_AI_CREDITS, c as CREATE_SANDBOX, vt as DEFAULT_SPEAKABLE_LABELS, Bt as DEFAULT_SPEECH_RATE, Ge as ENDPOINT_GRACE_MS, l as EXTEND_SANDBOX_TTL, $r as FOLLOW_APP_LOCALE, u as GET_ACTIVE_SANDBOXES, d as GET_SANDBOX, xe as HOSTED_TTS_MAX_CHARS, _e as HOSTED_TTS_TIER, ve as HOSTED_VOICES, cn as IDLE_PLAYBACK, Ke as INITIAL_SESSION, Ln as INLINE_IMAGE_MAX_DIM, Rn as INLINE_IMAGE_QUALITY, qe as INTERRUPT_MAX_MS, Je as INTERRUPT_MIN_MS, zn as MAX_ATTACHMENTS, gn as MAX_BOILERPLATE_LINE_CHARS, _n as MAX_EXTRACTED_CHARS, Bn as MAX_FILE_BYTES, Vn as MAX_INLINE_CHARS_PER_FILE, Hn as MAX_INLINE_CHARS_TOTAL, pn as MAX_INLINE_IMAGE_BASE64_BYTES, Un as MAX_INLINE_IMAGE_BASE64_CHARS, Wn as MAX_INLINE_IMAGE_PARTS, Gn as MAX_INLINE_TURN_BODY_BYTES, vn as MAX_PDF_PAGES_SCANNED, mn as MAX_REQUEST_BODY_BYTES, yt as MAX_SPEAKABLE_CHARS, bt as MAX_SPOKEN_TABLE_ROWS, Kn as MAX_TURN_BODY_BYTES, At as MINI_CAPTION_BUDGET, yn as MIN_PAGE_TEXT_CHARS, bn as MIN_TEXT_PAGE_SHARE, gr as PHRASE_ROTATE_MS, Mt as POLL_FAST_MS, Nt as POLL_FAST_UNTIL_MS, Pt as POLL_SLOW_MS, Ft as POLL_STEADY_MS, It as POLL_STEADY_UNTIL_MS, Ot as PREVIEW_LANGUAGES, qn as PROMPT_ENVELOPE_RESERVE_BYTES, f as PROXY_SANDBOX_REQUEST, p as REPORT_AI_TOKEN_USAGE, Fr as SANDBOX_READY_TTL_MS, Ye as SILENCE_SUBMIT_MS, Se as SPEAKING_RATE_MAX, Ce as SPEAKING_RATE_MAX_STREAMING, we as SPEAKING_RATE_MAX_SYNC, Te as SPEAKING_RATE_MIN, xt as SPEECH_CHUNK_CHARS, St as SPEECH_CHUNK_CJK_CHARS, rt as SPEECH_LANG, rn as SPOKEN_LABEL_LANGUAGES, _r as STAGE_COPY, m as STOP_ASSISTANT_SANDBOX, vr as THINKING_PHRASES, Jn as TURN_BODY_HEADROOM_BYTES, it as VOICE_LIST_TIMEOUT_MS, li as VoiceCaption, ui as VoiceConversationView, fi as VoiceMiniController, pi as VoiceStage, mi as VoiceTranscriptDrawer, di as VoiceWaveform, h as WAIT_FOR_SANDBOX_RUNNING, E as abortAssistantTurn, Oi as aiCreditsUpdatedEventName, D as approvePendingWrite, en as assistantTranslationKey, Ur as assistantUrlTransform, Nr as availableAttachmentSources, Ee as base64ToBytes, ge as browserSpeechEngine, O as buildAssistantSandboxEnv, Yn as buildAttachmentPromptBlock, ht as buildContinuedFromVoiceNote, Z as buildProgress, Xn as buildPromptParts, k as buildPromptRequestBody, Zn as buildPromptWithAttachments, De as buildRequest, a as buildSandboxContextInput, gt as buildVoiceTranscriptMarkdown, le as chatTurns, A as checkAssistantAiCredits, Ct as chunkForSpeech, Qn as classifyAttachment, Oe as classifyHttpFailure, t as classifyQuotaError, xn as columnLetterToIndex, Pe as configureSpeechEngine, wt as containsCjk, Or as copyToClipboard, $n as countInlineImageCandidates, er as countInlinedImageParts, j as createAssistantSandbox, M as createAssistantSession, Me as createHostedTtsEngine, Ir as createReadinessTracker, Ne as createRoutingSpeechEngine, se as createSandboxAssistantTransport, Fe as createSpeechEngines, ke as decodeAudioResponse, Sn as decodeXmlEntities, n as describeQuotaError, tr as detectDocumentFormat, on as detectScriptLocale, Pr as deviceHasCamera, ki as dispatchAssistantQuotaExhausted, Cn as docxXmlToText, N as downloadAssistantArtifact, hi as downloadFile, nr as estimateTurnBodyBytes, o as executeSandboxGraphQL, gi as exportConversation, P as extendAssistantSandboxTTL, Mi as extractDocumentText, Vt as findAssistantLanguage, F as findExistingSandbox, Gt as findPendingWrite, wn as fitPdfPages, rr as formatBytes, Tn as formatPageRanges, kr as getActorId, I as getAssistantArtifacts, Q as getAssistantMedia, L as getAssistantMessages, R as getAssistantSession, z as getAssistantStreamAccess, $ as getAssistantText, ir as getAttachmentSendBlocker, S as getCapability, ar as getExtension, _ as getImageForMode, v as getImageTagForMode, Ar as getOrganizationId, ee as getRawMessageCreatedAt, y as getResourcesForMode, b as getSandboxImageRegistry, or as getSendableAttachments, Ie as getSpeechEngine, te as getToolProgress, jr as getWorkspaceId, ue as groupBySession, de as groupConsecutiveBySession, sr as hasAttachmentWorkInFlight, ye as hostedLocaleFor, be as hostedSupportsLanguage, Br as imageHostLabel, Xe as isCapturing, Ze as isEcho, En as isMostlyImagePages, Ei as isMultimodalBodyRejection, Fi as isProdRuntime, r as isQuotaExhaustedError, ne as isReapedSandboxConnectionError, Lr as isRecentlyVerified, re as isRecoverable, Di as isRecoverableAssistantError, Vr as isRemoteImageSrc, ln as isSpeakingMessage, at as isSpeechBlocked, yr as isStageCopy, Qe as isSubmittable, pr as isTurnInFlight, C as isUnknownFieldError, fe as isVoiceTurn, Dn as joinSheets, ot as languageDisplayName, ie as mapSessionToHistory, w as markSupported, T as markUnsupported, ae as mergeMessagesById, ze as micIsInterrupt, B as modeRequiresConfirmWrites, ni as nextModeIndex, st as normalizeLangTag, Ai as notifyAiCreditsUpdated, $e as orbMode, On as pageMarker, Kt as parseConfirmationRefusal, cr as parseDataUrl, kn as parseSharedStrings, wr as parseToolActivity, An as parseWorkbookSheets, jn as pdfTextItemsToPage, mr as planAbandonedTurn, et as planReplyConsumption, hr as planTurnAbort, Lt as pollDelayMs, ct as primaryLanguageSubtag, un as publishedChunks, i as quotaExhaustedEventName, Le as readSpeechEngineConfig, V as releaseSupersededAssistantSandboxes, Ut as replyFollowsInput, H as reportAssistantAiTokenUsage, dn as requiresCancel, Re as resetSpeechEngine, Ht as resolveAssistantLanguage, Wt as resolveLanguagePair, Jt as resolveModeConfig, x as resolveSandboxAssistantMode, sn as resolveSpeechLocale, oe as sanitize, U as selectExistingAssistantSandbox, W as selectSupersededAssistantSandboxes, lt as selectVoiceForLocale, G as sendAssistantPromptAsync, K as sendHeartbeat, Mn as sheetXmlToRows, Ae as shouldDisableEngine, jt as showPreviousChunk, Be as showsAssistantCaption, Ve as showsUserCaption, Tt as speakableEmail, ut as speechGate, an as speechLabelsFor, dt as speechLangForLocale, fn as speechPlaybackReducer, je as splitForVendor, Et as splitTableRow, tt as spokenSoFar, br as stageText, xr as statusStageCopy, q as stopReapedAssistantSandbox, Nn as summarisePageText, Sr as thinkingPhrase, Rt as toCaptionText, lr as toMessageAttachment, Dt as toSpeakableText, ur as truncateForInline, Pn as truncatePagesForInline, wi as useAssistantApiAccess, Ni as useAssistantAttachments, Ii as useAssistantHeartbeat, tn as useAssistantI18nNamespace, Li as useAssistantKeyboardShortcuts, Yt as useAssistantPageLabel, Xt as useAssistantProduct, Zt as useAssistantProductOrNull, Er as useAssistantSpeech, Qt as useAssistantStorageFolders, fr as useAssistantStore, nn as useAssistantTr, Ti as useConversationTurns, ce as useSandboxAssistantTransport, e as useVoiceInput, Dr as useVoiceSession, ji as useWorkspaceWriteAccess, dr as validateFile, ft as voiceAvailability, pe as voiceMarker, kt as voicePreviewText, pt as voiceQualityRank, me as voiceSessionIdOf, nt as voiceSessionReducer, He as voiceStageState, _t as voiceTranscriptFilename, he as voiceTurnsOnly, mt as voicesForLocale, J as waitForAssistantServiceReady, Y as waitForSandboxRunning, Ue as waveformIsActive, We as waveformIsSettled };
|