@opengeni/react 3.5.1-canary.0 → 3.7.0-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/artifacts.d.ts +1 -1
- package/dist/artifacts.js +248 -6
- package/dist/artifacts.js.map +1 -1
- package/dist/{browser-viewer-E5DDEFQ4.js → browser-viewer-NTD6UIPR.js} +3 -3
- package/dist/{chunk-W2RGYBCV.js → chunk-24M4YBCL.js} +4 -4
- package/dist/{chunk-WY3MELVJ.js → chunk-5IXTJTK3.js} +1438 -397
- package/dist/chunk-5IXTJTK3.js.map +1 -0
- package/dist/chunk-5PQJOCX5.js +902 -0
- package/dist/chunk-5PQJOCX5.js.map +1 -0
- package/dist/{chunk-UNCXXIQR.js → chunk-INGB2N5R.js} +4310 -3982
- package/dist/chunk-INGB2N5R.js.map +1 -0
- package/dist/{chunk-TJFMMDQU.js → chunk-MOWYEBCQ.js} +1839 -17
- package/dist/chunk-MOWYEBCQ.js.map +1 -0
- package/dist/chunk-PAJU5KKL.js +331 -0
- package/dist/chunk-PAJU5KKL.js.map +1 -0
- package/dist/{chunk-VTOREEXF.js → chunk-PLYRL5ER.js} +24 -2
- package/dist/{chunk-VTOREEXF.js.map → chunk-PLYRL5ER.js.map} +1 -1
- package/dist/{chunk-YVCHAQZY.js → chunk-ZFOFY5ST.js} +27 -349
- package/dist/chunk-ZFOFY5ST.js.map +1 -0
- package/dist/client.d.ts +1 -1
- package/dist/components/artifacts/index.d.ts +1 -1
- package/dist/components/artifacts/published-html-artifact-frame.d.ts +46 -3
- package/dist/components/composer.d.ts +2 -0
- package/dist/components/session-chrome.d.ts +38 -5
- package/dist/components/session-commands-panel.d.ts +6 -0
- package/dist/components/session-conversation.d.ts +14 -0
- package/dist/components/timeline-anchor.d.ts +21 -0
- package/dist/composer.js +2 -3
- package/dist/conversation-timeline.d.ts +5 -0
- package/dist/{fleet-decision-row-GGCAT4E4.js → fleet-decision-row-YZ3ZKWMM.js} +2 -1
- package/dist/fleet-decision-row-YZ3ZKWMM.js.map +1 -0
- package/dist/hooks/use-file-attachments.d.ts +6 -0
- package/dist/hooks/use-sandbox-files.d.ts +4 -1
- package/dist/hooks/use-workspace-edit.d.ts +4 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +823 -965
- package/dist/index.js.map +1 -1
- package/dist/interaction.js +2 -2
- package/dist/lib/format.d.ts +5 -0
- package/dist/machines.js +3 -2
- package/dist/session-ui.d.ts +3 -0
- package/dist/session-ui.js +14 -4
- package/dist/session.js +19 -19
- package/dist/timeline/registry.d.ts +2 -0
- package/dist/timeline/types.d.ts +4 -2
- package/package.json +2 -2
- package/src/artifacts.ts +3 -0
- package/src/client.ts +2 -1
- package/src/components/artifacts/index.ts +3 -0
- package/src/components/artifacts/published-html-artifact-frame.tsx +307 -4
- package/src/components/composer.tsx +89 -25
- package/src/components/machine-input-display.ts +6 -0
- package/src/components/message-timeline.tsx +351 -204
- package/src/components/sandbox-workspace.tsx +11 -1
- package/src/components/session-chrome.tsx +501 -128
- package/src/components/session-commands-panel.tsx +113 -0
- package/src/components/session-conversation.tsx +141 -0
- package/src/components/timeline-anchor.tsx +91 -0
- package/src/conversation-timeline.ts +83 -0
- package/src/hooks/use-file-attachments.ts +34 -0
- package/src/hooks/use-sandbox-files.ts +68 -20
- package/src/hooks/use-session-background-commands.ts +21 -10
- package/src/hooks/use-session-events.ts +56 -39
- package/src/hooks/use-session.ts +23 -2
- package/src/hooks/use-workspace-edit.ts +23 -5
- package/src/index.ts +4 -0
- package/src/lib/format.ts +32 -0
- package/src/session-ui.ts +3 -0
- package/src/timeline/fleet-decision-projection.ts +2 -1
- package/src/timeline/fleet-decision-row.tsx +1 -0
- package/src/timeline/projection.ts +157 -19
- package/src/timeline/registry.ts +15 -3
- package/src/timeline/tool-renderers.tsx +117 -1
- package/src/timeline/types.ts +12 -1
- package/styles/compiled.css +495 -411
- package/styles/index.css +23 -0
- package/dist/chunk-7EAFGICR.js +0 -302
- package/dist/chunk-7EAFGICR.js.map +0 -1
- package/dist/chunk-IB27C53Y.js +0 -2582
- package/dist/chunk-IB27C53Y.js.map +0 -1
- package/dist/chunk-TJFMMDQU.js.map +0 -1
- package/dist/chunk-UNCXXIQR.js.map +0 -1
- package/dist/chunk-WY3MELVJ.js.map +0 -1
- package/dist/chunk-YVCHAQZY.js.map +0 -1
- package/dist/fleet-decision-row-GGCAT4E4.js.map +0 -1
- /package/dist/{browser-viewer-E5DDEFQ4.js.map → browser-viewer-NTD6UIPR.js.map} +0 -0
- /package/dist/{chunk-W2RGYBCV.js.map → chunk-24M4YBCL.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
MachinesDashboard,
|
|
22
22
|
MetricHistoryChart,
|
|
23
23
|
MetricSparkline,
|
|
24
|
-
OpenGeniProvider,
|
|
25
24
|
SharedMachineDisclosure,
|
|
26
25
|
WINDOW_LABEL,
|
|
27
26
|
connectionStatusForState,
|
|
@@ -29,7 +28,7 @@ import {
|
|
|
29
28
|
healthPulses,
|
|
30
29
|
pointsFor,
|
|
31
30
|
useMachines
|
|
32
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-ZFOFY5ST.js";
|
|
33
32
|
import {
|
|
34
33
|
DesktopViewer,
|
|
35
34
|
useDesktopStream,
|
|
@@ -43,73 +42,12 @@ import {
|
|
|
43
42
|
encodeStreamFrame,
|
|
44
43
|
encodeStreamOpen
|
|
45
44
|
} from "./chunk-5YK2ZDIG.js";
|
|
46
|
-
import {
|
|
47
|
-
Actions,
|
|
48
|
-
AttachButton,
|
|
49
|
-
Attachments,
|
|
50
|
-
CommandPalette,
|
|
51
|
-
CommandPalette2,
|
|
52
|
-
ComposerTranscriptionControl,
|
|
53
|
-
Confirmation,
|
|
54
|
-
Controls,
|
|
55
|
-
Footer,
|
|
56
|
-
Frame,
|
|
57
|
-
Help,
|
|
58
|
-
Hint,
|
|
59
|
-
INITIAL_TRANSCRIPTION_CONTROL_STATE,
|
|
60
|
-
IndexedDbVoiceRecordingStore,
|
|
61
|
-
Input,
|
|
62
|
-
ModelPicker,
|
|
63
|
-
ModelPicker2,
|
|
64
|
-
OPEN_WORKSTREAM_CONTROL_EVENT,
|
|
65
|
-
PauseButton,
|
|
66
|
-
PausedState,
|
|
67
|
-
RestoredResources,
|
|
68
|
-
Root,
|
|
69
|
-
SendButton,
|
|
70
|
-
Status,
|
|
71
|
-
Surface,
|
|
72
|
-
VOICE_RECORDING_CLIENT_MAX_DURATION_SECONDS,
|
|
73
|
-
VOICE_RECORDING_OWNER_HEARTBEAT_MILLISECONDS,
|
|
74
|
-
VOICE_RECORDING_OWNER_STALE_MILLISECONDS,
|
|
75
|
-
VOICE_RECORDING_TIMESLICE_MILLISECONDS,
|
|
76
|
-
VoiceRecordingChunkConflictError,
|
|
77
|
-
VoiceRecordingChunkSequenceError,
|
|
78
|
-
VoiceRecordingNotFoundError,
|
|
79
|
-
VoiceRecordingOwnedError,
|
|
80
|
-
VoiceRecordingStorageUnavailableError,
|
|
81
|
-
appendFinalTranscript,
|
|
82
|
-
argHint,
|
|
83
|
-
createVoiceRecordingManifest,
|
|
84
|
-
defaultChatComposerMessages,
|
|
85
|
-
defaultCommands,
|
|
86
|
-
filterCommands,
|
|
87
|
-
firstMissingRequiredArg,
|
|
88
|
-
hasPermission,
|
|
89
|
-
matchCommand,
|
|
90
|
-
parseCommandLine,
|
|
91
|
-
planVoiceRecordingChunkCommit,
|
|
92
|
-
prepareVoiceRecordingChunk,
|
|
93
|
-
transitionTranscriptionControl,
|
|
94
|
-
useChatComposerController,
|
|
95
|
-
useSlashCommands,
|
|
96
|
-
useTranscription,
|
|
97
|
-
useVoiceInput
|
|
98
|
-
} from "./chunk-UNCXXIQR.js";
|
|
99
|
-
import {
|
|
100
|
-
BillingClassMark,
|
|
101
|
-
ModelPolicyPicker,
|
|
102
|
-
ModelPolicyPickerMenu,
|
|
103
|
-
PickerAnimatedPage,
|
|
104
|
-
PickerBackHeader,
|
|
105
|
-
PickerNavRow,
|
|
106
|
-
defaultModelPolicyPickerMessages
|
|
107
|
-
} from "./chunk-4JFUT22W.js";
|
|
108
45
|
import {
|
|
109
46
|
ActivityDisclosure,
|
|
110
47
|
ActivityRail,
|
|
111
48
|
BUILT_IN_TURN_SUMMARY_FACET_IDS,
|
|
112
49
|
BodyNote,
|
|
50
|
+
ChatComposer,
|
|
113
51
|
CopyButton,
|
|
114
52
|
CopyHoverFrame,
|
|
115
53
|
DisclosureDefaultsProvider,
|
|
@@ -126,6 +64,8 @@ import {
|
|
|
126
64
|
SESSION_STATUS_META,
|
|
127
65
|
ScreenshotFigure,
|
|
128
66
|
SessionChrome,
|
|
67
|
+
SessionCommandsPanel,
|
|
68
|
+
SessionConversation,
|
|
129
69
|
SessionStatus,
|
|
130
70
|
StatusDot,
|
|
131
71
|
TermBlock,
|
|
@@ -160,56 +100,110 @@ import {
|
|
|
160
100
|
stripExecBanner,
|
|
161
101
|
tailPeek,
|
|
162
102
|
unwrapMcpOutput,
|
|
103
|
+
useAvailableModels,
|
|
163
104
|
useThemeType,
|
|
105
|
+
useWorkspaceModelCatalog,
|
|
164
106
|
userMessageLikelyNeedsDisclosure,
|
|
165
107
|
v4aToGitFileDiff
|
|
166
|
-
} from "./chunk-
|
|
108
|
+
} from "./chunk-5IXTJTK3.js";
|
|
109
|
+
import "./chunk-W3OUAH6M.js";
|
|
167
110
|
import {
|
|
168
|
-
|
|
169
|
-
} from "./chunk-
|
|
111
|
+
OpenGeniProvider
|
|
112
|
+
} from "./chunk-PAJU5KKL.js";
|
|
170
113
|
import {
|
|
171
114
|
copyTextToClipboard,
|
|
172
115
|
tableElementToTsv
|
|
173
116
|
} from "./chunk-JVYQRRC4.js";
|
|
174
117
|
import {
|
|
118
|
+
CommandPalette,
|
|
119
|
+
ComposerTranscriptionControl,
|
|
120
|
+
INITIAL_TRANSCRIPTION_CONTROL_STATE,
|
|
121
|
+
IndexedDbVoiceRecordingStore,
|
|
175
122
|
LightboxProvider,
|
|
123
|
+
ModelPicker,
|
|
124
|
+
OPEN_WORKSTREAM_CONTROL_EVENT,
|
|
176
125
|
Tooltip,
|
|
177
126
|
TooltipContent,
|
|
178
127
|
TooltipProvider,
|
|
179
128
|
TooltipTrigger,
|
|
129
|
+
VOICE_RECORDING_CLIENT_MAX_DURATION_SECONDS,
|
|
130
|
+
VOICE_RECORDING_OWNER_HEARTBEAT_MILLISECONDS,
|
|
131
|
+
VOICE_RECORDING_OWNER_STALE_MILLISECONDS,
|
|
132
|
+
VOICE_RECORDING_TIMESLICE_MILLISECONDS,
|
|
133
|
+
VoiceRecordingChunkConflictError,
|
|
134
|
+
VoiceRecordingChunkSequenceError,
|
|
135
|
+
VoiceRecordingNotFoundError,
|
|
136
|
+
VoiceRecordingOwnedError,
|
|
137
|
+
VoiceRecordingStorageUnavailableError,
|
|
138
|
+
appendFinalTranscript,
|
|
139
|
+
argHint,
|
|
140
|
+
createVoiceRecordingManifest,
|
|
141
|
+
defaultChatComposerMessages,
|
|
142
|
+
defaultCommands,
|
|
143
|
+
filterCommands,
|
|
144
|
+
firstMissingRequiredArg,
|
|
145
|
+
hasPermission,
|
|
146
|
+
matchCommand,
|
|
147
|
+
parseCommandLine,
|
|
148
|
+
planVoiceRecordingChunkCommit,
|
|
149
|
+
prepareVoiceRecordingChunk,
|
|
150
|
+
transitionTranscriptionControl,
|
|
180
151
|
useLightbox,
|
|
181
|
-
useLightboxOptional
|
|
182
|
-
|
|
152
|
+
useLightboxOptional,
|
|
153
|
+
useSlashCommands,
|
|
154
|
+
useTranscription,
|
|
155
|
+
useVoiceInput
|
|
156
|
+
} from "./chunk-INGB2N5R.js";
|
|
157
|
+
import {
|
|
158
|
+
BillingClassMark,
|
|
159
|
+
ModelPolicyPicker,
|
|
160
|
+
ModelPolicyPickerMenu,
|
|
161
|
+
PickerAnimatedPage,
|
|
162
|
+
PickerBackHeader,
|
|
163
|
+
PickerNavRow,
|
|
164
|
+
defaultModelPolicyPickerMessages
|
|
165
|
+
} from "./chunk-4JFUT22W.js";
|
|
183
166
|
import {
|
|
184
167
|
usePortalTokenSource,
|
|
185
168
|
usePortalTokenStyle
|
|
186
169
|
} from "./chunk-VZTQ73XT.js";
|
|
170
|
+
import {
|
|
171
|
+
approvalsFromRequiresAction,
|
|
172
|
+
createEmbeddedSessionClient,
|
|
173
|
+
isGoalEvent,
|
|
174
|
+
isLineageRefreshEvent,
|
|
175
|
+
isSessionMcpApprovalPolicyEvent,
|
|
176
|
+
projectPendingApprovals,
|
|
177
|
+
useFileAttachments,
|
|
178
|
+
useGoal,
|
|
179
|
+
useSessionControl,
|
|
180
|
+
useSessionLineage,
|
|
181
|
+
useSessionMcpApprovalPolicy
|
|
182
|
+
} from "./chunk-5PQJOCX5.js";
|
|
187
183
|
import {
|
|
188
184
|
SESSION_EVENT_BROWSER_MAX_BYTES,
|
|
189
185
|
SESSION_EVENT_BROWSER_MAX_COUNT,
|
|
190
186
|
SESSION_EVENT_BROWSER_PENDING_MAX_BYTES,
|
|
191
187
|
SESSION_EVENT_BROWSER_PENDING_MAX_COUNT,
|
|
192
188
|
SESSION_EVENT_BROWSER_SINGLE_EVENT_MAX_BYTES,
|
|
193
|
-
approvalsFromRequiresAction,
|
|
194
189
|
boundBrowserSessionEventWindow,
|
|
195
|
-
|
|
196
|
-
|
|
190
|
+
buildTimeline,
|
|
191
|
+
createOlderHistoryLoadReceipt,
|
|
192
|
+
creditExhaustedFromEvents,
|
|
193
|
+
extractSessionRef,
|
|
194
|
+
groupTimeline,
|
|
195
|
+
humanInputRequestFromEvent,
|
|
197
196
|
isHumanInputEvent,
|
|
198
|
-
isLineageRefreshEvent,
|
|
199
|
-
isSessionMcpApprovalPolicyEvent,
|
|
200
197
|
isTitleEvent,
|
|
201
198
|
isTurnQueueEvent,
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
199
|
+
projectPendingHumanInputRequests,
|
|
200
|
+
sessionStatusFromEvents,
|
|
201
|
+
toolDisplayName,
|
|
205
202
|
useHumanInputRequests,
|
|
206
203
|
useSession,
|
|
207
|
-
useSessionControl,
|
|
208
204
|
useSessionEvents,
|
|
209
|
-
useSessionLineage,
|
|
210
|
-
useSessionMcpApprovalPolicy,
|
|
211
205
|
useTurnQueue
|
|
212
|
-
} from "./chunk-
|
|
206
|
+
} from "./chunk-MOWYEBCQ.js";
|
|
213
207
|
import {
|
|
214
208
|
FILE_ONLY_MESSAGE_TEXT,
|
|
215
209
|
composeSendInput,
|
|
@@ -217,27 +211,6 @@ import {
|
|
|
217
211
|
shouldSubmitOnKey,
|
|
218
212
|
useComposer
|
|
219
213
|
} from "./chunk-IOLVN74D.js";
|
|
220
|
-
import {
|
|
221
|
-
useMutationRunner,
|
|
222
|
-
usePageLiveActivity,
|
|
223
|
-
usePolledValue,
|
|
224
|
-
useSessionEventTrigger
|
|
225
|
-
} from "./chunk-KZ73RL76.js";
|
|
226
|
-
import {
|
|
227
|
-
useOpenGeni,
|
|
228
|
-
useOpenGeniClient
|
|
229
|
-
} from "./chunk-NEXLLTP4.js";
|
|
230
|
-
import {
|
|
231
|
-
buildTimeline,
|
|
232
|
-
createOlderHistoryLoadReceipt,
|
|
233
|
-
creditExhaustedFromEvents,
|
|
234
|
-
extractSessionRef,
|
|
235
|
-
groupTimeline,
|
|
236
|
-
humanInputRequestFromEvent,
|
|
237
|
-
projectPendingHumanInputRequests,
|
|
238
|
-
sessionStatusFromEvents,
|
|
239
|
-
toolDisplayName
|
|
240
|
-
} from "./chunk-TJFMMDQU.js";
|
|
241
214
|
import {
|
|
242
215
|
COMPOSER_PAYMENT_REQUIRED_MESSAGE,
|
|
243
216
|
CREDIT_EXHAUSTION_MESSAGE,
|
|
@@ -247,10 +220,21 @@ import {
|
|
|
247
220
|
formatRelativeTime,
|
|
248
221
|
humanizeFailureReason,
|
|
249
222
|
isCreditExhaustion,
|
|
223
|
+
presentFailure,
|
|
250
224
|
stringifyPayload,
|
|
251
225
|
truncate,
|
|
252
226
|
tryParseJson
|
|
253
|
-
} from "./chunk-
|
|
227
|
+
} from "./chunk-PLYRL5ER.js";
|
|
228
|
+
import {
|
|
229
|
+
useMutationRunner,
|
|
230
|
+
usePageLiveActivity,
|
|
231
|
+
usePolledValue,
|
|
232
|
+
useSessionEventTrigger
|
|
233
|
+
} from "./chunk-KZ73RL76.js";
|
|
234
|
+
import {
|
|
235
|
+
useOpenGeni,
|
|
236
|
+
useOpenGeniClient
|
|
237
|
+
} from "./chunk-NEXLLTP4.js";
|
|
254
238
|
import {
|
|
255
239
|
advancedSourceSummary,
|
|
256
240
|
availabilityReasonLabel,
|
|
@@ -492,32 +476,43 @@ function useWorkspaceSessions(options = {}) {
|
|
|
492
476
|
}
|
|
493
477
|
|
|
494
478
|
// src/hooks/use-session-background-commands.ts
|
|
495
|
-
import { useCallback as useCallback4 } from "react";
|
|
479
|
+
import { useCallback as useCallback4, useEffect as useEffect3, useRef as useRef2 } from "react";
|
|
496
480
|
function useSessionBackgroundCommands(sessionId, options = {}) {
|
|
497
481
|
const { client, workspaceId } = useOpenGeni(options);
|
|
498
482
|
const enabled = (options.enabled ?? true) && Boolean(sessionId);
|
|
499
|
-
const load = useCallback4(
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
483
|
+
const load = useCallback4(
|
|
484
|
+
async (signal) => {
|
|
485
|
+
if (!sessionId) return { commands: [] };
|
|
486
|
+
if (!client.listSessionBackgroundCommands) {
|
|
487
|
+
throw new Error("The configured OpenGeni client does not support background commands");
|
|
488
|
+
}
|
|
489
|
+
return await client.listSessionBackgroundCommands(workspaceId, sessionId, { signal });
|
|
490
|
+
},
|
|
491
|
+
[client, workspaceId, sessionId]
|
|
492
|
+
);
|
|
506
493
|
const state = usePolledValue(load, {
|
|
507
494
|
enabled,
|
|
508
495
|
pollIntervalMs: options.pollIntervalMs
|
|
509
496
|
});
|
|
510
497
|
const refresh = state.refresh;
|
|
498
|
+
const generation = useRef2(0);
|
|
499
|
+
useEffect3(() => {
|
|
500
|
+
generation.current += 1;
|
|
501
|
+
return () => {
|
|
502
|
+
generation.current += 1;
|
|
503
|
+
};
|
|
504
|
+
}, [client, workspaceId, sessionId, enabled]);
|
|
511
505
|
const cancel = useCallback4(
|
|
512
506
|
async (commandId) => {
|
|
513
507
|
if (!sessionId) return;
|
|
514
508
|
if (!client.cancelSessionBackgroundCommand) {
|
|
515
509
|
throw new Error("The configured OpenGeni client does not support background commands");
|
|
516
510
|
}
|
|
511
|
+
const ticket = generation.current;
|
|
517
512
|
await client.cancelSessionBackgroundCommand(workspaceId, sessionId, commandId);
|
|
518
|
-
await refresh();
|
|
513
|
+
if (enabled && ticket === generation.current) await refresh();
|
|
519
514
|
},
|
|
520
|
-
[client, workspaceId, sessionId, refresh]
|
|
515
|
+
[client, workspaceId, sessionId, refresh, enabled]
|
|
521
516
|
);
|
|
522
517
|
return {
|
|
523
518
|
commands: state.data?.commands ?? [],
|
|
@@ -1172,65 +1167,12 @@ function useBillingUsage(options = {}) {
|
|
|
1172
1167
|
};
|
|
1173
1168
|
}
|
|
1174
1169
|
|
|
1175
|
-
// src/hooks/use-available-models.ts
|
|
1176
|
-
import { useCallback as useCallback11 } from "react";
|
|
1177
|
-
function useAvailableModels(options = {}) {
|
|
1178
|
-
const client = useOpenGeniClient(options);
|
|
1179
|
-
const load = useCallback11(
|
|
1180
|
-
async (signal) => await client.getClientConfig({ signal }),
|
|
1181
|
-
[client]
|
|
1182
|
-
);
|
|
1183
|
-
const state = usePolledValue(load, {
|
|
1184
|
-
pollIntervalMs: options.pollIntervalMs,
|
|
1185
|
-
enabled: options.enabled
|
|
1186
|
-
});
|
|
1187
|
-
return {
|
|
1188
|
-
models: state.data?.models ?? [],
|
|
1189
|
-
defaultModel: state.data?.defaultModel ?? null,
|
|
1190
|
-
loading: state.loading,
|
|
1191
|
-
error: state.error,
|
|
1192
|
-
refresh: state.refresh
|
|
1193
|
-
};
|
|
1194
|
-
}
|
|
1195
|
-
function useWorkspaceModelCatalog(options) {
|
|
1196
|
-
const client = useOpenGeniClient(options);
|
|
1197
|
-
const load = useCallback11(
|
|
1198
|
-
async (signal) => {
|
|
1199
|
-
if (!options.workspaceId) {
|
|
1200
|
-
return { models: [], defaultModel: null };
|
|
1201
|
-
}
|
|
1202
|
-
const [catalog, config] = await Promise.all([
|
|
1203
|
-
client.getWorkspaceModelCatalog(options.workspaceId, { signal }),
|
|
1204
|
-
client.getClientConfig({ signal })
|
|
1205
|
-
]);
|
|
1206
|
-
return {
|
|
1207
|
-
models: catalog.models,
|
|
1208
|
-
defaultModel: config.defaultModel
|
|
1209
|
-
};
|
|
1210
|
-
},
|
|
1211
|
-
[client, options.workspaceId]
|
|
1212
|
-
);
|
|
1213
|
-
const state = usePolledValue(load, {
|
|
1214
|
-
pollIntervalMs: options.pollIntervalMs,
|
|
1215
|
-
enabled: options.enabled !== false && Boolean(options.workspaceId)
|
|
1216
|
-
});
|
|
1217
|
-
const rows = sortPickerRows(projectPickerRows(state.data?.models ?? []));
|
|
1218
|
-
return {
|
|
1219
|
-
models: state.data?.models ?? [],
|
|
1220
|
-
rows,
|
|
1221
|
-
defaultModel: state.data?.defaultModel ?? null,
|
|
1222
|
-
loading: state.loading,
|
|
1223
|
-
error: state.error,
|
|
1224
|
-
refresh: state.refresh
|
|
1225
|
-
};
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
1170
|
// src/hooks/use-session-capabilities.ts
|
|
1229
1171
|
import {
|
|
1230
1172
|
OpenGeniApiError,
|
|
1231
1173
|
applyUrlRotation
|
|
1232
1174
|
} from "@opengeni/sdk";
|
|
1233
|
-
import { useCallback as
|
|
1175
|
+
import { useCallback as useCallback11, useEffect as useEffect4, useRef as useRef3, useState } from "react";
|
|
1234
1176
|
|
|
1235
1177
|
// src/lib/sandbox-liveness.ts
|
|
1236
1178
|
function sandboxAcceptsLiveIo(liveness) {
|
|
@@ -1277,13 +1219,13 @@ function useSessionCapabilities(sessionId, options = {}) {
|
|
|
1277
1219
|
const [viewerId, setViewerId] = useState(null);
|
|
1278
1220
|
const [stateIdentity, setStateIdentity] = useState(identityKey);
|
|
1279
1221
|
const [nonce, setNonce] = useState(0);
|
|
1280
|
-
const epochRef =
|
|
1281
|
-
const viewerIdRef =
|
|
1282
|
-
const previousIdentityRef =
|
|
1283
|
-
const renegotiate =
|
|
1222
|
+
const epochRef = useRef3(0);
|
|
1223
|
+
const viewerIdRef = useRef3(null);
|
|
1224
|
+
const previousIdentityRef = useRef3(identityKey);
|
|
1225
|
+
const renegotiate = useCallback11(() => {
|
|
1284
1226
|
setNonce((n) => n + 1);
|
|
1285
1227
|
}, []);
|
|
1286
|
-
|
|
1228
|
+
useEffect4(() => {
|
|
1287
1229
|
const identityChanged = previousIdentityRef.current !== identityKey;
|
|
1288
1230
|
previousIdentityRef.current = identityKey;
|
|
1289
1231
|
if (identityChanged) {
|
|
@@ -1511,7 +1453,7 @@ function useSessionCapabilities(sessionId, options = {}) {
|
|
|
1511
1453
|
identityKey
|
|
1512
1454
|
]);
|
|
1513
1455
|
const events = options.events;
|
|
1514
|
-
|
|
1456
|
+
useEffect4(() => {
|
|
1515
1457
|
if (!events || events.length === 0) return;
|
|
1516
1458
|
setCapabilities((prev) => {
|
|
1517
1459
|
if (!prev || !prev.DesktopStream.url) return prev;
|
|
@@ -1555,7 +1497,7 @@ import {
|
|
|
1555
1497
|
ttydResizeFrame,
|
|
1556
1498
|
TtydServerCommand
|
|
1557
1499
|
} from "@opengeni/sdk";
|
|
1558
|
-
import { useCallback as
|
|
1500
|
+
import { useCallback as useCallback12, useEffect as useEffect5, useMemo as useMemo4, useRef as useRef4, useState as useState2 } from "react";
|
|
1559
1501
|
var MAX_PENDING_TERMINAL_INPUT_CODE_UNITS = 64 * 1024;
|
|
1560
1502
|
var TERMINAL_CONNECT_EXPIRY_SKEW_MS = 5e3;
|
|
1561
1503
|
var TERMINAL_RECONNECT_INITIAL_MS = 100;
|
|
@@ -1623,25 +1565,25 @@ function useTerminalStream(options) {
|
|
|
1623
1565
|
const { capability, onOutput, onTitle, onReconnectNeeded, initialCols, initialRows } = options;
|
|
1624
1566
|
const [status, setStatus] = useState2("closed");
|
|
1625
1567
|
const [reconnectGeneration, setReconnectGeneration] = useState2(0);
|
|
1626
|
-
const wsRef =
|
|
1627
|
-
const pendingInputRef =
|
|
1628
|
-
const socketFailedRef =
|
|
1629
|
-
const socketAuthenticatedRef =
|
|
1630
|
-
const relayChannelRef =
|
|
1631
|
-
const relayIdentityRef =
|
|
1632
|
-
const relayInputSequenceRef =
|
|
1633
|
-
const relayOutputSequenceRef =
|
|
1634
|
-
const reconnectAttemptRef =
|
|
1635
|
-
const credentialIdentityRef =
|
|
1636
|
-
const refreshRequestedRef =
|
|
1637
|
-
const intentionalCloseRef =
|
|
1638
|
-
const sizeRef =
|
|
1568
|
+
const wsRef = useRef4(null);
|
|
1569
|
+
const pendingInputRef = useRef4("");
|
|
1570
|
+
const socketFailedRef = useRef4(false);
|
|
1571
|
+
const socketAuthenticatedRef = useRef4(false);
|
|
1572
|
+
const relayChannelRef = useRef4(null);
|
|
1573
|
+
const relayIdentityRef = useRef4(null);
|
|
1574
|
+
const relayInputSequenceRef = useRef4(0n);
|
|
1575
|
+
const relayOutputSequenceRef = useRef4(0n);
|
|
1576
|
+
const reconnectAttemptRef = useRef4(0);
|
|
1577
|
+
const credentialIdentityRef = useRef4(null);
|
|
1578
|
+
const refreshRequestedRef = useRef4(false);
|
|
1579
|
+
const intentionalCloseRef = useRef4(/* @__PURE__ */ new WeakSet());
|
|
1580
|
+
const sizeRef = useRef4({
|
|
1639
1581
|
cols: initialCols ?? 80,
|
|
1640
1582
|
rows: initialRows ?? 24
|
|
1641
1583
|
});
|
|
1642
|
-
const onOutputRef =
|
|
1643
|
-
const onTitleRef =
|
|
1644
|
-
const onReconnectNeededRef =
|
|
1584
|
+
const onOutputRef = useRef4(onOutput);
|
|
1585
|
+
const onTitleRef = useRef4(onTitle);
|
|
1586
|
+
const onReconnectNeededRef = useRef4(onReconnectNeeded);
|
|
1645
1587
|
onOutputRef.current = onOutput;
|
|
1646
1588
|
onTitleRef.current = onTitle;
|
|
1647
1589
|
onReconnectNeededRef.current = onReconnectNeeded;
|
|
@@ -1649,9 +1591,9 @@ function useTerminalStream(options) {
|
|
|
1649
1591
|
const url = capability?.url ?? null;
|
|
1650
1592
|
const token = capability?.token ?? null;
|
|
1651
1593
|
const expiresAt = capability?.expiresAt ?? null;
|
|
1652
|
-
const transportRef =
|
|
1594
|
+
const transportRef = useRef4(transport);
|
|
1653
1595
|
transportRef.current = transport;
|
|
1654
|
-
|
|
1596
|
+
useEffect5(() => {
|
|
1655
1597
|
if (typeof window === "undefined" || typeof WebSocket === "undefined") return;
|
|
1656
1598
|
const relay = transport === "relay-pty";
|
|
1657
1599
|
if (transport !== "pty-ws" && !relay) {
|
|
@@ -1868,7 +1810,7 @@ function useTerminalStream(options) {
|
|
|
1868
1810
|
closeSocket(socket);
|
|
1869
1811
|
};
|
|
1870
1812
|
}, [transport, url, token, expiresAt, reconnectGeneration]);
|
|
1871
|
-
const write =
|
|
1813
|
+
const write = useCallback12((data) => {
|
|
1872
1814
|
const currentTransport = transportRef.current;
|
|
1873
1815
|
const ws = wsRef.current;
|
|
1874
1816
|
if (ws && ws.readyState === WebSocket.OPEN && socketAuthenticatedRef.current) {
|
|
@@ -1896,7 +1838,7 @@ function useTerminalStream(options) {
|
|
|
1896
1838
|
pendingInputRef.current += data;
|
|
1897
1839
|
}
|
|
1898
1840
|
}, []);
|
|
1899
|
-
const resize =
|
|
1841
|
+
const resize = useCallback12((cols, rows) => {
|
|
1900
1842
|
if (cols <= 0 || rows <= 0) return;
|
|
1901
1843
|
sizeRef.current = { cols, rows };
|
|
1902
1844
|
const ws = wsRef.current;
|
|
@@ -1907,7 +1849,7 @@ function useTerminalStream(options) {
|
|
|
1907
1849
|
}
|
|
1908
1850
|
}
|
|
1909
1851
|
}, []);
|
|
1910
|
-
const disconnect =
|
|
1852
|
+
const disconnect = useCallback12(() => {
|
|
1911
1853
|
const ws = wsRef.current;
|
|
1912
1854
|
wsRef.current = null;
|
|
1913
1855
|
pendingInputRef.current = "";
|
|
@@ -1925,7 +1867,7 @@ function useTerminalStream(options) {
|
|
|
1925
1867
|
|
|
1926
1868
|
// src/hooks/use-sandbox-terminal.ts
|
|
1927
1869
|
import { OpenGeniApiError as OpenGeniApiError2 } from "@opengeni/sdk";
|
|
1928
|
-
import { useCallback as
|
|
1870
|
+
import { useCallback as useCallback13, useEffect as useEffect6, useMemo as useMemo5, useRef as useRef5, useState as useState3 } from "react";
|
|
1929
1871
|
function useSandboxTerminal(sessionId, options) {
|
|
1930
1872
|
const { client, workspaceId } = useOpenGeni(options);
|
|
1931
1873
|
const includeAgentFirehose = options.includeAgentFirehose ?? true;
|
|
@@ -1937,16 +1879,16 @@ function useSandboxTerminal(sessionId, options) {
|
|
|
1937
1879
|
const [openError, setOpenError] = useState3(null);
|
|
1938
1880
|
const [stateIdentity, setStateIdentity] = useState3(identityKey);
|
|
1939
1881
|
const [reopenNonce, setReopenNonce] = useState3(0);
|
|
1940
|
-
const currentIdentityRef =
|
|
1882
|
+
const currentIdentityRef = useRef5(identityKey);
|
|
1941
1883
|
currentIdentityRef.current = identityKey;
|
|
1942
|
-
|
|
1884
|
+
useEffect6(() => {
|
|
1943
1885
|
setStateIdentity(identityKey);
|
|
1944
1886
|
setOpenedPtyId(null);
|
|
1945
1887
|
setOpenError(null);
|
|
1946
1888
|
}, [identityKey]);
|
|
1947
|
-
const openInFlight =
|
|
1889
|
+
const openInFlight = useRef5(false);
|
|
1948
1890
|
const boxWarm = liveness === void 0 || sandboxAcceptsLiveIo(liveness);
|
|
1949
|
-
|
|
1891
|
+
useEffect6(() => {
|
|
1950
1892
|
if (!interactive || !sessionId || ptyFilter || !boxWarm) {
|
|
1951
1893
|
setOpenError(null);
|
|
1952
1894
|
return;
|
|
@@ -2041,7 +1983,7 @@ function useSandboxTerminal(sessionId, options) {
|
|
|
2041
1983
|
});
|
|
2042
1984
|
};
|
|
2043
1985
|
}, [client, workspaceId, sessionId, activePtyId, canWrite, openedPtyId, identityKey]);
|
|
2044
|
-
const close =
|
|
1986
|
+
const close = useCallback13(() => {
|
|
2045
1987
|
if (!activePtyId || !sessionId) return;
|
|
2046
1988
|
void client.terminalPtyClose(workspaceId, sessionId, { ptyId: activePtyId }).catch(() => {
|
|
2047
1989
|
});
|
|
@@ -2057,7 +1999,7 @@ function useSandboxTerminal(sessionId, options) {
|
|
|
2057
1999
|
}
|
|
2058
2000
|
|
|
2059
2001
|
// src/hooks/use-sandbox-files.ts
|
|
2060
|
-
import { useCallback as
|
|
2002
|
+
import { useCallback as useCallback14, useEffect as useEffect7, useMemo as useMemo6, useRef as useRef6, useState as useState4 } from "react";
|
|
2061
2003
|
var CapturedFileUnavailableError = class extends Error {
|
|
2062
2004
|
constructor(path, reason) {
|
|
2063
2005
|
super(
|
|
@@ -2085,8 +2027,11 @@ function normalizeRoot(root) {
|
|
|
2085
2027
|
const normalized = slashNormalized.replace(/\/+$/, "");
|
|
2086
2028
|
return normalized === "." ? "" : normalized;
|
|
2087
2029
|
}
|
|
2030
|
+
function isAbsoluteTreePath(path) {
|
|
2031
|
+
return path.startsWith("/") || /^[A-Za-z]:\//u.test(path);
|
|
2032
|
+
}
|
|
2088
2033
|
function joinTreeRoot(root, path) {
|
|
2089
|
-
if (!root || path
|
|
2034
|
+
if (!root || isAbsoluteTreePath(path)) return path;
|
|
2090
2035
|
return root === "/" ? `/${path}` : `${root}/${path}`;
|
|
2091
2036
|
}
|
|
2092
2037
|
function qualifyStatusPath(root, path, treeRoot) {
|
|
@@ -2174,6 +2119,7 @@ var FS_LIST_BATCH_REQUEST_LIMIT = 16;
|
|
|
2174
2119
|
function initialDirectoryFrontier(rootPath, repoPaths) {
|
|
2175
2120
|
const root = normalizeRoot(rootPath);
|
|
2176
2121
|
const rootParts = root.split("/").filter(Boolean);
|
|
2122
|
+
const rootPrefix = root.startsWith("//") ? "//" : root.startsWith("/") ? "/" : "";
|
|
2177
2123
|
const paths = /* @__PURE__ */ new Set();
|
|
2178
2124
|
for (const repoPath of repoPaths) {
|
|
2179
2125
|
const canonicalRepoPath = joinTreeRoot(root, normalizeRoot(repoPath));
|
|
@@ -2181,7 +2127,7 @@ function initialDirectoryFrontier(rootPath, repoPaths) {
|
|
|
2181
2127
|
if (rootParts.some((part, index) => parts[index] !== part)) continue;
|
|
2182
2128
|
for (let depth = rootParts.length + 1; depth <= parts.length; depth += 1) {
|
|
2183
2129
|
const path = parts.slice(0, depth).join("/");
|
|
2184
|
-
paths.add(
|
|
2130
|
+
paths.add(`${rootPrefix}${path}`);
|
|
2185
2131
|
}
|
|
2186
2132
|
}
|
|
2187
2133
|
return [...paths].sort((a, b) => a.split("/").length - b.split("/").length || a.localeCompare(b)).slice(0, 8);
|
|
@@ -2291,6 +2237,12 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2291
2237
|
const enabled = (options.enabled ?? true) && Boolean(sessionId);
|
|
2292
2238
|
const active = options.active ?? true;
|
|
2293
2239
|
const rootPath = options.rootPath ?? "";
|
|
2240
|
+
const routeEpoch = options.route?.epoch ?? null;
|
|
2241
|
+
const routeRoot = options.route?.root ?? null;
|
|
2242
|
+
const route = useMemo6(
|
|
2243
|
+
() => routeEpoch !== null && routeRoot !== null ? { epoch: routeEpoch, root: routeRoot } : void 0,
|
|
2244
|
+
[routeEpoch, routeRoot]
|
|
2245
|
+
);
|
|
2294
2246
|
const repoPathsKey = [
|
|
2295
2247
|
...new Set((options.repoPaths?.length ? options.repoPaths : [rootPath]).map(normalizeRoot))
|
|
2296
2248
|
].join("\0");
|
|
@@ -2298,12 +2250,12 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2298
2250
|
const capture = options.capture ?? null;
|
|
2299
2251
|
const isLive2 = sandboxAcceptsLiveIo(options.liveness);
|
|
2300
2252
|
const acceptsEventReads = options.liveness === void 0 || isLive2;
|
|
2301
|
-
const acceptsEventReadsRef =
|
|
2253
|
+
const acceptsEventReadsRef = useRef6(acceptsEventReads);
|
|
2302
2254
|
acceptsEventReadsRef.current = acceptsEventReads;
|
|
2303
2255
|
const hasLiveIoFence = options.liveness !== void 0;
|
|
2304
|
-
const identityKey = `${workspaceId}\0${sessionId ?? ""}\0${rootPath}\0${repoPathsKey}`;
|
|
2256
|
+
const identityKey = `${workspaceId}\0${sessionId ?? ""}\0${rootPath}\0${repoPathsKey}\0${routeEpoch ?? ""}\0${routeRoot ?? ""}`;
|
|
2305
2257
|
const [tree, setTree] = useState4([]);
|
|
2306
|
-
const treeRef =
|
|
2258
|
+
const treeRef = useRef6([]);
|
|
2307
2259
|
const [loading, setLoading] = useState4(false);
|
|
2308
2260
|
const [expandingPaths, setExpandingPaths] = useState4(/* @__PURE__ */ new Set());
|
|
2309
2261
|
const [error, setError] = useState4(null);
|
|
@@ -2312,23 +2264,23 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2312
2264
|
const [contentRevision, setContentRevision] = useState4(0);
|
|
2313
2265
|
const [stateIdentity, setStateIdentity] = useState4(identityKey);
|
|
2314
2266
|
const [source, setSource] = useState4(null);
|
|
2315
|
-
const sourceRef =
|
|
2316
|
-
const statusRef =
|
|
2317
|
-
const refreshGenerationRef =
|
|
2318
|
-
const refreshAbortRef =
|
|
2319
|
-
const identityAbortRef =
|
|
2320
|
-
const eventReadAbortRef =
|
|
2321
|
-
const identityGenerationRef =
|
|
2322
|
-
const lastSeqRef =
|
|
2323
|
-
const pendingParentsRef =
|
|
2324
|
-
const pendingGitRef =
|
|
2325
|
-
const eventReconcileInFlightRef =
|
|
2326
|
-
const eventReconcilePendingRef =
|
|
2327
|
-
const debounceRef =
|
|
2328
|
-
const ownRevisionsRef =
|
|
2267
|
+
const sourceRef = useRef6(null);
|
|
2268
|
+
const statusRef = useRef6(/* @__PURE__ */ new Map());
|
|
2269
|
+
const refreshGenerationRef = useRef6(0);
|
|
2270
|
+
const refreshAbortRef = useRef6(null);
|
|
2271
|
+
const identityAbortRef = useRef6(new AbortController());
|
|
2272
|
+
const eventReadAbortRef = useRef6(new AbortController());
|
|
2273
|
+
const identityGenerationRef = useRef6(0);
|
|
2274
|
+
const lastSeqRef = useRef6(0);
|
|
2275
|
+
const pendingParentsRef = useRef6(/* @__PURE__ */ new Set());
|
|
2276
|
+
const pendingGitRef = useRef6(false);
|
|
2277
|
+
const eventReconcileInFlightRef = useRef6(null);
|
|
2278
|
+
const eventReconcilePendingRef = useRef6(false);
|
|
2279
|
+
const debounceRef = useRef6(null);
|
|
2280
|
+
const ownRevisionsRef = useRef6(/* @__PURE__ */ new Set());
|
|
2329
2281
|
const onMutationError = options.onMutationError;
|
|
2330
2282
|
treeRef.current = tree;
|
|
2331
|
-
const applyStatus =
|
|
2283
|
+
const applyStatus = useCallback14((nodes) => {
|
|
2332
2284
|
const overlay = statusRef.current;
|
|
2333
2285
|
const walk = (list) => {
|
|
2334
2286
|
let changed = false;
|
|
@@ -2351,7 +2303,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2351
2303
|
};
|
|
2352
2304
|
return walk(nodes);
|
|
2353
2305
|
}, []);
|
|
2354
|
-
const refresh =
|
|
2306
|
+
const refresh = useCallback14(async () => {
|
|
2355
2307
|
if (!sessionId) return;
|
|
2356
2308
|
refreshAbortRef.current?.abort();
|
|
2357
2309
|
const refreshAbort = new AbortController();
|
|
@@ -2364,7 +2316,8 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2364
2316
|
const frontierPaths = initialDirectoryFrontier(rootPath, repoPaths);
|
|
2365
2317
|
const listRequests = [rootPath, ...frontierPaths].map((path) => ({
|
|
2366
2318
|
path,
|
|
2367
|
-
depth: 1
|
|
2319
|
+
depth: 1,
|
|
2320
|
+
...route ? { route } : {}
|
|
2368
2321
|
}));
|
|
2369
2322
|
const listedBatch = await client.fsListBatch(
|
|
2370
2323
|
workspaceId,
|
|
@@ -2433,8 +2386,8 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2433
2386
|
if (refreshGenerationRef.current === generation) setGitLoading(false);
|
|
2434
2387
|
if (refreshAbortRef.current === refreshAbort) refreshAbortRef.current = null;
|
|
2435
2388
|
}
|
|
2436
|
-
}, [client, workspaceId, sessionId, rootPath, repoPaths, applyStatus]);
|
|
2437
|
-
const seedFromCapture =
|
|
2389
|
+
}, [client, workspaceId, sessionId, rootPath, repoPaths, route, applyStatus]);
|
|
2390
|
+
const seedFromCapture = useCallback14(
|
|
2438
2391
|
(manifest) => {
|
|
2439
2392
|
const overlay = /* @__PURE__ */ new Map();
|
|
2440
2393
|
for (const file of manifest.files) {
|
|
@@ -2462,7 +2415,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2462
2415
|
},
|
|
2463
2416
|
[applyStatus]
|
|
2464
2417
|
);
|
|
2465
|
-
const expand =
|
|
2418
|
+
const expand = useCallback14(
|
|
2466
2419
|
async (path) => {
|
|
2467
2420
|
if (!sessionId) return;
|
|
2468
2421
|
if (source === "capture" && capture) return;
|
|
@@ -2477,7 +2430,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2477
2430
|
const listed = await client.fsList(
|
|
2478
2431
|
workspaceId,
|
|
2479
2432
|
sessionId,
|
|
2480
|
-
{ path, depth: 1 },
|
|
2433
|
+
{ path, depth: 1, ...route ? { route } : {} },
|
|
2481
2434
|
{ signal: identitySignal }
|
|
2482
2435
|
);
|
|
2483
2436
|
if (identityGenerationRef.current !== identityGeneration) return;
|
|
@@ -2497,9 +2450,9 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2497
2450
|
}
|
|
2498
2451
|
}
|
|
2499
2452
|
},
|
|
2500
|
-
[client, workspaceId, sessionId, capture, source, applyStatus]
|
|
2453
|
+
[client, workspaceId, sessionId, capture, source, route, applyStatus]
|
|
2501
2454
|
);
|
|
2502
|
-
const readFile =
|
|
2455
|
+
const readFile = useCallback14(
|
|
2503
2456
|
async (path, requestOptions = {}) => {
|
|
2504
2457
|
if (!sessionId) throw new Error("no session");
|
|
2505
2458
|
const identitySignal = identityAbortRef.current.signal;
|
|
@@ -2570,11 +2523,16 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2570
2523
|
}
|
|
2571
2524
|
throw new Error("Captured file download failed after refreshing its URL.");
|
|
2572
2525
|
}
|
|
2573
|
-
return await client.fsRead(
|
|
2526
|
+
return await client.fsRead(
|
|
2527
|
+
workspaceId,
|
|
2528
|
+
sessionId,
|
|
2529
|
+
{ path, ...route ? { route } : {} },
|
|
2530
|
+
{ signal }
|
|
2531
|
+
);
|
|
2574
2532
|
},
|
|
2575
|
-
[client, workspaceId, sessionId, capture, source]
|
|
2533
|
+
[client, workspaceId, sessionId, capture, source, route]
|
|
2576
2534
|
);
|
|
2577
|
-
const reconcilePath =
|
|
2535
|
+
const reconcilePath = useCallback14(
|
|
2578
2536
|
async (path, requestSignal) => {
|
|
2579
2537
|
if (!sessionId) return;
|
|
2580
2538
|
const identityGeneration = identityGenerationRef.current;
|
|
@@ -2582,7 +2540,12 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2582
2540
|
const signal = requestSignal ? AbortSignal.any([identitySignal, requestSignal]) : identitySignal;
|
|
2583
2541
|
if (!parentIsLoaded(treeRef.current, path, rootPath)) return;
|
|
2584
2542
|
try {
|
|
2585
|
-
const listed = await client.fsList(
|
|
2543
|
+
const listed = await client.fsList(
|
|
2544
|
+
workspaceId,
|
|
2545
|
+
sessionId,
|
|
2546
|
+
{ path, depth: 1, ...route ? { route } : {} },
|
|
2547
|
+
{ signal }
|
|
2548
|
+
);
|
|
2586
2549
|
if (identityGenerationRef.current !== identityGeneration) return;
|
|
2587
2550
|
const children = (listed.root.children ?? []).map((node) => fsNodeToTree(node));
|
|
2588
2551
|
if (path === normalizeRoot(rootPath)) {
|
|
@@ -2596,9 +2559,9 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2596
2559
|
} catch {
|
|
2597
2560
|
}
|
|
2598
2561
|
},
|
|
2599
|
-
[client, workspaceId, sessionId, rootPath, applyStatus]
|
|
2562
|
+
[client, workspaceId, sessionId, rootPath, route, applyStatus]
|
|
2600
2563
|
);
|
|
2601
|
-
const reconcilePaths =
|
|
2564
|
+
const reconcilePaths = useCallback14(
|
|
2602
2565
|
async (requestedPaths, requestSignal) => {
|
|
2603
2566
|
if (!sessionId) return;
|
|
2604
2567
|
const identityGeneration = identityGenerationRef.current;
|
|
@@ -2613,7 +2576,13 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2613
2576
|
const listed = await client.fsListBatch(
|
|
2614
2577
|
workspaceId,
|
|
2615
2578
|
sessionId,
|
|
2616
|
-
{
|
|
2579
|
+
{
|
|
2580
|
+
requests: chunk.map((path) => ({
|
|
2581
|
+
path,
|
|
2582
|
+
depth: 1,
|
|
2583
|
+
...route ? { route } : {}
|
|
2584
|
+
}))
|
|
2585
|
+
},
|
|
2617
2586
|
{ signal }
|
|
2618
2587
|
);
|
|
2619
2588
|
if (identityGenerationRef.current !== identityGeneration) return;
|
|
@@ -2637,9 +2606,9 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2637
2606
|
}
|
|
2638
2607
|
}
|
|
2639
2608
|
},
|
|
2640
|
-
[client, workspaceId, sessionId, rootPath, applyStatus]
|
|
2609
|
+
[client, workspaceId, sessionId, rootPath, route, applyStatus]
|
|
2641
2610
|
);
|
|
2642
|
-
const runOptimistic =
|
|
2611
|
+
const runOptimistic = useCallback14(
|
|
2643
2612
|
async (opName, apply, op, reconcileParents) => {
|
|
2644
2613
|
const identityGeneration = identityGenerationRef.current;
|
|
2645
2614
|
const snapshot = treeRef.current;
|
|
@@ -2669,7 +2638,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2669
2638
|
},
|
|
2670
2639
|
[applyStatus, reconcilePath, onMutationError]
|
|
2671
2640
|
);
|
|
2672
|
-
const writeFile =
|
|
2641
|
+
const writeFile = useCallback14(
|
|
2673
2642
|
async (path, content, writeOptions = {}) => {
|
|
2674
2643
|
if (!sessionId) throw new Error("no session");
|
|
2675
2644
|
const identityGeneration = identityGenerationRef.current;
|
|
@@ -2690,7 +2659,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2690
2659
|
const live = await client.fsRead(
|
|
2691
2660
|
workspaceId,
|
|
2692
2661
|
sessionId,
|
|
2693
|
-
{ path },
|
|
2662
|
+
{ path, ...route ? { route } : {} },
|
|
2694
2663
|
{ signal: identitySignal }
|
|
2695
2664
|
);
|
|
2696
2665
|
if (identityGenerationRef.current !== identityGeneration) {
|
|
@@ -2707,15 +2676,16 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2707
2676
|
return await client.fsWrite(workspaceId, sessionId, {
|
|
2708
2677
|
path,
|
|
2709
2678
|
content,
|
|
2710
|
-
overwrite: true
|
|
2679
|
+
overwrite: true,
|
|
2680
|
+
...route ? { route } : {}
|
|
2711
2681
|
});
|
|
2712
2682
|
},
|
|
2713
2683
|
exists ? [] : [parent]
|
|
2714
2684
|
);
|
|
2715
2685
|
},
|
|
2716
|
-
[client, workspaceId, sessionId, tree, rootPath, runOptimistic]
|
|
2686
|
+
[client, workspaceId, sessionId, tree, rootPath, route, runOptimistic]
|
|
2717
2687
|
);
|
|
2718
|
-
const createFile =
|
|
2688
|
+
const createFile = useCallback14(
|
|
2719
2689
|
async (path) => {
|
|
2720
2690
|
if (!sessionId) throw new Error("no session");
|
|
2721
2691
|
const parent = parentWithinTree(path, rootPath);
|
|
@@ -2731,14 +2701,15 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2731
2701
|
() => client.fsWrite(workspaceId, sessionId, {
|
|
2732
2702
|
path,
|
|
2733
2703
|
content: "",
|
|
2734
|
-
overwrite: false
|
|
2704
|
+
overwrite: false,
|
|
2705
|
+
...route ? { route } : {}
|
|
2735
2706
|
}),
|
|
2736
2707
|
[parent]
|
|
2737
2708
|
);
|
|
2738
2709
|
},
|
|
2739
|
-
[client, workspaceId, sessionId, rootPath, runOptimistic]
|
|
2710
|
+
[client, workspaceId, sessionId, rootPath, route, runOptimistic]
|
|
2740
2711
|
);
|
|
2741
|
-
const createDir =
|
|
2712
|
+
const createDir = useCallback14(
|
|
2742
2713
|
async (path) => {
|
|
2743
2714
|
if (!sessionId) throw new Error("no session");
|
|
2744
2715
|
const parent = parentWithinTree(path, rootPath);
|
|
@@ -2751,25 +2722,33 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2751
2722
|
await runOptimistic(
|
|
2752
2723
|
"create folder",
|
|
2753
2724
|
(nodes) => insertNode(nodes, parent, node, rootPath),
|
|
2754
|
-
() => client.fsMkdir(workspaceId, sessionId, {
|
|
2725
|
+
() => client.fsMkdir(workspaceId, sessionId, {
|
|
2726
|
+
path,
|
|
2727
|
+
recursive: true,
|
|
2728
|
+
...route ? { route } : {}
|
|
2729
|
+
}),
|
|
2755
2730
|
[parent]
|
|
2756
2731
|
);
|
|
2757
2732
|
},
|
|
2758
|
-
[client, workspaceId, sessionId, rootPath, runOptimistic]
|
|
2733
|
+
[client, workspaceId, sessionId, rootPath, route, runOptimistic]
|
|
2759
2734
|
);
|
|
2760
|
-
const deleteEntry =
|
|
2735
|
+
const deleteEntry = useCallback14(
|
|
2761
2736
|
async (path, recursive = false) => {
|
|
2762
2737
|
if (!sessionId) throw new Error("no session");
|
|
2763
2738
|
await runOptimistic(
|
|
2764
2739
|
"delete",
|
|
2765
2740
|
(nodes) => removeNode(nodes, path, rootPath),
|
|
2766
|
-
() => client.fsDelete(workspaceId, sessionId, {
|
|
2741
|
+
() => client.fsDelete(workspaceId, sessionId, {
|
|
2742
|
+
path,
|
|
2743
|
+
recursive,
|
|
2744
|
+
...route ? { route } : {}
|
|
2745
|
+
}),
|
|
2767
2746
|
[parentWithinTree(path, rootPath)]
|
|
2768
2747
|
);
|
|
2769
2748
|
},
|
|
2770
|
-
[client, workspaceId, sessionId, rootPath, runOptimistic]
|
|
2749
|
+
[client, workspaceId, sessionId, rootPath, route, runOptimistic]
|
|
2771
2750
|
);
|
|
2772
|
-
const moveEntry =
|
|
2751
|
+
const moveEntry = useCallback14(
|
|
2773
2752
|
async (path, newPath, opts) => {
|
|
2774
2753
|
if (!sessionId) throw new Error("no session");
|
|
2775
2754
|
const from = parentWithinTree(path, rootPath);
|
|
@@ -2785,18 +2764,19 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2785
2764
|
() => client.fsMove(workspaceId, sessionId, {
|
|
2786
2765
|
path,
|
|
2787
2766
|
newPath,
|
|
2788
|
-
overwrite: opts?.overwrite ?? false
|
|
2767
|
+
overwrite: opts?.overwrite ?? false,
|
|
2768
|
+
...route ? { route } : {}
|
|
2789
2769
|
}),
|
|
2790
2770
|
to === from ? [from] : [from, to]
|
|
2791
2771
|
);
|
|
2792
2772
|
},
|
|
2793
|
-
[client, workspaceId, sessionId, rootPath, runOptimistic]
|
|
2773
|
+
[client, workspaceId, sessionId, rootPath, route, runOptimistic]
|
|
2794
2774
|
);
|
|
2795
|
-
const captureRef =
|
|
2775
|
+
const captureRef = useRef6(capture);
|
|
2796
2776
|
captureRef.current = capture;
|
|
2797
2777
|
const captureRevision = capture?.revision ?? null;
|
|
2798
|
-
const previousIdentityRef =
|
|
2799
|
-
|
|
2778
|
+
const previousIdentityRef = useRef6(identityKey);
|
|
2779
|
+
useEffect7(() => {
|
|
2800
2780
|
refreshAbortRef.current?.abort();
|
|
2801
2781
|
refreshAbortRef.current = null;
|
|
2802
2782
|
refreshGenerationRef.current += 1;
|
|
@@ -2865,7 +2845,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2865
2845
|
refresh,
|
|
2866
2846
|
seedFromCapture
|
|
2867
2847
|
]);
|
|
2868
|
-
const refreshGitOverlay =
|
|
2848
|
+
const refreshGitOverlay = useCallback14(
|
|
2869
2849
|
async (requestSignal) => {
|
|
2870
2850
|
if (!sessionId) return;
|
|
2871
2851
|
const identityGeneration = identityGenerationRef.current;
|
|
@@ -2902,7 +2882,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2902
2882
|
},
|
|
2903
2883
|
[client, workspaceId, sessionId, repoPaths, rootPath, applyStatus]
|
|
2904
2884
|
);
|
|
2905
|
-
const performEventReconcile =
|
|
2885
|
+
const performEventReconcile = useCallback14(async () => {
|
|
2906
2886
|
const parents = pendingParentsRef.current;
|
|
2907
2887
|
pendingParentsRef.current = /* @__PURE__ */ new Set();
|
|
2908
2888
|
const wantGit = pendingGitRef.current;
|
|
@@ -2912,9 +2892,9 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2912
2892
|
await reconcilePaths(paths, signal);
|
|
2913
2893
|
if (wantGit) await refreshGitOverlay(signal);
|
|
2914
2894
|
}, [reconcilePaths, refreshGitOverlay]);
|
|
2915
|
-
const performEventReconcileRef =
|
|
2895
|
+
const performEventReconcileRef = useRef6(performEventReconcile);
|
|
2916
2896
|
performEventReconcileRef.current = performEventReconcile;
|
|
2917
|
-
const reconcilePendingEvents =
|
|
2897
|
+
const reconcilePendingEvents = useCallback14(async () => {
|
|
2918
2898
|
eventReconcilePendingRef.current = true;
|
|
2919
2899
|
const existing = eventReconcileInFlightRef.current;
|
|
2920
2900
|
if (existing) return await existing;
|
|
@@ -2933,7 +2913,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2933
2913
|
}
|
|
2934
2914
|
}, []);
|
|
2935
2915
|
const events = options.events;
|
|
2936
|
-
|
|
2916
|
+
useEffect7(() => {
|
|
2937
2917
|
if (!enabled || !events) return;
|
|
2938
2918
|
if (!active || !acceptsEventReads) {
|
|
2939
2919
|
for (const event of events) {
|
|
@@ -2991,7 +2971,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2991
2971
|
void reconcilePendingEvents();
|
|
2992
2972
|
}, 150);
|
|
2993
2973
|
}, [enabled, active, acceptsEventReads, events, rootPath, reconcilePendingEvents]);
|
|
2994
|
-
|
|
2974
|
+
useEffect7(() => {
|
|
2995
2975
|
if (active && acceptsEventReads) return;
|
|
2996
2976
|
if (debounceRef.current) {
|
|
2997
2977
|
clearTimeout(debounceRef.current);
|
|
@@ -3001,7 +2981,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
3001
2981
|
pendingGitRef.current = false;
|
|
3002
2982
|
eventReconcilePendingRef.current = false;
|
|
3003
2983
|
}, [active, acceptsEventReads]);
|
|
3004
|
-
|
|
2984
|
+
useEffect7(
|
|
3005
2985
|
() => () => {
|
|
3006
2986
|
refreshAbortRef.current?.abort();
|
|
3007
2987
|
identityAbortRef.current.abort();
|
|
@@ -3035,7 +3015,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
3035
3015
|
}
|
|
3036
3016
|
|
|
3037
3017
|
// src/hooks/use-sandbox-git.ts
|
|
3038
|
-
import { useCallback as
|
|
3018
|
+
import { useCallback as useCallback15, useEffect as useEffect8, useMemo as useMemo7, useRef as useRef7, useState as useState5 } from "react";
|
|
3039
3019
|
function normalizeRoot2(root) {
|
|
3040
3020
|
const normalized = root.replaceAll("\\", "/").replace(/^\.\/+/, "").replace(/\/+$/, "");
|
|
3041
3021
|
return normalized === "." ? "" : normalized;
|
|
@@ -3107,7 +3087,7 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
3107
3087
|
const capture = comparison === "staged" ? null : options.capture ?? null;
|
|
3108
3088
|
const isLive2 = sandboxAcceptsLiveIo(options.liveness);
|
|
3109
3089
|
const acceptsEventReads = options.liveness === void 0 || isLive2;
|
|
3110
|
-
const acceptsEventReadsRef =
|
|
3090
|
+
const acceptsEventReadsRef = useRef7(acceptsEventReads);
|
|
3111
3091
|
acceptsEventReadsRef.current = acceptsEventReads;
|
|
3112
3092
|
const hasLiveIoFence = options.liveness !== void 0;
|
|
3113
3093
|
const identityKey = `${workspaceId}\0${sessionId ?? ""}\0${repoPathsKey}\0${workspaceWide}\0${comparison}`;
|
|
@@ -3118,18 +3098,18 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
3118
3098
|
const [behind, setBehind] = useState5(0);
|
|
3119
3099
|
const [repoRoots, setRepoRoots] = useState5([]);
|
|
3120
3100
|
const [source, setSource] = useState5(null);
|
|
3121
|
-
const sourceRef =
|
|
3101
|
+
const sourceRef = useRef7(null);
|
|
3122
3102
|
const [loading, setLoading] = useState5(false);
|
|
3123
3103
|
const [error, setError] = useState5(null);
|
|
3124
3104
|
const [stateIdentity, setStateIdentity] = useState5(identityKey);
|
|
3125
|
-
const refreshGenerationRef =
|
|
3126
|
-
const refreshAbortRef =
|
|
3127
|
-
const refreshInFlightRef =
|
|
3128
|
-
const refreshPendingRef =
|
|
3129
|
-
const refreshWorkerEpochRef =
|
|
3130
|
-
const lastChangeRef =
|
|
3131
|
-
const eventRefreshTimerRef =
|
|
3132
|
-
const performRefresh =
|
|
3105
|
+
const refreshGenerationRef = useRef7(0);
|
|
3106
|
+
const refreshAbortRef = useRef7(null);
|
|
3107
|
+
const refreshInFlightRef = useRef7(null);
|
|
3108
|
+
const refreshPendingRef = useRef7(false);
|
|
3109
|
+
const refreshWorkerEpochRef = useRef7(0);
|
|
3110
|
+
const lastChangeRef = useRef7(0);
|
|
3111
|
+
const eventRefreshTimerRef = useRef7(null);
|
|
3112
|
+
const performRefresh = useCallback15(async () => {
|
|
3133
3113
|
if (!sessionId) return;
|
|
3134
3114
|
const refreshAbort = new AbortController();
|
|
3135
3115
|
refreshAbortRef.current = refreshAbort;
|
|
@@ -3241,9 +3221,9 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
3241
3221
|
workspaceWide,
|
|
3242
3222
|
comparison
|
|
3243
3223
|
]);
|
|
3244
|
-
const performRefreshRef =
|
|
3224
|
+
const performRefreshRef = useRef7(performRefresh);
|
|
3245
3225
|
performRefreshRef.current = performRefresh;
|
|
3246
|
-
const refresh =
|
|
3226
|
+
const refresh = useCallback15(async () => {
|
|
3247
3227
|
refreshPendingRef.current = true;
|
|
3248
3228
|
const existing = refreshInFlightRef.current;
|
|
3249
3229
|
if (existing) return await existing;
|
|
@@ -3261,7 +3241,7 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
3261
3241
|
if (refreshInFlightRef.current === run) refreshInFlightRef.current = null;
|
|
3262
3242
|
}
|
|
3263
3243
|
}, []);
|
|
3264
|
-
const seedFromCapture =
|
|
3244
|
+
const seedFromCapture = useCallback15(
|
|
3265
3245
|
(manifest) => {
|
|
3266
3246
|
const repositories = workspaceWide ? manifest.repos : [repoForPath(manifest, repoPath)].filter(Boolean);
|
|
3267
3247
|
if (comparison === "branch" && repositories.some((repo) => repo.branchDiff === void 0)) {
|
|
@@ -3298,11 +3278,11 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
3298
3278
|
},
|
|
3299
3279
|
[comparison, repoPath, workspaceWide]
|
|
3300
3280
|
);
|
|
3301
|
-
const captureRef =
|
|
3281
|
+
const captureRef = useRef7(capture);
|
|
3302
3282
|
captureRef.current = capture;
|
|
3303
3283
|
const captureRevision = capture?.revision ?? null;
|
|
3304
|
-
const previousIdentityRef =
|
|
3305
|
-
|
|
3284
|
+
const previousIdentityRef = useRef7(identityKey);
|
|
3285
|
+
useEffect8(() => {
|
|
3306
3286
|
refreshAbortRef.current?.abort();
|
|
3307
3287
|
refreshAbortRef.current = null;
|
|
3308
3288
|
refreshPendingRef.current = false;
|
|
@@ -3358,7 +3338,7 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
3358
3338
|
seedFromCapture
|
|
3359
3339
|
]);
|
|
3360
3340
|
const events = options.events;
|
|
3361
|
-
|
|
3341
|
+
useEffect8(() => {
|
|
3362
3342
|
if (!enabled || !events) {
|
|
3363
3343
|
if (eventRefreshTimerRef.current) {
|
|
3364
3344
|
clearTimeout(eventRefreshTimerRef.current);
|
|
@@ -3395,7 +3375,7 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
3395
3375
|
}, 150);
|
|
3396
3376
|
}
|
|
3397
3377
|
}, [enabled, active, acceptsEventReads, events, refresh]);
|
|
3398
|
-
|
|
3378
|
+
useEffect8(
|
|
3399
3379
|
() => () => {
|
|
3400
3380
|
if (eventRefreshTimerRef.current) clearTimeout(eventRefreshTimerRef.current);
|
|
3401
3381
|
},
|
|
@@ -3420,7 +3400,7 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
3420
3400
|
}
|
|
3421
3401
|
|
|
3422
3402
|
// src/hooks/use-workspace-capture.ts
|
|
3423
|
-
import { useCallback as
|
|
3403
|
+
import { useCallback as useCallback16, useEffect as useEffect9, useRef as useRef8, useState as useState6 } from "react";
|
|
3424
3404
|
var REVISION_CAPTURED = "workspace.revision.captured";
|
|
3425
3405
|
var REVISION_DEGRADED = "workspace.revision.degraded";
|
|
3426
3406
|
var MANIFEST_FETCH_TIMEOUT_MS = 15e3;
|
|
@@ -3467,10 +3447,10 @@ function useWorkspaceCapture(sessionId, options = {}) {
|
|
|
3467
3447
|
const [error, setError] = useState6(null);
|
|
3468
3448
|
const [announcedRevision, setAnnouncedRevision] = useState6(null);
|
|
3469
3449
|
const [stateIdentity, setStateIdentity] = useState6(identityKey);
|
|
3470
|
-
const generationRef =
|
|
3471
|
-
const requestAbortRef =
|
|
3472
|
-
const lastSeqRef =
|
|
3473
|
-
const refresh =
|
|
3450
|
+
const generationRef = useRef8(0);
|
|
3451
|
+
const requestAbortRef = useRef8(null);
|
|
3452
|
+
const lastSeqRef = useRef8(0);
|
|
3453
|
+
const refresh = useCallback16(async () => {
|
|
3474
3454
|
if (!sessionId) return;
|
|
3475
3455
|
requestAbortRef.current?.abort();
|
|
3476
3456
|
const requestAbort = new AbortController();
|
|
@@ -3543,7 +3523,7 @@ function useWorkspaceCapture(sessionId, options = {}) {
|
|
|
3543
3523
|
if (requestAbortRef.current === requestAbort) requestAbortRef.current = null;
|
|
3544
3524
|
}
|
|
3545
3525
|
}, [client, workspaceId, sessionId, identityKey]);
|
|
3546
|
-
|
|
3526
|
+
useEffect9(() => {
|
|
3547
3527
|
requestAbortRef.current?.abort();
|
|
3548
3528
|
requestAbortRef.current = null;
|
|
3549
3529
|
generationRef.current += 1;
|
|
@@ -3566,7 +3546,7 @@ function useWorkspaceCapture(sessionId, options = {}) {
|
|
|
3566
3546
|
};
|
|
3567
3547
|
}, [enabled, refresh]);
|
|
3568
3548
|
const events = options.events;
|
|
3569
|
-
|
|
3549
|
+
useEffect9(() => {
|
|
3570
3550
|
if (!enabled || !events) return;
|
|
3571
3551
|
let newest = null;
|
|
3572
3552
|
for (const event of events) {
|
|
@@ -3592,7 +3572,7 @@ function useWorkspaceCapture(sessionId, options = {}) {
|
|
|
3592
3572
|
const visibleCapture = identityMatches ? capture : null;
|
|
3593
3573
|
const visibleAnnouncedRevision = identityMatches ? announcedRevision : null;
|
|
3594
3574
|
const loadedRevision = visibleCapture?.revision ?? null;
|
|
3595
|
-
|
|
3575
|
+
useEffect9(() => {
|
|
3596
3576
|
if (!enabled) return;
|
|
3597
3577
|
if (visibleAnnouncedRevision === null) return;
|
|
3598
3578
|
if (loadedRevision !== null && visibleAnnouncedRevision <= loadedRevision) return;
|
|
@@ -3615,7 +3595,7 @@ function useWorkspaceCapture(sessionId, options = {}) {
|
|
|
3615
3595
|
}
|
|
3616
3596
|
|
|
3617
3597
|
// src/hooks/use-workspace-edit.ts
|
|
3618
|
-
import { useCallback as
|
|
3598
|
+
import { useCallback as useCallback17, useEffect as useEffect10, useMemo as useMemo8, useRef as useRef9, useState as useState7 } from "react";
|
|
3619
3599
|
function isLive(liveness) {
|
|
3620
3600
|
return sandboxAcceptsLiveIo(liveness);
|
|
3621
3601
|
}
|
|
@@ -3623,9 +3603,15 @@ function useWorkspaceEdit(sessionId, options = {}) {
|
|
|
3623
3603
|
const { client, workspaceId } = useOpenGeni(options);
|
|
3624
3604
|
const path = options.path ?? null;
|
|
3625
3605
|
const baseContent = options.baseContent ?? null;
|
|
3606
|
+
const routeEpoch = options.route?.epoch;
|
|
3607
|
+
const routeRoot = options.route?.root;
|
|
3608
|
+
const route = useMemo8(
|
|
3609
|
+
() => routeEpoch !== void 0 && routeRoot !== void 0 ? { epoch: routeEpoch, root: routeRoot } : void 0,
|
|
3610
|
+
[routeEpoch, routeRoot]
|
|
3611
|
+
);
|
|
3626
3612
|
const live = isLive(options.liveness);
|
|
3627
3613
|
const offline = options.offline === true;
|
|
3628
|
-
const identityKey = `${workspaceId}\0${sessionId ?? ""}\0${path ?? ""}`;
|
|
3614
|
+
const identityKey = `${workspaceId}\0${sessionId ?? ""}\0${path ?? ""}\0${routeEpoch ?? ""}\0${routeRoot ?? ""}`;
|
|
3629
3615
|
const [buffer, setBuffer] = useState7(null);
|
|
3630
3616
|
const [wantsWarm, setWantsWarm] = useState7(false);
|
|
3631
3617
|
const [flush, setFlush] = useState7("idle");
|
|
@@ -3633,13 +3619,13 @@ function useWorkspaceEdit(sessionId, options = {}) {
|
|
|
3633
3619
|
const [error, setError] = useState7(null);
|
|
3634
3620
|
const [stateIdentity, setStateIdentity] = useState7(identityKey);
|
|
3635
3621
|
const onWarmRequested = options.onWarmRequested;
|
|
3636
|
-
const bufferRef =
|
|
3622
|
+
const bufferRef = useRef9(null);
|
|
3637
3623
|
bufferRef.current = buffer;
|
|
3638
|
-
const flushingRef =
|
|
3639
|
-
const identityGenerationRef =
|
|
3640
|
-
const flushAttemptRef =
|
|
3641
|
-
const readAbortRef =
|
|
3642
|
-
|
|
3624
|
+
const flushingRef = useRef9(false);
|
|
3625
|
+
const identityGenerationRef = useRef9(0);
|
|
3626
|
+
const flushAttemptRef = useRef9(0);
|
|
3627
|
+
const readAbortRef = useRef9(null);
|
|
3628
|
+
useEffect10(() => {
|
|
3643
3629
|
identityGenerationRef.current += 1;
|
|
3644
3630
|
flushAttemptRef.current += 1;
|
|
3645
3631
|
readAbortRef.current?.abort();
|
|
@@ -3658,7 +3644,7 @@ function useWorkspaceEdit(sessionId, options = {}) {
|
|
|
3658
3644
|
readAbortRef.current = null;
|
|
3659
3645
|
};
|
|
3660
3646
|
}, [identityKey]);
|
|
3661
|
-
const edit =
|
|
3647
|
+
const edit = useCallback17(
|
|
3662
3648
|
(content) => {
|
|
3663
3649
|
if (stateIdentity !== identityKey) return;
|
|
3664
3650
|
if (offline) return;
|
|
@@ -3674,7 +3660,7 @@ function useWorkspaceEdit(sessionId, options = {}) {
|
|
|
3674
3660
|
},
|
|
3675
3661
|
[offline, live, onWarmRequested, stateIdentity, identityKey]
|
|
3676
3662
|
);
|
|
3677
|
-
const doFlush =
|
|
3663
|
+
const doFlush = useCallback17(
|
|
3678
3664
|
async (force) => {
|
|
3679
3665
|
if (stateIdentity !== identityKey) return;
|
|
3680
3666
|
if (!sessionId || !path) return;
|
|
@@ -3694,7 +3680,7 @@ function useWorkspaceEdit(sessionId, options = {}) {
|
|
|
3694
3680
|
const liveRead = await client.fsRead(
|
|
3695
3681
|
workspaceId,
|
|
3696
3682
|
sessionId,
|
|
3697
|
-
{ path },
|
|
3683
|
+
{ path, ...route ? { route } : {} },
|
|
3698
3684
|
{ signal: readAbort.signal }
|
|
3699
3685
|
);
|
|
3700
3686
|
if (readAbortRef.current === readAbort) readAbortRef.current = null;
|
|
@@ -3706,7 +3692,12 @@ function useWorkspaceEdit(sessionId, options = {}) {
|
|
|
3706
3692
|
return;
|
|
3707
3693
|
}
|
|
3708
3694
|
}
|
|
3709
|
-
await client.fsWrite(workspaceId, sessionId, {
|
|
3695
|
+
await client.fsWrite(workspaceId, sessionId, {
|
|
3696
|
+
path,
|
|
3697
|
+
content,
|
|
3698
|
+
overwrite: true,
|
|
3699
|
+
...route ? { route } : {}
|
|
3700
|
+
});
|
|
3710
3701
|
if (identityGenerationRef.current !== identityGeneration) return;
|
|
3711
3702
|
setConflict(null);
|
|
3712
3703
|
setFlush("flushed");
|
|
@@ -3722,19 +3713,19 @@ function useWorkspaceEdit(sessionId, options = {}) {
|
|
|
3722
3713
|
}
|
|
3723
3714
|
}
|
|
3724
3715
|
},
|
|
3725
|
-
[client, workspaceId, sessionId, path, baseContent, stateIdentity, identityKey]
|
|
3716
|
+
[client, workspaceId, sessionId, path, baseContent, route, stateIdentity, identityKey]
|
|
3726
3717
|
);
|
|
3727
|
-
|
|
3718
|
+
useEffect10(() => {
|
|
3728
3719
|
if (offline) return;
|
|
3729
3720
|
if (!live) return;
|
|
3730
3721
|
if (buffer === null) return;
|
|
3731
3722
|
if (flush === "flushed" || flush === "conflict" || flush === "flushing") return;
|
|
3732
3723
|
void doFlush(false);
|
|
3733
3724
|
}, [offline, live, buffer, flush, doFlush]);
|
|
3734
|
-
const overwrite =
|
|
3725
|
+
const overwrite = useCallback17(async () => {
|
|
3735
3726
|
await doFlush(true);
|
|
3736
3727
|
}, [doFlush]);
|
|
3737
|
-
const discard =
|
|
3728
|
+
const discard = useCallback17(() => {
|
|
3738
3729
|
setBuffer(null);
|
|
3739
3730
|
setWantsWarm(false);
|
|
3740
3731
|
setFlush("idle");
|
|
@@ -3774,7 +3765,7 @@ function useWorkspaceEdit(sessionId, options = {}) {
|
|
|
3774
3765
|
}
|
|
3775
3766
|
|
|
3776
3767
|
// src/hooks/use-machine-chip.ts
|
|
3777
|
-
import { useMemo as
|
|
3768
|
+
import { useMemo as useMemo9 } from "react";
|
|
3778
3769
|
function formatAsOf(capturedAt, now) {
|
|
3779
3770
|
const then = Date.parse(capturedAt);
|
|
3780
3771
|
if (Number.isNaN(then)) return "recently";
|
|
@@ -3824,7 +3815,7 @@ function useMachineChip(input) {
|
|
|
3824
3815
|
capturedAt,
|
|
3825
3816
|
now
|
|
3826
3817
|
} = input;
|
|
3827
|
-
return
|
|
3818
|
+
return useMemo9(
|
|
3828
3819
|
() => deriveMachineChip({
|
|
3829
3820
|
liveness,
|
|
3830
3821
|
capabilitiesState,
|
|
@@ -3850,7 +3841,7 @@ function useMachineChip(input) {
|
|
|
3850
3841
|
|
|
3851
3842
|
// src/components/approval-surface.tsx
|
|
3852
3843
|
import { CheckIcon, ShieldCheckIcon, XIcon } from "lucide-react";
|
|
3853
|
-
import { useEffect as
|
|
3844
|
+
import { useEffect as useEffect11, useId, useRef as useRef10, useState as useState8 } from "react";
|
|
3854
3845
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3855
3846
|
var defaultApprovalSurfaceMessages = {
|
|
3856
3847
|
title: "Approval required",
|
|
@@ -3891,9 +3882,9 @@ function ApprovalSurface({
|
|
|
3891
3882
|
const titleId = useId();
|
|
3892
3883
|
const messages = { ...defaultApprovalSurfaceMessages, ...overrides };
|
|
3893
3884
|
const [pending, setPending] = useState8(null);
|
|
3894
|
-
const pendingRef =
|
|
3885
|
+
const pendingRef = useRef10(null);
|
|
3895
3886
|
const [decisionError, setDecisionError] = useState8(null);
|
|
3896
|
-
|
|
3887
|
+
useEffect11(() => {
|
|
3897
3888
|
if (pending && !approvals.some((approval) => approvalOwnershipKey(approval) === pending.approvalKey)) {
|
|
3898
3889
|
if (pendingRef.current?.token === pending.token) {
|
|
3899
3890
|
pendingRef.current = null;
|
|
@@ -3990,152 +3981,9 @@ function ApprovalSurface({
|
|
|
3990
3981
|
);
|
|
3991
3982
|
}
|
|
3992
3983
|
|
|
3993
|
-
// src/components/chat-composer.tsx
|
|
3994
|
-
import { LayoutGroup, motion } from "motion/react";
|
|
3995
|
-
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
3996
|
-
function ChatComposer({
|
|
3997
|
-
composer,
|
|
3998
|
-
responsiveBasis,
|
|
3999
|
-
effectiveControl,
|
|
4000
|
-
queuedAheadCount,
|
|
4001
|
-
canControlWorkspace,
|
|
4002
|
-
controlLinks,
|
|
4003
|
-
placeholder,
|
|
4004
|
-
disabled,
|
|
4005
|
-
autoFocus,
|
|
4006
|
-
hint,
|
|
4007
|
-
controlsLeading,
|
|
4008
|
-
controlsStart,
|
|
4009
|
-
actionsStart,
|
|
4010
|
-
attachButtonClassName,
|
|
4011
|
-
transcription,
|
|
4012
|
-
transcriptionClassName,
|
|
4013
|
-
transcriptionSuppressed = false,
|
|
4014
|
-
header,
|
|
4015
|
-
onPaste,
|
|
4016
|
-
attachments,
|
|
4017
|
-
models,
|
|
4018
|
-
selectedModel,
|
|
4019
|
-
onSelectModel,
|
|
4020
|
-
className,
|
|
4021
|
-
commands,
|
|
4022
|
-
commandContext,
|
|
4023
|
-
onClearView,
|
|
4024
|
-
messages
|
|
4025
|
-
}) {
|
|
4026
|
-
const controller = useChatComposerController({
|
|
4027
|
-
delivery: composer,
|
|
4028
|
-
draft: composer,
|
|
4029
|
-
control: composer,
|
|
4030
|
-
effectiveControl,
|
|
4031
|
-
queuedAheadCount,
|
|
4032
|
-
canControlWorkspace,
|
|
4033
|
-
controlLinks,
|
|
4034
|
-
disabled,
|
|
4035
|
-
attachments,
|
|
4036
|
-
commands,
|
|
4037
|
-
commandContext,
|
|
4038
|
-
onClearView,
|
|
4039
|
-
onPaste,
|
|
4040
|
-
messages
|
|
4041
|
-
});
|
|
4042
|
-
const hasControls = Boolean(
|
|
4043
|
-
attachments || models || controlsLeading || controlsStart || transcription
|
|
4044
|
-
);
|
|
4045
|
-
const stackActions = hasControls && Boolean(actionsStart);
|
|
4046
|
-
return /* @__PURE__ */ jsx2(Fragment2, { children: /* @__PURE__ */ jsxs2(Root, { controller, responsiveBasis, className, children: [
|
|
4047
|
-
/* @__PURE__ */ jsxs2(Frame, { children: [
|
|
4048
|
-
/* @__PURE__ */ jsx2(CommandPalette2, {}),
|
|
4049
|
-
/* @__PURE__ */ jsxs2(Surface, { children: [
|
|
4050
|
-
/* @__PURE__ */ jsx2(PausedState, {}),
|
|
4051
|
-
/* @__PURE__ */ jsx2(RestoredResources, {}),
|
|
4052
|
-
/* @__PURE__ */ jsx2(Attachments, {}),
|
|
4053
|
-
header,
|
|
4054
|
-
composer.annotations && composer.annotations.length > 0 ? /* @__PURE__ */ jsx2("div", { className: "px-3 pt-2 sm:px-4", children: /* @__PURE__ */ jsx2(
|
|
4055
|
-
TimelineAnnotationsChip,
|
|
4056
|
-
{
|
|
4057
|
-
annotations: composer.annotations,
|
|
4058
|
-
editable: true,
|
|
4059
|
-
focusAnnotationId: composer.annotationReviewTargetId,
|
|
4060
|
-
onFocusConsumed: composer.clearAnnotationReviewTarget,
|
|
4061
|
-
onUpdate: composer.updateAnnotation,
|
|
4062
|
-
onRemove: composer.removeAnnotation
|
|
4063
|
-
}
|
|
4064
|
-
) }) : null,
|
|
4065
|
-
/* @__PURE__ */ jsx2(Input, { placeholder, autoFocus }),
|
|
4066
|
-
controller.confirmState ? /* @__PURE__ */ jsx2(Confirmation, {}) : /* @__PURE__ */ jsx2(
|
|
4067
|
-
Footer,
|
|
4068
|
-
{
|
|
4069
|
-
"data-og-stack-actions": stackActions ? "" : void 0,
|
|
4070
|
-
className: stackActions ? "max-sm:flex-nowrap sm:flex-wrap" : void 0,
|
|
4071
|
-
children: /* @__PURE__ */ jsxs2(LayoutGroup, { id: "og-composer-footer", children: [
|
|
4072
|
-
hasControls ? /* @__PURE__ */ jsxs2(
|
|
4073
|
-
Controls,
|
|
4074
|
-
{
|
|
4075
|
-
className: stackActions ? "min-w-0 max-sm:flex-1 sm:w-auto" : void 0,
|
|
4076
|
-
children: [
|
|
4077
|
-
controlsLeading,
|
|
4078
|
-
/* @__PURE__ */ jsx2(AttachButton, { className: attachButtonClassName }),
|
|
4079
|
-
transcription ? /* @__PURE__ */ jsx2(
|
|
4080
|
-
ComposerTranscriptionControl,
|
|
4081
|
-
{
|
|
4082
|
-
...transcription,
|
|
4083
|
-
suppressed: transcriptionSuppressed,
|
|
4084
|
-
className: [transcription.className, transcriptionClassName].filter(Boolean).join(" ")
|
|
4085
|
-
}
|
|
4086
|
-
) : null,
|
|
4087
|
-
models ? /* @__PURE__ */ jsx2(
|
|
4088
|
-
motion.span,
|
|
4089
|
-
{
|
|
4090
|
-
layout: true,
|
|
4091
|
-
transition: { duration: 0.36, ease: [0.22, 1, 0.36, 1] },
|
|
4092
|
-
className: "inline-flex min-w-0",
|
|
4093
|
-
children: /* @__PURE__ */ jsx2(
|
|
4094
|
-
ModelPicker2,
|
|
4095
|
-
{
|
|
4096
|
-
models,
|
|
4097
|
-
value: selectedModel,
|
|
4098
|
-
onChange: onSelectModel
|
|
4099
|
-
}
|
|
4100
|
-
)
|
|
4101
|
-
}
|
|
4102
|
-
) : null,
|
|
4103
|
-
controlsStart ? /* @__PURE__ */ jsx2(
|
|
4104
|
-
motion.span,
|
|
4105
|
-
{
|
|
4106
|
-
layout: true,
|
|
4107
|
-
transition: { duration: 0.36, ease: [0.22, 1, 0.36, 1] },
|
|
4108
|
-
className: "inline-flex min-w-0 flex-1 items-center gap-1.5",
|
|
4109
|
-
children: controlsStart
|
|
4110
|
-
}
|
|
4111
|
-
) : null
|
|
4112
|
-
]
|
|
4113
|
-
}
|
|
4114
|
-
) : /* @__PURE__ */ jsx2(Hint, { children: hint }),
|
|
4115
|
-
/* @__PURE__ */ jsxs2(
|
|
4116
|
-
Actions,
|
|
4117
|
-
{
|
|
4118
|
-
className: stackActions ? "max-sm:shrink-0 sm:w-auto sm:justify-end" : void 0,
|
|
4119
|
-
children: [
|
|
4120
|
-
actionsStart,
|
|
4121
|
-
/* @__PURE__ */ jsx2(PauseButton, {}),
|
|
4122
|
-
/* @__PURE__ */ jsx2(SendButton, {})
|
|
4123
|
-
]
|
|
4124
|
-
}
|
|
4125
|
-
)
|
|
4126
|
-
] })
|
|
4127
|
-
}
|
|
4128
|
-
)
|
|
4129
|
-
] })
|
|
4130
|
-
] }),
|
|
4131
|
-
/* @__PURE__ */ jsx2(Help, {}),
|
|
4132
|
-
/* @__PURE__ */ jsx2(Status, {})
|
|
4133
|
-
] }) });
|
|
4134
|
-
}
|
|
4135
|
-
|
|
4136
3984
|
// src/components/fleet-tile.tsx
|
|
4137
3985
|
import { deriveSessionDisplayTitle } from "@opengeni/sdk";
|
|
4138
|
-
import { jsx as
|
|
3986
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
4139
3987
|
var SESSION_METADATA_TITLE_KEYS = ["title", "name"];
|
|
4140
3988
|
function sessionDisplayTitle(session) {
|
|
4141
3989
|
return deriveSessionDisplayTitle(session, { metadataKeys: SESSION_METADATA_TITLE_KEYS });
|
|
@@ -4143,7 +3991,7 @@ function sessionDisplayTitle(session) {
|
|
|
4143
3991
|
function FleetTile({ session, title, subtitle, onOpen, className }) {
|
|
4144
3992
|
const running = session.status === "running" || session.status === "queued";
|
|
4145
3993
|
const needsYou = session.status === "requires_action";
|
|
4146
|
-
return /* @__PURE__ */
|
|
3994
|
+
return /* @__PURE__ */ jsxs2(
|
|
4147
3995
|
"button",
|
|
4148
3996
|
{
|
|
4149
3997
|
type: "button",
|
|
@@ -4159,7 +4007,7 @@ function FleetTile({ session, title, subtitle, onOpen, className }) {
|
|
|
4159
4007
|
className
|
|
4160
4008
|
),
|
|
4161
4009
|
children: [
|
|
4162
|
-
/* @__PURE__ */
|
|
4010
|
+
/* @__PURE__ */ jsx2(
|
|
4163
4011
|
"span",
|
|
4164
4012
|
{
|
|
4165
4013
|
"aria-hidden": true,
|
|
@@ -4169,16 +4017,16 @@ function FleetTile({ session, title, subtitle, onOpen, className }) {
|
|
|
4169
4017
|
)
|
|
4170
4018
|
}
|
|
4171
4019
|
),
|
|
4172
|
-
/* @__PURE__ */
|
|
4173
|
-
/* @__PURE__ */
|
|
4174
|
-
/* @__PURE__ */
|
|
4020
|
+
/* @__PURE__ */ jsxs2("span", { className: "flex w-full items-start justify-between gap-3", children: [
|
|
4021
|
+
/* @__PURE__ */ jsx2("span", { className: "line-clamp-2 min-w-0 text-og-base font-medium leading-snug text-og-fg", children: title ?? sessionDisplayTitle(session) }),
|
|
4022
|
+
/* @__PURE__ */ jsx2(SessionStatus, { status: session.status, size: "sm", className: "mt-px" })
|
|
4175
4023
|
] }),
|
|
4176
|
-
subtitle ? /* @__PURE__ */
|
|
4177
|
-
/* @__PURE__ */
|
|
4178
|
-
/* @__PURE__ */
|
|
4179
|
-
/* @__PURE__ */
|
|
4180
|
-
/* @__PURE__ */
|
|
4181
|
-
/* @__PURE__ */
|
|
4024
|
+
subtitle ? /* @__PURE__ */ jsx2("span", { className: "line-clamp-1 text-og-sm text-og-fg-muted", children: subtitle }) : null,
|
|
4025
|
+
/* @__PURE__ */ jsxs2("span", { className: "mt-auto flex w-full items-center gap-2 text-og-xs text-og-fg-subtle", children: [
|
|
4026
|
+
/* @__PURE__ */ jsx2("span", { className: "font-og-mono", children: session.id.slice(0, 8) }),
|
|
4027
|
+
/* @__PURE__ */ jsx2("span", { "aria-hidden": true, children: "\xB7" }),
|
|
4028
|
+
/* @__PURE__ */ jsx2("span", { className: "truncate", children: session.model }),
|
|
4029
|
+
/* @__PURE__ */ jsx2("span", { className: "ml-auto shrink-0", title: session.updatedAt, children: formatRelativeTime(session.updatedAt) })
|
|
4182
4030
|
] })
|
|
4183
4031
|
]
|
|
4184
4032
|
}
|
|
@@ -4186,7 +4034,7 @@ function FleetTile({ session, title, subtitle, onOpen, className }) {
|
|
|
4186
4034
|
}
|
|
4187
4035
|
|
|
4188
4036
|
// src/components/sandbox-terminal.tsx
|
|
4189
|
-
import { useEffect as
|
|
4037
|
+
import { useEffect as useEffect12, useLayoutEffect, useRef as useRef11, useState as useState9 } from "react";
|
|
4190
4038
|
|
|
4191
4039
|
// src/lib/xterm-theme.ts
|
|
4192
4040
|
var DARK_ANSI = {
|
|
@@ -4339,7 +4187,7 @@ async function attachRenderer(prefer, loaders, onTier) {
|
|
|
4339
4187
|
}
|
|
4340
4188
|
|
|
4341
4189
|
// src/components/sandbox-terminal.tsx
|
|
4342
|
-
import { jsx as
|
|
4190
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
4343
4191
|
function terminalSurfaceState(input) {
|
|
4344
4192
|
if (!input.ready) return "loading";
|
|
4345
4193
|
if (input.acceptsInput) return "interactive";
|
|
@@ -4381,13 +4229,13 @@ function SandboxTerminal({
|
|
|
4381
4229
|
onReconnectNeeded,
|
|
4382
4230
|
className
|
|
4383
4231
|
}) {
|
|
4384
|
-
const containerRef =
|
|
4385
|
-
const termRef =
|
|
4386
|
-
const fitRef =
|
|
4387
|
-
const rendererRef =
|
|
4388
|
-
const writtenRef =
|
|
4389
|
-
const wroteFirehoseRef =
|
|
4390
|
-
const bootActiveRef =
|
|
4232
|
+
const containerRef = useRef11(null);
|
|
4233
|
+
const termRef = useRef11(null);
|
|
4234
|
+
const fitRef = useRef11(null);
|
|
4235
|
+
const rendererRef = useRef11(null);
|
|
4236
|
+
const writtenRef = useRef11(/* @__PURE__ */ new Set());
|
|
4237
|
+
const wroteFirehoseRef = useRef11(false);
|
|
4238
|
+
const bootActiveRef = useRef11(false);
|
|
4391
4239
|
const [ready, setReady] = useState9(false);
|
|
4392
4240
|
const [inputReady, setInputReady] = useState9(false);
|
|
4393
4241
|
const [activated, setActivated] = useState9(false);
|
|
@@ -4443,7 +4291,7 @@ function SandboxTerminal({
|
|
|
4443
4291
|
if (!activated) setActivated(true);
|
|
4444
4292
|
onActivate?.();
|
|
4445
4293
|
}
|
|
4446
|
-
|
|
4294
|
+
useEffect12(() => {
|
|
4447
4295
|
if (typeof window === "undefined") return;
|
|
4448
4296
|
const el = containerRef.current;
|
|
4449
4297
|
if (!el) return;
|
|
@@ -4557,13 +4405,13 @@ function SandboxTerminal({
|
|
|
4557
4405
|
term.options.disableStdin = !interactive;
|
|
4558
4406
|
term.options.cursorBlink = interactive;
|
|
4559
4407
|
}, [ready, interactive]);
|
|
4560
|
-
|
|
4408
|
+
useEffect12(() => {
|
|
4561
4409
|
const term = termRef.current;
|
|
4562
4410
|
if (!ready || !term) return;
|
|
4563
4411
|
const next = theme ?? xtermThemeFromTokens(containerRef.current);
|
|
4564
4412
|
if (next) term.options.theme = next;
|
|
4565
4413
|
}, [ready, theme]);
|
|
4566
|
-
|
|
4414
|
+
useEffect12(() => {
|
|
4567
4415
|
const term = termRef.current;
|
|
4568
4416
|
if (!ready || !term) return;
|
|
4569
4417
|
if (!booting) {
|
|
@@ -4584,7 +4432,7 @@ function SandboxTerminal({
|
|
|
4584
4432
|
const id = setInterval(paint, 1e3);
|
|
4585
4433
|
return () => clearInterval(id);
|
|
4586
4434
|
}, [ready, booting]);
|
|
4587
|
-
|
|
4435
|
+
useEffect12(() => {
|
|
4588
4436
|
const term = termRef.current;
|
|
4589
4437
|
if (!ready || !term || ptyMode) return;
|
|
4590
4438
|
for (const chunk of result.chunks) {
|
|
@@ -4609,14 +4457,14 @@ function SandboxTerminal({
|
|
|
4609
4457
|
setInputReady(sub !== null);
|
|
4610
4458
|
return () => sub?.dispose();
|
|
4611
4459
|
}, [ready, interactive, ptyAttachable, ptyWrite, result.write]);
|
|
4612
|
-
|
|
4460
|
+
useEffect12(() => {
|
|
4613
4461
|
const term = termRef.current;
|
|
4614
4462
|
if (!ready || !term || !ptyMode) return;
|
|
4615
4463
|
resizePty(term.cols, term.rows);
|
|
4616
4464
|
const sub = term.onResize(({ cols, rows }) => resizePty(cols, rows));
|
|
4617
4465
|
return () => sub.dispose();
|
|
4618
4466
|
}, [ready, ptyMode, ptyConnected, resizePty]);
|
|
4619
|
-
|
|
4467
|
+
useEffect12(() => {
|
|
4620
4468
|
if (typeof window === "undefined") return;
|
|
4621
4469
|
const refit = () => {
|
|
4622
4470
|
try {
|
|
@@ -4636,10 +4484,10 @@ function SandboxTerminal({
|
|
|
4636
4484
|
observer?.disconnect();
|
|
4637
4485
|
};
|
|
4638
4486
|
}, [ready]);
|
|
4639
|
-
return /* @__PURE__ */
|
|
4640
|
-
showHeader && /* @__PURE__ */
|
|
4641
|
-
/* @__PURE__ */
|
|
4642
|
-
/* @__PURE__ */
|
|
4487
|
+
return /* @__PURE__ */ jsxs3("div", { className: cn("relative flex h-full w-full flex-col overflow-hidden", className), children: [
|
|
4488
|
+
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: [
|
|
4489
|
+
/* @__PURE__ */ jsxs3("span", { className: "flex min-w-0 items-center gap-1.5", children: [
|
|
4490
|
+
/* @__PURE__ */ jsx3(
|
|
4643
4491
|
"span",
|
|
4644
4492
|
{
|
|
4645
4493
|
className: cn(
|
|
@@ -4648,13 +4496,13 @@ function SandboxTerminal({
|
|
|
4648
4496
|
)
|
|
4649
4497
|
}
|
|
4650
4498
|
),
|
|
4651
|
-
/* @__PURE__ */
|
|
4499
|
+
/* @__PURE__ */ jsxs3("span", { className: "truncate font-og-mono", children: [
|
|
4652
4500
|
"pty: ",
|
|
4653
4501
|
shell ?? "shell"
|
|
4654
4502
|
] })
|
|
4655
4503
|
] }),
|
|
4656
|
-
/* @__PURE__ */
|
|
4657
|
-
terminalModeLabel && /* @__PURE__ */
|
|
4504
|
+
/* @__PURE__ */ jsxs3("span", { className: "flex shrink-0 items-center gap-2", children: [
|
|
4505
|
+
terminalModeLabel && /* @__PURE__ */ jsx3(
|
|
4658
4506
|
"span",
|
|
4659
4507
|
{
|
|
4660
4508
|
className: "rounded-og-sm bg-og-surface-2 px-1.5 py-0.5 text-og-xs uppercase tracking-wide",
|
|
@@ -4662,7 +4510,7 @@ function SandboxTerminal({
|
|
|
4662
4510
|
children: terminalModeLabel
|
|
4663
4511
|
}
|
|
4664
4512
|
),
|
|
4665
|
-
/* @__PURE__ */
|
|
4513
|
+
/* @__PURE__ */ jsx3(
|
|
4666
4514
|
"button",
|
|
4667
4515
|
{
|
|
4668
4516
|
type: "button",
|
|
@@ -4677,15 +4525,15 @@ function SandboxTerminal({
|
|
|
4677
4525
|
)
|
|
4678
4526
|
] })
|
|
4679
4527
|
] }),
|
|
4680
|
-
/* @__PURE__ */
|
|
4528
|
+
/* @__PURE__ */ jsxs3(
|
|
4681
4529
|
"div",
|
|
4682
4530
|
{
|
|
4683
4531
|
className: "relative min-h-0 flex-1 bg-og-bg p-3",
|
|
4684
4532
|
onPointerDownCapture: handleActivate,
|
|
4685
4533
|
onFocusCapture: handleActivate,
|
|
4686
4534
|
children: [
|
|
4687
|
-
!ready && (placeholder ?? /* @__PURE__ */
|
|
4688
|
-
/* @__PURE__ */
|
|
4535
|
+
!ready && (placeholder ?? /* @__PURE__ */ jsx3(TerminalPlaceholder, {})),
|
|
4536
|
+
/* @__PURE__ */ jsx3(
|
|
4689
4537
|
"div",
|
|
4690
4538
|
{
|
|
4691
4539
|
ref: containerRef,
|
|
@@ -4745,7 +4593,7 @@ function ensureXtermBaseCss() {
|
|
|
4745
4593
|
document.head.appendChild(style);
|
|
4746
4594
|
}
|
|
4747
4595
|
function TerminalPlaceholder() {
|
|
4748
|
-
return /* @__PURE__ */
|
|
4596
|
+
return /* @__PURE__ */ jsx3("div", { className: "absolute inset-0 flex items-center justify-center text-og-sm text-og-fg-subtle", children: "Loading terminal\u2026" });
|
|
4749
4597
|
}
|
|
4750
4598
|
|
|
4751
4599
|
// src/components/file-browser.tsx
|
|
@@ -4761,24 +4609,24 @@ import {
|
|
|
4761
4609
|
Trash2Icon
|
|
4762
4610
|
} from "lucide-react";
|
|
4763
4611
|
import {
|
|
4764
|
-
useCallback as
|
|
4765
|
-
useEffect as
|
|
4612
|
+
useCallback as useCallback18,
|
|
4613
|
+
useEffect as useEffect14,
|
|
4766
4614
|
useId as useId2,
|
|
4767
4615
|
useLayoutEffect as useLayoutEffect2,
|
|
4768
|
-
useMemo as
|
|
4769
|
-
useRef as
|
|
4616
|
+
useMemo as useMemo11,
|
|
4617
|
+
useRef as useRef12,
|
|
4770
4618
|
useState as useState10
|
|
4771
4619
|
} from "react";
|
|
4772
4620
|
import { AlertDialog } from "radix-ui";
|
|
4773
4621
|
import { VList } from "virtua";
|
|
4774
4622
|
|
|
4775
4623
|
// src/lib/use-unicode-fonts.ts
|
|
4776
|
-
import { useEffect as
|
|
4624
|
+
import { useEffect as useEffect13, useMemo as useMemo10 } from "react";
|
|
4777
4625
|
var japaneseScript = /[\u3040-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff]/u;
|
|
4778
4626
|
var arabicScript = /[\u0600-\u06ff\u0750-\u077f\u0870-\u08ff\ufb50-\ufdff\ufe70-\ufefc]/u;
|
|
4779
4627
|
function useUnicodeFallbackFonts(values) {
|
|
4780
|
-
const content =
|
|
4781
|
-
|
|
4628
|
+
const content = useMemo10(() => collectUnicodeContent(values), [values]);
|
|
4629
|
+
useEffect13(() => {
|
|
4782
4630
|
if (content.japanese) {
|
|
4783
4631
|
void import("./noto-sans-jp-loader.generated-HFGLYBR3.js").then(({ loadNotoSansJp }) => loadNotoSansJp(content.japanese)).catch(() => void 0);
|
|
4784
4632
|
}
|
|
@@ -4800,7 +4648,7 @@ function collectUnicodeContent(values) {
|
|
|
4800
4648
|
}
|
|
4801
4649
|
|
|
4802
4650
|
// src/components/file-browser.tsx
|
|
4803
|
-
import { Fragment as
|
|
4651
|
+
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
4804
4652
|
var STATUS_TINT = {
|
|
4805
4653
|
added: "text-og-status-idle",
|
|
4806
4654
|
modified: "text-og-status-running",
|
|
@@ -4808,7 +4656,7 @@ var STATUS_TINT = {
|
|
|
4808
4656
|
renamed: "text-og-accent",
|
|
4809
4657
|
untracked: "text-og-fg-subtle"
|
|
4810
4658
|
};
|
|
4811
|
-
var useBrowserLayoutEffect = typeof window === "undefined" ?
|
|
4659
|
+
var useBrowserLayoutEffect = typeof window === "undefined" ? useEffect14 : useLayoutEffect2;
|
|
4812
4660
|
function parentOf2(path) {
|
|
4813
4661
|
const i = path.lastIndexOf("/");
|
|
4814
4662
|
return i <= 0 ? "" : path.slice(0, i);
|
|
@@ -4889,19 +4737,19 @@ function FileBrowser({
|
|
|
4889
4737
|
const [busy, setBusy] = useState10(false);
|
|
4890
4738
|
const [coarsePointer, setCoarsePointer] = useState10(false);
|
|
4891
4739
|
const [revealRequest, setRevealRequest] = useState10(null);
|
|
4892
|
-
const handledRevealRequestRef =
|
|
4893
|
-
const attemptedRevealPathsRef =
|
|
4740
|
+
const handledRevealRequestRef = useRef12(null);
|
|
4741
|
+
const attemptedRevealPathsRef = useRef12(/* @__PURE__ */ new Set());
|
|
4894
4742
|
const treeId = useId2();
|
|
4895
4743
|
const container = usePortalTokenSource();
|
|
4896
4744
|
const containerRef = container.currentRef;
|
|
4897
|
-
const deleteReturnFocusRef =
|
|
4898
|
-
const vlistRef =
|
|
4745
|
+
const deleteReturnFocusRef = useRef12(null);
|
|
4746
|
+
const vlistRef = useRef12(null);
|
|
4899
4747
|
const portalTokenStyle = usePortalTokenStyle(container.source);
|
|
4900
|
-
const getTreeElement =
|
|
4748
|
+
const getTreeElement = useCallback18(
|
|
4901
4749
|
() => typeof document === "undefined" ? null : document.getElementById(treeId),
|
|
4902
4750
|
[treeId]
|
|
4903
4751
|
);
|
|
4904
|
-
const visibleTree =
|
|
4752
|
+
const visibleTree = useMemo11(
|
|
4905
4753
|
() => visibleFileTree(result.tree, isNodeVisible),
|
|
4906
4754
|
[isNodeVisible, result.tree]
|
|
4907
4755
|
);
|
|
@@ -4920,7 +4768,7 @@ function FileBrowser({
|
|
|
4920
4768
|
}
|
|
4921
4769
|
}, []);
|
|
4922
4770
|
const effectiveRevealRequestId = revealPath ? revealPathRequestId ?? revealPath : null;
|
|
4923
|
-
|
|
4771
|
+
useEffect14(() => {
|
|
4924
4772
|
if (!revealPath || effectiveRevealRequestId === null) {
|
|
4925
4773
|
setRevealRequest(null);
|
|
4926
4774
|
return;
|
|
@@ -4937,10 +4785,10 @@ function FileBrowser({
|
|
|
4937
4785
|
}, [effectiveRevealRequestId, revealPath]);
|
|
4938
4786
|
const visibleActive = active && findNode(visibleTree, active) ? active : null;
|
|
4939
4787
|
const cursor = visibleActive ?? (selectedPath && findNode(visibleTree, selectedPath) ? selectedPath : null);
|
|
4940
|
-
|
|
4788
|
+
useEffect14(() => {
|
|
4941
4789
|
if (active !== null && visibleActive === null) setActive(null);
|
|
4942
4790
|
}, [active, visibleActive]);
|
|
4943
|
-
const expand =
|
|
4791
|
+
const expand = useCallback18(
|
|
4944
4792
|
async (path) => {
|
|
4945
4793
|
const node = findNode(visibleTree, path);
|
|
4946
4794
|
if (node && node.kind === "dir" && node.children === void 0) {
|
|
@@ -4958,14 +4806,14 @@ function FileBrowser({
|
|
|
4958
4806
|
},
|
|
4959
4807
|
[result, visibleTree]
|
|
4960
4808
|
);
|
|
4961
|
-
const open =
|
|
4809
|
+
const open = useCallback18(
|
|
4962
4810
|
(path) => {
|
|
4963
4811
|
setExpanded((prev) => new Set(prev).add(path));
|
|
4964
4812
|
void expand(path);
|
|
4965
4813
|
},
|
|
4966
4814
|
[expand]
|
|
4967
4815
|
);
|
|
4968
|
-
|
|
4816
|
+
useEffect14(() => {
|
|
4969
4817
|
if (!revealRequest) return;
|
|
4970
4818
|
const trace = traceRevealPath(visibleTree, revealRequest.path);
|
|
4971
4819
|
if (trace.directories.length > 0) {
|
|
@@ -4987,7 +4835,7 @@ function FileBrowser({
|
|
|
4987
4835
|
attemptedRevealPathsRef.current.add(frontier);
|
|
4988
4836
|
void expand(frontier);
|
|
4989
4837
|
}, [expand, loadingPaths, result.expandingPaths, revealRequest, visibleTree]);
|
|
4990
|
-
const toggle =
|
|
4838
|
+
const toggle = useCallback18(
|
|
4991
4839
|
async (node) => {
|
|
4992
4840
|
if (node.kind !== "dir") return;
|
|
4993
4841
|
const isOpen = expanded.has(node.path);
|
|
@@ -5002,7 +4850,7 @@ function FileBrowser({
|
|
|
5002
4850
|
[expanded, expand]
|
|
5003
4851
|
);
|
|
5004
4852
|
const cold = result.source !== "live";
|
|
5005
|
-
const renderItems =
|
|
4853
|
+
const renderItems = useMemo11(() => {
|
|
5006
4854
|
const items = [];
|
|
5007
4855
|
if (draftCreate && draftCreate.parent === "") {
|
|
5008
4856
|
items.push({ type: "create", parent: "", kind: draftCreate.kind, depth: 0 });
|
|
@@ -5033,22 +4881,22 @@ function FileBrowser({
|
|
|
5033
4881
|
walk(visibleTree, 0);
|
|
5034
4882
|
return items;
|
|
5035
4883
|
}, [visibleTree, expanded, draftCreate, loadingPaths, result.expandingPaths, cold]);
|
|
5036
|
-
const unicodeFontPaths =
|
|
4884
|
+
const unicodeFontPaths = useMemo11(
|
|
5037
4885
|
() => renderItems.flatMap((item) => item.type === "node" ? [item.node.path] : []),
|
|
5038
4886
|
[renderItems]
|
|
5039
4887
|
);
|
|
5040
4888
|
useUnicodeFallbackFonts(unicodeFontPaths);
|
|
5041
|
-
const flatRows =
|
|
4889
|
+
const flatRows = useMemo11(
|
|
5042
4890
|
() => renderItems.flatMap(
|
|
5043
4891
|
(item) => item.type === "node" ? [{ node: item.node, depth: item.depth }] : []
|
|
5044
4892
|
),
|
|
5045
4893
|
[renderItems]
|
|
5046
4894
|
);
|
|
5047
|
-
const rowIndexByPath =
|
|
4895
|
+
const rowIndexByPath = useMemo11(
|
|
5048
4896
|
() => new Map(flatRows.map((row, index) => [row.node.path, index])),
|
|
5049
4897
|
[flatRows]
|
|
5050
4898
|
);
|
|
5051
|
-
const treePositionByPath =
|
|
4899
|
+
const treePositionByPath = useMemo11(() => {
|
|
5052
4900
|
const positions = /* @__PURE__ */ new Map();
|
|
5053
4901
|
const visit = (nodes) => {
|
|
5054
4902
|
nodes.forEach((node, index) => {
|
|
@@ -5062,7 +4910,7 @@ function FileBrowser({
|
|
|
5062
4910
|
const cursorIndex = cursor ? rowIndexByPath.get(cursor) ?? -1 : -1;
|
|
5063
4911
|
const activeDescendantId = cursorIndex >= 0 ? `${treeId}-item-${cursorIndex}` : void 0;
|
|
5064
4912
|
const supportsMutation = editable && result.source === "live" && result.error === null && !result.loading;
|
|
5065
|
-
const performDelete =
|
|
4913
|
+
const performDelete = useCallback18(
|
|
5066
4914
|
async (node) => {
|
|
5067
4915
|
if (!supportsMutation) return;
|
|
5068
4916
|
const recursive = node.kind === "dir";
|
|
@@ -5076,7 +4924,7 @@ function FileBrowser({
|
|
|
5076
4924
|
},
|
|
5077
4925
|
[supportsMutation, result]
|
|
5078
4926
|
);
|
|
5079
|
-
const runDelete =
|
|
4927
|
+
const runDelete = useCallback18(
|
|
5080
4928
|
async (node, returnFocus) => {
|
|
5081
4929
|
if (!supportsMutation) return;
|
|
5082
4930
|
setMenu(null);
|
|
@@ -5089,7 +4937,7 @@ function FileBrowser({
|
|
|
5089
4937
|
},
|
|
5090
4938
|
[supportsMutation, confirmDelete, performDelete]
|
|
5091
4939
|
);
|
|
5092
|
-
const closePendingDelete =
|
|
4940
|
+
const closePendingDelete = useCallback18(
|
|
5093
4941
|
(restoreTrigger) => {
|
|
5094
4942
|
const returnTarget = restoreTrigger ? deleteReturnFocusRef.current : getTreeElement();
|
|
5095
4943
|
deleteReturnFocusRef.current = null;
|
|
@@ -5103,7 +4951,7 @@ function FileBrowser({
|
|
|
5103
4951
|
},
|
|
5104
4952
|
[getTreeElement]
|
|
5105
4953
|
);
|
|
5106
|
-
const commitCreate =
|
|
4954
|
+
const commitCreate = useCallback18(
|
|
5107
4955
|
async (name) => {
|
|
5108
4956
|
const draft = draftCreate;
|
|
5109
4957
|
setDraftCreate(null);
|
|
@@ -5128,7 +4976,7 @@ function FileBrowser({
|
|
|
5128
4976
|
},
|
|
5129
4977
|
[draftCreate, supportsMutation, result, open, onSelectFile]
|
|
5130
4978
|
);
|
|
5131
|
-
const commitRename =
|
|
4979
|
+
const commitRename = useCallback18(
|
|
5132
4980
|
async (name) => {
|
|
5133
4981
|
const draft = draftRename;
|
|
5134
4982
|
setDraftRename(null);
|
|
@@ -5151,7 +4999,7 @@ function FileBrowser({
|
|
|
5151
4999
|
},
|
|
5152
5000
|
[draftRename, supportsMutation, result, selectedPath, active, onSelectFile, visibleTree]
|
|
5153
5001
|
);
|
|
5154
|
-
const startCreate =
|
|
5002
|
+
const startCreate = useCallback18(
|
|
5155
5003
|
(kind) => {
|
|
5156
5004
|
if (!supportsMutation) return;
|
|
5157
5005
|
const anchor = cursor ? findNode(visibleTree, cursor) : void 0;
|
|
@@ -5163,7 +5011,7 @@ function FileBrowser({
|
|
|
5163
5011
|
},
|
|
5164
5012
|
[supportsMutation, cursor, open, visibleTree]
|
|
5165
5013
|
);
|
|
5166
|
-
const startRename =
|
|
5014
|
+
const startRename = useCallback18(
|
|
5167
5015
|
(node) => {
|
|
5168
5016
|
if (!supportsMutation) return;
|
|
5169
5017
|
setDraftCreate(null);
|
|
@@ -5172,7 +5020,7 @@ function FileBrowser({
|
|
|
5172
5020
|
},
|
|
5173
5021
|
[supportsMutation]
|
|
5174
5022
|
);
|
|
5175
|
-
const onDropOnto =
|
|
5023
|
+
const onDropOnto = useCallback18(
|
|
5176
5024
|
async (targetDir, sourcePath) => {
|
|
5177
5025
|
setDragOver(null);
|
|
5178
5026
|
if (!supportsMutation || !sourcePath) return;
|
|
@@ -5196,7 +5044,7 @@ function FileBrowser({
|
|
|
5196
5044
|
},
|
|
5197
5045
|
[supportsMutation, result, selectedPath, active, onSelectFile, visibleTree]
|
|
5198
5046
|
);
|
|
5199
|
-
const onKeyDown =
|
|
5047
|
+
const onKeyDown = useCallback18(
|
|
5200
5048
|
(e) => {
|
|
5201
5049
|
if (draftCreate || draftRename) return;
|
|
5202
5050
|
if (flatRows.length === 0) return;
|
|
@@ -5315,7 +5163,7 @@ function FileBrowser({
|
|
|
5315
5163
|
treeId
|
|
5316
5164
|
]
|
|
5317
5165
|
);
|
|
5318
|
-
|
|
5166
|
+
useEffect14(() => {
|
|
5319
5167
|
if (!menu) return;
|
|
5320
5168
|
const close = () => setMenu(null);
|
|
5321
5169
|
window.addEventListener("click", close);
|
|
@@ -5335,7 +5183,7 @@ function FileBrowser({
|
|
|
5335
5183
|
const renderNodeRow = (node, depth) => {
|
|
5336
5184
|
const isOpen = expanded.has(node.path);
|
|
5337
5185
|
if (renderNode) {
|
|
5338
|
-
return /* @__PURE__ */
|
|
5186
|
+
return /* @__PURE__ */ jsx4("div", { children: renderNode(node, depth, isOpen) });
|
|
5339
5187
|
}
|
|
5340
5188
|
const isDir = node.kind === "dir";
|
|
5341
5189
|
const isSelected = node.path === selectedPath || node.path === active;
|
|
@@ -5345,7 +5193,7 @@ function FileBrowser({
|
|
|
5345
5193
|
const isDropTarget = dragOver === (isDir ? node.path : parentOf2(node.path));
|
|
5346
5194
|
const dropDir = isDir ? node.path : parentOf2(node.path);
|
|
5347
5195
|
const treePosition = treePositionByPath.get(node.path);
|
|
5348
|
-
return /* @__PURE__ */
|
|
5196
|
+
return /* @__PURE__ */ jsx4(
|
|
5349
5197
|
"div",
|
|
5350
5198
|
{
|
|
5351
5199
|
id: `${treeId}-item-${rowIndexByPath.get(node.path) ?? 0}`,
|
|
@@ -5371,7 +5219,7 @@ function FileBrowser({
|
|
|
5371
5219
|
const src = e.dataTransfer.getData("text/og-path");
|
|
5372
5220
|
void onDropOnto(dropDir, src);
|
|
5373
5221
|
} : void 0,
|
|
5374
|
-
children: isRenaming ? /* @__PURE__ */
|
|
5222
|
+
children: isRenaming ? /* @__PURE__ */ jsx4(
|
|
5375
5223
|
InlineInput,
|
|
5376
5224
|
{
|
|
5377
5225
|
depth,
|
|
@@ -5380,7 +5228,7 @@ function FileBrowser({
|
|
|
5380
5228
|
onCommit: (name) => void commitRename(name),
|
|
5381
5229
|
onCancel: () => setDraftRename(null)
|
|
5382
5230
|
}
|
|
5383
|
-
) : /* @__PURE__ */
|
|
5231
|
+
) : /* @__PURE__ */ jsxs4(
|
|
5384
5232
|
"button",
|
|
5385
5233
|
{
|
|
5386
5234
|
type: "button",
|
|
@@ -5414,7 +5262,7 @@ function FileBrowser({
|
|
|
5414
5262
|
),
|
|
5415
5263
|
style: { paddingLeft: `${depth * 12 + 4}px` },
|
|
5416
5264
|
children: [
|
|
5417
|
-
isDir ? /* @__PURE__ */
|
|
5265
|
+
isDir ? /* @__PURE__ */ jsx4(
|
|
5418
5266
|
ChevronRightIcon,
|
|
5419
5267
|
{
|
|
5420
5268
|
className: cn(
|
|
@@ -5423,10 +5271,10 @@ function FileBrowser({
|
|
|
5423
5271
|
isLoading && "text-og-accent"
|
|
5424
5272
|
)
|
|
5425
5273
|
}
|
|
5426
|
-
) : /* @__PURE__ */
|
|
5427
|
-
isDir ? /* @__PURE__ */
|
|
5428
|
-
/* @__PURE__ */
|
|
5429
|
-
supportsMutation && /* @__PURE__ */
|
|
5274
|
+
) : /* @__PURE__ */ jsx4("span", { className: "inline-block w-3 shrink-0" }),
|
|
5275
|
+
isDir ? /* @__PURE__ */ jsx4(FolderIcon, { className: "size-3.5 shrink-0" }) : /* @__PURE__ */ jsx4(FileIcon, { className: "size-3.5 shrink-0" }),
|
|
5276
|
+
/* @__PURE__ */ jsx4("span", { className: "truncate", children: node.name }),
|
|
5277
|
+
supportsMutation && /* @__PURE__ */ jsx4(
|
|
5430
5278
|
"span",
|
|
5431
5279
|
{
|
|
5432
5280
|
role: "button",
|
|
@@ -5454,7 +5302,7 @@ function FileBrowser({
|
|
|
5454
5302
|
case "node":
|
|
5455
5303
|
return renderNodeRow(item.node, item.depth);
|
|
5456
5304
|
case "create":
|
|
5457
|
-
return /* @__PURE__ */
|
|
5305
|
+
return /* @__PURE__ */ jsx4(
|
|
5458
5306
|
InlineInput,
|
|
5459
5307
|
{
|
|
5460
5308
|
depth: item.depth,
|
|
@@ -5465,14 +5313,14 @@ function FileBrowser({
|
|
|
5465
5313
|
}
|
|
5466
5314
|
);
|
|
5467
5315
|
case "skeleton":
|
|
5468
|
-
return /* @__PURE__ */
|
|
5316
|
+
return /* @__PURE__ */ jsx4(
|
|
5469
5317
|
"div",
|
|
5470
5318
|
{
|
|
5471
5319
|
role: "group",
|
|
5472
5320
|
"aria-hidden": true,
|
|
5473
5321
|
style: { paddingLeft: `${item.depth * 12 + 4}px` },
|
|
5474
5322
|
className: "space-y-1 py-1",
|
|
5475
|
-
children: [0, 1, 2].map((i) => /* @__PURE__ */
|
|
5323
|
+
children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx4(
|
|
5476
5324
|
"div",
|
|
5477
5325
|
{
|
|
5478
5326
|
className: "h-2.5 animate-pulse rounded-og-sm bg-og-surface-2",
|
|
@@ -5483,25 +5331,25 @@ function FileBrowser({
|
|
|
5483
5331
|
}
|
|
5484
5332
|
);
|
|
5485
5333
|
case "residue":
|
|
5486
|
-
return /* @__PURE__ */
|
|
5334
|
+
return /* @__PURE__ */ jsxs4(
|
|
5487
5335
|
"div",
|
|
5488
5336
|
{
|
|
5489
5337
|
style: { paddingLeft: `${item.depth * 12 + 4}px` },
|
|
5490
5338
|
className: "flex items-center gap-1.5 py-0.5 pr-1 text-og-xs italic text-og-fg-subtle",
|
|
5491
5339
|
children: [
|
|
5492
|
-
/* @__PURE__ */
|
|
5493
|
-
/* @__PURE__ */
|
|
5340
|
+
/* @__PURE__ */ jsx4("span", { className: "inline-block w-3 shrink-0" }),
|
|
5341
|
+
/* @__PURE__ */ jsx4("span", { className: "min-w-0 truncate", children: "contents on machine \u2014 open when live" })
|
|
5494
5342
|
]
|
|
5495
5343
|
}
|
|
5496
5344
|
);
|
|
5497
5345
|
}
|
|
5498
5346
|
};
|
|
5499
|
-
|
|
5347
|
+
useEffect14(() => {
|
|
5500
5348
|
if (!cursor) return;
|
|
5501
5349
|
const index = renderItems.findIndex((it) => it.type === "node" && it.node.path === cursor);
|
|
5502
5350
|
if (index >= 0) vlistRef.current?.scrollToIndex(index);
|
|
5503
5351
|
}, [cursor, renderItems]);
|
|
5504
|
-
|
|
5352
|
+
useEffect14(() => {
|
|
5505
5353
|
if (!revealRequest) return;
|
|
5506
5354
|
const index = renderItems.findIndex(
|
|
5507
5355
|
(item) => item.type === "node" && item.node.path === revealRequest.path
|
|
@@ -5516,18 +5364,18 @@ function FileBrowser({
|
|
|
5516
5364
|
(current) => current?.path === revealRequest.path && current.requestId === revealRequest.requestId ? null : current
|
|
5517
5365
|
);
|
|
5518
5366
|
}, [renderItems, revealRequest, treeId, usesVirtualTree]);
|
|
5519
|
-
return /* @__PURE__ */
|
|
5520
|
-
showToolbar && /* @__PURE__ */
|
|
5367
|
+
return /* @__PURE__ */ jsxs4("div", { className: cn("flex min-h-0 min-w-0 flex-col", className), children: [
|
|
5368
|
+
showToolbar && /* @__PURE__ */ jsxs4(
|
|
5521
5369
|
"div",
|
|
5522
5370
|
{
|
|
5523
5371
|
role: "toolbar",
|
|
5524
5372
|
"aria-label": "File actions",
|
|
5525
5373
|
className: "flex shrink-0 flex-wrap items-center gap-0.5 border-b border-og-border px-1 py-1",
|
|
5526
5374
|
children: [
|
|
5527
|
-
supportsMutation ? /* @__PURE__ */
|
|
5528
|
-
/* @__PURE__ */
|
|
5529
|
-
/* @__PURE__ */
|
|
5530
|
-
/* @__PURE__ */
|
|
5375
|
+
supportsMutation ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
5376
|
+
/* @__PURE__ */ jsx4(ToolbarButton, { label: "New file", onClick: () => startCreate("file"), disabled: busy, children: /* @__PURE__ */ jsx4(FilePlusIcon, { className: "size-3.5" }) }),
|
|
5377
|
+
/* @__PURE__ */ jsx4(ToolbarButton, { label: "New folder", onClick: () => startCreate("dir"), disabled: busy, children: /* @__PURE__ */ jsx4(FolderPlusIcon, { className: "size-3.5" }) }),
|
|
5378
|
+
/* @__PURE__ */ jsx4(
|
|
5531
5379
|
ToolbarButton,
|
|
5532
5380
|
{
|
|
5533
5381
|
label: "Rename",
|
|
@@ -5536,10 +5384,10 @@ function FileBrowser({
|
|
|
5536
5384
|
if (node) startRename(node);
|
|
5537
5385
|
},
|
|
5538
5386
|
disabled: busy || !cursor,
|
|
5539
|
-
children: /* @__PURE__ */
|
|
5387
|
+
children: /* @__PURE__ */ jsx4(PencilIcon, { className: "size-3.5" })
|
|
5540
5388
|
}
|
|
5541
5389
|
),
|
|
5542
|
-
/* @__PURE__ */
|
|
5390
|
+
/* @__PURE__ */ jsx4(
|
|
5543
5391
|
ToolbarButton,
|
|
5544
5392
|
{
|
|
5545
5393
|
label: "Delete",
|
|
@@ -5548,24 +5396,24 @@ function FileBrowser({
|
|
|
5548
5396
|
if (node) void runDelete(node, event.currentTarget);
|
|
5549
5397
|
},
|
|
5550
5398
|
disabled: busy || !cursor,
|
|
5551
|
-
children: /* @__PURE__ */
|
|
5399
|
+
children: /* @__PURE__ */ jsx4(Trash2Icon, { className: "size-3.5" })
|
|
5552
5400
|
}
|
|
5553
5401
|
)
|
|
5554
5402
|
] }) : null,
|
|
5555
|
-
/* @__PURE__ */
|
|
5556
|
-
/* @__PURE__ */
|
|
5403
|
+
/* @__PURE__ */ jsx4("span", { className: "ml-auto" }),
|
|
5404
|
+
/* @__PURE__ */ jsx4(
|
|
5557
5405
|
ToolbarButton,
|
|
5558
5406
|
{
|
|
5559
5407
|
label: "Refresh",
|
|
5560
5408
|
onClick: () => void result.refresh(),
|
|
5561
5409
|
disabled: busy || result.loading,
|
|
5562
|
-
children: /* @__PURE__ */
|
|
5410
|
+
children: /* @__PURE__ */ jsx4(RefreshCwIcon, { className: cn("size-3.5", result.loading && "animate-spin") })
|
|
5563
5411
|
}
|
|
5564
5412
|
)
|
|
5565
5413
|
]
|
|
5566
5414
|
}
|
|
5567
5415
|
),
|
|
5568
|
-
showDegradedTree ? /* @__PURE__ */
|
|
5416
|
+
showDegradedTree ? /* @__PURE__ */ jsxs4(
|
|
5569
5417
|
"div",
|
|
5570
5418
|
{
|
|
5571
5419
|
role: "status",
|
|
@@ -5573,9 +5421,9 @@ function FileBrowser({
|
|
|
5573
5421
|
"data-opengeni-files-degraded": true,
|
|
5574
5422
|
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",
|
|
5575
5423
|
children: [
|
|
5576
|
-
/* @__PURE__ */
|
|
5577
|
-
/* @__PURE__ */
|
|
5578
|
-
/* @__PURE__ */
|
|
5424
|
+
/* @__PURE__ */ jsx4(TriangleAlertIcon, { className: "size-3.5 shrink-0 text-og-status-running", "aria-hidden": true }),
|
|
5425
|
+
/* @__PURE__ */ jsx4("span", { className: "min-w-0 flex-1", children: result.source === "capture" ? "Live files are temporarily unavailable. Showing the latest captured revision." : "Live refresh failed. Showing the last loaded files." }),
|
|
5426
|
+
/* @__PURE__ */ jsxs4(
|
|
5579
5427
|
"button",
|
|
5580
5428
|
{
|
|
5581
5429
|
type: "button",
|
|
@@ -5583,7 +5431,7 @@ function FileBrowser({
|
|
|
5583
5431
|
disabled: result.loading,
|
|
5584
5432
|
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",
|
|
5585
5433
|
children: [
|
|
5586
|
-
/* @__PURE__ */
|
|
5434
|
+
/* @__PURE__ */ jsx4(
|
|
5587
5435
|
RefreshCwIcon,
|
|
5588
5436
|
{
|
|
5589
5437
|
className: cn("size-3", result.loading && "animate-spin motion-reduce:animate-none"),
|
|
@@ -5597,7 +5445,7 @@ function FileBrowser({
|
|
|
5597
5445
|
]
|
|
5598
5446
|
}
|
|
5599
5447
|
) : null,
|
|
5600
|
-
/* @__PURE__ */
|
|
5448
|
+
/* @__PURE__ */ jsx4(
|
|
5601
5449
|
"div",
|
|
5602
5450
|
{
|
|
5603
5451
|
ref: container.ref,
|
|
@@ -5623,9 +5471,9 @@ function FileBrowser({
|
|
|
5623
5471
|
dragOver === "" && "ring-1 ring-inset ring-og-accent"
|
|
5624
5472
|
),
|
|
5625
5473
|
"data-opengeni-file-tree": true,
|
|
5626
|
-
children: showErrorEmpty ? /* @__PURE__ */
|
|
5627
|
-
/* @__PURE__ */
|
|
5628
|
-
/* @__PURE__ */
|
|
5474
|
+
children: showErrorEmpty ? /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-start gap-2 p-2 text-og-sm text-og-fg-subtle", children: [
|
|
5475
|
+
/* @__PURE__ */ jsx4("div", { children: fallback ?? `Could not load files: ${result.error?.message ?? "refresh the file list to try again"}` }),
|
|
5476
|
+
/* @__PURE__ */ jsxs4(
|
|
5629
5477
|
"button",
|
|
5630
5478
|
{
|
|
5631
5479
|
type: "button",
|
|
@@ -5633,7 +5481,7 @@ function FileBrowser({
|
|
|
5633
5481
|
disabled: result.loading,
|
|
5634
5482
|
className: "inline-flex 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:text-og-fg disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:min-h-11",
|
|
5635
5483
|
children: [
|
|
5636
|
-
/* @__PURE__ */
|
|
5484
|
+
/* @__PURE__ */ jsx4(
|
|
5637
5485
|
RefreshCwIcon,
|
|
5638
5486
|
{
|
|
5639
5487
|
className: cn("size-3.5", result.loading && "animate-spin"),
|
|
@@ -5644,7 +5492,7 @@ function FileBrowser({
|
|
|
5644
5492
|
]
|
|
5645
5493
|
}
|
|
5646
5494
|
)
|
|
5647
|
-
] }) : showEmpty ? /* @__PURE__ */
|
|
5495
|
+
] }) : showEmpty ? /* @__PURE__ */ jsx4("div", { className: "p-2 text-og-sm text-og-fg-subtle", children: emptyState ?? "This directory is empty" }) : !usesVirtualTree ? /* @__PURE__ */ jsx4(
|
|
5648
5496
|
"div",
|
|
5649
5497
|
{
|
|
5650
5498
|
id: treeId,
|
|
@@ -5654,13 +5502,13 @@ function FileBrowser({
|
|
|
5654
5502
|
"aria-multiselectable": false,
|
|
5655
5503
|
tabIndex: 0,
|
|
5656
5504
|
className: "min-h-0 min-w-0 flex-1 overflow-auto outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-og-accent",
|
|
5657
|
-
children: renderItems.map((item) => /* @__PURE__ */
|
|
5505
|
+
children: renderItems.map((item) => /* @__PURE__ */ jsx4("div", { className: "min-w-0", children: renderItem(item) }, itemKey(item)))
|
|
5658
5506
|
}
|
|
5659
5507
|
) : (
|
|
5660
5508
|
// Virtualized: only the rows in/near the viewport mount, so a 3k-node
|
|
5661
5509
|
// tree stays responsive. The flat item list already carries the
|
|
5662
5510
|
// expanded subtree + synthetic (create/skeleton/residue) rows.
|
|
5663
|
-
/* @__PURE__ */
|
|
5511
|
+
/* @__PURE__ */ jsx4(
|
|
5664
5512
|
VList,
|
|
5665
5513
|
{
|
|
5666
5514
|
ref: vlistRef,
|
|
@@ -5673,13 +5521,13 @@ function FileBrowser({
|
|
|
5673
5521
|
className: "min-h-0 flex-1 outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-og-accent",
|
|
5674
5522
|
itemSize: coarsePointer ? 44 : 28,
|
|
5675
5523
|
ssrCount: Math.min(32, renderItems.length),
|
|
5676
|
-
children: renderItems.map((item) => /* @__PURE__ */
|
|
5524
|
+
children: renderItems.map((item) => /* @__PURE__ */ jsx4("div", { className: "min-w-0", children: renderItem(item) }, itemKey(item)))
|
|
5677
5525
|
}
|
|
5678
5526
|
)
|
|
5679
5527
|
)
|
|
5680
5528
|
}
|
|
5681
5529
|
),
|
|
5682
|
-
menu && menu.node && /* @__PURE__ */
|
|
5530
|
+
menu && menu.node && /* @__PURE__ */ jsx4(
|
|
5683
5531
|
ContextMenu,
|
|
5684
5532
|
{
|
|
5685
5533
|
node: menu.node,
|
|
@@ -5695,7 +5543,7 @@ function FileBrowser({
|
|
|
5695
5543
|
}
|
|
5696
5544
|
}
|
|
5697
5545
|
),
|
|
5698
|
-
pendingDelete ? /* @__PURE__ */
|
|
5546
|
+
pendingDelete ? /* @__PURE__ */ jsx4(
|
|
5699
5547
|
DeleteDialog,
|
|
5700
5548
|
{
|
|
5701
5549
|
node: pendingDelete,
|
|
@@ -5718,11 +5566,11 @@ function DeleteDialog({
|
|
|
5718
5566
|
onCancel,
|
|
5719
5567
|
onConfirm
|
|
5720
5568
|
}) {
|
|
5721
|
-
const cancelRef =
|
|
5569
|
+
const cancelRef = useRef12(null);
|
|
5722
5570
|
const [open, setOpen] = useState10(true);
|
|
5723
|
-
const closeIntentRef =
|
|
5724
|
-
const settledRef =
|
|
5725
|
-
const settleTimerRef =
|
|
5571
|
+
const closeIntentRef = useRef12("cancel");
|
|
5572
|
+
const settledRef = useRef12(false);
|
|
5573
|
+
const settleTimerRef = useRef12(null);
|
|
5726
5574
|
const settle = () => {
|
|
5727
5575
|
if (settledRef.current) return;
|
|
5728
5576
|
settledRef.current = true;
|
|
@@ -5739,13 +5587,13 @@ function DeleteDialog({
|
|
|
5739
5587
|
settle();
|
|
5740
5588
|
}, 0);
|
|
5741
5589
|
};
|
|
5742
|
-
|
|
5590
|
+
useEffect14(
|
|
5743
5591
|
() => () => {
|
|
5744
5592
|
if (settleTimerRef.current !== null) clearTimeout(settleTimerRef.current);
|
|
5745
5593
|
},
|
|
5746
5594
|
[]
|
|
5747
5595
|
);
|
|
5748
|
-
return /* @__PURE__ */
|
|
5596
|
+
return /* @__PURE__ */ jsx4(
|
|
5749
5597
|
AlertDialog.Root,
|
|
5750
5598
|
{
|
|
5751
5599
|
open,
|
|
@@ -5755,9 +5603,9 @@ function DeleteDialog({
|
|
|
5755
5603
|
scheduleSettle();
|
|
5756
5604
|
}
|
|
5757
5605
|
},
|
|
5758
|
-
children: /* @__PURE__ */
|
|
5759
|
-
/* @__PURE__ */
|
|
5760
|
-
/* @__PURE__ */
|
|
5606
|
+
children: /* @__PURE__ */ jsxs4(AlertDialog.Portal, { container: typeof document === "undefined" ? null : document.body, children: [
|
|
5607
|
+
/* @__PURE__ */ jsx4(AlertDialog.Overlay, { className: "og-root fixed inset-0 z-[100] bg-black/45 backdrop-blur-[2px]" }),
|
|
5608
|
+
/* @__PURE__ */ jsxs4(
|
|
5761
5609
|
AlertDialog.Content,
|
|
5762
5610
|
{
|
|
5763
5611
|
className: "og-root fixed left-1/2 top-1/2 z-[101] max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] max-w-sm -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-og-lg border border-og-border-strong bg-og-surface-1 p-4 text-og-fg shadow-2xl outline-hidden",
|
|
@@ -5779,22 +5627,22 @@ function DeleteDialog({
|
|
|
5779
5627
|
}
|
|
5780
5628
|
},
|
|
5781
5629
|
children: [
|
|
5782
|
-
/* @__PURE__ */
|
|
5783
|
-
/* @__PURE__ */
|
|
5784
|
-
/* @__PURE__ */
|
|
5785
|
-
/* @__PURE__ */
|
|
5630
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-start gap-3", children: [
|
|
5631
|
+
/* @__PURE__ */ jsx4("span", { className: "flex size-9 shrink-0 items-center justify-center rounded-full bg-og-status-failed/12 text-og-status-failed", children: /* @__PURE__ */ jsx4(Trash2Icon, { className: "size-4", "aria-hidden": true }) }),
|
|
5632
|
+
/* @__PURE__ */ jsxs4("div", { className: "min-w-0", children: [
|
|
5633
|
+
/* @__PURE__ */ jsxs4(AlertDialog.Title, { className: "text-og-sm font-semibold", children: [
|
|
5786
5634
|
"Delete ",
|
|
5787
5635
|
node.kind === "dir" ? "folder" : "file",
|
|
5788
5636
|
"?"
|
|
5789
5637
|
] }),
|
|
5790
|
-
/* @__PURE__ */
|
|
5791
|
-
/* @__PURE__ */
|
|
5638
|
+
/* @__PURE__ */ jsxs4(AlertDialog.Description, { className: "mt-1 text-og-sm leading-relaxed text-og-fg-muted", children: [
|
|
5639
|
+
/* @__PURE__ */ jsx4("span", { className: "break-all font-og-mono text-og-fg", children: node.path }),
|
|
5792
5640
|
node.kind === "dir" ? " and everything inside it will be permanently removed." : " will be permanently removed."
|
|
5793
5641
|
] })
|
|
5794
5642
|
] })
|
|
5795
5643
|
] }),
|
|
5796
|
-
/* @__PURE__ */
|
|
5797
|
-
/* @__PURE__ */
|
|
5644
|
+
/* @__PURE__ */ jsxs4("div", { className: "mt-4 flex justify-end gap-2", children: [
|
|
5645
|
+
/* @__PURE__ */ jsx4(AlertDialog.Cancel, { asChild: true, children: /* @__PURE__ */ jsx4(
|
|
5798
5646
|
"button",
|
|
5799
5647
|
{
|
|
5800
5648
|
ref: cancelRef,
|
|
@@ -5807,7 +5655,7 @@ function DeleteDialog({
|
|
|
5807
5655
|
children: "Cancel"
|
|
5808
5656
|
}
|
|
5809
5657
|
) }),
|
|
5810
|
-
/* @__PURE__ */
|
|
5658
|
+
/* @__PURE__ */ jsx4(AlertDialog.Action, { asChild: true, children: /* @__PURE__ */ jsx4(
|
|
5811
5659
|
"button",
|
|
5812
5660
|
{
|
|
5813
5661
|
type: "button",
|
|
@@ -5833,7 +5681,7 @@ function ToolbarButton({
|
|
|
5833
5681
|
disabled,
|
|
5834
5682
|
children
|
|
5835
5683
|
}) {
|
|
5836
|
-
return /* @__PURE__ */
|
|
5684
|
+
return /* @__PURE__ */ jsx4(
|
|
5837
5685
|
"button",
|
|
5838
5686
|
{
|
|
5839
5687
|
type: "button",
|
|
@@ -5858,9 +5706,9 @@ function InlineInput({
|
|
|
5858
5706
|
onCancel
|
|
5859
5707
|
}) {
|
|
5860
5708
|
const [value, setValue] = useState10(initialValue);
|
|
5861
|
-
const ref =
|
|
5862
|
-
const doneRef =
|
|
5863
|
-
|
|
5709
|
+
const ref = useRef12(null);
|
|
5710
|
+
const doneRef = useRef12(false);
|
|
5711
|
+
useEffect14(() => {
|
|
5864
5712
|
const el = ref.current;
|
|
5865
5713
|
if (!el) return;
|
|
5866
5714
|
el.focus();
|
|
@@ -5874,15 +5722,15 @@ function InlineInput({
|
|
|
5874
5722
|
if (commit) onCommit(value);
|
|
5875
5723
|
else onCancel();
|
|
5876
5724
|
};
|
|
5877
|
-
return /* @__PURE__ */
|
|
5725
|
+
return /* @__PURE__ */ jsxs4(
|
|
5878
5726
|
"div",
|
|
5879
5727
|
{
|
|
5880
5728
|
className: "flex items-center gap-1 px-1 py-0.5",
|
|
5881
5729
|
style: { paddingLeft: `${depth * 12 + 4}px` },
|
|
5882
5730
|
children: [
|
|
5883
|
-
/* @__PURE__ */
|
|
5884
|
-
kind === "dir" ? /* @__PURE__ */
|
|
5885
|
-
/* @__PURE__ */
|
|
5731
|
+
/* @__PURE__ */ jsx4("span", { className: "inline-block w-3 shrink-0" }),
|
|
5732
|
+
kind === "dir" ? /* @__PURE__ */ jsx4(FolderIcon, { className: "size-3.5 shrink-0" }) : /* @__PURE__ */ jsx4(FileIcon, { className: "size-3.5 shrink-0" }),
|
|
5733
|
+
/* @__PURE__ */ jsx4(
|
|
5886
5734
|
"input",
|
|
5887
5735
|
{
|
|
5888
5736
|
ref,
|
|
@@ -5924,12 +5772,12 @@ function ContextMenu({
|
|
|
5924
5772
|
onClose
|
|
5925
5773
|
}) {
|
|
5926
5774
|
const isDir = node.kind === "dir";
|
|
5927
|
-
const menuRef =
|
|
5775
|
+
const menuRef = useRef12(null);
|
|
5928
5776
|
const vw = typeof window !== "undefined" ? window.innerWidth : 9999;
|
|
5929
5777
|
const vh = typeof window !== "undefined" ? window.innerHeight : 9999;
|
|
5930
5778
|
const left = Math.max(4, Math.min(x, vw - 180));
|
|
5931
5779
|
const top = Math.max(4, Math.min(y, vh - 160));
|
|
5932
|
-
|
|
5780
|
+
useEffect14(() => {
|
|
5933
5781
|
menuRef.current?.querySelector('[role="menuitem"]')?.focus();
|
|
5934
5782
|
}, []);
|
|
5935
5783
|
const onKeyDown = (event) => {
|
|
@@ -5954,7 +5802,7 @@ function ContextMenu({
|
|
|
5954
5802
|
event.stopPropagation();
|
|
5955
5803
|
items[next]?.focus();
|
|
5956
5804
|
};
|
|
5957
|
-
const item = (label, icon, onClick, danger) => /* @__PURE__ */
|
|
5805
|
+
const item = (label, icon, onClick, danger) => /* @__PURE__ */ jsxs4(
|
|
5958
5806
|
"button",
|
|
5959
5807
|
{
|
|
5960
5808
|
type: "button",
|
|
@@ -5974,7 +5822,7 @@ function ContextMenu({
|
|
|
5974
5822
|
]
|
|
5975
5823
|
}
|
|
5976
5824
|
);
|
|
5977
|
-
return /* @__PURE__ */
|
|
5825
|
+
return /* @__PURE__ */ jsxs4(
|
|
5978
5826
|
"div",
|
|
5979
5827
|
{
|
|
5980
5828
|
ref: menuRef,
|
|
@@ -5989,13 +5837,13 @@ function ContextMenu({
|
|
|
5989
5837
|
"bg-og-surface-1"
|
|
5990
5838
|
),
|
|
5991
5839
|
children: [
|
|
5992
|
-
isDir && /* @__PURE__ */
|
|
5993
|
-
item("New file", /* @__PURE__ */
|
|
5994
|
-
item("New folder", /* @__PURE__ */
|
|
5995
|
-
/* @__PURE__ */
|
|
5840
|
+
isDir && /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
5841
|
+
item("New file", /* @__PURE__ */ jsx4(FilePlusIcon, { className: "size-3.5" }), onNewFile),
|
|
5842
|
+
item("New folder", /* @__PURE__ */ jsx4(FolderPlusIcon, { className: "size-3.5" }), onNewFolder),
|
|
5843
|
+
/* @__PURE__ */ jsx4("div", { role: "separator", className: "my-1 h-px bg-og-border" })
|
|
5996
5844
|
] }),
|
|
5997
|
-
item("Rename", /* @__PURE__ */
|
|
5998
|
-
item("Delete", /* @__PURE__ */
|
|
5845
|
+
item("Rename", /* @__PURE__ */ jsx4(PencilIcon, { className: "size-3.5" }), onRename),
|
|
5846
|
+
item("Delete", /* @__PURE__ */ jsx4(Trash2Icon, { className: "size-3.5" }), onDelete, true)
|
|
5999
5847
|
]
|
|
6000
5848
|
}
|
|
6001
5849
|
);
|
|
@@ -6005,18 +5853,18 @@ function ContextMenu({
|
|
|
6005
5853
|
import { ArrowUpRightIcon, FileWarningIcon, HistoryIcon } from "lucide-react";
|
|
6006
5854
|
import {
|
|
6007
5855
|
Component,
|
|
6008
|
-
useCallback as
|
|
6009
|
-
useEffect as
|
|
5856
|
+
useCallback as useCallback20,
|
|
5857
|
+
useEffect as useEffect16,
|
|
6010
5858
|
useId as useId3,
|
|
6011
5859
|
useLayoutEffect as useLayoutEffect3,
|
|
6012
|
-
useMemo as
|
|
6013
|
-
useRef as
|
|
5860
|
+
useMemo as useMemo13,
|
|
5861
|
+
useRef as useRef14,
|
|
6014
5862
|
useState as useState12
|
|
6015
5863
|
} from "react";
|
|
6016
5864
|
import { VList as VList2 } from "virtua";
|
|
6017
5865
|
|
|
6018
5866
|
// src/hooks/use-windowed-sections.ts
|
|
6019
|
-
import { useCallback as
|
|
5867
|
+
import { useCallback as useCallback19, useEffect as useEffect15, useMemo as useMemo12, useRef as useRef13, useState as useState11 } from "react";
|
|
6020
5868
|
function computeWindowRange(heights, scrollTop, viewport, overscan) {
|
|
6021
5869
|
const n = heights.length;
|
|
6022
5870
|
if (n === 0) return { start: 0, end: 0 };
|
|
@@ -6047,29 +5895,29 @@ function computeWindowRange(heights, scrollTop, viewport, overscan) {
|
|
|
6047
5895
|
}
|
|
6048
5896
|
function useWindowedSections(opts) {
|
|
6049
5897
|
const { count, estimateHeight, overscan = 3 } = opts;
|
|
6050
|
-
const scrollRef =
|
|
5898
|
+
const scrollRef = useRef13(null);
|
|
6051
5899
|
const [heights, setHeights] = useState11(
|
|
6052
5900
|
() => Array.from({ length: count }, (_, i) => estimateHeight(i))
|
|
6053
5901
|
);
|
|
6054
|
-
|
|
5902
|
+
useEffect15(() => {
|
|
6055
5903
|
setHeights((prev) => {
|
|
6056
5904
|
const next = Array.from({ length: count }, (_, i) => estimateHeight(i));
|
|
6057
5905
|
return prev.length === next.length && prev.every((height, index) => height === next[index]) ? prev : next;
|
|
6058
5906
|
});
|
|
6059
5907
|
}, [count, estimateHeight]);
|
|
6060
|
-
const heightsRef =
|
|
5908
|
+
const heightsRef = useRef13(heights);
|
|
6061
5909
|
heightsRef.current = heights;
|
|
6062
5910
|
const [range, setRange] = useState11(() => ({
|
|
6063
5911
|
start: 0,
|
|
6064
5912
|
end: Math.min(count, overscan + 1)
|
|
6065
5913
|
}));
|
|
6066
|
-
const recompute =
|
|
5914
|
+
const recompute = useCallback19(() => {
|
|
6067
5915
|
const el = scrollRef.current;
|
|
6068
5916
|
if (!el) return;
|
|
6069
5917
|
const next = computeWindowRange(heightsRef.current, el.scrollTop, el.clientHeight, overscan);
|
|
6070
5918
|
setRange((prev) => prev.start === next.start && prev.end === next.end ? prev : next);
|
|
6071
5919
|
}, [overscan]);
|
|
6072
|
-
|
|
5920
|
+
useEffect15(() => {
|
|
6073
5921
|
const el = scrollRef.current;
|
|
6074
5922
|
if (!el) return;
|
|
6075
5923
|
let raf = 0;
|
|
@@ -6090,7 +5938,7 @@ function useWindowedSections(opts) {
|
|
|
6090
5938
|
if (raf && typeof cancelAnimationFrame === "function") cancelAnimationFrame(raf);
|
|
6091
5939
|
};
|
|
6092
5940
|
}, [recompute, count]);
|
|
6093
|
-
const measure =
|
|
5941
|
+
const measure = useCallback19((index, height) => {
|
|
6094
5942
|
if (height <= 0) return;
|
|
6095
5943
|
setHeights((prev) => {
|
|
6096
5944
|
if (Math.abs((prev[index] ?? 0) - height) < 1) return prev;
|
|
@@ -6099,16 +5947,16 @@ function useWindowedSections(opts) {
|
|
|
6099
5947
|
return next;
|
|
6100
5948
|
});
|
|
6101
5949
|
}, []);
|
|
6102
|
-
const offsets =
|
|
5950
|
+
const offsets = useMemo12(() => {
|
|
6103
5951
|
const out = new Array(count + 1);
|
|
6104
5952
|
out[0] = 0;
|
|
6105
5953
|
for (let i = 0; i < count; i++) out[i + 1] = (out[i] ?? 0) + Math.max(heights[i] ?? 0, 0);
|
|
6106
5954
|
return out;
|
|
6107
5955
|
}, [heights, count]);
|
|
6108
|
-
|
|
5956
|
+
useEffect15(() => {
|
|
6109
5957
|
recompute();
|
|
6110
5958
|
}, [offsets, recompute]);
|
|
6111
|
-
const scrollToIndex =
|
|
5959
|
+
const scrollToIndex = useCallback19(
|
|
6112
5960
|
(index) => {
|
|
6113
5961
|
const el = scrollRef.current;
|
|
6114
5962
|
if (!el) return;
|
|
@@ -6128,14 +5976,14 @@ function useWindowedSections(opts) {
|
|
|
6128
5976
|
}
|
|
6129
5977
|
|
|
6130
5978
|
// src/components/workbench-changes.tsx
|
|
6131
|
-
import { jsx as
|
|
5979
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
6132
5980
|
var GROUP_THRESHOLD = 20;
|
|
6133
5981
|
var OVERSCAN = 2;
|
|
6134
5982
|
var HEADER_PX = 30;
|
|
6135
5983
|
var LINE_PX = 18;
|
|
6136
5984
|
var GUARD_BODY_PX = 52;
|
|
6137
5985
|
var COMPACT_SURFACE_PX = 560;
|
|
6138
|
-
var useChangesLayoutEffect = typeof window === "undefined" ?
|
|
5986
|
+
var useChangesLayoutEffect = typeof window === "undefined" ? useEffect16 : useLayoutEffect3;
|
|
6139
5987
|
var STATUS_TINT2 = {
|
|
6140
5988
|
added: "text-og-status-idle",
|
|
6141
5989
|
modified: "text-og-status-running",
|
|
@@ -6246,7 +6094,7 @@ var ChangesRailVList = class extends Component {
|
|
|
6246
6094
|
this.listHandle = handle;
|
|
6247
6095
|
};
|
|
6248
6096
|
render() {
|
|
6249
|
-
return /* @__PURE__ */
|
|
6097
|
+
return /* @__PURE__ */ jsx5("div", { ref: this.setHost, "data-opengeni-changes-rail": true, className: this.props.className, children: /* @__PURE__ */ jsx5(
|
|
6250
6098
|
VList2,
|
|
6251
6099
|
{
|
|
6252
6100
|
ref: this.setListHandle,
|
|
@@ -6310,19 +6158,19 @@ function WorkbenchChanges({
|
|
|
6310
6158
|
onOpenFile,
|
|
6311
6159
|
className
|
|
6312
6160
|
}) {
|
|
6313
|
-
const rootRef =
|
|
6161
|
+
const rootRef = useRef14(null);
|
|
6314
6162
|
const [compact, setCompact] = useState12(false);
|
|
6315
6163
|
const [coarsePointer, setCoarsePointer] = useState12(false);
|
|
6316
6164
|
const resolvedTheme = useThemeType(themeType);
|
|
6317
6165
|
const [layout, setLayout] = useState12("unified");
|
|
6318
6166
|
const [activePath, setActivePath] = useState12(null);
|
|
6319
6167
|
const pickerId = useId3();
|
|
6320
|
-
const unicodeFontPaths =
|
|
6168
|
+
const unicodeFontPaths = useMemo13(
|
|
6321
6169
|
() => diff.flatMap((file) => file.oldPath ? [file.path, file.oldPath] : [file.path]),
|
|
6322
6170
|
[diff]
|
|
6323
6171
|
);
|
|
6324
6172
|
useUnicodeFallbackFonts(unicodeFontPaths);
|
|
6325
|
-
const { orderedFiles, rows, grouped } =
|
|
6173
|
+
const { orderedFiles, rows, grouped } = useMemo13(() => buildRail(diff), [diff]);
|
|
6326
6174
|
const selectedIndex = orderedFiles.findIndex((file) => file.path === activePath);
|
|
6327
6175
|
const activeIndex = selectedIndex >= 0 ? selectedIndex : 0;
|
|
6328
6176
|
useChangesLayoutEffect(() => {
|
|
@@ -6352,9 +6200,9 @@ function WorkbenchChanges({
|
|
|
6352
6200
|
return () => query.removeListener(update);
|
|
6353
6201
|
}
|
|
6354
6202
|
}, []);
|
|
6355
|
-
const additions =
|
|
6356
|
-
const deletions =
|
|
6357
|
-
const estimateHeight =
|
|
6203
|
+
const additions = useMemo13(() => diff.reduce((sum, f) => sum + f.additions, 0), [diff]);
|
|
6204
|
+
const deletions = useMemo13(() => diff.reduce((sum, f) => sum + f.deletions, 0), [diff]);
|
|
6205
|
+
const estimateHeight = useCallback20(
|
|
6358
6206
|
(index) => {
|
|
6359
6207
|
const file = orderedFiles[index];
|
|
6360
6208
|
return file ? estimateSectionHeight(file) : HEADER_PX + LINE_PX;
|
|
@@ -6366,14 +6214,14 @@ function WorkbenchChanges({
|
|
|
6366
6214
|
estimateHeight,
|
|
6367
6215
|
overscan: OVERSCAN
|
|
6368
6216
|
});
|
|
6369
|
-
const jumpTo =
|
|
6217
|
+
const jumpTo = useCallback20(
|
|
6370
6218
|
(index) => {
|
|
6371
6219
|
setActivePath(orderedFiles[index]?.path ?? null);
|
|
6372
6220
|
windowed.scrollToIndex(index);
|
|
6373
6221
|
},
|
|
6374
6222
|
[orderedFiles, windowed]
|
|
6375
6223
|
);
|
|
6376
|
-
const onPaneScroll =
|
|
6224
|
+
const onPaneScroll = useCallback20(() => {
|
|
6377
6225
|
const el = windowed.scrollRef.current;
|
|
6378
6226
|
if (!el) {
|
|
6379
6227
|
return;
|
|
@@ -6388,7 +6236,7 @@ function WorkbenchChanges({
|
|
|
6388
6236
|
const nextPath = orderedFiles[idx]?.path ?? null;
|
|
6389
6237
|
setActivePath((previous) => previous === nextPath ? previous : nextPath);
|
|
6390
6238
|
}, [windowed, orderedFiles]);
|
|
6391
|
-
|
|
6239
|
+
useEffect16(() => {
|
|
6392
6240
|
const el = windowed.scrollRef.current;
|
|
6393
6241
|
if (!el) return;
|
|
6394
6242
|
el.addEventListener("scroll", onPaneScroll, { passive: true });
|
|
@@ -6396,14 +6244,14 @@ function WorkbenchChanges({
|
|
|
6396
6244
|
}, [windowed.scrollRef, onPaneScroll]);
|
|
6397
6245
|
const sourceBadge = describeSource(source, capturedAt, captureRevision ?? null);
|
|
6398
6246
|
const activeFile = orderedFiles[activeIndex] ?? orderedFiles[0];
|
|
6399
|
-
return /* @__PURE__ */
|
|
6247
|
+
return /* @__PURE__ */ jsxs5(
|
|
6400
6248
|
"div",
|
|
6401
6249
|
{
|
|
6402
6250
|
ref: rootRef,
|
|
6403
6251
|
className: cn("flex h-full min-h-0 min-w-0 flex-col", className),
|
|
6404
6252
|
"data-workbench-changes-layout": compact ? "compact" : "rail",
|
|
6405
6253
|
children: [
|
|
6406
|
-
/* @__PURE__ */
|
|
6254
|
+
/* @__PURE__ */ jsxs5(
|
|
6407
6255
|
"div",
|
|
6408
6256
|
{
|
|
6409
6257
|
className: cn(
|
|
@@ -6411,7 +6259,7 @@ function WorkbenchChanges({
|
|
|
6411
6259
|
compact && source === "capture" && "flex-col items-stretch gap-1.5 py-2"
|
|
6412
6260
|
),
|
|
6413
6261
|
children: [
|
|
6414
|
-
/* @__PURE__ */
|
|
6262
|
+
/* @__PURE__ */ jsxs5(
|
|
6415
6263
|
"span",
|
|
6416
6264
|
{
|
|
6417
6265
|
role: "status",
|
|
@@ -6424,18 +6272,18 @@ function WorkbenchChanges({
|
|
|
6424
6272
|
" ",
|
|
6425
6273
|
diff.length === 1 ? "file" : "files",
|
|
6426
6274
|
" changed",
|
|
6427
|
-
/* @__PURE__ */
|
|
6275
|
+
/* @__PURE__ */ jsxs5("span", { "data-contrast-audited": true, className: "ml-2 text-og-status-idle", children: [
|
|
6428
6276
|
"+",
|
|
6429
6277
|
additions
|
|
6430
6278
|
] }),
|
|
6431
|
-
/* @__PURE__ */
|
|
6279
|
+
/* @__PURE__ */ jsxs5("span", { "data-contrast-audited": true, className: "ml-1 text-og-status-failed", children: [
|
|
6432
6280
|
"\u2212",
|
|
6433
6281
|
deletions
|
|
6434
6282
|
] })
|
|
6435
6283
|
]
|
|
6436
6284
|
}
|
|
6437
6285
|
),
|
|
6438
|
-
/* @__PURE__ */
|
|
6286
|
+
/* @__PURE__ */ jsxs5(
|
|
6439
6287
|
"div",
|
|
6440
6288
|
{
|
|
6441
6289
|
className: cn(
|
|
@@ -6443,18 +6291,18 @@ function WorkbenchChanges({
|
|
|
6443
6291
|
compact && source === "capture" && "self-start"
|
|
6444
6292
|
),
|
|
6445
6293
|
children: [
|
|
6446
|
-
compact ? null : /* @__PURE__ */
|
|
6447
|
-
/* @__PURE__ */
|
|
6294
|
+
compact ? null : /* @__PURE__ */ jsx5(LayoutToggle, { layout, onChange: setLayout }),
|
|
6295
|
+
/* @__PURE__ */ jsx5(SourceBadge, { source, capturedAt, label: sourceBadge })
|
|
6448
6296
|
]
|
|
6449
6297
|
}
|
|
6450
6298
|
)
|
|
6451
6299
|
]
|
|
6452
6300
|
}
|
|
6453
6301
|
),
|
|
6454
|
-
compact ? /* @__PURE__ */
|
|
6455
|
-
/* @__PURE__ */
|
|
6456
|
-
/* @__PURE__ */
|
|
6457
|
-
/* @__PURE__ */
|
|
6302
|
+
compact ? /* @__PURE__ */ jsxs5("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
6303
|
+
/* @__PURE__ */ jsxs5("div", { className: "shrink-0 border-b border-og-border bg-og-surface-1 p-2", children: [
|
|
6304
|
+
/* @__PURE__ */ jsx5("label", { className: "sr-only", htmlFor: pickerId, children: "Changed file" }),
|
|
6305
|
+
/* @__PURE__ */ jsx5(
|
|
6458
6306
|
"select",
|
|
6459
6307
|
{
|
|
6460
6308
|
id: pickerId,
|
|
@@ -6467,11 +6315,11 @@ function WorkbenchChanges({
|
|
|
6467
6315
|
title: activeFile?.path,
|
|
6468
6316
|
"data-compact-file-picker": true,
|
|
6469
6317
|
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",
|
|
6470
|
-
children: orderedFiles.map((file, index) => /* @__PURE__ */
|
|
6318
|
+
children: orderedFiles.map((file, index) => /* @__PURE__ */ jsx5("option", { value: index, children: compactFileLabel(file) }, file.path))
|
|
6471
6319
|
}
|
|
6472
6320
|
)
|
|
6473
6321
|
] }),
|
|
6474
|
-
/* @__PURE__ */
|
|
6322
|
+
/* @__PURE__ */ jsx5(
|
|
6475
6323
|
"div",
|
|
6476
6324
|
{
|
|
6477
6325
|
"aria-label": "Changed file diff",
|
|
@@ -6479,7 +6327,7 @@ function WorkbenchChanges({
|
|
|
6479
6327
|
"data-opengeni-changes-pane": true,
|
|
6480
6328
|
role: "region",
|
|
6481
6329
|
tabIndex: 0,
|
|
6482
|
-
children: activeFile ? /* @__PURE__ */
|
|
6330
|
+
children: activeFile ? /* @__PURE__ */ jsx5(
|
|
6483
6331
|
DiffSection,
|
|
6484
6332
|
{
|
|
6485
6333
|
file: activeFile,
|
|
@@ -6490,8 +6338,8 @@ function WorkbenchChanges({
|
|
|
6490
6338
|
) : null
|
|
6491
6339
|
}
|
|
6492
6340
|
)
|
|
6493
|
-
] }) : /* @__PURE__ */
|
|
6494
|
-
/* @__PURE__ */
|
|
6341
|
+
] }) : /* @__PURE__ */ jsxs5("div", { className: "flex min-h-0 flex-1", children: [
|
|
6342
|
+
/* @__PURE__ */ jsx5(
|
|
6495
6343
|
ChangesRailVList,
|
|
6496
6344
|
{
|
|
6497
6345
|
rowCount: rows.length,
|
|
@@ -6499,18 +6347,18 @@ function WorkbenchChanges({
|
|
|
6499
6347
|
files: orderedFiles,
|
|
6500
6348
|
className: "w-[clamp(12rem,28%,15rem)] shrink-0 border-r border-og-border bg-og-surface-1/35",
|
|
6501
6349
|
children: rows.map(
|
|
6502
|
-
(row) => row.kind === "group" ? /* @__PURE__ */
|
|
6350
|
+
(row) => row.kind === "group" ? /* @__PURE__ */ jsxs5(
|
|
6503
6351
|
"div",
|
|
6504
6352
|
{
|
|
6505
6353
|
"data-rail-group": true,
|
|
6506
6354
|
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",
|
|
6507
6355
|
children: [
|
|
6508
|
-
/* @__PURE__ */
|
|
6509
|
-
/* @__PURE__ */
|
|
6356
|
+
/* @__PURE__ */ jsx5("span", { className: "min-w-0 truncate", children: row.label }),
|
|
6357
|
+
/* @__PURE__ */ jsx5("span", { className: "shrink-0", children: row.count })
|
|
6510
6358
|
]
|
|
6511
6359
|
},
|
|
6512
6360
|
`g:${row.label}`
|
|
6513
|
-
) : /* @__PURE__ */
|
|
6361
|
+
) : /* @__PURE__ */ jsx5(
|
|
6514
6362
|
RailFileRow,
|
|
6515
6363
|
{
|
|
6516
6364
|
file: row.file,
|
|
@@ -6523,7 +6371,7 @@ function WorkbenchChanges({
|
|
|
6523
6371
|
)
|
|
6524
6372
|
}
|
|
6525
6373
|
),
|
|
6526
|
-
/* @__PURE__ */
|
|
6374
|
+
/* @__PURE__ */ jsx5(
|
|
6527
6375
|
"div",
|
|
6528
6376
|
{
|
|
6529
6377
|
ref: windowed.scrollRef,
|
|
@@ -6532,15 +6380,15 @@ function WorkbenchChanges({
|
|
|
6532
6380
|
"data-opengeni-changes-pane": true,
|
|
6533
6381
|
role: "region",
|
|
6534
6382
|
tabIndex: 0,
|
|
6535
|
-
children: /* @__PURE__ */
|
|
6383
|
+
children: /* @__PURE__ */ jsx5("div", { style: { position: "relative", height: windowed.totalHeight }, children: orderedFiles.map((file, index) => {
|
|
6536
6384
|
if (index < windowed.range.start || index >= windowed.range.end) return null;
|
|
6537
|
-
return /* @__PURE__ */
|
|
6385
|
+
return /* @__PURE__ */ jsx5(
|
|
6538
6386
|
MeasuredSection,
|
|
6539
6387
|
{
|
|
6540
6388
|
index,
|
|
6541
6389
|
top: windowed.offsets[index] ?? 0,
|
|
6542
6390
|
onMeasure: windowed.measure,
|
|
6543
|
-
children: /* @__PURE__ */
|
|
6391
|
+
children: /* @__PURE__ */ jsx5(
|
|
6544
6392
|
DiffSection,
|
|
6545
6393
|
{
|
|
6546
6394
|
file,
|
|
@@ -6566,19 +6414,19 @@ function SourceBadge({
|
|
|
6566
6414
|
label
|
|
6567
6415
|
}) {
|
|
6568
6416
|
if (source === "capture" && capturedAt) {
|
|
6569
|
-
return /* @__PURE__ */
|
|
6417
|
+
return /* @__PURE__ */ jsxs5(
|
|
6570
6418
|
"span",
|
|
6571
6419
|
{
|
|
6572
6420
|
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",
|
|
6573
6421
|
title: new Date(capturedAt).toLocaleString(),
|
|
6574
6422
|
children: [
|
|
6575
|
-
/* @__PURE__ */
|
|
6423
|
+
/* @__PURE__ */ jsx5(HistoryIcon, { className: "size-3 shrink-0 text-og-status-running", "aria-hidden": true }),
|
|
6576
6424
|
label
|
|
6577
6425
|
]
|
|
6578
6426
|
}
|
|
6579
6427
|
);
|
|
6580
6428
|
}
|
|
6581
|
-
return /* @__PURE__ */
|
|
6429
|
+
return /* @__PURE__ */ jsx5("span", { className: "rounded-og-xs bg-og-surface-2 px-1.5 py-px text-og-xs text-og-fg-subtle", children: label });
|
|
6582
6430
|
}
|
|
6583
6431
|
function describeSource(source, capturedAt, revision) {
|
|
6584
6432
|
if (source !== "capture" || !capturedAt) return "Live diff";
|
|
@@ -6593,7 +6441,7 @@ function RailFileRow({
|
|
|
6593
6441
|
}) {
|
|
6594
6442
|
const repoPrefix = file.repoRoot ? `${file.repoRoot}/` : null;
|
|
6595
6443
|
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;
|
|
6596
|
-
return /* @__PURE__ */
|
|
6444
|
+
return /* @__PURE__ */ jsxs5(
|
|
6597
6445
|
"button",
|
|
6598
6446
|
{
|
|
6599
6447
|
type: "button",
|
|
@@ -6607,7 +6455,7 @@ function RailFileRow({
|
|
|
6607
6455
|
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"
|
|
6608
6456
|
),
|
|
6609
6457
|
children: [
|
|
6610
|
-
/* @__PURE__ */
|
|
6458
|
+
/* @__PURE__ */ jsx5(
|
|
6611
6459
|
"span",
|
|
6612
6460
|
{
|
|
6613
6461
|
"data-contrast-audited": true,
|
|
@@ -6615,13 +6463,13 @@ function RailFileRow({
|
|
|
6615
6463
|
children: STATUS_LETTER[file.status]
|
|
6616
6464
|
}
|
|
6617
6465
|
),
|
|
6618
|
-
/* @__PURE__ */
|
|
6619
|
-
/* @__PURE__ */
|
|
6620
|
-
/* @__PURE__ */
|
|
6466
|
+
/* @__PURE__ */ jsx5("span", { className: "min-w-0 flex-1 truncate", children: shown }),
|
|
6467
|
+
/* @__PURE__ */ jsxs5("span", { className: "ml-auto flex shrink-0 items-center gap-1 pl-1 font-og-mono text-og-xs", children: [
|
|
6468
|
+
/* @__PURE__ */ jsxs5("span", { "data-contrast-audited": true, className: "text-og-status-idle", children: [
|
|
6621
6469
|
"+",
|
|
6622
6470
|
file.additions
|
|
6623
6471
|
] }),
|
|
6624
|
-
/* @__PURE__ */
|
|
6472
|
+
/* @__PURE__ */ jsxs5("span", { "data-contrast-audited": true, className: "text-og-status-failed", children: [
|
|
6625
6473
|
"\u2212",
|
|
6626
6474
|
file.deletions
|
|
6627
6475
|
] })
|
|
@@ -6636,8 +6484,8 @@ function MeasuredSection({
|
|
|
6636
6484
|
onMeasure,
|
|
6637
6485
|
children
|
|
6638
6486
|
}) {
|
|
6639
|
-
const ref =
|
|
6640
|
-
|
|
6487
|
+
const ref = useRef14(null);
|
|
6488
|
+
useEffect16(() => {
|
|
6641
6489
|
const el = ref.current;
|
|
6642
6490
|
if (!el) return;
|
|
6643
6491
|
const report = () => onMeasure(index, el.offsetHeight);
|
|
@@ -6646,7 +6494,7 @@ function MeasuredSection({
|
|
|
6646
6494
|
ro?.observe(el);
|
|
6647
6495
|
return () => ro?.disconnect();
|
|
6648
6496
|
}, [index, onMeasure]);
|
|
6649
|
-
return /* @__PURE__ */
|
|
6497
|
+
return /* @__PURE__ */ jsx5(
|
|
6650
6498
|
"div",
|
|
6651
6499
|
{
|
|
6652
6500
|
ref,
|
|
@@ -6665,37 +6513,37 @@ function DiffSection({
|
|
|
6665
6513
|
}) {
|
|
6666
6514
|
if (isGuarded(file)) {
|
|
6667
6515
|
const renamed = file.oldPath && file.oldPath !== file.path;
|
|
6668
|
-
return /* @__PURE__ */
|
|
6669
|
-
/* @__PURE__ */
|
|
6670
|
-
/* @__PURE__ */
|
|
6671
|
-
/* @__PURE__ */
|
|
6672
|
-
/* @__PURE__ */
|
|
6516
|
+
return /* @__PURE__ */ jsxs5("section", { className: "border-b border-og-border pb-1", children: [
|
|
6517
|
+
/* @__PURE__ */ jsxs5("header", { className: "flex items-center justify-between gap-2 bg-og-surface-1 px-3 py-1.5 text-og-sm", children: [
|
|
6518
|
+
/* @__PURE__ */ jsx5("span", { className: "min-w-0 truncate font-og-mono text-og-xs", children: renamed ? `${file.oldPath} \u2192 ${file.path}` : file.path }),
|
|
6519
|
+
/* @__PURE__ */ jsxs5("span", { className: "flex shrink-0 items-center gap-2 font-og-mono text-og-xs", children: [
|
|
6520
|
+
/* @__PURE__ */ jsxs5("span", { className: "text-og-status-idle", children: [
|
|
6673
6521
|
"+",
|
|
6674
6522
|
file.additions
|
|
6675
6523
|
] }),
|
|
6676
|
-
/* @__PURE__ */
|
|
6524
|
+
/* @__PURE__ */ jsxs5("span", { className: "text-og-status-failed", children: [
|
|
6677
6525
|
"\u2212",
|
|
6678
6526
|
file.deletions
|
|
6679
6527
|
] })
|
|
6680
6528
|
] })
|
|
6681
6529
|
] }),
|
|
6682
|
-
/* @__PURE__ */
|
|
6530
|
+
/* @__PURE__ */ jsx5(GuardBody, { file, ...onOpenFile ? { onOpenFile } : {} })
|
|
6683
6531
|
] });
|
|
6684
6532
|
}
|
|
6685
|
-
return /* @__PURE__ */
|
|
6533
|
+
return /* @__PURE__ */ jsx5("section", { "data-pierre-section": true, className: "border-b border-og-border pb-2", children: /* @__PURE__ */ jsx5(PierreDiff, { diff: [file], layout, themeType, className: "px-1" }) });
|
|
6686
6534
|
}
|
|
6687
6535
|
function GuardBody({
|
|
6688
6536
|
file,
|
|
6689
6537
|
onOpenFile
|
|
6690
6538
|
}) {
|
|
6691
6539
|
const reason = file.isBinary ? "Binary file" : "Diff too large to show here";
|
|
6692
|
-
return /* @__PURE__ */
|
|
6693
|
-
/* @__PURE__ */
|
|
6694
|
-
/* @__PURE__ */
|
|
6540
|
+
return /* @__PURE__ */ jsxs5("div", { className: "flex flex-wrap items-center gap-2 px-3 py-3 text-og-sm text-og-fg-subtle", children: [
|
|
6541
|
+
/* @__PURE__ */ jsx5(FileWarningIcon, { className: "size-3.5 shrink-0", "aria-hidden": true }),
|
|
6542
|
+
/* @__PURE__ */ jsxs5("span", { className: "min-w-0 flex-1", children: [
|
|
6695
6543
|
reason,
|
|
6696
6544
|
"."
|
|
6697
6545
|
] }),
|
|
6698
|
-
onOpenFile ? /* @__PURE__ */
|
|
6546
|
+
onOpenFile ? /* @__PURE__ */ jsxs5(
|
|
6699
6547
|
"button",
|
|
6700
6548
|
{
|
|
6701
6549
|
type: "button",
|
|
@@ -6703,7 +6551,7 @@ function GuardBody({
|
|
|
6703
6551
|
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",
|
|
6704
6552
|
children: [
|
|
6705
6553
|
"Open in Files",
|
|
6706
|
-
/* @__PURE__ */
|
|
6554
|
+
/* @__PURE__ */ jsx5(ArrowUpRightIcon, { className: "size-3.5", "aria-hidden": true })
|
|
6707
6555
|
]
|
|
6708
6556
|
}
|
|
6709
6557
|
) : null
|
|
@@ -6713,7 +6561,7 @@ function LayoutToggle({
|
|
|
6713
6561
|
layout,
|
|
6714
6562
|
onChange
|
|
6715
6563
|
}) {
|
|
6716
|
-
return /* @__PURE__ */
|
|
6564
|
+
return /* @__PURE__ */ jsx5("div", { className: "inline-flex items-center rounded-og-sm border border-og-border p-0.5", children: ["unified", "split"].map((value) => /* @__PURE__ */ jsx5(
|
|
6717
6565
|
"button",
|
|
6718
6566
|
{
|
|
6719
6567
|
type: "button",
|
|
@@ -6729,7 +6577,7 @@ function LayoutToggle({
|
|
|
6729
6577
|
}
|
|
6730
6578
|
|
|
6731
6579
|
// src/components/diff-view.tsx
|
|
6732
|
-
import { jsx as
|
|
6580
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
6733
6581
|
function DiffView({
|
|
6734
6582
|
diff,
|
|
6735
6583
|
fallback,
|
|
@@ -6740,9 +6588,9 @@ function DiffView({
|
|
|
6740
6588
|
className
|
|
6741
6589
|
}) {
|
|
6742
6590
|
if (diff.length === 0) {
|
|
6743
|
-
return /* @__PURE__ */
|
|
6591
|
+
return /* @__PURE__ */ jsx6("div", { className: cn("p-3 text-og-sm text-og-fg-subtle", className), children: emptyState ?? (isRepo ? "No changes" : "No repository mounted") });
|
|
6744
6592
|
}
|
|
6745
|
-
return /* @__PURE__ */
|
|
6593
|
+
return /* @__PURE__ */ jsx6(
|
|
6746
6594
|
PierreDiff,
|
|
6747
6595
|
{
|
|
6748
6596
|
diff,
|
|
@@ -6758,10 +6606,10 @@ function DiffView({
|
|
|
6758
6606
|
import {
|
|
6759
6607
|
lazy,
|
|
6760
6608
|
Suspense,
|
|
6761
|
-
useEffect as
|
|
6609
|
+
useEffect as useEffect17,
|
|
6762
6610
|
useState as useState13
|
|
6763
6611
|
} from "react";
|
|
6764
|
-
import { jsx as
|
|
6612
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
6765
6613
|
var LazyFile = lazy(async () => {
|
|
6766
6614
|
const mod = await import("@pierre/diffs/react");
|
|
6767
6615
|
return { default: mod.File };
|
|
@@ -6777,7 +6625,7 @@ function PierreFile({
|
|
|
6777
6625
|
className
|
|
6778
6626
|
}) {
|
|
6779
6627
|
const [failed, setFailed] = useState13(false);
|
|
6780
|
-
|
|
6628
|
+
useEffect17(() => {
|
|
6781
6629
|
let cancelled = false;
|
|
6782
6630
|
void import("@pierre/diffs/react").catch(() => {
|
|
6783
6631
|
if (!cancelled) setFailed(true);
|
|
@@ -6788,7 +6636,7 @@ function PierreFile({
|
|
|
6788
6636
|
}, []);
|
|
6789
6637
|
const name = path.split("/").filter(Boolean).pop() ?? path;
|
|
6790
6638
|
if (failed) {
|
|
6791
|
-
return /* @__PURE__ */
|
|
6639
|
+
return /* @__PURE__ */ jsx7("div", { className, children: fallback ?? /* @__PURE__ */ jsx7(PlainFile, { name, contents }) });
|
|
6792
6640
|
}
|
|
6793
6641
|
const options = {
|
|
6794
6642
|
overflow: "scroll",
|
|
@@ -6810,7 +6658,7 @@ function PierreFile({
|
|
|
6810
6658
|
"--diffs-font-size": "var(--og-code-font-size)",
|
|
6811
6659
|
"--diffs-line-height": "var(--og-code-line-height)"
|
|
6812
6660
|
};
|
|
6813
|
-
return /* @__PURE__ */
|
|
6661
|
+
return /* @__PURE__ */ jsx7("div", { className: cn("min-w-0", className), "data-opengeni-pierre-file": true, style: pierreVars, children: /* @__PURE__ */ jsx7(Suspense, { fallback: loading ?? /* @__PURE__ */ jsx7(FileSkeleton, {}), children: /* @__PURE__ */ jsx7(
|
|
6814
6662
|
LazyFile,
|
|
6815
6663
|
{
|
|
6816
6664
|
file: { name, contents },
|
|
@@ -6820,7 +6668,7 @@ function PierreFile({
|
|
|
6820
6668
|
) }) });
|
|
6821
6669
|
}
|
|
6822
6670
|
function PlainFile({ name, contents }) {
|
|
6823
|
-
return /* @__PURE__ */
|
|
6671
|
+
return /* @__PURE__ */ jsx7(
|
|
6824
6672
|
"pre",
|
|
6825
6673
|
{
|
|
6826
6674
|
className: "overflow-auto whitespace-pre p-2 font-og-mono text-og-sm text-og-fg",
|
|
@@ -6830,19 +6678,19 @@ function PlainFile({ name, contents }) {
|
|
|
6830
6678
|
);
|
|
6831
6679
|
}
|
|
6832
6680
|
function FileSkeleton() {
|
|
6833
|
-
return /* @__PURE__ */
|
|
6681
|
+
return /* @__PURE__ */ jsx7("div", { className: "p-3 text-og-sm text-og-fg-subtle", children: "Loading file\u2026" });
|
|
6834
6682
|
}
|
|
6835
6683
|
|
|
6836
6684
|
// src/components/code-editor.tsx
|
|
6837
6685
|
import { Loader2Icon, SaveIcon } from "lucide-react";
|
|
6838
6686
|
import {
|
|
6839
|
-
useCallback as
|
|
6840
|
-
useEffect as
|
|
6841
|
-
useMemo as
|
|
6842
|
-
useRef as
|
|
6687
|
+
useCallback as useCallback21,
|
|
6688
|
+
useEffect as useEffect18,
|
|
6689
|
+
useMemo as useMemo14,
|
|
6690
|
+
useRef as useRef15,
|
|
6843
6691
|
useState as useState14
|
|
6844
6692
|
} from "react";
|
|
6845
|
-
import { jsx as
|
|
6693
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
6846
6694
|
var LANGUAGE_LOADERS = {
|
|
6847
6695
|
javascript: async () => (await import("@codemirror/lang-javascript")).javascript({ jsx: true, typescript: true }),
|
|
6848
6696
|
json: async () => (await import("@codemirror/lang-json")).json(),
|
|
@@ -6923,19 +6771,19 @@ function CodeEditor({
|
|
|
6923
6771
|
const [saving, setSaving] = useState14(false);
|
|
6924
6772
|
const [saveError, setSaveError] = useState14(null);
|
|
6925
6773
|
const [savedTick, setSavedTick] = useState14(false);
|
|
6926
|
-
const saveInFlightRef =
|
|
6774
|
+
const saveInFlightRef = useRef15(false);
|
|
6927
6775
|
const dirty = value !== baseline;
|
|
6928
6776
|
const saveConflict = saveError !== null && saveError.code === "file_write_conflict";
|
|
6929
|
-
const editIntentFiredRef =
|
|
6930
|
-
|
|
6777
|
+
const editIntentFiredRef = useRef15(false);
|
|
6778
|
+
useEffect18(() => {
|
|
6931
6779
|
setBuffer((current) => reconcileEditorBuffer(current, { path, contents: initialContents }));
|
|
6932
6780
|
}, [path, initialContents]);
|
|
6933
|
-
|
|
6781
|
+
useEffect18(() => {
|
|
6934
6782
|
editIntentFiredRef.current = false;
|
|
6935
6783
|
setSaveError(null);
|
|
6936
6784
|
setSavedTick(false);
|
|
6937
6785
|
}, [path]);
|
|
6938
|
-
const noteEdit =
|
|
6786
|
+
const noteEdit = useCallback21(
|
|
6939
6787
|
(next) => {
|
|
6940
6788
|
setBuffer((current) => ({ ...current, value: next }));
|
|
6941
6789
|
setSavedTick(false);
|
|
@@ -6946,8 +6794,8 @@ function CodeEditor({
|
|
|
6946
6794
|
},
|
|
6947
6795
|
[baseline, onEditIntent]
|
|
6948
6796
|
);
|
|
6949
|
-
const langKey =
|
|
6950
|
-
|
|
6797
|
+
const langKey = useMemo14(() => languageForPath(path), [path]);
|
|
6798
|
+
useEffect18(() => {
|
|
6951
6799
|
let cancelled = false;
|
|
6952
6800
|
void (async () => {
|
|
6953
6801
|
try {
|
|
@@ -6987,9 +6835,9 @@ function CodeEditor({
|
|
|
6987
6835
|
cancelled = true;
|
|
6988
6836
|
};
|
|
6989
6837
|
}, [langKey]);
|
|
6990
|
-
const saveRef =
|
|
6838
|
+
const saveRef = useRef15(() => {
|
|
6991
6839
|
});
|
|
6992
|
-
const save =
|
|
6840
|
+
const save = useCallback21(async () => {
|
|
6993
6841
|
if (readOnly || saveInFlightRef.current) return;
|
|
6994
6842
|
const snapshot = value;
|
|
6995
6843
|
if (snapshot === baseline) return;
|
|
@@ -7010,7 +6858,7 @@ function CodeEditor({
|
|
|
7010
6858
|
setSaving(false);
|
|
7011
6859
|
}
|
|
7012
6860
|
}, [readOnly, value, baseline, onSave, path]);
|
|
7013
|
-
const overwrite =
|
|
6861
|
+
const overwrite = useCallback21(async () => {
|
|
7014
6862
|
if (readOnly || !onOverwrite || saveInFlightRef.current) return;
|
|
7015
6863
|
const snapshot = value;
|
|
7016
6864
|
if (snapshot === baseline) return;
|
|
@@ -7034,27 +6882,27 @@ function CodeEditor({
|
|
|
7034
6882
|
saveRef.current = () => {
|
|
7035
6883
|
void save();
|
|
7036
6884
|
};
|
|
7037
|
-
|
|
6885
|
+
useEffect18(() => {
|
|
7038
6886
|
if (!savedTick) return;
|
|
7039
6887
|
const t = setTimeout(() => setSavedTick(false), 1800);
|
|
7040
6888
|
return () => clearTimeout(t);
|
|
7041
6889
|
}, [savedTick]);
|
|
7042
6890
|
const fileName = path.split("/").filter(Boolean).pop() ?? path;
|
|
7043
|
-
const cmExtensions =
|
|
6891
|
+
const cmExtensions = useMemo14(() => {
|
|
7044
6892
|
if (!bundle) return [];
|
|
7045
6893
|
const exts = [bundle.saveKeymapExtension(() => saveRef.current())];
|
|
7046
6894
|
if (bundle.languageExtension) exts.push(bundle.languageExtension);
|
|
7047
6895
|
return exts;
|
|
7048
6896
|
}, [bundle]);
|
|
7049
6897
|
const Editor = bundle?.Editor;
|
|
7050
|
-
const reload =
|
|
6898
|
+
const reload = useCallback21(() => {
|
|
7051
6899
|
setBuffer({ path, value: initialContents, baseline: initialContents });
|
|
7052
6900
|
editIntentFiredRef.current = false;
|
|
7053
6901
|
setSaveError(null);
|
|
7054
6902
|
setSavedTick(false);
|
|
7055
6903
|
onReload?.();
|
|
7056
6904
|
}, [initialContents, onReload, path]);
|
|
7057
|
-
return /* @__PURE__ */
|
|
6905
|
+
return /* @__PURE__ */ jsxs6(
|
|
7058
6906
|
"div",
|
|
7059
6907
|
{
|
|
7060
6908
|
className: cn("flex h-full min-h-0 flex-col", className),
|
|
@@ -7062,8 +6910,8 @@ function CodeEditor({
|
|
|
7062
6910
|
"data-opengeni-editor-dirty": dirty ? "true" : "false",
|
|
7063
6911
|
style: editorVars,
|
|
7064
6912
|
children: [
|
|
7065
|
-
/* @__PURE__ */
|
|
7066
|
-
/* @__PURE__ */
|
|
6913
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex min-h-9 shrink-0 items-center gap-2 border-b border-og-border bg-og-surface-1 px-2 py-1", children: [
|
|
6914
|
+
/* @__PURE__ */ jsx8(
|
|
7067
6915
|
"span",
|
|
7068
6916
|
{
|
|
7069
6917
|
className: cn(
|
|
@@ -7073,12 +6921,12 @@ function CodeEditor({
|
|
|
7073
6921
|
title: readOnly ? "read-only" : dirty ? "unsaved changes" : "saved"
|
|
7074
6922
|
}
|
|
7075
6923
|
),
|
|
7076
|
-
/* @__PURE__ */
|
|
6924
|
+
/* @__PURE__ */ jsxs6("span", { className: "truncate font-og-mono text-og-xs text-og-fg-muted", children: [
|
|
7077
6925
|
fileName,
|
|
7078
6926
|
dirty && !readOnly ? " \u2022" : ""
|
|
7079
6927
|
] }),
|
|
7080
|
-
/* @__PURE__ */
|
|
7081
|
-
saveError && !saveConflict && /* @__PURE__ */
|
|
6928
|
+
/* @__PURE__ */ jsxs6("div", { className: "ml-auto flex shrink-0 items-center gap-2", children: [
|
|
6929
|
+
saveError && !saveConflict && /* @__PURE__ */ jsx8(
|
|
7082
6930
|
"span",
|
|
7083
6931
|
{
|
|
7084
6932
|
className: "max-w-[220px] truncate text-og-xs text-og-status-failed",
|
|
@@ -7086,8 +6934,8 @@ function CodeEditor({
|
|
|
7086
6934
|
children: saveError.message
|
|
7087
6935
|
}
|
|
7088
6936
|
),
|
|
7089
|
-
!saveError && savedTick && !dirty && /* @__PURE__ */
|
|
7090
|
-
readOnly ? /* @__PURE__ */
|
|
6937
|
+
!saveError && savedTick && !dirty && /* @__PURE__ */ jsx8("span", { className: "text-og-xs text-og-status-idle", children: "Saved" }),
|
|
6938
|
+
readOnly ? /* @__PURE__ */ jsx8("span", { className: "text-og-xs uppercase tracking-wide text-og-fg-subtle", children: "Read-only" }) : !saveConflict ? /* @__PURE__ */ jsxs6(
|
|
7091
6939
|
"button",
|
|
7092
6940
|
{
|
|
7093
6941
|
type: "button",
|
|
@@ -7099,26 +6947,26 @@ function CodeEditor({
|
|
|
7099
6947
|
),
|
|
7100
6948
|
title: "Save (\u2318/Ctrl+S)",
|
|
7101
6949
|
children: [
|
|
7102
|
-
saving ? /* @__PURE__ */
|
|
6950
|
+
saving ? /* @__PURE__ */ jsx8(Loader2Icon, { className: "size-3 animate-spin" }) : /* @__PURE__ */ jsx8(SaveIcon, { className: "size-3" }),
|
|
7103
6951
|
"Save"
|
|
7104
6952
|
]
|
|
7105
6953
|
}
|
|
7106
6954
|
) : null
|
|
7107
6955
|
] })
|
|
7108
6956
|
] }),
|
|
7109
|
-
saveConflict ? /* @__PURE__ */
|
|
6957
|
+
saveConflict ? /* @__PURE__ */ jsxs6(
|
|
7110
6958
|
"div",
|
|
7111
6959
|
{
|
|
7112
6960
|
className: "flex shrink-0 flex-wrap items-center gap-x-3 gap-y-2 border-b border-og-status-failed/25 bg-og-status-failed/8 px-2 py-2",
|
|
7113
6961
|
role: "alert",
|
|
7114
6962
|
children: [
|
|
7115
|
-
/* @__PURE__ */
|
|
7116
|
-
/* @__PURE__ */
|
|
6963
|
+
/* @__PURE__ */ jsxs6("div", { className: "min-w-[12rem] flex-1 text-og-xs text-og-fg-muted", children: [
|
|
6964
|
+
/* @__PURE__ */ jsx8("span", { className: "font-medium text-og-status-failed", children: "File changed on machine." }),
|
|
7117
6965
|
" ",
|
|
7118
6966
|
"Reloading discards your edits; overwriting replaces the live version."
|
|
7119
6967
|
] }),
|
|
7120
|
-
/* @__PURE__ */
|
|
7121
|
-
onReload ? /* @__PURE__ */
|
|
6968
|
+
/* @__PURE__ */ jsxs6("div", { className: "ml-auto flex shrink-0 items-center gap-1.5", children: [
|
|
6969
|
+
onReload ? /* @__PURE__ */ jsx8(
|
|
7122
6970
|
"button",
|
|
7123
6971
|
{
|
|
7124
6972
|
type: "button",
|
|
@@ -7129,7 +6977,7 @@ function CodeEditor({
|
|
|
7129
6977
|
children: "Reload live"
|
|
7130
6978
|
}
|
|
7131
6979
|
) : null,
|
|
7132
|
-
onOverwrite ? /* @__PURE__ */
|
|
6980
|
+
onOverwrite ? /* @__PURE__ */ jsx8(
|
|
7133
6981
|
"button",
|
|
7134
6982
|
{
|
|
7135
6983
|
type: "button",
|
|
@@ -7143,7 +6991,7 @@ function CodeEditor({
|
|
|
7143
6991
|
]
|
|
7144
6992
|
}
|
|
7145
6993
|
) : null,
|
|
7146
|
-
/* @__PURE__ */
|
|
6994
|
+
/* @__PURE__ */ jsx8("div", { className: "min-h-0 flex-1 overflow-auto", children: failed ? fallback ?? /* @__PURE__ */ jsx8(
|
|
7147
6995
|
PlainTextarea,
|
|
7148
6996
|
{
|
|
7149
6997
|
value,
|
|
@@ -7151,7 +6999,7 @@ function CodeEditor({
|
|
|
7151
6999
|
onChange: noteEdit,
|
|
7152
7000
|
onSave: () => void save()
|
|
7153
7001
|
}
|
|
7154
|
-
) : Editor ? /* @__PURE__ */
|
|
7002
|
+
) : Editor ? /* @__PURE__ */ jsx8(
|
|
7155
7003
|
Editor,
|
|
7156
7004
|
{
|
|
7157
7005
|
value,
|
|
@@ -7164,7 +7012,7 @@ function CodeEditor({
|
|
|
7164
7012
|
className: "og-cm-editor min-h-full text-og-sm",
|
|
7165
7013
|
onChange: readOnly ? void 0 : noteEdit
|
|
7166
7014
|
}
|
|
7167
|
-
) : loading ?? /* @__PURE__ */
|
|
7015
|
+
) : loading ?? /* @__PURE__ */ jsx8(EditorSkeleton, {}) })
|
|
7168
7016
|
]
|
|
7169
7017
|
}
|
|
7170
7018
|
);
|
|
@@ -7179,7 +7027,7 @@ function PlainTextarea({
|
|
|
7179
7027
|
onChange,
|
|
7180
7028
|
onSave
|
|
7181
7029
|
}) {
|
|
7182
|
-
return /* @__PURE__ */
|
|
7030
|
+
return /* @__PURE__ */ jsx8(
|
|
7183
7031
|
"textarea",
|
|
7184
7032
|
{
|
|
7185
7033
|
value,
|
|
@@ -7198,14 +7046,14 @@ function PlainTextarea({
|
|
|
7198
7046
|
);
|
|
7199
7047
|
}
|
|
7200
7048
|
function EditorSkeleton() {
|
|
7201
|
-
return /* @__PURE__ */
|
|
7049
|
+
return /* @__PURE__ */ jsx8("div", { className: "p-3 text-og-sm text-og-fg-subtle", children: "Loading editor\u2026" });
|
|
7202
7050
|
}
|
|
7203
7051
|
|
|
7204
7052
|
// src/components/sandbox-files.tsx
|
|
7205
7053
|
import { FileCode2Icon, FileWarningIcon as FileWarningIcon2, LoaderCircleIcon } from "lucide-react";
|
|
7206
|
-
import { useCallback as
|
|
7054
|
+
import { useCallback as useCallback22, useEffect as useEffect19, useRef as useRef16, useState as useState15 } from "react";
|
|
7207
7055
|
import { Group, Panel, Separator } from "react-resizable-panels";
|
|
7208
|
-
import { Fragment as
|
|
7056
|
+
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
7209
7057
|
function SandboxFiles({
|
|
7210
7058
|
files,
|
|
7211
7059
|
git,
|
|
@@ -7233,11 +7081,11 @@ function SandboxFiles({
|
|
|
7233
7081
|
const [treeRevealRequest, setTreeRevealRequest] = useState15(null);
|
|
7234
7082
|
const [liveRequestedPath, setLiveRequestedPath] = useState15(null);
|
|
7235
7083
|
const [viewReloadRevision, setViewReloadRevision] = useState15(0);
|
|
7236
|
-
const viewerScrollRef =
|
|
7237
|
-
const pendingRequestRef =
|
|
7238
|
-
const handledRequestRef =
|
|
7084
|
+
const viewerScrollRef = useRef16(null);
|
|
7085
|
+
const pendingRequestRef = useRef16(null);
|
|
7086
|
+
const handledRequestRef = useRef16(null);
|
|
7239
7087
|
const requestKey = requestedPath ? requestedPathRequestId ?? requestedPath : null;
|
|
7240
|
-
|
|
7088
|
+
useEffect19(() => {
|
|
7241
7089
|
if (!requestedPath || requestKey === null) {
|
|
7242
7090
|
pendingRequestRef.current = null;
|
|
7243
7091
|
handledRequestRef.current = null;
|
|
@@ -7283,9 +7131,9 @@ function SandboxFiles({
|
|
|
7283
7131
|
requestedPath,
|
|
7284
7132
|
requestedPathReady
|
|
7285
7133
|
]);
|
|
7286
|
-
const rootRef =
|
|
7134
|
+
const rootRef = useRef16(null);
|
|
7287
7135
|
const [wide, setWide] = useState15(false);
|
|
7288
|
-
|
|
7136
|
+
useEffect19(() => {
|
|
7289
7137
|
const el = rootRef.current;
|
|
7290
7138
|
if (!el) return;
|
|
7291
7139
|
const update = () => setWide(el.getBoundingClientRect().width >= 720);
|
|
@@ -7308,7 +7156,7 @@ function SandboxFiles({
|
|
|
7308
7156
|
const selectedVisibility = selected ? filePathVisibility(files.tree, selected, isNodeVisible) : "unknown";
|
|
7309
7157
|
const visibilityPending = Boolean(isNodeVisible && files.loading && files.tree.length === 0);
|
|
7310
7158
|
const viewPath = selectedVisibility === "hidden" || visibilityPending ? null : selected;
|
|
7311
|
-
|
|
7159
|
+
useEffect19(() => {
|
|
7312
7160
|
if (selected === null || selectedVisibility !== "hidden") return;
|
|
7313
7161
|
setSelected(null);
|
|
7314
7162
|
onSelectedPathChange?.(null);
|
|
@@ -7322,12 +7170,12 @@ function SandboxFiles({
|
|
|
7322
7170
|
files.readFile,
|
|
7323
7171
|
`${files.contentRevision ?? 0}:${viewReloadRevision}`
|
|
7324
7172
|
);
|
|
7325
|
-
|
|
7173
|
+
useEffect19(() => {
|
|
7326
7174
|
if (focusLine === null && viewReloadRevision > 0 && viewerScrollRef.current) {
|
|
7327
7175
|
viewerScrollRef.current.scrollTop = 0;
|
|
7328
7176
|
}
|
|
7329
7177
|
}, [focusLine, viewReloadRevision]);
|
|
7330
|
-
const selectFile =
|
|
7178
|
+
const selectFile = useCallback22(
|
|
7331
7179
|
(path) => {
|
|
7332
7180
|
if (pendingRequestRef.current !== null) {
|
|
7333
7181
|
handledRequestRef.current = pendingRequestRef.current;
|
|
@@ -7348,39 +7196,39 @@ function SandboxFiles({
|
|
|
7348
7196
|
const captureFileUnavailable = fileView.error instanceof CapturedFileUnavailableError ? fileView.error : null;
|
|
7349
7197
|
const waitingForSelectedFile = liveRequestedPath === viewPath && (!liveWorkspaceReady || files.loading) && captureFileUnavailable !== null;
|
|
7350
7198
|
if (workspaceResting || workspaceWaking) {
|
|
7351
|
-
return /* @__PURE__ */
|
|
7199
|
+
return /* @__PURE__ */ jsx9("div", { className: cn("h-full", className), "data-opengeni-workspace-resting": true, children: /* @__PURE__ */ jsxs7(
|
|
7352
7200
|
Notice,
|
|
7353
7201
|
{
|
|
7354
|
-
icon: workspaceWaking ? /* @__PURE__ */
|
|
7202
|
+
icon: workspaceWaking ? /* @__PURE__ */ jsx9(
|
|
7355
7203
|
LoaderCircleIcon,
|
|
7356
7204
|
{
|
|
7357
7205
|
className: "size-5 animate-spin motion-reduce:animate-none",
|
|
7358
7206
|
"aria-hidden": true
|
|
7359
7207
|
}
|
|
7360
|
-
) : /* @__PURE__ */
|
|
7208
|
+
) : /* @__PURE__ */ jsx9(FileCode2Icon, { className: "size-5", "aria-hidden": true }),
|
|
7361
7209
|
title: workspaceWaking ? "Waking workspace" : "Workspace is resting",
|
|
7362
7210
|
announce: "status",
|
|
7363
7211
|
children: [
|
|
7364
|
-
/* @__PURE__ */
|
|
7365
|
-
!workspaceWaking && onWakeWorkspace ? /* @__PURE__ */
|
|
7212
|
+
/* @__PURE__ */ jsx9("p", { children: workspaceWaking ? "Connecting to the live file system\u2026" : "No captured revision is available yet. Wake the sandbox to browse its current files." }),
|
|
7213
|
+
!workspaceWaking && onWakeWorkspace ? /* @__PURE__ */ jsx9(WakeButton, { onClick: onWakeWorkspace, children: "Open live workspace" }) : null
|
|
7366
7214
|
]
|
|
7367
7215
|
}
|
|
7368
7216
|
) });
|
|
7369
7217
|
}
|
|
7370
7218
|
if (!fileSystemAvailable) {
|
|
7371
|
-
return /* @__PURE__ */
|
|
7219
|
+
return /* @__PURE__ */ jsx9(
|
|
7372
7220
|
Notice,
|
|
7373
7221
|
{
|
|
7374
7222
|
className,
|
|
7375
|
-
icon: /* @__PURE__ */
|
|
7223
|
+
icon: /* @__PURE__ */ jsx9(FileWarningIcon2, { className: "size-5", "aria-hidden": true }),
|
|
7376
7224
|
title: "Files unavailable",
|
|
7377
7225
|
announce: "alert",
|
|
7378
7226
|
children: "This sandbox does not expose a file system."
|
|
7379
7227
|
}
|
|
7380
7228
|
);
|
|
7381
7229
|
}
|
|
7382
|
-
return /* @__PURE__ */
|
|
7383
|
-
/* @__PURE__ */
|
|
7230
|
+
return /* @__PURE__ */ jsxs7("div", { ref: rootRef, className: cn("flex h-full min-h-0 min-w-0 flex-col", className), children: [
|
|
7231
|
+
/* @__PURE__ */ jsx9(
|
|
7384
7232
|
GitHeader,
|
|
7385
7233
|
{
|
|
7386
7234
|
loading: Boolean(files.loading || files.gitLoading || files.source === null || git?.loading) && files.gitSummary === null,
|
|
@@ -7394,13 +7242,13 @@ function SandboxFiles({
|
|
|
7394
7242
|
}
|
|
7395
7243
|
}
|
|
7396
7244
|
),
|
|
7397
|
-
/* @__PURE__ */
|
|
7245
|
+
/* @__PURE__ */ jsxs7(
|
|
7398
7246
|
Group,
|
|
7399
7247
|
{
|
|
7400
7248
|
orientation: wide ? "horizontal" : "vertical",
|
|
7401
7249
|
className: cn("min-h-0 flex-1", wide ? "flex-row" : "flex-col"),
|
|
7402
7250
|
children: [
|
|
7403
|
-
/* @__PURE__ */
|
|
7251
|
+
/* @__PURE__ */ jsx9(
|
|
7404
7252
|
Panel,
|
|
7405
7253
|
{
|
|
7406
7254
|
id: "sandbox-files-tree",
|
|
@@ -7408,7 +7256,7 @@ function SandboxFiles({
|
|
|
7408
7256
|
minSize: wide ? "180px" : "120px",
|
|
7409
7257
|
maxSize: wide ? "60%" : "70%",
|
|
7410
7258
|
className: "flex min-h-0 min-w-0 flex-col",
|
|
7411
|
-
children: /* @__PURE__ */
|
|
7259
|
+
children: /* @__PURE__ */ jsx9(
|
|
7412
7260
|
FileBrowser,
|
|
7413
7261
|
{
|
|
7414
7262
|
result: files,
|
|
@@ -7426,7 +7274,7 @@ function SandboxFiles({
|
|
|
7426
7274
|
)
|
|
7427
7275
|
}
|
|
7428
7276
|
),
|
|
7429
|
-
/* @__PURE__ */
|
|
7277
|
+
/* @__PURE__ */ jsx9(
|
|
7430
7278
|
Separator,
|
|
7431
7279
|
{
|
|
7432
7280
|
"aria-label": "Resize file tree",
|
|
@@ -7438,15 +7286,15 @@ function SandboxFiles({
|
|
|
7438
7286
|
)
|
|
7439
7287
|
}
|
|
7440
7288
|
),
|
|
7441
|
-
/* @__PURE__ */
|
|
7289
|
+
/* @__PURE__ */ jsxs7(
|
|
7442
7290
|
Panel,
|
|
7443
7291
|
{
|
|
7444
7292
|
id: "sandbox-files-viewer",
|
|
7445
7293
|
minSize: wide ? "240px" : "160px",
|
|
7446
7294
|
className: cn("flex min-h-0 min-w-0 flex-col", !wide && "border-t border-og-border"),
|
|
7447
7295
|
children: [
|
|
7448
|
-
/* @__PURE__ */
|
|
7449
|
-
/* @__PURE__ */
|
|
7296
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex shrink-0 items-center justify-between gap-2 border-b border-og-border bg-og-surface-1 px-2 py-1", children: [
|
|
7297
|
+
/* @__PURE__ */ jsx9(
|
|
7450
7298
|
"span",
|
|
7451
7299
|
{
|
|
7452
7300
|
"data-opengeni-selected-file": true,
|
|
@@ -7454,7 +7302,7 @@ function SandboxFiles({
|
|
|
7454
7302
|
children: selected ? focusLine !== null ? `${selected}:${focusLine}` : selected : "No file selected"
|
|
7455
7303
|
}
|
|
7456
7304
|
),
|
|
7457
|
-
canEdit && /* @__PURE__ */
|
|
7305
|
+
canEdit && /* @__PURE__ */ jsx9(
|
|
7458
7306
|
Segmented,
|
|
7459
7307
|
{
|
|
7460
7308
|
options: [
|
|
@@ -7466,13 +7314,13 @@ function SandboxFiles({
|
|
|
7466
7314
|
}
|
|
7467
7315
|
)
|
|
7468
7316
|
] }),
|
|
7469
|
-
/* @__PURE__ */
|
|
7317
|
+
/* @__PURE__ */ jsx9(
|
|
7470
7318
|
"div",
|
|
7471
7319
|
{
|
|
7472
7320
|
ref: viewerScrollRef,
|
|
7473
7321
|
className: "min-h-0 flex-1 overflow-auto",
|
|
7474
7322
|
"data-opengeni-file-viewer-scroll": true,
|
|
7475
|
-
children: viewPath ? showEditor && fileView.content !== null ? /* @__PURE__ */
|
|
7323
|
+
children: viewPath ? showEditor && fileView.content !== null ? /* @__PURE__ */ jsx9(
|
|
7476
7324
|
CodeEditor,
|
|
7477
7325
|
{
|
|
7478
7326
|
path: viewPath,
|
|
@@ -7485,10 +7333,10 @@ function SandboxFiles({
|
|
|
7485
7333
|
className: "h-full"
|
|
7486
7334
|
},
|
|
7487
7335
|
viewPath
|
|
7488
|
-
) : waitingForSelectedFile ? /* @__PURE__ */
|
|
7336
|
+
) : waitingForSelectedFile ? /* @__PURE__ */ jsxs7(
|
|
7489
7337
|
Notice,
|
|
7490
7338
|
{
|
|
7491
|
-
icon: /* @__PURE__ */
|
|
7339
|
+
icon: /* @__PURE__ */ jsx9(
|
|
7492
7340
|
LoaderCircleIcon,
|
|
7493
7341
|
{
|
|
7494
7342
|
className: "size-5 animate-spin motion-reduce:animate-none",
|
|
@@ -7503,9 +7351,9 @@ function SandboxFiles({
|
|
|
7503
7351
|
" when the live file system is ready\u2026"
|
|
7504
7352
|
]
|
|
7505
7353
|
}
|
|
7506
|
-
) : captureFileUnavailable ? /* @__PURE__ */
|
|
7507
|
-
/* @__PURE__ */
|
|
7508
|
-
onWakeWorkspace ? /* @__PURE__ */
|
|
7354
|
+
) : captureFileUnavailable ? /* @__PURE__ */ jsxs7(Notice, { icon: /* @__PURE__ */ jsx9(FileCode2Icon, { className: "size-5", "aria-hidden": true }), title: "On machine", children: [
|
|
7355
|
+
/* @__PURE__ */ jsx9("p", { children: captureFileUnavailable.reason === "too-large" ? "This file is larger than the captured preview limit." : captureFileUnavailable.reason === "content-missing" ? "The captured copy is no longer available." : "This file was indexed, but it was not changed in the captured turn." }),
|
|
7356
|
+
onWakeWorkspace ? /* @__PURE__ */ jsx9(
|
|
7509
7357
|
WakeButton,
|
|
7510
7358
|
{
|
|
7511
7359
|
onClick: () => {
|
|
@@ -7516,54 +7364,54 @@ function SandboxFiles({
|
|
|
7516
7364
|
children: liveWorkspaceReady ? "Retry live file" : "Open live file"
|
|
7517
7365
|
}
|
|
7518
7366
|
) : null
|
|
7519
|
-
] }) : fileView.error ? /* @__PURE__ */
|
|
7367
|
+
] }) : fileView.error ? /* @__PURE__ */ jsxs7(Notice, { announce: "alert", children: [
|
|
7520
7368
|
"Could not open ",
|
|
7521
7369
|
viewPath,
|
|
7522
7370
|
": ",
|
|
7523
7371
|
fileView.error.message
|
|
7524
|
-
] }) : fileView.loading ? /* @__PURE__ */
|
|
7372
|
+
] }) : fileView.loading ? /* @__PURE__ */ jsxs7(Notice, { announce: "status", children: [
|
|
7525
7373
|
"Loading ",
|
|
7526
7374
|
viewPath,
|
|
7527
7375
|
"\u2026"
|
|
7528
|
-
] }) : fileView.isBinary ? /* @__PURE__ */
|
|
7376
|
+
] }) : fileView.isBinary ? /* @__PURE__ */ jsxs7(Notice, { children: [
|
|
7529
7377
|
viewPath,
|
|
7530
7378
|
" is a binary file (",
|
|
7531
7379
|
fileView.sizeBytes ?? 0,
|
|
7532
7380
|
" bytes)."
|
|
7533
|
-
] }) : fileView.content !== null ? /* @__PURE__ */
|
|
7534
|
-
fileView.truncated && /* @__PURE__ */
|
|
7381
|
+
] }) : fileView.content !== null ? /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
7382
|
+
fileView.truncated && /* @__PURE__ */ jsxs7("div", { className: "border-b border-og-border bg-og-surface-1 px-2 py-1 text-og-xs text-og-status-running", children: [
|
|
7535
7383
|
"Large file \u2014 showing a truncated preview (",
|
|
7536
7384
|
fileView.sizeBytes ?? 0,
|
|
7537
7385
|
" bytes loaded). Editing is disabled to avoid corrupting the file."
|
|
7538
7386
|
] }),
|
|
7539
|
-
usePierre && focusLine === null ? /* @__PURE__ */
|
|
7387
|
+
usePierre && focusLine === null ? /* @__PURE__ */ jsx9(
|
|
7540
7388
|
PierreFile,
|
|
7541
7389
|
{
|
|
7542
7390
|
path: viewPath,
|
|
7543
7391
|
contents: fileView.content,
|
|
7544
7392
|
themeType: resolvedTheme,
|
|
7545
|
-
fallback: /* @__PURE__ */
|
|
7393
|
+
fallback: /* @__PURE__ */ jsx9("pre", { className: "overflow-auto whitespace-pre p-2 font-og-mono text-og-sm text-og-fg", children: fileView.content }),
|
|
7546
7394
|
className: "p-1"
|
|
7547
7395
|
},
|
|
7548
7396
|
`${viewPath}:${viewReloadRevision}`
|
|
7549
|
-
) : focusLine !== null ? /* @__PURE__ */
|
|
7397
|
+
) : focusLine !== null ? /* @__PURE__ */ jsx9(
|
|
7550
7398
|
LineNumberedFile,
|
|
7551
7399
|
{
|
|
7552
7400
|
path: viewPath,
|
|
7553
7401
|
contents: fileView.content,
|
|
7554
7402
|
focusLine
|
|
7555
7403
|
}
|
|
7556
|
-
) : /* @__PURE__ */
|
|
7557
|
-
] }) : /* @__PURE__ */
|
|
7404
|
+
) : /* @__PURE__ */ jsx9("pre", { className: "overflow-auto whitespace-pre p-2 font-og-mono text-og-sm text-og-fg", children: fileView.content })
|
|
7405
|
+
] }) : /* @__PURE__ */ jsxs7(Notice, { announce: "status", children: [
|
|
7558
7406
|
"Loading ",
|
|
7559
7407
|
viewPath,
|
|
7560
7408
|
"\u2026"
|
|
7561
7409
|
] }) : (
|
|
7562
7410
|
// Nothing selected — the tree shows the whole workspace; pick a file.
|
|
7563
|
-
requestedPath && !requestedPathReady ? /* @__PURE__ */
|
|
7411
|
+
requestedPath && !requestedPathReady ? /* @__PURE__ */ jsxs7(
|
|
7564
7412
|
Notice,
|
|
7565
7413
|
{
|
|
7566
|
-
icon: /* @__PURE__ */
|
|
7414
|
+
icon: /* @__PURE__ */ jsx9(
|
|
7567
7415
|
LoaderCircleIcon,
|
|
7568
7416
|
{
|
|
7569
7417
|
className: "size-5 animate-spin motion-reduce:animate-none",
|
|
@@ -7578,7 +7426,7 @@ function SandboxFiles({
|
|
|
7578
7426
|
" when the live workspace is ready\u2026"
|
|
7579
7427
|
]
|
|
7580
7428
|
}
|
|
7581
|
-
) : /* @__PURE__ */
|
|
7429
|
+
) : /* @__PURE__ */ jsx9(Notice, { icon: /* @__PURE__ */ jsx9(FileCode2Icon, { className: "size-5", "aria-hidden": true }), title: "Choose a file", children: "Select a file in the tree to preview it." })
|
|
7582
7430
|
)
|
|
7583
7431
|
}
|
|
7584
7432
|
)
|
|
@@ -7591,7 +7439,7 @@ function SandboxFiles({
|
|
|
7591
7439
|
] });
|
|
7592
7440
|
}
|
|
7593
7441
|
function WakeButton({ children, onClick }) {
|
|
7594
|
-
return /* @__PURE__ */
|
|
7442
|
+
return /* @__PURE__ */ jsx9(
|
|
7595
7443
|
"button",
|
|
7596
7444
|
{
|
|
7597
7445
|
type: "button",
|
|
@@ -7608,21 +7456,21 @@ function LineNumberedFile({
|
|
|
7608
7456
|
}) {
|
|
7609
7457
|
const lines = contents.split("\n");
|
|
7610
7458
|
const inRange = focusLine >= 1 && focusLine <= lines.length;
|
|
7611
|
-
const targetRef =
|
|
7612
|
-
|
|
7459
|
+
const targetRef = useRef16(null);
|
|
7460
|
+
useEffect19(() => {
|
|
7613
7461
|
targetRef.current?.scrollIntoView({
|
|
7614
7462
|
block: "center",
|
|
7615
7463
|
behavior: prefersReducedMotion() ? "auto" : "smooth"
|
|
7616
7464
|
});
|
|
7617
7465
|
}, [path, focusLine, contents]);
|
|
7618
|
-
return /* @__PURE__ */
|
|
7466
|
+
return /* @__PURE__ */ jsxs7(
|
|
7619
7467
|
"div",
|
|
7620
7468
|
{
|
|
7621
7469
|
className: "h-full min-h-0 overflow-auto font-og-mono text-og-sm text-og-fg",
|
|
7622
7470
|
role: "region",
|
|
7623
7471
|
"aria-label": inRange ? `${path} at line ${focusLine}` : path,
|
|
7624
7472
|
children: [
|
|
7625
|
-
!inRange ? /* @__PURE__ */
|
|
7473
|
+
!inRange ? /* @__PURE__ */ jsxs7(
|
|
7626
7474
|
"p",
|
|
7627
7475
|
{
|
|
7628
7476
|
className: "border-b border-og-border bg-og-surface-1 px-2 py-1 text-og-xs text-og-fg-muted",
|
|
@@ -7634,10 +7482,10 @@ function LineNumberedFile({
|
|
|
7634
7482
|
]
|
|
7635
7483
|
}
|
|
7636
7484
|
) : null,
|
|
7637
|
-
/* @__PURE__ */
|
|
7485
|
+
/* @__PURE__ */ jsx9("div", { children: lines.map((text, index) => {
|
|
7638
7486
|
const lineNumber = index + 1;
|
|
7639
7487
|
const focused = inRange && lineNumber === focusLine;
|
|
7640
|
-
return /* @__PURE__ */
|
|
7488
|
+
return /* @__PURE__ */ jsxs7(
|
|
7641
7489
|
"div",
|
|
7642
7490
|
{
|
|
7643
7491
|
ref: focused ? targetRef : void 0,
|
|
@@ -7646,8 +7494,8 @@ function LineNumberedFile({
|
|
|
7646
7494
|
"aria-current": focused ? "location" : void 0,
|
|
7647
7495
|
className: cn("flex gap-3 px-2 py-0.5 leading-6", focused && "bg-og-accent-soft"),
|
|
7648
7496
|
children: [
|
|
7649
|
-
/* @__PURE__ */
|
|
7650
|
-
/* @__PURE__ */
|
|
7497
|
+
/* @__PURE__ */ jsx9("span", { className: "w-11 shrink-0 select-none text-right tabular-nums text-og-fg-subtle", children: lineNumber }),
|
|
7498
|
+
/* @__PURE__ */ jsx9("pre", { className: "min-w-0 flex-1 whitespace-pre-wrap break-words", children: text || " " })
|
|
7651
7499
|
]
|
|
7652
7500
|
},
|
|
7653
7501
|
lineNumber
|
|
@@ -7659,28 +7507,28 @@ function LineNumberedFile({
|
|
|
7659
7507
|
}
|
|
7660
7508
|
function GitHeader({ git, loading }) {
|
|
7661
7509
|
if (loading) {
|
|
7662
|
-
return /* @__PURE__ */
|
|
7510
|
+
return /* @__PURE__ */ jsxs7(
|
|
7663
7511
|
"div",
|
|
7664
7512
|
{
|
|
7665
7513
|
className: "flex shrink-0 items-center gap-2 border-b border-og-border bg-og-surface-1 px-2 py-1 text-og-sm text-og-fg-muted",
|
|
7666
7514
|
role: "status",
|
|
7667
7515
|
"aria-live": "polite",
|
|
7668
7516
|
children: [
|
|
7669
|
-
/* @__PURE__ */
|
|
7517
|
+
/* @__PURE__ */ jsx9(
|
|
7670
7518
|
LoaderCircleIcon,
|
|
7671
7519
|
{
|
|
7672
7520
|
className: "size-3.5 shrink-0 animate-spin motion-reduce:animate-none",
|
|
7673
7521
|
"aria-hidden": true
|
|
7674
7522
|
}
|
|
7675
7523
|
),
|
|
7676
|
-
/* @__PURE__ */
|
|
7524
|
+
/* @__PURE__ */ jsx9("span", { children: "Loading repository\u2026" })
|
|
7677
7525
|
]
|
|
7678
7526
|
}
|
|
7679
7527
|
);
|
|
7680
7528
|
}
|
|
7681
7529
|
const dirty = git.dirtyCount > 0;
|
|
7682
|
-
return /* @__PURE__ */
|
|
7683
|
-
/* @__PURE__ */
|
|
7530
|
+
return /* @__PURE__ */ jsxs7("div", { className: "flex shrink-0 items-center gap-2 border-b border-og-border bg-og-surface-1 px-2 py-1 text-og-sm", children: [
|
|
7531
|
+
/* @__PURE__ */ jsx9(
|
|
7684
7532
|
"span",
|
|
7685
7533
|
{
|
|
7686
7534
|
"aria-hidden": "true",
|
|
@@ -7690,19 +7538,19 @@ function GitHeader({ git, loading }) {
|
|
|
7690
7538
|
)
|
|
7691
7539
|
}
|
|
7692
7540
|
),
|
|
7693
|
-
/* @__PURE__ */
|
|
7694
|
-
/* @__PURE__ */
|
|
7695
|
-
(git.ahead > 0 || git.behind > 0) && /* @__PURE__ */
|
|
7696
|
-
git.ahead > 0 && /* @__PURE__ */
|
|
7541
|
+
/* @__PURE__ */ jsx9("span", { className: "sr-only", children: dirty ? `Uncommitted changes in ${git.dirtyCount} files` : "No uncommitted changes" }),
|
|
7542
|
+
/* @__PURE__ */ jsx9("span", { className: "truncate font-og-mono text-og-fg", children: git.repoCount > 1 ? `${git.repoCount} repositories` : git.branch ?? (git.isRepo ? "(detached)" : "no repo") }),
|
|
7543
|
+
(git.ahead > 0 || git.behind > 0) && /* @__PURE__ */ jsxs7("span", { className: "flex shrink-0 items-center gap-1.5 text-og-xs text-og-fg-subtle", children: [
|
|
7544
|
+
git.ahead > 0 && /* @__PURE__ */ jsxs7("span", { children: [
|
|
7697
7545
|
"\u2191",
|
|
7698
7546
|
git.ahead
|
|
7699
7547
|
] }),
|
|
7700
|
-
git.behind > 0 && /* @__PURE__ */
|
|
7548
|
+
git.behind > 0 && /* @__PURE__ */ jsxs7("span", { children: [
|
|
7701
7549
|
"\u2193",
|
|
7702
7550
|
git.behind
|
|
7703
7551
|
] })
|
|
7704
7552
|
] }),
|
|
7705
|
-
dirty && /* @__PURE__ */
|
|
7553
|
+
dirty && /* @__PURE__ */ jsxs7(
|
|
7706
7554
|
"span",
|
|
7707
7555
|
{
|
|
7708
7556
|
"aria-hidden": "true",
|
|
@@ -7721,7 +7569,7 @@ function Segmented({
|
|
|
7721
7569
|
value,
|
|
7722
7570
|
onChange
|
|
7723
7571
|
}) {
|
|
7724
|
-
return /* @__PURE__ */
|
|
7572
|
+
return /* @__PURE__ */ jsx9("div", { className: "flex flex-wrap items-center rounded-og-sm border border-og-border p-0.5", children: options.map((opt) => /* @__PURE__ */ jsx9(
|
|
7725
7573
|
"button",
|
|
7726
7574
|
{
|
|
7727
7575
|
type: "button",
|
|
@@ -7736,7 +7584,7 @@ function Segmented({
|
|
|
7736
7584
|
)) });
|
|
7737
7585
|
}
|
|
7738
7586
|
function useFileView(path, readFile, reloadRevision = 0) {
|
|
7739
|
-
const previousPathRef =
|
|
7587
|
+
const previousPathRef = useRef16(null);
|
|
7740
7588
|
const [state, setState] = useState15({
|
|
7741
7589
|
content: null,
|
|
7742
7590
|
isBinary: false,
|
|
@@ -7745,7 +7593,7 @@ function useFileView(path, readFile, reloadRevision = 0) {
|
|
|
7745
7593
|
loading: false,
|
|
7746
7594
|
error: null
|
|
7747
7595
|
});
|
|
7748
|
-
|
|
7596
|
+
useEffect19(() => {
|
|
7749
7597
|
if (!path) {
|
|
7750
7598
|
previousPathRef.current = null;
|
|
7751
7599
|
setState({
|
|
@@ -7825,7 +7673,7 @@ function Notice({
|
|
|
7825
7673
|
title,
|
|
7826
7674
|
announce
|
|
7827
7675
|
}) {
|
|
7828
|
-
return /* @__PURE__ */
|
|
7676
|
+
return /* @__PURE__ */ jsx9(
|
|
7829
7677
|
"div",
|
|
7830
7678
|
{
|
|
7831
7679
|
role: announce,
|
|
@@ -7835,10 +7683,10 @@ function Notice({
|
|
|
7835
7683
|
"flex h-full items-center justify-center p-4 text-center text-og-sm text-og-fg-subtle",
|
|
7836
7684
|
className
|
|
7837
7685
|
),
|
|
7838
|
-
children: /* @__PURE__ */
|
|
7839
|
-
icon ? /* @__PURE__ */
|
|
7840
|
-
title ? /* @__PURE__ */
|
|
7841
|
-
/* @__PURE__ */
|
|
7686
|
+
children: /* @__PURE__ */ jsxs7("div", { className: "flex max-w-sm flex-col items-center gap-2.5", children: [
|
|
7687
|
+
icon ? /* @__PURE__ */ jsx9("span", { className: "grid size-10 place-items-center rounded-og-lg border border-og-border bg-og-surface-1 text-og-fg-muted shadow-sm", children: icon }) : null,
|
|
7688
|
+
title ? /* @__PURE__ */ jsx9("p", { className: "font-medium text-og-fg", children: title }) : null,
|
|
7689
|
+
/* @__PURE__ */ jsx9("div", { "data-contrast-audited": true, className: "leading-5", children })
|
|
7842
7690
|
] })
|
|
7843
7691
|
}
|
|
7844
7692
|
);
|
|
@@ -7846,11 +7694,11 @@ function Notice({
|
|
|
7846
7694
|
|
|
7847
7695
|
// src/components/workspace-dock.tsx
|
|
7848
7696
|
import {
|
|
7849
|
-
useCallback as
|
|
7850
|
-
useEffect as
|
|
7697
|
+
useCallback as useCallback23,
|
|
7698
|
+
useEffect as useEffect20,
|
|
7851
7699
|
useId as useId4,
|
|
7852
7700
|
useLayoutEffect as useLayoutEffect4,
|
|
7853
|
-
useRef as
|
|
7701
|
+
useRef as useRef17,
|
|
7854
7702
|
useState as useState16
|
|
7855
7703
|
} from "react";
|
|
7856
7704
|
import {
|
|
@@ -7867,7 +7715,7 @@ import {
|
|
|
7867
7715
|
useDefaultLayout,
|
|
7868
7716
|
usePanelRef
|
|
7869
7717
|
} from "react-resizable-panels";
|
|
7870
|
-
import { Fragment as
|
|
7718
|
+
import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
7871
7719
|
var SERVER_LAYOUT_STORAGE = {
|
|
7872
7720
|
getItem: () => null,
|
|
7873
7721
|
setItem: () => {
|
|
@@ -7881,7 +7729,7 @@ function getLayoutStorage() {
|
|
|
7881
7729
|
return SERVER_LAYOUT_STORAGE;
|
|
7882
7730
|
}
|
|
7883
7731
|
}
|
|
7884
|
-
var useDockLayoutEffect = typeof window === "undefined" ?
|
|
7732
|
+
var useDockLayoutEffect = typeof window === "undefined" ? useEffect20 : useLayoutEffect4;
|
|
7885
7733
|
var DOCK_OVERLAY_BREAKPOINT = 1024;
|
|
7886
7734
|
function useIsNarrow(maxWidth) {
|
|
7887
7735
|
const [narrow, setNarrow] = useState16(false);
|
|
@@ -7918,30 +7766,30 @@ function WorkspaceDock({
|
|
|
7918
7766
|
className
|
|
7919
7767
|
}) {
|
|
7920
7768
|
const narrow = useIsNarrow(DOCK_OVERLAY_BREAKPOINT);
|
|
7921
|
-
const rootRef =
|
|
7922
|
-
const reopenRef =
|
|
7923
|
-
const returnFocusRef =
|
|
7924
|
-
const initialNarrowFocusRef =
|
|
7769
|
+
const rootRef = useRef17(null);
|
|
7770
|
+
const reopenRef = useRef17(null);
|
|
7771
|
+
const returnFocusRef = useRef17(null);
|
|
7772
|
+
const initialNarrowFocusRef = useRef17(false);
|
|
7925
7773
|
const dockPanelRef = usePanelRef();
|
|
7926
7774
|
const [internalCollapsed, setInternalCollapsed] = useState16(false);
|
|
7927
7775
|
const [maximized, setMaximized] = useState16(false);
|
|
7928
7776
|
const [internalTab, setInternalTab] = useState16(tabs[0]?.id ?? "");
|
|
7929
7777
|
const collapsed = collapsedProp ?? internalCollapsed;
|
|
7930
7778
|
const hostControlled = collapsedProp !== void 0;
|
|
7931
|
-
const previousCollapsedRef =
|
|
7779
|
+
const previousCollapsedRef = useRef17(collapsed);
|
|
7932
7780
|
const { defaultLayout, onLayoutChanged } = useDefaultLayout({
|
|
7933
7781
|
panelIds: ["primary", "dock"],
|
|
7934
7782
|
storage: getLayoutStorage(),
|
|
7935
7783
|
id: autoSaveId
|
|
7936
7784
|
});
|
|
7937
7785
|
const expandedDefaultLayout = defaultLayout && (defaultLayout.dock ?? 0) > 1 ? defaultLayout : void 0;
|
|
7938
|
-
const lastExpandedSizeRef =
|
|
7939
|
-
const layoutIdentityRef =
|
|
7786
|
+
const lastExpandedSizeRef = useRef17(expandedDefaultLayout?.dock ?? defaultSize);
|
|
7787
|
+
const layoutIdentityRef = useRef17(autoSaveId);
|
|
7940
7788
|
if (layoutIdentityRef.current !== autoSaveId) {
|
|
7941
7789
|
layoutIdentityRef.current = autoSaveId;
|
|
7942
7790
|
lastExpandedSizeRef.current = expandedDefaultLayout?.dock ?? defaultSize;
|
|
7943
7791
|
}
|
|
7944
|
-
const persistExpandedLayout =
|
|
7792
|
+
const persistExpandedLayout = useCallback23(
|
|
7945
7793
|
(layout, meta) => {
|
|
7946
7794
|
const dockSize = layout.dock ?? 0;
|
|
7947
7795
|
if (dockSize <= 1) return;
|
|
@@ -7955,14 +7803,14 @@ function WorkspaceDock({
|
|
|
7955
7803
|
const firstTabId = tabs[0]?.id ?? "";
|
|
7956
7804
|
const requestedTabIsValid = tabIds.includes(requestedTab);
|
|
7957
7805
|
const current = requestedTabIsValid ? requestedTab : firstTabId;
|
|
7958
|
-
const setTab =
|
|
7806
|
+
const setTab = useCallback23(
|
|
7959
7807
|
(id) => {
|
|
7960
7808
|
setInternalTab(id);
|
|
7961
7809
|
onActiveTabChange?.(id);
|
|
7962
7810
|
},
|
|
7963
7811
|
[onActiveTabChange]
|
|
7964
7812
|
);
|
|
7965
|
-
const setCollapsed =
|
|
7813
|
+
const setCollapsed = useCallback23(
|
|
7966
7814
|
(next) => {
|
|
7967
7815
|
setInternalCollapsed((previous) => previous === next ? previous : next);
|
|
7968
7816
|
onCollapsedChange?.(next);
|
|
@@ -7980,7 +7828,7 @@ function WorkspaceDock({
|
|
|
7980
7828
|
dockPanelRef.current?.resize(`${lastExpandedSizeRef.current}%`);
|
|
7981
7829
|
}
|
|
7982
7830
|
}, [collapsedProp, dockPanelRef]);
|
|
7983
|
-
|
|
7831
|
+
useEffect20(() => {
|
|
7984
7832
|
const previous = previousCollapsedRef.current;
|
|
7985
7833
|
previousCollapsedRef.current = collapsed;
|
|
7986
7834
|
if (previous === collapsed) return;
|
|
@@ -8016,7 +7864,7 @@ function WorkspaceDock({
|
|
|
8016
7864
|
});
|
|
8017
7865
|
return () => cancelAnimationFrame(frame);
|
|
8018
7866
|
}, [collapsed, hostControlled, narrow]);
|
|
8019
|
-
|
|
7867
|
+
useEffect20(() => {
|
|
8020
7868
|
if (!narrow || collapsed || initialNarrowFocusRef.current) return;
|
|
8021
7869
|
initialNarrowFocusRef.current = true;
|
|
8022
7870
|
const active = document.activeElement;
|
|
@@ -8029,20 +7877,20 @@ function WorkspaceDock({
|
|
|
8029
7877
|
});
|
|
8030
7878
|
return () => cancelAnimationFrame(frame);
|
|
8031
7879
|
}, [collapsed, narrow]);
|
|
8032
|
-
|
|
7880
|
+
useEffect20(() => {
|
|
8033
7881
|
if (firstTabId && !requestedTabIsValid) {
|
|
8034
7882
|
setTab(firstTabId);
|
|
8035
7883
|
}
|
|
8036
7884
|
}, [firstTabId, requestedTabIsValid, setTab]);
|
|
8037
|
-
const collapse =
|
|
7885
|
+
const collapse = useCallback23(() => {
|
|
8038
7886
|
dockPanelRef.current?.collapse();
|
|
8039
7887
|
setCollapsed(true);
|
|
8040
7888
|
}, [dockPanelRef, setCollapsed]);
|
|
8041
|
-
const expand =
|
|
7889
|
+
const expand = useCallback23(() => {
|
|
8042
7890
|
dockPanelRef.current?.expand();
|
|
8043
7891
|
setCollapsed(false);
|
|
8044
7892
|
}, [dockPanelRef, setCollapsed]);
|
|
8045
|
-
|
|
7893
|
+
useEffect20(() => {
|
|
8046
7894
|
const overlayOpen = maximized || narrow && !collapsed;
|
|
8047
7895
|
if (!overlayOpen) return;
|
|
8048
7896
|
const onKey = (event) => {
|
|
@@ -8086,8 +7934,8 @@ function WorkspaceDock({
|
|
|
8086
7934
|
return () => window.removeEventListener("keydown", onKey);
|
|
8087
7935
|
}, [maximized, narrow, collapsed, collapse]);
|
|
8088
7936
|
if (narrow) {
|
|
8089
|
-
return /* @__PURE__ */
|
|
8090
|
-
/* @__PURE__ */
|
|
7937
|
+
return /* @__PURE__ */ jsxs8("div", { ref: rootRef, className: cn("relative flex h-full min-h-0 w-full min-w-0", className), children: [
|
|
7938
|
+
/* @__PURE__ */ jsx10(
|
|
8091
7939
|
"div",
|
|
8092
7940
|
{
|
|
8093
7941
|
"data-workspace-primary": true,
|
|
@@ -8097,7 +7945,7 @@ function WorkspaceDock({
|
|
|
8097
7945
|
children: primary
|
|
8098
7946
|
}
|
|
8099
7947
|
),
|
|
8100
|
-
/* @__PURE__ */
|
|
7948
|
+
/* @__PURE__ */ jsx10(
|
|
8101
7949
|
"div",
|
|
8102
7950
|
{
|
|
8103
7951
|
"data-workspace-surface": true,
|
|
@@ -8115,7 +7963,7 @@ function WorkspaceDock({
|
|
|
8115
7963
|
paddingTop: "env(safe-area-inset-top)",
|
|
8116
7964
|
paddingBottom: "env(safe-area-inset-bottom)"
|
|
8117
7965
|
},
|
|
8118
|
-
children: /* @__PURE__ */
|
|
7966
|
+
children: /* @__PURE__ */ jsx10(
|
|
8119
7967
|
DockChrome,
|
|
8120
7968
|
{
|
|
8121
7969
|
tabs,
|
|
@@ -8123,12 +7971,12 @@ function WorkspaceDock({
|
|
|
8123
7971
|
onTab: setTab,
|
|
8124
7972
|
leading: mobileLeadingControl,
|
|
8125
7973
|
accessory: headerAccessory,
|
|
8126
|
-
controls: /* @__PURE__ */
|
|
7974
|
+
controls: /* @__PURE__ */ jsx10(ChromeButton, { onClick: collapse, title: "Hide workspace", label: "Hide workspace", children: /* @__PURE__ */ jsx10(XIcon2, { className: "size-4" }) })
|
|
8127
7975
|
}
|
|
8128
7976
|
)
|
|
8129
7977
|
}
|
|
8130
7978
|
),
|
|
8131
|
-
collapsed && !hostControlled ? /* @__PURE__ */
|
|
7979
|
+
collapsed && !hostControlled ? /* @__PURE__ */ jsx10(
|
|
8132
7980
|
"button",
|
|
8133
7981
|
{
|
|
8134
7982
|
ref: reopenRef,
|
|
@@ -8138,34 +7986,34 @@ function WorkspaceDock({
|
|
|
8138
7986
|
"aria-label": "Open workspace",
|
|
8139
7987
|
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",
|
|
8140
7988
|
style: { marginTop: "env(safe-area-inset-top)" },
|
|
8141
|
-
children: /* @__PURE__ */
|
|
7989
|
+
children: /* @__PURE__ */ jsx10(ChevronsLeftRightIcon, { className: "size-4", "aria-hidden": true })
|
|
8142
7990
|
}
|
|
8143
7991
|
) : null
|
|
8144
7992
|
] });
|
|
8145
7993
|
}
|
|
8146
|
-
const dockChrome = /* @__PURE__ */
|
|
7994
|
+
const dockChrome = /* @__PURE__ */ jsx10(
|
|
8147
7995
|
DockChrome,
|
|
8148
7996
|
{
|
|
8149
7997
|
tabs,
|
|
8150
7998
|
current,
|
|
8151
7999
|
onTab: setTab,
|
|
8152
8000
|
accessory: headerAccessory,
|
|
8153
|
-
controls: /* @__PURE__ */
|
|
8154
|
-
/* @__PURE__ */
|
|
8001
|
+
controls: /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
8002
|
+
/* @__PURE__ */ jsx10(
|
|
8155
8003
|
ChromeButton,
|
|
8156
8004
|
{
|
|
8157
8005
|
onClick: () => setMaximized((m) => !m),
|
|
8158
8006
|
title: maximized ? "Restore (Esc)" : "Maximize",
|
|
8159
8007
|
label: maximized ? "Restore dock" : "Maximize dock",
|
|
8160
|
-
children: maximized ? /* @__PURE__ */
|
|
8008
|
+
children: maximized ? /* @__PURE__ */ jsx10(Minimize2Icon, { className: "size-3.5" }) : /* @__PURE__ */ jsx10(Maximize2Icon, { className: "size-3.5" })
|
|
8161
8009
|
}
|
|
8162
8010
|
),
|
|
8163
|
-
hostControlled && !showCollapseControl ? null : /* @__PURE__ */
|
|
8011
|
+
hostControlled && !showCollapseControl ? null : /* @__PURE__ */ jsx10(ChromeButton, { onClick: collapse, title: "Hide workspace", label: "Hide workspace", children: /* @__PURE__ */ jsx10(PanelRightCloseIcon, { className: "size-3.5" }) })
|
|
8164
8012
|
] })
|
|
8165
8013
|
}
|
|
8166
8014
|
);
|
|
8167
|
-
return /* @__PURE__ */
|
|
8168
|
-
/* @__PURE__ */
|
|
8015
|
+
return /* @__PURE__ */ jsxs8("div", { ref: rootRef, className: cn("relative flex h-full min-h-0 w-full min-w-0", className), children: [
|
|
8016
|
+
/* @__PURE__ */ jsxs8(
|
|
8169
8017
|
Group2,
|
|
8170
8018
|
{
|
|
8171
8019
|
orientation: "horizontal",
|
|
@@ -8173,7 +8021,7 @@ function WorkspaceDock({
|
|
|
8173
8021
|
...expandedDefaultLayout ? { defaultLayout: expandedDefaultLayout } : {},
|
|
8174
8022
|
onLayoutChanged: persistExpandedLayout,
|
|
8175
8023
|
children: [
|
|
8176
|
-
/* @__PURE__ */
|
|
8024
|
+
/* @__PURE__ */ jsx10(Panel2, { id: "primary", minSize: "30%", className: "min-h-0 min-w-0", children: /* @__PURE__ */ jsx10(
|
|
8177
8025
|
"div",
|
|
8178
8026
|
{
|
|
8179
8027
|
"data-workspace-primary": true,
|
|
@@ -8183,8 +8031,8 @@ function WorkspaceDock({
|
|
|
8183
8031
|
children: primary
|
|
8184
8032
|
}
|
|
8185
8033
|
) }),
|
|
8186
|
-
!collapsed && /* @__PURE__ */
|
|
8187
|
-
/* @__PURE__ */
|
|
8034
|
+
!collapsed && /* @__PURE__ */ jsx10(Separator2, { 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__ */ jsx10("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" }) }),
|
|
8035
|
+
/* @__PURE__ */ jsx10(
|
|
8188
8036
|
Panel2,
|
|
8189
8037
|
{
|
|
8190
8038
|
id: "dock",
|
|
@@ -8202,7 +8050,7 @@ function WorkspaceDock({
|
|
|
8202
8050
|
}
|
|
8203
8051
|
},
|
|
8204
8052
|
className: "min-h-0 min-w-0",
|
|
8205
|
-
children: /* @__PURE__ */
|
|
8053
|
+
children: /* @__PURE__ */ jsx10(
|
|
8206
8054
|
"div",
|
|
8207
8055
|
{
|
|
8208
8056
|
"data-workspace-surface": true,
|
|
@@ -8223,7 +8071,7 @@ function WorkspaceDock({
|
|
|
8223
8071
|
]
|
|
8224
8072
|
}
|
|
8225
8073
|
),
|
|
8226
|
-
collapsed && !maximized && !hostControlled && /* @__PURE__ */
|
|
8074
|
+
collapsed && !maximized && !hostControlled && /* @__PURE__ */ jsx10(
|
|
8227
8075
|
"button",
|
|
8228
8076
|
{
|
|
8229
8077
|
ref: reopenRef,
|
|
@@ -8231,7 +8079,7 @@ function WorkspaceDock({
|
|
|
8231
8079
|
onClick: expand,
|
|
8232
8080
|
title: "Open workspace",
|
|
8233
8081
|
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",
|
|
8234
|
-
children: /* @__PURE__ */
|
|
8082
|
+
children: /* @__PURE__ */ jsx10(ChevronsLeftRightIcon, { className: "size-3.5" })
|
|
8235
8083
|
}
|
|
8236
8084
|
)
|
|
8237
8085
|
] });
|
|
@@ -8242,7 +8090,7 @@ function ChromeButton({
|
|
|
8242
8090
|
label,
|
|
8243
8091
|
children
|
|
8244
8092
|
}) {
|
|
8245
|
-
return /* @__PURE__ */
|
|
8093
|
+
return /* @__PURE__ */ jsx10(
|
|
8246
8094
|
"button",
|
|
8247
8095
|
{
|
|
8248
8096
|
type: "button",
|
|
@@ -8262,11 +8110,11 @@ function DockChrome({
|
|
|
8262
8110
|
accessory,
|
|
8263
8111
|
controls
|
|
8264
8112
|
}) {
|
|
8265
|
-
const chromeRef =
|
|
8113
|
+
const chromeRef = useRef17(null);
|
|
8266
8114
|
const [compact, setCompact] = useState16(false);
|
|
8267
8115
|
const active = tabs.find((t) => t.id === current) ?? tabs[0];
|
|
8268
8116
|
const tabsetId = useId4();
|
|
8269
|
-
const tabRefs =
|
|
8117
|
+
const tabRefs = useRef17([]);
|
|
8270
8118
|
const [visitedTabs, setVisitedTabs] = useState16(() => /* @__PURE__ */ new Set());
|
|
8271
8119
|
const activeId = active?.id ?? "";
|
|
8272
8120
|
useDockLayoutEffect(() => {
|
|
@@ -8286,7 +8134,7 @@ function DockChrome({
|
|
|
8286
8134
|
observer.observe(node);
|
|
8287
8135
|
return () => observer.disconnect();
|
|
8288
8136
|
}, []);
|
|
8289
|
-
|
|
8137
|
+
useEffect20(() => {
|
|
8290
8138
|
if (!activeId) return;
|
|
8291
8139
|
setVisitedTabs((previous) => {
|
|
8292
8140
|
if (previous.has(activeId)) return previous;
|
|
@@ -8314,7 +8162,7 @@ function DockChrome({
|
|
|
8314
8162
|
event.preventDefault();
|
|
8315
8163
|
activateTab(nextIndex);
|
|
8316
8164
|
};
|
|
8317
|
-
return /* @__PURE__ */
|
|
8165
|
+
return /* @__PURE__ */ jsxs8(
|
|
8318
8166
|
"div",
|
|
8319
8167
|
{
|
|
8320
8168
|
ref: chromeRef,
|
|
@@ -8322,13 +8170,13 @@ function DockChrome({
|
|
|
8322
8170
|
"data-compact": compact ? "true" : void 0,
|
|
8323
8171
|
className: "flex h-full min-h-0 min-w-0 flex-col",
|
|
8324
8172
|
children: [
|
|
8325
|
-
/* @__PURE__ */
|
|
8326
|
-
/* @__PURE__ */
|
|
8327
|
-
/* @__PURE__ */
|
|
8328
|
-
/* @__PURE__ */
|
|
8173
|
+
/* @__PURE__ */ jsxs8("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: [
|
|
8174
|
+
/* @__PURE__ */ jsx10("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: leading ?? /* @__PURE__ */ jsx10("span", { className: "hidden truncate text-og-sm font-semibold text-og-fg max-[1023px]:inline", children: "Workspace" }) }),
|
|
8175
|
+
/* @__PURE__ */ jsx10("div", { className: "min-w-0 shrink text-og-fg-muted", children: accessory }),
|
|
8176
|
+
/* @__PURE__ */ jsx10("div", { className: "flex shrink-0 items-center gap-0.5 text-og-fg-subtle", children: controls })
|
|
8329
8177
|
] }),
|
|
8330
|
-
/* @__PURE__ */
|
|
8331
|
-
/* @__PURE__ */
|
|
8178
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex min-h-0 min-w-0 flex-1", children: [
|
|
8179
|
+
/* @__PURE__ */ jsx10(
|
|
8332
8180
|
"div",
|
|
8333
8181
|
{
|
|
8334
8182
|
className: cn(
|
|
@@ -8340,7 +8188,7 @@ function DockChrome({
|
|
|
8340
8188
|
"aria-orientation": "vertical",
|
|
8341
8189
|
children: tabs.map((tab, index) => {
|
|
8342
8190
|
const tabName = tab.ariaLabel ?? (typeof tab.label === "string" ? tab.label : tab.id);
|
|
8343
|
-
return /* @__PURE__ */
|
|
8191
|
+
return /* @__PURE__ */ jsxs8(
|
|
8344
8192
|
"button",
|
|
8345
8193
|
{
|
|
8346
8194
|
ref: (node) => {
|
|
@@ -8362,7 +8210,7 @@ function DockChrome({
|
|
|
8362
8210
|
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"
|
|
8363
8211
|
),
|
|
8364
8212
|
children: [
|
|
8365
|
-
tab.icon ? /* @__PURE__ */
|
|
8213
|
+
tab.icon ? /* @__PURE__ */ jsx10(
|
|
8366
8214
|
"span",
|
|
8367
8215
|
{
|
|
8368
8216
|
className: "flex size-4 shrink-0 items-center justify-center [&>svg]:size-4",
|
|
@@ -8370,8 +8218,8 @@ function DockChrome({
|
|
|
8370
8218
|
children: tab.icon
|
|
8371
8219
|
}
|
|
8372
8220
|
) : null,
|
|
8373
|
-
!compact || !tab.icon ? /* @__PURE__ */
|
|
8374
|
-
tab.badge ? /* @__PURE__ */
|
|
8221
|
+
!compact || !tab.icon ? /* @__PURE__ */ jsx10("span", { "data-contrast-audited": true, className: "min-w-0 flex-1 truncate", children: tab.label }) : null,
|
|
8222
|
+
tab.badge ? /* @__PURE__ */ jsx10(
|
|
8375
8223
|
"span",
|
|
8376
8224
|
{
|
|
8377
8225
|
className: cn("shrink-0", compact && "absolute -right-0.5 -top-0.5 scale-90"),
|
|
@@ -8385,10 +8233,10 @@ function DockChrome({
|
|
|
8385
8233
|
})
|
|
8386
8234
|
}
|
|
8387
8235
|
),
|
|
8388
|
-
/* @__PURE__ */
|
|
8236
|
+
/* @__PURE__ */ jsx10("div", { className: "min-h-0 min-w-0 flex-1 overflow-hidden", children: tabs.length > 0 ? tabs.map((tab, index) => {
|
|
8389
8237
|
const selected = tab.id === activeId;
|
|
8390
8238
|
const shouldMount = selected || visitedTabs.has(tab.id);
|
|
8391
|
-
return /* @__PURE__ */
|
|
8239
|
+
return /* @__PURE__ */ jsx10(
|
|
8392
8240
|
"div",
|
|
8393
8241
|
{
|
|
8394
8242
|
id: `${tabsetId}-panel-${index}`,
|
|
@@ -8400,7 +8248,7 @@ function DockChrome({
|
|
|
8400
8248
|
},
|
|
8401
8249
|
tab.id
|
|
8402
8250
|
);
|
|
8403
|
-
}) : /* @__PURE__ */
|
|
8251
|
+
}) : /* @__PURE__ */ jsx10("div", { className: "h-full min-h-0 min-w-0", "aria-label": "Workspace", role: "tabpanel" }) })
|
|
8404
8252
|
] })
|
|
8405
8253
|
]
|
|
8406
8254
|
}
|
|
@@ -8411,10 +8259,10 @@ function DockChrome({
|
|
|
8411
8259
|
import {
|
|
8412
8260
|
lazy as lazy2,
|
|
8413
8261
|
Suspense as Suspense2,
|
|
8414
|
-
useCallback as
|
|
8415
|
-
useEffect as
|
|
8416
|
-
useMemo as
|
|
8417
|
-
useRef as
|
|
8262
|
+
useCallback as useCallback24,
|
|
8263
|
+
useEffect as useEffect21,
|
|
8264
|
+
useMemo as useMemo15,
|
|
8265
|
+
useRef as useRef18,
|
|
8418
8266
|
useState as useState17
|
|
8419
8267
|
} from "react";
|
|
8420
8268
|
import {
|
|
@@ -8429,9 +8277,9 @@ import {
|
|
|
8429
8277
|
SquareTerminalIcon,
|
|
8430
8278
|
TriangleAlertIcon as TriangleAlertIcon2
|
|
8431
8279
|
} from "lucide-react";
|
|
8432
|
-
import { jsx as
|
|
8280
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
8433
8281
|
var LazyBrowserViewer = lazy2(async () => {
|
|
8434
|
-
const { BrowserViewer } = await import("./browser-viewer-
|
|
8282
|
+
const { BrowserViewer } = await import("./browser-viewer-NTD6UIPR.js");
|
|
8435
8283
|
return { default: BrowserViewer };
|
|
8436
8284
|
});
|
|
8437
8285
|
var LazyComputerViewer = lazy2(async () => {
|
|
@@ -8453,6 +8301,11 @@ var WORKBENCH_SURFACES = [
|
|
|
8453
8301
|
function isWorkbenchSurface(value) {
|
|
8454
8302
|
return WORKBENCH_SURFACES.includes(value);
|
|
8455
8303
|
}
|
|
8304
|
+
function isCanonicalAbsoluteSandboxPath(value) {
|
|
8305
|
+
if (!value) return false;
|
|
8306
|
+
const portable = value.replaceAll("\\", "/");
|
|
8307
|
+
return portable.startsWith("/") || /^[A-Za-z]:\//u.test(portable);
|
|
8308
|
+
}
|
|
8456
8309
|
function sourceDrivenDefaultTab(hasChanges, changesEnabled, filesEnabled) {
|
|
8457
8310
|
if (hasChanges && changesEnabled) return WORKBENCH_TAB_CHANGES;
|
|
8458
8311
|
if (filesEnabled) return WORKBENCH_TAB_FILES;
|
|
@@ -8472,11 +8325,11 @@ function captureDegradedMessage(reason) {
|
|
|
8472
8325
|
}
|
|
8473
8326
|
}
|
|
8474
8327
|
function WorkbenchSurfaceLoading({ name }) {
|
|
8475
|
-
return /* @__PURE__ */
|
|
8328
|
+
return /* @__PURE__ */ jsx11(
|
|
8476
8329
|
CenteredState,
|
|
8477
8330
|
{
|
|
8478
|
-
icon: /* @__PURE__ */
|
|
8479
|
-
children: /* @__PURE__ */
|
|
8331
|
+
icon: /* @__PURE__ */ jsx11(LoaderCircleIcon2, { className: "size-5 animate-spin motion-reduce:animate-none", "aria-hidden": true }),
|
|
8332
|
+
children: /* @__PURE__ */ jsxs9("p", { className: "text-og-sm font-medium text-og-fg", children: [
|
|
8480
8333
|
"Opening ",
|
|
8481
8334
|
name
|
|
8482
8335
|
] })
|
|
@@ -8587,7 +8440,7 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8587
8440
|
const terminalEnabled = surfaceSet.has(WORKBENCH_TAB_TERMINAL);
|
|
8588
8441
|
const browserEnabled = surfaceSet.has(WORKBENCH_TAB_BROWSER);
|
|
8589
8442
|
const desktopEnabled = surfaceSet.has(WORKBENCH_TAB_DESKTOP);
|
|
8590
|
-
const createLinkedComputer =
|
|
8443
|
+
const createLinkedComputer = useCallback24(
|
|
8591
8444
|
async (name, placement) => {
|
|
8592
8445
|
const response = await client.createComputerSession(workspaceId, {
|
|
8593
8446
|
operationId: crypto.randomUUID(),
|
|
@@ -8618,7 +8471,7 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8618
8471
|
const warmIntents = storedWarmIntents.sessionId === sessionId ? storedWarmIntents : emptyWarmIntents(sessionId);
|
|
8619
8472
|
const { warmTerminal, warmFiles } = warmIntents;
|
|
8620
8473
|
const filesWarmRequested = warmFiles || Boolean(requestedFilePath);
|
|
8621
|
-
const requestWarmIntent =
|
|
8474
|
+
const requestWarmIntent = useCallback24(
|
|
8622
8475
|
(intent) => {
|
|
8623
8476
|
setStoredWarmIntents((previous) => {
|
|
8624
8477
|
const current = previous.sessionId === sessionId ? previous : emptyWarmIntents(sessionId);
|
|
@@ -8647,6 +8500,7 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8647
8500
|
const liveness = capabilities?.liveness;
|
|
8648
8501
|
const liveIoLiveness = liveness ?? null;
|
|
8649
8502
|
const fileSystemOn = capabilities?.FileSystem.available ?? false;
|
|
8503
|
+
const fileSystemRoute = capabilities ? { epoch: capabilities.leaseEpoch, root: capabilities.FileSystem.root } : void 0;
|
|
8650
8504
|
const fsReadOnly = capabilities?.FileSystem.readOnly ?? false;
|
|
8651
8505
|
const filesEditable = fileSystemOn && !fsReadOnly && sandboxAcceptsLiveIo(liveness);
|
|
8652
8506
|
const gitOn = capabilities?.Git.available ?? false;
|
|
@@ -8659,15 +8513,15 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8659
8513
|
});
|
|
8660
8514
|
const provisioning = sandboxProvisionInFlight(events);
|
|
8661
8515
|
const renegotiate = caps.renegotiate;
|
|
8662
|
-
const provisioningRef =
|
|
8663
|
-
|
|
8516
|
+
const provisioningRef = useRef18({ sessionId, provisioning });
|
|
8517
|
+
useEffect21(() => {
|
|
8664
8518
|
const previous = provisioningRef.current;
|
|
8665
8519
|
if (previous.sessionId === sessionId && previous.provisioning && !provisioning) {
|
|
8666
8520
|
renegotiate();
|
|
8667
8521
|
}
|
|
8668
8522
|
provisioningRef.current = { sessionId, provisioning };
|
|
8669
8523
|
}, [sessionId, provisioning, renegotiate]);
|
|
8670
|
-
|
|
8524
|
+
useEffect21(() => {
|
|
8671
8525
|
if (workspaceInteractionEvent?.workspaceId !== workspaceId) return;
|
|
8672
8526
|
renegotiate();
|
|
8673
8527
|
}, [workspaceId, workspaceInteractionEvent, renegotiate]);
|
|
@@ -8678,19 +8532,19 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8678
8532
|
const captureAvailable = captureState.available;
|
|
8679
8533
|
const liveWorkspaceExpected = sandboxAcceptsLiveIo(liveness);
|
|
8680
8534
|
const capturePending = !liveWorkspaceExpected && (captureState.fileCount === null || captureState.loading);
|
|
8681
|
-
const repoPaths =
|
|
8535
|
+
const repoPaths = useMemo15(() => {
|
|
8682
8536
|
const advertised = capabilities?.Git.repos ?? [];
|
|
8683
8537
|
if (advertised.length > 0) return advertised;
|
|
8684
8538
|
return captureState.capture?.repos.map((repo) => repo.root) ?? [];
|
|
8685
8539
|
}, [capabilities?.Git.repos, captureState.capture]);
|
|
8686
|
-
const notifiedCaptureDegradedReason =
|
|
8540
|
+
const notifiedCaptureDegradedReason = useRef18({
|
|
8687
8541
|
sessionId,
|
|
8688
8542
|
reason: null
|
|
8689
8543
|
});
|
|
8690
8544
|
if (notifiedCaptureDegradedReason.current.sessionId !== sessionId) {
|
|
8691
8545
|
notifiedCaptureDegradedReason.current = { sessionId, reason: null };
|
|
8692
8546
|
}
|
|
8693
|
-
|
|
8547
|
+
useEffect21(() => {
|
|
8694
8548
|
const reason = captureState.degradedReason;
|
|
8695
8549
|
if (!reason || notifiedCaptureDegradedReason.current.reason === reason) return;
|
|
8696
8550
|
notifiedCaptureDegradedReason.current = { sessionId, reason };
|
|
@@ -8708,7 +8562,8 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8708
8562
|
active: filesActive && !turnInFlight,
|
|
8709
8563
|
// A deliberate canonical absolute-path open browses in the selected target's
|
|
8710
8564
|
// advertised namespace, so the authoritative tree and link share exact paths.
|
|
8711
|
-
...requestedFilePath
|
|
8565
|
+
...isCanonicalAbsoluteSandboxPath(requestedFilePath) && capabilities?.FileSystem.root ? { rootPath: capabilities.FileSystem.root } : {},
|
|
8566
|
+
...fileSystemRoute ? { route: fileSystemRoute } : {},
|
|
8712
8567
|
repoPaths,
|
|
8713
8568
|
liveness: liveIoLiveness,
|
|
8714
8569
|
capture: captureState.capture,
|
|
@@ -8722,7 +8577,7 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8722
8577
|
const [storedChangesComparison, setStoredChangesComparison] = useState17(null);
|
|
8723
8578
|
const captureSupportsBranch = captureState.capture !== null && captureState.capture.repos.length > 0 && captureState.capture.repos.every((repo) => repo.branchDiff !== void 0);
|
|
8724
8579
|
const changesComparison = storedChangesComparison?.sessionId === sessionId ? storedChangesComparison.value : liveWorkspaceExpected || captureSupportsBranch ? "branch" : "working";
|
|
8725
|
-
const setChangesComparison =
|
|
8580
|
+
const setChangesComparison = useCallback24(
|
|
8726
8581
|
(value) => setStoredChangesComparison({ sessionId, value }),
|
|
8727
8582
|
[sessionId]
|
|
8728
8583
|
);
|
|
@@ -8739,13 +8594,13 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8739
8594
|
comparison: changesComparison,
|
|
8740
8595
|
capture: changesComparison === "staged" ? null : captureState.capture
|
|
8741
8596
|
});
|
|
8742
|
-
|
|
8597
|
+
useEffect21(() => {
|
|
8743
8598
|
if (changesComparison === "branch" && git.error && storedChangesComparison?.sessionId !== sessionId) {
|
|
8744
8599
|
setStoredChangesComparison({ sessionId, value: "working" });
|
|
8745
8600
|
}
|
|
8746
8601
|
}, [changesComparison, git.error, sessionId, storedChangesComparison?.sessionId]);
|
|
8747
8602
|
const [xtermTheme, setXtermTheme] = useState17(void 0);
|
|
8748
|
-
|
|
8603
|
+
useEffect21(() => {
|
|
8749
8604
|
if (!terminalEnabled || typeof document === "undefined") return;
|
|
8750
8605
|
const derive = () => setXtermTheme(xtermThemeFromTokens());
|
|
8751
8606
|
derive();
|
|
@@ -8767,7 +8622,7 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8767
8622
|
});
|
|
8768
8623
|
const workspaceWaking = chip.state === "waking";
|
|
8769
8624
|
const defaultIdentity = `${sessionId}\0${surfaceIdentity}`;
|
|
8770
|
-
const defaultTabRef =
|
|
8625
|
+
const defaultTabRef = useRef18({
|
|
8771
8626
|
identity: defaultIdentity,
|
|
8772
8627
|
value: null
|
|
8773
8628
|
});
|
|
@@ -8792,15 +8647,15 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8792
8647
|
}
|
|
8793
8648
|
}
|
|
8794
8649
|
const defaultTab = defaultTabRef.current.value;
|
|
8795
|
-
const tabs =
|
|
8650
|
+
const tabs = useMemo15(() => {
|
|
8796
8651
|
const list = [];
|
|
8797
8652
|
if (changesEnabled)
|
|
8798
8653
|
list.push({
|
|
8799
8654
|
id: WORKBENCH_TAB_CHANGES,
|
|
8800
8655
|
label: "Changes",
|
|
8801
|
-
icon: /* @__PURE__ */
|
|
8802
|
-
badge: dirtyCount > 0 ? /* @__PURE__ */
|
|
8803
|
-
content: /* @__PURE__ */
|
|
8656
|
+
icon: /* @__PURE__ */ jsx11(GitCompareArrowsIcon, {}),
|
|
8657
|
+
badge: dirtyCount > 0 ? /* @__PURE__ */ jsx11(DirtyBadge, { count: dirtyCount }) : void 0,
|
|
8658
|
+
content: /* @__PURE__ */ jsx11(
|
|
8804
8659
|
ChangesTabBody,
|
|
8805
8660
|
{
|
|
8806
8661
|
git,
|
|
@@ -8828,8 +8683,8 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8828
8683
|
list.push({
|
|
8829
8684
|
id: WORKBENCH_TAB_FILES,
|
|
8830
8685
|
label: "Files",
|
|
8831
|
-
icon: /* @__PURE__ */
|
|
8832
|
-
content: /* @__PURE__ */
|
|
8686
|
+
icon: /* @__PURE__ */ jsx11(FileCode2Icon2, {}),
|
|
8687
|
+
content: /* @__PURE__ */ jsx11(
|
|
8833
8688
|
SandboxFiles,
|
|
8834
8689
|
{
|
|
8835
8690
|
files,
|
|
@@ -8859,8 +8714,8 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8859
8714
|
list.push({
|
|
8860
8715
|
id: WORKBENCH_TAB_TERMINAL,
|
|
8861
8716
|
label: "Terminal",
|
|
8862
|
-
icon: /* @__PURE__ */
|
|
8863
|
-
content: /* @__PURE__ */
|
|
8717
|
+
icon: /* @__PURE__ */ jsx11(SquareTerminalIcon, {}),
|
|
8718
|
+
content: /* @__PURE__ */ jsx11("div", { className: "h-full bg-og-bg p-1", children: /* @__PURE__ */ jsx11(
|
|
8864
8719
|
SandboxTerminal,
|
|
8865
8720
|
{
|
|
8866
8721
|
result: terminal,
|
|
@@ -8880,8 +8735,8 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8880
8735
|
list.push({
|
|
8881
8736
|
id: WORKBENCH_TAB_BROWSER,
|
|
8882
8737
|
label: "Browser",
|
|
8883
|
-
icon: /* @__PURE__ */
|
|
8884
|
-
content: /* @__PURE__ */
|
|
8738
|
+
icon: /* @__PURE__ */ jsx11(Globe2Icon, {}),
|
|
8739
|
+
content: /* @__PURE__ */ jsx11(Suspense2, { fallback: /* @__PURE__ */ jsx11(WorkbenchSurfaceLoading, { name: "Browser" }), children: /* @__PURE__ */ jsx11(
|
|
8885
8740
|
LazyBrowserViewer,
|
|
8886
8741
|
{
|
|
8887
8742
|
client,
|
|
@@ -8905,8 +8760,8 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8905
8760
|
list.push({
|
|
8906
8761
|
id: WORKBENCH_TAB_DESKTOP,
|
|
8907
8762
|
label: "Desktop",
|
|
8908
|
-
icon: /* @__PURE__ */
|
|
8909
|
-
content: /* @__PURE__ */
|
|
8763
|
+
icon: /* @__PURE__ */ jsx11(MonitorIcon, {}),
|
|
8764
|
+
content: /* @__PURE__ */ jsx11(Suspense2, { fallback: /* @__PURE__ */ jsx11(WorkbenchSurfaceLoading, { name: "Desktop" }), children: /* @__PURE__ */ jsx11(
|
|
8910
8765
|
LazyComputerViewer,
|
|
8911
8766
|
{
|
|
8912
8767
|
client,
|
|
@@ -9020,11 +8875,11 @@ function SandboxWorkspace(props) {
|
|
|
9020
8875
|
const [storedSelection, setStoredSelection] = useState17(null);
|
|
9021
8876
|
const [requestedFile, setRequestedFile] = useState17(null);
|
|
9022
8877
|
const [requestedComputer, setRequestedComputer] = useState17(null);
|
|
9023
|
-
const nextFileRequestId =
|
|
9024
|
-
const nextComputerRequestId =
|
|
8878
|
+
const nextFileRequestId = useRef18(0);
|
|
8879
|
+
const nextComputerRequestId = useRef18(0);
|
|
9025
8880
|
const selectedTab = storedSelection?.sessionId === sessionId ? storedSelection.tab : null;
|
|
9026
8881
|
const activeTabHint = selectedTab ?? initialTab ?? leadingTabs?.[0]?.id ?? null;
|
|
9027
|
-
const openFile =
|
|
8882
|
+
const openFile = useCallback24(
|
|
9028
8883
|
(path, line) => {
|
|
9029
8884
|
setRequestedFile({
|
|
9030
8885
|
sessionId,
|
|
@@ -9039,14 +8894,14 @@ function SandboxWorkspace(props) {
|
|
|
9039
8894
|
},
|
|
9040
8895
|
[onActiveTabChange, onCollapsedChange, onFilePathChange, sessionId]
|
|
9041
8896
|
);
|
|
9042
|
-
const handledOpenFileRequestId =
|
|
9043
|
-
|
|
8897
|
+
const handledOpenFileRequestId = useRef18(null);
|
|
8898
|
+
useEffect21(() => {
|
|
9044
8899
|
if (!openFileRequest) return;
|
|
9045
8900
|
if (handledOpenFileRequestId.current === openFileRequest.requestId) return;
|
|
9046
8901
|
handledOpenFileRequestId.current = openFileRequest.requestId;
|
|
9047
8902
|
openFile(openFileRequest.path, openFileRequest.line);
|
|
9048
8903
|
}, [openFile, openFileRequest]);
|
|
9049
|
-
const openComputer =
|
|
8904
|
+
const openComputer = useCallback24(
|
|
9050
8905
|
(computerSessionId) => {
|
|
9051
8906
|
nextComputerRequestId.current += 1;
|
|
9052
8907
|
setRequestedComputer({
|
|
@@ -9095,18 +8950,18 @@ function SandboxWorkspace(props) {
|
|
|
9095
8950
|
const tabs = [...leadingTabs ?? [], ...workbenchTabs, ...trailingTabs ?? []];
|
|
9096
8951
|
const preferredTab = selectedTab ?? defaultTab;
|
|
9097
8952
|
const activeTab = preferredTab && tabs.some((tab) => tab.id === preferredTab) ? preferredTab : tabs[0]?.id;
|
|
9098
|
-
const selectTab =
|
|
8953
|
+
const selectTab = useCallback24(
|
|
9099
8954
|
(tab) => {
|
|
9100
8955
|
setStoredSelection({ sessionId, tab });
|
|
9101
8956
|
onActiveTabChange?.(tab);
|
|
9102
8957
|
},
|
|
9103
8958
|
[onActiveTabChange, sessionId]
|
|
9104
8959
|
);
|
|
9105
|
-
|
|
8960
|
+
useEffect21(() => {
|
|
9106
8961
|
if (selectedTab !== null || defaultTab === null) return;
|
|
9107
8962
|
setStoredSelection({ sessionId, tab: defaultTab });
|
|
9108
8963
|
}, [defaultTab, selectedTab, sessionId]);
|
|
9109
|
-
return /* @__PURE__ */
|
|
8964
|
+
return /* @__PURE__ */ jsx11(
|
|
9110
8965
|
WorkspaceDock,
|
|
9111
8966
|
{
|
|
9112
8967
|
primary,
|
|
@@ -9114,7 +8969,7 @@ function SandboxWorkspace(props) {
|
|
|
9114
8969
|
...activeTab !== void 0 ? { activeTab } : {},
|
|
9115
8970
|
onActiveTabChange: selectTab,
|
|
9116
8971
|
...machine.enabled ? {
|
|
9117
|
-
headerAccessory: /* @__PURE__ */
|
|
8972
|
+
headerAccessory: /* @__PURE__ */ jsx11(MachineStateChip, { chip: machine.chip })
|
|
9118
8973
|
} : {},
|
|
9119
8974
|
...mobileLeadingControl !== void 0 ? { mobileLeadingControl } : {},
|
|
9120
8975
|
...collapsed !== void 0 ? { collapsed } : {},
|
|
@@ -9129,7 +8984,7 @@ function SandboxWorkspace(props) {
|
|
|
9129
8984
|
);
|
|
9130
8985
|
}
|
|
9131
8986
|
function DirtyBadge({ count }) {
|
|
9132
|
-
return /* @__PURE__ */
|
|
8987
|
+
return /* @__PURE__ */ jsx11("span", { className: "rounded-og-xs bg-og-accent-soft px-1 text-og-xs text-og-fg-muted", children: count });
|
|
9133
8988
|
}
|
|
9134
8989
|
function chipDotClass(state) {
|
|
9135
8990
|
if (state === "live") return "bg-og-status-running";
|
|
@@ -9137,27 +8992,27 @@ function chipDotClass(state) {
|
|
|
9137
8992
|
return "bg-og-fg-subtle";
|
|
9138
8993
|
}
|
|
9139
8994
|
function MachineStateChip({ chip }) {
|
|
9140
|
-
return /* @__PURE__ */
|
|
8995
|
+
return /* @__PURE__ */ jsxs9(
|
|
9141
8996
|
"div",
|
|
9142
8997
|
{
|
|
9143
8998
|
role: "status",
|
|
9144
8999
|
"aria-label": `Machine: ${chip.label}`,
|
|
9145
9000
|
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",
|
|
9146
9001
|
children: [
|
|
9147
|
-
/* @__PURE__ */
|
|
9002
|
+
/* @__PURE__ */ jsx11(
|
|
9148
9003
|
"span",
|
|
9149
9004
|
{
|
|
9150
9005
|
className: cn("size-1.5 shrink-0 rounded-full", chipDotClass(chip.state)),
|
|
9151
9006
|
"aria-hidden": true
|
|
9152
9007
|
}
|
|
9153
9008
|
),
|
|
9154
|
-
/* @__PURE__ */
|
|
9009
|
+
/* @__PURE__ */ jsx11("span", { className: "min-w-0 max-w-[11rem] truncate", children: chip.label })
|
|
9155
9010
|
]
|
|
9156
9011
|
}
|
|
9157
9012
|
);
|
|
9158
9013
|
}
|
|
9159
9014
|
function DockActionButton({ onClick, children }) {
|
|
9160
|
-
return /* @__PURE__ */
|
|
9015
|
+
return /* @__PURE__ */ jsx11(
|
|
9161
9016
|
"button",
|
|
9162
9017
|
{
|
|
9163
9018
|
type: "button",
|
|
@@ -9172,12 +9027,12 @@ function ChangesTabBody({
|
|
|
9172
9027
|
onComparisonChange,
|
|
9173
9028
|
...props
|
|
9174
9029
|
}) {
|
|
9175
|
-
return /* @__PURE__ */
|
|
9176
|
-
/* @__PURE__ */
|
|
9030
|
+
return /* @__PURE__ */ jsxs9("div", { className: "flex h-full min-h-0 flex-col", children: [
|
|
9031
|
+
/* @__PURE__ */ jsx11("div", { className: "flex shrink-0 items-center gap-1 border-b border-og-border bg-og-surface-1 px-2 py-1.5", children: [
|
|
9177
9032
|
["branch", "Branch"],
|
|
9178
9033
|
["working", "Uncommitted"],
|
|
9179
9034
|
["staged", "Staged"]
|
|
9180
|
-
].map(([value, label]) => /* @__PURE__ */
|
|
9035
|
+
].map(([value, label]) => /* @__PURE__ */ jsx11(
|
|
9181
9036
|
"button",
|
|
9182
9037
|
{
|
|
9183
9038
|
type: "button",
|
|
@@ -9191,7 +9046,7 @@ function ChangesTabBody({
|
|
|
9191
9046
|
},
|
|
9192
9047
|
value
|
|
9193
9048
|
)) }),
|
|
9194
|
-
/* @__PURE__ */
|
|
9049
|
+
/* @__PURE__ */ jsx11("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsx11(ChangesTabContent, { comparison, ...props }) })
|
|
9195
9050
|
] });
|
|
9196
9051
|
}
|
|
9197
9052
|
function ChangesTabContent({
|
|
@@ -9210,8 +9065,8 @@ function ChangesTabContent({
|
|
|
9210
9065
|
}) {
|
|
9211
9066
|
const diff = git.diff;
|
|
9212
9067
|
if (diff.length > 0) {
|
|
9213
|
-
return /* @__PURE__ */
|
|
9214
|
-
git.error ? /* @__PURE__ */
|
|
9068
|
+
return /* @__PURE__ */ jsxs9("div", { className: "flex h-full min-h-0 flex-col", children: [
|
|
9069
|
+
git.error ? /* @__PURE__ */ jsxs9(
|
|
9215
9070
|
"div",
|
|
9216
9071
|
{
|
|
9217
9072
|
role: "status",
|
|
@@ -9219,9 +9074,9 @@ function ChangesTabContent({
|
|
|
9219
9074
|
"data-opengeni-changes-degraded": true,
|
|
9220
9075
|
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",
|
|
9221
9076
|
children: [
|
|
9222
|
-
/* @__PURE__ */
|
|
9223
|
-
/* @__PURE__ */
|
|
9224
|
-
/* @__PURE__ */
|
|
9077
|
+
/* @__PURE__ */ jsx11(TriangleAlertIcon2, { className: "size-3.5 shrink-0 text-og-status-running", "aria-hidden": true }),
|
|
9078
|
+
/* @__PURE__ */ jsx11("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." }),
|
|
9079
|
+
/* @__PURE__ */ jsxs9(
|
|
9225
9080
|
"button",
|
|
9226
9081
|
{
|
|
9227
9082
|
type: "button",
|
|
@@ -9229,7 +9084,7 @@ function ChangesTabContent({
|
|
|
9229
9084
|
disabled: git.loading,
|
|
9230
9085
|
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",
|
|
9231
9086
|
children: [
|
|
9232
|
-
/* @__PURE__ */
|
|
9087
|
+
/* @__PURE__ */ jsx11(
|
|
9233
9088
|
RefreshCwIcon2,
|
|
9234
9089
|
{
|
|
9235
9090
|
className: cn("size-3", git.loading && "animate-spin motion-reduce:animate-none"),
|
|
@@ -9243,7 +9098,7 @@ function ChangesTabContent({
|
|
|
9243
9098
|
]
|
|
9244
9099
|
}
|
|
9245
9100
|
) : null,
|
|
9246
|
-
/* @__PURE__ */
|
|
9101
|
+
/* @__PURE__ */ jsx11("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsx11(
|
|
9247
9102
|
WorkbenchChanges,
|
|
9248
9103
|
{
|
|
9249
9104
|
diff,
|
|
@@ -9256,20 +9111,20 @@ function ChangesTabContent({
|
|
|
9256
9111
|
] });
|
|
9257
9112
|
}
|
|
9258
9113
|
if (capabilitiesError && !captureAvailable) {
|
|
9259
|
-
return /* @__PURE__ */
|
|
9260
|
-
/* @__PURE__ */
|
|
9261
|
-
/* @__PURE__ */
|
|
9262
|
-
/* @__PURE__ */
|
|
9263
|
-
/* @__PURE__ */
|
|
9114
|
+
return /* @__PURE__ */ jsxs9(CenteredState, { icon: /* @__PURE__ */ jsx11(TriangleAlertIcon2, { className: "size-5", "aria-hidden": true }), tone: "danger", children: [
|
|
9115
|
+
/* @__PURE__ */ jsx11("p", { className: "text-og-sm font-medium text-og-fg", children: "Sandbox unavailable" }),
|
|
9116
|
+
/* @__PURE__ */ jsx11("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." }),
|
|
9117
|
+
/* @__PURE__ */ jsxs9(DockActionButton, { onClick: onRetry, children: [
|
|
9118
|
+
/* @__PURE__ */ jsx11(RefreshCwIcon2, { className: "size-3" }),
|
|
9264
9119
|
"Retry"
|
|
9265
9120
|
] })
|
|
9266
9121
|
] });
|
|
9267
9122
|
}
|
|
9268
9123
|
if ((capturePending || capabilitiesState === "negotiating") && !captureAvailable && !workspaceWaking) {
|
|
9269
|
-
return /* @__PURE__ */
|
|
9124
|
+
return /* @__PURE__ */ jsxs9(
|
|
9270
9125
|
CenteredState,
|
|
9271
9126
|
{
|
|
9272
|
-
icon: /* @__PURE__ */
|
|
9127
|
+
icon: /* @__PURE__ */ jsx11(
|
|
9273
9128
|
LoaderCircleIcon2,
|
|
9274
9129
|
{
|
|
9275
9130
|
className: "size-5 animate-spin motion-reduce:animate-none",
|
|
@@ -9277,28 +9132,28 @@ function ChangesTabContent({
|
|
|
9277
9132
|
}
|
|
9278
9133
|
),
|
|
9279
9134
|
children: [
|
|
9280
|
-
/* @__PURE__ */
|
|
9281
|
-
/* @__PURE__ */
|
|
9135
|
+
/* @__PURE__ */ jsx11("p", { className: "text-og-sm font-medium text-og-fg", children: "Connecting workspace" }),
|
|
9136
|
+
/* @__PURE__ */ jsx11("p", { className: "text-og-sm leading-5 text-og-fg-subtle", children: "Looking for the latest files and changes\u2026" })
|
|
9282
9137
|
]
|
|
9283
9138
|
}
|
|
9284
9139
|
);
|
|
9285
9140
|
}
|
|
9286
9141
|
if (!liveWorkspaceExpected && (comparison !== "working" || !captureAvailable)) {
|
|
9287
|
-
return /* @__PURE__ */
|
|
9142
|
+
return /* @__PURE__ */ jsxs9(
|
|
9288
9143
|
CenteredState,
|
|
9289
9144
|
{
|
|
9290
|
-
icon: workspaceWaking ? /* @__PURE__ */
|
|
9145
|
+
icon: workspaceWaking ? /* @__PURE__ */ jsx11(
|
|
9291
9146
|
LoaderCircleIcon2,
|
|
9292
9147
|
{
|
|
9293
9148
|
className: "size-5 animate-spin motion-reduce:animate-none",
|
|
9294
9149
|
"aria-hidden": true
|
|
9295
9150
|
}
|
|
9296
|
-
) : /* @__PURE__ */
|
|
9151
|
+
) : /* @__PURE__ */ jsx11(CpuIcon, { className: "size-5", "aria-hidden": true }),
|
|
9297
9152
|
children: [
|
|
9298
|
-
/* @__PURE__ */
|
|
9299
|
-
/* @__PURE__ */
|
|
9300
|
-
!workspaceWaking ? /* @__PURE__ */
|
|
9301
|
-
/* @__PURE__ */
|
|
9153
|
+
/* @__PURE__ */ jsx11("p", { className: "text-og-sm font-medium text-og-fg", children: workspaceWaking ? "Waking workspace" : "Workspace is resting" }),
|
|
9154
|
+
/* @__PURE__ */ jsx11("p", { className: "text-og-sm leading-5 text-og-fg-subtle", children: workspaceWaking ? "Connecting to the live working tree\u2026" : 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." }),
|
|
9155
|
+
!workspaceWaking ? /* @__PURE__ */ jsxs9(DockActionButton, { onClick: onWake, children: [
|
|
9156
|
+
/* @__PURE__ */ jsx11(CpuIcon, { className: "size-3" }),
|
|
9302
9157
|
"Open live workspace"
|
|
9303
9158
|
] }) : null
|
|
9304
9159
|
]
|
|
@@ -9306,10 +9161,10 @@ function ChangesTabContent({
|
|
|
9306
9161
|
);
|
|
9307
9162
|
}
|
|
9308
9163
|
if (git.loading && git.source === null) {
|
|
9309
|
-
return /* @__PURE__ */
|
|
9164
|
+
return /* @__PURE__ */ jsxs9(
|
|
9310
9165
|
CenteredState,
|
|
9311
9166
|
{
|
|
9312
|
-
icon: /* @__PURE__ */
|
|
9167
|
+
icon: /* @__PURE__ */ jsx11(
|
|
9313
9168
|
LoaderCircleIcon2,
|
|
9314
9169
|
{
|
|
9315
9170
|
className: "size-5 animate-spin motion-reduce:animate-none",
|
|
@@ -9317,15 +9172,15 @@ function ChangesTabContent({
|
|
|
9317
9172
|
}
|
|
9318
9173
|
),
|
|
9319
9174
|
children: [
|
|
9320
|
-
/* @__PURE__ */
|
|
9321
|
-
/* @__PURE__ */
|
|
9175
|
+
/* @__PURE__ */ jsx11("p", { className: "text-og-sm font-medium text-og-fg", children: "Loading workspace" }),
|
|
9176
|
+
/* @__PURE__ */ jsx11("p", { className: "text-og-sm leading-5 text-og-fg-subtle", children: "Reading the current working tree\u2026" })
|
|
9322
9177
|
]
|
|
9323
9178
|
}
|
|
9324
9179
|
);
|
|
9325
9180
|
}
|
|
9326
|
-
return /* @__PURE__ */
|
|
9327
|
-
/* @__PURE__ */
|
|
9328
|
-
/* @__PURE__ */
|
|
9181
|
+
return /* @__PURE__ */ jsxs9(CenteredState, { icon: /* @__PURE__ */ jsx11(CircleCheckIcon, { className: "size-5", "aria-hidden": true }), tone: "success", children: [
|
|
9182
|
+
/* @__PURE__ */ jsx11("p", { className: "text-og-sm font-medium text-og-fg", children: comparison === "branch" ? "No branch changes" : comparison === "staged" ? "No staged changes" : "No uncommitted changes" }),
|
|
9183
|
+
/* @__PURE__ */ jsx11("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." })
|
|
9329
9184
|
] });
|
|
9330
9185
|
}
|
|
9331
9186
|
function CenteredState({
|
|
@@ -9333,15 +9188,15 @@ function CenteredState({
|
|
|
9333
9188
|
icon,
|
|
9334
9189
|
tone = "neutral"
|
|
9335
9190
|
}) {
|
|
9336
|
-
return /* @__PURE__ */
|
|
9191
|
+
return /* @__PURE__ */ jsx11(
|
|
9337
9192
|
"div",
|
|
9338
9193
|
{
|
|
9339
9194
|
role: tone === "danger" ? "alert" : "status",
|
|
9340
9195
|
"aria-atomic": "true",
|
|
9341
9196
|
"aria-live": tone === "danger" ? "assertive" : "polite",
|
|
9342
9197
|
className: "grid h-full place-items-center p-6 text-center",
|
|
9343
|
-
children: /* @__PURE__ */
|
|
9344
|
-
icon ? /* @__PURE__ */
|
|
9198
|
+
children: /* @__PURE__ */ jsxs9("div", { className: "flex max-w-sm flex-col items-center gap-2.5", children: [
|
|
9199
|
+
icon ? /* @__PURE__ */ jsx11(
|
|
9345
9200
|
"span",
|
|
9346
9201
|
{
|
|
9347
9202
|
className: cn(
|
|
@@ -9360,7 +9215,7 @@ function CenteredState({
|
|
|
9360
9215
|
}
|
|
9361
9216
|
|
|
9362
9217
|
// src/hooks/use-codex-accounts.ts
|
|
9363
|
-
import { useCallback as
|
|
9218
|
+
import { useCallback as useCallback25, useState as useState18 } from "react";
|
|
9364
9219
|
function isCodexAccountEvent(event) {
|
|
9365
9220
|
return event.type === "codex.account.switched";
|
|
9366
9221
|
}
|
|
@@ -9381,7 +9236,7 @@ function useCodexAccounts(options = {}) {
|
|
|
9381
9236
|
const codexClient = options.codexClient ?? client;
|
|
9382
9237
|
const sessionId = options.sessionId;
|
|
9383
9238
|
const sharedEvents = options.events;
|
|
9384
|
-
const load =
|
|
9239
|
+
const load = useCallback25(async () => {
|
|
9385
9240
|
const accountsP = codexClient.listCodexAccounts(workspaceId);
|
|
9386
9241
|
const sessionP = sessionId && codexClient.getSession ? codexClient.getSession(workspaceId, sessionId).catch(() => null) : Promise.resolve(null);
|
|
9387
9242
|
const [acc, session] = await Promise.all([accountsP, sessionP]);
|
|
@@ -9415,7 +9270,7 @@ function useCodexAccounts(options = {}) {
|
|
|
9415
9270
|
...sharedEvents !== void 0 ? { events: sharedEvents } : {}
|
|
9416
9271
|
}
|
|
9417
9272
|
);
|
|
9418
|
-
const pin =
|
|
9273
|
+
const pin = useCallback25(
|
|
9419
9274
|
async (target) => {
|
|
9420
9275
|
if (!sessionId || !codexClient.pinSessionCodexAccount) {
|
|
9421
9276
|
return false;
|
|
@@ -9431,7 +9286,7 @@ function useCodexAccounts(options = {}) {
|
|
|
9431
9286
|
},
|
|
9432
9287
|
[codexClient, workspaceId, sessionId, runMutation, refresh]
|
|
9433
9288
|
);
|
|
9434
|
-
const refreshUsage =
|
|
9289
|
+
const refreshUsage = useCallback25(async () => {
|
|
9435
9290
|
if (!codexClient.refreshCodexUsage) {
|
|
9436
9291
|
return false;
|
|
9437
9292
|
}
|
|
@@ -9463,7 +9318,7 @@ function useCodexAccounts(options = {}) {
|
|
|
9463
9318
|
}
|
|
9464
9319
|
|
|
9465
9320
|
// src/hooks/use-supergrok-accounts.ts
|
|
9466
|
-
import { useCallback as
|
|
9321
|
+
import { useCallback as useCallback26 } from "react";
|
|
9467
9322
|
var EMPTY = {
|
|
9468
9323
|
accounts: [],
|
|
9469
9324
|
activeAccountId: null,
|
|
@@ -9476,7 +9331,7 @@ var EMPTY = {
|
|
|
9476
9331
|
function useSuperGrokAccounts(options = {}) {
|
|
9477
9332
|
const { client, workspaceId } = useOpenGeni(options);
|
|
9478
9333
|
const supergrokClient = options.supergrokClient ?? client;
|
|
9479
|
-
const load =
|
|
9334
|
+
const load = useCallback26(
|
|
9480
9335
|
async () => await supergrokClient.listSuperGrokAccounts(workspaceId),
|
|
9481
9336
|
[supergrokClient, workspaceId]
|
|
9482
9337
|
);
|
|
@@ -9485,7 +9340,7 @@ function useSuperGrokAccounts(options = {}) {
|
|
|
9485
9340
|
pollIntervalMs: options.pollIntervalMs
|
|
9486
9341
|
});
|
|
9487
9342
|
const { run, mutating: activating, mutationError } = useMutationRunner();
|
|
9488
|
-
const activate =
|
|
9343
|
+
const activate = useCallback26(
|
|
9489
9344
|
async (accountId) => {
|
|
9490
9345
|
if (!supergrokClient.activateSuperGrokAccount) return false;
|
|
9491
9346
|
const result = await run(async () => {
|
|
@@ -9587,6 +9442,8 @@ export {
|
|
|
9587
9442
|
SandboxWorkspace,
|
|
9588
9443
|
ScreenshotFigure,
|
|
9589
9444
|
SessionChrome,
|
|
9445
|
+
SessionCommandsPanel,
|
|
9446
|
+
SessionConversation,
|
|
9590
9447
|
SessionStatus,
|
|
9591
9448
|
SharedMachineDisclosure,
|
|
9592
9449
|
StatusDot,
|
|
@@ -9694,6 +9551,7 @@ export {
|
|
|
9694
9551
|
planVoiceRecordingChunkCommit,
|
|
9695
9552
|
pointsFor,
|
|
9696
9553
|
prepareVoiceRecordingChunk,
|
|
9554
|
+
presentFailure,
|
|
9697
9555
|
projectClientModelRows,
|
|
9698
9556
|
projectPendingApprovals,
|
|
9699
9557
|
projectPendingHumanInputRequests,
|