@zhin.js/adapter-weixin-ilink 3.0.1 → 3.0.3
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 +46 -0
- package/README.md +16 -39
- package/adapters/weixin-ilink.ts +30 -0
- package/lib/aes-ecb.d.ts +0 -1
- package/lib/aes-ecb.js +0 -1
- package/lib/cdn-upload.d.ts +0 -1
- package/lib/cdn-upload.js +0 -1
- package/lib/cdn-url.d.ts +0 -1
- package/lib/cdn-url.js +0 -1
- package/lib/context-store.d.ts +0 -1
- package/lib/context-store.js +0 -1
- package/lib/credentials.d.ts +0 -1
- package/lib/credentials.js +0 -1
- package/lib/endpoint.d.ts +35 -30
- package/lib/endpoint.js +218 -236
- package/lib/ilink-api.d.ts +0 -1
- package/lib/ilink-api.js +0 -1
- package/lib/ilink-config-cache.d.ts +0 -1
- package/lib/ilink-config-cache.js +0 -1
- package/lib/ilink-logger.d.ts +0 -1
- package/lib/ilink-logger.js +0 -1
- package/lib/ilink-meta.d.ts +0 -1
- package/lib/ilink-meta.js +0 -1
- package/lib/ilink-random.d.ts +0 -1
- package/lib/ilink-random.js +0 -1
- package/lib/ilink-redact.d.ts +0 -1
- package/lib/ilink-redact.js +0 -1
- package/lib/ilink-session-guard.d.ts +0 -1
- package/lib/ilink-session-guard.js +0 -1
- package/lib/ilink-types.d.ts +0 -1
- package/lib/ilink-types.js +0 -1
- package/lib/index.d.ts +4 -19
- package/lib/index.js +2 -37
- package/lib/login.d.ts +4 -6
- package/lib/login.js +43 -65
- package/lib/media-download.d.ts +1 -2
- package/lib/media-download.js +1 -2
- package/lib/mime.d.ts +0 -1
- package/lib/mime.js +0 -1
- package/lib/outbound-media.d.ts +4 -4
- package/lib/outbound-media.js +44 -42
- package/lib/pic-decrypt.d.ts +0 -1
- package/lib/pic-decrypt.js +0 -1
- package/lib/protocol.d.ts +52 -0
- package/lib/protocol.js +109 -0
- package/lib/silk-transcode.d.ts +0 -1
- package/lib/silk-transcode.js +0 -1
- package/lib/types.d.ts +2 -16
- package/lib/types.js +0 -1
- package/lib/upload.d.ts +1 -2
- package/lib/upload.js +1 -2
- package/lib/weixin-inbound.d.ts +1 -2
- package/lib/weixin-inbound.js +1 -2
- package/lib/weixin-send-media.d.ts +0 -1
- package/lib/weixin-send-media.js +0 -1
- package/lib/weixin-send.d.ts +1 -2
- package/lib/weixin-send.js +2 -3
- package/package.json +37 -41
- package/plugin.ts +8 -0
- package/schema.json +30 -0
- package/src/endpoint.ts +261 -279
- package/src/index.ts +24 -53
- package/src/login.ts +56 -72
- package/src/media-download.ts +1 -2
- package/src/outbound-media.ts +56 -50
- package/src/protocol.ts +172 -0
- package/src/types.ts +6 -15
- package/src/upload.ts +2 -2
- package/src/weixin-inbound.ts +2 -2
- package/src/weixin-send.ts +4 -4
- package/client/LoginAssistPanel.tsx +0 -200
- package/client/WeixinIlinkManagement.tsx +0 -139
- package/client/index.tsx +0 -11
- package/client/tsconfig.json +0 -13
- package/client/utils/api.ts +0 -30
- package/dist/index.js +0 -29
- package/lib/adapter.d.ts +0 -15
- package/lib/adapter.d.ts.map +0 -1
- package/lib/adapter.js +0 -21
- package/lib/adapter.js.map +0 -1
- package/lib/aes-ecb.d.ts.map +0 -1
- package/lib/aes-ecb.js.map +0 -1
- package/lib/cdn-upload.d.ts.map +0 -1
- package/lib/cdn-upload.js.map +0 -1
- package/lib/cdn-upload.test.d.ts +0 -2
- package/lib/cdn-upload.test.d.ts.map +0 -1
- package/lib/cdn-upload.test.js +0 -150
- package/lib/cdn-upload.test.js.map +0 -1
- package/lib/cdn-url.d.ts.map +0 -1
- package/lib/cdn-url.js.map +0 -1
- package/lib/context-store.d.ts.map +0 -1
- package/lib/context-store.js.map +0 -1
- package/lib/credentials.d.ts.map +0 -1
- package/lib/credentials.js.map +0 -1
- package/lib/endpoint.d.ts.map +0 -1
- package/lib/endpoint.js.map +0 -1
- package/lib/ilink-api.d.ts.map +0 -1
- package/lib/ilink-api.js.map +0 -1
- package/lib/ilink-config-cache.d.ts.map +0 -1
- package/lib/ilink-config-cache.js.map +0 -1
- package/lib/ilink-logger.d.ts.map +0 -1
- package/lib/ilink-logger.js.map +0 -1
- package/lib/ilink-meta.d.ts.map +0 -1
- package/lib/ilink-meta.js.map +0 -1
- package/lib/ilink-random.d.ts.map +0 -1
- package/lib/ilink-random.js.map +0 -1
- package/lib/ilink-redact.d.ts.map +0 -1
- package/lib/ilink-redact.js.map +0 -1
- package/lib/ilink-session-guard.d.ts.map +0 -1
- package/lib/ilink-session-guard.js.map +0 -1
- package/lib/ilink-types.d.ts.map +0 -1
- package/lib/ilink-types.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/login-assist-routes.d.ts +0 -7
- package/lib/login-assist-routes.d.ts.map +0 -1
- package/lib/login-assist-routes.js +0 -29
- package/lib/login-assist-routes.js.map +0 -1
- package/lib/login.d.ts.map +0 -1
- package/lib/login.js.map +0 -1
- package/lib/media-download.d.ts.map +0 -1
- package/lib/media-download.js.map +0 -1
- package/lib/mime.d.ts.map +0 -1
- package/lib/mime.js.map +0 -1
- package/lib/mime.test.d.ts +0 -2
- package/lib/mime.test.d.ts.map +0 -1
- package/lib/mime.test.js +0 -62
- package/lib/mime.test.js.map +0 -1
- package/lib/outbound-media.d.ts.map +0 -1
- package/lib/outbound-media.js.map +0 -1
- package/lib/pic-decrypt.d.ts.map +0 -1
- package/lib/pic-decrypt.js.map +0 -1
- package/lib/routes.d.ts +0 -8
- package/lib/routes.d.ts.map +0 -1
- package/lib/routes.js +0 -29
- package/lib/routes.js.map +0 -1
- package/lib/segment-mapper.d.ts +0 -2
- package/lib/segment-mapper.d.ts.map +0 -1
- package/lib/segment-mapper.js +0 -2
- package/lib/segment-mapper.js.map +0 -1
- package/lib/silk-transcode.d.ts.map +0 -1
- package/lib/silk-transcode.js.map +0 -1
- package/lib/silk-transcode.test.d.ts +0 -2
- package/lib/silk-transcode.test.d.ts.map +0 -1
- package/lib/silk-transcode.test.js +0 -53
- package/lib/silk-transcode.test.js.map +0 -1
- package/lib/types.d.ts.map +0 -1
- package/lib/types.js.map +0 -1
- package/lib/upload.d.ts.map +0 -1
- package/lib/upload.js.map +0 -1
- package/lib/upload.test.d.ts +0 -2
- package/lib/upload.test.d.ts.map +0 -1
- package/lib/upload.test.js +0 -250
- package/lib/upload.test.js.map +0 -1
- package/lib/weixin-inbound.d.ts.map +0 -1
- package/lib/weixin-inbound.js.map +0 -1
- package/lib/weixin-send-media.d.ts.map +0 -1
- package/lib/weixin-send-media.js.map +0 -1
- package/lib/weixin-send.d.ts.map +0 -1
- package/lib/weixin-send.js.map +0 -1
- package/src/adapter.ts +0 -25
- package/src/login-assist-routes.ts +0 -36
- package/src/routes.ts +0 -39
- package/src/segment-mapper.ts +0 -1
package/lib/protocol.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Weixin iLink protocol helpers (no legacy Adapter/Endpoint / segment-mapper).
|
|
3
|
+
* Canonicalization is owned by gateway/core before endpoint.send.
|
|
4
|
+
*/
|
|
5
|
+
import { pickCredential } from '@zhin.js/adapter';
|
|
6
|
+
import { bodyFromItemList, isMediaItem } from './weixin-inbound.js';
|
|
7
|
+
import { DEFAULT_API_BASE_URL, DEFAULT_CDN_BASE_URL } from './ilink-meta.js';
|
|
8
|
+
const DEFAULT_LONG_POLL_TIMEOUT_MS = 35_000;
|
|
9
|
+
export function resolveWeixinIlinkConfig(config = {}) {
|
|
10
|
+
const entry = config.endpoints?.find((item) => item.context === 'weixin-ilink');
|
|
11
|
+
const name = (typeof config.name === 'string' && config.name)
|
|
12
|
+
|| (typeof entry?.name === 'string' && entry.name)
|
|
13
|
+
|| process.env.WEIXIN_ILINK_BOT_NAME
|
|
14
|
+
|| 'weixin-ilink-bot';
|
|
15
|
+
const botToken = pickCredential(typeof config.botToken === 'string' ? config.botToken.trim() : config.botToken, typeof entry?.botToken === 'string' ? entry.botToken.trim() : entry?.botToken, process.env.WEIXIN_ILINK_TOKEN?.trim());
|
|
16
|
+
// No throw here: missing botToken is resolved later by resolveCredentials()
|
|
17
|
+
// (sidecar credentials file / QR login) during endpoint.start().
|
|
18
|
+
return {
|
|
19
|
+
context: 'weixin-ilink',
|
|
20
|
+
name,
|
|
21
|
+
botAgent: config.botAgent ?? entry?.botAgent,
|
|
22
|
+
baseUrl: config.baseUrl ?? entry?.baseUrl ?? DEFAULT_API_BASE_URL,
|
|
23
|
+
cdnBaseUrl: config.cdnBaseUrl ?? entry?.cdnBaseUrl ?? DEFAULT_CDN_BASE_URL,
|
|
24
|
+
longPollTimeoutMs: config.longPollTimeoutMs
|
|
25
|
+
?? entry?.longPollTimeoutMs
|
|
26
|
+
?? DEFAULT_LONG_POLL_TIMEOUT_MS,
|
|
27
|
+
botToken,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** Build inbound text for MessageGateway.receive (gateway owns reply routing). */
|
|
31
|
+
export function formatInboundContent(msg) {
|
|
32
|
+
const parts = [];
|
|
33
|
+
const text = bodyFromItemList(msg.item_list);
|
|
34
|
+
if (text)
|
|
35
|
+
parts.push(text);
|
|
36
|
+
const media = msg._media;
|
|
37
|
+
if (media?.decryptedPicPath) {
|
|
38
|
+
parts.push(`[image: ${media.decryptedPicPath}]`);
|
|
39
|
+
}
|
|
40
|
+
else if (media?.decryptedVideoPath) {
|
|
41
|
+
parts.push(`[video: ${media.decryptedVideoPath}]`);
|
|
42
|
+
}
|
|
43
|
+
else if (media?.decryptedFilePath) {
|
|
44
|
+
parts.push(`[file: ${media.decryptedFilePath}]`);
|
|
45
|
+
}
|
|
46
|
+
else if (media?.decryptedVoicePath) {
|
|
47
|
+
parts.push(`[record: ${media.decryptedVoicePath}]`);
|
|
48
|
+
}
|
|
49
|
+
else if (!text && msg.item_list?.some((item) => isMediaItem(item))) {
|
|
50
|
+
parts.push('[媒体消息]');
|
|
51
|
+
}
|
|
52
|
+
return parts.join('\n').trim() || '';
|
|
53
|
+
}
|
|
54
|
+
export function inboundMessageId(msg) {
|
|
55
|
+
return String(msg.message_id ?? msg.client_id ?? msg.seq ?? Date.now());
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Wire-encode an already-rendered outbound payload into Weixin wire segments.
|
|
59
|
+
* Segment canonicalization is intentionally not done here.
|
|
60
|
+
*/
|
|
61
|
+
export function formatOutboundSegments(payload) {
|
|
62
|
+
if (typeof payload === 'string') {
|
|
63
|
+
return [{ type: 'text', data: { text: payload } }];
|
|
64
|
+
}
|
|
65
|
+
const items = Array.isArray(payload)
|
|
66
|
+
? payload
|
|
67
|
+
: payload && typeof payload === 'object' && 'type' in payload
|
|
68
|
+
? [payload]
|
|
69
|
+
: [];
|
|
70
|
+
if (items.length === 0) {
|
|
71
|
+
const text = payload == null
|
|
72
|
+
? ''
|
|
73
|
+
: typeof payload === 'object'
|
|
74
|
+
? JSON.stringify(payload)
|
|
75
|
+
: String(payload);
|
|
76
|
+
return [{ type: 'text', data: { text } }];
|
|
77
|
+
}
|
|
78
|
+
const segs = [];
|
|
79
|
+
for (const item of items) {
|
|
80
|
+
if (typeof item === 'string') {
|
|
81
|
+
segs.push({ type: 'text', data: { text: item } });
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
segs.push({ type: item.type, data: item.data ?? {} });
|
|
85
|
+
}
|
|
86
|
+
return segs.length ? segs : [{ type: 'text', data: { text: '' } }];
|
|
87
|
+
}
|
|
88
|
+
export function segmentLocalPath(seg) {
|
|
89
|
+
const data = seg.data ?? {};
|
|
90
|
+
const candidates = [data.file, data.path, data.url].filter((value) => typeof value === 'string' && Boolean(value));
|
|
91
|
+
const ref = candidates[0];
|
|
92
|
+
if (!ref || ref.startsWith('base64://') || /^data:/.test(ref) || /^https?:\/\//i.test(ref)) {
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
return ref.replace(/^file:\/\//, '');
|
|
96
|
+
}
|
|
97
|
+
export function sleep(ms, signal) {
|
|
98
|
+
return new Promise((resolve) => {
|
|
99
|
+
if (signal?.aborted) {
|
|
100
|
+
resolve();
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const timer = setTimeout(resolve, ms);
|
|
104
|
+
signal?.addEventListener('abort', () => {
|
|
105
|
+
clearTimeout(timer);
|
|
106
|
+
resolve();
|
|
107
|
+
}, { once: true });
|
|
108
|
+
});
|
|
109
|
+
}
|
package/lib/silk-transcode.d.ts
CHANGED
package/lib/silk-transcode.js
CHANGED
package/lib/types.d.ts
CHANGED
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
name: string;
|
|
4
|
-
/** 观测用 bot_agent,默认 Zhin.js/<version> */
|
|
5
|
-
botAgent?: string;
|
|
6
|
-
/** iLink API 根地址,默认 https://ilinkai.weixin.qq.com */
|
|
7
|
-
baseUrl?: string;
|
|
8
|
-
/** CDN 根地址 */
|
|
9
|
-
cdnBaseUrl?: string;
|
|
10
|
-
/** 长轮询超时(ms),默认 35000 */
|
|
11
|
-
longPollTimeoutMs?: number;
|
|
12
|
-
/** 直接配置 token(优先于侧车凭证文件) */
|
|
13
|
-
botToken?: string;
|
|
14
|
-
}
|
|
15
|
-
export type { WeixinMessage, MessageItem } from "./ilink-types.js";
|
|
16
|
-
//# sourceMappingURL=types.d.ts.map
|
|
1
|
+
export type { WeixinIlinkEndpointConfig, WeixinIlinkAdapterConfig, ResolvedWeixinIlinkConfig, } from './protocol.js';
|
|
2
|
+
export type { WeixinMessage, MessageItem } from './ilink-types.js';
|
package/lib/types.js
CHANGED
package/lib/upload.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type WeixinApiOptions } from './ilink-api.js';
|
|
2
2
|
export type UploadedFileInfo = {
|
|
3
3
|
filekey: string;
|
|
4
4
|
/** 由 upload_param 上传后 CDN 返回的下载加密参数; fill into ImageItem.media.encrypt_query_param */
|
|
@@ -40,4 +40,3 @@ export declare function uploadFileAttachmentToWeixin(params: {
|
|
|
40
40
|
opts: WeixinApiOptions;
|
|
41
41
|
cdnBaseUrl: string;
|
|
42
42
|
}): Promise<UploadedFileInfo>;
|
|
43
|
-
//# sourceMappingURL=upload.d.ts.map
|
package/lib/upload.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import crypto from "node:crypto";
|
|
2
2
|
import fs from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { getUploadUrl } from
|
|
4
|
+
import { getUploadUrl } from './ilink-api.js';
|
|
5
5
|
import { aesEcbPaddedSize } from "./aes-ecb.js";
|
|
6
6
|
import { uploadBufferToCdn } from "./cdn-upload.js";
|
|
7
7
|
import { logger } from "./ilink-logger.js";
|
|
@@ -103,4 +103,3 @@ export async function uploadFileAttachmentToWeixin(params) {
|
|
|
103
103
|
label: "uploadFileAttachmentToWeixin",
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
-
//# sourceMappingURL=upload.js.map
|
package/lib/weixin-inbound.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type WeixinMessage, type MessageItem } from './ilink-types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Restore persisted context tokens for an account into the in-memory map.
|
|
4
4
|
* Called once during gateway startAccount to survive restarts.
|
|
@@ -68,4 +68,3 @@ export type WeixinInboundMediaOpts = {
|
|
|
68
68
|
export declare function weixinMessageToMsgContext(msg: WeixinMessage, accountId: string, opts?: WeixinInboundMediaOpts): WeixinMsgContext;
|
|
69
69
|
/** Extract the context_token from an inbound WeixinMsgContext. */
|
|
70
70
|
export declare function getContextTokenFromMsgContext(ctx: WeixinMsgContext): string | undefined;
|
|
71
|
-
//# sourceMappingURL=weixin-inbound.d.ts.map
|
package/lib/weixin-inbound.js
CHANGED
|
@@ -2,7 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { logger } from "./ilink-logger.js";
|
|
4
4
|
import { generateId } from "./ilink-random.js";
|
|
5
|
-
import { MessageItemType } from
|
|
5
|
+
import { MessageItemType } from './ilink-types.js';
|
|
6
6
|
import { resolveStateDir } from "./credentials.js";
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
// Context token store (in-process cache + disk persistence)
|
|
@@ -198,4 +198,3 @@ export function weixinMessageToMsgContext(msg, accountId, opts) {
|
|
|
198
198
|
export function getContextTokenFromMsgContext(ctx) {
|
|
199
199
|
return ctx.context_token;
|
|
200
200
|
}
|
|
201
|
-
//# sourceMappingURL=weixin-inbound.js.map
|
package/lib/weixin-send-media.js
CHANGED
|
@@ -51,4 +51,3 @@ export async function sendWeixinMediaFile(params) {
|
|
|
51
51
|
logger.info(`[weixin] sendWeixinMediaFile: file upload done filekey=${uploaded.filekey} size=${uploaded.fileSize}`);
|
|
52
52
|
return sendFileMessageWeixin({ to, text, fileName, uploaded, opts });
|
|
53
53
|
}
|
|
54
|
-
//# sourceMappingURL=weixin-send-media.js.map
|
package/lib/weixin-send.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type WeixinApiOptions } from './ilink-api.js';
|
|
2
2
|
import type { UploadedFileInfo } from "./upload.js";
|
|
3
3
|
/**
|
|
4
4
|
* Send a plain text message downstream.
|
|
@@ -62,4 +62,3 @@ export declare function sendFileMessageWeixin(params: {
|
|
|
62
62
|
}): Promise<{
|
|
63
63
|
messageId: string;
|
|
64
64
|
}>;
|
|
65
|
-
//# sourceMappingURL=weixin-send.d.ts.map
|
package/lib/weixin-send.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { sendMessage as sendMessageApi } from
|
|
1
|
+
import { sendMessage as sendMessageApi } from './ilink-api.js';
|
|
2
2
|
import { logger } from "./ilink-logger.js";
|
|
3
3
|
import { generateId } from "./ilink-random.js";
|
|
4
|
-
import { MessageItemType, MessageState, MessageType } from
|
|
4
|
+
import { MessageItemType, MessageState, MessageType } from './ilink-types.js';
|
|
5
5
|
function generateClientId() {
|
|
6
6
|
return generateId("weixin-ilink");
|
|
7
7
|
}
|
|
@@ -178,4 +178,3 @@ export async function sendFileMessageWeixin(params) {
|
|
|
178
178
|
};
|
|
179
179
|
return sendMediaItems({ to, text, mediaItem: fileItem, opts, label: "sendFileMessageWeixin" });
|
|
180
180
|
}
|
|
181
|
-
//# sourceMappingURL=weixin-send.js.map
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/adapter-weixin-ilink",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Zhin.js
|
|
5
|
+
"description": "Zhin.js Weixin iLink (ClawBot) adapter for Plugin Runtime (long-poll)",
|
|
6
6
|
"main": "./lib/index.js",
|
|
7
7
|
"types": "./lib/index.d.ts",
|
|
8
8
|
"keywords": [
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"directory": "plugins/adapters/weixin-ilink"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
|
+
"adapters",
|
|
31
|
+
"plugin.ts",
|
|
32
|
+
"schema.json",
|
|
30
33
|
"src",
|
|
31
34
|
"lib",
|
|
32
|
-
"client",
|
|
33
|
-
"dist",
|
|
34
|
-
"skills",
|
|
35
35
|
"README.md",
|
|
36
36
|
"CHANGELOG.md"
|
|
37
37
|
],
|
|
@@ -46,53 +46,49 @@
|
|
|
46
46
|
"import": "./lib/index.js"
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
|
-
"dependencies": {
|
|
50
|
-
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"lucide-react": "^1.22.0",
|
|
55
|
-
"radix-ui": "^1.6.2",
|
|
56
|
-
"typescript": "^6.0.3",
|
|
57
|
-
"@zhin.js/agent": "1.0.2",
|
|
58
|
-
"@zhin.js/cli": "1.0.92",
|
|
59
|
-
"@zhin.js/client": "2.0.4",
|
|
60
|
-
"@zhin.js/contract": "1.0.2",
|
|
61
|
-
"@zhin.js/core": "1.3.3",
|
|
62
|
-
"@zhin.js/host-api": "2.0.4",
|
|
63
|
-
"zhin.js": "4.1.1",
|
|
64
|
-
"@zhin.js/host-router": "2.0.2"
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@zhin.js/adapter": "1.0.1",
|
|
51
|
+
"@zhin.js/core": "1.3.5",
|
|
52
|
+
"@zhin.js/logger": "1.0.75",
|
|
53
|
+
"@zhin.js/plugin-runtime": "1.0.1"
|
|
65
54
|
},
|
|
66
55
|
"peerDependencies": {
|
|
67
|
-
"@zhin.js/
|
|
68
|
-
"@zhin.js/
|
|
69
|
-
"@zhin.js/
|
|
70
|
-
"
|
|
71
|
-
"@zhin.js/host-api": "2.0.4",
|
|
72
|
-
"zhin.js": "4.1.1",
|
|
73
|
-
"@zhin.js/host-router": "2.0.2"
|
|
56
|
+
"@zhin.js/adapter": "1.0.1",
|
|
57
|
+
"@zhin.js/core": "1.3.5",
|
|
58
|
+
"@zhin.js/plugin-runtime": "1.0.1",
|
|
59
|
+
"zhin.js": "4.1.3"
|
|
74
60
|
},
|
|
75
61
|
"peerDependenciesMeta": {
|
|
76
|
-
"
|
|
77
|
-
"optional": true
|
|
78
|
-
},
|
|
79
|
-
"@zhin.js/client": {
|
|
80
|
-
"optional": true
|
|
81
|
-
},
|
|
82
|
-
"@zhin.js/host-api": {
|
|
83
|
-
"optional": true
|
|
84
|
-
},
|
|
85
|
-
"@zhin.js/host-router": {
|
|
62
|
+
"zhin.js": {
|
|
86
63
|
"optional": true
|
|
87
64
|
}
|
|
88
65
|
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@types/node": "^26.1.0",
|
|
68
|
+
"typescript": "^6.0.3",
|
|
69
|
+
"vitest": "^4.1.10"
|
|
70
|
+
},
|
|
89
71
|
"ilink_appid": "bot",
|
|
90
72
|
"engines": {
|
|
91
73
|
"node": "^20.19.0 || >=22.12.0"
|
|
92
74
|
},
|
|
75
|
+
"zhin": {
|
|
76
|
+
"protocol": 1,
|
|
77
|
+
"type": "plugin",
|
|
78
|
+
"entry": "./plugin.ts",
|
|
79
|
+
"engine": "^1.0.0",
|
|
80
|
+
"runtime": "trusted",
|
|
81
|
+
"features": [
|
|
82
|
+
{
|
|
83
|
+
"package": "@zhin.js/adapter",
|
|
84
|
+
"api": "^1.0.0"
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"plugins": []
|
|
88
|
+
},
|
|
93
89
|
"scripts": {
|
|
94
|
-
"build": "
|
|
95
|
-
"
|
|
96
|
-
"
|
|
90
|
+
"build": "tsc",
|
|
91
|
+
"clean": "rimraf lib",
|
|
92
|
+
"test": "NODE_OPTIONS=--experimental-strip-types vitest run --root ../../.. plugins/adapters/weixin-ilink/tests"
|
|
97
93
|
}
|
|
98
94
|
}
|
package/plugin.ts
ADDED
package/schema.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"additionalProperties": false,
|
|
5
|
+
"properties": {
|
|
6
|
+
"name": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"default": "weixin-ilink-bot"
|
|
9
|
+
},
|
|
10
|
+
"botAgent": {
|
|
11
|
+
"type": "string"
|
|
12
|
+
},
|
|
13
|
+
"baseUrl": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"default": "https://ilinkai.weixin.qq.com"
|
|
16
|
+
},
|
|
17
|
+
"cdnBaseUrl": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"default": "https://novac2c.cdn.weixin.qq.com/c2c"
|
|
20
|
+
},
|
|
21
|
+
"longPollTimeoutMs": {
|
|
22
|
+
"type": "number",
|
|
23
|
+
"default": 35000
|
|
24
|
+
},
|
|
25
|
+
"botToken": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"description": "iLink bot token (prefer env WEIXIN_ILINK_TOKEN or sidecar credential file)"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|