@zhin.js/adapter-napcat 1.1.15 → 1.1.16
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 +36 -0
- package/agents/napcat/messages.js +16 -0
- package/agents/napcat/messages.ts +16 -0
- package/agents/napcat/skills/napcat-account/tools/send_like/index.js +2 -1
- package/agents/napcat/skills/napcat-account/tools/send_like/index.ts +2 -1
- package/agents/napcat/skills/napcat-group-settings/tools/set_title/index.js +2 -1
- package/agents/napcat/skills/napcat-group-settings/tools/set_title/index.ts +2 -1
- package/agents/napcat/skills/napcat-messaging/tools/send_poke/index.js +2 -1
- package/agents/napcat/skills/napcat-messaging/tools/send_poke/index.ts +2 -1
- package/commands/napcat/endpoint/definition.js +4 -4
- package/commands/napcat/endpoint/definition.ts +4 -4
- package/lib/endpoint-management.js +6 -0
- package/package.json +16 -16
- package/schema.json +35 -5
- package/src/endpoint-management.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @zhin.js/adapter-napcat
|
|
2
2
|
|
|
3
|
+
## 1.1.16
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 334e92d: 公告:草稿 → 审批 → 发送(ADR 0037 第 1 期切片 B)。
|
|
8
|
+
|
|
9
|
+
- 新表 `ai_announcements` 与 `AiAnnouncements`:状态只前进 `draft` → `pending` → `approved` → `sent`,旁路 `rejected` / `expired` / `failed`;`revision` 乐观并发;改正文回到 `draft` 并重算 `content_hash`;待审批默认 24 小时超时。
|
|
10
|
+
- 新工具 `announcement_draft`(`risk: safe`):模型只能建草稿,不能提交、审批或发送。
|
|
11
|
+
- Console `plugin.root.announcements` / `announcement`(读)与 `announcement-create` / `-edit` / `-submit` / `-approve` / `-reject` / `-resend`(动作,暂用 `control:read` / `control:write`)。
|
|
12
|
+
- 批准即发送:摘要复核 → 控制面 → 会话画像 → 硬闸以公告审批记录作批准(`ToolHardGate.checkPreApproved`,不弹第二张卡)→ `EndpointManagement.sendGroupNotice`(icqq / napcat)。被拦或失败置 `failed`,不自动重试;重发回到 `pending` 需再批一次;摘要不符拒绝(`announcement_hash_mismatch`)。
|
|
13
|
+
- 审计追加 kind `announcement` 与码 `announcement_drafted` / `_submitted` / `_approved` / `_rejected` / `_expired` / `_sent` / `_send_failed` / `_resend` / `_hash_mismatch`。
|
|
14
|
+
|
|
15
|
+
- 53bc6a0: 适配器配置标签、端点命令和工具反馈支持中英文;复用当前操作语言,保持协议值、用户内容、身份、权限与发送链路不变。Sandbox 展示使用项目语言,QQ 绑定与交互状态保留完整会话身份。
|
|
16
|
+
- Updated dependencies [334e92d]
|
|
17
|
+
- Updated dependencies [f3b7c9f]
|
|
18
|
+
- Updated dependencies [658a5fb]
|
|
19
|
+
- Updated dependencies [144a17b]
|
|
20
|
+
- Updated dependencies [18296cf]
|
|
21
|
+
- Updated dependencies [08e64de]
|
|
22
|
+
- Updated dependencies [9cade30]
|
|
23
|
+
- Updated dependencies [53bc6a0]
|
|
24
|
+
- Updated dependencies [7595136]
|
|
25
|
+
- Updated dependencies [66b6404]
|
|
26
|
+
- Updated dependencies [adb4af2]
|
|
27
|
+
- Updated dependencies [69f9ef6]
|
|
28
|
+
- Updated dependencies [17d1301]
|
|
29
|
+
- @zhin.js/adapter@1.1.23
|
|
30
|
+
- @zhin.js/host-http@1.1.10
|
|
31
|
+
- @zhin.js/core@1.1.51
|
|
32
|
+
- @zhin.js/permission@1.1.9
|
|
33
|
+
- @zhin.js/tool@1.1.10
|
|
34
|
+
- @zhin.js/skill@1.1.10
|
|
35
|
+
- @zhin.js/im-contract@1.1.7
|
|
36
|
+
- @zhin.js/agent-feature@1.1.10
|
|
37
|
+
- @zhin.js/feature-kit@1.1.9
|
|
38
|
+
|
|
3
39
|
## 1.1.15
|
|
4
40
|
|
|
5
41
|
### Patch Changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { createMessages } from 'zhin.js/i18n';
|
|
3
|
+
export const messages = createMessages({
|
|
4
|
+
"likesSent": {
|
|
5
|
+
"zh-CN": "已给 {p0} 点赞 {p1} 次",
|
|
6
|
+
"en": "Sent {p1} likes to {p0}"
|
|
7
|
+
},
|
|
8
|
+
"memberTitleSet": {
|
|
9
|
+
"zh-CN": "已设置 {p0} 头衔为 \"{p1}\"",
|
|
10
|
+
"en": "Title for {p0} set to \"{p1}\""
|
|
11
|
+
},
|
|
12
|
+
"userPoked": {
|
|
13
|
+
"zh-CN": "已戳 {p0}",
|
|
14
|
+
"en": "Poked {p0}"
|
|
15
|
+
}
|
|
16
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createMessages } from 'zhin.js/i18n';
|
|
2
|
+
|
|
3
|
+
export const messages = createMessages({
|
|
4
|
+
"likesSent": {
|
|
5
|
+
"zh-CN": "已给 {p0} 点赞 {p1} 次",
|
|
6
|
+
"en": "Sent {p1} likes to {p0}"
|
|
7
|
+
},
|
|
8
|
+
"memberTitleSet": {
|
|
9
|
+
"zh-CN": "已设置 {p0} 头衔为 \"{p1}\"",
|
|
10
|
+
"en": "Title for {p0} set to \"{p1}\""
|
|
11
|
+
},
|
|
12
|
+
"userPoked": {
|
|
13
|
+
"zh-CN": "已戳 {p0}",
|
|
14
|
+
"en": "Poked {p0}"
|
|
15
|
+
}
|
|
16
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { messages as t } from "../../../../messages.js";
|
|
2
3
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
3
4
|
import { z } from 'zod';
|
|
4
5
|
export default defineAgentTool({
|
|
@@ -13,6 +14,6 @@ export default defineAgentTool({
|
|
|
13
14
|
async execute({ user_id, times }, context) {
|
|
14
15
|
const endpoint = context.$client;
|
|
15
16
|
await endpoint.sendLike(user_id, times || 1);
|
|
16
|
-
return { success: true, message:
|
|
17
|
+
return { success: true, message: t(context.locale, 'likesSent', { p0: user_id, p1: times || 1 }) };
|
|
17
18
|
},
|
|
18
19
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { messages as t } from "../../../../messages.js";
|
|
1
2
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
|
|
@@ -13,6 +14,6 @@ export default defineAgentTool<{ user_id: number; times?: number }>({
|
|
|
13
14
|
async execute({ user_id, times }: { user_id: number; times?: number }, context) {
|
|
14
15
|
const endpoint = context.$client;
|
|
15
16
|
await endpoint.sendLike(user_id, times || 1);
|
|
16
|
-
return { success: true, message:
|
|
17
|
+
return { success: true, message: t(context.locale, 'likesSent', { p0: user_id, p1: times || 1 }) };
|
|
17
18
|
},
|
|
18
19
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { messages as t } from "../../../../messages.js";
|
|
2
3
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
3
4
|
import { z } from 'zod';
|
|
4
5
|
export default defineAgentTool({
|
|
@@ -16,6 +17,6 @@ export default defineAgentTool({
|
|
|
16
17
|
async execute({ group_id, user_id, title }, context) {
|
|
17
18
|
const endpoint = context.$client;
|
|
18
19
|
await endpoint.setTitle(group_id, user_id, title);
|
|
19
|
-
return { success: true, message:
|
|
20
|
+
return { success: true, message: t(context.locale, 'memberTitleSet', { p0: user_id, p1: title }) };
|
|
20
21
|
},
|
|
21
22
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { messages as t } from "../../../../messages.js";
|
|
1
2
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
|
|
@@ -16,6 +17,6 @@ export default defineAgentTool<{ group_id: number; user_id: number; title: strin
|
|
|
16
17
|
async execute({ group_id, user_id, title }: { group_id: number; user_id: number; title: string }, context) {
|
|
17
18
|
const endpoint = context.$client;
|
|
18
19
|
await endpoint.setTitle(group_id, user_id, title);
|
|
19
|
-
return { success: true, message:
|
|
20
|
+
return { success: true, message: t(context.locale, 'memberTitleSet', { p0: user_id, p1: title }) };
|
|
20
21
|
},
|
|
21
22
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { messages as t } from "../../../../messages.js";
|
|
2
3
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
3
4
|
import { z } from 'zod';
|
|
4
5
|
export default defineAgentTool({
|
|
@@ -13,6 +14,6 @@ export default defineAgentTool({
|
|
|
13
14
|
async execute({ user_id, group_id }, context) {
|
|
14
15
|
const endpoint = context.$client;
|
|
15
16
|
await endpoint.sendPoke(user_id, group_id);
|
|
16
|
-
return { success: true, message:
|
|
17
|
+
return { success: true, message: t(context.locale, 'userPoked', { p0: user_id }) };
|
|
17
18
|
},
|
|
18
19
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { messages as t } from "../../../../messages.js";
|
|
1
2
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
|
|
@@ -13,6 +14,6 @@ export default defineAgentTool<{ user_id: number; group_id?: number }>({
|
|
|
13
14
|
async execute({ user_id, group_id }: { user_id: number; group_id?: number }, context) {
|
|
14
15
|
const endpoint = context.$client;
|
|
15
16
|
await endpoint.sendPoke(user_id, group_id);
|
|
16
|
-
return { success: true, message:
|
|
17
|
+
return { success: true, message: t(context.locale, 'userPoked', { p0: user_id }) };
|
|
17
18
|
},
|
|
18
19
|
});
|
|
@@ -10,10 +10,10 @@ export const napcatEndpointCommands = createEndpointCommands({
|
|
|
10
10
|
adapterKey: 'napcat',
|
|
11
11
|
adapterDisplayName: 'NapCat',
|
|
12
12
|
fields: [
|
|
13
|
-
{ key: 'url', description: 'NapCat WebSocket URL(connection: ws 必填)' },
|
|
14
|
-
{ key: 'path', description: 'reverse-wss 路径(connection: wss)' },
|
|
15
|
-
{ key: 'http_url', description: 'HTTP API base URL(connection: http 出站)' },
|
|
16
|
-
{ key: 'post_path', description: 'HTTP POST 事件路径(connection: http 入站)' },
|
|
13
|
+
{ key: 'url', description: 'NapCat WebSocket URL(connection: ws 必填)', descriptionI18n: { en: "NapCat WebSocket URL (required for connection: ws)" } },
|
|
14
|
+
{ key: 'path', description: 'reverse-wss 路径(connection: wss)', descriptionI18n: { en: "Reverse WebSocket path (connection: wss)" } },
|
|
15
|
+
{ key: 'http_url', description: 'HTTP API base URL(connection: http 出站)', descriptionI18n: { en: "HTTP API base URL (outbound connection: http)" } },
|
|
16
|
+
{ key: 'post_path', description: 'HTTP POST 事件路径(connection: http 入站)', descriptionI18n: { en: "HTTP POST event path (inbound connection: http)" } },
|
|
17
17
|
{ key: 'access_token', env: true, description: 'NapCat access token' },
|
|
18
18
|
],
|
|
19
19
|
running: (use) => use(napcatRuntimeStateToken).endpoints.values(),
|
|
@@ -10,10 +10,10 @@ export const napcatEndpointCommands = createEndpointCommands({
|
|
|
10
10
|
adapterKey: 'napcat',
|
|
11
11
|
adapterDisplayName: 'NapCat',
|
|
12
12
|
fields: [
|
|
13
|
-
{ key: 'url', description: 'NapCat WebSocket URL(connection: ws 必填)' },
|
|
14
|
-
{ key: 'path', description: 'reverse-wss 路径(connection: wss)' },
|
|
15
|
-
{ key: 'http_url', description: 'HTTP API base URL(connection: http 出站)' },
|
|
16
|
-
{ key: 'post_path', description: 'HTTP POST 事件路径(connection: http 入站)' },
|
|
13
|
+
{ key: 'url', description: 'NapCat WebSocket URL(connection: ws 必填)', descriptionI18n: { en: "NapCat WebSocket URL (required for connection: ws)" } },
|
|
14
|
+
{ key: 'path', description: 'reverse-wss 路径(connection: wss)', descriptionI18n: { en: "Reverse WebSocket path (connection: wss)" } },
|
|
15
|
+
{ key: 'http_url', description: 'HTTP API base URL(connection: http 出站)', descriptionI18n: { en: "HTTP API base URL (outbound connection: http)" } },
|
|
16
|
+
{ key: 'post_path', description: 'HTTP POST 事件路径(connection: http 入站)', descriptionI18n: { en: "HTTP POST event path (inbound connection: http)" } },
|
|
17
17
|
{ key: 'access_token', env: true, description: 'NapCat access token' },
|
|
18
18
|
],
|
|
19
19
|
running: (use) => use(napcatRuntimeStateToken).endpoints.values(),
|
|
@@ -27,6 +27,12 @@ export function createNapCatEndpointManagement(endpoint) {
|
|
|
27
27
|
});
|
|
28
28
|
return toArray(data);
|
|
29
29
|
},
|
|
30
|
+
async sendGroupNotice(groupId, content) {
|
|
31
|
+
await endpoint.callApi('_send_group_notice', {
|
|
32
|
+
group_id: toNumberId(groupId, 'group_id'),
|
|
33
|
+
content,
|
|
34
|
+
});
|
|
35
|
+
},
|
|
30
36
|
});
|
|
31
37
|
}
|
|
32
38
|
function asRecord(value) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/adapter-napcat",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.16",
|
|
4
4
|
"description": "Zhin.js NapCat adapter for Plugin Runtime (WebSocket client, OneBot11 + NapCat extensions)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -44,16 +44,16 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"ws": "^8.21.1",
|
|
47
|
-
"@zhin.js/adapter": "1.1.
|
|
48
|
-
"@zhin.js/agent-feature": "1.1.
|
|
49
|
-
"@zhin.js/core": "1.1.
|
|
50
|
-
"@zhin.js/
|
|
51
|
-
"@zhin.js/
|
|
52
|
-
"@zhin.js/im-contract": "1.1.6",
|
|
47
|
+
"@zhin.js/adapter": "1.1.23",
|
|
48
|
+
"@zhin.js/agent-feature": "1.1.10",
|
|
49
|
+
"@zhin.js/core": "1.1.51",
|
|
50
|
+
"@zhin.js/im-contract": "1.1.7",
|
|
51
|
+
"@zhin.js/feature-kit": "1.1.9",
|
|
53
52
|
"@zhin.js/logger": "1.1.2",
|
|
54
|
-
"@zhin.js/permission": "1.1.
|
|
55
|
-
"@zhin.js/
|
|
56
|
-
"@zhin.js/
|
|
53
|
+
"@zhin.js/permission": "1.1.9",
|
|
54
|
+
"@zhin.js/host-http": "1.1.10",
|
|
55
|
+
"@zhin.js/skill": "1.1.10",
|
|
56
|
+
"@zhin.js/tool": "1.1.10"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/node": "^26.1.2",
|
|
@@ -61,15 +61,15 @@
|
|
|
61
61
|
"typescript": "^6.0.3",
|
|
62
62
|
"vitest": "^4.1.10",
|
|
63
63
|
"zod": "^4.4.3",
|
|
64
|
-
"
|
|
65
|
-
"zhin.js": "1.1.
|
|
64
|
+
"zhin.js": "1.1.16",
|
|
65
|
+
"@zhin.js/host-http": "1.1.10"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"zod": "^4.0.0",
|
|
69
|
-
"@zhin.js/adapter": "^1.1.
|
|
70
|
-
"@zhin.js/
|
|
71
|
-
"@zhin.js/
|
|
72
|
-
"zhin.js": "^1.1.
|
|
69
|
+
"@zhin.js/adapter": "^1.1.23",
|
|
70
|
+
"@zhin.js/core": "^1.1.51",
|
|
71
|
+
"@zhin.js/command": "^1.1.11",
|
|
72
|
+
"zhin.js": "^1.1.16"
|
|
73
73
|
},
|
|
74
74
|
"peerDependenciesMeta": {
|
|
75
75
|
"@zhin.js/command": {
|
package/schema.json
CHANGED
|
@@ -30,7 +30,12 @@
|
|
|
30
30
|
"string",
|
|
31
31
|
"number"
|
|
32
32
|
],
|
|
33
|
-
"description": "框架 master(QQ uin;AI/工具权限、endpoint 管理)。endpoints[i].master 可逐项覆盖"
|
|
33
|
+
"description": "框架 master(QQ uin;AI/工具权限、endpoint 管理)。endpoints[i].master 可逐项覆盖",
|
|
34
|
+
"x-i18n": {
|
|
35
|
+
"en": {
|
|
36
|
+
"description": "Framework masters (QQ uin; AI/tool permissions and endpoint management). endpoints[i].master can override this value."
|
|
37
|
+
}
|
|
38
|
+
}
|
|
34
39
|
},
|
|
35
40
|
"trusted": {
|
|
36
41
|
"type": "array",
|
|
@@ -41,7 +46,12 @@
|
|
|
41
46
|
],
|
|
42
47
|
"description": "Trusted QQ uin"
|
|
43
48
|
},
|
|
44
|
-
"description": "框架 trusted 用户列表(弱于 master)。endpoints[i].trusted 可逐项追加"
|
|
49
|
+
"description": "框架 trusted 用户列表(弱于 master)。endpoints[i].trusted 可逐项追加",
|
|
50
|
+
"x-i18n": {
|
|
51
|
+
"en": {
|
|
52
|
+
"description": "Framework trusted users, below master authority. endpoints[i].trusted can add users."
|
|
53
|
+
}
|
|
54
|
+
}
|
|
45
55
|
},
|
|
46
56
|
"endpoints": {
|
|
47
57
|
"type": "array",
|
|
@@ -56,7 +66,12 @@
|
|
|
56
66
|
"string",
|
|
57
67
|
"number"
|
|
58
68
|
],
|
|
59
|
-
"description": "本 endpoint 的框架 master(QQ uin);覆盖顶层 master"
|
|
69
|
+
"description": "本 endpoint 的框架 master(QQ uin);覆盖顶层 master",
|
|
70
|
+
"x-i18n": {
|
|
71
|
+
"en": {
|
|
72
|
+
"description": "Framework masters for this endpoint (QQ uin), overriding the top-level master list."
|
|
73
|
+
}
|
|
74
|
+
}
|
|
60
75
|
},
|
|
61
76
|
"trusted": {
|
|
62
77
|
"type": "array",
|
|
@@ -67,7 +82,12 @@
|
|
|
67
82
|
],
|
|
68
83
|
"description": "Trusted QQ uin"
|
|
69
84
|
},
|
|
70
|
-
"description": "本 endpoint 的 trusted 列表"
|
|
85
|
+
"description": "本 endpoint 的 trusted 列表",
|
|
86
|
+
"x-i18n": {
|
|
87
|
+
"en": {
|
|
88
|
+
"description": "Trusted users for this endpoint."
|
|
89
|
+
}
|
|
90
|
+
}
|
|
71
91
|
},
|
|
72
92
|
"connection": {
|
|
73
93
|
"type": "string",
|
|
@@ -117,12 +137,22 @@
|
|
|
117
137
|
"required": [
|
|
118
138
|
"id"
|
|
119
139
|
]
|
|
140
|
+
},
|
|
141
|
+
"x-i18n": {
|
|
142
|
+
"en": {
|
|
143
|
+
"description": "Multiple accounts: mount multiple endpoints in one plugin instance. Each entry uses the top-level fields; id is required and other fields override defaults."
|
|
144
|
+
}
|
|
120
145
|
}
|
|
121
146
|
},
|
|
122
147
|
"commandPrefix": {
|
|
123
148
|
"type": "string",
|
|
124
149
|
"default": "",
|
|
125
|
-
"description": "命令前缀(默认 '' 无前缀,任意文本按命令匹配;如 '/' 要求 / 开头)。endpoints[i] 可逐项覆盖"
|
|
150
|
+
"description": "命令前缀(默认 '' 无前缀,任意文本按命令匹配;如 '/' 要求 / 开头)。endpoints[i] 可逐项覆盖",
|
|
151
|
+
"x-i18n": {
|
|
152
|
+
"en": {
|
|
153
|
+
"description": "Command prefix. The default empty string allows unprefixed commands; '/' requires a leading slash. Each endpoints[i] can override it."
|
|
154
|
+
}
|
|
155
|
+
}
|
|
126
156
|
}
|
|
127
157
|
},
|
|
128
158
|
"required": [
|
|
@@ -49,6 +49,12 @@ export function createNapCatEndpointManagement(
|
|
|
49
49
|
});
|
|
50
50
|
return toArray(data);
|
|
51
51
|
},
|
|
52
|
+
async sendGroupNotice(groupId: string, content: string): Promise<void> {
|
|
53
|
+
await endpoint.callApi('_send_group_notice', {
|
|
54
|
+
group_id: toNumberId(groupId, 'group_id'),
|
|
55
|
+
content,
|
|
56
|
+
});
|
|
57
|
+
},
|
|
52
58
|
});
|
|
53
59
|
}
|
|
54
60
|
|