@builder.io/ai-utils 0.18.0 → 0.18.2
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/package.json +1 -1
- package/src/codegen.d.ts +62 -0
- package/src/completion.d.ts +147 -151
- package/src/events.d.ts +281 -333
- package/src/mapping.d.ts +66 -66
- package/src/messages.d.ts +214 -283
- package/src/messages.js +12 -12
- package/src/organization.d.ts +366 -351
- package/src/projects.d.ts +433 -571
- package/src/projects.js +17 -18
- package/src/repo-indexing.d.ts +96 -114
- package/src/repo-indexing.js +5 -5
- package/src/settings.d.ts +13 -15
- package/src/settings.js +26 -27
- package/src/vscode-tunnel.d.ts +8 -23
- package/src/vscode-tunnel.js +22 -36
package/src/messages.d.ts
CHANGED
|
@@ -3,317 +3,266 @@ import type { ContentUpdatePatch } from "./events.js";
|
|
|
3
3
|
* Message param does not know the id of the message.
|
|
4
4
|
* This is an input message.
|
|
5
5
|
*/
|
|
6
|
-
export type MessageParam =
|
|
7
|
-
| SystemMessageParam
|
|
8
|
-
| UserMessageParam
|
|
9
|
-
| AssistantMessageParam;
|
|
6
|
+
export type MessageParam = SystemMessageParam | UserMessageParam | AssistantMessageParam;
|
|
10
7
|
export interface ContentMessageItemText {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
type: "text";
|
|
9
|
+
text: string;
|
|
10
|
+
cache?: boolean;
|
|
11
|
+
citations?: TextCitationParam[] | null;
|
|
12
|
+
ephemeral?: boolean;
|
|
13
|
+
thoughtSignature?: string;
|
|
14
|
+
tag?: string;
|
|
18
15
|
}
|
|
19
16
|
export interface ContentMessageItemImage {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
type: "image";
|
|
18
|
+
source: ImageBase64Source | ImageUrlSource;
|
|
19
|
+
cache?: boolean;
|
|
20
|
+
ephemeral?: boolean;
|
|
24
21
|
}
|
|
25
22
|
export interface ContentMessageItemDocument {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
type: "document";
|
|
24
|
+
source: DocumentBase64Source | DocumentUrlSource | DocumentTextSource;
|
|
25
|
+
cache?: boolean;
|
|
26
|
+
ephemeral?: boolean;
|
|
27
|
+
title?: string;
|
|
31
28
|
}
|
|
32
29
|
export interface ContentMessageItemVideo {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
type: "video";
|
|
31
|
+
source: VideoUrlSource;
|
|
32
|
+
cache?: boolean;
|
|
33
|
+
ephemeral?: boolean;
|
|
37
34
|
}
|
|
38
35
|
export interface DocumentBase64Source {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
type: "base64";
|
|
37
|
+
media_type: "application/pdf";
|
|
38
|
+
data: string;
|
|
39
|
+
original_url?: string;
|
|
43
40
|
}
|
|
44
41
|
export interface DocumentUrlSource {
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
type: "url";
|
|
43
|
+
url: string;
|
|
47
44
|
}
|
|
48
45
|
export interface DocumentTextSource {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
type: "text";
|
|
47
|
+
media_type: "text/plain";
|
|
48
|
+
data: string;
|
|
52
49
|
}
|
|
53
50
|
export interface ContentMessageItemToolResult {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
51
|
+
type: "tool_result";
|
|
52
|
+
tool_use_id: string;
|
|
53
|
+
tool_name?: string;
|
|
54
|
+
tool_input?: string;
|
|
55
|
+
title?: string;
|
|
56
|
+
content: string | (ContentMessageItemText | ContentMessageItemImage)[];
|
|
57
|
+
is_error?: boolean;
|
|
58
|
+
cache?: boolean;
|
|
59
|
+
ephemeral?: boolean;
|
|
60
|
+
structured_result?: Record<string, any>;
|
|
64
61
|
}
|
|
65
62
|
export interface ImageBase64Source {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
type: "base64";
|
|
64
|
+
media_type: "image/webp" | "image/png" | "image/jpeg" | "image/gif";
|
|
65
|
+
data: string;
|
|
66
|
+
original_url?: string;
|
|
70
67
|
}
|
|
71
68
|
export interface ImageUrlSource {
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
type: "url";
|
|
70
|
+
url: string;
|
|
74
71
|
}
|
|
75
72
|
export interface VideoUrlSource {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
| "video/mp4"
|
|
80
|
-
| "video/mov"
|
|
81
|
-
| "video/mpeg"
|
|
82
|
-
| "video/mpg"
|
|
83
|
-
| "video/avi"
|
|
84
|
-
| "video/wmv"
|
|
85
|
-
| "video/webm"
|
|
86
|
-
| "video/flv";
|
|
73
|
+
type: "url";
|
|
74
|
+
url: string;
|
|
75
|
+
media_type?: "video/mp4" | "video/mov" | "video/mpeg" | "video/mpg" | "video/avi" | "video/wmv" | "video/webm" | "video/flv";
|
|
87
76
|
}
|
|
88
77
|
export interface ContentMessageItemThinking {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
78
|
+
type: "thinking";
|
|
79
|
+
thinking: string;
|
|
80
|
+
signature: string;
|
|
81
|
+
source?: "openai" | "gemini";
|
|
82
|
+
id?: string;
|
|
94
83
|
}
|
|
95
84
|
export interface ContentMessageItemRedactedThinking {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
85
|
+
type: "redacted_thinking";
|
|
86
|
+
data: string;
|
|
87
|
+
source?: "openai" | "gemini";
|
|
88
|
+
id?: string;
|
|
100
89
|
}
|
|
101
90
|
export interface ContentMessageItemToolUse {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
91
|
+
type: "tool_use";
|
|
92
|
+
id: string;
|
|
93
|
+
provider_id?: string;
|
|
94
|
+
input: unknown;
|
|
95
|
+
completion?: string;
|
|
96
|
+
thoughtSignature?: string;
|
|
97
|
+
name: string;
|
|
109
98
|
}
|
|
110
99
|
export interface CitationCharLocationParam {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
100
|
+
cited_text: string;
|
|
101
|
+
document_index: number;
|
|
102
|
+
document_title: string | null;
|
|
103
|
+
end_char_index: number;
|
|
104
|
+
start_char_index: number;
|
|
105
|
+
type: "char_location";
|
|
117
106
|
}
|
|
118
107
|
export interface CitationContentBlockLocationParam {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
108
|
+
cited_text: string;
|
|
109
|
+
document_index: number;
|
|
110
|
+
document_title: string | null;
|
|
111
|
+
end_block_index: number;
|
|
112
|
+
start_block_index: number;
|
|
113
|
+
type: "content_block_location";
|
|
125
114
|
}
|
|
126
115
|
export interface CitationPageLocationParam {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
116
|
+
cited_text: string;
|
|
117
|
+
document_index: number;
|
|
118
|
+
document_title: string | null;
|
|
119
|
+
end_page_number: number;
|
|
120
|
+
start_page_number: number;
|
|
121
|
+
type: "page_location";
|
|
133
122
|
}
|
|
134
123
|
export interface CitationWebSearchResultLocationParam {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
export type TextCitationParam =
|
|
142
|
-
| CitationCharLocationParam
|
|
143
|
-
| CitationPageLocationParam
|
|
144
|
-
| CitationContentBlockLocationParam
|
|
145
|
-
| CitationWebSearchResultLocationParam;
|
|
124
|
+
cited_text: string;
|
|
125
|
+
encrypted_index: string;
|
|
126
|
+
title: string | null;
|
|
127
|
+
type: "web_search_result_location";
|
|
128
|
+
url: string;
|
|
129
|
+
}
|
|
130
|
+
export type TextCitationParam = CitationCharLocationParam | CitationPageLocationParam | CitationContentBlockLocationParam | CitationWebSearchResultLocationParam;
|
|
146
131
|
export interface ServerToolUseContent {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
132
|
+
type: "web_search_result";
|
|
133
|
+
title: string;
|
|
134
|
+
url: string;
|
|
135
|
+
page_age: string | null;
|
|
136
|
+
encrypted_content: string;
|
|
152
137
|
}
|
|
153
138
|
export interface ServerToolUseContentError {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
| "too_many_requests"
|
|
159
|
-
| "query_too_long";
|
|
160
|
-
type: "web_search_tool_result_error";
|
|
161
|
-
}
|
|
162
|
-
export type ServerToolUseContentUnion =
|
|
163
|
-
| ServerToolUseContent[]
|
|
164
|
-
| ServerToolUseContentError;
|
|
139
|
+
error_code: "invalid_tool_input" | "unavailable" | "max_uses_exceeded" | "too_many_requests" | "query_too_long";
|
|
140
|
+
type: "web_search_tool_result_error";
|
|
141
|
+
}
|
|
142
|
+
export type ServerToolUseContentUnion = ServerToolUseContent[] | ServerToolUseContentError;
|
|
165
143
|
export interface ContentMessageItemServerToolUse {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
| "text_editor_code_execution"
|
|
174
|
-
| "tool_search_tool_regex"
|
|
175
|
-
| "tool_search_tool_bm25";
|
|
176
|
-
input: unknown;
|
|
177
|
-
completion?: string;
|
|
178
|
-
content?: any;
|
|
179
|
-
cache?: boolean;
|
|
144
|
+
type: "server_tool_use";
|
|
145
|
+
id: string;
|
|
146
|
+
name: "web_search" | "code_execution" | "web_fetch" | "bash_code_execution" | "text_editor_code_execution" | "tool_search_tool_regex" | "tool_search_tool_bm25";
|
|
147
|
+
input: unknown;
|
|
148
|
+
completion?: string;
|
|
149
|
+
content?: any;
|
|
150
|
+
cache?: boolean;
|
|
180
151
|
}
|
|
181
152
|
export interface MCPServerURLDefinition {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
153
|
+
name: string;
|
|
154
|
+
type: "url";
|
|
155
|
+
url: string;
|
|
156
|
+
authorization_token?: string | null;
|
|
157
|
+
tool_configuration?: MCPServerToolConfiguration | null;
|
|
158
|
+
token_expires_at?: number | null;
|
|
159
|
+
create_date?: number | null;
|
|
160
|
+
serverId: string;
|
|
161
|
+
disabled: boolean;
|
|
191
162
|
}
|
|
192
163
|
export interface MCPServerToolConfiguration {
|
|
193
|
-
|
|
194
|
-
|
|
164
|
+
allowed_tools?: Array<string> | null;
|
|
165
|
+
enabled?: boolean | null;
|
|
195
166
|
}
|
|
196
167
|
export interface ContentMessageItemWebSearchToolResult {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
168
|
+
content: ServerToolUseContent[] | ServerToolUseContentError;
|
|
169
|
+
tool_use_id: string;
|
|
170
|
+
type: "web_search_tool_result";
|
|
171
|
+
cache?: boolean;
|
|
201
172
|
}
|
|
202
173
|
export interface ContentMessageItemMCPToolUse {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
174
|
+
type: "mcp_tool_use";
|
|
175
|
+
id: string;
|
|
176
|
+
name: string;
|
|
177
|
+
input: unknown;
|
|
178
|
+
server_name: string;
|
|
179
|
+
cache?: boolean;
|
|
209
180
|
}
|
|
210
181
|
export interface ContentMessageItemContainerUpload {
|
|
211
|
-
|
|
212
|
-
|
|
182
|
+
type: "container_upload";
|
|
183
|
+
file_id: string;
|
|
213
184
|
}
|
|
214
185
|
export interface ContentMessageItemMCPToolResult {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
186
|
+
type: "mcp_tool_result";
|
|
187
|
+
tool_use_id: string;
|
|
188
|
+
content: string | ContentMessageItemText[];
|
|
189
|
+
is_error: boolean;
|
|
190
|
+
cache?: boolean;
|
|
220
191
|
}
|
|
221
192
|
export interface ContentMessageItemCodeExecutionToolResult {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
}
|
|
227
|
-
export type ContentMessageItem =
|
|
228
|
-
| ContentMessageItemText
|
|
229
|
-
| ContentMessageItemImage
|
|
230
|
-
| ContentMessageItemDocument
|
|
231
|
-
| ContentMessageItemVideo
|
|
232
|
-
| ContentMessageItemThinking
|
|
233
|
-
| ContentMessageItemRedactedThinking
|
|
234
|
-
| ContentMessageItemToolUse
|
|
235
|
-
| ContentMessageItemToolResult
|
|
236
|
-
| ContentMessageItemWebSearchToolResult
|
|
237
|
-
| ContentMessageItemServerToolUse
|
|
238
|
-
| ContentMessageItemMCPToolUse
|
|
239
|
-
| ContentMessageItemMCPToolResult
|
|
240
|
-
| ContentMessageItemContainerUpload
|
|
241
|
-
| ContentMessageItemCodeExecutionToolResult;
|
|
193
|
+
type: "code_execution_tool_result";
|
|
194
|
+
tool_use_id: string;
|
|
195
|
+
content: any;
|
|
196
|
+
cache?: boolean;
|
|
197
|
+
}
|
|
198
|
+
export type ContentMessageItem = ContentMessageItemText | ContentMessageItemImage | ContentMessageItemDocument | ContentMessageItemVideo | ContentMessageItemThinking | ContentMessageItemRedactedThinking | ContentMessageItemToolUse | ContentMessageItemToolResult | ContentMessageItemWebSearchToolResult | ContentMessageItemServerToolUse | ContentMessageItemMCPToolUse | ContentMessageItemMCPToolResult | ContentMessageItemContainerUpload | ContentMessageItemCodeExecutionToolResult;
|
|
242
199
|
export type ContentMessage = ContentMessageItem[];
|
|
243
200
|
export interface SystemMessageParam {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
201
|
+
/**
|
|
202
|
+
* The contents of the system message.
|
|
203
|
+
*/
|
|
204
|
+
content: string | ContentMessageItemText[];
|
|
205
|
+
responseId?: string;
|
|
206
|
+
/**
|
|
207
|
+
* The role of the messages author, in this case `system`.
|
|
208
|
+
*/
|
|
209
|
+
role: "system";
|
|
210
|
+
id?: string;
|
|
254
211
|
}
|
|
255
212
|
export interface UserMessageParam {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
| ContentMessageItemToolResult
|
|
267
|
-
)[];
|
|
268
|
-
responseId?: string;
|
|
269
|
-
/**
|
|
270
|
-
* The role of the messages author, in this case `user`.
|
|
271
|
-
*/
|
|
272
|
-
role: "user";
|
|
273
|
-
id?: string;
|
|
213
|
+
/**
|
|
214
|
+
* The contents of the user message.
|
|
215
|
+
*/
|
|
216
|
+
content: string | (ContentMessageItemText | ContentMessageItemImage | ContentMessageItemDocument | ContentMessageItemVideo | ContentMessageItemToolResult)[];
|
|
217
|
+
responseId?: string;
|
|
218
|
+
/**
|
|
219
|
+
* The role of the messages author, in this case `user`.
|
|
220
|
+
*/
|
|
221
|
+
role: "user";
|
|
222
|
+
id?: string;
|
|
274
223
|
}
|
|
275
224
|
export type AssistantMessageAction = "new-chat";
|
|
276
225
|
export interface AssistantMessageParam {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
226
|
+
/**
|
|
227
|
+
* The contents of the assistant message.
|
|
228
|
+
*/
|
|
229
|
+
content: string | ContentMessageItem[];
|
|
230
|
+
/**
|
|
231
|
+
* The role of the messages author, in this case `assistant`.
|
|
232
|
+
*/
|
|
233
|
+
role: "assistant";
|
|
234
|
+
responseId?: string;
|
|
235
|
+
id?: string;
|
|
236
|
+
skipDelta?: boolean;
|
|
237
|
+
/**
|
|
238
|
+
* A summary of the patches which the assistant has made.
|
|
239
|
+
* Useful for genai.
|
|
240
|
+
*/
|
|
241
|
+
patches?: ContentUpdatePatch[];
|
|
242
|
+
state?: "error";
|
|
243
|
+
/**
|
|
244
|
+
* Any actions associated with the error such as a "new chat" button.
|
|
245
|
+
* typically used when there is an error.
|
|
246
|
+
*/
|
|
247
|
+
actions?: AssistantMessageAction[];
|
|
299
248
|
}
|
|
300
249
|
export interface SystemMessage extends SystemMessageParam {
|
|
301
|
-
|
|
250
|
+
id: string;
|
|
302
251
|
}
|
|
303
252
|
export interface UserMessage extends UserMessageParam {
|
|
304
|
-
|
|
253
|
+
id: string;
|
|
305
254
|
}
|
|
306
255
|
export interface AssistantMessage extends AssistantMessageParam {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
256
|
+
id: string;
|
|
257
|
+
status?: "accepted" | "rejected" | "aborted";
|
|
258
|
+
summary?: string;
|
|
310
259
|
}
|
|
311
260
|
export interface AssistantActionMessage {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
261
|
+
/**
|
|
262
|
+
* The role of the messages author, in this case `assistant`.
|
|
263
|
+
*/
|
|
264
|
+
role: "assistant";
|
|
265
|
+
id: string;
|
|
317
266
|
}
|
|
318
267
|
/**
|
|
319
268
|
* Message DOES know the id of the message.
|
|
@@ -321,53 +270,35 @@ export interface AssistantActionMessage {
|
|
|
321
270
|
* and is the output message.
|
|
322
271
|
*/
|
|
323
272
|
export type Message = SystemMessage | UserMessage | AssistantMessage;
|
|
324
|
-
export type GeneratingMessage = null | Partial<
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
export
|
|
328
|
-
message: string | ContentMessage,
|
|
329
|
-
): string;
|
|
330
|
-
export declare function getContentAttachments(
|
|
331
|
-
message: string | ContentMessage,
|
|
332
|
-
): (ImageBase64Source | ImageUrlSource)[];
|
|
333
|
-
export type Attachment =
|
|
334
|
-
| FileUpload
|
|
335
|
-
| Template
|
|
336
|
-
| URL
|
|
337
|
-
| BuilderContentAttachment
|
|
338
|
-
| FigmaContentAttachment;
|
|
273
|
+
export type GeneratingMessage = null | Partial<AssistantActionMessage | AssistantMessage>;
|
|
274
|
+
export declare function getContentText(message: string | ContentMessage): string;
|
|
275
|
+
export declare function getContentAttachments(message: string | ContentMessage): (ImageBase64Source | ImageUrlSource)[];
|
|
276
|
+
export type Attachment = FileUpload | Template | URL | BuilderContentAttachment | FigmaContentAttachment;
|
|
339
277
|
export interface URL {
|
|
340
|
-
|
|
341
|
-
|
|
278
|
+
type: "url";
|
|
279
|
+
value: string;
|
|
342
280
|
}
|
|
343
281
|
export interface FileUpload {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
name: string;
|
|
354
|
-
dataUrl: string;
|
|
355
|
-
text?: string;
|
|
356
|
-
size: number;
|
|
357
|
-
id: string;
|
|
358
|
-
originalUrl?: string;
|
|
359
|
-
ephemeral?: boolean;
|
|
282
|
+
type: "upload";
|
|
283
|
+
contentType: "image/webp" | "image/png" | "image/jpeg" | "image/gif" | "application/pdf" | "application/json" | "text/plain";
|
|
284
|
+
name: string;
|
|
285
|
+
dataUrl: string;
|
|
286
|
+
text?: string;
|
|
287
|
+
size: number;
|
|
288
|
+
id: string;
|
|
289
|
+
originalUrl?: string;
|
|
290
|
+
ephemeral?: boolean;
|
|
360
291
|
}
|
|
361
292
|
export interface Template {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
293
|
+
type: "template";
|
|
294
|
+
name: string;
|
|
295
|
+
id: number;
|
|
365
296
|
}
|
|
366
297
|
export interface BuilderContentAttachment {
|
|
367
|
-
|
|
368
|
-
|
|
298
|
+
type: "builder";
|
|
299
|
+
html: string;
|
|
369
300
|
}
|
|
370
301
|
export interface FigmaContentAttachment {
|
|
371
|
-
|
|
372
|
-
|
|
302
|
+
type: "figma";
|
|
303
|
+
html: string;
|
|
373
304
|
}
|
package/src/messages.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export function getContentText(message) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
if (typeof message === "string") {
|
|
3
|
+
return message;
|
|
4
|
+
}
|
|
5
|
+
return message
|
|
6
|
+
.map((item) => (item.type === "text" ? item.text : ""))
|
|
7
|
+
.join("");
|
|
8
8
|
}
|
|
9
9
|
export function getContentAttachments(message) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
if (typeof message === "string") {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
return message
|
|
14
|
+
.filter((item) => item.type === "image")
|
|
15
|
+
.map((item) => item.source);
|
|
16
16
|
}
|