@threadbase-sh/streamer 1.47.1 → 1.47.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +18 -5
- package/dist/cli.cjs.map +1 -1
- package/dist/ensure-demo-project-dirs.cjs +1 -1
- package/dist/ensure-demo-project-dirs.cjs.map +1 -1
- package/dist/index.cjs +17 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -5
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -61,7 +61,7 @@ function extractDemoCwds(projectsRoot) {
|
|
|
61
61
|
if (!line.trim()) continue;
|
|
62
62
|
try {
|
|
63
63
|
const obj = JSON.parse(line);
|
|
64
|
-
if (typeof obj.cwd === "string" && obj.cwd.length > 0 && obj.cwd
|
|
64
|
+
if (typeof obj.cwd === "string" && obj.cwd.length > 0 && (0, import_node_path.isAbsolute)(obj.cwd)) {
|
|
65
65
|
cwds.add(obj.cwd);
|
|
66
66
|
}
|
|
67
67
|
} catch {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/docker/ensureDemoProjectDirs.ts"],"sourcesContent":["// Walk a Claude projects tree (…/.claude/projects/**/*.jsonl), collect every\n// unique `cwd` value, and mkdir -p each one. Demo seed JSONLs reference paths\n// like /home/demo/projects/threadbase-mobile; when PTYManager resumes a\n// session it chdirs there, and a missing directory fails the spawn with\n// \"chdir(2) failed\". Deriving the list from the corpus removes the hardcoded\n// mkdir block in entrypoint.sh that drifted whenever a new seed was added.\n//\n// Compiled by tsup to dist/ensure-demo-project-dirs.cjs.\nimport { mkdirSync, readdirSync, readFileSync, statSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\n/** Recursively list *.jsonl files under `root`. */\nexport function listJsonlFiles(root: string): string[] {\n const out: string[] = [];\n const stack: string[] = [root];\n while (stack.length > 0) {\n const dir = stack.pop();\n if (dir === undefined) break;\n let entries: string[];\n try {\n entries = readdirSync(dir);\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === \"ENOENT\") return out;\n throw err;\n }\n for (const name of entries) {\n const full = join(dir, name);\n try {\n const st = statSync(full);\n if (st.isDirectory()) stack.push(full);\n else if (st.isFile() && name.endsWith(\".jsonl\")) out.push(full);\n } catch {\n // Skip unreadable entries (races / permissions).\n }\n }\n }\n return out;\n}\n\n/**\n * Parse JSONL files under `projectsRoot` and return sorted unique absolute\n * `cwd` strings. Malformed lines and missing `cwd` are skipped.\n */\nexport function extractDemoCwds(projectsRoot: string): string[] {\n const cwds = new Set<string>();\n for (const file of listJsonlFiles(projectsRoot)) {\n const text = readFileSync(file, \"utf8\");\n for (const line of text.split(\"\\n\")) {\n if (!line.trim()) continue;\n try {\n const obj = JSON.parse(line) as { cwd?: unknown };\n if (typeof obj.cwd === \"string\" && obj.cwd.length > 0 && obj.cwd
|
|
1
|
+
{"version":3,"sources":["../src/docker/ensureDemoProjectDirs.ts"],"sourcesContent":["// Walk a Claude projects tree (…/.claude/projects/**/*.jsonl), collect every\n// unique `cwd` value, and mkdir -p each one. Demo seed JSONLs reference paths\n// like /home/demo/projects/threadbase-mobile; when PTYManager resumes a\n// session it chdirs there, and a missing directory fails the spawn with\n// \"chdir(2) failed\". Deriving the list from the corpus removes the hardcoded\n// mkdir block in entrypoint.sh that drifted whenever a new seed was added.\n//\n// Compiled by tsup to dist/ensure-demo-project-dirs.cjs.\nimport { mkdirSync, readdirSync, readFileSync, statSync } from \"node:fs\";\nimport { isAbsolute, join } from \"node:path\";\n\n/** Recursively list *.jsonl files under `root`. */\nexport function listJsonlFiles(root: string): string[] {\n const out: string[] = [];\n const stack: string[] = [root];\n while (stack.length > 0) {\n const dir = stack.pop();\n if (dir === undefined) break;\n let entries: string[];\n try {\n entries = readdirSync(dir);\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === \"ENOENT\") return out;\n throw err;\n }\n for (const name of entries) {\n const full = join(dir, name);\n try {\n const st = statSync(full);\n if (st.isDirectory()) stack.push(full);\n else if (st.isFile() && name.endsWith(\".jsonl\")) out.push(full);\n } catch {\n // Skip unreadable entries (races / permissions).\n }\n }\n }\n return out;\n}\n\n/**\n * Parse JSONL files under `projectsRoot` and return sorted unique absolute\n * `cwd` strings. Malformed lines and missing `cwd` are skipped.\n */\nexport function extractDemoCwds(projectsRoot: string): string[] {\n const cwds = new Set<string>();\n for (const file of listJsonlFiles(projectsRoot)) {\n const text = readFileSync(file, \"utf8\");\n for (const line of text.split(\"\\n\")) {\n if (!line.trim()) continue;\n try {\n const obj = JSON.parse(line) as { cwd?: unknown };\n // Absolute-only, to skip relative or garbage cwds we must not mkdir.\n // This runs on Linux (the demo container), where isAbsolute is exactly\n // startsWith(\"/\"); it is written portably so the unit tests can drive it\n // with native temp paths on Windows.\n if (typeof obj.cwd === \"string\" && obj.cwd.length > 0 && isAbsolute(obj.cwd)) {\n cwds.add(obj.cwd);\n }\n } catch {\n // Skip corrupt lines — same tolerance the scanner uses.\n }\n }\n }\n return [...cwds].sort();\n}\n\n/** Extract cwds from `projectsRoot` and create each directory. Returns the list. */\nexport function ensureDemoProjectDirs(projectsRoot: string): string[] {\n const cwds = extractDemoCwds(projectsRoot);\n for (const cwd of cwds) {\n mkdirSync(cwd, { recursive: true });\n }\n return cwds;\n}\n\nfunction main(): void {\n const projectsRoot = process.env.DEMO_PROJECTS_ROOT ?? process.argv[2];\n if (!projectsRoot) {\n console.error(\"[entrypoint] ensure-demo-project-dirs: DEMO_PROJECTS_ROOT or argv[2] required\");\n process.exit(1);\n }\n try {\n const cwds = ensureDemoProjectDirs(projectsRoot);\n for (const cwd of cwds) {\n console.log(cwd);\n }\n } catch (err) {\n console.error(`[entrypoint] ${(err as Error).message}`);\n process.exit(1);\n }\n}\n\nif (require.main === module) {\n main();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,qBAA+D;AAC/D,uBAAiC;AAG1B,SAAS,eAAe,MAAwB;AACrD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AAa;AACpB,QAAM,eAAe,QAAQ,IAAI,sBAAsB,QAAQ,KAAK,CAAC;AACrE,MAAI,CAAC,cAAc;AACjB,YAAQ,MAAM,+EAA+E;AAC7F,YAAQ,KAAK,CAAC;AAAA,EAChB;AACA,MAAI;AACF,UAAM,OAAO,sBAAsB,YAAY;AAC/C,eAAW,OAAO,MAAM;AACtB,cAAQ,IAAI,GAAG;AAAA,IACjB;AAAA,EACF,SAAS,KAAK;AACZ,YAAQ,MAAM,gBAAiB,IAAc,OAAO,EAAE;AACtD,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;AAEA,IAAI,QAAQ,SAAS,QAAQ;AAC3B,OAAK;AACP;","names":[]}
|
package/dist/index.cjs
CHANGED
|
@@ -5844,11 +5844,18 @@ function parseVersionOutput(output) {
|
|
|
5844
5844
|
return match ? match[0] : null;
|
|
5845
5845
|
}
|
|
5846
5846
|
function runVersion(exe) {
|
|
5847
|
+
const viaShell = isWindows && /\.(?:cmd|bat)$/i.test(exe);
|
|
5848
|
+
const file = viaShell ? `"${exe}"` : exe;
|
|
5847
5849
|
return new Promise((resolve2) => {
|
|
5848
|
-
(0, import_child_process3.execFile)(
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5850
|
+
(0, import_child_process3.execFile)(
|
|
5851
|
+
file,
|
|
5852
|
+
["--version"],
|
|
5853
|
+
{ timeout: VERSION_TIMEOUT_MS, shell: viaShell, windowsHide: true },
|
|
5854
|
+
(err, stdout, stderr) => {
|
|
5855
|
+
if (err && !stdout && !stderr) return resolve2(null);
|
|
5856
|
+
resolve2(parseVersionOutput(`${stdout}${stderr}`));
|
|
5857
|
+
}
|
|
5858
|
+
);
|
|
5852
5859
|
});
|
|
5853
5860
|
}
|
|
5854
5861
|
function compareToVerified(version, verified) {
|
|
@@ -5911,7 +5918,12 @@ async function providerHealth(name, resolveExe, detect = runVersion) {
|
|
|
5911
5918
|
]
|
|
5912
5919
|
};
|
|
5913
5920
|
}
|
|
5914
|
-
|
|
5921
|
+
let version = null;
|
|
5922
|
+
try {
|
|
5923
|
+
version = await detect(exe);
|
|
5924
|
+
} catch {
|
|
5925
|
+
version = null;
|
|
5926
|
+
}
|
|
5915
5927
|
const warning = compareToVerified(version, verifiedAgainst);
|
|
5916
5928
|
return {
|
|
5917
5929
|
name,
|