@agent-relay/sdk 2.3.4 → 2.3.5

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/dist/index.d.ts CHANGED
@@ -3,20 +3,7 @@
3
3
  *
4
4
  * Lightweight SDK for agent-to-agent communication via Agent Relay.
5
5
  *
6
- * ## Quick Start (Standalone - No Setup Required)
7
- *
8
- * ```typescript
9
- * import { createRelay } from '@agent-relay/sdk';
10
- *
11
- * const relay = await createRelay();
12
- * const alice = await relay.client('Alice');
13
- * const bob = await relay.client('Bob');
14
- *
15
- * bob.onMessage = (from, { body }) => console.log(`${from}: ${body}`);
16
- * alice.sendMessage('Bob', 'Hello!');
17
- * ```
18
- *
19
- * ## With External Daemon
6
+ * ## Quick Start
20
7
  *
21
8
  * ```typescript
22
9
  * import { RelayClient } from '@agent-relay/sdk';
@@ -24,23 +11,8 @@
24
11
  * const client = new RelayClient({ agentName: 'MyAgent' });
25
12
  * await client.connect();
26
13
  * ```
27
- *
28
- * ## Browser Usage (WebSocket)
29
- *
30
- * ```typescript
31
- * import { BrowserRelayClient } from '@agent-relay/sdk';
32
- *
33
- * const client = new BrowserRelayClient({
34
- * agentName: 'BrowserAgent',
35
- * transport: { wsUrl: 'wss://relay.example.com/ws' },
36
- * });
37
- * await client.connect();
38
- * ```
39
14
  */
40
15
  export { RelayClient, type ClientState, type ClientConfig, type SyncOptions, type RequestOptions, type RequestResponse, type SpawnResult, } from './client.js';
41
- export { BrowserRelayClient, type BrowserClientState, type BrowserClientConfig, type BrowserRequestOptions, type BrowserRequestResponse, } from './browser-client.js';
42
- export { type Transport, type TransportConfig, type TransportEvents, type TransportState, type TransportFactory, SocketTransport, createSocketTransport, type SocketTransportConfig, WebSocketTransport, createWebSocketTransport, socketPathToWsUrl, type WebSocketTransportConfig, createAutoTransport, type AutoTransportOptions, detectEnvironment, type EnvironmentInfo, isBrowser, isNode, } from './transports/index.js';
43
- export { createRelay, createPair, type Relay, type RelayConfig, } from './standalone.js';
44
16
  export { PROTOCOL_VERSION, type MessageType, type PayloadKind, type Envelope, type EntityType, type SendPayload, type SendMeta, type SyncMeta, type DeliveryInfo, type AckPayload, type ErrorCode, type ErrorPayload, type SpeakOnTrigger, type ShadowConfig, type SpawnPayload, type SpawnResultPayload, type ReleasePayload, type ReleaseResultPayload, type AgentReadyPayload, type ChannelMessagePayload, type ChannelJoinPayload, type ChannelLeavePayload, type MessageAttachment, type StatusResponsePayload, type InboxMessage, type MessagesResponsePayload, type AgentInfo, type HealthResponsePayload, type CrashRecord, type AlertRecord, type MetricsResponsePayload, type AgentMetrics, type ConsensusType, type VoteValue, type ProposalStatus, type CreateProposalOptions, type VoteOptions, } from './protocol/index.js';
45
17
  export { encodeFrame, encodeFrameLegacy, FrameParser, MAX_FRAME_BYTES, } from './protocol/index.js';
46
18
  export { getLogs, listLoggedAgents, type GetLogsOptions, type LogsResult, } from './logs.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAGH,OAAO,EACL,WAAW,EACX,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,WAAW,GACjB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,kBAAkB,EAClB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,GAC5B,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EAErB,eAAe,EACf,qBAAqB,EACrB,KAAK,qBAAqB,EAE1B,kBAAkB,EAClB,wBAAwB,EACxB,iBAAiB,EACjB,KAAK,wBAAwB,EAE7B,mBAAmB,E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AAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,OAAO,EACP,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,UAAU,GAChB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,0BAA0B,EAC1B,eAAe,EACf,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,UAAU,GACX,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -3,20 +3,7 @@
