@opengeni/react 3.7.0-canary.0 → 3.7.0-canary.2
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.js +24 -5
- 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-R55HFTT3.js → chunk-3IY6UZI6.js} +4306 -4020
- package/dist/chunk-3IY6UZI6.js.map +1 -0
- package/dist/chunk-5PQJOCX5.js +902 -0
- package/dist/chunk-5PQJOCX5.js.map +1 -0
- package/dist/{chunk-FJBOU2TH.js → chunk-MOWYEBCQ.js} +1728 -12
- 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-DOK4KZF2.js → chunk-WZIMM3GX.js} +1536 -539
- package/dist/chunk-WZIMM3GX.js.map +1 -0
- package/dist/{chunk-YVCHAQZY.js → chunk-ZFOFY5ST.js} +27 -349
- package/dist/chunk-ZFOFY5ST.js.map +1 -0
- package/dist/components/artifacts/published-html-artifact-frame.d.ts +3 -2
- package/dist/components/child-session-link.d.ts +5 -0
- package/dist/components/session-chrome.d.ts +43 -6
- 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/index.d.ts +4 -1
- package/dist/index.js +716 -914
- 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/types.d.ts +3 -1
- package/package.json +2 -2
- package/src/components/artifacts/published-html-artifact-frame.tsx +27 -4
- package/src/components/child-session-link.tsx +27 -0
- package/src/components/composer.tsx +1 -1
- package/src/components/machine-input-display.ts +8 -2
- package/src/components/message-timeline.tsx +336 -198
- package/src/components/session-chrome.tsx +572 -161
- 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-session-background-commands.ts +21 -10
- package/src/hooks/use-session-events.ts +36 -14
- package/src/hooks/use-session.ts +23 -2
- package/src/index.ts +4 -0
- package/src/lib/format.ts +32 -0
- package/src/session-ui.ts +3 -0
- package/src/timeline/projection.ts +6 -12
- package/src/timeline/types.ts +4 -0
- package/styles/compiled.css +513 -410
- package/styles/index.css +23 -0
- package/dist/chunk-7EAFGICR.js +0 -302
- package/dist/chunk-7EAFGICR.js.map +0 -1
- package/dist/chunk-C6WDLHBA.js +0 -2590
- package/dist/chunk-C6WDLHBA.js.map +0 -1
- package/dist/chunk-DOK4KZF2.js.map +0 -1
- package/dist/chunk-FJBOU2TH.js.map +0 -1
- package/dist/chunk-R55HFTT3.js.map +0 -1
- package/dist/chunk-YVCHAQZY.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-R55HFTT3.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-WZIMM3GX.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-3IY6UZI6.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-FJBOU2TH.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(
|
|
@@ -2308,12 +2250,12 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2308
2250
|
const capture = options.capture ?? null;
|
|
2309
2251
|
const isLive2 = sandboxAcceptsLiveIo(options.liveness);
|
|
2310
2252
|
const acceptsEventReads = options.liveness === void 0 || isLive2;
|
|
2311
|
-
const acceptsEventReadsRef =
|
|
2253
|
+
const acceptsEventReadsRef = useRef6(acceptsEventReads);
|
|
2312
2254
|
acceptsEventReadsRef.current = acceptsEventReads;
|
|
2313
2255
|
const hasLiveIoFence = options.liveness !== void 0;
|
|
2314
2256
|
const identityKey = `${workspaceId}\0${sessionId ?? ""}\0${rootPath}\0${repoPathsKey}\0${routeEpoch ?? ""}\0${routeRoot ?? ""}`;
|
|
2315
2257
|
const [tree, setTree] = useState4([]);
|
|
2316
|
-
const treeRef =
|
|
2258
|
+
const treeRef = useRef6([]);
|
|
2317
2259
|
const [loading, setLoading] = useState4(false);
|
|
2318
2260
|
const [expandingPaths, setExpandingPaths] = useState4(/* @__PURE__ */ new Set());
|
|
2319
2261
|
const [error, setError] = useState4(null);
|
|
@@ -2322,23 +2264,23 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2322
2264
|
const [contentRevision, setContentRevision] = useState4(0);
|
|
2323
2265
|
const [stateIdentity, setStateIdentity] = useState4(identityKey);
|
|
2324
2266
|
const [source, setSource] = useState4(null);
|
|
2325
|
-
const sourceRef =
|
|
2326
|
-
const statusRef =
|
|
2327
|
-
const refreshGenerationRef =
|
|
2328
|
-
const refreshAbortRef =
|
|
2329
|
-
const identityAbortRef =
|
|
2330
|
-
const eventReadAbortRef =
|
|
2331
|
-
const identityGenerationRef =
|
|
2332
|
-
const lastSeqRef =
|
|
2333
|
-
const pendingParentsRef =
|
|
2334
|
-
const pendingGitRef =
|
|
2335
|
-
const eventReconcileInFlightRef =
|
|
2336
|
-
const eventReconcilePendingRef =
|
|
2337
|
-
const debounceRef =
|
|
2338
|
-
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());
|
|
2339
2281
|
const onMutationError = options.onMutationError;
|
|
2340
2282
|
treeRef.current = tree;
|
|
2341
|
-
const applyStatus =
|
|
2283
|
+
const applyStatus = useCallback14((nodes) => {
|
|
2342
2284
|
const overlay = statusRef.current;
|
|
2343
2285
|
const walk = (list) => {
|
|
2344
2286
|
let changed = false;
|
|
@@ -2361,7 +2303,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2361
2303
|
};
|
|
2362
2304
|
return walk(nodes);
|
|
2363
2305
|
}, []);
|
|
2364
|
-
const refresh =
|
|
2306
|
+
const refresh = useCallback14(async () => {
|
|
2365
2307
|
if (!sessionId) return;
|
|
2366
2308
|
refreshAbortRef.current?.abort();
|
|
2367
2309
|
const refreshAbort = new AbortController();
|
|
@@ -2445,7 +2387,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2445
2387
|
if (refreshAbortRef.current === refreshAbort) refreshAbortRef.current = null;
|
|
2446
2388
|
}
|
|
2447
2389
|
}, [client, workspaceId, sessionId, rootPath, repoPaths, route, applyStatus]);
|
|
2448
|
-
const seedFromCapture =
|
|
2390
|
+
const seedFromCapture = useCallback14(
|
|
2449
2391
|
(manifest) => {
|
|
2450
2392
|
const overlay = /* @__PURE__ */ new Map();
|
|
2451
2393
|
for (const file of manifest.files) {
|
|
@@ -2473,7 +2415,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2473
2415
|
},
|
|
2474
2416
|
[applyStatus]
|
|
2475
2417
|
);
|
|
2476
|
-
const expand =
|
|
2418
|
+
const expand = useCallback14(
|
|
2477
2419
|
async (path) => {
|
|
2478
2420
|
if (!sessionId) return;
|
|
2479
2421
|
if (source === "capture" && capture) return;
|
|
@@ -2510,7 +2452,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2510
2452
|
},
|
|
2511
2453
|
[client, workspaceId, sessionId, capture, source, route, applyStatus]
|
|
2512
2454
|
);
|
|
2513
|
-
const readFile =
|
|
2455
|
+
const readFile = useCallback14(
|
|
2514
2456
|
async (path, requestOptions = {}) => {
|
|
2515
2457
|
if (!sessionId) throw new Error("no session");
|
|
2516
2458
|
const identitySignal = identityAbortRef.current.signal;
|
|
@@ -2590,7 +2532,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2590
2532
|
},
|
|
2591
2533
|
[client, workspaceId, sessionId, capture, source, route]
|
|
2592
2534
|
);
|
|
2593
|
-
const reconcilePath =
|
|
2535
|
+
const reconcilePath = useCallback14(
|
|
2594
2536
|
async (path, requestSignal) => {
|
|
2595
2537
|
if (!sessionId) return;
|
|
2596
2538
|
const identityGeneration = identityGenerationRef.current;
|
|
@@ -2619,7 +2561,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2619
2561
|
},
|
|
2620
2562
|
[client, workspaceId, sessionId, rootPath, route, applyStatus]
|
|
2621
2563
|
);
|
|
2622
|
-
const reconcilePaths =
|
|
2564
|
+
const reconcilePaths = useCallback14(
|
|
2623
2565
|
async (requestedPaths, requestSignal) => {
|
|
2624
2566
|
if (!sessionId) return;
|
|
2625
2567
|
const identityGeneration = identityGenerationRef.current;
|
|
@@ -2666,7 +2608,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2666
2608
|
},
|
|
2667
2609
|
[client, workspaceId, sessionId, rootPath, route, applyStatus]
|
|
2668
2610
|
);
|
|
2669
|
-
const runOptimistic =
|
|
2611
|
+
const runOptimistic = useCallback14(
|
|
2670
2612
|
async (opName, apply, op, reconcileParents) => {
|
|
2671
2613
|
const identityGeneration = identityGenerationRef.current;
|
|
2672
2614
|
const snapshot = treeRef.current;
|
|
@@ -2696,7 +2638,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2696
2638
|
},
|
|
2697
2639
|
[applyStatus, reconcilePath, onMutationError]
|
|
2698
2640
|
);
|
|
2699
|
-
const writeFile =
|
|
2641
|
+
const writeFile = useCallback14(
|
|
2700
2642
|
async (path, content, writeOptions = {}) => {
|
|
2701
2643
|
if (!sessionId) throw new Error("no session");
|
|
2702
2644
|
const identityGeneration = identityGenerationRef.current;
|
|
@@ -2743,7 +2685,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2743
2685
|
},
|
|
2744
2686
|
[client, workspaceId, sessionId, tree, rootPath, route, runOptimistic]
|
|
2745
2687
|
);
|
|
2746
|
-
const createFile =
|
|
2688
|
+
const createFile = useCallback14(
|
|
2747
2689
|
async (path) => {
|
|
2748
2690
|
if (!sessionId) throw new Error("no session");
|
|
2749
2691
|
const parent = parentWithinTree(path, rootPath);
|
|
@@ -2767,7 +2709,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2767
2709
|
},
|
|
2768
2710
|
[client, workspaceId, sessionId, rootPath, route, runOptimistic]
|
|
2769
2711
|
);
|
|
2770
|
-
const createDir =
|
|
2712
|
+
const createDir = useCallback14(
|
|
2771
2713
|
async (path) => {
|
|
2772
2714
|
if (!sessionId) throw new Error("no session");
|
|
2773
2715
|
const parent = parentWithinTree(path, rootPath);
|
|
@@ -2790,7 +2732,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2790
2732
|
},
|
|
2791
2733
|
[client, workspaceId, sessionId, rootPath, route, runOptimistic]
|
|
2792
2734
|
);
|
|
2793
|
-
const deleteEntry =
|
|
2735
|
+
const deleteEntry = useCallback14(
|
|
2794
2736
|
async (path, recursive = false) => {
|
|
2795
2737
|
if (!sessionId) throw new Error("no session");
|
|
2796
2738
|
await runOptimistic(
|
|
@@ -2806,7 +2748,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2806
2748
|
},
|
|
2807
2749
|
[client, workspaceId, sessionId, rootPath, route, runOptimistic]
|
|
2808
2750
|
);
|
|
2809
|
-
const moveEntry =
|
|
2751
|
+
const moveEntry = useCallback14(
|
|
2810
2752
|
async (path, newPath, opts) => {
|
|
2811
2753
|
if (!sessionId) throw new Error("no session");
|
|
2812
2754
|
const from = parentWithinTree(path, rootPath);
|
|
@@ -2830,11 +2772,11 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2830
2772
|
},
|
|
2831
2773
|
[client, workspaceId, sessionId, rootPath, route, runOptimistic]
|
|
2832
2774
|
);
|
|
2833
|
-
const captureRef =
|
|
2775
|
+
const captureRef = useRef6(capture);
|
|
2834
2776
|
captureRef.current = capture;
|
|
2835
2777
|
const captureRevision = capture?.revision ?? null;
|
|
2836
|
-
const previousIdentityRef =
|
|
2837
|
-
|
|
2778
|
+
const previousIdentityRef = useRef6(identityKey);
|
|
2779
|
+
useEffect7(() => {
|
|
2838
2780
|
refreshAbortRef.current?.abort();
|
|
2839
2781
|
refreshAbortRef.current = null;
|
|
2840
2782
|
refreshGenerationRef.current += 1;
|
|
@@ -2903,7 +2845,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2903
2845
|
refresh,
|
|
2904
2846
|
seedFromCapture
|
|
2905
2847
|
]);
|
|
2906
|
-
const refreshGitOverlay =
|
|
2848
|
+
const refreshGitOverlay = useCallback14(
|
|
2907
2849
|
async (requestSignal) => {
|
|
2908
2850
|
if (!sessionId) return;
|
|
2909
2851
|
const identityGeneration = identityGenerationRef.current;
|
|
@@ -2940,7 +2882,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2940
2882
|
},
|
|
2941
2883
|
[client, workspaceId, sessionId, repoPaths, rootPath, applyStatus]
|
|
2942
2884
|
);
|
|
2943
|
-
const performEventReconcile =
|
|
2885
|
+
const performEventReconcile = useCallback14(async () => {
|
|
2944
2886
|
const parents = pendingParentsRef.current;
|
|
2945
2887
|
pendingParentsRef.current = /* @__PURE__ */ new Set();
|
|
2946
2888
|
const wantGit = pendingGitRef.current;
|
|
@@ -2950,9 +2892,9 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2950
2892
|
await reconcilePaths(paths, signal);
|
|
2951
2893
|
if (wantGit) await refreshGitOverlay(signal);
|
|
2952
2894
|
}, [reconcilePaths, refreshGitOverlay]);
|
|
2953
|
-
const performEventReconcileRef =
|
|
2895
|
+
const performEventReconcileRef = useRef6(performEventReconcile);
|
|
2954
2896
|
performEventReconcileRef.current = performEventReconcile;
|
|
2955
|
-
const reconcilePendingEvents =
|
|
2897
|
+
const reconcilePendingEvents = useCallback14(async () => {
|
|
2956
2898
|
eventReconcilePendingRef.current = true;
|
|
2957
2899
|
const existing = eventReconcileInFlightRef.current;
|
|
2958
2900
|
if (existing) return await existing;
|
|
@@ -2971,7 +2913,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2971
2913
|
}
|
|
2972
2914
|
}, []);
|
|
2973
2915
|
const events = options.events;
|
|
2974
|
-
|
|
2916
|
+
useEffect7(() => {
|
|
2975
2917
|
if (!enabled || !events) return;
|
|
2976
2918
|
if (!active || !acceptsEventReads) {
|
|
2977
2919
|
for (const event of events) {
|
|
@@ -3029,7 +2971,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
3029
2971
|
void reconcilePendingEvents();
|
|
3030
2972
|
}, 150);
|
|
3031
2973
|
}, [enabled, active, acceptsEventReads, events, rootPath, reconcilePendingEvents]);
|
|
3032
|
-
|
|
2974
|
+
useEffect7(() => {
|
|
3033
2975
|
if (active && acceptsEventReads) return;
|
|
3034
2976
|
if (debounceRef.current) {
|
|
3035
2977
|
clearTimeout(debounceRef.current);
|
|
@@ -3039,7 +2981,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
3039
2981
|
pendingGitRef.current = false;
|
|
3040
2982
|
eventReconcilePendingRef.current = false;
|
|
3041
2983
|
}, [active, acceptsEventReads]);
|
|
3042
|
-
|
|
2984
|
+
useEffect7(
|
|
3043
2985
|
() => () => {
|
|
3044
2986
|
refreshAbortRef.current?.abort();
|
|
3045
2987
|
identityAbortRef.current.abort();
|
|
@@ -3073,7 +3015,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
3073
3015
|
}
|
|
3074
3016
|
|
|
3075
3017
|
// src/hooks/use-sandbox-git.ts
|
|
3076
|
-
import { useCallback as
|
|
3018
|
+
import { useCallback as useCallback15, useEffect as useEffect8, useMemo as useMemo7, useRef as useRef7, useState as useState5 } from "react";
|
|
3077
3019
|
function normalizeRoot2(root) {
|
|
3078
3020
|
const normalized = root.replaceAll("\\", "/").replace(/^\.\/+/, "").replace(/\/+$/, "");
|
|
3079
3021
|
return normalized === "." ? "" : normalized;
|
|
@@ -3145,7 +3087,7 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
3145
3087
|
const capture = comparison === "staged" ? null : options.capture ?? null;
|
|
3146
3088
|
const isLive2 = sandboxAcceptsLiveIo(options.liveness);
|
|
3147
3089
|
const acceptsEventReads = options.liveness === void 0 || isLive2;
|
|
3148
|
-
const acceptsEventReadsRef =
|
|
3090
|
+
const acceptsEventReadsRef = useRef7(acceptsEventReads);
|
|
3149
3091
|
acceptsEventReadsRef.current = acceptsEventReads;
|
|
3150
3092
|
const hasLiveIoFence = options.liveness !== void 0;
|
|
3151
3093
|
const identityKey = `${workspaceId}\0${sessionId ?? ""}\0${repoPathsKey}\0${workspaceWide}\0${comparison}`;
|
|
@@ -3156,18 +3098,18 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
3156
3098
|
const [behind, setBehind] = useState5(0);
|
|
3157
3099
|
const [repoRoots, setRepoRoots] = useState5([]);
|
|
3158
3100
|
const [source, setSource] = useState5(null);
|
|
3159
|
-
const sourceRef =
|
|
3101
|
+
const sourceRef = useRef7(null);
|
|
3160
3102
|
const [loading, setLoading] = useState5(false);
|
|
3161
3103
|
const [error, setError] = useState5(null);
|
|
3162
3104
|
const [stateIdentity, setStateIdentity] = useState5(identityKey);
|
|
3163
|
-
const refreshGenerationRef =
|
|
3164
|
-
const refreshAbortRef =
|
|
3165
|
-
const refreshInFlightRef =
|
|
3166
|
-
const refreshPendingRef =
|
|
3167
|
-
const refreshWorkerEpochRef =
|
|
3168
|
-
const lastChangeRef =
|
|
3169
|
-
const eventRefreshTimerRef =
|
|
3170
|
-
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 () => {
|
|
3171
3113
|
if (!sessionId) return;
|
|
3172
3114
|
const refreshAbort = new AbortController();
|
|
3173
3115
|
refreshAbortRef.current = refreshAbort;
|
|
@@ -3279,9 +3221,9 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
3279
3221
|
workspaceWide,
|
|
3280
3222
|
comparison
|
|
3281
3223
|
]);
|
|
3282
|
-
const performRefreshRef =
|
|
3224
|
+
const performRefreshRef = useRef7(performRefresh);
|
|
3283
3225
|
performRefreshRef.current = performRefresh;
|
|
3284
|
-
const refresh =
|
|
3226
|
+
const refresh = useCallback15(async () => {
|
|
3285
3227
|
refreshPendingRef.current = true;
|
|
3286
3228
|
const existing = refreshInFlightRef.current;
|
|
3287
3229
|
if (existing) return await existing;
|
|
@@ -3299,7 +3241,7 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
3299
3241
|
if (refreshInFlightRef.current === run) refreshInFlightRef.current = null;
|
|
3300
3242
|
}
|
|
3301
3243
|
}, []);
|
|
3302
|
-
const seedFromCapture =
|
|
3244
|
+
const seedFromCapture = useCallback15(
|
|
3303
3245
|
(manifest) => {
|
|
3304
3246
|
const repositories = workspaceWide ? manifest.repos : [repoForPath(manifest, repoPath)].filter(Boolean);
|
|
3305
3247
|
if (comparison === "branch" && repositories.some((repo) => repo.branchDiff === void 0)) {
|
|
@@ -3336,11 +3278,11 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
3336
3278
|
},
|
|
3337
3279
|
[comparison, repoPath, workspaceWide]
|
|
3338
3280
|
);
|
|
3339
|
-
const captureRef =
|
|
3281
|
+
const captureRef = useRef7(capture);
|
|
3340
3282
|
captureRef.current = capture;
|
|
3341
3283
|
const captureRevision = capture?.revision ?? null;
|
|
3342
|
-
const previousIdentityRef =
|
|
3343
|
-
|
|
3284
|
+
const previousIdentityRef = useRef7(identityKey);
|
|
3285
|
+
useEffect8(() => {
|
|
3344
3286
|
refreshAbortRef.current?.abort();
|
|
3345
3287
|
refreshAbortRef.current = null;
|
|
3346
3288
|
refreshPendingRef.current = false;
|
|
@@ -3396,7 +3338,7 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
3396
3338
|
seedFromCapture
|
|
3397
3339
|
]);
|
|
3398
3340
|
const events = options.events;
|
|
3399
|
-
|
|
3341
|
+
useEffect8(() => {
|
|
3400
3342
|
if (!enabled || !events) {
|
|
3401
3343
|
if (eventRefreshTimerRef.current) {
|
|
3402
3344
|
clearTimeout(eventRefreshTimerRef.current);
|
|
@@ -3433,7 +3375,7 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
3433
3375
|
}, 150);
|
|
3434
3376
|
}
|
|
3435
3377
|
}, [enabled, active, acceptsEventReads, events, refresh]);
|
|
3436
|
-
|
|
3378
|
+
useEffect8(
|
|
3437
3379
|
() => () => {
|
|
3438
3380
|
if (eventRefreshTimerRef.current) clearTimeout(eventRefreshTimerRef.current);
|
|
3439
3381
|
},
|
|
@@ -3458,7 +3400,7 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
3458
3400
|
}
|
|
3459
3401
|
|
|
3460
3402
|
// src/hooks/use-workspace-capture.ts
|
|
3461
|
-
import { useCallback as
|
|
3403
|
+
import { useCallback as useCallback16, useEffect as useEffect9, useRef as useRef8, useState as useState6 } from "react";
|
|
3462
3404
|
var REVISION_CAPTURED = "workspace.revision.captured";
|
|
3463
3405
|
var REVISION_DEGRADED = "workspace.revision.degraded";
|
|
3464
3406
|
var MANIFEST_FETCH_TIMEOUT_MS = 15e3;
|
|
@@ -3505,10 +3447,10 @@ function useWorkspaceCapture(sessionId, options = {}) {
|
|
|
3505
3447
|
const [error, setError] = useState6(null);
|
|
3506
3448
|
const [announcedRevision, setAnnouncedRevision] = useState6(null);
|
|
3507
3449
|
const [stateIdentity, setStateIdentity] = useState6(identityKey);
|
|
3508
|
-
const generationRef =
|
|
3509
|
-
const requestAbortRef =
|
|
3510
|
-
const lastSeqRef =
|
|
3511
|
-
const refresh =
|
|
3450
|
+
const generationRef = useRef8(0);
|
|
3451
|
+
const requestAbortRef = useRef8(null);
|
|
3452
|
+
const lastSeqRef = useRef8(0);
|
|
3453
|
+
const refresh = useCallback16(async () => {
|
|
3512
3454
|
if (!sessionId) return;
|
|
3513
3455
|
requestAbortRef.current?.abort();
|
|
3514
3456
|
const requestAbort = new AbortController();
|
|
@@ -3581,7 +3523,7 @@ function useWorkspaceCapture(sessionId, options = {}) {
|
|
|
3581
3523
|
if (requestAbortRef.current === requestAbort) requestAbortRef.current = null;
|
|
3582
3524
|
}
|
|
3583
3525
|
}, [client, workspaceId, sessionId, identityKey]);
|
|
3584
|
-
|
|
3526
|
+
useEffect9(() => {
|
|
3585
3527
|
requestAbortRef.current?.abort();
|
|
3586
3528
|
requestAbortRef.current = null;
|
|
3587
3529
|
generationRef.current += 1;
|
|
@@ -3604,7 +3546,7 @@ function useWorkspaceCapture(sessionId, options = {}) {
|
|
|
3604
3546
|
};
|
|
3605
3547
|
}, [enabled, refresh]);
|
|
3606
3548
|
const events = options.events;
|
|
3607
|
-
|
|
3549
|
+
useEffect9(() => {
|
|
3608
3550
|
if (!enabled || !events) return;
|
|
3609
3551
|
let newest = null;
|
|
3610
3552
|
for (const event of events) {
|
|
@@ -3630,7 +3572,7 @@ function useWorkspaceCapture(sessionId, options = {}) {
|
|
|
3630
3572
|
const visibleCapture = identityMatches ? capture : null;
|
|
3631
3573
|
const visibleAnnouncedRevision = identityMatches ? announcedRevision : null;
|
|
3632
3574
|
const loadedRevision = visibleCapture?.revision ?? null;
|
|
3633
|
-
|
|
3575
|
+
useEffect9(() => {
|
|
3634
3576
|
if (!enabled) return;
|
|
3635
3577
|
if (visibleAnnouncedRevision === null) return;
|
|
3636
3578
|
if (loadedRevision !== null && visibleAnnouncedRevision <= loadedRevision) return;
|
|
@@ -3653,7 +3595,7 @@ function useWorkspaceCapture(sessionId, options = {}) {
|
|
|
3653
3595
|
}
|
|
3654
3596
|
|
|
3655
3597
|
// src/hooks/use-workspace-edit.ts
|
|
3656
|
-
import { useCallback as
|
|
3598
|
+
import { useCallback as useCallback17, useEffect as useEffect10, useMemo as useMemo8, useRef as useRef9, useState as useState7 } from "react";
|
|
3657
3599
|
function isLive(liveness) {
|
|
3658
3600
|
return sandboxAcceptsLiveIo(liveness);
|
|
3659
3601
|
}
|
|
@@ -3677,13 +3619,13 @@ function useWorkspaceEdit(sessionId, options = {}) {
|
|
|
3677
3619
|
const [error, setError] = useState7(null);
|
|
3678
3620
|
const [stateIdentity, setStateIdentity] = useState7(identityKey);
|
|
3679
3621
|
const onWarmRequested = options.onWarmRequested;
|
|
3680
|
-
const bufferRef =
|
|
3622
|
+
const bufferRef = useRef9(null);
|
|
3681
3623
|
bufferRef.current = buffer;
|
|
3682
|
-
const flushingRef =
|
|
3683
|
-
const identityGenerationRef =
|
|
3684
|
-
const flushAttemptRef =
|
|
3685
|
-
const readAbortRef =
|
|
3686
|
-
|
|
3624
|
+
const flushingRef = useRef9(false);
|
|
3625
|
+
const identityGenerationRef = useRef9(0);
|
|
3626
|
+
const flushAttemptRef = useRef9(0);
|
|
3627
|
+
const readAbortRef = useRef9(null);
|
|
3628
|
+
useEffect10(() => {
|
|
3687
3629
|
identityGenerationRef.current += 1;
|
|
3688
3630
|
flushAttemptRef.current += 1;
|
|
3689
3631
|
readAbortRef.current?.abort();
|
|
@@ -3702,7 +3644,7 @@ function useWorkspaceEdit(sessionId, options = {}) {
|
|
|
3702
3644
|
readAbortRef.current = null;
|
|
3703
3645
|
};
|
|
3704
3646
|
}, [identityKey]);
|
|
3705
|
-
const edit =
|
|
3647
|
+
const edit = useCallback17(
|
|
3706
3648
|
(content) => {
|
|
3707
3649
|
if (stateIdentity !== identityKey) return;
|
|
3708
3650
|
if (offline) return;
|
|
@@ -3718,7 +3660,7 @@ function useWorkspaceEdit(sessionId, options = {}) {
|
|
|
3718
3660
|
},
|
|
3719
3661
|
[offline, live, onWarmRequested, stateIdentity, identityKey]
|
|
3720
3662
|
);
|
|
3721
|
-
const doFlush =
|
|
3663
|
+
const doFlush = useCallback17(
|
|
3722
3664
|
async (force) => {
|
|
3723
3665
|
if (stateIdentity !== identityKey) return;
|
|
3724
3666
|
if (!sessionId || !path) return;
|
|
@@ -3773,17 +3715,17 @@ function useWorkspaceEdit(sessionId, options = {}) {
|
|
|
3773
3715
|
},
|
|
3774
3716
|
[client, workspaceId, sessionId, path, baseContent, route, stateIdentity, identityKey]
|
|
3775
3717
|
);
|
|
3776
|
-
|
|
3718
|
+
useEffect10(() => {
|
|
3777
3719
|
if (offline) return;
|
|
3778
3720
|
if (!live) return;
|
|
3779
3721
|
if (buffer === null) return;
|
|
3780
3722
|
if (flush === "flushed" || flush === "conflict" || flush === "flushing") return;
|
|
3781
3723
|
void doFlush(false);
|
|
3782
3724
|
}, [offline, live, buffer, flush, doFlush]);
|
|
3783
|
-
const overwrite =
|
|
3725
|
+
const overwrite = useCallback17(async () => {
|
|
3784
3726
|
await doFlush(true);
|
|
3785
3727
|
}, [doFlush]);
|
|
3786
|
-
const discard =
|
|
3728
|
+
const discard = useCallback17(() => {
|
|
3787
3729
|
setBuffer(null);
|
|
3788
3730
|
setWantsWarm(false);
|
|
3789
3731
|
setFlush("idle");
|
|
@@ -3899,7 +3841,7 @@ function useMachineChip(input) {
|
|
|
3899
3841
|
|
|
3900
3842
|
// src/components/approval-surface.tsx
|
|
3901
3843
|
import { CheckIcon, ShieldCheckIcon, XIcon } from "lucide-react";
|
|
3902
|
-
import { useEffect as
|
|
3844
|
+
import { useEffect as useEffect11, useId, useRef as useRef10, useState as useState8 } from "react";
|
|
3903
3845
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3904
3846
|
var defaultApprovalSurfaceMessages = {
|
|
3905
3847
|
title: "Approval required",
|
|
@@ -3940,9 +3882,9 @@ function ApprovalSurface({
|
|
|
3940
3882
|
const titleId = useId();
|
|
3941
3883
|
const messages = { ...defaultApprovalSurfaceMessages, ...overrides };
|
|
3942
3884
|
const [pending, setPending] = useState8(null);
|
|
3943
|
-
const pendingRef =
|
|
3885
|
+
const pendingRef = useRef10(null);
|
|
3944
3886
|
const [decisionError, setDecisionError] = useState8(null);
|
|
3945
|
-
|
|
3887
|
+
useEffect11(() => {
|
|
3946
3888
|
if (pending && !approvals.some((approval) => approvalOwnershipKey(approval) === pending.approvalKey)) {
|
|
3947
3889
|
if (pendingRef.current?.token === pending.token) {
|
|
3948
3890
|
pendingRef.current = null;
|
|
@@ -4039,152 +3981,9 @@ function ApprovalSurface({
|
|
|
4039
3981
|
);
|
|
4040
3982
|
}
|
|
4041
3983
|
|
|
4042
|
-
// src/components/chat-composer.tsx
|
|
4043
|
-
import { LayoutGroup, motion } from "motion/react";
|
|
4044
|
-
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
4045
|
-
function ChatComposer({
|
|
4046
|
-
composer,
|
|
4047
|
-
responsiveBasis,
|
|
4048
|
-
effectiveControl,
|
|
4049
|
-
queuedAheadCount,
|
|
4050
|
-
canControlWorkspace,
|
|
4051
|
-
controlLinks,
|
|
4052
|
-
placeholder,
|
|
4053
|
-
disabled,
|
|
4054
|
-
autoFocus,
|
|
4055
|
-
hint,
|
|
4056
|
-
controlsLeading,
|
|
4057
|
-
controlsStart,
|
|
4058
|
-
actionsStart,
|
|
4059
|
-
attachButtonClassName,
|
|
4060
|
-
transcription,
|
|
4061
|
-
transcriptionClassName,
|
|
4062
|
-
transcriptionSuppressed = false,
|
|
4063
|
-
header,
|
|
4064
|
-
onPaste,
|
|
4065
|
-
attachments,
|
|
4066
|
-
models,
|
|
4067
|
-
selectedModel,
|
|
4068
|
-
onSelectModel,
|
|
4069
|
-
className,
|
|
4070
|
-
commands,
|
|
4071
|
-
commandContext,
|
|
4072
|
-
onClearView,
|
|
4073
|
-
messages
|
|
4074
|
-
}) {
|
|
4075
|
-
const controller = useChatComposerController({
|
|
4076
|
-
delivery: composer,
|
|
4077
|
-
draft: composer,
|
|
4078
|
-
control: composer,
|
|
4079
|
-
effectiveControl,
|
|
4080
|
-
queuedAheadCount,
|
|
4081
|
-
canControlWorkspace,
|
|
4082
|
-
controlLinks,
|
|
4083
|
-
disabled,
|
|
4084
|
-
attachments,
|
|
4085
|
-
commands,
|
|
4086
|
-
commandContext,
|
|
4087
|
-
onClearView,
|
|
4088
|
-
onPaste,
|
|
4089
|
-
messages
|
|
4090
|
-
});
|
|
4091
|
-
const hasControls = Boolean(
|
|
4092
|
-
attachments || models || controlsLeading || controlsStart || transcription
|
|
4093
|
-
);
|
|
4094
|
-
const stackActions = hasControls && Boolean(actionsStart);
|
|
4095
|
-
return /* @__PURE__ */ jsx2(Fragment2, { children: /* @__PURE__ */ jsxs2(Root, { controller, responsiveBasis, className, children: [
|
|
4096
|
-
/* @__PURE__ */ jsxs2(Frame, { children: [
|
|
4097
|
-
/* @__PURE__ */ jsx2(CommandPalette2, {}),
|
|
4098
|
-
/* @__PURE__ */ jsxs2(Surface, { children: [
|
|
4099
|
-
/* @__PURE__ */ jsx2(PausedState, {}),
|
|
4100
|
-
/* @__PURE__ */ jsx2(RestoredResources, {}),
|
|
4101
|
-
/* @__PURE__ */ jsx2(Attachments, {}),
|
|
4102
|
-
header,
|
|
4103
|
-
composer.annotations && composer.annotations.length > 0 ? /* @__PURE__ */ jsx2("div", { className: "px-3 pt-2 sm:px-4", children: /* @__PURE__ */ jsx2(
|
|
4104
|
-
TimelineAnnotationsChip,
|
|
4105
|
-
{
|
|
4106
|
-
annotations: composer.annotations,
|
|
4107
|
-
editable: true,
|
|
4108
|
-
focusAnnotationId: composer.annotationReviewTargetId,
|
|
4109
|
-
onFocusConsumed: composer.clearAnnotationReviewTarget,
|
|
4110
|
-
onUpdate: composer.updateAnnotation,
|
|
4111
|
-
onRemove: composer.removeAnnotation
|
|
4112
|
-
}
|
|
4113
|
-
) }) : null,
|
|
4114
|
-
/* @__PURE__ */ jsx2(Input, { placeholder, autoFocus }),
|
|
4115
|
-
controller.confirmState ? /* @__PURE__ */ jsx2(Confirmation, {}) : /* @__PURE__ */ jsx2(
|
|
4116
|
-
Footer,
|
|
4117
|
-
{
|
|
4118
|
-
"data-og-stack-actions": stackActions ? "" : void 0,
|
|
4119
|
-
className: stackActions ? "max-sm:flex-nowrap sm:flex-wrap" : void 0,
|
|
4120
|
-
children: /* @__PURE__ */ jsxs2(LayoutGroup, { id: "og-composer-footer", children: [
|
|
4121
|
-
hasControls ? /* @__PURE__ */ jsxs2(
|
|
4122
|
-
Controls,
|
|
4123
|
-
{
|
|
4124
|
-
className: stackActions ? "min-w-0 max-sm:flex-1 sm:w-auto" : void 0,
|
|
4125
|
-
children: [
|
|
4126
|
-
controlsLeading,
|
|
4127
|
-
/* @__PURE__ */ jsx2(AttachButton, { className: attachButtonClassName }),
|
|
4128
|
-
transcription ? /* @__PURE__ */ jsx2(
|
|
4129
|
-
ComposerTranscriptionControl,
|
|
4130
|
-
{
|
|
4131
|
-
...transcription,
|
|
4132
|
-
suppressed: transcriptionSuppressed,
|
|
4133
|
-
className: [transcription.className, transcriptionClassName].filter(Boolean).join(" ")
|
|
4134
|
-
}
|
|
4135
|
-
) : null,
|
|
4136
|
-
models ? /* @__PURE__ */ jsx2(
|
|
4137
|
-
motion.span,
|
|
4138
|
-
{
|
|
4139
|
-
layout: true,
|
|
4140
|
-
transition: { duration: 0.36, ease: [0.22, 1, 0.36, 1] },
|
|
4141
|
-
className: "inline-flex min-w-0",
|
|
4142
|
-
children: /* @__PURE__ */ jsx2(
|
|
4143
|
-
ModelPicker2,
|
|
4144
|
-
{
|
|
4145
|
-
models,
|
|
4146
|
-
value: selectedModel,
|
|
4147
|
-
onChange: onSelectModel
|
|
4148
|
-
}
|
|
4149
|
-
)
|
|
4150
|
-
}
|
|
4151
|
-
) : null,
|
|
4152
|
-
controlsStart ? /* @__PURE__ */ jsx2(
|
|
4153
|
-
motion.span,
|
|
4154
|
-
{
|
|
4155
|
-
layout: true,
|
|
4156
|
-
transition: { duration: 0.36, ease: [0.22, 1, 0.36, 1] },
|
|
4157
|
-
className: "inline-flex min-w-0 flex-1 items-center gap-1.5",
|
|
4158
|
-
children: controlsStart
|
|
4159
|
-
}
|
|
4160
|
-
) : null
|
|
4161
|
-
]
|
|
4162
|
-
}
|
|
4163
|
-
) : /* @__PURE__ */ jsx2(Hint, { children: hint }),
|
|
4164
|
-
/* @__PURE__ */ jsxs2(
|
|
4165
|
-
Actions,
|
|
4166
|
-
{
|
|
4167
|
-
className: stackActions ? "max-sm:shrink-0 sm:w-auto sm:justify-end" : void 0,
|
|
4168
|
-
children: [
|
|
4169
|
-
actionsStart,
|
|
4170
|
-
/* @__PURE__ */ jsx2(PauseButton, {}),
|
|
4171
|
-
/* @__PURE__ */ jsx2(SendButton, {})
|
|
4172
|
-
]
|
|
4173
|
-
}
|
|
4174
|
-
)
|
|
4175
|
-
] })
|
|
4176
|
-
}
|
|
4177
|
-
)
|
|
4178
|
-
] })
|
|
4179
|
-
] }),
|
|
4180
|
-
/* @__PURE__ */ jsx2(Help, {}),
|
|
4181
|
-
/* @__PURE__ */ jsx2(Status, {})
|
|
4182
|
-
] }) });
|
|
4183
|
-
}
|
|
4184
|
-
|
|
4185
3984
|
// src/components/fleet-tile.tsx
|
|
4186
3985
|
import { deriveSessionDisplayTitle } from "@opengeni/sdk";
|
|
4187
|
-
import { jsx as
|
|
3986
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
4188
3987
|
var SESSION_METADATA_TITLE_KEYS = ["title", "name"];
|
|
4189
3988
|
function sessionDisplayTitle(session) {
|
|
4190
3989
|
return deriveSessionDisplayTitle(session, { metadataKeys: SESSION_METADATA_TITLE_KEYS });
|
|
@@ -4192,7 +3991,7 @@ function sessionDisplayTitle(session) {
|
|
|
4192
3991
|
function FleetTile({ session, title, subtitle, onOpen, className }) {
|
|
4193
3992
|
const running = session.status === "running" || session.status === "queued";
|
|
4194
3993
|
const needsYou = session.status === "requires_action";
|
|
4195
|
-
return /* @__PURE__ */
|
|
3994
|
+
return /* @__PURE__ */ jsxs2(
|
|
4196
3995
|
"button",
|
|
4197
3996
|
{
|
|
4198
3997
|
type: "button",
|
|
@@ -4208,7 +4007,7 @@ function FleetTile({ session, title, subtitle, onOpen, className }) {
|
|
|
4208
4007
|
className
|
|
4209
4008
|
),
|
|
4210
4009
|
children: [
|
|
4211
|
-
/* @__PURE__ */
|
|
4010
|
+
/* @__PURE__ */ jsx2(
|
|
4212
4011
|
"span",
|
|
4213
4012
|
{
|
|
4214
4013
|
"aria-hidden": true,
|
|
@@ -4218,16 +4017,16 @@ function FleetTile({ session, title, subtitle, onOpen, className }) {
|
|
|
4218
4017
|
)
|
|
4219
4018
|
}
|
|
4220
4019
|
),
|
|
4221
|
-
/* @__PURE__ */
|
|
4222
|
-
/* @__PURE__ */
|
|
4223
|
-
/* @__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" })
|
|
4224
4023
|
] }),
|
|
4225
|
-
subtitle ? /* @__PURE__ */
|
|
4226
|
-
/* @__PURE__ */
|
|
4227
|
-
/* @__PURE__ */
|
|
4228
|
-
/* @__PURE__ */
|
|
4229
|
-
/* @__PURE__ */
|
|
4230
|
-
/* @__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) })
|
|
4231
4030
|
] })
|
|
4232
4031
|
]
|
|
4233
4032
|
}
|
|
@@ -4235,7 +4034,7 @@ function FleetTile({ session, title, subtitle, onOpen, className }) {
|
|
|
4235
4034
|
}
|
|
4236
4035
|
|
|
4237
4036
|
// src/components/sandbox-terminal.tsx
|
|
4238
|
-
import { useEffect as
|
|
4037
|
+
import { useEffect as useEffect12, useLayoutEffect, useRef as useRef11, useState as useState9 } from "react";
|
|
4239
4038
|
|
|
4240
4039
|
// src/lib/xterm-theme.ts
|
|
4241
4040
|
var DARK_ANSI = {
|
|
@@ -4388,7 +4187,7 @@ async function attachRenderer(prefer, loaders, onTier) {
|
|
|
4388
4187
|
}
|
|
4389
4188
|
|
|
4390
4189
|
// src/components/sandbox-terminal.tsx
|
|
4391
|
-
import { jsx as
|
|
4190
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
4392
4191
|
function terminalSurfaceState(input) {
|
|
4393
4192
|
if (!input.ready) return "loading";
|
|
4394
4193
|
if (input.acceptsInput) return "interactive";
|
|
@@ -4430,13 +4229,13 @@ function SandboxTerminal({
|
|
|
4430
4229
|
onReconnectNeeded,
|
|
4431
4230
|
className
|
|
4432
4231
|
}) {
|
|
4433
|
-
const containerRef =
|
|
4434
|
-
const termRef =
|
|
4435
|
-
const fitRef =
|
|
4436
|
-
const rendererRef =
|
|
4437
|
-
const writtenRef =
|
|
4438
|
-
const wroteFirehoseRef =
|
|
4439
|
-
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);
|
|
4440
4239
|
const [ready, setReady] = useState9(false);
|
|
4441
4240
|
const [inputReady, setInputReady] = useState9(false);
|
|
4442
4241
|
const [activated, setActivated] = useState9(false);
|
|
@@ -4492,7 +4291,7 @@ function SandboxTerminal({
|
|
|
4492
4291
|
if (!activated) setActivated(true);
|
|
4493
4292
|
onActivate?.();
|
|
4494
4293
|
}
|
|
4495
|
-
|
|
4294
|
+
useEffect12(() => {
|
|
4496
4295
|
if (typeof window === "undefined") return;
|
|
4497
4296
|
const el = containerRef.current;
|
|
4498
4297
|
if (!el) return;
|
|
@@ -4606,13 +4405,13 @@ function SandboxTerminal({
|
|
|
4606
4405
|
term.options.disableStdin = !interactive;
|
|
4607
4406
|
term.options.cursorBlink = interactive;
|
|
4608
4407
|
}, [ready, interactive]);
|
|
4609
|
-
|
|
4408
|
+
useEffect12(() => {
|
|
4610
4409
|
const term = termRef.current;
|
|
4611
4410
|
if (!ready || !term) return;
|
|
4612
4411
|
const next = theme ?? xtermThemeFromTokens(containerRef.current);
|
|
4613
4412
|
if (next) term.options.theme = next;
|
|
4614
4413
|
}, [ready, theme]);
|
|
4615
|
-
|
|
4414
|
+
useEffect12(() => {
|
|
4616
4415
|
const term = termRef.current;
|
|
4617
4416
|
if (!ready || !term) return;
|
|
4618
4417
|
if (!booting) {
|
|
@@ -4633,7 +4432,7 @@ function SandboxTerminal({
|
|
|
4633
4432
|
const id = setInterval(paint, 1e3);
|
|
4634
4433
|
return () => clearInterval(id);
|
|
4635
4434
|
}, [ready, booting]);
|
|
4636
|
-
|
|
4435
|
+
useEffect12(() => {
|
|
4637
4436
|
const term = termRef.current;
|
|
4638
4437
|
if (!ready || !term || ptyMode) return;
|
|
4639
4438
|
for (const chunk of result.chunks) {
|
|
@@ -4658,14 +4457,14 @@ function SandboxTerminal({
|
|
|
4658
4457
|
setInputReady(sub !== null);
|
|
4659
4458
|
return () => sub?.dispose();
|
|
4660
4459
|
}, [ready, interactive, ptyAttachable, ptyWrite, result.write]);
|
|
4661
|
-
|
|
4460
|
+
useEffect12(() => {
|
|
4662
4461
|
const term = termRef.current;
|
|
4663
4462
|
if (!ready || !term || !ptyMode) return;
|
|
4664
4463
|
resizePty(term.cols, term.rows);
|
|
4665
4464
|
const sub = term.onResize(({ cols, rows }) => resizePty(cols, rows));
|
|
4666
4465
|
return () => sub.dispose();
|
|
4667
4466
|
}, [ready, ptyMode, ptyConnected, resizePty]);
|
|
4668
|
-
|
|
4467
|
+
useEffect12(() => {
|
|
4669
4468
|
if (typeof window === "undefined") return;
|
|
4670
4469
|
const refit = () => {
|
|
4671
4470
|
try {
|
|
@@ -4685,10 +4484,10 @@ function SandboxTerminal({
|
|
|
4685
4484
|
observer?.disconnect();
|
|
4686
4485
|
};
|
|
4687
4486
|
}, [ready]);
|
|
4688
|
-
return /* @__PURE__ */
|
|
4689
|
-
showHeader && /* @__PURE__ */
|
|
4690
|
-
/* @__PURE__ */
|
|
4691
|
-
/* @__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(
|
|
4692
4491
|
"span",
|
|
4693
4492
|
{
|
|
4694
4493
|
className: cn(
|
|
@@ -4697,13 +4496,13 @@ function SandboxTerminal({
|
|
|
4697
4496
|
)
|
|
4698
4497
|
}
|
|
4699
4498
|
),
|
|
4700
|
-
/* @__PURE__ */
|
|
4499
|
+
/* @__PURE__ */ jsxs3("span", { className: "truncate font-og-mono", children: [
|
|
4701
4500
|
"pty: ",
|
|
4702
4501
|
shell ?? "shell"
|
|
4703
4502
|
] })
|
|
4704
4503
|
] }),
|
|
4705
|
-
/* @__PURE__ */
|
|
4706
|
-
terminalModeLabel && /* @__PURE__ */
|
|
4504
|
+
/* @__PURE__ */ jsxs3("span", { className: "flex shrink-0 items-center gap-2", children: [
|
|
4505
|
+
terminalModeLabel && /* @__PURE__ */ jsx3(
|
|
4707
4506
|
"span",
|
|
4708
4507
|
{
|
|
4709
4508
|
className: "rounded-og-sm bg-og-surface-2 px-1.5 py-0.5 text-og-xs uppercase tracking-wide",
|
|
@@ -4711,7 +4510,7 @@ function SandboxTerminal({
|
|
|
4711
4510
|
children: terminalModeLabel
|
|
4712
4511
|
}
|
|
4713
4512
|
),
|
|
4714
|
-
/* @__PURE__ */
|
|
4513
|
+
/* @__PURE__ */ jsx3(
|
|
4715
4514
|
"button",
|
|
4716
4515
|
{
|
|
4717
4516
|
type: "button",
|
|
@@ -4726,15 +4525,15 @@ function SandboxTerminal({
|
|
|
4726
4525
|
)
|
|
4727
4526
|
] })
|
|
4728
4527
|
] }),
|
|
4729
|
-
/* @__PURE__ */
|
|
4528
|
+
/* @__PURE__ */ jsxs3(
|
|
4730
4529
|
"div",
|
|
4731
4530
|
{
|
|
4732
4531
|
className: "relative min-h-0 flex-1 bg-og-bg p-3",
|
|
4733
4532
|
onPointerDownCapture: handleActivate,
|
|
4734
4533
|
onFocusCapture: handleActivate,
|
|
4735
4534
|
children: [
|
|
4736
|
-
!ready && (placeholder ?? /* @__PURE__ */
|
|
4737
|
-
/* @__PURE__ */
|
|
4535
|
+
!ready && (placeholder ?? /* @__PURE__ */ jsx3(TerminalPlaceholder, {})),
|
|
4536
|
+
/* @__PURE__ */ jsx3(
|
|
4738
4537
|
"div",
|
|
4739
4538
|
{
|
|
4740
4539
|
ref: containerRef,
|
|
@@ -4794,7 +4593,7 @@ function ensureXtermBaseCss() {
|
|
|
4794
4593
|
document.head.appendChild(style);
|
|
4795
4594
|
}
|
|
4796
4595
|
function TerminalPlaceholder() {
|
|
4797
|
-
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" });
|
|
4798
4597
|
}
|
|
4799
4598
|
|
|
4800
4599
|
// src/components/file-browser.tsx
|
|
@@ -4810,24 +4609,24 @@ import {
|
|
|
4810
4609
|
Trash2Icon
|
|
4811
4610
|
} from "lucide-react";
|
|
4812
4611
|
import {
|
|
4813
|
-
useCallback as
|
|
4814
|
-
useEffect as
|
|
4612
|
+
useCallback as useCallback18,
|
|
4613
|
+
useEffect as useEffect14,
|
|
4815
4614
|
useId as useId2,
|
|
4816
4615
|
useLayoutEffect as useLayoutEffect2,
|
|
4817
4616
|
useMemo as useMemo11,
|
|
4818
|
-
useRef as
|
|
4617
|
+
useRef as useRef12,
|
|
4819
4618
|
useState as useState10
|
|
4820
4619
|
} from "react";
|
|
4821
4620
|
import { AlertDialog } from "radix-ui";
|
|
4822
4621
|
import { VList } from "virtua";
|
|
4823
4622
|
|
|
4824
4623
|
// src/lib/use-unicode-fonts.ts
|
|
4825
|
-
import { useEffect as
|
|
4624
|
+
import { useEffect as useEffect13, useMemo as useMemo10 } from "react";
|
|
4826
4625
|
var japaneseScript = /[\u3040-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff]/u;
|
|
4827
4626
|
var arabicScript = /[\u0600-\u06ff\u0750-\u077f\u0870-\u08ff\ufb50-\ufdff\ufe70-\ufefc]/u;
|
|
4828
4627
|
function useUnicodeFallbackFonts(values) {
|
|
4829
4628
|
const content = useMemo10(() => collectUnicodeContent(values), [values]);
|
|
4830
|
-
|
|
4629
|
+
useEffect13(() => {
|
|
4831
4630
|
if (content.japanese) {
|
|
4832
4631
|
void import("./noto-sans-jp-loader.generated-HFGLYBR3.js").then(({ loadNotoSansJp }) => loadNotoSansJp(content.japanese)).catch(() => void 0);
|
|
4833
4632
|
}
|
|
@@ -4849,7 +4648,7 @@ function collectUnicodeContent(values) {
|
|
|
4849
4648
|
}
|
|
4850
4649
|
|
|
4851
4650
|
// src/components/file-browser.tsx
|
|
4852
|
-
import { Fragment as
|
|
4651
|
+
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
4853
4652
|
var STATUS_TINT = {
|
|
4854
4653
|
added: "text-og-status-idle",
|
|
4855
4654
|
modified: "text-og-status-running",
|
|
@@ -4857,7 +4656,7 @@ var STATUS_TINT = {
|
|
|
4857
4656
|
renamed: "text-og-accent",
|
|
4858
4657
|
untracked: "text-og-fg-subtle"
|
|
4859
4658
|
};
|
|
4860
|
-
var useBrowserLayoutEffect = typeof window === "undefined" ?
|
|
4659
|
+
var useBrowserLayoutEffect = typeof window === "undefined" ? useEffect14 : useLayoutEffect2;
|
|
4861
4660
|
function parentOf2(path) {
|
|
4862
4661
|
const i = path.lastIndexOf("/");
|
|
4863
4662
|
return i <= 0 ? "" : path.slice(0, i);
|
|
@@ -4938,15 +4737,15 @@ function FileBrowser({
|
|
|
4938
4737
|
const [busy, setBusy] = useState10(false);
|
|
4939
4738
|
const [coarsePointer, setCoarsePointer] = useState10(false);
|
|
4940
4739
|
const [revealRequest, setRevealRequest] = useState10(null);
|
|
4941
|
-
const handledRevealRequestRef =
|
|
4942
|
-
const attemptedRevealPathsRef =
|
|
4740
|
+
const handledRevealRequestRef = useRef12(null);
|
|
4741
|
+
const attemptedRevealPathsRef = useRef12(/* @__PURE__ */ new Set());
|
|
4943
4742
|
const treeId = useId2();
|
|
4944
4743
|
const container = usePortalTokenSource();
|
|
4945
4744
|
const containerRef = container.currentRef;
|
|
4946
|
-
const deleteReturnFocusRef =
|
|
4947
|
-
const vlistRef =
|
|
4745
|
+
const deleteReturnFocusRef = useRef12(null);
|
|
4746
|
+
const vlistRef = useRef12(null);
|
|
4948
4747
|
const portalTokenStyle = usePortalTokenStyle(container.source);
|
|
4949
|
-
const getTreeElement =
|
|
4748
|
+
const getTreeElement = useCallback18(
|
|
4950
4749
|
() => typeof document === "undefined" ? null : document.getElementById(treeId),
|
|
4951
4750
|
[treeId]
|
|
4952
4751
|
);
|
|
@@ -4969,7 +4768,7 @@ function FileBrowser({
|
|
|
4969
4768
|
}
|
|
4970
4769
|
}, []);
|
|
4971
4770
|
const effectiveRevealRequestId = revealPath ? revealPathRequestId ?? revealPath : null;
|
|
4972
|
-
|
|
4771
|
+
useEffect14(() => {
|
|
4973
4772
|
if (!revealPath || effectiveRevealRequestId === null) {
|
|
4974
4773
|
setRevealRequest(null);
|
|
4975
4774
|
return;
|
|
@@ -4986,10 +4785,10 @@ function FileBrowser({
|
|
|
4986
4785
|
}, [effectiveRevealRequestId, revealPath]);
|
|
4987
4786
|
const visibleActive = active && findNode(visibleTree, active) ? active : null;
|
|
4988
4787
|
const cursor = visibleActive ?? (selectedPath && findNode(visibleTree, selectedPath) ? selectedPath : null);
|
|
4989
|
-
|
|
4788
|
+
useEffect14(() => {
|
|
4990
4789
|
if (active !== null && visibleActive === null) setActive(null);
|
|
4991
4790
|
}, [active, visibleActive]);
|
|
4992
|
-
const expand =
|
|
4791
|
+
const expand = useCallback18(
|
|
4993
4792
|
async (path) => {
|
|
4994
4793
|
const node = findNode(visibleTree, path);
|
|
4995
4794
|
if (node && node.kind === "dir" && node.children === void 0) {
|
|
@@ -5007,14 +4806,14 @@ function FileBrowser({
|
|
|
5007
4806
|
},
|
|
5008
4807
|
[result, visibleTree]
|
|
5009
4808
|
);
|
|
5010
|
-
const open =
|
|
4809
|
+
const open = useCallback18(
|
|
5011
4810
|
(path) => {
|
|
5012
4811
|
setExpanded((prev) => new Set(prev).add(path));
|
|
5013
4812
|
void expand(path);
|
|
5014
4813
|
},
|
|
5015
4814
|
[expand]
|
|
5016
4815
|
);
|
|
5017
|
-
|
|
4816
|
+
useEffect14(() => {
|
|
5018
4817
|
if (!revealRequest) return;
|
|
5019
4818
|
const trace = traceRevealPath(visibleTree, revealRequest.path);
|
|
5020
4819
|
if (trace.directories.length > 0) {
|
|
@@ -5036,7 +4835,7 @@ function FileBrowser({
|
|
|
5036
4835
|
attemptedRevealPathsRef.current.add(frontier);
|
|
5037
4836
|
void expand(frontier);
|
|
5038
4837
|
}, [expand, loadingPaths, result.expandingPaths, revealRequest, visibleTree]);
|
|
5039
|
-
const toggle =
|
|
4838
|
+
const toggle = useCallback18(
|
|
5040
4839
|
async (node) => {
|
|
5041
4840
|
if (node.kind !== "dir") return;
|
|
5042
4841
|
const isOpen = expanded.has(node.path);
|
|
@@ -5111,7 +4910,7 @@ function FileBrowser({
|
|
|
5111
4910
|
const cursorIndex = cursor ? rowIndexByPath.get(cursor) ?? -1 : -1;
|
|
5112
4911
|
const activeDescendantId = cursorIndex >= 0 ? `${treeId}-item-${cursorIndex}` : void 0;
|
|
5113
4912
|
const supportsMutation = editable && result.source === "live" && result.error === null && !result.loading;
|
|
5114
|
-
const performDelete =
|
|
4913
|
+
const performDelete = useCallback18(
|
|
5115
4914
|
async (node) => {
|
|
5116
4915
|
if (!supportsMutation) return;
|
|
5117
4916
|
const recursive = node.kind === "dir";
|
|
@@ -5125,7 +4924,7 @@ function FileBrowser({
|
|
|
5125
4924
|
},
|
|
5126
4925
|
[supportsMutation, result]
|
|
5127
4926
|
);
|
|
5128
|
-
const runDelete =
|
|
4927
|
+
const runDelete = useCallback18(
|
|
5129
4928
|
async (node, returnFocus) => {
|
|
5130
4929
|
if (!supportsMutation) return;
|
|
5131
4930
|
setMenu(null);
|
|
@@ -5138,7 +4937,7 @@ function FileBrowser({
|
|
|
5138
4937
|
},
|
|
5139
4938
|
[supportsMutation, confirmDelete, performDelete]
|
|
5140
4939
|
);
|
|
5141
|
-
const closePendingDelete =
|
|
4940
|
+
const closePendingDelete = useCallback18(
|
|
5142
4941
|
(restoreTrigger) => {
|
|
5143
4942
|
const returnTarget = restoreTrigger ? deleteReturnFocusRef.current : getTreeElement();
|
|
5144
4943
|
deleteReturnFocusRef.current = null;
|
|
@@ -5152,7 +4951,7 @@ function FileBrowser({
|
|
|
5152
4951
|
},
|
|
5153
4952
|
[getTreeElement]
|
|
5154
4953
|
);
|
|
5155
|
-
const commitCreate =
|
|
4954
|
+
const commitCreate = useCallback18(
|
|
5156
4955
|
async (name) => {
|
|
5157
4956
|
const draft = draftCreate;
|
|
5158
4957
|
setDraftCreate(null);
|
|
@@ -5177,7 +4976,7 @@ function FileBrowser({
|
|
|
5177
4976
|
},
|
|
5178
4977
|
[draftCreate, supportsMutation, result, open, onSelectFile]
|
|
5179
4978
|
);
|
|
5180
|
-
const commitRename =
|
|
4979
|
+
const commitRename = useCallback18(
|
|
5181
4980
|
async (name) => {
|
|
5182
4981
|
const draft = draftRename;
|
|
5183
4982
|
setDraftRename(null);
|
|
@@ -5200,7 +4999,7 @@ function FileBrowser({
|
|
|
5200
4999
|
},
|
|
5201
5000
|
[draftRename, supportsMutation, result, selectedPath, active, onSelectFile, visibleTree]
|
|
5202
5001
|
);
|
|
5203
|
-
const startCreate =
|
|
5002
|
+
const startCreate = useCallback18(
|
|
5204
5003
|
(kind) => {
|
|
5205
5004
|
if (!supportsMutation) return;
|
|
5206
5005
|
const anchor = cursor ? findNode(visibleTree, cursor) : void 0;
|
|
@@ -5212,7 +5011,7 @@ function FileBrowser({
|
|
|
5212
5011
|
},
|
|
5213
5012
|
[supportsMutation, cursor, open, visibleTree]
|
|
5214
5013
|
);
|
|
5215
|
-
const startRename =
|
|
5014
|
+
const startRename = useCallback18(
|
|
5216
5015
|
(node) => {
|
|
5217
5016
|
if (!supportsMutation) return;
|
|
5218
5017
|
setDraftCreate(null);
|
|
@@ -5221,7 +5020,7 @@ function FileBrowser({
|
|
|
5221
5020
|
},
|
|
5222
5021
|
[supportsMutation]
|
|
5223
5022
|
);
|
|
5224
|
-
const onDropOnto =
|
|
5023
|
+
const onDropOnto = useCallback18(
|
|
5225
5024
|
async (targetDir, sourcePath) => {
|
|
5226
5025
|
setDragOver(null);
|
|
5227
5026
|
if (!supportsMutation || !sourcePath) return;
|
|
@@ -5245,7 +5044,7 @@ function FileBrowser({
|
|
|
5245
5044
|
},
|
|
5246
5045
|
[supportsMutation, result, selectedPath, active, onSelectFile, visibleTree]
|
|
5247
5046
|
);
|
|
5248
|
-
const onKeyDown =
|
|
5047
|
+
const onKeyDown = useCallback18(
|
|
5249
5048
|
(e) => {
|
|
5250
5049
|
if (draftCreate || draftRename) return;
|
|
5251
5050
|
if (flatRows.length === 0) return;
|
|
@@ -5364,7 +5163,7 @@ function FileBrowser({
|
|
|
5364
5163
|
treeId
|
|
5365
5164
|
]
|
|
5366
5165
|
);
|
|
5367
|
-
|
|
5166
|
+
useEffect14(() => {
|
|
5368
5167
|
if (!menu) return;
|
|
5369
5168
|
const close = () => setMenu(null);
|
|
5370
5169
|
window.addEventListener("click", close);
|
|
@@ -5384,7 +5183,7 @@ function FileBrowser({
|
|
|
5384
5183
|
const renderNodeRow = (node, depth) => {
|
|
5385
5184
|
const isOpen = expanded.has(node.path);
|
|
5386
5185
|
if (renderNode) {
|
|
5387
|
-
return /* @__PURE__ */
|
|
5186
|
+
return /* @__PURE__ */ jsx4("div", { children: renderNode(node, depth, isOpen) });
|
|
5388
5187
|
}
|
|
5389
5188
|
const isDir = node.kind === "dir";
|
|
5390
5189
|
const isSelected = node.path === selectedPath || node.path === active;
|
|
@@ -5394,7 +5193,7 @@ function FileBrowser({
|
|
|
5394
5193
|
const isDropTarget = dragOver === (isDir ? node.path : parentOf2(node.path));
|
|
5395
5194
|
const dropDir = isDir ? node.path : parentOf2(node.path);
|
|
5396
5195
|
const treePosition = treePositionByPath.get(node.path);
|
|
5397
|
-
return /* @__PURE__ */
|
|
5196
|
+
return /* @__PURE__ */ jsx4(
|
|
5398
5197
|
"div",
|
|
5399
5198
|
{
|
|
5400
5199
|
id: `${treeId}-item-${rowIndexByPath.get(node.path) ?? 0}`,
|
|
@@ -5420,7 +5219,7 @@ function FileBrowser({
|
|
|
5420
5219
|
const src = e.dataTransfer.getData("text/og-path");
|
|
5421
5220
|
void onDropOnto(dropDir, src);
|
|
5422
5221
|
} : void 0,
|
|
5423
|
-
children: isRenaming ? /* @__PURE__ */
|
|
5222
|
+
children: isRenaming ? /* @__PURE__ */ jsx4(
|
|
5424
5223
|
InlineInput,
|
|
5425
5224
|
{
|
|
5426
5225
|
depth,
|
|
@@ -5429,7 +5228,7 @@ function FileBrowser({
|
|
|
5429
5228
|
onCommit: (name) => void commitRename(name),
|
|
5430
5229
|
onCancel: () => setDraftRename(null)
|
|
5431
5230
|
}
|
|
5432
|
-
) : /* @__PURE__ */
|
|
5231
|
+
) : /* @__PURE__ */ jsxs4(
|
|
5433
5232
|
"button",
|
|
5434
5233
|
{
|
|
5435
5234
|
type: "button",
|
|
@@ -5463,7 +5262,7 @@ function FileBrowser({
|
|
|
5463
5262
|
),
|
|
5464
5263
|
style: { paddingLeft: `${depth * 12 + 4}px` },
|
|
5465
5264
|
children: [
|
|
5466
|
-
isDir ? /* @__PURE__ */
|
|
5265
|
+
isDir ? /* @__PURE__ */ jsx4(
|
|
5467
5266
|
ChevronRightIcon,
|
|
5468
5267
|
{
|
|
5469
5268
|
className: cn(
|
|
@@ -5472,10 +5271,10 @@ function FileBrowser({
|
|
|
5472
5271
|
isLoading && "text-og-accent"
|
|
5473
5272
|
)
|
|
5474
5273
|
}
|
|
5475
|
-
) : /* @__PURE__ */
|
|
5476
|
-
isDir ? /* @__PURE__ */
|
|
5477
|
-
/* @__PURE__ */
|
|
5478
|
-
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(
|
|
5479
5278
|
"span",
|
|
5480
5279
|
{
|
|
5481
5280
|
role: "button",
|
|
@@ -5503,7 +5302,7 @@ function FileBrowser({
|
|
|
5503
5302
|
case "node":
|
|
5504
5303
|
return renderNodeRow(item.node, item.depth);
|
|
5505
5304
|
case "create":
|
|
5506
|
-
return /* @__PURE__ */
|
|
5305
|
+
return /* @__PURE__ */ jsx4(
|
|
5507
5306
|
InlineInput,
|
|
5508
5307
|
{
|
|
5509
5308
|
depth: item.depth,
|
|
@@ -5514,14 +5313,14 @@ function FileBrowser({
|
|
|
5514
5313
|
}
|
|
5515
5314
|
);
|
|
5516
5315
|
case "skeleton":
|
|
5517
|
-
return /* @__PURE__ */
|
|
5316
|
+
return /* @__PURE__ */ jsx4(
|
|
5518
5317
|
"div",
|
|
5519
5318
|
{
|
|
5520
5319
|
role: "group",
|
|
5521
5320
|
"aria-hidden": true,
|
|
5522
5321
|
style: { paddingLeft: `${item.depth * 12 + 4}px` },
|
|
5523
5322
|
className: "space-y-1 py-1",
|
|
5524
|
-
children: [0, 1, 2].map((i) => /* @__PURE__ */
|
|
5323
|
+
children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx4(
|
|
5525
5324
|
"div",
|
|
5526
5325
|
{
|
|
5527
5326
|
className: "h-2.5 animate-pulse rounded-og-sm bg-og-surface-2",
|
|
@@ -5532,25 +5331,25 @@ function FileBrowser({
|
|
|
5532
5331
|
}
|
|
5533
5332
|
);
|
|
5534
5333
|
case "residue":
|
|
5535
|
-
return /* @__PURE__ */
|
|
5334
|
+
return /* @__PURE__ */ jsxs4(
|
|
5536
5335
|
"div",
|
|
5537
5336
|
{
|
|
5538
5337
|
style: { paddingLeft: `${item.depth * 12 + 4}px` },
|
|
5539
5338
|
className: "flex items-center gap-1.5 py-0.5 pr-1 text-og-xs italic text-og-fg-subtle",
|
|
5540
5339
|
children: [
|
|
5541
|
-
/* @__PURE__ */
|
|
5542
|
-
/* @__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" })
|
|
5543
5342
|
]
|
|
5544
5343
|
}
|
|
5545
5344
|
);
|
|
5546
5345
|
}
|
|
5547
5346
|
};
|
|
5548
|
-
|
|
5347
|
+
useEffect14(() => {
|
|
5549
5348
|
if (!cursor) return;
|
|
5550
5349
|
const index = renderItems.findIndex((it) => it.type === "node" && it.node.path === cursor);
|
|
5551
5350
|
if (index >= 0) vlistRef.current?.scrollToIndex(index);
|
|
5552
5351
|
}, [cursor, renderItems]);
|
|
5553
|
-
|
|
5352
|
+
useEffect14(() => {
|
|
5554
5353
|
if (!revealRequest) return;
|
|
5555
5354
|
const index = renderItems.findIndex(
|
|
5556
5355
|
(item) => item.type === "node" && item.node.path === revealRequest.path
|
|
@@ -5565,18 +5364,18 @@ function FileBrowser({
|
|
|
5565
5364
|
(current) => current?.path === revealRequest.path && current.requestId === revealRequest.requestId ? null : current
|
|
5566
5365
|
);
|
|
5567
5366
|
}, [renderItems, revealRequest, treeId, usesVirtualTree]);
|
|
5568
|
-
return /* @__PURE__ */
|
|
5569
|
-
showToolbar && /* @__PURE__ */
|
|
5367
|
+
return /* @__PURE__ */ jsxs4("div", { className: cn("flex min-h-0 min-w-0 flex-col", className), children: [
|
|
5368
|
+
showToolbar && /* @__PURE__ */ jsxs4(
|
|
5570
5369
|
"div",
|
|
5571
5370
|
{
|
|
5572
5371
|
role: "toolbar",
|
|
5573
5372
|
"aria-label": "File actions",
|
|
5574
5373
|
className: "flex shrink-0 flex-wrap items-center gap-0.5 border-b border-og-border px-1 py-1",
|
|
5575
5374
|
children: [
|
|
5576
|
-
supportsMutation ? /* @__PURE__ */
|
|
5577
|
-
/* @__PURE__ */
|
|
5578
|
-
/* @__PURE__ */
|
|
5579
|
-
/* @__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(
|
|
5580
5379
|
ToolbarButton,
|
|
5581
5380
|
{
|
|
5582
5381
|
label: "Rename",
|
|
@@ -5585,10 +5384,10 @@ function FileBrowser({
|
|
|
5585
5384
|
if (node) startRename(node);
|
|
5586
5385
|
},
|
|
5587
5386
|
disabled: busy || !cursor,
|
|
5588
|
-
children: /* @__PURE__ */
|
|
5387
|
+
children: /* @__PURE__ */ jsx4(PencilIcon, { className: "size-3.5" })
|
|
5589
5388
|
}
|
|
5590
5389
|
),
|
|
5591
|
-
/* @__PURE__ */
|
|
5390
|
+
/* @__PURE__ */ jsx4(
|
|
5592
5391
|
ToolbarButton,
|
|
5593
5392
|
{
|
|
5594
5393
|
label: "Delete",
|
|
@@ -5597,24 +5396,24 @@ function FileBrowser({
|
|
|
5597
5396
|
if (node) void runDelete(node, event.currentTarget);
|
|
5598
5397
|
},
|
|
5599
5398
|
disabled: busy || !cursor,
|
|
5600
|
-
children: /* @__PURE__ */
|
|
5399
|
+
children: /* @__PURE__ */ jsx4(Trash2Icon, { className: "size-3.5" })
|
|
5601
5400
|
}
|
|
5602
5401
|
)
|
|
5603
5402
|
] }) : null,
|
|
5604
|
-
/* @__PURE__ */
|
|
5605
|
-
/* @__PURE__ */
|
|
5403
|
+
/* @__PURE__ */ jsx4("span", { className: "ml-auto" }),
|
|
5404
|
+
/* @__PURE__ */ jsx4(
|
|
5606
5405
|
ToolbarButton,
|
|
5607
5406
|
{
|
|
5608
5407
|
label: "Refresh",
|
|
5609
5408
|
onClick: () => void result.refresh(),
|
|
5610
5409
|
disabled: busy || result.loading,
|
|
5611
|
-
children: /* @__PURE__ */
|
|
5410
|
+
children: /* @__PURE__ */ jsx4(RefreshCwIcon, { className: cn("size-3.5", result.loading && "animate-spin") })
|
|
5612
5411
|
}
|
|
5613
5412
|
)
|
|
5614
5413
|
]
|
|
5615
5414
|
}
|
|
5616
5415
|
),
|
|
5617
|
-
showDegradedTree ? /* @__PURE__ */
|
|
5416
|
+
showDegradedTree ? /* @__PURE__ */ jsxs4(
|
|
5618
5417
|
"div",
|
|
5619
5418
|
{
|
|
5620
5419
|
role: "status",
|
|
@@ -5622,9 +5421,9 @@ function FileBrowser({
|
|
|
5622
5421
|
"data-opengeni-files-degraded": true,
|
|
5623
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",
|
|
5624
5423
|
children: [
|
|
5625
|
-
/* @__PURE__ */
|
|
5626
|
-
/* @__PURE__ */
|
|
5627
|
-
/* @__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(
|
|
5628
5427
|
"button",
|
|
5629
5428
|
{
|
|
5630
5429
|
type: "button",
|
|
@@ -5632,7 +5431,7 @@ function FileBrowser({
|
|
|
5632
5431
|
disabled: result.loading,
|
|
5633
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",
|
|
5634
5433
|
children: [
|
|
5635
|
-
/* @__PURE__ */
|
|
5434
|
+
/* @__PURE__ */ jsx4(
|
|
5636
5435
|
RefreshCwIcon,
|
|
5637
5436
|
{
|
|
5638
5437
|
className: cn("size-3", result.loading && "animate-spin motion-reduce:animate-none"),
|
|
@@ -5646,7 +5445,7 @@ function FileBrowser({
|
|
|
5646
5445
|
]
|
|
5647
5446
|
}
|
|
5648
5447
|
) : null,
|
|
5649
|
-
/* @__PURE__ */
|
|
5448
|
+
/* @__PURE__ */ jsx4(
|
|
5650
5449
|
"div",
|
|
5651
5450
|
{
|
|
5652
5451
|
ref: container.ref,
|
|
@@ -5672,9 +5471,9 @@ function FileBrowser({
|
|
|
5672
5471
|
dragOver === "" && "ring-1 ring-inset ring-og-accent"
|
|
5673
5472
|
),
|
|
5674
5473
|
"data-opengeni-file-tree": true,
|
|
5675
|
-
children: showErrorEmpty ? /* @__PURE__ */
|
|
5676
|
-
/* @__PURE__ */
|
|
5677
|
-
/* @__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(
|
|
5678
5477
|
"button",
|
|
5679
5478
|
{
|
|
5680
5479
|
type: "button",
|
|
@@ -5682,7 +5481,7 @@ function FileBrowser({
|
|
|
5682
5481
|
disabled: result.loading,
|
|
5683
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",
|
|
5684
5483
|
children: [
|
|
5685
|
-
/* @__PURE__ */
|
|
5484
|
+
/* @__PURE__ */ jsx4(
|
|
5686
5485
|
RefreshCwIcon,
|
|
5687
5486
|
{
|
|
5688
5487
|
className: cn("size-3.5", result.loading && "animate-spin"),
|
|
@@ -5693,7 +5492,7 @@ function FileBrowser({
|
|
|
5693
5492
|
]
|
|
5694
5493
|
}
|
|
5695
5494
|
)
|
|
5696
|
-
] }) : 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(
|
|
5697
5496
|
"div",
|
|
5698
5497
|
{
|
|
5699
5498
|
id: treeId,
|
|
@@ -5703,13 +5502,13 @@ function FileBrowser({
|
|
|
5703
5502
|
"aria-multiselectable": false,
|
|
5704
5503
|
tabIndex: 0,
|
|
5705
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",
|
|
5706
|
-
children: renderItems.map((item) => /* @__PURE__ */
|
|
5505
|
+
children: renderItems.map((item) => /* @__PURE__ */ jsx4("div", { className: "min-w-0", children: renderItem(item) }, itemKey(item)))
|
|
5707
5506
|
}
|
|
5708
5507
|
) : (
|
|
5709
5508
|
// Virtualized: only the rows in/near the viewport mount, so a 3k-node
|
|
5710
5509
|
// tree stays responsive. The flat item list already carries the
|
|
5711
5510
|
// expanded subtree + synthetic (create/skeleton/residue) rows.
|
|
5712
|
-
/* @__PURE__ */
|
|
5511
|
+
/* @__PURE__ */ jsx4(
|
|
5713
5512
|
VList,
|
|
5714
5513
|
{
|
|
5715
5514
|
ref: vlistRef,
|
|
@@ -5722,13 +5521,13 @@ function FileBrowser({
|
|
|
5722
5521
|
className: "min-h-0 flex-1 outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-og-accent",
|
|
5723
5522
|
itemSize: coarsePointer ? 44 : 28,
|
|
5724
5523
|
ssrCount: Math.min(32, renderItems.length),
|
|
5725
|
-
children: renderItems.map((item) => /* @__PURE__ */
|
|
5524
|
+
children: renderItems.map((item) => /* @__PURE__ */ jsx4("div", { className: "min-w-0", children: renderItem(item) }, itemKey(item)))
|
|
5726
5525
|
}
|
|
5727
5526
|
)
|
|
5728
5527
|
)
|
|
5729
5528
|
}
|
|
5730
5529
|
),
|
|
5731
|
-
menu && menu.node && /* @__PURE__ */
|
|
5530
|
+
menu && menu.node && /* @__PURE__ */ jsx4(
|
|
5732
5531
|
ContextMenu,
|
|
5733
5532
|
{
|
|
5734
5533
|
node: menu.node,
|
|
@@ -5744,7 +5543,7 @@ function FileBrowser({
|
|
|
5744
5543
|
}
|
|
5745
5544
|
}
|
|
5746
5545
|
),
|
|
5747
|
-
pendingDelete ? /* @__PURE__ */
|
|
5546
|
+
pendingDelete ? /* @__PURE__ */ jsx4(
|
|
5748
5547
|
DeleteDialog,
|
|
5749
5548
|
{
|
|
5750
5549
|
node: pendingDelete,
|
|
@@ -5767,11 +5566,11 @@ function DeleteDialog({
|
|
|
5767
5566
|
onCancel,
|
|
5768
5567
|
onConfirm
|
|
5769
5568
|
}) {
|
|
5770
|
-
const cancelRef =
|
|
5569
|
+
const cancelRef = useRef12(null);
|
|
5771
5570
|
const [open, setOpen] = useState10(true);
|
|
5772
|
-
const closeIntentRef =
|
|
5773
|
-
const settledRef =
|
|
5774
|
-
const settleTimerRef =
|
|
5571
|
+
const closeIntentRef = useRef12("cancel");
|
|
5572
|
+
const settledRef = useRef12(false);
|
|
5573
|
+
const settleTimerRef = useRef12(null);
|
|
5775
5574
|
const settle = () => {
|
|
5776
5575
|
if (settledRef.current) return;
|
|
5777
5576
|
settledRef.current = true;
|
|
@@ -5788,13 +5587,13 @@ function DeleteDialog({
|
|
|
5788
5587
|
settle();
|
|
5789
5588
|
}, 0);
|
|
5790
5589
|
};
|
|
5791
|
-
|
|
5590
|
+
useEffect14(
|
|
5792
5591
|
() => () => {
|
|
5793
5592
|
if (settleTimerRef.current !== null) clearTimeout(settleTimerRef.current);
|
|
5794
5593
|
},
|
|
5795
5594
|
[]
|
|
5796
5595
|
);
|
|
5797
|
-
return /* @__PURE__ */
|
|
5596
|
+
return /* @__PURE__ */ jsx4(
|
|
5798
5597
|
AlertDialog.Root,
|
|
5799
5598
|
{
|
|
5800
5599
|
open,
|
|
@@ -5804,9 +5603,9 @@ function DeleteDialog({
|
|
|
5804
5603
|
scheduleSettle();
|
|
5805
5604
|
}
|
|
5806
5605
|
},
|
|
5807
|
-
children: /* @__PURE__ */
|
|
5808
|
-
/* @__PURE__ */
|
|
5809
|
-
/* @__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(
|
|
5810
5609
|
AlertDialog.Content,
|
|
5811
5610
|
{
|
|
5812
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",
|
|
@@ -5828,22 +5627,22 @@ function DeleteDialog({
|
|
|
5828
5627
|
}
|
|
5829
5628
|
},
|
|
5830
5629
|
children: [
|
|
5831
|
-
/* @__PURE__ */
|
|
5832
|
-
/* @__PURE__ */
|
|
5833
|
-
/* @__PURE__ */
|
|
5834
|
-
/* @__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: [
|
|
5835
5634
|
"Delete ",
|
|
5836
5635
|
node.kind === "dir" ? "folder" : "file",
|
|
5837
5636
|
"?"
|
|
5838
5637
|
] }),
|
|
5839
|
-
/* @__PURE__ */
|
|
5840
|
-
/* @__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 }),
|
|
5841
5640
|
node.kind === "dir" ? " and everything inside it will be permanently removed." : " will be permanently removed."
|
|
5842
5641
|
] })
|
|
5843
5642
|
] })
|
|
5844
5643
|
] }),
|
|
5845
|
-
/* @__PURE__ */
|
|
5846
|
-
/* @__PURE__ */
|
|
5644
|
+
/* @__PURE__ */ jsxs4("div", { className: "mt-4 flex justify-end gap-2", children: [
|
|
5645
|
+
/* @__PURE__ */ jsx4(AlertDialog.Cancel, { asChild: true, children: /* @__PURE__ */ jsx4(
|
|
5847
5646
|
"button",
|
|
5848
5647
|
{
|
|
5849
5648
|
ref: cancelRef,
|
|
@@ -5856,7 +5655,7 @@ function DeleteDialog({
|
|
|
5856
5655
|
children: "Cancel"
|
|
5857
5656
|
}
|
|
5858
5657
|
) }),
|
|
5859
|
-
/* @__PURE__ */
|
|
5658
|
+
/* @__PURE__ */ jsx4(AlertDialog.Action, { asChild: true, children: /* @__PURE__ */ jsx4(
|
|
5860
5659
|
"button",
|
|
5861
5660
|
{
|
|
5862
5661
|
type: "button",
|
|
@@ -5882,7 +5681,7 @@ function ToolbarButton({
|
|
|
5882
5681
|
disabled,
|
|
5883
5682
|
children
|
|
5884
5683
|
}) {
|
|
5885
|
-
return /* @__PURE__ */
|
|
5684
|
+
return /* @__PURE__ */ jsx4(
|
|
5886
5685
|
"button",
|
|
5887
5686
|
{
|
|
5888
5687
|
type: "button",
|
|
@@ -5907,9 +5706,9 @@ function InlineInput({
|
|
|
5907
5706
|
onCancel
|
|
5908
5707
|
}) {
|
|
5909
5708
|
const [value, setValue] = useState10(initialValue);
|
|
5910
|
-
const ref =
|
|
5911
|
-
const doneRef =
|
|
5912
|
-
|
|
5709
|
+
const ref = useRef12(null);
|
|
5710
|
+
const doneRef = useRef12(false);
|
|
5711
|
+
useEffect14(() => {
|
|
5913
5712
|
const el = ref.current;
|
|
5914
5713
|
if (!el) return;
|
|
5915
5714
|
el.focus();
|
|
@@ -5923,15 +5722,15 @@ function InlineInput({
|
|
|
5923
5722
|
if (commit) onCommit(value);
|
|
5924
5723
|
else onCancel();
|
|
5925
5724
|
};
|
|
5926
|
-
return /* @__PURE__ */
|
|
5725
|
+
return /* @__PURE__ */ jsxs4(
|
|
5927
5726
|
"div",
|
|
5928
5727
|
{
|
|
5929
5728
|
className: "flex items-center gap-1 px-1 py-0.5",
|
|
5930
5729
|
style: { paddingLeft: `${depth * 12 + 4}px` },
|
|
5931
5730
|
children: [
|
|
5932
|
-
/* @__PURE__ */
|
|
5933
|
-
kind === "dir" ? /* @__PURE__ */
|
|
5934
|
-
/* @__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(
|
|
5935
5734
|
"input",
|
|
5936
5735
|
{
|
|
5937
5736
|
ref,
|
|
@@ -5973,12 +5772,12 @@ function ContextMenu({
|
|
|
5973
5772
|
onClose
|
|
5974
5773
|
}) {
|
|
5975
5774
|
const isDir = node.kind === "dir";
|
|
5976
|
-
const menuRef =
|
|
5775
|
+
const menuRef = useRef12(null);
|
|
5977
5776
|
const vw = typeof window !== "undefined" ? window.innerWidth : 9999;
|
|
5978
5777
|
const vh = typeof window !== "undefined" ? window.innerHeight : 9999;
|
|
5979
5778
|
const left = Math.max(4, Math.min(x, vw - 180));
|
|
5980
5779
|
const top = Math.max(4, Math.min(y, vh - 160));
|
|
5981
|
-
|
|
5780
|
+
useEffect14(() => {
|
|
5982
5781
|
menuRef.current?.querySelector('[role="menuitem"]')?.focus();
|
|
5983
5782
|
}, []);
|
|
5984
5783
|
const onKeyDown = (event) => {
|
|
@@ -6003,7 +5802,7 @@ function ContextMenu({
|
|
|
6003
5802
|
event.stopPropagation();
|
|
6004
5803
|
items[next]?.focus();
|
|
6005
5804
|
};
|
|
6006
|
-
const item = (label, icon, onClick, danger) => /* @__PURE__ */
|
|
5805
|
+
const item = (label, icon, onClick, danger) => /* @__PURE__ */ jsxs4(
|
|
6007
5806
|
"button",
|
|
6008
5807
|
{
|
|
6009
5808
|
type: "button",
|
|
@@ -6023,7 +5822,7 @@ function ContextMenu({
|
|
|
6023
5822
|
]
|
|
6024
5823
|
}
|
|
6025
5824
|
);
|
|
6026
|
-
return /* @__PURE__ */
|
|
5825
|
+
return /* @__PURE__ */ jsxs4(
|
|
6027
5826
|
"div",
|
|
6028
5827
|
{
|
|
6029
5828
|
ref: menuRef,
|
|
@@ -6038,13 +5837,13 @@ function ContextMenu({
|
|
|
6038
5837
|
"bg-og-surface-1"
|
|
6039
5838
|
),
|
|
6040
5839
|
children: [
|
|
6041
|
-
isDir && /* @__PURE__ */
|
|
6042
|
-
item("New file", /* @__PURE__ */
|
|
6043
|
-
item("New folder", /* @__PURE__ */
|
|
6044
|
-
/* @__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" })
|
|
6045
5844
|
] }),
|
|
6046
|
-
item("Rename", /* @__PURE__ */
|
|
6047
|
-
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)
|
|
6048
5847
|
]
|
|
6049
5848
|
}
|
|
6050
5849
|
);
|
|
@@ -6054,18 +5853,18 @@ function ContextMenu({
|
|
|
6054
5853
|
import { ArrowUpRightIcon, FileWarningIcon, HistoryIcon } from "lucide-react";
|
|
6055
5854
|
import {
|
|
6056
5855
|
Component,
|
|
6057
|
-
useCallback as
|
|
6058
|
-
useEffect as
|
|
5856
|
+
useCallback as useCallback20,
|
|
5857
|
+
useEffect as useEffect16,
|
|
6059
5858
|
useId as useId3,
|
|
6060
5859
|
useLayoutEffect as useLayoutEffect3,
|
|
6061
5860
|
useMemo as useMemo13,
|
|
6062
|
-
useRef as
|
|
5861
|
+
useRef as useRef14,
|
|
6063
5862
|
useState as useState12
|
|
6064
5863
|
} from "react";
|
|
6065
5864
|
import { VList as VList2 } from "virtua";
|
|
6066
5865
|
|
|
6067
5866
|
// src/hooks/use-windowed-sections.ts
|
|
6068
|
-
import { useCallback as
|
|
5867
|
+
import { useCallback as useCallback19, useEffect as useEffect15, useMemo as useMemo12, useRef as useRef13, useState as useState11 } from "react";
|
|
6069
5868
|
function computeWindowRange(heights, scrollTop, viewport, overscan) {
|
|
6070
5869
|
const n = heights.length;
|
|
6071
5870
|
if (n === 0) return { start: 0, end: 0 };
|
|
@@ -6096,29 +5895,29 @@ function computeWindowRange(heights, scrollTop, viewport, overscan) {
|
|
|
6096
5895
|
}
|
|
6097
5896
|
function useWindowedSections(opts) {
|
|
6098
5897
|
const { count, estimateHeight, overscan = 3 } = opts;
|
|
6099
|
-
const scrollRef =
|
|
5898
|
+
const scrollRef = useRef13(null);
|
|
6100
5899
|
const [heights, setHeights] = useState11(
|
|
6101
5900
|
() => Array.from({ length: count }, (_, i) => estimateHeight(i))
|
|
6102
5901
|
);
|
|
6103
|
-
|
|
5902
|
+
useEffect15(() => {
|
|
6104
5903
|
setHeights((prev) => {
|
|
6105
5904
|
const next = Array.from({ length: count }, (_, i) => estimateHeight(i));
|
|
6106
5905
|
return prev.length === next.length && prev.every((height, index) => height === next[index]) ? prev : next;
|
|
6107
5906
|
});
|
|
6108
5907
|
}, [count, estimateHeight]);
|
|
6109
|
-
const heightsRef =
|
|
5908
|
+
const heightsRef = useRef13(heights);
|
|
6110
5909
|
heightsRef.current = heights;
|
|
6111
5910
|
const [range, setRange] = useState11(() => ({
|
|
6112
5911
|
start: 0,
|
|
6113
5912
|
end: Math.min(count, overscan + 1)
|
|
6114
5913
|
}));
|
|
6115
|
-
const recompute =
|
|
5914
|
+
const recompute = useCallback19(() => {
|
|
6116
5915
|
const el = scrollRef.current;
|
|
6117
5916
|
if (!el) return;
|
|
6118
5917
|
const next = computeWindowRange(heightsRef.current, el.scrollTop, el.clientHeight, overscan);
|
|
6119
5918
|
setRange((prev) => prev.start === next.start && prev.end === next.end ? prev : next);
|
|
6120
5919
|
}, [overscan]);
|
|
6121
|
-
|
|
5920
|
+
useEffect15(() => {
|
|
6122
5921
|
const el = scrollRef.current;
|
|
6123
5922
|
if (!el) return;
|
|
6124
5923
|
let raf = 0;
|
|
@@ -6139,7 +5938,7 @@ function useWindowedSections(opts) {
|
|
|
6139
5938
|
if (raf && typeof cancelAnimationFrame === "function") cancelAnimationFrame(raf);
|
|
6140
5939
|
};
|
|
6141
5940
|
}, [recompute, count]);
|
|
6142
|
-
const measure =
|
|
5941
|
+
const measure = useCallback19((index, height) => {
|
|
6143
5942
|
if (height <= 0) return;
|
|
6144
5943
|
setHeights((prev) => {
|
|
6145
5944
|
if (Math.abs((prev[index] ?? 0) - height) < 1) return prev;
|
|
@@ -6154,10 +5953,10 @@ function useWindowedSections(opts) {
|
|
|
6154
5953
|
for (let i = 0; i < count; i++) out[i + 1] = (out[i] ?? 0) + Math.max(heights[i] ?? 0, 0);
|
|
6155
5954
|
return out;
|
|
6156
5955
|
}, [heights, count]);
|
|
6157
|
-
|
|
5956
|
+
useEffect15(() => {
|
|
6158
5957
|
recompute();
|
|
6159
5958
|
}, [offsets, recompute]);
|
|
6160
|
-
const scrollToIndex =
|
|
5959
|
+
const scrollToIndex = useCallback19(
|
|
6161
5960
|
(index) => {
|
|
6162
5961
|
const el = scrollRef.current;
|
|
6163
5962
|
if (!el) return;
|
|
@@ -6177,14 +5976,14 @@ function useWindowedSections(opts) {
|
|
|
6177
5976
|
}
|
|
6178
5977
|
|
|
6179
5978
|
// src/components/workbench-changes.tsx
|
|
6180
|
-
import { jsx as
|
|
5979
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
6181
5980
|
var GROUP_THRESHOLD = 20;
|
|
6182
5981
|
var OVERSCAN = 2;
|
|
6183
5982
|
var HEADER_PX = 30;
|
|
6184
5983
|
var LINE_PX = 18;
|
|
6185
5984
|
var GUARD_BODY_PX = 52;
|
|
6186
5985
|
var COMPACT_SURFACE_PX = 560;
|
|
6187
|
-
var useChangesLayoutEffect = typeof window === "undefined" ?
|
|
5986
|
+
var useChangesLayoutEffect = typeof window === "undefined" ? useEffect16 : useLayoutEffect3;
|
|
6188
5987
|
var STATUS_TINT2 = {
|
|
6189
5988
|
added: "text-og-status-idle",
|
|
6190
5989
|
modified: "text-og-status-running",
|
|
@@ -6295,7 +6094,7 @@ var ChangesRailVList = class extends Component {
|
|
|
6295
6094
|
this.listHandle = handle;
|
|
6296
6095
|
};
|
|
6297
6096
|
render() {
|
|
6298
|
-
return /* @__PURE__ */
|
|
6097
|
+
return /* @__PURE__ */ jsx5("div", { ref: this.setHost, "data-opengeni-changes-rail": true, className: this.props.className, children: /* @__PURE__ */ jsx5(
|
|
6299
6098
|
VList2,
|
|
6300
6099
|
{
|
|
6301
6100
|
ref: this.setListHandle,
|
|
@@ -6359,7 +6158,7 @@ function WorkbenchChanges({
|
|
|
6359
6158
|
onOpenFile,
|
|
6360
6159
|
className
|
|
6361
6160
|
}) {
|
|
6362
|
-
const rootRef =
|
|
6161
|
+
const rootRef = useRef14(null);
|
|
6363
6162
|
const [compact, setCompact] = useState12(false);
|
|
6364
6163
|
const [coarsePointer, setCoarsePointer] = useState12(false);
|
|
6365
6164
|
const resolvedTheme = useThemeType(themeType);
|
|
@@ -6403,7 +6202,7 @@ function WorkbenchChanges({
|
|
|
6403
6202
|
}, []);
|
|
6404
6203
|
const additions = useMemo13(() => diff.reduce((sum, f) => sum + f.additions, 0), [diff]);
|
|
6405
6204
|
const deletions = useMemo13(() => diff.reduce((sum, f) => sum + f.deletions, 0), [diff]);
|
|
6406
|
-
const estimateHeight =
|
|
6205
|
+
const estimateHeight = useCallback20(
|
|
6407
6206
|
(index) => {
|
|
6408
6207
|
const file = orderedFiles[index];
|
|
6409
6208
|
return file ? estimateSectionHeight(file) : HEADER_PX + LINE_PX;
|
|
@@ -6415,14 +6214,14 @@ function WorkbenchChanges({
|
|
|
6415
6214
|
estimateHeight,
|
|
6416
6215
|
overscan: OVERSCAN
|
|
6417
6216
|
});
|
|
6418
|
-
const jumpTo =
|
|
6217
|
+
const jumpTo = useCallback20(
|
|
6419
6218
|
(index) => {
|
|
6420
6219
|
setActivePath(orderedFiles[index]?.path ?? null);
|
|
6421
6220
|
windowed.scrollToIndex(index);
|
|
6422
6221
|
},
|
|
6423
6222
|
[orderedFiles, windowed]
|
|
6424
6223
|
);
|
|
6425
|
-
const onPaneScroll =
|
|
6224
|
+
const onPaneScroll = useCallback20(() => {
|
|
6426
6225
|
const el = windowed.scrollRef.current;
|
|
6427
6226
|
if (!el) {
|
|
6428
6227
|
return;
|
|
@@ -6437,7 +6236,7 @@ function WorkbenchChanges({
|
|
|
6437
6236
|
const nextPath = orderedFiles[idx]?.path ?? null;
|
|
6438
6237
|
setActivePath((previous) => previous === nextPath ? previous : nextPath);
|
|
6439
6238
|
}, [windowed, orderedFiles]);
|
|
6440
|
-
|
|
6239
|
+
useEffect16(() => {
|
|
6441
6240
|
const el = windowed.scrollRef.current;
|
|
6442
6241
|
if (!el) return;
|
|
6443
6242
|
el.addEventListener("scroll", onPaneScroll, { passive: true });
|
|
@@ -6445,14 +6244,14 @@ function WorkbenchChanges({
|
|
|
6445
6244
|
}, [windowed.scrollRef, onPaneScroll]);
|
|
6446
6245
|
const sourceBadge = describeSource(source, capturedAt, captureRevision ?? null);
|
|
6447
6246
|
const activeFile = orderedFiles[activeIndex] ?? orderedFiles[0];
|
|
6448
|
-
return /* @__PURE__ */
|
|
6247
|
+
return /* @__PURE__ */ jsxs5(
|
|
6449
6248
|
"div",
|
|
6450
6249
|
{
|
|
6451
6250
|
ref: rootRef,
|
|
6452
6251
|
className: cn("flex h-full min-h-0 min-w-0 flex-col", className),
|
|
6453
6252
|
"data-workbench-changes-layout": compact ? "compact" : "rail",
|
|
6454
6253
|
children: [
|
|
6455
|
-
/* @__PURE__ */
|
|
6254
|
+
/* @__PURE__ */ jsxs5(
|
|
6456
6255
|
"div",
|
|
6457
6256
|
{
|
|
6458
6257
|
className: cn(
|
|
@@ -6460,7 +6259,7 @@ function WorkbenchChanges({
|
|
|
6460
6259
|
compact && source === "capture" && "flex-col items-stretch gap-1.5 py-2"
|
|
6461
6260
|
),
|
|
6462
6261
|
children: [
|
|
6463
|
-
/* @__PURE__ */
|
|
6262
|
+
/* @__PURE__ */ jsxs5(
|
|
6464
6263
|
"span",
|
|
6465
6264
|
{
|
|
6466
6265
|
role: "status",
|
|
@@ -6473,18 +6272,18 @@ function WorkbenchChanges({
|
|
|
6473
6272
|
" ",
|
|
6474
6273
|
diff.length === 1 ? "file" : "files",
|
|
6475
6274
|
" changed",
|
|
6476
|
-
/* @__PURE__ */
|
|
6275
|
+
/* @__PURE__ */ jsxs5("span", { "data-contrast-audited": true, className: "ml-2 text-og-status-idle", children: [
|
|
6477
6276
|
"+",
|
|
6478
6277
|
additions
|
|
6479
6278
|
] }),
|
|
6480
|
-
/* @__PURE__ */
|
|
6279
|
+
/* @__PURE__ */ jsxs5("span", { "data-contrast-audited": true, className: "ml-1 text-og-status-failed", children: [
|
|
6481
6280
|
"\u2212",
|
|
6482
6281
|
deletions
|
|
6483
6282
|
] })
|
|
6484
6283
|
]
|
|
6485
6284
|
}
|
|
6486
6285
|
),
|
|
6487
|
-
/* @__PURE__ */
|
|
6286
|
+
/* @__PURE__ */ jsxs5(
|
|
6488
6287
|
"div",
|
|
6489
6288
|
{
|
|
6490
6289
|
className: cn(
|
|
@@ -6492,18 +6291,18 @@ function WorkbenchChanges({
|
|
|
6492
6291
|
compact && source === "capture" && "self-start"
|
|
6493
6292
|
),
|
|
6494
6293
|
children: [
|
|
6495
|
-
compact ? null : /* @__PURE__ */
|
|
6496
|
-
/* @__PURE__ */
|
|
6294
|
+
compact ? null : /* @__PURE__ */ jsx5(LayoutToggle, { layout, onChange: setLayout }),
|
|
6295
|
+
/* @__PURE__ */ jsx5(SourceBadge, { source, capturedAt, label: sourceBadge })
|
|
6497
6296
|
]
|
|
6498
6297
|
}
|
|
6499
6298
|
)
|
|
6500
6299
|
]
|
|
6501
6300
|
}
|
|
6502
6301
|
),
|
|
6503
|
-
compact ? /* @__PURE__ */
|
|
6504
|
-
/* @__PURE__ */
|
|
6505
|
-
/* @__PURE__ */
|
|
6506
|
-
/* @__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(
|
|
6507
6306
|
"select",
|
|
6508
6307
|
{
|
|
6509
6308
|
id: pickerId,
|
|
@@ -6516,11 +6315,11 @@ function WorkbenchChanges({
|
|
|
6516
6315
|
title: activeFile?.path,
|
|
6517
6316
|
"data-compact-file-picker": true,
|
|
6518
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",
|
|
6519
|
-
children: orderedFiles.map((file, index) => /* @__PURE__ */
|
|
6318
|
+
children: orderedFiles.map((file, index) => /* @__PURE__ */ jsx5("option", { value: index, children: compactFileLabel(file) }, file.path))
|
|
6520
6319
|
}
|
|
6521
6320
|
)
|
|
6522
6321
|
] }),
|
|
6523
|
-
/* @__PURE__ */
|
|
6322
|
+
/* @__PURE__ */ jsx5(
|
|
6524
6323
|
"div",
|
|
6525
6324
|
{
|
|
6526
6325
|
"aria-label": "Changed file diff",
|
|
@@ -6528,7 +6327,7 @@ function WorkbenchChanges({
|
|
|
6528
6327
|
"data-opengeni-changes-pane": true,
|
|
6529
6328
|
role: "region",
|
|
6530
6329
|
tabIndex: 0,
|
|
6531
|
-
children: activeFile ? /* @__PURE__ */
|
|
6330
|
+
children: activeFile ? /* @__PURE__ */ jsx5(
|
|
6532
6331
|
DiffSection,
|
|
6533
6332
|
{
|
|
6534
6333
|
file: activeFile,
|
|
@@ -6539,8 +6338,8 @@ function WorkbenchChanges({
|
|
|
6539
6338
|
) : null
|
|
6540
6339
|
}
|
|
6541
6340
|
)
|
|
6542
|
-
] }) : /* @__PURE__ */
|
|
6543
|
-
/* @__PURE__ */
|
|
6341
|
+
] }) : /* @__PURE__ */ jsxs5("div", { className: "flex min-h-0 flex-1", children: [
|
|
6342
|
+
/* @__PURE__ */ jsx5(
|
|
6544
6343
|
ChangesRailVList,
|
|
6545
6344
|
{
|
|
6546
6345
|
rowCount: rows.length,
|
|
@@ -6548,18 +6347,18 @@ function WorkbenchChanges({
|
|
|
6548
6347
|
files: orderedFiles,
|
|
6549
6348
|
className: "w-[clamp(12rem,28%,15rem)] shrink-0 border-r border-og-border bg-og-surface-1/35",
|
|
6550
6349
|
children: rows.map(
|
|
6551
|
-
(row) => row.kind === "group" ? /* @__PURE__ */
|
|
6350
|
+
(row) => row.kind === "group" ? /* @__PURE__ */ jsxs5(
|
|
6552
6351
|
"div",
|
|
6553
6352
|
{
|
|
6554
6353
|
"data-rail-group": true,
|
|
6555
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",
|
|
6556
6355
|
children: [
|
|
6557
|
-
/* @__PURE__ */
|
|
6558
|
-
/* @__PURE__ */
|
|
6356
|
+
/* @__PURE__ */ jsx5("span", { className: "min-w-0 truncate", children: row.label }),
|
|
6357
|
+
/* @__PURE__ */ jsx5("span", { className: "shrink-0", children: row.count })
|
|
6559
6358
|
]
|
|
6560
6359
|
},
|
|
6561
6360
|
`g:${row.label}`
|
|
6562
|
-
) : /* @__PURE__ */
|
|
6361
|
+
) : /* @__PURE__ */ jsx5(
|
|
6563
6362
|
RailFileRow,
|
|
6564
6363
|
{
|
|
6565
6364
|
file: row.file,
|
|
@@ -6572,7 +6371,7 @@ function WorkbenchChanges({
|
|
|
6572
6371
|
)
|
|
6573
6372
|
}
|
|
6574
6373
|
),
|
|
6575
|
-
/* @__PURE__ */
|
|
6374
|
+
/* @__PURE__ */ jsx5(
|
|
6576
6375
|
"div",
|
|
6577
6376
|
{
|
|
6578
6377
|
ref: windowed.scrollRef,
|
|
@@ -6581,15 +6380,15 @@ function WorkbenchChanges({
|
|
|
6581
6380
|
"data-opengeni-changes-pane": true,
|
|
6582
6381
|
role: "region",
|
|
6583
6382
|
tabIndex: 0,
|
|
6584
|
-
children: /* @__PURE__ */
|
|
6383
|
+
children: /* @__PURE__ */ jsx5("div", { style: { position: "relative", height: windowed.totalHeight }, children: orderedFiles.map((file, index) => {
|
|
6585
6384
|
if (index < windowed.range.start || index >= windowed.range.end) return null;
|
|
6586
|
-
return /* @__PURE__ */
|
|
6385
|
+
return /* @__PURE__ */ jsx5(
|
|
6587
6386
|
MeasuredSection,
|
|
6588
6387
|
{
|
|
6589
6388
|
index,
|
|
6590
6389
|
top: windowed.offsets[index] ?? 0,
|
|
6591
6390
|
onMeasure: windowed.measure,
|
|
6592
|
-
children: /* @__PURE__ */
|
|
6391
|
+
children: /* @__PURE__ */ jsx5(
|
|
6593
6392
|
DiffSection,
|
|
6594
6393
|
{
|
|
6595
6394
|
file,
|
|
@@ -6615,19 +6414,19 @@ function SourceBadge({
|
|
|
6615
6414
|
label
|
|
6616
6415
|
}) {
|
|
6617
6416
|
if (source === "capture" && capturedAt) {
|
|
6618
|
-
return /* @__PURE__ */
|
|
6417
|
+
return /* @__PURE__ */ jsxs5(
|
|
6619
6418
|
"span",
|
|
6620
6419
|
{
|
|
6621
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",
|
|
6622
6421
|
title: new Date(capturedAt).toLocaleString(),
|
|
6623
6422
|
children: [
|
|
6624
|
-
/* @__PURE__ */
|
|
6423
|
+
/* @__PURE__ */ jsx5(HistoryIcon, { className: "size-3 shrink-0 text-og-status-running", "aria-hidden": true }),
|
|
6625
6424
|
label
|
|
6626
6425
|
]
|
|
6627
6426
|
}
|
|
6628
6427
|
);
|
|
6629
6428
|
}
|
|
6630
|
-
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 });
|
|
6631
6430
|
}
|
|
6632
6431
|
function describeSource(source, capturedAt, revision) {
|
|
6633
6432
|
if (source !== "capture" || !capturedAt) return "Live diff";
|
|
@@ -6642,7 +6441,7 @@ function RailFileRow({
|
|
|
6642
6441
|
}) {
|
|
6643
6442
|
const repoPrefix = file.repoRoot ? `${file.repoRoot}/` : null;
|
|
6644
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;
|
|
6645
|
-
return /* @__PURE__ */
|
|
6444
|
+
return /* @__PURE__ */ jsxs5(
|
|
6646
6445
|
"button",
|
|
6647
6446
|
{
|
|
6648
6447
|
type: "button",
|
|
@@ -6656,7 +6455,7 @@ function RailFileRow({
|
|
|
6656
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"
|
|
6657
6456
|
),
|
|
6658
6457
|
children: [
|
|
6659
|
-
/* @__PURE__ */
|
|
6458
|
+
/* @__PURE__ */ jsx5(
|
|
6660
6459
|
"span",
|
|
6661
6460
|
{
|
|
6662
6461
|
"data-contrast-audited": true,
|
|
@@ -6664,13 +6463,13 @@ function RailFileRow({
|
|
|
6664
6463
|
children: STATUS_LETTER[file.status]
|
|
6665
6464
|
}
|
|
6666
6465
|
),
|
|
6667
|
-
/* @__PURE__ */
|
|
6668
|
-
/* @__PURE__ */
|
|
6669
|
-
/* @__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: [
|
|
6670
6469
|
"+",
|
|
6671
6470
|
file.additions
|
|
6672
6471
|
] }),
|
|
6673
|
-
/* @__PURE__ */
|
|
6472
|
+
/* @__PURE__ */ jsxs5("span", { "data-contrast-audited": true, className: "text-og-status-failed", children: [
|
|
6674
6473
|
"\u2212",
|
|
6675
6474
|
file.deletions
|
|
6676
6475
|
] })
|
|
@@ -6685,8 +6484,8 @@ function MeasuredSection({
|
|
|
6685
6484
|
onMeasure,
|
|
6686
6485
|
children
|
|
6687
6486
|
}) {
|
|
6688
|
-
const ref =
|
|
6689
|
-
|
|
6487
|
+
const ref = useRef14(null);
|
|
6488
|
+
useEffect16(() => {
|
|
6690
6489
|
const el = ref.current;
|
|
6691
6490
|
if (!el) return;
|
|
6692
6491
|
const report = () => onMeasure(index, el.offsetHeight);
|
|
@@ -6695,7 +6494,7 @@ function MeasuredSection({
|
|
|
6695
6494
|
ro?.observe(el);
|
|
6696
6495
|
return () => ro?.disconnect();
|
|
6697
6496
|
}, [index, onMeasure]);
|
|
6698
|
-
return /* @__PURE__ */
|
|
6497
|
+
return /* @__PURE__ */ jsx5(
|
|
6699
6498
|
"div",
|
|
6700
6499
|
{
|
|
6701
6500
|
ref,
|
|
@@ -6714,37 +6513,37 @@ function DiffSection({
|
|
|
6714
6513
|
}) {
|
|
6715
6514
|
if (isGuarded(file)) {
|
|
6716
6515
|
const renamed = file.oldPath && file.oldPath !== file.path;
|
|
6717
|
-
return /* @__PURE__ */
|
|
6718
|
-
/* @__PURE__ */
|
|
6719
|
-
/* @__PURE__ */
|
|
6720
|
-
/* @__PURE__ */
|
|
6721
|
-
/* @__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: [
|
|
6722
6521
|
"+",
|
|
6723
6522
|
file.additions
|
|
6724
6523
|
] }),
|
|
6725
|
-
/* @__PURE__ */
|
|
6524
|
+
/* @__PURE__ */ jsxs5("span", { className: "text-og-status-failed", children: [
|
|
6726
6525
|
"\u2212",
|
|
6727
6526
|
file.deletions
|
|
6728
6527
|
] })
|
|
6729
6528
|
] })
|
|
6730
6529
|
] }),
|
|
6731
|
-
/* @__PURE__ */
|
|
6530
|
+
/* @__PURE__ */ jsx5(GuardBody, { file, ...onOpenFile ? { onOpenFile } : {} })
|
|
6732
6531
|
] });
|
|
6733
6532
|
}
|
|
6734
|
-
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" }) });
|
|
6735
6534
|
}
|
|
6736
6535
|
function GuardBody({
|
|
6737
6536
|
file,
|
|
6738
6537
|
onOpenFile
|
|
6739
6538
|
}) {
|
|
6740
6539
|
const reason = file.isBinary ? "Binary file" : "Diff too large to show here";
|
|
6741
|
-
return /* @__PURE__ */
|
|
6742
|
-
/* @__PURE__ */
|
|
6743
|
-
/* @__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: [
|
|
6744
6543
|
reason,
|
|
6745
6544
|
"."
|
|
6746
6545
|
] }),
|
|
6747
|
-
onOpenFile ? /* @__PURE__ */
|
|
6546
|
+
onOpenFile ? /* @__PURE__ */ jsxs5(
|
|
6748
6547
|
"button",
|
|
6749
6548
|
{
|
|
6750
6549
|
type: "button",
|
|
@@ -6752,7 +6551,7 @@ function GuardBody({
|
|
|
6752
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",
|
|
6753
6552
|
children: [
|
|
6754
6553
|
"Open in Files",
|
|
6755
|
-
/* @__PURE__ */
|
|
6554
|
+
/* @__PURE__ */ jsx5(ArrowUpRightIcon, { className: "size-3.5", "aria-hidden": true })
|
|
6756
6555
|
]
|
|
6757
6556
|
}
|
|
6758
6557
|
) : null
|
|
@@ -6762,7 +6561,7 @@ function LayoutToggle({
|
|
|
6762
6561
|
layout,
|
|
6763
6562
|
onChange
|
|
6764
6563
|
}) {
|
|
6765
|
-
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(
|
|
6766
6565
|
"button",
|
|
6767
6566
|
{
|
|
6768
6567
|
type: "button",
|
|
@@ -6778,7 +6577,7 @@ function LayoutToggle({
|
|
|
6778
6577
|
}
|
|
6779
6578
|
|
|
6780
6579
|
// src/components/diff-view.tsx
|
|
6781
|
-
import { jsx as
|
|
6580
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
6782
6581
|
function DiffView({
|
|
6783
6582
|
diff,
|
|
6784
6583
|
fallback,
|
|
@@ -6789,9 +6588,9 @@ function DiffView({
|
|
|
6789
6588
|
className
|
|
6790
6589
|
}) {
|
|
6791
6590
|
if (diff.length === 0) {
|
|
6792
|
-
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") });
|
|
6793
6592
|
}
|
|
6794
|
-
return /* @__PURE__ */
|
|
6593
|
+
return /* @__PURE__ */ jsx6(
|
|
6795
6594
|
PierreDiff,
|
|
6796
6595
|
{
|
|
6797
6596
|
diff,
|
|
@@ -6807,10 +6606,10 @@ function DiffView({
|
|
|
6807
6606
|
import {
|
|
6808
6607
|
lazy,
|
|
6809
6608
|
Suspense,
|
|
6810
|
-
useEffect as
|
|
6609
|
+
useEffect as useEffect17,
|
|
6811
6610
|
useState as useState13
|
|
6812
6611
|
} from "react";
|
|
6813
|
-
import { jsx as
|
|
6612
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
6814
6613
|
var LazyFile = lazy(async () => {
|
|
6815
6614
|
const mod = await import("@pierre/diffs/react");
|
|
6816
6615
|
return { default: mod.File };
|
|
@@ -6826,7 +6625,7 @@ function PierreFile({
|
|
|
6826
6625
|
className
|
|
6827
6626
|
}) {
|
|
6828
6627
|
const [failed, setFailed] = useState13(false);
|
|
6829
|
-
|
|
6628
|
+
useEffect17(() => {
|
|
6830
6629
|
let cancelled = false;
|
|
6831
6630
|
void import("@pierre/diffs/react").catch(() => {
|
|
6832
6631
|
if (!cancelled) setFailed(true);
|
|
@@ -6837,7 +6636,7 @@ function PierreFile({
|
|
|
6837
6636
|
}, []);
|
|
6838
6637
|
const name = path.split("/").filter(Boolean).pop() ?? path;
|
|
6839
6638
|
if (failed) {
|
|
6840
|
-
return /* @__PURE__ */
|
|
6639
|
+
return /* @__PURE__ */ jsx7("div", { className, children: fallback ?? /* @__PURE__ */ jsx7(PlainFile, { name, contents }) });
|
|
6841
6640
|
}
|
|
6842
6641
|
const options = {
|
|
6843
6642
|
overflow: "scroll",
|
|
@@ -6859,7 +6658,7 @@ function PierreFile({
|
|
|
6859
6658
|
"--diffs-font-size": "var(--og-code-font-size)",
|
|
6860
6659
|
"--diffs-line-height": "var(--og-code-line-height)"
|
|
6861
6660
|
};
|
|
6862
|
-
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(
|
|
6863
6662
|
LazyFile,
|
|
6864
6663
|
{
|
|
6865
6664
|
file: { name, contents },
|
|
@@ -6869,7 +6668,7 @@ function PierreFile({
|
|
|
6869
6668
|
) }) });
|
|
6870
6669
|
}
|
|
6871
6670
|
function PlainFile({ name, contents }) {
|
|
6872
|
-
return /* @__PURE__ */
|
|
6671
|
+
return /* @__PURE__ */ jsx7(
|
|
6873
6672
|
"pre",
|
|
6874
6673
|
{
|
|
6875
6674
|
className: "overflow-auto whitespace-pre p-2 font-og-mono text-og-sm text-og-fg",
|
|
@@ -6879,19 +6678,19 @@ function PlainFile({ name, contents }) {
|
|
|
6879
6678
|
);
|
|
6880
6679
|
}
|
|
6881
6680
|
function FileSkeleton() {
|
|
6882
|
-
return /* @__PURE__ */
|
|
6681
|
+
return /* @__PURE__ */ jsx7("div", { className: "p-3 text-og-sm text-og-fg-subtle", children: "Loading file\u2026" });
|
|
6883
6682
|
}
|
|
6884
6683
|
|
|
6885
6684
|
// src/components/code-editor.tsx
|
|
6886
6685
|
import { Loader2Icon, SaveIcon } from "lucide-react";
|
|
6887
6686
|
import {
|
|
6888
|
-
useCallback as
|
|
6889
|
-
useEffect as
|
|
6687
|
+
useCallback as useCallback21,
|
|
6688
|
+
useEffect as useEffect18,
|
|
6890
6689
|
useMemo as useMemo14,
|
|
6891
|
-
useRef as
|
|
6690
|
+
useRef as useRef15,
|
|
6892
6691
|
useState as useState14
|
|
6893
6692
|
} from "react";
|
|
6894
|
-
import { jsx as
|
|
6693
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
6895
6694
|
var LANGUAGE_LOADERS = {
|
|
6896
6695
|
javascript: async () => (await import("@codemirror/lang-javascript")).javascript({ jsx: true, typescript: true }),
|
|
6897
6696
|
json: async () => (await import("@codemirror/lang-json")).json(),
|
|
@@ -6972,19 +6771,19 @@ function CodeEditor({
|
|
|
6972
6771
|
const [saving, setSaving] = useState14(false);
|
|
6973
6772
|
const [saveError, setSaveError] = useState14(null);
|
|
6974
6773
|
const [savedTick, setSavedTick] = useState14(false);
|
|
6975
|
-
const saveInFlightRef =
|
|
6774
|
+
const saveInFlightRef = useRef15(false);
|
|
6976
6775
|
const dirty = value !== baseline;
|
|
6977
6776
|
const saveConflict = saveError !== null && saveError.code === "file_write_conflict";
|
|
6978
|
-
const editIntentFiredRef =
|
|
6979
|
-
|
|
6777
|
+
const editIntentFiredRef = useRef15(false);
|
|
6778
|
+
useEffect18(() => {
|
|
6980
6779
|
setBuffer((current) => reconcileEditorBuffer(current, { path, contents: initialContents }));
|
|
6981
6780
|
}, [path, initialContents]);
|
|
6982
|
-
|
|
6781
|
+
useEffect18(() => {
|
|
6983
6782
|
editIntentFiredRef.current = false;
|
|
6984
6783
|
setSaveError(null);
|
|
6985
6784
|
setSavedTick(false);
|
|
6986
6785
|
}, [path]);
|
|
6987
|
-
const noteEdit =
|
|
6786
|
+
const noteEdit = useCallback21(
|
|
6988
6787
|
(next) => {
|
|
6989
6788
|
setBuffer((current) => ({ ...current, value: next }));
|
|
6990
6789
|
setSavedTick(false);
|
|
@@ -6996,7 +6795,7 @@ function CodeEditor({
|
|
|
6996
6795
|
[baseline, onEditIntent]
|
|
6997
6796
|
);
|
|
6998
6797
|
const langKey = useMemo14(() => languageForPath(path), [path]);
|
|
6999
|
-
|
|
6798
|
+
useEffect18(() => {
|
|
7000
6799
|
let cancelled = false;
|
|
7001
6800
|
void (async () => {
|
|
7002
6801
|
try {
|
|
@@ -7036,9 +6835,9 @@ function CodeEditor({
|
|
|
7036
6835
|
cancelled = true;
|
|
7037
6836
|
};
|
|
7038
6837
|
}, [langKey]);
|
|
7039
|
-
const saveRef =
|
|
6838
|
+
const saveRef = useRef15(() => {
|
|
7040
6839
|
});
|
|
7041
|
-
const save =
|
|
6840
|
+
const save = useCallback21(async () => {
|
|
7042
6841
|
if (readOnly || saveInFlightRef.current) return;
|
|
7043
6842
|
const snapshot = value;
|
|
7044
6843
|
if (snapshot === baseline) return;
|
|
@@ -7059,7 +6858,7 @@ function CodeEditor({
|
|
|
7059
6858
|
setSaving(false);
|
|
7060
6859
|
}
|
|
7061
6860
|
}, [readOnly, value, baseline, onSave, path]);
|
|
7062
|
-
const overwrite =
|
|
6861
|
+
const overwrite = useCallback21(async () => {
|
|
7063
6862
|
if (readOnly || !onOverwrite || saveInFlightRef.current) return;
|
|
7064
6863
|
const snapshot = value;
|
|
7065
6864
|
if (snapshot === baseline) return;
|
|
@@ -7083,7 +6882,7 @@ function CodeEditor({
|
|
|
7083
6882
|
saveRef.current = () => {
|
|
7084
6883
|
void save();
|
|
7085
6884
|
};
|
|
7086
|
-
|
|
6885
|
+
useEffect18(() => {
|
|
7087
6886
|
if (!savedTick) return;
|
|
7088
6887
|
const t = setTimeout(() => setSavedTick(false), 1800);
|
|
7089
6888
|
return () => clearTimeout(t);
|
|
@@ -7096,14 +6895,14 @@ function CodeEditor({
|
|
|
7096
6895
|
return exts;
|
|
7097
6896
|
}, [bundle]);
|
|
7098
6897
|
const Editor = bundle?.Editor;
|
|
7099
|
-
const reload =
|
|
6898
|
+
const reload = useCallback21(() => {
|
|
7100
6899
|
setBuffer({ path, value: initialContents, baseline: initialContents });
|
|
7101
6900
|
editIntentFiredRef.current = false;
|
|
7102
6901
|
setSaveError(null);
|
|
7103
6902
|
setSavedTick(false);
|
|
7104
6903
|
onReload?.();
|
|
7105
6904
|
}, [initialContents, onReload, path]);
|
|
7106
|
-
return /* @__PURE__ */
|
|
6905
|
+
return /* @__PURE__ */ jsxs6(
|
|
7107
6906
|
"div",
|
|
7108
6907
|
{
|
|
7109
6908
|
className: cn("flex h-full min-h-0 flex-col", className),
|
|
@@ -7111,8 +6910,8 @@ function CodeEditor({
|
|
|
7111
6910
|
"data-opengeni-editor-dirty": dirty ? "true" : "false",
|
|
7112
6911
|
style: editorVars,
|
|
7113
6912
|
children: [
|
|
7114
|
-
/* @__PURE__ */
|
|
7115
|
-
/* @__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(
|
|
7116
6915
|
"span",
|
|
7117
6916
|
{
|
|
7118
6917
|
className: cn(
|
|
@@ -7122,12 +6921,12 @@ function CodeEditor({
|
|
|
7122
6921
|
title: readOnly ? "read-only" : dirty ? "unsaved changes" : "saved"
|
|
7123
6922
|
}
|
|
7124
6923
|
),
|
|
7125
|
-
/* @__PURE__ */
|
|
6924
|
+
/* @__PURE__ */ jsxs6("span", { className: "truncate font-og-mono text-og-xs text-og-fg-muted", children: [
|
|
7126
6925
|
fileName,
|
|
7127
6926
|
dirty && !readOnly ? " \u2022" : ""
|
|
7128
6927
|
] }),
|
|
7129
|
-
/* @__PURE__ */
|
|
7130
|
-
saveError && !saveConflict && /* @__PURE__ */
|
|
6928
|
+
/* @__PURE__ */ jsxs6("div", { className: "ml-auto flex shrink-0 items-center gap-2", children: [
|
|
6929
|
+
saveError && !saveConflict && /* @__PURE__ */ jsx8(
|
|
7131
6930
|
"span",
|
|
7132
6931
|
{
|
|
7133
6932
|
className: "max-w-[220px] truncate text-og-xs text-og-status-failed",
|
|
@@ -7135,8 +6934,8 @@ function CodeEditor({
|
|
|
7135
6934
|
children: saveError.message
|
|
7136
6935
|
}
|
|
7137
6936
|
),
|
|
7138
|
-
!saveError && savedTick && !dirty && /* @__PURE__ */
|
|
7139
|
-
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(
|
|
7140
6939
|
"button",
|
|
7141
6940
|
{
|
|
7142
6941
|
type: "button",
|
|
@@ -7148,26 +6947,26 @@ function CodeEditor({
|
|
|
7148
6947
|
),
|
|
7149
6948
|
title: "Save (\u2318/Ctrl+S)",
|
|
7150
6949
|
children: [
|
|
7151
|
-
saving ? /* @__PURE__ */
|
|
6950
|
+
saving ? /* @__PURE__ */ jsx8(Loader2Icon, { className: "size-3 animate-spin" }) : /* @__PURE__ */ jsx8(SaveIcon, { className: "size-3" }),
|
|
7152
6951
|
"Save"
|
|
7153
6952
|
]
|
|
7154
6953
|
}
|
|
7155
6954
|
) : null
|
|
7156
6955
|
] })
|
|
7157
6956
|
] }),
|
|
7158
|
-
saveConflict ? /* @__PURE__ */
|
|
6957
|
+
saveConflict ? /* @__PURE__ */ jsxs6(
|
|
7159
6958
|
"div",
|
|
7160
6959
|
{
|
|
7161
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",
|
|
7162
6961
|
role: "alert",
|
|
7163
6962
|
children: [
|
|
7164
|
-
/* @__PURE__ */
|
|
7165
|
-
/* @__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." }),
|
|
7166
6965
|
" ",
|
|
7167
6966
|
"Reloading discards your edits; overwriting replaces the live version."
|
|
7168
6967
|
] }),
|
|
7169
|
-
/* @__PURE__ */
|
|
7170
|
-
onReload ? /* @__PURE__ */
|
|
6968
|
+
/* @__PURE__ */ jsxs6("div", { className: "ml-auto flex shrink-0 items-center gap-1.5", children: [
|
|
6969
|
+
onReload ? /* @__PURE__ */ jsx8(
|
|
7171
6970
|
"button",
|
|
7172
6971
|
{
|
|
7173
6972
|
type: "button",
|
|
@@ -7178,7 +6977,7 @@ function CodeEditor({
|
|
|
7178
6977
|
children: "Reload live"
|
|
7179
6978
|
}
|
|
7180
6979
|
) : null,
|
|
7181
|
-
onOverwrite ? /* @__PURE__ */
|
|
6980
|
+
onOverwrite ? /* @__PURE__ */ jsx8(
|
|
7182
6981
|
"button",
|
|
7183
6982
|
{
|
|
7184
6983
|
type: "button",
|
|
@@ -7192,7 +6991,7 @@ function CodeEditor({
|
|
|
7192
6991
|
]
|
|
7193
6992
|
}
|
|
7194
6993
|
) : null,
|
|
7195
|
-
/* @__PURE__ */
|
|
6994
|
+
/* @__PURE__ */ jsx8("div", { className: "min-h-0 flex-1 overflow-auto", children: failed ? fallback ?? /* @__PURE__ */ jsx8(
|
|
7196
6995
|
PlainTextarea,
|
|
7197
6996
|
{
|
|
7198
6997
|
value,
|
|
@@ -7200,7 +6999,7 @@ function CodeEditor({
|
|
|
7200
6999
|
onChange: noteEdit,
|
|
7201
7000
|
onSave: () => void save()
|
|
7202
7001
|
}
|
|
7203
|
-
) : Editor ? /* @__PURE__ */
|
|
7002
|
+
) : Editor ? /* @__PURE__ */ jsx8(
|
|
7204
7003
|
Editor,
|
|
7205
7004
|
{
|
|
7206
7005
|
value,
|
|
@@ -7213,7 +7012,7 @@ function CodeEditor({
|
|
|
7213
7012
|
className: "og-cm-editor min-h-full text-og-sm",
|
|
7214
7013
|
onChange: readOnly ? void 0 : noteEdit
|
|
7215
7014
|
}
|
|
7216
|
-
) : loading ?? /* @__PURE__ */
|
|
7015
|
+
) : loading ?? /* @__PURE__ */ jsx8(EditorSkeleton, {}) })
|
|
7217
7016
|
]
|
|
7218
7017
|
}
|
|
7219
7018
|
);
|
|
@@ -7228,7 +7027,7 @@ function PlainTextarea({
|
|
|
7228
7027
|
onChange,
|
|
7229
7028
|
onSave
|
|
7230
7029
|
}) {
|
|
7231
|
-
return /* @__PURE__ */
|
|
7030
|
+
return /* @__PURE__ */ jsx8(
|
|
7232
7031
|
"textarea",
|
|
7233
7032
|
{
|
|
7234
7033
|
value,
|
|
@@ -7247,14 +7046,14 @@ function PlainTextarea({
|
|
|
7247
7046
|
);
|
|
7248
7047
|
}
|
|
7249
7048
|
function EditorSkeleton() {
|
|
7250
|
-
return /* @__PURE__ */
|
|
7049
|
+
return /* @__PURE__ */ jsx8("div", { className: "p-3 text-og-sm text-og-fg-subtle", children: "Loading editor\u2026" });
|
|
7251
7050
|
}
|
|
7252
7051
|
|
|
7253
7052
|
// src/components/sandbox-files.tsx
|
|
7254
7053
|
import { FileCode2Icon, FileWarningIcon as FileWarningIcon2, LoaderCircleIcon } from "lucide-react";
|
|
7255
|
-
import { useCallback as
|
|
7054
|
+
import { useCallback as useCallback22, useEffect as useEffect19, useRef as useRef16, useState as useState15 } from "react";
|
|
7256
7055
|
import { Group, Panel, Separator } from "react-resizable-panels";
|
|
7257
|
-
import { Fragment as
|
|
7056
|
+
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
7258
7057
|
function SandboxFiles({
|
|
7259
7058
|
files,
|
|
7260
7059
|
git,
|
|
@@ -7282,11 +7081,11 @@ function SandboxFiles({
|
|
|
7282
7081
|
const [treeRevealRequest, setTreeRevealRequest] = useState15(null);
|
|
7283
7082
|
const [liveRequestedPath, setLiveRequestedPath] = useState15(null);
|
|
7284
7083
|
const [viewReloadRevision, setViewReloadRevision] = useState15(0);
|
|
7285
|
-
const viewerScrollRef =
|
|
7286
|
-
const pendingRequestRef =
|
|
7287
|
-
const handledRequestRef =
|
|
7084
|
+
const viewerScrollRef = useRef16(null);
|
|
7085
|
+
const pendingRequestRef = useRef16(null);
|
|
7086
|
+
const handledRequestRef = useRef16(null);
|
|
7288
7087
|
const requestKey = requestedPath ? requestedPathRequestId ?? requestedPath : null;
|
|
7289
|
-
|
|
7088
|
+
useEffect19(() => {
|
|
7290
7089
|
if (!requestedPath || requestKey === null) {
|
|
7291
7090
|
pendingRequestRef.current = null;
|
|
7292
7091
|
handledRequestRef.current = null;
|
|
@@ -7332,9 +7131,9 @@ function SandboxFiles({
|
|
|
7332
7131
|
requestedPath,
|
|
7333
7132
|
requestedPathReady
|
|
7334
7133
|
]);
|
|
7335
|
-
const rootRef =
|
|
7134
|
+
const rootRef = useRef16(null);
|
|
7336
7135
|
const [wide, setWide] = useState15(false);
|
|
7337
|
-
|
|
7136
|
+
useEffect19(() => {
|
|
7338
7137
|
const el = rootRef.current;
|
|
7339
7138
|
if (!el) return;
|
|
7340
7139
|
const update = () => setWide(el.getBoundingClientRect().width >= 720);
|
|
@@ -7357,7 +7156,7 @@ function SandboxFiles({
|
|
|
7357
7156
|
const selectedVisibility = selected ? filePathVisibility(files.tree, selected, isNodeVisible) : "unknown";
|
|
7358
7157
|
const visibilityPending = Boolean(isNodeVisible && files.loading && files.tree.length === 0);
|
|
7359
7158
|
const viewPath = selectedVisibility === "hidden" || visibilityPending ? null : selected;
|
|
7360
|
-
|
|
7159
|
+
useEffect19(() => {
|
|
7361
7160
|
if (selected === null || selectedVisibility !== "hidden") return;
|
|
7362
7161
|
setSelected(null);
|
|
7363
7162
|
onSelectedPathChange?.(null);
|
|
@@ -7371,12 +7170,12 @@ function SandboxFiles({
|
|
|
7371
7170
|
files.readFile,
|
|
7372
7171
|
`${files.contentRevision ?? 0}:${viewReloadRevision}`
|
|
7373
7172
|
);
|
|
7374
|
-
|
|
7173
|
+
useEffect19(() => {
|
|
7375
7174
|
if (focusLine === null && viewReloadRevision > 0 && viewerScrollRef.current) {
|
|
7376
7175
|
viewerScrollRef.current.scrollTop = 0;
|
|
7377
7176
|
}
|
|
7378
7177
|
}, [focusLine, viewReloadRevision]);
|
|
7379
|
-
const selectFile =
|
|
7178
|
+
const selectFile = useCallback22(
|
|
7380
7179
|
(path) => {
|
|
7381
7180
|
if (pendingRequestRef.current !== null) {
|
|
7382
7181
|
handledRequestRef.current = pendingRequestRef.current;
|
|
@@ -7397,39 +7196,39 @@ function SandboxFiles({
|
|
|
7397
7196
|
const captureFileUnavailable = fileView.error instanceof CapturedFileUnavailableError ? fileView.error : null;
|
|
7398
7197
|
const waitingForSelectedFile = liveRequestedPath === viewPath && (!liveWorkspaceReady || files.loading) && captureFileUnavailable !== null;
|
|
7399
7198
|
if (workspaceResting || workspaceWaking) {
|
|
7400
|
-
return /* @__PURE__ */
|
|
7199
|
+
return /* @__PURE__ */ jsx9("div", { className: cn("h-full", className), "data-opengeni-workspace-resting": true, children: /* @__PURE__ */ jsxs7(
|
|
7401
7200
|
Notice,
|
|
7402
7201
|
{
|
|
7403
|
-
icon: workspaceWaking ? /* @__PURE__ */
|
|
7202
|
+
icon: workspaceWaking ? /* @__PURE__ */ jsx9(
|
|
7404
7203
|
LoaderCircleIcon,
|
|
7405
7204
|
{
|
|
7406
7205
|
className: "size-5 animate-spin motion-reduce:animate-none",
|
|
7407
7206
|
"aria-hidden": true
|
|
7408
7207
|
}
|
|
7409
|
-
) : /* @__PURE__ */
|
|
7208
|
+
) : /* @__PURE__ */ jsx9(FileCode2Icon, { className: "size-5", "aria-hidden": true }),
|
|
7410
7209
|
title: workspaceWaking ? "Waking workspace" : "Workspace is resting",
|
|
7411
7210
|
announce: "status",
|
|
7412
7211
|
children: [
|
|
7413
|
-
/* @__PURE__ */
|
|
7414
|
-
!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
|
|
7415
7214
|
]
|
|
7416
7215
|
}
|
|
7417
7216
|
) });
|
|
7418
7217
|
}
|
|
7419
7218
|
if (!fileSystemAvailable) {
|
|
7420
|
-
return /* @__PURE__ */
|
|
7219
|
+
return /* @__PURE__ */ jsx9(
|
|
7421
7220
|
Notice,
|
|
7422
7221
|
{
|
|
7423
7222
|
className,
|
|
7424
|
-
icon: /* @__PURE__ */
|
|
7223
|
+
icon: /* @__PURE__ */ jsx9(FileWarningIcon2, { className: "size-5", "aria-hidden": true }),
|
|
7425
7224
|
title: "Files unavailable",
|
|
7426
7225
|
announce: "alert",
|
|
7427
7226
|
children: "This sandbox does not expose a file system."
|
|
7428
7227
|
}
|
|
7429
7228
|
);
|
|
7430
7229
|
}
|
|
7431
|
-
return /* @__PURE__ */
|
|
7432
|
-
/* @__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(
|
|
7433
7232
|
GitHeader,
|
|
7434
7233
|
{
|
|
7435
7234
|
loading: Boolean(files.loading || files.gitLoading || files.source === null || git?.loading) && files.gitSummary === null,
|
|
@@ -7443,13 +7242,13 @@ function SandboxFiles({
|
|
|
7443
7242
|
}
|
|
7444
7243
|
}
|
|
7445
7244
|
),
|
|
7446
|
-
/* @__PURE__ */
|
|
7245
|
+
/* @__PURE__ */ jsxs7(
|
|
7447
7246
|
Group,
|
|
7448
7247
|
{
|
|
7449
7248
|
orientation: wide ? "horizontal" : "vertical",
|
|
7450
7249
|
className: cn("min-h-0 flex-1", wide ? "flex-row" : "flex-col"),
|
|
7451
7250
|
children: [
|
|
7452
|
-
/* @__PURE__ */
|
|
7251
|
+
/* @__PURE__ */ jsx9(
|
|
7453
7252
|
Panel,
|
|
7454
7253
|
{
|
|
7455
7254
|
id: "sandbox-files-tree",
|
|
@@ -7457,7 +7256,7 @@ function SandboxFiles({
|
|
|
7457
7256
|
minSize: wide ? "180px" : "120px",
|
|
7458
7257
|
maxSize: wide ? "60%" : "70%",
|
|
7459
7258
|
className: "flex min-h-0 min-w-0 flex-col",
|
|
7460
|
-
children: /* @__PURE__ */
|
|
7259
|
+
children: /* @__PURE__ */ jsx9(
|
|
7461
7260
|
FileBrowser,
|
|
7462
7261
|
{
|
|
7463
7262
|
result: files,
|
|
@@ -7475,7 +7274,7 @@ function SandboxFiles({
|
|
|
7475
7274
|
)
|
|
7476
7275
|
}
|
|
7477
7276
|
),
|
|
7478
|
-
/* @__PURE__ */
|
|
7277
|
+
/* @__PURE__ */ jsx9(
|
|
7479
7278
|
Separator,
|
|
7480
7279
|
{
|
|
7481
7280
|
"aria-label": "Resize file tree",
|
|
@@ -7487,15 +7286,15 @@ function SandboxFiles({
|
|
|
7487
7286
|
)
|
|
7488
7287
|
}
|
|
7489
7288
|
),
|
|
7490
|
-
/* @__PURE__ */
|
|
7289
|
+
/* @__PURE__ */ jsxs7(
|
|
7491
7290
|
Panel,
|
|
7492
7291
|
{
|
|
7493
7292
|
id: "sandbox-files-viewer",
|
|
7494
7293
|
minSize: wide ? "240px" : "160px",
|
|
7495
7294
|
className: cn("flex min-h-0 min-w-0 flex-col", !wide && "border-t border-og-border"),
|
|
7496
7295
|
children: [
|
|
7497
|
-
/* @__PURE__ */
|
|
7498
|
-
/* @__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(
|
|
7499
7298
|
"span",
|
|
7500
7299
|
{
|
|
7501
7300
|
"data-opengeni-selected-file": true,
|
|
@@ -7503,7 +7302,7 @@ function SandboxFiles({
|
|
|
7503
7302
|
children: selected ? focusLine !== null ? `${selected}:${focusLine}` : selected : "No file selected"
|
|
7504
7303
|
}
|
|
7505
7304
|
),
|
|
7506
|
-
canEdit && /* @__PURE__ */
|
|
7305
|
+
canEdit && /* @__PURE__ */ jsx9(
|
|
7507
7306
|
Segmented,
|
|
7508
7307
|
{
|
|
7509
7308
|
options: [
|
|
@@ -7515,13 +7314,13 @@ function SandboxFiles({
|
|
|
7515
7314
|
}
|
|
7516
7315
|
)
|
|
7517
7316
|
] }),
|
|
7518
|
-
/* @__PURE__ */
|
|
7317
|
+
/* @__PURE__ */ jsx9(
|
|
7519
7318
|
"div",
|
|
7520
7319
|
{
|
|
7521
7320
|
ref: viewerScrollRef,
|
|
7522
7321
|
className: "min-h-0 flex-1 overflow-auto",
|
|
7523
7322
|
"data-opengeni-file-viewer-scroll": true,
|
|
7524
|
-
children: viewPath ? showEditor && fileView.content !== null ? /* @__PURE__ */
|
|
7323
|
+
children: viewPath ? showEditor && fileView.content !== null ? /* @__PURE__ */ jsx9(
|
|
7525
7324
|
CodeEditor,
|
|
7526
7325
|
{
|
|
7527
7326
|
path: viewPath,
|
|
@@ -7534,10 +7333,10 @@ function SandboxFiles({
|
|
|
7534
7333
|
className: "h-full"
|
|
7535
7334
|
},
|
|
7536
7335
|
viewPath
|
|
7537
|
-
) : waitingForSelectedFile ? /* @__PURE__ */
|
|
7336
|
+
) : waitingForSelectedFile ? /* @__PURE__ */ jsxs7(
|
|
7538
7337
|
Notice,
|
|
7539
7338
|
{
|
|
7540
|
-
icon: /* @__PURE__ */
|
|
7339
|
+
icon: /* @__PURE__ */ jsx9(
|
|
7541
7340
|
LoaderCircleIcon,
|
|
7542
7341
|
{
|
|
7543
7342
|
className: "size-5 animate-spin motion-reduce:animate-none",
|
|
@@ -7552,9 +7351,9 @@ function SandboxFiles({
|
|
|
7552
7351
|
" when the live file system is ready\u2026"
|
|
7553
7352
|
]
|
|
7554
7353
|
}
|
|
7555
|
-
) : captureFileUnavailable ? /* @__PURE__ */
|
|
7556
|
-
/* @__PURE__ */
|
|
7557
|
-
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(
|
|
7558
7357
|
WakeButton,
|
|
7559
7358
|
{
|
|
7560
7359
|
onClick: () => {
|
|
@@ -7565,54 +7364,54 @@ function SandboxFiles({
|
|
|
7565
7364
|
children: liveWorkspaceReady ? "Retry live file" : "Open live file"
|
|
7566
7365
|
}
|
|
7567
7366
|
) : null
|
|
7568
|
-
] }) : fileView.error ? /* @__PURE__ */
|
|
7367
|
+
] }) : fileView.error ? /* @__PURE__ */ jsxs7(Notice, { announce: "alert", children: [
|
|
7569
7368
|
"Could not open ",
|
|
7570
7369
|
viewPath,
|
|
7571
7370
|
": ",
|
|
7572
7371
|
fileView.error.message
|
|
7573
|
-
] }) : fileView.loading ? /* @__PURE__ */
|
|
7372
|
+
] }) : fileView.loading ? /* @__PURE__ */ jsxs7(Notice, { announce: "status", children: [
|
|
7574
7373
|
"Loading ",
|
|
7575
7374
|
viewPath,
|
|
7576
7375
|
"\u2026"
|
|
7577
|
-
] }) : fileView.isBinary ? /* @__PURE__ */
|
|
7376
|
+
] }) : fileView.isBinary ? /* @__PURE__ */ jsxs7(Notice, { children: [
|
|
7578
7377
|
viewPath,
|
|
7579
7378
|
" is a binary file (",
|
|
7580
7379
|
fileView.sizeBytes ?? 0,
|
|
7581
7380
|
" bytes)."
|
|
7582
|
-
] }) : fileView.content !== null ? /* @__PURE__ */
|
|
7583
|
-
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: [
|
|
7584
7383
|
"Large file \u2014 showing a truncated preview (",
|
|
7585
7384
|
fileView.sizeBytes ?? 0,
|
|
7586
7385
|
" bytes loaded). Editing is disabled to avoid corrupting the file."
|
|
7587
7386
|
] }),
|
|
7588
|
-
usePierre && focusLine === null ? /* @__PURE__ */
|
|
7387
|
+
usePierre && focusLine === null ? /* @__PURE__ */ jsx9(
|
|
7589
7388
|
PierreFile,
|
|
7590
7389
|
{
|
|
7591
7390
|
path: viewPath,
|
|
7592
7391
|
contents: fileView.content,
|
|
7593
7392
|
themeType: resolvedTheme,
|
|
7594
|
-
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 }),
|
|
7595
7394
|
className: "p-1"
|
|
7596
7395
|
},
|
|
7597
7396
|
`${viewPath}:${viewReloadRevision}`
|
|
7598
|
-
) : focusLine !== null ? /* @__PURE__ */
|
|
7397
|
+
) : focusLine !== null ? /* @__PURE__ */ jsx9(
|
|
7599
7398
|
LineNumberedFile,
|
|
7600
7399
|
{
|
|
7601
7400
|
path: viewPath,
|
|
7602
7401
|
contents: fileView.content,
|
|
7603
7402
|
focusLine
|
|
7604
7403
|
}
|
|
7605
|
-
) : /* @__PURE__ */
|
|
7606
|
-
] }) : /* @__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: [
|
|
7607
7406
|
"Loading ",
|
|
7608
7407
|
viewPath,
|
|
7609
7408
|
"\u2026"
|
|
7610
7409
|
] }) : (
|
|
7611
7410
|
// Nothing selected — the tree shows the whole workspace; pick a file.
|
|
7612
|
-
requestedPath && !requestedPathReady ? /* @__PURE__ */
|
|
7411
|
+
requestedPath && !requestedPathReady ? /* @__PURE__ */ jsxs7(
|
|
7613
7412
|
Notice,
|
|
7614
7413
|
{
|
|
7615
|
-
icon: /* @__PURE__ */
|
|
7414
|
+
icon: /* @__PURE__ */ jsx9(
|
|
7616
7415
|
LoaderCircleIcon,
|
|
7617
7416
|
{
|
|
7618
7417
|
className: "size-5 animate-spin motion-reduce:animate-none",
|
|
@@ -7627,7 +7426,7 @@ function SandboxFiles({
|
|
|
7627
7426
|
" when the live workspace is ready\u2026"
|
|
7628
7427
|
]
|
|
7629
7428
|
}
|
|
7630
|
-
) : /* @__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." })
|
|
7631
7430
|
)
|
|
7632
7431
|
}
|
|
7633
7432
|
)
|
|
@@ -7640,7 +7439,7 @@ function SandboxFiles({
|
|
|
7640
7439
|
] });
|
|
7641
7440
|
}
|
|
7642
7441
|
function WakeButton({ children, onClick }) {
|
|
7643
|
-
return /* @__PURE__ */
|
|
7442
|
+
return /* @__PURE__ */ jsx9(
|
|
7644
7443
|
"button",
|
|
7645
7444
|
{
|
|
7646
7445
|
type: "button",
|
|
@@ -7657,21 +7456,21 @@ function LineNumberedFile({
|
|
|
7657
7456
|
}) {
|
|
7658
7457
|
const lines = contents.split("\n");
|
|
7659
7458
|
const inRange = focusLine >= 1 && focusLine <= lines.length;
|
|
7660
|
-
const targetRef =
|
|
7661
|
-
|
|
7459
|
+
const targetRef = useRef16(null);
|
|
7460
|
+
useEffect19(() => {
|
|
7662
7461
|
targetRef.current?.scrollIntoView({
|
|
7663
7462
|
block: "center",
|
|
7664
7463
|
behavior: prefersReducedMotion() ? "auto" : "smooth"
|
|
7665
7464
|
});
|
|
7666
7465
|
}, [path, focusLine, contents]);
|
|
7667
|
-
return /* @__PURE__ */
|
|
7466
|
+
return /* @__PURE__ */ jsxs7(
|
|
7668
7467
|
"div",
|
|
7669
7468
|
{
|
|
7670
7469
|
className: "h-full min-h-0 overflow-auto font-og-mono text-og-sm text-og-fg",
|
|
7671
7470
|
role: "region",
|
|
7672
7471
|
"aria-label": inRange ? `${path} at line ${focusLine}` : path,
|
|
7673
7472
|
children: [
|
|
7674
|
-
!inRange ? /* @__PURE__ */
|
|
7473
|
+
!inRange ? /* @__PURE__ */ jsxs7(
|
|
7675
7474
|
"p",
|
|
7676
7475
|
{
|
|
7677
7476
|
className: "border-b border-og-border bg-og-surface-1 px-2 py-1 text-og-xs text-og-fg-muted",
|
|
@@ -7683,10 +7482,10 @@ function LineNumberedFile({
|
|
|
7683
7482
|
]
|
|
7684
7483
|
}
|
|
7685
7484
|
) : null,
|
|
7686
|
-
/* @__PURE__ */
|
|
7485
|
+
/* @__PURE__ */ jsx9("div", { children: lines.map((text, index) => {
|
|
7687
7486
|
const lineNumber = index + 1;
|
|
7688
7487
|
const focused = inRange && lineNumber === focusLine;
|
|
7689
|
-
return /* @__PURE__ */
|
|
7488
|
+
return /* @__PURE__ */ jsxs7(
|
|
7690
7489
|
"div",
|
|
7691
7490
|
{
|
|
7692
7491
|
ref: focused ? targetRef : void 0,
|
|
@@ -7695,8 +7494,8 @@ function LineNumberedFile({
|
|
|
7695
7494
|
"aria-current": focused ? "location" : void 0,
|
|
7696
7495
|
className: cn("flex gap-3 px-2 py-0.5 leading-6", focused && "bg-og-accent-soft"),
|
|
7697
7496
|
children: [
|
|
7698
|
-
/* @__PURE__ */
|
|
7699
|
-
/* @__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 || " " })
|
|
7700
7499
|
]
|
|
7701
7500
|
},
|
|
7702
7501
|
lineNumber
|
|
@@ -7708,28 +7507,28 @@ function LineNumberedFile({
|
|
|
7708
7507
|
}
|
|
7709
7508
|
function GitHeader({ git, loading }) {
|
|
7710
7509
|
if (loading) {
|
|
7711
|
-
return /* @__PURE__ */
|
|
7510
|
+
return /* @__PURE__ */ jsxs7(
|
|
7712
7511
|
"div",
|
|
7713
7512
|
{
|
|
7714
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",
|
|
7715
7514
|
role: "status",
|
|
7716
7515
|
"aria-live": "polite",
|
|
7717
7516
|
children: [
|
|
7718
|
-
/* @__PURE__ */
|
|
7517
|
+
/* @__PURE__ */ jsx9(
|
|
7719
7518
|
LoaderCircleIcon,
|
|
7720
7519
|
{
|
|
7721
7520
|
className: "size-3.5 shrink-0 animate-spin motion-reduce:animate-none",
|
|
7722
7521
|
"aria-hidden": true
|
|
7723
7522
|
}
|
|
7724
7523
|
),
|
|
7725
|
-
/* @__PURE__ */
|
|
7524
|
+
/* @__PURE__ */ jsx9("span", { children: "Loading repository\u2026" })
|
|
7726
7525
|
]
|
|
7727
7526
|
}
|
|
7728
7527
|
);
|
|
7729
7528
|
}
|
|
7730
7529
|
const dirty = git.dirtyCount > 0;
|
|
7731
|
-
return /* @__PURE__ */
|
|
7732
|
-
/* @__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(
|
|
7733
7532
|
"span",
|
|
7734
7533
|
{
|
|
7735
7534
|
"aria-hidden": "true",
|
|
@@ -7739,19 +7538,19 @@ function GitHeader({ git, loading }) {
|
|
|
7739
7538
|
)
|
|
7740
7539
|
}
|
|
7741
7540
|
),
|
|
7742
|
-
/* @__PURE__ */
|
|
7743
|
-
/* @__PURE__ */
|
|
7744
|
-
(git.ahead > 0 || git.behind > 0) && /* @__PURE__ */
|
|
7745
|
-
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: [
|
|
7746
7545
|
"\u2191",
|
|
7747
7546
|
git.ahead
|
|
7748
7547
|
] }),
|
|
7749
|
-
git.behind > 0 && /* @__PURE__ */
|
|
7548
|
+
git.behind > 0 && /* @__PURE__ */ jsxs7("span", { children: [
|
|
7750
7549
|
"\u2193",
|
|
7751
7550
|
git.behind
|
|
7752
7551
|
] })
|
|
7753
7552
|
] }),
|
|
7754
|
-
dirty && /* @__PURE__ */
|
|
7553
|
+
dirty && /* @__PURE__ */ jsxs7(
|
|
7755
7554
|
"span",
|
|
7756
7555
|
{
|
|
7757
7556
|
"aria-hidden": "true",
|
|
@@ -7770,7 +7569,7 @@ function Segmented({
|
|
|
7770
7569
|
value,
|
|
7771
7570
|
onChange
|
|
7772
7571
|
}) {
|
|
7773
|
-
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(
|
|
7774
7573
|
"button",
|
|
7775
7574
|
{
|
|
7776
7575
|
type: "button",
|
|
@@ -7785,7 +7584,7 @@ function Segmented({
|
|
|
7785
7584
|
)) });
|
|
7786
7585
|
}
|
|
7787
7586
|
function useFileView(path, readFile, reloadRevision = 0) {
|
|
7788
|
-
const previousPathRef =
|
|
7587
|
+
const previousPathRef = useRef16(null);
|
|
7789
7588
|
const [state, setState] = useState15({
|
|
7790
7589
|
content: null,
|
|
7791
7590
|
isBinary: false,
|
|
@@ -7794,7 +7593,7 @@ function useFileView(path, readFile, reloadRevision = 0) {
|
|
|
7794
7593
|
loading: false,
|
|
7795
7594
|
error: null
|
|
7796
7595
|
});
|
|
7797
|
-
|
|
7596
|
+
useEffect19(() => {
|
|
7798
7597
|
if (!path) {
|
|
7799
7598
|
previousPathRef.current = null;
|
|
7800
7599
|
setState({
|
|
@@ -7874,7 +7673,7 @@ function Notice({
|
|
|
7874
7673
|
title,
|
|
7875
7674
|
announce
|
|
7876
7675
|
}) {
|
|
7877
|
-
return /* @__PURE__ */
|
|
7676
|
+
return /* @__PURE__ */ jsx9(
|
|
7878
7677
|
"div",
|
|
7879
7678
|
{
|
|
7880
7679
|
role: announce,
|
|
@@ -7884,10 +7683,10 @@ function Notice({
|
|
|
7884
7683
|
"flex h-full items-center justify-center p-4 text-center text-og-sm text-og-fg-subtle",
|
|
7885
7684
|
className
|
|
7886
7685
|
),
|
|
7887
|
-
children: /* @__PURE__ */
|
|
7888
|
-
icon ? /* @__PURE__ */
|
|
7889
|
-
title ? /* @__PURE__ */
|
|
7890
|
-
/* @__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 })
|
|
7891
7690
|
] })
|
|
7892
7691
|
}
|
|
7893
7692
|
);
|
|
@@ -7895,11 +7694,11 @@ function Notice({
|
|
|
7895
7694
|
|
|
7896
7695
|
// src/components/workspace-dock.tsx
|
|
7897
7696
|
import {
|
|
7898
|
-
useCallback as
|
|
7899
|
-
useEffect as
|
|
7697
|
+
useCallback as useCallback23,
|
|
7698
|
+
useEffect as useEffect20,
|
|
7900
7699
|
useId as useId4,
|
|
7901
7700
|
useLayoutEffect as useLayoutEffect4,
|
|
7902
|
-
useRef as
|
|
7701
|
+
useRef as useRef17,
|
|
7903
7702
|
useState as useState16
|
|
7904
7703
|
} from "react";
|
|
7905
7704
|
import {
|
|
@@ -7916,7 +7715,7 @@ import {
|
|
|
7916
7715
|
useDefaultLayout,
|
|
7917
7716
|
usePanelRef
|
|
7918
7717
|
} from "react-resizable-panels";
|
|
7919
|
-
import { Fragment as
|
|
7718
|
+
import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
7920
7719
|
var SERVER_LAYOUT_STORAGE = {
|
|
7921
7720
|
getItem: () => null,
|
|
7922
7721
|
setItem: () => {
|
|
@@ -7930,7 +7729,7 @@ function getLayoutStorage() {
|
|
|
7930
7729
|
return SERVER_LAYOUT_STORAGE;
|
|
7931
7730
|
}
|
|
7932
7731
|
}
|
|
7933
|
-
var useDockLayoutEffect = typeof window === "undefined" ?
|
|
7732
|
+
var useDockLayoutEffect = typeof window === "undefined" ? useEffect20 : useLayoutEffect4;
|
|
7934
7733
|
var DOCK_OVERLAY_BREAKPOINT = 1024;
|
|
7935
7734
|
function useIsNarrow(maxWidth) {
|
|
7936
7735
|
const [narrow, setNarrow] = useState16(false);
|
|
@@ -7967,30 +7766,30 @@ function WorkspaceDock({
|
|
|
7967
7766
|
className
|
|
7968
7767
|
}) {
|
|
7969
7768
|
const narrow = useIsNarrow(DOCK_OVERLAY_BREAKPOINT);
|
|
7970
|
-
const rootRef =
|
|
7971
|
-
const reopenRef =
|
|
7972
|
-
const returnFocusRef =
|
|
7973
|
-
const initialNarrowFocusRef =
|
|
7769
|
+
const rootRef = useRef17(null);
|
|
7770
|
+
const reopenRef = useRef17(null);
|
|
7771
|
+
const returnFocusRef = useRef17(null);
|
|
7772
|
+
const initialNarrowFocusRef = useRef17(false);
|
|
7974
7773
|
const dockPanelRef = usePanelRef();
|
|
7975
7774
|
const [internalCollapsed, setInternalCollapsed] = useState16(false);
|
|
7976
7775
|
const [maximized, setMaximized] = useState16(false);
|
|
7977
7776
|
const [internalTab, setInternalTab] = useState16(tabs[0]?.id ?? "");
|
|
7978
7777
|
const collapsed = collapsedProp ?? internalCollapsed;
|
|
7979
7778
|
const hostControlled = collapsedProp !== void 0;
|
|
7980
|
-
const previousCollapsedRef =
|
|
7779
|
+
const previousCollapsedRef = useRef17(collapsed);
|
|
7981
7780
|
const { defaultLayout, onLayoutChanged } = useDefaultLayout({
|
|
7982
7781
|
panelIds: ["primary", "dock"],
|
|
7983
7782
|
storage: getLayoutStorage(),
|
|
7984
7783
|
id: autoSaveId
|
|
7985
7784
|
});
|
|
7986
7785
|
const expandedDefaultLayout = defaultLayout && (defaultLayout.dock ?? 0) > 1 ? defaultLayout : void 0;
|
|
7987
|
-
const lastExpandedSizeRef =
|
|
7988
|
-
const layoutIdentityRef =
|
|
7786
|
+
const lastExpandedSizeRef = useRef17(expandedDefaultLayout?.dock ?? defaultSize);
|
|
7787
|
+
const layoutIdentityRef = useRef17(autoSaveId);
|
|
7989
7788
|
if (layoutIdentityRef.current !== autoSaveId) {
|
|
7990
7789
|
layoutIdentityRef.current = autoSaveId;
|
|
7991
7790
|
lastExpandedSizeRef.current = expandedDefaultLayout?.dock ?? defaultSize;
|
|
7992
7791
|
}
|
|
7993
|
-
const persistExpandedLayout =
|
|
7792
|
+
const persistExpandedLayout = useCallback23(
|
|
7994
7793
|
(layout, meta) => {
|
|
7995
7794
|
const dockSize = layout.dock ?? 0;
|
|
7996
7795
|
if (dockSize <= 1) return;
|
|
@@ -8004,14 +7803,14 @@ function WorkspaceDock({
|
|
|
8004
7803
|
const firstTabId = tabs[0]?.id ?? "";
|
|
8005
7804
|
const requestedTabIsValid = tabIds.includes(requestedTab);
|
|
8006
7805
|
const current = requestedTabIsValid ? requestedTab : firstTabId;
|
|
8007
|
-
const setTab =
|
|
7806
|
+
const setTab = useCallback23(
|
|
8008
7807
|
(id) => {
|
|
8009
7808
|
setInternalTab(id);
|
|
8010
7809
|
onActiveTabChange?.(id);
|
|
8011
7810
|
},
|
|
8012
7811
|
[onActiveTabChange]
|
|
8013
7812
|
);
|
|
8014
|
-
const setCollapsed =
|
|
7813
|
+
const setCollapsed = useCallback23(
|
|
8015
7814
|
(next) => {
|
|
8016
7815
|
setInternalCollapsed((previous) => previous === next ? previous : next);
|
|
8017
7816
|
onCollapsedChange?.(next);
|
|
@@ -8029,7 +7828,7 @@ function WorkspaceDock({
|
|
|
8029
7828
|
dockPanelRef.current?.resize(`${lastExpandedSizeRef.current}%`);
|
|
8030
7829
|
}
|
|
8031
7830
|
}, [collapsedProp, dockPanelRef]);
|
|
8032
|
-
|
|
7831
|
+
useEffect20(() => {
|
|
8033
7832
|
const previous = previousCollapsedRef.current;
|
|
8034
7833
|
previousCollapsedRef.current = collapsed;
|
|
8035
7834
|
if (previous === collapsed) return;
|
|
@@ -8065,7 +7864,7 @@ function WorkspaceDock({
|
|
|
8065
7864
|
});
|
|
8066
7865
|
return () => cancelAnimationFrame(frame);
|
|
8067
7866
|
}, [collapsed, hostControlled, narrow]);
|
|
8068
|
-
|
|
7867
|
+
useEffect20(() => {
|
|
8069
7868
|
if (!narrow || collapsed || initialNarrowFocusRef.current) return;
|
|
8070
7869
|
initialNarrowFocusRef.current = true;
|
|
8071
7870
|
const active = document.activeElement;
|
|
@@ -8078,20 +7877,20 @@ function WorkspaceDock({
|
|
|
8078
7877
|
});
|
|
8079
7878
|
return () => cancelAnimationFrame(frame);
|
|
8080
7879
|
}, [collapsed, narrow]);
|
|
8081
|
-
|
|
7880
|
+
useEffect20(() => {
|
|
8082
7881
|
if (firstTabId && !requestedTabIsValid) {
|
|
8083
7882
|
setTab(firstTabId);
|
|
8084
7883
|
}
|
|
8085
7884
|
}, [firstTabId, requestedTabIsValid, setTab]);
|
|
8086
|
-
const collapse =
|
|
7885
|
+
const collapse = useCallback23(() => {
|
|
8087
7886
|
dockPanelRef.current?.collapse();
|
|
8088
7887
|
setCollapsed(true);
|
|
8089
7888
|
}, [dockPanelRef, setCollapsed]);
|
|
8090
|
-
const expand =
|
|
7889
|
+
const expand = useCallback23(() => {
|
|
8091
7890
|
dockPanelRef.current?.expand();
|
|
8092
7891
|
setCollapsed(false);
|
|
8093
7892
|
}, [dockPanelRef, setCollapsed]);
|
|
8094
|
-
|
|
7893
|
+
useEffect20(() => {
|
|
8095
7894
|
const overlayOpen = maximized || narrow && !collapsed;
|
|
8096
7895
|
if (!overlayOpen) return;
|
|
8097
7896
|
const onKey = (event) => {
|
|
@@ -8135,8 +7934,8 @@ function WorkspaceDock({
|
|
|
8135
7934
|
return () => window.removeEventListener("keydown", onKey);
|
|
8136
7935
|
}, [maximized, narrow, collapsed, collapse]);
|
|
8137
7936
|
if (narrow) {
|
|
8138
|
-
return /* @__PURE__ */
|
|
8139
|
-
/* @__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(
|
|
8140
7939
|
"div",
|
|
8141
7940
|
{
|
|
8142
7941
|
"data-workspace-primary": true,
|
|
@@ -8146,7 +7945,7 @@ function WorkspaceDock({
|
|
|
8146
7945
|
children: primary
|
|
8147
7946
|
}
|
|
8148
7947
|
),
|
|
8149
|
-
/* @__PURE__ */
|
|
7948
|
+
/* @__PURE__ */ jsx10(
|
|
8150
7949
|
"div",
|
|
8151
7950
|
{
|
|
8152
7951
|
"data-workspace-surface": true,
|
|
@@ -8164,7 +7963,7 @@ function WorkspaceDock({
|
|
|
8164
7963
|
paddingTop: "env(safe-area-inset-top)",
|
|
8165
7964
|
paddingBottom: "env(safe-area-inset-bottom)"
|
|
8166
7965
|
},
|
|
8167
|
-
children: /* @__PURE__ */
|
|
7966
|
+
children: /* @__PURE__ */ jsx10(
|
|
8168
7967
|
DockChrome,
|
|
8169
7968
|
{
|
|
8170
7969
|
tabs,
|
|
@@ -8172,12 +7971,12 @@ function WorkspaceDock({
|
|
|
8172
7971
|
onTab: setTab,
|
|
8173
7972
|
leading: mobileLeadingControl,
|
|
8174
7973
|
accessory: headerAccessory,
|
|
8175
|
-
controls: /* @__PURE__ */
|
|
7974
|
+
controls: /* @__PURE__ */ jsx10(ChromeButton, { onClick: collapse, title: "Hide workspace", label: "Hide workspace", children: /* @__PURE__ */ jsx10(XIcon2, { className: "size-4" }) })
|
|
8176
7975
|
}
|
|
8177
7976
|
)
|
|
8178
7977
|
}
|
|
8179
7978
|
),
|
|
8180
|
-
collapsed && !hostControlled ? /* @__PURE__ */
|
|
7979
|
+
collapsed && !hostControlled ? /* @__PURE__ */ jsx10(
|
|
8181
7980
|
"button",
|
|
8182
7981
|
{
|
|
8183
7982
|
ref: reopenRef,
|
|
@@ -8187,34 +7986,34 @@ function WorkspaceDock({
|
|
|
8187
7986
|
"aria-label": "Open workspace",
|
|
8188
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",
|
|
8189
7988
|
style: { marginTop: "env(safe-area-inset-top)" },
|
|
8190
|
-
children: /* @__PURE__ */
|
|
7989
|
+
children: /* @__PURE__ */ jsx10(ChevronsLeftRightIcon, { className: "size-4", "aria-hidden": true })
|
|
8191
7990
|
}
|
|
8192
7991
|
) : null
|
|
8193
7992
|
] });
|
|
8194
7993
|
}
|
|
8195
|
-
const dockChrome = /* @__PURE__ */
|
|
7994
|
+
const dockChrome = /* @__PURE__ */ jsx10(
|
|
8196
7995
|
DockChrome,
|
|
8197
7996
|
{
|
|
8198
7997
|
tabs,
|
|
8199
7998
|
current,
|
|
8200
7999
|
onTab: setTab,
|
|
8201
8000
|
accessory: headerAccessory,
|
|
8202
|
-
controls: /* @__PURE__ */
|
|
8203
|
-
/* @__PURE__ */
|
|
8001
|
+
controls: /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
8002
|
+
/* @__PURE__ */ jsx10(
|
|
8204
8003
|
ChromeButton,
|
|
8205
8004
|
{
|
|
8206
8005
|
onClick: () => setMaximized((m) => !m),
|
|
8207
8006
|
title: maximized ? "Restore (Esc)" : "Maximize",
|
|
8208
8007
|
label: maximized ? "Restore dock" : "Maximize dock",
|
|
8209
|
-
children: maximized ? /* @__PURE__ */
|
|
8008
|
+
children: maximized ? /* @__PURE__ */ jsx10(Minimize2Icon, { className: "size-3.5" }) : /* @__PURE__ */ jsx10(Maximize2Icon, { className: "size-3.5" })
|
|
8210
8009
|
}
|
|
8211
8010
|
),
|
|
8212
|
-
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" }) })
|
|
8213
8012
|
] })
|
|
8214
8013
|
}
|
|
8215
8014
|
);
|
|
8216
|
-
return /* @__PURE__ */
|
|
8217
|
-
/* @__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(
|
|
8218
8017
|
Group2,
|
|
8219
8018
|
{
|
|
8220
8019
|
orientation: "horizontal",
|
|
@@ -8222,7 +8021,7 @@ function WorkspaceDock({
|
|
|
8222
8021
|
...expandedDefaultLayout ? { defaultLayout: expandedDefaultLayout } : {},
|
|
8223
8022
|
onLayoutChanged: persistExpandedLayout,
|
|
8224
8023
|
children: [
|
|
8225
|
-
/* @__PURE__ */
|
|
8024
|
+
/* @__PURE__ */ jsx10(Panel2, { id: "primary", minSize: "30%", className: "min-h-0 min-w-0", children: /* @__PURE__ */ jsx10(
|
|
8226
8025
|
"div",
|
|
8227
8026
|
{
|
|
8228
8027
|
"data-workspace-primary": true,
|
|
@@ -8232,8 +8031,8 @@ function WorkspaceDock({
|
|
|
8232
8031
|
children: primary
|
|
8233
8032
|
}
|
|
8234
8033
|
) }),
|
|
8235
|
-
!collapsed && /* @__PURE__ */
|
|
8236
|
-
/* @__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(
|
|
8237
8036
|
Panel2,
|
|
8238
8037
|
{
|
|
8239
8038
|
id: "dock",
|
|
@@ -8251,7 +8050,7 @@ function WorkspaceDock({
|
|
|
8251
8050
|
}
|
|
8252
8051
|
},
|
|
8253
8052
|
className: "min-h-0 min-w-0",
|
|
8254
|
-
children: /* @__PURE__ */
|
|
8053
|
+
children: /* @__PURE__ */ jsx10(
|
|
8255
8054
|
"div",
|
|
8256
8055
|
{
|
|
8257
8056
|
"data-workspace-surface": true,
|
|
@@ -8272,7 +8071,7 @@ function WorkspaceDock({
|
|
|
8272
8071
|
]
|
|
8273
8072
|
}
|
|
8274
8073
|
),
|
|
8275
|
-
collapsed && !maximized && !hostControlled && /* @__PURE__ */
|
|
8074
|
+
collapsed && !maximized && !hostControlled && /* @__PURE__ */ jsx10(
|
|
8276
8075
|
"button",
|
|
8277
8076
|
{
|
|
8278
8077
|
ref: reopenRef,
|
|
@@ -8280,7 +8079,7 @@ function WorkspaceDock({
|
|
|
8280
8079
|
onClick: expand,
|
|
8281
8080
|
title: "Open workspace",
|
|
8282
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",
|
|
8283
|
-
children: /* @__PURE__ */
|
|
8082
|
+
children: /* @__PURE__ */ jsx10(ChevronsLeftRightIcon, { className: "size-3.5" })
|
|
8284
8083
|
}
|
|
8285
8084
|
)
|
|
8286
8085
|
] });
|
|
@@ -8291,7 +8090,7 @@ function ChromeButton({
|
|
|
8291
8090
|
label,
|
|
8292
8091
|
children
|
|
8293
8092
|
}) {
|
|
8294
|
-
return /* @__PURE__ */
|
|
8093
|
+
return /* @__PURE__ */ jsx10(
|
|
8295
8094
|
"button",
|
|
8296
8095
|
{
|
|
8297
8096
|
type: "button",
|
|
@@ -8311,11 +8110,11 @@ function DockChrome({
|
|
|
8311
8110
|
accessory,
|
|
8312
8111
|
controls
|
|
8313
8112
|
}) {
|
|
8314
|
-
const chromeRef =
|
|
8113
|
+
const chromeRef = useRef17(null);
|
|
8315
8114
|
const [compact, setCompact] = useState16(false);
|
|
8316
8115
|
const active = tabs.find((t) => t.id === current) ?? tabs[0];
|
|
8317
8116
|
const tabsetId = useId4();
|
|
8318
|
-
const tabRefs =
|
|
8117
|
+
const tabRefs = useRef17([]);
|
|
8319
8118
|
const [visitedTabs, setVisitedTabs] = useState16(() => /* @__PURE__ */ new Set());
|
|
8320
8119
|
const activeId = active?.id ?? "";
|
|
8321
8120
|
useDockLayoutEffect(() => {
|
|
@@ -8335,7 +8134,7 @@ function DockChrome({
|
|
|
8335
8134
|
observer.observe(node);
|
|
8336
8135
|
return () => observer.disconnect();
|
|
8337
8136
|
}, []);
|
|
8338
|
-
|
|
8137
|
+
useEffect20(() => {
|
|
8339
8138
|
if (!activeId) return;
|
|
8340
8139
|
setVisitedTabs((previous) => {
|
|
8341
8140
|
if (previous.has(activeId)) return previous;
|
|
@@ -8363,7 +8162,7 @@ function DockChrome({
|
|
|
8363
8162
|
event.preventDefault();
|
|
8364
8163
|
activateTab(nextIndex);
|
|
8365
8164
|
};
|
|
8366
|
-
return /* @__PURE__ */
|
|
8165
|
+
return /* @__PURE__ */ jsxs8(
|
|
8367
8166
|
"div",
|
|
8368
8167
|
{
|
|
8369
8168
|
ref: chromeRef,
|
|
@@ -8371,13 +8170,13 @@ function DockChrome({
|
|
|
8371
8170
|
"data-compact": compact ? "true" : void 0,
|
|
8372
8171
|
className: "flex h-full min-h-0 min-w-0 flex-col",
|
|
8373
8172
|
children: [
|
|
8374
|
-
/* @__PURE__ */
|
|
8375
|
-
/* @__PURE__ */
|
|
8376
|
-
/* @__PURE__ */
|
|
8377
|
-
/* @__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 })
|
|
8378
8177
|
] }),
|
|
8379
|
-
/* @__PURE__ */
|
|
8380
|
-
/* @__PURE__ */
|
|
8178
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex min-h-0 min-w-0 flex-1", children: [
|
|
8179
|
+
/* @__PURE__ */ jsx10(
|
|
8381
8180
|
"div",
|
|
8382
8181
|
{
|
|
8383
8182
|
className: cn(
|
|
@@ -8389,7 +8188,7 @@ function DockChrome({
|
|
|
8389
8188
|
"aria-orientation": "vertical",
|
|
8390
8189
|
children: tabs.map((tab, index) => {
|
|
8391
8190
|
const tabName = tab.ariaLabel ?? (typeof tab.label === "string" ? tab.label : tab.id);
|
|
8392
|
-
return /* @__PURE__ */
|
|
8191
|
+
return /* @__PURE__ */ jsxs8(
|
|
8393
8192
|
"button",
|
|
8394
8193
|
{
|
|
8395
8194
|
ref: (node) => {
|
|
@@ -8411,7 +8210,7 @@ function DockChrome({
|
|
|
8411
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"
|
|
8412
8211
|
),
|
|
8413
8212
|
children: [
|
|
8414
|
-
tab.icon ? /* @__PURE__ */
|
|
8213
|
+
tab.icon ? /* @__PURE__ */ jsx10(
|
|
8415
8214
|
"span",
|
|
8416
8215
|
{
|
|
8417
8216
|
className: "flex size-4 shrink-0 items-center justify-center [&>svg]:size-4",
|
|
@@ -8419,8 +8218,8 @@ function DockChrome({
|
|
|
8419
8218
|
children: tab.icon
|
|
8420
8219
|
}
|
|
8421
8220
|
) : null,
|
|
8422
|
-
!compact || !tab.icon ? /* @__PURE__ */
|
|
8423
|
-
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(
|
|
8424
8223
|
"span",
|
|
8425
8224
|
{
|
|
8426
8225
|
className: cn("shrink-0", compact && "absolute -right-0.5 -top-0.5 scale-90"),
|
|
@@ -8434,10 +8233,10 @@ function DockChrome({
|
|
|
8434
8233
|
})
|
|
8435
8234
|
}
|
|
8436
8235
|
),
|
|
8437
|
-
/* @__PURE__ */
|
|
8236
|
+
/* @__PURE__ */ jsx10("div", { className: "min-h-0 min-w-0 flex-1 overflow-hidden", children: tabs.length > 0 ? tabs.map((tab, index) => {
|
|
8438
8237
|
const selected = tab.id === activeId;
|
|
8439
8238
|
const shouldMount = selected || visitedTabs.has(tab.id);
|
|
8440
|
-
return /* @__PURE__ */
|
|
8239
|
+
return /* @__PURE__ */ jsx10(
|
|
8441
8240
|
"div",
|
|
8442
8241
|
{
|
|
8443
8242
|
id: `${tabsetId}-panel-${index}`,
|
|
@@ -8449,7 +8248,7 @@ function DockChrome({
|
|
|
8449
8248
|
},
|
|
8450
8249
|
tab.id
|
|
8451
8250
|
);
|
|
8452
|
-
}) : /* @__PURE__ */
|
|
8251
|
+
}) : /* @__PURE__ */ jsx10("div", { className: "h-full min-h-0 min-w-0", "aria-label": "Workspace", role: "tabpanel" }) })
|
|
8453
8252
|
] })
|
|
8454
8253
|
]
|
|
8455
8254
|
}
|
|
@@ -8460,10 +8259,10 @@ function DockChrome({
|
|
|
8460
8259
|
import {
|
|
8461
8260
|
lazy as lazy2,
|
|
8462
8261
|
Suspense as Suspense2,
|
|
8463
|
-
useCallback as
|
|
8464
|
-
useEffect as
|
|
8262
|
+
useCallback as useCallback24,
|
|
8263
|
+
useEffect as useEffect21,
|
|
8465
8264
|
useMemo as useMemo15,
|
|
8466
|
-
useRef as
|
|
8265
|
+
useRef as useRef18,
|
|
8467
8266
|
useState as useState17
|
|
8468
8267
|
} from "react";
|
|
8469
8268
|
import {
|
|
@@ -8478,9 +8277,9 @@ import {
|
|
|
8478
8277
|
SquareTerminalIcon,
|
|
8479
8278
|
TriangleAlertIcon as TriangleAlertIcon2
|
|
8480
8279
|
} from "lucide-react";
|
|
8481
|
-
import { jsx as
|
|
8280
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
8482
8281
|
var LazyBrowserViewer = lazy2(async () => {
|
|
8483
|
-
const { BrowserViewer } = await import("./browser-viewer-
|
|
8282
|
+
const { BrowserViewer } = await import("./browser-viewer-NTD6UIPR.js");
|
|
8484
8283
|
return { default: BrowserViewer };
|
|
8485
8284
|
});
|
|
8486
8285
|
var LazyComputerViewer = lazy2(async () => {
|
|
@@ -8526,11 +8325,11 @@ function captureDegradedMessage(reason) {
|
|
|
8526
8325
|
}
|
|
8527
8326
|
}
|
|
8528
8327
|
function WorkbenchSurfaceLoading({ name }) {
|
|
8529
|
-
return /* @__PURE__ */
|
|
8328
|
+
return /* @__PURE__ */ jsx11(
|
|
8530
8329
|
CenteredState,
|
|
8531
8330
|
{
|
|
8532
|
-
icon: /* @__PURE__ */
|
|
8533
|
-
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: [
|
|
8534
8333
|
"Opening ",
|
|
8535
8334
|
name
|
|
8536
8335
|
] })
|
|
@@ -8641,7 +8440,7 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8641
8440
|
const terminalEnabled = surfaceSet.has(WORKBENCH_TAB_TERMINAL);
|
|
8642
8441
|
const browserEnabled = surfaceSet.has(WORKBENCH_TAB_BROWSER);
|
|
8643
8442
|
const desktopEnabled = surfaceSet.has(WORKBENCH_TAB_DESKTOP);
|
|
8644
|
-
const createLinkedComputer =
|
|
8443
|
+
const createLinkedComputer = useCallback24(
|
|
8645
8444
|
async (name, placement) => {
|
|
8646
8445
|
const response = await client.createComputerSession(workspaceId, {
|
|
8647
8446
|
operationId: crypto.randomUUID(),
|
|
@@ -8672,7 +8471,7 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8672
8471
|
const warmIntents = storedWarmIntents.sessionId === sessionId ? storedWarmIntents : emptyWarmIntents(sessionId);
|
|
8673
8472
|
const { warmTerminal, warmFiles } = warmIntents;
|
|
8674
8473
|
const filesWarmRequested = warmFiles || Boolean(requestedFilePath);
|
|
8675
|
-
const requestWarmIntent =
|
|
8474
|
+
const requestWarmIntent = useCallback24(
|
|
8676
8475
|
(intent) => {
|
|
8677
8476
|
setStoredWarmIntents((previous) => {
|
|
8678
8477
|
const current = previous.sessionId === sessionId ? previous : emptyWarmIntents(sessionId);
|
|
@@ -8714,15 +8513,15 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8714
8513
|
});
|
|
8715
8514
|
const provisioning = sandboxProvisionInFlight(events);
|
|
8716
8515
|
const renegotiate = caps.renegotiate;
|
|
8717
|
-
const provisioningRef =
|
|
8718
|
-
|
|
8516
|
+
const provisioningRef = useRef18({ sessionId, provisioning });
|
|
8517
|
+
useEffect21(() => {
|
|
8719
8518
|
const previous = provisioningRef.current;
|
|
8720
8519
|
if (previous.sessionId === sessionId && previous.provisioning && !provisioning) {
|
|
8721
8520
|
renegotiate();
|
|
8722
8521
|
}
|
|
8723
8522
|
provisioningRef.current = { sessionId, provisioning };
|
|
8724
8523
|
}, [sessionId, provisioning, renegotiate]);
|
|
8725
|
-
|
|
8524
|
+
useEffect21(() => {
|
|
8726
8525
|
if (workspaceInteractionEvent?.workspaceId !== workspaceId) return;
|
|
8727
8526
|
renegotiate();
|
|
8728
8527
|
}, [workspaceId, workspaceInteractionEvent, renegotiate]);
|
|
@@ -8738,14 +8537,14 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8738
8537
|
if (advertised.length > 0) return advertised;
|
|
8739
8538
|
return captureState.capture?.repos.map((repo) => repo.root) ?? [];
|
|
8740
8539
|
}, [capabilities?.Git.repos, captureState.capture]);
|
|
8741
|
-
const notifiedCaptureDegradedReason =
|
|
8540
|
+
const notifiedCaptureDegradedReason = useRef18({
|
|
8742
8541
|
sessionId,
|
|
8743
8542
|
reason: null
|
|
8744
8543
|
});
|
|
8745
8544
|
if (notifiedCaptureDegradedReason.current.sessionId !== sessionId) {
|
|
8746
8545
|
notifiedCaptureDegradedReason.current = { sessionId, reason: null };
|
|
8747
8546
|
}
|
|
8748
|
-
|
|
8547
|
+
useEffect21(() => {
|
|
8749
8548
|
const reason = captureState.degradedReason;
|
|
8750
8549
|
if (!reason || notifiedCaptureDegradedReason.current.reason === reason) return;
|
|
8751
8550
|
notifiedCaptureDegradedReason.current = { sessionId, reason };
|
|
@@ -8778,7 +8577,7 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8778
8577
|
const [storedChangesComparison, setStoredChangesComparison] = useState17(null);
|
|
8779
8578
|
const captureSupportsBranch = captureState.capture !== null && captureState.capture.repos.length > 0 && captureState.capture.repos.every((repo) => repo.branchDiff !== void 0);
|
|
8780
8579
|
const changesComparison = storedChangesComparison?.sessionId === sessionId ? storedChangesComparison.value : liveWorkspaceExpected || captureSupportsBranch ? "branch" : "working";
|
|
8781
|
-
const setChangesComparison =
|
|
8580
|
+
const setChangesComparison = useCallback24(
|
|
8782
8581
|
(value) => setStoredChangesComparison({ sessionId, value }),
|
|
8783
8582
|
[sessionId]
|
|
8784
8583
|
);
|
|
@@ -8795,13 +8594,13 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8795
8594
|
comparison: changesComparison,
|
|
8796
8595
|
capture: changesComparison === "staged" ? null : captureState.capture
|
|
8797
8596
|
});
|
|
8798
|
-
|
|
8597
|
+
useEffect21(() => {
|
|
8799
8598
|
if (changesComparison === "branch" && git.error && storedChangesComparison?.sessionId !== sessionId) {
|
|
8800
8599
|
setStoredChangesComparison({ sessionId, value: "working" });
|
|
8801
8600
|
}
|
|
8802
8601
|
}, [changesComparison, git.error, sessionId, storedChangesComparison?.sessionId]);
|
|
8803
8602
|
const [xtermTheme, setXtermTheme] = useState17(void 0);
|
|
8804
|
-
|
|
8603
|
+
useEffect21(() => {
|
|
8805
8604
|
if (!terminalEnabled || typeof document === "undefined") return;
|
|
8806
8605
|
const derive = () => setXtermTheme(xtermThemeFromTokens());
|
|
8807
8606
|
derive();
|
|
@@ -8823,7 +8622,7 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8823
8622
|
});
|
|
8824
8623
|
const workspaceWaking = chip.state === "waking";
|
|
8825
8624
|
const defaultIdentity = `${sessionId}\0${surfaceIdentity}`;
|
|
8826
|
-
const defaultTabRef =
|
|
8625
|
+
const defaultTabRef = useRef18({
|
|
8827
8626
|
identity: defaultIdentity,
|
|
8828
8627
|
value: null
|
|
8829
8628
|
});
|
|
@@ -8854,9 +8653,9 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8854
8653
|
list.push({
|
|
8855
8654
|
id: WORKBENCH_TAB_CHANGES,
|
|
8856
8655
|
label: "Changes",
|
|
8857
|
-
icon: /* @__PURE__ */
|
|
8858
|
-
badge: dirtyCount > 0 ? /* @__PURE__ */
|
|
8859
|
-
content: /* @__PURE__ */
|
|
8656
|
+
icon: /* @__PURE__ */ jsx11(GitCompareArrowsIcon, {}),
|
|
8657
|
+
badge: dirtyCount > 0 ? /* @__PURE__ */ jsx11(DirtyBadge, { count: dirtyCount }) : void 0,
|
|
8658
|
+
content: /* @__PURE__ */ jsx11(
|
|
8860
8659
|
ChangesTabBody,
|
|
8861
8660
|
{
|
|
8862
8661
|
git,
|
|
@@ -8884,8 +8683,8 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8884
8683
|
list.push({
|
|
8885
8684
|
id: WORKBENCH_TAB_FILES,
|
|
8886
8685
|
label: "Files",
|
|
8887
|
-
icon: /* @__PURE__ */
|
|
8888
|
-
content: /* @__PURE__ */
|
|
8686
|
+
icon: /* @__PURE__ */ jsx11(FileCode2Icon2, {}),
|
|
8687
|
+
content: /* @__PURE__ */ jsx11(
|
|
8889
8688
|
SandboxFiles,
|
|
8890
8689
|
{
|
|
8891
8690
|
files,
|
|
@@ -8915,8 +8714,8 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8915
8714
|
list.push({
|
|
8916
8715
|
id: WORKBENCH_TAB_TERMINAL,
|
|
8917
8716
|
label: "Terminal",
|
|
8918
|
-
icon: /* @__PURE__ */
|
|
8919
|
-
content: /* @__PURE__ */
|
|
8717
|
+
icon: /* @__PURE__ */ jsx11(SquareTerminalIcon, {}),
|
|
8718
|
+
content: /* @__PURE__ */ jsx11("div", { className: "h-full bg-og-bg p-1", children: /* @__PURE__ */ jsx11(
|
|
8920
8719
|
SandboxTerminal,
|
|
8921
8720
|
{
|
|
8922
8721
|
result: terminal,
|
|
@@ -8936,8 +8735,8 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8936
8735
|
list.push({
|
|
8937
8736
|
id: WORKBENCH_TAB_BROWSER,
|
|
8938
8737
|
label: "Browser",
|
|
8939
|
-
icon: /* @__PURE__ */
|
|
8940
|
-
content: /* @__PURE__ */
|
|
8738
|
+
icon: /* @__PURE__ */ jsx11(Globe2Icon, {}),
|
|
8739
|
+
content: /* @__PURE__ */ jsx11(Suspense2, { fallback: /* @__PURE__ */ jsx11(WorkbenchSurfaceLoading, { name: "Browser" }), children: /* @__PURE__ */ jsx11(
|
|
8941
8740
|
LazyBrowserViewer,
|
|
8942
8741
|
{
|
|
8943
8742
|
client,
|
|
@@ -8961,8 +8760,8 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8961
8760
|
list.push({
|
|
8962
8761
|
id: WORKBENCH_TAB_DESKTOP,
|
|
8963
8762
|
label: "Desktop",
|
|
8964
|
-
icon: /* @__PURE__ */
|
|
8965
|
-
content: /* @__PURE__ */
|
|
8763
|
+
icon: /* @__PURE__ */ jsx11(MonitorIcon, {}),
|
|
8764
|
+
content: /* @__PURE__ */ jsx11(Suspense2, { fallback: /* @__PURE__ */ jsx11(WorkbenchSurfaceLoading, { name: "Desktop" }), children: /* @__PURE__ */ jsx11(
|
|
8966
8765
|
LazyComputerViewer,
|
|
8967
8766
|
{
|
|
8968
8767
|
client,
|
|
@@ -9076,11 +8875,11 @@ function SandboxWorkspace(props) {
|
|
|
9076
8875
|
const [storedSelection, setStoredSelection] = useState17(null);
|
|
9077
8876
|
const [requestedFile, setRequestedFile] = useState17(null);
|
|
9078
8877
|
const [requestedComputer, setRequestedComputer] = useState17(null);
|
|
9079
|
-
const nextFileRequestId =
|
|
9080
|
-
const nextComputerRequestId =
|
|
8878
|
+
const nextFileRequestId = useRef18(0);
|
|
8879
|
+
const nextComputerRequestId = useRef18(0);
|
|
9081
8880
|
const selectedTab = storedSelection?.sessionId === sessionId ? storedSelection.tab : null;
|
|
9082
8881
|
const activeTabHint = selectedTab ?? initialTab ?? leadingTabs?.[0]?.id ?? null;
|
|
9083
|
-
const openFile =
|
|
8882
|
+
const openFile = useCallback24(
|
|
9084
8883
|
(path, line) => {
|
|
9085
8884
|
setRequestedFile({
|
|
9086
8885
|
sessionId,
|
|
@@ -9095,14 +8894,14 @@ function SandboxWorkspace(props) {
|
|
|
9095
8894
|
},
|
|
9096
8895
|
[onActiveTabChange, onCollapsedChange, onFilePathChange, sessionId]
|
|
9097
8896
|
);
|
|
9098
|
-
const handledOpenFileRequestId =
|
|
9099
|
-
|
|
8897
|
+
const handledOpenFileRequestId = useRef18(null);
|
|
8898
|
+
useEffect21(() => {
|
|
9100
8899
|
if (!openFileRequest) return;
|
|
9101
8900
|
if (handledOpenFileRequestId.current === openFileRequest.requestId) return;
|
|
9102
8901
|
handledOpenFileRequestId.current = openFileRequest.requestId;
|
|
9103
8902
|
openFile(openFileRequest.path, openFileRequest.line);
|
|
9104
8903
|
}, [openFile, openFileRequest]);
|
|
9105
|
-
const openComputer =
|
|
8904
|
+
const openComputer = useCallback24(
|
|
9106
8905
|
(computerSessionId) => {
|
|
9107
8906
|
nextComputerRequestId.current += 1;
|
|
9108
8907
|
setRequestedComputer({
|
|
@@ -9151,18 +8950,18 @@ function SandboxWorkspace(props) {
|
|
|
9151
8950
|
const tabs = [...leadingTabs ?? [], ...workbenchTabs, ...trailingTabs ?? []];
|
|
9152
8951
|
const preferredTab = selectedTab ?? defaultTab;
|
|
9153
8952
|
const activeTab = preferredTab && tabs.some((tab) => tab.id === preferredTab) ? preferredTab : tabs[0]?.id;
|
|
9154
|
-
const selectTab =
|
|
8953
|
+
const selectTab = useCallback24(
|
|
9155
8954
|
(tab) => {
|
|
9156
8955
|
setStoredSelection({ sessionId, tab });
|
|
9157
8956
|
onActiveTabChange?.(tab);
|
|
9158
8957
|
},
|
|
9159
8958
|
[onActiveTabChange, sessionId]
|
|
9160
8959
|
);
|
|
9161
|
-
|
|
8960
|
+
useEffect21(() => {
|
|
9162
8961
|
if (selectedTab !== null || defaultTab === null) return;
|
|
9163
8962
|
setStoredSelection({ sessionId, tab: defaultTab });
|
|
9164
8963
|
}, [defaultTab, selectedTab, sessionId]);
|
|
9165
|
-
return /* @__PURE__ */
|
|
8964
|
+
return /* @__PURE__ */ jsx11(
|
|
9166
8965
|
WorkspaceDock,
|
|
9167
8966
|
{
|
|
9168
8967
|
primary,
|
|
@@ -9170,7 +8969,7 @@ function SandboxWorkspace(props) {
|
|
|
9170
8969
|
...activeTab !== void 0 ? { activeTab } : {},
|
|
9171
8970
|
onActiveTabChange: selectTab,
|
|
9172
8971
|
...machine.enabled ? {
|
|
9173
|
-
headerAccessory: /* @__PURE__ */
|
|
8972
|
+
headerAccessory: /* @__PURE__ */ jsx11(MachineStateChip, { chip: machine.chip })
|
|
9174
8973
|
} : {},
|
|
9175
8974
|
...mobileLeadingControl !== void 0 ? { mobileLeadingControl } : {},
|
|
9176
8975
|
...collapsed !== void 0 ? { collapsed } : {},
|
|
@@ -9185,7 +8984,7 @@ function SandboxWorkspace(props) {
|
|
|
9185
8984
|
);
|
|
9186
8985
|
}
|
|
9187
8986
|
function DirtyBadge({ count }) {
|
|
9188
|
-
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 });
|
|
9189
8988
|
}
|
|
9190
8989
|
function chipDotClass(state) {
|
|
9191
8990
|
if (state === "live") return "bg-og-status-running";
|
|
@@ -9193,27 +8992,27 @@ function chipDotClass(state) {
|
|
|
9193
8992
|
return "bg-og-fg-subtle";
|
|
9194
8993
|
}
|
|
9195
8994
|
function MachineStateChip({ chip }) {
|
|
9196
|
-
return /* @__PURE__ */
|
|
8995
|
+
return /* @__PURE__ */ jsxs9(
|
|
9197
8996
|
"div",
|
|
9198
8997
|
{
|
|
9199
8998
|
role: "status",
|
|
9200
8999
|
"aria-label": `Machine: ${chip.label}`,
|
|
9201
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",
|
|
9202
9001
|
children: [
|
|
9203
|
-
/* @__PURE__ */
|
|
9002
|
+
/* @__PURE__ */ jsx11(
|
|
9204
9003
|
"span",
|
|
9205
9004
|
{
|
|
9206
9005
|
className: cn("size-1.5 shrink-0 rounded-full", chipDotClass(chip.state)),
|
|
9207
9006
|
"aria-hidden": true
|
|
9208
9007
|
}
|
|
9209
9008
|
),
|
|
9210
|
-
/* @__PURE__ */
|
|
9009
|
+
/* @__PURE__ */ jsx11("span", { className: "min-w-0 max-w-[11rem] truncate", children: chip.label })
|
|
9211
9010
|
]
|
|
9212
9011
|
}
|
|
9213
9012
|
);
|
|
9214
9013
|
}
|
|
9215
9014
|
function DockActionButton({ onClick, children }) {
|
|
9216
|
-
return /* @__PURE__ */
|
|
9015
|
+
return /* @__PURE__ */ jsx11(
|
|
9217
9016
|
"button",
|
|
9218
9017
|
{
|
|
9219
9018
|
type: "button",
|
|
@@ -9228,12 +9027,12 @@ function ChangesTabBody({
|
|
|
9228
9027
|
onComparisonChange,
|
|
9229
9028
|
...props
|
|
9230
9029
|
}) {
|
|
9231
|
-
return /* @__PURE__ */
|
|
9232
|
-
/* @__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: [
|
|
9233
9032
|
["branch", "Branch"],
|
|
9234
9033
|
["working", "Uncommitted"],
|
|
9235
9034
|
["staged", "Staged"]
|
|
9236
|
-
].map(([value, label]) => /* @__PURE__ */
|
|
9035
|
+
].map(([value, label]) => /* @__PURE__ */ jsx11(
|
|
9237
9036
|
"button",
|
|
9238
9037
|
{
|
|
9239
9038
|
type: "button",
|
|
@@ -9247,7 +9046,7 @@ function ChangesTabBody({
|
|
|
9247
9046
|
},
|
|
9248
9047
|
value
|
|
9249
9048
|
)) }),
|
|
9250
|
-
/* @__PURE__ */
|
|
9049
|
+
/* @__PURE__ */ jsx11("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsx11(ChangesTabContent, { comparison, ...props }) })
|
|
9251
9050
|
] });
|
|
9252
9051
|
}
|
|
9253
9052
|
function ChangesTabContent({
|
|
@@ -9266,8 +9065,8 @@ function ChangesTabContent({
|
|
|
9266
9065
|
}) {
|
|
9267
9066
|
const diff = git.diff;
|
|
9268
9067
|
if (diff.length > 0) {
|
|
9269
|
-
return /* @__PURE__ */
|
|
9270
|
-
git.error ? /* @__PURE__ */
|
|
9068
|
+
return /* @__PURE__ */ jsxs9("div", { className: "flex h-full min-h-0 flex-col", children: [
|
|
9069
|
+
git.error ? /* @__PURE__ */ jsxs9(
|
|
9271
9070
|
"div",
|
|
9272
9071
|
{
|
|
9273
9072
|
role: "status",
|
|
@@ -9275,9 +9074,9 @@ function ChangesTabContent({
|
|
|
9275
9074
|
"data-opengeni-changes-degraded": true,
|
|
9276
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",
|
|
9277
9076
|
children: [
|
|
9278
|
-
/* @__PURE__ */
|
|
9279
|
-
/* @__PURE__ */
|
|
9280
|
-
/* @__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(
|
|
9281
9080
|
"button",
|
|
9282
9081
|
{
|
|
9283
9082
|
type: "button",
|
|
@@ -9285,7 +9084,7 @@ function ChangesTabContent({
|
|
|
9285
9084
|
disabled: git.loading,
|
|
9286
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",
|
|
9287
9086
|
children: [
|
|
9288
|
-
/* @__PURE__ */
|
|
9087
|
+
/* @__PURE__ */ jsx11(
|
|
9289
9088
|
RefreshCwIcon2,
|
|
9290
9089
|
{
|
|
9291
9090
|
className: cn("size-3", git.loading && "animate-spin motion-reduce:animate-none"),
|
|
@@ -9299,7 +9098,7 @@ function ChangesTabContent({
|
|
|
9299
9098
|
]
|
|
9300
9099
|
}
|
|
9301
9100
|
) : null,
|
|
9302
|
-
/* @__PURE__ */
|
|
9101
|
+
/* @__PURE__ */ jsx11("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsx11(
|
|
9303
9102
|
WorkbenchChanges,
|
|
9304
9103
|
{
|
|
9305
9104
|
diff,
|
|
@@ -9312,20 +9111,20 @@ function ChangesTabContent({
|
|
|
9312
9111
|
] });
|
|
9313
9112
|
}
|
|
9314
9113
|
if (capabilitiesError && !captureAvailable) {
|
|
9315
|
-
return /* @__PURE__ */
|
|
9316
|
-
/* @__PURE__ */
|
|
9317
|
-
/* @__PURE__ */
|
|
9318
|
-
/* @__PURE__ */
|
|
9319
|
-
/* @__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" }),
|
|
9320
9119
|
"Retry"
|
|
9321
9120
|
] })
|
|
9322
9121
|
] });
|
|
9323
9122
|
}
|
|
9324
9123
|
if ((capturePending || capabilitiesState === "negotiating") && !captureAvailable && !workspaceWaking) {
|
|
9325
|
-
return /* @__PURE__ */
|
|
9124
|
+
return /* @__PURE__ */ jsxs9(
|
|
9326
9125
|
CenteredState,
|
|
9327
9126
|
{
|
|
9328
|
-
icon: /* @__PURE__ */
|
|
9127
|
+
icon: /* @__PURE__ */ jsx11(
|
|
9329
9128
|
LoaderCircleIcon2,
|
|
9330
9129
|
{
|
|
9331
9130
|
className: "size-5 animate-spin motion-reduce:animate-none",
|
|
@@ -9333,28 +9132,28 @@ function ChangesTabContent({
|
|
|
9333
9132
|
}
|
|
9334
9133
|
),
|
|
9335
9134
|
children: [
|
|
9336
|
-
/* @__PURE__ */
|
|
9337
|
-
/* @__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" })
|
|
9338
9137
|
]
|
|
9339
9138
|
}
|
|
9340
9139
|
);
|
|
9341
9140
|
}
|
|
9342
9141
|
if (!liveWorkspaceExpected && (comparison !== "working" || !captureAvailable)) {
|
|
9343
|
-
return /* @__PURE__ */
|
|
9142
|
+
return /* @__PURE__ */ jsxs9(
|
|
9344
9143
|
CenteredState,
|
|
9345
9144
|
{
|
|
9346
|
-
icon: workspaceWaking ? /* @__PURE__ */
|
|
9145
|
+
icon: workspaceWaking ? /* @__PURE__ */ jsx11(
|
|
9347
9146
|
LoaderCircleIcon2,
|
|
9348
9147
|
{
|
|
9349
9148
|
className: "size-5 animate-spin motion-reduce:animate-none",
|
|
9350
9149
|
"aria-hidden": true
|
|
9351
9150
|
}
|
|
9352
|
-
) : /* @__PURE__ */
|
|
9151
|
+
) : /* @__PURE__ */ jsx11(CpuIcon, { className: "size-5", "aria-hidden": true }),
|
|
9353
9152
|
children: [
|
|
9354
|
-
/* @__PURE__ */
|
|
9355
|
-
/* @__PURE__ */
|
|
9356
|
-
!workspaceWaking ? /* @__PURE__ */
|
|
9357
|
-
/* @__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" }),
|
|
9358
9157
|
"Open live workspace"
|
|
9359
9158
|
] }) : null
|
|
9360
9159
|
]
|
|
@@ -9362,10 +9161,10 @@ function ChangesTabContent({
|
|
|
9362
9161
|
);
|
|
9363
9162
|
}
|
|
9364
9163
|
if (git.loading && git.source === null) {
|
|
9365
|
-
return /* @__PURE__ */
|
|
9164
|
+
return /* @__PURE__ */ jsxs9(
|
|
9366
9165
|
CenteredState,
|
|
9367
9166
|
{
|
|
9368
|
-
icon: /* @__PURE__ */
|
|
9167
|
+
icon: /* @__PURE__ */ jsx11(
|
|
9369
9168
|
LoaderCircleIcon2,
|
|
9370
9169
|
{
|
|
9371
9170
|
className: "size-5 animate-spin motion-reduce:animate-none",
|
|
@@ -9373,15 +9172,15 @@ function ChangesTabContent({
|
|
|
9373
9172
|
}
|
|
9374
9173
|
),
|
|
9375
9174
|
children: [
|
|
9376
|
-
/* @__PURE__ */
|
|
9377
|
-
/* @__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" })
|
|
9378
9177
|
]
|
|
9379
9178
|
}
|
|
9380
9179
|
);
|
|
9381
9180
|
}
|
|
9382
|
-
return /* @__PURE__ */
|
|
9383
|
-
/* @__PURE__ */
|
|
9384
|
-
/* @__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." })
|
|
9385
9184
|
] });
|
|
9386
9185
|
}
|
|
9387
9186
|
function CenteredState({
|
|
@@ -9389,15 +9188,15 @@ function CenteredState({
|
|
|
9389
9188
|
icon,
|
|
9390
9189
|
tone = "neutral"
|
|
9391
9190
|
}) {
|
|
9392
|
-
return /* @__PURE__ */
|
|
9191
|
+
return /* @__PURE__ */ jsx11(
|
|
9393
9192
|
"div",
|
|
9394
9193
|
{
|
|
9395
9194
|
role: tone === "danger" ? "alert" : "status",
|
|
9396
9195
|
"aria-atomic": "true",
|
|
9397
9196
|
"aria-live": tone === "danger" ? "assertive" : "polite",
|
|
9398
9197
|
className: "grid h-full place-items-center p-6 text-center",
|
|
9399
|
-
children: /* @__PURE__ */
|
|
9400
|
-
icon ? /* @__PURE__ */
|
|
9198
|
+
children: /* @__PURE__ */ jsxs9("div", { className: "flex max-w-sm flex-col items-center gap-2.5", children: [
|
|
9199
|
+
icon ? /* @__PURE__ */ jsx11(
|
|
9401
9200
|
"span",
|
|
9402
9201
|
{
|
|
9403
9202
|
className: cn(
|
|
@@ -9416,7 +9215,7 @@ function CenteredState({
|
|
|
9416
9215
|
}
|
|
9417
9216
|
|
|
9418
9217
|
// src/hooks/use-codex-accounts.ts
|
|
9419
|
-
import { useCallback as
|
|
9218
|
+
import { useCallback as useCallback25, useState as useState18 } from "react";
|
|
9420
9219
|
function isCodexAccountEvent(event) {
|
|
9421
9220
|
return event.type === "codex.account.switched";
|
|
9422
9221
|
}
|
|
@@ -9437,7 +9236,7 @@ function useCodexAccounts(options = {}) {
|
|
|
9437
9236
|
const codexClient = options.codexClient ?? client;
|
|
9438
9237
|
const sessionId = options.sessionId;
|
|
9439
9238
|
const sharedEvents = options.events;
|
|
9440
|
-
const load =
|
|
9239
|
+
const load = useCallback25(async () => {
|
|
9441
9240
|
const accountsP = codexClient.listCodexAccounts(workspaceId);
|
|
9442
9241
|
const sessionP = sessionId && codexClient.getSession ? codexClient.getSession(workspaceId, sessionId).catch(() => null) : Promise.resolve(null);
|
|
9443
9242
|
const [acc, session] = await Promise.all([accountsP, sessionP]);
|
|
@@ -9471,7 +9270,7 @@ function useCodexAccounts(options = {}) {
|
|
|
9471
9270
|
...sharedEvents !== void 0 ? { events: sharedEvents } : {}
|
|
9472
9271
|
}
|
|
9473
9272
|
);
|
|
9474
|
-
const pin =
|
|
9273
|
+
const pin = useCallback25(
|
|
9475
9274
|
async (target) => {
|
|
9476
9275
|
if (!sessionId || !codexClient.pinSessionCodexAccount) {
|
|
9477
9276
|
return false;
|
|
@@ -9487,7 +9286,7 @@ function useCodexAccounts(options = {}) {
|
|
|
9487
9286
|
},
|
|
9488
9287
|
[codexClient, workspaceId, sessionId, runMutation, refresh]
|
|
9489
9288
|
);
|
|
9490
|
-
const refreshUsage =
|
|
9289
|
+
const refreshUsage = useCallback25(async () => {
|
|
9491
9290
|
if (!codexClient.refreshCodexUsage) {
|
|
9492
9291
|
return false;
|
|
9493
9292
|
}
|
|
@@ -9519,7 +9318,7 @@ function useCodexAccounts(options = {}) {
|
|
|
9519
9318
|
}
|
|
9520
9319
|
|
|
9521
9320
|
// src/hooks/use-supergrok-accounts.ts
|
|
9522
|
-
import { useCallback as
|
|
9321
|
+
import { useCallback as useCallback26 } from "react";
|
|
9523
9322
|
var EMPTY = {
|
|
9524
9323
|
accounts: [],
|
|
9525
9324
|
activeAccountId: null,
|
|
@@ -9532,7 +9331,7 @@ var EMPTY = {
|
|
|
9532
9331
|
function useSuperGrokAccounts(options = {}) {
|
|
9533
9332
|
const { client, workspaceId } = useOpenGeni(options);
|
|
9534
9333
|
const supergrokClient = options.supergrokClient ?? client;
|
|
9535
|
-
const load =
|
|
9334
|
+
const load = useCallback26(
|
|
9536
9335
|
async () => await supergrokClient.listSuperGrokAccounts(workspaceId),
|
|
9537
9336
|
[supergrokClient, workspaceId]
|
|
9538
9337
|
);
|
|
@@ -9541,7 +9340,7 @@ function useSuperGrokAccounts(options = {}) {
|
|
|
9541
9340
|
pollIntervalMs: options.pollIntervalMs
|
|
9542
9341
|
});
|
|
9543
9342
|
const { run, mutating: activating, mutationError } = useMutationRunner();
|
|
9544
|
-
const activate =
|
|
9343
|
+
const activate = useCallback26(
|
|
9545
9344
|
async (accountId) => {
|
|
9546
9345
|
if (!supergrokClient.activateSuperGrokAccount) return false;
|
|
9547
9346
|
const result = await run(async () => {
|
|
@@ -9643,6 +9442,8 @@ export {
|
|
|
9643
9442
|
SandboxWorkspace,
|
|
9644
9443
|
ScreenshotFigure,
|
|
9645
9444
|
SessionChrome,
|
|
9445
|
+
SessionCommandsPanel,
|
|
9446
|
+
SessionConversation,
|
|
9646
9447
|
SessionStatus,
|
|
9647
9448
|
SharedMachineDisclosure,
|
|
9648
9449
|
StatusDot,
|
|
@@ -9750,6 +9551,7 @@ export {
|
|
|
9750
9551
|
planVoiceRecordingChunkCommit,
|
|
9751
9552
|
pointsFor,
|
|
9752
9553
|
prepareVoiceRecordingChunk,
|
|
9554
|
+
presentFailure,
|
|
9753
9555
|
projectClientModelRows,
|
|
9754
9556
|
projectPendingApprovals,
|
|
9755
9557
|
projectPendingHumanInputRequests,
|