@seclai/sdk 0.0.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/LICENSE +21 -0
- package/README.md +67 -0
- package/dist/index.cjs +369 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +708 -0
- package/dist/index.d.ts +708 -0
- package/dist/index.js +337 -0
- package/dist/index.js.map +1 -0
- package/package.json +44 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,708 @@
|
|
|
1
|
+
interface components {
|
|
2
|
+
schemas: {
|
|
3
|
+
/** AgentRunAttemptResponse */
|
|
4
|
+
AgentRunAttemptResponse: {
|
|
5
|
+
/**
|
|
6
|
+
* Duration
|
|
7
|
+
* @description Duration of the attempt in seconds.
|
|
8
|
+
*/
|
|
9
|
+
duration: number | null;
|
|
10
|
+
/**
|
|
11
|
+
* Ended At
|
|
12
|
+
* @description Timestamp when the attempt ended.
|
|
13
|
+
*/
|
|
14
|
+
ended_at: string | null;
|
|
15
|
+
/**
|
|
16
|
+
* Error
|
|
17
|
+
* @description Error message if the attempt failed.
|
|
18
|
+
*/
|
|
19
|
+
error: string | null;
|
|
20
|
+
/**
|
|
21
|
+
* Started At
|
|
22
|
+
* @description Timestamp when the attempt started.
|
|
23
|
+
*/
|
|
24
|
+
started_at: string | null;
|
|
25
|
+
/** @description Status of the agent run attempt. */
|
|
26
|
+
status: components["schemas"]["PendingProcessingCompletedFailedStatus"];
|
|
27
|
+
};
|
|
28
|
+
/** AgentRunRequest */
|
|
29
|
+
AgentRunRequest: {
|
|
30
|
+
/**
|
|
31
|
+
* Input
|
|
32
|
+
* @description Input to provide to the agent upon running for agents with dynamic triggers.
|
|
33
|
+
*/
|
|
34
|
+
input: string | null;
|
|
35
|
+
/**
|
|
36
|
+
* Metadata
|
|
37
|
+
* @description Metadata to make available for string substitution expressions in agent tasks.
|
|
38
|
+
*/
|
|
39
|
+
metadata: {
|
|
40
|
+
[key: string]: components["schemas"]["JsonValue"];
|
|
41
|
+
} | null;
|
|
42
|
+
/**
|
|
43
|
+
* Priority
|
|
44
|
+
* @description If true, the agent run will be treated as priority execution.
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
priority: boolean;
|
|
48
|
+
};
|
|
49
|
+
/** AgentRunResponse */
|
|
50
|
+
AgentRunResponse: {
|
|
51
|
+
/**
|
|
52
|
+
* Attempts
|
|
53
|
+
* @description List of attempts made for this agent run.
|
|
54
|
+
*/
|
|
55
|
+
attempts: components["schemas"]["AgentRunAttemptResponse"][];
|
|
56
|
+
/**
|
|
57
|
+
* Credits
|
|
58
|
+
* @description Credits consumed by the agent run, if applicable.
|
|
59
|
+
*/
|
|
60
|
+
credits: number | null;
|
|
61
|
+
/**
|
|
62
|
+
* Error Count
|
|
63
|
+
* @description Number of errors encountered during the run.
|
|
64
|
+
*/
|
|
65
|
+
error_count: number;
|
|
66
|
+
/**
|
|
67
|
+
* Input
|
|
68
|
+
* @description Input provided to the agent for this run.
|
|
69
|
+
*/
|
|
70
|
+
input: string | null;
|
|
71
|
+
/**
|
|
72
|
+
* Output
|
|
73
|
+
* @description Output produced by the agent run.
|
|
74
|
+
*/
|
|
75
|
+
output: string | null;
|
|
76
|
+
/**
|
|
77
|
+
* Priority
|
|
78
|
+
* @description Indicates if the run was treated as a priority execution.
|
|
79
|
+
*/
|
|
80
|
+
priority: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Run Id
|
|
83
|
+
* @description Unique identifier for the agent run.
|
|
84
|
+
*/
|
|
85
|
+
run_id: string;
|
|
86
|
+
/** @description Current status of the agent run. */
|
|
87
|
+
status: components["schemas"]["PendingProcessingCompletedFailedStatus"];
|
|
88
|
+
};
|
|
89
|
+
/** Body_upload_file_to_source_api_sources__source_connection_id__upload_post */
|
|
90
|
+
Body_upload_file_to_source_api_sources__source_connection_id__upload_post: {
|
|
91
|
+
/**
|
|
92
|
+
* File
|
|
93
|
+
* Format: binary
|
|
94
|
+
* @description File to upload
|
|
95
|
+
*/
|
|
96
|
+
file: string;
|
|
97
|
+
/**
|
|
98
|
+
* Title
|
|
99
|
+
* @description Optional title for the content
|
|
100
|
+
*/
|
|
101
|
+
title?: string;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* ContentEmbeddingResponse
|
|
105
|
+
* @description Response model for content embedding.
|
|
106
|
+
*/
|
|
107
|
+
ContentEmbeddingResponse: {
|
|
108
|
+
/** Batch Duration */
|
|
109
|
+
batch_duration: number;
|
|
110
|
+
/** Batch Size */
|
|
111
|
+
batch_size: number;
|
|
112
|
+
/** Id */
|
|
113
|
+
id: string;
|
|
114
|
+
/** Text */
|
|
115
|
+
text: string;
|
|
116
|
+
/** Text End */
|
|
117
|
+
text_end: number;
|
|
118
|
+
/** Text Start */
|
|
119
|
+
text_start: number;
|
|
120
|
+
/** Vector */
|
|
121
|
+
vector: number[];
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* FileUploadResponse
|
|
125
|
+
* @description Response model for file upload
|
|
126
|
+
*/
|
|
127
|
+
FileUploadResponse: {
|
|
128
|
+
/**
|
|
129
|
+
* Content Version Id
|
|
130
|
+
* @description ID of the created content version
|
|
131
|
+
*/
|
|
132
|
+
content_version_id: string | null;
|
|
133
|
+
/**
|
|
134
|
+
* Filename
|
|
135
|
+
* @description Original filename
|
|
136
|
+
*/
|
|
137
|
+
filename: string;
|
|
138
|
+
/**
|
|
139
|
+
* Source Connection Content Version Id
|
|
140
|
+
* @description ID of the duplicate source connection content version
|
|
141
|
+
*/
|
|
142
|
+
source_connection_content_version_id: string | null;
|
|
143
|
+
/**
|
|
144
|
+
* Status
|
|
145
|
+
* @description Processing status
|
|
146
|
+
*/
|
|
147
|
+
status: string;
|
|
148
|
+
};
|
|
149
|
+
/** HTTPValidationError */
|
|
150
|
+
HTTPValidationError: {
|
|
151
|
+
/** Detail */
|
|
152
|
+
detail?: components["schemas"]["ValidationError"][];
|
|
153
|
+
};
|
|
154
|
+
JsonValue: unknown;
|
|
155
|
+
/**
|
|
156
|
+
* PaginationResponse
|
|
157
|
+
* @description Pagination information.
|
|
158
|
+
*/
|
|
159
|
+
PaginationResponse: {
|
|
160
|
+
/** Has Next */
|
|
161
|
+
has_next: boolean;
|
|
162
|
+
/** Has Prev */
|
|
163
|
+
has_prev: boolean;
|
|
164
|
+
/** Limit */
|
|
165
|
+
limit: number;
|
|
166
|
+
/** Page */
|
|
167
|
+
page: number;
|
|
168
|
+
/** Pages */
|
|
169
|
+
pages: number;
|
|
170
|
+
/** Total */
|
|
171
|
+
total: number;
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* PendingProcessingCompletedFailedStatus
|
|
175
|
+
* @enum {string}
|
|
176
|
+
*/
|
|
177
|
+
PendingProcessingCompletedFailedStatus: "pending" | "processing" | "completed" | "failed";
|
|
178
|
+
/**
|
|
179
|
+
* SourceResponse
|
|
180
|
+
* @description Response model for source data.
|
|
181
|
+
*/
|
|
182
|
+
SourceResponse: {
|
|
183
|
+
/**
|
|
184
|
+
* Account Id
|
|
185
|
+
* Format: uuid
|
|
186
|
+
* @description Account ID associated with the source.
|
|
187
|
+
*/
|
|
188
|
+
account_id: string;
|
|
189
|
+
/**
|
|
190
|
+
* Avg Episodes Per Month
|
|
191
|
+
* @description Average number of episodes per month.
|
|
192
|
+
*/
|
|
193
|
+
avg_episodes_per_month?: number | null;
|
|
194
|
+
/**
|
|
195
|
+
* Avg Words Per Episode
|
|
196
|
+
* @description Average number of words per episode.
|
|
197
|
+
*/
|
|
198
|
+
avg_words_per_episode?: number | null;
|
|
199
|
+
/**
|
|
200
|
+
* Chunk Language
|
|
201
|
+
* @description Language used for chunking content.
|
|
202
|
+
*/
|
|
203
|
+
chunk_language?: string | null;
|
|
204
|
+
/**
|
|
205
|
+
* Chunk Overlap
|
|
206
|
+
* @description Chunk overlap for content processing.
|
|
207
|
+
*/
|
|
208
|
+
chunk_overlap?: number | null;
|
|
209
|
+
/**
|
|
210
|
+
* Chunk Regex Separators
|
|
211
|
+
* @description Indicates if chunk separators are regex patterns.
|
|
212
|
+
*/
|
|
213
|
+
chunk_regex_separators?: boolean | null;
|
|
214
|
+
/**
|
|
215
|
+
* Chunk Separators
|
|
216
|
+
* @description Chunk separators used for content processing.
|
|
217
|
+
*/
|
|
218
|
+
chunk_separators?: string | null;
|
|
219
|
+
/**
|
|
220
|
+
* Chunk Size
|
|
221
|
+
* @description Chunk size for content processing.
|
|
222
|
+
*/
|
|
223
|
+
chunk_size?: number | null;
|
|
224
|
+
/**
|
|
225
|
+
* Content Count
|
|
226
|
+
* @description Number of content items associated with the source connection.
|
|
227
|
+
* @default 0
|
|
228
|
+
*/
|
|
229
|
+
content_count: number;
|
|
230
|
+
/**
|
|
231
|
+
* Content Filter
|
|
232
|
+
* @description Content filter for the source connection.
|
|
233
|
+
*/
|
|
234
|
+
content_filter: string;
|
|
235
|
+
/**
|
|
236
|
+
* Created At
|
|
237
|
+
* @description Timestamp when the source connection was created.
|
|
238
|
+
*/
|
|
239
|
+
created_at: string;
|
|
240
|
+
/**
|
|
241
|
+
* Dimensions
|
|
242
|
+
* @description Dimensions of the embedding model.
|
|
243
|
+
*/
|
|
244
|
+
dimensions?: number | null;
|
|
245
|
+
/**
|
|
246
|
+
* Embedding Model
|
|
247
|
+
* @description Embedding model used for the source connection.
|
|
248
|
+
*/
|
|
249
|
+
embedding_model?: string | null;
|
|
250
|
+
/**
|
|
251
|
+
* Embedding Model Type
|
|
252
|
+
* @description Type of the embedding model.
|
|
253
|
+
*/
|
|
254
|
+
embedding_model_type?: string | null;
|
|
255
|
+
/**
|
|
256
|
+
* Has Historical Data
|
|
257
|
+
* @description Indicates if the source connection has historical data.
|
|
258
|
+
* @default false
|
|
259
|
+
*/
|
|
260
|
+
has_historical_data: boolean;
|
|
261
|
+
/**
|
|
262
|
+
* Id
|
|
263
|
+
* @description Unique identifier for the source connection.
|
|
264
|
+
*/
|
|
265
|
+
id: string;
|
|
266
|
+
/**
|
|
267
|
+
* Name
|
|
268
|
+
* @description Name of the source connection.
|
|
269
|
+
*/
|
|
270
|
+
name: string;
|
|
271
|
+
/**
|
|
272
|
+
* Next Poll At
|
|
273
|
+
* @description Timestamp for the next scheduled poll.
|
|
274
|
+
*/
|
|
275
|
+
next_poll_at: string | null;
|
|
276
|
+
/**
|
|
277
|
+
* Polling
|
|
278
|
+
* @description Polling configuration for the source connection.
|
|
279
|
+
*/
|
|
280
|
+
polling: string | null;
|
|
281
|
+
/**
|
|
282
|
+
* Polling Action
|
|
283
|
+
* @description Polling action for the source connection.
|
|
284
|
+
*/
|
|
285
|
+
polling_action: string | null;
|
|
286
|
+
/**
|
|
287
|
+
* Polling Max Items
|
|
288
|
+
* @description Maximum items to poll for the source connection.
|
|
289
|
+
*/
|
|
290
|
+
polling_max_items: number | null;
|
|
291
|
+
/**
|
|
292
|
+
* Pulled At
|
|
293
|
+
* @description Timestamp when content was last pulled.
|
|
294
|
+
*/
|
|
295
|
+
pulled_at: string | null;
|
|
296
|
+
/**
|
|
297
|
+
* Readonly
|
|
298
|
+
* @description Indicates if the source connection is read-only.
|
|
299
|
+
* @default false
|
|
300
|
+
*/
|
|
301
|
+
readonly: boolean;
|
|
302
|
+
/**
|
|
303
|
+
* Retention
|
|
304
|
+
* @description Retention period for the source connection.
|
|
305
|
+
*/
|
|
306
|
+
retention: number | null;
|
|
307
|
+
/**
|
|
308
|
+
* Source Type
|
|
309
|
+
* @description Type of the source connection.
|
|
310
|
+
*/
|
|
311
|
+
source_type: string;
|
|
312
|
+
/**
|
|
313
|
+
* Updated At
|
|
314
|
+
* @description Timestamp when the source connection was last updated.
|
|
315
|
+
*/
|
|
316
|
+
updated_at: string;
|
|
317
|
+
/**
|
|
318
|
+
* Url
|
|
319
|
+
* @description URL of the source connection.
|
|
320
|
+
*/
|
|
321
|
+
url: string | null;
|
|
322
|
+
};
|
|
323
|
+
/** ValidationError */
|
|
324
|
+
ValidationError: {
|
|
325
|
+
/** Location */
|
|
326
|
+
loc: (string | number)[];
|
|
327
|
+
/** Message */
|
|
328
|
+
msg: string;
|
|
329
|
+
/** Error Type */
|
|
330
|
+
type: string;
|
|
331
|
+
};
|
|
332
|
+
/** AgentRunListResponse */
|
|
333
|
+
routers__api__agents__AgentRunListResponse: {
|
|
334
|
+
/**
|
|
335
|
+
* Data
|
|
336
|
+
* @description List of agent runs.
|
|
337
|
+
*/
|
|
338
|
+
data: components["schemas"]["AgentRunResponse"][];
|
|
339
|
+
pagination: components["schemas"]["PaginationResponse"];
|
|
340
|
+
};
|
|
341
|
+
/**
|
|
342
|
+
* ContentDetailResponse
|
|
343
|
+
* @description Response model for content detail.
|
|
344
|
+
*/
|
|
345
|
+
routers__api__contents__ContentDetailResponse: {
|
|
346
|
+
/**
|
|
347
|
+
* Content Duration
|
|
348
|
+
* @description Duration of the content in seconds.
|
|
349
|
+
*/
|
|
350
|
+
content_duration: number | null;
|
|
351
|
+
/**
|
|
352
|
+
* Content Duration Display
|
|
353
|
+
* @description Display string for content duration.
|
|
354
|
+
*/
|
|
355
|
+
content_duration_display: string | null;
|
|
356
|
+
/**
|
|
357
|
+
* Content Status
|
|
358
|
+
* @description Status of the content.
|
|
359
|
+
*/
|
|
360
|
+
content_status: string;
|
|
361
|
+
/**
|
|
362
|
+
* Content Type
|
|
363
|
+
* @description Type of the content.
|
|
364
|
+
*/
|
|
365
|
+
content_type: string;
|
|
366
|
+
/**
|
|
367
|
+
* Content Type Display
|
|
368
|
+
* @description Display name of the content type.
|
|
369
|
+
*/
|
|
370
|
+
content_type_display: string;
|
|
371
|
+
/**
|
|
372
|
+
* Content Url
|
|
373
|
+
* @description URL of the content.
|
|
374
|
+
*/
|
|
375
|
+
content_url: string;
|
|
376
|
+
/**
|
|
377
|
+
* Content Word Count
|
|
378
|
+
* @description Word count of the content.
|
|
379
|
+
*/
|
|
380
|
+
content_word_count: number | null;
|
|
381
|
+
/**
|
|
382
|
+
* Description
|
|
383
|
+
* @description Description of the content.
|
|
384
|
+
*/
|
|
385
|
+
description: string | null;
|
|
386
|
+
/**
|
|
387
|
+
* Error
|
|
388
|
+
* @description Error message, if any.
|
|
389
|
+
*/
|
|
390
|
+
error: string | null;
|
|
391
|
+
/**
|
|
392
|
+
* Id
|
|
393
|
+
* @description Unique identifier for the content version.
|
|
394
|
+
*/
|
|
395
|
+
id: string;
|
|
396
|
+
/**
|
|
397
|
+
* Metadata
|
|
398
|
+
* @description Metadata associated with the content.
|
|
399
|
+
*/
|
|
400
|
+
metadata: {
|
|
401
|
+
[key: string]: string;
|
|
402
|
+
}[] | null;
|
|
403
|
+
/**
|
|
404
|
+
* Published At
|
|
405
|
+
* @description Timestamp when the content was published.
|
|
406
|
+
*/
|
|
407
|
+
published_at: string | null;
|
|
408
|
+
/**
|
|
409
|
+
* Pulled At
|
|
410
|
+
* @description Timestamp when the content was pulled.
|
|
411
|
+
*/
|
|
412
|
+
pulled_at: string;
|
|
413
|
+
/**
|
|
414
|
+
* Source Connection Content Version Id
|
|
415
|
+
* @description ID of the source connection content version.
|
|
416
|
+
*/
|
|
417
|
+
source_connection_content_version_id: string;
|
|
418
|
+
/**
|
|
419
|
+
* Source Connection Id
|
|
420
|
+
* @description ID of the source connection.
|
|
421
|
+
*/
|
|
422
|
+
source_connection_id: string;
|
|
423
|
+
/**
|
|
424
|
+
* Source Name
|
|
425
|
+
* @description Name of the source.
|
|
426
|
+
*/
|
|
427
|
+
source_name: string;
|
|
428
|
+
/**
|
|
429
|
+
* Source Type
|
|
430
|
+
* @description Type of the source.
|
|
431
|
+
*/
|
|
432
|
+
source_type: string;
|
|
433
|
+
/**
|
|
434
|
+
* Text Content
|
|
435
|
+
* @description Text content.
|
|
436
|
+
*/
|
|
437
|
+
text_content: string | null;
|
|
438
|
+
/**
|
|
439
|
+
* Text Content End
|
|
440
|
+
* @description End position of the text content.
|
|
441
|
+
*/
|
|
442
|
+
text_content_end: number;
|
|
443
|
+
/**
|
|
444
|
+
* Text Content Start
|
|
445
|
+
* @description Start position of the text content.
|
|
446
|
+
*/
|
|
447
|
+
text_content_start: number;
|
|
448
|
+
/**
|
|
449
|
+
* Text Content Total Length
|
|
450
|
+
* @description Total length of the text content.
|
|
451
|
+
*/
|
|
452
|
+
text_content_total_length: number;
|
|
453
|
+
/**
|
|
454
|
+
* Title
|
|
455
|
+
* @description Title of the content.
|
|
456
|
+
*/
|
|
457
|
+
title: string | null;
|
|
458
|
+
};
|
|
459
|
+
/**
|
|
460
|
+
* ContentEmbeddingsListResponse
|
|
461
|
+
* @description Response model for paginated content embeddings.
|
|
462
|
+
*/
|
|
463
|
+
routers__api__contents__ContentEmbeddingsListResponse: {
|
|
464
|
+
/** Data */
|
|
465
|
+
data: components["schemas"]["ContentEmbeddingResponse"][];
|
|
466
|
+
pagination: components["schemas"]["PaginationResponse"];
|
|
467
|
+
};
|
|
468
|
+
/**
|
|
469
|
+
* SourceListResponse
|
|
470
|
+
* @description Response model for paginated source list
|
|
471
|
+
*/
|
|
472
|
+
routers__api__sources__SourceListResponse: {
|
|
473
|
+
/** Data */
|
|
474
|
+
data: components["schemas"]["SourceResponse"][];
|
|
475
|
+
pagination: components["schemas"]["PaginationResponse"];
|
|
476
|
+
};
|
|
477
|
+
};
|
|
478
|
+
responses: never;
|
|
479
|
+
parameters: never;
|
|
480
|
+
requestBodies: never;
|
|
481
|
+
headers: never;
|
|
482
|
+
pathItems: never;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/** JSON-serializable values accepted/returned by the SDK's low-level `request()` method. */
|
|
486
|
+
type JSONValue = {
|
|
487
|
+
[key: string]: JSONValue;
|
|
488
|
+
} | JSONValue[] | string | number | boolean | null;
|
|
489
|
+
/** Request body for starting an agent run. */
|
|
490
|
+
type AgentRunRequest = components["schemas"]["AgentRunRequest"];
|
|
491
|
+
/** Response body describing an agent run. */
|
|
492
|
+
type AgentRunResponse = components["schemas"]["AgentRunResponse"];
|
|
493
|
+
/** Paginated list response for agent runs. */
|
|
494
|
+
type AgentRunListResponse = components["schemas"]["routers__api__agents__AgentRunListResponse"];
|
|
495
|
+
/** Content detail response for a specific content version. */
|
|
496
|
+
type ContentDetailResponse = components["schemas"]["routers__api__contents__ContentDetailResponse"];
|
|
497
|
+
/** Paginated list response for embeddings. */
|
|
498
|
+
type ContentEmbeddingsListResponse = components["schemas"]["routers__api__contents__ContentEmbeddingsListResponse"];
|
|
499
|
+
/** Paginated list response for sources. */
|
|
500
|
+
type SourceListResponse = components["schemas"]["routers__api__sources__SourceListResponse"];
|
|
501
|
+
/** Upload response for source uploads. */
|
|
502
|
+
type FileUploadResponse = components["schemas"]["FileUploadResponse"];
|
|
503
|
+
/** Standard OpenAPI validation error shape (typically HTTP 422). */
|
|
504
|
+
type HTTPValidationError = components["schemas"]["HTTPValidationError"];
|
|
505
|
+
|
|
506
|
+
/** Default API base URL (can be overridden with `baseUrl` or `SECLAI_API_URL`). */
|
|
507
|
+
declare const SECLAI_API_URL = "https://seclai.com";
|
|
508
|
+
/** A `fetch`-compatible function (e.g. `globalThis.fetch` or `undici.fetch`). */
|
|
509
|
+
type FetchLike = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
510
|
+
/** Configuration for the {@link Seclai} client. */
|
|
511
|
+
interface SeclaiOptions {
|
|
512
|
+
/** API key used for authentication. Defaults to `process.env.SECLAI_API_KEY` when available. */
|
|
513
|
+
apiKey?: string;
|
|
514
|
+
/** API base URL. Defaults to `process.env.SECLAI_API_URL` when available, else {@link SECLAI_API_URL}. */
|
|
515
|
+
baseUrl?: string;
|
|
516
|
+
/** Header name to use for the API key. Defaults to `x-api-key`. */
|
|
517
|
+
apiKeyHeader?: string;
|
|
518
|
+
/** Extra headers to include on every request. */
|
|
519
|
+
defaultHeaders?: Record<string, string>;
|
|
520
|
+
/** Optional `fetch` implementation for environments without a global `fetch`. */
|
|
521
|
+
fetch?: FetchLike;
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Seclai JavaScript/TypeScript client.
|
|
525
|
+
*
|
|
526
|
+
* @remarks
|
|
527
|
+
* - Uses API key auth via `x-api-key` by default.
|
|
528
|
+
* - Throws SDK exceptions for non-success responses.
|
|
529
|
+
*/
|
|
530
|
+
declare class Seclai {
|
|
531
|
+
private readonly apiKey;
|
|
532
|
+
private readonly baseUrl;
|
|
533
|
+
private readonly apiKeyHeader;
|
|
534
|
+
private readonly defaultHeaders;
|
|
535
|
+
private readonly fetcher;
|
|
536
|
+
/**
|
|
537
|
+
* Create a new Seclai client.
|
|
538
|
+
*
|
|
539
|
+
* @param opts - Client configuration.
|
|
540
|
+
* @throws {@link SeclaiConfigurationError} If no API key is provided (and `SECLAI_API_KEY` is not set).
|
|
541
|
+
* @throws {@link SeclaiConfigurationError} If no `fetch` implementation is available.
|
|
542
|
+
*/
|
|
543
|
+
constructor(opts?: SeclaiOptions);
|
|
544
|
+
/**
|
|
545
|
+
* Make a raw HTTP request to the Seclai API.
|
|
546
|
+
*
|
|
547
|
+
* This is a low-level escape hatch. For most operations, prefer the typed convenience methods.
|
|
548
|
+
*
|
|
549
|
+
* @param method - HTTP method (e.g. `"GET"`, `"POST"`).
|
|
550
|
+
* @param path - Request path relative to `baseUrl` (e.g. `"/api/sources/"`).
|
|
551
|
+
* @param opts - Query params, JSON body, and per-request headers.
|
|
552
|
+
* @returns Parsed JSON for JSON responses, raw text for non-JSON responses, or `null` for empty bodies.
|
|
553
|
+
* @throws {@link SeclaiAPIValidationError} For validation errors (typically HTTP 422).
|
|
554
|
+
* @throws {@link SeclaiAPIStatusError} For other non-success HTTP status codes.
|
|
555
|
+
*/
|
|
556
|
+
request(method: string, path: string, opts?: {
|
|
557
|
+
query?: Record<string, unknown>;
|
|
558
|
+
json?: unknown;
|
|
559
|
+
headers?: Record<string, string>;
|
|
560
|
+
}): Promise<unknown | string | null>;
|
|
561
|
+
/**
|
|
562
|
+
* Run an agent.
|
|
563
|
+
*
|
|
564
|
+
* @param agentId - Agent identifier.
|
|
565
|
+
* @param body - Agent run request payload.
|
|
566
|
+
* @returns The created agent run.
|
|
567
|
+
*/
|
|
568
|
+
runAgent(agentId: string, body: AgentRunRequest): Promise<AgentRunResponse>;
|
|
569
|
+
/**
|
|
570
|
+
* List agent runs for an agent.
|
|
571
|
+
*
|
|
572
|
+
* @param agentId - Agent identifier.
|
|
573
|
+
* @param opts - Pagination options.
|
|
574
|
+
* @returns A paginated list of runs.
|
|
575
|
+
*/
|
|
576
|
+
listAgentRuns(agentId: string, opts?: {
|
|
577
|
+
page?: number;
|
|
578
|
+
limit?: number;
|
|
579
|
+
}): Promise<AgentRunListResponse>;
|
|
580
|
+
/**
|
|
581
|
+
* Get details of a specific agent run.
|
|
582
|
+
*
|
|
583
|
+
* @param agentId - Agent identifier.
|
|
584
|
+
* @param runId - Run identifier.
|
|
585
|
+
* @returns Agent run details.
|
|
586
|
+
*/
|
|
587
|
+
getAgentRun(agentId: string, runId: string): Promise<AgentRunResponse>;
|
|
588
|
+
/**
|
|
589
|
+
* Cancel an agent run.
|
|
590
|
+
*
|
|
591
|
+
* @param agentId - Agent identifier.
|
|
592
|
+
* @param runId - Run identifier.
|
|
593
|
+
* @returns Updated agent run record.
|
|
594
|
+
*/
|
|
595
|
+
deleteAgentRun(agentId: string, runId: string): Promise<AgentRunResponse>;
|
|
596
|
+
/**
|
|
597
|
+
* Get content detail.
|
|
598
|
+
*
|
|
599
|
+
* Fetches a slice of a content version (use `start`/`end` to page through large content).
|
|
600
|
+
*
|
|
601
|
+
* @param sourceConnectionContentVersion - Content version identifier.
|
|
602
|
+
* @param opts - Range options.
|
|
603
|
+
* @returns Content details for the requested range.
|
|
604
|
+
*/
|
|
605
|
+
getContentDetail(sourceConnectionContentVersion: string, opts?: {
|
|
606
|
+
start?: number;
|
|
607
|
+
end?: number;
|
|
608
|
+
}): Promise<ContentDetailResponse>;
|
|
609
|
+
/**
|
|
610
|
+
* Delete a specific content version.
|
|
611
|
+
*
|
|
612
|
+
* @param sourceConnectionContentVersion - Content version identifier.
|
|
613
|
+
*/
|
|
614
|
+
deleteContent(sourceConnectionContentVersion: string): Promise<void>;
|
|
615
|
+
/**
|
|
616
|
+
* List embeddings for a content version.
|
|
617
|
+
*
|
|
618
|
+
* @param sourceConnectionContentVersion - Content version identifier.
|
|
619
|
+
* @param opts - Pagination options.
|
|
620
|
+
* @returns A paginated list of embeddings.
|
|
621
|
+
*/
|
|
622
|
+
listContentEmbeddings(sourceConnectionContentVersion: string, opts?: {
|
|
623
|
+
page?: number;
|
|
624
|
+
limit?: number;
|
|
625
|
+
}): Promise<ContentEmbeddingsListResponse>;
|
|
626
|
+
/**
|
|
627
|
+
* List sources.
|
|
628
|
+
*
|
|
629
|
+
* @param opts - Pagination and filter options.
|
|
630
|
+
* @returns A paginated list of sources.
|
|
631
|
+
*/
|
|
632
|
+
listSources(opts?: {
|
|
633
|
+
page?: number;
|
|
634
|
+
limit?: number;
|
|
635
|
+
sort?: string;
|
|
636
|
+
order?: "asc" | "desc";
|
|
637
|
+
accountId?: string | null;
|
|
638
|
+
}): Promise<SourceListResponse>;
|
|
639
|
+
/**
|
|
640
|
+
* Upload a file to a specific source connection.
|
|
641
|
+
*
|
|
642
|
+
* @param sourceConnectionId - Source connection identifier.
|
|
643
|
+
* @param opts - File payload and optional metadata.
|
|
644
|
+
* @param opts.file - File payload as a `Blob`, `Uint8Array`, or `ArrayBuffer`.
|
|
645
|
+
* @param opts.title - Optional title for the uploaded file.
|
|
646
|
+
* @param opts.fileName - Optional filename to send with the upload.
|
|
647
|
+
* @param opts.mimeType - Optional MIME type to attach to the upload.
|
|
648
|
+
* @returns Upload response details.
|
|
649
|
+
*/
|
|
650
|
+
uploadFileToSource(sourceConnectionId: string, opts: {
|
|
651
|
+
file: Blob | Uint8Array | ArrayBuffer;
|
|
652
|
+
title?: string;
|
|
653
|
+
fileName?: string;
|
|
654
|
+
mimeType?: string;
|
|
655
|
+
}): Promise<FileUploadResponse>;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
/** Base error class for the Seclai SDK. */
|
|
659
|
+
declare class SeclaiError extends Error {
|
|
660
|
+
constructor(message: string);
|
|
661
|
+
}
|
|
662
|
+
/** Thrown when the SDK is misconfigured (for example, missing API key). */
|
|
663
|
+
declare class SeclaiConfigurationError extends SeclaiError {
|
|
664
|
+
constructor(message: string);
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Thrown when the API returns a non-success status code.
|
|
668
|
+
*
|
|
669
|
+
* @remarks
|
|
670
|
+
* Use {@link SeclaiAPIValidationError} for HTTP 422 validation errors.
|
|
671
|
+
*/
|
|
672
|
+
declare class SeclaiAPIStatusError extends SeclaiError {
|
|
673
|
+
/** HTTP status code returned by the API. */
|
|
674
|
+
readonly statusCode: number;
|
|
675
|
+
/** HTTP method used for the request. */
|
|
676
|
+
readonly method: string;
|
|
677
|
+
/** Full request URL. */
|
|
678
|
+
readonly url: string;
|
|
679
|
+
/** Best-effort response body text (if available). */
|
|
680
|
+
readonly responseText: string | undefined;
|
|
681
|
+
constructor(opts: {
|
|
682
|
+
/** Human-readable error message. */
|
|
683
|
+
message: string;
|
|
684
|
+
statusCode: number;
|
|
685
|
+
method: string;
|
|
686
|
+
url: string;
|
|
687
|
+
responseText: string | undefined;
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Thrown when the API returns a validation error response (typically HTTP 422).
|
|
692
|
+
*
|
|
693
|
+
* The `validationError` field contains the decoded validation payload when available.
|
|
694
|
+
*/
|
|
695
|
+
declare class SeclaiAPIValidationError extends SeclaiAPIStatusError {
|
|
696
|
+
/** Parsed validation error payload (best-effort). */
|
|
697
|
+
readonly validationError: unknown;
|
|
698
|
+
constructor(opts: {
|
|
699
|
+
message: string;
|
|
700
|
+
statusCode: number;
|
|
701
|
+
method: string;
|
|
702
|
+
url: string;
|
|
703
|
+
responseText: string | undefined;
|
|
704
|
+
validationError: unknown;
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
export { type AgentRunListResponse, type AgentRunRequest, type AgentRunResponse, type ContentDetailResponse, type ContentEmbeddingsListResponse, type FetchLike, type FileUploadResponse, type HTTPValidationError, type JSONValue, SECLAI_API_URL, Seclai, SeclaiAPIStatusError, SeclaiAPIValidationError, SeclaiConfigurationError, SeclaiError, type SeclaiOptions, type SourceListResponse };
|