vde-open 0.1.10 → 0.1.11
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 +16 -2
- package/dist/cli.js +3 -3
- package/dist/daemon.js +2 -2
- package/dist/{html-static-BDV6MgA7.js → html-static-C_wwQAJx.js} +67 -0
- package/dist/{main-BI-4X6_3.js → main-BH6i8EXC.js} +62 -12
- package/dist/{print-Cfa1Ytrj.js → print-vae7mHCU.js} +1 -1
- package/dist/{render-BX3arVZj.js → render-BJa4uW0H.js} +1 -1
- package/dist/{search-index-NiN4l6Hg.js → search-index-BoGly_y4.js} +11 -3
- package/dist/web/assets/index-CVYtIVot.js +163 -0
- package/dist/web/assets/index-_RRuuJtK.css +2 -0
- package/dist/web/index.html +2 -2
- package/dist/workers/parse-worker.js +3 -3
- package/dist/workers/search-worker.js +1 -1
- package/docs/agent-usage.md +1 -0
- package/package.json +3 -2
- package/skills/vde-open/SKILL.md +4 -2
- package/dist/web/assets/index-DOobMckY.js +0 -163
- package/dist/web/assets/index-HOxygmIG.css +0 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[日本語](README.ja.md)
|
|
4
4
|
|
|
5
|
-
A local document viewer for agents and people who work from the same material. Open Markdown and
|
|
5
|
+
A local document viewer for agents and people who work from the same material. Open Markdown, HTML, and image files, read them in a management UI in the browser, and let an agent search and read the same documents from the CLI. An agent can also ask a person questions, and the person submits the answers from the management UI.
|
|
6
6
|
|
|
7
7
|
- Agents can search and read only the documents you opened.
|
|
8
8
|
- When you save a document, the management UI updates automatically.
|
|
@@ -28,7 +28,7 @@ To install from a clone of this repository (Node.js 24.21.0 is pinned in `mise.t
|
|
|
28
28
|
pnpm install --frozen-lockfile
|
|
29
29
|
pnpm build
|
|
30
30
|
pnpm test:pack # builds artifacts/vde-open-<version>.tgz and verifies an install in a separate directory
|
|
31
|
-
bun add -g "$PWD/artifacts/vde-open-0.1.
|
|
31
|
+
bun add -g "$PWD/artifacts/vde-open-0.1.11.tgz" # bun add -g needs an absolute path
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
## `vde-open` and `vo`
|
|
@@ -97,6 +97,20 @@ Markdown is rendered with TanStack Markdown 1.0.0. It is not fully compatible wi
|
|
|
97
97
|
- Code is highlighted only for JS, JSX, TS, TSX, JSON, YAML, HTML, CSS, Bash, and Markdown. Code larger than 256 KiB and other languages are not highlighted.
|
|
98
98
|
- Documents that cannot be parsed within 2 seconds, or that have more than 100,000 elements or more than 64 levels of nesting, are shown as source.
|
|
99
99
|
|
|
100
|
+
## Image files
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
vo diagram.png # open an image directly
|
|
104
|
+
vo open photo.jpg animation.gif --focus # open images and switch the view
|
|
105
|
+
vo open images -w # also open images added later
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Recognized extensions include PNG/APNG, JPEG (`jpg`, `jpeg`, `jpe`, `jif`, `jfif`, `pjpeg`, `pjp`), GIF, WebP, AVIF, SVG, BMP, ICO/CUR, JPEG XL, TIFF, and HEIC/HEIF. Images initially fit the view; "Actual size" shows the original dimensions with scrolling. Saving the file updates the view. Pausing updates keeps the displayed revision. You can open the same image's management UI URL in another browser on the same machine.
|
|
109
|
+
|
|
110
|
+
The browser decodes the original file without conversion. Supported formats depend on the browser and OS. Unsupported or damaged images show an error. SVG is displayed as an image; scripts and external references cannot run.
|
|
111
|
+
|
|
112
|
+
Images are searchable by title and path (`vo search diagram --mode path`). Text extraction, `vo read`, and PDF export are for Markdown and HTML; images have no OCR. The existing 10 MiB per-file limit also applies to images.
|
|
113
|
+
|
|
100
114
|
## Exporting to PDF
|
|
101
115
|
|
|
102
116
|
"Export PDF" in the header of a document saves the shown revision as a PDF, without a print dialog.
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { C as decodeStateFile, D as daemonEntryPath, E as resolveStateRoot, O as referencedBlobs, S as renameWithRetry, T as resolveRuntimeLocation, a as DAEMON_LOCK_NAME, b as proofMatches, c as readIpcKey, d as inspectOwner, f as readCurrentLock, g as encodeFrame, h as FrameDecoder, i as requirePrivateDirectoryIfExists, k as version, l as readPointer, m as systemProcessProbe, n as ensurePrivateDirectory, o as POINTER_FILE, p as releaseLock, r as inspectPrivateDirectory, s as START_LOCK_NAME, t as startDaemon, u as acquireLock, v as computeProof, w as currentPathEnvironment, x as removeWithRetry, y as createNonce } from "./main-
|
|
3
|
-
import { A as successEnvelope, C as VdeError, D as ExitCode, E as isVdeError, O as envelopeSchema, T as isErrorCode, Y as LIMITS, k as errorEnvelope, w as exitCodeForError } from "./search-index-
|
|
2
|
+
import { C as decodeStateFile, D as daemonEntryPath, E as resolveStateRoot, O as referencedBlobs, S as renameWithRetry, T as resolveRuntimeLocation, a as DAEMON_LOCK_NAME, b as proofMatches, c as readIpcKey, d as inspectOwner, f as readCurrentLock, g as encodeFrame, h as FrameDecoder, i as requirePrivateDirectoryIfExists, k as version, l as readPointer, m as systemProcessProbe, n as ensurePrivateDirectory, o as POINTER_FILE, p as releaseLock, r as inspectPrivateDirectory, s as START_LOCK_NAME, t as startDaemon, u as acquireLock, v as computeProof, w as currentPathEnvironment, x as removeWithRetry, y as createNonce } from "./main-BH6i8EXC.js";
|
|
3
|
+
import { A as successEnvelope, C as VdeError, D as ExitCode, E as isVdeError, O as envelopeSchema, T as isErrorCode, Y as LIMITS, k as errorEnvelope, w as exitCodeForError } from "./search-index-BoGly_y4.js";
|
|
4
4
|
import fs, { fstatSync } from "node:fs";
|
|
5
5
|
import { lstat, readFile, readdir, stat as stat$1, writeFile } from "node:fs/promises";
|
|
6
6
|
import path, { join, resolve } from "node:path";
|
|
@@ -3848,7 +3848,7 @@ async function runCli(rawArgv, context) {
|
|
|
3848
3848
|
}
|
|
3849
3849
|
};
|
|
3850
3850
|
const program = new Command();
|
|
3851
|
-
program.name(PROGRAM_NAME).description("Local CLI that shows
|
|
3851
|
+
program.name(PROGRAM_NAME).description("Local CLI that shows Markdown, HTML, and images in the browser and lets agents search documents and read text").version(CLI_VERSION, "-V, --version", "Show the version").helpOption("-h, --help", "Show help").addHelpText("after", "\n`vo` is the same command as `vde-open`. Passing a file directly is treated as `open` (for example: vo a.md).\nRunning with no arguments opens the management UI in the browser.").exitOverride().configureOutput({
|
|
3852
3852
|
writeOut: context.stdout,
|
|
3853
3853
|
writeErr: context.stderr
|
|
3854
3854
|
}).action(async () => {
|
package/dist/daemon.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { k as version, t as startDaemon, w as currentPathEnvironment } from "./main-
|
|
2
|
-
import { E as isVdeError } from "./search-index-
|
|
1
|
+
import { k as version, t as startDaemon, w as currentPathEnvironment } from "./main-BH6i8EXC.js";
|
|
2
|
+
import { E as isVdeError } from "./search-index-BoGly_y4.js";
|
|
3
3
|
//#region src/daemon.ts
|
|
4
4
|
function notifyParent(message) {
|
|
5
5
|
if (!process.send) return;
|
|
@@ -8090,6 +8090,10 @@ const ASSET_TYPES = {
|
|
|
8090
8090
|
mime: "image/png",
|
|
8091
8091
|
role: "image"
|
|
8092
8092
|
},
|
|
8093
|
+
apng: {
|
|
8094
|
+
mime: "image/apng",
|
|
8095
|
+
role: "image"
|
|
8096
|
+
},
|
|
8093
8097
|
jpg: {
|
|
8094
8098
|
mime: "image/jpeg",
|
|
8095
8099
|
role: "image"
|
|
@@ -8098,6 +8102,26 @@ const ASSET_TYPES = {
|
|
|
8098
8102
|
mime: "image/jpeg",
|
|
8099
8103
|
role: "image"
|
|
8100
8104
|
},
|
|
8105
|
+
jpe: {
|
|
8106
|
+
mime: "image/jpeg",
|
|
8107
|
+
role: "image"
|
|
8108
|
+
},
|
|
8109
|
+
jif: {
|
|
8110
|
+
mime: "image/jpeg",
|
|
8111
|
+
role: "image"
|
|
8112
|
+
},
|
|
8113
|
+
jfif: {
|
|
8114
|
+
mime: "image/jpeg",
|
|
8115
|
+
role: "image"
|
|
8116
|
+
},
|
|
8117
|
+
pjpeg: {
|
|
8118
|
+
mime: "image/jpeg",
|
|
8119
|
+
role: "image"
|
|
8120
|
+
},
|
|
8121
|
+
pjp: {
|
|
8122
|
+
mime: "image/jpeg",
|
|
8123
|
+
role: "image"
|
|
8124
|
+
},
|
|
8101
8125
|
webp: {
|
|
8102
8126
|
mime: "image/webp",
|
|
8103
8127
|
role: "image"
|
|
@@ -8114,6 +8138,38 @@ const ASSET_TYPES = {
|
|
|
8114
8138
|
mime: "image/svg+xml",
|
|
8115
8139
|
role: "svg"
|
|
8116
8140
|
},
|
|
8141
|
+
bmp: {
|
|
8142
|
+
mime: "image/bmp",
|
|
8143
|
+
role: "image"
|
|
8144
|
+
},
|
|
8145
|
+
ico: {
|
|
8146
|
+
mime: "image/x-icon",
|
|
8147
|
+
role: "image"
|
|
8148
|
+
},
|
|
8149
|
+
cur: {
|
|
8150
|
+
mime: "image/x-icon",
|
|
8151
|
+
role: "image"
|
|
8152
|
+
},
|
|
8153
|
+
jxl: {
|
|
8154
|
+
mime: "image/jxl",
|
|
8155
|
+
role: "image"
|
|
8156
|
+
},
|
|
8157
|
+
tif: {
|
|
8158
|
+
mime: "image/tiff",
|
|
8159
|
+
role: "image"
|
|
8160
|
+
},
|
|
8161
|
+
tiff: {
|
|
8162
|
+
mime: "image/tiff",
|
|
8163
|
+
role: "image"
|
|
8164
|
+
},
|
|
8165
|
+
heic: {
|
|
8166
|
+
mime: "image/heic",
|
|
8167
|
+
role: "image"
|
|
8168
|
+
},
|
|
8169
|
+
heif: {
|
|
8170
|
+
mime: "image/heif",
|
|
8171
|
+
role: "image"
|
|
8172
|
+
},
|
|
8117
8173
|
css: {
|
|
8118
8174
|
mime: "text/css; charset=utf-8",
|
|
8119
8175
|
role: "style"
|
|
@@ -8682,6 +8738,17 @@ function analyzeHtml(source) {
|
|
|
8682
8738
|
};
|
|
8683
8739
|
}
|
|
8684
8740
|
function analyzeDocument(source, format) {
|
|
8741
|
+
if (format === "image") return {
|
|
8742
|
+
title: null,
|
|
8743
|
+
outline: [],
|
|
8744
|
+
sections: [{
|
|
8745
|
+
sectionId: "sec_0000",
|
|
8746
|
+
level: 0,
|
|
8747
|
+
title: "",
|
|
8748
|
+
headingPath: [],
|
|
8749
|
+
text: ""
|
|
8750
|
+
}]
|
|
8751
|
+
};
|
|
8685
8752
|
return format === "markdown" ? analyzeMarkdown(source) : analyzeHtml(source);
|
|
8686
8753
|
}
|
|
8687
8754
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as roleAllowed, N as __commonJSMin, P as __toESM, S as isValidLogicalPath, _ as classifyLink, b as encodeLogicalPath, d as analyzeDocument, g as assetTypeOf, u as ParseLimitError, v as classifyReference, x as hasHiddenSegment, y as dirnameOfLogicalPath } from "./html-static-
|
|
2
|
-
import { $ as literal, A as successEnvelope, B as readParamsSchema, C as VdeError, D as ExitCode, E as isVdeError, F as htmlModeChangeParamsSchema, G as sha256Schema, H as reorderParamsSchema, I as htmlModeSchema, J as watchRuleSchema, K as sourceKindSchema, L as linkOpenParamsSchema, M as closeParamsSchema, N as documentFormatSchema, P as documentIdSchema, Q as boolean, R as listParamsSchema, S as validateAnswers, U as revisionSchema, V as renderGrantParamsSchema, W as searchParamsSchema, X as _enum, Y as LIMITS, Z as array, _ as feedbackWaitParamsSchema, a as uniqueTokens, at as canonicalJson, b as submissionSchema, c as feedbackAckParamsSchema, d as feedbackDraftParamsSchema, et as number, f as feedbackForgetParamsSchema, g as feedbackSubmitParamsSchema, h as feedbackStatusSchema, i as codePointLength, it as ZodError, j as assetRecordSchema, k as errorEnvelope, l as feedbackCancelParamsSchema, m as feedbackListParamsSchema, n as batchesOf, nt as strictObject, o as answersSchema, p as feedbackIdParamsSchema, q as sourceStateSchema, r as partsOf, rt as string, s as cancellationSchema, tt as record, u as feedbackCreateParamsSchema, v as questionnaireSchema, w as exitCodeForError, x as utf8Length, y as requestIdSchema, z as openParamsSchema } from "./search-index-
|
|
3
|
-
import { n as scanReferences, r as extractTitle } from "./render-
|
|
1
|
+
import { C as roleAllowed, N as __commonJSMin, P as __toESM, S as isValidLogicalPath, _ as classifyLink, b as encodeLogicalPath, d as analyzeDocument, g as assetTypeOf, u as ParseLimitError, v as classifyReference, x as hasHiddenSegment, y as dirnameOfLogicalPath } from "./html-static-C_wwQAJx.js";
|
|
2
|
+
import { $ as literal, A as successEnvelope, B as readParamsSchema, C as VdeError, D as ExitCode, E as isVdeError, F as htmlModeChangeParamsSchema, G as sha256Schema, H as reorderParamsSchema, I as htmlModeSchema, J as watchRuleSchema, K as sourceKindSchema, L as linkOpenParamsSchema, M as closeParamsSchema, N as documentFormatSchema, P as documentIdSchema, Q as boolean, R as listParamsSchema, S as validateAnswers, U as revisionSchema, V as renderGrantParamsSchema, W as searchParamsSchema, X as _enum, Y as LIMITS, Z as array, _ as feedbackWaitParamsSchema, a as uniqueTokens, at as canonicalJson, b as submissionSchema, c as feedbackAckParamsSchema, d as feedbackDraftParamsSchema, et as number, f as feedbackForgetParamsSchema, g as feedbackSubmitParamsSchema, h as feedbackStatusSchema, i as codePointLength, it as ZodError, j as assetRecordSchema, k as errorEnvelope, l as feedbackCancelParamsSchema, m as feedbackListParamsSchema, n as batchesOf, nt as strictObject, o as answersSchema, p as feedbackIdParamsSchema, q as sourceStateSchema, r as partsOf, rt as string, s as cancellationSchema, tt as record, u as feedbackCreateParamsSchema, v as questionnaireSchema, w as exitCodeForError, x as utf8Length, y as requestIdSchema, z as openParamsSchema } from "./search-index-BoGly_y4.js";
|
|
3
|
+
import { n as scanReferences, r as extractTitle } from "./render-BJa4uW0H.js";
|
|
4
4
|
import { n as measureHeap, t as collectGarbage } from "./heap-C3qHm7SE.js";
|
|
5
5
|
import { accessSync, constants, existsSync, stat, statSync, unwatchFile, watch, watchFile } from "node:fs";
|
|
6
6
|
import { appendFile, chmod, link, lstat, mkdir, mkdtemp, open, readFile, readdir, readlink, realpath, rename, rm, rmdir, stat as stat$1, writeFile } from "node:fs/promises";
|
|
@@ -154,7 +154,7 @@ function parseStrictJson(text) {
|
|
|
154
154
|
}
|
|
155
155
|
//#endregion
|
|
156
156
|
//#region package.json
|
|
157
|
-
var version = "0.1.
|
|
157
|
+
var version = "0.1.11";
|
|
158
158
|
//#endregion
|
|
159
159
|
//#region src/documents/cursor.ts
|
|
160
160
|
function invalidCursor(reason) {
|
|
@@ -283,7 +283,7 @@ function decodeSource(bytes, label) {
|
|
|
283
283
|
throw invalid(label, "invalid-utf8");
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
|
-
async function readSourceFile(path) {
|
|
286
|
+
async function readSourceFile(path, format = "markdown") {
|
|
287
287
|
let canonicalPath;
|
|
288
288
|
try {
|
|
289
289
|
canonicalPath = await realpath(path);
|
|
@@ -317,7 +317,7 @@ async function readSourceFile(path) {
|
|
|
317
317
|
return {
|
|
318
318
|
canonicalPath,
|
|
319
319
|
bytes,
|
|
320
|
-
text: decodeSource(bytes, path),
|
|
320
|
+
text: format === "image" ? "" : decodeSource(bytes, path),
|
|
321
321
|
signature: statSignature(after)
|
|
322
322
|
};
|
|
323
323
|
} finally {
|
|
@@ -3387,7 +3387,10 @@ const FORMAT_BY_EXTENSION = /* @__PURE__ */ new Map([
|
|
|
3387
3387
|
[".htm", "html"]
|
|
3388
3388
|
]);
|
|
3389
3389
|
function formatOfPath(path) {
|
|
3390
|
-
|
|
3390
|
+
const document = FORMAT_BY_EXTENSION.get(extname(path).toLowerCase());
|
|
3391
|
+
if (document) return document;
|
|
3392
|
+
const asset = assetTypeOf(path);
|
|
3393
|
+
return asset?.role === "image" || asset?.role === "svg" ? "image" : null;
|
|
3391
3394
|
}
|
|
3392
3395
|
function compareText(a, b) {
|
|
3393
3396
|
return a < b ? -1 : a > b ? 1 : 0;
|
|
@@ -4086,6 +4089,7 @@ const ANALYSIS_CACHE_BYTES = 33554432;
|
|
|
4086
4089
|
const MISSING_RETRY_MS = 1e3;
|
|
4087
4090
|
const MISSING_RETRY_INTERVAL_MS = 100;
|
|
4088
4091
|
function profileOf(format) {
|
|
4092
|
+
if (format === "image") return "image-v1";
|
|
4089
4093
|
return format === "markdown" ? MARKDOWN_PARSER_PROFILE : HTML_STATIC_PARSER_PROFILE;
|
|
4090
4094
|
}
|
|
4091
4095
|
function toSummary(record, order, searchState = "excluded", pendingRequestIds = [], interactiveAllowed = false, repository = null) {
|
|
@@ -4290,6 +4294,20 @@ var DocumentService = class {
|
|
|
4290
4294
|
});
|
|
4291
4295
|
documentLogicalPath = fromRoot.split(sep).join("/");
|
|
4292
4296
|
}
|
|
4297
|
+
if (source.format === "image") {
|
|
4298
|
+
const type = assetTypeOf(documentLogicalPath);
|
|
4299
|
+
if (type?.role !== "image" && type?.role !== "svg") throw new VdeError("E_UNSUPPORTED_FORMAT", "The file extension is not an image format.");
|
|
4300
|
+
if (extraAssets.length > 0) throw new VdeError("E_INVALID_ARGUMENT", "--asset is not available for standalone images.");
|
|
4301
|
+
return {
|
|
4302
|
+
...source,
|
|
4303
|
+
assetsRoot,
|
|
4304
|
+
extraAssets: [],
|
|
4305
|
+
documentLogicalPath,
|
|
4306
|
+
assets: [],
|
|
4307
|
+
trackedFiles: [],
|
|
4308
|
+
assetScanFailed: false
|
|
4309
|
+
};
|
|
4310
|
+
}
|
|
4293
4311
|
let assetScanFailed = false;
|
|
4294
4312
|
const manifest = await buildManifest({
|
|
4295
4313
|
format: source.format,
|
|
@@ -4598,7 +4616,7 @@ var DocumentService = class {
|
|
|
4598
4616
|
for (const [canonicalPath, { candidate, format }] of resolved.unique) {
|
|
4599
4617
|
let loaded;
|
|
4600
4618
|
try {
|
|
4601
|
-
loaded = await this.#readSource(candidate.absolutePath);
|
|
4619
|
+
loaded = await this.#readSource(candidate.absolutePath, format);
|
|
4602
4620
|
} catch (error) {
|
|
4603
4621
|
if (!(error instanceof VdeError)) throw error;
|
|
4604
4622
|
problems.push({
|
|
@@ -4699,7 +4717,7 @@ var DocumentService = class {
|
|
|
4699
4717
|
sha256
|
|
4700
4718
|
}))
|
|
4701
4719
|
});
|
|
4702
|
-
const title = options.title ?? extractTitle(item.text, item.format) ?? item.fallbackTitle;
|
|
4720
|
+
const title = options.title ?? (item.format === "image" ? null : extractTitle(item.text, item.format)) ?? item.fallbackTitle;
|
|
4703
4721
|
const revisionRecord = {
|
|
4704
4722
|
revision,
|
|
4705
4723
|
format: item.format,
|
|
@@ -4869,6 +4887,10 @@ var DocumentService = class {
|
|
|
4869
4887
|
sectionId = payload["sectionId"];
|
|
4870
4888
|
}
|
|
4871
4889
|
const entry = this.#requireRevision(record, revision);
|
|
4890
|
+
if (entry.format === "image") throw new VdeError("E_UNSUPPORTED_FORMAT", "Images have no text source, outline, or sections.", {
|
|
4891
|
+
documentId: record.documentId,
|
|
4892
|
+
format: "image"
|
|
4893
|
+
});
|
|
4872
4894
|
if (mode === "outline") return this.#readOutline(record, entry, params.maxBytes, offset ?? 0);
|
|
4873
4895
|
if (mode === "section") return this.#readSection(record, entry, sectionId ?? "", params.maxBytes, offset ?? 0);
|
|
4874
4896
|
const source = await this.#store.readBlob(entry.sourceSha256);
|
|
@@ -5245,7 +5267,12 @@ var DocumentService = class {
|
|
|
5245
5267
|
let failure = "error";
|
|
5246
5268
|
const deadline = Date.now() + MISSING_RETRY_MS;
|
|
5247
5269
|
for (;;) try {
|
|
5248
|
-
|
|
5270
|
+
const format = this.#store.payload.documents[documentId]?.format;
|
|
5271
|
+
if (format === void 0) return {
|
|
5272
|
+
changed: false,
|
|
5273
|
+
signature: null
|
|
5274
|
+
};
|
|
5275
|
+
loaded = await this.#readSource(canonicalPath, format);
|
|
5249
5276
|
break;
|
|
5250
5277
|
} catch (error) {
|
|
5251
5278
|
if (!(error instanceof VdeError)) throw error;
|
|
@@ -5362,7 +5389,7 @@ var DocumentService = class {
|
|
|
5362
5389
|
if (isOpenPath(before, path) || rule.suppressedPaths.includes(path)) continue;
|
|
5363
5390
|
let loaded;
|
|
5364
5391
|
try {
|
|
5365
|
-
loaded = await this.#readSource(path);
|
|
5392
|
+
loaded = await this.#readSource(path, format);
|
|
5366
5393
|
} catch (error) {
|
|
5367
5394
|
if (error instanceof VdeError) continue;
|
|
5368
5395
|
throw error;
|
|
@@ -5825,6 +5852,7 @@ function createPdfService(options) {
|
|
|
5825
5852
|
const run = async (documentId, revision, signal) => {
|
|
5826
5853
|
const started = Date.now();
|
|
5827
5854
|
const { record, entry } = documents.describeRevision(documentId, revision);
|
|
5855
|
+
if (entry.format === "image") throw new VdeError("E_UNSUPPORTED_FORMAT", "PDF export is available for Markdown and HTML.");
|
|
5828
5856
|
const source = (await store.readBlob(entry.sourceSha256)).toString("utf8");
|
|
5829
5857
|
const slot = randomBytes(16).toString("hex");
|
|
5830
5858
|
let assets = entry.assets.filter((asset) => asset.role === "image" || asset.role === "svg");
|
|
@@ -6916,6 +6944,28 @@ function createRenderService(options) {
|
|
|
6916
6944
|
snapshot: cached
|
|
6917
6945
|
};
|
|
6918
6946
|
}
|
|
6947
|
+
if (entry.format === "image") {
|
|
6948
|
+
const type = assetTypeOf(entry.documentLogicalPath);
|
|
6949
|
+
if (type?.role !== "image" && type?.role !== "svg") throw new VdeError("E_UNSUPPORTED_FORMAT", "The file extension is not an image format.");
|
|
6950
|
+
return {
|
|
6951
|
+
record,
|
|
6952
|
+
entry,
|
|
6953
|
+
snapshot: {
|
|
6954
|
+
format: "image",
|
|
6955
|
+
documentLogicalPath: entry.documentLogicalPath,
|
|
6956
|
+
hasDocument: true,
|
|
6957
|
+
files: /* @__PURE__ */ new Map([[entry.documentLogicalPath, {
|
|
6958
|
+
kind: "blob",
|
|
6959
|
+
sha256: entry.sourceSha256,
|
|
6960
|
+
...type
|
|
6961
|
+
}]]),
|
|
6962
|
+
assets: [],
|
|
6963
|
+
links: [],
|
|
6964
|
+
diagnostics: [],
|
|
6965
|
+
headingTargets: []
|
|
6966
|
+
}
|
|
6967
|
+
};
|
|
6968
|
+
}
|
|
6919
6969
|
const source = (await store.readBlob(entry.sourceSha256)).toString("utf8");
|
|
6920
6970
|
const stylesheets = [];
|
|
6921
6971
|
for (const asset of entry.assets) {
|
|
@@ -7469,7 +7519,7 @@ function createSearchService(options) {
|
|
|
7469
7519
|
if (indexed.get(documentId) === attempt) indexed.delete(documentId);
|
|
7470
7520
|
};
|
|
7471
7521
|
try {
|
|
7472
|
-
const text = (await store.readBlob(entry.sourceSha256)).toString("utf8");
|
|
7522
|
+
const text = entry.format === "image" ? "" : (await store.readBlob(entry.sourceSha256)).toString("utf8");
|
|
7473
7523
|
const { sections } = await analyzeOnce(entry.format, text);
|
|
7474
7524
|
if (!current()) {
|
|
7475
7525
|
await giveUp(false);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as escapeAttr, D as defaultTreeAdapter, E as serialize, M as footnoteReferenceId, O as NS, T as parseFragment, c as renderedLinkOf, h as parseMarkdownDocument, i as transformStaticHtml, j as escapeHtml$2, k as parseMarkdown, l as MARKDOWN_PARSE_OPTIONS, n as resolveAssetUrl, o as transformCss, s as localImagePath, t as DiagnosticLog, w as parse, y as dirnameOfLogicalPath } from "./html-static-
|
|
1
|
+
import { A as escapeAttr, D as defaultTreeAdapter, E as serialize, M as footnoteReferenceId, O as NS, T as parseFragment, c as renderedLinkOf, h as parseMarkdownDocument, i as transformStaticHtml, j as escapeHtml$2, k as parseMarkdown, l as MARKDOWN_PARSE_OPTIONS, n as resolveAssetUrl, o as transformCss, s as localImagePath, t as DiagnosticLog, w as parse, y as dirnameOfLogicalPath } from "./html-static-C_wwQAJx.js";
|
|
2
2
|
//#region ../../node_modules/.pnpm/@tanstack+markdown@1.0.0_react@19.3.0/node_modules/@tanstack/markdown/dist/html.js
|
|
3
3
|
function renderHtml(input, options = {}) {
|
|
4
4
|
return (typeof input === "string" ? parseMarkdown(input, options) : input).children.map((node) => renderBlock(node, options)).join("\n");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as classifyLink, a as scanCssReferences, f as assertWithinLimits, i as transformStaticHtml, k as parseMarkdown, l as MARKDOWN_PARSE_OPTIONS, m as markdownUrlTransform, n as resolveAssetUrl, o as transformCss, p as inlineText$1, r as scanHtmlReferences, t as DiagnosticLog, w as parse, y as dirnameOfLogicalPath } from "./html-static-
|
|
1
|
+
import { _ as classifyLink, a as scanCssReferences, f as assertWithinLimits, i as transformStaticHtml, k as parseMarkdown, l as MARKDOWN_PARSE_OPTIONS, m as markdownUrlTransform, n as resolveAssetUrl, o as transformCss, p as inlineText$1, r as scanHtmlReferences, t as DiagnosticLog, w as parse, y as dirnameOfLogicalPath } from "./html-static-C_wwQAJx.js";
|
|
2
2
|
//#region ../../packages/document/src/title.ts
|
|
3
3
|
const TITLE_SCAN_CHARS = 65536;
|
|
4
4
|
const MAX_TITLE_LENGTH = 160;
|
|
@@ -5632,7 +5632,11 @@ const LIMITS = {
|
|
|
5632
5632
|
const documentIdSchema = string().regex(/^doc_[0-9a-f-]{36}$/);
|
|
5633
5633
|
const revisionSchema = string().regex(/^rev_[0-9a-f]{64}$/);
|
|
5634
5634
|
const sha256Schema = string().regex(/^[0-9a-f]{64}$/);
|
|
5635
|
-
const documentFormatSchema = _enum([
|
|
5635
|
+
const documentFormatSchema = _enum([
|
|
5636
|
+
"markdown",
|
|
5637
|
+
"html",
|
|
5638
|
+
"image"
|
|
5639
|
+
]);
|
|
5636
5640
|
const sourceKindSchema = _enum([
|
|
5637
5641
|
"file",
|
|
5638
5642
|
"stdin",
|
|
@@ -5964,7 +5968,11 @@ const searchHitSchema = strictObject({
|
|
|
5964
5968
|
]),
|
|
5965
5969
|
score: number(),
|
|
5966
5970
|
sourceRange: sourceRangeSchema.nullable(),
|
|
5967
|
-
extraction: _enum([
|
|
5971
|
+
extraction: _enum([
|
|
5972
|
+
"markdown",
|
|
5973
|
+
"static-html",
|
|
5974
|
+
"image"
|
|
5975
|
+
])
|
|
5968
5976
|
});
|
|
5969
5977
|
strictObject({
|
|
5970
5978
|
query: string(),
|
|
@@ -8852,7 +8860,7 @@ var SearchIndex = class {
|
|
|
8852
8860
|
matchKind: kind,
|
|
8853
8861
|
score: Math.round(score * 1e3) / 1e3,
|
|
8854
8862
|
sourceRange: null,
|
|
8855
|
-
extraction: meta.format === "markdown" ? "markdown" : "static-html"
|
|
8863
|
+
extraction: meta.format === "image" ? "image" : meta.format === "markdown" ? "markdown" : "static-html"
|
|
8856
8864
|
});
|
|
8857
8865
|
}
|
|
8858
8866
|
return hits;
|