claude-code-channel/src
packages/claude-code-channel/src
Purpose
Public entry barrel for@moltzap/claude-code-channel.
Public entry barrel for @moltzap/claude-code-channel.
Only names listed here are part of the public surface.
Public surface
AllowlistError
TypeAlias
bootClaudeCodeChannel
Function
cli.ts) calls this; tests call it directly with an injected
in-memory MCP transport.
Foreign-protocol bridge: step 6c is where the MCP stdio transport
attaches. From this point on the process owns two concurrent
channels — MCP stdio (outbound to Claude) and MoltZap WS (inbound
from server). They meet inside the inbound handler and the reply
tool.
Fails with:
AgentKeyInvalid— opts.agentKey or opts.serverUrl is blankMcpTransportFailed— MCP server init or stdio connect rejects (step 6)ServiceRpcError— WS connect / auth rejects (step 8)
BootError
TypeAlias
BootOptions
Interface
Record<string, unknown>, no any. Logging is provided through Effect
logger layers at process boundaries.
BootResult
TypeAlias
ClaudeChannelNotification
Interface
<channel> tag
renderer inside Claude Code.
ConversationId
TypeAlias
conversationId on the
wire, rendered to Claude Code as the contract-meta key chat_id.
Principle 1: preventing accidental confusion with MessageId at call sites.
ConversationId
TypeAlias
conversationId on the
wire, rendered to Claude Code as the contract-meta key chat_id.
Principle 1: preventing accidental confusion with MessageId at call sites.
EventShapeError
TypeAlias
GateInbound
TypeAlias
gateInbound hook — zapbot-parity allowlist seam.
Must be pure and synchronous. Returning a failure drops the event;
no downstream notification is emitted. No I/O, no mutation.
The gate may modify the returned EnrichedInboundMessage by
returning a new value inside Success — the notification is built
from gated.value. The gate runs BEFORE routing.recordInbound;
a denied message is never added to the LRU map and cannot be
targeted by reply_to.
Failure error variants live in errors.ts → AllowlistError
(SenderNotAllowed / ConversationNotAllowed).
Handle
Interface
bootClaudeCodeChannel.
Principle 3: every operation has a typed error channel. push uses
Effect<void, PushError> so the MCP emit failure surfaces as a tag, not a
rejected Promise. stop is infallible-by-design (teardown swallows
downstream errors into logs per spec I8).
IsoTimestamp
TypeAlias
createdAt (already ISO),
rendered as contract-meta ts.
MessageId
TypeAlias
id, rendered as
contract-meta message_id.
MessageId
TypeAlias
id, rendered as
contract-meta message_id.
PushError
TypeAlias
ReplyError
TypeAlias
UserId
TypeAlias
sender.id, rendered as
contract-meta user.
UserId
TypeAlias
sender.id, rendered as
contract-meta user.
Files
entry.tserrors.tstypes.ts