@aka_openclaw_plugin/mychat 0.1.9 → 0.1.10

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/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-PfFuZ2Rm.js";
2
- import { t as mychatPlugin } from "./channel-MvJfw3N_.js";
2
+ import { t as mychatPlugin } from "./channel-BTGCJxf9.js";
3
3
  //#region api.ts
4
4
  init_runtime();
5
5
  //#endregion
@@ -3929,6 +3929,7 @@ function createMychatProviderLifecycle(params) {
3929
3929
  return {
3930
3930
  async waitForReady() {
3931
3931
  const start = Date.now();
3932
+ console.log(`[mychat:lifecycle] starting timeoutMs=${readyTimeoutMs}`);
3932
3933
  logger?.info(`${prefix} starting connection lifecycle timeoutMs=${readyTimeoutMs}`);
3933
3934
  wsClient.connect();
3934
3935
  let wsConnectedAt = null;
@@ -3937,24 +3938,29 @@ function createMychatProviderLifecycle(params) {
3937
3938
  if (wsClient.isConnected()) {
3938
3939
  if (!wsConnectedAt) {
3939
3940
  wsConnectedAt = Date.now();
3941
+ console.log(`[mychat:lifecycle] ws connected, fetching bot identity elapsedMs=${wsConnectedAt - start}`);
3940
3942
  logger?.info(`${prefix} ws connected, fetching bot identity elapsedMs=${wsConnectedAt - start}`);
3941
3943
  }
3942
3944
  getSelfAttempts++;
3943
3945
  const botSelf = await httpClient.getSelf();
3944
3946
  if (botSelf) {
3947
+ console.log(`[mychat:lifecycle] bot connected botId=${botSelf.botId} wsConnectMs=${wsConnectedAt - start} getSelfAttempts=${getSelfAttempts}`);
3945
3948
  logger?.info(`${prefix} bot connected botId=${botSelf.botId} wsConnectMs=${wsConnectedAt - start} getSelfAttempts=${getSelfAttempts}`);
3946
3949
  return botSelf;
3947
3950
  }
3951
+ console.warn(`[mychat:lifecycle] getSelf() failed attempt=${getSelfAttempts} elapsedMs=${Date.now() - start}`);
3948
3952
  logger?.warn(`${prefix} getSelf() failed attempt=${getSelfAttempts} elapsedMs=${Date.now() - start}`);
3949
3953
  }
3950
3954
  await new Promise((r) => setTimeout(r, 500));
3951
3955
  }
3952
3956
  const wsConnected = wsClient.isConnected();
3953
3957
  const elapsed = Date.now() - start;
3958
+ console.warn(`[mychat:lifecycle] ready timeout wsConnected=${wsConnected} wsConnectedAt=${wsConnectedAt ? wsConnectedAt - start : "never"} getSelfAttempts=${getSelfAttempts} elapsedMs=${elapsed} timeoutMs=${readyTimeoutMs}`);
3954
3959
  logger?.warn(`${prefix} ready timeout wsConnected=${wsConnected} wsConnectedAt=${wsConnectedAt ? wsConnectedAt - start : "never"} getSelfAttempts=${getSelfAttempts} elapsedMs=${elapsed} timeoutMs=${readyTimeoutMs}`);
3955
3960
  return null;
3956
3961
  },
3957
3962
  shutdown() {
3963
+ console.log(`[mychat:lifecycle] shutdown`);
3958
3964
  wsClient.disconnect();
3959
3965
  logger?.info(`${prefix} shutdown`);
3960
3966
  }
@@ -4114,6 +4120,7 @@ async function monitorMychatProvider(ctx) {
4114
4120
  const { account, setStatus } = ctx;
4115
4121
  const logger = getMychatLogger();
4116
4122
  const prefix = mychatLogPrefix("provider");
4123
+ console.log(`[mychat:provider] starting accountId=${account.accountId}`);
4117
4124
  if (logger) logger.info(`${prefix} starting accountId=${account.accountId}`);
4118
4125
  setStatus({
4119
4126
  connected: false,
@@ -4123,10 +4130,12 @@ async function monitorMychatProvider(ctx) {
4123
4130
  baseUrl: account.baseUrl,
4124
4131
  token: account.token
4125
4132
  });
4133
+ console.log(`[mychat:provider] fetching bot identity baseUrl=${account.baseUrl}`);
4126
4134
  if (logger) logger.info(`${prefix} fetching bot identity baseUrl=${account.baseUrl}`);
4127
4135
  const botSelf = await httpClient.getSelf();
4128
4136
  if (!botSelf) {
4129
4137
  const error = `MyChat provider failed to get bot identity (baseUrl=${account.baseUrl}, token=${account.token ? account.token.slice(0, 8) + "..." : "empty"})`;
4138
+ console.error(`[mychat:provider] ${error}`);
4130
4139
  if (logger) logger.error(`${prefix} ${error}`);
4131
4140
  setStatus({
4132
4141
  connected: false,
@@ -4134,11 +4143,16 @@ async function monitorMychatProvider(ctx) {
4134
4143
  });
4135
4144
  throw new Error(error);
4136
4145
  }
4146
+ console.log(`[mychat:provider] got bot identity botId=${botSelf.botId} name=${botSelf.name ?? "unknown"}`);
4137
4147
  if (logger) logger.info(`${prefix} got bot identity botId=${botSelf.botId} name=${botSelf.name ?? "unknown"}`);
4138
4148
  const health = await httpClient.healthCheck();
4139
4149
  if (!health.ok) {
4150
+ console.warn(`[mychat:provider] health check failed latencyMs=${health.latencyMs} baseUrl=${account.baseUrl}`);
4140
4151
  if (logger) logger.warn(`${prefix} health check failed latencyMs=${health.latencyMs} baseUrl=${account.baseUrl}`);
4141
- } else if (logger) logger.info(`${prefix} health check ok latencyMs=${health.latencyMs}`);
4152
+ } else {
4153
+ console.log(`[mychat:provider] health check ok latencyMs=${health.latencyMs}`);
4154
+ if (logger) logger.info(`${prefix} health check ok latencyMs=${health.latencyMs}`);
4155
+ }
4142
4156
  const { wsClient } = createMychatProviderClients(account, botSelf.botId);
4143
4157
  const rt = ctx.runtime;
4144
4158
  rt.mychat = {
@@ -4160,6 +4174,7 @@ async function monitorMychatProvider(ctx) {
4160
4174
  }),
4161
4175
  wsClient
4162
4176
  });
4177
+ console.log(`[mychat:provider] starting connection lifecycle`);
4163
4178
  const lifecycle = createMychatProviderLifecycle({
4164
4179
  httpClient,
4165
4180
  wsClient
@@ -4167,6 +4182,7 @@ async function monitorMychatProvider(ctx) {
4167
4182
  const readyBotSelf = await lifecycle.waitForReady();
4168
4183
  if (!readyBotSelf) {
4169
4184
  const error = "MyChat provider failed to connect";
4185
+ console.error(`[mychat:provider] ${error}`);
4170
4186
  if (logger) logger.error(`${prefix} ${error}`);
4171
4187
  setStatus({
4172
4188
  connected: false,
@@ -4182,13 +4198,16 @@ async function monitorMychatProvider(ctx) {
4182
4198
  mode: "websocket",
4183
4199
  lastError: null
4184
4200
  });
4201
+ console.log(`[mychat:provider] bot connected botId=${readyBotSelf.botId}`);
4185
4202
  if (logger) logger.info(`${prefix} bot connected botId=${readyBotSelf.botId}`);
4186
4203
  ctx.abortSignal?.addEventListener("abort", () => {
4204
+ console.log(`[mychat:provider] abort signal received, shutting down`);
4187
4205
  if (logger) logger.info(`${prefix} abort signal received, shutting down`);
4188
4206
  lifecycle.shutdown();
4189
4207
  setStatus({ connected: false });
4190
4208
  });
4191
4209
  return { unsubscribe() {
4210
+ console.log(`[mychat:provider] unsubscribe called, shutting down`);
4192
4211
  lifecycle.shutdown();
4193
4212
  setStatus({ connected: false });
4194
4213
  } };
@@ -1,2 +1,2 @@
1
- import { t as mychatPlugin } from "./channel-MvJfw3N_.js";
1
+ import { t as mychatPlugin } from "./channel-BTGCJxf9.js";
2
2
  export { mychatPlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aka_openclaw_plugin/mychat",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "OpenClaw MyChat channel plugin",
5
5
  "repository": {
6
6
  "type": "git",
package/setup-entry.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as mychatPlugin } from "./channel-MvJfw3N_.js";
1
+ import { t as mychatPlugin } from "./channel-BTGCJxf9.js";
2
2
  export { mychatPlugin };