@invago/mixin 1.0.13 → 1.0.15

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.
@@ -2,7 +2,7 @@
2
2
  "id": "mixin",
3
3
  "name": "Mixin Messenger Channel",
4
4
  "description": "Mixin Messenger channel via Blaze WebSocket",
5
- "version": "1.0.13",
5
+ "version": "1.0.15",
6
6
  "channels": [
7
7
  "mixin"
8
8
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@invago/mixin",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "description": "Mixin Messenger channel plugin for OpenClaw",
5
5
  "type": "module",
6
6
  "main": "index.ts",
package/src/channel.ts CHANGED
@@ -1,12 +1,11 @@
1
1
  import { execFile } from "node:child_process";
2
2
  import { promisify } from "node:util";
3
3
  import { uniqueConversationID } from "@mixin.dev/mixin-node-sdk";
4
- import {
5
- buildChannelConfigSchema,
6
- createDefaultChannelRuntimeState,
7
- formatPairingApproveHint,
8
- resolveChannelMediaMaxBytes,
9
- } from "openclaw/plugin-sdk";
4
+ import {
5
+ buildChannelConfigSchema,
6
+ formatPairingApproveHint,
7
+ resolveChannelMediaMaxBytes,
8
+ } from "openclaw/plugin-sdk";
10
9
  import type { ChannelGatewayContext, OpenClawConfig, ReplyPayload } from "openclaw/plugin-sdk";
11
10
  import { runBlazeLoop } from "./blaze-service.js";
12
11
  import { buildClient, sleep } from "./shared.js";
@@ -27,8 +26,24 @@ const BASE_DELAY = 1000;
27
26
  const MAX_DELAY = 3000;
28
27
  const MULTIPLIER = 1.5;
29
28
  const MEDIA_MAX_BYTES = 30 * 1024 * 1024;
30
- const execFileAsync = promisify(execFile);
31
- const CONVERSATION_CATEGORY_CACHE_TTL_MS = 5 * 60 * 1000;
29
+ const execFileAsync = promisify(execFile);
30
+ const CONVERSATION_CATEGORY_CACHE_TTL_MS = 5 * 60 * 1000;
31
+
32
+ function createDefaultMixinRuntimeState(accountId: string): {
33
+ accountId: string;
34
+ running: boolean;
35
+ lastStartAt: number | null;
36
+ lastStopAt: number | null;
37
+ lastError: string | null;
38
+ } {
39
+ return {
40
+ accountId,
41
+ running: false,
42
+ lastStartAt: null,
43
+ lastStopAt: null,
44
+ lastError: null,
45
+ };
46
+ }
32
47
 
33
48
  const conversationCategoryCache = new Map<string, {
34
49
  category: "CONTACT" | "GROUP";
@@ -512,8 +527,8 @@ export const mixinPlugin = {
512
527
  },
513
528
  },
514
529
 
515
- status: {
516
- defaultRuntime: createDefaultChannelRuntimeState("default"),
530
+ status: {
531
+ defaultRuntime: createDefaultMixinRuntimeState("default"),
517
532
  buildChannelSummary: (params: {
518
533
  snapshot: {
519
534
  configured?: boolean | null;
package/src/status.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { buildBaseAccountStatusSnapshot, buildBaseChannelStatusSummary } from "openclaw/plugin-sdk";
2
1
  import type { OpenClawConfig } from "openclaw/plugin-sdk";
3
2
  import { getAccountConfig, resolveDefaultAccountId } from "./config.js";
4
3
  import { getOutboxPathsSnapshot, type OutboxStatus } from "./send-service.js";
@@ -44,6 +43,71 @@ type MixinStatusAccount = {
44
43
  };
45
44
  };
46
45
 
46
+ function buildBaseChannelStatusSummary(snapshot: MixinChannelStatusSnapshot): {
47
+ configured: boolean;
48
+ running: boolean;
49
+ lastStartAt: number | null;
50
+ lastStopAt: number | null;
51
+ lastError: string | null;
52
+ } {
53
+ return {
54
+ configured: snapshot.configured ?? false,
55
+ running: snapshot.running ?? false,
56
+ lastStartAt: snapshot.lastStartAt ?? null,
57
+ lastStopAt: snapshot.lastStopAt ?? null,
58
+ lastError: snapshot.lastError ?? null,
59
+ };
60
+ }
61
+
62
+ function buildRuntimeAccountStatusSnapshot(params: {
63
+ runtime?: RuntimeLifecycleSnapshot | null;
64
+ probe?: unknown;
65
+ }): {
66
+ running: boolean;
67
+ lastStartAt: number | null;
68
+ lastStopAt: number | null;
69
+ lastError: string | null;
70
+ probe?: unknown;
71
+ } {
72
+ const { runtime, probe } = params;
73
+ return {
74
+ running: runtime?.running ?? false,
75
+ lastStartAt: runtime?.lastStartAt ?? null,
76
+ lastStopAt: runtime?.lastStopAt ?? null,
77
+ lastError: runtime?.lastError ?? null,
78
+ probe,
79
+ };
80
+ }
81
+
82
+ function buildBaseAccountStatusSnapshot(params: {
83
+ account: MixinStatusAccount;
84
+ runtime?: RuntimeLifecycleSnapshot | null;
85
+ probe?: unknown;
86
+ }): {
87
+ accountId: string;
88
+ name?: string;
89
+ enabled?: boolean;
90
+ configured?: boolean;
91
+ running: boolean;
92
+ lastStartAt: number | null;
93
+ lastStopAt: number | null;
94
+ lastError: string | null;
95
+ probe?: unknown;
96
+ lastInboundAt: number | null;
97
+ lastOutboundAt: number | null;
98
+ } {
99
+ const { account, runtime, probe } = params;
100
+ return {
101
+ accountId: account.accountId,
102
+ name: account.name,
103
+ enabled: account.enabled,
104
+ configured: account.configured,
105
+ ...buildRuntimeAccountStatusSnapshot({ runtime, probe }),
106
+ lastInboundAt: runtime?.lastInboundAt ?? null,
107
+ lastOutboundAt: runtime?.lastOutboundAt ?? null,
108
+ };
109
+ }
110
+
47
111
  export function resolveMixinStatusSnapshot(
48
112
  cfg: OpenClawConfig,
49
113
  accountId?: string,