appostle-installer 0.0.86 → 0.0.88

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.
@@ -0,0 +1,485 @@
1
+ import { createRequire as __ac_createRequire } from "node:module";
2
+ const require = __ac_createRequire(import.meta.url);
3
+
4
+ // ../server/scripts/supervisor-entrypoint.ts
5
+ import { fileURLToPath } from "url";
6
+ import { existsSync as existsSync2 } from "node:fs";
7
+ import path3 from "node:path";
8
+
9
+ // ../server/src/server/pid-lock.ts
10
+ import { open, readFile, unlink, mkdir } from "node:fs/promises";
11
+ import { existsSync } from "node:fs";
12
+ import { join } from "node:path";
13
+ import { hostname } from "node:os";
14
+ var PidLockError = class extends Error {
15
+ constructor(message, existingLock) {
16
+ super(message);
17
+ this.existingLock = existingLock;
18
+ this.name = "PidLockError";
19
+ }
20
+ };
21
+ function isPidRunning(pid) {
22
+ try {
23
+ process.kill(pid, 0);
24
+ return true;
25
+ } catch {
26
+ return false;
27
+ }
28
+ }
29
+ function getPidFilePath(appostleHome) {
30
+ return join(appostleHome, "appostle.pid");
31
+ }
32
+ function resolveOwnerPid(ownerPid) {
33
+ if (typeof ownerPid === "number" && Number.isInteger(ownerPid) && ownerPid > 0) {
34
+ return ownerPid;
35
+ }
36
+ return process.pid;
37
+ }
38
+ async function acquirePidLock(appostleHome, listen, options) {
39
+ const pidPath = getPidFilePath(appostleHome);
40
+ if (!existsSync(appostleHome)) {
41
+ await mkdir(appostleHome, { recursive: true });
42
+ }
43
+ let existingLock = null;
44
+ try {
45
+ const content = await readFile(pidPath, "utf-8");
46
+ existingLock = JSON.parse(content);
47
+ } catch {
48
+ }
49
+ const lockOwnerPid = resolveOwnerPid(options?.ownerPid);
50
+ if (existingLock) {
51
+ if (isPidRunning(existingLock.pid)) {
52
+ if (existingLock.pid === lockOwnerPid) {
53
+ return;
54
+ }
55
+ throw new PidLockError(
56
+ `Another Appostle daemon is already running (PID ${existingLock.pid}, started ${existingLock.startedAt})`,
57
+ existingLock
58
+ );
59
+ }
60
+ await unlink(pidPath).catch(() => {
61
+ });
62
+ }
63
+ const lockInfo = {
64
+ pid: lockOwnerPid,
65
+ startedAt: (/* @__PURE__ */ new Date()).toISOString(),
66
+ hostname: hostname(),
67
+ uid: process.getuid?.() ?? 0,
68
+ listen,
69
+ ...process.env.APPOSTLE_DESKTOP_MANAGED === "1" ? { desktopManaged: true } : {}
70
+ };
71
+ let fd;
72
+ try {
73
+ fd = await open(pidPath, "wx");
74
+ await fd.write(JSON.stringify(lockInfo));
75
+ } catch (err) {
76
+ if (err.code === "EEXIST") {
77
+ try {
78
+ const content = await readFile(pidPath, "utf-8");
79
+ const raceLock = JSON.parse(content);
80
+ throw new PidLockError(
81
+ `Another Appostle daemon is already running (PID ${raceLock.pid})`,
82
+ raceLock
83
+ );
84
+ } catch (innerErr) {
85
+ if (innerErr instanceof PidLockError) throw innerErr;
86
+ throw new PidLockError("Failed to acquire PID lock due to race condition");
87
+ }
88
+ }
89
+ throw err;
90
+ } finally {
91
+ await fd?.close();
92
+ }
93
+ }
94
+ async function updatePidLock(appostleHome, patch, options) {
95
+ const pidPath = getPidFilePath(appostleHome);
96
+ const lockOwnerPid = resolveOwnerPid(options?.ownerPid);
97
+ const content = await readFile(pidPath, "utf-8");
98
+ const existingLock = JSON.parse(content);
99
+ if (existingLock.pid !== lockOwnerPid) {
100
+ throw new PidLockError(`Cannot update PID lock owned by PID ${existingLock.pid}`, existingLock);
101
+ }
102
+ const updatedLock = {
103
+ ...existingLock,
104
+ ...patch
105
+ };
106
+ const fd = await open(pidPath, "r+");
107
+ try {
108
+ await fd.truncate(0);
109
+ await fd.writeFile(JSON.stringify(updatedLock));
110
+ } finally {
111
+ await fd.close();
112
+ }
113
+ }
114
+ async function releasePidLock(appostleHome, options) {
115
+ const pidPath = getPidFilePath(appostleHome);
116
+ const lockOwnerPid = resolveOwnerPid(options?.ownerPid);
117
+ try {
118
+ const content = await readFile(pidPath, "utf-8");
119
+ const lock = JSON.parse(content);
120
+ if (lock.pid === lockOwnerPid) {
121
+ await unlink(pidPath);
122
+ }
123
+ } catch {
124
+ }
125
+ }
126
+
127
+ // ../server/src/server/appostle-home.ts
128
+ import os from "node:os";
129
+ import path from "node:path";
130
+ import { mkdirSync } from "node:fs";
131
+ function expandHomeDir(input) {
132
+ if (input.startsWith("~/")) {
133
+ return path.join(os.homedir(), input.slice(2));
134
+ }
135
+ if (input === "~") {
136
+ return os.homedir();
137
+ }
138
+ return input;
139
+ }
140
+ function resolveAppostleHome(env = process.env) {
141
+ const raw = env.APPOSTLE_HOME ?? "~/.appostle";
142
+ const resolved = path.resolve(expandHomeDir(raw));
143
+ mkdirSync(resolved, { recursive: true });
144
+ return resolved;
145
+ }
146
+
147
+ // ../server/scripts/supervisor.ts
148
+ import { fork, spawn } from "child_process";
149
+ function describeExit(code, signal) {
150
+ return signal ?? (typeof code === "number" ? `code ${code}` : "unknown");
151
+ }
152
+ function parseLifecycleMessage(msg) {
153
+ if (typeof msg !== "object" || msg === null || !("type" in msg)) {
154
+ return null;
155
+ }
156
+ const type = msg.type;
157
+ if (type === "appostle:shutdown") {
158
+ return { type: "appostle:shutdown" };
159
+ }
160
+ if (type === "appostle:ready") {
161
+ const listen = msg.listen;
162
+ if (typeof listen !== "string" || listen.trim().length === 0) {
163
+ return null;
164
+ }
165
+ return { type: "appostle:ready", listen };
166
+ }
167
+ if (type === "appostle:restart") {
168
+ const reason = msg.reason;
169
+ return {
170
+ type: "appostle:restart",
171
+ ...typeof reason === "string" && reason.trim().length > 0 ? { reason } : {}
172
+ };
173
+ }
174
+ return null;
175
+ }
176
+ function runSupervisor(options) {
177
+ const restartOnCrash = options.restartOnCrash ?? false;
178
+ const workerArgs = options.workerArgs ?? process.argv.slice(2);
179
+ const workerEnv = options.workerEnv ?? process.env;
180
+ const workerExecArgv = options.workerExecArgv ?? ["--import", "tsx"];
181
+ const resolveWorkerSpawnSpec = options.resolveWorkerSpawnSpec;
182
+ let child = null;
183
+ let restarting = false;
184
+ let shuttingDown = false;
185
+ let exiting = false;
186
+ const log = (message) => {
187
+ process.stderr.write(`[${options.name}] ${message}
188
+ `);
189
+ };
190
+ const exitSupervisor = (code) => {
191
+ if (exiting) {
192
+ return;
193
+ }
194
+ exiting = true;
195
+ Promise.resolve(options.onSupervisorExit?.()).catch((error) => {
196
+ const message = error instanceof Error ? error.message : String(error);
197
+ log(`Supervisor exit cleanup failed: ${message}`);
198
+ }).finally(() => {
199
+ process.exit(code);
200
+ });
201
+ };
202
+ const spawnWorker = () => {
203
+ let workerEntry;
204
+ try {
205
+ workerEntry = options.resolveWorkerEntry();
206
+ } catch (error) {
207
+ const message = error instanceof Error ? error.message : String(error);
208
+ log(`Failed to resolve worker entry: ${message}`);
209
+ exitSupervisor(1);
210
+ return;
211
+ }
212
+ const spawnSpec = resolveWorkerSpawnSpec?.(workerEntry) ?? null;
213
+ if (spawnSpec) {
214
+ child = spawn(spawnSpec.command, spawnSpec.args, {
215
+ stdio: ["inherit", "inherit", "inherit", "ipc"],
216
+ env: spawnSpec.env ?? workerEnv
217
+ });
218
+ } else {
219
+ child = fork(workerEntry, workerArgs, {
220
+ stdio: "inherit",
221
+ env: workerEnv,
222
+ execArgv: workerExecArgv
223
+ });
224
+ }
225
+ child.on("message", (msg) => {
226
+ const lifecycleMessage = parseLifecycleMessage(msg);
227
+ if (!lifecycleMessage) {
228
+ return;
229
+ }
230
+ if (lifecycleMessage.type === "appostle:ready") {
231
+ Promise.resolve(options.onWorkerReady?.({ listen: lifecycleMessage.listen })).catch(
232
+ (error) => {
233
+ const message = error instanceof Error ? error.message : String(error);
234
+ log(`Worker ready callback failed: ${message}`);
235
+ }
236
+ );
237
+ return;
238
+ }
239
+ if (lifecycleMessage.type === "appostle:shutdown") {
240
+ requestShutdown("Shutdown requested by worker");
241
+ return;
242
+ }
243
+ requestRestart("Restart requested by worker");
244
+ });
245
+ child.on("exit", (code, signal) => {
246
+ const exitDescriptor = describeExit(code, signal);
247
+ if (shuttingDown) {
248
+ log(`Worker exited (${exitDescriptor}). Supervisor shutting down.`);
249
+ exitSupervisor(0);
250
+ return;
251
+ }
252
+ const crashed = restartOnCrash && (code !== 0 && code !== null || signal !== null && signal === "SIGKILL");
253
+ if (restarting || crashed) {
254
+ restarting = false;
255
+ log(`Worker exited (${exitDescriptor}). Restarting worker...`);
256
+ spawnWorker();
257
+ return;
258
+ }
259
+ log(`Worker exited (${exitDescriptor}). Supervisor exiting.`);
260
+ exitSupervisor(typeof code === "number" ? code : 0);
261
+ });
262
+ };
263
+ const requestRestart = (reason) => {
264
+ if (!child || restarting || shuttingDown) {
265
+ return;
266
+ }
267
+ restarting = true;
268
+ log(`${reason}. Stopping worker for restart...`);
269
+ child.kill("SIGTERM");
270
+ };
271
+ const requestShutdown = (reason) => {
272
+ if (shuttingDown) {
273
+ return;
274
+ }
275
+ shuttingDown = true;
276
+ restarting = false;
277
+ log(`${reason}. Stopping worker...`);
278
+ if (!child) {
279
+ exitSupervisor(0);
280
+ return;
281
+ }
282
+ child.kill("SIGTERM");
283
+ };
284
+ const forwardSignal = (signal) => {
285
+ requestShutdown(`Received ${signal}`);
286
+ };
287
+ process.on("SIGINT", () => forwardSignal("SIGINT"));
288
+ process.on("SIGTERM", () => forwardSignal("SIGTERM"));
289
+ process.stdout.write(`[${options.name}] ${options.startupMessage}
290
+ `);
291
+ spawnWorker();
292
+ }
293
+
294
+ // ../server/src/server/speech/providers/local/sherpa/sherpa-runtime-env.ts
295
+ import { createRequire } from "node:module";
296
+ import path2 from "node:path";
297
+ function sherpaPlatformArch(platform = process.platform, arch = process.arch) {
298
+ const normalizedPlatform = platform === "win32" ? "win" : platform;
299
+ return `${normalizedPlatform}-${arch}`;
300
+ }
301
+ function sherpaPlatformPackageName(platform = process.platform, arch = process.arch) {
302
+ return `sherpa-onnx-${sherpaPlatformArch(platform, arch)}`;
303
+ }
304
+ function sherpaLoaderEnvKey(platform = process.platform) {
305
+ if (platform === "linux") {
306
+ return "LD_LIBRARY_PATH";
307
+ }
308
+ if (platform === "darwin") {
309
+ return "DYLD_LIBRARY_PATH";
310
+ }
311
+ if (platform === "win32") {
312
+ return "PATH";
313
+ }
314
+ return null;
315
+ }
316
+ function prependEnvPath(existing, value) {
317
+ const parts = (existing ?? "").split(path2.delimiter).filter(Boolean);
318
+ if (parts.includes(value)) {
319
+ return parts.join(path2.delimiter);
320
+ }
321
+ return [value, ...parts].join(path2.delimiter);
322
+ }
323
+ function resolveSherpaLoaderEnv(platform = process.platform, arch = process.arch) {
324
+ const key = sherpaLoaderEnvKey(platform);
325
+ if (!key) {
326
+ return null;
327
+ }
328
+ const packageName = sherpaPlatformPackageName(platform, arch);
329
+ const require2 = createRequire(import.meta.url);
330
+ try {
331
+ const pkgJson = require2.resolve(`${packageName}/package.json`);
332
+ return {
333
+ key,
334
+ libDir: path2.dirname(pkgJson),
335
+ packageName
336
+ };
337
+ } catch {
338
+ return null;
339
+ }
340
+ }
341
+ function findEnvKey(env, key) {
342
+ const lower = key.toLowerCase();
343
+ for (const k of Object.keys(env)) {
344
+ if (k.toLowerCase() === lower) return k;
345
+ }
346
+ return key;
347
+ }
348
+ function applySherpaLoaderEnv(env, platform = process.platform, arch = process.arch) {
349
+ const resolved = resolveSherpaLoaderEnv(platform, arch);
350
+ if (!resolved) {
351
+ return {
352
+ changed: false,
353
+ key: null,
354
+ libDir: null,
355
+ packageName: null
356
+ };
357
+ }
358
+ const actualKey = findEnvKey(env, resolved.key);
359
+ const next = prependEnvPath(env[actualKey], resolved.libDir);
360
+ const changed = next !== (env[actualKey] ?? "");
361
+ env[actualKey] = next;
362
+ return {
363
+ changed,
364
+ key: resolved.key,
365
+ libDir: resolved.libDir,
366
+ packageName: resolved.packageName
367
+ };
368
+ }
369
+
370
+ // ../server/scripts/supervisor-entrypoint.ts
371
+ function parseConfig(argv) {
372
+ let devMode = false;
373
+ const workerArgs = [];
374
+ for (const arg of argv) {
375
+ if (arg === "--dev") {
376
+ devMode = true;
377
+ continue;
378
+ }
379
+ workerArgs.push(arg);
380
+ }
381
+ return { devMode, workerArgs };
382
+ }
383
+ function resolveWorkerEntry() {
384
+ const candidates = [
385
+ // Single-package bundle (appostle-installer): worker ships next to this
386
+ // supervisor-entrypoint as `worker.js`.
387
+ fileURLToPath(new URL("./worker.js", import.meta.url)),
388
+ // Legacy @appostle/server layouts (dev / older multi-package install).
389
+ fileURLToPath(new URL("../server/server/index.js", import.meta.url)),
390
+ fileURLToPath(new URL("../dist/server/server/index.js", import.meta.url)),
391
+ fileURLToPath(new URL("../src/server/index.ts", import.meta.url)),
392
+ fileURLToPath(new URL("../../src/server/index.ts", import.meta.url))
393
+ ];
394
+ for (const candidate of candidates) {
395
+ if (existsSync2(candidate)) {
396
+ return candidate;
397
+ }
398
+ }
399
+ return candidates[0];
400
+ }
401
+ function resolveDevWorkerEntry() {
402
+ const candidate = fileURLToPath(new URL("../src/server/index.ts", import.meta.url));
403
+ if (!existsSync2(candidate)) {
404
+ throw new Error(`Dev worker entry not found: ${candidate}`);
405
+ }
406
+ return candidate;
407
+ }
408
+ function resolveWorkerExecArgv(workerEntry) {
409
+ return workerEntry.endsWith(".ts") ? ["--import", "tsx"] : [];
410
+ }
411
+ function resolvePackagedNodeEntrypointRunnerPath(currentScriptPath) {
412
+ const packageMarker = `${path3.sep}node_modules${path3.sep}@appostle${path3.sep}server${path3.sep}`;
413
+ const markerIndex = currentScriptPath.lastIndexOf(packageMarker);
414
+ if (markerIndex === -1) {
415
+ return null;
416
+ }
417
+ const appRoot = currentScriptPath.slice(0, markerIndex);
418
+ const runnerPath = path3.join(appRoot, "dist", "daemon", "node-entrypoint-runner.js");
419
+ return existsSync2(runnerPath) ? runnerPath : null;
420
+ }
421
+ async function main() {
422
+ const config = parseConfig(process.argv.slice(2));
423
+ const workerEntry = config.devMode ? resolveDevWorkerEntry() : resolveWorkerEntry();
424
+ const workerExecArgv = resolveWorkerExecArgv(workerEntry);
425
+ const workerEnv = { ...process.env, APPOSTLE_SUPERVISED: "1" };
426
+ const packagedNodeEntrypointRunner = process.env.ELECTRON_RUN_AS_NODE === "1" ? resolvePackagedNodeEntrypointRunnerPath(fileURLToPath(import.meta.url)) : null;
427
+ applySherpaLoaderEnv(workerEnv);
428
+ const appostleHome = resolveAppostleHome(workerEnv);
429
+ try {
430
+ await acquirePidLock(appostleHome, null, {
431
+ ownerPid: process.pid
432
+ });
433
+ } catch (error) {
434
+ if (error instanceof PidLockError) {
435
+ process.stderr.write(`${error.message}
436
+ `);
437
+ process.exit(1);
438
+ return;
439
+ }
440
+ throw error;
441
+ }
442
+ let lockReleased = false;
443
+ const releaseLock = async () => {
444
+ if (lockReleased) {
445
+ return;
446
+ }
447
+ lockReleased = true;
448
+ await releasePidLock(appostleHome, {
449
+ ownerPid: process.pid
450
+ });
451
+ };
452
+ runSupervisor({
453
+ name: "DaemonRunner",
454
+ startupMessage: config.devMode ? "Starting daemon worker (dev mode, crash restarts enabled)" : "Starting daemon worker (IPC restart enabled)",
455
+ resolveWorkerEntry: () => workerEntry,
456
+ workerArgs: config.workerArgs,
457
+ workerEnv,
458
+ workerExecArgv,
459
+ resolveWorkerSpawnSpec: packagedNodeEntrypointRunner ? (resolvedWorkerEntry) => ({
460
+ command: process.execPath,
461
+ args: [
462
+ packagedNodeEntrypointRunner,
463
+ "node-script",
464
+ resolvedWorkerEntry,
465
+ ...config.workerArgs
466
+ ],
467
+ env: {
468
+ ...workerEnv,
469
+ ELECTRON_RUN_AS_NODE: "1"
470
+ }
471
+ }) : void 0,
472
+ restartOnCrash: config.devMode,
473
+ onWorkerReady: async ({ listen }) => {
474
+ await updatePidLock(appostleHome, { listen }, { ownerPid: process.pid });
475
+ },
476
+ onSupervisorExit: releaseLock
477
+ });
478
+ }
479
+ void main().catch((error) => {
480
+ const message = error instanceof Error ? error.stack ?? error.message : String(error);
481
+ process.stderr.write(`${message}
482
+ `);
483
+ process.exit(1);
484
+ });
485
+ //# sourceMappingURL=supervisor-entrypoint.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../server/scripts/supervisor-entrypoint.ts", "../../server/src/server/pid-lock.ts", "../../server/src/server/appostle-home.ts", "../../server/scripts/supervisor.ts", "../../server/src/server/speech/providers/local/sherpa/sherpa-runtime-env.ts"],
4
+ "sourcesContent": ["import { fileURLToPath } from \"url\";\nimport { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport {\n acquirePidLock,\n PidLockError,\n releasePidLock,\n updatePidLock,\n} from \"../src/server/pid-lock.js\";\nimport { resolveAppostleHome } from \"../src/server/appostle-home.js\";\nimport { runSupervisor } from \"./supervisor.js\";\nimport { applySherpaLoaderEnv } from \"../src/server/speech/providers/local/sherpa/sherpa-runtime-env.js\";\n\ntype DaemonRunnerConfig = {\n devMode: boolean;\n workerArgs: string[];\n};\n\nfunction parseConfig(argv: string[]): DaemonRunnerConfig {\n let devMode = false;\n const workerArgs: string[] = [];\n\n for (const arg of argv) {\n if (arg === \"--dev\") {\n devMode = true;\n continue;\n }\n workerArgs.push(arg);\n }\n\n return { devMode, workerArgs };\n}\n\nfunction resolveWorkerEntry(): string {\n const candidates = [\n // Single-package bundle (appostle-installer): worker ships next to this\n // supervisor-entrypoint as `worker.js`.\n fileURLToPath(new URL(\"./worker.js\", import.meta.url)),\n // Legacy @appostle/server layouts (dev / older multi-package install).\n fileURLToPath(new URL(\"../server/server/index.js\", import.meta.url)),\n fileURLToPath(new URL(\"../dist/server/server/index.js\", import.meta.url)),\n fileURLToPath(new URL(\"../src/server/index.ts\", import.meta.url)),\n fileURLToPath(new URL(\"../../src/server/index.ts\", import.meta.url)),\n ];\n\n for (const candidate of candidates) {\n if (existsSync(candidate)) {\n return candidate;\n }\n }\n\n return candidates[0];\n}\n\nfunction resolveDevWorkerEntry(): string {\n const candidate = fileURLToPath(new URL(\"../src/server/index.ts\", import.meta.url));\n if (!existsSync(candidate)) {\n throw new Error(`Dev worker entry not found: ${candidate}`);\n }\n return candidate;\n}\n\nfunction resolveWorkerExecArgv(workerEntry: string): string[] {\n return workerEntry.endsWith(\".ts\") ? [\"--import\", \"tsx\"] : [];\n}\n\nfunction resolvePackagedNodeEntrypointRunnerPath(currentScriptPath: string): string | null {\n const packageMarker = `${path.sep}node_modules${path.sep}@appostle${path.sep}server${path.sep}`;\n const markerIndex = currentScriptPath.lastIndexOf(packageMarker);\n if (markerIndex === -1) {\n return null;\n }\n\n const appRoot = currentScriptPath.slice(0, markerIndex);\n const runnerPath = path.join(appRoot, \"dist\", \"daemon\", \"node-entrypoint-runner.js\");\n return existsSync(runnerPath) ? runnerPath : null;\n}\n\nasync function main(): Promise<void> {\n const config = parseConfig(process.argv.slice(2));\n const workerEntry = config.devMode ? resolveDevWorkerEntry() : resolveWorkerEntry();\n const workerExecArgv = resolveWorkerExecArgv(workerEntry);\n const workerEnv: NodeJS.ProcessEnv = { ...process.env, APPOSTLE_SUPERVISED: \"1\" };\n const packagedNodeEntrypointRunner =\n process.env.ELECTRON_RUN_AS_NODE === \"1\"\n ? resolvePackagedNodeEntrypointRunnerPath(fileURLToPath(import.meta.url))\n : null;\n\n applySherpaLoaderEnv(workerEnv);\n\n const appostleHome = resolveAppostleHome(workerEnv);\n\n try {\n await acquirePidLock(appostleHome, null, {\n ownerPid: process.pid,\n });\n } catch (error) {\n if (error instanceof PidLockError) {\n process.stderr.write(`${error.message}\\n`);\n process.exit(1);\n return;\n }\n throw error;\n }\n\n let lockReleased = false;\n const releaseLock = async (): Promise<void> => {\n if (lockReleased) {\n return;\n }\n lockReleased = true;\n await releasePidLock(appostleHome, {\n ownerPid: process.pid,\n });\n };\n\n runSupervisor({\n name: \"DaemonRunner\",\n startupMessage: config.devMode\n ? \"Starting daemon worker (dev mode, crash restarts enabled)\"\n : \"Starting daemon worker (IPC restart enabled)\",\n resolveWorkerEntry: () => workerEntry,\n workerArgs: config.workerArgs,\n workerEnv,\n workerExecArgv,\n resolveWorkerSpawnSpec: packagedNodeEntrypointRunner\n ? (resolvedWorkerEntry) => ({\n command: process.execPath,\n args: [\n packagedNodeEntrypointRunner,\n \"node-script\",\n resolvedWorkerEntry,\n ...config.workerArgs,\n ],\n env: {\n ...workerEnv,\n ELECTRON_RUN_AS_NODE: \"1\",\n },\n })\n : undefined,\n restartOnCrash: config.devMode,\n onWorkerReady: async ({ listen }) => {\n await updatePidLock(appostleHome, { listen }, { ownerPid: process.pid });\n },\n onSupervisorExit: releaseLock,\n });\n}\n\nvoid main().catch((error) => {\n const message = error instanceof Error ? (error.stack ?? error.message) : String(error);\n process.stderr.write(`${message}\\n`);\n process.exit(1);\n});\n", "import { open, readFile, unlink, mkdir } from \"node:fs/promises\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { hostname } from \"node:os\";\n\nexport interface PidLockInfo {\n pid: number;\n startedAt: string;\n hostname: string;\n uid: number;\n listen: string | null;\n desktopManaged?: boolean;\n}\n\nexport class PidLockError extends Error {\n constructor(\n message: string,\n public readonly existingLock?: PidLockInfo,\n ) {\n super(message);\n this.name = \"PidLockError\";\n }\n}\n\nfunction isPidRunning(pid: number): boolean {\n try {\n process.kill(pid, 0);\n return true;\n } catch {\n return false;\n }\n}\n\nfunction getPidFilePath(appostleHome: string): string {\n return join(appostleHome, \"appostle.pid\");\n}\n\nfunction resolveOwnerPid(ownerPid?: number): number {\n if (typeof ownerPid === \"number\" && Number.isInteger(ownerPid) && ownerPid > 0) {\n return ownerPid;\n }\n return process.pid;\n}\n\nexport async function acquirePidLock(\n appostleHome: string,\n listen: string | null,\n options?: { ownerPid?: number },\n): Promise<void> {\n const pidPath = getPidFilePath(appostleHome);\n\n // Ensure appostleHome directory exists\n if (!existsSync(appostleHome)) {\n await mkdir(appostleHome, { recursive: true });\n }\n\n // Try to read existing lock\n let existingLock: PidLockInfo | null = null;\n try {\n const content = await readFile(pidPath, \"utf-8\");\n existingLock = JSON.parse(content) as PidLockInfo;\n } catch {\n // No existing lock or invalid JSON - that's fine\n }\n\n // Check if existing lock is stale\n const lockOwnerPid = resolveOwnerPid(options?.ownerPid);\n if (existingLock) {\n if (isPidRunning(existingLock.pid)) {\n if (existingLock.pid === lockOwnerPid) {\n return;\n }\n\n throw new PidLockError(\n `Another Appostle daemon is already running (PID ${existingLock.pid}, started ${existingLock.startedAt})`,\n existingLock,\n );\n }\n // Stale lock - remove it\n await unlink(pidPath).catch(() => {});\n }\n\n // Create new lock with exclusive flag\n const lockInfo: PidLockInfo = {\n pid: lockOwnerPid,\n startedAt: new Date().toISOString(),\n hostname: hostname(),\n uid: process.getuid?.() ?? 0,\n listen,\n ...(process.env.APPOSTLE_DESKTOP_MANAGED === \"1\" ? { desktopManaged: true } : {}),\n };\n\n let fd;\n try {\n fd = await open(pidPath, \"wx\");\n await fd.write(JSON.stringify(lockInfo));\n } catch (err: any) {\n if (err.code === \"EEXIST\") {\n // Race condition - another process created the file\n // Re-read and check\n try {\n const content = await readFile(pidPath, \"utf-8\");\n const raceLock = JSON.parse(content) as PidLockInfo;\n throw new PidLockError(\n `Another Appostle daemon is already running (PID ${raceLock.pid})`,\n raceLock,\n );\n } catch (innerErr) {\n if (innerErr instanceof PidLockError) throw innerErr;\n throw new PidLockError(\"Failed to acquire PID lock due to race condition\");\n }\n }\n throw err;\n } finally {\n await fd?.close();\n }\n}\n\nexport async function updatePidLock(\n appostleHome: string,\n patch: { listen: string },\n options?: { ownerPid?: number },\n): Promise<void> {\n const pidPath = getPidFilePath(appostleHome);\n const lockOwnerPid = resolveOwnerPid(options?.ownerPid);\n const content = await readFile(pidPath, \"utf-8\");\n const existingLock = JSON.parse(content) as PidLockInfo;\n\n if (existingLock.pid !== lockOwnerPid) {\n throw new PidLockError(`Cannot update PID lock owned by PID ${existingLock.pid}`, existingLock);\n }\n\n const updatedLock: PidLockInfo = {\n ...existingLock,\n ...patch,\n };\n\n const fd = await open(pidPath, \"r+\");\n try {\n await fd.truncate(0);\n await fd.writeFile(JSON.stringify(updatedLock));\n } finally {\n await fd.close();\n }\n}\n\nexport async function releasePidLock(\n appostleHome: string,\n options?: { ownerPid?: number },\n): Promise<void> {\n const pidPath = getPidFilePath(appostleHome);\n const lockOwnerPid = resolveOwnerPid(options?.ownerPid);\n try {\n // Only remove if it's our lock\n const content = await readFile(pidPath, \"utf-8\");\n const lock = JSON.parse(content) as PidLockInfo;\n if (lock.pid === lockOwnerPid) {\n await unlink(pidPath);\n }\n } catch {\n // Ignore errors - lock may already be gone\n }\n}\n\nexport async function getPidLockInfo(appostleHome: string): Promise<PidLockInfo | null> {\n const pidPath = getPidFilePath(appostleHome);\n try {\n const content = await readFile(pidPath, \"utf-8\");\n return JSON.parse(content) as PidLockInfo;\n } catch {\n return null;\n }\n}\n\nexport async function isLocked(\n appostleHome: string,\n): Promise<{ locked: boolean; info?: PidLockInfo }> {\n const info = await getPidLockInfo(appostleHome);\n if (!info) {\n return { locked: false };\n }\n if (!isPidRunning(info.pid)) {\n return { locked: false, info };\n }\n return { locked: true, info };\n}\n", "import os from \"node:os\";\nimport path from \"node:path\";\nimport { mkdirSync } from \"node:fs\";\n\nfunction expandHomeDir(input: string): string {\n if (input.startsWith(\"~/\")) {\n return path.join(os.homedir(), input.slice(2));\n }\n if (input === \"~\") {\n return os.homedir();\n }\n return input;\n}\n\nexport function resolveAppostleHome(env: NodeJS.ProcessEnv = process.env): string {\n const raw = env.APPOSTLE_HOME ?? \"~/.appostle\";\n const resolved = path.resolve(expandHomeDir(raw));\n mkdirSync(resolved, { recursive: true });\n return resolved;\n}\n", "import { fork, spawn, type ChildProcess } from \"child_process\";\n\ntype WorkerLifecycleMessage =\n | {\n type: \"appostle:shutdown\";\n }\n | {\n type: \"appostle:ready\";\n listen: string;\n }\n | {\n type: \"appostle:restart\";\n reason?: string;\n };\n\ntype SupervisorOptions = {\n name: string;\n startupMessage: string;\n resolveWorkerEntry: () => string;\n workerArgs?: string[];\n workerEnv?: NodeJS.ProcessEnv;\n workerExecArgv?: string[];\n resolveWorkerSpawnSpec?: (workerEntry: string) => {\n command: string;\n args: string[];\n env?: NodeJS.ProcessEnv;\n } | null;\n onWorkerReady?: (message: { listen: string }) => Promise<void> | void;\n restartOnCrash?: boolean;\n onSupervisorExit?: () => Promise<void> | void;\n};\n\nfunction describeExit(code: number | null, signal: NodeJS.Signals | null): string {\n return signal ?? (typeof code === \"number\" ? `code ${code}` : \"unknown\");\n}\n\nfunction parseLifecycleMessage(msg: unknown): WorkerLifecycleMessage | null {\n if (typeof msg !== \"object\" || msg === null || !(\"type\" in msg)) {\n return null;\n }\n const type = (msg as { type?: unknown }).type;\n if (type === \"appostle:shutdown\") {\n return { type: \"appostle:shutdown\" };\n }\n if (type === \"appostle:ready\") {\n const listen = (msg as { listen?: unknown }).listen;\n if (typeof listen !== \"string\" || listen.trim().length === 0) {\n return null;\n }\n return { type: \"appostle:ready\", listen };\n }\n if (type === \"appostle:restart\") {\n const reason = (msg as { reason?: unknown }).reason;\n return {\n type: \"appostle:restart\",\n ...(typeof reason === \"string\" && reason.trim().length > 0 ? { reason } : {}),\n };\n }\n return null;\n}\n\nexport function runSupervisor(options: SupervisorOptions): void {\n const restartOnCrash = options.restartOnCrash ?? false;\n const workerArgs = options.workerArgs ?? process.argv.slice(2);\n const workerEnv = options.workerEnv ?? process.env;\n const workerExecArgv = options.workerExecArgv ?? [\"--import\", \"tsx\"];\n const resolveWorkerSpawnSpec = options.resolveWorkerSpawnSpec;\n\n let child: ChildProcess | null = null;\n let restarting = false;\n let shuttingDown = false;\n let exiting = false;\n\n const log = (message: string): void => {\n process.stderr.write(`[${options.name}] ${message}\\n`);\n };\n\n const exitSupervisor = (code: number): void => {\n if (exiting) {\n return;\n }\n exiting = true;\n Promise.resolve(options.onSupervisorExit?.())\n .catch((error) => {\n const message = error instanceof Error ? error.message : String(error);\n log(`Supervisor exit cleanup failed: ${message}`);\n })\n .finally(() => {\n process.exit(code);\n });\n };\n\n const spawnWorker = () => {\n let workerEntry: string;\n try {\n // Resolve at spawn time so restarts pick up current filesystem state.\n workerEntry = options.resolveWorkerEntry();\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n log(`Failed to resolve worker entry: ${message}`);\n exitSupervisor(1);\n return;\n }\n\n const spawnSpec = resolveWorkerSpawnSpec?.(workerEntry) ?? null;\n if (spawnSpec) {\n child = spawn(spawnSpec.command, spawnSpec.args, {\n stdio: [\"inherit\", \"inherit\", \"inherit\", \"ipc\"],\n env: spawnSpec.env ?? workerEnv,\n });\n } else {\n child = fork(workerEntry, workerArgs, {\n stdio: \"inherit\",\n env: workerEnv,\n execArgv: workerExecArgv,\n });\n }\n\n child.on(\"message\", (msg: unknown) => {\n const lifecycleMessage = parseLifecycleMessage(msg);\n if (!lifecycleMessage) {\n return;\n }\n\n if (lifecycleMessage.type === \"appostle:ready\") {\n Promise.resolve(options.onWorkerReady?.({ listen: lifecycleMessage.listen })).catch(\n (error) => {\n const message = error instanceof Error ? error.message : String(error);\n log(`Worker ready callback failed: ${message}`);\n },\n );\n return;\n }\n\n if (lifecycleMessage.type === \"appostle:shutdown\") {\n requestShutdown(\"Shutdown requested by worker\");\n return;\n }\n\n requestRestart(\"Restart requested by worker\");\n });\n\n child.on(\"exit\", (code, signal) => {\n const exitDescriptor = describeExit(code, signal);\n\n if (shuttingDown) {\n log(`Worker exited (${exitDescriptor}). Supervisor shutting down.`);\n exitSupervisor(0);\n return;\n }\n\n const crashed =\n restartOnCrash &&\n ((code !== 0 && code !== null) || (signal !== null && signal === \"SIGKILL\"));\n\n if (restarting || crashed) {\n restarting = false;\n log(`Worker exited (${exitDescriptor}). Restarting worker...`);\n spawnWorker();\n return;\n }\n\n log(`Worker exited (${exitDescriptor}). Supervisor exiting.`);\n exitSupervisor(typeof code === \"number\" ? code : 0);\n });\n };\n\n const requestRestart = (reason: string) => {\n if (!child || restarting || shuttingDown) {\n return;\n }\n restarting = true;\n log(`${reason}. Stopping worker for restart...`);\n child.kill(\"SIGTERM\");\n };\n\n const requestShutdown = (reason: string) => {\n if (shuttingDown) {\n return;\n }\n shuttingDown = true;\n restarting = false;\n log(`${reason}. Stopping worker...`);\n if (!child) {\n exitSupervisor(0);\n return;\n }\n child.kill(\"SIGTERM\");\n };\n\n const forwardSignal = (signal: NodeJS.Signals) => {\n requestShutdown(`Received ${signal}`);\n };\n\n process.on(\"SIGINT\", () => forwardSignal(\"SIGINT\"));\n process.on(\"SIGTERM\", () => forwardSignal(\"SIGTERM\"));\n\n process.stdout.write(`[${options.name}] ${options.startupMessage}\\n`);\n spawnWorker();\n}\n", "import { createRequire } from \"node:module\";\nimport path from \"node:path\";\n\nexport type SherpaLoaderEnvKey = \"LD_LIBRARY_PATH\" | \"DYLD_LIBRARY_PATH\" | \"PATH\";\n\nexport type SherpaLoaderEnvResolution = {\n key: SherpaLoaderEnvKey;\n libDir: string;\n packageName: string;\n};\n\nexport function sherpaPlatformArch(\n platform: NodeJS.Platform = process.platform,\n arch: string = process.arch,\n): string {\n const normalizedPlatform = platform === \"win32\" ? \"win\" : platform;\n return `${normalizedPlatform}-${arch}`;\n}\n\nexport function sherpaPlatformPackageName(\n platform: NodeJS.Platform = process.platform,\n arch: string = process.arch,\n): string {\n return `sherpa-onnx-${sherpaPlatformArch(platform, arch)}`;\n}\n\nexport function sherpaLoaderEnvKey(\n platform: NodeJS.Platform = process.platform,\n): SherpaLoaderEnvKey | null {\n if (platform === \"linux\") {\n return \"LD_LIBRARY_PATH\";\n }\n if (platform === \"darwin\") {\n return \"DYLD_LIBRARY_PATH\";\n }\n if (platform === \"win32\") {\n return \"PATH\";\n }\n return null;\n}\n\nexport function prependEnvPath(existing: string | undefined, value: string): string {\n const parts = (existing ?? \"\").split(path.delimiter).filter(Boolean);\n if (parts.includes(value)) {\n return parts.join(path.delimiter);\n }\n return [value, ...parts].join(path.delimiter);\n}\n\nexport function resolveSherpaLoaderEnv(\n platform: NodeJS.Platform = process.platform,\n arch: string = process.arch,\n): SherpaLoaderEnvResolution | null {\n const key = sherpaLoaderEnvKey(platform);\n if (!key) {\n return null;\n }\n\n const packageName = sherpaPlatformPackageName(platform, arch);\n const require = createRequire(import.meta.url);\n try {\n const pkgJson = require.resolve(`${packageName}/package.json`);\n return {\n key,\n libDir: path.dirname(pkgJson),\n packageName,\n };\n } catch {\n return null;\n }\n}\n\n/**\n * Find the actual case-sensitive key in a plain object that matches the given\n * key case-insensitively. On Windows, `{...process.env}` produces a plain\n * (case-sensitive) object where PATH is typically stored as `Path`. Using a\n * hardcoded `\"PATH\"` would miss the existing key and create a duplicate,\n * breaking the child process's PATH.\n */\nfunction findEnvKey(env: NodeJS.ProcessEnv, key: string): string {\n const lower = key.toLowerCase();\n for (const k of Object.keys(env)) {\n if (k.toLowerCase() === lower) return k;\n }\n return key;\n}\n\nexport function applySherpaLoaderEnv(\n env: NodeJS.ProcessEnv,\n platform: NodeJS.Platform = process.platform,\n arch: string = process.arch,\n): {\n changed: boolean;\n key: SherpaLoaderEnvKey | null;\n libDir: string | null;\n packageName: string | null;\n} {\n const resolved = resolveSherpaLoaderEnv(platform, arch);\n if (!resolved) {\n return {\n changed: false,\n key: null,\n libDir: null,\n packageName: null,\n };\n }\n\n const actualKey = findEnvKey(env, resolved.key);\n const next = prependEnvPath(env[actualKey], resolved.libDir);\n const changed = next !== (env[actualKey] ?? \"\");\n env[actualKey] = next;\n return {\n changed,\n key: resolved.key,\n libDir: resolved.libDir,\n packageName: resolved.packageName,\n };\n}\n"],
5
+ "mappings": ";;;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,cAAAA,mBAAkB;AAC3B,OAAOC,WAAU;;;ACFjB,SAAS,MAAM,UAAU,QAAQ,aAAa;AAC9C,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AACrB,SAAS,gBAAgB;AAWlB,IAAM,eAAN,cAA2B,MAAM;AAAA,EACtC,YACE,SACgB,cAChB;AACA,UAAM,OAAO;AAFG;AAGhB,SAAK,OAAO;AAAA,EACd;AACF;AAEA,SAAS,aAAa,KAAsB;AAC1C,MAAI;AACF,YAAQ,KAAK,KAAK,CAAC;AACnB,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EAC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AAC,UAAU;AAC3B,QAAM,UAAU,iBAAiB,QAAS,MAAM,SAAS,MAAM,UAAW,OAAO,KAAK;AACtF,UAAQ,OAAO,MAAM,GAAG,OAAO;AAAA,CAAI;AACnC,UAAQ,KAAK,CAAC;AAChB,CAAC;",
6
+ "names": ["existsSync", "path", "path", "require", "existsSync", "path"]
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appostle-installer",
3
- "version": "0.0.86",
3
+ "version": "0.0.88",
4
4
  "engines": {
5
5
  "node": ">=20.12"
6
6
  },