feat(modality)!: SnapOtter 2.0 phase 3 modality framework: media/doc engines, pool routing, display modes (#218)

This commit is contained in:
SnapOtter
2026-06-13 10:18:39 +08:00
parent c451b939c7
commit d647d8ed19
99 changed files with 4380 additions and 1813 deletions
+11
View File
@@ -0,0 +1,11 @@
import { runDocsScript } from "@snapotter/ai";
/** Page count via the docs-profile Python dispatcher (pikepdf). */
export async function pdfPageCountPy(absPath: string): Promise<number> {
const stdout = await runDocsScript("doc_pagecount", { path: absPath });
const parsed = JSON.parse(stdout.trim()) as { pages?: number; error?: string };
if (parsed.error || typeof parsed.pages !== "number") {
throw new Error(`doc_pagecount failed: ${parsed.error ?? stdout.slice(0, 200)}`);
}
return parsed.pages;
}