@xmanrui/dsh-im 4.35.0 → 4.36.0
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 +4 -3
- package/lib/index.js +311 -310
- package/package.json +3 -3
- 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 +8 -0
- package/src/channels/qq/qq-controller.mjs +14 -0
- package/src/channels/qq/qq-runtime.mjs +10 -0
- package/src/channels/shared/deferred-delivery-coordinator.mjs +2 -1
- package/src/channels/shared/deferred-delivery.mjs +8 -5
- package/src/channels/shared/harness-approval.mjs +84 -7
- package/src/channels/shared/harness-client.mjs +152 -42
- package/src/channels/shared/i18n-en/shared-a.mjs +6 -2
- package/src/channels/shared/i18n-en/shared-c.mjs +3 -0
- package/src/channels/shared/message-failure.mjs +6 -2
- 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
|
@@ -289,6 +289,20 @@ export class WeixinController {
|
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
+
async presentSessionSyncApproval(botId, target, interaction, options = {}) {
|
|
293
|
+
const config = this.#configStore.get(botId);
|
|
294
|
+
if (!config) throw new Error('Unknown Weixin account');
|
|
295
|
+
return this.#withBotTransition(botId, async () => {
|
|
296
|
+
const runtime = this.#runtimes.get(botId);
|
|
297
|
+
if (!runtime?.status?.ready || typeof runtime.presentSessionSyncApproval !== 'function') {
|
|
298
|
+
const error = new Error(t('微信连接当前离线'));
|
|
299
|
+
error.code = 'bot-not-connected';
|
|
300
|
+
throw error;
|
|
301
|
+
}
|
|
302
|
+
return runtime.presentSessionSyncApproval(target, interaction, options);
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
|
|
292
306
|
async deleteBot(botId) {
|
|
293
307
|
const config = this.#configStore.get(botId);
|
|
294
308
|
if (!config) throw weixinStageError('workspace-bot-not-found', undefined, 'account.remove');
|
|
@@ -392,6 +392,16 @@ export class WeixinRuntime {
|
|
|
392
392
|
return result;
|
|
393
393
|
}
|
|
394
394
|
|
|
395
|
+
async presentSessionSyncApproval(target, interaction, options = {}) {
|
|
396
|
+
if (!this.#status.ready || !this.#bridge) return false;
|
|
397
|
+
const actor = typeof target?.route?.toUserId === 'string' ? target.route.toUserId.trim() : '';
|
|
398
|
+
if (!actor) return false;
|
|
399
|
+
return this.#bridge.presentSessionSyncApproval(interaction, {
|
|
400
|
+
key: options.key, actor, validate: options.validate,
|
|
401
|
+
send: (text) => this.sendProactiveText(target, text),
|
|
402
|
+
}, options);
|
|
403
|
+
}
|
|
404
|
+
|
|
395
405
|
async sendProactiveText(target, text, { signal } = {}) {
|
|
396
406
|
const toUserId = typeof target?.route?.toUserId === 'string'
|
|
397
407
|
? target.route.toUserId.trim() : '';
|
|
@@ -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'
|