import type { Context } from "@earendil-works/chord"; import { LiveDoc, type ToolExecutionApi } from "@earendil-works/pi-durable"; /** Record when execution starts independently of renderer-specific progress details. */ export async function startTool(api: ToolExecutionApi, context: Context): Promise { const startedAt = Date.now(); await api.commit(async (tx) => { const live = await tx.doc(LiveDoc, api.conversationId); const slot = live.tools?.find((slot) => slot.callId === api.callId); // pi-durable does not yet record a wall-clock start time on the slot if (slot) Object.assign(slot, { startedAt }); }, context); }