@aka_openclaw_plugin/mychat 0.2.6 → 0.2.8
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/api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as tryGetMychatRuntime, i as setMychatRuntime, n as init_runtime, t as getMychatRuntime } from "./runtime-CkiGSF1r.js";
|
|
2
|
-
import { t as mychatPlugin } from "./channel-
|
|
2
|
+
import { t as mychatPlugin } from "./channel-DMX-AylR.js";
|
|
3
3
|
//#region extensions/mychat/api.ts
|
|
4
4
|
init_runtime();
|
|
5
5
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as init_runtime, o as __toCommonJS, r as runtime_exports, t as getMychatRuntime } from "./runtime-CkiGSF1r.js";
|
|
2
2
|
import { n as resolveMychatAccounts, t as resolveMychatAccount } from "./accounts-BTv5784y.js";
|
|
3
3
|
import { t as mychatConfigSchema } from "./config-schema-CjCqWPdP.js";
|
|
4
4
|
import { createChannelPluginBase, createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
|
|
@@ -707,16 +707,13 @@ async function monitorMychatProvider(ctx) {
|
|
|
707
707
|
if (!health.ok) logger?.warn(`${prefix} health check failed latencyMs=${health.latencyMs} baseUrl=${account.baseUrl}`);
|
|
708
708
|
else logger?.info(`${prefix} health check ok latencyMs=${health.latencyMs}`);
|
|
709
709
|
const { wsClient } = createMychatProviderClients(account, botSelf.botId, logger);
|
|
710
|
-
const
|
|
711
|
-
|
|
710
|
+
const runtimeStore = getMychatRuntime();
|
|
711
|
+
runtimeStore.mychat = {
|
|
712
712
|
accountId: account.accountId,
|
|
713
713
|
httpClient,
|
|
714
714
|
wsClient,
|
|
715
715
|
botSelf
|
|
716
716
|
};
|
|
717
|
-
try {
|
|
718
|
-
setMychatRuntime(ctx.runtime);
|
|
719
|
-
} catch {}
|
|
720
717
|
const handler = createMychatMessageHandler({
|
|
721
718
|
account,
|
|
722
719
|
botSelfId: botSelf.botId,
|
|
@@ -777,11 +774,11 @@ async function monitorMychatProvider(ctx) {
|
|
|
777
774
|
}
|
|
778
775
|
/** Dispatch an inbound message through the OpenClaw turn runtime. */
|
|
779
776
|
async function dispatchMychatInbound(ctx, httpClient, result) {
|
|
780
|
-
const { runtime, cfg, account } = ctx;
|
|
777
|
+
const { runtime, channelRuntime, cfg, account } = ctx;
|
|
781
778
|
const logger = ctx.log;
|
|
782
779
|
const prefix = mychatLogPrefix("dispatch");
|
|
783
|
-
const rt =
|
|
784
|
-
if (!rt
|
|
780
|
+
const rt = getMychatRuntime().channel ?? channelRuntime;
|
|
781
|
+
if (!rt?.turn?.run) {
|
|
785
782
|
logger?.error(`${prefix} channel.turn.run not available on runtime, cannot dispatch inbound messageId=${result.context.messageId}`);
|
|
786
783
|
return;
|
|
787
784
|
}
|
|
@@ -790,7 +787,7 @@ async function dispatchMychatInbound(ctx, httpClient, result) {
|
|
|
790
787
|
const senderId = result.context.senderId;
|
|
791
788
|
const chatType = result.context.chatType;
|
|
792
789
|
const messageId = result.context.messageId;
|
|
793
|
-
await rt.
|
|
790
|
+
await rt.turn.run({
|
|
794
791
|
channel: "mychat",
|
|
795
792
|
accountId: account.accountId,
|
|
796
793
|
raw: result,
|
|
@@ -804,7 +801,7 @@ async function dispatchMychatInbound(ctx, httpClient, result) {
|
|
|
804
801
|
raw: result
|
|
805
802
|
}),
|
|
806
803
|
resolveTurn: (input) => {
|
|
807
|
-
const msgCtx = rt.
|
|
804
|
+
const msgCtx = rt.turn.buildContext({
|
|
808
805
|
channel: "mychat",
|
|
809
806
|
accountId: account.accountId,
|
|
810
807
|
timestamp: input.timestamp,
|
|
@@ -912,6 +909,7 @@ function createMychatPluginBase() {
|
|
|
912
909
|
const result = await monitorMychatProvider({
|
|
913
910
|
cfg: ctx.cfg,
|
|
914
911
|
runtime: ctx.runtime,
|
|
912
|
+
channelRuntime: ctx.channelRuntime,
|
|
915
913
|
account: ctx.account,
|
|
916
914
|
setStatus,
|
|
917
915
|
abortSignal: ctx.abortSignal,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as mychatPlugin } from "./channel-
|
|
1
|
+
import { t as mychatPlugin } from "./channel-DMX-AylR.js";
|
|
2
2
|
export { mychatPlugin };
|