Skip to main content

openclaw-channel/src

packages/openclaw-channel/src

Purpose

Canonical package entry. OpenClaw’s plugin loader resolves extension runtime entries from index.* at the extension root only, so the built dist/index.js must exist; the implementation lives in openclaw-entry.ts.

Public surface

createMoltzapChannelPlugin

Function
Factory: returns a fresh plugin object whose activeClients map lives in this closure. register(api) calls this so each registration gets its own per-plugin state. The plugin exposes the openclaw lifecycle hooks (startAccount, stopAccount), the outbound sendText, the inbound onInbound adapter (registered inside startAccount), the deliver callback, and resolveTarget for openclaw’s targeting layer. deliver returns PromiseLike<boolean> per openclaw contract; false signals “not delivered” without throwing. The lease-guard is single-shot per inbound message: a retried deliver exercises the lease again, surfacing LeaseAlreadyConsumed as a typed callback (MoltzapChannelPluginDeps.onLeaseConsumed) rather than a throw. resolveTarget accepts agent:<name> (DM with named agent) and task:<taskId>:<conversationId> (existing conversation). A target containing : in any other shape is rejected.

default

Variable

moltzapChannelPlugin

Variable
Shared singleton so a single registration reuses the same activeClients closure across startAccount and sendText. Tests import this directly to assert against that shared state.

MoltzapChannelPlugin

TypeAlias

Files

  • openclaw-entry.ts