@combycode/dpe-framework-ts 2.0.2 → 2.0.3

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/runtime.ts +13 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@combycode/dpe-framework-ts",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "DPE framework for building streaming pipeline tools in TypeScript/Bun",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "repository": {
package/src/runtime.ts CHANGED
@@ -114,6 +114,19 @@ class Runtime implements RuntimeLike {
114
114
 
115
115
  if (this.queue.length > 0) await this.drainQueue();
116
116
  if (opts.onShutdown) await opts.onShutdown();
117
+
118
+ // Workaround for Bun's exit-time stdout race that drops tail-end
119
+ // envelopes when ctx.output runs back-to-back milliseconds before
120
+ // stdin EOF. The bare `process.stdout.write('', cb)` callback fires
121
+ // before the OS pipe actually settles (observed: callback alone
122
+ // reduced the bug from ~30% to ~20%; adding a 50ms grace eliminates
123
+ // it). Issue 0045 — recon-extract-col-meta → recon-normalize-cols
124
+ // hand-off losing 1 of N envelopes. Same family as inbox 0041.
125
+ await new Promise<void>((resolve) => {
126
+ process.stdout.write('', () => {
127
+ setTimeout(resolve, 50);
128
+ });
129
+ });
117
130
  }
118
131
  }
119
132