pipeai 0.8.1 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -299,6 +299,23 @@ const pipeline = Workflow.create<Ctx>()
299
299
  });
300
300
  ```
301
301
 
302
+ An inline `.step(id, fn)` handler receives `{ ctx, input, writer? }`. When the workflow runs via `.stream(...)`, `writer` is the same `UIMessageStreamWriter` the agent steps merge into — so an inline step can surface mid-pipeline progress (status/data parts) to the client before the terminal agent starts emitting tokens. `writer` is `undefined` in generate mode (`.generate(...)`), so guard with `?.`:
303
+
304
+ ```ts
305
+ const pipeline = Workflow.create<Ctx>()
306
+ .step("plan", async ({ ctx, input, writer }) => {
307
+ writer?.write({ type: "data-status", data: { phase: "planning" } });
308
+ return planner.run(ctx, input);
309
+ })
310
+ .step("search", async ({ ctx, input, writer }) => {
311
+ writer?.write({ type: "data-status", data: { phase: "searching", queries: input.queries.length } });
312
+ return ctx.search.run(input.queries);
313
+ })
314
+ .step(synthesizerAgent); // terminal streaming agent
315
+ ```
316
+
317
+ For ambient writer access from helper functions called *inside* a step, compose the AI SDK's `createUIMessageStream` directly — pipeai only threads `writer` into the inline step handler itself.
318
+
302
319
  ### Running a workflow
303
320
 
304
321
  ```ts
package/dist/index.cjs CHANGED
@@ -1342,7 +1342,10 @@ var Workflow = class _Workflow extends SealedWorkflow {
1342
1342
  execute: async (state) => {
1343
1343
  state.output = await fn({
1344
1344
  ctx: state.ctx,
1345
- input: state.output
1345
+ input: state.output,
1346
+ // Present in stream mode (undefined in generate mode), letting the
1347
+ // inline step emit UIMessageChunk parts onto the workflow's stream.
1348
+ writer: state.writer
1346
1349
  });
1347
1350
  }
1348
1351
  };