@openclaw/discord 2026.9.6 → 2026.9.7

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 (150) hide show
  1. package/assets/icon.png +0 -0
  2. package/dist/.setup/{account-inspect-BwQj24ht.mjs → account-inspect-De8hOUxG.mjs} +1 -1
  3. package/dist/.setup/{accounts-CwJQoLjM.mjs → accounts-ChaMcixG.mjs} +1 -4
  4. package/dist/.setup/{activities-api-COU4-0nR.mjs → activities-api-tvbsU2e3.mjs} +38 -66
  5. package/dist/.setup/{api-CBK9zcq5.mjs → api-DVbJwZVt.mjs} +10 -2
  6. package/dist/.setup/{approval-handler.runtime-CbBktBb4.mjs → approval-handler.runtime-DxCK2Rux.mjs} +49 -125
  7. package/dist/.setup/{approval-message-updates-jf9zMaIC.mjs → approval-message-updates-BKFqavHZ.mjs} +2 -2
  8. package/dist/.setup/{audit-vKbh-LFR.mjs → audit-CLg9I71N.mjs} +5 -5
  9. package/dist/.setup/{channel-Dv4e3Jpc.mjs → channel-DxlUVU9t.mjs} +121 -227
  10. package/dist/.setup/{channel-type-DKnjV1XW.mjs → channel-type-DRCrEMss.mjs} +22 -22
  11. package/dist/.setup/{channel.setup-0NX6FFwi.mjs → channel.setup-CRo1GjV7.mjs} +6 -9
  12. package/dist/.setup/{components-yBEb75bB.mjs → components-Cq1PvIpN.mjs} +41 -69
  13. package/dist/.setup/{config-schema-CiZz-mtA.mjs → config-schema-oxELUSDx.mjs} +19 -44
  14. package/dist/.setup/{conversation-binding-route-B7qImK_b.mjs → conversation-binding-route-Caz_XuFH.mjs} +10 -5
  15. package/dist/.setup/{directory-config-BytTftz-.mjs → directory-config-esqNn0Eo.mjs} +6 -9
  16. package/dist/.setup/{directory-live--EGTH0DC.mjs → directory-live-DtKRHuGV.mjs} +6 -12
  17. package/dist/.setup/{discord-BXpHW-cu.mjs → discord-0xJYfdDD.mjs} +82 -386
  18. package/dist/.setup/{doctor-D1R-uFIu.mjs → doctor-BCl1H5tl.mjs} +21 -36
  19. package/dist/.setup/{doctor-contract-Co5vRCZ6.mjs → doctor-contract-CvvgwrrG.mjs} +41 -50
  20. package/dist/.setup/{channel-actions.runtime-leZuw01r.mjs → handle-action-CUvQWnE7.mjs} +67 -104
  21. package/dist/.setup/{handle-action.guild-admin-DcFa8NwA.mjs → handle-action.guild-admin-Df-8gVle.mjs} +62 -120
  22. package/dist/.setup/{live-policy-config-eKQ-PLdy.mjs → live-policy-config-8Pv20CHc.mjs} +2 -3
  23. package/dist/.setup/{message-handler-X6ejmbtY.mjs → message-handler-B-Jk4oDk.mjs} +18 -94
  24. package/dist/.setup/{message-handler.preflight-pluralkit-8Xji34AF.mjs → message-handler.preflight-pluralkit-CWLUBVcx.mjs} +8 -10
  25. package/dist/.setup/{message-handler.preflight-DE_POxFc.mjs → message-handler.preflight-v-__NSDq.mjs} +69 -180
  26. package/dist/.setup/{message-handler.process-CCmIVnxy.mjs → message-handler.process-BNFFuChn.mjs} +65 -86
  27. package/dist/.setup/{outbound-adapter-ClIgmu4F.mjs → outbound-adapter-BobT-kse.mjs} +105 -19
  28. package/dist/.setup/{outbound-session-route-VulUE0yV.mjs → outbound-session-route-zVGxxceg.mjs} +140 -108
  29. package/dist/.setup/{pluralkit-CdAt1G0P.mjs → pluralkit-a6_NLfH9.mjs} +1 -1
  30. package/dist/.setup/{presence-cache-dYSHPWMx.mjs → presence-cache-Di3H3DIU.mjs} +0 -4
  31. package/dist/.setup/{probe-CupW4we4.mjs → probe-LYrIHlBF.mjs} +13 -4
  32. package/dist/.setup/{provider-iOf73HW-.mjs → provider-B_G5hASF.mjs} +721 -1416
  33. package/dist/.setup/provider-session.runtime-BYlTBFD2.mjs +6 -0
  34. package/dist/.setup/provider.runtime-CUE3UxER.mjs +2 -0
  35. package/dist/.setup/{realtime-session.runtime-Dz8uVutq.mjs → realtime-session.runtime-oUd9DOcz.mjs} +41 -55
  36. package/dist/.setup/{receive-recovery-DHst8WRx.mjs → receive-recovery-CHPOsnLc.mjs} +1 -4
  37. package/dist/.setup/{resolve-allowlist-common-CwMBzbx9.mjs → resolve-allowlist-common-DPdRggu5.mjs} +4 -7
  38. package/dist/.setup/{resolve-channels-BbvsLQOZ.mjs → resolve-channels-BFPNRmVv.mjs} +21 -40
  39. package/dist/.setup/{resolve-users-ByFlR7LQ.mjs → resolve-users-0-aBuCy3.mjs} +4 -4
  40. package/dist/.setup/{retry-BEYkDy0P.mjs → retry-pz_cSha2.mjs} +3 -3
  41. package/dist/.setup/rolldown-runtime-B4FMCO8f.mjs +28 -0
  42. package/dist/.setup/{runtime-B8lJfyrA.mjs → runtime-FN000lxA.mjs} +60 -162
  43. package/dist/.setup/runtime-doctor-migrations-CshUGl36.mjs +159 -0
  44. package/dist/.setup/{runtime-DisDbixd.mjs → runtime-sUksZ--Q.mjs} +2 -5
  45. package/dist/.setup/{secret-config-contract-DFu9hfU8.mjs → secret-config-contract-uOE2J7yM.mjs} +15 -85
  46. package/dist/.setup/{security-audit-s5w50-Ly.mjs → security-audit-Cdaegq7C.mjs} +3 -1
  47. package/dist/.setup/{send-CIBzvXjS.mjs → send-CrfEI6Bs.mjs} +53 -108
  48. package/dist/.setup/{send.components-ChY21qr-.mjs → send.components-DxQAMfES.mjs} +62 -107
  49. package/dist/.setup/{send.outbound-QTyuFupn.mjs → send.outbound-BISKnb-a.mjs} +66 -140
  50. package/dist/.setup/{send.shared-VNvWfX2T.mjs → send.shared-DGFkbkQR.mjs} +10 -25
  51. package/dist/.setup/{sender-identity-0Ymgvmaj.mjs → sender-identity-B9X5Vb9R.mjs} +2 -3
  52. package/dist/.setup/setup-plugin-api-BQUBxbhe.mjs +3 -0
  53. package/dist/.setup/{shared-DHPDaMSx.mjs → shared-B3wZ4hN-.mjs} +25 -32
  54. package/dist/.setup/{subagent-hooks-CjW7r8Pe.mjs → subagent-hooks-nlUE9ow7.mjs} +5 -6
  55. package/dist/.setup/system-events-CdeZnvPV.mjs +33 -0
  56. package/dist/.setup/{target-resolver-BXpy6VT8.mjs → target-resolver-BuLapkhy.mjs} +9 -12
  57. package/dist/.setup/targets-0KUcEIYx.mjs +3 -0
  58. package/dist/.setup/{thread-bindings-CEh2dhqP.mjs → thread-bindings-D7TfgjR_.mjs} +33 -35
  59. package/dist/.setup/{thread-bindings.manager-ve-i6oqt.mjs → thread-bindings.manager-DN-NissX.mjs} +325 -233
  60. package/dist/.setup/thread-bindings.session-updates-CshfKghV.mjs +359 -0
  61. package/dist/.setup/{thread-bindings.state-BThFQEga.mjs → thread-bindings.state-g6v9zAym.mjs} +21 -62
  62. package/dist/.setup/{transcripts-source-DVegW0WI.mjs → transcripts-source-p8EV179h.mjs} +76 -235
  63. package/dist/.setup/{typing-BKZL5fGj.mjs → typing-BiHCzBRu.mjs} +2 -1
  64. package/dist/.setup/{voice-runtime-elTtjEIG.mjs → voice-runtime-B46rcwrG.mjs} +140 -244
  65. package/dist/account-inspect-api.js +1 -1
  66. package/dist/action-runtime-api.js +1 -1
  67. package/dist/activities-api.js +1 -1
  68. package/dist/api.js +18 -18
  69. package/dist/channel-config-api.js +1 -1
  70. package/dist/channel-plugin-api.js +1 -1
  71. package/dist/directory-contract-api.js +1 -1
  72. package/dist/doctor-contract-api.js +4 -4
  73. package/dist/index.js +1 -1
  74. package/dist/runtime-api.js +20 -20
  75. package/dist/secret-contract-api.js +1 -1
  76. package/dist/security-audit-contract-api.js +1 -1
  77. package/dist/setup-entry.js +1 -1
  78. package/dist/setup-plugin-api.js +1 -1
  79. package/dist/src/voice/audio-worker.runtime.js +15 -24
  80. package/dist/subagent-hooks-api.js +3 -4
  81. package/dist/transcripts-source-api.js +1 -1
  82. package/node_modules/@types/node/README.md +2 -2
  83. package/node_modules/@types/node/child_process.d.ts +1 -1
  84. package/node_modules/@types/node/crypto.d.ts +20 -8
  85. package/node_modules/@types/node/ffi.d.ts +14 -0
  86. package/node_modules/@types/node/http2.d.ts +3 -2
  87. package/node_modules/@types/node/net.d.ts +16 -4
  88. package/node_modules/@types/node/package.json +2 -17
  89. package/node_modules/@types/node/process.d.ts +1 -0
  90. package/node_modules/@types/node/quic.d.ts +39 -1
  91. package/node_modules/@types/node/stream/iter.d.ts +9 -12
  92. package/node_modules/@types/node/test/reporters.d.ts +1 -0
  93. package/node_modules/@types/node/test.d.ts +72 -0
  94. package/node_modules/@types/node/tls.d.ts +14 -10
  95. package/node_modules/@types/node/vm.d.ts +2 -1
  96. package/node_modules/@types/node/worker_threads.d.ts +4 -1
  97. package/node_modules/typebox/build/compile/code.mjs +1 -2
  98. package/node_modules/typebox/build/compile/validator.mjs +5 -1
  99. package/node_modules/typebox/build/format/iri.mjs +16 -9
  100. package/node_modules/typebox/build/guard/emit.mjs +2 -2
  101. package/node_modules/typebox/build/guard/guard.d.mts +7 -5
  102. package/node_modules/typebox/build/guard/guard.mjs +14 -9
  103. package/node_modules/typebox/build/guard/index.mjs +6 -0
  104. package/node_modules/typebox/build/guard/unicode/unicode.d.mts +6 -0
  105. package/node_modules/typebox/build/guard/unicode/unicode.mjs +35 -0
  106. package/node_modules/typebox/build/guard/{string.mjs → unicode/unicode_segment.mjs} +16 -19
  107. package/node_modules/typebox/build/schema/build.mjs +2 -3
  108. package/node_modules/typebox/build/schema/engine/_pathing.d.mts +1 -0
  109. package/node_modules/typebox/build/schema/engine/_pathing.mjs +11 -0
  110. package/node_modules/typebox/build/schema/engine/_refine.mjs +13 -5
  111. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +2 -1
  112. package/node_modules/typebox/build/schema/engine/dependencies.mjs +2 -1
  113. package/node_modules/typebox/build/schema/engine/dependentSchemas.mjs +2 -1
  114. package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +1 -1
  115. package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +2 -2
  116. package/node_modules/typebox/build/schema/engine/format.mjs +9 -2
  117. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +3 -2
  118. package/node_modules/typebox/build/schema/engine/properties.mjs +3 -2
  119. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -1
  120. package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +1 -1
  121. package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +2 -2
  122. package/node_modules/typebox/build/schema/engine/ref.d.mts +1 -1
  123. package/node_modules/typebox/build/schema/engine/ref.mjs +2 -2
  124. package/node_modules/typebox/build/schema/engine/schema.mjs +24 -24
  125. package/node_modules/typebox/build/schema/parse.mjs +3 -0
  126. package/node_modules/typebox/build/schema/pointer/pointer.d.mts +1 -6
  127. package/node_modules/typebox/build/schema/pointer/pointer.mjs +47 -64
  128. package/node_modules/typebox/build/system/settings/internal.d.mts +2 -0
  129. package/node_modules/typebox/build/system/settings/internal.mjs +20 -0
  130. package/node_modules/typebox/build/system/settings/settings.d.mts +11 -0
  131. package/node_modules/typebox/build/system/settings/settings.mjs +14 -0
  132. package/node_modules/typebox/build/type/extends/inference.d.mts +1 -1
  133. package/node_modules/typebox/build/type/extends/inference.mjs +15 -2
  134. package/node_modules/typebox/build/type/extends/tuple.d.mts +2 -1
  135. package/node_modules/typebox/build/type/extends/tuple.mjs +21 -1
  136. package/node_modules/typebox/build/value/parse/parse.mjs +10 -4
  137. package/node_modules/typebox/package.json +1 -1
  138. package/node_modules/typebox/readme.md +3 -1
  139. package/openclaw.plugin.json +21 -1
  140. package/package.json +5 -5
  141. package/dist/.setup/agent-components.runtime-CEPrf2SY.mjs +0 -4
  142. package/dist/.setup/probe.runtime-DBQ_AGPe.mjs +0 -2
  143. package/dist/.setup/provider-session.runtime-DrGAYnZv.mjs +0 -6
  144. package/dist/.setup/provider.runtime-BmjW_pIw.mjs +0 -2
  145. package/dist/.setup/security-audit.runtime-DHtYenx9.mjs +0 -2
  146. package/dist/.setup/setup-plugin-api-Dvr41dyx.mjs +0 -3
  147. package/dist/.setup/system-events-B2YEEMbS.mjs +0 -34
  148. package/dist/.setup/targets-CvemhN3i.mjs +0 -3
  149. package/dist/.setup/thread-bindings.session-updates-DCQq1WZ5.mjs +0 -55
  150. /package/node_modules/typebox/build/guard/{string.d.mts → unicode/unicode_segment.d.mts} +0 -0
