@fencyai/js 0.1.107 → 0.1.109
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/lib/api/createAgentTask.d.ts +2 -1
- package/lib/api/createAgentTask.js +4 -4
- package/lib/api/createFileDownloadLink.d.ts +2 -1
- package/lib/api/createFileDownloadLink.js +6 -4
- package/lib/api/createStream.d.ts +1 -1
- package/lib/api/createStream.js +20 -4
- package/lib/index.d.ts +6 -5
- package/lib/index.js +2 -3
- package/lib/loadFency.d.ts +2 -1
- package/lib/openapi/ct/core/ApiError.d.ts +10 -0
- package/lib/openapi/ct/core/ApiError.js +11 -0
- package/lib/openapi/ct/core/ApiRequestOptions.d.ts +13 -0
- package/lib/openapi/ct/core/ApiResult.d.ts +7 -0
- package/lib/openapi/ct/core/CancelablePromise.d.ts +20 -0
- package/lib/openapi/ct/core/CancelablePromise.js +111 -0
- package/lib/openapi/ct/core/OpenAPI.d.ts +16 -0
- package/lib/openapi/ct/core/OpenAPI.js +11 -0
- package/lib/openapi/ct/core/request.d.ts +30 -0
- package/lib/openapi/ct/core/request.js +275 -0
- package/lib/openapi/ct/index.d.ts +12 -0
- package/lib/openapi/{index.js → ct/index.js} +0 -1
- package/lib/openapi/{models → ct/models}/StreamDto.d.ts +1 -0
- package/lib/openapi/ct/models/StreamEventType.d.ts +6 -0
- package/lib/openapi/ct/models/StreamEventType.js +11 -0
- package/lib/openapi/ct/services/PubService.d.ts +19 -0
- package/lib/openapi/ct/services/PubService.js +26 -0
- package/lib/openapi/ct-st/index.d.ts +9 -0
- package/lib/openapi/ct-st/index.js +9 -0
- package/lib/openapi/{models → ct-st/models}/PubCreateAgentTaskRequest.d.ts +0 -1
- package/lib/openapi/ct-st/services/PubService.d.ts +20 -0
- package/lib/openapi/ct-st/services/PubService.js +33 -0
- package/lib/types/AgentTask.d.ts +1 -1
- package/lib/types/Stream.d.ts +1 -0
- package/lib/types/index.d.ts +1 -22
- package/lib/types/index.js +1 -2
- package/lib/utils/version.js +1 -1
- package/package.json +3 -3
- package/lib/api/listMemoryTypes.d.ts +0 -6
- package/lib/api/listMemoryTypes.js +0 -28
- package/lib/api/searchMemories.d.ts +0 -8
- package/lib/api/searchMemories.js +0 -27
- package/lib/openapi/index.d.ts +0 -27
- package/lib/openapi/models/ChatCompletionStreamCompletedEventDto.d.ts +0 -7
- package/lib/openapi/models/FileSearchIndexReadyEventDto.d.ts +0 -7
- package/lib/openapi/models/FileTextContentReadyEventDto.d.ts +0 -8
- package/lib/openapi/models/FileTextContentReadyEventDto.js +0 -1
- package/lib/openapi/models/FileUploadCompletedEventDto.d.ts +0 -7
- package/lib/openapi/models/FileUploadCompletedEventDto.js +0 -1
- package/lib/openapi/models/ListMemoryTypesResponse.d.ts +0 -6
- package/lib/openapi/models/ListMemoryTypesResponse.js +0 -1
- package/lib/openapi/models/NewChatCompletionStreamChunkEventDto.d.ts +0 -8
- package/lib/openapi/models/NewChatCompletionStreamChunkEventDto.js +0 -1
- package/lib/openapi/models/PaginationDto.d.ts +0 -4
- package/lib/openapi/models/PaginationDto.js +0 -1
- package/lib/openapi/models/PubMemoryDto.d.ts +0 -5
- package/lib/openapi/models/PubMemoryDto.js +0 -1
- package/lib/openapi/models/PubMemoryTypeDto.d.ts +0 -5
- package/lib/openapi/models/PubMemoryTypeDto.js +0 -1
- package/lib/openapi/models/PubSearchMemoriesRequest.d.ts +0 -4
- package/lib/openapi/models/PubSearchMemoriesRequest.js +0 -1
- package/lib/openapi/models/PubSearchMemoriesResponse.d.ts +0 -4
- package/lib/openapi/models/PubSearchMemoriesResponse.js +0 -1
- package/lib/openapi/models/StreamEventType.d.ts +0 -12
- package/lib/openapi/models/StreamEventType.js +0 -17
- package/lib/openapi/services/PubService.d.ts +0 -63
- package/lib/openapi/services/PubService.js +0 -96
- package/lib/types/AnthropicModel.d.ts +0 -1
- package/lib/types/AnthropicModel.js +0 -1
- package/lib/types/ChatCompletion.d.ts +0 -8
- package/lib/types/ChatCompletion.js +0 -7
- package/lib/types/ChatCompletionMessage.d.ts +0 -4
- package/lib/types/ChatCompletionMessage.js +0 -1
- package/lib/types/ClaudeChatCompletionMessage.d.ts +0 -4
- package/lib/types/ClaudeChatCompletionMessage.js +0 -1
- package/lib/types/CreateChatCompletionRequest.d.ts +0 -10
- package/lib/types/CreateChatCompletionRequest.js +0 -1
- package/lib/types/CreateChatCompletionResponse.d.ts +0 -9
- package/lib/types/CreateChatCompletionResponse.js +0 -1
- package/lib/types/CreateClaudeChatCompletionRequestParams.d.ts +0 -10
- package/lib/types/CreateClaudeChatCompletionRequestParams.js +0 -1
- package/lib/types/CreateGeminiChatCompletionRequestParams.d.ts +0 -11
- package/lib/types/CreateGeminiChatCompletionRequestParams.js +0 -1
- package/lib/types/CreateOpenAiChatCompletionRequestParams.d.ts +0 -9
- package/lib/types/CreateOpenAiChatCompletionRequestParams.js +0 -1
- package/lib/types/GeminiChatCompletionMessage.d.ts +0 -4
- package/lib/types/GeminiChatCompletionMessage.js +0 -1
- package/lib/types/GeminiModel.d.ts +0 -1
- package/lib/types/GeminiModel.js +0 -1
- package/lib/types/ListMemoryTypesResponse.d.ts +0 -10
- package/lib/types/ListMemoryTypesResponse.js +0 -1
- package/lib/types/OpenAiModel.d.ts +0 -1
- package/lib/types/OpenAiModel.js +0 -1
- package/lib/types/SearchMemoriesRequest.d.ts +0 -4
- package/lib/types/SearchMemoriesRequest.js +0 -1
- package/lib/types/SearchMemoriesResponse.d.ts +0 -9
- package/lib/types/SearchMemoriesResponse.js +0 -1
- /package/lib/openapi/{models/AgentTaskProgressItemUpdatedEventDto.js → ct/core/ApiRequestOptions.js} +0 -0
- /package/lib/openapi/{models/ChatCompletionStreamCompletedEventDto.js → ct/core/ApiResult.js} +0 -0
- /package/lib/openapi/{models → ct/models}/AgentTaskProgressItemType.d.ts +0 -0
- /package/lib/openapi/{models → ct/models}/AgentTaskProgressItemType.js +0 -0
- /package/lib/openapi/{models → ct/models}/AgentTaskProgressItemUpdatedEventDto.d.ts +0 -0
- /package/lib/openapi/{models/FileSearchIndexReadyEventDto.js → ct/models/AgentTaskProgressItemUpdatedEventDto.js} +0 -0
- /package/lib/openapi/{models → ct/models}/ApiDtoType.d.ts +0 -0
- /package/lib/openapi/{models → ct/models}/ApiDtoType.js +0 -0
- /package/lib/openapi/{models → ct/models}/StreamDto.js +0 -0
- /package/lib/openapi/{models → ct/models}/StreamNotFoundEventDto.d.ts +0 -0
- /package/lib/openapi/{models → ct/models}/StreamNotFoundEventDto.js +0 -0
- /package/lib/openapi/{models → ct/models}/StreamTimeoutEventDto.d.ts +0 -0
- /package/lib/openapi/{models → ct/models}/StreamTimeoutEventDto.js +0 -0
- /package/lib/openapi/{core → ct-st/core}/ApiError.d.ts +0 -0
- /package/lib/openapi/{core → ct-st/core}/ApiError.js +0 -0
- /package/lib/openapi/{core → ct-st/core}/ApiRequestOptions.d.ts +0 -0
- /package/lib/openapi/{core → ct-st/core}/ApiRequestOptions.js +0 -0
- /package/lib/openapi/{core → ct-st/core}/ApiResult.d.ts +0 -0
- /package/lib/openapi/{core → ct-st/core}/ApiResult.js +0 -0
- /package/lib/openapi/{core → ct-st/core}/CancelablePromise.d.ts +0 -0
- /package/lib/openapi/{core → ct-st/core}/CancelablePromise.js +0 -0
- /package/lib/openapi/{core → ct-st/core}/OpenAPI.d.ts +0 -0
- /package/lib/openapi/{core → ct-st/core}/OpenAPI.js +0 -0
- /package/lib/openapi/{core → ct-st/core}/request.d.ts +0 -0
- /package/lib/openapi/{core → ct-st/core}/request.js +0 -0
- /package/lib/openapi/{models → ct-st/models}/AgentTaskStatusDto.d.ts +0 -0
- /package/lib/openapi/{models → ct-st/models}/AgentTaskStatusDto.js +0 -0
- /package/lib/openapi/{models → ct-st/models}/PubAgentTaskDto.d.ts +0 -0
- /package/lib/openapi/{models → ct-st/models}/PubAgentTaskDto.js +0 -0
- /package/lib/openapi/{models → ct-st/models}/PubCreateAgentTaskRequest.js +0 -0
- /package/lib/openapi/{models → ct-st/models}/PubCreateFileDownloadLinkResponse.d.ts +0 -0
- /package/lib/openapi/{models → ct-st/models}/PubCreateFileDownloadLinkResponse.js +0 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
import { ApiError } from './ApiError';
|
|
6
|
+
import { CancelablePromise } from './CancelablePromise';
|
|
7
|
+
export const isDefined = (value) => {
|
|
8
|
+
return value !== undefined && value !== null;
|
|
9
|
+
};
|
|
10
|
+
export const isString = (value) => {
|
|
11
|
+
return typeof value === 'string';
|
|
12
|
+
};
|
|
13
|
+
export const isStringWithValue = (value) => {
|
|
14
|
+
return isString(value) && value !== '';
|
|
15
|
+
};
|
|
16
|
+
export const isBlob = (value) => {
|
|
17
|
+
return (typeof value === 'object' &&
|
|
18
|
+
typeof value.type === 'string' &&
|
|
19
|
+
typeof value.stream === 'function' &&
|
|
20
|
+
typeof value.arrayBuffer === 'function' &&
|
|
21
|
+
typeof value.constructor === 'function' &&
|
|
22
|
+
typeof value.constructor.name === 'string' &&
|
|
23
|
+
/^(Blob|File)$/.test(value.constructor.name) &&
|
|
24
|
+
/^(Blob|File)$/.test(value[Symbol.toStringTag]));
|
|
25
|
+
};
|
|
26
|
+
export const isFormData = (value) => {
|
|
27
|
+
return value instanceof FormData;
|
|
28
|
+
};
|
|
29
|
+
export const base64 = (str) => {
|
|
30
|
+
try {
|
|
31
|
+
return btoa(str);
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
return Buffer.from(str).toString('base64');
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
export const getQueryString = (params) => {
|
|
39
|
+
const qs = [];
|
|
40
|
+
const append = (key, value) => {
|
|
41
|
+
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
42
|
+
};
|
|
43
|
+
const process = (key, value) => {
|
|
44
|
+
if (isDefined(value)) {
|
|
45
|
+
if (Array.isArray(value)) {
|
|
46
|
+
value.forEach(v => {
|
|
47
|
+
process(key, v);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
else if (typeof value === 'object') {
|
|
51
|
+
Object.entries(value).forEach(([k, v]) => {
|
|
52
|
+
process(`${key}[${k}]`, v);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
append(key, value);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
61
|
+
process(key, value);
|
|
62
|
+
});
|
|
63
|
+
if (qs.length > 0) {
|
|
64
|
+
return `?${qs.join('&')}`;
|
|
65
|
+
}
|
|
66
|
+
return '';
|
|
67
|
+
};
|
|
68
|
+
const getUrl = (config, options) => {
|
|
69
|
+
const encoder = config.ENCODE_PATH || encodeURI;
|
|
70
|
+
const path = options.url
|
|
71
|
+
.replace('{api-version}', config.VERSION)
|
|
72
|
+
.replace(/{(.*?)}/g, (substring, group) => {
|
|
73
|
+
if (options.path?.hasOwnProperty(group)) {
|
|
74
|
+
return encoder(String(options.path[group]));
|
|
75
|
+
}
|
|
76
|
+
return substring;
|
|
77
|
+
});
|
|
78
|
+
const url = `${config.BASE}${path}`;
|
|
79
|
+
if (options.query) {
|
|
80
|
+
return `${url}${getQueryString(options.query)}`;
|
|
81
|
+
}
|
|
82
|
+
return url;
|
|
83
|
+
};
|
|
84
|
+
export const getFormData = (options) => {
|
|
85
|
+
if (options.formData) {
|
|
86
|
+
const formData = new FormData();
|
|
87
|
+
const process = (key, value) => {
|
|
88
|
+
if (isString(value) || isBlob(value)) {
|
|
89
|
+
formData.append(key, value);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
formData.append(key, JSON.stringify(value));
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
Object.entries(options.formData)
|
|
96
|
+
.filter(([_, value]) => isDefined(value))
|
|
97
|
+
.forEach(([key, value]) => {
|
|
98
|
+
if (Array.isArray(value)) {
|
|
99
|
+
value.forEach(v => process(key, v));
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
process(key, value);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
return formData;
|
|
106
|
+
}
|
|
107
|
+
return undefined;
|
|
108
|
+
};
|
|
109
|
+
export const resolve = async (options, resolver) => {
|
|
110
|
+
if (typeof resolver === 'function') {
|
|
111
|
+
return resolver(options);
|
|
112
|
+
}
|
|
113
|
+
return resolver;
|
|
114
|
+
};
|
|
115
|
+
export const getHeaders = async (config, options) => {
|
|
116
|
+
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
117
|
+
resolve(options, config.TOKEN),
|
|
118
|
+
resolve(options, config.USERNAME),
|
|
119
|
+
resolve(options, config.PASSWORD),
|
|
120
|
+
resolve(options, config.HEADERS),
|
|
121
|
+
]);
|
|
122
|
+
const headers = Object.entries({
|
|
123
|
+
Accept: 'application/json',
|
|
124
|
+
...additionalHeaders,
|
|
125
|
+
...options.headers,
|
|
126
|
+
})
|
|
127
|
+
.filter(([_, value]) => isDefined(value))
|
|
128
|
+
.reduce((headers, [key, value]) => ({
|
|
129
|
+
...headers,
|
|
130
|
+
[key]: String(value),
|
|
131
|
+
}), {});
|
|
132
|
+
if (isStringWithValue(token)) {
|
|
133
|
+
headers['Authorization'] = `Bearer ${token}`;
|
|
134
|
+
}
|
|
135
|
+
if (isStringWithValue(username) && isStringWithValue(password)) {
|
|
136
|
+
const credentials = base64(`${username}:${password}`);
|
|
137
|
+
headers['Authorization'] = `Basic ${credentials}`;
|
|
138
|
+
}
|
|
139
|
+
if (options.body !== undefined) {
|
|
140
|
+
if (options.mediaType) {
|
|
141
|
+
headers['Content-Type'] = options.mediaType;
|
|
142
|
+
}
|
|
143
|
+
else if (isBlob(options.body)) {
|
|
144
|
+
headers['Content-Type'] = options.body.type || 'application/octet-stream';
|
|
145
|
+
}
|
|
146
|
+
else if (isString(options.body)) {
|
|
147
|
+
headers['Content-Type'] = 'text/plain';
|
|
148
|
+
}
|
|
149
|
+
else if (!isFormData(options.body)) {
|
|
150
|
+
headers['Content-Type'] = 'application/json';
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return new Headers(headers);
|
|
154
|
+
};
|
|
155
|
+
export const getRequestBody = (options) => {
|
|
156
|
+
if (options.body !== undefined) {
|
|
157
|
+
if (options.mediaType?.includes('/json')) {
|
|
158
|
+
return JSON.stringify(options.body);
|
|
159
|
+
}
|
|
160
|
+
else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {
|
|
161
|
+
return options.body;
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
return JSON.stringify(options.body);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return undefined;
|
|
168
|
+
};
|
|
169
|
+
export const sendRequest = async (config, options, url, body, formData, headers, onCancel) => {
|
|
170
|
+
const controller = new AbortController();
|
|
171
|
+
const request = {
|
|
172
|
+
headers,
|
|
173
|
+
body: body ?? formData,
|
|
174
|
+
method: options.method,
|
|
175
|
+
signal: controller.signal,
|
|
176
|
+
};
|
|
177
|
+
if (config.WITH_CREDENTIALS) {
|
|
178
|
+
request.credentials = config.CREDENTIALS;
|
|
179
|
+
}
|
|
180
|
+
onCancel(() => controller.abort());
|
|
181
|
+
return await fetch(url, request);
|
|
182
|
+
};
|
|
183
|
+
export const getResponseHeader = (response, responseHeader) => {
|
|
184
|
+
if (responseHeader) {
|
|
185
|
+
const content = response.headers.get(responseHeader);
|
|
186
|
+
if (isString(content)) {
|
|
187
|
+
return content;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return undefined;
|
|
191
|
+
};
|
|
192
|
+
export const getResponseBody = async (response) => {
|
|
193
|
+
if (response.status !== 204) {
|
|
194
|
+
try {
|
|
195
|
+
const contentType = response.headers.get('Content-Type');
|
|
196
|
+
if (contentType) {
|
|
197
|
+
const jsonTypes = ['application/json', 'application/problem+json'];
|
|
198
|
+
const isJSON = jsonTypes.some(type => contentType.toLowerCase().startsWith(type));
|
|
199
|
+
if (isJSON) {
|
|
200
|
+
return await response.json();
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
return await response.text();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
console.error(error);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return undefined;
|
|
212
|
+
};
|
|
213
|
+
export const catchErrorCodes = (options, result) => {
|
|
214
|
+
const errors = {
|
|
215
|
+
400: 'Bad Request',
|
|
216
|
+
401: 'Unauthorized',
|
|
217
|
+
403: 'Forbidden',
|
|
218
|
+
404: 'Not Found',
|
|
219
|
+
500: 'Internal Server Error',
|
|
220
|
+
502: 'Bad Gateway',
|
|
221
|
+
503: 'Service Unavailable',
|
|
222
|
+
...options.errors,
|
|
223
|
+
};
|
|
224
|
+
const error = errors[result.status];
|
|
225
|
+
if (error) {
|
|
226
|
+
throw new ApiError(options, result, error);
|
|
227
|
+
}
|
|
228
|
+
if (!result.ok) {
|
|
229
|
+
const errorStatus = result.status ?? 'unknown';
|
|
230
|
+
const errorStatusText = result.statusText ?? 'unknown';
|
|
231
|
+
const errorBody = (() => {
|
|
232
|
+
try {
|
|
233
|
+
return JSON.stringify(result.body, null, 2);
|
|
234
|
+
}
|
|
235
|
+
catch (e) {
|
|
236
|
+
return undefined;
|
|
237
|
+
}
|
|
238
|
+
})();
|
|
239
|
+
throw new ApiError(options, result, `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`);
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
/**
|
|
243
|
+
* Request method
|
|
244
|
+
* @param config The OpenAPI configuration object
|
|
245
|
+
* @param options The request options from the service
|
|
246
|
+
* @returns CancelablePromise<T>
|
|
247
|
+
* @throws ApiError
|
|
248
|
+
*/
|
|
249
|
+
export const request = (config, options) => {
|
|
250
|
+
return new CancelablePromise(async (resolve, reject, onCancel) => {
|
|
251
|
+
try {
|
|
252
|
+
const url = getUrl(config, options);
|
|
253
|
+
const formData = getFormData(options);
|
|
254
|
+
const body = getRequestBody(options);
|
|
255
|
+
const headers = await getHeaders(config, options);
|
|
256
|
+
if (!onCancel.isCancelled) {
|
|
257
|
+
const response = await sendRequest(config, options, url, body, formData, headers, onCancel);
|
|
258
|
+
const responseBody = await getResponseBody(response);
|
|
259
|
+
const responseHeader = getResponseHeader(response, options.responseHeader);
|
|
260
|
+
const result = {
|
|
261
|
+
url,
|
|
262
|
+
ok: response.ok,
|
|
263
|
+
status: response.status,
|
|
264
|
+
statusText: response.statusText,
|
|
265
|
+
body: responseHeader ?? responseBody,
|
|
266
|
+
};
|
|
267
|
+
catchErrorCodes(options, result);
|
|
268
|
+
resolve(result.body);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
catch (error) {
|
|
272
|
+
reject(error);
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { ApiError } from './core/ApiError';
|
|
2
|
+
export { CancelablePromise, CancelError } from './core/CancelablePromise';
|
|
3
|
+
export { OpenAPI } from './core/OpenAPI';
|
|
4
|
+
export type { OpenAPIConfig } from './core/OpenAPI';
|
|
5
|
+
export { AgentTaskProgressItemType } from './models/AgentTaskProgressItemType';
|
|
6
|
+
export type { AgentTaskProgressItemUpdatedEventDto } from './models/AgentTaskProgressItemUpdatedEventDto';
|
|
7
|
+
export { ApiDtoType } from './models/ApiDtoType';
|
|
8
|
+
export type { StreamDto } from './models/StreamDto';
|
|
9
|
+
export { StreamEventType } from './models/StreamEventType';
|
|
10
|
+
export type { StreamNotFoundEventDto } from './models/StreamNotFoundEventDto';
|
|
11
|
+
export type { StreamTimeoutEventDto } from './models/StreamTimeoutEventDto';
|
|
12
|
+
export { PubService } from './services/PubService';
|
|
@@ -6,7 +6,6 @@ export { ApiError } from './core/ApiError';
|
|
|
6
6
|
export { CancelablePromise, CancelError } from './core/CancelablePromise';
|
|
7
7
|
export { OpenAPI } from './core/OpenAPI';
|
|
8
8
|
export { AgentTaskProgressItemType } from './models/AgentTaskProgressItemType';
|
|
9
|
-
export { AgentTaskStatusDto } from './models/AgentTaskStatusDto';
|
|
10
9
|
export { ApiDtoType } from './models/ApiDtoType';
|
|
11
10
|
export { StreamEventType } from './models/StreamEventType';
|
|
12
11
|
export { PubService } from './services/PubService';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
export var StreamEventType;
|
|
6
|
+
(function (StreamEventType) {
|
|
7
|
+
StreamEventType["STREAM_TIMEOUT"] = "StreamTimeout";
|
|
8
|
+
StreamEventType["STREAM_NOT_FOUND"] = "StreamNotFound";
|
|
9
|
+
StreamEventType["STREAM_UNAUTHORIZED"] = "StreamUnauthorized";
|
|
10
|
+
StreamEventType["AGENT_TASK_PROGRESS_ITEM_UPDATED"] = "AgentTaskProgressItemUpdated";
|
|
11
|
+
})(StreamEventType || (StreamEventType = {}));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AgentTaskProgressItemUpdatedEventDto } from '../models/AgentTaskProgressItemUpdatedEventDto';
|
|
2
|
+
import type { StreamDto } from '../models/StreamDto';
|
|
3
|
+
import type { StreamNotFoundEventDto } from '../models/StreamNotFoundEventDto';
|
|
4
|
+
import type { StreamTimeoutEventDto } from '../models/StreamTimeoutEventDto';
|
|
5
|
+
import type { CancelablePromise } from '../core/CancelablePromise';
|
|
6
|
+
export declare class PubService {
|
|
7
|
+
/**
|
|
8
|
+
* Create Chat Completion Stream
|
|
9
|
+
* @returns StreamDto Created
|
|
10
|
+
* @throws ApiError
|
|
11
|
+
*/
|
|
12
|
+
static createStream(): CancelablePromise<StreamDto>;
|
|
13
|
+
/**
|
|
14
|
+
* Get pub types
|
|
15
|
+
* @returns any OK
|
|
16
|
+
* @throws ApiError
|
|
17
|
+
*/
|
|
18
|
+
static getPubTypes(): CancelablePromise<(StreamTimeoutEventDto | StreamNotFoundEventDto | AgentTaskProgressItemUpdatedEventDto)>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { OpenAPI } from '../core/OpenAPI';
|
|
2
|
+
import { request as __request } from '../core/request';
|
|
3
|
+
export class PubService {
|
|
4
|
+
/**
|
|
5
|
+
* Create Chat Completion Stream
|
|
6
|
+
* @returns StreamDto Created
|
|
7
|
+
* @throws ApiError
|
|
8
|
+
*/
|
|
9
|
+
static createStream() {
|
|
10
|
+
return __request(OpenAPI, {
|
|
11
|
+
method: 'POST',
|
|
12
|
+
url: '/pub/ct/streams',
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get pub types
|
|
17
|
+
* @returns any OK
|
|
18
|
+
* @throws ApiError
|
|
19
|
+
*/
|
|
20
|
+
static getPubTypes() {
|
|
21
|
+
return __request(OpenAPI, {
|
|
22
|
+
method: 'POST',
|
|
23
|
+
url: '/pub/ct/types',
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { ApiError } from './core/ApiError';
|
|
2
|
+
export { CancelablePromise, CancelError } from './core/CancelablePromise';
|
|
3
|
+
export { OpenAPI } from './core/OpenAPI';
|
|
4
|
+
export type { OpenAPIConfig } from './core/OpenAPI';
|
|
5
|
+
export { AgentTaskStatusDto } from './models/AgentTaskStatusDto';
|
|
6
|
+
export type { PubAgentTaskDto } from './models/PubAgentTaskDto';
|
|
7
|
+
export type { PubCreateAgentTaskRequest } from './models/PubCreateAgentTaskRequest';
|
|
8
|
+
export type { PubCreateFileDownloadLinkResponse } from './models/PubCreateFileDownloadLinkResponse';
|
|
9
|
+
export { PubService } from './services/PubService';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
export { ApiError } from './core/ApiError';
|
|
6
|
+
export { CancelablePromise, CancelError } from './core/CancelablePromise';
|
|
7
|
+
export { OpenAPI } from './core/OpenAPI';
|
|
8
|
+
export { AgentTaskStatusDto } from './models/AgentTaskStatusDto';
|
|
9
|
+
export { PubService } from './services/PubService';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { PubAgentTaskDto } from '../models/PubAgentTaskDto';
|
|
2
|
+
import type { PubCreateAgentTaskRequest } from '../models/PubCreateAgentTaskRequest';
|
|
3
|
+
import type { PubCreateFileDownloadLinkResponse } from '../models/PubCreateFileDownloadLinkResponse';
|
|
4
|
+
import type { CancelablePromise } from '../core/CancelablePromise';
|
|
5
|
+
export declare class PubService {
|
|
6
|
+
/**
|
|
7
|
+
* Create AgentTask
|
|
8
|
+
* @param requestBody
|
|
9
|
+
* @returns PubAgentTaskDto Created
|
|
10
|
+
* @throws ApiError
|
|
11
|
+
*/
|
|
12
|
+
static createAgentTask(requestBody: PubCreateAgentTaskRequest): CancelablePromise<PubAgentTaskDto>;
|
|
13
|
+
/**
|
|
14
|
+
* Create File Download Link
|
|
15
|
+
* @param fileId
|
|
16
|
+
* @returns PubCreateFileDownloadLinkResponse OK
|
|
17
|
+
* @throws ApiError
|
|
18
|
+
*/
|
|
19
|
+
static createFileDownloadLink(fileId: string): CancelablePromise<PubCreateFileDownloadLinkResponse>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { OpenAPI } from '../core/OpenAPI';
|
|
2
|
+
import { request as __request } from '../core/request';
|
|
3
|
+
export class PubService {
|
|
4
|
+
/**
|
|
5
|
+
* Create AgentTask
|
|
6
|
+
* @param requestBody
|
|
7
|
+
* @returns PubAgentTaskDto Created
|
|
8
|
+
* @throws ApiError
|
|
9
|
+
*/
|
|
10
|
+
static createAgentTask(requestBody) {
|
|
11
|
+
return __request(OpenAPI, {
|
|
12
|
+
method: 'POST',
|
|
13
|
+
url: '/pub/ct-st/agent-tasks',
|
|
14
|
+
body: requestBody,
|
|
15
|
+
mediaType: 'application/json',
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create File Download Link
|
|
20
|
+
* @param fileId
|
|
21
|
+
* @returns PubCreateFileDownloadLinkResponse OK
|
|
22
|
+
* @throws ApiError
|
|
23
|
+
*/
|
|
24
|
+
static createFileDownloadLink(fileId) {
|
|
25
|
+
return __request(OpenAPI, {
|
|
26
|
+
method: 'POST',
|
|
27
|
+
url: '/pub/ct-st/files/{fileId}/download-links',
|
|
28
|
+
path: {
|
|
29
|
+
'fileId': fileId,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
package/lib/types/AgentTask.d.ts
CHANGED
package/lib/types/Stream.d.ts
CHANGED
package/lib/types/index.d.ts
CHANGED
|
@@ -1,28 +1,7 @@
|
|
|
1
|
-
export type { AnthropicModel } from './AnthropicModel';
|
|
2
1
|
export type { ApiError } from './ApiError';
|
|
3
|
-
export { isAgentTask } from './AgentTask';
|
|
4
2
|
export type { AgentTask } from './AgentTask';
|
|
5
|
-
export { isChatCompletion } from './ChatCompletion';
|
|
6
|
-
export type { ChatCompletion } from './ChatCompletion';
|
|
7
|
-
export type { ChatCompletionMessage } from './ChatCompletionMessage';
|
|
8
|
-
export type { ClaudeChatCompletionMessage } from './ClaudeChatCompletionMessage';
|
|
9
3
|
export type { CreateAgentTaskRequest } from './CreateAgentTaskRequest';
|
|
10
4
|
export type { CreateAgentTaskResponse } from './CreateAgentTaskResponse';
|
|
11
|
-
export type { CreateChatCompletionRequest } from './CreateChatCompletionRequest';
|
|
12
|
-
export type { CreateClaudeChatCompletionRequestParams } from './CreateClaudeChatCompletionRequestParams';
|
|
13
|
-
export type { CreateGeminiChatCompletionRequestParams } from './CreateGeminiChatCompletionRequestParams';
|
|
14
|
-
export type { CreateOpenAiChatCompletionRequestParams } from './CreateOpenAiChatCompletionRequestParams';
|
|
15
5
|
export type { CreateStreamResponse } from './CreateStreamResponse';
|
|
16
|
-
export type { GeminiChatCompletionMessage } from './GeminiChatCompletionMessage';
|
|
17
|
-
export type { GeminiModel } from './GeminiModel';
|
|
18
|
-
export type { OpenAiModel } from './OpenAiModel';
|
|
19
|
-
export type { S3PostRequest } from './S3PostRequest';
|
|
20
|
-
export type { Stream } from './Stream';
|
|
21
|
-
export type { ListMemoryTypesResponse } from './ListMemoryTypesResponse';
|
|
22
|
-
export type { CreateChatCompletionResponse } from './CreateChatCompletionResponse';
|
|
23
|
-
export type { FencyInstance } from './FencyInstance';
|
|
24
|
-
export type { FencyOptions } from './FencyOptions';
|
|
25
|
-
export type { SearchMemoriesResponse } from './SearchMemoriesResponse';
|
|
26
|
-
export type { SearchMemoriesRequest } from './SearchMemoriesRequest';
|
|
27
|
-
export type { CreateFileDownloadLinkRequest } from './CreateFileDownloadLinkRequest';
|
|
28
6
|
export type { CreateFileDownloadLinkResponse } from './CreateFileDownloadLinkResponse';
|
|
7
|
+
export type { Stream } from './Stream';
|
package/lib/types/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { isChatCompletion } from './ChatCompletion';
|
|
1
|
+
export {};
|
package/lib/utils/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Browser-compatible version utility
|
|
2
2
|
// The version is set at build time and can be overridden if needed
|
|
3
3
|
// Build-time version constant - this should be updated during the build process
|
|
4
|
-
const SDK_VERSION = '0.1.
|
|
4
|
+
const SDK_VERSION = '0.1.107';
|
|
5
5
|
// Allow runtime override if needed
|
|
6
6
|
let versionOverride = null;
|
|
7
7
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fencyai/js",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.109",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "staklau <steinaageklaussen@gmail.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"test:watch": "jest --watch",
|
|
33
33
|
"dev": "tsc --watch",
|
|
34
34
|
"prepublishOnly": "npm run build",
|
|
35
|
-
"codegen": "openapi --input http://localhost:8080/
|
|
35
|
+
"codegen": "openapi --input http://localhost:8080/pub/ct-st/swagger.json --output ./src/openapi/ct-st && openapi --input http://localhost:8080/pub/ct/swagger.json --output ./src/openapi/ct"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/jest": "^29.5.11",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"ts-jest": "^29.1.1",
|
|
43
43
|
"typescript": "^5.3.3"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "2663038df613dc32b2ba59c8ef2c0bf6c0dd767a"
|
|
46
46
|
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { OpenAPI, PubService } from '../openapi';
|
|
2
|
-
import { getPackageVersion } from '../utils/version';
|
|
3
|
-
export async function listMemoryTypes(params) {
|
|
4
|
-
try {
|
|
5
|
-
OpenAPI.BASE = params.baseUrl;
|
|
6
|
-
OpenAPI.HEADERS = {
|
|
7
|
-
'Content-Type': 'application/json',
|
|
8
|
-
Authorization: `Bearer ${params.pk}`,
|
|
9
|
-
'X-Fency-Sdk-Version': getPackageVersion(),
|
|
10
|
-
'X-Fency-Client-Secret': params.clientSecret,
|
|
11
|
-
};
|
|
12
|
-
const response = await PubService.listMemoryTypes();
|
|
13
|
-
return {
|
|
14
|
-
type: 'success',
|
|
15
|
-
items: response.items,
|
|
16
|
-
pagination: response.pagination,
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
return {
|
|
21
|
-
type: 'error',
|
|
22
|
-
error: {
|
|
23
|
-
code: 'UnknownError',
|
|
24
|
-
message: `Unknown error!\n${error ? `Error: ${error}\n` : ''}`.trim(),
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { SearchMemoriesRequest } from '../types/SearchMemoriesRequest';
|
|
2
|
-
import { SearchMemoriesResponse } from '../types/SearchMemoriesResponse';
|
|
3
|
-
export declare function searchMemories(params: {
|
|
4
|
-
pk: string;
|
|
5
|
-
clientSecret: string;
|
|
6
|
-
request: SearchMemoriesRequest;
|
|
7
|
-
baseUrl: string;
|
|
8
|
-
}): Promise<SearchMemoriesResponse>;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { OpenAPI, PubService } from '../openapi';
|
|
2
|
-
import { getPackageVersion } from '../utils/version';
|
|
3
|
-
export async function searchMemories(params) {
|
|
4
|
-
try {
|
|
5
|
-
OpenAPI.BASE = params.baseUrl;
|
|
6
|
-
OpenAPI.HEADERS = {
|
|
7
|
-
'Content-Type': 'application/json',
|
|
8
|
-
Authorization: `Bearer ${params.pk}`,
|
|
9
|
-
'X-Fency-Sdk-Version': getPackageVersion(),
|
|
10
|
-
'X-Fency-Client-Secret': params.clientSecret,
|
|
11
|
-
};
|
|
12
|
-
const response = await PubService.searchMemories(params.request);
|
|
13
|
-
return {
|
|
14
|
-
type: 'success',
|
|
15
|
-
items: response.items,
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
catch (error) {
|
|
19
|
-
return {
|
|
20
|
-
type: 'error',
|
|
21
|
-
error: {
|
|
22
|
-
code: 'UnknownError',
|
|
23
|
-
message: `Unknown error!\n${error ? `Error: ${error}\n` : ''}`.trim(),
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
}
|
package/lib/openapi/index.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export { ApiError } from './core/ApiError';
|
|
2
|
-
export { CancelablePromise, CancelError } from './core/CancelablePromise';
|
|
3
|
-
export { OpenAPI } from './core/OpenAPI';
|
|
4
|
-
export type { OpenAPIConfig } from './core/OpenAPI';
|
|
5
|
-
export { AgentTaskProgressItemType } from './models/AgentTaskProgressItemType';
|
|
6
|
-
export type { AgentTaskProgressItemUpdatedEventDto } from './models/AgentTaskProgressItemUpdatedEventDto';
|
|
7
|
-
export { AgentTaskStatusDto } from './models/AgentTaskStatusDto';
|
|
8
|
-
export { ApiDtoType } from './models/ApiDtoType';
|
|
9
|
-
export type { ChatCompletionStreamCompletedEventDto } from './models/ChatCompletionStreamCompletedEventDto';
|
|
10
|
-
export type { FileSearchIndexReadyEventDto } from './models/FileSearchIndexReadyEventDto';
|
|
11
|
-
export type { FileTextContentReadyEventDto } from './models/FileTextContentReadyEventDto';
|
|
12
|
-
export type { FileUploadCompletedEventDto } from './models/FileUploadCompletedEventDto';
|
|
13
|
-
export type { ListMemoryTypesResponse } from './models/ListMemoryTypesResponse';
|
|
14
|
-
export type { NewChatCompletionStreamChunkEventDto } from './models/NewChatCompletionStreamChunkEventDto';
|
|
15
|
-
export type { PaginationDto } from './models/PaginationDto';
|
|
16
|
-
export type { PubAgentTaskDto } from './models/PubAgentTaskDto';
|
|
17
|
-
export type { PubCreateAgentTaskRequest } from './models/PubCreateAgentTaskRequest';
|
|
18
|
-
export type { PubCreateFileDownloadLinkResponse } from './models/PubCreateFileDownloadLinkResponse';
|
|
19
|
-
export type { PubMemoryDto } from './models/PubMemoryDto';
|
|
20
|
-
export type { PubMemoryTypeDto } from './models/PubMemoryTypeDto';
|
|
21
|
-
export type { PubSearchMemoriesRequest } from './models/PubSearchMemoriesRequest';
|
|
22
|
-
export type { PubSearchMemoriesResponse } from './models/PubSearchMemoriesResponse';
|
|
23
|
-
export type { StreamDto } from './models/StreamDto';
|
|
24
|
-
export { StreamEventType } from './models/StreamEventType';
|
|
25
|
-
export type { StreamNotFoundEventDto } from './models/StreamNotFoundEventDto';
|
|
26
|
-
export type { StreamTimeoutEventDto } from './models/StreamTimeoutEventDto';
|
|
27
|
-
export { PubService } from './services/PubService';
|