@cogitator-ai/channels 0.7.5 → 0.8.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/README.md CHANGED
@@ -72,7 +72,30 @@ telegramChannel({
72
72
  });
73
73
  ```
74
74
 
75
- Supports: text, photos (→ vision), voice and audio (→ STT), video, documents, replies, streaming via drafts/editText, emoji reactions, sending files from buffers or URLs, 4096 char limit. Docs: [Telegram](https://cogitator.app/docs/channels/telegram).
75
+ Built on the current Bot API, through grammY's raw API so newer methods work on any grammY:
76
+
77
+ - **Rich Markdown** (default on, `richMessages: false` to turn off): the agent's Markdown goes out as written, with headings, tables, code blocks, task lists, footnotes and formulas, up to 32,768 characters. A refused rich message falls back to classic Markdown, then plain text.
78
+ - **Streaming** through rich drafts with a **stop button**: a press stops the run and keeps what was written as the reply. Groups stream by editing.
79
+ - **Buttons** with colors, URLs, copy-text and disabled buttons (`SendOptions.buttons`); presses reach the `action:received` hook or `onAction`. Tool approval prompts get Approve and Deny buttons.
80
+ - **Topics** (forum topics and private chat topics), `@username` chat ids, captions, GIFs and voice notes, **albums** (`sendFiles`), silent, protected, ephemeral and effect messages, link preview options.
81
+ - **Command menus** by scope and language (`setCommands`, `setCommandMenu`), bot name and descriptions (`setProfile`), and `call(method, args)` for any other Bot API method.
82
+ - Incoming text, photos (→ vision), voice and audio (→ STT), video, video notes, GIFs, documents, replies and topics.
83
+
84
+ ```typescript
85
+ const telegram = telegramChannel({ token: process.env.TG_TOKEN! });
86
+
87
+ await telegram.sendText(chatId, 'Publish the noon edition?', {
88
+ buttons: [
89
+ [
90
+ { text: 'Publish', data: 'publish', style: 'success' },
91
+ { text: 'Hold', data: 'hold', style: 'danger' },
92
+ ],
93
+ ],
94
+ });
95
+ await telegram.setCommands([{ command: 'status', description: 'What is going on' }], { chatId });
96
+ ```
97
+
98
+ Docs: [Telegram](https://cogitator.app/docs/channels/telegram).
76
99
 
77
100
  ### Discord
78
101
 
@@ -228,6 +251,8 @@ Tools marked `requiresApproval` (for example `create_tool` from `capabilities.se
228
251
  2. The user replies `approve` / `yes` to run the calls, or `deny` / `no` to refuse, optionally followed by a reason (`no, too risky`) that the agent sees. Replies are case-insensitive and may end with punctuation; `да` / `одобряю` and `нет` / `отклоняю` work out of the box.
229
252
  3. The Gateway calls `cogitator.resume(agent, threadId, { userId, defaultDecision })` and delivers the result like any reply, streaming included. If the run pauses again, a new prompt is sent.
230
253
 
254
+ On channels with buttons (Telegram), the prompt also carries **Approve** and **Deny** buttons. A press answers exactly like the reply words, through the same middleware and checks, and the buttons then show the decision. `approvals.buttons: false` turns them off and `approvals.buttonLabels` renames them. A press counts only from the user the prompt asked, while their run is still paused; any other press gets an alert (`notAllowedMessage`, or `expiredMessage` once the request was answered, dropped or predates a restart, when a reply word still works).
255
+
231
256
  Any other message on a paused thread runs as usual, and the runtime answers the waiting calls as declined. An approve-only word with more text after it (`yes, but rename it`) counts as a new message, so nothing runs by accident.
232
257
 
233
258
  Only the user who started the run can answer it: the runtime checks the run's `userId` on resume. In a shared thread (a `threadKey` per group chat), someone else replying `approve` gets `notAllowedMessage` and the pause stays put.
@@ -402,20 +427,21 @@ const gateway = new Gateway({ /* ... */ hooks });
402
427
 
403
428
  Handlers are typed by hook name through `HookPayloads` (exported here and from `@cogitator-ai/types`, which also exports each event type):
404
429
 
