kordoc 4.3.1 → 4.4.1
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/NOTICE +176 -0
- package/README.md +942 -922
- package/THIRD_PARTY/apache-2.0.LICENSE +201 -0
- package/THIRD_PARTY/claw-hwp.LICENSE +21 -0
- package/THIRD_PARTY/hml-equation-parser.LICENSE +201 -0
- package/THIRD_PARTY/hml-equation-parser.txt +35 -0
- package/THIRD_PARTY/opendataloader-pdf.txt +32 -0
- package/THIRD_PARTY/pix2text.txt +17 -0
- package/THIRD_PARTY/rhwp-forms.txt +35 -0
- package/dist/{-RH6BEVTT.js → -7X4H77Z7.js} +11 -11
- package/dist/{chunk-RO4Y4BFI.js → chunk-2352RXHG.js} +366 -51
- package/dist/chunk-2352RXHG.js.map +1 -0
- package/dist/{chunk-7DZPPUQD.cjs → chunk-3DX6VJGH.cjs} +9 -9
- package/dist/chunk-3DX6VJGH.cjs.map +1 -0
- package/dist/{chunk-3FFPHTXD.js → chunk-3H5X63BQ.js} +1 -1
- package/dist/chunk-3H5X63BQ.js.map +1 -0
- package/dist/{chunk-CD5X6UG5.js → chunk-5A2TGIN7.js} +2 -2
- package/dist/chunk-5A2TGIN7.js.map +1 -0
- package/dist/{chunk-SA22NK56.js → chunk-5PXCA3DN.js} +4 -4
- package/dist/chunk-5PXCA3DN.js.map +1 -0
- package/dist/{chunk-6GBLFQMA.js → chunk-5RPYBC2Q.js} +1 -1
- package/dist/chunk-5RPYBC2Q.js.map +1 -0
- package/dist/{chunk-VQB5P5KJ.cjs → chunk-7BIVNIK5.cjs} +2 -2
- package/dist/chunk-7BIVNIK5.cjs.map +1 -0
- package/dist/{chunk-W34QSJFF.js → chunk-7FCNOKOR.js} +1 -1
- package/dist/chunk-7FCNOKOR.js.map +1 -0
- package/dist/{chunk-ZYYTU7NY.js → chunk-7MDLAKVO.js} +2 -2
- package/dist/chunk-7MDLAKVO.js.map +1 -0
- package/dist/{chunk-ZSL6MQVE.js → chunk-A73RMJ6B.js} +1 -1
- package/dist/chunk-A73RMJ6B.js.map +1 -0
- package/dist/{chunk-PV3NVBGL.js → chunk-AYM6UHFX.js} +3 -3
- package/dist/chunk-AYM6UHFX.js.map +1 -0
- package/dist/chunk-DCZVOIEO.cjs.map +1 -1
- package/dist/{chunk-O5EK52TG.js → chunk-DZIXKL7E.js} +1 -1
- package/dist/chunk-DZIXKL7E.js.map +1 -0
- package/dist/{chunk-5F5UCACZ.cjs → chunk-FR65WNLF.cjs} +6 -6
- package/dist/chunk-FR65WNLF.cjs.map +1 -0
- package/dist/{chunk-ZMKTKJZN.cjs → chunk-GC7WBHAN.cjs} +26 -5
- package/dist/chunk-GC7WBHAN.cjs.map +1 -0
- package/dist/chunk-GS7T56RP.cjs.map +1 -1
- package/dist/{chunk-6XPXIG57.js → chunk-GZDOWYJM.js} +2 -2
- package/dist/chunk-GZDOWYJM.js.map +1 -0
- package/dist/{chunk-HPRK67YB.js → chunk-HGSO2H44.js} +3 -3
- package/dist/chunk-HGSO2H44.js.map +1 -0
- package/dist/{chunk-BYEQDLZS.js → chunk-IPOVUGXD.js} +6 -4
- package/dist/chunk-IPOVUGXD.js.map +1 -0
- package/dist/{chunk-HZU7Y22R.js → chunk-JGHQFUKI.js} +7 -4
- package/dist/chunk-JGHQFUKI.js.map +1 -0
- package/dist/chunk-MOL7MDBG.js +0 -0
- package/dist/{chunk-GTPEKBN6.js → chunk-NUGTEPKT.js} +2 -2
- package/dist/chunk-NUGTEPKT.js.map +1 -0
- package/dist/{chunk-BPJSTJBN.js → chunk-SMPEZINI.js} +24 -3
- package/dist/chunk-SMPEZINI.js.map +1 -0
- package/dist/{chunk-LEC2HG7A.js → chunk-T25FBUMN.js} +2 -2
- package/dist/chunk-T25FBUMN.js.map +1 -0
- package/dist/{chunk-YDCD4AV4.js → chunk-TGAWXMXB.js} +3 -3
- package/dist/chunk-TGAWXMXB.js.map +1 -0
- package/dist/{chunk-FUXDD36A.js → chunk-UA53AA7R.js} +24 -3
- package/dist/chunk-UA53AA7R.js.map +1 -0
- package/dist/{chunk-YNJDNP44.js → chunk-UAFSPWU7.js} +1 -1
- package/dist/chunk-UAFSPWU7.js.map +1 -0
- package/dist/{chunk-ZJ75YDW7.js → chunk-WA7XLWZW.js} +2 -2
- package/dist/chunk-WA7XLWZW.js.map +1 -0
- package/dist/{chunk-MGGU3ZRK.cjs → chunk-ZV5OKQ3Z.cjs} +1 -1
- package/dist/chunk-ZV5OKQ3Z.cjs.map +1 -0
- package/dist/chunks-FMZK4QHL.js +10 -0
- package/dist/cli.js +28 -24
- package/dist/cli.js.map +1 -1
- package/dist/{formula-IWV5IJ3Y.cjs → formula-CG4S7TWO.cjs} +8 -8
- package/dist/formula-CG4S7TWO.cjs.map +1 -0
- package/dist/{formula-7ZPC54JO.js → formula-JLYS73QL.js} +2 -2
- package/dist/formula-JLYS73QL.js.map +1 -0
- package/dist/{formula-EQRHSMYW.js → formula-LIVQSCMM.js} +2 -2
- package/dist/formula-LIVQSCMM.js.map +1 -0
- package/dist/{image-ocr-6MO4FXJK.js → image-ocr-AHHY42OI.js} +5 -5
- package/dist/image-ocr-AHHY42OI.js.map +1 -0
- package/dist/{image-ocr-TWUU2RNG.js → image-ocr-K4XCRBTY.js} +7 -7
- package/dist/image-ocr-K4XCRBTY.js.map +1 -0
- package/dist/{image-ocr-MGVXT6XD.cjs → image-ocr-VCXLT5Q6.cjs} +11 -11
- package/dist/image-ocr-VCXLT5Q6.cjs.map +1 -0
- package/dist/index.cjs +858 -537
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +373 -52
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +36 -32
- package/dist/mcp.js.map +1 -1
- package/dist/{models-6VMAVZR6.js → models-6SIKLKRH.js} +3 -3
- package/dist/page-range-737B4EZW.js +0 -0
- package/dist/page-range-P7SDW6LR.cjs.map +1 -1
- package/dist/{parser-JFGLN4DA.cjs → parser-ABYM2MVN.cjs} +25 -25
- package/dist/parser-ABYM2MVN.cjs.map +1 -0
- package/dist/{parser-VR2BTUT7.js → parser-I3ELUUOG.js} +8 -8
- package/dist/parser-I3ELUUOG.js.map +1 -0
- package/dist/{parser-YA7HSSPK.js → parser-IPVY56U3.js} +6 -6
- package/dist/parser-IPVY56U3.js.map +1 -0
- package/dist/pdf-ocr-EL3VSWWY.js +12 -0
- package/dist/pdf-ocr-FVLKQNAT.js +15 -0
- package/dist/pdf-ocr-VQ3QWXGE.cjs +13 -0
- package/dist/pdf-ocr-VQ3QWXGE.cjs.map +1 -0
- package/dist/{profile-io-QPIMGVO3.js → profile-io-YADU6SKH.js} +3 -3
- package/dist/{rasterize-AFYGNKXG.js → rasterize-YV5VDSQX.js} +2 -2
- package/dist/rasterize-YV5VDSQX.js.map +1 -0
- package/dist/{redact-W5K3ILQH.js → redact-7ILEAUTS.js} +2 -2
- package/dist/render-K6M3P24X.js +10 -0
- package/dist/seal-YW3U5BCY.js +10 -0
- package/dist/{setup-I4I75QJU.js → setup-GUQT5ELJ.js} +1 -1
- package/dist/setup-GUQT5ELJ.js.map +1 -0
- package/dist/{watch-D3JJEOAB.js → watch-5K2ZERXI.js} +11 -11
- package/dist/watch-5K2ZERXI.js.map +1 -0
- package/package.json +103 -101
- package/templates//352/260/204/354/235/264/352/270/260/354/225/210/353/254/270_/354/230/210/354/213/234/352/260/222.json +9 -9
- package/templates//354/235/274/353/260/230/352/270/260/354/225/210/353/254/270_/354/230/210/354/213/234/352/260/222.json +24 -24
- package/dist/chunk-3FFPHTXD.js.map +0 -1
- package/dist/chunk-5F5UCACZ.cjs.map +0 -1
- package/dist/chunk-6GBLFQMA.js.map +0 -1
- package/dist/chunk-6XPXIG57.js.map +0 -1
- package/dist/chunk-7DZPPUQD.cjs.map +0 -1
- package/dist/chunk-BPJSTJBN.js.map +0 -1
- package/dist/chunk-BYEQDLZS.js.map +0 -1
- package/dist/chunk-CD5X6UG5.js.map +0 -1
- package/dist/chunk-FUXDD36A.js.map +0 -1
- package/dist/chunk-GTPEKBN6.js.map +0 -1
- package/dist/chunk-HPRK67YB.js.map +0 -1
- package/dist/chunk-HZU7Y22R.js.map +0 -1
- package/dist/chunk-LEC2HG7A.js.map +0 -1
- package/dist/chunk-MGGU3ZRK.cjs.map +0 -1
- package/dist/chunk-O5EK52TG.js.map +0 -1
- package/dist/chunk-PV3NVBGL.js.map +0 -1
- package/dist/chunk-RO4Y4BFI.js.map +0 -1
- package/dist/chunk-SA22NK56.js.map +0 -1
- package/dist/chunk-VQB5P5KJ.cjs.map +0 -1
- package/dist/chunk-W34QSJFF.js.map +0 -1
- package/dist/chunk-YDCD4AV4.js.map +0 -1
- package/dist/chunk-YNJDNP44.js.map +0 -1
- package/dist/chunk-ZJ75YDW7.js.map +0 -1
- package/dist/chunk-ZMKTKJZN.cjs.map +0 -1
- package/dist/chunk-ZSL6MQVE.js.map +0 -1
- package/dist/chunk-ZYYTU7NY.js.map +0 -1
- package/dist/chunks-JEYQWXIZ.js +0 -10
- package/dist/formula-7ZPC54JO.js.map +0 -1
- package/dist/formula-EQRHSMYW.js.map +0 -1
- package/dist/formula-IWV5IJ3Y.cjs.map +0 -1
- package/dist/image-ocr-6MO4FXJK.js.map +0 -1
- package/dist/image-ocr-MGVXT6XD.cjs.map +0 -1
- package/dist/image-ocr-TWUU2RNG.js.map +0 -1
- package/dist/parser-JFGLN4DA.cjs.map +0 -1
- package/dist/parser-VR2BTUT7.js.map +0 -1
- package/dist/parser-YA7HSSPK.js.map +0 -1
- package/dist/pdf-ocr-4LISPZEM.cjs +0 -13
- package/dist/pdf-ocr-4LISPZEM.cjs.map +0 -1
- package/dist/pdf-ocr-AIWB2QCS.js +0 -12
- package/dist/pdf-ocr-QMOKUMC2.js +0 -15
- package/dist/rasterize-AFYGNKXG.js.map +0 -1
- package/dist/render-PSPTMZIZ.js +0 -10
- package/dist/seal-4XBJ7ISE.js +0 -10
- package/dist/setup-I4I75QJU.js.map +0 -1
- package/dist/watch-D3JJEOAB.js.map +0 -1
- /package/dist/{-RH6BEVTT.js.map → -7X4H77Z7.js.map} +0 -0
- /package/dist/{chunks-JEYQWXIZ.js.map → chunks-FMZK4QHL.js.map} +0 -0
- /package/dist/{models-6VMAVZR6.js.map → models-6SIKLKRH.js.map} +0 -0
- /package/dist/{pdf-ocr-AIWB2QCS.js.map → pdf-ocr-EL3VSWWY.js.map} +0 -0
- /package/dist/{pdf-ocr-QMOKUMC2.js.map → pdf-ocr-FVLKQNAT.js.map} +0 -0
- /package/dist/{profile-io-QPIMGVO3.js.map → profile-io-YADU6SKH.js.map} +0 -0
- /package/dist/{redact-W5K3ILQH.js.map → redact-7ILEAUTS.js.map} +0 -0
- /package/dist/{render-PSPTMZIZ.js.map → render-K6M3P24X.js.map} +0 -0
- /package/dist/{seal-4XBJ7ISE.js.map → seal-YW3U5BCY.js.map} +0 -0
package/dist/mcp.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
SIZE_KEYS,
|
|
15
15
|
SIZE_PT_RANGE,
|
|
16
16
|
buildGongmunOptions
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-5RPYBC2Q.js";
|
|
18
18
|
import {
|
|
19
19
|
BUILTIN_TEMPLATES,
|
|
20
20
|
PRESET_ALIAS,
|
|
@@ -37,25 +37,25 @@ import {
|
|
|
37
37
|
readBuiltinTemplate,
|
|
38
38
|
resolveBuiltinTemplate,
|
|
39
39
|
unknownFontWarnings
|
|
40
|
-
} from "./chunk-
|
|
41
|
-
import "./chunk-
|
|
42
|
-
import "./chunk-
|
|
40
|
+
} from "./chunk-2352RXHG.js";
|
|
41
|
+
import "./chunk-7FCNOKOR.js";
|
|
42
|
+
import "./chunk-A73RMJ6B.js";
|
|
43
43
|
import "./chunk-MOL7MDBG.js";
|
|
44
|
-
import "./chunk-
|
|
45
|
-
import "./chunk-
|
|
46
|
-
import "./chunk-
|
|
44
|
+
import "./chunk-IPOVUGXD.js";
|
|
45
|
+
import "./chunk-DZIXKL7E.js";
|
|
46
|
+
import "./chunk-7MDLAKVO.js";
|
|
47
47
|
import {
|
|
48
48
|
blocksToMarkdown
|
|
49
|
-
} from "./chunk-
|
|
50
|
-
import "./chunk-
|
|
51
|
-
import "./chunk-
|
|
49
|
+
} from "./chunk-SMPEZINI.js";
|
|
50
|
+
import "./chunk-5PXCA3DN.js";
|
|
51
|
+
import "./chunk-JGHQFUKI.js";
|
|
52
52
|
import {
|
|
53
53
|
KordocError,
|
|
54
54
|
VERSION,
|
|
55
55
|
classifyError,
|
|
56
56
|
sanitizeError,
|
|
57
57
|
toArrayBuffer
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-WA7XLWZW.js";
|
|
59
59
|
|
|
60
60
|
// src/mcp.ts
|
|
61
61
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -66,6 +66,7 @@ import { readFile, writeFile, mkdir, stat } from "fs/promises";
|
|
|
66
66
|
import { pathToFileURL } from "url";
|
|
67
67
|
import { resolve, isAbsolute, extname, dirname, basename } from "path";
|
|
68
68
|
var ALLOWED_EXTENSIONS = /* @__PURE__ */ new Set([".hwp", ".hwpx", ".hml", ".pdf", ".xls", ".xlsx", ".docx"]);
|
|
69
|
+
var PARSE_EXTENSIONS = /* @__PURE__ */ new Set([...ALLOWED_EXTENSIONS, ".png", ".jpg", ".jpeg", ".webp"]);
|
|
69
70
|
var IMAGE_EXTENSIONS = /* @__PURE__ */ new Set([".png", ".jpg", ".jpeg", ".gif", ".bmp"]);
|
|
70
71
|
var PROFILE_EXTENSIONS = /* @__PURE__ */ new Set([".json"]);
|
|
71
72
|
var MAX_FILE_SIZE = 500 * 1024 * 1024;
|
|
@@ -170,11 +171,12 @@ server.tool(
|
|
|
170
171
|
formula_ocr: z.boolean().optional().describe("PDF \uC218\uC2DD OCR \uD65C\uC131\uD654 (MFD+MFR ONNX, \uCCAB \uC0AC\uC6A9 \uC2DC \uBAA8\uB378 ~155MB \uC790\uB3D9 \uB2E4\uC6B4\uB85C\uB4DC, CLI --formula-ocr \uB300\uC751)"),
|
|
171
172
|
dedupe_running_headers: z.boolean().optional().describe("HWP5 \uB808\uC774\uC544\uC6C3 \uD45C \uD398\uC774\uC9C0 \uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 \uC911\uBCF5 \uC81C\uAC70 (\uAE30\uBCF8 off \u2014 \uBD99\uC784\uBCC4 \uC7AC\uBC88\uD638 \uC624\uC0AD\uC81C \uC8FC\uC758, CLI --dedupe-headers \uB300\uC751)"),
|
|
172
173
|
keep_trailing_empty_cols: z.boolean().optional().describe("\uD45C \uC624\uB978\uCABD \uB05D \uBE48 \uC5F4(\uC11C\uC2DD \uC785\uB825\uB780) \uBCF4\uC874 (#47, \uAE30\uBCF8 off: \uD6C4\uD589 \uBE48 \uC5F4 \uD2B8\uB9BC, CLI --keep-empty-cols \uB300\uC751)"),
|
|
173
|
-
keep_empty_paragraphs: z.boolean().optional().describe("\uBE48 \uBB38\uB2E8 \uBCF4\uC874 \u2014 \uBCF8\uBB38\uC740 \uBE48 paragraph \uBE14\uB85D, \uD45C \uC140\uC740 \uBE48 \uC904 (#57, \uAE30\uBCF8 off, CLI --keep-empty-paragraphs \uB300\uC751)")
|
|
174
|
+
keep_empty_paragraphs: z.boolean().optional().describe("\uBE48 \uBB38\uB2E8 \uBCF4\uC874 \u2014 \uBCF8\uBB38\uC740 \uBE48 paragraph \uBE14\uB85D, \uD45C \uC140\uC740 \uBE48 \uC904 (#57, \uAE30\uBCF8 off, CLI --keep-empty-paragraphs \uB300\uC751)"),
|
|
175
|
+
password: z.string().optional().describe("\uC554\uD638\uB85C \uBCF4\uD638\uB41C \uBB38\uC11C\uC758 \uC5F4\uAE30 \uC554\uD638 (#59, HWPX\xB7HWP3\xB7HWP5 \uC9C0\uC6D0. \uD30C\uC2F1\uC774 ENCRYPTED\uB85C \uC2E4\uD328\uD558\uBA74 \uC774 \uC635\uC158\uC73C\uB85C \uC7AC\uC2DC\uB3C4\uD558\uC138\uC694. \uD55C\uCEF4 DRM \uBCF4\uD638 \uBB38\uC11C\uB294 \uD574\uB2F9 \uC5C6\uC74C)")
|
|
174
176
|
},
|
|
175
|
-
async ({ file_path, ocr, remove_header_footer, formula_ocr, dedupe_running_headers, keep_trailing_empty_cols, keep_empty_paragraphs }) => {
|
|
177
|
+
async ({ file_path, ocr, remove_header_footer, formula_ocr, dedupe_running_headers, keep_trailing_empty_cols, keep_empty_paragraphs, password }) => {
|
|
176
178
|
try {
|
|
177
|
-
const { buffer, resolved } = await readValidatedFile(file_path);
|
|
179
|
+
const { buffer, resolved } = await readValidatedFile(file_path, MAX_FILE_SIZE, PARSE_EXTENSIONS);
|
|
178
180
|
const format = detectFormat(buffer);
|
|
179
181
|
if (format === "unknown") {
|
|
180
182
|
return {
|
|
@@ -189,7 +191,8 @@ server.tool(
|
|
|
189
191
|
...formula_ocr ? { formulaOcr: true } : {},
|
|
190
192
|
...dedupe_running_headers ? { dedupeRunningHeaders: true } : {},
|
|
191
193
|
...keep_trailing_empty_cols ? { keepTrailingEmptyCols: true } : {},
|
|
192
|
-
...keep_empty_paragraphs ? { keepEmptyParagraphs: true } : {}
|
|
194
|
+
...keep_empty_paragraphs ? { keepEmptyParagraphs: true } : {},
|
|
195
|
+
...password ? { password } : {}
|
|
193
196
|
});
|
|
194
197
|
if (!result.success) {
|
|
195
198
|
return {
|
|
@@ -240,13 +243,13 @@ server.tool(
|
|
|
240
243
|
},
|
|
241
244
|
async ({ file_path }) => {
|
|
242
245
|
try {
|
|
243
|
-
const resolved = safePath(file_path);
|
|
246
|
+
const resolved = safePath(file_path, PARSE_EXTENSIONS);
|
|
244
247
|
let format = detectFormatFromHeader(resolved);
|
|
245
248
|
if (format === "hwpx") {
|
|
246
|
-
const { buffer } = await readValidatedFile(file_path);
|
|
249
|
+
const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, PARSE_EXTENSIONS);
|
|
247
250
|
format = await detectZipFormat(buffer);
|
|
248
251
|
} else if (format === "hwp") {
|
|
249
|
-
const { buffer } = await readValidatedFile(file_path);
|
|
252
|
+
const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, PARSE_EXTENSIONS);
|
|
250
253
|
const ole2Format = detectOle2Format(buffer);
|
|
251
254
|
if (ole2Format !== "unknown") format = ole2Format;
|
|
252
255
|
}
|
|
@@ -269,7 +272,7 @@ server.tool(
|
|
|
269
272
|
},
|
|
270
273
|
async ({ file_path }) => {
|
|
271
274
|
try {
|
|
272
|
-
const resolved = safePath(file_path);
|
|
275
|
+
const resolved = safePath(file_path, PARSE_EXTENSIONS);
|
|
273
276
|
const format = detectFormatFromHeader(resolved);
|
|
274
277
|
if (format === "unknown") {
|
|
275
278
|
return {
|
|
@@ -277,7 +280,7 @@ server.tool(
|
|
|
277
280
|
isError: true
|
|
278
281
|
};
|
|
279
282
|
}
|
|
280
|
-
const { buffer } = await readValidatedFile(file_path, MAX_METADATA_FILE_SIZE);
|
|
283
|
+
const { buffer } = await readValidatedFile(file_path, MAX_METADATA_FILE_SIZE, PARSE_EXTENSIONS);
|
|
281
284
|
let metadata;
|
|
282
285
|
let effectiveFormat = format;
|
|
283
286
|
if (format === "hwpx") {
|
|
@@ -295,7 +298,7 @@ server.tool(
|
|
|
295
298
|
break;
|
|
296
299
|
case "pdf":
|
|
297
300
|
try {
|
|
298
|
-
const { extractPdfMetadataOnly } = await import("./parser-
|
|
301
|
+
const { extractPdfMetadataOnly } = await import("./parser-I3ELUUOG.js");
|
|
299
302
|
metadata = await extractPdfMetadataOnly(buffer);
|
|
300
303
|
} catch {
|
|
301
304
|
metadata = void 0;
|
|
@@ -334,8 +337,8 @@ server.tool(
|
|
|
334
337
|
},
|
|
335
338
|
async ({ file_path, pages }) => {
|
|
336
339
|
try {
|
|
337
|
-
const resolved = safePath(file_path);
|
|
338
|
-
const { buffer } = await readValidatedFile(file_path);
|
|
340
|
+
const resolved = safePath(file_path, PARSE_EXTENSIONS);
|
|
341
|
+
const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, PARSE_EXTENSIONS);
|
|
339
342
|
const format = detectFormat(buffer);
|
|
340
343
|
if (format === "unknown") {
|
|
341
344
|
return {
|
|
@@ -377,7 +380,7 @@ server.tool(
|
|
|
377
380
|
},
|
|
378
381
|
async ({ file_path, table_index }) => {
|
|
379
382
|
try {
|
|
380
|
-
const { buffer } = await readValidatedFile(file_path);
|
|
383
|
+
const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, PARSE_EXTENSIONS);
|
|
381
384
|
const format = detectFormat(buffer);
|
|
382
385
|
if (format === "unknown") {
|
|
383
386
|
return {
|
|
@@ -676,7 +679,7 @@ server.tool(
|
|
|
676
679
|
}
|
|
677
680
|
const image = new Uint8Array(await readFile(imgResolved));
|
|
678
681
|
const ext = extname(imgResolved).slice(1).toLowerCase();
|
|
679
|
-
const { placeSealHwpx } = await import("./seal-
|
|
682
|
+
const { placeSealHwpx } = await import("./seal-YW3U5BCY.js");
|
|
680
683
|
const result = await placeSealHwpx(buffer, [{
|
|
681
684
|
anchor,
|
|
682
685
|
occurrence,
|
|
@@ -778,7 +781,7 @@ server.tool(
|
|
|
778
781
|
}
|
|
779
782
|
const outPath = output_path ? safeOutputPath(output_path, /* @__PURE__ */ new Set([format === "png" ? ".png" : ".svg"])) : void 0;
|
|
780
783
|
const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx"]));
|
|
781
|
-
const { renderHwpxToSvg } = await import("./render-
|
|
784
|
+
const { renderHwpxToSvg } = await import("./render-K6M3P24X.js");
|
|
782
785
|
const result = await renderHwpxToSvg(buffer, { highlights, reflow: true, reflowMode: reflow_mode });
|
|
783
786
|
const summary = [
|
|
784
787
|
`\uB80C\uB354 \uC644\uB8CC: ${result.pageCount}\uD398\uC774\uC9C0, ${Math.round(result.width)}x${Math.round(result.height)}pt (\uD14D\uC2A4\uD2B8 ${result.stats.texts}\xB7\uC774\uBBF8\uC9C0 ${result.stats.images}\xB7\uD45C ${result.stats.tables})`,
|
|
@@ -790,7 +793,7 @@ server.tool(
|
|
|
790
793
|
summary.push(`\uC800\uC7A5: ${outPath}`);
|
|
791
794
|
return { content: [{ type: "text", text: summary.join("\n") }] };
|
|
792
795
|
}
|
|
793
|
-
const { rasterizeSvg } = await import("./rasterize-
|
|
796
|
+
const { rasterizeSvg } = await import("./rasterize-YV5VDSQX.js");
|
|
794
797
|
const raster = await rasterizeSvg(result.svg, result.width, result.height);
|
|
795
798
|
if (outPath) {
|
|
796
799
|
await mkdir(dirname(outPath), { recursive: true });
|
|
@@ -835,7 +838,7 @@ server.tool(
|
|
|
835
838
|
if (!parsed.success) {
|
|
836
839
|
return { content: [{ type: "text", text: `\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}` }], isError: true };
|
|
837
840
|
}
|
|
838
|
-
const { redactMarkdown } = await import("./redact-
|
|
841
|
+
const { redactMarkdown } = await import("./redact-7ILEAUTS.js");
|
|
839
842
|
const r = redactMarkdown(parsed.markdown, { rules, maskChar: mask_char });
|
|
840
843
|
const byRule = /* @__PURE__ */ new Map();
|
|
841
844
|
for (const h of r.hits) byRule.set(h.rule, (byRule.get(h.rule) ?? 0) + 1);
|
|
@@ -883,12 +886,12 @@ server.tool(
|
|
|
883
886
|
},
|
|
884
887
|
async ({ file_path, granularity, include_table_cells }) => {
|
|
885
888
|
try {
|
|
886
|
-
const { buffer } = await readValidatedFile(file_path);
|
|
889
|
+
const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, PARSE_EXTENSIONS);
|
|
887
890
|
const parsed = await parse(buffer, { filePath: file_path });
|
|
888
891
|
if (!parsed.success) {
|
|
889
892
|
return { content: [{ type: "text", text: `\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}` }], isError: true };
|
|
890
893
|
}
|
|
891
|
-
const { blocksToChunks } = await import("./chunks-
|
|
894
|
+
const { blocksToChunks } = await import("./chunks-FMZK4QHL.js");
|
|
892
895
|
const chunks = blocksToChunks(parsed.blocks, { granularity, includeTableCells: include_table_cells });
|
|
893
896
|
return { content: [{ type: "text", text: capResponseText(JSON.stringify(chunks, null, 2)) }] };
|
|
894
897
|
} catch (err) {
|
|
@@ -907,7 +910,7 @@ server.tool(
|
|
|
907
910
|
try {
|
|
908
911
|
const out = safeOutputPath(output_path, PROFILE_EXTENSIONS);
|
|
909
912
|
const { buffer } = await readValidatedFile(hwpx_path);
|
|
910
|
-
const { hwpxToProfile } = await import("./-
|
|
913
|
+
const { hwpxToProfile } = await import("./-7X4H77Z7.js");
|
|
911
914
|
const profile = await hwpxToProfile(buffer);
|
|
912
915
|
await mkdir(dirname(out), { recursive: true });
|
|
913
916
|
await writeFile(out, JSON.stringify(profile, null, 2));
|
|
@@ -990,7 +993,7 @@ server.tool(
|
|
|
990
993
|
}
|
|
991
994
|
let profile;
|
|
992
995
|
if (profile_path) {
|
|
993
|
-
const { parseFormatProfileJson } = await import("./profile-io-
|
|
996
|
+
const { parseFormatProfileJson } = await import("./profile-io-YADU6SKH.js");
|
|
994
997
|
profile = parseFormatProfileJson(await readFile(safePath(profile_path, PROFILE_EXTENSIONS), "utf-8"));
|
|
995
998
|
}
|
|
996
999
|
const out = safeOutputPath(output_path, /* @__PURE__ */ new Set([".hwpx"]));
|
|
@@ -1036,6 +1039,7 @@ if (autoStart) startMcpServer().catch((err) => {
|
|
|
1036
1039
|
export {
|
|
1037
1040
|
ALLOWED_EXTENSIONS,
|
|
1038
1041
|
IMAGE_EXTENSIONS,
|
|
1042
|
+
PARSE_EXTENSIONS,
|
|
1039
1043
|
PROFILE_EXTENSIONS,
|
|
1040
1044
|
buildFillInputs,
|
|
1041
1045
|
capResponseText,
|