codemie-sdk 0.1.425 → 0.1.427
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/dist/index.cjs +359 -223
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +127 -1
- package/dist/index.d.ts +127 -1
- package/dist/index.js +355 -223
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -72,148 +72,29 @@ var KeycloakCredentials = class {
|
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
-
// src/
|
|
76
|
-
function omitUndefined(obj) {
|
|
77
|
-
return Object.fromEntries(Object.entries(obj).filter(([_, value]) => value !== void 0));
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// src/mappers/assistant.mapper.ts
|
|
81
|
-
var AssistantMapper = class {
|
|
82
|
-
static mapBaseModelApiResponse(response) {
|
|
83
|
-
return omitUndefined({
|
|
84
|
-
generated: response.generated,
|
|
85
|
-
time_elapsed: response.timeElapsed,
|
|
86
|
-
tokens_used: response.tokensUsed,
|
|
87
|
-
thoughts: response.thoughts,
|
|
88
|
-
task_id: response.taskId
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
// src/services/assistant.ts
|
|
94
|
-
import { z as z2 } from "zod";
|
|
95
|
-
|
|
96
|
-
// src/schemas/assistant.ts
|
|
75
|
+
// src/schemas/analytics.ts
|
|
97
76
|
import { z } from "zod";
|
|
98
|
-
var
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
77
|
+
var TIME_PERIOD_VALUES = [
|
|
78
|
+
"last_hour",
|
|
79
|
+
"last_6_hours",
|
|
80
|
+
"last_24_hours",
|
|
81
|
+
"last_7_days",
|
|
82
|
+
"last_30_days",
|
|
83
|
+
"last_60_days",
|
|
84
|
+
"last_year"
|
|
85
|
+
];
|
|
86
|
+
var timePeriodSchema = z.enum(TIME_PERIOD_VALUES);
|
|
87
|
+
var analyticsQueryParamsBase = z.object({
|
|
88
|
+
time_period: timePeriodSchema.optional(),
|
|
89
|
+
start_date: z.string().datetime({ offset: true }).optional(),
|
|
90
|
+
end_date: z.string().datetime({ offset: true }).optional(),
|
|
91
|
+
users: z.string().optional(),
|
|
92
|
+
projects: z.string().optional()
|
|
109
93
|
});
|
|
110
|
-
var
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
system_prompt: z.string(),
|
|
115
|
-
project: z.string(),
|
|
116
|
-
context: z.array(
|
|
117
|
-
z.object({
|
|
118
|
-
context_type: z.enum(["knowledge_base", "code"]),
|
|
119
|
-
name: z.string()
|
|
120
|
-
})
|
|
121
|
-
),
|
|
122
|
-
llm_model_type: z.string(),
|
|
123
|
-
toolkits: z.array(
|
|
124
|
-
z.object({
|
|
125
|
-
toolkit: z.string(),
|
|
126
|
-
tools: z.array(
|
|
127
|
-
z.object({
|
|
128
|
-
name: z.string(),
|
|
129
|
-
label: z.string().optional(),
|
|
130
|
-
settings_config: z.boolean(),
|
|
131
|
-
user_description: z.string().optional(),
|
|
132
|
-
settings: z.any().nullable().optional()
|
|
133
|
-
})
|
|
134
|
-
),
|
|
135
|
-
label: z.string(),
|
|
136
|
-
settings_config: z.boolean(),
|
|
137
|
-
is_external: z.boolean(),
|
|
138
|
-
settings: z.any().optional()
|
|
139
|
-
})
|
|
140
|
-
),
|
|
141
|
-
conversation_starters: z.array(z.string()),
|
|
142
|
-
shared: z.boolean().optional(),
|
|
143
|
-
is_react: z.boolean().optional(),
|
|
144
|
-
is_global: z.boolean().optional(),
|
|
145
|
-
slug: z.string().optional(),
|
|
146
|
-
temperature: z.number().optional(),
|
|
147
|
-
top_p: z.number().optional(),
|
|
148
|
-
mcp_servers: z.array(
|
|
149
|
-
z.object({
|
|
150
|
-
name: z.string(),
|
|
151
|
-
description: z.string().optional(),
|
|
152
|
-
enabled: z.boolean(),
|
|
153
|
-
config: z.object({
|
|
154
|
-
url: z.string().optional(),
|
|
155
|
-
command: z.string().optional(),
|
|
156
|
-
args: z.array(z.string()).optional(),
|
|
157
|
-
env: z.record(z.string(), z.unknown()).optional(),
|
|
158
|
-
auth_token: z.string().optional()
|
|
159
|
-
}).optional().refine(
|
|
160
|
-
(config) => {
|
|
161
|
-
if (!config) {
|
|
162
|
-
return true;
|
|
163
|
-
}
|
|
164
|
-
const hasUrl = !!config.url;
|
|
165
|
-
const hasCommand = !!config.command;
|
|
166
|
-
return hasUrl !== hasCommand;
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
error: "Either 'url' or 'command' must be provided in config, but not both"
|
|
170
|
-
}
|
|
171
|
-
),
|
|
172
|
-
mcp_connect_url: z.string().optional(),
|
|
173
|
-
tools_tokens_size_limit: z.number().optional(),
|
|
174
|
-
command: z.string().optional(),
|
|
175
|
-
arguments: z.string().optional(),
|
|
176
|
-
settings: z.any().optional(),
|
|
177
|
-
mcp_connect_auth_token: z.any().optional()
|
|
178
|
-
})
|
|
179
|
-
),
|
|
180
|
-
assistant_ids: z.array(z.string()),
|
|
181
|
-
prompt_variables: z.array(PromptVariableSchema).optional().prefault([]),
|
|
182
|
-
categories: z.array(z.string()).max(3).optional(),
|
|
183
|
-
skip_integration_validation: z.boolean().optional().prefault(false)
|
|
184
|
-
}).readonly();
|
|
185
|
-
var AssistantUpdateParamsSchema = AssistantCreateParamsSchema;
|
|
186
|
-
var AssistantChatParamsSchema = z.object({
|
|
187
|
-
conversation_id: z.string().optional(),
|
|
188
|
-
text: z.string(),
|
|
189
|
-
content_raw: z.string().optional(),
|
|
190
|
-
file_names: z.array(z.string()).optional(),
|
|
191
|
-
llm_model: z.string().optional(),
|
|
192
|
-
history: z.union([
|
|
193
|
-
z.array(
|
|
194
|
-
z.object({
|
|
195
|
-
role: z.enum(["Assistant", "User"]),
|
|
196
|
-
message: z.string().optional()
|
|
197
|
-
})
|
|
198
|
-
),
|
|
199
|
-
z.string()
|
|
200
|
-
]),
|
|
201
|
-
history_index: z.number().optional(),
|
|
202
|
-
stream: z.boolean().optional(),
|
|
203
|
-
propagate_headers: z.boolean().optional(),
|
|
204
|
-
custom_metadata: z.record(z.string(), z.unknown()).optional(),
|
|
205
|
-
top_k: z.number().optional(),
|
|
206
|
-
system_prompt: z.string().optional(),
|
|
207
|
-
background_task: z.boolean().optional(),
|
|
208
|
-
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
209
|
-
mcp_server_single_usage: z.boolean().optional(),
|
|
210
|
-
save_history: z.boolean().optional(),
|
|
211
|
-
version: z.number().optional(),
|
|
212
|
-
output_schema: z.union([z.custom((val) => val instanceof z.ZodType), z.record(z.string(), z.unknown())]).optional()
|
|
213
|
-
}).readonly();
|
|
214
|
-
var AssistantVersionsListParamsSchema = z.object({
|
|
215
|
-
page: z.number().optional(),
|
|
216
|
-
per_page: z.number().optional()
|
|
94
|
+
var AnalyticsQueryParamsSchema = analyticsQueryParamsBase.readonly();
|
|
95
|
+
var PaginatedAnalyticsQueryParamsSchema = analyticsQueryParamsBase.extend({
|
|
96
|
+
page: z.number().int().min(0).default(0),
|
|
97
|
+
per_page: z.number().int().min(1).default(20)
|
|
217
98
|
}).readonly();
|
|
218
99
|
|
|
219
100
|
// src/utils/http.ts
|
|
@@ -334,6 +215,245 @@ var ApiRequestHandler = class {
|
|
|
334
215
|
}
|
|
335
216
|
};
|
|
336
217
|
|
|
218
|
+
// src/services/analytics.ts
|
|
219
|
+
var AnalyticsService = class {
|
|
220
|
+
constructor(config) {
|
|
221
|
+
this.api = new ApiRequestHandler(config);
|
|
222
|
+
}
|
|
223
|
+
async getSummaries(_params = {}) {
|
|
224
|
+
const params = AnalyticsQueryParamsSchema.parse(_params);
|
|
225
|
+
return this.api.get("/v1/analytics/summaries", params);
|
|
226
|
+
}
|
|
227
|
+
async getCliSummary(_params = {}) {
|
|
228
|
+
const params = AnalyticsQueryParamsSchema.parse(_params);
|
|
229
|
+
return this.api.get("/v1/analytics/cli-summary", params);
|
|
230
|
+
}
|
|
231
|
+
async getUsers(_params = {}) {
|
|
232
|
+
const params = AnalyticsQueryParamsSchema.parse(_params);
|
|
233
|
+
return this.api.get("/v1/analytics/users", params);
|
|
234
|
+
}
|
|
235
|
+
async getAssistantsChats(_params = {}) {
|
|
236
|
+
const params = PaginatedAnalyticsQueryParamsSchema.parse(_params);
|
|
237
|
+
return this.api.get("/v1/analytics/assistants-chats", params);
|
|
238
|
+
}
|
|
239
|
+
async getWorkflows(_params = {}) {
|
|
240
|
+
const params = PaginatedAnalyticsQueryParamsSchema.parse(_params);
|
|
241
|
+
return this.api.get("/v1/analytics/workflows", params);
|
|
242
|
+
}
|
|
243
|
+
async getToolsUsage(_params = {}) {
|
|
244
|
+
const params = PaginatedAnalyticsQueryParamsSchema.parse(_params);
|
|
245
|
+
return this.api.get("/v1/analytics/tools-usage", params);
|
|
246
|
+
}
|
|
247
|
+
async getWebhooksInvocation(_params = {}) {
|
|
248
|
+
const params = PaginatedAnalyticsQueryParamsSchema.parse(_params);
|
|
249
|
+
return this.api.get("/v1/analytics/webhooks-invocation", params);
|
|
250
|
+
}
|
|
251
|
+
async getMcpServers(_params = {}) {
|
|
252
|
+
const params = PaginatedAnalyticsQueryParamsSchema.parse(_params);
|
|
253
|
+
return this.api.get("/v1/analytics/mcp-servers", params);
|
|
254
|
+
}
|
|
255
|
+
async getMcpServersByUsers(_params = {}) {
|
|
256
|
+
const params = PaginatedAnalyticsQueryParamsSchema.parse(_params);
|
|
257
|
+
return this.api.get("/v1/analytics/mcp-servers-by-users", params);
|
|
258
|
+
}
|
|
259
|
+
async getProjectsSpending(_params = {}) {
|
|
260
|
+
const params = PaginatedAnalyticsQueryParamsSchema.parse(_params);
|
|
261
|
+
return this.api.get("/v1/analytics/projects-spending", params);
|
|
262
|
+
}
|
|
263
|
+
async getLlmsUsage(_params = {}) {
|
|
264
|
+
const params = PaginatedAnalyticsQueryParamsSchema.parse(_params);
|
|
265
|
+
return this.api.get("/v1/analytics/llms-usage", params);
|
|
266
|
+
}
|
|
267
|
+
async getUsersSpending(_params = {}) {
|
|
268
|
+
const params = PaginatedAnalyticsQueryParamsSchema.parse(_params);
|
|
269
|
+
return this.api.get("/v1/analytics/users-spending", params);
|
|
270
|
+
}
|
|
271
|
+
async getBudgetSoftLimit(_params = {}) {
|
|
272
|
+
const params = PaginatedAnalyticsQueryParamsSchema.parse(_params);
|
|
273
|
+
return this.api.get("/v1/analytics/budget-soft-limit", params);
|
|
274
|
+
}
|
|
275
|
+
async getBudgetHardLimit(_params = {}) {
|
|
276
|
+
const params = PaginatedAnalyticsQueryParamsSchema.parse(_params);
|
|
277
|
+
return this.api.get("/v1/analytics/budget-hard-limit", params);
|
|
278
|
+
}
|
|
279
|
+
async getUsersActivity(_params = {}) {
|
|
280
|
+
const params = PaginatedAnalyticsQueryParamsSchema.parse(_params);
|
|
281
|
+
return this.api.get("/v1/analytics/users-activity", params);
|
|
282
|
+
}
|
|
283
|
+
async getProjectsActivity(_params = {}) {
|
|
284
|
+
const params = PaginatedAnalyticsQueryParamsSchema.parse(_params);
|
|
285
|
+
return this.api.get("/v1/analytics/projects-activity", params);
|
|
286
|
+
}
|
|
287
|
+
async getAgentsUsage(_params = {}) {
|
|
288
|
+
const params = PaginatedAnalyticsQueryParamsSchema.parse(_params);
|
|
289
|
+
return this.api.get("/v1/analytics/agents-usage", params);
|
|
290
|
+
}
|
|
291
|
+
async getCliAgents(_params = {}) {
|
|
292
|
+
const params = PaginatedAnalyticsQueryParamsSchema.parse(_params);
|
|
293
|
+
return this.api.get("/v1/analytics/cli-agents", params);
|
|
294
|
+
}
|
|
295
|
+
async getCliLlms(_params = {}) {
|
|
296
|
+
const params = PaginatedAnalyticsQueryParamsSchema.parse(_params);
|
|
297
|
+
return this.api.get("/v1/analytics/cli-llms", params);
|
|
298
|
+
}
|
|
299
|
+
async getCliUsers(_params = {}) {
|
|
300
|
+
const params = PaginatedAnalyticsQueryParamsSchema.parse(_params);
|
|
301
|
+
return this.api.get("/v1/analytics/cli-users", params);
|
|
302
|
+
}
|
|
303
|
+
async getCliErrors(_params = {}) {
|
|
304
|
+
const params = PaginatedAnalyticsQueryParamsSchema.parse(_params);
|
|
305
|
+
return this.api.get("/v1/analytics/cli-errors", params);
|
|
306
|
+
}
|
|
307
|
+
async getCliRepositories(_params = {}) {
|
|
308
|
+
const params = PaginatedAnalyticsQueryParamsSchema.parse(_params);
|
|
309
|
+
return this.api.get("/v1/analytics/cli-repositories", params);
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
// src/utils/helpers.ts
|
|
314
|
+
function omitUndefined(obj) {
|
|
315
|
+
return Object.fromEntries(Object.entries(obj).filter(([_, value]) => value !== void 0));
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// src/mappers/assistant.mapper.ts
|
|
319
|
+
var AssistantMapper = class {
|
|
320
|
+
static mapBaseModelApiResponse(response) {
|
|
321
|
+
return omitUndefined({
|
|
322
|
+
generated: response.generated,
|
|
323
|
+
time_elapsed: response.timeElapsed,
|
|
324
|
+
tokens_used: response.tokensUsed,
|
|
325
|
+
thoughts: response.thoughts,
|
|
326
|
+
task_id: response.taskId
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
// src/services/assistant.ts
|
|
332
|
+
import { z as z3 } from "zod";
|
|
333
|
+
|
|
334
|
+
// src/schemas/assistant.ts
|
|
335
|
+
import { z as z2 } from "zod";
|
|
336
|
+
var AssistantListParamsSchema = z2.object({
|
|
337
|
+
minimal_response: z2.boolean().prefault(true),
|
|
338
|
+
scope: z2.enum(["visible_to_user", "marketplace"]).prefault("visible_to_user"),
|
|
339
|
+
page: z2.number().prefault(0),
|
|
340
|
+
per_page: z2.number().prefault(12),
|
|
341
|
+
filters: z2.record(z2.string(), z2.unknown()).optional()
|
|
342
|
+
}).readonly();
|
|
343
|
+
var PromptVariableSchema = z2.object({
|
|
344
|
+
key: z2.string(),
|
|
345
|
+
description: z2.string().optional(),
|
|
346
|
+
default_value: z2.string()
|
|
347
|
+
});
|
|
348
|
+
var AssistantCreateParamsSchema = z2.object({
|
|
349
|
+
name: z2.string(),
|
|
350
|
+
description: z2.string(),
|
|
351
|
+
icon_url: z2.string().optional(),
|
|
352
|
+
system_prompt: z2.string(),
|
|
353
|
+
project: z2.string(),
|
|
354
|
+
context: z2.array(
|
|
355
|
+
z2.object({
|
|
356
|
+
context_type: z2.enum(["knowledge_base", "code"]),
|
|
357
|
+
name: z2.string()
|
|
358
|
+
})
|
|
359
|
+
),
|
|
360
|
+
llm_model_type: z2.string(),
|
|
361
|
+
toolkits: z2.array(
|
|
362
|
+
z2.object({
|
|
363
|
+
toolkit: z2.string(),
|
|
364
|
+
tools: z2.array(
|
|
365
|
+
z2.object({
|
|
366
|
+
name: z2.string(),
|
|
367
|
+
label: z2.string().optional(),
|
|
368
|
+
settings_config: z2.boolean(),
|
|
369
|
+
user_description: z2.string().optional(),
|
|
370
|
+
settings: z2.any().nullable().optional()
|
|
371
|
+
})
|
|
372
|
+
),
|
|
373
|
+
label: z2.string(),
|
|
374
|
+
settings_config: z2.boolean(),
|
|
375
|
+
is_external: z2.boolean(),
|
|
376
|
+
settings: z2.any().optional()
|
|
377
|
+
})
|
|
378
|
+
),
|
|
379
|
+
conversation_starters: z2.array(z2.string()),
|
|
380
|
+
shared: z2.boolean().optional(),
|
|
381
|
+
is_react: z2.boolean().optional(),
|
|
382
|
+
is_global: z2.boolean().optional(),
|
|
383
|
+
slug: z2.string().optional(),
|
|
384
|
+
temperature: z2.number().optional(),
|
|
385
|
+
top_p: z2.number().optional(),
|
|
386
|
+
mcp_servers: z2.array(
|
|
387
|
+
z2.object({
|
|
388
|
+
name: z2.string(),
|
|
389
|
+
description: z2.string().optional(),
|
|
390
|
+
enabled: z2.boolean(),
|
|
391
|
+
config: z2.object({
|
|
392
|
+
url: z2.string().optional(),
|
|
393
|
+
command: z2.string().optional(),
|
|
394
|
+
args: z2.array(z2.string()).optional(),
|
|
395
|
+
env: z2.record(z2.string(), z2.unknown()).optional(),
|
|
396
|
+
auth_token: z2.string().optional()
|
|
397
|
+
}).optional().refine(
|
|
398
|
+
(config) => {
|
|
399
|
+
if (!config) {
|
|
400
|
+
return true;
|
|
401
|
+
}
|
|
402
|
+
const hasUrl = !!config.url;
|
|
403
|
+
const hasCommand = !!config.command;
|
|
404
|
+
return hasUrl !== hasCommand;
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
error: "Either 'url' or 'command' must be provided in config, but not both"
|
|
408
|
+
}
|
|
409
|
+
),
|
|
410
|
+
mcp_connect_url: z2.string().optional(),
|
|
411
|
+
tools_tokens_size_limit: z2.number().optional(),
|
|
412
|
+
command: z2.string().optional(),
|
|
413
|
+
arguments: z2.string().optional(),
|
|
414
|
+
settings: z2.any().optional(),
|
|
415
|
+
mcp_connect_auth_token: z2.any().optional()
|
|
416
|
+
})
|
|
417
|
+
),
|
|
418
|
+
assistant_ids: z2.array(z2.string()),
|
|
419
|
+
prompt_variables: z2.array(PromptVariableSchema).optional().prefault([]),
|
|
420
|
+
categories: z2.array(z2.string()).max(3).optional(),
|
|
421
|
+
skip_integration_validation: z2.boolean().optional().prefault(false)
|
|
422
|
+
}).readonly();
|
|
423
|
+
var AssistantUpdateParamsSchema = AssistantCreateParamsSchema;
|
|
424
|
+
var AssistantChatParamsSchema = z2.object({
|
|
425
|
+
conversation_id: z2.string().optional(),
|
|
426
|
+
text: z2.string(),
|
|
427
|
+
content_raw: z2.string().optional(),
|
|
428
|
+
file_names: z2.array(z2.string()).optional(),
|
|
429
|
+
llm_model: z2.string().optional(),
|
|
430
|
+
history: z2.union([
|
|
431
|
+
z2.array(
|
|
432
|
+
z2.object({
|
|
433
|
+
role: z2.enum(["Assistant", "User"]),
|
|
434
|
+
message: z2.string().optional()
|
|
435
|
+
})
|
|
436
|
+
),
|
|
437
|
+
z2.string()
|
|
438
|
+
]),
|
|
439
|
+
history_index: z2.number().optional(),
|
|
440
|
+
stream: z2.boolean().optional(),
|
|
441
|
+
propagate_headers: z2.boolean().optional(),
|
|
442
|
+
custom_metadata: z2.record(z2.string(), z2.unknown()).optional(),
|
|
443
|
+
top_k: z2.number().optional(),
|
|
444
|
+
system_prompt: z2.string().optional(),
|
|
445
|
+
background_task: z2.boolean().optional(),
|
|
446
|
+
metadata: z2.record(z2.string(), z2.unknown()).optional(),
|
|
447
|
+
mcp_server_single_usage: z2.boolean().optional(),
|
|
448
|
+
save_history: z2.boolean().optional(),
|
|
449
|
+
version: z2.number().optional(),
|
|
450
|
+
output_schema: z2.union([z2.custom((val) => val instanceof z2.ZodType), z2.record(z2.string(), z2.unknown())]).optional()
|
|
451
|
+
}).readonly();
|
|
452
|
+
var AssistantVersionsListParamsSchema = z2.object({
|
|
453
|
+
page: z2.number().optional(),
|
|
454
|
+
per_page: z2.number().optional()
|
|
455
|
+
}).readonly();
|
|
456
|
+
|
|
337
457
|
// src/services/assistant.ts
|
|
338
458
|
var AssistantService = class {
|
|
339
459
|
constructor(config) {
|
|
@@ -464,9 +584,9 @@ var AssistantService = class {
|
|
|
464
584
|
async chat(assistantId, _params, headers) {
|
|
465
585
|
let zodSchema = void 0;
|
|
466
586
|
let params = { ..._params };
|
|
467
|
-
if (params.output_schema && params.output_schema instanceof
|
|
587
|
+
if (params.output_schema && params.output_schema instanceof z3.ZodType) {
|
|
468
588
|
zodSchema = params.output_schema;
|
|
469
|
-
params.output_schema =
|
|
589
|
+
params.output_schema = z3.toJSONSchema(zodSchema);
|
|
470
590
|
}
|
|
471
591
|
params = AssistantChatParamsSchema.parse(params);
|
|
472
592
|
const response = await this.api.post(
|
|
@@ -489,9 +609,9 @@ var AssistantService = class {
|
|
|
489
609
|
async chatBySlug(assistantSlug, _params, headers) {
|
|
490
610
|
let zodSchema = void 0;
|
|
491
611
|
let params = { ..._params };
|
|
492
|
-
if (params.output_schema && params.output_schema instanceof
|
|
612
|
+
if (params.output_schema && params.output_schema instanceof z3.ZodType) {
|
|
493
613
|
zodSchema = params.output_schema;
|
|
494
|
-
params.output_schema =
|
|
614
|
+
params.output_schema = z3.toJSONSchema(zodSchema);
|
|
495
615
|
}
|
|
496
616
|
params = AssistantChatParamsSchema.parse(params);
|
|
497
617
|
const response = await this.api.post(
|
|
@@ -531,9 +651,9 @@ var AssistantService = class {
|
|
|
531
651
|
async chatWithVersion(assistantId, versionNumber, _params) {
|
|
532
652
|
let zodSchema = void 0;
|
|
533
653
|
let params = { ..._params };
|
|
534
|
-
if (params.output_schema && params.output_schema instanceof
|
|
654
|
+
if (params.output_schema && params.output_schema instanceof z3.ZodType) {
|
|
535
655
|
zodSchema = params.output_schema;
|
|
536
|
-
params.output_schema =
|
|
656
|
+
params.output_schema = z3.toJSONSchema(zodSchema);
|
|
537
657
|
}
|
|
538
658
|
params = AssistantChatParamsSchema.parse(params);
|
|
539
659
|
const response = await this.api.post(
|
|
@@ -552,11 +672,11 @@ var AssistantService = class {
|
|
|
552
672
|
};
|
|
553
673
|
|
|
554
674
|
// src/schemas/conversation.ts
|
|
555
|
-
import { z as
|
|
556
|
-
var ConversationCreateParamsSchema =
|
|
557
|
-
initial_assistant_id:
|
|
558
|
-
folder:
|
|
559
|
-
mcp_server_single_usage:
|
|
675
|
+
import { z as z4 } from "zod";
|
|
676
|
+
var ConversationCreateParamsSchema = z4.object({
|
|
677
|
+
initial_assistant_id: z4.string().optional(),
|
|
678
|
+
folder: z4.string().optional(),
|
|
679
|
+
mcp_server_single_usage: z4.boolean().prefault(false).optional()
|
|
560
680
|
}).readonly();
|
|
561
681
|
|
|
562
682
|
// src/services/conversation.ts
|
|
@@ -1110,35 +1230,35 @@ var IntegrationType = {
|
|
|
1110
1230
|
};
|
|
1111
1231
|
|
|
1112
1232
|
// src/schemas/integration.ts
|
|
1113
|
-
import { z as
|
|
1114
|
-
var IntegrationListParamsSchema =
|
|
1115
|
-
setting_type:
|
|
1116
|
-
page:
|
|
1117
|
-
per_page:
|
|
1118
|
-
filters:
|
|
1233
|
+
import { z as z5 } from "zod";
|
|
1234
|
+
var IntegrationListParamsSchema = z5.object({
|
|
1235
|
+
setting_type: z5.enum([IntegrationType.USER, IntegrationType.PROJECT]).prefault(IntegrationType.USER),
|
|
1236
|
+
page: z5.number().prefault(0),
|
|
1237
|
+
per_page: z5.number().prefault(10),
|
|
1238
|
+
filters: z5.record(z5.string(), z5.unknown()).optional()
|
|
1119
1239
|
}).readonly();
|
|
1120
|
-
var IntegrationGetParamsSchema =
|
|
1121
|
-
integration_id:
|
|
1122
|
-
setting_type:
|
|
1240
|
+
var IntegrationGetParamsSchema = z5.object({
|
|
1241
|
+
integration_id: z5.string(),
|
|
1242
|
+
setting_type: z5.enum([IntegrationType.USER, IntegrationType.PROJECT]).prefault(IntegrationType.USER)
|
|
1123
1243
|
}).readonly();
|
|
1124
|
-
var IntegrationGetByAliasParamsSchema =
|
|
1125
|
-
alias:
|
|
1126
|
-
setting_type:
|
|
1244
|
+
var IntegrationGetByAliasParamsSchema = z5.object({
|
|
1245
|
+
alias: z5.string(),
|
|
1246
|
+
setting_type: z5.enum([IntegrationType.USER, IntegrationType.PROJECT]).prefault(IntegrationType.USER)
|
|
1127
1247
|
}).readonly();
|
|
1128
|
-
var CredentialValueSchema =
|
|
1129
|
-
key:
|
|
1130
|
-
value:
|
|
1248
|
+
var CredentialValueSchema = z5.object({
|
|
1249
|
+
key: z5.string(),
|
|
1250
|
+
value: z5.unknown()
|
|
1131
1251
|
});
|
|
1132
|
-
var IntegrationCreateParamsSchema =
|
|
1133
|
-
credential_type:
|
|
1134
|
-
credential_values:
|
|
1135
|
-
project_name:
|
|
1136
|
-
setting_type:
|
|
1137
|
-
alias:
|
|
1138
|
-
default:
|
|
1139
|
-
project:
|
|
1140
|
-
enabled:
|
|
1141
|
-
external_id:
|
|
1252
|
+
var IntegrationCreateParamsSchema = z5.object({
|
|
1253
|
+
credential_type: z5.enum(Object.values(CredentialTypes)),
|
|
1254
|
+
credential_values: z5.array(CredentialValueSchema),
|
|
1255
|
+
project_name: z5.string(),
|
|
1256
|
+
setting_type: z5.enum([IntegrationType.USER, IntegrationType.PROJECT]).prefault(IntegrationType.USER),
|
|
1257
|
+
alias: z5.string().optional(),
|
|
1258
|
+
default: z5.boolean().optional().prefault(false),
|
|
1259
|
+
project: z5.string().optional(),
|
|
1260
|
+
enabled: z5.boolean().optional().prefault(true),
|
|
1261
|
+
external_id: z5.string().optional()
|
|
1142
1262
|
}).readonly();
|
|
1143
1263
|
var IntegrationUpdateParamsSchema = IntegrationCreateParamsSchema;
|
|
1144
1264
|
|
|
@@ -1364,7 +1484,7 @@ var CategoryService = class {
|
|
|
1364
1484
|
};
|
|
1365
1485
|
|
|
1366
1486
|
// src/schemas/skill.ts
|
|
1367
|
-
import { z as
|
|
1487
|
+
import { z as z6 } from "zod";
|
|
1368
1488
|
|
|
1369
1489
|
// src/models/skill.ts
|
|
1370
1490
|
var SkillVisibility = /* @__PURE__ */ ((SkillVisibility2) => {
|
|
@@ -1416,13 +1536,13 @@ var SkillCategory = /* @__PURE__ */ ((SkillCategory2) => {
|
|
|
1416
1536
|
})(SkillCategory || {});
|
|
1417
1537
|
|
|
1418
1538
|
// src/schemas/skill.ts
|
|
1419
|
-
var SkillListParamsSchema =
|
|
1420
|
-
page:
|
|
1421
|
-
per_page:
|
|
1422
|
-
filters:
|
|
1423
|
-
sort_by:
|
|
1424
|
-
scope:
|
|
1425
|
-
assistant_id:
|
|
1539
|
+
var SkillListParamsSchema = z6.object({
|
|
1540
|
+
page: z6.number().default(0),
|
|
1541
|
+
per_page: z6.number().default(20),
|
|
1542
|
+
filters: z6.record(z6.string(), z6.unknown()).optional(),
|
|
1543
|
+
sort_by: z6.nativeEnum(SkillSortBy).optional(),
|
|
1544
|
+
scope: z6.nativeEnum(SkillScopeFilter).optional(),
|
|
1545
|
+
assistant_id: z6.string().optional()
|
|
1426
1546
|
}).readonly();
|
|
1427
1547
|
|
|
1428
1548
|
// src/services/skill.ts
|
|
@@ -1589,7 +1709,7 @@ var WorkflowMapper = class {
|
|
|
1589
1709
|
};
|
|
1590
1710
|
|
|
1591
1711
|
// src/schemas/workflow.ts
|
|
1592
|
-
import { z as
|
|
1712
|
+
import { z as z7 } from "zod";
|
|
1593
1713
|
|
|
1594
1714
|
// src/models/workflow.ts
|
|
1595
1715
|
var WorkflowMode = {
|
|
@@ -1606,50 +1726,50 @@ var ExecutionStatus = {
|
|
|
1606
1726
|
};
|
|
1607
1727
|
|
|
1608
1728
|
// src/schemas/workflow.ts
|
|
1609
|
-
var WorkflowListParamsSchema =
|
|
1610
|
-
page:
|
|
1611
|
-
per_page:
|
|
1612
|
-
projects:
|
|
1613
|
-
search:
|
|
1729
|
+
var WorkflowListParamsSchema = z7.object({
|
|
1730
|
+
page: z7.number().prefault(0),
|
|
1731
|
+
per_page: z7.number().prefault(10),
|
|
1732
|
+
projects: z7.array(z7.string()).optional(),
|
|
1733
|
+
search: z7.string().optional()
|
|
1614
1734
|
}).readonly();
|
|
1615
|
-
var WorkflowCreateParamsSchema =
|
|
1616
|
-
project:
|
|
1617
|
-
name:
|
|
1618
|
-
description:
|
|
1619
|
-
yaml_config:
|
|
1620
|
-
mode:
|
|
1621
|
-
shared:
|
|
1622
|
-
icon_url:
|
|
1735
|
+
var WorkflowCreateParamsSchema = z7.object({
|
|
1736
|
+
project: z7.string(),
|
|
1737
|
+
name: z7.string(),
|
|
1738
|
+
description: z7.string().optional(),
|
|
1739
|
+
yaml_config: z7.string(),
|
|
1740
|
+
mode: z7.enum([WorkflowMode.SEQUENTIAL, WorkflowMode.AUTONOMOUS]),
|
|
1741
|
+
shared: z7.boolean(),
|
|
1742
|
+
icon_url: z7.string().optional()
|
|
1623
1743
|
}).readonly();
|
|
1624
|
-
var WorkflowUpdateParamsSchema =
|
|
1625
|
-
project:
|
|
1626
|
-
name:
|
|
1627
|
-
description:
|
|
1628
|
-
yaml_config:
|
|
1629
|
-
mode:
|
|
1630
|
-
shared:
|
|
1631
|
-
icon_url:
|
|
1744
|
+
var WorkflowUpdateParamsSchema = z7.object({
|
|
1745
|
+
project: z7.string(),
|
|
1746
|
+
name: z7.string(),
|
|
1747
|
+
description: z7.string().optional(),
|
|
1748
|
+
yaml_config: z7.string(),
|
|
1749
|
+
mode: z7.enum([WorkflowMode.SEQUENTIAL, WorkflowMode.AUTONOMOUS]).optional(),
|
|
1750
|
+
shared: z7.boolean().optional(),
|
|
1751
|
+
icon_url: z7.string().optional()
|
|
1632
1752
|
}).readonly();
|
|
1633
|
-
var WorkflowExecutionListParamsSchema =
|
|
1634
|
-
page:
|
|
1635
|
-
per_page:
|
|
1753
|
+
var WorkflowExecutionListParamsSchema = z7.object({
|
|
1754
|
+
page: z7.number().prefault(0),
|
|
1755
|
+
per_page: z7.number().prefault(10)
|
|
1636
1756
|
}).readonly();
|
|
1637
|
-
var WorkflowExecutionCreateParamsSchema =
|
|
1638
|
-
user_input:
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1757
|
+
var WorkflowExecutionCreateParamsSchema = z7.object({
|
|
1758
|
+
user_input: z7.union([
|
|
1759
|
+
z7.string(),
|
|
1760
|
+
z7.record(z7.string(), z7.unknown()),
|
|
1761
|
+
z7.array(z7.unknown()),
|
|
1762
|
+
z7.number(),
|
|
1763
|
+
z7.boolean()
|
|
1644
1764
|
]).optional(),
|
|
1645
|
-
file_name:
|
|
1646
|
-
session_id:
|
|
1647
|
-
propagate_headers:
|
|
1648
|
-
tags:
|
|
1765
|
+
file_name: z7.string().optional(),
|
|
1766
|
+
session_id: z7.string().optional(),
|
|
1767
|
+
propagate_headers: z7.boolean().optional(),
|
|
1768
|
+
tags: z7.array(z7.string()).optional()
|
|
1649
1769
|
}).readonly();
|
|
1650
|
-
var WorkflowExecutionStateListParamsSchema =
|
|
1651
|
-
page:
|
|
1652
|
-
per_page:
|
|
1770
|
+
var WorkflowExecutionStateListParamsSchema = z7.object({
|
|
1771
|
+
page: z7.number().prefault(0),
|
|
1772
|
+
per_page: z7.number().prefault(10)
|
|
1653
1773
|
}).readonly();
|
|
1654
1774
|
|
|
1655
1775
|
// src/services/workflow_execution_state.ts
|
|
@@ -1886,6 +2006,7 @@ var CodeMieClient = class {
|
|
|
1886
2006
|
verifySSL: this.verifySSL,
|
|
1887
2007
|
cookies: this.cookies
|
|
1888
2008
|
};
|
|
2009
|
+
this._analytics = new AnalyticsService(authConfig);
|
|
1889
2010
|
this._assistants = new AssistantService(authConfig);
|
|
1890
2011
|
this._conversations = new ConversationService(authConfig);
|
|
1891
2012
|
this._datasources = new DatasourceService(authConfig);
|
|
@@ -1898,6 +2019,12 @@ var CodeMieClient = class {
|
|
|
1898
2019
|
this._skills = new SkillService(authConfig);
|
|
1899
2020
|
this._workflows = new WorkflowService(authConfig);
|
|
1900
2021
|
}
|
|
2022
|
+
/**
|
|
2023
|
+
* Get the AnalyticsService instance.
|
|
2024
|
+
*/
|
|
2025
|
+
get analytics() {
|
|
2026
|
+
return this._analytics;
|
|
2027
|
+
}
|
|
1901
2028
|
/**
|
|
1902
2029
|
* Get the AssistantService instance.
|
|
1903
2030
|
*/
|
|
@@ -2027,6 +2154,7 @@ var CodeMieClient = class {
|
|
|
2027
2154
|
verifySSL: this.verifySSL,
|
|
2028
2155
|
cookies: this.cookies
|
|
2029
2156
|
};
|
|
2157
|
+
this._analytics = new AnalyticsService(authConfig);
|
|
2030
2158
|
this._assistants = new AssistantService(authConfig);
|
|
2031
2159
|
this._conversations = new ConversationService(authConfig);
|
|
2032
2160
|
this._datasources = new DatasourceService(authConfig);
|
|
@@ -2204,6 +2332,8 @@ var BackgroundTaskStatus = {
|
|
|
2204
2332
|
FAILED: "FAILED"
|
|
2205
2333
|
};
|
|
2206
2334
|
export {
|
|
2335
|
+
AnalyticsQueryParamsSchema,
|
|
2336
|
+
AnalyticsService,
|
|
2207
2337
|
ApiError,
|
|
2208
2338
|
AssistantChatParamsSchema,
|
|
2209
2339
|
AssistantCreateParamsSchema,
|
|
@@ -2241,11 +2371,13 @@ export {
|
|
|
2241
2371
|
LLMProvider,
|
|
2242
2372
|
LLMService,
|
|
2243
2373
|
NotFoundError,
|
|
2374
|
+
PaginatedAnalyticsQueryParamsSchema,
|
|
2244
2375
|
SkillCategory,
|
|
2245
2376
|
SkillScopeFilter,
|
|
2246
2377
|
SkillService,
|
|
2247
2378
|
SkillSortBy,
|
|
2248
2379
|
SkillVisibility,
|
|
2380
|
+
TIME_PERIOD_VALUES,
|
|
2249
2381
|
TaskService,
|
|
2250
2382
|
UserService,
|
|
2251
2383
|
WorkflowCreateParamsSchema,
|