@zhin.js/adapter-napcat 3.0.0 → 3.0.2
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 +34 -0
- package/README.md +0 -1
- package/{skills/napcat → agent}/PERMITS.md +3 -3
- package/{skills/napcat/SKILL.md → agent/skills/napcat.md} +2 -2
- package/agent/tools/ai_tts.ts +21 -0
- package/agent/tools/del_group_notice.ts +22 -0
- package/agent/tools/delete_essence_msg.ts +21 -0
- package/agent/tools/delete_friend.ts +20 -0
- package/agent/tools/download_file.ts +19 -0
- package/agent/tools/forward_single_msg.ts +32 -0
- package/agent/tools/get_ai_characters.ts +19 -0
- package/agent/tools/get_essence_list.ts +19 -0
- package/agent/tools/get_friend_msg_history.ts +20 -0
- package/agent/tools/get_group_file_url.ts +21 -0
- package/agent/tools/get_group_info_ex.ts +19 -0
- package/agent/tools/get_group_msg_history.ts +21 -0
- package/agent/tools/get_group_notice.ts +19 -0
- package/agent/tools/get_group_root_files.ts +19 -0
- package/agent/tools/get_group_shut_list.ts +19 -0
- package/agent/tools/get_mini_app_ark.ts +22 -0
- package/agent/tools/get_user_status.ts +18 -0
- package/agent/tools/group_sign.ts +20 -0
- package/agent/tools/mark_msg_as_read.ts +19 -0
- package/agent/tools/ocr_image.ts +18 -0
- package/agent/tools/send_forward_msg.ts +31 -0
- package/agent/tools/send_group_notice.ts +23 -0
- package/agent/tools/send_like.ts +20 -0
- package/agent/tools/send_poke.ts +20 -0
- package/agent/tools/set_avatar.ts +19 -0
- package/agent/tools/set_emoji_reaction.ts +20 -0
- package/agent/tools/set_essence_msg.ts +21 -0
- package/agent/tools/set_group_portrait.ts +22 -0
- package/agent/tools/set_online_status.ts +20 -0
- package/agent/tools/set_profile.ts +23 -0
- package/agent/tools/set_signature.ts +19 -0
- package/agent/tools/set_title.ts +23 -0
- package/agent/tools/translate.ts +18 -0
- package/agent/tools/upload_group_file.ts +23 -0
- package/dist/index.js +2 -2
- package/lib/agent/tools/ai_tts.js +21 -0
- package/lib/agent/tools/ai_tts.js.map +1 -0
- package/lib/agent/tools/del_group_notice.js +22 -0
- package/lib/agent/tools/del_group_notice.js.map +1 -0
- package/lib/agent/tools/delete_essence_msg.js +21 -0
- package/lib/agent/tools/delete_essence_msg.js.map +1 -0
- package/lib/agent/tools/delete_friend.js +20 -0
- package/lib/agent/tools/delete_friend.js.map +1 -0
- package/lib/agent/tools/download_file.js +19 -0
- package/lib/agent/tools/download_file.js.map +1 -0
- package/lib/agent/tools/forward_single_msg.js +24 -0
- package/lib/agent/tools/forward_single_msg.js.map +1 -0
- package/lib/agent/tools/get_ai_characters.js +19 -0
- package/lib/agent/tools/get_ai_characters.js.map +1 -0
- package/lib/agent/tools/get_essence_list.js +19 -0
- package/lib/agent/tools/get_essence_list.js.map +1 -0
- package/lib/agent/tools/get_friend_msg_history.js +20 -0
- package/lib/agent/tools/get_friend_msg_history.js.map +1 -0
- package/lib/agent/tools/get_group_file_url.js +21 -0
- package/lib/agent/tools/get_group_file_url.js.map +1 -0
- package/lib/agent/tools/get_group_info_ex.js +19 -0
- package/lib/agent/tools/get_group_info_ex.js.map +1 -0
- package/lib/agent/tools/get_group_msg_history.js +21 -0
- package/lib/agent/tools/get_group_msg_history.js.map +1 -0
- package/lib/agent/tools/get_group_notice.js +19 -0
- package/lib/agent/tools/get_group_notice.js.map +1 -0
- package/lib/agent/tools/get_group_root_files.js +19 -0
- package/lib/agent/tools/get_group_root_files.js.map +1 -0
- package/lib/agent/tools/get_group_shut_list.js +19 -0
- package/lib/agent/tools/get_group_shut_list.js.map +1 -0
- package/lib/agent/tools/get_mini_app_ark.js +22 -0
- package/lib/agent/tools/get_mini_app_ark.js.map +1 -0
- package/lib/agent/tools/get_user_status.js +18 -0
- package/lib/agent/tools/get_user_status.js.map +1 -0
- package/lib/agent/tools/group_sign.js +20 -0
- package/lib/agent/tools/group_sign.js.map +1 -0
- package/lib/agent/tools/mark_msg_as_read.js +19 -0
- package/lib/agent/tools/mark_msg_as_read.js.map +1 -0
- package/lib/agent/tools/ocr_image.js +18 -0
- package/lib/agent/tools/ocr_image.js.map +1 -0
- package/lib/agent/tools/send_forward_msg.js +21 -0
- package/lib/agent/tools/send_forward_msg.js.map +1 -0
- package/lib/agent/tools/send_group_notice.js +23 -0
- package/lib/agent/tools/send_group_notice.js.map +1 -0
- package/lib/agent/tools/send_like.js +20 -0
- package/lib/agent/tools/send_like.js.map +1 -0
- package/lib/agent/tools/send_poke.js +20 -0
- package/lib/agent/tools/send_poke.js.map +1 -0
- package/lib/agent/tools/set_avatar.js +19 -0
- package/lib/agent/tools/set_avatar.js.map +1 -0
- package/lib/agent/tools/set_emoji_reaction.js +20 -0
- package/lib/agent/tools/set_emoji_reaction.js.map +1 -0
- package/lib/agent/tools/set_essence_msg.js +21 -0
- package/lib/agent/tools/set_essence_msg.js.map +1 -0
- package/lib/agent/tools/set_group_portrait.js +22 -0
- package/lib/agent/tools/set_group_portrait.js.map +1 -0
- package/lib/agent/tools/set_online_status.js +20 -0
- package/lib/agent/tools/set_online_status.js.map +1 -0
- package/lib/agent/tools/set_profile.js +23 -0
- package/lib/agent/tools/set_profile.js.map +1 -0
- package/lib/agent/tools/set_signature.js +19 -0
- package/lib/agent/tools/set_signature.js.map +1 -0
- package/lib/agent/tools/set_title.js +23 -0
- package/lib/agent/tools/set_title.js.map +1 -0
- package/lib/agent/tools/translate.js +18 -0
- package/lib/agent/tools/translate.js.map +1 -0
- package/lib/agent/tools/upload_group_file.js +23 -0
- package/lib/agent/tools/upload_group_file.js.map +1 -0
- package/lib/{adapter.js → src/adapter.js} +14 -7
- package/lib/src/adapter.js.map +1 -0
- package/lib/src/agent-prompt.js.map +1 -0
- package/lib/{endpoint-base.js → src/endpoint-base.js} +34 -53
- package/lib/src/endpoint-base.js.map +1 -0
- package/lib/{endpoint-http.js → src/endpoint-http.js} +2 -15
- package/lib/src/endpoint-http.js.map +1 -0
- package/lib/{endpoint-ws-client.js → src/endpoint-ws-client.js} +2 -28
- package/lib/src/endpoint-ws-client.js.map +1 -0
- package/lib/{endpoint-ws-server.js → src/endpoint-ws-server.js} +3 -16
- package/lib/src/endpoint-ws-server.js.map +1 -0
- package/lib/{index.js → src/index.js} +7 -9
- package/lib/src/index.js.map +1 -0
- package/lib/src/napcat-agent-deps.js +19 -0
- package/lib/src/napcat-agent-deps.js.map +1 -0
- package/lib/src/napcat-inbound.js.map +1 -0
- package/lib/src/onebot-get-msg.js.map +1 -0
- package/lib/src/routes.js.map +1 -0
- package/lib/src/segment-mapper.js +2 -0
- package/lib/src/segment-mapper.js.map +1 -0
- package/lib/src/types.js.map +1 -0
- package/package.json +20 -15
- package/src/adapter.ts +14 -7
- package/src/agent-prompt.ts +1 -2
- package/src/endpoint-base.ts +42 -55
- package/src/endpoint-http.ts +2 -16
- package/src/endpoint-ws-client.ts +2 -29
- package/src/endpoint-ws-server.ts +3 -17
- package/src/index.ts +11 -17
- package/src/napcat-agent-deps.ts +29 -0
- package/src/segment-mapper.ts +1 -0
- package/src/types.ts +0 -13
- package/lib/adapter.d.ts +0 -29
- package/lib/adapter.d.ts.map +0 -1
- package/lib/adapter.js.map +0 -1
- package/lib/agent-prompt.d.ts +0 -3
- package/lib/agent-prompt.d.ts.map +0 -1
- package/lib/agent-prompt.js.map +0 -1
- package/lib/endpoint-base.d.ts +0 -143
- package/lib/endpoint-base.d.ts.map +0 -1
- package/lib/endpoint-base.js.map +0 -1
- package/lib/endpoint-http.d.ts +0 -18
- package/lib/endpoint-http.d.ts.map +0 -1
- package/lib/endpoint-http.js.map +0 -1
- package/lib/endpoint-ws-client.d.ts +0 -21
- package/lib/endpoint-ws-client.d.ts.map +0 -1
- package/lib/endpoint-ws-client.js.map +0 -1
- package/lib/endpoint-ws-server.d.ts +0 -21
- package/lib/endpoint-ws-server.d.ts.map +0 -1
- package/lib/endpoint-ws-server.js.map +0 -1
- package/lib/index.d.ts +0 -22
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/napcat-inbound.d.ts +0 -21
- package/lib/napcat-inbound.d.ts.map +0 -1
- package/lib/napcat-inbound.js.map +0 -1
- package/lib/onebot-get-msg.d.ts +0 -3
- package/lib/onebot-get-msg.d.ts.map +0 -1
- package/lib/onebot-get-msg.js.map +0 -1
- package/lib/routes.d.ts +0 -4
- package/lib/routes.d.ts.map +0 -1
- package/lib/routes.js.map +0 -1
- package/lib/tools.d.ts +0 -8
- package/lib/tools.d.ts.map +0 -1
- package/lib/tools.js +0 -605
- package/lib/tools.js.map +0 -1
- package/lib/types.d.ts +0 -293
- package/lib/types.d.ts.map +0 -1
- package/lib/types.js.map +0 -1
- package/lib/typing-indicator.d.ts +0 -45
- package/lib/typing-indicator.d.ts.map +0 -1
- package/lib/typing-indicator.js +0 -132
- package/lib/typing-indicator.js.map +0 -1
- package/src/tools.ts +0 -632
- package/src/typing-indicator.ts +0 -184
- /package/lib/{agent-prompt.js → src/agent-prompt.js} +0 -0
- /package/lib/{napcat-inbound.js → src/napcat-inbound.js} +0 -0
- /package/lib/{onebot-get-msg.js → src/onebot-get-msg.js} +0 -0
- /package/lib/{routes.js → src/routes.js} +0 -0
- /package/lib/{types.js → src/types.js} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/adapter-napcat",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Zhin.js adapter for NapCatQQ (OneBot11 superset with go-cqhttp & NapCat extensions)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"files": [
|
|
16
16
|
"src",
|
|
17
17
|
"lib",
|
|
18
|
+
"agent",
|
|
18
19
|
"client",
|
|
19
20
|
"dist",
|
|
20
|
-
"skills",
|
|
21
21
|
"plugin.yml",
|
|
22
22
|
"README.md",
|
|
23
23
|
"CHANGELOG.md"
|
|
@@ -49,25 +49,27 @@
|
|
|
49
49
|
"ws": "^8.21.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@types/node": "^
|
|
52
|
+
"@types/node": "^26.1.0",
|
|
53
53
|
"@types/react": "^19.2.17",
|
|
54
54
|
"@types/react-dom": "^19.2.3",
|
|
55
55
|
"@types/ws": "^8.18.1",
|
|
56
|
-
"lucide-react": "^1.
|
|
56
|
+
"lucide-react": "^1.22.0",
|
|
57
57
|
"typescript": "^6.0.3",
|
|
58
|
-
"
|
|
59
|
-
"@zhin.js/
|
|
60
|
-
"@zhin.js/
|
|
61
|
-
"@zhin.js/
|
|
62
|
-
"@zhin.js/host-
|
|
63
|
-
"zhin.js": "
|
|
58
|
+
"zod": "^4.4.3",
|
|
59
|
+
"@zhin.js/agent": "1.0.3",
|
|
60
|
+
"@zhin.js/cli": "1.0.93",
|
|
61
|
+
"@zhin.js/contract": "1.0.3",
|
|
62
|
+
"@zhin.js/host-api": "2.0.5",
|
|
63
|
+
"@zhin.js/host-router": "2.0.3",
|
|
64
|
+
"zhin.js": "4.1.2"
|
|
64
65
|
},
|
|
65
66
|
"peerDependencies": {
|
|
66
|
-
"
|
|
67
|
-
"@zhin.js/
|
|
68
|
-
"@zhin.js/
|
|
69
|
-
"@zhin.js/
|
|
70
|
-
"zhin.js": "
|
|
67
|
+
"zod": "^4.0.0",
|
|
68
|
+
"@zhin.js/agent": "1.0.3",
|
|
69
|
+
"@zhin.js/host-api": "2.0.5",
|
|
70
|
+
"@zhin.js/contract": "1.0.3",
|
|
71
|
+
"@zhin.js/host-router": "2.0.3",
|
|
72
|
+
"zhin.js": "4.1.2"
|
|
71
73
|
},
|
|
72
74
|
"peerDependenciesMeta": {
|
|
73
75
|
"@zhin.js/agent": {
|
|
@@ -78,6 +80,9 @@
|
|
|
78
80
|
},
|
|
79
81
|
"@zhin.js/host-router": {
|
|
80
82
|
"optional": true
|
|
83
|
+
},
|
|
84
|
+
"zod": {
|
|
85
|
+
"optional": true
|
|
81
86
|
}
|
|
82
87
|
},
|
|
83
88
|
"publishConfig": {
|
package/src/adapter.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* NapCat 适配器:支持正向 WS / 反向 WS / HTTP
|
|
3
3
|
*/
|
|
4
|
-
import { formatCompact, Adapter, Plugin, OUTBOUND_RICH_SEGMENT_POLICY_IM_FULL } from 'zhin.js';
|
|
4
|
+
import { formatCompact, Adapter, Plugin, OUTBOUND_RICH_SEGMENT_POLICY_IM_FULL, ONEBOT_KEYBOARD_AI_OUTBOUND_EXTENSION } from 'zhin.js';
|
|
5
5
|
import type { Router } from '@zhin.js/host-router';
|
|
6
6
|
import { NapCatWsClient } from './endpoint-ws-client.js';
|
|
7
7
|
import { NapCatWsServer } from './endpoint-ws-server.js';
|
|
@@ -13,6 +13,13 @@ export type NapCatEndpoint = NapCatWsClient | NapCatWsServer | NapCatHttpEndpoin
|
|
|
13
13
|
export class NapCatAdapter extends Adapter<NapCatEndpoint> {
|
|
14
14
|
static override readonly capabilities = ['inbound', 'outbound'] as const;
|
|
15
15
|
static override outboundRichSegmentPolicy = OUTBOUND_RICH_SEGMENT_POLICY_IM_FULL;
|
|
16
|
+
static override interactivePolicy = 'text' as const;
|
|
17
|
+
static override aiOutboundCapabilities = {
|
|
18
|
+
mentions: true,
|
|
19
|
+
richSegments: ['qrcode', 'html', 'markdown', 'tts'],
|
|
20
|
+
interactive: 'text' as const,
|
|
21
|
+
};
|
|
22
|
+
static override aiOutboundExtensions = [ONEBOT_KEYBOARD_AI_OUTBOUND_EXTENSION];
|
|
16
23
|
|
|
17
24
|
#router?: Router;
|
|
18
25
|
|
|
@@ -36,9 +43,9 @@ export class NapCatAdapter extends Adapter<NapCatEndpoint> {
|
|
|
36
43
|
}
|
|
37
44
|
}
|
|
38
45
|
|
|
39
|
-
// ── 群管理接口(
|
|
46
|
+
// ── 群管理接口(ISceneManagement 适配)──────────────────────────
|
|
40
47
|
|
|
41
|
-
async
|
|
48
|
+
async removeMember(endpointId: string, sceneId: string, userId: string) {
|
|
42
49
|
const endpoint = this.endpoints.get(endpointId);
|
|
43
50
|
if (!endpoint) throw new Error(`Endpoint ${endpointId} not found`);
|
|
44
51
|
return endpoint.kickMember(Number(sceneId), Number(userId));
|
|
@@ -50,13 +57,13 @@ export class NapCatAdapter extends Adapter<NapCatEndpoint> {
|
|
|
50
57
|
return endpoint.muteMember(Number(sceneId), Number(userId), duration);
|
|
51
58
|
}
|
|
52
59
|
|
|
53
|
-
async
|
|
60
|
+
async setSceneMuted(endpointId: string, sceneId: string, enable = true) {
|
|
54
61
|
const endpoint = this.endpoints.get(endpointId);
|
|
55
62
|
if (!endpoint) throw new Error(`Endpoint ${endpointId} not found`);
|
|
56
63
|
return endpoint.muteAll(Number(sceneId), enable);
|
|
57
64
|
}
|
|
58
65
|
|
|
59
|
-
async
|
|
66
|
+
async setModerator(endpointId: string, sceneId: string, userId: string, enable = true) {
|
|
60
67
|
const endpoint = this.endpoints.get(endpointId);
|
|
61
68
|
if (!endpoint) throw new Error(`Endpoint ${endpointId} not found`);
|
|
62
69
|
return endpoint.setAdmin(Number(sceneId), Number(userId), enable);
|
|
@@ -68,7 +75,7 @@ export class NapCatAdapter extends Adapter<NapCatEndpoint> {
|
|
|
68
75
|
return endpoint.setCard(Number(sceneId), Number(userId), nickname);
|
|
69
76
|
}
|
|
70
77
|
|
|
71
|
-
async
|
|
78
|
+
async renameScene(endpointId: string, sceneId: string, name: string) {
|
|
72
79
|
const endpoint = this.endpoints.get(endpointId);
|
|
73
80
|
if (!endpoint) throw new Error(`Endpoint ${endpointId} not found`);
|
|
74
81
|
return endpoint.setGroupName(Number(sceneId), name);
|
|
@@ -86,7 +93,7 @@ export class NapCatAdapter extends Adapter<NapCatEndpoint> {
|
|
|
86
93
|
};
|
|
87
94
|
}
|
|
88
95
|
|
|
89
|
-
async
|
|
96
|
+
async getSceneInfo(endpointId: string, sceneId: string) {
|
|
90
97
|
const endpoint = this.endpoints.get(endpointId);
|
|
91
98
|
if (!endpoint) throw new Error(`Endpoint ${endpointId} not found`);
|
|
92
99
|
return endpoint.getGroupInfo(Number(sceneId));
|
package/src/agent-prompt.ts
CHANGED
|
@@ -4,8 +4,7 @@ import type {
|
|
|
4
4
|
AgentPromptSection,
|
|
5
5
|
DeferredToolCatalogItem,
|
|
6
6
|
} from 'zhin.js';
|
|
7
|
-
import type
|
|
8
|
-
import { filterTools } from 'zhin.js/ai';
|
|
7
|
+
import { filterTools, type AgentTool } from 'zhin.js/ai';
|
|
9
8
|
|
|
10
9
|
function isNapCatDelegatedTask(query: string, goal: string): boolean {
|
|
11
10
|
const text = `${query} ${goal}`;
|
package/src/endpoint-base.ts
CHANGED
|
@@ -9,13 +9,18 @@ import {
|
|
|
9
9
|
SendContent,
|
|
10
10
|
SendOptions,
|
|
11
11
|
segment,
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
expandInteractiveSegmentsInContent,
|
|
13
|
+
mapNoticeParts,
|
|
14
|
+
mapRequestParts,
|
|
15
|
+
buildNotice,
|
|
16
|
+
buildRequest,
|
|
17
|
+
senderFromId,
|
|
14
18
|
type QuotedMessagePayload,} from 'zhin.js';
|
|
15
19
|
import { parseOneBotGetMsgResponse } from './onebot-get-msg.js';
|
|
16
20
|
import type { NapCatEndpointConfig, NapCatMessageEvent, MessageSegment, ApiResponse } from './types.js';
|
|
17
21
|
import type { NapCatAdapter } from './adapter.js';
|
|
18
22
|
import { InboundMessageDeduper, isSelfMessage, normalizeMessage, resolveSideEventDedupeKey } from './napcat-inbound.js';
|
|
23
|
+
import { fromCanonicalSegments, toCanonicalSegments } from './segment-mapper.js';
|
|
19
24
|
|
|
20
25
|
export abstract class NapCatEndpointBase extends EventEmitter implements Endpoint<NapCatEndpointConfig, NapCatMessageEvent> {
|
|
21
26
|
$connected = false;
|
|
@@ -36,10 +41,18 @@ export abstract class NapCatEndpointBase extends EventEmitter implements Endpoin
|
|
|
36
41
|
// 消息格式化
|
|
37
42
|
// ══════════════════════════════════════════════════════════════════
|
|
38
43
|
|
|
44
|
+
private toWireSendContent(content: SendContent): MessageSegment[] {
|
|
45
|
+
const items = (Array.isArray(content) ? content : [content]).map((item) =>
|
|
46
|
+
typeof item === 'string' ? { type: 'text', data: { text: item } } : item as MessageSegment,
|
|
47
|
+
);
|
|
48
|
+
return fromCanonicalSegments(toCanonicalSegments(items)) as MessageSegment[];
|
|
49
|
+
}
|
|
50
|
+
|
|
39
51
|
$formatMessage(ev: NapCatMessageEvent): Message<NapCatMessageEvent> {
|
|
40
|
-
const
|
|
41
|
-
const quoteId = Message.quoteIdFromContent(
|
|
42
|
-
Message.alignReplySegments(
|
|
52
|
+
const wire = normalizeMessage(ev.message);
|
|
53
|
+
const quoteId = Message.quoteIdFromContent(wire);
|
|
54
|
+
Message.alignReplySegments(wire, quoteId);
|
|
55
|
+
const content = toCanonicalSegments(wire);
|
|
43
56
|
|
|
44
57
|
const message = Message.from(ev, {
|
|
45
58
|
$id: ev.message_id.toString(),
|
|
@@ -75,7 +88,8 @@ export abstract class NapCatEndpointBase extends EventEmitter implements Endpoin
|
|
|
75
88
|
}
|
|
76
89
|
|
|
77
90
|
async $sendMessage(options: SendOptions): Promise<string> {
|
|
78
|
-
const
|
|
91
|
+
const content = this.toWireSendContent(expandInteractiveSegmentsInContent(options.content));
|
|
92
|
+
const msg: any = { message: content };
|
|
79
93
|
if (options.type === 'group') {
|
|
80
94
|
const result = await this.callApi<{ message_id: number }>('send_group_msg', { group_id: parseInt(options.id), ...msg });
|
|
81
95
|
this.logger.debug(`${this.$id} send group(${options.id}):${segment.raw(options.content)}`);
|
|
@@ -136,70 +150,43 @@ export abstract class NapCatEndpointBase extends EventEmitter implements Endpoin
|
|
|
136
150
|
private handleNotice(event: any): void {
|
|
137
151
|
const dedupeKey = resolveSideEventDedupeKey(event, 'notice');
|
|
138
152
|
if (!this.inboundDeduper.shouldProcess(dedupeKey)) return;
|
|
139
|
-
const noticeTypeMap: Record<string, string> = {
|
|
140
|
-
group_increase: 'group_member_increase',
|
|
141
|
-
group_decrease: 'group_member_decrease',
|
|
142
|
-
group_admin: 'group_admin_change',
|
|
143
|
-
group_ban: 'group_ban',
|
|
144
|
-
group_recall: 'group_recall',
|
|
145
|
-
friend_recall: 'friend_recall',
|
|
146
|
-
friend_add: 'friend_add',
|
|
147
|
-
group_upload: 'group_upload',
|
|
148
|
-
group_card: 'group_card_change',
|
|
149
|
-
essence: event.sub_type === 'add' ? 'essence_add' : 'essence_delete',
|
|
150
|
-
notify: this.resolveNotifyType(event),
|
|
151
|
-
group_msg_emoji_like: 'group_emoji_reaction',
|
|
152
|
-
};
|
|
153
|
-
const $type = noticeTypeMap[event.notice_type] || event.notice_type;
|
|
154
153
|
const isGroup = !!event.group_id;
|
|
155
|
-
const
|
|
154
|
+
const { scene_type, sub_type } = mapNoticeParts('napcat', event.notice_type ?? '', {
|
|
155
|
+
sub_type: event.sub_type,
|
|
156
|
+
is_group: isGroup,
|
|
157
|
+
});
|
|
158
|
+
const sceneId = String((event.group_id || event.user_id) ?? '');
|
|
159
|
+
const notice = buildNotice(event, {
|
|
156
160
|
$id: `${event.time}_${event.notice_type}_${event.group_id || event.user_id}`,
|
|
157
161
|
$adapter: 'napcat',
|
|
158
162
|
$endpoint: this.$config.name,
|
|
159
|
-
$type,
|
|
160
|
-
$
|
|
161
|
-
$
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
$
|
|
166
|
-
$target: event.user_id ? { id: event.user_id.toString(), name: event.user_id.toString() } : undefined,
|
|
167
|
-
$timestamp: event.time || Math.floor(Date.now() / 1000),
|
|
163
|
+
$type: 'notice',
|
|
164
|
+
$scene_id: sceneId,
|
|
165
|
+
$scene_type: scene_type,
|
|
166
|
+
$sub_type: sub_type,
|
|
167
|
+
$actor: senderFromId(event.operator_id),
|
|
168
|
+
$target: senderFromId(event.user_id),
|
|
169
|
+
$timestamp: (event.time || Math.floor(Date.now() / 1000)) * 1000,
|
|
168
170
|
});
|
|
169
171
|
this.adapter.emit('notice.receive', notice);
|
|
170
172
|
}
|
|
171
173
|
|
|
172
|
-
private resolveNotifyType(event: any): string {
|
|
173
|
-
switch (event.sub_type) {
|
|
174
|
-
case 'poke': return event.group_id ? 'group_poke' : 'friend_poke';
|
|
175
|
-
case 'input_status': return 'input_status';
|
|
176
|
-
case 'title': return 'title_change';
|
|
177
|
-
case 'profile_like': return 'profile_like';
|
|
178
|
-
default: return `notify_${event.sub_type}`;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
174
|
private handleRequest(event: any): void {
|
|
183
175
|
const dedupeKey = resolveSideEventDedupeKey(event, 'request');
|
|
184
176
|
if (!this.inboundDeduper.shouldProcess(dedupeKey)) return;
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
};
|
|
189
|
-
const $type = typeMap[event.request_type] || event.request_type;
|
|
190
|
-
const request = Request.from(event, {
|
|
177
|
+
const { scene_type, sub_type } = mapRequestParts('napcat', event.request_type ?? '', event.sub_type);
|
|
178
|
+
const sceneId = String((event.group_id || event.user_id) ?? '');
|
|
179
|
+
const request = buildRequest(event, {
|
|
191
180
|
$id: event.flag || `${event.time}_${event.request_type}_${event.user_id}`,
|
|
192
181
|
$adapter: 'napcat',
|
|
193
182
|
$endpoint: this.$config.name,
|
|
194
|
-
$type,
|
|
195
|
-
$
|
|
196
|
-
$
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
},
|
|
200
|
-
$sender: { id: event.user_id?.toString() || '', name: event.user_id?.toString() || '' },
|
|
183
|
+
$type: 'request',
|
|
184
|
+
$scene_id: sceneId,
|
|
185
|
+
$scene_type: scene_type,
|
|
186
|
+
$sub_type: sub_type,
|
|
187
|
+
$actor: senderFromId(event.user_id) ?? { id: '', name: '' },
|
|
201
188
|
$comment: event.comment,
|
|
202
|
-
$timestamp: event.time || Math.floor(Date.now() / 1000),
|
|
189
|
+
$timestamp: (event.time || Math.floor(Date.now() / 1000)) * 1000,
|
|
203
190
|
$approve: async (remark?: string) => {
|
|
204
191
|
await this.callApi(
|
|
205
192
|
event.request_type === 'friend' ? 'set_friend_add_request' : 'set_group_add_request',
|
package/src/endpoint-http.ts
CHANGED
|
@@ -9,7 +9,6 @@ import type { NapCatHttpConfig, ApiResponse } from './types.js';
|
|
|
9
9
|
import type { NapCatAdapter } from './adapter.js';
|
|
10
10
|
import { registerFetchRoute, type Router, type RouterContext } from '@zhin.js/host-router/router';
|
|
11
11
|
import * as crypto from 'crypto';
|
|
12
|
-
import { enableTypingIndicator } from './typing-indicator.js';
|
|
13
12
|
|
|
14
13
|
export class NapCatHttpEndpoint extends NapCatEndpointBase {
|
|
15
14
|
private pollTimer?: NodeJS.Timeout;
|
|
@@ -25,8 +24,7 @@ export class NapCatHttpEndpoint extends NapCatEndpointBase {
|
|
|
25
24
|
await this.checkConnection();
|
|
26
25
|
this.startPoll();
|
|
27
26
|
this.$connected = true;
|
|
28
|
-
this.
|
|
29
|
-
this.logger.info(formatCompact({ endpoint: this.$id, mode: 'http' }));
|
|
27
|
+
this.logger.debug(formatCompact({ endpoint: this.$id, mode: 'http' }));
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
async $disconnect(): Promise<void> {
|
|
@@ -72,7 +70,7 @@ export class NapCatHttpEndpoint extends NapCatEndpointBase {
|
|
|
72
70
|
this.logger.warn(formatCompact( { op: 'recv', endpoint: this.$id, ok: false, error: String(e) }));
|
|
73
71
|
}
|
|
74
72
|
});
|
|
75
|
-
this.logger.
|
|
73
|
+
this.logger.debug(formatCompact( { op: 'webhook', endpoint: this.$id, path: postPath }));
|
|
76
74
|
}
|
|
77
75
|
|
|
78
76
|
private async checkConnection(): Promise<void> {
|
|
@@ -94,16 +92,4 @@ export class NapCatHttpEndpoint extends NapCatEndpointBase {
|
|
|
94
92
|
}
|
|
95
93
|
}, interval);
|
|
96
94
|
}
|
|
97
|
-
|
|
98
|
-
private initTypingIndicator(): void {
|
|
99
|
-
const tiConfig = (this.$config as any).typingIndicator;
|
|
100
|
-
if (tiConfig && tiConfig.enabled !== false) {
|
|
101
|
-
enableTypingIndicator(this, {
|
|
102
|
-
enabled: true,
|
|
103
|
-
defaultEmoji: tiConfig.defaultEmoji || '128516',
|
|
104
|
-
autoRemove: true,
|
|
105
|
-
removeDelay: 5000,
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
95
|
}
|
|
@@ -6,7 +6,6 @@ import { formatCompact } from 'zhin.js';
|
|
|
6
6
|
import { NapCatEndpointBase } from './endpoint-base.js';
|
|
7
7
|
import type { NapCatWsClientConfig, ApiResponse } from './types.js';
|
|
8
8
|
import type { NapCatAdapter } from './adapter.js';
|
|
9
|
-
import { enableTypingIndicator } from './typing-indicator.js';
|
|
10
9
|
|
|
11
10
|
export class NapCatWsClient extends NapCatEndpointBase {
|
|
12
11
|
private ws?: WebSocket;
|
|
@@ -42,9 +41,8 @@ export class NapCatWsClient extends NapCatEndpointBase {
|
|
|
42
41
|
if (!this.$config.access_token) {
|
|
43
42
|
this.logger.warn(formatCompact({ endpoint: this.$id, ok: false, error: 'missing access_token' }));
|
|
44
43
|
}
|
|
45
|
-
this.logger.
|
|
44
|
+
this.logger.debug(formatCompact({ endpoint: this.$id, mode: 'ws' }));
|
|
46
45
|
this.startHeartbeat();
|
|
47
|
-
this.initTypingIndicator();
|
|
48
46
|
resolve();
|
|
49
47
|
});
|
|
50
48
|
|
|
@@ -133,32 +131,7 @@ export class NapCatWsClient extends NapCatEndpointBase {
|
|
|
133
131
|
|
|
134
132
|
protected handleMeta(event: any): void {
|
|
135
133
|
if (event.meta_event_type === 'lifecycle' && event.sub_type === 'connect') {
|
|
136
|
-
this.logger.
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
private initTypingIndicator(): void {
|
|
141
|
-
const tiConfig = this.$config.typingIndicator;
|
|
142
|
-
if (tiConfig && tiConfig.enabled !== false) {
|
|
143
|
-
enableTypingIndicator(this, {
|
|
144
|
-
enabled: tiConfig.enabled ?? true,
|
|
145
|
-
defaultEmoji: tiConfig.defaultEmoji || '128516',
|
|
146
|
-
autoRemove: true,
|
|
147
|
-
removeDelay: 5000,
|
|
148
|
-
privateConfig: tiConfig.privateConfig ? {
|
|
149
|
-
type: tiConfig.privateConfig.type || 'message',
|
|
150
|
-
message: tiConfig.privateConfig.message || '正在思考中...',
|
|
151
|
-
autoRemove: true,
|
|
152
|
-
removeDelay: 3000,
|
|
153
|
-
} : undefined,
|
|
154
|
-
groupConfig: tiConfig.groupConfig ? {
|
|
155
|
-
type: tiConfig.groupConfig.type || 'reaction',
|
|
156
|
-
emoji: tiConfig.groupConfig.emoji || '128516',
|
|
157
|
-
autoRemove: true,
|
|
158
|
-
removeDelay: 5000,
|
|
159
|
-
} : undefined,
|
|
160
|
-
});
|
|
161
|
-
this.logger.info(formatCompact({ endpoint: this.$id, typingIndicator: 'enabled' }));
|
|
134
|
+
this.logger.debug(formatCompact({ endpoint: this.$id, lifecycle: 'connect', self_id: event.self_id }));
|
|
162
135
|
}
|
|
163
136
|
}
|
|
164
137
|
}
|
|
@@ -8,7 +8,6 @@ import { NapCatEndpointBase } from './endpoint-base.js';
|
|
|
8
8
|
import type { NapCatWsServerConfig, ApiResponse } from './types.js';
|
|
9
9
|
import type { NapCatAdapter } from './adapter.js';
|
|
10
10
|
import type { Router } from '@zhin.js/host-router';
|
|
11
|
-
import { enableTypingIndicator } from './typing-indicator.js';
|
|
12
11
|
|
|
13
12
|
export class NapCatWsServer extends NapCatEndpointBase {
|
|
14
13
|
#wss?: WebSocketServer;
|
|
@@ -41,11 +40,11 @@ export class NapCatWsServer extends NapCatEndpointBase {
|
|
|
41
40
|
return true;
|
|
42
41
|
},
|
|
43
42
|
});
|
|
44
|
-
this.logger.
|
|
43
|
+
this.logger.debug(formatCompact( { op: 'listen', endpoint: this.$id, mode: 'wss', path: this.$config.path }));
|
|
45
44
|
|
|
46
45
|
this.#wss.on('connection', (client, req) => {
|
|
47
46
|
this.startHeartbeat();
|
|
48
|
-
this.logger.
|
|
47
|
+
this.logger.debug(formatCompact({ endpoint: this.$id, peer: req.socket.remoteAddress }));
|
|
49
48
|
|
|
50
49
|
client.on('error', (err) => this.logger.warn(formatCompact( {
|
|
51
50
|
op: 'ws_error',
|
|
@@ -119,8 +118,7 @@ export class NapCatWsServer extends NapCatEndpointBase {
|
|
|
119
118
|
if (message.post_type === 'meta_event' && message.sub_type === 'connect') {
|
|
120
119
|
this.#clientMap.set(String(message.self_id), client);
|
|
121
120
|
this.$connected = true;
|
|
122
|
-
this.logger.
|
|
123
|
-
this.initTypingIndicator();
|
|
121
|
+
this.logger.debug(formatCompact({ endpoint: this.$id, self_id: message.self_id }));
|
|
124
122
|
return;
|
|
125
123
|
}
|
|
126
124
|
this.dispatchEvent(message);
|
|
@@ -135,16 +133,4 @@ export class NapCatWsServer extends NapCatEndpointBase {
|
|
|
135
133
|
}
|
|
136
134
|
}, interval);
|
|
137
135
|
}
|
|
138
|
-
|
|
139
|
-
private initTypingIndicator(): void {
|
|
140
|
-
const tiConfig = (this.$config as any).typingIndicator;
|
|
141
|
-
if (tiConfig && tiConfig.enabled !== false) {
|
|
142
|
-
enableTypingIndicator(this, {
|
|
143
|
-
enabled: true,
|
|
144
|
-
defaultEmoji: tiConfig.defaultEmoji || '128516',
|
|
145
|
-
autoRemove: true,
|
|
146
|
-
removeDelay: 5000,
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
136
|
}
|
package/src/index.ts
CHANGED
|
@@ -8,18 +8,18 @@ import {
|
|
|
8
8
|
usePlugin,
|
|
9
9
|
type Plugin,
|
|
10
10
|
type Context,
|
|
11
|
-
type
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
type ISceneManagement,
|
|
12
|
+
createSceneManagementTools,
|
|
13
|
+
registerDefaultScenePlatformPermitChecker,
|
|
14
14
|
type ToolFeature,
|
|
15
15
|
} from 'zhin.js';
|
|
16
16
|
import { registerAgentPromptContributor, unregisterAgentPromptContributor } from 'zhin.js/agent';
|
|
17
17
|
import type { Router } from '@zhin.js/host-router';
|
|
18
18
|
import { PageManager } from '@zhin.js/host-api';
|
|
19
19
|
import { NapCatAdapter } from './adapter.js';
|
|
20
|
-
import { createNapCatTools } from './tools.js';
|
|
21
20
|
import { createNapCatAgentPromptContributor } from './agent-prompt.js';
|
|
22
21
|
import { registerRoutes } from './routes.js';
|
|
22
|
+
import { setNapcatAgentDeps } from './napcat-agent-deps.js';
|
|
23
23
|
|
|
24
24
|
export * from './types.js';
|
|
25
25
|
export { NapCatWsClient } from './endpoint-ws-client.js';
|
|
@@ -27,11 +27,6 @@ export { NapCatWsServer } from './endpoint-ws-server.js';
|
|
|
27
27
|
export { NapCatHttpEndpoint } from './endpoint-http.js';
|
|
28
28
|
export { NapCatAdapter, type NapCatEndpoint } from './adapter.js';
|
|
29
29
|
export { NapCatEndpointBase } from './endpoint-base.js';
|
|
30
|
-
export {
|
|
31
|
-
NapCatTypingIndicatorManager,
|
|
32
|
-
enableTypingIndicator,
|
|
33
|
-
type NapCatTypingIndicatorConfig,
|
|
34
|
-
} from './typing-indicator.js';
|
|
35
30
|
|
|
36
31
|
declare module 'zhin.js' {
|
|
37
32
|
namespace Plugin {
|
|
@@ -64,19 +59,18 @@ provide({
|
|
|
64
59
|
},
|
|
65
60
|
} as unknown as Context<'napcat'>);
|
|
66
61
|
|
|
67
|
-
// ── AI
|
|
62
|
+
// ── AI 工具注册(场景治理;扩展工具见 agent/tools/)────────────────
|
|
68
63
|
useContext('tool', 'napcat', (toolService: ToolFeature, napcat: NapCatAdapter) => {
|
|
64
|
+
setNapcatAgentDeps({ getAdapter: () => napcat });
|
|
65
|
+
|
|
69
66
|
const disposers: (() => void)[] = [];
|
|
70
|
-
disposers.push(
|
|
67
|
+
disposers.push(registerDefaultScenePlatformPermitChecker('napcat'));
|
|
71
68
|
|
|
72
|
-
const
|
|
73
|
-
napcat as unknown as
|
|
69
|
+
const sceneTools = createSceneManagementTools(
|
|
70
|
+
napcat as unknown as ISceneManagement,
|
|
74
71
|
'napcat',
|
|
75
72
|
);
|
|
76
|
-
disposers.push(...
|
|
77
|
-
|
|
78
|
-
const napcatTools = createNapCatTools(napcat);
|
|
79
|
-
disposers.push(...napcatTools.map(t => toolService.addTool(t, plugin.name)));
|
|
73
|
+
disposers.push(...sceneTools.map(t => toolService.addTool(t, plugin.name)));
|
|
80
74
|
|
|
81
75
|
return () => disposers.forEach(d => d());
|
|
82
76
|
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared runtime deps for napcat agent/ authoring tools.
|
|
3
|
+
*/
|
|
4
|
+
import type { NapCatAdapter, NapCatEndpoint } from './adapter.js';
|
|
5
|
+
|
|
6
|
+
export interface NapcatAgentDeps {
|
|
7
|
+
getAdapter: () => NapCatAdapter;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let _deps: NapcatAgentDeps | null = null;
|
|
11
|
+
|
|
12
|
+
export function setNapcatAgentDeps(deps: NapcatAgentDeps): void {
|
|
13
|
+
_deps = deps;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function getNapcatAgentDeps(): NapcatAgentDeps {
|
|
17
|
+
if (!_deps) throw new Error('napcat agent deps not initialized');
|
|
18
|
+
return _deps;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function getAdapter(): NapCatAdapter {
|
|
22
|
+
return getNapcatAgentDeps().getAdapter();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function getEndpoint(endpointId: string): NapCatEndpoint {
|
|
26
|
+
const endpoint = getAdapter().endpoints.get(endpointId);
|
|
27
|
+
if (!endpoint) throw new Error(`Endpoint ${endpointId} not found`);
|
|
28
|
+
return endpoint;
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { toCanonicalSegments, fromCanonicalSegments } from 'zhin.js';
|
package/src/types.ts
CHANGED
|
@@ -5,23 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
// ── 配置 ─────────────────────────────────────────────────────────────
|
|
7
7
|
|
|
8
|
-
export interface TypingIndicatorConfig {
|
|
9
|
-
/** 是否启用(默认 true) */
|
|
10
|
-
enabled?: boolean;
|
|
11
|
-
/** 默认表情 ID */
|
|
12
|
-
defaultEmoji?: string;
|
|
13
|
-
/** 私聊配置 */
|
|
14
|
-
privateConfig?: { type?: 'message' | 'typing'; message?: string };
|
|
15
|
-
/** 群聊配置 */
|
|
16
|
-
groupConfig?: { type?: 'reaction'; emoji?: string };
|
|
17
|
-
}
|
|
18
|
-
|
|
19
8
|
export interface NapCatConfigBase {
|
|
20
9
|
context: 'napcat';
|
|
21
10
|
name: string;
|
|
22
11
|
access_token?: string;
|
|
23
|
-
/** Typing Indicator 配置 */
|
|
24
|
-
typingIndicator?: TypingIndicatorConfig;
|
|
25
12
|
}
|
|
26
13
|
|
|
27
14
|
/** 正向 WebSocket */
|
package/lib/adapter.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NapCat 适配器:支持正向 WS / 反向 WS / HTTP
|
|
3
|
-
*/
|
|
4
|
-
import { Adapter, Plugin } from 'zhin.js';
|
|
5
|
-
import { NapCatWsClient } from './endpoint-ws-client.js';
|
|
6
|
-
import { NapCatWsServer } from './endpoint-ws-server.js';
|
|
7
|
-
import { NapCatHttpEndpoint } from './endpoint-http.js';
|
|
8
|
-
import type { NapCatEndpointConfig } from './types.js';
|
|
9
|
-
export type NapCatEndpoint = NapCatWsClient | NapCatWsServer | NapCatHttpEndpoint;
|
|
10
|
-
export declare class NapCatAdapter extends Adapter<NapCatEndpoint> {
|
|
11
|
-
#private;
|
|
12
|
-
static readonly capabilities: readonly ["inbound", "outbound"];
|
|
13
|
-
static outboundRichSegmentPolicy: import("zhin.js").OutboundRichSegmentPolicy;
|
|
14
|
-
constructor(plugin: Plugin);
|
|
15
|
-
createEndpoint(config: NapCatEndpointConfig): NapCatEndpoint;
|
|
16
|
-
kickMember(endpointId: string, sceneId: string, userId: string): Promise<boolean>;
|
|
17
|
-
muteMember(endpointId: string, sceneId: string, userId: string, duration?: number): Promise<boolean>;
|
|
18
|
-
muteAll(endpointId: string, sceneId: string, enable?: boolean): Promise<boolean>;
|
|
19
|
-
setAdmin(endpointId: string, sceneId: string, userId: string, enable?: boolean): Promise<boolean>;
|
|
20
|
-
setMemberNickname(endpointId: string, sceneId: string, userId: string, nickname: string): Promise<boolean>;
|
|
21
|
-
setGroupName(endpointId: string, sceneId: string, name: string): Promise<any>;
|
|
22
|
-
listMembers(endpointId: string, sceneId: string): Promise<{
|
|
23
|
-
members: any;
|
|
24
|
-
count: any;
|
|
25
|
-
}>;
|
|
26
|
-
getGroupInfo(endpointId: string, sceneId: string): Promise<any>;
|
|
27
|
-
start(): Promise<void>;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=adapter.d.ts.map
|
package/lib/adapter.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAiB,OAAO,EAAE,MAAM,EAAwC,MAAM,SAAS,CAAC;AAE/F,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,oBAAoB,EAAgE,MAAM,YAAY,CAAC;AAErH,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,cAAc,GAAG,kBAAkB,CAAC;AAElF,qBAAa,aAAc,SAAQ,OAAO,CAAC,cAAc,CAAC;;IACxD,gBAAyB,YAAY,mCAAoC;IACzE,OAAgB,yBAAyB,8CAAwC;gBAIrE,MAAM,EAAE,MAAM;IAI1B,cAAc,CAAC,MAAM,EAAE,oBAAoB,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AG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAChD,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,YAAY,UAAU,YAAY,CAAC,CAAC;QACnE,OAAO,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,OAAO,GAAI,IAAI,CAAC,MAAM,CAAC,MAA8C,CAAC,QAAQ,CAAC,CAAC;QACpF,IAAI,CAAC,MAAM,CAAC,UAAkE,CAAC,QAAQ,EAAE,CAAC,MAAc,EAAE,EAAE;YAC3G,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACxB,CAAC,CAAC,CAAC;QACH,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC"}
|
package/lib/agent-prompt.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-prompt.d.ts","sourceRoot":"","sources":["../src/agent-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,sBAAsB,EAGvB,MAAM,SAAS,CAAC;AAwEjB,wBAAgB,kCAAkC,IAAI,sBAAsB,CAsC3E"}
|
package/lib/agent-prompt.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-prompt.js","sourceRoot":"","sources":["../src/agent-prompt.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,SAAS,qBAAqB,CAAC,KAAa,EAAE,IAAY;IACxD,MAAM,IAAI,GAAG,GAAG,KAAK,IAAI,IAAI,EAAE,CAAC;IAChC,IAAI,gCAAgC,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7D,IAAI,gCAAgC,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7D,IAAI,i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