ai-project-manage-cli 3.0.24 → 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.
Files changed (2) hide show
  1. package/dist/index.js +23 -40
  2. 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.cliRequirements.updateTaskAgentId({
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,12 +706,13 @@ function runConnect(opts) {
724
706
  console.error("[apm] apm upload-artifact \u5931\u8D25:", pullErr);
725
707
  throw pullErr;
726
708
  }
727
- } catch (e) {
728
- console.error(
729
- "[apm] \u65E0\u6CD5\u89E3\u6790 WebSocket \u6D88\u606F:",
730
- text,
731
- e.message
732
- );
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);
714
+ } catch {
715
+ console.error("[apm] \u65E0\u6CD5\u89E3\u6790 WebSocket \u6D88\u606F:", text);
733
716
  }
734
717
  });
735
718
  ws.on("error", (err) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-project-manage-cli",
3
- "version": "3.0.24",
3
+ "version": "4.0.1",
4
4
  "description": "命令行工具:后续用于调用平台后端 API 完成运维与自动化操作",
5
5
  "type": "module",
6
6
  "private": false,