@fencyai/js 0.1.106 → 0.1.108

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.
Files changed (125) hide show
  1. package/lib/api/createAgentTask.d.ts +2 -1
  2. package/lib/api/createAgentTask.js +4 -4
  3. package/lib/api/createFileDownloadLink.d.ts +2 -1
  4. package/lib/api/createFileDownloadLink.js +5 -3
  5. package/lib/api/createStream.d.ts +1 -1
  6. package/lib/api/createStream.js +20 -4
  7. package/lib/index.d.ts +10 -5
  8. package/lib/index.js +2 -3
  9. package/lib/loadFency.d.ts +2 -1
  10. package/lib/openapi/client/index.d.ts +9 -0
  11. package/lib/openapi/client/index.js +9 -0
  12. package/lib/openapi/{models → client/models}/PubCreateAgentTaskRequest.d.ts +0 -1
  13. package/lib/openapi/client/services/PubService.d.ts +20 -0
  14. package/lib/openapi/client/services/PubService.js +33 -0
  15. package/lib/openapi/stream/core/ApiError.d.ts +10 -0
  16. package/lib/openapi/stream/core/ApiError.js +11 -0
  17. package/lib/openapi/stream/core/ApiRequestOptions.d.ts +13 -0
  18. package/lib/openapi/stream/core/ApiResult.d.ts +7 -0
  19. package/lib/openapi/stream/core/CancelablePromise.d.ts +20 -0
  20. package/lib/openapi/stream/core/CancelablePromise.js +111 -0
  21. package/lib/openapi/stream/core/OpenAPI.d.ts +16 -0
  22. package/lib/openapi/stream/core/OpenAPI.js +11 -0
  23. package/lib/openapi/stream/core/request.d.ts +30 -0
  24. package/lib/openapi/stream/core/request.js +275 -0
  25. package/lib/openapi/{index.d.ts → stream/index.d.ts} +0 -10
  26. package/lib/openapi/{index.js → stream/index.js} +0 -1
  27. package/lib/openapi/{models → stream/models}/StreamDto.d.ts +1 -0
  28. package/lib/openapi/stream/services/PubService.d.ts +24 -0
  29. package/lib/openapi/stream/services/PubService.js +26 -0
  30. package/lib/types/AgentTask.d.ts +1 -1
  31. package/lib/types/Stream.d.ts +1 -0
  32. package/lib/types/index.d.ts +1 -22
  33. package/lib/types/index.js +1 -2
  34. package/lib/utils/version.js +1 -1
  35. package/package.json +3 -3
  36. package/lib/api/listMemoryTypes.d.ts +0 -6
  37. package/lib/api/listMemoryTypes.js +0 -28
  38. package/lib/api/searchMemories.d.ts +0 -8
  39. package/lib/api/searchMemories.js +0 -27
  40. package/lib/openapi/models/ListMemoryTypesResponse.d.ts +0 -6
  41. package/lib/openapi/models/PaginationDto.d.ts +0 -4
  42. package/lib/openapi/models/PubMemoryDto.d.ts +0 -5
  43. package/lib/openapi/models/PubMemoryDto.js +0 -1
  44. package/lib/openapi/models/PubMemoryTypeDto.d.ts +0 -5
  45. package/lib/openapi/models/PubMemoryTypeDto.js +0 -1
  46. package/lib/openapi/models/PubSearchMemoriesRequest.d.ts +0 -4
  47. package/lib/openapi/models/PubSearchMemoriesRequest.js +0 -1
  48. package/lib/openapi/models/PubSearchMemoriesResponse.d.ts +0 -4
  49. package/lib/openapi/models/PubSearchMemoriesResponse.js +0 -1
  50. package/lib/openapi/services/PubService.d.ts +0 -63
  51. package/lib/openapi/services/PubService.js +0 -96
  52. package/lib/types/AnthropicModel.d.ts +0 -1
  53. package/lib/types/AnthropicModel.js +0 -1
  54. package/lib/types/ChatCompletion.d.ts +0 -8
  55. package/lib/types/ChatCompletion.js +0 -7
  56. package/lib/types/ChatCompletionMessage.d.ts +0 -4
  57. package/lib/types/ChatCompletionMessage.js +0 -1
  58. package/lib/types/ClaudeChatCompletionMessage.d.ts +0 -4
  59. package/lib/types/ClaudeChatCompletionMessage.js +0 -1
  60. package/lib/types/CreateChatCompletionRequest.d.ts +0 -10
  61. package/lib/types/CreateChatCompletionRequest.js +0 -1
  62. package/lib/types/CreateChatCompletionResponse.d.ts +0 -9
  63. package/lib/types/CreateChatCompletionResponse.js +0 -1
  64. package/lib/types/CreateClaudeChatCompletionRequestParams.d.ts +0 -10
  65. package/lib/types/CreateClaudeChatCompletionRequestParams.js +0 -1
  66. package/lib/types/CreateGeminiChatCompletionRequestParams.d.ts +0 -11
  67. package/lib/types/CreateGeminiChatCompletionRequestParams.js +0 -1
  68. package/lib/types/CreateOpenAiChatCompletionRequestParams.d.ts +0 -9
  69. package/lib/types/CreateOpenAiChatCompletionRequestParams.js +0 -1
  70. package/lib/types/GeminiChatCompletionMessage.d.ts +0 -4
  71. package/lib/types/GeminiChatCompletionMessage.js +0 -1
  72. package/lib/types/GeminiModel.d.ts +0 -1
  73. package/lib/types/GeminiModel.js +0 -1
  74. package/lib/types/ListMemoryTypesResponse.d.ts +0 -10
  75. package/lib/types/ListMemoryTypesResponse.js +0 -1
  76. package/lib/types/OpenAiModel.d.ts +0 -1
  77. package/lib/types/OpenAiModel.js +0 -1
  78. package/lib/types/SearchMemoriesRequest.d.ts +0 -4
  79. package/lib/types/SearchMemoriesRequest.js +0 -1
  80. package/lib/types/SearchMemoriesResponse.d.ts +0 -9
  81. package/lib/types/SearchMemoriesResponse.js +0 -1
  82. /package/lib/openapi/{core → client/core}/ApiError.d.ts +0 -0
  83. /package/lib/openapi/{core → client/core}/ApiError.js +0 -0
  84. /package/lib/openapi/{core → client/core}/ApiRequestOptions.d.ts +0 -0
  85. /package/lib/openapi/{core → client/core}/ApiRequestOptions.js +0 -0
  86. /package/lib/openapi/{core → client/core}/ApiResult.d.ts +0 -0
  87. /package/lib/openapi/{core → client/core}/ApiResult.js +0 -0
  88. /package/lib/openapi/{core → client/core}/CancelablePromise.d.ts +0 -0
  89. /package/lib/openapi/{core → client/core}/CancelablePromise.js +0 -0
  90. /package/lib/openapi/{core → client/core}/OpenAPI.d.ts +0 -0
  91. /package/lib/openapi/{core → client/core}/OpenAPI.js +0 -0
  92. /package/lib/openapi/{core → client/core}/request.d.ts +0 -0
  93. /package/lib/openapi/{core → client/core}/request.js +0 -0
  94. /package/lib/openapi/{models → client/models}/AgentTaskStatusDto.d.ts +0 -0
  95. /package/lib/openapi/{models → client/models}/AgentTaskStatusDto.js +0 -0
  96. /package/lib/openapi/{models → client/models}/PubAgentTaskDto.d.ts +0 -0
  97. /package/lib/openapi/{models → client/models}/PubAgentTaskDto.js +0 -0
  98. /package/lib/openapi/{models → client/models}/PubCreateAgentTaskRequest.js +0 -0
  99. /package/lib/openapi/{models → client/models}/PubCreateFileDownloadLinkResponse.d.ts +0 -0
  100. /package/lib/openapi/{models → client/models}/PubCreateFileDownloadLinkResponse.js +0 -0
  101. /package/lib/openapi/{models/AgentTaskProgressItemUpdatedEventDto.js → stream/core/ApiRequestOptions.js} +0 -0
  102. /package/lib/openapi/{models/ChatCompletionStreamCompletedEventDto.js → stream/core/ApiResult.js} +0 -0
  103. /package/lib/openapi/{models → stream/models}/AgentTaskProgressItemType.d.ts +0 -0
  104. /package/lib/openapi/{models → stream/models}/AgentTaskProgressItemType.js +0 -0
  105. /package/lib/openapi/{models → stream/models}/AgentTaskProgressItemUpdatedEventDto.d.ts +0 -0
  106. /package/lib/openapi/{models/FileSearchIndexReadyEventDto.js → stream/models/AgentTaskProgressItemUpdatedEventDto.js} +0 -0
  107. /package/lib/openapi/{models → stream/models}/ApiDtoType.d.ts +0 -0
  108. /package/lib/openapi/{models → stream/models}/ApiDtoType.js +0 -0
  109. /package/lib/openapi/{models → stream/models}/ChatCompletionStreamCompletedEventDto.d.ts +0 -0
  110. /package/lib/openapi/{models/FileTextContentReadyEventDto.js → stream/models/ChatCompletionStreamCompletedEventDto.js} +0 -0
  111. /package/lib/openapi/{models → stream/models}/FileSearchIndexReadyEventDto.d.ts +0 -0
  112. /package/lib/openapi/{models/FileUploadCompletedEventDto.js → stream/models/FileSearchIndexReadyEventDto.js} +0 -0
  113. /package/lib/openapi/{models → stream/models}/FileTextContentReadyEventDto.d.ts +0 -0
  114. /package/lib/openapi/{models/ListMemoryTypesResponse.js → stream/models/FileTextContentReadyEventDto.js} +0 -0
  115. /package/lib/openapi/{models → stream/models}/FileUploadCompletedEventDto.d.ts +0 -0
  116. /package/lib/openapi/{models/NewChatCompletionStreamChunkEventDto.js → stream/models/FileUploadCompletedEventDto.js} +0 -0
  117. /package/lib/openapi/{models → stream/models}/NewChatCompletionStreamChunkEventDto.d.ts +0 -0
  118. /package/lib/openapi/{models/PaginationDto.js → stream/models/NewChatCompletionStreamChunkEventDto.js} +0 -0
  119. /package/lib/openapi/{models → stream/models}/StreamDto.js +0 -0
  120. /package/lib/openapi/{models → stream/models}/StreamEventType.d.ts +0 -0
  121. /package/lib/openapi/{models → stream/models}/StreamEventType.js +0 -0
  122. /package/lib/openapi/{models → stream/models}/StreamNotFoundEventDto.d.ts +0 -0
  123. /package/lib/openapi/{models → stream/models}/StreamNotFoundEventDto.js +0 -0
  124. /package/lib/openapi/{models → stream/models}/StreamTimeoutEventDto.d.ts +0 -0
  125. /package/lib/openapi/{models → stream/models}/StreamTimeoutEventDto.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
