@aiti-ai/aiti-git-review 0.2.10 → 0.2.12
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 +2 -3
- package/README.zh-CN.md +2 -3
- package/client/src/entry.tsx +5 -0
- package/client/src/task-picker.tsx +5 -1
- package/dist/aiti-git-review-client.mjs +814 -125
- package/icon.svg +1 -1
- package/index.ts +110 -16
- package/lib/ai-commit.test.mjs +91 -5
- package/lib/ai-commit.ts +175 -20
- package/lib/late-result.test.mjs +71 -0
- package/lib/late-result.ts +105 -0
- package/package.json +12 -3
- package/vite.config.ts +4 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
let _ctx$2 = null;
|
|
2
|
-
function __setCtx(ctx) {
|
|
2
|
+
function __setCtx$1(ctx) {
|
|
3
3
|
_ctx$2 = ctx;
|
|
4
4
|
}
|
|
5
|
-
function extSvc(key) {
|
|
5
|
+
function extSvc$1(key) {
|
|
6
6
|
return _ctx$2?.getExtService?.(key);
|
|
7
7
|
}
|
|
8
8
|
function regSvc(key, impl) {
|
|
@@ -51,6 +51,67 @@ function t$1(key, params) {
|
|
|
51
51
|
const fn = _ctx$2?.t;
|
|
52
52
|
return typeof fn === "function" ? fn(key, params) : key;
|
|
53
53
|
}
|
|
54
|
+
function displayCwd(cwd, home) {
|
|
55
|
+
return home && cwd && cwd.startsWith(home) ? "~" + cwd.slice(home.length) : cwd;
|
|
56
|
+
}
|
|
57
|
+
const UNREAD_KEY = "pi-web:unread-session-ids";
|
|
58
|
+
function loadUnread() {
|
|
59
|
+
try {
|
|
60
|
+
const r = localStorage.getItem(UNREAD_KEY);
|
|
61
|
+
const a = r ? JSON.parse(r) : [];
|
|
62
|
+
return new Set(Array.isArray(a) ? a : []);
|
|
63
|
+
} catch {
|
|
64
|
+
return /* @__PURE__ */ new Set();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function wkKey(s) {
|
|
68
|
+
return s.projectKey || s.cwd || s.id;
|
|
69
|
+
}
|
|
70
|
+
function recentProjects(sessions) {
|
|
71
|
+
const m = /* @__PURE__ */ new Map();
|
|
72
|
+
for (const s of sessions) {
|
|
73
|
+
const root = s.projectRoot || s.cwd;
|
|
74
|
+
if (!root) continue;
|
|
75
|
+
const k = wkKey(s);
|
|
76
|
+
const p = m.get(k);
|
|
77
|
+
if (!p || s.modified > p.modified) m.set(k, { root, modified: s.modified });
|
|
78
|
+
}
|
|
79
|
+
return [...m.values()].sort((a, b) => (b.modified || "").localeCompare(a.modified || "")).map((x) => ({ key: x.root, root: x.root }));
|
|
80
|
+
}
|
|
81
|
+
function projectActivity(sessions, running, unread) {
|
|
82
|
+
const m = /* @__PURE__ */ new Map();
|
|
83
|
+
for (const s of sessions) {
|
|
84
|
+
const k = wkKey(s);
|
|
85
|
+
if (!k) continue;
|
|
86
|
+
let e = m.get(k);
|
|
87
|
+
if (!e) {
|
|
88
|
+
e = { running: 0, unread: 0 };
|
|
89
|
+
m.set(k, e);
|
|
90
|
+
}
|
|
91
|
+
if (running.has(s.id)) e.running++;
|
|
92
|
+
if (unread.has(s.id)) e.unread++;
|
|
93
|
+
}
|
|
94
|
+
return m;
|
|
95
|
+
}
|
|
96
|
+
let _ctx$1 = null;
|
|
97
|
+
function __setCtx(ctx) {
|
|
98
|
+
_ctx$1 = ctx;
|
|
99
|
+
}
|
|
100
|
+
function extSvc(key) {
|
|
101
|
+
return _ctx$1?.getExtService?.(key);
|
|
102
|
+
}
|
|
103
|
+
function apiUrl(p) {
|
|
104
|
+
const fn = _ctx$1?.apiUrl;
|
|
105
|
+
return typeof fn === "function" ? fn(p) : p;
|
|
106
|
+
}
|
|
107
|
+
function t(key, params) {
|
|
108
|
+
const fn = _ctx$1?.t;
|
|
109
|
+
return typeof fn === "function" ? fn(key, params) : key;
|
|
110
|
+
}
|
|
111
|
+
function createPortal(children, container) {
|
|
112
|
+
const fn = _ctx$1?.createPortal;
|
|
113
|
+
return typeof fn === "function" ? fn(children, container) : children;
|
|
114
|
+
}
|
|
54
115
|
function isFixedContainingBlock(cs) {
|
|
55
116
|
const zoomValue = parseFloat(cs.zoom || "");
|
|
56
117
|
if (Number.isFinite(zoomValue) && zoomValue !== 1) return true;
|
|
@@ -831,6 +892,7 @@ const DOCK_MENU_WORDS = {
|
|
|
831
892
|
block: { "zh-CN": "区块", en: "Block" },
|
|
832
893
|
position: { "zh-CN": "切换停靠位置", en: "Change dock position" },
|
|
833
894
|
actions: { "zh-CN": "区块操作", en: "Block actions" },
|
|
895
|
+
dragReorder: { "zh-CN": "拖动排序", en: "Drag to reorder" },
|
|
834
896
|
move: { "zh-CN": "移动", en: "Move" },
|
|
835
897
|
pin: { "zh-CN": "钉住", en: "Pin" },
|
|
836
898
|
unpin: { "zh-CN": "取消钉住", en: "Unpin" },
|
|
@@ -1355,7 +1417,7 @@ function DockBody(props) {
|
|
|
1355
1417
|
} };
|
|
1356
1418
|
if (chrome === "section" && kind !== "reserved") {
|
|
1357
1419
|
headerProps.draggable = true;
|
|
1358
|
-
headerProps.title = props.headerHint ?? "
|
|
1420
|
+
headerProps.title = props.headerHint ?? menuWord("dragReorder");
|
|
1359
1421
|
headerProps.onDragStart = onDragStart;
|
|
1360
1422
|
headerProps.onDragOver = (e) => {
|
|
1361
1423
|
if (isDockDrag(e) && dragKey !== blockKey) {
|
|
@@ -1522,12 +1584,12 @@ const G = {
|
|
|
1522
1584
|
probePath: "",
|
|
1523
1585
|
presetRepo: ""
|
|
1524
1586
|
};
|
|
1525
|
-
let _ctx
|
|
1587
|
+
let _ctx = null;
|
|
1526
1588
|
function setGRCtx(ctx) {
|
|
1527
|
-
_ctx
|
|
1589
|
+
_ctx = ctx;
|
|
1528
1590
|
}
|
|
1529
1591
|
function getCtx() {
|
|
1530
|
-
return _ctx
|
|
1592
|
+
return _ctx;
|
|
1531
1593
|
}
|
|
1532
1594
|
const lastSeg = (p) => {
|
|
1533
1595
|
const s = String(p).split("/");
|
|
@@ -1970,57 +2032,6 @@ function dedupeFetch(url, options) {
|
|
|
1970
2032
|
inflight.set(url, { promise, freshUntil: 0 });
|
|
1971
2033
|
return promise.then((r) => r.clone());
|
|
1972
2034
|
}
|
|
1973
|
-
function displayCwd(cwd, home) {
|
|
1974
|
-
return home && cwd && cwd.startsWith(home) ? "~" + cwd.slice(home.length) : cwd;
|
|
1975
|
-
}
|
|
1976
|
-
const UNREAD_KEY = "pi-web:unread-session-ids";
|
|
1977
|
-
function loadUnread() {
|
|
1978
|
-
try {
|
|
1979
|
-
const r = localStorage.getItem(UNREAD_KEY);
|
|
1980
|
-
const a = r ? JSON.parse(r) : [];
|
|
1981
|
-
return new Set(Array.isArray(a) ? a : []);
|
|
1982
|
-
} catch {
|
|
1983
|
-
return /* @__PURE__ */ new Set();
|
|
1984
|
-
}
|
|
1985
|
-
}
|
|
1986
|
-
function wkKey(s) {
|
|
1987
|
-
return s.projectKey || s.cwd || s.id;
|
|
1988
|
-
}
|
|
1989
|
-
function recentProjects(sessions) {
|
|
1990
|
-
const m = /* @__PURE__ */ new Map();
|
|
1991
|
-
for (const s of sessions) {
|
|
1992
|
-
const root = s.projectRoot || s.cwd;
|
|
1993
|
-
if (!root) continue;
|
|
1994
|
-
const k = wkKey(s);
|
|
1995
|
-
const p = m.get(k);
|
|
1996
|
-
if (!p || s.modified > p.modified) m.set(k, { root, modified: s.modified });
|
|
1997
|
-
}
|
|
1998
|
-
return [...m.values()].sort((a, b) => (b.modified || "").localeCompare(a.modified || "")).map((x) => ({ key: x.root, root: x.root }));
|
|
1999
|
-
}
|
|
2000
|
-
function projectActivity(sessions, running, unread) {
|
|
2001
|
-
const m = /* @__PURE__ */ new Map();
|
|
2002
|
-
for (const s of sessions) {
|
|
2003
|
-
const k = wkKey(s);
|
|
2004
|
-
if (!k) continue;
|
|
2005
|
-
let e = m.get(k);
|
|
2006
|
-
if (!e) {
|
|
2007
|
-
e = { running: 0, unread: 0 };
|
|
2008
|
-
m.set(k, e);
|
|
2009
|
-
}
|
|
2010
|
-
if (running.has(s.id)) e.running++;
|
|
2011
|
-
if (unread.has(s.id)) e.unread++;
|
|
2012
|
-
}
|
|
2013
|
-
return m;
|
|
2014
|
-
}
|
|
2015
|
-
let _ctx = null;
|
|
2016
|
-
function apiUrl(p) {
|
|
2017
|
-
const fn = _ctx?.apiUrl;
|
|
2018
|
-
return typeof fn === "function" ? fn(p) : p;
|
|
2019
|
-
}
|
|
2020
|
-
function t(key, params) {
|
|
2021
|
-
const fn = _ctx?.t;
|
|
2022
|
-
return typeof fn === "function" ? fn(key, params) : key;
|
|
2023
|
-
}
|
|
2024
2035
|
const COMPONENT_DICT = {
|
|
2025
2036
|
en: {
|
|
2026
2037
|
"files.cancel": "Cancel",
|
|
@@ -2029,7 +2040,28 @@ const COMPONENT_DICT = {
|
|
|
2029
2040
|
"files.parentDir": "Parent directory",
|
|
2030
2041
|
"files.selectFolder": "Select this folder",
|
|
2031
2042
|
"i18n.close": "Close",
|
|
2043
|
+
"i18n.cancel": "Cancel",
|
|
2044
|
+
"i18n.checking": "Checking…",
|
|
2032
2045
|
"sidebar.customPath": "Custom path…",
|
|
2046
|
+
// Shared directory picker (extensions/_shared/directory-picker.tsx)
|
|
2047
|
+
"directoryPicker.selectDirectory": "Select directory",
|
|
2048
|
+
"directoryPicker.goToParent": "Go to parent directory",
|
|
2049
|
+
"directoryPicker.directoryPath": "Directory path",
|
|
2050
|
+
"directoryPicker.editPath": "Edit path",
|
|
2051
|
+
"directoryPicker.pathEditHint": "Click or type to edit the path (Alt+D / Ctrl+L)",
|
|
2052
|
+
"directoryPicker.copyPath": "Copy path",
|
|
2053
|
+
"directoryPicker.copied": "Path copied",
|
|
2054
|
+
"directoryPicker.pathPlaceholder": "/path/to/project or ~/project",
|
|
2055
|
+
"directoryPicker.loadingDirectories": "Loading directories…",
|
|
2056
|
+
"directoryPicker.noDrives": "No drives found",
|
|
2057
|
+
"directoryPicker.noSubdirectories": "No subdirectories",
|
|
2058
|
+
"directoryPicker.selectCurrentDirectory": "Select current directory",
|
|
2059
|
+
"directoryPicker.selectThisFolder": "Select this folder",
|
|
2060
|
+
"directoryPicker.newFolder": "New folder",
|
|
2061
|
+
"directoryPicker.newFolderIn": "Create a new folder in {path}",
|
|
2062
|
+
"directoryPicker.folderName": "Folder name",
|
|
2063
|
+
"directoryPicker.create": "Create",
|
|
2064
|
+
"directoryPicker.creating": "Creating…",
|
|
2033
2065
|
"files.openFolder": "Open Folder",
|
|
2034
2066
|
"sidebar.filterProjects": "Filter projects…",
|
|
2035
2067
|
"sidebar.noMatchingProjects": "No matching projects",
|
|
@@ -2068,7 +2100,11 @@ const COMPONENT_DICT = {
|
|
|
2068
2100
|
"git.aiRefine": "AI refine",
|
|
2069
2101
|
"git.aiRefineBusy": "AI grouping… (up to 3 min)",
|
|
2070
2102
|
"git.aiMessage": "Generate",
|
|
2071
|
-
"git.aiMessageBusy": "Generating… (
|
|
2103
|
+
"git.aiMessageBusy": "Generating… (usually under a minute)",
|
|
2104
|
+
"git.aiMessageBusyLong": "Still generating… (large changes take longer)",
|
|
2105
|
+
"git.aiMessagePending": "Still waiting… (the session keeps running in the background)",
|
|
2106
|
+
"git.aiMessageStillPending": "The session is still generating in the background — open the dialog again and press Generate to pick the result up.",
|
|
2107
|
+
"git.aiMessageEmpty": "The AI answered, but the text could not be cleaned into a commit message — please retry.",
|
|
2072
2108
|
"git.aiMessageOverwrite": "Message already has content. Overwrite with the generated commit message?",
|
|
2073
2109
|
"git.aiMessageTitle": "Generate a commit message with AI (reads AGENTS.md and the diff of selected files)",
|
|
2074
2110
|
"git.stagedBucket": "Staged",
|
|
@@ -2090,7 +2126,28 @@ const COMPONENT_DICT = {
|
|
|
2090
2126
|
"files.parentDir": "上级目录",
|
|
2091
2127
|
"files.selectFolder": "选择此文件夹",
|
|
2092
2128
|
"i18n.close": "关闭",
|
|
2129
|
+
"i18n.cancel": "取消",
|
|
2130
|
+
"i18n.checking": "检查中…",
|
|
2093
2131
|
"sidebar.customPath": "自定义路径…",
|
|
2132
|
+
// Shared directory picker (extensions/_shared/directory-picker.tsx)
|
|
2133
|
+
"directoryPicker.selectDirectory": "选择目录",
|
|
2134
|
+
"directoryPicker.goToParent": "转到上级目录",
|
|
2135
|
+
"directoryPicker.directoryPath": "目录路径",
|
|
2136
|
+
"directoryPicker.editPath": "编辑路径",
|
|
2137
|
+
"directoryPicker.pathEditHint": "点击或直接键入以编辑路径(Alt+D / Ctrl+L)",
|
|
2138
|
+
"directoryPicker.copyPath": "复制路径",
|
|
2139
|
+
"directoryPicker.copied": "已复制路径",
|
|
2140
|
+
"directoryPicker.pathPlaceholder": "/路径/到/项目 或 ~/项目",
|
|
2141
|
+
"directoryPicker.loadingDirectories": "正在加载目录…",
|
|
2142
|
+
"directoryPicker.noDrives": "未找到盘符",
|
|
2143
|
+
"directoryPicker.noSubdirectories": "没有子目录",
|
|
2144
|
+
"directoryPicker.selectCurrentDirectory": "选择当前目录",
|
|
2145
|
+
"directoryPicker.selectThisFolder": "选择此文件夹",
|
|
2146
|
+
"directoryPicker.newFolder": "新建文件夹",
|
|
2147
|
+
"directoryPicker.newFolderIn": "在 {path} 新建文件夹",
|
|
2148
|
+
"directoryPicker.folderName": "文件夹名",
|
|
2149
|
+
"directoryPicker.create": "创建",
|
|
2150
|
+
"directoryPicker.creating": "创建中…",
|
|
2094
2151
|
"files.openFolder": "打开文件夹",
|
|
2095
2152
|
"sidebar.filterProjects": "筛选项目…",
|
|
2096
2153
|
"sidebar.noMatchingProjects": "没有匹配的项目",
|
|
@@ -2129,7 +2186,11 @@ const COMPONENT_DICT = {
|
|
|
2129
2186
|
"git.aiRefine": "AI 精修",
|
|
2130
2187
|
"git.aiRefineBusy": "AI 分组中…(最长 3 分钟)",
|
|
2131
2188
|
"git.aiMessage": "生成",
|
|
2132
|
-
"git.aiMessageBusy": "
|
|
2189
|
+
"git.aiMessageBusy": "生成中…(通常 1 分钟内)",
|
|
2190
|
+
"git.aiMessageBusyLong": "仍在生成…(改动较大时需要更久)",
|
|
2191
|
+
"git.aiMessagePending": "仍在等待…(会话在后台继续生成)",
|
|
2192
|
+
"git.aiMessageStillPending": "会话仍在后台生成——稍后重新打开本弹窗、再点一次生成即可取回结果。",
|
|
2193
|
+
"git.aiMessageEmpty": "AI 已作答,但无法整理成提交信息——请重试。",
|
|
2133
2194
|
"git.aiMessageOverwrite": "输入框已有内容,生成结果将覆盖,是否继续?",
|
|
2134
2195
|
"git.aiMessageTitle": "AI 生成提交信息(读取 AGENTS.md 与所选文件的 diff)",
|
|
2135
2196
|
"git.stagedBucket": "已暂存",
|
|
@@ -2160,10 +2221,10 @@ function ct(key, params) {
|
|
|
2160
2221
|
}
|
|
2161
2222
|
return hit;
|
|
2162
2223
|
}
|
|
2163
|
-
function FolderIcon({ open, size }) {
|
|
2224
|
+
function FolderIcon$1({ open, size }) {
|
|
2164
2225
|
return /* @__PURE__ */ jsx("svg", { width: size ?? 14, height: size ?? 14, viewBox: "0 0 24 24", fill: "none", stroke: "var(--text-dim)", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx("path", { d: open ? "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2" : "M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z" }) });
|
|
2165
2226
|
}
|
|
2166
|
-
function CheckIcon() {
|
|
2227
|
+
function CheckIcon$1() {
|
|
2167
2228
|
return /* @__PURE__ */ jsx("svg", { width: 10, height: 10, viewBox: "0 0 10 10", fill: "none", stroke: "var(--accent)", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx("polyline", { points: "1.5 5 4 7.5 8.5 2.5" }) });
|
|
2168
2229
|
}
|
|
2169
2230
|
function PathLabel({ text, style }) {
|
|
@@ -2185,66 +2246,691 @@ function ActivityBadges({ act, t: t2 }) {
|
|
|
2185
2246
|
] }) : null
|
|
2186
2247
|
] });
|
|
2187
2248
|
}
|
|
2188
|
-
const
|
|
2189
|
-
function
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
const
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2249
|
+
const OVERLAY_BACK_MOBILE_QUERY = "(max-width: 640px)";
|
|
2250
|
+
function dismissOnBack(getService, close) {
|
|
2251
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return () => {
|
|
2252
|
+
};
|
|
2253
|
+
const mq = window.matchMedia(OVERLAY_BACK_MOBILE_QUERY);
|
|
2254
|
+
let handle = null;
|
|
2255
|
+
let released = false;
|
|
2256
|
+
const sync = () => {
|
|
2257
|
+
if (released) return;
|
|
2258
|
+
let service;
|
|
2259
|
+
try {
|
|
2260
|
+
service = getService();
|
|
2261
|
+
} catch {
|
|
2262
|
+
service = null;
|
|
2263
|
+
}
|
|
2264
|
+
const should = mq.matches && !!service && typeof service.acquire === "function";
|
|
2265
|
+
if (should && !handle) {
|
|
2266
|
+
try {
|
|
2267
|
+
handle = service.acquire(close);
|
|
2268
|
+
} catch {
|
|
2269
|
+
handle = null;
|
|
2270
|
+
}
|
|
2271
|
+
} else if (!should && handle) {
|
|
2272
|
+
const prev = handle;
|
|
2273
|
+
handle = null;
|
|
2274
|
+
try {
|
|
2275
|
+
prev.release();
|
|
2276
|
+
} catch {
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
};
|
|
2280
|
+
sync();
|
|
2281
|
+
const onChange = () => sync();
|
|
2282
|
+
if (typeof mq.addEventListener === "function") mq.addEventListener("change", onChange);
|
|
2283
|
+
else mq.addListener(onChange);
|
|
2284
|
+
return () => {
|
|
2285
|
+
if (released) return;
|
|
2286
|
+
released = true;
|
|
2287
|
+
if (typeof mq.removeEventListener === "function") mq.removeEventListener("change", onChange);
|
|
2288
|
+
else mq.removeListener(onChange);
|
|
2289
|
+
const prev = handle;
|
|
2290
|
+
handle = null;
|
|
2291
|
+
if (prev) {
|
|
2292
|
+
try {
|
|
2293
|
+
prev.release();
|
|
2294
|
+
} catch {
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
};
|
|
2298
|
+
}
|
|
2299
|
+
const DIRECTORY_PICKER_ATTR = "data-aiti-directory-picker";
|
|
2300
|
+
function isDirectoryPickerTarget(target) {
|
|
2301
|
+
const el = target;
|
|
2302
|
+
try {
|
|
2303
|
+
return typeof el?.closest === "function" && !!el.closest(`[${DIRECTORY_PICKER_ATTR}]`);
|
|
2304
|
+
} catch {
|
|
2305
|
+
return false;
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
const DRIVE_RE = /^[a-zA-Z]:/;
|
|
2309
|
+
function isWindowsPath(value) {
|
|
2310
|
+
if (value.startsWith("\\\\")) return true;
|
|
2311
|
+
if (DRIVE_RE.test(value)) return true;
|
|
2312
|
+
return !value.startsWith("/") && value.includes("\\") && !value.includes("/");
|
|
2313
|
+
}
|
|
2314
|
+
function splitPosix(value) {
|
|
2315
|
+
const absolute = value.startsWith("/");
|
|
2316
|
+
const parts = value.split("/").filter(Boolean);
|
|
2317
|
+
let acc = "";
|
|
2318
|
+
const segments = [];
|
|
2319
|
+
for (const part of parts) {
|
|
2320
|
+
acc = acc ? `${acc}/${part}` : absolute ? `/${part}` : part;
|
|
2321
|
+
segments.push({ label: part, path: acc });
|
|
2322
|
+
}
|
|
2323
|
+
return { sep: "/", root: absolute ? { label: "/", path: "/" } : null, segments };
|
|
2324
|
+
}
|
|
2325
|
+
function splitWindows(value) {
|
|
2326
|
+
const unc = value.startsWith("\\\\");
|
|
2327
|
+
const normalized = unc ? "\\\\" + value.slice(2).replace(/[\\/]+/g, "\\") : value.replace(/[\\/]+/g, "\\");
|
|
2328
|
+
let root = null;
|
|
2329
|
+
let acc = "";
|
|
2330
|
+
let rest = normalized;
|
|
2331
|
+
if (unc) {
|
|
2332
|
+
const parts2 = normalized.slice(2).split("\\").filter(Boolean);
|
|
2333
|
+
const server = parts2.shift() ?? "";
|
|
2334
|
+
const share = parts2.shift() ?? "";
|
|
2335
|
+
const rootPath = share ? `\\\\${server}\\${share}` : server ? `\\\\${server}` : "\\\\";
|
|
2336
|
+
root = { label: rootPath, path: rootPath };
|
|
2337
|
+
acc = rootPath;
|
|
2338
|
+
rest = parts2.length > 0 ? "\\" + parts2.join("\\") : "";
|
|
2339
|
+
} else {
|
|
2340
|
+
const drive = DRIVE_RE.exec(normalized)?.[0] ?? null;
|
|
2341
|
+
if (drive) {
|
|
2342
|
+
const rootPath = `${drive}\\`;
|
|
2343
|
+
root = { label: drive, path: rootPath };
|
|
2344
|
+
acc = drive;
|
|
2345
|
+
rest = normalized.slice(drive.length);
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2348
|
+
const parts = rest.split("\\").filter(Boolean);
|
|
2349
|
+
const segments = [];
|
|
2350
|
+
for (const part of parts) {
|
|
2351
|
+
acc = acc ? `${acc}\\${part}` : part;
|
|
2352
|
+
segments.push({ label: part, path: acc });
|
|
2353
|
+
}
|
|
2354
|
+
return { sep: "\\", root, segments };
|
|
2355
|
+
}
|
|
2356
|
+
function splitPathSegments(input) {
|
|
2357
|
+
const value = typeof input === "string" ? input : "";
|
|
2358
|
+
if (!value) return { sep: "/", root: null, segments: [] };
|
|
2359
|
+
return isWindowsPath(value) ? splitWindows(value) : splitPosix(value);
|
|
2360
|
+
}
|
|
2361
|
+
const BOX = {
|
|
2362
|
+
display: "flex",
|
|
2363
|
+
alignItems: "center",
|
|
2364
|
+
gap: 1,
|
|
2365
|
+
minWidth: 0,
|
|
2366
|
+
height: 36,
|
|
2367
|
+
padding: "0 4px 0 6px",
|
|
2368
|
+
border: "1px solid var(--border)",
|
|
2369
|
+
borderRadius: 6,
|
|
2370
|
+
background: "var(--bg-panel)",
|
|
2371
|
+
color: "var(--text)",
|
|
2372
|
+
fontFamily: "var(--font-mono)",
|
|
2373
|
+
fontSize: 12,
|
|
2374
|
+
boxSizing: "border-box"
|
|
2375
|
+
};
|
|
2376
|
+
const SEGMENT = {
|
|
2377
|
+
minWidth: 22,
|
|
2378
|
+
maxWidth: 240,
|
|
2379
|
+
height: 24,
|
|
2380
|
+
padding: "0 4px",
|
|
2381
|
+
border: 0,
|
|
2382
|
+
borderRadius: 4,
|
|
2383
|
+
background: "none",
|
|
2384
|
+
color: "var(--text-muted)",
|
|
2385
|
+
font: "inherit",
|
|
2386
|
+
cursor: "pointer",
|
|
2387
|
+
overflow: "hidden",
|
|
2388
|
+
textOverflow: "ellipsis",
|
|
2389
|
+
whiteSpace: "nowrap"
|
|
2390
|
+
};
|
|
2391
|
+
const ICON_BUTTON = {
|
|
2392
|
+
flexShrink: 0,
|
|
2393
|
+
width: 24,
|
|
2394
|
+
height: 24,
|
|
2395
|
+
padding: 0,
|
|
2396
|
+
display: "flex",
|
|
2397
|
+
alignItems: "center",
|
|
2398
|
+
justifyContent: "center",
|
|
2399
|
+
border: 0,
|
|
2400
|
+
borderRadius: 4,
|
|
2401
|
+
background: "none",
|
|
2402
|
+
color: "var(--text-dim)",
|
|
2403
|
+
cursor: "pointer"
|
|
2404
|
+
};
|
|
2405
|
+
function CopyIcon() {
|
|
2406
|
+
return /* @__PURE__ */ jsxs("svg", { width: "12", height: "12", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.3", "aria-hidden": "true", children: [
|
|
2407
|
+
/* @__PURE__ */ jsx("rect", { x: "5.5", y: "5.5", width: "8", height: "8", rx: "1.2" }),
|
|
2408
|
+
/* @__PURE__ */ jsx("path", { d: "M10.5 5.5v-1a1 1 0 0 0-1-1h-7a1 1 0 0 0-1 1v7a1 1 0 0 0 1 1h1" })
|
|
2409
|
+
] });
|
|
2410
|
+
}
|
|
2411
|
+
function CheckIcon() {
|
|
2412
|
+
return /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 16 16", fill: "none", stroke: "var(--accent)", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("polyline", { points: "2.5 8.5 6 12 13.5 4" }) });
|
|
2413
|
+
}
|
|
2414
|
+
async function writeClipboard(text) {
|
|
2415
|
+
try {
|
|
2416
|
+
if (navigator.clipboard?.writeText) {
|
|
2417
|
+
await navigator.clipboard.writeText(text);
|
|
2418
|
+
return true;
|
|
2419
|
+
}
|
|
2420
|
+
} catch {
|
|
2421
|
+
}
|
|
2422
|
+
const area = document.createElement("textarea");
|
|
2423
|
+
area.value = text;
|
|
2424
|
+
area.setAttribute("readonly", "");
|
|
2425
|
+
area.style.position = "fixed";
|
|
2426
|
+
area.style.top = "-1000px";
|
|
2427
|
+
area.style.opacity = "0";
|
|
2428
|
+
document.body.appendChild(area);
|
|
2429
|
+
try {
|
|
2430
|
+
area.select();
|
|
2431
|
+
return document.execCommand("copy");
|
|
2432
|
+
} catch {
|
|
2433
|
+
return false;
|
|
2434
|
+
} finally {
|
|
2435
|
+
area.remove();
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
function PathBreadcrumb(props) {
|
|
2439
|
+
const { value, disabled = false, onNavigate } = props;
|
|
2440
|
+
const [editing, setEditingState] = useState(false);
|
|
2441
|
+
const [draft, setDraft] = useState("");
|
|
2442
|
+
const [copied, setCopied] = useState(false);
|
|
2443
|
+
const inputRef = useRef(null);
|
|
2444
|
+
const hotRef = useRef(null);
|
|
2445
|
+
const editingRef = useRef(false);
|
|
2446
|
+
const draftRef = useRef("");
|
|
2447
|
+
const copyTimerRef = useRef(null);
|
|
2448
|
+
const mountedRef = useRef(true);
|
|
2449
|
+
const propsRef = useRef(props);
|
|
2450
|
+
propsRef.current = props;
|
|
2451
|
+
const setEditing = useCallback((on) => {
|
|
2452
|
+
editingRef.current = on;
|
|
2453
|
+
setEditingState(on);
|
|
2454
|
+
propsRef.current.onEditingChange?.(on);
|
|
2208
2455
|
}, []);
|
|
2456
|
+
const enterEdit = useCallback((seed) => {
|
|
2457
|
+
if (propsRef.current.disabled) return;
|
|
2458
|
+
const next = seed !== void 0 ? seed : propsRef.current.value;
|
|
2459
|
+
draftRef.current = next;
|
|
2460
|
+
setDraft(next);
|
|
2461
|
+
setEditing(true);
|
|
2462
|
+
}, [setEditing]);
|
|
2463
|
+
const commitEdit = useCallback(() => {
|
|
2464
|
+
if (!editingRef.current) return;
|
|
2465
|
+
const next = draftRef.current.trim();
|
|
2466
|
+
setEditing(false);
|
|
2467
|
+
if (next && next !== propsRef.current.value) propsRef.current.onNavigate(next);
|
|
2468
|
+
}, [setEditing]);
|
|
2469
|
+
const cancelEdit = useCallback(() => {
|
|
2470
|
+
if (!editingRef.current) return;
|
|
2471
|
+
setEditing(false);
|
|
2472
|
+
}, [setEditing]);
|
|
2473
|
+
useEffect(() => {
|
|
2474
|
+
if (!editing) return;
|
|
2475
|
+
const field = inputRef.current;
|
|
2476
|
+
if (!field) return;
|
|
2477
|
+
field.focus();
|
|
2478
|
+
field.select();
|
|
2479
|
+
}, [editing]);
|
|
2480
|
+
useEffect(() => {
|
|
2481
|
+
if (!editing && props.autoFocus) hotRef.current?.focus({ preventScroll: true });
|
|
2482
|
+
}, [editing, props.autoFocus]);
|
|
2209
2483
|
useEffect(() => {
|
|
2210
|
-
|
|
2211
|
-
|
|
2484
|
+
mountedRef.current = true;
|
|
2485
|
+
return () => {
|
|
2486
|
+
mountedRef.current = false;
|
|
2487
|
+
if (copyTimerRef.current !== null) window.clearTimeout(copyTimerRef.current);
|
|
2212
2488
|
};
|
|
2213
|
-
|
|
2214
|
-
|
|
2489
|
+
}, []);
|
|
2490
|
+
const copyPath = useCallback(() => {
|
|
2491
|
+
if (!propsRef.current.value) return;
|
|
2492
|
+
void writeClipboard(propsRef.current.value).then((ok) => {
|
|
2493
|
+
if (!mountedRef.current) return;
|
|
2494
|
+
if (!ok) {
|
|
2495
|
+
enterEdit();
|
|
2496
|
+
return;
|
|
2497
|
+
}
|
|
2498
|
+
setCopied(true);
|
|
2499
|
+
if (copyTimerRef.current !== null) window.clearTimeout(copyTimerRef.current);
|
|
2500
|
+
copyTimerRef.current = window.setTimeout(() => {
|
|
2501
|
+
if (mountedRef.current) setCopied(false);
|
|
2502
|
+
}, 1200);
|
|
2503
|
+
});
|
|
2504
|
+
}, [enterEdit]);
|
|
2505
|
+
const handleBarKeyDown = (event) => {
|
|
2506
|
+
if (editingRef.current || propsRef.current.disabled) return;
|
|
2507
|
+
if (event.altKey && (event.key === "d" || event.key === "D")) {
|
|
2508
|
+
event.preventDefault();
|
|
2509
|
+
enterEdit();
|
|
2510
|
+
return;
|
|
2511
|
+
}
|
|
2512
|
+
if ((event.ctrlKey || event.metaKey) && (event.key === "l" || event.key === "L")) {
|
|
2513
|
+
event.preventDefault();
|
|
2514
|
+
enterEdit();
|
|
2515
|
+
return;
|
|
2516
|
+
}
|
|
2517
|
+
if (event.key === "Enter" || event.key === "F2") {
|
|
2518
|
+
event.preventDefault();
|
|
2519
|
+
enterEdit();
|
|
2520
|
+
return;
|
|
2521
|
+
}
|
|
2522
|
+
if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
|
|
2523
|
+
event.preventDefault();
|
|
2524
|
+
enterEdit(event.key);
|
|
2525
|
+
}
|
|
2526
|
+
};
|
|
2527
|
+
const split = splitPathSegments(value);
|
|
2528
|
+
const copyTitle = copied ? props.copiedLabel : props.copyLabel;
|
|
2529
|
+
return /* @__PURE__ */ jsxs(
|
|
2530
|
+
"div",
|
|
2531
|
+
{
|
|
2532
|
+
className: "path-breadcrumb",
|
|
2533
|
+
role: "group",
|
|
2534
|
+
"aria-label": props.label,
|
|
2535
|
+
onKeyDown: handleBarKeyDown,
|
|
2536
|
+
style: { ...BOX, ...props.style },
|
|
2537
|
+
"data-editing": editing ? "1" : void 0,
|
|
2538
|
+
children: [
|
|
2539
|
+
editing ? /* @__PURE__ */ jsx(
|
|
2540
|
+
"input",
|
|
2541
|
+
{
|
|
2542
|
+
ref: inputRef,
|
|
2543
|
+
className: "path-breadcrumb-input",
|
|
2544
|
+
type: "text",
|
|
2545
|
+
value: draft,
|
|
2546
|
+
placeholder: props.placeholder,
|
|
2547
|
+
autoComplete: "off",
|
|
2548
|
+
spellCheck: false,
|
|
2549
|
+
"aria-label": props.label,
|
|
2550
|
+
onChange: (event) => {
|
|
2551
|
+
draftRef.current = event.target.value;
|
|
2552
|
+
setDraft(event.target.value);
|
|
2553
|
+
},
|
|
2554
|
+
onKeyDown: (event) => {
|
|
2555
|
+
if (event.nativeEvent.isComposing || event.keyCode === 229) return;
|
|
2556
|
+
if (event.key === "Enter") {
|
|
2557
|
+
event.preventDefault();
|
|
2558
|
+
event.stopPropagation();
|
|
2559
|
+
commitEdit();
|
|
2560
|
+
return;
|
|
2561
|
+
}
|
|
2562
|
+
if (event.key === "Escape") {
|
|
2563
|
+
event.preventDefault();
|
|
2564
|
+
event.stopPropagation();
|
|
2565
|
+
cancelEdit();
|
|
2566
|
+
}
|
|
2567
|
+
},
|
|
2568
|
+
onBlur: commitEdit,
|
|
2569
|
+
style: { minWidth: 0, flex: 1, height: 28, padding: "0 8px", border: 0, outline: "none", background: "transparent", color: "var(--text)", fontFamily: "var(--font-mono)", fontSize: 12 }
|
|
2570
|
+
}
|
|
2571
|
+
) : value ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2572
|
+
split.root && /* @__PURE__ */ jsx(
|
|
2573
|
+
"button",
|
|
2574
|
+
{
|
|
2575
|
+
type: "button",
|
|
2576
|
+
className: "path-breadcrumb-segment is-root",
|
|
2577
|
+
title: split.root.path,
|
|
2578
|
+
disabled,
|
|
2579
|
+
onClick: () => {
|
|
2580
|
+
if (split.root && split.root.path !== value) onNavigate(split.root.path);
|
|
2581
|
+
},
|
|
2582
|
+
style: { ...SEGMENT, flexShrink: 0, color: "var(--text-muted)" },
|
|
2583
|
+
children: split.root.label
|
|
2584
|
+
}
|
|
2585
|
+
),
|
|
2586
|
+
split.segments.map((segment, index) => {
|
|
2587
|
+
const last = index === split.segments.length - 1;
|
|
2588
|
+
const showSep = split.root ? !(index === 0 && split.root.path.endsWith(split.sep)) : false;
|
|
2589
|
+
return /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", alignItems: "center", minWidth: 0, flexShrink: last ? 1 : 100 }, children: [
|
|
2590
|
+
showSep ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: { flexShrink: 0, color: "var(--text-dim)" }, children: split.sep }) : null,
|
|
2591
|
+
/* @__PURE__ */ jsx(
|
|
2592
|
+
"button",
|
|
2593
|
+
{
|
|
2594
|
+
type: "button",
|
|
2595
|
+
className: `path-breadcrumb-segment${last ? " is-current" : ""}`,
|
|
2596
|
+
title: segment.path,
|
|
2597
|
+
disabled,
|
|
2598
|
+
onClick: () => {
|
|
2599
|
+
if (segment.path !== value) onNavigate(segment.path);
|
|
2600
|
+
},
|
|
2601
|
+
style: { ...SEGMENT, color: last ? "var(--text)" : "var(--text-muted)", fontWeight: last ? 600 : 400, maxWidth: last ? void 0 : 180 },
|
|
2602
|
+
children: segment.label
|
|
2603
|
+
}
|
|
2604
|
+
)
|
|
2605
|
+
] }, segment.path);
|
|
2606
|
+
}),
|
|
2607
|
+
/* @__PURE__ */ jsx(
|
|
2608
|
+
"button",
|
|
2609
|
+
{
|
|
2610
|
+
type: "button",
|
|
2611
|
+
ref: hotRef,
|
|
2612
|
+
className: "path-breadcrumb-edit-hot",
|
|
2613
|
+
"aria-label": props.editLabel,
|
|
2614
|
+
title: props.editHint ?? props.editLabel,
|
|
2615
|
+
autoFocus: props.autoFocus,
|
|
2616
|
+
onClick: () => enterEdit(),
|
|
2617
|
+
style: { flex: 1, minWidth: 18, height: "100%", padding: 0, border: 0, background: "none", cursor: "text" }
|
|
2618
|
+
}
|
|
2619
|
+
)
|
|
2620
|
+
] }) : /* @__PURE__ */ jsx(
|
|
2621
|
+
"button",
|
|
2622
|
+
{
|
|
2623
|
+
type: "button",
|
|
2624
|
+
ref: hotRef,
|
|
2625
|
+
className: "path-breadcrumb-edit-hot",
|
|
2626
|
+
"aria-label": props.editLabel,
|
|
2627
|
+
title: props.editHint ?? props.editLabel,
|
|
2628
|
+
autoFocus: props.autoFocus,
|
|
2629
|
+
onClick: () => enterEdit(),
|
|
2630
|
+
style: { flex: 1, minWidth: 18, height: "100%", padding: "0 8px", border: 0, background: "none", color: "var(--text-dim)", font: "inherit", textAlign: "left", cursor: "text" },
|
|
2631
|
+
children: props.placeholder
|
|
2632
|
+
}
|
|
2633
|
+
),
|
|
2634
|
+
/* @__PURE__ */ jsx(
|
|
2635
|
+
"button",
|
|
2636
|
+
{
|
|
2637
|
+
type: "button",
|
|
2638
|
+
className: "path-breadcrumb-copy",
|
|
2639
|
+
"aria-label": copyTitle,
|
|
2640
|
+
title: copyTitle,
|
|
2641
|
+
disabled: disabled || !value || editing,
|
|
2642
|
+
onClick: copyPath,
|
|
2643
|
+
style: { ...ICON_BUTTON, cursor: disabled || !value || editing ? "default" : "pointer", opacity: disabled || !value ? 0.5 : 1 },
|
|
2644
|
+
children: copied ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(CopyIcon, {})
|
|
2645
|
+
}
|
|
2646
|
+
)
|
|
2647
|
+
]
|
|
2648
|
+
}
|
|
2649
|
+
);
|
|
2650
|
+
}
|
|
2651
|
+
const DEFAULT_CREATE_FOLDER_URL = "/api/extensions/aiti-folder/create-folder";
|
|
2652
|
+
async function loadDirectories(host, directory) {
|
|
2653
|
+
const response = await fetch(host.apiUrl("/api/cwd/browse"), {
|
|
2654
|
+
method: "POST",
|
|
2655
|
+
headers: { "content-type": "application/json" },
|
|
2656
|
+
body: JSON.stringify({ path: directory ?? void 0 })
|
|
2657
|
+
});
|
|
2658
|
+
const data = await response.json();
|
|
2659
|
+
if (!response.ok || data.error) throw new Error(data.error ?? `HTTP ${response.status}`);
|
|
2660
|
+
return data;
|
|
2661
|
+
}
|
|
2662
|
+
async function createFolder(host, directory, name) {
|
|
2663
|
+
const response = await fetch(host.apiUrl(host.createFolderUrl ?? DEFAULT_CREATE_FOLDER_URL), {
|
|
2664
|
+
method: "POST",
|
|
2665
|
+
headers: { "content-type": "application/json" },
|
|
2666
|
+
body: JSON.stringify({ dir: directory, name })
|
|
2667
|
+
});
|
|
2668
|
+
const data = await response.json().catch(() => ({}));
|
|
2669
|
+
if (!response.ok || !data.ok || !data.path) throw new Error(data.error ?? `HTTP ${response.status}`);
|
|
2670
|
+
return data.path;
|
|
2671
|
+
}
|
|
2672
|
+
function FolderIcon() {
|
|
2673
|
+
return /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.3", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M1.5 3h4l1.5 2h7.5v7.5h-13z" }) });
|
|
2674
|
+
}
|
|
2675
|
+
function FolderPlusIcon() {
|
|
2676
|
+
return /* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", "aria-hidden": "true", children: [
|
|
2677
|
+
/* @__PURE__ */ jsx("path", { d: "M1.5 3h4l1.5 2h7.5v7.5h-13z" }),
|
|
2678
|
+
/* @__PURE__ */ jsx("path", { d: "M8 7v3.5M6.25 8.75h3.5" })
|
|
2679
|
+
] });
|
|
2680
|
+
}
|
|
2681
|
+
function DriveIcon() {
|
|
2682
|
+
return /* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
2683
|
+
/* @__PURE__ */ jsx("rect", { x: "2", y: "3", width: "12", height: "10", rx: "1.5" }),
|
|
2684
|
+
/* @__PURE__ */ jsx("path", { d: "M2 9h12" }),
|
|
2685
|
+
/* @__PURE__ */ jsx("circle", { cx: "11.5", cy: "11", r: "0.6", fill: "currentColor", stroke: "none" })
|
|
2686
|
+
] });
|
|
2687
|
+
}
|
|
2688
|
+
function isWindowsDriveRoot(directory) {
|
|
2689
|
+
return /^[a-zA-Z]:[\\/]?$/.test(directory);
|
|
2690
|
+
}
|
|
2691
|
+
function DirectoryPicker$1(props) {
|
|
2692
|
+
const { host, onCancel, onSelect, initialPath, busy = false, error } = props;
|
|
2693
|
+
const t2 = host.t;
|
|
2694
|
+
const [portalTarget, setPortalTarget] = useState(null);
|
|
2695
|
+
const [currentPath, setCurrentPath] = useState("");
|
|
2696
|
+
const [parentDirectory, setParentDirectory] = useState(null);
|
|
2697
|
+
const [pathEditing, setPathEditing] = useState(false);
|
|
2698
|
+
const [directories, setDirectories] = useState([]);
|
|
2699
|
+
const [drives, setDrives] = useState(null);
|
|
2700
|
+
const [loadError, setLoadError] = useState(null);
|
|
2701
|
+
const [loading, setLoading] = useState(true);
|
|
2702
|
+
const [newFolderOpen, setNewFolderOpen] = useState(false);
|
|
2703
|
+
const [newFolderName, setNewFolderName] = useState("");
|
|
2704
|
+
const [newFolderBusy, setNewFolderBusy] = useState(false);
|
|
2705
|
+
const [newFolderError, setNewFolderError] = useState(null);
|
|
2706
|
+
const navigateTo = useCallback(async (directory) => {
|
|
2707
|
+
setLoading(true);
|
|
2708
|
+
setLoadError(null);
|
|
2709
|
+
setNewFolderOpen(false);
|
|
2710
|
+
setNewFolderError(null);
|
|
2711
|
+
try {
|
|
2712
|
+
const data = await loadDirectories(host, directory);
|
|
2713
|
+
const nextPath = data.path ?? directory ?? "/";
|
|
2714
|
+
setCurrentPath(nextPath);
|
|
2715
|
+
setParentDirectory(data.parentPath ?? null);
|
|
2716
|
+
setDirectories(data.directories ?? []);
|
|
2717
|
+
setDrives(data.drives ?? null);
|
|
2718
|
+
} catch (cause) {
|
|
2719
|
+
setLoadError(cause instanceof Error ? cause.message : String(cause));
|
|
2720
|
+
} finally {
|
|
2721
|
+
setLoading(false);
|
|
2722
|
+
}
|
|
2723
|
+
}, [host]);
|
|
2724
|
+
useEffect(() => {
|
|
2725
|
+
setPortalTarget(document.body);
|
|
2726
|
+
void navigateTo(initialPath || void 0);
|
|
2727
|
+
}, [initialPath, navigateTo]);
|
|
2728
|
+
const canSelect = Boolean(currentPath) && !busy && !loading && !pathEditing;
|
|
2729
|
+
const canNavigateUp = Boolean(parentDirectory) || isWindowsDriveRoot(currentPath);
|
|
2730
|
+
const canCreateFolder = Boolean(currentPath) && drives === null && !loading && !busy && !pathEditing;
|
|
2731
|
+
const canSubmitNewFolder = canCreateFolder && !newFolderBusy && Boolean(newFolderName.trim());
|
|
2732
|
+
const submitNewFolder = useCallback(async () => {
|
|
2733
|
+
const name = newFolderName.trim();
|
|
2734
|
+
if (!name || newFolderBusy || !canCreateFolder) return;
|
|
2735
|
+
setNewFolderBusy(true);
|
|
2736
|
+
setNewFolderError(null);
|
|
2737
|
+
try {
|
|
2738
|
+
const created = await createFolder(host, currentPath, name);
|
|
2739
|
+
setNewFolderName("");
|
|
2740
|
+
await navigateTo(created);
|
|
2741
|
+
} catch (cause) {
|
|
2742
|
+
setNewFolderError(cause instanceof Error ? cause.message : String(cause));
|
|
2743
|
+
} finally {
|
|
2744
|
+
setNewFolderBusy(false);
|
|
2745
|
+
}
|
|
2746
|
+
}, [canCreateFolder, currentPath, host, navigateTo, newFolderBusy, newFolderName]);
|
|
2747
|
+
const handleNewFolderSubmit = (event) => {
|
|
2748
|
+
event.preventDefault();
|
|
2749
|
+
void submitNewFolder();
|
|
2750
|
+
};
|
|
2751
|
+
const busyRef = useRef(busy);
|
|
2752
|
+
useEffect(() => {
|
|
2753
|
+
busyRef.current = busy;
|
|
2754
|
+
}, [busy]);
|
|
2755
|
+
const cancelRef = useRef(onCancel);
|
|
2756
|
+
useEffect(() => {
|
|
2757
|
+
cancelRef.current = onCancel;
|
|
2215
2758
|
}, [onCancel]);
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
/* @__PURE__ */
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2759
|
+
useEffect(() => dismissOnBack(
|
|
2760
|
+
() => host.getExtService?.("pi-web.overlayBack"),
|
|
2761
|
+
() => {
|
|
2762
|
+
if (!busyRef.current) cancelRef.current();
|
|
2763
|
+
}
|
|
2764
|
+
), [host]);
|
|
2765
|
+
if (!portalTarget) return null;
|
|
2766
|
+
const overlay2 = /* @__PURE__ */ jsx(
|
|
2767
|
+
"div",
|
|
2768
|
+
{
|
|
2769
|
+
className: "directory-picker-backdrop",
|
|
2770
|
+
...{ [DIRECTORY_PICKER_ATTR]: "1" },
|
|
2771
|
+
role: "dialog",
|
|
2772
|
+
"aria-modal": "true",
|
|
2773
|
+
"aria-label": t2("directoryPicker.selectDirectory"),
|
|
2774
|
+
onClick: (event) => {
|
|
2775
|
+
if (event.target === event.currentTarget && !busy) onCancel();
|
|
2776
|
+
},
|
|
2777
|
+
onKeyDown: (event) => {
|
|
2778
|
+
if (event.key === "Escape" && !busy) onCancel();
|
|
2779
|
+
},
|
|
2780
|
+
style: { position: "fixed", inset: 0, zIndex: 2147483e3, display: "flex", alignItems: "center", justifyContent: "center", background: "rgba(0,0,0,0.35)" },
|
|
2781
|
+
children: /* @__PURE__ */ jsxs("div", { className: "directory-picker-panel", style: { width: 520, maxWidth: "calc(100vw - 16px)", height: "min(620px, calc(100dvh - 16px))", maxHeight: "calc(100dvh - 16px)", display: "flex", flexDirection: "column", overflow: "hidden", background: "var(--bg)", border: "1px solid var(--border)", borderRadius: 10, boxShadow: "0 8px 32px rgba(0,0,0,0.18)" }, children: [
|
|
2782
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", flexShrink: 0, padding: "12px 18px", borderBottom: "1px solid var(--border)" }, children: [
|
|
2783
|
+
/* @__PURE__ */ jsx("div", { style: { minWidth: 0, flex: 1 }, children: /* @__PURE__ */ jsx("div", { style: { color: "var(--text)", fontWeight: 700, fontSize: 15 }, children: t2("directoryPicker.selectDirectory") }) }),
|
|
2784
|
+
/* @__PURE__ */ jsx(
|
|
2785
|
+
"button",
|
|
2786
|
+
{
|
|
2787
|
+
type: "button",
|
|
2788
|
+
onClick: onCancel,
|
|
2789
|
+
disabled: busy,
|
|
2790
|
+
title: t2("i18n.close"),
|
|
2791
|
+
"aria-label": t2("i18n.close"),
|
|
2792
|
+
style: { padding: "2px 6px", border: 0, background: "none", color: "var(--text-muted)", fontSize: 20, lineHeight: 1, cursor: busy ? "default" : "pointer", opacity: busy ? 0.5 : 1 },
|
|
2793
|
+
children: "×"
|
|
2794
|
+
}
|
|
2795
|
+
)
|
|
2796
|
+
] }),
|
|
2797
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8, flexShrink: 0, padding: "10px 14px", borderBottom: "1px solid var(--border)" }, children: [
|
|
2798
|
+
/* @__PURE__ */ jsx("button", { className: "directory-picker-back", type: "button", onClick: () => void navigateTo(parentDirectory ?? void 0), disabled: loading || !canNavigateUp, title: t2("directoryPicker.goToParent"), "aria-label": t2("directoryPicker.goToParent"), style: { width: 36, height: 36, padding: 0, display: "flex", alignItems: "center", justifyContent: "center", flexShrink: 0, border: "1px solid var(--border)", borderRadius: 6, background: "var(--bg-hover)", color: "var(--text-muted)", cursor: canNavigateUp ? "pointer" : "default", opacity: canNavigateUp ? 1 : 0.45 }, children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "m18 15-6-6-6 6" }) }) }),
|
|
2799
|
+
/* @__PURE__ */ jsx(
|
|
2800
|
+
PathBreadcrumb,
|
|
2801
|
+
{
|
|
2802
|
+
value: currentPath,
|
|
2803
|
+
label: t2("directoryPicker.directoryPath"),
|
|
2804
|
+
editLabel: t2("directoryPicker.editPath"),
|
|
2805
|
+
editHint: t2("directoryPicker.pathEditHint"),
|
|
2806
|
+
copyLabel: t2("directoryPicker.copyPath"),
|
|
2807
|
+
copiedLabel: t2("directoryPicker.copied"),
|
|
2808
|
+
placeholder: t2("directoryPicker.pathPlaceholder"),
|
|
2809
|
+
disabled: loading || busy,
|
|
2810
|
+
autoFocus: true,
|
|
2811
|
+
onNavigate: (path) => void navigateTo(path),
|
|
2812
|
+
onEditingChange: setPathEditing,
|
|
2813
|
+
style: { flex: 1 }
|
|
2814
|
+
}
|
|
2815
|
+
)
|
|
2816
|
+
] }),
|
|
2817
|
+
/* @__PURE__ */ jsxs("div", { className: "directory-picker-list", style: { flex: 1, minHeight: 0, overflow: "auto", padding: "8px 10px" }, children: [
|
|
2818
|
+
loading ? /* @__PURE__ */ jsx("div", { style: { padding: 8, color: "var(--text-dim)", fontSize: 11 }, children: t2("directoryPicker.loadingDirectories") }) : drives !== null ? /* @__PURE__ */ jsx(Fragment, { children: drives.length > 0 ? drives.map((drive) => /* @__PURE__ */ jsxs(
|
|
2819
|
+
"button",
|
|
2820
|
+
{
|
|
2821
|
+
className: "directory-picker-entry",
|
|
2822
|
+
type: "button",
|
|
2823
|
+
onClick: () => void navigateTo(drive.path),
|
|
2824
|
+
title: drive.path,
|
|
2825
|
+
style: { width: "100%", minHeight: 34, display: "flex", alignItems: "center", gap: 7, padding: "6px 8px", border: 0, borderRadius: 5, background: "none", color: "var(--text-muted)", cursor: "pointer", textAlign: "left", fontFamily: "var(--font-mono)", fontSize: 11 },
|
|
2826
|
+
children: [
|
|
2827
|
+
/* @__PURE__ */ jsx(DriveIcon, {}),
|
|
2828
|
+
/* @__PURE__ */ jsx("span", { children: drive.name })
|
|
2829
|
+
]
|
|
2830
|
+
},
|
|
2831
|
+
drive.path
|
|
2832
|
+
)) : /* @__PURE__ */ jsx("div", { style: { padding: 8, color: "var(--text-dim)", fontSize: 11 }, children: t2("directoryPicker.noDrives") }) }) : directories.length > 0 ? directories.map((entry) => /* @__PURE__ */ jsxs(
|
|
2833
|
+
"button",
|
|
2834
|
+
{
|
|
2835
|
+
className: "directory-picker-entry",
|
|
2836
|
+
type: "button",
|
|
2837
|
+
onClick: () => void navigateTo(entry.path),
|
|
2838
|
+
title: entry.path,
|
|
2839
|
+
style: { width: "100%", minHeight: 30, display: "flex", alignItems: "center", gap: 7, padding: "5px 8px", border: 0, borderRadius: 5, background: "none", color: "var(--text-muted)", cursor: "pointer", textAlign: "left", fontFamily: "var(--font-mono)", fontSize: 11 },
|
|
2840
|
+
children: [
|
|
2841
|
+
/* @__PURE__ */ jsx(FolderIcon, {}),
|
|
2842
|
+
/* @__PURE__ */ jsx("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: entry.name })
|
|
2843
|
+
]
|
|
2844
|
+
},
|
|
2845
|
+
entry.path
|
|
2846
|
+
)) : /* @__PURE__ */ jsx("div", { style: { padding: 8, color: "var(--text-dim)", fontSize: 11 }, children: t2("directoryPicker.noSubdirectories") }),
|
|
2847
|
+
(loadError || error) && /* @__PURE__ */ jsx("div", { style: { padding: "8px", color: "var(--danger, #dc2626)", fontSize: 11 }, children: loadError ?? error })
|
|
2848
|
+
] }),
|
|
2849
|
+
newFolderOpen && /* @__PURE__ */ jsxs("form", { onSubmit: handleNewFolderSubmit, style: { flexShrink: 0, padding: "10px 14px", borderTop: "1px solid var(--border)" }, children: [
|
|
2850
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
2851
|
+
/* @__PURE__ */ jsx("label", { htmlFor: "aiti-directory-new-folder", style: { position: "absolute", width: 1, height: 1, padding: 0, margin: -1, overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", border: 0 }, children: t2("directoryPicker.folderName") }),
|
|
2852
|
+
/* @__PURE__ */ jsx(
|
|
2853
|
+
"input",
|
|
2854
|
+
{
|
|
2855
|
+
className: "directory-picker-new-folder-name",
|
|
2856
|
+
id: "aiti-directory-new-folder",
|
|
2857
|
+
type: "text",
|
|
2858
|
+
value: newFolderName,
|
|
2859
|
+
placeholder: t2("directoryPicker.folderName"),
|
|
2860
|
+
autoFocus: true,
|
|
2861
|
+
autoComplete: "off",
|
|
2862
|
+
spellCheck: false,
|
|
2863
|
+
onChange: (event) => {
|
|
2864
|
+
setNewFolderName(event.target.value);
|
|
2865
|
+
setNewFolderError(null);
|
|
2866
|
+
},
|
|
2867
|
+
onKeyDown: (event) => {
|
|
2868
|
+
if (event.key === "Escape") {
|
|
2869
|
+
event.stopPropagation();
|
|
2870
|
+
setNewFolderOpen(false);
|
|
2871
|
+
setNewFolderError(null);
|
|
2872
|
+
}
|
|
2873
|
+
},
|
|
2874
|
+
style: { minWidth: 0, flex: 1, height: 32, padding: "0 10px", border: "1px solid var(--border)", borderRadius: 6, outline: "none", background: "var(--bg-panel)", color: "var(--text)", fontSize: 12 }
|
|
2875
|
+
}
|
|
2876
|
+
),
|
|
2877
|
+
/* @__PURE__ */ jsx(
|
|
2878
|
+
"button",
|
|
2879
|
+
{
|
|
2880
|
+
className: "directory-picker-action",
|
|
2881
|
+
type: "submit",
|
|
2882
|
+
disabled: !canSubmitNewFolder,
|
|
2883
|
+
style: { minWidth: 58, height: 32, padding: "0 12px", border: 0, borderRadius: 6, background: "var(--accent)", color: "#fff", fontSize: 13, fontWeight: 600, opacity: canSubmitNewFolder ? 1 : 0.6, cursor: canSubmitNewFolder ? "pointer" : "default" },
|
|
2884
|
+
children: newFolderBusy ? t2("directoryPicker.creating") : t2("directoryPicker.create")
|
|
2885
|
+
}
|
|
2886
|
+
)
|
|
2887
|
+
] }),
|
|
2888
|
+
newFolderError && /* @__PURE__ */ jsx("div", { style: { paddingTop: 6, color: "var(--danger, #dc2626)", fontSize: 11 }, children: newFolderError })
|
|
2889
|
+
] }),
|
|
2890
|
+
/* @__PURE__ */ jsxs("div", { className: "directory-picker-footer", style: { display: "flex", alignItems: "center", gap: 10, flexShrink: 0, padding: "10px 18px", borderTop: "1px solid var(--border)" }, children: [
|
|
2891
|
+
/* @__PURE__ */ jsxs(
|
|
2892
|
+
"button",
|
|
2893
|
+
{
|
|
2894
|
+
className: "directory-picker-new-folder",
|
|
2895
|
+
type: "button",
|
|
2896
|
+
onClick: () => {
|
|
2897
|
+
setNewFolderOpen(true);
|
|
2898
|
+
setNewFolderError(null);
|
|
2899
|
+
},
|
|
2900
|
+
disabled: !canCreateFolder,
|
|
2901
|
+
title: t2("directoryPicker.newFolderIn", { path: currentPath }),
|
|
2902
|
+
style: { display: "flex", alignItems: "center", gap: 6, padding: "6px 10px", border: "1px solid var(--border)", borderRadius: 6, background: "none", color: "var(--text-muted)", fontSize: 13, opacity: canCreateFolder ? 1 : 0.45, cursor: canCreateFolder ? "pointer" : "default" },
|
|
2903
|
+
children: [
|
|
2904
|
+
/* @__PURE__ */ jsx(FolderPlusIcon, {}),
|
|
2905
|
+
t2("directoryPicker.newFolder")
|
|
2906
|
+
]
|
|
2907
|
+
}
|
|
2908
|
+
),
|
|
2909
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 10, marginLeft: "auto" }, children: [
|
|
2910
|
+
/* @__PURE__ */ jsx("button", { className: "directory-picker-action", type: "button", onClick: onCancel, disabled: busy, style: { padding: "6px 14px", border: "1px solid var(--border)", borderRadius: 6, background: "none", color: "var(--text-muted)", cursor: busy ? "default" : "pointer", fontSize: 13 }, children: t2("i18n.cancel") }),
|
|
2911
|
+
/* @__PURE__ */ jsx(
|
|
2912
|
+
"button",
|
|
2913
|
+
{
|
|
2914
|
+
className: "directory-picker-action",
|
|
2915
|
+
type: "button",
|
|
2916
|
+
onClick: () => onSelect(currentPath),
|
|
2917
|
+
disabled: !canSelect,
|
|
2918
|
+
title: t2("directoryPicker.selectCurrentDirectory"),
|
|
2919
|
+
style: { padding: "6px 16px", border: 0, borderRadius: 6, background: "var(--accent)", color: "#fff", fontSize: 13, fontWeight: 600, opacity: canSelect ? 1 : 0.6, cursor: canSelect ? "pointer" : "default" },
|
|
2920
|
+
children: busy ? t2("i18n.checking") : t2("directoryPicker.selectThisFolder")
|
|
2921
|
+
}
|
|
2922
|
+
)
|
|
2923
|
+
] })
|
|
2924
|
+
] })
|
|
2925
|
+
] })
|
|
2926
|
+
}
|
|
2927
|
+
);
|
|
2928
|
+
const portaled = host.createPortal ? host.createPortal(overlay2, portalTarget) : null;
|
|
2929
|
+
return portaled ?? overlay2;
|
|
2930
|
+
}
|
|
2931
|
+
const HOST = { apiUrl, t: ct, getExtService: extSvc, createPortal };
|
|
2932
|
+
function DirectoryPicker(props) {
|
|
2933
|
+
return /* @__PURE__ */ jsx(DirectoryPicker$1, { ...props, host: HOST });
|
|
2248
2934
|
}
|
|
2249
2935
|
function WorkspaceDropdown({ selected, onSelect, onClose, align = "left", showUseDefault = true, allOption, width, extraTopItem }) {
|
|
2250
2936
|
const selectedStr = selected || "";
|
|
@@ -2286,14 +2972,16 @@ function WorkspaceDropdown({ selected, onSelect, onClose, align = "left", showUs
|
|
|
2286
2972
|
useEffect(() => {
|
|
2287
2973
|
const onScroll = (e) => {
|
|
2288
2974
|
if (ddRef.current && e.target instanceof Node && ddRef.current.contains(e.target)) return;
|
|
2975
|
+
if (pickerOpen || isDirectoryPickerTarget(e.target)) return;
|
|
2289
2976
|
onClose();
|
|
2290
2977
|
};
|
|
2291
2978
|
window.addEventListener("scroll", onScroll, true);
|
|
2292
2979
|
return () => window.removeEventListener("scroll", onScroll, true);
|
|
2293
|
-
}, [onClose]);
|
|
2980
|
+
}, [onClose, pickerOpen]);
|
|
2294
2981
|
useEffect(() => {
|
|
2295
2982
|
let alive = true;
|
|
2296
|
-
const
|
|
2983
|
+
const svc = extSvc("pi-web.home");
|
|
2984
|
+
const p = svc?.ensure ? svc.ensure() : dedupeFetch(apiUrl("/api/home")).then((r) => r.json()).then((d) => d?.home ?? null).catch(() => null);
|
|
2297
2985
|
void p.then((dir) => {
|
|
2298
2986
|
if (alive && dir) setHome(dir);
|
|
2299
2987
|
});
|
|
@@ -2381,8 +3069,8 @@ function WorkspaceDropdown({ selected, onSelect, onClose, align = "left", showUs
|
|
|
2381
3069
|
},
|
|
2382
3070
|
style: { display: "flex", alignItems: "center", gap: 7, width: "100%", padding: "8px 10px", background: "var(--bg)", borderLeft: "none", borderRight: "none", borderTop: "none", borderBottom: "1px solid var(--border)", color: !selectedStr ? "var(--text)" : "var(--text-muted)", cursor: "pointer", textAlign: "left", fontSize: 11 },
|
|
2383
3071
|
children: [
|
|
2384
|
-
!selectedStr ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx("span", { style: { width: 10, flexShrink: 0 } }),
|
|
2385
|
-
/* @__PURE__ */ jsx(FolderIcon, { open: false }),
|
|
3072
|
+
!selectedStr ? /* @__PURE__ */ jsx(CheckIcon$1, {}) : /* @__PURE__ */ jsx("span", { style: { width: 10, flexShrink: 0 } }),
|
|
3073
|
+
/* @__PURE__ */ jsx(FolderIcon$1, { open: false }),
|
|
2386
3074
|
/* @__PURE__ */ jsx(PathLabel, { text: allOption.label, style: { flex: 1 } })
|
|
2387
3075
|
]
|
|
2388
3076
|
},
|
|
@@ -2402,7 +3090,7 @@ function WorkspaceDropdown({ selected, onSelect, onClose, align = "left", showUs
|
|
|
2402
3090
|
title: p.root,
|
|
2403
3091
|
style: { display: "flex", alignItems: "center", gap: 7, width: "100%", padding: "8px 10px", background: "var(--bg)", borderLeft: "none", borderRight: "none", borderTop: "none", borderBottom: "1px solid var(--border)", color: cur ? "var(--text)" : "var(--text-muted)", cursor: "pointer", textAlign: "left", fontSize: 11, fontFamily: "var(--font-mono)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
|
|
2404
3092
|
children: [
|
|
2405
|
-
cur ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx("span", { style: { width: 10, flexShrink: 0 } }),
|
|
3093
|
+
cur ? /* @__PURE__ */ jsx(CheckIcon$1, {}) : /* @__PURE__ */ jsx("span", { style: { width: 10, flexShrink: 0 } }),
|
|
2406
3094
|
/* @__PURE__ */ jsx(PathLabel, { text: displayCwd(p.root, home), style: { flex: 1 } }),
|
|
2407
3095
|
/* @__PURE__ */ jsx(ActivityBadges, { act: activity.get(p.key), t: ct })
|
|
2408
3096
|
]
|
|
@@ -2446,7 +3134,7 @@ function WorkspaceDropdown({ selected, onSelect, onClose, align = "left", showUs
|
|
|
2446
3134
|
]
|
|
2447
3135
|
}
|
|
2448
3136
|
),
|
|
2449
|
-
pickerOpen ? /* @__PURE__ */ jsx(
|
|
3137
|
+
pickerOpen ? /* @__PURE__ */ jsx(DirectoryPicker, { initialPath: selectedStr, onSelect: (p) => {
|
|
2450
3138
|
setPickerOpen(false);
|
|
2451
3139
|
onClose();
|
|
2452
3140
|
onSelect(p);
|
|
@@ -2709,7 +3397,7 @@ function TaskPicker({ onClose, onOpenTask, presetRepo, fallbackRepo, onDock }) {
|
|
|
2709
3397
|
useEffect(() => {
|
|
2710
3398
|
if (!wsOpen) return;
|
|
2711
3399
|
const h = (e) => {
|
|
2712
|
-
if (wsBoxRef.current && !wsBoxRef.current.contains(e.target)) setWsOpen(false);
|
|
3400
|
+
if (wsBoxRef.current && !wsBoxRef.current.contains(e.target) && !isDirectoryPickerTarget(e.target)) setWsOpen(false);
|
|
2713
3401
|
};
|
|
2714
3402
|
document.addEventListener("mousedown", h);
|
|
2715
3403
|
return () => document.removeEventListener("mousedown", h);
|
|
@@ -3652,7 +4340,7 @@ function ReviewApp({ onClose, init, onExitToList }) {
|
|
|
3652
4340
|
});
|
|
3653
4341
|
};
|
|
3654
4342
|
void pull();
|
|
3655
|
-
const topicsSvc = extSvc("aiti-event-bus.subscribe-topics");
|
|
4343
|
+
const topicsSvc = extSvc$1("aiti-event-bus.subscribe-topics");
|
|
3656
4344
|
if (topicsSvc) {
|
|
3657
4345
|
const off = topicsSvc((f) => {
|
|
3658
4346
|
if (f && f.type === "gr:task" && f.taskId === task.id) void pull();
|
|
@@ -5099,6 +5787,7 @@ function DockReviewWork() {
|
|
|
5099
5787
|
}
|
|
5100
5788
|
function register(ctx) {
|
|
5101
5789
|
seedDockDefault("aiti-git-review:workspace", "right-panel");
|
|
5790
|
+
__setCtx$1(ctx);
|
|
5102
5791
|
__setCtx(ctx);
|
|
5103
5792
|
setGRCtx(ctx);
|
|
5104
5793
|
ctx.registerItems?.("toolbar", [{
|