@zhin.js/adapter-weixin-ilink 1.1.16 → 1.1.18

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/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # @zhin.js/adapter-weixin-ilink
2
2
 
3
+ ## 1.1.18
4
+
5
+ ### Patch Changes
6
+
7
+ - 6345a38: feat(adapters): add per-adapter Console pages
8
+
9
+ Every platform adapter now ships a `pages/index` Console page backed by a shared
10
+ `createAdapterConsolePage` component and `createAdapterConsoleRpc` server helper:
11
+
12
+ - See running endpoints, test connectivity, and manage
13
+ `plugins.<adapter>.endpoints` (add/remove writes `.env` references) from the
14
+ Console instead of chat commands.
15
+ - Surface LoginAssist pending tasks (QR / slider / SMS / device) so ICQQ login no
16
+ longer requires the terminal.
17
+ - QQ moves its QR binding flow (`qq endpoint add`) into Console actions with
18
+ public/private selection.
19
+ - Pages are permission-gated by `<adapter>:read`; writes need `<adapter>:write`.
20
+
21
+ - Updated dependencies [6345a38]
22
+ - Updated dependencies [ff3efe7]
23
+ - Updated dependencies [c58c589]
24
+ - @zhin.js/adapter@1.1.25
25
+ - @zhin.js/client@1.1.21
26
+ - @zhin.js/core@1.1.53
27
+ - @zhin.js/im-contract@1.1.9
28
+
29
+ ## 1.1.17
30
+
31
+ ### Patch Changes
32
+
33
+ - Updated dependencies [f67883e]
34
+ - Updated dependencies [e23cabc]
35
+ - Updated dependencies [4d728c0]
36
+ - Updated dependencies [24a2b71]
37
+ - Updated dependencies [d0e1fac]
38
+ - Updated dependencies [3771f7a]
39
+ - Updated dependencies [4f96ad5]
40
+ - @zhin.js/core@1.1.52
41
+ - @zhin.js/adapter@1.1.24
42
+ - @zhin.js/im-contract@1.1.8
43
+
3
44
  ## 1.1.16
4
45
 
5
46
  ### Patch Changes
package/README.md CHANGED
@@ -66,6 +66,16 @@ data/weixin-ilink/<id>/credentials.json
66
66
  - **出站**:先单独发文本,再发纯媒体(不带 caption)
67
67
  - **入站**:文字与媒体路径写入同一条 gateway `content` 文本
68
68
 
69
+ ## Console 页面
70
+
71
+ 启动后打开 Console 的「微信 iLink」页(地址 `/weixin-ilink`),可以:
72
+
73
+ - 查看运行中的连接、点「测试连接」做连通性诊断;
74
+ - 增删 `plugins.weixin-ilink.endpoints`(凭据写入 `.env`,配置里只保留 `${ENV}` 引用);
75
+ - 如果适配器要求登录,页面会显示 LoginAssist 的扫码 / 滑块 / 设备确认待办;
76
+
77
+ 读取需要 `weixin-ilink:read`,写操作需要 `weixin-ilink:write`;管理员 full token 不受限。页面里的「添加 endpoint」等价于原来的 `weixin-ilink endpoint add`。
78
+
69
79
  ## 故障排查
70
80
 
71
81
  | 现象 | 可能原因 |
