The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 03:15 UTC
perf(server): background service launcher uses 75% less memory (#29284)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Theo Browne committed
Nov 6, 2026 at 03:11 UTC
6577c6b6185167c0e502fa01f9e8e8f2dee6ff25
10 files changed
+217
-92
apps/server/scripts/cli.ts
+37
-18
@@ -16,6 +16,7 @@ import rootPackageJson from "../../../package.json" with { type: "json" };
16
import * as HostProcess from "@t3tools/shared/HostProcess";
17
import { resolveSpawnCommand } from "@t3tools/shared/shell";
18
import {
19
+ ServerCliBootstrapTooLargeError,
20
ServerCliBuildAssetMissingError,
21
ServerCliCommandExitError,
22
ServerCliDevelopmentIconSourceMissingError,
@@ -127,30 +128,48 @@ const buildExeCmd = Command.make(
128
(yield* HostProcess.Platform) === "linux" &&
129
(yield* HostProcess.Architecture) === "arm64";
130
const spawnCommand = yield* resolveSpawnCommand("vp", ["pack"]);
130
- yield* runCommand(
131
- ChildProcess.make(spawnCommand.command, spawnCommand.args, {
132
- cwd: serverDir,
133
- env: {
134
- ...process.env,
135
- T3CODE_PACK_EXE: linuxArm64 ? "bundle" : "1",
136
- T3CODE_PACK_EXE_TARGET: target ?? "",
137
- },
138
- stdout: config.verbose ? "inherit" : "ignore",
139
- stderr: "inherit",
140
- shell: spawnCommand.shell,
141
- }),
142
- );
131
+ const cliAssetDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-cli-asset-" });
132
+ const pack = (packMode: "bundle" | "bootstrap" | "1") =>
133
+ runCommand(
134
+ ChildProcess.make(spawnCommand.command, spawnCommand.args, {
135
+ cwd: serverDir,
136
+ env: {
137
+ ...process.env,
138
+ T3CODE_PACK_EXE: packMode,
139
+ T3CODE_CLI_ASSET_DIR: cliAssetDir,
140
+ T3CODE_PACK_EXE_TARGET: target ?? "",
141
+ },
142
+ stdout: config.verbose ? "inherit" : "ignore",
143
+ stderr: "inherit",
144
+ shell: spawnCommand.shell,
145
+ }),
146
+ );
147
+
148
+ yield* pack("bundle");
149
+ const cliMainPath = path.join(cliAssetDir, "binMain.mjs");
150
+ yield* pack(linuxArm64 ? "bootstrap" : "1");
151
152
// Executables reject non-builtin imports even when bundling succeeds; inspect the emitted graph.
145
- const bundlePath = path.join(serverDir, "dist-exe/bin.mjs");
146
- const specifiers = findEsmImportsOfExternalPackages(yield* fs.readFileString(bundlePath));
147
- if (specifiers.length > 0) {
148
- return yield* new ServerCliExecutableImportError({ bundlePath, specifiers });
153
+ const bootstrapPath = path.join(serverDir, "dist-exe/bin.mjs");
154
+ for (const bundlePath of [bootstrapPath, cliMainPath]) {
155
+ const specifiers = findEsmImportsOfExternalPackages(yield* fs.readFileString(bundlePath));
156
+ if (specifiers.length > 0) {
157
+ return yield* new ServerCliExecutableImportError({ bundlePath, specifiers });
158
+ }
159
+ }
160
+ // The service launcher's memory win depends on the CLI staying out of the bootstrap.
161
+ const bootstrapBytes = (yield* fs.stat(bootstrapPath)).size;
162
+ if (bootstrapBytes > 1024 * 1024) {
163
+ return yield* new ServerCliBootstrapTooLargeError({
164
+ bootstrapPath,
165
+ bytes: Number(bootstrapBytes),
166
+ });
167
}
168
// TEMPORARY one-time Node fix. Remove when fixed: https://github.com/nodejs/node/issues/67048
169
if (linuxArm64) {
170
yield* injectLinuxArm64Sea({
153
- bundlePath,
171
+ bundlePath: bootstrapPath,
172
+ cliAssetPath: cliMainPath,
173
outputPath: path.join(serverDir, "dist-exe/t3"),
174
nodeVersion: rootPackageJson.engines.node,
175
verbose: config.verbose,
apps/server/scripts/cliErrors.ts
+12
@@ -58,3 +58,15 @@ export class ServerCliExecutableImportError extends Schema.TaggedError<ServerCli
58
return `${this.bundlePath} imports file-backed packages that a single-executable cannot resolve: ${this.specifiers.join(", ")}. Load them through createRequire instead.`;
59
}
60
}
61
+
62
+export class ServerCliBootstrapTooLargeError extends Schema.TaggedError<ServerCliBootstrapTooLargeError>()(
63
+ "ServerCliBootstrapTooLargeError",
64
+ {
65
+ bootstrapPath: Schema.String,
66
+ bytes: Schema.Number,
67
+ },
68
+) {
69
+ override get message(): string {
70
+ return `${this.bootstrapPath} is ${this.bytes} bytes. The CLI was bundled into the executable bootstrap; keep ./binMain.ts external.`;
71
+ }
72
+}
apps/server/src/bin.ts
+37
-43
@@ -1,11 +1,34 @@
1
-/**
2
- * Every ACP agent spawns `t3 acp-mcp-bridge` while opening its session, and terminal-fallback
3
- * agents run `t3 acp-mcp-call` per tool call, so their startup sits on first-message latency.
4
- * They and Codex's managed-token helper dispatch before the full CLI module graph (seconds
5
- * of evaluation) loads; everything else defers to the real CLI in ./binCli.ts.
6
- */
1
+// @effect-diagnostics nodeBuiltinImport:off -- The service launcher starts before the CLI runtime.
2
+import * as NodeModule from "node:module";
3
+import * as NodeSea from "node:sea";
4
+import * as NodeURL from "node:url";
5
+
6
import { isEntrypoint } from "./entrypoint.ts";
8
-import { enableCliCompileCache } from "./cliCompileCache.ts";
7
+
8
+// Loads the CLI outside the launcher's module graph. Packaged builds embed it as a raw asset.
9
+async function loadCliMain(): Promise<typeof import("./binMain.ts")> {
10
+ if (!NodeSea.isSea()) return import("./binMain.ts");
11
+
12
+ // Keep the executable's module URL so the CLI finds the web client and native packages beside it.
13
+ const require = NodeModule.createRequire(import.meta.url);
14
+ // require() resolves links in the executable path, such as a Windows junction.
15
+ const cliUrl = NodeURL.pathToFileURL(require.resolve(process.execPath)).href;
16
+ const hook = NodeModule.registerHooks({
17
+ load(url, context, next) {
18
+ if (url !== cliUrl) return next(url, context);
19
+ return {
20
+ format: "module",
21
+ source: new Uint8Array(NodeSea.getRawAsset("binMain.mjs")),
22
+ shortCircuit: true,
23
+ };
24
+ },
25
+ });
26
+ try {
27
+ return require(process.execPath) as typeof import("./binMain.ts");
28
+ } finally {
29
+ hook.deregister();
30
+ }
31
+}
32
33
if (
34
isEntrypoint({
@@ -14,42 +37,13 @@ if (
37
runtimeMain: import.meta.main,
38
})
39
) {
17
- const command = process.argv[2];
18
- // Guard sockets before either dispatch path can load outbound-capable modules.
19
- const { ignoreMacosTypeOfServiceEinval } = await import("./outboundHttp.ts");
20
- ignoreMacosTypeOfServiceEinval();
21
- if (command === "__document-text") {
22
- const { extractDocumentText } = await import("./provider/documentTextWorker.ts");
23
- try {
24
- process.stdout.write(await extractDocumentText(process.argv[3]!, process.argv[4]!));
25
- } catch (error) {
26
- if (error instanceof Error && "code" in error && /^E[A-Z0-9]+$/.test(String(error.code))) {
27
- throw error;
28
- }
29
- // Exit 2 identifies document rejections; OS and process failures remain retryable.
30
- process.exitCode = 2;
31
- }
32
- } else if (command === "__managed-chatgpt-token") {
33
- const { runManagedChatGptTokenCli } = await import("./cli/managedChatGptToken.ts");
34
- await runManagedChatGptTokenCli(process.argv.slice(3));
35
- } else if (command === "acp-mcp-bridge" || command === "acp-mcp-call") {
36
- const { runAcpMcpCliFastPath } = await import("./mcp/AcpMcpStdioBridge.ts");
37
- await runAcpMcpCliFastPath(command, process.argv.slice(3));
38
- } else if (command === "__speech-worker") {
39
- const mode = process.argv[3];
40
- if (mode !== "discover" && mode !== "model") throw new Error("Unknown speech worker mode.");
41
- const { runNativeSpeechWorker } = await import("./speech/native.ts");
42
- await runNativeSpeechWorker(mode, process.argv[4]);
40
+ // The launcher owns shutdown until its child exits, so it bypasses the Effect CLI runtime.
41
+ // The service unit passes no arguments; flags and help go through the full CLI.
42
+ if (process.argv[2] === "__service-launcher" && process.argv.length === 3) {
43
+ const { runServiceLauncherCli } = await import("./cli/serviceLauncher.ts");
44
+ await runServiceLauncherCli();
45
} else {
44
- enableCliCompileCache();
45
- // Windows desktop launches without stdin; attach before reading, except on fast paths using pipes.
46
- const { attachConsoleStdin } = await import("./cli/consoleStdin.ts");
47
- attachConsoleStdin();
48
- const importStart = performance.now();
49
- const { runCli } = await import("./binCli.ts");
50
- if (process.env.T3CODE_STARTUP_PROFILE_DIR) {
51
- performance.measure("server.import.binCli", { start: importStart });
52
- }
53
- runCli();
46
+ const { runCliCommand } = await loadCliMain();
47
+ await runCliCommand();
48
}
49
}
apps/server/src/binCli.ts
+7
-2
@@ -24,7 +24,7 @@ import { threadCommand } from "./cli/thread.ts";
24
import { runDefaultServerCommand, serveCommand, startCommand } from "./cli/server.ts";
25
import { updateCommand } from "./cli/update.ts";
26
import { uninstallCommand } from "./cli/uninstall.ts";
27
-import { serviceLauncherCommand } from "./cli/serviceLauncher.ts";
27
+import { runServiceLauncherCli } from "./cli/serviceLauncher.ts";
28
import { speechWorkerCommand } from "./cli/speechWorker.ts";
29
import { claudeHistoryCommand } from "./cli/claudeHistory.ts";
30
import { sshHelperCommand } from "./cli/sshHelper.ts";
@@ -90,7 +90,12 @@ export const makeCli = ({ cloudEnabled = hasCloudPublicConfig } = {}) =>
90
serviceCommand,
91
updateCommand,
92
uninstallCommand,
93
- serviceLauncherCommand,
93
+ // bin.ts runs the bare service invocation; this keeps flags and help working like other commands.
94
+ Command.make("__service-launcher").pipe(
95
+ Command.unlisted,
96
+ // The launcher owns shutdown until its child exits; `runMain` would interrupt that shutdown.
97
+ Command.withHandler(() => Effect.sync(() => void runServiceLauncherCli())),
98
+ ),
99
claudeHistoryCommand,
100
speechWorkerCommand,
101
sshHelperCommand,
apps/server/src/binMain.ts
new
+45
@@ -0,0 +1,45 @@
1
+import { enableCliCompileCache } from "./cliCompileCache.ts";
2
+
3
+// Packaged builds load this graph with require(esm): top-level await anywhere in it breaks them.
4
+// ACP agents spawn `acp-mcp-bridge` per session and `acp-mcp-call` per tool call, so those fast
5
+// paths dispatch before the full CLI module graph (seconds of evaluation) loads.
6
+export async function runCliCommand() {
7
+ const command = process.argv[2];
8
+ // Install the socket guard before importing code that can open outbound connections.
9
+ const { ignoreMacosTypeOfServiceEinval } = await import("./outboundHttp.ts");
10
+ ignoreMacosTypeOfServiceEinval();
11
+ if (command === "__document-text") {
12
+ const { extractDocumentText } = await import("./provider/documentTextWorker.ts");
13
+ try {
14
+ process.stdout.write(await extractDocumentText(process.argv[3]!, process.argv[4]!));
15
+ } catch (error) {
16
+ if (error instanceof Error && "code" in error && /^E[A-Z0-9]+$/.test(String(error.code))) {
17
+ throw error;
18
+ }
19
+ // Exit 2 identifies document rejections; OS and process failures remain retryable.
20
+ process.exitCode = 2;
21
+ }
22
+ } else if (command === "__managed-chatgpt-token") {
23
+ const { runManagedChatGptTokenCli } = await import("./cli/managedChatGptToken.ts");
24
+ await runManagedChatGptTokenCli(process.argv.slice(3));
25
+ } else if (command === "acp-mcp-bridge" || command === "acp-mcp-call") {
26
+ const { runAcpMcpCliFastPath } = await import("./mcp/AcpMcpStdioBridge.ts");
27
+ await runAcpMcpCliFastPath(command, process.argv.slice(3));
28
+ } else if (command === "__speech-worker") {
29
+ const mode = process.argv[3];
30
+ if (mode !== "discover" && mode !== "model") throw new Error("Unknown speech worker mode.");
31
+ const { runNativeSpeechWorker } = await import("./speech/native.ts");
32
+ await runNativeSpeechWorker(mode, process.argv[4]);
33
+ } else {
34
+ enableCliCompileCache();
35
+ // Windows desktop launches without stdin; attach before reading, except on fast paths using pipes.
36
+ const { attachConsoleStdin } = await import("./cli/consoleStdin.ts");
37
+ attachConsoleStdin();
38
+ const importStart = performance.now();
39
+ const { runCli } = await import("./binCli.ts");
40
+ if (process.env.T3CODE_STARTUP_PROFILE_DIR) {
41
+ performance.measure("server.import.binCli", { start: importStart });
42
+ }
43
+ runCli();
44
+ }
45
+}
apps/server/src/cli/serviceLauncher.ts
+9
-16
@@ -1,18 +1,11 @@
1
-import * as Effect from "effect/Effect";
2
-import { Command } from "effect/cli";
3
-
1
import { main as runServiceLauncher } from "../serviceLauncher.ts";
2
6
-/** The launcher must stop its child before exiting; `runMain` would interrupt that shutdown. */
7
-export const serviceLauncherCommand = Command.make("__service-launcher").pipe(
8
- Command.unlisted,
9
- Command.withHandler(() =>
10
- Effect.sync(() => {
11
- runServiceLauncher().catch((cause: unknown) => {
12
- const error = cause instanceof Error ? cause : new Error(String(cause));
13
- process.stderr.write(`[service-launcher] ${error.message}\n`);
14
- process.exitCode = 1;
15
- });
16
- }),
17
- ),
18
-);
3
+export async function runServiceLauncherCli(): Promise<void> {
4
+ try {
5
+ await runServiceLauncher();
6
+ } catch (cause) {
7
+ const message = cause instanceof Error ? cause.message : String(cause);
8
+ process.stderr.write(`[service-launcher] ${message}\n`);
9
+ process.exitCode = 1;
10
+ }
11
+}
apps/server/src/cliCompileCache.test.ts
+31
-4
@@ -7,13 +7,23 @@ import * as FileSystem from "effect/FileSystem";
7
import * as Stream from "effect/Stream";
8
import { ChildProcess, ChildProcessSpawner } from "effect/process";
9
10
-it.live("enables CLI caching while respecting overrides and unavailable storage", () =>
10
+it.live("loads the CLI with its cache settings only when the command needs it", () =>
11
Effect.gen(function* () {
12
const fs = yield* FileSystem.FileSystem;
13
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
14
const root = yield* fs.makeTempDirectoryScoped({ prefix: "t3-cli-cache-test-" });
15
- const report = `import { getCompileCacheDir, registerHooks } from 'node:module'; registerHooks({ resolve(specifier, context, nextResolve) { if (specifier === './binCli.ts') console.error('CACHE=' + (getCompileCacheDir() ?? 'disabled')); return nextResolve(specifier, context); } });`;
16
- const run = Effect.fn("cliCompileCache.test.run")(function* (env: Record<string, string>) {
15
+ const report = `
16
+ import { getCompileCacheDir, registerHooks } from 'node:module';
17
+ registerHooks({ resolve(specifier, context, nextResolve) {
18
+ if (specifier === './binMain.ts') console.error('LOADED_CLI_MAIN');
19
+ if (specifier === './binCli.ts') console.error('CACHE=' + (getCompileCacheDir() ?? 'disabled'));
20
+ return nextResolve(specifier, context);
21
+ } });
22
+ `;
23
+ const run = Effect.fn("cliCompileCache.test.run")(function* (
24
+ env: Record<string, string>,
25
+ args: ReadonlyArray<string> = ["--help"],
26
+ ) {
27
const child = yield* spawner.spawn(
28
ChildProcess.make(
29
process.execPath,
@@ -22,7 +32,7 @@ it.live("enables CLI caching while respecting overrides and unavailable storage"
32
"--import",
33
`data:text/javascript,${encodeURIComponent(report)}`,
34
NodeURL.fileURLToPath(new URL("./bin.ts", import.meta.url)),
25
- "--help",
35
+ ...args,
36
],
37
{
38
env: {
@@ -47,9 +57,26 @@ it.live("enables CLI caching while respecting overrides and unavailable storage"
57
}, Effect.scoped);
58
const normal = yield* run({});
59
expect(normal.exitCode).toBe(0);
60
+ expect(normal.stderr).toContain("LOADED_CLI_MAIN");
61
expect(normal.stderr.replaceAll("\\", "/")).toContain(
62
`CACHE=${root}/cache/t3code/compile-cache`.replaceAll("\\", "/"),
63
);
64
+ const launcher = yield* run({ T3CODE_HOME: "" }, ["__service-launcher"]);
65
+ expect(launcher.exitCode).toBe(1);
66
+ expect(launcher.stderr).toContain("[service-launcher] T3CODE_HOME is required");
67
+ expect(launcher.stderr).not.toMatch(/LOADED_CLI_MAIN|CACHE=/);
68
+ const launcherHelp = yield* run({ T3CODE_HOME: "" }, ["__service-launcher", "--help"]);
69
+ expect(launcherHelp.exitCode).toBe(0);
70
+ expect(launcherHelp.stderr).toContain("LOADED_CLI_MAIN");
71
+ expect(launcherHelp.stdout).toContain("t3 __service-launcher [flags]");
72
+ const launcherFlags = yield* run({ T3CODE_HOME: "" }, [
73
+ "__service-launcher",
74
+ "--log-level",
75
+ "debug",
76
+ ]);
77
+ expect(launcherFlags.exitCode).toBe(1);
78
+ expect(launcherFlags.stderr).toContain("LOADED_CLI_MAIN");
79
+ expect(launcherFlags.stderr).toContain("[service-launcher] T3CODE_HOME is required");
80
const appImage = yield* run({ APPIMAGE: `${root}/T3Code.AppImage` });
81
expect(appImage.exitCode).toBe(0);
82
expect(appImage.stderr).toContain("CACHE=disabled");
apps/server/vite.config.ts
+23
-8
@@ -1,4 +1,6 @@
1
import "vite-plus/test/config";
2
+// @effect-diagnostics-next-line nodeBuiltinImport:off -- tsdown needs the asset path when it reads this config.
3
+import * as NodePath from "node:path";
4
import { defineConfig, mergeConfig } from "vite-plus";
5
6
import baseConfig from "../../vite.config.ts";
@@ -29,10 +31,14 @@ if (!TELEMETRY_CHANNELS.includes(telemetryChannel)) {
31
}
32
33
// tsdown SEA needs one chunk (sourcemaps count) and Node >=25.7, so package separately.
34
+// "bundle" emits the embedded CLI. "1" builds dist-exe/t3 from the bootstrap.
35
// TEMPORARY one-time Node fix. Remove when fixed: https://github.com/nodejs/node/issues/67048
33
-// "1" builds dist-exe/t3 here; "bundle" stops at bin.mjs for scripts/cli.ts to inject (linux-arm64).
36
+// "bootstrap" stops at bin.mjs for scripts/cli.ts to inject (linux-arm64).
37
const packMode = process.env.T3CODE_PACK_EXE;
35
-const packExecutable = packMode === "1" || packMode === "bundle";
38
+const packBootstrap = packMode === "1" || packMode === "bootstrap";
39
+const packExecutable = packBootstrap || packMode === "bundle";
40
+const cliAssetDir = process.env.T3CODE_CLI_ASSET_DIR ?? "";
41
+if (packExecutable && !cliAssetDir) throw new Error("Build the executable with build:exe.");
42
// TEMPORARY one-time Node fix. Remove when fixed: https://github.com/nodejs/node/issues/67048
43
// No linux-arm64: --build-sea output cannot load on 16/64 KiB page kernels, so it builds natively.
44
const SEA_TARGETS = {
@@ -83,12 +89,15 @@ export default mergeConfig(
89
},
90
pack: {
91
// SEA embeds one entry; expose the history worker as a hidden subcommand.
86
- entry: packExecutable ? ["src/bin.ts"] : ["src/bin.ts", "src/claude-history-worker.ts"],
87
- outDir: packExecutable ? "dist-exe" : "dist",
92
+ entry: packBootstrap
93
+ ? ["src/bin.ts"]
94
+ : packExecutable
95
+ ? ["src/binMain.ts"]
96
+ : ["src/bin.ts", "src/claude-history-worker.ts"],
97
+ outDir: packBootstrap ? "dist-exe" : packExecutable ? cliAssetDir : "dist",
98
sourcemap: !packExecutable,
99
clean: true,
90
- // TEMPORARY one-time Node fix. Remove when fixed: https://github.com/nodejs/node/issues/67048
91
- // SEA can only resolve built-ins; keep dynamic imports inside its one module.
100
+ // SEA can only resolve built-ins; keep dynamic imports inside each emitted module.
101
...(packExecutable ? { outputOptions: { codeSplitting: false } } : {}),
102
...(packMode === "1"
103
? {
@@ -97,14 +106,20 @@ export default mergeConfig(
106
outDir: "dist-exe",
107
...(packExecutableTargets ? { targets: packExecutableTargets } : {}),
108
// Node SEA useCodeCache breaks import(), which the server needs.
100
- seaConfig: { useCodeCache: false },
109
+ seaConfig: {
110
+ useCodeCache: false,
111
+ // The bootstrap loads the embedded CLI with require(esm).
112
+ execArgv: ["--require-module"],
113
+ assets: { "binMain.mjs": NodePath.join(cliAssetDir, "binMain.mjs") },
114
+ },
115
},
116
}
117
: {}),
118
deps: {
119
// alwaysBundle=false has no opinion; neverBundle must retain transitive native acceleration.
120
alwaysBundle: shouldBundleCliDependency,
107
- neverBundle: (id: string) => isExternalCliDependency(id),
121
+ neverBundle: (id: string) =>
122
+ (packBootstrap && id === "./binMain.ts") || isExternalCliDependency(id),
123
onlyBundle: false,
124
},
125
banner: {
scripts/lib/linux-arm64-sea.ts
+4
@@ -32,6 +32,7 @@ const run = Effect.fn("LinuxArm64Sea.run")(function* (args: Array<string>, verbo
32
// Builds the SEA blob with this Node and injects it into a copy of this Node with postject.
33
export const injectLinuxArm64Sea = Effect.fn("LinuxArm64Sea.inject")(function* (input: {
34
bundlePath: string;
35
+ cliAssetPath: string;
36
outputPath: string;
37
nodeVersion: string;
38
verbose: boolean;
@@ -51,11 +52,14 @@ export const injectLinuxArm64Sea = Effect.fn("LinuxArm64Sea.inject")(function* (
52
configPath,
53
yield* encodeJson({
54
main: input.bundlePath,
55
+ assets: { "binMain.mjs": input.cliAssetPath },
56
output: blobPath,
57
mainFormat: "module",
58
disableExperimentalSEAWarning: true,
59
// Node SEA useCodeCache breaks import(), which the server needs.
60
useCodeCache: false,
61
+ // The bootstrap loads the embedded CLI with require(esm).
62
+ execArgv: ["--require-module"],
63
}),
64
);
65
yield* run(["--experimental-sea-config", configPath], input.verbose);
scripts/smoke-cli-archive.ts
+12
-1
@@ -135,6 +135,15 @@ const smokeCliArchive = Effect.fn("smokeCliArchive")(function* (input: {
135
});
136
}
137
138
+ // The service launcher loads outside the embedded CLI; without T3CODE_HOME it exits right away.
139
+ const launcher = yield* runExecutable(executable, ["__service-launcher"], contentDir);
140
+ if (launcher.exitCode !== 1 || !launcher.stderr.includes("T3CODE_HOME is required")) {
141
+ return yield* new CliArchiveSmokeError({
142
+ step: "running __service-launcher",
143
+ detail: `exit ${String(launcher.exitCode)}\n${launcher.stdout}${launcher.stderr}`,
144
+ });
145
+ }
146
+
147
const net = yield* NetService.NetService;
148
const port = yield* net.findAvailablePort(47700);
149
const home = path.join(scratch, "home");
@@ -191,7 +200,9 @@ const smokeCliArchive = Effect.fn("smokeCliArchive")(function* (input: {
200
detail: `no 200 from / within 30s\n${stdout}${stderr}`,
201
});
202
}
194
- yield* Effect.log(`[cli-smoke] ${root}: --version passed and serve answered on ${String(port)}.`);
203
+ yield* Effect.log(
204
+ `[cli-smoke] ${root}: --version and __service-launcher passed, and serve answered on ${String(port)}.`,
205
+ );
206
});
207
208
const command = Command.make(