@lingyao037/openclaw-lingyao-cli 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.d.ts CHANGED
@@ -1,213 +1,5 @@
1
- import { L as LingyaoRuntime, a as LingyaoAccount, D as DeviceToken, b as DeviceInfo, H as HealthStatus } from './types-XJDsfTRA.js';
2
-
3
- /**
4
- * Account storage and management
5
- */
6
- declare class AccountManager {
7
- private runtime;
8
- private accounts;
9
- private pendingPairings;
10
- /** Debounced flush for high-frequency updates (e.g. heartbeat lastSeen). */
11
- private accountsSaveTimer;
12
- private static readonly ACCOUNTS_SAVE_DEBOUNCE_MS;
13
- constructor(runtime: LingyaoRuntime);
14
- /**
15
- * Initialize account manager from storage
16
- */
17
- initialize(): Promise<void>;
18
- /**
19
- * Get account by device ID
20
- */
21
- getAccount(deviceId: string): LingyaoAccount | undefined;
22
- /**
23
- * Get account by device token
24
- */
25
- getAccountByToken(token: string): LingyaoAccount | undefined;
26
- /**
27
- * Get all active accounts
28
- */
29
- getActiveAccounts(): LingyaoAccount[];
30
- /**
31
- * Create a new pairing session
32
- */
33
- createPairingSession(code: string, expiresAt: number): Promise<void>;
34
- /**
35
- * Get pairing session by code
36
- */
37
- getPairingSession(code: string): PairingSession | undefined;
38
- /**
39
- * Remove a pending pairing (e.g. expired or cancelled)
40
- */
41
- deletePendingPairing(code: string): Promise<void>;
42
- /**
43
- * Confirm pairing and create account
44
- */
45
- confirmPairing(pairingCode: string, deviceToken: DeviceToken, deviceInfo: DeviceInfo): Promise<LingyaoAccount | null>;
46
- /**
47
- * Update account's last seen timestamp
48
- */
49
- updateLastSeen(deviceId: string): Promise<void>;
50
- /**
51
- * Persist any debounced account state immediately (e.g. before process/account shutdown).
52
- */
53
- flushPendingAccountsSave(): Promise<void>;
54
- private scheduleDebouncedAccountsSave;
55
- /**
56
- * Revoke an account
57
- */
58
- revokeAccount(deviceId: string): Promise<boolean>;
59
- /**
60
- * Manually add a device by deviceId (user-initiated pairing).
61
- * No pairing code or deviceToken required — the user explicitly
62
- * trusts this device from the OpenClaw CLI.
63
- */
64
- addDevice(deviceId: string, deviceInfo: DeviceInfo): Promise<LingyaoAccount>;
65
- /**
66
- * Refresh device token
67
- */
68
- refreshDeviceToken(deviceId: string, newToken: DeviceToken): Promise<boolean>;
69
- /**
70
- * Clean up expired accounts
71
- */
72
- cleanupExpired(): Promise<void>;
73
- /**
74
- * Save accounts to storage (immediate; clears any pending debounced save).
75
- */
76
- private saveAccounts;
77
- private persistAccounts;
78
- /**
79
- * Save pending pairings to storage
80
- */
81
- private savePendingPairings;
82
- }
83
- interface PairingSession {
84
- code: string;
85
- createdAt: number;
86
- expiresAt: number;
87
- }
88
-
89
- /**
90
- * Probe status levels
91
- */
92
- declare enum ProbeStatus {
93
- HEALTHY = "healthy",
94
- DEGRADED = "degraded",
95
- UNHEALTHY = "unhealthy"
96
- }
97
- /**
98
- * Health check result
99
- */
100
- interface HealthCheckResult {
101
- status: ProbeStatus;
102
- checks: Map<string, CheckResult>;
103
- timestamp: number;
104
- }
105
- /**
106
- * Individual check result
107
- */
108
- interface CheckResult {
109
- passed: boolean;
110
- message?: string;
111
- duration: number;
112
- error?: Error;
113
- }
114
- /**
115
- * Channel status for reporting
116
- */
117
- interface ChannelStatus {
118
- configured: boolean;
119
- running: boolean;
120
- lastError?: string;
121
- activeAccounts: number;
122
- uptime: number;
123
- status: ProbeStatus;
124
- }
125
- /**
126
- * Probe - Channel health status and monitoring
127
- */
128
- declare class Probe {
129
- private runtime;
130
- private startTime;
131
- private lastError;
132
- private lastErrorTime;
133
- private errorCounts;
134
- private healthChecks;
135
- constructor(runtime: LingyaoRuntime);
136
- /**
137
- * Register a custom health check
138
- */
139
- registerHealthCheck(name: string, check: HealthCheckFn): void;
140
- /**
141
- * Run all health checks
142
- */
143
- runHealthChecks(): Promise<HealthCheckResult>;
144
- /**
145
- * Get channel status for reporting
146
- */
147
- getChannelStatus(configured: boolean, running: boolean, activeAccounts?: number): ChannelStatus;
148
- /**
149
- * Get health status for API endpoint
150
- */
151
- getHealthStatus(activeConnections?: number, queuedMessages?: number): Promise<HealthStatus>;
152
- /**
153
- * Record an error
154
- */
155
- recordError(error: string, category?: string): void;
156
- /**
157
- * Get last error
158
- */
159
- getLastError(): string | null;
160
- /**
161
- * Clear last error
162
- */
163
- clearLastError(): void;
164
- /**
165
- * Get error counts by category
166
- */
167
- getErrorCounts(): Record<string, number>;
168
- /**
169
- * Reset error counts
170
- */
171
- resetErrorCounts(): void;
172
- /**
173
- * Get uptime in milliseconds
174
- */
175
- getUptime(): number;
176
- /**
177
- * Get uptime formatted as human-readable string
178
- */
179
- getUptimeString(): string;
180
- /**
181
- * Health check: uptime
182
- */
183
- private checkUptime;
184
- /**
185
- * Health check: errors
186
- */
187
- private checkErrors;
188
- /**
189
- * Create status adapter for OpenClaw integration
190
- */
191
- createStatusAdapter(configured: boolean): {
192
- getStatus: (running: boolean, activeAccounts?: number, activeConnections?: number, queuedMessages?: number) => Promise<{
193
- activeConnections: number;
194
- queuedMessages: number;
195
- configured: boolean;
196
- running: boolean;
197
- lastError?: string;
198
- activeAccounts: number;
199
- uptime: number;
200
- status: ProbeStatus;
201
- }>;
202
- };
203
- }
204
- /**
205
- * Health check function signature
206
- */
207
- type HealthCheckFn = () => Promise<{
208
- passed: boolean;
209
- message?: string;
210
- }>;
1
+ import { L as LingyaoRuntime } from './types-BFXkMaHp.js';
2
+ import { A as AccountManager, P as Probe } from './probe-DW7_cF66.js';
211
3
 
