@commonlyai/cli 0.1.359 → 0.1.360

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commonlyai/cli",
3
- "version": "0.1.359",
3
+ "version": "0.1.360",
4
4
  "license": "Apache-2.0",
5
5
  "description": "The Commonly CLI — connect agents, manage pods, iterate fast",
6
6
  "type": "module",
@@ -73,7 +73,13 @@ export const publicCodexVersionError = ({ found, required, seat = 'public seat'
73
73
  // `args` come before `--version`, for a launch that is an interpreter and a
74
74
  // script (a Windows npm shim). The interpreter's path says nothing about which
75
75
  // script it would run, so that probe is never cached.
76
+ //
77
+ // An entry also ages out after VERSION_CACHE_MAX_AGE_MS. A shim on PATH (asdf,
78
+ // mise, a wrapper script) keeps its mtime while the harness behind it changes,
79
+ // so an upgrade, or a downgrade under a version floor, would otherwise go
80
+ // unseen until the daemon restarted (F262).
76
81
  const versionCache = new Map();
82
+ export const VERSION_CACHE_MAX_AGE_MS = 5 * 60 * 1000;
77
83
 
78
84
  const resolveBinary = (binary, env) => {
79
85
  const name = String(binary || '');
@@ -90,17 +96,18 @@ const resolveBinary = (binary, env) => {
90
96
 
91
97
  export const probeVersion = async (binary, {
92
98
  args = [], env, timeoutMs = 30000, parse, execFileImpl = childProcess.execFile, cache = versionCache,
99
+ now = Date.now,
93
100
  } = {}) => {
94
101
  const resolved = args.length ? null : resolveBinary(binary, env);
95
102
  const key = resolved?.key || null;
96
103
  const hit = key ? cache.get(key) : null;
97
- if (hit && hit.mtimeMs === resolved.mtimeMs) return hit.version;
104
+ if (hit && hit.mtimeMs === resolved.mtimeMs && now() - hit.at < VERSION_CACHE_MAX_AGE_MS) return hit.version;
98
105
  const stdout = await new Promise((resolve) => {
99
106
  execFileImpl(key || binary, [...args, '--version'], { encoding: 'utf8', env, timeout: timeoutMs }, (error, out) => {
100
107
  resolve(error ? null : out);
101
108
  });
102
109
  });
103
110
  const version = stdout === null ? null : parse(stdout);
104
- if (version && key) cache.set(key, { mtimeMs: resolved.mtimeMs, version });
111
+ if (version && key) cache.set(key, { mtimeMs: resolved.mtimeMs, version, at: now() });
105
112
  return version;
106
113
  };