simplex-ts 3.6.17 → 3.6.19
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 +262 -193
- package/dist/SimplexClient.d.ts +33 -18
- package/dist/SimplexClient.d.ts.map +1 -1
- package/dist/SimplexClient.js +48 -65
- package/dist/SimplexClient.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/resources/Workflow.d.ts +22 -39
- package/dist/resources/Workflow.d.ts.map +1 -1
- package/dist/resources/Workflow.js +21 -371
- package/dist/resources/Workflow.js.map +1 -1
- package/dist/types/index.d.ts +19 -211
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/resources/WorkflowSession.d.ts +0 -39
- package/dist/resources/WorkflowSession.d.ts.map +0 -1
- package/dist/resources/WorkflowSession.js +0 -114
- package/dist/resources/WorkflowSession.js.map +0 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface SimplexClientOptions {
|
|
2
2
|
apiKey: string;
|
|
3
|
+
baseURL?: string;
|
|
3
4
|
timeout?: number;
|
|
4
5
|
maxRetries?: number;
|
|
5
6
|
retryDelay?: number;
|
|
6
7
|
}
|
|
7
|
-
/**
|
|
8
|
-
* Metadata for a file downloaded or created during a session
|
|
9
|
-
*/
|
|
10
8
|
export interface FileMetadata {
|
|
11
9
|
/** The filename */
|
|
12
10
|
filename: string;
|
|
@@ -22,7 +20,7 @@ export interface WebhookPayload {
|
|
|
22
20
|
agent_response: string;
|
|
23
21
|
session_id: string;
|
|
24
22
|
file_metadata?: FileMetadata[];
|
|
25
|
-
scraper_outputs?: any
|
|
23
|
+
scraper_outputs?: Record<string, any>;
|
|
26
24
|
session_metadata?: Record<string, any>;
|
|
27
25
|
workflow_id?: string;
|
|
28
26
|
workflow_metadata?: Record<string, any>;
|
|
@@ -33,24 +31,6 @@ export interface WebhookPayload {
|
|
|
33
31
|
export interface WorkflowVariables {
|
|
34
32
|
[key: string]: any;
|
|
35
33
|
}
|
|
36
|
-
export interface Variable {
|
|
37
|
-
name: string;
|
|
38
|
-
type: 'string' | 'number' | 'boolean' | 'array' | 'object' | 'enum';
|
|
39
|
-
required: boolean;
|
|
40
|
-
enumValues?: string[];
|
|
41
|
-
description: string;
|
|
42
|
-
}
|
|
43
|
-
export interface StructuredOutput {
|
|
44
|
-
name: string;
|
|
45
|
-
type: string;
|
|
46
|
-
enumValues?: string[];
|
|
47
|
-
description: string;
|
|
48
|
-
}
|
|
49
|
-
export interface Prompt {
|
|
50
|
-
id: string;
|
|
51
|
-
name: string;
|
|
52
|
-
prompt: string;
|
|
53
|
-
}
|
|
54
34
|
export interface RunWorkflowRequest {
|
|
55
35
|
workflow_id: string;
|
|
56
36
|
metadata?: string;
|
|
@@ -63,145 +43,6 @@ export interface RunWorkflowResponse {
|
|
|
63
43
|
session_id: string;
|
|
64
44
|
vnc_url: string;
|
|
65
45
|
}
|
|
66
|
-
export interface SimplexClientOptions {
|
|
67
|
-
apiKey: string;
|
|
68
|
-
baseURL?: string;
|
|
69
|
-
timeout?: number;
|
|
70
|
-
maxRetries?: number;
|
|
71
|
-
retryDelay?: number;
|
|
72
|
-
}
|
|
73
|
-
export interface AgenticRequest {
|
|
74
|
-
task: string;
|
|
75
|
-
session_id: string;
|
|
76
|
-
max_steps?: number;
|
|
77
|
-
actions_to_exclude?: string[];
|
|
78
|
-
variables?: string;
|
|
79
|
-
}
|
|
80
|
-
export interface AgenticResponse {
|
|
81
|
-
succeeded: boolean;
|
|
82
|
-
result: any;
|
|
83
|
-
error?: string;
|
|
84
|
-
}
|
|
85
|
-
export interface RunAgentRequest {
|
|
86
|
-
agent_name: string;
|
|
87
|
-
session_id: string;
|
|
88
|
-
variables?: Record<string, any>;
|
|
89
|
-
}
|
|
90
|
-
export interface RunAgentResponse {
|
|
91
|
-
succeeded: boolean;
|
|
92
|
-
session_id: string;
|
|
93
|
-
agent_name: string;
|
|
94
|
-
result: any;
|
|
95
|
-
}
|
|
96
|
-
export interface WorkflowAction {
|
|
97
|
-
action: string;
|
|
98
|
-
params: any;
|
|
99
|
-
result: any;
|
|
100
|
-
timestamp: string;
|
|
101
|
-
}
|
|
102
|
-
export interface RunBetaAgentActionWithPrompts {
|
|
103
|
-
function: 'run_beta_agent';
|
|
104
|
-
params: {
|
|
105
|
-
prompts: Prompt[];
|
|
106
|
-
};
|
|
107
|
-
options: Record<string, any>;
|
|
108
|
-
}
|
|
109
|
-
export interface RunBetaAgentActionWithPrompt {
|
|
110
|
-
function: 'run_beta_agent';
|
|
111
|
-
params: {
|
|
112
|
-
prompt: string;
|
|
113
|
-
};
|
|
114
|
-
options: Record<string, any>;
|
|
115
|
-
}
|
|
116
|
-
export type RunBetaAgentAction = RunBetaAgentActionWithPrompts | RunBetaAgentActionWithPrompt;
|
|
117
|
-
export interface WaitAction {
|
|
118
|
-
function: 'wait';
|
|
119
|
-
params: {
|
|
120
|
-
milliseconds: string;
|
|
121
|
-
};
|
|
122
|
-
options: Record<string, any>;
|
|
123
|
-
}
|
|
124
|
-
export interface CaptureLoginSessionAction {
|
|
125
|
-
function: 'capture_login_session';
|
|
126
|
-
params: Record<string, never>;
|
|
127
|
-
options: Record<string, any>;
|
|
128
|
-
}
|
|
129
|
-
export interface GetNetworkResponseAction {
|
|
130
|
-
function: 'get_network_response';
|
|
131
|
-
params: {
|
|
132
|
-
url: string;
|
|
133
|
-
};
|
|
134
|
-
options: Record<string, any>;
|
|
135
|
-
}
|
|
136
|
-
export interface GotoAction {
|
|
137
|
-
function: 'goto';
|
|
138
|
-
params: {
|
|
139
|
-
url: string;
|
|
140
|
-
timeout?: number;
|
|
141
|
-
};
|
|
142
|
-
options: Record<string, any>;
|
|
143
|
-
}
|
|
144
|
-
export type Action = RunBetaAgentAction | WaitAction | CaptureLoginSessionAction | GetNetworkResponseAction | GotoAction;
|
|
145
|
-
export interface Workflow {
|
|
146
|
-
id: string;
|
|
147
|
-
name: string;
|
|
148
|
-
actions: Action[];
|
|
149
|
-
variables: Variable[];
|
|
150
|
-
structured_output?: StructuredOutput[];
|
|
151
|
-
url: string;
|
|
152
|
-
metadata: string | null;
|
|
153
|
-
}
|
|
154
|
-
export interface WorkflowStatusResponse {
|
|
155
|
-
succeeded: boolean;
|
|
156
|
-
completed: boolean;
|
|
157
|
-
results: WorkflowAction[];
|
|
158
|
-
total_actions: number;
|
|
159
|
-
session_id: string;
|
|
160
|
-
completed_at?: string;
|
|
161
|
-
}
|
|
162
|
-
export interface CreateWorkflowSessionRequest {
|
|
163
|
-
workflow_name: string;
|
|
164
|
-
url: string;
|
|
165
|
-
proxies?: boolean;
|
|
166
|
-
session_data?: string;
|
|
167
|
-
metadata?: string;
|
|
168
|
-
}
|
|
169
|
-
export interface CreateWorkflowSessionResponse {
|
|
170
|
-
session_id: string;
|
|
171
|
-
workflow_id: string;
|
|
172
|
-
connect_url: string;
|
|
173
|
-
vnc_url: string;
|
|
174
|
-
}
|
|
175
|
-
export interface GetSessionStoreResponse {
|
|
176
|
-
succeeded: boolean;
|
|
177
|
-
session_store?: Record<string, any>;
|
|
178
|
-
error?: string;
|
|
179
|
-
}
|
|
180
|
-
export interface DownloadSessionFilesRequest {
|
|
181
|
-
session_id: string;
|
|
182
|
-
filename?: string;
|
|
183
|
-
}
|
|
184
|
-
export interface DownloadSessionFilesErrorResponse {
|
|
185
|
-
succeeded: false;
|
|
186
|
-
error: string;
|
|
187
|
-
}
|
|
188
|
-
export interface TwoFactorConfig {
|
|
189
|
-
seed: string;
|
|
190
|
-
name?: string;
|
|
191
|
-
partial_url?: string;
|
|
192
|
-
}
|
|
193
|
-
export interface Add2FAConfigRequest {
|
|
194
|
-
seed: string;
|
|
195
|
-
name?: string;
|
|
196
|
-
partial_url?: string;
|
|
197
|
-
}
|
|
198
|
-
export interface Add2FAConfigResponse {
|
|
199
|
-
succeeded: boolean;
|
|
200
|
-
added_config?: any;
|
|
201
|
-
total_configs?: number;
|
|
202
|
-
all_configs?: any[];
|
|
203
|
-
error?: string;
|
|
204
|
-
}
|
|
205
46
|
export interface SearchWorkflowsRequest {
|
|
206
47
|
workflow_name?: string;
|
|
207
48
|
metadata?: string;
|
|
@@ -226,60 +67,27 @@ export interface UpdateWorkflowMetadataResponse {
|
|
|
226
67
|
workflow_id: string;
|
|
227
68
|
metadata: string;
|
|
228
69
|
}
|
|
229
|
-
export interface GetWorkflowResponse {
|
|
230
|
-
succeeded: boolean;
|
|
231
|
-
workflow: Workflow;
|
|
232
|
-
error?: string;
|
|
233
|
-
}
|
|
234
|
-
export interface CreateWorkflowRequest {
|
|
235
|
-
name: string;
|
|
236
|
-
url?: string;
|
|
237
|
-
actions?: Action[];
|
|
238
|
-
variables?: Variable[];
|
|
239
|
-
structured_output?: StructuredOutput[];
|
|
240
|
-
metadata?: string;
|
|
241
|
-
}
|
|
242
|
-
export interface CreateWorkflowResponse {
|
|
243
|
-
succeeded: boolean;
|
|
244
|
-
workflow: Workflow;
|
|
245
|
-
error?: string;
|
|
246
|
-
}
|
|
247
|
-
export interface UpdateWorkflowRequest {
|
|
248
|
-
name?: string;
|
|
249
|
-
actions?: Action[];
|
|
250
|
-
variables?: Variable[];
|
|
251
|
-
structured_output?: StructuredOutput[];
|
|
252
|
-
url?: string;
|
|
253
|
-
metadata?: string | null;
|
|
254
|
-
}
|
|
255
|
-
export interface UpdateWorkflowResponse {
|
|
256
|
-
succeeded: boolean;
|
|
257
|
-
workflow: Workflow;
|
|
258
|
-
error?: string;
|
|
259
|
-
}
|
|
260
|
-
export interface CreatePromptRequest {
|
|
261
|
-
prompt: string;
|
|
262
|
-
name?: string;
|
|
263
|
-
}
|
|
264
|
-
export interface CreatePromptResponse {
|
|
265
|
-
succeeded: boolean;
|
|
266
|
-
message: string;
|
|
267
|
-
prompt: Prompt;
|
|
268
|
-
error?: string;
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Response from polling session status
|
|
272
|
-
*/
|
|
273
70
|
export interface SessionStatusResponse {
|
|
274
|
-
/** Whether the session is still running
|
|
71
|
+
/** Whether the session is still running */
|
|
275
72
|
in_progress: boolean;
|
|
276
|
-
/** Whether the session completed successfully (null while in progress
|
|
73
|
+
/** Whether the session completed successfully (null while in progress) */
|
|
277
74
|
success: boolean | null;
|
|
278
|
-
/** Custom metadata provided when the session was started
|
|
75
|
+
/** Custom metadata provided when the session was started */
|
|
279
76
|
metadata: Record<string, any>;
|
|
280
|
-
/** Metadata from the workflow definition
|
|
77
|
+
/** Metadata from the workflow definition */
|
|
281
78
|
workflow_metadata: Record<string, any>;
|
|
282
|
-
/** Metadata for files downloaded during the session
|
|
79
|
+
/** Metadata for files downloaded during the session */
|
|
283
80
|
file_metadata: FileMetadata[];
|
|
81
|
+
/** Scraper outputs collected during the session */
|
|
82
|
+
scraper_outputs?: Record<string, any>;
|
|
83
|
+
}
|
|
84
|
+
export interface DownloadSessionFilesErrorResponse {
|
|
85
|
+
succeeded: false;
|
|
86
|
+
error: string;
|
|
87
|
+
}
|
|
88
|
+
export interface ResumeSessionResponse {
|
|
89
|
+
succeeded: boolean;
|
|
90
|
+
key?: string;
|
|
91
|
+
error?: string;
|
|
284
92
|
}
|
|
285
93
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,MAAM,WAAW,YAAY;IAC3B,mBAAmB;IACn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
|
|
1
|
-
import { HttpClient } from '../client/HttpClient';
|
|
2
|
-
import { AgenticResponse, RunAgentResponse } from '../types';
|
|
3
|
-
export declare class WorkflowSession {
|
|
4
|
-
private httpClient;
|
|
5
|
-
sessionId: string;
|
|
6
|
-
workflowId: string;
|
|
7
|
-
connectUrl: string;
|
|
8
|
-
vncUrl: string;
|
|
9
|
-
constructor(httpClient: HttpClient, data: {
|
|
10
|
-
sessionId: string;
|
|
11
|
-
workflowId: string;
|
|
12
|
-
connectUrl: string;
|
|
13
|
-
vncUrl: string;
|
|
14
|
-
});
|
|
15
|
-
runAgent(agentName: string, variables?: Record<string, any>): Promise<RunAgentResponse>;
|
|
16
|
-
agentic(task: string, options?: {
|
|
17
|
-
maxSteps?: number;
|
|
18
|
-
actionsToExclude?: string[];
|
|
19
|
-
variables?: Record<string, any>;
|
|
20
|
-
}): Promise<AgenticResponse>;
|
|
21
|
-
startCapture(): Promise<{
|
|
22
|
-
succeeded: boolean;
|
|
23
|
-
}>;
|
|
24
|
-
stopCapture(): Promise<{
|
|
25
|
-
succeeded: boolean;
|
|
26
|
-
}>;
|
|
27
|
-
goto(url: string, options?: {
|
|
28
|
-
timeout?: number;
|
|
29
|
-
overrideFailState?: boolean;
|
|
30
|
-
}): Promise<{
|
|
31
|
-
succeeded: boolean;
|
|
32
|
-
error?: string;
|
|
33
|
-
}>;
|
|
34
|
-
close(): Promise<{
|
|
35
|
-
succeeded: boolean;
|
|
36
|
-
message?: string;
|
|
37
|
-
}>;
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=WorkflowSession.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WorkflowSession.d.ts","sourceRoot":"","sources":["../../src/resources/WorkflowSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAEL,eAAe,EAEf,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAGlB,qBAAa,eAA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1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WorkflowSession = void 0;
|
|
4
|
-
const errors_1 = require("../errors");
|
|
5
|
-
class WorkflowSession {
|
|
6
|
-
constructor(httpClient, data) {
|
|
7
|
-
this.httpClient = httpClient;
|
|
8
|
-
this.sessionId = data.sessionId;
|
|
9
|
-
this.workflowId = data.workflowId;
|
|
10
|
-
this.connectUrl = data.connectUrl;
|
|
11
|
-
this.vncUrl = data.vncUrl;
|
|
12
|
-
}
|
|
13
|
-
async runAgent(agentName, variables) {
|
|
14
|
-
const request = {
|
|
15
|
-
agent_name: agentName,
|
|
16
|
-
session_id: this.sessionId,
|
|
17
|
-
variables,
|
|
18
|
-
};
|
|
19
|
-
try {
|
|
20
|
-
const response = await this.httpClient.post('/run_agent', request);
|
|
21
|
-
if (!response.succeeded) {
|
|
22
|
-
throw new errors_1.SimplexError(`Agent run failed for ${agentName}`, 500, { agentName, sessionId: this.sessionId });
|
|
23
|
-
}
|
|
24
|
-
return response;
|
|
25
|
-
}
|
|
26
|
-
catch (error) {
|
|
27
|
-
if (error instanceof errors_1.SimplexError) {
|
|
28
|
-
throw error;
|
|
29
|
-
}
|
|
30
|
-
throw new errors_1.SimplexError(`Failed to run agent: ${error instanceof Error ? error.message : 'Unknown error'}`, 500, { agentName, sessionId: this.sessionId });
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
async agentic(task, options) {
|
|
34
|
-
const request = {
|
|
35
|
-
task,
|
|
36
|
-
session_id: this.sessionId,
|
|
37
|
-
max_steps: options?.maxSteps,
|
|
38
|
-
actions_to_exclude: options?.actionsToExclude,
|
|
39
|
-
variables: options?.variables ? JSON.stringify(options.variables) : undefined,
|
|
40
|
-
};
|
|
41
|
-
try {
|
|
42
|
-
const response = await this.httpClient.post('/agentic', request);
|
|
43
|
-
if (!response.succeeded && response.error) {
|
|
44
|
-
throw new errors_1.SimplexError(`Agent task failed: ${response.error}`, 500, { sessionId: this.sessionId, task });
|
|
45
|
-
}
|
|
46
|
-
return response;
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
if (error instanceof errors_1.SimplexError) {
|
|
50
|
-
throw error;
|
|
51
|
-
}
|
|
52
|
-
throw new errors_1.SimplexError(`Failed to run agent task: ${error instanceof Error ? error.message : 'Unknown error'}`, 500, { sessionId: this.sessionId, task });
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
async startCapture() {
|
|
56
|
-
const request = {
|
|
57
|
-
session_id: this.sessionId,
|
|
58
|
-
};
|
|
59
|
-
try {
|
|
60
|
-
const response = await this.httpClient.post('/start_capture_mode', request);
|
|
61
|
-
return response;
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
throw new errors_1.WorkflowError(`Failed to start capture mode: ${error instanceof Error ? error.message : 'Unknown error'}`, undefined, this.sessionId);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
async stopCapture() {
|
|
68
|
-
const request = {
|
|
69
|
-
session_id: this.sessionId,
|
|
70
|
-
};
|
|
71
|
-
try {
|
|
72
|
-
const response = await this.httpClient.post('/stop_capture_mode', request);
|
|
73
|
-
return response;
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
throw new errors_1.WorkflowError(`Failed to stop capture mode: ${error instanceof Error ? error.message : 'Unknown error'}`, undefined, this.sessionId);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
async goto(url, options) {
|
|
80
|
-
const request = {
|
|
81
|
-
url,
|
|
82
|
-
session_id: this.sessionId,
|
|
83
|
-
timeout: options?.timeout ?? 120000,
|
|
84
|
-
override_fail_state: options?.overrideFailState ?? false,
|
|
85
|
-
};
|
|
86
|
-
try {
|
|
87
|
-
const response = await this.httpClient.post('/goto', request);
|
|
88
|
-
if (!response.succeeded && response.error) {
|
|
89
|
-
throw new errors_1.SimplexError(`Goto failed: ${response.error}`, 500, { sessionId: this.sessionId, url });
|
|
90
|
-
}
|
|
91
|
-
return response;
|
|
92
|
-
}
|
|
93
|
-
catch (error) {
|
|
94
|
-
if (error instanceof errors_1.SimplexError) {
|
|
95
|
-
throw error;
|
|
96
|
-
}
|
|
97
|
-
throw new errors_1.SimplexError(`Failed to goto URL: ${error instanceof Error ? error.message : 'Unknown error'}`, 500, { sessionId: this.sessionId, url });
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
async close() {
|
|
101
|
-
const request = {
|
|
102
|
-
session_id: this.sessionId,
|
|
103
|
-
};
|
|
104
|
-
try {
|
|
105
|
-
const response = await this.httpClient.post('/close_workflow_session', request);
|
|
106
|
-
return response;
|
|
107
|
-
}
|
|
108
|
-
catch (error) {
|
|
109
|
-
throw new errors_1.WorkflowError(`Failed to close workflow session: ${error instanceof Error ? error.message : 'Unknown error'}`, undefined, this.sessionId);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
exports.WorkflowSession = WorkflowSession;
|
|
114
|
-
//# sourceMappingURL=WorkflowSession.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WorkflowSession.js","sourceRoot":"","sources":["../../src/resources/WorkflowSession.ts"],"names":[],"mappings":";;;AAOA,sCAAwD;AAExD,MAAa,eAAe;IAM1B,YACU,UAAsB,EAC9B,IAKC;QANO,eAAU,GAAV,UAAU,CAAY;QAQ9B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,QAAQ,CACZ,SAAiB,EACjB,SAA+B;QAE/B,MAAM,OAAO,GAAoB;YAC/B,UAAU,EAAE,SAAS;YACrB,UAAU,EAAE,IAAI,CAAC,SAAS;YAC1B,SAAS;S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