212
4
  /**
213
5
  * CLI command handler for Lingyao plugin
package/dist/index.d.ts CHANGED
@@ -1,8 +1,290 @@
1
- import { R as ResolvedAccount, L as LingyaoProbeResult } from './status-Bjzb8u67.js';
1
+ import { R as ResolvedAccount, L as LingyaoProbeResult } from './status-n_XeBoR3.js';
2
2
  import * as openclaw_plugin_sdk from 'openclaw/plugin-sdk';
3
- import { PluginRuntime, ChannelPlugin } from 'openclaw/plugin-sdk';
4
- import { c as LingyaoConfig } from './types-XJDsfTRA.js';
5
- export { A as AckRequest, d as AgentMessage, b as DeviceInfo, D as DeviceToken, e as DiarySyncPayload, F as FailedEntry, H as HealthStatus, f as LINGYAO_SERVER_URL, a as LingyaoAccount, g as LingyaoAccountConfig, h as LingyaoMessage, L as LingyaoRuntime, M as MemorySyncPayload, i as MessageHandler, j as MessageType, N as NotifyAction, k as NotifyPayload, l as NotifyRequest, P as PairingCode, m as PairingConfirmRequest, n as PairingConfirmResponse, o as PollRequest, p as PollResponse, Q as QueuedMessage, S as SyncRequest, q as SyncResponse, T as TokenRefreshRequest, r as TokenRefreshResponse, W as WebSocketConnection, s as getLingyaoGatewayWsUrl } from './types-XJDsfTRA.js';
3
+ import { PluginRuntime, OpenClawConfig, ChannelPlugin } from 'openclaw/plugin-sdk';
4
+ import { L as LingyaoRuntime, a as LingyaoConfig } from './types-BFXkMaHp.js';
5
+ export { A as AckRequest, b as AgentMessage, D as DeviceInfo, c as DeviceToken, d as DiarySyncPayload, F as FailedEntry, H as HealthStatus, e as LINGYAO_SERVER_URL, f as LingyaoAccount, g as LingyaoAccountConfig, h as LingyaoMessage, M as MemorySyncPayload, i as MessageHandler, j as MessageType, N as NotifyAction, k as NotifyPayload, l as NotifyRequest, P as PairingCode, m as PairingConfirmRequest, n as PairingConfirmResponse, o as PollRequest, p as PollResponse, Q as QueuedMessage, S as SyncRequest, q as SyncResponse, T as TokenRefreshRequest, r as TokenRefreshResponse, W as WebSocketConnection, s as getLingyaoGatewayWsUrl } from './types-BFXkMaHp.js';
6
+ import { P as Probe, A as AccountManager } from './probe-DW7_cF66.js';
7
+
8
+ /**
9
+ * Lingyao WebSocket Client
10
+ *
11
+ * 主动连接到 lingyao.live 服务器的 WebSocket 客户端
12
+ * 实现:
13
+ * - 自动连接和重连
14
+ * - 心跳机制
15
+ * - 消息发送和接收
16
+ * - 在线状态管理
17
+ */
18
+
19
+ /**
20
+ * WebSocket 连接状态
21
+ */
22
+ type ConnectionState = "connecting" | "connected" | "disconnected" | "error";
23
+ /**
24
+ * WebSocket 消息类型(与 `lingyao/server/src/server.ts` 中 Gateway 协议一致)
25
+ */
26
+ declare enum WSMessageType {
27
+ GATEWAY_REGISTER = "gateway_register",
28
+ GATEWAY_HEARTBEAT = "gateway_heartbeat",
29
+ GATEWAY_SEND_MESSAGE = "gateway_send_message",
30
+ GATEWAY_REGISTERED = "gateway_registered",
31
+ GATEWAY_HEARTBEAT_ACK = "gateway_heartbeat_ack",
32
+ MESSAGE_DELIVERED = "message_delivered",
33
+ MESSAGE_FAILED = "message_failed",
34
+ APP_MESSAGE = "app_message",
35
+ DEVICE_ONLINE = "device_online",
36
+ PAIRING_COMPLETED = "pairing_completed",
37
+ ERROR = "error"
38
+ }
39
+ /**
40
+ * WebSocket 消息基础格式
41
+ */
42
+ interface WSMessage {
43
+ type: WSMessageType | string;
44
+ id: string;
45
+ timestamp: number;
46
+ payload?: unknown;
47
+ }
48
+ /**
49
+ * 接收到的 App 消息
50
+ */
51
+ interface AppMessage extends WSMessage {
52
+ type: WSMessageType.APP_MESSAGE;
53
+ payload: {
54
+ deviceId: string;
55
+ message: {
56
+ id: string;
57
+ type: "sync_diary" | "sync_memory" | "heartbeat";
58
+ timestamp: number;
59
+ content: string;
60
+ metadata?: Record<string, unknown>;
61
+ };
62
+ };
63
+ }
64
+ /**
65
+ * WebSocket 客户端事件
66
+ */
67
+ type WSClientEvent = {
68
+ type: "connected";
69
+ connectionId: string;
70
+ } | {
71
+ type: "disconnected";
72
+ code: number;
73
+ reason: string;
74
+ } | {
75
+ type: "error";
76
+ error: Error;
77
+ } | {
78
+ type: "fatal_handshake";
79
+ reason: "http_404";
80
+ } | {
81
+ type: "reconnect_aborted";
82
+ reason: "max_attempts";
83
+ attempts: number;
84
+ } | {
85
+ type: "message";
86
+ message: WSMessage;
87
+ } | {
88
+ type: "appMessage";
89
+ deviceId: string;
90
+ message: AppMessage["payload"]["message"];
91
+ } | {
92
+ type: "pairing_completed";
93
+ deviceId: string;
94
+ deviceInfo: {
95
+ name: string;
96
+ platform: string;
97
+ version: string;
98
+ };
99
+ sessionId: string;
100
+ };
101
+ /**
102
+ * WebSocket 客户端配置
103
+ */
104
+ interface WSClientConfig {
105
+ url: string;
106
+ gatewayId: string;
107
+ token?: string;
108
+ /** 重连退避的基准间隔(毫秒),第一次调度使用 `interval * multiplier^0` */
109
+ reconnectInterval: number;
110
+ /** 单次退避延迟上限(毫秒),默认 60s */
111
+ reconnectMaxDelayMs?: number;
112
+ /** 指数乘数,默认 2 */
113
+ reconnectBackoffMultiplier?: number;
114
+ /** 最大连续重连次数(不含首次 connect),0 表示不限制 */
115
+ reconnectMaxAttempts?: number;
116
+ heartbeatInterval: number;
117
+ /** 单帧入站最大字节,默认 {@link LINGYAO_DEFAULT_MAX_INCOMING_WS_BYTES} */
118
+ maxIncomingMessageBytes?: number;
119
+ messageHandler?: (message: AppMessage) => void | Promise<void>;
120
+ eventHandler?: (event: WSClientEvent) => void;
121
+ }
122
+ /**
123
+ * Lingyao WebSocket Client
124
+ *
125
+ * 主动连接到 lingyao.live 服务器的 WebSocket 客户端
126
+ */
127
+ declare class LingyaoWSClient {
128
+ private config;
129
+ private ws;
130
+ private state;
131
+ private connectionId;
132
+ private heartbeatTimer;
133
+ private reconnectTimer;
134
+ /** When set, close handler will not schedule reconnect (e.g. HTTP 404 on upgrade). */
135
+ private suppressReconnect;
136
+ /** 自上次成功 `open` 以来已调度的重连次数(用于退避与上限) */
137
+ private reconnectAttempt;
138
+ private messageHandlers;
139
+ private logger;
140
+ constructor(runtime: LingyaoRuntime, config: WSClientConfig);
141
+ /**
142
+ * 连接到服务器
143
+ */
144
+ connect(): Promise<void>;
145
+ /**
146
+ * 设置 WebSocket 事件处理器
147
+ */
148
+ private setupWebSocketHandlers;
149
+ /**
150
+ * 处理连接打开
151
+ */
152
+ private handleOpen;
153
+ /**
154
+ * 处理接收消息
155
+ */
156
+ private handleMessage;
157
+ /**
158
+ * 处理连接错误
159
+ */
160
+ private handleErrorEvent;
161
+ /**
162
+ * 处理连接关闭
163
+ */
164
+ private handleClose;
165
+ /**
166
+ * 发送注册消息
167
+ */
168
+ private sendRegister;
169
+ /**
170
+ * 处理注册响应
171
+ */
172
+ private handleRegistered;
173
+ /**
174
+ * 发送心跳
175
+ */
176
+ private sendHeartbeat;
177
+ /**
178
+ * 处理心跳确认
179
+ */
180
+ private handleHeartbeatAck;
181
+ /**
182
+ * 启动心跳
183
+ */
184
+ private startHeartbeat;
185
+ /**
186
+ * 停止心跳
187
+ */
188
+ private stopHeartbeat;
189
+ /**
190
+ * 安排重连
191
+ */
192
+ private scheduleReconnect;
193
+ /**
194
+ * 发送消息到服务器
195
+ */
196
+ send(message: WSMessage): void;
197
+ /**
198
+ * 发送通知到鸿蒙 App
199
+ */
200
+ sendNotification(deviceId: string, notification: Record<string, unknown>): void;
201
+ /**
202
+ * 处理 App 消息
203
+ */
204
+ private handleAppMessage;
205
+ /**
206
+ * 处理消息发送成功
207
+ */
208
+ private handleMessageDelivered;
209
+ /**
210
+ * 设备上线(服务器可选推送)
211
+ */
212
+ private handleDeviceOnline;
213
+ /**
214
+ * 处理配对完成通知(来自 lingyao.live 服务器)
215
+ */
216
+ private handlePairingCompleted;
217
+ /**
218
+ * 处理消息发送失败
219
+ */
220
+ private handleMessageFailed;
221
+ /**
222
+ * 处理服务器错误
223
+ */
224
+ private handleError;
225
+ /**
226
+ * 注册消息处理器
227
+ */
228
+ registerMessageHandler(type: string, handler: (message: WSMessage) => void): void;
229
+ /**
230
+ * 发送事件
231
+ */
232
+ private emitEvent;
233
+ /**
234
+ * 更新 WebSocket 连接使用的 token
235
+ */
236
+ updateToken(token: string): void;
237
+ /**
238
+ * 断开连接
239
+ */
240
+ disconnect(): void;
241
+ /**
242
+ * 获取连接状态
243
+ */
244
+ getState(): ConnectionState;
245
+ /**
246
+ * 获取连接 ID
247
+ */
248
+ getConnectionId(): string | null;
249
+ /**
250
+ * 是否已连接
251
+ */
252
+ isConnected(): boolean;
253
+ /**
254
+ * 生成消息 ID
255
+ */
256
+ private generateMessageId;
257
+ /**
258
+ * 生成连接 ID
259
+ */
260
+ private generateConnectionId;
261
+ }
262
+
263
+ /**
264
+ * Narrow orchestrator surface for channel adapters.
265
+ * Adapters depend on this module instead of `orchestrator.ts`, avoiding fragile
266
+ * type-level coupling to the full `MultiAccountOrchestrator` implementation.
267
+ */
268
+
269
+ /**
270
+ * Per-account fields that status/gateway-style adapters read via `getAccountState`.
271
+ */
272
+ interface LingyaoAccountRuntimeState {
273
+ gatewayId: string;
274
+ startTime: number;
275
+ wsClient: LingyaoWSClient | null;
276
+ probe: Probe;
277
+ }
278
+ interface LingyaoOrchestratorHandle {
279
+ start(account: ResolvedAccount, context?: {
280
+ channelRuntime?: PluginRuntime['channel'];
281
+ cfg?: OpenClawConfig;
282
+ }): Promise<void>;
283
+ stop(accountId: string): Promise<void>;
284
+ getAccountState(accountId: string): LingyaoAccountRuntimeState | undefined;
285
+ getAccountManager(accountId: string): AccountManager | null;
286
+ sendNotification(accountId: string, deviceId: string, notification: Record<string, unknown>): boolean;
287
+ }
6
288
 
