Complete or cancel threads manually for non-contract workflows
Closing a thread allows you to explicitly mark threads as completed or cancelled. Contract-based threads end automatically at terminal steps, while non-contract threads require manual ending.
const thread = await threadify.start(); // No contract// Record some stepsawait thread.step('process_order').success();await thread.step('send_email').success();// Manually end the threadawait thread.complete('All steps finished');// ORawait thread.cancel('User cancelled order');