createNonExitingRuntime.exit() threw a generic Error, making it
impossible for upstream try-catch to distinguish a simulated process
exit from a real runtime crash. Added an ExitError class (internal-only,
not exported from SDK) that callers can check via instanceof.
ExitError is kept internal to avoid expanding the public plugin SDK
API surface without maintainer approval. Tests import directly from
./runtime.js.
Fixes#97796.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add unit tests for createNonExitingRuntime and writeRuntimeJson
functions in src/runtime.ts to verify runtime behavior.
Tests cover:
- createNonExitingRuntime returns runtime with exit function
- exit function throws error with code
- writeRuntimeJson writes JSON using writeJson when available
- writeRuntimeJson writes JSON using log when writeJson not available
- uses custom space parameter
- handles zero space parameter