@mean-weasel/lineage 0.1.15 → 0.1.17

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +249 -19
  3. package/dist/cli/lineage-channel.js +25 -5
  4. package/dist/cli/lineage-channel.js.map +2 -2
  5. package/dist/cli/lineage-dev.js +891 -52
  6. package/dist/cli/lineage-dev.js.map +4 -4
  7. package/dist/cli/lineage-preview.js +891 -52
  8. package/dist/cli/lineage-preview.js.map +4 -4
  9. package/dist/cli/lineage.js +891 -52
  10. package/dist/cli/lineage.js.map +4 -4
  11. package/dist/cli/managed-service.js +19 -5
  12. package/dist/cli/managed-service.js.map +2 -2
  13. package/dist/runtime-build.json +4 -4
  14. package/dist/server.js +883 -89
  15. package/dist/server.js.map +4 -4
  16. package/dist/web/assets/agent-shared-state-DOfpTLiw.webp +0 -0
  17. package/dist/web/assets/agent-to-canvas-DtIu_cPq.mp4 +0 -0
  18. package/dist/web/assets/{app-CDxSvoD3.css → app-B-fAyNsU.css} +1 -1
  19. package/dist/web/assets/app-DMogkUoS.js +16 -0
  20. package/dist/web/assets/attempt-history-D6wdic6n.webp +0 -0
  21. package/dist/web/assets/branching-tree-B8I5_S6D.png +0 -0
  22. package/dist/web/assets/canvas-cli-DHBacq7r.png +0 -0
  23. package/dist/web/assets/hero-agent-sync-CSyh0tHy.mp4 +0 -0
  24. package/dist/web/assets/hero-board-DG3ED4AW.webp +0 -0
  25. package/dist/web/assets/hero-lineage-growth-Bsl9tiq-.mp4 +0 -0
  26. package/dist/web/assets/hero-trace-connections-Bb52ABBc.mp4 +0 -0
  27. package/dist/web/assets/human-selection-BdDBDE-I.webp +0 -0
  28. package/dist/web/assets/human-to-agent-D1z92ZO9.mp4 +0 -0
  29. package/dist/web/assets/{jsx-runtime-_Rdg6et1.js → jsx-runtime-DAFSxiwi.js} +1 -1
  30. package/dist/web/assets/landing-Bn4qKbIO.css +1 -0
  31. package/dist/web/assets/landing-CoyGmxBo.js +1 -0
  32. package/dist/web/assets/reroll-history-DQcEH42R.mp4 +0 -0
  33. package/dist/web/index.html +3 -3
  34. package/dist/web/landing/index.html +3 -3
  35. package/fixtures/demo-project/lineage/swissifier-rich-demo.json +13 -13
  36. package/package.json +4 -3
  37. package/dist/web/assets/app-CYUgf6rX.js +0 -16
  38. package/dist/web/assets/landing-D3Y679_B.css +0 -1
  39. package/dist/web/assets/landing-ii8AH_DG.js +0 -1
@@ -90,7 +90,7 @@ function defaultLauncher(channel) {
90
90
  if (channel === "dev") return [process.execPath, "--import", "tsx", join(root, "src", "cli", "lineage-dev.ts")];
91
91
  const runtimeRoot = process.env.LINEAGE_RUNTIME_ROOT || (platform() === "darwin" ? join(homedir(), "Library", "Application Support", "Lineage", "runtimes") : join(homedir(), ".local", "share", "lineage", "runtimes"));
92
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")];
93
+ return [process.env[envName] || process.env.LINEAGE_CHANNEL_LAUNCHER || join(runtimeRoot, "bin", channel === "stable" ? "lineage-stable" : "lineage-preview")];
94
94
  }
95
95
  function launcherFor(channel, args) {
96
96
  const explicit = readOption(args, "--launcher");
@@ -103,6 +103,9 @@ function invoke(launcher, args, options = {}) {
103
103
  ...options
104
104
  });
