@mean-weasel/lineage 0.1.18 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cli/lineage-channel.js.map +1 -1
- package/dist/cli/lineage-dev.js +50 -27
- package/dist/cli/lineage-dev.js.map +4 -4
- package/dist/cli/lineage-preview.js +50 -27
- package/dist/cli/lineage-preview.js.map +4 -4
- package/dist/cli/lineage.js +50 -27
- package/dist/cli/lineage.js.map +4 -4
- package/dist/runtime-build.json +4 -4
- package/dist/server.js +76 -52
- package/dist/server.js.map +4 -4
- package/dist/web/assets/app-536tsqAD.js +16 -0
- package/dist/web/assets/hero-agent-sync-D8ibW83E.mp4 +0 -0
- package/dist/web/assets/hero-agent-sync-poster-zBB3KpbO.png +0 -0
- package/dist/web/assets/landing-CPZnU7M8.js +1 -0
- package/dist/web/assets/landing-Dmkx4R_N.css +1 -0
- package/dist/web/index.html +1 -1
- package/dist/web/landing/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/app-XjkwA_uj.js +0 -16
- package/dist/web/assets/hero-agent-sync-CSyh0tHy.mp4 +0 -0
- package/dist/web/assets/landing-BogL3MNz.js +0 -1
- package/dist/web/assets/landing-D79qigX-.css +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.20
|
|
4
|
+
|
|
5
|
+
- Generate every server and browser handoff with the verified stable, preview, or checkout-development launcher and pin it to the active profile or explicit database instead of emitting unsafe `npx` fallbacks.
|
|
6
|
+
- Remove the duplicate user-facing Node SQLite startup warning while preserving unrelated warnings, and fail closed when browser command generation lacks runtime identity.
|
|
7
|
+
- Refine landing-page carousel autoplay, poster loading, transitions, and media presentation for a smoother first visit.
|
|
8
|
+
|
|
3
9
|
## 0.1.18
|
|
4
10
|
|
|
5
11
|
- Keep managed stable/preview service control compatible with launchers generated by the immediately preceding public channel bootstrap by resolving the exact launcher through its receipt-bound channel pointer.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/cli/lineage-channel.ts", "../../src/shared/runtimeInfoTypes.ts"],
|
|
4
|
-
"sourcesContent": ["#!/usr/bin/env node\n\nimport { createHash } from 'node:crypto';\nimport { execFileSync } from 'node:child_process';\nimport {\n chmodSync,\n existsSync,\n mkdirSync,\n mkdtempSync,\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 { dirname, join, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport {\n lineageRuntimeBuildSchemaVersion,\n lineageRuntimeInstallSchemaVersion,\n type LineageRuntimeBuildIdentity,\n type LineageRuntimeInstallReceipt,\n} from '../shared/runtimeInfoTypes';\n\ntype PublishedChannel = 'stable' | 'preview';\ninterface ResolvedPackageSpec {\n expectedVersion?: string;\n installSpec: string;\n integrity: string;\n requestedSpec: string;\n source: LineageRuntimeInstallReceipt['package_source'];\n}\n\ninterface RegistryPackageMetadata {\n dist?: { integrity?: unknown };\n 'dist.integrity'?: unknown;\n version?: unknown;\n}\n\nconst packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..', '..');\nconst packageInfo = JSON.parse(readFileSync(join(packageRoot, 'package.json'), 'utf8')) as { name: string; version: string };\n\nfunction sha256(value: string | Buffer): string {\n return createHash('sha256').update(value).digest('hex');\n}\n\nfunction readOption(args: string[], name: string): string | undefined {\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 runtimeRoot(): string {\n if (process.env.LINEAGE_RUNTIME_ROOT) return resolve(process.env.LINEAGE_RUNTIME_ROOT);\n if (platform() === 'darwin') return join(homedir(), 'Library', 'Application Support', 'Lineage', 'runtimes');\n if (platform() === 'win32') return join(process.env.LOCALAPPDATA || join(homedir(), 'AppData', 'Local'), 'Lineage', 'runtimes');\n return join(process.env.XDG_DATA_HOME || join(homedir(), '.local', 'share'), 'lineage', 'runtimes');\n}\n\nfunction globalNpmExecutableDirectory(): string {\n let prefix: string;\n try {\n prefix = execFileSync('npm', ['prefix', '--global'], { encoding: 'utf8' }).trim();\n } catch (error) {\n throw new Error('Could not locate the global npm executable directory; pass --shim-dir explicitly', { cause: error });\n }\n if (!prefix) throw new Error('npm returned an empty global prefix; pass --shim-dir explicitly');\n return platform() === 'win32' ? resolve(prefix) : resolve(prefix, 'bin');\n}\n\nfunction shimDirectory(args: string[], root: string): string {\n const explicit = readOption(args, '--shim-dir');\n if (explicit) return resolve(explicit);\n if (readOption(args, '--root') || process.env.LINEAGE_RUNTIME_ROOT) return join(root, 'bin');\n return globalNpmExecutableDirectory();\n}\n\nfunction parseChannel(value?: string): PublishedChannel {\n if (value === 'stable' || value === 'preview') return value;\n throw new Error('Channel must be stable or preview; dev is checkout-only');\n}\n\nfunction packageTreeSha256(root: string): string {\n const hash = createHash('sha256');\n const visit = (directory: string, 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(root);\n return hash.digest('hex');\n}\n\nfunction expectedBuildFingerprint(build: Omit<LineageRuntimeBuildIdentity, 'build_fingerprint'>): string {\n return sha256(JSON.stringify({\n package_name: build.package_name,\n package_version: build.package_version,\n schema_version: build.schema_version,\n source_dirty: build.source_dirty,\n source_fingerprint: build.source_fingerprint,\n source_git_sha: build.source_git_sha,\n }));\n}\n\nfunction validateBuild(root: string, installed: { name: string; version: string }): LineageRuntimeBuildIdentity {\n const path = join(root, 'dist', 'runtime-build.json');\n const build = JSON.parse(readFileSync(path, 'utf8')) as LineageRuntimeBuildIdentity;\n if (build.schema_version !== lineageRuntimeBuildSchemaVersion) throw new Error(`Unsupported build identity schema in ${path}`);\n if (build.package_name !== installed.name || build.package_version !== installed.version) throw new Error('Embedded build identity does not match installed package.json');\n if (!/^[a-f0-9]{40}$/i.test(build.source_git_sha)) throw new Error('Embedded build Git revision is invalid');\n if (!/^[a-f0-9]{64}$/i.test(build.source_fingerprint)) throw new Error('Embedded source fingerprint is invalid');\n if (build.build_fingerprint !== expectedBuildFingerprint(build)) throw new Error('Embedded build fingerprint does not match its contents');\n if (build.source_dirty) throw new Error('Refusing stable/preview installation of a dirty-source build');\n return build;\n}\n\nexport function parseRegistryPackageMetadata(value: unknown): { integrity: string; version: string } {\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n throw new Error('npm metadata was not a JSON object');\n }\n const metadata = value as RegistryPackageMetadata;\n const nestedIntegrity = metadata.dist?.integrity;\n const flatIntegrity = metadata['dist.integrity'];\n if (\n typeof nestedIntegrity === 'string'\n && typeof flatIntegrity === 'string'\n && nestedIntegrity !== flatIntegrity\n ) {\n throw new Error('npm metadata returned conflicting integrity values');\n }\n const integrity = typeof nestedIntegrity === 'string' ? nestedIntegrity : flatIntegrity;\n if (typeof metadata.version !== 'string' || !metadata.version || typeof integrity !== 'string' || !integrity) {\n throw new Error('npm metadata did not include exact version and integrity');\n }\n return { integrity, version: metadata.version };\n}\n\nfunction resolveSpec(spec: string, allowLocalPackage: boolean): ResolvedPackageSpec {\n const localPath = resolve(spec.replace(/^file:/, ''));\n if (existsSync(localPath)) {\n if (!allowLocalPackage) {\n throw new Error('Local package paths require --allow-local-package; normal stable/preview installs must resolve from the npm registry');\n }\n return {\n installSpec: localPath,\n integrity: `sha512-${createHash('sha512').update(readFileSync(localPath)).digest('base64')}`,\n requestedSpec: spec,\n source: 'local',\n };\n }\n let metadata: { integrity: string; version: string };\n try {\n metadata = parseRegistryPackageMetadata(JSON.parse(execFileSync('npm', ['view', spec, 'version', 'dist.integrity', '--json'], { encoding: 'utf8' })));\n } catch (error) {\n throw new Error(`npm metadata for ${spec} did not include exact version and integrity`, { cause: error });\n }\n const name = spec.startsWith('@') ? spec.slice(0, spec.indexOf('@', 1)) : spec.split('@')[0];\n return {\n installSpec: `${name}@${metadata.version}`,\n integrity: metadata.integrity,\n expectedVersion: metadata.version,\n requestedSpec: spec,\n source: 'registry',\n };\n}\n\nfunction shellQuote(value: string): string {\n return `'${value.replaceAll(\"'\", \"'\\\\''\")}'`;\n}\n\nfunction writeShim(\n path: string,\n channel: PublishedChannel,\n receiptPath: string,\n entrypoint: string,\n environment: Record<string, string> = {},\n): void {\n const tempPath = `${path}.tmp-${process.pid}`;\n const assignments = Object.entries(environment).map(([key, value]) => `${key}=${shellQuote(value)}`).join(' ');\n const script = `#!/bin/sh\\nLINEAGE_RUNTIME_RECEIPT=${shellQuote(receiptPath)} LINEAGE_RELEASE_CHANNEL=${shellQuote(channel)}${assignments ? ` ${assignments}` : ''} exec ${shellQuote(process.execPath)} ${shellQuote(entrypoint)} \"$@\"\\n`;\n writeFileSync(tempPath, script, { mode: 0o755 });\n chmodSync(tempPath, 0o755);\n renameSync(tempPath, path);\n}\n\nfunction validateExistingReceipt(\n receiptPath: string,\n channel: PublishedChannel,\n expected?: { build: LineageRuntimeBuildIdentity; integrity: string; packageRoot: string; source: ResolvedPackageSpec['source']; version: string },\n): LineageRuntimeInstallReceipt {\n const receipt = JSON.parse(readFileSync(receiptPath, 'utf8')) as LineageRuntimeInstallReceipt;\n if (receipt.schema_version !== lineageRuntimeInstallSchemaVersion || receipt.channel !== channel) throw new Error(`Invalid existing ${channel} runtime receipt`);\n const installed = JSON.parse(readFileSync(join(receipt.package_root, 'package.json'), 'utf8')) as { name: string; version: string };\n const build = validateBuild(receipt.package_root, installed);\n if (receipt.package_name !== installed.name || receipt.package_version !== installed.version) throw new Error(`Existing ${channel} receipt does not match package.json`);\n if (receipt.build_fingerprint !== build.build_fingerprint) throw new Error(`Existing ${channel} receipt does not match embedded build identity`);\n if (packageTreeSha256(receipt.package_root) !== receipt.package_tree_sha256) throw new Error(`Existing ${channel} runtime package tree has changed`);\n if (expected && (\n receipt.package_integrity !== expected.integrity\n || receipt.package_root !== expected.packageRoot\n || receipt.package_source !== expected.source\n || receipt.package_version !== expected.version\n || receipt.build_fingerprint !== expected.build.build_fingerprint\n )) {\n throw new Error(`Existing ${channel} runtime receipt does not match the freshly resolved package`);\n }\n return receipt;\n}\n\nfunction install(channel: PublishedChannel, args: string[]): LineageRuntimeInstallReceipt & { receipt_path: string; service_shim: string; shim: string } {\n const root = resolve(readOption(args, '--root') || runtimeRoot());\n const shimDir = shimDirectory(args, root);\n const requestedSpec = readOption(args, '--package') || `${packageInfo.name}@${channel === 'stable' ? 'latest' : 'next'}`;\n const resolvedSpec = resolveSpec(requestedSpec, args.includes('--allow-local-package'));\n const channelRoot = join(root, 'installs', channel);\n mkdirSync(channelRoot, { recursive: true });\n const stagingRoot = mkdtempSync(join(channelRoot, '.staging-'));\n let keepStaging = false;\n try {\n execFileSync('npm', [\n 'install', '--prefix', stagingRoot, '--ignore-scripts', '--no-audit', '--no-fund', '--package-lock=false', resolvedSpec.installSpec,\n ], { stdio: 'ignore' });\n const stagingPackageRoot = join(stagingRoot, 'node_modules', ...packageInfo.name.split('/'));\n const installed = JSON.parse(readFileSync(join(stagingPackageRoot, 'package.json'), 'utf8')) as { name: string; version: string };\n if (installed.name !== packageInfo.name) throw new Error(`Installed unexpected package ${installed.name}`);\n if (resolvedSpec.expectedVersion && installed.version !== resolvedSpec.expectedVersion) throw new Error(`Installed ${installed.version}, expected ${resolvedSpec.expectedVersion}`);\n const build = validateBuild(stagingPackageRoot, installed);\n const installId = `${installed.version}-${sha256(resolvedSpec.integrity).slice(0, 16)}`;\n const finalRoot = join(channelRoot, installId);\n const finalPackageRoot = join(finalRoot, 'node_modules', ...packageInfo.name.split('/'));\n const receiptPath = join(finalRoot, 'lineage-runtime-receipt.json');\n let receipt: LineageRuntimeInstallReceipt;\n if (existsSync(finalRoot)) {\n receipt = validateExistingReceipt(receiptPath, channel, {\n build,\n integrity: resolvedSpec.integrity,\n packageRoot: finalPackageRoot,\n source: resolvedSpec.source,\n version: installed.version,\n });\n } else {\n const packageTree = packageTreeSha256(stagingPackageRoot);\n renameSync(stagingRoot, finalRoot);\n keepStaging = true;\n receipt = {\n build_fingerprint: build.build_fingerprint,\n channel,\n installed_at: new Date().toISOString(),\n package_integrity: resolvedSpec.integrity,\n package_name: installed.name,\n package_root: finalPackageRoot,\n package_source: resolvedSpec.source,\n package_spec: resolvedSpec.requestedSpec,\n package_tree_sha256: packageTree,\n package_version: installed.version,\n schema_version: lineageRuntimeInstallSchemaVersion,\n };\n writeFileSync(receiptPath, `${JSON.stringify(receipt, null, 2)}\\n`, { mode: 0o600 });\n }\n mkdirSync(shimDir, { recursive: true });\n const shim = join(shimDir, channel === 'stable' ? 'lineage-stable' : 'lineage-preview');\n const entrypoint = join(finalPackageRoot, 'dist', 'cli', channel === 'stable' ? 'lineage.js' : 'lineage-preview.js');\n if (!existsSync(entrypoint)) throw new Error(`Installed package is missing ${entrypoint}`);\n writeShim(shim, channel, receiptPath, entrypoint);\n const serviceShim = join(shimDir, channel === 'stable' ? 'lineage-stable-service' : 'lineage-preview-service');\n const serviceEntrypoint = join(finalPackageRoot, 'dist', 'cli', 'managed-service.js');\n if (!existsSync(serviceEntrypoint)) throw new Error(`Installed package is missing ${serviceEntrypoint}`);\n writeShim(serviceShim, channel, receiptPath, serviceEntrypoint, { LINEAGE_CHANNEL_LAUNCHER: shim });\n const pointerDir = join(root, 'channels');\n mkdirSync(pointerDir, { recursive: true });\n writeFileSync(join(pointerDir, `${channel}.json`), `${JSON.stringify({ channel, receipt_path: receiptPath, service_shim: serviceShim, shim }, null, 2)}\\n`, { mode: 0o600 });\n return { ...receipt, receipt_path: receiptPath, service_shim: serviceShim, shim };\n } finally {\n if (!keepStaging) rmSync(stagingRoot, { force: true, recursive: true });\n }\n}\n\nfunction status(args: string[]): unknown {\n const root = resolve(readOption(args, '--root') || runtimeRoot());\n return Object.fromEntries((['stable', 'preview'] as const).map(channel => {\n const pointerPath = join(root, 'channels', `${channel}.json`);\n if (!existsSync(pointerPath)) return [channel, { installed: false }];\n try {\n const pointer = JSON.parse(readFileSync(pointerPath, 'utf8')) as { receipt_path: string; service_shim: string; shim: string };\n const receipt = validateExistingReceipt(pointer.receipt_path, channel);\n if (!existsSync(pointer.shim) || !existsSync(pointer.service_shim)) throw new Error(`Existing ${channel} runtime shims are missing`);\n return [channel, { installed: true, receipt, receipt_path: pointer.receipt_path, service_shim: pointer.service_shim, shim: pointer.shim }];\n } catch (error) {\n return [channel, { error: error instanceof Error ? error.message : String(error), installed: false }];\n }\n }));\n}\n\nfunction usage(): string {\n return `lineage-channel ${packageInfo.version}\n\nUsage:\n lineage-channel install stable [--root <path>] [--shim-dir <path>] [--package <npm-spec>] [--json]\n lineage-channel install preview [--root <path>] [--shim-dir <path>] [--package <npm-spec>] [--json]\n lineage-channel status [--root <path>] [--json]\n\nStable and preview are installed into separate content-addressed roots. Dev is\ncheckout-only and is started with npm run lineage:dev -- <command>. Local\ntarballs are refused unless --allow-local-package is supplied explicitly.\nDefault installs put launchers in npm's global executable directory, which is\nalready on PATH when lineage-channel is invoked. A custom --root keeps its\nlaunchers under <root>/bin unless --shim-dir is also supplied.`;\n}\n\nfunction print(value: unknown, json: boolean): void {\n if (json) console.log(JSON.stringify(value, null, 2));\n else if (value && typeof value === 'object' && 'shim' in value) {\n const installed = value as { channel: string; package_version: string; service_shim: string; shim: string };\n console.log(`Installed Lineage ${installed.channel} ${installed.package_version}`);\n console.log(`Launcher: ${installed.shim}`);\n console.log(`Service manager: ${installed.service_shim}`);\n } else console.log(JSON.stringify(value, null, 2));\n}\n\nexport function runLineageChannel(args = process.argv.slice(2)): void {\n const json = args.includes('--json');\n try {\n if (args.length === 0 || args.includes('--help') || args.includes('-h')) {\n console.log(usage());\n } else if (args.includes('--version') || args.includes('-v')) {\n console.log(packageInfo.version);\n } else if (args[0] === 'install') {\n print(install(parseChannel(args[1] || readOption(args, '--channel')), args.slice(2)), json);\n } else if (args[0] === 'status') {\n print(status(args.slice(1)), json);\n } else {\n throw new Error(`Unknown lineage-channel command: ${args[0]}`);\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n if (json) console.error(JSON.stringify({ error: message, ok: false }, null, 2));\n else console.error(`lineage-channel: ${message}`);\n process.exitCode = 1;\n }\n}\n\nif (process.argv[1] && realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url))) runLineageChannel();\n", "export type LineageRuntimeChannel = 'stable' | 'preview' | 'dev';\n\nexport const lineageRuntimeBuildSchemaVersion = 'lineage.runtime_build.v1' as const;\nexport const lineageRuntimeInstallSchemaVersion = 'lineage.runtime_install.v1' as const;\n\ntype LineageRuntimeEnvironment = 'production' | 'preview' | 'development';\n\ninterface LineageRuntimeDatabaseInfo {\n error?: string;\n exists: boolean;\n modified_at?: string;\n path: string;\n projects?: number;\n size_bytes?: number;\n workspaces?: number;\n}\n\ninterface LineageRuntimeProfileInfo {\n bound: boolean;\n environment: LineageRuntimeEnvironment;\n fingerprint?: string;\n id: string;\n manifest_path?: string;\n service_origin?: string;\n warning?: string;\n}\n\ninterface LineageRuntimeSchemaInfo {\n migration_keys: string[];\n profile_environment?: LineageRuntimeEnvironment;\n profile_fingerprint?: string;\n profile_id?: string;\n}\n\nexport interface LineageRuntimeBuildIdentity {\n build_fingerprint: string;\n package_name: string;\n package_version: string;\n schema_version: typeof lineageRuntimeBuildSchemaVersion;\n source_dirty: boolean;\n source_fingerprint: string;\n source_git_sha: string;\n}\n\nexport interface LineageRuntimeInstallReceipt {\n build_fingerprint: string;\n channel: Exclude<LineageRuntimeChannel, 'dev'>;\n installed_at: string;\n package_integrity: string;\n package_name: string;\n package_root: string;\n package_source: 'local' | 'registry';\n package_spec: string;\n package_tree_sha256: string;\n package_version: string;\n schema_version: typeof lineageRuntimeInstallSchemaVersion;\n}\n\nexport interface LineageRuntimeCodeIdentity {\n build?: LineageRuntimeBuildIdentity;\n channel: LineageRuntimeChannel;\n dirty?: boolean;\n errors: string[];\n fingerprint: string;\n git_sha?: string;\n install?: LineageRuntimeInstallReceipt & { receipt_path: string };\n origin: 'checkout' | 'package' | 'unknown';\n package_version: string;\n root: string;\n source_fingerprint?: string;\n verified: boolean;\n}\n\nexport interface LineageRuntimeInfo {\n asset_root: string;\n channel: LineageRuntimeChannel;\n code?: LineageRuntimeCodeIdentity;\n database: LineageRuntimeDatabaseInfo;\n fetchedAt: string;\n git_sha?: string;\n node_env?: string;\n package_name: string;\n process?: {\n pid: number;\n role: 'command' | 'service';\n started_at: string;\n };\n profile: LineageRuntimeProfileInfo;\n schema: LineageRuntimeSchemaInfo;\n service?: {\n instance_id?: string;\n mode: 'foreground' | 'managed';\n launcher_pid?: number;\n pid: number;\n started_at: string;\n };\n version: string;\n}\n"],
|
|
4
|
+
"sourcesContent": ["#!/usr/bin/env node\n\nimport { createHash } from 'node:crypto';\nimport { execFileSync } from 'node:child_process';\nimport {\n chmodSync,\n existsSync,\n mkdirSync,\n mkdtempSync,\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 { dirname, join, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport {\n lineageRuntimeBuildSchemaVersion,\n lineageRuntimeInstallSchemaVersion,\n type LineageRuntimeBuildIdentity,\n type LineageRuntimeInstallReceipt,\n} from '../shared/runtimeInfoTypes';\n\ntype PublishedChannel = 'stable' | 'preview';\ninterface ResolvedPackageSpec {\n expectedVersion?: string;\n installSpec: string;\n integrity: string;\n requestedSpec: string;\n source: LineageRuntimeInstallReceipt['package_source'];\n}\n\ninterface RegistryPackageMetadata {\n dist?: { integrity?: unknown };\n 'dist.integrity'?: unknown;\n version?: unknown;\n}\n\nconst packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..', '..');\nconst packageInfo = JSON.parse(readFileSync(join(packageRoot, 'package.json'), 'utf8')) as { name: string; version: string };\n\nfunction sha256(value: string | Buffer): string {\n return createHash('sha256').update(value).digest('hex');\n}\n\nfunction readOption(args: string[], name: string): string | undefined {\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 runtimeRoot(): string {\n if (process.env.LINEAGE_RUNTIME_ROOT) return resolve(process.env.LINEAGE_RUNTIME_ROOT);\n if (platform() === 'darwin') return join(homedir(), 'Library', 'Application Support', 'Lineage', 'runtimes');\n if (platform() === 'win32') return join(process.env.LOCALAPPDATA || join(homedir(), 'AppData', 'Local'), 'Lineage', 'runtimes');\n return join(process.env.XDG_DATA_HOME || join(homedir(), '.local', 'share'), 'lineage', 'runtimes');\n}\n\nfunction globalNpmExecutableDirectory(): string {\n let prefix: string;\n try {\n prefix = execFileSync('npm', ['prefix', '--global'], { encoding: 'utf8' }).trim();\n } catch (error) {\n throw new Error('Could not locate the global npm executable directory; pass --shim-dir explicitly', { cause: error });\n }\n if (!prefix) throw new Error('npm returned an empty global prefix; pass --shim-dir explicitly');\n return platform() === 'win32' ? resolve(prefix) : resolve(prefix, 'bin');\n}\n\nfunction shimDirectory(args: string[], root: string): string {\n const explicit = readOption(args, '--shim-dir');\n if (explicit) return resolve(explicit);\n if (readOption(args, '--root') || process.env.LINEAGE_RUNTIME_ROOT) return join(root, 'bin');\n return globalNpmExecutableDirectory();\n}\n\nfunction parseChannel(value?: string): PublishedChannel {\n if (value === 'stable' || value === 'preview') return value;\n throw new Error('Channel must be stable or preview; dev is checkout-only');\n}\n\nfunction packageTreeSha256(root: string): string {\n const hash = createHash('sha256');\n const visit = (directory: string, 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(root);\n return hash.digest('hex');\n}\n\nfunction expectedBuildFingerprint(build: Omit<LineageRuntimeBuildIdentity, 'build_fingerprint'>): string {\n return sha256(JSON.stringify({\n package_name: build.package_name,\n package_version: build.package_version,\n schema_version: build.schema_version,\n source_dirty: build.source_dirty,\n source_fingerprint: build.source_fingerprint,\n source_git_sha: build.source_git_sha,\n }));\n}\n\nfunction validateBuild(root: string, installed: { name: string; version: string }): LineageRuntimeBuildIdentity {\n const path = join(root, 'dist', 'runtime-build.json');\n const build = JSON.parse(readFileSync(path, 'utf8')) as LineageRuntimeBuildIdentity;\n if (build.schema_version !== lineageRuntimeBuildSchemaVersion) throw new Error(`Unsupported build identity schema in ${path}`);\n if (build.package_name !== installed.name || build.package_version !== installed.version) throw new Error('Embedded build identity does not match installed package.json');\n if (!/^[a-f0-9]{40}$/i.test(build.source_git_sha)) throw new Error('Embedded build Git revision is invalid');\n if (!/^[a-f0-9]{64}$/i.test(build.source_fingerprint)) throw new Error('Embedded source fingerprint is invalid');\n if (build.build_fingerprint !== expectedBuildFingerprint(build)) throw new Error('Embedded build fingerprint does not match its contents');\n if (build.source_dirty) throw new Error('Refusing stable/preview installation of a dirty-source build');\n return build;\n}\n\nexport function parseRegistryPackageMetadata(value: unknown): { integrity: string; version: string } {\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n throw new Error('npm metadata was not a JSON object');\n }\n const metadata = value as RegistryPackageMetadata;\n const nestedIntegrity = metadata.dist?.integrity;\n const flatIntegrity = metadata['dist.integrity'];\n if (\n typeof nestedIntegrity === 'string'\n && typeof flatIntegrity === 'string'\n && nestedIntegrity !== flatIntegrity\n ) {\n throw new Error('npm metadata returned conflicting integrity values');\n }\n const integrity = typeof nestedIntegrity === 'string' ? nestedIntegrity : flatIntegrity;\n if (typeof metadata.version !== 'string' || !metadata.version || typeof integrity !== 'string' || !integrity) {\n throw new Error('npm metadata did not include exact version and integrity');\n }\n return { integrity, version: metadata.version };\n}\n\nfunction resolveSpec(spec: string, allowLocalPackage: boolean): ResolvedPackageSpec {\n const localPath = resolve(spec.replace(/^file:/, ''));\n if (existsSync(localPath)) {\n if (!allowLocalPackage) {\n throw new Error('Local package paths require --allow-local-package; normal stable/preview installs must resolve from the npm registry');\n }\n return {\n installSpec: localPath,\n integrity: `sha512-${createHash('sha512').update(readFileSync(localPath)).digest('base64')}`,\n requestedSpec: spec,\n source: 'local',\n };\n }\n let metadata: { integrity: string; version: string };\n try {\n metadata = parseRegistryPackageMetadata(JSON.parse(execFileSync('npm', ['view', spec, 'version', 'dist.integrity', '--json'], { encoding: 'utf8' })));\n } catch (error) {\n throw new Error(`npm metadata for ${spec} did not include exact version and integrity`, { cause: error });\n }\n const name = spec.startsWith('@') ? spec.slice(0, spec.indexOf('@', 1)) : spec.split('@')[0];\n return {\n installSpec: `${name}@${metadata.version}`,\n integrity: metadata.integrity,\n expectedVersion: metadata.version,\n requestedSpec: spec,\n source: 'registry',\n };\n}\n\nfunction shellQuote(value: string): string {\n return `'${value.replaceAll(\"'\", \"'\\\\''\")}'`;\n}\n\nfunction writeShim(\n path: string,\n channel: PublishedChannel,\n receiptPath: string,\n entrypoint: string,\n environment: Record<string, string> = {},\n): void {\n const tempPath = `${path}.tmp-${process.pid}`;\n const assignments = Object.entries(environment).map(([key, value]) => `${key}=${shellQuote(value)}`).join(' ');\n const script = `#!/bin/sh\\nLINEAGE_RUNTIME_RECEIPT=${shellQuote(receiptPath)} LINEAGE_RELEASE_CHANNEL=${shellQuote(channel)}${assignments ? ` ${assignments}` : ''} exec ${shellQuote(process.execPath)} ${shellQuote(entrypoint)} \"$@\"\\n`;\n writeFileSync(tempPath, script, { mode: 0o755 });\n chmodSync(tempPath, 0o755);\n renameSync(tempPath, path);\n}\n\nfunction validateExistingReceipt(\n receiptPath: string,\n channel: PublishedChannel,\n expected?: { build: LineageRuntimeBuildIdentity; integrity: string; packageRoot: string; source: ResolvedPackageSpec['source']; version: string },\n): LineageRuntimeInstallReceipt {\n const receipt = JSON.parse(readFileSync(receiptPath, 'utf8')) as LineageRuntimeInstallReceipt;\n if (receipt.schema_version !== lineageRuntimeInstallSchemaVersion || receipt.channel !== channel) throw new Error(`Invalid existing ${channel} runtime receipt`);\n const installed = JSON.parse(readFileSync(join(receipt.package_root, 'package.json'), 'utf8')) as { name: string; version: string };\n const build = validateBuild(receipt.package_root, installed);\n if (receipt.package_name !== installed.name || receipt.package_version !== installed.version) throw new Error(`Existing ${channel} receipt does not match package.json`);\n if (receipt.build_fingerprint !== build.build_fingerprint) throw new Error(`Existing ${channel} receipt does not match embedded build identity`);\n if (packageTreeSha256(receipt.package_root) !== receipt.package_tree_sha256) throw new Error(`Existing ${channel} runtime package tree has changed`);\n if (expected && (\n receipt.package_integrity !== expected.integrity\n || receipt.package_root !== expected.packageRoot\n || receipt.package_source !== expected.source\n || receipt.package_version !== expected.version\n || receipt.build_fingerprint !== expected.build.build_fingerprint\n )) {\n throw new Error(`Existing ${channel} runtime receipt does not match the freshly resolved package`);\n }\n return receipt;\n}\n\nfunction install(channel: PublishedChannel, args: string[]): LineageRuntimeInstallReceipt & { receipt_path: string; service_shim: string; shim: string } {\n const root = resolve(readOption(args, '--root') || runtimeRoot());\n const shimDir = shimDirectory(args, root);\n const requestedSpec = readOption(args, '--package') || `${packageInfo.name}@${channel === 'stable' ? 'latest' : 'next'}`;\n const resolvedSpec = resolveSpec(requestedSpec, args.includes('--allow-local-package'));\n const channelRoot = join(root, 'installs', channel);\n mkdirSync(channelRoot, { recursive: true });\n const stagingRoot = mkdtempSync(join(channelRoot, '.staging-'));\n let keepStaging = false;\n try {\n execFileSync('npm', [\n 'install', '--prefix', stagingRoot, '--ignore-scripts', '--no-audit', '--no-fund', '--package-lock=false', resolvedSpec.installSpec,\n ], { stdio: 'ignore' });\n const stagingPackageRoot = join(stagingRoot, 'node_modules', ...packageInfo.name.split('/'));\n const installed = JSON.parse(readFileSync(join(stagingPackageRoot, 'package.json'), 'utf8')) as { name: string; version: string };\n if (installed.name !== packageInfo.name) throw new Error(`Installed unexpected package ${installed.name}`);\n if (resolvedSpec.expectedVersion && installed.version !== resolvedSpec.expectedVersion) throw new Error(`Installed ${installed.version}, expected ${resolvedSpec.expectedVersion}`);\n const build = validateBuild(stagingPackageRoot, installed);\n const installId = `${installed.version}-${sha256(resolvedSpec.integrity).slice(0, 16)}`;\n const finalRoot = join(channelRoot, installId);\n const finalPackageRoot = join(finalRoot, 'node_modules', ...packageInfo.name.split('/'));\n const receiptPath = join(finalRoot, 'lineage-runtime-receipt.json');\n let receipt: LineageRuntimeInstallReceipt;\n if (existsSync(finalRoot)) {\n receipt = validateExistingReceipt(receiptPath, channel, {\n build,\n integrity: resolvedSpec.integrity,\n packageRoot: finalPackageRoot,\n source: resolvedSpec.source,\n version: installed.version,\n });\n } else {\n const packageTree = packageTreeSha256(stagingPackageRoot);\n renameSync(stagingRoot, finalRoot);\n keepStaging = true;\n receipt = {\n build_fingerprint: build.build_fingerprint,\n channel,\n installed_at: new Date().toISOString(),\n package_integrity: resolvedSpec.integrity,\n package_name: installed.name,\n package_root: finalPackageRoot,\n package_source: resolvedSpec.source,\n package_spec: resolvedSpec.requestedSpec,\n package_tree_sha256: packageTree,\n package_version: installed.version,\n schema_version: lineageRuntimeInstallSchemaVersion,\n };\n writeFileSync(receiptPath, `${JSON.stringify(receipt, null, 2)}\\n`, { mode: 0o600 });\n }\n mkdirSync(shimDir, { recursive: true });\n const shim = join(shimDir, channel === 'stable' ? 'lineage-stable' : 'lineage-preview');\n const entrypoint = join(finalPackageRoot, 'dist', 'cli', channel === 'stable' ? 'lineage.js' : 'lineage-preview.js');\n if (!existsSync(entrypoint)) throw new Error(`Installed package is missing ${entrypoint}`);\n writeShim(shim, channel, receiptPath, entrypoint);\n const serviceShim = join(shimDir, channel === 'stable' ? 'lineage-stable-service' : 'lineage-preview-service');\n const serviceEntrypoint = join(finalPackageRoot, 'dist', 'cli', 'managed-service.js');\n if (!existsSync(serviceEntrypoint)) throw new Error(`Installed package is missing ${serviceEntrypoint}`);\n writeShim(serviceShim, channel, receiptPath, serviceEntrypoint, { LINEAGE_CHANNEL_LAUNCHER: shim });\n const pointerDir = join(root, 'channels');\n mkdirSync(pointerDir, { recursive: true });\n writeFileSync(join(pointerDir, `${channel}.json`), `${JSON.stringify({ channel, receipt_path: receiptPath, service_shim: serviceShim, shim }, null, 2)}\\n`, { mode: 0o600 });\n return { ...receipt, receipt_path: receiptPath, service_shim: serviceShim, shim };\n } finally {\n if (!keepStaging) rmSync(stagingRoot, { force: true, recursive: true });\n }\n}\n\nfunction status(args: string[]): unknown {\n const root = resolve(readOption(args, '--root') || runtimeRoot());\n return Object.fromEntries((['stable', 'preview'] as const).map(channel => {\n const pointerPath = join(root, 'channels', `${channel}.json`);\n if (!existsSync(pointerPath)) return [channel, { installed: false }];\n try {\n const pointer = JSON.parse(readFileSync(pointerPath, 'utf8')) as { receipt_path: string; service_shim: string; shim: string };\n const receipt = validateExistingReceipt(pointer.receipt_path, channel);\n if (!existsSync(pointer.shim) || !existsSync(pointer.service_shim)) throw new Error(`Existing ${channel} runtime shims are missing`);\n return [channel, { installed: true, receipt, receipt_path: pointer.receipt_path, service_shim: pointer.service_shim, shim: pointer.shim }];\n } catch (error) {\n return [channel, { error: error instanceof Error ? error.message : String(error), installed: false }];\n }\n }));\n}\n\nfunction usage(): string {\n return `lineage-channel ${packageInfo.version}\n\nUsage:\n lineage-channel install stable [--root <path>] [--shim-dir <path>] [--package <npm-spec>] [--json]\n lineage-channel install preview [--root <path>] [--shim-dir <path>] [--package <npm-spec>] [--json]\n lineage-channel status [--root <path>] [--json]\n\nStable and preview are installed into separate content-addressed roots. Dev is\ncheckout-only and is started with npm run lineage:dev -- <command>. Local\ntarballs are refused unless --allow-local-package is supplied explicitly.\nDefault installs put launchers in npm's global executable directory, which is\nalready on PATH when lineage-channel is invoked. A custom --root keeps its\nlaunchers under <root>/bin unless --shim-dir is also supplied.`;\n}\n\nfunction print(value: unknown, json: boolean): void {\n if (json) console.log(JSON.stringify(value, null, 2));\n else if (value && typeof value === 'object' && 'shim' in value) {\n const installed = value as { channel: string; package_version: string; service_shim: string; shim: string };\n console.log(`Installed Lineage ${installed.channel} ${installed.package_version}`);\n console.log(`Launcher: ${installed.shim}`);\n console.log(`Service manager: ${installed.service_shim}`);\n } else console.log(JSON.stringify(value, null, 2));\n}\n\nexport function runLineageChannel(args = process.argv.slice(2)): void {\n const json = args.includes('--json');\n try {\n if (args.length === 0 || args.includes('--help') || args.includes('-h')) {\n console.log(usage());\n } else if (args.includes('--version') || args.includes('-v')) {\n console.log(packageInfo.version);\n } else if (args[0] === 'install') {\n print(install(parseChannel(args[1] || readOption(args, '--channel')), args.slice(2)), json);\n } else if (args[0] === 'status') {\n print(status(args.slice(1)), json);\n } else {\n throw new Error(`Unknown lineage-channel command: ${args[0]}`);\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n if (json) console.error(JSON.stringify({ error: message, ok: false }, null, 2));\n else console.error(`lineage-channel: ${message}`);\n process.exitCode = 1;\n }\n}\n\nif (process.argv[1] && realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url))) runLineageChannel();\n", "export type LineageRuntimeChannel = 'stable' | 'preview' | 'dev';\n\nexport const lineageRuntimeBuildSchemaVersion = 'lineage.runtime_build.v1' as const;\nexport const lineageRuntimeInstallSchemaVersion = 'lineage.runtime_install.v1' as const;\n\ntype LineageRuntimeEnvironment = 'production' | 'preview' | 'development';\n\ninterface LineageRuntimeDatabaseInfo {\n error?: string;\n exists: boolean;\n modified_at?: string;\n path: string;\n projects?: number;\n size_bytes?: number;\n workspaces?: number;\n}\n\ninterface LineageRuntimeProfileInfo {\n bound: boolean;\n environment: LineageRuntimeEnvironment;\n fingerprint?: string;\n id: string;\n manifest_path?: string;\n service_origin?: string;\n warning?: string;\n}\n\ninterface LineageRuntimeSchemaInfo {\n migration_keys: string[];\n profile_environment?: LineageRuntimeEnvironment;\n profile_fingerprint?: string;\n profile_id?: string;\n}\n\nexport interface LineageRuntimeBuildIdentity {\n build_fingerprint: string;\n package_name: string;\n package_version: string;\n schema_version: typeof lineageRuntimeBuildSchemaVersion;\n source_dirty: boolean;\n source_fingerprint: string;\n source_git_sha: string;\n}\n\nexport interface LineageRuntimeInstallReceipt {\n build_fingerprint: string;\n channel: Exclude<LineageRuntimeChannel, 'dev'>;\n installed_at: string;\n package_integrity: string;\n package_name: string;\n package_root: string;\n package_source: 'local' | 'registry';\n package_spec: string;\n package_tree_sha256: string;\n package_version: string;\n schema_version: typeof lineageRuntimeInstallSchemaVersion;\n}\n\nexport interface LineageRuntimeCodeIdentity {\n build?: LineageRuntimeBuildIdentity;\n channel: LineageRuntimeChannel;\n dirty?: boolean;\n errors: string[];\n fingerprint: string;\n git_sha?: string;\n install?: LineageRuntimeInstallReceipt & { receipt_path: string };\n origin: 'checkout' | 'package' | 'unknown';\n package_version: string;\n root: string;\n source_fingerprint?: string;\n verified: boolean;\n}\n\nexport interface LineageRuntimeInfo {\n asset_root: string;\n channel: LineageRuntimeChannel;\n cli: {\n launcher: string;\n runtime_selector: string;\n };\n code?: LineageRuntimeCodeIdentity;\n database: LineageRuntimeDatabaseInfo;\n fetchedAt: string;\n git_sha?: string;\n node_env?: string;\n package_name: string;\n process?: {\n pid: number;\n role: 'command' | 'service';\n started_at: string;\n };\n profile: LineageRuntimeProfileInfo;\n schema: LineageRuntimeSchemaInfo;\n service?: {\n instance_id?: string;\n mode: 'foreground' | 'managed';\n launcher_pid?: number;\n pid: number;\n started_at: string;\n };\n version: string;\n}\n"],
|
|
5
5
|
"mappings": ";;;AAEA,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B;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,SAAS,MAAM,eAAe;AACvC,SAAS,qBAAqB;;;ACjBvB,IAAM,mCAAmC;AACzC,IAAM,qCAAqC;;;ADuClD,IAAM,cAAc,QAAQ,QAAQ,cAAc,YAAY,GAAG,CAAC,GAAG,MAAM,IAAI;AAC/E,IAAM,cAAc,KAAK,MAAM,aAAa,KAAK,aAAa,cAAc,GAAG,MAAM,CAAC;AAEtF,SAAS,OAAO,OAAgC;AAC9C,SAAO,WAAW,QAAQ,EAAE,OAAO,KAAK,EAAE,OAAO,KAAK;AACxD;AAEA,SAAS,WAAW,MAAgB,MAAkC;AACpE,QAAM,SAAS,KAAK,KAAK,SAAO,IAAI,WAAW,GAAG,IAAI,GAAG,CAAC;AAC1D,MAAI,OAAQ,QAAO,OAAO,MAAM,KAAK,SAAS,CAAC;AAC/C,QAAM,QAAQ,KAAK,QAAQ,IAAI;AAC/B,SAAO,SAAS,IAAI,KAAK,QAAQ,CAAC,IAAI;AACxC;AAEA,SAAS,cAAsB;AAC7B,MAAI,QAAQ,IAAI,qBAAsB,QAAO,QAAQ,QAAQ,IAAI,oBAAoB;AACrF,MAAI,SAAS,MAAM,SAAU,QAAO,KAAK,QAAQ,GAAG,WAAW,uBAAuB,WAAW,UAAU;AAC3G,MAAI,SAAS,M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ACvE,cAAQ,IAAI,MAAM,CAAC;AAAA,IACrB,WAAW,KAAK,SAAS,WAAW,KAAK,KAAK,SAAS,IAAI,GAAG;AAC5D,cAAQ,IAAI,YAAY,OAAO;AAAA,IACjC,WAAW,KAAK,CAAC,MAAM,WAAW;AAChC,YAAM,QAAQ,aAAa,KAAK,CAAC,KAAK,WAAW,MAAM,WAAW,CAAC,GAAG,KAAK,MAAM,CAAC,CAAC,GAAG,IAAI;AAAA,IAC5F,WAAW,KAAK,CAAC,MAAM,UAAU;AAC/B,YAAM,OAAO,KAAK,MAAM,CAAC,CAAC,GAAG,IAAI;AAAA,IACnC,OAAO;AACL,YAAM,IAAI,MAAM,oCAAoC,KAAK,CAAC,CAAC,EAAE;AAAA,IAC/D;AAAA,EACF,SAAS,OAAO;AACd,UAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACrE,QAAI,KAAM,SAAQ,MAAM,KAAK,UAAU,EAAE,OAAO,SAAS,IAAI,MAAM,GAAG,MAAM,CAAC,CAAC;AAAA,QACzE,SAAQ,MAAM,oBAAoB,OAAO,EAAE;AAChD,YAAQ,WAAW;AAAA,EACrB;AACF;AAEA,IAAI,QAAQ,KAAK,CAAC,KAAK,aAAa,QAAQ,KAAK,CAAC,CAAC,MAAM,aAAa,cAAc,YAAY,GAAG,CAAC,EAAG,mBAAkB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cli/lineage-dev.js
CHANGED
|
@@ -38,7 +38,6 @@ function requireEdgeSummary(value) {
|
|
|
38
38
|
import { createHash as createHash4, randomBytes, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
|
|
39
39
|
|
|
40
40
|
// src/server/assetLineageDb.ts
|
|
41
|
-
import { createRequire as createRequire2 } from "node:module";
|
|
42
41
|
import { existsSync as existsSync6, mkdirSync as mkdirSync5 } from "node:fs";
|
|
43
42
|
import { join as join6 } from "node:path";
|
|
44
43
|
|
|
@@ -621,7 +620,6 @@ import { dirname as dirname4, join as join5, resolve as resolve4 } from "node:pa
|
|
|
621
620
|
|
|
622
621
|
// src/server/lineageProfiles.ts
|
|
623
622
|
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
624
|
-
import { createRequire } from "node:module";
|
|
625
623
|
import {
|
|
626
624
|
chmodSync as chmodSync2,
|
|
627
625
|
closeSync,
|
|
@@ -651,8 +649,26 @@ var lineageProfileCloneReceiptSchemaVersion = "lineage.profile_clone_receipt.v1"
|
|
|
651
649
|
var lineageProfileAssetsCloneReceiptSchemaVersion = "lineage.profile_assets_clone_receipt.v1";
|
|
652
650
|
var lineageProfileRuntimeRepinReceiptSchemaVersion = "lineage.profile_runtime_repin_receipt.v1";
|
|
653
651
|
|
|
654
|
-
// src/server/
|
|
652
|
+
// src/server/nodeSqlite.ts
|
|
653
|
+
import { createRequire } from "node:module";
|
|
655
654
|
var require2 = createRequire(import.meta.url);
|
|
655
|
+
var sqliteExperimentalWarning = "SQLite is an experimental feature and might change at any time";
|
|
656
|
+
function loadNodeSqlite() {
|
|
657
|
+
const emitWarning = process.emitWarning;
|
|
658
|
+
process.emitWarning = ((warning, ...args) => {
|
|
659
|
+
const message = warning instanceof Error ? warning.message : warning;
|
|
660
|
+
const type = typeof args[0] === "string" ? args[0] : warning instanceof Error ? warning.name : void 0;
|
|
661
|
+
if (message === sqliteExperimentalWarning && type === "ExperimentalWarning") return;
|
|
662
|
+
return Reflect.apply(emitWarning, process, [warning, ...args]);
|
|
663
|
+
});
|
|
664
|
+
try {
|
|
665
|
+
return require2("node:sqlite");
|
|
666
|
+
} finally {
|
|
667
|
+
process.emitWarning = emitWarning;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
// src/server/lineageProfiles.ts
|
|
656
672
|
var profileIdPattern = /^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/;
|
|
657
673
|
function lineageDataRoot() {
|
|
658
674
|
if (process.env.LINEAGE_HOME) return resolve3(process.env.LINEAGE_HOME);
|
|
@@ -850,7 +866,7 @@ function initializeLineageProfile(profileId, serviceOrigin, runtime, confirmWrit
|
|
|
850
866
|
mkdirSync3(assetRoot, { mode: 448 });
|
|
851
867
|
const databaseFd = openSync(databasePath, fsConstants.O_CREAT | fsConstants.O_EXCL | fsConstants.O_RDWR, 384);
|
|
852
868
|
closeSync(databaseFd);
|
|
853
|
-
const { DatabaseSync } =
|
|
869
|
+
const { DatabaseSync } = loadNodeSqlite();
|
|
854
870
|
const database = new DatabaseSync(databasePath);
|
|
855
871
|
let boundIdentity;
|
|
856
872
|
try {
|
|
@@ -1068,7 +1084,7 @@ function inspectDatabase(profile) {
|
|
|
1068
1084
|
};
|
|
1069
1085
|
if (!result.exists) return result;
|
|
1070
1086
|
try {
|
|
1071
|
-
const { DatabaseSync } =
|
|
1087
|
+
const { DatabaseSync } = loadNodeSqlite();
|
|
1072
1088
|
const database = new DatabaseSync(profile.database_path, { readOnly: true });
|
|
1073
1089
|
try {
|
|
1074
1090
|
if (tableExists(database, "lineage_profile_identity")) {
|
|
@@ -1287,7 +1303,7 @@ function bindLineageProfileDatabase(selector, runtime, confirmWrite) {
|
|
|
1287
1303
|
assertProfileChannel(profile, runtime.channel);
|
|
1288
1304
|
assertProfileRuntimePin(profile, runtime);
|
|
1289
1305
|
if (!existsSync4(profile.database_path)) throw new Error(`Profile database does not exist: ${profile.database_path}`);
|
|
1290
|
-
const { DatabaseSync } =
|
|
1306
|
+
const { DatabaseSync } = loadNodeSqlite();
|
|
1291
1307
|
const database = new DatabaseSync(profile.database_path);
|
|
1292
1308
|
try {
|
|
1293
1309
|
const before = inspectDatabase(profile).identity;
|
|
@@ -1317,7 +1333,7 @@ async function cloneLineageProfileDatabase(sourceDatabasePath, targetSelector, r
|
|
|
1317
1333
|
const temporaryPath = `${targetPath}.clone-${randomUUID()}.tmp`;
|
|
1318
1334
|
const receiptDirectory = join4(dirname3(profile.manifest_path), "clone-receipts");
|
|
1319
1335
|
let targetCreated = false;
|
|
1320
|
-
const { DatabaseSync, backup } =
|
|
1336
|
+
const { DatabaseSync, backup } = loadNodeSqlite();
|
|
1321
1337
|
const source = new DatabaseSync(sourcePath, { readOnly: true });
|
|
1322
1338
|
try {
|
|
1323
1339
|
const pagesCopied = await backup(source, temporaryPath);
|
|
@@ -1408,7 +1424,7 @@ function cloneLineageProfileAssets(sourceAssetRoot, targetSelector, runtime, con
|
|
|
1408
1424
|
if (databaseIdentity && (databaseIdentity.profile_id !== profile.profile_id || databaseIdentity.environment !== profile.environment || databaseIdentity.profile_fingerprint && databaseIdentity.profile_fingerprint !== profile.profile_fingerprint)) {
|
|
1409
1425
|
throw new Error(`Profile database is already bound to ${databaseIdentity.profile_id}/${databaseIdentity.environment}`);
|
|
1410
1426
|
}
|
|
1411
|
-
const { DatabaseSync } =
|
|
1427
|
+
const { DatabaseSync } = loadNodeSqlite();
|
|
1412
1428
|
const database = new DatabaseSync(profile.database_path, { readOnly: true });
|
|
1413
1429
|
let references;
|
|
1414
1430
|
try {
|
|
@@ -1701,7 +1717,6 @@ function getProfileWriterDelegation(profile) {
|
|
|
1701
1717
|
}
|
|
1702
1718
|
|
|
1703
1719
|
// src/server/assetLineageDb.ts
|
|
1704
|
-
var require3 = createRequire2(import.meta.url);
|
|
1705
1720
|
function nowIso() {
|
|
1706
1721
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
1707
1722
|
}
|
|
@@ -1715,7 +1730,7 @@ function lineageDb() {
|
|
|
1715
1730
|
throw new Error(`Refusing writable open of missing profile database ${lineageDbPath()}; bind an existing database or create a non-production clone first`);
|
|
1716
1731
|
}
|
|
1717
1732
|
if (!readOnly) mkdirSync5(join6(lineageDbPath(), ".."), { recursive: true });
|
|
1718
|
-
const { DatabaseSync } =
|
|
1733
|
+
const { DatabaseSync } = loadNodeSqlite();
|
|
1719
1734
|
const database = readOnly ? new DatabaseSync(lineageDbPath(), { readOnly: true }) : new DatabaseSync(lineageDbPath());
|
|
1720
1735
|
if (process.env.LINEAGE_PROFILE) assertSelectedProfileDatabaseIdentity(database);
|
|
1721
1736
|
database.exec("PRAGMA foreign_keys = ON");
|
|
@@ -4217,32 +4232,38 @@ function clearLineageRerollRequest(project, fields) {
|
|
|
4217
4232
|
|
|
4218
4233
|
// src/server/lineageRuntimeCommand.ts
|
|
4219
4234
|
import { existsSync as existsSync7 } from "node:fs";
|
|
4220
|
-
import { createRequire as
|
|
4235
|
+
import { createRequire as createRequire2 } from "node:module";
|
|
4221
4236
|
import { join as join8 } from "node:path";
|
|
4222
|
-
var
|
|
4223
|
-
function
|
|
4224
|
-
if (
|
|
4237
|
+
var require3 = createRequire2(import.meta.url);
|
|
4238
|
+
function lineageCliLauncher(channel = process.env.LINEAGE_CHANNEL) {
|
|
4239
|
+
if (channel === "dev") {
|
|
4225
4240
|
const sourceCli = join8(packageRoot, "src", "cli", "lineage-dev.ts");
|
|
4226
4241
|
const builtCli = join8(packageRoot, "dist", "cli", "lineage-dev.js");
|
|
4227
|
-
return existsSync7(sourceCli) ? `${shellQuote(process.execPath)} --import ${shellQuote(
|
|
4242
|
+
return existsSync7(sourceCli) ? `${shellQuote(process.execPath)} --import ${shellQuote(require3.resolve("tsx"))} ${shellQuote(sourceCli)}` : `${shellQuote(process.execPath)} ${shellQuote(builtCli)}`;
|
|
4228
4243
|
}
|
|
4229
|
-
if (
|
|
4230
|
-
return "
|
|
4244
|
+
if (channel === "preview") return "lineage-preview";
|
|
4245
|
+
if (channel === "stable") return "lineage-stable";
|
|
4246
|
+
throw new Error("LINEAGE_CHANNEL must be stable, preview, or dev before generating a Lineage command");
|
|
4231
4247
|
}
|
|
4232
4248
|
function shellQuote(value) {
|
|
4233
4249
|
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
4234
4250
|
}
|
|
4235
|
-
function lineageRuntimeSelector() {
|
|
4251
|
+
function lineageRuntimeSelector(databasePath) {
|
|
4236
4252
|
const manifest = process.env.LINEAGE_PROFILE_MANIFEST?.trim();
|
|
4237
|
-
|
|
4253
|
+
const database = databasePath || process.env.LINEAGE_DB || join8(packageRoot, ".lineage", "asset-lineage.sqlite");
|
|
4254
|
+
return manifest ? `--profile ${shellQuote(manifest)}` : `--db ${shellQuote(database)}`;
|
|
4255
|
+
}
|
|
4256
|
+
function lineageCliCommand(command) {
|
|
4257
|
+
const normalized = command.trim().replace(/\s+--json$/, "");
|
|
4258
|
+
return `${lineageCliLauncher()} ${normalized} ${lineageRuntimeSelector()} --json`;
|
|
4238
4259
|
}
|
|
4239
4260
|
|
|
4240
4261
|
// src/server/assetLineageHandoff.ts
|
|
4241
4262
|
function lineageCommand(command, project, rootAssetId) {
|
|
4242
|
-
return `${
|
|
4263
|
+
return lineageCliCommand(`${command} --project ${shellQuote(project)} --root ${shellQuote(rootAssetId)}`);
|
|
4243
4264
|
}
|
|
4244
4265
|
function linkChildCommand(project, rootAssetId) {
|
|
4245
|
-
return
|
|
4266
|
+
return lineageCliCommand(`link-child --project ${shellQuote(project)} --root ${shellQuote(rootAssetId)} --child <asset-id> --summary "<one-or-two-words>" --confirm-write`);
|
|
4246
4267
|
}
|
|
4247
4268
|
function rerollImportGuidance(rootAssetId, targetAssetId) {
|
|
4248
4269
|
return `Use lineage reroll plan --root ${rootAssetId} --target ${targetAssetId} and lineage reroll import instead.`;
|
|
@@ -4284,7 +4305,7 @@ function getLineageBrief(project, rootAssetId) {
|
|
|
4284
4305
|
},
|
|
4285
4306
|
handoff: {
|
|
4286
4307
|
next_command: lineageCommand("next", project, next.root_asset_id),
|
|
4287
|
-
inspect_command: asset ?
|
|
4308
|
+
inspect_command: asset ? lineageCliCommand(`inspect --project ${shellQuote(project)} --asset-id ${shellQuote(asset.asset_id)}`) : void 0,
|
|
4288
4309
|
link_child_command: asset ? linkChildCommand(project, next.root_asset_id) : void 0
|
|
4289
4310
|
},
|
|
4290
4311
|
fetchedAt: nowIso()
|
|
@@ -4523,7 +4544,7 @@ function buildHandoff(project, id, prompt, count, perBaseCount, next, inputs) {
|
|
|
4523
4544
|
if (!parent) throw new GenerationReceiptError("Missing lineage next base");
|
|
4524
4545
|
const parents = parentMappings(next, perBaseCount);
|
|
4525
4546
|
const outputManifest = createGenerationOutputManifestDraft({ id, expected_output_count: count, inputs });
|
|
4526
|
-
const importCommand =
|
|
4547
|
+
const importCommand = lineageCliCommand(`generate image import --project ${quote(project)} --job-id ${quote(id)} --manifest ${quote(".asset-scratch/generation-output-manifest.json")} --confirm-write`);
|
|
4527
4548
|
return {
|
|
4528
4549
|
schema_version: "lineage.generation_handoff.v2",
|
|
4529
4550
|
provider,
|
|
@@ -4560,7 +4581,7 @@ function buildHandoff(project, id, prompt, count, perBaseCount, next, inputs) {
|
|
|
4560
4581
|
};
|
|
4561
4582
|
}
|
|
4562
4583
|
function buildRerollHandoff(project, id, prompt, rootAssetId, target, request) {
|
|
4563
|
-
const importCommand =
|
|
4584
|
+
const importCommand = lineageCliCommand(`reroll import --project ${quote(project)} --job-id ${quote(id)} --file <.asset-scratch-file> --confirm-write`);
|
|
4564
4585
|
return {
|
|
4565
4586
|
schema_version: "lineage.generation_handoff.v1",
|
|
4566
4587
|
provider,
|
|
@@ -5634,7 +5655,6 @@ function getLineageSelectionPacket(project, options = {}) {
|
|
|
5634
5655
|
// src/server/runtimeInfo.ts
|
|
5635
5656
|
import { createHash as createHash6 } from "node:crypto";
|
|
5636
5657
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
5637
|
-
import { createRequire as createRequire4 } from "node:module";
|
|
5638
5658
|
import { existsSync as existsSync10, lstatSync as lstatSync3, readFileSync as readFileSync5, readdirSync as readdirSync3, readlinkSync, realpathSync as realpathSync3, statSync as statSync6 } from "node:fs";
|
|
5639
5659
|
import { dirname as dirname5, isAbsolute as isAbsolute3, join as join9, resolve as resolve7 } from "node:path";
|
|
5640
5660
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
@@ -5644,7 +5664,6 @@ var lineageRuntimeBuildSchemaVersion = "lineage.runtime_build.v1";
|
|
|
5644
5664
|
var lineageRuntimeInstallSchemaVersion = "lineage.runtime_install.v1";
|
|
5645
5665
|
|
|
5646
5666
|
// src/server/runtimeInfo.ts
|
|
5647
|
-
var require5 = createRequire4(import.meta.url);
|
|
5648
5667
|
var processStartedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5649
5668
|
function isLineagePackageRoot(root) {
|
|
5650
5669
|
try {
|
|
@@ -5908,7 +5927,7 @@ function getLineageRuntimeInfo(options = {}) {
|
|
|
5908
5927
|
const stat = statSync6(dbPath);
|
|
5909
5928
|
databaseInfo.modified_at = stat.mtime.toISOString();
|
|
5910
5929
|
databaseInfo.size_bytes = stat.size;
|
|
5911
|
-
const { DatabaseSync } =
|
|
5930
|
+
const { DatabaseSync } = loadNodeSqlite();
|
|
5912
5931
|
const database = new DatabaseSync(dbPath, { readOnly: true });
|
|
5913
5932
|
try {
|
|
5914
5933
|
databaseInfo.projects = tableCount(database, "projects");
|
|
@@ -5934,6 +5953,10 @@ function getLineageRuntimeInfo(options = {}) {
|
|
|
5934
5953
|
return {
|
|
5935
5954
|
asset_root: repoRoot,
|
|
5936
5955
|
channel,
|
|
5956
|
+
cli: {
|
|
5957
|
+
launcher: lineageCliLauncher(channel),
|
|
5958
|
+
runtime_selector: lineageRuntimeSelector(dbPath)
|
|
5959
|
+
},
|
|
5937
5960
|
code,
|
|
5938
5961
|
database: databaseInfo,
|
|
5939
5962
|
fetchedAt: nowIso(),
|