liangzimixin 0.3.30 → 0.3.31

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 CHANGED
@@ -18759,8 +18759,7 @@ var quantumImOnboarding = {
18759
18759
  [
18760
18760
  "\u8BF7\u51C6\u5907\u4EE5\u4E0B\u4FE1\u606F:",
18761
18761
  " 1. \u5E73\u53F0\u7533\u8BF7\u7684 appId \u548C appSecret",
18762
- " 2. \u91CF\u5B50\u52A0\u5BC6\u670D\u52A1\u7684 appId",
18763
- " 3. \u7528\u4E8E\u4FDD\u62A4\u672C\u5730\u6570\u636E\u7684 PIN \u53E3\u4EE4",
18762
+ " 2. (\u53EF\u9009) \u91CF\u5B50\u52A0\u5BC6\u670D\u52A1\u7684\u8D26\u6237\u6807\u8BC6",
18764
18763
  "",
18765
18764
  "\u5982\u6709\u7591\u95EE\u8BF7\u8054\u7CFB\u5E73\u53F0\u7BA1\u7406\u5458\u83B7\u53D6\u3002"
18766
18765
  ].join("\n"),
@@ -18776,11 +18775,23 @@ var quantumImOnboarding = {
18776
18775
  initialValue: existing.appSecret ?? void 0,
18777
18776
  validate: required2
18778
18777
  });
