perf(startup): load canvas, node-pty, ssh2, html-to-text and the OpenCode SDK on first use

Main module evaluation drops from ~420 ms to ~330 ms. Types stay as import type; the DeepSeek Harness chunks stay static because the protocol chunk shares code with Main startup paths.
This commit is contained in:
mesalogo
2026-10-03 17:15:13 +08:00
parent 68cc0792e1
commit 010aafb6f4
12 changed files with 104 additions and 26 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
import { convert } from 'html-to-text'
import { loadHtmlToText } from '../document-extracted-text'
import { unzipSync } from 'fflate'
import { extname } from 'node:path'
import type { ParsedDocumentImage } from '../http-document-ocr'
@@ -701,7 +701,7 @@ export async function parseDocument(
} else if (['.docx', '.xlsx', '.pptx'].includes(extension)) {
sections = parseOfficeArchive(buffer, extension)
} else if (['.html', '.htm'].includes(extension)) {
const content = convert(decodeText(buffer), {
const content = loadHtmlToText().convert(decodeText(buffer), {
wordwrap: false,
selectors: [
{ selector: 'script', format: 'skip' },