+ };
@@ -4,22 +4,12 @@ export { OpenAPI } from './core/OpenAPI';
4
4
  export type { OpenAPIConfig } from './core/OpenAPI';
5
5
  export { AgentTaskProgressItemType } from './models/AgentTaskProgressItemType';
6
6
  export type { AgentTaskProgressItemUpdatedEventDto } from './models/AgentTaskProgressItemUpdatedEventDto';
7
- export { AgentTaskStatusDto } from './models/AgentTaskStatusDto';
8
7
  export { ApiDtoType } from './models/ApiDtoType';
9
8
  export type { ChatCompletionStreamCompletedEventDto } from './models/ChatCompletionStreamCompletedEventDto';
10
9
  export type { FileSearchIndexReadyEventDto } from './models/FileSearchIndexReadyEventDto';
11
10
  export type { FileTextContentReadyEventDto } from './models/FileTextContentReadyEventDto';
12
11
  export type { FileUploadCompletedEventDto } from './models/FileUploadCompletedEventDto';
13
- export type { ListMemoryTypesResponse } from './models/ListMemoryTypesResponse';
14
12
  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
13
  export type { StreamDto } from './models/StreamDto';
24
14
  export { StreamEventType } from './models/StreamEventType';
25
15
  export type { StreamNotFoundEventDto } from './models/StreamNotFoundEventDto';
