@xmanrui/dsh-im 4.35.1 → 4.36.1
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/PROACTIVE_DELIVERY.en.md +50 -0
- package/PROACTIVE_DELIVERY.md +22 -0
- package/README.en.md +3 -1
- package/README.md +3 -1
- package/lib/client.js +30 -8
- package/lib/index.js +309 -309
- package/package.json +3 -3
- package/plugin-src/client/connection-error.js +2 -1
- package/plugin-src/host/channels/dingtalk/production.mjs +1 -1
- package/plugin-src/host/channels/feishu/production.mjs +4 -2
- package/plugin-src/host/channels/matrix/production.mjs +1 -1
- package/plugin-src/host/channels/qq/production.mjs +1 -1
- package/plugin-src/host/channels/shared/production.mjs +1 -1
- package/plugin-src/host/channels/slack/production.mjs +1 -1
- package/plugin-src/host/channels/wecom/production.mjs +1 -1
- package/plugin-src/host/channels/wecom-app/production.mjs +1 -1
- package/plugin-src/host/channels/weixin/production.mjs +1 -1
- package/plugin-src/host/channels/whatsapp/production.mjs +1 -1
- package/plugin-src/host/delivery-adapter.mjs +60 -12
- package/plugin-src/host/delivery-service.mjs +127 -1
- package/plugin-src/host/delivery-suggestions.mjs +2 -1
- package/plugin-src/host/harness-connection.mjs +3 -7
- package/plugin-src/host/index.mjs +5 -2
- package/plugin-src/host/modern-harness-api.mjs +139 -4
- package/src/channels/dingtalk/dingtalk-bridge.mjs +6 -0
- package/src/channels/dingtalk/dingtalk-controller.mjs +14 -0
- package/src/channels/dingtalk/dingtalk-runtime.mjs +10 -0
- package/src/channels/discord/discord-runtime.mjs +13 -0
- package/src/channels/feishu/bridge.mjs +30 -13
- package/src/channels/feishu/external-consumer.mjs +118 -0
- package/src/channels/feishu/feishu-runtime.mjs +72 -3
- package/src/channels/feishu/history-reader.mjs +92 -0
- package/src/channels/feishu/multi-bot-controller.mjs +130 -2
- package/src/channels/feishu/nearby-history.mjs +72 -0
- package/src/channels/feishu/plugin-config-store.mjs +1 -0
- package/src/channels/matrix/matrix-controller.mjs +9 -0
- package/src/channels/matrix/matrix-runtime.mjs +14 -0
- package/src/channels/qq/qq-bridge.mjs +6 -0
- package/src/channels/qq/qq-controller.mjs +14 -0
- package/src/channels/qq/qq-runtime.mjs +10 -0
- package/src/channels/shared/connection-error.mjs +1 -0
- package/src/channels/shared/diagnostic-details.mjs +7 -1
- package/src/channels/shared/harness-approval.mjs +84 -7
- package/src/channels/shared/harness-client.mjs +51 -40
- package/src/channels/shared/i18n-en/diagnostics.mjs +3 -0
- package/src/channels/shared/i18n-en/shared-c.mjs +3 -0
- package/src/channels/shared/message-failure.mjs +1 -1
- package/src/channels/shared/text-harness-bridge.mjs +6 -0
- package/src/channels/shared/token-bot-controller.mjs +16 -0
- package/src/channels/slack/manifest.mjs +1 -0
- package/src/channels/slack/slack-api.mjs +7 -0
- package/src/channels/slack/slack-controller.mjs +14 -0
- package/src/channels/slack/slack-runtime.mjs +12 -0
- package/src/channels/telegram/telegram-runtime.mjs +10 -0
- package/src/channels/wecom/wecom-bridge.mjs +6 -0
- package/src/channels/wecom/wecom-controller.mjs +14 -0
- package/src/channels/wecom/wecom-runtime.mjs +10 -0
- package/src/channels/wecom-app/wecom-app-bridge.mjs +6 -0
- package/src/channels/wecom-app/wecom-app-controller.mjs +14 -0
- package/src/channels/wecom-app/wecom-app-runtime.mjs +10 -0
- package/src/channels/weixin/weixin-bridge.mjs +6 -0
- package/src/channels/weixin/weixin-controller.mjs +14 -0
- package/src/channels/weixin/weixin-runtime.mjs +10 -0
- package/src/channels/whatsapp/whatsapp-controller.mjs +14 -0
- package/src/channels/whatsapp/whatsapp-runtime.mjs +10 -0
|
@@ -248,6 +248,20 @@ export class WhatsappController {
|
|
|
248
248
|
});
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
+
async presentSessionSyncApproval(botId, target, interaction, options = {}) {
|
|
252
|
+
const config = this.#configStore.get(botId);
|
|
253
|
+
if (!config) throw new Error('Unknown WhatsApp bot');
|
|
254
|
+
return this.#withBotTransition(botId, async () => {
|
|
255
|
+
const runtime = this.#runtimes.get(botId);
|
|
256
|
+
if (!runtime?.status?.ready || typeof runtime.presentSessionSyncApproval !== 'function') {
|
|
257
|
+
const error = new Error(t('WhatsApp机器人尚未连接'));
|
|
258
|
+
error.code = 'bot-not-connected';
|
|
259
|
+
throw error;
|
|
260
|
+
}
|
|
261
|
+
return runtime.presentSessionSyncApproval(target, interaction, options);
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
|
|
251
265
|
async setAccessPolicy(botId, value) {
|
|
252
266
|
if (this.#closed) throw new Error('WhatsApp controller is closed');
|
|
253
267
|
const accessPolicy = normalizeWhatsappAccessPolicy(value);
|
|
@@ -876,6 +876,16 @@ export class WhatsappRuntime {
|
|
|
876
876
|
return { sent: true };
|
|
877
877
|
}
|
|
878
878
|
|
|
879
|
+
async presentSessionSyncApproval(target, interaction, options = {}) {
|
|
880
|
+
if (!this.#status.ready || !this.#bridge) return false;
|
|
881
|
+
const actor = typeof target?.route?.jid === 'string' ? target.route.jid.trim() : '';
|
|
882
|
+
if (!actor) return false;
|
|
883
|
+
return this.#bridge.presentSessionSyncApproval(interaction, {
|
|
884
|
+
key: options.key, actor, validate: options.validate,
|
|
885
|
+
send: (text) => this.sendProactiveText(target, text),
|
|
886
|
+
}, options);
|
|
887
|
+
}
|
|
888
|
+
|
|
879
889
|
async sendProactiveText(target, text, { signal } = {}) {
|
|
880
890
|
const jid = typeof target?.route?.jid === 'string' ? target.route.jid.trim() : '';
|
|
881
891
|
const validUser = target?.kind === 'user'
|