7
289
  /**
8
290
  * Validate configuration object
@@ -14,7 +296,9 @@ declare function validateConfig(config: unknown): LingyaoConfig;
14
296
  declare function getDefaultConfig(): LingyaoConfig;
15
297
 
16
298
  declare const lingyaoPlugin: ChannelPlugin<ResolvedAccount, LingyaoProbeResult>;
17
- declare function initializeLingyaoRuntime(runtime: PluginRuntime): void;
299
+ declare function initializeLingyaoRuntime(runtime: PluginRuntime, options?: {
300
+ lingyaoConfig?: Partial<LingyaoConfig>;
301
+ }): void;
18
302
 
19
303
  declare const plugin: {
20
304
  id: string;
@@ -26,4 +310,4 @@ declare const plugin: {
26
310
  setChannelRuntime?: (runtime: openclaw_plugin_sdk.PluginRuntime) => void;
27
311
  };
28
312
 
29
- export { LingyaoConfig, plugin as default, getDefaultConfig, initializeLingyaoRuntime, lingyaoPlugin, validateConfig };
313
+ export { type LingyaoAccountRuntimeState, LingyaoConfig, type LingyaoOrchestratorHandle, LingyaoRuntime, plugin as default, getDefaultConfig, initializeLingyaoRuntime, lingyaoPlugin, validateConfig };
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ var globalRuntime = null;
11
11
  function setRuntime(runtime) {
12
12
  globalRuntime = runtime;
13
13
  }
14
- function adaptPluginRuntime(pr) {
14
+ function adaptPluginRuntime(pr, lingyaoConfig) {
15
15
  const noop = (..._args) => {
16
16
  };
17
17
  const rawLogger = pr.logging?.getChildLogger?.() ?? {
@@ -28,7 +28,10 @@ function adaptPluginRuntime(pr) {
28
28
  const stateDir = pr.state?.resolveStateDir?.() ?? join(process.cwd(), ".lingyao-data");
29
29
  const storeDir = join(stateDir, "lingyao");
30
30
  return {
31
- config: { enabled: true },
31
+ config: {
32
+ enabled: true,
33
+ ...lingyaoConfig
34
+ },
32
35
  logger: childLogger,
33
36
  storage: {
34
37
  async get(key) {
@@ -87,6 +90,8 @@ var lingyaoConfigSchema = z.object({
87
90
  dmPolicy: lingyaoDmPolicySchema.optional().default("pairing"),
88
91
  allowFrom: allowFromSchema.default([]),
89
92
  websocketHeartbeatIntervalMs: z.number().int().min(5e3).max(12e4).optional(),
93
+ notificationRatePerSecond: z.number().positive().max(500).optional(),
94
+ notificationBurst: z.number().int().positive().max(1e4).optional(),
90
95
  defaultAccount: z.string().min(1).optional(),
91
96
  accounts: z.record(lingyaoAccountConfigSchema).optional()
92
97
  });
@@ -118,6 +123,18 @@ var lingyaoChannelConfigSchema = {
118
123
  maximum: 12e4,
119
124
  description: "WebSocket gateway_heartbeat interval in ms (default: server register response). Use 5000\u201355000 for typical relay timeout."
120
125
  },
126
+ notificationRatePerSecond: {
127
+ type: "number",
128
+ minimum: 0.1,
129
+ maximum: 500,
130
+ description: "Token bucket refill rate for outbound App notifications (default 15). Override with LINGYAO_NOTIFY_RATE_PER_SEC env if runtime config is not merged."
131
+ },
132
+ notificationBurst: {
133
+ type: "integer",
134
+ minimum: 1,
135
+ maximum: 1e4,
136
+ description: "Max burst for outbound notifications (default 25). Env: LINGYAO_NOTIFY_BURST."
137
+ },
121
138
  accounts: {
122
139
  type: "object",
123
140
  additionalProperties: false,
@@ -2434,6 +2451,18 @@ var NotificationRateLimiter = class {
2434
2451
  };
2435
2452
  var DEFAULT_NOTIFY_REFILL_PER_SEC = 15;
2436
2453
  var DEFAULT_NOTIFY_BURST = 25;
2454
+ function resolveNotificationLimiterParams(cfg) {
2455
+ const envRef = typeof process !== "undefined" ? process.env.LINGYAO_NOTIFY_RATE_PER_SEC : void 0;
2456
+ const envBurst = typeof process !== "undefined" ? process.env.LINGYAO_NOTIFY_BURST : void 0;
2457
+ const refillFromEnv = envRef !== void 0 && envRef !== "" ? Number(envRef) : Number.NaN;
2458
+ const burstFromEnv = envBurst !== void 0 && envBurst !== "" ? Number(envBurst) : Number.NaN;
2459
+ const refill = cfg.notificationRatePerSecond ?? (!Number.isNaN(refillFromEnv) && refillFromEnv > 0 ? refillFromEnv : void 0) ?? DEFAULT_NOTIFY_REFILL_PER_SEC;
2460
+ const burst = cfg.notificationBurst ?? (!Number.isNaN(burstFromEnv) && burstFromEnv > 0 ? Math.floor(burstFromEnv) : void 0) ?? DEFAULT_NOTIFY_BURST;
2461
+ return {
2462
+ refillPerSecond: Math.min(500, Math.max(0.1, refill)),
2463
+ burst: Math.min(1e4, Math.max(1, Math.floor(burst)))
2464
+ };
2465
+ }
2437
2466
 
2438
2467
  // src/orchestrator.ts
2439
2468
  function getMachineId() {
@@ -2452,12 +2481,11 @@ function generateGatewayId(accountId) {
2452
2481
  var MultiAccountOrchestrator = class {
2453
2482
  runtime;
2454
2483
  accounts = /* @__PURE__ */ new Map();
