@lingyao037/openclaw-lingyao-cli 0.3.2 → 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/cli.mjs +12 -10
- 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/cli.mjs
CHANGED
|
@@ -27,7 +27,7 @@ const CYAN = '\x1b[36m';
|
|
|
27
27
|
const NC = '\x1b[0m';
|
|
28
28
|
|
|
29
29
|
class LingyaoInstaller {
|
|
30
|
-
constructor(customPath = null, skipDeps =
|
|
30
|
+
constructor(customPath = null, skipDeps = true) {
|
|
31
31
|
this.openclawPath = null;
|
|
32
32
|
this.customPath = customPath;
|
|
33
33
|
this.skipDeps = skipDeps;
|
|
@@ -227,13 +227,15 @@ class LingyaoInstaller {
|
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
// 从 npx/npm 临时目录一起复制运行时依赖,避免目标 Gateway 再执行一次安装。
|
|
230
|
+
// 注意:默认不复制 node_modules,因为插件依赖(axios/ws/zod)已在目标 OpenClaw 环境中可用。
|
|
231
|
+
// 如遇特殊情况需强制复制依赖,可传入 --with-deps 参数。
|
|
230
232
|
const runtimeModulesPath = join(__dirname, 'node_modules');
|
|
231
233
|
if (existsSync(runtimeModulesPath) && statSync(runtimeModulesPath).isDirectory()) {
|
|
232
|
-
if (
|
|
234
|
+
if (this.skipDeps) {
|
|
235
|
+
this.info('跳过复制 node_modules (默认行为,使用目标环境已有依赖)');
|
|
236
|
+
} else {
|
|
233
237
|
this.log('复制运行时依赖...');
|
|
234
238
|
this.copyDirectory(runtimeModulesPath, join(targetDir, 'node_modules'));
|
|
235
|
-
} else {
|
|
236
|
-
this.info('跳过复制运行时依赖 (--no-deps)');
|
|
237
239
|
}
|
|
238
240
|
} else {
|
|
239
241
|
if (!this.skipDeps) {
|
|
@@ -540,14 +542,14 @@ async function main() {
|
|
|
540
542
|
const args = process.argv.slice(2);
|
|
541
543
|
let command = 'install';
|
|
542
544
|
let customPath = null;
|
|
543
|
-
let skipDeps =
|
|
545
|
+
let skipDeps = true;
|
|
544
546
|
|
|
545
547
|
for (let i = 0; i < args.length; i++) {
|
|
546
548
|
if (args[i] === '--path' && i + 1 < args.length) {
|
|
547
549
|
customPath = args[i + 1];
|
|
548
550
|
i++; // 跳过路径参数
|
|
549
|
-
} else if (args[i] === '--
|
|
550
|
-
skipDeps =
|
|
551
|
+
} else if (args[i] === '--with-deps') {
|
|
552
|
+
skipDeps = false;
|
|
551
553
|
} else if (!args[i].startsWith('--')) {
|
|
552
554
|
command = args[i];
|
|
553
555
|
}
|
|
@@ -579,7 +581,7 @@ async function main() {
|
|
|
579
581
|
|
|
580
582
|
参数:
|
|
581
583
|
--path <目录> # 指定 OpenClaw 安装目录
|
|
582
|
-
--
|
|
584
|
+
--with-deps # 复制 node_modules(默认不复制,避免依赖冲突)
|
|
583
585
|
|
|
584
586
|
环境要求:
|
|
585
587
|
• Node.js >= 22
|
|
@@ -589,8 +591,8 @@ async function main() {
|
|
|
589
591
|
# 从 npm 安装(推荐)
|
|
590
592
|
npx -y @lingyao/openclaw-lingyao-cli install
|
|
591
593
|
|
|
592
|
-
#
|
|
593
|
-
npx -y @lingyao/openclaw-lingyao-cli install --
|
|
594
|
+
# 强制复制 node_modules(仅在明确需要时使用)
|
|
595
|
+
npx -y @lingyao/openclaw-lingyao-cli install --with-deps
|
|
594
596
|
|
|
595
597
|
# 从 npm 卸载
|
|
596
598
|
npx -y @lingyao/openclaw-lingyao-cli uninstall
|
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(
|