18779
- const quantumAccount = await prompter.text({
18780
- message: "\u91CF\u5B50\u8D26\u6237\u6807\u8BC6 (quantumAccount\uFF0C\u53EF\u9009\uFF0C\u586B\u5199\u540E\u542F\u7528\u91CF\u5B50\u52A0\u5BC6)",
18781
- placeholder: "\u5982: 17100001111\uFF08\u7559\u7A7A\u5219\u4E0D\u542F\u7528\u52A0\u5BC6\uFF09",
18782
- initialValue: existing.quantumAccount ?? void 0
18778
+ const encryptionMode = await prompter.select({
18779
+ message: "\u6D88\u606F\u4F20\u8F93\u6A21\u5F0F",
18780
+ options: [
18781
+ { value: "plain", label: "\u660E\u6587\u6A21\u5F0F\uFF08\u4E0D\u52A0\u5BC6\uFF09", hint: "\u9002\u5408\u6D4B\u8BD5\u6216\u4E0D\u9700\u8981\u52A0\u5BC6\u7684\u573A\u666F" },
18782
+ { value: "quantum", label: "\u91CF\u5B50\u52A0\u5BC6\u6A21\u5F0F", hint: "\u9700\u8981\u91CF\u5B50\u8D26\u6237\u6807\u8BC6" }
18783
+ ],
18784
+ initialValue: existing.quantumAccount?.trim() ? "quantum" : "plain"
18783
18785
  });
18786
+ let quantumAccount = "";
18787
+ if (encryptionMode === "quantum") {
18788
+ quantumAccount = await prompter.text({
18789
+ message: "\u91CF\u5B50\u8D26\u6237\u6807\u8BC6 (quantumAccount)",
18790
+ placeholder: "\u5982: 17100001111",
18791
+ initialValue: existing.quantumAccount ?? void 0,
18792
+ validate: required2
18793
+ });
18794
+ }
18784
18795
  const channels = cfg.channels ?? {};
18785
18796
  const channelCfg = channels[CHANNEL_ID] ?? {};
18786
18797
  const accounts = channelCfg.accounts ?? {};
@@ -18899,7 +18910,60 @@ var quantumImPlugin = {
18899
18910
  outbound: quantumImOutbound,
18900
18911
  setup: {
18901
18912
  resolveAccountId: () => import_plugin_sdk3.DEFAULT_ACCOUNT_ID,
18902
- applyAccountConfig: ({ cfg }) => cfg
18913
+ /**
18914
+ * 校验 CLI 输入 — 确保必填字段已提供。
18915
+ *
18916
+ * 映射关系:
18917
+ * --token → appId
18918
+ * --password → appSecret
18919
+ * --user-id → quantumAccount (可选)
18920
+ */
18921
+ validateInput: ({ input }) => {
18922
+ if (!input.token || !input.token.trim()) {
18923
+ return "appId is required. Use --token <appId>.";
18924
+ }
18925
+ if (!input.password || !input.password.trim()) {
18926
+ return "appSecret is required. Use --password <appSecret>.";
18927
+ }
18928
+ return null;
18929
+ },
18930
+ /**
18931
+ * 将 CLI 选项写入 channels.liangzimixin.accounts.default。
18932
+ *
18933
+ * 用法:
18934
+ * openclaw channels add --channel liangzimixin \
18935
+ * --token <appId> \
18936
+ * --password <appSecret> \
18937
+ * --user-id <quantumAccount>
18938
+ */
18939
+ applyAccountConfig: ({ cfg, accountId, input }) => {
18940
+ const appId = input.token?.trim();
18941
+ const appSecret = input.password?.trim();
18942
+ const quantumAccount = input.userId?.trim();
18943
+ const channels = cfg.channels ?? {};
18944
+ const channelCfg = channels[CHANNEL_ID] ?? {};
18945
+ const accounts = channelCfg.accounts ?? {};
18946
+ const existing = accounts[accountId] ?? {};
18947
+ return {
18948
+ ...cfg,
18949
+ channels: {
18950
+ ...channels,
18951
+ [CHANNEL_ID]: {
18952
+ ...channelCfg,
18953
+ enabled: true,
18954
+ accounts: {
18955
+ ...accounts,
18956
+ [accountId]: {
18957
+ ...existing,
18958
+ ...appId ? { appId } : {},
18959
+ ...appSecret ? { appSecret } : {},
18960
+ ...quantumAccount ? { quantumAccount } : {}
18961
+ }
18962
+ }
18963
+ }
18964
+ }
18965
+ };
18966
+ }
18903
18967
  },
18904
18968
  onboarding: quantumImOnboarding,
18905
18969
  status: {
@@ -20491,8 +20491,7 @@ var quantumImOnboarding = {
20491
20491
  [
20492
20492
  "\u8BF7\u51C6\u5907\u4EE5\u4E0B\u4FE1\u606F:",
20493
20493
  " 1. \u5E73\u53F0\u7533\u8BF7\u7684 appId \u548C appSecret",
20494
- " 2. \u91CF\u5B50\u52A0\u5BC6\u670D\u52A1\u7684 appId",
20495
- " 3. \u7528\u4E8E\u4FDD\u62A4\u672C\u5730\u6570\u636E\u7684 PIN \u53E3\u4EE4",
20494
+ " 2. (\u53EF\u9009) \u91CF\u5B50\u52A0\u5BC6\u670D\u52A1\u7684\u8D26\u6237\u6807\u8BC6",
20496
20495
  "",
20497
20496
  "\u5982\u6709\u7591\u95EE\u8BF7\u8054\u7CFB\u5E73\u53F0\u7BA1\u7406\u5458\u83B7\u53D6\u3002"
20498
20497
  ].join("\n"),
@@ -20508,11 +20507,23 @@ var quantumImOnboarding = {
20508
20507
  initialValue: existing.appSecret ?? void 0,
20509
20508
  validate: required2
20510
20509
  });
20511
- const quantumAccount = await prompter.text({
20512
- message: "\u91CF\u5B50\u8D26\u6237\u6807\u8BC6 (quantumAccount\uFF0C\u53EF\u9009\uFF0C\u586B\u5199\u540E\u542F\u7528\u91CF\u5B50\u52A0\u5BC6)",
20513
- placeholder: "\u5982: 17100001111\uFF08\u7559\u7A7A\u5219\u4E0D\u542F\u7528\u52A0\u5BC6\uFF09",
20514
- initialValue: existing.quantumAccount ?? void 0
20510
+ const encryptionMode = await prompter.select({
20511
+ message: "\u6D88\u606F\u4F20\u8F93\u6A21\u5F0F",
20512
+ options: [
20513
+ { value: "plain", label: "\u660E\u6587\u6A21\u5F0F\uFF08\u4E0D\u52A0\u5BC6\uFF09", hint: "\u9002\u5408\u6D4B\u8BD5\u6216\u4E0D\u9700\u8981\u52A0\u5BC6\u7684\u573A\u666F" },
20514
+ { value: "quantum", label: "\u91CF\u5B50\u52A0\u5BC6\u6A21\u5F0F", hint: "\u9700\u8981\u91CF\u5B50\u8D26\u6237\u6807\u8BC6" }
20515
+ ],
20516
+ initialValue: existing.quantumAccount?.trim() ? "quantum" : "plain"
20515
20517
  });
20518
+ let quantumAccount = "";
20519
+ if (encryptionMode === "quantum") {
20520
+ quantumAccount = await prompter.text({
20521
+ message: "\u91CF\u5B50\u8D26\u6237\u6807\u8BC6 (quantumAccount)",
20522
+ placeholder: "\u5982: 17100001111",
20523
+ initialValue: existing.quantumAccount ?? void 0,
20524
+ validate: required2
20525
+ });
20526
+ }
20516
20527
  const channels = cfg.channels ?? {};
20517
20528
  const channelCfg = channels[CHANNEL_ID] ?? {};
20518
20529
  const accounts = channelCfg.accounts ?? {};
@@ -20631,7 +20642,60 @@ var quantumImPlugin = {
20631
20642
  outbound: quantumImOutbound,
20632
20643
  setup: {
20633
20644
  resolveAccountId: () => import_plugin_sdk3.DEFAULT_ACCOUNT_ID,
20634
- applyAccountConfig: ({ cfg }) => cfg
20645
+ /**
20646
+ * 校验 CLI 输入 — 确保必填字段已提供。
20647
+ *
20648
+ * 映射关系:
20649
+ * --token → appId
20650
+ * --password → appSecret
20651
+ * --user-id → quantumAccount (可选)
20652
+ */
20653
+ validateInput: ({ input }) => {
20654
+ if (!input.token || !input.token.trim()) {
20655
+ return "appId is required. Use --token <appId>.";
20656
+ }
20657
+ if (!input.password || !input.password.trim()) {
20658
+ return "appSecret is required. Use --password <appSecret>.";
20659
+ }
20660
+ return null;
20661
+ },
20662
+ /**
20663
+ * 将 CLI 选项写入 channels.liangzimixin.accounts.default。
20664
+ *
20665
+ * 用法:
20666
+ * openclaw channels add --channel liangzimixin \
20667
+ * --token <appId> \
20668
+ * --password <appSecret> \
20669
+ * --user-id <quantumAccount>
20670
+ */
20671
+ applyAccountConfig: ({ cfg, accountId, input }) => {
20672
+ const appId = input.token?.trim();
20673
+ const appSecret = input.password?.trim();
20674
+ const quantumAccount = input.userId?.trim();
20675
+ const channels = cfg.channels ?? {};
20676
+ const channelCfg = channels[CHANNEL_ID] ?? {};
20677
+ const accounts = channelCfg.accounts ?? {};
20678
+ const existing = accounts[accountId] ?? {};
20679
+ return {
20680
+ ...cfg,
20681
+ channels: {
20682
+ ...channels,
20683
+ [CHANNEL_ID]: {
20684
+ ...channelCfg,
20685
+ enabled: true,
20686
+ accounts: {
20687
+ ...accounts,
20688
+ [accountId]: {
20689
+ ...existing,
20690
+ ...appId ? { appId } : {},
20691
+ ...appSecret ? { appSecret } : {},
20692
+ ...quantumAccount ? { quantumAccount } : {}
20693
+ }
20694
+ }
20695
+ }
20696
+ }
20697
+ };
20698
+ }
20635
20699
  },
20636
20700
  onboarding: quantumImOnboarding,
20637
20701
  status: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "liangzimixin",
3
- "version": "0.3.30",
3
+ "version": "0.3.31",
4
4
  "description": "Quantum-encrypted IM channel plugin for OpenClaw",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",