@zhin.js/adapter-slack 4.1.1 → 5.0.0
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 +30 -0
- package/README.md +22 -6
- package/lib/endpoint.d.ts +2 -0
- package/lib/endpoint.js +4 -0
- package/package.json +13 -13
- package/schema.json +38 -17
- package/src/endpoint.ts +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.0.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7db69c1: 命令前缀改为适配器配置项:`MessageDispatcher` 不再硬编码 `/`,默认按消息所属适配器实例 config 的 `commandPrefix` 解析(默认 `''` 无前缀,任意文本按命令匹配),`endpoints[i].commandPrefix` 逐项覆盖;`ImRuntime({ commandPrefix })` 仍可设全局静态前缀。全部 20 个平台适配器 schema 新增 `commandPrefix` 属性。
|
|
8
|
+
|
|
9
|
+
BREAKING(行为变化):未配置时命令不再需要 `/` 前缀——原 `/zt` 写法不再命中,直接发 `zt` 即可;需要斜杠风格的适配器请在配置里显式设 `commandPrefix: '/'`。
|
|
10
|
+
|
|
11
|
+
- 1ddcd70: Console/契约扫尾批:
|
|
12
|
+
|
|
13
|
+
- adapter:多 endpoint record name 改为 entry.name(Console 展示/resolve/inbox 按名唯一命中);`expandEndpointConfigs` 增加缺名/非法字符/重名校验与告警;slack endpoint 补 `name` getter;inbox-installer / agent-host 解析 `slot~entry` 展开 id(activity-feedback 随之恢复)。
|
|
14
|
+
- host-http:`schema:get`/`config:get` 兼容 `data.plugin`;extended RPC 参数顶层与 `data` 合并(cron 写操作修复);请求审批认 `requestId`、已读认单值 `id`;`endpoint:requests`/`inboxRequests`/`inboxNotices` 行补 camelCase/扁平别名;cron 列表补 `expression/running/plugin/nextExecution/createdAt/context`。
|
|
15
|
+
- cli:装配 `setOrchestrationRuntime`/`setSessionTreeRuntime`(agent-sessions/orchestration 页恢复);`/api/stats` 补 commands/components 计数;console REST databaseHost.started 改动态 getter;`wrapModel` 支持 orderBy/limit 链式查询;接线 SystemLog 模型 + 日志 transport(logs 页有真实数据,带 7 天/1 万条清理)。
|
|
16
|
+
- plugin-runtime:`DatabaseHostModel.select` 升级为链式 `DatabaseHostSelection`;新增 `system-log`(SystemLog 表定义/写入助手)。
|
|
17
|
+
- agent:导出 `asPrivate`(Runtime Host 装配 session tree runtime 用)。
|
|
18
|
+
|
|
19
|
+
- 713445c: 适配器配置格式定稿(不兼容旧格式):`plugins.<adapter>` 顶层仅共享字段 + `commandPrefix`,`endpoints[i]` 携带 endpoint 级字段(`name` + 凭据,各 schema 已类型化),`endpoints` 为必填(icqq 另需顶层 `master`);icqq 新增 `trusted` 列表(顶层/逐项均可)。scaffold-wizard 全部字段式与自定义 configure() 产出改为新格式,examples(full-bot / qq-games-bot)与 20 个适配器 README 同步迁移。
|
|
20
|
+
- f32c424: 适配器配置统一为 endpoints 数组格式:`plugins.<adapter>` 为该 adapter 所有 endpoint 的通用配置,`plugins.<adapter>.endpoints[i]` 为单个 endpoint 的特殊配置(逐项覆盖,`name` 必填)。slack / github schema 新增 `endpoints` 属性;icqq / qq / slack 顶层必填改为 `anyOf`(单 endpoint 字段或 `endpoints` 数组二选一,兼容 Ajv strictRequired)。
|
|
21
|
+
- Updated dependencies [7db69c1]
|
|
22
|
+
- Updated dependencies [e5c84ed]
|
|
23
|
+
- Updated dependencies [3ea84a0]
|
|
24
|
+
- Updated dependencies [1ddcd70]
|
|
25
|
+
- Updated dependencies [ac9da66]
|
|
26
|
+
- @zhin.js/core@1.4.0
|
|
27
|
+
- @zhin.js/adapter@1.1.0
|
|
28
|
+
- @zhin.js/plugin-runtime@1.1.0
|
|
29
|
+
- @zhin.js/agent@1.0.5
|
|
30
|
+
- @zhin.js/host-http@1.0.2
|
|
31
|
+
- zhin.js@5.0.0
|
|
32
|
+
|
|
3
33
|
## 4.1.1
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -44,10 +44,25 @@ pnpm add @zhin.js/adapter-slack
|
|
|
44
44
|
# zhin.config.yml(Plugin Runtime)
|
|
45
45
|
plugins:
|
|
46
46
|
slack:
|
|
47
|
-
name: my-slack-bot
|
|
48
|
-
token: ${SLACK_BOT_TOKEN}
|
|
49
|
-
appToken: ${SLACK_APP_TOKEN}
|
|
50
47
|
socketMode: true # 默认 true,可省略
|
|
48
|
+
endpoints:
|
|
49
|
+
- name: my-slack-bot
|
|
50
|
+
token: ${SLACK_BOT_TOKEN}
|
|
51
|
+
appToken: ${SLACK_APP_TOKEN}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
多 workspace:一个插件实例挂多个 endpoint(`endpoints` 数组逐项覆盖顶层字段,`name` 必填):
|
|
55
|
+
|
|
56
|
+
```yaml
|
|
57
|
+
plugins:
|
|
58
|
+
slack:
|
|
59
|
+
endpoints:
|
|
60
|
+
- name: team-a
|
|
61
|
+
token: ${SLACK_BOT_TOKEN_A}
|
|
62
|
+
appToken: ${SLACK_APP_TOKEN_A}
|
|
63
|
+
- name: team-b
|
|
64
|
+
token: ${SLACK_BOT_TOKEN_B}
|
|
65
|
+
appToken: ${SLACK_APP_TOKEN_B}
|
|
51
66
|
```
|
|
52
67
|
|
|
53
68
|
## HTTP Events 配置
|
|
@@ -55,11 +70,12 @@ plugins:
|
|
|
55
70
|
```yaml
|
|
56
71
|
plugins:
|
|
57
72
|
slack:
|
|
58
|
-
name: my-slack-bot
|
|
59
|
-
token: ${SLACK_BOT_TOKEN}
|
|
60
|
-
signingSecret: ${SLACK_SIGNING_SECRET}
|
|
61
73
|
socketMode: false
|
|
62
74
|
webhookPath: /slack/events # 可选,默认 /slack/events
|
|
75
|
+
endpoints:
|
|
76
|
+
- name: my-slack-bot
|
|
77
|
+
token: ${SLACK_BOT_TOKEN}
|
|
78
|
+
signingSecret: ${SLACK_SIGNING_SECRET}
|
|
63
79
|
```
|
|
64
80
|
|
|
65
81
|
根插件 `zhin.plugins`(或项目图)需引用 `@zhin.js/adapter-slack`(`instanceKey: slack`)。
|
package/lib/endpoint.d.ts
CHANGED
|
@@ -108,6 +108,8 @@ export interface SlackEndpointOptions {
|
|
|
108
108
|
export declare class SlackEndpoint implements EndpointInstance, SlackWebhookHandler {
|
|
109
109
|
#private;
|
|
110
110
|
constructor(options: SlackEndpointOptions);
|
|
111
|
+
/** Console 展示 / AdapterIndex live name(多 endpoint 时与 entry name 一致)。 */
|
|
112
|
+
get name(): string;
|
|
111
113
|
get client(): SlackWebClientLike | undefined;
|
|
112
114
|
get platformUserId(): string | undefined;
|
|
113
115
|
get config(): ResolvedSlackConfig;
|
package/lib/endpoint.js
CHANGED
|
@@ -27,6 +27,10 @@ export class SlackEndpoint {
|
|
|
27
27
|
constructor(options) {
|
|
28
28
|
this.#options = options;
|
|
29
29
|
}
|
|
30
|
+
/** Console 展示 / AdapterIndex live name(多 endpoint 时与 entry name 一致)。 */
|
|
31
|
+
get name() {
|
|
32
|
+
return this.#options.config.name;
|
|
33
|
+
}
|
|
30
34
|
get client() {
|
|
31
35
|
return this.#client;
|
|
32
36
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/adapter-slack",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Zhin.js Slack adapter for Plugin Runtime (Socket Mode / HTTP Events)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -34,20 +34,20 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@slack/socket-mode": "^2.0.3",
|
|
36
36
|
"@slack/web-api": "^7.17.0",
|
|
37
|
-
"@zhin.js/adapter": "1.0
|
|
38
|
-
"@zhin.js/core": "1.
|
|
39
|
-
"@zhin.js/host-http": "1.0.
|
|
37
|
+
"@zhin.js/adapter": "1.1.0",
|
|
38
|
+
"@zhin.js/core": "1.4.0",
|
|
39
|
+
"@zhin.js/host-http": "1.0.2",
|
|
40
40
|
"@zhin.js/logger": "1.0.75",
|
|
41
|
-
"@zhin.js/plugin-runtime": "1.0
|
|
41
|
+
"@zhin.js/plugin-runtime": "1.1.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"zod": "^4.0.0",
|
|
45
|
-
"@zhin.js/adapter": "1.0
|
|
46
|
-
"@zhin.js/agent": "1.0.
|
|
47
|
-
"@zhin.js/core": "1.
|
|
48
|
-
"@zhin.js/host-http": "1.0.
|
|
49
|
-
"@zhin.js/plugin-runtime": "1.0
|
|
50
|
-
"zhin.js": "
|
|
45
|
+
"@zhin.js/adapter": "1.1.0",
|
|
46
|
+
"@zhin.js/agent": "1.0.5",
|
|
47
|
+
"@zhin.js/core": "1.4.0",
|
|
48
|
+
"@zhin.js/host-http": "1.0.2",
|
|
49
|
+
"@zhin.js/plugin-runtime": "1.1.0",
|
|
50
|
+
"zhin.js": "5.0.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependenciesMeta": {
|
|
53
53
|
"zhin.js": {
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"typescript": "^6.0.3",
|
|
66
66
|
"vitest": "^4.1.10",
|
|
67
67
|
"zod": "^4.4.3",
|
|
68
|
-
"@zhin.js/agent": "1.0.
|
|
69
|
-
"zhin.js": "
|
|
68
|
+
"@zhin.js/agent": "1.0.5",
|
|
69
|
+
"zhin.js": "5.0.0"
|
|
70
70
|
},
|
|
71
71
|
"files": [
|
|
72
72
|
"adapters",
|
package/schema.json
CHANGED
|
@@ -3,22 +3,6 @@
|
|
|
3
3
|
"type": "object",
|
|
4
4
|
"additionalProperties": false,
|
|
5
5
|
"properties": {
|
|
6
|
-
"name": {
|
|
7
|
-
"type": "string",
|
|
8
|
-
"default": "slack-bot"
|
|
9
|
-
},
|
|
10
|
-
"token": {
|
|
11
|
-
"type": "string",
|
|
12
|
-
"description": "Bot User OAuth Token (xoxb-...)"
|
|
13
|
-
},
|
|
14
|
-
"signingSecret": {
|
|
15
|
-
"type": "string",
|
|
16
|
-
"description": "Required for HTTP Events API (socketMode: false)"
|
|
17
|
-
},
|
|
18
|
-
"appToken": {
|
|
19
|
-
"type": "string",
|
|
20
|
-
"description": "App-Level Token (xapp-...) for Socket Mode"
|
|
21
|
-
},
|
|
22
6
|
"socketMode": {
|
|
23
7
|
"type": "boolean",
|
|
24
8
|
"default": true,
|
|
@@ -32,7 +16,44 @@
|
|
|
32
16
|
"type": "number",
|
|
33
17
|
"default": 15000,
|
|
34
18
|
"description": "Socket Mode client ping timeout (ms)"
|
|
19
|
+
},
|
|
20
|
+
"endpoints": {
|
|
21
|
+
"type": "array",
|
|
22
|
+
"description": "多账号:一个插件实例挂多个 endpoint。每项与顶层字段同构(name 必填,其余覆盖顶层)",
|
|
23
|
+
"items": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"additionalProperties": true,
|
|
26
|
+
"properties": {
|
|
27
|
+
"name": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "Slack bot name"
|
|
30
|
+
},
|
|
31
|
+
"token": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "Bot User OAuth Token (xoxb-...)"
|
|
34
|
+
},
|
|
35
|
+
"signingSecret": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"description": "Required for HTTP Events API (socketMode: false)"
|
|
38
|
+
},
|
|
39
|
+
"appToken": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"description": "App-Level Token (xapp-...) for Socket Mode"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"required": [
|
|
45
|
+
"name",
|
|
46
|
+
"token"
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"commandPrefix": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"default": "",
|
|
53
|
+
"description": "命令前缀(默认 '' 无前缀,任意文本按命令匹配;如 '/' 要求 / 开头)。endpoints[i] 可逐项覆盖"
|
|
35
54
|
}
|
|
36
55
|
},
|
|
37
|
-
"required": [
|
|
56
|
+
"required": [
|
|
57
|
+
"endpoints"
|
|
58
|
+
]
|
|
38
59
|
}
|
package/src/endpoint.ts
CHANGED
|
@@ -102,6 +102,11 @@ export class SlackEndpoint implements EndpointInstance, SlackWebhookHandler {
|
|
|
102
102
|
this.#options = options;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
/** Console 展示 / AdapterIndex live name(多 endpoint 时与 entry name 一致)。 */
|
|
106
|
+
get name(): string {
|
|
107
|
+
return this.#options.config.name;
|
|
108
|
+
}
|
|
109
|
+
|
|
105
110
|
get client(): SlackWebClientLike | undefined {
|
|
106
111
|
return this.#client;
|
|
107
112
|
}
|