-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
Add optional stream() async generator to Executor and streaming: boolean to ModuleAnnotations, enabling modules to produce incremental output.
Changes
ModuleAnnotations
- Added
readonly streaming: boolean(defaultfalse) - Updated
DEFAULT_ANNOTATIONSandANNOTATION_FIELDS
Executor.stream()
- New
async *stream(moduleId, inputs?, context?): AsyncGenerator<Record<string, unknown>> - Steps 1-6 identical to
call()(context, safety, lookup, ACL, validate, before-middleware) - If module has no
stream(): falls back tocall(), yields single chunk - If module has
stream(): iterates it, yields each chunk, accumulates via shallow merge - Output validation runs on accumulated result
- After-middleware runs on accumulated result
- Error recovery via middleware
onError
Extracted helper
_validateOutput()extracted from_executeWithMiddleware()for reuse
Tests (8 new)
- Fallback single chunk, multiple chunks, ModuleNotFoundError
- Before/after middleware ordering (streaming + fallback paths)
- Error recovery, output schema validation
- Disjoint-key shallow merge accumulation
Files Changed
src/module.ts—streamingfieldsrc/executor.ts—stream(),_streamWithMiddleware(),_validateOutput()src/schema/annotations.ts—ANNOTATION_FIELDSupdatedtests/test-executor-stream.test.ts— 8 new tests
Test Results
435 tests pass, 0 failures. tsc --noEmit clean.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request