3
3
  *
4
4
  * Lightweight SDK for agent-to-agent communication via Agent Relay.
5
5
  *
6
- * ## Quick Start (Standalone - No Setup Required)
7
- *
8
- * ```typescript
9
- * import { createRelay } from '@agent-relay/sdk';
10
- *
11
- * const relay = await createRelay();
12
- * const alice = await relay.client('Alice');
13
- * const bob = await relay.client('Bob');
14
- *
15
- * bob.onMessage = (from, { body }) => console.log(`${from}: ${body}`);
16
- * alice.sendMessage('Bob', 'Hello!');
17
- * ```
18
- *
19
- * ## With External Daemon
6
+ * ## Quick Start
20
7
  *
21
8
  * ```typescript
22
9
  * import { RelayClient } from '@agent-relay/sdk';
@@ -24,33 +11,9 @@
24
11
  * const client = new RelayClient({ agentName: 'MyAgent' });
25
12
  * await client.connect();
26
13
  * ```
27
- *
28
- * ## Browser Usage (WebSocket)
29
- *
30
- * ```typescript
31
- * import { BrowserRelayClient } from '@agent-relay/sdk';
32
- *
33
- * const client = new BrowserRelayClient({
34
- * agentName: 'BrowserAgent',
35
- * transport: { wsUrl: 'wss://relay.example.com/ws' },
36
- * });
37
- * await client.connect();
38
- * ```
39
14
  */
40
15
  // Main client (Node.js, Unix sockets)
41
16
  export { RelayClient, } from './client.js';
42
- // Browser-compatible client (WebSocket)
43
- export { BrowserRelayClient, } from './browser-client.js';
44
- // Transport abstractions
45
- export {
46
- // Socket transport (Node.js)
47
- SocketTransport, createSocketTransport,
48
- // WebSocket transport (Browser + Node.js)
49
- WebSocketTransport, createWebSocketTransport, socketPathToWsUrl,
50
- // Auto-detection
51
- createAutoTransport, detectEnvironment, isBrowser, isNode, } from './transports/index.js';
52
- // Standalone relay (in-process daemon for simple use cases)
53
- export { createRelay, createPair, } from './standalone.js';
54
17
  // Protocol types (re-export for convenience)
55
18
  export { PROTOCOL_VERSION, } from './protocol/index.js';
56
19
  // Framing utilities
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,sCAAsC;AACtC,OAAO,EACL,WAAW,GAOZ,MAAM,aAAa,CAAC;AAErB,wCAAwC;AACxC,OAAO,EACL,kBAAkB,GAKnB,MAAM,qBAAqB,CAAC;AAE7B,yBAAyB;AACzB,OAAO;AAOL,6BAA6B;AAC7B,eAAe,EACf,qBAAqB;AAErB,0CAA0C;AAC1C,kBAAkB,EAClB,wBAAwB,EACxB,iBAAiB;AAEjB,iBAAiB;AACjB,mBAAmB,EAEnB,iBAAiB,EAEjB,SAAS,EACT,MAAM,GACP,MAAM,uBAAuB,CAAC;AAE/B,4DAA4D;AAC5D,OAAO,EACL,WAAW,EACX,UAAU,GAGX,MAAM,iBAAiB,CAAC;AAEzB,6CAA6C;AAC7C,OAAO,EACL,gBAAgB,GA0CjB,MAAM,qBAAqB,CAAC;AAE7B,oBAAoB;AACpB,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAE7B,yDAAyD;AACzD,OAAO,EACL,OAAO,EACP,gBAAgB,GAGjB,MAAM,WAAW,CAAC;AAEnB,0EAA0E;AAC1E,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,0BAA0B,EAC1B,eAAe,EACf,kBAAkB,GAKnB,MAAM,gBAAgB,CAAC;AAExB,cAAc;AACd,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,UAAU,GACX,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,sCAAsC;AACtC,OAAO,EACL,WAAW,GAOZ,MAAM,aAAa,CAAC;AAErB,6CAA6C;AAC7C,OAAO,EACL,gBAAgB,GA0CjB,MAAM,qBAAqB,CAAC;AAE7B,oBAAoB;AACpB,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAE7B,yDAAyD;AACzD,OAAO,EACL,OAAO,EACP,gBAAgB,GAGjB,MAAM,WAAW,CAAC;AAEnB,0EAA0E;AAC1E,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,0BAA0B,EAC1B,eAAe,EACf,kBAAkB,GAKnB,MAAM,gBAAgB,CAAC;AAExB,cAAc;AACd,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,UAAU,GACX,MAAM,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/sdk",
3
- "version": "2.3.4",
3
+ "version": "2.3.5",
4
4
  "description": "Lightweight SDK for agent-to-agent communication via Agent Relay",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -10,11 +10,6 @@
