intention-coding 0.2.3 → 0.2.5
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/cli/analyze-image.d.ts +2 -0
- package/dist/config.d.ts +5 -0
- package/dist/index.js +650 -809
- package/dist/prompt/{change-analysis.md → change-analysis.ts} +2 -2
- package/dist/services/change-summarizer/prompt/change-analysis.d.ts +1 -0
- package/dist/services/claude-code/index.d.ts +6 -6
- package/dist/services/image-analysis/config.d.ts +14 -0
- package/dist/services/image-analysis/factory.d.ts +33 -0
- package/dist/services/image-analysis/image-analysis.d.ts +36 -0
- package/dist/services/image-analysis/image-encoder.d.ts +20 -0
- package/dist/services/image-analysis/image-validator.d.ts +30 -0
- package/dist/services/image-analysis/index.d.ts +29 -0
- package/dist/services/image-analysis/tools.d.ts +55 -0
- package/dist/services/image-analysis/types.d.ts +154 -0
- package/dist/services/index.d.ts +5 -0
- package/dist/{services → utils}/openai-service.d.ts +30 -0
- package/package.json +7 -6
package/dist/index.js
CHANGED
|
@@ -11,11 +11,6 @@ import mammoth from "mammoth";
|
|
|
11
11
|
import html_to_md from "html-to-md";
|
|
12
12
|
import { runCli as external_aico_pack_runCli } from "aico-pack";
|
|
13
13
|
import axios from "axios";
|
|
14
|
-
import { exec, spawn } from "node:child_process";
|
|
15
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
16
|
-
import { homedir } from "node:os";
|
|
17
|
-
import { resolve as external_node_path_resolve } from "node:path";
|
|
18
|
-
import { promisify } from "node:util";
|
|
19
14
|
import { execSync } from "child_process";
|
|
20
15
|
var __webpack_modules__ = {
|
|
21
16
|
"./src/config.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
@@ -23,10 +18,34 @@ var __webpack_modules__ = {
|
|
|
23
18
|
Gp: ()=>SERVICE_CONFIG,
|
|
24
19
|
aj: ()=>getExportsDir,
|
|
25
20
|
I4: ()=>PROJECT_ROOT,
|
|
26
|
-
WR: ()=>getStorageDir
|
|
21
|
+
WR: ()=>getStorageDir,
|
|
22
|
+
NL: ()=>initializeProjectRoot
|
|
27
23
|
});
|
|
28
24
|
var external_fs_ = __webpack_require__("fs");
|
|
29
|
-
|
|
25
|
+
var external_path_ = __webpack_require__("path");
|
|
26
|
+
var logger = __webpack_require__("./src/utils/logger.ts");
|
|
27
|
+
const detectProjectRoot = ()=>{
|
|
28
|
+
if (process.env.MCP_STORAGE_DIR) return process.env.MCP_STORAGE_DIR;
|
|
29
|
+
let currentDir = process.cwd();
|
|
30
|
+
const markers = [
|
|
31
|
+
'package.json',
|
|
32
|
+
'.git',
|
|
33
|
+
'Cargo.toml',
|
|
34
|
+
'pyproject.toml',
|
|
35
|
+
'go.mod'
|
|
36
|
+
];
|
|
37
|
+
while('/' !== currentDir){
|
|
38
|
+
for (const marker of markers){
|
|
39
|
+
const markerPath = (0, external_path_.resolve)(currentDir, marker);
|
|
40
|
+
if ((0, external_fs_.existsSync)(markerPath)) return currentDir;
|
|
41
|
+
}
|
|
42
|
+
const parentDir = (0, external_path_.dirname)(currentDir);
|
|
43
|
+
if (parentDir === currentDir) break;
|
|
44
|
+
currentDir = parentDir;
|
|
45
|
+
}
|
|
46
|
+
return process.cwd();
|
|
47
|
+
};
|
|
48
|
+
const PROJECT_ROOT = detectProjectRoot();
|
|
30
49
|
const getStorageDir = ()=>{
|
|
31
50
|
const envDir = PROJECT_ROOT + "/.aico";
|
|
32
51
|
if (!external_fs_.existsSync(envDir)) external_fs_.mkdirSync(envDir, {
|
|
@@ -42,6 +61,15 @@ var __webpack_modules__ = {
|
|
|
42
61
|
});
|
|
43
62
|
return exportsDir;
|
|
44
63
|
};
|
|
64
|
+
const initializeProjectRoot = ()=>{
|
|
65
|
+
const detectedRoot = detectProjectRoot();
|
|
66
|
+
if (process.env.MCP_STORAGE_DIR) logger.k.info(`\u{2705} \u{4F7F}\u{7528}\u{73AF}\u{5883}\u{53D8}\u{91CF} MCP_STORAGE_DIR: ${process.env.MCP_STORAGE_DIR}`);
|
|
67
|
+
else {
|
|
68
|
+
process.env.MCP_STORAGE_DIR = detectedRoot;
|
|
69
|
+
logger.k.info(`\u{1F50D} \u{81EA}\u{52A8}\u{68C0}\u{6D4B}\u{9879}\u{76EE}\u{6839}\u{76EE}\u{5F55}: ${detectedRoot}`);
|
|
70
|
+
}
|
|
71
|
+
logger.k.info(`\u{1F4C1} \u{9879}\u{76EE}\u{6839}\u{76EE}\u{5F55}\u{5DF2}\u{8BBE}\u{7F6E}\u{4E3A}: ${PROJECT_ROOT}`);
|
|
72
|
+
};
|
|
45
73
|
const SERVICE_CONFIG = {
|
|
46
74
|
name: "\u667A\u80FD\u8F6F\u4EF6\u661F\u5DE5\u5382",
|
|
47
75
|
version: "0.2.0",
|
|
@@ -616,12 +644,12 @@ var __webpack_modules__ = {
|
|
|
616
644
|
var esm = __webpack_require__("./node_modules/.pnpm/zod@3.25.64/node_modules/zod/dist/esm/index.js");
|
|
617
645
|
var promises_ = __webpack_require__("fs/promises");
|
|
618
646
|
var external_path_ = __webpack_require__("path");
|
|
619
|
-
var openai_service = __webpack_require__("./src/services/openai-service.ts");
|
|
620
647
|
var utils_logger = __webpack_require__("./src/utils/logger.ts");
|
|
621
648
|
var config = __webpack_require__("./src/config.ts");
|
|
622
649
|
var common = __webpack_require__("./src/utils/common.ts");
|
|
623
650
|
var file_storage = __webpack_require__("./src/db/file-storage.ts");
|
|
624
651
|
var external_crypto_ = __webpack_require__("crypto");
|
|
652
|
+
var openai_service = __webpack_require__("./src/utils/openai-service.ts");
|
|
625
653
|
esm.z.object({
|
|
626
654
|
status: esm.z["enum"]([
|
|
627
655
|
'pending',
|
|
@@ -1064,7 +1092,7 @@ ${generationResult.files.map((f)=>`- **${f.type}**: \`${f.path}\` (${f.size} \u{
|
|
|
1064
1092
|
try {
|
|
1065
1093
|
const result = await openai_service.rA.generateText({
|
|
1066
1094
|
prompt,
|
|
1067
|
-
model: "
|
|
1095
|
+
model: "kimi-k2-0711-preview",
|
|
1068
1096
|
max_tokens: 2000,
|
|
1069
1097
|
temperature: 0.3,
|
|
1070
1098
|
system_prompt: "\u4F60\u662F\u4E00\u4F4D\u4E13\u4E1A\u7684\u9879\u76EE\u7BA1\u7406\u4E13\u5BB6\uFF0C\u5584\u4E8E\u7F16\u5199\u6E05\u6670\u7684\u9879\u76EE\u6587\u6863\u3002\u8BF7\u4E25\u683C\u6309\u7167\u6A21\u677F\u683C\u5F0F\u751F\u6210\u5185\u5BB9\u3002"
|
|
@@ -1112,7 +1140,7 @@ ${generationResult.files.map((f)=>`- **${f.type}**: \`${f.path}\` (${f.size} \u{
|
|
|
1112
1140
|
try {
|
|
1113
1141
|
const result = await openai_service.rA.generateText({
|
|
1114
1142
|
prompt,
|
|
1115
|
-
model: "
|
|
1143
|
+
model: "kimi-k2-0711-preview",
|
|
1116
1144
|
max_tokens: 2000,
|
|
1117
1145
|
temperature: 0.3,
|
|
1118
1146
|
system_prompt: "\u4F60\u662F\u4E00\u4F4D\u4E13\u4E1A\u7684\u4EA7\u54C1\u7ECF\u7406\uFF0C\u5584\u4E8E\u5206\u6790\u7528\u6237\u9700\u6C42\u548C\u4EA7\u54C1\u5B9A\u4F4D\u3002\u8BF7\u4E25\u683C\u6309\u7167\u6A21\u677F\u683C\u5F0F\u751F\u6210\u5185\u5BB9\u3002"
|
|
@@ -1164,7 +1192,7 @@ ${generationResult.files.map((f)=>`- **${f.type}**: \`${f.path}\` (${f.size} \u{
|
|
|
1164
1192
|
try {
|
|
1165
1193
|
const result = await openai_service.rA.generateText({
|
|
1166
1194
|
prompt,
|
|
1167
|
-
model: "
|
|
1195
|
+
model: "kimi-k2-0711-preview",
|
|
1168
1196
|
max_tokens: 2000,
|
|
1169
1197
|
temperature: 0.3,
|
|
1170
1198
|
system_prompt: "\u4F60\u662F\u4E00\u4F4D\u4E13\u4E1A\u7684\u6280\u672F\u67B6\u6784\u5E08\uFF0C\u5584\u4E8E\u8BBE\u8BA1\u6280\u672F\u65B9\u6848\u548C\u9009\u62E9\u5408\u9002\u7684\u6280\u672F\u6808\u3002\u8BF7\u4E25\u683C\u6309\u7167\u6A21\u677F\u683C\u5F0F\u751F\u6210\u5185\u5BB9\u3002"
|
|
@@ -1239,7 +1267,7 @@ ${generationResult.files.map((f)=>`- **${f.type}**: \`${f.path}\` (${f.size} \u{
|
|
|
1239
1267
|
try {
|
|
1240
1268
|
const result = await openai_service.rA.generateText({
|
|
1241
1269
|
prompt,
|
|
1242
|
-
model: "
|
|
1270
|
+
model: "kimi-k2-0711-preview",
|
|
1243
1271
|
max_tokens: 2000,
|
|
1244
1272
|
temperature: 0.3,
|
|
1245
1273
|
system_prompt: "\u4F60\u662F\u4E00\u4F4D\u4E13\u4E1A\u7684\u7CFB\u7EDF\u67B6\u6784\u5E08\uFF0C\u5584\u4E8E\u8BBE\u8BA1\u7CFB\u7EDF\u67B6\u6784\u548C\u9009\u62E9\u5408\u9002\u7684\u8BBE\u8BA1\u6A21\u5F0F\u3002\u8BF7\u4E25\u683C\u6309\u7167\u6A21\u677F\u683C\u5F0F\u751F\u6210\u5185\u5BB9\u3002"
|
|
@@ -1316,7 +1344,7 @@ flowchart TD
|
|
|
1316
1344
|
try {
|
|
1317
1345
|
const result = await openai_service.rA.generateText({
|
|
1318
1346
|
prompt,
|
|
1319
|
-
model: "
|
|
1347
|
+
model: "kimi-k2-0711-preview",
|
|
1320
1348
|
max_tokens: 3000,
|
|
1321
1349
|
temperature: 0.3,
|
|
1322
1350
|
system_prompt: "\u4F60\u662F\u4E00\u4F4D\u4E13\u4E1A\u7684\u7528\u6237\u4F53\u9A8C\u8BBE\u8BA1\u5E08\uFF0C\u5584\u4E8E\u8BBE\u8BA1\u7528\u6237\u6D41\u7A0B\u548C\u4EA4\u4E92\u4F53\u9A8C\u3002\u8BF7\u4E25\u683C\u6309\u7167\u6A21\u677F\u683C\u5F0F\u751F\u6210\u5185\u5BB9\u3002"
|
|
@@ -1378,7 +1406,7 @@ flowchart TD
|
|
|
1378
1406
|
try {
|
|
1379
1407
|
const result = await openai_service.rA.generateText({
|
|
1380
1408
|
prompt,
|
|
1381
|
-
model: "
|
|
1409
|
+
model: "kimi-k2-0711-preview",
|
|
1382
1410
|
max_tokens: 2000,
|
|
1383
1411
|
temperature: 0.3,
|
|
1384
1412
|
system_prompt: "\u4F60\u662F\u4E00\u4F4D\u4E13\u4E1A\u7684\u6D4B\u8BD5\u5DE5\u7A0B\u5E08\uFF0C\u5584\u4E8E\u8BBE\u8BA1\u6D4B\u8BD5\u7B56\u7565\u548C\u6D4B\u8BD5\u65B9\u6848\u3002\u8BF7\u4E25\u683C\u6309\u7167\u6A21\u677F\u683C\u5F0F\u751F\u6210\u5185\u5BB9\u3002"
|
|
@@ -1503,7 +1531,7 @@ ${params.test_requirements || "\u5F85\u5B9A\u4E49"}
|
|
|
1503
1531
|
try {
|
|
1504
1532
|
const result = await openai_service.rA.generateText({
|
|
1505
1533
|
prompt,
|
|
1506
|
-
model: "
|
|
1534
|
+
model: "kimi-k2-0711-preview",
|
|
1507
1535
|
max_tokens: 4000,
|
|
1508
1536
|
temperature: 0.3,
|
|
1509
1537
|
system_prompt: `\u{4F60}\u{662F}\u{4E00}\u{4F4D}\u{4E13}\u{4E1A}\u{7684}${params.programming_language}\u{5F00}\u{53D1}\u{5DE5}\u{7A0B}\u{5E08}\u{FF0C}\u{5584}\u{4E8E}\u{7F16}\u{5199}\u{9AD8}\u{8D28}\u{91CF}\u{7684}\u{4EE3}\u{7801}\u{3002}\u{8BF7}\u{751F}\u{6210}\u{7ED3}\u{6784}\u{5316}\u{7684}\u{4EE3}\u{7801}\u{6587}\u{4EF6}\u{3002}`
|
|
@@ -1765,7 +1793,129 @@ flowchart TD
|
|
|
1765
1793
|
* \`techContext.md\``;
|
|
1766
1794
|
}
|
|
1767
1795
|
},
|
|
1768
|
-
"./src/
|
|
1796
|
+
"./src/utils/common.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1797
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
1798
|
+
He: ()=>sanitizeFileName,
|
|
1799
|
+
kK: ()=>validateAndResolvePath
|
|
1800
|
+
});
|
|
1801
|
+
var external_path_ = __webpack_require__("path");
|
|
1802
|
+
var external_fs_ = __webpack_require__("fs");
|
|
1803
|
+
var logger = __webpack_require__("./src/utils/logger.ts");
|
|
1804
|
+
const sanitizeFileName = (input)=>input.replace(/[\\/:*?"<>|\n\r#%&]/g, '').trim().replace(/\s+/g, '_').replace(/_+/g, '_').replace(/^_+|_+$/g, '');
|
|
1805
|
+
async function validateAndResolvePath(filePath) {
|
|
1806
|
+
if ('win32' === process.platform && filePath.startsWith('\\\\')) filePath = '\\\\?\\UNC\\' + filePath.substring(2);
|
|
1807
|
+
const normalized = external_path_["default"].normalize(filePath);
|
|
1808
|
+
const resolved = external_path_["default"].resolve(normalized);
|
|
1809
|
+
try {
|
|
1810
|
+
await external_fs_.promises.access(resolved, external_fs_.promises.constants.R_OK);
|
|
1811
|
+
} catch (error) {
|
|
1812
|
+
logger.k.warn(`\u{6587}\u{4EF6}\u{4E0D}\u{5B58}\u{5728}\u{6216}\u{4E0D}\u{53EF}\u{8BFB}: ${resolved}`, error);
|
|
1813
|
+
throw new Error(`\u{6587}\u{4EF6}\u{4E0D}\u{5B58}\u{5728}\u{6216}\u{4E0D}\u{53EF}\u{8BFB}: ${resolved}`);
|
|
1814
|
+
}
|
|
1815
|
+
return resolved;
|
|
1816
|
+
}
|
|
1817
|
+
},
|
|
1818
|
+
"./src/utils/logger.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1819
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
1820
|
+
k: ()=>logger
|
|
1821
|
+
});
|
|
1822
|
+
var config = __webpack_require__("./src/config.ts");
|
|
1823
|
+
var external_path_ = __webpack_require__("path");
|
|
1824
|
+
const logDir = (0, config.WR)() + '/logs';
|
|
1825
|
+
const levels = {
|
|
1826
|
+
error: 0,
|
|
1827
|
+
warn: 1,
|
|
1828
|
+
info: 2,
|
|
1829
|
+
debug: 3,
|
|
1830
|
+
verbose: 4
|
|
1831
|
+
};
|
|
1832
|
+
const colors = {
|
|
1833
|
+
error: 'red',
|
|
1834
|
+
warn: 'yellow',
|
|
1835
|
+
info: 'green',
|
|
1836
|
+
debug: 'blue',
|
|
1837
|
+
verbose: 'cyan'
|
|
1838
|
+
};
|
|
1839
|
+
winston.addColors(colors);
|
|
1840
|
+
const consoleFormat = winston.format.combine(winston.format.timestamp({
|
|
1841
|
+
format: 'YYYY-MM-DD HH:mm:ss'
|
|
1842
|
+
}), winston.format.colorize(), winston.format.printf(({ timestamp, level, message, ...meta })=>{
|
|
1843
|
+
const metaStr = Object.keys(meta).length ? JSON.stringify(meta, null, 2) : '';
|
|
1844
|
+
return `${timestamp} [${level}]: ${message} ${metaStr}`;
|
|
1845
|
+
}));
|
|
1846
|
+
const fileFormat = winston.format.combine(winston.format.timestamp(), winston.format.errors({
|
|
1847
|
+
stack: true
|
|
1848
|
+
}), winston.format.json());
|
|
1849
|
+
const exceptionFormat = winston.format.combine(winston.format.timestamp(), winston.format.errors({
|
|
1850
|
+
stack: true
|
|
1851
|
+
}), winston.format.printf((info)=>{
|
|
1852
|
+
const { timestamp, level, message, stack, ...meta } = info;
|
|
1853
|
+
const error = meta.error || meta;
|
|
1854
|
+
const errorInfo = {
|
|
1855
|
+
timestamp,
|
|
1856
|
+
level: level || 'error',
|
|
1857
|
+
message: message || 'Uncaught Exception',
|
|
1858
|
+
stack: stack || error && error.stack || 'No stack trace available',
|
|
1859
|
+
error: {
|
|
1860
|
+
name: error && error.name || 'Error',
|
|
1861
|
+
message: error && error.message || String(error || message),
|
|
1862
|
+
code: error && error.code || meta.code,
|
|
1863
|
+
...meta
|
|
1864
|
+
}
|
|
1865
|
+
};
|
|
1866
|
+
return JSON.stringify(errorInfo, null, 2);
|
|
1867
|
+
}));
|
|
1868
|
+
const transports = [
|
|
1869
|
+
new winston.transports.Console({
|
|
1870
|
+
format: consoleFormat,
|
|
1871
|
+
level: 'verbose'
|
|
1872
|
+
}),
|
|
1873
|
+
new winston_daily_rotate_file({
|
|
1874
|
+
filename: external_path_["default"].join(logDir, 'application-%DATE%.log'),
|
|
1875
|
+
datePattern: 'YYYY-MM-DD',
|
|
1876
|
+
zippedArchive: true,
|
|
1877
|
+
maxSize: '2m',
|
|
1878
|
+
maxFiles: '7d',
|
|
1879
|
+
format: fileFormat,
|
|
1880
|
+
level: 'info'
|
|
1881
|
+
})
|
|
1882
|
+
];
|
|
1883
|
+
const logger = winston.createLogger({
|
|
1884
|
+
level: 'debug',
|
|
1885
|
+
levels,
|
|
1886
|
+
format: winston.format.combine(winston.format.errors({
|
|
1887
|
+
stack: true
|
|
1888
|
+
}), winston.format.splat()),
|
|
1889
|
+
transports,
|
|
1890
|
+
exceptionHandlers: [
|
|
1891
|
+
new winston_daily_rotate_file({
|
|
1892
|
+
filename: external_path_["default"].join(logDir, 'exceptions-%DATE%.log'),
|
|
1893
|
+
datePattern: 'YYYY-MM-DD',
|
|
1894
|
+
zippedArchive: true,
|
|
1895
|
+
maxSize: '1m',
|
|
1896
|
+
maxFiles: '7d',
|
|
1897
|
+
format: exceptionFormat
|
|
1898
|
+
})
|
|
1899
|
+
],
|
|
1900
|
+
rejectionHandlers: [
|
|
1901
|
+
new winston_daily_rotate_file({
|
|
1902
|
+
filename: external_path_["default"].join(logDir, 'rejections-%DATE%.log'),
|
|
1903
|
+
datePattern: 'YYYY-MM-DD',
|
|
1904
|
+
zippedArchive: true,
|
|
1905
|
+
maxSize: '1m',
|
|
1906
|
+
maxFiles: '7d',
|
|
1907
|
+
format: exceptionFormat
|
|
1908
|
+
})
|
|
1909
|
+
]
|
|
1910
|
+
});
|
|
1911
|
+
process.on('SIGINT', ()=>{
|
|
1912
|
+
logger.end(()=>{
|
|
1913
|
+
logger.info("\u65E5\u5FD7\u5DF2\u5173\u95ED");
|
|
1914
|
+
process.exit(0);
|
|
1915
|
+
});
|
|
1916
|
+
});
|
|
1917
|
+
},
|
|
1918
|
+
"./src/utils/openai-service.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1769
1919
|
__webpack_require__.d(__webpack_exports__, {
|
|
1770
1920
|
rA: ()=>openAIService
|
|
1771
1921
|
});
|
|
@@ -1783,7 +1933,15 @@ flowchart TD
|
|
|
1783
1933
|
}
|
|
1784
1934
|
esm.z.object({
|
|
1785
1935
|
prompt: esm.z.string().describe("The detailed prompt for the AI model"),
|
|
1786
|
-
model: esm.z.string().optional().default("
|
|
1936
|
+
model: esm.z.string().optional().default("kimi-k2-0711-preview").describe("The model to use"),
|
|
1937
|
+
max_tokens: esm.z.number().optional().default(4000).describe("Maximum tokens to generate"),
|
|
1938
|
+
temperature: esm.z.number().optional().default(0.7).describe("Temperature for generation"),
|
|
1939
|
+
system_prompt: esm.z.string().optional().describe("System prompt to set behavior")
|
|
1940
|
+
});
|
|
1941
|
+
esm.z.object({
|
|
1942
|
+
prompt: esm.z.string().describe("The prompt describing what to analyze in the image"),
|
|
1943
|
+
image_base64: esm.z.string().describe("Base64 encoded image with data URI scheme"),
|
|
1944
|
+
model: esm.z.string().optional().default("moonshot-v1-128k-vision-preview").describe("The vision model to use"),
|
|
1787
1945
|
max_tokens: esm.z.number().optional().default(4000).describe("Maximum tokens to generate"),
|
|
1788
1946
|
temperature: esm.z.number().optional().default(0.7).describe("Temperature for generation"),
|
|
1789
1947
|
system_prompt: esm.z.string().optional().describe("System prompt to set behavior")
|
|
@@ -1922,138 +2080,92 @@ flowchart TD
|
|
|
1922
2080
|
throw error;
|
|
1923
2081
|
}
|
|
1924
2082
|
}
|
|
2083
|
+
async analyzeImage(params) {
|
|
2084
|
+
const { prompt, image_base64, model, max_tokens, temperature, system_prompt } = params;
|
|
2085
|
+
try {
|
|
2086
|
+
var _data_usage, _data_usage1, _data_usage2;
|
|
2087
|
+
logger.k.info('Calling OpenAI Vision API', {
|
|
2088
|
+
model,
|
|
2089
|
+
max_tokens,
|
|
2090
|
+
temperature,
|
|
2091
|
+
promptLength: prompt.length,
|
|
2092
|
+
imageSize: image_base64.length
|
|
2093
|
+
});
|
|
2094
|
+
const response = await fetch(`${this.baseUrl}/v1/chat/completions`, {
|
|
2095
|
+
method: 'POST',
|
|
2096
|
+
headers: {
|
|
2097
|
+
'Content-Type': 'application/json',
|
|
2098
|
+
Authorization: `Bearer ${this.apiKey}`
|
|
2099
|
+
},
|
|
2100
|
+
body: JSON.stringify({
|
|
2101
|
+
model,
|
|
2102
|
+
messages: [
|
|
2103
|
+
...system_prompt ? [
|
|
2104
|
+
{
|
|
2105
|
+
role: 'system',
|
|
2106
|
+
content: [
|
|
2107
|
+
{
|
|
2108
|
+
type: 'text',
|
|
2109
|
+
text: system_prompt
|
|
2110
|
+
}
|
|
2111
|
+
]
|
|
2112
|
+
}
|
|
2113
|
+
] : [],
|
|
2114
|
+
{
|
|
2115
|
+
role: 'user',
|
|
2116
|
+
content: [
|
|
2117
|
+
{
|
|
2118
|
+
type: 'image_url',
|
|
2119
|
+
image_url: {
|
|
2120
|
+
url: image_base64
|
|
2121
|
+
}
|
|
2122
|
+
},
|
|
2123
|
+
{
|
|
2124
|
+
type: 'text',
|
|
2125
|
+
text: prompt
|
|
2126
|
+
}
|
|
2127
|
+
]
|
|
2128
|
+
}
|
|
2129
|
+
],
|
|
2130
|
+
max_tokens,
|
|
2131
|
+
temperature,
|
|
2132
|
+
stream: false
|
|
2133
|
+
})
|
|
2134
|
+
});
|
|
2135
|
+
if (!response.ok) {
|
|
2136
|
+
const errorText = await response.text();
|
|
2137
|
+
throw new Error(`OpenAI Vision API error: ${response.status} ${response.statusText} - ${errorText}`);
|
|
2138
|
+
}
|
|
2139
|
+
const data = await response.json();
|
|
2140
|
+
if (!data.choices || 0 === data.choices.length) throw new Error('No choices returned from OpenAI Vision API');
|
|
2141
|
+
const content = data.choices[0].message.content;
|
|
2142
|
+
logger.k.info('OpenAI Vision API call successful', {
|
|
2143
|
+
model,
|
|
2144
|
+
promptTokens: null == (_data_usage = data.usage) ? void 0 : _data_usage.prompt_tokens,
|
|
2145
|
+
completionTokens: null == (_data_usage1 = data.usage) ? void 0 : _data_usage1.completion_tokens,
|
|
2146
|
+
totalTokens: null == (_data_usage2 = data.usage) ? void 0 : _data_usage2.total_tokens,
|
|
2147
|
+
contentLength: content.length
|
|
2148
|
+
});
|
|
2149
|
+
return content;
|
|
2150
|
+
} catch (error) {
|
|
2151
|
+
logger.k.error('OpenAI Vision API call failed', {
|
|
2152
|
+
error: error instanceof Error ? error.message : String(error),
|
|
2153
|
+
model,
|
|
2154
|
+
promptLength: prompt.length
|
|
2155
|
+
});
|
|
2156
|
+
throw error;
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
1925
2159
|
constructor(apiKey, baseUrl){
|
|
1926
2160
|
_define_property(this, "apiKey", void 0);
|
|
1927
2161
|
_define_property(this, "baseUrl", void 0);
|
|
1928
|
-
this.apiKey = apiKey || process.env.OPENAI_API_KEY || 'sk-
|
|
1929
|
-
this.baseUrl = baseUrl || process.env.OPENAI_BASE_URL || 'https://api.
|
|
2162
|
+
this.apiKey = apiKey || process.env.OPENAI_API_KEY || 'sk-fp8wJSigZBEP3x8y6MAZWGPuVIHJ5PDZtX9lMQQk8hjP2R0u';
|
|
2163
|
+
this.baseUrl = baseUrl || process.env.OPENAI_BASE_URL || 'https://api.moonshot.cn/v1/chat/completions';
|
|
1930
2164
|
if (!this.apiKey) throw new Error('API key is required. Please set OPENAI_API_KEY or SILICONFLOW_API_KEY environment variable.');
|
|
1931
2165
|
}
|
|
1932
2166
|
}
|
|
1933
2167
|
const openAIService = new OpenAIService();
|
|
1934
2168
|
},
|
|
1935
|
-
"./src/utils/common.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1936
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
1937
|
-
He: ()=>sanitizeFileName,
|
|
1938
|
-
kK: ()=>validateAndResolvePath
|
|
1939
|
-
});
|
|
1940
|
-
var external_path_ = __webpack_require__("path");
|
|
1941
|
-
var external_fs_ = __webpack_require__("fs");
|
|
1942
|
-
var logger = __webpack_require__("./src/utils/logger.ts");
|
|
1943
|
-
const sanitizeFileName = (input)=>input.replace(/[\\/:*?"<>|\n\r#%&]/g, '').trim().replace(/\s+/g, '_').replace(/_+/g, '_').replace(/^_+|_+$/g, '');
|
|
1944
|
-
async function validateAndResolvePath(filePath) {
|
|
1945
|
-
if ('win32' === process.platform && filePath.startsWith('\\\\')) filePath = '\\\\?\\UNC\\' + filePath.substring(2);
|
|
1946
|
-
const normalized = external_path_["default"].normalize(filePath);
|
|
1947
|
-
const resolved = external_path_["default"].resolve(normalized);
|
|
1948
|
-
try {
|
|
1949
|
-
await external_fs_.promises.access(resolved, external_fs_.promises.constants.R_OK);
|
|
1950
|
-
} catch (error) {
|
|
1951
|
-
logger.k.warn(`\u{6587}\u{4EF6}\u{4E0D}\u{5B58}\u{5728}\u{6216}\u{4E0D}\u{53EF}\u{8BFB}: ${resolved}`, error);
|
|
1952
|
-
throw new Error(`\u{6587}\u{4EF6}\u{4E0D}\u{5B58}\u{5728}\u{6216}\u{4E0D}\u{53EF}\u{8BFB}: ${resolved}`);
|
|
1953
|
-
}
|
|
1954
|
-
return resolved;
|
|
1955
|
-
}
|
|
1956
|
-
},
|
|
1957
|
-
"./src/utils/logger.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1958
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
1959
|
-
k: ()=>logger
|
|
1960
|
-
});
|
|
1961
|
-
var config = __webpack_require__("./src/config.ts");
|
|
1962
|
-
var external_path_ = __webpack_require__("path");
|
|
1963
|
-
const logDir = (0, config.WR)() + '/logs';
|
|
1964
|
-
const levels = {
|
|
1965
|
-
error: 0,
|
|
1966
|
-
warn: 1,
|
|
1967
|
-
info: 2,
|
|
1968
|
-
debug: 3,
|
|
1969
|
-
verbose: 4
|
|
1970
|
-
};
|
|
1971
|
-
const colors = {
|
|
1972
|
-
error: 'red',
|
|
1973
|
-
warn: 'yellow',
|
|
1974
|
-
info: 'green',
|
|
1975
|
-
debug: 'blue',
|
|
1976
|
-
verbose: 'cyan'
|
|
1977
|
-
};
|
|
1978
|
-
winston.addColors(colors);
|
|
1979
|
-
const consoleFormat = winston.format.combine(winston.format.timestamp({
|
|
1980
|
-
format: 'YYYY-MM-DD HH:mm:ss'
|
|
1981
|
-
}), winston.format.colorize(), winston.format.printf(({ timestamp, level, message, ...meta })=>{
|
|
1982
|
-
const metaStr = Object.keys(meta).length ? JSON.stringify(meta, null, 2) : '';
|
|
1983
|
-
return `${timestamp} [${level}]: ${message} ${metaStr}`;
|
|
1984
|
-
}));
|
|
1985
|
-
const fileFormat = winston.format.combine(winston.format.timestamp(), winston.format.errors({
|
|
1986
|
-
stack: true
|
|
1987
|
-
}), winston.format.json());
|
|
1988
|
-
const exceptionFormat = winston.format.combine(winston.format.timestamp(), winston.format.errors({
|
|
1989
|
-
stack: true
|
|
1990
|
-
}), winston.format.printf((info)=>{
|
|
1991
|
-
const { timestamp, level, message, stack, ...meta } = info;
|
|
1992
|
-
const error = meta.error || meta;
|
|
1993
|
-
const errorInfo = {
|
|
1994
|
-
timestamp,
|
|
1995
|
-
level: level || 'error',
|
|
1996
|
-
message: message || 'Uncaught Exception',
|
|
1997
|
-
stack: stack || error && error.stack || 'No stack trace available',
|
|
1998
|
-
error: {
|
|
1999
|
-
name: error && error.name || 'Error',
|
|
2000
|
-
message: error && error.message || String(error || message),
|
|
2001
|
-
code: error && error.code || meta.code,
|
|
2002
|
-
...meta
|
|
2003
|
-
}
|
|
2004
|
-
};
|
|
2005
|
-
return JSON.stringify(errorInfo, null, 2);
|
|
2006
|
-
}));
|
|
2007
|
-
const transports = [
|
|
2008
|
-
new winston.transports.Console({
|
|
2009
|
-
format: consoleFormat,
|
|
2010
|
-
level: 'verbose'
|
|
2011
|
-
}),
|
|
2012
|
-
new winston_daily_rotate_file({
|
|
2013
|
-
filename: external_path_["default"].join(logDir, 'application-%DATE%.log'),
|
|
2014
|
-
datePattern: 'YYYY-MM-DD',
|
|
2015
|
-
zippedArchive: true,
|
|
2016
|
-
maxSize: '2m',
|
|
2017
|
-
maxFiles: '7d',
|
|
2018
|
-
format: fileFormat,
|
|
2019
|
-
level: 'info'
|
|
2020
|
-
})
|
|
2021
|
-
];
|
|
2022
|
-
const logger = winston.createLogger({
|
|
2023
|
-
level: 'debug',
|
|
2024
|
-
levels,
|
|
2025
|
-
format: winston.format.combine(winston.format.errors({
|
|
2026
|
-
stack: true
|
|
2027
|
-
}), winston.format.splat()),
|
|
2028
|
-
transports,
|
|
2029
|
-
exceptionHandlers: [
|
|
2030
|
-
new winston_daily_rotate_file({
|
|
2031
|
-
filename: external_path_["default"].join(logDir, 'exceptions-%DATE%.log'),
|
|
2032
|
-
datePattern: 'YYYY-MM-DD',
|
|
2033
|
-
zippedArchive: true,
|
|
2034
|
-
maxSize: '1m',
|
|
2035
|
-
maxFiles: '7d',
|
|
2036
|
-
format: exceptionFormat
|
|
2037
|
-
})
|
|
2038
|
-
],
|
|
2039
|
-
rejectionHandlers: [
|
|
2040
|
-
new winston_daily_rotate_file({
|
|
2041
|
-
filename: external_path_["default"].join(logDir, 'rejections-%DATE%.log'),
|
|
2042
|
-
datePattern: 'YYYY-MM-DD',
|
|
2043
|
-
zippedArchive: true,
|
|
2044
|
-
maxSize: '1m',
|
|
2045
|
-
maxFiles: '7d',
|
|
2046
|
-
format: exceptionFormat
|
|
2047
|
-
})
|
|
2048
|
-
]
|
|
2049
|
-
});
|
|
2050
|
-
process.on('SIGINT', ()=>{
|
|
2051
|
-
logger.end(()=>{
|
|
2052
|
-
console.log("\u65E5\u5FD7\u5DF2\u5173\u95ED");
|
|
2053
|
-
process.exit(0);
|
|
2054
|
-
});
|
|
2055
|
-
});
|
|
2056
|
-
},
|
|
2057
2169
|
crypto: function(module) {
|
|
2058
2170
|
module.exports = __WEBPACK_EXTERNAL_MODULE_crypto__;
|
|
2059
2171
|
},
|
|
@@ -2071,6 +2183,7 @@ flowchart TD
|
|
|
2071
2183
|
},
|
|
2072
2184
|
"./node_modules/.pnpm/zod@3.25.64/node_modules/zod/dist/esm/index.js": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
2073
2185
|
__webpack_require__.d(__webpack_exports__, {
|
|
2186
|
+
jm: ()=>ZodError,
|
|
2074
2187
|
z: ()=>external_namespaceObject
|
|
2075
2188
|
});
|
|
2076
2189
|
var external_namespaceObject = {};
|
|
@@ -6334,7 +6447,7 @@ ${includeExamples ? `#### 9. \u{4EE3}\u{7801}\u{793A}\u{4F8B}\u{548C}\u{6A21}\u{
|
|
|
6334
6447
|
prompt: prompt,
|
|
6335
6448
|
systemPrompt: "\u4F60\u662F\u4E00\u4F4D\u4E13\u4E1A\u7684\u8F6F\u4EF6\u5F00\u53D1\u89C4\u8303\u4E13\u5BB6\uFF0C\u5584\u4E8E\u5206\u6790\u9879\u76EE\u67B6\u6784\u5E76\u5236\u5B9A\u5F00\u53D1\u89C4\u8303\u3002",
|
|
6336
6449
|
config: {
|
|
6337
|
-
model: "
|
|
6450
|
+
model: "kimi-k2-0711-preview",
|
|
6338
6451
|
maxTokens: 4000,
|
|
6339
6452
|
temperature: 0.3
|
|
6340
6453
|
}
|
|
@@ -6410,7 +6523,7 @@ ${includeExamples ? "10. **\u4EE3\u7801\u793A\u4F8B\u5E93** - \u9488\u5BF9\u8BE5
|
|
|
6410
6523
|
prompt: prompt,
|
|
6411
6524
|
systemPrompt: "\u4F60\u662F\u4E00\u4F4D\u4E13\u4E1A\u7684\u8F6F\u4EF6\u5F00\u53D1\u89C4\u8303\u4E13\u5BB6\uFF0C\u5584\u4E8E\u7F16\u5199\u8BE6\u7EC6\u7684\u5F00\u53D1\u6587\u6863\u548C\u89C4\u8303\u3002",
|
|
6412
6525
|
config: {
|
|
6413
|
-
model: "
|
|
6526
|
+
model: "kimi-k2-0711-preview",
|
|
6414
6527
|
maxTokens: 4000,
|
|
6415
6528
|
temperature: 0.3
|
|
6416
6529
|
}
|
|
@@ -7349,7 +7462,6 @@ const apiTestTools = [
|
|
|
7349
7462
|
updateTaskTool,
|
|
7350
7463
|
exportTestResultsTool
|
|
7351
7464
|
];
|
|
7352
|
-
var openai_service = __webpack_require__("./src/services/openai-service.ts");
|
|
7353
7465
|
async function extractTaskDescriptionFromRequirement(requirementDoc, featureName) {
|
|
7354
7466
|
try {
|
|
7355
7467
|
const lines = requirementDoc.split('\n');
|
|
@@ -7381,6 +7493,7 @@ async function extractTaskDescriptionFromRequirement(requirementDoc, featureName
|
|
|
7381
7493
|
return `\u{57FA}\u{4E8E}\u{9700}\u{6C42}\u{5206}\u{6790}\u{6587}\u{6863}\u{751F}\u{6210}\u{7684}${featureName}\u{529F}\u{80FD}\u{5B9E}\u{73B0}`;
|
|
7382
7494
|
}
|
|
7383
7495
|
}
|
|
7496
|
+
var openai_service = __webpack_require__("./src/utils/openai-service.ts");
|
|
7384
7497
|
const RequirementAnalyzerParams = esm.z.object({
|
|
7385
7498
|
input_type: esm.z["enum"]([
|
|
7386
7499
|
'text',
|
|
@@ -7703,7 +7816,7 @@ sequenceDiagram
|
|
|
7703
7816
|
try {
|
|
7704
7817
|
const result = await openai_service.rA.generateText({
|
|
7705
7818
|
prompt: prompt,
|
|
7706
|
-
model: "
|
|
7819
|
+
model: "kimi-k2-0711-preview",
|
|
7707
7820
|
max_tokens: 4000,
|
|
7708
7821
|
temperature: 0.7,
|
|
7709
7822
|
system_prompt: "\u4F60\u662F\u4E00\u4F4D\u4E13\u4E1A\u7684\u8F6F\u4EF6\u5DE5\u7A0B\u9700\u6C42\u5206\u6790\u4E13\u5BB6\uFF0C\u5584\u4E8E\u5C06\u7528\u6237\u9700\u6C42\u8F6C\u5316\u4E3A\u7ED3\u6784\u5316\u7684\u9700\u6C42\u6587\u6863\u3002"
|
|
@@ -8029,657 +8142,94 @@ function generateSequenceDiagramSection(analysis, featureName) {
|
|
|
8029
8142
|
`;
|
|
8030
8143
|
section += ` \u{540E}\u{7AEF}\u{670D}\u{52A1}->>\u{6570}\u{636E}\u{5E93}: \u{63D2}\u{5165}\u{65B0}\u{8BB0}\u{5F55}
|
|
8031
8144
|
`;
|
|
8032
|
-
section += ` \u{6570}\u{636E}\u{5E93}->>\u{540E}\u{7AEF}\u{670D}\u{52A1}: \u{8FD4}\u{56DE}\u{64CD}\u{4F5C}\u{7ED3}\u{679C}
|
|
8033
|
-
`;
|
|
8034
|
-
section += ` \u{540E}\u{7AEF}\u{670D}\u{52A1}->>\u{524D}\u{7AEF}\u{754C}\u{9762}: \u{8FD4}\u{56DE}\u{64CD}\u{4F5C}\u{72B6}\u{6001}
|
|
8035
|
-
`;
|
|
8036
|
-
section += ` \u{524D}\u{7AEF}\u{754C}\u{9762}->>\u{7528}\u{6237}: \u{663E}\u{793A}\u{64CD}\u{4F5C}\u{7ED3}\u{679C}
|
|
8037
|
-
`;
|
|
8038
|
-
}
|
|
8039
|
-
section += "```\n\n";
|
|
8040
|
-
return section;
|
|
8041
|
-
}
|
|
8042
|
-
function generateBusinessStates(analysis) {
|
|
8043
|
-
let section = `## 7. \u{4E1A}\u{52A1}\u{72B6}\u{6001}\u{63CF}\u{8FF0}
|
|
8044
|
-
|
|
8045
|
-
`;
|
|
8046
|
-
section += `||||\n`;
|
|
8047
|
-
section += `|---|---|---|\n`;
|
|
8048
|
-
section += `|**\u{72B6}\u{6001}\u{7F16}\u{53F7}**|**\u{72B6}\u{6001}\u{540D}\u{79F0}**|**\u{63CF}\u{8FF0}**|
|
|
8049
|
-
`;
|
|
8050
|
-
section += `|01|\u{5F85}\u{5904}\u{7406}|\u{65B0}\u{521B}\u{5EFA}\u{7684}\u{8BB0}\u{5F55}\u{FF0C}\u{7B49}\u{5F85}\u{5904}\u{7406}|
|
|
8051
|
-
`;
|
|
8052
|
-
section += `|02|\u{5904}\u{7406}\u{4E2D}|\u{6B63}\u{5728}\u{5904}\u{7406}\u{7684}\u{8BB0}\u{5F55}|
|
|
8053
|
-
`;
|
|
8054
|
-
section += `|03|\u{5DF2}\u{5B8C}\u{6210}|\u{5904}\u{7406}\u{5B8C}\u{6210}\u{7684}\u{8BB0}\u{5F55}|
|
|
8055
|
-
`;
|
|
8056
|
-
if (analysis.keywords.includes("\u5BA1\u6838")) {
|
|
8057
|
-
section += `|04|\u{5F85}\u{5BA1}\u{6838}|\u{63D0}\u{4EA4}\u{540E}\u{7B49}\u{5F85}\u{5BA1}\u{6838}|
|
|
8058
|
-
`;
|
|
8059
|
-
section += `|05|\u{5BA1}\u{6838}\u{901A}\u{8FC7}|\u{5BA1}\u{6838}\u{901A}\u{8FC7}\u{7684}\u{8BB0}\u{5F55}|
|
|
8060
|
-
`;
|
|
8061
|
-
section += `|06|\u{5BA1}\u{6838}\u{9A73}\u{56DE}|\u{5BA1}\u{6838}\u{4E0D}\u{901A}\u{8FC7}\u{7684}\u{8BB0}\u{5F55}|
|
|
8062
|
-
`;
|
|
8063
|
-
}
|
|
8064
|
-
section += `|99|\u{5DF2}\u{5220}\u{9664}|\u{903B}\u{8F91}\u{5220}\u{9664}\u{7684}\u{8BB0}\u{5F55}|
|
|
8065
|
-
|
|
8066
|
-
`;
|
|
8067
|
-
return section;
|
|
8068
|
-
}
|
|
8069
|
-
function generateProcessingLogic(analysis) {
|
|
8070
|
-
let section = `## 8. \u{5904}\u{7406}\u{903B}\u{8F91}\u{8BE6}\u{7EC6}\u{8BF4}\u{660E}
|
|
8071
|
-
|
|
8072
|
-
`;
|
|
8073
|
-
section += `### 8.1 \u{524D}\u{53F0}\u{4EA4}\u{4E92}\u{89C4}\u{5219}
|
|
8074
|
-
|
|
8075
|
-
`;
|
|
8076
|
-
section += `1. **\u{5B57}\u{6BB5}\u{9A8C}\u{8BC1}\u{89C4}\u{5219}**
|
|
8077
|
-
`;
|
|
8078
|
-
section += ` - \u{5FC5}\u{586B}\u{5B57}\u{6BB5}\u{4E0D}\u{80FD}\u{4E3A}\u{7A7A}
|
|
8079
|
-
`;
|
|
8080
|
-
section += ` - \u{6570}\u{636E}\u{683C}\u{5F0F}\u{5FC5}\u{987B}\u{7B26}\u{5408}\u{8981}\u{6C42}
|
|
8081
|
-
`;
|
|
8082
|
-
section += ` - \u{5B57}\u{7B26}\u{957F}\u{5EA6}\u{4E0D}\u{80FD}\u{8D85}\u{8FC7}\u{9650}\u{5236}
|
|
8083
|
-
|
|
8084
|
-
`;
|
|
8085
|
-
section += `2. **\u{64CD}\u{4F5C}\u{6743}\u{9650}\u{63A7}\u{5236}**
|
|
8086
|
-
`;
|
|
8087
|
-
section += ` - \u{7528}\u{6237}\u{9700}\u{8981}\u{5177}\u{5907}\u{76F8}\u{5E94}\u{7684}\u{529F}\u{80FD}\u{6743}\u{9650}
|
|
8088
|
-
`;
|
|
8089
|
-
section += ` - \u{5173}\u{952E}\u{64CD}\u{4F5C}\u{9700}\u{8981}\u{4E8C}\u{6B21}\u{786E}\u{8BA4}
|
|
8090
|
-
|
|
8091
|
-
`;
|
|
8092
|
-
section += `### 8.2 \u{540E}\u{53F0}\u{5904}\u{7406}\u{903B}\u{8F91}
|
|
8093
|
-
|
|
8094
|
-
`;
|
|
8095
|
-
if (analysis.businessRules && analysis.businessRules.length > 0) {
|
|
8096
|
-
section += `**\u{4E1A}\u{52A1}\u{89C4}\u{5219}**:
|
|
8097
|
-
`;
|
|
8098
|
-
analysis.businessRules.forEach((rule, index)=>{
|
|
8099
|
-
section += `${index + 1}. ${rule}\n`;
|
|
8100
|
-
});
|
|
8101
|
-
section += `\n`;
|
|
8102
|
-
}
|
|
8103
|
-
section += `**\u{6570}\u{636E}\u{5904}\u{7406}\u{6D41}\u{7A0B}**:
|
|
8104
|
-
`;
|
|
8105
|
-
section += `1. \u{63A5}\u{6536}\u{524D}\u{7AEF}\u{8BF7}\u{6C42}
|
|
8106
|
-
`;
|
|
8107
|
-
section += `2. \u{9A8C}\u{8BC1}\u{8BF7}\u{6C42}\u{53C2}\u{6570}
|
|
8108
|
-
`;
|
|
8109
|
-
section += `3. \u{6267}\u{884C}\u{4E1A}\u{52A1}\u{903B}\u{8F91}
|
|
8110
|
-
`;
|
|
8111
|
-
section += `4. \u{6570}\u{636E}\u{5E93}\u{64CD}\u{4F5C}
|
|
8112
|
-
`;
|
|
8113
|
-
section += `5. \u{8FD4}\u{56DE}\u{5904}\u{7406}\u{7ED3}\u{679C}
|
|
8114
|
-
|
|
8115
|
-
`;
|
|
8116
|
-
return section;
|
|
8117
|
-
}
|
|
8118
|
-
function _define_property(obj, key, value) {
|
|
8119
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
8120
|
-
value: value,
|
|
8121
|
-
enumerable: true,
|
|
8122
|
-
configurable: true,
|
|
8123
|
-
writable: true
|
|
8124
|
-
});
|
|
8125
|
-
else obj[key] = value;
|
|
8126
|
-
return obj;
|
|
8127
|
-
}
|
|
8128
|
-
const execAsync = promisify(exec);
|
|
8129
|
-
class SessionManager {
|
|
8130
|
-
async listSessions(filter) {
|
|
8131
|
-
try {
|
|
8132
|
-
const sessions = await this.loadSessions();
|
|
8133
|
-
return sessions.filter((session)=>this.matchesFilter(session, filter));
|
|
8134
|
-
} catch (error) {
|
|
8135
|
-
throw new Error(`Failed to list sessions: ${error instanceof Error ? error.message : String(error)}`);
|
|
8136
|
-
}
|
|
8137
|
-
}
|
|
8138
|
-
async getSession(sessionId) {
|
|
8139
|
-
const sessions = await this.loadSessions();
|
|
8140
|
-
const session = sessions.find((s)=>s.id === sessionId);
|
|
8141
|
-
if (!session) throw new Error(`Session ${sessionId} not found`);
|
|
8142
|
-
return session;
|
|
8143
|
-
}
|
|
8144
|
-
async cleanupSessions(options) {
|
|
8145
|
-
const sessions = await this.loadSessions();
|
|
8146
|
-
const now = new Date();
|
|
8147
|
-
const cutoffDate = (null == options ? void 0 : options.maxAgeDays) ? new Date(now.setDate(now.getDate() - options.maxAgeDays)).toISOString() : void 0;
|
|
8148
|
-
const sessionsToKeep = sessions.filter((session)=>{
|
|
8149
|
-
if (cutoffDate && session.lastAccessed < cutoffDate) return false;
|
|
8150
|
-
return true;
|
|
8151
|
-
}).slice(0, (null == options ? void 0 : options.maxSessions) || sessions.length);
|
|
8152
|
-
const deletedCount = sessions.length - sessionsToKeep.length;
|
|
8153
|
-
const freedBytes = sessions.filter((s)=>!sessionsToKeep.some((ks)=>ks.id === s.id)).reduce((sum, s)=>sum + s.size, 0);
|
|
8154
|
-
if (deletedCount > 0) await this.saveSessions(sessionsToKeep);
|
|
8155
|
-
return {
|
|
8156
|
-
deletedCount,
|
|
8157
|
-
freedBytes,
|
|
8158
|
-
remainingCount: sessionsToKeep.length
|
|
8159
|
-
};
|
|
8160
|
-
}
|
|
8161
|
-
async exportSession(sessionId, exportPath) {
|
|
8162
|
-
const session = await this.getSession(sessionId);
|
|
8163
|
-
try {
|
|
8164
|
-
writeFileSync(external_node_path_resolve(exportPath, `${sessionId}.json`), JSON.stringify(session, null, 2), 'utf8');
|
|
8165
|
-
} catch (error) {
|
|
8166
|
-
throw new Error(`Failed to export session: ${error instanceof Error ? error.message : String(error)}`);
|
|
8167
|
-
}
|
|
8168
|
-
}
|
|
8169
|
-
async importSession(importPath) {
|
|
8170
|
-
try {
|
|
8171
|
-
const content = readFileSync(importPath, 'utf8');
|
|
8172
|
-
const session = JSON.parse(content);
|
|
8173
|
-
const sessions = await this.loadSessions();
|
|
8174
|
-
const newSession = {
|
|
8175
|
-
...session,
|
|
8176
|
-
id: `session-${Date.now()}`,
|
|
8177
|
-
lastAccessed: new Date().toISOString()
|
|
8178
|
-
};
|
|
8179
|
-
await this.saveSessions([
|
|
8180
|
-
...sessions,
|
|
8181
|
-
newSession
|
|
8182
|
-
]);
|
|
8183
|
-
return newSession.id;
|
|
8184
|
-
} catch (error) {
|
|
8185
|
-
throw new Error(`Failed to import session: ${error instanceof Error ? error.message : String(error)}`);
|
|
8186
|
-
}
|
|
8187
|
-
}
|
|
8188
|
-
async getStorageStats() {
|
|
8189
|
-
const sessions = await this.loadSessions();
|
|
8190
|
-
if (0 === sessions.length) return {
|
|
8191
|
-
totalSessions: 0,
|
|
8192
|
-
totalSize: 0,
|
|
8193
|
-
averageSize: 0
|
|
8194
|
-
};
|
|
8195
|
-
const sortedSessions = [
|
|
8196
|
-
...sessions
|
|
8197
|
-
].sort((a, b)=>new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
|
|
8198
|
-
return {
|
|
8199
|
-
totalSessions: sessions.length,
|
|
8200
|
-
totalSize: sessions.reduce((sum, s)=>sum + s.size, 0),
|
|
8201
|
-
oldestSession: sortedSessions[0].createdAt,
|
|
8202
|
-
newestSession: sortedSessions[sortedSessions.length - 1].createdAt,
|
|
8203
|
-
averageSize: sessions.reduce((sum, s)=>sum + s.size, 0) / sessions.length
|
|
8204
|
-
};
|
|
8205
|
-
}
|
|
8206
|
-
async loadSessions() {
|
|
8207
|
-
try {
|
|
8208
|
-
const sessionsFile = external_node_path_resolve(this.storagePath, 'sessions.json');
|
|
8209
|
-
if (existsSync(sessionsFile)) {
|
|
8210
|
-
const content = readFileSync(sessionsFile, 'utf8');
|
|
8211
|
-
return JSON.parse(content);
|
|
8212
|
-
}
|
|
8213
|
-
return [];
|
|
8214
|
-
} catch (error) {
|
|
8215
|
-
throw new Error(`Failed to load sessions: ${error instanceof Error ? error.message : String(error)}`);
|
|
8216
|
-
}
|
|
8217
|
-
}
|
|
8218
|
-
async saveSessions(sessions) {
|
|
8219
|
-
try {
|
|
8220
|
-
writeFileSync(external_node_path_resolve(this.storagePath, 'sessions.json'), JSON.stringify(sessions, null, 2), 'utf8');
|
|
8221
|
-
} catch (error) {
|
|
8222
|
-
throw new Error(`Failed to save sessions: ${error instanceof Error ? error.message : String(error)}`);
|
|
8223
|
-
}
|
|
8224
|
-
}
|
|
8225
|
-
matchesFilter(session, filter) {
|
|
8226
|
-
var _session_metadata;
|
|
8227
|
-
if (!filter) return true;
|
|
8228
|
-
if (filter.project && (null == (_session_metadata = session.metadata) ? void 0 : _session_metadata.project) !== filter.project) return false;
|
|
8229
|
-
if (filter.dateRange) {
|
|
8230
|
-
const sessionDate = new Date(session.createdAt);
|
|
8231
|
-
if (filter.dateRange.start && new Date(filter.dateRange.start) > sessionDate) return false;
|
|
8232
|
-
if (filter.dateRange.end && new Date(filter.dateRange.end) < sessionDate) return false;
|
|
8233
|
-
}
|
|
8234
|
-
if (filter.sizeLimit && session.size > filter.sizeLimit) return false;
|
|
8235
|
-
return true;
|
|
8236
|
-
}
|
|
8237
|
-
constructor(options){
|
|
8238
|
-
_define_property(this, "storagePath", void 0);
|
|
8239
|
-
if (!options.storagePath) throw new Error('storagePath is required');
|
|
8240
|
-
this.storagePath = options.storagePath;
|
|
8241
|
-
}
|
|
8242
|
-
}
|
|
8243
|
-
const ClaudeCodeParams = esm.z.object({
|
|
8244
|
-
prompt: esm.z.string().describe("The detailed natural language prompt for Claude to execute"),
|
|
8245
|
-
workFolder: esm.z.string().optional().describe("The working directory for Claude execution. Must be an absolute path"),
|
|
8246
|
-
sessionId: esm.z.string().optional().describe("Optional session ID to resume a previous conversation"),
|
|
8247
|
-
allowedTools: esm.z.array(esm.z.string()).optional().describe("Optional array of allowed tool names to restrict Claude's capabilities"),
|
|
8248
|
-
debugMode: esm.z.boolean().optional().describe("Enable debug logging for detailed SDK messages"),
|
|
8249
|
-
claudePath: esm.z.string().optional().describe("Path to claude executable (optional, uses system PATH if not provided)"),
|
|
8250
|
-
maxRetries: esm.z.number().optional().describe("Maximum number of retries for failed operations (default: 2)"),
|
|
8251
|
-
timeout: esm.z.number().optional().describe("Operation timeout in milliseconds")
|
|
8252
|
-
});
|
|
8253
|
-
esm.z.object({
|
|
8254
|
-
prompt: esm.z.string().describe("The detailed natural language prompt for Claude to execute"),
|
|
8255
|
-
workFolder: esm.z.string().optional().describe("The working directory for Claude execution. Must be an absolute path"),
|
|
8256
|
-
sessionId: esm.z.string().optional().describe("Optional session ID to resume a previous conversation"),
|
|
8257
|
-
allowedTools: esm.z.array(esm.z.string()).optional().describe("Optional array of allowed tool names to restrict Claude's capabilities"),
|
|
8258
|
-
debugMode: esm.z.boolean().optional().describe("Enable debug logging for detailed SDK messages"),
|
|
8259
|
-
claudePath: esm.z.string().optional().describe("Path to claude executable (optional, uses system PATH if not provided)"),
|
|
8260
|
-
maxRetries: esm.z.number().optional().describe("Maximum number of retries for failed operations (default: 2)"),
|
|
8261
|
-
timeout: esm.z.number().optional().describe("Operation timeout in milliseconds")
|
|
8262
|
-
});
|
|
8263
|
-
function loadClaudeConfig() {
|
|
8264
|
-
const configPath = external_node_path_resolve(homedir(), '.claude-code', 'config.json');
|
|
8265
|
-
let config = {
|
|
8266
|
-
authToken: process.env.ANTHROPIC_AUTH_TOKEN || 'sk-0s3yu16dNo1tS8rh88afk4eWRCSj19fZEndqGZye0JWIrFkn',
|
|
8267
|
-
baseUrl: process.env.ANTHROPIC_BASE_URL || 'https://api.moonshot.cn/anthropic',
|
|
8268
|
-
sessionStoragePath: external_node_path_resolve(homedir(), '.claude-code', 'sessions'),
|
|
8269
|
-
debug: 'true' === process.env.CLAUDE_DEBUG
|
|
8270
|
-
};
|
|
8271
|
-
try {
|
|
8272
|
-
if (existsSync(configPath)) {
|
|
8273
|
-
const fileConfig = JSON.parse(readFileSync(configPath, 'utf8'));
|
|
8274
|
-
config = {
|
|
8275
|
-
...config,
|
|
8276
|
-
...fileConfig
|
|
8277
|
-
};
|
|
8278
|
-
}
|
|
8279
|
-
} catch (error) {
|
|
8280
|
-
src_logger.k.warn({
|
|
8281
|
-
module: 'claude_config',
|
|
8282
|
-
message: 'Failed to load config file',
|
|
8283
|
-
error: error instanceof Error ? error.message : String(error)
|
|
8284
|
-
});
|
|
8285
|
-
}
|
|
8286
|
-
return config;
|
|
8287
|
-
}
|
|
8288
|
-
function setupClaudeEnvironment(args) {
|
|
8289
|
-
const config = loadClaudeConfig();
|
|
8290
|
-
if (!config.authToken) throw new Error('ANTHROPIC_AUTH_TOKEN is required. Please set it in environment variables or config file');
|
|
8291
|
-
process.env.ANTHROPIC_AUTH_TOKEN = config.authToken;
|
|
8292
|
-
process.env.ANTHROPIC_BASE_URL = config.baseUrl;
|
|
8293
|
-
const claudeCodeDir = external_node_path_resolve(homedir(), '.claude-code');
|
|
8294
|
-
if (!existsSync(claudeCodeDir)) mkdirSync(claudeCodeDir, {
|
|
8295
|
-
recursive: true
|
|
8296
|
-
});
|
|
8297
|
-
const configPath = external_node_path_resolve(claudeCodeDir, 'config.json');
|
|
8298
|
-
if (!existsSync(configPath)) {
|
|
8299
|
-
const configData = {
|
|
8300
|
-
authToken: config.authToken,
|
|
8301
|
-
baseUrl: config.baseUrl,
|
|
8302
|
-
debug: config.debug || false
|
|
8303
|
-
};
|
|
8304
|
-
writeFileSync(configPath, JSON.stringify(configData, null, 2), 'utf8');
|
|
8305
|
-
}
|
|
8306
|
-
if (config.sessionStoragePath) try {
|
|
8307
|
-
mkdirSync(config.sessionStoragePath, {
|
|
8308
|
-
recursive: true
|
|
8309
|
-
});
|
|
8310
|
-
} catch (error) {
|
|
8311
|
-
src_logger.k.error({
|
|
8312
|
-
module: 'claude_config',
|
|
8313
|
-
message: 'Failed to create session storage directory',
|
|
8314
|
-
path: config.sessionStoragePath,
|
|
8315
|
-
error: error instanceof Error ? error.message : String(error)
|
|
8316
|
-
});
|
|
8317
|
-
}
|
|
8318
|
-
if ((null == args ? void 0 : args.debugMode) || config.debug) {
|
|
8319
|
-
src_logger.k.level = 'debug';
|
|
8320
|
-
process.env.DEBUG = 'claude-code*';
|
|
8321
|
-
}
|
|
8322
|
-
}
|
|
8323
|
-
async function ensureClaudeInstalled() {
|
|
8324
|
-
try {
|
|
8325
|
-
const { stdout } = await execAsync('which claude');
|
|
8326
|
-
if (stdout.trim()) {
|
|
8327
|
-
src_logger.k.info({
|
|
8328
|
-
module: 'claude_install',
|
|
8329
|
-
message: 'Claude CLI already installed',
|
|
8330
|
-
path: stdout.trim()
|
|
8331
|
-
});
|
|
8332
|
-
return stdout.trim();
|
|
8333
|
-
}
|
|
8334
|
-
} catch (error) {
|
|
8335
|
-
src_logger.k.debug({
|
|
8336
|
-
module: 'claude_install',
|
|
8337
|
-
message: 'Claude CLI not found, attempting installation',
|
|
8338
|
-
error: error instanceof Error ? error.message : String(error)
|
|
8339
|
-
});
|
|
8145
|
+
section += ` \u{6570}\u{636E}\u{5E93}->>\u{540E}\u{7AEF}\u{670D}\u{52A1}: \u{8FD4}\u{56DE}\u{64CD}\u{4F5C}\u{7ED3}\u{679C}
|
|
8146
|
+
`;
|
|
8147
|
+
section += ` \u{540E}\u{7AEF}\u{670D}\u{52A1}->>\u{524D}\u{7AEF}\u{754C}\u{9762}: \u{8FD4}\u{56DE}\u{64CD}\u{4F5C}\u{72B6}\u{6001}
|
|
8148
|
+
`;
|
|
8149
|
+
section += ` \u{524D}\u{7AEF}\u{754C}\u{9762}->>\u{7528}\u{6237}: \u{663E}\u{793A}\u{64CD}\u{4F5C}\u{7ED3}\u{679C}
|
|
8150
|
+
`;
|
|
8340
8151
|
}
|
|
8341
|
-
|
|
8342
|
-
|
|
8343
|
-
|
|
8344
|
-
|
|
8152
|
+
section += "```\n\n";
|
|
8153
|
+
return section;
|
|
8154
|
+
}
|
|
8155
|
+
function generateBusinessStates(analysis) {
|
|
8156
|
+
let section = `## 7. \u{4E1A}\u{52A1}\u{72B6}\u{6001}\u{63CF}\u{8FF0}
|
|
8157
|
+
|
|
8158
|
+
`;
|
|
8159
|
+
section += `||||\n`;
|
|
8160
|
+
section += `|---|---|---|\n`;
|
|
8161
|
+
section += `|**\u{72B6}\u{6001}\u{7F16}\u{53F7}**|**\u{72B6}\u{6001}\u{540D}\u{79F0}**|**\u{63CF}\u{8FF0}**|
|
|
8162
|
+
`;
|
|
8163
|
+
section += `|01|\u{5F85}\u{5904}\u{7406}|\u{65B0}\u{521B}\u{5EFA}\u{7684}\u{8BB0}\u{5F55}\u{FF0C}\u{7B49}\u{5F85}\u{5904}\u{7406}|
|
|
8164
|
+
`;
|
|
8165
|
+
section += `|02|\u{5904}\u{7406}\u{4E2D}|\u{6B63}\u{5728}\u{5904}\u{7406}\u{7684}\u{8BB0}\u{5F55}|
|
|
8166
|
+
`;
|
|
8167
|
+
section += `|03|\u{5DF2}\u{5B8C}\u{6210}|\u{5904}\u{7406}\u{5B8C}\u{6210}\u{7684}\u{8BB0}\u{5F55}|
|
|
8168
|
+
`;
|
|
8169
|
+
if (analysis.keywords.includes("\u5BA1\u6838")) {
|
|
8170
|
+
section += `|04|\u{5F85}\u{5BA1}\u{6838}|\u{63D0}\u{4EA4}\u{540E}\u{7B49}\u{5F85}\u{5BA1}\u{6838}|
|
|
8171
|
+
`;
|
|
8172
|
+
section += `|05|\u{5BA1}\u{6838}\u{901A}\u{8FC7}|\u{5BA1}\u{6838}\u{901A}\u{8FC7}\u{7684}\u{8BB0}\u{5F55}|
|
|
8173
|
+
`;
|
|
8174
|
+
section += `|06|\u{5BA1}\u{6838}\u{9A73}\u{56DE}|\u{5BA1}\u{6838}\u{4E0D}\u{901A}\u{8FC7}\u{7684}\u{8BB0}\u{5F55}|
|
|
8175
|
+
`;
|
|
8345
8176
|
}
|
|
8346
|
-
|
|
8347
|
-
|
|
8348
|
-
|
|
8349
|
-
|
|
8350
|
-
|
|
8351
|
-
|
|
8352
|
-
|
|
8353
|
-
|
|
8354
|
-
|
|
8355
|
-
|
|
8356
|
-
|
|
8357
|
-
|
|
8358
|
-
|
|
8359
|
-
|
|
8360
|
-
|
|
8361
|
-
|
|
8362
|
-
|
|
8363
|
-
|
|
8364
|
-
|
|
8365
|
-
|
|
8366
|
-
|
|
8367
|
-
|
|
8177
|
+
section += `|99|\u{5DF2}\u{5220}\u{9664}|\u{903B}\u{8F91}\u{5220}\u{9664}\u{7684}\u{8BB0}\u{5F55}|
|
|
8178
|
+
|
|
8179
|
+
`;
|
|
8180
|
+
return section;
|
|
8181
|
+
}
|
|
8182
|
+
function generateProcessingLogic(analysis) {
|
|
8183
|
+
let section = `## 8. \u{5904}\u{7406}\u{903B}\u{8F91}\u{8BE6}\u{7EC6}\u{8BF4}\u{660E}
|
|
8184
|
+
|
|
8185
|
+
`;
|
|
8186
|
+
section += `### 8.1 \u{524D}\u{53F0}\u{4EA4}\u{4E92}\u{89C4}\u{5219}
|
|
8187
|
+
|
|
8188
|
+
`;
|
|
8189
|
+
section += `1. **\u{5B57}\u{6BB5}\u{9A8C}\u{8BC1}\u{89C4}\u{5219}**
|
|
8190
|
+
`;
|
|
8191
|
+
section += ` - \u{5FC5}\u{586B}\u{5B57}\u{6BB5}\u{4E0D}\u{80FD}\u{4E3A}\u{7A7A}
|
|
8192
|
+
`;
|
|
8193
|
+
section += ` - \u{6570}\u{636E}\u{683C}\u{5F0F}\u{5FC5}\u{987B}\u{7B26}\u{5408}\u{8981}\u{6C42}
|
|
8194
|
+
`;
|
|
8195
|
+
section += ` - \u{5B57}\u{7B26}\u{957F}\u{5EA6}\u{4E0D}\u{80FD}\u{8D85}\u{8FC7}\u{9650}\u{5236}
|
|
8196
|
+
|
|
8197
|
+
`;
|
|
8198
|
+
section += `2. **\u{64CD}\u{4F5C}\u{6743}\u{9650}\u{63A7}\u{5236}**
|
|
8199
|
+
`;
|
|
8200
|
+
section += ` - \u{7528}\u{6237}\u{9700}\u{8981}\u{5177}\u{5907}\u{76F8}\u{5E94}\u{7684}\u{529F}\u{80FD}\u{6743}\u{9650}
|
|
8201
|
+
`;
|
|
8202
|
+
section += ` - \u{5173}\u{952E}\u{64CD}\u{4F5C}\u{9700}\u{8981}\u{4E8C}\u{6B21}\u{786E}\u{8BA4}
|
|
8203
|
+
|
|
8204
|
+
`;
|
|
8205
|
+
section += `### 8.2 \u{540E}\u{53F0}\u{5904}\u{7406}\u{903B}\u{8F91}
|
|
8206
|
+
|
|
8207
|
+
`;
|
|
8208
|
+
if (analysis.businessRules && analysis.businessRules.length > 0) {
|
|
8209
|
+
section += `**\u{4E1A}\u{52A1}\u{89C4}\u{5219}**:
|
|
8210
|
+
`;
|
|
8211
|
+
analysis.businessRules.forEach((rule, index)=>{
|
|
8212
|
+
section += `${index + 1}. ${rule}\n`;
|
|
8368
8213
|
});
|
|
8369
|
-
|
|
8214
|
+
section += `\n`;
|
|
8370
8215
|
}
|
|
8216
|
+
section += `**\u{6570}\u{636E}\u{5904}\u{7406}\u{6D41}\u{7A0B}**:
|
|
8217
|
+
`;
|
|
8218
|
+
section += `1. \u{63A5}\u{6536}\u{524D}\u{7AEF}\u{8BF7}\u{6C42}
|
|
8219
|
+
`;
|
|
8220
|
+
section += `2. \u{9A8C}\u{8BC1}\u{8BF7}\u{6C42}\u{53C2}\u{6570}
|
|
8221
|
+
`;
|
|
8222
|
+
section += `3. \u{6267}\u{884C}\u{4E1A}\u{52A1}\u{903B}\u{8F91}
|
|
8223
|
+
`;
|
|
8224
|
+
section += `4. \u{6570}\u{636E}\u{5E93}\u{64CD}\u{4F5C}
|
|
8225
|
+
`;
|
|
8226
|
+
section += `5. \u{8FD4}\u{56DE}\u{5904}\u{7406}\u{7ED3}\u{679C}
|
|
8227
|
+
|
|
8228
|
+
`;
|
|
8229
|
+
return section;
|
|
8371
8230
|
}
|
|
8372
|
-
async function runClaudeWithTerminal(args) {
|
|
8373
|
-
return new Promise(async (resolve, reject)=>{
|
|
8374
|
-
try {
|
|
8375
|
-
setupClaudeEnvironment({
|
|
8376
|
-
debugMode: args.debugMode
|
|
8377
|
-
});
|
|
8378
|
-
await ensureClaudeInstalled();
|
|
8379
|
-
let effectiveCwd = homedir();
|
|
8380
|
-
if (args.workFolder) {
|
|
8381
|
-
const resolvedCwd = external_node_path_resolve(args.workFolder);
|
|
8382
|
-
if (existsSync(resolvedCwd)) effectiveCwd = resolvedCwd;
|
|
8383
|
-
else src_logger.k.warn({
|
|
8384
|
-
module: 'claude_code',
|
|
8385
|
-
message: 'Specified workFolder does not exist, using default',
|
|
8386
|
-
workFolder: args.workFolder,
|
|
8387
|
-
defaultCwd: effectiveCwd
|
|
8388
|
-
});
|
|
8389
|
-
}
|
|
8390
|
-
const cliArgs = [
|
|
8391
|
-
'--dangerously-skip-permissions'
|
|
8392
|
-
];
|
|
8393
|
-
if (args.prompt && args.prompt.trim()) cliArgs.push('--print', args.prompt);
|
|
8394
|
-
if (args.sessionId) cliArgs.push('--resume', args.sessionId);
|
|
8395
|
-
cliArgs.push('--output-format', 'json', '--verbose');
|
|
8396
|
-
if (args.allowedTools && args.allowedTools.length > 0) for (const tool of args.allowedTools)cliArgs.push('--allowedTools', tool);
|
|
8397
|
-
try {
|
|
8398
|
-
const claudeConfigPath = external_node_path_resolve(homedir(), '.claude.json');
|
|
8399
|
-
if (existsSync(claudeConfigPath)) {
|
|
8400
|
-
const config = JSON.parse(readFileSync(claudeConfigPath, 'utf8'));
|
|
8401
|
-
const hasMcpServers = config.mcpServers && Object.keys(config.mcpServers).length > 0;
|
|
8402
|
-
if (hasMcpServers) cliArgs.push('--mcp-config', claudeConfigPath);
|
|
8403
|
-
}
|
|
8404
|
-
} catch (error) {
|
|
8405
|
-
src_logger.k.warn({
|
|
8406
|
-
module: 'claude_code',
|
|
8407
|
-
message: 'Failed to check MCP config',
|
|
8408
|
-
error: error instanceof Error ? error.message : String(error)
|
|
8409
|
-
});
|
|
8410
|
-
}
|
|
8411
|
-
if (!args.sessionId) cliArgs.push('--model', 'sonnet');
|
|
8412
|
-
src_logger.k.debug({
|
|
8413
|
-
module: 'claude_code',
|
|
8414
|
-
message: 'Invoking Claude CLI',
|
|
8415
|
-
command: `claude ${cliArgs.join(' ')}`,
|
|
8416
|
-
prompt: args.prompt.substring(0, 100) + '...',
|
|
8417
|
-
workFolder: effectiveCwd,
|
|
8418
|
-
sessionId: args.sessionId || 'new'
|
|
8419
|
-
});
|
|
8420
|
-
const claudeProcess = spawn('claude', cliArgs, {
|
|
8421
|
-
cwd: effectiveCwd,
|
|
8422
|
-
stdio: [
|
|
8423
|
-
'pipe',
|
|
8424
|
-
'pipe',
|
|
8425
|
-
'pipe'
|
|
8426
|
-
],
|
|
8427
|
-
env: {
|
|
8428
|
-
...process.env,
|
|
8429
|
-
ANTHROPIC_AUTH_TOKEN: process.env.ANTHROPIC_AUTH_TOKEN || loadClaudeConfig().authToken,
|
|
8430
|
-
ANTHROPIC_BASE_URL: process.env.ANTHROPIC_BASE_URL || loadClaudeConfig().baseUrl
|
|
8431
|
-
}
|
|
8432
|
-
});
|
|
8433
|
-
let output = '';
|
|
8434
|
-
let errorOutput = '';
|
|
8435
|
-
claudeProcess.stdout.on('data', (data)=>{
|
|
8436
|
-
const chunk = data.toString();
|
|
8437
|
-
output += chunk;
|
|
8438
|
-
try {
|
|
8439
|
-
const lines = chunk.split('\n').filter((line)=>line.trim());
|
|
8440
|
-
for (const line of lines){
|
|
8441
|
-
const parsed = JSON.parse(line);
|
|
8442
|
-
if ('assistant' === parsed.type && parsed.content) src_logger.k.debug({
|
|
8443
|
-
module: 'claude_code',
|
|
8444
|
-
message: 'Claude response chunk',
|
|
8445
|
-
content: parsed.content
|
|
8446
|
-
});
|
|
8447
|
-
}
|
|
8448
|
-
} catch (e) {
|
|
8449
|
-
src_logger.k.debug({
|
|
8450
|
-
module: 'claude_code',
|
|
8451
|
-
message: 'Raw Claude output',
|
|
8452
|
-
output: chunk
|
|
8453
|
-
});
|
|
8454
|
-
}
|
|
8455
|
-
});
|
|
8456
|
-
claudeProcess.stderr.on('data', (data)=>{
|
|
8457
|
-
errorOutput += data.toString();
|
|
8458
|
-
src_logger.k.error({
|
|
8459
|
-
module: 'claude_code',
|
|
8460
|
-
message: 'Claude CLI stderr',
|
|
8461
|
-
error: data.toString()
|
|
8462
|
-
});
|
|
8463
|
-
});
|
|
8464
|
-
claudeProcess.on('close', (code)=>{
|
|
8465
|
-
if (0 === code) {
|
|
8466
|
-
src_logger.k.info({
|
|
8467
|
-
module: 'claude_code',
|
|
8468
|
-
message: 'Claude CLI execution completed',
|
|
8469
|
-
workFolder: effectiveCwd,
|
|
8470
|
-
outputLength: output.length
|
|
8471
|
-
});
|
|
8472
|
-
try {
|
|
8473
|
-
let finalOutput = output;
|
|
8474
|
-
const lines = output.split('\n').filter((line)=>line.trim());
|
|
8475
|
-
const contents = [];
|
|
8476
|
-
for (const line of lines)try {
|
|
8477
|
-
const parsed = JSON.parse(line);
|
|
8478
|
-
if ('assistant' === parsed.type && parsed.content) contents.push(parsed.content);
|
|
8479
|
-
else if ('result' === parsed.type) contents.push(`Result: ${JSON.stringify(parsed.result || parsed.content, null, 2)}`);
|
|
8480
|
-
} catch (e) {
|
|
8481
|
-
contents.push(line);
|
|
8482
|
-
}
|
|
8483
|
-
if (contents.length > 0) finalOutput = contents.join('\n');
|
|
8484
|
-
resolve(finalOutput);
|
|
8485
|
-
} catch (error) {
|
|
8486
|
-
resolve(output);
|
|
8487
|
-
}
|
|
8488
|
-
} else {
|
|
8489
|
-
const error = new Error(`Claude CLI exited with code ${code}: ${errorOutput || output}`);
|
|
8490
|
-
src_logger.k.error({
|
|
8491
|
-
module: 'claude_code',
|
|
8492
|
-
message: 'Claude CLI execution failed',
|
|
8493
|
-
error: error.message,
|
|
8494
|
-
exitCode: code
|
|
8495
|
-
});
|
|
8496
|
-
reject(error);
|
|
8497
|
-
}
|
|
8498
|
-
});
|
|
8499
|
-
claudeProcess.on('error', (error)=>{
|
|
8500
|
-
src_logger.k.error({
|
|
8501
|
-
module: 'claude_code',
|
|
8502
|
-
message: 'Failed to spawn Claude CLI process',
|
|
8503
|
-
error: error.message
|
|
8504
|
-
});
|
|
8505
|
-
reject(new Error(`Failed to start Claude CLI: ${error.message}`));
|
|
8506
|
-
});
|
|
8507
|
-
claudeProcess.stdin.end();
|
|
8508
|
-
} catch (error) {
|
|
8509
|
-
src_logger.k.error({
|
|
8510
|
-
module: 'claude_code',
|
|
8511
|
-
message: 'Failed to execute Claude command',
|
|
8512
|
-
error: error instanceof Error ? error.message : String(error)
|
|
8513
|
-
});
|
|
8514
|
-
reject(new Error(`Claude execution failed: ${error instanceof Error ? error.message : String(error)}`));
|
|
8515
|
-
}
|
|
8516
|
-
});
|
|
8517
|
-
}
|
|
8518
|
-
const claudeCode = {
|
|
8519
|
-
name: "cc",
|
|
8520
|
-
description: `Claude Code\u{FF1A}\u{901A}\u{8FC7}Claude Code CLI\u{8FDB}\u{884C}\u{4EE3}\u{7801}\u{3001}\u{6587}\u{4EF6}\u{3001}Git\u{548C}\u{7EC8}\u{7AEF}\u{64CD}\u{4F5C}\u{7684}\u{591A}\u{529F}\u{80FD}\u{52A9}\u{624B}
|
|
8521
|
-
|
|
8522
|
-
\u{529F}\u{80FD}\u{FF1A}
|
|
8523
|
-
\u{2022} \u{6587}\u{4EF6}\u{64CD}\u{4F5C}\u{FF1A}\u{521B}\u{5EFA}\u{3001}\u{8BFB}\u{53D6}\u{3001}\u{7F16}\u{8F91}\u{3001}\u{79FB}\u{52A8}\u{3001}\u{590D}\u{5236}\u{3001}\u{5220}\u{9664}\u{3001}\u{5217}\u{51FA}\u{6587}\u{4EF6}\u{FF0C}\u{5206}\u{6790}\u{56FE}\u{50CF}
|
|
8524
|
-
\u{2022} \u{4EE3}\u{7801}\u{FF1A}\u{751F}\u{6210}\u{3001}\u{5206}\u{6790}\u{3001}\u{91CD}\u{6784}\u{3001}\u{4FEE}\u{590D}\u{4EE3}\u{7801}
|
|
8525
|
-
\u{2022} Git\u{FF1A}\u{6682}\u{5B58}\u{3001}\u{63D0}\u{4EA4}\u{3001}\u{63A8}\u{9001}\u{3001}\u{6807}\u{7B7E}\u{5DE5}\u{4F5C}\u{6D41}
|
|
8526
|
-
\u{2022} \u{7EC8}\u{7AEF}\u{FF1A}\u{8FD0}\u{884C}\u{4EFB}\u{4F55}CLI\u{547D}\u{4EE4}\u{6216}\u{6253}\u{5F00}URL
|
|
8527
|
-
\u{2022} \u{7F51}\u{7EDC}\u{641C}\u{7D22}\u{548C}\u{5185}\u{5BB9}\u{6458}\u{8981}
|
|
8528
|
-
\u{2022} \u{591A}\u{6B65}\u{9AA4}\u{5DE5}\u{4F5C}\u{6D41}\u{FF08}\u{7248}\u{672C}\u{66F4}\u{65B0}\u{3001}\u{53D8}\u{66F4}\u{65E5}\u{5FD7}\u{66F4}\u{65B0}\u{3001}\u{53D1}\u{5E03}\u{6807}\u{7B7E}\u{FF09}
|
|
8529
|
-
\u{2022} \u{9700}\u{6C42}\u{5206}\u{6790}
|
|
8530
|
-
\u{2022} \u{4F1A}\u{8BDD}\u{7BA1}\u{7406}\u{FF1A}\u{652F}\u{6301}\u{4F1A}\u{8BDD}\u{6062}\u{590D}\u{548C}\u{8FDE}\u{7EED}\u{6027}\u{5BF9}\u{8BDD}
|
|
8531
|
-
|
|
8532
|
-
\u{4F7F}\u{7528}\u{63D0}\u{793A}\u{FF1A}
|
|
8533
|
-
1. \u{5BF9}\u{4E8E}\u{590D}\u{6742}\u{4EFB}\u{52A1}\u{FF0C}\u{4FDD}\u{6301}\u{7B80}\u{6D01}\u{660E}\u{786E}
|
|
8534
|
-
2. \u{4F7F}\u{7528}workFolder\u{4E3A}\u{6587}\u{4EF6}\u{64CD}\u{4F5C}\u{8BBE}\u{7F6E}\u{5DE5}\u{4F5C}\u{76EE}\u{5F55}\u{4E0A}\u{4E0B}\u{6587}
|
|
8535
|
-
3. \u{4F7F}\u{7528}sessionId\u{6062}\u{590D}\u{4E4B}\u{524D}\u{7684}\u{5BF9}\u{8BDD}\u{4F1A}\u{8BDD}`,
|
|
8536
|
-
parameters: ClaudeCodeParams,
|
|
8537
|
-
execute: async (args)=>runClaudeWithTerminal(args)
|
|
8538
|
-
};
|
|
8539
|
-
const claudeCodeSessions = {
|
|
8540
|
-
name: "ccs",
|
|
8541
|
-
description: `Claude Code\u{4F1A}\u{8BDD}\u{7BA1}\u{7406}\u{FF1A}\u{7BA1}\u{7406}Claude Code\u{7684}\u{5BF9}\u{8BDD}\u{4F1A}\u{8BDD}
|
|
8542
|
-
|
|
8543
|
-
\u{529F}\u{80FD}\u{FF1A}
|
|
8544
|
-
\u{2022} \u{5217}\u{51FA}\u{6240}\u{6709}\u{53EF}\u{7528}\u{7684}\u{4F1A}\u{8BDD}\u{FF08}\u{652F}\u{6301}\u{8FC7}\u{6EE4}\u{548C}\u{5206}\u{9875}\u{FF09}
|
|
8545
|
-
\u{2022} \u{83B7}\u{53D6}\u{4F1A}\u{8BDD}\u{8BE6}\u{60C5}\u{548C}\u{5143}\u{6570}\u{636E}\u{FF08}\u{5305}\u{62EC}\u{521B}\u{5EFA}\u{65F6}\u{95F4}\u{3001}\u{6700}\u{540E}\u{8BBF}\u{95EE}\u{65F6}\u{95F4}\u{3001}\u{4E0A}\u{4E0B}\u{6587}\u{6458}\u{8981}\u{FF09}
|
|
8546
|
-
\u{2022} \u{6E05}\u{7406}\u{65E7}\u{4F1A}\u{8BDD}\u{FF08}\u{6309}\u{65F6}\u{95F4}\u{6216}\u{5927}\u{5C0F}\u{FF09}
|
|
8547
|
-
\u{2022} \u{5BFC}\u{5165}/\u{5BFC}\u{51FA}\u{4F1A}\u{8BDD}\u{6570}\u{636E}
|
|
8548
|
-
\u{2022} \u{4F1A}\u{8BDD}\u{5B58}\u{50A8}\u{7BA1}\u{7406}\u{FF08}\u{538B}\u{7F29}\u{3001}\u{5907}\u{4EFD}\u{FF09}
|
|
8549
|
-
|
|
8550
|
-
\u{4F7F}\u{7528}\u{573A}\u{666F}\u{FF1A}
|
|
8551
|
-
\u{2022} \u{9700}\u{8981}\u{6062}\u{590D}\u{4E4B}\u{524D}\u{7684}\u{5BF9}\u{8BDD}\u{4E0A}\u{4E0B}\u{6587}
|
|
8552
|
-
\u{2022} \u{7BA1}\u{7406}\u{591A}\u{4E2A}\u{9879}\u{76EE}\u{7684}\u{4E0D}\u{540C}\u{4F1A}\u{8BDD}
|
|
8553
|
-
\u{2022} \u{6E05}\u{7406}\u{4E0D}\u{518D}\u{9700}\u{8981}\u{7684}\u{4F1A}\u{8BDD}\u{6570}\u{636E}
|
|
8554
|
-
\u{2022} \u{8FC1}\u{79FB}\u{6216}\u{5907}\u{4EFD}\u{4F1A}\u{8BDD}\u{6570}\u{636E}`,
|
|
8555
|
-
parameters: esm.z.object({
|
|
8556
|
-
action: esm.z["enum"]([
|
|
8557
|
-
'list',
|
|
8558
|
-
'info',
|
|
8559
|
-
'cleanup',
|
|
8560
|
-
'export',
|
|
8561
|
-
'import',
|
|
8562
|
-
'stats'
|
|
8563
|
-
]).describe('Action to perform on sessions'),
|
|
8564
|
-
sessionId: esm.z.string().optional().describe('Session ID for info/export actions'),
|
|
8565
|
-
filter: esm.z.object({
|
|
8566
|
-
project: esm.z.string().optional().describe('Filter by project name'),
|
|
8567
|
-
dateRange: esm.z.object({
|
|
8568
|
-
start: esm.z.string().optional().describe('Start date (YYYY-MM-DD)'),
|
|
8569
|
-
end: esm.z.string().optional().describe('End date (YYYY-MM-DD)')
|
|
8570
|
-
}).optional(),
|
|
8571
|
-
sizeLimit: esm.z.number().optional().describe('Maximum session size in bytes')
|
|
8572
|
-
}).optional(),
|
|
8573
|
-
cleanupOptions: esm.z.object({
|
|
8574
|
-
maxAgeDays: esm.z.number().optional().describe('Maximum age in days to keep'),
|
|
8575
|
-
maxSessions: esm.z.number().optional().describe('Maximum number of sessions to keep')
|
|
8576
|
-
}).optional(),
|
|
8577
|
-
exportPath: esm.z.string().optional().describe('Path to export session data'),
|
|
8578
|
-
importPath: esm.z.string().optional().describe('Path to import session data from')
|
|
8579
|
-
}),
|
|
8580
|
-
execute: async (args)=>{
|
|
8581
|
-
try {
|
|
8582
|
-
setupClaudeEnvironment();
|
|
8583
|
-
const sessionManager = new SessionManager({
|
|
8584
|
-
storagePath: loadClaudeConfig().sessionStoragePath || external_node_path_resolve(homedir(), '.claude-code', 'sessions')
|
|
8585
|
-
});
|
|
8586
|
-
let result;
|
|
8587
|
-
switch(args.action){
|
|
8588
|
-
case 'list':
|
|
8589
|
-
{
|
|
8590
|
-
const sessions = await sessionManager.listSessions(args.filter);
|
|
8591
|
-
result = {
|
|
8592
|
-
sessions: sessions.map((s)=>{
|
|
8593
|
-
var _s_metadata;
|
|
8594
|
-
return {
|
|
8595
|
-
id: s.id,
|
|
8596
|
-
createdAt: s.createdAt,
|
|
8597
|
-
lastAccessed: s.lastAccessed,
|
|
8598
|
-
size: s.size,
|
|
8599
|
-
summary: s.summary,
|
|
8600
|
-
project: null == (_s_metadata = s.metadata) ? void 0 : _s_metadata.project
|
|
8601
|
-
};
|
|
8602
|
-
}),
|
|
8603
|
-
totalCount: sessions.length
|
|
8604
|
-
};
|
|
8605
|
-
break;
|
|
8606
|
-
}
|
|
8607
|
-
case 'info':
|
|
8608
|
-
{
|
|
8609
|
-
var _session_context;
|
|
8610
|
-
if (!args.sessionId) throw new Error('sessionId is required for info action');
|
|
8611
|
-
const session = await sessionManager.getSession(args.sessionId);
|
|
8612
|
-
result = {
|
|
8613
|
-
id: session.id,
|
|
8614
|
-
createdAt: session.createdAt,
|
|
8615
|
-
lastAccessed: session.lastAccessed,
|
|
8616
|
-
size: session.size,
|
|
8617
|
-
metadata: session.metadata,
|
|
8618
|
-
summary: session.summary,
|
|
8619
|
-
contextLength: (null == (_session_context = session.context) ? void 0 : _session_context.length) || 0
|
|
8620
|
-
};
|
|
8621
|
-
break;
|
|
8622
|
-
}
|
|
8623
|
-
case 'cleanup':
|
|
8624
|
-
{
|
|
8625
|
-
const cleanupResult = await sessionManager.cleanupSessions(args.cleanupOptions);
|
|
8626
|
-
result = {
|
|
8627
|
-
deletedSessions: cleanupResult.deletedCount,
|
|
8628
|
-
freedSpace: cleanupResult.freedBytes,
|
|
8629
|
-
remainingSessions: cleanupResult.remainingCount
|
|
8630
|
-
};
|
|
8631
|
-
break;
|
|
8632
|
-
}
|
|
8633
|
-
case 'export':
|
|
8634
|
-
if (!args.sessionId) throw new Error('sessionId is required for export action');
|
|
8635
|
-
if (!args.exportPath) throw new Error('exportPath is required');
|
|
8636
|
-
await sessionManager.exportSession(args.sessionId, args.exportPath);
|
|
8637
|
-
result = {
|
|
8638
|
-
status: 'success',
|
|
8639
|
-
message: `Session ${args.sessionId} exported to ${args.exportPath}`
|
|
8640
|
-
};
|
|
8641
|
-
break;
|
|
8642
|
-
case 'import':
|
|
8643
|
-
{
|
|
8644
|
-
if (!args.importPath) throw new Error('importPath is required');
|
|
8645
|
-
const sessionId = await sessionManager.importSession(args.importPath);
|
|
8646
|
-
result = {
|
|
8647
|
-
status: 'success',
|
|
8648
|
-
sessionId,
|
|
8649
|
-
message: `Session imported from ${args.importPath}`
|
|
8650
|
-
};
|
|
8651
|
-
break;
|
|
8652
|
-
}
|
|
8653
|
-
case 'stats':
|
|
8654
|
-
{
|
|
8655
|
-
const stats = await sessionManager.getStorageStats();
|
|
8656
|
-
result = {
|
|
8657
|
-
totalSessions: stats.totalSessions,
|
|
8658
|
-
totalSize: stats.totalSize,
|
|
8659
|
-
oldestSession: stats.oldestSession,
|
|
8660
|
-
newestSession: stats.newestSession,
|
|
8661
|
-
averageSessionSize: stats.averageSize
|
|
8662
|
-
};
|
|
8663
|
-
break;
|
|
8664
|
-
}
|
|
8665
|
-
default:
|
|
8666
|
-
throw new Error(`Unknown action: ${args.action}`);
|
|
8667
|
-
}
|
|
8668
|
-
return JSON.stringify(result, null, 2);
|
|
8669
|
-
} catch (error) {
|
|
8670
|
-
src_logger.k.error({
|
|
8671
|
-
module: 'claude_code_sessions',
|
|
8672
|
-
message: 'Session management failed',
|
|
8673
|
-
error: error instanceof Error ? error.message : String(error),
|
|
8674
|
-
action: args.action,
|
|
8675
|
-
sessionId: args.sessionId
|
|
8676
|
-
});
|
|
8677
|
-
throw new Error(`Session management failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
8678
|
-
}
|
|
8679
|
-
}
|
|
8680
|
-
};
|
|
8681
8231
|
var code_generator = __webpack_require__("./src/services/code-generator/index.ts");
|
|
8682
|
-
function
|
|
8232
|
+
function _define_property(obj, key, value) {
|
|
8683
8233
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
8684
8234
|
value: value,
|
|
8685
8235
|
enumerable: true,
|
|
@@ -9009,11 +8559,11 @@ class TaskQueueManager {
|
|
|
9009
8559
|
};
|
|
9010
8560
|
}
|
|
9011
8561
|
constructor(config = DEFAULT_QUEUE_CONFIG){
|
|
9012
|
-
|
|
9013
|
-
|
|
9014
|
-
|
|
9015
|
-
|
|
9016
|
-
|
|
8562
|
+
_define_property(this, "tasks", new Map());
|
|
8563
|
+
_define_property(this, "runningTasks", new Set());
|
|
8564
|
+
_define_property(this, "config", void 0);
|
|
8565
|
+
_define_property(this, "storageDir", void 0);
|
|
8566
|
+
_define_property(this, "isProcessing", false);
|
|
9017
8567
|
this.config = config;
|
|
9018
8568
|
this.storageDir = external_path_["default"].join((0, src_config.WR)(), 'task-queue');
|
|
9019
8569
|
this.initializeStorage();
|
|
@@ -9529,8 +9079,59 @@ ${task.sessionDir ? `## \u{4F1A}\u{8BDD}\u{76EE}\u{5F55}
|
|
|
9529
9079
|
}
|
|
9530
9080
|
}
|
|
9531
9081
|
};
|
|
9532
|
-
const
|
|
9533
|
-
|
|
9082
|
+
const changeAnalysisPrompt = `\u{8BF7}\u{5206}\u{6790}\u{672C}\u{6B21}\u{4EE3}\u{7801}\u{53D8}\u{66F4}\u{FF0C}\u{5E76}\u{4E0E}\u{9700}\u{6C42}\u{8FDB}\u{884C}\u{5BF9}\u{6BD4}\u{FF0C}\u{786E}\u{4FDD}\u{5B9E}\u{73B0}\u{7684}\u{5B8C}\u{6574}\u{6027}\u{3002}
|
|
9083
|
+
|
|
9084
|
+
\u{8BF7}\u{6309}\u{4EE5}\u{4E0B}\u{6B65}\u{9AA4}\u{8FDB}\u{884C}\u{5206}\u{6790}\u{FF1A}
|
|
9085
|
+
|
|
9086
|
+
## 1. \u{4EE3}\u{7801}\u{53D8}\u{66F4}\u{603B}\u{7ED3}
|
|
9087
|
+
\u{5206}\u{6790}git diff\u{5185}\u{5BB9}\u{FF0C}\u{603B}\u{7ED3}\u{FF1A}
|
|
9088
|
+
- \u{65B0}\u{589E}\u{6587}\u{4EF6}\u{53CA}\u{5176}\u{529F}\u{80FD}
|
|
9089
|
+
- \u{4FEE}\u{6539}\u{6587}\u{4EF6}\u{53CA}\u{53D8}\u{66F4}\u{5185}\u{5BB9}
|
|
9090
|
+
- \u{5220}\u{9664}\u{6587}\u{4EF6}\u{53CA}\u{539F}\u{56E0}
|
|
9091
|
+
- \u{4E3B}\u{8981}\u{529F}\u{80FD}\u{6A21}\u{5757}\u{53D8}\u{66F4}
|
|
9092
|
+
|
|
9093
|
+
## 2. \u{63A5}\u{53E3}\u{4E0E}\u{9700}\u{6C42}\u{5BF9}\u{5E94}\u{5173}\u{7CFB}\u{8868}
|
|
9094
|
+
\u{6839}\u{636E}\u{4EE3}\u{7801}\u{53D8}\u{66F4}\u{FF0C}\u{751F}\u{6210}\u{63A5}\u{53E3}\u{4E0E}\u{9700}\u{6C42}\u{5BF9}\u{5E94}\u{5173}\u{7CFB}\u{8868}\u{FF1A}
|
|
9095
|
+
|
|
9096
|
+
| \u{9700}\u{6C42}\u{529F}\u{80FD} | \u{5B9E}\u{73B0}\u{63A5}\u{53E3} | \u{8BF7}\u{6C42}\u{65B9}\u{5F0F} | URL | \u{53D8}\u{66F4}\u{72B6}\u{6001} |
|
|
9097
|
+
|---------|---------|---------|-----|----------|
|
|
9098
|
+
| [\u{9700}\u{6C42}\u{529F}\u{80FD}\u{63CF}\u{8FF0}] | [Controller.method] | [GET/POST/PUT/DELETE] | [/api/path] | [\u{65B0}\u{589E}/\u{4FEE}\u{6539}/\u{5220}\u{9664}] |
|
|
9099
|
+
|
|
9100
|
+
## 3. \u{6838}\u{5FC3}\u{903B}\u{8F91}\u{65B9}\u{6CD5}\u{8868}
|
|
9101
|
+
\u{5206}\u{6790}\u{6838}\u{5FC3}\u{4E1A}\u{52A1}\u{903B}\u{8F91}\u{65B9}\u{6CD5}\u{FF1A}
|
|
9102
|
+
|
|
9103
|
+
| \u{65B9}\u{6CD5}\u{540D}\u{79F0} | \u{6240}\u{5C5E}\u{7C7B} | \u{529F}\u{80FD}\u{8BF4}\u{660E} | \u{53D8}\u{66F4}\u{72B6}\u{6001} |
|
|
9104
|
+
|---------|-------|---------|----------|
|
|
9105
|
+
| [methodName] | [ClassName] | [\u{529F}\u{80FD}\u{63CF}\u{8FF0}] | [\u{65B0}\u{589E}/\u{4FEE}\u{6539}/\u{5220}\u{9664}] |
|
|
9106
|
+
|
|
9107
|
+
## 4. \u{524D}\u{7AEF}\u{9875}\u{9762}\u{4E0E}\u{63A5}\u{53E3}\u{5BF9}\u{5E94}\u{5173}\u{7CFB}\u{8868}
|
|
9108
|
+
\u{5206}\u{6790}\u{524D}\u{7AEF}\u{9875}\u{9762}\u{53D8}\u{66F4}\u{FF1A}
|
|
9109
|
+
|
|
9110
|
+
| \u{9875}\u{9762}\u{540D}\u{79F0} | \u{8C03}\u{7528}\u{63A5}\u{53E3} | \u{7EC4}\u{4EF6}\u{540D}\u{79F0} | \u{8DEF}\u{7531}\u{8DEF}\u{5F84} | \u{53D8}\u{66F4}\u{72B6}\u{6001} |
|
|
9111
|
+
|---------|---------|---------|---------|----------|
|
|
9112
|
+
| [\u{9875}\u{9762}\u{540D}\u{79F0}] | [Controller.method] | [ComponentName] | [/path] | [\u{65B0}\u{589E}/\u{4FEE}\u{6539}/\u{5220}\u{9664}] |
|
|
9113
|
+
|
|
9114
|
+
## 5. \u{524D}\u{7AEF}\u{6838}\u{5FC3}\u{7EC4}\u{4EF6}\u{8868}
|
|
9115
|
+
\u{5206}\u{6790}\u{524D}\u{7AEF}\u{7EC4}\u{4EF6}\u{53D8}\u{66F4}\u{FF1A}
|
|
9116
|
+
|
|
9117
|
+
| \u{7EC4}\u{4EF6}\u{540D}\u{79F0} | \u{6240}\u{5C5E}\u{9875}\u{9762} | \u{529F}\u{80FD}\u{8BF4}\u{660E} | \u{53D8}\u{66F4}\u{72B6}\u{6001} |
|
|
9118
|
+
|---------|---------|---------|----------|
|
|
9119
|
+
| [ComponentName] | [PageName] | [\u{529F}\u{80FD}\u{63CF}\u{8FF0}] | [\u{65B0}\u{589E}/\u{4FEE}\u{6539}/\u{5220}\u{9664}] |
|
|
9120
|
+
|
|
9121
|
+
## 6. \u{9700}\u{6C42}\u{5B8C}\u{6574}\u{6027}\u{68C0}\u{67E5}
|
|
9122
|
+
\u{5BF9}\u{6BD4}\u{539F}\u{59CB}\u{9700}\u{6C42}\u{FF0C}\u{68C0}\u{67E5}\u{FF1A}
|
|
9123
|
+
- \u{2705} \u{5DF2}\u{5B8C}\u{6210}\u{7684}\u{529F}\u{80FD}
|
|
9124
|
+
- \u{26A0}\u{FE0F} \u{90E8}\u{5206}\u{5B8C}\u{6210}\u{7684}\u{529F}\u{80FD}
|
|
9125
|
+
- \u{274C} \u{672A}\u{5B9E}\u{73B0}\u{7684}\u{529F}\u{80FD}
|
|
9126
|
+
- \u{1F504} \u{9700}\u{8981}\u{8FDB}\u{4E00}\u{6B65}\u{5B8C}\u{5584}\u{7684}\u{529F}\u{80FD}
|
|
9127
|
+
|
|
9128
|
+
## 7. \u{5EFA}\u{8BAE}\u{4E0E}\u{603B}\u{7ED3}
|
|
9129
|
+
- \u{5B9E}\u{73B0}\u{8D28}\u{91CF}\u{8BC4}\u{4F30}
|
|
9130
|
+
- \u{6F5C}\u{5728}\u{95EE}\u{9898}\u{8BC6}\u{522B}
|
|
9131
|
+
- \u{540E}\u{7EED}\u{5F00}\u{53D1}\u{5EFA}\u{8BAE}
|
|
9132
|
+
- \u{6D4B}\u{8BD5}\u{5EFA}\u{8BAE}
|
|
9133
|
+
|
|
9134
|
+
\u{8BF7}\u{786E}\u{4FDD}\u{6240}\u{6709}\u{8868}\u{683C}\u{4E0A}\u{4E0B}\u{5BF9}\u{9F50}\u{FF0C}\u{5185}\u{5BB9}\u{8BE6}\u{5B9E}\u{51C6}\u{786E}\u{3002}`;
|
|
9534
9135
|
const ChangeSummarizerParams = esm.z.object({
|
|
9535
9136
|
baseBranch: esm.z.string().default('main').describe("\u57FA\u51C6\u5206\u652F\u540D\u79F0\uFF0C\u7528\u4E8E\u5BF9\u6BD4\u53D8\u66F4"),
|
|
9536
9137
|
requirementFile: esm.z.string().optional().describe("\u9700\u6C42\u6587\u6863\u6587\u4EF6\u8DEF\u5F84\uFF08\u53EF\u9009\uFF09"),
|
|
@@ -11056,12 +10657,258 @@ export interface BaseModel {
|
|
|
11056
10657
|
});
|
|
11057
10658
|
return templates;
|
|
11058
10659
|
}
|
|
10660
|
+
function types_define_property(obj, key, value) {
|
|
10661
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
10662
|
+
value: value,
|
|
10663
|
+
enumerable: true,
|
|
10664
|
+
configurable: true,
|
|
10665
|
+
writable: true
|
|
10666
|
+
});
|
|
10667
|
+
else obj[key] = value;
|
|
10668
|
+
return obj;
|
|
10669
|
+
}
|
|
10670
|
+
const ImageAnalysisParams = esm.z.object({
|
|
10671
|
+
imagePath: esm.z.string().min(1, "Image path cannot be empty").refine((path)=>path.startsWith('/') || /^[A-Za-z]:\\/.test(path), {
|
|
10672
|
+
message: "Image path must be an absolute path"
|
|
10673
|
+
}).describe("Absolute path to the local image file"),
|
|
10674
|
+
prompt: esm.z.string().min(1, "Prompt cannot be empty").max(10000, "Prompt cannot exceed 10,000 characters").describe("The prompt describing what to analyze in the image"),
|
|
10675
|
+
maxTokens: esm.z.number().int("Max tokens must be an integer").min(1, "Max tokens must be at least 1").max(8000, "Max tokens cannot exceed 8000").optional().default(4000).describe("Maximum tokens to generate"),
|
|
10676
|
+
temperature: esm.z.number().min(0, "Temperature must be between 0 and 1").max(1, "Temperature must be between 0 and 1").optional().default(0.7).describe("Temperature for generation (0-1)"),
|
|
10677
|
+
systemPrompt: esm.z.string().max(5000, "System prompt cannot exceed 5,000 characters").optional().describe("Optional system prompt to set behavior")
|
|
10678
|
+
});
|
|
10679
|
+
var types_ErrorCodes = /*#__PURE__*/ function(ErrorCodes) {
|
|
10680
|
+
ErrorCodes["FILE_NOT_FOUND"] = "FILE_NOT_FOUND";
|
|
10681
|
+
ErrorCodes["UNSUPPORTED_FORMAT"] = "UNSUPPORTED_FORMAT";
|
|
10682
|
+
ErrorCodes["FILE_TOO_LARGE"] = "FILE_TOO_LARGE";
|
|
10683
|
+
ErrorCodes["PERMISSION_DENIED"] = "PERMISSION_DENIED";
|
|
10684
|
+
ErrorCodes["API_ERROR"] = "API_ERROR";
|
|
10685
|
+
ErrorCodes["VALIDATION_ERROR"] = "VALIDATION_ERROR";
|
|
10686
|
+
return ErrorCodes;
|
|
10687
|
+
}({});
|
|
10688
|
+
class ImageAnalysisError extends Error {
|
|
10689
|
+
constructor(message, code, details){
|
|
10690
|
+
super(message), types_define_property(this, "code", void 0), types_define_property(this, "details", void 0), this.code = code, this.details = details;
|
|
10691
|
+
this.name = 'ImageAnalysisError';
|
|
10692
|
+
}
|
|
10693
|
+
}
|
|
10694
|
+
const DEFAULT_CONFIG = {
|
|
10695
|
+
temperature: 0.6,
|
|
10696
|
+
maxTokens: 10000,
|
|
10697
|
+
supportedFormats: [
|
|
10698
|
+
'image/jpeg',
|
|
10699
|
+
'image/png',
|
|
10700
|
+
'image/webp'
|
|
10701
|
+
],
|
|
10702
|
+
maxFileSize: 5242880
|
|
10703
|
+
};
|
|
10704
|
+
function image_validator_define_property(obj, key, value) {
|
|
10705
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
10706
|
+
value: value,
|
|
10707
|
+
enumerable: true,
|
|
10708
|
+
configurable: true,
|
|
10709
|
+
writable: true
|
|
10710
|
+
});
|
|
10711
|
+
else obj[key] = value;
|
|
10712
|
+
return obj;
|
|
10713
|
+
}
|
|
10714
|
+
class ImageValidator {
|
|
10715
|
+
static async validateImage(imagePath) {
|
|
10716
|
+
try {
|
|
10717
|
+
const stats = await promises_.stat(imagePath).catch(()=>{
|
|
10718
|
+
throw new ImageAnalysisError(`Image file not found: ${imagePath}`, types_ErrorCodes.FILE_NOT_FOUND);
|
|
10719
|
+
});
|
|
10720
|
+
if (!stats.isFile()) throw new ImageAnalysisError(`Path is not a file: ${imagePath}`, types_ErrorCodes.FILE_NOT_FOUND);
|
|
10721
|
+
if (stats.size > ImageValidator.MAX_FILE_SIZE) throw new ImageAnalysisError(`Image file too large: ${stats.size} bytes (max: ${ImageValidator.MAX_FILE_SIZE} bytes)`, types_ErrorCodes.FILE_TOO_LARGE, {
|
|
10722
|
+
size: stats.size,
|
|
10723
|
+
maxSize: ImageValidator.MAX_FILE_SIZE
|
|
10724
|
+
});
|
|
10725
|
+
try {
|
|
10726
|
+
await promises_.access(imagePath, promises_.constants.R_OK);
|
|
10727
|
+
} catch (err) {
|
|
10728
|
+
err instanceof Error && err.message;
|
|
10729
|
+
throw new ImageAnalysisError(`Permission denied: Cannot read image file ${imagePath}`, types_ErrorCodes.PERMISSION_DENIED, {
|
|
10730
|
+
error: err
|
|
10731
|
+
});
|
|
10732
|
+
}
|
|
10733
|
+
const extension = external_path_.extname(imagePath).slice(1).toLowerCase();
|
|
10734
|
+
const isSupported = ImageValidator.isFormatSupported(extension);
|
|
10735
|
+
if (!isSupported) throw new ImageAnalysisError(`Unsupported image format: ${extension}. Supported formats: ${ImageValidator.SUPPORTED_FORMATS.join(', ')}`, types_ErrorCodes.UNSUPPORTED_FORMAT, {
|
|
10736
|
+
format: extension,
|
|
10737
|
+
supportedFormats: ImageValidator.SUPPORTED_FORMATS
|
|
10738
|
+
});
|
|
10739
|
+
return {
|
|
10740
|
+
exists: true,
|
|
10741
|
+
size: stats.size,
|
|
10742
|
+
format: extension,
|
|
10743
|
+
isSupported: true,
|
|
10744
|
+
mimeType: ImageValidator.getMimeType(extension)
|
|
10745
|
+
};
|
|
10746
|
+
} catch (error) {
|
|
10747
|
+
if (error instanceof ImageAnalysisError) throw error;
|
|
10748
|
+
const message = error instanceof Error ? error.message : 'Error validating image file';
|
|
10749
|
+
throw new ImageAnalysisError(`Error validating image file: ${message}`, types_ErrorCodes.VALIDATION_ERROR, {
|
|
10750
|
+
error
|
|
10751
|
+
});
|
|
10752
|
+
}
|
|
10753
|
+
}
|
|
10754
|
+
static isFormatSupported(format) {
|
|
10755
|
+
return ImageValidator.SUPPORTED_FORMATS.includes(format.toLowerCase());
|
|
10756
|
+
}
|
|
10757
|
+
static getMimeType(format) {
|
|
10758
|
+
const normalizedFormat = format.toLowerCase();
|
|
10759
|
+
switch(normalizedFormat){
|
|
10760
|
+
case 'jpg':
|
|
10761
|
+
case 'jpeg':
|
|
10762
|
+
return 'image/jpeg';
|
|
10763
|
+
case 'png':
|
|
10764
|
+
return 'image/png';
|
|
10765
|
+
case 'gif':
|
|
10766
|
+
return 'image/gif';
|
|
10767
|
+
case 'bmp':
|
|
10768
|
+
return 'image/bmp';
|
|
10769
|
+
case 'webp':
|
|
10770
|
+
return 'image/webp';
|
|
10771
|
+
default:
|
|
10772
|
+
return 'application/octet-stream';
|
|
10773
|
+
}
|
|
10774
|
+
}
|
|
10775
|
+
}
|
|
10776
|
+
image_validator_define_property(ImageValidator, "SUPPORTED_FORMATS", DEFAULT_CONFIG.supportedFormats || [
|
|
10777
|
+
'jpg',
|
|
10778
|
+
'jpeg',
|
|
10779
|
+
'png',
|
|
10780
|
+
'gif',
|
|
10781
|
+
'bmp',
|
|
10782
|
+
'webp'
|
|
10783
|
+
]);
|
|
10784
|
+
image_validator_define_property(ImageValidator, "MAX_FILE_SIZE", DEFAULT_CONFIG.maxFileSize || 5242880);
|
|
10785
|
+
class ImageEncoder {
|
|
10786
|
+
static async encodeImageToBase64(imagePath) {
|
|
10787
|
+
try {
|
|
10788
|
+
const fileInfo = await ImageValidator.validateImage(imagePath);
|
|
10789
|
+
const base64Data = await ImageEncoder.streamToBase64(imagePath);
|
|
10790
|
+
return `data:${fileInfo.mimeType};base64,${base64Data}`;
|
|
10791
|
+
} catch (error) {
|
|
10792
|
+
if (error instanceof ImageAnalysisError) throw error;
|
|
10793
|
+
const message = error instanceof Error ? error.message : 'Error encoding image';
|
|
10794
|
+
throw new ImageAnalysisError(`Error encoding image: ${message}`, types_ErrorCodes.VALIDATION_ERROR, {
|
|
10795
|
+
error
|
|
10796
|
+
});
|
|
10797
|
+
}
|
|
10798
|
+
}
|
|
10799
|
+
static async streamToBase64(filePath) {
|
|
10800
|
+
return new Promise((resolve, reject)=>{
|
|
10801
|
+
const readStream = external_fs_.createReadStream(filePath);
|
|
10802
|
+
const chunks = [];
|
|
10803
|
+
readStream.on('data', (chunk)=>chunks.push(Buffer.from(chunk)));
|
|
10804
|
+
readStream.on('error', (err)=>reject(new Error(`Error reading file: ${err.message}`)));
|
|
10805
|
+
readStream.on('end', ()=>{
|
|
10806
|
+
const buffer = Buffer.concat(chunks);
|
|
10807
|
+
const base64String = buffer.toString('base64');
|
|
10808
|
+
resolve(base64String);
|
|
10809
|
+
});
|
|
10810
|
+
});
|
|
10811
|
+
}
|
|
10812
|
+
}
|
|
10813
|
+
class ImageAnalysisService {
|
|
10814
|
+
async analyzeImage(params) {
|
|
10815
|
+
const startTime = Date.now();
|
|
10816
|
+
try {
|
|
10817
|
+
const validatedParams = ImageAnalysisParams.parse(params);
|
|
10818
|
+
const fileInfo = await ImageValidator.validateImage(validatedParams.imagePath);
|
|
10819
|
+
const base64Image = await ImageEncoder.encodeImageToBase64(validatedParams.imagePath);
|
|
10820
|
+
src_logger.k.info('Calling OpenAI Vision API via unified service', {
|
|
10821
|
+
model: 'moonshot-v1-128k-vision-preview',
|
|
10822
|
+
maxTokens: validatedParams.maxTokens,
|
|
10823
|
+
temperature: validatedParams.temperature,
|
|
10824
|
+
promptLength: validatedParams.prompt.length,
|
|
10825
|
+
imageSize: fileInfo.size,
|
|
10826
|
+
imageFormat: fileInfo.format
|
|
10827
|
+
});
|
|
10828
|
+
const content = await openai_service.rA.analyzeImage({
|
|
10829
|
+
prompt: validatedParams.prompt,
|
|
10830
|
+
image_base64: base64Image,
|
|
10831
|
+
model: 'moonshot-v1-128k-vision-preview',
|
|
10832
|
+
max_tokens: validatedParams.maxTokens,
|
|
10833
|
+
temperature: validatedParams.temperature,
|
|
10834
|
+
system_prompt: validatedParams.systemPrompt
|
|
10835
|
+
});
|
|
10836
|
+
const processingTime = Date.now() - startTime;
|
|
10837
|
+
src_logger.k.info('OpenAI Vision API call successful', {
|
|
10838
|
+
model: 'moonshot-v1-128k-vision-preview',
|
|
10839
|
+
contentLength: content.length,
|
|
10840
|
+
processingTime
|
|
10841
|
+
});
|
|
10842
|
+
return {
|
|
10843
|
+
content,
|
|
10844
|
+
metadata: {
|
|
10845
|
+
imagePath: validatedParams.imagePath,
|
|
10846
|
+
imageSize: fileInfo.size,
|
|
10847
|
+
imageFormat: fileInfo.format,
|
|
10848
|
+
processingTime
|
|
10849
|
+
}
|
|
10850
|
+
};
|
|
10851
|
+
} catch (error) {
|
|
10852
|
+
if (error instanceof esm.jm) {
|
|
10853
|
+
const validationErrors = error.errors.map((err)=>`${err.path.join('.')}: ${err.message}`).join(', ');
|
|
10854
|
+
src_logger.k.error('Parameter validation failed', {
|
|
10855
|
+
error: validationErrors,
|
|
10856
|
+
details: error.errors
|
|
10857
|
+
});
|
|
10858
|
+
throw new ImageAnalysisError(`Parameter validation failed: ${validationErrors}`, types_ErrorCodes.VALIDATION_ERROR, {
|
|
10859
|
+
validationErrors: error instanceof esm.jm ? error.errors : []
|
|
10860
|
+
});
|
|
10861
|
+
}
|
|
10862
|
+
if (error instanceof ImageAnalysisError) {
|
|
10863
|
+
src_logger.k.error('Image analysis failed', {
|
|
10864
|
+
error: error.message,
|
|
10865
|
+
code: error.code,
|
|
10866
|
+
details: error.details
|
|
10867
|
+
});
|
|
10868
|
+
throw error;
|
|
10869
|
+
}
|
|
10870
|
+
src_logger.k.error('Image analysis failed with unexpected error', {
|
|
10871
|
+
error: error instanceof Error ? error.message : String(error)
|
|
10872
|
+
});
|
|
10873
|
+
throw new ImageAnalysisError(`Image analysis failed: ${error instanceof Error ? error.message : String(error)}`, types_ErrorCodes.API_ERROR, {
|
|
10874
|
+
error
|
|
10875
|
+
});
|
|
10876
|
+
}
|
|
10877
|
+
}
|
|
10878
|
+
constructor(){}
|
|
10879
|
+
}
|
|
10880
|
+
function createImageAnalysisService(config) {
|
|
10881
|
+
return new ImageAnalysisService();
|
|
10882
|
+
}
|
|
10883
|
+
const imageAnalysisService = createImageAnalysisService();
|
|
10884
|
+
const analyzeImageTool = {
|
|
10885
|
+
name: 'analyzeImage',
|
|
10886
|
+
description: "\u8BC6\u522B\u56FE\u7247\u5185\u5BB9\u5E76\u751F\u6210\u5BF9\u56FE\u7247\u7684\u63CF\u8FF0",
|
|
10887
|
+
parameters: esm.z.object({
|
|
10888
|
+
imagePath: esm.z.string().describe('Absolute path to the local image file'),
|
|
10889
|
+
prompt: esm.z.string().describe('The prompt describing what to analyze in the image'),
|
|
10890
|
+
maxTokens: esm.z.number().optional().describe('Maximum tokens to generate (optional, default: 4000)'),
|
|
10891
|
+
temperature: esm.z.number().optional().describe('Temperature for generation (optional, default: 0.7)'),
|
|
10892
|
+
systemPrompt: esm.z.string().optional().describe('Optional system prompt to set behavior')
|
|
10893
|
+
}),
|
|
10894
|
+
execute: async (args)=>{
|
|
10895
|
+
const result = await imageAnalysisService.analyzeImage({
|
|
10896
|
+
imagePath: args.imagePath,
|
|
10897
|
+
prompt: args.prompt,
|
|
10898
|
+
maxTokens: args.maxTokens,
|
|
10899
|
+
temperature: args.temperature,
|
|
10900
|
+
systemPrompt: args.systemPrompt
|
|
10901
|
+
});
|
|
10902
|
+
return result.content;
|
|
10903
|
+
}
|
|
10904
|
+
};
|
|
10905
|
+
(0, src_config.NL)();
|
|
11059
10906
|
const server = new FastMCP({
|
|
11060
10907
|
name: src_config.Gp.name,
|
|
11061
10908
|
version: src_config.Gp.version,
|
|
11062
10909
|
ping: {
|
|
11063
10910
|
enabled: true,
|
|
11064
|
-
intervalMs:
|
|
10911
|
+
intervalMs: 30000,
|
|
11065
10912
|
logLevel: "info"
|
|
11066
10913
|
}
|
|
11067
10914
|
});
|
|
@@ -11070,10 +10917,9 @@ server.addTool(word2mdTool);
|
|
|
11070
10917
|
server.addTool(pdf2mdTool);
|
|
11071
10918
|
server.addTool(requirementAnalyzerTool);
|
|
11072
10919
|
server.addTool(code_generator.codeGeneratorTool);
|
|
11073
|
-
server.addTool(claudeCode);
|
|
11074
|
-
server.addTool(claudeCodeSessions);
|
|
11075
10920
|
server.addTool(changeSummarizer);
|
|
11076
10921
|
server.addTool(integratedGenerator);
|
|
10922
|
+
server.addTool(analyzeImageTool);
|
|
11077
10923
|
server.addTool(addTaskToQueueTool);
|
|
11078
10924
|
server.addTool(createIterationTool);
|
|
11079
10925
|
server.addTool(enhanced_tools_updateTaskTool);
|
|
@@ -11082,12 +10928,7 @@ server.addTool(queryTasksTool);
|
|
|
11082
10928
|
server.addTool(batchOperationTool);
|
|
11083
10929
|
server.addTool(getTaskDetailTool);
|
|
11084
10930
|
apiTestTools.forEach((tool)=>server.addTool(tool));
|
|
11085
|
-
|
|
11086
|
-
|
|
11087
|
-
|
|
11088
|
-
|
|
11089
|
-
});
|
|
11090
|
-
} catch (error) {
|
|
11091
|
-
src_logger.k.error(`\u{542F}\u{52A8}\u{5931}\u{8D25}: ${error instanceof Error ? error.message : String(error)}`);
|
|
11092
|
-
process.exit(1);
|
|
11093
|
-
}
|
|
10931
|
+
src_logger.k.info(`\u{1F680} \u{542F}\u{52A8}${src_config.Gp.name}\u{6210}\u{529F}`);
|
|
10932
|
+
server.start({
|
|
10933
|
+
transportType: "stdio"
|
|
10934
|
+
});
|