@@ -0,0 +1,359 @@
1
+ import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.mjs";
2
+ import { O as setBindingRecord, a as THREAD_BINDINGS_MAX_ENTRIES, b as removeBindingRecord, g as openThreadBindingsStore, l as ensureBindingsLoaded, n as MANAGERS_BY_ACCOUNT_ID, o as THREAD_BINDINGS_NAMESPACE, p as normalizePersistedBinding, r as PERSIST_BY_ACCOUNT_ID, s as THREAD_BINDINGS_STATE, t as BINDINGS_BY_THREAD_ID, u as ensureBindingsLoadedAsync, x as resolveBindingIdsForSession } from "./thread-bindings.state-g6v9zAym.mjs";
3
+ import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
4
+ import { createPluginStateErrorReporter } from "openclaw/plugin-sdk/plugin-state-runtime";
5
+ import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
6
+ //#region extensions/discord/src/monitor/thread-bindings.persistence.ts
7
+ function shouldPersistAnyBindingState() {
8
+ for (const value of PERSIST_BY_ACCOUNT_ID.values()) if (value) return true;
9
+ return false;
10
+ }
11
+ function shouldPersistBindingMutations() {
12
+ if (shouldPersistAnyBindingState()) return true;
13
+ return THREAD_BINDINGS_STATE.loadedPersistentBindings;
14
+ }
15
+ function snapshotThreadBindingJson(value) {
16
+ const serialized = JSON.stringify(value);
17
+ return serialized ? JSON.parse(serialized) : void 0;
18
+ }
19
+ function toPersistedBindingRecord(record) {
20
+ return normalizePersistedBinding(record.threadId, snapshotThreadBindingJson(record)) ?? { ...record };
21
+ }
22
+ function runThreadBindingAccountOperation(managers, operation) {
23
+ if (managers.length === 0) return operation();
24
+ const tails = THREAD_BINDINGS_STATE.accountOperationTails;
25
+ const predecessors = managers.map((manager) => tails.get(manager) ?? Promise.resolve());
26
+ const result = Promise.all(predecessors).then(operation);
27
+ const settled = result.then(() => {}, () => {});
28
+ for (const manager of managers) tails.set(manager, settled);
29
+ settled.then(() => {
30
+ for (const manager of managers) if (tails.get(manager) === settled) tails.delete(manager);
31
+ });
32
+ return result;
33
+ }
34
+ function drainThreadBindingAccountOperations(manager) {
35
+ return THREAD_BINDINGS_STATE.accountOperationTails.get(manager) ?? Promise.resolve();
36
+ }
37
+ function runThreadBindingMutation(operation) {
38
+ const result = THREAD_BINDINGS_STATE.mutationTail.then(operation);
39
+ THREAD_BINDINGS_STATE.mutationTail = result.then(() => {}, () => {});
40
+ return result;
41
+ }
42
+ function drainThreadBindingMutations() {
43
+ return THREAD_BINDINGS_STATE.mutationTail;
44
+ }
45
+ async function commitBindingRecord(params) {
46
+ const revision = THREAD_BINDINGS_STATE.revision;
47
+ let authorityRefused = false;
48
+ let targetCommitted = false;
49
+ let committedWrites = 0;
50
+ const assertCurrent = () => {
51
+ try {
52
+ params.assertCurrent?.();
53
+ if (THREAD_BINDINGS_STATE.revision !== revision || BINDINGS_BY_THREAD_ID.get(params.bindingKey) !== params.previous) throw new Error("Discord thread binding changed during persistence");
54
+ } catch (error) {
55
+ authorityRefused = true;
56
+ throw error;
57
+ }
58
+ };
59
+ assertCurrent();
60
+ const now = Date.now();
61
+ if (params.persist && THREAD_BINDINGS_STATE.persistenceAvailable && !(params.minIntervalMs && THREAD_BINDINGS_STATE.lastPersistedAtMs > 0 && now - THREAD_BINDINGS_STATE.lastPersistedAtMs < params.minIntervalMs)) {
62
+ const records = new Map(BINDINGS_BY_THREAD_ID);
63
+ if (params.next) records.set(params.bindingKey, params.next);
64
+ else records.delete(params.bindingKey);
65
+ const active = {
66
+ targetKey: params.bindingKey,
67
+ deletingTarget: params.next === null,
68
+ nextRecord: params.next,
69
+ writingKey: void 0,
70
+ committedKeys: /* @__PURE__ */ new Set()
71
+ };
72
+ THREAD_BINDINGS_STATE.activePersistence = active;
73
+ try {
74
+ const store = getDiscordRuntime().state.openKeyedStore({
75
+ namespace: THREAD_BINDINGS_NAMESPACE,
76
+ maxEntries: THREAD_BINDINGS_MAX_ENTRIES
77
+ });
78
+ for (const [key, record] of records) {
79
+ assertCurrent();
80
+ const persisted = toPersistedBindingRecord(record);
81
+ if (key === params.bindingKey) active.nextRecord = persisted;
82
+ active.writingKey = key;
83
+ await store.register(key, persisted, { assertCurrent });
84
+ active.writingKey = void 0;
85
+ active.committedKeys.add(key);
86
+ committedWrites += 1;
87
+ targetCommitted ||= key === params.bindingKey;
88
+ }
89
+ assertCurrent();
90
+ const entries = await store.entries();
91
+ assertCurrent();
92
+ for (const entry of entries) if (!records.has(entry.key)) {
93
+ active.writingKey = entry.key;
94
+ await store.delete(entry.key, { assertCurrent });
95
+ active.writingKey = void 0;
96
+ active.committedKeys.add(entry.key);
97
+ committedWrites += 1;
98
+ targetCommitted ||= entry.key === params.bindingKey;
99
+ }
100
+ if (!params.next) targetCommitted = true;
101
+ assertCurrent();
102
+ THREAD_BINDINGS_STATE.loadedPersistentBindings = records.size > 0;
103
+ THREAD_BINDINGS_STATE.lastPersistedAtMs = now;
104
+ } catch (error) {
105
+ let failure = error;
106
+ if (!authorityRefused) try {
107
+ assertCurrent();
108
+ } catch (interruption) {
109
+ failure = interruption;
110
+ }
111
+ if (authorityRefused) {
112
+ createPluginStateErrorReporter(getDiscordRuntime, "discord", "thread-bindings", "Discord thread binding save interrupted; acknowledged writes were retained.", () => ({
113
+ committedWrites,
114
+ targetCommitted
115
+ }))(failure);
116
+ if (!targetCommitted) {
117
+ if (committedWrites === 0) throw failure;
118
+ throw new Error(`Discord thread binding changed during persistence after ${committedWrites} acknowledged writes`, { cause: error });
119
+ }
120
+ } else {
121
+ THREAD_BINDINGS_STATE.persistenceAvailable = false;
122
+ logVerbose("discord thread binding persistence unavailable; keeping bindings in memory");
123
+ }
124
+ } finally {
125
+ delete THREAD_BINDINGS_STATE.activePersistence;
126
+ }
127
+ }
128
+ if (!targetCommitted) assertCurrent();
129
+ if (BINDINGS_BY_THREAD_ID.get(params.bindingKey) !== params.previous) return;
130
+ if (params.next) setBindingRecord(params.next);
131
+ else removeBindingRecord(params.bindingKey);
132
+ }
133
+ function persistBindingsSync(update, removedKey) {
134
+ const store = openThreadBindingsStore();
135
+ const active = THREAD_BINDINGS_STATE.activePersistence;
136
+ let updatedRecord;
137
+ for (const [key, record] of BINDINGS_BY_THREAD_ID) if (key === update?.bindingKey || active?.targetKey === key && active.deletingTarget || active?.writingKey === key || active?.committedKeys.has(key)) {
138
+ if (!store.update) throw new Error("Discord synchronous compatibility requires atomic state update");
139
+ let next;
140
+ store.update(key, (current) => {
141
+ let base = record;
142
+ if (active?.targetKey === key) {
143
+ if (!current && active.deletingTarget) base = void 0;
144
+ else if (current && active.nextRecord && (active.writingKey === key || active.committedKeys.has(key)) && JSON.stringify(toPersistedBindingRecord(current)) === JSON.stringify(toPersistedBindingRecord(active.nextRecord))) base = normalizePersistedBinding(key, current) ?? record;
145
+ }
146
+ if (key === update?.bindingKey) update.observe?.(current && normalizePersistedBinding(key, current) ? base : void 0);
147
+ next = base ? key === update?.bindingKey ? update.transform(base) : base : void 0;
148
+ return next ? toPersistedBindingRecord(next) : void 0;
149
+ });
150
+ if (key === update?.bindingKey) updatedRecord = next;
151
+ if (next) {
152
+ if (next !== record) setBindingRecord(next);
153
+ } else if (!(active?.targetKey === key && active.deletingTarget)) removeBindingRecord(key);
154
+ } else store.register(key, toPersistedBindingRecord(record));
155
+ for (const entry of store.entries()) if (!BINDINGS_BY_THREAD_ID.has(entry.key)) {
156
+ if (entry.key !== removedKey && active?.targetKey === entry.key && !active.deletingTarget) {
157
+ const committed = normalizePersistedBinding(entry.key, entry.value);
158
+ if (committed) {
159
+ setBindingRecord(committed);
160
+ continue;
161
+ }
162
+ }
163
+ store.delete(entry.key);
164
+ }
165
+ THREAD_BINDINGS_STATE.loadedPersistentBindings = BINDINGS_BY_THREAD_ID.size > 0;
166
+ THREAD_BINDINGS_STATE.lastPersistedAtMs = Date.now();
167
+ return updatedRecord;
168
+ }
169
+ /** Public SDK compatibility only; bundled callers await worker mutations. */
170
+ function updateBindingRecordSync(params) {
171
+ const record = BINDINGS_BY_THREAD_ID.get(params.bindingKey);
172
+ if (!record) return null;
173
+ const now = Date.now();
174
+ const persist = params.persist && THREAD_BINDINGS_STATE.persistenceAvailable && (THREAD_BINDINGS_STATE.activePersistence || !params.minIntervalMs || now - THREAD_BINDINGS_STATE.lastPersistedAtMs >= params.minIntervalMs);
175
+ let observed;
176
+ if (persist) try {
177
+ return persistBindingsSync({
178
+ ...params,
179
+ observe: (current) => {
180
+ observed = current;
181
+ }
182
+ }) ?? null;
183
+ } catch {
184
+ THREAD_BINDINGS_STATE.persistenceAvailable = false;
185
+ logVerbose("discord thread binding persistence unavailable; keeping bindings in memory");
186
+ }
187
+ const current = BINDINGS_BY_THREAD_ID.get(params.bindingKey);
188
+ if (current !== record) return current ?? null;
189
+ if (THREAD_BINDINGS_STATE.activePersistence?.targetKey === params.bindingKey && !observed) {
190
+ logVerbose("discord synchronous binding update skipped: pending target read unavailable");
191
+ return null;
192
+ }
193
+ const next = params.transform(observed ?? record);
194
+ setBindingRecord(next);
195
+ return next;
196
+ }
197
+ /** Public SDK compatibility only; bundled callers await worker mutations. */
198
+ function removeBindingRecordSync(bindingKey) {
199
+ const record = BINDINGS_BY_THREAD_ID.get(bindingKey);
200
+ if (!record) return null;
201
+ if (!shouldPersistBindingMutations() || !THREAD_BINDINGS_STATE.persistenceAvailable) return THREAD_BINDINGS_STATE.activePersistence?.targetKey === bindingKey ? null : removeBindingRecord(bindingKey);
202
+ let removed = null;
203
+ let observed = null;
204
+ let replacement;
205
+ try {
206
+ const store = openThreadBindingsStore();
207
+ if (!store.deleteIf) throw new Error("Discord synchronous compatibility requires atomic state deletion");
208
+ const deleted = store.deleteIf(bindingKey, (current) => {
209
+ const normalized = normalizePersistedBinding(bindingKey, current);
210
+ observed = normalized;
211
+ const pending = THREAD_BINDINGS_STATE.activePersistence;
212
+ if (normalized && pending?.targetKey === bindingKey && pending.nextRecord && (pending.writingKey === bindingKey || pending.committedKeys.has(bindingKey)) && JSON.stringify(toPersistedBindingRecord(normalized)) === JSON.stringify(toPersistedBindingRecord(pending.nextRecord)) && (normalized.targetSessionKey !== record.targetSessionKey || normalized.targetKind !== record.targetKind)) {
213
+ replacement = normalized;
214
+ return false;
215
+ }
216
+ return true;
217
+ });
218
+ if (replacement) {
219
+ setBindingRecord(replacement);
220
+ return null;
221
+ }
222
+ const pending = THREAD_BINDINGS_STATE.activePersistence;
223
+ if (!deleted && pending?.targetKey === bindingKey && pending.deletingTarget) return null;
224
+ removed = removeBindingRecord(bindingKey);
225
+ persistBindingsSync(void 0, bindingKey);
226
+ return removed;
227
+ } catch {
228
+ THREAD_BINDINGS_STATE.persistenceAvailable = false;
229
+ if (replacement) {
230
+ setBindingRecord(replacement);
231
+ return null;
232
+ }
233
+ if (THREAD_BINDINGS_STATE.activePersistence?.targetKey === bindingKey && !observed && !removed) {
234
+ logVerbose("discord synchronous binding removal skipped: pending target read unavailable");
235
+ return null;
236
+ }
237
+ return removed ?? removeBindingRecord(bindingKey);
238
+ }
239
+ }
240
+ //#endregion
241
+ //#region extensions/discord/src/monitor/thread-bindings.session-shared.ts
242
+ function normalizeNonNegativeMs(raw) {
243
+ if (!Number.isFinite(raw)) return 0;
244
+ return Math.max(0, Math.floor(raw));
245
+ }
246
+ function resolveBindingIdsForTargetSession(params) {
247
+ ensureBindingsLoaded();
248
+ const targetSessionKey = params.targetSessionKey.trim();
249
+ if (!targetSessionKey) return [];
250
+ const accountId = params.accountId ? normalizeAccountId(params.accountId) : void 0;
251
+ return resolveBindingIdsForSession({
252
+ targetSessionKey,
253
+ accountId,
254
+ targetKind: params.targetKind
255
+ });
256
+ }
257
+ function mutateBindingsForTargetSession(params, update, onRemoved) {
258
+ const accountId = params.accountId ? normalizeAccountId(params.accountId) : void 0;
259
+ const admittedOwners = new Map([...MANAGERS_BY_ACCOUNT_ID].filter(([ownerAccountId]) => accountId === void 0 || ownerAccountId === accountId).map(([ownerAccountId, manager]) => [ownerAccountId, {
260
+ manager,
261
+ stopping: manager.isStopping()
262
+ }]));
263
+ return runThreadBindingAccountOperation([...admittedOwners.values()].map(({ manager }) => manager), () => runThreadBindingMutation(async () => {
264
+ await ensureBindingsLoadedAsync();
265
+ const ids = resolveBindingIdsForTargetSession(params);
266
+ const owners = /* @__PURE__ */ new Map();
267
+ for (const bindingKey of ids) {
268
+ const existing = BINDINGS_BY_THREAD_ID.get(bindingKey);
269
+ if (!existing) continue;
270
+ const manager = MANAGERS_BY_ACCOUNT_ID.get(existing.accountId);
271
+ const admitted = admittedOwners.get(existing.accountId);
272
+ if (admitted?.stopping || !admitted && manager?.isStopping()) throw new Error("Discord thread binding manager is stopping");
273
+ if (admitted?.manager !== manager) throw new Error("Discord thread binding manager changed");
274
+ owners.set(existing.accountId, manager);
275
+ }
276
+ const now = Date.now();
277
+ const updated = [];
278
+ for (const bindingKey of ids) {
279
+ const existing = BINDINGS_BY_THREAD_ID.get(bindingKey);
280
+ if (!existing) continue;
281
+ const manager = owners.get(existing.accountId);
282
+ const assertCurrent = () => {
283
+ if (MANAGERS_BY_ACCOUNT_ID.get(existing.accountId) !== manager) throw new Error("Discord thread binding manager changed");
284
+ };
285
+ const nextRecord = update(existing, now);
286
+ await commitBindingRecord({
287
+ bindingKey,
288
+ previous: existing,
289
+ next: nextRecord,
290
+ persist: shouldPersistBindingMutations(),
291
+ assertCurrent
292
+ });
293
+ if (!nextRecord) onRemoved?.(existing, manager);
294
+ updated.push(nextRecord ?? existing);
295
+ }
296
+ return updated;
297
+ }));
298
+ }
299
+ /** @deprecated Generic SDK synchronous lifecycle compatibility. */
300
+ function updateBindingsForTargetSessionSync(ids, update) {
301
+ const now = Date.now();
302
+ const updated = [];
303
+ for (const bindingKey of ids) {
304
+ const existing = BINDINGS_BY_THREAD_ID.get(bindingKey);
305
+ if (!existing) continue;
306
+ if (MANAGERS_BY_ACCOUNT_ID.get(existing.accountId)?.isStopping()) throw new Error("Discord thread binding manager is stopping");
307
+ const next = updateBindingRecordSync({
308
+ bindingKey,
309
+ transform: (record) => record.targetSessionKey === existing.targetSessionKey ? update(record, now) : record,
310
+ persist: shouldPersistBindingMutations()
311
+ });
312
+ if (next?.targetSessionKey === existing.targetSessionKey) updated.push(next);
313
+ }
314
+ return updated;
315
+ }
316
+ //#endregion
317
+ //#region extensions/discord/src/monitor/thread-bindings.session-updates.ts
318
+ async function setThreadBindingIdleTimeoutBySessionKeyAsync(input) {
319
+ const params = { ...input };
320
+ const idleTimeoutMs = normalizeNonNegativeMs(params.idleTimeoutMs);
321
+ return mutateBindingsForTargetSession(params, (existing, now) => ({
322
+ ...existing,
323
+ idleTimeoutMs,
324
+ lastActivityAt: now
325
+ }));
326
+ }
327
+ async function setThreadBindingMaxAgeBySessionKeyAsync(input) {
328
+ const params = { ...input };
329
+ const maxAgeMs = normalizeNonNegativeMs(params.maxAgeMs);
330
+ return mutateBindingsForTargetSession(params, (existing, now) => ({
331
+ ...existing,
332
+ maxAgeMs,
333
+ boundAt: now,
334
+ lastActivityAt: now
335
+ }));
336
+ }
337
+ /** @deprecated Use the awaited lifecycle setter; retained for the generic SDK contract. */
338
+ function setThreadBindingIdleTimeoutBySessionKey(params) {
339
+ const ids = resolveBindingIdsForTargetSession(params);
340
+ const idleTimeoutMs = normalizeNonNegativeMs(params.idleTimeoutMs);
341
+ return updateBindingsForTargetSessionSync(ids, (existing, now) => ({
342
+ ...existing,
343
+ idleTimeoutMs,
344
+ lastActivityAt: now
345
+ }));
346
+ }
347
+ /** @deprecated Use the awaited lifecycle setter; retained for the generic SDK contract. */
348
+ function setThreadBindingMaxAgeBySessionKey(params) {
349
+ const ids = resolveBindingIdsForTargetSession(params);
350
+ const maxAgeMs = normalizeNonNegativeMs(params.maxAgeMs);
351
+ return updateBindingsForTargetSessionSync(ids, (existing, now) => ({
352
+ ...existing,
353
+ maxAgeMs,
354
+ boundAt: now,
355
+ lastActivityAt: now
356
+ }));
357
+ }
358
+ //#endregion
359
+ export { mutateBindingsForTargetSession as a, drainThreadBindingAccountOperations as c, runThreadBindingAccountOperation as d, runThreadBindingMutation as f, updateBindingRecordSync as h, setThreadBindingMaxAgeBySessionKeyAsync as i, drainThreadBindingMutations as l, snapshotThreadBindingJson as m, setThreadBindingIdleTimeoutBySessionKeyAsync as n, resolveBindingIdsForTargetSession as o, shouldPersistAnyBindingState as p, setThreadBindingMaxAgeBySessionKey as r, commitBindingRecord as s, setThreadBindingIdleTimeoutBySessionKey as t, removeBindingRecordSync as u };
@@ -1,7 +1,9 @@
1
- import { Ut as __exportAll } from "./discord-BXpHW-cu.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
2
  import { t as getDiscordRuntime } from "./runtime-DgnVQ7zW.mjs";
