ai-worktool 1.0.48 → 1.0.50
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/CHANGELOG.md +2 -1
- package/dist/agents/jianguoke.js +11 -3
- package/dist/program.js +14 -1
- package/dist/testAgent.js +5 -13
- package/dist/user.js +2 -0
- package/package.json +3 -3
- package/packages/{aicoder-1.0.48-linux → aicoder-1.0.50-linux} +0 -0
- package/packages/{aicoder-1.0.48-macos → aicoder-1.0.50-macos} +0 -0
- package/packages/{aicoder-1.0.48-win.exe → aicoder-1.0.50-win.exe} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
## 1.0.
|
|
1
|
+
## 1.0.50 (2025-08-12)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
* **agent:** 为消息事件添加任务ID ([bfc4244](https://codeup.aliyun.com/666cf9ed29ecbe23053513a3/JianGuoKe/ai-worktools/commits/bfc42445e95cc7d927aab8ed13ea040d8d107b7a))
|
|
93
93
|
* **agent:** 优化 TestAgent 启停逻辑和 UI 显示 ([91ce307](https://codeup.aliyun.com/666cf9ed29ecbe23053513a3/JianGuoKe/ai-worktools/commits/91ce307e5317023107f392052fb4607aa21e8081))
|
|
94
94
|
* **agent:** 优化代码文件显示逻辑 ([e21ca68](https://codeup.aliyun.com/666cf9ed29ecbe23053513a3/JianGuoKe/ai-worktools/commits/e21ca680db772694254a98ac76518b74f6e7b726))
|
|
95
|
+
* **agent:** 增加 Token 用完时的异常处理 ([5b9189d](https://codeup.aliyun.com/666cf9ed29ecbe23053513a3/JianGuoKe/ai-worktools/commits/5b9189d0a3fad63493b50aaaafab88402237a20d))
|
|
95
96
|
* **agent:** 增加对话模式功能 ([cc53353](https://codeup.aliyun.com/666cf9ed29ecbe23053513a3/JianGuoKe/ai-worktools/commits/cc5335364f13ca39d9e92e7600c9c79587071591))
|
|
96
97
|
* **agent:** 增加工具调用回调并优化测试流程 ([1cae77e](https://codeup.aliyun.com/666cf9ed29ecbe23053513a3/JianGuoKe/ai-worktools/commits/1cae77e7bf05c3f72771d29568034eaecfea3c8e))
|
|
97
98
|
* **agent:** 增加智能体增量回复功能 ([edd406b](https://codeup.aliyun.com/666cf9ed29ecbe23053513a3/JianGuoKe/ai-worktools/commits/edd406b905b930a7943c9697248150f9a4505e08))
|
package/dist/agents/jianguoke.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.setConversationId = void 0;
|
|
36
|
+
exports.AgentException = exports.setConversationId = void 0;
|
|
37
37
|
exports.checkAccount = checkAccount;
|
|
38
38
|
exports.toolCallback = toolCallback;
|
|
39
39
|
exports.startAgent = startAgent;
|
|
@@ -112,6 +112,14 @@ async function handleToolCall(toolCall) {
|
|
|
112
112
|
await toolCallback(toolCall.toolName, toolCall.callId, data || message).catch(console.error);
|
|
113
113
|
return { data, message, success };
|
|
114
114
|
}
|
|
115
|
+
class AgentException extends Error {
|
|
116
|
+
constructor(message, name, code) {
|
|
117
|
+
super(message);
|
|
118
|
+
this.name = name || 'AgentException';
|
|
119
|
+
this.code = code;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.AgentException = AgentException;
|
|
115
123
|
async function startAgent(name, question, vars, withConversation, ctrl, mode, onMessage, onToolCall) {
|
|
116
124
|
let err = null;
|
|
117
125
|
let msg = '';
|
|
@@ -196,12 +204,12 @@ async function startAgent(name, question, vars, withConversation, ctrl, mode, on
|
|
|
196
204
|
console.log(msg);
|
|
197
205
|
}
|
|
198
206
|
if (ev?.event === 'ERROR') {
|
|
199
|
-
err = data.error;
|
|
207
|
+
err = new AgentException(data.error, data.name, data.code);
|
|
200
208
|
}
|
|
201
209
|
}
|
|
202
210
|
});
|
|
203
211
|
if (err) {
|
|
204
|
-
throw
|
|
212
|
+
throw err;
|
|
205
213
|
}
|
|
206
214
|
}
|
|
207
215
|
//# sourceMappingURL=jianguoke.js.map
|
package/dist/program.js
CHANGED
|
@@ -79,7 +79,7 @@ program
|
|
|
79
79
|
.action(async (projectRoot, options) => {
|
|
80
80
|
let projectConfig;
|
|
81
81
|
const tasks = [];
|
|
82
|
-
await (0, testAgent_1.startTestAgent)({
|
|
82
|
+
const result = await (0, testAgent_1.startTestAgent)({
|
|
83
83
|
...options,
|
|
84
84
|
projectRoot: projectRoot || options.projectRoot,
|
|
85
85
|
mode: 'increment',
|
|
@@ -102,6 +102,12 @@ program
|
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
await Promise.all(tasks);
|
|
105
|
+
if (result?.name === '') {
|
|
106
|
+
if (result?.name === 'ExpiredException') {
|
|
107
|
+
logHandler('您的Tokens已用完,请充值。执行下面命令打开使用面板:');
|
|
108
|
+
logHandler('testAgent usage');
|
|
109
|
+
}
|
|
110
|
+
}
|
|
105
111
|
});
|
|
106
112
|
program
|
|
107
113
|
.command('show [projectRoot]')
|
|
@@ -118,5 +124,12 @@ program
|
|
|
118
124
|
await (0, view_1.loadAndDisplayCoverage)(path_1.default.join(projectRoot || options.projectRoot, options.coverageDir, view_1.COVERAGE_FILE_PATH));
|
|
119
125
|
}
|
|
120
126
|
});
|
|
127
|
+
program
|
|
128
|
+
.command('usage')
|
|
129
|
+
.description('打开使用情况')
|
|
130
|
+
.action(async () => {
|
|
131
|
+
const token = await (0, user_1.getTokenStorage)().get();
|
|
132
|
+
(0, user_1.openExternalUrl)(user_1.HOME_URL + '/usage.html?token=' + token);
|
|
133
|
+
});
|
|
121
134
|
exports.default = program;
|
|
122
135
|
//# sourceMappingURL=program.js.map
|
package/dist/testAgent.js
CHANGED
|
@@ -10,10 +10,11 @@ const tools_1 = require("./tools");
|
|
|
10
10
|
async function startTestAgent(options) {
|
|
11
11
|
const ctrl = options.controller;
|
|
12
12
|
const log = options.onMessage || console.log;
|
|
13
|
-
let isErrorEnd
|
|
13
|
+
let isErrorEnd;
|
|
14
14
|
log(`开始干活... 😎`);
|
|
15
15
|
console.log(options.projectRoot);
|
|
16
16
|
try {
|
|
17
|
+
isErrorEnd = false;
|
|
17
18
|
// 工作流程:
|
|
18
19
|
// 1、检查当前项目单元测试工具是否安装好,否则安装测试工具搭建测试环境
|
|
19
20
|
const projectConfig = await (0, tools_1.detectProjectConfig)(options.projectRoot, options);
|
|
@@ -39,16 +40,6 @@ async function startTestAgent(options) {
|
|
|
39
40
|
break;
|
|
40
41
|
}
|
|
41
42
|
if (!result.success) {
|
|
42
|
-
// // 单测执行失败,没有发现任何需要测试的代码
|
|
43
|
-
// if (result.noTestsFound) {
|
|
44
|
-
// log('没有发现任何需要测试的源代码...');
|
|
45
|
-
// if (!options.fullCoverageEnd) {
|
|
46
|
-
// await wait(options.idleTimeout || 5000);
|
|
47
|
-
// continue;
|
|
48
|
-
// } else {
|
|
49
|
-
// break;
|
|
50
|
-
// }
|
|
51
|
-
// }
|
|
52
43
|
// 上一次执行必须有写入类操作,否则不会有新的单测覆盖率变化
|
|
53
44
|
if (lastTestResult?.stderr === result.stderr &&
|
|
54
45
|
toolCalls.every((toolCall) => !tools_1.modifyTools.includes(toolCall.functionName))) {
|
|
@@ -133,11 +124,12 @@ async function startTestAgent(options) {
|
|
|
133
124
|
console.log('已终止');
|
|
134
125
|
}
|
|
135
126
|
else {
|
|
127
|
+
isErrorEnd = err;
|
|
136
128
|
console.error(err);
|
|
137
|
-
log('发生错误,' + err.message);
|
|
138
|
-
isErrorEnd = true;
|
|
129
|
+
log('发生错误, ' + err.message);
|
|
139
130
|
}
|
|
140
131
|
}
|
|
141
132
|
log(isErrorEnd ? '被下班~ 👻' : '下班下班 👋');
|
|
133
|
+
return isErrorEnd;
|
|
142
134
|
}
|
|
143
135
|
//# sourceMappingURL=testAgent.js.map
|
package/dist/user.js
CHANGED
|
@@ -36,6 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.HOME_URL = void 0;
|
|
39
40
|
exports.setTokenStorage = setTokenStorage;
|
|
40
41
|
exports.getTokenStorage = getTokenStorage;
|
|
41
42
|
exports.openExternalUrl = openExternalUrl;
|
|
@@ -55,6 +56,7 @@ const child_process_1 = require("child_process");
|
|
|
55
56
|
const jianguoke_1 = require("./agents/jianguoke");
|
|
56
57
|
// 转换exec为Promise形式,便于async/await使用
|
|
57
58
|
const execAsync = util_1.default.promisify(child_process_1.exec);
|
|
59
|
+
exports.HOME_URL = process.env.HOME_URL || 'https://aicoder.jianguoke.cn';
|
|
58
60
|
let tokenStorage = {
|
|
59
61
|
get: async () => {
|
|
60
62
|
return localStorage.getItem('token');
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-worktool",
|
|
3
3
|
"displayName": "吃豆豆:单测智能体",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.50",
|
|
5
5
|
"description": "单元测试智能体,帮你开发单元测试用例代码直到100%单测覆盖通过。",
|
|
6
6
|
"author": "jianguoke.cn",
|
|
7
7
|
"license": "MIT",
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"createup": "node ./uposs.js create-local-folder",
|
|
24
24
|
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
|
25
25
|
"puball": "yarn ver && yarn exepack && yarn vspack && yarn pubvs && yarn pubovsx && yarn puboss && yarn pubnpm",
|
|
26
|
-
"exepack": "yarn createup && cross-env PKG_CACHE_PATH=./binaries pkg -o packages/aicoder-1.0.
|
|
26
|
+
"exepack": "yarn createup && cross-env PKG_CACHE_PATH=./binaries pkg -o packages/aicoder-1.0.50 . && yarn upicon",
|
|
27
27
|
"pubvs": "yarn remove-deps && yarn changelog && vsce publish --yarn --baseContentUrl https://aicoder.jianguoke.cn/assets && yarn restore-deps",
|
|
28
28
|
"pubovsx": "yarn remove-deps && ovsx publish -p 47621ff6-be56-4814-865e-d2a8e8a76f86 --yarn --baseContentUrl https://aicoder.jianguoke.cn/assets && yarn restore-deps",
|
|
29
29
|
"patch": "yarn remove-deps && vsce publish patch --yarn && yarn restore-deps",
|
|
30
|
-
"vspack": "yarn createup && yarn remove-deps && vsce package -o packages/aicoder-1.0.
|
|
30
|
+
"vspack": "yarn createup && yarn remove-deps && vsce package -o packages/aicoder-1.0.50.vsix --yarn --baseContentUrl https://aicoder.jianguoke.cn/assets && yarn restore-deps",
|
|
31
31
|
"puboss": "node ./uposs.js upload",
|
|
32
32
|
"pubnpm": "npm publish --registry=https://registry.npmjs.org",
|
|
33
33
|
"prepare": "husky"
|
|
index c66734d..c145829 100755
|
|
|
Binary file
|
|
index 907b0c6..68b40ec 100755
|
|
|
Binary file
|
|
index 2e42a35..3e1e277 100644
|
|
|
Binary file
|