@clazic/kordoc 2.2.3 → 2.2.4
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/dist/{chunk-Z24TFFSO.js → chunk-FRUOLYOA.js} +2 -2
- package/dist/{chunk-NND6AJ7Y.js → chunk-RY4EXD2W.js} +3 -3
- package/dist/cli.js +5 -5
- package/dist/index.cjs +10 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -7
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +2 -2
- package/dist/{resolve-H4SNHDDT.js → resolve-C5F2MXLL.js} +11 -7
- package/dist/resolve-C5F2MXLL.js.map +1 -0
- package/dist/{utils-Q3MHKY3T.js → utils-HOTLMIQL.js} +2 -2
- package/dist/{watch-RVLVNLCX.js → watch-E2YLCDHY.js} +3 -3
- package/package.json +1 -1
- package/dist/resolve-H4SNHDDT.js.map +0 -1
- /package/dist/{chunk-Z24TFFSO.js.map → chunk-FRUOLYOA.js.map} +0 -0
- /package/dist/{chunk-NND6AJ7Y.js.map → chunk-RY4EXD2W.js.map} +0 -0
- /package/dist/{utils-Q3MHKY3T.js.map → utils-HOTLMIQL.js.map} +0 -0
- /package/dist/{watch-RVLVNLCX.js.map → watch-E2YLCDHY.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -2014,11 +2014,14 @@ var init_auto_detect = __esm({
|
|
|
2014
2014
|
|
|
2015
2015
|
// src/ocr/cli-provider.ts
|
|
2016
2016
|
import { spawnSync } from "child_process";
|
|
2017
|
-
import { writeFileSync, readFileSync, unlinkSync,
|
|
2017
|
+
import { writeFileSync, readFileSync, unlinkSync, mkdirSync } from "fs";
|
|
2018
2018
|
import { join } from "path";
|
|
2019
2019
|
import { tmpdir } from "os";
|
|
2020
2020
|
function getTempDir() {
|
|
2021
|
-
if (!_tempDir)
|
|
2021
|
+
if (!_tempDir) {
|
|
2022
|
+
_tempDir = join(process.cwd(), ".kordoc-tmp");
|
|
2023
|
+
mkdirSync(_tempDir, { recursive: true });
|
|
2024
|
+
}
|
|
2022
2025
|
return _tempDir;
|
|
2023
2026
|
}
|
|
2024
2027
|
function createCliOcrProvider(mode) {
|
|
@@ -2061,12 +2064,12 @@ function callCli(mode, imagePath) {
|
|
|
2061
2064
|
return result.stdout || "";
|
|
2062
2065
|
}
|
|
2063
2066
|
function callCodexCli(imagePath) {
|
|
2064
|
-
const outPath = join(
|
|
2067
|
+
const outPath = join(tmpdir(), `kordoc-codex-out-${Date.now()}.txt`);
|
|
2065
2068
|
try {
|
|
2066
2069
|
const args = ["exec", OCR_PROMPT, "--image", imagePath, "--output-last-message", outPath];
|
|
2067
2070
|
const result = spawnSync("codex", args, {
|
|
2068
2071
|
encoding: "utf-8",
|
|
2069
|
-
timeout:
|
|
2072
|
+
timeout: 18e4,
|
|
2070
2073
|
maxBuffer: 10 * 1024 * 1024,
|
|
2071
2074
|
input: ""
|
|
2072
2075
|
// stdin EOF 즉시 전달 (대화형 입력 차단)
|
|
@@ -2106,8 +2109,9 @@ function buildCliArgs(mode, imagePath) {
|
|
|
2106
2109
|
async function callOllamaApi(imagePath) {
|
|
2107
2110
|
const { readFileSync: readFileSync2 } = await import("fs");
|
|
2108
2111
|
const imageBase64 = readFileSync2(imagePath).toString("base64");
|
|
2109
|
-
const model = process.env.KORDOC_OLLAMA_MODEL || "
|
|
2112
|
+
const model = process.env.KORDOC_OLLAMA_MODEL || "qwen3-vl:8b";
|
|
2110
2113
|
const host = process.env.KORDOC_OLLAMA_HOST || "http://localhost:11434";
|
|
2114
|
+
const timeoutMs = Number(process.env.KORDOC_OLLAMA_TIMEOUT) || 12e4;
|
|
2111
2115
|
const response = await fetch(`${host}/api/chat`, {
|
|
2112
2116
|
method: "POST",
|
|
2113
2117
|
headers: { "Content-Type": "application/json" },
|
|
@@ -2120,7 +2124,7 @@ async function callOllamaApi(imagePath) {
|
|
|
2120
2124
|
}],
|
|
2121
2125
|
stream: false
|
|
2122
2126
|
}),
|
|
2123
|
-
signal: AbortSignal.timeout(
|
|
2127
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
2124
2128
|
});
|
|
2125
2129
|
if (!response.ok) {
|
|
2126
2130
|
throw new Error(`Ollama API \uC624\uB958: ${response.status} ${response.statusText}`);
|
|
@@ -2432,7 +2436,7 @@ import JSZip2 from "jszip";
|
|
|
2432
2436
|
import { DOMParser } from "@xmldom/xmldom";
|
|
2433
2437
|
|
|
2434
2438
|
// src/utils.ts
|
|
2435
|
-
var VERSION = true ? "2.2.
|
|
2439
|
+
var VERSION = true ? "2.2.4" : "0.0.0-dev";
|
|
2436
2440
|
function toArrayBuffer(buf) {
|
|
2437
2441
|
if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {
|
|
2438
2442
|
return buf.buffer;
|