agentgui 1.0.604 → 1.0.606

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.
@@ -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 expanded = folderPath.startsWith('~') ? folderPath.replace('~', os.homedir()) : folderPath;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.604",
3
+ "version": "1.0.606",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",
package/server.js CHANGED
@@ -4340,7 +4340,7 @@ wsRouter.onLegacy((data, ws) => {
4340
4340
  ws.terminalProc = proc;
4341
4341
  ws.terminalPty = true;
4342
4342
  proc.on('data', (chunk) => {
4343
- if (ws.readyState === 1) ws.send(JSON.stringify({ type: 'terminal_output', data: chunk.toString('base64'), encoding: 'base64' }));
4343
+ if (ws.readyState === 1) ws.send(JSON.stringify({ type: 'terminal_output', data: Buffer.from(chunk).toString('base64'), encoding: 'base64' }));
4344
4344
  });
4345
4345
  proc.on('exit', (code) => {
4346
4346
  if (ws.readyState === 1) ws.send(JSON.stringify({ type: 'terminal_exit', code }));
@@ -191,7 +191,8 @@ class ConversationManager {
191
191
 
192
192
  this.folderBrowser.listEl.innerHTML = '';
193
193
 
194
- if (dirPath !== '~' && dirPath !== '/' && dirPath !== this.folderBrowser.homePath) {
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 newPath = expandedBase + separator + folder.name;
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 separator = expanded.includes('\\') ? '\\' : '/';
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="${separator}">${separator} </span>`;
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
- accumulated += separator + parts[i];
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(accumulated)}">${this.escapeHtml(parts[i])}</span>`;
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;
@@ -10,6 +10,20 @@
10
10
  return proto + '//' + location.host + BASE + '/sync';
11
11
  }
12
12
 
13
+ function getCwd() {
14
+ try {
15
+ if (window.conversationManager) {
16
+ var mgr = window.conversationManager;
17
+ var id = mgr.activeId;
18
+ if (id && mgr.conversations) {
19
+ var conv = mgr.conversations.find(function(c) { return c.id === id; });
20
+ if (conv && conv.workingDirectory) return conv.workingDirectory;
21
+ }
22
+ }
23
+ } catch (_) {}
24
+ return undefined;
25
+ }
26
+
13
27
  function ensureTerm() {
14
28
  var output = document.getElementById('terminalOutput');
15
29
  if (!output) return false;
@@ -69,24 +83,21 @@
69
83
  }
70
84
 
71
85
  function connectAndStart() {
72
- console.log('Terminal: Connecting to WebSocket');
86
+ var cwd = getCwd();
73
87
  if (ws && ws.readyState === WebSocket.OPEN) {
74
- console.log('Terminal: Sending terminal_start command');
75
88
  var dims = term ? { cols: term.cols, rows: term.rows } : { cols: 80, rows: 24 };
76
- ws.send(JSON.stringify({ type: 'terminal_start', cwd: window.__STARTUP_CWD || undefined, cols: dims.cols, rows: dims.rows }));
89
+ ws.send(JSON.stringify({ type: 'terminal_start', cwd: cwd, cols: dims.cols, rows: dims.rows }));
77
90
  setTimeout(function() { if (term && term.focus) term.focus(); }, 100);
78
91
  return;
79
92
  }
80
93
  if (ws && ws.readyState === WebSocket.CONNECTING) {
81
- console.log('Terminal: WebSocket already connecting');
82
94
  return;
83
95
  }
84
96
 
85
97
  ws = new WebSocket(getWsUrl());
86
98
  ws.onopen = function() {
87
- console.log('Terminal: WebSocket connected, starting terminal');
88
99
  var dims = term ? { cols: term.cols, rows: term.rows } : { cols: 80, rows: 24 };
89
- ws.send(JSON.stringify({ type: 'terminal_start', cwd: window.__STARTUP_CWD || undefined, cols: dims.cols, rows: dims.rows }));
100
+ ws.send(JSON.stringify({ type: 'terminal_start', cwd: cwd, cols: dims.cols, rows: dims.rows }));
90
101
  setTimeout(function() { if (term && term.focus) term.focus(); }, 100);
91
102
  };
92
103
  ws.onmessage = function(e) {
@@ -100,25 +111,18 @@
100
111
  } else if (msg.type === 'terminal_exit' && term) {
101
112
  term.write('\r\n[Process exited with code ' + msg.code + ']\r\n');
102
113
  if (termActive) setTimeout(connectAndStart, 2000);
103
- } else if (msg.type === 'terminal_started') {
104
- console.log('Terminal: Started successfully');
105
114
  }
106
115
  } catch(_) {}
107
116
  };
108
117
  ws.onclose = function() {
109
- console.log('Terminal: WebSocket closed');
110
118
  ws = null;
111
119
  if (termActive) setTimeout(connectAndStart, 2000);
112
120
  };
113
- ws.onerror = function(error) {
114
- console.error('Terminal: WebSocket error:', error);
115
- };
121
+ ws.onerror = function() {};
116
122
  }
117
123
 
118
124
  function startTerminal() {
119
- console.log('Terminal: Starting terminal module');
120
125
  if (!ensureTerm()) {
121
- console.log('Terminal: Terminal not ready, retrying');
122
126
  setTimeout(startTerminal, 200);
123
127
  return;
124
128
  }
@@ -128,7 +132,6 @@
128
132
  }
129
133
 
130
134
  function stopTerminal() {
131
- console.log('Terminal: Stopping terminal module');
132
135
  termActive = false;
133
136
  if (ws && ws.readyState === WebSocket.OPEN) {
134
137
  ws.send(JSON.stringify({ type: 'terminal_stop' }));
@@ -140,13 +143,10 @@
140
143
  }
141
144
 
142
145
  function initTerminalEarly() {
143
- console.log('Terminal: Initializing terminal early (not yet active)');
144
146
  if (!ensureTerm()) {
145
- console.log('Terminal: Waiting for xterm.js to load');
146
147
  setTimeout(initTerminalEarly, 200);
147
148
  return;
148
149
  }
149
- console.log('Terminal: Terminal UI initialized and ready for interaction');
150
150
  }
151
151
 
152
152
  if (document.readyState === 'loading') {
@@ -167,8 +167,8 @@
167
167
  }
168
168
  });
169
169
 
170
- window.terminalModule = {
171
- start: startTerminal,
170
+ window.terminalModule = {
171
+ start: startTerminal,
172
172
  stop: stopTerminal,
173
173
  getTerminal: function() { return term; },
174
174
  isActive: function() { return termActive; }