This is the smallest adapter OpenMeow needs to dogfood @openclaw/sdk without binding UI code directly to transport details.
type OpenMeowLaneTarget = {
agentId: string;
label?: string;
sessionKey?: string;
};
type OpenMeowSendResult = {
runId: string;
sessionKey: string;
};
interface OpenMeowSDKClient {
connect(): Promise<void>;
close(): Promise<void>;
listAgents(): Promise<unknown>;
getAgentIdentity(agentId: string): Promise<unknown>;
createLaneSession(target: OpenMeowLaneTarget): Promise<{ sessionKey: string }>;
send(sessionKey: string, message: string): Promise<OpenMeowSendResult>;
events(runId: string): AsyncIterable<unknown>;
wait(runId: string, timeoutMs?: number): Promise<unknown>;
cancel(runId: string, sessionKey: string): Promise<unknown>;
effectiveTools(sessionKey?: string): Promise<unknown>;
invokeTool(name: string, params?: {
args?: Record<string, unknown>;
sessionKey?: string;
agentId?: string;
confirm?: boolean;
idempotencyKey?: string;
}): Promise<unknown>;
}| Adapter method | SDK/Gateway path |
|---|---|
connect |
oc.connect() |
listAgents |
oc.agents.list() |
getAgentIdentity |
oc.agents.get(id).identity() |
createLaneSession |
oc.sessions.create({ agentId, label }) |
send |
oc.sessions.send({ key, message }) |
events |
oc.runs.events(runId) |
wait |
oc.runs.wait(runId, { timeoutMs }) |
cancel |
oc.runs.cancel(runId, sessionKey) |
effectiveTools |
oc.tools.effective({ sessionKey }) |
invokeTool |
oc.tools.invoke(name, params) |
The initial dogfood implementation lives in src/index.js with declarations in src/index.d.ts.
It intentionally depends only on the public @openclaw/sdk package boundary:
createOpenMeowSDKClient()wraps agents, sessions, runs, cancellation, and effective tools.mapOpenClawEventToOpenMeowUIEvent()converts normalized SDK events into compact OpenMeow UI events.initialOpenMeowUIState()andreduceOpenMeowUIState()build app-facing lane state: assistant messages/drafts, compact tool activity, approval cards, terminal composer state, and debug-only raw events.reduceOpenMeowRunState()andmarkOpenMeowRunCancelling()implement the send-or-stop composer state.reduceOpenMeowCancelResult()maps the immediate cancel/abort response into deterministic UI recovery while the live Gateway wait/cancel contract is clarified.normalizeOpenMeowWaitResult()separates a wait deadline (status: "accepted") from a runtime timeout (status: "timed_out").invokeTool()wraps the SDK-facing Gatewaytools.invokeRPC added upstream in OpenClaw PR #74804, with a temporary HTTP/tools/invokefallback for installed Gateways that still returnunknown method: tools.invoke.
- Every send returns a stable
runIdandsessionKey. - Every active run can be cancelled.
- Event stream can be consumed after run creation without losing early lifecycle events.
- Wait timeout and runtime timeout are distinguishable.
- Tool/approval events are normalized enough for UI cards.