@lingyao037/openclaw-lingyao-cli 0.3.3 → 0.3.5
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/index.d.ts +93 -47
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,31 @@
|
|
|
1
1
|
import { a as LingyaoAccountConfig, L as LingyaoRuntime, A as AccountManager, S as SyncRequest, b as SyncResponse, c as LingyaoMessage, D as DeviceInfo, d as DeviceToken, e as LingyaoConfig, N as NotifyPayload, H as HealthStatus } from './accounts-Bkwmg14Q.js';
|
|
2
2
|
export { f as AckRequest, g as DiarySyncPayload, F as FailedEntry, h as LINGYAO_SERVER_URL, i as LingyaoAccount, M as MemorySyncPayload, j as MessageType, k as NotifyAction, l as NotifyRequest, P as PairingCode, m as PairingConfirmRequest, n as PairingConfirmResponse, o as PollRequest, p as PollResponse, Q as QueuedMessage, T as TokenRefreshRequest, q as TokenRefreshResponse, W as WebSocketConnection } from './accounts-Bkwmg14Q.js';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Messaging Adapter - Target normalization and session resolution
|
|
6
|
+
*
|
|
7
|
+
* Implements ChannelMessagingAdapter:
|
|
8
|
+
* - normalizeTarget: strip "lingyao:" prefix, return pure deviceId
|
|
9
|
+
* - resolveSessionTarget: return "lingyao:{id}" format
|
|
10
|
+
* - inferTargetChatType: always "direct" (Lingyao has no groups)
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* SDK-compatible messaging interfaces
|
|
14
|
+
*/
|
|
15
|
+
type ChatType = 'direct' | 'group';
|
|
16
|
+
|
|
4
17
|
/**
|
|
5
18
|
* Config Adapter - Account resolution, config validation
|
|
6
19
|
*
|
|
7
20
|
* serverUrl is NOT exposed to users — hardcoded as LINGYAO_SERVER_URL.
|
|
8
21
|
*/
|
|
9
22
|
|
|
23
|
+
/**
|
|
24
|
+
* OpenClawConfig - compatible with SDK interface
|
|
25
|
+
*/
|
|
26
|
+
interface OpenClawConfig$4 {
|
|
27
|
+
channels?: Record<string, unknown>;
|
|
28
|
+
}
|
|
10
29
|
/**
|
|
11
30
|
* Resolved account after config resolution.
|
|
12
31
|
*/
|
|
@@ -767,10 +786,14 @@ declare class ErrorHandler {
|
|
|
767
786
|
*/
|
|
768
787
|
|
|
769
788
|
/**
|
|
770
|
-
*
|
|
789
|
+
* SDK-compatible directory interfaces
|
|
771
790
|
*/
|
|
772
|
-
interface
|
|
773
|
-
|
|
791
|
+
interface OpenClawConfig$3 {
|
|
792
|
+
channels?: Record<string, unknown>;
|
|
793
|
+
}
|
|
794
|
+
type ChannelDirectoryEntryKind = 'user' | 'group' | 'channel';
|
|
795
|
+
interface ChannelDirectoryEntry {
|
|
796
|
+
kind: ChannelDirectoryEntryKind;
|
|
774
797
|
id: string;
|
|
775
798
|
name?: string;
|
|
776
799
|
handle?: string;
|
|
@@ -778,6 +801,15 @@ interface DirectoryEntry {
|
|
|
778
801
|
rank?: number;
|
|
779
802
|
raw?: unknown;
|
|
780
803
|
}
|
|
804
|
+
interface RuntimeEnv$1 {
|
|
805
|
+
}
|
|
806
|
+
interface ChannelDirectoryListParams {
|
|
807
|
+
cfg: OpenClawConfig$3;
|
|
808
|
+
accountId?: string | null;
|
|
809
|
+
query?: string | null;
|
|
810
|
+
limit?: number | null;
|
|
811
|
+
runtime: RuntimeEnv$1;
|
|
812
|
+
}
|
|
781
813
|
|
|
782
814
|
/**
|
|
783
815
|
* Status Adapter - Health checks and channel summary
|
|
@@ -793,6 +825,18 @@ interface DirectoryEntry {
|
|
|
793
825
|
* Wraps existing Probe and Monitor classes.
|
|
794
826
|
*/
|
|
795
827
|
|
|
828
|
+
/**
|
|
829
|
+
* SDK-compatible status interfaces
|
|
830
|
+
*/
|
|
831
|
+
interface OpenClawConfig$2 {
|
|
832
|
+
channels?: Record<string, unknown>;
|
|
833
|
+
}
|
|
834
|
+
interface ChannelAccountSnapshot$1 {
|
|
835
|
+
accountId: string;
|
|
836
|
+
configured: boolean;
|
|
837
|
+
enabled: boolean;
|
|
838
|
+
running: boolean;
|
|
839
|
+
}
|
|
796
840
|
/**
|
|
797
841
|
* Probe result structure.
|
|
798
842
|
*/
|
|
@@ -826,26 +870,23 @@ interface LingyaoProbeResult {
|
|
|
826
870
|
*/
|
|
827
871
|
|
|
828
872
|
/**
|
|
829
|
-
*
|
|
873
|
+
* SDK-compatible outbound interfaces
|
|
830
874
|
*/
|
|
831
|
-
interface
|
|
832
|
-
|
|
875
|
+
interface OpenClawConfig$1 {
|
|
876
|
+
channels?: Record<string, unknown>;
|
|
877
|
+
}
|
|
878
|
+
interface ChannelOutboundContext {
|
|
879
|
+
cfg: OpenClawConfig$1;
|
|
833
880
|
to: string;
|
|
834
881
|
text: string;
|
|
835
882
|
mediaUrl?: string;
|
|
836
883
|
accountId?: string | null;
|
|
837
884
|
silent?: boolean;
|
|
838
885
|
}
|
|
839
|
-
|
|
840
|
-
* Minimal ChannelOutboundPayloadContext.
|
|
841
|
-
*/
|
|
842
|
-
interface OutboundPayloadContext extends OutboundContext {
|
|
886
|
+
interface ChannelOutboundPayloadContext extends ChannelOutboundContext {
|
|
843
887
|
payload: unknown;
|
|
844
888
|
}
|
|
845
|
-
|
|
846
|
-
* OutboundDeliveryResult - what SDK expects back.
|
|
847
|
-
*/
|
|
848
|
-
interface DeliveryResult {
|
|
889
|
+
interface OutboundDeliveryResult {
|
|
849
890
|
channel: string;
|
|
850
891
|
messageId: string;
|
|
851
892
|
chatId?: string;
|
|
@@ -862,29 +903,40 @@ interface DeliveryResult {
|
|
|
862
903
|
*
|
|
863
904
|
* Delegates to MultiAccountOrchestrator for all operations.
|
|
864
905
|
*
|
|
865
|
-
* SDK passes ChannelGatewayContext
|
|
906
|
+
* SDK passes ChannelGatewayContext with required fields:
|
|
866
907
|
* cfg, accountId, account, runtime, abortSignal, log,
|
|
867
908
|
* getStatus, setStatus, channelRuntime?
|
|
868
909
|
*/
|
|
869
910
|
|
|
870
911
|
/**
|
|
871
|
-
*
|
|
872
|
-
* We define this locally to avoid importing internal SDK types.
|
|
912
|
+
* SDK-compatible ChannelGatewayContext interface
|
|
873
913
|
*/
|
|
874
|
-
interface
|
|
914
|
+
interface ChannelGatewayContext<ResolvedAccount = unknown> {
|
|
915
|
+
cfg: OpenClawConfig;
|
|
875
916
|
accountId: string;
|
|
876
917
|
account: ResolvedAccount;
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
abortSignal?: AbortSignal;
|
|
918
|
+
runtime: RuntimeEnv;
|
|
919
|
+
abortSignal: AbortSignal;
|
|
880
920
|
log?: {
|
|
881
921
|
info: (msg: string) => void;
|
|
882
|
-
warn
|
|
883
|
-
error
|
|
922
|
+
warn?: (msg: string) => void;
|
|
923
|
+
error?: (msg: string) => void;
|
|
884
924
|
debug?: (msg: string) => void;
|
|
885
925
|
};
|
|
886
|
-
getStatus
|
|
887
|
-
setStatus
|
|
926
|
+
getStatus: () => ChannelAccountSnapshot;
|
|
927
|
+
setStatus: (next: ChannelAccountSnapshot) => void;
|
|
928
|
+
channelRuntime?: unknown;
|
|
929
|
+
}
|
|
930
|
+
interface OpenClawConfig {
|
|
931
|
+
channels?: Record<string, unknown>;
|
|
932
|
+
}
|
|
933
|
+
interface RuntimeEnv {
|
|
934
|
+
}
|
|
935
|
+
interface ChannelAccountSnapshot {
|
|
936
|
+
accountId: string;
|
|
937
|
+
configured: boolean;
|
|
938
|
+
enabled: boolean;
|
|
939
|
+
running: boolean;
|
|
888
940
|
}
|
|
889
941
|
|
|
890
942
|
/**
|
|
@@ -1147,21 +1199,21 @@ declare const pluginEntry: {
|
|
|
1147
1199
|
blockStreaming: boolean;
|
|
1148
1200
|
};
|
|
1149
1201
|
config: {
|
|
1150
|
-
listAccountIds(cfg:
|
|
1151
|
-
resolveAccount(cfg:
|
|
1152
|
-
isConfigured(_account: ResolvedAccount): boolean;
|
|
1153
|
-
isEnabled(account: ResolvedAccount): boolean;
|
|
1202
|
+
listAccountIds(cfg: OpenClawConfig$4): string[];
|
|
1203
|
+
resolveAccount(cfg: OpenClawConfig$4, accountId?: string | null): ResolvedAccount;
|
|
1204
|
+
isConfigured(_account: ResolvedAccount, _cfg: OpenClawConfig$4): boolean;
|
|
1205
|
+
isEnabled(account: ResolvedAccount, _cfg: OpenClawConfig$4): boolean;
|
|
1154
1206
|
};
|
|
1155
1207
|
gateway: {
|
|
1156
|
-
startAccount(ctx:
|
|
1157
|
-
stopAccount(ctx:
|
|
1208
|
+
startAccount(ctx: ChannelGatewayContext<ResolvedAccount>): Promise<void>;
|
|
1209
|
+
stopAccount(ctx: ChannelGatewayContext<ResolvedAccount>): Promise<void>;
|
|
1158
1210
|
};
|
|
1159
1211
|
outbound: {
|
|
1160
1212
|
deliveryMode: "direct";
|
|
1161
|
-
sendText(ctx:
|
|
1162
|
-
sendPayload(ctx:
|
|
1213
|
+
sendText(ctx: ChannelOutboundContext): Promise<OutboundDeliveryResult>;
|
|
1214
|
+
sendPayload(ctx: ChannelOutboundPayloadContext): Promise<OutboundDeliveryResult>;
|
|
1163
1215
|
resolveTarget(params: {
|
|
1164
|
-
cfg?:
|
|
1216
|
+
cfg?: OpenClawConfig$1;
|
|
1165
1217
|
to?: string;
|
|
1166
1218
|
accountId?: string | null;
|
|
1167
1219
|
}): {
|
|
@@ -1176,34 +1228,28 @@ declare const pluginEntry: {
|
|
|
1176
1228
|
probeAccount(params: {
|
|
1177
1229
|
account: ResolvedAccount;
|
|
1178
1230
|
timeoutMs: number;
|
|
1179
|
-
cfg:
|
|
1231
|
+
cfg: OpenClawConfig$2;
|
|
1180
1232
|
}): Promise<LingyaoProbeResult>;
|
|
1181
1233
|
buildChannelSummary(params: {
|
|
1182
1234
|
account: ResolvedAccount;
|
|
1183
|
-
cfg:
|
|
1235
|
+
cfg: OpenClawConfig$2;
|
|
1184
1236
|
defaultAccountId: string;
|
|
1185
|
-
snapshot:
|
|
1237
|
+
snapshot: ChannelAccountSnapshot$1;
|
|
1186
1238
|
}): Promise<Record<string, unknown>>;
|
|
1187
1239
|
};
|
|
1188
1240
|
directory: {
|
|
1189
|
-
listPeers(params:
|
|
1190
|
-
cfg: unknown;
|
|
1191
|
-
accountId?: string | null;
|
|
1192
|
-
query?: string | null;
|
|
1193
|
-
limit?: number | null;
|
|
1194
|
-
runtime?: unknown;
|
|
1195
|
-
}): Promise<DirectoryEntry[]>;
|
|
1241
|
+
listPeers(params: ChannelDirectoryListParams): Promise<ChannelDirectoryEntry[]>;
|
|
1196
1242
|
};
|
|
1197
1243
|
messaging: {
|
|
1198
1244
|
normalizeTarget(raw: string): string | undefined;
|
|
1199
1245
|
resolveSessionTarget(params: {
|
|
1200
|
-
kind: "group" | "channel";
|
|
1246
|
+
kind: "user" | "group" | "channel";
|
|
1201
1247
|
id: string;
|
|
1202
|
-
threadId?: string | null;
|
|
1248
|
+
threadId?: string | number | null;
|
|
1203
1249
|
}): string | undefined;
|
|
1204
1250
|
inferTargetChatType(_params: {
|
|
1205
1251
|
to: string;
|
|
1206
|
-
}):
|
|
1252
|
+
}): ChatType | undefined;
|
|
1207
1253
|
};
|
|
1208
1254
|
};
|
|
1209
1255
|
security: {
|
package/dist/index.js
CHANGED
|
@@ -40,10 +40,10 @@ function createConfigAdapter() {
|
|
|
40
40
|
rawConfig: accountConfig
|
|
41
41
|
};
|
|
42
42
|
},
|
|
43
|
-
isConfigured(_account) {
|
|
43
|
+
isConfigured(_account, _cfg) {
|
|
44
44
|
return true;
|
|
45
45
|
},
|
|
46
|
-
isEnabled(account) {
|
|
46
|
+
isEnabled(account, _cfg) {
|
|
47
47
|
return account.enabled;
|
|
48
48
|
}
|
|
49
49
|
};
|
|
@@ -241,11 +241,10 @@ function createOutboundAdapter(getOrchestrator2) {
|
|
|
241
241
|
throw new Error("Orchestrator not initialized");
|
|
242
242
|
}
|
|
243
243
|
const accountId = ctx.accountId ?? "default";
|
|
244
|
-
const payload = ctx.payload;
|
|
245
244
|
const sent = orchestrator2.sendNotification(
|
|
246
245
|
accountId,
|
|
247
246
|
ctx.to,
|
|
248
|
-
payload
|
|
247
|
+
ctx.payload
|
|
249
248
|
);
|
|
250
249
|
if (!sent) {
|
|
251
250
|
throw new Error(
|