Skip to content

Commit 7f41564

Browse files
committed
feat: US-069 - Complete modern Web API bootstrap for Pi PTY's undici dependency chain
1 parent 5c81981 commit 7f41564

15 files changed

Lines changed: 1180 additions & 27 deletions

File tree

.agent/contracts/node-bridge.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,15 @@ Bridge/runtime Web Streams and MIME polyfills SHALL preserve the Node-observable
125125
- **WHEN** sandboxed code reads `require('util').MIMEType` or `require('util').MIMEParams`
126126
- **THEN** the runtime MUST source those constructors from the shared `internal/mime` helper so parsing, serialization, and parameter mutation preserve Node-compatible behavior
127127

128+
### Requirement: Early Bootstrap Globals Cover Undici-Class Dependency Chains
129+
Bridge/runtime bootstrap SHALL expose the modern Web API and worker-thread compatibility helpers that third-party packages such as `undici` read at module scope before the bridge network module finishes loading.
130+
131+
#### Scenario: PTY Node process requires undici before any network bridge import
132+
- **WHEN** a kernel-mediated PTY session runs `node -e "require('undici')"` or another third-party dependency chain that eagerly evaluates `undici`
133+
- **THEN** bootstrap-time globals such as `DOMException`, `Blob`, `File`, `FormData`, `MessagePort`, `MessageChannel`, `MessageEvent`, `AbortSignal.timeout`, and `AbortSignal.any` MUST already exist
134+
- **AND** compatibility helpers like `worker_threads.markAsUncloneable` and `stream.Readable.fromWeb()` MUST be reachable during that same bootstrap path
135+
- **AND** the runtime MUST satisfy that dependency chain through generic runtime/bootstrap behavior rather than a package-specific redirect or mock
136+
128137
### Requirement: Cryptographic Randomness Bridge Uses Host CSPRNG
129138
Bridge-provided randomness for global `crypto` APIs MUST delegate to host `node:crypto` primitives and MUST NOT use isolate-local pseudo-random fallbacks such as `Math.random()`.
130139

0 commit comments

Comments
 (0)