@openclaw/imessage 2026.9.1-beta.1 → 2026.9.1

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.
Files changed (33) hide show
  1. package/dist/{accounts-DIpGOIiN.js → accounts-CCirBEIm.js} +2 -3
  2. package/dist/{actions.runtime-BhggncbG.js → actions.runtime-DCjNT81u.js} +5 -5
  3. package/dist/api.js +5 -5
  4. package/dist/{approval-handler.runtime-BC-YsgAf.js → approval-handler.runtime-BReeID1z.js} +14 -9
  5. package/dist/{approval-reactions-Cvwmdlev.js → approval-reactions-DcLRPx7O.js} +6 -10
  6. package/dist/channel-config-api.js +1 -1
  7. package/dist/channel-plugin-api.js +1 -1
  8. package/dist/{channel-CnKQ2MVB.js → channel-zDmMTHWD.js} +16 -12
  9. package/dist/{channel.runtime-BQLCh7bE.js → channel.runtime-qQBHCle8.js} +59 -14
  10. package/dist/{config-schema-DV0KP5nC.js → config-schema-DuGbA8Kp.js} +8 -7
  11. package/dist/contract-api.js +1 -1
  12. package/dist/doctor-contract-api.js +8 -281
  13. package/dist/{group-policy-BipELT2x.js → group-policy-BWqG2esy.js} +18 -12
  14. package/dist/media-contract-api.js +1 -1
  15. package/dist/{media-contract-BVXuQHG2.js → media-contract-pns3TSS5.js} +3 -2
  16. package/dist/{message-tool-api-BwIxJDoz.js → message-tool-api-CUoFESHj.js} +11 -6
  17. package/dist/message-tool-api.js +1 -1
  18. package/dist/{monitor-DRD_Dnp9.js → monitor-AmSj6QIH.js} +293 -27
  19. package/dist/{remote-file-CyTTuRAt.js → remote-file-COTN7196.js} +9 -8
  20. package/dist/runtime-Cza4CY5T.js +8 -0
  21. package/dist/runtime-api.js +7 -7
  22. package/dist/{sanitize-outbound-g651fIhi.js → sanitize-outbound-CN3Hxbjy.js} +393 -82
  23. package/dist/{send-DVQY6M5M.js → send-v0blZfaI.js} +145 -23
  24. package/dist/state-contract-DvahEY4X.js +56 -0
  25. package/dist/state-migrations-D-fyHVcb.js +277 -0
  26. package/node_modules/typebox/build/format/email.mjs +1 -1
  27. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
  28. package/node_modules/typebox/package.json +1 -1
  29. package/openclaw.plugin.json +0 -6
  30. package/package.json +5 -5
  31. package/dist/catchup-Dh-Rv4Ur.js +0 -294
  32. package/dist/monitor-reply-cache-BdeUQaHO.js +0 -353
  33. package/dist/persisted-echo-cache-DGxy-J4t.js +0 -143
