@lingyao037/openclaw-lingyao-cli 1.3.6 → 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 +2 -201
- package/dist/index.d.ts +281 -16
- package/dist/index.js +291 -119
- package/dist/index.js.map +1 -1
- package/dist/probe-DW7_cF66.d.ts +212 -0
- package/dist/setup-entry.d.ts +2 -2
- package/dist/setup-entry.js +103 -78
- package/dist/setup-entry.js.map +1 -1
- package/dist/{status-CS7AsRlS.d.ts → status-n_XeBoR3.d.ts} +1 -1
- package/dist/{types-BZMU9mea.d.ts → types-BFXkMaHp.d.ts} +24 -1
- package/package.json +1 -1
package/dist/cli.d.ts
CHANGED
|
@@ -1,204 +1,5 @@
|
|
|
1
|
-
import { L as LingyaoRuntime
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Account storage and management
|
|
5
|
-
*/
|
|
6
|
-
declare class AccountManager {
|
|
7
|
-
private runtime;
|
|
8
|
-
private accounts;
|
|
9
|
-
private pendingPairings;
|
|
10
|
-
constructor(runtime: LingyaoRuntime);
|
|
11
|
-
/**
|
|
12
|
-
* Initialize account manager from storage
|
|
13
|
-
*/
|
|
14
|
-
initialize(): Promise<void>;
|
|
15
|
-
/**
|
|
16
|
-
* Get account by device ID
|
|
17
|
-
*/
|
|
18
|
-
getAccount(deviceId: string): LingyaoAccount | undefined;
|
|
19
|
-
/**
|
|
20
|
-
* Get account by device token
|
|
21
|
-
*/
|
|
22
|
-
getAccountByToken(token: string): LingyaoAccount | undefined;
|
|
23
|
-
/**
|
|
24
|
-
* Get all active accounts
|
|
25
|
-
*/
|
|
26
|
-
getActiveAccounts(): LingyaoAccount[];
|
|
27
|
-
/**
|
|
28
|
-
* Create a new pairing session
|
|
29
|
-
*/
|
|
30
|
-
createPairingSession(code: string, expiresAt: number): Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
* Get pairing session by code
|
|
33
|
-
*/
|
|
34
|
-
getPairingSession(code: string): PairingSession | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* Remove a pending pairing (e.g. expired or cancelled)
|
|
37
|
-
*/
|
|
38
|
-
deletePendingPairing(code: string): Promise<void>;
|
|
39
|
-
/**
|
|
40
|
-
* Confirm pairing and create account
|
|
41
|
-
*/
|
|
42
|
-
confirmPairing(pairingCode: string, deviceToken: DeviceToken, deviceInfo: DeviceInfo): Promise<LingyaoAccount | null>;
|
|
43
|
-
/**
|
|
44
|
-
* Update account's last seen timestamp
|
|
45
|
-
*/
|
|
46
|
-
updateLastSeen(deviceId: string): Promise<void>;
|
|
47
|
-
/**
|
|
48
|
-
* Revoke an account
|
|
49
|
-
*/
|
|
50
|
-
revokeAccount(deviceId: string): Promise<boolean>;
|
|
51
|
-
/**
|
|
52
|
-
* Manually add a device by deviceId (user-initiated pairing).
|
|
53
|
-
* No pairing code or deviceToken required — the user explicitly
|
|
54
|
-
* trusts this device from the OpenClaw CLI.
|
|
55
|
-
*/
|
|
56
|
-
addDevice(deviceId: string, deviceInfo: DeviceInfo): Promise<LingyaoAccount>;
|
|
57
|
-
/**
|
|
58
|
-
* Refresh device token
|
|
59
|
-
*/
|
|
60
|
-
refreshDeviceToken(deviceId: string, newToken: DeviceToken): Promise<boolean>;
|
|
61
|
-
/**
|
|
62
|
-
* Clean up expired accounts
|
|
63
|
-
*/
|
|
64
|
-
cleanupExpired(): Promise<void>;
|
|
65
|
-
/**
|
|
66
|
-
* Save accounts to storage
|
|
67
|
-
*/
|
|
68
|
-
private saveAccounts;
|
|
69
|
-
/**
|
|
70
|
-
* Save pending pairings to storage
|
|
71
|
-
*/
|
|
72
|
-
private savePendingPairings;
|
|
73
|
-
}
|
|
74
|
-
interface PairingSession {
|
|
75
|
-
code: string;
|
|
76
|
-
createdAt: number;
|
|
77
|
-
expiresAt: number;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Probe status levels
|
|
82
|
-
*/
|
|
83
|
-
declare enum ProbeStatus {
|
|
84
|
-
HEALTHY = "healthy",
|
|
85
|
-
DEGRADED = "degraded",
|
|
86
|
-
UNHEALTHY = "unhealthy"
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Health check result
|
|
90
|
-
*/
|
|
91
|
-
interface HealthCheckResult {
|
|
92
|
-
status: ProbeStatus;
|
|
93
|
-
checks: Map<string, CheckResult>;
|
|
94
|
-
timestamp: number;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Individual check result
|
|
98
|
-
*/
|
|
99
|
-
interface CheckResult {
|
|
100
|
-
passed: boolean;
|
|
101
|
-
message?: string;
|
|
102
|
-
duration: number;
|
|
103
|
-
error?: Error;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Channel status for reporting
|
|
107
|
-
*/
|
|
108
|
-
interface ChannelStatus {
|
|
109
|
-
configured: boolean;
|
|
110
|
-
running: boolean;
|
|
111
|
-
lastError?: string;
|
|
112
|
-
activeAccounts: number;
|
|
113
|
-
uptime: number;
|
|
114
|
-
status: ProbeStatus;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Probe - Channel health status and monitoring
|
|
118
|
-
*/
|
|
119
|
-
declare class Probe {
|
|
120
|
-
private runtime;
|
|
121
|
-
private startTime;
|
|
122
|
-
private lastError;
|
|
123
|
-
private lastErrorTime;
|
|
124
|
-
private errorCounts;
|
|
125
|
-
private healthChecks;
|
|
126
|
-
constructor(runtime: LingyaoRuntime);
|
|
127
|
-
/**
|
|
128
|
-
* Register a custom health check
|
|
129
|
-
*/
|
|
130
|
-
registerHealthCheck(name: string, check: HealthCheckFn): void;
|
|
131
|
-
/**
|
|
132
|
-
* Run all health checks
|
|
133
|
-
*/
|
|
134
|
-
runHealthChecks(): Promise<HealthCheckResult>;
|
|
135
|
-
/**
|
|
136
|
-
* Get channel status for reporting
|
|
137
|
-
*/
|
|
138
|
-
getChannelStatus(configured: boolean, running: boolean, activeAccounts?: number): ChannelStatus;
|
|
139
|
-
/**
|
|
140
|
-
* Get health status for API endpoint
|
|
141
|
-
*/
|
|
142
|
-
getHealthStatus(activeConnections?: number, queuedMessages?: number): Promise<HealthStatus>;
|
|
143
|
-
/**
|
|
144
|
-
* Record an error
|
|
145
|
-
*/
|
|
146
|
-
recordError(error: string, category?: string): void;
|
|
147
|
-
/**
|
|
148
|
-
* Get last error
|
|
149
|
-
*/
|
|
150
|
-
getLastError(): string | null;
|
|
151
|
-
/**
|
|
152
|
-
* Clear last error
|
|
153
|
-
*/
|
|
154
|
-
clearLastError(): void;
|
|
155
|
-
/**
|
|
156
|
-
* Get error counts by category
|
|
157
|
-
*/
|
|
158
|
-
getErrorCounts(): Record<string, number>;
|
|
159
|
-
/**
|
|
160
|
-
* Reset error counts
|
|
161
|
-
*/
|
|
162
|
-
resetErrorCounts(): void;
|
|
163
|
-
/**
|
|
164
|
-
* Get uptime in milliseconds
|
|
165
|
-
*/
|
|
166
|
-
getUptime(): number;
|
|
167
|
-
/**
|
|
168
|
-
* Get uptime formatted as human-readable string
|
|
169
|
-
*/
|
|
170
|
-
getUptimeString(): string;
|
|
171
|
-
/**
|
|
172
|
-
* Health check: uptime
|
|
173
|
-
*/
|
|
174
|
-
private checkUptime;
|
|
175
|
-
/**
|
|
176
|
-
* Health check: errors
|
|
177
|
-
*/
|
|
178
|
-
private checkErrors;
|
|
179
|
-
/**
|
|
180
|
-
* Create status adapter for OpenClaw integration
|
|
181
|
-
*/
|
|
182
|
-
createStatusAdapter(configured: boolean): {
|
|
183
|
-
getStatus: (running: boolean, activeAccounts?: number, activeConnections?: number, queuedMessages?: number) => Promise<{
|
|
184
|
-
activeConnections: number;
|
|
185
|
-
queuedMessages: number;
|
|
186
|
-
configured: boolean;
|
|
187
|
-
running: boolean;
|
|
188
|
-
lastError?: string;
|
|
189
|
-
activeAccounts: number;
|
|
190
|
-
uptime: number;
|
|
191
|
-
status: ProbeStatus;
|
|
192
|
-
}>;
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Health check function signature
|
|
197
|
-
*/
|
|
198
|
-
type HealthCheckFn = () => Promise<{
|
|
199
|
-
passed: boolean;
|
|
200
|
-
message?: string;
|
|
201
|
-
}>;
|
|
1
|
+
import { L as LingyaoRuntime } from './types-BFXkMaHp.js';
|
|
2
|
+
import { A as AccountManager, P as Probe } from './probe-DW7_cF66.js';
|
|
202
3
|
|
|
203
4
|
/**
|
|
204
5
|
* CLI command handler for Lingyao plugin
|
package/dist/index.d.ts
CHANGED
|
@@ -1,26 +1,289 @@
|
|
|
1
|
-
import { R as ResolvedAccount, L as LingyaoProbeResult } from './status-
|
|
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 {
|
|
5
|
-
export { A as AckRequest, b as
|
|
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';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
+
* Lingyao WebSocket Client
|
|
9
10
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
11
|
+
* 主动连接到 lingyao.live 服务器的 WebSocket 客户端
|
|
12
|
+
* 实现:
|
|
13
|
+
* - 自动连接和重连
|
|
14
|
+
* - 心跳机制
|
|
15
|
+
* - 消息发送和接收
|
|
16
|
+
* - 在线状态管理
|
|
12
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
|
+
}
|
|
13
39
|
/**
|
|
14
|
-
*
|
|
40
|
+
* WebSocket 消息基础格式
|
|
15
41
|
*/
|
|
16
|
-
interface
|
|
42
|
+
interface WSMessage {
|
|
43
|
+
type: WSMessageType | string;
|
|
17
44
|
id: string;
|
|
18
|
-
type: "diary" | "memory" | "heartbeat";
|
|
19
|
-
from: string;
|
|
20
|
-
deviceId: string;
|
|
21
|
-
content: string;
|
|
22
|
-
metadata: Record<string, unknown>;
|
|
23
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;
|
|
24
287
|
}
|
|
25
288
|
|
|
26
289
|
/**
|
|
@@ -33,7 +296,9 @@ declare function validateConfig(config: unknown): LingyaoConfig;
|
|
|
33
296
|
declare function getDefaultConfig(): LingyaoConfig;
|
|
34
297
|
|
|
35
298
|
declare const lingyaoPlugin: ChannelPlugin<ResolvedAccount, LingyaoProbeResult>;
|
|
36
|
-
declare function initializeLingyaoRuntime(runtime: PluginRuntime
|
|
299
|
+
declare function initializeLingyaoRuntime(runtime: PluginRuntime, options?: {
|
|
300
|
+
lingyaoConfig?: Partial<LingyaoConfig>;
|
|
301
|
+
}): void;
|
|
37
302
|
|
|
38
303
|
declare const plugin: {
|
|
39
304
|
id: string;
|
|
@@ -45,4 +310,4 @@ declare const plugin: {
|
|
|
45
310
|
setChannelRuntime?: (runtime: openclaw_plugin_sdk.PluginRuntime) => void;
|
|
46
311
|
};
|
|
47
312
|
|
|
48
|
-
export { type
|
|
313
|
+
export { type LingyaoAccountRuntimeState, LingyaoConfig, type LingyaoOrchestratorHandle, LingyaoRuntime, plugin as default, getDefaultConfig, initializeLingyaoRuntime, lingyaoPlugin, validateConfig };
|