agentgui 1.0.604 → 1.0.605
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/lib/ws-handlers-util.js
CHANGED
|
@@ -16,7 +16,8 @@ export function register(router, deps) {
|
|
|
16
16
|
router.handle('folders', (p) => {
|
|
17
17
|
const folderPath = p.path || STARTUP_CWD;
|
|
18
18
|
try {
|
|
19
|
-
const
|
|
19
|
+
const raw = folderPath.startsWith('~') ? folderPath.replace('~', os.homedir()) : folderPath;
|
|
20
|
+
const expanded = path.resolve(raw);
|
|
20
21
|
const entries = fs.readdirSync(expanded, { withFileTypes: true });
|
|
21
22
|
const folders = entries
|
|
22
23
|
.filter(e => e.isDirectory() && !e.name.startsWith('.'))
|
package/package.json
CHANGED
|
@@ -191,7 +191,8 @@ class ConversationManager {
|
|
|
191
191
|
|
|
192
192
|
this.folderBrowser.listEl.innerHTML = '';
|
|
193
193
|
|
|
194
|
-
|
|
194
|
+
const isAtRoot = dirPath === '~' || dirPath === '/' || dirPath === this.folderBrowser.homePath || /^[A-Za-z]:[\\\/]?$/.test(dirPath);
|
|
195
|
+
if (!isAtRoot) {
|
|
195
196
|
const parentPath = this.getParentPath(dirPath);
|
|
196
197
|
const upItem = document.createElement('li');
|
|
197
198
|
upItem.className = 'folder-list-item';
|
|
@@ -212,7 +213,8 @@ class ConversationManager {
|
|
|
212
213
|
li.addEventListener('click', () => {
|
|
213
214
|
const expandedBase = dirPath === '~' ? this.folderBrowser.homePath : dirPath;
|
|
214
215
|
const separator = expandedBase.includes('\\') ? '\\' : '/';
|
|
215
|
-
const
|
|
216
|
+
const base = expandedBase.replace(/[\/\\]+$/, '');
|
|
217
|
+
const newPath = base + separator + folder.name;
|
|
216
218
|
this.loadFolders(newPath);
|
|
217
219
|
});
|
|
218
220
|
this.folderBrowser.listEl.appendChild(li);
|
|
@@ -244,17 +246,25 @@ class ConversationManager {
|
|
|
244
246
|
|
|
245
247
|
const expanded = dirPath === '~' ? this.folderBrowser.homePath : dirPath;
|
|
246
248
|
const parts = pathSplit(expanded);
|
|
247
|
-
const
|
|
249
|
+
const isWin = expanded.includes('\\') || /^[A-Za-z]:/.test(expanded);
|
|
250
|
+
const separator = isWin ? '\\' : '/';
|
|
251
|
+
const rootPath = isWin && parts[0] && /^[A-Za-z]:$/.test(parts[0]) ? parts[0] + separator : separator;
|
|
248
252
|
|
|
249
253
|
let html = '';
|
|
250
|
-
html += `<span class="folder-breadcrumb-segment" data-path="${
|
|
254
|
+
html += `<span class="folder-breadcrumb-segment" data-path="${this.escapeHtml(rootPath)}">${this.escapeHtml(rootPath)} </span>`;
|
|
251
255
|
|
|
252
256
|
let accumulated = '';
|
|
257
|
+
const isDriveLetter = isWin && parts[0] && /^[A-Za-z]:$/.test(parts[0]);
|
|
253
258
|
for (let i = 0; i < parts.length; i++) {
|
|
254
|
-
|
|
259
|
+
if (i === 0 && isDriveLetter) {
|
|
260
|
+
accumulated = parts[0];
|
|
261
|
+
} else {
|
|
262
|
+
accumulated += separator + parts[i];
|
|
263
|
+
}
|
|
264
|
+
const segPath = (i === 0 && isDriveLetter) ? rootPath : accumulated;
|
|
255
265
|
const isLast = i === parts.length - 1;
|
|
256
266
|
html += `<span class="folder-breadcrumb-separator">${separator}</span>`;
|
|
257
|
-
html += `<span class="folder-breadcrumb-segment${isLast ? '' : ''}" data-path="${this.escapeHtml(
|
|
267
|
+
html += `<span class="folder-breadcrumb-segment${isLast ? '' : ''}" data-path="${this.escapeHtml(segPath)}">${this.escapeHtml(parts[i])}</span>`;
|
|
258
268
|
}
|
|
259
269
|
|
|
260
270
|
this.folderBrowser.breadcrumbEl.innerHTML = html;
|