23de918e94
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
13 lines
612 B
TypeScript
13 lines
612 B
TypeScript
import { TaskTreeStore } from "./store.ts";
|
|
|
|
export function createTaskTreeActivities(store: TaskTreeStore) {
|
|
return {
|
|
async recordTaskExecution(input: { taskId: string }) {
|
|
const task = await store.updateTask(input.taskId, { status: "completed" });
|
|
if (!task) throw Object.assign(new Error("task was not found"), { code: "task_not_found" });
|
|
const report = await store.createReport({ taskId: task.id, title: "Temporal execution report", body: `Task ${task.title} completed by Temporal worker.`, status: "succeeded" });
|
|
return { taskId: task.id, reportId: report.id };
|
|
}
|
|
};
|
|
}
|