10
10
  "types": "./dist/index.d.ts",
11
11
  "import": "./dist/index.js"
12
12
  },
13
- "./standalone": {
14
- "types": "./dist/standalone.d.ts",
15
- "import": "./dist/standalone.js",
16
- "default": "./dist/standalone.js"
17
- },
18
13
  "./protocol": {
19
14
  "types": "./dist/protocol/index.d.ts",
20
15
  "import": "./dist/protocol/index.js",
@@ -25,16 +20,6 @@
25
20
  "import": "./dist/client.js",
26
21
  "default": "./dist/client.js"
27
22
  },
28
- "./browser": {
29
- "types": "./dist/browser-client.d.ts",
30
- "import": "./dist/browser-client.js",
31
- "default": "./dist/browser-client.js"
32
- },
33
- "./transports": {
34
- "types": "./dist/transports/index.d.ts",
35
- "import": "./dist/transports/index.js",
36
- "default": "./dist/transports/index.js"
37
- },
38
23
  "./discovery": {
39
24
  "types": "./dist/discovery.d.ts",
40
25
  "import": "./dist/discovery.js",
@@ -62,9 +47,7 @@
62
47
  "agent",
63
48
  "ai",
64
49
  "communication",
65
- "sdk",
66
- "websocket",
67
- "browser"
50
+ "sdk"
68
51
  ],
69
52
  "author": "Khaliq Gant",
70
53
  "license": "Apache-2.0",
@@ -77,8 +60,8 @@
77
60
  "access": "public"
78
61
  },
79
62
  "dependencies": {
80
- "@agent-relay/protocol": "2.3.4",
81
- "@agent-relay/utils": "2.3.4"
63
+ "@agent-relay/protocol": "2.3.5",
64
+ "@agent-relay/utils": "2.3.5"
82
65
  },
83
66
  "engines": {
84
67
  "node": ">=18.0.0"
@@ -91,10 +74,6 @@
91
74
  "optional": true
92
75
  }
93
76
  },
