@mcmcjs/julia 0.4.0 → 0.6.0
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/dist/driver.jl +10 -214
- package/dist/fitlib.jl +289 -0
- package/dist/index.cjs +403 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +82 -16
- package/dist/index.d.ts +82 -16
- package/dist/index.js +399 -59
- package/dist/index.js.map +1 -1
- package/dist/worker.jl +95 -0
- package/package.json +3 -3
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/environment.ts","../src/doctor.ts","../src/engine.ts","../src/fit.ts","../src/runner-common.ts","../src/predict.ts","../src/project.ts","../src/run-matrix.ts","../src/setup.ts","../src/versions.ts"],"sourcesContent":["import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { type CommandRunner, createRunner, type ToolInfo } from \"@mcmcjs/engine\";\n\nexport type { CommandRunner, ToolInfo } from \"@mcmcjs/engine\";\nexport { createRunner } from \"@mcmcjs/engine\";\n\nconst defaultRunner = createRunner();\n\n// juliaup installs its shims here; we also fall back to whatever is on PATH.\nfunction candidates(binary: string): string[] {\n return [join(homedir(), \".juliaup\", \"bin\", binary), binary];\n}\n\nasync function detect(\n binary: string,\n parseVersion: (stdout: string) => string | undefined,\n runner: CommandRunner,\n): Promise<ToolInfo> {\n for (const path of candidates(binary)) {\n try {\n const version = parseVersion(await runner(path, [\"--version\"]));\n if (version) return { found: true, version, path };\n } catch {\n // not available at this path; try the next candidate\n }\n }\n return { found: false };\n}\n\nconst versionNumber = (stdout: string): string | undefined => stdout.match(/(\\d+\\.\\d+\\.\\d+)/)?.[1];\n\n/** Detects the Julia runtime via `julia --version`. */\nexport function detectJulia(runner: CommandRunner = defaultRunner): Promise<ToolInfo> {\n return detect(\"julia\", versionNumber, runner);\n}\n\n/** Detects the juliaup version manager via `juliaup --version`. */\nexport function detectJuliaup(runner: CommandRunner = defaultRunner): Promise<ToolInfo> {\n return detect(\"juliaup\", versionNumber, runner);\n}\n","import { type CommandRunner, detectJulia, detectJuliaup, type ToolInfo } from \"./environment\";\n\n/** A summary of the Julia toolchain available for inference. */\nexport interface DoctorReport {\n juliaup: ToolInfo;\n julia: ToolInfo;\n /** True when Julia itself is available (the minimum needed to run inference). */\n ready: boolean;\n}\n\n/** Detects the installed Julia toolchain and reports whether inference can run. */\nexport async function runDoctor(runner?: CommandRunner): Promise<DoctorReport> {\n const [juliaup, julia] = await Promise.all([detectJuliaup(runner), detectJulia(runner)]);\n return { juliaup, julia, ready: julia.found };\n}\n","import type { Engine, EngineContext, HealthReport } from \"@mcmcjs/engine\";\nimport { runDoctor } from \"./doctor\";\n\nconst JULIAUP_URL = \"https://github.com/JuliaLang/juliaup\";\n\nexport const juliaEngine: Engine = {\n id: \"julia\",\n displayName: \"Julia\",\n capabilities: { setup: true, versions: true, fit: true, predict: true },\n async doctor(ctx: EngineContext): Promise<HealthReport> {\n const report = await runDoctor(ctx.run);\n return {\n engineId: \"julia\",\n ready: report.ready,\n tools: [\n { name: \"juliaup\", ...report.juliaup },\n { name: \"julia\", ...report.julia },\n ],\n hint: report.ready\n ? undefined\n : `Julia not found. Install it with juliaup (${JULIAUP_URL}), or run \\`mcmc setup\\`.`,\n };\n },\n};\n","import { existsSync, mkdtempSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport {\n canonicalJson,\n parseSamples,\n type ResolvedSpec,\n RUN_RECORD_SCHEMA_VERSION,\n type RunRecord,\n} from \"@mcmcjs/core\";\nimport type { FitResult, FitRunner } from \"@mcmcjs/engine\";\nimport { driverPath, lastJsonLine, sha256, toStage } from \"./runner-common\";\n\nexport interface FitIo {\n /** Spawns the Julia process; injectable so runFit is testable without Julia. */\n spawn: FitRunner;\n /** The managed Julia project directory passed as --project. */\n projectDir: string;\n /** Where the samples file is written. */\n outPath: string;\n tmpDir?: string;\n}\n\n/** Runs one inference for a resolved spec on a resolved runtime invocation. */\nexport async function runFit(\n spec: ResolvedSpec,\n resolved: { command: string; args: string[] },\n io: FitIo,\n): Promise<FitResult> {\n const startedAt = new Date().toISOString();\n const start = performance.now();\n const runtimeRequested = spec.backend.version;\n\n const tmp = io.tmpDir ?? mkdtempSync(join(tmpdir(), \"mcmcjs-fit-\"));\n const requestPath = join(tmp, \"request.json\");\n writeFileSync(\n requestPath,\n JSON.stringify({\n schema_version: spec.schema_version,\n backend: { id: spec.backend.id },\n model: { file: spec.modelPath, entry: spec.model.entry },\n data: spec.data,\n sampler: spec.sampler,\n seed: spec.seed,\n out: io.outPath,\n }),\n );\n\n const args = [\n ...resolved.args,\n \"--startup-file=no\",\n `--project=${io.projectDir}`,\n driverPath(),\n requestPath,\n ];\n const { stdout, stderr, code } = await io.spawn(resolved.command, args);\n const elapsedMs = Math.round(performance.now() - start);\n\n if (code !== 0 || !existsSync(io.outPath)) {\n const failure = lastJsonLine(stderr);\n const stage = toStage(failure?.stage);\n const error =\n (failure?.error as string) ??\n stderr.trim().split(\"\\n\").pop() ??\n `julia exited with code ${code}`;\n return { status: \"error\", runtimeRequested, elapsedMs, stage, error };\n }\n\n try {\n parseSamples(readFileSync(io.outPath, \"utf8\"));\n } catch (error) {\n return {\n status: \"error\",\n runtimeRequested,\n elapsedMs,\n stage: \"write\",\n error: `samples file did not parse: ${(error as Error).message}`,\n };\n }\n\n const provenance = lastJsonLine(stdout);\n const julia = provenance?.julia_version as string | undefined;\n const record: RunRecord = {\n schema_version: RUN_RECORD_SCHEMA_VERSION,\n spec_hash: spec.specHash,\n seed: spec.seed,\n backend: { id: spec.backend.id, runtime: spec.backend.runtime },\n runtime: { requested: runtimeRequested, actual: julia, path: resolved.command },\n manifest_sha256: provenance?.manifest_sha256 as string | undefined,\n packages: provenance?.packages as Record<string, string> | undefined,\n model_sha256: existsSync(spec.modelPath)\n ? sha256(readFileSync(spec.modelPath, \"utf8\"))\n : undefined,\n data_sha256: sha256(canonicalJson(spec.data)),\n samples_file: io.outPath,\n started_at: startedAt,\n elapsed_ms: elapsedMs,\n };\n writeFileSync(`${io.outPath}.run.json`, `${JSON.stringify(record, null, 2)}\\n`);\n\n return {\n status: \"ok\",\n samplesFile: io.outPath,\n runtimeRequested,\n runtimeActual: julia,\n elapsedMs,\n };\n}\n","import { createHash } from \"node:crypto\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport type { FitResult } from \"@mcmcjs/engine\";\n\n/** Path to the shipped Julia driver, resolved next to this module in dist/. */\nexport function driverPath(): string {\n return join(dirname(fileURLToPath(import.meta.url)), \"driver.jl\");\n}\n\nexport function sha256(text: string): string {\n return createHash(\"sha256\").update(text).digest(\"hex\");\n}\n\n/** Parses the last JSON-object line of text (the driver's provenance or error line). */\nexport function lastJsonLine(text: string): Record<string, unknown> | undefined {\n for (const line of text.trimEnd().split(\"\\n\").reverse()) {\n const trimmed = line.trim();\n if (!trimmed.startsWith(\"{\")) continue;\n try {\n return JSON.parse(trimmed) as Record<string, unknown>;\n } catch {\n return undefined;\n }\n }\n return undefined;\n}\n\nconst STAGES = new Set<NonNullable<FitResult[\"stage\"]>>([\n \"compile\",\n \"sample\",\n \"load_samples\",\n \"predict\",\n \"write\",\n \"spawn\",\n]);\n\n/** Narrows a driver-reported stage string to the known set. */\nexport function toStage(value: unknown): FitResult[\"stage\"] {\n return typeof value === \"string\" && STAGES.has(value as NonNullable<FitResult[\"stage\"]>)\n ? (value as FitResult[\"stage\"])\n : undefined;\n}\n","import { existsSync, mkdtempSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport {\n canonicalJson,\n parseSamples,\n type ResolvedSpec,\n RUN_RECORD_SCHEMA_VERSION,\n type RunRecord,\n} from \"@mcmcjs/core\";\nimport type { FitResult, FitRunner } from \"@mcmcjs/engine\";\nimport { driverPath, lastJsonLine, sha256, toStage } from \"./runner-common\";\n\nexport interface PredictIo {\n /** Spawns the Julia process; injectable so runPredict is testable without Julia. */\n spawn: FitRunner;\n projectDir: string;\n /** Where the posterior-predictive samples file is written. */\n outPath: string;\n /** The posterior samples file fed to prediction. */\n samplesPath: string;\n tmpDir?: string;\n}\n\n/** The prediction data: [data] with [predict].data overrides, target outcomes blanked to nulls. */\nexport function predictData(spec: ResolvedSpec): Record<string, unknown> {\n const predict = spec.predict;\n if (!predict) throw new Error(\"spec has no [predict] block\");\n const data: Record<string, unknown> = { ...spec.data, ...(predict.data ?? {}) };\n // Blank a target to null, preserving array shape so the driver maps it to a\n // matching shape of `missing` (a multidimensional outcome stays nested).\n const blank = (value: unknown): unknown => (Array.isArray(value) ? value.map(blank) : null);\n for (const target of predict.targets) {\n data[target] = blank(data[target]);\n }\n return data;\n}\n\n/** Draws posterior-predictive samples from a fitted model and its posterior samples file. */\nexport async function runPredict(\n spec: ResolvedSpec,\n resolved: { command: string; args: string[] },\n io: PredictIo,\n): Promise<FitResult> {\n const startedAt = new Date().toISOString();\n const start = performance.now();\n const runtimeRequested = spec.backend.version;\n const data = predictData(spec);\n\n const tmp = io.tmpDir ?? mkdtempSync(join(tmpdir(), \"mcmcjs-predict-\"));\n const requestPath = join(tmp, \"request.json\");\n writeFileSync(\n requestPath,\n JSON.stringify({\n mode: \"predict\",\n schema_version: spec.schema_version,\n backend: { id: spec.backend.id },\n model: { file: spec.modelPath, entry: spec.model.entry },\n data,\n predict: { targets: spec.predict?.targets ?? [] },\n samples: io.samplesPath,\n seed: spec.seed,\n out: io.outPath,\n }),\n );\n\n const args = [\n ...resolved.args,\n \"--startup-file=no\",\n `--project=${io.projectDir}`,\n driverPath(),\n requestPath,\n ];\n const { stdout, stderr, code } = await io.spawn(resolved.command, args);\n const elapsedMs = Math.round(performance.now() - start);\n\n if (code !== 0 || !existsSync(io.outPath)) {\n const failure = lastJsonLine(stderr);\n const error =\n (failure?.error as string) ??\n stderr.trim().split(\"\\n\").pop() ??\n `julia exited with code ${code}`;\n return { status: \"error\", runtimeRequested, elapsedMs, stage: toStage(failure?.stage), error };\n }\n\n try {\n parseSamples(readFileSync(io.outPath, \"utf8\"));\n } catch (error) {\n return {\n status: \"error\",\n runtimeRequested,\n elapsedMs,\n stage: \"write\",\n error: `samples file did not parse: ${(error as Error).message}`,\n };\n }\n\n const provenance = lastJsonLine(stdout);\n const julia = provenance?.julia_version as string | undefined;\n const record: RunRecord = {\n schema_version: RUN_RECORD_SCHEMA_VERSION,\n spec_hash: spec.specHash,\n seed: spec.seed,\n backend: { id: spec.backend.id, runtime: spec.backend.runtime },\n runtime: { requested: runtimeRequested, actual: julia, path: resolved.command },\n manifest_sha256: provenance?.manifest_sha256 as string | undefined,\n packages: provenance?.packages as Record<string, string> | undefined,\n model_sha256: existsSync(spec.modelPath)\n ? sha256(readFileSync(spec.modelPath, \"utf8\"))\n : undefined,\n data_sha256: sha256(canonicalJson(data)),\n posterior_samples: io.samplesPath,\n posterior_samples_sha256: existsSync(io.samplesPath)\n ? sha256(readFileSync(io.samplesPath, \"utf8\"))\n : undefined,\n samples_file: io.outPath,\n started_at: startedAt,\n elapsed_ms: elapsedMs,\n };\n writeFileSync(`${io.outPath}.run.json`, `${JSON.stringify(record, null, 2)}\\n`);\n\n return {\n status: \"ok\",\n samplesFile: io.outPath,\n runtimeRequested,\n runtimeActual: julia,\n elapsedMs,\n };\n}\n","import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { type CommandRunner, createRunner } from \"@mcmcjs/engine\";\n\nconst PACKAGES = [\n \"Turing\",\n \"FlexiChains\",\n \"DimensionalData\",\n \"MCMCChains\",\n \"JuliaBUGS\",\n \"AdvancedHMC\",\n \"ForwardDiff\",\n \"JSON\",\n \"StableRNGs\",\n];\n\n/** The per-user directory holding the managed Julia project (Project + Manifest). */\nexport function managedProjectDir(): string {\n const base = process.env.XDG_DATA_HOME || join(homedir(), \".local\", \"share\");\n return join(base, \"mcmcjs\", \"julia\", \"env\");\n}\n\n// Records the package set a managed dir was provisioned with, so an env from an\n// older package set is healed (Pkg.add is additive) rather than left incomplete.\nfunction sentinelPath(dir: string): string {\n return join(dir, \".mcmcjs-packages.json\");\n}\n\nfunction provisioned(dir: string): boolean {\n try {\n return readFileSync(sentinelPath(dir), \"utf8\").trim() === JSON.stringify([...PACKAGES].sort());\n } catch {\n return false;\n }\n}\n\n/** Whether the managed project is present and provisioned with the current package set. */\nexport function managedProjectReady(dir: string = managedProjectDir()): boolean {\n return existsSync(join(dir, \"Project.toml\")) && provisioned(dir);\n}\n\n/**\n * Ensures the managed Julia project exists with the inference packages installed.\n * Idempotent: returns immediately when already provisioned with the current set,\n * otherwise adds (and precompiles) the missing packages. The first run resolves\n * and precompiles the project, which can take several minutes.\n */\nexport async function ensureProject(\n juliaBin: string,\n run: CommandRunner = createRunner(30 * 60_000),\n dir: string = managedProjectDir(),\n): Promise<string> {\n if (managedProjectReady(dir)) return dir;\n mkdirSync(dir, { recursive: true });\n const code = `using Pkg; Pkg.add(${JSON.stringify(PACKAGES)}); Pkg.precompile()`;\n await run(juliaBin, [\"--startup-file=no\", `--project=${dir}`, \"-e\", code]);\n writeFileSync(sentinelPath(dir), JSON.stringify([...PACKAGES].sort()));\n return dir;\n}\n","import { join } from \"node:path\";\nimport type { ResolvedSpec } from \"@mcmcjs/core\";\nimport type { FitResult, FitRunner } from \"@mcmcjs/engine\";\nimport { runFit } from \"./fit\";\n\nexport interface MatrixEntry {\n version: string;\n status: \"ok\" | \"error\";\n samplesFile?: string;\n runtimeActual?: string;\n elapsedMs: number;\n stage?: FitResult[\"stage\"];\n error?: string;\n}\n\nexport interface MatrixResult {\n entries: MatrixEntry[];\n /** True only when every requested version ran and succeeded. */\n ok: boolean;\n}\n\nexport interface MatrixIo {\n spawn: FitRunner;\n projectDir: string;\n /** Directory the per-version samples files are written into. */\n outDir: string;\n /** Resolves a version/channel to a concrete invocation; injectable for tests. */\n resolve: (version: string) => Promise<{ command: string; args: string[] }>;\n /** Continue after a version fails instead of stopping. */\n keepGoing?: boolean;\n}\n\n/** Runs the same spec across several Julia versions, one samples file per version. */\nexport async function runMatrix(\n spec: ResolvedSpec,\n versions: string[],\n io: MatrixIo,\n): Promise<MatrixResult> {\n const entries: MatrixEntry[] = [];\n for (const version of versions) {\n let entry: MatrixEntry;\n try {\n const resolved = await io.resolve(version);\n const versioned = { ...spec, backend: { ...spec.backend, version } };\n const result = await runFit(versioned, resolved, {\n spawn: io.spawn,\n projectDir: io.projectDir,\n outPath: join(io.outDir, `${version}.samples.json`),\n });\n entry = {\n version,\n status: result.status,\n samplesFile: result.samplesFile,\n runtimeActual: result.runtimeActual,\n elapsedMs: result.elapsedMs,\n stage: result.stage,\n error: result.error,\n };\n } catch (error) {\n entry = { version, status: \"error\", elapsedMs: 0, error: (error as Error).message };\n }\n entries.push(entry);\n if (entry.status === \"error\" && !io.keepGoing) break;\n }\n return {\n entries,\n ok: entries.length === versions.length && entries.every((e) => e.status === \"ok\"),\n };\n}\n","import { type DoctorReport, runDoctor } from \"./doctor\";\nimport { type CommandRunner, createRunner, type ToolInfo } from \"./environment\";\n\n/** The official juliaup install script, piped to a shell by the install step. */\nconst JULIAUP_INSTALL_URL = \"https://install.julialang.org\";\n\n/** An executable and its arguments, run directly (no shell word-splitting). */\nexport interface InstallCommand {\n command: string;\n args: string[];\n}\n\n/**\n * The command that installs juliaup on the given platform, or null when\n * automatic install is not yet supported there.\n */\nexport function juliaupInstallCommand(platform: NodeJS.Platform): InstallCommand | null {\n if (platform === \"win32\") {\n // TODO: install juliaup on Windows via winget or the Microsoft Store.\n return null;\n }\n return { command: \"sh\", args: [\"-c\", `curl -fsSL ${JULIAUP_INSTALL_URL} | sh -s -- --yes`] };\n}\n\n/** A single provisioning step needed to make the toolchain ready. */\nexport interface SetupStep {\n tool: \"juliaup\" | \"julia\";\n /** A short description of what the step does. */\n label: string;\n /** The command to run, or null when the step cannot be performed automatically. */\n command: InstallCommand | null;\n}\n\n/** The ordered steps needed to reach a ready toolchain, given the current state. */\nexport function planSetup(report: DoctorReport, platform: NodeJS.Platform): SetupStep[] {\n if (report.julia.found) return [];\n if (report.juliaup.found) {\n return [\n {\n tool: \"julia\",\n label: \"install the latest stable Julia via juliaup\",\n command: { command: report.juliaup.path ?? \"juliaup\", args: [\"add\", \"release\"] },\n },\n ];\n }\n return [\n {\n tool: \"juliaup\",\n label: \"install juliaup (this also installs Julia)\",\n command: juliaupInstallCommand(platform),\n },\n ];\n}\n\nexport type StepStatus = \"ran\" | \"skipped\" | \"failed\" | \"unsupported\";\n\nexport interface SetupStepResult extends SetupStep {\n status: StepStatus;\n /** Error detail when the step failed. */\n detail?: string;\n}\n\nexport interface SetupResult {\n juliaup: ToolInfo;\n julia: ToolInfo;\n /** True when Julia is available after setup. */\n ready: boolean;\n steps: SetupStepResult[];\n}\n\nexport interface SetupOptions {\n /** Runs detection commands. Injectable for tests. */\n runner?: CommandRunner;\n /** Runs install steps, which may take several minutes. Injectable for tests. */\n installer?: CommandRunner;\n /** Target platform; defaults to the current process platform. */\n platform?: NodeJS.Platform;\n /** Plan the steps but do not run them. */\n dryRun?: boolean;\n}\n\n/** Installs the Julia toolchain (juliaup and Julia) needed for inference. */\nexport async function runSetup(options: SetupOptions = {}): Promise<SetupResult> {\n const {\n runner,\n installer = createRunner(15 * 60_000),\n platform = process.platform,\n dryRun = false,\n } = options;\n\n const before = await runDoctor(runner);\n if (before.ready) return { ...before, steps: [] };\n\n const plan = planSetup(before, platform);\n\n if (dryRun) {\n return {\n ...before,\n steps: plan.map((step) => ({ ...step, status: step.command ? \"skipped\" : \"unsupported\" })),\n };\n }\n\n const steps: SetupStepResult[] = [];\n for (const step of plan) {\n if (!step.command) {\n steps.push({ ...step, status: \"unsupported\" });\n continue;\n }\n try {\n await installer(step.command.command, step.command.args);\n steps.push({ ...step, status: \"ran\" });\n } catch (error) {\n const detail = error instanceof Error ? error.message : String(error);\n steps.push({ ...step, status: \"failed\", detail });\n }\n }\n\n const after = await runDoctor(runner);\n return { juliaup: after.juliaup, julia: after.julia, ready: after.ready, steps };\n}\n","import type { CommandRunner, RuntimeVersion } from \"@mcmcjs/engine\";\n\ninterface ChannelInfo {\n Name: string;\n File: string;\n Args?: string[];\n Version?: string;\n Arch?: string;\n}\n\ninterface Getconfig1 {\n DefaultChannel: ChannelInfo | null;\n OtherChannels: ChannelInfo[];\n}\n\nfunction parseChannel(value: unknown): ChannelInfo {\n const c = value as Record<string, unknown>;\n if (!c || typeof c.Name !== \"string\" || typeof c.File !== \"string\") {\n throw new Error(\"unexpected `juliaup api getconfig1` channel shape\");\n }\n return {\n Name: c.Name,\n File: c.File,\n Args: Array.isArray(c.Args) ? (c.Args as string[]) : undefined,\n Version: typeof c.Version === \"string\" ? c.Version : undefined,\n Arch: typeof c.Arch === \"string\" ? c.Arch : undefined,\n };\n}\n\nfunction parseGetconfig1(raw: string): Getconfig1 {\n let data: unknown;\n try {\n data = JSON.parse(raw);\n } catch {\n throw new Error(\"could not parse `juliaup api getconfig1` output as JSON\");\n }\n const obj = data as Record<string, unknown>;\n if (!obj || typeof obj !== \"object\" || !Array.isArray(obj.OtherChannels)) {\n throw new Error(\"unexpected `juliaup api getconfig1` output\");\n }\n return {\n DefaultChannel: obj.DefaultChannel ? parseChannel(obj.DefaultChannel) : null,\n OtherChannels: obj.OtherChannels.map(parseChannel),\n };\n}\n\nfunction toVersion(channel: ChannelInfo, isDefault: boolean): RuntimeVersion {\n return { id: channel.Name, version: channel.Version, path: channel.File || undefined, isDefault };\n}\n\n/** Lists the installed Julia versions, marking the default channel. */\nexport async function listVersions(bin: string, run: CommandRunner): Promise<RuntimeVersion[]> {\n const config = parseGetconfig1(await run(bin, [\"api\", \"getconfig1\"]));\n const versions: RuntimeVersion[] = [];\n if (config.DefaultChannel) versions.push(toVersion(config.DefaultChannel, true));\n for (const channel of config.OtherChannels) versions.push(toVersion(channel, false));\n return versions;\n}\n\nexport async function addVersion(\n bin: string,\n channel: string,\n opts: { default?: boolean },\n run: CommandRunner,\n): Promise<void> {\n await run(bin, [\"add\", channel]);\n if (opts.default) await run(bin, [\"default\", channel]);\n}\n\nexport async function removeVersion(\n bin: string,\n channel: string,\n run: CommandRunner,\n): Promise<void> {\n await run(bin, [\"remove\", channel]);\n}\n\nexport async function setDefaultVersion(\n bin: string,\n channel: string,\n run: CommandRunner,\n): Promise<void> {\n await run(bin, [\"default\", channel]);\n}\n\nexport async function updateVersion(\n bin: string,\n channel: string | undefined,\n run: CommandRunner,\n): Promise<void> {\n await run(bin, channel ? [\"update\", channel] : [\"update\"]);\n}\n\nexport async function gcVersions(bin: string, run: CommandRunner): Promise<void> {\n await run(bin, [\"gc\"]);\n}\n\n/** Resolves a channel to a concrete invocation, preferring its absolute binary path. */\nexport async function resolveVersion(\n bin: string,\n channel: string,\n run: CommandRunner,\n): Promise<{ command: string; args: string[] }> {\n const config = parseGetconfig1(await run(bin, [\"api\", \"getconfig1\"]));\n const all = config.DefaultChannel\n ? [config.DefaultChannel, ...config.OtherChannels]\n : config.OtherChannels;\n const match = all.find((c) => c.Name === channel);\n if (!match?.File) {\n throw new Error(\n `Julia version \"${channel}\" is not installed. Add it with: mcmc julia version add ${channel}`,\n );\n }\n return { command: match.File, args: match.Args ?? [] };\n}\n\n/** Throws with an actionable message if any requested channel is not installed. */\nexport function assertVersionsInstalled(channels: string[], installed: RuntimeVersion[]): void {\n const have = new Set(installed.map((v) => v.id));\n const missing = channels.filter((c) => !have.has(c));\n if (missing.length > 0) {\n const fixes = missing.map((m) => `mcmc julia version add ${m}`).join(\"; \");\n throw new Error(\n `Julia version(s) not installed: ${missing.join(\", \")}. Install with: ${fixes}`,\n );\n }\n}\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,SAA6B,oBAAmC;AAGhE,SAAS,gBAAAA,qBAAoB;AAE7B,IAAM,gBAAgB,aAAa;AAGnC,SAAS,WAAW,QAA0B;AAC5C,SAAO,CAAC,KAAK,QAAQ,GAAG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AK,UAAU,CAAC,UAAU,OAAO,IAAI,CAAC,QAAQ,CAAC;AAC3D;AAEA,eAAsB,WAAW,KAAa,KAAmC;AAC/E,QAAM,IAAI,KAAK,CAAC,IAAI,CAAC;AACvB;AAGA,eAAsB,eACpB,KACA,SACA,KAC8C;AAC9C,QAAM,SAAS,gBAAgB,MAAM,IAAI,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AACpE,QAAM,MAAM,OAAO,iBACf,CAAC,OAAO,gBAAgB,GAAG,OAAO,aAAa,IAC/C,OAAO;AACX,QAAM,QAAQ,IAAI,KAAK,CAAC,MAAM,EAAE,SAAS,OAAO;AAChD,MAAI,CAAC,OAAO,MAAM;AAChB,UAAM,IAAI;AAAA,MACR,kBAAkB,OAAO,2DAA2D,OAAO;AAAA,IAC7F;AAAA,EACF;AACA,SAAO,EAAE,SAAS,MAAM,MAAM,MAAM,MAAM,QAAQ,CAAC,EAAE;AACvD;AAGO,SAAS,wBAAwB,UAAoB,WAAmC;AAC7F,QAAM,OAAO,IAAI,IAAI,UAAU,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;AAC/C,QAAM,UAAU,SAAS,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC;AACnD,MAAI,QAAQ,SAAS,GAAG;AACtB,UAAM,QAAQ,QAAQ,IAAI,CAAC,MAAM,0BAA0B,CAAC,EAAE,EAAE,KAAK,IAAI;AACzE,UAAM,IAAI;AAAA,MACR,mCAAmC,QAAQ,KAAK,IAAI,CAAC,mBAAmB,KAAK;AAAA,IAC/E;AAAA,EACF;AACF;","names":["createRunner","join","join","join","existsSync","mkdtempSync","readFileSync","writeFileSync","tmpdir","join","canonicalJson","parseSamples","RUN_RECORD_SCHEMA_VERSION","mkdtempSync","join","tmpdir","writeFileSync","existsSync","parseSamples","readFileSync","RUN_RECORD_SCHEMA_VERSION","canonicalJson","existsSync","readFileSync","writeFileSync","homedir","join","createRunner","join","join","createRunner"]}
|
|
1
|
+
{"version":3,"sources":["../src/environment.ts","../src/doctor.ts","../src/engine.ts","../src/fit.ts","../src/runner-common.ts","../src/predict.ts","../src/project.ts","../src/run-matrix.ts","../src/setup.ts","../src/versions.ts","../src/worker.ts"],"sourcesContent":["import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { type CommandRunner, createRunner, type ToolInfo } from \"@mcmcjs/engine\";\n\nexport type { CommandRunner, ToolInfo } from \"@mcmcjs/engine\";\nexport { createRunner } from \"@mcmcjs/engine\";\n\nconst defaultRunner = createRunner();\n\n// juliaup installs its shims under the home directory; we also fall back to\n// whatever is on PATH. $HOME is honored first so a sandbox that redirects HOME\n// (mcmc sandbox --strict) finds its own juliaup, not the user's.\nfunction candidates(binary: string): string[] {\n const home = process.env.HOME || homedir();\n return [join(home, \".juliaup\", \"bin\", binary), binary];\n}\n\nasync function detect(\n binary: string,\n parseVersion: (stdout: string) => string | undefined,\n runner: CommandRunner,\n): Promise<ToolInfo> {\n for (const path of candidates(binary)) {\n try {\n const version = parseVersion(await runner(path, [\"--version\"]));\n if (version) return { found: true, version, path };\n } catch {\n // not available at this path; try the next candidate\n }\n }\n return { found: false };\n}\n\nconst versionNumber = (stdout: string): string | undefined => stdout.match(/(\\d+\\.\\d+\\.\\d+)/)?.[1];\n\n/** Detects the Julia runtime via `julia --version`. */\nexport function detectJulia(runner: CommandRunner = defaultRunner): Promise<ToolInfo> {\n return detect(\"julia\", versionNumber, runner);\n}\n\n/** Detects the juliaup version manager via `juliaup --version`. */\nexport function detectJuliaup(runner: CommandRunner = defaultRunner): Promise<ToolInfo> {\n return detect(\"juliaup\", versionNumber, runner);\n}\n","import { type CommandRunner, detectJulia, detectJuliaup, type ToolInfo } from \"./environment\";\n\n/** A summary of the Julia toolchain available for inference. */\nexport interface DoctorReport {\n juliaup: ToolInfo;\n julia: ToolInfo;\n /** True when Julia itself is available (the minimum needed to run inference). */\n ready: boolean;\n}\n\n/** Detects the installed Julia toolchain and reports whether inference can run. */\nexport async function runDoctor(runner?: CommandRunner): Promise<DoctorReport> {\n const [juliaup, julia] = await Promise.all([detectJuliaup(runner), detectJulia(runner)]);\n return { juliaup, julia, ready: julia.found };\n}\n","import type { Engine, EngineContext, HealthReport } from \"@mcmcjs/engine\";\nimport { runDoctor } from \"./doctor\";\n\nconst JULIAUP_URL = \"https://github.com/JuliaLang/juliaup\";\n\nexport const juliaEngine: Engine = {\n id: \"julia\",\n displayName: \"Julia\",\n capabilities: { setup: true, versions: true, fit: true, predict: true },\n async doctor(ctx: EngineContext): Promise<HealthReport> {\n const report = await runDoctor(ctx.run);\n return {\n engineId: \"julia\",\n ready: report.ready,\n tools: [\n { name: \"juliaup\", ...report.juliaup },\n { name: \"julia\", ...report.julia },\n ],\n hint: report.ready\n ? undefined\n : `Julia not found. Install it with juliaup (${JULIAUP_URL}), or run \\`mcmc setup\\`.`,\n };\n },\n};\n","import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport {\n canonicalJson,\n parseSamples,\n type ResolvedSpec,\n RUN_RECORD_SCHEMA_VERSION,\n type RunRecord,\n} from \"@mcmcjs/core\";\nimport type { FitProgress, FitResult, FitRunner } from \"@mcmcjs/engine\";\nimport { driverPath, lastJsonLine, sha256, sharedTmpParent, toStage } from \"./runner-common\";\n\nexport interface FitIo {\n /** Spawns the Julia process; injectable so runFit is testable without Julia. */\n spawn: FitRunner;\n /** The managed Julia project directory passed as --project. */\n projectDir: string;\n /** Where the samples file is written. */\n outPath: string;\n /** Where the run record is written; defaults to `<outPath>.run.json`. */\n recordPath?: string;\n /** Streamed per-chain sampling progress. */\n onProgress?: (progress: FitProgress) => void;\n /** Source path when the data came from a referenced file; recorded, not copied. */\n dataFile?: string;\n /** Overrides the recorded data hash (e.g. the data file's bytes hash). */\n dataSha256?: string;\n tmpDir?: string;\n}\n\n/** A fresh request dir under the shared per-user tmp parent. */\nexport function makeRequestDir(kind: string): string {\n const parent = sharedTmpParent();\n mkdirSync(parent, { recursive: true });\n return mkdtempSync(join(parent, `${kind}-`));\n}\n\n/** The driver/worker request object for one fit. */\nexport function fitRequest(spec: ResolvedSpec, outPath: string): Record<string, unknown> {\n return {\n schema_version: spec.schema_version,\n backend: { id: spec.backend.id },\n model: { file: spec.modelPath, entry: spec.model.entry },\n data: spec.data,\n sampler: spec.sampler,\n seed: spec.seed,\n out: outPath,\n };\n}\n\n/**\n * Validates the written samples and records provenance; the success tail\n * shared by the one-shot driver and the worker paths.\n */\nexport function finalizeOkFit(\n spec: ResolvedSpec,\n resolved: { command: string },\n io: Pick<FitIo, \"outPath\" | \"recordPath\" | \"dataFile\" | \"dataSha256\">,\n provenance: Record<string, unknown> | undefined,\n startedAt: string,\n elapsedMs: number,\n): FitResult {\n const runtimeRequested = spec.backend.version;\n if (!existsSync(io.outPath)) {\n return {\n status: \"error\",\n runtimeRequested,\n elapsedMs,\n stage: \"write\",\n error: \"the runtime reported success but wrote no samples file\",\n };\n }\n try {\n parseSamples(readFileSync(io.outPath, \"utf8\"));\n } catch (error) {\n return {\n status: \"error\",\n runtimeRequested,\n elapsedMs,\n stage: \"write\",\n error: `samples file did not parse: ${(error as Error).message}`,\n };\n }\n\n const julia = provenance?.julia_version as string | undefined;\n const record: RunRecord = {\n schema_version: RUN_RECORD_SCHEMA_VERSION,\n spec_hash: spec.specHash,\n seed: spec.seed,\n backend: { id: spec.backend.id, runtime: spec.backend.runtime },\n runtime: { requested: runtimeRequested, actual: julia, path: resolved.command },\n manifest_sha256: provenance?.manifest_sha256 as string | undefined,\n packages: provenance?.packages as Record<string, string> | undefined,\n model_sha256: existsSync(spec.modelPath)\n ? sha256(readFileSync(spec.modelPath, \"utf8\"))\n : undefined,\n data_sha256: io.dataSha256 ?? sha256(canonicalJson(spec.data)),\n ...(io.dataFile ? { data_file: io.dataFile } : {}),\n samples_file: io.outPath,\n started_at: startedAt,\n elapsed_ms: elapsedMs,\n };\n writeFileSync(io.recordPath ?? `${io.outPath}.run.json`, `${JSON.stringify(record, null, 2)}\\n`);\n\n return {\n status: \"ok\",\n samplesFile: io.outPath,\n runtimeRequested,\n runtimeActual: julia,\n elapsedMs,\n };\n}\n\n/** Runs one inference for a resolved spec on a resolved runtime invocation. */\nexport async function runFit(\n spec: ResolvedSpec,\n resolved: { command: string; args: string[] },\n io: FitIo,\n): Promise<FitResult> {\n const startedAt = new Date().toISOString();\n const start = performance.now();\n const runtimeRequested = spec.backend.version;\n\n const ownTmp = io.tmpDir === undefined;\n const tmp = io.tmpDir ?? makeRequestDir(\"fit\");\n const requestPath = join(tmp, \"request.json\");\n writeFileSync(requestPath, JSON.stringify(fitRequest(spec, io.outPath)));\n\n const args = [\n ...resolved.args,\n \"--startup-file=no\",\n `--project=${io.projectDir}`,\n driverPath(),\n requestPath,\n ];\n let stdout: string;\n let stderr: string;\n let code: number;\n try {\n ({ stdout, stderr, code } = await io.spawn(resolved.command, args, {\n onProgress: io.onProgress,\n }));\n } finally {\n if (ownTmp) rmSync(tmp, { recursive: true, force: true });\n }\n const elapsedMs = Math.round(performance.now() - start);\n\n if (code !== 0 || !existsSync(io.outPath)) {\n const failure = lastJsonLine(stderr);\n const stage = toStage(failure?.stage);\n const error =\n (failure?.error as string) ??\n stderr.trim().split(\"\\n\").pop() ??\n `julia exited with code ${code}`;\n return { status: \"error\", runtimeRequested, elapsedMs, stage, error };\n }\n\n return finalizeOkFit(spec, resolved, io, lastJsonLine(stdout), startedAt, elapsedMs);\n}\n","import { createHash } from \"node:crypto\";\nimport { tmpdir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport type { FitResult } from \"@mcmcjs/engine\";\n\n/**\n * The per-user parent for all mcmcjs temp state. The uid suffix keeps users\n * on a shared /tmp out of each other's way (macOS tmpdir is per-user already,\n * Linux /tmp is not).\n */\nexport function sharedTmpParent(): string {\n const uid = typeof process.getuid === \"function\" ? `-${process.getuid()}` : \"\";\n return join(tmpdir(), `mcmcjs${uid}`);\n}\n\n/** Path to the shipped Julia driver, resolved next to this module in dist/. */\nexport function driverPath(): string {\n return join(dirname(fileURLToPath(import.meta.url)), \"driver.jl\");\n}\n\n/** Path to the shipped persistent worker, resolved next to this module in dist/. */\nexport function workerPath(): string {\n return join(dirname(fileURLToPath(import.meta.url)), \"worker.jl\");\n}\n\nexport function sha256(text: string): string {\n return createHash(\"sha256\").update(text).digest(\"hex\");\n}\n\n/** Parses the last JSON-object line of text (the driver's provenance or error line). */\nexport function lastJsonLine(text: string): Record<string, unknown> | undefined {\n for (const line of text.trimEnd().split(\"\\n\").reverse()) {\n const trimmed = line.trim();\n if (!trimmed.startsWith(\"{\")) continue;\n try {\n return JSON.parse(trimmed) as Record<string, unknown>;\n } catch {\n return undefined;\n }\n }\n return undefined;\n}\n\nconst STAGES = new Set<NonNullable<FitResult[\"stage\"]>>([\n \"compile\",\n \"sample\",\n \"load_samples\",\n \"predict\",\n \"write\",\n \"spawn\",\n \"worker\",\n]);\n\n/** Narrows a driver-reported stage string to the known set. */\nexport function toStage(value: unknown): FitResult[\"stage\"] {\n return typeof value === \"string\" && STAGES.has(value as NonNullable<FitResult[\"stage\"]>)\n ? (value as FitResult[\"stage\"])\n : undefined;\n}\n","import { existsSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport {\n canonicalJson,\n parseSamples,\n type ResolvedSpec,\n RUN_RECORD_SCHEMA_VERSION,\n type RunRecord,\n} from \"@mcmcjs/core\";\nimport type { FitResult, FitRunner } from \"@mcmcjs/engine\";\nimport { makeRequestDir } from \"./fit\";\nimport { driverPath, lastJsonLine, sha256, toStage } from \"./runner-common\";\n\nexport interface PredictIo {\n /** Spawns the Julia process; injectable so runPredict is testable without Julia. */\n spawn: FitRunner;\n projectDir: string;\n /** Where the posterior-predictive samples file is written. */\n outPath: string;\n /** The posterior samples file fed to prediction. */\n samplesPath: string;\n tmpDir?: string;\n}\n\n/** The prediction data: [data] with [predict].data overrides, target outcomes blanked to nulls. */\nexport function predictData(spec: ResolvedSpec): Record<string, unknown> {\n const predict = spec.predict;\n if (!predict) throw new Error(\"spec has no [predict] block\");\n const data: Record<string, unknown> = { ...spec.data, ...(predict.data ?? {}) };\n // Blank a target to null, preserving array shape so the driver maps it to a\n // matching shape of `missing` (a multidimensional outcome stays nested).\n const blank = (value: unknown): unknown => (Array.isArray(value) ? value.map(blank) : null);\n for (const target of predict.targets) {\n data[target] = blank(data[target]);\n }\n return data;\n}\n\n/** Draws posterior-predictive samples from a fitted model and its posterior samples file. */\nexport async function runPredict(\n spec: ResolvedSpec,\n resolved: { command: string; args: string[] },\n io: PredictIo,\n): Promise<FitResult> {\n const startedAt = new Date().toISOString();\n const start = performance.now();\n const runtimeRequested = spec.backend.version;\n const data = predictData(spec);\n\n const ownTmp = io.tmpDir === undefined;\n const tmp = io.tmpDir ?? makeRequestDir(\"predict\");\n const requestPath = join(tmp, \"request.json\");\n writeFileSync(\n requestPath,\n JSON.stringify({\n mode: \"predict\",\n schema_version: spec.schema_version,\n backend: { id: spec.backend.id },\n model: { file: spec.modelPath, entry: spec.model.entry },\n data,\n predict: { targets: spec.predict?.targets ?? [] },\n samples: io.samplesPath,\n seed: spec.seed,\n out: io.outPath,\n }),\n );\n\n const args = [\n ...resolved.args,\n \"--startup-file=no\",\n `--project=${io.projectDir}`,\n driverPath(),\n requestPath,\n ];\n let stdout: string;\n let stderr: string;\n let code: number;\n try {\n ({ stdout, stderr, code } = await io.spawn(resolved.command, args));\n } finally {\n if (ownTmp) rmSync(tmp, { recursive: true, force: true });\n }\n const elapsedMs = Math.round(performance.now() - start);\n\n if (code !== 0 || !existsSync(io.outPath)) {\n const failure = lastJsonLine(stderr);\n const error =\n (failure?.error as string) ??\n stderr.trim().split(\"\\n\").pop() ??\n `julia exited with code ${code}`;\n return { status: \"error\", runtimeRequested, elapsedMs, stage: toStage(failure?.stage), error };\n }\n\n try {\n parseSamples(readFileSync(io.outPath, \"utf8\"));\n } catch (error) {\n return {\n status: \"error\",\n runtimeRequested,\n elapsedMs,\n stage: \"write\",\n error: `samples file did not parse: ${(error as Error).message}`,\n };\n }\n\n const provenance = lastJsonLine(stdout);\n const julia = provenance?.julia_version as string | undefined;\n const record: RunRecord = {\n schema_version: RUN_RECORD_SCHEMA_VERSION,\n spec_hash: spec.specHash,\n seed: spec.seed,\n backend: { id: spec.backend.id, runtime: spec.backend.runtime },\n runtime: { requested: runtimeRequested, actual: julia, path: resolved.command },\n manifest_sha256: provenance?.manifest_sha256 as string | undefined,\n packages: provenance?.packages as Record<string, string> | undefined,\n model_sha256: existsSync(spec.modelPath)\n ? sha256(readFileSync(spec.modelPath, \"utf8\"))\n : undefined,\n data_sha256: sha256(canonicalJson(data)),\n posterior_samples: io.samplesPath,\n posterior_samples_sha256: existsSync(io.samplesPath)\n ? sha256(readFileSync(io.samplesPath, \"utf8\"))\n : undefined,\n samples_file: io.outPath,\n started_at: startedAt,\n elapsed_ms: elapsedMs,\n };\n writeFileSync(`${io.outPath}.run.json`, `${JSON.stringify(record, null, 2)}\\n`);\n\n return {\n status: \"ok\",\n samplesFile: io.outPath,\n runtimeRequested,\n runtimeActual: julia,\n elapsedMs,\n };\n}\n","import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { canonicalJson } from \"@mcmcjs/core\";\nimport { type CommandRunner, createRunner } from \"@mcmcjs/engine\";\nimport { sha256 } from \"./runner-common\";\n\nconst PACKAGES = [\n \"Turing\",\n \"FlexiChains\",\n \"DimensionalData\",\n \"MCMCChains\",\n \"JuliaBUGS\",\n \"AdvancedHMC\",\n \"ForwardDiff\",\n \"JSON\",\n \"StableRNGs\",\n];\n\n/** Version pins for managed packages, by name (e.g. { Turing: \"0.45\" }). */\nexport type PackagePins = Record<string, string>;\n\n// Version strings are interpolated into Julia source for Pkg.add; this allows\n// only the characters of a Julia version specifier (digits, letters, and the\n// range operators) and notably excludes `$` and backticks, which would\n// otherwise let a shared spec run arbitrary Julia via string interpolation.\nconst VERSION_RE = /^[0-9A-Za-z.+~^=<>,\\s-]+$/;\n\n/** Rejects a version string that could break out of the generated Julia literal. */\nexport function validateVersionString(name: string, version: string): void {\n if (!VERSION_RE.test(version)) {\n throw new Error(\n `invalid version \"${version}\" for package ${name}; a version may contain only digits, letters, and . + ~ ^ = < > , - and spaces`,\n );\n }\n}\n\n/** Rejects pins for unmanaged packages or with unsafe version strings. */\nexport function validatePins(pins: PackagePins | undefined): void {\n for (const [name, version] of Object.entries(pins ?? {})) {\n if (!PACKAGES.includes(name)) {\n throw new Error(\n `cannot pin unknown package \"${name}\"; managed packages are: ${PACKAGES.join(\", \")}`,\n );\n }\n validateVersionString(name, version);\n }\n}\n\nfunction hasPins(pins?: PackagePins): pins is PackagePins {\n return pins !== undefined && Object.keys(pins).length > 0;\n}\n\n/**\n * The per-user directory holding a managed Julia project (Project + Manifest).\n * Keyed by the concrete Julia version AND any package pins, so each version\n * resolves its own compatible Manifest and each distinct set of pins gets its\n * own environment: a Manifest resolved by one Julia version (or package set)\n * can pin versions that fail to precompile under another. A missing version\n * and no pins falls back to the unversioned root.\n */\nexport function managedProjectDir(version?: string, pins?: PackagePins): string {\n const base = process.env.XDG_DATA_HOME || join(homedir(), \".local\", \"share\");\n const root = join(base, \"mcmcjs\", \"julia\", \"env\");\n if (!version && !hasPins(pins)) return root;\n let leaf = (version ?? \"default\").replace(/[^A-Za-z0-9._-]/g, \"_\");\n if (hasPins(pins)) leaf += `-${sha256(canonicalJson(pins)).slice(0, 8)}`;\n return join(root, leaf);\n}\n\n// Records what a managed dir was provisioned with (package set + pins), so an\n// env from an older set is healed (Pkg.add is additive) rather than left stale.\nfunction sentinelPath(dir: string): string {\n return join(dir, \".mcmcjs-packages.json\");\n}\n\nfunction expectedSentinel(pins?: PackagePins): string {\n return canonicalJson({ packages: [...PACKAGES].sort(), pins: pins ?? {} });\n}\n\nfunction provisioned(dir: string, pins?: PackagePins): boolean {\n try {\n return readFileSync(sentinelPath(dir), \"utf8\").trim() === expectedSentinel(pins);\n } catch {\n return false;\n }\n}\n\n/** Whether the managed project is present and provisioned with the current package set and pins. */\nexport function managedProjectReady(\n dir: string = managedProjectDir(),\n pins?: PackagePins,\n): boolean {\n return existsSync(join(dir, \"Project.toml\")) && provisioned(dir, pins);\n}\n\n/** The `Pkg.add` argument: a PackageSpec per managed package, version-pinned where requested. */\nfunction packageSpecsCode(pins?: PackagePins): string {\n const specs = PACKAGES.map((name) => {\n const version = pins?.[name];\n return version\n ? `Pkg.PackageSpec(name=${JSON.stringify(name)}, version=${JSON.stringify(version)})`\n : `Pkg.PackageSpec(name=${JSON.stringify(name)})`;\n });\n return `[${specs.join(\", \")}]`;\n}\n\n/**\n * Ensures the managed Julia project exists with the inference packages installed\n * (version-pinned where `pins` requests). Idempotent: returns immediately when\n * already provisioned with the current set and pins, otherwise adds (and\n * precompiles) the packages. The first run resolves and precompiles the project,\n * which can take several minutes.\n */\nexport async function ensureProject(\n juliaBin: string,\n run: CommandRunner = createRunner(30 * 60_000),\n dir: string = managedProjectDir(),\n pins?: PackagePins,\n): Promise<string> {\n validatePins(pins);\n if (managedProjectReady(dir, pins)) return dir;\n mkdirSync(dir, { recursive: true });\n const code = `using Pkg; Pkg.add(${packageSpecsCode(pins)}); Pkg.precompile()`;\n await run(juliaBin, [\"--startup-file=no\", `--project=${dir}`, \"-e\", code]);\n writeFileSync(sentinelPath(dir), expectedSentinel(pins));\n return dir;\n}\n","import { join } from \"node:path\";\nimport type { ResolvedSpec } from \"@mcmcjs/core\";\nimport type { FitResult, FitRunner } from \"@mcmcjs/engine\";\nimport { runFit } from \"./fit\";\n\nexport interface MatrixEntry {\n version: string;\n status: \"ok\" | \"error\";\n samplesFile?: string;\n runtimeActual?: string;\n elapsedMs: number;\n stage?: FitResult[\"stage\"];\n error?: string;\n}\n\nexport interface MatrixResult {\n entries: MatrixEntry[];\n /** True only when every requested version ran and succeeded. */\n ok: boolean;\n}\n\nexport interface ResolvedInvocation {\n command: string;\n args: string[];\n version?: string;\n}\n\nexport interface MatrixIo {\n spawn: FitRunner;\n /** Directory the per-version samples files are written into. */\n outDir: string;\n /** Resolves a version/channel to a concrete invocation; injectable for tests. */\n resolve: (version: string) => Promise<ResolvedInvocation>;\n /** Provisions the managed env for a resolved version and returns its dir. */\n ensure: (resolved: ResolvedInvocation) => Promise<string>;\n /** Source path when the data came from a referenced file; recorded per version. */\n dataFile?: string;\n /** Overrides the recorded data hash (the data file's bytes hash). */\n dataSha256?: string;\n /** Continue after a version fails instead of stopping. */\n keepGoing?: boolean;\n}\n\n/** Runs the same spec across several Julia versions, one samples file per version. */\nexport async function runMatrix(\n spec: ResolvedSpec,\n versions: string[],\n io: MatrixIo,\n): Promise<MatrixResult> {\n const entries: MatrixEntry[] = [];\n for (const version of versions) {\n let entry: MatrixEntry;\n try {\n const resolved = await io.resolve(version);\n const projectDir = await io.ensure(resolved);\n const versioned = { ...spec, backend: { ...spec.backend, version } };\n const result = await runFit(versioned, resolved, {\n spawn: io.spawn,\n projectDir,\n outPath: join(io.outDir, `${version}.samples.json`),\n dataFile: io.dataFile,\n dataSha256: io.dataSha256,\n });\n entry = {\n version,\n status: result.status,\n samplesFile: result.samplesFile,\n runtimeActual: result.runtimeActual,\n elapsedMs: result.elapsedMs,\n stage: result.stage,\n error: result.error,\n };\n } catch (error) {\n entry = { version, status: \"error\", elapsedMs: 0, error: (error as Error).message };\n }\n entries.push(entry);\n if (entry.status === \"error\" && !io.keepGoing) break;\n }\n return {\n entries,\n ok: entries.length === versions.length && entries.every((e) => e.status === \"ok\"),\n };\n}\n","import { type DoctorReport, runDoctor } from \"./doctor\";\nimport { type CommandRunner, createRunner, type ToolInfo } from \"./environment\";\n\n/** The official juliaup install script, piped to a shell by the install step. */\nconst JULIAUP_INSTALL_URL = \"https://install.julialang.org\";\n\n/** An executable and its arguments, run directly (no shell word-splitting). */\nexport interface InstallCommand {\n command: string;\n args: string[];\n}\n\n/**\n * The command that installs juliaup on the given platform, or null when\n * automatic install is not yet supported there.\n */\nexport function juliaupInstallCommand(platform: NodeJS.Platform): InstallCommand | null {\n if (platform === \"win32\") {\n // TODO: install juliaup on Windows via winget or the Microsoft Store.\n return null;\n }\n return { command: \"sh\", args: [\"-c\", `curl -fsSL ${JULIAUP_INSTALL_URL} | sh -s -- --yes`] };\n}\n\n/** A single provisioning step needed to make the toolchain ready. */\nexport interface SetupStep {\n tool: \"juliaup\" | \"julia\";\n /** A short description of what the step does. */\n label: string;\n /** The command to run, or null when the step cannot be performed automatically. */\n command: InstallCommand | null;\n}\n\n/** The ordered steps needed to reach a ready toolchain, given the current state. */\nexport function planSetup(report: DoctorReport, platform: NodeJS.Platform): SetupStep[] {\n if (report.julia.found) return [];\n if (report.juliaup.found) {\n return [\n {\n tool: \"julia\",\n label: \"install the latest stable Julia via juliaup\",\n command: { command: report.juliaup.path ?? \"juliaup\", args: [\"add\", \"release\"] },\n },\n ];\n }\n return [\n {\n tool: \"juliaup\",\n label: \"install juliaup (this also installs Julia)\",\n command: juliaupInstallCommand(platform),\n },\n ];\n}\n\nexport type StepStatus = \"ran\" | \"skipped\" | \"failed\" | \"unsupported\";\n\nexport interface SetupStepResult extends SetupStep {\n status: StepStatus;\n /** Error detail when the step failed. */\n detail?: string;\n}\n\nexport interface SetupResult {\n juliaup: ToolInfo;\n julia: ToolInfo;\n /** True when Julia is available after setup. */\n ready: boolean;\n steps: SetupStepResult[];\n}\n\nexport interface SetupOptions {\n /** Runs detection commands. Injectable for tests. */\n runner?: CommandRunner;\n /** Runs install steps, which may take several minutes. Injectable for tests. */\n installer?: CommandRunner;\n /** Target platform; defaults to the current process platform. */\n platform?: NodeJS.Platform;\n /** Plan the steps but do not run them. */\n dryRun?: boolean;\n}\n\n/** Installs the Julia toolchain (juliaup and Julia) needed for inference. */\nexport async function runSetup(options: SetupOptions = {}): Promise<SetupResult> {\n const {\n runner,\n installer = createRunner(15 * 60_000),\n platform = process.platform,\n dryRun = false,\n } = options;\n\n const before = await runDoctor(runner);\n if (before.ready) return { ...before, steps: [] };\n\n const plan = planSetup(before, platform);\n\n if (dryRun) {\n return {\n ...before,\n steps: plan.map((step) => ({ ...step, status: step.command ? \"skipped\" : \"unsupported\" })),\n };\n }\n\n const steps: SetupStepResult[] = [];\n for (const step of plan) {\n if (!step.command) {\n steps.push({ ...step, status: \"unsupported\" });\n continue;\n }\n try {\n await installer(step.command.command, step.command.args);\n steps.push({ ...step, status: \"ran\" });\n } catch (error) {\n const detail = error instanceof Error ? error.message : String(error);\n steps.push({ ...step, status: \"failed\", detail });\n }\n }\n\n const after = await runDoctor(runner);\n return { juliaup: after.juliaup, julia: after.julia, ready: after.ready, steps };\n}\n","import type { CommandRunner, RuntimeVersion } from \"@mcmcjs/engine\";\n\ninterface ChannelInfo {\n Name: string;\n File: string;\n Args?: string[];\n Version?: string;\n Arch?: string;\n}\n\ninterface Getconfig1 {\n DefaultChannel: ChannelInfo | null;\n OtherChannels: ChannelInfo[];\n}\n\nfunction parseChannel(value: unknown): ChannelInfo {\n const c = value as Record<string, unknown>;\n if (!c || typeof c.Name !== \"string\" || typeof c.File !== \"string\") {\n throw new Error(\"unexpected `juliaup api getconfig1` channel shape\");\n }\n return {\n Name: c.Name,\n File: c.File,\n Args: Array.isArray(c.Args) ? (c.Args as string[]) : undefined,\n Version: typeof c.Version === \"string\" ? c.Version : undefined,\n Arch: typeof c.Arch === \"string\" ? c.Arch : undefined,\n };\n}\n\nfunction parseGetconfig1(raw: string): Getconfig1 {\n let data: unknown;\n try {\n data = JSON.parse(raw);\n } catch {\n throw new Error(\"could not parse `juliaup api getconfig1` output as JSON\");\n }\n const obj = data as Record<string, unknown>;\n if (!obj || typeof obj !== \"object\" || !Array.isArray(obj.OtherChannels)) {\n throw new Error(\"unexpected `juliaup api getconfig1` output\");\n }\n return {\n DefaultChannel: obj.DefaultChannel ? parseChannel(obj.DefaultChannel) : null,\n OtherChannels: obj.OtherChannels.map(parseChannel),\n };\n}\n\nfunction toVersion(channel: ChannelInfo, isDefault: boolean): RuntimeVersion {\n return { id: channel.Name, version: channel.Version, path: channel.File || undefined, isDefault };\n}\n\n/** Lists the installed Julia versions, marking the default channel. */\nexport async function listVersions(bin: string, run: CommandRunner): Promise<RuntimeVersion[]> {\n const config = parseGetconfig1(await run(bin, [\"api\", \"getconfig1\"]));\n const versions: RuntimeVersion[] = [];\n if (config.DefaultChannel) versions.push(toVersion(config.DefaultChannel, true));\n for (const channel of config.OtherChannels) versions.push(toVersion(channel, false));\n return versions;\n}\n\nexport async function addVersion(\n bin: string,\n channel: string,\n opts: { default?: boolean },\n run: CommandRunner,\n): Promise<void> {\n await run(bin, [\"add\", channel]);\n if (opts.default) await run(bin, [\"default\", channel]);\n}\n\nexport async function removeVersion(\n bin: string,\n channel: string,\n run: CommandRunner,\n): Promise<void> {\n await run(bin, [\"remove\", channel]);\n}\n\nexport async function setDefaultVersion(\n bin: string,\n channel: string,\n run: CommandRunner,\n): Promise<void> {\n await run(bin, [\"default\", channel]);\n}\n\nexport async function updateVersion(\n bin: string,\n channel: string | undefined,\n run: CommandRunner,\n): Promise<void> {\n await run(bin, channel ? [\"update\", channel] : [\"update\"]);\n}\n\nexport async function gcVersions(bin: string, run: CommandRunner): Promise<void> {\n await run(bin, [\"gc\"]);\n}\n\n/** Resolves a channel to a concrete invocation, preferring its absolute binary path. */\nexport async function resolveVersion(\n bin: string,\n channel: string,\n run: CommandRunner,\n): Promise<{ command: string; args: string[]; version?: string }> {\n const config = parseGetconfig1(await run(bin, [\"api\", \"getconfig1\"]));\n const all = config.DefaultChannel\n ? [config.DefaultChannel, ...config.OtherChannels]\n : config.OtherChannels;\n const match = all.find((c) => c.Name === channel);\n if (!match?.File) {\n throw new Error(\n `Julia version \"${channel}\" is not installed. Add it with: mcmc julia version add ${channel}`,\n );\n }\n return { command: match.File, args: match.Args ?? [], version: match.Version };\n}\n\n/** Throws with an actionable message if any requested channel is not installed. */\nexport function assertVersionsInstalled(channels: string[], installed: RuntimeVersion[]): void {\n const have = new Set(installed.map((v) => v.id));\n const missing = channels.filter((c) => !have.has(c));\n if (missing.length > 0) {\n const fixes = missing.map((m) => `mcmc julia version add ${m}`).join(\"; \");\n throw new Error(\n `Julia version(s) not installed: ${missing.join(\", \")}. Install with: ${fixes}`,\n );\n }\n}\n","import { spawn } from \"node:child_process\";\nimport { mkdirSync, readdirSync, rmdirSync, rmSync, statSync } from \"node:fs\";\nimport { createConnection, type Socket } from \"node:net\";\nimport { join } from \"node:path\";\nimport type { ResolvedSpec } from \"@mcmcjs/core\";\nimport type { FitResult } from \"@mcmcjs/engine\";\nimport { parseProgressLine } from \"@mcmcjs/engine\";\nimport { type FitIo, finalizeOkFit, fitRequest, runFit } from \"./fit\";\nimport { sha256, sharedTmpParent, toStage, workerPath } from \"./runner-common\";\n\nconst START_WAIT_MS = 180_000;\nconst CONNECT_TIMEOUT_MS = 1_000;\nconst STOP_ACK_TIMEOUT_MS = 3_000;\n\n/** Same 30-minute budget as the one-shot driver; MCMC_WORKER_TIMEOUT_MS overrides. */\nfunction fitInactivityTimeoutMs(): number {\n const fromEnv = Number(process.env.MCMC_WORKER_TIMEOUT_MS);\n return Number.isFinite(fromEnv) && fromEnv > 0 ? fromEnv : 30 * 60_000;\n}\n\n/** A hung worker is not retried; the fit is reported failed instead. */\nclass WorkerTimeoutError extends Error {}\n\n/** Where worker sockets live; runtime dir when available, the shared tmp parent otherwise. */\nexport function workersDir(): string {\n const runtime = process.env.XDG_RUNTIME_DIR;\n const dir = runtime ? join(runtime, \"mcmcjs\") : join(sharedTmpParent(), \"workers\");\n mkdirSync(dir, { recursive: true, mode: 0o700 });\n return dir;\n}\n\n/** One worker per (Julia binary, project env) pair, named by a key hash. */\nexport function workerSocketPath(command: string, projectDir: string): string {\n return join(workersDir(), `worker-${sha256(`${command}\\n${projectDir}`).slice(0, 12)}.sock`);\n}\n\nfunction connectOnce(path: string): Promise<Socket> {\n return new Promise((resolve, reject) => {\n const sock = createConnection(path);\n const timer = setTimeout(() => {\n sock.destroy();\n reject(new Error(\"connect timeout\"));\n }, CONNECT_TIMEOUT_MS);\n sock.once(\"connect\", () => {\n clearTimeout(timer);\n resolve(sock);\n });\n sock.once(\"error\", (error) => {\n clearTimeout(timer);\n reject(error);\n });\n });\n}\n\nconst delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));\n\n/**\n * Serializes cold starts: only one invocation spawns a worker per socket path;\n * the rest poll the socket. A stale lock (a dead spawner) is taken over.\n */\nfunction acquireStartLock(socketPath: string): boolean {\n const lock = `${socketPath}.start`;\n try {\n mkdirSync(lock);\n return true;\n } catch {\n try {\n if (Date.now() - statSync(lock).mtimeMs > START_WAIT_MS) {\n rmdirSync(lock);\n mkdirSync(lock);\n return true;\n }\n } catch {}\n return false;\n }\n}\n\nfunction releaseStartLock(socketPath: string): void {\n try {\n rmdirSync(`${socketPath}.start`);\n } catch {}\n}\n\n/** Connects to the keyed worker, starting one (detached) if none answers. */\nexport async function ensureWorker(\n resolved: { command: string; args: string[] },\n projectDir: string,\n notify?: (line: string) => void,\n): Promise<Socket> {\n const path = workerSocketPath(resolved.command, projectDir);\n try {\n return await connectOnce(path);\n } catch {}\n\n let spawnFailure: Error | undefined;\n const startedHere = acquireStartLock(path);\n if (startedHere) {\n try {\n rmSync(path, { force: true });\n notify?.(\"starting the Julia worker (first use loads Turing, can take a minute)...\");\n const child = spawn(\n resolved.command,\n [...resolved.args, \"--startup-file=no\", `--project=${projectDir}`, workerPath(), path],\n { detached: true, stdio: \"ignore\" },\n );\n child.on(\"error\", (error) => {\n spawnFailure = error;\n });\n child.on(\"exit\", (code) => {\n if (code !== 0 && code !== null) {\n spawnFailure = new Error(`the worker exited with code ${code} before serving`);\n }\n });\n child.unref();\n } catch (error) {\n releaseStartLock(path);\n throw error;\n }\n }\n\n try {\n const deadline = Date.now() + START_WAIT_MS;\n for (;;) {\n if (spawnFailure) throw spawnFailure;\n try {\n return await connectOnce(path);\n } catch {}\n if (Date.now() > deadline) throw new Error(\"the Julia worker did not start in time\");\n await delay(250);\n }\n } finally {\n if (startedHere) releaseStartLock(path);\n }\n}\n\n/**\n * Streams progress lines to onProgress and resolves with the final result\n * line. The inactivity deadline (reset by every byte the worker sends, so\n * healthy long fits survive on their progress stream) rejects with\n * WorkerTimeoutError rather than hanging forever on a wedged worker.\n */\nfunction readWorkerResponse(\n sock: Socket,\n onProgress?: FitIo[\"onProgress\"],\n inactivityMs = fitInactivityTimeoutMs(),\n): Promise<Record<string, unknown>> {\n return new Promise((resolve, reject) => {\n let pending = \"\";\n let settled = false;\n const settle = (fn: () => void) => {\n if (settled) return;\n settled = true;\n sock.setTimeout(0);\n fn();\n };\n sock.setTimeout(inactivityMs, () => {\n const error = new WorkerTimeoutError(\n `the worker sent nothing for ${Math.round(inactivityMs / 60_000)} minutes`,\n );\n settle(() => {\n sock.destroy();\n reject(error);\n });\n });\n sock.on(\"data\", (chunk: Buffer) => {\n pending += chunk.toString(\"utf8\");\n for (;;) {\n const at = pending.indexOf(\"\\n\");\n if (at === -1) break;\n const line = pending.slice(0, at).trim();\n pending = pending.slice(at + 1);\n if (!line) continue;\n const progress = parseProgressLine(line);\n if (progress) {\n onProgress?.(progress);\n continue;\n }\n try {\n const doc = JSON.parse(line) as Record<string, unknown>;\n settle(() => {\n sock.end();\n resolve(doc);\n });\n return;\n } catch {}\n }\n });\n sock.on(\"error\", (error) => settle(() => reject(error)));\n sock.on(\"close\", () => settle(() => reject(new Error(\"worker closed the connection\"))));\n });\n}\n\n/** Runs one fit through the persistent worker. Throws on worker-infrastructure failure. */\nexport async function runFitViaWorker(\n spec: ResolvedSpec,\n resolved: { command: string; args: string[] },\n io: FitIo & { notify?: (line: string) => void },\n): Promise<FitResult> {\n const startedAt = new Date().toISOString();\n const start = performance.now();\n const sock = await ensureWorker(resolved, io.projectDir, io.notify);\n sock.write(`${JSON.stringify(fitRequest(spec, io.outPath))}\\n`);\n const final = await readWorkerResponse(sock, io.onProgress);\n const elapsedMs = Math.round(performance.now() - start);\n\n if (final.ok !== true) {\n // \"worker\" is the worker's own protocol failure, not a model failure;\n // throwing hands the fit to the one-shot driver.\n if (final.stage === \"worker\") throw new Error(String(final.error ?? \"worker error\"));\n return {\n status: \"error\",\n runtimeRequested: spec.backend.version,\n elapsedMs,\n stage: toStage(final.stage),\n error: String(final.error ?? \"worker error\"),\n };\n }\n return finalizeOkFit(\n spec,\n resolved,\n io,\n final.provenance as Record<string, unknown> | undefined,\n startedAt,\n elapsedMs,\n );\n}\n\n/**\n * Runs a fit through the worker when asked (and possible), falling back to the\n * one-shot driver on worker-infrastructure failures. Two exceptions never fall\n * back: a fit that genuinely failed (model error) is returned, and a hung\n * worker (timeout) is reported rather than silently re-run for another\n * half hour.\n */\nexport async function runFitAuto(\n spec: ResolvedSpec,\n resolved: { command: string; args: string[] },\n io: FitIo & { daemon?: boolean; notify?: (line: string) => void },\n): Promise<FitResult> {\n if (io.daemon && process.platform !== \"win32\") {\n const start = performance.now();\n try {\n return await runFitViaWorker(spec, resolved, io);\n } catch (error) {\n if (error instanceof WorkerTimeoutError) {\n return {\n status: \"error\",\n runtimeRequested: spec.backend.version,\n elapsedMs: Math.round(performance.now() - start),\n stage: \"worker\",\n error: `${error.message}; the worker may be wedged, try mcmc daemon stop`,\n };\n }\n io.notify?.(\n `worker unavailable (${(error as Error).message}); falling back to a one-shot run`,\n );\n }\n }\n return runFit(spec, resolved, io);\n}\n\nexport interface WorkerStatus {\n socket: string;\n alive: boolean;\n}\n\n/** Lists known worker sockets and whether each answers. */\nexport async function listWorkers(): Promise<WorkerStatus[]> {\n const dir = workersDir();\n const sockets = readdirSync(dir).filter((f) => f.startsWith(\"worker-\") && f.endsWith(\".sock\"));\n const statuses: WorkerStatus[] = [];\n for (const name of sockets) {\n const socket = join(dir, name);\n let alive = false;\n try {\n const sock = await connectOnce(socket);\n sock.destroy();\n alive = true;\n } catch {}\n statuses.push({ socket, alive });\n }\n return statuses;\n}\n\nexport type StopOutcome = \"stopped\" | \"stale\" | \"pending\";\n\n/**\n * Asks one worker to shut down. \"stopped\": acknowledged and gone. \"stale\": the\n * socket was dead and its file was removed. \"pending\": the worker is busy with\n * a fit; the stop request is queued and honored when the fit finishes, so the\n * live socket file is left alone.\n */\nexport async function stopWorker(socket: string): Promise<StopOutcome> {\n let sock: Socket;\n try {\n sock = await connectOnce(socket);\n } catch {\n rmSync(socket, { force: true });\n return \"stale\";\n }\n const acked = await new Promise<boolean>((resolve) => {\n const timer = setTimeout(() => resolve(false), STOP_ACK_TIMEOUT_MS);\n const finish = (ok: boolean) => {\n clearTimeout(timer);\n resolve(ok);\n };\n // Without a flowing readable side the worker's FIN is never surfaced.\n sock.resume();\n sock.on(\"close\", () => finish(true));\n sock.on(\"error\", () => finish(false));\n sock.write('{\"mcmcjs\":\"stop\"}\\n');\n });\n sock.destroy();\n if (!acked) return \"pending\";\n rmSync(socket, { force: true });\n return \"stopped\";\n}\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,SAA6B,oBAAmC;AAGhE,SAAS,gBAAAA,qBAAoB;AAE7B,IAAM,gBAAgB,aAAa;AAKnC,SAAS,WAAW,QAA0B;AAC5C,QAAM,OAAO,QAAQ,IAAI,QAAQ,QAAQ;AACzC,SAAO,CAAC,KAAK,MAAM,YAAY,OAAO,MAAM,GAAG,MAAM;AACvD;AAEA,eAAe,OACb,QACA,cACA,QACmB;AACnB,aAAW,QAAQ,WAAW,MAAM,GAAG;AACrC,QAAI;AACF,YAAM,UAAU,aAAa,MAAM,OAAO,MAAM,CAAC,WAAW,CAAC,CAAC;AAC9D,UAAI,QAAS,QAAO,EAAE,OAAO,MAAM,SAAS,KAAK;AAAA,IACnD,QAAQ;AAAA,IAER;AAAA,EACF;AACA,SAAO,EAAE,OAAO,MAAM;AACxB;AAEA,IAAM,gBAAgB,CAAC,WAAuC,OAAO,MAAM,iBAAiB,IAAI,CAAC;AAG1F,SAAS,YAAY,SAAwB,eAAkC;AACpF,SAAO,OAAO,SAAS,eAAe,MAAM;AAC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MAAM,CAAC;AAAA,EACjC;AACA,SAAO;AACT;AAUA,eAAsB,WAAW,QAAsC;AACrE,MAAI;AACJ,MAAI;AACF,WAAO,MAAM,YAAY,MAAM;AAAA,EACjC,QAAQ;AACN,IAAAE,QAAO,QAAQ,EAAE,OAAO,KAAK,CAAC;AAC9B,WAAO;AAAA,EACT;AACA,QAAM,QAAQ,MAAM,IAAI,QAAiB,CAAC,YAAY;AACpD,UAAM,QAAQ,WAAW,MAAM,QAAQ,KAAK,GAAG,mBAAmB;AAClE,UAAM,SAAS,CAAC,OAAgB;AAC9B,mBAAa,KAAK;AAClB,cAAQ,EAAE;AAAA,IACZ;AAEA,SAAK,OAAO;AACZ,SAAK,GAAG,SAAS,MAAM,OAAO,IAAI,CAAC;AACnC,SAAK,GAAG,SAAS,MAAM,OAAO,KAAK,CAAC;AACpC,SAAK,MAAM,qBAAqB;AAAA,EAClC,CAAC;AACD,OAAK,QAAQ;AACb,MAAI,CAAC,MAAO,QAAO;AACnB,EAAAA,QAAO,QAAQ,EAAE,OAAO,KAAK,CAAC;AAC9B,SAAO;AACT;","names":["createRunner","join","join","join","existsSync","readFileSync","rmSync","writeFileSync","join","canonicalJson","parseSamples","RUN_RECORD_SCHEMA_VERSION","join","writeFileSync","rmSync","existsSync","parseSamples","readFileSync","RUN_RECORD_SCHEMA_VERSION","canonicalJson","existsSync","mkdirSync","readFileSync","writeFileSync","homedir","join","canonicalJson","createRunner","join","homedir","canonicalJson","readFileSync","existsSync","createRunner","mkdirSync","writeFileSync","join","join","createRunner","mkdirSync","rmSync","join","join","mkdirSync","rmSync"]}
|
package/dist/worker.jl
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# MCMC.js persistent fit worker. Keeps Turing loaded between fits so warm
|
|
2
|
+
# re-fits skip the cold start. Listens on a Unix domain socket (ARGS[1]); each
|
|
3
|
+
# connection carries one JSON request line and receives {"mcmcjs":"progress"}
|
|
4
|
+
# lines followed by one final handle_request result line. A {"mcmcjs":"stop"}
|
|
5
|
+
# request shuts the worker down; so does half an hour of idleness.
|
|
6
|
+
include(joinpath(@__DIR__, "fitlib.jl"))
|
|
7
|
+
using Sockets
|
|
8
|
+
|
|
9
|
+
const IDLE_TIMEOUT_S = 30 * 60
|
|
10
|
+
|
|
11
|
+
# True while this process still owns the socket path: another worker stealing
|
|
12
|
+
# the path (by binding over it) changes the inode, and a worker that lost the
|
|
13
|
+
# path must never delete its successor's socket.
|
|
14
|
+
function owns_socket(path, ino)
|
|
15
|
+
try
|
|
16
|
+
return stat(path).inode == ino
|
|
17
|
+
catch
|
|
18
|
+
return false
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
function remove_if_owned(path, ino)
|
|
23
|
+
owns_socket(path, ino) && rm(path; force = true)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
function serve(path)
|
|
27
|
+
mkpath(dirname(path))
|
|
28
|
+
if ispath(path)
|
|
29
|
+
# A live worker already serving this path wins; a dead socket file is cleared.
|
|
30
|
+
try
|
|
31
|
+
close(Sockets.connect(path))
|
|
32
|
+
exit(0)
|
|
33
|
+
catch
|
|
34
|
+
rm(path; force = true)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
server = Sockets.listen(path)
|
|
38
|
+
ino = stat(path).inode
|
|
39
|
+
atexit(() -> remove_if_owned(path, ino))
|
|
40
|
+
|
|
41
|
+
last_activity = Ref(time())
|
|
42
|
+
busy = Ref(false)
|
|
43
|
+
# The watchdog task is cooperative: it gets scheduled while the main task
|
|
44
|
+
# blocks on accept. The busy guard is belt and braces for any future
|
|
45
|
+
# multithreaded scheduling.
|
|
46
|
+
@async while true
|
|
47
|
+
sleep(30)
|
|
48
|
+
if !busy[] && time() - last_activity[] > IDLE_TIMEOUT_S
|
|
49
|
+
remove_if_owned(path, ino)
|
|
50
|
+
exit(0)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
while true
|
|
55
|
+
sock = Sockets.accept(server)
|
|
56
|
+
busy[] = true
|
|
57
|
+
stopping = false
|
|
58
|
+
try
|
|
59
|
+
line = readline(sock)
|
|
60
|
+
if isempty(strip(line))
|
|
61
|
+
close(sock)
|
|
62
|
+
continue
|
|
63
|
+
end
|
|
64
|
+
request = JSON.parse(line)
|
|
65
|
+
if get(request, "mcmcjs", "") == "stop"
|
|
66
|
+
stopping = true
|
|
67
|
+
println(sock, JSON.json(Dict("ok" => true, "stopped" => true)))
|
|
68
|
+
else
|
|
69
|
+
PROGRESS_IO[] = sock
|
|
70
|
+
result = try
|
|
71
|
+
handle_request(request)
|
|
72
|
+
finally
|
|
73
|
+
PROGRESS_IO[] = stderr
|
|
74
|
+
end
|
|
75
|
+
println(sock, JSON.json(result))
|
|
76
|
+
end
|
|
77
|
+
close(sock)
|
|
78
|
+
catch err
|
|
79
|
+
try
|
|
80
|
+
println(sock, JSON.json(Dict("ok" => false, "error" => sprint(showerror, err), "stage" => "worker")))
|
|
81
|
+
close(sock)
|
|
82
|
+
catch
|
|
83
|
+
end
|
|
84
|
+
finally
|
|
85
|
+
busy[] = false
|
|
86
|
+
last_activity[] = time()
|
|
87
|
+
end
|
|
88
|
+
if stopping
|
|
89
|
+
remove_if_owned(path, ino)
|
|
90
|
+
exit(0)
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
serve(ARGS[1])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcmcjs/julia",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Julia toolchain detection and the inference runner for MCMC.js.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcmc",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@mcmcjs/core": "0.
|
|
50
|
-
"@mcmcjs/engine": "0.
|
|
49
|
+
"@mcmcjs/core": "0.4.0",
|
|
50
|
+
"@mcmcjs/engine": "0.3.0"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "tsup",
|