{"_id":"@aipuna/aipuna","_rev":"3-5bda93544ccd5569595af5a48bf6cec0","name":"@aipuna/aipuna","dist-tags":{"latest":"0.2.2"},"versions":{"0.2.0":{"name":"@aipuna/aipuna","version":"0.2.0","keywords":["openclaw","webrtc","datachannel","flutter","plugin"],"license":"MIT","_id":"@aipuna/aipuna@0.2.0","maintainers":[{"name":"aipuna.com","email":"npm@aipuna.com"}],"dist":{"shasum":"754aa34db92fba4b165daae53834ead9a493b3c9","tarball":"https://registry.npmjs.org/@aipuna/aipuna/-/aipuna-0.2.0.tgz","fileCount":17,"integrity":"sha512-nMQrmX5HbdkIlQFvbsqACz7CP4aF6cWC+OgF8gGzumYHEYwlTE/6VSZILnDjDWnf19/cVrtbx1+x6R90/a2bLQ==","signatures":[{"sig":"MEYCIQD+Snt2VEsBA0IN7WBUtAVNPkj5Vo0ucHZQRNkhxRfUiwIhAKqvmY4U3aaC8D2GkRc4LdPAjf/seBUyY2kVVaMKKWah","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":723708},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.20.0"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./register":{"import":{"types":"./dist/register.d.ts","default":"./dist/register.js"},"require":{"types":"./dist/register.d.cts","default":"./dist/register.cjs"}}},"scripts":{"dev":"tsx watch src/index.ts","lint":"eslint .","test":"vitest run","build":"tsup","format":"prettier --write .","lint:fix":"eslint . --fix","typecheck":"tsc --noEmit","test:watch":"vitest","format:check":"prettier --check ."},"_npmUser":{"name":"aipuna.com","email":"npm@aipuna.com"},"openclaw":{"channel":{"id":"aipuna","blurb":"WebRTC DataChannel bridge for Flutter apps with subagent session support.","label":"AIPuna WebRTC","aliases":["aipuna","octochat"],"selectionLabel":"AIPuna (WebRTC DataChannel)"},"install":{"npmSpec":"@aipuna/aipuna","defaultChoice":"npm"},"channels":["aipuna"],"extensions":["./dist/register.js"],"installDependencies":true},"_npmVersion":"11.5.1","description":"WebRTC bridge plugin connecting Flutter apps to a local OpenClaw instance","directories":{},"_nodeVersion":"24.5.0","dependencies":{"ws":"^8.19.0","zod":"^4.3.6","pino":"^10.3.1","nanoid":"^5.1.6","werift":"^0.22.9"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","tsup":"^8.5.1","eslint":"^10.0.2","vitest":"^4.0.18","prettier":"^3.8.1","@types/ws":"^8.18.1","@eslint/js":"^10.0.1","typescript":"~5.9.3","pino-pretty":"^13.1.3","typescript-eslint":"^8.56.1","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.5"},"peerDependencies":{"openclaw":">=2026.2.0"},"peerDependenciesMeta":{"openclaw":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/aipuna_0.2.0_1772612528184_0.8404661790973287","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@aipuna/aipuna","version":"0.2.1","keywords":["openclaw","webrtc","datachannel","flutter","plugin"],"license":"MIT","_id":"@aipuna/aipuna@0.2.1","maintainers":[{"name":"aipuna.com","email":"npm@aipuna.com"}],"dist":{"shasum":"bbbd8bbc8c0db830c902c8b43bdac9a1300c761c","tarball":"https://registry.npmjs.org/@aipuna/aipuna/-/aipuna-0.2.1.tgz","fileCount":17,"integrity":"sha512-o+Rx0JXvSCaiJolWpZHAIeGNWLuSODNgL3EG2Z3O/1OT0qmDDzuacuICjs4J1CVIWcu0+LBDU0oLnNrTzI12jQ==","signatures":[{"sig":"MEUCIQDvh/g+irERp9vLiPXk2QQcA7mmkvjyJXRFz5u4/9VvEgIgHQ1q1wvlKJmDho+TAuEAzBErIJED+dXrTW72TG10Zok=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":723628},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.20.0"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./register":{"import":{"types":"./dist/register.d.ts","default":"./dist/register.js"},"require":{"types":"./dist/register.d.cts","default":"./dist/register.cjs"}}},"scripts":{"dev":"tsx watch src/index.ts","lint":"eslint .","test":"vitest run","build":"tsup","format":"prettier --write .","lint:fix":"eslint . --fix","typecheck":"tsc --noEmit","test:watch":"vitest","format:check":"prettier --check ."},"_npmUser":{"name":"aipuna.com","email":"npm@aipuna.com"},"openclaw":{"channel":{"id":"aipuna","blurb":"WebRTC DataChannel bridge for Flutter apps with subagent session support.","label":"AIPuna WebRTC","aliases":["aipuna","octochat"],"selectionLabel":"AIPuna (WebRTC DataChannel)"},"install":{"npmSpec":"@aipuna/aipuna","defaultChoice":"npm"},"channels":["aipuna"],"extensions":["./dist/register.js"],"installDependencies":true},"_npmVersion":"11.5.1","description":"WebRTC bridge plugin connecting Flutter apps to a local OpenClaw instance","directories":{},"_nodeVersion":"24.5.0","dependencies":{"ws":"^8.19.0","zod":"^4.3.6","pino":"^10.3.1","nanoid":"^5.1.6","werift":"^0.22.9"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","tsup":"^8.5.1","eslint":"^10.0.2","vitest":"^4.0.18","prettier":"^3.8.1","@types/ws":"^8.18.1","@eslint/js":"^10.0.1","typescript":"~5.9.3","pino-pretty":"^13.1.3","typescript-eslint":"^8.56.1","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.5"},"peerDependencies":{"openclaw":">=2026.2.0"},"peerDependenciesMeta":{"openclaw":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/aipuna_0.2.1_1772625501361_0.28133304710966867","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"@aipuna/aipuna","version":"0.2.2","description":"WebRTC bridge plugin connecting Flutter apps to a local OpenClaw instance","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./register":{"import":{"types":"./dist/register.d.ts","default":"./dist/register.js"},"require":{"types":"./dist/register.d.cts","default":"./dist/register.cjs"}}},"engines":{"node":">=18.20.0"},"scripts":{"build":"tsup","dev":"tsx watch src/index.ts","test":"vitest run","test:watch":"vitest","lint":"eslint .","lint:fix":"eslint . --fix","format":"prettier --write .","format:check":"prettier --check .","typecheck":"tsc --noEmit"},"dependencies":{"nanoid":"^5.1.6","werift":"^0.22.9","pino":"^10.3.1","ws":"^8.19.0","zod":"^4.3.6"},"devDependencies":{"@eslint/js":"^10.0.1","@types/ws":"^8.18.1","eslint":"^10.0.2","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.5","pino-pretty":"^13.1.3","prettier":"^3.8.1","tsup":"^8.5.1","tsx":"^4.21.0","typescript":"~5.9.3","typescript-eslint":"^8.56.1","vitest":"^4.0.18"},"peerDependencies":{"openclaw":">=2026.2.0"},"peerDependenciesMeta":{"openclaw":{"optional":true}},"openclaw":{"extensions":["./dist/register.js"],"channels":["aipuna"],"installDependencies":true,"channel":{"id":"aipuna","label":"AIPuna WebRTC","selectionLabel":"AIPuna (WebRTC DataChannel)","blurb":"WebRTC DataChannel bridge for Flutter apps with subagent session support.","aliases":["aipuna","octochat"]},"install":{"npmSpec":"@aipuna/aipuna","defaultChoice":"npm"}},"keywords":["openclaw","webrtc","datachannel","flutter","plugin"],"license":"MIT","_id":"@aipuna/aipuna@0.2.2","_nodeVersion":"24.5.0","_npmVersion":"11.5.1","dist":{"integrity":"sha512-Dpbh8tXQRZAVB9Ind332/5DHRied6nuCpX54Ip/nKEhEvm7XMOnNwsGyTBvMhyDeBtbcir3Va6k+M9hzkZzSYQ==","shasum":"9871221739c080b46b6da38fa9a7c3b6ff0cbd98","tarball":"https://registry.npmjs.org/@aipuna/aipuna/-/aipuna-0.2.2.tgz","fileCount":17,"unpackedSize":724438,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIQDD3T9+iXBBZNAOJtWt71iTuu49FZjkQRMAxMezqNDjPAIfWWvM6+Rz62DVPIWcyLV3PuysCJE9WQwa5LPY+g/ZSg=="}]},"_npmUser":{"name":"aipuna.com","email":"npm@aipuna.com"},"directories":{},"maintainers":[{"name":"aipuna.com","email":"npm@aipuna.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/aipuna_0.2.2_1772649887142_0.20395565316603248"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-04T08:22:08.080Z","modified":"2026-03-04T18:44:47.470Z","0.2.0":"2026-03-04T08:22:08.416Z","0.2.1":"2026-03-04T11:58:21.527Z","0.2.2":"2026-03-04T18:44:47.352Z"},"license":"MIT","keywords":["openclaw","webrtc","datachannel","flutter","plugin"],"description":"WebRTC bridge plugin connecting Flutter apps to a local OpenClaw instance","maintainers":[{"name":"aipuna.com","email":"npm@aipuna.com"}],"readme":"# @aipuna/aipuna\n\nWebRTC bridge plugin that connects Flutter apps (AIPuna, Octochat) to a local OpenClaw instance via peer-to-peer DataChannel connections.\n\n## Installation\n\n```bash\nopenclaw plugins install @aipuna/aipuna\n```\n\n**Requirements:** Node.js >= 18.20.0\n\n## Quick Start\n\n```typescript\nimport { OpenClawPlugin } from '@aipuna/aipuna';\n\nconst plugin = new OpenClawPlugin({\n  gatewayUrl: 'ws://127.0.0.1:18789',\n  gatewayToken: process.env.OPENCLAW_PLUGIN_GATEWAY_TOKEN,\n  signalingUrl: 'wss://signal.example.com',\n  tokenStoragePath: './data/token.json',\n  iceServers: [{ urls: 'stun:stun.l.google.com:19302' }],\n});\n\nplugin.on('pairing:code', (code, displayText) => {\n  console.log(displayText); // formatted pairing code for terminal\n});\n\nplugin.on('pairing:complete', () => {\n  console.log('Pairing complete — token stored for future sessions');\n});\n\nplugin.on('ready', () => {\n  console.log('Plugin ready for connections');\n});\n\nplugin.on('session:connected', (peerId) => {\n  console.log(`Flutter app connected: ${peerId}`);\n});\n\nplugin.on('session:disconnected', (peerId) => {\n  console.log(`Flutter app disconnected: ${peerId}`);\n});\n\nplugin.on('error', (error) => {\n  console.error('Plugin error:', error);\n});\n\nawait plugin.start();\n```\n\n## Configuration\n\nAll settings can be provided via constructor options or environment variables. Constructor options take precedence.\n\n| Option | Env Variable | Required | Description |\n|---|---|---|---|\n| `gatewayUrl` | `OPENCLAW_PLUGIN_GATEWAY_URL` | Yes | OpenClaw gateway WebSocket URL |\n| `gatewayToken` | `OPENCLAW_PLUGIN_GATEWAY_TOKEN` | Yes | Authentication token for the gateway |\n| `signalingUrl` | `OPENCLAW_PLUGIN_SIGNALING_URL` | Yes | FastAPI signaling server URL |\n| `tokenStoragePath` | `OPENCLAW_PLUGIN_TOKEN_STORAGE_PATH` | Yes | File path for persistent token storage |\n| `iceServers` | `OPENCLAW_PLUGIN_ICE_SERVERS` | Yes | ICE server config (JSON array for env) |\n| `pluginToken` | `OPENCLAW_PLUGIN_TOKEN` | No | Pre-existing plugin token (`oc_` prefix) |\n| `logLevel` | `OPENCLAW_PLUGIN_LOG_LEVEL` | No | Log level: `fatal\\|error\\|warn\\|info\\|debug\\|trace` |\n\n### ICE Servers\n\n```typescript\n// Constructor\n{ iceServers: [{ urls: 'stun:stun.l.google.com:19302' }] }\n\n// Environment (JSON array)\nOPENCLAW_PLUGIN_ICE_SERVERS='[{\"urls\":\"stun:stun.l.google.com:19302\"}]'\n\n// TURN server with credentials\n{ iceServers: [{ urls: 'turn:turn.example.com:3478', username: 'user', credential: 'pass' }] }\n```\n\n## API Reference\n\n### `OpenClawPlugin`\n\n#### Methods\n\n| Method | Returns | Description |\n|---|---|---|\n| `start()` | `Promise<void>` | Connects to gateway and signaling. Uses stored token or enters pairing flow |\n| `stop()` | `Promise<void>` | Graceful shutdown in reverse order, emits `stopped` |\n| `getPairingCode()` | `string \\| null` | Returns the current 6-character pairing code during pairing |\n| `getActiveSessions()` | `SessionInfo[]` | Returns info about all active peer sessions |\n\n#### Events\n\n| Event | Payload | Description |\n|---|---|---|\n| `ready` | — | Plugin is connected and ready for Flutter apps |\n| `stopped` | — | Plugin has shut down |\n| `pairing:code` | `code: string, displayText: string` | A pairing code was received (display to user) |\n| `pairing:complete` | — | Pairing succeeded, token stored |\n| `session:connected` | `peerId: string` | A Flutter app established a DataChannel |\n| `session:disconnected` | `peerId: string` | A Flutter app disconnected |\n| `error` | `error: Error` | An error occurred |\n\n### Error Classes\n\nAll errors extend `OpenClawPluginError`:\n\n- `ConfigurationError` — Invalid or missing configuration\n- `SignalingConnectionError` — Signaling server connection failure\n- `OpenClawConnectionError` — Gateway connection failure\n- `WebRTCError` — WebRTC/DataChannel failure\n- `AuthenticationError` — Authentication failure\n- `TimeoutError` — Operation timed out\n- `ProtocolError` — Invalid message format\n\n## Development\n\n```bash\nnpm run build        # Build ESM + CJS + types\nnpm test             # Run tests\nnpm run test:watch   # Run tests in watch mode\nnpm run typecheck    # TypeScript type checking\nnpm run lint         # ESLint\nnpm run format       # Prettier\n```\n\n## Architecture\n\nSee [docs/architecture.md](docs/architecture.md) for module interactions and data flow.\n\n## Protocol\n\nSee [docs/protocol.md](docs/protocol.md) for the DataChannel message specification.\n","readmeFilename":"README.md"}