@@ -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';
@@ -3,4 +3,5 @@ export type StreamDto = {
3
3
  id: string;
4
4
  createdAt: string;
5
5
  type: ApiDtoType;
6
+ token: string;
6
7
  };
@@ -0,0 +1,24 @@
1
+ import type { AgentTaskProgressItemUpdatedEventDto } from '../models/AgentTaskProgressItemUpdatedEventDto';
2
+ import type { ChatCompletionStreamCompletedEventDto } from '../models/ChatCompletionStreamCompletedEventDto';
3
+ import type { FileSearchIndexReadyEventDto } from '../models/FileSearchIndexReadyEventDto';
4
+ import type { FileTextContentReadyEventDto } from '../models/FileTextContentReadyEventDto';
5
+ import type { FileUploadCompletedEventDto } from '../models/FileUploadCompletedEventDto';
6
+ import type { NewChatCompletionStreamChunkEventDto } from '../models/NewChatCompletionStreamChunkEventDto';
7
+ import type { StreamDto } from '../models/StreamDto';
8
+ import type { StreamNotFoundEventDto } from '../models/StreamNotFoundEventDto';
9
+ import type { StreamTimeoutEventDto } from '../models/StreamTimeoutEventDto';
10
+ import type { CancelablePromise } from '../core/CancelablePromise';
11
+ export declare class PubService {
12
+ /**
13
+ * Create Chat Completion Stream
14
+ * @returns StreamDto Created
15
+ * @throws ApiError
16
+ */
17
+ static createStream(): CancelablePromise<StreamDto>;
18
+ /**
19
+ * Get pub types
20
+ * @returns any OK
21
+ * @throws ApiError
22
+ */
23
+ static getPubTypes(): CancelablePromise<(StreamTimeoutEventDto | StreamNotFoundEventDto | NewChatCompletionStreamChunkEventDto | ChatCompletionStreamCompletedEventDto | FileUploadCompletedEventDto | FileTextContentReadyEventDto | FileSearchIndexReadyEventDto | AgentTaskProgressItemUpdatedEventDto)>;
24
+ }
@@ -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/stream/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/stream/types',
24
+ });
25
+ }
26
+ }
@@ -1,4 +1,4 @@
1
- import { AgentTaskStatusDto } from "../openapi";
1
+ import { AgentTaskStatusDto } from "../openapi/client";
2
2
  export type AgentTask = {
3
3
  id: string;
4
4
  status: AgentTaskStatusDto;
@@ -1,5 +1,6 @@
1
1
  export interface Stream {
2
2
  id: string;
3
3
  createdAt: string;
4
+ token: string;
4
5
  }
5
6
  export declare const isStream: (data: any) => data is Stream;
@@ -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';
@@ -1,2 +1 @@
1
- export { isAgentTask } from './AgentTask';
2
- export { isChatCompletion } from './ChatCompletion';
1
+ export {};
@@ -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.104';
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.106",
3
+ "version": "0.1.108",
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/v1/pub/swagger.json --output ./src/openapi"
35
+ "codegen": "openapi --input http://localhost:8080/pub/client/swagger.json --output ./src/openapi/client && openapi --input http://localhost:8080/pub/stream/swagger.json --output ./src/openapi/stream"
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": "e516e654cc331c80fb151ff035b29796ac736b26"
45
+ "gitHead": "b6e2b8dfa4bb130b0f57dc2d4decbb08c5f91850"
46
46
  }
