@recursorsdk/sdk 1.0.0 → 1.0.2

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.d.ts CHANGED
@@ -1,386 +1,197 @@
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;
1
+ export * from "./types.js";
2
+ export type { WebSocketMessage, WebSocketEventHandler } from "./websocket.js";
3
+ export { RecursorWebSocket } from "./websocket.js";
4
+ import { RecursorBase } from "./base.js";
5
+ declare const RecursorSDK_base: {
6
+ new (...args: any[]): {
7
+ createWebSocket(): Promise<import("./websocket.js").RecursorWebSocket>;
8
+ connectWebSocket(): Promise<import("./websocket.js").RecursorWebSocket>;
9
+ disconnectWebSocket(): void;
10
+ close(): void;
11
+ baseUrl: string;
12
+ apiKey?: string;
13
+ accessToken?: string;
14
+ timeoutMs: number;
15
+ wsClient?: any;
16
+ localIndex: Record<string, any>;
17
+ offlineQueue: any[];
18
+ setAccessToken(token: string): void;
19
+ setApiKey(key: string): void;
20
+ headers(): import("./types.js").HeadersInit;
21
+ get<T>(path: string, params?: Record<string, unknown>): Promise<T>;
22
+ post<T>(path: string, body?: unknown, method?: string): Promise<T>;
23
+ put<T>(path: string, body?: unknown): Promise<T>;
24
+ patch<T>(path: string, body?: unknown): Promise<T>;
25
+ delete<T>(path: string): Promise<T>;
26
+ checkHealth(): Promise<boolean>;
141
27
  };
142
- llm_tokens: {
143
- used: number;
144
- limit: number;
145
- percentage: number;
28
+ } & {
29
+ new (...args: any[]): {
30
+ createProject(projectData: import("./types.js").ProjectCreate): Promise<import("./types.js").ProjectResponse>;
31
+ getProject(projectId: string): Promise<import("./types.js").ProjectResponse>;
32
+ listProjects(): Promise<import("./types.js").ProjectResponse[]>;
33
+ updateProject(projectId: string, updates: import("./types.js").ProjectUpdate): Promise<import("./types.js").ProjectResponse>;
34
+ deleteProject(projectId: string): Promise<void>;
35
+ getMcpConfig(projectId: string): Promise<Record<string, unknown>>;
36
+ login(credentials: import("./types.js").UserLogin): Promise<import("./types.js").TokenResponse>;
37
+ getProfile(): Promise<import("./types.js").UserProfile>;
38
+ register(data: Record<string, any>): Promise<any>;
39
+ refreshToken(refreshToken: string): Promise<import("./types.js").TokenResponse>;
40
+ listActivityLogs(params?: {
41
+ limit?: number;
42
+ offset?: number;
43
+ resource_type?: string;
44
+ action?: string;
45
+ start_date?: string;
46
+ end_date?: string;
47
+ } | undefined): Promise<any>;
48
+ getUserAuditLogs(limit?: number, offset?: number, action?: string): Promise<import("./types.js").AuditLogResponse>;
49
+ exportActivityLogs(format?: string, start_date?: string, end_date?: string): Promise<Blob>;
50
+ getSettings(): Promise<any>;
51
+ updateAccount(data: {
52
+ full_name?: string;
53
+ email?: string;
54
+ }): Promise<any>;
55
+ listNotifications(): Promise<any[]>;
56
+ markNotificationAsRead(notificationId: string): Promise<void>;
57
+ getUsage(): Promise<any>;
58
+ listBillingPlans(): Promise<any[]>;
59
+ baseUrl: string;
60
+ apiKey?: string;
61
+ accessToken?: string;
62
+ timeoutMs: number;
63
+ wsClient?: any;
64
+ localIndex: Record<string, any>;
65
+ offlineQueue: any[];
66
+ setAccessToken(token: string): void;
67
+ setApiKey(key: string): void;
68
+ headers(): import("./types.js").HeadersInit;
69
+ get<T>(path: string, params?: Record<string, unknown>): Promise<T>;
70
+ post<T>(path: string, body?: unknown, method?: string): Promise<T>;
71
+ put<T>(path: string, body?: unknown): Promise<T>;
72
+ patch<T>(path: string, body?: unknown): Promise<T>;
73
+ delete<T>(path: string): Promise<T>;
74
+ checkHealth(): Promise<boolean>;
146
75
  };
147
- cost: {
148
- current_period: number;
149
- estimated_monthly: number;
76
+ } & {
77
+ new (...args: any[]): {
78
+ detectIntent(args: {
79
+ user_request: string;
80
+ current_file?: string;
81
+ user_id?: string;
82
+ project_id?: string;
83
+ tags?: string[];
84
+ similar_limit?: number;
85
+ }): Promise<import("./types.js").IntentResponse>;
86
+ getIntentHistory(limit?: number, project_id?: string): Promise<import("./types.js").IntentHistoryItem[]>;
87
+ predictCorrection(input_text: string, user_id: string, context?: Record<string, any>): Promise<any>;
88
+ correctCode(code: string, language: string, project_profile?: Record<string, unknown>): Promise<Record<string, unknown>>;
89
+ correctTests(test_code: string, test_framework: string, language: string): Promise<any>;
90
+ correctConfig(config: string, config_type: string): Promise<Record<string, unknown>>;
91
+ correctDocumentation(markdown: string, doc_type?: string): Promise<Record<string, unknown>>;
92
+ applyAutoCorrections(user_id: string, model_name: string, corrections: Array<Record<string, unknown>>): Promise<Record<string, unknown>>;
93
+ getTrustScore(user_id: string, model_name: string): Promise<number>;
94
+ submitFeedback(prediction_id: string, accepted: boolean): Promise<void>;
95
+ getAutoCorrectStats(user_id: string): Promise<Record<string, unknown>>;
96
+ getPatterns(user_id?: string): Promise<Array<Record<string, unknown>>>;
97
+ gatewayChat(args: {
98
+ provider?: string;
99
+ model?: string;
100
+ messages: import("./types.js").ChatMessage[];
101
+ call_provider?: boolean;
102
+ user_id?: string;
103
+ }): Promise<import("./types.js").ChatGatewayResponse>;
104
+ chatProxy(request: import("./types.js").ChatProxyRequest): Promise<import("./types.js").ChatProxyResponse>;
105
+ getLLMGatewayPolicy(): Promise<any>;
106
+ getRoboticsGatewayPolicy(): Promise<any>;
107
+ getAvGatewayPolicy(): Promise<any>;
108
+ listCorrections(args: {
109
+ page?: number;
110
+ page_size?: number;
111
+ }): Promise<any>;
112
+ searchCorrections(query: string, limit?: number): Promise<any[]>;
113
+ createCorrection(data: {
114
+ input_text: string;
115
+ output_text: string;
116
+ }): Promise<any>;
117
+ baseUrl: string;
118
+ apiKey?: string;
119
+ accessToken?: string;
120
+ timeoutMs: number;
121
+ wsClient?: any;
122
+ localIndex: Record<string, any>;
123
+ offlineQueue: any[];
124
+ setAccessToken(token: string): void;
125
+ setApiKey(key: string): void;
126
+ headers(): import("./types.js").HeadersInit;
127
+ get<T>(path: string, params?: Record<string, unknown>): Promise<T>;
128
+ post<T>(path: string, body?: unknown, method?: string): Promise<T>;
129
+ put<T>(path: string, body?: unknown): Promise<T>;
130
+ patch<T>(path: string, body?: unknown): Promise<T>;
131
+ delete<T>(path: string): Promise<T>;
132
+ checkHealth(): Promise<boolean>;
150
133
  };
151
- subscription: {
152
- plan_name: string;
153
- status: string;
154
- billing_period: string;
134
+ } & {
135
+ new (...args: any[]): {
136
+ createWorkflow(data: import("./types.js").WorkflowCreate): Promise<import("./types.js").WorkflowResponse>;
137
+ listWorkflows(): Promise<import("./types.js").WorkflowResponse[]>;
138
+ executeWorkflow(workflowId: string, inputData: Record<string, any>): Promise<import("./types.js").WorkflowExecutionResponse>;
139
+ getExecutionStatus(executionId: string): Promise<import("./types.js").WorkflowExecutionResponse>;
140
+ baseUrl: string;
141
+ apiKey?: string;
142
+ accessToken?: string;
143
+ timeoutMs: number;
144
+ wsClient?: any;
145
+ localIndex: Record<string, any>;
146
+ offlineQueue: any[];
147
+ setAccessToken(token: string): void;
148
+ setApiKey(key: string): void;
149
+ headers(): import("./types.js").HeadersInit;
150
+ get<T>(path: string, params?: Record<string, unknown>): Promise<T>;
151
+ post<T>(path: string, body?: unknown, method?: string): Promise<T>;
152
+ put<T>(path: string, body?: unknown): Promise<T>;
153
+ patch<T>(path: string, body?: unknown): Promise<T>;
154
+ delete<T>(path: string): Promise<T>;
155
+ checkHealth(): Promise<boolean>;
155
156
  };
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;
157
+ } & {
158
+ new (...args: any[]): {
159
+ listCodebaseFiles(limit?: number, offset?: number): Promise<any[]>;
160
+ getCodebaseIndex(): Promise<import("./types.js").CodebaseIndexResponse>;
161
+ getDirectoryStructure(max_depth?: number, include_files?: boolean): Promise<any>;
162
+ validateCodebaseOperation(action: string, path: string): Promise<any>;
163
+ findSimilarFiles(name: string, threshold?: number): Promise<string[]>;
164
+ syncFile(filePath: string, content?: string): Promise<Record<string, unknown>>;
165
+ syncBatch(files: {
166
+ path: string;
167
+ content?: string;
168
+ }[]): Promise<any>;
169
+ syncDelete(filePath: string): Promise<any>;
170
+ syncHybridIndex(user_id: string, index: Record<string, any>): Promise<any>;
171
+ baseUrl: string;
184
172
  apiKey?: string;
185
173
  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
- }
174
+ timeoutMs: number;
175
+ wsClient?: any;
176
+ localIndex: Record<string, any>;
177
+ offlineQueue: any[];
178
+ setAccessToken(token: string): void;
179
+ setApiKey(key: string): void;
180
+ headers(): import("./types.js").HeadersInit;
181
+ get<T>(path: string, params?: Record<string, unknown>): Promise<T>;
182
+ post<T>(path: string, body?: unknown, method?: string): Promise<T>;
183
+ put<T>(path: string, body?: unknown): Promise<T>;
184
+ patch<T>(path: string, body?: unknown): Promise<T>;
185
+ delete<T>(path: string): Promise<T>;
186
+ checkHealth(): Promise<boolean>;
187
+ };
188
+ } & typeof RecursorBase;
189
+ /**
190
+ * RecursorSDK
191
+ *
192
+ * The main client for the Recursor API.
193
+ * Composed of multiple mixins to provide a modular yet flat API.
194
+ */
195
+ export declare class RecursorSDK extends RecursorSDK_base {
196
+ }
197
+ export default RecursorSDK;