comfy-ts 2.20.1 → 2.21.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/README.md +21 -3
- package/dist/{ServeApp-B469W26E.js → ServeApp-ByMobrWW.js} +3 -3
- package/dist/{ServeApp-B469W26E.js.map → ServeApp-ByMobrWW.js.map} +1 -1
- package/dist/cli.js +5 -5
- package/dist/{exampleAssets-8MycEthF.js → exampleAssets-B5sMqNia.js} +58 -3
- package/dist/exampleAssets-B5sMqNia.js.map +1 -0
- package/dist/{findDefinedWorkflow-B90-xFxX.js → findDefinedWorkflow-BNZgYIww.js} +2 -2
- package/dist/{findDefinedWorkflow-B90-xFxX.js.map → findDefinedWorkflow-BNZgYIww.js.map} +1 -1
- package/dist/index.cjs +87 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -3
- package/dist/index.d.ts +19 -3
- package/dist/index.js +87 -19
- package/dist/index.js.map +1 -1
- package/dist/{run-run-BslhZ0Qm.js → run-run-CuBSygku.js} +5 -5
- package/dist/{run-run-BslhZ0Qm.js.map → run-run-CuBSygku.js.map} +1 -1
- package/dist/{run-serve-CsEYPGm9.js → run-serve-COk_G0Qz.js} +4 -4
- package/dist/{run-serve-CsEYPGm9.js.map → run-serve-COk_G0Qz.js.map} +1 -1
- package/dist/{run-tui-Cxa8ksav.js → run-tui-CB6i_x2y.js} +4 -4
- package/dist/{run-tui-Cxa8ksav.js.map → run-tui-CB6i_x2y.js.map} +1 -1
- package/dist/{schemaDrift-DaWsE-mt.js → schemaDrift-CHDVYlaj.js} +32 -19
- package/dist/{schemaDrift-DaWsE-mt.js.map → schemaDrift-CHDVYlaj.js.map} +1 -1
- package/dist/web.d.ts +19 -3
- package/dist/web.js +87 -19
- package/dist/web.js.map +1 -1
- package/package.json +2 -2
- package/src/host/ComfyHost.ts +21 -0
- package/src/host/leastBusy.ts +37 -0
- package/src/state.ts +6 -0
- package/src/vars/DefinedWorkflow.ts +38 -21
- package/dist/exampleAssets-8MycEthF.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as ComfyTS, t as bundledExamplesDir } from "./exampleAssets-
|
|
2
|
-
import { ht as extractErrorMessage } from "./schemaDrift-
|
|
3
|
-
import { h as moduleName, n as mergeWorkflowSources, r as scanCflowFiles, t as findDefinedWorkflow } from "./findDefinedWorkflow-
|
|
4
|
-
import { n as describeVar, r as renderDescriptorLine, t as ServeApp } from "./ServeApp-
|
|
1
|
+
import { r as ComfyTS, t as bundledExamplesDir } from "./exampleAssets-B5sMqNia.js";
|
|
2
|
+
import { ht as extractErrorMessage } from "./schemaDrift-CHDVYlaj.js";
|
|
3
|
+
import { h as moduleName, n as mergeWorkflowSources, r as scanCflowFiles, t as findDefinedWorkflow } from "./findDefinedWorkflow-BNZgYIww.js";
|
|
4
|
+
import { n as describeVar, r as renderDescriptorLine, t as ServeApp } from "./ServeApp-ByMobrWW.js";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
|
6
6
|
import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
7
7
|
import { basename, dirname, extname, isAbsolute, join, resolve } from "pathe";
|
|
@@ -446,4 +446,4 @@ async function runRun(argv) {
|
|
|
446
446
|
//#endregion
|
|
447
447
|
export { runRun };
|
|
448
448
|
|
|
449
|
-
//# sourceMappingURL=run-run-
|
|
449
|
+
//# sourceMappingURL=run-run-CuBSygku.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-run-BslhZ0Qm.js","names":[],"sources":["../src/cli/run/flagValue.ts","../src/cli/run/outputPaths.ts","../src/cli/run/pickModule.ts","../src/cli/run/sidecar.ts","../src/cli/run/runArgs.ts","../src/cli/run/findModules.ts","../src/cli/run/run-run.ts"],"sourcesContent":["// one `--<var> <value>` flag, a string on the command line, as the value serve's payload takes\n// for that var kind (applyVarPayload validates it after, so this only shapes, never judges)\nimport { isAbsolute, resolve } from 'pathe'\nimport type { ChoiceSelect, VarKind } from 'src/vars/ComfyVars.ts'\n\nexport type FlagSpec = { kind: VarKind; select?: ChoiceSelect }\n\nconst TRUE = new Set(['true', 'yes', '1', 'on'])\nconst FALSE = new Set(['false', 'no', '0', 'off'])\n\n/** `raw` is `true` for a bare flag (`--upscale`) */\nexport function flagValue(p: {\n name: string\n spec: FlagSpec\n raw: string | true\n cwd: string\n}): { value: unknown } | { error: string } {\n const raw = p.raw\n if (p.spec.kind === 'toggle') {\n if (raw === true) return { value: true }\n const v = raw.toLowerCase()\n if (TRUE.has(v)) return { value: true }\n if (FALSE.has(v)) return { value: false }\n return { error: `--${p.name} is a toggle: true or false` }\n }\n if (raw === true) return { error: `--${p.name} needs a value` }\n switch (p.spec.kind) {\n case 'int':\n case 'float':\n return { value: raw }\n case 'seed': {\n // a random seed as a number: serve rerolls a '?' mode only when the payload leaves the seed out\n if (raw === '?') return { value: Math.floor(Math.random() * 2 ** 32) }\n const n = Number(raw)\n return Number.isFinite(n) ? { value: n } : { error: `--${p.name} is a seed: a number, or ? for a random one` }\n }\n case 'choice':\n if (p.spec.select === 'many')\n return {\n value: raw\n .split(',')\n .map((x) => x.trim())\n .filter((x) => x !== ''),\n }\n if (p.spec.select === 'zero-or-one' && raw === 'none') return { value: null }\n return { value: raw }\n case 'loras':\n try {\n return { value: JSON.parse(raw) }\n } catch {\n return { error: `--${p.name} takes the loras as json, like '{\"name.safetensors\": 0.8}'` }\n }\n case 'image':\n case 'audio':\n case 'video':\n // a url goes through as is: serve downloads it\n return { value: /^https?:\\/\\//.test(raw) || isAbsolute(raw) ? raw : resolve(p.cwd, raw) }\n default:\n return { value: raw }\n }\n}\n","// where `comfy-ts run` writes each output. `--out a.png` and one output: exactly there, its\n// extension swapped for the output's own when they differ (said on the line); several outputs\n// are numbered (`a-1.png`); a dir keeps the server's filenames; no --out names them after the\n// module and the prompt in the cwd. Pure: the caller says whether --out is a dir\nimport { basename, extname, join, resolve } from 'pathe'\n\nexport type Produced = { filename: string }\nexport type Destination = { path: string; note: string | null }\n\nexport function outputPaths(p: {\n out: string | null\n outIsDir: boolean\n module: string\n promptId: string\n items: readonly Produced[]\n cwd: string\n}): Destination[] {\n const n = p.items.length\n if (p.out != null && p.outIsDir) {\n const dir = resolve(p.cwd, p.out)\n return p.items.map((it) => ({ path: join(dir, basename(it.filename)), note: null }))\n }\n const base = p.out == null ? join(p.cwd, `${p.module}-${p.promptId.slice(0, 8)}`) : resolve(p.cwd, p.out)\n const asked = p.out == null ? '' : extname(base)\n const stem = asked === '' ? base : base.slice(0, -asked.length)\n return p.items.map((it, ix) => {\n const own = extname(it.filename)\n const path = `${stem}${n > 1 ? `-${ix + 1}` : ''}${own}`\n const note =\n asked !== '' && own !== '' && asked.toLowerCase() !== own.toLowerCase()\n ? `the output is ${own}, not ${asked}`\n : null\n return { path, note }\n })\n}\n\n/** the transcript or text beside the first media output: same stem, `.txt` */\nexport function sidecarPath(mediaPath: string): string {\n const ext = extname(mediaPath)\n return `${ext === '' ? mediaPath : mediaPath.slice(0, -ext.length)}.txt`\n}\n","// `comfy-ts run <name>`: which module a name means, over the discovered files in their order\n// (cwd first, then the bundled examples). A name may carry its folder (`rvion/anima`,\n// `comfy-cloud/anima`), which narrows to modules in a folder of that name. Tiers, first hit\n// wins: the exact module key, the key without its number (`anima-t2i` → `10-anima-t2i`), a\n// prefix of that, a substring. Two modules on the first tier that hits is ambiguous, and the\n// error names them with their folder\nimport { basename, dirname } from 'pathe'\nimport { moduleName } from 'src/cli/tui/treeRows.ts'\n\nexport type Picked = { file: string; key: string } | { error: string }\n\nconst bare = (key: string): string => key.replace(/^\\d+-/, '')\nconst qualified = (file: string): string => `${basename(dirname(file))}/${moduleName(file)}`\n\nexport function pickModule(files: readonly string[], name: string): Picked {\n const cut = name.lastIndexOf('/')\n const folder = cut < 0 ? null : name.slice(0, cut).toLowerCase()\n const n = name.slice(cut + 1).toLowerCase()\n // one file per qualified name, the first one found: a cwd module shadows a bundled one\n const byName = new Map<string, string>()\n for (const f of files) {\n if (folder != null && !qualified(f).toLowerCase().startsWith(`${folder}/`)) continue\n if (!byName.has(qualified(f))) byName.set(qualified(f), f)\n }\n const all = [...byName.values()]\n const tiers: ((k: string) => boolean)[] = [\n (k) => k === n,\n (k) => bare(k) === n,\n (k) => bare(k).startsWith(n),\n (k) => k.includes(n),\n ]\n for (const hit of tiers) {\n const found = all.filter((f) => hit(moduleName(f).toLowerCase()))\n if (found.length === 1) return { file: found[0]!, key: moduleName(found[0]!) }\n if (found.length > 1)\n return {\n error: `'${name}' matches ${found.length} modules: ${found.map(qualified).join(', ')}. Name one, folder included`,\n }\n }\n return { error: `no module matches '${name}'. Modules: ${all.map(qualified).join(', ')}` }\n}\n","// the text a media file carries beside it: a media var set from `clip.flac` whose declaration\n// links a text var (`v.audio(path, { sidecarText })`) fills that var from `clip.txt`, unless the\n// flags set it. The link is the workflow's, so run knows no var name\nimport type { AnyVar, MediaVar } from 'src/vars/ComfyVars.ts'\nimport { sidecarPath } from 'src/cli/run/outputPaths.ts'\n\nconst MEDIA = new Set(['image', 'audio', 'video'])\n\n/** each var to fill, with the sidecar it comes from */\nexport function sidecarFills(\n entries: readonly (readonly [string, AnyVar])[],\n payload: Readonly<Record<string, unknown>>,\n exists: (path: string) => boolean,\n): { name: string; from: string }[] {\n const out: { name: string; from: string }[] = []\n for (const [k, v] of entries) {\n const path = payload[k]\n // kind, never instanceof (agent/coding.md cast whitelist 6)\n if (!MEDIA.has(v.kind) || typeof path !== 'string' || /^https?:\\/\\//.test(path)) continue\n const linked = (v as MediaVar).opts.sidecarText\n const name = linked == null ? null : entries.find(([, x]) => x === linked)?.[0]\n if (name == null || name in payload || out.some((o) => o.name === name)) continue\n const from = sidecarPath(path)\n if (exists(from)) out.push({ name, from })\n }\n return out\n}\n","// `comfy-ts run [name] [--draft d] [--out p] [--json] [--verbose] [--help] [--<var> value | --<var>=value | --<toggle>]`\n// Pure: the vars stay strings here, the module's own var kinds shape them later (flagValue)\n\nexport type RunArgs = {\n name: string | null\n draft: string\n out: string | null\n json: boolean\n /** the library's own log lines, on stderr */\n verbose: boolean\n help: boolean\n /** in command line order; `true` = a bare flag */\n vars: [string, string | true][]\n}\n\nconst OWN = new Set(['draft', 'out'])\n\nexport function parseRunArgs(argv: readonly string[]): RunArgs | { error: string } {\n const r: RunArgs = { name: null, draft: 'default', out: null, json: false, verbose: false, help: false, vars: [] }\n for (let i = 0; i < argv.length; i++) {\n const a = argv[i]!\n if (a === '-h' || a === '--help') {\n r.help = true\n continue\n }\n if (a === '--json') {\n r.json = true\n continue\n }\n if (a === '--verbose') {\n r.verbose = true\n continue\n }\n if (!a.startsWith('--')) {\n if (r.name != null) return { error: `one module per run: got '${r.name}' and '${a}'` }\n r.name = a\n continue\n }\n const eq = a.indexOf('=')\n const key = eq < 0 ? a.slice(2) : a.slice(2, eq)\n if (key === '') return { error: `'${a}' names no var` }\n let value: string | true\n if (eq >= 0) value = a.slice(eq + 1)\n else {\n const next = argv[i + 1]\n if (next == null || next.startsWith('--')) value = true\n else {\n value = next\n i++\n }\n }\n if (OWN.has(key)) {\n if (value === true) return { error: `--${key} needs a value` }\n if (key === 'draft') r.draft = value\n else r.out = value\n continue\n }\n r.vars.push([key, value])\n }\n return r\n}\n","// the `*.cflow.ts` modules under the cwd for `comfy-ts run`, walked with bounds: node_modules\n// and dot dirs are never entered (a recursive readdir reads all of them before any filter,\n// which stalls a run started in a big repo or a temp dir), and the walk stops MAX_DEPTH deep\nimport { existsSync, readdirSync } from 'node:fs'\nimport { dirname, join } from 'pathe'\n\nexport const MAX_DEPTH = 5\n\nexport function findModules(dir: string, depth = 0): string[] {\n let entries: import('node:fs').Dirent[]\n try {\n entries = readdirSync(dir, { withFileTypes: true })\n } catch {\n return []\n }\n const out: string[] = []\n for (const e of entries.sort((a, b) => a.name.localeCompare(b.name))) {\n if (e.isFile() && /\\.cflow\\.tsx?$/.test(e.name)) out.push(join(dir, e.name))\n else if (e.isDirectory() && depth < MAX_DEPTH && e.name !== 'node_modules' && !e.name.startsWith('.'))\n out.push(...findModules(join(dir, e.name), depth + 1))\n }\n return out\n}\n\n/** the workspace a module belongs to: the nearest folder above it holding `.comfy-ts/` (its\n * schema cache and its tuned drafts), or null. A run roots comfy-ts there, so it never writes a\n * `.comfy-ts/` into whatever folder it was started from */\nexport function workspaceOf(file: string): string | null {\n let dir = dirname(file)\n while (true) {\n if (existsSync(join(dir, '.comfy-ts'))) return dir\n const up = dirname(dir)\n if (up === dir) return null\n dir = up\n }\n}\n","// `comfy-ts run`: one generation from the command line, headless (architecture.md item 15).\n// It is serve's generate path in process: a ServeApp over the one module, handle(POST\n// /generate/…), so drafts, payload checks, the media gate and seeds are serve's own code. Only\n// the starter differs (live progress, nothing saved by the runner) and the outputs land where\n// --out says\nimport { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs'\nimport { pathToFileURL } from 'node:url'\nimport { basename, dirname, resolve } from 'pathe'\nimport type { DefinedWorkflow } from 'src/vars/DefinedWorkflow.ts'\nimport { flagValue, type FlagSpec } from 'src/cli/run/flagValue.ts'\nimport { outputPaths, sidecarPath } from 'src/cli/run/outputPaths.ts'\nimport { pickModule } from 'src/cli/run/pickModule.ts'\nimport { sidecarFills } from 'src/cli/run/sidecar.ts'\nimport { parseRunArgs } from 'src/cli/run/runArgs.ts'\nimport { describeVar, renderDescriptorLine } from 'src/cli/serve/describeVar.ts'\nimport { ServeApp, type ServeExecution, type ServeStarter } from 'src/cli/serve/ServeApp.ts'\nimport { findModules, workspaceOf } from 'src/cli/run/findModules.ts'\nimport { mergeWorkflowSources, scanCflowFiles } from 'src/cli/tui/discoverWorkflows.ts'\nimport { findDefinedWorkflow } from 'src/cli/tui/findDefinedWorkflow.ts'\nimport { moduleName } from 'src/cli/tui/treeRows.ts'\nimport { bundledExamplesDir } from 'src/exampleAssets.ts'\nimport { ComfyTS } from 'src/state.ts'\nimport { extractErrorMessage } from 'src/utils/extractErrorMessage.ts'\n\nconst USAGE = `comfy-ts run <name | module.cflow.ts> [--draft <name>] [--<var> <value>…] [--out <path>] [--json]\n one generation, headless, with live progress. <name> is a module key (10-anima-t2i), the key\n without its number (anima-t2i), or a unique part of it (anima). \\`comfy-ts run <name> --help\\`\n lists the module's vars. --<var>-file <path> reads a text var from a file. --out a.png writes\n there (several outputs: a-1.png, a-2.png), --out dir/ keeps the server's names, no --out\n writes <module>-<id>.<ext> here. Text outputs go beside the first media output as <stem>.txt.\n --json prints one line with every output path, --verbose shows the library log on stderr`\n\ntype Out = { path: string; note: string | null; bytes: Uint8Array | null; from: string | null }\n\nfunction discover(cwd: string): string[] {\n const bundledDir = bundledExamplesDir()\n return mergeWorkflowSources({\n explicitTarget: false,\n scanned: findModules(cwd),\n bundledFiles: bundledDir == null ? [] : scanCflowFiles(bundledDir),\n }).files\n}\n\nconst log = (line: string): void => void process.stderr.write(`${line}\\n`)\n\nexport async function runRun(argv: string[]): Promise<number> {\n const args = parseRunArgs(argv)\n if ('error' in args) {\n log(`[comfy-ts run] ${args.error}`)\n return 1\n }\n // stdout carries the result lines only (one json line under --json): the library's info\n // chatter is silenced, and a stray console.log reaches stderr under --verbose, else nowhere\n const say = console.log.bind(console)\n if (!args.verbose) process.env.COMFY_TS_QUIET = '1'\n console.log = (...a: unknown[]): void => {\n if (args.verbose) console.error(...a)\n }\n const cwd = process.cwd()\n const explicit = args.name != null && /\\.cflow\\.tsx?$/.test(args.name) ? resolve(cwd, args.name) : null\n const files = explicit != null ? [explicit] : discover(cwd)\n if (args.name == null) {\n say(USAGE)\n const names = [...new Set(files.map((f) => `${basename(dirname(f))}/${moduleName(f)}`))]\n say(`\\nmodules:\\n${names.map((k) => ` ${k}`).join('\\n')}`)\n return 0\n }\n if (explicit != null && !existsSync(explicit)) {\n log(`[comfy-ts run] no such file: ${explicit}`)\n return 1\n }\n const picked = explicit != null ? { file: explicit, key: moduleName(explicit) } : pickModule(files, args.name)\n if ('error' in picked) {\n log(`[comfy-ts run] ${picked.error}`)\n return 1\n }\n\n // rooted at the module's workspace before its import registers one at the cwd: its schema\n // cache and drafts are there, and --out and media paths still resolve against the cwd\n ComfyTS.create({ rootPath: workspaceOf(picked.file) ?? cwd })\n let dw: DefinedWorkflow\n try {\n const found = findDefinedWorkflow((await import(pathToFileURL(picked.file).href)) as Record<string, unknown>)\n if (found == null) throw new Error('it exports no DefinedWorkflow')\n dw = found\n } catch (e) {\n log(`[comfy-ts run] ${picked.file}: ${extractErrorMessage(e)}`)\n return 1\n }\n const vars = new Map(dw.entries())\n\n if (args.help) {\n say(`comfy-ts run ${picked.key} (${picked.file})\\n\\nvars, each one a --<name> <value> flag:`)\n const width = Math.max(0, ...[...vars.keys()].map((k) => k.length))\n for (const [k, v] of vars) {\n const d = describeVar(v)\n // the cli's own forms where they differ from serve's json payload\n const payload =\n v.kind === 'seed'\n ? 'a number, or ? for a random one'\n : v.kind === 'toggle'\n ? 'true | false, or the bare flag'\n : v.kind === 'text' || v.kind === 'prompt'\n ? `${d.payload}, or --${k}-file <path>`\n : d.payload\n say(renderDescriptorLine(k, { ...d, payload }, width))\n }\n return 0\n }\n\n // the flags, shaped by each var's own kind\n const payload: Record<string, unknown> = {}\n for (const [name, raw] of args.vars) {\n const fileOf = name.endsWith('-file') ? name.slice(0, -'-file'.length) : null\n const target = fileOf != null && vars.has(fileOf) ? fileOf : name\n const v = vars.get(target)\n if (v == null) {\n log(`[comfy-ts run] ${picked.key} has no var '${name}'. Vars: ${[...vars.keys()].join(', ')}`)\n return 1\n }\n if (target !== name) {\n if (raw === true) {\n log(`[comfy-ts run] --${name} needs a path`)\n return 1\n }\n const path = resolve(cwd, raw)\n if (!existsSync(path)) {\n log(`[comfy-ts run] --${name}: no such file ${path}`)\n return 1\n }\n payload[target] = readFileSync(path, 'utf8').trim()\n continue\n }\n // kind, never instanceof (agent/coding.md cast whitelist 6)\n const spec: FlagSpec = { kind: v.kind, select: v.kind === 'choice' ? describeVar(v).select : undefined }\n const shaped = flagValue({ name, spec, raw, cwd })\n if ('error' in shaped) {\n log(`[comfy-ts run] ${shaped.error}`)\n return 1\n }\n payload[name] = shaped.value\n }\n // a media file's <file>.txt fills the text var its declaration links (a clip's transcript)\n for (const fill of sidecarFills([...vars], payload, existsSync)) {\n payload[fill.name] = readFileSync(fill.from, 'utf8').trim()\n if (!args.json) log(` ${fill.name} from ${fill.from}`)\n }\n\n let execution: ServeExecution | null = null\n const starter: ServeStarter = async (mod, opts) => {\n const host = opts.host ?? mod.dw.host\n await host.connect()\n const wf = await mod.dw.build({ advance: true, host })\n const ex = await wf.start({ save: false, log: !args.json })\n execution = ex\n return ex\n }\n const app = new ServeApp([{ key: picked.key, file: picked.file, dw }], { starter })\n if (!args.json) log(`▶ ${dw.host.data.id} · ${picked.key}/${args.draft}`)\n const t0 = Date.now()\n let code = 0\n try {\n const reply = await app.handle({\n method: 'POST',\n url: `/generate/${encodeURIComponent(picked.key)}/${encodeURIComponent(args.draft)}`,\n body: JSON.stringify(payload),\n })\n const body = JSON.parse(typeof reply.body === 'string' ? reply.body : new TextDecoder().decode(reply.body)) as {\n ok?: boolean\n error?: string\n seeds?: Record<string, number>\n promptId?: string\n durationMs?: number\n }\n const ex = execution as ServeExecution | null\n if (reply.status !== 200 || body.ok !== true || ex == null) {\n const error = body.error ?? `serve answered ${reply.status}`\n if (args.json) say(JSON.stringify({ ok: false, module: picked.key, draft: args.draft, error }))\n else log(`\\n✗ ${picked.key}/${args.draft}: ${error}`)\n return 1\n }\n\n const media: { filename: string; bytes: Uint8Array | null; from: string | null }[] = [\n ...ex.images.map((i) => ({ filename: i.filename, bytes: i.buffer ?? null, from: i.absPath })),\n ...(ex.audios ?? []).map((a) => ({ filename: a.filename, bytes: a.bytes, from: a.absPath })),\n ...(ex.videos ?? []).map((a) => ({ filename: a.filename, bytes: a.bytes, from: a.absPath })),\n ]\n const outIsDir =\n args.out != null &&\n (/[/\\\\]$/.test(args.out) ||\n (existsSync(resolve(cwd, args.out)) && statSync(resolve(cwd, args.out)).isDirectory()))\n const dests = outputPaths({\n out: args.out,\n outIsDir,\n module: picked.key,\n promptId: body.promptId ?? ex.data.id,\n items: media,\n cwd,\n })\n const outs: Out[] = media.map((m, i) => ({ ...dests[i]!, bytes: m.bytes, from: m.from }))\n for (const o of outs) {\n const bytes = o.bytes ?? (o.from != null ? new Uint8Array(readFileSync(o.from)) : null)\n if (bytes == null) throw new Error(`an output of ${picked.key} came back with no bytes`)\n mkdirSync(dirname(o.path), { recursive: true })\n writeFileSync(o.path, bytes)\n }\n const texts = (ex.texts ?? []).map((t) => t.text)\n const written = outs.map((o) => o.path)\n if (texts.length > 0) {\n const first = outs[0]\n if (first != null) {\n writeFileSync(sidecarPath(first.path), `${texts.join('\\n')}\\n`)\n written.push(sidecarPath(first.path))\n } else if (args.out != null && !outIsDir) {\n const path = resolve(cwd, args.out)\n mkdirSync(dirname(path), { recursive: true })\n writeFileSync(path, `${texts.join('\\n')}\\n`)\n written.push(path)\n } else if (!args.json) for (const t of texts) say(t)\n }\n const durationMs = body.durationMs ?? Date.now() - t0\n if (args.json)\n say(\n JSON.stringify({\n ok: true,\n module: picked.key,\n draft: args.draft,\n seeds: body.seeds ?? {},\n durationMs,\n outputs: written,\n texts,\n }),\n )\n else {\n const seeds = Object.entries(body.seeds ?? {})\n .map(([k, v]) => `${k} ${v}`)\n .join(', ')\n for (const o of outs) log(`✓ ${o.path}${o.note == null ? '' : ` (${o.note})`}`)\n for (const w of written.slice(outs.length)) log(`✓ ${w}`)\n log(` ${(durationMs / 1000).toFixed(1)}s${seeds === '' ? '' : ` · ${seeds}`}`)\n if (written.length === 0) log(' the run produced no output')\n }\n } catch (e) {\n log(`[comfy-ts run] 🔴 ${extractErrorMessage(e)}`)\n code = 1\n } finally {\n for (const [, h] of comfyts.hosts) h.disconnect()\n }\n return code\n}\n"],"mappings":";;;;;;;;AAOA,MAAM,uBAAO,IAAI,IAAI;CAAC;CAAQ;CAAO;CAAK;AAAI,CAAC;AAC/C,MAAM,wBAAQ,IAAI,IAAI;CAAC;CAA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,GAAG,MAAM,KAAK,IAAI,EAAE,GAAG;IAC3C,QAAQ,KAAK,IAAI;GACpB,OAAO,IAAI,CAAC,KAAK,MAAM,KAAK,MAAM,KAAK,OAAO,IAAI,CAAC;EACtD;EACA,MAAM,aAAa,KAAK,cAAc,KAAK,IAAI,IAAI;EACnD,IAAI,KAAK,MACN,IACG,KAAK,UAAU;GACZ,IAAI;GACJ,QAAQ,OAAO;GACf,OAAO,KAAK;GACZ,OAAO,KAAK,SAAS,CAAC;GACtB;GACA,SAAS;GACT;EACH,CAAC,CACJ;OACE;GACF,MAAM,QAAQ,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,CAC1C,KAAK,CAAC,GAAG,OAAO,GAAG,EAAE,GAAG,GAAG,CAAC,CAC5B,KAAK,IAAI;GACb,KAAK,MAAM,KAAK,MAAM,IAAI,KAAK,EAAE,OAAO,EAAE,QAAQ,OAAO,KAAK,MAAM,EAAE,KAAK,IAAI;GAC/E,KAAK,MAAM,KAAK,QAAQ,MAAM,KAAK,MAAM,GAAG,IAAI,KAAK,GAAG;GACxD,IAAI,MAAM,aAAa,IAAA,CAAM,QAAQ,CAAC,EAAE,GAAG,UAAU,KAAK,KAAK,MAAM,SAAS;GAC9E,IAAI,QAAQ,WAAW,GAAG,IAAI,8BAA8B;EAC/D;CACH,SAAS,GAAG;EACT,IAAI,qBAAqB,oBAAoB,CAAC,GAAG;EACjD,OAAO;CACV,UAAU;EACP,KAAK,MAAM,GAAG,MAAM,QAAQ,OAAO,EAAE,WAAW;CACnD;CACA,OAAO;AACV"}
|
|
1
|
+
{"version":3,"file":"run-run-CuBSygku.js","names":[],"sources":["../src/cli/run/flagValue.ts","../src/cli/run/outputPaths.ts","../src/cli/run/pickModule.ts","../src/cli/run/sidecar.ts","../src/cli/run/runArgs.ts","../src/cli/run/findModules.ts","../src/cli/run/run-run.ts"],"sourcesContent":["// one `--<var> <value>` flag, a string on the command line, as the value serve's payload takes\n// for that var kind (applyVarPayload validates it after, so this only shapes, never judges)\nimport { isAbsolute, resolve } from 'pathe'\nimport type { ChoiceSelect, VarKind } from 'src/vars/ComfyVars.ts'\n\nexport type FlagSpec = { kind: VarKind; select?: ChoiceSelect }\n\nconst TRUE = new Set(['true', 'yes', '1', 'on'])\nconst FALSE = new Set(['false', 'no', '0', 'off'])\n\n/** `raw` is `true` for a bare flag (`--upscale`) */\nexport function flagValue(p: {\n name: string\n spec: FlagSpec\n raw: string | true\n cwd: string\n}): { value: unknown } | { error: string } {\n const raw = p.raw\n if (p.spec.kind === 'toggle') {\n if (raw === true) return { value: true }\n const v = raw.toLowerCase()\n if (TRUE.has(v)) return { value: true }\n if (FALSE.has(v)) return { value: false }\n return { error: `--${p.name} is a toggle: true or false` }\n }\n if (raw === true) return { error: `--${p.name} needs a value` }\n switch (p.spec.kind) {\n case 'int':\n case 'float':\n return { value: raw }\n case 'seed': {\n // a random seed as a number: serve rerolls a '?' mode only when the payload leaves the seed out\n if (raw === '?') return { value: Math.floor(Math.random() * 2 ** 32) }\n const n = Number(raw)\n return Number.isFinite(n) ? { value: n } : { error: `--${p.name} is a seed: a number, or ? for a random one` }\n }\n case 'choice':\n if (p.spec.select === 'many')\n return {\n value: raw\n .split(',')\n .map((x) => x.trim())\n .filter((x) => x !== ''),\n }\n if (p.spec.select === 'zero-or-one' && raw === 'none') return { value: null }\n return { value: raw }\n case 'loras':\n try {\n return { value: JSON.parse(raw) }\n } catch {\n return { error: `--${p.name} takes the loras as json, like '{\"name.safetensors\": 0.8}'` }\n }\n case 'image':\n case 'audio':\n case 'video':\n // a url goes through as is: serve downloads it\n return { value: /^https?:\\/\\//.test(raw) || isAbsolute(raw) ? raw : resolve(p.cwd, raw) }\n default:\n return { value: raw }\n }\n}\n","// where `comfy-ts run` writes each output. `--out a.png` and one output: exactly there, its\n// extension swapped for the output's own when they differ (said on the line); several outputs\n// are numbered (`a-1.png`); a dir keeps the server's filenames; no --out names them after the\n// module and the prompt in the cwd. Pure: the caller says whether --out is a dir\nimport { basename, extname, join, resolve } from 'pathe'\n\nexport type Produced = { filename: string }\nexport type Destination = { path: string; note: string | null }\n\nexport function outputPaths(p: {\n out: string | null\n outIsDir: boolean\n module: string\n promptId: string\n items: readonly Produced[]\n cwd: string\n}): Destination[] {\n const n = p.items.length\n if (p.out != null && p.outIsDir) {\n const dir = resolve(p.cwd, p.out)\n return p.items.map((it) => ({ path: join(dir, basename(it.filename)), note: null }))\n }\n const base = p.out == null ? join(p.cwd, `${p.module}-${p.promptId.slice(0, 8)}`) : resolve(p.cwd, p.out)\n const asked = p.out == null ? '' : extname(base)\n const stem = asked === '' ? base : base.slice(0, -asked.length)\n return p.items.map((it, ix) => {\n const own = extname(it.filename)\n const path = `${stem}${n > 1 ? `-${ix + 1}` : ''}${own}`\n const note =\n asked !== '' && own !== '' && asked.toLowerCase() !== own.toLowerCase()\n ? `the output is ${own}, not ${asked}`\n : null\n return { path, note }\n })\n}\n\n/** the transcript or text beside the first media output: same stem, `.txt` */\nexport function sidecarPath(mediaPath: string): string {\n const ext = extname(mediaPath)\n return `${ext === '' ? mediaPath : mediaPath.slice(0, -ext.length)}.txt`\n}\n","// `comfy-ts run <name>`: which module a name means, over the discovered files in their order\n// (cwd first, then the bundled examples). A name may carry its folder (`rvion/anima`,\n// `comfy-cloud/anima`), which narrows to modules in a folder of that name. Tiers, first hit\n// wins: the exact module key, the key without its number (`anima-t2i` → `10-anima-t2i`), a\n// prefix of that, a substring. Two modules on the first tier that hits is ambiguous, and the\n// error names them with their folder\nimport { basename, dirname } from 'pathe'\nimport { moduleName } from 'src/cli/tui/treeRows.ts'\n\nexport type Picked = { file: string; key: string } | { error: string }\n\nconst bare = (key: string): string => key.replace(/^\\d+-/, '')\nconst qualified = (file: string): string => `${basename(dirname(file))}/${moduleName(file)}`\n\nexport function pickModule(files: readonly string[], name: string): Picked {\n const cut = name.lastIndexOf('/')\n const folder = cut < 0 ? null : name.slice(0, cut).toLowerCase()\n const n = name.slice(cut + 1).toLowerCase()\n // one file per qualified name, the first one found: a cwd module shadows a bundled one\n const byName = new Map<string, string>()\n for (const f of files) {\n if (folder != null && !qualified(f).toLowerCase().startsWith(`${folder}/`)) continue\n if (!byName.has(qualified(f))) byName.set(qualified(f), f)\n }\n const all = [...byName.values()]\n const tiers: ((k: string) => boolean)[] = [\n (k) => k === n,\n (k) => bare(k) === n,\n (k) => bare(k).startsWith(n),\n (k) => k.includes(n),\n ]\n for (const hit of tiers) {\n const found = all.filter((f) => hit(moduleName(f).toLowerCase()))\n if (found.length === 1) return { file: found[0]!, key: moduleName(found[0]!) }\n if (found.length > 1)\n return {\n error: `'${name}' matches ${found.length} modules: ${found.map(qualified).join(', ')}. Name one, folder included`,\n }\n }\n return { error: `no module matches '${name}'. Modules: ${all.map(qualified).join(', ')}` }\n}\n","// the text a media file carries beside it: a media var set from `clip.flac` whose declaration\n// links a text var (`v.audio(path, { sidecarText })`) fills that var from `clip.txt`, unless the\n// flags set it. The link is the workflow's, so run knows no var name\nimport type { AnyVar, MediaVar } from 'src/vars/ComfyVars.ts'\nimport { sidecarPath } from 'src/cli/run/outputPaths.ts'\n\nconst MEDIA = new Set(['image', 'audio', 'video'])\n\n/** each var to fill, with the sidecar it comes from */\nexport function sidecarFills(\n entries: readonly (readonly [string, AnyVar])[],\n payload: Readonly<Record<string, unknown>>,\n exists: (path: string) => boolean,\n): { name: string; from: string }[] {\n const out: { name: string; from: string }[] = []\n for (const [k, v] of entries) {\n const path = payload[k]\n // kind, never instanceof (agent/coding.md cast whitelist 6)\n if (!MEDIA.has(v.kind) || typeof path !== 'string' || /^https?:\\/\\//.test(path)) continue\n const linked = (v as MediaVar).opts.sidecarText\n const name = linked == null ? null : entries.find(([, x]) => x === linked)?.[0]\n if (name == null || name in payload || out.some((o) => o.name === name)) continue\n const from = sidecarPath(path)\n if (exists(from)) out.push({ name, from })\n }\n return out\n}\n","// `comfy-ts run [name] [--draft d] [--out p] [--json] [--verbose] [--help] [--<var> value | --<var>=value | --<toggle>]`\n// Pure: the vars stay strings here, the module's own var kinds shape them later (flagValue)\n\nexport type RunArgs = {\n name: string | null\n draft: string\n out: string | null\n json: boolean\n /** the library's own log lines, on stderr */\n verbose: boolean\n help: boolean\n /** in command line order; `true` = a bare flag */\n vars: [string, string | true][]\n}\n\nconst OWN = new Set(['draft', 'out'])\n\nexport function parseRunArgs(argv: readonly string[]): RunArgs | { error: string } {\n const r: RunArgs = { name: null, draft: 'default', out: null, json: false, verbose: false, help: false, vars: [] }\n for (let i = 0; i < argv.length; i++) {\n const a = argv[i]!\n if (a === '-h' || a === '--help') {\n r.help = true\n continue\n }\n if (a === '--json') {\n r.json = true\n continue\n }\n if (a === '--verbose') {\n r.verbose = true\n continue\n }\n if (!a.startsWith('--')) {\n if (r.name != null) return { error: `one module per run: got '${r.name}' and '${a}'` }\n r.name = a\n continue\n }\n const eq = a.indexOf('=')\n const key = eq < 0 ? a.slice(2) : a.slice(2, eq)\n if (key === '') return { error: `'${a}' names no var` }\n let value: string | true\n if (eq >= 0) value = a.slice(eq + 1)\n else {\n const next = argv[i + 1]\n if (next == null || next.startsWith('--')) value = true\n else {\n value = next\n i++\n }\n }\n if (OWN.has(key)) {\n if (value === true) return { error: `--${key} needs a value` }\n if (key === 'draft') r.draft = value\n else r.out = value\n continue\n }\n r.vars.push([key, value])\n }\n return r\n}\n","// the `*.cflow.ts` modules under the cwd for `comfy-ts run`, walked with bounds: node_modules\n// and dot dirs are never entered (a recursive readdir reads all of them before any filter,\n// which stalls a run started in a big repo or a temp dir), and the walk stops MAX_DEPTH deep\nimport { existsSync, readdirSync } from 'node:fs'\nimport { dirname, join } from 'pathe'\n\nexport const MAX_DEPTH = 5\n\nexport function findModules(dir: string, depth = 0): string[] {\n let entries: import('node:fs').Dirent[]\n try {\n entries = readdirSync(dir, { withFileTypes: true })\n } catch {\n return []\n }\n const out: string[] = []\n for (const e of entries.sort((a, b) => a.name.localeCompare(b.name))) {\n if (e.isFile() && /\\.cflow\\.tsx?$/.test(e.name)) out.push(join(dir, e.name))\n else if (e.isDirectory() && depth < MAX_DEPTH && e.name !== 'node_modules' && !e.name.startsWith('.'))\n out.push(...findModules(join(dir, e.name), depth + 1))\n }\n return out\n}\n\n/** the workspace a module belongs to: the nearest folder above it holding `.comfy-ts/` (its\n * schema cache and its tuned drafts), or null. A run roots comfy-ts there, so it never writes a\n * `.comfy-ts/` into whatever folder it was started from */\nexport function workspaceOf(file: string): string | null {\n let dir = dirname(file)\n while (true) {\n if (existsSync(join(dir, '.comfy-ts'))) return dir\n const up = dirname(dir)\n if (up === dir) return null\n dir = up\n }\n}\n","// `comfy-ts run`: one generation from the command line, headless (architecture.md item 15).\n// It is serve's generate path in process: a ServeApp over the one module, handle(POST\n// /generate/…), so drafts, payload checks, the media gate and seeds are serve's own code. Only\n// the starter differs (live progress, nothing saved by the runner) and the outputs land where\n// --out says\nimport { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs'\nimport { pathToFileURL } from 'node:url'\nimport { basename, dirname, resolve } from 'pathe'\nimport type { DefinedWorkflow } from 'src/vars/DefinedWorkflow.ts'\nimport { flagValue, type FlagSpec } from 'src/cli/run/flagValue.ts'\nimport { outputPaths, sidecarPath } from 'src/cli/run/outputPaths.ts'\nimport { pickModule } from 'src/cli/run/pickModule.ts'\nimport { sidecarFills } from 'src/cli/run/sidecar.ts'\nimport { parseRunArgs } from 'src/cli/run/runArgs.ts'\nimport { describeVar, renderDescriptorLine } from 'src/cli/serve/describeVar.ts'\nimport { ServeApp, type ServeExecution, type ServeStarter } from 'src/cli/serve/ServeApp.ts'\nimport { findModules, workspaceOf } from 'src/cli/run/findModules.ts'\nimport { mergeWorkflowSources, scanCflowFiles } from 'src/cli/tui/discoverWorkflows.ts'\nimport { findDefinedWorkflow } from 'src/cli/tui/findDefinedWorkflow.ts'\nimport { moduleName } from 'src/cli/tui/treeRows.ts'\nimport { bundledExamplesDir } from 'src/exampleAssets.ts'\nimport { ComfyTS } from 'src/state.ts'\nimport { extractErrorMessage } from 'src/utils/extractErrorMessage.ts'\n\nconst USAGE = `comfy-ts run <name | module.cflow.ts> [--draft <name>] [--<var> <value>…] [--out <path>] [--json]\n one generation, headless, with live progress. <name> is a module key (10-anima-t2i), the key\n without its number (anima-t2i), or a unique part of it (anima). \\`comfy-ts run <name> --help\\`\n lists the module's vars. --<var>-file <path> reads a text var from a file. --out a.png writes\n there (several outputs: a-1.png, a-2.png), --out dir/ keeps the server's names, no --out\n writes <module>-<id>.<ext> here. Text outputs go beside the first media output as <stem>.txt.\n --json prints one line with every output path, --verbose shows the library log on stderr`\n\ntype Out = { path: string; note: string | null; bytes: Uint8Array | null; from: string | null }\n\nfunction discover(cwd: string): string[] {\n const bundledDir = bundledExamplesDir()\n return mergeWorkflowSources({\n explicitTarget: false,\n scanned: findModules(cwd),\n bundledFiles: bundledDir == null ? [] : scanCflowFiles(bundledDir),\n }).files\n}\n\nconst log = (line: string): void => void process.stderr.write(`${line}\\n`)\n\nexport async function runRun(argv: string[]): Promise<number> {\n const args = parseRunArgs(argv)\n if ('error' in args) {\n log(`[comfy-ts run] ${args.error}`)\n return 1\n }\n // stdout carries the result lines only (one json line under --json): the library's info\n // chatter is silenced, and a stray console.log reaches stderr under --verbose, else nowhere\n const say = console.log.bind(console)\n if (!args.verbose) process.env.COMFY_TS_QUIET = '1'\n console.log = (...a: unknown[]): void => {\n if (args.verbose) console.error(...a)\n }\n const cwd = process.cwd()\n const explicit = args.name != null && /\\.cflow\\.tsx?$/.test(args.name) ? resolve(cwd, args.name) : null\n const files = explicit != null ? [explicit] : discover(cwd)\n if (args.name == null) {\n say(USAGE)\n const names = [...new Set(files.map((f) => `${basename(dirname(f))}/${moduleName(f)}`))]\n say(`\\nmodules:\\n${names.map((k) => ` ${k}`).join('\\n')}`)\n return 0\n }\n if (explicit != null && !existsSync(explicit)) {\n log(`[comfy-ts run] no such file: ${explicit}`)\n return 1\n }\n const picked = explicit != null ? { file: explicit, key: moduleName(explicit) } : pickModule(files, args.name)\n if ('error' in picked) {\n log(`[comfy-ts run] ${picked.error}`)\n return 1\n }\n\n // rooted at the module's workspace before its import registers one at the cwd: its schema\n // cache and drafts are there, and --out and media paths still resolve against the cwd\n ComfyTS.create({ rootPath: workspaceOf(picked.file) ?? cwd })\n let dw: DefinedWorkflow\n try {\n const found = findDefinedWorkflow((await import(pathToFileURL(picked.file).href)) as Record<string, unknown>)\n if (found == null) throw new Error('it exports no DefinedWorkflow')\n dw = found\n } catch (e) {\n log(`[comfy-ts run] ${picked.file}: ${extractErrorMessage(e)}`)\n return 1\n }\n const vars = new Map(dw.entries())\n\n if (args.help) {\n say(`comfy-ts run ${picked.key} (${picked.file})\\n\\nvars, each one a --<name> <value> flag:`)\n const width = Math.max(0, ...[...vars.keys()].map((k) => k.length))\n for (const [k, v] of vars) {\n const d = describeVar(v)\n // the cli's own forms where they differ from serve's json payload\n const payload =\n v.kind === 'seed'\n ? 'a number, or ? for a random one'\n : v.kind === 'toggle'\n ? 'true | false, or the bare flag'\n : v.kind === 'text' || v.kind === 'prompt'\n ? `${d.payload}, or --${k}-file <path>`\n : d.payload\n say(renderDescriptorLine(k, { ...d, payload }, width))\n }\n return 0\n }\n\n // the flags, shaped by each var's own kind\n const payload: Record<string, unknown> = {}\n for (const [name, raw] of args.vars) {\n const fileOf = name.endsWith('-file') ? name.slice(0, -'-file'.length) : null\n const target = fileOf != null && vars.has(fileOf) ? fileOf : name\n const v = vars.get(target)\n if (v == null) {\n log(`[comfy-ts run] ${picked.key} has no var '${name}'. Vars: ${[...vars.keys()].join(', ')}`)\n return 1\n }\n if (target !== name) {\n if (raw === true) {\n log(`[comfy-ts run] --${name} needs a path`)\n return 1\n }\n const path = resolve(cwd, raw)\n if (!existsSync(path)) {\n log(`[comfy-ts run] --${name}: no such file ${path}`)\n return 1\n }\n payload[target] = readFileSync(path, 'utf8').trim()\n continue\n }\n // kind, never instanceof (agent/coding.md cast whitelist 6)\n const spec: FlagSpec = { kind: v.kind, select: v.kind === 'choice' ? describeVar(v).select : undefined }\n const shaped = flagValue({ name, spec, raw, cwd })\n if ('error' in shaped) {\n log(`[comfy-ts run] ${shaped.error}`)\n return 1\n }\n payload[name] = shaped.value\n }\n // a media file's <file>.txt fills the text var its declaration links (a clip's transcript)\n for (const fill of sidecarFills([...vars], payload, existsSync)) {\n payload[fill.name] = readFileSync(fill.from, 'utf8').trim()\n if (!args.json) log(` ${fill.name} from ${fill.from}`)\n }\n\n let execution: ServeExecution | null = null\n const starter: ServeStarter = async (mod, opts) => {\n const host = opts.host ?? mod.dw.host\n await host.connect()\n const wf = await mod.dw.build({ advance: true, host })\n const ex = await wf.start({ save: false, log: !args.json })\n execution = ex\n return ex\n }\n const app = new ServeApp([{ key: picked.key, file: picked.file, dw }], { starter })\n if (!args.json) log(`▶ ${dw.host.data.id} · ${picked.key}/${args.draft}`)\n const t0 = Date.now()\n let code = 0\n try {\n const reply = await app.handle({\n method: 'POST',\n url: `/generate/${encodeURIComponent(picked.key)}/${encodeURIComponent(args.draft)}`,\n body: JSON.stringify(payload),\n })\n const body = JSON.parse(typeof reply.body === 'string' ? reply.body : new TextDecoder().decode(reply.body)) as {\n ok?: boolean\n error?: string\n seeds?: Record<string, number>\n promptId?: string\n durationMs?: number\n }\n const ex = execution as ServeExecution | null\n if (reply.status !== 200 || body.ok !== true || ex == null) {\n const error = body.error ?? `serve answered ${reply.status}`\n if (args.json) say(JSON.stringify({ ok: false, module: picked.key, draft: args.draft, error }))\n else log(`\\n✗ ${picked.key}/${args.draft}: ${error}`)\n return 1\n }\n\n const media: { filename: string; bytes: Uint8Array | null; from: string | null }[] = [\n ...ex.images.map((i) => ({ filename: i.filename, bytes: i.buffer ?? null, from: i.absPath })),\n ...(ex.audios ?? []).map((a) => ({ filename: a.filename, bytes: a.bytes, from: a.absPath })),\n ...(ex.videos ?? []).map((a) => ({ filename: a.filename, bytes: a.bytes, from: a.absPath })),\n ]\n const outIsDir =\n args.out != null &&\n (/[/\\\\]$/.test(args.out) ||\n (existsSync(resolve(cwd, args.out)) && statSync(resolve(cwd, args.out)).isDirectory()))\n const dests = outputPaths({\n out: args.out,\n outIsDir,\n module: picked.key,\n promptId: body.promptId ?? ex.data.id,\n items: media,\n cwd,\n })\n const outs: Out[] = media.map((m, i) => ({ ...dests[i]!, bytes: m.bytes, from: m.from }))\n for (const o of outs) {\n const bytes = o.bytes ?? (o.from != null ? new Uint8Array(readFileSync(o.from)) : null)\n if (bytes == null) throw new Error(`an output of ${picked.key} came back with no bytes`)\n mkdirSync(dirname(o.path), { recursive: true })\n writeFileSync(o.path, bytes)\n }\n const texts = (ex.texts ?? []).map((t) => t.text)\n const written = outs.map((o) => o.path)\n if (texts.length > 0) {\n const first = outs[0]\n if (first != null) {\n writeFileSync(sidecarPath(first.path), `${texts.join('\\n')}\\n`)\n written.push(sidecarPath(first.path))\n } else if (args.out != null && !outIsDir) {\n const path = resolve(cwd, args.out)\n mkdirSync(dirname(path), { recursive: true })\n writeFileSync(path, `${texts.join('\\n')}\\n`)\n written.push(path)\n } else if (!args.json) for (const t of texts) say(t)\n }\n const durationMs = body.durationMs ?? Date.now() - t0\n if (args.json)\n say(\n JSON.stringify({\n ok: true,\n module: picked.key,\n draft: args.draft,\n seeds: body.seeds ?? {},\n durationMs,\n outputs: written,\n texts,\n }),\n )\n else {\n const seeds = Object.entries(body.seeds ?? {})\n .map(([k, v]) => `${k} ${v}`)\n .join(', ')\n for (const o of outs) log(`✓ ${o.path}${o.note == null ? '' : ` (${o.note})`}`)\n for (const w of written.slice(outs.length)) log(`✓ ${w}`)\n log(` ${(durationMs / 1000).toFixed(1)}s${seeds === '' ? '' : ` · ${seeds}`}`)\n if (written.length === 0) log(' the run produced no output')\n }\n } catch (e) {\n log(`[comfy-ts run] 🔴 ${extractErrorMessage(e)}`)\n code = 1\n } finally {\n for (const [, h] of comfyts.hosts) h.disconnect()\n }\n return code\n}\n"],"mappings":";;;;;;;;AAOA,MAAM,uBAAO,IAAI,IAAI;CAAC;CAAQ;CAAO;CAAK;AAAI,CAAC;A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EAAE,WAAW,KAAK,CAAC;IAC5C,cAAc,MAAM,GAAG,MAAM,KAAK,IAAI,EAAE,GAAG;IAC3C,QAAQ,KAAK,IAAI;GACpB,OAAO,IAAI,CAAC,KAAK,MAAM,KAAK,MAAM,KAAK,OAAO,IAAI,CAAC;EACtD;EACA,MAAM,aAAa,KAAK,cAAc,KAAK,IAAI,IAAI;EACnD,IAAI,KAAK,MACN,IACG,KAAK,UAAU;GACZ,IAAI;GACJ,QAAQ,OAAO;GACf,OAAO,KAAK;GACZ,OAAO,KAAK,SAAS,CAAC;GACtB;GACA,SAAS;GACT;EACH,CAAC,CACJ;OACE;GACF,MAAM,QAAQ,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,CAC1C,KAAK,CAAC,GAAG,OAAO,GAAG,EAAE,GAAG,GAAG,CAAC,CAC5B,KAAK,IAAI;GACb,KAAK,MAAM,KAAK,MAAM,IAAI,KAAK,EAAE,OAAO,EAAE,QAAQ,OAAO,KAAK,MAAM,EAAE,KAAK,IAAI;GAC/E,KAAK,MAAM,KAAK,QAAQ,MAAM,KAAK,MAAM,GAAG,IAAI,KAAK,GAAG;GACxD,IAAI,MAAM,aAAa,IAAA,CAAM,QAAQ,CAAC,EAAE,GAAG,UAAU,KAAK,KAAK,MAAM,SAAS;GAC9E,IAAI,QAAQ,WAAW,GAAG,IAAI,8BAA8B;EAC/D;CACH,SAAS,GAAG;EACT,IAAI,qBAAqB,oBAAoB,CAAC,GAAG;EACjD,OAAO;CACV,UAAU;EACP,KAAK,MAAM,GAAG,MAAM,QAAQ,OAAO,EAAE,WAAW;CACnD;CACA,OAAO;AACV"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Q as stripAnsi, X as ansi, Z as colorsAvailable, ht as extractErrorMessage } from "./schemaDrift-
|
|
2
|
-
import { a as draftKeyForFile, r as scanCflowFiles, t as findDefinedWorkflow } from "./findDefinedWorkflow-
|
|
3
|
-
import { n as describeVar, r as renderDescriptorLine, t as ServeApp } from "./ServeApp-
|
|
1
|
+
import { Q as stripAnsi, X as ansi, Z as colorsAvailable, ht as extractErrorMessage } from "./schemaDrift-CHDVYlaj.js";
|
|
2
|
+
import { a as draftKeyForFile, r as scanCflowFiles, t as findDefinedWorkflow } from "./findDefinedWorkflow-BNZgYIww.js";
|
|
3
|
+
import { n as describeVar, r as renderDescriptorLine, t as ServeApp } from "./ServeApp-ByMobrWW.js";
|
|
4
4
|
import { spawnSync } from "node:child_process";
|
|
5
5
|
import { networkInterfaces } from "node:os";
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
@@ -461,4 +461,4 @@ function printStartup(app, bind, port) {
|
|
|
461
461
|
//#endregion
|
|
462
462
|
export { runServe };
|
|
463
463
|
|
|
464
|
-
//# sourceMappingURL=run-serve-
|
|
464
|
+
//# sourceMappingURL=run-serve-COk_G0Qz.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-serve-CsEYPGm9.js","names":[],"sources":["../src/cli/serve/byteRange.ts","../src/cli/serve/startupPrint.ts","../src/cli/serve/webBundle.ts","../src/cli/serve/run-serve.ts"],"sourcesContent":["// HTTP byte ranges on binary replies. WebKit (Safari, and a WKWebView app window) plays audio and\n// video only from a server that answers `Range` with 206: without it a flac never starts there\nimport type { ServeReply } from 'src/cli/serve/ServeApp.ts'\n\n/** one range, the only kind media players send: `bytes=a-b`, `bytes=a-`, `bytes=-n` */\nfunction parseRange(header: string, size: number): { start: number; end: number } | 'unsatisfiable' | null {\n const m = /^bytes=(\\d*)-(\\d*)$/.exec(header.trim())\n if (m == null) return null\n const a = m[1] ?? ''\n const b = m[2] ?? ''\n if (a === '' && b === '') return null\n if (a === '') {\n const n = Number(b)\n if (n === 0) return 'unsatisfiable'\n return { start: Math.max(0, size - n), end: size - 1 }\n }\n const start = Number(a)\n const end = b === '' ? size - 1 : Math.min(Number(b), size - 1)\n if (start >= size || start > end) return 'unsatisfiable'\n return { start, end }\n}\n\n/** a whole 200 binary reply gets its length and `accept-ranges`; a range request gets 206 with\n * those bytes, or 416 past the end. Text replies and errors pass through untouched */\nexport function withByteRange(reply: ServeReply, req: { method: string; range?: string }): ServeReply {\n if (req.method !== 'GET' || reply.status !== 200 || typeof reply.body === 'string') return reply\n const size = reply.body.length\n const base = { ...reply.headers, 'accept-ranges': 'bytes' }\n const range = req.range == null ? null : parseRange(req.range, size)\n if (range == null) return { ...reply, headers: { ...base, 'content-length': String(size) } }\n if (range === 'unsatisfiable')\n return {\n status: 416,\n contentType: reply.contentType,\n body: new Uint8Array(0),\n headers: { ...base, 'content-range': `bytes */${size}` },\n }\n return {\n status: 206,\n contentType: reply.contentType,\n body: reply.body.subarray(range.start, range.end + 1),\n headers: {\n ...base,\n 'content-range': `bytes ${range.start}-${range.end}/${size}`,\n 'content-length': String(range.end - range.start + 1),\n },\n }\n}\n","// what `comfy-ts serve` prints on launch. PURE: takes the already-described\n// modules and gives back lines, so tests read the layout without a server and\n// without a tty. Colors are a parameter, never a probe done in here.\nimport { ansi, stripAnsi } from 'src/utils/ansi.ts'\n\nexport type StartupModule = {\n key: string\n hostId: string\n /** the POST routes, ready to print */\n routes: string[]\n /** one line per var (renderDescriptorLine) */\n varLines: string[]\n}\n\nexport type StartupInput = {\n modules: StartupModule[]\n bind: string\n port: number\n /** every address this bind answers on (reachableAddresses) */\n urls: string[]\n color: boolean\n}\n\nconst RULE_WIDTH = 64\n\n/** 100.64.0.0/10 is the CGNAT range tailscale hands out — worth naming, it is the one\n * you want when the phone is not on the same wifi */\nexport function addressNote(addr: string): string {\n const octets = addr.split('.').map(Number)\n const second = octets[1] ?? 0\n if (octets[0] === 100 && second >= 64 && second <= 127) return 'tailnet'\n if (addr === '127.0.0.1' || addr === 'localhost') return 'this machine'\n return ''\n}\n\nfunction paint(color: boolean): {\n title: (s: string) => string\n name: (s: string) => string\n dim: (s: string) => string\n url: (s: string) => string\n warn: (s: string) => string\n} {\n const id = (s: string): string => s\n if (!color) return { title: id, name: id, dim: id, url: id, warn: id }\n return {\n title: (s) => ansi.bold(s),\n name: (s) => ansi.bold.cyan(s),\n dim: (s) => ansi.gray(s),\n url: (s) => ansi.green(s),\n warn: (s) => ansi.yellow(s),\n }\n}\n\n/** a box that stays square whatever the colors do: padding measures the VISIBLE text */\nexport function boxed(lines: string[], p: { color: boolean } = { color: false }): string[] {\n const width = Math.max(...lines.map((l) => stripAnsi(l).length), 0)\n const edge = (l: string, r: string): string => `${l}${'─'.repeat(width + 2)}${r}`\n const border = (s: string): string => (p.color ? ansi.gray(s) : s)\n return [\n border(edge('┌', '┐')),\n ...lines.map((l) => `${border('│')} ${l}${' '.repeat(width - stripAnsi(l).length)} ${border('│')}`),\n border(edge('└', '┘')),\n ]\n}\n\nexport function renderStartupLines(p: StartupInput): string[] {\n const c = paint(p.color)\n const loopback = p.bind === '127.0.0.1' || p.bind === 'localhost' || p.bind === '::1'\n const primary = `http://${p.urls[0] ?? p.bind}:${p.port}/`\n const out: string[] = []\n\n const count = `${p.modules.length} workflow${p.modules.length === 1 ? '' : 's'}`\n out.push(c.title(`comfy-ts serve · ${count} · ${primary}`))\n // said on EVERY launch, loopback included: cross-origin is open, so the exposure is not\n // limited to who can reach the port. any page in your browser can reach 127.0.0.1 too\n out.push(\n c.warn(\n loopback\n ? '⚠️ no auth: this API runs workflows, and any page open in your browser can call it'\n : `⚠️ bound to ${p.bind}, no auth: anyone on this network can run workflows on your ComfyUI host`,\n ),\n )\n\n for (const mod of p.modules) {\n out.push('', c.dim('─'.repeat(RULE_WIDTH)))\n out.push(`${c.name(mod.key)} ${c.dim(`host: ${mod.hostId}`)}`)\n for (const route of mod.routes) out.push(c.dim(` POST ${route}`))\n out.push(...mod.varLines)\n }\n out.push(c.dim('─'.repeat(RULE_WIDTH)), '')\n\n // the box is the last thing on screen: where the ui is, and how to reach it elsewhere\n const box: string[] = [\n `${c.title('web ui')} ${c.url(primary)}`,\n `${c.dim('json api')} ${c.dim(`${primary}drafts`)}`,\n ]\n if (p.urls.length > 1) {\n box.push('', c.dim('also reachable at:'))\n for (const url of p.urls.slice(1)) {\n const note = addressNote(url)\n box.push(` ${c.url(`http://${url}:${p.port}/`)}${note === '' ? '' : c.dim(` (${note})`)}`)\n }\n }\n if (loopback) {\n box.push('', c.dim('to open it from your phone or another machine:'))\n box.push(c.dim(` comfy-ts serve --host 0.0.0.0 (--bind is the same flag)`))\n box.push(c.dim(' every reachable url gets printed here, tailnet included'))\n }\n out.push(...boxed(box, { color: p.color }))\n return out\n}\n","// web ui bundle resolution (architecture item 12, web ui): prebuilt\n// dist/serve-web.js next to the running module, else an in-memory Bun.build\n// from source (src/ ships in the npm tarball), rebuilt when a source file changes,\n// else null — the api must serve without a UI, never crash\nimport { existsSync, readdirSync, readFileSync, statSync } from 'node:fs'\nimport { fileURLToPath } from 'node:url'\nimport { dirname, join } from 'pathe'\n\nconst WEB_ENTRY = 'src/cli/serve/web/main.tsx'\n\n/** nearest dir upward holding a package.json — the comfy-ts package root, from dist/ and src/ alike */\nfunction packageRoot(fromDir: string): string | null {\n let dir = fromDir\n while (true) {\n if (existsSync(join(dir, 'package.json'))) return dir\n const parent = dirname(dir)\n if (parent === dir) return null\n dir = parent\n }\n}\n\n/** bundle the web app to one browser file. Bun.build reads no tsconfig, so the\n * house 'src/...' absolute imports resolve through the same plugin shape as\n * tests/web-bundle.test.ts */\nexport async function buildWebJsText(pkgRoot: string): Promise<string> {\n const result = await Bun.build({\n entrypoints: [join(pkgRoot, WEB_ENTRY)],\n target: 'browser',\n minify: true,\n throw: false,\n define: { 'process.env.NODE_ENV': '\"production\"' },\n plugins: [\n {\n name: 'repo-src-paths',\n setup(build) {\n build.onResolve({ filter: /^src\\// }, (args) => ({ path: join(pkgRoot, args.path) }))\n },\n },\n ],\n })\n if (!result.success || result.outputs[0] == null)\n throw new Error(`web ui bundle failed:\\n${result.logs.map((l) => String(l)).join('\\n')}`)\n return await result.outputs[0].text()\n}\n\n/** changes whenever a file under `dir` is added, removed or rewritten. The web bundle reaches\n * outside web/ (vars, protocol types), so the whole src/ tree is the input: ~300 stats, a few ms */\nexport function sourceSignature(dir: string): string {\n let count = 0\n let newest = 0\n let bytes = 0\n const walk = (d: string): void => {\n for (const entry of readdirSync(d, { withFileTypes: true })) {\n const abs = join(d, entry.name)\n if (entry.isDirectory()) walk(abs)\n else if (entry.isFile()) {\n const st = statSync(abs)\n count += 1\n bytes += st.size\n newest = Math.max(newest, st.mtimeMs)\n }\n }\n }\n walk(dir)\n return `${count}:${bytes}:${newest}`\n}\n\nlet prebuiltJs: string | null = null\nlet fromSource: { signature: string; js: Promise<string | null> } | null = null\n\n/** the runtime resolution chain; every miss logs loud and degrades to api-only. Called on every\n * page load: a prebuilt file is read once, a source build is redone only when src/ changed, so\n * an edited panel shows on refresh under `bun --watch`, which never sees the bundled files */\nexport async function loadOrBuildWebJs(): Promise<string | null> {\n const here = dirname(fileURLToPath(import.meta.url))\n const prebuilt = join(here, 'serve-web.js')\n if (prebuiltJs != null) return prebuiltJs\n if (existsSync(prebuilt)) {\n prebuiltJs = readFileSync(prebuilt, 'utf8')\n return prebuiltJs\n }\n if (typeof Bun === 'undefined') {\n console.error('[serve] 🔴 no serve-web.js next to the cli and not running under bun — api only, no web ui')\n return null\n }\n const pkgRoot = packageRoot(here)\n if (pkgRoot == null || !existsSync(join(pkgRoot, WEB_ENTRY))) {\n console.error(`[serve] 🔴 web ui source not found (looked for ${WEB_ENTRY} above ${here}) — api only, no web ui`)\n return null\n }\n const signature = sourceSignature(join(pkgRoot, 'src'))\n if (fromSource?.signature !== signature) {\n const rebuilt = fromSource != null\n // a failed build stays failed for this signature: logged once, retried on the next edit\n fromSource = {\n signature,\n js: buildWebJsText(pkgRoot).then(\n (js) => {\n if (rebuilt) console.log('[serve] web ui rebuilt from source')\n return js\n },\n (e: unknown) => {\n console.error('[serve] 🔴 web ui bundle failed — api only until the next edit:', e)\n return null\n },\n ),\n }\n }\n return await fromSource.js\n}\n","// `comfy-ts serve [dir | module.cflow.ts] [--port N] [--host ADDR]`\n// drafts as a local HTTP generation API — agent/architecture.md item 12\nimport { spawnSync } from 'node:child_process'\nimport { statSync } from 'node:fs'\nimport { createServer, type IncomingMessage, type Server, type ServerResponse } from 'node:http'\nimport { networkInterfaces } from 'node:os'\nimport { pathToFileURL } from 'node:url'\nimport { dirname, resolve } from 'pathe'\nimport { scanCflowFiles } from 'src/cli/tui/discoverWorkflows.ts'\nimport { findDefinedWorkflow } from 'src/cli/tui/findDefinedWorkflow.ts'\nimport { draftKeyForFile } from 'src/cli/tui/state/DraftsSt.ts'\nimport { describeVar, renderDescriptorLine } from 'src/cli/serve/describeVar.ts'\nimport { ServeApp, type ServeModule } from 'src/cli/serve/ServeApp.ts'\nimport { withByteRange } from 'src/cli/serve/byteRange.ts'\nimport { renderStartupLines } from 'src/cli/serve/startupPrint.ts'\nimport { loadOrBuildWebJs } from 'src/cli/serve/webBundle.ts'\nimport { colorsAvailable } from 'src/utils/ansi.ts'\nimport { extractErrorMessage } from 'src/utils/extractErrorMessage.ts'\n\nconst DEFAULT_PORT = 8288\nconst BODY_CAP = 10_000_000\n/** a video dropped on a media var rides POST /upload as base64 json: ~200 MB of file */\nexport const UPLOAD_BODY_CAP = 280_000_000\n\nexport function parseArgs(args: string[]): { target?: string; port: number; bind: string } | { error: string } {\n let target: string | undefined\n let port = DEFAULT_PORT\n let bind = '127.0.0.1'\n for (let i = 0; i < args.length; i++) {\n const a = args[i]\n if (a === '--port') {\n const n = Number(args[++i])\n if (!Number.isInteger(n) || n <= 0 || n > 65535) return { error: `--port expects 1..65535, got '${args[i]}'` }\n port = n\n } else if (a === '--host' || a === '--bind') {\n // --host is the spelling; --bind stays an alias so an old command line keeps working\n const b = args[++i]\n if (b == null) return { error: `${a} expects an address (0.0.0.0 to reach it from another machine)` }\n bind = b\n } else if (a != null && a.startsWith('--')) return { error: `unknown flag '${a}'` }\n else if (a != null) {\n if (target != null) return { error: `one target only (got '${target}' and '${a}')` }\n target = a\n }\n }\n return { target, port, bind }\n}\n\n/** node:http glue around ServeApp.handle — exported so tests can drive a real socket */\n/** open CORS, because a browser page IS a first-class client here: the web entry runs the\n * library in a tab and rides serve as its bridge to hosts that send no CORS headers\n * (examples/web is on another port by construction). The cost is real and stated at launch:\n * with no auth, any page you visit can drive this api. That is the same trade as the port\n * being open at all, so it is said out loud rather than hidden behind a flag. */\nexport function makeRequestListener(app: ServeApp): (req: IncomingMessage, res: ServerResponse) => void {\n const cors = {\n 'access-control-allow-origin': '*',\n 'access-control-allow-methods': 'GET, POST, PUT, DELETE, OPTIONS',\n 'access-control-allow-headers': 'content-type, accept',\n }\n return (req, res) => {\n const cap = req.method === 'POST' && (req.url ?? '').split('?')[0] === '/upload' ? UPLOAD_BODY_CAP : BODY_CAP\n const chunks: Buffer[] = []\n let size = 0\n let overflow = false\n req.on('error', (e) => console.error(`[serve] request stream error: ${extractErrorMessage(e)}`))\n req.on('data', (c: Buffer) => {\n if (overflow) return\n size += c.length\n if (size > cap) {\n // answer NOW: a destroyed request never emits 'end'\n overflow = true\n res.writeHead(413, { 'content-type': 'application/json', ...cors })\n res.end(JSON.stringify({ error: 'payload too large' }), () => req.destroy())\n } else chunks.push(c)\n })\n req.on('end', () => {\n if (overflow) return\n if (req.method === 'OPTIONS') {\n res.writeHead(204, cors)\n res.end()\n return\n }\n app.handle({\n method: req.method ?? 'GET',\n url: req.url ?? '/',\n accept: req.headers.accept,\n body: Buffer.concat(chunks).toString('utf8'),\n })\n .then((whole) => {\n const range = req.headers.range\n const reply = withByteRange(whole, { method: req.method ?? 'GET', range })\n res.writeHead(reply.status, { 'content-type': reply.contentType, ...reply.headers, ...cors })\n res.end(reply.body)\n })\n .catch((e: unknown) => {\n // handle() catches internally; this guards the response write itself\n console.error(`[serve] response write failed: ${extractErrorMessage(e)}`)\n res.destroy()\n })\n })\n }\n}\n\nexport async function runServe(args: string[]): Promise<number> {\n const parsed = parseArgs(args)\n if ('error' in parsed) {\n console.error(`[comfy-ts serve] ${parsed.error}`)\n return 1\n }\n\n // discovery: explicit file → that module only; dir/no-arg → scan, WITHOUT\n // the bundled examples (serve is for the user's tuned drafts)\n const target = resolve(parsed.target ?? '.')\n let files: string[]\n try {\n files = statSync(target).isDirectory() ? scanCflowFiles(target) : [target]\n } catch {\n console.error(`[comfy-ts serve] no such file or directory: ${target}`)\n return 1\n }\n if (files.length === 0) {\n console.error(`[comfy-ts serve] no *.cflow.ts modules under ${target}`)\n return 1\n }\n\n const modules: ServeModule[] = []\n const loadErrors: Record<string, string> = {}\n for (const file of files) {\n try {\n const mod: Record<string, unknown> = await import(pathToFileURL(file).href)\n const dw = findDefinedWorkflow(mod)\n if (dw == null) throw new Error('exports no DefinedWorkflow')\n const key = draftKeyForFile(file)\n const clash = modules.find((m) => m.key === key)\n if (clash != null) throw new Error(`module key '${key}' already taken by ${clash.file}`)\n modules.push({ key, file, dw })\n } catch (e) {\n loadErrors[file] = extractErrorMessage(e)\n console.error(`[comfy-ts serve] ✗ ${file}: ${loadErrors[file]}`)\n }\n }\n if (modules.length === 0) {\n console.error('[comfy-ts serve] every module failed to load — nothing to serve')\n return 1\n }\n\n const app = new ServeApp(modules, {\n loadErrors,\n webJs: loadOrBuildWebJs,\n // the modules registered comfyts on import: its root holds `.comfy-ts/`\n workspace: typeof comfyts === 'undefined' ? process.cwd() : comfyts.rootPath,\n root: statSync(target).isDirectory() ? target : dirname(target),\n })\n return listenUntilClosed(createServer(makeRequestListener(app)), parsed.port, parsed.bind, () =>\n printStartup(app, parsed.bind, parsed.port),\n )\n}\n\n/** listens, then stays up until the server closes; resolves the exit code. A listen\n * failure resolves 1 AT ONCE: bun fires no `close` for a server that never listened,\n * and a cli awaiting one never ends (agent/architecture.md item 12) */\nexport function listenUntilClosed(\n server: Server,\n port: number,\n bind: string,\n onListening?: () => void,\n): Promise<number> {\n return new Promise<number>((resolveExit) => {\n let listening = false\n server.once('listening', () => {\n listening = true\n onListening?.()\n })\n server.on('error', (e) => {\n if (!listening) {\n console.error(`[comfy-ts serve] 🔴 ${describeListenError(e, port, bind)}`)\n resolveExit(1)\n return\n }\n console.error(`[comfy-ts serve] server error: ${extractErrorMessage(e)}`)\n server.close()\n resolveExit(1)\n })\n server.on('close', () => resolveExit(0))\n server.listen(port, bind)\n })\n}\n\nfunction describeListenError(e: Error, port: number, bind: string): string {\n const code = 'code' in e ? e.code : undefined\n if (code !== 'EADDRINUSE') return `cannot listen on ${bind}:${port}: ${extractErrorMessage(e)}`\n const holder = portHolder(port)\n const by = holder == null ? '' : ` by ${holder}`\n return `port ${port} on ${bind} is taken${by}: stop it, or pick another port with --port <n>`\n}\n\n/** `pid <n> (<command>)` of the process listening on a tcp port; null when unknowable\n * (no lsof on this box, or the holder is not visible to this user) */\nexport function portHolder(port: number): string | null {\n const lsof = spawnSync('lsof', ['-nP', `-iTCP:${port}`, '-sTCP:LISTEN', '-t'], { encoding: 'utf8', timeout: 2000 })\n const pid = lsof.error == null ? lsof.stdout.split('\\n')[0]?.trim() : undefined\n if (pid == null || pid === '') return null\n const ps = spawnSync('ps', ['-o', 'command=', '-p', pid], { encoding: 'utf8', timeout: 2000 })\n const command = ps.error == null ? ps.stdout.trim().slice(0, 160) : ''\n return command === '' ? `pid ${pid}` : `pid ${pid} (${command})`\n}\n\nexport type Nic = { address: string; family: string | number; internal: boolean }\n\n/** the addresses this bind actually answers on. `0.0.0.0` means every interface, so printing\n * only that back is useless: the LAN ip and the tailnet 100.x are the urls a phone can open */\nexport function reachableAddresses(bind: string, nics: Record<string, Nic[] | undefined>): string[] {\n if (bind !== '0.0.0.0' && bind !== '::') return [bind]\n const found: string[] = []\n for (const list of Object.values(nics)) {\n for (const nic of list ?? []) {\n // node reports family as 'IPv4' or 4 depending on the version\n if (nic.internal || (nic.family !== 'IPv4' && nic.family !== 4)) continue\n found.push(nic.address)\n }\n }\n return ['127.0.0.1', ...found]\n}\n\nfunction printStartup(app: ServeApp, bind: string, port: number): void {\n const base = `http://${bind}:${port}`\n const color = colorsAvailable()\n const lines = renderStartupLines({\n bind,\n port,\n urls: reachableAddresses(bind, networkInterfaces()),\n color,\n modules: app.modules.map((mod) => {\n const entries = mod.dw.entries()\n const nameWidth = Math.max(...entries.map(([n]) => n.length), 4)\n return {\n key: mod.key,\n hostId: mod.dw.host.data.id,\n routes: app\n .draftsFor(mod)\n .map((d) => `${base}/generate/${encodeURIComponent(mod.key)}/${encodeURIComponent(d)}`),\n varLines: entries.map(([name, varDef]) =>\n renderDescriptorLine(name, describeVar(varDef), nameWidth, color),\n ),\n }\n }),\n })\n for (const line of lines) console.log(line)\n}\n"],"mappings":";;;;;;;;;;;AAKA,SAAS,WAAW,QAAgB,MAAuE;CACxG,MAAM,IAAI,sBAAsB,KAAK,OAAO,KAAK,CAAC;CAClD,IAAI,KAAK,MAAM,OAAO;CACtB,MAAM,IAAI,EAAE,MAAM;CAClB,MAAM,IAAI,EAAE,MAAM;CAClB,IAAI,MAAM,MAAM,MAAM,IAAI,OAAO;CACjC,IAAI,MAAM,IAAI;EACX,MAAM,IAAI,OAAO,CAAC;EAClB,IAAI,MAAM,GAAG,OAAO;EACpB,OAAO;GAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC;GAAG,KAAK,OAAO;EAAE;CACxD;CACA,MAAM,QAAQ,OAAO,CAAC;CACtB,MAAM,MAAM,MAAM,KAAK,OAAO,IAAI,KAAK,IAAI,OAAO,CAAC,GAAG,OAAO,CAAC;CAC9D,IAAI,SAAS,QAAQ,QAAQ,KAAK,OAAO;CACzC,OAAO;EAAE;EAAO;CAAI;AACvB;;;AAIA,SAAgB,cAAc,OAAmB,KAAqD;CACnG,IAAI,IAAI,WAAW,SAAS,MAAM,WAAW,OAAO,OAAO,MAAM,SAAS,UAAU,OAAO;CAC3F,MAAM,OAAO,MAAM,KAAK;CACxB,MAAM,OAAO;EAAE,GAAG,MAAM;EAAS,iBAAiB;CAAQ;CAC1D,MAAM,QAAQ,IAAI,SAAS,OAAO,OAAO,WAAW,IAAI,OAAO,IAAI;CACnE,IAAI,SAAS,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AK,CACnE;GACH;EACH,CAAC;CACJ,CAAC;CACD,KAAK,MAAM,QAAQ,OAAO,QAAQ,IAAI,IAAI;AAC7C"}
|
|
1
|
+
{"version":3,"file":"run-serve-COk_G0Qz.js","names":[],"sources":["../src/cli/serve/byteRange.ts","../src/cli/serve/startupPrint.ts","../src/cli/serve/webBundle.ts","../src/cli/serve/run-serve.ts"],"sourcesContent":["// HTTP byte ranges on binary replies. WebKit (Safari, and a WKWebView app window) plays audio and\n// video only from a server that answers `Range` with 206: without it a flac never starts there\nimport type { ServeReply } from 'src/cli/serve/ServeApp.ts'\n\n/** one range, the only kind media players send: `bytes=a-b`, `bytes=a-`, `bytes=-n` */\nfunction parseRange(header: string, size: number): { start: number; end: number } | 'unsatisfiable' | null {\n const m = /^bytes=(\\d*)-(\\d*)$/.exec(header.trim())\n if (m == null) return null\n const a = m[1] ?? ''\n const b = m[2] ?? ''\n if (a === '' && b === '') return null\n if (a === '') {\n const n = Number(b)\n if (n === 0) return 'unsatisfiable'\n return { start: Math.max(0, size - n), end: size - 1 }\n }\n const start = Number(a)\n const end = b === '' ? size - 1 : Math.min(Number(b), size - 1)\n if (start >= size || start > end) return 'unsatisfiable'\n return { start, end }\n}\n\n/** a whole 200 binary reply gets its length and `accept-ranges`; a range request gets 206 with\n * those bytes, or 416 past the end. Text replies and errors pass through untouched */\nexport function withByteRange(reply: ServeReply, req: { method: string; range?: string }): ServeReply {\n if (req.method !== 'GET' || reply.status !== 200 || typeof reply.body === 'string') return reply\n const size = reply.body.length\n const base = { ...reply.headers, 'accept-ranges': 'bytes' }\n const range = req.range == null ? null : parseRange(req.range, size)\n if (range == null) return { ...reply, headers: { ...base, 'content-length': String(size) } }\n if (range === 'unsatisfiable')\n return {\n status: 416,\n contentType: reply.contentType,\n body: new Uint8Array(0),\n headers: { ...base, 'content-range': `bytes */${size}` },\n }\n return {\n status: 206,\n contentType: reply.contentType,\n body: reply.body.subarray(range.start, range.end + 1),\n headers: {\n ...base,\n 'content-range': `bytes ${range.start}-${range.end}/${size}`,\n 'content-length': String(range.end - range.start + 1),\n },\n }\n}\n","// what `comfy-ts serve` prints on launch. PURE: takes the already-described\n// modules and gives back lines, so tests read the layout without a server and\n// without a tty. Colors are a parameter, never a probe done in here.\nimport { ansi, stripAnsi } from 'src/utils/ansi.ts'\n\nexport type StartupModule = {\n key: string\n hostId: string\n /** the POST routes, ready to print */\n routes: string[]\n /** one line per var (renderDescriptorLine) */\n varLines: string[]\n}\n\nexport type StartupInput = {\n modules: StartupModule[]\n bind: string\n port: number\n /** every address this bind answers on (reachableAddresses) */\n urls: string[]\n color: boolean\n}\n\nconst RULE_WIDTH = 64\n\n/** 100.64.0.0/10 is the CGNAT range tailscale hands out — worth naming, it is the one\n * you want when the phone is not on the same wifi */\nexport function addressNote(addr: string): string {\n const octets = addr.split('.').map(Number)\n const second = octets[1] ?? 0\n if (octets[0] === 100 && second >= 64 && second <= 127) return 'tailnet'\n if (addr === '127.0.0.1' || addr === 'localhost') return 'this machine'\n return ''\n}\n\nfunction paint(color: boolean): {\n title: (s: string) => string\n name: (s: string) => string\n dim: (s: string) => string\n url: (s: string) => string\n warn: (s: string) => string\n} {\n const id = (s: string): string => s\n if (!color) return { title: id, name: id, dim: id, url: id, warn: id }\n return {\n title: (s) => ansi.bold(s),\n name: (s) => ansi.bold.cyan(s),\n dim: (s) => ansi.gray(s),\n url: (s) => ansi.green(s),\n warn: (s) => ansi.yellow(s),\n }\n}\n\n/** a box that stays square whatever the colors do: padding measures the VISIBLE text */\nexport function boxed(lines: string[], p: { color: boolean } = { color: false }): string[] {\n const width = Math.max(...lines.map((l) => stripAnsi(l).length), 0)\n const edge = (l: string, r: string): string => `${l}${'─'.repeat(width + 2)}${r}`\n const border = (s: string): string => (p.color ? ansi.gray(s) : s)\n return [\n border(edge('┌', '┐')),\n ...lines.map((l) => `${border('│')} ${l}${' '.repeat(width - stripAnsi(l).length)} ${border('│')}`),\n border(edge('└', '┘')),\n ]\n}\n\nexport function renderStartupLines(p: StartupInput): string[] {\n const c = paint(p.color)\n const loopback = p.bind === '127.0.0.1' || p.bind === 'localhost' || p.bind === '::1'\n const primary = `http://${p.urls[0] ?? p.bind}:${p.port}/`\n const out: string[] = []\n\n const count = `${p.modules.length} workflow${p.modules.length === 1 ? '' : 's'}`\n out.push(c.title(`comfy-ts serve · ${count} · ${primary}`))\n // said on EVERY launch, loopback included: cross-origin is open, so the exposure is not\n // limited to who can reach the port. any page in your browser can reach 127.0.0.1 too\n out.push(\n c.warn(\n loopback\n ? '⚠️ no auth: this API runs workflows, and any page open in your browser can call it'\n : `⚠️ bound to ${p.bind}, no auth: anyone on this network can run workflows on your ComfyUI host`,\n ),\n )\n\n for (const mod of p.modules) {\n out.push('', c.dim('─'.repeat(RULE_WIDTH)))\n out.push(`${c.name(mod.key)} ${c.dim(`host: ${mod.hostId}`)}`)\n for (const route of mod.routes) out.push(c.dim(` POST ${route}`))\n out.push(...mod.varLines)\n }\n out.push(c.dim('─'.repeat(RULE_WIDTH)), '')\n\n // the box is the last thing on screen: where the ui is, and how to reach it elsewhere\n const box: string[] = [\n `${c.title('web ui')} ${c.url(primary)}`,\n `${c.dim('json api')} ${c.dim(`${primary}drafts`)}`,\n ]\n if (p.urls.length > 1) {\n box.push('', c.dim('also reachable at:'))\n for (const url of p.urls.slice(1)) {\n const note = addressNote(url)\n box.push(` ${c.url(`http://${url}:${p.port}/`)}${note === '' ? '' : c.dim(` (${note})`)}`)\n }\n }\n if (loopback) {\n box.push('', c.dim('to open it from your phone or another machine:'))\n box.push(c.dim(` comfy-ts serve --host 0.0.0.0 (--bind is the same flag)`))\n box.push(c.dim(' every reachable url gets printed here, tailnet included'))\n }\n out.push(...boxed(box, { color: p.color }))\n return out\n}\n","// web ui bundle resolution (architecture item 12, web ui): prebuilt\n// dist/serve-web.js next to the running module, else an in-memory Bun.build\n// from source (src/ ships in the npm tarball), rebuilt when a source file changes,\n// else null — the api must serve without a UI, never crash\nimport { existsSync, readdirSync, readFileSync, statSync } from 'node:fs'\nimport { fileURLToPath } from 'node:url'\nimport { dirname, join } from 'pathe'\n\nconst WEB_ENTRY = 'src/cli/serve/web/main.tsx'\n\n/** nearest dir upward holding a package.json — the comfy-ts package root, from dist/ and src/ alike */\nfunction packageRoot(fromDir: string): string | null {\n let dir = fromDir\n while (true) {\n if (existsSync(join(dir, 'package.json'))) return dir\n const parent = dirname(dir)\n if (parent === dir) return null\n dir = parent\n }\n}\n\n/** bundle the web app to one browser file. Bun.build reads no tsconfig, so the\n * house 'src/...' absolute imports resolve through the same plugin shape as\n * tests/web-bundle.test.ts */\nexport async function buildWebJsText(pkgRoot: string): Promise<string> {\n const result = await Bun.build({\n entrypoints: [join(pkgRoot, WEB_ENTRY)],\n target: 'browser',\n minify: true,\n throw: false,\n define: { 'process.env.NODE_ENV': '\"production\"' },\n plugins: [\n {\n name: 'repo-src-paths',\n setup(build) {\n build.onResolve({ filter: /^src\\// }, (args) => ({ path: join(pkgRoot, args.path) }))\n },\n },\n ],\n })\n if (!result.success || result.outputs[0] == null)\n throw new Error(`web ui bundle failed:\\n${result.logs.map((l) => String(l)).join('\\n')}`)\n return await result.outputs[0].text()\n}\n\n/** changes whenever a file under `dir` is added, removed or rewritten. The web bundle reaches\n * outside web/ (vars, protocol types), so the whole src/ tree is the input: ~300 stats, a few ms */\nexport function sourceSignature(dir: string): string {\n let count = 0\n let newest = 0\n let bytes = 0\n const walk = (d: string): void => {\n for (const entry of readdirSync(d, { withFileTypes: true })) {\n const abs = join(d, entry.name)\n if (entry.isDirectory()) walk(abs)\n else if (entry.isFile()) {\n const st = statSync(abs)\n count += 1\n bytes += st.size\n newest = Math.max(newest, st.mtimeMs)\n }\n }\n }\n walk(dir)\n return `${count}:${bytes}:${newest}`\n}\n\nlet prebuiltJs: string | null = null\nlet fromSource: { signature: string; js: Promise<string | null> } | null = null\n\n/** the runtime resolution chain; every miss logs loud and degrades to api-only. Called on every\n * page load: a prebuilt file is read once, a source build is redone only when src/ changed, so\n * an edited panel shows on refresh under `bun --watch`, which never sees the bundled files */\nexport async function loadOrBuildWebJs(): Promise<string | null> {\n const here = dirname(fileURLToPath(import.meta.url))\n const prebuilt = join(here, 'serve-web.js')\n if (prebuiltJs != null) return prebuiltJs\n if (existsSync(prebuilt)) {\n prebuiltJs = readFileSync(prebuilt, 'utf8')\n return prebuiltJs\n }\n if (typeof Bun === 'undefined') {\n console.error('[serve] 🔴 no serve-web.js next to the cli and not running under bun — api only, no web ui')\n return null\n }\n const pkgRoot = packageRoot(here)\n if (pkgRoot == null || !existsSync(join(pkgRoot, WEB_ENTRY))) {\n console.error(`[serve] 🔴 web ui source not found (looked for ${WEB_ENTRY} above ${here}) — api only, no web ui`)\n return null\n }\n const signature = sourceSignature(join(pkgRoot, 'src'))\n if (fromSource?.signature !== signature) {\n const rebuilt = fromSource != null\n // a failed build stays failed for this signature: logged once, retried on the next edit\n fromSource = {\n signature,\n js: buildWebJsText(pkgRoot).then(\n (js) => {\n if (rebuilt) console.log('[serve] web ui rebuilt from source')\n return js\n },\n (e: unknown) => {\n console.error('[serve] 🔴 web ui bundle failed — api only until the next edit:', e)\n return null\n },\n ),\n }\n }\n return await fromSource.js\n}\n","// `comfy-ts serve [dir | module.cflow.ts] [--port N] [--host ADDR]`\n// drafts as a local HTTP generation API — agent/architecture.md item 12\nimport { spawnSync } from 'node:child_process'\nimport { statSync } from 'node:fs'\nimport { createServer, type IncomingMessage, type Server, type ServerResponse } from 'node:http'\nimport { networkInterfaces } from 'node:os'\nimport { pathToFileURL } from 'node:url'\nimport { dirname, resolve } from 'pathe'\nimport { scanCflowFiles } from 'src/cli/tui/discoverWorkflows.ts'\nimport { findDefinedWorkflow } from 'src/cli/tui/findDefinedWorkflow.ts'\nimport { draftKeyForFile } from 'src/cli/tui/state/DraftsSt.ts'\nimport { describeVar, renderDescriptorLine } from 'src/cli/serve/describeVar.ts'\nimport { ServeApp, type ServeModule } from 'src/cli/serve/ServeApp.ts'\nimport { withByteRange } from 'src/cli/serve/byteRange.ts'\nimport { renderStartupLines } from 'src/cli/serve/startupPrint.ts'\nimport { loadOrBuildWebJs } from 'src/cli/serve/webBundle.ts'\nimport { colorsAvailable } from 'src/utils/ansi.ts'\nimport { extractErrorMessage } from 'src/utils/extractErrorMessage.ts'\n\nconst DEFAULT_PORT = 8288\nconst BODY_CAP = 10_000_000\n/** a video dropped on a media var rides POST /upload as base64 json: ~200 MB of file */\nexport const UPLOAD_BODY_CAP = 280_000_000\n\nexport function parseArgs(args: string[]): { target?: string; port: number; bind: string } | { error: string } {\n let target: string | undefined\n let port = DEFAULT_PORT\n let bind = '127.0.0.1'\n for (let i = 0; i < args.length; i++) {\n const a = args[i]\n if (a === '--port') {\n const n = Number(args[++i])\n if (!Number.isInteger(n) || n <= 0 || n > 65535) return { error: `--port expects 1..65535, got '${args[i]}'` }\n port = n\n } else if (a === '--host' || a === '--bind') {\n // --host is the spelling; --bind stays an alias so an old command line keeps working\n const b = args[++i]\n if (b == null) return { error: `${a} expects an address (0.0.0.0 to reach it from another machine)` }\n bind = b\n } else if (a != null && a.startsWith('--')) return { error: `unknown flag '${a}'` }\n else if (a != null) {\n if (target != null) return { error: `one target only (got '${target}' and '${a}')` }\n target = a\n }\n }\n return { target, port, bind }\n}\n\n/** node:http glue around ServeApp.handle — exported so tests can drive a real socket */\n/** open CORS, because a browser page IS a first-class client here: the web entry runs the\n * library in a tab and rides serve as its bridge to hosts that send no CORS headers\n * (examples/web is on another port by construction). The cost is real and stated at launch:\n * with no auth, any page you visit can drive this api. That is the same trade as the port\n * being open at all, so it is said out loud rather than hidden behind a flag. */\nexport function makeRequestListener(app: ServeApp): (req: IncomingMessage, res: ServerResponse) => void {\n const cors = {\n 'access-control-allow-origin': '*',\n 'access-control-allow-methods': 'GET, POST, PUT, DELETE, OPTIONS',\n 'access-control-allow-headers': 'content-type, accept',\n }\n return (req, res) => {\n const cap = req.method === 'POST' && (req.url ?? '').split('?')[0] === '/upload' ? UPLOAD_BODY_CAP : BODY_CAP\n const chunks: Buffer[] = []\n let size = 0\n let overflow = false\n req.on('error', (e) => console.error(`[serve] request stream error: ${extractErrorMessage(e)}`))\n req.on('data', (c: Buffer) => {\n if (overflow) return\n size += c.length\n if (size > cap) {\n // answer NOW: a destroyed request never emits 'end'\n overflow = true\n res.writeHead(413, { 'content-type': 'application/json', ...cors })\n res.end(JSON.stringify({ error: 'payload too large' }), () => req.destroy())\n } else chunks.push(c)\n })\n req.on('end', () => {\n if (overflow) return\n if (req.method === 'OPTIONS') {\n res.writeHead(204, cors)\n res.end()\n return\n }\n app.handle({\n method: req.method ?? 'GET',\n url: req.url ?? '/',\n accept: req.headers.accept,\n body: Buffer.concat(chunks).toString('utf8'),\n })\n .then((whole) => {\n const range = req.headers.range\n const reply = withByteRange(whole, { method: req.method ?? 'GET', range })\n res.writeHead(reply.status, { 'content-type': reply.contentType, ...reply.headers, ...cors })\n res.end(reply.body)\n })\n .catch((e: unknown) => {\n // handle() catches internally; this guards the response write itself\n console.error(`[serve] response write failed: ${extractErrorMessage(e)}`)\n res.destroy()\n })\n })\n }\n}\n\nexport async function runServe(args: string[]): Promise<number> {\n const parsed = parseArgs(args)\n if ('error' in parsed) {\n console.error(`[comfy-ts serve] ${parsed.error}`)\n return 1\n }\n\n // discovery: explicit file → that module only; dir/no-arg → scan, WITHOUT\n // the bundled examples (serve is for the user's tuned drafts)\n const target = resolve(parsed.target ?? '.')\n let files: string[]\n try {\n files = statSync(target).isDirectory() ? scanCflowFiles(target) : [target]\n } catch {\n console.error(`[comfy-ts serve] no such file or directory: ${target}`)\n return 1\n }\n if (files.length === 0) {\n console.error(`[comfy-ts serve] no *.cflow.ts modules under ${target}`)\n return 1\n }\n\n const modules: ServeModule[] = []\n const loadErrors: Record<string, string> = {}\n for (const file of files) {\n try {\n const mod: Record<string, unknown> = await import(pathToFileURL(file).href)\n const dw = findDefinedWorkflow(mod)\n if (dw == null) throw new Error('exports no DefinedWorkflow')\n const key = draftKeyForFile(file)\n const clash = modules.find((m) => m.key === key)\n if (clash != null) throw new Error(`module key '${key}' already taken by ${clash.file}`)\n modules.push({ key, file, dw })\n } catch (e) {\n loadErrors[file] = extractErrorMessage(e)\n console.error(`[comfy-ts serve] ✗ ${file}: ${loadErrors[file]}`)\n }\n }\n if (modules.length === 0) {\n console.error('[comfy-ts serve] every module failed to load — nothing to serve')\n return 1\n }\n\n const app = new ServeApp(modules, {\n loadErrors,\n webJs: loadOrBuildWebJs,\n // the modules registered comfyts on import: its root holds `.comfy-ts/`\n workspace: typeof comfyts === 'undefined' ? process.cwd() : comfyts.rootPath,\n root: statSync(target).isDirectory() ? target : dirname(target),\n })\n return listenUntilClosed(createServer(makeRequestListener(app)), parsed.port, parsed.bind, () =>\n printStartup(app, parsed.bind, parsed.port),\n )\n}\n\n/** listens, then stays up until the server closes; resolves the exit code. A listen\n * failure resolves 1 AT ONCE: bun fires no `close` for a server that never listened,\n * and a cli awaiting one never ends (agent/architecture.md item 12) */\nexport function listenUntilClosed(\n server: Server,\n port: number,\n bind: string,\n onListening?: () => void,\n): Promise<number> {\n return new Promise<number>((resolveExit) => {\n let listening = false\n server.once('listening', () => {\n listening = true\n onListening?.()\n })\n server.on('error', (e) => {\n if (!listening) {\n console.error(`[comfy-ts serve] 🔴 ${describeListenError(e, port, bind)}`)\n resolveExit(1)\n return\n }\n console.error(`[comfy-ts serve] server error: ${extractErrorMessage(e)}`)\n server.close()\n resolveExit(1)\n })\n server.on('close', () => resolveExit(0))\n server.listen(port, bind)\n })\n}\n\nfunction describeListenError(e: Error, port: number, bind: string): string {\n const code = 'code' in e ? e.code : undefined\n if (code !== 'EADDRINUSE') return `cannot listen on ${bind}:${port}: ${extractErrorMessage(e)}`\n const holder = portHolder(port)\n const by = holder == null ? '' : ` by ${holder}`\n return `port ${port} on ${bind} is taken${by}: stop it, or pick another port with --port <n>`\n}\n\n/** `pid <n> (<command>)` of the process listening on a tcp port; null when unknowable\n * (no lsof on this box, or the holder is not visible to this user) */\nexport function portHolder(port: number): string | null {\n const lsof = spawnSync('lsof', ['-nP', `-iTCP:${port}`, '-sTCP:LISTEN', '-t'], { encoding: 'utf8', timeout: 2000 })\n const pid = lsof.error == null ? lsof.stdout.split('\\n')[0]?.trim() : undefined\n if (pid == null || pid === '') return null\n const ps = spawnSync('ps', ['-o', 'command=', '-p', pid], { encoding: 'utf8', timeout: 2000 })\n const command = ps.error == null ? ps.stdout.trim().slice(0, 160) : ''\n return command === '' ? `pid ${pid}` : `pid ${pid} (${command})`\n}\n\nexport type Nic = { address: string; family: string | number; internal: boolean }\n\n/** the addresses this bind actually answers on. `0.0.0.0` means every interface, so printing\n * only that back is useless: the LAN ip and the tailnet 100.x are the urls a phone can open */\nexport function reachableAddresses(bind: string, nics: Record<string, Nic[] | undefined>): string[] {\n if (bind !== '0.0.0.0' && bind !== '::') return [bind]\n const found: string[] = []\n for (const list of Object.values(nics)) {\n for (const nic of list ?? []) {\n // node reports family as 'IPv4' or 4 depending on the version\n if (nic.internal || (nic.family !== 'IPv4' && nic.family !== 4)) continue\n found.push(nic.address)\n }\n }\n return ['127.0.0.1', ...found]\n}\n\nfunction printStartup(app: ServeApp, bind: string, port: number): void {\n const base = `http://${bind}:${port}`\n const color = colorsAvailable()\n const lines = renderStartupLines({\n bind,\n port,\n urls: reachableAddresses(bind, networkInterfaces()),\n color,\n modules: app.modules.map((mod) => {\n const entries = mod.dw.entries()\n const nameWidth = Math.max(...entries.map(([n]) => n.length), 4)\n return {\n key: mod.key,\n hostId: mod.dw.host.data.id,\n routes: app\n .draftsFor(mod)\n .map((d) => `${base}/generate/${encodeURIComponent(mod.key)}/${encodeURIComponent(d)}`),\n varLines: entries.map(([name, varDef]) =>\n renderDescriptorLine(name, describeVar(varDef), nameWidth, color),\n ),\n }\n }),\n })\n for (const line of lines) console.log(line)\n}\n"],"mappings":";;;;;;;;;;;AAKA,SAAS,WAAW,QAAgB,MAAuE;CACxG,MAAM,IAAI,sBAAsB,KAAK,OAAO,KAAK,CAAC;CAClD,IAAI,KAAK,MAAM,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IAAI,IAAI,YAAa,IAAI,WAAW,UAAU,IAAI,WAAW,GAAI;EACjE,MAAM,KAAK,IAAI,OAAO;CACzB;CAEH,OAAO,CAAC,aAAa,GAAG,KAAK;AAChC;AAEA,SAAS,aAAa,KAAe,MAAc,MAAoB;CACpE,MAAM,OAAO,UAAU,KAAK,GAAG;CAC/B,MAAM,QAAQ,gBAAgB;CAC9B,MAAM,QAAQ,mBAAmB;EAC9B;EACA;EACA,MAAM,mBAAmB,MAAM,kBAAkB,CAAC;EAClD;EACA,SAAS,IAAI,QAAQ,KAAK,QAAQ;GAC/B,MAAM,UAAU,IAAI,GAAG,QAAQ;GAC/B,MAAM,YAAY,KAAK,IAAI,GAAG,QAAQ,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC;GAC/D,OAAO;IACJ,KAAK,IAAI;IACT,QAAQ,IAAI,GAAG,KAAK,KAAK;IACzB,QAAQ,IACJ,UAAU,GAAG,CAAC,CACd,KAAK,MAAM,GAAG,KAAK,YAAY,mBAAmB,IAAI,GAAG,EAAE,GAAG,mBAAmB,CAAC,GAAG;IACzF,UAAU,QAAQ,KAAK,CAAC,MAAM,YAC3B,qBAAqB,MAAM,YAAY,MAAM,GAAG,WAAW,KAAK,CACnE;GACH;EACH,CAAC;CACJ,CAAC;CACD,KAAK,MAAM,QAAQ,OAAO,QAAQ,IAAI,IAAI;AAC7C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as settingsPathFor, o as importSharp, t as bundledExamplesDir } from "./exampleAssets-
|
|
2
|
-
import { F as fetchLoraList, I as fetchLoraPreviewBytes, J as loraKey, Y as loraPreviewMapFrom, f as clearLoraKeywordOverride, g as setLoraKeyword, h as loraKeywordFromMirror, ht as extractErrorMessage, i as summarizeDrift, k as refreshLoraInfoCacheIfChanged, m as isLoraKeywordFromMirror, o as LorasVar, p as getLoraKeyword, q as loraBasename, s as PromptVar, tt as extensionOf, ut as logError, w as loraMatchesFilter, x as getLoraPreviewUrl, y as getLoraDisplayName } from "./schemaDrift-
|
|
3
|
-
import { a as draftKeyForFile, c as LogsSt, f as assignFamilyColors, i as DraftsSt, m as familyOf, n as mergeWorkflowSources, p as buildFileRows, r as scanCflowFiles, s as listDraftsForFile, t as findDefinedWorkflow } from "./findDefinedWorkflow-
|
|
1
|
+
import { i as settingsPathFor, o as importSharp, t as bundledExamplesDir } from "./exampleAssets-B5sMqNia.js";
|
|
2
|
+
import { F as fetchLoraList, I as fetchLoraPreviewBytes, J as loraKey, Y as loraPreviewMapFrom, f as clearLoraKeywordOverride, g as setLoraKeyword, h as loraKeywordFromMirror, ht as extractErrorMessage, i as summarizeDrift, k as refreshLoraInfoCacheIfChanged, m as isLoraKeywordFromMirror, o as LorasVar, p as getLoraKeyword, q as loraBasename, s as PromptVar, tt as extensionOf, ut as logError, w as loraMatchesFilter, x as getLoraPreviewUrl, y as getLoraDisplayName } from "./schemaDrift-CHDVYlaj.js";
|
|
3
|
+
import { a as draftKeyForFile, c as LogsSt, f as assignFamilyColors, i as DraftsSt, m as familyOf, n as mergeWorkflowSources, p as buildFileRows, r as scanCflowFiles, s as listDraftsForFile, t as findDefinedWorkflow } from "./findDefinedWorkflow-BNZgYIww.js";
|
|
4
4
|
import { spawn } from "node:child_process";
|
|
5
5
|
import { homedir, tmpdir } from "node:os";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
@@ -4566,4 +4566,4 @@ async function runTui(args) {
|
|
|
4566
4566
|
//#endregion
|
|
4567
4567
|
export { runTui };
|
|
4568
4568
|
|
|
4569
|
-
//# sourceMappingURL=run-tui-
|
|
4569
|
+
//# sourceMappingURL=run-tui-CB6i_x2y.js.map
|