mirror of
https://github.com/run-llama/workflows-ts.git
synced 2026-07-20 21:59:32 -04:00
[PR #24] [MERGED] feat: middleware withTraceEvents
#39
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/run-llama/workflows-ts/pull/24
Author: @himself65
Created: 4/5/2025
Status: ✅ Merged
Merged: 4/6/2025
Merged by: @himself65
Base:
main← Head:trace-events📝 Commits (10+)
e1002ddfeat: middlewarewithTraceEvents738339dfix: naming6a7c455fix: namingd5a9584docs: update README.mdbfb53fadocs: update README.md08d0ebctest: add full examplef40eae3test: fixb9f7247doc: updatef443228fix: log6abf194fix: doc📊 Changes
17 files changed (+696 additions, -120 deletions)
View changed files
📝
README.md(+124 -1)📝
packages/fluere/src/core/event.ts(+0 -2)📝
packages/fluere/src/core/internal/context.ts(+38 -9)📝
packages/fluere/src/core/internal/executor.ts(+33 -25)📝
packages/fluere/src/core/workflow.ts(+23 -35)📝
packages/fluere/src/middleware/store.ts(+36 -12)➕
packages/fluere/src/middleware/trace-events.ts(+152 -0)➕
packages/fluere/src/middleware/trace-events/create-handler-decorator.ts(+46 -0)➕
packages/fluere/src/middleware/trace-events/run-once.ts(+10 -0)📝
packages/fluere/src/middleware/validation.ts(+11 -14)📝
packages/fluere/src/util/zod.ts(+10 -11)➕
packages/fluere/tests/full-workflow.spec.ts(+79 -0)➕
packages/fluere/tests/with-trace-events.spec.ts(+110 -0)📝
packages/fluere/tests/with-validation.spec.ts(+17 -5)📝
packages/fluere/tsconfig.browser.json(+4 -1)📝
packages/fluere/tsconfig.json(+2 -2)📝
vitest.workspace.ts(+1 -3)📄 Description
withTraceEventsAdds tracing capabilities to your workflow, allowing you to monitor/decorate handler and debug event flows easily.
When enabled,
it collects events based on the directed graph of the runtime and provide lifecycle hooks for each handler.
createHandlerDecoratorYou can create your own handler decorator to modify the behavior of the handler.
HandlerContextThe
HandlerContextincludes the runtime information of the handler in the directed graph of the workflow.For example, when you send two
startEventevents, and sendmessageEventtwice (once in the handler and once in the global),the
HandlerContextfrom root to leaf is:You can use any directed graph library to visualize the directed graph of the workflow.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.