@mean-weasel/lineage 0.1.12 → 0.1.13

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,430 @@
1
+ #!/usr/bin/env node
2
+
3
+ // scripts/managed-service.mjs
4
+ import { randomUUID, createHash } from "node:crypto";
5
+ import { spawn, spawnSync } from "node:child_process";
6
+ import {
7
+ closeSync,
8
+ existsSync,
9
+ mkdirSync,
10
+ openSync,
11
+ readFileSync,
12
+ readdirSync,
13
+ readlinkSync,
14
+ realpathSync,
15
+ renameSync,
16
+ rmSync,
17
+ writeFileSync
18
+ } from "node:fs";
19
+ import { homedir, platform } from "node:os";
20
+ import { basename, dirname, join, resolve } from "node:path";
21
+ import { fileURLToPath } from "node:url";
22
+ var scriptDirectory = dirname(fileURLToPath(import.meta.url));
23
+ var root = [resolve(scriptDirectory, "../.."), resolve(scriptDirectory, "..")].find((candidate) => {
24
+ try {
25
+ const packageInfo = JSON.parse(readFileSync(join(candidate, "package.json"), "utf8"));
26
+ return packageInfo.name === "@mean-weasel/lineage";
27
+ } catch {
28
+ return false;
29
+ }
30
+ });
31
+ if (!root) throw new Error("Unable to locate the Lineage package root for managed service control");
32
+ var receiptSchema = "lineage.managed_service.v1";
33
+ function packageTreeSha256(packageRoot) {
34
+ const hash = createHash("sha256");
35
+ const visit = (directory, relativeDirectory = "") => {
36
+ for (const entry of readdirSync(directory, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
37
+ const relativePath = relativeDirectory ? join(relativeDirectory, entry.name) : entry.name;
38
+ const path = join(directory, entry.name);
39
+ hash.update(relativePath.replaceAll("\\", "/"));
40
+ hash.update("\0");
41
+ if (entry.isDirectory()) {
42
+ hash.update("directory\0");
43
+ visit(path, relativePath);
44
+ } else if (entry.isSymbolicLink()) {
45
+ hash.update("symlink\0");
46
+ hash.update(readlinkSync(path));
47
+ } else if (entry.isFile()) {
48
+ hash.update("file\0");
49
+ hash.update(readFileSync(path));
50
+ } else {
51
+ hash.update("other\0");
52
+ }
53
+ hash.update("\0");
54
+ }
55
+ };
56
+ visit(packageRoot);
57
+ return hash.digest("hex");
58
+ }
59
+ function assertServiceManagerOrigin(channel) {
60
+ const checkoutController = resolve(scriptDirectory) === resolve(root, "scripts");
61
+ if (channel === "dev") {
62
+ if (!checkoutController) throw new Error("Dev service control is checkout-only; run node scripts/managed-service.mjs from the intended worktree");
63
+ return;
64
+ }
65
+ if (checkoutController) throw new Error(`${channel} service control requires the matching attested packaged manager`);
66
+ const receiptPath = process.env.LINEAGE_RUNTIME_RECEIPT;
67
+ if (!receiptPath || !existsSync(receiptPath)) throw new Error(`${channel} service manager is missing its runtime install receipt`);
68
+ const receipt = JSON.parse(readFileSync(receiptPath, "utf8"));
69
+ if (receipt.channel !== channel || process.env.LINEAGE_RELEASE_CHANNEL !== channel) {
70
+ throw new Error(`${channel} service manager receipt channel does not match the requested channel`);
71
+ }
72
+ if (!receipt.package_root || realpathSync(receipt.package_root) !== realpathSync(root)) {
73
+ throw new Error(`${channel} service manager receipt package root ${receipt.package_root || "(missing)"} does not match controller root ${root}`);
74
+ }
75
+ if (packageTreeSha256(root) !== receipt.package_tree_sha256) throw new Error(`${channel} service manager package tree does not match its install receipt`);
76
+ }
77
+ function readOption(args, name) {
78
+ const inline = args.find((arg) => arg.startsWith(`${name}=`));
79
+ if (inline) return inline.slice(name.length + 1);
80
+ const index = args.indexOf(name);
81
+ return index >= 0 ? args[index + 1] : void 0;
82
+ }
83
+ function serviceRoot() {
84
+ if (process.env.LINEAGE_SERVICE_ROOT) return resolve(process.env.LINEAGE_SERVICE_ROOT);
85
+ if (platform() === "darwin") return join(homedir(), "Library", "Application Support", "Lineage", "services");
86
+ if (platform() === "win32") return join(process.env.LOCALAPPDATA || join(homedir(), "AppData", "Local"), "Lineage", "services");
87
+ return join(process.env.XDG_STATE_HOME || join(homedir(), ".local", "state"), "lineage", "services");
88
+ }
89
+ function defaultLauncher(channel) {
90
+ if (channel === "dev") return [process.execPath, "--import", "tsx", join(root, "src", "cli", "lineage-dev.ts")];
91
+ const runtimeRoot = process.env.LINEAGE_RUNTIME_ROOT || (platform() === "darwin" ? join(homedir(), "Library", "Application Support", "Lineage", "runtimes") : join(homedir(), ".local", "share", "lineage", "runtimes"));
92
+ const envName = channel === "stable" ? "LINEAGE_STABLE_BIN" : "LINEAGE_PREVIEW_BIN";
93
+ return [process.env[envName] || join(runtimeRoot, "bin", channel === "stable" ? "lineage-stable" : "lineage-preview")];
94
+ }
95
+ function launcherFor(channel, args) {
96
+ const explicit = readOption(args, "--launcher");
97
+ return explicit ? [resolve(explicit)] : defaultLauncher(channel);
98
+ }
99
+ function invoke(launcher, args, options = {}) {
100
+ return spawnSync(launcher[0], [...launcher.slice(1), ...args], {
101
+ cwd: root,
102
+ encoding: "utf8",
103
+ ...options
104
+ });
105
+ }
106
+ function profileDoctor(launcher, selector) {
107
+ const result = invoke(launcher, ["profile", "doctor", "--profile", selector, "--json"]);
108
+ let doctor;
109
+ try {
110
+ doctor = JSON.parse(result.stdout || "{}");
111
+ } catch {
112
+ throw new Error(`Profile doctor did not return JSON: ${(result.stderr || result.stdout).trim()}`);
113
+ }
114
+ if (!doctor.profile) throw new Error(`Profile doctor could not resolve ${selector}: ${(result.stderr || JSON.stringify(doctor)).trim()}`);
115
+ return { doctor, status: result.status ?? 1 };
116
+ }
117
+ function runtimeDoctor(launcher) {
118
+ const result = invoke(launcher, ["runtime", "doctor", "--json"]);
119
+ let runtime;
120
+ try {
121
+ runtime = JSON.parse(result.stdout || "{}");
122
+ } catch {
123
+ throw new Error(`Runtime doctor did not return JSON: ${(result.stderr || result.stdout).trim()}`);
124
+ }
125
+ if (result.status !== 0 || !runtime.verified) throw new Error(`Runtime doctor failed: ${(result.stderr || JSON.stringify(runtime)).trim()}`);
126
+ return runtime;
127
+ }
128
+ function statePaths(channel, profile) {
129
+ const digest = createHash("sha256").update(profile.manifest_path).digest("hex").slice(0, 12);
130
+ const key = `${channel}--${profile.profile_id}--${digest}`;
131
+ const directory = join(serviceRoot(), key);
132
+ return {
133
+ directory,
134
+ lock: `${directory}.manager.lock`,
135
+ log: join(directory, "service.log"),
136
+ receipt: join(directory, "service.json")
137
+ };
138
+ }
139
+ function processAlive(pid) {
140
+ try {
141
+ process.kill(pid, 0);
142
+ return true;
143
+ } catch (error) {
144
+ return error?.code !== "ESRCH";
145
+ }
146
+ }
147
+ function processStartToken(pid) {
148
+ if (platform() === "win32") return void 0;
149
+ const result = spawnSync("ps", ["-p", String(pid), "-o", "lstart="], { encoding: "utf8" });
150
+ return result.status === 0 ? result.stdout.trim() || void 0 : void 0;
151
+ }
152
+ function processCommand(pid) {
153
+ if (platform() === "win32") return void 0;
154
+ const result = spawnSync("ps", ["-p", String(pid), "-o", "command="], { encoding: "utf8" });
155
+ return result.status === 0 ? result.stdout.trim() || void 0 : void 0;
156
+ }
157
+ function acquireManagerLock(path) {
158
+ mkdirSync(dirname(path), { recursive: true, mode: 448 });
159
+ for (let attempt = 0; attempt < 3; attempt += 1) {
160
+ try {
161
+ mkdirSync(path, { mode: 448 });
162
+ writeFileSync(join(path, "owner.json"), `${JSON.stringify({ acquired_at: (/* @__PURE__ */ new Date()).toISOString(), pid: process.pid })}
163
+ `, { mode: 384 });
164
+ return () => rmSync(path, { force: true, recursive: true });
165
+ } catch (error) {
166
+ if (error?.code !== "EEXIST") throw error;
167
+ try {
168
+ const owner = JSON.parse(readFileSync(join(path, "owner.json"), "utf8"));
169
+ if (Number.isSafeInteger(owner.pid) && processAlive(owner.pid)) {
170
+ throw new Error(`Another service manager operation is active (pid ${owner.pid})`, { cause: error });
171
+ }
172
+ } catch (ownerError) {
173
+ if (ownerError instanceof Error && ownerError.message.startsWith("Another service manager")) throw ownerError;
174
+ }
175
+ rmSync(path, { force: true, recursive: true });
176
+ }
177
+ }
178
+ throw new Error(`Could not acquire service manager lock ${path}`);
179
+ }
180
+ function readReceipt(path) {
181
+ if (!existsSync(path)) return void 0;
182
+ const receipt = JSON.parse(readFileSync(path, "utf8"));
183
+ if (receipt.schema_version !== receiptSchema || !Number.isSafeInteger(receipt.pid) || typeof receipt.instance_id !== "string" || typeof receipt.profile_fingerprint !== "string" || !Array.isArray(receipt.launcher)) throw new Error(`Managed service receipt is invalid: ${path}`);
184
+ return receipt;
185
+ }
186
+ function writeReceipt(path, receipt) {
187
+ mkdirSync(dirname(path), { recursive: true, mode: 448 });
188
+ const temporary = `${path}.tmp-${process.pid}-${randomUUID()}`;
189
+ writeFileSync(temporary, `${JSON.stringify(receipt, null, 2)}
190
+ `, { encoding: "utf8", flag: "wx", mode: 384 });
191
+ renameSync(temporary, path);
192
+ }
193
+ function managedServiceIdentityErrors(runtime, receipt) {
194
+ const errors = [];
195
+ if (runtime.channel !== receipt.channel) errors.push(`channel ${runtime.channel} != ${receipt.channel}`);
196
+ if (!runtime.code?.verified) errors.push("code identity is not verified");
197
+ if (runtime.code?.fingerprint !== receipt.code_fingerprint) errors.push(`code fingerprint ${runtime.code?.fingerprint || "missing"} != ${receipt.code_fingerprint}`);
198
+ if (runtime.profile?.id !== receipt.profile_id) errors.push(`profile ${runtime.profile?.id || "missing"} != ${receipt.profile_id}`);
199
+ if (runtime.profile?.environment !== receipt.environment) errors.push(`environment ${runtime.profile?.environment || "missing"} != ${receipt.environment}`);
200
+ if (runtime.profile?.fingerprint !== receipt.profile_fingerprint) errors.push(`profile fingerprint ${runtime.profile?.fingerprint || "missing"} != ${receipt.profile_fingerprint}`);
201
+ if (runtime.schema?.profile_id !== receipt.profile_id) errors.push(`database profile ${runtime.schema?.profile_id || "missing"} != ${receipt.profile_id}`);
202
+ if (runtime.schema?.profile_fingerprint !== receipt.profile_fingerprint) errors.push(`database fingerprint ${runtime.schema?.profile_fingerprint || "missing"} != ${receipt.profile_fingerprint}`);
203
+ if (resolve(runtime.database?.path || "") !== resolve(receipt.database_path)) errors.push(`database ${runtime.database?.path || "missing"} != ${receipt.database_path}`);
204
+ if (runtime.service?.instance_id !== receipt.instance_id) errors.push(`instance ${runtime.service?.instance_id || "missing"} != ${receipt.instance_id}`);
205
+ if (runtime.service?.launcher_pid !== receipt.pid) errors.push(`launcher pid ${runtime.service?.launcher_pid || "missing"} != ${receipt.pid}`);
206
+ return errors;
207
+ }
208
+ function desiredReceiptErrors(channel, doctor, receipt) {
209
+ const errors = [];
210
+ if (receipt.channel !== channel) errors.push(`receipt channel ${receipt.channel} != ${channel}`);
211
+ if (receipt.code_fingerprint !== doctor.runtime?.code_fingerprint) errors.push(`receipt code fingerprint ${receipt.code_fingerprint} != current ${doctor.runtime?.code_fingerprint || "missing"}`);
212
+ if (receipt.code_origin !== doctor.runtime?.code_origin) errors.push(`receipt code origin ${receipt.code_origin} != current ${doctor.runtime?.code_origin || "missing"}`);
213
+ if (receipt.profile_id !== doctor.profile.profile_id) errors.push(`receipt profile ${receipt.profile_id} != ${doctor.profile.profile_id}`);
214
+ if (receipt.environment !== doctor.profile.environment) errors.push(`receipt environment ${receipt.environment} != ${doctor.profile.environment}`);
215
+ if (receipt.profile_fingerprint !== doctor.profile.profile_fingerprint) errors.push(`receipt profile fingerprint ${receipt.profile_fingerprint} != current ${doctor.profile.profile_fingerprint}`);
216
+ if (resolve(receipt.database_path) !== resolve(doctor.profile.database_path)) errors.push("receipt database path does not match current profile");
217
+ if (receipt.service_origin !== doctor.profile.service_origin) errors.push("receipt service origin does not match current profile");
218
+ if (receipt.manifest_path !== doctor.profile.manifest_path) errors.push("receipt manifest path does not match current profile");
219
+ return errors;
220
+ }
221
+ async function fetchRuntime(origin) {
222
+ const response = await fetch(`${origin}/api/runtime`, { signal: AbortSignal.timeout(1e3) });
223
+ if (!response.ok) throw new Error(`HTTP ${response.status}`);
224
+ const body = await response.json();
225
+ if (!body?.runtime) throw new Error("Runtime response is missing runtime identity");
226
+ return body.runtime;
227
+ }
228
+ async function inspectHealth(receipt) {
229
+ const errors = [];
230
+ if (!processAlive(receipt.pid)) errors.push(`launcher pid ${receipt.pid} is not alive`);
231
+ if (receipt.process_start && processStartToken(receipt.pid) !== receipt.process_start) errors.push(`launcher pid ${receipt.pid} was reused`);
232
+ let runtime;
233
+ try {
234
+ runtime = await fetchRuntime(receipt.service_origin);
235
+ errors.push(...managedServiceIdentityErrors(runtime, receipt));
236
+ } catch (error) {
237
+ errors.push(`runtime health failed: ${error instanceof Error ? error.message : String(error)}`);
238
+ }
239
+ return { errors, healthy: errors.length === 0, runtime };
240
+ }
241
+ async function waitForHealthy(receipt, timeoutMs = 2e4) {
242
+ const deadline = Date.now() + timeoutMs;
243
+ let health = { errors: ["service did not respond"], healthy: false };
244
+ while (Date.now() < deadline && processAlive(receipt.pid)) {
245
+ health = await inspectHealth(receipt);
246
+ if (health.healthy) return health;
247
+ await new Promise((resolveDelay) => setTimeout(resolveDelay, 250));
248
+ }
249
+ throw new Error(`Service failed readiness: ${health.errors.join("; ")}`);
250
+ }
251
+ function openBrowser(origin) {
252
+ const command = platform() === "darwin" ? "open" : platform() === "win32" ? "cmd" : "xdg-open";
253
+ const args = platform() === "win32" ? ["/c", "start", "", origin] : [origin];
254
+ const child = spawn(command, args, { detached: true, stdio: "ignore" });
255
+ child.unref();
256
+ }
257
+ function terminate(receipt, force = false) {
258
+ if (!processAlive(receipt.pid)) return;
259
+ const currentStart = processStartToken(receipt.pid);
260
+ const command = processCommand(receipt.pid);
261
+ const processMatches = receipt.process_start ? currentStart === receipt.process_start : Boolean(command?.includes("start") && command.includes(receipt.manifest_path));
262
+ if (!processMatches && !force) {
263
+ throw new Error(`Refusing to signal pid ${receipt.pid}: process identity no longer matches the service receipt; inspect manually or pass --force`);
264
+ }
265
+ const signalTarget = platform() === "win32" ? receipt.pid : -receipt.pid;
266
+ try {
267
+ process.kill(signalTarget, "SIGTERM");
268
+ } catch (error) {
269
+ if (error?.code !== "ESRCH") throw error;
270
+ }
271
+ }
272
+ async function startManaged(channel, selector, launcher, args) {
273
+ const { doctor, status } = profileDoctor(launcher, selector);
274
+ const runtimeIdentity = runtimeDoctor(launcher);
275
+ if (status !== 0 || !doctor.ok || !doctor.runtime?.code_verified) {
276
+ const failures = (doctor.checks || []).filter((check) => check.status === "fail").map((check) => `${check.id}: ${check.message}`);
277
+ throw new Error(`Profile doctor must pass before service start: ${failures.join("; ") || "unverified runtime"}`);
278
+ }
279
+ if (runtimeIdentity.fingerprint !== doctor.runtime.code_fingerprint || runtimeIdentity.channel !== channel) {
280
+ throw new Error("Runtime doctor identity changed while resolving the service profile");
281
+ }
282
+ const paths = statePaths(channel, doctor.profile);
283
+ const release = acquireManagerLock(paths.lock);
284
+ try {
285
+ const existing = readReceipt(paths.receipt);
286
+ if (existing) {
287
+ const health = await inspectHealth(existing);
288
+ const desiredErrors = desiredReceiptErrors(channel, doctor, existing);
289
+ if (health.healthy && desiredErrors.length === 0) throw new Error(`Managed service is already healthy at ${existing.service_origin}`);
290
+ if (processAlive(existing.pid)) throw new Error(`Managed service pid ${existing.pid} exists but is stale or unhealthy: ${[...desiredErrors, ...health.errors].join("; ")}`);
291
+ rmSync(paths.receipt, { force: true });
292
+ }
293
+ mkdirSync(paths.directory, { recursive: true, mode: 448 });
294
+ const logFd = openSync(paths.log, "a", 384);
295
+ const instanceId = randomUUID();
296
+ const startArgs = ["start", "--profile", doctor.profile.manifest_path, "--json"];
297
+ const child = spawn(launcher[0], [...launcher.slice(1), ...startArgs], {
298
+ cwd: root,
299
+ detached: true,
300
+ env: { ...process.env, LINEAGE_SERVICE_INSTANCE_ID: instanceId },
301
+ stdio: ["ignore", logFd, logFd]
302
+ });
303
+ closeSync(logFd);
304
+ child.unref();
305
+ const receipt = {
306
+ channel,
307
+ code_fingerprint: doctor.runtime.code_fingerprint,
308
+ code_origin: doctor.runtime.code_origin,
309
+ code_root: runtimeIdentity.root,
310
+ database_path: doctor.profile.database_path,
311
+ environment: doctor.profile.environment,
312
+ instance_id: instanceId,
313
+ launcher,
314
+ log_path: paths.log,
315
+ manifest_path: doctor.profile.manifest_path,
316
+ pid: child.pid,
317
+ process_start: processStartToken(child.pid),
318
+ profile_fingerprint: doctor.profile.profile_fingerprint,
319
+ profile_id: doctor.profile.profile_id,
320
+ schema_version: receiptSchema,
321
+ service_origin: doctor.profile.service_origin,
322
+ started_at: (/* @__PURE__ */ new Date()).toISOString()
323
+ };
324
+ writeReceipt(paths.receipt, receipt);
325
+ try {
326
+ const health = await waitForHealthy(receipt, Number(readOption(args, "--timeout-ms") || 2e4));
327
+ if (args.includes("--open")) openBrowser(receipt.service_origin);
328
+ return { healthy: true, receipt, runtime: health.runtime, state_path: paths.receipt };
329
+ } catch (error) {
330
+ terminate(receipt, true);
331
+ throw error;
332
+ }
333
+ } finally {
334
+ release();
335
+ }
336
+ }
337
+ async function statusManaged(channel, selector, launcher) {
338
+ const { doctor, status } = profileDoctor(launcher, selector);
339
+ const paths = statePaths(channel, doctor.profile);
340
+ const receipt = readReceipt(paths.receipt);
341
+ if (!receipt) throw new Error(`No managed service receipt exists for ${channel}/${doctor.profile.profile_id}`);
342
+ const health = await inspectHealth(receipt);
343
+ const doctorFailures = status === 0 && doctor.ok ? [] : (doctor.checks || []).filter((check) => check.status === "fail").map((check) => `current doctor ${check.id}: ${check.message}`);
344
+ const errors = [...doctorFailures, ...desiredReceiptErrors(channel, doctor, receipt), ...health.errors];
345
+ if (errors.length > 0) throw new Error(`Managed service is not healthy: ${errors.join("; ")}`);
346
+ return { healthy: true, receipt, runtime: health.runtime, state_path: paths.receipt };
347
+ }
348
+ async function stopManaged(channel, selector, launcher, force) {
349
+ const { doctor } = profileDoctor(launcher, selector);
350
+ const paths = statePaths(channel, doctor.profile);
351
+ const release = acquireManagerLock(paths.lock);
352
+ try {
353
+ const receipt = readReceipt(paths.receipt);
354
+ if (!receipt) return { already_stopped: true, profile_id: doctor.profile.profile_id };
355
+ if (receipt.manifest_path !== doctor.profile.manifest_path || receipt.profile_id !== doctor.profile.profile_id) {
356
+ throw new Error("Service receipt identity does not match the requested profile");
357
+ }
358
+ terminate(receipt, force);
359
+ const deadline = Date.now() + 5e3;
360
+ while (processAlive(receipt.pid) && Date.now() < deadline) await new Promise((resolveDelay) => setTimeout(resolveDelay, 100));
361
+ if (processAlive(receipt.pid) && force) {
362
+ const signalTarget = platform() === "win32" ? receipt.pid : -receipt.pid;
363
+ try {
364
+ process.kill(signalTarget, "SIGKILL");
365
+ } catch {
366
+ }
367
+ }
368
+ if (processAlive(receipt.pid)) throw new Error(`Service pid ${receipt.pid} did not stop`);
369
+ rmSync(paths.receipt, { force: true });
370
+ return { profile_id: receipt.profile_id, stopped: true };
371
+ } finally {
372
+ release();
373
+ }
374
+ }
375
+ function logsManaged(channel, selector, launcher, lines) {
376
+ const { doctor } = profileDoctor(launcher, selector);
377
+ const paths = statePaths(channel, doctor.profile);
378
+ const receipt = readReceipt(paths.receipt);
379
+ const logPath = receipt?.log_path || paths.log;
380
+ if (!existsSync(logPath)) throw new Error(`No managed service log exists: ${logPath}`);
381
+ return readFileSync(logPath, "utf8").split("\n").slice(-lines).join("\n");
382
+ }
383
+ function usage() {
384
+ return `Usage:
385
+ lineage-service start --channel stable|preview|dev --profile <id-or-manifest> [--open] [--json]
386
+ lineage-service status --channel stable|preview|dev --profile <id-or-manifest> [--json]
387
+ lineage-service stop --channel stable|preview|dev --profile <id-or-manifest> [--force] [--json]
388
+ lineage-service logs --channel stable|preview|dev --profile <id-or-manifest> [--lines 100]
389
+
390
+ Start writes a profile-scoped receipt, waits for /api/runtime to match the exact
391
+ code/profile/database/service instance, and only then opens a browser. Status is
392
+ nonzero for a stale PID, failed health request, or any identity mismatch.`;
393
+ }
394
+ async function main() {
395
+ const args = process.argv.slice(2);
396
+ if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
397
+ console.log(usage());
398
+ return;
399
+ }
400
+ const command = args[0];
401
+ const channel = readOption(args, "--channel");
402
+ const selector = readOption(args, "--profile");
403
+ if (!["stable", "preview", "dev"].includes(channel)) throw new Error("--channel must be stable, preview, or dev");
404
+ if (!selector) throw new Error("--profile is required; managed services never use legacy-unbound data");
405
+ assertServiceManagerOrigin(channel);
406
+ const launcher = launcherFor(channel, args);
407
+ let result;
408
+ if (command === "start") result = await startManaged(channel, selector, launcher, args);
409
+ else if (command === "status") result = await statusManaged(channel, selector, launcher);
410
+ else if (command === "stop") result = await stopManaged(channel, selector, launcher, args.includes("--force"));
411
+ else if (command === "logs") {
412
+ const output = logsManaged(channel, selector, launcher, Number(readOption(args, "--lines") || 100));
413
+ console.log(output);
414
+ return;
415
+ } else throw new Error(`Unknown managed-service command: ${command}`);
416
+ if (args.includes("--json")) console.log(JSON.stringify(result, null, 2));
417
+ else if (command === "status" || command === "start") console.log(`Lineage ${channel}/${result.receipt.profile_id} healthy at ${result.receipt.service_origin}`);
418
+ else console.log(`Lineage ${channel}/${result.profile_id} stopped`);
419
+ }
420
+ var invokedAs = process.argv[1] ? basename(process.argv[1]) : "";
421
+ if (process.argv[1] && (resolve(process.argv[1]) === fileURLToPath(import.meta.url) || ["lineage-service", "lineage-stable-service", "lineage-preview-service", "managed-service.js", "managed-service.mjs"].includes(invokedAs))) {
422
+ main().catch((error) => {
423
+ console.error(`managed-service: ${error instanceof Error ? error.message : String(error)}`);
424
+ process.exitCode = 1;
425
+ });
426
+ }
427
+ export {
428
+ managedServiceIdentityErrors
429
+ };
430
+ //# sourceMappingURL=managed-service.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../scripts/managed-service.mjs"],
4
+ "sourcesContent": ["#!/usr/bin/env node\n\nimport { randomUUID, createHash } from 'node:crypto';\nimport { spawn, spawnSync } from 'node:child_process';\nimport {\n closeSync,\n existsSync,\n mkdirSync,\n openSync,\n readFileSync,\n readdirSync,\n readlinkSync,\n realpathSync,\n renameSync,\n rmSync,\n writeFileSync,\n} from 'node:fs';\nimport { homedir, platform } from 'node:os';\nimport { basename, dirname, join, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst scriptDirectory = dirname(fileURLToPath(import.meta.url));\nconst root = [resolve(scriptDirectory, '../..'), resolve(scriptDirectory, '..')].find(candidate => {\n try {\n const packageInfo = JSON.parse(readFileSync(join(candidate, 'package.json'), 'utf8'));\n return packageInfo.name === '@mean-weasel/lineage';\n } catch {\n return false;\n }\n});\nif (!root) throw new Error('Unable to locate the Lineage package root for managed service control');\nconst receiptSchema = 'lineage.managed_service.v1';\n\nfunction packageTreeSha256(packageRoot) {\n const hash = createHash('sha256');\n const visit = (directory, relativeDirectory = '') => {\n for (const entry of readdirSync(directory, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {\n const relativePath = relativeDirectory ? join(relativeDirectory, entry.name) : entry.name;\n const path = join(directory, entry.name);\n hash.update(relativePath.replaceAll('\\\\', '/'));\n hash.update('\\0');\n if (entry.isDirectory()) {\n hash.update('directory\\0');\n visit(path, relativePath);\n } else if (entry.isSymbolicLink()) {\n hash.update('symlink\\0');\n hash.update(readlinkSync(path));\n } else if (entry.isFile()) {\n hash.update('file\\0');\n hash.update(readFileSync(path));\n } else {\n hash.update('other\\0');\n }\n hash.update('\\0');\n }\n };\n visit(packageRoot);\n return hash.digest('hex');\n}\n\nfunction assertServiceManagerOrigin(channel) {\n const checkoutController = resolve(scriptDirectory) === resolve(root, 'scripts');\n if (channel === 'dev') {\n if (!checkoutController) throw new Error('Dev service control is checkout-only; run node scripts/managed-service.mjs from the intended worktree');\n return;\n }\n if (checkoutController) throw new Error(`${channel} service control requires the matching attested packaged manager`);\n const receiptPath = process.env.LINEAGE_RUNTIME_RECEIPT;\n if (!receiptPath || !existsSync(receiptPath)) throw new Error(`${channel} service manager is missing its runtime install receipt`);\n const receipt = JSON.parse(readFileSync(receiptPath, 'utf8'));\n if (receipt.channel !== channel || process.env.LINEAGE_RELEASE_CHANNEL !== channel) {\n throw new Error(`${channel} service manager receipt channel does not match the requested channel`);\n }\n if (!receipt.package_root || realpathSync(receipt.package_root) !== realpathSync(root)) {\n throw new Error(`${channel} service manager receipt package root ${receipt.package_root || '(missing)'} does not match controller root ${root}`);\n }\n if (packageTreeSha256(root) !== receipt.package_tree_sha256) throw new Error(`${channel} service manager package tree does not match its install receipt`);\n}\n\nfunction readOption(args, name) {\n const inline = args.find(arg => arg.startsWith(`${name}=`));\n if (inline) return inline.slice(name.length + 1);\n const index = args.indexOf(name);\n return index >= 0 ? args[index + 1] : undefined;\n}\n\nfunction serviceRoot() {\n if (process.env.LINEAGE_SERVICE_ROOT) return resolve(process.env.LINEAGE_SERVICE_ROOT);\n if (platform() === 'darwin') return join(homedir(), 'Library', 'Application Support', 'Lineage', 'services');\n if (platform() === 'win32') return join(process.env.LOCALAPPDATA || join(homedir(), 'AppData', 'Local'), 'Lineage', 'services');\n return join(process.env.XDG_STATE_HOME || join(homedir(), '.local', 'state'), 'lineage', 'services');\n}\n\nfunction defaultLauncher(channel) {\n if (channel === 'dev') return [process.execPath, '--import', 'tsx', join(root, 'src', 'cli', 'lineage-dev.ts')];\n const runtimeRoot = process.env.LINEAGE_RUNTIME_ROOT\n || (platform() === 'darwin'\n ? join(homedir(), 'Library', 'Application Support', 'Lineage', 'runtimes')\n : join(homedir(), '.local', 'share', 'lineage', 'runtimes'));\n const envName = channel === 'stable' ? 'LINEAGE_STABLE_BIN' : 'LINEAGE_PREVIEW_BIN';\n return [process.env[envName] || join(runtimeRoot, 'bin', channel === 'stable' ? 'lineage-stable' : 'lineage-preview')];\n}\n\nfunction launcherFor(channel, args) {\n const explicit = readOption(args, '--launcher');\n return explicit ? [resolve(explicit)] : defaultLauncher(channel);\n}\n\nfunction invoke(launcher, args, options = {}) {\n return spawnSync(launcher[0], [...launcher.slice(1), ...args], {\n cwd: root,\n encoding: 'utf8',\n ...options,\n });\n}\n\nfunction profileDoctor(launcher, selector) {\n const result = invoke(launcher, ['profile', 'doctor', '--profile', selector, '--json']);\n let doctor;\n try {\n doctor = JSON.parse(result.stdout || '{}');\n } catch {\n throw new Error(`Profile doctor did not return JSON: ${(result.stderr || result.stdout).trim()}`);\n }\n if (!doctor.profile) throw new Error(`Profile doctor could not resolve ${selector}: ${(result.stderr || JSON.stringify(doctor)).trim()}`);\n return { doctor, status: result.status ?? 1 };\n}\n\nfunction runtimeDoctor(launcher) {\n const result = invoke(launcher, ['runtime', 'doctor', '--json']);\n let runtime;\n try {\n runtime = JSON.parse(result.stdout || '{}');\n } catch {\n throw new Error(`Runtime doctor did not return JSON: ${(result.stderr || result.stdout).trim()}`);\n }\n if (result.status !== 0 || !runtime.verified) throw new Error(`Runtime doctor failed: ${(result.stderr || JSON.stringify(runtime)).trim()}`);\n return runtime;\n}\n\nfunction statePaths(channel, profile) {\n const digest = createHash('sha256').update(profile.manifest_path).digest('hex').slice(0, 12);\n const key = `${channel}--${profile.profile_id}--${digest}`;\n const directory = join(serviceRoot(), key);\n return {\n directory,\n lock: `${directory}.manager.lock`,\n log: join(directory, 'service.log'),\n receipt: join(directory, 'service.json'),\n };\n}\n\nfunction processAlive(pid) {\n try {\n process.kill(pid, 0);\n return true;\n } catch (error) {\n return error?.code !== 'ESRCH';\n }\n}\n\nfunction processStartToken(pid) {\n if (platform() === 'win32') return undefined;\n const result = spawnSync('ps', ['-p', String(pid), '-o', 'lstart='], { encoding: 'utf8' });\n return result.status === 0 ? result.stdout.trim() || undefined : undefined;\n}\n\nfunction processCommand(pid) {\n if (platform() === 'win32') return undefined;\n const result = spawnSync('ps', ['-p', String(pid), '-o', 'command='], { encoding: 'utf8' });\n return result.status === 0 ? result.stdout.trim() || undefined : undefined;\n}\n\nfunction acquireManagerLock(path) {\n mkdirSync(dirname(path), { recursive: true, mode: 0o700 });\n for (let attempt = 0; attempt < 3; attempt += 1) {\n try {\n mkdirSync(path, { mode: 0o700 });\n writeFileSync(join(path, 'owner.json'), `${JSON.stringify({ acquired_at: new Date().toISOString(), pid: process.pid })}\\n`, { mode: 0o600 });\n return () => rmSync(path, { force: true, recursive: true });\n } catch (error) {\n if (error?.code !== 'EEXIST') throw error;\n try {\n const owner = JSON.parse(readFileSync(join(path, 'owner.json'), 'utf8'));\n if (Number.isSafeInteger(owner.pid) && processAlive(owner.pid)) {\n throw new Error(`Another service manager operation is active (pid ${owner.pid})`, { cause: error });\n }\n } catch (ownerError) {\n if (ownerError instanceof Error && ownerError.message.startsWith('Another service manager')) throw ownerError;\n }\n rmSync(path, { force: true, recursive: true });\n }\n }\n throw new Error(`Could not acquire service manager lock ${path}`);\n}\n\nfunction readReceipt(path) {\n if (!existsSync(path)) return undefined;\n const receipt = JSON.parse(readFileSync(path, 'utf8'));\n if (\n receipt.schema_version !== receiptSchema\n || !Number.isSafeInteger(receipt.pid)\n || typeof receipt.instance_id !== 'string'\n || typeof receipt.profile_fingerprint !== 'string'\n || !Array.isArray(receipt.launcher)\n ) throw new Error(`Managed service receipt is invalid: ${path}`);\n return receipt;\n}\n\nfunction writeReceipt(path, receipt) {\n mkdirSync(dirname(path), { recursive: true, mode: 0o700 });\n const temporary = `${path}.tmp-${process.pid}-${randomUUID()}`;\n writeFileSync(temporary, `${JSON.stringify(receipt, null, 2)}\\n`, { encoding: 'utf8', flag: 'wx', mode: 0o600 });\n renameSync(temporary, path);\n}\n\nexport function managedServiceIdentityErrors(runtime, receipt) {\n const errors = [];\n if (runtime.channel !== receipt.channel) errors.push(`channel ${runtime.channel} != ${receipt.channel}`);\n if (!runtime.code?.verified) errors.push('code identity is not verified');\n if (runtime.code?.fingerprint !== receipt.code_fingerprint) errors.push(`code fingerprint ${runtime.code?.fingerprint || 'missing'} != ${receipt.code_fingerprint}`);\n if (runtime.profile?.id !== receipt.profile_id) errors.push(`profile ${runtime.profile?.id || 'missing'} != ${receipt.profile_id}`);\n if (runtime.profile?.environment !== receipt.environment) errors.push(`environment ${runtime.profile?.environment || 'missing'} != ${receipt.environment}`);\n if (runtime.profile?.fingerprint !== receipt.profile_fingerprint) errors.push(`profile fingerprint ${runtime.profile?.fingerprint || 'missing'} != ${receipt.profile_fingerprint}`);\n if (runtime.schema?.profile_id !== receipt.profile_id) errors.push(`database profile ${runtime.schema?.profile_id || 'missing'} != ${receipt.profile_id}`);\n if (runtime.schema?.profile_fingerprint !== receipt.profile_fingerprint) errors.push(`database fingerprint ${runtime.schema?.profile_fingerprint || 'missing'} != ${receipt.profile_fingerprint}`);\n if (resolve(runtime.database?.path || '') !== resolve(receipt.database_path)) errors.push(`database ${runtime.database?.path || 'missing'} != ${receipt.database_path}`);\n if (runtime.service?.instance_id !== receipt.instance_id) errors.push(`instance ${runtime.service?.instance_id || 'missing'} != ${receipt.instance_id}`);\n if (runtime.service?.launcher_pid !== receipt.pid) errors.push(`launcher pid ${runtime.service?.launcher_pid || 'missing'} != ${receipt.pid}`);\n return errors;\n}\n\nfunction desiredReceiptErrors(channel, doctor, receipt) {\n const errors = [];\n if (receipt.channel !== channel) errors.push(`receipt channel ${receipt.channel} != ${channel}`);\n if (receipt.code_fingerprint !== doctor.runtime?.code_fingerprint) errors.push(`receipt code fingerprint ${receipt.code_fingerprint} != current ${doctor.runtime?.code_fingerprint || 'missing'}`);\n if (receipt.code_origin !== doctor.runtime?.code_origin) errors.push(`receipt code origin ${receipt.code_origin} != current ${doctor.runtime?.code_origin || 'missing'}`);\n if (receipt.profile_id !== doctor.profile.profile_id) errors.push(`receipt profile ${receipt.profile_id} != ${doctor.profile.profile_id}`);\n if (receipt.environment !== doctor.profile.environment) errors.push(`receipt environment ${receipt.environment} != ${doctor.profile.environment}`);\n if (receipt.profile_fingerprint !== doctor.profile.profile_fingerprint) errors.push(`receipt profile fingerprint ${receipt.profile_fingerprint} != current ${doctor.profile.profile_fingerprint}`);\n if (resolve(receipt.database_path) !== resolve(doctor.profile.database_path)) errors.push('receipt database path does not match current profile');\n if (receipt.service_origin !== doctor.profile.service_origin) errors.push('receipt service origin does not match current profile');\n if (receipt.manifest_path !== doctor.profile.manifest_path) errors.push('receipt manifest path does not match current profile');\n return errors;\n}\n\nasync function fetchRuntime(origin) {\n const response = await fetch(`${origin}/api/runtime`, { signal: AbortSignal.timeout(1_000) });\n if (!response.ok) throw new Error(`HTTP ${response.status}`);\n const body = await response.json();\n if (!body?.runtime) throw new Error('Runtime response is missing runtime identity');\n return body.runtime;\n}\n\nasync function inspectHealth(receipt) {\n const errors = [];\n if (!processAlive(receipt.pid)) errors.push(`launcher pid ${receipt.pid} is not alive`);\n if (receipt.process_start && processStartToken(receipt.pid) !== receipt.process_start) errors.push(`launcher pid ${receipt.pid} was reused`);\n let runtime;\n try {\n runtime = await fetchRuntime(receipt.service_origin);\n errors.push(...managedServiceIdentityErrors(runtime, receipt));\n } catch (error) {\n errors.push(`runtime health failed: ${error instanceof Error ? error.message : String(error)}`);\n }\n return { errors, healthy: errors.length === 0, runtime };\n}\n\nasync function waitForHealthy(receipt, timeoutMs = 20_000) {\n const deadline = Date.now() + timeoutMs;\n let health = { errors: ['service did not respond'], healthy: false };\n while (Date.now() < deadline && processAlive(receipt.pid)) {\n health = await inspectHealth(receipt);\n if (health.healthy) return health;\n await new Promise(resolveDelay => setTimeout(resolveDelay, 250));\n }\n throw new Error(`Service failed readiness: ${health.errors.join('; ')}`);\n}\n\nfunction openBrowser(origin) {\n const command = platform() === 'darwin' ? 'open' : platform() === 'win32' ? 'cmd' : 'xdg-open';\n const args = platform() === 'win32' ? ['/c', 'start', '', origin] : [origin];\n const child = spawn(command, args, { detached: true, stdio: 'ignore' });\n child.unref();\n}\n\nfunction terminate(receipt, force = false) {\n if (!processAlive(receipt.pid)) return;\n const currentStart = processStartToken(receipt.pid);\n const command = processCommand(receipt.pid);\n const processMatches = receipt.process_start\n ? currentStart === receipt.process_start\n : Boolean(command?.includes('start') && command.includes(receipt.manifest_path));\n if (!processMatches && !force) {\n throw new Error(`Refusing to signal pid ${receipt.pid}: process identity no longer matches the service receipt; inspect manually or pass --force`);\n }\n const signalTarget = platform() === 'win32' ? receipt.pid : -receipt.pid;\n try { process.kill(signalTarget, 'SIGTERM'); } catch (error) { if (error?.code !== 'ESRCH') throw error; }\n}\n\nasync function startManaged(channel, selector, launcher, args) {\n const { doctor, status } = profileDoctor(launcher, selector);\n const runtimeIdentity = runtimeDoctor(launcher);\n if (status !== 0 || !doctor.ok || !doctor.runtime?.code_verified) {\n const failures = (doctor.checks || []).filter(check => check.status === 'fail').map(check => `${check.id}: ${check.message}`);\n throw new Error(`Profile doctor must pass before service start: ${failures.join('; ') || 'unverified runtime'}`);\n }\n if (runtimeIdentity.fingerprint !== doctor.runtime.code_fingerprint || runtimeIdentity.channel !== channel) {\n throw new Error('Runtime doctor identity changed while resolving the service profile');\n }\n const paths = statePaths(channel, doctor.profile);\n const release = acquireManagerLock(paths.lock);\n try {\n const existing = readReceipt(paths.receipt);\n if (existing) {\n const health = await inspectHealth(existing);\n const desiredErrors = desiredReceiptErrors(channel, doctor, existing);\n if (health.healthy && desiredErrors.length === 0) throw new Error(`Managed service is already healthy at ${existing.service_origin}`);\n if (processAlive(existing.pid)) throw new Error(`Managed service pid ${existing.pid} exists but is stale or unhealthy: ${[...desiredErrors, ...health.errors].join('; ')}`);\n rmSync(paths.receipt, { force: true });\n }\n mkdirSync(paths.directory, { recursive: true, mode: 0o700 });\n const logFd = openSync(paths.log, 'a', 0o600);\n const instanceId = randomUUID();\n const startArgs = ['start', '--profile', doctor.profile.manifest_path, '--json'];\n const child = spawn(launcher[0], [...launcher.slice(1), ...startArgs], {\n cwd: root,\n detached: true,\n env: { ...process.env, LINEAGE_SERVICE_INSTANCE_ID: instanceId },\n stdio: ['ignore', logFd, logFd],\n });\n closeSync(logFd);\n child.unref();\n const receipt = {\n channel,\n code_fingerprint: doctor.runtime.code_fingerprint,\n code_origin: doctor.runtime.code_origin,\n code_root: runtimeIdentity.root,\n database_path: doctor.profile.database_path,\n environment: doctor.profile.environment,\n instance_id: instanceId,\n launcher,\n log_path: paths.log,\n manifest_path: doctor.profile.manifest_path,\n pid: child.pid,\n process_start: processStartToken(child.pid),\n profile_fingerprint: doctor.profile.profile_fingerprint,\n profile_id: doctor.profile.profile_id,\n schema_version: receiptSchema,\n service_origin: doctor.profile.service_origin,\n started_at: new Date().toISOString(),\n };\n writeReceipt(paths.receipt, receipt);\n try {\n const health = await waitForHealthy(receipt, Number(readOption(args, '--timeout-ms') || 20_000));\n if (args.includes('--open')) openBrowser(receipt.service_origin);\n return { healthy: true, receipt, runtime: health.runtime, state_path: paths.receipt };\n } catch (error) {\n terminate(receipt, true);\n throw error;\n }\n } finally {\n release();\n }\n}\n\nasync function statusManaged(channel, selector, launcher) {\n const { doctor, status } = profileDoctor(launcher, selector);\n const paths = statePaths(channel, doctor.profile);\n const receipt = readReceipt(paths.receipt);\n if (!receipt) throw new Error(`No managed service receipt exists for ${channel}/${doctor.profile.profile_id}`);\n const health = await inspectHealth(receipt);\n const doctorFailures = status === 0 && doctor.ok\n ? []\n : (doctor.checks || []).filter(check => check.status === 'fail').map(check => `current doctor ${check.id}: ${check.message}`);\n const errors = [...doctorFailures, ...desiredReceiptErrors(channel, doctor, receipt), ...health.errors];\n if (errors.length > 0) throw new Error(`Managed service is not healthy: ${errors.join('; ')}`);\n return { healthy: true, receipt, runtime: health.runtime, state_path: paths.receipt };\n}\n\nasync function stopManaged(channel, selector, launcher, force) {\n const { doctor } = profileDoctor(launcher, selector);\n const paths = statePaths(channel, doctor.profile);\n const release = acquireManagerLock(paths.lock);\n try {\n const receipt = readReceipt(paths.receipt);\n if (!receipt) return { already_stopped: true, profile_id: doctor.profile.profile_id };\n if (receipt.manifest_path !== doctor.profile.manifest_path || receipt.profile_id !== doctor.profile.profile_id) {\n throw new Error('Service receipt identity does not match the requested profile');\n }\n terminate(receipt, force);\n const deadline = Date.now() + 5_000;\n while (processAlive(receipt.pid) && Date.now() < deadline) await new Promise(resolveDelay => setTimeout(resolveDelay, 100));\n if (processAlive(receipt.pid) && force) {\n const signalTarget = platform() === 'win32' ? receipt.pid : -receipt.pid;\n try { process.kill(signalTarget, 'SIGKILL'); } catch { /* already exited */ }\n }\n if (processAlive(receipt.pid)) throw new Error(`Service pid ${receipt.pid} did not stop`);\n rmSync(paths.receipt, { force: true });\n return { profile_id: receipt.profile_id, stopped: true };\n } finally {\n release();\n }\n}\n\nfunction logsManaged(channel, selector, launcher, lines) {\n const { doctor } = profileDoctor(launcher, selector);\n const paths = statePaths(channel, doctor.profile);\n const receipt = readReceipt(paths.receipt);\n const logPath = receipt?.log_path || paths.log;\n if (!existsSync(logPath)) throw new Error(`No managed service log exists: ${logPath}`);\n return readFileSync(logPath, 'utf8').split('\\n').slice(-lines).join('\\n');\n}\n\nfunction usage() {\n return `Usage:\n lineage-service start --channel stable|preview|dev --profile <id-or-manifest> [--open] [--json]\n lineage-service status --channel stable|preview|dev --profile <id-or-manifest> [--json]\n lineage-service stop --channel stable|preview|dev --profile <id-or-manifest> [--force] [--json]\n lineage-service logs --channel stable|preview|dev --profile <id-or-manifest> [--lines 100]\n\nStart writes a profile-scoped receipt, waits for /api/runtime to match the exact\ncode/profile/database/service instance, and only then opens a browser. Status is\nnonzero for a stale PID, failed health request, or any identity mismatch.`;\n}\n\nasync function main() {\n const args = process.argv.slice(2);\n if (args.length === 0 || args.includes('--help') || args.includes('-h')) {\n console.log(usage());\n return;\n }\n const command = args[0];\n const channel = readOption(args, '--channel');\n const selector = readOption(args, '--profile');\n if (!['stable', 'preview', 'dev'].includes(channel)) throw new Error('--channel must be stable, preview, or dev');\n if (!selector) throw new Error('--profile is required; managed services never use legacy-unbound data');\n assertServiceManagerOrigin(channel);\n const launcher = launcherFor(channel, args);\n let result;\n if (command === 'start') result = await startManaged(channel, selector, launcher, args);\n else if (command === 'status') result = await statusManaged(channel, selector, launcher);\n else if (command === 'stop') result = await stopManaged(channel, selector, launcher, args.includes('--force'));\n else if (command === 'logs') {\n const output = logsManaged(channel, selector, launcher, Number(readOption(args, '--lines') || 100));\n console.log(output);\n return;\n } else throw new Error(`Unknown managed-service command: ${command}`);\n if (args.includes('--json')) console.log(JSON.stringify(result, null, 2));\n else if (command === 'status' || command === 'start') console.log(`Lineage ${channel}/${result.receipt.profile_id} healthy at ${result.receipt.service_origin}`);\n else console.log(`Lineage ${channel}/${result.profile_id} stopped`);\n}\n\nconst invokedAs = process.argv[1] ? basename(process.argv[1]) : '';\nif (process.argv[1] && (\n resolve(process.argv[1]) === fileURLToPath(import.meta.url)\n || ['lineage-service', 'lineage-stable-service', 'lineage-preview-service', 'managed-service.js', 'managed-service.mjs'].includes(invokedAs)\n)) {\n main().catch(error => {\n console.error(`managed-service: ${error instanceof Error ? error.message : String(error)}`);\n process.exitCode = 1;\n });\n}\n"],
5
+ "mappings": ";;;AAEA,SAAS,YAAY,kBAAkB;AACvC,SAAS,OAAO,iBAAiB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,SAAS,gBAAgB;AAClC,SAAS,UAAU,SAAS,MAAM,eAAe;AACjD,SAAS,qBAAqB;AAE9B,IAAM,kBAAkB,QAAQ,cAAc,YAAY,GAAG,CAAC;AAC9D,IAAM,OAAO,CAAC,QAAQ,iBAAiB,OAAO,GAAG,QAAQ,iBAAiB,IAAI,CAAC,EAAE,KAAK,eAAa;AACjG,MAAI;AACF,UAAM,cAAc,KAAK,MAAM,aAAa,KAAK,WAAW,cAAc,GAAG,MAAM,CAAC;AACpF,WAAO,YAAY,SAAS;AAAA,EAC9B,QAAQ;AACN,WAAO;AAAA,EACT;AACF,CAAC;AACD,IAAI,CAAC,KAAM,OAAM,IAAI,MAAM,uEAAuE;AAClG,IAAM,gBAAgB;AAEtB,SAAS,kBAAkB,aAAa;AACtC,QAAM,OAAO,WAAW,QAAQ;AAChC,QAAM,QAAQ,CAAC,WAAW,oBAAoB,OAAO;AACnD,eAAW,SAAS,YAAY,WAAW,EAAE,eAAe,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,UAAU,KAAK,KAAK,cAAc,MAAM,IAAI,CAAC,GAAG;AAC9H,YAAM,eAAe,oBAAoB,KAAK,mBAAmB,MAAM,IAAI,IAAI,MAAM;AACrF,YAAM,OAAO,KAAK,WAAW,MAAM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AU,OAAO,WAAW,MAAM,SAAS,KAAK,GAAG,CAAC;AAClG,YAAQ,IAAI,MAAM;AAClB;AAAA,EACF,MAAO,OAAM,IAAI,MAAM,oCAAoC,OAAO,EAAE;AACpE,MAAI,KAAK,SAAS,QAAQ,EAAG,SAAQ,IAAI,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;AAAA,WAC/D,YAAY,YAAY,YAAY,QAAS,SAAQ,IAAI,WAAW,OAAO,IAAI,OAAO,QAAQ,UAAU,eAAe,OAAO,QAAQ,cAAc,EAAE;AAAA,MAC1J,SAAQ,IAAI,WAAW,OAAO,IAAI,OAAO,UAAU,UAAU;AACpE;AAEA,IAAM,YAAY,QAAQ,KAAK,CAAC,IAAI,SAAS,QAAQ,KAAK,CAAC,CAAC,IAAI;AAChE,IAAI,QAAQ,KAAK,CAAC,MAChB,QAAQ,QAAQ,KAAK,CAAC,CAAC,MAAM,cAAc,YAAY,GAAG,KACvD,CAAC,mBAAmB,0BAA0B,2BAA2B,sBAAsB,qBAAqB,EAAE,SAAS,SAAS,IAC1I;AACD,OAAK,EAAE,MAAM,WAAS;AACpB,YAAQ,MAAM,oBAAoB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AAC1F,YAAQ,WAAW;AAAA,EACrB,CAAC;AACH;",
6
+ "names": []
7
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "build_fingerprint": "aa5c14478fdf5914b723a6cd85cfbffb25816e0b24c3244cfaaaba8f5ddc97c6",
3
+ "package_name": "@mean-weasel/lineage",
4
+ "package_version": "0.1.13",
5
+ "schema_version": "lineage.runtime_build.v1",
6
+ "source_dirty": false,
7
+ "source_fingerprint": "137fed84fbb53c1721042ea6b07b62ab37cb1ee051052e136bdc622ade5cbf5a",
8
+ "source_git_sha": "b1dbfad1fa1552bd577d17fa39b0c9dc1623db23"
9
+ }