@opengeni/react 0.28.2 → 0.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/approvals.d.ts +14 -0
- package/dist/{chunk-M7X4JZOD.js → chunk-4QOQ2DSR.js} +8 -1
- package/dist/chunk-4QOQ2DSR.js.map +1 -0
- package/dist/{chunk-HQFPO7VX.js → chunk-7CJOAW3V.js} +24 -3
- package/dist/{chunk-HQFPO7VX.js.map → chunk-7CJOAW3V.js.map} +1 -1
- package/dist/{chunk-PMSGE233.js → chunk-A2WITZTI.js} +377 -113
- package/dist/chunk-A2WITZTI.js.map +1 -0
- package/dist/{chunk-BC6RKIHS.js → chunk-GZ4KR67U.js} +11 -11
- package/dist/{chunk-4F2YLLHP.js → chunk-KZRUYCL4.js} +14 -17
- package/dist/chunk-KZRUYCL4.js.map +1 -0
- package/dist/{chunk-OCHBZ2X7.js → chunk-TCCE5ZU5.js} +192 -28
- package/dist/chunk-TCCE5ZU5.js.map +1 -0
- package/dist/chunk-U255M5EZ.js +178 -0
- package/dist/chunk-U255M5EZ.js.map +1 -0
- package/dist/{chunk-XVVQP7A4.js → chunk-WY2QN2CX.js} +2539 -2174
- package/dist/chunk-WY2QN2CX.js.map +1 -0
- package/dist/chunk-ZNNE2VES.js +6413 -0
- package/dist/chunk-ZNNE2VES.js.map +1 -0
- package/dist/client.d.ts +33 -0
- package/dist/commands/index.d.ts +3 -0
- package/dist/commands/registry.d.ts +41 -0
- package/dist/commands/types.d.ts +85 -0
- package/dist/components/approval-surface.d.ts +28 -0
- package/dist/components/chat-composer.d.ts +51 -0
- package/dist/components/code-editor.d.ts +43 -0
- package/dist/components/command-palette.d.ts +25 -0
- package/dist/components/composer-transcription-control.d.ts +36 -0
- package/dist/components/composer.d.ts +277 -0
- package/dist/components/copy-button.d.ts +26 -0
- package/dist/components/desktop-viewer.d.ts +85 -0
- package/dist/components/diff-view.d.ts +38 -0
- package/dist/components/enrollment-consent.d.ts +33 -0
- package/dist/components/enrollment-device-flow.d.ts +27 -0
- package/dist/components/file-browser.d.ts +47 -0
- package/dist/components/fleet-tile.d.ts +18 -0
- package/dist/components/human-input-form.d.ts +47 -0
- package/dist/components/machine-card.d.ts +21 -0
- package/dist/components/machine-dock-bar.d.ts +31 -0
- package/dist/components/machine-health-pill.d.ts +9 -0
- package/dist/components/machine-metrics.d.ts +15 -0
- package/dist/components/machine-status-pill.d.ts +54 -0
- package/dist/components/machines/health.d.ts +25 -0
- package/dist/components/machines/machine-detail.d.ts +14 -0
- package/dist/components/machines/metric-history-chart.d.ts +24 -0
- package/dist/components/machines/metric-sparkline.d.ts +9 -0
- package/dist/components/machines/series.d.ts +24 -0
- package/dist/components/machines-dashboard.d.ts +30 -0
- package/dist/components/markdown.d.ts +31 -0
- package/dist/components/message-timeline.d.ts +98 -0
- package/dist/components/model-picker.d.ts +19 -0
- package/dist/components/pierre-diff.d.ts +34 -0
- package/dist/components/pierre-file.d.ts +27 -0
- package/dist/components/queue-draft-policy.d.ts +7 -0
- package/dist/components/queue-surface-implementation.d.ts +20 -0
- package/dist/components/queue-surface-state.d.ts +12 -0
- package/dist/components/queue-surface.d.ts +12 -0
- package/dist/components/sandbox-files.d.ts +49 -0
- package/dist/components/sandbox-terminal.d.ts +123 -0
- package/dist/components/sandbox-workspace.d.ts +128 -0
- package/dist/components/session-chrome.d.ts +70 -0
- package/dist/components/session-status.d.ts +25 -0
- package/dist/components/soften-streaming-markdown.d.ts +13 -0
- package/dist/components/stream-reveal.d.ts +37 -0
- package/dist/components/tip-follow.d.ts +139 -0
- package/dist/components/tooltip.d.ts +16 -0
- package/dist/components/workbench-changes.d.ts +34 -0
- package/dist/components/workspace-dock.d.ts +35 -0
- package/dist/composer.d.ts +11 -7
- package/dist/composer.js +9 -6
- package/dist/hooks/internal.d.ts +46 -0
- package/dist/hooks/use-available-models.d.ts +37 -0
- package/dist/hooks/use-billing-usage.d.ts +26 -0
- package/dist/hooks/use-codex-accounts.d.ts +69 -0
- package/dist/{use-composer-ClHy1rkL.d.ts → hooks/use-composer.d.ts} +16 -24
- package/dist/hooks/use-desktop-stream.d.ts +43 -0
- package/dist/hooks/use-environments.d.ts +35 -0
- package/dist/{use-file-attachments-BmT8WtqO.d.ts → hooks/use-file-attachments.d.ts} +6 -9
- package/dist/hooks/use-goal.d.ts +46 -0
- package/dist/hooks/use-human-input.d.ts +26 -0
- package/dist/hooks/use-last-started-turn-policy.d.ts +27 -0
- package/dist/hooks/use-machine-chip.d.ts +54 -0
- package/dist/hooks/use-machines.d.ts +81 -0
- package/dist/hooks/use-packs.d.ts +27 -0
- package/dist/hooks/use-relay-frame-stream.d.ts +53 -0
- package/dist/hooks/use-rigs.d.ts +87 -0
- package/dist/hooks/use-sandbox-files.d.ts +108 -0
- package/dist/hooks/use-sandbox-git.d.ts +58 -0
- package/dist/hooks/use-sandbox-terminal.d.ts +62 -0
- package/dist/hooks/use-scheduled-tasks.d.ts +15 -0
- package/dist/hooks/use-session-capabilities.d.ts +83 -0
- package/dist/hooks/use-session-control.d.ts +22 -0
- package/dist/hooks/use-session-events.d.ts +92 -0
- package/dist/hooks/use-session-lineage.d.ts +17 -0
- package/dist/hooks/use-session-mcp-approval-policy.d.ts +23 -0
- package/dist/hooks/use-session.d.ts +23 -0
- package/dist/hooks/use-slash-commands.d.ts +66 -0
- package/dist/hooks/use-terminal-stream.d.ts +46 -0
- package/dist/hooks/use-transcription.d.ts +73 -0
- package/dist/hooks/use-turn-queue.d.ts +44 -0
- package/dist/hooks/use-voice-input.d.ts +25 -0
- package/dist/hooks/use-windowed-sections.d.ts +42 -0
- package/dist/hooks/use-workspace-capture.d.ts +49 -0
- package/dist/hooks/use-workspace-edit.d.ts +73 -0
- package/dist/hooks/use-workspace-sessions.d.ts +30 -0
- package/dist/hooks/use-workspaces.d.ts +22 -0
- package/dist/human-input.d.ts +18 -0
- package/dist/index.d.ts +144 -2119
- package/dist/index.js +421 -324
- package/dist/index.js.map +1 -1
- package/dist/lib/clipboard.d.ts +7 -0
- package/dist/lib/cn.d.ts +3 -0
- package/dist/lib/format.d.ts +48 -0
- package/dist/lib/git-patch.d.ts +8 -0
- package/dist/lib/motion-inspect.d.ts +5 -0
- package/dist/lib/motion.d.ts +14 -0
- package/dist/lib/noto-sans-arabic-loader.d.ts +1 -0
- package/dist/lib/noto-sans-jp-loader.generated.d.ts +1 -0
- package/dist/lib/relay-wire.d.ts +30 -0
- package/dist/lib/use-portal-token-style.d.ts +9 -0
- package/dist/lib/use-theme-type.d.ts +5 -0
- package/dist/lib/use-unicode-fonts.d.ts +12 -0
- package/dist/lib/xterm-renderer.d.ts +19 -0
- package/dist/lib/xterm-theme.d.ts +75 -0
- package/dist/machines.d.ts +30 -413
- package/dist/machines.js +3 -3
- package/dist/model-policy.d.ts +32 -0
- package/dist/model-policy.js +33 -0
- package/dist/model-policy.js.map +1 -0
- package/dist/provider.d.ts +16 -0
- package/dist/{queue-surface-implementation-UQ535OKQ.js → queue-surface-implementation-THPAKGMD.js} +2 -2
- package/dist/{queue-surface-implementation-UQ535OKQ.js.map → queue-surface-implementation-THPAKGMD.js.map} +1 -1
- package/dist/session-context.d.ts +82 -0
- package/dist/session-ui.d.ts +10 -7
- package/dist/session-ui.js +9 -5
- package/dist/session.d.ts +28 -6
- package/dist/session.js +11 -11
- package/dist/timeline/activity-rail.d.ts +19 -0
- package/dist/timeline/disclosure-context.d.ts +14 -0
- package/dist/timeline/entrance.d.ts +14 -0
- package/dist/timeline/fleet-decision-projection.d.ts +9 -0
- package/dist/timeline/fleet-decision-row.d.ts +11 -0
- package/dist/timeline/fold-memory.d.ts +15 -0
- package/dist/timeline/index.d.ts +18 -0
- package/dist/timeline/parsers.d.ts +96 -0
- package/dist/timeline/projection.d.ts +38 -0
- package/dist/timeline/registry.d.ts +40 -0
- package/dist/timeline/screenshot-lightbox.d.ts +26 -0
- package/dist/timeline/seen-activity-ids.d.ts +2 -0
- package/dist/timeline/shared.d.ts +125 -0
- package/dist/timeline/tool-diff.d.ts +8 -0
- package/dist/timeline/tool-display-name.d.ts +10 -0
- package/dist/timeline/tool-renderers.d.ts +5 -0
- package/dist/timeline/turn-summary.d.ts +116 -0
- package/dist/{use-turn-queue-Drm_ypue.d.ts → timeline/types.d.ts} +57 -67
- package/dist/types/machines.d.ts +11 -0
- package/package.json +8 -4
- package/src/client.ts +1 -0
- package/src/components/composer-transcription-control.tsx +278 -130
- package/src/components/composer.tsx +20 -15
- package/src/components/copy-button.tsx +127 -0
- package/src/components/markdown.tsx +231 -32
- package/src/components/message-timeline.tsx +1382 -378
- package/src/components/model-picker.tsx +83 -43
- package/src/components/queue-surface-implementation.tsx +1 -1
- package/src/components/session-chrome.tsx +942 -0
- package/src/components/soften-streaming-markdown.ts +205 -0
- package/src/components/stream-reveal.ts +195 -0
- package/src/components/tip-follow.ts +459 -0
- package/src/components/tooltip.tsx +103 -0
- package/src/composer.ts +6 -0
- package/src/hooks/internal.ts +30 -4
- package/src/hooks/use-available-models.ts +51 -4
- package/src/hooks/use-composer.ts +24 -18
- package/src/hooks/use-last-started-turn-policy.ts +95 -0
- package/src/hooks/use-session-events.ts +359 -5
- package/src/hooks/use-voice-input.ts +232 -0
- package/src/index.ts +49 -1
- package/src/lib/clipboard.ts +58 -0
- package/src/lib/format.ts +18 -0
- package/src/lib/motion-inspect.ts +5 -0
- package/src/lib/motion.ts +80 -0
- package/src/model-policy.ts +210 -0
- package/src/session-ui.ts +7 -0
- package/src/session.ts +2 -0
- package/src/timeline/activity-rail.tsx +46 -7
- package/src/timeline/entrance.tsx +10 -0
- package/src/timeline/fold-memory.ts +52 -0
- package/src/timeline/index.ts +11 -1
- package/src/timeline/projection.ts +252 -47
- package/src/timeline/seen-activity-ids.ts +19 -0
- package/src/timeline/shared.tsx +1 -1
- package/src/timeline/tool-renderers.tsx +75 -6
- package/src/timeline/turn-summary.tsx +387 -97
- package/src/timeline/types.ts +47 -0
- package/styles/index.css +99 -7
- package/styles/tokens.css +44 -3
- package/dist/chunk-4F2YLLHP.js.map +0 -1
- package/dist/chunk-M7X4JZOD.js.map +0 -1
- package/dist/chunk-OCHBZ2X7.js.map +0 -1
- package/dist/chunk-PMSGE233.js.map +0 -1
- package/dist/chunk-WAA247AB.js +0 -3858
- package/dist/chunk-WAA247AB.js.map +0 -1
- package/dist/chunk-XVVQP7A4.js.map +0 -1
- package/dist/composer-BMzimGTO.d.ts +0 -528
- package/dist/session-C3tIXLim.d.ts +0 -264
- package/dist/session-context-CAjlaeZb.d.ts +0 -84
- package/dist/session-ui-B_7cfN5u.d.ts +0 -259
- /package/dist/{chunk-BC6RKIHS.js.map → chunk-GZ4KR67U.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,42 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Actions,
|
|
3
|
-
AttachButton,
|
|
4
|
-
Attachments,
|
|
5
|
-
CommandPalette,
|
|
6
|
-
CommandPalette2,
|
|
7
|
-
ComposerTranscriptionControl,
|
|
8
|
-
Confirmation,
|
|
9
|
-
Controls,
|
|
10
|
-
Footer,
|
|
11
|
-
Frame,
|
|
12
|
-
Help,
|
|
13
|
-
Hint,
|
|
14
|
-
INITIAL_TRANSCRIPTION_CONTROL_STATE,
|
|
15
|
-
Input,
|
|
16
|
-
ModelPicker,
|
|
17
|
-
ModelPicker2,
|
|
18
|
-
OPEN_WORKSTREAM_CONTROL_EVENT,
|
|
19
|
-
PauseButton,
|
|
20
|
-
PausedState,
|
|
21
|
-
RestoredResources,
|
|
22
|
-
Root,
|
|
23
|
-
SendButton,
|
|
24
|
-
Status,
|
|
25
|
-
Surface,
|
|
26
|
-
appendFinalTranscript,
|
|
27
|
-
argHint,
|
|
28
|
-
defaultChatComposerMessages,
|
|
29
|
-
defaultCommands,
|
|
30
|
-
filterCommands,
|
|
31
|
-
firstMissingRequiredArg,
|
|
32
|
-
hasPermission,
|
|
33
|
-
matchCommand,
|
|
34
|
-
parseCommandLine,
|
|
35
|
-
transitionTranscriptionControl,
|
|
36
|
-
useChatComposerController,
|
|
37
|
-
useSlashCommands,
|
|
38
|
-
useTranscription
|
|
39
|
-
} from "./chunk-XVVQP7A4.js";
|
|
40
1
|
import {
|
|
41
2
|
CONNECTION_STATUS_META,
|
|
42
3
|
ConnectionDot,
|
|
@@ -64,12 +25,41 @@ import {
|
|
|
64
25
|
healthPulses,
|
|
65
26
|
pointsFor,
|
|
66
27
|
useMachines
|
|
67
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-GZ4KR67U.js";
|
|
29
|
+
import {
|
|
30
|
+
SESSION_EVENT_BROWSER_MAX_BYTES,
|
|
31
|
+
SESSION_EVENT_BROWSER_MAX_COUNT,
|
|
32
|
+
SESSION_EVENT_BROWSER_PENDING_MAX_BYTES,
|
|
33
|
+
SESSION_EVENT_BROWSER_PENDING_MAX_COUNT,
|
|
34
|
+
SESSION_EVENT_BROWSER_SINGLE_EVENT_MAX_BYTES,
|
|
35
|
+
approvalsFromRequiresAction,
|
|
36
|
+
boundBrowserSessionEventWindow,
|
|
37
|
+
humanInputRequestFromEvent,
|
|
38
|
+
isGoalEvent,
|
|
39
|
+
isHumanInputEvent,
|
|
40
|
+
isLineageRefreshEvent,
|
|
41
|
+
isSessionMcpApprovalPolicyEvent,
|
|
42
|
+
isTitleEvent,
|
|
43
|
+
isTurnQueueEvent,
|
|
44
|
+
projectPendingApprovals,
|
|
45
|
+
projectPendingHumanInputRequests,
|
|
46
|
+
useFileAttachments,
|
|
47
|
+
useGoal,
|
|
48
|
+
useHumanInputRequests,
|
|
49
|
+
useSession,
|
|
50
|
+
useSessionControl,
|
|
51
|
+
useSessionEvents,
|
|
52
|
+
useSessionLineage,
|
|
53
|
+
useSessionMcpApprovalPolicy,
|
|
54
|
+
useTurnQueue
|
|
55
|
+
} from "./chunk-A2WITZTI.js";
|
|
68
56
|
import {
|
|
69
57
|
ActivityDisclosure,
|
|
70
58
|
ActivityRail,
|
|
71
59
|
BUILT_IN_TURN_SUMMARY_FACET_IDS,
|
|
72
60
|
BodyNote,
|
|
61
|
+
CopyButton,
|
|
62
|
+
CopyHoverFrame,
|
|
73
63
|
DisclosureDefaultsProvider,
|
|
74
64
|
HumanInputForm,
|
|
75
65
|
LightboxProvider,
|
|
@@ -82,15 +72,21 @@ import {
|
|
|
82
72
|
QueueSurface,
|
|
83
73
|
SESSION_STATUS_META,
|
|
84
74
|
ScreenshotFigure,
|
|
75
|
+
SessionChrome,
|
|
85
76
|
SessionStatus,
|
|
86
77
|
StatusDot,
|
|
87
78
|
TermBlock,
|
|
88
79
|
Thumbnail,
|
|
89
80
|
TimelineRow,
|
|
81
|
+
Tooltip,
|
|
82
|
+
TooltipContent,
|
|
83
|
+
TooltipProvider,
|
|
84
|
+
TooltipTrigger,
|
|
90
85
|
TurnSummary,
|
|
91
86
|
answersFromDrafts,
|
|
92
87
|
applyPatchOps,
|
|
93
88
|
controlCaret,
|
|
89
|
+
copyTextToClipboard,
|
|
94
90
|
createDefaultToolRegistry,
|
|
95
91
|
createToolRegistry,
|
|
96
92
|
defaultHumanInputFormMessages,
|
|
@@ -105,68 +101,102 @@ import {
|
|
|
105
101
|
rawTypeOf,
|
|
106
102
|
redactSecrets,
|
|
107
103
|
sandboxCommandExitCode,
|
|
104
|
+
sessionChromeGoalPillState,
|
|
108
105
|
stripExecBanner,
|
|
106
|
+
tableElementToTsv,
|
|
109
107
|
tailPeek,
|
|
110
108
|
unwrapMcpOutput,
|
|
111
109
|
useLightbox,
|
|
112
110
|
useLightboxOptional,
|
|
111
|
+
usePortalTokenStyle,
|
|
113
112
|
useThemeType,
|
|
114
113
|
v4aToGitFileDiff
|
|
115
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-ZNNE2VES.js";
|
|
116
115
|
import {
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
buildTimeline,
|
|
117
|
+
creditExhaustedFromEvents,
|
|
118
|
+
extractSessionRef,
|
|
119
|
+
groupTimeline,
|
|
120
|
+
sessionStatusFromEvents,
|
|
121
|
+
toolDisplayName
|
|
122
|
+
} from "./chunk-TCCE5ZU5.js";
|
|
119
123
|
import {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
124
|
+
Actions,
|
|
125
|
+
AttachButton,
|
|
126
|
+
Attachments,
|
|
127
|
+
CommandPalette,
|
|
128
|
+
CommandPalette2,
|
|
129
|
+
ComposerTranscriptionControl,
|
|
130
|
+
Confirmation,
|
|
131
|
+
Controls,
|
|
132
|
+
Footer,
|
|
133
|
+
Frame,
|
|
134
|
+
Help,
|
|
135
|
+
Hint,
|
|
136
|
+
INITIAL_TRANSCRIPTION_CONTROL_STATE,
|
|
137
|
+
Input,
|
|
138
|
+
ModelPicker,
|
|
139
|
+
ModelPicker2,
|
|
140
|
+
OPEN_WORKSTREAM_CONTROL_EVENT,
|
|
141
|
+
PauseButton,
|
|
142
|
+
PausedState,
|
|
143
|
+
RestoredResources,
|
|
144
|
+
Root,
|
|
145
|
+
SendButton,
|
|
146
|
+
Status,
|
|
147
|
+
Surface,
|
|
148
|
+
appendFinalTranscript,
|
|
149
|
+
argHint,
|
|
150
|
+
defaultChatComposerMessages,
|
|
151
|
+
defaultCommands,
|
|
152
|
+
filterCommands,
|
|
153
|
+
firstMissingRequiredArg,
|
|
154
|
+
hasPermission,
|
|
155
|
+
matchCommand,
|
|
156
|
+
parseCommandLine,
|
|
157
|
+
transitionTranscriptionControl,
|
|
158
|
+
useChatComposerController,
|
|
159
|
+
useSlashCommands,
|
|
160
|
+
useTranscription,
|
|
161
|
+
useVoiceInput
|
|
162
|
+
} from "./chunk-WY2QN2CX.js";
|
|
146
163
|
import {
|
|
147
164
|
FILE_ONLY_MESSAGE_TEXT,
|
|
148
165
|
composeSendInput,
|
|
149
166
|
shouldSteerOnKey,
|
|
150
167
|
shouldSubmitOnKey,
|
|
151
168
|
useComposer
|
|
152
|
-
} from "./chunk-
|
|
169
|
+
} from "./chunk-KZRUYCL4.js";
|
|
153
170
|
import {
|
|
154
171
|
useMutationRunner,
|
|
155
172
|
useOpenGeni,
|
|
156
173
|
useOpenGeniClient,
|
|
157
174
|
usePolledValue,
|
|
158
175
|
useSessionEventTrigger
|
|
159
|
-
} from "./chunk-
|
|
176
|
+
} from "./chunk-7CJOAW3V.js";
|
|
160
177
|
import {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
178
|
+
advancedSourceSummary,
|
|
179
|
+
availabilityReasonLabel,
|
|
180
|
+
billingClassForModel,
|
|
181
|
+
billingClassLabel,
|
|
182
|
+
coerceReasoningEffortForModel,
|
|
183
|
+
defaultEffortForModel,
|
|
184
|
+
effortOptionsForModel,
|
|
185
|
+
findPickerRow,
|
|
186
|
+
groupPickerRowsByBillingClass,
|
|
187
|
+
labelLatencyMode,
|
|
188
|
+
payerSummaryForModel,
|
|
189
|
+
projectPickerRows,
|
|
190
|
+
runnableLatencyModesForModel,
|
|
191
|
+
sortPickerRows
|
|
192
|
+
} from "./chunk-U255M5EZ.js";
|
|
168
193
|
import {
|
|
194
|
+
cn
|
|
195
|
+
} from "./chunk-TK7G6XLT.js";
|
|
196
|
+
import {
|
|
197
|
+
COMPOSER_PAYMENT_REQUIRED_MESSAGE,
|
|
169
198
|
CREDIT_EXHAUSTION_MESSAGE,
|
|
199
|
+
composerSubmissionErrorMessage,
|
|
170
200
|
formatBytes,
|
|
171
201
|
formatRelativeTime,
|
|
172
202
|
humanizeFailureReason,
|
|
@@ -174,9 +204,61 @@ import {
|
|
|
174
204
|
stringifyPayload,
|
|
175
205
|
truncate,
|
|
176
206
|
tryParseJson
|
|
177
|
-
} from "./chunk-
|
|
207
|
+
} from "./chunk-4QOQ2DSR.js";
|
|
178
208
|
import "./chunk-YDNWMKXO.js";
|
|
179
209
|
|
|
210
|
+
// src/hooks/use-last-started-turn-policy.ts
|
|
211
|
+
import { useCallback, useEffect } from "react";
|
|
212
|
+
function isLastStartedTurnPolicyEvent(event) {
|
|
213
|
+
return event.type === "turn.started";
|
|
214
|
+
}
|
|
215
|
+
function policyFromTurn(turn) {
|
|
216
|
+
if (!turn) return null;
|
|
217
|
+
return {
|
|
218
|
+
model: turn.model,
|
|
219
|
+
reasoningEffort: turn.reasoningEffort,
|
|
220
|
+
latencyMode: turn.latencyMode ?? "standard",
|
|
221
|
+
turnId: turn.id
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
function useLastStartedTurnPolicy(sessionId, options = {}) {
|
|
225
|
+
const { client, workspaceId, workspaceControlEvent, registerSessionReconciler } = useOpenGeni(options);
|
|
226
|
+
const enabled = (options.enabled ?? true) && Boolean(sessionId);
|
|
227
|
+
const load = useCallback(async () => {
|
|
228
|
+
if (!sessionId) return null;
|
|
229
|
+
const turns = await client.listTurns(workspaceId, sessionId, { latestStarted: true });
|
|
230
|
+
return policyFromTurn(turns[0]);
|
|
231
|
+
}, [client, workspaceId, sessionId]);
|
|
232
|
+
const { data, loading, error, refresh } = usePolledValue(load, {
|
|
233
|
+
pollIntervalMs: options.pollIntervalMs,
|
|
234
|
+
enabled
|
|
235
|
+
});
|
|
236
|
+
useEffect(() => {
|
|
237
|
+
if (enabled && workspaceControlEvent) void refresh();
|
|
238
|
+
}, [enabled, refresh, workspaceControlEvent]);
|
|
239
|
+
useEffect(() => {
|
|
240
|
+
if (!sessionId || !enabled) return;
|
|
241
|
+
return registerSessionReconciler(sessionId, "last-started-turn-policy", refresh);
|
|
242
|
+
}, [enabled, refresh, registerSessionReconciler, sessionId]);
|
|
243
|
+
useSessionEventTrigger(
|
|
244
|
+
client,
|
|
245
|
+
workspaceId,
|
|
246
|
+
sessionId,
|
|
247
|
+
isLastStartedTurnPolicyEvent,
|
|
248
|
+
() => void refresh(),
|
|
249
|
+
{
|
|
250
|
+
events: options.events,
|
|
251
|
+
enabled: enabled && options.events !== void 0
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
return {
|
|
255
|
+
policy: enabled ? data : null,
|
|
256
|
+
loading,
|
|
257
|
+
error,
|
|
258
|
+
refresh
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
|
|
180
262
|
// src/components/chat-composer.tsx
|
|
181
263
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
182
264
|
function ChatComposer({
|
|
@@ -249,11 +331,11 @@ function ChatComposer({
|
|
|
249
331
|
}
|
|
250
332
|
|
|
251
333
|
// src/hooks/use-scheduled-tasks.ts
|
|
252
|
-
import { useCallback } from "react";
|
|
334
|
+
import { useCallback as useCallback2 } from "react";
|
|
253
335
|
function useScheduledTasks(options = {}) {
|
|
254
336
|
const { client, workspaceId } = useOpenGeni(options);
|
|
255
337
|
const limit = options.limit;
|
|
256
|
-
const load =
|
|
338
|
+
const load = useCallback2(
|
|
257
339
|
async () => await client.listScheduledTasks(workspaceId, limit !== void 0 ? { limit } : {}),
|
|
258
340
|
[client, workspaceId, limit]
|
|
259
341
|
);
|
|
@@ -270,7 +352,7 @@ function useScheduledTasks(options = {}) {
|
|
|
270
352
|
}
|
|
271
353
|
|
|
272
354
|
// src/hooks/use-workspace-sessions.ts
|
|
273
|
-
import { useCallback as
|
|
355
|
+
import { useCallback as useCallback3, useEffect as useEffect2, useRef } from "react";
|
|
274
356
|
function useWorkspaceSessions(options = {}) {
|
|
275
357
|
const { client, workspaceId } = useOpenGeni(options);
|
|
276
358
|
const limit = options.limit;
|
|
@@ -289,10 +371,10 @@ function useWorkspaceSessions(options = {}) {
|
|
|
289
371
|
].join("\0");
|
|
290
372
|
const previousQueryKey = useRef(queryKey);
|
|
291
373
|
const queryKeyTransition = previousQueryKey.current !== queryKey;
|
|
292
|
-
|
|
374
|
+
useEffect2(() => {
|
|
293
375
|
previousQueryKey.current = queryKey;
|
|
294
376
|
}, [queryKey]);
|
|
295
|
-
const load =
|
|
377
|
+
const load = useCallback3(
|
|
296
378
|
async () => ({
|
|
297
379
|
queryKey,
|
|
298
380
|
page: await client.listSessionPage(workspaceId, {
|
|
@@ -331,10 +413,10 @@ function useWorkspaceSessions(options = {}) {
|
|
|
331
413
|
}
|
|
332
414
|
|
|
333
415
|
// src/hooks/use-environments.ts
|
|
334
|
-
import { useCallback as
|
|
416
|
+
import { useCallback as useCallback4, useMemo } from "react";
|
|
335
417
|
function useVariableSets(options = {}) {
|
|
336
418
|
const { client, workspaceId } = useOpenGeni(options);
|
|
337
|
-
const load =
|
|
419
|
+
const load = useCallback4(
|
|
338
420
|
async () => await client.listVariableSets(workspaceId),
|
|
339
421
|
[client, workspaceId]
|
|
340
422
|
);
|
|
@@ -343,7 +425,7 @@ function useVariableSets(options = {}) {
|
|
|
343
425
|
enabled: options.enabled
|
|
344
426
|
});
|
|
345
427
|
const { run, mutating, mutationError, clearMutationError } = useMutationRunner();
|
|
346
|
-
const create =
|
|
428
|
+
const create = useCallback4(
|
|
347
429
|
async (request) => {
|
|
348
430
|
const result = await run(() => client.createVariableSet(workspaceId, request));
|
|
349
431
|
if (result) {
|
|
@@ -353,7 +435,7 @@ function useVariableSets(options = {}) {
|
|
|
353
435
|
},
|
|
354
436
|
[client, workspaceId, run, refresh]
|
|
355
437
|
);
|
|
356
|
-
const update =
|
|
438
|
+
const update = useCallback4(
|
|
357
439
|
async (variableSetId, request) => {
|
|
358
440
|
const result = await run(() => client.updateVariableSet(workspaceId, variableSetId, request));
|
|
359
441
|
if (result) {
|
|
@@ -363,7 +445,7 @@ function useVariableSets(options = {}) {
|
|
|
363
445
|
},
|
|
364
446
|
[client, workspaceId, run, refresh]
|
|
365
447
|
);
|
|
366
|
-
const remove =
|
|
448
|
+
const remove = useCallback4(
|
|
367
449
|
async (variableSetId) => {
|
|
368
450
|
const result = await run(async () => {
|
|
369
451
|
await client.deleteVariableSet(workspaceId, variableSetId);
|
|
@@ -376,7 +458,7 @@ function useVariableSets(options = {}) {
|
|
|
376
458
|
},
|
|
377
459
|
[client, workspaceId, run, refresh]
|
|
378
460
|
);
|
|
379
|
-
const setVariable =
|
|
461
|
+
const setVariable = useCallback4(
|
|
380
462
|
async (variableSetId, name, value) => {
|
|
381
463
|
const result = await run(
|
|
382
464
|
() => client.setVariableSetVariable(workspaceId, variableSetId, name, value)
|
|
@@ -388,7 +470,7 @@ function useVariableSets(options = {}) {
|
|
|
388
470
|
},
|
|
389
471
|
[client, workspaceId, run, refresh]
|
|
390
472
|
);
|
|
391
|
-
const deleteVariable =
|
|
473
|
+
const deleteVariable = useCallback4(
|
|
392
474
|
async (variableSetId, name) => {
|
|
393
475
|
const result = await run(async () => {
|
|
394
476
|
await client.deleteVariableSetVariable(workspaceId, variableSetId, name);
|
|
@@ -436,16 +518,16 @@ function useEnvironments(options = {}) {
|
|
|
436
518
|
}
|
|
437
519
|
|
|
438
520
|
// src/hooks/use-rigs.ts
|
|
439
|
-
import { useCallback as
|
|
521
|
+
import { useCallback as useCallback5 } from "react";
|
|
440
522
|
function useRigs(options = {}) {
|
|
441
523
|
const { client, workspaceId } = useOpenGeni(options);
|
|
442
|
-
const load =
|
|
524
|
+
const load = useCallback5(async () => await client.listRigs(workspaceId), [client, workspaceId]);
|
|
443
525
|
const { data, loading, error, refresh } = usePolledValue(load, {
|
|
444
526
|
pollIntervalMs: options.pollIntervalMs,
|
|
445
527
|
enabled: options.enabled
|
|
446
528
|
});
|
|
447
529
|
const { run, mutating, mutationError, clearMutationError } = useMutationRunner();
|
|
448
|
-
const create =
|
|
530
|
+
const create = useCallback5(
|
|
449
531
|
async (request) => {
|
|
450
532
|
const result = await run(() => client.createRig(workspaceId, request));
|
|
451
533
|
if (result) {
|
|
@@ -455,7 +537,7 @@ function useRigs(options = {}) {
|
|
|
455
537
|
},
|
|
456
538
|
[client, workspaceId, run, refresh]
|
|
457
539
|
);
|
|
458
|
-
const update =
|
|
540
|
+
const update = useCallback5(
|
|
459
541
|
async (rigId, request) => {
|
|
460
542
|
const result = await run(() => client.updateRig(workspaceId, rigId, request));
|
|
461
543
|
if (result) {
|
|
@@ -465,7 +547,7 @@ function useRigs(options = {}) {
|
|
|
465
547
|
},
|
|
466
548
|
[client, workspaceId, run, refresh]
|
|
467
549
|
);
|
|
468
|
-
const remove =
|
|
550
|
+
const remove = useCallback5(
|
|
469
551
|
async (rigId) => {
|
|
470
552
|
const result = await run(async () => {
|
|
471
553
|
await client.deleteRig(workspaceId, rigId);
|
|
@@ -478,13 +560,13 @@ function useRigs(options = {}) {
|
|
|
478
560
|
},
|
|
479
561
|
[client, workspaceId, run, refresh]
|
|
480
562
|
);
|
|
481
|
-
const listVersions =
|
|
563
|
+
const listVersions = useCallback5(
|
|
482
564
|
async (rigId) => {
|
|
483
565
|
return await run(() => client.listRigVersions(workspaceId, rigId));
|
|
484
566
|
},
|
|
485
567
|
[client, workspaceId, run]
|
|
486
568
|
);
|
|
487
|
-
const activateVersion =
|
|
569
|
+
const activateVersion = useCallback5(
|
|
488
570
|
async (rigId, versionId) => {
|
|
489
571
|
const result = await run(() => client.activateRigVersion(workspaceId, rigId, versionId));
|
|
490
572
|
if (result) {
|
|
@@ -494,13 +576,13 @@ function useRigs(options = {}) {
|
|
|
494
576
|
},
|
|
495
577
|
[client, workspaceId, run, refresh]
|
|
496
578
|
);
|
|
497
|
-
const listChanges =
|
|
579
|
+
const listChanges = useCallback5(
|
|
498
580
|
async (rigId) => {
|
|
499
581
|
return await run(() => client.listRigChanges(workspaceId, rigId));
|
|
500
582
|
},
|
|
501
583
|
[client, workspaceId, run]
|
|
502
584
|
);
|
|
503
|
-
const proposeChange =
|
|
585
|
+
const proposeChange = useCallback5(
|
|
504
586
|
async (rigId, request) => {
|
|
505
587
|
const result = await run(() => client.proposeRigChange(workspaceId, rigId, request));
|
|
506
588
|
if (result) {
|
|
@@ -529,7 +611,7 @@ function useRigs(options = {}) {
|
|
|
529
611
|
}
|
|
530
612
|
function useRig(rigId, options = {}) {
|
|
531
613
|
const { client, workspaceId } = useOpenGeni(options);
|
|
532
|
-
const load =
|
|
614
|
+
const load = useCallback5(
|
|
533
615
|
async () => await client.getRig(workspaceId, rigId),
|
|
534
616
|
[client, workspaceId, rigId]
|
|
535
617
|
);
|
|
@@ -538,7 +620,7 @@ function useRig(rigId, options = {}) {
|
|
|
538
620
|
enabled: options.enabled
|
|
539
621
|
});
|
|
540
622
|
const { run, mutating, mutationError, clearMutationError } = useMutationRunner();
|
|
541
|
-
const update =
|
|
623
|
+
const update = useCallback5(
|
|
542
624
|
async (request) => {
|
|
543
625
|
const result = await run(() => client.updateRig(workspaceId, rigId, request));
|
|
544
626
|
if (result) {
|
|
@@ -548,14 +630,14 @@ function useRig(rigId, options = {}) {
|
|
|
548
630
|
},
|
|
549
631
|
[client, workspaceId, rigId, run, refresh]
|
|
550
632
|
);
|
|
551
|
-
const remove =
|
|
633
|
+
const remove = useCallback5(async () => {
|
|
552
634
|
const result = await run(async () => {
|
|
553
635
|
await client.deleteRig(workspaceId, rigId);
|
|
554
636
|
return true;
|
|
555
637
|
});
|
|
556
638
|
return result === true;
|
|
557
639
|
}, [client, workspaceId, rigId, run]);
|
|
558
|
-
const activateVersion =
|
|
640
|
+
const activateVersion = useCallback5(
|
|
559
641
|
async (versionId) => {
|
|
560
642
|
const result = await run(() => client.activateRigVersion(workspaceId, rigId, versionId));
|
|
561
643
|
if (result) {
|
|
@@ -565,7 +647,7 @@ function useRig(rigId, options = {}) {
|
|
|
565
647
|
},
|
|
566
648
|
[client, workspaceId, rigId, run, refresh]
|
|
567
649
|
);
|
|
568
|
-
const proposeChange =
|
|
650
|
+
const proposeChange = useCallback5(
|
|
569
651
|
async (request) => {
|
|
570
652
|
const result = await run(() => client.proposeRigChange(workspaceId, rigId, request));
|
|
571
653
|
if (result) {
|
|
@@ -575,7 +657,7 @@ function useRig(rigId, options = {}) {
|
|
|
575
657
|
},
|
|
576
658
|
[client, workspaceId, rigId, run, refresh]
|
|
577
659
|
);
|
|
578
|
-
const verifyChange =
|
|
660
|
+
const verifyChange = useCallback5(
|
|
579
661
|
async (changeId) => {
|
|
580
662
|
const result = await run(() => client.verifyRigChange(workspaceId, rigId, changeId));
|
|
581
663
|
if (result) {
|
|
@@ -585,7 +667,7 @@ function useRig(rigId, options = {}) {
|
|
|
585
667
|
},
|
|
586
668
|
[client, workspaceId, rigId, run, refresh]
|
|
587
669
|
);
|
|
588
|
-
const promoteChange =
|
|
670
|
+
const promoteChange = useCallback5(
|
|
589
671
|
async (changeId) => {
|
|
590
672
|
const result = await run(() => client.promoteRigChange(workspaceId, rigId, changeId));
|
|
591
673
|
if (result) {
|
|
@@ -595,7 +677,7 @@ function useRig(rigId, options = {}) {
|
|
|
595
677
|
},
|
|
596
678
|
[client, workspaceId, rigId, run, refresh]
|
|
597
679
|
);
|
|
598
|
-
const verify =
|
|
680
|
+
const verify = useCallback5(async () => {
|
|
599
681
|
return await run(() => client.verifyRig(workspaceId, rigId));
|
|
600
682
|
}, [client, workspaceId, rigId, run]);
|
|
601
683
|
return {
|
|
@@ -617,7 +699,7 @@ function useRig(rigId, options = {}) {
|
|
|
617
699
|
}
|
|
618
700
|
function useRigVersions(rigId, options = {}) {
|
|
619
701
|
const { client, workspaceId } = useOpenGeni(options);
|
|
620
|
-
const load =
|
|
702
|
+
const load = useCallback5(
|
|
621
703
|
async () => await client.listRigVersions(workspaceId, rigId),
|
|
622
704
|
[client, workspaceId, rigId]
|
|
623
705
|
);
|
|
@@ -634,7 +716,7 @@ function useRigVersions(rigId, options = {}) {
|
|
|
634
716
|
}
|
|
635
717
|
function useRigChanges(rigId, options = {}) {
|
|
636
718
|
const { client, workspaceId } = useOpenGeni(options);
|
|
637
|
-
const load =
|
|
719
|
+
const load = useCallback5(
|
|
638
720
|
async () => await client.listRigChanges(workspaceId, rigId),
|
|
639
721
|
[client, workspaceId, rigId]
|
|
640
722
|
);
|
|
@@ -651,17 +733,17 @@ function useRigChanges(rigId, options = {}) {
|
|
|
651
733
|
}
|
|
652
734
|
|
|
653
735
|
// src/hooks/use-packs.ts
|
|
654
|
-
import { useCallback as
|
|
736
|
+
import { useCallback as useCallback6 } from "react";
|
|
655
737
|
var EMPTY_INSTALLATIONS = [];
|
|
656
738
|
function usePacks(options = {}) {
|
|
657
739
|
const { client, workspaceId } = useOpenGeni(options);
|
|
658
|
-
const load =
|
|
740
|
+
const load = useCallback6(async () => await client.listPacks(workspaceId), [client, workspaceId]);
|
|
659
741
|
const { data, loading, error, refresh } = usePolledValue(load, {
|
|
660
742
|
pollIntervalMs: options.pollIntervalMs,
|
|
661
743
|
enabled: options.enabled
|
|
662
744
|
});
|
|
663
745
|
const { run, mutating, mutationError, clearMutationError } = useMutationRunner();
|
|
664
|
-
const register =
|
|
746
|
+
const register = useCallback6(
|
|
665
747
|
async (manifest) => {
|
|
666
748
|
const result = await run(() => client.registerPack(workspaceId, manifest));
|
|
667
749
|
if (result) {
|
|
@@ -671,7 +753,7 @@ function usePacks(options = {}) {
|
|
|
671
753
|
},
|
|
672
754
|
[client, workspaceId, run, refresh]
|
|
673
755
|
);
|
|
674
|
-
const enable =
|
|
756
|
+
const enable = useCallback6(
|
|
675
757
|
async (packId, request = {}) => {
|
|
676
758
|
const result = await run(() => client.enablePack(workspaceId, packId, request));
|
|
677
759
|
if (result) {
|
|
@@ -681,7 +763,7 @@ function usePacks(options = {}) {
|
|
|
681
763
|
},
|
|
682
764
|
[client, workspaceId, run, refresh]
|
|
683
765
|
);
|
|
684
|
-
const remove =
|
|
766
|
+
const remove = useCallback6(
|
|
685
767
|
async (packId) => {
|
|
686
768
|
const result = await run(async () => {
|
|
687
769
|
await client.deletePack(workspaceId, packId);
|
|
@@ -695,7 +777,7 @@ function usePacks(options = {}) {
|
|
|
695
777
|
[client, workspaceId, run, refresh]
|
|
696
778
|
);
|
|
697
779
|
const installations = data?.installations ?? EMPTY_INSTALLATIONS;
|
|
698
|
-
const installationFor =
|
|
780
|
+
const installationFor = useCallback6(
|
|
699
781
|
(packId) => installations.find((installation) => installation.packId === packId) ?? null,
|
|
700
782
|
[installations]
|
|
701
783
|
);
|
|
@@ -716,16 +798,16 @@ function usePacks(options = {}) {
|
|
|
716
798
|
}
|
|
717
799
|
|
|
718
800
|
// src/hooks/use-workspaces.ts
|
|
719
|
-
import { useCallback as
|
|
801
|
+
import { useCallback as useCallback7 } from "react";
|
|
720
802
|
function useWorkspaces(options = {}) {
|
|
721
803
|
const client = useOpenGeniClient(options);
|
|
722
|
-
const load =
|
|
804
|
+
const load = useCallback7(async () => await client.listWorkspaces(), [client]);
|
|
723
805
|
const { data, loading, error, refresh } = usePolledValue(load, {
|
|
724
806
|
pollIntervalMs: options.pollIntervalMs,
|
|
725
807
|
enabled: options.enabled
|
|
726
808
|
});
|
|
727
809
|
const { run, mutating, mutationError, clearMutationError } = useMutationRunner();
|
|
728
|
-
const create =
|
|
810
|
+
const create = useCallback7(
|
|
729
811
|
async (request) => {
|
|
730
812
|
const result = await run(() => client.createWorkspace(request));
|
|
731
813
|
if (result) {
|
|
@@ -735,7 +817,7 @@ function useWorkspaces(options = {}) {
|
|
|
735
817
|
},
|
|
736
818
|
[client, run, refresh]
|
|
737
819
|
);
|
|
738
|
-
const update =
|
|
820
|
+
const update = useCallback7(
|
|
739
821
|
async (workspaceId, request) => {
|
|
740
822
|
const result = await run(() => client.updateWorkspace(workspaceId, request));
|
|
741
823
|
if (result) {
|
|
@@ -759,12 +841,12 @@ function useWorkspaces(options = {}) {
|
|
|
759
841
|
}
|
|
760
842
|
|
|
761
843
|
// src/hooks/use-billing-usage.ts
|
|
762
|
-
import { useCallback as
|
|
844
|
+
import { useCallback as useCallback8 } from "react";
|
|
763
845
|
function useBillingUsage(options = {}) {
|
|
764
846
|
const client = useOpenGeniClient(options);
|
|
765
847
|
const accountId = options.accountId;
|
|
766
848
|
const workspaceId = options.workspaceId;
|
|
767
|
-
const load =
|
|
849
|
+
const load = useCallback8(
|
|
768
850
|
async () => await client.getBillingUsage({
|
|
769
851
|
...accountId !== void 0 ? { accountId } : {},
|
|
770
852
|
...workspaceId !== void 0 ? { workspaceId } : {}
|
|
@@ -785,10 +867,10 @@ function useBillingUsage(options = {}) {
|
|
|
785
867
|
}
|
|
786
868
|
|
|
787
869
|
// src/hooks/use-available-models.ts
|
|
788
|
-
import { useCallback as
|
|
870
|
+
import { useCallback as useCallback9 } from "react";
|
|
789
871
|
function useAvailableModels(options = {}) {
|
|
790
872
|
const client = useOpenGeniClient(options);
|
|
791
|
-
const load =
|
|
873
|
+
const load = useCallback9(async () => await client.getClientConfig(), [client]);
|
|
792
874
|
const state = usePolledValue(load, {
|
|
793
875
|
pollIntervalMs: options.pollIntervalMs,
|
|
794
876
|
enabled: options.enabled
|
|
@@ -801,13 +883,42 @@ function useAvailableModels(options = {}) {
|
|
|
801
883
|
refresh: state.refresh
|
|
802
884
|
};
|
|
803
885
|
}
|
|
886
|
+
function useWorkspaceModelCatalog(options) {
|
|
887
|
+
const client = useOpenGeniClient(options);
|
|
888
|
+
const load = useCallback9(async () => {
|
|
889
|
+
if (!options.workspaceId) {
|
|
890
|
+
return { models: [], defaultModel: null };
|
|
891
|
+
}
|
|
892
|
+
const [catalog, config] = await Promise.all([
|
|
893
|
+
client.getWorkspaceModelCatalog(options.workspaceId),
|
|
894
|
+
client.getClientConfig()
|
|
895
|
+
]);
|
|
896
|
+
return {
|
|
897
|
+
models: catalog.models,
|
|
898
|
+
defaultModel: config.defaultModel
|
|
899
|
+
};
|
|
900
|
+
}, [client, options.workspaceId]);
|
|
901
|
+
const state = usePolledValue(load, {
|
|
902
|
+
pollIntervalMs: options.pollIntervalMs,
|
|
903
|
+
enabled: options.enabled !== false && Boolean(options.workspaceId)
|
|
904
|
+
});
|
|
905
|
+
const rows = sortPickerRows(projectPickerRows(state.data?.models ?? []));
|
|
906
|
+
return {
|
|
907
|
+
models: state.data?.models ?? [],
|
|
908
|
+
rows,
|
|
909
|
+
defaultModel: state.data?.defaultModel ?? null,
|
|
910
|
+
loading: state.loading,
|
|
911
|
+
error: state.error,
|
|
912
|
+
refresh: state.refresh
|
|
913
|
+
};
|
|
914
|
+
}
|
|
804
915
|
|
|
805
916
|
// src/hooks/use-session-capabilities.ts
|
|
806
917
|
import {
|
|
807
918
|
OpenGeniApiError,
|
|
808
919
|
applyUrlRotation
|
|
809
920
|
} from "@opengeni/sdk";
|
|
810
|
-
import { useCallback as
|
|
921
|
+
import { useCallback as useCallback10, useEffect as useEffect3, useRef as useRef2, useState } from "react";
|
|
811
922
|
function desktopAttachable(cell) {
|
|
812
923
|
if (cell.transport !== null) return true;
|
|
813
924
|
return cell.reason === "lease_cold" || cell.reason === "not_provisioned" || cell.reason === null;
|
|
@@ -847,10 +958,10 @@ function useSessionCapabilities(sessionId, options = {}) {
|
|
|
847
958
|
const epochRef = useRef2(0);
|
|
848
959
|
const viewerIdRef = useRef2(null);
|
|
849
960
|
const previousIdentityRef = useRef2(identityKey);
|
|
850
|
-
const renegotiate =
|
|
961
|
+
const renegotiate = useCallback10(() => {
|
|
851
962
|
setNonce((n) => n + 1);
|
|
852
963
|
}, []);
|
|
853
|
-
|
|
964
|
+
useEffect3(() => {
|
|
854
965
|
const identityChanged = previousIdentityRef.current !== identityKey;
|
|
855
966
|
previousIdentityRef.current = identityKey;
|
|
856
967
|
if (identityChanged) {
|
|
@@ -1047,7 +1158,7 @@ function useSessionCapabilities(sessionId, options = {}) {
|
|
|
1047
1158
|
identityKey
|
|
1048
1159
|
]);
|
|
1049
1160
|
const events = options.events;
|
|
1050
|
-
|
|
1161
|
+
useEffect3(() => {
|
|
1051
1162
|
if (!events || events.length === 0) return;
|
|
1052
1163
|
setCapabilities((prev) => {
|
|
1053
1164
|
if (!prev || !prev.DesktopStream.url) return prev;
|
|
@@ -1084,7 +1195,7 @@ import {
|
|
|
1084
1195
|
desktopSocketUrl,
|
|
1085
1196
|
nextDesktopState
|
|
1086
1197
|
} from "@opengeni/sdk";
|
|
1087
|
-
import { useEffect as
|
|
1198
|
+
import { useEffect as useEffect5, useRef as useRef4, useState as useState3 } from "react";
|
|
1088
1199
|
|
|
1089
1200
|
// src/lib/relay-wire.ts
|
|
1090
1201
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
@@ -1157,7 +1268,7 @@ function decodeStreamFrame(bytes) {
|
|
|
1157
1268
|
}
|
|
1158
1269
|
|
|
1159
1270
|
// src/hooks/use-relay-frame-stream.ts
|
|
1160
|
-
import { useEffect as
|
|
1271
|
+
import { useEffect as useEffect4, useRef as useRef3, useState as useState2 } from "react";
|
|
1161
1272
|
var TAG_OPEN = 1;
|
|
1162
1273
|
var TAG_OPENACK = 2;
|
|
1163
1274
|
var TAG_FRAME = 3;
|
|
@@ -1186,7 +1297,7 @@ function useRelayFrameStream(options) {
|
|
|
1186
1297
|
const token = capability?.token ?? null;
|
|
1187
1298
|
const factoryRef = useRef3(webSocketFactory);
|
|
1188
1299
|
factoryRef.current = webSocketFactory;
|
|
1189
|
-
|
|
1300
|
+
useEffect4(() => {
|
|
1190
1301
|
if (typeof window === "undefined") return;
|
|
1191
1302
|
if (transport !== "relay-frames" || !url) {
|
|
1192
1303
|
setBoth("idle");
|
|
@@ -1399,7 +1510,7 @@ function useDesktopStream(options) {
|
|
|
1399
1510
|
modeRef.current = mode;
|
|
1400
1511
|
rfbFactoryRef.current = rfbFactory;
|
|
1401
1512
|
const viewOnlyFor = (m, want) => m === "read-only" || !want;
|
|
1402
|
-
|
|
1513
|
+
useEffect5(() => {
|
|
1403
1514
|
if (typeof window === "undefined") return;
|
|
1404
1515
|
if (transport !== "vnc-ws" || !url) {
|
|
1405
1516
|
setBoth("idle");
|
|
@@ -1462,11 +1573,11 @@ function useDesktopStream(options) {
|
|
|
1462
1573
|
}
|
|
1463
1574
|
};
|
|
1464
1575
|
}, [url, token, transport, nonce]);
|
|
1465
|
-
|
|
1576
|
+
useEffect5(() => {
|
|
1466
1577
|
const rfb = rfbRef.current;
|
|
1467
1578
|
if (rfb) rfb.viewOnly = viewOnlyFor(mode, interactive);
|
|
1468
1579
|
}, [interactive, mode, state]);
|
|
1469
|
-
|
|
1580
|
+
useEffect5(() => {
|
|
1470
1581
|
const rfb = rfbRef.current;
|
|
1471
1582
|
if (rfb) {
|
|
1472
1583
|
rfb.clipViewport = false;
|
|
@@ -1486,7 +1597,7 @@ import {
|
|
|
1486
1597
|
ttydResizeFrame,
|
|
1487
1598
|
TtydServerCommand
|
|
1488
1599
|
} from "@opengeni/sdk";
|
|
1489
|
-
import { useEffect as
|
|
1600
|
+
import { useEffect as useEffect6, useMemo as useMemo2, useRef as useRef5, useState as useState4 } from "react";
|
|
1490
1601
|
function decodeFrame(data) {
|
|
1491
1602
|
if (typeof data === "string") {
|
|
1492
1603
|
return { command: data.charAt(0), payload: data.slice(1) };
|
|
@@ -1511,7 +1622,7 @@ function useTerminalStream(options) {
|
|
|
1511
1622
|
const transport = capability?.transport ?? null;
|
|
1512
1623
|
const url = capability?.url ?? null;
|
|
1513
1624
|
const token = capability?.token ?? null;
|
|
1514
|
-
|
|
1625
|
+
useEffect6(() => {
|
|
1515
1626
|
if (typeof window === "undefined" || typeof WebSocket === "undefined") return;
|
|
1516
1627
|
if (transport !== "pty-ws" || !url) {
|
|
1517
1628
|
setStatus("closed");
|
|
@@ -1608,7 +1719,7 @@ function useTerminalStream(options) {
|
|
|
1608
1719
|
|
|
1609
1720
|
// src/hooks/use-sandbox-terminal.ts
|
|
1610
1721
|
import { OpenGeniApiError as OpenGeniApiError2 } from "@opengeni/sdk";
|
|
1611
|
-
import { useCallback as
|
|
1722
|
+
import { useCallback as useCallback11, useEffect as useEffect7, useMemo as useMemo3, useRef as useRef6, useState as useState5 } from "react";
|
|
1612
1723
|
function useSandboxTerminal(sessionId, options) {
|
|
1613
1724
|
const { client, workspaceId } = useOpenGeni(options);
|
|
1614
1725
|
const includeAgentFirehose = options.includeAgentFirehose ?? true;
|
|
@@ -1622,14 +1733,14 @@ function useSandboxTerminal(sessionId, options) {
|
|
|
1622
1733
|
const [reopenNonce, setReopenNonce] = useState5(0);
|
|
1623
1734
|
const currentIdentityRef = useRef6(identityKey);
|
|
1624
1735
|
currentIdentityRef.current = identityKey;
|
|
1625
|
-
|
|
1736
|
+
useEffect7(() => {
|
|
1626
1737
|
setStateIdentity(identityKey);
|
|
1627
1738
|
setOpenedPtyId(null);
|
|
1628
1739
|
setOpenError(null);
|
|
1629
1740
|
}, [identityKey]);
|
|
1630
1741
|
const openInFlight = useRef6(false);
|
|
1631
1742
|
const boxWarm = liveness === void 0 || liveness === "warm" || liveness === "draining";
|
|
1632
|
-
|
|
1743
|
+
useEffect7(() => {
|
|
1633
1744
|
if (!interactive || !sessionId || ptyFilter || !boxWarm) {
|
|
1634
1745
|
setOpenError(null);
|
|
1635
1746
|
return;
|
|
@@ -1724,7 +1835,7 @@ function useSandboxTerminal(sessionId, options) {
|
|
|
1724
1835
|
});
|
|
1725
1836
|
};
|
|
1726
1837
|
}, [client, workspaceId, sessionId, activePtyId, canWrite, openedPtyId, identityKey]);
|
|
1727
|
-
const close =
|
|
1838
|
+
const close = useCallback11(() => {
|
|
1728
1839
|
if (!activePtyId || !sessionId) return;
|
|
1729
1840
|
void client.terminalPtyClose(workspaceId, sessionId, { ptyId: activePtyId }).catch(() => {
|
|
1730
1841
|
});
|
|
@@ -1740,7 +1851,7 @@ function useSandboxTerminal(sessionId, options) {
|
|
|
1740
1851
|
}
|
|
1741
1852
|
|
|
1742
1853
|
// src/hooks/use-sandbox-files.ts
|
|
1743
|
-
import { useCallback as
|
|
1854
|
+
import { useCallback as useCallback12, useEffect as useEffect8, useRef as useRef7, useState as useState6 } from "react";
|
|
1744
1855
|
var CapturedFileUnavailableError = class extends Error {
|
|
1745
1856
|
constructor(path, reason) {
|
|
1746
1857
|
super(
|
|
@@ -1944,7 +2055,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
1944
2055
|
const ownRevisionsRef = useRef7(/* @__PURE__ */ new Set());
|
|
1945
2056
|
const onMutationError = options.onMutationError;
|
|
1946
2057
|
treeRef.current = tree;
|
|
1947
|
-
const applyStatus =
|
|
2058
|
+
const applyStatus = useCallback12((nodes) => {
|
|
1948
2059
|
const overlay = statusRef.current;
|
|
1949
2060
|
const walk = (list) => {
|
|
1950
2061
|
let changed = false;
|
|
@@ -1967,7 +2078,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
1967
2078
|
};
|
|
1968
2079
|
return walk(nodes);
|
|
1969
2080
|
}, []);
|
|
1970
|
-
const refresh =
|
|
2081
|
+
const refresh = useCallback12(async () => {
|
|
1971
2082
|
if (!sessionId) return;
|
|
1972
2083
|
refreshAbortRef.current?.abort();
|
|
1973
2084
|
const refreshAbort = new AbortController();
|
|
@@ -2016,7 +2127,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2016
2127
|
if (refreshAbortRef.current === refreshAbort) refreshAbortRef.current = null;
|
|
2017
2128
|
}
|
|
2018
2129
|
}, [client, workspaceId, sessionId, rootPath, applyStatus]);
|
|
2019
|
-
const seedFromCapture =
|
|
2130
|
+
const seedFromCapture = useCallback12(
|
|
2020
2131
|
(manifest) => {
|
|
2021
2132
|
const overlay = /* @__PURE__ */ new Map();
|
|
2022
2133
|
for (const file of manifest.files) {
|
|
@@ -2035,7 +2146,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2035
2146
|
},
|
|
2036
2147
|
[applyStatus]
|
|
2037
2148
|
);
|
|
2038
|
-
const expand =
|
|
2149
|
+
const expand = useCallback12(
|
|
2039
2150
|
async (path) => {
|
|
2040
2151
|
if (!sessionId) return;
|
|
2041
2152
|
if (source === "capture" && capture) return;
|
|
@@ -2072,7 +2183,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2072
2183
|
},
|
|
2073
2184
|
[client, workspaceId, sessionId, capture, source, applyStatus]
|
|
2074
2185
|
);
|
|
2075
|
-
const readFile =
|
|
2186
|
+
const readFile = useCallback12(
|
|
2076
2187
|
async (path, requestOptions = {}) => {
|
|
2077
2188
|
if (!sessionId) throw new Error("no session");
|
|
2078
2189
|
const identitySignal = identityAbortRef.current.signal;
|
|
@@ -2147,7 +2258,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2147
2258
|
},
|
|
2148
2259
|
[client, workspaceId, sessionId, capture, source]
|
|
2149
2260
|
);
|
|
2150
|
-
const reconcilePath =
|
|
2261
|
+
const reconcilePath = useCallback12(
|
|
2151
2262
|
async (path) => {
|
|
2152
2263
|
if (!sessionId) return;
|
|
2153
2264
|
const identityGeneration = identityGenerationRef.current;
|
|
@@ -2174,7 +2285,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2174
2285
|
},
|
|
2175
2286
|
[client, workspaceId, sessionId, applyStatus]
|
|
2176
2287
|
);
|
|
2177
|
-
const runOptimistic =
|
|
2288
|
+
const runOptimistic = useCallback12(
|
|
2178
2289
|
async (opName, apply, op, reconcileParents) => {
|
|
2179
2290
|
const identityGeneration = identityGenerationRef.current;
|
|
2180
2291
|
const snapshot = treeRef.current;
|
|
@@ -2204,7 +2315,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2204
2315
|
},
|
|
2205
2316
|
[applyStatus, reconcilePath, onMutationError]
|
|
2206
2317
|
);
|
|
2207
|
-
const writeFile =
|
|
2318
|
+
const writeFile = useCallback12(
|
|
2208
2319
|
async (path, content, writeOptions = {}) => {
|
|
2209
2320
|
if (!sessionId) throw new Error("no session");
|
|
2210
2321
|
const identityGeneration = identityGenerationRef.current;
|
|
@@ -2245,7 +2356,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2245
2356
|
},
|
|
2246
2357
|
[client, workspaceId, sessionId, tree, runOptimistic]
|
|
2247
2358
|
);
|
|
2248
|
-
const createFile =
|
|
2359
|
+
const createFile = useCallback12(
|
|
2249
2360
|
async (path) => {
|
|
2250
2361
|
if (!sessionId) throw new Error("no session");
|
|
2251
2362
|
const parent = parentOf(path);
|
|
@@ -2259,7 +2370,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2259
2370
|
},
|
|
2260
2371
|
[client, workspaceId, sessionId, runOptimistic]
|
|
2261
2372
|
);
|
|
2262
|
-
const createDir =
|
|
2373
|
+
const createDir = useCallback12(
|
|
2263
2374
|
async (path) => {
|
|
2264
2375
|
if (!sessionId) throw new Error("no session");
|
|
2265
2376
|
const parent = parentOf(path);
|
|
@@ -2273,7 +2384,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2273
2384
|
},
|
|
2274
2385
|
[client, workspaceId, sessionId, runOptimistic]
|
|
2275
2386
|
);
|
|
2276
|
-
const deleteEntry =
|
|
2387
|
+
const deleteEntry = useCallback12(
|
|
2277
2388
|
async (path, recursive = false) => {
|
|
2278
2389
|
if (!sessionId) throw new Error("no session");
|
|
2279
2390
|
await runOptimistic(
|
|
@@ -2285,7 +2396,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2285
2396
|
},
|
|
2286
2397
|
[client, workspaceId, sessionId, runOptimistic]
|
|
2287
2398
|
);
|
|
2288
|
-
const moveEntry =
|
|
2399
|
+
const moveEntry = useCallback12(
|
|
2289
2400
|
async (path, newPath, opts) => {
|
|
2290
2401
|
if (!sessionId) throw new Error("no session");
|
|
2291
2402
|
const from = parentOf(path);
|
|
@@ -2312,7 +2423,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2312
2423
|
captureRef.current = capture;
|
|
2313
2424
|
const captureRevision = capture?.revision ?? null;
|
|
2314
2425
|
const previousIdentityRef = useRef7(identityKey);
|
|
2315
|
-
|
|
2426
|
+
useEffect8(() => {
|
|
2316
2427
|
refreshAbortRef.current?.abort();
|
|
2317
2428
|
refreshAbortRef.current = null;
|
|
2318
2429
|
refreshGenerationRef.current += 1;
|
|
@@ -2356,7 +2467,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2356
2467
|
refreshGenerationRef.current += 1;
|
|
2357
2468
|
};
|
|
2358
2469
|
}, [enabled, isLive2, captureRevision, identityKey, refresh, seedFromCapture]);
|
|
2359
|
-
const refreshGitOverlay =
|
|
2470
|
+
const refreshGitOverlay = useCallback12(async () => {
|
|
2360
2471
|
if (!sessionId) return;
|
|
2361
2472
|
const identityGeneration = identityGenerationRef.current;
|
|
2362
2473
|
const identitySignal = identityAbortRef.current.signal;
|
|
@@ -2380,7 +2491,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2380
2491
|
}
|
|
2381
2492
|
}, [client, workspaceId, sessionId, rootPath, applyStatus]);
|
|
2382
2493
|
const events = options.events;
|
|
2383
|
-
|
|
2494
|
+
useEffect8(() => {
|
|
2384
2495
|
if (!enabled || !events) return;
|
|
2385
2496
|
let sawNew = false;
|
|
2386
2497
|
for (const event of events) {
|
|
@@ -2426,7 +2537,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2426
2537
|
})();
|
|
2427
2538
|
}, 150);
|
|
2428
2539
|
}, [enabled, events, reconcilePath, refreshGitOverlay]);
|
|
2429
|
-
|
|
2540
|
+
useEffect8(
|
|
2430
2541
|
() => () => {
|
|
2431
2542
|
refreshAbortRef.current?.abort();
|
|
2432
2543
|
identityAbortRef.current.abort();
|
|
@@ -2455,7 +2566,7 @@ function useSandboxFiles(sessionId, options = {}) {
|
|
|
2455
2566
|
}
|
|
2456
2567
|
|
|
2457
2568
|
// src/hooks/use-sandbox-git.ts
|
|
2458
|
-
import { useCallback as
|
|
2569
|
+
import { useCallback as useCallback13, useEffect as useEffect9, useMemo as useMemo4, useRef as useRef8, useState as useState7 } from "react";
|
|
2459
2570
|
function normalizeRoot(root) {
|
|
2460
2571
|
const normalized = root.replaceAll("\\", "/").replace(/^\.\/+/, "").replace(/\/+$/, "");
|
|
2461
2572
|
return normalized === "." ? "" : normalized;
|
|
@@ -2538,7 +2649,7 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
2538
2649
|
const refreshGenerationRef = useRef8(0);
|
|
2539
2650
|
const refreshAbortRef = useRef8(null);
|
|
2540
2651
|
const lastChangeRef = useRef8(0);
|
|
2541
|
-
const refresh =
|
|
2652
|
+
const refresh = useCallback13(async () => {
|
|
2542
2653
|
if (!sessionId) return;
|
|
2543
2654
|
refreshAbortRef.current?.abort();
|
|
2544
2655
|
const refreshAbort = new AbortController();
|
|
@@ -2606,7 +2717,7 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
2606
2717
|
if (refreshAbortRef.current === refreshAbort) refreshAbortRef.current = null;
|
|
2607
2718
|
}
|
|
2608
2719
|
}, [client, workspaceId, sessionId, repoPaths, staged, workspaceWide]);
|
|
2609
|
-
const seedFromCapture =
|
|
2720
|
+
const seedFromCapture = useCallback13(
|
|
2610
2721
|
(manifest) => {
|
|
2611
2722
|
const repositories = workspaceWide ? manifest.repos : [repoForPath(manifest, repoPath)].filter(Boolean);
|
|
2612
2723
|
if (repositories.length === 0) {
|
|
@@ -2643,7 +2754,7 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
2643
2754
|
captureRef.current = capture;
|
|
2644
2755
|
const captureRevision = capture?.revision ?? null;
|
|
2645
2756
|
const previousIdentityRef = useRef8(identityKey);
|
|
2646
|
-
|
|
2757
|
+
useEffect9(() => {
|
|
2647
2758
|
refreshAbortRef.current?.abort();
|
|
2648
2759
|
refreshAbortRef.current = null;
|
|
2649
2760
|
refreshGenerationRef.current += 1;
|
|
@@ -2680,7 +2791,7 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
2680
2791
|
};
|
|
2681
2792
|
}, [enabled, isLive2, captureRevision, identityKey, refresh, seedFromCapture]);
|
|
2682
2793
|
const events = options.events;
|
|
2683
|
-
|
|
2794
|
+
useEffect9(() => {
|
|
2684
2795
|
if (!enabled || !events) return;
|
|
2685
2796
|
let latest = lastChangeRef.current;
|
|
2686
2797
|
for (const event of events) {
|
|
@@ -2712,7 +2823,7 @@ function useSandboxGit(sessionId, options = {}) {
|
|
|
2712
2823
|
}
|
|
2713
2824
|
|
|
2714
2825
|
// src/hooks/use-workspace-capture.ts
|
|
2715
|
-
import { useCallback as
|
|
2826
|
+
import { useCallback as useCallback14, useEffect as useEffect10, useRef as useRef9, useState as useState8 } from "react";
|
|
2716
2827
|
var REVISION_CAPTURED = "workspace.revision.captured";
|
|
2717
2828
|
var REVISION_DEGRADED = "workspace.revision.degraded";
|
|
2718
2829
|
var MANIFEST_FETCH_TIMEOUT_MS = 15e3;
|
|
@@ -2762,7 +2873,7 @@ function useWorkspaceCapture(sessionId, options = {}) {
|
|
|
2762
2873
|
const generationRef = useRef9(0);
|
|
2763
2874
|
const requestAbortRef = useRef9(null);
|
|
2764
2875
|
const lastSeqRef = useRef9(0);
|
|
2765
|
-
const refresh =
|
|
2876
|
+
const refresh = useCallback14(async () => {
|
|
2766
2877
|
if (!sessionId) return;
|
|
2767
2878
|
requestAbortRef.current?.abort();
|
|
2768
2879
|
const requestAbort = new AbortController();
|
|
@@ -2835,7 +2946,7 @@ function useWorkspaceCapture(sessionId, options = {}) {
|
|
|
2835
2946
|
if (requestAbortRef.current === requestAbort) requestAbortRef.current = null;
|
|
2836
2947
|
}
|
|
2837
2948
|
}, [client, workspaceId, sessionId, identityKey]);
|
|
2838
|
-
|
|
2949
|
+
useEffect10(() => {
|
|
2839
2950
|
requestAbortRef.current?.abort();
|
|
2840
2951
|
requestAbortRef.current = null;
|
|
2841
2952
|
generationRef.current += 1;
|
|
@@ -2858,7 +2969,7 @@ function useWorkspaceCapture(sessionId, options = {}) {
|
|
|
2858
2969
|
};
|
|
2859
2970
|
}, [enabled, refresh]);
|
|
2860
2971
|
const events = options.events;
|
|
2861
|
-
|
|
2972
|
+
useEffect10(() => {
|
|
2862
2973
|
if (!enabled || !events) return;
|
|
2863
2974
|
let newest = null;
|
|
2864
2975
|
for (const event of events) {
|
|
@@ -2884,7 +2995,7 @@ function useWorkspaceCapture(sessionId, options = {}) {
|
|
|
2884
2995
|
const visibleCapture = identityMatches ? capture : null;
|
|
2885
2996
|
const visibleAnnouncedRevision = identityMatches ? announcedRevision : null;
|
|
2886
2997
|
const loadedRevision = visibleCapture?.revision ?? null;
|
|
2887
|
-
|
|
2998
|
+
useEffect10(() => {
|
|
2888
2999
|
if (!enabled) return;
|
|
2889
3000
|
if (visibleAnnouncedRevision === null) return;
|
|
2890
3001
|
if (loadedRevision !== null && visibleAnnouncedRevision <= loadedRevision) return;
|
|
@@ -2906,7 +3017,7 @@ function useWorkspaceCapture(sessionId, options = {}) {
|
|
|
2906
3017
|
}
|
|
2907
3018
|
|
|
2908
3019
|
// src/hooks/use-workspace-edit.ts
|
|
2909
|
-
import { useCallback as
|
|
3020
|
+
import { useCallback as useCallback15, useEffect as useEffect11, useRef as useRef10, useState as useState9 } from "react";
|
|
2910
3021
|
function isLive(liveness) {
|
|
2911
3022
|
return liveness === "warm" || liveness === "draining";
|
|
2912
3023
|
}
|
|
@@ -2930,7 +3041,7 @@ function useWorkspaceEdit(sessionId, options = {}) {
|
|
|
2930
3041
|
const identityGenerationRef = useRef10(0);
|
|
2931
3042
|
const flushAttemptRef = useRef10(0);
|
|
2932
3043
|
const readAbortRef = useRef10(null);
|
|
2933
|
-
|
|
3044
|
+
useEffect11(() => {
|
|
2934
3045
|
identityGenerationRef.current += 1;
|
|
2935
3046
|
flushAttemptRef.current += 1;
|
|
2936
3047
|
readAbortRef.current?.abort();
|
|
@@ -2949,7 +3060,7 @@ function useWorkspaceEdit(sessionId, options = {}) {
|
|
|
2949
3060
|
readAbortRef.current = null;
|
|
2950
3061
|
};
|
|
2951
3062
|
}, [identityKey]);
|
|
2952
|
-
const edit =
|
|
3063
|
+
const edit = useCallback15(
|
|
2953
3064
|
(content) => {
|
|
2954
3065
|
if (stateIdentity !== identityKey) return;
|
|
2955
3066
|
if (offline) return;
|
|
@@ -2965,7 +3076,7 @@ function useWorkspaceEdit(sessionId, options = {}) {
|
|
|
2965
3076
|
},
|
|
2966
3077
|
[offline, live, onWarmRequested, stateIdentity, identityKey]
|
|
2967
3078
|
);
|
|
2968
|
-
const doFlush =
|
|
3079
|
+
const doFlush = useCallback15(
|
|
2969
3080
|
async (force) => {
|
|
2970
3081
|
if (stateIdentity !== identityKey) return;
|
|
2971
3082
|
if (!sessionId || !path) return;
|
|
@@ -3015,17 +3126,17 @@ function useWorkspaceEdit(sessionId, options = {}) {
|
|
|
3015
3126
|
},
|
|
3016
3127
|
[client, workspaceId, sessionId, path, baseContent, stateIdentity, identityKey]
|
|
3017
3128
|
);
|
|
3018
|
-
|
|
3129
|
+
useEffect11(() => {
|
|
3019
3130
|
if (offline) return;
|
|
3020
3131
|
if (!live) return;
|
|
3021
3132
|
if (buffer === null) return;
|
|
3022
3133
|
if (flush === "flushed" || flush === "conflict" || flush === "flushing") return;
|
|
3023
3134
|
void doFlush(false);
|
|
3024
3135
|
}, [offline, live, buffer, flush, doFlush]);
|
|
3025
|
-
const overwrite =
|
|
3136
|
+
const overwrite = useCallback15(async () => {
|
|
3026
3137
|
await doFlush(true);
|
|
3027
3138
|
}, [doFlush]);
|
|
3028
|
-
const discard =
|
|
3139
|
+
const discard = useCallback15(() => {
|
|
3029
3140
|
setBuffer(null);
|
|
3030
3141
|
setWantsWarm(false);
|
|
3031
3142
|
setFlush("idle");
|
|
@@ -3128,7 +3239,7 @@ function useMachineChip(input) {
|
|
|
3128
3239
|
|
|
3129
3240
|
// src/components/approval-surface.tsx
|
|
3130
3241
|
import { CheckIcon, ShieldCheckIcon, XIcon } from "lucide-react";
|
|
3131
|
-
import { useEffect as
|
|
3242
|
+
import { useEffect as useEffect12, useId, useRef as useRef11, useState as useState10 } from "react";
|
|
3132
3243
|
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
3133
3244
|
var defaultApprovalSurfaceMessages = {
|
|
3134
3245
|
title: "Approval required",
|
|
@@ -3171,7 +3282,7 @@ function ApprovalSurface({
|
|
|
3171
3282
|
const [pending, setPending] = useState10(null);
|
|
3172
3283
|
const pendingRef = useRef11(null);
|
|
3173
3284
|
const [decisionError, setDecisionError] = useState10(null);
|
|
3174
|
-
|
|
3285
|
+
useEffect12(() => {
|
|
3175
3286
|
if (pending && !approvals.some((approval) => approvalOwnershipKey(approval) === pending.approvalKey)) {
|
|
3176
3287
|
if (pendingRef.current?.token === pending.token) {
|
|
3177
3288
|
pendingRef.current = null;
|
|
@@ -3328,7 +3439,7 @@ function FleetTile({ session, title, subtitle, onOpen, className }) {
|
|
|
3328
3439
|
}
|
|
3329
3440
|
|
|
3330
3441
|
// src/components/sandbox-terminal.tsx
|
|
3331
|
-
import { useEffect as
|
|
3442
|
+
import { useEffect as useEffect13, useRef as useRef12, useState as useState11 } from "react";
|
|
3332
3443
|
|
|
3333
3444
|
// src/lib/xterm-theme.ts
|
|
3334
3445
|
var DARK_ANSI = {
|
|
@@ -3542,7 +3653,7 @@ function SandboxTerminal({
|
|
|
3542
3653
|
if (!activated) setActivated(true);
|
|
3543
3654
|
onActivate?.();
|
|
3544
3655
|
}
|
|
3545
|
-
|
|
3656
|
+
useEffect13(() => {
|
|
3546
3657
|
if (typeof window === "undefined") return;
|
|
3547
3658
|
const el = containerRef.current;
|
|
3548
3659
|
if (!el) return;
|
|
@@ -3654,19 +3765,19 @@ function SandboxTerminal({
|
|
|
3654
3765
|
setReady(false);
|
|
3655
3766
|
};
|
|
3656
3767
|
}, []);
|
|
3657
|
-
|
|
3768
|
+
useEffect13(() => {
|
|
3658
3769
|
const term = termRef.current;
|
|
3659
3770
|
if (!ready || !term) return;
|
|
3660
3771
|
term.options.disableStdin = !interactive;
|
|
3661
3772
|
term.options.cursorBlink = interactive;
|
|
3662
3773
|
}, [ready, interactive]);
|
|
3663
|
-
|
|
3774
|
+
useEffect13(() => {
|
|
3664
3775
|
const term = termRef.current;
|
|
3665
3776
|
if (!ready || !term) return;
|
|
3666
3777
|
const next = theme ?? xtermThemeFromTokens(containerRef.current);
|
|
3667
3778
|
if (next) term.options.theme = next;
|
|
3668
3779
|
}, [ready, theme]);
|
|
3669
|
-
|
|
3780
|
+
useEffect13(() => {
|
|
3670
3781
|
const term = termRef.current;
|
|
3671
3782
|
if (!ready || !term) return;
|
|
3672
3783
|
if (!booting) {
|
|
@@ -3687,7 +3798,7 @@ function SandboxTerminal({
|
|
|
3687
3798
|
const id = setInterval(paint, 1e3);
|
|
3688
3799
|
return () => clearInterval(id);
|
|
3689
3800
|
}, [ready, booting]);
|
|
3690
|
-
|
|
3801
|
+
useEffect13(() => {
|
|
3691
3802
|
const term = termRef.current;
|
|
3692
3803
|
if (!ready || !term || ptyMode) return;
|
|
3693
3804
|
for (const chunk of result.chunks) {
|
|
@@ -3697,7 +3808,7 @@ function SandboxTerminal({
|
|
|
3697
3808
|
term.write(chunk.text);
|
|
3698
3809
|
}
|
|
3699
3810
|
}, [ready, result.chunks, ptyMode]);
|
|
3700
|
-
|
|
3811
|
+
useEffect13(() => {
|
|
3701
3812
|
const term = termRef.current;
|
|
3702
3813
|
if (!ready || !term || !interactive) return;
|
|
3703
3814
|
const sink = ptyMode ? ptyWrite : result.write;
|
|
@@ -3705,14 +3816,14 @@ function SandboxTerminal({
|
|
|
3705
3816
|
const sub = term.onData((data) => sink(data));
|
|
3706
3817
|
return () => sub.dispose();
|
|
3707
3818
|
}, [ready, interactive, ptyMode, ptyWrite, result.write]);
|
|
3708
|
-
|
|
3819
|
+
useEffect13(() => {
|
|
3709
3820
|
const term = termRef.current;
|
|
3710
3821
|
if (!ready || !term || !ptyMode) return;
|
|
3711
3822
|
resizePty(term.cols, term.rows);
|
|
3712
3823
|
const sub = term.onResize(({ cols, rows }) => resizePty(cols, rows));
|
|
3713
3824
|
return () => sub.dispose();
|
|
3714
3825
|
}, [ready, ptyMode, ptyConnected, resizePty]);
|
|
3715
|
-
|
|
3826
|
+
useEffect13(() => {
|
|
3716
3827
|
if (typeof window === "undefined") return;
|
|
3717
3828
|
const refit = () => {
|
|
3718
3829
|
try {
|
|
@@ -3846,61 +3957,17 @@ import {
|
|
|
3846
3957
|
Trash2Icon
|
|
3847
3958
|
} from "lucide-react";
|
|
3848
3959
|
import {
|
|
3849
|
-
useCallback as
|
|
3960
|
+
useCallback as useCallback16,
|
|
3850
3961
|
useEffect as useEffect15,
|
|
3851
3962
|
useId as useId2,
|
|
3852
3963
|
useLayoutEffect,
|
|
3853
3964
|
useMemo as useMemo7,
|
|
3854
3965
|
useRef as useRef13,
|
|
3855
|
-
useState as
|
|
3966
|
+
useState as useState12
|
|
3856
3967
|
} from "react";
|
|
3857
3968
|
import { AlertDialog } from "radix-ui";
|
|
3858
3969
|
import { VList } from "virtua";
|
|
3859
3970
|
|
|
3860
|
-
// src/lib/use-portal-token-style.ts
|
|
3861
|
-
import { useEffect as useEffect13, useState as useState12 } from "react";
|
|
3862
|
-
function usePortalTokenStyle(sourceRef) {
|
|
3863
|
-
const [style, setStyle] = useState12({});
|
|
3864
|
-
useEffect13(() => {
|
|
3865
|
-
const source = sourceRef.current;
|
|
3866
|
-
if (!source || typeof MutationObserver === "undefined") return;
|
|
3867
|
-
let signature = "";
|
|
3868
|
-
const sync = () => {
|
|
3869
|
-
const computed = getComputedStyle(source);
|
|
3870
|
-
const next = { colorScheme: computed.colorScheme };
|
|
3871
|
-
for (let index = 0; index < computed.length; index += 1) {
|
|
3872
|
-
const property = computed.item(index);
|
|
3873
|
-
if (!property.startsWith("--og-")) continue;
|
|
3874
|
-
next[property] = computed.getPropertyValue(property);
|
|
3875
|
-
}
|
|
3876
|
-
const nextSignature = JSON.stringify(next);
|
|
3877
|
-
if (nextSignature !== signature) {
|
|
3878
|
-
signature = nextSignature;
|
|
3879
|
-
setStyle(next);
|
|
3880
|
-
}
|
|
3881
|
-
};
|
|
3882
|
-
const observers = [];
|
|
3883
|
-
let ancestor = source;
|
|
3884
|
-
while (ancestor) {
|
|
3885
|
-
const observer = new MutationObserver(sync);
|
|
3886
|
-
observer.observe(ancestor, {
|
|
3887
|
-
attributes: true,
|
|
3888
|
-
attributeFilter: ["class", "data-og-theme", "style"]
|
|
3889
|
-
});
|
|
3890
|
-
observers.push(observer);
|
|
3891
|
-
ancestor = ancestor.parentElement;
|
|
3892
|
-
}
|
|
3893
|
-
const colorScheme = window.matchMedia?.("(prefers-color-scheme: dark)");
|
|
3894
|
-
colorScheme?.addEventListener?.("change", sync);
|
|
3895
|
-
sync();
|
|
3896
|
-
return () => {
|
|
3897
|
-
for (const observer of observers) observer.disconnect();
|
|
3898
|
-
colorScheme?.removeEventListener?.("change", sync);
|
|
3899
|
-
};
|
|
3900
|
-
}, [sourceRef]);
|
|
3901
|
-
return style;
|
|
3902
|
-
}
|
|
3903
|
-
|
|
3904
3971
|
// src/lib/use-unicode-fonts.ts
|
|
3905
3972
|
import { useEffect as useEffect14, useMemo as useMemo6 } from "react";
|
|
3906
3973
|
var japaneseScript = /[\u3040-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff]/u;
|
|
@@ -3978,22 +4045,22 @@ function FileBrowser({
|
|
|
3978
4045
|
confirmDelete,
|
|
3979
4046
|
className
|
|
3980
4047
|
}) {
|
|
3981
|
-
const [expanded, setExpanded] =
|
|
3982
|
-
const [loadingPaths, setLoadingPaths] =
|
|
3983
|
-
const [active, setActive] =
|
|
3984
|
-
const [draftCreate, setDraftCreate] =
|
|
3985
|
-
const [draftRename, setDraftRename] =
|
|
3986
|
-
const [dragOver, setDragOver] =
|
|
3987
|
-
const [menu, setMenu] =
|
|
3988
|
-
const [pendingDelete, setPendingDelete] =
|
|
3989
|
-
const [busy, setBusy] =
|
|
3990
|
-
const [coarsePointer, setCoarsePointer] =
|
|
4048
|
+
const [expanded, setExpanded] = useState12(/* @__PURE__ */ new Set());
|
|
4049
|
+
const [loadingPaths, setLoadingPaths] = useState12(/* @__PURE__ */ new Set());
|
|
4050
|
+
const [active, setActive] = useState12(null);
|
|
4051
|
+
const [draftCreate, setDraftCreate] = useState12(null);
|
|
4052
|
+
const [draftRename, setDraftRename] = useState12(null);
|
|
4053
|
+
const [dragOver, setDragOver] = useState12(null);
|
|
4054
|
+
const [menu, setMenu] = useState12(null);
|
|
4055
|
+
const [pendingDelete, setPendingDelete] = useState12(null);
|
|
4056
|
+
const [busy, setBusy] = useState12(false);
|
|
4057
|
+
const [coarsePointer, setCoarsePointer] = useState12(false);
|
|
3991
4058
|
const treeId = useId2();
|
|
3992
4059
|
const containerRef = useRef13(null);
|
|
3993
4060
|
const deleteReturnFocusRef = useRef13(null);
|
|
3994
4061
|
const vlistRef = useRef13(null);
|
|
3995
4062
|
const portalTokenStyle = usePortalTokenStyle(containerRef);
|
|
3996
|
-
const getTreeElement =
|
|
4063
|
+
const getTreeElement = useCallback16(
|
|
3997
4064
|
() => typeof document === "undefined" ? null : document.getElementById(treeId),
|
|
3998
4065
|
[treeId]
|
|
3999
4066
|
);
|
|
@@ -4012,7 +4079,7 @@ function FileBrowser({
|
|
|
4012
4079
|
}
|
|
4013
4080
|
}, []);
|
|
4014
4081
|
const cursor = active ?? selectedPath ?? null;
|
|
4015
|
-
const expand =
|
|
4082
|
+
const expand = useCallback16(
|
|
4016
4083
|
async (path) => {
|
|
4017
4084
|
const node = findNode(result.tree, path);
|
|
4018
4085
|
if (node && node.kind === "dir" && node.children === void 0) {
|
|
@@ -4030,14 +4097,14 @@ function FileBrowser({
|
|
|
4030
4097
|
},
|
|
4031
4098
|
[result]
|
|
4032
4099
|
);
|
|
4033
|
-
const open =
|
|
4100
|
+
const open = useCallback16(
|
|
4034
4101
|
(path) => {
|
|
4035
4102
|
setExpanded((prev) => new Set(prev).add(path));
|
|
4036
4103
|
void expand(path);
|
|
4037
4104
|
},
|
|
4038
4105
|
[expand]
|
|
4039
4106
|
);
|
|
4040
|
-
const toggle =
|
|
4107
|
+
const toggle = useCallback16(
|
|
4041
4108
|
async (node) => {
|
|
4042
4109
|
if (node.kind !== "dir") return;
|
|
4043
4110
|
const isOpen = expanded.has(node.path);
|
|
@@ -4112,7 +4179,7 @@ function FileBrowser({
|
|
|
4112
4179
|
const cursorIndex = cursor ? rowIndexByPath.get(cursor) ?? -1 : -1;
|
|
4113
4180
|
const activeDescendantId = cursorIndex >= 0 ? `${treeId}-item-${cursorIndex}` : void 0;
|
|
4114
4181
|
const supportsMutation = editable && result.source === "live" && result.error === null && !result.loading;
|
|
4115
|
-
const performDelete =
|
|
4182
|
+
const performDelete = useCallback16(
|
|
4116
4183
|
async (node) => {
|
|
4117
4184
|
if (!supportsMutation) return;
|
|
4118
4185
|
const recursive = node.kind === "dir";
|
|
@@ -4126,7 +4193,7 @@ function FileBrowser({
|
|
|
4126
4193
|
},
|
|
4127
4194
|
[supportsMutation, result]
|
|
4128
4195
|
);
|
|
4129
|
-
const runDelete =
|
|
4196
|
+
const runDelete = useCallback16(
|
|
4130
4197
|
async (node, returnFocus) => {
|
|
4131
4198
|
if (!supportsMutation) return;
|
|
4132
4199
|
setMenu(null);
|
|
@@ -4139,7 +4206,7 @@ function FileBrowser({
|
|
|
4139
4206
|
},
|
|
4140
4207
|
[supportsMutation, confirmDelete, performDelete]
|
|
4141
4208
|
);
|
|
4142
|
-
const closePendingDelete =
|
|
4209
|
+
const closePendingDelete = useCallback16(
|
|
4143
4210
|
(restoreTrigger) => {
|
|
4144
4211
|
const returnTarget = restoreTrigger ? deleteReturnFocusRef.current : getTreeElement();
|
|
4145
4212
|
deleteReturnFocusRef.current = null;
|
|
@@ -4153,7 +4220,7 @@ function FileBrowser({
|
|
|
4153
4220
|
},
|
|
4154
4221
|
[getTreeElement]
|
|
4155
4222
|
);
|
|
4156
|
-
const commitCreate =
|
|
4223
|
+
const commitCreate = useCallback16(
|
|
4157
4224
|
async (name) => {
|
|
4158
4225
|
const draft = draftCreate;
|
|
4159
4226
|
setDraftCreate(null);
|
|
@@ -4178,7 +4245,7 @@ function FileBrowser({
|
|
|
4178
4245
|
},
|
|
4179
4246
|
[draftCreate, supportsMutation, result, open, onSelectFile]
|
|
4180
4247
|
);
|
|
4181
|
-
const commitRename =
|
|
4248
|
+
const commitRename = useCallback16(
|
|
4182
4249
|
async (name) => {
|
|
4183
4250
|
const draft = draftRename;
|
|
4184
4251
|
setDraftRename(null);
|
|
@@ -4201,7 +4268,7 @@ function FileBrowser({
|
|
|
4201
4268
|
},
|
|
4202
4269
|
[draftRename, supportsMutation, result, selectedPath, active, onSelectFile]
|
|
4203
4270
|
);
|
|
4204
|
-
const startCreate =
|
|
4271
|
+
const startCreate = useCallback16(
|
|
4205
4272
|
(kind) => {
|
|
4206
4273
|
if (!supportsMutation) return;
|
|
4207
4274
|
const anchor = cursor ? findNode(result.tree, cursor) : void 0;
|
|
@@ -4213,7 +4280,7 @@ function FileBrowser({
|
|
|
4213
4280
|
},
|
|
4214
4281
|
[supportsMutation, cursor, result.tree, open]
|
|
4215
4282
|
);
|
|
4216
|
-
const startRename =
|
|
4283
|
+
const startRename = useCallback16(
|
|
4217
4284
|
(node) => {
|
|
4218
4285
|
if (!supportsMutation) return;
|
|
4219
4286
|
setDraftCreate(null);
|
|
@@ -4222,7 +4289,7 @@ function FileBrowser({
|
|
|
4222
4289
|
},
|
|
4223
4290
|
[supportsMutation]
|
|
4224
4291
|
);
|
|
4225
|
-
const onDropOnto =
|
|
4292
|
+
const onDropOnto = useCallback16(
|
|
4226
4293
|
async (targetDir, sourcePath) => {
|
|
4227
4294
|
setDragOver(null);
|
|
4228
4295
|
if (!supportsMutation || !sourcePath) return;
|
|
@@ -4246,7 +4313,7 @@ function FileBrowser({
|
|
|
4246
4313
|
},
|
|
4247
4314
|
[supportsMutation, result, selectedPath, active, onSelectFile]
|
|
4248
4315
|
);
|
|
4249
|
-
const onKeyDown =
|
|
4316
|
+
const onKeyDown = useCallback16(
|
|
4250
4317
|
(e) => {
|
|
4251
4318
|
if (draftCreate || draftRename) return;
|
|
4252
4319
|
if (flatRows.length === 0) return;
|
|
@@ -4747,7 +4814,7 @@ function DeleteDialog({
|
|
|
4747
4814
|
onConfirm
|
|
4748
4815
|
}) {
|
|
4749
4816
|
const cancelRef = useRef13(null);
|
|
4750
|
-
const [open, setOpen] =
|
|
4817
|
+
const [open, setOpen] = useState12(true);
|
|
4751
4818
|
const closeIntentRef = useRef13("cancel");
|
|
4752
4819
|
const settledRef = useRef13(false);
|
|
4753
4820
|
const settleTimerRef = useRef13(null);
|
|
@@ -4885,7 +4952,7 @@ function InlineInput({
|
|
|
4885
4952
|
onCommit,
|
|
4886
4953
|
onCancel
|
|
4887
4954
|
}) {
|
|
4888
|
-
const [value, setValue] =
|
|
4955
|
+
const [value, setValue] = useState12(initialValue);
|
|
4889
4956
|
const ref = useRef13(null);
|
|
4890
4957
|
const doneRef = useRef13(false);
|
|
4891
4958
|
useEffect15(() => {
|
|
@@ -5060,7 +5127,7 @@ import {
|
|
|
5060
5127
|
lazy,
|
|
5061
5128
|
Suspense,
|
|
5062
5129
|
useEffect as useEffect16,
|
|
5063
|
-
useState as
|
|
5130
|
+
useState as useState13
|
|
5064
5131
|
} from "react";
|
|
5065
5132
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
5066
5133
|
var LazyFile = lazy(async () => {
|
|
@@ -5077,7 +5144,7 @@ function PierreFile({
|
|
|
5077
5144
|
fallback,
|
|
5078
5145
|
className
|
|
5079
5146
|
}) {
|
|
5080
|
-
const [failed, setFailed] =
|
|
5147
|
+
const [failed, setFailed] = useState13(false);
|
|
5081
5148
|
useEffect16(() => {
|
|
5082
5149
|
let cancelled = false;
|
|
5083
5150
|
void import("@pierre/diffs/react").catch(() => {
|
|
@@ -5137,11 +5204,11 @@ function FileSkeleton() {
|
|
|
5137
5204
|
// src/components/code-editor.tsx
|
|
5138
5205
|
import { Loader2Icon, SaveIcon } from "lucide-react";
|
|
5139
5206
|
import {
|
|
5140
|
-
useCallback as
|
|
5207
|
+
useCallback as useCallback17,
|
|
5141
5208
|
useEffect as useEffect17,
|
|
5142
5209
|
useMemo as useMemo8,
|
|
5143
5210
|
useRef as useRef14,
|
|
5144
|
-
useState as
|
|
5211
|
+
useState as useState14
|
|
5145
5212
|
} from "react";
|
|
5146
5213
|
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
5147
5214
|
var LANGUAGE_LOADERS = {
|
|
@@ -5200,13 +5267,13 @@ function CodeEditor({
|
|
|
5200
5267
|
fallback,
|
|
5201
5268
|
className
|
|
5202
5269
|
}) {
|
|
5203
|
-
const [failed, setFailed] =
|
|
5204
|
-
const [bundle, setBundle] =
|
|
5205
|
-
const [value, setValue] =
|
|
5206
|
-
const [baseline, setBaseline] =
|
|
5207
|
-
const [saving, setSaving] =
|
|
5208
|
-
const [saveError, setSaveError] =
|
|
5209
|
-
const [savedTick, setSavedTick] =
|
|
5270
|
+
const [failed, setFailed] = useState14(false);
|
|
5271
|
+
const [bundle, setBundle] = useState14(null);
|
|
5272
|
+
const [value, setValue] = useState14(initialContents);
|
|
5273
|
+
const [baseline, setBaseline] = useState14(initialContents);
|
|
5274
|
+
const [saving, setSaving] = useState14(false);
|
|
5275
|
+
const [saveError, setSaveError] = useState14(null);
|
|
5276
|
+
const [savedTick, setSavedTick] = useState14(false);
|
|
5210
5277
|
const dirty = value !== baseline;
|
|
5211
5278
|
const saveConflict = saveError !== null && saveError.code === "file_write_conflict";
|
|
5212
5279
|
const editIntentFiredRef = useRef14(false);
|
|
@@ -5221,7 +5288,7 @@ function CodeEditor({
|
|
|
5221
5288
|
setSaveError(null);
|
|
5222
5289
|
setSavedTick(false);
|
|
5223
5290
|
}, [path, initialContents]);
|
|
5224
|
-
const noteEdit =
|
|
5291
|
+
const noteEdit = useCallback17(
|
|
5225
5292
|
(next) => {
|
|
5226
5293
|
setValue(next);
|
|
5227
5294
|
setSavedTick(false);
|
|
@@ -5275,7 +5342,7 @@ function CodeEditor({
|
|
|
5275
5342
|
}, [langKey]);
|
|
5276
5343
|
const saveRef = useRef14(() => {
|
|
5277
5344
|
});
|
|
5278
|
-
const save =
|
|
5345
|
+
const save = useCallback17(async () => {
|
|
5279
5346
|
if (readOnly) return;
|
|
5280
5347
|
const snapshot = value;
|
|
5281
5348
|
if (snapshot === baseline) return;
|
|
@@ -5293,7 +5360,7 @@ function CodeEditor({
|
|
|
5293
5360
|
setSaving(false);
|
|
5294
5361
|
}
|
|
5295
5362
|
}, [readOnly, value, baseline, onSave, path]);
|
|
5296
|
-
const overwrite =
|
|
5363
|
+
const overwrite = useCallback17(async () => {
|
|
5297
5364
|
if (readOnly || !onOverwrite) return;
|
|
5298
5365
|
const snapshot = value;
|
|
5299
5366
|
if (snapshot === baseline) return;
|
|
@@ -5476,7 +5543,7 @@ function EditorSkeleton() {
|
|
|
5476
5543
|
|
|
5477
5544
|
// src/components/sandbox-files.tsx
|
|
5478
5545
|
import { FileCode2Icon, FileWarningIcon, LoaderCircleIcon } from "lucide-react";
|
|
5479
|
-
import { useCallback as
|
|
5546
|
+
import { useCallback as useCallback18, useEffect as useEffect18, useRef as useRef15, useState as useState15 } from "react";
|
|
5480
5547
|
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
5481
5548
|
function SandboxFiles({
|
|
5482
5549
|
files,
|
|
@@ -5495,10 +5562,10 @@ function SandboxFiles({
|
|
|
5495
5562
|
themeType,
|
|
5496
5563
|
className
|
|
5497
5564
|
}) {
|
|
5498
|
-
const [selected, setSelected] =
|
|
5499
|
-
const [editMode, setEditMode] =
|
|
5500
|
-
const [liveRequestedPath, setLiveRequestedPath] =
|
|
5501
|
-
const [viewReloadRevision, setViewReloadRevision] =
|
|
5565
|
+
const [selected, setSelected] = useState15(null);
|
|
5566
|
+
const [editMode, setEditMode] = useState15(false);
|
|
5567
|
+
const [liveRequestedPath, setLiveRequestedPath] = useState15(null);
|
|
5568
|
+
const [viewReloadRevision, setViewReloadRevision] = useState15(0);
|
|
5502
5569
|
const pendingRequestRef = useRef15(null);
|
|
5503
5570
|
const handledRequestRef = useRef15(null);
|
|
5504
5571
|
const requestKey = requestedPath ? requestedPathRequestId ?? requestedPath : null;
|
|
@@ -5521,7 +5588,7 @@ function SandboxFiles({
|
|
|
5521
5588
|
setEditMode(false);
|
|
5522
5589
|
}, [requestKey, requestedPath, requestedPathReady]);
|
|
5523
5590
|
const rootRef = useRef15(null);
|
|
5524
|
-
const [wide, setWide] =
|
|
5591
|
+
const [wide, setWide] = useState15(false);
|
|
5525
5592
|
useEffect18(() => {
|
|
5526
5593
|
const el = rootRef.current;
|
|
5527
5594
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
@@ -5535,7 +5602,7 @@ function SandboxFiles({
|
|
|
5535
5602
|
const resolvedTheme = useThemeType(themeType);
|
|
5536
5603
|
const viewPath = selected;
|
|
5537
5604
|
const fileView = useFileView(viewPath, files.readFile, viewReloadRevision);
|
|
5538
|
-
const selectFile =
|
|
5605
|
+
const selectFile = useCallback18((path) => {
|
|
5539
5606
|
if (pendingRequestRef.current !== null) {
|
|
5540
5607
|
handledRequestRef.current = pendingRequestRef.current;
|
|
5541
5608
|
pendingRequestRef.current = null;
|
|
@@ -5809,7 +5876,7 @@ function Segmented({
|
|
|
5809
5876
|
)) });
|
|
5810
5877
|
}
|
|
5811
5878
|
function useFileView(path, readFile, reloadRevision = 0) {
|
|
5812
|
-
const [state, setState] =
|
|
5879
|
+
const [state, setState] = useState15({
|
|
5813
5880
|
content: null,
|
|
5814
5881
|
isBinary: false,
|
|
5815
5882
|
truncated: false,
|
|
@@ -5908,7 +5975,7 @@ function Notice({
|
|
|
5908
5975
|
|
|
5909
5976
|
// src/components/desktop-viewer.tsx
|
|
5910
5977
|
import { LoaderCircleIcon as LoaderCircleIcon2, MonitorIcon, MousePointerClickIcon, WifiOffIcon } from "lucide-react";
|
|
5911
|
-
import { useEffect as useEffect19, useRef as useRef16, useState as
|
|
5978
|
+
import { useEffect as useEffect19, useRef as useRef16, useState as useState16 } from "react";
|
|
5912
5979
|
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
5913
5980
|
var DESKTOP_MEDIA_BACKGROUND = "#000";
|
|
5914
5981
|
function isHardUnavailable(reason) {
|
|
@@ -5942,8 +6009,8 @@ function DesktopViewer({
|
|
|
5942
6009
|
className
|
|
5943
6010
|
}) {
|
|
5944
6011
|
const containerRef = useRef16(null);
|
|
5945
|
-
const [consented, setConsented] =
|
|
5946
|
-
const [takeControl, setTakeControl] =
|
|
6012
|
+
const [consented, setConsented] = useState16(false);
|
|
6013
|
+
const [takeControl, setTakeControl] = useState16(interactive ?? false);
|
|
5947
6014
|
const externallyControlled = interactive !== void 0;
|
|
5948
6015
|
const serverAllowsControl = capability?.mode !== "read-only";
|
|
5949
6016
|
const wantControl = externallyControlled ? interactive : takeControl;
|
|
@@ -6007,8 +6074,8 @@ function DesktopViewer({
|
|
|
6007
6074
|
document.addEventListener("visibilitychange", maybeReattach);
|
|
6008
6075
|
return () => document.removeEventListener("visibilitychange", maybeReattach);
|
|
6009
6076
|
}, [hasLiveUrl, connectCapability?.url]);
|
|
6010
|
-
const [connectTimedOut, setConnectTimedOut] =
|
|
6011
|
-
const [reconnectNonce, setReconnectNonce] =
|
|
6077
|
+
const [connectTimedOut, setConnectTimedOut] = useState16(false);
|
|
6078
|
+
const [reconnectNonce, setReconnectNonce] = useState16(0);
|
|
6012
6079
|
useEffect19(() => {
|
|
6013
6080
|
setConnectTimedOut(false);
|
|
6014
6081
|
if (!hasLiveUrl || connected || stream.error || connectTimeoutMs <= 0) return;
|
|
@@ -6287,12 +6354,12 @@ function defaultNotice(title, body, onRetry) {
|
|
|
6287
6354
|
|
|
6288
6355
|
// src/components/workspace-dock.tsx
|
|
6289
6356
|
import {
|
|
6290
|
-
useCallback as
|
|
6357
|
+
useCallback as useCallback19,
|
|
6291
6358
|
useEffect as useEffect20,
|
|
6292
6359
|
useId as useId3,
|
|
6293
6360
|
useLayoutEffect as useLayoutEffect2,
|
|
6294
6361
|
useRef as useRef17,
|
|
6295
|
-
useState as
|
|
6362
|
+
useState as useState17
|
|
6296
6363
|
} from "react";
|
|
6297
6364
|
import {
|
|
6298
6365
|
ChevronsLeftRightIcon,
|
|
@@ -6325,7 +6392,7 @@ function getLayoutStorage() {
|
|
|
6325
6392
|
var useDockLayoutEffect = typeof window === "undefined" ? useEffect20 : useLayoutEffect2;
|
|
6326
6393
|
var DOCK_OVERLAY_BREAKPOINT = 1024;
|
|
6327
6394
|
function useIsNarrow(maxWidth) {
|
|
6328
|
-
const [narrow, setNarrow] =
|
|
6395
|
+
const [narrow, setNarrow] = useState17(false);
|
|
6329
6396
|
useDockLayoutEffect(() => {
|
|
6330
6397
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
6331
6398
|
return;
|
|
@@ -6363,9 +6430,9 @@ function WorkspaceDock({
|
|
|
6363
6430
|
const returnFocusRef = useRef17(null);
|
|
6364
6431
|
const initialNarrowFocusRef = useRef17(false);
|
|
6365
6432
|
const dockPanelRef = usePanelRef();
|
|
6366
|
-
const [internalCollapsed, setInternalCollapsed] =
|
|
6367
|
-
const [maximized, setMaximized] =
|
|
6368
|
-
const [internalTab, setInternalTab] =
|
|
6433
|
+
const [internalCollapsed, setInternalCollapsed] = useState17(false);
|
|
6434
|
+
const [maximized, setMaximized] = useState17(false);
|
|
6435
|
+
const [internalTab, setInternalTab] = useState17(tabs[0]?.id ?? "");
|
|
6369
6436
|
const collapsed = collapsedProp ?? internalCollapsed;
|
|
6370
6437
|
const hostControlled = collapsedProp !== void 0;
|
|
6371
6438
|
const previousCollapsedRef = useRef17(collapsed);
|
|
@@ -6379,14 +6446,14 @@ function WorkspaceDock({
|
|
|
6379
6446
|
const firstTabId = tabs[0]?.id ?? "";
|
|
6380
6447
|
const requestedTabIsValid = tabIds.includes(requestedTab);
|
|
6381
6448
|
const current = requestedTabIsValid ? requestedTab : firstTabId;
|
|
6382
|
-
const setTab =
|
|
6449
|
+
const setTab = useCallback19(
|
|
6383
6450
|
(id) => {
|
|
6384
6451
|
setInternalTab(id);
|
|
6385
6452
|
onActiveTabChange?.(id);
|
|
6386
6453
|
},
|
|
6387
6454
|
[onActiveTabChange]
|
|
6388
6455
|
);
|
|
6389
|
-
const setCollapsed =
|
|
6456
|
+
const setCollapsed = useCallback19(
|
|
6390
6457
|
(next) => {
|
|
6391
6458
|
setInternalCollapsed((previous) => previous === next ? previous : next);
|
|
6392
6459
|
onCollapsedChange?.(next);
|
|
@@ -6452,11 +6519,11 @@ function WorkspaceDock({
|
|
|
6452
6519
|
setTab(firstTabId);
|
|
6453
6520
|
}
|
|
6454
6521
|
}, [firstTabId, requestedTabIsValid, setTab]);
|
|
6455
|
-
const collapse =
|
|
6522
|
+
const collapse = useCallback19(() => {
|
|
6456
6523
|
dockPanelRef.current?.collapse();
|
|
6457
6524
|
setCollapsed(true);
|
|
6458
6525
|
}, [dockPanelRef, setCollapsed]);
|
|
6459
|
-
const expand =
|
|
6526
|
+
const expand = useCallback19(() => {
|
|
6460
6527
|
dockPanelRef.current?.expand();
|
|
6461
6528
|
setCollapsed(false);
|
|
6462
6529
|
}, [dockPanelRef, setCollapsed]);
|
|
@@ -6679,11 +6746,11 @@ function DockChrome({
|
|
|
6679
6746
|
const tabsetId = useId3();
|
|
6680
6747
|
const tabRefs = useRef17([]);
|
|
6681
6748
|
const tabListRef = useRef17(null);
|
|
6682
|
-
const [visitedTabs, setVisitedTabs] =
|
|
6683
|
-
const [tabOverflow, setTabOverflow] =
|
|
6749
|
+
const [visitedTabs, setVisitedTabs] = useState17(() => /* @__PURE__ */ new Set());
|
|
6750
|
+
const [tabOverflow, setTabOverflow] = useState17({ start: false, end: false });
|
|
6684
6751
|
const activeId = active?.id ?? "";
|
|
6685
6752
|
const activeTabIndex = tabs.findIndex((tab) => tab.id === activeId);
|
|
6686
|
-
const keepActiveTabVisible =
|
|
6753
|
+
const keepActiveTabVisible = useCallback19(() => {
|
|
6687
6754
|
const selected = activeTabIndex >= 0 ? tabRefs.current[activeTabIndex] : null;
|
|
6688
6755
|
selected?.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
6689
6756
|
}, [activeTabIndex]);
|
|
@@ -6809,7 +6876,7 @@ function DockChrome({
|
|
|
6809
6876
|
}
|
|
6810
6877
|
|
|
6811
6878
|
// src/components/sandbox-workspace.tsx
|
|
6812
|
-
import { useCallback as
|
|
6879
|
+
import { useCallback as useCallback22, useEffect as useEffect23, useMemo as useMemo11, useRef as useRef20, useState as useState20 } from "react";
|
|
6813
6880
|
import { Popover } from "radix-ui";
|
|
6814
6881
|
import {
|
|
6815
6882
|
CircleCheckIcon,
|
|
@@ -6823,18 +6890,18 @@ import {
|
|
|
6823
6890
|
// src/components/workbench-changes.tsx
|
|
6824
6891
|
import { ArrowUpRightIcon, FileWarningIcon as FileWarningIcon2, HistoryIcon } from "lucide-react";
|
|
6825
6892
|
import {
|
|
6826
|
-
useCallback as
|
|
6893
|
+
useCallback as useCallback21,
|
|
6827
6894
|
useEffect as useEffect22,
|
|
6828
6895
|
useId as useId4,
|
|
6829
6896
|
useLayoutEffect as useLayoutEffect3,
|
|
6830
6897
|
useMemo as useMemo10,
|
|
6831
6898
|
useRef as useRef19,
|
|
6832
|
-
useState as
|
|
6899
|
+
useState as useState19
|
|
6833
6900
|
} from "react";
|
|
6834
6901
|
import { VList as VList2 } from "virtua";
|
|
6835
6902
|
|
|
6836
6903
|
// src/hooks/use-windowed-sections.ts
|
|
6837
|
-
import { useCallback as
|
|
6904
|
+
import { useCallback as useCallback20, useEffect as useEffect21, useMemo as useMemo9, useRef as useRef18, useState as useState18 } from "react";
|
|
6838
6905
|
function computeWindowRange(heights, scrollTop, viewport, overscan) {
|
|
6839
6906
|
const n = heights.length;
|
|
6840
6907
|
if (n === 0) return { start: 0, end: 0 };
|
|
@@ -6866,7 +6933,7 @@ function computeWindowRange(heights, scrollTop, viewport, overscan) {
|
|
|
6866
6933
|
function useWindowedSections(opts) {
|
|
6867
6934
|
const { count, estimateHeight, overscan = 3 } = opts;
|
|
6868
6935
|
const scrollRef = useRef18(null);
|
|
6869
|
-
const [heights, setHeights] =
|
|
6936
|
+
const [heights, setHeights] = useState18(
|
|
6870
6937
|
() => Array.from({ length: count }, (_, i) => estimateHeight(i))
|
|
6871
6938
|
);
|
|
6872
6939
|
useEffect21(() => {
|
|
@@ -6877,11 +6944,11 @@ function useWindowedSections(opts) {
|
|
|
6877
6944
|
}, [count]);
|
|
6878
6945
|
const heightsRef = useRef18(heights);
|
|
6879
6946
|
heightsRef.current = heights;
|
|
6880
|
-
const [range, setRange] =
|
|
6947
|
+
const [range, setRange] = useState18(() => ({
|
|
6881
6948
|
start: 0,
|
|
6882
6949
|
end: Math.min(count, overscan + 1)
|
|
6883
6950
|
}));
|
|
6884
|
-
const recompute =
|
|
6951
|
+
const recompute = useCallback20(() => {
|
|
6885
6952
|
const el = scrollRef.current;
|
|
6886
6953
|
if (!el) return;
|
|
6887
6954
|
const next = computeWindowRange(heightsRef.current, el.scrollTop, el.clientHeight, overscan);
|
|
@@ -6908,7 +6975,7 @@ function useWindowedSections(opts) {
|
|
|
6908
6975
|
if (raf && typeof cancelAnimationFrame === "function") cancelAnimationFrame(raf);
|
|
6909
6976
|
};
|
|
6910
6977
|
}, [recompute, count]);
|
|
6911
|
-
const measure =
|
|
6978
|
+
const measure = useCallback20((index, height) => {
|
|
6912
6979
|
if (height <= 0) return;
|
|
6913
6980
|
setHeights((prev) => {
|
|
6914
6981
|
if (Math.abs((prev[index] ?? 0) - height) < 1) return prev;
|
|
@@ -6926,7 +6993,7 @@ function useWindowedSections(opts) {
|
|
|
6926
6993
|
useEffect21(() => {
|
|
6927
6994
|
recompute();
|
|
6928
6995
|
}, [offsets, recompute]);
|
|
6929
|
-
const scrollToIndex =
|
|
6996
|
+
const scrollToIndex = useCallback20(
|
|
6930
6997
|
(index) => {
|
|
6931
6998
|
const el = scrollRef.current;
|
|
6932
6999
|
if (!el) return;
|
|
@@ -7034,11 +7101,11 @@ function WorkbenchChanges({
|
|
|
7034
7101
|
className
|
|
7035
7102
|
}) {
|
|
7036
7103
|
const rootRef = useRef19(null);
|
|
7037
|
-
const [compact, setCompact] =
|
|
7038
|
-
const [coarsePointer, setCoarsePointer] =
|
|
7104
|
+
const [compact, setCompact] = useState19(false);
|
|
7105
|
+
const [coarsePointer, setCoarsePointer] = useState19(false);
|
|
7039
7106
|
const resolvedTheme = useThemeType(themeType);
|
|
7040
|
-
const [layout, setLayout] =
|
|
7041
|
-
const [activePath, setActivePath] =
|
|
7107
|
+
const [layout, setLayout] = useState19("unified");
|
|
7108
|
+
const [activePath, setActivePath] = useState19(null);
|
|
7042
7109
|
const pickerId = useId4();
|
|
7043
7110
|
const unicodeFontPaths = useMemo10(
|
|
7044
7111
|
() => diff.flatMap((file) => file.oldPath ? [file.path, file.oldPath] : [file.path]),
|
|
@@ -7077,7 +7144,7 @@ function WorkbenchChanges({
|
|
|
7077
7144
|
}, []);
|
|
7078
7145
|
const additions = useMemo10(() => diff.reduce((sum, f) => sum + f.additions, 0), [diff]);
|
|
7079
7146
|
const deletions = useMemo10(() => diff.reduce((sum, f) => sum + f.deletions, 0), [diff]);
|
|
7080
|
-
const estimateHeight =
|
|
7147
|
+
const estimateHeight = useCallback21(
|
|
7081
7148
|
(index) => {
|
|
7082
7149
|
const file = orderedFiles[index];
|
|
7083
7150
|
return file ? estimateSectionHeight(file) : HEADER_PX + LINE_PX;
|
|
@@ -7089,14 +7156,14 @@ function WorkbenchChanges({
|
|
|
7089
7156
|
estimateHeight,
|
|
7090
7157
|
overscan: OVERSCAN
|
|
7091
7158
|
});
|
|
7092
|
-
const jumpTo =
|
|
7159
|
+
const jumpTo = useCallback21(
|
|
7093
7160
|
(index) => {
|
|
7094
7161
|
setActivePath(orderedFiles[index]?.path ?? null);
|
|
7095
7162
|
windowed.scrollToIndex(index);
|
|
7096
7163
|
},
|
|
7097
7164
|
[orderedFiles, windowed]
|
|
7098
7165
|
);
|
|
7099
|
-
const onPaneScroll =
|
|
7166
|
+
const onPaneScroll = useCallback21(() => {
|
|
7100
7167
|
const el = windowed.scrollRef.current;
|
|
7101
7168
|
if (!el) {
|
|
7102
7169
|
return;
|
|
@@ -7520,12 +7587,12 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
7520
7587
|
const workspaceDataEnabled = changesEnabled || filesEnabled;
|
|
7521
7588
|
const anySurfaceEnabled = workspaceDataEnabled || terminalEnabled || desktopEnabled;
|
|
7522
7589
|
const surfaceIdentity = WORKBENCH_SURFACES.filter((surface) => surfaceSet.has(surface)).join(",");
|
|
7523
|
-
const [storedWarmIntents, setStoredWarmIntents] =
|
|
7590
|
+
const [storedWarmIntents, setStoredWarmIntents] = useState20(
|
|
7524
7591
|
() => emptyWarmIntents(sessionId)
|
|
7525
7592
|
);
|
|
7526
7593
|
const warmIntents = storedWarmIntents.sessionId === sessionId ? storedWarmIntents : emptyWarmIntents(sessionId);
|
|
7527
7594
|
const { watchDesktop, warmTerminal, warmFiles } = warmIntents;
|
|
7528
|
-
const requestWarmIntent =
|
|
7595
|
+
const requestWarmIntent = useCallback22(
|
|
7529
7596
|
(intent) => {
|
|
7530
7597
|
setStoredWarmIntents((previous) => {
|
|
7531
7598
|
const current = previous.sessionId === sessionId ? previous : emptyWarmIntents(sessionId);
|
|
@@ -7631,7 +7698,7 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
7631
7698
|
liveness,
|
|
7632
7699
|
capture: captureState.capture
|
|
7633
7700
|
});
|
|
7634
|
-
const [xtermTheme, setXtermTheme] =
|
|
7701
|
+
const [xtermTheme, setXtermTheme] = useState20(void 0);
|
|
7635
7702
|
useEffect23(() => {
|
|
7636
7703
|
if (!terminalEnabled || typeof document === "undefined") return;
|
|
7637
7704
|
const derive = () => setXtermTheme(xtermThemeFromTokens());
|
|
@@ -7867,10 +7934,10 @@ function SandboxWorkspace(props) {
|
|
|
7867
7934
|
maxSize,
|
|
7868
7935
|
className
|
|
7869
7936
|
} = props;
|
|
7870
|
-
const [storedSelection, setStoredSelection] =
|
|
7871
|
-
const [requestedFile, setRequestedFile] =
|
|
7937
|
+
const [storedSelection, setStoredSelection] = useState20(null);
|
|
7938
|
+
const [requestedFile, setRequestedFile] = useState20(null);
|
|
7872
7939
|
const nextFileRequestId = useRef20(0);
|
|
7873
|
-
const openFile =
|
|
7940
|
+
const openFile = useCallback22(
|
|
7874
7941
|
(path) => {
|
|
7875
7942
|
nextFileRequestId.current += 1;
|
|
7876
7943
|
setRequestedFile({ sessionId, path, requestId: nextFileRequestId.current });
|
|
@@ -7898,7 +7965,7 @@ function SandboxWorkspace(props) {
|
|
|
7898
7965
|
const selectedTab = storedSelection?.sessionId === sessionId ? storedSelection.tab : null;
|
|
7899
7966
|
const preferredTab = selectedTab ?? defaultTab;
|
|
7900
7967
|
const activeTab = preferredTab && tabs.some((tab) => tab.id === preferredTab) ? preferredTab : tabs[0]?.id;
|
|
7901
|
-
const selectTab =
|
|
7968
|
+
const selectTab = useCallback22(
|
|
7902
7969
|
(tab) => setStoredSelection({ sessionId, tab }),
|
|
7903
7970
|
[sessionId]
|
|
7904
7971
|
);
|
|
@@ -8199,7 +8266,7 @@ function CenteredState({
|
|
|
8199
8266
|
}
|
|
8200
8267
|
|
|
8201
8268
|
// src/hooks/use-codex-accounts.ts
|
|
8202
|
-
import { useCallback as
|
|
8269
|
+
import { useCallback as useCallback23, useState as useState21 } from "react";
|
|
8203
8270
|
function isCodexAccountEvent(event) {
|
|
8204
8271
|
return event.type === "codex.account.switched" || event.type === "turn.started";
|
|
8205
8272
|
}
|
|
@@ -8220,7 +8287,7 @@ function useCodexAccounts(options = {}) {
|
|
|
8220
8287
|
const codexClient = options.codexClient ?? client;
|
|
8221
8288
|
const sessionId = options.sessionId;
|
|
8222
8289
|
const sharedEvents = options.events;
|
|
8223
|
-
const load =
|
|
8290
|
+
const load = useCallback23(async () => {
|
|
8224
8291
|
const accountsP = codexClient.listCodexAccounts(workspaceId);
|
|
8225
8292
|
const sessionP = sessionId && codexClient.getSession ? codexClient.getSession(workspaceId, sessionId).catch(() => null) : Promise.resolve(null);
|
|
8226
8293
|
const [acc, session] = await Promise.all([accountsP, sessionP]);
|
|
@@ -8242,7 +8309,7 @@ function useCodexAccounts(options = {}) {
|
|
|
8242
8309
|
});
|
|
8243
8310
|
const { run: runMutation, mutating: pinning, mutationError } = useMutationRunner();
|
|
8244
8311
|
const { run: runUsageMutation, mutating: refreshingUsage } = useMutationRunner();
|
|
8245
|
-
const [pinningTarget, setPinningTarget] =
|
|
8312
|
+
const [pinningTarget, setPinningTarget] = useState21(null);
|
|
8246
8313
|
useSessionEventTrigger(
|
|
8247
8314
|
client,
|
|
8248
8315
|
workspaceId,
|
|
@@ -8254,7 +8321,7 @@ function useCodexAccounts(options = {}) {
|
|
|
8254
8321
|
...sharedEvents !== void 0 ? { events: sharedEvents } : {}
|
|
8255
8322
|
}
|
|
8256
8323
|
);
|
|
8257
|
-
const pin =
|
|
8324
|
+
const pin = useCallback23(
|
|
8258
8325
|
async (target) => {
|
|
8259
8326
|
if (!sessionId || !codexClient.pinSessionCodexAccount) {
|
|
8260
8327
|
return false;
|
|
@@ -8270,7 +8337,7 @@ function useCodexAccounts(options = {}) {
|
|
|
8270
8337
|
},
|
|
8271
8338
|
[codexClient, workspaceId, sessionId, runMutation, refresh]
|
|
8272
8339
|
);
|
|
8273
|
-
const refreshUsage =
|
|
8340
|
+
const refreshUsage = useCallback23(async () => {
|
|
8274
8341
|
if (!codexClient.refreshCodexUsage) {
|
|
8275
8342
|
return false;
|
|
8276
8343
|
}
|
|
@@ -8306,6 +8373,7 @@ export {
|
|
|
8306
8373
|
ApprovalSurface,
|
|
8307
8374
|
BUILT_IN_TURN_SUMMARY_FACET_IDS,
|
|
8308
8375
|
BodyNote,
|
|
8376
|
+
COMPOSER_PAYMENT_REQUIRED_MESSAGE,
|
|
8309
8377
|
CONNECTION_STATUS_META,
|
|
8310
8378
|
CREDIT_EXHAUSTION_MESSAGE,
|
|
8311
8379
|
CapturedFileUnavailableError,
|
|
@@ -8315,6 +8383,8 @@ export {
|
|
|
8315
8383
|
ComposerTranscriptionControl,
|
|
8316
8384
|
ConnectionDot,
|
|
8317
8385
|
ConnectionStatusPill,
|
|
8386
|
+
CopyButton,
|
|
8387
|
+
CopyHoverFrame,
|
|
8318
8388
|
DesktopViewer,
|
|
8319
8389
|
DiffView,
|
|
8320
8390
|
DisclosureDefaultsProvider,
|
|
@@ -8361,12 +8431,17 @@ export {
|
|
|
8361
8431
|
SandboxTerminal,
|
|
8362
8432
|
SandboxWorkspace,
|
|
8363
8433
|
ScreenshotFigure,
|
|
8434
|
+
SessionChrome,
|
|
8364
8435
|
SessionStatus,
|
|
8365
8436
|
SharedMachineDisclosure,
|
|
8366
8437
|
StatusDot,
|
|
8367
8438
|
TermBlock,
|
|
8368
8439
|
Thumbnail,
|
|
8369
8440
|
TimelineRow,
|
|
8441
|
+
Tooltip,
|
|
8442
|
+
TooltipContent,
|
|
8443
|
+
TooltipProvider,
|
|
8444
|
+
TooltipTrigger,
|
|
8370
8445
|
TurnSummary,
|
|
8371
8446
|
WINDOW_LABEL,
|
|
8372
8447
|
WORKBENCH_SURFACES,
|
|
@@ -8375,35 +8450,46 @@ export {
|
|
|
8375
8450
|
WORKBENCH_TAB_FILES,
|
|
8376
8451
|
WORKBENCH_TAB_TERMINAL,
|
|
8377
8452
|
WorkspaceDock,
|
|
8453
|
+
advancedSourceSummary,
|
|
8378
8454
|
answersFromDrafts,
|
|
8379
8455
|
appendFinalTranscript,
|
|
8380
8456
|
applyPatchOps,
|
|
8381
8457
|
approvalsFromRequiresAction,
|
|
8382
8458
|
argHint,
|
|
8459
|
+
availabilityReasonLabel,
|
|
8460
|
+
billingClassForModel,
|
|
8461
|
+
billingClassLabel,
|
|
8383
8462
|
boundBrowserSessionEventWindow,
|
|
8384
8463
|
buildTimeline,
|
|
8385
8464
|
cn,
|
|
8465
|
+
coerceReasoningEffortForModel,
|
|
8386
8466
|
composeSendInput,
|
|
8467
|
+
composerSubmissionErrorMessage,
|
|
8387
8468
|
connectionStatusForState,
|
|
8388
8469
|
controlCaret,
|
|
8470
|
+
copyTextToClipboard,
|
|
8389
8471
|
createDefaultToolRegistry,
|
|
8390
8472
|
createToolRegistry,
|
|
8391
8473
|
creditExhaustedFromEvents,
|
|
8392
8474
|
defaultApprovalSurfaceMessages,
|
|
8393
8475
|
defaultChatComposerMessages,
|
|
8394
8476
|
defaultCommands,
|
|
8477
|
+
defaultEffortForModel,
|
|
8395
8478
|
defaultHumanInputFormMessages,
|
|
8396
8479
|
defaultToolRegistry,
|
|
8397
8480
|
deriveHealth,
|
|
8398
8481
|
deriveMachineChip,
|
|
8482
|
+
effortOptionsForModel,
|
|
8399
8483
|
execTruncated,
|
|
8400
8484
|
extractSessionRef,
|
|
8401
8485
|
filterCommands,
|
|
8486
|
+
findPickerRow,
|
|
8402
8487
|
firstMissingRequiredArg,
|
|
8403
8488
|
formatAsOf,
|
|
8404
8489
|
formatBytes,
|
|
8405
8490
|
formatRelativeTime,
|
|
8406
8491
|
gitFileDiffToPatch,
|
|
8492
|
+
groupPickerRowsByBillingClass,
|
|
8407
8493
|
groupTimeline,
|
|
8408
8494
|
hasPermission,
|
|
8409
8495
|
healthPulses,
|
|
@@ -8416,28 +8502,36 @@ export {
|
|
|
8416
8502
|
isExecSessionLostBanner,
|
|
8417
8503
|
isGoalEvent,
|
|
8418
8504
|
isHumanInputEvent,
|
|
8505
|
+
isLastStartedTurnPolicyEvent,
|
|
8419
8506
|
isLineageRefreshEvent,
|
|
8420
8507
|
isSessionMcpApprovalPolicyEvent,
|
|
8421
8508
|
isTitleEvent,
|
|
8422
8509
|
isTurnQueueEvent,
|
|
8510
|
+
labelLatencyMode,
|
|
8423
8511
|
languageForPath,
|
|
8424
8512
|
looksBinary,
|
|
8425
8513
|
matchCommand,
|
|
8426
8514
|
parseCommandLine,
|
|
8427
8515
|
parseExecBannerSessionId,
|
|
8428
8516
|
parseToolArgs,
|
|
8517
|
+
payerSummaryForModel,
|
|
8429
8518
|
pointsFor,
|
|
8430
8519
|
projectPendingApprovals,
|
|
8431
8520
|
projectPendingHumanInputRequests,
|
|
8521
|
+
projectPickerRows,
|
|
8432
8522
|
rawTypeOf,
|
|
8433
8523
|
redactSecrets,
|
|
8524
|
+
runnableLatencyModesForModel,
|
|
8434
8525
|
sandboxCommandExitCode,
|
|
8526
|
+
sessionChromeGoalPillState,
|
|
8435
8527
|
sessionDisplayTitle,
|
|
8436
8528
|
sessionStatusFromEvents,
|
|
8437
8529
|
shouldSteerOnKey,
|
|
8438
8530
|
shouldSubmitOnKey,
|
|
8531
|
+
sortPickerRows,
|
|
8439
8532
|
stringifyPayload,
|
|
8440
8533
|
stripExecBanner,
|
|
8534
|
+
tableElementToTsv,
|
|
8441
8535
|
tailPeek,
|
|
8442
8536
|
toolDisplayName,
|
|
8443
8537
|
transitionTranscriptionControl,
|
|
@@ -8453,6 +8547,7 @@ export {
|
|
|
8453
8547
|
useFileAttachments,
|
|
8454
8548
|
useGoal,
|
|
8455
8549
|
useHumanInputRequests,
|
|
8550
|
+
useLastStartedTurnPolicy,
|
|
8456
8551
|
useLightbox,
|
|
8457
8552
|
useLightboxOptional,
|
|
8458
8553
|
useMachineChip,
|
|
@@ -8481,8 +8576,10 @@ export {
|
|
|
8481
8576
|
useTranscription,
|
|
8482
8577
|
useTurnQueue,
|
|
8483
8578
|
useVariableSets,
|
|
8579
|
+
useVoiceInput,
|
|
8484
8580
|
useWorkspaceCapture,
|
|
8485
8581
|
useWorkspaceEdit,
|
|
8582
|
+
useWorkspaceModelCatalog,
|
|
8486
8583
|
useWorkspaceSessions,
|
|
8487
8584
|
useWorkspaces,
|
|
8488
8585
|
v4aToGitFileDiff,
|