accelr8 2.0.0 → 3.0.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/dist/chunks/agentcli-ZI2O7ID7.js +176 -0
- package/dist/chunks/chunk-3JNUWI22.js +563 -0
- package/dist/chunks/chunk-SF6NNSYZ.js +60 -0
- package/dist/chunks/client-7BVK2DEW.js +3454 -0
- package/dist/chunks/server-ZP2DV4IO.js +930 -0
- package/dist/chunks/update-UEPNGB6Y.js +106 -0
- package/dist/cli.js +15 -4
- package/package.json +19 -3
- package/dist/chunks/chunk-BVRGM7YI.js +0 -24
- package/dist/chunks/client-FMFGODEU.js +0 -593
- package/dist/chunks/server-CG3UEKLP.js +0 -270
- package/worker/src/worker.ts +0 -293
- package/worker/wrangler.jsonc +0 -10
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/update.ts
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import os from "node:os";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import { spawn } from "node:child_process";
|
|
8
|
+
var REGISTRY = "https://registry.npmjs.org/accelr8/latest";
|
|
9
|
+
var CACHE_FILE = "update-check.json";
|
|
10
|
+
var CHECK_EVERY_MS = 6 * 60 * 60 * 1e3;
|
|
11
|
+
function cachePath(baseDir) {
|
|
12
|
+
return path.join(baseDir ?? path.join(os.homedir(), ".accelr8"), CACHE_FILE);
|
|
13
|
+
}
|
|
14
|
+
function compareVersions(a, b) {
|
|
15
|
+
const clean = (v) => v.trim().replace(/^v/, "").split("-")[0].split(".").map((n) => parseInt(n, 10) || 0);
|
|
16
|
+
const pa = clean(a), pb = clean(b);
|
|
17
|
+
for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
|
|
18
|
+
const x = pa[i] ?? 0, y = pb[i] ?? 0;
|
|
19
|
+
if (x !== y) return x < y ? -1 : 1;
|
|
20
|
+
}
|
|
21
|
+
return 0;
|
|
22
|
+
}
|
|
23
|
+
function cachedUpdate(current, baseDir) {
|
|
24
|
+
try {
|
|
25
|
+
const raw = fs.readFileSync(cachePath(baseDir), "utf8");
|
|
26
|
+
const c = JSON.parse(raw);
|
|
27
|
+
if (c && typeof c.latest === "string" && compareVersions(current, c.latest) < 0) {
|
|
28
|
+
return { latest: c.latest, current };
|
|
29
|
+
}
|
|
30
|
+
} catch {
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
function refreshUpdateCache(baseDir, now = Date.now()) {
|
|
35
|
+
let fresh = false;
|
|
36
|
+
try {
|
|
37
|
+
const c = JSON.parse(fs.readFileSync(cachePath(baseDir), "utf8"));
|
|
38
|
+
fresh = typeof c.checkedAt === "number" && now - c.checkedAt < CHECK_EVERY_MS;
|
|
39
|
+
} catch {
|
|
40
|
+
}
|
|
41
|
+
if (fresh) return;
|
|
42
|
+
const ac = new AbortController();
|
|
43
|
+
const timer = setTimeout(() => ac.abort(), 2500);
|
|
44
|
+
Promise.resolve().then(() => globalThis.fetch ? globalThis.fetch(REGISTRY, { signal: ac.signal, headers: { accept: "application/json" } }) : null).then((r) => r && r.ok ? r.json() : null).then((j) => {
|
|
45
|
+
const latest = j && typeof j.version === "string" ? j.version : null;
|
|
46
|
+
if (!latest) return;
|
|
47
|
+
const dir = baseDir ?? path.join(os.homedir(), ".accelr8");
|
|
48
|
+
try {
|
|
49
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
50
|
+
} catch {
|
|
51
|
+
}
|
|
52
|
+
const tmp = path.join(dir, CACHE_FILE + ".tmp-" + process.pid);
|
|
53
|
+
fs.writeFileSync(tmp, JSON.stringify({ latest, checkedAt: now }));
|
|
54
|
+
fs.renameSync(tmp, cachePath(baseDir));
|
|
55
|
+
}).catch(() => {
|
|
56
|
+
}).finally(() => clearTimeout(timer));
|
|
57
|
+
}
|
|
58
|
+
function updateBanner(current, baseDir) {
|
|
59
|
+
refreshUpdateCache(baseDir);
|
|
60
|
+
const u = cachedUpdate(current, baseDir);
|
|
61
|
+
return u ? `update available \xB7 v${u.latest} \xB7 npm i -g accelr8@latest` : null;
|
|
62
|
+
}
|
|
63
|
+
function runUpdate(cb) {
|
|
64
|
+
let child;
|
|
65
|
+
const MANUAL = "run it yourself: npm i -g accelr8@latest";
|
|
66
|
+
try {
|
|
67
|
+
child = spawn("npm", ["install", "-g", "accelr8@latest", "--no-fund", "--no-audit"], { stdio: ["ignore", "pipe", "pipe"] });
|
|
68
|
+
} catch (e) {
|
|
69
|
+
queueMicrotask(() => cb.onDone(false, `couldn't start npm \xB7 ${MANUAL}`));
|
|
70
|
+
return () => {
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
let tail = "";
|
|
74
|
+
const feed = (chunk) => {
|
|
75
|
+
tail += chunk.toString();
|
|
76
|
+
let nl;
|
|
77
|
+
while ((nl = tail.indexOf("\n")) >= 0) {
|
|
78
|
+
const line = tail.slice(0, nl).trim();
|
|
79
|
+
tail = tail.slice(nl + 1);
|
|
80
|
+
if (line) cb.onLine(line);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
child.stdout?.on("data", feed);
|
|
84
|
+
child.stderr?.on("data", feed);
|
|
85
|
+
child.on("error", (e) => {
|
|
86
|
+
cb.onDone(false, e.code === "ENOENT" ? `npm not found \xB7 ${MANUAL}` : `${e.message} \xB7 ${MANUAL}`);
|
|
87
|
+
});
|
|
88
|
+
child.on("close", (code) => {
|
|
89
|
+
if (tail.trim()) cb.onLine(tail.trim());
|
|
90
|
+
if (code === 0) cb.onDone(true, "updated \xB7 restart accelr8 to use the new version");
|
|
91
|
+
else cb.onDone(false, code === 243 || code === 3 ? `permission denied \xB7 ${MANUAL}` : `npm exited ${code} \xB7 ${MANUAL}`);
|
|
92
|
+
});
|
|
93
|
+
return () => {
|
|
94
|
+
try {
|
|
95
|
+
child.kill();
|
|
96
|
+
} catch {
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
cachedUpdate,
|
|
102
|
+
compareVersions,
|
|
103
|
+
refreshUpdateCache,
|
|
104
|
+
runUpdate,
|
|
105
|
+
updateBanner
|
|
106
|
+
};
|
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
DEFAULT_SERVER,
|
|
4
4
|
PORT,
|
|
5
5
|
VERSION
|
|
6
|
-
} from "./chunks/chunk-
|
|
6
|
+
} from "./chunks/chunk-SF6NNSYZ.js";
|
|
7
7
|
|
|
8
8
|
// src/cli.ts
|
|
9
9
|
var HELP = `
|
|
@@ -13,6 +13,7 @@ USAGE
|
|
|
13
13
|
accelr8 open the app
|
|
14
14
|
accelr8 join <CODE> open straight into a project
|
|
15
15
|
accelr8 serve run your own sync server
|
|
16
|
+
accelr8 --intro replay the full boot animation
|
|
16
17
|
|
|
17
18
|
OPTIONS
|
|
18
19
|
--name <name> display name (remembered for next time)
|
|
@@ -51,10 +52,15 @@ async function main() {
|
|
|
51
52
|
console.error(`invalid port: ${argVal(args, "--port")}`);
|
|
52
53
|
process.exit(1);
|
|
53
54
|
}
|
|
54
|
-
const { runServer } = await import("./chunks/server-
|
|
55
|
+
const { runServer } = await import("./chunks/server-ZP2DV4IO.js");
|
|
55
56
|
runServer(port);
|
|
56
57
|
return;
|
|
57
58
|
}
|
|
59
|
+
if (args[0] === "agent") {
|
|
60
|
+
const { runAgentCli } = await import("./chunks/agentcli-ZI2O7ID7.js");
|
|
61
|
+
await runAgentCli(args.slice(1));
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
58
64
|
let joinCode;
|
|
59
65
|
if (args[0] === "join") {
|
|
60
66
|
joinCode = args[1];
|
|
@@ -67,11 +73,16 @@ async function main() {
|
|
|
67
73
|
console.error("accelr8 is a terminal app and needs an interactive terminal (TTY).");
|
|
68
74
|
process.exit(1);
|
|
69
75
|
}
|
|
70
|
-
const {
|
|
76
|
+
const { cachedUpdate, refreshUpdateCache } = await import("./chunks/update-UEPNGB6Y.js");
|
|
77
|
+
refreshUpdateCache();
|
|
78
|
+
const update = cachedUpdate(VERSION);
|
|
79
|
+
const { runClient } = await import("./chunks/client-7BVK2DEW.js");
|
|
71
80
|
runClient({
|
|
72
81
|
name: argVal(args, "--name"),
|
|
73
82
|
server: argVal(args, "--server"),
|
|
74
|
-
joinCode
|
|
83
|
+
joinCode,
|
|
84
|
+
intro: args.includes("--intro"),
|
|
85
|
+
update
|
|
75
86
|
});
|
|
76
87
|
}
|
|
77
88
|
main();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "accelr8",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Collaborative ascii canvas in your terminal. Real multiplayer, live cursors, mouse-driven TUI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "ISC",
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
|
-
"worker",
|
|
18
17
|
"README.md"
|
|
19
18
|
],
|
|
20
19
|
"engines": {
|
|
@@ -37,7 +36,24 @@
|
|
|
37
36
|
"smoketest": "tsx src/smoketest.ts",
|
|
38
37
|
"rendertest": "tsx src/rendertest.ts",
|
|
39
38
|
"typecheck": "tsc --noEmit",
|
|
40
|
-
"prepublishOnly": "npm run build"
|
|
39
|
+
"prepublishOnly": "npm run build",
|
|
40
|
+
"coretest": "tsx src/coretest.ts",
|
|
41
|
+
"orbtest": "tsx src/orbtest.ts",
|
|
42
|
+
"chattest": "tsx src/chattest.ts",
|
|
43
|
+
"inputtest": "tsx src/inputtest.ts",
|
|
44
|
+
"torturetest": "tsx src/torturetest.ts",
|
|
45
|
+
"test": "for t in core chat input ladder boot orb crypto accounts executor agentcontext map voice glyph materialize update contrast; do tsx src/${t}test.ts || exit 1; done && tsx src/rendertest.ts > /dev/null && echo RENDER OK",
|
|
46
|
+
"laddertest": "tsx src/laddertest.ts",
|
|
47
|
+
"boottest": "tsx src/boottest.ts",
|
|
48
|
+
"reconnecttest": "tsx src/reconnecttest.ts",
|
|
49
|
+
"agenttest": "tsx src/agenttest.ts",
|
|
50
|
+
"maptest": "tsx src/maptest.ts",
|
|
51
|
+
"voicetest": "tsx src/voicetest.ts",
|
|
52
|
+
"cryptotest": "tsx src/cryptotest.ts",
|
|
53
|
+
"accountstest": "tsx src/accountstest.ts",
|
|
54
|
+
"executortest": "tsx src/executortest.ts",
|
|
55
|
+
"agentcontexttest": "tsx src/agentcontexttest.ts",
|
|
56
|
+
"chaintest": "tsx src/chaintest.ts"
|
|
41
57
|
},
|
|
42
58
|
"dependencies": {
|
|
43
59
|
"terminal-kit": "3.1.2",
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// src/protocol.ts
|
|
4
|
-
var VERSION = "2.0.0";
|
|
5
|
-
var PORT = 8787;
|
|
6
|
-
var DEFAULT_SERVER = "wss://accelr8-canvas.patonchain.workers.dev";
|
|
7
|
-
var CANVAS_W = 100;
|
|
8
|
-
var CANVAS_H = 30;
|
|
9
|
-
function encode(msg) {
|
|
10
|
-
return JSON.stringify(msg);
|
|
11
|
-
}
|
|
12
|
-
function decode(data) {
|
|
13
|
-
return JSON.parse(data);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
VERSION,
|
|
18
|
-
PORT,
|
|
19
|
-
DEFAULT_SERVER,
|
|
20
|
-
CANVAS_W,
|
|
21
|
-
CANVAS_H,
|
|
22
|
-
encode,
|
|
23
|
-
decode
|
|
24
|
-
};
|