94
- "optionalDependencies": {
95
- "@msgpack/msgpack": "^3.0.0",
96
- "ws": "^8.0.0"
97
- },
98
77
  "devDependencies": {
99
78
  "@types/node": "^22.19.3",
100
79
  "typescript": "^5.9.3",
@@ -1,212 +0,0 @@
1
- /**
2
- * BrowserRelayClient - Browser-compatible Agent Relay SDK Client
3
- * @agent-relay/sdk
4
- *
5
- * A client designed for browser environments using WebSocket transport.
6
- * Can also be used in Node.js with the WebSocket transport.
7
- *
8
- * Key differences from RelayClient:
9
- * - Uses transport abstraction instead of direct socket access
10
- * - No Node.js-specific dependencies (node:net, node:crypto)
11
- * - Uses browser-compatible APIs (crypto.randomUUID, etc.)
12
- */
13
- import type { Transport } from './transports/types.js';
14
- import { type AutoTransportOptions } from './transports/index.js';
15
- import { type Envelope, type SendPayload, type SendMeta, type AckPayload, type PayloadKind, type SpeakOnTrigger, type EntityType, type ChannelMessagePayload, type MessageAttachment } from '@agent-relay/protocol';
16
- export type BrowserClientState = 'DISCONNECTED' | 'CONNECTING' | 'HANDSHAKING' | 'READY' | 'BACKOFF';
17
- export interface BrowserClientConfig {
18
- /** Agent name */
19
- agentName: string;
20
- /** Entity type: 'agent' (default) or 'user' */
21
- entityType?: EntityType;
22
- /** CLI identifier (claude, codex, gemini, etc.) */
23
- cli?: string;
24
- /** Display name for human users */
25
- displayName?: string;
26
- /** Avatar URL for human users */
27
- avatarUrl?: string;
28
- /** Suppress console logging */
29
- quiet?: boolean;
30
- /** Auto-reconnect on disconnect */
31
- reconnect?: boolean;
32
- /** Max reconnect attempts */
33
- maxReconnectAttempts?: number;
34
- /** Initial reconnect delay (ms) */
35
- reconnectDelayMs?: number;
36
- /** Max reconnect delay (ms) */
37
- reconnectMaxDelayMs?: number;
38
- /** Transport options (WebSocket URL, socket path, etc.) */
39
- transport?: AutoTransportOptions;
40
- /**
41
- * Pre-configured transport instance (alternative to transport options).
42
- * NOTE: Auto-reconnection is NOT supported when using transportInstance.
43
- * If reconnection is needed, use `transport` options instead, or handle
44
- * reconnection manually by listening for state changes.
45
- */
46
- transportInstance?: Transport;
47
- }
48
- /**
49
- * Browser-compatible request options.
50
- */
51
- export interface BrowserRequestOptions {
52
- /** Timeout in milliseconds (default: 30000) */
53
- timeout?: number;
54
- /** Optional structured data to include with the request */
55
- data?: Record<string, unknown>;
56
- /** Optional thread identifier */
57
- thread?: string;
58
- /** Message kind (default: 'message') */
59
- kind?: PayloadKind;
60
- }
61
- /**
62
- * Response from the request() method.
63
- */
64
- export interface BrowserRequestResponse {
65
- /** Sender of the response */
66
- from: string;
67
- /** Response body text */
68
- body: string;
69
- /** Optional structured data from the response */
70
- data?: Record<string, unknown>;
71
- /** The correlation ID used for this request/response */
72
- correlationId: string;
73
- /** Thread identifier if set */
74
- thread?: string;
75
- /** The full payload for advanced use cases */
76
- payload: SendPayload;
77
- }
78
- /**
79
- * BrowserRelayClient - A browser-compatible relay client.
80
- *
81
- * Uses WebSocket transport by default, making it compatible with browsers.
82
- * Can also be used in Node.js for WebSocket-based connections.
83
- *
84
- * @example Browser usage
85
- * ```typescript
86
- * import { BrowserRelayClient } from '@agent-relay/sdk/browser';
87
- *
88
- * const client = new BrowserRelayClient({
89
- * agentName: 'MyAgent',
90
- * transport: {
91
- * wsUrl: 'wss://relay.example.com/ws',
92
- * },
93
- * });
94
- *
95
- * await client.connect();
96
- *
97
- * client.onMessage = (from, payload) => {
98
- * console.log(`Message from ${from}: ${payload.body}`);
99
- * };
100
- *
101
- * client.sendMessage('OtherAgent', 'Hello!');
102
- * ```
103
- */
104
- export declare class BrowserRelayClient {
105
- private config;
106
- private transport?;
107
- private parser;
108
- private _state;
109
- private sessionId?;
110
- private resumeToken?;
111
- private reconnectAttempts;
112
- private reconnectDelay;
113
- private reconnectTimer?;
114
- private _destroyed;
115
- private dedupeCache;
116
- private writeQueue;
117
- private writeScheduled;
118
- private pendingSyncAcks;
119
- private pendingRequests;
120
- onMessage?: (from: string, payload: SendPayload, messageId: string, meta?: SendMeta, originalTo?: string) => void;
121
- onChannelMessage?: (from: string, channel: string, body: string, envelope: Envelope<ChannelMessagePayload>) => void;
122
- onStateChange?: (state: BrowserClientState) => void;
123
- onError?: (error: Error) => void;
124
- constructor(config: BrowserClientConfig);
125
- get state(): BrowserClientState;
126
- get agentName(): string;
127
- get currentSessionId(): string | undefined;
128
- /**
129
- * Connect to the relay daemon.
130
- */
131
- connect(): Promise<void>;
132
- /**
133
- * Disconnect from the relay daemon.
134
- */
135
- disconnect(): void;
136
- /**
137
- * Permanently destroy the client.
138
- */
139
- destroy(): void;
140
- /**
141
- * Send a message to another agent.
142
- */
143
- sendMessage(to: string, body: string, kind?: PayloadKind, data?: Record<string, unknown>, thread?: string, meta?: SendMeta): boolean;
144
- /**
145
- * Send an ACK for a delivered message.
146
- */
147
- sendAck(payload: AckPayload): boolean;
148
- /**
149
- * Send a request to another agent and wait for their response.
150
- */
151
- request(to: string, body: string, options?: BrowserRequestOptions): Promise<BrowserRequestResponse>;
152
- /**
153
- * Respond to a request from another agent.
154
- */
155
- respond(correlationId: string, to: string, body: string, data?: Record<string, unknown>): boolean;
156
- /**
157
- * Broadcast a message to all agents.
158
- */
159
- broadcast(body: string, kind?: PayloadKind, data?: Record<string, unknown>): boolean;
160
- /**
161
- * Bind as a shadow to a primary agent.
162
- */
163
- bindAsShadow(primaryAgent: string, options?: {
164
- speakOn?: SpeakOnTrigger[];
165
- receiveIncoming?: boolean;
166
- receiveOutgoing?: boolean;
167
- }): boolean;
168
- /**
169
- * Unbind from a primary agent.
170
- */
171
- unbindAsShadow(primaryAgent: string): boolean;
172
- /**
173
- * Send log output to the daemon.
174
- */
175
- sendLog(data: string): boolean;
176
- /**
177
- * Join a channel.
178
- */
179
- joinChannel(channel: string, displayName?: string): boolean;
180
- /**
181
- * Leave a channel.
182
- */
183
- leaveChannel(channel: string, reason?: string): boolean;
184
- /**
185
- * Send a message to a channel.
186
- */
187
- sendChannelMessage(channel: string, body: string, options?: {
188
- thread?: string;
189
- mentions?: string[];
190
- attachments?: MessageAttachment[];
191
- data?: Record<string, unknown>;
192
- }): boolean;
193
- private setState;
194
- private sendHello;
195
- private send;
196
- private flushWrites;
197
- private handleData;
198
- private processFrame;
199
- private handleWelcome;
200
- private handleDeliver;
201
- private extractCorrelationId;
202
- private handleChannelMessage;
203
- private handleAck;
204
- private handlePing;
205
- private handleErrorFrame;
206
- private handleDisconnect;
207
- private handleError;
208
- private rejectPendingSyncAcks;
209
- private rejectPendingRequests;
210
- private scheduleReconnect;
211
- }
212
- //# sourceMappingURL=browser-client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"browser-client.d.ts","sourceRoot":"","sources":["../src/browser-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,QAAQ,EAGb,KAAK,WAAW,EAChB,KAAK,QAAQ,EAGb,KAAK,UAAU,EAEf,KAAK,WAAW,EAEhB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,qBAAqB,EAI1B,KAAK,iBAAiB,EAEvB,MAAM,uBAAuB,CAAC;AAG/B,MAAM,MAAM,kBAAkB,GAAG,cAAc,GAAG,YAAY,GAAG,aAAa,GAAG,OAAO,GAAG,SAAS,CAAC;AAErG,MAAM,WAAW,mBAAmB;IAClC,iBAAiB;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,mDAAmD;IACnD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,mCAAmC;IACnC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6BAA6B;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,mCAAmC;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,+BAA+B;IAC/B,mBAAmB,CAAC,E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