105
105
  }
106
+ function shellDisplay(parts) {
107
+ return parts.map((part) => /^[A-Za-z0-9_./:@=-]+$/.test(part) ? part : JSON.stringify(part)).join(" ");
108
+ }
106
109
  function profileDoctor(launcher, selector) {
107
110
  const result = invoke(launcher, ["profile", "doctor", "--profile", selector, "--json"]);
108
111
  let doctor;
@@ -111,7 +114,12 @@ function profileDoctor(launcher, selector) {
111
114
  } catch {
112
115
  throw new Error(`Profile doctor did not return JSON: ${(result.stderr || result.stdout).trim()}`);
113
116
  }
114
- if (!doctor.profile) throw new Error(`Profile doctor could not resolve ${selector}: ${(result.stderr || JSON.stringify(doctor)).trim()}`);
117
+ if (!doctor.profile) {
118
+ const detail = doctor.error || (doctor.checks || []).filter((check) => check.status === "fail").map((check) => check.message).join("; ") || result.stderr.trim() || "profile manifest was not found or could not be read";
119
+ const doctorCommand = shellDisplay([...launcher, "profile", "doctor", "--profile", selector, "--json"]);
120
+ const initCommand = shellDisplay([...launcher, "profile", "init", "--profile", selector, "--confirm-write", "--json"]);
121
+ throw new Error(`Profile ${selector} could not be resolved: ${detail}. Next: run \`${doctorCommand}\`. If this is a new profile, run \`${initCommand}\` instead.`);
122
+ }
115
123
  return { doctor, status: result.status ?? 1 };
116
124
  }
