@agent-relay/sdk 10.4.0 → 10.5.0
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/bin/agent-relay-broker-darwin-arm64 +0 -0
- package/bin/agent-relay-broker-darwin-x64 +0 -0
- package/bin/agent-relay-broker-linux-arm64 +0 -0
- package/bin/agent-relay-broker-linux-x64 +0 -0
- package/bin/agent-relay-broker-win32-x64.exe +0 -0
- package/dist/agent-relay.d.ts +23 -0
- package/dist/agent-relay.d.ts.map +1 -1
- package/dist/agent-relay.js +57 -5
- package/dist/agent-relay.js.map +1 -1
- package/dist/delivery/types.d.ts +5 -1
- package/dist/delivery/types.d.ts.map +1 -1
- package/dist/listeners.d.ts.map +1 -1
- package/dist/listeners.js +16 -4
- package/dist/listeners.js.map +1 -1
- package/dist/messaging/event-fanin.d.ts +54 -0
- package/dist/messaging/event-fanin.d.ts.map +1 -0
- package/dist/messaging/event-fanin.js +293 -0
- package/dist/messaging/event-fanin.js.map +1 -0
- package/dist/messaging/index.d.ts +2 -0
- package/dist/messaging/index.d.ts.map +1 -1
- package/dist/messaging/index.js +2 -0
- package/dist/messaging/index.js.map +1 -1
- package/dist/messaging/normalize.d.ts.map +1 -1
- package/dist/messaging/normalize.js +479 -509
- package/dist/messaging/normalize.js.map +1 -1
- package/dist/messaging/observer-source.d.ts +80 -0
- package/dist/messaging/observer-source.d.ts.map +1 -0
- package/dist/messaging/observer-source.js +502 -0
- package/dist/messaging/observer-source.js.map +1 -0
- package/dist/messaging/relaycast-client.d.ts +2 -1
- package/dist/messaging/relaycast-client.d.ts.map +1 -1
- package/dist/messaging/relaycast-client.js.map +1 -1
- package/dist/messaging/types.d.ts +133 -107
- package/dist/messaging/types.d.ts.map +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
const DEFAULT_DEDUPE_WINDOW_MS = 30_000;
|
|
2
|
+
const DEFAULT_DEDUPE_CAPACITY = 2048;
|
|
3
|
+
const DEFAULT_NO_SOURCE_WARNING_MS = 10_000;
|
|
4
|
+
/**
|
|
5
|
+
* Derive a cross-source identity for an event, or `null` for events that must
|
|
6
|
+
* never be deduplicated (per-connection transport state, unknown frames).
|
|
7
|
+
*/
|
|
8
|
+
function dedupeKey(event) {
|
|
9
|
+
switch (event.type) {
|
|
10
|
+
case 'messageCreated':
|
|
11
|
+
case 'messageUpdated':
|
|
12
|
+
case 'threadReply':
|
|
13
|
+
return event.message?.messageId ? `${event.type}:${event.message.messageId}` : null;
|
|
14
|
+
case 'dmReceived':
|
|
15
|
+
case 'groupDmReceived':
|
|
16
|
+
return event.message?.messageId
|
|
17
|
+
? `${event.type}:${event.conversationId}:${event.message.messageId}`
|
|
18
|
+
: null;
|
|
19
|
+
case 'messageRead':
|
|
20
|
+
return `${event.type}:${event.messageId}:${event.agentName}`;
|
|
21
|
+
case 'reactionAdded':
|
|
22
|
+
case 'reactionRemoved':
|
|
23
|
+
return `${event.type}:${event.messageId}:${event.emoji}:${event.agentName}`;
|
|
24
|
+
case 'agentOnline':
|
|
25
|
+
case 'agentOffline':
|
|
26
|
+
return `${event.type}:${event.agent?.name}`;
|
|
27
|
+
case 'agentSpawnRequested':
|
|
28
|
+
case 'agentReleaseRequested':
|
|
29
|
+
return `${event.type}:${event.agent?.name}`;
|
|
30
|
+
case 'channelCreated':
|
|
31
|
+
case 'channelUpdated':
|
|
32
|
+
case 'channelArchived':
|
|
33
|
+
return `${event.type}:${event.channel?.name}`;
|
|
34
|
+
case 'memberJoined':
|
|
35
|
+
case 'memberLeft':
|
|
36
|
+
case 'channelMuted':
|
|
37
|
+
case 'channelUnmuted':
|
|
38
|
+
return `${event.type}:${event.channel}:${event.agentName}`;
|
|
39
|
+
case 'actionInvoked':
|
|
40
|
+
return `${event.type}:${event.invocationId}`;
|
|
41
|
+
default:
|
|
42
|
+
// connected / disconnected / error / reconnecting /
|
|
43
|
+
// permanentlyDisconnected / unknown: per-source transport state.
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Create an events fan-in.
|
|
49
|
+
*
|
|
50
|
+
* @param fallback - The workspace-scoped client's events surface, used only
|
|
51
|
+
* while no agent sources exist (it may still work against servers that
|
|
52
|
+
* accept the workspace stream). It is detached as soon as the first agent
|
|
53
|
+
* source connects.
|
|
54
|
+
*/
|
|
55
|
+
export function createEventFanIn(fallback, options = {}) {
|
|
56
|
+
const dedupeWindowMs = options.dedupeWindowMs ?? DEFAULT_DEDUPE_WINDOW_MS;
|
|
57
|
+
const dedupeCapacity = options.dedupeCapacity ?? DEFAULT_DEDUPE_CAPACITY;
|
|
58
|
+
const noSourceWarningMs = options.noSourceWarningMs ?? DEFAULT_NO_SOURCE_WARNING_MS;
|
|
59
|
+
const now = options.now ?? (() => Date.now());
|
|
60
|
+
const handlers = new Map();
|
|
61
|
+
const sources = [];
|
|
62
|
+
const seenSources = new Set();
|
|
63
|
+
/** Active `on('any', ...)` forwarding per source, so disconnect can detach. */
|
|
64
|
+
const sourceForwarding = new Map();
|
|
65
|
+
const desiredChannels = new Set();
|
|
66
|
+
/** Dedupe keys → current occurrence, insertion-ordered for eviction. */
|
|
67
|
+
const seenEvents = new Map();
|
|
68
|
+
let connectRequested = false;
|
|
69
|
+
let fallbackForwarding;
|
|
70
|
+
let fallbackConnected = false;
|
|
71
|
+
let noSourceTimer;
|
|
72
|
+
const report = (error) => {
|
|
73
|
+
if (options.onError) {
|
|
74
|
+
try {
|
|
75
|
+
options.onError(error);
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
// Error hooks must not throw into the event source.
|
|
79
|
+
}
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
console.warn('[agent-relay] event stream:', error);
|
|
83
|
+
};
|
|
84
|
+
const emitLocal = (event) => {
|
|
85
|
+
for (const key of [event.type, 'any']) {
|
|
86
|
+
for (const handler of handlers.get(key) ?? []) {
|
|
87
|
+
try {
|
|
88
|
+
void Promise.resolve(handler(event)).catch(report);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
report(error);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Forward an event from one source, collapsing cross-source duplicates.
|
|
98
|
+
*
|
|
99
|
+
* The engine emits one delivery per locally-registered recipient, so N
|
|
100
|
+
* sources produce N copies of one occurrence — only the first is emitted.
|
|
101
|
+
* A copy from a source that already delivered the previous occurrence is a
|
|
102
|
+
* genuine repeat (message edit, re-reaction, presence flap) and starts a
|
|
103
|
+
* new occurrence, so same-source repeats are never dropped.
|
|
104
|
+
*/
|
|
105
|
+
const forward = (source, event) => {
|
|
106
|
+
const key = dedupeKey(event);
|
|
107
|
+
if (key) {
|
|
108
|
+
const at = now();
|
|
109
|
+
const record = seenEvents.get(key);
|
|
110
|
+
if (record && at - record.at < dedupeWindowMs && !record.sources.has(source)) {
|
|
111
|
+
record.sources.add(source);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
seenEvents.delete(key);
|
|
115
|
+
seenEvents.set(key, { at, sources: new Set([source]) });
|
|
116
|
+
while (seenEvents.size > dedupeCapacity) {
|
|
117
|
+
const oldest = seenEvents.keys().next().value;
|
|
118
|
+
if (oldest === undefined)
|
|
119
|
+
break;
|
|
120
|
+
seenEvents.delete(oldest);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
emitLocal(event);
|
|
124
|
+
};
|
|
125
|
+
const clearNoSourceTimer = () => {
|
|
126
|
+
if (noSourceTimer !== undefined) {
|
|
127
|
+
clearTimeout(noSourceTimer);
|
|
128
|
+
noSourceTimer = undefined;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
const scheduleNoSourceWarning = () => {
|
|
132
|
+
if (noSourceTimer !== undefined || noSourceWarningMs <= 0)
|
|
133
|
+
return;
|
|
134
|
+
noSourceTimer = setTimeout(() => {
|
|
135
|
+
noSourceTimer = undefined;
|
|
136
|
+
if (!connectRequested || sources.length > 0)
|
|
137
|
+
return;
|
|
138
|
+
report(new Error('Listening for relay events, but no registered agent is connected. ' +
|
|
139
|
+
"Relaycast delivers events over each agent's node transport, and the " +
|
|
140
|
+
'workspace-key stream cannot receive them. Register an agent first ' +
|
|
141
|
+
'(`relay.workspace.register(...)` / `workspace.reconnect(...)`) so the ' +
|
|
142
|
+
'listener has a live connection to stream through.'));
|
|
143
|
+
}, noSourceWarningMs);
|
|
144
|
+
noSourceTimer.unref?.();
|
|
145
|
+
};
|
|
146
|
+
const attachSourceForwarding = (source) => {
|
|
147
|
+
if (sourceForwarding.has(source))
|
|
148
|
+
return;
|
|
149
|
+
sourceForwarding.set(source, source.on('any', (event) => forward(source, event)));
|
|
150
|
+
};
|
|
151
|
+
const detachAllForwarding = () => {
|
|
152
|
+
for (const off of sourceForwarding.values())
|
|
153
|
+
off();
|
|
154
|
+
sourceForwarding.clear();
|
|
155
|
+
};
|
|
156
|
+
const connectSource = (source) => {
|
|
157
|
+
if (typeof source.connect === 'function') {
|
|
158
|
+
try {
|
|
159
|
+
source.connect();
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
report(error);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (desiredChannels.size > 0 && typeof source.subscribe === 'function') {
|
|
166
|
+
try {
|
|
167
|
+
source.subscribe([...desiredChannels]);
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
report(error);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
const attachFallback = () => {
|
|
175
|
+
// Injected fakes may carry a partial surface; only a stream that can be
|
|
176
|
+
// observed is worth attaching.
|
|
177
|
+
if (!fallback || fallbackForwarding || typeof fallback.on !== 'function')
|
|
178
|
+
return;
|
|
179
|
+
fallbackForwarding = fallback.on('any', (event) => forward(fallback, event));
|
|
180
|
+
if (typeof fallback.connect === 'function') {
|
|
181
|
+
try {
|
|
182
|
+
fallback.connect();
|
|
183
|
+
fallbackConnected = true;
|
|
184
|
+
}
|
|
185
|
+
catch (error) {
|
|
186
|
+
// A workspace-key client may have no stream at all; agent sources can
|
|
187
|
+
// still arrive later, so surface the failure without giving up.
|
|
188
|
+
report(error);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
const detachFallback = () => {
|
|
193
|
+
if (!fallbackForwarding)
|
|
194
|
+
return;
|
|
195
|
+
fallbackForwarding();
|
|
196
|
+
fallbackForwarding = undefined;
|
|
197
|
+
if (fallbackConnected) {
|
|
198
|
+
fallbackConnected = false;
|
|
199
|
+
if (typeof fallback?.disconnect === 'function') {
|
|
200
|
+
try {
|
|
201
|
+
void fallback.disconnect().catch(() => { });
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
// Fallback surfaces whose disconnect misbehaves are left as-is.
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
return {
|
|
210
|
+
addSource: (source) => {
|
|
211
|
+
// A source without a subscribable stream (partial fakes injected via
|
|
212
|
+
// `createAgentMessaging`) contributes nothing; skip it entirely.
|
|
213
|
+
if (!source || typeof source.on !== 'function')
|
|
214
|
+
return;
|
|
215
|
+
if (seenSources.has(source))
|
|
216
|
+
return;
|
|
217
|
+
seenSources.add(source);
|
|
218
|
+
sources.push(source);
|
|
219
|
+
attachSourceForwarding(source);
|
|
220
|
+
if (connectRequested) {
|
|
221
|
+
connectSource(source);
|
|
222
|
+
clearNoSourceTimer();
|
|
223
|
+
// The agent transport is the real event stream; stop the workspace
|
|
224
|
+
// fallback so it does not sit in a doomed reconnect loop.
|
|
225
|
+
detachFallback();
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
hasAgentSources: () => sources.length > 0,
|
|
229
|
+
connect: () => {
|
|
230
|
+
connectRequested = true;
|
|
231
|
+
if (sources.length > 0) {
|
|
232
|
+
for (const source of sources) {
|
|
233
|
+
// Re-attach forwarding dropped by a prior disconnect().
|
|
234
|
+
attachSourceForwarding(source);
|
|
235
|
+
connectSource(source);
|
|
236
|
+
}
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
attachFallback();
|
|
240
|
+
scheduleNoSourceWarning();
|
|
241
|
+
},
|
|
242
|
+
disconnect: async () => {
|
|
243
|
+
connectRequested = false;
|
|
244
|
+
clearNoSourceTimer();
|
|
245
|
+
detachFallback();
|
|
246
|
+
// Stop forwarding first so a source another owner reconnects later
|
|
247
|
+
// cannot feed listeners that were explicitly disconnected.
|
|
248
|
+
detachAllForwarding();
|
|
249
|
+
await Promise.allSettled(sources.map((source) => Promise.resolve().then(() => {
|
|
250
|
+
if (typeof source.disconnect === 'function')
|
|
251
|
+
return source.disconnect();
|
|
252
|
+
return undefined;
|
|
253
|
+
})));
|
|
254
|
+
},
|
|
255
|
+
subscribe: (channels) => {
|
|
256
|
+
for (const channel of channels)
|
|
257
|
+
desiredChannels.add(channel);
|
|
258
|
+
for (const source of sources) {
|
|
259
|
+
if (typeof source.subscribe !== 'function')
|
|
260
|
+
continue;
|
|
261
|
+
try {
|
|
262
|
+
source.subscribe(channels);
|
|
263
|
+
}
|
|
264
|
+
catch (error) {
|
|
265
|
+
report(error);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
unsubscribe: (channels) => {
|
|
270
|
+
for (const channel of channels)
|
|
271
|
+
desiredChannels.delete(channel);
|
|
272
|
+
for (const source of sources) {
|
|
273
|
+
if (typeof source.unsubscribe !== 'function')
|
|
274
|
+
continue;
|
|
275
|
+
try {
|
|
276
|
+
source.unsubscribe(channels);
|
|
277
|
+
}
|
|
278
|
+
catch (error) {
|
|
279
|
+
report(error);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
on: (event, handler) => {
|
|
284
|
+
const set = handlers.get(event) ?? new Set();
|
|
285
|
+
set.add(handler);
|
|
286
|
+
handlers.set(event, set);
|
|
287
|
+
return () => {
|
|
288
|
+
set.delete(handler);
|
|
289
|
+
};
|
|
290
|
+
},
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
//# sourceMappingURL=event-fanin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-fanin.js","sourceRoot":"","sources":["../../src/messaging/event-fanin.ts"],"names":[],"mappings":"AA+CA,MAAM,wBAAwB,GAAG,MAAM,CAAC;AACxC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AACrC,MAAM,4BAA4B,GAAG,MAAM,CAAC;AAE5C;;;GAGG;AACH,SAAS,SAAS,CAAC,KAA0B;IAC3C,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,gBAAgB,CAAC;QACtB,KAAK,gBAAgB,CAAC;QACtB,KAAK,aAAa;YAChB,OAAO,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QACtF,KAAK,YAAY,CAAC;QAClB,KAAK,iBAAiB;YACpB,OAAO,KAAK,CAAC,OAAO,EAAE,SAAS;gBAC7B,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,cAAc,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE;gBACpE,CAAC,CAAC,IAAI,CAAC;QACX,KAAK,aAAa;YAChB,OAAO,GAAG,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;QAC/D,KAAK,eAAe,CAAC;QACrB,KAAK,iBAAiB;YACpB,OAAO,GAAG,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;QAC9E,KAAK,aAAa,CAAC;QACnB,KAAK,cAAc;YACjB,OAAO,G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E,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;YACzB,OAAO,GAAG,EAAE;gBACV,GAAG,CAAC,MAAM,CAAC,OAA+D,CAAC,CAAC;YAC9E,CAAC,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './types.js';
|
|
2
2
|
export * from './normalize.js';
|
|
3
|
+
export { createEventFanIn, type EventFanInOptions, type RelayEventFanIn } from './event-fanin.js';
|
|
4
|
+
export { createObserverEventSource, type ObserverEventSourceOptions, type ObserverLiveStream, } from './observer-source.js';
|
|
3
5
|
export { RelayPlacementError, RelaycastMessagingClient, type RelaycastMessagingOptions, } from './relaycast.js';
|
|
4
6
|
export * from './thin-client.js';
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messaging/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,KAAK,yBAAyB,GAC/B,MAAM,gBAAgB,CAAC;AACxB,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messaging/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAClG,OAAO,EACL,yBAAyB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,kBAAkB,GACxB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,KAAK,yBAAyB,GAC/B,MAAM,gBAAgB,CAAC;AACxB,cAAc,kBAAkB,CAAC"}
|
package/dist/messaging/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './types.js';
|
|
2
2
|
export * from './normalize.js';
|
|
3
|
+
export { createEventFanIn } from './event-fanin.js';
|
|
4
|
+
export { createObserverEventSource, } from './observer-source.js';
|
|
3
5
|
export { RelayPlacementError, RelaycastMessagingClient, } from './relaycast.js';
|
|
4
6
|
export * from './thin-client.js';
|
|
5
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/messaging/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EACL,mBAAmB,EACnB,wBAAwB,GAEzB,MAAM,gBAAgB,CAAC;AACxB,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/messaging/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAgD,MAAM,kBAAkB,CAAC;AAClG,OAAO,EACL,yBAAyB,GAG1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,mBAAmB,EACnB,wBAAwB,GAEzB,MAAM,gBAAgB,CAAC;AACxB,cAAc,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/messaging/normalize.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/messaging/normalize.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,EAC5B,UAAU,EAIV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