liangzimixin 0.3.29-beta.2 → 0.3.30
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.cjs +20 -188
- package/dist/index.d.cts +21 -11
- package/dist/quantum-sdk/index.cjs +4 -4
- package/dist/setup-entry.cjs +49 -240
- package/dist/setup-entry.d.cts +7 -8
- package/openclaw.plugin.json +31 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -17565,7 +17565,7 @@ function buildPluginConfig(accountConfig, internalOverrides) {
|
|
|
17565
17565
|
}
|
|
17566
17566
|
|
|
17567
17567
|
// src/channel/plugin.ts
|
|
17568
|
-
var
|
|
17568
|
+
var import_plugin_sdk3 = require("openclaw/plugin-sdk");
|
|
17569
17569
|
|
|
17570
17570
|
// src/file/media.ts
|
|
17571
17571
|
var path = __toESM(require("path"), 1);
|
|
@@ -18676,20 +18676,20 @@ var QUANTUM_IM_CONFIG_JSON_SCHEMA = {
|
|
|
18676
18676
|
};
|
|
18677
18677
|
|
|
18678
18678
|
// src/accounts.ts
|
|
18679
|
-
var
|
|
18679
|
+
var import_plugin_sdk = require("openclaw/plugin-sdk");
|
|
18680
18680
|
function getChannelConfig(cfg) {
|
|
18681
18681
|
return cfg?.channels?.[CHANNEL_ID];
|
|
18682
18682
|
}
|
|
18683
18683
|
function getAccountIds(cfg) {
|
|
18684
18684
|
const section = getChannelConfig(cfg);
|
|
18685
|
-
if (!section?.accounts) return [
|
|
18685
|
+
if (!section?.accounts) return [import_plugin_sdk.DEFAULT_ACCOUNT_ID];
|
|
18686
18686
|
return Object.keys(section.accounts);
|
|
18687
18687
|
}
|
|
18688
18688
|
function getDefaultAccountId(cfg) {
|
|
18689
|
-
return getAccountIds(cfg)[0] ??
|
|
18689
|
+
return getAccountIds(cfg)[0] ?? import_plugin_sdk.DEFAULT_ACCOUNT_ID;
|
|
18690
18690
|
}
|
|
18691
18691
|
function resolveAccount(cfg, accountId) {
|
|
18692
|
-
const requestedId = accountId ??
|
|
18692
|
+
const requestedId = accountId ?? import_plugin_sdk.DEFAULT_ACCOUNT_ID;
|
|
18693
18693
|
const section = getChannelConfig(cfg);
|
|
18694
18694
|
if (!section?.accounts?.[requestedId]) {
|
|
18695
18695
|
return {
|
|
@@ -18716,7 +18716,7 @@ function resolveAccount(cfg, accountId) {
|
|
|
18716
18716
|
}
|
|
18717
18717
|
|
|
18718
18718
|
// src/channel/onboarding.ts
|
|
18719
|
-
var
|
|
18719
|
+
var import_plugin_sdk2 = require("openclaw/plugin-sdk");
|
|
18720
18720
|
function getChannelSection(cfg) {
|
|
18721
18721
|
return cfg.channels?.[CHANNEL_ID];
|
|
18722
18722
|
}
|
|
@@ -18752,7 +18752,7 @@ var quantumImOnboarding = {
|
|
|
18752
18752
|
initialValue: false
|
|
18753
18753
|
});
|
|
18754
18754
|
if (!reconfigure) {
|
|
18755
|
-
return { cfg, accountId:
|
|
18755
|
+
return { cfg, accountId: import_plugin_sdk2.DEFAULT_ACCOUNT_ID };
|
|
18756
18756
|
}
|
|
18757
18757
|
}
|
|
18758
18758
|
await prompter.note(
|
|
@@ -18806,7 +18806,7 @@ var quantumImOnboarding = {
|
|
|
18806
18806
|
}
|
|
18807
18807
|
};
|
|
18808
18808
|
await prompter.note("\u51ED\u636E\u5DF2\u4FDD\u5B58\uFF0C\u91CD\u542F gateway \u540E\u751F\u6548\u3002", "\u2713 \u914D\u7F6E\u5B8C\u6210");
|
|
18809
|
-
return { cfg: next, accountId:
|
|
18809
|
+
return { cfg: next, accountId: import_plugin_sdk2.DEFAULT_ACCOUNT_ID };
|
|
18810
18810
|
},
|
|
18811
18811
|
disable: (cfg) => ({
|
|
18812
18812
|
...cfg,
|
|
@@ -18888,7 +18888,7 @@ var quantumImPlugin = {
|
|
|
18888
18888
|
isConfigured: (account) => Boolean(account?.configured),
|
|
18889
18889
|
/** 返回账户状态描述 */
|
|
18890
18890
|
describeAccount: (_account) => ({
|
|
18891
|
-
accountId:
|
|
18891
|
+
accountId: import_plugin_sdk3.DEFAULT_ACCOUNT_ID,
|
|
18892
18892
|
enabled: true,
|
|
18893
18893
|
configured: true
|
|
18894
18894
|
})
|
|
@@ -18898,153 +18898,13 @@ var quantumImPlugin = {
|
|
|
18898
18898
|
},
|
|
18899
18899
|
outbound: quantumImOutbound,
|
|
18900
18900
|
setup: {
|
|
18901
|
-
resolveAccountId: () =>
|
|
18901
|
+
resolveAccountId: () => import_plugin_sdk3.DEFAULT_ACCOUNT_ID,
|
|
18902
18902
|
applyAccountConfig: ({ cfg }) => cfg
|
|
18903
18903
|
},
|
|
18904
|
-
// ── Guided Setup Wizard (OpenClaw 3.28+) ──
|
|
18905
|
-
// 交互式终端向导,让 `openclaw channels add` 引导用户配置凭据
|
|
18906
|
-
setupWizard: {
|
|
18907
|
-
channel: CHANNEL_ID,
|
|
18908
|
-
// 状态指示器
|
|
18909
|
-
status: {
|
|
18910
|
-
configuredLabel: "\u5DF2\u8FDE\u63A5 (Configured)",
|
|
18911
|
-
unconfiguredLabel: "\u672A\u914D\u7F6E (Not configured)",
|
|
18912
|
-
resolveConfigured: ({ cfg }) => {
|
|
18913
|
-
const channels = cfg?.channels;
|
|
18914
|
-
const channelCfg = channels?.[CHANNEL_ID];
|
|
18915
|
-
const accounts = channelCfg?.accounts;
|
|
18916
|
-
const defaultAccount = accounts?.default;
|
|
18917
|
-
return Boolean(defaultAccount?.appId && defaultAccount?.appSecret);
|
|
18918
|
-
}
|
|
18919
|
-
},
|
|
18920
|
-
// 凭据表单
|
|
18921
|
-
credentials: [
|
|
18922
|
-
{
|
|
18923
|
-
inputKey: "token",
|
|
18924
|
-
// 映射到 appId
|
|
18925
|
-
providerHint: "\u91CF\u5B50\u5BC6\u4FE1",
|
|
18926
|
-
credentialLabel: "\u5E94\u7528 ID (appId)",
|
|
18927
|
-
envPrompt: "\u4ECE\u73AF\u5883\u53D8\u91CF\u4E2D\u8BFB\u53D6 appId?",
|
|
18928
|
-
keepPrompt: "\u4FDD\u7559\u5F53\u524D appId?",
|
|
18929
|
-
inputPrompt: "\u8BF7\u8F93\u5165\u5E73\u53F0\u7533\u8BF7\u7684\u5E94\u7528 ID (appId)",
|
|
18930
|
-
inspect: ({ cfg, accountId }) => {
|
|
18931
|
-
const channels = cfg?.channels;
|
|
18932
|
-
const channelCfg = channels?.[CHANNEL_ID];
|
|
18933
|
-
const accounts = channelCfg?.accounts;
|
|
18934
|
-
const acct = accounts?.[accountId || "default"];
|
|
18935
|
-
const val = acct?.appId;
|
|
18936
|
-
return {
|
|
18937
|
-
accountConfigured: Boolean(val),
|
|
18938
|
-
hasConfiguredValue: Boolean(val),
|
|
18939
|
-
resolvedValue: val
|
|
18940
|
-
};
|
|
18941
|
-
},
|
|
18942
|
-
applySet: ({ cfg, accountId, resolvedValue }) => {
|
|
18943
|
-
const channels = cfg.channels ?? {};
|
|
18944
|
-
const channelCfg = channels[CHANNEL_ID] ?? {};
|
|
18945
|
-
const accounts = channelCfg.accounts ?? {};
|
|
18946
|
-
const acct = accounts[accountId || "default"] ?? {};
|
|
18947
|
-
return {
|
|
18948
|
-
...cfg,
|
|
18949
|
-
channels: {
|
|
18950
|
-
...channels,
|
|
18951
|
-
[CHANNEL_ID]: {
|
|
18952
|
-
...channelCfg,
|
|
18953
|
-
enabled: true,
|
|
18954
|
-
accounts: { ...accounts, [accountId || "default"]: { ...acct, appId: resolvedValue } }
|
|
18955
|
-
}
|
|
18956
|
-
}
|
|
18957
|
-
};
|
|
18958
|
-
}
|
|
18959
|
-
},
|
|
18960
|
-
{
|
|
18961
|
-
inputKey: "botToken",
|
|
18962
|
-
// 映射到 appSecret
|
|
18963
|
-
providerHint: "\u91CF\u5B50\u5BC6\u4FE1",
|
|
18964
|
-
credentialLabel: "\u5E94\u7528\u5BC6\u94A5 (appSecret)",
|
|
18965
|
-
envPrompt: "\u4ECE\u73AF\u5883\u53D8\u91CF\u4E2D\u8BFB\u53D6 appSecret?",
|
|
18966
|
-
keepPrompt: "\u4FDD\u7559\u5F53\u524D appSecret?",
|
|
18967
|
-
inputPrompt: "\u8BF7\u8F93\u5165\u4E0E appId \u914D\u5BF9\u7684\u5E94\u7528\u5BC6\u94A5 (appSecret)",
|
|
18968
|
-
inspect: ({ cfg, accountId }) => {
|
|
18969
|
-
const channels = cfg?.channels;
|
|
18970
|
-
const channelCfg = channels?.[CHANNEL_ID];
|
|
18971
|
-
const accounts = channelCfg?.accounts;
|
|
18972
|
-
const acct = accounts?.[accountId || "default"];
|
|
18973
|
-
const val = acct?.appSecret;
|
|
18974
|
-
return {
|
|
18975
|
-
accountConfigured: Boolean(val),
|
|
18976
|
-
hasConfiguredValue: Boolean(val),
|
|
18977
|
-
resolvedValue: val ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : void 0
|
|
18978
|
-
};
|
|
18979
|
-
},
|
|
18980
|
-
applySet: ({ cfg, accountId, resolvedValue }) => {
|
|
18981
|
-
const channels = cfg.channels ?? {};
|
|
18982
|
-
const channelCfg = channels[CHANNEL_ID] ?? {};
|
|
18983
|
-
const accounts = channelCfg.accounts ?? {};
|
|
18984
|
-
const acct = accounts[accountId || "default"] ?? {};
|
|
18985
|
-
return {
|
|
18986
|
-
...cfg,
|
|
18987
|
-
channels: {
|
|
18988
|
-
...channels,
|
|
18989
|
-
[CHANNEL_ID]: {
|
|
18990
|
-
...channelCfg,
|
|
18991
|
-
enabled: true,
|
|
18992
|
-
accounts: { ...accounts, [accountId || "default"]: { ...acct, appSecret: resolvedValue } }
|
|
18993
|
-
}
|
|
18994
|
-
}
|
|
18995
|
-
};
|
|
18996
|
-
}
|
|
18997
|
-
}
|
|
18998
|
-
],
|
|
18999
|
-
// 额外文本输入(可选字段)
|
|
19000
|
-
textInputs: [
|
|
19001
|
-
{
|
|
19002
|
-
inputKey: "accessToken",
|
|
19003
|
-
// 映射到 quantumAccount
|
|
19004
|
-
message: "\u91CF\u5B50\u8D26\u6237\u6807\u8BC6 (quantumAccount\uFF0C\u53EF\u9009\uFF0C\u586B\u5199\u540E\u542F\u7528\u91CF\u5B50\u52A0\u5BC6)",
|
|
19005
|
-
placeholder: "\u5982: 17100001111\uFF08\u7559\u7A7A\u5219\u4E0D\u542F\u7528\u52A0\u5BC6\uFF09",
|
|
19006
|
-
required: false,
|
|
19007
|
-
currentValue: ({ cfg, accountId }) => {
|
|
19008
|
-
const channels = cfg?.channels;
|
|
19009
|
-
const channelCfg = channels?.[CHANNEL_ID];
|
|
19010
|
-
const accounts = channelCfg?.accounts;
|
|
19011
|
-
const acct = accounts?.[accountId || "default"];
|
|
19012
|
-
return acct?.quantumAccount;
|
|
19013
|
-
},
|
|
19014
|
-
applySet: ({ cfg, accountId, value }) => {
|
|
19015
|
-
const channels = cfg.channels ?? {};
|
|
19016
|
-
const channelCfg = channels[CHANNEL_ID] ?? {};
|
|
19017
|
-
const accounts = channelCfg.accounts ?? {};
|
|
19018
|
-
const acct = accounts[accountId || "default"] ?? {};
|
|
19019
|
-
return {
|
|
19020
|
-
...cfg,
|
|
19021
|
-
channels: {
|
|
19022
|
-
...channels,
|
|
19023
|
-
[CHANNEL_ID]: {
|
|
19024
|
-
...channelCfg,
|
|
19025
|
-
accounts: {
|
|
19026
|
-
...accounts,
|
|
19027
|
-
[accountId || "default"]: {
|
|
19028
|
-
...acct,
|
|
19029
|
-
...value.trim() ? { quantumAccount: value.trim() } : {}
|
|
19030
|
-
}
|
|
19031
|
-
}
|
|
19032
|
-
}
|
|
19033
|
-
}
|
|
19034
|
-
};
|
|
19035
|
-
}
|
|
19036
|
-
}
|
|
19037
|
-
],
|
|
19038
|
-
// 完成提示
|
|
19039
|
-
completionNote: {
|
|
19040
|
-
title: "\u2713 \u91CF\u5B50\u5BC6\u4FE1\u914D\u7F6E\u5B8C\u6210",
|
|
19041
|
-
lines: ["\u51ED\u636E\u5DF2\u4FDD\u5B58\uFF0C\u91CD\u542F gateway \u540E\u751F\u6548\u3002"]
|
|
19042
|
-
}
|
|
19043
|
-
},
|
|
19044
18904
|
onboarding: quantumImOnboarding,
|
|
19045
18905
|
status: {
|
|
19046
18906
|
defaultRuntime: {
|
|
19047
|
-
accountId:
|
|
18907
|
+
accountId: import_plugin_sdk3.DEFAULT_ACCOUNT_ID,
|
|
19048
18908
|
running: false,
|
|
19049
18909
|
lastStartAt: null,
|
|
19050
18910
|
lastStopAt: null,
|
|
@@ -20882,44 +20742,16 @@ async function startPlugin(accountConfig, internalOverrides) {
|
|
|
20882
20742
|
}
|
|
20883
20743
|
};
|
|
20884
20744
|
}
|
|
20885
|
-
var plugin
|
|
20886
|
-
|
|
20887
|
-
|
|
20888
|
-
|
|
20889
|
-
|
|
20890
|
-
|
|
20891
|
-
|
|
20892
|
-
|
|
20893
|
-
plugin: quantumImPlugin,
|
|
20894
|
-
registerFull(api) {
|
|
20895
|
-
setPluginRuntime(api.runtime);
|
|
20896
|
-
log25.info("plugin registered (v3 path) \u2713");
|
|
20897
|
-
}
|
|
20898
|
-
});
|
|
20899
|
-
} else {
|
|
20900
|
-
plugin = {
|
|
20901
|
-
id: PLUGIN_ID,
|
|
20902
|
-
name: "\u91CF\u5B50\u5BC6\u4FE1",
|
|
20903
|
-
description: "Quantum-encrypted IM channel plugin",
|
|
20904
|
-
register(api) {
|
|
20905
|
-
setPluginRuntime(api.runtime);
|
|
20906
|
-
api.registerChannel({ plugin: quantumImPlugin });
|
|
20907
|
-
log25.info("plugin registered (v2 path) \u2713");
|
|
20908
|
-
}
|
|
20909
|
-
};
|
|
20745
|
+
var plugin = {
|
|
20746
|
+
id: PLUGIN_ID,
|
|
20747
|
+
name: "\u91CF\u5B50\u5BC6\u4FE1",
|
|
20748
|
+
description: "Quantum-encrypted IM channel plugin",
|
|
20749
|
+
register(api) {
|
|
20750
|
+
setPluginRuntime(api.runtime);
|
|
20751
|
+
api.registerChannel({ plugin: quantumImPlugin });
|
|
20752
|
+
log25.info("plugin registered \u2713");
|
|
20910
20753
|
}
|
|
20911
|
-
}
|
|
20912
|
-
plugin = {
|
|
20913
|
-
id: PLUGIN_ID,
|
|
20914
|
-
name: "\u91CF\u5B50\u5BC6\u4FE1",
|
|
20915
|
-
description: "Quantum-encrypted IM channel plugin",
|
|
20916
|
-
register(api) {
|
|
20917
|
-
setPluginRuntime(api.runtime);
|
|
20918
|
-
api.registerChannel({ plugin: quantumImPlugin });
|
|
20919
|
-
log25.info("plugin registered (fallback path) \u2713");
|
|
20920
|
-
}
|
|
20921
|
-
};
|
|
20922
|
-
}
|
|
20754
|
+
};
|
|
20923
20755
|
var index_default = plugin;
|
|
20924
20756
|
// Annotate the CommonJS export names for ESM import in node:
|
|
20925
20757
|
0 && (module.exports = {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { EventEmitter } from 'node:events';
|
|
3
2
|
import { ChannelPlugin } from 'openclaw/plugin-sdk';
|
|
3
|
+
import { EventEmitter } from 'node:events';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* openclaw-liangzimixin — 配置定义
|
|
@@ -124,6 +124,15 @@ interface PluginConfig extends InternalConfig {
|
|
|
124
124
|
*/
|
|
125
125
|
declare function buildPluginConfig(accountConfig: AccountConfig, internalOverrides?: Partial<InternalConfig>): PluginConfig;
|
|
126
126
|
|
|
127
|
+
/**
|
|
128
|
+
* openclaw-liangzimixin — ChannelPlugin 接口实现
|
|
129
|
+
*
|
|
130
|
+
* 插件与 OpenClaw SDK 的核心契约。
|
|
131
|
+
* gateway.startAccount 是整个插件的启动入口。
|
|
132
|
+
*/
|
|
133
|
+
|
|
134
|
+
declare const quantumImPlugin: ChannelPlugin;
|
|
135
|
+
|
|
127
136
|
/** 入站消息 — 从 IM 服务器接收到的消息,经解密后的结构 */
|
|
128
137
|
interface InboundMessage {
|
|
129
138
|
/** 消息唯一标识 (用于去重、回复引用) */
|
|
@@ -1072,15 +1081,6 @@ declare class PushQueue {
|
|
|
1072
1081
|
private clearTimer;
|
|
1073
1082
|
}
|
|
1074
1083
|
|
|
1075
|
-
/**
|
|
1076
|
-
* openclaw-liangzimixin — ChannelPlugin 接口实现
|
|
1077
|
-
*
|
|
1078
|
-
* 插件与 OpenClaw SDK 的核心契约。
|
|
1079
|
-
* gateway.startAccount 是整个插件的启动入口。
|
|
1080
|
-
*/
|
|
1081
|
-
|
|
1082
|
-
declare const quantumImPlugin: ChannelPlugin;
|
|
1083
|
-
|
|
1084
1084
|
/**
|
|
1085
1085
|
* openclaw-liangzimixin — JSON Schema 配置描述
|
|
1086
1086
|
*
|
|
@@ -1156,6 +1156,16 @@ interface PluginInstance {
|
|
|
1156
1156
|
* @param internalOverrides - 可选的内部配置覆盖
|
|
1157
1157
|
*/
|
|
1158
1158
|
declare function startPlugin(accountConfig: AccountConfig, internalOverrides?: Partial<InternalConfig>): Promise<PluginInstance>;
|
|
1159
|
-
declare
|
|
1159
|
+
declare const plugin: {
|
|
1160
|
+
id: string;
|
|
1161
|
+
name: string;
|
|
1162
|
+
description: string;
|
|
1163
|
+
register(api: {
|
|
1164
|
+
registerChannel: (opts: {
|
|
1165
|
+
plugin: typeof quantumImPlugin;
|
|
1166
|
+
}) => void;
|
|
1167
|
+
runtime: unknown;
|
|
1168
|
+
}): void;
|
|
1169
|
+
};
|
|
1160
1170
|
|
|
1161
1171
|
export { type AccountConfig, AccountConfigSchema, EncryptionStrategy, type InboundMessage, type OutboundMessage, type PluginConfig, type PluginInstance, QUANTUM_IM_CONFIG_JSON_SCHEMA, buildPluginConfig, plugin as default, quantumImPlugin, startPlugin };
|
|
@@ -3705,7 +3705,7 @@ var Logger = class {
|
|
|
3705
3705
|
constructor() {
|
|
3706
3706
|
const cfgLevel = (config_default.logLevel || "info").toLowerCase();
|
|
3707
3707
|
this._level = LEVELS[cfgLevel] ?? LEVELS.info;
|
|
3708
|
-
this._logDir = import_node_path2.default.join(
|
|
3708
|
+
this._logDir = import_node_path2.default.join(process.cwd(), "log");
|
|
3709
3709
|
this._logFile = import_node_path2.default.join(this._logDir, "app.log");
|
|
3710
3710
|
import_node_fs2.default.mkdirSync(this._logDir, { recursive: true });
|
|
3711
3711
|
}
|
|
@@ -3897,7 +3897,7 @@ var CacheStore = class {
|
|
|
3897
3897
|
* @param {number} [options.ttl] - Default TTL in milliseconds (0 = no expiration)
|
|
3898
3898
|
*/
|
|
3899
3899
|
constructor(options = {}) {
|
|
3900
|
-
this.cacheDir = import_node_path3.default.resolve(options.cacheDir || import_node_path3.default.join(
|
|
3900
|
+
this.cacheDir = import_node_path3.default.resolve(options.cacheDir || import_node_path3.default.join(process.cwd(), ".cache"));
|
|
3901
3901
|
this.defaultTTL = options.ttl || 0;
|
|
3902
3902
|
this._initialized = false;
|
|
3903
3903
|
}
|
|
@@ -4575,7 +4575,7 @@ async function getSpmInfo(kmsUrl) {
|
|
|
4575
4575
|
return response.data;
|
|
4576
4576
|
}
|
|
4577
4577
|
async function getKeyFile() {
|
|
4578
|
-
const keysDir = import_node_path4.default.join(
|
|
4578
|
+
const keysDir = import_node_path4.default.join(process.cwd(), ".cache", KEY_DIR);
|
|
4579
4579
|
logger_default.info("cacheDir", keysDir);
|
|
4580
4580
|
try {
|
|
4581
4581
|
const files = await import_promises2.default.readdir(keysDir);
|
|
@@ -4629,7 +4629,7 @@ async function scmAdd2(kmsUrl) {
|
|
|
4629
4629
|
const { headerCipher, fkCipher } = await qss_parse_fillkey_rep(JSON.stringify(response.data));
|
|
4630
4630
|
const combinedData = headerCipher + fkCipher;
|
|
4631
4631
|
const encryptedData = encryptWithDeviceKey(combinedData);
|
|
4632
|
-
const keysDir = import_node_path4.default.join(
|
|
4632
|
+
const keysDir = import_node_path4.default.join(process.cwd(), ".cache", KEY_DIR);
|
|
4633
4633
|
const filePath = import_node_path4.default.join(keysDir, spmInfo.spmId);
|
|
4634
4634
|
await import_promises2.default.mkdir(keysDir, { recursive: true });
|
|
4635
4635
|
try {
|
package/dist/setup-entry.cjs
CHANGED
|
@@ -3654,7 +3654,7 @@ __export(setup_entry_exports, {
|
|
|
3654
3654
|
module.exports = __toCommonJS(setup_entry_exports);
|
|
3655
3655
|
|
|
3656
3656
|
// src/channel/plugin.ts
|
|
3657
|
-
var
|
|
3657
|
+
var import_plugin_sdk3 = require("openclaw/plugin-sdk");
|
|
3658
3658
|
|
|
3659
3659
|
// src/file/media.ts
|
|
3660
3660
|
var path = __toESM(require("path"), 1);
|
|
@@ -3679,7 +3679,6 @@ var FileServiceError = class extends Error {
|
|
|
3679
3679
|
|
|
3680
3680
|
// src/constants.ts
|
|
3681
3681
|
var CHANNEL_ID = "liangzimixin";
|
|
3682
|
-
var PLUGIN_ID = CHANNEL_ID;
|
|
3683
3682
|
var LOG_PREFIX = CHANNEL_ID;
|
|
3684
3683
|
var TOKEN_STORE_DIR = `.${CHANNEL_ID}`;
|
|
3685
3684
|
function channelAddress(id) {
|
|
@@ -15201,42 +15200,42 @@ function extractDefs(ctx, schema) {
|
|
|
15201
15200
|
if (!root)
|
|
15202
15201
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
15203
15202
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
15204
|
-
for (const
|
|
15205
|
-
const id = ctx.metadataRegistry.get(
|
|
15203
|
+
for (const entry of ctx.seen.entries()) {
|
|
15204
|
+
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
15206
15205
|
if (id) {
|
|
15207
15206
|
const existing = idToSchema.get(id);
|
|
15208
|
-
if (existing && existing !==
|
|
15207
|
+
if (existing && existing !== entry[0]) {
|
|
15209
15208
|
throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
15210
15209
|
}
|
|
15211
|
-
idToSchema.set(id,
|
|
15210
|
+
idToSchema.set(id, entry[0]);
|
|
15212
15211
|
}
|
|
15213
15212
|
}
|
|
15214
|
-
const makeURI = (
|
|
15213
|
+
const makeURI = (entry) => {
|
|
15215
15214
|
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
15216
15215
|
if (ctx.external) {
|
|
15217
|
-
const externalId = ctx.external.registry.get(
|
|
15216
|
+
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
15218
15217
|
const uriGenerator = ctx.external.uri ?? ((id2) => id2);
|
|
15219
15218
|
if (externalId) {
|
|
15220
15219
|
return { ref: uriGenerator(externalId) };
|
|
15221
15220
|
}
|
|
15222
|
-
const id =
|
|
15223
|
-
|
|
15221
|
+
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
15222
|
+
entry[1].defId = id;
|
|
15224
15223
|
return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
|
|
15225
15224
|
}
|
|
15226
|
-
if (
|
|
15225
|
+
if (entry[1] === root) {
|
|
15227
15226
|
return { ref: "#" };
|
|
15228
15227
|
}
|
|
15229
15228
|
const uriPrefix = `#`;
|
|
15230
15229
|
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
15231
|
-
const defId =
|
|
15230
|
+
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
15232
15231
|
return { defId, ref: defUriPrefix + defId };
|
|
15233
15232
|
};
|
|
15234
|
-
const extractToDef = (
|
|
15235
|
-
if (
|
|
15233
|
+
const extractToDef = (entry) => {
|
|
15234
|
+
if (entry[1].schema.$ref) {
|
|
15236
15235
|
return;
|
|
15237
15236
|
}
|
|
15238
|
-
const seen =
|
|
15239
|
-
const { ref, defId } = makeURI(
|
|
15237
|
+
const seen = entry[1];
|
|
15238
|
+
const { ref, defId } = makeURI(entry);
|
|
15240
15239
|
seen.def = { ...seen.schema };
|
|
15241
15240
|
if (defId)
|
|
15242
15241
|
seen.defId = defId;
|
|
@@ -15247,8 +15246,8 @@ function extractDefs(ctx, schema) {
|
|
|
15247
15246
|
schema2.$ref = ref;
|
|
15248
15247
|
};
|
|
15249
15248
|
if (ctx.cycles === "throw") {
|
|
15250
|
-
for (const
|
|
15251
|
-
const seen =
|
|
15249
|
+
for (const entry of ctx.seen.entries()) {
|
|
15250
|
+
const seen = entry[1];
|
|
15252
15251
|
if (seen.cycle) {
|
|
15253
15252
|
throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
|
|
15254
15253
|
|
|
@@ -15256,31 +15255,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15256
15255
|
}
|
|
15257
15256
|
}
|
|
15258
15257
|
}
|
|
15259
|
-
for (const
|
|
15260
|
-
const seen =
|
|
15261
|
-
if (schema ===
|
|
15262
|
-
extractToDef(
|
|
15258
|
+
for (const entry of ctx.seen.entries()) {
|
|
15259
|
+
const seen = entry[1];
|
|
15260
|
+
if (schema === entry[0]) {
|
|
15261
|
+
extractToDef(entry);
|
|
15263
15262
|
continue;
|
|
15264
15263
|
}
|
|
15265
15264
|
if (ctx.external) {
|
|
15266
|
-
const ext = ctx.external.registry.get(
|
|
15267
|
-
if (schema !==
|
|
15268
|
-
extractToDef(
|
|
15265
|
+
const ext = ctx.external.registry.get(entry[0])?.id;
|
|
15266
|
+
if (schema !== entry[0] && ext) {
|
|
15267
|
+
extractToDef(entry);
|
|
15269
15268
|
continue;
|
|
15270
15269
|
}
|
|
15271
15270
|
}
|
|
15272
|
-
const id = ctx.metadataRegistry.get(
|
|
15271
|
+
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
15273
15272
|
if (id) {
|
|
15274
|
-
extractToDef(
|
|
15273
|
+
extractToDef(entry);
|
|
15275
15274
|
continue;
|
|
15276
15275
|
}
|
|
15277
15276
|
if (seen.cycle) {
|
|
15278
|
-
extractToDef(
|
|
15277
|
+
extractToDef(entry);
|
|
15279
15278
|
continue;
|
|
15280
15279
|
}
|
|
15281
15280
|
if (seen.count > 1) {
|
|
15282
15281
|
if (ctx.reused === "ref") {
|
|
15283
|
-
extractToDef(
|
|
15282
|
+
extractToDef(entry);
|
|
15284
15283
|
continue;
|
|
15285
15284
|
}
|
|
15286
15285
|
}
|
|
@@ -15352,8 +15351,8 @@ function finalize(ctx, schema) {
|
|
|
15352
15351
|
path: seen.path ?? []
|
|
15353
15352
|
});
|
|
15354
15353
|
};
|
|
15355
|
-
for (const
|
|
15356
|
-
flattenRef(
|
|
15354
|
+
for (const entry of [...ctx.seen.entries()].reverse()) {
|
|
15355
|
+
flattenRef(entry[0]);
|
|
15357
15356
|
}
|
|
15358
15357
|
const result = {};
|
|
15359
15358
|
if (ctx.target === "draft-2020-12") {
|
|
@@ -15373,8 +15372,8 @@ function finalize(ctx, schema) {
|
|
|
15373
15372
|
}
|
|
15374
15373
|
Object.assign(result, root.def ?? root.schema);
|
|
15375
15374
|
const defs = ctx.external?.defs ?? {};
|
|
15376
|
-
for (const
|
|
15377
|
-
const seen =
|
|
15375
|
+
for (const entry of ctx.seen.entries()) {
|
|
15376
|
+
const seen = entry[1];
|
|
15378
15377
|
if (seen.def && seen.defId) {
|
|
15379
15378
|
defs[seen.defId] = seen.def;
|
|
15380
15379
|
}
|
|
@@ -15993,8 +15992,8 @@ function toJSONSchema(input, params) {
|
|
|
15993
15992
|
const registry2 = input;
|
|
15994
15993
|
const ctx2 = initializeContext({ ...params, processors: allProcessors });
|
|
15995
15994
|
const defs = {};
|
|
15996
|
-
for (const
|
|
15997
|
-
const [_, schema] =
|
|
15995
|
+
for (const entry of registry2._idmap.entries()) {
|
|
15996
|
+
const [_, schema] = entry;
|
|
15998
15997
|
process2(schema, ctx2);
|
|
15999
15998
|
}
|
|
16000
15999
|
const schemas = {};
|
|
@@ -16004,8 +16003,8 @@ function toJSONSchema(input, params) {
|
|
|
16004
16003
|
defs
|
|
16005
16004
|
};
|
|
16006
16005
|
ctx2.external = external;
|
|
16007
|
-
for (const
|
|
16008
|
-
const [key, schema] =
|
|
16006
|
+
for (const entry of registry2._idmap.entries()) {
|
|
16007
|
+
const [key, schema] = entry;
|
|
16009
16008
|
extractDefs(ctx2, schema);
|
|
16010
16009
|
schemas[key] = finalize(ctx2, schema);
|
|
16011
16010
|
}
|
|
@@ -19790,9 +19789,6 @@ var PushQueue = class {
|
|
|
19790
19789
|
|
|
19791
19790
|
// src/runtime.ts
|
|
19792
19791
|
var runtime = null;
|
|
19793
|
-
function setPluginRuntime(next) {
|
|
19794
|
-
runtime = next;
|
|
19795
|
-
}
|
|
19796
19792
|
function getPluginRuntime() {
|
|
19797
19793
|
if (!runtime) {
|
|
19798
19794
|
throw new Error("PluginRuntime not initialized \u2014 ensure register() has been called");
|
|
@@ -19946,44 +19942,6 @@ async function startPlugin(accountConfig, internalOverrides) {
|
|
|
19946
19942
|
}
|
|
19947
19943
|
};
|
|
19948
19944
|
}
|
|
19949
|
-
var plugin;
|
|
19950
|
-
try {
|
|
19951
|
-
const sdk = require("openclaw/plugin-sdk");
|
|
19952
|
-
if (typeof sdk.defineChannelPluginEntry === "function") {
|
|
19953
|
-
plugin = sdk.defineChannelPluginEntry({
|
|
19954
|
-
id: PLUGIN_ID,
|
|
19955
|
-
name: "\u91CF\u5B50\u5BC6\u4FE1",
|
|
19956
|
-
description: "Quantum-encrypted IM channel plugin",
|
|
19957
|
-
plugin: quantumImPlugin,
|
|
19958
|
-
registerFull(api) {
|
|
19959
|
-
setPluginRuntime(api.runtime);
|
|
19960
|
-
log16.info("plugin registered (v3 path) \u2713");
|
|
19961
|
-
}
|
|
19962
|
-
});
|
|
19963
|
-
} else {
|
|
19964
|
-
plugin = {
|
|
19965
|
-
id: PLUGIN_ID,
|
|
19966
|
-
name: "\u91CF\u5B50\u5BC6\u4FE1",
|
|
19967
|
-
description: "Quantum-encrypted IM channel plugin",
|
|
19968
|
-
register(api) {
|
|
19969
|
-
setPluginRuntime(api.runtime);
|
|
19970
|
-
api.registerChannel({ plugin: quantumImPlugin });
|
|
19971
|
-
log16.info("plugin registered (v2 path) \u2713");
|
|
19972
|
-
}
|
|
19973
|
-
};
|
|
19974
|
-
}
|
|
19975
|
-
} catch {
|
|
19976
|
-
plugin = {
|
|
19977
|
-
id: PLUGIN_ID,
|
|
19978
|
-
name: "\u91CF\u5B50\u5BC6\u4FE1",
|
|
19979
|
-
description: "Quantum-encrypted IM channel plugin",
|
|
19980
|
-
register(api) {
|
|
19981
|
-
setPluginRuntime(api.runtime);
|
|
19982
|
-
api.registerChannel({ plugin: quantumImPlugin });
|
|
19983
|
-
log16.info("plugin registered (fallback path) \u2713");
|
|
19984
|
-
}
|
|
19985
|
-
};
|
|
19986
|
-
}
|
|
19987
19945
|
|
|
19988
19946
|
// src/message-handler/parser.ts
|
|
19989
19947
|
var log17 = createLogger("message-handler/parser");
|
|
@@ -20450,20 +20408,20 @@ var InboundPipeline = class {
|
|
|
20450
20408
|
};
|
|
20451
20409
|
|
|
20452
20410
|
// src/accounts.ts
|
|
20453
|
-
var
|
|
20411
|
+
var import_plugin_sdk = require("openclaw/plugin-sdk");
|
|
20454
20412
|
function getChannelConfig(cfg) {
|
|
20455
20413
|
return cfg?.channels?.[CHANNEL_ID];
|
|
20456
20414
|
}
|
|
20457
20415
|
function getAccountIds(cfg) {
|
|
20458
20416
|
const section = getChannelConfig(cfg);
|
|
20459
|
-
if (!section?.accounts) return [
|
|
20417
|
+
if (!section?.accounts) return [import_plugin_sdk.DEFAULT_ACCOUNT_ID];
|
|
20460
20418
|
return Object.keys(section.accounts);
|
|
20461
20419
|
}
|
|
20462
20420
|
function getDefaultAccountId(cfg) {
|
|
20463
|
-
return getAccountIds(cfg)[0] ??
|
|
20421
|
+
return getAccountIds(cfg)[0] ?? import_plugin_sdk.DEFAULT_ACCOUNT_ID;
|
|
20464
20422
|
}
|
|
20465
20423
|
function resolveAccount(cfg, accountId) {
|
|
20466
|
-
const requestedId = accountId ??
|
|
20424
|
+
const requestedId = accountId ?? import_plugin_sdk.DEFAULT_ACCOUNT_ID;
|
|
20467
20425
|
const section = getChannelConfig(cfg);
|
|
20468
20426
|
if (!section?.accounts?.[requestedId]) {
|
|
20469
20427
|
return {
|
|
@@ -20490,7 +20448,7 @@ function resolveAccount(cfg, accountId) {
|
|
|
20490
20448
|
}
|
|
20491
20449
|
|
|
20492
20450
|
// src/channel/onboarding.ts
|
|
20493
|
-
var
|
|
20451
|
+
var import_plugin_sdk2 = require("openclaw/plugin-sdk");
|
|
20494
20452
|
function getChannelSection(cfg) {
|
|
20495
20453
|
return cfg.channels?.[CHANNEL_ID];
|
|
20496
20454
|
}
|
|
@@ -20526,7 +20484,7 @@ var quantumImOnboarding = {
|
|
|
20526
20484
|
initialValue: false
|
|
20527
20485
|
});
|
|
20528
20486
|
if (!reconfigure) {
|
|
20529
|
-
return { cfg, accountId:
|
|
20487
|
+
return { cfg, accountId: import_plugin_sdk2.DEFAULT_ACCOUNT_ID };
|
|
20530
20488
|
}
|
|
20531
20489
|
}
|
|
20532
20490
|
await prompter.note(
|
|
@@ -20580,7 +20538,7 @@ var quantumImOnboarding = {
|
|
|
20580
20538
|
}
|
|
20581
20539
|
};
|
|
20582
20540
|
await prompter.note("\u51ED\u636E\u5DF2\u4FDD\u5B58\uFF0C\u91CD\u542F gateway \u540E\u751F\u6548\u3002", "\u2713 \u914D\u7F6E\u5B8C\u6210");
|
|
20583
|
-
return { cfg: next, accountId:
|
|
20541
|
+
return { cfg: next, accountId: import_plugin_sdk2.DEFAULT_ACCOUNT_ID };
|
|
20584
20542
|
},
|
|
20585
20543
|
disable: (cfg) => ({
|
|
20586
20544
|
...cfg,
|
|
@@ -20662,7 +20620,7 @@ var quantumImPlugin = {
|
|
|
20662
20620
|
isConfigured: (account) => Boolean(account?.configured),
|
|
20663
20621
|
/** 返回账户状态描述 */
|
|
20664
20622
|
describeAccount: (_account) => ({
|
|
20665
|
-
accountId:
|
|
20623
|
+
accountId: import_plugin_sdk3.DEFAULT_ACCOUNT_ID,
|
|
20666
20624
|
enabled: true,
|
|
20667
20625
|
configured: true
|
|
20668
20626
|
})
|
|
@@ -20672,153 +20630,13 @@ var quantumImPlugin = {
|
|
|
20672
20630
|
},
|
|
20673
20631
|
outbound: quantumImOutbound,
|
|
20674
20632
|
setup: {
|
|
20675
|
-
resolveAccountId: () =>
|
|
20633
|
+
resolveAccountId: () => import_plugin_sdk3.DEFAULT_ACCOUNT_ID,
|
|
20676
20634
|
applyAccountConfig: ({ cfg }) => cfg
|
|
20677
20635
|
},
|
|
20678
|
-
// ── Guided Setup Wizard (OpenClaw 3.28+) ──
|
|
20679
|
-
// 交互式终端向导,让 `openclaw channels add` 引导用户配置凭据
|
|
20680
|
-
setupWizard: {
|
|
20681
|
-
channel: CHANNEL_ID,
|
|
20682
|
-
// 状态指示器
|
|
20683
|
-
status: {
|
|
20684
|
-
configuredLabel: "\u5DF2\u8FDE\u63A5 (Configured)",
|
|
20685
|
-
unconfiguredLabel: "\u672A\u914D\u7F6E (Not configured)",
|
|
20686
|
-
resolveConfigured: ({ cfg }) => {
|
|
20687
|
-
const channels = cfg?.channels;
|
|
20688
|
-
const channelCfg = channels?.[CHANNEL_ID];
|
|
20689
|
-
const accounts = channelCfg?.accounts;
|
|
20690
|
-
const defaultAccount = accounts?.default;
|
|
20691
|
-
return Boolean(defaultAccount?.appId && defaultAccount?.appSecret);
|
|
20692
|
-
}
|
|
20693
|
-
},
|
|
20694
|
-
// 凭据表单
|
|
20695
|
-
credentials: [
|
|
20696
|
-
{
|
|
20697
|
-
inputKey: "token",
|
|
20698
|
-
// 映射到 appId
|
|
20699
|
-
providerHint: "\u91CF\u5B50\u5BC6\u4FE1",
|
|
20700
|
-
credentialLabel: "\u5E94\u7528 ID (appId)",
|
|
20701
|
-
envPrompt: "\u4ECE\u73AF\u5883\u53D8\u91CF\u4E2D\u8BFB\u53D6 appId?",
|
|
20702
|
-
keepPrompt: "\u4FDD\u7559\u5F53\u524D appId?",
|
|
20703
|
-
inputPrompt: "\u8BF7\u8F93\u5165\u5E73\u53F0\u7533\u8BF7\u7684\u5E94\u7528 ID (appId)",
|
|
20704
|
-
inspect: ({ cfg, accountId }) => {
|
|
20705
|
-
const channels = cfg?.channels;
|
|
20706
|
-
const channelCfg = channels?.[CHANNEL_ID];
|
|
20707
|
-
const accounts = channelCfg?.accounts;
|
|
20708
|
-
const acct = accounts?.[accountId || "default"];
|
|
20709
|
-
const val = acct?.appId;
|
|
20710
|
-
return {
|
|
20711
|
-
accountConfigured: Boolean(val),
|
|
20712
|
-
hasConfiguredValue: Boolean(val),
|
|
20713
|
-
resolvedValue: val
|
|
20714
|
-
};
|
|
20715
|
-
},
|
|
20716
|
-
applySet: ({ cfg, accountId, resolvedValue }) => {
|
|
20717
|
-
const channels = cfg.channels ?? {};
|
|
20718
|
-
const channelCfg = channels[CHANNEL_ID] ?? {};
|
|
20719
|
-
const accounts = channelCfg.accounts ?? {};
|
|
20720
|
-
const acct = accounts[accountId || "default"] ?? {};
|
|
20721
|
-
return {
|
|
20722
|
-
...cfg,
|
|
20723
|
-
channels: {
|
|
20724
|
-
...channels,
|
|
20725
|
-
[CHANNEL_ID]: {
|
|
20726
|
-
...channelCfg,
|
|
20727
|
-
enabled: true,
|
|
20728
|
-
accounts: { ...accounts, [accountId || "default"]: { ...acct, appId: resolvedValue } }
|
|
20729
|
-
}
|
|
20730
|
-
}
|
|
20731
|
-
};
|
|
20732
|
-
}
|
|
20733
|
-
},
|
|
20734
|
-
{
|
|
20735
|
-
inputKey: "botToken",
|
|
20736
|
-
// 映射到 appSecret
|
|
20737
|
-
providerHint: "\u91CF\u5B50\u5BC6\u4FE1",
|
|
20738
|
-
credentialLabel: "\u5E94\u7528\u5BC6\u94A5 (appSecret)",
|
|
20739
|
-
envPrompt: "\u4ECE\u73AF\u5883\u53D8\u91CF\u4E2D\u8BFB\u53D6 appSecret?",
|
|
20740
|
-
keepPrompt: "\u4FDD\u7559\u5F53\u524D appSecret?",
|
|
20741
|
-
inputPrompt: "\u8BF7\u8F93\u5165\u4E0E appId \u914D\u5BF9\u7684\u5E94\u7528\u5BC6\u94A5 (appSecret)",
|
|
20742
|
-
inspect: ({ cfg, accountId }) => {
|
|
20743
|
-
const channels = cfg?.channels;
|
|
20744
|
-
const channelCfg = channels?.[CHANNEL_ID];
|
|
20745
|
-
const accounts = channelCfg?.accounts;
|
|
20746
|
-
const acct = accounts?.[accountId || "default"];
|
|
20747
|
-
const val = acct?.appSecret;
|
|
20748
|
-
return {
|
|
20749
|
-
accountConfigured: Boolean(val),
|
|
20750
|
-
hasConfiguredValue: Boolean(val),
|
|
20751
|
-
resolvedValue: val ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : void 0
|
|
20752
|
-
};
|
|
20753
|
-
},
|
|
20754
|
-
applySet: ({ cfg, accountId, resolvedValue }) => {
|
|
20755
|
-
const channels = cfg.channels ?? {};
|
|
20756
|
-
const channelCfg = channels[CHANNEL_ID] ?? {};
|
|
20757
|
-
const accounts = channelCfg.accounts ?? {};
|
|
20758
|
-
const acct = accounts[accountId || "default"] ?? {};
|
|
20759
|
-
return {
|
|
20760
|
-
...cfg,
|
|
20761
|
-
channels: {
|
|
20762
|
-
...channels,
|
|
20763
|
-
[CHANNEL_ID]: {
|
|
20764
|
-
...channelCfg,
|
|
20765
|
-
enabled: true,
|
|
20766
|
-
accounts: { ...accounts, [accountId || "default"]: { ...acct, appSecret: resolvedValue } }
|
|
20767
|
-
}
|
|
20768
|
-
}
|
|
20769
|
-
};
|
|
20770
|
-
}
|
|
20771
|
-
}
|
|
20772
|
-
],
|
|
20773
|
-
// 额外文本输入(可选字段)
|
|
20774
|
-
textInputs: [
|
|
20775
|
-
{
|
|
20776
|
-
inputKey: "accessToken",
|
|
20777
|
-
// 映射到 quantumAccount
|
|
20778
|
-
message: "\u91CF\u5B50\u8D26\u6237\u6807\u8BC6 (quantumAccount\uFF0C\u53EF\u9009\uFF0C\u586B\u5199\u540E\u542F\u7528\u91CF\u5B50\u52A0\u5BC6)",
|
|
20779
|
-
placeholder: "\u5982: 17100001111\uFF08\u7559\u7A7A\u5219\u4E0D\u542F\u7528\u52A0\u5BC6\uFF09",
|
|
20780
|
-
required: false,
|
|
20781
|
-
currentValue: ({ cfg, accountId }) => {
|
|
20782
|
-
const channels = cfg?.channels;
|
|
20783
|
-
const channelCfg = channels?.[CHANNEL_ID];
|
|
20784
|
-
const accounts = channelCfg?.accounts;
|
|
20785
|
-
const acct = accounts?.[accountId || "default"];
|
|
20786
|
-
return acct?.quantumAccount;
|
|
20787
|
-
},
|
|
20788
|
-
applySet: ({ cfg, accountId, value }) => {
|
|
20789
|
-
const channels = cfg.channels ?? {};
|
|
20790
|
-
const channelCfg = channels[CHANNEL_ID] ?? {};
|
|
20791
|
-
const accounts = channelCfg.accounts ?? {};
|
|
20792
|
-
const acct = accounts[accountId || "default"] ?? {};
|
|
20793
|
-
return {
|
|
20794
|
-
...cfg,
|
|
20795
|
-
channels: {
|
|
20796
|
-
...channels,
|
|
20797
|
-
[CHANNEL_ID]: {
|
|
20798
|
-
...channelCfg,
|
|
20799
|
-
accounts: {
|
|
20800
|
-
...accounts,
|
|
20801
|
-
[accountId || "default"]: {
|
|
20802
|
-
...acct,
|
|
20803
|
-
...value.trim() ? { quantumAccount: value.trim() } : {}
|
|
20804
|
-
}
|
|
20805
|
-
}
|
|
20806
|
-
}
|
|
20807
|
-
}
|
|
20808
|
-
};
|
|
20809
|
-
}
|
|
20810
|
-
}
|
|
20811
|
-
],
|
|
20812
|
-
// 完成提示
|
|
20813
|
-
completionNote: {
|
|
20814
|
-
title: "\u2713 \u91CF\u5B50\u5BC6\u4FE1\u914D\u7F6E\u5B8C\u6210",
|
|
20815
|
-
lines: ["\u51ED\u636E\u5DF2\u4FDD\u5B58\uFF0C\u91CD\u542F gateway \u540E\u751F\u6548\u3002"]
|
|
20816
|
-
}
|
|
20817
|
-
},
|
|
20818
20636
|
onboarding: quantumImOnboarding,
|
|
20819
20637
|
status: {
|
|
20820
20638
|
defaultRuntime: {
|
|
20821
|
-
accountId:
|
|
20639
|
+
accountId: import_plugin_sdk3.DEFAULT_ACCOUNT_ID,
|
|
20822
20640
|
running: false,
|
|
20823
20641
|
lastStartAt: null,
|
|
20824
20642
|
lastStopAt: null,
|
|
@@ -20912,15 +20730,6 @@ var quantumImPlugin = {
|
|
|
20912
20730
|
};
|
|
20913
20731
|
|
|
20914
20732
|
// src/setup-entry.ts
|
|
20915
|
-
var
|
|
20916
|
-
|
|
20917
|
-
|
|
20918
|
-
if (typeof sdk.defineSetupPluginEntry === "function") {
|
|
20919
|
-
entry = sdk.defineSetupPluginEntry(quantumImPlugin);
|
|
20920
|
-
} else {
|
|
20921
|
-
entry = { plugin: quantumImPlugin };
|
|
20922
|
-
}
|
|
20923
|
-
} catch {
|
|
20924
|
-
entry = { plugin: quantumImPlugin };
|
|
20925
|
-
}
|
|
20926
|
-
var setup_entry_default = entry;
|
|
20733
|
+
var setup_entry_default = {
|
|
20734
|
+
plugin: quantumImPlugin
|
|
20735
|
+
};
|
package/dist/setup-entry.d.cts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
+
import * as openclaw_plugin_sdk from 'openclaw/plugin-sdk';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* openclaw-liangzimixin — Setup 入口
|
|
3
5
|
*
|
|
4
6
|
* 轻量级入口,用于 `openclaw configure/onboard`。
|
|
5
|
-
* 只注册 channel plugin 对象(含
|
|
7
|
+
* 只注册 channel plugin 对象(含 onboarding adapter),
|
|
6
8
|
* 不加载完整的运行时依赖(crypto、auth、transport 等)。
|
|
7
|
-
*
|
|
8
|
-
* 兼容策略:
|
|
9
|
-
* v3.28+ → 使用 defineSetupPluginEntry() — CLI 从 plugin.setupWizard 读取向导
|
|
10
|
-
* v3.22+ → defineSetupPluginEntry(plugin)
|
|
11
|
-
* v2.x → fallback 到 { plugin } 导出
|
|
12
9
|
*/
|
|
13
|
-
declare
|
|
10
|
+
declare const _default: {
|
|
11
|
+
plugin: openclaw_plugin_sdk.ChannelPlugin<unknown>;
|
|
12
|
+
};
|
|
14
13
|
|
|
15
|
-
export {
|
|
14
|
+
export { _default as default };
|
package/openclaw.plugin.json
CHANGED
|
@@ -4,6 +4,36 @@
|
|
|
4
4
|
"configSchema": {
|
|
5
5
|
"type": "object",
|
|
6
6
|
"additionalProperties": false,
|
|
7
|
-
"properties": {
|
|
7
|
+
"properties": {
|
|
8
|
+
"appId": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"title": "应用 ID",
|
|
11
|
+
"description": "在平台申请的应用标识,用于 API 鉴权和 WS 连接",
|
|
12
|
+
"minLength": 1
|
|
13
|
+
},
|
|
14
|
+
"appSecret": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"title": "应用密钥",
|
|
17
|
+
"description": "与 appId 配对,用于签名和身份校验",
|
|
18
|
+
"minLength": 1
|
|
19
|
+
},
|
|
20
|
+
"quantumAccount": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"title": "量子账户标识(可选)",
|
|
23
|
+
"description": "绑定的服务账号/租户 ID,填写后启用量子加密模块"
|
|
24
|
+
},
|
|
25
|
+
"botUserId": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"title": "Bot 用户 ID",
|
|
28
|
+
"description": "用于 anti-loop 检查,防止处理自己发送的消息"
|
|
29
|
+
},
|
|
30
|
+
"env": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"title": "部署环境",
|
|
33
|
+
"description": "选择对接的服务器环境。staging = 联调环境,production = 线上环境",
|
|
34
|
+
"enum": ["staging", "production"],
|
|
35
|
+
"default": "production"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
8
38
|
}
|
|
9
39
|
}
|