@recursorsdk/sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,386 @@
1
+ export interface IntentResponse {
2
+ action: string;
3
+ scope: string[];
4
+ constraints: Record<string, unknown>;
5
+ quality: string;
6
+ preserve_existing: boolean;
7
+ similar_past_requests: string[];
8
+ }
9
+ export interface ChatMessage {
10
+ role: string;
11
+ content: string;
12
+ }
13
+ export interface ChatGatewayResponse {
14
+ policy: Record<string, unknown>;
15
+ normalized_messages: ChatMessage[];
16
+ provider_response?: Record<string, unknown>;
17
+ }
18
+ export interface RoboticsGatewayResponse {
19
+ policy: Record<string, unknown>;
20
+ result: Record<string, unknown>;
21
+ }
22
+ export interface AVGatewayResponse {
23
+ policy: Record<string, unknown>;
24
+ result: Record<string, unknown>;
25
+ }
26
+ export interface IntentHistoryItem {
27
+ id: string;
28
+ text: string;
29
+ created_at: string;
30
+ project_id?: string | null;
31
+ tags?: string[];
32
+ }
33
+ export interface CorrectionResponseList {
34
+ corrections: unknown[];
35
+ total: number;
36
+ page: number;
37
+ page_size: number;
38
+ }
39
+ export interface UserRegister {
40
+ email: string;
41
+ password: string;
42
+ full_name?: string;
43
+ username: string;
44
+ }
45
+ export interface UserLogin {
46
+ email: string;
47
+ password: string;
48
+ }
49
+ export interface TokenResponse {
50
+ access_token: string;
51
+ refresh_token?: string;
52
+ token_type: string;
53
+ expires_in: number;
54
+ }
55
+ export interface UserProfile {
56
+ id: string;
57
+ email: string;
58
+ username: string;
59
+ full_name?: string;
60
+ role: string;
61
+ is_active: boolean;
62
+ is_verified: boolean;
63
+ created_at: string;
64
+ last_login?: string;
65
+ }
66
+ export interface UserResponse {
67
+ id: string;
68
+ email: string;
69
+ username: string;
70
+ full_name?: string;
71
+ created_at: string;
72
+ }
73
+ export interface UserUpdate {
74
+ full_name?: string;
75
+ username?: string;
76
+ }
77
+ export interface PasswordChange {
78
+ current_password: string;
79
+ new_password: string;
80
+ }
81
+ export interface APIKeyResponse {
82
+ api_key: string;
83
+ created_at: string;
84
+ }
85
+ export interface ProjectCreate {
86
+ name: string;
87
+ description?: string;
88
+ organization_id: string;
89
+ settings?: Record<string, unknown>;
90
+ }
91
+ export interface ProjectUpdate {
92
+ name?: string;
93
+ description?: string;
94
+ settings?: Record<string, unknown>;
95
+ is_active?: boolean;
96
+ }
97
+ export interface ProjectResponse {
98
+ id: string;
99
+ name: string;
100
+ description?: string;
101
+ organization_id: string;
102
+ created_by?: string;
103
+ api_key?: string;
104
+ is_active: boolean;
105
+ created_at: string;
106
+ updated_at: string;
107
+ settings?: Record<string, unknown>;
108
+ }
109
+ export interface OrganizationCreate {
110
+ name: string;
111
+ description?: string;
112
+ }
113
+ export interface OrganizationUpdate {
114
+ name?: string;
115
+ description?: string;
116
+ }
117
+ export interface OrganizationResponse {
118
+ id: string;
119
+ name: string;
120
+ slug: string;
121
+ description?: string;
122
+ created_by: string;
123
+ created_at: string;
124
+ updated_at: string;
125
+ }
126
+ export interface UsageStatsResponse {
127
+ api_calls: {
128
+ used: number;
129
+ limit: number;
130
+ percentage: number;
131
+ };
132
+ corrections: {
133
+ used: number;
134
+ limit: number;
135
+ percentage: number;
136
+ };
137
+ storage_gb: {
138
+ used: number;
139
+ limit: number;
140
+ percentage: number;
141
+ };
142
+ llm_tokens: {
143
+ used: number;
144
+ limit: number;
145
+ percentage: number;
146
+ };
147
+ cost: {
148
+ current_period: number;
149
+ estimated_monthly: number;
150
+ };
151
+ subscription: {
152
+ plan_name: string;
153
+ status: string;
154
+ billing_period: string;
155
+ };
156
+ }
157
+ export interface BillingPlanResponse {
158
+ id: string;
159
+ name: string;
160
+ slug: string;
161
+ description: string;
162
+ price_monthly: number;
163
+ price_yearly: number;
164
+ features: string[];
165
+ }
166
+ export interface NotificationResponse {
167
+ id: string;
168
+ type: string;
169
+ title: string;
170
+ message: string;
171
+ is_read: boolean;
172
+ created_at: string;
173
+ }
174
+ export type { WebSocketMessage, WebSocketEventHandler } from "./websocket.js";
175
+ export { RecursorWebSocket } from "./websocket.js";
176
+ export declare class RecursorSDK {
177
+ private baseUrl;
178
+ private apiKey?;
179
+ private accessToken?;
180
+ private timeoutMs;
181
+ private wsClient?;
182
+ constructor(options?: {
183
+ baseUrl?: string;
184
+ apiKey?: string;
185
+ accessToken?: string;
186
+ timeoutMs?: number;
187
+ });
188
+ setAccessToken(token: string): void;
189
+ setApiKey(key: string): void;
190
+ private headers;
191
+ private get;
192
+ private post;
193
+ private put;
194
+ private patch;
195
+ private delete;
196
+ checkHealth(): Promise<boolean>;
197
+ detectIntent(args: {
198
+ user_request: string;
199
+ current_file?: string;
200
+ user_id?: string;
201
+ project_id?: string;
202
+ tags?: string[];
203
+ similar_limit?: number;
204
+ organization_id?: string;
205
+ }): Promise<IntentResponse>;
206
+ getLLMGatewayPolicy(): Promise<Record<string, unknown>>;
207
+ gatewayChat(args: {
208
+ provider?: string;
209
+ model?: string;
210
+ messages: ChatMessage[];
211
+ call_provider?: boolean;
212
+ user_id?: string;
213
+ organization_id?: string;
214
+ }): Promise<ChatGatewayResponse>;
215
+ getRoboticsGatewayPolicy(): Promise<Record<string, unknown>>;
216
+ roboticsGatewayObserve(args: {
217
+ state: Record<string, unknown>;
218
+ command?: Record<string, unknown>;
219
+ environment?: Record<string, unknown>[];
220
+ user_id?: string;
221
+ organization_id?: string;
222
+ }): Promise<RoboticsGatewayResponse>;
223
+ getAvGatewayPolicy(): Promise<Record<string, unknown>>;
224
+ avGatewayObserve(args: {
225
+ sensors: Record<string, unknown>;
226
+ state: Record<string, unknown>;
227
+ action: Record<string, unknown>;
228
+ timestamp: number;
229
+ vehicle_id: string;
230
+ user_id?: string;
231
+ organization_id?: string;
232
+ }): Promise<AVGatewayResponse>;
233
+ getIntentHistory(limit?: number, project_id?: string): Promise<IntentHistoryItem[]>;
234
+ createCorrection(args: {
235
+ input_text: string;
236
+ output_text: string;
237
+ expected_output?: string;
238
+ context?: Record<string, unknown>;
239
+ correction_type?: string;
240
+ organization_id?: string;
241
+ }): Promise<Record<string, unknown>>;
242
+ listCorrections(args?: {
243
+ page?: number;
244
+ page_size?: number;
245
+ include_inactive?: boolean;
246
+ organization_id?: string;
247
+ }): Promise<CorrectionResponseList>;
248
+ searchCorrections(query: string, limit?: number, organization_id?: string): Promise<CorrectionResponseList>;
249
+ getAnalyticsDashboard(user_id: string, period?: string, project_id?: string): Promise<Record<string, unknown>>;
250
+ getTimeSaved(user_id: string, period?: string, project_id?: string): Promise<Record<string, unknown>>;
251
+ getQualityMetrics(user_id: string, period?: string, project_id?: string): Promise<Record<string, unknown>>;
252
+ getAIAgentMetrics(user_id: string, project_id?: string): Promise<Record<string, unknown>>;
253
+ correctCode(code: string, language: string, project_profile?: Record<string, unknown>): Promise<Record<string, unknown>>;
254
+ correctConfig(config: string, config_type: string): Promise<Record<string, unknown>>;
255
+ correctDocumentation(markdown: string, doc_type?: string): Promise<Record<string, unknown>>;
256
+ applyAutoCorrections(user_id: string, model_name: string, corrections: Array<Record<string, unknown>>): Promise<Record<string, unknown>>;
257
+ getTrustScore(user_id: string, model_name: string): Promise<number>;
258
+ submitFeedback(prediction_id: string, accepted: boolean): Promise<void>;
259
+ getAutoCorrectStats(user_id: string): Promise<Record<string, unknown>>;
260
+ getPatterns(user_id?: string): Promise<Array<Record<string, unknown>>>;
261
+ register(userData: UserRegister): Promise<UserResponse>;
262
+ login(credentials: UserLogin): Promise<TokenResponse>;
263
+ logout(): Promise<void>;
264
+ refreshToken(refreshToken: string): Promise<TokenResponse>;
265
+ getProfile(): Promise<UserProfile>;
266
+ updateProfile(updates: UserUpdate): Promise<UserProfile>;
267
+ changePassword(passwordChange: PasswordChange): Promise<void>;
268
+ generateApiKey(): Promise<APIKeyResponse>;
269
+ revokeApiKey(): Promise<void>;
270
+ getPasswordRequirements(): Promise<{
271
+ requirements: string[];
272
+ min_length: number;
273
+ max_length: number;
274
+ }>;
275
+ createProject(projectData: ProjectCreate): Promise<ProjectResponse>;
276
+ getProject(projectId: string): Promise<ProjectResponse>;
277
+ listProjects(organizationId?: string): Promise<ProjectResponse[]>;
278
+ updateProject(projectId: string, updates: ProjectUpdate): Promise<ProjectResponse>;
279
+ deleteProject(projectId: string): Promise<void>;
280
+ regenerateProjectApiKey(projectId: string): Promise<APIKeyResponse>;
281
+ getMcpConfig(projectId: string): Promise<Record<string, unknown>>;
282
+ getMcpStats(projectId: string): Promise<Record<string, unknown>>;
283
+ createOrganization(orgData: OrganizationCreate): Promise<OrganizationResponse>;
284
+ listOrganizations(): Promise<OrganizationResponse[]>;
285
+ getOrganization(orgId: string): Promise<OrganizationResponse>;
286
+ updateOrganization(orgId: string, updates: OrganizationUpdate): Promise<OrganizationResponse>;
287
+ addMemberToOrganization(orgId: string, userId: string): Promise<void>;
288
+ removeMemberFromOrganization(orgId: string, userId: string): Promise<void>;
289
+ getUsage(): Promise<UsageStatsResponse>;
290
+ getUsageHistory(days?: number, resourceType?: string): Promise<Record<string, unknown>>;
291
+ listBillingPlans(): Promise<BillingPlanResponse[]>;
292
+ getSubscription(): Promise<Record<string, unknown>>;
293
+ listNotifications(): Promise<NotificationResponse[]>;
294
+ markNotificationAsRead(notificationId: string): Promise<NotificationResponse>;
295
+ markAllNotificationsAsRead(): Promise<void>;
296
+ deleteNotification(notificationId: string): Promise<void>;
297
+ getSettings(): Promise<Record<string, unknown>>;
298
+ updateAccount(updates: {
299
+ full_name?: string;
300
+ email?: string;
301
+ }): Promise<Record<string, unknown>>;
302
+ updatePreferences(preferences: Record<string, unknown>): Promise<Record<string, unknown>>;
303
+ getGuidelines(): Promise<Record<string, unknown>>;
304
+ changePasswordViaSettings(passwordChange: PasswordChange): Promise<void>;
305
+ deleteAccount(confirm: boolean): Promise<void>;
306
+ listActivityLogs(page?: number, pageSize?: number): Promise<Record<string, unknown>>;
307
+ exportActivityLogs(): Promise<Blob>;
308
+ getCorrection(correctionId: string): Promise<Record<string, unknown>>;
309
+ updateCorrection(correctionId: string, updates: Record<string, unknown>): Promise<Record<string, unknown>>;
310
+ getCorrectionStats(): Promise<Record<string, unknown>>;
311
+ /**
312
+ * Create WebSocket connection for real-time updates
313
+ * Requires access token (use login() first or setAccessToken())
314
+ */
315
+ createWebSocket(): Promise<import("./websocket").RecursorWebSocket>;
316
+ /**
317
+ * Connect WebSocket and return client
318
+ */
319
+ connectWebSocket(): Promise<import("./websocket").RecursorWebSocket>;
320
+ /**
321
+ * Disconnect WebSocket if connected
322
+ */
323
+ disconnectWebSocket(): void;
324
+ /**
325
+ * Create a conversation summary
326
+ */
327
+ createConversationSummary(data: {
328
+ conversation_id: string;
329
+ messages: Array<{
330
+ role: string;
331
+ content: string;
332
+ }>;
333
+ summary_text: string;
334
+ key_points?: string[];
335
+ topics?: string[];
336
+ metadata?: Record<string, any>;
337
+ }): Promise<any>;
338
+ /**
339
+ * Get a conversation summary by ID
340
+ */
341
+ getConversationSummary(conversationId: string): Promise<any>;
342
+ /**
343
+ * List recent conversation summaries
344
+ */
345
+ listConversationSummaries(params?: {
346
+ limit?: number;
347
+ days?: number;
348
+ }): Promise<any>;
349
+ /**
350
+ * Record an architectural change
351
+ */
352
+ recordArchitecturalChange(data: {
353
+ change_type: string;
354
+ component: string;
355
+ description: string;
356
+ before?: Record<string, any>;
357
+ after?: Record<string, any>;
358
+ impact?: string[];
359
+ metadata?: Record<string, any>;
360
+ }): Promise<any>;
361
+ /**
362
+ * List recent architectural changes
363
+ */
364
+ listArchitecturalChanges(params?: {
365
+ limit?: number;
366
+ days?: number;
367
+ change_type?: string;
368
+ }): Promise<any>;
369
+ /**
370
+ * Query rotatable memory patterns
371
+ */
372
+ queryRotatableMemory(params?: {
373
+ domain?: string;
374
+ pattern_type?: string;
375
+ min_effectiveness?: number;
376
+ limit?: number;
377
+ }): Promise<any>;
378
+ /**
379
+ * Record pattern usage and update effectiveness
380
+ */
381
+ recordPatternUsage(patternId: string, successful: boolean): Promise<any>;
382
+ /**
383
+ * Get rotatable memory statistics
384
+ */
385
+ getRotatableMemoryStats(): Promise<any>;
386
+ }