# SDK Domain Modules

`createClient()` returns a `MoltlazyClient` with 8 domain modules. Each module wraps a set of related Admin HTTP RPC methods with typed parameters and response types.

## config

```ts
client.config.get()                                     // config.get
client.config.set(params: ConfigSetParams)              // config.set
client.config.patch(params: ConfigPatchParams)          // config.patch
client.config.apply(params: ConfigApplyParams)          // config.apply
client.config.schema()                                  // config.schema
client.config.schemaLookup(path: string)                // config.schema.lookup
```

`config.get()` returns a `ConfigSnapshot` (`config`, `hash`, optional
`configRevisionHash` / `appliedConfigHash`). Pass its `hash` as `baseHash` on
the next write.

`ConfigPatchParams` accepts:

```ts
{
  raw: string;            // serialised JSON5/JSON merge-patch object
  baseHash?: string;      // hash from config.get()
  replacePaths?: string[]; // exact array paths whose replacement/deletion is intentional
  sessionKey?: string;
  deliveryContext?: { channel?: string; to?: string; accountId?: string; threadId?: string | number };
  note?: string;
  restartDelayMs?: number;
}
```

Example — patch session DM scope:

```ts
await client.config.patch({
  raw: JSON.stringify({ session: { dmScope: 'per-channel-peer' } }),
});
```

`config.patch()` is the supported partial-update path: it merges objects (`null`
deletes) and waits for the active Gateway to apply the write, returning the
effective `changedPaths`. Any array replacement or deletion must list its exact
path in `replacePaths`. `config.set()` acknowledges persistence only and is
deprecated; use `config.patch()` instead, or `config.apply()` to replace the
full config.

`config.schema.lookup` returns a path-scoped schema node (`schema`), presentation
hint, `reloadKind` (`restart` / `hot` / `none`), and immediate `children`
summaries — the first stop for field-level docs.

## update

```ts
client.update.run(params?: UpdateRunParams)  // update.run
client.update.status()                        // update.status
```

`update.run()` admits a self-update plus restart and returns a durable `runId`;
acknowledgment is not completion. Include `continuationMessage` to run one
follow-up agent turn after the restart. Use `update.status()` to inspect the
latest restart sentinel and verify the running version.

## agents

```ts
client.agents.list()
client.agents.create(params: AgentCreateParams)
client.agents.update(params: AgentUpdateParams)
client.agents.delete(params: AgentDeleteParams)
```

`AgentCreateParams` requires `name` and `workspace`:

```ts
await client.agents.create({
  name: 'coder',
  workspace: '/home/openclaw/workspace',
  model: 'claude-opus-4', // optional
});
```

## channels

```ts
client.channels.status(params?: ChannelStatusParams)
client.channels.start(params)
client.channels.stop(params)
```

`ChannelStatus` includes `ts`, `channelOrder`, `channels`, `channelAccounts`, and `channelDefaultAccountId`.

## devices

```ts
client.devices.list()
client.devices.approve(params: DevicePairActionParams)
client.devices.reject(params: DevicePairActionParams)
client.devices.remove(params: DevicePairActionParams)
```

`DevicePairRequest` fields: `requestId`, `deviceId`, `displayName`, `publicKey`, `ts`.

## cron

```ts
client.cron.list()
client.cron.get(params: { name: string })
client.cron.add(params: CronAddParams)
client.cron.update(params: CronUpdateParams)
client.cron.remove(params: CronRemoveParams)
client.cron.run(params: CronRunParams)
```

`CronAddParams` requires a discriminated `CronSchedule` union (`at` / `every` / `cron`) plus `name`, `sessionTarget`, `wakeMode`, and a `payload` union (`systemEvent` | `agentTurn`).

## models

```ts
client.models.list();
client.models.authStatus();
```

`ModelInfo` has required fields `id` and `name`.

## gateway

```ts
client.gateway.health()
client.gateway.status()
client.gateway.restart()
client.gateway.logsTail(params?)
```

`HealthResponse` and `GatewayStatus` are moltlazy-defined types with no direct upstream equivalent.
