fix: use async/await instead of .then() in getWorkflowDescriptor

This commit is contained in:
2026-05-12 10:29:50 +08:00
parent 81a7a8c7c1
commit b1e66fa7a4
+5 -3
View File
@@ -147,13 +147,15 @@ export function listWorkflows(agent: string): Promise<{ workflows: WorkflowSumma
return fetchJson(agentBase(agent), "/workflows");
}
export function getWorkflowDescriptor(
export async function getWorkflowDescriptor(
agent: string,
name: string,
): Promise<WorkflowDescriptor | null> {
return fetchJson<WorkflowDetail>(agentBase(agent), `/workflows/${encodeURIComponent(name)}`).then(
(res) => res.descriptor,
const res = await fetchJson<WorkflowDetail>(
agentBase(agent),
`/workflows/${encodeURIComponent(name)}`,
);
return res.descriptor;
}
export function listThreads(agent: string): Promise<{ threads: ThreadSummary[] }> {