@yanhaidao/wecom 2.4.160 → 2.5.110
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/dist/index.js +68 -0
- package/dist/src/accounts.js +20 -0
- package/dist/src/agent/handler.js +895 -0
- package/dist/src/agent/index.js +5 -0
- package/dist/src/app/account-runtime.js +216 -0
- package/dist/src/app/bootstrap.js +19 -0
- package/dist/src/app/index.js +118 -0
- package/dist/src/capability/agent/delivery-service.js +63 -0
- package/dist/src/capability/agent/fallback-policy.js +6 -0
- package/dist/src/capability/agent/ingress-service.js +33 -0
- package/dist/src/capability/agent/upstream-delivery-service.js +71 -0
- package/dist/src/capability/bot/dispatch-config.js +45 -0
- package/dist/src/capability/bot/fallback-delivery.js +147 -0
- package/dist/src/capability/bot/local-path-delivery.js +178 -0
- package/dist/src/capability/bot/sandbox-media.js +138 -0
- package/dist/src/capability/bot/service.js +49 -0
- package/dist/src/capability/bot/stream-delivery.js +321 -0
- package/dist/src/capability/bot/stream-finalizer.js +81 -0
- package/dist/src/capability/bot/stream-orchestrator.js +318 -0
- package/dist/src/capability/bot/types.js +1 -0
- package/{src/capability/calendar/client.ts → dist/src/capability/calendar/client.js} +118 -241
- package/{src/capability/calendar/schema.ts → dist/src/capability/calendar/schema.js} +0 -38
- package/dist/src/capability/calendar/tool.js +365 -0
- package/dist/src/capability/calendar/types.js +12 -0
- package/{src/capability/doc/client.ts → dist/src/capability/doc/client.js} +370 -605
- package/{src/capability/doc/schema.ts → dist/src/capability/doc/schema.js} +345 -394
- package/dist/src/capability/doc/tool.js +1556 -0
- package/dist/src/capability/doc/types.js +113 -0
- package/dist/src/capability/mcp/index.js +3 -0
- package/dist/src/capability/mcp/schema.js +102 -0
- package/dist/src/capability/mcp/tool.js +146 -0
- package/dist/src/capability/mcp/transport.js +293 -0
- package/dist/src/channel.js +224 -0
- package/dist/src/config/accounts.js +236 -0
- package/dist/src/config/derived-paths.js +31 -0
- package/dist/src/config/index.js +7 -0
- package/dist/src/config/media.js +110 -0
- package/dist/src/config/network.js +32 -0
- package/dist/src/config/routing.js +20 -0
- package/dist/src/config/runtime-config.js +25 -0
- package/dist/src/config/schema.js +4 -0
- package/{src/config-schema.ts → dist/src/config-schema.js} +1 -1
- package/dist/src/context-store.js +219 -0
- package/{src/crypto/aes.ts → dist/src/crypto/aes.js} +11 -28
- package/dist/src/crypto/index.js +9 -0
- package/{src/crypto/signature.ts → dist/src/crypto/signature.js} +3 -18
- package/{src/crypto/xml.ts → dist/src/crypto/xml.js} +3 -11
- package/dist/src/crypto.js +145 -0
- package/dist/src/domain/models.js +1 -0
- package/dist/src/domain/policies.js +32 -0
- package/{src/dynamic-agent.ts → dist/src/dynamic-agent.js} +36 -73
- package/dist/src/gateway-monitor.js +139 -0
- package/dist/src/http.js +114 -0
- package/{src/media.ts → dist/src/media.js} +21 -40
- package/dist/src/monitor/limits.js +7 -0
- package/dist/src/monitor/state.js +28 -0
- package/dist/src/monitor.js +84 -0
- package/dist/src/observability/audit-log.js +30 -0
- package/dist/src/observability/legacy-operational-event-store.js +22 -0
- package/dist/src/observability/raw-envelope-log.js +24 -0
- package/dist/src/observability/status-registry.js +9 -0
- package/dist/src/observability/transport-session-view.js +14 -0
- package/dist/src/onboarding.js +546 -0
- package/dist/src/outbound.js +557 -0
- package/dist/src/runtime/dispatcher.js +57 -0
- package/{src/runtime/index.ts → dist/src/runtime/index.js} +0 -1
- package/dist/src/runtime/outbound-intent.js +1 -0
- package/dist/src/runtime/reply-orchestrator.js +38 -0
- package/dist/src/runtime/routing-bridge.js +26 -0
- package/dist/src/runtime/session-manager.js +112 -0
- package/dist/src/runtime/source-registry.js +174 -0
- package/dist/src/runtime.js +1 -0
- package/dist/src/shared/command-auth.js +57 -0
- package/{src/shared/index.ts → dist/src/shared/index.js} +0 -1
- package/dist/src/shared/media-asset.js +65 -0
- package/dist/src/shared/media-service.js +59 -0
- package/dist/src/shared/media-types.js +1 -0
- package/{src/shared/xml-parser.ts → dist/src/shared/xml-parser.js} +72 -63
- package/dist/src/store/active-reply-store.js +41 -0
- package/dist/src/store/interfaces.js +1 -0
- package/dist/src/store/memory-store.js +33 -0
- package/dist/src/store/stream-batch-store.js +319 -0
- package/{src/target.ts → dist/src/target.js} +15 -48
- package/dist/src/transport/agent-api/client.js +168 -0
- package/dist/src/transport/agent-api/core.js +337 -0
- package/dist/src/transport/agent-api/delivery.js +28 -0
- package/dist/src/transport/agent-api/media-upload.js +4 -0
- package/dist/src/transport/agent-api/reply.js +24 -0
- package/dist/src/transport/agent-api/upstream-delivery.js +30 -0
- package/dist/src/transport/agent-api/upstream-media-upload.js +46 -0
- package/dist/src/transport/agent-api/upstream-reply.js +26 -0
- package/dist/src/transport/agent-callback/http-handler.js +30 -0
- package/dist/src/transport/agent-callback/inbound.js +4 -0
- package/dist/src/transport/agent-callback/reply.js +8 -0
- package/dist/src/transport/agent-callback/request-handler.js +189 -0
- package/dist/src/transport/agent-callback/session.js +15 -0
- package/dist/src/transport/bot-webhook/active-reply.js +27 -0
- package/dist/src/transport/bot-webhook/http-handler.js +31 -0
- package/dist/src/transport/bot-webhook/inbound-normalizer.js +496 -0
- package/dist/src/transport/bot-webhook/inbound.js +4 -0
- package/dist/src/transport/bot-webhook/message-shape.js +98 -0
- package/dist/src/transport/bot-webhook/protocol.js +124 -0
- package/dist/src/transport/bot-webhook/reply.js +9 -0
- package/dist/src/transport/bot-webhook/request-handler.js +285 -0
- package/dist/src/transport/bot-webhook/session.js +15 -0
- package/dist/src/transport/bot-ws/inbound.js +147 -0
- package/dist/src/transport/bot-ws/media.js +236 -0
- package/dist/src/transport/bot-ws/reply.js +310 -0
- package/dist/src/transport/bot-ws/sdk-adapter.js +257 -0
- package/dist/src/transport/bot-ws/session.js +15 -0
- package/dist/src/transport/http/common.js +78 -0
- package/dist/src/transport/http/registry.js +71 -0
- package/dist/src/transport/http/request-handler.js +51 -0
- package/{src/transport/index.ts → dist/src/transport/index.js} +2 -10
- package/dist/src/types/account.js +1 -0
- package/dist/src/types/config.js +1 -0
- package/dist/src/types/constants.js +28 -0
- package/dist/src/types/events.js +1 -0
- package/dist/src/types/index.js +1 -0
- package/dist/src/types/legacy-stream.js +1 -0
- package/dist/src/types/message.js +5 -0
- package/dist/src/types/runtime-context.js +1 -0
- package/dist/src/types/runtime.js +1 -0
- package/dist/src/types.js +1 -0
- package/dist/src/upstream/index.js +111 -0
- package/dist/src/wecom_msg_adapter/markdown_adapter.js +280 -0
- package/openclaw.plugin.json +15 -0
- package/package.json +18 -1
- package/.github/workflows/release.yml +0 -143
- package/GOVERNANCE.md +0 -26
- package/SKILLS_CAL.md +0 -895
- package/SKILLS_DOC.md +0 -2288
- package/UPSTREAM_CONFIG.md +0 -170
- package/UPSTREAM_PLAN.md +0 -175
- package/assets/01.bot-add.png +0 -0
- package/assets/01.bot-setp2.png +0 -0
- package/assets/01.image.jpg +0 -0
- package/assets/02.agent.add.png +0 -0
- package/assets/02.agent.api-set.png +0 -0
- package/assets/02.image.jpg +0 -0
- package/assets/03.agent.page.png +0 -0
- package/assets/03.bot.page.png +0 -0
- package/assets/link-me.jpg +0 -0
- package/assets/register.png +0 -0
- package/changelog/v2.2.28.md +0 -70
- package/changelog/v2.3.10.md +0 -17
- package/changelog/v2.3.11.md +0 -19
- package/changelog/v2.3.12.md +0 -25
- package/changelog/v2.3.13.md +0 -19
- package/changelog/v2.3.14.md +0 -48
- package/changelog/v2.3.15.md +0 -15
- package/changelog/v2.3.16.md +0 -11
- package/changelog/v2.3.18.md +0 -22
- package/changelog/v2.3.19.md +0 -73
- package/changelog/v2.3.2.md +0 -28
- package/changelog/v2.3.26.md +0 -21
- package/changelog/v2.3.27.md +0 -33
- package/changelog/v2.3.4.md +0 -20
- package/changelog/v2.3.9.md +0 -22
- package/changelog/v2.4.12.md +0 -37
- package/changelog/v2.4.16.md +0 -19
- package/compat-single-account.md +0 -148
- package/index.test.ts +0 -38
- package/scripts/test-proxy.ts +0 -70
- package/src/accounts.ts +0 -34
- package/src/agent/api-client.upload.test.ts +0 -109
- package/src/agent/handler.event-filter.test.ts +0 -100
- package/src/agent/handler.ts +0 -1105
- package/src/agent/index.ts +0 -12
- package/src/app/account-runtime.ts +0 -276
- package/src/app/bootstrap.ts +0 -29
- package/src/app/index.ts +0 -192
- package/src/capability/agent/delivery-service.ts +0 -87
- package/src/capability/agent/fallback-policy.ts +0 -13
- package/src/capability/agent/ingress-service.ts +0 -38
- package/src/capability/agent/upstream-delivery-service.ts +0 -96
- package/src/capability/bot/dispatch-config.ts +0 -47
- package/src/capability/bot/fallback-delivery.ts +0 -178
- package/src/capability/bot/local-path-delivery.ts +0 -215
- package/src/capability/bot/sandbox-media.test.ts +0 -221
- package/src/capability/bot/sandbox-media.ts +0 -176
- package/src/capability/bot/service.ts +0 -56
- package/src/capability/bot/stream-delivery.ts +0 -379
- package/src/capability/bot/stream-finalizer.ts +0 -120
- package/src/capability/bot/stream-orchestrator.ts +0 -371
- package/src/capability/bot/types.ts +0 -8
- package/src/capability/calendar/SKILLS_CHECKLIST.md +0 -251
- package/src/capability/calendar/tool.ts +0 -417
- package/src/capability/calendar/types.ts +0 -309
- package/src/capability/doc/tool.ts +0 -1629
- package/src/capability/doc/types.ts +0 -792
- package/src/capability/mcp/index.ts +0 -10
- package/src/capability/mcp/schema.ts +0 -107
- package/src/capability/mcp/tool.ts +0 -174
- package/src/capability/mcp/transport.ts +0 -394
- package/src/channel.config.test.ts +0 -147
- package/src/channel.lifecycle.test.ts +0 -255
- package/src/channel.meta.test.ts +0 -26
- package/src/channel.ts +0 -256
- package/src/config/accounts.resolve.test.ts +0 -75
- package/src/config/accounts.ts +0 -296
- package/src/config/derived-paths.test.ts +0 -111
- package/src/config/derived-paths.ts +0 -41
- package/src/config/index.ts +0 -26
- package/src/config/media.test.ts +0 -113
- package/src/config/media.ts +0 -139
- package/src/config/network.ts +0 -53
- package/src/config/routing.test.ts +0 -88
- package/src/config/routing.ts +0 -26
- package/src/config/runtime-config.ts +0 -46
- package/src/config/schema.ts +0 -90
- package/src/context-store.ts +0 -297
- package/src/crypto/index.ts +0 -24
- package/src/crypto.test.ts +0 -32
- package/src/crypto.ts +0 -176
- package/src/domain/models.ts +0 -7
- package/src/domain/policies.ts +0 -36
- package/src/dynamic-agent.account-scope.test.ts +0 -17
- package/src/gateway-monitor.ts +0 -181
- package/src/http.ts +0 -145
- package/src/media.test.ts +0 -82
- package/src/monitor/limits.ts +0 -7
- package/src/monitor/state.queue.test.ts +0 -185
- package/src/monitor/state.ts +0 -34
- package/src/monitor.active.test.ts +0 -245
- package/src/monitor.inbound-filter.test.ts +0 -63
- package/src/monitor.integration.test.ts +0 -208
- package/src/monitor.ts +0 -121
- package/src/monitor.webhook.test.ts +0 -774
- package/src/observability/audit-log.ts +0 -48
- package/src/observability/legacy-operational-event-store.ts +0 -36
- package/src/observability/raw-envelope-log.ts +0 -28
- package/src/observability/status-registry.ts +0 -13
- package/src/observability/transport-session-view.ts +0 -14
- package/src/onboarding.test.ts +0 -336
- package/src/onboarding.ts +0 -704
- package/src/outbound.test.ts +0 -1271
- package/src/outbound.ts +0 -746
- package/src/runtime/dispatcher.ts +0 -71
- package/src/runtime/outbound-intent.ts +0 -4
- package/src/runtime/reply-orchestrator.test.ts +0 -71
- package/src/runtime/reply-orchestrator.ts +0 -67
- package/src/runtime/routing-bridge.test.ts +0 -115
- package/src/runtime/routing-bridge.ts +0 -44
- package/src/runtime/session-manager.test.ts +0 -174
- package/src/runtime/session-manager.ts +0 -139
- package/src/runtime/source-registry.ts +0 -249
- package/src/runtime.ts +0 -14
- package/src/shared/command-auth.ts +0 -87
- package/src/shared/media-asset.ts +0 -78
- package/src/shared/media-service.test.ts +0 -111
- package/src/shared/media-service.ts +0 -84
- package/src/shared/media-types.ts +0 -5
- package/src/shared/xml-parser.test.ts +0 -50
- package/src/store/active-reply-store.ts +0 -42
- package/src/store/interfaces.ts +0 -11
- package/src/store/memory-store.ts +0 -43
- package/src/store/stream-batch-store.ts +0 -350
- package/src/transport/agent-api/client.ts +0 -277
- package/src/transport/agent-api/core.ts +0 -463
- package/src/transport/agent-api/delivery.ts +0 -41
- package/src/transport/agent-api/media-upload.ts +0 -11
- package/src/transport/agent-api/reply.ts +0 -39
- package/src/transport/agent-api/upstream-delivery.ts +0 -45
- package/src/transport/agent-api/upstream-media-upload.ts +0 -70
- package/src/transport/agent-api/upstream-reply.ts +0 -43
- package/src/transport/agent-callback/http-handler.ts +0 -47
- package/src/transport/agent-callback/inbound.ts +0 -5
- package/src/transport/agent-callback/reply.ts +0 -13
- package/src/transport/agent-callback/request-handler.ts +0 -244
- package/src/transport/agent-callback/session.ts +0 -23
- package/src/transport/bot-webhook/active-reply.ts +0 -39
- package/src/transport/bot-webhook/http-handler.ts +0 -48
- package/src/transport/bot-webhook/inbound-normalizer.test.ts +0 -433
- package/src/transport/bot-webhook/inbound-normalizer.ts +0 -558
- package/src/transport/bot-webhook/inbound.ts +0 -5
- package/src/transport/bot-webhook/message-shape.ts +0 -92
- package/src/transport/bot-webhook/protocol.ts +0 -148
- package/src/transport/bot-webhook/reply.ts +0 -15
- package/src/transport/bot-webhook/request-handler.ts +0 -394
- package/src/transport/bot-webhook/session.ts +0 -23
- package/src/transport/bot-ws/inbound.test.ts +0 -290
- package/src/transport/bot-ws/inbound.ts +0 -163
- package/src/transport/bot-ws/media.test.ts +0 -44
- package/src/transport/bot-ws/media.ts +0 -321
- package/src/transport/bot-ws/reply.test.ts +0 -450
- package/src/transport/bot-ws/reply.ts +0 -365
- package/src/transport/bot-ws/sdk-adapter.test.ts +0 -187
- package/src/transport/bot-ws/sdk-adapter.ts +0 -314
- package/src/transport/bot-ws/session.ts +0 -28
- package/src/transport/http/common.ts +0 -109
- package/src/transport/http/registry.ts +0 -92
- package/src/transport/http/request-handler.ts +0 -84
- package/src/types/account.ts +0 -70
- package/src/types/config.ts +0 -114
- package/src/types/constants.ts +0 -31
- package/src/types/events.ts +0 -21
- package/src/types/global.d.ts +0 -9
- package/src/types/index.ts +0 -17
- package/src/types/legacy-stream.ts +0 -50
- package/src/types/message.ts +0 -189
- package/src/types/runtime-context.ts +0 -28
- package/src/types/runtime.ts +0 -165
- package/src/types.ts +0 -41
- package/src/upstream/index.ts +0 -150
- package/src/upstream.test.ts +0 -84
- package/src/wecom_msg_adapter/markdown_adapter.ts +0 -331
- package/tsconfig.json +0 -22
- package/vitest.config.ts +0 -26
- /package/{src/capability/agent/index.ts → dist/src/capability/agent/index.js} +0 -0
- /package/{src/capability/bot/index.ts → dist/src/capability/bot/index.js} +0 -0
- /package/{src/capability/calendar/index.ts → dist/src/capability/calendar/index.js} +0 -0
- /package/{src/capability/index.ts → dist/src/capability/index.js} +0 -0
package/src/types/config.ts
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
export type WecomDmPolicy = "open" | "pairing" | "allowlist" | "disabled";
|
|
2
|
-
export type WecomBotPrimaryTransport = "ws" | "webhook";
|
|
3
|
-
|
|
4
|
-
export type WecomDmConfig = {
|
|
5
|
-
policy?: WecomDmPolicy;
|
|
6
|
-
allowFrom?: Array<string | number>;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export type WecomMediaConfig = {
|
|
10
|
-
tempDir?: string;
|
|
11
|
-
retentionHours?: number;
|
|
12
|
-
cleanupOnStart?: boolean;
|
|
13
|
-
maxBytes?: number;
|
|
14
|
-
downloadTimeoutMs?: number;
|
|
15
|
-
localRoots?: string[];
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export type WecomNetworkConfig = {
|
|
19
|
-
egressProxyUrl?: string;
|
|
20
|
-
timeoutMs?: number;
|
|
21
|
-
mediaDownloadTimeoutMs?: number;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export type WecomRoutingConfig = {
|
|
25
|
-
failClosedOnDefaultRoute?: boolean;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export type WecomBotWsConfig = {
|
|
29
|
-
botId: string;
|
|
30
|
-
secret: string;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export type WecomBotWebhookConfig = {
|
|
34
|
-
token: string;
|
|
35
|
-
encodingAESKey: string;
|
|
36
|
-
receiveId?: string;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export type WecomBotConfig = {
|
|
40
|
-
primaryTransport?: WecomBotPrimaryTransport;
|
|
41
|
-
streamPlaceholderContent?: string;
|
|
42
|
-
welcomeText?: string;
|
|
43
|
-
dm?: WecomDmConfig;
|
|
44
|
-
/**
|
|
45
|
-
* Deprecated compatibility fields kept only while old webhook helpers are
|
|
46
|
-
* being extracted into transport adapters.
|
|
47
|
-
*/
|
|
48
|
-
aibotid?: string;
|
|
49
|
-
botIds?: string[];
|
|
50
|
-
ws?: WecomBotWsConfig;
|
|
51
|
-
webhook?: WecomBotWebhookConfig;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* 上下游企业配置
|
|
56
|
-
* 根据企业微信文档,只需要配置下游企业的 CorpID 和 AgentID
|
|
57
|
-
* 不需要下游企业的 agentSecret,使用主企业的 corpSecret 获取下游企业的 access_token
|
|
58
|
-
*/
|
|
59
|
-
export type WecomUpstreamCorpConfig = {
|
|
60
|
-
corpId: string;
|
|
61
|
-
agentId: number;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export type WecomAgentConfig = {
|
|
65
|
-
corpId: string;
|
|
66
|
-
agentSecret?: string;
|
|
67
|
-
/**
|
|
68
|
-
* Deprecated compatibility alias for old configs.
|
|
69
|
-
* New configs should use `agentSecret`.
|
|
70
|
-
*/
|
|
71
|
-
corpSecret?: string;
|
|
72
|
-
agentId?: number | string;
|
|
73
|
-
token: string;
|
|
74
|
-
encodingAESKey: string;
|
|
75
|
-
welcomeText?: string;
|
|
76
|
-
dm?: WecomDmConfig;
|
|
77
|
-
/**
|
|
78
|
-
* 上下游企业配置映射
|
|
79
|
-
* key: 配置名称(可自定义)
|
|
80
|
-
* value: 下游企业的 CorpID 和 AgentID
|
|
81
|
-
*
|
|
82
|
-
* 注意:不需要配置 agentSecret,使用主企业的 corpSecret 获取下游企业的 access_token
|
|
83
|
-
*/
|
|
84
|
-
upstreamCorps?: Record<string, WecomUpstreamCorpConfig>;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
export type WecomDynamicAgentsConfig = {
|
|
88
|
-
enabled?: boolean;
|
|
89
|
-
dmCreateAgent?: boolean;
|
|
90
|
-
groupEnabled?: boolean;
|
|
91
|
-
adminUsers?: string[];
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
export type WecomAccountConfig = {
|
|
95
|
-
enabled?: boolean;
|
|
96
|
-
name?: string;
|
|
97
|
-
mediaMaxMb?: number;
|
|
98
|
-
bot?: WecomBotConfig;
|
|
99
|
-
agent?: WecomAgentConfig;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export type WecomConfig = {
|
|
103
|
-
enabled?: boolean;
|
|
104
|
-
mediaMaxMb?: number;
|
|
105
|
-
mediaDownloadTimeoutMs?: number;
|
|
106
|
-
bot?: WecomBotConfig;
|
|
107
|
-
agent?: WecomAgentConfig;
|
|
108
|
-
accounts?: Record<string, WecomAccountConfig>;
|
|
109
|
-
defaultAccount?: string;
|
|
110
|
-
media?: WecomMediaConfig;
|
|
111
|
-
network?: WecomNetworkConfig;
|
|
112
|
-
routing?: WecomRoutingConfig;
|
|
113
|
-
dynamicAgents?: WecomDynamicAgentsConfig;
|
|
114
|
-
};
|
package/src/types/constants.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export const WEBHOOK_PATHS = {
|
|
2
|
-
BOT: "/wecom/bot",
|
|
3
|
-
BOT_ALT: "/wecom",
|
|
4
|
-
AGENT: "/wecom/agent",
|
|
5
|
-
BOT_PLUGIN: "/plugins/wecom/bot",
|
|
6
|
-
AGENT_PLUGIN: "/plugins/wecom/agent",
|
|
7
|
-
} as const;
|
|
8
|
-
|
|
9
|
-
export const API_ENDPOINTS = {
|
|
10
|
-
GET_TOKEN: "https://qyapi.weixin.qq.com/cgi-bin/gettoken",
|
|
11
|
-
SEND_MESSAGE: "https://qyapi.weixin.qq.com/cgi-bin/message/send",
|
|
12
|
-
SEND_APPCHAT: "https://qyapi.weixin.qq.com/cgi-bin/appchat/send",
|
|
13
|
-
UPLOAD_MEDIA: "https://qyapi.weixin.qq.com/cgi-bin/media/upload",
|
|
14
|
-
DOWNLOAD_MEDIA: "https://qyapi.weixin.qq.com/cgi-bin/media/get",
|
|
15
|
-
} as const;
|
|
16
|
-
|
|
17
|
-
export const LIMITS = {
|
|
18
|
-
TEXT_MAX_BYTES: 20_480,
|
|
19
|
-
TOKEN_REFRESH_BUFFER_MS: 60_000,
|
|
20
|
-
REQUEST_TIMEOUT_MS: 15_000,
|
|
21
|
-
MAX_REQUEST_BODY_SIZE: 1024 * 1024,
|
|
22
|
-
BOT_WEBHOOK_PASSIVE_WINDOW_MS: 5_000,
|
|
23
|
-
BOT_WEBHOOK_RESPONSE_URL_TTL_MS: 60 * 60 * 1000,
|
|
24
|
-
BOT_STREAM_WINDOW_MS: 6 * 60 * 1000,
|
|
25
|
-
BOT_WS_HEARTBEAT_MS: 30_000,
|
|
26
|
-
} as const;
|
|
27
|
-
|
|
28
|
-
export const CRYPTO = {
|
|
29
|
-
PKCS7_BLOCK_SIZE: 32,
|
|
30
|
-
AES_KEY_LENGTH: 32,
|
|
31
|
-
} as const;
|
package/src/types/events.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { UnifiedInboundEvent } from "./runtime.js";
|
|
2
|
-
|
|
3
|
-
export type BotWsFrameHeaders = {
|
|
4
|
-
req_id: string;
|
|
5
|
-
[key: string]: unknown;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export type BotWsFrame<T = unknown> = {
|
|
9
|
-
cmd?: string;
|
|
10
|
-
headers: BotWsFrameHeaders;
|
|
11
|
-
body?: T;
|
|
12
|
-
errcode?: number;
|
|
13
|
-
errmsg?: string;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export type AgentCallbackEnvelope = {
|
|
17
|
-
xml: string;
|
|
18
|
-
decrypted: Record<string, unknown>;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export type InboundEventMapper<T = unknown> = (payload: T) => UnifiedInboundEvent;
|
package/src/types/global.d.ts
DELETED
package/src/types/index.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export * from "./constants.js";
|
|
2
|
-
export type * from "./config.js";
|
|
3
|
-
export type * from "./account.js";
|
|
4
|
-
export type * from "./events.js";
|
|
5
|
-
export type * from "./runtime.js";
|
|
6
|
-
export type {
|
|
7
|
-
WecomBotInboundBase,
|
|
8
|
-
WecomBotInboundText,
|
|
9
|
-
WecomBotInboundVoice,
|
|
10
|
-
WecomBotInboundStreamRefresh,
|
|
11
|
-
WecomBotInboundEvent,
|
|
12
|
-
WecomBotInboundMessage,
|
|
13
|
-
WecomAgentInboundMessage,
|
|
14
|
-
WecomInboundQuote,
|
|
15
|
-
WecomTemplateCard,
|
|
16
|
-
WecomOutboundMessage,
|
|
17
|
-
} from "./message.js";
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { WecomBotInboundMessage as WecomInboundMessage } from "./message.js";
|
|
2
|
-
import type { WecomWebhookTarget } from "./runtime-context.js";
|
|
3
|
-
|
|
4
|
-
export type StreamState = {
|
|
5
|
-
streamId: string;
|
|
6
|
-
msgid?: string;
|
|
7
|
-
conversationKey?: string;
|
|
8
|
-
batchKey?: string;
|
|
9
|
-
userId?: string;
|
|
10
|
-
chatType?: "group" | "direct";
|
|
11
|
-
chatId?: string;
|
|
12
|
-
aibotid?: string;
|
|
13
|
-
taskKey?: string;
|
|
14
|
-
createdAt: number;
|
|
15
|
-
updatedAt: number;
|
|
16
|
-
started: boolean;
|
|
17
|
-
finished: boolean;
|
|
18
|
-
error?: string;
|
|
19
|
-
content: string;
|
|
20
|
-
images?: { base64: string; md5: string }[];
|
|
21
|
-
fallbackMode?: "media" | "timeout" | "error";
|
|
22
|
-
fallbackPromptSentAt?: number;
|
|
23
|
-
finalDeliveredAt?: number;
|
|
24
|
-
dmContent?: string;
|
|
25
|
-
agentMediaKeys?: string[];
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export type PendingInbound = {
|
|
29
|
-
streamId: string;
|
|
30
|
-
conversationKey: string;
|
|
31
|
-
batchKey: string;
|
|
32
|
-
target: WecomWebhookTarget;
|
|
33
|
-
msg: WecomInboundMessage;
|
|
34
|
-
contents: string[];
|
|
35
|
-
media?: { buffer: Buffer; contentType: string; filename: string };
|
|
36
|
-
msgids: string[];
|
|
37
|
-
nonce: string;
|
|
38
|
-
timestamp: string;
|
|
39
|
-
timeout: ReturnType<typeof setTimeout> | null;
|
|
40
|
-
readyToFlush?: boolean;
|
|
41
|
-
createdAt: number;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export type ActiveReplyState = {
|
|
45
|
-
response_url: string;
|
|
46
|
-
proxyUrl?: string;
|
|
47
|
-
createdAt: number;
|
|
48
|
-
usedAt?: number;
|
|
49
|
-
lastError?: string;
|
|
50
|
-
};
|
package/src/types/message.ts
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WeCom 消息类型定义
|
|
3
|
-
* Bot 和 Agent 模式共用
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Bot 模式入站消息基础结构 (JSON)
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* **WecomBotInboundBase (Bot 入站消息基类)**
|
|
11
|
-
*
|
|
12
|
-
* Bot 模式下 JSON 格式回调的基础字段。
|
|
13
|
-
* @property msgid 消息 ID
|
|
14
|
-
* @property aibotid 机器人 ID
|
|
15
|
-
* @property chattype 会话类型: "single" | "group"
|
|
16
|
-
* @property chatid 群聊 ID (仅群组时存在)
|
|
17
|
-
* @property response_url 下行回复 URL (用于被动响应转主动推送)
|
|
18
|
-
* @property from 发送者信息
|
|
19
|
-
*/
|
|
20
|
-
export type WecomBotInboundBase = {
|
|
21
|
-
msgid?: string;
|
|
22
|
-
aibotid?: string;
|
|
23
|
-
chattype?: "single" | "group";
|
|
24
|
-
chatid?: string;
|
|
25
|
-
response_url?: string;
|
|
26
|
-
from?: { userid?: string; corpid?: string };
|
|
27
|
-
msgtype?: string;
|
|
28
|
-
/** 附件数量 (部分消息存在) */
|
|
29
|
-
attachment_count?: number;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export type WecomBotInboundText = WecomBotInboundBase & {
|
|
33
|
-
msgtype: "text";
|
|
34
|
-
text?: { content?: string };
|
|
35
|
-
quote?: WecomInboundQuote;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export type WecomBotInboundVoice = WecomBotInboundBase & {
|
|
39
|
-
msgtype: "voice";
|
|
40
|
-
voice?: { content?: string };
|
|
41
|
-
quote?: WecomInboundQuote;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export type WecomBotInboundStreamRefresh = WecomBotInboundBase & {
|
|
45
|
-
msgtype: "stream";
|
|
46
|
-
stream?: { id?: string };
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export type WecomBotInboundEvent = WecomBotInboundBase & {
|
|
50
|
-
msgtype: "event";
|
|
51
|
-
create_time?: number;
|
|
52
|
-
event?: {
|
|
53
|
-
eventtype?: string;
|
|
54
|
-
[key: string]: unknown;
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* **WecomInboundQuote (引用消息)**
|
|
60
|
-
*
|
|
61
|
-
* 消息中引用的原始内容(如回复某条消息)。
|
|
62
|
-
* 支持引用文本、图片、混合类型、语音、文件、视频等多种媒体类型。
|
|
63
|
-
*
|
|
64
|
-
* 注意:引用中的媒体 URL 时效约 5 分钟,必须尽快下载和解密。
|
|
65
|
-
*/
|
|
66
|
-
export type WecomInboundQuote = {
|
|
67
|
-
msgtype?: "text" | "image" | "mixed" | "voice" | "file" | "video";
|
|
68
|
-
/** 引用文本内容 */
|
|
69
|
-
text?: { content?: string };
|
|
70
|
-
/** 引用图片 URL,可包含出现时的加密密钥 aeskey */
|
|
71
|
-
image?: { url?: string; aeskey?: string };
|
|
72
|
-
/** 引用混合消息 (图文) */
|
|
73
|
-
mixed?: {
|
|
74
|
-
msg_item?: Array<{
|
|
75
|
-
msgtype: "text" | "image";
|
|
76
|
-
text?: { content?: string };
|
|
77
|
-
image?: { url?: string };
|
|
78
|
-
}>;
|
|
79
|
-
};
|
|
80
|
-
/** 引用语音 - 仅含转写文本,无 URL 需下载(按纯文本处理) */
|
|
81
|
-
voice?: { content?: string };
|
|
82
|
-
/** 引用文件 URL 及其加密密钥 */
|
|
83
|
-
file?: { url?: string; aeskey?: string };
|
|
84
|
-
/** 引用视频 URL 及其加密密钥(新增支持) */
|
|
85
|
-
video?: { url?: string; aeskey?: string };
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
export type WecomBotInboundMessage =
|
|
89
|
-
| WecomBotInboundText
|
|
90
|
-
| WecomBotInboundVoice
|
|
91
|
-
| WecomBotInboundStreamRefresh
|
|
92
|
-
| WecomBotInboundEvent
|
|
93
|
-
| (WecomBotInboundBase & { quote?: WecomInboundQuote } & Record<string, unknown>);
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Agent 模式入站消息结构 (解析自 XML)
|
|
97
|
-
*/
|
|
98
|
-
/**
|
|
99
|
-
* **WecomAgentInboundMessage (Agent 入站消息)**
|
|
100
|
-
*
|
|
101
|
-
* Agent 模式下解析自 XML 的扁平化消息结构。
|
|
102
|
-
* 键名保持 PascalCase (如 `ToUserName`)。
|
|
103
|
-
*/
|
|
104
|
-
export type WecomAgentInboundMessage = {
|
|
105
|
-
ToUserName?: string;
|
|
106
|
-
FromUserName?: string;
|
|
107
|
-
CreateTime?: number;
|
|
108
|
-
MsgType?: string;
|
|
109
|
-
MsgId?: string;
|
|
110
|
-
AgentID?: number;
|
|
111
|
-
// 文本消息
|
|
112
|
-
Content?: string;
|
|
113
|
-
// 图片消息
|
|
114
|
-
PicUrl?: string;
|
|
115
|
-
MediaId?: string;
|
|
116
|
-
// 文件消息
|
|
117
|
-
FileName?: string;
|
|
118
|
-
// 语音消息
|
|
119
|
-
Format?: string;
|
|
120
|
-
Recognition?: string;
|
|
121
|
-
// 视频消息
|
|
122
|
-
ThumbMediaId?: string;
|
|
123
|
-
// 位置消息
|
|
124
|
-
Location_X?: number;
|
|
125
|
-
Location_Y?: number;
|
|
126
|
-
Scale?: number;
|
|
127
|
-
Label?: string;
|
|
128
|
-
// 链接消息
|
|
129
|
-
Title?: string;
|
|
130
|
-
Description?: string;
|
|
131
|
-
Url?: string;
|
|
132
|
-
// 事件消息
|
|
133
|
-
Event?: string;
|
|
134
|
-
EventKey?: string;
|
|
135
|
-
// 群聊
|
|
136
|
-
ChatId?: string;
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* 模板卡片类型
|
|
141
|
-
*/
|
|
142
|
-
/**
|
|
143
|
-
* **WecomTemplateCard (模板卡片)**
|
|
144
|
-
*
|
|
145
|
-
* 复杂的交互式卡片结构。
|
|
146
|
-
* @property card_type 卡片类型: "text_notice" | "news_notice" | "button_interaction" ...
|
|
147
|
-
* @property source 来源信息
|
|
148
|
-
* @property main_title 主标题
|
|
149
|
-
* @property sub_title_text 副标题
|
|
150
|
-
* @property horizontal_content_list 水平排列的键值列表
|
|
151
|
-
* @property button_list 按钮列表
|
|
152
|
-
*/
|
|
153
|
-
export type WecomTemplateCard = {
|
|
154
|
-
card_type: "text_notice" | "news_notice" | "button_interaction" | "vote_interaction" | "multiple_interaction";
|
|
155
|
-
source?: { icon_url?: string; desc?: string; desc_color?: number };
|
|
156
|
-
main_title?: { title?: string; desc?: string };
|
|
157
|
-
task_id?: string;
|
|
158
|
-
button_list?: Array<{ text: string; style?: number; key: string }>;
|
|
159
|
-
sub_title_text?: string;
|
|
160
|
-
horizontal_content_list?: Array<{
|
|
161
|
-
keyname: string;
|
|
162
|
-
value?: string;
|
|
163
|
-
type?: number;
|
|
164
|
-
url?: string;
|
|
165
|
-
userid?: string;
|
|
166
|
-
}>;
|
|
167
|
-
card_action?: { type: number; url?: string; appid?: string; pagepath?: string };
|
|
168
|
-
action_menu?: { desc: string; action_list: Array<{ text: string; key: string }> };
|
|
169
|
-
select_list?: Array<{
|
|
170
|
-
question_key: string;
|
|
171
|
-
title?: string;
|
|
172
|
-
selected_id?: string;
|
|
173
|
-
option_list: Array<{ id: string; text: string }>;
|
|
174
|
-
}>;
|
|
175
|
-
submit_button?: { text: string; key: string };
|
|
176
|
-
checkbox?: {
|
|
177
|
-
question_key: string;
|
|
178
|
-
option_list: Array<{ id: string; text: string; is_checked?: boolean }>;
|
|
179
|
-
mode?: number;
|
|
180
|
-
};
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* 出站消息类型
|
|
185
|
-
*/
|
|
186
|
-
export type WecomOutboundMessage =
|
|
187
|
-
| { msgtype: "text"; text: { content: string } }
|
|
188
|
-
| { msgtype: "markdown"; markdown: { content: string } }
|
|
189
|
-
| { msgtype: "template_card"; template_card: WecomTemplateCard };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { OpenClawConfig, PluginRuntime } from "openclaw/plugin-sdk";
|
|
2
|
-
|
|
3
|
-
import type { ResolvedBotAccount } from "./account.js";
|
|
4
|
-
import type { RawFrameReference, TransportSessionPatch, WecomAuditCategory, WecomTransportKind } from "./runtime.js";
|
|
5
|
-
|
|
6
|
-
export type WecomRuntimeEnv = {
|
|
7
|
-
log?: (message: string) => void;
|
|
8
|
-
error?: (message: string) => void;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export type WecomRuntimeAuditEvent = {
|
|
12
|
-
transport: WecomTransportKind;
|
|
13
|
-
category: WecomAuditCategory;
|
|
14
|
-
summary: string;
|
|
15
|
-
messageId?: string;
|
|
16
|
-
raw?: RawFrameReference;
|
|
17
|
-
error?: string;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export type WecomWebhookTarget = {
|
|
21
|
-
account: ResolvedBotAccount;
|
|
22
|
-
config: OpenClawConfig;
|
|
23
|
-
runtime: WecomRuntimeEnv;
|
|
24
|
-
core: PluginRuntime;
|
|
25
|
-
path: string;
|
|
26
|
-
touchTransportSession?: (patch: TransportSessionPatch) => void;
|
|
27
|
-
auditSink?: (event: WecomRuntimeAuditEvent) => void;
|
|
28
|
-
};
|
package/src/types/runtime.ts
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import type { PluginRuntime } from "openclaw/plugin-sdk";
|
|
2
|
-
|
|
3
|
-
import type { ResolvedAgentAccount, ResolvedBotAccount, ResolvedWecomAccount } from "./account.js";
|
|
4
|
-
|
|
5
|
-
export type WecomCapabilityKind = "bot" | "agent";
|
|
6
|
-
export type WecomTransportKind = "bot-ws" | "bot-webhook" | "agent-callback" | "agent-api";
|
|
7
|
-
export type WecomAuditCategory =
|
|
8
|
-
| "inbound"
|
|
9
|
-
| "duplicate-inbound"
|
|
10
|
-
| "duplicate-reply"
|
|
11
|
-
| "owner-drift"
|
|
12
|
-
| "ws-kicked"
|
|
13
|
-
| "media-decrypt-failed"
|
|
14
|
-
| "fallback-delivery-failed"
|
|
15
|
-
| "runtime-error";
|
|
16
|
-
export type WecomRuntimeHealth = "idle" | "healthy" | "degraded" | "down";
|
|
17
|
-
export type WecomInboundKind =
|
|
18
|
-
| "text"
|
|
19
|
-
| "image"
|
|
20
|
-
| "file"
|
|
21
|
-
| "voice"
|
|
22
|
-
| "video"
|
|
23
|
-
| "mixed"
|
|
24
|
-
| "location"
|
|
25
|
-
| "link"
|
|
26
|
-
| "event"
|
|
27
|
-
| "welcome"
|
|
28
|
-
| "template-card-event";
|
|
29
|
-
|
|
30
|
-
export type ConversationRef = {
|
|
31
|
-
accountId: string;
|
|
32
|
-
peerKind: "direct" | "group";
|
|
33
|
-
peerId: string;
|
|
34
|
-
senderId: string;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export type RawFrameReference = {
|
|
38
|
-
transport: WecomTransportKind;
|
|
39
|
-
command?: string;
|
|
40
|
-
headers?: Record<string, unknown>;
|
|
41
|
-
body?: unknown;
|
|
42
|
-
envelopeType: "json" | "xml" | "ws";
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export type ReplyContext = {
|
|
46
|
-
transport: WecomTransportKind;
|
|
47
|
-
accountId: string;
|
|
48
|
-
responseUrl?: string;
|
|
49
|
-
reqId?: string;
|
|
50
|
-
streamId?: string;
|
|
51
|
-
webhookNonce?: string;
|
|
52
|
-
webhookTimestamp?: string;
|
|
53
|
-
passiveWindowMs?: number;
|
|
54
|
-
raw: RawFrameReference;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export type UnifiedInboundEvent = {
|
|
58
|
-
accountId: string;
|
|
59
|
-
capability: WecomCapabilityKind;
|
|
60
|
-
transport: WecomTransportKind;
|
|
61
|
-
inboundKind: WecomInboundKind;
|
|
62
|
-
messageId: string;
|
|
63
|
-
conversation: ConversationRef;
|
|
64
|
-
text: string;
|
|
65
|
-
senderName?: string;
|
|
66
|
-
timestamp: number;
|
|
67
|
-
raw: RawFrameReference;
|
|
68
|
-
replyContext: ReplyContext;
|
|
69
|
-
attachments?: Array<{
|
|
70
|
-
name?: string;
|
|
71
|
-
contentType?: string;
|
|
72
|
-
remoteUrl?: string;
|
|
73
|
-
aesKey?: string;
|
|
74
|
-
}>;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export type ReplyDeliveryInfo = {
|
|
78
|
-
kind: "block" | "final" | "error";
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export type ReplyPayload = {
|
|
82
|
-
text?: string;
|
|
83
|
-
mediaUrl?: string;
|
|
84
|
-
mediaUrls?: string[];
|
|
85
|
-
replyToId?: string;
|
|
86
|
-
replyToTag?: boolean;
|
|
87
|
-
replyToCurrent?: boolean;
|
|
88
|
-
audioAsVoice?: boolean;
|
|
89
|
-
isError?: boolean;
|
|
90
|
-
isReasoning?: boolean;
|
|
91
|
-
channelData?: Record<string, unknown>;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
export type ReplyHandle = {
|
|
95
|
-
context: ReplyContext;
|
|
96
|
-
deliver: (payload: ReplyPayload, info: ReplyDeliveryInfo) => Promise<void>;
|
|
97
|
-
fail?: (error: unknown) => Promise<void>;
|
|
98
|
-
markExternalActivity?: () => void;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
export type TransportSessionSnapshot = {
|
|
102
|
-
accountId: string;
|
|
103
|
-
transport: WecomTransportKind;
|
|
104
|
-
running: boolean;
|
|
105
|
-
ownerId?: string;
|
|
106
|
-
connected?: boolean;
|
|
107
|
-
authenticated?: boolean;
|
|
108
|
-
lastConnectedAt?: number;
|
|
109
|
-
lastDisconnectedAt?: number;
|
|
110
|
-
lastInboundAt?: number;
|
|
111
|
-
lastOutboundAt?: number;
|
|
112
|
-
lastError?: string;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
export type TransportSessionPatch = Partial<Omit<TransportSessionSnapshot, "accountId" | "transport">> & {
|
|
116
|
-
lastError?: string | null;
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
export type AccountRuntimeStatusSnapshot = {
|
|
120
|
-
accountId: string;
|
|
121
|
-
health: WecomRuntimeHealth;
|
|
122
|
-
transport?: WecomTransportKind;
|
|
123
|
-
ownerId?: string | null;
|
|
124
|
-
connected?: boolean;
|
|
125
|
-
authenticated?: boolean;
|
|
126
|
-
ownerDriftAt?: number | null;
|
|
127
|
-
lastError?: string | null;
|
|
128
|
-
lastErrorAt?: number | null;
|
|
129
|
-
lastInboundAt?: number | null;
|
|
130
|
-
lastOutboundAt?: number | null;
|
|
131
|
-
recentInboundSummary?: string | null;
|
|
132
|
-
recentOutboundSummary?: string | null;
|
|
133
|
-
recentIssueCategory?: WecomAuditCategory | null;
|
|
134
|
-
recentIssueSummary?: string | null;
|
|
135
|
-
transportSessions?: string[];
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
export type DeliveryTask = {
|
|
139
|
-
accountId: string;
|
|
140
|
-
transport: WecomTransportKind;
|
|
141
|
-
conversation: ConversationRef;
|
|
142
|
-
messageId: string;
|
|
143
|
-
status: "pending" | "delivered" | "failed";
|
|
144
|
-
createdAt: number;
|
|
145
|
-
updatedAt: number;
|
|
146
|
-
error?: string;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
export type RuntimeLogSink = {
|
|
150
|
-
info?: (message: string) => void;
|
|
151
|
-
warn?: (message: string) => void;
|
|
152
|
-
error?: (message: string) => void;
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
export type RuntimeServices = {
|
|
156
|
-
core: PluginRuntime;
|
|
157
|
-
log: RuntimeLogSink;
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
export type AccountRuntimeContext = {
|
|
161
|
-
account: ResolvedWecomAccount;
|
|
162
|
-
bot?: ResolvedBotAccount;
|
|
163
|
-
agent?: ResolvedAgentAccount;
|
|
164
|
-
services: RuntimeServices;
|
|
165
|
-
};
|
package/src/types.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Backward-compatible type bridge.
|
|
3
|
-
* Canonical definitions live in `src/types/*`.
|
|
4
|
-
*/
|
|
5
|
-
export type {
|
|
6
|
-
WecomDmConfig,
|
|
7
|
-
WecomAccountConfig,
|
|
8
|
-
WecomConfig,
|
|
9
|
-
ResolvedWecomAccount,
|
|
10
|
-
WecomInboundQuote,
|
|
11
|
-
WecomTemplateCard,
|
|
12
|
-
WecomOutboundMessage,
|
|
13
|
-
} from "./types/index.js";
|
|
14
|
-
|
|
15
|
-
import type {
|
|
16
|
-
WecomBotInboundBase,
|
|
17
|
-
WecomBotInboundText,
|
|
18
|
-
WecomBotInboundVoice,
|
|
19
|
-
WecomBotInboundStreamRefresh,
|
|
20
|
-
WecomBotInboundEvent,
|
|
21
|
-
WecomBotInboundMessage,
|
|
22
|
-
} from "./types/index.js";
|
|
23
|
-
|
|
24
|
-
export type WecomInboundBase = WecomBotInboundBase;
|
|
25
|
-
export type WecomInboundText = WecomBotInboundText;
|
|
26
|
-
export type WecomInboundVoice = WecomBotInboundVoice;
|
|
27
|
-
export type WecomInboundStreamRefresh = WecomBotInboundStreamRefresh;
|
|
28
|
-
export type WecomInboundEvent = WecomBotInboundEvent;
|
|
29
|
-
export type WecomInboundMessage = WecomBotInboundMessage;
|
|
30
|
-
|
|
31
|
-
export type WecomInboundTemplateCardEvent = WecomBotInboundEvent;
|
|
32
|
-
export type WecomTemplateCardEventPayload = {
|
|
33
|
-
card_type: string;
|
|
34
|
-
event_key: string;
|
|
35
|
-
task_id: string;
|
|
36
|
-
response_code?: string;
|
|
37
|
-
selected_items?: {
|
|
38
|
-
question_key?: string;
|
|
39
|
-
option_ids?: string[];
|
|
40
|
-
};
|
|
41
|
-
};
|