@the-17/agentsecrets 1.1.3 → 1.1.4

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.
@@ -39,11 +39,27 @@ function httpsGet(url) {
39
39
  });
40
40
  }
41
41
 
42
- async function getLatestVersion() {
42
+ const CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000; // 7 days
43
+
44
+ async function getLatestVersion(baseDir) {
45
+ const cacheFile = path.join(baseDir, 'version.cache');
46
+
47
+ // Check cache first
48
+ if (fs.existsSync(cacheFile)) {
49
+ const cache = JSON.parse(fs.readFileSync(cacheFile, 'utf8'));
50
+ if (Date.now() - cache.timestamp < CACHE_TTL_MS) {
51
+ return cache.version;
52
+ }
53
+ }
54
+
43
55
  try {
44
56
  const { body } = await httpsGet(`https://api.github.com/repos/${GITHUB_REPO}/releases/latest`);
45
57
  const release = JSON.parse(body);
46
- return release.tag_name.replace(/^v/, '');
58
+ const version = release.tag_name.replace(/^v/, '');
59
+
60
+ // Save to cache
61
+ fs.writeFileSync(cacheFile, JSON.stringify({ version, timestamp: Date.now() }));
62
+ return version;
47
63
  } catch {
48
64
  return null;
49
65
  }
@@ -80,8 +96,7 @@ async function ensureBinary() {
80
96
  if (osName === 'windows') binaryName += '.exe';
81
97
 
82
98
  // Check GitHub for the latest version
83
- process.stderr.write('Checking for latest AgentSecrets version...\n');
84
- const latestVersion = await getLatestVersion();
99
+ const latestVersion = await getLatestVersion(baseDir);
85
100
 
86
101
  if (!latestVersion) {
87
102
  // Offline or GitHub unreachable — fall back to any existing binary
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-17/agentsecrets",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "AI-native zero-knowledge secrets manager (CLI wrapper)",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -34,4 +34,4 @@
34
34
  "dependencies": {
35
35
  "tar": "^6.2.1"
36
36
  }
37
- }
37
+ }