{"_id":"@aitty/wterm-core","_rev":"7-c0bbaa14162c6782865c1f7d4ad635c5","name":"@aitty/wterm-core","dist-tags":{"latest":"0.3.1-aitty.7"},"versions":{"0.3.1-aitty.1":{"name":"@aitty/wterm-core","version":"0.3.1-aitty.1","keywords":["terminal","emulator","wasm","zig","xterm"],"license":"Apache-2.0","_id":"@aitty/wterm-core@0.3.1-aitty.1","maintainers":[{"name":"kingsword09","email":"kingsword09@gmail.com"}],"homepage":"https://wterm.dev","bugs":{"url":"https://github.com/kingsword09/wterm/issues"},"dist":{"shasum":"0fc2fdb670edf5e475b931cee25ba24715826384","tarball":"https://registry.npmjs.org/@aitty/wterm-core/-/wterm-core-0.3.1-aitty.1.tgz","fileCount":24,"integrity":"sha512-Ngxvr6i8UQwON7NjOSkpV0fsC714o+d6HcPLp1PCPJHKQ5JDzuHvNUKyCyUz/7Inb+7d1TNcXkI2vr/fYVIU3w==","signatures":[{"sig":"MEQCIBi68Tt5XpYCKChKzzMtmSIE5/4LcLecToxNJUDRd/bhAiAFRSJpC8Dkq3m6kmSEwftRsSIvi5FmPwzyEVFT36n++g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":97313},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./wasm":"./wasm/wterm.wasm"},"gitHead":"1149231c595caf9bc1ce4ef25e0fc2d591f5c068","_npmUser":{"name":"kingsword09","email":"kingsword09@gmail.com"},"repository":{"url":"git+https://github.com/kingsword09/wterm.git","type":"git","directory":"packages/@aitty/wterm-core"},"_npmVersion":"11.11.1","description":"Headless terminal emulator core for the web — WASM bridge and WebSocket transport","directories":{},"_nodeVersion":"25.8.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/wterm-core_0.3.1-aitty.1_1778682549154_0.5038610695357326","host":"s3://npm-registry-packages-npm-production"}},"0.3.1-aitty.2":{"name":"@aitty/wterm-core","version":"0.3.1-aitty.2","keywords":["terminal","emulator","wasm","zig","xterm"],"license":"Apache-2.0","_id":"@aitty/wterm-core@0.3.1-aitty.2","maintainers":[{"name":"kingsword09","email":"kingsword09@gmail.com"}],"homepage":"https://wterm.dev","bugs":{"url":"https://github.com/kingsword09/wterm/issues"},"dist":{"shasum":"325004f15168d495cd9090854f1bf613e494c951","tarball":"https://registry.npmjs.org/@aitty/wterm-core/-/wterm-core-0.3.1-aitty.2.tgz","fileCount":24,"integrity":"sha512-c+LZCjYicpHQp2lxx3Ris87No7Rg+wNO+aheVCN3hclM4P1+dGX+cHovAQa/V9EjimHFDI/9i2uYr5eyosP40A==","signatures":[{"sig":"MEQCICxa8VCfdFABGP0YIyvKlbCB6Uur1Cf4UhdIiFPmm/K7AiAPepRDW2jwxhVMIZZl//0M67WbTOXwRRHI75dFrbTk6g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":97313},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./wasm":"./wasm/wterm.wasm"},"gitHead":"4ae314a8b7bc7b0827776104d14c223641dca33d","_npmUser":{"name":"kingsword09","email":"kingsword09@gmail.com"},"repository":{"url":"git+https://github.com/kingsword09/wterm.git","type":"git","directory":"packages/@aitty/wterm-core"},"_npmVersion":"11.11.1","description":"Headless terminal emulator core for the web — WASM bridge and WebSocket transport","directories":{},"_nodeVersion":"25.8.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/wterm-core_0.3.1-aitty.2_1778976528816_0.339398280671966","host":"s3://npm-registry-packages-npm-production"}},"0.3.1-aitty.3":{"name":"@aitty/wterm-core","version":"0.3.1-aitty.3","keywords":["terminal","emulator","wasm","zig","xterm"],"license":"Apache-2.0","_id":"@aitty/wterm-core@0.3.1-aitty.3","maintainers":[{"name":"kingsword09","email":"kingsword09@gmail.com"}],"homepage":"https://wterm.dev","bugs":{"url":"https://github.com/kingsword09/wterm/issues"},"dist":{"shasum":"cb0afcf2baac6ff75c95bf2fe24e37487e013438","tarball":"https://registry.npmjs.org/@aitty/wterm-core/-/wterm-core-0.3.1-aitty.3.tgz","fileCount":24,"integrity":"sha512-CjC6A4k0ZUzKJvc/9juQGJbNOya3j1lLIaDTrnuZX03BQmJcy1o61T6tWYiYdfgStJFC1VMJVTmW8Het3bsoPg==","signatures":[{"sig":"MEYCIQDY8gEzHIpOm7zAhuX+0+oyFON87floaHtaZPDkWhLJVQIhAMQE6iKHNdBPpFgKN70Hc3hDDmAZP8zqdxLpTiDTnYFy","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":97313},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./wasm":"./wasm/wterm.wasm"},"gitHead":"4c9f5f271db0e5e9bd5c89ec1fa64d792bdbe7c0","_npmUser":{"name":"kingsword09","email":"kingsword09@gmail.com"},"repository":{"url":"git+https://github.com/kingsword09/wterm.git","type":"git","directory":"packages/@aitty/wterm-core"},"_npmVersion":"11.11.1","description":"Headless terminal emulator core for the web — WASM bridge and WebSocket transport","directories":{},"_nodeVersion":"25.8.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/wterm-core_0.3.1-aitty.3_1779021191506_0.5847863001347242","host":"s3://npm-registry-packages-npm-production"}},"0.3.1-aitty.4":{"name":"@aitty/wterm-core","version":"0.3.1-aitty.4","keywords":["terminal","emulator","wasm","zig","xterm"],"license":"Apache-2.0","_id":"@aitty/wterm-core@0.3.1-aitty.4","maintainers":[{"name":"kingsword09","email":"kingsword09@gmail.com"}],"homepage":"https://wterm.dev","bugs":{"url":"https://github.com/kingsword09/wterm/issues"},"dist":{"shasum":"a4c016eab60fd7937e3ca403ab6c8ffcd0e69e0f","tarball":"https://registry.npmjs.org/@aitty/wterm-core/-/wterm-core-0.3.1-aitty.4.tgz","fileCount":24,"integrity":"sha512-vG75bPR9AODThAkd99Pnb52+cCX1RXK2CsTcbtgGywEPLxYbFh5IankTJKtWJMkYP3iOXLhPc69Ua0SFN9Vn3Q==","signatures":[{"sig":"MEQCIEovGLVG14/v2jEH/CUz7POifcyrlC/60jvCBagHekdnAiAKoOU58dKEK3XHhOKBlHm/1mZLbMxP+6QAS9KePVE+pA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":99338},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./wasm":"./wasm/wterm.wasm"},"gitHead":"e7ee3307932fc490f6a95edce3f54d2086bcde91","_npmUser":{"name":"kingsword09","email":"kingsword09@gmail.com"},"repository":{"url":"git+https://github.com/kingsword09/wterm.git","type":"git","directory":"packages/@aitty/wterm-core"},"_npmVersion":"11.11.1","description":"Headless terminal emulator core for the web — WASM bridge and WebSocket transport","directories":{},"_nodeVersion":"25.8.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/wterm-core_0.3.1-aitty.4_1779926880442_0.1633601986648745","host":"s3://npm-registry-packages-npm-production"}},"0.3.1-aitty.5":{"name":"@aitty/wterm-core","version":"0.3.1-aitty.5","keywords":["terminal","emulator","wasm","zig","xterm"],"license":"Apache-2.0","_id":"@aitty/wterm-core@0.3.1-aitty.5","maintainers":[{"name":"kingsword09","email":"kingsword09@gmail.com"}],"homepage":"https://wterm.dev","bugs":{"url":"https://github.com/kingsword09/wterm/issues"},"dist":{"shasum":"4f56c9a2bdea74056252f1c5c2d8014a1e0013d0","tarball":"https://registry.npmjs.org/@aitty/wterm-core/-/wterm-core-0.3.1-aitty.5.tgz","fileCount":24,"integrity":"sha512-02AydnlYZcgXwg2RNle6QqhKHiyLda7NoU4ZhFauPGENraOC5oxsc39u/WZQmXUsRHWRFZEyoOXx38nQiVcTYw==","signatures":[{"sig":"MEYCIQD7KknjQ0moROXmRQQIYnXmDxjJCIJGBBwzOL0yUb08MwIhALxOUM0t5bNJwtBjGKhZP3oxRO1OtmTeKj0+XSoAidVB","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":100173},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./wasm":"./wasm/wterm.wasm"},"gitHead":"defdc2071d720332ba02a5d54c4491006e9392c8","_npmUser":{"name":"kingsword09","email":"kingsword09@gmail.com"},"repository":{"url":"git+https://github.com/kingsword09/wterm.git","type":"git","directory":"packages/@aitty/wterm-core"},"_npmVersion":"11.11.1","description":"Headless terminal emulator core for the web — WASM bridge and WebSocket transport","directories":{},"_nodeVersion":"25.8.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/wterm-core_0.3.1-aitty.5_1780665256168_0.0463472489723149","host":"s3://npm-registry-packages-npm-production"}},"0.3.1-aitty.6":{"name":"@aitty/wterm-core","version":"0.3.1-aitty.6","keywords":["terminal","emulator","wasm","zig","xterm"],"license":"Apache-2.0","_id":"@aitty/wterm-core@0.3.1-aitty.6","maintainers":[{"name":"kingsword09","email":"kingsword09@gmail.com"}],"homepage":"https://wterm.dev","bugs":{"url":"https://github.com/kingsword09/wterm/issues"},"dist":{"shasum":"291b72d9cfc361f05468a6f6f8baa2cb333af287","tarball":"https://registry.npmjs.org/@aitty/wterm-core/-/wterm-core-0.3.1-aitty.6.tgz","fileCount":24,"integrity":"sha512-sKgyNLHe8sHZkgF/Awkys0UEs7bLt0PIroEr2V0TpRRWEWwumhSzrha91INTUEsSDNvxKcdY0hadeRFv1GcWBg==","signatures":[{"sig":"MEUCIQD3OixAbc088WT26U5VSntLwTLAPUPEaLRJn7SbVgDU3AIgN0OQ5ULX2YjJUJVXkXNHRw8GuAnn8fvThS6NaBPOccs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":101420},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./wasm":"./wasm/wterm.wasm"},"gitHead":"fe926d7c695995d74bb7073db6fb79383a10df40","_npmUser":{"name":"kingsword09","email":"kingsword09@gmail.com"},"repository":{"url":"git+https://github.com/kingsword09/wterm.git","type":"git","directory":"packages/@aitty/wterm-core"},"_npmVersion":"11.11.1","description":"Headless terminal emulator core for the web — WASM bridge and WebSocket transport","directories":{},"_nodeVersion":"25.8.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/wterm-core_0.3.1-aitty.6_1780841089309_0.9993039888498045","host":"s3://npm-registry-packages-npm-production"}},"0.3.1-aitty.7":{"name":"@aitty/wterm-core","version":"0.3.1-aitty.7","description":"Headless terminal emulator core for the web — WASM bridge and WebSocket transport","type":"module","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./wasm":"./wasm/wterm.wasm"},"keywords":["terminal","emulator","wasm","zig","xterm"],"license":"Apache-2.0","homepage":"https://wterm.dev","repository":{"type":"git","url":"git+https://github.com/kingsword09/wterm.git","directory":"packages/@aitty/wterm-core"},"publishConfig":{"access":"public"},"gitHead":"2dba3da37df579604b7bd8c624ab7c9a81f43094","_id":"@aitty/wterm-core@0.3.1-aitty.7","bugs":{"url":"https://github.com/kingsword09/wterm/issues"},"_nodeVersion":"25.8.2","_npmVersion":"11.11.1","dist":{"integrity":"sha512-xLx7sPrVN0zwABaAsGeLOJUDW3wQMvx26h56PV5JaWAvmgU9lyeQtn3mEIjzGWoYO8npRsQ7CWo8o8Q5UxEVQA==","shasum":"aa44bae1645140072f53416e33eff1b9cd319b03","tarball":"https://registry.npmjs.org/@aitty/wterm-core/-/wterm-core-0.3.1-aitty.7.tgz","fileCount":24,"unpackedSize":102936,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQChrKsLZxsaBpZO4ll18/UYpn2w35G4EtVgxUqcgP8yhwIhAPpGQ34FXisUXdnHEfK3YkEDfr8+dC7UPyzFvqczc8dK"}]},"_npmUser":{"name":"kingsword09","email":"kingsword09@gmail.com"},"directories":{},"maintainers":[{"name":"kingsword09","email":"kingsword09@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/wterm-core_0.3.1-aitty.7_1780870535327_0.8036636566591426"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-13T14:29:09.026Z","modified":"2026-06-07T22:15:35.634Z","0.3.1-aitty.1":"2026-05-13T14:29:09.324Z","0.3.1-aitty.2":"2026-05-17T00:08:48.960Z","0.3.1-aitty.3":"2026-05-17T12:33:11.667Z","0.3.1-aitty.4":"2026-05-28T00:08:00.733Z","0.3.1-aitty.5":"2026-06-05T13:14:16.309Z","0.3.1-aitty.6":"2026-06-07T14:04:49.439Z","0.3.1-aitty.7":"2026-06-07T22:15:35.484Z"},"bugs":{"url":"https://github.com/kingsword09/wterm/issues"},"license":"Apache-2.0","homepage":"https://wterm.dev","keywords":["terminal","emulator","wasm","zig","xterm"],"repository":{"type":"git","url":"git+https://github.com/kingsword09/wterm.git","directory":"packages/@aitty/wterm-core"},"description":"Headless terminal emulator core for the web — WASM bridge and WebSocket transport","maintainers":[{"name":"kingsword09","email":"kingsword09@gmail.com"}],"readme":"# @aitty/wterm-core\n\nHeadless terminal emulator core for [wterm](https://github.com/vercel-labs/wterm). Provides the WASM bridge and WebSocket transport — no DOM dependency.\n\n## Related Packages\n\n| Package | Description |\n|---|---|\n| [`@aitty/wterm-dom`](https://www.npmjs.com/package/@aitty/wterm-dom) | DOM renderer, input handler — vanilla JS terminal |\n| [`@wterm/react`](https://www.npmjs.com/package/@wterm/react) | React component + `useTerminal` hook |\n| [`@wterm/vue`](https://www.npmjs.com/package/@wterm/vue) | Vue 3 component + template ref API |\n| [`@wterm/ghostty`](https://www.npmjs.com/package/@wterm/ghostty) | Full-featured VT emulation core powered by libghostty |\n| [`@wterm/just-bash`](https://www.npmjs.com/package/@wterm/just-bash) | In-browser Bash shell powered by just-bash |\n| [`@wterm/markdown`](https://www.npmjs.com/package/@wterm/markdown) | Streaming Markdown-to-ANSI renderer for terminals |\n\n## Install\n\n```bash\nnpm install @aitty/wterm-core\n```\n\n## Pluggable Cores\n\n`@aitty/wterm-core` defines a `TerminalCore` interface that any terminal emulation backend can implement. The built-in `WasmBridge` implements it using wterm's lightweight Zig WASM binary (~12 KB). For full-featured emulation (Kitty protocols, proper grapheme handling, mouse tracking, etc.), use [`@wterm/ghostty`](https://www.npmjs.com/package/@wterm/ghostty) which implements the same interface using libghostty (~400 KB).\n\n```ts\nimport { WTerm } from \"@aitty/wterm-dom\";\nimport { GhosttyCore } from \"@wterm/ghostty\";\n\n// Default — uses built-in lightweight core\nconst term = new WTerm(el);\n\n// Opt-in — uses libghostty for full VT emulation\nconst core = await GhosttyCore.load();\nconst term = new WTerm(el, { core });\n```\n\n## API\n\n### `WasmBridge`\n\nLow-level interface to the Zig/WASM terminal state machine. Implements the `TerminalCore` interface.\n\n```ts\nimport { WasmBridge } from \"@aitty/wterm-core\";\n\nconst bridge = await WasmBridge.load();\nbridge.init(80, 24);\nbridge.writeString(\"Hello, world!\\r\\n\");\n\nconst cell = bridge.getCell(0, 0); // { char, fg, bg, flags, width }\nconst cursor = bridge.getCursor();  // { row, col, visible }\n```\n\n| Method | Description |\n|---|---|\n| `WasmBridge.load(url?)` | Load WASM binary and return a new bridge instance. Uses the embedded binary when no URL is given. |\n| `init(cols, rows)` | Initialize the terminal grid |\n| `writeString(str)` | Write a UTF-8 string to the terminal |\n| `writeRaw(data: Uint8Array)` | Write raw bytes to the terminal |\n| `resize(cols, rows)` | Resize the terminal grid |\n| `getCell(row, col)` | Get cell data (`{ char, fg, bg, flags, width }`). `width` is `0` for wide-character spacer cells, `1` for normal cells, and `2` for wide/fullwidth cells. |\n| `getCursor()` | Get cursor state (`{ row, col, visible }`) |\n| `getCols()` / `getRows()` | Get current grid dimensions |\n| `isDirtyRow(row)` | Check if a row needs re-rendering |\n| `clearDirty()` | Reset all dirty-row flags |\n| `getTitle()` | Get pending title change (or `null`) |\n| `getResponse()` | Get pending host response (or `null`) |\n| `getScrollbackCount()` | Number of lines in the scrollback buffer |\n| `getScrollbackGeneration()` | Monotonic scrollback content version for renderer cache invalidation |\n| `getScrollbackCell(offset, col)` | Get cell data from scrollback |\n| `getScrollbackLineLen(offset)` | Get length of a scrollback line |\n| `getScrollbackLineWrapped(offset)` | Check whether a scrollback line soft-wraps into the following line |\n| `getRowWrapped(row)` | Check whether a visible grid row soft-wraps into the following row |\n| `cursorKeysApp()` | Whether cursor keys are in application mode |\n| `bracketedPaste()` | Whether bracketed paste mode is active |\n| `usingAltScreen()` | Whether the alternate screen buffer is active |\n\n### `WebSocketTransport`\n\nConnect to a PTY backend over WebSocket.\n\n```ts\nimport { WebSocketTransport } from \"@aitty/wterm-core\";\n\nconst ws = new WebSocketTransport({\n  url: \"ws://localhost:8080/pty\",\n  onData: (data) => { /* handle received data */ },\n});\n\nws.connect();\nws.send(\"ls\\n\");\n```\n\n## License\n\nApache-2.0\n","readmeFilename":"README.md"}