agentgui 1.0.861 → 1.0.863

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.
@@ -1,6 +1,6 @@
1
1
  import { spawn } from 'child_process';
2
2
  import os from 'os';
3
- import { getCliVersion, getInstalledVersion } from './tool-version-check.js';
3
+ import { getCliVersion, getInstalledVersion, saveLastInstalledNpmVersion } from './tool-version-check.js';
4
4
  import { clearVersionCache, checkToolViaBunx } from './tool-version-fetch.js';
5
5
  import * as toolInstallMachine from './tool-install-machine.js';
6
6
 
@@ -84,7 +84,13 @@ async function postInstallRefresh(tool, statusCache, checkToolStatusAsync) {
84
84
  statusCache.delete(tool.id);
85
85
  clearVersionCache();
86
86
  const version = tool.category === 'cli' ? getCliVersion(tool.pkg) : getInstalledVersion(tool.pkg, tool.pluginId, tool.frameWork);
87
- const freshStatus = await checkToolStatusAsync(tool.id);
87
+ // Fetch with skipPublishedVersion=false so we have the npm version to persist
88
+ const freshStatus = await checkToolStatusAsync(tool.id, false);
89
+ // For plugin tools, save the npm published version as the "installed" version so future
90
+ // checks don't false-positive when plugin.json versioning differs from the npm wrapper version.
91
+ if (tool.category === 'plugin' && freshStatus.publishedVersion) {
92
+ saveLastInstalledNpmVersion(tool.pkg, freshStatus.publishedVersion);
93
+ }
88
94
  return { success: true, error: null, version: version || freshStatus.publishedVersion || 'unknown', ...freshStatus };
89
95
  }
90
96
 
@@ -5,6 +5,27 @@ import { execSync } from 'child_process';
5
5
 
6
6
  const isWindows = os.platform() === 'win32';
7
7
  const homeDir = os.homedir();
8
+ const gmguiDir = path.join(homeDir, '.gmgui');
9
+ const npmVersionsFile = path.join(gmguiDir, 'tool-npm-versions.json');
10
+
11
+ /** Return the last npm-published version we successfully installed for a plugin tool pkg. */
12
+ export function getLastInstalledNpmVersion(pkg) {
13
+ try {
14
+ if (!fs.existsSync(npmVersionsFile)) return null;
15
+ return JSON.parse(fs.readFileSync(npmVersionsFile, 'utf-8'))[pkg] || null;
16
+ } catch (_) {}
17
+ return null;
18
+ }
19
+
20
+ /** Persist the npm-published version we just installed for a plugin tool pkg. */
21
+ export function saveLastInstalledNpmVersion(pkg, version) {
22
+ try {
23
+ const data = fs.existsSync(npmVersionsFile) ? JSON.parse(fs.readFileSync(npmVersionsFile, 'utf-8')) : {};
24
+ data[pkg] = version;
25
+ fs.mkdirSync(gmguiDir, { recursive: true });
26
+ fs.writeFileSync(npmVersionsFile, JSON.stringify(data, null, 2));
27
+ } catch (_) {}
28
+ }
8
29
 
9
30
  export const BIN_MAP = {
10
31
  '@anthropic-ai/claude-code': 'claude',
@@ -1,5 +1,5 @@
1
1
  import https from 'https';
2
- import { checkCliInstalled, getCliVersion, checkToolInstalled, compareVersions, getInstalledVersion } from './tool-version-check.js';
2
+ import { checkCliInstalled, getCliVersion, checkToolInstalled, compareVersions, getInstalledVersion, getLastInstalledNpmVersion } from './tool-version-check.js';
3
3
 
4
4
  const versionCache = new Map();
5
5
 
@@ -43,7 +43,14 @@ export async function checkToolViaBunx(pkg, pluginId = null, category = 'plugin'
43
43
  try {
44
44
  const isCli = category === 'cli';
45
45
  const installed = isCli ? checkCliInstalled(pkg) : checkToolInstalled(pluginId || pkg, frameWork);
46
- const installedVersion = isCli ? getCliVersion(pkg) : getInstalledVersion(pkg, pluginId, frameWork, tools);
46
+ let installedVersion = isCli ? getCliVersion(pkg) : getInstalledVersion(pkg, pluginId, frameWork, tools);
47
+ // For plugin tools, prefer the last npm version we successfully installed over the plugin.json
48
+ // version. This prevents infinite re-update loops when plugin.json versioning differs from
49
+ // the npm wrapper package version (e.g. gm-codex@2.0.506 installs gm plugin.json@2.0.241).
50
+ if (!isCli) {
51
+ const lastNpm = getLastInstalledNpmVersion(pkg);
52
+ if (lastNpm) installedVersion = lastNpm;
53
+ }
47
54
  let publishedVersion = null;
48
55
  if (!skipPublishedVersion) {
49
56
  publishedVersion = await fetchPublishedVersion(pkg);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.861",
3
+ "version": "1.0.863",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "electron/main.js",