kordoc 4.7.1 → 4.7.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/README.md +19 -1
- package/dist/{-O42BMYNX.js → -WYNJOQ6P.js} +9 -9
- package/dist/{chunk-PLEGO474.js → chunk-3NKSSL44.js} +3 -3
- package/dist/{chunk-UZB3UGC5.js → chunk-3P5YCJQE.js} +2 -2
- package/dist/{chunk-IZEUWEEY.js → chunk-46F5RMU7.js} +3 -11
- package/dist/chunk-46F5RMU7.js.map +1 -0
- package/dist/{chunk-UAFSPWU7.js → chunk-4HZN7EZZ.js} +8 -1
- package/dist/chunk-4HZN7EZZ.js.map +1 -0
- package/dist/{chunk-4VNUQYUE.js → chunk-4KGGVCYX.js} +1 -1
- package/dist/chunk-4KGGVCYX.js.map +1 -0
- package/dist/{chunk-AFX6ZXER.js → chunk-CGJDCZA3.js} +2 -2
- package/dist/{chunk-DJKLOLBT.cjs → chunk-E6DONLTM.cjs} +3 -11
- package/dist/chunk-E6DONLTM.cjs.map +1 -0
- package/dist/chunk-EV53YE3W.cjs +11 -0
- package/dist/chunk-EV53YE3W.cjs.map +1 -0
- package/dist/{chunk-3H5X63BQ.js → chunk-HJV4BVQI.js} +27 -1
- package/dist/chunk-HJV4BVQI.js.map +1 -0
- package/dist/{chunk-J3W6Q3AX.js → chunk-IMFIACHP.js} +2 -2
- package/dist/{chunk-BQENBAUC.js → chunk-JKJEBDP7.js} +3 -3
- package/dist/{chunk-ZDWP3LLY.cjs → chunk-KE6DLZAW.cjs} +12 -10
- package/dist/chunk-KE6DLZAW.cjs.map +1 -0
- package/dist/{chunk-YWDN5PQC.js → chunk-KEGAEHWO.js} +2 -2
- package/dist/chunk-KSATSTC5.js +11 -0
- package/dist/chunk-KSATSTC5.js.map +1 -0
- package/dist/{chunk-3UIT4PPQ.js → chunk-LMHVMGEC.js} +5 -3
- package/dist/{chunk-3UIT4PPQ.js.map → chunk-LMHVMGEC.js.map} +1 -1
- package/dist/{chunk-VECVLIWE.js → chunk-NYLYIN55.js} +3 -3
- package/dist/{chunk-IMEMTJ76.js → chunk-P663PYWV.js} +2 -2
- package/dist/{chunk-ZV5OKQ3Z.cjs → chunk-QETZP25M.cjs} +28 -2
- package/dist/chunk-QETZP25M.cjs.map +1 -0
- package/dist/{chunk-TZ3WCAJZ.cjs → chunk-QGATKC4R.cjs} +6 -6
- package/dist/{chunk-TZ3WCAJZ.cjs.map → chunk-QGATKC4R.cjs.map} +1 -1
- package/dist/{chunk-USGC3ZKU.cjs → chunk-R4LXZRYP.cjs} +4 -4
- package/dist/{chunk-USGC3ZKU.cjs.map → chunk-R4LXZRYP.cjs.map} +1 -1
- package/dist/chunk-RQVFFSAO.js +52 -0
- package/dist/chunk-RQVFFSAO.js.map +1 -0
- package/dist/{chunk-GZDOWYJM.js → chunk-TXQQ7URG.js} +2 -2
- package/dist/{chunk-7ZIOZ6PU.js → chunk-VZ3AQVBN.js} +8 -3
- package/dist/chunk-VZ3AQVBN.js.map +1 -0
- package/dist/{chunk-5KPNXBNR.js → chunk-W5NZYPRQ.js} +386 -80
- package/dist/chunk-W5NZYPRQ.js.map +1 -0
- package/dist/{chunk-JEX5P66D.js → chunk-XOO6YEZE.js} +3 -3
- package/dist/{chunk-6663UXPE.js → chunk-Y7T5Z4DC.js} +3 -3
- package/dist/chunks-LWAOHTK2.js +10 -0
- package/dist/cli.js +57 -21
- package/dist/cli.js.map +1 -1
- package/dist/{formula-JLYS73QL.js → formula-IFKZZPD2.js} +4 -2
- package/dist/{formula-LIVQSCMM.js.map → formula-IFKZZPD2.js.map} +1 -1
- package/dist/{formula-CG4S7TWO.cjs → formula-PDMZMBIP.cjs} +9 -8
- package/dist/formula-PDMZMBIP.cjs.map +1 -0
- package/dist/{formula-LIVQSCMM.js → formula-V6EAYHMF.js} +3 -2
- package/dist/{image-ocr-MKD6MKWO.cjs → image-ocr-75WGMVU6.cjs} +12 -11
- package/dist/image-ocr-75WGMVU6.cjs.map +1 -0
- package/dist/{image-ocr-5QRZBNOF.js → image-ocr-B7TMIG3F.js} +10 -9
- package/dist/{image-ocr-5QRZBNOF.js.map → image-ocr-B7TMIG3F.js.map} +1 -1
- package/dist/{image-ocr-TAJHRZ5T.js → image-ocr-XHBZONFZ.js} +6 -5
- package/dist/{image-ocr-TAJHRZ5T.js.map → image-ocr-XHBZONFZ.js.map} +1 -1
- package/dist/index.cjs +865 -552
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +390 -77
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +36 -18
- package/dist/mcp.js.map +1 -1
- package/dist/model-bundle-Q4HQXJQG.js +104 -0
- package/dist/model-bundle-Q4HQXJQG.js.map +1 -0
- package/dist/{models-6SIKLKRH.js → models-QQA7OQHY.js} +5 -3
- package/dist/{parser-SWY4RKGD.cjs → parser-4CBOPTVY.cjs} +28 -27
- package/dist/parser-4CBOPTVY.cjs.map +1 -0
- package/dist/{parser-UMFBJG2D.js → parser-HT7GZOF2.js} +8 -8
- package/dist/{parser-RCEHB2EV.js.map → parser-HT7GZOF2.js.map} +1 -1
- package/dist/{parser-RCEHB2EV.js → parser-Z36MZUHS.js} +8 -7
- package/dist/{parser-UMFBJG2D.js.map → parser-Z36MZUHS.js.map} +1 -1
- package/dist/pdf-ocr-6ZNGDVC6.cjs +14 -0
- package/dist/pdf-ocr-6ZNGDVC6.cjs.map +1 -0
- package/dist/pdf-ocr-NTXRJI4T.js +13 -0
- package/dist/pdf-ocr-TYMCEUPH.js +16 -0
- package/dist/{profile-io-HT62OAEU.js → profile-io-ACYRLCSR.js} +3 -3
- package/dist/{rasterize-GL67HQC7.js → rasterize-QYCLEH2J.js} +2 -2
- package/dist/render-5Y2US4IM.js +10 -0
- package/dist/seal-VU6JS2QD.js +10 -0
- package/dist/{setup-GUQT5ELJ.js → setup-MG3YYKXU.js} +30 -7
- package/dist/setup-MG3YYKXU.js.map +1 -0
- package/dist/{watch-5ST75Q7Q.js → watch-AZIY6AWC.js} +13 -9
- package/dist/watch-AZIY6AWC.js.map +1 -0
- package/package.json +7 -3
- package/dist/chunk-3H5X63BQ.js.map +0 -1
- package/dist/chunk-4VNUQYUE.js.map +0 -1
- package/dist/chunk-5KPNXBNR.js.map +0 -1
- package/dist/chunk-7ZIOZ6PU.js.map +0 -1
- package/dist/chunk-DJKLOLBT.cjs.map +0 -1
- package/dist/chunk-IZEUWEEY.js.map +0 -1
- package/dist/chunk-UAFSPWU7.js.map +0 -1
- package/dist/chunk-ZDWP3LLY.cjs.map +0 -1
- package/dist/chunk-ZV5OKQ3Z.cjs.map +0 -1
- package/dist/chunks-C7DJL4RE.js +0 -10
- package/dist/formula-CG4S7TWO.cjs.map +0 -1
- package/dist/image-ocr-MKD6MKWO.cjs.map +0 -1
- package/dist/parser-SWY4RKGD.cjs.map +0 -1
- package/dist/pdf-ocr-3NTV3MYP.js +0 -12
- package/dist/pdf-ocr-7BOO4JA7.js +0 -15
- package/dist/pdf-ocr-JDHELYBY.cjs +0 -13
- package/dist/pdf-ocr-JDHELYBY.cjs.map +0 -1
- package/dist/render-IQ4IZLY4.js +0 -10
- package/dist/seal-AGSZ6MUR.js +0 -10
- package/dist/setup-GUQT5ELJ.js.map +0 -1
- package/dist/watch-5ST75Q7Q.js.map +0 -1
- /package/dist/{-O42BMYNX.js.map → -WYNJOQ6P.js.map} +0 -0
- /package/dist/{chunk-PLEGO474.js.map → chunk-3NKSSL44.js.map} +0 -0
- /package/dist/{chunk-UZB3UGC5.js.map → chunk-3P5YCJQE.js.map} +0 -0
- /package/dist/{chunk-AFX6ZXER.js.map → chunk-CGJDCZA3.js.map} +0 -0
- /package/dist/{chunk-J3W6Q3AX.js.map → chunk-IMFIACHP.js.map} +0 -0
- /package/dist/{chunk-BQENBAUC.js.map → chunk-JKJEBDP7.js.map} +0 -0
- /package/dist/{chunk-YWDN5PQC.js.map → chunk-KEGAEHWO.js.map} +0 -0
- /package/dist/{chunk-VECVLIWE.js.map → chunk-NYLYIN55.js.map} +0 -0
- /package/dist/{chunk-IMEMTJ76.js.map → chunk-P663PYWV.js.map} +0 -0
- /package/dist/{chunk-GZDOWYJM.js.map → chunk-TXQQ7URG.js.map} +0 -0
- /package/dist/{chunk-JEX5P66D.js.map → chunk-XOO6YEZE.js.map} +0 -0
- /package/dist/{chunk-6663UXPE.js.map → chunk-Y7T5Z4DC.js.map} +0 -0
- /package/dist/{chunks-C7DJL4RE.js.map → chunks-LWAOHTK2.js.map} +0 -0
- /package/dist/{formula-JLYS73QL.js.map → formula-V6EAYHMF.js.map} +0 -0
- /package/dist/{models-6SIKLKRH.js.map → models-QQA7OQHY.js.map} +0 -0
- /package/dist/{pdf-ocr-3NTV3MYP.js.map → pdf-ocr-NTXRJI4T.js.map} +0 -0
- /package/dist/{pdf-ocr-7BOO4JA7.js.map → pdf-ocr-TYMCEUPH.js.map} +0 -0
- /package/dist/{profile-io-HT62OAEU.js.map → profile-io-ACYRLCSR.js.map} +0 -0
- /package/dist/{rasterize-GL67HQC7.js.map → rasterize-QYCLEH2J.js.map} +0 -0
- /package/dist/{render-IQ4IZLY4.js.map → render-5Y2US4IM.js.map} +0 -0
- /package/dist/{seal-AGSZ6MUR.js.map → seal-VU6JS2QD.js.map} +0 -0
package/dist/mcp.js
CHANGED
|
@@ -37,25 +37,30 @@ import {
|
|
|
37
37
|
readBuiltinTemplate,
|
|
38
38
|
resolveBuiltinTemplate,
|
|
39
39
|
unknownFontWarnings
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-W5NZYPRQ.js";
|
|
41
41
|
import "./chunk-7FCNOKOR.js";
|
|
42
|
-
import "./chunk-
|
|
42
|
+
import "./chunk-4KGGVCYX.js";
|
|
43
43
|
import "./chunk-MOL7MDBG.js";
|
|
44
|
-
import "./chunk-
|
|
44
|
+
import "./chunk-NYLYIN55.js";
|
|
45
45
|
import "./chunk-DZIXKL7E.js";
|
|
46
|
-
import "./chunk-
|
|
46
|
+
import "./chunk-CGJDCZA3.js";
|
|
47
47
|
import {
|
|
48
48
|
blocksToMarkdown
|
|
49
|
-
} from "./chunk-
|
|
50
|
-
import "./chunk-
|
|
51
|
-
import "./chunk-
|
|
49
|
+
} from "./chunk-KEGAEHWO.js";
|
|
50
|
+
import "./chunk-XOO6YEZE.js";
|
|
51
|
+
import "./chunk-VZ3AQVBN.js";
|
|
52
|
+
import {
|
|
53
|
+
assertWithinRoot,
|
|
54
|
+
getAccessRoot,
|
|
55
|
+
isOfflineMode
|
|
56
|
+
} from "./chunk-RQVFFSAO.js";
|
|
52
57
|
import {
|
|
53
58
|
KordocError,
|
|
54
59
|
VERSION,
|
|
55
60
|
classifyError,
|
|
56
61
|
sanitizeError,
|
|
57
62
|
toArrayBuffer
|
|
58
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-IMFIACHP.js";
|
|
59
64
|
|
|
60
65
|
// src/mcp.ts
|
|
61
66
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -82,6 +87,7 @@ function safePath(filePath, allowedExts = ALLOWED_EXTENSIONS) {
|
|
|
82
87
|
throw new KordocError(`\uACBD\uB85C \uCC98\uB9AC \uC624\uB958 [${err?.code ?? "UNKNOWN"}]`);
|
|
83
88
|
}
|
|
84
89
|
if (!isAbsolute(real)) throw new KordocError("\uC808\uB300 \uACBD\uB85C\uB9CC \uD5C8\uC6A9\uB429\uB2C8\uB2E4");
|
|
90
|
+
assertWithinRoot(real);
|
|
85
91
|
const ext = extname(real).toLowerCase();
|
|
86
92
|
if (!allowedExts.has(ext)) throw new KordocError(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uD655\uC7A5\uC790\uC785\uB2C8\uB2E4: ${ext} (\uD5C8\uC6A9: ${[...allowedExts].join(", ")})`);
|
|
87
93
|
return real;
|
|
@@ -95,12 +101,16 @@ function safeOutputPath(outputPath, allowedExts) {
|
|
|
95
101
|
}
|
|
96
102
|
const parent = dirname(resolved);
|
|
97
103
|
if (existsSync(parent)) {
|
|
104
|
+
let real;
|
|
98
105
|
try {
|
|
99
|
-
|
|
106
|
+
real = resolve(realpathSync(parent), basename(resolved));
|
|
100
107
|
} catch (err) {
|
|
101
108
|
throw new KordocError(`\uCD9C\uB825 \uACBD\uB85C \uCC98\uB9AC \uC624\uB958 [${err?.code ?? "UNKNOWN"}]: ${parent}`);
|
|
102
109
|
}
|
|
110
|
+
assertWithinRoot(real);
|
|
111
|
+
return real;
|
|
103
112
|
}
|
|
113
|
+
assertWithinRoot(resolved);
|
|
104
114
|
return resolved;
|
|
105
115
|
}
|
|
106
116
|
function describeError(err) {
|
|
@@ -300,7 +310,7 @@ server.tool(
|
|
|
300
310
|
break;
|
|
301
311
|
case "pdf":
|
|
302
312
|
try {
|
|
303
|
-
const { extractPdfMetadataOnly } = await import("./parser-
|
|
313
|
+
const { extractPdfMetadataOnly } = await import("./parser-HT7GZOF2.js");
|
|
304
314
|
metadata = await extractPdfMetadataOnly(buffer);
|
|
305
315
|
} catch {
|
|
306
316
|
metadata = void 0;
|
|
@@ -332,7 +342,7 @@ server.tool(
|
|
|
332
342
|
);
|
|
333
343
|
server.tool(
|
|
334
344
|
"parse_pages",
|
|
335
|
-
"\uBB38\uC11C\uC758 \uD2B9\uC815 \uD398\uC774\uC9C0
|
|
345
|
+
"\uBB38\uC11C\uC758 \uD2B9\uC815 \uD398\uC774\uC9C0 \uBC94\uC704\uB9CC \uD30C\uC2F1\uD569\uB2C8\uB2E4. PDF\uC640 \uD55C\uCEF4 \uC800\uC7A5\uBCF8 HWP/HWPX\uB294 \uC2E4\uC81C \uD398\uC774\uC9C0 \uAE30\uC900(metadata.pageMode=layout), \uC870\uD310 \uCE90\uC2DC\uAC00 \uC5C6\uB294 \uC0DD\uC131 \uD30C\uC77C\uC740 \uC139\uC158 \uB2E8\uC704 \uADFC\uC0AC(pageMode=section)\uC785\uB2C8\uB2E4.",
|
|
336
346
|
{
|
|
337
347
|
file_path: z.string().min(1).describe("\uD30C\uC2F1\uD560 \uBB38\uC11C \uD30C\uC77C\uC758 \uC808\uB300 \uACBD\uB85C"),
|
|
338
348
|
pages: z.string().min(1).describe("\uD398\uC774\uC9C0 \uBC94\uC704 (\uC608: '1-3', '1,3,5-7')")
|
|
@@ -358,7 +368,8 @@ server.tool(
|
|
|
358
368
|
const meta = [
|
|
359
369
|
`\uD3EC\uB9F7: ${result.fileType.toUpperCase()}`,
|
|
360
370
|
`\uBC94\uC704: ${pages}`,
|
|
361
|
-
result.pageCount ? `\uD398\uC774\uC9C0: ${result.pageCount}` : null
|
|
371
|
+
result.pageCount ? `\uD398\uC774\uC9C0: ${result.pageCount}` : null,
|
|
372
|
+
result.metadata?.pageMode === "section" ? "\uAE30\uC900: \uC139\uC158 \uADFC\uC0AC" : null
|
|
362
373
|
].filter(Boolean).join(" | ");
|
|
363
374
|
return {
|
|
364
375
|
content: [{ type: "text", text: `[${meta}]
|
|
@@ -681,7 +692,7 @@ server.tool(
|
|
|
681
692
|
}
|
|
682
693
|
const image = new Uint8Array(await readFile(imgResolved));
|
|
683
694
|
const ext = extname(imgResolved).slice(1).toLowerCase();
|
|
684
|
-
const { placeSealHwpx } = await import("./seal-
|
|
695
|
+
const { placeSealHwpx } = await import("./seal-VU6JS2QD.js");
|
|
685
696
|
const result = await placeSealHwpx(buffer, [{
|
|
686
697
|
anchor,
|
|
687
698
|
occurrence,
|
|
@@ -783,7 +794,7 @@ server.tool(
|
|
|
783
794
|
}
|
|
784
795
|
const outPath = output_path ? safeOutputPath(output_path, /* @__PURE__ */ new Set([format === "png" ? ".png" : ".svg"])) : void 0;
|
|
785
796
|
const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx"]));
|
|
786
|
-
const { renderHwpxToSvg } = await import("./render-
|
|
797
|
+
const { renderHwpxToSvg } = await import("./render-5Y2US4IM.js");
|
|
787
798
|
const result = await renderHwpxToSvg(buffer, { highlights, reflow: true, reflowMode: reflow_mode });
|
|
788
799
|
const summary = [
|
|
789
800
|
`\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})`,
|
|
@@ -795,7 +806,7 @@ server.tool(
|
|
|
795
806
|
summary.push(`\uC800\uC7A5: ${outPath}`);
|
|
796
807
|
return { content: [{ type: "text", text: summary.join("\n") }] };
|
|
797
808
|
}
|
|
798
|
-
const { rasterizeSvg } = await import("./rasterize-
|
|
809
|
+
const { rasterizeSvg } = await import("./rasterize-QYCLEH2J.js");
|
|
799
810
|
const raster = await rasterizeSvg(result.svg, result.width, result.height);
|
|
800
811
|
if (outPath) {
|
|
801
812
|
await mkdir(dirname(outPath), { recursive: true });
|
|
@@ -893,7 +904,7 @@ server.tool(
|
|
|
893
904
|
if (!parsed.success) {
|
|
894
905
|
return { content: [{ type: "text", text: `\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}` }], isError: true };
|
|
895
906
|
}
|
|
896
|
-
const { blocksToChunks } = await import("./chunks-
|
|
907
|
+
const { blocksToChunks } = await import("./chunks-LWAOHTK2.js");
|
|
897
908
|
const chunks = blocksToChunks(parsed.blocks, { granularity, includeTableCells: include_table_cells });
|
|
898
909
|
return { content: [{ type: "text", text: capResponseText(JSON.stringify(chunks, null, 2)) }] };
|
|
899
910
|
} catch (err) {
|
|
@@ -912,7 +923,7 @@ server.tool(
|
|
|
912
923
|
try {
|
|
913
924
|
const out = safeOutputPath(output_path, PROFILE_EXTENSIONS);
|
|
914
925
|
const { buffer } = await readValidatedFile(hwpx_path);
|
|
915
|
-
const { hwpxToProfile } = await import("./-
|
|
926
|
+
const { hwpxToProfile } = await import("./-WYNJOQ6P.js");
|
|
916
927
|
const profile = await hwpxToProfile(buffer);
|
|
917
928
|
await mkdir(dirname(out), { recursive: true });
|
|
918
929
|
await writeFile(out, JSON.stringify(profile, null, 2));
|
|
@@ -1001,7 +1012,7 @@ server.tool(
|
|
|
1001
1012
|
}
|
|
1002
1013
|
let profile;
|
|
1003
1014
|
if (profile_path) {
|
|
1004
|
-
const { parseFormatProfileJson } = await import("./profile-io-
|
|
1015
|
+
const { parseFormatProfileJson } = await import("./profile-io-ACYRLCSR.js");
|
|
1005
1016
|
profile = parseFormatProfileJson(await readFile(safePath(profile_path, PROFILE_EXTENSIONS), "utf-8"));
|
|
1006
1017
|
}
|
|
1007
1018
|
const out = safeOutputPath(output_path, /* @__PURE__ */ new Set([".hwpx"]));
|
|
@@ -1015,6 +1026,7 @@ server.tool(
|
|
|
1015
1026
|
let images;
|
|
1016
1027
|
if (image_dir) {
|
|
1017
1028
|
const dir = await realpath(resolve(image_dir));
|
|
1029
|
+
assertWithinRoot(dir);
|
|
1018
1030
|
for (const m of markdown.matchAll(/!\[[^\]]*\]\(([^)\s]+)\)/g)) {
|
|
1019
1031
|
const url = m[1];
|
|
1020
1032
|
if (!/^[A-Za-z0-9._-]+\.[A-Za-z0-9]+$/.test(url) || url.includes("..")) continue;
|
|
@@ -1056,6 +1068,12 @@ var serverStarted = false;
|
|
|
1056
1068
|
async function startMcpServer() {
|
|
1057
1069
|
if (serverStarted) return;
|
|
1058
1070
|
serverStarted = true;
|
|
1071
|
+
const root = getAccessRoot();
|
|
1072
|
+
if (isOfflineMode() || root) {
|
|
1073
|
+
const flags = [isOfflineMode() ? "offline" : null, root ? `root=${root}` : null].filter(Boolean);
|
|
1074
|
+
process.stderr.write(`[kordoc-mcp] \uC81C\uD55C \uBAA8\uB4DC: ${flags.join(", ")}
|
|
1075
|
+
`);
|
|
1076
|
+
}
|
|
1059
1077
|
const transport = new StdioServerTransport();
|
|
1060
1078
|
await server.connect(transport);
|
|
1061
1079
|
}
|