@openagents-org/agent-launcher 0.2.4 → 0.2.6

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 +3 -2
  2. package/src/registry.js +28 -18
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openagents-org/agent-launcher",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "OpenAgents Launcher — install, configure, and run AI coding agents from your terminal",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -37,6 +37,7 @@
37
37
  "README.md"
38
38
  ],
39
39
  "dependencies": {
40
- "blessed": "^0.1.81"
40
+ "blessed": "^0.1.81",
41
+ "ws": "^8.18.0"
41
42
  }
42
43
  }
package/src/registry.js CHANGED
@@ -30,17 +30,16 @@ class Registry {
30
30
  // Try cache first (avoids network on every call)
31
31
  const cached = this._loadCache();
32
32
  if (cached) {
33
- this._catalog = cached;
34
- // Refresh in background if stale (but still return cached)
33
+ this._catalog = this._mergeBundled(cached);
35
34
  this._refreshInBackground();
36
- return cached;
35
+ return this._catalog;
37
36
  }
38
37
 
39
38
  // No cache — try remote
40
39
  const remote = await this._fetchRemote();
41
40
  if (remote) {
42
- this._catalog = remote;
43
- return remote;
41
+ this._catalog = this._mergeBundled(remote);
42
+ return this._catalog;
44
43
  }
45
44
 
46
45
  // Fallback to bundled
@@ -54,22 +53,33 @@ class Registry {
54
53
  getCatalogSync() {
55
54
  if (this._catalog) return this._catalog;
56
55
  const cached = this._loadCache();
57
- const bundled = this._loadBundled();
58
56
  if (cached) {
59
- // Merge bundled env_config/resolve_env into cached entries (cache may be stale)
60
- for (const entry of cached) {
61
- const b = bundled.find(x => x.name === entry.name);
62
- if (b) {
63
- if (!entry.env_config && b.env_config) entry.env_config = b.env_config;
64
- if (!entry.resolve_env && b.resolve_env) entry.resolve_env = b.resolve_env;
65
- if (!entry.install && b.install) entry.install = b.install;
66
- }
57
+ this._catalog = this._mergeBundled(cached);
58
+ return this._catalog;
59
+ }
60
+ this._catalog = this._loadBundled();
61
+ return this._catalog;
62
+ }
63
+
64
+ /**
65
+ * Merge bundled env_config/resolve_env/install into catalog entries.
66
+ * Remote/cached entries may lack these fields.
67
+ */
68
+ _mergeBundled(catalog) {
69
+ const bundled = this._loadBundled();
70
+ for (const entry of catalog) {
71
+ const b = bundled.find(x => x.name === entry.name);
72
+ if (b) {
73
+ if ((!entry.env_config || entry.env_config.length === 0) && b.env_config && b.env_config.length > 0) entry.env_config = b.env_config;
74
+ if (!entry.resolve_env && b.resolve_env) entry.resolve_env = b.resolve_env;
75
+ if (!entry.install && b.install) entry.install = b.install;
67
76
  }
68
- this._catalog = cached;
69
- return cached;
70
77
  }
71
- this._catalog = bundled;
72
- return bundled;
78
+ // Add bundled entries not in catalog
79
+ for (const b of bundled) {
80
+ if (!catalog.find(e => e.name === b.name)) catalog.push(b);
81
+ }
82
+ return catalog;
73
83
  }
74
84
 
75
85
  /**