@zhin.js/adapter-line 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,51 @@
1
1
  # @zhin.js/adapter-line
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
+ - @zhin.js/tool@1.1.12
29
+
30
+ ## 1.1.17
31
+
32
+ ### Patch Changes
33
+
34
+ - Updated dependencies [f67883e]
35
+ - Updated dependencies [e23cabc]
36
+ - Updated dependencies [4d728c0]
37
+ - Updated dependencies [eb8feeb]
38
+ - Updated dependencies [24a2b71]
39
+ - Updated dependencies [d0e1fac]
40
+ - Updated dependencies [1ca669a]
41
+ - Updated dependencies [3771f7a]
42
+ - Updated dependencies [4f96ad5]
43
+ - @zhin.js/core@1.1.52
44
+ - @zhin.js/adapter@1.1.24
45
+ - @zhin.js/tool@1.1.11
46
+ - @zhin.js/host-http@1.1.11
47
+ - @zhin.js/im-contract@1.1.8
48
+
3
49
  ## 1.1.16
4
50
 
5
51
  ### Patch Changes
package/README.md CHANGED
@@ -99,6 +99,16 @@ LINE 要求 Webhook URL 以 HTTPS 开头。常见方案:
99
99
  - **单次最多 5 条消息**:LINE 限制单次 Reply/Push 最多 5 条
100
100
  - **文本长度限制**:单条文本消息最多 5000 字符
101
101
 
102
+ ## Console 页面
103
+
104
+ 启动后打开 Console 的「LINE」页(地址 `/line`),可以:
105
+
106
+ - 查看运行中的连接、点「测试连接」做连通性诊断;
107
+ - 增删 `plugins.line.endpoints`(凭据写入 `.env`,配置里只保留 `${ENV}` 引用);
108
+ - 如果适配器要求登录,页面会显示 LoginAssist 的扫码 / 滑块 / 设备确认待办;
109
+
110
+ 读取需要 `line:read`,写操作需要 `line:write`;管理员 full token 不受限。页面里的「添加 endpoint」等价于原来的 `line endpoint add`。
111
+
102
112
  ## 故障排查
103
113
 
104
114
  | 问题 | 排查方法 |
