ai-project-manage-cli 3.0.20 → 3.0.21
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/index.js +31 -23
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -118,6 +118,10 @@ var requestConfig = {
|
|
|
118
118
|
updateTaskStatus: defineEndpoint({
|
|
119
119
|
method: "POST",
|
|
120
120
|
path: "/cli/requirements/update-task-status"
|
|
121
|
+
}),
|
|
122
|
+
updateTaskAgentId: defineEndpoint({
|
|
123
|
+
method: "POST",
|
|
124
|
+
path: "/cli/requirements/update-task-agent-id"
|
|
121
125
|
})
|
|
122
126
|
},
|
|
123
127
|
requirementArtifact: {
|
|
@@ -622,15 +626,26 @@ function runConnect(opts) {
|
|
|
622
626
|
console.error("[apm] apm pull \u5931\u8D25:", pullErr);
|
|
623
627
|
throw pullErr;
|
|
624
628
|
}
|
|
625
|
-
const agent = await
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
629
|
+
const agent = await (async () => {
|
|
630
|
+
const options = {
|
|
631
|
+
apiKey: payload.apiKey,
|
|
632
|
+
model: { id: payload.model ?? "default" },
|
|
633
|
+
local: { cwd: payload.cwd }
|
|
634
|
+
};
|
|
635
|
+
if (payload.agentId) {
|
|
636
|
+
return Agent.resume(payload.agentId, options);
|
|
637
|
+
}
|
|
638
|
+
return Agent.create(options);
|
|
639
|
+
})();
|
|
630
640
|
await api.cliRequirements.updateDevStatus({
|
|
631
641
|
requirementId: payload.requirementId,
|
|
632
642
|
status: "WORKING"
|
|
633
643
|
});
|
|
644
|
+
await api.cliRequirements.updateTaskAgentId({
|
|
645
|
+
taskId: payload.taskId,
|
|
646
|
+
requirementId: payload.requirementId,
|
|
647
|
+
agentId: agent.agentId
|
|
648
|
+
});
|
|
634
649
|
let IN_PROGRESS = false;
|
|
635
650
|
const session = new EventSession();
|
|
636
651
|
const run = await agent.send(payload.prompt);
|
|
@@ -656,24 +671,17 @@ function runConnect(opts) {
|
|
|
656
671
|
if (event.type === "thinking") {
|
|
657
672
|
const thinking = event.text;
|
|
658
673
|
console.log(`[Thinking]`, thinking);
|
|
659
|
-
session.addEvent(event);
|
|
660
674
|
continue;
|
|
661
675
|
}
|
|
662
676
|
if (event.type === "tool_call") {
|
|
663
677
|
if (event.status === "completed" || event.status === "error") {
|
|
664
678
|
console.log(`[ToolCall(${event.call_id}) Result]`);
|
|
665
|
-
console.log(JSON.stringify(event.args));
|
|
666
|
-
console.log(JSON.stringify(event.result, null, 2));
|
|
667
|
-
console.log("---------------\u8C03\u7528\u5B8C\u6210-----------------");
|
|
668
679
|
}
|
|
669
680
|
session.addEvent(event);
|
|
670
681
|
continue;
|
|
671
682
|
}
|
|
672
683
|
if (event.type === "task") {
|
|
673
684
|
console.log(`[Task:${event.status}]`);
|
|
674
|
-
console.log("--------------------------------");
|
|
675
|
-
console.log(event.text || "\u65E0");
|
|
676
|
-
console.log("--------------------------------");
|
|
677
685
|
session.addEvent(event);
|
|
678
686
|
continue;
|
|
679
687
|
}
|
|
@@ -777,13 +785,13 @@ async function runLogin(opts) {
|
|
|
777
785
|
|
|
778
786
|
// src/commands/branch.ts
|
|
779
787
|
import { execFile } from "child_process";
|
|
780
|
-
import { resolve as
|
|
788
|
+
import { resolve as resolve3 } from "path";
|
|
781
789
|
import { promisify } from "util";
|
|
782
790
|
var execFileAsync = promisify(execFile);
|
|
783
791
|
async function fetchBaselineBranchFromApi(requirementId, cwd) {
|
|
784
792
|
const cfg = await ensureLoggedConfig();
|
|
785
793
|
const api = createApmApiClient(cfg);
|
|
786
|
-
const workdirPath =
|
|
794
|
+
const workdirPath = resolve3(cwd);
|
|
787
795
|
const { baselineBranch } = await api.cliRequirements.branchBaseline({
|
|
788
796
|
requirementId,
|
|
789
797
|
workdirPath
|
|
@@ -952,11 +960,11 @@ import path5 from "node:path";
|
|
|
952
960
|
|
|
953
961
|
// src/commands/deploy/lib/apm-config.ts
|
|
954
962
|
import { existsSync as existsSync3, readFileSync as readFileSync6 } from "node:fs";
|
|
955
|
-
import { resolve as
|
|
963
|
+
import { resolve as resolve4 } from "node:path";
|
|
956
964
|
function loadApmConfig(options) {
|
|
957
|
-
const p =
|
|
965
|
+
const p = resolve4(
|
|
958
966
|
process.cwd(),
|
|
959
|
-
options?.configPath ??
|
|
967
|
+
options?.configPath ?? resolve4(WORKSPACE_APM_DIR, "apm.config.json")
|
|
960
968
|
);
|
|
961
969
|
if (!existsSync3(p)) {
|
|
962
970
|
console.error(`\u672A\u627E\u5230\u914D\u7F6E\u6587\u4EF6\uFF1A${p}`);
|
|
@@ -1200,17 +1208,17 @@ var DockerodeClient = class {
|
|
|
1200
1208
|
await this.client.getImage(image).remove({ force: true });
|
|
1201
1209
|
}
|
|
1202
1210
|
async pullImage(image, auth) {
|
|
1203
|
-
const stream = await new Promise((
|
|
1211
|
+
const stream = await new Promise((resolve5, reject) => {
|
|
1204
1212
|
const pullOptions = auth ? { authconfig: auth } : void 0;
|
|
1205
1213
|
this.client.pull(image, pullOptions, (err, output) => {
|
|
1206
1214
|
if (err || !output) {
|
|
1207
1215
|
reject(err ?? new Error("docker pull \u8FD4\u56DE\u7A7A\u8F93\u51FA"));
|
|
1208
1216
|
return;
|
|
1209
1217
|
}
|
|
1210
|
-
|
|
1218
|
+
resolve5(output);
|
|
1211
1219
|
});
|
|
1212
1220
|
});
|
|
1213
|
-
await new Promise((
|
|
1221
|
+
await new Promise((resolve5, reject) => {
|
|
1214
1222
|
this.client.modem.followProgress(
|
|
1215
1223
|
stream,
|
|
1216
1224
|
(err) => {
|
|
@@ -1218,7 +1226,7 @@ var DockerodeClient = class {
|
|
|
1218
1226
|
reject(err);
|
|
1219
1227
|
return;
|
|
1220
1228
|
}
|
|
1221
|
-
|
|
1229
|
+
resolve5();
|
|
1222
1230
|
},
|
|
1223
1231
|
() => void 0
|
|
1224
1232
|
);
|
|
@@ -1734,14 +1742,14 @@ var MinioClient = class {
|
|
|
1734
1742
|
async deleteObjectsByPrefix(bucket, prefix) {
|
|
1735
1743
|
const objectsStream = this.inner.listObjectsV2(bucket, prefix, true);
|
|
1736
1744
|
const keys = [];
|
|
1737
|
-
await new Promise((
|
|
1745
|
+
await new Promise((resolve5, reject) => {
|
|
1738
1746
|
objectsStream.on("data", (obj) => {
|
|
1739
1747
|
if (obj.name) {
|
|
1740
1748
|
keys.push(obj.name);
|
|
1741
1749
|
}
|
|
1742
1750
|
});
|
|
1743
1751
|
objectsStream.on("error", reject);
|
|
1744
|
-
objectsStream.on("end",
|
|
1752
|
+
objectsStream.on("end", resolve5);
|
|
1745
1753
|
});
|
|
1746
1754
|
const chunkSize = 500;
|
|
1747
1755
|
for (let i = 0; i < keys.length; i += chunkSize) {
|