← All @molecule/* packages · App templates
@molecule/api-channel-captureProvider bond · channel · API (Node) · v1.0.2 · Apache-2.0
Channel capture provider for molecule.dev
npm install @molecule/api-channel-capturenpm · Source on GitHub · Implements @molecule/api-channel
@molecule/api-channel-capture is a provider bond on the API (Node) side: it implements the channel core interface (@molecule/api-channel) with a concrete vendor or library behind it.
Your code calls the core; you wire this provider once at startup. Swapping vendors later is one line in that wiring, not a rewrite.
import { setProvider } from '@molecule/api-channel'
import { provider } from '@molecule/api-channel-capture'
setProvider(provider)Works with: @molecule/api-activity, @molecule/api-channel
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Channel capture provider for molecule.dev.
Records every sendMessage() call as an activity event. Intercept-only by
default; delegates + tees when wrapping a real provider.
import { setProvider } from '@molecule/api-channel'
import { provider } from '@molecule/api-channel-capture'
setProvider(provider)
provider
npm install @molecule/api-channel-capture @molecule/api-activity @molecule/api-channel
createChannelCaptureProvider(realProvider)Creates a channel capture provider.
When realProvider is provided, each message is posted through it and the
captured event records the real outcome (delegate + tee). When omitted (the
dev default), messages are intercepted and a synthetic SendResult is
returned. Inbound / signature / feature methods delegate to the real
provider when present and otherwise return intercept-only defaults.
function createChannelCaptureProvider(realProvider?: ChannelProvider): ChannelProvider
realProvider — Optional real provider to delegate to and tee.Returns: A {@link ChannelProvider} that records activity for every send.
providerDefault channel capture provider (intercept-only).
const provider: ChannelProvider
Implements @molecule/api-channel interface.
Setup function to register this provider with the core interface:
import { setProvider } from '@molecule/api-channel'
import { provider } from '@molecule/api-channel-capture'
export function setupChannelCapture(): void {
setProvider(provider)
}
Peer dependencies:
@molecule/api-activity ^1.0.1@molecule/api-channel ^1.0.1@molecule/api-activity
@molecule/api-channel
Two modes, and the choice decides whether the message is POSTED.
INTERCEPT-ONLY (provider, or createChannelCaptureProvider() with no
argument) records the message and returns a synthetic success — nothing
reaches the channel. DELEGATE + TEE
(createChannelCaptureProvider(real)) posts through the real provider AND
records the real outcome. Anywhere real messages must go out (production),
wrap the real provider — never bond the intercept-only provider.
Recording is best-effort: a bonded ActivitySink that throws NEVER changes
the outcome of sendMessage() — a successful real post still resolves and
a failed one still rejects with the REAL provider error.
Bond an activity sink or captures vanish. Captured sends are delivered
via @molecule/api-activity's record(), which silently no-ops when no
sink is bonded. Wire one at startup (e.g. @molecule/api-activity-console
or -http) before this provider, or every intercepted message is dropped
with no trace.
Intercept-only mode (no realProvider) returns a synthetic success from
sendMessage(), always fails verifyWebhookSignature() (false), and
parseInbound() returns a stub — inbound webhook flows need a real
provider wrapped via createChannelCaptureProvider(realProvider).
Integration checklist — drive the real UI (live preview, no mocks), adapt each item to this app's actual screens/flows, and check every box off one by one. A box you can't check is an integration bug to fix — not a skip:
read_activity tool (filter type 'channel'); never mock the flow or
modify production code to expose the message.undefined
placeholders, no secrets).