fix(workflow): 复刻前端保存的 $platformId 与 chooses 刷新

- 全量保存时自动补充 inputs: [{$platformId}],避免平台把内置节点 desc 重置为「」
- 保存后调用 pipelines/{id}/chooses,与前端“保存更新”保持一致
- createWorkflowDetailClient 返回当前 platformId,node add/edit/map/rm 保存路径传入
- 更新保存/节点编排测试 mock,重新生成 dist/mcp/server.js
This commit is contained in:
gitea committed 2026-10-28 10:56:02 +08:00
1 parent efb5b0e1bd
commit 1d24c022ab
8 files changed
+401 -361

No files matched your search

+10 -10
View File
@@ -133,7 +133,7 @@ async function handleListNodes(
parsed: CliParsedArgs,
runtime: CliRuntime
): Promise<CliResult> {
const { client } = await createWorkflowDetailClient(parsed, runtime, pipelineId);
const { client, platformId } = await createWorkflowDetailClient(parsed, runtime, pipelineId);
const detail = await getWorkflowDetail(client, pipelineId);
const tasks = detail.tasks || [];
const flattened = flattenWorkflowTaskTree(tasks);
@@ -190,7 +190,7 @@ async function handleGetNode(
};
}
const { client } = await createWorkflowDetailClient(parsed, runtime, pipelineId);
const { client, platformId } = await createWorkflowDetailClient(parsed, runtime, pipelineId);
const detail = await getWorkflowDetail(client, pipelineId);
const located = findWorkflowTask(detail.tasks || [], nodeTarget);
@@ -290,7 +290,7 @@ async function handleAddNode(
`hose-use workflow node add ${pipelineId} --type=${type}${label ? ` --label="${label}"` : ""}${displayName ? ` --display-name="${displayName}"` : ""}${parent ? ` --parent="${parent}"` : ""}${after ? ` --after="${after}"` : ""} --yes`
);
const { client } = await createWorkflowDetailClient(parsed, runtime, pipelineId);
const { client, platformId } = await createWorkflowDetailClient(parsed, runtime, pipelineId);
const detail = await getWorkflowDetail(client, pipelineId);
const { workflow: updatedWorkflow, newTask } = addWorkflowTask(detail, {
@@ -315,7 +315,7 @@ async function handleAddNode(
});
}
const saveResult = await updateWorkflow(client, updatedWorkflow);
const saveResult = await updateWorkflow(client, updatedWorkflow, platformId);
if (runtime.jsonMode) {
return {
@@ -410,7 +410,7 @@ async function handleEditNode(
`hose-use workflow node edit ${pipelineId} ${nodeTarget}${label ? ` --label="${label}"` : ""}${displayName ? ` --display-name="${displayName}"` : ""} --yes`
);
const { client } = await createWorkflowDetailClient(parsed, runtime, pipelineId);
const { client, platformId } = await createWorkflowDetailClient(parsed, runtime, pipelineId);
const detail = await getWorkflowDetail(client, pipelineId);
const { workflow: updatedWorkflow, editedTask } = editWorkflowTask(detail, nodeTarget, {
@@ -436,7 +436,7 @@ async function handleEditNode(
});
}
const saveResult = await updateWorkflow(client, updatedWorkflow);
const saveResult = await updateWorkflow(client, updatedWorkflow, platformId);
if (runtime.jsonMode) {
return {
@@ -516,7 +516,7 @@ async function handleMapNode(
`hose-use workflow node map ${pipelineId} ${nodeTarget} --yes`
);
const { client } = await createWorkflowDetailClient(parsed, runtime, pipelineId);
const { client, platformId } = await createWorkflowDetailClient(parsed, runtime, pipelineId);
const detail = await getWorkflowDetail(client, pipelineId);
const { workflow: updatedWorkflow, editedTask, changedKeys } = applyNodeMapping(detail, nodeTarget, mappingData);
@@ -534,7 +534,7 @@ async function handleMapNode(
});
}
const saveResult = await updateWorkflow(client, updatedWorkflow);
const saveResult = await updateWorkflow(client, updatedWorkflow, platformId);
if (runtime.jsonMode) {
return {
@@ -572,7 +572,7 @@ async function handleRemoveNode(
`hose-use workflow node rm ${pipelineId} ${nodeTarget} --yes`
);
const { client } = await createWorkflowDetailClient(parsed, runtime, pipelineId);
const { client, platformId } = await createWorkflowDetailClient(parsed, runtime, pipelineId);
const detail = await getWorkflowDetail(client, pipelineId);
const { workflow: updatedWorkflow, removedTask } = removeWorkflowTask(detail, nodeTarget);
@@ -587,7 +587,7 @@ async function handleRemoveNode(
});
}
const saveResult = await updateWorkflow(client, updatedWorkflow);
const saveResult = await updateWorkflow(client, updatedWorkflow, platformId);
if (runtime.jsonMode) {
return {