@ptkl/sdk 1.9.2 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.0.10.js +283 -78
- package/dist/package.json +1 -1
- package/dist/v0.10/api/component.d.ts +7 -2
- package/dist/v0.10/api/index.d.ts +4 -0
- package/dist/v0.10/api/integrations/dms.d.ts +3 -1
- package/dist/v0.10/api/integrations/timber.d.ts +22 -0
- package/dist/v0.10/api/integrations.d.ts +2 -0
- package/dist/v0.10/api/kortex.d.ts +52 -0
- package/dist/v0.10/api/platform.d.ts +2 -0
- package/dist/v0.10/api/thunder.d.ts +5 -4
- package/dist/v0.10/index.cjs.js +283 -78
- package/dist/v0.10/index.esm.js +282 -79
- package/dist/v0.10/types/component.d.ts +25 -2
- package/dist/v0.10/types/integrations.d.ts +6 -0
- package/dist/v0.10/types/kortex.d.ts +294 -0
- package/dist/v0.10/types/thunder.d.ts +4 -0
- package/dist/v0.10/types/timber.d.ts +77 -0
- package/package.json +1 -1
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
type PagedResponse<T> = {
|
|
2
|
+
data: T[];
|
|
3
|
+
total: number;
|
|
4
|
+
page: number;
|
|
5
|
+
limit: number;
|
|
6
|
+
};
|
|
7
|
+
type PaginationParams = {
|
|
8
|
+
limit?: number;
|
|
9
|
+
page?: number;
|
|
10
|
+
};
|
|
11
|
+
type RAGConfig = {
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
top_k: number;
|
|
14
|
+
score_threshold: number;
|
|
15
|
+
};
|
|
16
|
+
type LLMSettings = {
|
|
17
|
+
temperature?: number;
|
|
18
|
+
top_p?: number;
|
|
19
|
+
top_k?: number;
|
|
20
|
+
max_tokens?: number;
|
|
21
|
+
};
|
|
22
|
+
type Agent = {
|
|
23
|
+
uuid: string;
|
|
24
|
+
project_uuid: string;
|
|
25
|
+
name: string;
|
|
26
|
+
description: string;
|
|
27
|
+
system_prompt: string;
|
|
28
|
+
knowledge_bases: string[];
|
|
29
|
+
rag_config: RAGConfig;
|
|
30
|
+
llm_settings: LLMSettings;
|
|
31
|
+
model_tier: string;
|
|
32
|
+
status: string;
|
|
33
|
+
created_at: string;
|
|
34
|
+
updated_at: string;
|
|
35
|
+
};
|
|
36
|
+
type AgentCreatePayload = {
|
|
37
|
+
name: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
system_prompt?: string;
|
|
40
|
+
knowledge_bases?: string[];
|
|
41
|
+
rag_config?: RAGConfig;
|
|
42
|
+
llm_settings?: LLMSettings;
|
|
43
|
+
model_tier?: string;
|
|
44
|
+
};
|
|
45
|
+
type AgentUpdatePayload = {
|
|
46
|
+
name?: string;
|
|
47
|
+
description?: string;
|
|
48
|
+
system_prompt?: string;
|
|
49
|
+
knowledge_bases?: string[];
|
|
50
|
+
rag_config?: RAGConfig;
|
|
51
|
+
llm_settings?: LLMSettings;
|
|
52
|
+
model_tier?: string;
|
|
53
|
+
};
|
|
54
|
+
type ChunkingStrategy = {
|
|
55
|
+
chunk_size: number;
|
|
56
|
+
chunk_overlap: number;
|
|
57
|
+
};
|
|
58
|
+
type KnowledgeBase = {
|
|
59
|
+
uuid: string;
|
|
60
|
+
project_uuid: string;
|
|
61
|
+
name: string;
|
|
62
|
+
description: string;
|
|
63
|
+
chunking_strategy: ChunkingStrategy;
|
|
64
|
+
document_count: number;
|
|
65
|
+
chunk_count: number;
|
|
66
|
+
total_size: number;
|
|
67
|
+
status: string;
|
|
68
|
+
created_at: string;
|
|
69
|
+
updated_at: string;
|
|
70
|
+
};
|
|
71
|
+
type KnowledgeBaseCreatePayload = {
|
|
72
|
+
name: string;
|
|
73
|
+
description?: string;
|
|
74
|
+
chunking_strategy?: ChunkingStrategy;
|
|
75
|
+
};
|
|
76
|
+
type KnowledgeBaseUpdatePayload = {
|
|
77
|
+
name?: string;
|
|
78
|
+
description?: string;
|
|
79
|
+
chunking_strategy?: ChunkingStrategy;
|
|
80
|
+
};
|
|
81
|
+
type Document = {
|
|
82
|
+
uuid: string;
|
|
83
|
+
project_uuid: string;
|
|
84
|
+
knowledge_base_uuid: string;
|
|
85
|
+
name: string;
|
|
86
|
+
content_type: string;
|
|
87
|
+
size: number;
|
|
88
|
+
processing_status: string;
|
|
89
|
+
processing_error?: string;
|
|
90
|
+
retry_count: number;
|
|
91
|
+
created_at: string;
|
|
92
|
+
updated_at: string;
|
|
93
|
+
};
|
|
94
|
+
type Participant = {
|
|
95
|
+
agent_uuid: string;
|
|
96
|
+
name: string;
|
|
97
|
+
mode: string;
|
|
98
|
+
instructions_override?: string;
|
|
99
|
+
};
|
|
100
|
+
type TokenUsage = {
|
|
101
|
+
prompt_tokens: number;
|
|
102
|
+
completion_tokens: number;
|
|
103
|
+
total_tokens: number;
|
|
104
|
+
};
|
|
105
|
+
type ToolCall = {
|
|
106
|
+
id: string;
|
|
107
|
+
type: string;
|
|
108
|
+
function: {
|
|
109
|
+
name: string;
|
|
110
|
+
arguments: string;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
type RAGSource = {
|
|
114
|
+
document_uuid: string;
|
|
115
|
+
document_name: string;
|
|
116
|
+
chunk_index: number;
|
|
117
|
+
score: number;
|
|
118
|
+
content: string;
|
|
119
|
+
};
|
|
120
|
+
type Message = {
|
|
121
|
+
uuid: string;
|
|
122
|
+
conversation_uuid: string;
|
|
123
|
+
project_uuid: string;
|
|
124
|
+
role: string;
|
|
125
|
+
content: string;
|
|
126
|
+
agent_uuid?: string;
|
|
127
|
+
tool_calls?: ToolCall[];
|
|
128
|
+
tool_call_id?: string;
|
|
129
|
+
rag_sources?: RAGSource[];
|
|
130
|
+
token_usage: TokenUsage;
|
|
131
|
+
created_at: string;
|
|
132
|
+
};
|
|
133
|
+
type Conversation = {
|
|
134
|
+
uuid: string;
|
|
135
|
+
project_uuid: string;
|
|
136
|
+
user_uuid: string;
|
|
137
|
+
title: string;
|
|
138
|
+
agent_uuid?: string;
|
|
139
|
+
tier: string;
|
|
140
|
+
participants?: Participant[];
|
|
141
|
+
message_count: number;
|
|
142
|
+
tokens_used: number;
|
|
143
|
+
archived_at?: string;
|
|
144
|
+
created_at: string;
|
|
145
|
+
updated_at: string;
|
|
146
|
+
};
|
|
147
|
+
type ConversationCreatePayload = {
|
|
148
|
+
title?: string;
|
|
149
|
+
agent_uuid?: string;
|
|
150
|
+
};
|
|
151
|
+
type ConversationUpdatePayload = {
|
|
152
|
+
title?: string;
|
|
153
|
+
agent_uuid?: string;
|
|
154
|
+
};
|
|
155
|
+
type ParticipantAddPayload = {
|
|
156
|
+
agent_uuid: string;
|
|
157
|
+
name?: string;
|
|
158
|
+
mode?: string;
|
|
159
|
+
instructions_override?: string;
|
|
160
|
+
};
|
|
161
|
+
type ToolResultApproval = {
|
|
162
|
+
approved: boolean;
|
|
163
|
+
mode?: string;
|
|
164
|
+
};
|
|
165
|
+
type ToolResultPayload = {
|
|
166
|
+
tool_call_id: string;
|
|
167
|
+
name?: string;
|
|
168
|
+
content: string;
|
|
169
|
+
approval?: ToolResultApproval;
|
|
170
|
+
};
|
|
171
|
+
type PageContext = {
|
|
172
|
+
label: string;
|
|
173
|
+
description?: string;
|
|
174
|
+
icon?: string;
|
|
175
|
+
};
|
|
176
|
+
type SendMessagePayload = {
|
|
177
|
+
content: string;
|
|
178
|
+
agent_uuid?: string;
|
|
179
|
+
images?: string[];
|
|
180
|
+
stream?: boolean;
|
|
181
|
+
tools?: Record<string, any>[];
|
|
182
|
+
tool_results?: ToolResultPayload[];
|
|
183
|
+
page_context?: PageContext;
|
|
184
|
+
};
|
|
185
|
+
type InjectMessagePayload = {
|
|
186
|
+
role: string;
|
|
187
|
+
content: string;
|
|
188
|
+
};
|
|
189
|
+
type OCRPayload = {
|
|
190
|
+
file_name: string;
|
|
191
|
+
file_data: string;
|
|
192
|
+
content_type: string;
|
|
193
|
+
};
|
|
194
|
+
type OCRResult = {
|
|
195
|
+
text: string;
|
|
196
|
+
char_count: number;
|
|
197
|
+
};
|
|
198
|
+
type UserAccess = {
|
|
199
|
+
uuid: string;
|
|
200
|
+
project_uuid: string;
|
|
201
|
+
user_uuid: string;
|
|
202
|
+
credit_limit: number;
|
|
203
|
+
allowed_agent_uuids: string[];
|
|
204
|
+
status: string;
|
|
205
|
+
created_at: string;
|
|
206
|
+
updated_at: string;
|
|
207
|
+
};
|
|
208
|
+
type UserAccessCreatePayload = {
|
|
209
|
+
user_uuid: string;
|
|
210
|
+
credit_limit: number;
|
|
211
|
+
allowed_agent_uuids?: string[];
|
|
212
|
+
};
|
|
213
|
+
type UserAccessUpdatePayload = {
|
|
214
|
+
credit_limit?: number;
|
|
215
|
+
allowed_agent_uuids?: string[];
|
|
216
|
+
status?: string;
|
|
217
|
+
};
|
|
218
|
+
type TopUpPayload = {
|
|
219
|
+
amount: number;
|
|
220
|
+
reason?: string;
|
|
221
|
+
};
|
|
222
|
+
type UserMonthlyUsage = {
|
|
223
|
+
user_uuid: string;
|
|
224
|
+
year: number;
|
|
225
|
+
month: number;
|
|
226
|
+
credits_used: number;
|
|
227
|
+
credit_limit: number;
|
|
228
|
+
};
|
|
229
|
+
type UserUsageBreakdown = {
|
|
230
|
+
user_uuid: string;
|
|
231
|
+
credit_limit: number;
|
|
232
|
+
breakdown: {
|
|
233
|
+
year: number;
|
|
234
|
+
month: number;
|
|
235
|
+
credits: number;
|
|
236
|
+
}[];
|
|
237
|
+
};
|
|
238
|
+
type MyAccess = {
|
|
239
|
+
uuid: string;
|
|
240
|
+
project_uuid: string;
|
|
241
|
+
user_uuid: string;
|
|
242
|
+
credit_limit: number;
|
|
243
|
+
allowed_agent_uuids: string[];
|
|
244
|
+
status: string;
|
|
245
|
+
created_at: string;
|
|
246
|
+
updated_at: string;
|
|
247
|
+
credits_used: number;
|
|
248
|
+
is_admin?: boolean;
|
|
249
|
+
};
|
|
250
|
+
type AggregatedUsage = {
|
|
251
|
+
user_uuid: string;
|
|
252
|
+
model_tier: string;
|
|
253
|
+
prompt_tokens: number;
|
|
254
|
+
completion_tokens: number;
|
|
255
|
+
ocr_seconds: number;
|
|
256
|
+
credits: number;
|
|
257
|
+
billing_type: string;
|
|
258
|
+
created_at: string;
|
|
259
|
+
};
|
|
260
|
+
type Tier = {
|
|
261
|
+
tier: string;
|
|
262
|
+
can_create_agents: boolean;
|
|
263
|
+
can_create_kbs: boolean;
|
|
264
|
+
can_use_workflows: boolean;
|
|
265
|
+
can_assign_agents: boolean;
|
|
266
|
+
can_assign_users: boolean;
|
|
267
|
+
can_choose_model: boolean;
|
|
268
|
+
kb_ocr_seconds: number;
|
|
269
|
+
max_agents: number;
|
|
270
|
+
max_kbs: number;
|
|
271
|
+
max_msg_per_day: number;
|
|
272
|
+
max_msg_per_min: number;
|
|
273
|
+
max_storage_bytes: number;
|
|
274
|
+
max_users: number;
|
|
275
|
+
};
|
|
276
|
+
type KortexWorkflowMessage = {
|
|
277
|
+
role: string;
|
|
278
|
+
content: string;
|
|
279
|
+
};
|
|
280
|
+
type KortexWorkflowPayload = {
|
|
281
|
+
agent_uuid?: string;
|
|
282
|
+
system_prompt?: string;
|
|
283
|
+
response_format?: string;
|
|
284
|
+
messages: KortexWorkflowMessage[];
|
|
285
|
+
stream?: boolean;
|
|
286
|
+
temperature?: number;
|
|
287
|
+
max_tokens?: number;
|
|
288
|
+
tools?: Record<string, any>[];
|
|
289
|
+
};
|
|
290
|
+
type KortexWorkflowResult = {
|
|
291
|
+
content: string;
|
|
292
|
+
usage: TokenUsage;
|
|
293
|
+
};
|
|
294
|
+
export { PagedResponse, PaginationParams, RAGConfig, LLMSettings, Agent, AgentCreatePayload, AgentUpdatePayload, ChunkingStrategy, KnowledgeBase, KnowledgeBaseCreatePayload, KnowledgeBaseUpdatePayload, Document, Participant, TokenUsage, ToolCall, RAGSource, Message, Conversation, ConversationCreatePayload, ConversationUpdatePayload, ParticipantAddPayload, ToolResultApproval, ToolResultPayload, PageContext, SendMessagePayload, InjectMessagePayload, OCRPayload, OCRResult, UserAccess, UserAccessCreatePayload, UserAccessUpdatePayload, TopUpPayload, UserMonthlyUsage, UserUsageBreakdown, MyAccess, AggregatedUsage, Tier, KortexWorkflowMessage, KortexWorkflowPayload, KortexWorkflowResult, };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export type TimberSource = 'system' | 'user';
|
|
2
|
+
export type TimberLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
3
|
+
export type TimberActorType = 'user' | 'api_key' | 'service' | 'system';
|
|
4
|
+
export interface TimberActor {
|
|
5
|
+
type: TimberActorType;
|
|
6
|
+
id: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
ip?: string;
|
|
9
|
+
user_agent?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface TimberChanges {
|
|
12
|
+
before?: Record<string, any>;
|
|
13
|
+
after?: Record<string, any>;
|
|
14
|
+
}
|
|
15
|
+
export interface TimberEntry {
|
|
16
|
+
id: string;
|
|
17
|
+
timestamp: string;
|
|
18
|
+
source: TimberSource;
|
|
19
|
+
level: TimberLevel;
|
|
20
|
+
service: string;
|
|
21
|
+
project_uuid: string;
|
|
22
|
+
actor: TimberActor;
|
|
23
|
+
action?: string;
|
|
24
|
+
resource_type?: string;
|
|
25
|
+
resource_id?: string;
|
|
26
|
+
resource_name?: string;
|
|
27
|
+
message?: string;
|
|
28
|
+
changes?: TimberChanges;
|
|
29
|
+
attributes?: Record<string, any>;
|
|
30
|
+
trace_id?: string;
|
|
31
|
+
span_id?: string;
|
|
32
|
+
request_id?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface TimberQueryParams {
|
|
35
|
+
limit?: number;
|
|
36
|
+
cursor?: string;
|
|
37
|
+
source?: TimberSource;
|
|
38
|
+
level?: TimberLevel;
|
|
39
|
+
from?: string | Date;
|
|
40
|
+
to?: string | Date;
|
|
41
|
+
actor_id?: string;
|
|
42
|
+
actor_name?: string;
|
|
43
|
+
actor_type?: TimberActorType;
|
|
44
|
+
action?: string;
|
|
45
|
+
resource_type?: string;
|
|
46
|
+
resource_id?: string;
|
|
47
|
+
request_uuid?: string;
|
|
48
|
+
search?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface TimberQueryResponse {
|
|
51
|
+
data: TimberEntry[];
|
|
52
|
+
meta: {
|
|
53
|
+
limit: number;
|
|
54
|
+
has_more: boolean;
|
|
55
|
+
next_cursor?: string;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export interface TimberWritePayload {
|
|
59
|
+
level?: TimberLevel;
|
|
60
|
+
message: string;
|
|
61
|
+
service?: string;
|
|
62
|
+
resource_type?: string;
|
|
63
|
+
resource_id?: string;
|
|
64
|
+
resource_name?: string;
|
|
65
|
+
attributes?: Record<string, any>;
|
|
66
|
+
trace_id?: string;
|
|
67
|
+
span_id?: string;
|
|
68
|
+
request_id?: string;
|
|
69
|
+
}
|
|
70
|
+
export type TimberLogPayload = Omit<TimberWritePayload, 'level'>;
|
|
71
|
+
export interface TimberUsage {
|
|
72
|
+
tier: 'free' | 'pro' | string;
|
|
73
|
+
period?: string;
|
|
74
|
+
bytes_ingested?: number;
|
|
75
|
+
gb_ingested?: number;
|
|
76
|
+
[key: string]: any;
|
|
77
|
+
}
|