{"_id":"@bun-win32/wer","_rev":"4-b2d3f3c5e8ac275878a60eacd565b9ee","name":"@bun-win32/wer","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"@bun-win32/wer","version":"1.0.0","keywords":["bun","ffi","win32","windows","wer","windows-error-reporting","wait-chain-traversal","deadlock","crash-reporting","minidump","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/wer@1.0.0","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"d52f2b4e8a7fd060876dd4e743e80622ee03658f","tarball":"https://registry.npmjs.org/@bun-win32/wer/-/wer-1.0.0.tgz","fileCount":6,"integrity":"sha512-pYO6iDSpHvNN/W9NqSLSzJFbsb1oekyJuGNeQ7s9nayOxmWt0BoQWjc4yLfbW5YGUvG9sWbTCJ5KJ5a/o+QYHQ==","signatures":[{"sig":"MEQCIF4SbH0U0vxeHuyyQduDmavthqQRBx2AyS5qJVGyUJb6AiBigUEf/VpqTk4JXSgcYGnbqjjtbhIjfkvY/Ab66Nd/1w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":23015},"main":"./index.ts","type":"module","module":"index.ts","shasum":"d52f2b4e8a7fd060876dd4e743e80622ee03658f","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:deadlock-detector":"bun ./example/deadlock-detector.ts","example:crash-report-forensics":"bun ./example/crash-report-forensics.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-pYO6iDSpHvNN/W9NqSLSzJFbsb1oekyJuGNeQ7s9nayOxmWt0BoQWjc4yLfbW5YGUvG9sWbTCJ5KJ5a/o+QYHQ==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/wer"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 WER bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.2"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/wer_1.0.0_1779150546886_0.990045617844288","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@bun-win32/wer","version":"1.0.1","keywords":["bun","ffi","win32","windows","wer","windows-error-reporting","wait-chain-traversal","deadlock","crash-reporting","minidump","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/wer@1.0.1","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"bee83e57f1da7a03d0ddee75bd88d799f3e34400","tarball":"https://registry.npmjs.org/@bun-win32/wer/-/wer-1.0.1.tgz","fileCount":6,"integrity":"sha512-YjWAiYJiQ3GkvpcJWkVmikT3R1Yq6WsxMcU6RkW5f2PqAe5hkqvUNsNTTmwheEBnOrUtkEnyizFYXTuTfZwc/w==","signatures":[{"sig":"MEUCIBLBZAILmN1hXzP2w+CD+Gg1PKbVMJFtMvqgHIsRKJJlAiEAqEZftjV9EUoV8ZE0j4Qt9BJQpWVXIt1efIFxZ6femg4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":23020},"main":"./index.ts","type":"module","module":"index.ts","shasum":"bee83e57f1da7a03d0ddee75bd88d799f3e34400","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:deadlock-detector":"bun ./example/deadlock-detector.ts","example:crash-report-forensics":"bun ./example/crash-report-forensics.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-YjWAiYJiQ3GkvpcJWkVmikT3R1Yq6WsxMcU6RkW5f2PqAe5hkqvUNsNTTmwheEBnOrUtkEnyizFYXTuTfZwc/w==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/wer"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 WER bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.2"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/wer_1.0.1_1780581927601_0.4450634008318375","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@bun-win32/wer","version":"2.0.0","keywords":["bun","ffi","win32","windows","wer","windows-error-reporting","wait-chain-traversal","deadlock","crash-reporting","minidump","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/wer@2.0.0","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"f97e01acf81c365c9fa54b640508d69ac5ef96f7","tarball":"https://registry.npmjs.org/@bun-win32/wer/-/wer-2.0.0.tgz","fileCount":6,"integrity":"sha512-QuKw4O4aqqShNO3gAY2LF+o03i7/qjN+ciFYO/dHGcDfAESOahO3ouL5rUv7uLx01L5fklSovX3OMAI2dDaWCw==","signatures":[{"sig":"MEQCIBGlJr6dEcs9OqQI/xmKEulQxtV5xVwk/Isq8DalZHVzAiB21V0TlnA/EpXMZlSJzxrmthtbnkqVKF8u9N6RnZ3Bbg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24419},"main":"./index.ts","type":"module","module":"index.ts","shasum":"f97e01acf81c365c9fa54b640508d69ac5ef96f7","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:deadlock-detector":"bun ./example/deadlock-detector.ts","example:crash-report-forensics":"bun ./example/crash-report-forensics.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"_integrity":"sha512-QuKw4O4aqqShNO3gAY2LF+o03i7/qjN+ciFYO/dHGcDfAESOahO3ouL5rUv7uLx01L5fklSovX3OMAI2dDaWCw==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/wer"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 WER bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"26.3.0","dependencies":{"@bun-win32/core":"2.0.0"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/wer_2.0.0_1782435984204_0.6617002652699864","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"author":"Stev Peifer <stev.p@outlook.com>","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dependencies":{"@bun-win32/core":"2.0.1"},"description":"Zero-dependency, zero-overhead Win32 WER bindings for Bun (FFI) on Windows.","devDependencies":{"@types/bun":"latest"},"exports":{".":"./index.ts"},"license":"MIT","module":"index.ts","name":"@bun-win32/wer","peerDependencies":{"typescript":"^5"},"private":false,"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/wer"},"type":"module","version":"2.0.1","main":"./index.ts","keywords":["bun","ffi","win32","windows","wer","windows-error-reporting","wait-chain-traversal","deadlock","crash-reporting","minidump","bindings","typescript","dll"],"sideEffects":false,"engines":{"bun":">=1.1.0"},"scripts":{"example:deadlock-detector":"bun ./example/deadlock-detector.ts","example:crash-report-forensics":"bun ./example/crash-report-forensics.ts"},"_id":"@bun-win32/wer@2.0.1","_integrity":"sha512-67xKRmJTtvp1lZTTyCbqkERGh2bISWe/5KwPbRWTMoRJFHqhCx3ypns6OMaOOrq4IWVcFBwekgptl0lahHm7tA==","_nodeVersion":"26.3.0","_npmVersion":"10.8.3","shasum":"ecab95d5dbfd1af05a920ef3ae0ea9d74a15b5f2","dist":{"integrity":"sha512-67xKRmJTtvp1lZTTyCbqkERGh2bISWe/5KwPbRWTMoRJFHqhCx3ypns6OMaOOrq4IWVcFBwekgptl0lahHm7tA==","shasum":"ecab95d5dbfd1af05a920ef3ae0ea9d74a15b5f2","tarball":"https://registry.npmjs.org/@bun-win32/wer/-/wer-2.0.1.tgz","fileCount":6,"unpackedSize":24419,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGKOyihcyp6PgCNAZ4hDWKHH7R8opZt1bMmtjFcwK9eXAiAiQ9r3IhuSskC7l1Rbyc/FzaI7yYkd9dJ2KjAfYV2ACg=="}]},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"directories":{},"maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/wer_2.0.1_1782438210430_0.948908672302957"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-19T00:29:06.786Z","modified":"2026-06-26T01:43:30.684Z","1.0.0":"2026-05-19T00:29:07.035Z","1.0.1":"2026-06-04T14:05:27.747Z","2.0.0":"2026-06-26T01:06:24.358Z","2.0.1":"2026-06-26T01:43:30.559Z"},"bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","homepage":"https://github.com/ObscuritySRL/bun-win32#readme","keywords":["bun","ffi","win32","windows","wer","windows-error-reporting","wait-chain-traversal","deadlock","crash-reporting","minidump","bindings","typescript","dll"],"repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/wer"},"description":"Zero-dependency, zero-overhead Win32 WER bindings for Bun (FFI) on Windows.","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"readme":"# @bun-win32/Wer\n\nZero-dependency, zero-overhead Win32 Wer bindings for [Bun](https://bun.sh) on Windows.\n\n## Overview\n\n`@bun-win32/Wer` exposes the `wer.dll` exports using [Bun](https://bun.sh)'s FFI. It provides a single class, `Wer`, which lazily binds native symbols on first use. You can optionally preload a subset or all symbols up-front via `Preload()`.\n\nIt covers two surfaces, both exported from `wer.dll`:\n\n- **Windows Error Reporting (`werapi.h`)** — author a crash/hang/event report (`WerReportCreate` → `WerReportSetParameter`/`WerReportAddDump`/`WerReportAddFile` → `WerReportSubmit`), and inspect the on-disk report stores (`WerStoreOpen`/`WerStoreGetReportCount`/`WerStoreGetFirstReportKey`/`WerStoreQueryReportMetadataV2`/…).\n- **Wait Chain Traversal (`wct.h`)** — `OpenThreadWaitChainSession` + `GetThreadWaitChain` + `CloseThreadWaitChainSession`: the kernel deadlock-detection API that walks which thread is blocked on which lock and reports cycles.\n\nThe bindings are strongly typed for a smooth DX in TypeScript.\n\n## Features\n\n- [Bun](https://bun.sh)-first ergonomics on Windows 10/11.\n- Direct FFI to `wer.dll` (Windows Error Reporting report authoring/stores and Wait Chain Traversal deadlock detection).\n- In-source docs in `structs/Wer.ts` with links to Microsoft Docs.\n- Lazy binding on first call; optional eager preload (`Wer.Preload()`).\n- No wrapper overhead; calls map 1:1 to native APIs.\n- Strongly-typed Win32 aliases (see `types/Wer.ts`).\n\n## Requirements\n\n- [Bun](https://bun.sh) runtime\n- Windows 10 or later\n\n## Installation\n\n```sh\nbun add @bun-win32/wer\n```\n\n## Quick Start\n\n```ts\nimport Wer, { REPORT_STORE_TYPES } from '@bun-win32/wer';\n\n// How many crash reports are queued machine-wide, and how big are they?\nconst storeOut = Buffer.alloc(8);\nif (Wer.WerStoreOpen(REPORT_STORE_TYPES.E_STORE_MACHINE_QUEUE, storeOut.ptr!) === 0) {\n  const hStore = storeOut.readBigUInt64LE(0);\n\n  const countOut = Buffer.alloc(4);\n  Wer.WerStoreGetReportCount(hStore, countOut.ptr!);\n\n  const sizeOut = Buffer.alloc(8);\n  Wer.WerStoreGetSizeOnDisk(hStore, sizeOut.ptr!);\n\n  console.log(`${countOut.readUInt32LE(0)} queued reports, ${sizeOut.readBigUInt64LE(0)} bytes`);\n  Wer.WerStoreClose(hStore);\n}\n\n// Open a Wait Chain Traversal session (deadlock detection).\nconst session = Wer.OpenThreadWaitChainSession(0, null); // bigint; 0n on failure\nif (session !== 0n) Wer.CloseThreadWaitChainSession(session);\n```\n\n> [!NOTE]\n> AI agents: see `AI.md` for the package binding contract and source-navigation guidance. It explains how to use the package without scanning the entire implementation.\n\n## Examples\n\nRun the included examples:\n\n```sh\nbun run example/deadlock-detector.ts\nbun run example/crash-report-forensics.ts\n```\n\n- **`deadlock-detector.ts`** — spins up two real OS worker threads that wedge on a mutual mutex deadlock, then uses Wait Chain Traversal to X-ray every thread in the process live, rendering an animated ANSI thread radar and the wedged pair's wait chain.\n- **`crash-report-forensics.ts`** — opens all four WER report stores, counts/measures every queued and archived crash report, enumerates each report key, and prints an aligned forensic dossier with a fault-family histogram.\n\n## Notes\n\n- Either rely on lazy binding or call `Wer.Preload()`.\n- Windows only. Bun runtime required.\n- **SAL types & naming:** nullability is in the **type** — `Optional<T>` (formally optional, SAL `_*opt_`) and `Nullable<T>` (plain `[in]`/`[out]` the docs say can be NULL), the null sentinel derived from `T` (`null` for pointers `LP*`/`P*`, `0n` for handles/by-value addresses); direction is in the **parameter name** — `_out` (`_Out_`), `_in_out` (`_Inout_`), `_In_` bare. See `AI.md` and the repo `AGENTS.md`.\n","readmeFilename":"README.md"}