@@ -1,6 +0,0 @@
1
- import { ListMemoryTypesResponse } from '../types';
2
- export declare function listMemoryTypes(params: {
3
- pk: string;
4
- clientSecret: string;
5
- baseUrl: string;
6
- }): Promise<ListMemoryTypesResponse>;
@@ -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
- }
@@ -1,6 +0,0 @@
1
- import type { PaginationDto } from './PaginationDto';
2
- import type { PubMemoryTypeDto } from './PubMemoryTypeDto';
3
- export type ListMemoryTypesResponse = {
4
- items: Array<PubMemoryTypeDto>;
5
- pagination: PaginationDto;
6
- };
@@ -1,4 +0,0 @@
1
- export type PaginationDto = {
2
- previousPageToken?: string | null;
3
- nextPageToken?: string | null;
4
- };
@@ -1,5 +0,0 @@
1
- export type PubMemoryDto = {
2
- id: string;
3
- createdAt: string;
4
- title?: string | null;
5
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- export type PubMemoryTypeDto = {
2
- id: string;
3
- createdAt: string;
4
- name: string;
5
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,4 +0,0 @@
1
- export type PubSearchMemoriesRequest = {
2
- title?: string | null;
3
- memoryTypeId?: string | null;
4
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,4 +0,0 @@
1
- import type { PubMemoryDto } from './PubMemoryDto';
2
- export type PubSearchMemoriesResponse = {
3
- items: Array<PubMemoryDto>;
4
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,63 +0,0 @@
1
- import type { AgentTaskProgressItemUpdatedEventDto } from '../models/AgentTaskProgressItemUpdatedEventDto';
2
- import type { ChatCompletionStreamCompletedEventDto } from '../models/ChatCompletionStreamCompletedEventDto';
3
- import type { FileSearchIndexReadyEventDto } from '../models/FileSearchIndexReadyEventDto';
4
- import type { FileTextContentReadyEventDto } from '../models/FileTextContentReadyEventDto';
5
- import type { FileUploadCompletedEventDto } from '../models/FileUploadCompletedEventDto';
6
- import type { ListMemoryTypesResponse } from '../models/ListMemoryTypesResponse';
7
- import type { NewChatCompletionStreamChunkEventDto } from '../models/NewChatCompletionStreamChunkEventDto';
8
- import type { PubAgentTaskDto } from '../models/PubAgentTaskDto';
9
- import type { PubCreateAgentTaskRequest } from '../models/PubCreateAgentTaskRequest';
10
- import type { PubCreateFileDownloadLinkResponse } from '../models/PubCreateFileDownloadLinkResponse';
11
- import type { PubSearchMemoriesRequest } from '../models/PubSearchMemoriesRequest';
12
- import type { PubSearchMemoriesResponse } from '../models/PubSearchMemoriesResponse';
13
- import type { StreamDto } from '../models/StreamDto';
14
- import type { StreamNotFoundEventDto } from '../models/StreamNotFoundEventDto';
15
- import type { StreamTimeoutEventDto } from '../models/StreamTimeoutEventDto';
16
- import type { CancelablePromise } from '../core/CancelablePromise';
17
- export declare class PubService {
18
- /**
19
- * Create AgentTask
20
- * @param requestBody
21
- * @returns PubAgentTaskDto Created
22
- * @throws ApiError
23
- */
24
- static createAgentTask(requestBody: PubCreateAgentTaskRequest): CancelablePromise<PubAgentTaskDto>;
25
- /**
26
- * Create File Download Link
27
- * @param fileId
28
- * @returns PubCreateFileDownloadLinkResponse OK
29
- * @throws ApiError
30
- */
31
- static createFileDownloadLink(fileId: string): CancelablePromise<PubCreateFileDownloadLinkResponse>;
32
- /**
33
- * Search Memories
34
- * @param requestBody
35
- * @param nextPageToken
36
- * @param previousPageToken
37
- * @param limit
38
- * @returns PubSearchMemoriesResponse OK
39
- * @throws ApiError
40
- */
41
- static searchMemories(requestBody: PubSearchMemoriesRequest, nextPageToken?: string, previousPageToken?: string, limit?: number): CancelablePromise<PubSearchMemoriesResponse>;
42
- /**
43
- * List Memory Types
44
- * @param nextPageToken
45
- * @param previousPageToken
46
- * @param limit
47
- * @returns ListMemoryTypesResponse OK
48
- * @throws ApiError
49
- */
50
- static listMemoryTypes(nextPageToken?: string, previousPageToken?: string, limit?: number): CancelablePromise<ListMemoryTypesResponse>;
51
- /**
52
- * Create Chat Completion Stream
53
- * @returns StreamDto Created
54
- * @throws ApiError
55
- */
56
- static createStream(): CancelablePromise<StreamDto>;
57
- /**
58
- * Get pub types
59
- * @returns any OK
60
- * @throws ApiError
61
- */
62
- static getPubTypes(): CancelablePromise<(StreamTimeoutEventDto | StreamNotFoundEventDto | NewChatCompletionStreamChunkEventDto | ChatCompletionStreamCompletedEventDto | FileUploadCompletedEventDto | FileTextContentReadyEventDto | FileSearchIndexReadyEventDto | AgentTaskProgressItemUpdatedEventDto)>;
63
- }