@thaloz/t3 0.0.0-stage → 0.1.5
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 +6 -2
- package/bin/t3.js +39 -0
- package/dist/bin.mjs +34 -0
- package/package.json +21 -4
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @thaloz/t3
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Install with `npm install -g @thaloz/t3`, then run `thz`.
|
|
4
|
+
|
|
5
|
+
New releases support `thz service install` with verified runtime downloads from https://updates.thalozlabs.com/releases/download.
|
|
6
|
+
|
|
7
|
+
The immutable 0.0.54 recovery package supports foreground use, but refuses managed installation and all `service`, `connect`, `update`, hidden service and legacy managed entrypoints. Connect onboarding and updates can install or reconcile a service too. Its original executable defaults to upstream downloads after the service manager discards the npm wrapper's environment. Use a newer Thaloz release for managed workers and Connect setup. Existing 0.0.54 services require a persistent Thaloz origin in their service configuration; see the repository's release backfill and recovery procedure.
|
package/bin/t3.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
const thalozPackage = require("../package.json");
|
|
4
|
+
if (thalozPackage.version === "0.0.54" && (false || process.argv.slice(2).some((arg) => ["service", "connect", "update", "__service-launcher", "__service-preflight"].includes(arg)))) {
|
|
5
|
+
process.stderr.write("thz: managed installation of the immutable 0.0.54 recovery package is disabled: its service would lose the Thaloz download origin. Install a newer Thaloz release for managed services.\n");
|
|
6
|
+
process.exit(1);
|
|
7
|
+
}
|
|
8
|
+
process.env.T3CODE_RELEASE_BASE_URL ||= "https://updates.thalozlabs.com/releases/download";
|
|
9
|
+
const { spawnSync } = require("node:child_process");
|
|
10
|
+
const { constants } = require("node:os");
|
|
11
|
+
const { dirname, join } = require("node:path");
|
|
12
|
+
|
|
13
|
+
const SUPPORTED = ["darwin-arm64", "linux-x64", "win32-x64"];
|
|
14
|
+
const key = process.platform + "-" + process.arch;
|
|
15
|
+
|
|
16
|
+
let packageDir;
|
|
17
|
+
try {
|
|
18
|
+
packageDir = dirname(require.resolve("@thaloz/t3-" + key + "/package.json"));
|
|
19
|
+
} catch {
|
|
20
|
+
process.stderr.write(
|
|
21
|
+
[
|
|
22
|
+
"t3: no T3 Code CLI build is available for this platform (" + key + ").",
|
|
23
|
+
"Supported platforms: " + SUPPORTED.join(", ") + ".",
|
|
24
|
+
"If yours is listed, reinstall @thaloz/t3 so npm fetches its optional dependency.",
|
|
25
|
+
"The desktop app and release archives are at https://updates.thalozlabs.com/releases/download",
|
|
26
|
+
"",
|
|
27
|
+
].join("\n"),
|
|
28
|
+
);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const executable = join(packageDir, process.platform === "win32" ? "t3.exe" : "t3");
|
|
33
|
+
const result = spawnSync(executable, process.argv.slice(2), { stdio: "inherit" });
|
|
34
|
+
if (result.error) {
|
|
35
|
+
process.stderr.write("t3: failed to start " + executable + ": " + result.error.message + "\n");
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
// A child killed by a signal has no status; report it the way a shell would.
|
|
39
|
+
process.exit(result.status ?? 128 + (constants.signals[result.signal] || 1));
|
package/dist/bin.mjs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createRequire as thalozCreateRequire } from "node:module";
|
|
2
|
+
const thalozPackage = thalozCreateRequire(import.meta.url)("../package.json");
|
|
3
|
+
if (thalozPackage.version === "0.0.54" && (true || process.argv.slice(2).some((arg) => ["service", "connect", "update", "__service-launcher", "__service-preflight"].includes(arg)))) {
|
|
4
|
+
process.stderr.write("thz: managed installation of the immutable 0.0.54 recovery package is disabled: its service would lose the Thaloz download origin. Install a newer Thaloz release for managed services.\n");
|
|
5
|
+
process.exit(1);
|
|
6
|
+
}
|
|
7
|
+
process.env.T3CODE_RELEASE_BASE_URL ||= "https://updates.thalozlabs.com/releases/download";
|
|
8
|
+
import { spawn } from "node:child_process";
|
|
9
|
+
import { constants } from "node:os";
|
|
10
|
+
import { dirname, join } from "node:path";
|
|
11
|
+
import { createRequire } from "node:module";
|
|
12
|
+
const require = createRequire(import.meta.url);
|
|
13
|
+
const executableName = process.platform === "win32" ? "t3.exe" : "t3";
|
|
14
|
+
const executable = join(dirname(require.resolve("@thaloz/t3-" + process.platform + "-" + process.arch + "/package.json")), executableName);
|
|
15
|
+
const ipc = process.send !== undefined;
|
|
16
|
+
const child = spawn(executable, process.argv.slice(2), {
|
|
17
|
+
stdio: ipc ? ["inherit", "inherit", "inherit", "ipc"] : "inherit",
|
|
18
|
+
});
|
|
19
|
+
const fail = (error) => {
|
|
20
|
+
if (!error) return;
|
|
21
|
+
process.stderr.write("t3: " + error.message + "\n");
|
|
22
|
+
child.kill("SIGTERM");
|
|
23
|
+
process.exitCode = 1;
|
|
24
|
+
};
|
|
25
|
+
if (ipc) {
|
|
26
|
+
process.on("message", (message) => { if (child.connected) child.send(message, fail); });
|
|
27
|
+
child.on("message", (message) => { if (process.connected) process.send(message, fail); });
|
|
28
|
+
process.on("disconnect", () => { if (child.connected) child.disconnect(); });
|
|
29
|
+
}
|
|
30
|
+
for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
|
|
31
|
+
process.on(signal, () => child.kill(signal));
|
|
32
|
+
}
|
|
33
|
+
child.on("error", (error) => { fail(error); process.exit(1); });
|
|
34
|
+
child.on("exit", (code, signal) => process.exit(code ?? 128 + (constants.signals[signal] || 1)));
|
package/package.json
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thaloz/t3",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"description": "T3 Code CLI. Installs the self-contained executable for this platform.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/Thaloz/thz-t3code",
|
|
9
|
+
"directory": "apps/server"
|
|
10
|
+
},
|
|
11
|
+
"bin": {
|
|
12
|
+
"thz": "./bin/t3.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"bin",
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"optionalDependencies": {
|
|
19
|
+
"@thaloz/t3-darwin-arm64": "0.1.5",
|
|
20
|
+
"@thaloz/t3-linux-x64": "0.1.5",
|
|
21
|
+
"@thaloz/t3-win32-x64": "0.1.5"
|
|
22
|
+
}
|
|
23
|
+
}
|