agentgui 1.0.506 → 1.0.507

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server.js +52 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.506",
3
+ "version": "1.0.507",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",
package/server.js CHANGED
@@ -1844,11 +1844,27 @@ const server = http.createServer(async (req, res) => {
1844
1844
  }
1845
1845
  queries.updateToolStatus(toolId, { status: 'installing' });
1846
1846
  sendJSON(req, res, 200, { success: true, installing: true, estimatedTime: 60000 });
1847
+
1848
+ let installCompleted = false;
1849
+ const installTimeout = setTimeout(() => {
1850
+ if (!installCompleted) {
1851
+ installCompleted = true;
1852
+ queries.updateToolStatus(toolId, { status: 'failed', error_message: 'Install timeout after 6 minutes' });
1853
+ if (wsOptimizer && wsOptimizer.broadcast) {
1854
+ wsOptimizer.broadcast({ type: 'tool_install_failed', toolId, data: { success: false, error: 'Install timeout after 6 minutes' } });
1855
+ }
1856
+ queries.addToolInstallHistory(toolId, 'install', 'failed', 'Install timeout after 6 minutes');
1857
+ }
1858
+ }, 360000);
1859
+
1847
1860
  toolManager.install(toolId, (msg) => {
1848
1861
  if (wsOptimizer && wsOptimizer.broadcast) {
1849
1862
  wsOptimizer.broadcast({ type: 'tool_install_progress', toolId, data: msg });
1850
1863
  }
1851
1864
  }).then((result) => {
1865
+ clearTimeout(installTimeout);
1866
+ if (installCompleted) return;
1867
+ installCompleted = true;
1852
1868
  if (result.success) {
1853
1869
  queries.updateToolStatus(toolId, { status: 'installed', version: result.version, installed_at: Date.now() });
1854
1870
  if (wsOptimizer && wsOptimizer.broadcast) {
@@ -1862,6 +1878,16 @@ const server = http.createServer(async (req, res) => {
1862
1878
  }
1863
1879
  queries.addToolInstallHistory(toolId, 'install', 'failed', result.error);
1864
1880
  }
1881
+ }).catch((err) => {
1882
+ clearTimeout(installTimeout);
1883
+ if (installCompleted) return;
1884
+ installCompleted = true;
1885
+ const error = err?.message || 'Unknown error';
1886
+ queries.updateToolStatus(toolId, { status: 'failed', error_message: error });
1887
+ if (wsOptimizer && wsOptimizer.broadcast) {
1888
+ wsOptimizer.broadcast({ type: 'tool_install_failed', toolId, data: { success: false, error } });
1889
+ }
1890
+ queries.addToolInstallHistory(toolId, 'install', 'failed', error);
1865
1891
  });
1866
1892
  return;
1867
1893
  }
@@ -1881,11 +1907,27 @@ const server = http.createServer(async (req, res) => {
1881
1907
  }
1882
1908
  queries.updateToolStatus(toolId, { status: 'updating' });
1883
1909
  sendJSON(req, res, 200, { success: true, updating: true });
1910
+
1911
+ let updateCompleted = false;
1912
+ const updateTimeout = setTimeout(() => {
1913
+ if (!updateCompleted) {
1914
+ updateCompleted = true;
1915
+ queries.updateToolStatus(toolId, { status: 'failed', error_message: 'Update timeout after 6 minutes' });
1916
+ if (wsOptimizer && wsOptimizer.broadcast) {
1917
+ wsOptimizer.broadcast({ type: 'tool_update_failed', toolId, data: { success: false, error: 'Update timeout after 6 minutes' } });
1918
+ }
1919
+ queries.addToolInstallHistory(toolId, 'update', 'failed', 'Update timeout after 6 minutes');
1920
+ }
1921
+ }, 360000);
1922
+
1884
1923
  toolManager.update(toolId, body.targetVersion, (msg) => {
1885
1924
  if (wsOptimizer && wsOptimizer.broadcast) {
1886
1925
  wsOptimizer.broadcast({ type: 'tool_update_progress', toolId, data: msg });
1887
1926
  }
1888
1927
  }).then((result) => {
1928
+ clearTimeout(updateTimeout);
1929
+ if (updateCompleted) return;
1930
+ updateCompleted = true;
1889
1931
  if (result.success) {
1890
1932
  queries.updateToolStatus(toolId, { status: 'installed', version: result.version, installed_at: Date.now() });
1891
1933
  if (wsOptimizer && wsOptimizer.broadcast) {
@@ -1899,6 +1941,16 @@ const server = http.createServer(async (req, res) => {
1899
1941
  }
1900
1942
  queries.addToolInstallHistory(toolId, 'update', 'failed', result.error);
1901
1943
  }
1944
+ }).catch((err) => {
1945
+ clearTimeout(updateTimeout);
1946
+ if (updateCompleted) return;
1947
+ updateCompleted = true;
1948
+ const error = err?.message || 'Unknown error';
1949
+ queries.updateToolStatus(toolId, { status: 'failed', error_message: error });
1950
+ if (wsOptimizer && wsOptimizer.broadcast) {
1951
+ wsOptimizer.broadcast({ type: 'tool_update_failed', toolId, data: { success: false, error } });
1952
+ }
1953
+ queries.addToolInstallHistory(toolId, 'update', 'failed', error);
1902
1954
  });
1903
1955
  return;
1904
1956
  }