@neta-art/cohub-cli 8.3.1 → 8.4.1
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 +1 -0
- package/dist/avatar.js +3 -1
- package/dist/board-export.d.ts +4 -8
- package/dist/board-export.js +18 -30
- package/dist/board-fonts.d.ts +7 -0
- package/dist/board-fonts.js +10 -0
- package/dist/board-kernel/browserAll.js +2760 -0
- package/dist/board-kernel/getPo2TextureFromSource.js +13138 -0
- package/dist/board-kernel/init.js +867 -0
- package/dist/board-kernel/webworkerAll.js +3 -0
- package/dist/board-kernel.d.ts +3 -0
- package/dist/board-kernel.js +29154 -0
- package/dist/commands/boards.js +11 -1
- package/dist/commands/desktop.js +5 -3
- package/dist/commands/generations.js +104 -30
- package/dist/commands/spaces.js +38 -0
- package/dist/fonts/geist-latin-400-normal.woff2 +0 -0
- package/dist/fonts/geist-latin-500-normal.woff2 +0 -0
- package/dist/fonts/geist-latin-600-normal.woff2 +0 -0
- package/dist/fonts/geist-latin-700-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-500-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-600-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-700-normal.woff2 +0 -0
- package/dist/runtime/connection.js +13 -7
- package/dist/runtime/harness.d.ts +2 -0
- package/dist/runtime/harness.js +6 -2
- package/dist/runtime/json-rpc.d.ts +4 -0
- package/dist/runtime/json-rpc.js +7 -3
- package/dist/runtime/native/execution.js +5 -2
- package/dist/runtime/native/transcript.js +20 -9
- package/dist/runtime/native/translate.js +13 -10
- package/dist/runtime/presentation.js +1 -0
- package/dist/runtime/process-group.js +2 -2
- package/dist/self-update.d.ts +1 -0
- package/dist/self-update.js +52 -16
- package/package.json +8 -4
|
@@ -6,6 +6,7 @@ const messages = {
|
|
|
6
6
|
"runtime.ready": "Harness connected",
|
|
7
7
|
"runtime.available": "Runtime ready",
|
|
8
8
|
"runtime.websocket.closed": "Connection lost; reconnecting",
|
|
9
|
+
"runtime.websocket.rejected": "Connection rejected; not reconnecting",
|
|
9
10
|
"runtime.heartbeat_timeout": "Connection timed out; reconnecting",
|
|
10
11
|
"runtime.auth_token_failed": "Cannot obtain credentials; retrying",
|
|
11
12
|
"runtime.auth_required": "Sign in with cohub auth login",
|
|
@@ -19,8 +19,8 @@ async function probeLinux(pid) {
|
|
|
19
19
|
members.push({ pid: Number(entry), state: state ?? "U" });
|
|
20
20
|
}
|
|
21
21
|
catch (error) {
|
|
22
|
-
//
|
|
23
|
-
if (error.code
|
|
22
|
+
// Exited between readdir and read.
|
|
23
|
+
if (!["ENOENT", "ESRCH"].includes(error.code ?? ""))
|
|
24
24
|
throw error;
|
|
25
25
|
}
|
|
26
26
|
}
|
package/dist/self-update.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const SELF_UPDATE_WORKER_ENV = "COHUB_CLI_SELF_UPDATE_WORKER";
|
|
2
2
|
export type CliSelfUpdateResult = "current" | "updated" | "updated-by-peer";
|
|
3
|
+
export declare function isNewerVersion(candidate: string, installed: string | undefined): boolean;
|
|
3
4
|
export declare function resolveSelfUpdateResult(beforeVersion: string | undefined, afterVersion: string | undefined, updatedByPeer: boolean): CliSelfUpdateResult;
|
|
4
5
|
export declare const isCliSelfUpdateDue: () => boolean;
|
|
5
6
|
export declare function startCliSelfUpdate(entrypoint: string): void;
|
package/dist/self-update.js
CHANGED
|
@@ -38,9 +38,9 @@ const readState = () => {
|
|
|
38
38
|
return {};
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
-
const writeState = () => {
|
|
41
|
+
const writeState = (state) => {
|
|
42
42
|
mkdirSync(dirname(STATE_PATH), { recursive: true });
|
|
43
|
-
writeFileSync(STATE_PATH, `${JSON.stringify({
|
|
43
|
+
writeFileSync(STATE_PATH, `${JSON.stringify({ checkedAt: new Date().toISOString(), ...state }, null, 2)}\n`);
|
|
44
44
|
};
|
|
45
45
|
const readInstalledVersion = () => {
|
|
46
46
|
try {
|
|
@@ -51,19 +51,35 @@ const readInstalledVersion = () => {
|
|
|
51
51
|
return undefined;
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
+
const parseVersion = (value) => {
|
|
55
|
+
const match = /^(\d+)\.(\d+)\.(\d+)(-.+)?$/.exec(value.trim());
|
|
56
|
+
if (!match)
|
|
57
|
+
return null;
|
|
58
|
+
const core = [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
59
|
+
return { core, prerelease: Boolean(match[4]) };
|
|
60
|
+
};
|
|
61
|
+
export function isNewerVersion(candidate, installed) {
|
|
62
|
+
const next = parseVersion(candidate);
|
|
63
|
+
if (!next)
|
|
64
|
+
return false;
|
|
65
|
+
const current = installed === undefined ? null : parseVersion(installed);
|
|
66
|
+
if (!current)
|
|
67
|
+
return true;
|
|
68
|
+
const [major, minor, patch] = next.core;
|
|
69
|
+
const [installedMajor, installedMinor, installedPatch] = current.core;
|
|
70
|
+
const delta = major - installedMajor || minor - installedMinor || patch - installedPatch;
|
|
71
|
+
return delta === 0 ? current.prerelease && !next.prerelease : delta > 0;
|
|
72
|
+
}
|
|
54
73
|
export function resolveSelfUpdateResult(beforeVersion, afterVersion, updatedByPeer) {
|
|
55
74
|
if (beforeVersion !== undefined && beforeVersion === afterVersion)
|
|
56
75
|
return "current";
|
|
57
76
|
return updatedByPeer ? "updated-by-peer" : "updated";
|
|
58
77
|
}
|
|
59
78
|
export const isCliSelfUpdateDue = () => {
|
|
60
|
-
const
|
|
61
|
-
if (!
|
|
79
|
+
const checkedAt = Date.parse(readState().checkedAt ?? "");
|
|
80
|
+
if (!Number.isFinite(checkedAt))
|
|
62
81
|
return true;
|
|
63
|
-
|
|
64
|
-
if (!Number.isFinite(lastUpdatedAt))
|
|
65
|
-
return true;
|
|
66
|
-
return Date.now() - lastUpdatedAt >= getIntervalMs();
|
|
82
|
+
return Date.now() - checkedAt >= getIntervalMs();
|
|
67
83
|
};
|
|
68
84
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
69
85
|
const acquireLock = async (timeoutMs) => {
|
|
@@ -96,9 +112,9 @@ const acquireLock = async (timeoutMs) => {
|
|
|
96
112
|
const releaseLock = () => {
|
|
97
113
|
rmSync(LOCK_PATH, { recursive: true, force: true });
|
|
98
114
|
};
|
|
99
|
-
const
|
|
115
|
+
const runNpm = (args, timeoutMs) => {
|
|
100
116
|
return new Promise((resolve, reject) => {
|
|
101
|
-
const child = spawn("npm",
|
|
117
|
+
const child = spawn("npm", args, {
|
|
102
118
|
stdio: ["ignore", "pipe", "pipe"],
|
|
103
119
|
env: process.env,
|
|
104
120
|
});
|
|
@@ -117,14 +133,14 @@ const runNpmUpdate = (timeoutMs) => {
|
|
|
117
133
|
});
|
|
118
134
|
child.on("close", (code, signal) => {
|
|
119
135
|
clearTimeout(timer);
|
|
136
|
+
const stdout = Buffer.concat(stdoutChunks).toString().trim();
|
|
120
137
|
if (code === 0) {
|
|
121
|
-
resolve();
|
|
138
|
+
resolve(stdout);
|
|
122
139
|
return;
|
|
123
140
|
}
|
|
124
|
-
const stdout = Buffer.concat(stdoutChunks).toString().trim();
|
|
125
141
|
const stderr = Buffer.concat(stderrChunks).toString().trim();
|
|
126
142
|
const detail = [stderr, stdout].filter(Boolean).join("\n");
|
|
127
|
-
reject(new Error(`npm
|
|
143
|
+
reject(new Error(`npm ${args.join(" ")} failed${signal ? ` (${signal})` : code !== null ? ` (exit ${code})` : ""}${detail ? `:\n${detail}` : ""}`));
|
|
128
144
|
});
|
|
129
145
|
});
|
|
130
146
|
};
|
|
@@ -156,9 +172,29 @@ export async function ensureCliSelfUpdated() {
|
|
|
156
172
|
if (!isCliSelfUpdateDue()) {
|
|
157
173
|
return resolveSelfUpdateResult(beforeVersion, readInstalledVersion(), true);
|
|
158
174
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
175
|
+
// Reinstalling briefly removes the `cohub` bin, so only do it for a newer release.
|
|
176
|
+
let latestVersion;
|
|
177
|
+
try {
|
|
178
|
+
latestVersion = await runNpm(["view", `${PACKAGE_NAME}@latest`, "version"], timeoutMs);
|
|
179
|
+
if (!isNewerVersion(latestVersion, beforeVersion)) {
|
|
180
|
+
writeState({ installedVersion: beforeVersion, latestVersion, result: "current" });
|
|
181
|
+
return "current";
|
|
182
|
+
}
|
|
183
|
+
await runNpm(["install", "-g", `${PACKAGE_NAME}@${latestVersion}`, "--silent"], timeoutMs);
|
|
184
|
+
}
|
|
185
|
+
catch (error) {
|
|
186
|
+
writeState({
|
|
187
|
+
installedVersion: beforeVersion,
|
|
188
|
+
latestVersion,
|
|
189
|
+
result: "failed",
|
|
190
|
+
error: (error instanceof Error ? error.message : String(error)).slice(0, 500),
|
|
191
|
+
});
|
|
192
|
+
throw error;
|
|
193
|
+
}
|
|
194
|
+
const afterVersion = readInstalledVersion();
|
|
195
|
+
const result = resolveSelfUpdateResult(beforeVersion, afterVersion, false);
|
|
196
|
+
writeState({ installedVersion: afterVersion, latestVersion, result });
|
|
197
|
+
return result;
|
|
162
198
|
}
|
|
163
199
|
finally {
|
|
164
200
|
releaseLock();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neta-art/cohub-cli",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.1",
|
|
4
4
|
"description": "CLI for Cohub — spaces, sessions, and agent collaboration.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -20,25 +20,29 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@neta-art/generation": "^0.1.30",
|
|
22
22
|
"commander": "^15.0.0",
|
|
23
|
-
"pixi.js": "^8.20.1",
|
|
24
23
|
"sharp": "^0.35.4",
|
|
25
24
|
"ws": "^8.21.3",
|
|
26
|
-
"@neta-art/cohub": "8.
|
|
25
|
+
"@neta-art/cohub": "8.24.0"
|
|
27
26
|
},
|
|
28
27
|
"publishConfig": {
|
|
29
28
|
"access": "public"
|
|
30
29
|
},
|
|
31
30
|
"devDependencies": {
|
|
31
|
+
"@fontsource/geist": "^5.3.0",
|
|
32
|
+
"@fontsource/geist-mono": "^5.3.0",
|
|
32
33
|
"@types/node": "^26.4.0",
|
|
33
34
|
"@types/ws": "^8.18.1",
|
|
35
|
+
"pixi.js": "^8.20.1",
|
|
36
|
+
"tsdown": "^0.22.14",
|
|
34
37
|
"typescript": "^7.0.2"
|
|
35
38
|
},
|
|
36
39
|
"optionalDependencies": {
|
|
37
40
|
"@napi-rs/canvas": "^1.0.8"
|
|
38
41
|
},
|
|
39
42
|
"scripts": {
|
|
40
|
-
"build": "tsc -p tsconfig.build.json",
|
|
43
|
+
"build": "tsc -p tsconfig.build.json && tsdown",
|
|
41
44
|
"verify:sandboxd": "node --import tsx scripts/verify-sandboxd-release.ts",
|
|
45
|
+
"verify:board-kernel": "node --import tsx scripts/verify-board-kernel.ts",
|
|
42
46
|
"test": "node ../../scripts/test/run.mjs 'tests/**/*.test.ts'",
|
|
43
47
|
"test:runtime": "node --import tsx --test tests/runtime-*.integration.ts",
|
|
44
48
|
"test:runtime:native": "node --import tsx tests/runtime-native.smoke.ts",
|