405
- | Hook | Payload | Fields |
406
- | -------------------- | ------------------------ | ------------------------------------------------------------------- |
407
- | `message:received` | `MessageReceivedEvent` | `msg`, `threadId`, `user` |
408
- | `message:sending` | `MessageSendingEvent` | `msg`, `threadId`, `text`, `channelId` |
409
- | `message:sent` | `MessageSentEvent` | `msg`, `threadId`, `text`, `messageId` (first chunk) |
410
- | `agent:before_run` | `AgentBeforeRunEvent` | `msg`, `threadId`, `agent` (agent name) |
411
- | `agent:after_run` | `AgentAfterRunEvent` | `msg`, `threadId`, `output` |
412
- | `agent:error` | `AgentErrorEvent` | `msg`, `threadId`, `error` (always an `Error`) |
413
- | `session:created` | `SessionCreatedEvent` | `session`, `threadId` |
414
- | `session:compacted` | `SessionCompactedEvent` | `threadId`, `result` (`CompactionResult`) |
415
- | `stream:started` | `StreamStartedEvent` | `msg`, `threadId` |
416
- | `stream:finished` | `StreamFinishedEvent` | `msg`, `threadId`, `messageIds` |
417
- | `approval:requested` | `ApprovalRequestedEvent` | `msg`, `threadId`, `userId`, `approvals` |
418
- | `approval:resolved` | `ApprovalResolvedEvent` | `msg`, `threadId`, `userId`, `decision`, `approvals?`, `superseded` |
430
+ | Hook | Payload | Fields |
431
+ | -------------------- | ------------------------ | ------------------------------------------------------------------------------- |
432
+ | `message:received` | `MessageReceivedEvent` | `msg`, `threadId`, `user` |
433
+ | `message:sending` | `MessageSendingEvent` | `msg`, `threadId`, `text`, `channelId` |
434
+ | `message:sent` | `MessageSentEvent` | `msg`, `threadId`, `text`, `messageId` (first chunk) |
435
+ | `agent:before_run` | `AgentBeforeRunEvent` | `msg`, `threadId`, `agent` (agent name) |
436
+ | `agent:after_run` | `AgentAfterRunEvent` | `msg`, `threadId`, `output` |
437
+ | `agent:error` | `AgentErrorEvent` | `msg`, `threadId`, `error` (always an `Error`) |
438
+ | `session:created` | `SessionCreatedEvent` | `session`, `threadId` |
439
+ | `session:compacted` | `SessionCompactedEvent` | `threadId`, `result` (`CompactionResult`) |
440
+ | `stream:started` | `StreamStartedEvent` | `msg`, `threadId` |
441
+ | `stream:finished` | `StreamFinishedEvent` | `msg`, `threadId`, `messageIds` |
442
+ | `approval:requested` | `ApprovalRequestedEvent` | `msg`, `threadId`, `userId`, `approvals` |
443
+ | `approval:resolved` | `ApprovalResolvedEvent` | `msg`, `threadId`, `userId`, `decision`, `approvals?`, `superseded` |
444
+ | `action:received` | `ActionReceivedEvent` | `action`, `answer(options?)`: a button press the Gateway does not handle itself |
419
445
 
420
446
  A handler typed `HookHandler` (`unknown` payload) is still accepted for any hook. Errors in one handler don't affect others (they are logged). Unsubscribe with `hooks.off(name, handler)`. Docs: [Lifecycle Hooks](https://cogitator.app/docs/channels/gateway#lifecycle-hooks).
421
447
 
@@ -16,7 +16,25 @@ export interface GatewayApprovalsConfig {
16
16
  denyWords?: readonly string[];
17
17
  /** Sent when someone other than the user who started the run answers it */
18
18
  notAllowedMessage?: string;
19
+ /**
20
+ * Put Approve and Deny buttons under the prompt on channels that have buttons (default
21
+ * true). A press answers like the reply words do, and the buttons then show the decision.
22
+ */
23
+ buttons?: boolean;
24
+ /** Labels of the buttons and of the decision they show once pressed */
25
+ buttonLabels?: {
26
+ approve?: string;
27
+ deny?: string;
28
+ approved?: string;
29
+ denied?: string;
30
+ };
31
+ /** Shown on a press of buttons whose request was answered, dropped or is from before a restart */
32
+ expiredMessage?: string;
19
33
  }
