@opengeni/react 7.4.0 → 7.5.0-canary.36919050519001
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 +124 -27
- package/dist/artifacts-document.js +3 -2
- package/dist/artifacts-presentation.js +3 -2
- package/dist/artifacts-spreadsheet.js +2 -2
- package/dist/artifacts.d.ts +1 -0
- package/dist/artifacts.js +516 -1413
- package/dist/artifacts.js.map +1 -1
- package/dist/{browser-viewer-2E6R2Y4W.js → browser-viewer-Z7S7QEJL.js} +6 -5
- package/dist/chat-interactive-block-UGBTNB3L.js +11 -0
- package/dist/{chunk-Y3QTZN2F.js → chunk-2VFNCX4E.js} +6 -6
- package/dist/{chunk-UDD6DLLT.js → chunk-3IJJEYW4.js} +15 -3
- package/dist/chunk-3IJJEYW4.js.map +1 -0
- package/dist/chunk-4RVYOY4O.js +379 -0
- package/dist/chunk-4RVYOY4O.js.map +1 -0
- package/dist/chunk-5CVXZA3Y.js +292 -0
- package/dist/chunk-5CVXZA3Y.js.map +1 -0
- package/dist/{chunk-5YK2ZDIG.js → chunk-5J4FOW6Q.js} +2 -10
- package/dist/chunk-5J4FOW6Q.js.map +1 -0
- package/dist/{chunk-KVERXCFY.js → chunk-5KYZIQFY.js} +40 -3
- package/dist/chunk-5KYZIQFY.js.map +1 -0
- package/dist/{chunk-KNDIXZN6.js → chunk-7UAMYXJY.js} +25 -18
- package/dist/{chunk-KNDIXZN6.js.map → chunk-7UAMYXJY.js.map} +1 -1
- package/dist/{chunk-SEEVCT36.js → chunk-A4UJB2MM.js} +2 -2
- package/dist/{chunk-X4HIN6TV.js → chunk-AFLPWUQ7.js} +71 -162
- package/dist/chunk-AFLPWUQ7.js.map +1 -0
- package/dist/chunk-B3V6TG77.js +41 -0
- package/dist/chunk-B3V6TG77.js.map +1 -0
- package/dist/{chunk-XEJEOAOV.js → chunk-B7WMS3CS.js} +51 -40
- package/dist/chunk-B7WMS3CS.js.map +1 -0
- package/dist/{chunk-S5JQ4R22.js → chunk-BDKR6BAR.js} +54 -24
- package/dist/chunk-BDKR6BAR.js.map +1 -0
- package/dist/{chunk-4MDLEHXL.js → chunk-DYWBUX5Q.js} +24 -12
- package/dist/chunk-DYWBUX5Q.js.map +1 -0
- package/dist/{chunk-YZ3YYMOM.js → chunk-E3G7SAYZ.js} +252 -624
- package/dist/chunk-E3G7SAYZ.js.map +1 -0
- package/dist/chunk-JT4JW7BC.js +54 -0
- package/dist/chunk-JT4JW7BC.js.map +1 -0
- package/dist/{chunk-5AZSK6MV.js → chunk-LWNLETQT.js} +5 -5
- package/dist/{chunk-USXVQACU.js → chunk-M7LBYP63.js} +5 -4
- package/dist/{chunk-USXVQACU.js.map → chunk-M7LBYP63.js.map} +1 -1
- package/dist/{chunk-L4OSXQ6H.js → chunk-NBOHNRLJ.js} +1289 -1060
- package/dist/chunk-NBOHNRLJ.js.map +1 -0
- package/dist/chunk-RHREZ7BO.js +11 -0
- package/dist/chunk-RHREZ7BO.js.map +1 -0
- package/dist/chunk-SCOTPE2I.js +589 -0
- package/dist/chunk-SCOTPE2I.js.map +1 -0
- package/dist/chunk-WEHMPOXK.js +39 -0
- package/dist/chunk-WEHMPOXK.js.map +1 -0
- package/dist/chunk-WRHIZYZF.js +988 -0
- package/dist/chunk-WRHIZYZF.js.map +1 -0
- package/dist/{chunk-3E2AITTZ.js → chunk-WUISZ3WU.js} +32 -28
- package/dist/{chunk-3E2AITTZ.js.map → chunk-WUISZ3WU.js.map} +1 -1
- package/dist/chunk-XCHWDJ22.js +107 -0
- package/dist/chunk-XCHWDJ22.js.map +1 -0
- package/dist/{chunk-DUEBTL3N.js → chunk-Y2PRMYLC.js} +4 -3
- package/dist/{chunk-DUEBTL3N.js.map → chunk-Y2PRMYLC.js.map} +1 -1
- package/dist/chunk-YBXQDQFX.js +1772 -0
- package/dist/chunk-YBXQDQFX.js.map +1 -0
- package/dist/chunk-YV4L3ILF.js +9 -0
- package/dist/chunk-YV4L3ILF.js.map +1 -0
- package/dist/{chunk-V2ABIVYJ.js → chunk-ZXSEDZP7.js} +70 -6
- package/dist/chunk-ZXSEDZP7.js.map +1 -0
- package/dist/components/artifacts/artifact-chrome.d.ts +120 -0
- package/dist/components/artifacts/artifact-sandbox.d.ts +27 -0
- package/dist/components/artifacts/chat-interactive-block.d.ts +29 -0
- package/dist/components/artifacts/deferred-chat-media.d.ts +15 -0
- package/dist/components/artifacts/editable-artifact-ui.d.ts +2 -1
- package/dist/components/artifacts/editable-artifact-view.d.ts +46 -0
- package/dist/components/artifacts/index.d.ts +7 -0
- package/dist/components/artifacts/latest-task-runner.d.ts +15 -0
- package/dist/components/artifacts/session-artifact-viewer.d.ts +39 -0
- package/dist/components/artifacts/site-view.d.ts +23 -0
- package/dist/components/browser-select-control.d.ts +3 -1
- package/dist/components/code-editor.d.ts +1 -4
- package/dist/components/desktop-viewer.d.ts +1 -1
- package/dist/components/message-timeline.d.ts +20 -3
- package/dist/components/open-geni-links.d.ts +16 -0
- package/dist/components/session-conversation.d.ts +20 -1
- package/dist/components/timeline-pill-geometry.d.ts +8 -0
- package/dist/components/timeline-pill-placement.d.ts +24 -0
- package/dist/components/usage-limit-notice.d.ts +49 -0
- package/dist/components/usage-member-list.d.ts +91 -0
- package/dist/components/usage-meter.d.ts +73 -0
- package/dist/composer.js +5 -5
- package/dist/{computer-viewer-WMJE6OA3.js → computer-viewer-KJWLH3GI.js} +7 -5
- package/dist/connect.js +7 -6
- package/dist/connect.js.map +1 -1
- package/dist/conversation-timeline.d.ts +1 -1
- package/dist/desktop.d.ts +7 -0
- package/dist/desktop.js +26 -0
- package/dist/desktop.js.map +1 -0
- package/dist/editor.d.ts +7 -0
- package/dist/editor.js +21 -0
- package/dist/editor.js.map +1 -0
- package/dist/hooks/latest-question.d.ts +1 -1
- package/dist/hooks/use-composer.d.ts +4 -0
- package/dist/hooks/use-desktop-stream.d.ts +1 -1
- package/dist/hooks/use-usage.d.ts +40 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.js +460 -1386
- package/dist/index.js.map +1 -1
- package/dist/interaction.js +8 -6
- package/dist/interaction.js.map +1 -1
- package/dist/{latest-question-QB4EUCW5.js → latest-question-IS445HOW.js} +3 -3
- package/dist/lib/format.d.ts +6 -1
- package/dist/lib/workbench-peers.d.ts +36 -0
- package/dist/machines.js +2 -2
- package/dist/{markdown-table-layout-PFUEZ2U4.js → markdown-table-layout-QXSLK4BY.js} +37 -5
- package/dist/markdown-table-layout-QXSLK4BY.js.map +1 -0
- package/dist/{queue-surface-implementation-IM2HD3SK.js → queue-surface-implementation-2CAQAIHM.js} +2 -2
- package/dist/realtime.js +3 -3
- package/dist/{sandbox-files-PXPIZAFG.js → sandbox-files-AEJTWGT4.js} +8 -5
- package/dist/sandbox-files-AEJTWGT4.js.map +1 -0
- package/dist/session-ui.d.ts +9 -2
- package/dist/session-ui.js +39 -20
- package/dist/session-ui.js.map +1 -1
- package/dist/session.js +4 -4
- package/dist/sites.js +4 -289
- package/dist/sites.js.map +1 -1
- package/dist/terminal.d.ts +8 -0
- package/dist/terminal.js +31 -0
- package/dist/terminal.js.map +1 -0
- package/dist/timeline/allowance-exhausted-row.d.ts +24 -0
- package/dist/timeline/genie-loading.d.ts +3 -1
- package/dist/timeline/types.d.ts +8 -1
- package/dist/{timeline-annotation-selection-ODLVF4OI.js → timeline-annotation-selection-DMLMM2TX.js} +6 -1
- package/dist/timeline-annotation-selection-DMLMM2TX.js.map +1 -0
- package/dist/timeline-pill-geometry-Z23V243M.js +110 -0
- package/dist/timeline-pill-geometry-Z23V243M.js.map +1 -0
- package/dist/usage/allowance-copy.d.ts +25 -0
- package/dist/usage/summary.d.ts +35 -0
- package/dist/usage.d.ts +13 -0
- package/dist/usage.js +1073 -0
- package/dist/usage.js.map +1 -0
- package/package.json +19 -3
- package/src/artifacts.ts +37 -0
- package/src/components/artifacts/artifact-chrome.tsx +413 -0
- package/src/components/artifacts/artifact-sandbox.tsx +185 -0
- package/src/components/artifacts/chat-interactive-block.tsx +260 -0
- package/src/components/artifacts/deferred-chat-media.tsx +67 -0
- package/src/components/artifacts/editable-artifact-ui.tsx +3 -1
- package/src/components/artifacts/editable-artifact-view.tsx +187 -0
- package/src/components/artifacts/editable-artifact-workbench.tsx +5 -2
- package/src/components/artifacts/editable-document.tsx +34 -36
- package/src/components/artifacts/editable-presentation.tsx +21 -16
- package/src/components/artifacts/index.ts +41 -0
- package/src/components/artifacts/latest-task-runner.ts +49 -0
- package/src/components/artifacts/session-artifact-viewer.tsx +376 -0
- package/src/components/artifacts/site-view.tsx +116 -0
- package/src/components/browser-select-control.tsx +4 -1
- package/src/components/browser-viewer.tsx +81 -22
- package/src/components/code-editor.tsx +13 -16
- package/src/components/computer-viewer.tsx +51 -23
- package/src/components/desktop-viewer.tsx +1 -1
- package/src/components/markdown-table-layout.ts +49 -5
- package/src/components/markdown.tsx +5 -2
- package/src/components/message-timeline.tsx +557 -516
- package/src/components/open-geni-links.tsx +24 -0
- package/src/components/sandbox-terminal.tsx +48 -11
- package/src/components/session-chrome.tsx +22 -3
- package/src/components/session-conversation.tsx +195 -102
- package/src/components/timeline-annotation-selection.tsx +7 -0
- package/src/components/timeline-pill-geometry.ts +169 -0
- package/src/components/timeline-pill-placement.ts +99 -0
- package/src/components/usage-limit-notice.tsx +179 -0
- package/src/components/usage-member-list.tsx +792 -0
- package/src/components/usage-meter.tsx +382 -0
- package/src/conversation-timeline.ts +10 -2
- package/src/desktop.ts +24 -0
- package/src/editor.ts +13 -0
- package/src/hooks/use-available-models.ts +1 -1
- package/src/hooks/use-composer.ts +57 -2
- package/src/hooks/use-desktop-stream.ts +19 -28
- package/src/hooks/use-usage.ts +100 -0
- package/src/index.ts +22 -0
- package/src/lib/format.ts +32 -6
- package/src/lib/workbench-peers.ts +62 -0
- package/src/session-ui.ts +22 -0
- package/src/terminal.ts +26 -0
- package/src/timeline/activity-rail.tsx +5 -3
- package/src/timeline/allowance-exhausted-row.tsx +86 -0
- package/src/timeline/genie-loading.tsx +16 -6
- package/src/timeline/projection.ts +78 -4
- package/src/timeline/types.ts +8 -0
- package/src/usage/allowance-copy.ts +64 -0
- package/src/usage/summary.ts +93 -0
- package/src/usage.ts +50 -0
- package/styles/compiled.css +325 -0
- package/dist/chunk-4MDLEHXL.js.map +0 -1
- package/dist/chunk-5YK2ZDIG.js.map +0 -1
- package/dist/chunk-KVERXCFY.js.map +0 -1
- package/dist/chunk-L4OSXQ6H.js.map +0 -1
- package/dist/chunk-S5JQ4R22.js.map +0 -1
- package/dist/chunk-UDD6DLLT.js.map +0 -1
- package/dist/chunk-UGMKPUEM.js +0 -299
- package/dist/chunk-UGMKPUEM.js.map +0 -1
- package/dist/chunk-V2ABIVYJ.js.map +0 -1
- package/dist/chunk-X4HIN6TV.js.map +0 -1
- package/dist/chunk-XEJEOAOV.js.map +0 -1
- package/dist/chunk-YZ3YYMOM.js.map +0 -1
- package/dist/markdown-table-layout-PFUEZ2U4.js.map +0 -1
- package/dist/timeline-annotation-selection-ODLVF4OI.js.map +0 -1
- /package/dist/{browser-viewer-2E6R2Y4W.js.map → browser-viewer-Z7S7QEJL.js.map} +0 -0
- /package/dist/{computer-viewer-WMJE6OA3.js.map → chat-interactive-block-UGBTNB3L.js.map} +0 -0
- /package/dist/{chunk-Y3QTZN2F.js.map → chunk-2VFNCX4E.js.map} +0 -0
- /package/dist/{chunk-SEEVCT36.js.map → chunk-A4UJB2MM.js.map} +0 -0
- /package/dist/{chunk-5AZSK6MV.js.map → chunk-LWNLETQT.js.map} +0 -0
- /package/dist/{sandbox-files-PXPIZAFG.js.map → computer-viewer-KJWLH3GI.js.map} +0 -0
- /package/dist/{latest-question-QB4EUCW5.js.map → latest-question-IS445HOW.js.map} +0 -0
- /package/dist/{queue-surface-implementation-IM2HD3SK.js.map → queue-surface-implementation-2CAQAIHM.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CapturedFileUnavailableError,
|
|
3
|
-
CodeEditor,
|
|
4
3
|
FileBrowser,
|
|
5
4
|
FileWriteConflictError,
|
|
6
5
|
PierreFile,
|
|
7
6
|
SandboxFiles,
|
|
8
7
|
filePathVisibility,
|
|
9
|
-
languageForPath,
|
|
10
|
-
sandboxAcceptsLiveIo,
|
|
11
8
|
useSandboxFiles,
|
|
12
9
|
useUnicodeFallbackFonts,
|
|
13
10
|
visibleFileTree
|
|
14
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-E3G7SAYZ.js";
|
|
15
12
|
import {
|
|
16
13
|
createEmbeddedSessionClient,
|
|
17
14
|
isGoalEvent,
|
|
@@ -51,23 +48,7 @@ import {
|
|
|
51
48
|
healthPulses,
|
|
52
49
|
pointsFor,
|
|
53
50
|
useMachines
|
|
54
|
-
} from "./chunk-
|
|
55
|
-
import {
|
|
56
|
-
DesktopViewer,
|
|
57
|
-
useDesktopStream,
|
|
58
|
-
useRelayFrameStream
|
|
59
|
-
} from "./chunk-4MDLEHXL.js";
|
|
60
|
-
import {
|
|
61
|
-
STREAM_KIND_PTY,
|
|
62
|
-
STREAM_ROLE_CLIENT,
|
|
63
|
-
decodeStreamFrame,
|
|
64
|
-
decodeStreamOpenAck,
|
|
65
|
-
encodeStreamFrame,
|
|
66
|
-
encodeStreamOpen
|
|
67
|
-
} from "./chunk-5YK2ZDIG.js";
|
|
68
|
-
import {
|
|
69
|
-
ModelPolicyPickerMenu
|
|
70
|
-
} from "./chunk-5EXGU7UF.js";
|
|
51
|
+
} from "./chunk-LWNLETQT.js";
|
|
71
52
|
import {
|
|
72
53
|
ActivityRail,
|
|
73
54
|
ApprovalSurface,
|
|
@@ -126,17 +107,18 @@ import {
|
|
|
126
107
|
useWorkspaceSessions,
|
|
127
108
|
userMessageLikelyNeedsDisclosure,
|
|
128
109
|
v4aToGitFileDiff
|
|
129
|
-
} from "./chunk-
|
|
130
|
-
import "./chunk-YCGBREUV.js";
|
|
110
|
+
} from "./chunk-NBOHNRLJ.js";
|
|
131
111
|
import {
|
|
132
112
|
useThemeType
|
|
133
113
|
} from "./chunk-UK4TINKT.js";
|
|
114
|
+
import "./chunk-YCGBREUV.js";
|
|
134
115
|
import "./chunk-5QHL6BLH.js";
|
|
135
116
|
import "./chunk-ZYRGEKWS.js";
|
|
136
|
-
import {
|
|
137
|
-
registerPierreDiffs
|
|
138
|
-
} from "./chunk-A2PI6UMY.js";
|
|
139
117
|
import "./chunk-FZCP527Y.js";
|
|
118
|
+
import {
|
|
119
|
+
ArtifactLabelsProvider,
|
|
120
|
+
DEFAULT_ARTIFACT_LABELS
|
|
121
|
+
} from "./chunk-5CVXZA3Y.js";
|
|
140
122
|
import {
|
|
141
123
|
SESSION_EVENT_BROWSER_MAX_BYTES,
|
|
142
124
|
SESSION_EVENT_BROWSER_MAX_COUNT,
|
|
@@ -158,20 +140,69 @@ import {
|
|
|
158
140
|
useSessionControl,
|
|
159
141
|
useSessionEvents,
|
|
160
142
|
useTurnQueue
|
|
161
|
-
} from "./chunk-
|
|
143
|
+
} from "./chunk-M7LBYP63.js";
|
|
162
144
|
import {
|
|
163
145
|
buildTimeline,
|
|
164
146
|
creditExhaustedFromEvents,
|
|
165
147
|
extractSessionRef,
|
|
166
148
|
groupTimeline,
|
|
167
149
|
sessionStatusFromEvents
|
|
168
|
-
} from "./chunk-
|
|
150
|
+
} from "./chunk-ZXSEDZP7.js";
|
|
169
151
|
import {
|
|
170
152
|
toolDisplayName
|
|
171
153
|
} from "./chunk-ERGYJIBB.js";
|
|
172
154
|
import {
|
|
173
155
|
OpenGeniProvider
|
|
174
156
|
} from "./chunk-WZ55DVGK.js";
|
|
157
|
+
import {
|
|
158
|
+
McpConnectionCard,
|
|
159
|
+
SessionCapabilityFrame,
|
|
160
|
+
SessionMcpCapabilityCard,
|
|
161
|
+
attachSessionCapability,
|
|
162
|
+
completeSessionCapabilityOAuth
|
|
163
|
+
} from "./chunk-45GE35O7.js";
|
|
164
|
+
import {
|
|
165
|
+
ActivityDisclosure,
|
|
166
|
+
BodyNote,
|
|
167
|
+
CopyButton,
|
|
168
|
+
CopyHoverFrame,
|
|
169
|
+
DisclosureDefaultsProvider,
|
|
170
|
+
Markdown,
|
|
171
|
+
MediaEmpty,
|
|
172
|
+
MediaSkeleton,
|
|
173
|
+
PayloadBlock,
|
|
174
|
+
ScreenshotFigure,
|
|
175
|
+
TermBlock,
|
|
176
|
+
Thumbnail,
|
|
177
|
+
retainedImageId,
|
|
178
|
+
sandboxFileLocationFromHref,
|
|
179
|
+
sandboxFilePathFromHref
|
|
180
|
+
} from "./chunk-AFLPWUQ7.js";
|
|
181
|
+
import "./chunk-GIMRELBW.js";
|
|
182
|
+
import "./chunk-447JLCBU.js";
|
|
183
|
+
import {
|
|
184
|
+
OpenGeniLinkProvider,
|
|
185
|
+
chainLinkResolvers,
|
|
186
|
+
sessionLinkResolver,
|
|
187
|
+
useOpenGeniLinkResolver,
|
|
188
|
+
viewerLinkResolver
|
|
189
|
+
} from "./chunk-XCHWDJ22.js";
|
|
190
|
+
import {
|
|
191
|
+
registerPierreDiffs
|
|
192
|
+
} from "./chunk-A2PI6UMY.js";
|
|
193
|
+
import {
|
|
194
|
+
copyTextToClipboard,
|
|
195
|
+
tableElementToTsv
|
|
196
|
+
} from "./chunk-JVYQRRC4.js";
|
|
197
|
+
import {
|
|
198
|
+
DesktopViewer,
|
|
199
|
+
useDesktopStream,
|
|
200
|
+
useRelayFrameStream
|
|
201
|
+
} from "./chunk-DYWBUX5Q.js";
|
|
202
|
+
import "./chunk-RHREZ7BO.js";
|
|
203
|
+
import {
|
|
204
|
+
ModelPolicyPickerMenu
|
|
205
|
+
} from "./chunk-5EXGU7UF.js";
|
|
175
206
|
import {
|
|
176
207
|
CommandPalette,
|
|
177
208
|
ComposerTranscriptionControl,
|
|
@@ -204,7 +235,23 @@ import {
|
|
|
204
235
|
useSlashCommands,
|
|
205
236
|
useTranscription,
|
|
206
237
|
useVoiceInput
|
|
207
|
-
} from "./chunk-
|
|
238
|
+
} from "./chunk-2VFNCX4E.js";
|
|
239
|
+
import {
|
|
240
|
+
FILE_ONLY_MESSAGE_TEXT,
|
|
241
|
+
composeSendInput,
|
|
242
|
+
shouldSteerOnKey,
|
|
243
|
+
shouldSubmitOnKey,
|
|
244
|
+
useComposer
|
|
245
|
+
} from "./chunk-5KYZIQFY.js";
|
|
246
|
+
import {
|
|
247
|
+
LightboxProvider,
|
|
248
|
+
Tooltip,
|
|
249
|
+
TooltipContent,
|
|
250
|
+
TooltipProvider,
|
|
251
|
+
TooltipTrigger,
|
|
252
|
+
useLightbox,
|
|
253
|
+
useLightboxOptional
|
|
254
|
+
} from "./chunk-BRM6FVZA.js";
|
|
208
255
|
import {
|
|
209
256
|
BillingClassMark,
|
|
210
257
|
ClaudeMark,
|
|
@@ -216,13 +263,6 @@ import {
|
|
|
216
263
|
defaultModelPolicyPickerMessages
|
|
217
264
|
} from "./chunk-UINDK6C3.js";
|
|
218
265
|
import "./chunk-K3HQAKQX.js";
|
|
219
|
-
import {
|
|
220
|
-
FILE_ONLY_MESSAGE_TEXT,
|
|
221
|
-
composeSendInput,
|
|
222
|
-
shouldSteerOnKey,
|
|
223
|
-
shouldSubmitOnKey,
|
|
224
|
-
useComposer
|
|
225
|
-
} from "./chunk-KVERXCFY.js";
|
|
226
266
|
import {
|
|
227
267
|
advancedSourceSummary,
|
|
228
268
|
availabilityReasonLabel,
|
|
@@ -242,55 +282,6 @@ import {
|
|
|
242
282
|
runnableLatencyModesForModel,
|
|
243
283
|
sortPickerRows
|
|
244
284
|
} from "./chunk-CHPKSLPN.js";
|
|
245
|
-
import {
|
|
246
|
-
useMutationRunner,
|
|
247
|
-
usePageLiveActivity,
|
|
248
|
-
usePolledValue,
|
|
249
|
-
useSessionEventTrigger
|
|
250
|
-
} from "./chunk-KZ73RL76.js";
|
|
251
|
-
import {
|
|
252
|
-
useOpenGeni,
|
|
253
|
-
useOpenGeniClient
|
|
254
|
-
} from "./chunk-NEXLLTP4.js";
|
|
255
|
-
import {
|
|
256
|
-
McpConnectionCard,
|
|
257
|
-
SessionCapabilityFrame,
|
|
258
|
-
SessionMcpCapabilityCard,
|
|
259
|
-
attachSessionCapability,
|
|
260
|
-
completeSessionCapabilityOAuth
|
|
261
|
-
} from "./chunk-45GE35O7.js";
|
|
262
|
-
import {
|
|
263
|
-
ActivityDisclosure,
|
|
264
|
-
BodyNote,
|
|
265
|
-
CopyButton,
|
|
266
|
-
CopyHoverFrame,
|
|
267
|
-
DisclosureDefaultsProvider,
|
|
268
|
-
Markdown,
|
|
269
|
-
MediaEmpty,
|
|
270
|
-
MediaSkeleton,
|
|
271
|
-
OpenGeniLinkProvider,
|
|
272
|
-
PayloadBlock,
|
|
273
|
-
ScreenshotFigure,
|
|
274
|
-
TermBlock,
|
|
275
|
-
Thumbnail,
|
|
276
|
-
chainLinkResolvers,
|
|
277
|
-
retainedImageId,
|
|
278
|
-
sandboxFileLocationFromHref,
|
|
279
|
-
sandboxFilePathFromHref,
|
|
280
|
-
sessionLinkResolver,
|
|
281
|
-
useOpenGeniLinkResolver
|
|
282
|
-
} from "./chunk-X4HIN6TV.js";
|
|
283
|
-
import "./chunk-GIMRELBW.js";
|
|
284
|
-
import "./chunk-447JLCBU.js";
|
|
285
|
-
import {
|
|
286
|
-
LightboxProvider,
|
|
287
|
-
Tooltip,
|
|
288
|
-
TooltipContent,
|
|
289
|
-
TooltipProvider,
|
|
290
|
-
TooltipTrigger,
|
|
291
|
-
useLightbox,
|
|
292
|
-
useLightboxOptional
|
|
293
|
-
} from "./chunk-BRM6FVZA.js";
|
|
294
285
|
import "./chunk-VZTQ73XT.js";
|
|
295
286
|
import {
|
|
296
287
|
COMPOSER_PAYMENT_REQUIRED_MESSAGE,
|
|
@@ -305,14 +296,40 @@ import {
|
|
|
305
296
|
stringifyPayload,
|
|
306
297
|
truncate,
|
|
307
298
|
tryParseJson
|
|
308
|
-
} from "./chunk-
|
|
299
|
+
} from "./chunk-3IJJEYW4.js";
|
|
300
|
+
import {
|
|
301
|
+
SandboxTerminal,
|
|
302
|
+
terminalCanAcquirePty,
|
|
303
|
+
useTerminalStream,
|
|
304
|
+
xtermThemeFromTokens
|
|
305
|
+
} from "./chunk-WRHIZYZF.js";
|
|
306
|
+
import {
|
|
307
|
+
sandboxAcceptsLiveIo
|
|
308
|
+
} from "./chunk-YV4L3ILF.js";
|
|
309
|
+
import "./chunk-5J4FOW6Q.js";
|
|
310
|
+
import "./chunk-B3V6TG77.js";
|
|
311
|
+
import {
|
|
312
|
+
useMutationRunner,
|
|
313
|
+
usePageLiveActivity,
|
|
314
|
+
usePolledValue,
|
|
315
|
+
useSessionEventTrigger
|
|
316
|
+
} from "./chunk-KZ73RL76.js";
|
|
317
|
+
import {
|
|
318
|
+
useOpenGeni,
|
|
319
|
+
useOpenGeniClient
|
|
320
|
+
} from "./chunk-NEXLLTP4.js";
|
|
321
|
+
import {
|
|
322
|
+
CodeEditor,
|
|
323
|
+
languageForPath
|
|
324
|
+
} from "./chunk-4RVYOY4O.js";
|
|
325
|
+
import {
|
|
326
|
+
registerCodeEditor,
|
|
327
|
+
registerDesktopViewer,
|
|
328
|
+
registerSandboxTerminal
|
|
329
|
+
} from "./chunk-JT4JW7BC.js";
|
|
309
330
|
import {
|
|
310
331
|
cn
|
|
311
332
|
} from "./chunk-22KP6LR5.js";
|
|
312
|
-
import {
|
|
313
|
-
copyTextToClipboard,
|
|
314
|
-
tableElementToTsv
|
|
315
|
-
} from "./chunk-JVYQRRC4.js";
|
|
316
333
|
|
|
317
334
|
// src/session-auth-recommendation.ts
|
|
318
335
|
function sessionAuthRecommendation(item, catalog) {
|
|
@@ -1070,15 +1087,6 @@ import {
|
|
|
1070
1087
|
applyUrlRotation
|
|
1071
1088
|
} from "@opengeni/sdk";
|
|
1072
1089
|
import { useCallback as useCallback8, useEffect as useEffect3, useRef as useRef2, useState as useState2 } from "react";
|
|
1073
|
-
|
|
1074
|
-
// src/lib/terminal-capability.ts
|
|
1075
|
-
function terminalCanAcquirePty(cell) {
|
|
1076
|
-
if (!cell?.ptyCapable) return false;
|
|
1077
|
-
if (cell.transport === "pty-ws" || cell.transport === "relay-pty") return true;
|
|
1078
|
-
return cell.reason === "lease_cold" || cell.reason === "not_provisioned";
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
// src/hooks/use-session-capabilities.ts
|
|
1082
1090
|
function desktopAttachable(cell) {
|
|
1083
1091
|
if (cell.transport !== null) return true;
|
|
1084
1092
|
return cell.reason === "lease_cold" || cell.reason === "not_provisioned" || cell.reason === null;
|
|
@@ -1380,386 +1388,9 @@ function isSandboxOwnershipDisabledError(error) {
|
|
|
1380
1388
|
return error instanceof OpenGeniApiError && error.status === 404 && error.message.includes("sandbox ownership is not enabled");
|
|
1381
1389
|
}
|
|
1382
1390
|
|
|
1383
|
-
// src/hooks/use-terminal-stream.ts
|
|
1384
|
-
import {
|
|
1385
|
-
TTYD_SUBPROTOCOL,
|
|
1386
|
-
terminalSocketUrl,
|
|
1387
|
-
ttydAuthFrame,
|
|
1388
|
-
ttydInputFrame,
|
|
1389
|
-
ttydResizeFrame,
|
|
1390
|
-
TtydServerCommand
|
|
1391
|
-
} from "@opengeni/sdk";
|
|
1392
|
-
import { useCallback as useCallback9, useEffect as useEffect4, useMemo as useMemo4, useRef as useRef3, useState as useState3 } from "react";
|
|
1393
|
-
var MAX_PENDING_TERMINAL_INPUT_CODE_UNITS = 64 * 1024;
|
|
1394
|
-
var TERMINAL_CONNECT_EXPIRY_SKEW_MS = 5e3;
|
|
1395
|
-
var TERMINAL_RECONNECT_INITIAL_MS = 100;
|
|
1396
|
-
var TERMINAL_RECONNECT_MAX_MS = 3e3;
|
|
1397
|
-
var RELAY_TAG_OPEN = 1;
|
|
1398
|
-
var RELAY_TAG_OPEN_ACK = 2;
|
|
1399
|
-
var RELAY_TAG_FRAME = 3;
|
|
1400
|
-
function relayDatagram(tag, body) {
|
|
1401
|
-
const bytes = new Uint8Array(body.length + 1);
|
|
1402
|
-
bytes[0] = tag;
|
|
1403
|
-
bytes.set(body, 1);
|
|
1404
|
-
return bytes.buffer;
|
|
1405
|
-
}
|
|
1406
|
-
function relayChannelFromUrl(url) {
|
|
1407
|
-
const endpoint = new URL(url);
|
|
1408
|
-
const channel = {
|
|
1409
|
-
channelId: endpoint.searchParams.get("channel") ?? "",
|
|
1410
|
-
workspaceId: endpoint.searchParams.get("ws") ?? "",
|
|
1411
|
-
agentId: endpoint.searchParams.get("agent") ?? "",
|
|
1412
|
-
kind: STREAM_KIND_PTY,
|
|
1413
|
-
port: Number(endpoint.searchParams.get("port") ?? "0")
|
|
1414
|
-
};
|
|
1415
|
-
if (!channel.channelId || !channel.workspaceId || !channel.agentId || !Number.isSafeInteger(channel.port) || channel.port <= 0) {
|
|
1416
|
-
throw new Error("terminal relay endpoint is incomplete");
|
|
1417
|
-
}
|
|
1418
|
-
return channel;
|
|
1419
|
-
}
|
|
1420
|
-
function sendRelayInput(socket, channel, sequence, data) {
|
|
1421
|
-
socket.send(
|
|
1422
|
-
relayDatagram(
|
|
1423
|
-
RELAY_TAG_FRAME,
|
|
1424
|
-
encodeStreamFrame({
|
|
1425
|
-
channelId: channel.channelId,
|
|
1426
|
-
seq: sequence.toString(),
|
|
1427
|
-
data: new TextEncoder().encode(data),
|
|
1428
|
-
producedAtMs: String(Date.now())
|
|
1429
|
-
})
|
|
1430
|
-
)
|
|
1431
|
-
);
|
|
1432
|
-
}
|
|
1433
|
-
function terminalStreamCredentialUsable(capability, nowMs = Date.now()) {
|
|
1434
|
-
if (capability?.transport !== "pty-ws" && capability?.transport !== "relay-pty" || !capability.url) {
|
|
1435
|
-
return false;
|
|
1436
|
-
}
|
|
1437
|
-
if (!capability.expiresAt) return true;
|
|
1438
|
-
const expiresAt = Date.parse(capability.expiresAt);
|
|
1439
|
-
return Number.isFinite(expiresAt) && expiresAt > nowMs + TERMINAL_CONNECT_EXPIRY_SKEW_MS;
|
|
1440
|
-
}
|
|
1441
|
-
function decodeFrame(data) {
|
|
1442
|
-
if (typeof data === "string") {
|
|
1443
|
-
return { command: data.charAt(0), payload: data.slice(1) };
|
|
1444
|
-
}
|
|
1445
|
-
const bytes = new Uint8Array(data);
|
|
1446
|
-
const command = bytes.length > 0 ? String.fromCharCode(bytes[0]) : "";
|
|
1447
|
-
const payload = bytes.length > 1 ? new TextDecoder().decode(bytes.subarray(1)) : "";
|
|
1448
|
-
return { command, payload };
|
|
1449
|
-
}
|
|
1450
|
-
function closeSocket(socket) {
|
|
1451
|
-
try {
|
|
1452
|
-
socket?.close();
|
|
1453
|
-
} catch {
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
|
-
function useTerminalStream(options) {
|
|
1457
|
-
const { capability, onOutput, onTitle, onReconnectNeeded, initialCols, initialRows } = options;
|
|
1458
|
-
const [status, setStatus] = useState3("closed");
|
|
1459
|
-
const [reconnectGeneration, setReconnectGeneration] = useState3(0);
|
|
1460
|
-
const wsRef = useRef3(null);
|
|
1461
|
-
const pendingInputRef = useRef3("");
|
|
1462
|
-
const socketFailedRef = useRef3(false);
|
|
1463
|
-
const socketAuthenticatedRef = useRef3(false);
|
|
1464
|
-
const relayChannelRef = useRef3(null);
|
|
1465
|
-
const relayIdentityRef = useRef3(null);
|
|
1466
|
-
const relayInputSequenceRef = useRef3(0n);
|
|
1467
|
-
const relayOutputSequenceRef = useRef3(0n);
|
|
1468
|
-
const reconnectAttemptRef = useRef3(0);
|
|
1469
|
-
const credentialIdentityRef = useRef3(null);
|
|
1470
|
-
const refreshRequestedRef = useRef3(false);
|
|
1471
|
-
const intentionalCloseRef = useRef3(/* @__PURE__ */ new WeakSet());
|
|
1472
|
-
const sizeRef = useRef3({
|
|
1473
|
-
cols: initialCols ?? 80,
|
|
1474
|
-
rows: initialRows ?? 24
|
|
1475
|
-
});
|
|
1476
|
-
const onOutputRef = useRef3(onOutput);
|
|
1477
|
-
const onTitleRef = useRef3(onTitle);
|
|
1478
|
-
const onReconnectNeededRef = useRef3(onReconnectNeeded);
|
|
1479
|
-
onOutputRef.current = onOutput;
|
|
1480
|
-
onTitleRef.current = onTitle;
|
|
1481
|
-
onReconnectNeededRef.current = onReconnectNeeded;
|
|
1482
|
-
const transport = capability?.transport ?? null;
|
|
1483
|
-
const url = capability?.url ?? null;
|
|
1484
|
-
const token = capability?.token ?? null;
|
|
1485
|
-
const expiresAt = capability?.expiresAt ?? null;
|
|
1486
|
-
const transportRef = useRef3(transport);
|
|
1487
|
-
transportRef.current = transport;
|
|
1488
|
-
useEffect4(() => {
|
|
1489
|
-
if (typeof window === "undefined" || typeof WebSocket === "undefined") return;
|
|
1490
|
-
const relay = transport === "relay-pty";
|
|
1491
|
-
if (transport !== "pty-ws" && !relay) {
|
|
1492
|
-
pendingInputRef.current = "";
|
|
1493
|
-
socketAuthenticatedRef.current = false;
|
|
1494
|
-
relayIdentityRef.current = null;
|
|
1495
|
-
relayInputSequenceRef.current = 0n;
|
|
1496
|
-
relayOutputSequenceRef.current = 0n;
|
|
1497
|
-
reconnectAttemptRef.current = 0;
|
|
1498
|
-
credentialIdentityRef.current = null;
|
|
1499
|
-
refreshRequestedRef.current = false;
|
|
1500
|
-
setStatus("closed");
|
|
1501
|
-
return;
|
|
1502
|
-
}
|
|
1503
|
-
const credentialIdentity = `${transport}\0${url ?? ""}\0${token ?? ""}\0${expiresAt ?? ""}`;
|
|
1504
|
-
if (credentialIdentityRef.current !== credentialIdentity) {
|
|
1505
|
-
credentialIdentityRef.current = credentialIdentity;
|
|
1506
|
-
reconnectAttemptRef.current = 0;
|
|
1507
|
-
refreshRequestedRef.current = false;
|
|
1508
|
-
}
|
|
1509
|
-
socketFailedRef.current = false;
|
|
1510
|
-
socketAuthenticatedRef.current = false;
|
|
1511
|
-
if (!url) {
|
|
1512
|
-
setStatus("closed");
|
|
1513
|
-
return;
|
|
1514
|
-
}
|
|
1515
|
-
if (!terminalStreamCredentialUsable({ transport, url, expiresAt })) {
|
|
1516
|
-
setStatus("closed");
|
|
1517
|
-
if (!refreshRequestedRef.current) {
|
|
1518
|
-
refreshRequestedRef.current = true;
|
|
1519
|
-
onReconnectNeededRef.current?.();
|
|
1520
|
-
}
|
|
1521
|
-
return;
|
|
1522
|
-
}
|
|
1523
|
-
let disposed = false;
|
|
1524
|
-
let reconnectTimer = null;
|
|
1525
|
-
let socket;
|
|
1526
|
-
let relayChannel = null;
|
|
1527
|
-
const relayOutputDecoder = new TextDecoder();
|
|
1528
|
-
setStatus("connecting");
|
|
1529
|
-
try {
|
|
1530
|
-
if (relay) {
|
|
1531
|
-
relayChannel = relayChannelFromUrl(url);
|
|
1532
|
-
const relayIdentity = [
|
|
1533
|
-
relayChannel.workspaceId,
|
|
1534
|
-
relayChannel.agentId,
|
|
1535
|
-
relayChannel.port,
|
|
1536
|
-
relayChannel.channelId
|
|
1537
|
-
].join("\0");
|
|
1538
|
-
if (relayIdentityRef.current !== relayIdentity) {
|
|
1539
|
-
relayIdentityRef.current = relayIdentity;
|
|
1540
|
-
relayInputSequenceRef.current = 0n;
|
|
1541
|
-
relayOutputSequenceRef.current = 0n;
|
|
1542
|
-
}
|
|
1543
|
-
relayChannelRef.current = relayChannel;
|
|
1544
|
-
socket = new WebSocket(url);
|
|
1545
|
-
} else {
|
|
1546
|
-
socket = new WebSocket(terminalSocketUrl({ url }), TTYD_SUBPROTOCOL);
|
|
1547
|
-
}
|
|
1548
|
-
} catch {
|
|
1549
|
-
socketFailedRef.current = true;
|
|
1550
|
-
setStatus("error");
|
|
1551
|
-
return;
|
|
1552
|
-
}
|
|
1553
|
-
socket.binaryType = "arraybuffer";
|
|
1554
|
-
wsRef.current = socket;
|
|
1555
|
-
const requestFreshGrant = () => {
|
|
1556
|
-
if (disposed || refreshRequestedRef.current || intentionalCloseRef.current.has(socket))
|
|
1557
|
-
return;
|
|
1558
|
-
refreshRequestedRef.current = true;
|
|
1559
|
-
onReconnectNeededRef.current?.();
|
|
1560
|
-
};
|
|
1561
|
-
const scheduleTransportReconnect = () => {
|
|
1562
|
-
if (disposed || reconnectTimer !== null || intentionalCloseRef.current.has(socket)) return;
|
|
1563
|
-
if (refreshRequestedRef.current) return;
|
|
1564
|
-
if (!terminalStreamCredentialUsable({ transport, url, expiresAt })) {
|
|
1565
|
-
requestFreshGrant();
|
|
1566
|
-
return;
|
|
1567
|
-
}
|
|
1568
|
-
const attempt = reconnectAttemptRef.current++;
|
|
1569
|
-
const delay = Math.min(
|
|
1570
|
-
TERMINAL_RECONNECT_INITIAL_MS * 2 ** Math.min(attempt, 8),
|
|
1571
|
-
TERMINAL_RECONNECT_MAX_MS
|
|
1572
|
-
);
|
|
1573
|
-
setStatus("connecting");
|
|
1574
|
-
reconnectTimer = setTimeout(() => {
|
|
1575
|
-
reconnectTimer = null;
|
|
1576
|
-
if (!disposed) setReconnectGeneration((generation) => generation + 1);
|
|
1577
|
-
}, delay);
|
|
1578
|
-
};
|
|
1579
|
-
socket.onopen = () => {
|
|
1580
|
-
if (disposed) return;
|
|
1581
|
-
if (relay && relayChannel) {
|
|
1582
|
-
try {
|
|
1583
|
-
socket.send(
|
|
1584
|
-
relayDatagram(
|
|
1585
|
-
RELAY_TAG_OPEN,
|
|
1586
|
-
encodeStreamOpen({
|
|
1587
|
-
channel: relayChannel,
|
|
1588
|
-
token: token ?? "",
|
|
1589
|
-
role: STREAM_ROLE_CLIENT,
|
|
1590
|
-
resumeFromSeq: relayOutputSequenceRef.current.toString()
|
|
1591
|
-
})
|
|
1592
|
-
)
|
|
1593
|
-
);
|
|
1594
|
-
} catch {
|
|
1595
|
-
socketFailedRef.current = false;
|
|
1596
|
-
setStatus("connecting");
|
|
1597
|
-
closeSocket(socket);
|
|
1598
|
-
}
|
|
1599
|
-
return;
|
|
1600
|
-
}
|
|
1601
|
-
try {
|
|
1602
|
-
socket.send(ttydAuthFrame({ columns: sizeRef.current.cols, rows: sizeRef.current.rows }));
|
|
1603
|
-
socket.send(ttydResizeFrame(sizeRef.current.cols, sizeRef.current.rows));
|
|
1604
|
-
if (pendingInputRef.current.length > 0) {
|
|
1605
|
-
socket.send(ttydInputFrame(pendingInputRef.current));
|
|
1606
|
-
pendingInputRef.current = "";
|
|
1607
|
-
}
|
|
1608
|
-
socketAuthenticatedRef.current = true;
|
|
1609
|
-
} catch {
|
|
1610
|
-
socketFailedRef.current = false;
|
|
1611
|
-
setStatus("connecting");
|
|
1612
|
-
closeSocket(socket);
|
|
1613
|
-
return;
|
|
1614
|
-
}
|
|
1615
|
-
setStatus("open");
|
|
1616
|
-
reconnectAttemptRef.current = 0;
|
|
1617
|
-
refreshRequestedRef.current = false;
|
|
1618
|
-
};
|
|
1619
|
-
socket.onmessage = (ev) => {
|
|
1620
|
-
if (disposed) return;
|
|
1621
|
-
if (relay) {
|
|
1622
|
-
if (!(ev.data instanceof ArrayBuffer) || !relayChannel) return;
|
|
1623
|
-
const bytes = new Uint8Array(ev.data);
|
|
1624
|
-
if (bytes.length < 1) return;
|
|
1625
|
-
const tag = bytes[0];
|
|
1626
|
-
const body = bytes.subarray(1);
|
|
1627
|
-
if (tag === RELAY_TAG_OPEN_ACK) {
|
|
1628
|
-
try {
|
|
1629
|
-
const ack = decodeStreamOpenAck(body);
|
|
1630
|
-
if (!ack.accepted) throw new Error(ack.error?.message ?? "terminal relay rejected");
|
|
1631
|
-
reconnectAttemptRef.current = 0;
|
|
1632
|
-
refreshRequestedRef.current = false;
|
|
1633
|
-
socketAuthenticatedRef.current = true;
|
|
1634
|
-
if (pendingInputRef.current.length > 0) {
|
|
1635
|
-
sendRelayInput(
|
|
1636
|
-
socket,
|
|
1637
|
-
relayChannel,
|
|
1638
|
-
relayInputSequenceRef.current++,
|
|
1639
|
-
pendingInputRef.current
|
|
1640
|
-
);
|
|
1641
|
-
pendingInputRef.current = "";
|
|
1642
|
-
}
|
|
1643
|
-
setStatus("open");
|
|
1644
|
-
} catch {
|
|
1645
|
-
socketFailedRef.current = true;
|
|
1646
|
-
setStatus("error");
|
|
1647
|
-
requestFreshGrant();
|
|
1648
|
-
closeSocket(socket);
|
|
1649
|
-
}
|
|
1650
|
-
} else if (tag === RELAY_TAG_FRAME && socketAuthenticatedRef.current) {
|
|
1651
|
-
try {
|
|
1652
|
-
const frame = decodeStreamFrame(body);
|
|
1653
|
-
const sequence = BigInt(frame.seq);
|
|
1654
|
-
if (sequence < relayOutputSequenceRef.current) return;
|
|
1655
|
-
relayOutputSequenceRef.current = sequence + 1n;
|
|
1656
|
-
if (frame.data.length > 0) {
|
|
1657
|
-
onOutputRef.current?.(relayOutputDecoder.decode(frame.data, { stream: true }));
|
|
1658
|
-
}
|
|
1659
|
-
} catch {
|
|
1660
|
-
}
|
|
1661
|
-
}
|
|
1662
|
-
return;
|
|
1663
|
-
}
|
|
1664
|
-
const { command, payload } = decodeFrame(ev.data);
|
|
1665
|
-
switch (command) {
|
|
1666
|
-
case TtydServerCommand.OUTPUT:
|
|
1667
|
-
onOutputRef.current?.(payload);
|
|
1668
|
-
break;
|
|
1669
|
-
case TtydServerCommand.SET_WINDOW_TITLE:
|
|
1670
|
-
onTitleRef.current?.(payload);
|
|
1671
|
-
break;
|
|
1672
|
-
// SET_PREFERENCES ("2") and anything else: ignored.
|
|
1673
|
-
default:
|
|
1674
|
-
break;
|
|
1675
|
-
}
|
|
1676
|
-
};
|
|
1677
|
-
socket.onerror = () => {
|
|
1678
|
-
if (!disposed) {
|
|
1679
|
-
socketFailedRef.current = false;
|
|
1680
|
-
setStatus("connecting");
|
|
1681
|
-
closeSocket(socket);
|
|
1682
|
-
}
|
|
1683
|
-
};
|
|
1684
|
-
socket.onclose = () => {
|
|
1685
|
-
if (wsRef.current === socket) wsRef.current = null;
|
|
1686
|
-
socketAuthenticatedRef.current = false;
|
|
1687
|
-
if (!disposed) {
|
|
1688
|
-
if (socketFailedRef.current) setStatus("error");
|
|
1689
|
-
else scheduleTransportReconnect();
|
|
1690
|
-
}
|
|
1691
|
-
};
|
|
1692
|
-
return () => {
|
|
1693
|
-
disposed = true;
|
|
1694
|
-
wsRef.current = null;
|
|
1695
|
-
socketAuthenticatedRef.current = false;
|
|
1696
|
-
relayChannelRef.current = null;
|
|
1697
|
-
if (reconnectTimer !== null) clearTimeout(reconnectTimer);
|
|
1698
|
-
socket.onopen = null;
|
|
1699
|
-
socket.onmessage = null;
|
|
1700
|
-
socket.onerror = null;
|
|
1701
|
-
socket.onclose = null;
|
|
1702
|
-
closeSocket(socket);
|
|
1703
|
-
};
|
|
1704
|
-
}, [transport, url, token, expiresAt, reconnectGeneration]);
|
|
1705
|
-
const write = useCallback9((data) => {
|
|
1706
|
-
const currentTransport = transportRef.current;
|
|
1707
|
-
const ws = wsRef.current;
|
|
1708
|
-
if (ws && ws.readyState === WebSocket.OPEN && socketAuthenticatedRef.current) {
|
|
1709
|
-
try {
|
|
1710
|
-
const relayChannel = relayChannelRef.current;
|
|
1711
|
-
if (currentTransport === "relay-pty" && relayChannel) {
|
|
1712
|
-
sendRelayInput(ws, relayChannel, relayInputSequenceRef.current++, data);
|
|
1713
|
-
} else {
|
|
1714
|
-
ws.send(ttydInputFrame(data));
|
|
1715
|
-
}
|
|
1716
|
-
} catch {
|
|
1717
|
-
socketFailedRef.current = false;
|
|
1718
|
-
setStatus("connecting");
|
|
1719
|
-
closeSocket(ws);
|
|
1720
|
-
}
|
|
1721
|
-
} else if ((currentTransport === "pty-ws" || currentTransport === "relay-pty") && !socketFailedRef.current) {
|
|
1722
|
-
const nextSize = pendingInputRef.current.length + data.length;
|
|
1723
|
-
if (nextSize > MAX_PENDING_TERMINAL_INPUT_CODE_UNITS) {
|
|
1724
|
-
pendingInputRef.current = "";
|
|
1725
|
-
socketFailedRef.current = true;
|
|
1726
|
-
setStatus("error");
|
|
1727
|
-
closeSocket(ws);
|
|
1728
|
-
return;
|
|
1729
|
-
}
|
|
1730
|
-
pendingInputRef.current += data;
|
|
1731
|
-
}
|
|
1732
|
-
}, []);
|
|
1733
|
-
const resize = useCallback9((cols, rows) => {
|
|
1734
|
-
if (cols <= 0 || rows <= 0) return;
|
|
1735
|
-
sizeRef.current = { cols, rows };
|
|
1736
|
-
const ws = wsRef.current;
|
|
1737
|
-
if (ws && ws.readyState === WebSocket.OPEN && socketAuthenticatedRef.current) {
|
|
1738
|
-
try {
|
|
1739
|
-
if (transportRef.current === "pty-ws") ws.send(ttydResizeFrame(cols, rows));
|
|
1740
|
-
} catch {
|
|
1741
|
-
}
|
|
1742
|
-
}
|
|
1743
|
-
}, []);
|
|
1744
|
-
const disconnect = useCallback9(() => {
|
|
1745
|
-
const ws = wsRef.current;
|
|
1746
|
-
wsRef.current = null;
|
|
1747
|
-
pendingInputRef.current = "";
|
|
1748
|
-
socketFailedRef.current = false;
|
|
1749
|
-
socketAuthenticatedRef.current = false;
|
|
1750
|
-
relayChannelRef.current = null;
|
|
1751
|
-
setStatus("closed");
|
|
1752
|
-
if (ws) intentionalCloseRef.current.add(ws);
|
|
1753
|
-
closeSocket(ws);
|
|
1754
|
-
}, []);
|
|
1755
|
-
return useMemo4(() => {
|
|
1756
|
-
return { connected: status === "open", status, write, resize, disconnect };
|
|
1757
|
-
}, [status, write, resize, disconnect]);
|
|
1758
|
-
}
|
|
1759
|
-
|
|
1760
1391
|
// src/hooks/use-sandbox-terminal.ts
|
|
1761
1392
|
import { OpenGeniApiError as OpenGeniApiError2 } from "@opengeni/sdk";
|
|
1762
|
-
import { useCallback as
|
|
1393
|
+
import { useCallback as useCallback9, useEffect as useEffect4, useMemo as useMemo4, useRef as useRef3, useState as useState3 } from "react";
|
|
1763
1394
|
function useSandboxTerminal(sessionId, options) {
|
|
1764
1395
|
const { client, workspaceId } = useOpenGeni(options);
|
|
1765
1396
|
const includeAgentFirehose = options.includeAgentFirehose ?? true;
|
|
@@ -1767,20 +1398,20 @@ function useSandboxTerminal(sessionId, options) {
|
|
|
1767
1398
|
const ptyFilter = options.ptyId;
|
|
1768
1399
|
const liveness = options.liveness;
|
|
1769
1400
|
const identityKey = `${workspaceId}\0${sessionId ?? ""}\0${interactive}\0${ptyFilter ?? ""}`;
|
|
1770
|
-
const [openedPtyId, setOpenedPtyId] =
|
|
1771
|
-
const [openError, setOpenError] =
|
|
1772
|
-
const [stateIdentity, setStateIdentity] =
|
|
1773
|
-
const [reopenNonce, setReopenNonce] =
|
|
1774
|
-
const currentIdentityRef =
|
|
1401
|
+
const [openedPtyId, setOpenedPtyId] = useState3(null);
|
|
1402
|
+
const [openError, setOpenError] = useState3(null);
|
|
1403
|
+
const [stateIdentity, setStateIdentity] = useState3(identityKey);
|
|
1404
|
+
const [reopenNonce, setReopenNonce] = useState3(0);
|
|
1405
|
+
const currentIdentityRef = useRef3(identityKey);
|
|
1775
1406
|
currentIdentityRef.current = identityKey;
|
|
1776
|
-
|
|
1407
|
+
useEffect4(() => {
|
|
1777
1408
|
setStateIdentity(identityKey);
|
|
1778
1409
|
setOpenedPtyId(null);
|
|
1779
1410
|
setOpenError(null);
|
|
1780
1411
|
}, [identityKey]);
|
|
1781
|
-
const openInFlight =
|
|
1412
|
+
const openInFlight = useRef3(false);
|
|
1782
1413
|
const boxWarm = liveness === void 0 || sandboxAcceptsLiveIo(liveness);
|
|
1783
|
-
|
|
1414
|
+
useEffect4(() => {
|
|
1784
1415
|
if (!interactive || !sessionId || ptyFilter || !boxWarm) {
|
|
1785
1416
|
setOpenError(null);
|
|
1786
1417
|
return;
|
|
@@ -1810,7 +1441,7 @@ function useSandboxTerminal(sessionId, options) {
|
|
|
1810
1441
|
});
|
|
1811
1442
|
};
|
|
1812
1443
|
}, [interactive, client, workspaceId, sessionId, ptyFilter, boxWarm, reopenNonce]);
|
|
1813
|
-
const { chunks, openPty, supportsInput } =
|
|
1444
|
+
const { chunks, openPty, supportsInput } = useMemo4(() => {
|
|
1814
1445
|
const out = [];
|
|
1815
1446
|
const open = /* @__PURE__ */ new Map();
|
|
1816
1447
|
let lastOpened = null;
|
|
@@ -1863,7 +1494,7 @@ function useSandboxTerminal(sessionId, options) {
|
|
|
1863
1494
|
const identityMatches = stateIdentity === identityKey;
|
|
1864
1495
|
const activePtyId = identityMatches ? openedPtyId ?? openPty : null;
|
|
1865
1496
|
const canWrite = openedPtyId !== null || supportsInput;
|
|
1866
|
-
const write =
|
|
1497
|
+
const write = useMemo4(() => {
|
|
1867
1498
|
if (!activePtyId || !canWrite || !sessionId) return null;
|
|
1868
1499
|
const writeIdentity = identityKey;
|
|
1869
1500
|
return (data) => {
|
|
@@ -1875,7 +1506,7 @@ function useSandboxTerminal(sessionId, options) {
|
|
|
1875
1506
|
});
|
|
1876
1507
|
};
|
|
1877
1508
|
}, [client, workspaceId, sessionId, activePtyId, canWrite, openedPtyId, identityKey]);
|
|
1878
|
-
const close =
|
|
1509
|
+
const close = useCallback9(() => {
|
|
1879
1510
|
if (!activePtyId || !sessionId) return;
|
|
1880
1511
|
void client.terminalPtyClose(workspaceId, sessionId, { ptyId: activePtyId }).catch(() => {
|
|
1881
1512
|
});
|
|
@@ -1891,7 +1522,7 @@ function useSandboxTerminal(sessionId, options) {
|
|
|
1891
1522
|
}
|
|
1892
1523
|
|
|
1893
1524
|
// src/hooks/use-sandbox-git.ts
|
|
1894
|
-
import { useCallback as
|
|
1525
|
+
import { useCallback as useCallback10, useEffect as useEffect5, useMemo as useMemo5, useRef as useRef4, useState as useState4 } from "react";
|
|
1895
1526
|
function normalizeRoot(root) {
|
|
1896
1527
|
const normalized = root.replaceAll("\\", "/").replace(/^\.\/+/, "").replace(/\/+$/, "");
|
|
1897
1528
|
return normalized === "." ? "" : normalized;
|
|
@@ -1957,35 +1588,35 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
1957
1588
|
const repoPathsKey = uniqueRoots(
|
|
1958
1589
|
options.repoPaths && options.repoPaths.length > 0 ? options.repoPaths : [repoPath]
|
|
1959
1590
|
).join("\0");
|
|
1960
|
-
const repoPaths =
|
|
1591
|
+
const repoPaths = useMemo5(() => repoPathsKey.split("\0"), [repoPathsKey]);
|
|
1961
1592
|
const comparison = options.comparison ?? (options.staged ? "staged" : "working");
|
|
1962
1593
|
const hasAdvertisedRepoPaths = (options.repoPaths?.length ?? 0) > 0;
|
|
1963
1594
|
const capture = comparison === "staged" ? null : options.capture ?? null;
|
|
1964
1595
|
const isLive2 = sandboxAcceptsLiveIo(options.liveness);
|
|
1965
1596
|
const acceptsEventReads = options.liveness === void 0 || isLive2;
|
|
1966
|
-
const acceptsEventReadsRef =
|
|
1597
|
+
const acceptsEventReadsRef = useRef4(acceptsEventReads);
|
|
1967
1598
|
acceptsEventReadsRef.current = acceptsEventReads;
|
|
1968
1599
|
const hasLiveIoFence = options.liveness !== void 0;
|
|
1969
1600
|
const identityKey = `${workspaceId}\0${sessionId ?? ""}\0${repoPathsKey}\0${workspaceWide}\0${comparison}`;
|
|
1970
|
-
const [diff, setDiff] =
|
|
1971
|
-
const [branch, setBranch] =
|
|
1972
|
-
const [isRepo, setIsRepo] =
|
|
1973
|
-
const [ahead, setAhead] =
|
|
1974
|
-
const [behind, setBehind] =
|
|
1975
|
-
const [repoRoots, setRepoRoots] =
|
|
1976
|
-
const [source, setSource] =
|
|
1977
|
-
const sourceRef =
|
|
1978
|
-
const [loading, setLoading] =
|
|
1979
|
-
const [error, setError] =
|
|
1980
|
-
const [stateIdentity, setStateIdentity] =
|
|
1981
|
-
const refreshGenerationRef =
|
|
1982
|
-
const refreshAbortRef =
|
|
1983
|
-
const refreshInFlightRef =
|
|
1984
|
-
const refreshPendingRef =
|
|
1985
|
-
const refreshWorkerEpochRef =
|
|
1986
|
-
const lastChangeRef =
|
|
1987
|
-
const eventRefreshTimerRef =
|
|
1988
|
-
const performRefresh =
|
|
1601
|
+
const [diff, setDiff] = useState4([]);
|
|
1602
|
+
const [branch, setBranch] = useState4(null);
|
|
1603
|
+
const [isRepo, setIsRepo] = useState4(false);
|
|
1604
|
+
const [ahead, setAhead] = useState4(0);
|
|
1605
|
+
const [behind, setBehind] = useState4(0);
|
|
1606
|
+
const [repoRoots, setRepoRoots] = useState4([]);
|
|
1607
|
+
const [source, setSource] = useState4(null);
|
|
1608
|
+
const sourceRef = useRef4(null);
|
|
1609
|
+
const [loading, setLoading] = useState4(false);
|
|
1610
|
+
const [error, setError] = useState4(null);
|
|
1611
|
+
const [stateIdentity, setStateIdentity] = useState4(identityKey);
|
|
1612
|
+
const refreshGenerationRef = useRef4(0);
|
|
1613
|
+
const refreshAbortRef = useRef4(null);
|
|
1614
|
+
const refreshInFlightRef = useRef4(null);
|
|
1615
|
+
const refreshPendingRef = useRef4(false);
|
|
1616
|
+
const refreshWorkerEpochRef = useRef4(0);
|
|
1617
|
+
const lastChangeRef = useRef4(0);
|
|
1618
|
+
const eventRefreshTimerRef = useRef4(null);
|
|
1619
|
+
const performRefresh = useCallback10(async () => {
|
|
1989
1620
|
if (!sessionId) return;
|
|
1990
1621
|
const refreshAbort = new AbortController();
|
|
1991
1622
|
refreshAbortRef.current = refreshAbort;
|
|
@@ -2097,9 +1728,9 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
2097
1728
|
workspaceWide,
|
|
2098
1729
|
comparison
|
|
2099
1730
|
]);
|
|
2100
|
-
const performRefreshRef =
|
|
1731
|
+
const performRefreshRef = useRef4(performRefresh);
|
|
2101
1732
|
performRefreshRef.current = performRefresh;
|
|
2102
|
-
const refresh =
|
|
1733
|
+
const refresh = useCallback10(async () => {
|
|
2103
1734
|
refreshPendingRef.current = true;
|
|
2104
1735
|
const existing = refreshInFlightRef.current;
|
|
2105
1736
|
if (existing) return await existing;
|
|
@@ -2117,7 +1748,7 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
2117
1748
|
if (refreshInFlightRef.current === run) refreshInFlightRef.current = null;
|
|
2118
1749
|
}
|
|
2119
1750
|
}, []);
|
|
2120
|
-
const seedFromCapture =
|
|
1751
|
+
const seedFromCapture = useCallback10(
|
|
2121
1752
|
(manifest) => {
|
|
2122
1753
|
const repositories = workspaceWide ? manifest.repos : [repoForPath(manifest, repoPath)].filter(Boolean);
|
|
2123
1754
|
if (comparison === "branch" && repositories.some((repo) => repo.branchDiff === void 0)) {
|
|
@@ -2154,11 +1785,11 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
2154
1785
|
},
|
|
2155
1786
|
[comparison, repoPath, workspaceWide]
|
|
2156
1787
|
);
|
|
2157
|
-
const captureRef =
|
|
1788
|
+
const captureRef = useRef4(capture);
|
|
2158
1789
|
captureRef.current = capture;
|
|
2159
1790
|
const captureRevision = capture?.revision ?? null;
|
|
2160
|
-
const previousIdentityRef =
|
|
2161
|
-
|
|
1791
|
+
const previousIdentityRef = useRef4(identityKey);
|
|
1792
|
+
useEffect5(() => {
|
|
2162
1793
|
refreshAbortRef.current?.abort();
|
|
2163
1794
|
refreshAbortRef.current = null;
|
|
2164
1795
|
refreshPendingRef.current = false;
|
|
@@ -2214,7 +1845,7 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
2214
1845
|
seedFromCapture
|
|
2215
1846
|
]);
|
|
2216
1847
|
const events = options.events;
|
|
2217
|
-
|
|
1848
|
+
useEffect5(() => {
|
|
2218
1849
|
if (!enabled || !events) {
|
|
2219
1850
|
if (eventRefreshTimerRef.current) {
|
|
2220
1851
|
clearTimeout(eventRefreshTimerRef.current);
|
|
@@ -2251,7 +1882,7 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
2251
1882
|
}, 150);
|
|
2252
1883
|
}
|
|
2253
1884
|
}, [enabled, active, acceptsEventReads, events, refresh]);
|
|
2254
|
-
|
|
1885
|
+
useEffect5(
|
|
2255
1886
|
() => () => {
|
|
2256
1887
|
if (eventRefreshTimerRef.current) clearTimeout(eventRefreshTimerRef.current);
|
|
2257
1888
|
},
|
|
@@ -2276,7 +1907,7 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
2276
1907
|
}
|
|
2277
1908
|
|
|
2278
1909
|
// src/hooks/use-workspace-capture.ts
|
|
2279
|
-
import { useCallback as
|
|
1910
|
+
import { useCallback as useCallback11, useEffect as useEffect6, useRef as useRef5, useState as useState5 } from "react";
|
|
2280
1911
|
var REVISION_CAPTURED = "workspace.revision.captured";
|
|
2281
1912
|
var REVISION_DEGRADED = "workspace.revision.degraded";
|
|
2282
1913
|
var MANIFEST_FETCH_TIMEOUT_MS = 15e3;
|
|
@@ -2315,18 +1946,18 @@ function useWorkspaceCapture(sessionId, options = {}) {
|
|
|
2315
1946
|
const { client, workspaceId } = useOpenGeni(options);
|
|
2316
1947
|
const enabled = (options.enabled ?? true) && Boolean(sessionId);
|
|
2317
1948
|
const identityKey = `${workspaceId}\0${sessionId ?? ""}`;
|
|
2318
|
-
const [capture, setCapture] =
|
|
2319
|
-
const [available, setAvailable] =
|
|
2320
|
-
const [degradedReason, setDegradedReason] =
|
|
2321
|
-
const [fileCount, setFileCount] =
|
|
2322
|
-
const [loading, setLoading] =
|
|
2323
|
-
const [error, setError] =
|
|
2324
|
-
const [announcedRevision, setAnnouncedRevision] =
|
|
2325
|
-
const [stateIdentity, setStateIdentity] =
|
|
2326
|
-
const generationRef =
|
|
2327
|
-
const requestAbortRef =
|
|
2328
|
-
const lastSeqRef =
|
|
2329
|
-
const refresh =
|
|
1949
|
+
const [capture, setCapture] = useState5(null);
|
|
1950
|
+
const [available, setAvailable] = useState5(false);
|
|
1951
|
+
const [degradedReason, setDegradedReason] = useState5(null);
|
|
1952
|
+
const [fileCount, setFileCount] = useState5(null);
|
|
1953
|
+
const [loading, setLoading] = useState5(false);
|
|
1954
|
+
const [error, setError] = useState5(null);
|
|
1955
|
+
const [announcedRevision, setAnnouncedRevision] = useState5(null);
|
|
1956
|
+
const [stateIdentity, setStateIdentity] = useState5(identityKey);
|
|
1957
|
+
const generationRef = useRef5(0);
|
|
1958
|
+
const requestAbortRef = useRef5(null);
|
|
1959
|
+
const lastSeqRef = useRef5(0);
|
|
1960
|
+
const refresh = useCallback11(async () => {
|
|
2330
1961
|
if (!sessionId) return;
|
|
2331
1962
|
requestAbortRef.current?.abort();
|
|
2332
1963
|
const requestAbort = new AbortController();
|
|
@@ -2399,7 +2030,7 @@ function useWorkspaceCapture(sessionId, options = {}) {
|
|
|
2399
2030
|
if (requestAbortRef.current === requestAbort) requestAbortRef.current = null;
|
|
2400
2031
|
}
|
|
2401
2032
|
}, [client, workspaceId, sessionId, identityKey]);
|
|
2402
|
-
|
|
2033
|
+
useEffect6(() => {
|
|
2403
2034
|
requestAbortRef.current?.abort();
|
|
2404
2035
|
requestAbortRef.current = null;
|
|
2405
2036
|
generationRef.current += 1;
|
|
@@ -2422,7 +2053,7 @@ function useWorkspaceCapture(sessionId, options = {}) {
|
|
|
2422
2053
|
};
|
|
2423
2054
|
}, [enabled, refresh]);
|
|
2424
2055
|
const events = options.events;
|
|
2425
|
-
|
|
2056
|
+
useEffect6(() => {
|
|
2426
2057
|
if (!enabled || !events) return;
|
|
2427
2058
|
let newest = null;
|
|
2428
2059
|
for (const event of events) {
|
|
@@ -2448,7 +2079,7 @@ function useWorkspaceCapture(sessionId, options = {}) {
|
|
|
2448
2079
|
const visibleCapture = identityMatches ? capture : null;
|
|
2449
2080
|
const visibleAnnouncedRevision = identityMatches ? announcedRevision : null;
|
|
2450
2081
|
const loadedRevision = visibleCapture?.revision ?? null;
|
|
2451
|
-
|
|
2082
|
+
useEffect6(() => {
|
|
2452
2083
|
if (!enabled) return;
|
|
2453
2084
|
if (visibleAnnouncedRevision === null) return;
|
|
2454
2085
|
if (loadedRevision !== null && visibleAnnouncedRevision <= loadedRevision) return;
|
|
@@ -2471,7 +2102,7 @@ function useWorkspaceCapture(sessionId, options = {}) {
|
|
|
2471
2102
|
}
|
|
2472
2103
|
|
|
2473
2104
|
// src/hooks/use-workspace-edit.ts
|
|
2474
|
-
import { useCallback as
|
|
2105
|
+
import { useCallback as useCallback12, useEffect as useEffect7, useMemo as useMemo6, useRef as useRef6, useState as useState6 } from "react";
|
|
2475
2106
|
function isLive(liveness) {
|
|
2476
2107
|
return sandboxAcceptsLiveIo(liveness);
|
|
2477
2108
|
}
|
|
@@ -2481,27 +2112,27 @@ function useWorkspaceEdit(sessionId, options = {}) {
|
|
|
2481
2112
|
const baseContent = options.baseContent ?? null;
|
|
2482
2113
|
const routeEpoch = options.route?.epoch;
|
|
2483
2114
|
const routeRoot = options.route?.root;
|
|
2484
|
-
const route =
|
|
2115
|
+
const route = useMemo6(
|
|
2485
2116
|
() => routeEpoch !== void 0 && routeRoot !== void 0 ? { epoch: routeEpoch, root: routeRoot } : void 0,
|
|
2486
2117
|
[routeEpoch, routeRoot]
|
|
2487
2118
|
);
|
|
2488
2119
|
const live = isLive(options.liveness);
|
|
2489
2120
|
const offline = options.offline === true;
|
|
2490
2121
|
const identityKey = `${workspaceId}\0${sessionId ?? ""}\0${path ?? ""}\0${routeEpoch ?? ""}\0${routeRoot ?? ""}`;
|
|
2491
|
-
const [buffer, setBuffer] =
|
|
2492
|
-
const [wantsWarm, setWantsWarm] =
|
|
2493
|
-
const [flush, setFlush] =
|
|
2494
|
-
const [conflict, setConflict] =
|
|
2495
|
-
const [error, setError] =
|
|
2496
|
-
const [stateIdentity, setStateIdentity] =
|
|
2122
|
+
const [buffer, setBuffer] = useState6(null);
|
|
2123
|
+
const [wantsWarm, setWantsWarm] = useState6(false);
|
|
2124
|
+
const [flush, setFlush] = useState6("idle");
|
|
2125
|
+
const [conflict, setConflict] = useState6(null);
|
|
2126
|
+
const [error, setError] = useState6(null);
|
|
2127
|
+
const [stateIdentity, setStateIdentity] = useState6(identityKey);
|
|
2497
2128
|
const onWarmRequested = options.onWarmRequested;
|
|
2498
|
-
const bufferRef =
|
|
2129
|
+
const bufferRef = useRef6(null);
|
|
2499
2130
|
bufferRef.current = buffer;
|
|
2500
|
-
const flushingRef =
|
|
2501
|
-
const identityGenerationRef =
|
|
2502
|
-
const flushAttemptRef =
|
|
2503
|
-
const readAbortRef =
|
|
2504
|
-
|
|
2131
|
+
const flushingRef = useRef6(false);
|
|
2132
|
+
const identityGenerationRef = useRef6(0);
|
|
2133
|
+
const flushAttemptRef = useRef6(0);
|
|
2134
|
+
const readAbortRef = useRef6(null);
|
|
2135
|
+
useEffect7(() => {
|
|
2505
2136
|
identityGenerationRef.current += 1;
|
|
2506
2137
|
flushAttemptRef.current += 1;
|
|
2507
2138
|
readAbortRef.current?.abort();
|
|
@@ -2520,7 +2151,7 @@ function useWorkspaceEdit(sessionId, options = {}) {
|
|
|
2520
2151
|
readAbortRef.current = null;
|
|
2521
2152
|
};
|
|
2522
2153
|
}, [identityKey]);
|
|
2523
|
-
const edit =
|
|
2154
|
+
const edit = useCallback12(
|
|
2524
2155
|
(content) => {
|
|
2525
2156
|
if (stateIdentity !== identityKey) return;
|
|
2526
2157
|
if (offline) return;
|
|
@@ -2536,7 +2167,7 @@ function useWorkspaceEdit(sessionId, options = {}) {
|
|
|
2536
2167
|
},
|
|
2537
2168
|
[offline, live, onWarmRequested, stateIdentity, identityKey]
|
|
2538
2169
|
);
|
|
2539
|
-
const doFlush =
|
|
2170
|
+
const doFlush = useCallback12(
|
|
2540
2171
|
async (force) => {
|
|
2541
2172
|
if (stateIdentity !== identityKey) return;
|
|
2542
2173
|
if (!sessionId || !path) return;
|
|
@@ -2591,17 +2222,17 @@ function useWorkspaceEdit(sessionId, options = {}) {
|
|
|
2591
2222
|
},
|
|
2592
2223
|
[client, workspaceId, sessionId, path, baseContent, route, stateIdentity, identityKey]
|
|
2593
2224
|
);
|
|
2594
|
-
|
|
2225
|
+
useEffect7(() => {
|
|
2595
2226
|
if (offline) return;
|
|
2596
2227
|
if (!live) return;
|
|
2597
2228
|
if (buffer === null) return;
|
|
2598
2229
|
if (flush === "flushed" || flush === "conflict" || flush === "flushing") return;
|
|
2599
2230
|
void doFlush(false);
|
|
2600
2231
|
}, [offline, live, buffer, flush, doFlush]);
|
|
2601
|
-
const overwrite =
|
|
2232
|
+
const overwrite = useCallback12(async () => {
|
|
2602
2233
|
await doFlush(true);
|
|
2603
2234
|
}, [doFlush]);
|
|
2604
|
-
const discard =
|
|
2235
|
+
const discard = useCallback12(() => {
|
|
2605
2236
|
setBuffer(null);
|
|
2606
2237
|
setWantsWarm(false);
|
|
2607
2238
|
setFlush("idle");
|
|
@@ -2641,7 +2272,7 @@ function useWorkspaceEdit(sessionId, options = {}) {
|
|
|
2641
2272
|
}
|
|
2642
2273
|
|
|
2643
2274
|
// src/hooks/use-machine-chip.ts
|
|
2644
|
-
import { useMemo as
|
|
2275
|
+
import { useMemo as useMemo7 } from "react";
|
|
2645
2276
|
function formatAsOf(capturedAt, now) {
|
|
2646
2277
|
const then = Date.parse(capturedAt);
|
|
2647
2278
|
if (Number.isNaN(then)) return "recently";
|
|
@@ -2691,7 +2322,7 @@ function useMachineChip(input) {
|
|
|
2691
2322
|
capturedAt,
|
|
2692
2323
|
now
|
|
2693
2324
|
} = input;
|
|
2694
|
-
return
|
|
2325
|
+
return useMemo7(
|
|
2695
2326
|
() => deriveMachineChip({
|
|
2696
2327
|
liveness,
|
|
2697
2328
|
capabilitiesState,
|
|
@@ -2770,585 +2401,22 @@ function FleetTile({ session, title, subtitle, onOpen, className }) {
|
|
|
2770
2401
|
);
|
|
2771
2402
|
}
|
|
2772
2403
|
|
|
2773
|
-
// src/components/sandbox-terminal.tsx
|
|
2774
|
-
import { useEffect as useEffect9, useLayoutEffect, useRef as useRef8, useState as useState8 } from "react";
|
|
2775
|
-
|
|
2776
|
-
// src/lib/xterm-theme.ts
|
|
2777
|
-
var DARK_ANSI = {
|
|
2778
|
-
black: "oklch(0.3 0 0)",
|
|
2779
|
-
red: "oklch(0.68 0.17 22)",
|
|
2780
|
-
green: "oklch(0.75 0.13 155)",
|
|
2781
|
-
yellow: "oklch(0.8 0.11 80)",
|
|
2782
|
-
blue: "oklch(0.7 0.14 255)",
|
|
2783
|
-
magenta: "oklch(0.72 0.13 305)",
|
|
2784
|
-
cyan: "oklch(0.75 0.1 210)",
|
|
2785
|
-
white: "oklch(0.8 0 0)",
|
|
2786
|
-
brightBlack: "oklch(0.45 0 0)",
|
|
2787
|
-
brightRed: "oklch(0.76 0.17 22)",
|
|
2788
|
-
brightGreen: "oklch(0.82 0.14 155)",
|
|
2789
|
-
brightYellow: "oklch(0.86 0.12 85)",
|
|
2790
|
-
brightBlue: "oklch(0.78 0.13 255)",
|
|
2791
|
-
brightMagenta: "oklch(0.8 0.13 305)",
|
|
2792
|
-
brightCyan: "oklch(0.83 0.1 200)",
|
|
2793
|
-
brightWhite: "oklch(0.97 0 0)",
|
|
2794
|
-
selectionBackground: "oklch(0.8 0 0 / 0.3)",
|
|
2795
|
-
selectionForeground: "oklch(0.985 0 0)",
|
|
2796
|
-
selectionInactiveBackground: "oklch(0.72 0 0 / 0.2)"
|
|
2797
|
-
};
|
|
2798
|
-
var LIGHT_ANSI = {
|
|
2799
|
-
black: "oklch(0.35 0 0)",
|
|
2800
|
-
red: "oklch(0.52 0.19 22)",
|
|
2801
|
-
green: "oklch(0.5 0.13 155)",
|
|
2802
|
-
yellow: "oklch(0.56 0.13 80)",
|
|
2803
|
-
blue: "oklch(0.52 0.18 255)",
|
|
2804
|
-
magenta: "oklch(0.52 0.16 305)",
|
|
2805
|
-
cyan: "oklch(0.52 0.1 210)",
|
|
2806
|
-
white: "oklch(0.7 0 0)",
|
|
2807
|
-
brightBlack: "oklch(0.5 0 0)",
|
|
2808
|
-
brightRed: "oklch(0.55 0.2 22)",
|
|
2809
|
-
brightGreen: "oklch(0.54 0.14 155)",
|
|
2810
|
-
brightYellow: "oklch(0.6 0.14 80)",
|
|
2811
|
-
brightBlue: "oklch(0.48 0.19 255)",
|
|
2812
|
-
brightMagenta: "oklch(0.54 0.17 305)",
|
|
2813
|
-
brightCyan: "oklch(0.54 0.11 210)",
|
|
2814
|
-
brightWhite: "oklch(0.3 0 0)",
|
|
2815
|
-
selectionBackground: "oklch(0.45 0 0 / 0.2)",
|
|
2816
|
-
selectionForeground: "oklch(0.21 0 0)",
|
|
2817
|
-
selectionInactiveBackground: "oklch(0.6 0 0 / 0.14)"
|
|
2818
|
-
};
|
|
2819
|
-
function ogAnsiPalette(mode) {
|
|
2820
|
-
return mode === "light" ? LIGHT_ANSI : DARK_ANSI;
|
|
2821
|
-
}
|
|
2822
|
-
function buildXtermTheme(read, mode) {
|
|
2823
|
-
const ansi = ogAnsiPalette(mode);
|
|
2824
|
-
const bgFallback = mode === "light" ? "#ffffff" : "#202020";
|
|
2825
|
-
const fgFallback = mode === "light" ? "#242424" : "#e6e6e6";
|
|
2826
|
-
const bg = read("--og-color-bg") ?? bgFallback;
|
|
2827
|
-
const fg = read("--og-color-fg") ?? fgFallback;
|
|
2828
|
-
const accent = read("--og-color-accent") ?? ansi.brightBlue;
|
|
2829
|
-
return {
|
|
2830
|
-
// Match the dock surface the terminal paints on (`--og-color-bg`).
|
|
2831
|
-
background: bg,
|
|
2832
|
-
foreground: fg,
|
|
2833
|
-
cursor: accent,
|
|
2834
|
-
cursorAccent: bg,
|
|
2835
|
-
selectionBackground: ansi.selectionBackground,
|
|
2836
|
-
selectionForeground: ansi.selectionForeground,
|
|
2837
|
-
selectionInactiveBackground: ansi.selectionInactiveBackground,
|
|
2838
|
-
black: ansi.black,
|
|
2839
|
-
red: ansi.red,
|
|
2840
|
-
green: ansi.green,
|
|
2841
|
-
yellow: ansi.yellow,
|
|
2842
|
-
blue: ansi.blue,
|
|
2843
|
-
magenta: ansi.magenta,
|
|
2844
|
-
cyan: ansi.cyan,
|
|
2845
|
-
white: ansi.white,
|
|
2846
|
-
brightBlack: ansi.brightBlack,
|
|
2847
|
-
brightRed: ansi.brightRed,
|
|
2848
|
-
brightGreen: ansi.brightGreen,
|
|
2849
|
-
brightYellow: ansi.brightYellow,
|
|
2850
|
-
brightBlue: ansi.brightBlue,
|
|
2851
|
-
brightMagenta: ansi.brightMagenta,
|
|
2852
|
-
brightCyan: ansi.brightCyan,
|
|
2853
|
-
brightWhite: ansi.brightWhite
|
|
2854
|
-
};
|
|
2855
|
-
}
|
|
2856
|
-
function detectMode(el, style) {
|
|
2857
|
-
const closest = el.closest?.bind(el);
|
|
2858
|
-
if (closest) {
|
|
2859
|
-
if (closest('[data-og-theme="light"]') || closest(".og-light")) return "light";
|
|
2860
|
-
const explicit = closest("[data-og-theme]");
|
|
2861
|
-
if (explicit) return explicit.getAttribute("data-og-theme") === "light" ? "light" : "dark";
|
|
2862
|
-
}
|
|
2863
|
-
const scheme = (style.getPropertyValue("color-scheme").trim() || style.colorScheme || "").toLowerCase();
|
|
2864
|
-
if (scheme.includes("light") && !scheme.includes("dark")) return "light";
|
|
2865
|
-
return "dark";
|
|
2866
|
-
}
|
|
2867
|
-
function xtermThemeFromTokens(root) {
|
|
2868
|
-
if (typeof window === "undefined" || typeof getComputedStyle === "undefined") return void 0;
|
|
2869
|
-
const el = root ?? (typeof document !== "undefined" ? document.querySelector("[data-og-theme]") ?? document.documentElement : null);
|
|
2870
|
-
if (!el) return void 0;
|
|
2871
|
-
const style = getComputedStyle(el);
|
|
2872
|
-
const read = (name) => {
|
|
2873
|
-
const value = style.getPropertyValue(name).trim();
|
|
2874
|
-
return value || void 0;
|
|
2875
|
-
};
|
|
2876
|
-
return buildXtermTheme(read, detectMode(el, style));
|
|
2877
|
-
}
|
|
2878
|
-
var FALLBACK_MONO = "ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace";
|
|
2879
|
-
function resolveTerminalFontFromReader(read, overrides) {
|
|
2880
|
-
const rawFamily = overrides?.fontFamily ?? read("--og-font-mono");
|
|
2881
|
-
const fontFamily = rawFamily && rawFamily.trim() && !rawFamily.includes("var(") ? rawFamily.trim() : FALLBACK_MONO;
|
|
2882
|
-
let fontSize = overrides?.fontSize;
|
|
2883
|
-
if (fontSize == null) {
|
|
2884
|
-
const raw = read("--og-code-font-size");
|
|
2885
|
-
const parsed = raw ? Number.parseFloat(raw) : Number.NaN;
|
|
2886
|
-
fontSize = Number.isFinite(parsed) && parsed > 0 ? parsed : 13;
|
|
2887
|
-
}
|
|
2888
|
-
return { fontFamily, fontSize, lineHeight: 1.3 };
|
|
2889
|
-
}
|
|
2890
|
-
function resolveTerminalFont(el, overrides) {
|
|
2891
|
-
const style = getComputedStyle(el);
|
|
2892
|
-
const read = (name) => {
|
|
2893
|
-
const value = style.getPropertyValue(name).trim();
|
|
2894
|
-
return value || void 0;
|
|
2895
|
-
};
|
|
2896
|
-
return resolveTerminalFontFromReader(read, overrides);
|
|
2897
|
-
}
|
|
2898
|
-
|
|
2899
|
-
// src/lib/xterm-renderer.ts
|
|
2900
|
-
var ORDER = ["webgl", "canvas", "dom"];
|
|
2901
|
-
function nextRendererTier(tier) {
|
|
2902
|
-
const i = ORDER.indexOf(tier);
|
|
2903
|
-
return i >= 0 && i < ORDER.length - 1 ? ORDER[i + 1] : null;
|
|
2904
|
-
}
|
|
2905
|
-
async function attachRenderer(prefer, loaders, onTier) {
|
|
2906
|
-
const start = Math.max(0, ORDER.indexOf(prefer));
|
|
2907
|
-
for (let i = start; i < ORDER.length; i++) {
|
|
2908
|
-
const tier = ORDER[i];
|
|
2909
|
-
if (tier === "dom") break;
|
|
2910
|
-
const loader = tier === "webgl" ? loaders.webgl : loaders.canvas;
|
|
2911
|
-
if (!loader) continue;
|
|
2912
|
-
try {
|
|
2913
|
-
const downgrade = nextRendererTier(tier) ?? "dom";
|
|
2914
|
-
await loader(() => {
|
|
2915
|
-
void attachRenderer(downgrade, loaders, onTier);
|
|
2916
|
-
});
|
|
2917
|
-
onTier(tier);
|
|
2918
|
-
return tier;
|
|
2919
|
-
} catch {
|
|
2920
|
-
}
|
|
2921
|
-
}
|
|
2922
|
-
onTier("dom");
|
|
2923
|
-
return "dom";
|
|
2924
|
-
}
|
|
2925
|
-
|
|
2926
|
-
// src/components/sandbox-terminal.tsx
|
|
2927
|
-
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2928
|
-
function terminalSurfaceState(input) {
|
|
2929
|
-
if (!input.ready) return "loading";
|
|
2930
|
-
if (input.acceptsInput) return "interactive";
|
|
2931
|
-
if (input.inputPending) return "connecting";
|
|
2932
|
-
if (input.ptyStatus === "connecting") return "connecting";
|
|
2933
|
-
if (input.ptyStatus === "error") return "error";
|
|
2934
|
-
if (input.booting) return "waking";
|
|
2935
|
-
return "output-only";
|
|
2936
|
-
}
|
|
2937
|
-
function subscribeTerminalInput(term, sink, enabled) {
|
|
2938
|
-
if (!enabled || !term || !sink) return null;
|
|
2939
|
-
return term.onData(sink);
|
|
2940
|
-
}
|
|
2941
|
-
function clearTerminalBootStatus(term) {
|
|
2942
|
-
term.write("\r\x1B[2K\x1B[2J\x1B[H");
|
|
2943
|
-
}
|
|
2944
|
-
function forcedRendererFailures() {
|
|
2945
|
-
const raw = typeof globalThis !== "undefined" ? globalThis.__OG_FORCE_RENDERER_FAIL__ : void 0;
|
|
2946
|
-
const set = /* @__PURE__ */ new Set();
|
|
2947
|
-
if (typeof raw === "string") {
|
|
2948
|
-
for (const tier of raw.split(/[\s,]+/)) {
|
|
2949
|
-
if (tier === "webgl" || tier === "canvas") set.add(tier);
|
|
2950
|
-
}
|
|
2951
|
-
}
|
|
2952
|
-
return set;
|
|
2953
|
-
}
|
|
2954
|
-
function SandboxTerminal({
|
|
2955
|
-
result,
|
|
2956
|
-
terminalCapability,
|
|
2957
|
-
theme,
|
|
2958
|
-
fontFamily,
|
|
2959
|
-
fontSize,
|
|
2960
|
-
liveness,
|
|
2961
|
-
readOnly,
|
|
2962
|
-
placeholder,
|
|
2963
|
-
showHeader,
|
|
2964
|
-
shell,
|
|
2965
|
-
onActivate,
|
|
2966
|
-
onReconnectNeeded,
|
|
2967
|
-
className
|
|
2968
|
-
}) {
|
|
2969
|
-
const containerRef = useRef8(null);
|
|
2970
|
-
const termRef = useRef8(null);
|
|
2971
|
-
const fitRef = useRef8(null);
|
|
2972
|
-
const rendererRef = useRef8(null);
|
|
2973
|
-
const writtenRef = useRef8(/* @__PURE__ */ new Set());
|
|
2974
|
-
const wroteFirehoseRef = useRef8(false);
|
|
2975
|
-
const bootActiveRef = useRef8(false);
|
|
2976
|
-
const [ready, setReady] = useState8(false);
|
|
2977
|
-
const [inputReady, setInputReady] = useState8(false);
|
|
2978
|
-
const [activated, setActivated] = useState8(false);
|
|
2979
|
-
const ptyDescriptor = terminalCapability?.transport === "pty-ws" || terminalCapability?.transport === "relay-pty";
|
|
2980
|
-
const ptyAttachable = terminalCanAcquirePty(terminalCapability);
|
|
2981
|
-
const {
|
|
2982
|
-
status: ptyStatus,
|
|
2983
|
-
write: ptyWrite,
|
|
2984
|
-
resize: resizePty,
|
|
2985
|
-
connected: ptyConnected
|
|
2986
|
-
} = useTerminalStream({
|
|
2987
|
-
// Connect only after xterm exists. This makes the renderer the sole output
|
|
2988
|
-
// owner from the first websocket frame and removes an otherwise unbounded
|
|
2989
|
-
// pre-mount output queue during large command bursts.
|
|
2990
|
-
capability: ptyAttachable && ready ? {
|
|
2991
|
-
transport: terminalCapability.transport,
|
|
2992
|
-
url: ptyDescriptor ? terminalCapability.url : null,
|
|
2993
|
-
token: ptyDescriptor ? terminalCapability.token : null,
|
|
2994
|
-
expiresAt: ptyDescriptor ? terminalCapability.expiresAt : null
|
|
2995
|
-
} : null,
|
|
2996
|
-
onOutput: (data) => {
|
|
2997
|
-
termRef.current?.write(data);
|
|
2998
|
-
},
|
|
2999
|
-
onReconnectNeeded
|
|
3000
|
-
});
|
|
3001
|
-
const ptyMode = ptyDescriptor;
|
|
3002
|
-
const ptyCapturesInput = ptyAttachable && ptyStatus !== "error";
|
|
3003
|
-
const interactive = !readOnly && (ptyAttachable ? ptyCapturesInput : result.write !== null);
|
|
3004
|
-
const acceptsInput = inputReady && (!ptyAttachable || ptyConnected);
|
|
3005
|
-
const inputPending = inputReady && ptyAttachable && !ptyConnected && activated;
|
|
3006
|
-
let terminalModeLabel;
|
|
3007
|
-
if (readOnly) terminalModeLabel = "read-only";
|
|
3008
|
-
else if (!ptyAttachable) terminalModeLabel = acceptsInput ? null : "output only";
|
|
3009
|
-
else if (ptyStatus === "error") terminalModeLabel = "connection error";
|
|
3010
|
-
else if (acceptsInput) terminalModeLabel = null;
|
|
3011
|
-
else terminalModeLabel = activated ? "connecting" : "connect on input";
|
|
3012
|
-
const warm = sandboxAcceptsLiveIo(liveness);
|
|
3013
|
-
const booting = activated && !ptyMode && !warm && liveness !== null && liveness !== void 0 && result.chunks.length === 0;
|
|
3014
|
-
const surfaceState = terminalSurfaceState({
|
|
3015
|
-
ready,
|
|
3016
|
-
acceptsInput,
|
|
3017
|
-
inputPending,
|
|
3018
|
-
ptyStatus,
|
|
3019
|
-
booting
|
|
3020
|
-
});
|
|
3021
|
-
function handleActivate() {
|
|
3022
|
-
const term = termRef.current;
|
|
3023
|
-
if (term && !readOnly && (ptyAttachable || result.write !== null)) {
|
|
3024
|
-
term.options.disableStdin = false;
|
|
3025
|
-
term.options.cursorBlink = true;
|
|
3026
|
-
}
|
|
3027
|
-
term?.focus();
|
|
3028
|
-
if (!activated) setActivated(true);
|
|
3029
|
-
onActivate?.();
|
|
3030
|
-
}
|
|
3031
|
-
useEffect9(() => {
|
|
3032
|
-
if (typeof window === "undefined") return;
|
|
3033
|
-
const el = containerRef.current;
|
|
3034
|
-
if (!el) return;
|
|
3035
|
-
let disposed = false;
|
|
3036
|
-
const waitForSize = (node) => new Promise((resolve) => {
|
|
3037
|
-
if (node.clientWidth > 0 && node.clientHeight > 0) return resolve();
|
|
3038
|
-
const ro = new ResizeObserver(() => {
|
|
3039
|
-
if (node.clientWidth > 0 && node.clientHeight > 0) {
|
|
3040
|
-
ro.disconnect();
|
|
3041
|
-
resolve();
|
|
3042
|
-
}
|
|
3043
|
-
});
|
|
3044
|
-
ro.observe(node);
|
|
3045
|
-
setTimeout(() => {
|
|
3046
|
-
ro.disconnect();
|
|
3047
|
-
resolve();
|
|
3048
|
-
}, 1e3);
|
|
3049
|
-
});
|
|
3050
|
-
ensureXtermBaseCss();
|
|
3051
|
-
void (async () => {
|
|
3052
|
-
const [{ Terminal }, { FitAddon }, { WebLinksAddon }] = await Promise.all([
|
|
3053
|
-
import("@xterm/xterm"),
|
|
3054
|
-
import("@xterm/addon-fit"),
|
|
3055
|
-
import("@xterm/addon-web-links")
|
|
3056
|
-
]);
|
|
3057
|
-
if (disposed) return;
|
|
3058
|
-
await waitForSize(el);
|
|
3059
|
-
if (disposed) return;
|
|
3060
|
-
const font = resolveTerminalFont(el, { fontFamily, fontSize });
|
|
3061
|
-
const initialTheme = theme ?? xtermThemeFromTokens(el);
|
|
3062
|
-
const term = new Terminal({
|
|
3063
|
-
convertEol: true,
|
|
3064
|
-
disableStdin: !interactive,
|
|
3065
|
-
cursorBlink: interactive,
|
|
3066
|
-
fontFamily: font.fontFamily,
|
|
3067
|
-
fontSize: font.fontSize,
|
|
3068
|
-
lineHeight: font.lineHeight,
|
|
3069
|
-
...initialTheme ? { theme: initialTheme } : {}
|
|
3070
|
-
});
|
|
3071
|
-
const fit = new FitAddon();
|
|
3072
|
-
term.loadAddon(fit);
|
|
3073
|
-
term.loadAddon(
|
|
3074
|
-
new WebLinksAddon(
|
|
3075
|
-
(_e, uri) => window.open(uri, "_blank", "noopener,noreferrer")
|
|
3076
|
-
)
|
|
3077
|
-
);
|
|
3078
|
-
term.open(el);
|
|
3079
|
-
termRef.current = term;
|
|
3080
|
-
fitRef.current = fit;
|
|
3081
|
-
const failSet = forcedRendererFailures();
|
|
3082
|
-
const loaders = {
|
|
3083
|
-
webgl: async (onLoss) => {
|
|
3084
|
-
if (failSet.has("webgl")) throw new Error("forced webgl failure");
|
|
3085
|
-
const { WebglAddon } = await import("@xterm/addon-webgl");
|
|
3086
|
-
const addon = new WebglAddon();
|
|
3087
|
-
addon.onContextLoss?.(() => {
|
|
3088
|
-
try {
|
|
3089
|
-
addon.dispose();
|
|
3090
|
-
} catch {
|
|
3091
|
-
}
|
|
3092
|
-
onLoss();
|
|
3093
|
-
});
|
|
3094
|
-
term.loadAddon(addon);
|
|
3095
|
-
return addon;
|
|
3096
|
-
}
|
|
3097
|
-
};
|
|
3098
|
-
await attachRenderer("webgl", loaders, (tier) => {
|
|
3099
|
-
rendererRef.current = tier;
|
|
3100
|
-
el.setAttribute("data-og-term-renderer", tier);
|
|
3101
|
-
});
|
|
3102
|
-
if (disposed) return;
|
|
3103
|
-
const settle = () => {
|
|
3104
|
-
try {
|
|
3105
|
-
fit.fit();
|
|
3106
|
-
} catch {
|
|
3107
|
-
}
|
|
3108
|
-
};
|
|
3109
|
-
settle();
|
|
3110
|
-
requestAnimationFrame(() => {
|
|
3111
|
-
if (disposed) return;
|
|
3112
|
-
settle();
|
|
3113
|
-
el.setAttribute("data-og-term-ready", "true");
|
|
3114
|
-
if (typeof globalThis.__OG_TERMINAL_DEBUG__ === "function") {
|
|
3115
|
-
globalThis.__OG_TERMINAL_DEBUG__({
|
|
3116
|
-
renderer: rendererRef.current,
|
|
3117
|
-
fontFamily: term.options.fontFamily,
|
|
3118
|
-
fontSize: term.options.fontSize,
|
|
3119
|
-
hasVarInFont: String(term.options.fontFamily ?? "").includes("var("),
|
|
3120
|
-
theme: term.options.theme,
|
|
3121
|
-
term
|
|
3122
|
-
});
|
|
3123
|
-
}
|
|
3124
|
-
setReady(true);
|
|
3125
|
-
});
|
|
3126
|
-
})();
|
|
3127
|
-
return () => {
|
|
3128
|
-
disposed = true;
|
|
3129
|
-
termRef.current?.dispose();
|
|
3130
|
-
termRef.current = null;
|
|
3131
|
-
fitRef.current = null;
|
|
3132
|
-
rendererRef.current = null;
|
|
3133
|
-
writtenRef.current = /* @__PURE__ */ new Set();
|
|
3134
|
-
wroteFirehoseRef.current = false;
|
|
3135
|
-
bootActiveRef.current = false;
|
|
3136
|
-
setReady(false);
|
|
3137
|
-
};
|
|
3138
|
-
}, []);
|
|
3139
|
-
useLayoutEffect(() => {
|
|
3140
|
-
const term = termRef.current;
|
|
3141
|
-
if (!ready || !term) return;
|
|
3142
|
-
term.options.disableStdin = !interactive;
|
|
3143
|
-
term.options.cursorBlink = interactive;
|
|
3144
|
-
}, [ready, interactive]);
|
|
3145
|
-
useEffect9(() => {
|
|
3146
|
-
const term = termRef.current;
|
|
3147
|
-
if (!ready || !term) return;
|
|
3148
|
-
const next = theme ?? xtermThemeFromTokens(containerRef.current);
|
|
3149
|
-
if (next) term.options.theme = next;
|
|
3150
|
-
}, [ready, theme]);
|
|
3151
|
-
useEffect9(() => {
|
|
3152
|
-
const term = termRef.current;
|
|
3153
|
-
if (!ready || !term) return;
|
|
3154
|
-
if (!booting) {
|
|
3155
|
-
if (bootActiveRef.current) {
|
|
3156
|
-
bootActiveRef.current = false;
|
|
3157
|
-
if (!wroteFirehoseRef.current) clearTerminalBootStatus(term);
|
|
3158
|
-
}
|
|
3159
|
-
return;
|
|
3160
|
-
}
|
|
3161
|
-
bootActiveRef.current = true;
|
|
3162
|
-
const start = Date.now();
|
|
3163
|
-
const paint = () => {
|
|
3164
|
-
const s = Math.max(0, Math.round((Date.now() - start) / 1e3));
|
|
3165
|
-
term.write(`\r\x1B[2K\x1B[94m\u25CF\x1B[0m \x1B[2mwaking machine \u2014 ${s}s\u2026\x1B[0m`);
|
|
3166
|
-
};
|
|
3167
|
-
term.write("\r\n");
|
|
3168
|
-
paint();
|
|
3169
|
-
const id = setInterval(paint, 1e3);
|
|
3170
|
-
return () => clearInterval(id);
|
|
3171
|
-
}, [ready, booting]);
|
|
3172
|
-
useEffect9(() => {
|
|
3173
|
-
const term = termRef.current;
|
|
3174
|
-
if (!ready || !term || ptyMode) return;
|
|
3175
|
-
for (const chunk of result.chunks) {
|
|
3176
|
-
if (writtenRef.current.has(chunk.id)) continue;
|
|
3177
|
-
writtenRef.current.add(chunk.id);
|
|
3178
|
-
wroteFirehoseRef.current = true;
|
|
3179
|
-
term.write(chunk.text);
|
|
3180
|
-
}
|
|
3181
|
-
}, [ready, result.chunks, ptyMode]);
|
|
3182
|
-
useLayoutEffect(() => {
|
|
3183
|
-
const term = termRef.current;
|
|
3184
|
-
if (!ready || !term || !interactive) {
|
|
3185
|
-
setInputReady(false);
|
|
3186
|
-
return;
|
|
3187
|
-
}
|
|
3188
|
-
const sink = ptyAttachable ? ptyWrite : result.write;
|
|
3189
|
-
if (!sink) {
|
|
3190
|
-
setInputReady(false);
|
|
3191
|
-
return;
|
|
3192
|
-
}
|
|
3193
|
-
const sub = subscribeTerminalInput(term, sink, true);
|
|
3194
|
-
setInputReady(sub !== null);
|
|
3195
|
-
return () => sub?.dispose();
|
|
3196
|
-
}, [ready, interactive, ptyAttachable, ptyWrite, result.write]);
|
|
3197
|
-
useEffect9(() => {
|
|
3198
|
-
const term = termRef.current;
|
|
3199
|
-
if (!ready || !term || !ptyMode) return;
|
|
3200
|
-
resizePty(term.cols, term.rows);
|
|
3201
|
-
const sub = term.onResize(({ cols, rows }) => resizePty(cols, rows));
|
|
3202
|
-
return () => sub.dispose();
|
|
3203
|
-
}, [ready, ptyMode, ptyConnected, resizePty]);
|
|
3204
|
-
useEffect9(() => {
|
|
3205
|
-
if (typeof window === "undefined") return;
|
|
3206
|
-
const refit = () => {
|
|
3207
|
-
try {
|
|
3208
|
-
fitRef.current?.fit();
|
|
3209
|
-
} catch {
|
|
3210
|
-
}
|
|
3211
|
-
};
|
|
3212
|
-
window.addEventListener("resize", refit);
|
|
3213
|
-
let observer = null;
|
|
3214
|
-
const el = containerRef.current;
|
|
3215
|
-
if (el && typeof ResizeObserver !== "undefined") {
|
|
3216
|
-
observer = new ResizeObserver(() => refit());
|
|
3217
|
-
observer.observe(el);
|
|
3218
|
-
}
|
|
3219
|
-
return () => {
|
|
3220
|
-
window.removeEventListener("resize", refit);
|
|
3221
|
-
observer?.disconnect();
|
|
3222
|
-
};
|
|
3223
|
-
}, [ready]);
|
|
3224
|
-
return /* @__PURE__ */ jsxs3("div", { className: cn("relative flex h-full w-full flex-col overflow-hidden", className), children: [
|
|
3225
|
-
showHeader && /* @__PURE__ */ jsxs3("div", { className: "flex shrink-0 items-center justify-between gap-2 border-b border-og-border px-2 py-1 text-og-xs text-og-fg-subtle", children: [
|
|
3226
|
-
/* @__PURE__ */ jsxs3("span", { className: "flex min-w-0 items-center gap-1.5", children: [
|
|
3227
|
-
/* @__PURE__ */ jsx3(
|
|
3228
|
-
"span",
|
|
3229
|
-
{
|
|
3230
|
-
className: cn(
|
|
3231
|
-
"size-1.5 shrink-0 rounded-full",
|
|
3232
|
-
result.running ? "bg-og-status-running" : "bg-og-fg-subtle"
|
|
3233
|
-
)
|
|
3234
|
-
}
|
|
3235
|
-
),
|
|
3236
|
-
/* @__PURE__ */ jsxs3("span", { className: "truncate font-og-mono", children: [
|
|
3237
|
-
"pty: ",
|
|
3238
|
-
shell ?? "shell"
|
|
3239
|
-
] })
|
|
3240
|
-
] }),
|
|
3241
|
-
/* @__PURE__ */ jsxs3("span", { className: "flex shrink-0 items-center gap-2", children: [
|
|
3242
|
-
terminalModeLabel && /* @__PURE__ */ jsx3(
|
|
3243
|
-
"span",
|
|
3244
|
-
{
|
|
3245
|
-
className: "rounded-og-sm bg-og-surface-2 px-1.5 py-0.5 text-og-xs uppercase tracking-wide",
|
|
3246
|
-
role: "status",
|
|
3247
|
-
children: terminalModeLabel
|
|
3248
|
-
}
|
|
3249
|
-
),
|
|
3250
|
-
/* @__PURE__ */ jsx3(
|
|
3251
|
-
"button",
|
|
3252
|
-
{
|
|
3253
|
-
type: "button",
|
|
3254
|
-
onClick: () => {
|
|
3255
|
-
termRef.current?.clear();
|
|
3256
|
-
writtenRef.current = /* @__PURE__ */ new Set();
|
|
3257
|
-
wroteFirehoseRef.current = false;
|
|
3258
|
-
},
|
|
3259
|
-
className: "rounded-og-sm px-1.5 py-0.5 text-og-xs hover:text-og-fg pointer-coarse:min-h-11",
|
|
3260
|
-
children: "Clear"
|
|
3261
|
-
}
|
|
3262
|
-
)
|
|
3263
|
-
] })
|
|
3264
|
-
] }),
|
|
3265
|
-
/* @__PURE__ */ jsxs3(
|
|
3266
|
-
"div",
|
|
3267
|
-
{
|
|
3268
|
-
className: "relative min-h-0 flex-1 bg-og-bg p-3",
|
|
3269
|
-
onPointerDownCapture: handleActivate,
|
|
3270
|
-
onFocusCapture: handleActivate,
|
|
3271
|
-
children: [
|
|
3272
|
-
!ready && (placeholder ?? /* @__PURE__ */ jsx3(TerminalPlaceholder, {})),
|
|
3273
|
-
/* @__PURE__ */ jsx3(
|
|
3274
|
-
"div",
|
|
3275
|
-
{
|
|
3276
|
-
ref: containerRef,
|
|
3277
|
-
className: "h-full w-full",
|
|
3278
|
-
style: { visibility: ready ? "visible" : "hidden" },
|
|
3279
|
-
"data-opengeni-terminal": true,
|
|
3280
|
-
"data-opengeni-terminal-ready": ready ? "true" : "false",
|
|
3281
|
-
"data-opengeni-terminal-interactive": surfaceState === "interactive" ? "true" : "false",
|
|
3282
|
-
"data-opengeni-terminal-state": surfaceState,
|
|
3283
|
-
"data-opengeni-terminal-status": ptyAttachable ? ptyStatus : "firehose"
|
|
3284
|
-
}
|
|
3285
|
-
)
|
|
3286
|
-
]
|
|
3287
|
-
}
|
|
3288
|
-
)
|
|
3289
|
-
] });
|
|
3290
|
-
}
|
|
3291
|
-
var XTERM_STYLE_ID = "opengeni-xterm-base-css";
|
|
3292
|
-
var XTERM_BASE_CSS = `
|
|
3293
|
-
.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}
|
|
3294
|
-
.xterm.focus,.xterm:focus{outline:none}
|
|
3295
|
-
.xterm .xterm-helpers{position:absolute;top:0;z-index:5}
|
|
3296
|
-
.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}
|
|
3297
|
-
.xterm .composition-view{background:var(--og-color-bg);color:var(--og-color-fg);display:none;position:absolute;white-space:nowrap;z-index:1}
|
|
3298
|
-
.xterm .composition-view.active{display:block}
|
|
3299
|
-
.xterm .xterm-viewport{background-color:transparent;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}
|
|
3300
|
-
.xterm .xterm-screen{position:relative}
|
|
3301
|
-
.xterm .xterm-screen canvas{position:absolute;left:0;top:0}
|
|
3302
|
-
.xterm .xterm-scroll-area{visibility:hidden}
|
|
3303
|
-
.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}
|
|
3304
|
-
.xterm.enable-mouse-events{cursor:default}
|
|
3305
|
-
.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}
|
|
3306
|
-
.xterm.column-select.focus{cursor:crosshair}
|
|
3307
|
-
.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}
|
|
3308
|
-
.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}
|
|
3309
|
-
.xterm .xterm-accessibility-tree{user-select:text;white-space:pre}
|
|
3310
|
-
.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}
|
|
3311
|
-
.xterm-dim{opacity:1!important}
|
|
3312
|
-
.xterm-underline-1{text-decoration:underline}
|
|
3313
|
-
.xterm-underline-2{text-decoration:double underline}
|
|
3314
|
-
.xterm-underline-3{text-decoration:wavy underline}
|
|
3315
|
-
.xterm-underline-4{text-decoration:dotted underline}
|
|
3316
|
-
.xterm-underline-5{text-decoration:dashed underline}
|
|
3317
|
-
.xterm-overline{text-decoration:overline}
|
|
3318
|
-
.xterm-strikethrough{text-decoration:line-through}
|
|
3319
|
-
.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}
|
|
3320
|
-
.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}
|
|
3321
|
-
.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}
|
|
3322
|
-
.xterm-decoration-top{z-index:2;position:relative}
|
|
3323
|
-
`;
|
|
3324
|
-
function ensureXtermBaseCss() {
|
|
3325
|
-
if (typeof document === "undefined") return;
|
|
3326
|
-
if (document.getElementById(XTERM_STYLE_ID)) return;
|
|
3327
|
-
const style = document.createElement("style");
|
|
3328
|
-
style.id = XTERM_STYLE_ID;
|
|
3329
|
-
style.textContent = XTERM_BASE_CSS;
|
|
3330
|
-
document.head.appendChild(style);
|
|
3331
|
-
}
|
|
3332
|
-
function TerminalPlaceholder() {
|
|
3333
|
-
return /* @__PURE__ */ jsx3("div", { className: "absolute inset-0 flex items-center justify-center text-og-sm text-og-fg-subtle", children: "Loading terminal\u2026" });
|
|
3334
|
-
}
|
|
3335
|
-
|
|
3336
2404
|
// src/components/workbench-changes.tsx
|
|
3337
2405
|
import { ArrowUpRightIcon, FileWarningIcon, HistoryIcon } from "lucide-react";
|
|
3338
2406
|
import {
|
|
3339
2407
|
Component,
|
|
3340
|
-
useCallback as
|
|
3341
|
-
useEffect as
|
|
2408
|
+
useCallback as useCallback14,
|
|
2409
|
+
useEffect as useEffect9,
|
|
3342
2410
|
useId,
|
|
3343
|
-
useLayoutEffect
|
|
3344
|
-
useMemo as
|
|
3345
|
-
useRef as
|
|
3346
|
-
useState as
|
|
2411
|
+
useLayoutEffect,
|
|
2412
|
+
useMemo as useMemo9,
|
|
2413
|
+
useRef as useRef8,
|
|
2414
|
+
useState as useState8
|
|
3347
2415
|
} from "react";
|
|
3348
2416
|
import { VList } from "virtua";
|
|
3349
2417
|
|
|
3350
2418
|
// src/hooks/use-windowed-sections.ts
|
|
3351
|
-
import { useCallback as
|
|
2419
|
+
import { useCallback as useCallback13, useEffect as useEffect8, useMemo as useMemo8, useRef as useRef7, useState as useState7 } from "react";
|
|
3352
2420
|
function computeWindowRange(heights, scrollTop, viewport, overscan) {
|
|
3353
2421
|
const n = heights.length;
|
|
3354
2422
|
if (n === 0) return { start: 0, end: 0 };
|
|
@@ -3379,29 +2447,29 @@ function computeWindowRange(heights, scrollTop, viewport, overscan) {
|
|
|
3379
2447
|
}
|
|
3380
2448
|
function useWindowedSections(opts) {
|
|
3381
2449
|
const { count, estimateHeight, overscan = 3 } = opts;
|
|
3382
|
-
const scrollRef =
|
|
3383
|
-
const [heights, setHeights] =
|
|
2450
|
+
const scrollRef = useRef7(null);
|
|
2451
|
+
const [heights, setHeights] = useState7(
|
|
3384
2452
|
() => Array.from({ length: count }, (_, i) => estimateHeight(i))
|
|
3385
2453
|
);
|
|
3386
|
-
|
|
2454
|
+
useEffect8(() => {
|
|
3387
2455
|
setHeights((prev) => {
|
|
3388
2456
|
const next = Array.from({ length: count }, (_, i) => estimateHeight(i));
|
|
3389
2457
|
return prev.length === next.length && prev.every((height, index) => height === next[index]) ? prev : next;
|
|
3390
2458
|
});
|
|
3391
2459
|
}, [count, estimateHeight]);
|
|
3392
|
-
const heightsRef =
|
|
2460
|
+
const heightsRef = useRef7(heights);
|
|
3393
2461
|
heightsRef.current = heights;
|
|
3394
|
-
const [range, setRange] =
|
|
2462
|
+
const [range, setRange] = useState7(() => ({
|
|
3395
2463
|
start: 0,
|
|
3396
2464
|
end: Math.min(count, overscan + 1)
|
|
3397
2465
|
}));
|
|
3398
|
-
const recompute =
|
|
2466
|
+
const recompute = useCallback13(() => {
|
|
3399
2467
|
const el = scrollRef.current;
|
|
3400
2468
|
if (!el) return;
|
|
3401
2469
|
const next = computeWindowRange(heightsRef.current, el.scrollTop, el.clientHeight, overscan);
|
|
3402
2470
|
setRange((prev) => prev.start === next.start && prev.end === next.end ? prev : next);
|
|
3403
2471
|
}, [overscan]);
|
|
3404
|
-
|
|
2472
|
+
useEffect8(() => {
|
|
3405
2473
|
const el = scrollRef.current;
|
|
3406
2474
|
if (!el) return;
|
|
3407
2475
|
let raf = 0;
|
|
@@ -3422,7 +2490,7 @@ function useWindowedSections(opts) {
|
|
|
3422
2490
|
if (raf && typeof cancelAnimationFrame === "function") cancelAnimationFrame(raf);
|
|
3423
2491
|
};
|
|
3424
2492
|
}, [recompute, count]);
|
|
3425
|
-
const measure =
|
|
2493
|
+
const measure = useCallback13((index, height) => {
|
|
3426
2494
|
if (height <= 0) return;
|
|
3427
2495
|
setHeights((prev) => {
|
|
3428
2496
|
if (Math.abs((prev[index] ?? 0) - height) < 1) return prev;
|
|
@@ -3431,16 +2499,16 @@ function useWindowedSections(opts) {
|
|
|
3431
2499
|
return next;
|
|
3432
2500
|
});
|
|
3433
2501
|
}, []);
|
|
3434
|
-
const offsets =
|
|
2502
|
+
const offsets = useMemo8(() => {
|
|
3435
2503
|
const out = new Array(count + 1);
|
|
3436
2504
|
out[0] = 0;
|
|
3437
2505
|
for (let i = 0; i < count; i++) out[i + 1] = (out[i] ?? 0) + Math.max(heights[i] ?? 0, 0);
|
|
3438
2506
|
return out;
|
|
3439
2507
|
}, [heights, count]);
|
|
3440
|
-
|
|
2508
|
+
useEffect8(() => {
|
|
3441
2509
|
recompute();
|
|
3442
2510
|
}, [offsets, recompute]);
|
|
3443
|
-
const scrollToIndex =
|
|
2511
|
+
const scrollToIndex = useCallback13(
|
|
3444
2512
|
(index) => {
|
|
3445
2513
|
const el = scrollRef.current;
|
|
3446
2514
|
if (!el) return;
|
|
@@ -3460,14 +2528,14 @@ function useWindowedSections(opts) {
|
|
|
3460
2528
|
}
|
|
3461
2529
|
|
|
3462
2530
|
// src/components/workbench-changes.tsx
|
|
3463
|
-
import { jsx as
|
|
2531
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
3464
2532
|
var GROUP_THRESHOLD = 20;
|
|
3465
2533
|
var OVERSCAN = 2;
|
|
3466
2534
|
var HEADER_PX = 30;
|
|
3467
2535
|
var LINE_PX = 18;
|
|
3468
2536
|
var GUARD_BODY_PX = 52;
|
|
3469
2537
|
var COMPACT_SURFACE_PX = 560;
|
|
3470
|
-
var useChangesLayoutEffect = typeof window === "undefined" ?
|
|
2538
|
+
var useChangesLayoutEffect = typeof window === "undefined" ? useEffect9 : useLayoutEffect;
|
|
3471
2539
|
var STATUS_TINT = {
|
|
3472
2540
|
added: "text-og-status-idle",
|
|
3473
2541
|
modified: "text-og-status-running",
|
|
@@ -3578,7 +2646,7 @@ var ChangesRailVList = class extends Component {
|
|
|
3578
2646
|
this.listHandle = handle;
|
|
3579
2647
|
};
|
|
3580
2648
|
render() {
|
|
3581
|
-
return /* @__PURE__ */
|
|
2649
|
+
return /* @__PURE__ */ jsx3("div", { ref: this.setHost, "data-opengeni-changes-rail": true, className: this.props.className, children: /* @__PURE__ */ jsx3(
|
|
3582
2650
|
VList,
|
|
3583
2651
|
{
|
|
3584
2652
|
ref: this.setListHandle,
|
|
@@ -3642,19 +2710,19 @@ function WorkbenchChanges({
|
|
|
3642
2710
|
onOpenFile,
|
|
3643
2711
|
className
|
|
3644
2712
|
}) {
|
|
3645
|
-
const rootRef =
|
|
3646
|
-
const [compact, setCompact] =
|
|
3647
|
-
const [coarsePointer, setCoarsePointer] =
|
|
2713
|
+
const rootRef = useRef8(null);
|
|
2714
|
+
const [compact, setCompact] = useState8(false);
|
|
2715
|
+
const [coarsePointer, setCoarsePointer] = useState8(false);
|
|
3648
2716
|
const resolvedTheme = useThemeType(themeType);
|
|
3649
|
-
const [layout, setLayout] =
|
|
3650
|
-
const [activePath, setActivePath] =
|
|
2717
|
+
const [layout, setLayout] = useState8("unified");
|
|
2718
|
+
const [activePath, setActivePath] = useState8(null);
|
|
3651
2719
|
const pickerId = useId();
|
|
3652
|
-
const unicodeFontPaths =
|
|
2720
|
+
const unicodeFontPaths = useMemo9(
|
|
3653
2721
|
() => diff.flatMap((file) => file.oldPath ? [file.path, file.oldPath] : [file.path]),
|
|
3654
2722
|
[diff]
|
|
3655
2723
|
);
|
|
3656
2724
|
useUnicodeFallbackFonts(unicodeFontPaths);
|
|
3657
|
-
const { orderedFiles, rows, grouped } =
|
|
2725
|
+
const { orderedFiles, rows, grouped } = useMemo9(() => buildRail(diff), [diff]);
|
|
3658
2726
|
const selectedIndex = orderedFiles.findIndex((file) => file.path === activePath);
|
|
3659
2727
|
const activeIndex = selectedIndex >= 0 ? selectedIndex : 0;
|
|
3660
2728
|
useChangesLayoutEffect(() => {
|
|
@@ -3684,9 +2752,9 @@ function WorkbenchChanges({
|
|
|
3684
2752
|
return () => query.removeListener(update);
|
|
3685
2753
|
}
|
|
3686
2754
|
}, []);
|
|
3687
|
-
const additions =
|
|
3688
|
-
const deletions =
|
|
3689
|
-
const estimateHeight =
|
|
2755
|
+
const additions = useMemo9(() => diff.reduce((sum, f) => sum + f.additions, 0), [diff]);
|
|
2756
|
+
const deletions = useMemo9(() => diff.reduce((sum, f) => sum + f.deletions, 0), [diff]);
|
|
2757
|
+
const estimateHeight = useCallback14(
|
|
3690
2758
|
(index) => {
|
|
3691
2759
|
const file = orderedFiles[index];
|
|
3692
2760
|
return file ? estimateSectionHeight(file) : HEADER_PX + LINE_PX;
|
|
@@ -3698,14 +2766,14 @@ function WorkbenchChanges({
|
|
|
3698
2766
|
estimateHeight,
|
|
3699
2767
|
overscan: OVERSCAN
|
|
3700
2768
|
});
|
|
3701
|
-
const jumpTo =
|
|
2769
|
+
const jumpTo = useCallback14(
|
|
3702
2770
|
(index) => {
|
|
3703
2771
|
setActivePath(orderedFiles[index]?.path ?? null);
|
|
3704
2772
|
windowed.scrollToIndex(index);
|
|
3705
2773
|
},
|
|
3706
2774
|
[orderedFiles, windowed]
|
|
3707
2775
|
);
|
|
3708
|
-
const onPaneScroll =
|
|
2776
|
+
const onPaneScroll = useCallback14(() => {
|
|
3709
2777
|
const el = windowed.scrollRef.current;
|
|
3710
2778
|
if (!el) {
|
|
3711
2779
|
return;
|
|
@@ -3720,7 +2788,7 @@ function WorkbenchChanges({
|
|
|
3720
2788
|
const nextPath = orderedFiles[idx]?.path ?? null;
|
|
3721
2789
|
setActivePath((previous) => previous === nextPath ? previous : nextPath);
|
|
3722
2790
|
}, [windowed, orderedFiles]);
|
|
3723
|
-
|
|
2791
|
+
useEffect9(() => {
|
|
3724
2792
|
const el = windowed.scrollRef.current;
|
|
3725
2793
|
if (!el) return;
|
|
3726
2794
|
el.addEventListener("scroll", onPaneScroll, { passive: true });
|
|
@@ -3728,14 +2796,14 @@ function WorkbenchChanges({
|
|
|
3728
2796
|
}, [windowed.scrollRef, onPaneScroll]);
|
|
3729
2797
|
const sourceBadge = describeSource(source, capturedAt, captureRevision ?? null);
|
|
3730
2798
|
const activeFile = orderedFiles[activeIndex] ?? orderedFiles[0];
|
|
3731
|
-
return /* @__PURE__ */
|
|
2799
|
+
return /* @__PURE__ */ jsxs3(
|
|
3732
2800
|
"div",
|
|
3733
2801
|
{
|
|
3734
2802
|
ref: rootRef,
|
|
3735
2803
|
className: cn("flex h-full min-h-0 min-w-0 flex-col", className),
|
|
3736
2804
|
"data-workbench-changes-layout": compact ? "compact" : "rail",
|
|
3737
2805
|
children: [
|
|
3738
|
-
/* @__PURE__ */
|
|
2806
|
+
/* @__PURE__ */ jsxs3(
|
|
3739
2807
|
"div",
|
|
3740
2808
|
{
|
|
3741
2809
|
className: cn(
|
|
@@ -3743,7 +2811,7 @@ function WorkbenchChanges({
|
|
|
3743
2811
|
compact && source === "capture" && "flex-col items-stretch gap-1.5 py-2"
|
|
3744
2812
|
),
|
|
3745
2813
|
children: [
|
|
3746
|
-
/* @__PURE__ */
|
|
2814
|
+
/* @__PURE__ */ jsxs3(
|
|
3747
2815
|
"span",
|
|
3748
2816
|
{
|
|
3749
2817
|
role: "status",
|
|
@@ -3756,18 +2824,18 @@ function WorkbenchChanges({
|
|
|
3756
2824
|
" ",
|
|
3757
2825
|
diff.length === 1 ? "file" : "files",
|
|
3758
2826
|
" changed",
|
|
3759
|
-
/* @__PURE__ */
|
|
2827
|
+
/* @__PURE__ */ jsxs3("span", { "data-contrast-audited": true, className: "ml-2 text-og-status-idle", children: [
|
|
3760
2828
|
"+",
|
|
3761
2829
|
additions
|
|
3762
2830
|
] }),
|
|
3763
|
-
/* @__PURE__ */
|
|
2831
|
+
/* @__PURE__ */ jsxs3("span", { "data-contrast-audited": true, className: "ml-1 text-og-status-failed", children: [
|
|
3764
2832
|
"\u2212",
|
|
3765
2833
|
deletions
|
|
3766
2834
|
] })
|
|
3767
2835
|
]
|
|
3768
2836
|
}
|
|
3769
2837
|
),
|
|
3770
|
-
/* @__PURE__ */
|
|
2838
|
+
/* @__PURE__ */ jsxs3(
|
|
3771
2839
|
"div",
|
|
3772
2840
|
{
|
|
3773
2841
|
className: cn(
|
|
@@ -3775,18 +2843,18 @@ function WorkbenchChanges({
|
|
|
3775
2843
|
compact && source === "capture" && "self-start"
|
|
3776
2844
|
),
|
|
3777
2845
|
children: [
|
|
3778
|
-
compact ? null : /* @__PURE__ */
|
|
3779
|
-
/* @__PURE__ */
|
|
2846
|
+
compact ? null : /* @__PURE__ */ jsx3(LayoutToggle, { layout, onChange: setLayout }),
|
|
2847
|
+
/* @__PURE__ */ jsx3(SourceBadge, { source, capturedAt, label: sourceBadge })
|
|
3780
2848
|
]
|
|
3781
2849
|
}
|
|
3782
2850
|
)
|
|
3783
2851
|
]
|
|
3784
2852
|
}
|
|
3785
2853
|
),
|
|
3786
|
-
compact ? /* @__PURE__ */
|
|
3787
|
-
/* @__PURE__ */
|
|
3788
|
-
/* @__PURE__ */
|
|
3789
|
-
/* @__PURE__ */
|
|
2854
|
+
compact ? /* @__PURE__ */ jsxs3("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
2855
|
+
/* @__PURE__ */ jsxs3("div", { className: "shrink-0 border-b border-og-border bg-og-surface-1 p-2", children: [
|
|
2856
|
+
/* @__PURE__ */ jsx3("label", { className: "sr-only", htmlFor: pickerId, children: "Changed file" }),
|
|
2857
|
+
/* @__PURE__ */ jsx3(
|
|
3790
2858
|
"select",
|
|
3791
2859
|
{
|
|
3792
2860
|
id: pickerId,
|
|
@@ -3799,11 +2867,11 @@ function WorkbenchChanges({
|
|
|
3799
2867
|
title: activeFile?.path,
|
|
3800
2868
|
"data-compact-file-picker": true,
|
|
3801
2869
|
className: "h-11 w-full rounded-og-md border border-og-border bg-og-bg px-3 font-og-mono text-og-sm text-og-fg outline-hidden transition-colors focus:border-og-accent focus:ring-2 focus:ring-og-accent-soft",
|
|
3802
|
-
children: orderedFiles.map((file, index) => /* @__PURE__ */
|
|
2870
|
+
children: orderedFiles.map((file, index) => /* @__PURE__ */ jsx3("option", { value: index, children: compactFileLabel(file) }, file.path))
|
|
3803
2871
|
}
|
|
3804
2872
|
)
|
|
3805
2873
|
] }),
|
|
3806
|
-
/* @__PURE__ */
|
|
2874
|
+
/* @__PURE__ */ jsx3(
|
|
3807
2875
|
"div",
|
|
3808
2876
|
{
|
|
3809
2877
|
"aria-label": "Changed file diff",
|
|
@@ -3811,7 +2879,7 @@ function WorkbenchChanges({
|
|
|
3811
2879
|
"data-opengeni-changes-pane": true,
|
|
3812
2880
|
role: "region",
|
|
3813
2881
|
tabIndex: 0,
|
|
3814
|
-
children: activeFile ? /* @__PURE__ */
|
|
2882
|
+
children: activeFile ? /* @__PURE__ */ jsx3(
|
|
3815
2883
|
DiffSection,
|
|
3816
2884
|
{
|
|
3817
2885
|
file: activeFile,
|
|
@@ -3822,8 +2890,8 @@ function WorkbenchChanges({
|
|
|
3822
2890
|
) : null
|
|
3823
2891
|
}
|
|
3824
2892
|
)
|
|
3825
|
-
] }) : /* @__PURE__ */
|
|
3826
|
-
/* @__PURE__ */
|
|
2893
|
+
] }) : /* @__PURE__ */ jsxs3("div", { className: "flex min-h-0 flex-1", children: [
|
|
2894
|
+
/* @__PURE__ */ jsx3(
|
|
3827
2895
|
ChangesRailVList,
|
|
3828
2896
|
{
|
|
3829
2897
|
rowCount: rows.length,
|
|
@@ -3831,18 +2899,18 @@ function WorkbenchChanges({
|
|
|
3831
2899
|
files: orderedFiles,
|
|
3832
2900
|
className: "w-[clamp(12rem,28%,15rem)] shrink-0 border-r border-og-border bg-og-surface-1/35",
|
|
3833
2901
|
children: rows.map(
|
|
3834
|
-
(row) => row.kind === "group" ? /* @__PURE__ */
|
|
2902
|
+
(row) => row.kind === "group" ? /* @__PURE__ */ jsxs3(
|
|
3835
2903
|
"div",
|
|
3836
2904
|
{
|
|
3837
2905
|
"data-rail-group": true,
|
|
3838
2906
|
className: "flex items-center gap-1.5 px-2 pb-0.5 pt-2 text-og-xs font-medium uppercase tracking-wide text-og-fg-subtle",
|
|
3839
2907
|
children: [
|
|
3840
|
-
/* @__PURE__ */
|
|
3841
|
-
/* @__PURE__ */
|
|
2908
|
+
/* @__PURE__ */ jsx3("span", { className: "min-w-0 truncate", children: row.label }),
|
|
2909
|
+
/* @__PURE__ */ jsx3("span", { className: "shrink-0", children: row.count })
|
|
3842
2910
|
]
|
|
3843
2911
|
},
|
|
3844
2912
|
`g:${row.label}`
|
|
3845
|
-
) : /* @__PURE__ */
|
|
2913
|
+
) : /* @__PURE__ */ jsx3(
|
|
3846
2914
|
RailFileRow,
|
|
3847
2915
|
{
|
|
3848
2916
|
file: row.file,
|
|
@@ -3855,7 +2923,7 @@ function WorkbenchChanges({
|
|
|
3855
2923
|
)
|
|
3856
2924
|
}
|
|
3857
2925
|
),
|
|
3858
|
-
/* @__PURE__ */
|
|
2926
|
+
/* @__PURE__ */ jsx3(
|
|
3859
2927
|
"div",
|
|
3860
2928
|
{
|
|
3861
2929
|
ref: windowed.scrollRef,
|
|
@@ -3864,15 +2932,15 @@ function WorkbenchChanges({
|
|
|
3864
2932
|
"data-opengeni-changes-pane": true,
|
|
3865
2933
|
role: "region",
|
|
3866
2934
|
tabIndex: 0,
|
|
3867
|
-
children: /* @__PURE__ */
|
|
2935
|
+
children: /* @__PURE__ */ jsx3("div", { style: { position: "relative", height: windowed.totalHeight }, children: orderedFiles.map((file, index) => {
|
|
3868
2936
|
if (index < windowed.range.start || index >= windowed.range.end) return null;
|
|
3869
|
-
return /* @__PURE__ */
|
|
2937
|
+
return /* @__PURE__ */ jsx3(
|
|
3870
2938
|
MeasuredSection,
|
|
3871
2939
|
{
|
|
3872
2940
|
index,
|
|
3873
2941
|
top: windowed.offsets[index] ?? 0,
|
|
3874
2942
|
onMeasure: windowed.measure,
|
|
3875
|
-
children: /* @__PURE__ */
|
|
2943
|
+
children: /* @__PURE__ */ jsx3(
|
|
3876
2944
|
DiffSection,
|
|
3877
2945
|
{
|
|
3878
2946
|
file,
|
|
@@ -3898,19 +2966,19 @@ function SourceBadge({
|
|
|
3898
2966
|
label
|
|
3899
2967
|
}) {
|
|
3900
2968
|
if (source === "capture" && capturedAt) {
|
|
3901
|
-
return /* @__PURE__ */
|
|
2969
|
+
return /* @__PURE__ */ jsxs3(
|
|
3902
2970
|
"span",
|
|
3903
2971
|
{
|
|
3904
2972
|
className: "inline-flex items-center gap-1 rounded-og-xs border border-og-border px-1.5 py-px text-og-xs text-og-fg-muted",
|
|
3905
2973
|
title: new Date(capturedAt).toLocaleString(),
|
|
3906
2974
|
children: [
|
|
3907
|
-
/* @__PURE__ */
|
|
2975
|
+
/* @__PURE__ */ jsx3(HistoryIcon, { className: "size-3 shrink-0 text-og-status-running", "aria-hidden": true }),
|
|
3908
2976
|
label
|
|
3909
2977
|
]
|
|
3910
2978
|
}
|
|
3911
2979
|
);
|
|
3912
2980
|
}
|
|
3913
|
-
return /* @__PURE__ */
|
|
2981
|
+
return /* @__PURE__ */ jsx3("span", { className: "rounded-og-xs bg-og-surface-2 px-1.5 py-px text-og-xs text-og-fg-subtle", children: label });
|
|
3914
2982
|
}
|
|
3915
2983
|
function describeSource(source, capturedAt, revision) {
|
|
3916
2984
|
if (source !== "capture" || !capturedAt) return "Live diff";
|
|
@@ -3925,7 +2993,7 @@ function RailFileRow({
|
|
|
3925
2993
|
}) {
|
|
3926
2994
|
const repoPrefix = file.repoRoot ? `${file.repoRoot}/` : null;
|
|
3927
2995
|
const shown = grouped ? file.repoRoot !== void 0 ? repoPrefix && file.path.startsWith(repoPrefix) ? file.path.slice(repoPrefix.length) : file.path : file.path.slice(file.path.indexOf("/") + 1) || file.path : file.path;
|
|
3928
|
-
return /* @__PURE__ */
|
|
2996
|
+
return /* @__PURE__ */ jsxs3(
|
|
3929
2997
|
"button",
|
|
3930
2998
|
{
|
|
3931
2999
|
type: "button",
|
|
@@ -3939,7 +3007,7 @@ function RailFileRow({
|
|
|
3939
3007
|
active && "bg-og-accent-soft text-og-fg before:absolute before:inset-y-1 before:left-0 before:w-0.5 before:rounded-r-full before:bg-og-accent"
|
|
3940
3008
|
),
|
|
3941
3009
|
children: [
|
|
3942
|
-
/* @__PURE__ */
|
|
3010
|
+
/* @__PURE__ */ jsx3(
|
|
3943
3011
|
"span",
|
|
3944
3012
|
{
|
|
3945
3013
|
"data-contrast-audited": true,
|
|
@@ -3947,13 +3015,13 @@ function RailFileRow({
|
|
|
3947
3015
|
children: STATUS_LETTER[file.status]
|
|
3948
3016
|
}
|
|
3949
3017
|
),
|
|
3950
|
-
/* @__PURE__ */
|
|
3951
|
-
/* @__PURE__ */
|
|
3952
|
-
/* @__PURE__ */
|
|
3018
|
+
/* @__PURE__ */ jsx3("span", { className: "min-w-0 flex-1 truncate", children: shown }),
|
|
3019
|
+
/* @__PURE__ */ jsxs3("span", { className: "ml-auto flex shrink-0 items-center gap-1 pl-1 font-og-mono text-og-xs", children: [
|
|
3020
|
+
/* @__PURE__ */ jsxs3("span", { "data-contrast-audited": true, className: "text-og-status-idle", children: [
|
|
3953
3021
|
"+",
|
|
3954
3022
|
file.additions
|
|
3955
3023
|
] }),
|
|
3956
|
-
/* @__PURE__ */
|
|
3024
|
+
/* @__PURE__ */ jsxs3("span", { "data-contrast-audited": true, className: "text-og-status-failed", children: [
|
|
3957
3025
|
"\u2212",
|
|
3958
3026
|
file.deletions
|
|
3959
3027
|
] })
|
|
@@ -3968,8 +3036,8 @@ function MeasuredSection({
|
|
|
3968
3036
|
onMeasure,
|
|
3969
3037
|
children
|
|
3970
3038
|
}) {
|
|
3971
|
-
const ref =
|
|
3972
|
-
|
|
3039
|
+
const ref = useRef8(null);
|
|
3040
|
+
useEffect9(() => {
|
|
3973
3041
|
const el = ref.current;
|
|
3974
3042
|
if (!el) return;
|
|
3975
3043
|
const report = () => onMeasure(index, el.offsetHeight);
|
|
@@ -3978,7 +3046,7 @@ function MeasuredSection({
|
|
|
3978
3046
|
ro?.observe(el);
|
|
3979
3047
|
return () => ro?.disconnect();
|
|
3980
3048
|
}, [index, onMeasure]);
|
|
3981
|
-
return /* @__PURE__ */
|
|
3049
|
+
return /* @__PURE__ */ jsx3(
|
|
3982
3050
|
"div",
|
|
3983
3051
|
{
|
|
3984
3052
|
ref,
|
|
@@ -3997,37 +3065,37 @@ function DiffSection({
|
|
|
3997
3065
|
}) {
|
|
3998
3066
|
if (isGuarded(file)) {
|
|
3999
3067
|
const renamed = file.oldPath && file.oldPath !== file.path;
|
|
4000
|
-
return /* @__PURE__ */
|
|
4001
|
-
/* @__PURE__ */
|
|
4002
|
-
/* @__PURE__ */
|
|
4003
|
-
/* @__PURE__ */
|
|
4004
|
-
/* @__PURE__ */
|
|
3068
|
+
return /* @__PURE__ */ jsxs3("section", { className: "border-b border-og-border pb-1", children: [
|
|
3069
|
+
/* @__PURE__ */ jsxs3("header", { className: "flex items-center justify-between gap-2 bg-og-surface-1 px-3 py-1.5 text-og-sm", children: [
|
|
3070
|
+
/* @__PURE__ */ jsx3("span", { className: "min-w-0 truncate font-og-mono text-og-xs", children: renamed ? `${file.oldPath} \u2192 ${file.path}` : file.path }),
|
|
3071
|
+
/* @__PURE__ */ jsxs3("span", { className: "flex shrink-0 items-center gap-2 font-og-mono text-og-xs", children: [
|
|
3072
|
+
/* @__PURE__ */ jsxs3("span", { className: "text-og-status-idle", children: [
|
|
4005
3073
|
"+",
|
|
4006
3074
|
file.additions
|
|
4007
3075
|
] }),
|
|
4008
|
-
/* @__PURE__ */
|
|
3076
|
+
/* @__PURE__ */ jsxs3("span", { className: "text-og-status-failed", children: [
|
|
4009
3077
|
"\u2212",
|
|
4010
3078
|
file.deletions
|
|
4011
3079
|
] })
|
|
4012
3080
|
] })
|
|
4013
3081
|
] }),
|
|
4014
|
-
/* @__PURE__ */
|
|
3082
|
+
/* @__PURE__ */ jsx3(GuardBody, { file, ...onOpenFile ? { onOpenFile } : {} })
|
|
4015
3083
|
] });
|
|
4016
3084
|
}
|
|
4017
|
-
return /* @__PURE__ */
|
|
3085
|
+
return /* @__PURE__ */ jsx3("section", { "data-pierre-section": true, className: "border-b border-og-border pb-2", children: /* @__PURE__ */ jsx3(PierreDiff, { diff: [file], layout, themeType, className: "px-1" }) });
|
|
4018
3086
|
}
|
|
4019
3087
|
function GuardBody({
|
|
4020
3088
|
file,
|
|
4021
3089
|
onOpenFile
|
|
4022
3090
|
}) {
|
|
4023
3091
|
const reason = file.isBinary ? "Binary file" : "Diff too large to show here";
|
|
4024
|
-
return /* @__PURE__ */
|
|
4025
|
-
/* @__PURE__ */
|
|
4026
|
-
/* @__PURE__ */
|
|
3092
|
+
return /* @__PURE__ */ jsxs3("div", { className: "flex flex-wrap items-center gap-2 px-3 py-3 text-og-sm text-og-fg-subtle", children: [
|
|
3093
|
+
/* @__PURE__ */ jsx3(FileWarningIcon, { className: "size-3.5 shrink-0", "aria-hidden": true }),
|
|
3094
|
+
/* @__PURE__ */ jsxs3("span", { className: "min-w-0 flex-1", children: [
|
|
4027
3095
|
reason,
|
|
4028
3096
|
"."
|
|
4029
3097
|
] }),
|
|
4030
|
-
onOpenFile ? /* @__PURE__ */
|
|
3098
|
+
onOpenFile ? /* @__PURE__ */ jsxs3(
|
|
4031
3099
|
"button",
|
|
4032
3100
|
{
|
|
4033
3101
|
type: "button",
|
|
@@ -4035,7 +3103,7 @@ function GuardBody({
|
|
|
4035
3103
|
className: "inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded-og-sm border border-og-border px-2 py-1 text-og-xs font-medium text-og-fg-muted transition-colors hover:border-og-border-strong hover:bg-og-surface-2 hover:text-og-fg focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent pointer-coarse:min-h-11",
|
|
4036
3104
|
children: [
|
|
4037
3105
|
"Open in Files",
|
|
4038
|
-
/* @__PURE__ */
|
|
3106
|
+
/* @__PURE__ */ jsx3(ArrowUpRightIcon, { className: "size-3.5", "aria-hidden": true })
|
|
4039
3107
|
]
|
|
4040
3108
|
}
|
|
4041
3109
|
) : null
|
|
@@ -4045,7 +3113,7 @@ function LayoutToggle({
|
|
|
4045
3113
|
layout,
|
|
4046
3114
|
onChange
|
|
4047
3115
|
}) {
|
|
4048
|
-
return /* @__PURE__ */
|
|
3116
|
+
return /* @__PURE__ */ jsx3("div", { className: "inline-flex items-center rounded-og-sm border border-og-border p-0.5", children: ["unified", "split"].map((value) => /* @__PURE__ */ jsx3(
|
|
4049
3117
|
"button",
|
|
4050
3118
|
{
|
|
4051
3119
|
type: "button",
|
|
@@ -4061,7 +3129,7 @@ function LayoutToggle({
|
|
|
4061
3129
|
}
|
|
4062
3130
|
|
|
4063
3131
|
// src/components/diff-view.tsx
|
|
4064
|
-
import { jsx as
|
|
3132
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
4065
3133
|
function DiffView({
|
|
4066
3134
|
diff,
|
|
4067
3135
|
fallback,
|
|
@@ -4072,9 +3140,9 @@ function DiffView({
|
|
|
4072
3140
|
className
|
|
4073
3141
|
}) {
|
|
4074
3142
|
if (diff.length === 0) {
|
|
4075
|
-
return /* @__PURE__ */
|
|
3143
|
+
return /* @__PURE__ */ jsx4("div", { className: cn("p-3 text-og-sm text-og-fg-subtle", className), children: emptyState ?? (isRepo ? "No changes" : "No repository mounted") });
|
|
4076
3144
|
}
|
|
4077
|
-
return /* @__PURE__ */
|
|
3145
|
+
return /* @__PURE__ */ jsx4(
|
|
4078
3146
|
PierreDiff,
|
|
4079
3147
|
{
|
|
4080
3148
|
diff,
|
|
@@ -4088,12 +3156,12 @@ function DiffView({
|
|
|
4088
3156
|
|
|
4089
3157
|
// src/components/workspace-dock.tsx
|
|
4090
3158
|
import {
|
|
4091
|
-
useCallback as
|
|
4092
|
-
useEffect as
|
|
3159
|
+
useCallback as useCallback15,
|
|
3160
|
+
useEffect as useEffect10,
|
|
4093
3161
|
useId as useId2,
|
|
4094
|
-
useLayoutEffect as
|
|
4095
|
-
useRef as
|
|
4096
|
-
useState as
|
|
3162
|
+
useLayoutEffect as useLayoutEffect2,
|
|
3163
|
+
useRef as useRef9,
|
|
3164
|
+
useState as useState9
|
|
4097
3165
|
} from "react";
|
|
4098
3166
|
import {
|
|
4099
3167
|
ChevronsLeftRightIcon,
|
|
@@ -4109,7 +3177,7 @@ import {
|
|
|
4109
3177
|
useDefaultLayout,
|
|
4110
3178
|
usePanelRef
|
|
4111
3179
|
} from "react-resizable-panels";
|
|
4112
|
-
import { Fragment, jsx as
|
|
3180
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
4113
3181
|
var SERVER_LAYOUT_STORAGE = {
|
|
4114
3182
|
getItem: () => null,
|
|
4115
3183
|
setItem: () => {
|
|
@@ -4123,10 +3191,10 @@ function getLayoutStorage() {
|
|
|
4123
3191
|
return SERVER_LAYOUT_STORAGE;
|
|
4124
3192
|
}
|
|
4125
3193
|
}
|
|
4126
|
-
var useDockLayoutEffect = typeof window === "undefined" ?
|
|
3194
|
+
var useDockLayoutEffect = typeof window === "undefined" ? useEffect10 : useLayoutEffect2;
|
|
4127
3195
|
var DOCK_OVERLAY_BREAKPOINT = 1024;
|
|
4128
3196
|
function useIsNarrow(maxWidth) {
|
|
4129
|
-
const [narrow, setNarrow] =
|
|
3197
|
+
const [narrow, setNarrow] = useState9(false);
|
|
4130
3198
|
useDockLayoutEffect(() => {
|
|
4131
3199
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
4132
3200
|
return;
|
|
@@ -4160,30 +3228,30 @@ function WorkspaceDock({
|
|
|
4160
3228
|
className
|
|
4161
3229
|
}) {
|
|
4162
3230
|
const narrow = useIsNarrow(DOCK_OVERLAY_BREAKPOINT);
|
|
4163
|
-
const rootRef =
|
|
4164
|
-
const reopenRef =
|
|
4165
|
-
const returnFocusRef =
|
|
4166
|
-
const initialNarrowFocusRef =
|
|
3231
|
+
const rootRef = useRef9(null);
|
|
3232
|
+
const reopenRef = useRef9(null);
|
|
3233
|
+
const returnFocusRef = useRef9(null);
|
|
3234
|
+
const initialNarrowFocusRef = useRef9(false);
|
|
4167
3235
|
const dockPanelRef = usePanelRef();
|
|
4168
|
-
const [internalCollapsed, setInternalCollapsed] =
|
|
4169
|
-
const [maximized, setMaximized] =
|
|
4170
|
-
const [internalTab, setInternalTab] =
|
|
3236
|
+
const [internalCollapsed, setInternalCollapsed] = useState9(false);
|
|
3237
|
+
const [maximized, setMaximized] = useState9(false);
|
|
3238
|
+
const [internalTab, setInternalTab] = useState9(tabs[0]?.id ?? "");
|
|
4171
3239
|
const collapsed = collapsedProp ?? internalCollapsed;
|
|
4172
3240
|
const hostControlled = collapsedProp !== void 0;
|
|
4173
|
-
const previousCollapsedRef =
|
|
3241
|
+
const previousCollapsedRef = useRef9(collapsed);
|
|
4174
3242
|
const { defaultLayout, onLayoutChanged } = useDefaultLayout({
|
|
4175
3243
|
panelIds: ["primary", "dock"],
|
|
4176
3244
|
storage: getLayoutStorage(),
|
|
4177
3245
|
id: autoSaveId
|
|
4178
3246
|
});
|
|
4179
3247
|
const expandedDefaultLayout = defaultLayout && (defaultLayout.dock ?? 0) > 1 ? defaultLayout : void 0;
|
|
4180
|
-
const lastExpandedSizeRef =
|
|
4181
|
-
const layoutIdentityRef =
|
|
3248
|
+
const lastExpandedSizeRef = useRef9(expandedDefaultLayout?.dock ?? defaultSize);
|
|
3249
|
+
const layoutIdentityRef = useRef9(autoSaveId);
|
|
4182
3250
|
if (layoutIdentityRef.current !== autoSaveId) {
|
|
4183
3251
|
layoutIdentityRef.current = autoSaveId;
|
|
4184
3252
|
lastExpandedSizeRef.current = expandedDefaultLayout?.dock ?? defaultSize;
|
|
4185
3253
|
}
|
|
4186
|
-
const persistExpandedLayout =
|
|
3254
|
+
const persistExpandedLayout = useCallback15(
|
|
4187
3255
|
(layout, meta) => {
|
|
4188
3256
|
const dockSize = layout.dock ?? 0;
|
|
4189
3257
|
if (dockSize <= 1) return;
|
|
@@ -4197,14 +3265,14 @@ function WorkspaceDock({
|
|
|
4197
3265
|
const firstTabId = tabs[0]?.id ?? "";
|
|
4198
3266
|
const requestedTabIsValid = tabIds.includes(requestedTab);
|
|
4199
3267
|
const current = requestedTabIsValid ? requestedTab : firstTabId;
|
|
4200
|
-
const setTab =
|
|
3268
|
+
const setTab = useCallback15(
|
|
4201
3269
|
(id) => {
|
|
4202
3270
|
setInternalTab(id);
|
|
4203
3271
|
onActiveTabChange?.(id);
|
|
4204
3272
|
},
|
|
4205
3273
|
[onActiveTabChange]
|
|
4206
3274
|
);
|
|
4207
|
-
const setCollapsed =
|
|
3275
|
+
const setCollapsed = useCallback15(
|
|
4208
3276
|
(next) => {
|
|
4209
3277
|
setInternalCollapsed((previous) => previous === next ? previous : next);
|
|
4210
3278
|
onCollapsedChange?.(next);
|
|
@@ -4222,7 +3290,7 @@ function WorkspaceDock({
|
|
|
4222
3290
|
dockPanelRef.current?.resize(`${lastExpandedSizeRef.current}%`);
|
|
4223
3291
|
}
|
|
4224
3292
|
}, [collapsedProp, dockPanelRef]);
|
|
4225
|
-
|
|
3293
|
+
useEffect10(() => {
|
|
4226
3294
|
const previous = previousCollapsedRef.current;
|
|
4227
3295
|
previousCollapsedRef.current = collapsed;
|
|
4228
3296
|
if (previous === collapsed) return;
|
|
@@ -4258,7 +3326,7 @@ function WorkspaceDock({
|
|
|
4258
3326
|
});
|
|
4259
3327
|
return () => cancelAnimationFrame(frame);
|
|
4260
3328
|
}, [collapsed, hostControlled, narrow]);
|
|
4261
|
-
|
|
3329
|
+
useEffect10(() => {
|
|
4262
3330
|
if (!narrow || collapsed || initialNarrowFocusRef.current) return;
|
|
4263
3331
|
initialNarrowFocusRef.current = true;
|
|
4264
3332
|
const active = document.activeElement;
|
|
@@ -4271,20 +3339,20 @@ function WorkspaceDock({
|
|
|
4271
3339
|
});
|
|
4272
3340
|
return () => cancelAnimationFrame(frame);
|
|
4273
3341
|
}, [collapsed, narrow]);
|
|
4274
|
-
|
|
3342
|
+
useEffect10(() => {
|
|
4275
3343
|
if (firstTabId && !requestedTabIsValid) {
|
|
4276
3344
|
setTab(firstTabId);
|
|
4277
3345
|
}
|
|
4278
3346
|
}, [firstTabId, requestedTabIsValid, setTab]);
|
|
4279
|
-
const collapse =
|
|
3347
|
+
const collapse = useCallback15(() => {
|
|
4280
3348
|
dockPanelRef.current?.collapse();
|
|
4281
3349
|
setCollapsed(true);
|
|
4282
3350
|
}, [dockPanelRef, setCollapsed]);
|
|
4283
|
-
const expand =
|
|
3351
|
+
const expand = useCallback15(() => {
|
|
4284
3352
|
dockPanelRef.current?.expand();
|
|
4285
3353
|
setCollapsed(false);
|
|
4286
3354
|
}, [dockPanelRef, setCollapsed]);
|
|
4287
|
-
|
|
3355
|
+
useEffect10(() => {
|
|
4288
3356
|
const overlayOpen = maximized || narrow && !collapsed;
|
|
4289
3357
|
if (!overlayOpen) return;
|
|
4290
3358
|
const onKey = (event) => {
|
|
@@ -4328,8 +3396,8 @@ function WorkspaceDock({
|
|
|
4328
3396
|
return () => window.removeEventListener("keydown", onKey);
|
|
4329
3397
|
}, [maximized, narrow, collapsed, collapse]);
|
|
4330
3398
|
if (narrow) {
|
|
4331
|
-
return /* @__PURE__ */
|
|
4332
|
-
/* @__PURE__ */
|
|
3399
|
+
return /* @__PURE__ */ jsxs4("div", { ref: rootRef, className: cn("relative flex h-full min-h-0 w-full min-w-0", className), children: [
|
|
3400
|
+
/* @__PURE__ */ jsx5(
|
|
4333
3401
|
"div",
|
|
4334
3402
|
{
|
|
4335
3403
|
"data-workspace-primary": true,
|
|
@@ -4339,7 +3407,7 @@ function WorkspaceDock({
|
|
|
4339
3407
|
children: primary
|
|
4340
3408
|
}
|
|
4341
3409
|
),
|
|
4342
|
-
/* @__PURE__ */
|
|
3410
|
+
/* @__PURE__ */ jsx5(
|
|
4343
3411
|
"div",
|
|
4344
3412
|
{
|
|
4345
3413
|
"data-workspace-surface": true,
|
|
@@ -4357,7 +3425,7 @@ function WorkspaceDock({
|
|
|
4357
3425
|
paddingTop: "env(safe-area-inset-top)",
|
|
4358
3426
|
paddingBottom: "env(safe-area-inset-bottom)"
|
|
4359
3427
|
},
|
|
4360
|
-
children: /* @__PURE__ */
|
|
3428
|
+
children: /* @__PURE__ */ jsx5(
|
|
4361
3429
|
DockChrome,
|
|
4362
3430
|
{
|
|
4363
3431
|
tabs,
|
|
@@ -4365,12 +3433,12 @@ function WorkspaceDock({
|
|
|
4365
3433
|
onTab: setTab,
|
|
4366
3434
|
leading: mobileLeadingControl,
|
|
4367
3435
|
accessory: headerAccessory,
|
|
4368
|
-
controls: /* @__PURE__ */
|
|
3436
|
+
controls: /* @__PURE__ */ jsx5(ChromeButton, { onClick: collapse, title: "Hide workspace", label: "Hide workspace", children: /* @__PURE__ */ jsx5(XIcon, { className: "size-4" }) })
|
|
4369
3437
|
}
|
|
4370
3438
|
)
|
|
4371
3439
|
}
|
|
4372
3440
|
),
|
|
4373
|
-
collapsed && !hostControlled ? /* @__PURE__ */
|
|
3441
|
+
collapsed && !hostControlled ? /* @__PURE__ */ jsx5(
|
|
4374
3442
|
"button",
|
|
4375
3443
|
{
|
|
4376
3444
|
ref: reopenRef,
|
|
@@ -4380,34 +3448,34 @@ function WorkspaceDock({
|
|
|
4380
3448
|
"aria-label": "Open workspace",
|
|
4381
3449
|
className: "absolute right-3 top-3 z-30 inline-flex size-11 items-center justify-center rounded-og-md border border-og-border bg-og-surface-1 text-og-fg-muted shadow-lg transition-colors hover:border-og-border-strong hover:text-og-fg focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent",
|
|
4382
3450
|
style: { marginTop: "env(safe-area-inset-top)" },
|
|
4383
|
-
children: /* @__PURE__ */
|
|
3451
|
+
children: /* @__PURE__ */ jsx5(ChevronsLeftRightIcon, { className: "size-4", "aria-hidden": true })
|
|
4384
3452
|
}
|
|
4385
3453
|
) : null
|
|
4386
3454
|
] });
|
|
4387
3455
|
}
|
|
4388
|
-
const dockChrome = /* @__PURE__ */
|
|
3456
|
+
const dockChrome = /* @__PURE__ */ jsx5(
|
|
4389
3457
|
DockChrome,
|
|
4390
3458
|
{
|
|
4391
3459
|
tabs,
|
|
4392
3460
|
current,
|
|
4393
3461
|
onTab: setTab,
|
|
4394
3462
|
accessory: headerAccessory,
|
|
4395
|
-
controls: /* @__PURE__ */
|
|
4396
|
-
/* @__PURE__ */
|
|
3463
|
+
controls: /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
3464
|
+
/* @__PURE__ */ jsx5(
|
|
4397
3465
|
ChromeButton,
|
|
4398
3466
|
{
|
|
4399
3467
|
onClick: () => setMaximized((m) => !m),
|
|
4400
3468
|
title: maximized ? "Restore (Esc)" : "Maximize",
|
|
4401
3469
|
label: maximized ? "Restore dock" : "Maximize dock",
|
|
4402
|
-
children: maximized ? /* @__PURE__ */
|
|
3470
|
+
children: maximized ? /* @__PURE__ */ jsx5(Minimize2Icon, { className: "size-3.5" }) : /* @__PURE__ */ jsx5(Maximize2Icon, { className: "size-3.5" })
|
|
4403
3471
|
}
|
|
4404
3472
|
),
|
|
4405
|
-
hostControlled && !showCollapseControl ? null : /* @__PURE__ */
|
|
3473
|
+
hostControlled && !showCollapseControl ? null : /* @__PURE__ */ jsx5(ChromeButton, { onClick: collapse, title: "Hide workspace", label: "Hide workspace", children: /* @__PURE__ */ jsx5(PanelRightCloseIcon, { className: "size-3.5" }) })
|
|
4406
3474
|
] })
|
|
4407
3475
|
}
|
|
4408
3476
|
);
|
|
4409
|
-
return /* @__PURE__ */
|
|
4410
|
-
/* @__PURE__ */
|
|
3477
|
+
return /* @__PURE__ */ jsxs4("div", { ref: rootRef, className: cn("relative flex h-full min-h-0 w-full min-w-0", className), children: [
|
|
3478
|
+
/* @__PURE__ */ jsxs4(
|
|
4411
3479
|
Group,
|
|
4412
3480
|
{
|
|
4413
3481
|
orientation: "horizontal",
|
|
@@ -4415,7 +3483,7 @@ function WorkspaceDock({
|
|
|
4415
3483
|
...expandedDefaultLayout ? { defaultLayout: expandedDefaultLayout } : {},
|
|
4416
3484
|
onLayoutChanged: persistExpandedLayout,
|
|
4417
3485
|
children: [
|
|
4418
|
-
/* @__PURE__ */
|
|
3486
|
+
/* @__PURE__ */ jsx5(Panel, { id: "primary", minSize: "30%", className: "min-h-0 min-w-0", children: /* @__PURE__ */ jsx5(
|
|
4419
3487
|
"div",
|
|
4420
3488
|
{
|
|
4421
3489
|
"data-workspace-primary": true,
|
|
@@ -4425,8 +3493,8 @@ function WorkspaceDock({
|
|
|
4425
3493
|
children: primary
|
|
4426
3494
|
}
|
|
4427
3495
|
) }),
|
|
4428
|
-
!collapsed && /* @__PURE__ */
|
|
4429
|
-
/* @__PURE__ */
|
|
3496
|
+
!collapsed && /* @__PURE__ */ jsx5(Separator, { className: "group relative z-10 w-1.5 shrink-0 outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-og-accent max-[1023px]:-mx-[19px] max-[1023px]:w-11 pointer-coarse:-mx-[19px] pointer-coarse:w-11", children: /* @__PURE__ */ jsx5("span", { className: "absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-og-border transition-colors group-hover:bg-og-accent group-focus-visible:bg-og-accent group-data-[separator-state=dragging]:bg-og-accent" }) }),
|
|
3497
|
+
/* @__PURE__ */ jsx5(
|
|
4430
3498
|
Panel,
|
|
4431
3499
|
{
|
|
4432
3500
|
id: "dock",
|
|
@@ -4444,7 +3512,7 @@ function WorkspaceDock({
|
|
|
4444
3512
|
}
|
|
4445
3513
|
},
|
|
4446
3514
|
className: "min-h-0 min-w-0",
|
|
4447
|
-
children: /* @__PURE__ */
|
|
3515
|
+
children: /* @__PURE__ */ jsx5(
|
|
4448
3516
|
"div",
|
|
4449
3517
|
{
|
|
4450
3518
|
"data-workspace-surface": true,
|
|
@@ -4465,7 +3533,7 @@ function WorkspaceDock({
|
|
|
4465
3533
|
]
|
|
4466
3534
|
}
|
|
4467
3535
|
),
|
|
4468
|
-
collapsed && !maximized && !hostControlled && /* @__PURE__ */
|
|
3536
|
+
collapsed && !maximized && !hostControlled && /* @__PURE__ */ jsx5(
|
|
4469
3537
|
"button",
|
|
4470
3538
|
{
|
|
4471
3539
|
ref: reopenRef,
|
|
@@ -4473,7 +3541,7 @@ function WorkspaceDock({
|
|
|
4473
3541
|
onClick: expand,
|
|
4474
3542
|
title: "Open workspace",
|
|
4475
3543
|
className: "absolute inset-y-0 right-0 flex w-6 shrink-0 items-center justify-center border-l border-og-border bg-og-surface-1 text-og-fg-subtle hover:text-og-fg",
|
|
4476
|
-
children: /* @__PURE__ */
|
|
3544
|
+
children: /* @__PURE__ */ jsx5(ChevronsLeftRightIcon, { className: "size-3.5" })
|
|
4477
3545
|
}
|
|
4478
3546
|
)
|
|
4479
3547
|
] });
|
|
@@ -4484,7 +3552,7 @@ function ChromeButton({
|
|
|
4484
3552
|
label,
|
|
4485
3553
|
children
|
|
4486
3554
|
}) {
|
|
4487
|
-
return /* @__PURE__ */
|
|
3555
|
+
return /* @__PURE__ */ jsx5(
|
|
4488
3556
|
"button",
|
|
4489
3557
|
{
|
|
4490
3558
|
type: "button",
|
|
@@ -4504,12 +3572,12 @@ function DockChrome({
|
|
|
4504
3572
|
accessory,
|
|
4505
3573
|
controls
|
|
4506
3574
|
}) {
|
|
4507
|
-
const chromeRef =
|
|
4508
|
-
const [compact, setCompact] =
|
|
3575
|
+
const chromeRef = useRef9(null);
|
|
3576
|
+
const [compact, setCompact] = useState9(false);
|
|
4509
3577
|
const active = tabs.find((t) => t.id === current) ?? tabs[0];
|
|
4510
3578
|
const tabsetId = useId2();
|
|
4511
|
-
const tabRefs =
|
|
4512
|
-
const [visitedTabs, setVisitedTabs] =
|
|
3579
|
+
const tabRefs = useRef9([]);
|
|
3580
|
+
const [visitedTabs, setVisitedTabs] = useState9(() => /* @__PURE__ */ new Set());
|
|
4513
3581
|
const activeId = active?.id ?? "";
|
|
4514
3582
|
useDockLayoutEffect(() => {
|
|
4515
3583
|
const node = chromeRef.current;
|
|
@@ -4528,7 +3596,7 @@ function DockChrome({
|
|
|
4528
3596
|
observer.observe(node);
|
|
4529
3597
|
return () => observer.disconnect();
|
|
4530
3598
|
}, []);
|
|
4531
|
-
|
|
3599
|
+
useEffect10(() => {
|
|
4532
3600
|
if (!activeId) return;
|
|
4533
3601
|
setVisitedTabs((previous) => {
|
|
4534
3602
|
if (previous.has(activeId)) return previous;
|
|
@@ -4556,7 +3624,7 @@ function DockChrome({
|
|
|
4556
3624
|
event.preventDefault();
|
|
4557
3625
|
activateTab(nextIndex);
|
|
4558
3626
|
};
|
|
4559
|
-
return /* @__PURE__ */
|
|
3627
|
+
return /* @__PURE__ */ jsxs4(
|
|
4560
3628
|
"div",
|
|
4561
3629
|
{
|
|
4562
3630
|
ref: chromeRef,
|
|
@@ -4564,13 +3632,13 @@ function DockChrome({
|
|
|
4564
3632
|
"data-compact": compact ? "true" : void 0,
|
|
4565
3633
|
className: "flex h-full min-h-0 min-w-0 flex-col",
|
|
4566
3634
|
children: [
|
|
4567
|
-
/* @__PURE__ */
|
|
4568
|
-
/* @__PURE__ */
|
|
4569
|
-
/* @__PURE__ */
|
|
4570
|
-
/* @__PURE__ */
|
|
3635
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex min-h-10 shrink-0 items-center gap-2 border-b border-og-border px-2 max-[1023px]:min-h-12", children: [
|
|
3636
|
+
/* @__PURE__ */ jsx5("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: leading ?? /* @__PURE__ */ jsx5("span", { className: "hidden truncate text-og-sm font-semibold text-og-fg max-[1023px]:inline", children: "Workspace" }) }),
|
|
3637
|
+
/* @__PURE__ */ jsx5("div", { className: "min-w-0 shrink text-og-fg-muted", children: accessory }),
|
|
3638
|
+
/* @__PURE__ */ jsx5("div", { className: "flex shrink-0 items-center gap-0.5 text-og-fg-subtle", children: controls })
|
|
4571
3639
|
] }),
|
|
4572
|
-
/* @__PURE__ */
|
|
4573
|
-
/* @__PURE__ */
|
|
3640
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex min-h-0 min-w-0 flex-1", children: [
|
|
3641
|
+
/* @__PURE__ */ jsx5(
|
|
4574
3642
|
"div",
|
|
4575
3643
|
{
|
|
4576
3644
|
className: cn(
|
|
@@ -4582,7 +3650,7 @@ function DockChrome({
|
|
|
4582
3650
|
"aria-orientation": "vertical",
|
|
4583
3651
|
children: tabs.map((tab, index) => {
|
|
4584
3652
|
const tabName = tab.ariaLabel ?? (typeof tab.label === "string" ? tab.label : tab.id);
|
|
4585
|
-
return /* @__PURE__ */
|
|
3653
|
+
return /* @__PURE__ */ jsxs4(
|
|
4586
3654
|
"button",
|
|
4587
3655
|
{
|
|
4588
3656
|
ref: (node) => {
|
|
@@ -4604,7 +3672,7 @@ function DockChrome({
|
|
|
4604
3672
|
tab.id === current ? "bg-og-accent-soft text-og-fg shadow-[inset_2px_0_0_var(--og-color-accent)]" : "text-og-fg-subtle hover:bg-og-surface-2 hover:text-og-fg"
|
|
4605
3673
|
),
|
|
4606
3674
|
children: [
|
|
4607
|
-
tab.icon ? /* @__PURE__ */
|
|
3675
|
+
tab.icon ? /* @__PURE__ */ jsx5(
|
|
4608
3676
|
"span",
|
|
4609
3677
|
{
|
|
4610
3678
|
className: "flex size-4 shrink-0 items-center justify-center [&>svg]:size-4",
|
|
@@ -4612,8 +3680,8 @@ function DockChrome({
|
|
|
4612
3680
|
children: tab.icon
|
|
4613
3681
|
}
|
|
4614
3682
|
) : null,
|
|
4615
|
-
!compact || !tab.icon ? /* @__PURE__ */
|
|
4616
|
-
tab.badge ? /* @__PURE__ */
|
|
3683
|
+
!compact || !tab.icon ? /* @__PURE__ */ jsx5("span", { "data-contrast-audited": true, className: "min-w-0 flex-1 truncate", children: tab.label }) : null,
|
|
3684
|
+
tab.badge ? /* @__PURE__ */ jsx5(
|
|
4617
3685
|
"span",
|
|
4618
3686
|
{
|
|
4619
3687
|
className: cn("shrink-0", compact && "absolute -right-0.5 -top-0.5 scale-90"),
|
|
@@ -4627,10 +3695,10 @@ function DockChrome({
|
|
|
4627
3695
|
})
|
|
4628
3696
|
}
|
|
4629
3697
|
),
|
|
4630
|
-
/* @__PURE__ */
|
|
3698
|
+
/* @__PURE__ */ jsx5("div", { className: "min-h-0 min-w-0 flex-1 overflow-hidden", children: tabs.length > 0 ? tabs.map((tab, index) => {
|
|
4631
3699
|
const selected = tab.id === activeId;
|
|
4632
3700
|
const shouldMount = selected || visitedTabs.has(tab.id);
|
|
4633
|
-
return /* @__PURE__ */
|
|
3701
|
+
return /* @__PURE__ */ jsx5(
|
|
4634
3702
|
"div",
|
|
4635
3703
|
{
|
|
4636
3704
|
id: `${tabsetId}-panel-${index}`,
|
|
@@ -4642,7 +3710,7 @@ function DockChrome({
|
|
|
4642
3710
|
},
|
|
4643
3711
|
tab.id
|
|
4644
3712
|
);
|
|
4645
|
-
}) : /* @__PURE__ */
|
|
3713
|
+
}) : /* @__PURE__ */ jsx5("div", { className: "h-full min-h-0 min-w-0", "aria-label": "Workspace", role: "tabpanel" }) })
|
|
4646
3714
|
] })
|
|
4647
3715
|
]
|
|
4648
3716
|
}
|
|
@@ -4653,11 +3721,11 @@ function DockChrome({
|
|
|
4653
3721
|
import {
|
|
4654
3722
|
lazy,
|
|
4655
3723
|
Suspense,
|
|
4656
|
-
useCallback as
|
|
4657
|
-
useEffect as
|
|
4658
|
-
useMemo as
|
|
4659
|
-
useRef as
|
|
4660
|
-
useState as
|
|
3724
|
+
useCallback as useCallback16,
|
|
3725
|
+
useEffect as useEffect11,
|
|
3726
|
+
useMemo as useMemo10,
|
|
3727
|
+
useRef as useRef10,
|
|
3728
|
+
useState as useState10
|
|
4661
3729
|
} from "react";
|
|
4662
3730
|
import {
|
|
4663
3731
|
CircleCheckIcon,
|
|
@@ -4671,28 +3739,28 @@ import {
|
|
|
4671
3739
|
SquareTerminalIcon,
|
|
4672
3740
|
TriangleAlertIcon
|
|
4673
3741
|
} from "lucide-react";
|
|
4674
|
-
import { jsx as
|
|
3742
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
4675
3743
|
var LazySandboxFiles = lazy(
|
|
4676
|
-
() => import("./sandbox-files-
|
|
3744
|
+
() => import("./sandbox-files-AEJTWGT4.js").then(({ SandboxFiles: SandboxFiles2 }) => ({ default: SandboxFiles2 })).catch(() => ({ default: FilesLoadFailed }))
|
|
4677
3745
|
);
|
|
4678
3746
|
function FilesLoadFailed() {
|
|
4679
|
-
return /* @__PURE__ */
|
|
4680
|
-
/* @__PURE__ */
|
|
4681
|
-
/* @__PURE__ */
|
|
4682
|
-
/* @__PURE__ */
|
|
3747
|
+
return /* @__PURE__ */ jsxs5(CenteredState, { tone: "danger", icon: /* @__PURE__ */ jsx6(TriangleAlertIcon, { className: "size-5", "aria-hidden": true }), children: [
|
|
3748
|
+
/* @__PURE__ */ jsx6("p", { className: "text-og-sm font-medium text-og-fg", children: "Files could not be loaded." }),
|
|
3749
|
+
/* @__PURE__ */ jsxs5(DockActionButton, { onClick: () => window.location.reload(), children: [
|
|
3750
|
+
/* @__PURE__ */ jsx6(RefreshCwIcon, { className: "size-3", "aria-hidden": true }),
|
|
4683
3751
|
"Reload"
|
|
4684
3752
|
] })
|
|
4685
3753
|
] });
|
|
4686
3754
|
}
|
|
4687
3755
|
function FilesTabBody(props) {
|
|
4688
|
-
return /* @__PURE__ */
|
|
3756
|
+
return /* @__PURE__ */ jsx6(Suspense, { fallback: /* @__PURE__ */ jsx6(WorkbenchSurfaceLoading, { name: "Files" }), children: /* @__PURE__ */ jsx6(LazySandboxFiles, { ...props }) });
|
|
4689
3757
|
}
|
|
4690
3758
|
var LazyBrowserViewer = lazy(async () => {
|
|
4691
|
-
const { BrowserViewer } = await import("./browser-viewer-
|
|
3759
|
+
const { BrowserViewer } = await import("./browser-viewer-Z7S7QEJL.js");
|
|
4692
3760
|
return { default: BrowserViewer };
|
|
4693
3761
|
});
|
|
4694
3762
|
var LazyComputerViewer = lazy(async () => {
|
|
4695
|
-
const { ComputerViewer } = await import("./computer-viewer-
|
|
3763
|
+
const { ComputerViewer } = await import("./computer-viewer-KJWLH3GI.js");
|
|
4696
3764
|
return { default: ComputerViewer };
|
|
4697
3765
|
});
|
|
4698
3766
|
var WORKBENCH_TAB_CHANGES = "changes";
|
|
@@ -4722,11 +3790,11 @@ function sourceDrivenDefaultTab(hasChanges, changesEnabled, filesEnabled) {
|
|
|
4722
3790
|
return null;
|
|
4723
3791
|
}
|
|
4724
3792
|
function WorkbenchSurfaceLoading({ name }) {
|
|
4725
|
-
return /* @__PURE__ */
|
|
3793
|
+
return /* @__PURE__ */ jsx6(
|
|
4726
3794
|
CenteredState,
|
|
4727
3795
|
{
|
|
4728
|
-
icon: /* @__PURE__ */
|
|
4729
|
-
children: /* @__PURE__ */
|
|
3796
|
+
icon: /* @__PURE__ */ jsx6(LoaderCircleIcon, { className: "size-5 animate-spin motion-reduce:animate-none", "aria-hidden": true }),
|
|
3797
|
+
children: /* @__PURE__ */ jsxs5("p", { className: "text-og-sm font-medium text-og-fg", children: [
|
|
4730
3798
|
"Opening ",
|
|
4731
3799
|
name
|
|
4732
3800
|
] })
|
|
@@ -4837,7 +3905,7 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
4837
3905
|
const terminalEnabled = surfaceSet.has(WORKBENCH_TAB_TERMINAL);
|
|
4838
3906
|
const browserEnabled = surfaceSet.has(WORKBENCH_TAB_BROWSER);
|
|
4839
3907
|
const desktopEnabled = surfaceSet.has(WORKBENCH_TAB_DESKTOP);
|
|
4840
|
-
const createLinkedComputer =
|
|
3908
|
+
const createLinkedComputer = useCallback16(
|
|
4841
3909
|
async (name, placement) => {
|
|
4842
3910
|
const response = await client.createComputerSession(workspaceId, {
|
|
4843
3911
|
operationId: crypto.randomUUID(),
|
|
@@ -4862,13 +3930,13 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
4862
3930
|
const filesActive = resolvedActiveTab === WORKBENCH_TAB_FILES;
|
|
4863
3931
|
const turnInFlight = workspaceTurnInFlight(events);
|
|
4864
3932
|
const surfaceIdentity = WORKBENCH_SURFACES.filter((surface) => surfaceSet.has(surface)).join(",");
|
|
4865
|
-
const [storedWarmIntents, setStoredWarmIntents] =
|
|
3933
|
+
const [storedWarmIntents, setStoredWarmIntents] = useState10(
|
|
4866
3934
|
() => emptyWarmIntents(sessionId)
|
|
4867
3935
|
);
|
|
4868
3936
|
const warmIntents = storedWarmIntents.sessionId === sessionId ? storedWarmIntents : emptyWarmIntents(sessionId);
|
|
4869
3937
|
const { warmTerminal, warmFiles } = warmIntents;
|
|
4870
3938
|
const filesWarmRequested = warmFiles || Boolean(requestedFilePath);
|
|
4871
|
-
const requestWarmIntent =
|
|
3939
|
+
const requestWarmIntent = useCallback16(
|
|
4872
3940
|
(intent) => {
|
|
4873
3941
|
setStoredWarmIntents((previous) => {
|
|
4874
3942
|
const current = previous.sessionId === sessionId ? previous : emptyWarmIntents(sessionId);
|
|
@@ -4910,15 +3978,15 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
4910
3978
|
});
|
|
4911
3979
|
const provisioning = sandboxProvisionInFlight(events);
|
|
4912
3980
|
const renegotiate = caps.renegotiate;
|
|
4913
|
-
const provisioningRef =
|
|
4914
|
-
|
|
3981
|
+
const provisioningRef = useRef10({ sessionId, provisioning });
|
|
3982
|
+
useEffect11(() => {
|
|
4915
3983
|
const previous = provisioningRef.current;
|
|
4916
3984
|
if (previous.sessionId === sessionId && previous.provisioning && !provisioning) {
|
|
4917
3985
|
renegotiate();
|
|
4918
3986
|
}
|
|
4919
3987
|
provisioningRef.current = { sessionId, provisioning };
|
|
4920
3988
|
}, [sessionId, provisioning, renegotiate]);
|
|
4921
|
-
|
|
3989
|
+
useEffect11(() => {
|
|
4922
3990
|
if (workspaceInteractionEvent?.workspaceId !== workspaceId) return;
|
|
4923
3991
|
renegotiate();
|
|
4924
3992
|
}, [workspaceId, workspaceInteractionEvent, renegotiate]);
|
|
@@ -4929,7 +3997,7 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
4929
3997
|
const captureAvailable = captureState.available;
|
|
4930
3998
|
const liveWorkspaceExpected = sandboxAcceptsLiveIo(liveness);
|
|
4931
3999
|
const capturePending = !liveWorkspaceExpected && (captureState.fileCount === null || captureState.loading);
|
|
4932
|
-
const repoPaths =
|
|
4000
|
+
const repoPaths = useMemo10(() => {
|
|
4933
4001
|
const advertised = capabilities?.Git.repos ?? [];
|
|
4934
4002
|
if (advertised.length > 0) return advertised;
|
|
4935
4003
|
return captureState.capture?.repos.map((repo) => repo.root) ?? [];
|
|
@@ -4958,10 +4026,10 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
4958
4026
|
message: `Could not ${op}: ${error.message}`
|
|
4959
4027
|
})
|
|
4960
4028
|
});
|
|
4961
|
-
const [storedChangesComparison, setStoredChangesComparison] =
|
|
4029
|
+
const [storedChangesComparison, setStoredChangesComparison] = useState10(null);
|
|
4962
4030
|
const captureSupportsBranch = captureState.capture !== null && captureState.capture.repos.length > 0 && captureState.capture.repos.every((repo) => repo.branchDiff !== void 0);
|
|
4963
4031
|
const changesComparison = storedChangesComparison?.sessionId === sessionId ? storedChangesComparison.value : liveWorkspaceExpected || captureSupportsBranch ? "branch" : "working";
|
|
4964
|
-
const setChangesComparison =
|
|
4032
|
+
const setChangesComparison = useCallback16(
|
|
4965
4033
|
(value) => setStoredChangesComparison({ sessionId, value }),
|
|
4966
4034
|
[sessionId]
|
|
4967
4035
|
);
|
|
@@ -4978,13 +4046,13 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
4978
4046
|
comparison: changesComparison,
|
|
4979
4047
|
capture: changesComparison === "staged" ? null : captureState.capture
|
|
4980
4048
|
});
|
|
4981
|
-
|
|
4049
|
+
useEffect11(() => {
|
|
4982
4050
|
if (changesComparison === "branch" && git.error && storedChangesComparison?.sessionId !== sessionId) {
|
|
4983
4051
|
setStoredChangesComparison({ sessionId, value: "working" });
|
|
4984
4052
|
}
|
|
4985
4053
|
}, [changesComparison, git.error, sessionId, storedChangesComparison?.sessionId]);
|
|
4986
|
-
const [xtermTheme, setXtermTheme] =
|
|
4987
|
-
|
|
4054
|
+
const [xtermTheme, setXtermTheme] = useState10(void 0);
|
|
4055
|
+
useEffect11(() => {
|
|
4988
4056
|
if (!terminalEnabled || typeof document === "undefined") return;
|
|
4989
4057
|
const derive = () => setXtermTheme(xtermThemeFromTokens());
|
|
4990
4058
|
derive();
|
|
@@ -5006,7 +4074,7 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
5006
4074
|
});
|
|
5007
4075
|
const workspaceWaking = chip.state === "waking";
|
|
5008
4076
|
const defaultIdentity = `${sessionId}\0${surfaceIdentity}`;
|
|
5009
|
-
const defaultTabRef =
|
|
4077
|
+
const defaultTabRef = useRef10({
|
|
5010
4078
|
identity: defaultIdentity,
|
|
5011
4079
|
value: null
|
|
5012
4080
|
});
|
|
@@ -5031,15 +4099,15 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
5031
4099
|
}
|
|
5032
4100
|
}
|
|
5033
4101
|
const defaultTab = defaultTabRef.current.value;
|
|
5034
|
-
const tabs =
|
|
4102
|
+
const tabs = useMemo10(() => {
|
|
5035
4103
|
const list = [];
|
|
5036
4104
|
if (changesEnabled)
|
|
5037
4105
|
list.push({
|
|
5038
4106
|
id: WORKBENCH_TAB_CHANGES,
|
|
5039
4107
|
label: "Changes",
|
|
5040
|
-
icon: /* @__PURE__ */
|
|
5041
|
-
badge: dirtyCount > 0 ? /* @__PURE__ */
|
|
5042
|
-
content: /* @__PURE__ */
|
|
4108
|
+
icon: /* @__PURE__ */ jsx6(GitCompareArrowsIcon, {}),
|
|
4109
|
+
badge: dirtyCount > 0 ? /* @__PURE__ */ jsx6(DirtyBadge, { count: dirtyCount }) : void 0,
|
|
4110
|
+
content: /* @__PURE__ */ jsx6(
|
|
5043
4111
|
ChangesTabBody,
|
|
5044
4112
|
{
|
|
5045
4113
|
git,
|
|
@@ -5068,8 +4136,8 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
5068
4136
|
list.push({
|
|
5069
4137
|
id: WORKBENCH_TAB_FILES,
|
|
5070
4138
|
label: "Files",
|
|
5071
|
-
icon: /* @__PURE__ */
|
|
5072
|
-
content: /* @__PURE__ */
|
|
4139
|
+
icon: /* @__PURE__ */ jsx6(FileCode2Icon, {}),
|
|
4140
|
+
content: /* @__PURE__ */ jsx6(
|
|
5073
4141
|
FilesTabBody,
|
|
5074
4142
|
{
|
|
5075
4143
|
files,
|
|
@@ -5105,8 +4173,8 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
5105
4173
|
list.push({
|
|
5106
4174
|
id: WORKBENCH_TAB_TERMINAL,
|
|
5107
4175
|
label: "Terminal",
|
|
5108
|
-
icon: /* @__PURE__ */
|
|
5109
|
-
content: /* @__PURE__ */
|
|
4176
|
+
icon: /* @__PURE__ */ jsx6(SquareTerminalIcon, {}),
|
|
4177
|
+
content: /* @__PURE__ */ jsx6("div", { className: "h-full bg-og-bg p-1", children: /* @__PURE__ */ jsx6(
|
|
5110
4178
|
SandboxTerminal,
|
|
5111
4179
|
{
|
|
5112
4180
|
result: terminal,
|
|
@@ -5126,8 +4194,8 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
5126
4194
|
list.push({
|
|
5127
4195
|
id: WORKBENCH_TAB_BROWSER,
|
|
5128
4196
|
label: "Browser",
|
|
5129
|
-
icon: /* @__PURE__ */
|
|
5130
|
-
content: /* @__PURE__ */
|
|
4197
|
+
icon: /* @__PURE__ */ jsx6(Globe2Icon, {}),
|
|
4198
|
+
content: /* @__PURE__ */ jsx6(Suspense, { fallback: /* @__PURE__ */ jsx6(WorkbenchSurfaceLoading, { name: "Browser" }), children: /* @__PURE__ */ jsx6(
|
|
5131
4199
|
LazyBrowserViewer,
|
|
5132
4200
|
{
|
|
5133
4201
|
client,
|
|
@@ -5152,8 +4220,8 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
5152
4220
|
list.push({
|
|
5153
4221
|
id: WORKBENCH_TAB_DESKTOP,
|
|
5154
4222
|
label: "Desktop",
|
|
5155
|
-
icon: /* @__PURE__ */
|
|
5156
|
-
content: /* @__PURE__ */
|
|
4223
|
+
icon: /* @__PURE__ */ jsx6(MonitorIcon, {}),
|
|
4224
|
+
content: /* @__PURE__ */ jsx6(Suspense, { fallback: /* @__PURE__ */ jsx6(WorkbenchSurfaceLoading, { name: "Desktop" }), children: /* @__PURE__ */ jsx6(
|
|
5157
4225
|
LazyComputerViewer,
|
|
5158
4226
|
{
|
|
5159
4227
|
client,
|
|
@@ -5268,14 +4336,14 @@ function SandboxWorkspace(props) {
|
|
|
5268
4336
|
maxSize,
|
|
5269
4337
|
className
|
|
5270
4338
|
} = props;
|
|
5271
|
-
const [storedSelection, setStoredSelection] =
|
|
5272
|
-
const [requestedFile, setRequestedFile] =
|
|
5273
|
-
const [requestedComputer, setRequestedComputer] =
|
|
5274
|
-
const nextFileRequestId =
|
|
5275
|
-
const nextComputerRequestId =
|
|
4339
|
+
const [storedSelection, setStoredSelection] = useState10(null);
|
|
4340
|
+
const [requestedFile, setRequestedFile] = useState10(null);
|
|
4341
|
+
const [requestedComputer, setRequestedComputer] = useState10(null);
|
|
4342
|
+
const nextFileRequestId = useRef10(0);
|
|
4343
|
+
const nextComputerRequestId = useRef10(0);
|
|
5276
4344
|
const selectedTab = storedSelection?.sessionId === sessionId ? storedSelection.tab : null;
|
|
5277
|
-
const handledTabRequest =
|
|
5278
|
-
|
|
4345
|
+
const handledTabRequest = useRef10(null);
|
|
4346
|
+
useEffect11(() => {
|
|
5279
4347
|
if (!openTabRequest || handledTabRequest.current?.sessionId === sessionId && handledTabRequest.current.requestId === openTabRequest.requestId)
|
|
5280
4348
|
return;
|
|
5281
4349
|
const available = [...leadingTabs ?? [], ...trailingTabs ?? []].some(
|
|
@@ -5296,7 +4364,7 @@ function SandboxWorkspace(props) {
|
|
|
5296
4364
|
onCollapsedChange
|
|
5297
4365
|
]);
|
|
5298
4366
|
const activeTabHint = selectedTab ?? initialTab ?? leadingTabs?.[0]?.id ?? null;
|
|
5299
|
-
const openFile =
|
|
4367
|
+
const openFile = useCallback16(
|
|
5300
4368
|
(path, line) => {
|
|
5301
4369
|
setRequestedFile({
|
|
5302
4370
|
sessionId,
|
|
@@ -5311,14 +4379,14 @@ function SandboxWorkspace(props) {
|
|
|
5311
4379
|
},
|
|
5312
4380
|
[onActiveTabChange, onCollapsedChange, onFilePathChange, sessionId]
|
|
5313
4381
|
);
|
|
5314
|
-
const handledOpenFileRequestId =
|
|
5315
|
-
|
|
4382
|
+
const handledOpenFileRequestId = useRef10(null);
|
|
4383
|
+
useEffect11(() => {
|
|
5316
4384
|
if (!openFileRequest) return;
|
|
5317
4385
|
if (handledOpenFileRequestId.current === openFileRequest.requestId) return;
|
|
5318
4386
|
handledOpenFileRequestId.current = openFileRequest.requestId;
|
|
5319
4387
|
openFile(openFileRequest.path, openFileRequest.line);
|
|
5320
4388
|
}, [openFile, openFileRequest]);
|
|
5321
|
-
const openComputer =
|
|
4389
|
+
const openComputer = useCallback16(
|
|
5322
4390
|
(computerSessionId) => {
|
|
5323
4391
|
nextComputerRequestId.current += 1;
|
|
5324
4392
|
setRequestedComputer({
|
|
@@ -5367,18 +4435,18 @@ function SandboxWorkspace(props) {
|
|
|
5367
4435
|
const tabs = [...leadingTabs ?? [], ...workbenchTabs, ...trailingTabs ?? []];
|
|
5368
4436
|
const preferredTab = selectedTab ?? defaultTab;
|
|
5369
4437
|
const activeTab = preferredTab && tabs.some((tab) => tab.id === preferredTab) ? preferredTab : tabs[0]?.id;
|
|
5370
|
-
const selectTab =
|
|
4438
|
+
const selectTab = useCallback16(
|
|
5371
4439
|
(tab) => {
|
|
5372
4440
|
setStoredSelection({ sessionId, tab });
|
|
5373
4441
|
onActiveTabChange?.(tab);
|
|
5374
4442
|
},
|
|
5375
4443
|
[onActiveTabChange, sessionId]
|
|
5376
4444
|
);
|
|
5377
|
-
|
|
4445
|
+
useEffect11(() => {
|
|
5378
4446
|
if (selectedTab !== null || defaultTab === null) return;
|
|
5379
4447
|
setStoredSelection({ sessionId, tab: defaultTab });
|
|
5380
4448
|
}, [defaultTab, selectedTab, sessionId]);
|
|
5381
|
-
return /* @__PURE__ */
|
|
4449
|
+
return /* @__PURE__ */ jsx6(
|
|
5382
4450
|
WorkspaceDock,
|
|
5383
4451
|
{
|
|
5384
4452
|
primary,
|
|
@@ -5386,7 +4454,7 @@ function SandboxWorkspace(props) {
|
|
|
5386
4454
|
...activeTab !== void 0 ? { activeTab } : {},
|
|
5387
4455
|
onActiveTabChange: selectTab,
|
|
5388
4456
|
...machine.enabled && activeTab !== WORKBENCH_TAB_BROWSER && activeTab !== WORKBENCH_TAB_DESKTOP ? {
|
|
5389
|
-
headerAccessory: /* @__PURE__ */
|
|
4457
|
+
headerAccessory: /* @__PURE__ */ jsx6(MachineStateChip, { chip: machine.chip })
|
|
5390
4458
|
} : {},
|
|
5391
4459
|
...mobileLeadingControl !== void 0 ? { mobileLeadingControl } : {},
|
|
5392
4460
|
...collapsed !== void 0 ? { collapsed } : {},
|
|
@@ -5401,7 +4469,7 @@ function SandboxWorkspace(props) {
|
|
|
5401
4469
|
);
|
|
5402
4470
|
}
|
|
5403
4471
|
function DirtyBadge({ count }) {
|
|
5404
|
-
return /* @__PURE__ */
|
|
4472
|
+
return /* @__PURE__ */ jsx6("span", { className: "rounded-og-xs bg-og-accent-soft px-1 text-og-xs text-og-fg-muted", children: count });
|
|
5405
4473
|
}
|
|
5406
4474
|
function chipDotClass(state) {
|
|
5407
4475
|
if (state === "live") return "bg-og-status-running";
|
|
@@ -5409,27 +4477,27 @@ function chipDotClass(state) {
|
|
|
5409
4477
|
return "bg-og-fg-subtle";
|
|
5410
4478
|
}
|
|
5411
4479
|
function MachineStateChip({ chip }) {
|
|
5412
|
-
return /* @__PURE__ */
|
|
4480
|
+
return /* @__PURE__ */ jsxs5(
|
|
5413
4481
|
"div",
|
|
5414
4482
|
{
|
|
5415
4483
|
role: "status",
|
|
5416
4484
|
"aria-label": `Machine: ${chip.label}`,
|
|
5417
4485
|
className: "inline-flex min-h-7 min-w-0 items-center gap-1.5 px-2 py-1 text-og-xs font-medium text-og-fg-muted max-[1023px]:min-h-11 pointer-coarse:min-h-11",
|
|
5418
4486
|
children: [
|
|
5419
|
-
/* @__PURE__ */
|
|
4487
|
+
/* @__PURE__ */ jsx6(
|
|
5420
4488
|
"span",
|
|
5421
4489
|
{
|
|
5422
4490
|
className: cn("size-1.5 shrink-0 rounded-full", chipDotClass(chip.state)),
|
|
5423
4491
|
"aria-hidden": true
|
|
5424
4492
|
}
|
|
5425
4493
|
),
|
|
5426
|
-
/* @__PURE__ */
|
|
4494
|
+
/* @__PURE__ */ jsx6("span", { className: "min-w-0 max-w-[11rem] truncate", children: chip.label })
|
|
5427
4495
|
]
|
|
5428
4496
|
}
|
|
5429
4497
|
);
|
|
5430
4498
|
}
|
|
5431
4499
|
function DockActionButton({ onClick, children }) {
|
|
5432
|
-
return /* @__PURE__ */
|
|
4500
|
+
return /* @__PURE__ */ jsx6(
|
|
5433
4501
|
"button",
|
|
5434
4502
|
{
|
|
5435
4503
|
type: "button",
|
|
@@ -5444,12 +4512,12 @@ function ChangesTabBody({
|
|
|
5444
4512
|
onComparisonChange,
|
|
5445
4513
|
...props
|
|
5446
4514
|
}) {
|
|
5447
|
-
return /* @__PURE__ */
|
|
5448
|
-
/* @__PURE__ */
|
|
4515
|
+
return /* @__PURE__ */ jsxs5("div", { className: "flex h-full min-h-0 flex-col", children: [
|
|
4516
|
+
/* @__PURE__ */ jsx6("div", { className: "flex shrink-0 items-center gap-1 border-b border-og-border bg-og-surface-1 px-2 py-1.5", children: [
|
|
5449
4517
|
["branch", "Branch"],
|
|
5450
4518
|
["working", "Uncommitted"],
|
|
5451
4519
|
["staged", "Staged"]
|
|
5452
|
-
].map(([value, label]) => /* @__PURE__ */
|
|
4520
|
+
].map(([value, label]) => /* @__PURE__ */ jsx6(
|
|
5453
4521
|
"button",
|
|
5454
4522
|
{
|
|
5455
4523
|
type: "button",
|
|
@@ -5463,7 +4531,7 @@ function ChangesTabBody({
|
|
|
5463
4531
|
},
|
|
5464
4532
|
value
|
|
5465
4533
|
)) }),
|
|
5466
|
-
/* @__PURE__ */
|
|
4534
|
+
/* @__PURE__ */ jsx6("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsx6(ChangesTabContent, { comparison, ...props }) })
|
|
5467
4535
|
] });
|
|
5468
4536
|
}
|
|
5469
4537
|
function ChangesTabContent({
|
|
@@ -5483,8 +4551,8 @@ function ChangesTabContent({
|
|
|
5483
4551
|
}) {
|
|
5484
4552
|
const diff = git.diff;
|
|
5485
4553
|
if (diff.length > 0) {
|
|
5486
|
-
return /* @__PURE__ */
|
|
5487
|
-
git.error ? /* @__PURE__ */
|
|
4554
|
+
return /* @__PURE__ */ jsxs5("div", { className: "flex h-full min-h-0 flex-col", children: [
|
|
4555
|
+
git.error ? /* @__PURE__ */ jsxs5(
|
|
5488
4556
|
"div",
|
|
5489
4557
|
{
|
|
5490
4558
|
role: "status",
|
|
@@ -5492,9 +4560,9 @@ function ChangesTabContent({
|
|
|
5492
4560
|
"data-opengeni-changes-degraded": true,
|
|
5493
4561
|
className: "flex shrink-0 items-center gap-2 border-b border-og-status-running/30 bg-og-status-running/10 px-2 py-1.5 text-og-xs text-og-fg-muted",
|
|
5494
4562
|
children: [
|
|
5495
|
-
/* @__PURE__ */
|
|
5496
|
-
/* @__PURE__ */
|
|
5497
|
-
/* @__PURE__ */
|
|
4563
|
+
/* @__PURE__ */ jsx6(TriangleAlertIcon, { className: "size-3.5 shrink-0 text-og-status-running", "aria-hidden": true }),
|
|
4564
|
+
/* @__PURE__ */ jsx6("span", { className: "min-w-0 flex-1", children: git.source === "capture" ? "Live changes are temporarily unavailable. Showing the latest captured revision." : "Live refresh failed. Showing the last loaded changes." }),
|
|
4565
|
+
/* @__PURE__ */ jsxs5(
|
|
5498
4566
|
"button",
|
|
5499
4567
|
{
|
|
5500
4568
|
type: "button",
|
|
@@ -5502,7 +4570,7 @@ function ChangesTabContent({
|
|
|
5502
4570
|
disabled: git.loading,
|
|
5503
4571
|
className: "inline-flex min-h-7 shrink-0 items-center gap-1 rounded-og-sm border border-og-border bg-og-surface-1 px-2 font-medium text-og-fg transition-colors hover:border-og-border-strong focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:min-h-11",
|
|
5504
4572
|
children: [
|
|
5505
|
-
/* @__PURE__ */
|
|
4573
|
+
/* @__PURE__ */ jsx6(
|
|
5506
4574
|
RefreshCwIcon,
|
|
5507
4575
|
{
|
|
5508
4576
|
className: cn("size-3", git.loading && "animate-spin motion-reduce:animate-none"),
|
|
@@ -5516,7 +4584,7 @@ function ChangesTabContent({
|
|
|
5516
4584
|
]
|
|
5517
4585
|
}
|
|
5518
4586
|
) : null,
|
|
5519
|
-
/* @__PURE__ */
|
|
4587
|
+
/* @__PURE__ */ jsx6("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsx6(
|
|
5520
4588
|
WorkbenchChanges,
|
|
5521
4589
|
{
|
|
5522
4590
|
diff,
|
|
@@ -5529,20 +4597,20 @@ function ChangesTabContent({
|
|
|
5529
4597
|
] });
|
|
5530
4598
|
}
|
|
5531
4599
|
if (capabilitiesError && !captureAvailable) {
|
|
5532
|
-
return /* @__PURE__ */
|
|
5533
|
-
/* @__PURE__ */
|
|
5534
|
-
/* @__PURE__ */
|
|
5535
|
-
/* @__PURE__ */
|
|
5536
|
-
/* @__PURE__ */
|
|
4600
|
+
return /* @__PURE__ */ jsxs5(CenteredState, { icon: /* @__PURE__ */ jsx6(TriangleAlertIcon, { className: "size-5", "aria-hidden": true }), tone: "danger", children: [
|
|
4601
|
+
/* @__PURE__ */ jsx6("p", { className: "text-og-sm font-medium text-og-fg", children: "Sandbox unavailable" }),
|
|
4602
|
+
/* @__PURE__ */ jsx6("p", { "data-contrast-audited": true, className: "text-og-sm leading-5 text-og-fg-muted", children: capabilitiesError.message || "Couldn't reach the sandbox for this session." }),
|
|
4603
|
+
/* @__PURE__ */ jsxs5(DockActionButton, { onClick: onRetry, children: [
|
|
4604
|
+
/* @__PURE__ */ jsx6(RefreshCwIcon, { className: "size-3" }),
|
|
5537
4605
|
"Retry"
|
|
5538
4606
|
] })
|
|
5539
4607
|
] });
|
|
5540
4608
|
}
|
|
5541
4609
|
if ((capturePending || capabilitiesState === "negotiating") && !captureAvailable && !workspaceWaking) {
|
|
5542
|
-
return /* @__PURE__ */
|
|
4610
|
+
return /* @__PURE__ */ jsxs5(
|
|
5543
4611
|
CenteredState,
|
|
5544
4612
|
{
|
|
5545
|
-
icon: /* @__PURE__ */
|
|
4613
|
+
icon: /* @__PURE__ */ jsx6(
|
|
5546
4614
|
LoaderCircleIcon,
|
|
5547
4615
|
{
|
|
5548
4616
|
className: "size-5 animate-spin motion-reduce:animate-none",
|
|
@@ -5550,29 +4618,29 @@ function ChangesTabContent({
|
|
|
5550
4618
|
}
|
|
5551
4619
|
),
|
|
5552
4620
|
children: [
|
|
5553
|
-
/* @__PURE__ */
|
|
5554
|
-
/* @__PURE__ */
|
|
4621
|
+
/* @__PURE__ */ jsx6("p", { className: "text-og-sm font-medium text-og-fg", children: "Connecting workspace" }),
|
|
4622
|
+
/* @__PURE__ */ jsx6("p", { className: "text-og-sm leading-5 text-og-fg-subtle", children: "Looking for the latest files and changes\u2026" })
|
|
5555
4623
|
]
|
|
5556
4624
|
}
|
|
5557
4625
|
);
|
|
5558
4626
|
}
|
|
5559
4627
|
if (!liveWorkspaceExpected && (comparison !== "working" || !captureAvailable)) {
|
|
5560
4628
|
const previewUnavailable = captureDegraded && !captureAvailable && comparison !== "staged";
|
|
5561
|
-
return /* @__PURE__ */
|
|
4629
|
+
return /* @__PURE__ */ jsxs5(
|
|
5562
4630
|
CenteredState,
|
|
5563
4631
|
{
|
|
5564
|
-
icon: workspaceWaking ? /* @__PURE__ */
|
|
4632
|
+
icon: workspaceWaking ? /* @__PURE__ */ jsx6(
|
|
5565
4633
|
LoaderCircleIcon,
|
|
5566
4634
|
{
|
|
5567
4635
|
className: "size-5 animate-spin motion-reduce:animate-none",
|
|
5568
4636
|
"aria-hidden": true
|
|
5569
4637
|
}
|
|
5570
|
-
) : previewUnavailable ? /* @__PURE__ */
|
|
4638
|
+
) : previewUnavailable ? /* @__PURE__ */ jsx6(TriangleAlertIcon, { className: "size-5", "aria-hidden": true }) : /* @__PURE__ */ jsx6(CpuIcon, { className: "size-5", "aria-hidden": true }),
|
|
5571
4639
|
children: [
|
|
5572
|
-
/* @__PURE__ */
|
|
5573
|
-
/* @__PURE__ */
|
|
5574
|
-
!workspaceWaking ? /* @__PURE__ */
|
|
5575
|
-
/* @__PURE__ */
|
|
4640
|
+
/* @__PURE__ */ jsx6("p", { className: "text-og-sm font-medium text-og-fg", children: workspaceWaking ? "Waking workspace" : previewUnavailable ? "Saved changes preview is unavailable" : "Workspace is resting" }),
|
|
4641
|
+
/* @__PURE__ */ jsx6("p", { className: "text-og-sm leading-5 text-og-fg-subtle", children: workspaceWaking ? "Connecting to the live working tree\u2026" : previewUnavailable ? "Open the live workspace to view current changes." : comparison === "branch" ? "Wake the sandbox to compare this branch with the remote default branch." : comparison === "staged" ? "Wake the sandbox to inspect staged changes." : "No captured revision is available yet. Wake the sandbox to inspect uncommitted changes." }),
|
|
4642
|
+
!workspaceWaking ? /* @__PURE__ */ jsxs5(DockActionButton, { onClick: onWake, children: [
|
|
4643
|
+
/* @__PURE__ */ jsx6(CpuIcon, { className: "size-3" }),
|
|
5576
4644
|
"Open live workspace"
|
|
5577
4645
|
] }) : null
|
|
5578
4646
|
]
|
|
@@ -5580,10 +4648,10 @@ function ChangesTabContent({
|
|
|
5580
4648
|
);
|
|
5581
4649
|
}
|
|
5582
4650
|
if (git.loading && git.source === null) {
|
|
5583
|
-
return /* @__PURE__ */
|
|
4651
|
+
return /* @__PURE__ */ jsxs5(
|
|
5584
4652
|
CenteredState,
|
|
5585
4653
|
{
|
|
5586
|
-
icon: /* @__PURE__ */
|
|
4654
|
+
icon: /* @__PURE__ */ jsx6(
|
|
5587
4655
|
LoaderCircleIcon,
|
|
5588
4656
|
{
|
|
5589
4657
|
className: "size-5 animate-spin motion-reduce:animate-none",
|
|
@@ -5591,15 +4659,15 @@ function ChangesTabContent({
|
|
|
5591
4659
|
}
|
|
5592
4660
|
),
|
|
5593
4661
|
children: [
|
|
5594
|
-
/* @__PURE__ */
|
|
5595
|
-
/* @__PURE__ */
|
|
4662
|
+
/* @__PURE__ */ jsx6("p", { className: "text-og-sm font-medium text-og-fg", children: "Loading workspace" }),
|
|
4663
|
+
/* @__PURE__ */ jsx6("p", { className: "text-og-sm leading-5 text-og-fg-subtle", children: "Reading the current working tree\u2026" })
|
|
5596
4664
|
]
|
|
5597
4665
|
}
|
|
5598
4666
|
);
|
|
5599
4667
|
}
|
|
5600
|
-
return /* @__PURE__ */
|
|
5601
|
-
/* @__PURE__ */
|
|
5602
|
-
/* @__PURE__ */
|
|
4668
|
+
return /* @__PURE__ */ jsxs5(CenteredState, { icon: /* @__PURE__ */ jsx6(CircleCheckIcon, { className: "size-5", "aria-hidden": true }), tone: "success", children: [
|
|
4669
|
+
/* @__PURE__ */ jsx6("p", { className: "text-og-sm font-medium text-og-fg", children: comparison === "branch" ? "No branch changes" : comparison === "staged" ? "No staged changes" : "No uncommitted changes" }),
|
|
4670
|
+
/* @__PURE__ */ jsx6("p", { className: "text-og-sm leading-5 text-og-fg-subtle", children: comparison === "branch" ? "This branch matches the remote default branch." : comparison === "staged" ? "Stage files to review the next commit here." : "Local edits not yet committed will appear here." })
|
|
5603
4671
|
] });
|
|
5604
4672
|
}
|
|
5605
4673
|
function CenteredState({
|
|
@@ -5607,15 +4675,15 @@ function CenteredState({
|
|
|
5607
4675
|
icon,
|
|
5608
4676
|
tone = "neutral"
|
|
5609
4677
|
}) {
|
|
5610
|
-
return /* @__PURE__ */
|
|
4678
|
+
return /* @__PURE__ */ jsx6(
|
|
5611
4679
|
"div",
|
|
5612
4680
|
{
|
|
5613
4681
|
role: tone === "danger" ? "alert" : "status",
|
|
5614
4682
|
"aria-atomic": "true",
|
|
5615
4683
|
"aria-live": tone === "danger" ? "assertive" : "polite",
|
|
5616
4684
|
className: "grid h-full place-items-center p-6 text-center",
|
|
5617
|
-
children: /* @__PURE__ */
|
|
5618
|
-
icon ? /* @__PURE__ */
|
|
4685
|
+
children: /* @__PURE__ */ jsxs5("div", { className: "flex max-w-sm flex-col items-center gap-2.5", children: [
|
|
4686
|
+
icon ? /* @__PURE__ */ jsx6(
|
|
5619
4687
|
"span",
|
|
5620
4688
|
{
|
|
5621
4689
|
className: cn(
|
|
@@ -5634,7 +4702,7 @@ function CenteredState({
|
|
|
5634
4702
|
}
|
|
5635
4703
|
|
|
5636
4704
|
// src/hooks/use-codex-accounts.ts
|
|
5637
|
-
import { useCallback as
|
|
4705
|
+
import { useCallback as useCallback17, useState as useState11 } from "react";
|
|
5638
4706
|
function isCodexAccountEvent(event) {
|
|
5639
4707
|
return [
|
|
5640
4708
|
"codex.credential.selected",
|
|
@@ -5669,7 +4737,7 @@ function useCodexAccounts(options = {}) {
|
|
|
5669
4737
|
const codexClient = options.codexClient ?? client;
|
|
5670
4738
|
const sessionId = options.sessionId;
|
|
5671
4739
|
const sharedEvents = options.events;
|
|
5672
|
-
const load =
|
|
4740
|
+
const load = useCallback17(async () => {
|
|
5673
4741
|
if (sessionId) {
|
|
5674
4742
|
if (!codexClient.listSessionCodexAccounts)
|
|
5675
4743
|
throw new Error("Session Codex account projection is unavailable");
|
|
@@ -5697,9 +4765,9 @@ function useCodexAccounts(options = {}) {
|
|
|
5697
4765
|
});
|
|
5698
4766
|
const { run: runMutation, mutating: pinning, mutationError } = useMutationRunner();
|
|
5699
4767
|
const { run: runUsageMutation, mutating: refreshingUsage } = useMutationRunner();
|
|
5700
|
-
const [liveUsage, setLiveUsage] =
|
|
5701
|
-
const [pinningTarget, setPinningTarget] =
|
|
5702
|
-
const [switchReceipt, setSwitchReceipt] =
|
|
4768
|
+
const [liveUsage, setLiveUsage] = useState11({});
|
|
4769
|
+
const [pinningTarget, setPinningTarget] = useState11(null);
|
|
4770
|
+
const [switchReceipt, setSwitchReceipt] = useState11(null);
|
|
5703
4771
|
useSessionEventTrigger(
|
|
5704
4772
|
client,
|
|
5705
4773
|
workspaceId,
|
|
@@ -5711,7 +4779,7 @@ function useCodexAccounts(options = {}) {
|
|
|
5711
4779
|
...sharedEvents !== void 0 ? { events: sharedEvents } : {}
|
|
5712
4780
|
}
|
|
5713
4781
|
);
|
|
5714
|
-
const pin =
|
|
4782
|
+
const pin = useCallback17(
|
|
5715
4783
|
async (target) => {
|
|
5716
4784
|
if (!sessionId || !codexClient.pinSessionCodexAccount) {
|
|
5717
4785
|
return false;
|
|
@@ -5729,7 +4797,7 @@ function useCodexAccounts(options = {}) {
|
|
|
5729
4797
|
},
|
|
5730
4798
|
[codexClient, workspaceId, sessionId, runMutation, refresh]
|
|
5731
4799
|
);
|
|
5732
|
-
const refreshUsage =
|
|
4800
|
+
const refreshUsage = useCallback17(async () => {
|
|
5733
4801
|
if (!codexClient.refreshCodexUsage) {
|
|
5734
4802
|
return false;
|
|
5735
4803
|
}
|
|
@@ -5771,7 +4839,7 @@ function useCodexAccounts(options = {}) {
|
|
|
5771
4839
|
}
|
|
5772
4840
|
|
|
5773
4841
|
// src/hooks/use-supergrok-accounts.ts
|
|
5774
|
-
import { useCallback as
|
|
4842
|
+
import { useCallback as useCallback18 } from "react";
|
|
5775
4843
|
var EMPTY = {
|
|
5776
4844
|
accounts: [],
|
|
5777
4845
|
activeAccountId: null,
|
|
@@ -5784,7 +4852,7 @@ var EMPTY = {
|
|
|
5784
4852
|
function useSuperGrokAccounts(options = {}) {
|
|
5785
4853
|
const { client, workspaceId } = useOpenGeni(options);
|
|
5786
4854
|
const supergrokClient = options.supergrokClient ?? client;
|
|
5787
|
-
const load =
|
|
4855
|
+
const load = useCallback18(
|
|
5788
4856
|
async () => await supergrokClient.listSuperGrokAccounts(workspaceId),
|
|
5789
4857
|
[supergrokClient, workspaceId]
|
|
5790
4858
|
);
|
|
@@ -5793,7 +4861,7 @@ function useSuperGrokAccounts(options = {}) {
|
|
|
5793
4861
|
pollIntervalMs: options.pollIntervalMs
|
|
5794
4862
|
});
|
|
5795
4863
|
const { run, mutating: activating, mutationError } = useMutationRunner();
|
|
5796
|
-
const activate =
|
|
4864
|
+
const activate = useCallback18(
|
|
5797
4865
|
async (accountId) => {
|
|
5798
4866
|
if (!supergrokClient.activateSuperGrokAccount) return false;
|
|
5799
4867
|
const result = await run(async () => {
|
|
@@ -5819,21 +4887,22 @@ function useSuperGrokAccounts(options = {}) {
|
|
|
5819
4887
|
}
|
|
5820
4888
|
|
|
5821
4889
|
// src/components/anthropic-mark.tsx
|
|
5822
|
-
import { jsx as
|
|
4890
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
5823
4891
|
function AnthropicMark(props) {
|
|
5824
|
-
return /* @__PURE__ */
|
|
4892
|
+
return /* @__PURE__ */ jsx7("svg", { viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", ...props, children: /* @__PURE__ */ jsx7("path", { d: "M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z" }) });
|
|
5825
4893
|
}
|
|
5826
4894
|
|
|
5827
4895
|
// src/components/openrouter-mark.tsx
|
|
5828
|
-
import { jsx as
|
|
4896
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
5829
4897
|
function OpenRouterMark(props) {
|
|
5830
|
-
return /* @__PURE__ */
|
|
4898
|
+
return /* @__PURE__ */ jsx8("svg", { viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", ...props, children: /* @__PURE__ */ jsx8("path", { d: "M16.778 1.844v1.919q-.569-.026-1.138-.032-.708-.008-1.415.037c-1.93.126-4.023.728-6.149 2.237-2.911 2.066-2.731 1.95-4.14 2.75-.396.223-1.342.574-2.185.798-.841.225-1.753.333-1.751.333v4.229s.768.108 1.61.333c.842.224 1.789.575 2.185.799 1.41.798 1.228.683 4.14 2.75 2.126 1.509 4.22 2.11 6.148 2.236.88.058 1.716.041 2.555.005v1.918l7.222-4.168-7.222-4.17v2.176c-.86.038-1.611.065-2.278.021-1.364-.09-2.417-.357-3.979-1.465-2.244-1.593-2.866-2.027-3.68-2.508.889-.518 1.449-.906 3.822-2.59 1.56-1.109 2.614-1.377 3.978-1.466.667-.044 1.418-.017 2.278.02v2.176L24 6.014Z" }) });
|
|
5831
4899
|
}
|
|
5832
4900
|
export {
|
|
5833
4901
|
ActivityDisclosure,
|
|
5834
4902
|
ActivityRail,
|
|
5835
4903
|
AnthropicMark,
|
|
5836
4904
|
ApprovalSurface,
|
|
4905
|
+
ArtifactLabelsProvider,
|
|
5837
4906
|
BUILT_IN_TURN_SUMMARY_FACET_IDS,
|
|
5838
4907
|
BillingClassMark,
|
|
5839
4908
|
BodyNote,
|
|
@@ -5850,6 +4919,7 @@ export {
|
|
|
5850
4919
|
ConnectionStatusPill,
|
|
5851
4920
|
CopyButton,
|
|
5852
4921
|
CopyHoverFrame,
|
|
4922
|
+
DEFAULT_ARTIFACT_LABELS,
|
|
5853
4923
|
DesktopViewer,
|
|
5854
4924
|
DiffView,
|
|
5855
4925
|
DisclosureDefaultsProvider,
|
|
@@ -6041,7 +5111,10 @@ export {
|
|
|
6041
5111
|
projectPendingHumanInputRequests,
|
|
6042
5112
|
projectPickerRows,
|
|
6043
5113
|
rawTypeOf,
|
|
5114
|
+
registerCodeEditor,
|
|
5115
|
+
registerDesktopViewer,
|
|
6044
5116
|
registerPierreDiffs,
|
|
5117
|
+
registerSandboxTerminal,
|
|
6045
5118
|
retainedImageId,
|
|
6046
5119
|
runnableLatencyModesForModel,
|
|
6047
5120
|
sandboxCommandExitCode,
|
|
@@ -6119,6 +5192,7 @@ export {
|
|
|
6119
5192
|
useWorkspaces,
|
|
6120
5193
|
userMessageLikelyNeedsDisclosure,
|
|
6121
5194
|
v4aToGitFileDiff,
|
|
5195
|
+
viewerLinkResolver,
|
|
6122
5196
|
visibleFileTree,
|
|
6123
5197
|
xtermThemeFromTokens
|
|
6124
5198
|
};
|