@opengeni/react 6.1.0 → 7.0.0-canary.35585322809001
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/README.md +83 -2
- package/dist/artifacts-document.js +1 -1
- package/dist/artifacts-presentation.js +1 -1
- package/dist/artifacts-spreadsheet.js +1 -1
- package/dist/artifacts.js +3 -3
- package/dist/{browser-viewer-NTD6UIPR.js → browser-viewer-LGH4IP47.js} +3 -3
- package/dist/capability-catalog-row.d.ts +20 -0
- package/dist/capability-logo-fallback.d.ts +3 -0
- package/dist/{chunk-NOSYBS2D.js → chunk-2VHARTBL.js} +2 -1
- package/dist/{chunk-VRBL3F5E.js → chunk-5GAL23FF.js} +10 -2
- package/dist/{chunk-VRBL3F5E.js.map → chunk-5GAL23FF.js.map} +1 -1
- package/dist/chunk-5UONOQ3Y.js +635 -0
- package/dist/chunk-5UONOQ3Y.js.map +1 -0
- package/dist/{chunk-NYESIADM.js → chunk-AKOMC3VO.js} +3 -3
- package/dist/chunk-AKOMC3VO.js.map +1 -0
- package/dist/chunk-BRM6FVZA.js +302 -0
- package/dist/chunk-BRM6FVZA.js.map +1 -0
- package/dist/{chunk-TDSEILUH.js → chunk-D5NOQPLR.js} +1289 -1530
- package/dist/chunk-D5NOQPLR.js.map +1 -0
- package/dist/chunk-D7GAPJ3V.js +1558 -0
- package/dist/chunk-D7GAPJ3V.js.map +1 -0
- package/dist/{chunk-5M6VTFJ5.js → chunk-GBPCZH3Y.js} +2 -2
- package/dist/{chunk-YBM6CQRU.js → chunk-GEN54DU5.js} +4 -4
- package/dist/{chunk-UMECRJRV.js → chunk-HJ5VJ4JB.js} +21 -12
- package/dist/chunk-HJ5VJ4JB.js.map +1 -0
- package/dist/{chunk-R4KRSFGA.js → chunk-IP4BUBKH.js} +3 -3
- package/dist/{chunk-KANFU34B.js → chunk-IYUPN32E.js} +6 -2
- package/dist/chunk-IYUPN32E.js.map +1 -0
- package/dist/{chunk-L2NBTKRX.js → chunk-JKLGJQO5.js} +193 -12
- package/dist/chunk-JKLGJQO5.js.map +1 -0
- package/dist/{chunk-NLTS7JHI.js → chunk-JPHDWKZE.js} +5 -5
- package/dist/{chunk-ICA6R6TW.js → chunk-OWHPKAOV.js} +28 -20
- package/dist/chunk-OWHPKAOV.js.map +1 -0
- package/dist/{chunk-24M4YBCL.js → chunk-PNAVEK2U.js} +4 -4
- package/dist/{chunk-45XEUVTK.js → chunk-UXE5SSNN.js} +293 -463
- package/dist/chunk-UXE5SSNN.js.map +1 -0
- package/dist/{chunk-PEI6RANI.js → chunk-VR4Z73EU.js} +203 -9
- package/dist/chunk-VR4Z73EU.js.map +1 -0
- package/dist/{chunk-HUIKIDM5.js → chunk-XMXRI5JK.js} +65 -18
- package/dist/chunk-XMXRI5JK.js.map +1 -0
- package/dist/client.d.ts +1 -1
- package/dist/components/artifacts/spreadsheet-general-display.d.ts +24 -0
- package/dist/components/chat-composer.d.ts +13 -3
- package/dist/components/markdown.d.ts +4 -3
- package/dist/components/message-timeline.d.ts +7 -2
- package/dist/components/preview-loading.d.ts +2 -0
- package/dist/components/session-capability-frame.d.ts +24 -0
- package/dist/components/session-chrome.d.ts +1 -2
- package/dist/components/session-commands.d.ts +6 -0
- package/dist/components/session-connection-request.d.ts +8 -0
- package/dist/components/session-mcp-capability-card.d.ts +22 -0
- package/dist/components/timeline-search.d.ts +34 -0
- package/dist/composer.js +7 -7
- package/dist/connect-account-identity.d.ts +8 -0
- package/dist/connect-accounts.d.ts +5 -0
- package/dist/connect-chooser.d.ts +6 -0
- package/dist/connect-panel.d.ts +9 -2
- package/dist/connect-setup.d.ts +5 -1
- package/dist/connect.d.ts +5 -21
- package/dist/connect.js +1268 -584
- package/dist/connect.js.map +1 -1
- package/dist/connection-catalog.d.ts +6 -1
- package/dist/connection-discovery.d.ts +12 -0
- package/dist/connection-installed.d.ts +1 -0
- package/dist/connection-logo.d.ts +5 -2
- package/dist/connection-service-logo.d.ts +8 -0
- package/dist/connection-service-presentation.d.ts +13 -0
- package/dist/connection-skeleton.d.ts +5 -0
- package/dist/discovery-cache.d.ts +5 -0
- package/dist/hooks/use-codex-accounts.d.ts +11 -5
- package/dist/hooks/use-connect.d.ts +22 -0
- package/dist/hooks/use-session-events.d.ts +5 -0
- package/dist/hooks/use-session-mcp-approval-policy.d.ts +2 -2
- package/dist/hooks/use-workspace-sessions.d.ts +2 -0
- package/dist/index.d.ts +8 -2
- package/dist/index.js +771 -793
- package/dist/index.js.map +1 -1
- package/dist/interaction.js +2 -2
- package/dist/machines.js +2 -2
- package/dist/mcp-connection-status.d.ts +14 -0
- package/dist/{model-policy-picker-menu-3R336DP2.js → model-policy-picker-menu-RVOQ4ZZG.js} +4 -4
- package/dist/model-policy.d.ts +6 -2
- package/dist/model-policy.js +1 -1
- package/dist/{platform-activity-row-DUE2W74J.js → platform-activity-row-HLOH7FW4.js} +9 -4
- package/dist/platform-activity-row-HLOH7FW4.js.map +1 -0
- package/dist/plugin-discovery.d.ts +6 -0
- package/dist/{queue-surface-implementation-LK3S4BIW.js → queue-surface-implementation-3RIFK2BS.js} +4 -4
- package/dist/realtime.js +22 -22
- package/dist/realtime.js.map +1 -1
- package/dist/session-auth-recommendation.d.ts +5 -0
- package/dist/session-capability-policy.d.ts +12 -0
- package/dist/session-ui.d.ts +2 -0
- package/dist/session-ui.js +14 -12
- package/dist/session.d.ts +1 -0
- package/dist/session.js +6 -4
- package/dist/skill-discovery.d.ts +11 -0
- package/dist/timeline/compaction-copy.d.ts +10 -0
- package/dist/timeline/projection.d.ts +3 -1
- package/dist/timeline/turn-summary.d.ts +2 -2
- package/dist/timeline/types.d.ts +22 -1
- package/dist/{timeline-annotation-markers-DRSTLEM6.js → timeline-annotation-markers-OY6OWR3V.js} +2 -2
- package/dist/{timeline-annotation-selection-IHLUGVND.js → timeline-annotation-selection-BOXA2TIN.js} +2 -2
- package/dist/{timeline-annotations-dialog-6Q53N5FG.js → timeline-annotations-dialog-RGY3MHL3.js} +3 -3
- package/package.json +3 -3
- package/src/assets/README.md +8 -0
- package/src/assets/gmail.ico +0 -0
- package/src/assets/outlook.ico +0 -0
- package/src/capability-catalog-row.tsx +94 -0
- package/src/capability-logo-fallback.ts +22 -0
- package/src/client.ts +0 -9
- package/src/components/artifacts/document-editor.tsx +63 -6
- package/src/components/artifacts/presentation-editor.tsx +214 -9
- package/src/components/artifacts/spreadsheet-canvas.ts +3 -8
- package/src/components/artifacts/spreadsheet-general-display.ts +43 -0
- package/src/components/artifacts/spreadsheet-grid.tsx +10 -11
- package/src/components/chat-composer.tsx +26 -3
- package/src/components/composer.tsx +10 -4
- package/src/components/human-input-form.tsx +12 -2
- package/src/components/markdown.tsx +86 -4
- package/src/components/message-timeline.tsx +104 -36
- package/src/components/model-picker.tsx +11 -3
- package/src/components/model-policy-picker-menu.tsx +10 -3
- package/src/components/preview-loading.tsx +154 -0
- package/src/components/sandbox-workspace.tsx +20 -36
- package/src/components/session-capability-frame.tsx +163 -0
- package/src/components/session-chrome.tsx +46 -77
- package/src/components/session-commands.tsx +18 -0
- package/src/components/session-connection-request.tsx +97 -0
- package/src/components/session-conversation.tsx +5 -4
- package/src/components/session-mcp-capability-card.tsx +532 -0
- package/src/components/session-status.tsx +2 -2
- package/src/components/timeline-anchor.tsx +9 -8
- package/src/components/timeline-search.tsx +168 -0
- package/src/components/user-message-body.tsx +7 -0
- package/src/connect-account-identity.tsx +34 -0
- package/src/connect-accounts.tsx +114 -52
- package/src/connect-chooser.tsx +171 -39
- package/src/connect-panel.tsx +73 -9
- package/src/connect-setup.tsx +72 -25
- package/src/connect.ts +13 -22
- package/src/connection-assets.d.ts +4 -0
- package/src/connection-catalog.tsx +61 -39
- package/src/connection-discovery.tsx +235 -0
- package/src/connection-installed.tsx +2 -0
- package/src/connection-logo.tsx +18 -10
- package/src/connection-service-logo.tsx +55 -0
- package/src/connection-service-presentation.ts +46 -0
- package/src/connection-skeleton.tsx +16 -0
- package/src/conversation-timeline.ts +1 -0
- package/src/discovery-cache.ts +42 -0
- package/src/hooks/use-codex-accounts.ts +33 -14
- package/src/hooks/use-composer.ts +4 -5
- package/src/hooks/use-connect.ts +23 -0
- package/src/hooks/use-session-events.ts +114 -1
- package/src/hooks/use-session-mcp-approval-policy.ts +13 -5
- package/src/hooks/use-workspace-sessions.ts +10 -0
- package/src/index.ts +22 -2
- package/src/mcp-connection-status.ts +35 -0
- package/src/model-policy.ts +21 -0
- package/src/plugin-details.tsx +8 -5
- package/src/plugin-discovery.tsx +92 -72
- package/src/realtime/realtime-control.tsx +6 -8
- package/src/session-auth-recommendation.ts +48 -0
- package/src/session-capability-policy.ts +83 -0
- package/src/session-ui.ts +2 -0
- package/src/session.ts +1 -0
- package/src/skill-discovery.tsx +101 -56
- package/src/timeline/compaction-copy.ts +40 -0
- package/src/timeline/platform-activity-row.tsx +8 -3
- package/src/timeline/projection.ts +74 -2
- package/src/timeline/shared.tsx +6 -1
- package/src/timeline/startup-timings.tsx +1 -1
- package/src/timeline/turn-summary.tsx +17 -3
- package/src/timeline/types.ts +22 -2
- package/styles/compiled.css +325 -27
- package/styles/connect.css +90 -15
- package/styles/index.css +46 -0
- package/styles/session-capability.css +42 -0
- package/dist/chunk-45XEUVTK.js.map +0 -1
- package/dist/chunk-HQV2I5HV.js +0 -124
- package/dist/chunk-HQV2I5HV.js.map +0 -1
- package/dist/chunk-HUIKIDM5.js.map +0 -1
- package/dist/chunk-ICA6R6TW.js.map +0 -1
- package/dist/chunk-IHQII5WO.js +0 -886
- package/dist/chunk-IHQII5WO.js.map +0 -1
- package/dist/chunk-KANFU34B.js.map +0 -1
- package/dist/chunk-L2NBTKRX.js.map +0 -1
- package/dist/chunk-NYESIADM.js.map +0 -1
- package/dist/chunk-PEI6RANI.js.map +0 -1
- package/dist/chunk-TDSEILUH.js.map +0 -1
- package/dist/chunk-UMECRJRV.js.map +0 -1
- package/dist/hooks/use-packs.d.ts +0 -32
- package/dist/platform-activity-row-DUE2W74J.js.map +0 -1
- package/src/hooks/use-packs.ts +0 -157
- /package/dist/{browser-viewer-NTD6UIPR.js.map → browser-viewer-LGH4IP47.js.map} +0 -0
- /package/dist/{chunk-NOSYBS2D.js.map → chunk-2VHARTBL.js.map} +0 -0
- /package/dist/{chunk-5M6VTFJ5.js.map → chunk-GBPCZH3Y.js.map} +0 -0
- /package/dist/{chunk-YBM6CQRU.js.map → chunk-GEN54DU5.js.map} +0 -0
- /package/dist/{chunk-R4KRSFGA.js.map → chunk-IP4BUBKH.js.map} +0 -0
- /package/dist/{chunk-NLTS7JHI.js.map → chunk-JPHDWKZE.js.map} +0 -0
- /package/dist/{chunk-24M4YBCL.js.map → chunk-PNAVEK2U.js.map} +0 -0
- /package/dist/{model-policy-picker-menu-3R336DP2.js.map → model-policy-picker-menu-RVOQ4ZZG.js.map} +0 -0
- /package/dist/{queue-surface-implementation-LK3S4BIW.js.map → queue-surface-implementation-3RIFK2BS.js.map} +0 -0
- /package/dist/{timeline-annotation-markers-DRSTLEM6.js.map → timeline-annotation-markers-OY6OWR3V.js.map} +0 -0
- /package/dist/{timeline-annotation-selection-IHLUGVND.js.map → timeline-annotation-selection-BOXA2TIN.js.map} +0 -0
- /package/dist/{timeline-annotations-dialog-6Q53N5FG.js.map → timeline-annotations-dialog-RGY3MHL3.js.map} +0 -0
|
@@ -2,16 +2,16 @@ import {
|
|
|
2
2
|
Tooltip,
|
|
3
3
|
TooltipContent,
|
|
4
4
|
TooltipProvider,
|
|
5
|
-
TooltipTrigger
|
|
6
|
-
|
|
5
|
+
TooltipTrigger,
|
|
6
|
+
useLightboxOptional
|
|
7
|
+
} from "./chunk-BRM6FVZA.js";
|
|
7
8
|
import {
|
|
8
|
-
ComposerResponsiveContext
|
|
9
|
-
usePortalTokenStyle
|
|
9
|
+
ComposerResponsiveContext
|
|
10
10
|
} from "./chunk-VZTQ73XT.js";
|
|
11
11
|
import {
|
|
12
12
|
shouldSteerOnKey,
|
|
13
13
|
shouldSubmitOnKey
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-AKOMC3VO.js";
|
|
15
15
|
import {
|
|
16
16
|
composerSubmissionErrorMessage,
|
|
17
17
|
formatBytes,
|
|
@@ -19,186 +19,11 @@ import {
|
|
|
19
19
|
} from "./chunk-PLYRL5ER.js";
|
|
20
20
|
import {
|
|
21
21
|
groupPickerRowsByBillingClass
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-5GAL23FF.js";
|
|
23
23
|
import {
|
|
24
24
|
cn
|
|
25
25
|
} from "./chunk-22KP6LR5.js";
|
|
26
26
|
|
|
27
|
-
// src/timeline/screenshot-lightbox.tsx
|
|
28
|
-
import { DownloadIcon, XIcon } from "lucide-react";
|
|
29
|
-
import { AnimatePresence, motion } from "motion/react";
|
|
30
|
-
import {
|
|
31
|
-
createContext,
|
|
32
|
-
useCallback,
|
|
33
|
-
useContext,
|
|
34
|
-
useEffect,
|
|
35
|
-
useMemo,
|
|
36
|
-
useState
|
|
37
|
-
} from "react";
|
|
38
|
-
import { Dialog } from "radix-ui";
|
|
39
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
40
|
-
var LightboxContext = createContext(null);
|
|
41
|
-
function useLightbox() {
|
|
42
|
-
return useContext(LightboxContext) ?? NOOP;
|
|
43
|
-
}
|
|
44
|
-
function useLightboxOptional() {
|
|
45
|
-
return useContext(LightboxContext);
|
|
46
|
-
}
|
|
47
|
-
var NOOP = { open: () => {
|
|
48
|
-
} };
|
|
49
|
-
function createLightboxSourceOwner() {
|
|
50
|
-
let releaseCurrent = null;
|
|
51
|
-
return {
|
|
52
|
-
replace(release) {
|
|
53
|
-
const previous = releaseCurrent;
|
|
54
|
-
releaseCurrent = release ?? null;
|
|
55
|
-
previous?.();
|
|
56
|
-
},
|
|
57
|
-
release() {
|
|
58
|
-
const release = releaseCurrent;
|
|
59
|
-
releaseCurrent = null;
|
|
60
|
-
release?.();
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
function LightboxProvider({ children }) {
|
|
65
|
-
const ancestor = useContext(LightboxContext);
|
|
66
|
-
if (ancestor) {
|
|
67
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
68
|
-
}
|
|
69
|
-
return /* @__PURE__ */ jsx(LightboxRoot, { children });
|
|
70
|
-
}
|
|
71
|
-
function LightboxRoot({ children }) {
|
|
72
|
-
const [state, setState] = useState(null);
|
|
73
|
-
const [tokenSource, setTokenSource] = useState(null);
|
|
74
|
-
const sourceOwner = useMemo(() => createLightboxSourceOwner(), []);
|
|
75
|
-
const portalStyle = usePortalTokenStyle(tokenSource);
|
|
76
|
-
const releaseCurrentSource = useCallback(() => {
|
|
77
|
-
sourceOwner.release();
|
|
78
|
-
}, [sourceOwner]);
|
|
79
|
-
useEffect(() => releaseCurrentSource, [releaseCurrentSource]);
|
|
80
|
-
const open = useCallback(
|
|
81
|
-
(src, caption, source, label = "Screenshot", downloadFilename, controlLabels, releaseSource) => {
|
|
82
|
-
sourceOwner.replace(releaseSource);
|
|
83
|
-
setTokenSource(source ?? null);
|
|
84
|
-
setState({
|
|
85
|
-
src,
|
|
86
|
-
label,
|
|
87
|
-
...caption ? { caption } : {},
|
|
88
|
-
...downloadFilename ? { downloadFilename } : {},
|
|
89
|
-
...controlLabels ? { controlLabels } : {}
|
|
90
|
-
});
|
|
91
|
-
},
|
|
92
|
-
[sourceOwner]
|
|
93
|
-
);
|
|
94
|
-
const close = useCallback(() => {
|
|
95
|
-
releaseCurrentSource();
|
|
96
|
-
setState(null);
|
|
97
|
-
setTokenSource(null);
|
|
98
|
-
}, [releaseCurrentSource]);
|
|
99
|
-
const controller = useMemo(() => ({ open }), [open]);
|
|
100
|
-
return /* @__PURE__ */ jsxs(LightboxContext.Provider, { value: controller, children: [
|
|
101
|
-
children,
|
|
102
|
-
/* @__PURE__ */ jsx(Dialog.Root, { open: state !== null, onOpenChange: (next) => !next && close(), children: /* @__PURE__ */ jsx(AnimatePresence, { children: state !== null ? /* @__PURE__ */ jsxs(Dialog.Portal, { forceMount: true, children: [
|
|
103
|
-
/* @__PURE__ */ jsx(Dialog.Overlay, { asChild: true, forceMount: true, children: /* @__PURE__ */ jsx(
|
|
104
|
-
motion.div,
|
|
105
|
-
{
|
|
106
|
-
initial: { opacity: 0 },
|
|
107
|
-
animate: { opacity: 1 },
|
|
108
|
-
exit: { opacity: 0 },
|
|
109
|
-
transition: { duration: 0.15 },
|
|
110
|
-
className: "og-root fixed inset-0 z-50 bg-black/90 backdrop-blur-md",
|
|
111
|
-
style: portalStyle
|
|
112
|
-
}
|
|
113
|
-
) }),
|
|
114
|
-
/* @__PURE__ */ jsx(
|
|
115
|
-
Dialog.Content,
|
|
116
|
-
{
|
|
117
|
-
asChild: true,
|
|
118
|
-
forceMount: true,
|
|
119
|
-
"aria-label": state.label,
|
|
120
|
-
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
121
|
-
children: /* @__PURE__ */ jsxs(
|
|
122
|
-
motion.div,
|
|
123
|
-
{
|
|
124
|
-
initial: { opacity: 0, scale: 0.98 },
|
|
125
|
-
animate: { opacity: 1, scale: 1 },
|
|
126
|
-
exit: { opacity: 0, scale: 0.98 },
|
|
127
|
-
transition: { duration: 0.18, ease: [0.16, 1, 0.3, 1] },
|
|
128
|
-
onClick: (event) => {
|
|
129
|
-
if (event.target === event.currentTarget) {
|
|
130
|
-
close();
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
className: "og-root fixed inset-0 z-50 flex items-center justify-center p-6 sm:p-12",
|
|
134
|
-
style: portalStyle,
|
|
135
|
-
children: [
|
|
136
|
-
/* @__PURE__ */ jsx(Dialog.Title, { className: "sr-only", children: state.label }),
|
|
137
|
-
/* @__PURE__ */ jsx(Dialog.Description, { className: "sr-only", children: state.caption ?? `Expanded ${state.label.toLowerCase()}` }),
|
|
138
|
-
/* @__PURE__ */ jsxs("figure", { className: "m-0 flex max-h-full max-w-5xl flex-col items-center gap-3", children: [
|
|
139
|
-
/* @__PURE__ */ jsxs("div", { className: "relative flex min-h-0 w-fit max-w-full", children: [
|
|
140
|
-
/* @__PURE__ */ jsx(
|
|
141
|
-
"img",
|
|
142
|
-
{
|
|
143
|
-
src: state.src,
|
|
144
|
-
alt: state.caption ?? state.label,
|
|
145
|
-
className: "min-h-0 max-h-[82vh] w-auto max-w-full rounded-og-md border border-white/10 object-contain shadow-og-lg"
|
|
146
|
-
}
|
|
147
|
-
),
|
|
148
|
-
/* @__PURE__ */ jsx(
|
|
149
|
-
ScreenshotLightboxControls,
|
|
150
|
-
{
|
|
151
|
-
src: state.src,
|
|
152
|
-
downloadFilename: state.downloadFilename,
|
|
153
|
-
controlLabels: state.controlLabels
|
|
154
|
-
}
|
|
155
|
-
)
|
|
156
|
-
] }),
|
|
157
|
-
state.caption ? /* @__PURE__ */ jsx("figcaption", { className: "max-w-2xl text-center font-og-mono text-og-xs text-white/55", children: state.caption }) : /* @__PURE__ */ jsx("figcaption", { className: "font-og-mono text-og-xs uppercase tracking-[0.1em] text-white/35", children: "Esc or click outside to close" })
|
|
158
|
-
] })
|
|
159
|
-
]
|
|
160
|
-
}
|
|
161
|
-
)
|
|
162
|
-
}
|
|
163
|
-
)
|
|
164
|
-
] }) : null }) })
|
|
165
|
-
] });
|
|
166
|
-
}
|
|
167
|
-
function ScreenshotLightboxControls({
|
|
168
|
-
src,
|
|
169
|
-
downloadFilename,
|
|
170
|
-
controlLabels
|
|
171
|
-
}) {
|
|
172
|
-
return /* @__PURE__ */ jsxs("div", { className: "absolute -right-3 -top-3 flex items-center gap-2", children: [
|
|
173
|
-
downloadFilename ? /* @__PURE__ */ jsx(
|
|
174
|
-
"a",
|
|
175
|
-
{
|
|
176
|
-
href: src,
|
|
177
|
-
download: downloadFilename,
|
|
178
|
-
className: cn(
|
|
179
|
-
"inline-flex size-9 items-center justify-center rounded-full",
|
|
180
|
-
"border border-white/15 bg-black/60 text-white/70 backdrop-blur",
|
|
181
|
-
"transition-colors hover:border-white/30 hover:text-white"
|
|
182
|
-
),
|
|
183
|
-
"aria-label": controlLabels?.download ?? `Download ${downloadFilename}`,
|
|
184
|
-
children: /* @__PURE__ */ jsx(DownloadIcon, { className: "size-4" })
|
|
185
|
-
}
|
|
186
|
-
) : null,
|
|
187
|
-
/* @__PURE__ */ jsx(
|
|
188
|
-
Dialog.Close,
|
|
189
|
-
{
|
|
190
|
-
className: cn(
|
|
191
|
-
"inline-flex size-9 items-center justify-center rounded-full",
|
|
192
|
-
"border border-white/15 bg-black/60 text-white/70 backdrop-blur",
|
|
193
|
-
"transition-colors hover:border-white/30 hover:text-white"
|
|
194
|
-
),
|
|
195
|
-
"aria-label": controlLabels?.close ?? "Close",
|
|
196
|
-
children: /* @__PURE__ */ jsx(XIcon, { className: "size-4" })
|
|
197
|
-
}
|
|
198
|
-
)
|
|
199
|
-
] });
|
|
200
|
-
}
|
|
201
|
-
|
|
202
27
|
// src/workstream-control-event.ts
|
|
203
28
|
var OPEN_WORKSTREAM_CONTROL_EVENT = "opengeni:open-workstream-control";
|
|
204
29
|
|
|
@@ -391,11 +216,11 @@ function clearErrorMessage(cause) {
|
|
|
391
216
|
}
|
|
392
217
|
|
|
393
218
|
// src/hooks/use-slash-commands.ts
|
|
394
|
-
import { useCallback
|
|
219
|
+
import { useCallback, useMemo, useRef, useState } from "react";
|
|
395
220
|
function useSlashCommands(options) {
|
|
396
221
|
const { commands, context, handlers, value, setValue } = options;
|
|
397
|
-
const [highlight, setHighlight] =
|
|
398
|
-
const [dismissedValue, setDismissedValue] =
|
|
222
|
+
const [highlight, setHighlight] = useState(0);
|
|
223
|
+
const [dismissedValue, setDismissedValue] = useState(null);
|
|
399
224
|
const dismissed = dismissedValue !== null && dismissedValue === value;
|
|
400
225
|
const navigatedRef = useRef(false);
|
|
401
226
|
const navTokenRef = useRef(value);
|
|
@@ -403,8 +228,8 @@ function useSlashCommands(options) {
|
|
|
403
228
|
navTokenRef.current = value;
|
|
404
229
|
navigatedRef.current = false;
|
|
405
230
|
}
|
|
406
|
-
const parsed =
|
|
407
|
-
const filterCtx =
|
|
231
|
+
const parsed = useMemo(() => parseCommandLine(value), [value]);
|
|
232
|
+
const filterCtx = useMemo(
|
|
408
233
|
() => ({
|
|
409
234
|
sessionId: context?.sessionId ?? null,
|
|
410
235
|
status: context?.status ?? null,
|
|
@@ -412,13 +237,13 @@ function useSlashCommands(options) {
|
|
|
412
237
|
}),
|
|
413
238
|
[context?.sessionId, context?.status, context?.permissions]
|
|
414
239
|
);
|
|
415
|
-
const activeCommand =
|
|
240
|
+
const activeCommand = useMemo(() => {
|
|
416
241
|
if (!parsed || !parsed.hasTrailingSpace) {
|
|
417
242
|
return null;
|
|
418
243
|
}
|
|
419
244
|
return matchCommand(commands, value);
|
|
420
245
|
}, [commands, value, parsed]);
|
|
421
|
-
const items =
|
|
246
|
+
const items = useMemo(() => {
|
|
422
247
|
if (!parsed) {
|
|
423
248
|
return [];
|
|
424
249
|
}
|
|
@@ -431,7 +256,7 @@ function useSlashCommands(options) {
|
|
|
431
256
|
const isCommandDraft = parsed !== null && items.length > 0;
|
|
432
257
|
const clampedHighlight = items.length === 0 ? 0 : Math.min(highlight, items.length - 1);
|
|
433
258
|
const activeArgHint = activeCommand ? argHint(activeCommand.args) : "";
|
|
434
|
-
const buildContext =
|
|
259
|
+
const buildContext = useCallback(
|
|
435
260
|
(command) => {
|
|
436
261
|
if (!context) {
|
|
437
262
|
return null;
|
|
@@ -440,7 +265,7 @@ function useSlashCommands(options) {
|
|
|
440
265
|
},
|
|
441
266
|
[context, handlers]
|
|
442
267
|
);
|
|
443
|
-
const execute =
|
|
268
|
+
const execute = useCallback(
|
|
444
269
|
async (command, args) => {
|
|
445
270
|
const ctx = buildContext(command);
|
|
446
271
|
if (!ctx) {
|
|
@@ -460,21 +285,21 @@ function useSlashCommands(options) {
|
|
|
460
285
|
},
|
|
461
286
|
[buildContext, setValue]
|
|
462
287
|
);
|
|
463
|
-
const autocomplete =
|
|
288
|
+
const autocomplete = useCallback(
|
|
464
289
|
(command) => {
|
|
465
290
|
setValue(`/${command.name} `);
|
|
466
291
|
setHighlight(0);
|
|
467
292
|
},
|
|
468
293
|
[setValue]
|
|
469
294
|
);
|
|
470
|
-
const autocompleteHighlighted =
|
|
295
|
+
const autocompleteHighlighted = useCallback(() => {
|
|
471
296
|
const command = items[clampedHighlight];
|
|
472
297
|
if (command) {
|
|
473
298
|
autocomplete(command);
|
|
474
299
|
}
|
|
475
300
|
}, [items, clampedHighlight, autocomplete]);
|
|
476
301
|
const runningRef = useRef(false);
|
|
477
|
-
const runResolved =
|
|
302
|
+
const runResolved = useCallback(
|
|
478
303
|
async (command, executionOptions) => {
|
|
479
304
|
if (!parsed || runningRef.current) {
|
|
480
305
|
return;
|
|
@@ -502,7 +327,7 @@ function useSlashCommands(options) {
|
|
|
502
327
|
},
|
|
503
328
|
[parsed, activeCommand, autocomplete, execute]
|
|
504
329
|
);
|
|
505
|
-
const runHighlighted =
|
|
330
|
+
const runHighlighted = useCallback(async () => {
|
|
506
331
|
if (!parsed) {
|
|
507
332
|
return;
|
|
508
333
|
}
|
|
@@ -521,7 +346,7 @@ function useSlashCommands(options) {
|
|
|
521
346
|
}
|
|
522
347
|
await runResolved(command);
|
|
523
348
|
}, [parsed, activeCommand, items, clampedHighlight, runResolved]);
|
|
524
|
-
const runAt =
|
|
349
|
+
const runAt = useCallback(
|
|
525
350
|
async (index) => {
|
|
526
351
|
const command = items[index];
|
|
527
352
|
if (!command) {
|
|
@@ -531,7 +356,7 @@ function useSlashCommands(options) {
|
|
|
531
356
|
},
|
|
532
357
|
[items, runResolved]
|
|
533
358
|
);
|
|
534
|
-
const onKeyDown =
|
|
359
|
+
const onKeyDown = useCallback(
|
|
535
360
|
(event) => {
|
|
536
361
|
if (!open) {
|
|
537
362
|
return false;
|
|
@@ -600,8 +425,8 @@ function errorMessage2(cause) {
|
|
|
600
425
|
}
|
|
601
426
|
|
|
602
427
|
// src/components/command-palette.tsx
|
|
603
|
-
import { AnimatePresence
|
|
604
|
-
import { jsx
|
|
428
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
429
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
605
430
|
function CommandPalette({
|
|
606
431
|
open,
|
|
607
432
|
items,
|
|
@@ -613,8 +438,8 @@ function CommandPalette({
|
|
|
613
438
|
label = "Slash commands",
|
|
614
439
|
dangerLabel = "danger"
|
|
615
440
|
}) {
|
|
616
|
-
return /* @__PURE__ */
|
|
617
|
-
|
|
441
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { children: open ? /* @__PURE__ */ jsxs(
|
|
442
|
+
motion.div,
|
|
618
443
|
{
|
|
619
444
|
initial: { opacity: 0, y: 6, scale: 0.99 },
|
|
620
445
|
animate: { opacity: 1, y: 0, scale: 1 },
|
|
@@ -625,7 +450,7 @@ function CommandPalette({
|
|
|
625
450
|
"rounded-og-lg border border-og-border bg-og-surface-2 shadow-og-sm"
|
|
626
451
|
),
|
|
627
452
|
children: [
|
|
628
|
-
/* @__PURE__ */
|
|
453
|
+
/* @__PURE__ */ jsx(
|
|
629
454
|
"ul",
|
|
630
455
|
{
|
|
631
456
|
id: listboxId,
|
|
@@ -635,7 +460,7 @@ function CommandPalette({
|
|
|
635
460
|
children: items.map((command, index) => {
|
|
636
461
|
const selected = index === highlight;
|
|
637
462
|
const hint = argHint(command.args);
|
|
638
|
-
return /* @__PURE__ */
|
|
463
|
+
return /* @__PURE__ */ jsxs(
|
|
639
464
|
"li",
|
|
640
465
|
{
|
|
641
466
|
id: `${listboxId}-option-${index}`,
|
|
@@ -652,8 +477,8 @@ function CommandPalette({
|
|
|
652
477
|
selected ? "bg-og-accent/15 text-og-fg" : "text-og-fg-muted hover:bg-og-surface-3"
|
|
653
478
|
),
|
|
654
479
|
children: [
|
|
655
|
-
/* @__PURE__ */
|
|
656
|
-
/* @__PURE__ */
|
|
480
|
+
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-baseline gap-1.5", children: [
|
|
481
|
+
/* @__PURE__ */ jsxs(
|
|
657
482
|
"span",
|
|
658
483
|
{
|
|
659
484
|
className: cn(
|
|
@@ -666,11 +491,11 @@ function CommandPalette({
|
|
|
666
491
|
]
|
|
667
492
|
}
|
|
668
493
|
),
|
|
669
|
-
hint ? /* @__PURE__ */
|
|
494
|
+
hint ? /* @__PURE__ */ jsx("span", { className: "truncate font-mono text-[11px] text-og-fg-subtle", children: hint }) : null
|
|
670
495
|
] }),
|
|
671
|
-
/* @__PURE__ */
|
|
672
|
-
command.danger ? /* @__PURE__ */
|
|
673
|
-
/* @__PURE__ */
|
|
496
|
+
/* @__PURE__ */ jsxs("span", { className: "ml-auto flex items-center gap-1.5", children: [
|
|
497
|
+
command.danger ? /* @__PURE__ */ jsx("span", { className: "rounded-og-xs bg-og-status-failed/15 px-1 text-[10px] uppercase tracking-wide text-og-status-failed", children: dangerLabel }) : null,
|
|
498
|
+
/* @__PURE__ */ jsx("span", { className: "og-command-description truncate text-[12px] text-og-fg-subtle max-sm:hidden", children: command.description })
|
|
674
499
|
] })
|
|
675
500
|
]
|
|
676
501
|
},
|
|
@@ -679,7 +504,7 @@ function CommandPalette({
|
|
|
679
504
|
})
|
|
680
505
|
}
|
|
681
506
|
),
|
|
682
|
-
argHintText ? /* @__PURE__ */
|
|
507
|
+
argHintText ? /* @__PURE__ */ jsx("div", { className: "border-t border-og-border px-3 py-1.5 font-mono text-[11px] text-og-fg-subtle", children: argHintText }) : null
|
|
683
508
|
]
|
|
684
509
|
}
|
|
685
510
|
) : null });
|
|
@@ -687,8 +512,8 @@ function CommandPalette({
|
|
|
687
512
|
|
|
688
513
|
// src/components/model-picker.tsx
|
|
689
514
|
import { ChevronDownIcon } from "lucide-react";
|
|
690
|
-
import { useId, useMemo as
|
|
691
|
-
import { jsx as
|
|
515
|
+
import { useId, useMemo as useMemo2 } from "react";
|
|
516
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
692
517
|
var EMPTY_CLIENT_MODELS = [];
|
|
693
518
|
function isCodexClientModel(model) {
|
|
694
519
|
return model.id.startsWith("codex/") || model.source === "codex";
|
|
@@ -720,7 +545,14 @@ function providerGroups(models, codexOnly) {
|
|
|
720
545
|
optionDisabled: codexOnly && !isCodexClientModel(model)
|
|
721
546
|
});
|
|
722
547
|
}
|
|
723
|
-
|
|
548
|
+
const groups = [...byProvider.values()];
|
|
549
|
+
if (codexOnly) {
|
|
550
|
+
const codexIndex = groups.findIndex(
|
|
551
|
+
(group) => group.models.some((model) => !model.optionDisabled && isCodexClientModel(model))
|
|
552
|
+
);
|
|
553
|
+
if (codexIndex > 0) groups.unshift(...groups.splice(codexIndex, 1));
|
|
554
|
+
}
|
|
555
|
+
return groups;
|
|
724
556
|
}
|
|
725
557
|
function ModelPicker({
|
|
726
558
|
models = EMPTY_CLIENT_MODELS,
|
|
@@ -733,22 +565,22 @@ function ModelPicker({
|
|
|
733
565
|
codexOnly = false
|
|
734
566
|
}) {
|
|
735
567
|
const selectId = useId();
|
|
736
|
-
const effectiveRows =
|
|
568
|
+
const effectiveRows = useMemo2(
|
|
737
569
|
() => rows && rows.length > 0 ? applyCodexOnlyRows(rows, codexOnly) : [],
|
|
738
570
|
[rows, codexOnly]
|
|
739
571
|
);
|
|
740
|
-
const billingGroups =
|
|
741
|
-
() => effectiveRows.length > 0 ? groupPickerRowsByBillingClass(effectiveRows) : [],
|
|
742
|
-
[effectiveRows]
|
|
572
|
+
const billingGroups = useMemo2(
|
|
573
|
+
() => effectiveRows.length > 0 ? groupPickerRowsByBillingClass(effectiveRows, { codexOnly }) : [],
|
|
574
|
+
[effectiveRows, codexOnly]
|
|
743
575
|
);
|
|
744
|
-
const providerGroupList =
|
|
576
|
+
const providerGroupList = useMemo2(() => providerGroups(models, codexOnly), [models, codexOnly]);
|
|
745
577
|
const useBillingGroups = Boolean(effectiveRows.length);
|
|
746
578
|
if (models.length === 0 && effectiveRows.length === 0) {
|
|
747
579
|
return null;
|
|
748
580
|
}
|
|
749
|
-
return /* @__PURE__ */
|
|
750
|
-
/* @__PURE__ */
|
|
751
|
-
/* @__PURE__ */
|
|
581
|
+
return /* @__PURE__ */ jsxs2("span", { className: cn("relative inline-flex items-center", className), children: [
|
|
582
|
+
/* @__PURE__ */ jsx2("label", { htmlFor: selectId, className: "sr-only", children: label }),
|
|
583
|
+
/* @__PURE__ */ jsx2(
|
|
752
584
|
"select",
|
|
753
585
|
{
|
|
754
586
|
id: selectId,
|
|
@@ -763,10 +595,10 @@ function ModelPicker({
|
|
|
763
595
|
"focus:outline-hidden focus-visible:outline-hidden",
|
|
764
596
|
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
765
597
|
),
|
|
766
|
-
children: useBillingGroups ? billingGroups.map((group) => /* @__PURE__ */
|
|
598
|
+
children: useBillingGroups ? billingGroups.map((group) => /* @__PURE__ */ jsx2("optgroup", { label: group.label, children: group.rows.map((row) => /* @__PURE__ */ jsx2("option", { value: row.id, disabled: !row.selectable, children: row.unavailableReason ? `${row.label} (${row.unavailableReason})` : row.label }, row.id)) }, group.billingClass)) : providerGroupList.map((group) => /* @__PURE__ */ jsx2("optgroup", { label: group.label, children: group.models.map((model) => /* @__PURE__ */ jsx2("option", { value: model.id, disabled: model.optionDisabled, children: model.label }, model.id)) }, group.label))
|
|
767
599
|
}
|
|
768
600
|
),
|
|
769
|
-
/* @__PURE__ */
|
|
601
|
+
/* @__PURE__ */ jsx2(
|
|
770
602
|
ChevronDownIcon,
|
|
771
603
|
{
|
|
772
604
|
"aria-hidden": true,
|
|
@@ -787,23 +619,23 @@ import {
|
|
|
787
619
|
PauseIcon,
|
|
788
620
|
PlayIcon,
|
|
789
621
|
RotateCwIcon,
|
|
790
|
-
XIcon
|
|
622
|
+
XIcon
|
|
791
623
|
} from "lucide-react";
|
|
792
|
-
import { AnimatePresence as
|
|
624
|
+
import { AnimatePresence as AnimatePresence2, motion as motion2 } from "motion/react";
|
|
793
625
|
import {
|
|
794
626
|
cloneElement,
|
|
795
|
-
createContext
|
|
627
|
+
createContext,
|
|
796
628
|
forwardRef,
|
|
797
|
-
useCallback as
|
|
798
|
-
useContext
|
|
799
|
-
useEffect
|
|
629
|
+
useCallback as useCallback2,
|
|
630
|
+
useContext,
|
|
631
|
+
useEffect,
|
|
800
632
|
useId as useId2,
|
|
801
633
|
useLayoutEffect,
|
|
802
|
-
useMemo as
|
|
634
|
+
useMemo as useMemo3,
|
|
803
635
|
useRef as useRef2,
|
|
804
|
-
useState as
|
|
636
|
+
useState as useState2
|
|
805
637
|
} from "react";
|
|
806
|
-
import { Fragment
|
|
638
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
807
639
|
function ComposerTip({
|
|
808
640
|
tip,
|
|
809
641
|
children
|
|
@@ -952,7 +784,7 @@ function useChatComposerController({
|
|
|
952
784
|
onPaste,
|
|
953
785
|
messages: messageOverrides
|
|
954
786
|
}) {
|
|
955
|
-
const messages =
|
|
787
|
+
const messages = useMemo3(
|
|
956
788
|
() => ({ ...defaultChatComposerMessages, ...messageOverrides }),
|
|
957
789
|
[messageOverrides]
|
|
958
790
|
);
|
|
@@ -963,9 +795,9 @@ function useChatComposerController({
|
|
|
963
795
|
const fileInputRef = useRef2(null);
|
|
964
796
|
const listboxId = useId2();
|
|
965
797
|
const paused = effectiveControl?.state === "paused";
|
|
966
|
-
const [controlDetailsOpen, setControlDetailsOpen] =
|
|
967
|
-
const [paletteMounted, setPaletteMounted] =
|
|
968
|
-
const [submitting, setSubmitting] =
|
|
798
|
+
const [controlDetailsOpen, setControlDetailsOpen] = useState2(false);
|
|
799
|
+
const [paletteMounted, setPaletteMounted] = useState2(false);
|
|
800
|
+
const [submitting, setSubmitting] = useState2(false);
|
|
969
801
|
const submittingRef = useRef2(false);
|
|
970
802
|
const controlOperationRef = useRef2(false);
|
|
971
803
|
const deliveryValue = delivery.value;
|
|
@@ -973,13 +805,13 @@ function useChatComposerController({
|
|
|
973
805
|
const mountedRef = useRef2(true);
|
|
974
806
|
const deliveredValueRef = useRef2(deliveryValue);
|
|
975
807
|
const liveValueRef = useRef2(deliveryValue);
|
|
976
|
-
const [renderedValue, setRenderedValue] =
|
|
808
|
+
const [renderedValue, setRenderedValue] = useState2(deliveryValue);
|
|
977
809
|
const deliveryChanged = deliveryValue !== deliveredValueRef.current;
|
|
978
810
|
if (deliveryChanged) {
|
|
979
811
|
deliveredValueRef.current = deliveryValue;
|
|
980
812
|
liveValueRef.current = deliveryValue;
|
|
981
813
|
}
|
|
982
|
-
const setComposerValue =
|
|
814
|
+
const setComposerValue = useCallback2(
|
|
983
815
|
(next) => {
|
|
984
816
|
liveValueRef.current = next;
|
|
985
817
|
setRenderedValue(next);
|
|
@@ -993,13 +825,13 @@ function useChatComposerController({
|
|
|
993
825
|
setRenderedValue(liveValueRef.current);
|
|
994
826
|
}
|
|
995
827
|
}, [deliveryValue, renderedValue]);
|
|
996
|
-
|
|
828
|
+
useEffect(() => {
|
|
997
829
|
mountedRef.current = true;
|
|
998
830
|
return () => {
|
|
999
831
|
mountedRef.current = false;
|
|
1000
832
|
};
|
|
1001
833
|
}, []);
|
|
1002
|
-
|
|
834
|
+
useEffect(() => {
|
|
1003
835
|
const openControl = (event) => {
|
|
1004
836
|
const requestedId = event instanceof CustomEvent && isRecord(event.detail) && typeof event.detail.composerId === "string" ? event.detail.composerId : null;
|
|
1005
837
|
if (requestedId && requestedId !== id) return;
|
|
@@ -1018,10 +850,9 @@ function useChatComposerController({
|
|
|
1018
850
|
return () => document.removeEventListener(OPEN_WORKSTREAM_CONTROL_EVENT, openControl);
|
|
1019
851
|
}, [id, paused]);
|
|
1020
852
|
const blockedByAttachment = attachments?.hasUnresolved === true;
|
|
1021
|
-
const
|
|
1022
|
-
const [dragging, setDragging] = useState3(false);
|
|
853
|
+
const [dragging, setDragging] = useState2(false);
|
|
1023
854
|
const dragCarriesFiles = (event) => event.dataTransfer !== null && [...event.dataTransfer.types].includes("Files");
|
|
1024
|
-
const handleDragOver =
|
|
855
|
+
const handleDragOver = useCallback2(
|
|
1025
856
|
(event) => {
|
|
1026
857
|
if (!attachments || !dragCarriesFiles(event)) return;
|
|
1027
858
|
event.preventDefault();
|
|
@@ -1029,7 +860,7 @@ function useChatComposerController({
|
|
|
1029
860
|
},
|
|
1030
861
|
[attachments]
|
|
1031
862
|
);
|
|
1032
|
-
const handleDragLeave =
|
|
863
|
+
const handleDragLeave = useCallback2(
|
|
1033
864
|
(event) => {
|
|
1034
865
|
if (!attachments) return;
|
|
1035
866
|
if (event.currentTarget.contains(event.relatedTarget)) return;
|
|
@@ -1037,7 +868,7 @@ function useChatComposerController({
|
|
|
1037
868
|
},
|
|
1038
869
|
[attachments]
|
|
1039
870
|
);
|
|
1040
|
-
const handleDrop =
|
|
871
|
+
const handleDrop = useCallback2(
|
|
1041
872
|
(event) => {
|
|
1042
873
|
if (!attachments || !dragCarriesFiles(event)) return;
|
|
1043
874
|
event.preventDefault();
|
|
@@ -1046,17 +877,17 @@ function useChatComposerController({
|
|
|
1046
877
|
},
|
|
1047
878
|
[attachments]
|
|
1048
879
|
);
|
|
1049
|
-
const [notice, setNotice] =
|
|
1050
|
-
const [helpOpen, setHelpOpen] =
|
|
1051
|
-
const [confirmState, setConfirmState] =
|
|
880
|
+
const [notice, setNotice] = useState2(null);
|
|
881
|
+
const [helpOpen, setHelpOpen] = useState2(false);
|
|
882
|
+
const [confirmState, setConfirmState] = useState2(null);
|
|
1052
883
|
const pendingConfirm = useRef2(null);
|
|
1053
|
-
const settleConfirmation =
|
|
884
|
+
const settleConfirmation = useCallback2((confirmed) => {
|
|
1054
885
|
const resolve = pendingConfirm.current;
|
|
1055
886
|
pendingConfirm.current = null;
|
|
1056
887
|
setConfirmState(null);
|
|
1057
888
|
resolve?.(confirmed);
|
|
1058
889
|
}, []);
|
|
1059
|
-
|
|
890
|
+
useEffect(
|
|
1060
891
|
() => () => {
|
|
1061
892
|
pendingConfirm.current?.(false);
|
|
1062
893
|
pendingConfirm.current = null;
|
|
@@ -1064,7 +895,7 @@ function useChatComposerController({
|
|
|
1064
895
|
[]
|
|
1065
896
|
);
|
|
1066
897
|
const resizeInputRafRef = useRef2(null);
|
|
1067
|
-
const resizeInput =
|
|
898
|
+
const resizeInput = useCallback2(() => {
|
|
1068
899
|
if (resizeInputRafRef.current !== null) {
|
|
1069
900
|
return;
|
|
1070
901
|
}
|
|
@@ -1077,8 +908,8 @@ function useChatComposerController({
|
|
|
1077
908
|
applyComposerTextareaHeight(textarea, 220);
|
|
1078
909
|
});
|
|
1079
910
|
}, []);
|
|
1080
|
-
|
|
1081
|
-
|
|
911
|
+
useEffect(() => resizeInput(), [resizeInput, visibleValue]);
|
|
912
|
+
useEffect(
|
|
1082
913
|
() => () => {
|
|
1083
914
|
if (resizeInputRafRef.current !== null) {
|
|
1084
915
|
cancelAnimationFrame(resizeInputRafRef.current);
|
|
@@ -1087,7 +918,7 @@ function useChatComposerController({
|
|
|
1087
918
|
},
|
|
1088
919
|
[]
|
|
1089
920
|
);
|
|
1090
|
-
const handlers =
|
|
921
|
+
const handlers = useMemo3(
|
|
1091
922
|
() => ({
|
|
1092
923
|
notice: (next) => {
|
|
1093
924
|
setNotice(next);
|
|
@@ -1119,9 +950,9 @@ function useChatComposerController({
|
|
|
1119
950
|
const annotationsIncomplete = (delivery.annotations ?? []).some(
|
|
1120
951
|
(annotation) => annotation.note.trim().length === 0
|
|
1121
952
|
);
|
|
1122
|
-
const submitBlocker = disabled ? "disabled" : blockedByAttachment ? "attachment" : delivery.sending || submitting ? "sending" : commandDraftBlocked ? "command" : annotationsIncomplete ? "annotations" : delivery.canSend
|
|
953
|
+
const submitBlocker = disabled ? "disabled" : blockedByAttachment ? "attachment" : delivery.sending || submitting ? "sending" : commandDraftBlocked ? "command" : annotationsIncomplete ? "annotations" : delivery.canSend ? null : "empty";
|
|
1123
954
|
const canSubmit = submitBlocker === null;
|
|
1124
|
-
const submit =
|
|
955
|
+
const submit = useCallback2(
|
|
1125
956
|
async (mode) => {
|
|
1126
957
|
if (commandDraftBlocked) {
|
|
1127
958
|
setNotice({ tone: "error", message: messages.slashCommandBlocked });
|
|
@@ -1136,7 +967,7 @@ function useChatComposerController({
|
|
|
1136
967
|
delivery.requestAnnotationReview?.();
|
|
1137
968
|
return false;
|
|
1138
969
|
}
|
|
1139
|
-
if (!delivery.canSend
|
|
970
|
+
if (!delivery.canSend) return false;
|
|
1140
971
|
submittingRef.current = true;
|
|
1141
972
|
setSubmitting(true);
|
|
1142
973
|
try {
|
|
@@ -1152,12 +983,11 @@ function useChatComposerController({
|
|
|
1152
983
|
commandDraftBlocked,
|
|
1153
984
|
delivery,
|
|
1154
985
|
disabled,
|
|
1155
|
-
hasReadyAttachment,
|
|
1156
986
|
messages.annotationNotesRequired,
|
|
1157
987
|
messages.slashCommandBlocked
|
|
1158
988
|
]
|
|
1159
989
|
);
|
|
1160
|
-
const handleKeyDown =
|
|
990
|
+
const handleKeyDown = useCallback2(
|
|
1161
991
|
(event) => {
|
|
1162
992
|
if (paletteEnabled && paletteMounted && palette.onKeyDown(event)) return;
|
|
1163
993
|
if (!shouldSubmitOnKey(event)) return;
|
|
@@ -1166,21 +996,21 @@ function useChatComposerController({
|
|
|
1166
996
|
},
|
|
1167
997
|
[palette, paletteEnabled, paletteMounted, submit]
|
|
1168
998
|
);
|
|
1169
|
-
const handlePaste =
|
|
999
|
+
const handlePaste = useCallback2(
|
|
1170
1000
|
(event) => {
|
|
1171
1001
|
onPaste?.(event);
|
|
1172
1002
|
attachments?.addFromPaste(event);
|
|
1173
1003
|
},
|
|
1174
1004
|
[attachments, onPaste]
|
|
1175
1005
|
);
|
|
1176
|
-
const handleFileChange =
|
|
1006
|
+
const handleFileChange = useCallback2(
|
|
1177
1007
|
(event) => {
|
|
1178
1008
|
if (event.target.files) attachments?.addFiles(event.target.files);
|
|
1179
1009
|
event.target.value = "";
|
|
1180
1010
|
},
|
|
1181
1011
|
[attachments]
|
|
1182
1012
|
);
|
|
1183
|
-
const helpCommands =
|
|
1013
|
+
const helpCommands = useMemo3(
|
|
1184
1014
|
() => commands.filter((command) => {
|
|
1185
1015
|
if (command.permission && commandContext) {
|
|
1186
1016
|
const permissions = commandContext.permissions;
|
|
@@ -1194,7 +1024,7 @@ function useChatComposerController({
|
|
|
1194
1024
|
tone: "error",
|
|
1195
1025
|
message: /control changed|paused while/i.test(delivery.error.message) ? messages.controlChangedError : composerSubmissionErrorMessage(delivery.error) || messages.sendFailedError
|
|
1196
1026
|
} : null);
|
|
1197
|
-
|
|
1027
|
+
useEffect(() => {
|
|
1198
1028
|
if (notice?.tone !== "ok") return;
|
|
1199
1029
|
const timer = window.setTimeout(
|
|
1200
1030
|
() => setNotice((current) => current === notice ? null : current),
|
|
@@ -1202,13 +1032,13 @@ function useChatComposerController({
|
|
|
1202
1032
|
);
|
|
1203
1033
|
return () => window.clearTimeout(timer);
|
|
1204
1034
|
}, [notice]);
|
|
1205
|
-
|
|
1035
|
+
useEffect(() => {
|
|
1206
1036
|
if (annotationsIncomplete) return;
|
|
1207
1037
|
setNotice(
|
|
1208
1038
|
(current) => current?.message === messages.annotationNotesRequired ? null : current
|
|
1209
1039
|
);
|
|
1210
1040
|
}, [annotationsIncomplete, messages.annotationNotesRequired]);
|
|
1211
|
-
const runControlOperation =
|
|
1041
|
+
const runControlOperation = useCallback2(async (operation) => {
|
|
1212
1042
|
if (controlOperationRef.current) return false;
|
|
1213
1043
|
controlOperationRef.current = true;
|
|
1214
1044
|
try {
|
|
@@ -1218,21 +1048,21 @@ function useChatComposerController({
|
|
|
1218
1048
|
controlOperationRef.current = false;
|
|
1219
1049
|
}
|
|
1220
1050
|
}, []);
|
|
1221
|
-
const pause =
|
|
1051
|
+
const pause = useCallback2(
|
|
1222
1052
|
async (reason) => {
|
|
1223
1053
|
if (!control || control.pausing || control.resuming) return false;
|
|
1224
1054
|
return await runControlOperation(() => control.pause(reason));
|
|
1225
1055
|
},
|
|
1226
1056
|
[control, runControlOperation]
|
|
1227
1057
|
);
|
|
1228
|
-
const resume =
|
|
1058
|
+
const resume = useCallback2(
|
|
1229
1059
|
async (reason) => {
|
|
1230
1060
|
if (!control || control.pausing || control.resuming) return false;
|
|
1231
1061
|
return await runControlOperation(() => control.resume(reason));
|
|
1232
1062
|
},
|
|
1233
1063
|
[control, runControlOperation]
|
|
1234
1064
|
);
|
|
1235
|
-
const resumeScope =
|
|
1065
|
+
const resumeScope = useCallback2(
|
|
1236
1066
|
async (option) => {
|
|
1237
1067
|
if (!control || control.pausing || control.resuming) return false;
|
|
1238
1068
|
return await runControlOperation(() => control.resumeScope(option));
|
|
@@ -1297,9 +1127,9 @@ function useChatComposerController({
|
|
|
1297
1127
|
value: visibleValue
|
|
1298
1128
|
};
|
|
1299
1129
|
}
|
|
1300
|
-
var ComposerContext =
|
|
1130
|
+
var ComposerContext = createContext(null);
|
|
1301
1131
|
function useComposerController() {
|
|
1302
|
-
const controller =
|
|
1132
|
+
const controller = useContext(ComposerContext);
|
|
1303
1133
|
if (!controller) throw new Error("useChatComposer must be used inside <Composer.Root>");
|
|
1304
1134
|
return controller;
|
|
1305
1135
|
}
|
|
@@ -1311,11 +1141,11 @@ function isRecord(value) {
|
|
|
1311
1141
|
}
|
|
1312
1142
|
var Root = forwardRef(function ComposerRoot({ controller, children, className, style, responsiveBasis = "viewport", ...props }, forwardedRef) {
|
|
1313
1143
|
const responsiveRootRef = useRef2(null);
|
|
1314
|
-
const responsiveContext =
|
|
1144
|
+
const responsiveContext = useMemo3(
|
|
1315
1145
|
() => ({ responsiveBasis, rootRef: responsiveRootRef }),
|
|
1316
1146
|
[responsiveBasis]
|
|
1317
1147
|
);
|
|
1318
|
-
return /* @__PURE__ */
|
|
1148
|
+
return /* @__PURE__ */ jsx3(ComposerContext.Provider, { value: controller, children: /* @__PURE__ */ jsx3(ComposerResponsiveContext.Provider, { value: responsiveContext, children: /* @__PURE__ */ jsx3(TooltipProvider, { delayDuration: 300, children: /* @__PURE__ */ jsxs3(
|
|
1319
1149
|
"div",
|
|
1320
1150
|
{
|
|
1321
1151
|
...props,
|
|
@@ -1326,23 +1156,23 @@ var Root = forwardRef(function ComposerRoot({ controller, children, className, s
|
|
|
1326
1156
|
style: { paddingBottom: "env(safe-area-inset-bottom)", ...style },
|
|
1327
1157
|
children: [
|
|
1328
1158
|
children,
|
|
1329
|
-
/* @__PURE__ */
|
|
1159
|
+
/* @__PURE__ */ jsx3(ComposerAnnouncements, {})
|
|
1330
1160
|
]
|
|
1331
1161
|
}
|
|
1332
1162
|
) }) }) });
|
|
1333
1163
|
});
|
|
1334
1164
|
var Frame = forwardRef(function ComposerFrame({ className, ...props }, ref) {
|
|
1335
|
-
return /* @__PURE__ */
|
|
1165
|
+
return /* @__PURE__ */ jsx3("div", { ...props, ref, className: cn("relative", className) });
|
|
1336
1166
|
});
|
|
1337
1167
|
function CommandPalette2({ className }) {
|
|
1338
1168
|
const controller = useComposerController();
|
|
1339
1169
|
const setPaletteMounted = controller.setPaletteMounted;
|
|
1340
|
-
|
|
1170
|
+
useEffect(() => {
|
|
1341
1171
|
setPaletteMounted(true);
|
|
1342
1172
|
return () => setPaletteMounted(false);
|
|
1343
1173
|
}, [setPaletteMounted]);
|
|
1344
1174
|
if (!controller.paletteEnabled) return null;
|
|
1345
|
-
return /* @__PURE__ */
|
|
1175
|
+
return /* @__PURE__ */ jsx3("div", { className, children: /* @__PURE__ */ jsx3(
|
|
1346
1176
|
CommandPalette,
|
|
1347
1177
|
{
|
|
1348
1178
|
open: controller.palette.open && controller.confirmState === null,
|
|
@@ -1362,7 +1192,7 @@ function CommandPalette2({ className }) {
|
|
|
1362
1192
|
}
|
|
1363
1193
|
var Surface = forwardRef(function ComposerSurface({ className, children, ...props }, ref) {
|
|
1364
1194
|
const controller = useComposerController();
|
|
1365
|
-
return /* @__PURE__ */
|
|
1195
|
+
return /* @__PURE__ */ jsxs3(
|
|
1366
1196
|
"div",
|
|
1367
1197
|
{
|
|
1368
1198
|
...props,
|
|
@@ -1378,7 +1208,7 @@ var Surface = forwardRef(function ComposerSurface({ className, children, ...prop
|
|
|
1378
1208
|
className
|
|
1379
1209
|
),
|
|
1380
1210
|
children: [
|
|
1381
|
-
controller.dragging ? /* @__PURE__ */
|
|
1211
|
+
controller.dragging ? /* @__PURE__ */ jsx3(
|
|
1382
1212
|
"div",
|
|
1383
1213
|
{
|
|
1384
1214
|
"aria-hidden": true,
|
|
@@ -1386,8 +1216,8 @@ var Surface = forwardRef(function ComposerSurface({ className, children, ...prop
|
|
|
1386
1216
|
"pointer-events-none absolute inset-0 z-10 flex items-center justify-center",
|
|
1387
1217
|
"rounded-og-lg bg-og-surface-1/85 text-og-menu font-medium text-og-accent backdrop-blur-[1px]"
|
|
1388
1218
|
),
|
|
1389
|
-
children: /* @__PURE__ */
|
|
1390
|
-
/* @__PURE__ */
|
|
1219
|
+
children: /* @__PURE__ */ jsxs3("span", { className: "inline-flex items-center gap-2", children: [
|
|
1220
|
+
/* @__PURE__ */ jsx3(PaperclipIcon, { className: "size-4" }),
|
|
1391
1221
|
controller.messages.dropFiles
|
|
1392
1222
|
] })
|
|
1393
1223
|
}
|
|
@@ -1400,7 +1230,7 @@ var Surface = forwardRef(function ComposerSurface({ className, children, ...prop
|
|
|
1400
1230
|
function PausedState() {
|
|
1401
1231
|
const controller = useComposerController();
|
|
1402
1232
|
if (!controller.paused || !controller.effectiveControl || !controller.hasControl) return null;
|
|
1403
|
-
return /* @__PURE__ */
|
|
1233
|
+
return /* @__PURE__ */ jsx3(
|
|
1404
1234
|
WorkstreamPausedStrip,
|
|
1405
1235
|
{
|
|
1406
1236
|
control: controller.effectiveControl,
|
|
@@ -1420,7 +1250,7 @@ function PausedState() {
|
|
|
1420
1250
|
function RestoredResources() {
|
|
1421
1251
|
const controller = useComposerController();
|
|
1422
1252
|
if (controller.restoredResources.length === 0 || !controller.removeRestoredResource) return null;
|
|
1423
|
-
return /* @__PURE__ */
|
|
1253
|
+
return /* @__PURE__ */ jsx3(
|
|
1424
1254
|
RestoredResourceChips,
|
|
1425
1255
|
{
|
|
1426
1256
|
resources: controller.restoredResources,
|
|
@@ -1432,7 +1262,7 @@ function RestoredResources() {
|
|
|
1432
1262
|
function Attachments() {
|
|
1433
1263
|
const controller = useComposerController();
|
|
1434
1264
|
if (!controller.attachments || controller.attachments.attachments.length === 0) return null;
|
|
1435
|
-
return /* @__PURE__ */
|
|
1265
|
+
return /* @__PURE__ */ jsx3(
|
|
1436
1266
|
AttachmentChips,
|
|
1437
1267
|
{
|
|
1438
1268
|
attachments: controller.attachments.attachments,
|
|
@@ -1448,17 +1278,20 @@ var Input = forwardRef(function ComposerInput({ rows = 1, placeholder, className
|
|
|
1448
1278
|
const controller = useComposerController();
|
|
1449
1279
|
const autoFocusedRef = useRef2(false);
|
|
1450
1280
|
const paletteOpen = controller.paletteEnabled && controller.paletteMounted && controller.palette.open;
|
|
1451
|
-
|
|
1281
|
+
useEffect(() => {
|
|
1452
1282
|
if (!autoFocus || controller.disabled || autoFocusedRef.current) return;
|
|
1453
1283
|
const frame = window.requestAnimationFrame(() => {
|
|
1454
1284
|
const textarea = controller.textareaRef.current;
|
|
1455
1285
|
if (!textarea || textarea.disabled) return;
|
|
1456
1286
|
autoFocusedRef.current = true;
|
|
1287
|
+
const active = textarea.ownerDocument.activeElement;
|
|
1288
|
+
if (active !== textarea && active?.closest('input, textarea, select, [contenteditable="true"], [role="textbox"]'))
|
|
1289
|
+
return;
|
|
1457
1290
|
textarea.focus();
|
|
1458
1291
|
});
|
|
1459
1292
|
return () => window.cancelAnimationFrame(frame);
|
|
1460
1293
|
}, [autoFocus, controller.disabled, controller.textareaRef]);
|
|
1461
|
-
return /* @__PURE__ */
|
|
1294
|
+
return /* @__PURE__ */ jsx3(
|
|
1462
1295
|
"textarea",
|
|
1463
1296
|
{
|
|
1464
1297
|
...props,
|
|
@@ -1489,7 +1322,7 @@ function Confirmation() {
|
|
|
1489
1322
|
const controller = useComposerController();
|
|
1490
1323
|
const command = controller.confirmState?.command;
|
|
1491
1324
|
if (!command || !controller.confirmState) return null;
|
|
1492
|
-
return /* @__PURE__ */
|
|
1325
|
+
return /* @__PURE__ */ jsx3(
|
|
1493
1326
|
ConfirmBar,
|
|
1494
1327
|
{
|
|
1495
1328
|
command,
|
|
@@ -1501,7 +1334,7 @@ function Confirmation() {
|
|
|
1501
1334
|
);
|
|
1502
1335
|
}
|
|
1503
1336
|
var Footer = forwardRef(function ComposerFooter({ className, ...props }, ref) {
|
|
1504
|
-
return /* @__PURE__ */
|
|
1337
|
+
return /* @__PURE__ */ jsx3(
|
|
1505
1338
|
"div",
|
|
1506
1339
|
{
|
|
1507
1340
|
...props,
|
|
@@ -1517,7 +1350,7 @@ var Footer = forwardRef(function ComposerFooter({ className, ...props }, ref) {
|
|
|
1517
1350
|
});
|
|
1518
1351
|
var Controls = forwardRef(
|
|
1519
1352
|
function ComposerControls({ className, ...props }, ref) {
|
|
1520
|
-
return /* @__PURE__ */
|
|
1353
|
+
return /* @__PURE__ */ jsx3(
|
|
1521
1354
|
"span",
|
|
1522
1355
|
{
|
|
1523
1356
|
...props,
|
|
@@ -1533,7 +1366,7 @@ var Controls = forwardRef(
|
|
|
1533
1366
|
);
|
|
1534
1367
|
var Hint = forwardRef(function ComposerHint({ className, children, ...props }, ref) {
|
|
1535
1368
|
const controller = useComposerController();
|
|
1536
|
-
return /* @__PURE__ */
|
|
1369
|
+
return /* @__PURE__ */ jsx3(
|
|
1537
1370
|
"span",
|
|
1538
1371
|
{
|
|
1539
1372
|
...props,
|
|
@@ -1547,7 +1380,7 @@ var Hint = forwardRef(function ComposerHint({ className, children, ...props }, r
|
|
|
1547
1380
|
);
|
|
1548
1381
|
});
|
|
1549
1382
|
var Actions = forwardRef(function ComposerActions({ className, ...props }, ref) {
|
|
1550
|
-
return /* @__PURE__ */
|
|
1383
|
+
return /* @__PURE__ */ jsx3(
|
|
1551
1384
|
"span",
|
|
1552
1385
|
{
|
|
1553
1386
|
...props,
|
|
@@ -1565,8 +1398,8 @@ var AttachButton = forwardRef(
|
|
|
1565
1398
|
const controller = useComposerController();
|
|
1566
1399
|
if (!controller.attachments) return null;
|
|
1567
1400
|
const tip = title ?? controller.messages.attachFiles;
|
|
1568
|
-
return /* @__PURE__ */
|
|
1569
|
-
/* @__PURE__ */
|
|
1401
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1402
|
+
/* @__PURE__ */ jsx3(
|
|
1570
1403
|
"input",
|
|
1571
1404
|
{
|
|
1572
1405
|
ref: controller.fileInputRef,
|
|
@@ -1578,7 +1411,7 @@ var AttachButton = forwardRef(
|
|
|
1578
1411
|
onChange: controller.handleFileChange
|
|
1579
1412
|
}
|
|
1580
1413
|
),
|
|
1581
|
-
/* @__PURE__ */
|
|
1414
|
+
/* @__PURE__ */ jsx3(ComposerTip, { tip, children: /* @__PURE__ */ jsx3(
|
|
1582
1415
|
"button",
|
|
1583
1416
|
{
|
|
1584
1417
|
...props,
|
|
@@ -1593,7 +1426,7 @@ var AttachButton = forwardRef(
|
|
|
1593
1426
|
"disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:size-11",
|
|
1594
1427
|
className
|
|
1595
1428
|
),
|
|
1596
|
-
children: children ?? /* @__PURE__ */
|
|
1429
|
+
children: children ?? /* @__PURE__ */ jsx3(PaperclipIcon, { className: "size-4" })
|
|
1597
1430
|
}
|
|
1598
1431
|
) })
|
|
1599
1432
|
] });
|
|
@@ -1609,7 +1442,7 @@ function ModelPicker2({
|
|
|
1609
1442
|
codexOnly
|
|
1610
1443
|
}) {
|
|
1611
1444
|
const controller = useComposerController();
|
|
1612
|
-
return /* @__PURE__ */
|
|
1445
|
+
return /* @__PURE__ */ jsx3(
|
|
1613
1446
|
ModelPicker,
|
|
1614
1447
|
{
|
|
1615
1448
|
models,
|
|
@@ -1629,7 +1462,7 @@ var PauseButton = forwardRef(
|
|
|
1629
1462
|
if (!controller.effectiveControl || controller.paused || !controller.hasControl) return null;
|
|
1630
1463
|
const busy = controller.pausing || controller.resuming;
|
|
1631
1464
|
const tip = title ?? controller.messages.pauseTitle;
|
|
1632
|
-
return /* @__PURE__ */
|
|
1465
|
+
return /* @__PURE__ */ jsx3(ComposerTip, { tip, children: /* @__PURE__ */ jsx3(
|
|
1633
1466
|
"button",
|
|
1634
1467
|
{
|
|
1635
1468
|
...props,
|
|
@@ -1645,7 +1478,7 @@ var PauseButton = forwardRef(
|
|
|
1645
1478
|
"disabled:opacity-50",
|
|
1646
1479
|
className
|
|
1647
1480
|
),
|
|
1648
|
-
children: children ?? (busy ? /* @__PURE__ */
|
|
1481
|
+
children: children ?? (busy ? /* @__PURE__ */ jsx3(LoaderCircleIcon, { className: "size-3.5 animate-og-spin" }) : /* @__PURE__ */ jsx3(PauseIcon, { className: "size-3.5 fill-current" }))
|
|
1649
1482
|
}
|
|
1650
1483
|
) });
|
|
1651
1484
|
}
|
|
@@ -1654,7 +1487,7 @@ var SendButton = forwardRef(
|
|
|
1654
1487
|
function ComposerSendButton({ className, "aria-label": ariaLabel, title, children, ...props }, ref) {
|
|
1655
1488
|
const controller = useComposerController();
|
|
1656
1489
|
const tip = title ?? (controller.submitBlocker === "annotations" ? controller.messages.annotationNotesRequired : controller.paused ? controller.messages.sendAndResumeTitle : controller.messages.sendTitle);
|
|
1657
|
-
return /* @__PURE__ */
|
|
1490
|
+
return /* @__PURE__ */ jsx3(ComposerTip, { tip, children: /* @__PURE__ */ jsx3(
|
|
1658
1491
|
"button",
|
|
1659
1492
|
{
|
|
1660
1493
|
...props,
|
|
@@ -1672,14 +1505,14 @@ var SendButton = forwardRef(
|
|
|
1672
1505
|
"disabled:cursor-not-allowed disabled:bg-og-surface-3 disabled:text-og-fg-subtle disabled:shadow-none",
|
|
1673
1506
|
className
|
|
1674
1507
|
),
|
|
1675
|
-
children: children ?? (controller.sending ? /* @__PURE__ */
|
|
1508
|
+
children: children ?? (controller.sending ? /* @__PURE__ */ jsx3(LoaderCircleIcon, { className: "size-4 animate-og-spin" }) : /* @__PURE__ */ jsx3(ArrowUpIcon, { className: "size-4" }))
|
|
1676
1509
|
}
|
|
1677
1510
|
) });
|
|
1678
1511
|
}
|
|
1679
1512
|
);
|
|
1680
1513
|
function Help() {
|
|
1681
1514
|
const controller = useComposerController();
|
|
1682
|
-
return /* @__PURE__ */
|
|
1515
|
+
return /* @__PURE__ */ jsx3(AnimatePresence2, { children: controller.helpOpen ? /* @__PURE__ */ jsx3(
|
|
1683
1516
|
HelpPanel,
|
|
1684
1517
|
{
|
|
1685
1518
|
commands: controller.helpCommands,
|
|
@@ -1690,9 +1523,9 @@ function Help() {
|
|
|
1690
1523
|
}
|
|
1691
1524
|
function Status() {
|
|
1692
1525
|
const controller = useComposerController();
|
|
1693
|
-
return /* @__PURE__ */
|
|
1694
|
-
/* @__PURE__ */
|
|
1695
|
-
|
|
1526
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1527
|
+
/* @__PURE__ */ jsx3(AnimatePresence2, { children: controller.activeNotice ? /* @__PURE__ */ jsx3(
|
|
1528
|
+
motion2.p,
|
|
1696
1529
|
{
|
|
1697
1530
|
initial: { opacity: 0, height: 0 },
|
|
1698
1531
|
animate: { opacity: 1, height: "auto" },
|
|
@@ -1704,9 +1537,9 @@ function Status() {
|
|
|
1704
1537
|
children: controller.activeNotice.message
|
|
1705
1538
|
}
|
|
1706
1539
|
) : null }),
|
|
1707
|
-
controller.draftConflict ? /* @__PURE__ */
|
|
1708
|
-
/* @__PURE__ */
|
|
1709
|
-
/* @__PURE__ */
|
|
1540
|
+
controller.draftConflict ? /* @__PURE__ */ jsxs3("div", { className: "mt-1.5 flex flex-wrap items-center gap-2 px-1 text-og-xs text-og-status-failed", children: [
|
|
1541
|
+
/* @__PURE__ */ jsx3("span", { className: "min-w-0 flex-1", children: controller.messages.draftConflict }),
|
|
1542
|
+
/* @__PURE__ */ jsx3(
|
|
1710
1543
|
"button",
|
|
1711
1544
|
{
|
|
1712
1545
|
type: "button",
|
|
@@ -1715,7 +1548,7 @@ function Status() {
|
|
|
1715
1548
|
children: controller.messages.useOtherDraft
|
|
1716
1549
|
}
|
|
1717
1550
|
),
|
|
1718
|
-
/* @__PURE__ */
|
|
1551
|
+
/* @__PURE__ */ jsx3(
|
|
1719
1552
|
"button",
|
|
1720
1553
|
{
|
|
1721
1554
|
type: "button",
|
|
@@ -1729,9 +1562,9 @@ function Status() {
|
|
|
1729
1562
|
}
|
|
1730
1563
|
function ComposerAnnouncements() {
|
|
1731
1564
|
const controller = useComposerController();
|
|
1732
|
-
return /* @__PURE__ */
|
|
1733
|
-
controller.activeNotice ? /* @__PURE__ */
|
|
1734
|
-
controller.draftConflict ? /* @__PURE__ */
|
|
1565
|
+
return /* @__PURE__ */ jsxs3("div", { className: "sr-only", children: [
|
|
1566
|
+
controller.activeNotice ? /* @__PURE__ */ jsx3("p", { role: controller.activeNotice.tone === "error" ? "alert" : "status", children: controller.activeNotice.message }) : null,
|
|
1567
|
+
controller.draftConflict ? /* @__PURE__ */ jsx3("p", { role: "alert", children: controller.messages.draftConflict }) : null
|
|
1735
1568
|
] });
|
|
1736
1569
|
}
|
|
1737
1570
|
function mergeRefs(...refs) {
|
|
@@ -1761,10 +1594,10 @@ function WorkstreamPausedStrip({
|
|
|
1761
1594
|
const broaderOptions = control.resumeOptions.filter(
|
|
1762
1595
|
(option) => option !== primary && option.scope !== "selected" && (option.scope !== "workspace" || canControlWorkspace)
|
|
1763
1596
|
);
|
|
1764
|
-
return /* @__PURE__ */
|
|
1765
|
-
/* @__PURE__ */
|
|
1766
|
-
/* @__PURE__ */
|
|
1767
|
-
/* @__PURE__ */
|
|
1597
|
+
return /* @__PURE__ */ jsxs3("div", { className: "border-b border-og-status-waiting/25 bg-og-status-waiting/[0.07]", children: [
|
|
1598
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex min-w-0 items-center gap-2 px-3 py-2", children: [
|
|
1599
|
+
/* @__PURE__ */ jsx3(PauseIcon, { className: "size-3.5 shrink-0 text-og-status-waiting" }),
|
|
1600
|
+
/* @__PURE__ */ jsxs3(
|
|
1768
1601
|
"button",
|
|
1769
1602
|
{
|
|
1770
1603
|
type: "button",
|
|
@@ -1772,12 +1605,12 @@ function WorkstreamPausedStrip({
|
|
|
1772
1605
|
onClick: () => onOpenChange(!open),
|
|
1773
1606
|
"aria-expanded": open,
|
|
1774
1607
|
children: [
|
|
1775
|
-
/* @__PURE__ */
|
|
1776
|
-
/* @__PURE__ */
|
|
1608
|
+
/* @__PURE__ */ jsx3("span", { className: "block truncate text-og-xs font-medium text-og-fg", children: cause }),
|
|
1609
|
+
/* @__PURE__ */ jsx3("span", { className: "block truncate text-[11px] text-og-fg-muted", children: queuedAheadCount > 0 ? messages.queuedAhead(queuedAheadCount) : sending ? messages.resumingAndSending : messages.nextMessageResumes })
|
|
1777
1610
|
]
|
|
1778
1611
|
}
|
|
1779
1612
|
),
|
|
1780
|
-
/* @__PURE__ */
|
|
1613
|
+
/* @__PURE__ */ jsxs3(
|
|
1781
1614
|
"button",
|
|
1782
1615
|
{
|
|
1783
1616
|
type: "button",
|
|
@@ -1786,47 +1619,47 @@ function WorkstreamPausedStrip({
|
|
|
1786
1619
|
disabled: busy,
|
|
1787
1620
|
onClick: onResume,
|
|
1788
1621
|
children: [
|
|
1789
|
-
busy ? /* @__PURE__ */
|
|
1790
|
-
/* @__PURE__ */
|
|
1791
|
-
/* @__PURE__ */
|
|
1622
|
+
busy ? /* @__PURE__ */ jsx3(LoaderCircleIcon, { className: "size-3.5 animate-og-spin" }) : /* @__PURE__ */ jsx3(PlayIcon, { className: "size-3.5 fill-current" }),
|
|
1623
|
+
/* @__PURE__ */ jsx3("span", { className: "og-composer-resume-label-long hidden min-[400px]:inline", children: messages.resumeThisWorkstream }),
|
|
1624
|
+
/* @__PURE__ */ jsx3("span", { className: "og-composer-resume-label-short min-[400px]:hidden", children: messages.resumeShort })
|
|
1792
1625
|
]
|
|
1793
1626
|
}
|
|
1794
1627
|
),
|
|
1795
|
-
/* @__PURE__ */
|
|
1628
|
+
/* @__PURE__ */ jsx3(
|
|
1796
1629
|
"button",
|
|
1797
1630
|
{
|
|
1798
1631
|
type: "button",
|
|
1799
1632
|
className: "inline-flex size-8 shrink-0 items-center justify-center rounded-og-md text-og-fg-muted hover:bg-og-surface-2 pointer-coarse:size-11",
|
|
1800
1633
|
onClick: () => onOpenChange(!open),
|
|
1801
1634
|
"aria-label": open ? messages.hidePauseDetails : messages.showPauseDetails,
|
|
1802
|
-
children: /* @__PURE__ */
|
|
1635
|
+
children: /* @__PURE__ */ jsx3(ChevronDownIcon2, { className: cn("size-3.5 transition-transform", open && "rotate-180") })
|
|
1803
1636
|
}
|
|
1804
1637
|
)
|
|
1805
1638
|
] }),
|
|
1806
|
-
open ? /* @__PURE__ */
|
|
1807
|
-
/* @__PURE__ */
|
|
1639
|
+
open ? /* @__PURE__ */ jsxs3("div", { className: "border-t border-og-status-waiting/20 px-3 pb-3 pt-2", children: [
|
|
1640
|
+
/* @__PURE__ */ jsx3("ul", { className: "grid gap-2", "aria-label": messages.pauseReasonsLabel, children: control.blockers.map((entry, index) => /* @__PURE__ */ jsxs3(
|
|
1808
1641
|
"li",
|
|
1809
1642
|
{
|
|
1810
1643
|
className: "text-og-xs",
|
|
1811
1644
|
children: [
|
|
1812
|
-
/* @__PURE__ */
|
|
1813
|
-
blockerHref(entry, controlLinks) ? /* @__PURE__ */
|
|
1645
|
+
/* @__PURE__ */ jsx3("span", { className: "font-medium text-og-fg", children: index === 0 ? messages.pausedByLabel : messages.alsoPausedByLabel }),
|
|
1646
|
+
blockerHref(entry, controlLinks) ? /* @__PURE__ */ jsx3(
|
|
1814
1647
|
"a",
|
|
1815
1648
|
{
|
|
1816
1649
|
href: blockerHref(entry, controlLinks),
|
|
1817
1650
|
className: "font-medium text-og-fg underline decoration-og-border-strong underline-offset-2 hover:text-og-accent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-og-ring/40",
|
|
1818
1651
|
children: entry.displayName
|
|
1819
1652
|
}
|
|
1820
|
-
) : /* @__PURE__ */
|
|
1821
|
-
entry.reason ? /* @__PURE__ */
|
|
1653
|
+
) : /* @__PURE__ */ jsx3("span", { className: "font-medium text-og-fg", children: entry.displayName }),
|
|
1654
|
+
entry.reason ? /* @__PURE__ */ jsxs3("span", { className: "text-og-fg-muted", children: [
|
|
1822
1655
|
" \xB7 ",
|
|
1823
1656
|
entry.reason
|
|
1824
1657
|
] }) : null,
|
|
1825
|
-
entry.actor ? /* @__PURE__ */
|
|
1658
|
+
entry.actor ? /* @__PURE__ */ jsxs3("span", { className: "text-og-fg-subtle", children: [
|
|
1826
1659
|
" \xB7 ",
|
|
1827
1660
|
entry.actor
|
|
1828
1661
|
] }) : null,
|
|
1829
|
-
entry.changedAt ? /* @__PURE__ */
|
|
1662
|
+
entry.changedAt ? /* @__PURE__ */ jsxs3("span", { className: "text-og-fg-subtle", children: [
|
|
1830
1663
|
" ",
|
|
1831
1664
|
"\xB7 ",
|
|
1832
1665
|
messages.formatRelativeTime(entry.changedAt)
|
|
@@ -1835,11 +1668,11 @@ function WorkstreamPausedStrip({
|
|
|
1835
1668
|
},
|
|
1836
1669
|
`${entry.kind}-${entry.sessionId ?? "workspace"}-${entry.revision}`
|
|
1837
1670
|
)) }),
|
|
1838
|
-
broaderOptions.length > 0 ? /* @__PURE__ */
|
|
1671
|
+
broaderOptions.length > 0 ? /* @__PURE__ */ jsx3("div", { className: "mt-2 flex flex-wrap gap-1.5", children: broaderOptions.map((option) => /* @__PURE__ */ jsx3(
|
|
1839
1672
|
ComposerTip,
|
|
1840
1673
|
{
|
|
1841
1674
|
tip: option.impactCopy,
|
|
1842
|
-
children: /* @__PURE__ */
|
|
1675
|
+
children: /* @__PURE__ */ jsxs3(
|
|
1843
1676
|
"button",
|
|
1844
1677
|
{
|
|
1845
1678
|
type: "button",
|
|
@@ -1847,8 +1680,8 @@ function WorkstreamPausedStrip({
|
|
|
1847
1680
|
onClick: () => onResumeOption(option),
|
|
1848
1681
|
className: "rounded-og-md border border-og-border bg-og-surface-1 px-2 py-1 text-og-xs text-og-fg-muted hover:bg-og-surface-2 hover:text-og-fg pointer-coarse:min-h-10",
|
|
1849
1682
|
children: [
|
|
1850
|
-
/* @__PURE__ */
|
|
1851
|
-
/* @__PURE__ */
|
|
1683
|
+
/* @__PURE__ */ jsx3("span", { className: "block font-medium", children: option.scope === "workspace" ? messages.resumeWorkspace : messages.resumeFromSession }),
|
|
1684
|
+
/* @__PURE__ */ jsx3("span", { className: "block text-[10px] text-og-fg-subtle", children: option.selectedStateAfter === "active" ? messages.sessionCanRun : messages.stillPausedBy(
|
|
1852
1685
|
option.remainingPrimaryBlocker?.displayName ?? messages.narrowerPause
|
|
1853
1686
|
) })
|
|
1854
1687
|
]
|
|
@@ -1869,26 +1702,26 @@ function RestoredResourceChips({
|
|
|
1869
1702
|
messages,
|
|
1870
1703
|
onRemove
|
|
1871
1704
|
}) {
|
|
1872
|
-
return /* @__PURE__ */
|
|
1705
|
+
return /* @__PURE__ */ jsx3(
|
|
1873
1706
|
"div",
|
|
1874
1707
|
{
|
|
1875
1708
|
className: "flex flex-wrap gap-1.5 border-b border-og-border px-3 py-2",
|
|
1876
1709
|
"aria-label": messages.restoredResourcesLabel,
|
|
1877
|
-
children: resources.map((resource, index) => /* @__PURE__ */
|
|
1710
|
+
children: resources.map((resource, index) => /* @__PURE__ */ jsxs3(
|
|
1878
1711
|
"span",
|
|
1879
1712
|
{
|
|
1880
1713
|
className: "inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-og-md border border-og-border bg-og-surface-2 px-2 py-1 text-og-xs text-og-fg-muted",
|
|
1881
1714
|
children: [
|
|
1882
|
-
/* @__PURE__ */
|
|
1883
|
-
/* @__PURE__ */
|
|
1884
|
-
/* @__PURE__ */
|
|
1715
|
+
/* @__PURE__ */ jsx3(FileIcon, { className: "size-3 shrink-0" }),
|
|
1716
|
+
/* @__PURE__ */ jsx3("span", { className: "truncate", children: resource.kind === "file" ? messages.restoredFile(resource.fileId) : resource.uri }),
|
|
1717
|
+
/* @__PURE__ */ jsx3(
|
|
1885
1718
|
"button",
|
|
1886
1719
|
{
|
|
1887
1720
|
type: "button",
|
|
1888
1721
|
className: "shrink-0 hover:text-og-fg",
|
|
1889
1722
|
onClick: () => onRemove(index),
|
|
1890
1723
|
"aria-label": messages.removeRestoredResource(index),
|
|
1891
|
-
children: /* @__PURE__ */
|
|
1724
|
+
children: /* @__PURE__ */ jsx3(XIcon, { className: "size-3" })
|
|
1892
1725
|
}
|
|
1893
1726
|
)
|
|
1894
1727
|
]
|
|
@@ -1907,12 +1740,12 @@ function ConfirmBar({
|
|
|
1907
1740
|
}) {
|
|
1908
1741
|
const confirmRef = useRef2(null);
|
|
1909
1742
|
const descriptionId = useId2();
|
|
1910
|
-
|
|
1743
|
+
useEffect(() => {
|
|
1911
1744
|
const returnTo = returnFocusRef?.current ?? null;
|
|
1912
1745
|
confirmRef.current?.focus();
|
|
1913
1746
|
return () => returnTo?.focus();
|
|
1914
1747
|
}, [returnFocusRef]);
|
|
1915
|
-
return /* @__PURE__ */
|
|
1748
|
+
return /* @__PURE__ */ jsxs3(
|
|
1916
1749
|
"div",
|
|
1917
1750
|
{
|
|
1918
1751
|
role: "alertdialog",
|
|
@@ -1928,9 +1761,9 @@ function ConfirmBar({
|
|
|
1928
1761
|
},
|
|
1929
1762
|
className: "flex items-end justify-between gap-2 px-2.5 pb-2.5 pt-1",
|
|
1930
1763
|
children: [
|
|
1931
|
-
/* @__PURE__ */
|
|
1932
|
-
/* @__PURE__ */
|
|
1933
|
-
/* @__PURE__ */
|
|
1764
|
+
/* @__PURE__ */ jsx3("span", { id: descriptionId, className: "min-w-0 flex-1 px-1.5 text-og-sm text-og-status-failed", children: messages.confirmDescription(command) }),
|
|
1765
|
+
/* @__PURE__ */ jsxs3("span", { className: "flex shrink-0 items-center gap-1.5", children: [
|
|
1766
|
+
/* @__PURE__ */ jsx3(
|
|
1934
1767
|
"button",
|
|
1935
1768
|
{
|
|
1936
1769
|
type: "button",
|
|
@@ -1939,7 +1772,7 @@ function ConfirmBar({
|
|
|
1939
1772
|
children: messages.cancel
|
|
1940
1773
|
}
|
|
1941
1774
|
),
|
|
1942
|
-
/* @__PURE__ */
|
|
1775
|
+
/* @__PURE__ */ jsx3(
|
|
1943
1776
|
"button",
|
|
1944
1777
|
{
|
|
1945
1778
|
ref: confirmRef,
|
|
@@ -1964,9 +1797,9 @@ function AttachmentChips({
|
|
|
1964
1797
|
}) {
|
|
1965
1798
|
const lightbox = useLightboxOptional();
|
|
1966
1799
|
const previewRequest = useRef2(null);
|
|
1967
|
-
const [previewLoadingId, setPreviewLoadingId] =
|
|
1968
|
-
const [previewErrorId, setPreviewErrorId] =
|
|
1969
|
-
|
|
1800
|
+
const [previewLoadingId, setPreviewLoadingId] = useState2(null);
|
|
1801
|
+
const [previewErrorId, setPreviewErrorId] = useState2(null);
|
|
1802
|
+
useEffect(() => () => previewRequest.current?.abort(), [onLoadPreview]);
|
|
1970
1803
|
async function openPreview(attachment, source, canLoadPreview) {
|
|
1971
1804
|
previewRequest.current?.abort();
|
|
1972
1805
|
const attachmentId = attachment.id;
|
|
@@ -2006,7 +1839,7 @@ function AttachmentChips({
|
|
|
2006
1839
|
releaseSource
|
|
2007
1840
|
);
|
|
2008
1841
|
}
|
|
2009
|
-
return /* @__PURE__ */
|
|
1842
|
+
return /* @__PURE__ */ jsx3("div", { className: "flex flex-wrap gap-2 px-3 py-2", children: attachments.map((attachment) => {
|
|
2010
1843
|
const failed = attachment.status === "failed";
|
|
2011
1844
|
const secureContextRequired = attachment.errorCode === "secure_context_required";
|
|
2012
1845
|
const previewFailed = previewErrorId === attachment.id;
|
|
@@ -2015,7 +1848,7 @@ function AttachmentChips({
|
|
|
2015
1848
|
lightbox && onLoadPreview && attachment.status === "ready" && attachment.file && attachment.contentType.startsWith("image/")
|
|
2016
1849
|
);
|
|
2017
1850
|
const statusText = previewFailed ? messages.previewUnavailable ?? "Preview unavailable" : attachment.status === "uploading" ? messages.uploading : failed ? attachment.error || messages.uploadFailed : messages.formatBytes(attachment.sizeBytes);
|
|
2018
|
-
return /* @__PURE__ */
|
|
1851
|
+
return /* @__PURE__ */ jsxs3(
|
|
2019
1852
|
"div",
|
|
2020
1853
|
{
|
|
2021
1854
|
className: cn(
|
|
@@ -2026,7 +1859,7 @@ function AttachmentChips({
|
|
|
2026
1859
|
) : "max-w-[240px] border-og-border bg-og-surface-2"
|
|
2027
1860
|
),
|
|
2028
1861
|
children: [
|
|
2029
|
-
lightbox && (attachment.previewUrl || canLoadPreview) ? /* @__PURE__ */
|
|
1862
|
+
lightbox && (attachment.previewUrl || canLoadPreview) ? /* @__PURE__ */ jsx3(
|
|
2030
1863
|
"button",
|
|
2031
1864
|
{
|
|
2032
1865
|
type: "button",
|
|
@@ -2038,46 +1871,46 @@ function AttachmentChips({
|
|
|
2038
1871
|
"aria-busy": previewLoading || void 0,
|
|
2039
1872
|
disabled: previewLoading,
|
|
2040
1873
|
onClick: (event) => void openPreview(attachment, event.currentTarget, canLoadPreview),
|
|
2041
|
-
children: attachment.previewUrl ? /* @__PURE__ */
|
|
1874
|
+
children: attachment.previewUrl ? /* @__PURE__ */ jsx3(
|
|
2042
1875
|
"img",
|
|
2043
1876
|
{
|
|
2044
1877
|
src: attachment.previewUrl,
|
|
2045
1878
|
alt: "",
|
|
2046
1879
|
className: "h-full w-full object-cover transition-opacity hover:opacity-80"
|
|
2047
1880
|
}
|
|
2048
|
-
) : previewLoading ? /* @__PURE__ */
|
|
1881
|
+
) : previewLoading ? /* @__PURE__ */ jsx3(LoaderCircleIcon, { className: "size-4 animate-og-spin text-og-fg-muted" }) : /* @__PURE__ */ jsx3(ImageIcon, { className: "size-4 text-og-fg-muted" })
|
|
2049
1882
|
}
|
|
2050
|
-
) : attachment.previewUrl ? /* @__PURE__ */
|
|
1883
|
+
) : attachment.previewUrl ? /* @__PURE__ */ jsx3(
|
|
2051
1884
|
"img",
|
|
2052
1885
|
{
|
|
2053
1886
|
src: attachment.previewUrl,
|
|
2054
1887
|
alt: "",
|
|
2055
1888
|
className: "size-8 shrink-0 rounded object-cover"
|
|
2056
1889
|
}
|
|
2057
|
-
) : attachment.contentType.startsWith("image/") ? /* @__PURE__ */
|
|
2058
|
-
/* @__PURE__ */
|
|
2059
|
-
/* @__PURE__ */
|
|
2060
|
-
secureContextRequired ? /* @__PURE__ */
|
|
1890
|
+
) : attachment.contentType.startsWith("image/") ? /* @__PURE__ */ jsx3(ImageIcon, { className: "size-4 shrink-0 text-og-fg-muted" }) : /* @__PURE__ */ jsx3(FileIcon, { className: "size-4 shrink-0 text-og-fg-muted" }),
|
|
1891
|
+
/* @__PURE__ */ jsxs3("div", { className: "min-w-0 flex-1", children: [
|
|
1892
|
+
/* @__PURE__ */ jsx3("div", { className: "truncate font-medium text-og-fg", children: attachment.name }),
|
|
1893
|
+
secureContextRequired ? /* @__PURE__ */ jsx3("div", { className: "break-words text-og-xs leading-4 text-og-status-failed", children: statusText }) : failed || previewFailed ? /* @__PURE__ */ jsx3(ComposerTip, { tip: statusText, children: /* @__PURE__ */ jsx3("div", { className: "truncate text-og-xs text-og-status-failed", children: statusText }) }) : /* @__PURE__ */ jsx3("div", { className: "truncate text-og-xs text-og-fg-subtle", children: statusText })
|
|
2061
1894
|
] }),
|
|
2062
|
-
attachment.status === "uploading" ? /* @__PURE__ */
|
|
2063
|
-
failed && !secureContextRequired && onRetry ? /* @__PURE__ */
|
|
1895
|
+
attachment.status === "uploading" ? /* @__PURE__ */ jsx3(LoaderCircleIcon, { className: "size-3.5 shrink-0 animate-og-spin" }) : null,
|
|
1896
|
+
failed && !secureContextRequired && onRetry ? /* @__PURE__ */ jsx3(ComposerTip, { tip: messages.retryUpload, children: /* @__PURE__ */ jsx3(
|
|
2064
1897
|
"button",
|
|
2065
1898
|
{
|
|
2066
1899
|
type: "button",
|
|
2067
1900
|
onClick: () => onRetry(attachment.id),
|
|
2068
1901
|
className: "shrink-0 rounded-og-xs p-1 text-og-fg-muted hover:bg-og-surface-1 hover:text-og-fg pointer-coarse:size-10",
|
|
2069
1902
|
"aria-label": messages.retryAttachment(attachment.name),
|
|
2070
|
-
children: /* @__PURE__ */
|
|
1903
|
+
children: /* @__PURE__ */ jsx3(RotateCwIcon, { className: "size-3.5" })
|
|
2071
1904
|
}
|
|
2072
1905
|
) }) : null,
|
|
2073
|
-
/* @__PURE__ */
|
|
1906
|
+
/* @__PURE__ */ jsx3(
|
|
2074
1907
|
"button",
|
|
2075
1908
|
{
|
|
2076
1909
|
type: "button",
|
|
2077
1910
|
onClick: () => onRemove(attachment.id),
|
|
2078
1911
|
className: "shrink-0 rounded-og-xs p-1 text-og-fg-muted hover:bg-og-surface-1 hover:text-og-fg pointer-coarse:size-10",
|
|
2079
1912
|
"aria-label": messages.removeAttachment(attachment.name),
|
|
2080
|
-
children: /* @__PURE__ */
|
|
1913
|
+
children: /* @__PURE__ */ jsx3(XIcon, { className: "size-3.5" })
|
|
2081
1914
|
}
|
|
2082
1915
|
)
|
|
2083
1916
|
]
|
|
@@ -2091,17 +1924,17 @@ function HelpPanel({
|
|
|
2091
1924
|
messages,
|
|
2092
1925
|
onClose
|
|
2093
1926
|
}) {
|
|
2094
|
-
return /* @__PURE__ */
|
|
2095
|
-
|
|
1927
|
+
return /* @__PURE__ */ jsxs3(
|
|
1928
|
+
motion2.div,
|
|
2096
1929
|
{
|
|
2097
1930
|
initial: { opacity: 0, height: 0 },
|
|
2098
1931
|
animate: { opacity: 1, height: "auto" },
|
|
2099
1932
|
exit: { opacity: 0, height: 0 },
|
|
2100
1933
|
className: "mt-2 overflow-hidden rounded-og-lg border border-og-border bg-og-surface-2",
|
|
2101
1934
|
children: [
|
|
2102
|
-
/* @__PURE__ */
|
|
2103
|
-
/* @__PURE__ */
|
|
2104
|
-
/* @__PURE__ */
|
|
1935
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between border-b border-og-border px-3 py-1.5", children: [
|
|
1936
|
+
/* @__PURE__ */ jsx3("span", { className: "text-og-sm font-medium text-og-fg", children: messages.commands }),
|
|
1937
|
+
/* @__PURE__ */ jsx3(
|
|
2105
1938
|
"button",
|
|
2106
1939
|
{
|
|
2107
1940
|
type: "button",
|
|
@@ -2111,16 +1944,16 @@ function HelpPanel({
|
|
|
2111
1944
|
}
|
|
2112
1945
|
)
|
|
2113
1946
|
] }),
|
|
2114
|
-
/* @__PURE__ */
|
|
1947
|
+
/* @__PURE__ */ jsx3("ul", { className: "py-1", children: commands.map((command) => {
|
|
2115
1948
|
const hint = argHint(command.args);
|
|
2116
|
-
return /* @__PURE__ */
|
|
2117
|
-
/* @__PURE__ */
|
|
1949
|
+
return /* @__PURE__ */ jsxs3("li", { className: "flex items-baseline gap-2 px-3 py-1", children: [
|
|
1950
|
+
/* @__PURE__ */ jsxs3("span", { className: "font-mono text-og-sm text-og-accent", children: [
|
|
2118
1951
|
"/",
|
|
2119
1952
|
command.name,
|
|
2120
|
-
hint ? /* @__PURE__ */
|
|
1953
|
+
hint ? /* @__PURE__ */ jsx3("span", { className: "ml-1 text-og-fg-subtle", children: hint }) : null
|
|
2121
1954
|
] }),
|
|
2122
|
-
/* @__PURE__ */
|
|
2123
|
-
command.danger ? /* @__PURE__ */
|
|
1955
|
+
/* @__PURE__ */ jsx3("span", { className: "text-og-sm text-og-fg-muted", children: command.description }),
|
|
1956
|
+
command.danger ? /* @__PURE__ */ jsx3("span", { className: "ml-auto rounded-og-xs bg-og-status-failed/15 px-1 text-og-xs uppercase tracking-wide text-og-status-failed", children: messages.danger }) : null
|
|
2124
1957
|
] }, command.name);
|
|
2125
1958
|
}) })
|
|
2126
1959
|
]
|
|
@@ -2478,7 +2311,7 @@ import {
|
|
|
2478
2311
|
authorizeTranscriptionAdapter,
|
|
2479
2312
|
createTranscriptionSessionRequest
|
|
2480
2313
|
} from "@opengeni/sdk";
|
|
2481
|
-
import { useCallback as
|
|
2314
|
+
import { useCallback as useCallback3, useEffect as useEffect2, useMemo as useMemo4, useRef as useRef3, useState as useState3 } from "react";
|
|
2482
2315
|
var INITIAL_TRANSCRIPTION_CONTROL_STATE = {
|
|
2483
2316
|
status: "idle",
|
|
2484
2317
|
generation: 0,
|
|
@@ -2640,7 +2473,7 @@ function useTranscription({
|
|
|
2640
2473
|
lifecycleTimeouts,
|
|
2641
2474
|
onDiagnostic
|
|
2642
2475
|
}) {
|
|
2643
|
-
const [state, setState] =
|
|
2476
|
+
const [state, setState] = useState3(INITIAL_TRANSCRIPTION_CONTROL_STATE);
|
|
2644
2477
|
const stateRef = useRef3(state);
|
|
2645
2478
|
const valueRef = useRef3(value);
|
|
2646
2479
|
const sessionRef = useRef3(null);
|
|
@@ -2655,7 +2488,7 @@ function useTranscription({
|
|
|
2655
2488
|
lifecycleTimeouts?.cleanupMs,
|
|
2656
2489
|
DEFAULT_TRANSCRIPTION_LIFECYCLE_TIMEOUTS.cleanupMs
|
|
2657
2490
|
);
|
|
2658
|
-
const reportDiagnostic =
|
|
2491
|
+
const reportDiagnostic = useCallback3(
|
|
2659
2492
|
(diagnostic) => {
|
|
2660
2493
|
if (!onDiagnostic) return;
|
|
2661
2494
|
try {
|
|
@@ -2666,19 +2499,19 @@ function useTranscription({
|
|
|
2666
2499
|
[onDiagnostic]
|
|
2667
2500
|
);
|
|
2668
2501
|
const cleanupRuntimeRef = useRef3({ cleanupTimeoutMs, reportDiagnostic });
|
|
2669
|
-
|
|
2502
|
+
useEffect2(() => {
|
|
2670
2503
|
cleanupRuntimeRef.current = { cleanupTimeoutMs, reportDiagnostic };
|
|
2671
2504
|
}, [cleanupTimeoutMs, reportDiagnostic]);
|
|
2672
|
-
const policyRevision =
|
|
2505
|
+
const policyRevision = useMemo4(
|
|
2673
2506
|
() => transcriptionPolicyRevision(policy, selection),
|
|
2674
2507
|
[policy, selection]
|
|
2675
2508
|
);
|
|
2676
|
-
const authorization =
|
|
2509
|
+
const authorization = useMemo4(
|
|
2677
2510
|
() => adapter ? authorizeTranscriptionAdapter(policy, adapter.descriptor, selection) : null,
|
|
2678
2511
|
[adapter, policy, selection]
|
|
2679
2512
|
);
|
|
2680
2513
|
const unavailableReason = disabled ? "composer_disabled" : !policy.enabled ? "disabled" : !policy.acceptanceId ? "unaccepted" : !policy.primary ? "target_missing" : !adapter ? "adapter_missing" : authorization?.authorized ? null : authorization?.reason ?? "unaccepted";
|
|
2681
|
-
const apply =
|
|
2514
|
+
const apply = useCallback3(
|
|
2682
2515
|
(action) => {
|
|
2683
2516
|
const transition = transitionTranscriptionControl(stateRef.current, action);
|
|
2684
2517
|
if (transition.state !== stateRef.current) {
|
|
@@ -2695,7 +2528,7 @@ function useTranscription({
|
|
|
2695
2528
|
},
|
|
2696
2529
|
[focusInput, setValue]
|
|
2697
2530
|
);
|
|
2698
|
-
const releaseTerminalSession =
|
|
2531
|
+
const releaseTerminalSession = useCallback3(
|
|
2699
2532
|
(generation) => {
|
|
2700
2533
|
const active = sessionRef.current;
|
|
2701
2534
|
if (!active || active.generation !== generation) return;
|
|
@@ -2708,7 +2541,7 @@ function useTranscription({
|
|
|
2708
2541
|
},
|
|
2709
2542
|
[cleanupTimeoutMs, reportDiagnostic]
|
|
2710
2543
|
);
|
|
2711
|
-
const start =
|
|
2544
|
+
const start = useCallback3(async () => {
|
|
2712
2545
|
if (!adapter || unavailableReason !== null || isActiveTranscriptionStatus(stateRef.current.status)) {
|
|
2713
2546
|
return false;
|
|
2714
2547
|
}
|
|
@@ -2842,7 +2675,7 @@ function useTranscription({
|
|
|
2842
2675
|
startTimeoutMs,
|
|
2843
2676
|
unavailableReason
|
|
2844
2677
|
]);
|
|
2845
|
-
const cancel =
|
|
2678
|
+
const cancel = useCallback3(async () => {
|
|
2846
2679
|
const current = stateRef.current;
|
|
2847
2680
|
if (!isActiveTranscriptionStatus(current.status)) return false;
|
|
2848
2681
|
const generation = current.generation;
|
|
@@ -2866,8 +2699,8 @@ function useTranscription({
|
|
|
2866
2699
|
}
|
|
2867
2700
|
return true;
|
|
2868
2701
|
}, [apply, cleanupTimeoutMs, focusInput, reportDiagnostic]);
|
|
2869
|
-
const reset =
|
|
2870
|
-
|
|
2702
|
+
const reset = useCallback3(() => apply({ type: "reset" }), [apply]);
|
|
2703
|
+
useEffect2(() => {
|
|
2871
2704
|
if (!isActiveTranscriptionStatus(state.status)) return;
|
|
2872
2705
|
const onKeyDown = (event) => {
|
|
2873
2706
|
if (event.key !== "Escape") return;
|
|
@@ -2877,7 +2710,7 @@ function useTranscription({
|
|
|
2877
2710
|
document.addEventListener("keydown", onKeyDown);
|
|
2878
2711
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
2879
2712
|
}, [cancel, state.status]);
|
|
2880
|
-
|
|
2713
|
+
useEffect2(() => {
|
|
2881
2714
|
if (!isActiveTranscriptionStatus(state.status)) return;
|
|
2882
2715
|
const activePolicy = activePolicyRef.current;
|
|
2883
2716
|
if (unavailableReason === null && activePolicy?.generation === state.generation && activePolicy.revision === policyRevision) {
|
|
@@ -2885,7 +2718,7 @@ function useTranscription({
|
|
|
2885
2718
|
}
|
|
2886
2719
|
void cancel();
|
|
2887
2720
|
}, [cancel, policyRevision, state.generation, state.status, unavailableReason]);
|
|
2888
|
-
|
|
2721
|
+
useEffect2(
|
|
2889
2722
|
() => () => {
|
|
2890
2723
|
const pending = pendingStartRef.current;
|
|
2891
2724
|
pendingStartRef.current = null;
|
|
@@ -3039,7 +2872,7 @@ function transcriptionPolicyRevision(policy, selection) {
|
|
|
3039
2872
|
|
|
3040
2873
|
// src/hooks/use-voice-input.ts
|
|
3041
2874
|
import { OpenGeniApiError } from "@opengeni/sdk";
|
|
3042
|
-
import { useCallback as
|
|
2875
|
+
import { useCallback as useCallback4, useEffect as useEffect3, useRef as useRef4, useState as useState4 } from "react";
|
|
3043
2876
|
|
|
3044
2877
|
// src/voice-recording-owner.ts
|
|
3045
2878
|
var VOICE_RECORDING_OWNER_SESSION_KEY = "opengeni.voice-recording-owner.v1";
|
|
@@ -3263,20 +3096,20 @@ function useVoiceInput({
|
|
|
3263
3096
|
now = currentDate,
|
|
3264
3097
|
automaticRetryDelayMilliseconds
|
|
3265
3098
|
}) {
|
|
3266
|
-
const [status, setStatus] =
|
|
3267
|
-
const [error, setError] =
|
|
3268
|
-
const [stream, setStream] =
|
|
3269
|
-
const [recordingId, setRecordingId] =
|
|
3270
|
-
const [durationSeconds, setDurationSeconds] =
|
|
3271
|
-
const [locallySaved, setLocallySaved] =
|
|
3272
|
-
const [storageAvailable, setStorageAvailable] =
|
|
3099
|
+
const [status, setStatus] = useState4("idle");
|
|
3100
|
+
const [error, setError] = useState4(null);
|
|
3101
|
+
const [stream, setStream] = useState4(null);
|
|
3102
|
+
const [recordingId, setRecordingId] = useState4(null);
|
|
3103
|
+
const [durationSeconds, setDurationSeconds] = useState4(0);
|
|
3104
|
+
const [locallySaved, setLocallySaved] = useState4(false);
|
|
3105
|
+
const [storageAvailable, setStorageAvailable] = useState4(
|
|
3273
3106
|
() => Boolean(createRecordingStore) || typeof globalThis.indexedDB !== "undefined"
|
|
3274
3107
|
);
|
|
3275
3108
|
const createRecordingStoreRef = useRef4(createRecordingStore);
|
|
3276
3109
|
createRecordingStoreRef.current = createRecordingStore;
|
|
3277
3110
|
const nowRef = useRef4(now);
|
|
3278
3111
|
nowRef.current = now;
|
|
3279
|
-
const readNow =
|
|
3112
|
+
const readNow = useCallback4(() => nowRef.current(), []);
|
|
3280
3113
|
const generationRef = useRef4(0);
|
|
3281
3114
|
const workspaceIdRef = useRef4(workspaceId);
|
|
3282
3115
|
const ownerIdRef = useRef4(null);
|
|
@@ -3304,7 +3137,7 @@ function useVoiceInput({
|
|
|
3304
3137
|
valueRef.current = value;
|
|
3305
3138
|
statusRef.current = status;
|
|
3306
3139
|
workspaceIdRef.current = workspaceId;
|
|
3307
|
-
const ensureOwnerId =
|
|
3140
|
+
const ensureOwnerId = useCallback4(async () => {
|
|
3308
3141
|
if (ownerIdRef.current) return ownerIdRef.current;
|
|
3309
3142
|
ownerIdPromiseRef.current ??= (async () => {
|
|
3310
3143
|
const injectedOwnerId = createOwnerIdRef.current?.();
|
|
@@ -3319,11 +3152,11 @@ function useVoiceInput({
|
|
|
3319
3152
|
})();
|
|
3320
3153
|
return await ownerIdPromiseRef.current;
|
|
3321
3154
|
}, []);
|
|
3322
|
-
const stopOwnerHeartbeat =
|
|
3155
|
+
const stopOwnerHeartbeat = useCallback4(() => {
|
|
3323
3156
|
if (ownerHeartbeatTimerRef.current) clearInterval(ownerHeartbeatTimerRef.current);
|
|
3324
3157
|
ownerHeartbeatTimerRef.current = null;
|
|
3325
3158
|
}, []);
|
|
3326
|
-
const clearCaptureRuntime =
|
|
3159
|
+
const clearCaptureRuntime = useCallback4((expectedStream) => {
|
|
3327
3160
|
const captureStream = expectedStream ?? streamRef.current;
|
|
3328
3161
|
captureStream?.getTracks().forEach((track) => track.stop());
|
|
3329
3162
|
if (expectedStream && streamRef.current !== expectedStream) return;
|
|
@@ -3333,7 +3166,7 @@ function useVoiceInput({
|
|
|
3333
3166
|
recorderRef.current = null;
|
|
3334
3167
|
setStream(null);
|
|
3335
3168
|
}, []);
|
|
3336
|
-
const clearVisibleRecording =
|
|
3169
|
+
const clearVisibleRecording = useCallback4(() => {
|
|
3337
3170
|
stopOwnerHeartbeat();
|
|
3338
3171
|
manifestRef.current = null;
|
|
3339
3172
|
setRecordingId(null);
|
|
@@ -3341,7 +3174,7 @@ function useVoiceInput({
|
|
|
3341
3174
|
setLocallySaved(false);
|
|
3342
3175
|
automaticRetryAttemptRef.current = 0;
|
|
3343
3176
|
}, [stopOwnerHeartbeat]);
|
|
3344
|
-
const ensureStore =
|
|
3177
|
+
const ensureStore = useCallback4(async () => {
|
|
3345
3178
|
if (storeRef.current) return storeRef.current;
|
|
3346
3179
|
if (!storePromiseRef.current) {
|
|
3347
3180
|
storePromiseRef.current = Promise.resolve().then(() => {
|
|
@@ -3361,13 +3194,13 @@ function useVoiceInput({
|
|
|
3361
3194
|
throw reason;
|
|
3362
3195
|
}
|
|
3363
3196
|
}, []);
|
|
3364
|
-
const rememberManifest =
|
|
3197
|
+
const rememberManifest = useCallback4((manifest) => {
|
|
3365
3198
|
manifestRef.current = manifest;
|
|
3366
3199
|
setRecordingId(manifest.recordingId);
|
|
3367
3200
|
setDurationSeconds(manifest.totalDurationMilliseconds / 1e3);
|
|
3368
3201
|
setLocallySaved(manifest.chunkCount > 0);
|
|
3369
3202
|
}, []);
|
|
3370
|
-
const beginOwnerHeartbeat =
|
|
3203
|
+
const beginOwnerHeartbeat = useCallback4(
|
|
3371
3204
|
(manifest) => {
|
|
3372
3205
|
stopOwnerHeartbeat();
|
|
3373
3206
|
ownerHeartbeatTimerRef.current = setInterval(() => {
|
|
@@ -3392,7 +3225,7 @@ function useVoiceInput({
|
|
|
3392
3225
|
},
|
|
3393
3226
|
[ensureStore, readNow, stopOwnerHeartbeat]
|
|
3394
3227
|
);
|
|
3395
|
-
const preserveForRetry =
|
|
3228
|
+
const preserveForRetry = useCallback4(
|
|
3396
3229
|
async (manifest, code, generation) => {
|
|
3397
3230
|
if (generation !== generationRef.current) return;
|
|
3398
3231
|
rememberManifest(manifest);
|
|
@@ -3403,7 +3236,7 @@ function useVoiceInput({
|
|
|
3403
3236
|
},
|
|
3404
3237
|
[focusInput, rememberManifest]
|
|
3405
3238
|
);
|
|
3406
|
-
const updateManifestBestEffort =
|
|
3239
|
+
const updateManifestBestEffort = useCallback4(
|
|
3407
3240
|
async (manifest, update) => {
|
|
3408
3241
|
try {
|
|
3409
3242
|
return await (await ensureStore()).updateManifest(
|
|
@@ -3418,7 +3251,7 @@ function useVoiceInput({
|
|
|
3418
3251
|
},
|
|
3419
3252
|
[ensureStore, readNow]
|
|
3420
3253
|
);
|
|
3421
|
-
const loadNextRecoverable =
|
|
3254
|
+
const loadNextRecoverable = useCallback4(
|
|
3422
3255
|
async (generation) => {
|
|
3423
3256
|
const active = () => generation === generationRef.current && workspaceIdRef.current === workspaceId;
|
|
3424
3257
|
const [store, ownerId] = await Promise.all([ensureStore(), ensureOwnerId()]);
|
|
@@ -3470,7 +3303,7 @@ function useVoiceInput({
|
|
|
3470
3303
|
},
|
|
3471
3304
|
[beginOwnerHeartbeat, ensureOwnerId, ensureStore, readNow, rememberManifest, workspaceId]
|
|
3472
3305
|
);
|
|
3473
|
-
const finalizePersistedRecording =
|
|
3306
|
+
const finalizePersistedRecording = useCallback4(
|
|
3474
3307
|
async (generation) => {
|
|
3475
3308
|
const manifest = manifestRef.current;
|
|
3476
3309
|
const resumable = capability?.resumable && isResumableVoiceInputClient(client) ? capability.resumable : null;
|
|
@@ -3627,7 +3460,7 @@ function useVoiceInput({
|
|
|
3627
3460
|
const finalizePersistedRecordingRef = useRef4(finalizePersistedRecording);
|
|
3628
3461
|
finalizePersistedRecordingRef.current = finalizePersistedRecording;
|
|
3629
3462
|
const clientAvailable = client !== null && client !== void 0;
|
|
3630
|
-
|
|
3463
|
+
useEffect3(() => {
|
|
3631
3464
|
if (status !== "retrying" || !manifestRef.current || manifestRef.current.recoveryMode !== "automatic" || manifestRef.current.workspaceId !== workspaceId || !clientAvailable || disabled || !enabled) {
|
|
3632
3465
|
return;
|
|
3633
3466
|
}
|
|
@@ -3662,7 +3495,7 @@ function useVoiceInput({
|
|
|
3662
3495
|
automaticRetryTimerRef.current = null;
|
|
3663
3496
|
};
|
|
3664
3497
|
}, [automaticRetryDelayMilliseconds, clientAvailable, disabled, enabled, status, workspaceId]);
|
|
3665
|
-
const stop =
|
|
3498
|
+
const stop = useCallback4(() => {
|
|
3666
3499
|
const recorder = recorderRef.current;
|
|
3667
3500
|
if (!recorder || recorder.state === "inactive") return;
|
|
3668
3501
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
@@ -3670,7 +3503,7 @@ function useVoiceInput({
|
|
|
3670
3503
|
setStatus("saving");
|
|
3671
3504
|
recorder.stop();
|
|
3672
3505
|
}, []);
|
|
3673
|
-
const start =
|
|
3506
|
+
const start = useCallback4(async () => {
|
|
3674
3507
|
if (disabled || !client || !enabled || !capability?.available || manifestRef.current !== null || status === "requesting-permission" || status === "recording" || status === "saving" || status === "transcribing" || status === "retrying" || !navigator.mediaDevices?.getUserMedia || typeof MediaRecorder === "undefined") {
|
|
3675
3508
|
return false;
|
|
3676
3509
|
}
|
|
@@ -3895,7 +3728,7 @@ function useVoiceInput({
|
|
|
3895
3728
|
updateManifestBestEffort,
|
|
3896
3729
|
workspaceId
|
|
3897
3730
|
]);
|
|
3898
|
-
const retry =
|
|
3731
|
+
const retry = useCallback4(() => {
|
|
3899
3732
|
if (!manifestRef.current || manifestRef.current.finalizationState === "transcript-ready" || manifestRef.current.workspaceId !== workspaceId || !client || disabled || !enabled || status === "saving" || status === "transcribing") {
|
|
3900
3733
|
return;
|
|
3901
3734
|
}
|
|
@@ -3924,7 +3757,7 @@ function useVoiceInput({
|
|
|
3924
3757
|
updateManifestBestEffort,
|
|
3925
3758
|
workspaceId
|
|
3926
3759
|
]);
|
|
3927
|
-
const insertSavedTranscript =
|
|
3760
|
+
const insertSavedTranscript = useCallback4(async () => {
|
|
3928
3761
|
const manifest = manifestRef.current;
|
|
3929
3762
|
if (!manifest || manifest.workspaceId !== workspaceId || manifest.finalizationState !== "transcript-ready" || manifest.transcriptText === null) {
|
|
3930
3763
|
return;
|
|
@@ -3979,7 +3812,7 @@ function useVoiceInput({
|
|
|
3979
3812
|
setValue,
|
|
3980
3813
|
workspaceId
|
|
3981
3814
|
]);
|
|
3982
|
-
const discard =
|
|
3815
|
+
const discard = useCallback4(async () => {
|
|
3983
3816
|
const manifest = manifestRef.current;
|
|
3984
3817
|
const generation = ++generationRef.current;
|
|
3985
3818
|
controllerRef.current?.abort();
|
|
@@ -4027,7 +3860,7 @@ function useVoiceInput({
|
|
|
4027
3860
|
rememberManifest,
|
|
4028
3861
|
workspaceId
|
|
4029
3862
|
]);
|
|
4030
|
-
const cancel =
|
|
3863
|
+
const cancel = useCallback4(() => {
|
|
4031
3864
|
if (status === "recording" || status === "requesting-permission") {
|
|
4032
3865
|
void discard();
|
|
4033
3866
|
return;
|
|
@@ -4053,7 +3886,7 @@ function useVoiceInput({
|
|
|
4053
3886
|
});
|
|
4054
3887
|
}
|
|
4055
3888
|
}, [discard, preserveForRetry, status, updateManifestBestEffort]);
|
|
4056
|
-
|
|
3889
|
+
useEffect3(() => {
|
|
4057
3890
|
const current = manifestRef.current;
|
|
4058
3891
|
const generation = ++generationRef.current;
|
|
4059
3892
|
if (current && current.workspaceId !== workspaceId) {
|
|
@@ -4103,7 +3936,7 @@ function useVoiceInput({
|
|
|
4103
3936
|
readNow,
|
|
4104
3937
|
workspaceId
|
|
4105
3938
|
]);
|
|
4106
|
-
|
|
3939
|
+
useEffect3(() => {
|
|
4107
3940
|
const onKeyDown = (event) => {
|
|
4108
3941
|
if (event.key === "Escape" && (status === "requesting-permission" || status === "recording" || status === "saving" || status === "transcribing" || status === "retrying")) {
|
|
4109
3942
|
event.preventDefault();
|
|
@@ -4113,7 +3946,7 @@ function useVoiceInput({
|
|
|
4113
3946
|
document.addEventListener("keydown", onKeyDown);
|
|
4114
3947
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
4115
3948
|
}, [cancel, status]);
|
|
4116
|
-
|
|
3949
|
+
useEffect3(
|
|
4117
3950
|
() => () => {
|
|
4118
3951
|
generationRef.current += 1;
|
|
4119
3952
|
controllerRef.current?.abort();
|
|
@@ -4397,15 +4230,15 @@ import {
|
|
|
4397
4230
|
RefreshCwIcon,
|
|
4398
4231
|
SquareIcon,
|
|
4399
4232
|
Trash2Icon,
|
|
4400
|
-
XIcon as
|
|
4233
|
+
XIcon as XIcon2
|
|
4401
4234
|
} from "lucide-react";
|
|
4402
|
-
import { AnimatePresence as
|
|
4403
|
-
import { useEffect as
|
|
4404
|
-
import { Fragment as
|
|
4235
|
+
import { AnimatePresence as AnimatePresence3, motion as motion3 } from "motion/react";
|
|
4236
|
+
import { useEffect as useEffect4, useState as useState5 } from "react";
|
|
4237
|
+
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
4405
4238
|
function Tip({ tip, children }) {
|
|
4406
|
-
return /* @__PURE__ */
|
|
4407
|
-
/* @__PURE__ */
|
|
4408
|
-
/* @__PURE__ */
|
|
4239
|
+
return /* @__PURE__ */ jsxs4(Tooltip, { children: [
|
|
4240
|
+
/* @__PURE__ */ jsx4(TooltipTrigger, { asChild: true, children }),
|
|
4241
|
+
/* @__PURE__ */ jsx4(TooltipContent, { side: "top", children: tip })
|
|
4409
4242
|
] });
|
|
4410
4243
|
}
|
|
4411
4244
|
var defaultMessages = {
|
|
@@ -4469,7 +4302,7 @@ function ComposerTranscriptionControl({
|
|
|
4469
4302
|
const retrying = status === "retrying";
|
|
4470
4303
|
const capturing = status === "requesting-permission" || status === "recording";
|
|
4471
4304
|
const cancelTranscription = transcription.cancel;
|
|
4472
|
-
|
|
4305
|
+
useEffect4(() => {
|
|
4473
4306
|
if (!suppressed) return;
|
|
4474
4307
|
if (status === "recording" || status === "requesting-permission") {
|
|
4475
4308
|
cancelTranscription();
|
|
@@ -4489,8 +4322,8 @@ function ComposerTranscriptionControl({
|
|
|
4489
4322
|
}
|
|
4490
4323
|
void transcription.start();
|
|
4491
4324
|
}
|
|
4492
|
-
return /* @__PURE__ */
|
|
4493
|
-
|
|
4325
|
+
return /* @__PURE__ */ jsx4(AnimatePresence3, { initial: false, children: suppressed ? null : /* @__PURE__ */ jsx4(
|
|
4326
|
+
motion3.span,
|
|
4494
4327
|
{
|
|
4495
4328
|
initial: { opacity: 0, width: 0 },
|
|
4496
4329
|
animate: { opacity: 1, width: "auto" },
|
|
@@ -4505,9 +4338,9 @@ function ComposerTranscriptionControl({
|
|
|
4505
4338
|
),
|
|
4506
4339
|
"data-transcription-status": status,
|
|
4507
4340
|
"data-transcription-capturing": capturing ? "" : void 0,
|
|
4508
|
-
children: /* @__PURE__ */
|
|
4509
|
-
/* @__PURE__ */
|
|
4510
|
-
|
|
4341
|
+
children: /* @__PURE__ */ jsxs4("span", { className: "inline-flex min-w-0 items-center gap-1.5", children: [
|
|
4342
|
+
/* @__PURE__ */ jsx4(AnimatePresence3, { mode: "popLayout", initial: false, children: recoverable ? /* @__PURE__ */ jsxs4(
|
|
4343
|
+
motion3.span,
|
|
4511
4344
|
{
|
|
4512
4345
|
initial: { opacity: 0, scale: 0.96 },
|
|
4513
4346
|
animate: { opacity: 1, scale: 1 },
|
|
@@ -4518,12 +4351,12 @@ function ComposerTranscriptionControl({
|
|
|
4518
4351
|
"bg-og-surface-2/70 pl-2 pr-1 pointer-coarse:h-11"
|
|
4519
4352
|
),
|
|
4520
4353
|
children: [
|
|
4521
|
-
/* @__PURE__ */
|
|
4522
|
-
/* @__PURE__ */
|
|
4354
|
+
/* @__PURE__ */ jsx4("span", { className: "og-transcription-recovered-label max-w-44 truncate text-og-xs text-og-fg-muted max-sm:max-w-28", children: savedTranscript ? errorMessage3 ?? messages.recoveredTranscript : retrying ? messages.retrying : status === "error" ? errorMessage3 ?? messages.errorRetryable : messages.recovered }),
|
|
4355
|
+
/* @__PURE__ */ jsx4(
|
|
4523
4356
|
Tip,
|
|
4524
4357
|
{
|
|
4525
4358
|
tip: savedTranscript ? messages.insertRecoveredTranscript : retrying ? messages.pauseRetrying : messages.retry,
|
|
4526
|
-
children: /* @__PURE__ */
|
|
4359
|
+
children: /* @__PURE__ */ jsx4(
|
|
4527
4360
|
"button",
|
|
4528
4361
|
{
|
|
4529
4362
|
type: "button",
|
|
@@ -4534,12 +4367,12 @@ function ComposerTranscriptionControl({
|
|
|
4534
4367
|
"bg-og-fg text-og-bg transition-colors duration-150 motion-reduce:transition-none",
|
|
4535
4368
|
"hover:bg-og-fg-muted pointer-coarse:size-11"
|
|
4536
4369
|
),
|
|
4537
|
-
children: savedTranscript ? /* @__PURE__ */
|
|
4370
|
+
children: savedTranscript ? /* @__PURE__ */ jsx4(ClipboardPasteIcon, { className: "size-3.5" }) : retrying ? /* @__PURE__ */ jsx4(SquareIcon, { className: "size-3.5" }) : /* @__PURE__ */ jsx4(RefreshCwIcon, { className: "size-3.5" })
|
|
4538
4371
|
}
|
|
4539
4372
|
)
|
|
4540
4373
|
}
|
|
4541
4374
|
),
|
|
4542
|
-
/* @__PURE__ */
|
|
4375
|
+
/* @__PURE__ */ jsx4(Tip, { tip: messages.discardRecovered, children: /* @__PURE__ */ jsx4(
|
|
4543
4376
|
"button",
|
|
4544
4377
|
{
|
|
4545
4378
|
type: "button",
|
|
@@ -4550,14 +4383,14 @@ function ComposerTranscriptionControl({
|
|
|
4550
4383
|
"text-og-fg-muted transition-colors duration-150 motion-reduce:transition-none",
|
|
4551
4384
|
"hover:bg-og-surface-3 hover:text-og-status-failed pointer-coarse:size-11"
|
|
4552
4385
|
),
|
|
4553
|
-
children: /* @__PURE__ */
|
|
4386
|
+
children: /* @__PURE__ */ jsx4(Trash2Icon, { className: "size-3.5" })
|
|
4554
4387
|
}
|
|
4555
4388
|
) })
|
|
4556
4389
|
]
|
|
4557
4390
|
},
|
|
4558
4391
|
"recovered"
|
|
4559
|
-
) : active ? /* @__PURE__ */
|
|
4560
|
-
|
|
4392
|
+
) : active ? /* @__PURE__ */ jsxs4(
|
|
4393
|
+
motion3.span,
|
|
4561
4394
|
{
|
|
4562
4395
|
initial: { opacity: 0, scale: 0.96 },
|
|
4563
4396
|
animate: { opacity: 1, scale: 1 },
|
|
@@ -4568,21 +4401,21 @@ function ComposerTranscriptionControl({
|
|
|
4568
4401
|
"bg-og-surface-2/70 pl-2 pr-1 pointer-coarse:h-11"
|
|
4569
4402
|
),
|
|
4570
4403
|
children: [
|
|
4571
|
-
status === "requesting-permission" ? /* @__PURE__ */
|
|
4404
|
+
status === "requesting-permission" ? /* @__PURE__ */ jsx4(
|
|
4572
4405
|
LoaderCircleIcon2,
|
|
4573
4406
|
{
|
|
4574
4407
|
className: "size-3.5 shrink-0 text-og-fg-muted animate-og-spin motion-reduce:animate-none",
|
|
4575
4408
|
"aria-hidden": true
|
|
4576
4409
|
}
|
|
4577
|
-
) : /* @__PURE__ */
|
|
4578
|
-
status === "recording" ? /* @__PURE__ */
|
|
4410
|
+
) : /* @__PURE__ */ jsxs4("span", { className: "flex items-center gap-1.5", children: [
|
|
4411
|
+
status === "recording" ? /* @__PURE__ */ jsx4(
|
|
4579
4412
|
"span",
|
|
4580
4413
|
{
|
|
4581
4414
|
"aria-hidden": true,
|
|
4582
4415
|
className: "size-1.5 shrink-0 rounded-full bg-og-status-failed animate-og-pulse motion-reduce:animate-none"
|
|
4583
4416
|
}
|
|
4584
4417
|
) : null,
|
|
4585
|
-
/* @__PURE__ */
|
|
4418
|
+
/* @__PURE__ */ jsx4(
|
|
4586
4419
|
VoiceWaveform,
|
|
4587
4420
|
{
|
|
4588
4421
|
stream: status === "recording" ? transcription.stream : null,
|
|
@@ -4590,8 +4423,8 @@ function ComposerTranscriptionControl({
|
|
|
4590
4423
|
}
|
|
4591
4424
|
)
|
|
4592
4425
|
] }),
|
|
4593
|
-
status === "recording" ? /* @__PURE__ */
|
|
4594
|
-
/* @__PURE__ */
|
|
4426
|
+
status === "recording" ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
4427
|
+
/* @__PURE__ */ jsx4(Tip, { tip: messages.cancel, children: /* @__PURE__ */ jsx4(
|
|
4595
4428
|
"button",
|
|
4596
4429
|
{
|
|
4597
4430
|
type: "button",
|
|
@@ -4603,10 +4436,10 @@ function ComposerTranscriptionControl({
|
|
|
4603
4436
|
"text-og-fg-muted transition-colors duration-150 motion-reduce:transition-none",
|
|
4604
4437
|
"hover:bg-og-surface-3 hover:text-og-fg pointer-coarse:size-11"
|
|
4605
4438
|
),
|
|
4606
|
-
children: /* @__PURE__ */
|
|
4439
|
+
children: /* @__PURE__ */ jsx4(XIcon2, { className: "size-3.5" })
|
|
4607
4440
|
}
|
|
4608
4441
|
) }),
|
|
4609
|
-
/* @__PURE__ */
|
|
4442
|
+
/* @__PURE__ */ jsx4(Tip, { tip: messages.stop, children: /* @__PURE__ */ jsx4(
|
|
4610
4443
|
"button",
|
|
4611
4444
|
{
|
|
4612
4445
|
type: "button",
|
|
@@ -4617,15 +4450,15 @@ function ComposerTranscriptionControl({
|
|
|
4617
4450
|
"bg-og-fg text-og-bg transition-colors duration-150 motion-reduce:transition-none",
|
|
4618
4451
|
"hover:bg-og-fg-muted pointer-coarse:size-11"
|
|
4619
4452
|
),
|
|
4620
|
-
children: /* @__PURE__ */
|
|
4453
|
+
children: /* @__PURE__ */ jsx4(SquareIcon, { className: "size-2.5 fill-current" })
|
|
4621
4454
|
}
|
|
4622
4455
|
) })
|
|
4623
|
-
] }) : status === "transcribing" || status === "saving" ? /* @__PURE__ */
|
|
4456
|
+
] }) : status === "transcribing" || status === "saving" ? /* @__PURE__ */ jsx4("span", { className: "og-shimmer-text px-1.5 text-og-xs font-medium whitespace-nowrap", children: status === "saving" ? messages.saving : messages.transcribing }) : /* @__PURE__ */ jsx4("span", { className: "px-1.5 text-og-xs text-og-fg-muted whitespace-nowrap", children: messages.requestingPermission })
|
|
4624
4457
|
]
|
|
4625
4458
|
},
|
|
4626
4459
|
status === "transcribing" || status === "saving" ? "processing" : "capture"
|
|
4627
|
-
) : /* @__PURE__ */
|
|
4628
|
-
|
|
4460
|
+
) : /* @__PURE__ */ jsx4(Tip, { tip: idleLabel, children: /* @__PURE__ */ jsx4(
|
|
4461
|
+
motion3.button,
|
|
4629
4462
|
{
|
|
4630
4463
|
type: "button",
|
|
4631
4464
|
"data-og-composer-dictate": true,
|
|
@@ -4642,10 +4475,10 @@ function ComposerTranscriptionControl({
|
|
|
4642
4475
|
"text-og-fg-muted transition-colors duration-150 motion-reduce:transition-none",
|
|
4643
4476
|
unavailableMessage ? "cursor-not-allowed opacity-45" : "hover:bg-og-surface-2 hover:text-og-fg"
|
|
4644
4477
|
),
|
|
4645
|
-
children: /* @__PURE__ */
|
|
4478
|
+
children: /* @__PURE__ */ jsx4(MicIcon, { className: "size-4" })
|
|
4646
4479
|
}
|
|
4647
4480
|
) }, "idle") }),
|
|
4648
|
-
status === "error" && errorMessage3 && !recoverable ? /* @__PURE__ */
|
|
4481
|
+
status === "error" && errorMessage3 && !recoverable ? /* @__PURE__ */ jsx4(Tip, { tip: errorMessage3, children: /* @__PURE__ */ jsx4(
|
|
4649
4482
|
"span",
|
|
4650
4483
|
{
|
|
4651
4484
|
"aria-hidden": "true",
|
|
@@ -4653,7 +4486,7 @@ function ComposerTranscriptionControl({
|
|
|
4653
4486
|
children: errorMessage3
|
|
4654
4487
|
}
|
|
4655
4488
|
) }) : null,
|
|
4656
|
-
/* @__PURE__ */
|
|
4489
|
+
/* @__PURE__ */ jsx4(
|
|
4657
4490
|
"span",
|
|
4658
4491
|
{
|
|
4659
4492
|
className: "sr-only",
|
|
@@ -4671,9 +4504,9 @@ function VoiceWaveform({
|
|
|
4671
4504
|
stream,
|
|
4672
4505
|
mode
|
|
4673
4506
|
}) {
|
|
4674
|
-
const [levels, setLevels] =
|
|
4675
|
-
const [live, setLive] =
|
|
4676
|
-
|
|
4507
|
+
const [levels, setLevels] = useState5(() => restingLevels(WAVEFORM_BARS));
|
|
4508
|
+
const [live, setLive] = useState5(false);
|
|
4509
|
+
useEffect4(() => {
|
|
4677
4510
|
if (!stream || mode !== "recording") {
|
|
4678
4511
|
setLive(false);
|
|
4679
4512
|
setLevels(restingLevels(WAVEFORM_BARS));
|
|
@@ -4721,7 +4554,7 @@ function VoiceWaveform({
|
|
|
4721
4554
|
void context?.close();
|
|
4722
4555
|
};
|
|
4723
4556
|
}, [stream, mode]);
|
|
4724
|
-
return /* @__PURE__ */
|
|
4557
|
+
return /* @__PURE__ */ jsx4(
|
|
4725
4558
|
"span",
|
|
4726
4559
|
{
|
|
4727
4560
|
"aria-hidden": true,
|
|
@@ -4729,7 +4562,7 @@ function VoiceWaveform({
|
|
|
4729
4562
|
className: "flex h-4 w-[3.75rem] items-center justify-center gap-px",
|
|
4730
4563
|
children: WAVEFORM_BAR_KEYS.map((key, index) => {
|
|
4731
4564
|
const level = levels[index] ?? 0;
|
|
4732
|
-
return /* @__PURE__ */
|
|
4565
|
+
return /* @__PURE__ */ jsx4(
|
|
4733
4566
|
"span",
|
|
4734
4567
|
{
|
|
4735
4568
|
className: cn(
|
|
@@ -4780,9 +4613,6 @@ function transcriptionErrorMessage(code, messages) {
|
|
|
4780
4613
|
}
|
|
4781
4614
|
|
|
4782
4615
|
export {
|
|
4783
|
-
useLightbox,
|
|
4784
|
-
useLightboxOptional,
|
|
4785
|
-
LightboxProvider,
|
|
4786
4616
|
OPEN_WORKSTREAM_CONTROL_EVENT,
|
|
4787
4617
|
parseCommandLine,
|
|
4788
4618
|
hasPermission,
|
|
@@ -4836,4 +4666,4 @@ export {
|
|
|
4836
4666
|
useVoiceInput,
|
|
4837
4667
|
ComposerTranscriptionControl
|
|
4838
4668
|
};
|
|
4839
|
-
//# sourceMappingURL=chunk-
|
|
4669
|
+
//# sourceMappingURL=chunk-UXE5SSNN.js.map
|