### Run HTTP Server Example Source: https://github.com/notation-dev/yieldstar/blob/main/CONTRIBUTING.md Starts the YieldStar HTTP server example using Bun. This is typically run in one terminal. ```Shell bun examples/http-server/server.ts ``` -------------------------------- ### Install @yieldstar/bun-http-server Source: https://github.com/notation-dev/yieldstar/blob/main/packages/bun-http-server/README.md Installs the @yieldstar/bun-http-server package using npm. ```sh npm install @yieldstar/bun-http-server ``` -------------------------------- ### Run HTTP Server App Example Source: https://github.com/notation-dev/yieldstar/blob/main/CONTRIBUTING.md Executes the client application for the HTTP server example. This is typically run in a second terminal after starting the server. ```Shell bun examples/http-server/app.ts ``` -------------------------------- ### Prepare for Release Source: https://github.com/notation-dev/yieldstar/blob/main/CLAUDE.md Command to install dependencies and bundle the project in preparation for a release. ```shell bun run prerelease ``` -------------------------------- ### Inspect Example Workflows Source: https://github.com/notation-dev/yieldstar/blob/main/CLAUDE.md Command to run a helper script that prompts the user to select and import a workflow file from the examples directory for interactive inspection. ```shell bun start ``` -------------------------------- ### Run Local Execution Example Source: https://github.com/notation-dev/yieldstar/blob/main/CONTRIBUTING.md Executes a local workflow execution example using TypeScript and Bun. This demonstrates how to run workflows outside of a server environment. ```Shell bun examples/local-execution/app.ts ``` -------------------------------- ### Install YieldStar Core Package Source: https://github.com/notation-dev/yieldstar/blob/main/packages/yieldstar/README.md Installs the main YieldStar package using the Bun package manager. This is the foundational step for using YieldStar in your project. ```sh bun add yieldstar ``` -------------------------------- ### Install Dependencies with pnpm Source: https://github.com/notation-dev/yieldstar/blob/main/CLAUDE.md Command to install all workspace dependencies in the repository root using pnpm, respecting the lock file. ```shell pnpm install ``` -------------------------------- ### Basic Server Setup with createRoutes Source: https://github.com/notation-dev/yieldstar/blob/main/packages/bun-http-server/README.md Sets up a basic Bun.js HTTP server using createRoutes from @yieldstar/bun-http-server. It configures the server with an invoker, logger, and middleware. ```typescript import { createRoutes } from "@yieldstar/bun-http-server"; import { pino } from "pino"; const logger = pino(); const server = Bun.serve({ port: 3000, routes: createRoutes({ invoker: invoker, logger: logger, middleware: [middleware1, middleware2], }), }); logger.info(`Server started on port ${server.url}`); ``` -------------------------------- ### Importing Bun Test Utilities Source: https://github.com/notation-dev/yieldstar/blob/main/CLAUDE.md Example of importing testing utilities like expect, test, and mock from Bun's test module in TypeScript. ```typescript import { expect, test, mock } from "bun:test"; ``` -------------------------------- ### Install Dependencies with pnpm Source: https://github.com/notation-dev/yieldstar/blob/main/CONTRIBUTING.md Installs all project dependencies using the pnpm package manager. This is a prerequisite for development. ```Shell pnpm install ``` -------------------------------- ### Install YieldStar with Bun Source: https://github.com/notation-dev/yieldstar/blob/main/README.md This command installs the YieldStar package using the Bun package manager. YieldStar is designed to run on Bun. ```sh bun add yieldstar ``` -------------------------------- ### Monorepo Workspace Configuration Source: https://github.com/notation-dev/yieldstar/blob/main/CLAUDE.md Defines the workspaces included in the pnpm monorepo, specifying directories for packages, examples, and tests. ```yaml packages: - packages/* - examples - test ``` -------------------------------- ### Development Workflow with Bun Watch Source: https://github.com/notation-dev/yieldstar/blob/main/CONTRIBUTING.md Starts a development server that concurrently runs type-checking, builds, and tests in watch mode. This provides a rapid feedback loop during development. ```Shell bun run dev ``` -------------------------------- ### Bun HTTP Server Setup with Yieldstar Source: https://github.com/notation-dev/yieldstar/blob/main/packages/yieldstar/README.md Sets up an HTTP server using Bun to expose Yieldstar workflows. It includes middleware for authorization and integrates with a SQLite database for event handling. The server uses the `@yieldstar/bun-http-server` and `@yieldstar/bun-worker-invoker` packages. ```TypeScript import pino from "pino"; import { createRoutes, createMiddleware } from "@yieldstar/bun-http-server"; import { createWorkflowInvoker } from "@yieldstar/bun-worker-invoker"; import { SqliteEventLoop, createSqliteDb } from "@yieldstar/bun-sqlite-runtime"; import { router } from "./router"; const logger = pino(); const workerPath = new URL("./worker.ts", import.meta.url).href; const invoker = createWorkflowInvoker({ workerPath, logger }); const db = createSqliteDb({ path: "./.db/http.sqlite" }); new SqliteEventLoop(db).start({ onNewEvent: invoker.execute, logger }); const auth = createMiddleware(async (req, event, next) => { if (!req.headers.get("Authorization")) return new Response("Unauthorized", { status: 401 }); return next(); }); Bun.serve({ port: 8080, routes: { "/status": new Response("OK"), ...createRoutes({ invoker, logger, middleware: [auth] }) }, }); ``` -------------------------------- ### Test Workflows with In-Memory Runtime Source: https://github.com/notation-dev/yieldstar/blob/main/packages/yieldstar/README.md Example of testing workflows using the internal `@yieldstar/test-utils` package. It demonstrates triggering a workflow and waiting for its result in a test environment. ```TypeScript import { test, expect } from "bun:test"; import { createTestSdkFactory } from "@yieldstar/test-utils"; import { createWorkflow } from "yieldstar"; test("data flow between steps", async () => { const w = createWorkflow(async function* (step) { let n = yield* step.run(() => 1); n = yield* step.run(() => n * 2); return n; }); const createSdk = createTestSdkFactory(); const sdk = createSdk({ workflow: w }); expect(await sdk.triggerAndWait({ workflowId: "workflow" })).toBe(2); }); ``` -------------------------------- ### Yieldstar Step Runner Methods Source: https://github.com/notation-dev/yieldstar/blob/main/packages/yieldstar/README.md Details the available methods on the `StepRunner` object in Yieldstar workflows, including `run`, `delay`, and `poll`, with examples of their usage and optional key parameters. ```TypeScript // run yield* step.run(fn); yield* step.run("key", fn); // delay yield* step.delay(ms); yield* step.delay("key", ms); // poll yield* step.poll({ retryInterval, maxAttempts }, predicate); yield* step.poll("key", { retryInterval, maxAttempts }, predicate); ``` -------------------------------- ### Set Up YieldStar Workflow Worker with SQLite (TypeScript) Source: https://github.com/notation-dev/yieldstar/blob/main/packages/yieldstar/README.md Configures and starts a YieldStar workflow worker using Bun and SQLite for persistence. This worker executes workflow steps and manages state. ```typescript // worker.ts import pino from "pino"; import { WorkflowRunner } from "@yieldstar/core"; import { createWorkflowWorker } from "@yieldstar/bun-worker-invoker"; import { SqliteHeapClient, SqliteTimersClient, SqliteTaskQueueClient, SqliteSchedulerClient, createSqliteDb } from "@yieldstar/bun-sqlite-runtime"; import { router } from "./router"; const logger = pino(); const db = createSqliteDb({ path: "./.db/local.sqlite" }); const runner = new WorkflowRunner({ router, heapClient: new SqliteHeapClient(db), schedulerClient: new SqliteSchedulerClient({ taskQueueClient: new SqliteTaskQueueClient(db), timersClient: new SqliteTimersClient(db), }), logger, }); createWorkflowWorker(runner, logger).listen(); ``` -------------------------------- ### Run YieldStar Workflow Locally with SQLite (TypeScript) Source: https://github.com/notation-dev/yieldstar/blob/main/packages/yieldstar/README.md Sets up the application to drive a YieldStar worker and trigger workflows locally using SQLite. It demonstrates starting an event loop and invoking a workflow. ```typescript // app.ts import pino from "pino"; import { createWorkflowInvoker } from "@yieldstar/bun-worker-invoker"; import { createLocalSdk } from "yieldstar"; import { SqliteEventLoop, createSqliteDb } from "@yieldstar/bun-sqlite-runtime"; const logger = pino(); const workerPath = new URL("./worker.ts", import.meta.url).href; const invoker = createWorkflowInvoker({ workerPath, logger }); const db = createSqliteDb({ path: "./.db/local.sqlite" }); const loop = new SqliteEventLoop(db); loop.start({ onNewEvent: invoker.execute, logger }); const sdk = createLocalSdk(invoker); const result = await sdk.triggerAndWait({ workflowId: "simple-workflow" }); console.log(result); // 2 ``` -------------------------------- ### Yieldstar Custom Step-Like Helpers Source: https://github.com/notation-dev/yieldstar/blob/main/packages/yieldstar/README.md Shows how to create reusable, custom step-like functions in Yieldstar by composing built-in steps. This example defines a `waitForState` helper that uses `step.poll` internally, demonstrating how to abstract complex logic into manageable units. ```TypeScript const waitForState = (step: any, logger: any) => async function* (state: string) { yield* step.poll({ maxAttempts: 10, retryInterval: 1000 }, () => /* check */ true); }; export const coordinator = workflow(async function* (step) { const a = yield* step.run(() => 2); yield* (waitForState(step, console) as any)("enabled"); return yield* step.run(() => a * 3); }); ``` -------------------------------- ### Define a Simple YieldStar Workflow Source: https://github.com/notation-dev/yieldstar/blob/main/README.md This TypeScript example demonstrates how to define a simple workflow using YieldStar. The workflow executes a step, waits for a delay, and then runs another step, returning the result. It utilizes the `workflow` function and `step` object provided by the YieldStar library. ```typescript import { workflow } from "yieldstar"; export const simple = workflow(async function* (step) { const n = yield* step.run(() => 1); yield* step.delay(1000); return yield* step.run(() => n * 2); }); ``` -------------------------------- ### Yieldstar Workflow Parameters Source: https://github.com/notation-dev/yieldstar/blob/main/packages/yieldstar/README.md Illustrates how to pass parameters into a Yieldstar workflow and access them within the workflow execution using `event.params`. This example shows triggering a workflow with parameters and defining a workflow that logs and returns these parameters. ```TypeScript const result = await sdk.triggerAndWait({ workflowId: "w", params: { userId: "123" } }); export const w = workflow(async function* (step, event, logger) { logger.info("user:", event.params?.userId); return yield* step.run(() => event.params); }); ``` -------------------------------- ### Execute Release Script Source: https://github.com/notation-dev/yieldstar/blob/main/CLAUDE.md Command to execute the main release script, which handles versioning, publishing, and account switching. ```shell bun run release ``` -------------------------------- ### Run All Tests with Bun Source: https://github.com/notation-dev/yieldstar/blob/main/CLAUDE.md Command to execute all integration tests within the repository using Bun's built-in test runner. ```shell bun test ``` -------------------------------- ### Create Pre-release Build with Bun Source: https://github.com/notation-dev/yieldstar/blob/main/CONTRIBUTING.md Generates a pre-release build of the project using a Bun script. This prepares the project for testing before a full release. ```Shell bun run prerelease ``` -------------------------------- ### Middleware Lifecycle and Context Management Source: https://github.com/notation-dev/yieldstar/blob/main/packages/bun-http-server/README.md Illustrates the middleware lifecycle using createMiddleware. It shows how to read request headers, access/set context, and modify responses. It also highlights that context becomes read-only after `next()` is called. ```typescript import { createMiddleware } from "@yieldstar/bun-http-server"; const myMiddleware = createMiddleware(async (req, event, next) => { // Read the HTTP request const token = req.headers.get("X-token"); // Read context set by previous middlewares event.context.get("token"); // Set context if (!token) { event.context.set("token", token); } // Advance the middleware chain until either: // A middleware function returns a response, // or, the final handler invokes the workflow const response = await next(); // After next() is called, the context is frozen to prevent modifications // Any attempt to modify the context will throw an error: event.context.set("key", "value"); // Error: Cannot call set on a frozen map // When passed to the workflow, the context is converted to a read-only version // that prevents modifications in the workflow // The response can still be updated before it is sent to the user response.headers.set("X-Handled-By", "SuperAceDev"); return response; }); ``` -------------------------------- ### Custom Routes with createRoutes and basePath Source: https://github.com/notation-dev/yieldstar/blob/main/packages/bun-http-server/README.md Demonstrates how to create custom routes and mount workflow routes under a specific base path using createRoutes. ```typescript Bun.serve({ port: 3000, routes: { "/status": new Response('OK'), // mount workflow routes on /workflow ...createRoutes({ basePath: "/workflow", invoker, logger, }), }, }); ``` -------------------------------- ### Release Project with Bun Source: https://github.com/notation-dev/yieldstar/blob/main/CONTRIBUTING.md Publishes the project's packages to the registry using a Bun script. This command handles the final release process. ```Shell bun run release ``` -------------------------------- ### Build All Packages Source: https://github.com/notation-dev/yieldstar/blob/main/CLAUDE.md Command to compile all packages in the monorepo, including running each package's build script and generating type declarations with tsc. ```shell bun run bundle ``` -------------------------------- ### Run Tests with Bun Source: https://github.com/notation-dev/yieldstar/blob/main/CONTRIBUTING.md Executes all project tests using Bun's built-in test runner. Tests are located in the 'test/' directory. ```Shell bun test ``` -------------------------------- ### Bump Version for Release Source: https://github.com/notation-dev/yieldstar/blob/main/CLAUDE.md Command to bump the package version, typically with an alpha pre-release tag, using npm scripts. ```shell bun run version ``` -------------------------------- ### Build All Packages with Bun Source: https://github.com/notation-dev/yieldstar/blob/main/CONTRIBUTING.md Compiles all packages in the monorepo and emits TypeScript declarations using project references. This command runs individual package build scripts and then TypeScript compilation. ```Shell bun run bundle ``` -------------------------------- ### Yieldstar HTTP SDK Client Source: https://github.com/notation-dev/yieldstar/blob/main/packages/yieldstar/README.md Demonstrates how to use the Yieldstar HTTP SDK to trigger and interact with workflows exposed via an HTTP server. It shows how to create an SDK instance, trigger a workflow, acknowledge its execution, and wait for the result. ```TypeScript import { createHttpSdkFactory } from "yieldstar"; const createSdk = createHttpSdkFactory<{ "dynamic-workflow": any }>(); const sdk = createSdk({ url: "http://localhost:8080" }); const exec = await sdk.trigger({ workflowId: "dynamic-workflow", params: { msg: "world" } }); await exec.ack(); const result = await exec.waitForResult(); ``` -------------------------------- ### CORS and Authentication Middleware Source: https://github.com/notation-dev/yieldstar/blob/main/packages/bun-http-server/README.md Implements CORS and authentication middleware using createMiddleware. The CORS middleware adds necessary headers, while the authentication middleware checks for a token and stores it in the context. ```typescript import { createRoutes, createMiddleware } from "@yieldstar/bun-http-server"; // CORS middleware const corsMiddleware = createMiddleware(async (req, event, next) => { // Continue to the next middleware or handler const response = await next(); // Add CORS headers to the response response.headers.set("Access-Control-Allow-Origin", "*"); response.headers.set( "Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS" ); response.headers.set( "Access-Control-Allow-Headers", "Content-Type, Authorization" ); return response; }); // Authentication middleware const authMiddleware = createMiddleware(async (req, event, next) => { // Get auth token from request const cookies = parseCookies(req.headers.get("Cookie")); const authToken = cookies["X-Token"]; if (!authToken) { return new Response("Unauthorized", { status: 401 }); } // Store the auth token in the context event.context.set("authToken", authToken); // Continue to the next middleware or handler return next(); }); // Create server with middleware const server = Bun.serve({ port: 8080, routes: createRoutes({ logger, invoker, middleware: [corsMiddleware, authMiddleware], }), }); ``` -------------------------------- ### Type Checking and Declaration Generation Source: https://github.com/notation-dev/yieldstar/blob/main/CLAUDE.md Command to perform type checking across all monorepo packages and generate type declarations using Bun. ```shell bun dts ``` -------------------------------- ### Create and Use HTTP SDK Client Source: https://github.com/notation-dev/yieldstar/blob/main/packages/yieldstar/README.md Factory function to create an HTTP SDK client bound to a base URL. The client can trigger workflows, acknowledge execution, and wait for results. ```TypeScript const createSdk = createHttpSdkFactory(); const sdk = createSdk({ url, fetchOptions? }); const exec = await sdk.trigger({ workflowId, params?, context?, executionId? }); await exec.ack(); const result = await exec.waitForResult(); ``` -------------------------------- ### Yieldstar Local SDK Usage Source: https://github.com/notation-dev/yieldstar/blob/main/packages/yieldstar/README.md Demonstrates how to create and use a local Yieldstar SDK client, which interacts with workflows via an in-process `WorkflowInvoker`. This is useful for local testing and development. ```TypeScript const sdk = createLocalSdk(invoker); await sdk.triggerAndWait({ workflowId, params? }); ``` -------------------------------- ### Yieldstar Top-Level API Exports Source: https://github.com/notation-dev/yieldstar/blob/main/packages/yieldstar/README.md Lists the primary exports available from the `yieldstar` package, including functions for creating SDKs, routers, and workflows, as well as the `RetryableError` class. ```JavaScript export { createLocalSdk } from "yieldstar"; export { createHttpSdkFactory } from "yieldstar"; export { createWorkflowRouter } from "yieldstar"; export { RetryableError } from "yieldstar"; export { createWorkflow, workflow } from "yieldstar"; export type { WorkflowFn } from "yieldstar"; ``` -------------------------------- ### Bump Version with Bun Source: https://github.com/notation-dev/yieldstar/blob/main/CONTRIBUTING.md Increments the project's version number, typically for pre-releases, using a Bun script. This is part of the release process. ```Shell bun run version ``` -------------------------------- ### Define a Simple Workflow and Router (TypeScript) Source: https://github.com/notation-dev/yieldstar/blob/main/packages/yieldstar/README.md Defines a basic workflow named 'simple' that runs a calculation after a delay. It also creates a workflow router to expose this workflow. ```typescript // router.ts import { workflow, createWorkflowRouter } from "yieldstar"; export const simple = workflow(async function* (step, event, logger) { const n = yield* step.run(() => 1); yield* step.delay(1000); return yield* step.run(() => n * 2); }); export const router = createWorkflowRouter({ "simple-workflow": simple }); export type Router = typeof router; ``` -------------------------------- ### Define a Dynamic Workflow with Logging (TypeScript) Source: https://github.com/notation-dev/yieldstar/blob/main/packages/yieldstar/README.md Defines a dynamic workflow that generates a random number, waits, and logs a message including input parameters. This showcases workflow step execution and logging. ```typescript import { workflow, createWorkflowRouter } from "yieldstar"; export const dynamic = workflow<{ msg: string }, void>(async function* (step, event, logger) { const n = yield* step.run(() => Math.random()); yield* step.delay(1000); yield* step.run(() => logger.info(`Hello ${event.params.msg}: ${n}`)); }); export const router = createWorkflowRouter({ "dynamic-workflow": dynamic }); ``` -------------------------------- ### Type Checking and Declarations with Bun Source: https://github.com/notation-dev/yieldstar/blob/main/CONTRIBUTING.md Generates and checks TypeScript types across the entire monorepo using a custom Bun script. This ensures type safety. ```Shell bun dts ``` -------------------------------- ### Yieldstar Workflow Cache Keys in Loops Source: https://github.com/notation-dev/yieldstar/blob/main/packages/yieldstar/README.md Highlights the importance of using unique cache keys for each step within a loop in Yieldstar workflows. This ensures that each iteration is treated as a distinct step, preventing errors and enabling proper caching and state management. ```TypeScript for (let i = 0; i < 2; i++) { yield* step.run(`step:${i}`, () => i); } ``` -------------------------------- ### Configure YieldStar Worker for Dynamic Workflow (TypeScript) Source: https://github.com/notation-dev/yieldstar/blob/main/packages/yieldstar/README.md Sets up the YieldStar worker to handle the dynamic workflow using SQLite for persistence. This code is intended to run in a separate worker thread. ```typescript // worker.ts import pino from "pino"; import { WorkflowRunner } from "@yieldstar/core"; import { createWorkflowWorker } from "@yieldstar/bun-worker-invoker"; import { SqliteHeapClient, SqliteTimersClient, SqliteTaskQueueClient, SqliteSchedulerClient } from "@yieldstar/bun-sqlite-runtime"; import { router } from "./router"; import { createSqliteDb } from "@yieldstar/bun-sqlite-runtime"; const logger = pino(); const db = createSqliteDb({ path: "./.db/local.sqlite" }); const runner = new WorkflowRunner({ router, heapClient: new SqliteHeapClient(db), schedulerClient: new SqliteSchedulerClient({ taskQueueClient: new SqliteTaskQueueClient(db), timersClient: new SqliteTimersClient(db), }), logger, }); createWorkflowWorker(runner, logger).listen(); ``` -------------------------------- ### Yieldstar RetryableError Constructor Source: https://github.com/notation-dev/yieldstar/blob/main/packages/yieldstar/README.md Shows the constructor for `RetryableError` in Yieldstar, used to signal retriable failures within workflow steps. It accepts an error message and an options object for configuring `maxAttempts` and `retryInterval`. ```TypeScript new RetryableError(message, { maxAttempts: number, retryInterval: number }); ``` -------------------------------- ### Register and Type Workflows with Router Source: https://github.com/notation-dev/yieldstar/blob/main/packages/yieldstar/README.md Defines and registers workflows using a router. The `Router` type enforces type safety for `workflowId` and `params` when using the SDK. ```TypeScript const router = createWorkflowRouter({ "id": workflow, ... }); type Router = typeof router; ``` -------------------------------- ### Trigger and Wait for Dynamic Workflow (TypeScript) Source: https://github.com/notation-dev/yieldstar/blob/main/packages/yieldstar/README.md Drives the YieldStar worker from the main application thread and triggers a dynamic workflow with parameters. It then waits for the workflow to complete and logs the result. ```typescript // app.ts import pino from "pino"; import { createWorkflowInvoker } from "@yieldstar/bun-worker-invoker"; import { createLocalSdk } from "yieldstar"; import { SqliteEventLoop, createSqliteDb } from "@yieldstar/bun-sqlite-runtime"; const logger = pino(); const workerPath = new URL("./worker.ts", import.meta.url).href; const invoker = createWorkflowInvoker({ workerPath, logger }); const db = createSqliteDb({ path: "./.db/local.sqlite" }); const eventLoop = new SqliteEventLoop(db); eventLoop.start({ onNewEvent: invoker.execute, logger }); const sdk = createLocalSdk<{ "dynamic-workflow": any }>(invoker); const res = await sdk.triggerAndWait({ workflowId: "dynamic-workflow", params: { msg: "hello" } }); console.log(res); ``` -------------------------------- ### Yieldstar Workflow Delays Source: https://github.com/notation-dev/yieldstar/blob/main/packages/yieldstar/README.md Demonstrates how to pause the execution of a Yieldstar workflow for a specified duration using `step.delay`. The workflow will automatically resume after the delay period. ```TypeScript yield* step.delay(5000); ``` -------------------------------- ### Yieldstar Workflow Retries Source: https://github.com/notation-dev/yieldstar/blob/main/packages/yieldstar/README.md Shows how to implement retries for a specific step within a Yieldstar workflow by throwing a `RetryableError`. This allows for automatic retrying of operations that might fail temporarily, with configurable retry attempts and intervals. ```TypeScript import { RetryableError } from "yieldstar"; yield* step.run(async () => { // e.g. flaky fetch throw new RetryableError("temporary", { maxAttempts: 4, retryInterval: 1000 }); }); ``` -------------------------------- ### Yieldstar Workflow Definition Type Source: https://github.com/notation-dev/yieldstar/blob/main/packages/yieldstar/README.md Defines the TypeScript type for a Yieldstar workflow function (`WorkflowFn`), specifying the parameters, result, and context types, along with the `StepRunner`, `WorkflowEvent`, and `Logger` arguments. ```TypeScript type WorkflowFn = ( step: StepRunner, event: WorkflowEvent, logger: Logger ) => AsyncGenerator; ``` -------------------------------- ### Yieldstar Workflow Polling Source: https://github.com/notation-dev/yieldstar/blob/main/packages/yieldstar/README.md Explains how to use `step.poll` in Yieldstar to repeatedly check a condition until it becomes true or a timeout occurs. This pattern is useful for waiting for external states or asynchronous operations to complete, with built-in retry logic. ```TypeScript yield* step.poll({ retryInterval: 1000, maxAttempts: 10 }, () => isReady()); ``` -------------------------------- ### Handle Retries in YieldStar Workflows Source: https://github.com/notation-dev/yieldstar/blob/main/README.md This TypeScript snippet shows how to implement explicit and structured retries within a YieldStar workflow. It uses the `RetryableError` class to define retryable operations, specifying parameters like `maxAttempts` and `retryInterval`. ```typescript import { RetryableError } from "yieldstar"; yield* step.run(async () => { // e.g. flaky fetch throw new RetryableError("temporary", { maxAttempts: 4, retryInterval: 1000 }); }); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.