{"_id":"@anscribe/opentui","_rev":"3-290ce791ef289cfbe98ee9ac5f3071c3","name":"@anscribe/opentui","dist-tags":{"latest":"1.0.1"},"versions":{"0.1.0":{"name":"@anscribe/opentui","version":"0.1.0","keywords":["agent","anscribe","capture","mcp","opentui","tui"],"author":{"name":"msmps"},"license":"MIT","_id":"@anscribe/opentui@0.1.0","maintainers":[{"name":"msmps","email":"hello@msmp.me"}],"homepage":"https://github.com/msmps/anscribe","bugs":{"url":"https://github.com/msmps/anscribe/issues"},"dist":{"shasum":"5485d5770e019d6febcae91597dde44359f6695d","tarball":"https://registry.npmjs.org/@anscribe/opentui/-/opentui-0.1.0.tgz","fileCount":14,"integrity":"sha512-hcWVp5nG0LtcPrlLSY7ZQ58NUe5ujQhRlyuP7EVQI7OXtUlfQTp5mOlbOGaLokAWNcPtHPiMY4pgulwHlvGLAA==","signatures":[{"sig":"MEUCIHciZTufcmzyPWekQ3hiX+5uYc2Shk7//hNSoIHpNTERAiEA3u/eUKbq2LZQ31NpCJJLfa/LKwG9MkDG33zG0UhjxbA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@anscribe%2fopentui@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":39249},"type":"module","_from":"file:anscribe-opentui-0.1.0.tgz","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./react":{"types":"./dist/react.d.mts","import":"./dist/react.mjs"},"./sinks":{"types":"./dist/sinks.d.mts","import":"./dist/sinks.mjs"},"./package.json":"./package.json","./react/preload":{"types":"./dist/react/preload.d.mts","import":"./dist/react/preload.mjs"}},"scripts":{"test":"vitest run","build":"tsdown","test:integration":"bun test test/integration"},"_npmUser":{"name":"msmps","email":"hello@msmp.me"},"_resolved":"/tmp/79911d0b6b77993ce7c4b74aba4d8024/anscribe-opentui-0.1.0.tgz","_integrity":"sha512-hcWVp5nG0LtcPrlLSY7ZQ58NUe5ujQhRlyuP7EVQI7OXtUlfQTp5mOlbOGaLokAWNcPtHPiMY4pgulwHlvGLAA==","repository":{"url":"git+https://github.com/msmps/anscribe.git","type":"git","directory":"packages/opentui"},"_npmVersion":"11.14.1","description":"Anscribe OpenTUI adapter: install capture mode in OpenTUI apps and stream captures to an agent via MCP.","directories":{},"_nodeVersion":"24.15.0","dependencies":{"effect":"^4.0.0-beta.65","nanoid":"^5.1.6","@anscribe/core":"0.1.0","@anscribe/react":"0.1.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org","provenance":true},"_hasShrinkwrap":false,"peerDependencies":{"react":">=19.2.0","@opentui/core":"^0.2.8","@opentui/react":"0.2.8"},"peerDependenciesMeta":{"react":{"optional":true},"@opentui/react":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/opentui_0.1.0_1778789363762_0.8741430796838721","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@anscribe/opentui","version":"1.0.0","keywords":["agent","anscribe","capture","mcp","opentui","tui"],"author":{"name":"msmps"},"license":"MIT","_id":"@anscribe/opentui@1.0.0","maintainers":[{"name":"msmps","email":"hello@msmp.me"}],"homepage":"https://github.com/msmps/anscribe","bugs":{"url":"https://github.com/msmps/anscribe/issues"},"dist":{"shasum":"aa974c2cf7082610a1ec8ad89d73477b120055f8","tarball":"https://registry.npmjs.org/@anscribe/opentui/-/opentui-1.0.0.tgz","fileCount":11,"integrity":"sha512-8cCgEBDlb34bFkMabyigwB902Ji5nNRB1/R62E5JfBhYOjxOi98kR7XcIoHEu35pe0TgoaBBo42Ztz/Uuo+mhg==","signatures":[{"sig":"MEQCIDyce2jsLqNf6kon7kQbzdV2cfXtawvncWZtSHJqdUlCAiAcV31jUppFE0bSrgVe/RwMb/m1HLkR1oMR+N4w+wuzKQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@anscribe%2fopentui@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":37760},"type":"module","_from":"file:anscribe-opentui-1.0.0.tgz","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./react":{"types":"./dist/react.d.mts","import":"./dist/react.mjs"},"./package.json":"./package.json","./react/preload":{"types":"./dist/react/preload.d.mts","import":"./dist/react/preload.mjs"}},"scripts":{"test":"vitest run","build":"tsdown","test:integration":"bun test test/integration"},"_npmUser":{"name":"msmps","email":"hello@msmp.me"},"_resolved":"/tmp/bde4b8c1977c42df935cf6519a4700c3/anscribe-opentui-1.0.0.tgz","_integrity":"sha512-8cCgEBDlb34bFkMabyigwB902Ji5nNRB1/R62E5JfBhYOjxOi98kR7XcIoHEu35pe0TgoaBBo42Ztz/Uuo+mhg==","repository":{"url":"git+https://github.com/msmps/anscribe.git","type":"git","directory":"packages/opentui"},"_npmVersion":"11.14.1","description":"Anscribe OpenTUI adapter: install capture mode in OpenTUI apps and stream captures to an agent via MCP.","directories":{},"_nodeVersion":"24.15.0","dependencies":{"effect":"^4.0.0-beta.65","nanoid":"^5.1.6"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org","provenance":true},"_hasShrinkwrap":false,"peerDependencies":{"react":">=19.2.0","@opentui/core":"^0.2.8","@anscribe/core":"1.0.0","@opentui/react":"0.2.8","@anscribe/react":"1.0.0"},"peerDependenciesMeta":{"react":{"optional":true},"@opentui/react":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/opentui_1.0.0_1778792894474_0.8613897769494732","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@anscribe/opentui","version":"1.0.1","description":"Anscribe OpenTUI adapter: install capture mode in OpenTUI apps and stream captures to an agent via MCP.","keywords":["agent","anscribe","capture","mcp","opentui","tui"],"homepage":"https://github.com/msmps/anscribe","bugs":{"url":"https://github.com/msmps/anscribe/issues"},"license":"MIT","author":{"name":"msmps"},"repository":{"type":"git","url":"git+https://github.com/msmps/anscribe.git","directory":"packages/opentui"},"type":"module","exports":{"./package.json":"./package.json",".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./react":{"types":"./dist/react.d.mts","import":"./dist/react.mjs"},"./react/preload":{"types":"./dist/react/preload.d.mts","import":"./dist/react/preload.mjs"}},"publishConfig":{"access":"public","provenance":true,"registry":"https://registry.npmjs.org"},"dependencies":{"effect":"^4.0.0-beta.65","nanoid":"^5.1.6"},"peerDependencies":{"@opentui/core":"^0.2.8","@opentui/react":"0.2.8","react":">=19.2.0","@anscribe/react":"1.0.1","@anscribe/core":"1.0.1"},"peerDependenciesMeta":{"@opentui/react":{"optional":true},"react":{"optional":true}},"scripts":{"build":"tsdown","test":"vitest run","test:integration":"bun test test/integration"},"_id":"@anscribe/opentui@1.0.1","_integrity":"sha512-wkTcVDcJmaZTnfN7e9fqXabSOcSd34seUeJKU+2Qas/3ABdYmw3ecpesvtCHAB0WsNiTYBVJtp2eGoLcKcv+Fg==","_resolved":"/tmp/607d8ebc0f55652d07bcccb8d029db8b/anscribe-opentui-1.0.1.tgz","_from":"file:anscribe-opentui-1.0.1.tgz","_nodeVersion":"24.14.1","_npmVersion":"11.14.1","dist":{"integrity":"sha512-wkTcVDcJmaZTnfN7e9fqXabSOcSd34seUeJKU+2Qas/3ABdYmw3ecpesvtCHAB0WsNiTYBVJtp2eGoLcKcv+Fg==","shasum":"2ee8bfd1978b430dc43f6e4ed93ded8d8532b50e","tarball":"https://registry.npmjs.org/@anscribe/opentui/-/opentui-1.0.1.tgz","fileCount":11,"unpackedSize":37760,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@anscribe%2fopentui@1.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCMElXgQLI5LrTK7gvW659tiySDZnw5RBLhwLa1MrTRaAIhALV+EEbZJ1mqjhxccq7r776N1nWXbCDOCfB98OWZKQdw"}]},"_npmUser":{"name":"msmps","email":"hello@msmp.me"},"directories":{},"maintainers":[{"name":"msmps","email":"hello@msmp.me"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/opentui_1.0.1_1778794821485_0.5904299273394522"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-14T20:09:23.664Z","modified":"2026-05-14T21:40:21.998Z","0.1.0":"2026-05-14T20:09:23.918Z","1.0.0":"2026-05-14T21:08:14.675Z","1.0.1":"2026-05-14T21:40:21.647Z"},"bugs":{"url":"https://github.com/msmps/anscribe/issues"},"author":{"name":"msmps"},"license":"MIT","homepage":"https://github.com/msmps/anscribe","keywords":["agent","anscribe","capture","mcp","opentui","tui"],"repository":{"type":"git","url":"git+https://github.com/msmps/anscribe.git","directory":"packages/opentui"},"description":"Anscribe OpenTUI adapter: install capture mode in OpenTUI apps and stream captures to an agent via MCP.","maintainers":[{"name":"msmps","email":"hello@msmp.me"}],"readme":"# @anscribe/opentui\n\n> Capture live UI from an [OpenTUI](https://github.com/sst/opentui) app and hand it to an agent. Clipboard by default, opt-in MCP queue.\n\n`installCapture` installs an Anscribe Capture Mode overlay on an OpenTUI `CliRenderer`. A headless `<Anscribe />` component is exposed for OpenTUI React apps.\n\n## Install\n\n```bash\nbun add @anscribe/opentui\n```\n\nTo also persist Captures into a project-local queue that agents pull from, install [`@anscribe/mcp`](https://www.npmjs.com/package/@anscribe/mcp).\n\n## OpenTUI Core\n\n```ts\nimport { installCapture } from \"@anscribe/opentui\";\nimport { createCliRenderer } from \"@opentui/core\";\n\nconst renderer = await createCliRenderer({ useMouse: true });\n\nconst capture = installCapture(renderer, { keybinding: \"ctrl+g\" });\n\n// On shutdown:\nawait capture.close();\n```\n\nThe returned handle exposes `dispose()` (sync) and `close()` (async). Call one before destroying the renderer so any in-flight sink writes complete.\n\n## OpenTUI React\n\n```tsx\nimport \"@anscribe/opentui/react/preload\";\n\nimport { Anscribe } from \"@anscribe/opentui/react\";\nimport { createCliRenderer } from \"@opentui/core\";\nimport { createRoot } from \"@opentui/react\";\n\nfunction App() {\n  return (\n    <>\n      <Anscribe keybinding=\"ctrl+g\" />\n      <text id=\"save-action\" content=\"Save\" />\n    </>\n  );\n}\n\nconst renderer = await createCliRenderer({ useMouse: true });\ncreateRoot(renderer).render(<App />);\n```\n\n`@anscribe/opentui/react/preload` **must be imported before `@opentui/react`**. It installs a React DevTools hook that lets Anscribe enrich Captures with `componentName` and `componentPath`. If the preload is missing or imported late, Capture Mode still works — React metadata is simply absent and `<Anscribe />` warns once in development.\n\nThe preload is a side-effect re-export of [`@anscribe/react/preload`](https://www.npmjs.com/package/@anscribe/react). Use the OpenTUI subpath here; reach for `@anscribe/react/preload` directly only if you're building a non-OpenTUI adapter.\n\n## Capture Mode\n\n| Key | Action |\n|---|---|\n| `ctrl+g` | Enter Capture Mode (configurable via `keybinding`) |\n| `tab` / `↓` / `→` / `j` | Next selectable renderable |\n| `shift+tab` / `↑` / `←` / `k` | Previous renderable |\n| `space` / `enter` | Toggle current selection |\n| `backspace` / `delete` | Deselect current target |\n| `a` | Open instruction prompt |\n| `enter` (in prompt) | Save pending Capture |\n| `esc` (in prompt) | Cancel draft, keep selection |\n| `esc` / `q` | Exit Capture Mode |\n\nWith mouse input enabled, left-clicking a renderable selects it (clicks on text-node children resolve to the containing renderable). Capture Mode draws a translucent highlight over the current target. Normal app input is paused while Capture Mode is active and resumes on exit.\n\n## Options\n\n`installCapture(renderer, options?)` and `<Anscribe />` share the same options:\n\n| Option | Type | Default | |\n|---|---|---|---|\n| `keybinding` | `string` | `\"ctrl+g\"` | Entry shortcut |\n| `highlightColor` | hex | — | Color of the current target highlight |\n| `selectedColor` | hex | — | Color of selected targets |\n\n## Clipboard handoff (always on)\n\nEvery committed Capture is written to the system clipboard via [OSC52](https://chromium.googlesource.com/apps/libapps/+/master/hterm/doc/ControlSequences.md#OSC-52) as markdown. Works over SSH, inside dev containers, and on terminals without native bindings or permission prompts.\n\nThe payload format:\n\n```\nfix this row to use the new auth flow\n\n<BoxRenderable id=\"settings-status\"> \"Status: unsaved preference changes\"\n  in SettingsPanel (at src/settings.tsx:42)\n  in App (at src/index.tsx:10)\n```\n\n## Sinks (opt-in fan-out)\n\nEvery committed Capture goes to the clipboard first; additional sinks fan out from there. The canonical sink is the MCP queue from [`@anscribe/mcp`](https://www.npmjs.com/package/@anscribe/mcp) — added with a single side-effect import at the top of your entry file:\n\n```ts\nimport \"@anscribe/mcp/sink\";\n\nimport { installCapture } from \"@anscribe/opentui\";\n// ...installCapture as usual; the sink is already wired.\n```\n\nThe side-effect module registers the sink in `@anscribe/core`'s shared registry. `installCapture` snapshots the registry at host install time, so the import must run before the first `installCapture` call.\n\n### Custom and programmatic sinks\n\nFor dynamic registration (tests, multi-tenant runners, custom destinations) reach for the helpers in `@anscribe/core`:\n\n```ts\nimport { registerCaptureSink, type CaptureSink } from \"@anscribe/core\";\n\nconst webhookSink: CaptureSink = {\n  name: \"webhook\",\n  write: async (capture) => {\n    await fetch(\"https://example.com/captures\", {\n      method: \"POST\",\n      body: JSON.stringify(capture),\n    });\n  },\n};\n\nregisterCaptureSink(webhookSink);\n```\n\n`CaptureSink`, `registerCaptureSink`, `readRegisteredCaptureSinks`, and `resetCaptureSinks` all live in `@anscribe/core` — a peer dependency of this package, so a single core instance owns the registry that every adapter shares. `resetCaptureSinks()` is provided for test isolation; production code should not use it.\n\nIf a sink fails, the host's failure reporter logs the error tagged with the sink's name. The clipboard handoff has already happened, so the user-visible state stays consistent. The capture state machine has already committed the Capture; sink failures don't roll it back.\n\n## License\n\nMIT © [msmps](https://github.com/msmps)\n","readmeFilename":"README.md"}