{"_id":"@dysonic/web-replay-chrome-extensions","_rev":"2-97bb96d3296daa5fbfc7eb2bf78d7ead","name":"@dysonic/web-replay-chrome-extensions","dist-tags":{"beta":"0.1.0-beta.0","latest":"0.1.0"},"versions":{"0.1.0-beta.0":{"name":"@dysonic/web-replay-chrome-extensions","version":"0.1.0-beta.0","license":"MIT","_id":"@dysonic/web-replay-chrome-extensions@0.1.0-beta.0","maintainers":[{"name":"yuanhongboo","email":"yuanhongboo@gmail.com"}],"dist":{"shasum":"681eb25168e7de93e708d3e50b664ef8727db0ac","tarball":"https://registry.npmjs.org/@dysonic/web-replay-chrome-extensions/-/web-replay-chrome-extensions-0.1.0-beta.0.tgz","fileCount":16,"integrity":"sha512-6B59LYZP3BNPO1Beh7EPvGiFfd1k6/zeRKZJuM4gwEjU3SxSsBcpRuomKXNOOS+FpFhM1M9VXG5QYznLWnCjKw==","signatures":[{"sig":"MEQCIHD1j0xjJVBUsUJEK1UOzBv95jxdpbviXO+YZJF4odpsAiA+ns2doUfC4UAWssp2WrJFtgOxlMNUM58fmp93J/pDbA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":386406},"main":"dist/index.cjs.js","_from":"file:dysonic-web-replay-chrome-extensions-0.1.0-beta.0.tgz","types":"dist/index.d.ts","module":"dist/index.esm.js","scripts":{"test":"ts-node-script ../../tools/scripts/test.ts --verbose --color","build":"npm run build:cjs && npm run build:esm && npm run build:extensions","clean":"rimraf dist && rimraf coverage","prebuild":"rimraf dist","build:cjs":"ts-node-script ../../tools/scripts/build.ts --mode cjs","build:esm":"ts-node-script ../../tools/scripts/build.ts --mode esm","test:coverage":"ts-node-script ../../tools/scripts/test.ts --coverage","build:extensions":"ts-node-script ./scripts/build-extensions.ts"},"_npmUser":{"name":"yuanhongboo","email":"yuanhongboo@gmail.com"},"_resolved":"/private/var/folders/81/zd5db0kd52j_qlwm_kvz2zzc0000gn/T/059e06b3c4ffeeab49b24eadc081b167/dysonic-web-replay-chrome-extensions-0.1.0-beta.0.tgz","_integrity":"sha512-6B59LYZP3BNPO1Beh7EPvGiFfd1k6/zeRKZJuM4gwEjU3SxSsBcpRuomKXNOOS+FpFhM1M9VXG5QYznLWnCjKw==","_npmVersion":"10.8.2","description":"Chrome extension runtime and prototype assets for web replay capture","directories":{},"sideEffects":false,"_nodeVersion":"18.20.8","dependencies":{"rrweb":"2.0.0-alpha.4","fflate":"0.4.8","@dysonic/web-replay-core":"0.1.0-beta.0","@dysonic/web-replay-sdk-pc":"0.1.0-beta.0"},"publishConfig":{"registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"esbuild":"~0.17.19"},"_npmOperationalInternal":{"tmp":"tmp/web-replay-chrome-extensions_0.1.0-beta.0_1773427489846_0.40973001962675704","host":"s3://npm-registry-packages-npm-production"}},"0.1.0":{"name":"@dysonic/web-replay-chrome-extensions","version":"0.1.0","description":"Chrome extension runtime and prototype assets for web replay capture","license":"MIT","main":"dist/index.cjs.js","module":"dist/index.esm.js","types":"dist/index.d.ts","sideEffects":false,"publishConfig":{"registry":"https://registry.npmjs.org"},"dependencies":{"fflate":"0.4.8","rrweb":"2.0.0-alpha.4","@dysonic/web-replay-core":"0.1.0","@dysonic/web-replay-sdk-pc":"0.1.0"},"devDependencies":{"esbuild":"~0.17.19"},"scripts":{"build":"npm run build:cjs && npm run build:esm && npm run build:extensions","build:extensions":"ts-node-script ./scripts/build-extensions.ts","build:cjs":"ts-node-script ../../tools/scripts/build.ts --mode cjs","build:esm":"ts-node-script ../../tools/scripts/build.ts --mode esm","test":"ts-node-script ../../tools/scripts/test.ts --verbose --color","test:coverage":"ts-node-script ../../tools/scripts/test.ts --coverage","clean":"rimraf dist && rimraf coverage","prebuild":"rimraf dist"},"_id":"@dysonic/web-replay-chrome-extensions@0.1.0","_integrity":"sha512-536i6gUv0kA9FupcgDWi+17Or/ZIQ89vWVRJnXAuwFEHwTFCEQWqWiwihlE3e5N5nEGTf91PUcqHie2T+xbuHw==","_resolved":"/tmp/7dc3dc432bf269da5e24e549d2a28c78/dysonic-web-replay-chrome-extensions-0.1.0.tgz","_from":"file:dysonic-web-replay-chrome-extensions-0.1.0.tgz","_nodeVersion":"20.20.1","_npmVersion":"10.8.2","dist":{"integrity":"sha512-536i6gUv0kA9FupcgDWi+17Or/ZIQ89vWVRJnXAuwFEHwTFCEQWqWiwihlE3e5N5nEGTf91PUcqHie2T+xbuHw==","shasum":"c272291e4ee14539049fcf6310b95af8480b005e","tarball":"https://registry.npmjs.org/@dysonic/web-replay-chrome-extensions/-/web-replay-chrome-extensions-0.1.0.tgz","fileCount":16,"unpackedSize":386385,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBtfdbO4p0MqJC/ZaEh4MeKxkHByfOnglnRWMXWeZkv1AiEAjJH4cJkC6dfVh7lV4JxIl8nj3EDc26TKQam17M4lsZA="}]},"_npmUser":{"name":"yuanhongboo","email":"yuanhongboo@gmail.com"},"directories":{},"maintainers":[{"name":"yuanhongboo","email":"yuanhongboo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/web-replay-chrome-extensions_0.1.0_1773430617420_0.48852610903868454"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-13T18:44:49.757Z","modified":"2026-03-13T19:36:57.684Z","0.1.0-beta.0":"2026-03-13T18:44:50.117Z","0.1.0":"2026-03-13T19:36:57.567Z"},"license":"MIT","description":"Chrome extension runtime and prototype assets for web replay capture","maintainers":[{"name":"yuanhongboo","email":"yuanhongboo@gmail.com"}],"readme":"# @dysonic/web-replay-chrome-extensions\n\nChrome Extension runtime and prototype assets for web session recording and replay. Provides the message bridge, controller, background/content script helpers, and popup utilities needed to build a Chrome Extension on top of the web-replay stack.\n\n## Installation\n\n```bash\nnpm install @dysonic/web-replay-chrome-extensions\n```\n\n## Architecture\n\nThe extension is split into three runtime contexts that communicate via Chrome's message-passing API:\n\n```\nPopup (UI)\n  │  ExtensionCommand (RECORDER_START, PAUSE, RESUME, EXPORT, STATUS)\n  ▼\nBackground Script\n  │  sendCommandToActiveTab()\n  ▼\nContent Script (injected into the page)\n  │  attachChromeMessageBridge()\n  ▼\nExtensionRuntime → ExtensionController → RecorderCore\n```\n\n## API\n\n### Content Script — `attachChromeMessageBridge(runtime?, chromeApi?)`\n\nThe main entry point for a content script. Listens for `ExtensionCommand` messages via `chrome.runtime.onMessage` and dispatches them to the given runtime.\n\n```typescript\nimport { attachChromeMessageBridge } from '@dysonic/web-replay-chrome-extensions';\n\n// Uses createLiveExtensionRuntime() + window.chrome by default\nattachChromeMessageBridge();\n```\n\nProvide your own runtime or chrome API for testing:\n\n```typescript\nimport {\n  attachChromeMessageBridge,\n  createExtensionRuntime,\n  createLiveRrwebAdapter,\n} from '@dysonic/web-replay-chrome-extensions';\n\nconst adapter = createLiveRrwebAdapter({ maskAllInputs: true });\nconst runtime = createExtensionRuntime(adapter);\nattachChromeMessageBridge(runtime, chrome);\n```\n\n---\n\n### Background Script — `sendCommandToActiveTab(chromeApi, command)`\n\nSends an `ExtensionCommand` to the currently active tab's content script and returns the `ExtensionEvent` response.\n\n```typescript\nimport { sendCommandToActiveTab } from '@dysonic/web-replay-chrome-extensions';\n\nconst response = await sendCommandToActiveTab(chrome, { type: 'RECORDER_EXPORT' });\nif (response.type === 'EXPORT_READY') {\n  console.log(response.payload); // ReplayEnvelope\n}\n```\n\n---\n\n### Runtime — `createExtensionRuntime(adapter)`\n\nCreates an `ExtensionRuntime` that maps `ExtensionCommand` objects to controller actions.\n\n```typescript\nimport { createExtensionRuntime } from '@dysonic/web-replay-chrome-extensions';\n\nconst runtime = createExtensionRuntime(adapter);\nruntime.dispatch({ type: 'RECORDER_START' });  // → { type: 'STATUS', payload: { active: true, paused: false } }\nruntime.dispatch({ type: 'RECORDER_EXPORT' }); // → { type: 'EXPORT_READY', payload: ReplayEnvelope }\n```\n\nSupported commands:\n\n| Command | Response type |\n|---|---|\n| `RECORDER_STATUS` | `STATUS` |\n| `RECORDER_START` | `STATUS` |\n| `RECORDER_PAUSE` | `STATUS` |\n| `RECORDER_RESUME` | `STATUS` |\n| `RECORDER_EXPORT` | `EXPORT_READY` |\n\n---\n\n### Controller — `createExtensionController(config?)`\n\nLower-level controller that wraps `RecorderCore` and adds extension-specific lifecycle markers to the `customEvents` stream.\n\n```typescript\nimport { createExtensionController } from '@dysonic/web-replay-chrome-extensions';\n\nconst controller = createExtensionController({ maxMinutes: 5 });\ncontroller.start(adapter);\ncontroller.pause();\ncontroller.resume();\nconst envelope = controller.exportReplay(); // ReplayEnvelope\ncontroller.getStatus();                     // { active, paused }\n```\n\n---\n\n### Popup utilities\n\n```typescript\nimport {\n  dispatchPopupCommand,\n  renderPopupResponse,\n  downloadReplayFromResponse,\n} from '@dysonic/web-replay-chrome-extensions';\n\nconst response = await dispatchPopupCommand(transport, { type: 'RECORDER_EXPORT' });\nrenderPopupResponse(outputElement, response);\ndownloadReplayFromResponse(response, (filename, content) => {\n  // trigger a file download in the popup\n});\n```\n\n## Building the extension assets\n\nThe extension assets (background, content, and popup scripts) are bundled separately using esbuild via the package's own build script:\n\n```bash\ncd packages/web-replay-chrome-extensions\npnpm build:extensions\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}