{"id":50276975,"url":"https://github.com/telegraphic-dev/openclaw-gateway-client","last_synced_at":"2026-05-27T21:03:08.691Z","repository":{"id":349010477,"uuid":"1200635875","full_name":"telegraphic-dev/openclaw-gateway-client","owner":"telegraphic-dev","description":null,"archived":false,"fork":false,"pushed_at":"2026-04-03T19:27:30.000Z","size":87,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-03T21:07:18.094Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/telegraphic-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-03T16:43:09.000Z","updated_at":"2026-04-03T19:24:20.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/telegraphic-dev/openclaw-gateway-client","commit_stats":null,"previous_names":["telegraphic-dev/openclaw-gateway-client"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/telegraphic-dev/openclaw-gateway-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telegraphic-dev%2Fopenclaw-gateway-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telegraphic-dev%2Fopenclaw-gateway-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telegraphic-dev%2Fopenclaw-gateway-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telegraphic-dev%2Fopenclaw-gateway-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/telegraphic-dev","download_url":"https://codeload.github.com/telegraphic-dev/openclaw-gateway-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telegraphic-dev%2Fopenclaw-gateway-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33583399,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-27T02:00:06.184Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-27T21:03:07.684Z","updated_at":"2026-05-27T21:03:08.685Z","avatar_url":"https://github.com/telegraphic-dev.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @telegraphic-dev/openclaw-gateway-client\n\nReusable TypeScript client for the OpenClaw Gateway WebSocket protocol, aligned with OpenClaw 2026.4.2.\n\n## Features\n\n- challenge-based `connect` handshake\n- Ed25519 device identity generation/signing\n- stored device token persistence + retry recovery\n- typed request/response map for known Gateway methods\n- exported method/scope constants from current OpenClaw scope model\n- scope authorization helpers\n- event streaming helpers\n- reusable file-backed state adapter\n- high-level helpers for sessions, chat, pairing, login, config, logs, cron, tools, agents\n\n## Install\n\n```bash\nnpm install @telegraphic-dev/openclaw-gateway-client\n```\n\n## Quick start\n\n```ts\nimport {\n  OpenClawGatewayClient,\n  ROLE_SCOPE_MAP,\n  fileStoreAdapter,\n} from '@telegraphic-dev/openclaw-gateway-client';\n\nconst client = new OpenClawGatewayClient({\n  url: 'https://gateway.example.com',\n  token: process.env.OPENCLAW_GATEWAY_TOKEN,\n  store: fileStoreAdapter('.openclaw-gateway-client'),\n  client: {\n    id: 'my-app',\n    version: '0.1.0',\n    platform: 'node',\n    mode: 'backend',\n  },\n  role: 'operator',\n  scopes: ROLE_SCOPE_MAP.operator,\n});\n\nawait client.connect();\nconst sessions = await client.listSessions({ limit: 5 });\nconsole.log(sessions.sessions);\nawait client.close();\n```\n\n## Exported protocol metadata\n\n```ts\nimport {\n  METHOD_SCOPE_GROUPS,\n  METHOD_SCOPE_BY_NAME,\n  ROLE_SCOPE_MAP,\n  resolveRequiredOperatorScopeForMethod,\n  resolveLeastPrivilegeOperatorScopesForMethod,\n  authorizeOperatorScopesForMethod,\n} from '@telegraphic-dev/openclaw-gateway-client';\n```\n\nThis lets other projects:\n- build UI around supported methods\n- enforce least-privilege client scopes\n- show scope badges/explanations\n- gate operations before sending RPC requests\n\n## Included known method wrappers\n\n- Core: `health`, `status`, `modelsList`, `gatewayIdentityGet`\n- Agents/tools: `agentsList`, `agentIdentityGet`, `toolsCatalog`, `toolsEffective`, `skillsStatus`, `waitForAgentRun`\n- Sessions: `listSessions`, `createSession`, `getSession`, `sendSessionMessage`, `patchSession`, `deleteSession`, `resetSession`, `compactSession`\n- Chat: `chatHistory`, `chatSend`, `chatAbort`, `chatInject`\n- Device pairing: `devicePairList`, `devicePairApprove`, `devicePairReject`, `deviceTokenRotate`, `deviceTokenRevoke`\n- Web/login: `webLoginStart`, `webLoginWait`\n- Config/logs/cron: `configGet`, `configSchema`, `logsTail`, `cronStatus`, `cronList`, `cronRuns`\n- Channel/system: `channelsStatus`, `channelsLogout`, `systemPresence`, `nodeList`\n\n## Example: session-based review flow\n\n```ts\nconst created = await client.createSession({\n  key: 'main:repo:pr-123:review',\n  label: 'PR review',\n});\n\nconst sent = await client.sendSessionMessage({\n  key: created.key ?? 'main:repo:pr-123:review',\n  message: 'Review this PR',\n});\n\nif (sent.runId) {\n  const wait = await client.waitForAgentRun({ runId: sent.runId, timeoutMs: 30_000 });\n  console.log(wait.status);\n}\n\nconst transcript = await client.getSession({\n  key: created.key ?? 'main:repo:pr-123:review',\n  limit: 50,\n});\n\nconsole.log(transcript.messages);\n```\n\n## Local inspector against a real Gateway\n\nThere are now two inspector modes:\n\n### 1) Web inspector UI\n\nMCP-inspector-style local app for interactive debugging.\n\n```bash\nnpm run inspector\n```\n\nThen open:\n\n```text\nhttp://127.0.0.1:6274\n```\n\nCurrent features:\n- connect/disconnect to a real Gateway\n- invoke arbitrary methods with JSON params\n- live event stream\n- raw traffic log\n- saved connection fields in localStorage\n- quick presets for common methods\n\nNote: the default client id is `gateway-client` because the current Gateway schema validates `client.id` against the canonical client identifier.\n\nThis uses a **local proxy server** (`inspector/server/index.mjs`) so the browser UI does not need to implement Gateway auth/device-token handling directly.\n\n### 2) CLI inspector\n\nUseful for scripts and quick probes.\n\n```bash\n# one-off call\nOPENCLAW_GATEWAY_URL=ws://127.0.0.1:18789 \\\nOPENCLAW_GATEWAY_TOKEN=... \\\nnpm run inspect -- call health\n\n# call with params\nnpm run inspect -- call sessions.list --params '{\"limit\":5}'\n\n# stream all events\nnpm run inspect -- events\n\n# send chat\nnpm run inspect -- chat --sessionKey main --message 'hello from inspector'\n\n# interactive REPL\nnpm run inspect -- repl\n```\n\nPublished binary name:\n\n```bash\nopenclaw-gateway-inspector call health\n```\n\nWhat this gives us:\n- real handshake testing against an actual Gateway\n- event stream inspection\n- ad hoc RPC invocation\n- reproducible debugging for pairing/auth/scope problems\n- a foundation for a richer MCPJam-style inspector app\n\n## CI / publish\n\nIncluded:\n- GitHub Actions CI: typecheck + build + tests\n- GitHub Actions publish workflow for npm releases\n\nStill needed in GitHub repo settings:\n- `NPM_TOKEN` secret for publish workflow\n\n## Notes\n\n- Scope/method constants are extracted from the current OpenClaw scope model and included directly in the package.\n- Some Gateway methods are intentionally still typed as `Record\u003cstring, unknown\u003e` results where the upstream payload is broad or evolving.\n- The package is Node-first today (`ws` transport). Browser transport can be added later behind an adapter.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelegraphic-dev%2Fopenclaw-gateway-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftelegraphic-dev%2Fopenclaw-gateway-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelegraphic-dev%2Fopenclaw-gateway-client/lists"}