ai-project-manage-cli 4.0.13 → 4.0.14

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.
Files changed (2) hide show
  1. package/dist/index.js +24 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -164,7 +164,11 @@ var requestConfig = {
164
164
  method: "POST",
165
165
  path: "/space-workflows/ai-confirm-node"
166
166
  }
167
- )
167
+ ),
168
+ aiFailNode: defineEndpoint({
169
+ method: "POST",
170
+ path: "/space-workflows/ai-fail-node"
171
+ })
168
172
  }
169
173
  };
170
174
 
@@ -837,13 +841,19 @@ function runConnect(opts) {
837
841
  });
838
842
  const session = new EventSession(payload.prompt);
839
843
  const run = await agent.send(payload.prompt);
844
+ let agentRunFailed = false;
845
+ let agentFailReason = "";
840
846
  for await (const event of run.stream()) {
841
847
  if (event.type === "status") {
842
848
  console.log(`[Status]`, event.message || event.status);
843
849
  if (event.status === "ERROR") {
844
- console.log("===============================================");
845
- console.log(JSON.stringify(event, null, 2));
846
- console.log("===============================================");
850
+ agentRunFailed = true;
851
+ agentFailReason = event.message?.trim() ?? "";
852
+ console.error(
853
+ "[apm] Agent \u6267\u884C\u5931\u8D25:",
854
+ agentFailReason || "(\u65E0\u5931\u8D25\u539F\u56E0)"
855
+ );
856
+ break;
847
857
  }
848
858
  continue;
849
859
  }
@@ -881,8 +891,17 @@ function runConnect(opts) {
881
891
  requirementId: payload.requirementId,
882
892
  status: "IDLE"
883
893
  });
884
- console.log("[Done]");
885
894
  session.writeToFile(payload.cwd, payload.requirementId, run.agentId);
895
+ if (agentRunFailed) {
896
+ const failResult = await api.spaceWorkflow.aiFailNode({
897
+ requirementId: payload.requirementId,
898
+ nodeId: payload.nodeId,
899
+ error: agentFailReason
900
+ });
901
+ console.log("[apm] \u5DE5\u4F5C\u6D41\u8282\u70B9\u72B6\u6001:", failResult.nodeStatus);
902
+ return;
903
+ }
904
+ console.log("[Done]");
886
905
  try {
887
906
  await runUploadArtifact(payload.requirementId, apmRoot);
888
907
  } catch (pullErr) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-project-manage-cli",
3
- "version": "4.0.13",
3
+ "version": "4.0.14",
4
4
  "description": "命令行工具:后续用于调用平台后端 API 完成运维与自动化操作",
5
5
  "type": "module",
6
6
  "private": false,