@@ -0,0 +1,12 @@
1
+ /**
2
+ * LINE Console 页面元数据(浏览器与服务端共享;不要在这里 import 服务端代码)。
3
+ */
4
+ import type { AdapterConsoleField } from 'zhin.js/adapter';
5
+ export declare const lineConsoleSpec: {
6
+ readonly adapterKey: "line";
7
+ readonly adapterDisplayName: "LINE";
8
+ readonly fields: readonly AdapterConsoleField[];
9
+ readonly docsUrl: "https://zhin.js.org/adapters/line";
10
+ readonly readPermission: "line:read";
11
+ readonly writePermission: "line:write";
12
+ };
@@ -0,0 +1,11 @@
1
+ export const lineConsoleSpec = {
2
+ adapterKey: 'line',
3
+ adapterDisplayName: 'LINE',
4
+ fields: [
5
+ { key: 'channelSecret', required: true, env: true, description: 'LINE channel secret' },
6
+ { key: 'channelAccessToken', required: true, env: true, description: 'LINE channel access token' },
7
+ ],
8
+ docsUrl: 'https://zhin.js.org/adapters/line',
9
+ readPermission: 'line:read',
10
+ writePermission: 'line:write',
11
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * LINE Console RPC:运行状态 + endpoint 增删(原 `line 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 createLineConsoleRpc(resources: AdapterConsoleResources, getConfig: () => unknown): PluginConsoleRpc;
package/lib/console.js ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * LINE Console RPC:运行状态 + endpoint 增删(原 `line endpoint` 聊天命令)。
3
+ *
4
+ * 页面绑定 `pages/index`,读取 / 写入分别要求 `<adapter>:read` / `<adapter>:write`。
5
+ */
6
+ import { createAdapterConsoleRpc } from 'zhin.js/adapter';
7
+ import { lineRuntimeStateToken } from './line-runtime-state.js';
8
+ import { lineConsoleSpec } from './console-spec.js';
9
+ export function createLineConsoleRpc(resources, getConfig) {
10
+ const state = resources.use(lineRuntimeStateToken);
11
+ return createAdapterConsoleRpc({
12
+ ...lineConsoleSpec,
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-line",
3
- "version": "1.1.16",
3
+ "version": "1.1.18",
4
4
  "description": "Zhin.js LINE Messaging API adapter for Plugin Runtime (HTTP webhook)",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -31,23 +31,26 @@
31
31
  "directory": "plugins/adapters/line"
32
32
  },
33
33
  "dependencies": {
34
- "@zhin.js/adapter": "1.1.23",
34
+ "@zhin.js/adapter": "1.1.25",
35
35
  "@zhin.js/agent-feature": "1.1.10",
36
- "@zhin.js/core": "1.1.51",
36
+ "@zhin.js/client": "1.1.21",
37
+ "@zhin.js/console-contract": "1.1.3",
38
+ "@zhin.js/core": "1.1.53",
37
39
  "@zhin.js/feature-kit": "1.1.9",
38
- "@zhin.js/host-http": "1.1.10",
39
- "@zhin.js/im-contract": "1.1.7",
40
+ "@zhin.js/host-http": "1.1.11",
41
+ "@zhin.js/im-contract": "1.1.9",
40
42
  "@zhin.js/logger": "1.1.2",
43
+ "@zhin.js/page": "1.1.10",
41
44
  "@zhin.js/skill": "1.1.10",
42
- "@zhin.js/tool": "1.1.10"
45
+ "@zhin.js/tool": "1.1.12"
43
46
  },
44
47
  "peerDependencies": {
45
48
  "zod": "^4.0.0",
46
- "@zhin.js/adapter": "^1.1.23",
49
+ "@zhin.js/adapter": "^1.1.25",
47
50
  "@zhin.js/command": "^1.1.11",
48
- "@zhin.js/core": "^1.1.51",
49
- "@zhin.js/host-http": "^1.1.10",
50
- "zhin.js": "^1.1.16"
51
+ "@zhin.js/core": "^1.1.53",
52
+ "@zhin.js/host-http": "^1.1.11",
53
+ "zhin.js": "^1.1.18"
51
54
  },
52
55
  "peerDependenciesMeta": {
53
56
  "@zhin.js/command": {
@@ -65,11 +68,12 @@
65
68
  "typescript": "^6.0.3",
66
69
  "vitest": "^4.1.10",
67
70
  "zod": "^4.4.3",
68
- "zhin.js": "1.1.16"
71
+ "zhin.js": "1.1.18"
69
72
  },
70
73
  "files": [
71
74
  "adapters",
72
75
  "commands",
76
+ "pages",
73
77
  "plugin.js",
74
78
  "schema.json",
75
79
  "src",
@@ -113,6 +117,10 @@
113
117
  {
114
118
  "package": "@zhin.js/agent-feature",
115
119
  "api": "^1.0.0"
120
+ },
121
+ {
122
+ "package": "@zhin.js/page",
123
+ "api": "^1.0.0"
116
124
  }
117
125
  ],
118
126
  "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: 'LINE',
6
+ titleI18n: { en: 'LINE' },
7
+ icon: 'MessageCircle',
8
+ order: 67,
9
+ requiredPermissions: ['line:read'],
10
+ });
11
+ /**
12
+ * Convention page: `pages/index/index.ts` → `/line`(插件路径)。
13
+ * 连接状态、连接测试、endpoint 增删;登录待办来自 LoginAssist(ICQQ 等)。
14
+ */
15
+ export default createAdapterConsolePage('line');
@@ -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: 'LINE',
6
+ titleI18n: { en: 'LINE' },
7
+ icon: 'MessageCircle',
8
+ order: 67,
9
+ requiredPermissions: ['line:read'],
10
+ });
11
+
12
+ /**
13
+ * Convention page: `pages/index/index.ts` → `/line`(插件路径)。
14
+ * 连接状态、连接测试、endpoint 增删;登录待办来自 LoginAssist(ICQQ 等)。
15
+ */
16
+ export default createAdapterConsolePage('line');
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 { lineRuntimeStateToken } from "./lib/line-runtime-state.js";
5
+ import { createLineConsoleRpc } from "./lib/console.js";
5
6
  export default definePlugin({
6
7
  name: 'line',
7
8
  metadata: {
@@ -10,5 +11,6 @@ export default definePlugin({
10
11
  setup(context) {
11
12
  // 运行中 endpoint 注册表(line endpoint list 的"运行中"数据源)
12
13
  context.resources.provide(lineRuntimeStateToken, createEndpointRuntimeState());
14
+ context.resources.provide(pluginConsoleRpcToken, createLineConsoleRpc(context.resources, () => context.config.get()));
13
15
  },
14
16
  });
@@ -0,0 +1,16 @@
1
+ /**
2
+ * LINE Console 页面元数据(浏览器与服务端共享;不要在这里 import 服务端代码)。
3
+ */
4
+ import type { AdapterConsoleField } from 'zhin.js/adapter';
5
+
6
+ export const lineConsoleSpec = {
7
+ adapterKey: 'line',
8
+ adapterDisplayName: 'LINE',
9
+ fields: [
10
+ { key: 'channelSecret', required: true, env: true, description: 'LINE channel secret' },
11
+ { key: 'channelAccessToken', required: true, env: true, description: 'LINE channel access token' },
12
+ ] as readonly AdapterConsoleField[],
13
+ docsUrl: 'https://zhin.js.org/adapters/line',
14
+ readPermission: 'line:read',
15
+ writePermission: 'line:write',
16
+ } as const;
package/src/console.ts ADDED
@@ -0,0 +1,21 @@
1
+ /**
2
+ * LINE Console RPC:运行状态 + endpoint 增删(原 `line 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 { lineRuntimeStateToken } from './line-runtime-state.js';
9
+ import { lineConsoleSpec } from './console-spec.js';
10
+
11
+ export function createLineConsoleRpc(
12
+ resources: AdapterConsoleResources,
13
+ getConfig: () => unknown,
14
+ ): PluginConsoleRpc {
15
+ const state = resources.use(lineRuntimeStateToken);
16
+ return createAdapterConsoleRpc({
17
+ ...lineConsoleSpec,
18
+ running: () => state.endpoints.values(),
19
+ getConfig,
20
+ }, resources);
21
+ }