@burdenoff/fe-libs 2026.909.3 → 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 +296 -294
- 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,43 +10,44 @@ 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
53
|
function A(e) {
|
|
@@ -58,17 +59,17 @@ function j(e) {
|
|
|
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 = A(r.parts), a = h(r.parts), o = j(r.parts), s =
|
|
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,121 +79,118 @@ function Ge(e, t) {
|
|
|
78
79
|
...s ? { pendingWrite: s } : {}
|
|
79
80
|
};
|
|
80
81
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
var M = ({ visible: h = !0, writeAccess: se = "unknown" }) => {
|
|
90
|
-
let A = le(), { product: j, modes: M, gatherPageContext: qe, buildPrompt: Je, reportTokenUsage: Ye } = ce(), { getAccessToken: N, getWorkspaceToken: P, userId: F } = t(), { locale: Xe } = e(), Ze = x((e) => e.assistantLanguage), Qe = x((e) => e.replyLanguage), $e = T(() => oe(Ze, Qe, Xe), [
|
|
91
|
-
Ze,
|
|
92
|
-
Qe,
|
|
93
|
-
Xe
|
|
94
|
-
]), et = $e.reply.english, tt = $e.replyIsExplicit, nt = $e.reply.code, { conversations: rt, activeConversationId: I, mode: L, processingByConversationId: it, setMode: R, setConversationMode: z, setActiveConversation: at, createConversation: B, addMessage: V, updateMessage: ot, patchMessage: H, mergeMessageMetadata: st, setConversationProcessing: U, clearConversationProcessing: ct, setBackendSessionId: lt, clearBackendSessionId: ut, setSandbox: W, clearSandbox: dt, acknowledgeApiCalls: ft } = x(), pt = rt.find((e) => e.id === I), G = Ae(pt), mt = G.all, ht = I ? it[I] : void 0, gt = ge(ht?.status), _t = gt ? ht?.messageId ?? null : null, vt = ht?.status === "error" ? ht.messageId : null, { canUseApiCalls: yt, loading: bt } = ke(S()), xt = T(() => M.filter((e) => !e.requiresAdmin || yt), [M, yt]), [St, Ct] = ze(null), [wt, Tt] = ze(!1), Et = E({}), Dt = E(Se()), Ot = E(/* @__PURE__ */ new Set()), kt = T(() => M.find((e) => e.id === L), [M, L]);
|
|
95
|
-
w(() => {
|
|
96
|
-
bt || (!kt || kt.requiresAdmin && !yt) && L !== "assistant" && R("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
91
|
L,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
92
|
+
Pt,
|
|
93
|
+
wt,
|
|
94
|
+
Tt,
|
|
95
|
+
lt
|
|
103
96
|
]);
|
|
104
|
-
let
|
|
105
|
-
|
|
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, j, n,
|
|
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
118
|
if (n === "api-calls" && !N()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
|
|
122
|
-
|
|
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
|
}, [
|
|
137
|
-
|
|
134
|
+
ht,
|
|
138
135
|
N,
|
|
139
136
|
j,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
137
|
+
mt,
|
|
138
|
+
U,
|
|
139
|
+
A,
|
|
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
153
|
accessToken: N(),
|
|
156
154
|
workspaceToken: P(),
|
|
157
155
|
userId: F,
|
|
158
|
-
organizationId:
|
|
156
|
+
organizationId: Ce()
|
|
159
157
|
});
|
|
160
158
|
}, [
|
|
161
159
|
F,
|
|
162
160
|
N,
|
|
163
161
|
P
|
|
164
|
-
]),
|
|
165
|
-
let t =
|
|
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
168
|
accessToken: N(),
|
|
171
169
|
workspaceToken: P(),
|
|
172
170
|
userId: F,
|
|
173
|
-
organizationId:
|
|
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
185
|
F,
|
|
188
|
-
|
|
186
|
+
z,
|
|
189
187
|
A
|
|
190
|
-
]),
|
|
191
|
-
let i = r.voiceSessionId !== void 0, a =
|
|
188
|
+
]), q = T(async (e, t = [], r = {}) => {
|
|
189
|
+
let i = r.voiceSessionId !== void 0, a = S.getState(), o = a.activeConversationId ?? I;
|
|
192
190
|
if (o) {
|
|
193
|
-
if (
|
|
191
|
+
if (he(a.processingByConversationId[o]?.status)) {
|
|
194
192
|
let n = a.processingByConversationId[o]?.messageId ?? null;
|
|
195
|
-
n &&
|
|
193
|
+
n && K.current.has(n) && (Rt.current = {
|
|
196
194
|
conversationId: o,
|
|
197
195
|
content: e,
|
|
198
196
|
attachments: t,
|
|
@@ -200,40 +198,40 @@ var M = ({ visible: h = !0, writeAccess: se = "unknown" }) => {
|
|
|
200
198
|
});
|
|
201
199
|
return;
|
|
202
200
|
}
|
|
203
|
-
if (
|
|
201
|
+
if (Nt.current.has(o)) return;
|
|
204
202
|
}
|
|
205
|
-
let c = a.mode, d = I, f = d ?
|
|
206
|
-
if (d ? f && f.mode !== c && (f.messages.length > 0 || f.backendSessionId) ? d =
|
|
207
|
-
|
|
208
|
-
let p =
|
|
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 = {
|
|
209
207
|
accessToken: N(),
|
|
210
208
|
workspaceToken: P(),
|
|
211
209
|
userId: F,
|
|
212
|
-
organizationId:
|
|
210
|
+
organizationId: Ce()
|
|
213
211
|
}, h = {
|
|
214
|
-
id:
|
|
212
|
+
id: Je(),
|
|
215
213
|
role: "user",
|
|
216
214
|
content: e,
|
|
217
215
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
218
216
|
metadata: {
|
|
219
|
-
...t.length ? { attachments: t.map(
|
|
217
|
+
...t.length ? { attachments: t.map(me) } : {},
|
|
220
218
|
..._(r.voiceSessionId)
|
|
221
219
|
}
|
|
222
220
|
};
|
|
223
|
-
|
|
224
|
-
let g =
|
|
225
|
-
|
|
221
|
+
z(d, h);
|
|
222
|
+
let g = Je();
|
|
223
|
+
z(d, {
|
|
226
224
|
id: g,
|
|
227
225
|
role: "assistant",
|
|
228
226
|
content: "",
|
|
229
227
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
230
228
|
metadata: {
|
|
231
|
-
lang:
|
|
229
|
+
lang: ot,
|
|
232
230
|
..._(r.voiceSessionId)
|
|
233
231
|
}
|
|
234
|
-
}),
|
|
235
|
-
let ne = (e, t, n, i, a =
|
|
236
|
-
|
|
232
|
+
}), H(d, "provisioning", g, null);
|
|
233
|
+
let ne = (e, t, n, i, a = ot) => {
|
|
234
|
+
V(d, g, { content: te(e) }), ft(d, g, {
|
|
237
235
|
lang: a,
|
|
238
236
|
...t?.length ? { artifacts: t } : {},
|
|
239
237
|
...t?.length || n || i ? { mode: c } : {},
|
|
@@ -244,147 +242,151 @@ var M = ({ visible: h = !0, writeAccess: se = "unknown" }) => {
|
|
|
244
242
|
}, v = async (n = 1) => {
|
|
245
243
|
let r = !1;
|
|
246
244
|
try {
|
|
247
|
-
let { sandboxId: n, sessionId: a } = await
|
|
248
|
-
|
|
249
|
-
let f =
|
|
250
|
-
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;
|
|
251
249
|
try {
|
|
252
250
|
await ee(n, p, a, h, c, re, m, _?.length ? { parts: _ } : void 0);
|
|
253
251
|
} catch (e) {
|
|
254
|
-
if (!_ || !
|
|
252
|
+
if (!_ || !Pe(e)) throw e;
|
|
255
253
|
await ee(n, p, a, h, c, re, m, void 0), r ||= y;
|
|
256
254
|
}
|
|
257
|
-
let b =
|
|
255
|
+
let b = Xe([], o), ae = Date.now() + (We[c] ?? Ge), oe = Date.now(), x = Date.now(), se = () => ge({
|
|
258
256
|
turnId: g,
|
|
259
|
-
abortRequested:
|
|
260
|
-
activeTurnId:
|
|
261
|
-
})
|
|
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
|
+
};
|
|
262
263
|
for (; Date.now() < ae;) {
|
|
263
|
-
let e =
|
|
264
|
+
let e = se();
|
|
264
265
|
if (e.abandon) {
|
|
265
|
-
e.clearProcessing &&
|
|
266
|
+
ce(), e.clearProcessing && pt(d);
|
|
266
267
|
return;
|
|
267
268
|
}
|
|
268
|
-
if (b =
|
|
269
|
+
if (b = Xe(await u(n, p, a, m, {
|
|
269
270
|
limit: 50,
|
|
270
271
|
sinceMs: o
|
|
271
|
-
}), o),
|
|
272
|
-
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)));
|
|
273
274
|
}
|
|
274
275
|
if (!b.done && c !== "vibe-plugins") throw Error("Assistant response timed out while streaming progress");
|
|
275
|
-
let
|
|
276
|
+
let pe = c === "vibe-plugins" ? await l(n, p, a, m).then((e) => e).catch(() => []) : void 0;
|
|
276
277
|
if (b.done || (b = {
|
|
277
278
|
...b,
|
|
278
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._`
|
|
279
280
|
}), r && (b = {
|
|
280
281
|
...b,
|
|
281
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._")}`
|
|
282
|
-
}), ne(b.content,
|
|
283
|
-
|
|
283
|
+
}), ne(b.content, pe, a, n), b.tokens) {
|
|
284
|
+
V(d, g, { tokens: b.tokens });
|
|
284
285
|
try {
|
|
285
|
-
await
|
|
286
|
+
await $e?.({
|
|
286
287
|
workspaceId: p,
|
|
287
288
|
sessionId: a,
|
|
288
289
|
messageId: b.messageId,
|
|
289
290
|
model: b.model,
|
|
290
291
|
tokens: b.tokens
|
|
291
|
-
}),
|
|
292
|
+
}), Le(j);
|
|
292
293
|
} catch {}
|
|
293
294
|
}
|
|
294
|
-
let me =
|
|
295
|
+
let me = se();
|
|
295
296
|
if (me.abandon) {
|
|
296
|
-
me.clearProcessing &&
|
|
297
|
+
ce(), me.clearProcessing && pt(d);
|
|
297
298
|
return;
|
|
298
299
|
}
|
|
299
|
-
|
|
300
|
+
H(d, "complete", g, null);
|
|
300
301
|
} catch (e) {
|
|
301
|
-
if (n === 1 &&
|
|
302
|
+
if (n === 1 && Fe(e)) return ht(d), gt(c), v(2);
|
|
302
303
|
throw e;
|
|
303
304
|
}
|
|
304
305
|
}, y = d;
|
|
305
|
-
|
|
306
|
+
Nt.current.add(y);
|
|
306
307
|
try {
|
|
307
308
|
if (!p) throw Error("Assistant backend is unavailable without an active workspace context.");
|
|
308
309
|
await v();
|
|
309
310
|
} catch (e) {
|
|
310
|
-
|
|
311
|
+
Mt.current.invalidate(S.getState().sandboxesByMode[c]?.sandboxId ?? null);
|
|
311
312
|
let t = n(e);
|
|
312
313
|
if (t) {
|
|
313
|
-
t.refusal === "exhausted" &&
|
|
314
|
+
t.refusal === "exhausted" && Ie(j, "sandbox");
|
|
314
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.";
|
|
315
|
-
ne(e ? `${n}\n\n${e}` : n, void 0, void 0, void 0, "en"),
|
|
316
|
+
ne(e ? `${n}\n\n${e}` : n, void 0, void 0, void 0, "en"), H(d, "error", g, null);
|
|
316
317
|
return;
|
|
317
318
|
}
|
|
318
319
|
let i = e instanceof Error ? e.message : "Something went wrong";
|
|
319
|
-
|
|
320
|
+
H(d, "error", g, i), V(d, g, { content: `Sorry, an error occurred: ${i}. Please try again.` }), ft(d, g, {
|
|
320
321
|
lang: "en",
|
|
321
322
|
..._(r.voiceSessionId)
|
|
322
323
|
});
|
|
323
324
|
} finally {
|
|
324
|
-
|
|
325
|
-
let e =
|
|
326
|
-
|
|
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);
|
|
327
328
|
}
|
|
328
329
|
}, [
|
|
329
330
|
I,
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
331
|
+
z,
|
|
332
|
+
Qe,
|
|
333
|
+
ht,
|
|
334
|
+
gt,
|
|
335
|
+
st,
|
|
336
|
+
R,
|
|
337
|
+
Ft,
|
|
338
|
+
Ze,
|
|
338
339
|
N,
|
|
339
340
|
P,
|
|
340
|
-
|
|
341
|
+
V,
|
|
341
342
|
j,
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
343
|
+
$e,
|
|
344
|
+
at,
|
|
345
|
+
ot,
|
|
346
|
+
it,
|
|
347
|
+
mt,
|
|
348
|
+
ut,
|
|
349
|
+
H,
|
|
350
|
+
pt,
|
|
350
351
|
A,
|
|
351
|
-
|
|
352
|
+
G,
|
|
353
|
+
B,
|
|
352
354
|
F
|
|
353
|
-
]),
|
|
354
|
-
|
|
355
|
-
}, [
|
|
356
|
-
let e = [...
|
|
357
|
-
e &&
|
|
355
|
+
]), Vt = T((e) => {
|
|
356
|
+
q(e);
|
|
357
|
+
}, [q]), Ht = T(() => {
|
|
358
|
+
let e = [...W.chat].reverse().find((e) => e.role === "user"), t = I ? jt.current[I] ?? [] : [];
|
|
359
|
+
e && q(e.content, t);
|
|
358
360
|
}, [
|
|
359
|
-
|
|
360
|
-
|
|
361
|
+
yt,
|
|
362
|
+
q,
|
|
361
363
|
I
|
|
362
|
-
]),
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
}, [
|
|
366
|
-
let
|
|
367
|
-
if (
|
|
368
|
-
for (let e =
|
|
369
|
-
let t =
|
|
370
|
-
if (t?.role !== "assistant" || !g(t) ||
|
|
371
|
-
let n =
|
|
364
|
+
]), J = O(q);
|
|
365
|
+
E(() => {
|
|
366
|
+
J.current = q;
|
|
367
|
+
}, [q]);
|
|
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();
|
|
372
374
|
return n ? {
|
|
373
375
|
id: t.id,
|
|
374
376
|
text: n
|
|
375
377
|
} : null;
|
|
376
378
|
}
|
|
377
379
|
return null;
|
|
378
|
-
}, [
|
|
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) => ({
|
|
379
381
|
id: e.id,
|
|
380
382
|
role: e.role,
|
|
381
|
-
text:
|
|
383
|
+
text: xe(e.content).text.trim(),
|
|
382
384
|
sessionId: ne(e),
|
|
383
385
|
timestamp: e.timestamp
|
|
384
|
-
})).filter((e) => e.text.length > 0), [
|
|
385
|
-
if (
|
|
386
|
+
})).filter((e) => e.text.length > 0), [W.voice]), Kt = T(() => {
|
|
387
|
+
if (Y.length === 0) return;
|
|
386
388
|
let e = /* @__PURE__ */ new Date();
|
|
387
|
-
|
|
389
|
+
Oe(y(Y, {
|
|
388
390
|
title: A("voiceSession.transcript", "Voice conversation"),
|
|
389
391
|
savedAt: A("voiceSession.savedAt", "Saved"),
|
|
390
392
|
session: A("voiceSession.sessionLabel", "Session"),
|
|
@@ -394,168 +396,168 @@ var M = ({ visible: h = !0, writeAccess: se = "unknown" }) => {
|
|
|
394
396
|
}, e), re(j, e), "text/markdown");
|
|
395
397
|
}, [
|
|
396
398
|
j,
|
|
397
|
-
|
|
399
|
+
Y,
|
|
398
400
|
A
|
|
399
|
-
]),
|
|
400
|
-
|
|
401
|
-
let
|
|
402
|
-
onSubmit:
|
|
401
|
+
]), X = Re(), Z = O(X);
|
|
402
|
+
Z.current = X;
|
|
403
|
+
let Q = Se({
|
|
404
|
+
onSubmit: T((e, t) => {
|
|
403
405
|
let n = () => {
|
|
404
|
-
let n =
|
|
405
|
-
|
|
406
|
+
let n = Z.current, r = pe(n.attachments);
|
|
407
|
+
J.current(e, r, { voiceSessionId: t }), n.clear();
|
|
406
408
|
};
|
|
407
|
-
if (!
|
|
409
|
+
if (!Z.current.isBusy) {
|
|
408
410
|
n();
|
|
409
411
|
return;
|
|
410
412
|
}
|
|
411
413
|
let r = Date.now(), i = window.setInterval(() => {
|
|
412
|
-
|
|
414
|
+
Z.current.isBusy && Date.now() - r < qe || (window.clearInterval(i), n());
|
|
413
415
|
}, 200);
|
|
414
416
|
}, []),
|
|
415
|
-
latestReply:
|
|
416
|
-
language: ae(
|
|
417
|
-
}),
|
|
418
|
-
let e =
|
|
419
|
-
!e ||
|
|
420
|
-
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(),
|
|
421
423
|
role: "system",
|
|
422
|
-
content: v(
|
|
424
|
+
content: v(Y.slice(qt), {
|
|
423
425
|
intro: A("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
|
|
424
426
|
nothing: A("voiceSession.continuedNothing", "Continued from a voice conversation."),
|
|
425
427
|
more: (e) => A("voiceSession.continuedMore", "…and {{count}} more", { count: e })
|
|
426
428
|
}),
|
|
427
429
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
428
|
-
metadata: { continuedVoiceTurns:
|
|
429
|
-
}),
|
|
430
|
+
metadata: { continuedVoiceTurns: Y.length }
|
|
431
|
+
}), At(!1), Q.end());
|
|
430
432
|
}, [
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
433
|
+
Y,
|
|
434
|
+
qt,
|
|
435
|
+
z,
|
|
434
436
|
A,
|
|
435
|
-
|
|
436
|
-
]),
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
}, [
|
|
440
|
-
let
|
|
441
|
-
let e =
|
|
442
|
-
|
|
443
|
-
}, [
|
|
444
|
-
|
|
445
|
-
!h &&
|
|
446
|
-
}, [h,
|
|
447
|
-
|
|
448
|
-
}, [
|
|
449
|
-
let e =
|
|
450
|
-
return e &&
|
|
437
|
+
Q
|
|
438
|
+
]), Xt = O(0);
|
|
439
|
+
E(() => {
|
|
440
|
+
Q.active && (Xt.current = Y.length);
|
|
441
|
+
}, [Q.active]);
|
|
442
|
+
let Zt = T(() => {
|
|
443
|
+
let e = Y.length > Xt.current;
|
|
444
|
+
Q.end(), e && At(!0);
|
|
445
|
+
}, [Y, Q]);
|
|
446
|
+
E(() => {
|
|
447
|
+
!h && Q.active && Q.end();
|
|
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) => {
|
|
451
453
|
if (e.pendingPrompt && e.pendingPrompt !== t.pendingPrompt) {
|
|
452
|
-
let e =
|
|
453
|
-
e &&
|
|
454
|
+
let e = S.getState().consumePendingPrompt();
|
|
455
|
+
e && J.current(e);
|
|
454
456
|
}
|
|
455
457
|
});
|
|
456
458
|
}, []);
|
|
457
|
-
let
|
|
458
|
-
let t = I ?
|
|
459
|
+
let $ = T((e) => {
|
|
460
|
+
let t = I ? S.getState().conversations.find((e) => e.id === I) : void 0;
|
|
459
461
|
if (t && (t.messages.length > 0 || t.backendSessionId)) {
|
|
460
462
|
if (t.mode !== e) {
|
|
461
|
-
let t =
|
|
462
|
-
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);
|
|
463
465
|
}
|
|
464
|
-
} else I &&
|
|
465
|
-
|
|
466
|
+
} else I && ut(I, e);
|
|
467
|
+
lt(e);
|
|
466
468
|
}, [
|
|
467
469
|
I,
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
]),
|
|
473
|
-
if (M.find((t) => t.id === e)?.writeCapable && !
|
|
474
|
-
|
|
470
|
+
R,
|
|
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);
|
|
475
477
|
return;
|
|
476
478
|
}
|
|
477
|
-
|
|
478
|
-
}, [
|
|
479
|
-
let e =
|
|
480
|
-
|
|
479
|
+
$(e);
|
|
480
|
+
}, [$, M]), $t = T(() => {
|
|
481
|
+
let e = Dt;
|
|
482
|
+
Ot(null), _t(), e && $(e);
|
|
481
483
|
}, [
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
]),
|
|
486
|
-
|
|
484
|
+
Dt,
|
|
485
|
+
_t,
|
|
486
|
+
$
|
|
487
|
+
]), en = T(() => {
|
|
488
|
+
Ot(null);
|
|
487
489
|
}, []);
|
|
488
|
-
return /* @__PURE__ */
|
|
490
|
+
return /* @__PURE__ */ Ue("div", {
|
|
489
491
|
className: "relative flex flex-1 flex-col overflow-hidden",
|
|
490
492
|
children: [
|
|
491
|
-
/* @__PURE__ */
|
|
493
|
+
/* @__PURE__ */ Ue("div", {
|
|
492
494
|
className: "contents",
|
|
493
|
-
inert:
|
|
495
|
+
inert: Q.active || void 0,
|
|
494
496
|
children: [
|
|
495
|
-
|
|
496
|
-
count:
|
|
497
|
-
onOpenTranscript: () =>
|
|
497
|
+
Y.length > 0 && !Q.active ? /* @__PURE__ */ k(Ee, {
|
|
498
|
+
count: Y.length,
|
|
499
|
+
onOpenTranscript: () => At(!0)
|
|
498
500
|
}) : null,
|
|
499
|
-
|
|
501
|
+
Gt.length === 0 ? /* @__PURE__ */ k(ke, {
|
|
500
502
|
mode: L,
|
|
501
|
-
onSuggestionClick:
|
|
502
|
-
}) : /* @__PURE__ */
|
|
503
|
+
onSuggestionClick: Vt
|
|
504
|
+
}) : /* @__PURE__ */ k("div", {
|
|
503
505
|
className: "flex min-h-0 flex-1 flex-col",
|
|
504
|
-
children: /* @__PURE__ */
|
|
505
|
-
onApprovePendingWrite:
|
|
506
|
-
approvingWriteRef:
|
|
507
|
-
messages:
|
|
508
|
-
streamingMessageId:
|
|
509
|
-
failedMessageId:
|
|
510
|
-
onRetry:
|
|
506
|
+
children: /* @__PURE__ */ k(Ae, {
|
|
507
|
+
onApprovePendingWrite: Bt,
|
|
508
|
+
approvingWriteRef: It,
|
|
509
|
+
messages: Gt,
|
|
510
|
+
streamingMessageId: St,
|
|
511
|
+
failedMessageId: Ct,
|
|
512
|
+
onRetry: Ht
|
|
511
513
|
})
|
|
512
514
|
}),
|
|
513
|
-
/* @__PURE__ */
|
|
514
|
-
onStartVoiceSession:
|
|
515
|
-
onSend: (e, t) => void
|
|
516
|
-
disabled:
|
|
515
|
+
/* @__PURE__ */ k(ze, {
|
|
516
|
+
onStartVoiceSession: Q.available && L !== "api-calls" ? Q.start : void 0,
|
|
517
|
+
onSend: (e, t) => void q(e, t),
|
|
518
|
+
disabled: xt,
|
|
517
519
|
placeholder: L === "api-calls" ? A("chatArea.placeholderActions", "What would you like me to do?") : A("chatArea.placeholderGeneral", "Ask me anything…"),
|
|
518
520
|
mode: L,
|
|
519
|
-
writeAccessDenied:
|
|
520
|
-
availableModes:
|
|
521
|
-
onModeChange:
|
|
521
|
+
writeAccessDenied: x === "denied" && !!Pt?.writeCapable,
|
|
522
|
+
availableModes: Et,
|
|
523
|
+
onModeChange: Qt
|
|
522
524
|
})
|
|
523
525
|
]
|
|
524
526
|
}),
|
|
525
|
-
|
|
526
|
-
turns:
|
|
527
|
-
onClose: () =>
|
|
528
|
-
onSave:
|
|
529
|
-
onContinueInChat:
|
|
527
|
+
kt && !Q.active ? /* @__PURE__ */ k(De, {
|
|
528
|
+
turns: Y,
|
|
529
|
+
onClose: () => At(!1),
|
|
530
|
+
onSave: Kt,
|
|
531
|
+
onContinueInChat: Jt ? Yt : void 0,
|
|
530
532
|
closeOnEscape: !0
|
|
531
533
|
}) : null,
|
|
532
|
-
|
|
533
|
-
session:
|
|
534
|
-
notice:
|
|
535
|
-
capturing:
|
|
536
|
-
interrupting:
|
|
537
|
-
awaitingEndpoint:
|
|
538
|
-
turns:
|
|
539
|
-
spokenChunks:
|
|
540
|
-
attachments:
|
|
541
|
-
onAttachFiles:
|
|
542
|
-
onRemoveAttachment:
|
|
543
|
-
onRetryAttachment:
|
|
544
|
-
canAttachMore:
|
|
545
|
-
preparingAttachments:
|
|
546
|
-
onSaveTranscript:
|
|
547
|
-
onContinueInChat:
|
|
534
|
+
Q.active && /* @__PURE__ */ k(je, {
|
|
535
|
+
session: Q.session,
|
|
536
|
+
notice: Q.notice,
|
|
537
|
+
capturing: Q.capturing,
|
|
538
|
+
interrupting: Q.interrupting,
|
|
539
|
+
awaitingEndpoint: Q.awaitingEndpoint,
|
|
540
|
+
turns: Y,
|
|
541
|
+
spokenChunks: Q.spokenChunks,
|
|
542
|
+
attachments: X.attachments,
|
|
543
|
+
onAttachFiles: X.addFiles,
|
|
544
|
+
onRemoveAttachment: X.remove,
|
|
545
|
+
onRetryAttachment: X.retry,
|
|
546
|
+
canAttachMore: X.canAddMore,
|
|
547
|
+
preparingAttachments: X.preparingCount,
|
|
548
|
+
onSaveTranscript: Kt,
|
|
549
|
+
onContinueInChat: Yt,
|
|
548
550
|
onInterrupt: () => {
|
|
549
|
-
|
|
551
|
+
Q.interrupt(), zt();
|
|
550
552
|
},
|
|
551
|
-
spoken:
|
|
552
|
-
onToggleMute:
|
|
553
|
-
onEnd:
|
|
553
|
+
spoken: Wt,
|
|
554
|
+
onToggleMute: Q.toggleMute,
|
|
555
|
+
onEnd: Zt
|
|
554
556
|
}),
|
|
555
|
-
/* @__PURE__ */
|
|
556
|
-
open:
|
|
557
|
-
onConfirm:
|
|
558
|
-
onCancel:
|
|
557
|
+
/* @__PURE__ */ k(Ve, {
|
|
558
|
+
open: Dt !== null,
|
|
559
|
+
onConfirm: $t,
|
|
560
|
+
onCancel: en
|
|
559
561
|
})
|
|
560
562
|
]
|
|
561
563
|
});
|
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 };
|