@lyy0709/contextweaver 1.0.2 → 1.0.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/{SearchService-R7UMDQ6T.js → SearchService-P5C5QXMP.js} +5 -4
- package/dist/{browser-VC5772XM.js → browser-BCGLGKKF.js} +3 -2
- package/dist/{chunk-LPFRFKFW.js → chunk-53ESQDZT.js} +2 -1
- package/dist/{chunk-CKN7LWEA.js → chunk-7MWEWZ7J.js} +5 -4
- package/dist/{chunk-ECEVTSSZ.js → chunk-BGKNHLHY.js} +4 -3
- package/dist/{chunk-XVKMTPCT.js → chunk-CACJOY3O.js} +7 -6
- package/dist/{chunk-6HF343R7.js → chunk-PZTRC7VF.js} +6 -5
- package/dist/{chunk-YVLGQTLG.js → chunk-QCUCU74R.js} +2 -1
- package/dist/{chunk-V2USKRIC.js → chunk-YVMNY2OU.js} +1 -0
- package/dist/{claude-IKIA62JA.js → claude-YONOS6YG.js} +1 -0
- package/dist/codebaseRetrieval-N6ABFZ24.js +12 -0
- package/dist/{config-WTC56Y2R.js → config-VZD37BMJ.js} +2 -1
- package/dist/enhancer-PO6KKYUT.js +9 -0
- package/dist/{gemini-Q37K5XA5.js → gemini-54NRBSPH.js} +1 -0
- package/dist/index.js +11 -10
- package/dist/{lock-K4TS4ENC.js → lock-AQIUW3N3.js} +3 -2
- package/dist/logger-REOCZNEY.js +10 -0
- package/dist/mcp/main.js +3 -2
- package/dist/{openai-MOPZNA5I.js → openai-VRQNTJQZ.js} +1 -0
- package/dist/scanner-QUWFCQUV.js +11 -0
- package/dist/{server-DENFYPME.js → server-JOJGOORY.js} +40 -8
- package/dist/{server-RFAVT7XG.js → server-TGCR7VVZ.js} +76 -16
- package/package.json +2 -2
- package/dist/codebaseRetrieval-SCN3YIPM.js +0 -11
- package/dist/enhancer-QHNMR35J.js +0 -8
- package/dist/logger-SF6S6GVR.js +0 -9
- package/dist/scanner-T7MGYXQV.js +0 -10
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getIndexer,
|
|
3
3
|
getVectorStore
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BGKNHLHY.js";
|
|
5
5
|
import {
|
|
6
6
|
initDb,
|
|
7
7
|
isChunksFtsInitialized,
|
|
@@ -9,15 +9,15 @@ import {
|
|
|
9
9
|
searchChunksFts,
|
|
10
10
|
searchFilesFts,
|
|
11
11
|
segmentQuery
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-53ESQDZT.js";
|
|
13
13
|
import {
|
|
14
14
|
isDebugEnabled,
|
|
15
15
|
logger
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-QCUCU74R.js";
|
|
17
17
|
import {
|
|
18
18
|
getEmbeddingConfig,
|
|
19
19
|
getRerankerConfig
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-YVMNY2OU.js";
|
|
21
21
|
|
|
22
22
|
// src/api/reranker.ts
|
|
23
23
|
var RerankerClient = class {
|
|
@@ -1621,3 +1621,4 @@ ${code}`;
|
|
|
1621
1621
|
export {
|
|
1622
1622
|
SearchService
|
|
1623
1623
|
};
|
|
1624
|
+
//# sourceMappingURL=SearchService-P5C5QXMP.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
logger
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-QCUCU74R.js";
|
|
4
|
+
import "./chunk-YVMNY2OU.js";
|
|
5
5
|
|
|
6
6
|
// src/enhancer/browser.ts
|
|
7
7
|
import { exec } from "child_process";
|
|
@@ -28,3 +28,4 @@ function openBrowser(url) {
|
|
|
28
28
|
export {
|
|
29
29
|
openBrowser
|
|
30
30
|
};
|
|
31
|
+
//# sourceMappingURL=browser-BCGLGKKF.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
logger
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QCUCU74R.js";
|
|
4
4
|
|
|
5
5
|
// src/search/fts.ts
|
|
6
6
|
var tokenizerCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -541,3 +541,4 @@ export {
|
|
|
541
541
|
getStoredEmbeddingDimensions,
|
|
542
542
|
setStoredEmbeddingDimensions
|
|
543
543
|
};
|
|
544
|
+
//# sourceMappingURL=chunk-53ESQDZT.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
closeAllIndexers,
|
|
3
3
|
closeAllVectorStores,
|
|
4
4
|
getIndexer
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-BGKNHLHY.js";
|
|
6
6
|
import {
|
|
7
7
|
batchDelete,
|
|
8
8
|
batchUpdateMtime,
|
|
@@ -16,14 +16,14 @@ import {
|
|
|
16
16
|
getStoredEmbeddingDimensions,
|
|
17
17
|
initDb,
|
|
18
18
|
setStoredEmbeddingDimensions
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-53ESQDZT.js";
|
|
20
20
|
import {
|
|
21
21
|
logger
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-QCUCU74R.js";
|
|
23
23
|
import {
|
|
24
24
|
getEmbeddingConfig,
|
|
25
25
|
getExcludePatterns
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-YVMNY2OU.js";
|
|
27
27
|
|
|
28
28
|
// src/scanner/index.ts
|
|
29
29
|
import path3 from "path";
|
|
@@ -1335,3 +1335,4 @@ async function scan(rootPath, options = {}) {
|
|
|
1335
1335
|
export {
|
|
1336
1336
|
scan
|
|
1337
1337
|
};
|
|
1338
|
+
//# sourceMappingURL=chunk-7MWEWZ7J.js.map
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
batchUpsertChunkFts,
|
|
5
5
|
clearVectorIndexHash,
|
|
6
6
|
isChunksFtsInitialized
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-53ESQDZT.js";
|
|
8
8
|
import {
|
|
9
9
|
logger
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-QCUCU74R.js";
|
|
11
11
|
import {
|
|
12
12
|
getEmbeddingConfig
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-YVMNY2OU.js";
|
|
14
14
|
|
|
15
15
|
// src/vectorStore/index.ts
|
|
16
16
|
import fs from "fs";
|
|
@@ -892,3 +892,4 @@ export {
|
|
|
892
892
|
getIndexer,
|
|
893
893
|
closeAllIndexers
|
|
894
894
|
};
|
|
895
|
+
//# sourceMappingURL=chunk-BGKNHLHY.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generateProjectId
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-53ESQDZT.js";
|
|
4
4
|
import {
|
|
5
5
|
logger
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QCUCU74R.js";
|
|
7
7
|
|
|
8
8
|
// src/mcp/tools/codebaseRetrieval.ts
|
|
9
9
|
import fs from "fs";
|
|
@@ -75,8 +75,8 @@ function isProjectIndexed(projectId) {
|
|
|
75
75
|
return fs.existsSync(dbPath);
|
|
76
76
|
}
|
|
77
77
|
async function ensureIndexed(repoPath, projectId, onProgress) {
|
|
78
|
-
const { withLock } = await import("./lock-
|
|
79
|
-
const { scan } = await import("./scanner-
|
|
78
|
+
const { withLock } = await import("./lock-AQIUW3N3.js");
|
|
79
|
+
const { scan } = await import("./scanner-QUWFCQUV.js");
|
|
80
80
|
await withLock(projectId, "index", async () => {
|
|
81
81
|
const wasIndexed = isProjectIndexed(projectId);
|
|
82
82
|
if (!wasIndexed) {
|
|
@@ -116,7 +116,7 @@ async function handleCodebaseRetrieval(args, configOverride = ZEN_CONFIG_OVERRID
|
|
|
116
116
|
},
|
|
117
117
|
"MCP codebase-retrieval \u8C03\u7528\u5F00\u59CB"
|
|
118
118
|
);
|
|
119
|
-
const { checkEmbeddingEnv, checkRerankerEnv } = await import("./config-
|
|
119
|
+
const { checkEmbeddingEnv, checkRerankerEnv } = await import("./config-VZD37BMJ.js");
|
|
120
120
|
const embeddingCheck = checkEmbeddingEnv();
|
|
121
121
|
const rerankerCheck = checkRerankerEnv();
|
|
122
122
|
const allMissingVars = [...embeddingCheck.missingVars, ...rerankerCheck.missingVars];
|
|
@@ -136,7 +136,7 @@ async function handleCodebaseRetrieval(args, configOverride = ZEN_CONFIG_OVERRID
|
|
|
136
136
|
},
|
|
137
137
|
"MCP \u67E5\u8BE2\u6784\u5EFA"
|
|
138
138
|
);
|
|
139
|
-
const { SearchService } = await import("./SearchService-
|
|
139
|
+
const { SearchService } = await import("./SearchService-P5C5QXMP.js");
|
|
140
140
|
const service = new SearchService(projectId, repo_path, configOverride);
|
|
141
141
|
await service.init();
|
|
142
142
|
logger.debug("SearchService \u521D\u59CB\u5316\u5B8C\u6210");
|
|
@@ -295,3 +295,4 @@ export {
|
|
|
295
295
|
codebaseRetrievalSchema,
|
|
296
296
|
handleCodebaseRetrieval
|
|
297
297
|
};
|
|
298
|
+
//# sourceMappingURL=chunk-CACJOY3O.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
logger
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QCUCU74R.js";
|
|
4
4
|
import {
|
|
5
5
|
checkEnhancerEnv,
|
|
6
6
|
getEnhancerConfig
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YVMNY2OU.js";
|
|
8
8
|
|
|
9
9
|
// src/enhancer/detect.ts
|
|
10
10
|
function detectLanguage(text) {
|
|
@@ -34,13 +34,13 @@ async function createLlmClient(config) {
|
|
|
34
34
|
};
|
|
35
35
|
let client;
|
|
36
36
|
if (endpoint === "openai") {
|
|
37
|
-
const { OpenAiAdapter } = await import("./openai-
|
|
37
|
+
const { OpenAiAdapter } = await import("./openai-VRQNTJQZ.js");
|
|
38
38
|
client = new OpenAiAdapter(clientConfig);
|
|
39
39
|
} else if (endpoint === "claude") {
|
|
40
|
-
const { ClaudeAdapter } = await import("./claude-
|
|
40
|
+
const { ClaudeAdapter } = await import("./claude-YONOS6YG.js");
|
|
41
41
|
client = new ClaudeAdapter(clientConfig);
|
|
42
42
|
} else {
|
|
43
|
-
const { GeminiAdapter } = await import("./gemini-
|
|
43
|
+
const { GeminiAdapter } = await import("./gemini-54NRBSPH.js");
|
|
44
44
|
client = new GeminiAdapter(clientConfig);
|
|
45
45
|
}
|
|
46
46
|
clientCache.set(cacheKey, client);
|
|
@@ -184,3 +184,4 @@ async function enhancePrompt(options) {
|
|
|
184
184
|
export {
|
|
185
185
|
enhancePrompt
|
|
186
186
|
};
|
|
187
|
+
//# sourceMappingURL=chunk-PZTRC7VF.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isDev,
|
|
3
3
|
isMcpMode
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YVMNY2OU.js";
|
|
5
5
|
|
|
6
6
|
// src/utils/logger.ts
|
|
7
7
|
import fs from "fs";
|
|
@@ -168,3 +168,4 @@ export {
|
|
|
168
168
|
logger,
|
|
169
169
|
isDebugEnabled
|
|
170
170
|
};
|
|
171
|
+
//# sourceMappingURL=chunk-QCUCU74R.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
codebaseRetrievalSchema,
|
|
3
|
+
handleCodebaseRetrieval
|
|
4
|
+
} from "./chunk-CACJOY3O.js";
|
|
5
|
+
import "./chunk-53ESQDZT.js";
|
|
6
|
+
import "./chunk-QCUCU74R.js";
|
|
7
|
+
import "./chunk-YVMNY2OU.js";
|
|
8
|
+
export {
|
|
9
|
+
codebaseRetrievalSchema,
|
|
10
|
+
handleCodebaseRetrieval
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=codebaseRetrieval-N6ABFZ24.js.map
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
getRerankerConfig,
|
|
9
9
|
isDev,
|
|
10
10
|
isMcpMode
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-YVMNY2OU.js";
|
|
12
12
|
export {
|
|
13
13
|
checkEmbeddingEnv,
|
|
14
14
|
checkEnhancerEnv,
|
|
@@ -20,3 +20,4 @@ export {
|
|
|
20
20
|
isDev,
|
|
21
21
|
isMcpMode
|
|
22
22
|
};
|
|
23
|
+
//# sourceMappingURL=config-VZD37BMJ.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
scan
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-7MWEWZ7J.js";
|
|
5
|
+
import "./chunk-BGKNHLHY.js";
|
|
6
6
|
import {
|
|
7
7
|
generateProjectId
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-53ESQDZT.js";
|
|
9
9
|
import {
|
|
10
10
|
logger
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-QCUCU74R.js";
|
|
12
|
+
import "./chunk-YVMNY2OU.js";
|
|
13
13
|
|
|
14
14
|
// src/index.ts
|
|
15
15
|
import { promises as fs } from "fs";
|
|
@@ -121,7 +121,7 @@ cli.command("index [path]", "\u626B\u63CF\u4EE3\u7801\u5E93\u5E76\u5EFA\u7ACB\u7
|
|
|
121
121
|
}
|
|
122
122
|
});
|
|
123
123
|
cli.command("mcp", "\u542F\u52A8 MCP \u670D\u52A1\u5668").action(async () => {
|
|
124
|
-
const { startMcpServer } = await import("./server-
|
|
124
|
+
const { startMcpServer } = await import("./server-JOJGOORY.js");
|
|
125
125
|
try {
|
|
126
126
|
await startMcpServer();
|
|
127
127
|
} catch (err) {
|
|
@@ -138,7 +138,7 @@ cli.command("enhance <prompt>", "\u589E\u5F3A\u63D0\u793A\u8BCD").option("--no-b
|
|
|
138
138
|
const endpointRaw = options.endpoint?.toLowerCase();
|
|
139
139
|
const endpointOverride = endpointRaw === "openai" || endpointRaw === "claude" || endpointRaw === "gemini" ? endpointRaw : void 0;
|
|
140
140
|
if (options.browser === false) {
|
|
141
|
-
const { enhancePrompt } = await import("./enhancer-
|
|
141
|
+
const { enhancePrompt } = await import("./enhancer-PO6KKYUT.js");
|
|
142
142
|
try {
|
|
143
143
|
const result = await enhancePrompt({ prompt, endpointOverride });
|
|
144
144
|
process.stdout.write(`${result.enhanced}
|
|
@@ -153,8 +153,8 @@ cli.command("enhance <prompt>", "\u589E\u5F3A\u63D0\u793A\u8BCD").option("--no-b
|
|
|
153
153
|
}
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
|
-
const { startEnhanceServer } = await import("./server-
|
|
157
|
-
const { openBrowser } = await import("./browser-
|
|
156
|
+
const { startEnhanceServer } = await import("./server-TGCR7VVZ.js");
|
|
157
|
+
const { openBrowser } = await import("./browser-BCGLGKKF.js");
|
|
158
158
|
try {
|
|
159
159
|
const result = await startEnhanceServer(prompt, {
|
|
160
160
|
endpointOverride,
|
|
@@ -184,7 +184,7 @@ cli.command("search", "\u672C\u5730\u68C0\u7D22\uFF08\u53C2\u6570\u5BF9\u9F50 MC
|
|
|
184
184
|
}
|
|
185
185
|
const technicalTerms = (options.technicalTerms || "").split(",").map((t) => t.trim()).filter(Boolean);
|
|
186
186
|
const useZen = options.zen !== false;
|
|
187
|
-
const { handleCodebaseRetrieval } = await import("./codebaseRetrieval-
|
|
187
|
+
const { handleCodebaseRetrieval } = await import("./codebaseRetrieval-N6ABFZ24.js");
|
|
188
188
|
const response = await handleCodebaseRetrieval(
|
|
189
189
|
{
|
|
190
190
|
repo_path: repoPath,
|
|
@@ -200,3 +200,4 @@ cli.command("search", "\u672C\u5730\u68C0\u7D22\uFF08\u53C2\u6570\u5BF9\u9F50 MC
|
|
|
200
200
|
);
|
|
201
201
|
cli.help();
|
|
202
202
|
cli.parse();
|
|
203
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
logger
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-QCUCU74R.js";
|
|
4
|
+
import "./chunk-YVMNY2OU.js";
|
|
5
5
|
|
|
6
6
|
// src/utils/lock.ts
|
|
7
7
|
import fs from "fs";
|
|
@@ -104,3 +104,4 @@ async function withLock(projectId, operation, fn, timeoutMs = 3e4) {
|
|
|
104
104
|
export {
|
|
105
105
|
withLock
|
|
106
106
|
};
|
|
107
|
+
//# sourceMappingURL=lock-AQIUW3N3.js.map
|
package/dist/mcp/main.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
if (!process.argv.includes("mcp")) {
|
|
5
5
|
process.argv.push("mcp");
|
|
6
6
|
}
|
|
7
|
-
var { logger } = await import("../logger-
|
|
8
|
-
var { startMcpServer } = await import("../server-
|
|
7
|
+
var { logger } = await import("../logger-REOCZNEY.js");
|
|
8
|
+
var { startMcpServer } = await import("../server-JOJGOORY.js");
|
|
9
9
|
try {
|
|
10
10
|
await startMcpServer();
|
|
11
11
|
} catch (err) {
|
|
@@ -16,3 +16,4 @@ try {
|
|
|
16
16
|
);
|
|
17
17
|
process.exit(1);
|
|
18
18
|
}
|
|
19
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
codebaseRetrievalSchema,
|
|
3
3
|
handleCodebaseRetrieval
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-CACJOY3O.js";
|
|
5
|
+
import "./chunk-53ESQDZT.js";
|
|
6
6
|
import {
|
|
7
7
|
logger
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-QCUCU74R.js";
|
|
9
|
+
import "./chunk-YVMNY2OU.js";
|
|
10
10
|
|
|
11
11
|
// src/mcp/server.ts
|
|
12
12
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
@@ -20,7 +20,10 @@ var enhancePromptSchema = z.object({
|
|
|
20
20
|
conversation_history: z.string().optional().describe(
|
|
21
21
|
"Recent conversation history for context. Format: 'User: ...\\nAssistant: ...'"
|
|
22
22
|
),
|
|
23
|
-
project_root_path: z.string().optional().describe("Project root path for context")
|
|
23
|
+
project_root_path: z.string().optional().describe("Project root path for context"),
|
|
24
|
+
webui: z.boolean().optional().default(true).describe(
|
|
25
|
+
"When true (default), opens a Web UI in the browser for interactive review/editing. When false, returns the enhanced prompt directly."
|
|
26
|
+
)
|
|
24
27
|
});
|
|
25
28
|
function formatEnvMissingResponse(missingVars) {
|
|
26
29
|
const configPath = "~/.contextweaver/.env";
|
|
@@ -56,15 +59,38 @@ PROMPT_ENHANCER_TOKEN=your-api-key-here
|
|
|
56
59
|
};
|
|
57
60
|
}
|
|
58
61
|
async function handleEnhancePrompt(args) {
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
const useWebUi = args.webui !== false;
|
|
63
|
+
logger.info(
|
|
64
|
+
{ hasHistory: Boolean(args.conversation_history), webui: useWebUi },
|
|
65
|
+
"MCP enhance-prompt \u8C03\u7528\u5F00\u59CB"
|
|
66
|
+
);
|
|
67
|
+
const { checkEnhancerEnv } = await import("./config-VZD37BMJ.js");
|
|
61
68
|
const envCheck = checkEnhancerEnv();
|
|
62
69
|
if (!envCheck.isValid) {
|
|
63
70
|
logger.warn({ missingVars: envCheck.missingVars }, "Prompt Enhancer \u73AF\u5883\u53D8\u91CF\u672A\u914D\u7F6E");
|
|
64
71
|
return formatEnvMissingResponse(envCheck.missingVars);
|
|
65
72
|
}
|
|
66
73
|
try {
|
|
67
|
-
|
|
74
|
+
if (useWebUi) {
|
|
75
|
+
const { startEnhanceServer } = await import("./server-TGCR7VVZ.js");
|
|
76
|
+
const { openBrowser } = await import("./browser-BCGLGKKF.js");
|
|
77
|
+
const result2 = await startEnhanceServer(args.prompt, {
|
|
78
|
+
conversationHistory: args.conversation_history,
|
|
79
|
+
projectRootPath: args.project_root_path,
|
|
80
|
+
onStarted: (url) => {
|
|
81
|
+
openBrowser(url);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
return {
|
|
85
|
+
content: [
|
|
86
|
+
{
|
|
87
|
+
type: "text",
|
|
88
|
+
text: result2.enhanced
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
const { enhancePrompt } = await import("./enhancer-PO6KKYUT.js");
|
|
68
94
|
const result = await enhancePrompt({
|
|
69
95
|
prompt: args.prompt,
|
|
70
96
|
conversationHistory: args.conversation_history,
|
|
@@ -184,6 +210,11 @@ Features:
|
|
|
184
210
|
project_root_path: {
|
|
185
211
|
type: "string",
|
|
186
212
|
description: "Project root path for context"
|
|
213
|
+
},
|
|
214
|
+
webui: {
|
|
215
|
+
type: "boolean",
|
|
216
|
+
description: "When true (default), opens a Web UI in the browser for interactive review/editing. When false, returns the enhanced prompt directly.",
|
|
217
|
+
default: true
|
|
187
218
|
}
|
|
188
219
|
},
|
|
189
220
|
required: ["prompt"]
|
|
@@ -261,3 +292,4 @@ async function startMcpServer() {
|
|
|
261
292
|
export {
|
|
262
293
|
startMcpServer
|
|
263
294
|
};
|
|
295
|
+
//# sourceMappingURL=server-JOJGOORY.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
enhancePrompt
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PZTRC7VF.js";
|
|
4
4
|
import {
|
|
5
5
|
logger
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-QCUCU74R.js";
|
|
7
|
+
import "./chunk-YVMNY2OU.js";
|
|
8
8
|
|
|
9
9
|
// src/enhancer/server.ts
|
|
10
10
|
import { randomUUID } from "crypto";
|
|
@@ -59,6 +59,7 @@ function getEnhancePageHtml() {
|
|
|
59
59
|
justify-content: space-between;
|
|
60
60
|
gap: 16px;
|
|
61
61
|
margin-bottom: 14px;
|
|
62
|
+
flex-wrap: wrap;
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
.title {
|
|
@@ -71,6 +72,8 @@ function getEnhancePageHtml() {
|
|
|
71
72
|
display: flex;
|
|
72
73
|
align-items: center;
|
|
73
74
|
gap: 14px;
|
|
75
|
+
flex-wrap: wrap;
|
|
76
|
+
justify-content: flex-end;
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
.countdown {
|
|
@@ -90,6 +93,7 @@ function getEnhancePageHtml() {
|
|
|
90
93
|
color: var(--muted2);
|
|
91
94
|
text-align: right;
|
|
92
95
|
line-height: 1.4;
|
|
96
|
+
word-break: break-word;
|
|
93
97
|
}
|
|
94
98
|
|
|
95
99
|
.panel {
|
|
@@ -98,29 +102,63 @@ function getEnhancePageHtml() {
|
|
|
98
102
|
border-radius: 14px;
|
|
99
103
|
overflow: hidden;
|
|
100
104
|
box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6);
|
|
105
|
+
display: flex;
|
|
106
|
+
flex-direction: column;
|
|
101
107
|
}
|
|
102
108
|
|
|
103
109
|
.grid {
|
|
104
110
|
display: grid;
|
|
105
111
|
grid-template-columns: 1fr 1fr;
|
|
106
112
|
gap: 0;
|
|
113
|
+
height: min(720px, calc(100vh - 240px));
|
|
114
|
+
height: min(720px, calc(100dvh - 240px));
|
|
107
115
|
min-height: 520px;
|
|
108
116
|
}
|
|
109
117
|
|
|
110
118
|
@media (max-width: 920px) {
|
|
111
119
|
.grid {
|
|
112
120
|
grid-template-columns: 1fr;
|
|
121
|
+
height: auto;
|
|
122
|
+
min-height: 0;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.header-right {
|
|
126
|
+
width: 100%;
|
|
127
|
+
justify-content: flex-start;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.meta {
|
|
131
|
+
text-align: left;
|
|
113
132
|
}
|
|
114
133
|
}
|
|
115
134
|
|
|
116
135
|
.col {
|
|
117
136
|
padding: 14px;
|
|
118
137
|
border-right: 1px solid var(--border);
|
|
138
|
+
display: flex;
|
|
139
|
+
flex-direction: column;
|
|
140
|
+
gap: 10px;
|
|
141
|
+
min-height: 0;
|
|
119
142
|
}
|
|
120
143
|
.col:last-child {
|
|
121
144
|
border-right: none;
|
|
122
145
|
}
|
|
123
146
|
|
|
147
|
+
@media (max-width: 920px) {
|
|
148
|
+
.col {
|
|
149
|
+
border-right: none;
|
|
150
|
+
border-bottom: 1px solid var(--border);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.col:last-child {
|
|
154
|
+
border-bottom: none;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
textarea {
|
|
158
|
+
min-height: 320px;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
124
162
|
.label {
|
|
125
163
|
display: flex;
|
|
126
164
|
align-items: baseline;
|
|
@@ -128,14 +166,14 @@ function getEnhancePageHtml() {
|
|
|
128
166
|
gap: 12px;
|
|
129
167
|
font-size: 12px;
|
|
130
168
|
color: var(--muted);
|
|
131
|
-
margin: 4px 2px
|
|
169
|
+
margin: 4px 2px 0;
|
|
132
170
|
letter-spacing: 0.5px;
|
|
133
171
|
}
|
|
134
172
|
|
|
135
173
|
textarea {
|
|
136
174
|
width: 100%;
|
|
137
|
-
|
|
138
|
-
min-height:
|
|
175
|
+
flex: 1;
|
|
176
|
+
min-height: 0;
|
|
139
177
|
padding: 12px 12px;
|
|
140
178
|
border: 1px solid var(--border);
|
|
141
179
|
border-radius: 10px;
|
|
@@ -145,29 +183,35 @@ function getEnhancePageHtml() {
|
|
|
145
183
|
'Courier New', monospace;
|
|
146
184
|
font-size: 13px;
|
|
147
185
|
line-height: 1.55;
|
|
148
|
-
resize:
|
|
186
|
+
resize: none;
|
|
149
187
|
outline: none;
|
|
188
|
+
overflow: auto;
|
|
189
|
+
scrollbar-gutter: stable;
|
|
150
190
|
}
|
|
151
191
|
|
|
152
192
|
textarea:focus {
|
|
153
193
|
border-color: rgba(255, 255, 255, 0.45);
|
|
154
|
-
|
|
194
|
+
outline: 2px solid rgba(255, 255, 255, 0.28);
|
|
195
|
+
outline-offset: -2px;
|
|
155
196
|
}
|
|
156
197
|
|
|
157
198
|
.footer {
|
|
158
199
|
display: flex;
|
|
159
|
-
align-items:
|
|
200
|
+
align-items: flex-start;
|
|
160
201
|
justify-content: space-between;
|
|
161
202
|
gap: 12px;
|
|
162
203
|
padding: 12px 14px;
|
|
163
204
|
border-top: 1px solid var(--border);
|
|
164
205
|
background: rgba(0, 0, 0, 0.5);
|
|
206
|
+
flex-wrap: wrap;
|
|
165
207
|
}
|
|
166
208
|
|
|
167
209
|
.hint {
|
|
168
210
|
font-size: 12px;
|
|
169
211
|
color: var(--muted2);
|
|
170
212
|
line-height: 1.45;
|
|
213
|
+
flex: 1 1 260px;
|
|
214
|
+
min-width: 220px;
|
|
171
215
|
}
|
|
172
216
|
|
|
173
217
|
.buttons {
|
|
@@ -177,6 +221,18 @@ function getEnhancePageHtml() {
|
|
|
177
221
|
justify-content: flex-end;
|
|
178
222
|
}
|
|
179
223
|
|
|
224
|
+
@media (max-width: 520px) {
|
|
225
|
+
.buttons {
|
|
226
|
+
width: 100%;
|
|
227
|
+
justify-content: stretch;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.buttons button {
|
|
231
|
+
flex: 1 1 auto;
|
|
232
|
+
justify-content: center;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
180
236
|
button {
|
|
181
237
|
appearance: none;
|
|
182
238
|
border: 1px solid var(--border);
|
|
@@ -309,7 +365,7 @@ function getEnhancePageHtml() {
|
|
|
309
365
|
if (remaining <= 0) {
|
|
310
366
|
clearInterval(countdownTimer);
|
|
311
367
|
countdownEl.textContent = '\u5DF2\u8D85\u65F6';
|
|
312
|
-
setStatus('\u4F1A\u8BDD\
|
|
368
|
+
setStatus('\u4F1A\u8BDD\u8D85\u65F6\uFF0C\u5DF2\u81EA\u52A8\u91C7\u7528\u589E\u5F3A\u7248\u7ED3\u679C\u3002', 'success');
|
|
313
369
|
}
|
|
314
370
|
}
|
|
315
371
|
|
|
@@ -327,6 +383,7 @@ function getEnhancePageHtml() {
|
|
|
327
383
|
|
|
328
384
|
const edited = (enhancedEl.value || '').trim() && enhancedEl.value !== baselineEnhanced;
|
|
329
385
|
useEditedBtn.style.display = edited ? 'inline-block' : 'none';
|
|
386
|
+
useEditedBtn.disabled = !edited;
|
|
330
387
|
}
|
|
331
388
|
|
|
332
389
|
originalEl.addEventListener('input', updateCounts);
|
|
@@ -505,7 +562,9 @@ async function startEnhanceServer(prompt, options = {}) {
|
|
|
505
562
|
const port = await findAvailablePort();
|
|
506
563
|
const initial = await enhancePrompt({
|
|
507
564
|
prompt,
|
|
508
|
-
endpointOverride: options.endpointOverride
|
|
565
|
+
endpointOverride: options.endpointOverride,
|
|
566
|
+
conversationHistory: options.conversationHistory,
|
|
567
|
+
projectRootPath: options.projectRootPath
|
|
509
568
|
});
|
|
510
569
|
const session = {
|
|
511
570
|
id: randomUUID(),
|
|
@@ -587,7 +646,9 @@ async function startEnhanceServer(prompt, options = {}) {
|
|
|
587
646
|
}
|
|
588
647
|
const next = await enhancePrompt({
|
|
589
648
|
prompt: nextPrompt,
|
|
590
|
-
endpointOverride: options.endpointOverride
|
|
649
|
+
endpointOverride: options.endpointOverride,
|
|
650
|
+
conversationHistory: options.conversationHistory,
|
|
651
|
+
projectRootPath: options.projectRootPath
|
|
591
652
|
});
|
|
592
653
|
session.original = nextPrompt;
|
|
593
654
|
session.enhanced = next.enhanced;
|
|
@@ -610,10 +671,8 @@ async function startEnhanceServer(prompt, options = {}) {
|
|
|
610
671
|
const timeoutMs = 8 * 60 * 1e3;
|
|
611
672
|
const timeout = setTimeout(() => {
|
|
612
673
|
if (resolved) return;
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
rejectResult?.(new Error("User interaction timeout (8 minutes)"));
|
|
616
|
-
});
|
|
674
|
+
logger.info("\u4F1A\u8BDD\u8D85\u65F6\uFF0C\u81EA\u52A8\u4F7F\u7528\u589E\u5F3A\u7248\u7ED3\u679C");
|
|
675
|
+
finish(session.enhanced);
|
|
617
676
|
}, timeoutMs);
|
|
618
677
|
function abort(message) {
|
|
619
678
|
if (resolved) return;
|
|
@@ -651,3 +710,4 @@ async function startEnhanceServer(prompt, options = {}) {
|
|
|
651
710
|
export {
|
|
652
711
|
startEnhanceServer
|
|
653
712
|
};
|
|
713
|
+
//# sourceMappingURL=server-TGCR7VVZ.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lyy0709/contextweaver",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "A context weaving tool for LLMs — with Prompt Enhancer",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "lyy0709",
|
|
@@ -79,4 +79,4 @@
|
|
|
79
79
|
"tree-sitter-typescript"
|
|
80
80
|
]
|
|
81
81
|
}
|
|
82
|
-
}
|
|
82
|
+
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
codebaseRetrievalSchema,
|
|
3
|
-
handleCodebaseRetrieval
|
|
4
|
-
} from "./chunk-XVKMTPCT.js";
|
|
5
|
-
import "./chunk-LPFRFKFW.js";
|
|
6
|
-
import "./chunk-YVLGQTLG.js";
|
|
7
|
-
import "./chunk-V2USKRIC.js";
|
|
8
|
-
export {
|
|
9
|
-
codebaseRetrievalSchema,
|
|
10
|
-
handleCodebaseRetrieval
|
|
11
|
-
};
|
package/dist/logger-SF6S6GVR.js
DELETED