kordoc 4.7.0 → 4.7.2
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 +14 -0
- package/dist/{-MK2223RL.js → -CVPGGSAB.js} +9 -9
- package/dist/{chunk-W5KRKBYR.cjs → chunk-46VU6YXF.cjs} +13 -7
- package/dist/chunk-46VU6YXF.cjs.map +1 -0
- package/dist/{chunk-MVTX6ODZ.js → chunk-4VNUQYUE.js} +1 -1
- package/dist/chunk-4VNUQYUE.js.map +1 -0
- package/dist/{chunk-GIWKBPII.js → chunk-7CWNBDWQ.js} +5 -3
- package/dist/{chunk-GIWKBPII.js.map → chunk-7CWNBDWQ.js.map} +1 -1
- package/dist/{chunk-XZDJXYUC.js → chunk-BSWJCSG7.js} +2 -2
- package/dist/chunk-DCZVOIEO.cjs.map +1 -1
- package/dist/{chunk-TUU535RB.cjs → chunk-DZBMQC2N.cjs} +3 -11
- package/dist/chunk-DZBMQC2N.cjs.map +1 -0
- package/dist/{chunk-C27PPXRZ.cjs → chunk-E2XTVK7H.cjs} +12 -10
- package/dist/chunk-E2XTVK7H.cjs.map +1 -0
- package/dist/{chunk-PV2EXXGI.js → chunk-FJBOVJAG.js} +3 -3
- package/dist/{chunk-P2NWNJMR.js → chunk-GLZMUKYL.js} +3 -3
- package/dist/chunk-GS7T56RP.cjs.map +1 -1
- package/dist/chunk-I4TP7HYB.js +11 -0
- package/dist/chunk-I4TP7HYB.js.map +1 -0
- package/dist/{chunk-GZDOWYJM.js → chunk-IMY4LQ3J.js} +2 -2
- package/dist/{chunk-IDHBO6AG.js → chunk-IN2AOMX6.js} +3 -3
- package/dist/{chunk-PEVPKD6Z.js → chunk-IVSEGHI2.js} +3 -3
- package/dist/{chunk-YUVKU5CW.js → chunk-JMWBMGNH.js} +3 -11
- package/dist/chunk-JMWBMGNH.js.map +1 -0
- package/dist/{chunk-AFPD74JJ.js → chunk-LJW5EQXS.js} +2 -2
- package/dist/{chunk-YXXHH6WC.js → chunk-O4VLHQVG.js} +2 -2
- package/dist/{chunk-3VTMSSDW.js → chunk-P7HPLWEP.js} +11 -5
- package/dist/chunk-P7HPLWEP.js.map +1 -0
- package/dist/{chunk-BCG2PKQU.js → chunk-PGDJUJ4L.js} +11 -5
- package/dist/chunk-PGDJUJ4L.js.map +1 -0
- package/dist/{chunk-ZV5OKQ3Z.cjs → chunk-PV6WSN6E.cjs} +28 -2
- package/dist/chunk-PV6WSN6E.cjs.map +1 -0
- package/dist/{chunk-UAFSPWU7.js → chunk-QKHN7LEV.js} +8 -1
- package/dist/chunk-QKHN7LEV.js.map +1 -0
- package/dist/{chunk-6PIR74EA.js → chunk-QXC5NPO2.js} +26 -14
- package/dist/chunk-QXC5NPO2.js.map +1 -0
- package/dist/chunk-TYIFZT5H.js +52 -0
- package/dist/chunk-TYIFZT5H.js.map +1 -0
- package/dist/chunk-URTDBXV6.cjs +11 -0
- package/dist/chunk-URTDBXV6.cjs.map +1 -0
- package/dist/{chunk-AEYNY6FG.js → chunk-VEBTOI3I.js} +3 -3
- package/dist/{chunk-ZYVULRYF.js → chunk-VXB52EWX.js} +2 -2
- package/dist/{chunk-3H5X63BQ.js → chunk-Y3VDFFAW.js} +27 -1
- package/dist/chunk-Y3VDFFAW.js.map +1 -0
- package/dist/{chunk-5QTHHQQE.cjs → chunk-YU3PLOX4.cjs} +6 -6
- package/dist/chunk-YU3PLOX4.cjs.map +1 -0
- package/dist/chunks-RNP6VLGK.js +10 -0
- package/dist/cli.js +56 -20
- package/dist/cli.js.map +1 -1
- package/dist/{formula-CG4S7TWO.cjs → formula-7D3MLOSV.cjs} +9 -8
- package/dist/formula-7D3MLOSV.cjs.map +1 -0
- package/dist/{formula-LIVQSCMM.js → formula-GHGK7T3S.js} +3 -2
- package/dist/{formula-JLYS73QL.js → formula-RTGCS55B.js} +4 -2
- package/dist/{formula-LIVQSCMM.js.map → formula-RTGCS55B.js.map} +1 -1
- package/dist/{image-ocr-4MHEX4MN.js → image-ocr-2UMWFGRS.js} +10 -9
- package/dist/{image-ocr-4MHEX4MN.js.map → image-ocr-2UMWFGRS.js.map} +1 -1
- package/dist/{image-ocr-OB5PCQUU.cjs → image-ocr-PRI2JKDW.cjs} +12 -11
- package/dist/image-ocr-PRI2JKDW.cjs.map +1 -0
- package/dist/{image-ocr-3A3HZX6O.js → image-ocr-TQ5THN35.js} +6 -5
- package/dist/{image-ocr-3A3HZX6O.js.map → image-ocr-TQ5THN35.js.map} +1 -1
- package/dist/index.cjs +481 -467
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +24 -10
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +33 -16
- package/dist/mcp.js.map +1 -1
- package/dist/model-bundle-5RLZV7P2.js +104 -0
- package/dist/model-bundle-5RLZV7P2.js.map +1 -0
- package/dist/{models-6SIKLKRH.js → models-RSHR2BY7.js} +5 -3
- package/dist/page-range-P7SDW6LR.cjs.map +1 -1
- package/dist/{parser-EQN4YKU4.js → parser-FXEIK3VJ.js} +51 -7
- package/dist/parser-FXEIK3VJ.js.map +1 -0
- package/dist/{parser-EIVCD4NS.js → parser-QPMTNRPU.js} +51 -8
- package/dist/parser-QPMTNRPU.js.map +1 -0
- package/dist/{parser-VACM3DFR.cjs → parser-SCQ7NJUJ.cjs} +71 -27
- package/dist/parser-SCQ7NJUJ.cjs.map +1 -0
- package/dist/pdf-ocr-HPRM24SP.js +16 -0
- package/dist/pdf-ocr-I6DISTBR.js +13 -0
- package/dist/pdf-ocr-JNWL65YW.cjs +14 -0
- package/dist/pdf-ocr-JNWL65YW.cjs.map +1 -0
- package/dist/{profile-io-L5EH4JAD.js → profile-io-I4UGTNP6.js} +3 -3
- package/dist/{rasterize-7AR662AL.js → rasterize-QY3XJKCH.js} +2 -2
- package/dist/render-HEQX5DII.js +10 -0
- package/dist/seal-NB2YJ5F4.js +10 -0
- package/dist/{setup-GUQT5ELJ.js → setup-T2BY3VME.js} +30 -7
- package/dist/setup-T2BY3VME.js.map +1 -0
- package/dist/{watch-MONT6CGI.js → watch-JJE2UGVK.js} +13 -9
- package/dist/watch-JJE2UGVK.js.map +1 -0
- package/package.json +7 -3
- package/dist/chunk-3H5X63BQ.js.map +0 -1
- package/dist/chunk-3VTMSSDW.js.map +0 -1
- package/dist/chunk-5QTHHQQE.cjs.map +0 -1
- package/dist/chunk-6PIR74EA.js.map +0 -1
- package/dist/chunk-BCG2PKQU.js.map +0 -1
- package/dist/chunk-C27PPXRZ.cjs.map +0 -1
- package/dist/chunk-MVTX6ODZ.js.map +0 -1
- package/dist/chunk-TUU535RB.cjs.map +0 -1
- package/dist/chunk-UAFSPWU7.js.map +0 -1
- package/dist/chunk-W5KRKBYR.cjs.map +0 -1
- package/dist/chunk-YUVKU5CW.js.map +0 -1
- package/dist/chunk-ZV5OKQ3Z.cjs.map +0 -1
- package/dist/chunks-4HEG6ZPG.js +0 -10
- package/dist/formula-CG4S7TWO.cjs.map +0 -1
- package/dist/image-ocr-OB5PCQUU.cjs.map +0 -1
- package/dist/parser-EIVCD4NS.js.map +0 -1
- package/dist/parser-EQN4YKU4.js.map +0 -1
- package/dist/parser-VACM3DFR.cjs.map +0 -1
- package/dist/pdf-ocr-N62EWEX4.js +0 -12
- package/dist/pdf-ocr-NPYDUIC5.js +0 -15
- package/dist/pdf-ocr-OBPQ4F4D.cjs +0 -13
- package/dist/pdf-ocr-OBPQ4F4D.cjs.map +0 -1
- package/dist/render-CAFQT7S4.js +0 -10
- package/dist/seal-ESAC3IZR.js +0 -10
- package/dist/setup-GUQT5ELJ.js.map +0 -1
- package/dist/watch-MONT6CGI.js.map +0 -1
- /package/dist/{-MK2223RL.js.map → -CVPGGSAB.js.map} +0 -0
- /package/dist/{chunk-XZDJXYUC.js.map → chunk-BSWJCSG7.js.map} +0 -0
- /package/dist/{chunk-PV2EXXGI.js.map → chunk-FJBOVJAG.js.map} +0 -0
- /package/dist/{chunk-P2NWNJMR.js.map → chunk-GLZMUKYL.js.map} +0 -0
- /package/dist/{chunk-GZDOWYJM.js.map → chunk-IMY4LQ3J.js.map} +0 -0
- /package/dist/{chunk-IDHBO6AG.js.map → chunk-IN2AOMX6.js.map} +0 -0
- /package/dist/{chunk-PEVPKD6Z.js.map → chunk-IVSEGHI2.js.map} +0 -0
- /package/dist/{chunk-AFPD74JJ.js.map → chunk-LJW5EQXS.js.map} +0 -0
- /package/dist/{chunk-YXXHH6WC.js.map → chunk-O4VLHQVG.js.map} +0 -0
- /package/dist/{chunk-AEYNY6FG.js.map → chunk-VEBTOI3I.js.map} +0 -0
- /package/dist/{chunk-ZYVULRYF.js.map → chunk-VXB52EWX.js.map} +0 -0
- /package/dist/{chunks-4HEG6ZPG.js.map → chunks-RNP6VLGK.js.map} +0 -0
- /package/dist/{formula-JLYS73QL.js.map → formula-GHGK7T3S.js.map} +0 -0
- /package/dist/{models-6SIKLKRH.js.map → models-RSHR2BY7.js.map} +0 -0
- /package/dist/{pdf-ocr-N62EWEX4.js.map → pdf-ocr-HPRM24SP.js.map} +0 -0
- /package/dist/{pdf-ocr-NPYDUIC5.js.map → pdf-ocr-I6DISTBR.js.map} +0 -0
- /package/dist/{profile-io-L5EH4JAD.js.map → profile-io-I4UGTNP6.js.map} +0 -0
- /package/dist/{rasterize-7AR662AL.js.map → rasterize-QY3XJKCH.js.map} +0 -0
- /package/dist/{render-CAFQT7S4.js.map → render-HEQX5DII.js.map} +0 -0
- /package/dist/{seal-ESAC3IZR.js.map → seal-NB2YJ5F4.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-QXC5NPO2.js";
|
|
41
41
|
import "./chunk-7FCNOKOR.js";
|
|
42
|
-
import "./chunk-
|
|
42
|
+
import "./chunk-4VNUQYUE.js";
|
|
43
43
|
import "./chunk-MOL7MDBG.js";
|
|
44
|
-
import "./chunk-
|
|
44
|
+
import "./chunk-IN2AOMX6.js";
|
|
45
45
|
import "./chunk-DZIXKL7E.js";
|
|
46
|
-
import "./chunk-
|
|
46
|
+
import "./chunk-BSWJCSG7.js";
|
|
47
47
|
import {
|
|
48
48
|
blocksToMarkdown
|
|
49
|
-
} from "./chunk-
|
|
50
|
-
import "./chunk-
|
|
51
|
-
import "./chunk-
|
|
49
|
+
} from "./chunk-P7HPLWEP.js";
|
|
50
|
+
import "./chunk-FJBOVJAG.js";
|
|
51
|
+
import "./chunk-LJW5EQXS.js";
|
|
52
|
+
import {
|
|
53
|
+
assertWithinRoot,
|
|
54
|
+
getAccessRoot,
|
|
55
|
+
isOfflineMode
|
|
56
|
+
} from "./chunk-TYIFZT5H.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-VXB52EWX.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-QPMTNRPU.js");
|
|
304
314
|
metadata = await extractPdfMetadataOnly(buffer);
|
|
305
315
|
} catch {
|
|
306
316
|
metadata = void 0;
|
|
@@ -681,7 +691,7 @@ server.tool(
|
|
|
681
691
|
}
|
|
682
692
|
const image = new Uint8Array(await readFile(imgResolved));
|
|
683
693
|
const ext = extname(imgResolved).slice(1).toLowerCase();
|
|
684
|
-
const { placeSealHwpx } = await import("./seal-
|
|
694
|
+
const { placeSealHwpx } = await import("./seal-NB2YJ5F4.js");
|
|
685
695
|
const result = await placeSealHwpx(buffer, [{
|
|
686
696
|
anchor,
|
|
687
697
|
occurrence,
|
|
@@ -783,7 +793,7 @@ server.tool(
|
|
|
783
793
|
}
|
|
784
794
|
const outPath = output_path ? safeOutputPath(output_path, /* @__PURE__ */ new Set([format === "png" ? ".png" : ".svg"])) : void 0;
|
|
785
795
|
const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx"]));
|
|
786
|
-
const { renderHwpxToSvg } = await import("./render-
|
|
796
|
+
const { renderHwpxToSvg } = await import("./render-HEQX5DII.js");
|
|
787
797
|
const result = await renderHwpxToSvg(buffer, { highlights, reflow: true, reflowMode: reflow_mode });
|
|
788
798
|
const summary = [
|
|
789
799
|
`\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 +805,7 @@ server.tool(
|
|
|
795
805
|
summary.push(`\uC800\uC7A5: ${outPath}`);
|
|
796
806
|
return { content: [{ type: "text", text: summary.join("\n") }] };
|
|
797
807
|
}
|
|
798
|
-
const { rasterizeSvg } = await import("./rasterize-
|
|
808
|
+
const { rasterizeSvg } = await import("./rasterize-QY3XJKCH.js");
|
|
799
809
|
const raster = await rasterizeSvg(result.svg, result.width, result.height);
|
|
800
810
|
if (outPath) {
|
|
801
811
|
await mkdir(dirname(outPath), { recursive: true });
|
|
@@ -893,7 +903,7 @@ server.tool(
|
|
|
893
903
|
if (!parsed.success) {
|
|
894
904
|
return { content: [{ type: "text", text: `\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}` }], isError: true };
|
|
895
905
|
}
|
|
896
|
-
const { blocksToChunks } = await import("./chunks-
|
|
906
|
+
const { blocksToChunks } = await import("./chunks-RNP6VLGK.js");
|
|
897
907
|
const chunks = blocksToChunks(parsed.blocks, { granularity, includeTableCells: include_table_cells });
|
|
898
908
|
return { content: [{ type: "text", text: capResponseText(JSON.stringify(chunks, null, 2)) }] };
|
|
899
909
|
} catch (err) {
|
|
@@ -912,7 +922,7 @@ server.tool(
|
|
|
912
922
|
try {
|
|
913
923
|
const out = safeOutputPath(output_path, PROFILE_EXTENSIONS);
|
|
914
924
|
const { buffer } = await readValidatedFile(hwpx_path);
|
|
915
|
-
const { hwpxToProfile } = await import("./-
|
|
925
|
+
const { hwpxToProfile } = await import("./-CVPGGSAB.js");
|
|
916
926
|
const profile = await hwpxToProfile(buffer);
|
|
917
927
|
await mkdir(dirname(out), { recursive: true });
|
|
918
928
|
await writeFile(out, JSON.stringify(profile, null, 2));
|
|
@@ -1001,7 +1011,7 @@ server.tool(
|
|
|
1001
1011
|
}
|
|
1002
1012
|
let profile;
|
|
1003
1013
|
if (profile_path) {
|
|
1004
|
-
const { parseFormatProfileJson } = await import("./profile-io-
|
|
1014
|
+
const { parseFormatProfileJson } = await import("./profile-io-I4UGTNP6.js");
|
|
1005
1015
|
profile = parseFormatProfileJson(await readFile(safePath(profile_path, PROFILE_EXTENSIONS), "utf-8"));
|
|
1006
1016
|
}
|
|
1007
1017
|
const out = safeOutputPath(output_path, /* @__PURE__ */ new Set([".hwpx"]));
|
|
@@ -1015,6 +1025,7 @@ server.tool(
|
|
|
1015
1025
|
let images;
|
|
1016
1026
|
if (image_dir) {
|
|
1017
1027
|
const dir = await realpath(resolve(image_dir));
|
|
1028
|
+
assertWithinRoot(dir);
|
|
1018
1029
|
for (const m of markdown.matchAll(/!\[[^\]]*\]\(([^)\s]+)\)/g)) {
|
|
1019
1030
|
const url = m[1];
|
|
1020
1031
|
if (!/^[A-Za-z0-9._-]+\.[A-Za-z0-9]+$/.test(url) || url.includes("..")) continue;
|
|
@@ -1056,6 +1067,12 @@ var serverStarted = false;
|
|
|
1056
1067
|
async function startMcpServer() {
|
|
1057
1068
|
if (serverStarted) return;
|
|
1058
1069
|
serverStarted = true;
|
|
1070
|
+
const root = getAccessRoot();
|
|
1071
|
+
if (isOfflineMode() || root) {
|
|
1072
|
+
const flags = [isOfflineMode() ? "offline" : null, root ? `root=${root}` : null].filter(Boolean);
|
|
1073
|
+
process.stderr.write(`[kordoc-mcp] \uC81C\uD55C \uBAA8\uB4DC: ${flags.join(", ")}
|
|
1074
|
+
`);
|
|
1075
|
+
}
|
|
1059
1076
|
const transport = new StdioServerTransport();
|
|
1060
1077
|
await server.connect(transport);
|
|
1061
1078
|
}
|