2455
- notificationLimiter = new NotificationRateLimiter(
2456
- DEFAULT_NOTIFY_REFILL_PER_SEC,
2457
- DEFAULT_NOTIFY_BURST
2458
- );
2484
+ notificationLimiter;
2459
2485
  constructor(runtime) {
2460
2486
  this.runtime = runtime;
2487
+ const lim = resolveNotificationLimiterParams(runtime.config);
2488
+ this.notificationLimiter = new NotificationRateLimiter(lim.refillPerSecond, lim.burst);
2461
2489
  }
2462
2490
  /**
2463
2491
  * Start an account: create components, register to server, connect WS.
@@ -3006,15 +3034,18 @@ var lingyaoPlugin = {
3006
3034
  directory: directoryAdapter,
3007
3035
  messaging: messagingAdapter
3008
3036
  };
3009
- function initializeLingyaoRuntime(runtime) {
3010
- const adapted = adaptPluginRuntime(runtime);
3037
+ function initializeLingyaoRuntime(runtime, options) {
3038
+ const adapted = adaptPluginRuntime(
3039
+ runtime,
3040
+ options?.lingyaoConfig
3041
+ );
3011
3042
  setRuntime(adapted);
3012
3043
  orchestrator = new MultiAccountOrchestrator(adapted);
3013
3044
  }
3014
3045
 
3015
3046
  // src/runtime-api.ts
3016
- function setLingyaoRuntime(runtime) {
3017
- initializeLingyaoRuntime(runtime);
3047
+ function setLingyaoRuntime(runtime, options) {
3048
+ initializeLingyaoRuntime(runtime, options);
3018
3049
  }
3019
3050
 
3020
3051
  // src/index.ts