ai-project-manage-cli 3.0.23 → 4.0.1
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 +32 -35
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -114,14 +114,6 @@ var requestConfig = {
|
|
|
114
114
|
updateDevStatus: defineEndpoint({
|
|
115
115
|
method: "POST",
|
|
116
116
|
path: "/cli/requirements/update-dev-status"
|
|
117
|
-
}),
|
|
118
|
-
updateTaskStatus: defineEndpoint({
|
|
119
|
-
method: "POST",
|
|
120
|
-
path: "/cli/requirements/update-task-status"
|
|
121
|
-
}),
|
|
122
|
-
updateTaskAgentId: defineEndpoint({
|
|
123
|
-
method: "POST",
|
|
124
|
-
path: "/cli/requirements/update-task-agent-id"
|
|
125
117
|
})
|
|
126
118
|
},
|
|
127
119
|
requirementArtifact: {
|
|
@@ -141,6 +133,18 @@ var requestConfig = {
|
|
|
141
133
|
method: "POST",
|
|
142
134
|
path: "/requirement-artifacts/delete"
|
|
143
135
|
})
|
|
136
|
+
},
|
|
137
|
+
spaceWorkflow: {
|
|
138
|
+
aiStartNode: defineEndpoint({
|
|
139
|
+
method: "POST",
|
|
140
|
+
path: "/space-workflows/ai-start-node"
|
|
141
|
+
}),
|
|
142
|
+
aiConfirmNode: defineEndpoint(
|
|
143
|
+
{
|
|
144
|
+
method: "POST",
|
|
145
|
+
path: "/space-workflows/ai-confirm-node"
|
|
146
|
+
}
|
|
147
|
+
)
|
|
144
148
|
}
|
|
145
149
|
};
|
|
146
150
|
|
|
@@ -501,14 +505,6 @@ function unknownArrayToXml(rootName, itemName, items) {
|
|
|
501
505
|
lines.push(`</${rootName}>`, "");
|
|
502
506
|
return lines.join("\n");
|
|
503
507
|
}
|
|
504
|
-
function tasksForStatusYaml(tasks) {
|
|
505
|
-
return tasks.map((t) => ({
|
|
506
|
-
id: t.id,
|
|
507
|
-
title: t.title,
|
|
508
|
-
status: t.status,
|
|
509
|
-
executor: t.executorType
|
|
510
|
-
}));
|
|
511
|
-
}
|
|
512
508
|
function escapeForCdata(text) {
|
|
513
509
|
return text.replace(/\]\]>/g, "]]]]><![CDATA[>");
|
|
514
510
|
}
|
|
@@ -547,8 +543,7 @@ async function runPull(requirementId, workspaceDir) {
|
|
|
547
543
|
id: req2.id,
|
|
548
544
|
status: req2.status,
|
|
549
545
|
title: req2.title,
|
|
550
|
-
env: req2.envName || ""
|
|
551
|
-
tasks: tasksForStatusYaml(data.tasks ?? [])
|
|
546
|
+
env: req2.envName || ""
|
|
552
547
|
},
|
|
553
548
|
{ lineWidth: 0 }
|
|
554
549
|
);
|
|
@@ -635,6 +630,7 @@ function runConnect(opts) {
|
|
|
635
630
|
const payload = msg.payload;
|
|
636
631
|
const apmRoot = join5(payload.cwd, ".apm");
|
|
637
632
|
console.log("[apm] ROOT:", apmRoot);
|
|
633
|
+
console.log("[apm] workflow node:", payload.nodeId);
|
|
638
634
|
try {
|
|
639
635
|
await runPull(payload.requirementId, apmRoot);
|
|
640
636
|
} catch (pullErr) {
|
|
@@ -656,23 +652,14 @@ function runConnect(opts) {
|
|
|
656
652
|
requirementId: payload.requirementId,
|
|
657
653
|
status: "WORKING"
|
|
658
654
|
});
|
|
659
|
-
await api.
|
|
660
|
-
taskId: payload.taskId,
|
|
655
|
+
await api.spaceWorkflow.aiStartNode({
|
|
661
656
|
requirementId: payload.requirementId,
|
|
657
|
+
nodeId: payload.nodeId,
|
|
662
658
|
agentId: agent.agentId
|
|
663
659
|
});
|
|
664
|
-
let IN_PROGRESS = false;
|
|
665
660
|
const session = new EventSession(payload.prompt);
|
|
666
661
|
const run = await agent.send(payload.prompt);
|
|
667
662
|
for await (const event of run.stream()) {
|
|
668
|
-
if (!IN_PROGRESS) {
|
|
669
|
-
await api.cliRequirements.updateTaskStatus({
|
|
670
|
-
taskId: payload.taskId,
|
|
671
|
-
requirementId: payload.requirementId,
|
|
672
|
-
status: "IN_PROGRESS"
|
|
673
|
-
});
|
|
674
|
-
IN_PROGRESS = true;
|
|
675
|
-
}
|
|
676
663
|
if (event.type === "status") {
|
|
677
664
|
console.log(`[Status]`, event.message || event.status);
|
|
678
665
|
continue;
|
|
@@ -707,11 +694,6 @@ function runConnect(opts) {
|
|
|
707
694
|
}
|
|
708
695
|
console.log("\u672A\u77E5\u4E8B\u4EF6:", JSON.stringify(event, null, 2));
|
|
709
696
|
}
|
|
710
|
-
await api.cliRequirements.updateTaskStatus({
|
|
711
|
-
taskId: payload.taskId,
|
|
712
|
-
requirementId: payload.requirementId,
|
|
713
|
-
status: "PENDING_ACCEPTANCE"
|
|
714
|
-
});
|
|
715
697
|
await api.cliRequirements.updateDevStatus({
|
|
716
698
|
requirementId: payload.requirementId,
|
|
717
699
|
status: "IDLE"
|
|
@@ -724,6 +706,11 @@ function runConnect(opts) {
|
|
|
724
706
|
console.error("[apm] apm upload-artifact \u5931\u8D25:", pullErr);
|
|
725
707
|
throw pullErr;
|
|
726
708
|
}
|
|
709
|
+
const confirmResult = await api.spaceWorkflow.aiConfirmNode({
|
|
710
|
+
requirementId: payload.requirementId,
|
|
711
|
+
nodeId: payload.nodeId
|
|
712
|
+
});
|
|
713
|
+
console.log("[apm] \u5DE5\u4F5C\u6D41\u8282\u70B9\u72B6\u6001:", confirmResult.nodeStatus);
|
|
727
714
|
} catch {
|
|
728
715
|
console.error("[apm] \u65E0\u6CD5\u89E3\u6790 WebSocket \u6D88\u606F:", text);
|
|
729
716
|
}
|
|
@@ -1310,6 +1297,16 @@ var createDockerodeClient = (config) => new DockerodeClient(config);
|
|
|
1310
1297
|
// src/commands/deploy/lib/backend-deploy/dockerode-client/env.ts
|
|
1311
1298
|
import { existsSync as existsSync5, readFileSync as readFileSync8, statSync as statSync3 } from "node:fs";
|
|
1312
1299
|
import path2 from "node:path";
|
|
1300
|
+
function stripSurroundingQuotes(value) {
|
|
1301
|
+
const t = value.trim();
|
|
1302
|
+
if (t.length >= 2) {
|
|
1303
|
+
const q = t[0];
|
|
1304
|
+
if ((q === '"' || q === "'") && t[t.length - 1] === q) {
|
|
1305
|
+
return t.slice(1, -1);
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
return t;
|
|
1309
|
+
}
|
|
1313
1310
|
function loadEnvFromFile(envFilePath) {
|
|
1314
1311
|
if (!envFilePath) {
|
|
1315
1312
|
return {};
|
|
@@ -1330,7 +1327,7 @@ function loadEnvFromFile(envFilePath) {
|
|
|
1330
1327
|
continue;
|
|
1331
1328
|
}
|
|
1332
1329
|
const key = normalized.slice(0, eqIndex).trim();
|
|
1333
|
-
const value = normalized.slice(eqIndex + 1);
|
|
1330
|
+
const value = stripSurroundingQuotes(normalized.slice(eqIndex + 1));
|
|
1334
1331
|
if (key !== "") {
|
|
1335
1332
|
result[key] = value;
|
|
1336
1333
|
}
|