@@ -1,143 +0,0 @@
1
- import { f as getIMessageRuntime } from "./monitor-reply-cache-BdeUQaHO.js";
2
- import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
3
- import { createHash } from "node:crypto";
4
- //#region extensions/imessage/src/monitor/echo-text-corruption.ts
5
- function isLeadingEchoTextCorruptionMarker(code) {
6
- return code === 0 || code === 65279 || code === 65533 || code === 65534 || code === 65535;
7
- }
8
- function stripLeadingEchoTextCorruptionMarkers(text) {
9
- let offset = 0;
10
- while (offset < text.length && isLeadingEchoTextCorruptionMarker(text.charCodeAt(offset))) offset += 1;
11
- return offset === 0 ? text : text.slice(offset);
12
- }
13
- //#endregion
14
- //#region extensions/imessage/src/monitor/persisted-echo-cache.ts
15
- const IMESSAGE_SENT_ECHOES_TTL_MS = 720 * 60 * 1e3;
16
- const IMESSAGE_SENT_ECHOES_NAMESPACE = "imessage.sent-echoes";
17
- function normalizeText(text) {
18
- if (!text) return;
19
- return stripLeadingEchoTextCorruptionMarkers(text.replace(/\r\n?/g, "\n").trim()).trim() || void 0;
20
- }
21
- function normalizeMessageId(messageId) {
22
- const normalized = messageId?.trim();
23
- if (!normalized || normalized === "ok" || normalized === "unknown") return;
24
- return normalized;
25
- }
26
- let mirror = null;
27
- let persistenceFailureLogged = false;
28
- function reportFailure(scope, err) {
29
- if (persistenceFailureLogged) return;
30
- persistenceFailureLogged = true;
31
- logVerbose(`imessage echo-cache: ${scope} disabled after first failure: ${String(err)}`);
32
- }
33
- function resolveIMessageSentEchoEntryKey(entry) {
34
- return createHash("sha256").update(JSON.stringify([
35
- entry.scope,
36
- entry.text ?? "",
37
- resolveIMessageEchoMediaKey(entry.media) ?? "",
38
- entry.messageId ?? "",
39
- entry.timestamp
40
- ])).digest("hex").slice(0, 32);
41
- }
42
- function resolveIMessageEchoMediaKey(media) {
43
- const contentType = media?.contentType?.trim().toLowerCase() || void 0;
44
- const kind = media?.kind && media.kind !== "unknown" ? media.kind : void 0;
45
- if (kind) return `kind:${kind}`;
46
- const normalizedContentType = contentType?.split(";", 1)[0]?.trim();
47
- return normalizedContentType ? `mime:${normalizedContentType}` : void 0;
48
- }
49
- function normalizeMedia(media) {
50
- if (!resolveIMessageEchoMediaKey(media)) return;
51
- const contentType = media?.contentType?.trim().toLowerCase() || void 0;
52
- const kind = media?.kind ?? void 0;
53
- return {
54
- ...kind ? { kind } : {},
55
- ...contentType ? { contentType } : {}
56
- };
57
- }
58
- function openPersistedEchoStore() {
59
- return getIMessageRuntime().state.openSyncKeyedStore({
60
- namespace: IMESSAGE_SENT_ECHOES_NAMESPACE,
61
- maxEntries: 256
62
- });
63
- }
64
- function remainingTtlMs(timestamp) {
65
- const remaining = IMESSAGE_SENT_ECHOES_TTL_MS - Math.max(0, Date.now() - timestamp);
66
- return remaining > 0 ? remaining : void 0;
67
- }
68
- function resolveEntryTtlMs(entry, ttlMs) {
69
- if (typeof ttlMs === "number" && Number.isFinite(ttlMs) && ttlMs > 0) return ttlMs;
70
- return remainingTtlMs(entry.timestamp);
71
- }
72
- function isLiveEntry(entry, now = Date.now()) {
73
- const cutoff = now - IMESSAGE_SENT_ECHOES_TTL_MS;
74
- return entry.timestamp >= cutoff && (entry.expiresAt == null || entry.expiresAt > now);
75
- }
76
- function loadMirrorFromStore() {
77
- try {
78
- mirror = openPersistedEchoStore().entries().map(({ value }) => value).filter((entry) => isLiveEntry(entry)).toSorted((a, b) => a.timestamp - b.timestamp).slice(-256);
79
- } catch (err) {
80
- reportFailure("read", err);
81
- mirror = [];
82
- }
83
- }
84
- function readRecentEntries() {
85
- loadMirrorFromStore();
86
- return mirror ?? [];
87
- }
88
- function persistEntry(entry, ttlMs) {
89
- const effectiveTtlMs = resolveEntryTtlMs(entry, ttlMs);
90
- if (!effectiveTtlMs) return;
91
- const key = resolveIMessageSentEchoEntryKey(entry);
92
- try {
93
- openPersistedEchoStore().register(key, entry, { ttlMs: effectiveTtlMs });
94
- } catch (err) {
95
- reportFailure("write", err);
96
- return;
97
- }
98
- return key;
99
- }
100
- function rememberPersistedIMessageEcho(params) {
101
- const text = normalizeText(params.text);
102
- const media = normalizeMedia(params.media);
103
- const messageId = normalizeMessageId(params.messageId);
104
- const entry = {
105
- scope: params.scope,
106
- timestamp: Date.now(),
107
- ...text ? { text } : {},
108
- ...media ? { media } : {},
109
- ...messageId ? { messageId } : {},
110
- ...params.pending ? { pending: true } : {}
111
- };
112
- if (typeof params.ttlMs === "number" && Number.isFinite(params.ttlMs) && params.ttlMs > 0) entry.expiresAt = entry.timestamp + params.ttlMs;
113
- if (!entry.text && !entry.media && !entry.messageId) return;
114
- loadMirrorFromStore();
115
- const key = persistEntry(entry, params.ttlMs);
116
- mirror = [...mirror ?? [], entry].filter((candidate) => isLiveEntry(candidate)).slice(-256);
117
- return key;
118
- }
119
- function forgetPersistedIMessageEchoKey(key) {
120
- if (!key) return;
121
- try {
122
- openPersistedEchoStore().delete(key);
123
- } catch (err) {
124
- reportFailure("delete", err);
125
- }
126
- mirror = (mirror ?? []).filter((entry) => resolveIMessageSentEchoEntryKey(entry) !== key);
127
- }
128
- function hasPersistedIMessageEcho(params) {
129
- const text = normalizeText(params.text);
130
- const mediaKey = resolveIMessageEchoMediaKey(params.media);
131
- const messageId = normalizeMessageId(params.messageId);
132
- if (!text && !mediaKey && !messageId) return false;
133
- for (const entry of readRecentEntries()) {
134
- if (entry.scope !== params.scope) continue;
135
- if (messageId && entry.messageId === messageId) return true;
136
- const hasConflictingMessageIds = Boolean(messageId && entry.messageId && messageId !== entry.messageId);
137
- if (text && (!hasConflictingMessageIds || params.skipIdShortCircuit) && entry.text === text && (!entry.pending || params.includePendingText)) return true;
138
- if (mediaKey && !hasConflictingMessageIds && resolveIMessageEchoMediaKey(entry.media) === mediaKey && (!entry.pending || params.includePendingText)) return true;
139
- }
140
- return false;
141
- }
142
- //#endregion
143
- export { rememberPersistedIMessageEcho as a, stripLeadingEchoTextCorruptionMarkers as c, hasPersistedIMessageEcho as i, IMESSAGE_SENT_ECHOES_TTL_MS as n, resolveIMessageEchoMediaKey as o, forgetPersistedIMessageEchoKey as r, resolveIMessageSentEchoEntryKey as s, IMESSAGE_SENT_ECHOES_NAMESPACE as t };