@gricha/perry 0.1.7 → 0.2.0
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/README.md +2 -2
- package/dist/agent/router.js +59 -0
- package/dist/agent/run.js +4 -0
- package/dist/agent/static.js +17 -8
- package/dist/agent/web/assets/index-CaFOQOgc.css +1 -0
- package/dist/agent/web/assets/index-DQmM39Em.js +104 -0
- package/dist/agent/web/index.html +2 -2
- package/dist/chat/base-chat-websocket.js +5 -2
- package/dist/chat/handler.js +16 -0
- package/dist/chat/host-opencode-handler.js +22 -0
- package/dist/chat/opencode-handler.js +22 -0
- package/dist/chat/opencode-server.js +98 -65
- package/dist/chat/opencode-websocket.js +11 -3
- package/dist/chat/websocket.js +4 -4
- package/dist/models/cache.js +70 -0
- package/dist/models/discovery.js +108 -0
- package/dist/update-checker.js +12 -7
- package/package.json +1 -1
- package/dist/agent/web/assets/index-BTiTEcB0.js +0 -104
- package/dist/agent/web/assets/index-D2_-UqVf.css +0 -1
package/dist/update-checker.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { homedir } from 'os';
|
|
2
2
|
import { join } from 'path';
|
|
3
3
|
import { mkdir, readFile, writeFile } from 'fs/promises';
|
|
4
|
-
const
|
|
4
|
+
const GITHUB_REPO = 'gricha/perry';
|
|
5
5
|
const CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000; // 24 hours
|
|
6
6
|
async function getCacheDir() {
|
|
7
7
|
const dir = join(homedir(), '.config', 'perry');
|
|
@@ -29,13 +29,18 @@ async function writeCache(cache) {
|
|
|
29
29
|
}
|
|
30
30
|
async function fetchLatestVersion() {
|
|
31
31
|
try {
|
|
32
|
-
const response = await fetch(`https://
|
|
32
|
+
const response = await fetch(`https://api.github.com/repos/${GITHUB_REPO}/releases/latest`, {
|
|
33
33
|
signal: AbortSignal.timeout(3000),
|
|
34
|
+
headers: {
|
|
35
|
+
Accept: 'application/vnd.github.v3+json',
|
|
36
|
+
'User-Agent': 'perry-update-checker',
|
|
37
|
+
},
|
|
34
38
|
});
|
|
35
39
|
if (!response.ok)
|
|
36
40
|
return null;
|
|
37
41
|
const data = (await response.json());
|
|
38
|
-
|
|
42
|
+
const tag = data.tag_name || null;
|
|
43
|
+
return tag ? tag.replace(/^v/, '') : null;
|
|
39
44
|
}
|
|
40
45
|
catch {
|
|
41
46
|
return null;
|
|
@@ -68,10 +73,10 @@ export async function checkForUpdates(currentVersion) {
|
|
|
68
73
|
}
|
|
69
74
|
if (latestVersion && compareVersions(currentVersion, latestVersion) > 0) {
|
|
70
75
|
console.log('');
|
|
71
|
-
console.log(`\x1b[33m
|
|
72
|
-
console.log(`\x1b[33m│\x1b[0m Update available: \x1b[90m${currentVersion}\x1b[0m → \x1b[32m${latestVersion}\x1b[0m
|
|
73
|
-
console.log(`\x1b[33m│\x1b[0m Run \x1b[
|
|
74
|
-
console.log(`\x1b[33m
|
|
76
|
+
console.log(`\x1b[33m╭──────────────────────────────────────────────────────────────────────────────────╮\x1b[0m`);
|
|
77
|
+
console.log(`\x1b[33m│\x1b[0m Update available: \x1b[90m${currentVersion}\x1b[0m → \x1b[32m${latestVersion}\x1b[0m \x1b[33m│\x1b[0m`);
|
|
78
|
+
console.log(`\x1b[33m│\x1b[0m Run: \x1b[36mcurl -fsSL https://raw.githubusercontent.com/${GITHUB_REPO}/main/install.sh | bash\x1b[0m \x1b[33m│\x1b[0m`);
|
|
79
|
+
console.log(`\x1b[33m╰──────────────────────────────────────────────────────────────────────────────────╯\x1b[0m`);
|
|
75
80
|
console.log('');
|
|
76
81
|
}
|
|
77
82
|
}
|