@burdenoff/fe-libs 2026.910.7 → 2026.911.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 +6 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/preview/AssistantPreviewOverlay.d.ts +5 -0
- package/dist/shared/assistant/preview/AssistantPreviewOverlay.d.ts.map +1 -0
- package/dist/shared/assistant/preview/AssistantPreviewOverlay.js +65 -0
- package/dist/shared/assistant/preview/context.d.ts +9 -0
- package/dist/shared/assistant/preview/context.d.ts.map +1 -0
- package/dist/shared/assistant/preview/context.js +12 -0
- package/dist/shared/assistant/preview/previewTransitions.d.ts +78 -0
- package/dist/shared/assistant/preview/previewTransitions.d.ts.map +1 -0
- package/dist/shared/assistant/preview/previewTransitions.js +96 -0
- package/dist/shared/assistant/preview/types.d.ts +121 -0
- package/dist/shared/assistant/preview/types.d.ts.map +1 -0
- package/dist/shared/assistant/preview/useAssistantPreviewBridge.d.ts +3 -0
- package/dist/shared/assistant/preview/useAssistantPreviewBridge.d.ts.map +1 -0
- package/dist/shared/assistant/preview/useAssistantPreviewBridge.js +71 -0
- package/dist/shared/assistant/ui/AIAssistantPanel.d.ts +8 -0
- package/dist/shared/assistant/ui/AIAssistantPanel.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AIAssistantPanel.js +82 -45
- package/dist/shared/assistant/ui/AssistantHeader.d.ts +10 -0
- package/dist/shared/assistant/ui/AssistantHeader.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantHeader.js +46 -36
- package/dist/shared/assistant/ui/panelOverlays.d.ts +48 -0
- package/dist/shared/assistant/ui/panelOverlays.d.ts.map +1 -0
- package/dist/shared/assistant/ui/panelOverlays.js +16 -0
- package/dist/shared-assistant.js +40 -35
- package/package.json +1 -1
|
@@ -91,6 +91,12 @@ export * from './ui/composer/AssistantAttachmentButton';
|
|
|
91
91
|
export * from './ui/composer/AssistantAttachmentChips';
|
|
92
92
|
export * from './ui/composer/AssistantConnectSourceItem';
|
|
93
93
|
export * from './ui/composer/connectSource';
|
|
94
|
+
export * from './preview/types';
|
|
95
|
+
export * from './preview/context';
|
|
96
|
+
export * from './preview/previewTransitions';
|
|
97
|
+
export * from './ui/panelOverlays';
|
|
98
|
+
export * from './preview/useAssistantPreviewBridge';
|
|
99
|
+
export * from './preview/AssistantPreviewOverlay';
|
|
94
100
|
export * from './ui/composer/AssistantLanguageSelector';
|
|
95
101
|
export * from './ui/composer/AssistantModeSelector';
|
|
96
102
|
export * from './ui/composer/AssistantVoiceButton';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AAGxB,cAAc,wBAAwB,CAAC;AAKvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAG9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;A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preview/AssistantPreviewOverlay.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAA6B,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;AA0E3E,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC;IAAE,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CAoF/D,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { useAssistantTr as e } from "../i18n.js";
|
|
2
|
+
import { useAssistantStore as t } from "../store.js";
|
|
3
|
+
import { useAssistantPreview as n } from "./context.js";
|
|
4
|
+
import { Component as r } from "react";
|
|
5
|
+
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
//#region src/shared/assistant/preview/AssistantPreviewOverlay.tsx
|
|
7
|
+
var s = class extends r {
|
|
8
|
+
state = {
|
|
9
|
+
failed: !1,
|
|
10
|
+
shownFor: this.props.resetKey
|
|
11
|
+
};
|
|
12
|
+
static getDerivedStateFromProps(e, t) {
|
|
13
|
+
return e.resetKey === t.shownFor ? null : {
|
|
14
|
+
failed: !1,
|
|
15
|
+
shownFor: e.resetKey
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
static getDerivedStateFromError() {
|
|
19
|
+
return { failed: !0 };
|
|
20
|
+
}
|
|
21
|
+
componentDidCatch(e, t) {
|
|
22
|
+
console.error("[assistant] preview surface threw", e, t.componentStack);
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
return this.state.failed ? this.props.fallback : this.props.children;
|
|
26
|
+
}
|
|
27
|
+
}, c = ({ controller: e }) => /* @__PURE__ */ a(i, { children: e.render() }), l = ({ onClose: r }) => {
|
|
28
|
+
let i = n(), l = e(), u = t((e) => {
|
|
29
|
+
let t = e.activeConversationId, n = t ? e.processingByConversationId[t]?.messageId : null;
|
|
30
|
+
return !t || !n ? "idle" : `${t}:${n}#${e.conversations.find((e) => e.id === t)?.updatedAt ?? ""}`;
|
|
31
|
+
});
|
|
32
|
+
return i ? /* @__PURE__ */ o("div", {
|
|
33
|
+
className: "absolute inset-0 z-10 flex flex-col bg-bg-surface animate-in slide-in-from-right-2 fade-in duration-200",
|
|
34
|
+
role: "region",
|
|
35
|
+
"aria-label": i.label ?? l("preview.title", "Preview"),
|
|
36
|
+
"data-testid": "assistant-preview",
|
|
37
|
+
children: [/* @__PURE__ */ o("div", {
|
|
38
|
+
className: "flex items-center justify-between border-b border-border-default px-3 py-2",
|
|
39
|
+
children: [/* @__PURE__ */ a("span", {
|
|
40
|
+
className: "text-sm font-medium text-text-primary",
|
|
41
|
+
children: i.label ?? l("preview.title", "Preview")
|
|
42
|
+
}), /* @__PURE__ */ a("button", {
|
|
43
|
+
type: "button",
|
|
44
|
+
onClick: r,
|
|
45
|
+
className: "rounded-md px-2 py-1 text-xs text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong",
|
|
46
|
+
"aria-label": l("preview.close", "Close preview"),
|
|
47
|
+
"data-testid": "assistant-preview-close",
|
|
48
|
+
children: l("preview.close", "Close preview")
|
|
49
|
+
})]
|
|
50
|
+
}), /* @__PURE__ */ a("div", {
|
|
51
|
+
className: "min-h-0 flex-1 overflow-y-auto",
|
|
52
|
+
children: /* @__PURE__ */ a(s, {
|
|
53
|
+
resetKey: u,
|
|
54
|
+
fallback: /* @__PURE__ */ a("p", {
|
|
55
|
+
className: "p-4 text-sm text-text-muted",
|
|
56
|
+
"data-testid": "assistant-preview-failed",
|
|
57
|
+
children: l("preview.failed", "The preview could not be displayed.")
|
|
58
|
+
}),
|
|
59
|
+
children: /* @__PURE__ */ a(c, { controller: i })
|
|
60
|
+
})
|
|
61
|
+
})]
|
|
62
|
+
}) : null;
|
|
63
|
+
};
|
|
64
|
+
//#endregion
|
|
65
|
+
export { l as AssistantPreviewOverlay };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { AssistantPreviewController } from './types';
|
|
3
|
+
export declare const AssistantPreviewProvider: FC<{
|
|
4
|
+
value?: AssistantPreviewController;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}>;
|
|
7
|
+
/** The product's controller, or null when the product supplied none. */
|
|
8
|
+
export declare function useAssistantPreview(): AssistantPreviewController | null;
|
|
9
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/preview/context.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAA6B,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE3E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAM1D,eAAO,MAAM,wBAAwB,EAAE,EAAE,CAAC;IACxC,KAAK,CAAC,EAAE,0BAA0B,CAAC;IACnC,QAAQ,EAAE,SAAS,CAAC;CACrB,CAIA,CAAC;AAEF,wEAAwE;AACxE,wBAAgB,mBAAmB,IAAI,0BAA0B,GAAG,IAAI,CAEvE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createContext as e, useContext as t } from "react";
|
|
2
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
+
//#region src/shared/assistant/preview/context.tsx
|
|
4
|
+
var r = e(null), i = ({ value: e, children: t }) => /* @__PURE__ */ n(r.Provider, {
|
|
5
|
+
value: e ?? null,
|
|
6
|
+
children: t
|
|
7
|
+
});
|
|
8
|
+
function a() {
|
|
9
|
+
return t(r);
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { i as AssistantPreviewProvider, a as useAssistantPreview };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { AssistantConversationStatus } from '../conversation';
|
|
2
|
+
import { AssistantPreviewEvent, AssistantPreviewRun } from './types';
|
|
3
|
+
export interface PreviewBridgeState {
|
|
4
|
+
/**
|
|
5
|
+
* ★★ The conversation whose baseline has been established.
|
|
6
|
+
*
|
|
7
|
+
* It exists to tell two indistinguishable-looking situations apart. Mounting
|
|
8
|
+
* onto a conversation whose LAST turn already settled must NOT replay that
|
|
9
|
+
* turn — the entry commonly still holds a `complete` status long after the
|
|
10
|
+
* answer was read. But a turn that fails SYNCHRONOUSLY is the same shape: the
|
|
11
|
+
* no-workspace path throws inside the same block as the `provisioning` write
|
|
12
|
+
* (AssistantChatArea.tsx:1024 then :1492), React batches them, and the bridge
|
|
13
|
+
* sees only `error`. Requiring a prior `start` suppressed every event for
|
|
14
|
+
* that whole class of failure — the user saw an error in the transcript and
|
|
15
|
+
* the preview showed nothing at all.
|
|
16
|
+
*
|
|
17
|
+
* ★★ PER CONVERSATION, not a single flag. Terminal processing entries
|
|
18
|
+
* deliberately persist, so with one global flag, selecting a History row
|
|
19
|
+
* whose entry still held `complete` re-announced that OLD settled turn and
|
|
20
|
+
* replaced the product's preview with stale output — the very replay this
|
|
21
|
+
* guard exists to prevent, reached by switching conversation instead of by
|
|
22
|
+
* mounting. The first observation of EACH conversation is a baseline.
|
|
23
|
+
*/
|
|
24
|
+
readonly observedConversationId: string | null;
|
|
25
|
+
/**
|
|
26
|
+
* The run announced with `start` and not yet finished.
|
|
27
|
+
*
|
|
28
|
+
* ★ Clearing this IS the idempotence mechanism — a settled run is no longer
|
|
29
|
+
* anybody's started run, so no second `end` can be derived for it. An earlier
|
|
30
|
+
* draft also carried an `endedRunId`; a mutation test showed nothing could
|
|
31
|
+
* distinguish its presence from its absence, because this null already did
|
|
32
|
+
* the work. Two mechanisms for one guarantee is how they drift apart.
|
|
33
|
+
*/
|
|
34
|
+
readonly startedRun: AssistantPreviewRun | null;
|
|
35
|
+
/**
|
|
36
|
+
* ★★ The last run finished. NOT redundant with `startedRun` being null: a
|
|
37
|
+
* settled status can be written more than once, and since a terminal run
|
|
38
|
+
* first seen already-terminal now gets a lifecycle, "no started run" alone
|
|
39
|
+
* cannot tell a REPEATED `complete` from a genuinely new failed run. Without
|
|
40
|
+
* this the second `complete` tick re-announced the same run and ended it
|
|
41
|
+
* twice.
|
|
42
|
+
*
|
|
43
|
+
* (An earlier revision carried this field, found nothing could distinguish
|
|
44
|
+
* its presence from its absence, and removed it. That was correct then and is
|
|
45
|
+
* wrong now — the terminal-first case is what gives it work to do.)
|
|
46
|
+
*/
|
|
47
|
+
readonly lastEndedRunId: string | null;
|
|
48
|
+
/** The last content emitted, so an unchanged tick is not re-emitted. */
|
|
49
|
+
readonly lastSnapshot: string | null;
|
|
50
|
+
}
|
|
51
|
+
export declare const IDLE_PREVIEW_STATE: PreviewBridgeState;
|
|
52
|
+
export interface PreviewInput {
|
|
53
|
+
/**
|
|
54
|
+
* The turn the store currently describes, or null when the entry is gone.
|
|
55
|
+
* ★ null is NOT "nothing to do" — it is how an interrupted run ends.
|
|
56
|
+
*/
|
|
57
|
+
readonly run: AssistantPreviewRun | null;
|
|
58
|
+
/**
|
|
59
|
+
* ★★ The ACTIVE conversation, independent of whether it has a run.
|
|
60
|
+
*
|
|
61
|
+
* The baseline used to be derivable only from a run — so a panel opened on an
|
|
62
|
+
* IDLE conversation recorded nothing, and when that conversation's first turn
|
|
63
|
+
* then failed synchronously the terminal render was still "unbaselined" and
|
|
64
|
+
* emitted no events at all. The very case the baseline exists to permit,
|
|
65
|
+
* defeated by the baseline needing a run to establish itself.
|
|
66
|
+
*/
|
|
67
|
+
readonly conversationId: string | null;
|
|
68
|
+
readonly status: AssistantConversationStatus;
|
|
69
|
+
readonly content: string | null;
|
|
70
|
+
readonly error?: string | null;
|
|
71
|
+
/** `isStageCopy`, injected so this stays pure and testable without i18n. */
|
|
72
|
+
readonly isFiller: (content: string) => boolean;
|
|
73
|
+
}
|
|
74
|
+
export declare function nextPreviewEvents(state: PreviewBridgeState, input: PreviewInput): {
|
|
75
|
+
events: AssistantPreviewEvent[];
|
|
76
|
+
state: PreviewBridgeState;
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=previewTransitions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"previewTransitions.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/preview/previewTransitions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAS1E,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,QAAQ,CAAC,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/C;;;;;;;;OAQG;IACH,QAAQ,CAAC,UAAU,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAChD;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,wEAAwE;IACxE,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;AAED,eAAO,MAAM,kBAAkB,EAAE,kBAKhC,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACzC;;;;;;;;OAQG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,2BAA2B,CAAC;IAC7C,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,4EAA4E;IAC5E,QAAQ,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;CACjD;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,kBAAkB,EACzB,KAAK,EAAE,YAAY,GAClB;IAAE,MAAM,EAAE,qBAAqB,EAAE,CAAC;IAAC,KAAK,EAAE,kBAAkB,CAAA;CAAE,CAiIhE"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
//#region src/shared/assistant/preview/previewTransitions.ts
|
|
2
|
+
var e = new Set([
|
|
3
|
+
"provisioning",
|
|
4
|
+
"connecting",
|
|
5
|
+
"streaming"
|
|
6
|
+
]), t = {
|
|
7
|
+
observedConversationId: null,
|
|
8
|
+
startedRun: null,
|
|
9
|
+
lastEndedRunId: null,
|
|
10
|
+
lastSnapshot: null
|
|
11
|
+
};
|
|
12
|
+
function n(t, n) {
|
|
13
|
+
let r = [], i = n.run?.runId ?? null, a = n.conversationId ?? n.run?.conversationId ?? null, o = a !== null && t.observedConversationId === a, s = {
|
|
14
|
+
...t,
|
|
15
|
+
observedConversationId: a ?? t.observedConversationId
|
|
16
|
+
}, c = s.startedRun;
|
|
17
|
+
if (c && c.runId !== i && (r.push({
|
|
18
|
+
kind: "end",
|
|
19
|
+
run: c,
|
|
20
|
+
outcome: "abandoned",
|
|
21
|
+
error: null
|
|
22
|
+
}), s = {
|
|
23
|
+
...s,
|
|
24
|
+
startedRun: null,
|
|
25
|
+
lastEndedRunId: c.runId
|
|
26
|
+
}), !n.run) return {
|
|
27
|
+
events: r,
|
|
28
|
+
state: s
|
|
29
|
+
};
|
|
30
|
+
if (e.has(n.status)) {
|
|
31
|
+
s.startedRun?.runId !== n.run.runId && (r.push({
|
|
32
|
+
kind: "start",
|
|
33
|
+
run: n.run
|
|
34
|
+
}), s = {
|
|
35
|
+
...s,
|
|
36
|
+
startedRun: n.run,
|
|
37
|
+
lastSnapshot: null
|
|
38
|
+
});
|
|
39
|
+
let e = s.startedRun ?? n.run, t = n.content;
|
|
40
|
+
return t && !n.isFiller(t) && t !== s.lastSnapshot && (r.push({
|
|
41
|
+
kind: "snapshot",
|
|
42
|
+
run: e,
|
|
43
|
+
content: t
|
|
44
|
+
}), s = {
|
|
45
|
+
...s,
|
|
46
|
+
lastSnapshot: t
|
|
47
|
+
}), {
|
|
48
|
+
events: r,
|
|
49
|
+
state: s
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (!s.startedRun) {
|
|
53
|
+
if (!o || s.lastEndedRunId === n.run.runId) return {
|
|
54
|
+
events: r,
|
|
55
|
+
state: {
|
|
56
|
+
...s,
|
|
57
|
+
lastEndedRunId: n.run.runId
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
r.push({
|
|
61
|
+
kind: "start",
|
|
62
|
+
run: n.run
|
|
63
|
+
}), s = {
|
|
64
|
+
...s,
|
|
65
|
+
startedRun: n.run,
|
|
66
|
+
lastSnapshot: null
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
let l = s.startedRun;
|
|
70
|
+
if (l && l.runId === n.run.runId) {
|
|
71
|
+
let e = n.content;
|
|
72
|
+
e && !n.isFiller(e) && e !== s.lastSnapshot && (r.push({
|
|
73
|
+
kind: "snapshot",
|
|
74
|
+
run: l,
|
|
75
|
+
content: e
|
|
76
|
+
}), s = {
|
|
77
|
+
...s,
|
|
78
|
+
lastSnapshot: e
|
|
79
|
+
}), r.push({
|
|
80
|
+
kind: "end",
|
|
81
|
+
run: l,
|
|
82
|
+
outcome: n.status === "error" ? "error" : "complete",
|
|
83
|
+
error: n.error ?? null
|
|
84
|
+
}), s = {
|
|
85
|
+
...s,
|
|
86
|
+
startedRun: null,
|
|
87
|
+
lastEndedRunId: l.runId
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
events: r,
|
|
92
|
+
state: s
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
export { t as IDLE_PREVIEW_STATE, n as nextPreviewEvents };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* One logical run.
|
|
4
|
+
*
|
|
5
|
+
* ★★ `runId` is `${conversationId}:${messageId}`, and that pair is chosen
|
|
6
|
+
* because it is the only identity that SURVIVES THE INTERNAL RETRY. The
|
|
7
|
+
* assistant message id is minted once per turn (AssistantChatArea.tsx:995),
|
|
8
|
+
* outside `sendWithRealBackend` (:1079), which the failure path re-enters as
|
|
9
|
+
* `sendWithRealBackend(2)` (:1477) — and that retry swaps the sandbox id and
|
|
10
|
+
* the session id. A payload keyed on either would split one logical run in two,
|
|
11
|
+
* and a late callback from the first attempt could be mistaken for a new run.
|
|
12
|
+
*/
|
|
13
|
+
export interface AssistantPreviewRun {
|
|
14
|
+
readonly runId: string;
|
|
15
|
+
readonly conversationId: string;
|
|
16
|
+
readonly messageId: string;
|
|
17
|
+
/**
|
|
18
|
+
* ★ The workspace as it was when the run STARTED, not as it is now.
|
|
19
|
+
* `getWorkspaceId()` reads the URL live and the panel survives in-app
|
|
20
|
+
* navigation, so re-deriving this per event would file a run's output under a
|
|
21
|
+
* workspace it never ran in.
|
|
22
|
+
*/
|
|
23
|
+
readonly workspaceId: string | null;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* ★★ SPOKEN TURNS ARE INCLUDED, deliberately. Voice and typed turns share one
|
|
27
|
+
* message array and are separated by `isVoiceTurn`, which every reader of the
|
|
28
|
+
* TRANSCRIPT applies (`turnVisibility.ts:83`, `useConversationTurns.ts:46`,
|
|
29
|
+
* `AssistantConversationList.tsx:13`, `exportConversation.ts:1`) so that spoken
|
|
30
|
+
* turns stay out of the typed thread.
|
|
31
|
+
*
|
|
32
|
+
* The preview is not a transcript. It follows whatever turn the assistant is
|
|
33
|
+
* running, and a spoken turn is a turn — filtering it would leave a product's
|
|
34
|
+
* surface frozen for the whole of a voice answer, which is worse than showing
|
|
35
|
+
* it. Stated here because the omission otherwise reads as an oversight next to
|
|
36
|
+
* four readers that all filter, and because a product wanting to distinguish
|
|
37
|
+
* modality will need a flag on this type: add one when a product actually needs
|
|
38
|
+
* it, rather than guessing the shape before there is a consumer.
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* ★★ `snapshot` REPLACES, it never appends. The orchestrator's poll loop
|
|
42
|
+
* rewrites the whole message content on every tick
|
|
43
|
+
* (AssistantChatArea.tsx:1329), so a consumer that appended would accumulate
|
|
44
|
+
* duplicates of the same answer. The `kind` says so at the type level rather
|
|
45
|
+
* than in a comment a consumer never reads.
|
|
46
|
+
*/
|
|
47
|
+
export type AssistantPreviewEvent = {
|
|
48
|
+
kind: "start";
|
|
49
|
+
run: AssistantPreviewRun;
|
|
50
|
+
} | {
|
|
51
|
+
kind: "snapshot";
|
|
52
|
+
run: AssistantPreviewRun;
|
|
53
|
+
content: string;
|
|
54
|
+
} | {
|
|
55
|
+
kind: "end";
|
|
56
|
+
run: AssistantPreviewRun;
|
|
57
|
+
/**
|
|
58
|
+
* ★★ `abandoned` is not a failure and not a completion — it is a run the
|
|
59
|
+
* bridge can no longer follow. It covers a turn the user cancelled while
|
|
60
|
+
* a correction took over, a turn interrupted with nothing after it, and a
|
|
61
|
+
* conversation switched away from mid-turn. In every one of those the
|
|
62
|
+
* turn writes NO terminal status (`turnState.ts:70`), so without this
|
|
63
|
+
* outcome the run would simply never end and a preview would sit showing
|
|
64
|
+
* progress forever. The turn may or may not still be executing.
|
|
65
|
+
*/
|
|
66
|
+
outcome: "complete" | "error" | "abandoned";
|
|
67
|
+
/**
|
|
68
|
+
* ★ NON-optional. Every terminal branch sets this — `complete` and
|
|
69
|
+
* `error` from the store, `abandoned` explicitly as null — so leaving it
|
|
70
|
+
* optional let a future branch omit it and hand a consumer `undefined`
|
|
71
|
+
* where it had been promised `null`. The type now enforces at compile
|
|
72
|
+
* time what the tests pin at runtime.
|
|
73
|
+
*/
|
|
74
|
+
error: string | null;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* ★★ KEEP THIS OBJECT STABLE across renders — memoise it, or hold it in a ref.
|
|
78
|
+
*
|
|
79
|
+
* Two things depend on it, and both fail quietly rather than loudly:
|
|
80
|
+
*
|
|
81
|
+
* - The bridge's effect depends on the controller. It deliberately does NOT
|
|
82
|
+
* reset its run state when the identity changes, precisely so that the
|
|
83
|
+
* natural `preview={{ render, onEvent }}` — a new object every render — does
|
|
84
|
+
* not re-announce `start` on every poll tick. The cost of that choice is that
|
|
85
|
+
* REPLACING one working controller with another mid-run leaves the newcomer
|
|
86
|
+
* without a `start` for the run already in flight. Swap controllers between
|
|
87
|
+
* runs, not during one.
|
|
88
|
+
*
|
|
89
|
+
* - `render()` is invoked inside a single `PreviewSurface` component, so its
|
|
90
|
+
* hooks belong to that component's fiber. Swapping in a renderer with a
|
|
91
|
+
* DIFFERENT hook layout while the overlay is open is the classic
|
|
92
|
+
* "rendered more hooks than during the previous render" error. Keep one
|
|
93
|
+
* renderer per mounted preview, and branch inside it rather than swapping it.
|
|
94
|
+
*
|
|
95
|
+
* Neither is enforced by the type system: a named function passed as a callback
|
|
96
|
+
* satisfies the hooks lint, so nothing warns.
|
|
97
|
+
*/
|
|
98
|
+
export interface AssistantPreviewController {
|
|
99
|
+
/**
|
|
100
|
+
* The product's own preview surface. Returns JSX and is called during render,
|
|
101
|
+
* so it may use hooks like any component body.
|
|
102
|
+
*
|
|
103
|
+
* ★ It is rendered as an OVERLAY over a still-mounted chat area — never as an
|
|
104
|
+
* alternate view. Swapping the panel's body would unmount `AssistantChatArea`
|
|
105
|
+
* and take the voice session, the in-flight turn, draft attachments and the
|
|
106
|
+
* composer draft with it, while turn status lives on in the zustand store:
|
|
107
|
+
* split-brain rather than a clean stop.
|
|
108
|
+
*/
|
|
109
|
+
render: () => ReactNode;
|
|
110
|
+
/**
|
|
111
|
+
* Run-scoped progress. Optional: a product may want the surface without the
|
|
112
|
+
* stream.
|
|
113
|
+
*
|
|
114
|
+
* ★ Non-blocking and error-contained by the bridge — a throwing observer must
|
|
115
|
+
* never disturb the assistant, and must never cause a retry.
|
|
116
|
+
*/
|
|
117
|
+
onEvent?: (event: AssistantPreviewEvent) => void;
|
|
118
|
+
/** Toggle label. Product-neutral English fallback if omitted. */
|
|
119
|
+
label?: string;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/preview/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;;;;;;;;;GAUG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAED;;;;;;;;;;;;;;GAcG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAC7B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,mBAAmB,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,GAAG,EAAE,mBAAmB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC/D;IACE,IAAI,EAAE,KAAK,CAAC;IACZ,GAAG,EAAE,mBAAmB,CAAC;IACzB;;;;;;;;OAQG;IACH,OAAO,EAAE,UAAU,GAAG,OAAO,GAAG,WAAW,CAAC;IAC5C;;;;;;OAMG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAC;AAEN;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;;;;;;;OASG;IACH,MAAM,EAAE,MAAM,SAAS,CAAC;IAExB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAEjD,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAssistantPreviewBridge.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/preview/useAssistantPreviewBridge.ts"],"names":[],"mappings":"AAyCA,OAAO,KAAK,EAAE,0BAA0B,EAAyB,MAAM,SAAS,CAAC;AAyCjF,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,0BAA0B,GAAG,IAAI,GAC5C,IAAI,CAoKN"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { useAssistantTr as e } from "../i18n.js";
|
|
2
|
+
import { useAssistantStore as t } from "../store.js";
|
|
3
|
+
import { isStageCopy as n } from "../stageCopy.js";
|
|
4
|
+
import { getWorkspaceId as r } from "../context.js";
|
|
5
|
+
import { IDLE_PREVIEW_STATE as i, nextPreviewEvents as a } from "./previewTransitions.js";
|
|
6
|
+
import { useEffect as o, useRef as s } from "react";
|
|
7
|
+
//#region src/shared/assistant/preview/useAssistantPreviewBridge.ts
|
|
8
|
+
function c(e, t) {
|
|
9
|
+
try {
|
|
10
|
+
let n = e?.onEvent?.(t);
|
|
11
|
+
n && typeof n.then == "function" && Promise.resolve(n).catch((e) => {
|
|
12
|
+
console.error("[assistant] preview observer rejected", e);
|
|
13
|
+
});
|
|
14
|
+
} catch (e) {
|
|
15
|
+
console.error("[assistant] preview observer threw", e);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function l(l) {
|
|
19
|
+
let u = e(), d = t((e) => e.activeConversationId), f = t((e) => e.activeConversationId ? e.processingByConversationId[e.activeConversationId] : void 0), p = t((e) => {
|
|
20
|
+
let t = e.activeConversationId, n = t ? e.processingByConversationId[t]?.messageId : null;
|
|
21
|
+
return !t || !n ? null : e.conversations.find((e) => e.id === t)?.messages.find((e) => e.id === n)?.content ?? null;
|
|
22
|
+
}), m = s(i), h = s(null), g = s(null);
|
|
23
|
+
o(() => {
|
|
24
|
+
h.current = l;
|
|
25
|
+
}, [l]), o(() => () => {
|
|
26
|
+
let { events: e, state: t } = a(m.current, {
|
|
27
|
+
run: null,
|
|
28
|
+
conversationId: null,
|
|
29
|
+
status: "idle",
|
|
30
|
+
content: null,
|
|
31
|
+
isFiller: () => !1
|
|
32
|
+
});
|
|
33
|
+
m.current = t;
|
|
34
|
+
for (let t of e) c(h.current, t);
|
|
35
|
+
}, []), o(() => {
|
|
36
|
+
if (!l?.onEvent) {
|
|
37
|
+
m.current = i;
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
let e = (e) => {
|
|
41
|
+
c(l, e);
|
|
42
|
+
}, t = f?.messageId ?? null, o = d && t ? {
|
|
43
|
+
runId: `${d}:${t}`,
|
|
44
|
+
conversationId: d,
|
|
45
|
+
messageId: t,
|
|
46
|
+
workspaceId: r() || null
|
|
47
|
+
} : null;
|
|
48
|
+
o && g.current?.runId !== o.runId && (g.current = {
|
|
49
|
+
runId: o.runId,
|
|
50
|
+
tr: u
|
|
51
|
+
});
|
|
52
|
+
let s = o ? g.current?.tr ?? u : u, { events: h, state: _ } = a(m.current, {
|
|
53
|
+
run: o,
|
|
54
|
+
conversationId: d,
|
|
55
|
+
status: f?.status ?? "idle",
|
|
56
|
+
content: p,
|
|
57
|
+
error: f?.error ?? null,
|
|
58
|
+
isFiller: (e) => n(s, e)
|
|
59
|
+
});
|
|
60
|
+
m.current = _;
|
|
61
|
+
for (let t of h) e(t);
|
|
62
|
+
}, [
|
|
63
|
+
l,
|
|
64
|
+
d,
|
|
65
|
+
f,
|
|
66
|
+
p,
|
|
67
|
+
u
|
|
68
|
+
]);
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
export { l as useAssistantPreviewBridge };
|
|
@@ -2,6 +2,7 @@ import { FC } from 'react';
|
|
|
2
2
|
import { PanelProps } from '../../plugins/types';
|
|
3
3
|
import { WorkspaceWriteAccess } from '../useWorkspaceWriteAccess';
|
|
4
4
|
import { AssistantNavigate } from './AssistantMarkdownRenderer';
|
|
5
|
+
import { AssistantPreviewController } from '../preview/types';
|
|
5
6
|
export type AIAssistantPanelProps = PanelProps & {
|
|
6
7
|
/** When provided, renders a dock/float toggle in the header. */
|
|
7
8
|
docked?: boolean;
|
|
@@ -35,6 +36,13 @@ export type AIAssistantPanelProps = PanelProps & {
|
|
|
35
36
|
* opens in a new tab.
|
|
36
37
|
*/
|
|
37
38
|
connectSourceHref?: string;
|
|
39
|
+
/**
|
|
40
|
+
* An optional product preview surface, shown as an overlay over the chat.
|
|
41
|
+
*
|
|
42
|
+
* ★ Absence is the off-switch — no controller, no toggle, no overlay and no
|
|
43
|
+
* events. There is deliberately no second flag that could disagree with it.
|
|
44
|
+
*/
|
|
45
|
+
preview?: AssistantPreviewController;
|
|
38
46
|
};
|
|
39
47
|
/**
|
|
40
48
|
* The panel.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AIAssistantPanel.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AIAssistantPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAU,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"AIAssistantPanel.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AIAssistantPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAU,KAAK,EAAE,EAAY,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAMtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAIvE,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,6BAA6B,CAAC;AAQrC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAGnE,MAAM,MAAM,qBAAqB,GAAG,UAAU,GAAG;IAC/C,gEAAgE;IAChE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B;;;;;;;;;OASG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,0BAA0B,CAAC;CACtC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAyMtD,CAAC"}
|
|
@@ -4,55 +4,92 @@ import { AssistantNavigateProvider as n } from "./AssistantMarkdownRenderer.js";
|
|
|
4
4
|
import { useAssistantStore as r } from "../store.js";
|
|
5
5
|
import { AssistantSpeechProvider as i } from "./AssistantSpeechProvider.js";
|
|
6
6
|
import { AssistantConnectSourceProvider as a } from "./composer/connectSource.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
7
|
+
import { AssistantPreviewProvider as o } from "../preview/context.js";
|
|
8
|
+
import { escapeDismisses as s, nextPanelOverlays as c } from "./panelOverlays.js";
|
|
9
|
+
import { useAssistantPreviewBridge as l } from "../preview/useAssistantPreviewBridge.js";
|
|
10
|
+
import { AssistantPreviewOverlay as u } from "../preview/AssistantPreviewOverlay.js";
|
|
11
|
+
import { AssistantHeader as d } from "./AssistantHeader.js";
|
|
12
|
+
import { AssistantConversationList as f } from "./AssistantConversationList.js";
|
|
13
|
+
import { useFilesServiceWarmup as p } from "../../../storage/warmFilesService.js";
|
|
14
|
+
import { useAssistantHeartbeat as m } from "../useAssistantHeartbeat.js";
|
|
15
|
+
import { useAssistantKeyboardShortcuts as h } from "../useAssistantKeyboardShortcuts.js";
|
|
16
|
+
import { AssistantChatArea as g } from "./AssistantChatArea.js";
|
|
17
|
+
import { useRef as _, useState as v } from "react";
|
|
18
|
+
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
15
19
|
//#region src/shared/assistant/ui/AIAssistantPanel.tsx
|
|
16
|
-
var
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
20
|
+
var x = ({ onClose: x, visible: S, docked: C, onToggleDock: w, writeAccess: T, onNavigate: E, connectSourceHref: D, preview: O }) => {
|
|
21
|
+
let k = t(), [A, j] = v(!1);
|
|
22
|
+
A && !O && j(!1);
|
|
23
|
+
let M = A && !!O;
|
|
24
|
+
l(O ?? null);
|
|
25
|
+
let N = _(null), { conversations: P, activeConversationId: F, conversationListOpen: I, setConversationListOpen: L, createConversation: R } = r(), z = I || M, B = (e) => {
|
|
26
|
+
let t = c({
|
|
27
|
+
historyOpen: I,
|
|
28
|
+
previewOpen: M
|
|
29
|
+
}, e);
|
|
30
|
+
L(t.historyOpen), j(t.previewOpen);
|
|
31
|
+
}, V = P.find((e) => e.id === F);
|
|
32
|
+
m(V?.backendSessionId ?? null, V?.mode ?? null, S ?? !0), p(S ?? !0);
|
|
33
|
+
let H = e(S !== !1);
|
|
34
|
+
return h({
|
|
35
|
+
panelRef: N,
|
|
36
|
+
onClose: () => {
|
|
37
|
+
if (s({
|
|
38
|
+
historyOpen: I,
|
|
39
|
+
previewOpen: M
|
|
40
|
+
}) === "overlay") {
|
|
41
|
+
L(!1), j(!1);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
x();
|
|
45
|
+
}
|
|
46
|
+
}), /* @__PURE__ */ y(i, {
|
|
47
|
+
visible: S ?? !0,
|
|
48
|
+
children: /* @__PURE__ */ y(o, {
|
|
49
|
+
value: O,
|
|
50
|
+
children: /* @__PURE__ */ y(n, {
|
|
51
|
+
value: E,
|
|
52
|
+
children: /* @__PURE__ */ y(a, {
|
|
53
|
+
value: D,
|
|
54
|
+
children: /* @__PURE__ */ b("div", {
|
|
55
|
+
ref: N,
|
|
56
|
+
className: "relative flex h-full w-full flex-col bg-bg-surface",
|
|
57
|
+
role: "complementary",
|
|
58
|
+
"aria-label": k("panel.ariaLabel", "AI Assistant"),
|
|
59
|
+
"data-testid": "ai-assistant-panel",
|
|
60
|
+
tabIndex: -1,
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ y("div", {
|
|
63
|
+
className: "contents",
|
|
64
|
+
inert: z || void 0,
|
|
65
|
+
children: /* @__PURE__ */ y(d, {
|
|
66
|
+
contextLabel: H,
|
|
67
|
+
onNewConversation: () => R(),
|
|
68
|
+
onOpenHistory: () => B("history"),
|
|
69
|
+
historyOpen: I,
|
|
70
|
+
onTogglePreview: () => B("preview"),
|
|
71
|
+
previewOpen: M,
|
|
72
|
+
onClose: x,
|
|
73
|
+
docked: C,
|
|
74
|
+
onToggleDock: w
|
|
75
|
+
})
|
|
76
|
+
}),
|
|
77
|
+
I && /* @__PURE__ */ y(f, {}),
|
|
78
|
+
M && /* @__PURE__ */ y(u, { onClose: () => j(!1) }),
|
|
79
|
+
/* @__PURE__ */ y("div", {
|
|
80
|
+
className: "contents",
|
|
81
|
+
inert: z || void 0,
|
|
82
|
+
children: /* @__PURE__ */ y(g, {
|
|
83
|
+
visible: S ?? !0,
|
|
84
|
+
writeAccess: T
|
|
85
|
+
})
|
|
86
|
+
})
|
|
87
|
+
]
|
|
88
|
+
})
|
|
52
89
|
})
|
|
53
90
|
})
|
|
54
91
|
})
|
|
55
92
|
});
|
|
56
93
|
};
|
|
57
94
|
//#endregion
|
|
58
|
-
export {
|
|
95
|
+
export { x as AIAssistantPanel };
|
|
@@ -14,6 +14,16 @@ interface Props {
|
|
|
14
14
|
onOpenHistory: () => void;
|
|
15
15
|
/** True when the history drawer is currently open (drives the toggle state). */
|
|
16
16
|
historyOpen: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* ★★ OPTIONAL, because this component is published. `AssistantHeader` is
|
|
19
|
+
* `export *`-ed from the assistant barrel and reaches the built package, so a
|
|
20
|
+
* product that composes its own panel chrome renders it directly. Two
|
|
21
|
+
* REQUIRED props would have failed that product's build the moment it bumped
|
|
22
|
+
* fe-libs — a breaking change to ship an OPTIONAL capability, which is
|
|
23
|
+
* exactly backwards. Absent, the toggle simply does not render.
|
|
24
|
+
*/
|
|
25
|
+
onTogglePreview?: () => void;
|
|
26
|
+
previewOpen?: boolean;
|
|
17
27
|
onClose: () => void;
|
|
18
28
|
docked?: boolean;
|
|
19
29
|
onToggleDock?: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantHeader.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"AssistantHeader.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAchC,UAAU,KAAK;IACb,qEAAqE;IACrE;;;;;;;OAOG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,gFAAgF;IAChF,WAAW,EAAE,OAAO,CAAC;IACrB;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,KAAK,CA4IrC,CAAC"}
|
|
@@ -1,71 +1,81 @@
|
|
|
1
1
|
import { useAssistantTr as e } from "../i18n.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { useAssistantPreview as t } from "../preview/context.js";
|
|
3
|
+
import { AssistantMoreMenu as n } from "./AssistantMoreMenu.js";
|
|
4
|
+
import { Eye as r, History as i, PanelBottom as a, PanelRight as o, Plus as s, Sparkles as c, X as l } from "lucide-react";
|
|
5
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
5
6
|
//#region src/shared/assistant/ui/AssistantHeader.tsx
|
|
6
|
-
var
|
|
7
|
-
let
|
|
8
|
-
return /* @__PURE__ */
|
|
7
|
+
var p = ({ contextLabel: p, onNewConversation: m, onOpenHistory: h, historyOpen: g, onTogglePreview: _, previewOpen: v, onClose: y, docked: b, onToggleDock: x }) => {
|
|
8
|
+
let S = e(), C = t();
|
|
9
|
+
return /* @__PURE__ */ f("div", {
|
|
9
10
|
className: "flex items-center gap-2 border-b border-border-default bg-bg-elevated px-3 py-2.5",
|
|
10
|
-
children: [/* @__PURE__ */
|
|
11
|
+
children: [/* @__PURE__ */ f("div", {
|
|
11
12
|
className: "flex min-w-0 flex-1 items-center gap-2",
|
|
12
|
-
children: [/* @__PURE__ */
|
|
13
|
+
children: [/* @__PURE__ */ d("span", {
|
|
13
14
|
className: "flex size-7 flex-shrink-0 items-center justify-center rounded-lg bg-gradient-to-br from-action-primary-bg/25 to-action-primary-bg/5 text-action-primary-bg",
|
|
14
|
-
children: /* @__PURE__ */
|
|
15
|
-
}), /* @__PURE__ */
|
|
15
|
+
children: /* @__PURE__ */ d(c, { className: "size-4" })
|
|
16
|
+
}), /* @__PURE__ */ f("span", {
|
|
16
17
|
className: "min-w-0 flex-1",
|
|
17
|
-
children: [/* @__PURE__ */
|
|
18
|
+
children: [/* @__PURE__ */ d("span", {
|
|
18
19
|
className: "block truncate text-[14px] font-semibold leading-tight text-text-primary",
|
|
19
|
-
children:
|
|
20
|
-
}), /* @__PURE__ */
|
|
20
|
+
children: S("header.title", "AI Assistant")
|
|
21
|
+
}), /* @__PURE__ */ f("span", {
|
|
21
22
|
className: "block truncate text-[11px] leading-tight text-text-muted",
|
|
22
|
-
children: [
|
|
23
|
+
children: [S("header.ready", "Ready"), p && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("span", {
|
|
23
24
|
"aria-hidden": "true",
|
|
24
25
|
children: " · "
|
|
25
|
-
}),
|
|
26
|
+
}), S("header.context", "Context: {{page}}", { page: p })] })]
|
|
26
27
|
})]
|
|
27
28
|
})]
|
|
28
|
-
}), /* @__PURE__ */
|
|
29
|
+
}), /* @__PURE__ */ f("div", {
|
|
29
30
|
className: "flex flex-shrink-0 items-center gap-0.5",
|
|
30
31
|
children: [
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
+
/* @__PURE__ */ d("button", {
|
|
32
33
|
type: "button",
|
|
33
|
-
onClick:
|
|
34
|
+
onClick: m,
|
|
34
35
|
className: "rounded-lg p-1.5 text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary",
|
|
35
|
-
"aria-label":
|
|
36
|
+
"aria-label": S("header.newConversation", "New conversation"),
|
|
36
37
|
"data-testid": "assistant-new-conversation",
|
|
37
|
-
children: /* @__PURE__ */
|
|
38
|
+
children: /* @__PURE__ */ d(s, { className: "size-4" })
|
|
38
39
|
}),
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
+
/* @__PURE__ */ d("button", {
|
|
40
41
|
type: "button",
|
|
41
|
-
onClick:
|
|
42
|
-
className: `rounded-lg p-1.5 transition-colors ${
|
|
43
|
-
"aria-label":
|
|
44
|
-
"aria-pressed":
|
|
42
|
+
onClick: h,
|
|
43
|
+
className: `rounded-lg p-1.5 transition-colors ${g ? "bg-action-primary-bg/15 text-action-primary-bg" : "text-text-secondary hover:bg-bg-sunken hover:text-text-primary"}`,
|
|
44
|
+
"aria-label": S("header.history", "Conversation history"),
|
|
45
|
+
"aria-pressed": g,
|
|
45
46
|
"data-testid": "assistant-open-history",
|
|
46
|
-
children: /* @__PURE__ */
|
|
47
|
+
children: /* @__PURE__ */ d(i, { className: "size-4" })
|
|
47
48
|
}),
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
_ && /* @__PURE__ */ l("button", {
|
|
49
|
+
C && _ && /* @__PURE__ */ d("button", {
|
|
50
50
|
type: "button",
|
|
51
51
|
onClick: _,
|
|
52
|
+
className: `rounded-lg p-1.5 transition-colors ${v ? "bg-action-primary-bg/15 text-action-primary-bg" : "text-text-secondary hover:bg-bg-sunken hover:text-text-primary"}`,
|
|
53
|
+
"aria-label": C.label ?? S("header.preview", "Preview"),
|
|
54
|
+
"aria-pressed": !!v,
|
|
55
|
+
"data-testid": "assistant-toggle-preview",
|
|
56
|
+
children: /* @__PURE__ */ d(r, { className: "size-4" })
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ d(n, {}),
|
|
59
|
+
x && /* @__PURE__ */ d("button", {
|
|
60
|
+
type: "button",
|
|
61
|
+
onClick: x,
|
|
52
62
|
className: "hidden rounded-lg p-1.5 text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary sm:inline-flex",
|
|
53
|
-
"aria-label":
|
|
54
|
-
"aria-pressed":
|
|
63
|
+
"aria-label": b ? S("header.float", "Float chat window") : S("header.dock", "Dock to side panel"),
|
|
64
|
+
"aria-pressed": b,
|
|
55
65
|
"data-testid": "assistant-toggle-dock",
|
|
56
|
-
children:
|
|
66
|
+
children: d(b ? a : o, { className: "size-4" })
|
|
57
67
|
}),
|
|
58
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ d("button", {
|
|
59
69
|
type: "button",
|
|
60
|
-
onClick:
|
|
70
|
+
onClick: y,
|
|
61
71
|
className: "rounded-lg p-1.5 text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary",
|
|
62
|
-
"aria-label":
|
|
72
|
+
"aria-label": S("header.close", "Close assistant"),
|
|
63
73
|
"data-testid": "assistant-close",
|
|
64
|
-
children: /* @__PURE__ */ l
|
|
74
|
+
children: /* @__PURE__ */ d(l, { className: "size-4" })
|
|
65
75
|
})
|
|
66
76
|
]
|
|
67
77
|
})]
|
|
68
78
|
});
|
|
69
79
|
};
|
|
70
80
|
//#endregion
|
|
71
|
-
export {
|
|
81
|
+
export { p as AssistantHeader };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which of the panel's full-surface overlays is showing.
|
|
3
|
+
*
|
|
4
|
+
* ★★ THEY ARE MUTUALLY EXCLUSIVE, and that is not a style choice. The history
|
|
5
|
+
* drawer (`AssistantConversationList.tsx:71`) and the preview surface
|
|
6
|
+
* (`AssistantPreviewOverlay.tsx:57`) are BOTH `absolute inset-0 z-10` with an
|
|
7
|
+
* opaque `bg-bg-surface`, inside the same relative panel. Equal z-index means
|
|
8
|
+
* the later one in DOM order simply paints over the earlier one, so allowing
|
|
9
|
+
* both produces three separate defects at once:
|
|
10
|
+
*
|
|
11
|
+
* - the covered surface is invisible while its own toggle still reports
|
|
12
|
+
* `aria-pressed="true"`, so a screen reader announces a drawer the sighted
|
|
13
|
+
* user cannot see and the sighted user sees a pressed button doing nothing;
|
|
14
|
+
* - closing the top one makes a surface the user had forgotten reappear
|
|
15
|
+
* unbidden, over their conversation;
|
|
16
|
+
* - which one wins depends on JSX order, so a future reorder silently swaps
|
|
17
|
+
* the behaviour with nothing to catch it.
|
|
18
|
+
*
|
|
19
|
+
* Modelled as one slot with two toggles rather than two independent booleans,
|
|
20
|
+
* because "at most one is true" is then true by construction instead of by
|
|
21
|
+
* everyone remembering to close the other one.
|
|
22
|
+
*/
|
|
23
|
+
export interface PanelOverlayState {
|
|
24
|
+
readonly historyOpen: boolean;
|
|
25
|
+
readonly previewOpen: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** Nothing showing — the state the panel opens in. */
|
|
28
|
+
export declare const NO_PANEL_OVERLAY: PanelOverlayState;
|
|
29
|
+
/**
|
|
30
|
+
* The state after the user presses one of the two toggles.
|
|
31
|
+
*
|
|
32
|
+
* Pressing the toggle of the overlay already showing closes it; pressing the
|
|
33
|
+
* other one swaps to it. There is deliberately no way to express "both".
|
|
34
|
+
*/
|
|
35
|
+
export declare function nextPanelOverlays(current: PanelOverlayState, toggled: "history" | "preview"): PanelOverlayState;
|
|
36
|
+
/**
|
|
37
|
+
* What Escape should dismiss.
|
|
38
|
+
*
|
|
39
|
+
* ★★ THE TOPMOST LAYER, NOT THE WHOLE ASSISTANT. `useAssistantKeyboardShortcuts`
|
|
40
|
+
* calls `onClose()` on Escape (`:39-43`), and both host apps mount the panel as
|
|
41
|
+
* `{isOpen && <AIAssistantPanel/>}` — so with an overlay open, Escape did not
|
|
42
|
+
* close the overlay, it UNMOUNTED the assistant and took the in-flight turn,
|
|
43
|
+
* the composer draft and the attachments with it. The user's mental model of
|
|
44
|
+
* Escape is "back out of the thing I just opened"; here it destroyed a
|
|
45
|
+
* conversation instead.
|
|
46
|
+
*/
|
|
47
|
+
export declare function escapeDismisses(current: PanelOverlayState): "overlay" | "panel";
|
|
48
|
+
//# sourceMappingURL=panelOverlays.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panelOverlays.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/panelOverlays.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B;AAED,sDAAsD;AACtD,eAAO,MAAM,gBAAgB,EAAE,iBAG9B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,SAAS,GAAG,SAAS,GAC7B,iBAAiB,CAOnB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,iBAAiB,GACzB,SAAS,GAAG,OAAO,CAErB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/shared/assistant/ui/panelOverlays.ts
|
|
2
|
+
var e = {
|
|
3
|
+
historyOpen: !1,
|
|
4
|
+
previewOpen: !1
|
|
5
|
+
};
|
|
6
|
+
function t(t, n) {
|
|
7
|
+
return (n === "history" ? t.historyOpen : t.previewOpen) ? e : {
|
|
8
|
+
historyOpen: n === "history",
|
|
9
|
+
previewOpen: n === "preview"
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function n(e) {
|
|
13
|
+
return e.historyOpen || e.previewOpen ? "overlay" : "panel";
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { e as NO_PANEL_OVERLAY, n as escapeDismisses, t as nextPanelOverlays };
|
package/dist/shared-assistant.js
CHANGED
|
@@ -59,38 +59,43 @@ import { AssistantConnectSourceProvider as ti, useAssistantConnectSource as ni }
|
|
|
59
59
|
import { AssistantConnectSourceItem as ri } from "./shared/assistant/ui/composer/AssistantConnectSourceItem.js";
|
|
60
60
|
import { AssistantAttachmentButton as ii } from "./shared/assistant/ui/composer/AssistantAttachmentButton.js";
|
|
61
61
|
import { AssistantAttachmentChips as ai } from "./shared/assistant/ui/composer/AssistantAttachmentChips.js";
|
|
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
|
-
import {
|
|
94
|
-
import {
|
|
95
|
-
import {
|
|
96
|
-
|
|
62
|
+
import { AssistantPreviewProvider as oi, useAssistantPreview as si } from "./shared/assistant/preview/context.js";
|
|
63
|
+
import { IDLE_PREVIEW_STATE as ci, nextPreviewEvents as li } from "./shared/assistant/preview/previewTransitions.js";
|
|
64
|
+
import { NO_PANEL_OVERLAY as ui, escapeDismisses as di, nextPanelOverlays as fi } from "./shared/assistant/ui/panelOverlays.js";
|
|
65
|
+
import { useAssistantPreviewBridge as pi } from "./shared/assistant/preview/useAssistantPreviewBridge.js";
|
|
66
|
+
import { AssistantPreviewOverlay as mi } from "./shared/assistant/preview/AssistantPreviewOverlay.js";
|
|
67
|
+
import { AssistantLanguageSelector as hi, FOLLOW_APP_LOCALE as gi } from "./shared/assistant/ui/composer/AssistantLanguageSelector.js";
|
|
68
|
+
import { ASSISTANT_MODE_META as _i, AssistantModeSelector as vi, nextModeIndex as yi } from "./shared/assistant/ui/composer/AssistantModeSelector.js";
|
|
69
|
+
import { AssistantVoiceButton as bi } from "./shared/assistant/ui/composer/AssistantVoiceButton.js";
|
|
70
|
+
import { AUTO_VOICE as xi, AssistantVoiceSelector as Si } from "./shared/assistant/ui/composer/AssistantVoiceSelector.js";
|
|
71
|
+
import { AssistantVoiceOrb as Ci } from "./shared/assistant/ui/voice/AssistantVoiceOrb.js";
|
|
72
|
+
import { AssistantVoiceSessionButton as wi } from "./shared/assistant/ui/voice/AssistantVoiceSessionButton.js";
|
|
73
|
+
import { CAPTION_SCROLL_ATTR as Ti, VoiceCaption as Ei } from "./shared/assistant/ui/voice/VoiceCaption.js";
|
|
74
|
+
import { VoiceConversationView as Di } from "./shared/assistant/ui/voice/VoiceConversationView.js";
|
|
75
|
+
import { VoiceWaveform as Oi } from "./shared/assistant/ui/voice/VoiceWaveform.js";
|
|
76
|
+
import { VoiceMiniController as ki } from "./shared/assistant/ui/voice/VoiceMiniController.js";
|
|
77
|
+
import { VoiceStage as Ai } from "./shared/assistant/ui/voice/VoiceStage.js";
|
|
78
|
+
import { VoiceTranscriptDrawer as ji } from "./shared/assistant/ui/voice/VoiceTranscriptDrawer.js";
|
|
79
|
+
import { downloadFile as Mi, exportConversation as Ni } from "./shared/assistant/exportConversation.js";
|
|
80
|
+
import { AssistantMoreMenu as Pi } from "./shared/assistant/ui/AssistantMoreMenu.js";
|
|
81
|
+
import { AssistantHeader as Fi } from "./shared/assistant/ui/AssistantHeader.js";
|
|
82
|
+
import { AssistantConversationList as Ii } from "./shared/assistant/ui/AssistantConversationList.js";
|
|
83
|
+
import { AssistantEmptyState as Li } from "./shared/assistant/ui/AssistantEmptyState.js";
|
|
84
|
+
import { AssistantMessageItem as Ri } from "./shared/assistant/ui/AssistantMessageItem.js";
|
|
85
|
+
import { AssistantMessageList as zi } from "./shared/assistant/ui/AssistantMessageList.js";
|
|
86
|
+
import { AssistantVoiceSession as Bi } from "./shared/assistant/ui/voice/AssistantVoiceSession.js";
|
|
87
|
+
import { useAssistantApiAccess as Vi } from "./shared/assistant/useAssistantApiAccess.js";
|
|
88
|
+
import { useConversationTurns as Hi } from "./shared/assistant/useConversationTurns.js";
|
|
89
|
+
import { isMultimodalBodyRejection as Ui, isRecoverableAssistantError as Wi } from "./shared/assistant/transportErrors.js";
|
|
90
|
+
import { aiCreditsUpdatedEventName as Gi, dispatchAssistantQuotaExhausted as Ki, notifyAiCreditsUpdated as qi } from "./shared/assistant/aiCredits.js";
|
|
91
|
+
import { useWorkspaceWriteAccess as Ji } from "./shared/assistant/useWorkspaceWriteAccess.js";
|
|
92
|
+
import { extractDocumentText as Yi } from "./shared/assistant/documentExtract.js";
|
|
93
|
+
import { useAssistantAttachments as Xi } from "./shared/assistant/useAssistantAttachments.js";
|
|
94
|
+
import { AssistantComposer as Zi } from "./shared/assistant/ui/composer/AssistantComposer.js";
|
|
95
|
+
import { isProdRuntime as Qi } from "./shared/assistant/env.js";
|
|
96
|
+
import { useAssistantHeartbeat as $i } from "./shared/assistant/useAssistantHeartbeat.js";
|
|
97
|
+
import { useAssistantKeyboardShortcuts as ea } from "./shared/assistant/useAssistantKeyboardShortcuts.js";
|
|
98
|
+
import { AssistantApiCallsConsentDialog as ta } from "./shared/assistant/ui/AssistantApiCallsConsentDialog.js";
|
|
99
|
+
import { AssistantChatArea as na } from "./shared/assistant/ui/AssistantChatArea.js";
|
|
100
|
+
import { AIAssistantPanel as ra } from "./shared/assistant/ui/AIAssistantPanel.js";
|
|
101
|
+
export { ra as AIAssistantPanel, L as ASSISTANT_API_AUTH_STRATEGY, sn as ASSISTANT_LANGUAGES, _i as ASSISTANT_MODE_META, Kn as ATTACHMENT_ACCEPT, Hr as ATTACHMENT_SOURCES, xi as AUTO_VOICE, ta as AssistantApiCallsConsentDialog, ii as AssistantAttachmentButton, ai as AssistantAttachmentChips, Jr as AssistantAutoSpeakToggle, na as AssistantChatArea, Zi as AssistantComposer, ri as AssistantConnectSourceItem, ti as AssistantConnectSourceProvider, Ii as AssistantConversationList, Li as AssistantEmptyState, Fi as AssistantHeader, s as AssistantI18nProvider, Zr as AssistantLanguageMenu, hi as AssistantLanguageSelector, f as AssistantMarkdownImage, h as AssistantMarkdownRenderer, Yr as AssistantMessageAttachments, Ri as AssistantMessageItem, zi as AssistantMessageList, vi as AssistantModeSelector, Pi as AssistantMoreMenu, g as AssistantNavigateProvider, Xr as AssistantPendingWriteCard, mi as AssistantPreviewOverlay, oi as AssistantPreviewProvider, t as AssistantProductProvider, Qr as AssistantReplyLanguageSelector, _e as AssistantRuntimeManager, $r as AssistantSpeakButton, Ir as AssistantSpeechProvider, ei as AssistantSpokenTurnsNotice, Pr as AssistantToolActivity, bi as AssistantVoiceButton, Ci as AssistantVoiceOrb, Si as AssistantVoiceSelector, Bi as AssistantVoiceSession, wi as AssistantVoiceSessionButton, qn as AttachmentRejectedError, En as BOILERPLATE_PAGE_SHARE, Ti as CAPTION_SCROLL_ATTR, O as CHECK_AI_CREDITS, k as CREATE_SANDBOX, zt as DEFAULT_SPEAKABLE_LABELS, cn as DEFAULT_SPEECH_RATE, ft as ENDPOINT_GRACE_MS, A as EXTEND_SANDBOX_TTL, gi as FOLLOW_APP_LOCALE, j as GET_ACTIVE_SANDBOXES, M as GET_SANDBOX, He as HOSTED_TTS_MAX_CHARS, Re as HOSTED_TTS_TIER, ze as HOSTED_VOICES, yn as IDLE_PLAYBACK, ci as IDLE_PREVIEW_STATE, pt as INITIAL_SESSION, Jn as INLINE_IMAGE_MAX_DIM, Yn as INLINE_IMAGE_QUALITY, mt as INTERRUPT_MAX_MS, ht as INTERRUPT_MIN_MS, Xn as MAX_ATTACHMENTS, Dn as MAX_BOILERPLATE_LINE_CHARS, On as MAX_EXTRACTED_CHARS, Zn as MAX_FILE_BYTES, Qn as MAX_INLINE_CHARS_PER_FILE, $n as MAX_INLINE_CHARS_TOTAL, wn as MAX_INLINE_IMAGE_BASE64_BYTES, er as MAX_INLINE_IMAGE_BASE64_CHARS, tr as MAX_INLINE_IMAGE_PARTS, nr as MAX_INLINE_TURN_BODY_BYTES, kn as MAX_PDF_PAGES_SCANNED, Tn as MAX_REQUEST_BODY_BYTES, Bt as MAX_SPEAKABLE_CHARS, Vt as MAX_SPOKEN_TABLE_ROWS, rr as MAX_TURN_BODY_BYTES, Zt as MINI_CAPTION_BUDGET, An as MIN_PAGE_TEXT_CHARS, jn as MIN_TEXT_PAGE_SHARE, ui as NO_PANEL_OVERLAY, Dr as PHRASE_ROTATE_MS, $t as POLL_FAST_MS, en as POLL_FAST_UNTIL_MS, tn as POLL_SLOW_MS, nn as POLL_STEADY_MS, rn as POLL_STEADY_UNTIL_MS, Yt as PREVIEW_LANGUAGES, ir as PROMPT_ENVELOPE_RESERVE_BYTES, N as PROXY_SANDBOX_REQUEST, P as REPORT_AI_TOKEN_USAGE, Gr as SANDBOX_READY_TTL_MS, gt as SILENCE_SUBMIT_MS, Ue as SPEAKING_RATE_MAX, We as SPEAKING_RATE_MAX_STREAMING, Ge as SPEAKING_RATE_MAX_SYNC, Ke as SPEAKING_RATE_MIN, Ht as SPEECH_CHUNK_CHARS, Ut as SPEECH_CHUNK_CJK_CHARS, wt as SPEECH_LANG, hn as SPOKEN_LABEL_LANGUAGES, Or as STAGE_COPY, F as STOP_ASSISTANT_SANDBOX, kr as THINKING_PHRASES, ar as TURN_BODY_HEADROOM_BYTES, Tt as VOICE_LIST_TIMEOUT_MS, Ei as VoiceCaption, Di as VoiceConversationView, ki as VoiceMiniController, Ai as VoiceStage, ji as VoiceTranscriptDrawer, Oi as VoiceWaveform, I as WAIT_FOR_SANDBOX_RUNNING, q as abortAssistantTurn, Gi as aiCreditsUpdatedEventName, J as approvePendingWrite, _ as assistantRoutePath, c as assistantTranslationKey, v as assistantUrlTransform, Ur as availableAttachmentSources, qe as base64ToBytes, y as browserShouldHandle, Le as browserSpeechEngine, Y as buildAssistantSandboxEnv, or as buildAttachmentPromptBlock, It as buildContinuedFromVoiceNote, ve as buildProgress, sr as buildPromptParts, X as buildPromptRequestBody, cr as buildPromptWithAttachments, Je as buildRequest, E as buildSandboxContextInput, Lt as buildVoiceTranscriptMarkdown, Ae as chatTurns, Z as checkAssistantAiCredits, Wt as chunkForSpeech, b as classifyAssistantHref, lr as classifyAttachment, Ye as classifyHttpFailure, S as classifyQuotaError, Mn as columnLetterToIndex, tt as configureSpeechEngine, Gt as containsCjk, d as copyToClipboard, ur as countInlineImageCandidates, dr as countInlinedImageParts, Q as createAssistantSandbox, $ as createAssistantSession, $e as createHostedTtsEngine, Kr as createReadinessTracker, et as createRoutingSpeechEngine, Oe as createSandboxAssistantTransport, nt as createSpeechEngines, Xe as decodeAudioResponse, Nn as decodeXmlEntities, C as describeQuotaError, fr as detectDocumentFormat, _n as detectScriptLocale, Wr as deviceHasCamera, Ki as dispatchAssistantQuotaExhausted, Pn as docxXmlToText, ee as downloadAssistantArtifact, Mi as downloadFile, di as escapeDismisses, pr as estimateTurnBodyBytes, D as executeSandboxGraphQL, Ni as exportConversation, te as extendAssistantSandboxTTL, Yi as extractDocumentText, ln as findAssistantLanguage, ne as findExistingSandbox, pn as findPendingWrite, Fn as fitPdfPages, mr as formatBytes, In as formatPageRanges, zr as getActorId, re as getAssistantArtifacts, ye as getAssistantMedia, ie as getAssistantMessages, ae as getAssistantSession, oe as getAssistantStreamAccess, be as getAssistantText, hr as getAttachmentSendBlocker, U as getCapability, gr as getExtension, R as getImageForMode, z as getImageTagForMode, Br as getOrganizationId, xe as getRawMessageCreatedAt, B as getResourcesForMode, V as getSandboxImageRegistry, _r as getSendableAttachments, rt as getSpeechEngine, Se as getToolProgress, Vr as getWorkspaceId, je as groupBySession, Me as groupConsecutiveBySession, vr as hasAttachmentWorkInFlight, Be as hostedLocaleFor, Ve as hostedSupportsLanguage, p as imageHostLabel, _t as isCapturing, vt as isEcho, Ln as isMostlyImagePages, Ui as isMultimodalBodyRejection, Qi as isProdRuntime, w as isQuotaExhaustedError, Ce as isReapedSandboxConnectionError, qr as isRecentlyVerified, we as isRecoverable, Wi as isRecoverableAssistantError, m as isRemoteImageSrc, bn as isSpeakingMessage, Et as isSpeechBlocked, Ar as isStageCopy, yt as isSubmittable, wr as isTurnInFlight, W as isUnknownFieldError, Ne as isVoiceTurn, Rn as joinSheets, Dt as languageDisplayName, Te as mapSessionToHistory, G as markSupported, K as markUnsupported, Ee as mergeMessagesById, ot as micIsInterrupt, se as modeRequiresConfirmWrites, yi as nextModeIndex, fi as nextPanelOverlays, li as nextPreviewEvents, Ot as normalizeLangTag, qi as notifyAiCreditsUpdated, bt as orbMode, zn as pageMarker, mn as parseConfirmationRefusal, yr as parseDataUrl, Bn as parseSharedStrings, Fr as parseToolActivity, Vn as parseWorkbookSheets, Hn as pdfTextItemsToPage, Tr as planAbandonedTurn, xt as planReplyConsumption, Er as planTurnAbort, an as pollDelayMs, kt as primaryLanguageSubtag, xn as publishedChunks, T as quotaExhaustedEventName, it as readSpeechEngineConfig, ce as releaseSupersededAssistantSandboxes, dn as replyFollowsInput, le as reportAssistantAiTokenUsage, Sn as requiresCancel, at as resetSpeechEngine, un as resolveAssistantLanguage, fn as resolveLanguagePair, n as resolveModeConfig, H as resolveSandboxAssistantMode, vn as resolveSpeechLocale, De as sanitize, ue as selectExistingAssistantSandbox, de as selectSupersededAssistantSandboxes, At as selectVoiceForLocale, fe as sendAssistantPromptAsync, pe as sendHeartbeat, Un as sheetXmlToRows, Ze as shouldDisableEngine, Qt as showPreviousChunk, st as showsAssistantCaption, ct as showsUserCaption, Kt as speakableEmail, jt as speechGate, gn as speechLabelsFor, Mt as speechLangForLocale, Cn as speechPlaybackReducer, Qe as splitForVendor, qt as splitTableRow, St as spokenSoFar, jr as stageText, Mr as statusStageCopy, me as stopReapedAssistantSandbox, Wn as summarisePageText, Nr as thinkingPhrase, on as toCaptionText, br as toMessageAttachment, Jt as toSpeakableText, xr as truncateForInline, Gn as truncatePagesForInline, Vi as useAssistantApiAccess, Xi as useAssistantAttachments, ni as useAssistantConnectSource, $i as useAssistantHeartbeat, l as useAssistantI18nNamespace, ea as useAssistantKeyboardShortcuts, x as useAssistantNavigate, r as useAssistantPageLabel, si as useAssistantPreview, pi as useAssistantPreviewBridge, i as useAssistantProduct, a as useAssistantProductOrNull, Lr as useAssistantSpeech, o as useAssistantStorageFolders, Cr as useAssistantStore, u as useAssistantTr, Hi as useConversationTurns, ke as useSandboxAssistantTransport, e as useVoiceInput, Rr as useVoiceSession, Ji as useWorkspaceWriteAccess, Sr as validateFile, Nt as voiceAvailability, Pe as voiceMarker, Xt as voicePreviewText, Pt as voiceQualityRank, Fe as voiceSessionIdOf, Ct as voiceSessionReducer, lt as voiceStageState, Rt as voiceTranscriptFilename, Ie as voiceTurnsOnly, Ft as voicesForLocale, he as waitForAssistantServiceReady, ge as waitForSandboxRunning, ut as waveformIsActive, dt as waveformIsSettled };
|