117
125
  function runtimeDoctor(launcher) {
@@ -203,6 +211,7 @@ function managedServiceIdentityErrors(runtime, receipt) {
203
211
  if (resolve(runtime.database?.path || "") !== resolve(receipt.database_path)) errors.push(`database ${runtime.database?.path || "missing"} != ${receipt.database_path}`);
204
212
  if (runtime.service?.instance_id !== receipt.instance_id) errors.push(`instance ${runtime.service?.instance_id || "missing"} != ${receipt.instance_id}`);
205
213
  if (runtime.service?.launcher_pid !== receipt.pid) errors.push(`launcher pid ${runtime.service?.launcher_pid || "missing"} != ${receipt.pid}`);
214
+ if (runtime.service?.mode !== "managed") errors.push(`service mode ${runtime.service?.mode || "missing"} != managed`);
206
215
  return errors;
207
216
  }
208
217
  function desiredReceiptErrors(channel, doctor, receipt) {
@@ -286,7 +295,10 @@ async function startManaged(channel, selector, launcher, args) {
286
295
  if (existing) {
287
296
  const health = await inspectHealth(existing);
288
297
  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}`);
298
+ if (health.healthy && desiredErrors.length === 0) {
299
+ if (args.includes("--open")) openBrowser(existing.service_origin);
300
+ return { already_running: true, healthy: true, receipt: existing, runtime: health.runtime, state_path: paths.receipt };
301
+ }
290
302
  if (processAlive(existing.pid)) throw new Error(`Managed service pid ${existing.pid} exists but is stale or unhealthy: ${[...desiredErrors, ...health.errors].join("; ")}`);
291
303
  rmSync(paths.receipt, { force: true });
292
304
  }
@@ -297,7 +309,7 @@ async function startManaged(channel, selector, launcher, args) {
297
309
  const child = spawn(launcher[0], [...launcher.slice(1), ...startArgs], {
298
310
  cwd: root,
299
311
  detached: true,
300
- env: { ...process.env, LINEAGE_SERVICE_INSTANCE_ID: instanceId },
312
+ env: { ...process.env, LINEAGE_SERVICE_INSTANCE_ID: instanceId, LINEAGE_SERVICE_MODE: "managed" },
301
313
  stdio: ["ignore", logFd, logFd]
302
314
  });
303
315
  closeSync(logFd);
@@ -420,7 +432,9 @@ async function main() {
420
432
  var invokedAs = process.argv[1] ? basename(process.argv[1]) : "";
421
433
  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
434
  main().catch((error) => {
423
- console.error(`managed-service: ${error instanceof Error ? error.message : String(error)}`);
435
+ const message = error instanceof Error ? error.message : String(error);
436
+ if (process.argv.includes("--json")) console.error(JSON.stringify({ error: message, ok: false }, null, 2));
437
+ else console.error(`managed-service: ${message}`);
424
438
  process.exitCode = 1;
425
439
  });
426
440
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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,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Y,SAAS,UAAU,UAAU,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;",
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]\n || process.env.LINEAGE_CHANNEL_LAUNCHER\n || 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 shellDisplay(parts) {\n return parts.map(part => /^[A-Za-z0-9_./:@=-]+$/.test(part) ? part : JSON.stringify(part)).join(' ');\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) {\n const detail = doctor.error\n || (doctor.checks || []).filter(check => check.status === 'fail').map(check => check.message).join('; ')\n || result.stderr.trim()\n || 'profile manifest was not found or could not be read';\n const doctorCommand = shellDisplay([...launcher, 'profile', 'doctor', '--profile', selector, '--json']);\n const initCommand = shellDisplay([...launcher, 'profile', 'init', '--profile', selector, '--confirm-write', '--json']);\n throw new Error(`Profile ${selector} could not be resolved: ${detail}. Next: run \\`${doctorCommand}\\`. If this is a new profile, run \\`${initCommand}\\` instead.`);\n }\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 if (runtime.service?.mode !== 'managed') errors.push(`service mode ${runtime.service?.mode || 'missing'} != managed`);\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) {\n if (args.includes('--open')) openBrowser(existing.service_origin);\n return { already_running: true, healthy: true, receipt: existing, runtime: health.runtime, state_path: paths.receipt };\n }\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, LINEAGE_SERVICE_MODE: 'managed' },\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 const message = error instanceof Error ? error.message : String(error);\n if (process.argv.includes('--json')) console.error(JSON.stringify({ error: message, ok: false }, null, 2));\n else console.error(`managed-service: ${message}`);\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;A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AM,SAAS,YAAY,SAAS,UAAU,UAAU,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,UAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACrE,QAAI,QAAQ,KAAK,SAAS,QAAQ,EAAG,SAAQ,MAAM,KAAK,UAAU,EAAE,OAAO,SAAS,IAAI,MAAM,GAAG,MAAM,CAAC,CAAC;AAAA,QACpG,SAAQ,MAAM,oBAAoB,OAAO,EAAE;AAChD,YAAQ,WAAW;AAAA,EACrB,CAAC;AACH;",
6
6
  "names": []
7
7
  }
@@ -1,9 +1,9 @@
1
1
  {
2
- "build_fingerprint": "5726f451f6c74d249f9d81a64a3f805e45f49c94f947706bfc71e639cc15dffc",
2
+ "build_fingerprint": "87a10b563bd810b777c088e8ae7fd2b3ef4a0f4b655c85be7ca5bd8fed743743",
3
3
  "package_name": "@mean-weasel/lineage",
4
- "package_version": "0.1.15",
4
+ "package_version": "0.1.17",
5
5
  "schema_version": "lineage.runtime_build.v1",
6
6
  "source_dirty": false,
7
- "source_fingerprint": "a92b1501637f3b1bc2f5a659bbfb248c6adce52ef14ba2bcc532de35b86390df",
8
- "source_git_sha": "6883a78641c32006bd66d0ea068ecbc4bbf7ea94"
7
+ "source_fingerprint": "c678535d3cc4bf66e48e0609f32aecd75d0ec648494aa1ef84f8ec94f999c0bf",
8
+ "source_git_sha": "399a50473ece3f18150e811d8e5ffdd06484fd5a"
9
9
  }