dsh-message-gateway 0.1.36 → 0.1.37

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/lib/index.js CHANGED
@@ -474,6 +474,7 @@ var init_gateway_store = __esm({
474
474
  });
475
475
 
476
476
  // src/index.ts
477
+ import { Service } from "@deepseek-ai/cordis";
477
478
  import { defineTool } from "@deepseek-ai/dsh-tools";
478
479
 
479
480
  // src/host/bridge-manager.ts
@@ -5745,8 +5746,23 @@ var Config = Schema.object({
5745
5746
 
5746
5747
  // src/index.ts
5747
5748
  var inject = ["webServer", "sessions", "agents", "agentDefaultModel", "tools"];
5749
+ var MessageGatewayService = class extends Service {
5750
+ constructor(ctx, manager) {
5751
+ super(ctx, "messageGateway");
5752
+ this.manager = manager;
5753
+ }
5754
+ /** 向已配置的平台推送文本(平台 id / 目标与 send_chat_message 一致)。 */
5755
+ push(platform, target, message, opts = {}) {
5756
+ return this.manager.pushMessage(platform, target, message, opts);
5757
+ }
5758
+ /** 把一次提示交给网关的专用 agent,等待完整回复。 */
5759
+ ask(prompt, timeoutMs) {
5760
+ return this.manager.sendAndWait(prompt, timeoutMs);
5761
+ }
5762
+ };
5748
5763
  function apply(ctx, config = Config({})) {
5749
5764
  const manager = new BridgeManager(ctx, config);
5765
+ new MessageGatewayService(ctx, manager);
5750
5766
  ctx.effect(() => {
5751
5767
  void loadStore().then((store) => {
5752
5768
  const wecom = store.platforms["wecom-aibot"];
@@ -5960,6 +5976,7 @@ export {
5960
5976
  DiscordBridge,
5961
5977
  EmailBridge,
5962
5978
  ImapClient,
5979
+ MessageGatewayService,
5963
5980
  PLATFORMS,
5964
5981
  QQBridge,
5965
5982
  QqWebhookBridge,