@opengeni/react 4.0.2 → 5.0.4-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -0
- package/dist/artifacts.js +24 -285
- package/dist/artifacts.js.map +1 -1
- package/dist/chunk-BRFMGY4L.js +274 -0
- package/dist/chunk-BRFMGY4L.js.map +1 -0
- package/dist/chunk-IWIDV7SB.js +1 -0
- package/dist/chunk-IWIDV7SB.js.map +1 -0
- package/dist/{chunk-CQG7YUJB.js → chunk-SCZ6SUBW.js} +1177 -1021
- package/dist/chunk-SCZ6SUBW.js.map +1 -0
- package/dist/clipboard.js +1 -0
- package/dist/components/markdown-table-layout.d.ts +4 -1
- package/dist/components/message-timeline.d.ts +7 -3
- package/dist/connect-accounts.d.ts +10 -0
- package/dist/connect-chooser.d.ts +11 -0
- package/dist/connect-panel.d.ts +10 -0
- package/dist/connect-setup.d.ts +12 -0
- package/dist/connect.d.ts +30 -0
- package/dist/connect.js +831 -0
- package/dist/connect.js.map +1 -0
- package/dist/device-authorization.d.ts +15 -0
- package/dist/identity-link-accounts.d.ts +11 -0
- package/dist/identity-link-consent.d.ts +18 -0
- package/dist/index.js +523 -663
- package/dist/index.js.map +1 -1
- package/dist/{markdown-table-layout-3Z3AWBY7.js → markdown-table-layout-PFUEZ2U4.js} +7 -4
- package/dist/{markdown-table-layout-3Z3AWBY7.js.map → markdown-table-layout-PFUEZ2U4.js.map} +1 -1
- package/dist/session-ui.d.ts +2 -0
- package/dist/session-ui.js +3 -1
- package/dist/sites-ui.d.ts +33 -0
- package/dist/sites.d.ts +3 -0
- package/dist/sites.js +288 -0
- package/dist/sites.js.map +1 -0
- package/package.json +16 -2
- package/src/components/markdown-table-layout.ts +6 -3
- package/src/components/markdown.tsx +11 -3
- package/src/components/message-timeline.tsx +22 -5
- package/src/components/sandbox-workspace.tsx +9 -2
- package/src/connect-accounts.tsx +171 -0
- package/src/connect-chooser.tsx +144 -0
- package/src/connect-panel.tsx +29 -0
- package/src/connect-setup.tsx +260 -0
- package/src/connect.ts +48 -0
- package/src/device-authorization.tsx +90 -0
- package/src/hooks/use-workspace-capture.ts +3 -2
- package/src/identity-link-accounts.tsx +144 -0
- package/src/identity-link-consent.tsx +192 -0
- package/src/session-ui.ts +2 -0
- package/src/sites-ui.tsx +385 -0
- package/src/sites.ts +3 -0
- package/src/timeline/tool-renderers.tsx +1 -1
- package/styles/connect.css +48 -0
- package/styles/connect.d.ts +1 -0
- package/dist/chunk-CQG7YUJB.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -48,6 +48,7 @@ import {
|
|
|
48
48
|
import {
|
|
49
49
|
ActivityDisclosure,
|
|
50
50
|
ActivityRail,
|
|
51
|
+
ApprovalSurface,
|
|
51
52
|
BUILT_IN_TURN_SUMMARY_FACET_IDS,
|
|
52
53
|
BodyNote,
|
|
53
54
|
ChatComposer,
|
|
@@ -82,6 +83,7 @@ import {
|
|
|
82
83
|
controlCaret,
|
|
83
84
|
createDefaultToolRegistry,
|
|
84
85
|
createToolRegistry,
|
|
86
|
+
defaultApprovalSurfaceMessages,
|
|
85
87
|
defaultHumanInputFormMessages,
|
|
86
88
|
defaultToolRegistry,
|
|
87
89
|
execTruncated,
|
|
@@ -108,7 +110,7 @@ import {
|
|
|
108
110
|
useWorkspaceModelCatalog,
|
|
109
111
|
userMessageLikelyNeedsDisclosure,
|
|
110
112
|
v4aToGitFileDiff
|
|
111
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-SCZ6SUBW.js";
|
|
112
114
|
import "./chunk-YBM6CQRU.js";
|
|
113
115
|
import "./chunk-5M6VTFJ5.js";
|
|
114
116
|
import "./chunk-ZYRGEKWS.js";
|
|
@@ -3844,151 +3846,9 @@ function useMachineChip(input) {
|
|
|
3844
3846
|
);
|
|
3845
3847
|
}
|
|
3846
3848
|
|
|
3847
|
-
// src/components/approval-surface.tsx
|
|
3848
|
-
import { CheckIcon, ShieldCheckIcon, XIcon } from "lucide-react";
|
|
3849
|
-
import { useEffect as useEffect11, useId, useRef as useRef10, useState as useState8 } from "react";
|
|
3850
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3851
|
-
var defaultApprovalSurfaceMessages = {
|
|
3852
|
-
title: "Approval required",
|
|
3853
|
-
description: "Review the requested action before the agent continues.",
|
|
3854
|
-
approve: "Approve",
|
|
3855
|
-
reject: "Reject",
|
|
3856
|
-
approving: "Approving\u2026",
|
|
3857
|
-
rejecting: "Rejecting\u2026",
|
|
3858
|
-
formatToolName: (name) => name.replaceAll("_", " ").replaceAll(".", " \u203A ")
|
|
3859
|
-
};
|
|
3860
|
-
var APPROVAL_ARGUMENT_PREVIEW_CHARACTERS = 4e3;
|
|
3861
|
-
function approvalArgumentsPreview(value) {
|
|
3862
|
-
if (value === void 0) return null;
|
|
3863
|
-
let serialized;
|
|
3864
|
-
try {
|
|
3865
|
-
serialized = typeof value === "string" ? value : JSON.stringify(value, null, 2) ?? String(value);
|
|
3866
|
-
} catch {
|
|
3867
|
-
serialized = "[Arguments unavailable]";
|
|
3868
|
-
}
|
|
3869
|
-
const characters = Array.from(serialized);
|
|
3870
|
-
if (characters.length <= APPROVAL_ARGUMENT_PREVIEW_CHARACTERS) return serialized;
|
|
3871
|
-
return `${characters.slice(0, APPROVAL_ARGUMENT_PREVIEW_CHARACTERS).join("")}
|
|
3872
|
-
\u2026 ${characters.length - APPROVAL_ARGUMENT_PREVIEW_CHARACTERS} characters omitted`;
|
|
3873
|
-
}
|
|
3874
|
-
function approvalOwnershipKey(approval) {
|
|
3875
|
-
return `${approval.id}\0${approval.name}\0${approvalArgumentsPreview(approval.arguments) ?? ""}`;
|
|
3876
|
-
}
|
|
3877
|
-
function ApprovalSurface({
|
|
3878
|
-
approvals,
|
|
3879
|
-
onApprove,
|
|
3880
|
-
onReject,
|
|
3881
|
-
responding = false,
|
|
3882
|
-
error,
|
|
3883
|
-
messages: overrides,
|
|
3884
|
-
renderApproval,
|
|
3885
|
-
className
|
|
3886
|
-
}) {
|
|
3887
|
-
const titleId = useId();
|
|
3888
|
-
const messages = { ...defaultApprovalSurfaceMessages, ...overrides };
|
|
3889
|
-
const [pending, setPending] = useState8(null);
|
|
3890
|
-
const pendingRef = useRef10(null);
|
|
3891
|
-
const [decisionError, setDecisionError] = useState8(null);
|
|
3892
|
-
useEffect11(() => {
|
|
3893
|
-
if (pending && !approvals.some((approval) => approvalOwnershipKey(approval) === pending.approvalKey)) {
|
|
3894
|
-
if (pendingRef.current?.token === pending.token) {
|
|
3895
|
-
pendingRef.current = null;
|
|
3896
|
-
}
|
|
3897
|
-
setPending((current) => current?.token === pending.token ? null : current);
|
|
3898
|
-
}
|
|
3899
|
-
}, [approvals, pending]);
|
|
3900
|
-
if (approvals.length === 0) return null;
|
|
3901
|
-
const busy = responding || pendingRef.current !== null;
|
|
3902
|
-
const decide = async (approval, decision) => {
|
|
3903
|
-
if (responding || pendingRef.current !== null) return;
|
|
3904
|
-
const approvalKey = approvalOwnershipKey(approval);
|
|
3905
|
-
const token = Symbol(approvalKey);
|
|
3906
|
-
pendingRef.current = { approvalKey, token };
|
|
3907
|
-
setPending({ approvalKey, decision, token });
|
|
3908
|
-
setDecisionError(null);
|
|
3909
|
-
try {
|
|
3910
|
-
await (decision === "approve" ? onApprove(approval) : onReject(approval));
|
|
3911
|
-
} catch (cause) {
|
|
3912
|
-
if (pendingRef.current?.token === token) {
|
|
3913
|
-
pendingRef.current = null;
|
|
3914
|
-
setPending((current) => current?.token === token ? null : current);
|
|
3915
|
-
setDecisionError(cause instanceof Error ? cause : new Error(String(cause)));
|
|
3916
|
-
}
|
|
3917
|
-
}
|
|
3918
|
-
};
|
|
3919
|
-
const errorMessage = decisionError?.message ?? (error instanceof Error ? error.message : error);
|
|
3920
|
-
return /* @__PURE__ */ jsxs(
|
|
3921
|
-
"section",
|
|
3922
|
-
{
|
|
3923
|
-
className: cn(
|
|
3924
|
-
"og-root flex w-full flex-col gap-3 rounded-og-lg border border-og-status-waiting/35 bg-og-status-waiting/5 p-4 shadow-og-sm",
|
|
3925
|
-
className
|
|
3926
|
-
),
|
|
3927
|
-
"aria-labelledby": titleId,
|
|
3928
|
-
children: [
|
|
3929
|
-
/* @__PURE__ */ jsxs("header", { className: "flex items-start gap-3", children: [
|
|
3930
|
-
/* @__PURE__ */ jsx("span", { className: "mt-0.5 inline-flex size-8 shrink-0 items-center justify-center rounded-og-md bg-og-status-waiting/12 text-og-status-waiting", children: /* @__PURE__ */ jsx(ShieldCheckIcon, { "aria-hidden": "true", className: "size-4" }) }),
|
|
3931
|
-
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
3932
|
-
/* @__PURE__ */ jsx("h2", { id: titleId, className: "text-og-md font-semibold text-og-fg", children: messages.title }),
|
|
3933
|
-
/* @__PURE__ */ jsx("p", { className: "mt-0.5 text-og-sm text-og-fg-muted", children: messages.description })
|
|
3934
|
-
] })
|
|
3935
|
-
] }),
|
|
3936
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: approvals.map((approval) => {
|
|
3937
|
-
const approvalKey = approvalOwnershipKey(approval);
|
|
3938
|
-
const active = pending?.approvalKey === approvalKey ? pending.decision : null;
|
|
3939
|
-
const argumentsPreview = approvalArgumentsPreview(approval.arguments);
|
|
3940
|
-
return /* @__PURE__ */ jsxs(
|
|
3941
|
-
"article",
|
|
3942
|
-
{
|
|
3943
|
-
"data-approval-id": approval.id,
|
|
3944
|
-
className: "rounded-og-md border border-og-border bg-og-surface-1 p-3",
|
|
3945
|
-
children: [
|
|
3946
|
-
renderApproval ? renderApproval(approval) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3947
|
-
/* @__PURE__ */ jsx("p", { className: "text-og-sm font-medium text-og-fg", children: messages.formatToolName(approval.name) }),
|
|
3948
|
-
argumentsPreview !== null ? /* @__PURE__ */ jsx("pre", { className: "mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-words rounded-og-sm bg-og-surface-2 p-2 font-mono text-og-xs text-og-fg-muted", children: argumentsPreview }) : null
|
|
3949
|
-
] }),
|
|
3950
|
-
/* @__PURE__ */ jsxs("div", { className: "mt-3 flex flex-wrap justify-end gap-2", children: [
|
|
3951
|
-
/* @__PURE__ */ jsxs(
|
|
3952
|
-
"button",
|
|
3953
|
-
{
|
|
3954
|
-
type: "button",
|
|
3955
|
-
disabled: busy,
|
|
3956
|
-
onClick: () => void decide(approval, "reject"),
|
|
3957
|
-
className: "inline-flex min-h-9 items-center gap-1.5 rounded-og-md border border-og-border px-3 py-1.5 text-og-sm font-medium text-og-fg-muted transition-colors hover:bg-og-surface-2 hover:text-og-fg disabled:opacity-50",
|
|
3958
|
-
children: [
|
|
3959
|
-
/* @__PURE__ */ jsx(XIcon, { "aria-hidden": "true", className: "size-3.5" }),
|
|
3960
|
-
active === "reject" ? messages.rejecting : messages.reject
|
|
3961
|
-
]
|
|
3962
|
-
}
|
|
3963
|
-
),
|
|
3964
|
-
/* @__PURE__ */ jsxs(
|
|
3965
|
-
"button",
|
|
3966
|
-
{
|
|
3967
|
-
type: "button",
|
|
3968
|
-
disabled: busy,
|
|
3969
|
-
onClick: () => void decide(approval, "approve"),
|
|
3970
|
-
className: "inline-flex min-h-9 items-center gap-1.5 rounded-og-md bg-og-accent px-3 py-1.5 text-og-sm font-medium text-og-accent-fg transition-colors hover:bg-og-accent-strong disabled:opacity-50",
|
|
3971
|
-
children: [
|
|
3972
|
-
/* @__PURE__ */ jsx(CheckIcon, { "aria-hidden": "true", className: "size-3.5" }),
|
|
3973
|
-
active === "approve" ? messages.approving : messages.approve
|
|
3974
|
-
]
|
|
3975
|
-
}
|
|
3976
|
-
)
|
|
3977
|
-
] })
|
|
3978
|
-
]
|
|
3979
|
-
},
|
|
3980
|
-
approval.id
|
|
3981
|
-
);
|
|
3982
|
-
}) }),
|
|
3983
|
-
errorMessage ? /* @__PURE__ */ jsx("p", { role: "alert", className: "text-og-sm text-og-status-failed", children: errorMessage }) : null
|
|
3984
|
-
]
|
|
3985
|
-
}
|
|
3986
|
-
);
|
|
3987
|
-
}
|
|
3988
|
-
|
|
3989
3849
|
// src/components/fleet-tile.tsx
|
|
3990
3850
|
import { deriveSessionDisplayTitle } from "@opengeni/sdk";
|
|
3991
|
-
import { jsx
|
|
3851
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3992
3852
|
var SESSION_METADATA_TITLE_KEYS = ["title", "name"];
|
|
3993
3853
|
function sessionDisplayTitle(session) {
|
|
3994
3854
|
return deriveSessionDisplayTitle(session, { metadataKeys: SESSION_METADATA_TITLE_KEYS });
|
|
@@ -3996,7 +3856,7 @@ function sessionDisplayTitle(session) {
|
|
|
3996
3856
|
function FleetTile({ session, title, subtitle, onOpen, className }) {
|
|
3997
3857
|
const running = session.status === "running" || session.status === "queued";
|
|
3998
3858
|
const needsYou = session.status === "requires_action";
|
|
3999
|
-
return /* @__PURE__ */
|
|
3859
|
+
return /* @__PURE__ */ jsxs(
|
|
4000
3860
|
"button",
|
|
4001
3861
|
{
|
|
4002
3862
|
type: "button",
|
|
@@ -4012,7 +3872,7 @@ function FleetTile({ session, title, subtitle, onOpen, className }) {
|
|
|
4012
3872
|
className
|
|
4013
3873
|
),
|
|
4014
3874
|
children: [
|
|
4015
|
-
/* @__PURE__ */
|
|
3875
|
+
/* @__PURE__ */ jsx(
|
|
4016
3876
|
"span",
|
|
4017
3877
|
{
|
|
4018
3878
|
"aria-hidden": true,
|
|
@@ -4022,16 +3882,16 @@ function FleetTile({ session, title, subtitle, onOpen, className }) {
|
|
|
4022
3882
|
)
|
|
4023
3883
|
}
|
|
4024
3884
|
),
|
|
4025
|
-
/* @__PURE__ */
|
|
4026
|
-
/* @__PURE__ */
|
|
4027
|
-
/* @__PURE__ */
|
|
3885
|
+
/* @__PURE__ */ jsxs("span", { className: "flex w-full items-start justify-between gap-3", children: [
|
|
3886
|
+
/* @__PURE__ */ jsx("span", { className: "line-clamp-2 min-w-0 text-og-base font-medium leading-snug text-og-fg", children: title ?? sessionDisplayTitle(session) }),
|
|
3887
|
+
/* @__PURE__ */ jsx(SessionStatus, { status: session.status, size: "sm", className: "mt-px" })
|
|
4028
3888
|
] }),
|
|
4029
|
-
subtitle ? /* @__PURE__ */
|
|
4030
|
-
/* @__PURE__ */
|
|
4031
|
-
/* @__PURE__ */
|
|
4032
|
-
/* @__PURE__ */
|
|
4033
|
-
/* @__PURE__ */
|
|
4034
|
-
/* @__PURE__ */
|
|
3889
|
+
subtitle ? /* @__PURE__ */ jsx("span", { className: "line-clamp-1 text-og-sm text-og-fg-muted", children: subtitle }) : null,
|
|
3890
|
+
/* @__PURE__ */ jsxs("span", { className: "mt-auto flex w-full items-center gap-2 text-og-xs text-og-fg-subtle", children: [
|
|
3891
|
+
/* @__PURE__ */ jsx("span", { className: "font-og-mono", children: session.id.slice(0, 8) }),
|
|
3892
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "\xB7" }),
|
|
3893
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: session.model }),
|
|
3894
|
+
/* @__PURE__ */ jsx("span", { className: "ml-auto shrink-0", title: session.updatedAt, children: formatRelativeTime(session.updatedAt) })
|
|
4035
3895
|
] })
|
|
4036
3896
|
]
|
|
4037
3897
|
}
|
|
@@ -4039,7 +3899,7 @@ function FleetTile({ session, title, subtitle, onOpen, className }) {
|
|
|
4039
3899
|
}
|
|
4040
3900
|
|
|
4041
3901
|
// src/components/sandbox-terminal.tsx
|
|
4042
|
-
import { useEffect as
|
|
3902
|
+
import { useEffect as useEffect11, useLayoutEffect, useRef as useRef10, useState as useState8 } from "react";
|
|
4043
3903
|
|
|
4044
3904
|
// src/lib/xterm-theme.ts
|
|
4045
3905
|
var DARK_ANSI = {
|
|
@@ -4192,7 +4052,7 @@ async function attachRenderer(prefer, loaders, onTier) {
|
|
|
4192
4052
|
}
|
|
4193
4053
|
|
|
4194
4054
|
// src/components/sandbox-terminal.tsx
|
|
4195
|
-
import { jsx as
|
|
4055
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
4196
4056
|
function terminalSurfaceState(input) {
|
|
4197
4057
|
if (!input.ready) return "loading";
|
|
4198
4058
|
if (input.acceptsInput) return "interactive";
|
|
@@ -4234,16 +4094,16 @@ function SandboxTerminal({
|
|
|
4234
4094
|
onReconnectNeeded,
|
|
4235
4095
|
className
|
|
4236
4096
|
}) {
|
|
4237
|
-
const containerRef =
|
|
4238
|
-
const termRef =
|
|
4239
|
-
const fitRef =
|
|
4240
|
-
const rendererRef =
|
|
4241
|
-
const writtenRef =
|
|
4242
|
-
const wroteFirehoseRef =
|
|
4243
|
-
const bootActiveRef =
|
|
4244
|
-
const [ready, setReady] =
|
|
4245
|
-
const [inputReady, setInputReady] =
|
|
4246
|
-
const [activated, setActivated] =
|
|
4097
|
+
const containerRef = useRef10(null);
|
|
4098
|
+
const termRef = useRef10(null);
|
|
4099
|
+
const fitRef = useRef10(null);
|
|
4100
|
+
const rendererRef = useRef10(null);
|
|
4101
|
+
const writtenRef = useRef10(/* @__PURE__ */ new Set());
|
|
4102
|
+
const wroteFirehoseRef = useRef10(false);
|
|
4103
|
+
const bootActiveRef = useRef10(false);
|
|
4104
|
+
const [ready, setReady] = useState8(false);
|
|
4105
|
+
const [inputReady, setInputReady] = useState8(false);
|
|
4106
|
+
const [activated, setActivated] = useState8(false);
|
|
4247
4107
|
const ptyDescriptor = terminalCapability?.transport === "pty-ws" || terminalCapability?.transport === "relay-pty";
|
|
4248
4108
|
const ptyAttachable = terminalCanAcquirePty(terminalCapability);
|
|
4249
4109
|
const {
|
|
@@ -4296,7 +4156,7 @@ function SandboxTerminal({
|
|
|
4296
4156
|
if (!activated) setActivated(true);
|
|
4297
4157
|
onActivate?.();
|
|
4298
4158
|
}
|
|
4299
|
-
|
|
4159
|
+
useEffect11(() => {
|
|
4300
4160
|
if (typeof window === "undefined") return;
|
|
4301
4161
|
const el = containerRef.current;
|
|
4302
4162
|
if (!el) return;
|
|
@@ -4410,13 +4270,13 @@ function SandboxTerminal({
|
|
|
4410
4270
|
term.options.disableStdin = !interactive;
|
|
4411
4271
|
term.options.cursorBlink = interactive;
|
|
4412
4272
|
}, [ready, interactive]);
|
|
4413
|
-
|
|
4273
|
+
useEffect11(() => {
|
|
4414
4274
|
const term = termRef.current;
|
|
4415
4275
|
if (!ready || !term) return;
|
|
4416
4276
|
const next = theme ?? xtermThemeFromTokens(containerRef.current);
|
|
4417
4277
|
if (next) term.options.theme = next;
|
|
4418
4278
|
}, [ready, theme]);
|
|
4419
|
-
|
|
4279
|
+
useEffect11(() => {
|
|
4420
4280
|
const term = termRef.current;
|
|
4421
4281
|
if (!ready || !term) return;
|
|
4422
4282
|
if (!booting) {
|
|
@@ -4437,7 +4297,7 @@ function SandboxTerminal({
|
|
|
4437
4297
|
const id = setInterval(paint, 1e3);
|
|
4438
4298
|
return () => clearInterval(id);
|
|
4439
4299
|
}, [ready, booting]);
|
|
4440
|
-
|
|
4300
|
+
useEffect11(() => {
|
|
4441
4301
|
const term = termRef.current;
|
|
4442
4302
|
if (!ready || !term || ptyMode) return;
|
|
4443
4303
|
for (const chunk of result.chunks) {
|
|
@@ -4462,14 +4322,14 @@ function SandboxTerminal({
|
|
|
4462
4322
|
setInputReady(sub !== null);
|
|
4463
4323
|
return () => sub?.dispose();
|
|
4464
4324
|
}, [ready, interactive, ptyAttachable, ptyWrite, result.write]);
|
|
4465
|
-
|
|
4325
|
+
useEffect11(() => {
|
|
4466
4326
|
const term = termRef.current;
|
|
4467
4327
|
if (!ready || !term || !ptyMode) return;
|
|
4468
4328
|
resizePty(term.cols, term.rows);
|
|
4469
4329
|
const sub = term.onResize(({ cols, rows }) => resizePty(cols, rows));
|
|
4470
4330
|
return () => sub.dispose();
|
|
4471
4331
|
}, [ready, ptyMode, ptyConnected, resizePty]);
|
|
4472
|
-
|
|
4332
|
+
useEffect11(() => {
|
|
4473
4333
|
if (typeof window === "undefined") return;
|
|
4474
4334
|
const refit = () => {
|
|
4475
4335
|
try {
|
|
@@ -4489,10 +4349,10 @@ function SandboxTerminal({
|
|
|
4489
4349
|
observer?.disconnect();
|
|
4490
4350
|
};
|
|
4491
4351
|
}, [ready]);
|
|
4492
|
-
return /* @__PURE__ */
|
|
4493
|
-
showHeader && /* @__PURE__ */
|
|
4494
|
-
/* @__PURE__ */
|
|
4495
|
-
/* @__PURE__ */
|
|
4352
|
+
return /* @__PURE__ */ jsxs2("div", { className: cn("relative flex h-full w-full flex-col overflow-hidden", className), children: [
|
|
4353
|
+
showHeader && /* @__PURE__ */ jsxs2("div", { className: "flex shrink-0 items-center justify-between gap-2 border-b border-og-border px-2 py-1 text-og-xs text-og-fg-subtle", children: [
|
|
4354
|
+
/* @__PURE__ */ jsxs2("span", { className: "flex min-w-0 items-center gap-1.5", children: [
|
|
4355
|
+
/* @__PURE__ */ jsx2(
|
|
4496
4356
|
"span",
|
|
4497
4357
|
{
|
|
4498
4358
|
className: cn(
|
|
@@ -4501,13 +4361,13 @@ function SandboxTerminal({
|
|
|
4501
4361
|
)
|
|
4502
4362
|
}
|
|
4503
4363
|
),
|
|
4504
|
-
/* @__PURE__ */
|
|
4364
|
+
/* @__PURE__ */ jsxs2("span", { className: "truncate font-og-mono", children: [
|
|
4505
4365
|
"pty: ",
|
|
4506
4366
|
shell ?? "shell"
|
|
4507
4367
|
] })
|
|
4508
4368
|
] }),
|
|
4509
|
-
/* @__PURE__ */
|
|
4510
|
-
terminalModeLabel && /* @__PURE__ */
|
|
4369
|
+
/* @__PURE__ */ jsxs2("span", { className: "flex shrink-0 items-center gap-2", children: [
|
|
4370
|
+
terminalModeLabel && /* @__PURE__ */ jsx2(
|
|
4511
4371
|
"span",
|
|
4512
4372
|
{
|
|
4513
4373
|
className: "rounded-og-sm bg-og-surface-2 px-1.5 py-0.5 text-og-xs uppercase tracking-wide",
|
|
@@ -4515,7 +4375,7 @@ function SandboxTerminal({
|
|
|
4515
4375
|
children: terminalModeLabel
|
|
4516
4376
|
}
|
|
4517
4377
|
),
|
|
4518
|
-
/* @__PURE__ */
|
|
4378
|
+
/* @__PURE__ */ jsx2(
|
|
4519
4379
|
"button",
|
|
4520
4380
|
{
|
|
4521
4381
|
type: "button",
|
|
@@ -4530,15 +4390,15 @@ function SandboxTerminal({
|
|
|
4530
4390
|
)
|
|
4531
4391
|
] })
|
|
4532
4392
|
] }),
|
|
4533
|
-
/* @__PURE__ */
|
|
4393
|
+
/* @__PURE__ */ jsxs2(
|
|
4534
4394
|
"div",
|
|
4535
4395
|
{
|
|
4536
4396
|
className: "relative min-h-0 flex-1 bg-og-bg p-3",
|
|
4537
4397
|
onPointerDownCapture: handleActivate,
|
|
4538
4398
|
onFocusCapture: handleActivate,
|
|
4539
4399
|
children: [
|
|
4540
|
-
!ready && (placeholder ?? /* @__PURE__ */
|
|
4541
|
-
/* @__PURE__ */
|
|
4400
|
+
!ready && (placeholder ?? /* @__PURE__ */ jsx2(TerminalPlaceholder, {})),
|
|
4401
|
+
/* @__PURE__ */ jsx2(
|
|
4542
4402
|
"div",
|
|
4543
4403
|
{
|
|
4544
4404
|
ref: containerRef,
|
|
@@ -4598,7 +4458,7 @@ function ensureXtermBaseCss() {
|
|
|
4598
4458
|
document.head.appendChild(style);
|
|
4599
4459
|
}
|
|
4600
4460
|
function TerminalPlaceholder() {
|
|
4601
|
-
return /* @__PURE__ */
|
|
4461
|
+
return /* @__PURE__ */ jsx2("div", { className: "absolute inset-0 flex items-center justify-center text-og-sm text-og-fg-subtle", children: "Loading terminal\u2026" });
|
|
4602
4462
|
}
|
|
4603
4463
|
|
|
4604
4464
|
// src/components/file-browser.tsx
|
|
@@ -4615,23 +4475,23 @@ import {
|
|
|
4615
4475
|
} from "lucide-react";
|
|
4616
4476
|
import {
|
|
4617
4477
|
useCallback as useCallback18,
|
|
4618
|
-
useEffect as
|
|
4619
|
-
useId
|
|
4478
|
+
useEffect as useEffect13,
|
|
4479
|
+
useId,
|
|
4620
4480
|
useLayoutEffect as useLayoutEffect2,
|
|
4621
4481
|
useMemo as useMemo11,
|
|
4622
|
-
useRef as
|
|
4623
|
-
useState as
|
|
4482
|
+
useRef as useRef11,
|
|
4483
|
+
useState as useState9
|
|
4624
4484
|
} from "react";
|
|
4625
4485
|
import { AlertDialog } from "radix-ui";
|
|
4626
4486
|
import { VList } from "virtua";
|
|
4627
4487
|
|
|
4628
4488
|
// src/lib/use-unicode-fonts.ts
|
|
4629
|
-
import { useEffect as
|
|
4489
|
+
import { useEffect as useEffect12, useMemo as useMemo10 } from "react";
|
|
4630
4490
|
var japaneseScript = /[\u3040-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff]/u;
|
|
4631
4491
|
var arabicScript = /[\u0600-\u06ff\u0750-\u077f\u0870-\u08ff\ufb50-\ufdff\ufe70-\ufefc]/u;
|
|
4632
4492
|
function useUnicodeFallbackFonts(values) {
|
|
4633
4493
|
const content = useMemo10(() => collectUnicodeContent(values), [values]);
|
|
4634
|
-
|
|
4494
|
+
useEffect12(() => {
|
|
4635
4495
|
if (content.japanese) {
|
|
4636
4496
|
void import("./noto-sans-jp-loader.generated-HFGLYBR3.js").then(({ loadNotoSansJp }) => loadNotoSansJp(content.japanese)).catch(() => void 0);
|
|
4637
4497
|
}
|
|
@@ -4653,7 +4513,7 @@ function collectUnicodeContent(values) {
|
|
|
4653
4513
|
}
|
|
4654
4514
|
|
|
4655
4515
|
// src/components/file-browser.tsx
|
|
4656
|
-
import { Fragment
|
|
4516
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
4657
4517
|
var STATUS_TINT = {
|
|
4658
4518
|
added: "text-og-status-idle",
|
|
4659
4519
|
modified: "text-og-status-running",
|
|
@@ -4661,7 +4521,7 @@ var STATUS_TINT = {
|
|
|
4661
4521
|
renamed: "text-og-accent",
|
|
4662
4522
|
untracked: "text-og-fg-subtle"
|
|
4663
4523
|
};
|
|
4664
|
-
var useBrowserLayoutEffect = typeof window === "undefined" ?
|
|
4524
|
+
var useBrowserLayoutEffect = typeof window === "undefined" ? useEffect13 : useLayoutEffect2;
|
|
4665
4525
|
function parentOf2(path) {
|
|
4666
4526
|
const i = path.lastIndexOf("/");
|
|
4667
4527
|
return i <= 0 ? "" : path.slice(0, i);
|
|
@@ -4731,24 +4591,24 @@ function FileBrowser({
|
|
|
4731
4591
|
confirmDelete,
|
|
4732
4592
|
className
|
|
4733
4593
|
}) {
|
|
4734
|
-
const [expanded, setExpanded] =
|
|
4735
|
-
const [loadingPaths, setLoadingPaths] =
|
|
4736
|
-
const [active, setActive] =
|
|
4737
|
-
const [draftCreate, setDraftCreate] =
|
|
4738
|
-
const [draftRename, setDraftRename] =
|
|
4739
|
-
const [dragOver, setDragOver] =
|
|
4740
|
-
const [menu, setMenu] =
|
|
4741
|
-
const [pendingDelete, setPendingDelete] =
|
|
4742
|
-
const [busy, setBusy] =
|
|
4743
|
-
const [coarsePointer, setCoarsePointer] =
|
|
4744
|
-
const [revealRequest, setRevealRequest] =
|
|
4745
|
-
const handledRevealRequestRef =
|
|
4746
|
-
const attemptedRevealPathsRef =
|
|
4747
|
-
const treeId =
|
|
4594
|
+
const [expanded, setExpanded] = useState9(/* @__PURE__ */ new Set());
|
|
4595
|
+
const [loadingPaths, setLoadingPaths] = useState9(/* @__PURE__ */ new Set());
|
|
4596
|
+
const [active, setActive] = useState9(null);
|
|
4597
|
+
const [draftCreate, setDraftCreate] = useState9(null);
|
|
4598
|
+
const [draftRename, setDraftRename] = useState9(null);
|
|
4599
|
+
const [dragOver, setDragOver] = useState9(null);
|
|
4600
|
+
const [menu, setMenu] = useState9(null);
|
|
4601
|
+
const [pendingDelete, setPendingDelete] = useState9(null);
|
|
4602
|
+
const [busy, setBusy] = useState9(false);
|
|
4603
|
+
const [coarsePointer, setCoarsePointer] = useState9(false);
|
|
4604
|
+
const [revealRequest, setRevealRequest] = useState9(null);
|
|
4605
|
+
const handledRevealRequestRef = useRef11(null);
|
|
4606
|
+
const attemptedRevealPathsRef = useRef11(/* @__PURE__ */ new Set());
|
|
4607
|
+
const treeId = useId();
|
|
4748
4608
|
const container = usePortalTokenSource();
|
|
4749
4609
|
const containerRef = container.currentRef;
|
|
4750
|
-
const deleteReturnFocusRef =
|
|
4751
|
-
const vlistRef =
|
|
4610
|
+
const deleteReturnFocusRef = useRef11(null);
|
|
4611
|
+
const vlistRef = useRef11(null);
|
|
4752
4612
|
const portalTokenStyle = usePortalTokenStyle(container.source);
|
|
4753
4613
|
const getTreeElement = useCallback18(
|
|
4754
4614
|
() => typeof document === "undefined" ? null : document.getElementById(treeId),
|
|
@@ -4773,7 +4633,7 @@ function FileBrowser({
|
|
|
4773
4633
|
}
|
|
4774
4634
|
}, []);
|
|
4775
4635
|
const effectiveRevealRequestId = revealPath ? revealPathRequestId ?? revealPath : null;
|
|
4776
|
-
|
|
4636
|
+
useEffect13(() => {
|
|
4777
4637
|
if (!revealPath || effectiveRevealRequestId === null) {
|
|
4778
4638
|
setRevealRequest(null);
|
|
4779
4639
|
return;
|
|
@@ -4790,7 +4650,7 @@ function FileBrowser({
|
|
|
4790
4650
|
}, [effectiveRevealRequestId, revealPath]);
|
|
4791
4651
|
const visibleActive = active && findNode(visibleTree, active) ? active : null;
|
|
4792
4652
|
const cursor = visibleActive ?? (selectedPath && findNode(visibleTree, selectedPath) ? selectedPath : null);
|
|
4793
|
-
|
|
4653
|
+
useEffect13(() => {
|
|
4794
4654
|
if (active !== null && visibleActive === null) setActive(null);
|
|
4795
4655
|
}, [active, visibleActive]);
|
|
4796
4656
|
const expand = useCallback18(
|
|
@@ -4818,7 +4678,7 @@ function FileBrowser({
|
|
|
4818
4678
|
},
|
|
4819
4679
|
[expand]
|
|
4820
4680
|
);
|
|
4821
|
-
|
|
4681
|
+
useEffect13(() => {
|
|
4822
4682
|
if (!revealRequest) return;
|
|
4823
4683
|
const trace = traceRevealPath(visibleTree, revealRequest.path);
|
|
4824
4684
|
if (trace.directories.length > 0) {
|
|
@@ -5168,7 +5028,7 @@ function FileBrowser({
|
|
|
5168
5028
|
treeId
|
|
5169
5029
|
]
|
|
5170
5030
|
);
|
|
5171
|
-
|
|
5031
|
+
useEffect13(() => {
|
|
5172
5032
|
if (!menu) return;
|
|
5173
5033
|
const close = () => setMenu(null);
|
|
5174
5034
|
window.addEventListener("click", close);
|
|
@@ -5188,7 +5048,7 @@ function FileBrowser({
|
|
|
5188
5048
|
const renderNodeRow = (node, depth) => {
|
|
5189
5049
|
const isOpen = expanded.has(node.path);
|
|
5190
5050
|
if (renderNode) {
|
|
5191
|
-
return /* @__PURE__ */
|
|
5051
|
+
return /* @__PURE__ */ jsx3("div", { children: renderNode(node, depth, isOpen) });
|
|
5192
5052
|
}
|
|
5193
5053
|
const isDir = node.kind === "dir";
|
|
5194
5054
|
const isSelected = node.path === selectedPath || node.path === active;
|
|
@@ -5198,7 +5058,7 @@ function FileBrowser({
|
|
|
5198
5058
|
const isDropTarget = dragOver === (isDir ? node.path : parentOf2(node.path));
|
|
5199
5059
|
const dropDir = isDir ? node.path : parentOf2(node.path);
|
|
5200
5060
|
const treePosition = treePositionByPath.get(node.path);
|
|
5201
|
-
return /* @__PURE__ */
|
|
5061
|
+
return /* @__PURE__ */ jsx3(
|
|
5202
5062
|
"div",
|
|
5203
5063
|
{
|
|
5204
5064
|
id: `${treeId}-item-${rowIndexByPath.get(node.path) ?? 0}`,
|
|
@@ -5224,7 +5084,7 @@ function FileBrowser({
|
|
|
5224
5084
|
const src = e.dataTransfer.getData("text/og-path");
|
|
5225
5085
|
void onDropOnto(dropDir, src);
|
|
5226
5086
|
} : void 0,
|
|
5227
|
-
children: isRenaming ? /* @__PURE__ */
|
|
5087
|
+
children: isRenaming ? /* @__PURE__ */ jsx3(
|
|
5228
5088
|
InlineInput,
|
|
5229
5089
|
{
|
|
5230
5090
|
depth,
|
|
@@ -5233,7 +5093,7 @@ function FileBrowser({
|
|
|
5233
5093
|
onCommit: (name) => void commitRename(name),
|
|
5234
5094
|
onCancel: () => setDraftRename(null)
|
|
5235
5095
|
}
|
|
5236
|
-
) : /* @__PURE__ */
|
|
5096
|
+
) : /* @__PURE__ */ jsxs3(
|
|
5237
5097
|
"button",
|
|
5238
5098
|
{
|
|
5239
5099
|
type: "button",
|
|
@@ -5267,7 +5127,7 @@ function FileBrowser({
|
|
|
5267
5127
|
),
|
|
5268
5128
|
style: { paddingLeft: `${depth * 12 + 4}px` },
|
|
5269
5129
|
children: [
|
|
5270
|
-
isDir ? /* @__PURE__ */
|
|
5130
|
+
isDir ? /* @__PURE__ */ jsx3(
|
|
5271
5131
|
ChevronRightIcon,
|
|
5272
5132
|
{
|
|
5273
5133
|
className: cn(
|
|
@@ -5276,10 +5136,10 @@ function FileBrowser({
|
|
|
5276
5136
|
isLoading && "text-og-accent"
|
|
5277
5137
|
)
|
|
5278
5138
|
}
|
|
5279
|
-
) : /* @__PURE__ */
|
|
5280
|
-
isDir ? /* @__PURE__ */
|
|
5281
|
-
/* @__PURE__ */
|
|
5282
|
-
supportsMutation && /* @__PURE__ */
|
|
5139
|
+
) : /* @__PURE__ */ jsx3("span", { className: "inline-block w-3 shrink-0" }),
|
|
5140
|
+
isDir ? /* @__PURE__ */ jsx3(FolderIcon, { className: "size-3.5 shrink-0" }) : /* @__PURE__ */ jsx3(FileIcon, { className: "size-3.5 shrink-0" }),
|
|
5141
|
+
/* @__PURE__ */ jsx3("span", { className: "truncate", children: node.name }),
|
|
5142
|
+
supportsMutation && /* @__PURE__ */ jsx3(
|
|
5283
5143
|
"span",
|
|
5284
5144
|
{
|
|
5285
5145
|
role: "button",
|
|
@@ -5307,7 +5167,7 @@ function FileBrowser({
|
|
|
5307
5167
|
case "node":
|
|
5308
5168
|
return renderNodeRow(item.node, item.depth);
|
|
5309
5169
|
case "create":
|
|
5310
|
-
return /* @__PURE__ */
|
|
5170
|
+
return /* @__PURE__ */ jsx3(
|
|
5311
5171
|
InlineInput,
|
|
5312
5172
|
{
|
|
5313
5173
|
depth: item.depth,
|
|
@@ -5318,14 +5178,14 @@ function FileBrowser({
|
|
|
5318
5178
|
}
|
|
5319
5179
|
);
|
|
5320
5180
|
case "skeleton":
|
|
5321
|
-
return /* @__PURE__ */
|
|
5181
|
+
return /* @__PURE__ */ jsx3(
|
|
5322
5182
|
"div",
|
|
5323
5183
|
{
|
|
5324
5184
|
role: "group",
|
|
5325
5185
|
"aria-hidden": true,
|
|
5326
5186
|
style: { paddingLeft: `${item.depth * 12 + 4}px` },
|
|
5327
5187
|
className: "space-y-1 py-1",
|
|
5328
|
-
children: [0, 1, 2].map((i) => /* @__PURE__ */
|
|
5188
|
+
children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx3(
|
|
5329
5189
|
"div",
|
|
5330
5190
|
{
|
|
5331
5191
|
className: "h-2.5 animate-pulse rounded-og-sm bg-og-surface-2",
|
|
@@ -5336,25 +5196,25 @@ function FileBrowser({
|
|
|
5336
5196
|
}
|
|
5337
5197
|
);
|
|
5338
5198
|
case "residue":
|
|
5339
|
-
return /* @__PURE__ */
|
|
5199
|
+
return /* @__PURE__ */ jsxs3(
|
|
5340
5200
|
"div",
|
|
5341
5201
|
{
|
|
5342
5202
|
style: { paddingLeft: `${item.depth * 12 + 4}px` },
|
|
5343
5203
|
className: "flex items-center gap-1.5 py-0.5 pr-1 text-og-xs italic text-og-fg-subtle",
|
|
5344
5204
|
children: [
|
|
5345
|
-
/* @__PURE__ */
|
|
5346
|
-
/* @__PURE__ */
|
|
5205
|
+
/* @__PURE__ */ jsx3("span", { className: "inline-block w-3 shrink-0" }),
|
|
5206
|
+
/* @__PURE__ */ jsx3("span", { className: "min-w-0 truncate", children: "contents on machine \u2014 open when live" })
|
|
5347
5207
|
]
|
|
5348
5208
|
}
|
|
5349
5209
|
);
|
|
5350
5210
|
}
|
|
5351
5211
|
};
|
|
5352
|
-
|
|
5212
|
+
useEffect13(() => {
|
|
5353
5213
|
if (!cursor) return;
|
|
5354
5214
|
const index = renderItems.findIndex((it) => it.type === "node" && it.node.path === cursor);
|
|
5355
5215
|
if (index >= 0) vlistRef.current?.scrollToIndex(index);
|
|
5356
5216
|
}, [cursor, renderItems]);
|
|
5357
|
-
|
|
5217
|
+
useEffect13(() => {
|
|
5358
5218
|
if (!revealRequest) return;
|
|
5359
5219
|
const index = renderItems.findIndex(
|
|
5360
5220
|
(item) => item.type === "node" && item.node.path === revealRequest.path
|
|
@@ -5369,18 +5229,18 @@ function FileBrowser({
|
|
|
5369
5229
|
(current) => current?.path === revealRequest.path && current.requestId === revealRequest.requestId ? null : current
|
|
5370
5230
|
);
|
|
5371
5231
|
}, [renderItems, revealRequest, treeId, usesVirtualTree]);
|
|
5372
|
-
return /* @__PURE__ */
|
|
5373
|
-
showToolbar && /* @__PURE__ */
|
|
5232
|
+
return /* @__PURE__ */ jsxs3("div", { className: cn("flex min-h-0 min-w-0 flex-col", className), children: [
|
|
5233
|
+
showToolbar && /* @__PURE__ */ jsxs3(
|
|
5374
5234
|
"div",
|
|
5375
5235
|
{
|
|
5376
5236
|
role: "toolbar",
|
|
5377
5237
|
"aria-label": "File actions",
|
|
5378
5238
|
className: "flex shrink-0 flex-wrap items-center gap-0.5 border-b border-og-border px-1 py-1",
|
|
5379
5239
|
children: [
|
|
5380
|
-
supportsMutation ? /* @__PURE__ */
|
|
5381
|
-
/* @__PURE__ */
|
|
5382
|
-
/* @__PURE__ */
|
|
5383
|
-
/* @__PURE__ */
|
|
5240
|
+
supportsMutation ? /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
5241
|
+
/* @__PURE__ */ jsx3(ToolbarButton, { label: "New file", onClick: () => startCreate("file"), disabled: busy, children: /* @__PURE__ */ jsx3(FilePlusIcon, { className: "size-3.5" }) }),
|
|
5242
|
+
/* @__PURE__ */ jsx3(ToolbarButton, { label: "New folder", onClick: () => startCreate("dir"), disabled: busy, children: /* @__PURE__ */ jsx3(FolderPlusIcon, { className: "size-3.5" }) }),
|
|
5243
|
+
/* @__PURE__ */ jsx3(
|
|
5384
5244
|
ToolbarButton,
|
|
5385
5245
|
{
|
|
5386
5246
|
label: "Rename",
|
|
@@ -5389,10 +5249,10 @@ function FileBrowser({
|
|
|
5389
5249
|
if (node) startRename(node);
|
|
5390
5250
|
},
|
|
5391
5251
|
disabled: busy || !cursor,
|
|
5392
|
-
children: /* @__PURE__ */
|
|
5252
|
+
children: /* @__PURE__ */ jsx3(PencilIcon, { className: "size-3.5" })
|
|
5393
5253
|
}
|
|
5394
5254
|
),
|
|
5395
|
-
/* @__PURE__ */
|
|
5255
|
+
/* @__PURE__ */ jsx3(
|
|
5396
5256
|
ToolbarButton,
|
|
5397
5257
|
{
|
|
5398
5258
|
label: "Delete",
|
|
@@ -5401,24 +5261,24 @@ function FileBrowser({
|
|
|
5401
5261
|
if (node) void runDelete(node, event.currentTarget);
|
|
5402
5262
|
},
|
|
5403
5263
|
disabled: busy || !cursor,
|
|
5404
|
-
children: /* @__PURE__ */
|
|
5264
|
+
children: /* @__PURE__ */ jsx3(Trash2Icon, { className: "size-3.5" })
|
|
5405
5265
|
}
|
|
5406
5266
|
)
|
|
5407
5267
|
] }) : null,
|
|
5408
|
-
/* @__PURE__ */
|
|
5409
|
-
/* @__PURE__ */
|
|
5268
|
+
/* @__PURE__ */ jsx3("span", { className: "ml-auto" }),
|
|
5269
|
+
/* @__PURE__ */ jsx3(
|
|
5410
5270
|
ToolbarButton,
|
|
5411
5271
|
{
|
|
5412
5272
|
label: "Refresh",
|
|
5413
5273
|
onClick: () => void result.refresh(),
|
|
5414
5274
|
disabled: busy || result.loading,
|
|
5415
|
-
children: /* @__PURE__ */
|
|
5275
|
+
children: /* @__PURE__ */ jsx3(RefreshCwIcon, { className: cn("size-3.5", result.loading && "animate-spin") })
|
|
5416
5276
|
}
|
|
5417
5277
|
)
|
|
5418
5278
|
]
|
|
5419
5279
|
}
|
|
5420
5280
|
),
|
|
5421
|
-
showDegradedTree ? /* @__PURE__ */
|
|
5281
|
+
showDegradedTree ? /* @__PURE__ */ jsxs3(
|
|
5422
5282
|
"div",
|
|
5423
5283
|
{
|
|
5424
5284
|
role: "status",
|
|
@@ -5426,9 +5286,9 @@ function FileBrowser({
|
|
|
5426
5286
|
"data-opengeni-files-degraded": true,
|
|
5427
5287
|
className: "flex shrink-0 items-center gap-2 border-b border-og-status-running/30 bg-og-status-running/10 px-2 py-1.5 text-og-xs text-og-fg-muted",
|
|
5428
5288
|
children: [
|
|
5429
|
-
/* @__PURE__ */
|
|
5430
|
-
/* @__PURE__ */
|
|
5431
|
-
/* @__PURE__ */
|
|
5289
|
+
/* @__PURE__ */ jsx3(TriangleAlertIcon, { className: "size-3.5 shrink-0 text-og-status-running", "aria-hidden": true }),
|
|
5290
|
+
/* @__PURE__ */ jsx3("span", { className: "min-w-0 flex-1", children: result.source === "capture" ? "Live files are temporarily unavailable. Showing the latest captured revision." : "Live refresh failed. Showing the last loaded files." }),
|
|
5291
|
+
/* @__PURE__ */ jsxs3(
|
|
5432
5292
|
"button",
|
|
5433
5293
|
{
|
|
5434
5294
|
type: "button",
|
|
@@ -5436,7 +5296,7 @@ function FileBrowser({
|
|
|
5436
5296
|
disabled: result.loading,
|
|
5437
5297
|
className: "inline-flex min-h-7 shrink-0 items-center gap-1 rounded-og-sm border border-og-border bg-og-surface-1 px-2 font-medium text-og-fg transition-colors hover:border-og-border-strong focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:min-h-11",
|
|
5438
5298
|
children: [
|
|
5439
|
-
/* @__PURE__ */
|
|
5299
|
+
/* @__PURE__ */ jsx3(
|
|
5440
5300
|
RefreshCwIcon,
|
|
5441
5301
|
{
|
|
5442
5302
|
className: cn("size-3", result.loading && "animate-spin motion-reduce:animate-none"),
|
|
@@ -5450,7 +5310,7 @@ function FileBrowser({
|
|
|
5450
5310
|
]
|
|
5451
5311
|
}
|
|
5452
5312
|
) : null,
|
|
5453
|
-
/* @__PURE__ */
|
|
5313
|
+
/* @__PURE__ */ jsx3(
|
|
5454
5314
|
"div",
|
|
5455
5315
|
{
|
|
5456
5316
|
ref: container.ref,
|
|
@@ -5476,9 +5336,9 @@ function FileBrowser({
|
|
|
5476
5336
|
dragOver === "" && "ring-1 ring-inset ring-og-accent"
|
|
5477
5337
|
),
|
|
5478
5338
|
"data-opengeni-file-tree": true,
|
|
5479
|
-
children: showErrorEmpty ? /* @__PURE__ */
|
|
5480
|
-
/* @__PURE__ */
|
|
5481
|
-
/* @__PURE__ */
|
|
5339
|
+
children: showErrorEmpty ? /* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-start gap-2 p-2 text-og-sm text-og-fg-subtle", children: [
|
|
5340
|
+
/* @__PURE__ */ jsx3("div", { children: fallback ?? `Could not load files: ${result.error?.message ?? "refresh the file list to try again"}` }),
|
|
5341
|
+
/* @__PURE__ */ jsxs3(
|
|
5482
5342
|
"button",
|
|
5483
5343
|
{
|
|
5484
5344
|
type: "button",
|
|
@@ -5486,7 +5346,7 @@ function FileBrowser({
|
|
|
5486
5346
|
disabled: result.loading,
|
|
5487
5347
|
className: "inline-flex items-center gap-1.5 rounded-og-sm border border-og-border px-2 py-1 text-og-xs font-medium text-og-fg-muted transition-colors hover:border-og-border-strong hover:text-og-fg disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:min-h-11",
|
|
5488
5348
|
children: [
|
|
5489
|
-
/* @__PURE__ */
|
|
5349
|
+
/* @__PURE__ */ jsx3(
|
|
5490
5350
|
RefreshCwIcon,
|
|
5491
5351
|
{
|
|
5492
5352
|
className: cn("size-3.5", result.loading && "animate-spin"),
|
|
@@ -5497,7 +5357,7 @@ function FileBrowser({
|
|
|
5497
5357
|
]
|
|
5498
5358
|
}
|
|
5499
5359
|
)
|
|
5500
|
-
] }) : showEmpty ? /* @__PURE__ */
|
|
5360
|
+
] }) : showEmpty ? /* @__PURE__ */ jsx3("div", { className: "p-2 text-og-sm text-og-fg-subtle", children: emptyState ?? "This directory is empty" }) : !usesVirtualTree ? /* @__PURE__ */ jsx3(
|
|
5501
5361
|
"div",
|
|
5502
5362
|
{
|
|
5503
5363
|
id: treeId,
|
|
@@ -5507,13 +5367,13 @@ function FileBrowser({
|
|
|
5507
5367
|
"aria-multiselectable": false,
|
|
5508
5368
|
tabIndex: 0,
|
|
5509
5369
|
className: "min-h-0 min-w-0 flex-1 overflow-auto outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-og-accent",
|
|
5510
|
-
children: renderItems.map((item) => /* @__PURE__ */
|
|
5370
|
+
children: renderItems.map((item) => /* @__PURE__ */ jsx3("div", { className: "min-w-0", children: renderItem(item) }, itemKey(item)))
|
|
5511
5371
|
}
|
|
5512
5372
|
) : (
|
|
5513
5373
|
// Virtualized: only the rows in/near the viewport mount, so a 3k-node
|
|
5514
5374
|
// tree stays responsive. The flat item list already carries the
|
|
5515
5375
|
// expanded subtree + synthetic (create/skeleton/residue) rows.
|
|
5516
|
-
/* @__PURE__ */
|
|
5376
|
+
/* @__PURE__ */ jsx3(
|
|
5517
5377
|
VList,
|
|
5518
5378
|
{
|
|
5519
5379
|
ref: vlistRef,
|
|
@@ -5526,13 +5386,13 @@ function FileBrowser({
|
|
|
5526
5386
|
className: "min-h-0 flex-1 outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-og-accent",
|
|
5527
5387
|
itemSize: coarsePointer ? 44 : 28,
|
|
5528
5388
|
ssrCount: Math.min(32, renderItems.length),
|
|
5529
|
-
children: renderItems.map((item) => /* @__PURE__ */
|
|
5389
|
+
children: renderItems.map((item) => /* @__PURE__ */ jsx3("div", { className: "min-w-0", children: renderItem(item) }, itemKey(item)))
|
|
5530
5390
|
}
|
|
5531
5391
|
)
|
|
5532
5392
|
)
|
|
5533
5393
|
}
|
|
5534
5394
|
),
|
|
5535
|
-
menu && menu.node && /* @__PURE__ */
|
|
5395
|
+
menu && menu.node && /* @__PURE__ */ jsx3(
|
|
5536
5396
|
ContextMenu,
|
|
5537
5397
|
{
|
|
5538
5398
|
node: menu.node,
|
|
@@ -5548,7 +5408,7 @@ function FileBrowser({
|
|
|
5548
5408
|
}
|
|
5549
5409
|
}
|
|
5550
5410
|
),
|
|
5551
|
-
pendingDelete ? /* @__PURE__ */
|
|
5411
|
+
pendingDelete ? /* @__PURE__ */ jsx3(
|
|
5552
5412
|
DeleteDialog,
|
|
5553
5413
|
{
|
|
5554
5414
|
node: pendingDelete,
|
|
@@ -5571,11 +5431,11 @@ function DeleteDialog({
|
|
|
5571
5431
|
onCancel,
|
|
5572
5432
|
onConfirm
|
|
5573
5433
|
}) {
|
|
5574
|
-
const cancelRef =
|
|
5575
|
-
const [open, setOpen] =
|
|
5576
|
-
const closeIntentRef =
|
|
5577
|
-
const settledRef =
|
|
5578
|
-
const settleTimerRef =
|
|
5434
|
+
const cancelRef = useRef11(null);
|
|
5435
|
+
const [open, setOpen] = useState9(true);
|
|
5436
|
+
const closeIntentRef = useRef11("cancel");
|
|
5437
|
+
const settledRef = useRef11(false);
|
|
5438
|
+
const settleTimerRef = useRef11(null);
|
|
5579
5439
|
const settle = () => {
|
|
5580
5440
|
if (settledRef.current) return;
|
|
5581
5441
|
settledRef.current = true;
|
|
@@ -5592,13 +5452,13 @@ function DeleteDialog({
|
|
|
5592
5452
|
settle();
|
|
5593
5453
|
}, 0);
|
|
5594
5454
|
};
|
|
5595
|
-
|
|
5455
|
+
useEffect13(
|
|
5596
5456
|
() => () => {
|
|
5597
5457
|
if (settleTimerRef.current !== null) clearTimeout(settleTimerRef.current);
|
|
5598
5458
|
},
|
|
5599
5459
|
[]
|
|
5600
5460
|
);
|
|
5601
|
-
return /* @__PURE__ */
|
|
5461
|
+
return /* @__PURE__ */ jsx3(
|
|
5602
5462
|
AlertDialog.Root,
|
|
5603
5463
|
{
|
|
5604
5464
|
open,
|
|
@@ -5608,9 +5468,9 @@ function DeleteDialog({
|
|
|
5608
5468
|
scheduleSettle();
|
|
5609
5469
|
}
|
|
5610
5470
|
},
|
|
5611
|
-
children: /* @__PURE__ */
|
|
5612
|
-
/* @__PURE__ */
|
|
5613
|
-
/* @__PURE__ */
|
|
5471
|
+
children: /* @__PURE__ */ jsxs3(AlertDialog.Portal, { container: typeof document === "undefined" ? null : document.body, children: [
|
|
5472
|
+
/* @__PURE__ */ jsx3(AlertDialog.Overlay, { className: "og-root fixed inset-0 z-[100] bg-black/45 backdrop-blur-[2px]" }),
|
|
5473
|
+
/* @__PURE__ */ jsxs3(
|
|
5614
5474
|
AlertDialog.Content,
|
|
5615
5475
|
{
|
|
5616
5476
|
className: "og-root fixed left-1/2 top-1/2 z-[101] max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] max-w-sm -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-og-lg border border-og-border-strong bg-og-surface-1 p-4 text-og-fg shadow-2xl outline-hidden",
|
|
@@ -5632,22 +5492,22 @@ function DeleteDialog({
|
|
|
5632
5492
|
}
|
|
5633
5493
|
},
|
|
5634
5494
|
children: [
|
|
5635
|
-
/* @__PURE__ */
|
|
5636
|
-
/* @__PURE__ */
|
|
5637
|
-
/* @__PURE__ */
|
|
5638
|
-
/* @__PURE__ */
|
|
5495
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-start gap-3", children: [
|
|
5496
|
+
/* @__PURE__ */ jsx3("span", { className: "flex size-9 shrink-0 items-center justify-center rounded-full bg-og-status-failed/12 text-og-status-failed", children: /* @__PURE__ */ jsx3(Trash2Icon, { className: "size-4", "aria-hidden": true }) }),
|
|
5497
|
+
/* @__PURE__ */ jsxs3("div", { className: "min-w-0", children: [
|
|
5498
|
+
/* @__PURE__ */ jsxs3(AlertDialog.Title, { className: "text-og-sm font-semibold", children: [
|
|
5639
5499
|
"Delete ",
|
|
5640
5500
|
node.kind === "dir" ? "folder" : "file",
|
|
5641
5501
|
"?"
|
|
5642
5502
|
] }),
|
|
5643
|
-
/* @__PURE__ */
|
|
5644
|
-
/* @__PURE__ */
|
|
5503
|
+
/* @__PURE__ */ jsxs3(AlertDialog.Description, { className: "mt-1 text-og-sm leading-relaxed text-og-fg-muted", children: [
|
|
5504
|
+
/* @__PURE__ */ jsx3("span", { className: "break-all font-og-mono text-og-fg", children: node.path }),
|
|
5645
5505
|
node.kind === "dir" ? " and everything inside it will be permanently removed." : " will be permanently removed."
|
|
5646
5506
|
] })
|
|
5647
5507
|
] })
|
|
5648
5508
|
] }),
|
|
5649
|
-
/* @__PURE__ */
|
|
5650
|
-
/* @__PURE__ */
|
|
5509
|
+
/* @__PURE__ */ jsxs3("div", { className: "mt-4 flex justify-end gap-2", children: [
|
|
5510
|
+
/* @__PURE__ */ jsx3(AlertDialog.Cancel, { asChild: true, children: /* @__PURE__ */ jsx3(
|
|
5651
5511
|
"button",
|
|
5652
5512
|
{
|
|
5653
5513
|
ref: cancelRef,
|
|
@@ -5660,7 +5520,7 @@ function DeleteDialog({
|
|
|
5660
5520
|
children: "Cancel"
|
|
5661
5521
|
}
|
|
5662
5522
|
) }),
|
|
5663
|
-
/* @__PURE__ */
|
|
5523
|
+
/* @__PURE__ */ jsx3(AlertDialog.Action, { asChild: true, children: /* @__PURE__ */ jsx3(
|
|
5664
5524
|
"button",
|
|
5665
5525
|
{
|
|
5666
5526
|
type: "button",
|
|
@@ -5686,7 +5546,7 @@ function ToolbarButton({
|
|
|
5686
5546
|
disabled,
|
|
5687
5547
|
children
|
|
5688
5548
|
}) {
|
|
5689
|
-
return /* @__PURE__ */
|
|
5549
|
+
return /* @__PURE__ */ jsx3(
|
|
5690
5550
|
"button",
|
|
5691
5551
|
{
|
|
5692
5552
|
type: "button",
|
|
@@ -5710,10 +5570,10 @@ function InlineInput({
|
|
|
5710
5570
|
onCommit,
|
|
5711
5571
|
onCancel
|
|
5712
5572
|
}) {
|
|
5713
|
-
const [value, setValue] =
|
|
5714
|
-
const ref =
|
|
5715
|
-
const doneRef =
|
|
5716
|
-
|
|
5573
|
+
const [value, setValue] = useState9(initialValue);
|
|
5574
|
+
const ref = useRef11(null);
|
|
5575
|
+
const doneRef = useRef11(false);
|
|
5576
|
+
useEffect13(() => {
|
|
5717
5577
|
const el = ref.current;
|
|
5718
5578
|
if (!el) return;
|
|
5719
5579
|
el.focus();
|
|
@@ -5727,15 +5587,15 @@ function InlineInput({
|
|
|
5727
5587
|
if (commit) onCommit(value);
|
|
5728
5588
|
else onCancel();
|
|
5729
5589
|
};
|
|
5730
|
-
return /* @__PURE__ */
|
|
5590
|
+
return /* @__PURE__ */ jsxs3(
|
|
5731
5591
|
"div",
|
|
5732
5592
|
{
|
|
5733
5593
|
className: "flex items-center gap-1 px-1 py-0.5",
|
|
5734
5594
|
style: { paddingLeft: `${depth * 12 + 4}px` },
|
|
5735
5595
|
children: [
|
|
5736
|
-
/* @__PURE__ */
|
|
5737
|
-
kind === "dir" ? /* @__PURE__ */
|
|
5738
|
-
/* @__PURE__ */
|
|
5596
|
+
/* @__PURE__ */ jsx3("span", { className: "inline-block w-3 shrink-0" }),
|
|
5597
|
+
kind === "dir" ? /* @__PURE__ */ jsx3(FolderIcon, { className: "size-3.5 shrink-0" }) : /* @__PURE__ */ jsx3(FileIcon, { className: "size-3.5 shrink-0" }),
|
|
5598
|
+
/* @__PURE__ */ jsx3(
|
|
5739
5599
|
"input",
|
|
5740
5600
|
{
|
|
5741
5601
|
ref,
|
|
@@ -5777,12 +5637,12 @@ function ContextMenu({
|
|
|
5777
5637
|
onClose
|
|
5778
5638
|
}) {
|
|
5779
5639
|
const isDir = node.kind === "dir";
|
|
5780
|
-
const menuRef =
|
|
5640
|
+
const menuRef = useRef11(null);
|
|
5781
5641
|
const vw = typeof window !== "undefined" ? window.innerWidth : 9999;
|
|
5782
5642
|
const vh = typeof window !== "undefined" ? window.innerHeight : 9999;
|
|
5783
5643
|
const left = Math.max(4, Math.min(x, vw - 180));
|
|
5784
5644
|
const top = Math.max(4, Math.min(y, vh - 160));
|
|
5785
|
-
|
|
5645
|
+
useEffect13(() => {
|
|
5786
5646
|
menuRef.current?.querySelector('[role="menuitem"]')?.focus();
|
|
5787
5647
|
}, []);
|
|
5788
5648
|
const onKeyDown = (event) => {
|
|
@@ -5807,7 +5667,7 @@ function ContextMenu({
|
|
|
5807
5667
|
event.stopPropagation();
|
|
5808
5668
|
items[next]?.focus();
|
|
5809
5669
|
};
|
|
5810
|
-
const item = (label, icon, onClick, danger) => /* @__PURE__ */
|
|
5670
|
+
const item = (label, icon, onClick, danger) => /* @__PURE__ */ jsxs3(
|
|
5811
5671
|
"button",
|
|
5812
5672
|
{
|
|
5813
5673
|
type: "button",
|
|
@@ -5827,7 +5687,7 @@ function ContextMenu({
|
|
|
5827
5687
|
]
|
|
5828
5688
|
}
|
|
5829
5689
|
);
|
|
5830
|
-
return /* @__PURE__ */
|
|
5690
|
+
return /* @__PURE__ */ jsxs3(
|
|
5831
5691
|
"div",
|
|
5832
5692
|
{
|
|
5833
5693
|
ref: menuRef,
|
|
@@ -5842,13 +5702,13 @@ function ContextMenu({
|
|
|
5842
5702
|
"bg-og-surface-1"
|
|
5843
5703
|
),
|
|
5844
5704
|
children: [
|
|
5845
|
-
isDir && /* @__PURE__ */
|
|
5846
|
-
item("New file", /* @__PURE__ */
|
|
5847
|
-
item("New folder", /* @__PURE__ */
|
|
5848
|
-
/* @__PURE__ */
|
|
5705
|
+
isDir && /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
5706
|
+
item("New file", /* @__PURE__ */ jsx3(FilePlusIcon, { className: "size-3.5" }), onNewFile),
|
|
5707
|
+
item("New folder", /* @__PURE__ */ jsx3(FolderPlusIcon, { className: "size-3.5" }), onNewFolder),
|
|
5708
|
+
/* @__PURE__ */ jsx3("div", { role: "separator", className: "my-1 h-px bg-og-border" })
|
|
5849
5709
|
] }),
|
|
5850
|
-
item("Rename", /* @__PURE__ */
|
|
5851
|
-
item("Delete", /* @__PURE__ */
|
|
5710
|
+
item("Rename", /* @__PURE__ */ jsx3(PencilIcon, { className: "size-3.5" }), onRename),
|
|
5711
|
+
item("Delete", /* @__PURE__ */ jsx3(Trash2Icon, { className: "size-3.5" }), onDelete, true)
|
|
5852
5712
|
]
|
|
5853
5713
|
}
|
|
5854
5714
|
);
|
|
@@ -5859,17 +5719,17 @@ import { ArrowUpRightIcon, FileWarningIcon, HistoryIcon } from "lucide-react";
|
|
|
5859
5719
|
import {
|
|
5860
5720
|
Component,
|
|
5861
5721
|
useCallback as useCallback20,
|
|
5862
|
-
useEffect as
|
|
5863
|
-
useId as
|
|
5722
|
+
useEffect as useEffect15,
|
|
5723
|
+
useId as useId2,
|
|
5864
5724
|
useLayoutEffect as useLayoutEffect3,
|
|
5865
5725
|
useMemo as useMemo13,
|
|
5866
|
-
useRef as
|
|
5867
|
-
useState as
|
|
5726
|
+
useRef as useRef13,
|
|
5727
|
+
useState as useState11
|
|
5868
5728
|
} from "react";
|
|
5869
5729
|
import { VList as VList2 } from "virtua";
|
|
5870
5730
|
|
|
5871
5731
|
// src/hooks/use-windowed-sections.ts
|
|
5872
|
-
import { useCallback as useCallback19, useEffect as
|
|
5732
|
+
import { useCallback as useCallback19, useEffect as useEffect14, useMemo as useMemo12, useRef as useRef12, useState as useState10 } from "react";
|
|
5873
5733
|
function computeWindowRange(heights, scrollTop, viewport, overscan) {
|
|
5874
5734
|
const n = heights.length;
|
|
5875
5735
|
if (n === 0) return { start: 0, end: 0 };
|
|
@@ -5900,19 +5760,19 @@ function computeWindowRange(heights, scrollTop, viewport, overscan) {
|
|
|
5900
5760
|
}
|
|
5901
5761
|
function useWindowedSections(opts) {
|
|
5902
5762
|
const { count, estimateHeight, overscan = 3 } = opts;
|
|
5903
|
-
const scrollRef =
|
|
5904
|
-
const [heights, setHeights] =
|
|
5763
|
+
const scrollRef = useRef12(null);
|
|
5764
|
+
const [heights, setHeights] = useState10(
|
|
5905
5765
|
() => Array.from({ length: count }, (_, i) => estimateHeight(i))
|
|
5906
5766
|
);
|
|
5907
|
-
|
|
5767
|
+
useEffect14(() => {
|
|
5908
5768
|
setHeights((prev) => {
|
|
5909
5769
|
const next = Array.from({ length: count }, (_, i) => estimateHeight(i));
|
|
5910
5770
|
return prev.length === next.length && prev.every((height, index) => height === next[index]) ? prev : next;
|
|
5911
5771
|
});
|
|
5912
5772
|
}, [count, estimateHeight]);
|
|
5913
|
-
const heightsRef =
|
|
5773
|
+
const heightsRef = useRef12(heights);
|
|
5914
5774
|
heightsRef.current = heights;
|
|
5915
|
-
const [range, setRange] =
|
|
5775
|
+
const [range, setRange] = useState10(() => ({
|
|
5916
5776
|
start: 0,
|
|
5917
5777
|
end: Math.min(count, overscan + 1)
|
|
5918
5778
|
}));
|
|
@@ -5922,7 +5782,7 @@ function useWindowedSections(opts) {
|
|
|
5922
5782
|
const next = computeWindowRange(heightsRef.current, el.scrollTop, el.clientHeight, overscan);
|
|
5923
5783
|
setRange((prev) => prev.start === next.start && prev.end === next.end ? prev : next);
|
|
5924
5784
|
}, [overscan]);
|
|
5925
|
-
|
|
5785
|
+
useEffect14(() => {
|
|
5926
5786
|
const el = scrollRef.current;
|
|
5927
5787
|
if (!el) return;
|
|
5928
5788
|
let raf = 0;
|
|
@@ -5958,7 +5818,7 @@ function useWindowedSections(opts) {
|
|
|
5958
5818
|
for (let i = 0; i < count; i++) out[i + 1] = (out[i] ?? 0) + Math.max(heights[i] ?? 0, 0);
|
|
5959
5819
|
return out;
|
|
5960
5820
|
}, [heights, count]);
|
|
5961
|
-
|
|
5821
|
+
useEffect14(() => {
|
|
5962
5822
|
recompute();
|
|
5963
5823
|
}, [offsets, recompute]);
|
|
5964
5824
|
const scrollToIndex = useCallback19(
|
|
@@ -5981,14 +5841,14 @@ function useWindowedSections(opts) {
|
|
|
5981
5841
|
}
|
|
5982
5842
|
|
|
5983
5843
|
// src/components/workbench-changes.tsx
|
|
5984
|
-
import { jsx as
|
|
5844
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
5985
5845
|
var GROUP_THRESHOLD = 20;
|
|
5986
5846
|
var OVERSCAN = 2;
|
|
5987
5847
|
var HEADER_PX = 30;
|
|
5988
5848
|
var LINE_PX = 18;
|
|
5989
5849
|
var GUARD_BODY_PX = 52;
|
|
5990
5850
|
var COMPACT_SURFACE_PX = 560;
|
|
5991
|
-
var useChangesLayoutEffect = typeof window === "undefined" ?
|
|
5851
|
+
var useChangesLayoutEffect = typeof window === "undefined" ? useEffect15 : useLayoutEffect3;
|
|
5992
5852
|
var STATUS_TINT2 = {
|
|
5993
5853
|
added: "text-og-status-idle",
|
|
5994
5854
|
modified: "text-og-status-running",
|
|
@@ -6099,7 +5959,7 @@ var ChangesRailVList = class extends Component {
|
|
|
6099
5959
|
this.listHandle = handle;
|
|
6100
5960
|
};
|
|
6101
5961
|
render() {
|
|
6102
|
-
return /* @__PURE__ */
|
|
5962
|
+
return /* @__PURE__ */ jsx4("div", { ref: this.setHost, "data-opengeni-changes-rail": true, className: this.props.className, children: /* @__PURE__ */ jsx4(
|
|
6103
5963
|
VList2,
|
|
6104
5964
|
{
|
|
6105
5965
|
ref: this.setListHandle,
|
|
@@ -6163,13 +6023,13 @@ function WorkbenchChanges({
|
|
|
6163
6023
|
onOpenFile,
|
|
6164
6024
|
className
|
|
6165
6025
|
}) {
|
|
6166
|
-
const rootRef =
|
|
6167
|
-
const [compact, setCompact] =
|
|
6168
|
-
const [coarsePointer, setCoarsePointer] =
|
|
6026
|
+
const rootRef = useRef13(null);
|
|
6027
|
+
const [compact, setCompact] = useState11(false);
|
|
6028
|
+
const [coarsePointer, setCoarsePointer] = useState11(false);
|
|
6169
6029
|
const resolvedTheme = useThemeType(themeType);
|
|
6170
|
-
const [layout, setLayout] =
|
|
6171
|
-
const [activePath, setActivePath] =
|
|
6172
|
-
const pickerId =
|
|
6030
|
+
const [layout, setLayout] = useState11("unified");
|
|
6031
|
+
const [activePath, setActivePath] = useState11(null);
|
|
6032
|
+
const pickerId = useId2();
|
|
6173
6033
|
const unicodeFontPaths = useMemo13(
|
|
6174
6034
|
() => diff.flatMap((file) => file.oldPath ? [file.path, file.oldPath] : [file.path]),
|
|
6175
6035
|
[diff]
|
|
@@ -6241,7 +6101,7 @@ function WorkbenchChanges({
|
|
|
6241
6101
|
const nextPath = orderedFiles[idx]?.path ?? null;
|
|
6242
6102
|
setActivePath((previous) => previous === nextPath ? previous : nextPath);
|
|
6243
6103
|
}, [windowed, orderedFiles]);
|
|
6244
|
-
|
|
6104
|
+
useEffect15(() => {
|
|
6245
6105
|
const el = windowed.scrollRef.current;
|
|
6246
6106
|
if (!el) return;
|
|
6247
6107
|
el.addEventListener("scroll", onPaneScroll, { passive: true });
|
|
@@ -6249,14 +6109,14 @@ function WorkbenchChanges({
|
|
|
6249
6109
|
}, [windowed.scrollRef, onPaneScroll]);
|
|
6250
6110
|
const sourceBadge = describeSource(source, capturedAt, captureRevision ?? null);
|
|
6251
6111
|
const activeFile = orderedFiles[activeIndex] ?? orderedFiles[0];
|
|
6252
|
-
return /* @__PURE__ */
|
|
6112
|
+
return /* @__PURE__ */ jsxs4(
|
|
6253
6113
|
"div",
|
|
6254
6114
|
{
|
|
6255
6115
|
ref: rootRef,
|
|
6256
6116
|
className: cn("flex h-full min-h-0 min-w-0 flex-col", className),
|
|
6257
6117
|
"data-workbench-changes-layout": compact ? "compact" : "rail",
|
|
6258
6118
|
children: [
|
|
6259
|
-
/* @__PURE__ */
|
|
6119
|
+
/* @__PURE__ */ jsxs4(
|
|
6260
6120
|
"div",
|
|
6261
6121
|
{
|
|
6262
6122
|
className: cn(
|
|
@@ -6264,7 +6124,7 @@ function WorkbenchChanges({
|
|
|
6264
6124
|
compact && source === "capture" && "flex-col items-stretch gap-1.5 py-2"
|
|
6265
6125
|
),
|
|
6266
6126
|
children: [
|
|
6267
|
-
/* @__PURE__ */
|
|
6127
|
+
/* @__PURE__ */ jsxs4(
|
|
6268
6128
|
"span",
|
|
6269
6129
|
{
|
|
6270
6130
|
role: "status",
|
|
@@ -6277,18 +6137,18 @@ function WorkbenchChanges({
|
|
|
6277
6137
|
" ",
|
|
6278
6138
|
diff.length === 1 ? "file" : "files",
|
|
6279
6139
|
" changed",
|
|
6280
|
-
/* @__PURE__ */
|
|
6140
|
+
/* @__PURE__ */ jsxs4("span", { "data-contrast-audited": true, className: "ml-2 text-og-status-idle", children: [
|
|
6281
6141
|
"+",
|
|
6282
6142
|
additions
|
|
6283
6143
|
] }),
|
|
6284
|
-
/* @__PURE__ */
|
|
6144
|
+
/* @__PURE__ */ jsxs4("span", { "data-contrast-audited": true, className: "ml-1 text-og-status-failed", children: [
|
|
6285
6145
|
"\u2212",
|
|
6286
6146
|
deletions
|
|
6287
6147
|
] })
|
|
6288
6148
|
]
|
|
6289
6149
|
}
|
|
6290
6150
|
),
|
|
6291
|
-
/* @__PURE__ */
|
|
6151
|
+
/* @__PURE__ */ jsxs4(
|
|
6292
6152
|
"div",
|
|
6293
6153
|
{
|
|
6294
6154
|
className: cn(
|
|
@@ -6296,18 +6156,18 @@ function WorkbenchChanges({
|
|
|
6296
6156
|
compact && source === "capture" && "self-start"
|
|
6297
6157
|
),
|
|
6298
6158
|
children: [
|
|
6299
|
-
compact ? null : /* @__PURE__ */
|
|
6300
|
-
/* @__PURE__ */
|
|
6159
|
+
compact ? null : /* @__PURE__ */ jsx4(LayoutToggle, { layout, onChange: setLayout }),
|
|
6160
|
+
/* @__PURE__ */ jsx4(SourceBadge, { source, capturedAt, label: sourceBadge })
|
|
6301
6161
|
]
|
|
6302
6162
|
}
|
|
6303
6163
|
)
|
|
6304
6164
|
]
|
|
6305
6165
|
}
|
|
6306
6166
|
),
|
|
6307
|
-
compact ? /* @__PURE__ */
|
|
6308
|
-
/* @__PURE__ */
|
|
6309
|
-
/* @__PURE__ */
|
|
6310
|
-
/* @__PURE__ */
|
|
6167
|
+
compact ? /* @__PURE__ */ jsxs4("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
6168
|
+
/* @__PURE__ */ jsxs4("div", { className: "shrink-0 border-b border-og-border bg-og-surface-1 p-2", children: [
|
|
6169
|
+
/* @__PURE__ */ jsx4("label", { className: "sr-only", htmlFor: pickerId, children: "Changed file" }),
|
|
6170
|
+
/* @__PURE__ */ jsx4(
|
|
6311
6171
|
"select",
|
|
6312
6172
|
{
|
|
6313
6173
|
id: pickerId,
|
|
@@ -6320,11 +6180,11 @@ function WorkbenchChanges({
|
|
|
6320
6180
|
title: activeFile?.path,
|
|
6321
6181
|
"data-compact-file-picker": true,
|
|
6322
6182
|
className: "h-11 w-full rounded-og-md border border-og-border bg-og-bg px-3 font-og-mono text-og-sm text-og-fg outline-hidden transition-colors focus:border-og-accent focus:ring-2 focus:ring-og-accent-soft",
|
|
6323
|
-
children: orderedFiles.map((file, index) => /* @__PURE__ */
|
|
6183
|
+
children: orderedFiles.map((file, index) => /* @__PURE__ */ jsx4("option", { value: index, children: compactFileLabel(file) }, file.path))
|
|
6324
6184
|
}
|
|
6325
6185
|
)
|
|
6326
6186
|
] }),
|
|
6327
|
-
/* @__PURE__ */
|
|
6187
|
+
/* @__PURE__ */ jsx4(
|
|
6328
6188
|
"div",
|
|
6329
6189
|
{
|
|
6330
6190
|
"aria-label": "Changed file diff",
|
|
@@ -6332,7 +6192,7 @@ function WorkbenchChanges({
|
|
|
6332
6192
|
"data-opengeni-changes-pane": true,
|
|
6333
6193
|
role: "region",
|
|
6334
6194
|
tabIndex: 0,
|
|
6335
|
-
children: activeFile ? /* @__PURE__ */
|
|
6195
|
+
children: activeFile ? /* @__PURE__ */ jsx4(
|
|
6336
6196
|
DiffSection,
|
|
6337
6197
|
{
|
|
6338
6198
|
file: activeFile,
|
|
@@ -6343,8 +6203,8 @@ function WorkbenchChanges({
|
|
|
6343
6203
|
) : null
|
|
6344
6204
|
}
|
|
6345
6205
|
)
|
|
6346
|
-
] }) : /* @__PURE__ */
|
|
6347
|
-
/* @__PURE__ */
|
|
6206
|
+
] }) : /* @__PURE__ */ jsxs4("div", { className: "flex min-h-0 flex-1", children: [
|
|
6207
|
+
/* @__PURE__ */ jsx4(
|
|
6348
6208
|
ChangesRailVList,
|
|
6349
6209
|
{
|
|
6350
6210
|
rowCount: rows.length,
|
|
@@ -6352,18 +6212,18 @@ function WorkbenchChanges({
|
|
|
6352
6212
|
files: orderedFiles,
|
|
6353
6213
|
className: "w-[clamp(12rem,28%,15rem)] shrink-0 border-r border-og-border bg-og-surface-1/35",
|
|
6354
6214
|
children: rows.map(
|
|
6355
|
-
(row) => row.kind === "group" ? /* @__PURE__ */
|
|
6215
|
+
(row) => row.kind === "group" ? /* @__PURE__ */ jsxs4(
|
|
6356
6216
|
"div",
|
|
6357
6217
|
{
|
|
6358
6218
|
"data-rail-group": true,
|
|
6359
6219
|
className: "flex items-center gap-1.5 px-2 pb-0.5 pt-2 text-og-xs font-medium uppercase tracking-wide text-og-fg-subtle",
|
|
6360
6220
|
children: [
|
|
6361
|
-
/* @__PURE__ */
|
|
6362
|
-
/* @__PURE__ */
|
|
6221
|
+
/* @__PURE__ */ jsx4("span", { className: "min-w-0 truncate", children: row.label }),
|
|
6222
|
+
/* @__PURE__ */ jsx4("span", { className: "shrink-0", children: row.count })
|
|
6363
6223
|
]
|
|
6364
6224
|
},
|
|
6365
6225
|
`g:${row.label}`
|
|
6366
|
-
) : /* @__PURE__ */
|
|
6226
|
+
) : /* @__PURE__ */ jsx4(
|
|
6367
6227
|
RailFileRow,
|
|
6368
6228
|
{
|
|
6369
6229
|
file: row.file,
|
|
@@ -6376,7 +6236,7 @@ function WorkbenchChanges({
|
|
|
6376
6236
|
)
|
|
6377
6237
|
}
|
|
6378
6238
|
),
|
|
6379
|
-
/* @__PURE__ */
|
|
6239
|
+
/* @__PURE__ */ jsx4(
|
|
6380
6240
|
"div",
|
|
6381
6241
|
{
|
|
6382
6242
|
ref: windowed.scrollRef,
|
|
@@ -6385,15 +6245,15 @@ function WorkbenchChanges({
|
|
|
6385
6245
|
"data-opengeni-changes-pane": true,
|
|
6386
6246
|
role: "region",
|
|
6387
6247
|
tabIndex: 0,
|
|
6388
|
-
children: /* @__PURE__ */
|
|
6248
|
+
children: /* @__PURE__ */ jsx4("div", { style: { position: "relative", height: windowed.totalHeight }, children: orderedFiles.map((file, index) => {
|
|
6389
6249
|
if (index < windowed.range.start || index >= windowed.range.end) return null;
|
|
6390
|
-
return /* @__PURE__ */
|
|
6250
|
+
return /* @__PURE__ */ jsx4(
|
|
6391
6251
|
MeasuredSection,
|
|
6392
6252
|
{
|
|
6393
6253
|
index,
|
|
6394
6254
|
top: windowed.offsets[index] ?? 0,
|
|
6395
6255
|
onMeasure: windowed.measure,
|
|
6396
|
-
children: /* @__PURE__ */
|
|
6256
|
+
children: /* @__PURE__ */ jsx4(
|
|
6397
6257
|
DiffSection,
|
|
6398
6258
|
{
|
|
6399
6259
|
file,
|
|
@@ -6419,19 +6279,19 @@ function SourceBadge({
|
|
|
6419
6279
|
label
|
|
6420
6280
|
}) {
|
|
6421
6281
|
if (source === "capture" && capturedAt) {
|
|
6422
|
-
return /* @__PURE__ */
|
|
6282
|
+
return /* @__PURE__ */ jsxs4(
|
|
6423
6283
|
"span",
|
|
6424
6284
|
{
|
|
6425
6285
|
className: "inline-flex items-center gap-1 rounded-og-xs border border-og-border px-1.5 py-px text-og-xs text-og-fg-muted",
|
|
6426
6286
|
title: new Date(capturedAt).toLocaleString(),
|
|
6427
6287
|
children: [
|
|
6428
|
-
/* @__PURE__ */
|
|
6288
|
+
/* @__PURE__ */ jsx4(HistoryIcon, { className: "size-3 shrink-0 text-og-status-running", "aria-hidden": true }),
|
|
6429
6289
|
label
|
|
6430
6290
|
]
|
|
6431
6291
|
}
|
|
6432
6292
|
);
|
|
6433
6293
|
}
|
|
6434
|
-
return /* @__PURE__ */
|
|
6294
|
+
return /* @__PURE__ */ jsx4("span", { className: "rounded-og-xs bg-og-surface-2 px-1.5 py-px text-og-xs text-og-fg-subtle", children: label });
|
|
6435
6295
|
}
|
|
6436
6296
|
function describeSource(source, capturedAt, revision) {
|
|
6437
6297
|
if (source !== "capture" || !capturedAt) return "Live diff";
|
|
@@ -6446,7 +6306,7 @@ function RailFileRow({
|
|
|
6446
6306
|
}) {
|
|
6447
6307
|
const repoPrefix = file.repoRoot ? `${file.repoRoot}/` : null;
|
|
6448
6308
|
const shown = grouped ? file.repoRoot !== void 0 ? repoPrefix && file.path.startsWith(repoPrefix) ? file.path.slice(repoPrefix.length) : file.path : file.path.slice(file.path.indexOf("/") + 1) || file.path : file.path;
|
|
6449
|
-
return /* @__PURE__ */
|
|
6309
|
+
return /* @__PURE__ */ jsxs4(
|
|
6450
6310
|
"button",
|
|
6451
6311
|
{
|
|
6452
6312
|
type: "button",
|
|
@@ -6460,7 +6320,7 @@ function RailFileRow({
|
|
|
6460
6320
|
active && "bg-og-accent-soft text-og-fg before:absolute before:inset-y-1 before:left-0 before:w-0.5 before:rounded-r-full before:bg-og-accent"
|
|
6461
6321
|
),
|
|
6462
6322
|
children: [
|
|
6463
|
-
/* @__PURE__ */
|
|
6323
|
+
/* @__PURE__ */ jsx4(
|
|
6464
6324
|
"span",
|
|
6465
6325
|
{
|
|
6466
6326
|
"data-contrast-audited": true,
|
|
@@ -6468,13 +6328,13 @@ function RailFileRow({
|
|
|
6468
6328
|
children: STATUS_LETTER[file.status]
|
|
6469
6329
|
}
|
|
6470
6330
|
),
|
|
6471
|
-
/* @__PURE__ */
|
|
6472
|
-
/* @__PURE__ */
|
|
6473
|
-
/* @__PURE__ */
|
|
6331
|
+
/* @__PURE__ */ jsx4("span", { className: "min-w-0 flex-1 truncate", children: shown }),
|
|
6332
|
+
/* @__PURE__ */ jsxs4("span", { className: "ml-auto flex shrink-0 items-center gap-1 pl-1 font-og-mono text-og-xs", children: [
|
|
6333
|
+
/* @__PURE__ */ jsxs4("span", { "data-contrast-audited": true, className: "text-og-status-idle", children: [
|
|
6474
6334
|
"+",
|
|
6475
6335
|
file.additions
|
|
6476
6336
|
] }),
|
|
6477
|
-
/* @__PURE__ */
|
|
6337
|
+
/* @__PURE__ */ jsxs4("span", { "data-contrast-audited": true, className: "text-og-status-failed", children: [
|
|
6478
6338
|
"\u2212",
|
|
6479
6339
|
file.deletions
|
|
6480
6340
|
] })
|
|
@@ -6489,8 +6349,8 @@ function MeasuredSection({
|
|
|
6489
6349
|
onMeasure,
|
|
6490
6350
|
children
|
|
6491
6351
|
}) {
|
|
6492
|
-
const ref =
|
|
6493
|
-
|
|
6352
|
+
const ref = useRef13(null);
|
|
6353
|
+
useEffect15(() => {
|
|
6494
6354
|
const el = ref.current;
|
|
6495
6355
|
if (!el) return;
|
|
6496
6356
|
const report = () => onMeasure(index, el.offsetHeight);
|
|
@@ -6499,7 +6359,7 @@ function MeasuredSection({
|
|
|
6499
6359
|
ro?.observe(el);
|
|
6500
6360
|
return () => ro?.disconnect();
|
|
6501
6361
|
}, [index, onMeasure]);
|
|
6502
|
-
return /* @__PURE__ */
|
|
6362
|
+
return /* @__PURE__ */ jsx4(
|
|
6503
6363
|
"div",
|
|
6504
6364
|
{
|
|
6505
6365
|
ref,
|
|
@@ -6518,37 +6378,37 @@ function DiffSection({
|
|
|
6518
6378
|
}) {
|
|
6519
6379
|
if (isGuarded(file)) {
|
|
6520
6380
|
const renamed = file.oldPath && file.oldPath !== file.path;
|
|
6521
|
-
return /* @__PURE__ */
|
|
6522
|
-
/* @__PURE__ */
|
|
6523
|
-
/* @__PURE__ */
|
|
6524
|
-
/* @__PURE__ */
|
|
6525
|
-
/* @__PURE__ */
|
|
6381
|
+
return /* @__PURE__ */ jsxs4("section", { className: "border-b border-og-border pb-1", children: [
|
|
6382
|
+
/* @__PURE__ */ jsxs4("header", { className: "flex items-center justify-between gap-2 bg-og-surface-1 px-3 py-1.5 text-og-sm", children: [
|
|
6383
|
+
/* @__PURE__ */ jsx4("span", { className: "min-w-0 truncate font-og-mono text-og-xs", children: renamed ? `${file.oldPath} \u2192 ${file.path}` : file.path }),
|
|
6384
|
+
/* @__PURE__ */ jsxs4("span", { className: "flex shrink-0 items-center gap-2 font-og-mono text-og-xs", children: [
|
|
6385
|
+
/* @__PURE__ */ jsxs4("span", { className: "text-og-status-idle", children: [
|
|
6526
6386
|
"+",
|
|
6527
6387
|
file.additions
|
|
6528
6388
|
] }),
|
|
6529
|
-
/* @__PURE__ */
|
|
6389
|
+
/* @__PURE__ */ jsxs4("span", { className: "text-og-status-failed", children: [
|
|
6530
6390
|
"\u2212",
|
|
6531
6391
|
file.deletions
|
|
6532
6392
|
] })
|
|
6533
6393
|
] })
|
|
6534
6394
|
] }),
|
|
6535
|
-
/* @__PURE__ */
|
|
6395
|
+
/* @__PURE__ */ jsx4(GuardBody, { file, ...onOpenFile ? { onOpenFile } : {} })
|
|
6536
6396
|
] });
|
|
6537
6397
|
}
|
|
6538
|
-
return /* @__PURE__ */
|
|
6398
|
+
return /* @__PURE__ */ jsx4("section", { "data-pierre-section": true, className: "border-b border-og-border pb-2", children: /* @__PURE__ */ jsx4(PierreDiff, { diff: [file], layout, themeType, className: "px-1" }) });
|
|
6539
6399
|
}
|
|
6540
6400
|
function GuardBody({
|
|
6541
6401
|
file,
|
|
6542
6402
|
onOpenFile
|
|
6543
6403
|
}) {
|
|
6544
6404
|
const reason = file.isBinary ? "Binary file" : "Diff too large to show here";
|
|
6545
|
-
return /* @__PURE__ */
|
|
6546
|
-
/* @__PURE__ */
|
|
6547
|
-
/* @__PURE__ */
|
|
6405
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex flex-wrap items-center gap-2 px-3 py-3 text-og-sm text-og-fg-subtle", children: [
|
|
6406
|
+
/* @__PURE__ */ jsx4(FileWarningIcon, { className: "size-3.5 shrink-0", "aria-hidden": true }),
|
|
6407
|
+
/* @__PURE__ */ jsxs4("span", { className: "min-w-0 flex-1", children: [
|
|
6548
6408
|
reason,
|
|
6549
6409
|
"."
|
|
6550
6410
|
] }),
|
|
6551
|
-
onOpenFile ? /* @__PURE__ */
|
|
6411
|
+
onOpenFile ? /* @__PURE__ */ jsxs4(
|
|
6552
6412
|
"button",
|
|
6553
6413
|
{
|
|
6554
6414
|
type: "button",
|
|
@@ -6556,7 +6416,7 @@ function GuardBody({
|
|
|
6556
6416
|
className: "inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded-og-sm border border-og-border px-2 py-1 text-og-xs font-medium text-og-fg-muted transition-colors hover:border-og-border-strong hover:bg-og-surface-2 hover:text-og-fg focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent pointer-coarse:min-h-11",
|
|
6557
6417
|
children: [
|
|
6558
6418
|
"Open in Files",
|
|
6559
|
-
/* @__PURE__ */
|
|
6419
|
+
/* @__PURE__ */ jsx4(ArrowUpRightIcon, { className: "size-3.5", "aria-hidden": true })
|
|
6560
6420
|
]
|
|
6561
6421
|
}
|
|
6562
6422
|
) : null
|
|
@@ -6566,7 +6426,7 @@ function LayoutToggle({
|
|
|
6566
6426
|
layout,
|
|
6567
6427
|
onChange
|
|
6568
6428
|
}) {
|
|
6569
|
-
return /* @__PURE__ */
|
|
6429
|
+
return /* @__PURE__ */ jsx4("div", { className: "inline-flex items-center rounded-og-sm border border-og-border p-0.5", children: ["unified", "split"].map((value) => /* @__PURE__ */ jsx4(
|
|
6570
6430
|
"button",
|
|
6571
6431
|
{
|
|
6572
6432
|
type: "button",
|
|
@@ -6582,7 +6442,7 @@ function LayoutToggle({
|
|
|
6582
6442
|
}
|
|
6583
6443
|
|
|
6584
6444
|
// src/components/diff-view.tsx
|
|
6585
|
-
import { jsx as
|
|
6445
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
6586
6446
|
function DiffView({
|
|
6587
6447
|
diff,
|
|
6588
6448
|
fallback,
|
|
@@ -6593,9 +6453,9 @@ function DiffView({
|
|
|
6593
6453
|
className
|
|
6594
6454
|
}) {
|
|
6595
6455
|
if (diff.length === 0) {
|
|
6596
|
-
return /* @__PURE__ */
|
|
6456
|
+
return /* @__PURE__ */ jsx5("div", { className: cn("p-3 text-og-sm text-og-fg-subtle", className), children: emptyState ?? (isRepo ? "No changes" : "No repository mounted") });
|
|
6597
6457
|
}
|
|
6598
|
-
return /* @__PURE__ */
|
|
6458
|
+
return /* @__PURE__ */ jsx5(
|
|
6599
6459
|
PierreDiff,
|
|
6600
6460
|
{
|
|
6601
6461
|
diff,
|
|
@@ -6611,10 +6471,10 @@ function DiffView({
|
|
|
6611
6471
|
import {
|
|
6612
6472
|
lazy,
|
|
6613
6473
|
Suspense,
|
|
6614
|
-
useEffect as
|
|
6615
|
-
useState as
|
|
6474
|
+
useEffect as useEffect16,
|
|
6475
|
+
useState as useState12
|
|
6616
6476
|
} from "react";
|
|
6617
|
-
import { jsx as
|
|
6477
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
6618
6478
|
var LazyFile = lazy(async () => {
|
|
6619
6479
|
const mod = await import("@pierre/diffs/react");
|
|
6620
6480
|
return { default: mod.File };
|
|
@@ -6629,8 +6489,8 @@ function PierreFile({
|
|
|
6629
6489
|
fallback,
|
|
6630
6490
|
className
|
|
6631
6491
|
}) {
|
|
6632
|
-
const [failed, setFailed] =
|
|
6633
|
-
|
|
6492
|
+
const [failed, setFailed] = useState12(false);
|
|
6493
|
+
useEffect16(() => {
|
|
6634
6494
|
let cancelled = false;
|
|
6635
6495
|
void import("@pierre/diffs/react").catch(() => {
|
|
6636
6496
|
if (!cancelled) setFailed(true);
|
|
@@ -6641,7 +6501,7 @@ function PierreFile({
|
|
|
6641
6501
|
}, []);
|
|
6642
6502
|
const name = path.split("/").filter(Boolean).pop() ?? path;
|
|
6643
6503
|
if (failed) {
|
|
6644
|
-
return /* @__PURE__ */
|
|
6504
|
+
return /* @__PURE__ */ jsx6("div", { className, children: fallback ?? /* @__PURE__ */ jsx6(PlainFile, { name, contents }) });
|
|
6645
6505
|
}
|
|
6646
6506
|
const options = {
|
|
6647
6507
|
overflow: "scroll",
|
|
@@ -6663,7 +6523,7 @@ function PierreFile({
|
|
|
6663
6523
|
"--diffs-font-size": "var(--og-code-font-size)",
|
|
6664
6524
|
"--diffs-line-height": "var(--og-code-line-height)"
|
|
6665
6525
|
};
|
|
6666
|
-
return /* @__PURE__ */
|
|
6526
|
+
return /* @__PURE__ */ jsx6("div", { className: cn("min-w-0", className), "data-opengeni-pierre-file": true, style: pierreVars, children: /* @__PURE__ */ jsx6(Suspense, { fallback: loading ?? /* @__PURE__ */ jsx6(FileSkeleton, {}), children: /* @__PURE__ */ jsx6(
|
|
6667
6527
|
LazyFile,
|
|
6668
6528
|
{
|
|
6669
6529
|
file: { name, contents },
|
|
@@ -6673,7 +6533,7 @@ function PierreFile({
|
|
|
6673
6533
|
) }) });
|
|
6674
6534
|
}
|
|
6675
6535
|
function PlainFile({ name, contents }) {
|
|
6676
|
-
return /* @__PURE__ */
|
|
6536
|
+
return /* @__PURE__ */ jsx6(
|
|
6677
6537
|
"pre",
|
|
6678
6538
|
{
|
|
6679
6539
|
className: "overflow-auto whitespace-pre p-2 font-og-mono text-og-sm text-og-fg",
|
|
@@ -6683,19 +6543,19 @@ function PlainFile({ name, contents }) {
|
|
|
6683
6543
|
);
|
|
6684
6544
|
}
|
|
6685
6545
|
function FileSkeleton() {
|
|
6686
|
-
return /* @__PURE__ */
|
|
6546
|
+
return /* @__PURE__ */ jsx6("div", { className: "p-3 text-og-sm text-og-fg-subtle", children: "Loading file\u2026" });
|
|
6687
6547
|
}
|
|
6688
6548
|
|
|
6689
6549
|
// src/components/code-editor.tsx
|
|
6690
6550
|
import { Loader2Icon, SaveIcon } from "lucide-react";
|
|
6691
6551
|
import {
|
|
6692
6552
|
useCallback as useCallback21,
|
|
6693
|
-
useEffect as
|
|
6553
|
+
useEffect as useEffect17,
|
|
6694
6554
|
useMemo as useMemo14,
|
|
6695
|
-
useRef as
|
|
6696
|
-
useState as
|
|
6555
|
+
useRef as useRef14,
|
|
6556
|
+
useState as useState13
|
|
6697
6557
|
} from "react";
|
|
6698
|
-
import { jsx as
|
|
6558
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
6699
6559
|
var LANGUAGE_LOADERS = {
|
|
6700
6560
|
javascript: async () => (await import("@codemirror/lang-javascript")).javascript({ jsx: true, typescript: true }),
|
|
6701
6561
|
json: async () => (await import("@codemirror/lang-json")).json(),
|
|
@@ -6765,25 +6625,25 @@ function CodeEditor({
|
|
|
6765
6625
|
fallback,
|
|
6766
6626
|
className
|
|
6767
6627
|
}) {
|
|
6768
|
-
const [failed, setFailed] =
|
|
6769
|
-
const [bundle, setBundle] =
|
|
6770
|
-
const [buffer, setBuffer] =
|
|
6628
|
+
const [failed, setFailed] = useState13(false);
|
|
6629
|
+
const [bundle, setBundle] = useState13(null);
|
|
6630
|
+
const [buffer, setBuffer] = useState13(() => ({
|
|
6771
6631
|
path,
|
|
6772
6632
|
value: initialContents,
|
|
6773
6633
|
baseline: initialContents
|
|
6774
6634
|
}));
|
|
6775
6635
|
const { value, baseline } = buffer;
|
|
6776
|
-
const [saving, setSaving] =
|
|
6777
|
-
const [saveError, setSaveError] =
|
|
6778
|
-
const [savedTick, setSavedTick] =
|
|
6779
|
-
const saveInFlightRef =
|
|
6636
|
+
const [saving, setSaving] = useState13(false);
|
|
6637
|
+
const [saveError, setSaveError] = useState13(null);
|
|
6638
|
+
const [savedTick, setSavedTick] = useState13(false);
|
|
6639
|
+
const saveInFlightRef = useRef14(false);
|
|
6780
6640
|
const dirty = value !== baseline;
|
|
6781
6641
|
const saveConflict = saveError !== null && saveError.code === "file_write_conflict";
|
|
6782
|
-
const editIntentFiredRef =
|
|
6783
|
-
|
|
6642
|
+
const editIntentFiredRef = useRef14(false);
|
|
6643
|
+
useEffect17(() => {
|
|
6784
6644
|
setBuffer((current) => reconcileEditorBuffer(current, { path, contents: initialContents }));
|
|
6785
6645
|
}, [path, initialContents]);
|
|
6786
|
-
|
|
6646
|
+
useEffect17(() => {
|
|
6787
6647
|
editIntentFiredRef.current = false;
|
|
6788
6648
|
setSaveError(null);
|
|
6789
6649
|
setSavedTick(false);
|
|
@@ -6800,7 +6660,7 @@ function CodeEditor({
|
|
|
6800
6660
|
[baseline, onEditIntent]
|
|
6801
6661
|
);
|
|
6802
6662
|
const langKey = useMemo14(() => languageForPath(path), [path]);
|
|
6803
|
-
|
|
6663
|
+
useEffect17(() => {
|
|
6804
6664
|
let cancelled = false;
|
|
6805
6665
|
void (async () => {
|
|
6806
6666
|
try {
|
|
@@ -6840,7 +6700,7 @@ function CodeEditor({
|
|
|
6840
6700
|
cancelled = true;
|
|
6841
6701
|
};
|
|
6842
6702
|
}, [langKey]);
|
|
6843
|
-
const saveRef =
|
|
6703
|
+
const saveRef = useRef14(() => {
|
|
6844
6704
|
});
|
|
6845
6705
|
const save = useCallback21(async () => {
|
|
6846
6706
|
if (readOnly || saveInFlightRef.current) return;
|
|
@@ -6887,7 +6747,7 @@ function CodeEditor({
|
|
|
6887
6747
|
saveRef.current = () => {
|
|
6888
6748
|
void save();
|
|
6889
6749
|
};
|
|
6890
|
-
|
|
6750
|
+
useEffect17(() => {
|
|
6891
6751
|
if (!savedTick) return;
|
|
6892
6752
|
const t = setTimeout(() => setSavedTick(false), 1800);
|
|
6893
6753
|
return () => clearTimeout(t);
|
|
@@ -6907,7 +6767,7 @@ function CodeEditor({
|
|
|
6907
6767
|
setSavedTick(false);
|
|
6908
6768
|
onReload?.();
|
|
6909
6769
|
}, [initialContents, onReload, path]);
|
|
6910
|
-
return /* @__PURE__ */
|
|
6770
|
+
return /* @__PURE__ */ jsxs5(
|
|
6911
6771
|
"div",
|
|
6912
6772
|
{
|
|
6913
6773
|
className: cn("flex h-full min-h-0 flex-col", className),
|
|
@@ -6915,8 +6775,8 @@ function CodeEditor({
|
|
|
6915
6775
|
"data-opengeni-editor-dirty": dirty ? "true" : "false",
|
|
6916
6776
|
style: editorVars,
|
|
6917
6777
|
children: [
|
|
6918
|
-
/* @__PURE__ */
|
|
6919
|
-
/* @__PURE__ */
|
|
6778
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex min-h-9 shrink-0 items-center gap-2 border-b border-og-border bg-og-surface-1 px-2 py-1", children: [
|
|
6779
|
+
/* @__PURE__ */ jsx7(
|
|
6920
6780
|
"span",
|
|
6921
6781
|
{
|
|
6922
6782
|
className: cn(
|
|
@@ -6926,12 +6786,12 @@ function CodeEditor({
|
|
|
6926
6786
|
title: readOnly ? "read-only" : dirty ? "unsaved changes" : "saved"
|
|
6927
6787
|
}
|
|
6928
6788
|
),
|
|
6929
|
-
/* @__PURE__ */
|
|
6789
|
+
/* @__PURE__ */ jsxs5("span", { className: "truncate font-og-mono text-og-xs text-og-fg-muted", children: [
|
|
6930
6790
|
fileName,
|
|
6931
6791
|
dirty && !readOnly ? " \u2022" : ""
|
|
6932
6792
|
] }),
|
|
6933
|
-
/* @__PURE__ */
|
|
6934
|
-
saveError && !saveConflict && /* @__PURE__ */
|
|
6793
|
+
/* @__PURE__ */ jsxs5("div", { className: "ml-auto flex shrink-0 items-center gap-2", children: [
|
|
6794
|
+
saveError && !saveConflict && /* @__PURE__ */ jsx7(
|
|
6935
6795
|
"span",
|
|
6936
6796
|
{
|
|
6937
6797
|
className: "max-w-[220px] truncate text-og-xs text-og-status-failed",
|
|
@@ -6939,8 +6799,8 @@ function CodeEditor({
|
|
|
6939
6799
|
children: saveError.message
|
|
6940
6800
|
}
|
|
6941
6801
|
),
|
|
6942
|
-
!saveError && savedTick && !dirty && /* @__PURE__ */
|
|
6943
|
-
readOnly ? /* @__PURE__ */
|
|
6802
|
+
!saveError && savedTick && !dirty && /* @__PURE__ */ jsx7("span", { className: "text-og-xs text-og-status-idle", children: "Saved" }),
|
|
6803
|
+
readOnly ? /* @__PURE__ */ jsx7("span", { className: "text-og-xs uppercase tracking-wide text-og-fg-subtle", children: "Read-only" }) : !saveConflict ? /* @__PURE__ */ jsxs5(
|
|
6944
6804
|
"button",
|
|
6945
6805
|
{
|
|
6946
6806
|
type: "button",
|
|
@@ -6952,26 +6812,26 @@ function CodeEditor({
|
|
|
6952
6812
|
),
|
|
6953
6813
|
title: "Save (\u2318/Ctrl+S)",
|
|
6954
6814
|
children: [
|
|
6955
|
-
saving ? /* @__PURE__ */
|
|
6815
|
+
saving ? /* @__PURE__ */ jsx7(Loader2Icon, { className: "size-3 animate-spin" }) : /* @__PURE__ */ jsx7(SaveIcon, { className: "size-3" }),
|
|
6956
6816
|
"Save"
|
|
6957
6817
|
]
|
|
6958
6818
|
}
|
|
6959
6819
|
) : null
|
|
6960
6820
|
] })
|
|
6961
6821
|
] }),
|
|
6962
|
-
saveConflict ? /* @__PURE__ */
|
|
6822
|
+
saveConflict ? /* @__PURE__ */ jsxs5(
|
|
6963
6823
|
"div",
|
|
6964
6824
|
{
|
|
6965
6825
|
className: "flex shrink-0 flex-wrap items-center gap-x-3 gap-y-2 border-b border-og-status-failed/25 bg-og-status-failed/8 px-2 py-2",
|
|
6966
6826
|
role: "alert",
|
|
6967
6827
|
children: [
|
|
6968
|
-
/* @__PURE__ */
|
|
6969
|
-
/* @__PURE__ */
|
|
6828
|
+
/* @__PURE__ */ jsxs5("div", { className: "min-w-[12rem] flex-1 text-og-xs text-og-fg-muted", children: [
|
|
6829
|
+
/* @__PURE__ */ jsx7("span", { className: "font-medium text-og-status-failed", children: "File changed on machine." }),
|
|
6970
6830
|
" ",
|
|
6971
6831
|
"Reloading discards your edits; overwriting replaces the live version."
|
|
6972
6832
|
] }),
|
|
6973
|
-
/* @__PURE__ */
|
|
6974
|
-
onReload ? /* @__PURE__ */
|
|
6833
|
+
/* @__PURE__ */ jsxs5("div", { className: "ml-auto flex shrink-0 items-center gap-1.5", children: [
|
|
6834
|
+
onReload ? /* @__PURE__ */ jsx7(
|
|
6975
6835
|
"button",
|
|
6976
6836
|
{
|
|
6977
6837
|
type: "button",
|
|
@@ -6982,7 +6842,7 @@ function CodeEditor({
|
|
|
6982
6842
|
children: "Reload live"
|
|
6983
6843
|
}
|
|
6984
6844
|
) : null,
|
|
6985
|
-
onOverwrite ? /* @__PURE__ */
|
|
6845
|
+
onOverwrite ? /* @__PURE__ */ jsx7(
|
|
6986
6846
|
"button",
|
|
6987
6847
|
{
|
|
6988
6848
|
type: "button",
|
|
@@ -6996,7 +6856,7 @@ function CodeEditor({
|
|
|
6996
6856
|
]
|
|
6997
6857
|
}
|
|
6998
6858
|
) : null,
|
|
6999
|
-
/* @__PURE__ */
|
|
6859
|
+
/* @__PURE__ */ jsx7("div", { className: "min-h-0 flex-1 overflow-auto", children: failed ? fallback ?? /* @__PURE__ */ jsx7(
|
|
7000
6860
|
PlainTextarea,
|
|
7001
6861
|
{
|
|
7002
6862
|
value,
|
|
@@ -7004,7 +6864,7 @@ function CodeEditor({
|
|
|
7004
6864
|
onChange: noteEdit,
|
|
7005
6865
|
onSave: () => void save()
|
|
7006
6866
|
}
|
|
7007
|
-
) : Editor ? /* @__PURE__ */
|
|
6867
|
+
) : Editor ? /* @__PURE__ */ jsx7(
|
|
7008
6868
|
Editor,
|
|
7009
6869
|
{
|
|
7010
6870
|
value,
|
|
@@ -7017,7 +6877,7 @@ function CodeEditor({
|
|
|
7017
6877
|
className: "og-cm-editor min-h-full text-og-sm",
|
|
7018
6878
|
onChange: readOnly ? void 0 : noteEdit
|
|
7019
6879
|
}
|
|
7020
|
-
) : loading ?? /* @__PURE__ */
|
|
6880
|
+
) : loading ?? /* @__PURE__ */ jsx7(EditorSkeleton, {}) })
|
|
7021
6881
|
]
|
|
7022
6882
|
}
|
|
7023
6883
|
);
|
|
@@ -7032,7 +6892,7 @@ function PlainTextarea({
|
|
|
7032
6892
|
onChange,
|
|
7033
6893
|
onSave
|
|
7034
6894
|
}) {
|
|
7035
|
-
return /* @__PURE__ */
|
|
6895
|
+
return /* @__PURE__ */ jsx7(
|
|
7036
6896
|
"textarea",
|
|
7037
6897
|
{
|
|
7038
6898
|
value,
|
|
@@ -7051,14 +6911,14 @@ function PlainTextarea({
|
|
|
7051
6911
|
);
|
|
7052
6912
|
}
|
|
7053
6913
|
function EditorSkeleton() {
|
|
7054
|
-
return /* @__PURE__ */
|
|
6914
|
+
return /* @__PURE__ */ jsx7("div", { className: "p-3 text-og-sm text-og-fg-subtle", children: "Loading editor\u2026" });
|
|
7055
6915
|
}
|
|
7056
6916
|
|
|
7057
6917
|
// src/components/sandbox-files.tsx
|
|
7058
6918
|
import { FileCode2Icon, FileWarningIcon as FileWarningIcon2, LoaderCircleIcon } from "lucide-react";
|
|
7059
|
-
import { useCallback as useCallback22, useEffect as
|
|
6919
|
+
import { useCallback as useCallback22, useEffect as useEffect18, useRef as useRef15, useState as useState14 } from "react";
|
|
7060
6920
|
import { Group, Panel, Separator } from "react-resizable-panels";
|
|
7061
|
-
import { Fragment as
|
|
6921
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
7062
6922
|
function SandboxFiles({
|
|
7063
6923
|
files,
|
|
7064
6924
|
git,
|
|
@@ -7081,17 +6941,17 @@ function SandboxFiles({
|
|
|
7081
6941
|
themeType,
|
|
7082
6942
|
className
|
|
7083
6943
|
}) {
|
|
7084
|
-
const [selected, setSelected] =
|
|
7085
|
-
const [editMode, setEditMode] =
|
|
7086
|
-
const [focusLine, setFocusLine] =
|
|
7087
|
-
const [treeRevealRequest, setTreeRevealRequest] =
|
|
7088
|
-
const [liveRequestedPath, setLiveRequestedPath] =
|
|
7089
|
-
const [viewReloadRevision, setViewReloadRevision] =
|
|
7090
|
-
const viewerScrollRef =
|
|
7091
|
-
const pendingRequestRef =
|
|
7092
|
-
const handledRequestRef =
|
|
6944
|
+
const [selected, setSelected] = useState14(() => initialSelectedPath ?? null);
|
|
6945
|
+
const [editMode, setEditMode] = useState14(false);
|
|
6946
|
+
const [focusLine, setFocusLine] = useState14(null);
|
|
6947
|
+
const [treeRevealRequest, setTreeRevealRequest] = useState14(null);
|
|
6948
|
+
const [liveRequestedPath, setLiveRequestedPath] = useState14(null);
|
|
6949
|
+
const [viewReloadRevision, setViewReloadRevision] = useState14(0);
|
|
6950
|
+
const viewerScrollRef = useRef15(null);
|
|
6951
|
+
const pendingRequestRef = useRef15(null);
|
|
6952
|
+
const handledRequestRef = useRef15(null);
|
|
7093
6953
|
const requestKey = requestedPath ? requestedPathRequestId ?? requestedPath : null;
|
|
7094
|
-
|
|
6954
|
+
useEffect18(() => {
|
|
7095
6955
|
if (!requestedPath || requestKey === null) {
|
|
7096
6956
|
pendingRequestRef.current = null;
|
|
7097
6957
|
handledRequestRef.current = null;
|
|
@@ -7137,9 +6997,9 @@ function SandboxFiles({
|
|
|
7137
6997
|
requestedPath,
|
|
7138
6998
|
requestedPathReady
|
|
7139
6999
|
]);
|
|
7140
|
-
const rootRef =
|
|
7141
|
-
const [wide, setWide] =
|
|
7142
|
-
|
|
7000
|
+
const rootRef = useRef15(null);
|
|
7001
|
+
const [wide, setWide] = useState14(false);
|
|
7002
|
+
useEffect18(() => {
|
|
7143
7003
|
const el = rootRef.current;
|
|
7144
7004
|
if (!el) return;
|
|
7145
7005
|
const update = () => setWide(el.getBoundingClientRect().width >= 720);
|
|
@@ -7162,7 +7022,7 @@ function SandboxFiles({
|
|
|
7162
7022
|
const selectedVisibility = selected ? filePathVisibility(files.tree, selected, isNodeVisible) : "unknown";
|
|
7163
7023
|
const visibilityPending = Boolean(isNodeVisible && files.loading && files.tree.length === 0);
|
|
7164
7024
|
const viewPath = selectedVisibility === "hidden" || visibilityPending ? null : selected;
|
|
7165
|
-
|
|
7025
|
+
useEffect18(() => {
|
|
7166
7026
|
if (selected === null || selectedVisibility !== "hidden") return;
|
|
7167
7027
|
setSelected(null);
|
|
7168
7028
|
onSelectedPathChange?.(null);
|
|
@@ -7176,7 +7036,7 @@ function SandboxFiles({
|
|
|
7176
7036
|
files.readFile,
|
|
7177
7037
|
`${files.contentRevision ?? 0}:${viewReloadRevision}`
|
|
7178
7038
|
);
|
|
7179
|
-
|
|
7039
|
+
useEffect18(() => {
|
|
7180
7040
|
if (focusLine === null && viewReloadRevision > 0 && viewerScrollRef.current) {
|
|
7181
7041
|
viewerScrollRef.current.scrollTop = 0;
|
|
7182
7042
|
}
|
|
@@ -7202,45 +7062,45 @@ function SandboxFiles({
|
|
|
7202
7062
|
const captureFileUnavailable = fileView.error instanceof CapturedFileUnavailableError ? fileView.error : null;
|
|
7203
7063
|
const waitingForSelectedFile = !workspaceError && liveRequestedPath === viewPath && (!liveWorkspaceReady || files.loading) && captureFileUnavailable !== null;
|
|
7204
7064
|
if (workspaceError && !liveWorkspaceReady && files.source !== "capture") {
|
|
7205
|
-
return /* @__PURE__ */
|
|
7206
|
-
/* @__PURE__ */
|
|
7207
|
-
onWakeWorkspace ? /* @__PURE__ */
|
|
7065
|
+
return /* @__PURE__ */ jsxs6(Notice, { className, title: "Could not open live workspace", announce: "alert", children: [
|
|
7066
|
+
/* @__PURE__ */ jsx8("p", { children: workspaceError.message }),
|
|
7067
|
+
onWakeWorkspace ? /* @__PURE__ */ jsx8(WakeButton, { onClick: onWakeWorkspace, children: "Retry live workspace" }) : null
|
|
7208
7068
|
] });
|
|
7209
7069
|
}
|
|
7210
7070
|
if (workspaceResting || workspaceWaking) {
|
|
7211
|
-
return /* @__PURE__ */
|
|
7071
|
+
return /* @__PURE__ */ jsx8("div", { className: cn("h-full", className), "data-opengeni-workspace-resting": true, children: /* @__PURE__ */ jsxs6(
|
|
7212
7072
|
Notice,
|
|
7213
7073
|
{
|
|
7214
|
-
icon: workspaceWaking ? /* @__PURE__ */
|
|
7074
|
+
icon: workspaceWaking ? /* @__PURE__ */ jsx8(
|
|
7215
7075
|
LoaderCircleIcon,
|
|
7216
7076
|
{
|
|
7217
7077
|
className: "size-5 animate-spin motion-reduce:animate-none",
|
|
7218
7078
|
"aria-hidden": true
|
|
7219
7079
|
}
|
|
7220
|
-
) : /* @__PURE__ */
|
|
7080
|
+
) : /* @__PURE__ */ jsx8(FileCode2Icon, { className: "size-5", "aria-hidden": true }),
|
|
7221
7081
|
title: workspaceWaking ? "Waking workspace" : "Workspace is resting",
|
|
7222
7082
|
announce: "status",
|
|
7223
7083
|
children: [
|
|
7224
|
-
/* @__PURE__ */
|
|
7225
|
-
!workspaceWaking && onWakeWorkspace ? /* @__PURE__ */
|
|
7084
|
+
/* @__PURE__ */ jsx8("p", { children: workspaceWaking ? "Connecting to the live file system\u2026" : "No captured revision is available yet. Wake the sandbox to browse its current files." }),
|
|
7085
|
+
!workspaceWaking && onWakeWorkspace ? /* @__PURE__ */ jsx8(WakeButton, { onClick: onWakeWorkspace, children: "Open live workspace" }) : null
|
|
7226
7086
|
]
|
|
7227
7087
|
}
|
|
7228
7088
|
) });
|
|
7229
7089
|
}
|
|
7230
7090
|
if (!fileSystemAvailable) {
|
|
7231
|
-
return /* @__PURE__ */
|
|
7091
|
+
return /* @__PURE__ */ jsx8(
|
|
7232
7092
|
Notice,
|
|
7233
7093
|
{
|
|
7234
7094
|
className,
|
|
7235
|
-
icon: /* @__PURE__ */
|
|
7095
|
+
icon: /* @__PURE__ */ jsx8(FileWarningIcon2, { className: "size-5", "aria-hidden": true }),
|
|
7236
7096
|
title: "Files unavailable",
|
|
7237
7097
|
announce: "alert",
|
|
7238
7098
|
children: "This sandbox does not expose a file system."
|
|
7239
7099
|
}
|
|
7240
7100
|
);
|
|
7241
7101
|
}
|
|
7242
|
-
return /* @__PURE__ */
|
|
7243
|
-
/* @__PURE__ */
|
|
7102
|
+
return /* @__PURE__ */ jsxs6("div", { ref: rootRef, className: cn("flex h-full min-h-0 min-w-0 flex-col", className), children: [
|
|
7103
|
+
/* @__PURE__ */ jsx8(
|
|
7244
7104
|
GitHeader,
|
|
7245
7105
|
{
|
|
7246
7106
|
loading: Boolean(files.loading || files.gitLoading || files.source === null || git?.loading) && files.gitSummary === null,
|
|
@@ -7254,13 +7114,13 @@ function SandboxFiles({
|
|
|
7254
7114
|
}
|
|
7255
7115
|
}
|
|
7256
7116
|
),
|
|
7257
|
-
/* @__PURE__ */
|
|
7117
|
+
/* @__PURE__ */ jsxs6(
|
|
7258
7118
|
Group,
|
|
7259
7119
|
{
|
|
7260
7120
|
orientation: wide ? "horizontal" : "vertical",
|
|
7261
7121
|
className: cn("min-h-0 flex-1", wide ? "flex-row" : "flex-col"),
|
|
7262
7122
|
children: [
|
|
7263
|
-
/* @__PURE__ */
|
|
7123
|
+
/* @__PURE__ */ jsx8(
|
|
7264
7124
|
Panel,
|
|
7265
7125
|
{
|
|
7266
7126
|
id: "sandbox-files-tree",
|
|
@@ -7268,7 +7128,7 @@ function SandboxFiles({
|
|
|
7268
7128
|
minSize: wide ? "180px" : "120px",
|
|
7269
7129
|
maxSize: wide ? "60%" : "70%",
|
|
7270
7130
|
className: "flex min-h-0 min-w-0 flex-col",
|
|
7271
|
-
children: /* @__PURE__ */
|
|
7131
|
+
children: /* @__PURE__ */ jsx8(
|
|
7272
7132
|
FileBrowser,
|
|
7273
7133
|
{
|
|
7274
7134
|
result: files,
|
|
@@ -7286,7 +7146,7 @@ function SandboxFiles({
|
|
|
7286
7146
|
)
|
|
7287
7147
|
}
|
|
7288
7148
|
),
|
|
7289
|
-
/* @__PURE__ */
|
|
7149
|
+
/* @__PURE__ */ jsx8(
|
|
7290
7150
|
Separator,
|
|
7291
7151
|
{
|
|
7292
7152
|
"aria-label": "Resize file tree",
|
|
@@ -7298,15 +7158,15 @@ function SandboxFiles({
|
|
|
7298
7158
|
)
|
|
7299
7159
|
}
|
|
7300
7160
|
),
|
|
7301
|
-
/* @__PURE__ */
|
|
7161
|
+
/* @__PURE__ */ jsxs6(
|
|
7302
7162
|
Panel,
|
|
7303
7163
|
{
|
|
7304
7164
|
id: "sandbox-files-viewer",
|
|
7305
7165
|
minSize: wide ? "240px" : "160px",
|
|
7306
7166
|
className: cn("flex min-h-0 min-w-0 flex-col", !wide && "border-t border-og-border"),
|
|
7307
7167
|
children: [
|
|
7308
|
-
/* @__PURE__ */
|
|
7309
|
-
/* @__PURE__ */
|
|
7168
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex shrink-0 items-center justify-between gap-2 border-b border-og-border bg-og-surface-1 px-2 py-1", children: [
|
|
7169
|
+
/* @__PURE__ */ jsx8(
|
|
7310
7170
|
"span",
|
|
7311
7171
|
{
|
|
7312
7172
|
"data-opengeni-selected-file": true,
|
|
@@ -7314,7 +7174,7 @@ function SandboxFiles({
|
|
|
7314
7174
|
children: selected ? focusLine !== null ? `${selected}:${focusLine}` : selected : "No file selected"
|
|
7315
7175
|
}
|
|
7316
7176
|
),
|
|
7317
|
-
canEdit && /* @__PURE__ */
|
|
7177
|
+
canEdit && /* @__PURE__ */ jsx8(
|
|
7318
7178
|
Segmented,
|
|
7319
7179
|
{
|
|
7320
7180
|
options: [
|
|
@@ -7326,13 +7186,13 @@ function SandboxFiles({
|
|
|
7326
7186
|
}
|
|
7327
7187
|
)
|
|
7328
7188
|
] }),
|
|
7329
|
-
/* @__PURE__ */
|
|
7189
|
+
/* @__PURE__ */ jsx8(
|
|
7330
7190
|
"div",
|
|
7331
7191
|
{
|
|
7332
7192
|
ref: viewerScrollRef,
|
|
7333
7193
|
className: "min-h-0 flex-1 overflow-auto",
|
|
7334
7194
|
"data-opengeni-file-viewer-scroll": true,
|
|
7335
|
-
children: viewPath ? showEditor && fileView.content !== null ? /* @__PURE__ */
|
|
7195
|
+
children: viewPath ? showEditor && fileView.content !== null ? /* @__PURE__ */ jsx8(
|
|
7336
7196
|
CodeEditor,
|
|
7337
7197
|
{
|
|
7338
7198
|
path: viewPath,
|
|
@@ -7345,13 +7205,13 @@ function SandboxFiles({
|
|
|
7345
7205
|
className: "h-full"
|
|
7346
7206
|
},
|
|
7347
7207
|
viewPath
|
|
7348
|
-
) : workspaceError && (liveRequestedPath === viewPath || requestedPath === viewPath) && !liveWorkspaceReady ? /* @__PURE__ */
|
|
7349
|
-
/* @__PURE__ */
|
|
7350
|
-
onWakeWorkspace ? /* @__PURE__ */
|
|
7351
|
-
] }) : waitingForSelectedFile ? /* @__PURE__ */
|
|
7208
|
+
) : workspaceError && (liveRequestedPath === viewPath || requestedPath === viewPath) && !liveWorkspaceReady ? /* @__PURE__ */ jsxs6(Notice, { title: "Could not open live file", announce: "alert", children: [
|
|
7209
|
+
/* @__PURE__ */ jsx8("p", { children: workspaceError.message }),
|
|
7210
|
+
onWakeWorkspace ? /* @__PURE__ */ jsx8(WakeButton, { onClick: onWakeWorkspace, children: "Retry live file" }) : null
|
|
7211
|
+
] }) : waitingForSelectedFile ? /* @__PURE__ */ jsxs6(
|
|
7352
7212
|
Notice,
|
|
7353
7213
|
{
|
|
7354
|
-
icon: /* @__PURE__ */
|
|
7214
|
+
icon: /* @__PURE__ */ jsx8(
|
|
7355
7215
|
LoaderCircleIcon,
|
|
7356
7216
|
{
|
|
7357
7217
|
className: "size-5 animate-spin motion-reduce:animate-none",
|
|
@@ -7366,9 +7226,9 @@ function SandboxFiles({
|
|
|
7366
7226
|
" when the live file system is ready\u2026"
|
|
7367
7227
|
]
|
|
7368
7228
|
}
|
|
7369
|
-
) : captureFileUnavailable ? /* @__PURE__ */
|
|
7370
|
-
/* @__PURE__ */
|
|
7371
|
-
onWakeWorkspace ? /* @__PURE__ */
|
|
7229
|
+
) : captureFileUnavailable ? /* @__PURE__ */ jsxs6(Notice, { icon: /* @__PURE__ */ jsx8(FileCode2Icon, { className: "size-5", "aria-hidden": true }), title: "On machine", children: [
|
|
7230
|
+
/* @__PURE__ */ jsx8("p", { children: captureFileUnavailable.reason === "too-large" ? "This file is larger than the captured preview limit." : captureFileUnavailable.reason === "content-missing" ? "The captured copy is no longer available." : "This file was indexed, but it was not changed in the captured turn." }),
|
|
7231
|
+
onWakeWorkspace ? /* @__PURE__ */ jsx8(
|
|
7372
7232
|
WakeButton,
|
|
7373
7233
|
{
|
|
7374
7234
|
onClick: () => {
|
|
@@ -7379,64 +7239,64 @@ function SandboxFiles({
|
|
|
7379
7239
|
children: liveWorkspaceReady ? "Retry live file" : "Open live file"
|
|
7380
7240
|
}
|
|
7381
7241
|
) : null
|
|
7382
|
-
] }) : fileView.error ? /* @__PURE__ */
|
|
7242
|
+
] }) : fileView.error ? /* @__PURE__ */ jsxs6(Notice, { announce: "alert", children: [
|
|
7383
7243
|
"Could not open ",
|
|
7384
7244
|
viewPath,
|
|
7385
7245
|
": ",
|
|
7386
7246
|
fileView.error.message
|
|
7387
|
-
] }) : fileView.loading ? /* @__PURE__ */
|
|
7247
|
+
] }) : fileView.loading ? /* @__PURE__ */ jsxs6(Notice, { announce: "status", children: [
|
|
7388
7248
|
"Loading ",
|
|
7389
7249
|
viewPath,
|
|
7390
7250
|
"\u2026"
|
|
7391
|
-
] }) : fileView.imageUrl ? /* @__PURE__ */
|
|
7251
|
+
] }) : fileView.imageUrl ? /* @__PURE__ */ jsx8(
|
|
7392
7252
|
RasterFilePreview,
|
|
7393
7253
|
{
|
|
7394
7254
|
src: fileView.imageUrl,
|
|
7395
7255
|
path: viewPath
|
|
7396
7256
|
},
|
|
7397
7257
|
fileView.imageUrl
|
|
7398
|
-
) : fileView.isBinary ? /* @__PURE__ */
|
|
7258
|
+
) : fileView.isBinary ? /* @__PURE__ */ jsxs6(Notice, { children: [
|
|
7399
7259
|
viewPath,
|
|
7400
7260
|
" is a binary file (",
|
|
7401
7261
|
fileView.sizeBytes ?? 0,
|
|
7402
7262
|
" bytes)."
|
|
7403
|
-
] }) : fileView.content !== null ? /* @__PURE__ */
|
|
7404
|
-
fileView.truncated && /* @__PURE__ */
|
|
7263
|
+
] }) : fileView.content !== null ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
7264
|
+
fileView.truncated && /* @__PURE__ */ jsxs6("div", { className: "border-b border-og-border bg-og-surface-1 px-2 py-1 text-og-xs text-og-status-running", children: [
|
|
7405
7265
|
"Large file \u2014 showing a truncated preview (",
|
|
7406
7266
|
fileView.sizeBytes ?? 0,
|
|
7407
7267
|
" bytes loaded). Editing is disabled to avoid corrupting the file."
|
|
7408
7268
|
] }),
|
|
7409
|
-
usePierre && focusLine === null ? /* @__PURE__ */
|
|
7269
|
+
usePierre && focusLine === null ? /* @__PURE__ */ jsx8(
|
|
7410
7270
|
PierreFile,
|
|
7411
7271
|
{
|
|
7412
7272
|
path: viewPath,
|
|
7413
7273
|
contents: fileView.content,
|
|
7414
7274
|
themeType: resolvedTheme,
|
|
7415
|
-
fallback: /* @__PURE__ */
|
|
7275
|
+
fallback: /* @__PURE__ */ jsx8("pre", { className: "overflow-auto whitespace-pre p-2 font-og-mono text-og-sm text-og-fg", children: fileView.content }),
|
|
7416
7276
|
className: "p-1"
|
|
7417
7277
|
},
|
|
7418
7278
|
`${viewPath}:${viewReloadRevision}`
|
|
7419
|
-
) : focusLine !== null ? /* @__PURE__ */
|
|
7279
|
+
) : focusLine !== null ? /* @__PURE__ */ jsx8(
|
|
7420
7280
|
LineNumberedFile,
|
|
7421
7281
|
{
|
|
7422
7282
|
path: viewPath,
|
|
7423
7283
|
contents: fileView.content,
|
|
7424
7284
|
focusLine
|
|
7425
7285
|
}
|
|
7426
|
-
) : /* @__PURE__ */
|
|
7427
|
-
] }) : /* @__PURE__ */
|
|
7286
|
+
) : /* @__PURE__ */ jsx8("pre", { className: "overflow-auto whitespace-pre p-2 font-og-mono text-og-sm text-og-fg", children: fileView.content })
|
|
7287
|
+
] }) : /* @__PURE__ */ jsxs6(Notice, { announce: "status", children: [
|
|
7428
7288
|
"Loading ",
|
|
7429
7289
|
viewPath,
|
|
7430
7290
|
"\u2026"
|
|
7431
7291
|
] }) : (
|
|
7432
7292
|
// Nothing selected — the tree shows the whole workspace; pick a file.
|
|
7433
|
-
requestedPath && !requestedPathReady ? workspaceError ? /* @__PURE__ */
|
|
7434
|
-
/* @__PURE__ */
|
|
7435
|
-
onWakeWorkspace ? /* @__PURE__ */
|
|
7436
|
-
] }) : /* @__PURE__ */
|
|
7293
|
+
requestedPath && !requestedPathReady ? workspaceError ? /* @__PURE__ */ jsxs6(Notice, { title: "Could not open live file", announce: "alert", children: [
|
|
7294
|
+
/* @__PURE__ */ jsx8("p", { children: workspaceError.message }),
|
|
7295
|
+
onWakeWorkspace ? /* @__PURE__ */ jsx8(WakeButton, { onClick: onWakeWorkspace, children: "Retry live file" }) : null
|
|
7296
|
+
] }) : /* @__PURE__ */ jsxs6(
|
|
7437
7297
|
Notice,
|
|
7438
7298
|
{
|
|
7439
|
-
icon: /* @__PURE__ */
|
|
7299
|
+
icon: /* @__PURE__ */ jsx8(
|
|
7440
7300
|
LoaderCircleIcon,
|
|
7441
7301
|
{
|
|
7442
7302
|
className: "size-5 animate-spin motion-reduce:animate-none",
|
|
@@ -7451,7 +7311,7 @@ function SandboxFiles({
|
|
|
7451
7311
|
" when the live workspace is ready\u2026"
|
|
7452
7312
|
]
|
|
7453
7313
|
}
|
|
7454
|
-
) : /* @__PURE__ */
|
|
7314
|
+
) : /* @__PURE__ */ jsx8(Notice, { icon: /* @__PURE__ */ jsx8(FileCode2Icon, { className: "size-5", "aria-hidden": true }), title: "Choose a file", children: "Select a file in the tree to preview it." })
|
|
7455
7315
|
)
|
|
7456
7316
|
}
|
|
7457
7317
|
)
|
|
@@ -7464,7 +7324,7 @@ function SandboxFiles({
|
|
|
7464
7324
|
] });
|
|
7465
7325
|
}
|
|
7466
7326
|
function WakeButton({ children, onClick }) {
|
|
7467
|
-
return /* @__PURE__ */
|
|
7327
|
+
return /* @__PURE__ */ jsx8(
|
|
7468
7328
|
"button",
|
|
7469
7329
|
{
|
|
7470
7330
|
type: "button",
|
|
@@ -7481,21 +7341,21 @@ function LineNumberedFile({
|
|
|
7481
7341
|
}) {
|
|
7482
7342
|
const lines = contents.split("\n");
|
|
7483
7343
|
const inRange = focusLine >= 1 && focusLine <= lines.length;
|
|
7484
|
-
const targetRef =
|
|
7485
|
-
|
|
7344
|
+
const targetRef = useRef15(null);
|
|
7345
|
+
useEffect18(() => {
|
|
7486
7346
|
targetRef.current?.scrollIntoView({
|
|
7487
7347
|
block: "center",
|
|
7488
7348
|
behavior: prefersReducedMotion() ? "auto" : "smooth"
|
|
7489
7349
|
});
|
|
7490
7350
|
}, [path, focusLine, contents]);
|
|
7491
|
-
return /* @__PURE__ */
|
|
7351
|
+
return /* @__PURE__ */ jsxs6(
|
|
7492
7352
|
"div",
|
|
7493
7353
|
{
|
|
7494
7354
|
className: "h-full min-h-0 overflow-auto font-og-mono text-og-sm text-og-fg",
|
|
7495
7355
|
role: "region",
|
|
7496
7356
|
"aria-label": inRange ? `${path} at line ${focusLine}` : path,
|
|
7497
7357
|
children: [
|
|
7498
|
-
!inRange ? /* @__PURE__ */
|
|
7358
|
+
!inRange ? /* @__PURE__ */ jsxs6(
|
|
7499
7359
|
"p",
|
|
7500
7360
|
{
|
|
7501
7361
|
className: "border-b border-og-border bg-og-surface-1 px-2 py-1 text-og-xs text-og-fg-muted",
|
|
@@ -7507,10 +7367,10 @@ function LineNumberedFile({
|
|
|
7507
7367
|
]
|
|
7508
7368
|
}
|
|
7509
7369
|
) : null,
|
|
7510
|
-
/* @__PURE__ */
|
|
7370
|
+
/* @__PURE__ */ jsx8("div", { children: lines.map((text, index) => {
|
|
7511
7371
|
const lineNumber = index + 1;
|
|
7512
7372
|
const focused = inRange && lineNumber === focusLine;
|
|
7513
|
-
return /* @__PURE__ */
|
|
7373
|
+
return /* @__PURE__ */ jsxs6(
|
|
7514
7374
|
"div",
|
|
7515
7375
|
{
|
|
7516
7376
|
ref: focused ? targetRef : void 0,
|
|
@@ -7519,8 +7379,8 @@ function LineNumberedFile({
|
|
|
7519
7379
|
"aria-current": focused ? "location" : void 0,
|
|
7520
7380
|
className: cn("flex gap-3 px-2 py-0.5 leading-6", focused && "bg-og-accent-soft"),
|
|
7521
7381
|
children: [
|
|
7522
|
-
/* @__PURE__ */
|
|
7523
|
-
/* @__PURE__ */
|
|
7382
|
+
/* @__PURE__ */ jsx8("span", { className: "w-11 shrink-0 select-none text-right tabular-nums text-og-fg-subtle", children: lineNumber }),
|
|
7383
|
+
/* @__PURE__ */ jsx8("pre", { className: "min-w-0 flex-1 whitespace-pre-wrap break-words", children: text || " " })
|
|
7524
7384
|
]
|
|
7525
7385
|
},
|
|
7526
7386
|
lineNumber
|
|
@@ -7532,28 +7392,28 @@ function LineNumberedFile({
|
|
|
7532
7392
|
}
|
|
7533
7393
|
function GitHeader({ git, loading }) {
|
|
7534
7394
|
if (loading) {
|
|
7535
|
-
return /* @__PURE__ */
|
|
7395
|
+
return /* @__PURE__ */ jsxs6(
|
|
7536
7396
|
"div",
|
|
7537
7397
|
{
|
|
7538
7398
|
className: "flex shrink-0 items-center gap-2 border-b border-og-border bg-og-surface-1 px-2 py-1 text-og-sm text-og-fg-muted",
|
|
7539
7399
|
role: "status",
|
|
7540
7400
|
"aria-live": "polite",
|
|
7541
7401
|
children: [
|
|
7542
|
-
/* @__PURE__ */
|
|
7402
|
+
/* @__PURE__ */ jsx8(
|
|
7543
7403
|
LoaderCircleIcon,
|
|
7544
7404
|
{
|
|
7545
7405
|
className: "size-3.5 shrink-0 animate-spin motion-reduce:animate-none",
|
|
7546
7406
|
"aria-hidden": true
|
|
7547
7407
|
}
|
|
7548
7408
|
),
|
|
7549
|
-
/* @__PURE__ */
|
|
7409
|
+
/* @__PURE__ */ jsx8("span", { children: "Loading repository\u2026" })
|
|
7550
7410
|
]
|
|
7551
7411
|
}
|
|
7552
7412
|
);
|
|
7553
7413
|
}
|
|
7554
7414
|
const dirty = git.dirtyCount > 0;
|
|
7555
|
-
return /* @__PURE__ */
|
|
7556
|
-
/* @__PURE__ */
|
|
7415
|
+
return /* @__PURE__ */ jsxs6("div", { className: "flex shrink-0 items-center gap-2 border-b border-og-border bg-og-surface-1 px-2 py-1 text-og-sm", children: [
|
|
7416
|
+
/* @__PURE__ */ jsx8(
|
|
7557
7417
|
"span",
|
|
7558
7418
|
{
|
|
7559
7419
|
"aria-hidden": "true",
|
|
@@ -7563,19 +7423,19 @@ function GitHeader({ git, loading }) {
|
|
|
7563
7423
|
)
|
|
7564
7424
|
}
|
|
7565
7425
|
),
|
|
7566
|
-
/* @__PURE__ */
|
|
7567
|
-
/* @__PURE__ */
|
|
7568
|
-
(git.ahead > 0 || git.behind > 0) && /* @__PURE__ */
|
|
7569
|
-
git.ahead > 0 && /* @__PURE__ */
|
|
7426
|
+
/* @__PURE__ */ jsx8("span", { className: "sr-only", children: dirty ? `Uncommitted changes in ${git.dirtyCount} files` : "No uncommitted changes" }),
|
|
7427
|
+
/* @__PURE__ */ jsx8("span", { className: "truncate font-og-mono text-og-fg", children: git.repoCount > 1 ? `${git.repoCount} repositories` : git.branch ?? (git.isRepo ? "(detached)" : "no repo") }),
|
|
7428
|
+
(git.ahead > 0 || git.behind > 0) && /* @__PURE__ */ jsxs6("span", { className: "flex shrink-0 items-center gap-1.5 text-og-xs text-og-fg-subtle", children: [
|
|
7429
|
+
git.ahead > 0 && /* @__PURE__ */ jsxs6("span", { "data-contrast-audited": true, children: [
|
|
7570
7430
|
"\u2191",
|
|
7571
7431
|
git.ahead
|
|
7572
7432
|
] }),
|
|
7573
|
-
git.behind > 0 && /* @__PURE__ */
|
|
7433
|
+
git.behind > 0 && /* @__PURE__ */ jsxs6("span", { "data-contrast-audited": true, children: [
|
|
7574
7434
|
"\u2193",
|
|
7575
7435
|
git.behind
|
|
7576
7436
|
] })
|
|
7577
7437
|
] }),
|
|
7578
|
-
dirty && /* @__PURE__ */
|
|
7438
|
+
dirty && /* @__PURE__ */ jsxs6(
|
|
7579
7439
|
"span",
|
|
7580
7440
|
{
|
|
7581
7441
|
"aria-hidden": "true",
|
|
@@ -7594,7 +7454,7 @@ function Segmented({
|
|
|
7594
7454
|
value,
|
|
7595
7455
|
onChange
|
|
7596
7456
|
}) {
|
|
7597
|
-
return /* @__PURE__ */
|
|
7457
|
+
return /* @__PURE__ */ jsx8("div", { className: "flex flex-wrap items-center rounded-og-sm border border-og-border p-0.5", children: options.map((opt) => /* @__PURE__ */ jsx8(
|
|
7598
7458
|
"button",
|
|
7599
7459
|
{
|
|
7600
7460
|
type: "button",
|
|
@@ -7609,8 +7469,8 @@ function Segmented({
|
|
|
7609
7469
|
)) });
|
|
7610
7470
|
}
|
|
7611
7471
|
function useFileView(path, readFile, reloadRevision = 0) {
|
|
7612
|
-
const previousPathRef =
|
|
7613
|
-
const [state, setState] =
|
|
7472
|
+
const previousPathRef = useRef15(null);
|
|
7473
|
+
const [state, setState] = useState14({
|
|
7614
7474
|
content: null,
|
|
7615
7475
|
isBinary: false,
|
|
7616
7476
|
truncated: false,
|
|
@@ -7618,7 +7478,7 @@ function useFileView(path, readFile, reloadRevision = 0) {
|
|
|
7618
7478
|
loading: false,
|
|
7619
7479
|
error: null
|
|
7620
7480
|
});
|
|
7621
|
-
|
|
7481
|
+
useEffect18(() => {
|
|
7622
7482
|
if (!path) {
|
|
7623
7483
|
previousPathRef.current = null;
|
|
7624
7484
|
setState({
|
|
@@ -7686,12 +7546,12 @@ function rasterImageUrl(path, content) {
|
|
|
7686
7546
|
return mime ? `data:${mime};base64,${content}` : null;
|
|
7687
7547
|
}
|
|
7688
7548
|
function RasterFilePreview({ src, path }) {
|
|
7689
|
-
const [failed, setFailed] =
|
|
7690
|
-
return failed ? /* @__PURE__ */
|
|
7549
|
+
const [failed, setFailed] = useState14(false);
|
|
7550
|
+
return failed ? /* @__PURE__ */ jsxs6(Notice, { title: "Image preview unavailable", announce: "alert", children: [
|
|
7691
7551
|
"Could not decode ",
|
|
7692
7552
|
path,
|
|
7693
7553
|
" as an image."
|
|
7694
|
-
] }) : /* @__PURE__ */
|
|
7554
|
+
] }) : /* @__PURE__ */ jsx8(
|
|
7695
7555
|
"img",
|
|
7696
7556
|
{
|
|
7697
7557
|
src,
|
|
@@ -7720,7 +7580,7 @@ function Notice({
|
|
|
7720
7580
|
title,
|
|
7721
7581
|
announce
|
|
7722
7582
|
}) {
|
|
7723
|
-
return /* @__PURE__ */
|
|
7583
|
+
return /* @__PURE__ */ jsx8(
|
|
7724
7584
|
"div",
|
|
7725
7585
|
{
|
|
7726
7586
|
role: announce,
|
|
@@ -7730,10 +7590,10 @@ function Notice({
|
|
|
7730
7590
|
"flex h-full items-center justify-center p-4 text-center text-og-sm text-og-fg-subtle",
|
|
7731
7591
|
className
|
|
7732
7592
|
),
|
|
7733
|
-
children: /* @__PURE__ */
|
|
7734
|
-
icon ? /* @__PURE__ */
|
|
7735
|
-
title ? /* @__PURE__ */
|
|
7736
|
-
/* @__PURE__ */
|
|
7593
|
+
children: /* @__PURE__ */ jsxs6("div", { className: "flex max-w-sm flex-col items-center gap-2.5", children: [
|
|
7594
|
+
icon ? /* @__PURE__ */ jsx8("span", { className: "grid size-10 place-items-center rounded-og-lg border border-og-border bg-og-surface-1 text-og-fg-muted shadow-sm", children: icon }) : null,
|
|
7595
|
+
title ? /* @__PURE__ */ jsx8("p", { className: "font-medium text-og-fg", children: title }) : null,
|
|
7596
|
+
/* @__PURE__ */ jsx8("div", { "data-contrast-audited": true, className: "leading-5", children })
|
|
7737
7597
|
] })
|
|
7738
7598
|
}
|
|
7739
7599
|
);
|
|
@@ -7742,18 +7602,18 @@ function Notice({
|
|
|
7742
7602
|
// src/components/workspace-dock.tsx
|
|
7743
7603
|
import {
|
|
7744
7604
|
useCallback as useCallback23,
|
|
7745
|
-
useEffect as
|
|
7746
|
-
useId as
|
|
7605
|
+
useEffect as useEffect19,
|
|
7606
|
+
useId as useId3,
|
|
7747
7607
|
useLayoutEffect as useLayoutEffect4,
|
|
7748
|
-
useRef as
|
|
7749
|
-
useState as
|
|
7608
|
+
useRef as useRef16,
|
|
7609
|
+
useState as useState15
|
|
7750
7610
|
} from "react";
|
|
7751
7611
|
import {
|
|
7752
7612
|
ChevronsLeftRightIcon,
|
|
7753
7613
|
Maximize2Icon,
|
|
7754
7614
|
Minimize2Icon,
|
|
7755
7615
|
PanelRightCloseIcon,
|
|
7756
|
-
XIcon
|
|
7616
|
+
XIcon
|
|
7757
7617
|
} from "lucide-react";
|
|
7758
7618
|
import {
|
|
7759
7619
|
Group as Group2,
|
|
@@ -7762,7 +7622,7 @@ import {
|
|
|
7762
7622
|
useDefaultLayout,
|
|
7763
7623
|
usePanelRef
|
|
7764
7624
|
} from "react-resizable-panels";
|
|
7765
|
-
import { Fragment as
|
|
7625
|
+
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
7766
7626
|
var SERVER_LAYOUT_STORAGE = {
|
|
7767
7627
|
getItem: () => null,
|
|
7768
7628
|
setItem: () => {
|
|
@@ -7776,10 +7636,10 @@ function getLayoutStorage() {
|
|
|
7776
7636
|
return SERVER_LAYOUT_STORAGE;
|
|
7777
7637
|
}
|
|
7778
7638
|
}
|
|
7779
|
-
var useDockLayoutEffect = typeof window === "undefined" ?
|
|
7639
|
+
var useDockLayoutEffect = typeof window === "undefined" ? useEffect19 : useLayoutEffect4;
|
|
7780
7640
|
var DOCK_OVERLAY_BREAKPOINT = 1024;
|
|
7781
7641
|
function useIsNarrow(maxWidth) {
|
|
7782
|
-
const [narrow, setNarrow] =
|
|
7642
|
+
const [narrow, setNarrow] = useState15(false);
|
|
7783
7643
|
useDockLayoutEffect(() => {
|
|
7784
7644
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
7785
7645
|
return;
|
|
@@ -7813,25 +7673,25 @@ function WorkspaceDock({
|
|
|
7813
7673
|
className
|
|
7814
7674
|
}) {
|
|
7815
7675
|
const narrow = useIsNarrow(DOCK_OVERLAY_BREAKPOINT);
|
|
7816
|
-
const rootRef =
|
|
7817
|
-
const reopenRef =
|
|
7818
|
-
const returnFocusRef =
|
|
7819
|
-
const initialNarrowFocusRef =
|
|
7676
|
+
const rootRef = useRef16(null);
|
|
7677
|
+
const reopenRef = useRef16(null);
|
|
7678
|
+
const returnFocusRef = useRef16(null);
|
|
7679
|
+
const initialNarrowFocusRef = useRef16(false);
|
|
7820
7680
|
const dockPanelRef = usePanelRef();
|
|
7821
|
-
const [internalCollapsed, setInternalCollapsed] =
|
|
7822
|
-
const [maximized, setMaximized] =
|
|
7823
|
-
const [internalTab, setInternalTab] =
|
|
7681
|
+
const [internalCollapsed, setInternalCollapsed] = useState15(false);
|
|
7682
|
+
const [maximized, setMaximized] = useState15(false);
|
|
7683
|
+
const [internalTab, setInternalTab] = useState15(tabs[0]?.id ?? "");
|
|
7824
7684
|
const collapsed = collapsedProp ?? internalCollapsed;
|
|
7825
7685
|
const hostControlled = collapsedProp !== void 0;
|
|
7826
|
-
const previousCollapsedRef =
|
|
7686
|
+
const previousCollapsedRef = useRef16(collapsed);
|
|
7827
7687
|
const { defaultLayout, onLayoutChanged } = useDefaultLayout({
|
|
7828
7688
|
panelIds: ["primary", "dock"],
|
|
7829
7689
|
storage: getLayoutStorage(),
|
|
7830
7690
|
id: autoSaveId
|
|
7831
7691
|
});
|
|
7832
7692
|
const expandedDefaultLayout = defaultLayout && (defaultLayout.dock ?? 0) > 1 ? defaultLayout : void 0;
|
|
7833
|
-
const lastExpandedSizeRef =
|
|
7834
|
-
const layoutIdentityRef =
|
|
7693
|
+
const lastExpandedSizeRef = useRef16(expandedDefaultLayout?.dock ?? defaultSize);
|
|
7694
|
+
const layoutIdentityRef = useRef16(autoSaveId);
|
|
7835
7695
|
if (layoutIdentityRef.current !== autoSaveId) {
|
|
7836
7696
|
layoutIdentityRef.current = autoSaveId;
|
|
7837
7697
|
lastExpandedSizeRef.current = expandedDefaultLayout?.dock ?? defaultSize;
|
|
@@ -7875,7 +7735,7 @@ function WorkspaceDock({
|
|
|
7875
7735
|
dockPanelRef.current?.resize(`${lastExpandedSizeRef.current}%`);
|
|
7876
7736
|
}
|
|
7877
7737
|
}, [collapsedProp, dockPanelRef]);
|
|
7878
|
-
|
|
7738
|
+
useEffect19(() => {
|
|
7879
7739
|
const previous = previousCollapsedRef.current;
|
|
7880
7740
|
previousCollapsedRef.current = collapsed;
|
|
7881
7741
|
if (previous === collapsed) return;
|
|
@@ -7911,7 +7771,7 @@ function WorkspaceDock({
|
|
|
7911
7771
|
});
|
|
7912
7772
|
return () => cancelAnimationFrame(frame);
|
|
7913
7773
|
}, [collapsed, hostControlled, narrow]);
|
|
7914
|
-
|
|
7774
|
+
useEffect19(() => {
|
|
7915
7775
|
if (!narrow || collapsed || initialNarrowFocusRef.current) return;
|
|
7916
7776
|
initialNarrowFocusRef.current = true;
|
|
7917
7777
|
const active = document.activeElement;
|
|
@@ -7924,7 +7784,7 @@ function WorkspaceDock({
|
|
|
7924
7784
|
});
|
|
7925
7785
|
return () => cancelAnimationFrame(frame);
|
|
7926
7786
|
}, [collapsed, narrow]);
|
|
7927
|
-
|
|
7787
|
+
useEffect19(() => {
|
|
7928
7788
|
if (firstTabId && !requestedTabIsValid) {
|
|
7929
7789
|
setTab(firstTabId);
|
|
7930
7790
|
}
|
|
@@ -7937,7 +7797,7 @@ function WorkspaceDock({
|
|
|
7937
7797
|
dockPanelRef.current?.expand();
|
|
7938
7798
|
setCollapsed(false);
|
|
7939
7799
|
}, [dockPanelRef, setCollapsed]);
|
|
7940
|
-
|
|
7800
|
+
useEffect19(() => {
|
|
7941
7801
|
const overlayOpen = maximized || narrow && !collapsed;
|
|
7942
7802
|
if (!overlayOpen) return;
|
|
7943
7803
|
const onKey = (event) => {
|
|
@@ -7981,8 +7841,8 @@ function WorkspaceDock({
|
|
|
7981
7841
|
return () => window.removeEventListener("keydown", onKey);
|
|
7982
7842
|
}, [maximized, narrow, collapsed, collapse]);
|
|
7983
7843
|
if (narrow) {
|
|
7984
|
-
return /* @__PURE__ */
|
|
7985
|
-
/* @__PURE__ */
|
|
7844
|
+
return /* @__PURE__ */ jsxs7("div", { ref: rootRef, className: cn("relative flex h-full min-h-0 w-full min-w-0", className), children: [
|
|
7845
|
+
/* @__PURE__ */ jsx9(
|
|
7986
7846
|
"div",
|
|
7987
7847
|
{
|
|
7988
7848
|
"data-workspace-primary": true,
|
|
@@ -7992,7 +7852,7 @@ function WorkspaceDock({
|
|
|
7992
7852
|
children: primary
|
|
7993
7853
|
}
|
|
7994
7854
|
),
|
|
7995
|
-
/* @__PURE__ */
|
|
7855
|
+
/* @__PURE__ */ jsx9(
|
|
7996
7856
|
"div",
|
|
7997
7857
|
{
|
|
7998
7858
|
"data-workspace-surface": true,
|
|
@@ -8010,7 +7870,7 @@ function WorkspaceDock({
|
|
|
8010
7870
|
paddingTop: "env(safe-area-inset-top)",
|
|
8011
7871
|
paddingBottom: "env(safe-area-inset-bottom)"
|
|
8012
7872
|
},
|
|
8013
|
-
children: /* @__PURE__ */
|
|
7873
|
+
children: /* @__PURE__ */ jsx9(
|
|
8014
7874
|
DockChrome,
|
|
8015
7875
|
{
|
|
8016
7876
|
tabs,
|
|
@@ -8018,12 +7878,12 @@ function WorkspaceDock({
|
|
|
8018
7878
|
onTab: setTab,
|
|
8019
7879
|
leading: mobileLeadingControl,
|
|
8020
7880
|
accessory: headerAccessory,
|
|
8021
|
-
controls: /* @__PURE__ */
|
|
7881
|
+
controls: /* @__PURE__ */ jsx9(ChromeButton, { onClick: collapse, title: "Hide workspace", label: "Hide workspace", children: /* @__PURE__ */ jsx9(XIcon, { className: "size-4" }) })
|
|
8022
7882
|
}
|
|
8023
7883
|
)
|
|
8024
7884
|
}
|
|
8025
7885
|
),
|
|
8026
|
-
collapsed && !hostControlled ? /* @__PURE__ */
|
|
7886
|
+
collapsed && !hostControlled ? /* @__PURE__ */ jsx9(
|
|
8027
7887
|
"button",
|
|
8028
7888
|
{
|
|
8029
7889
|
ref: reopenRef,
|
|
@@ -8033,34 +7893,34 @@ function WorkspaceDock({
|
|
|
8033
7893
|
"aria-label": "Open workspace",
|
|
8034
7894
|
className: "absolute right-3 top-3 z-30 inline-flex size-11 items-center justify-center rounded-og-md border border-og-border bg-og-surface-1 text-og-fg-muted shadow-lg transition-colors hover:border-og-border-strong hover:text-og-fg focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent",
|
|
8035
7895
|
style: { marginTop: "env(safe-area-inset-top)" },
|
|
8036
|
-
children: /* @__PURE__ */
|
|
7896
|
+
children: /* @__PURE__ */ jsx9(ChevronsLeftRightIcon, { className: "size-4", "aria-hidden": true })
|
|
8037
7897
|
}
|
|
8038
7898
|
) : null
|
|
8039
7899
|
] });
|
|
8040
7900
|
}
|
|
8041
|
-
const dockChrome = /* @__PURE__ */
|
|
7901
|
+
const dockChrome = /* @__PURE__ */ jsx9(
|
|
8042
7902
|
DockChrome,
|
|
8043
7903
|
{
|
|
8044
7904
|
tabs,
|
|
8045
7905
|
current,
|
|
8046
7906
|
onTab: setTab,
|
|
8047
7907
|
accessory: headerAccessory,
|
|
8048
|
-
controls: /* @__PURE__ */
|
|
8049
|
-
/* @__PURE__ */
|
|
7908
|
+
controls: /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
7909
|
+
/* @__PURE__ */ jsx9(
|
|
8050
7910
|
ChromeButton,
|
|
8051
7911
|
{
|
|
8052
7912
|
onClick: () => setMaximized((m) => !m),
|
|
8053
7913
|
title: maximized ? "Restore (Esc)" : "Maximize",
|
|
8054
7914
|
label: maximized ? "Restore dock" : "Maximize dock",
|
|
8055
|
-
children: maximized ? /* @__PURE__ */
|
|
7915
|
+
children: maximized ? /* @__PURE__ */ jsx9(Minimize2Icon, { className: "size-3.5" }) : /* @__PURE__ */ jsx9(Maximize2Icon, { className: "size-3.5" })
|
|
8056
7916
|
}
|
|
8057
7917
|
),
|
|
8058
|
-
hostControlled && !showCollapseControl ? null : /* @__PURE__ */
|
|
7918
|
+
hostControlled && !showCollapseControl ? null : /* @__PURE__ */ jsx9(ChromeButton, { onClick: collapse, title: "Hide workspace", label: "Hide workspace", children: /* @__PURE__ */ jsx9(PanelRightCloseIcon, { className: "size-3.5" }) })
|
|
8059
7919
|
] })
|
|
8060
7920
|
}
|
|
8061
7921
|
);
|
|
8062
|
-
return /* @__PURE__ */
|
|
8063
|
-
/* @__PURE__ */
|
|
7922
|
+
return /* @__PURE__ */ jsxs7("div", { ref: rootRef, className: cn("relative flex h-full min-h-0 w-full min-w-0", className), children: [
|
|
7923
|
+
/* @__PURE__ */ jsxs7(
|
|
8064
7924
|
Group2,
|
|
8065
7925
|
{
|
|
8066
7926
|
orientation: "horizontal",
|
|
@@ -8068,7 +7928,7 @@ function WorkspaceDock({
|
|
|
8068
7928
|
...expandedDefaultLayout ? { defaultLayout: expandedDefaultLayout } : {},
|
|
8069
7929
|
onLayoutChanged: persistExpandedLayout,
|
|
8070
7930
|
children: [
|
|
8071
|
-
/* @__PURE__ */
|
|
7931
|
+
/* @__PURE__ */ jsx9(Panel2, { id: "primary", minSize: "30%", className: "min-h-0 min-w-0", children: /* @__PURE__ */ jsx9(
|
|
8072
7932
|
"div",
|
|
8073
7933
|
{
|
|
8074
7934
|
"data-workspace-primary": true,
|
|
@@ -8078,8 +7938,8 @@ function WorkspaceDock({
|
|
|
8078
7938
|
children: primary
|
|
8079
7939
|
}
|
|
8080
7940
|
) }),
|
|
8081
|
-
!collapsed && /* @__PURE__ */
|
|
8082
|
-
/* @__PURE__ */
|
|
7941
|
+
!collapsed && /* @__PURE__ */ jsx9(Separator2, { className: "group relative z-10 w-1.5 shrink-0 outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-og-accent max-[1023px]:-mx-[19px] max-[1023px]:w-11 pointer-coarse:-mx-[19px] pointer-coarse:w-11", children: /* @__PURE__ */ jsx9("span", { className: "absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-og-border transition-colors group-hover:bg-og-accent group-focus-visible:bg-og-accent group-data-[separator-state=dragging]:bg-og-accent" }) }),
|
|
7942
|
+
/* @__PURE__ */ jsx9(
|
|
8083
7943
|
Panel2,
|
|
8084
7944
|
{
|
|
8085
7945
|
id: "dock",
|
|
@@ -8097,7 +7957,7 @@ function WorkspaceDock({
|
|
|
8097
7957
|
}
|
|
8098
7958
|
},
|
|
8099
7959
|
className: "min-h-0 min-w-0",
|
|
8100
|
-
children: /* @__PURE__ */
|
|
7960
|
+
children: /* @__PURE__ */ jsx9(
|
|
8101
7961
|
"div",
|
|
8102
7962
|
{
|
|
8103
7963
|
"data-workspace-surface": true,
|
|
@@ -8118,7 +7978,7 @@ function WorkspaceDock({
|
|
|
8118
7978
|
]
|
|
8119
7979
|
}
|
|
8120
7980
|
),
|
|
8121
|
-
collapsed && !maximized && !hostControlled && /* @__PURE__ */
|
|
7981
|
+
collapsed && !maximized && !hostControlled && /* @__PURE__ */ jsx9(
|
|
8122
7982
|
"button",
|
|
8123
7983
|
{
|
|
8124
7984
|
ref: reopenRef,
|
|
@@ -8126,7 +7986,7 @@ function WorkspaceDock({
|
|
|
8126
7986
|
onClick: expand,
|
|
8127
7987
|
title: "Open workspace",
|
|
8128
7988
|
className: "absolute inset-y-0 right-0 flex w-6 shrink-0 items-center justify-center border-l border-og-border bg-og-surface-1 text-og-fg-subtle hover:text-og-fg",
|
|
8129
|
-
children: /* @__PURE__ */
|
|
7989
|
+
children: /* @__PURE__ */ jsx9(ChevronsLeftRightIcon, { className: "size-3.5" })
|
|
8130
7990
|
}
|
|
8131
7991
|
)
|
|
8132
7992
|
] });
|
|
@@ -8137,7 +7997,7 @@ function ChromeButton({
|
|
|
8137
7997
|
label,
|
|
8138
7998
|
children
|
|
8139
7999
|
}) {
|
|
8140
|
-
return /* @__PURE__ */
|
|
8000
|
+
return /* @__PURE__ */ jsx9(
|
|
8141
8001
|
"button",
|
|
8142
8002
|
{
|
|
8143
8003
|
type: "button",
|
|
@@ -8157,12 +8017,12 @@ function DockChrome({
|
|
|
8157
8017
|
accessory,
|
|
8158
8018
|
controls
|
|
8159
8019
|
}) {
|
|
8160
|
-
const chromeRef =
|
|
8161
|
-
const [compact, setCompact] =
|
|
8020
|
+
const chromeRef = useRef16(null);
|
|
8021
|
+
const [compact, setCompact] = useState15(false);
|
|
8162
8022
|
const active = tabs.find((t) => t.id === current) ?? tabs[0];
|
|
8163
|
-
const tabsetId =
|
|
8164
|
-
const tabRefs =
|
|
8165
|
-
const [visitedTabs, setVisitedTabs] =
|
|
8023
|
+
const tabsetId = useId3();
|
|
8024
|
+
const tabRefs = useRef16([]);
|
|
8025
|
+
const [visitedTabs, setVisitedTabs] = useState15(() => /* @__PURE__ */ new Set());
|
|
8166
8026
|
const activeId = active?.id ?? "";
|
|
8167
8027
|
useDockLayoutEffect(() => {
|
|
8168
8028
|
const node = chromeRef.current;
|
|
@@ -8181,7 +8041,7 @@ function DockChrome({
|
|
|
8181
8041
|
observer.observe(node);
|
|
8182
8042
|
return () => observer.disconnect();
|
|
8183
8043
|
}, []);
|
|
8184
|
-
|
|
8044
|
+
useEffect19(() => {
|
|
8185
8045
|
if (!activeId) return;
|
|
8186
8046
|
setVisitedTabs((previous) => {
|
|
8187
8047
|
if (previous.has(activeId)) return previous;
|
|
@@ -8209,7 +8069,7 @@ function DockChrome({
|
|
|
8209
8069
|
event.preventDefault();
|
|
8210
8070
|
activateTab(nextIndex);
|
|
8211
8071
|
};
|
|
8212
|
-
return /* @__PURE__ */
|
|
8072
|
+
return /* @__PURE__ */ jsxs7(
|
|
8213
8073
|
"div",
|
|
8214
8074
|
{
|
|
8215
8075
|
ref: chromeRef,
|
|
@@ -8217,13 +8077,13 @@ function DockChrome({
|
|
|
8217
8077
|
"data-compact": compact ? "true" : void 0,
|
|
8218
8078
|
className: "flex h-full min-h-0 min-w-0 flex-col",
|
|
8219
8079
|
children: [
|
|
8220
|
-
/* @__PURE__ */
|
|
8221
|
-
/* @__PURE__ */
|
|
8222
|
-
/* @__PURE__ */
|
|
8223
|
-
/* @__PURE__ */
|
|
8080
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex min-h-10 shrink-0 items-center gap-2 border-b border-og-border px-2 max-[1023px]:min-h-12", children: [
|
|
8081
|
+
/* @__PURE__ */ jsx9("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: leading ?? /* @__PURE__ */ jsx9("span", { className: "hidden truncate text-og-sm font-semibold text-og-fg max-[1023px]:inline", children: "Workspace" }) }),
|
|
8082
|
+
/* @__PURE__ */ jsx9("div", { className: "min-w-0 shrink text-og-fg-muted", children: accessory }),
|
|
8083
|
+
/* @__PURE__ */ jsx9("div", { className: "flex shrink-0 items-center gap-0.5 text-og-fg-subtle", children: controls })
|
|
8224
8084
|
] }),
|
|
8225
|
-
/* @__PURE__ */
|
|
8226
|
-
/* @__PURE__ */
|
|
8085
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex min-h-0 min-w-0 flex-1", children: [
|
|
8086
|
+
/* @__PURE__ */ jsx9(
|
|
8227
8087
|
"div",
|
|
8228
8088
|
{
|
|
8229
8089
|
className: cn(
|
|
@@ -8235,7 +8095,7 @@ function DockChrome({
|
|
|
8235
8095
|
"aria-orientation": "vertical",
|
|
8236
8096
|
children: tabs.map((tab, index) => {
|
|
8237
8097
|
const tabName = tab.ariaLabel ?? (typeof tab.label === "string" ? tab.label : tab.id);
|
|
8238
|
-
return /* @__PURE__ */
|
|
8098
|
+
return /* @__PURE__ */ jsxs7(
|
|
8239
8099
|
"button",
|
|
8240
8100
|
{
|
|
8241
8101
|
ref: (node) => {
|
|
@@ -8257,7 +8117,7 @@ function DockChrome({
|
|
|
8257
8117
|
tab.id === current ? "bg-og-accent-soft text-og-fg shadow-[inset_2px_0_0_var(--og-color-accent)]" : "text-og-fg-subtle hover:bg-og-surface-2 hover:text-og-fg"
|
|
8258
8118
|
),
|
|
8259
8119
|
children: [
|
|
8260
|
-
tab.icon ? /* @__PURE__ */
|
|
8120
|
+
tab.icon ? /* @__PURE__ */ jsx9(
|
|
8261
8121
|
"span",
|
|
8262
8122
|
{
|
|
8263
8123
|
className: "flex size-4 shrink-0 items-center justify-center [&>svg]:size-4",
|
|
@@ -8265,8 +8125,8 @@ function DockChrome({
|
|
|
8265
8125
|
children: tab.icon
|
|
8266
8126
|
}
|
|
8267
8127
|
) : null,
|
|
8268
|
-
!compact || !tab.icon ? /* @__PURE__ */
|
|
8269
|
-
tab.badge ? /* @__PURE__ */
|
|
8128
|
+
!compact || !tab.icon ? /* @__PURE__ */ jsx9("span", { "data-contrast-audited": true, className: "min-w-0 flex-1 truncate", children: tab.label }) : null,
|
|
8129
|
+
tab.badge ? /* @__PURE__ */ jsx9(
|
|
8270
8130
|
"span",
|
|
8271
8131
|
{
|
|
8272
8132
|
className: cn("shrink-0", compact && "absolute -right-0.5 -top-0.5 scale-90"),
|
|
@@ -8280,10 +8140,10 @@ function DockChrome({
|
|
|
8280
8140
|
})
|
|
8281
8141
|
}
|
|
8282
8142
|
),
|
|
8283
|
-
/* @__PURE__ */
|
|
8143
|
+
/* @__PURE__ */ jsx9("div", { className: "min-h-0 min-w-0 flex-1 overflow-hidden", children: tabs.length > 0 ? tabs.map((tab, index) => {
|
|
8284
8144
|
const selected = tab.id === activeId;
|
|
8285
8145
|
const shouldMount = selected || visitedTabs.has(tab.id);
|
|
8286
|
-
return /* @__PURE__ */
|
|
8146
|
+
return /* @__PURE__ */ jsx9(
|
|
8287
8147
|
"div",
|
|
8288
8148
|
{
|
|
8289
8149
|
id: `${tabsetId}-panel-${index}`,
|
|
@@ -8295,7 +8155,7 @@ function DockChrome({
|
|
|
8295
8155
|
},
|
|
8296
8156
|
tab.id
|
|
8297
8157
|
);
|
|
8298
|
-
}) : /* @__PURE__ */
|
|
8158
|
+
}) : /* @__PURE__ */ jsx9("div", { className: "h-full min-h-0 min-w-0", "aria-label": "Workspace", role: "tabpanel" }) })
|
|
8299
8159
|
] })
|
|
8300
8160
|
]
|
|
8301
8161
|
}
|
|
@@ -8307,10 +8167,10 @@ import {
|
|
|
8307
8167
|
lazy as lazy2,
|
|
8308
8168
|
Suspense as Suspense2,
|
|
8309
8169
|
useCallback as useCallback24,
|
|
8310
|
-
useEffect as
|
|
8170
|
+
useEffect as useEffect20,
|
|
8311
8171
|
useMemo as useMemo15,
|
|
8312
|
-
useRef as
|
|
8313
|
-
useState as
|
|
8172
|
+
useRef as useRef17,
|
|
8173
|
+
useState as useState16
|
|
8314
8174
|
} from "react";
|
|
8315
8175
|
import {
|
|
8316
8176
|
CircleCheckIcon,
|
|
@@ -8324,7 +8184,7 @@ import {
|
|
|
8324
8184
|
SquareTerminalIcon,
|
|
8325
8185
|
TriangleAlertIcon as TriangleAlertIcon2
|
|
8326
8186
|
} from "lucide-react";
|
|
8327
|
-
import { jsx as
|
|
8187
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
8328
8188
|
var LazyBrowserViewer = lazy2(async () => {
|
|
8329
8189
|
const { BrowserViewer } = await import("./browser-viewer-NTD6UIPR.js");
|
|
8330
8190
|
return { default: BrowserViewer };
|
|
@@ -8372,11 +8232,11 @@ function captureDegradedMessage(reason) {
|
|
|
8372
8232
|
}
|
|
8373
8233
|
}
|
|
8374
8234
|
function WorkbenchSurfaceLoading({ name }) {
|
|
8375
|
-
return /* @__PURE__ */
|
|
8235
|
+
return /* @__PURE__ */ jsx10(
|
|
8376
8236
|
CenteredState,
|
|
8377
8237
|
{
|
|
8378
|
-
icon: /* @__PURE__ */
|
|
8379
|
-
children: /* @__PURE__ */
|
|
8238
|
+
icon: /* @__PURE__ */ jsx10(LoaderCircleIcon2, { className: "size-5 animate-spin motion-reduce:animate-none", "aria-hidden": true }),
|
|
8239
|
+
children: /* @__PURE__ */ jsxs8("p", { className: "text-og-sm font-medium text-og-fg", children: [
|
|
8380
8240
|
"Opening ",
|
|
8381
8241
|
name
|
|
8382
8242
|
] })
|
|
@@ -8512,7 +8372,7 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8512
8372
|
const filesActive = resolvedActiveTab === WORKBENCH_TAB_FILES;
|
|
8513
8373
|
const turnInFlight = workspaceTurnInFlight(events);
|
|
8514
8374
|
const surfaceIdentity = WORKBENCH_SURFACES.filter((surface) => surfaceSet.has(surface)).join(",");
|
|
8515
|
-
const [storedWarmIntents, setStoredWarmIntents] =
|
|
8375
|
+
const [storedWarmIntents, setStoredWarmIntents] = useState16(
|
|
8516
8376
|
() => emptyWarmIntents(sessionId)
|
|
8517
8377
|
);
|
|
8518
8378
|
const warmIntents = storedWarmIntents.sessionId === sessionId ? storedWarmIntents : emptyWarmIntents(sessionId);
|
|
@@ -8560,15 +8420,15 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8560
8420
|
});
|
|
8561
8421
|
const provisioning = sandboxProvisionInFlight(events);
|
|
8562
8422
|
const renegotiate = caps.renegotiate;
|
|
8563
|
-
const provisioningRef =
|
|
8564
|
-
|
|
8423
|
+
const provisioningRef = useRef17({ sessionId, provisioning });
|
|
8424
|
+
useEffect20(() => {
|
|
8565
8425
|
const previous = provisioningRef.current;
|
|
8566
8426
|
if (previous.sessionId === sessionId && previous.provisioning && !provisioning) {
|
|
8567
8427
|
renegotiate();
|
|
8568
8428
|
}
|
|
8569
8429
|
provisioningRef.current = { sessionId, provisioning };
|
|
8570
8430
|
}, [sessionId, provisioning, renegotiate]);
|
|
8571
|
-
|
|
8431
|
+
useEffect20(() => {
|
|
8572
8432
|
if (workspaceInteractionEvent?.workspaceId !== workspaceId) return;
|
|
8573
8433
|
renegotiate();
|
|
8574
8434
|
}, [workspaceId, workspaceInteractionEvent, renegotiate]);
|
|
@@ -8584,14 +8444,14 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8584
8444
|
if (advertised.length > 0) return advertised;
|
|
8585
8445
|
return captureState.capture?.repos.map((repo) => repo.root) ?? [];
|
|
8586
8446
|
}, [capabilities?.Git.repos, captureState.capture]);
|
|
8587
|
-
const notifiedCaptureDegradedReason =
|
|
8447
|
+
const notifiedCaptureDegradedReason = useRef17({
|
|
8588
8448
|
sessionId,
|
|
8589
8449
|
reason: null
|
|
8590
8450
|
});
|
|
8591
8451
|
if (notifiedCaptureDegradedReason.current.sessionId !== sessionId) {
|
|
8592
8452
|
notifiedCaptureDegradedReason.current = { sessionId, reason: null };
|
|
8593
8453
|
}
|
|
8594
|
-
|
|
8454
|
+
useEffect20(() => {
|
|
8595
8455
|
const reason = captureState.degradedReason;
|
|
8596
8456
|
if (!reason || notifiedCaptureDegradedReason.current.reason === reason) return;
|
|
8597
8457
|
notifiedCaptureDegradedReason.current = { sessionId, reason };
|
|
@@ -8621,7 +8481,7 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8621
8481
|
message: `Could not ${op}: ${error.message}`
|
|
8622
8482
|
})
|
|
8623
8483
|
});
|
|
8624
|
-
const [storedChangesComparison, setStoredChangesComparison] =
|
|
8484
|
+
const [storedChangesComparison, setStoredChangesComparison] = useState16(null);
|
|
8625
8485
|
const captureSupportsBranch = captureState.capture !== null && captureState.capture.repos.length > 0 && captureState.capture.repos.every((repo) => repo.branchDiff !== void 0);
|
|
8626
8486
|
const changesComparison = storedChangesComparison?.sessionId === sessionId ? storedChangesComparison.value : liveWorkspaceExpected || captureSupportsBranch ? "branch" : "working";
|
|
8627
8487
|
const setChangesComparison = useCallback24(
|
|
@@ -8641,13 +8501,13 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8641
8501
|
comparison: changesComparison,
|
|
8642
8502
|
capture: changesComparison === "staged" ? null : captureState.capture
|
|
8643
8503
|
});
|
|
8644
|
-
|
|
8504
|
+
useEffect20(() => {
|
|
8645
8505
|
if (changesComparison === "branch" && git.error && storedChangesComparison?.sessionId !== sessionId) {
|
|
8646
8506
|
setStoredChangesComparison({ sessionId, value: "working" });
|
|
8647
8507
|
}
|
|
8648
8508
|
}, [changesComparison, git.error, sessionId, storedChangesComparison?.sessionId]);
|
|
8649
|
-
const [xtermTheme, setXtermTheme] =
|
|
8650
|
-
|
|
8509
|
+
const [xtermTheme, setXtermTheme] = useState16(void 0);
|
|
8510
|
+
useEffect20(() => {
|
|
8651
8511
|
if (!terminalEnabled || typeof document === "undefined") return;
|
|
8652
8512
|
const derive = () => setXtermTheme(xtermThemeFromTokens());
|
|
8653
8513
|
derive();
|
|
@@ -8669,7 +8529,7 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8669
8529
|
});
|
|
8670
8530
|
const workspaceWaking = chip.state === "waking";
|
|
8671
8531
|
const defaultIdentity = `${sessionId}\0${surfaceIdentity}`;
|
|
8672
|
-
const defaultTabRef =
|
|
8532
|
+
const defaultTabRef = useRef17({
|
|
8673
8533
|
identity: defaultIdentity,
|
|
8674
8534
|
value: null
|
|
8675
8535
|
});
|
|
@@ -8677,7 +8537,7 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8677
8537
|
defaultTabRef.current = { identity: defaultIdentity, value: null };
|
|
8678
8538
|
}
|
|
8679
8539
|
const captureHasChanges = (captureState.fileCount ?? 0) > 0 || (captureState.capture?.repos.some((repo) => (repo.branchDiff?.length ?? 0) > 0) ?? false);
|
|
8680
|
-
const captureUnavailable = captureState.fileCount === 0 && !captureHasChanges || captureState.error !== null;
|
|
8540
|
+
const captureUnavailable = !captureState.loading && (captureState.fileCount === 0 && !captureHasChanges || captureState.error !== null);
|
|
8681
8541
|
if (defaultTabRef.current.value === null) {
|
|
8682
8542
|
if (initialTab && (!isWorkbenchSurface(initialTab) || surfaceSet.has(initialTab))) {
|
|
8683
8543
|
defaultTabRef.current.value = initialTab;
|
|
@@ -8689,7 +8549,7 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8689
8549
|
);
|
|
8690
8550
|
} else if (captureUnavailable && initialWorkspaceTab(events) === WORKBENCH_TAB_CHANGES) {
|
|
8691
8551
|
defaultTabRef.current.value = sourceDrivenDefaultTab(true, changesEnabled, filesEnabled);
|
|
8692
|
-
} else if (captureState.fileCount !== null || captureState.error !== null) {
|
|
8552
|
+
} else if (!captureState.loading && (captureState.fileCount !== null || captureState.error !== null)) {
|
|
8693
8553
|
defaultTabRef.current.value = sourceDrivenDefaultTab(false, changesEnabled, filesEnabled);
|
|
8694
8554
|
}
|
|
8695
8555
|
}
|
|
@@ -8700,9 +8560,9 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8700
8560
|
list.push({
|
|
8701
8561
|
id: WORKBENCH_TAB_CHANGES,
|
|
8702
8562
|
label: "Changes",
|
|
8703
|
-
icon: /* @__PURE__ */
|
|
8704
|
-
badge: dirtyCount > 0 ? /* @__PURE__ */
|
|
8705
|
-
content: /* @__PURE__ */
|
|
8563
|
+
icon: /* @__PURE__ */ jsx10(GitCompareArrowsIcon, {}),
|
|
8564
|
+
badge: dirtyCount > 0 ? /* @__PURE__ */ jsx10(DirtyBadge, { count: dirtyCount }) : void 0,
|
|
8565
|
+
content: /* @__PURE__ */ jsx10(
|
|
8706
8566
|
ChangesTabBody,
|
|
8707
8567
|
{
|
|
8708
8568
|
git,
|
|
@@ -8730,8 +8590,8 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8730
8590
|
list.push({
|
|
8731
8591
|
id: WORKBENCH_TAB_FILES,
|
|
8732
8592
|
label: "Files",
|
|
8733
|
-
icon: /* @__PURE__ */
|
|
8734
|
-
content: /* @__PURE__ */
|
|
8593
|
+
icon: /* @__PURE__ */ jsx10(FileCode2Icon2, {}),
|
|
8594
|
+
content: /* @__PURE__ */ jsx10(
|
|
8735
8595
|
SandboxFiles,
|
|
8736
8596
|
{
|
|
8737
8597
|
files,
|
|
@@ -8767,8 +8627,8 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8767
8627
|
list.push({
|
|
8768
8628
|
id: WORKBENCH_TAB_TERMINAL,
|
|
8769
8629
|
label: "Terminal",
|
|
8770
|
-
icon: /* @__PURE__ */
|
|
8771
|
-
content: /* @__PURE__ */
|
|
8630
|
+
icon: /* @__PURE__ */ jsx10(SquareTerminalIcon, {}),
|
|
8631
|
+
content: /* @__PURE__ */ jsx10("div", { className: "h-full bg-og-bg p-1", children: /* @__PURE__ */ jsx10(
|
|
8772
8632
|
SandboxTerminal,
|
|
8773
8633
|
{
|
|
8774
8634
|
result: terminal,
|
|
@@ -8788,8 +8648,8 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8788
8648
|
list.push({
|
|
8789
8649
|
id: WORKBENCH_TAB_BROWSER,
|
|
8790
8650
|
label: "Browser",
|
|
8791
|
-
icon: /* @__PURE__ */
|
|
8792
|
-
content: /* @__PURE__ */
|
|
8651
|
+
icon: /* @__PURE__ */ jsx10(Globe2Icon, {}),
|
|
8652
|
+
content: /* @__PURE__ */ jsx10(Suspense2, { fallback: /* @__PURE__ */ jsx10(WorkbenchSurfaceLoading, { name: "Browser" }), children: /* @__PURE__ */ jsx10(
|
|
8793
8653
|
LazyBrowserViewer,
|
|
8794
8654
|
{
|
|
8795
8655
|
client,
|
|
@@ -8813,8 +8673,8 @@ function useSandboxWorkspaceTabs(options) {
|
|
|
8813
8673
|
list.push({
|
|
8814
8674
|
id: WORKBENCH_TAB_DESKTOP,
|
|
8815
8675
|
label: "Desktop",
|
|
8816
|
-
icon: /* @__PURE__ */
|
|
8817
|
-
content: /* @__PURE__ */
|
|
8676
|
+
icon: /* @__PURE__ */ jsx10(MonitorIcon, {}),
|
|
8677
|
+
content: /* @__PURE__ */ jsx10(Suspense2, { fallback: /* @__PURE__ */ jsx10(WorkbenchSurfaceLoading, { name: "Desktop" }), children: /* @__PURE__ */ jsx10(
|
|
8818
8678
|
LazyComputerViewer,
|
|
8819
8679
|
{
|
|
8820
8680
|
client,
|
|
@@ -8927,11 +8787,11 @@ function SandboxWorkspace(props) {
|
|
|
8927
8787
|
maxSize,
|
|
8928
8788
|
className
|
|
8929
8789
|
} = props;
|
|
8930
|
-
const [storedSelection, setStoredSelection] =
|
|
8931
|
-
const [requestedFile, setRequestedFile] =
|
|
8932
|
-
const [requestedComputer, setRequestedComputer] =
|
|
8933
|
-
const nextFileRequestId =
|
|
8934
|
-
const nextComputerRequestId =
|
|
8790
|
+
const [storedSelection, setStoredSelection] = useState16(null);
|
|
8791
|
+
const [requestedFile, setRequestedFile] = useState16(null);
|
|
8792
|
+
const [requestedComputer, setRequestedComputer] = useState16(null);
|
|
8793
|
+
const nextFileRequestId = useRef17(0);
|
|
8794
|
+
const nextComputerRequestId = useRef17(0);
|
|
8935
8795
|
const selectedTab = storedSelection?.sessionId === sessionId ? storedSelection.tab : null;
|
|
8936
8796
|
const activeTabHint = selectedTab ?? initialTab ?? leadingTabs?.[0]?.id ?? null;
|
|
8937
8797
|
const openFile = useCallback24(
|
|
@@ -8949,8 +8809,8 @@ function SandboxWorkspace(props) {
|
|
|
8949
8809
|
},
|
|
8950
8810
|
[onActiveTabChange, onCollapsedChange, onFilePathChange, sessionId]
|
|
8951
8811
|
);
|
|
8952
|
-
const handledOpenFileRequestId =
|
|
8953
|
-
|
|
8812
|
+
const handledOpenFileRequestId = useRef17(null);
|
|
8813
|
+
useEffect20(() => {
|
|
8954
8814
|
if (!openFileRequest) return;
|
|
8955
8815
|
if (handledOpenFileRequestId.current === openFileRequest.requestId) return;
|
|
8956
8816
|
handledOpenFileRequestId.current = openFileRequest.requestId;
|
|
@@ -9012,11 +8872,11 @@ function SandboxWorkspace(props) {
|
|
|
9012
8872
|
},
|
|
9013
8873
|
[onActiveTabChange, sessionId]
|
|
9014
8874
|
);
|
|
9015
|
-
|
|
8875
|
+
useEffect20(() => {
|
|
9016
8876
|
if (selectedTab !== null || defaultTab === null) return;
|
|
9017
8877
|
setStoredSelection({ sessionId, tab: defaultTab });
|
|
9018
8878
|
}, [defaultTab, selectedTab, sessionId]);
|
|
9019
|
-
return /* @__PURE__ */
|
|
8879
|
+
return /* @__PURE__ */ jsx10(
|
|
9020
8880
|
WorkspaceDock,
|
|
9021
8881
|
{
|
|
9022
8882
|
primary,
|
|
@@ -9024,7 +8884,7 @@ function SandboxWorkspace(props) {
|
|
|
9024
8884
|
...activeTab !== void 0 ? { activeTab } : {},
|
|
9025
8885
|
onActiveTabChange: selectTab,
|
|
9026
8886
|
...machine.enabled ? {
|
|
9027
|
-
headerAccessory: /* @__PURE__ */
|
|
8887
|
+
headerAccessory: /* @__PURE__ */ jsx10(MachineStateChip, { chip: machine.chip })
|
|
9028
8888
|
} : {},
|
|
9029
8889
|
...mobileLeadingControl !== void 0 ? { mobileLeadingControl } : {},
|
|
9030
8890
|
...collapsed !== void 0 ? { collapsed } : {},
|
|
@@ -9039,7 +8899,7 @@ function SandboxWorkspace(props) {
|
|
|
9039
8899
|
);
|
|
9040
8900
|
}
|
|
9041
8901
|
function DirtyBadge({ count }) {
|
|
9042
|
-
return /* @__PURE__ */
|
|
8902
|
+
return /* @__PURE__ */ jsx10("span", { className: "rounded-og-xs bg-og-accent-soft px-1 text-og-xs text-og-fg-muted", children: count });
|
|
9043
8903
|
}
|
|
9044
8904
|
function chipDotClass(state) {
|
|
9045
8905
|
if (state === "live") return "bg-og-status-running";
|
|
@@ -9047,27 +8907,27 @@ function chipDotClass(state) {
|
|
|
9047
8907
|
return "bg-og-fg-subtle";
|
|
9048
8908
|
}
|
|
9049
8909
|
function MachineStateChip({ chip }) {
|
|
9050
|
-
return /* @__PURE__ */
|
|
8910
|
+
return /* @__PURE__ */ jsxs8(
|
|
9051
8911
|
"div",
|
|
9052
8912
|
{
|
|
9053
8913
|
role: "status",
|
|
9054
8914
|
"aria-label": `Machine: ${chip.label}`,
|
|
9055
8915
|
className: "inline-flex min-h-7 min-w-0 items-center gap-1.5 px-2 py-1 text-og-xs font-medium text-og-fg-muted max-[1023px]:min-h-11 pointer-coarse:min-h-11",
|
|
9056
8916
|
children: [
|
|
9057
|
-
/* @__PURE__ */
|
|
8917
|
+
/* @__PURE__ */ jsx10(
|
|
9058
8918
|
"span",
|
|
9059
8919
|
{
|
|
9060
8920
|
className: cn("size-1.5 shrink-0 rounded-full", chipDotClass(chip.state)),
|
|
9061
8921
|
"aria-hidden": true
|
|
9062
8922
|
}
|
|
9063
8923
|
),
|
|
9064
|
-
/* @__PURE__ */
|
|
8924
|
+
/* @__PURE__ */ jsx10("span", { className: "min-w-0 max-w-[11rem] truncate", children: chip.label })
|
|
9065
8925
|
]
|
|
9066
8926
|
}
|
|
9067
8927
|
);
|
|
9068
8928
|
}
|
|
9069
8929
|
function DockActionButton({ onClick, children }) {
|
|
9070
|
-
return /* @__PURE__ */
|
|
8930
|
+
return /* @__PURE__ */ jsx10(
|
|
9071
8931
|
"button",
|
|
9072
8932
|
{
|
|
9073
8933
|
type: "button",
|
|
@@ -9082,12 +8942,12 @@ function ChangesTabBody({
|
|
|
9082
8942
|
onComparisonChange,
|
|
9083
8943
|
...props
|
|
9084
8944
|
}) {
|
|
9085
|
-
return /* @__PURE__ */
|
|
9086
|
-
/* @__PURE__ */
|
|
8945
|
+
return /* @__PURE__ */ jsxs8("div", { className: "flex h-full min-h-0 flex-col", children: [
|
|
8946
|
+
/* @__PURE__ */ jsx10("div", { className: "flex shrink-0 items-center gap-1 border-b border-og-border bg-og-surface-1 px-2 py-1.5", children: [
|
|
9087
8947
|
["branch", "Branch"],
|
|
9088
8948
|
["working", "Uncommitted"],
|
|
9089
8949
|
["staged", "Staged"]
|
|
9090
|
-
].map(([value, label]) => /* @__PURE__ */
|
|
8950
|
+
].map(([value, label]) => /* @__PURE__ */ jsx10(
|
|
9091
8951
|
"button",
|
|
9092
8952
|
{
|
|
9093
8953
|
type: "button",
|
|
@@ -9101,7 +8961,7 @@ function ChangesTabBody({
|
|
|
9101
8961
|
},
|
|
9102
8962
|
value
|
|
9103
8963
|
)) }),
|
|
9104
|
-
/* @__PURE__ */
|
|
8964
|
+
/* @__PURE__ */ jsx10("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsx10(ChangesTabContent, { comparison, ...props }) })
|
|
9105
8965
|
] });
|
|
9106
8966
|
}
|
|
9107
8967
|
function ChangesTabContent({
|
|
@@ -9120,8 +8980,8 @@ function ChangesTabContent({
|
|
|
9120
8980
|
}) {
|
|
9121
8981
|
const diff = git.diff;
|
|
9122
8982
|
if (diff.length > 0) {
|
|
9123
|
-
return /* @__PURE__ */
|
|
9124
|
-
git.error ? /* @__PURE__ */
|
|
8983
|
+
return /* @__PURE__ */ jsxs8("div", { className: "flex h-full min-h-0 flex-col", children: [
|
|
8984
|
+
git.error ? /* @__PURE__ */ jsxs8(
|
|
9125
8985
|
"div",
|
|
9126
8986
|
{
|
|
9127
8987
|
role: "status",
|
|
@@ -9129,9 +8989,9 @@ function ChangesTabContent({
|
|
|
9129
8989
|
"data-opengeni-changes-degraded": true,
|
|
9130
8990
|
className: "flex shrink-0 items-center gap-2 border-b border-og-status-running/30 bg-og-status-running/10 px-2 py-1.5 text-og-xs text-og-fg-muted",
|
|
9131
8991
|
children: [
|
|
9132
|
-
/* @__PURE__ */
|
|
9133
|
-
/* @__PURE__ */
|
|
9134
|
-
/* @__PURE__ */
|
|
8992
|
+
/* @__PURE__ */ jsx10(TriangleAlertIcon2, { className: "size-3.5 shrink-0 text-og-status-running", "aria-hidden": true }),
|
|
8993
|
+
/* @__PURE__ */ jsx10("span", { className: "min-w-0 flex-1", children: git.source === "capture" ? "Live changes are temporarily unavailable. Showing the latest captured revision." : "Live refresh failed. Showing the last loaded changes." }),
|
|
8994
|
+
/* @__PURE__ */ jsxs8(
|
|
9135
8995
|
"button",
|
|
9136
8996
|
{
|
|
9137
8997
|
type: "button",
|
|
@@ -9139,7 +8999,7 @@ function ChangesTabContent({
|
|
|
9139
8999
|
disabled: git.loading,
|
|
9140
9000
|
className: "inline-flex min-h-7 shrink-0 items-center gap-1 rounded-og-sm border border-og-border bg-og-surface-1 px-2 font-medium text-og-fg transition-colors hover:border-og-border-strong focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:min-h-11",
|
|
9141
9001
|
children: [
|
|
9142
|
-
/* @__PURE__ */
|
|
9002
|
+
/* @__PURE__ */ jsx10(
|
|
9143
9003
|
RefreshCwIcon2,
|
|
9144
9004
|
{
|
|
9145
9005
|
className: cn("size-3", git.loading && "animate-spin motion-reduce:animate-none"),
|
|
@@ -9153,7 +9013,7 @@ function ChangesTabContent({
|
|
|
9153
9013
|
]
|
|
9154
9014
|
}
|
|
9155
9015
|
) : null,
|
|
9156
|
-
/* @__PURE__ */
|
|
9016
|
+
/* @__PURE__ */ jsx10("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsx10(
|
|
9157
9017
|
WorkbenchChanges,
|
|
9158
9018
|
{
|
|
9159
9019
|
diff,
|
|
@@ -9166,20 +9026,20 @@ function ChangesTabContent({
|
|
|
9166
9026
|
] });
|
|
9167
9027
|
}
|
|
9168
9028
|
if (capabilitiesError && !captureAvailable) {
|
|
9169
|
-
return /* @__PURE__ */
|
|
9170
|
-
/* @__PURE__ */
|
|
9171
|
-
/* @__PURE__ */
|
|
9172
|
-
/* @__PURE__ */
|
|
9173
|
-
/* @__PURE__ */
|
|
9029
|
+
return /* @__PURE__ */ jsxs8(CenteredState, { icon: /* @__PURE__ */ jsx10(TriangleAlertIcon2, { className: "size-5", "aria-hidden": true }), tone: "danger", children: [
|
|
9030
|
+
/* @__PURE__ */ jsx10("p", { className: "text-og-sm font-medium text-og-fg", children: "Sandbox unavailable" }),
|
|
9031
|
+
/* @__PURE__ */ jsx10("p", { "data-contrast-audited": true, className: "text-og-sm leading-5 text-og-fg-muted", children: capabilitiesError.message || "Couldn't reach the sandbox for this session." }),
|
|
9032
|
+
/* @__PURE__ */ jsxs8(DockActionButton, { onClick: onRetry, children: [
|
|
9033
|
+
/* @__PURE__ */ jsx10(RefreshCwIcon2, { className: "size-3" }),
|
|
9174
9034
|
"Retry"
|
|
9175
9035
|
] })
|
|
9176
9036
|
] });
|
|
9177
9037
|
}
|
|
9178
9038
|
if ((capturePending || capabilitiesState === "negotiating") && !captureAvailable && !workspaceWaking) {
|
|
9179
|
-
return /* @__PURE__ */
|
|
9039
|
+
return /* @__PURE__ */ jsxs8(
|
|
9180
9040
|
CenteredState,
|
|
9181
9041
|
{
|
|
9182
|
-
icon: /* @__PURE__ */
|
|
9042
|
+
icon: /* @__PURE__ */ jsx10(
|
|
9183
9043
|
LoaderCircleIcon2,
|
|
9184
9044
|
{
|
|
9185
9045
|
className: "size-5 animate-spin motion-reduce:animate-none",
|
|
@@ -9187,28 +9047,28 @@ function ChangesTabContent({
|
|
|
9187
9047
|
}
|
|
9188
9048
|
),
|
|
9189
9049
|
children: [
|
|
9190
|
-
/* @__PURE__ */
|
|
9191
|
-
/* @__PURE__ */
|
|
9050
|
+
/* @__PURE__ */ jsx10("p", { className: "text-og-sm font-medium text-og-fg", children: "Connecting workspace" }),
|
|
9051
|
+
/* @__PURE__ */ jsx10("p", { className: "text-og-sm leading-5 text-og-fg-subtle", children: "Looking for the latest files and changes\u2026" })
|
|
9192
9052
|
]
|
|
9193
9053
|
}
|
|
9194
9054
|
);
|
|
9195
9055
|
}
|
|
9196
9056
|
if (!liveWorkspaceExpected && (comparison !== "working" || !captureAvailable)) {
|
|
9197
|
-
return /* @__PURE__ */
|
|
9057
|
+
return /* @__PURE__ */ jsxs8(
|
|
9198
9058
|
CenteredState,
|
|
9199
9059
|
{
|
|
9200
|
-
icon: workspaceWaking ? /* @__PURE__ */
|
|
9060
|
+
icon: workspaceWaking ? /* @__PURE__ */ jsx10(
|
|
9201
9061
|
LoaderCircleIcon2,
|
|
9202
9062
|
{
|
|
9203
9063
|
className: "size-5 animate-spin motion-reduce:animate-none",
|
|
9204
9064
|
"aria-hidden": true
|
|
9205
9065
|
}
|
|
9206
|
-
) : /* @__PURE__ */
|
|
9066
|
+
) : /* @__PURE__ */ jsx10(CpuIcon, { className: "size-5", "aria-hidden": true }),
|
|
9207
9067
|
children: [
|
|
9208
|
-
/* @__PURE__ */
|
|
9209
|
-
/* @__PURE__ */
|
|
9210
|
-
!workspaceWaking ? /* @__PURE__ */
|
|
9211
|
-
/* @__PURE__ */
|
|
9068
|
+
/* @__PURE__ */ jsx10("p", { className: "text-og-sm font-medium text-og-fg", children: workspaceWaking ? "Waking workspace" : "Workspace is resting" }),
|
|
9069
|
+
/* @__PURE__ */ jsx10("p", { className: "text-og-sm leading-5 text-og-fg-subtle", children: workspaceWaking ? "Connecting to the live working tree\u2026" : comparison === "branch" ? "Wake the sandbox to compare this branch with the remote default branch." : comparison === "staged" ? "Wake the sandbox to inspect staged changes." : "No captured revision is available yet. Wake the sandbox to inspect uncommitted changes." }),
|
|
9070
|
+
!workspaceWaking ? /* @__PURE__ */ jsxs8(DockActionButton, { onClick: onWake, children: [
|
|
9071
|
+
/* @__PURE__ */ jsx10(CpuIcon, { className: "size-3" }),
|
|
9212
9072
|
"Open live workspace"
|
|
9213
9073
|
] }) : null
|
|
9214
9074
|
]
|
|
@@ -9216,10 +9076,10 @@ function ChangesTabContent({
|
|
|
9216
9076
|
);
|
|
9217
9077
|
}
|
|
9218
9078
|
if (git.loading && git.source === null) {
|
|
9219
|
-
return /* @__PURE__ */
|
|
9079
|
+
return /* @__PURE__ */ jsxs8(
|
|
9220
9080
|
CenteredState,
|
|
9221
9081
|
{
|
|
9222
|
-
icon: /* @__PURE__ */
|
|
9082
|
+
icon: /* @__PURE__ */ jsx10(
|
|
9223
9083
|
LoaderCircleIcon2,
|
|
9224
9084
|
{
|
|
9225
9085
|
className: "size-5 animate-spin motion-reduce:animate-none",
|
|
@@ -9227,15 +9087,15 @@ function ChangesTabContent({
|
|
|
9227
9087
|
}
|
|
9228
9088
|
),
|
|
9229
9089
|
children: [
|
|
9230
|
-
/* @__PURE__ */
|
|
9231
|
-
/* @__PURE__ */
|
|
9090
|
+
/* @__PURE__ */ jsx10("p", { className: "text-og-sm font-medium text-og-fg", children: "Loading workspace" }),
|
|
9091
|
+
/* @__PURE__ */ jsx10("p", { className: "text-og-sm leading-5 text-og-fg-subtle", children: "Reading the current working tree\u2026" })
|
|
9232
9092
|
]
|
|
9233
9093
|
}
|
|
9234
9094
|
);
|
|
9235
9095
|
}
|
|
9236
|
-
return /* @__PURE__ */
|
|
9237
|
-
/* @__PURE__ */
|
|
9238
|
-
/* @__PURE__ */
|
|
9096
|
+
return /* @__PURE__ */ jsxs8(CenteredState, { icon: /* @__PURE__ */ jsx10(CircleCheckIcon, { className: "size-5", "aria-hidden": true }), tone: "success", children: [
|
|
9097
|
+
/* @__PURE__ */ jsx10("p", { className: "text-og-sm font-medium text-og-fg", children: comparison === "branch" ? "No branch changes" : comparison === "staged" ? "No staged changes" : "No uncommitted changes" }),
|
|
9098
|
+
/* @__PURE__ */ jsx10("p", { className: "text-og-sm leading-5 text-og-fg-subtle", children: comparison === "branch" ? "This branch matches the remote default branch." : comparison === "staged" ? "Stage files to review the next commit here." : "Local edits not yet committed will appear here." })
|
|
9239
9099
|
] });
|
|
9240
9100
|
}
|
|
9241
9101
|
function CenteredState({
|
|
@@ -9243,15 +9103,15 @@ function CenteredState({
|
|
|
9243
9103
|
icon,
|
|
9244
9104
|
tone = "neutral"
|
|
9245
9105
|
}) {
|
|
9246
|
-
return /* @__PURE__ */
|
|
9106
|
+
return /* @__PURE__ */ jsx10(
|
|
9247
9107
|
"div",
|
|
9248
9108
|
{
|
|
9249
9109
|
role: tone === "danger" ? "alert" : "status",
|
|
9250
9110
|
"aria-atomic": "true",
|
|
9251
9111
|
"aria-live": tone === "danger" ? "assertive" : "polite",
|
|
9252
9112
|
className: "grid h-full place-items-center p-6 text-center",
|
|
9253
|
-
children: /* @__PURE__ */
|
|
9254
|
-
icon ? /* @__PURE__ */
|
|
9113
|
+
children: /* @__PURE__ */ jsxs8("div", { className: "flex max-w-sm flex-col items-center gap-2.5", children: [
|
|
9114
|
+
icon ? /* @__PURE__ */ jsx10(
|
|
9255
9115
|
"span",
|
|
9256
9116
|
{
|
|
9257
9117
|
className: cn(
|
|
@@ -9270,7 +9130,7 @@ function CenteredState({
|
|
|
9270
9130
|
}
|
|
9271
9131
|
|
|
9272
9132
|
// src/hooks/use-codex-accounts.ts
|
|
9273
|
-
import { useCallback as useCallback25, useState as
|
|
9133
|
+
import { useCallback as useCallback25, useState as useState17 } from "react";
|
|
9274
9134
|
function isCodexAccountEvent(event) {
|
|
9275
9135
|
return [
|
|
9276
9136
|
"codex.account.switched",
|
|
@@ -9324,8 +9184,8 @@ function useCodexAccounts(options = {}) {
|
|
|
9324
9184
|
});
|
|
9325
9185
|
const { run: runMutation, mutating: pinning, mutationError } = useMutationRunner();
|
|
9326
9186
|
const { run: runUsageMutation, mutating: refreshingUsage } = useMutationRunner();
|
|
9327
|
-
const [pinningTarget, setPinningTarget] =
|
|
9328
|
-
const [switchReceipt, setSwitchReceipt] =
|
|
9187
|
+
const [pinningTarget, setPinningTarget] = useState17(null);
|
|
9188
|
+
const [switchReceipt, setSwitchReceipt] = useState17(null);
|
|
9329
9189
|
useSessionEventTrigger(
|
|
9330
9190
|
client,
|
|
9331
9191
|
workspaceId,
|