@recursorsdk/sdk 1.0.1 → 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,360 +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
- settings?: Record<string, unknown>;
89
- }
90
- export interface ProjectUpdate {
91
- name?: string;
92
- description?: string;
93
- settings?: Record<string, unknown>;
94
- is_active?: boolean;
95
- }
96
- export interface ProjectResponse {
97
- id: string;
98
- name: string;
99
- description?: string;
100
- created_by?: string;
101
- api_key?: string;
102
- is_active: boolean;
103
- created_at: string;
104
- updated_at: string;
105
- settings?: Record<string, unknown>;
106
- }
107
- export interface UsageStatsResponse {
108
- api_calls: {
109
- used: number;
110
- limit: number;
111
- percentage: number;
112
- };
113
- corrections: {
114
- used: number;
115
- limit: number;
116
- percentage: number;
117
- };
118
- storage_gb: {
119
- used: number;
120
- limit: number;
121
- 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>;
122
27
  };
123
- llm_tokens: {
124
- used: number;
125
- limit: number;
126
- 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>;
127
75
  };
128
- cost: {
129
- current_period: number;
130
- 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>;
131
133
  };
132
- subscription: {
133
- plan_name: string;
134
- status: string;
135
- 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>;
136
156
  };
137
- }
138
- export interface BillingPlanResponse {
139
- id: string;
140
- name: string;
141
- slug: string;
142
- description: string;
143
- price_monthly: number;
144
- price_yearly: number;
145
- features: string[];
146
- }
147
- export interface NotificationResponse {
148
- id: string;
149
- type: string;
150
- title: string;
151
- message: string;
152
- is_read: boolean;
153
- created_at: string;
154
- }
155
- export type { WebSocketMessage, WebSocketEventHandler } from "./websocket.js";
156
- export { RecursorWebSocket } from "./websocket.js";
157
- export declare class RecursorSDK {
158
- private baseUrl;
159
- private apiKey?;
160
- private accessToken?;
161
- private timeoutMs;
162
- private wsClient?;
163
- constructor(options?: {
164
- 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;
165
172
  apiKey?: string;
166
173
  accessToken?: string;
167
- timeoutMs?: number;
168
- });
169
- setAccessToken(token: string): void;
170
- setApiKey(key: string): void;
171
- private headers;
172
- private get;
173
- private post;
174
- private put;
175
- private patch;
176
- private delete;
177
- checkHealth(): Promise<boolean>;
178
- /**
179
- * Close the SDK client and cleanup resources
180
- * Disconnects WebSocket if connected
181
- */
182
- close(): void;
183
- detectIntent(args: {
184
- user_request: string;
185
- current_file?: string;
186
- user_id?: string;
187
- project_id?: string;
188
- tags?: string[];
189
- similar_limit?: number;
190
- }): Promise<IntentResponse>;
191
- getLLMGatewayPolicy(): Promise<Record<string, unknown>>;
192
- gatewayChat(args: {
193
- provider?: string;
194
- model?: string;
195
- messages: ChatMessage[];
196
- call_provider?: boolean;
197
- user_id?: string;
198
- }): Promise<ChatGatewayResponse>;
199
- getRoboticsGatewayPolicy(): Promise<Record<string, unknown>>;
200
- roboticsGatewayObserve(args: {
201
- state: Record<string, unknown>;
202
- command?: Record<string, unknown>;
203
- environment?: Record<string, unknown>[];
204
- user_id?: string;
205
- }): Promise<RoboticsGatewayResponse>;
206
- getAvGatewayPolicy(): Promise<Record<string, unknown>>;
207
- avGatewayObserve(args: {
208
- sensors: Record<string, unknown>;
209
- state: Record<string, unknown>;
210
- action: Record<string, unknown>;
211
- timestamp: number;
212
- vehicle_id: string;
213
- user_id?: string;
214
- }): Promise<AVGatewayResponse>;
215
- getIntentHistory(limit?: number, project_id?: string): Promise<IntentHistoryItem[]>;
216
- createCorrection(args: {
217
- input_text: string;
218
- output_text: string;
219
- expected_output?: string;
220
- context?: Record<string, unknown>;
221
- correction_type?: string;
222
- }): Promise<Record<string, unknown>>;
223
- listCorrections(args?: {
224
- page?: number;
225
- page_size?: number;
226
- include_inactive?: boolean;
227
- }): Promise<CorrectionResponseList>;
228
- searchCorrections(query: string, limit?: number): Promise<CorrectionResponseList>;
229
- getAnalyticsDashboard(user_id: string, period?: string, project_id?: string): Promise<Record<string, unknown>>;
230
- getTimeSaved(user_id: string, period?: string, project_id?: string): Promise<Record<string, unknown>>;
231
- getQualityMetrics(user_id: string, period?: string, project_id?: string): Promise<Record<string, unknown>>;
232
- getAIAgentMetrics(user_id: string, project_id?: string): Promise<Record<string, unknown>>;
233
- correctCode(code: string, language: string, project_profile?: Record<string, unknown>): Promise<Record<string, unknown>>;
234
- correctConfig(config: string, config_type: string): Promise<Record<string, unknown>>;
235
- correctDocumentation(markdown: string, doc_type?: string): Promise<Record<string, unknown>>;
236
- applyAutoCorrections(user_id: string, model_name: string, corrections: Array<Record<string, unknown>>): Promise<Record<string, unknown>>;
237
- getTrustScore(user_id: string, model_name: string): Promise<number>;
238
- submitFeedback(prediction_id: string, accepted: boolean): Promise<void>;
239
- getAutoCorrectStats(user_id: string): Promise<Record<string, unknown>>;
240
- getPatterns(user_id?: string): Promise<Array<Record<string, unknown>>>;
241
- register(userData: UserRegister): Promise<UserResponse>;
242
- login(credentials: UserLogin): Promise<TokenResponse>;
243
- logout(): Promise<void>;
244
- refreshToken(refreshToken: string): Promise<TokenResponse>;
245
- getProfile(): Promise<UserProfile>;
246
- updateProfile(updates: UserUpdate): Promise<UserProfile>;
247
- changePassword(passwordChange: PasswordChange): Promise<void>;
248
- generateApiKey(): Promise<APIKeyResponse>;
249
- revokeApiKey(): Promise<void>;
250
- getPasswordRequirements(): Promise<{
251
- requirements: string[];
252
- min_length: number;
253
- max_length: number;
254
- }>;
255
- createProject(projectData: ProjectCreate): Promise<ProjectResponse>;
256
- getProject(projectId: string): Promise<ProjectResponse>;
257
- listProjects(): Promise<ProjectResponse[]>;
258
- updateProject(projectId: string, updates: ProjectUpdate): Promise<ProjectResponse>;
259
- deleteProject(projectId: string): Promise<void>;
260
- regenerateProjectApiKey(projectId: string): Promise<APIKeyResponse>;
261
- getMcpConfig(projectId: string): Promise<Record<string, unknown>>;
262
- getMcpStats(projectId: string): Promise<Record<string, unknown>>;
263
- getUsage(): Promise<UsageStatsResponse>;
264
- getUsageHistory(days?: number, resourceType?: string): Promise<Record<string, unknown>>;
265
- listBillingPlans(): Promise<BillingPlanResponse[]>;
266
- getSubscription(): Promise<Record<string, unknown>>;
267
- listNotifications(): Promise<NotificationResponse[]>;
268
- markNotificationAsRead(notificationId: string): Promise<NotificationResponse>;
269
- markAllNotificationsAsRead(): Promise<void>;
270
- deleteNotification(notificationId: string): Promise<void>;
271
- getSettings(): Promise<Record<string, unknown>>;
272
- updateAccount(updates: {
273
- full_name?: string;
274
- email?: string;
275
- }): Promise<Record<string, unknown>>;
276
- updatePreferences(preferences: Record<string, unknown>): Promise<Record<string, unknown>>;
277
- getGuidelines(): Promise<Record<string, unknown>>;
278
- changePasswordViaSettings(passwordChange: PasswordChange): Promise<void>;
279
- deleteAccount(confirm: boolean): Promise<void>;
280
- listActivityLogs(page?: number, pageSize?: number): Promise<Record<string, unknown>>;
281
- exportActivityLogs(): Promise<Blob>;
282
- getCorrection(correctionId: string): Promise<Record<string, unknown>>;
283
- updateCorrection(correctionId: string, updates: Record<string, unknown>): Promise<Record<string, unknown>>;
284
- getCorrectionStats(): Promise<Record<string, unknown>>;
285
- /**
286
- * Create WebSocket connection for real-time updates
287
- * Requires access token (use login() first or setAccessToken())
288
- */
289
- createWebSocket(): Promise<import("./websocket").RecursorWebSocket>;
290
- /**
291
- * Connect WebSocket and return client
292
- */
293
- connectWebSocket(): Promise<import("./websocket").RecursorWebSocket>;
294
- /**
295
- * Disconnect WebSocket if connected
296
- */
297
- disconnectWebSocket(): void;
298
- /**
299
- * Create a conversation summary
300
- */
301
- createConversationSummary(data: {
302
- conversation_id: string;
303
- messages: Array<{
304
- role: string;
305
- content: string;
306
- }>;
307
- summary_text: string;
308
- key_points?: string[];
309
- topics?: string[];
310
- metadata?: Record<string, any>;
311
- }): Promise<any>;
312
- /**
313
- * Get a conversation summary by ID
314
- */
315
- getConversationSummary(conversationId: string): Promise<any>;
316
- /**
317
- * List recent conversation summaries
318
- */
319
- listConversationSummaries(params?: {
320
- limit?: number;
321
- days?: number;
322
- }): Promise<any>;
323
- /**
324
- * Record an architectural change
325
- */
326
- recordArchitecturalChange(data: {
327
- change_type: string;
328
- component: string;
329
- description: string;
330
- before?: Record<string, any>;
331
- after?: Record<string, any>;
332
- impact?: string[];
333
- metadata?: Record<string, any>;
334
- }): Promise<any>;
335
- /**
336
- * List recent architectural changes
337
- */
338
- listArchitecturalChanges(params?: {
339
- limit?: number;
340
- days?: number;
341
- change_type?: string;
342
- }): Promise<any>;
343
- /**
344
- * Query rotatable memory patterns
345
- */
346
- queryRotatableMemory(params?: {
347
- domain?: string;
348
- pattern_type?: string;
349
- min_effectiveness?: number;
350
- limit?: number;
351
- }): Promise<any>;
352
- /**
353
- * Record pattern usage and update effectiveness
354
- */
355
- recordPatternUsage(patternId: string, successful: boolean): Promise<any>;
356
- /**
357
- * Get rotatable memory statistics
358
- */
359
- getRotatableMemoryStats(): Promise<any>;
360
- }
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;