@@ -0,0 +1,12 @@
1
+ /**
2
+ * 微信 iLink Console 页面元数据(浏览器与服务端共享;不要在这里 import 服务端代码)。
3
+ */
4
+ import type { AdapterConsoleField } from 'zhin.js/adapter';
5
+ export declare const weixinIlinkConsoleSpec: {
6
+ readonly adapterKey: "weixin-ilink";
7
+ readonly adapterDisplayName: "微信 iLink";
8
+ readonly fields: readonly AdapterConsoleField[];
9
+ readonly docsUrl: "https://zhin.js.org/adapters/weixin-ilink";
10
+ readonly readPermission: "weixin-ilink:read";
11
+ readonly writePermission: "weixin-ilink:write";
12
+ };
@@ -0,0 +1,10 @@
1
+ export const weixinIlinkConsoleSpec = {
2
+ adapterKey: 'weixin-ilink',
3
+ adapterDisplayName: '微信 iLink',
4
+ fields: [
5
+ { key: 'botToken', required: true, env: true, description: 'iLink bot token' },
6
+ ],
7
+ docsUrl: 'https://zhin.js.org/adapters/weixin-ilink',
8
+ readPermission: 'weixin-ilink:read',
9
+ writePermission: 'weixin-ilink:write',
10
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 微信 iLink Console RPC:运行状态 + endpoint 增删(原 `weixin-ilink endpoint` 聊天命令)。
3
+ *
4
+ * 页面绑定 `pages/index`,读取 / 写入分别要求 `<adapter>:read` / `<adapter>:write`。
5
+ */
6
+ import { type AdapterConsoleResources } from 'zhin.js/adapter';
7
+ import type { PluginConsoleRpc } from 'zhin.js';
8
+ export declare function createWeixinIlinkConsoleRpc(resources: AdapterConsoleResources, getConfig: () => unknown): PluginConsoleRpc;
package/lib/console.js ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * 微信 iLink Console RPC:运行状态 + endpoint 增删(原 `weixin-ilink endpoint` 聊天命令)。
3
+ *
4
+ * 页面绑定 `pages/index`,读取 / 写入分别要求 `<adapter>:read` / `<adapter>:write`。
5
+ */
6
+ import { createAdapterConsoleRpc } from 'zhin.js/adapter';
7
+ import { weixinIlinkRuntimeStateToken } from './weixin-ilink-runtime-state.js';
8
+ import { weixinIlinkConsoleSpec } from './console-spec.js';
9
+ export function createWeixinIlinkConsoleRpc(resources, getConfig) {
10
+ const state = resources.use(weixinIlinkRuntimeStateToken);
11
+ return createAdapterConsoleRpc({
12
+ ...weixinIlinkConsoleSpec,
13
+ running: () => state.endpoints.values(),
14
+ getConfig,
15
+ }, resources);
16
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/adapter-weixin-ilink",
3
- "version": "1.1.16",
3
+ "version": "1.1.18",
4
4
  "type": "module",
5
5
  "description": "Zhin.js Weixin iLink (ClawBot) adapter for Plugin Runtime (long-poll)",
6
6
  "main": "./lib/index.js",
@@ -29,6 +29,7 @@
29
29
  "files": [
30
30
  "adapters",
31
31
  "commands",
32
+ "pages",
32
33
  "plugin.js",
33
34
  "schema.json",
34
35
  "src",
@@ -48,17 +49,20 @@
48
49
  }
49
50
  },
50
51
  "dependencies": {
51
- "@zhin.js/adapter": "1.1.23",
52
- "@zhin.js/core": "1.1.51",
52
+ "@zhin.js/adapter": "1.1.25",
53
+ "@zhin.js/client": "1.1.21",
54
+ "@zhin.js/console-contract": "1.1.3",
55
+ "@zhin.js/core": "1.1.53",
53
56
  "@zhin.js/feature-kit": "1.1.9",
54
- "@zhin.js/im-contract": "1.1.7",
55
- "@zhin.js/logger": "1.1.2"
57
+ "@zhin.js/im-contract": "1.1.9",
58
+ "@zhin.js/logger": "1.1.2",
59
+ "@zhin.js/page": "1.1.10"
56
60
  },
57
61
  "peerDependencies": {
58
- "@zhin.js/adapter": "^1.1.23",
62
+ "@zhin.js/adapter": "^1.1.25",
59
63
  "@zhin.js/command": "^1.1.11",
60
- "@zhin.js/core": "^1.1.51",
61
- "zhin.js": "^1.1.16"
64
+ "@zhin.js/core": "^1.1.53",
65
+ "zhin.js": "^1.1.18"
62
66
  },
63
67
  "peerDependenciesMeta": {
64
68
  "@zhin.js/command": {
@@ -72,7 +76,7 @@
72
76
  "@types/node": "^26.1.2",
73
77
  "typescript": "^6.0.3",
74
78
  "vitest": "^4.1.10",
75
- "zhin.js": "1.1.16"
79
+ "zhin.js": "1.1.18"
76
80
  },
77
81
  "ilink_appid": "bot",
78
82
  "engines": {
@@ -92,6 +96,10 @@
92
96
  {
93
97
  "package": "@zhin.js/command",
94
98
  "api": "^1.0.0"
99
+ },
100
+ {
101
+ "package": "@zhin.js/page",
102
+ "api": "^1.0.0"
95
103
  }
96
104
  ],
97
105
  "plugins": []
@@ -0,0 +1,15 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { definePage } from '@zhin.js/console-contract';
3
+ import { createAdapterConsolePage } from '@zhin.js/client';
4
+ export const meta = definePage({
5
+ title: '微信 iLink',
6
+ titleI18n: { en: 'Weixin iLink' },
7
+ icon: 'MessageCircle',
8
+ order: 77,
9
+ requiredPermissions: ['weixin-ilink:read'],
10
+ });
11
+ /**
12
+ * Convention page: `pages/index/index.ts` → `/weixin-ilink`(插件路径)。
13
+ * 连接状态、连接测试、endpoint 增删;登录待办来自 LoginAssist(ICQQ 等)。
14
+ */
15
+ export default createAdapterConsolePage('weixin-ilink');
@@ -0,0 +1,16 @@
1
+ import { definePage } from '@zhin.js/console-contract';
2
+ import { createAdapterConsolePage } from '@zhin.js/client';
3
+
4
+ export const meta = definePage({
5
+ title: '微信 iLink',
6
+ titleI18n: { en: 'Weixin iLink' },
7
+ icon: 'MessageCircle',
8
+ order: 77,
9
+ requiredPermissions: ['weixin-ilink:read'],
10
+ });
11
+
12
+ /**
13
+ * Convention page: `pages/index/index.ts` → `/weixin-ilink`(插件路径)。
14
+ * 连接状态、连接测试、endpoint 增删;登录待办来自 LoginAssist(ICQQ 等)。
15
+ */
16
+ export default createAdapterConsolePage('weixin-ilink');
package/plugin.js CHANGED
@@ -1,7 +1,8 @@
1
1
  // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
2
  import { createEndpointRuntimeState } from 'zhin.js/adapter';
3
- import { definePlugin } from 'zhin.js';
3
+ import { definePlugin, pluginConsoleRpcToken } from 'zhin.js';
4
4
  import { weixinIlinkRuntimeStateToken } from "./lib/weixin-ilink-runtime-state.js";
5
+ import { createWeixinIlinkConsoleRpc } from "./lib/console.js";
5
6
  export default definePlugin({
6
7
  name: 'weixin-ilink',
7
8
  metadata: {
@@ -10,5 +11,6 @@ export default definePlugin({
10
11
  setup(context) {
11
12
  // 运行中 endpoint 注册表(weixin-ilink endpoint list 的"运行中"数据源)
12
13
  context.resources.provide(weixinIlinkRuntimeStateToken, createEndpointRuntimeState());
14
+ context.resources.provide(pluginConsoleRpcToken, createWeixinIlinkConsoleRpc(context.resources, () => context.config.get()));
13
15
  },
14
16
  });
@@ -0,0 +1,15 @@
1
+ /**
2
+ * 微信 iLink Console 页面元数据(浏览器与服务端共享;不要在这里 import 服务端代码)。
3
+ */
4
+ import type { AdapterConsoleField } from 'zhin.js/adapter';
5
+
6
+ export const weixinIlinkConsoleSpec = {
7
+ adapterKey: 'weixin-ilink',
8
+ adapterDisplayName: '微信 iLink',
9
+ fields: [
10
+ { key: 'botToken', required: true, env: true, description: 'iLink bot token' },
11
+ ] as readonly AdapterConsoleField[],
12
+ docsUrl: 'https://zhin.js.org/adapters/weixin-ilink',
13
+ readPermission: 'weixin-ilink:read',
14
+ writePermission: 'weixin-ilink:write',
15
+ } as const;
package/src/console.ts ADDED
@@ -0,0 +1,21 @@
1
+ /**
2
+ * 微信 iLink Console RPC:运行状态 + endpoint 增删(原 `weixin-ilink endpoint` 聊天命令)。
3
+ *
4
+ * 页面绑定 `pages/index`,读取 / 写入分别要求 `<adapter>:read` / `<adapter>:write`。
5
+ */
6
+ import { createAdapterConsoleRpc, type AdapterConsoleResources } from 'zhin.js/adapter';
7
+ import type { PluginConsoleRpc } from 'zhin.js';
8
+ import { weixinIlinkRuntimeStateToken } from './weixin-ilink-runtime-state.js';
9
+ import { weixinIlinkConsoleSpec } from './console-spec.js';
10
+
11
+ export function createWeixinIlinkConsoleRpc(
12
+ resources: AdapterConsoleResources,
13
+ getConfig: () => unknown,
14
+ ): PluginConsoleRpc {
15
+ const state = resources.use(weixinIlinkRuntimeStateToken);
16
+ return createAdapterConsoleRpc({
17
+ ...weixinIlinkConsoleSpec,
18
+ running: () => state.endpoints.values(),
19
+ getConfig,
20
+ }, resources);
21
+ }