3
+ import { resolveGlobalSingleton } from "openclaw/plugin-sdk/global-singleton";
3
4
  import { normalizeAccountId, resolveAgentIdFromSessionKey } from "openclaw/plugin-sdk/routing";
4
- import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
5
+ import { asFiniteNumber, normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
6
+ import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
5
7
  import { recordOutboundMessageIdentity } from "openclaw/plugin-sdk/outbound-echo-runtime";
6
8
  import { resolveThreadBindingExpiry } from "openclaw/plugin-sdk/thread-bindings-session-runtime";
7
9
  //#region extensions/discord/src/monitor/thread-bindings.state.ts
@@ -12,6 +14,7 @@ var thread_bindings_state_exports = /* @__PURE__ */ __exportAll({
12
14
  REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL: () => REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL,
13
15
  THREAD_BINDINGS_MAX_ENTRIES: () => THREAD_BINDINGS_MAX_ENTRIES,
14
16
  THREAD_BINDINGS_NAMESPACE: () => THREAD_BINDINGS_NAMESPACE,
17
+ THREAD_BINDINGS_STATE: () => THREAD_BINDINGS_STATE,
15
18
  THREAD_BINDING_TOUCH_PERSIST_MIN_INTERVAL_MS: () => THREAD_BINDING_TOUCH_PERSIST_MIN_INTERVAL_MS,
16
19
  ensureBindingsLoaded: () => ensureBindingsLoaded,
17
20
  ensureBindingsLoadedAsync: () => ensureBindingsLoadedAsync,
@@ -20,7 +23,7 @@ var thread_bindings_state_exports = /* @__PURE__ */ __exportAll({
20
23
  normalizePersistedBinding: () => normalizePersistedBinding,
21
24
  normalizeTargetKind: () => normalizeTargetKind,
22
25
  normalizeThreadBindingDurationMs: () => normalizeThreadBindingDurationMs,
23
- normalizeThreadId: () => normalizeThreadId,
26
+ openThreadBindingsStore: () => openThreadBindingsStore,
24
27
  refreshUnboundThreadWebhookIdentity: () => refreshUnboundThreadWebhookIdentity,
25
28
  rememberReusableWebhook: () => rememberReusableWebhook,
26
29
  rememberThreadBindingToken: () => rememberThreadBindingToken,
@@ -32,15 +35,12 @@ var thread_bindings_state_exports = /* @__PURE__ */ __exportAll({
32
35
  resolveThreadBindingInactivityExpiresAt: () => resolveThreadBindingInactivityExpiresAt,
33
36
  resolveThreadBindingMaxAgeExpiresAt: () => resolveThreadBindingMaxAgeExpiresAt,
34
37
  resolveThreadBindingMaxAgeMs: () => resolveThreadBindingMaxAgeMs,
35
- saveBindingsToDisk: () => saveBindingsToDisk,
36
38
  setBindingRecord: () => setBindingRecord,
37
39
  shouldDefaultPersist: () => shouldDefaultPersist,
38
- shouldPersistBindingMutations: () => shouldPersistBindingMutations,
39
40
  toBindingRecordKey: () => toBindingRecordKey,
40
41
  toReusableWebhookKey: () => toReusableWebhookKey
41
42
  });
42
43
  const THREAD_BINDINGS_STATE_KEY = Symbol.for("openclaw.discordThreadBindingsState");
43
- let threadBindingsState;
44
44
  function createThreadBindingsGlobalState() {
45
45
  return {
46
46
  managersByAccountId: /* @__PURE__ */ new Map(),
@@ -52,18 +52,14 @@ function createThreadBindingsGlobalState() {
52
52
  loadedBindings: false,
53
53
  loadedPersistentBindings: false,
54
54
  persistenceAvailable: true,
55
- lastPersistedAtMs: 0
55
+ lastPersistedAtMs: 0,
56
+ revision: 0,
57
+ mutationTail: Promise.resolve(),
58
+ accountOperationTails: /* @__PURE__ */ new WeakMap()
56
59
  };
57
60
  }
58
- function resolveThreadBindingsGlobalState() {
59
- if (!threadBindingsState) {
60
- const globalStore = globalThis;
61
- threadBindingsState = globalStore[THREAD_BINDINGS_STATE_KEY] ?? createThreadBindingsGlobalState();
62
- globalStore[THREAD_BINDINGS_STATE_KEY] = threadBindingsState;
63
- }
64
- return threadBindingsState;
65
- }
66
- const THREAD_BINDINGS_STATE = resolveThreadBindingsGlobalState();
61
+ const THREAD_BINDINGS_STATE = resolveGlobalSingleton(THREAD_BINDINGS_STATE_KEY, createThreadBindingsGlobalState);
62
+ THREAD_BINDINGS_STATE.accountOperationTails ??= /* @__PURE__ */ new WeakMap();
67
63
  const MANAGERS_BY_ACCOUNT_ID = THREAD_BINDINGS_STATE.managersByAccountId;
68
64
  const BINDINGS_BY_THREAD_ID = THREAD_BINDINGS_STATE.bindingsByThreadId;
69
65
  const BINDINGS_BY_SESSION_KEY = THREAD_BINDINGS_STATE.bindingsBySessionKey;
@@ -98,14 +94,11 @@ function normalizeTargetKind(raw, targetSessionKey) {
98
94
  if (raw === "subagent" || raw === "acp") return raw;
99
95
  return targetSessionKey.includes(":subagent:") ? "subagent" : "acp";
100
96
  }
101
- function normalizeThreadId(raw) {
102
- return normalizeOptionalStringifiedId(raw);
103
- }
104
97
  function toBindingRecordKey(params) {
105
98
  return `${normalizeAccountId(params.accountId)}:${params.threadId.trim()}`;
106
99
  }
107
100
  function resolveBindingRecordKey(params) {
108
- const threadId = normalizeThreadId(params.threadId);
101
+ const threadId = normalizeOptionalStringifiedId(params.threadId);
109
102
  if (!threadId) return;
110
103
  return toBindingRecordKey({
111
104
  accountId: normalizeAccountId(params.accountId),
@@ -115,7 +108,7 @@ function resolveBindingRecordKey(params) {
115
108
  function normalizePersistedBinding(threadIdKey, raw) {
116
109
  if (!raw || typeof raw !== "object") return null;
117
110
  const value = raw;
118
- const threadId = normalizeThreadId(value.threadId ?? threadIdKey);
111
+ const threadId = normalizeOptionalStringifiedId(value.threadId ?? threadIdKey);
119
112
  const channelId = normalizeOptionalString(value.channelId) ?? "";
120
113
  const targetSessionKey = normalizeOptionalString(value.targetSessionKey) ?? "";
121
114
  if (!threadId || !channelId || !targetSessionKey) return null;
@@ -157,14 +150,10 @@ function normalizeThreadBindingDurationMs(raw, defaultsTo) {
157
150
  return durationMs;
158
151
  }
159
152
  function resolveThreadBindingIdleTimeoutMs(params) {
160
- const explicit = params.record.idleTimeoutMs;
161
- if (typeof explicit === "number" && Number.isFinite(explicit)) return Math.max(0, Math.floor(explicit));
162
- return Math.max(0, Math.floor(params.defaultIdleTimeoutMs));
153
+ return Math.max(0, Math.floor(asFiniteNumber(params.record.idleTimeoutMs) ?? params.defaultIdleTimeoutMs));
163
154
  }
164
155
  function resolveThreadBindingMaxAgeMs(params) {
165
- const explicit = params.record.maxAgeMs;
166
- if (typeof explicit === "number" && Number.isFinite(explicit)) return Math.max(0, Math.floor(explicit));
167
- return Math.max(0, Math.floor(params.defaultMaxAgeMs));
156
+ return Math.max(0, Math.floor(asFiniteNumber(params.record.maxAgeMs) ?? params.defaultMaxAgeMs));
168
157
  }
169
158
  function resolveTimestampExpiry(timestamp, durationMs) {
170
159
  if (durationMs <= 0) return;
@@ -252,6 +241,7 @@ function setBindingRecord(record) {
252
241
  const existing = BINDINGS_BY_THREAD_ID.get(bindingKey);
253
242
  if (existing) unlinkSessionBinding(existing.targetSessionKey, bindingKey);
254
243
  BINDINGS_BY_THREAD_ID.set(bindingKey, record);
244
+ THREAD_BINDINGS_STATE.revision += 1;
255
245
  linkSessionBinding(record.targetSessionKey, bindingKey);
256
246
  rememberReusableWebhook(record);
257
247
  }
@@ -261,46 +251,14 @@ function removeBindingRecord(bindingKeyRaw) {
261
251
  const existing = BINDINGS_BY_THREAD_ID.get(key);
262
252
  if (!existing) return null;
263
253
  BINDINGS_BY_THREAD_ID.delete(key);
254
+ THREAD_BINDINGS_STATE.revision += 1;
264
255
  unlinkSessionBinding(existing.targetSessionKey, key);
265
256
  return existing;
266
257
  }
267
- function shouldPersistAnyBindingState() {
268
- for (const value of PERSIST_BY_ACCOUNT_ID.values()) if (value) return true;
269
- return false;
270
- }
271
- function shouldPersistBindingMutations() {
272
- if (!THREAD_BINDINGS_STATE.persistenceAvailable) return false;
273
- if (shouldPersistAnyBindingState()) return true;
274
- return THREAD_BINDINGS_STATE.loadedPersistentBindings;
275
- }
276
- function toPersistedBindingRecord(record) {
277
- const serialized = JSON.stringify(record);
278
- if (!serialized) return { ...record };
279
- return normalizePersistedBinding(record.threadId, JSON.parse(serialized)) ?? { ...record };
280
- }
281
- function saveBindingsToDisk(params = {}) {
282
- if (!params.force && !shouldPersistAnyBindingState()) return;
283
- if (!THREAD_BINDINGS_STATE.persistenceAvailable) return;
284
- const minIntervalMs = typeof params.minIntervalMs === "number" && Number.isFinite(params.minIntervalMs) ? Math.max(0, Math.floor(params.minIntervalMs)) : 0;
285
- const now = Date.now();
286
- if (!params.force && minIntervalMs > 0 && THREAD_BINDINGS_STATE.lastPersistedAtMs > 0 && now - THREAD_BINDINGS_STATE.lastPersistedAtMs < minIntervalMs) return;
287
- try {
288
- const store = openThreadBindingsStore();
289
- const persistedKeys = /* @__PURE__ */ new Set();
290
- for (const [bindingKey, record] of BINDINGS_BY_THREAD_ID.entries()) {
291
- store.register(bindingKey, toPersistedBindingRecord(record));
292
- persistedKeys.add(bindingKey);
293
- }
294
- for (const entry of store.entries()) if (!persistedKeys.has(entry.key)) store.delete(entry.key);
295
- THREAD_BINDINGS_STATE.loadedPersistentBindings = persistedKeys.size > 0;
296
- THREAD_BINDINGS_STATE.lastPersistedAtMs = now;
297
- } catch {
298
- THREAD_BINDINGS_STATE.persistenceAvailable = false;
299
- }
300
- }
301
258
  function beginBindingsLoad() {
302
259
  THREAD_BINDINGS_STATE.loadedBindings = true;
303
260
  BINDINGS_BY_THREAD_ID.clear();
261
+ THREAD_BINDINGS_STATE.revision += 1;
304
262
  BINDINGS_BY_SESSION_KEY.clear();
305
263
  REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL.clear();
306
264
  THREAD_BINDINGS_STATE.loadedPersistentBindings = false;
@@ -337,6 +295,7 @@ async function loadBindingsAsync() {
337
295
  if (!THREAD_BINDINGS_STATE.loadedBindings) {
338
296
  beginBindingsLoad();
339
297
  THREAD_BINDINGS_STATE.persistenceAvailable = false;
298
+ logVerbose("discord thread binding persistence unavailable; keeping bindings in memory");
340
299
  }
341
300
  return;
342
301
  }
@@ -369,4 +328,4 @@ function resolveBindingIdsForSession(params) {
369
328
  return out;
370
329
  }
371
330
  //#endregion
372
- export { resolveThreadBindingMaxAgeMs as C, shouldPersistBindingMutations as D, shouldDefaultPersist as E, thread_bindings_state_exports as O, resolveThreadBindingMaxAgeExpiresAt as S, setBindingRecord as T, resolveBindingIdsForSession as _, THREAD_BINDING_TOUCH_PERSIST_MIN_INTERVAL_MS as a, resolveThreadBindingIdleTimeoutMs as b, forgetThreadBindingToken as c, normalizeThreadBindingDurationMs as d, normalizeThreadId as f, removeBindingRecord as g, rememberThreadBindingToken as h, REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL as i, toReusableWebhookKey as k, getThreadBindingToken as l, rememberReusableWebhook as m, MANAGERS_BY_ACCOUNT_ID as n, ensureBindingsLoaded as o, refreshUnboundThreadWebhookIdentity as p, PERSIST_BY_ACCOUNT_ID as r, ensureBindingsLoadedAsync as s, BINDINGS_BY_THREAD_ID as t, normalizeTargetKind as u, resolveBindingRecordKey as v, saveBindingsToDisk as w, resolveThreadBindingInactivityExpiresAt as x, resolvePreparedThreadBindingLifecycle as y };
331
+ export { thread_bindings_state_exports as A, resolvePreparedThreadBindingLifecycle as C, resolveThreadBindingMaxAgeMs as D, resolveThreadBindingMaxAgeExpiresAt as E, toReusableWebhookKey as M, setBindingRecord as O, resolveBindingRecordKey as S, resolveThreadBindingInactivityExpiresAt as T, refreshUnboundThreadWebhookIdentity as _, THREAD_BINDINGS_MAX_ENTRIES as a, removeBindingRecord as b, THREAD_BINDING_TOUCH_PERSIST_MIN_INTERVAL_MS as c, forgetThreadBindingToken as d, getThreadBindingToken as f, openThreadBindingsStore as g, normalizeThreadBindingDurationMs as h, REUSABLE_WEBHOOKS_BY_ACCOUNT_CHANNEL as i, toBindingRecordKey as j, shouldDefaultPersist as k, ensureBindingsLoaded as l, normalizeTargetKind as m, MANAGERS_BY_ACCOUNT_ID as n, THREAD_BINDINGS_NAMESPACE as o, normalizePersistedBinding as p, PERSIST_BY_ACCOUNT_ID as r, THREAD_BINDINGS_STATE as s, BINDINGS_BY_THREAD_ID as t, ensureBindingsLoadedAsync as u, rememberReusableWebhook as v, resolveThreadBindingIdleTimeoutMs as w, resolveBindingIdsForSession as x, rememberThreadBindingToken as y };