Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions docs/modules/client/src.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export interface AgentClientOptions {

Configures agent client.

### [`ContextOptions`](https://github.com/chughtapan/moltzap/blob/main/packages/client/src/service.ts#L126)
### [`ContextOptions`](https://github.com/chughtapan/moltzap/blob/main/packages/client/src/service.ts#L118)

_Interface_

Expand Down Expand Up @@ -242,7 +242,7 @@ export interface MoltzapdChildOptions {

Inputs for starting the packaged daemon against caller-scoped test config.

### [`MoltZapService`](https://github.com/chughtapan/moltzap/blob/main/packages/client/src/service.ts#L233)
### [`MoltZapService`](https://github.com/chughtapan/moltzap/blob/main/packages/client/src/service.ts#L225)

_Class_

Expand All @@ -263,9 +263,6 @@ export class MoltZapService {
private serviceScope: Scope.CloseableScope | null = null;

private readonly presentationState = new PresentationState();
private readonly agentConversationCacheRef: Ref.Ref<
HashMap.HashMap<string, ConversationId>
> = Effect.runSync(Ref.make(HashMap.empty<string, ConversationId>()));
private readonly lastReadRef: Ref.Ref<
HashMap.HashMap<string, HashMap.HashMap<string, ReadonlySet<string>>>
> = Effect.runSync(
Expand Down Expand Up @@ -367,6 +364,9 @@ export class MoltZapService {
// service-owned scope. The Stream is materialized BEFORE `connect()` so
// subscriptions are registered with the registry pre-handshake (a
// pre-connect-legal operation).
//
// Stream errors of type `NotConnectedError` are surfaced on the
// fiber's failure channel only when the client transitions to
```

Stateful MoltZap client that manages connection, conversation tracking,
Expand All @@ -389,7 +389,7 @@ export interface RpcCallOptions {

Configures rpc call.

### [`ServiceRpcError`](https://github.com/chughtapan/moltzap/blob/main/packages/client/src/service.ts#L114)
### [`ServiceRpcError`](https://github.com/chughtapan/moltzap/blob/main/packages/client/src/service.ts#L112)

_TypeAlias_

Expand All @@ -400,9 +400,9 @@ export type ServiceRpcError =

Errors that can surface from the Effect-based service API: any tagged error
an agent-callable method declares (recovered from the group's per-method
error unions) plus the transport errors. Methods that fan multiple calls
(e.g. `sendToAgent`) surface this broad union; a single-method call narrows
to that method's errors at the `call` site.
error unions) plus the transport errors. A method that fans several calls
surfaces this broad union; a single-method call narrows to that method's
errors at the `call` site.

## Files

Expand Down
99 changes: 80 additions & 19 deletions docs/modules/openclaw-channel/src.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ runtime entries from `index.*` at the extension root only, so the built

## Public surface

### [`createMoltzapChannelPlugin`](https://github.com/chughtapan/moltzap/blob/main/packages/openclaw-channel/src/openclaw-entry.ts#L1318)
### [`createMoltzapChannelPlugin`](https://github.com/chughtapan/moltzap/blob/main/packages/openclaw-channel/src/openclaw-entry.ts#L929)

_Function_

Expand All @@ -38,27 +38,20 @@ and `resolveTarget` for openclaw's targeting layer.
sequenceDiagram
participant OC as openclaw runtime
participant Plugin as moltzap plugin
participant Harness as caller-owned HarnessClient
participant Core as MoltZapChannelCore
participant Server as MoltZap server
participant Harness as HarnessClient
participant Daemon as moltzapd
OC->>Plugin: startAccount(ctx)
alt HarnessClient is injected
Plugin->>Harness: drain turns sequentially
Harness-->>Plugin: originating HarnessTurn
else legacy profile client
Plugin->>Core: new MoltZapAgentClient → MoltZapChannelCore
Plugin->>Core: core.connect() — WS auth
Plugin->>Core: core.onInbound(handler) — register dispatch
Core->>Plugin: enriched message arrives
Plugin->>Plugin: bind HarnessTurn reply authority
end
Plugin->>Harness: harnessClientForProfile(accountId)
Harness->>Daemon: start the slot child and connect over loopback MCP
Plugin->>Harness: drain turns sequentially
Harness-->>Plugin: HarnessTurn carrying its bound reply
Plugin->>OC: dispatchReplyWithBufferedBlockDispatcher
note over OC: agent pipeline → LLM
OC->>Plugin: deliver(payload, opts) — createHarnessReplyDeliver
Plugin->>Plugin: turn.reply(text)
Plugin->>Server: core ingress bridge sends reply
Harness->>Daemon: reply routed to its originating conversation
OC->>Plugin: stopAccount(ctx)
Plugin->>Plugin: stop owned drain or disconnect owned core
Plugin->>Plugin: signal the drain to stop
```

`deliver` returns `PromiseLike&lt;boolean>` per openclaw contract;
Expand All @@ -70,15 +63,15 @@ to `agent:&lt;name>`. Other colon-prefixed shapes are rejected.

**Returns:** The created moltzap channel plugin.

### [`default`](https://github.com/chughtapan/moltzap/blob/main/packages/openclaw-channel/src/openclaw-entry.ts#L1349)
### [`default`](https://github.com/chughtapan/moltzap/blob/main/packages/openclaw-channel/src/openclaw-entry.ts#L958)

_Variable_

```ts
const plugin =
```

### [`moltzapChannelPlugin`](https://github.com/chughtapan/moltzap/blob/main/packages/openclaw-channel/src/openclaw-entry.ts#L1346)
### [`moltzapChannelPlugin`](https://github.com/chughtapan/moltzap/blob/main/packages/openclaw-channel/src/openclaw-entry.ts#L955)

_Variable_

Expand All @@ -91,7 +84,7 @@ 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`](https://github.com/chughtapan/moltzap/blob/main/packages/openclaw-channel/src/openclaw-entry.ts#L1337)
### [`MoltzapChannelPlugin`](https://github.com/chughtapan/moltzap/blob/main/packages/openclaw-channel/src/openclaw-entry.ts#L946)

_TypeAlias_

Expand All @@ -103,6 +96,74 @@ export type MoltzapChannelPlugin = ReturnType<

Represents moltzap channel plugin values.

### [`OpenClawConfig`](https://github.com/chughtapan/moltzap/blob/main/packages/openclaw-channel/src/openclaw-entry.ts#L182)

_Interface_

```ts
export interface OpenClawConfig {
readonly [key: string]: unknown;
readonly channels?: {
readonly moltzap?: {
readonly accounts?: readonly MoltZapAccount[];
};
};
}
```

OpenClaw's config object; the plugin reads only its `channels.moltzap` section.

### [`OpenClawResolveTargetParams`](https://github.com/chughtapan/moltzap/blob/main/packages/openclaw-channel/src/openclaw-entry.ts#L255)

_Interface_

```ts
export interface OpenClawResolveTargetParams {
readonly cfg: OpenClawConfig;
readonly accountId?: string | null;
readonly input: string;
readonly normalized: string;
readonly preferredKind?: "user" | "group" | "channel";
}
```

One target-resolution request from OpenClaw's targeting layer.

### [`OpenClawStartAccountContext`](https://github.com/chughtapan/moltzap/blob/main/packages/openclaw-channel/src/openclaw-entry.ts#L210)

_Interface_

```ts
export interface OpenClawStartAccountContext {
cfg: OpenClawConfig;
accountId: string;
account: MoltZapAccount;
abortSignal: AbortSignal;
log?: OpenClawLogger;
setStatus: (next: Record<string, unknown>) => void;
channelRuntime?: {
reply?: {
dispatchReplyWithBufferedBlockDispatcher?: OpenClawReplyDispatcher;
};
};
}
```

What OpenClaw hands the plugin when it starts one configured account.

### [`OpenClawStopAccountContext`](https://github.com/chughtapan/moltzap/blob/main/packages/openclaw-channel/src/openclaw-entry.ts#L225)

_Interface_

```ts
export interface OpenClawStopAccountContext {
accountId: string;
log?: Pick<OpenClawLogger, "info">;
}
```

What OpenClaw hands the plugin when it stops one configured account.

## Files

- `openclaw-entry.ts`
1 change: 0 additions & 1 deletion knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"packages/openclaw-channel": {
"entry": [
"src/**/*.test.ts",
"src/**/*.integration.test.ts",
"src/**/__tests__/**/*.ts",
"vitest*.config.mjs"
],
Expand Down
18 changes: 9 additions & 9 deletions packages/client/src/MODULE.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export interface AgentClientOptions {

Configures agent client.

### [`ContextOptions`](./service.ts#L126)
### [`ContextOptions`](./service.ts#L118)

_Interface_

Expand Down Expand Up @@ -237,7 +237,7 @@ export interface MoltzapdChildOptions {

Inputs for starting the packaged daemon against caller-scoped test config.

### [`MoltZapService`](./service.ts#L233)
### [`MoltZapService`](./service.ts#L225)

_Class_

Expand All @@ -258,9 +258,6 @@ export class MoltZapService {
private serviceScope: Scope.CloseableScope | null = null;

private readonly presentationState = new PresentationState();
private readonly agentConversationCacheRef: Ref.Ref<
HashMap.HashMap<string, ConversationId>
> = Effect.runSync(Ref.make(HashMap.empty<string, ConversationId>()));
private readonly lastReadRef: Ref.Ref<
HashMap.HashMap<string, HashMap.HashMap<string, ReadonlySet<string>>>
> = Effect.runSync(
Expand Down Expand Up @@ -362,6 +359,9 @@ export class MoltZapService {
// service-owned scope. The Stream is materialized BEFORE `connect()` so
// subscriptions are registered with the registry pre-handshake (a
// pre-connect-legal operation).
//
// Stream errors of type `NotConnectedError` are surfaced on the
// fiber's failure channel only when the client transitions to
```

Stateful MoltZap client that manages connection, conversation tracking,
Expand All @@ -384,7 +384,7 @@ export interface RpcCallOptions {

Configures rpc call.

### [`ServiceRpcError`](./service.ts#L114)
### [`ServiceRpcError`](./service.ts#L112)

_TypeAlias_

Expand All @@ -395,9 +395,9 @@ export type ServiceRpcError =

Errors that can surface from the Effect-based service API: any tagged error
an agent-callable method declares (recovered from the group's per-method
error unions) plus the transport errors. Methods that fan multiple calls
(e.g. `sendToAgent`) surface this broad union; a single-method call narrows
to that method's errors at the `call` site.
error unions) plus the transport errors. A method that fans several calls
surfaces this broad union; a single-method call narrows to that method's
errors at the `call` site.

## Files

Expand Down
Loading
Loading