34
+ export declare const DEFAULT_EXPIRED_MESSAGE = "This request is no longer waiting. Reply \"approve\" or \"deny\" if it is still paused.";
35
+ /** The `data` of the approval buttons the gateway puts under its prompt. */
36
+ export declare const APPROVE_ACTION = "cogitator:approve";
37
+ export declare const DENY_ACTION = "cogitator:deny";
20
38
  export declare const DEFAULT_APPROVE_WORDS: readonly string[];
21
39
  export declare const DEFAULT_DENY_WORDS: readonly string[];
22
40
  export declare const DEFAULT_NOT_ALLOWED_MESSAGE = "Only the person who made this request can approve or deny it.";
@@ -1 +1 @@
1
- {"version":3,"file":"approvals.d.ts","sourceRoot":"","sources":["../src/approvals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,CAAC;AAE9D,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,mBAAmB,EAAE,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,CAAC;IAC9B,2EAA2E;IAC3E,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uEAAuE;IACvE,YAAY,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACvF,kGAAkG;IAClG,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,uBAAuB,4FACmD,CAAC;AAExF,4EAA4E;AAC5E,eAAO,MAAM,cAAc,sBAAsB,CAAC;AAClD,eAAO,MAAM,WAAW,mBAAmB,CAAC;AAE5C,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAAwC,CAAC;AAC5F,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAAsC,CAAC;AACvF,eAAO,MAAM,2BAA2B,kEACyB,CAAC;AAuBlE;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,kBAAkB,GACxB,oBAAoB,GAAG,IAAI,CAU7B;AAoBD,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,SAAS,mBAAmB,EAAE,EACzC,KAAK,EAAE,kBAAkB,GACxB,MAAM,CAqBR"}
package/dist/approvals.js CHANGED
@@ -1,3 +1,7 @@
1
+ export const DEFAULT_EXPIRED_MESSAGE = 'This request is no longer waiting. Reply "approve" or "deny" if it is still paused.';
2
+ /** The `data` of the approval buttons the gateway puts under its prompt. */
3
+ export const APPROVE_ACTION = 'cogitator:approve';
4
+ export const DENY_ACTION = 'cogitator:deny';
1
5
  export const DEFAULT_APPROVE_WORDS = ['approve', 'yes', 'да', 'одобряю'];
2
6
  export const DEFAULT_DENY_WORDS = ['deny', 'no', 'нет', 'отклоняю'];
3
7
  export const DEFAULT_NOT_ALLOWED_MESSAGE = 'Only the person who made this request can approve or deny it.';
@@ -1 +1 @@
1
- {"version":3,"file":"approvals.js","sourceRoot":"","sources":["../src/approvals.ts"],"names":[],"mappings":"AA4BA,MAAM,CAAC,MAAM,qBAAqB,GAAsB,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;AAC5F,MAAM,CAAC,MAAM,kBAAkB,GAAsB,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;AACvF,MAAM,CAAC,MAAM,2BAA2B,GACtC,+DAA+D,CAAC;AAElE,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,kBAAkB,GAAG,cAAc,CAAC;AAC1C,MAAM,aAAa,GAAG,aAAa,CAAC;AAEpC,SAAS,cAAc,CAAC,KAAwB;IAC9C,OAAO,KAAK;SACT,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,iBAAiB,EAAE,CAAC;SAC9C,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;SACjC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;AACzC,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAY,EAAE,KAAwB;IAC9D,KAAK,MAAM,IAAI,IAAI,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;QACzC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,iBAAiB,EAAE,KAAK,IAAI;YAAE,SAAS;QACtE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;YAA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SAAS,CAAC,6CAA6C,CACjF,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { Channel, ChannelMessage, ChannelType, Attachment, SendOptions } from '@cogitator-ai/types';
1
+ import type { Attachment, Channel, ChannelAction, ChannelButton, ChannelCommand, ChannelMessage, ChannelStop, ChannelType, DraftOptions, SendOptions } from '@cogitator-ai/types';
2
2
  export interface TelegramConfig {
3
3
  token: string;
4
4
  allowedUpdates?: string[];
@@ -13,16 +13,82 @@ export interface TelegramConfig {
13
13
  path?: string;
14
14
  secretToken?: string;
15
15
  };
16
+ /**
17
+ * Send Markdown as Telegram rich messages (Bot API 10.1+), which render standard Markdown
18
+ * with headings, tables, code blocks, task lists, footnotes and formulas, up to 32768
19
+ * characters. Default true. When a rich message is refused, the text goes out in Telegram's
20
+ * classic Markdown instead.
21
+ */
22
+ richMessages?: boolean;
23
+ }
24
+ /** Who a command menu is for, as Telegram scopes it. */
25
+ export type TelegramCommandScope = {
26
+ type: 'default';
27
+ } | {
28
+ type: 'all_private_chats';
29
+ } | {
30
+ type: 'all_group_chats';
31
+ } | {
32
+ type: 'all_chat_administrators';
33
+ } | {
34
+ type: 'chat';
35
+ chatId: string;
36
+ } | {
37
+ type: 'chat_administrators';
38
+ chatId: string;
39
+ } | {
40
+ type: 'chat_member';
41
+ chatId: string;
42
+ userId: string;
43
+ };
44
+ /** The bot's name and the texts users see before they start it. */
45
+ export interface TelegramProfile {
46
+ /** 0-64 characters */
47
+ name?: string;
48
+ /** Shown in an empty chat with the bot, 0-512 characters */
49
+ description?: string;
50
+ /** Shown on the bot's profile and in shared links, 0-120 characters */
51
+ shortDescription?: string;
52
+ languageCode?: string;
16
53
  }
54
+ /** A chat id as Telegram takes it: a number, or a public `@username`. */
55
+ export declare function telegramChatId(id: string): number | string;
56
+ /** The inline keyboard for rows of buttons. */
57
+ export declare function telegramKeyboard(rows: ChannelButton[][]): {
58
+ inline_keyboard: Record<string, unknown>[][];
59
+ };
60
+ /**
61
+ * Telegram through grammY, on the current Bot API: rich messages that render standard Markdown,
62
+ * streamed drafts with a stop button, inline buttons with colors and their presses, topics,
63
+ * captions and albums, message effects, link previews, ephemeral messages and command menus.
64
+ * Every call goes through grammY's raw API, so a Bot API feature newer than the installed grammY
65
+ * still works, and `call` reaches any method this class does not wrap.
66
+ */
17
67
  export declare class TelegramChannel implements Channel {
18
68
  private readonly config;
19
69
  readonly type: ChannelType;
20
70
  private handler;
71
+ private actionHandler;
72
+ private stopHandler;
21
73
  private bot;
22
74
  private grammy;
23
75
  private server;
76
+ /** Set when the Bot API server does not know rich messages, so they are not tried again. */
77
+ private richUnavailable;
24
78
  constructor(config: TelegramConfig);
79
+ /**
80
+ * With rich messages on, Markdown arrives as written (GitHub Flavored) and is adapted to
81
+ * Telegram's classic Markdown here when a rich message cannot be sent.
82
+ */
83
+ get nativeMarkdown(): boolean;
84
+ get maxMessageChars(): number;
85
+ /** Text for a classic message: Markdown written for rich messages is adapted first. */
86
+ private classic;
25
87
  onMessage(handler: (msg: ChannelMessage) => Promise<void>): void;
88
+ onAction(handler: (action: ChannelAction) => Promise<void>): void;
89
+ onStop(handler: (stop: ChannelStop) => void): void;
90
+ /** Calls any Bot API method by name, for features this class does not wrap. */
91
+ call<T = unknown>(method: string, args?: Record<string, unknown>): Promise<T>;
26
92
  private requireBot;
27
93
  private downloadFile;
28
94
  private buildBaseMessage;
@@ -31,13 +97,65 @@ export declare class TelegramChannel implements Channel {
31
97
  private startWebhook;
32
98
  private closeServer;
33
99
  stop(): Promise<void>;
100
+ /** The parameters every send shares: topic, reply, notification, protection, effect, buttons. */
101
+ private envelope;
102
+ private get useRich();
103
+ /** Notes a refusal of a rich call, so an unknown method is not tried again. */
104
+ private richRefused;
34
105
  sendText(channelId: string, text: string, options?: SendOptions): Promise<string>;
35
- editText(channelId: string, messageId: string, text: string): Promise<void>;
36
- sendFile(channelId: string, file: Attachment): Promise<void>;
37
- sendTyping(channelId: string): Promise<void>;
38
- sendDraft(channelId: string, draftId: number, text: string, options?: SendOptions): Promise<void>;
106
+ /**
107
+ * A text message in Telegram's classic formatting, in as many messages as the limit needs:
108
+ * the reply goes on the first, the buttons on the last, and a parse failure is sent as plain
109
+ * text.
110
+ */
111
+ private sendClassic;
112
+ editText(channelId: string, messageId: string, text: string, options?: SendOptions): Promise<void>;
113
+ private source;
114
+ /** The Bot API method and field a file is sent with. */
115
+ private static mediaKind;
116
+ /** A caption in classic formatting, or none when it is too long to be one. */
117
+ private caption;
118
+ /** Sends one file and returns the id of its message. */
119
+ sendFile(channelId: string, file: Attachment, options?: SendOptions): Promise<string>;
120
+ /**
121
+ * Sends files as albums of up to ten. Photos and videos share an album, while audio and
122
+ * documents each go in albums of their own kind, as Telegram requires; GIFs, which albums do
123
+ * not take, go on their own as animations. Each file keeps its own caption, and a caption too
124
+ * long for an album follows it as a message. Albums carry no buttons. Returns the ids of every
125
+ * message sent.
126
+ */
127
+ sendFiles(channelId: string, files: Attachment[], options?: SendOptions): Promise<string[]>;
128
+ sendTyping(channelId: string, options?: Pick<SendOptions, 'topicId'>): Promise<void>;
129
+ /**
130
+ * Streams a partial answer as a draft, a preview Telegram shows for 30 seconds; the final
131
+ * answer is sent as a message. Drafts exist in private chats only, so a group throws and the
132
+ * caller falls back to sending and editing messages. With `canStop`, the user gets a stop
133
+ * button and the draft stays on screen after a press until the final message replaces it.
134
+ */
135
+ sendDraft(channelId: string, draftId: number, text: string, options?: DraftOptions): Promise<void>;
39
136
  deleteMessage(channelId: string, messageId: string): Promise<void>;
40
137
  setReaction(channelId: string, messageId: string, emoji: string): Promise<void>;
138
+ answerAction(actionId: string, options?: {
139
+ text?: string;
140
+ alert?: boolean;
141
+ }): Promise<void>;
142
+ editButtons(channelId: string, messageId: string, buttons: ChannelButton[][] | null): Promise<void>;
143
+ setCommands(commands: ChannelCommand[], scope?: {
144
+ chatId?: string;
145
+ }): Promise<void>;
146
+ /** Sets the command menu for a scope and, optionally, a language. */
147
+ setCommandMenu(commands: ChannelCommand[], options?: {
148
+ scope?: TelegramCommandScope;
149
+ languageCode?: string;
150
+ }): Promise<void>;
151
+ /** Removes the command menu of a scope. */
152
+ deleteCommandMenu(options?: {
153
+ scope?: TelegramCommandScope;
154
+ languageCode?: string;
155
+ }): Promise<void>;
156
+ private scopeArgs;
157
+ /** Sets the bot's name, description and short description; fields left out are not changed. */
158
+ setProfile(profile: TelegramProfile): Promise<void>;
41
159
  }
42
- export declare function telegramChannel(config: TelegramConfig): Channel;
160
+ export declare function telegramChannel(config: TelegramConfig): TelegramChannel;
43
161
  //# sourceMappingURL=telegram.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"telegram.d.ts","sourceRoot":"","sources":["../../src/channels/telegram.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,WAAW,EACX,UAAU,EACV,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAE7B,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B;;;;OAIG;IACH,OAAO,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC9E;AA0HD,qBAAa,eAAgB,YAAW,OAAO;IAOjC,OAAO,CAAC,QAAQ,CAAC,MAAM;IANnC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAc;IACxC,OAAO,CAAC,OAAO,CAAyD;IACxE,OAAO,CAAC,GAAG,CAA4B;IACvC,OAAO,CAAC,MAAM,CAA6B;IAC3C,OAAO,CAAC,MAAM,CAAuB;gBAER,MAAM,EAAE,cAAc;IAEnD,SAAS,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC,IA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