@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/README.md +25 -41
- package/dist/base.d.ts +26 -0
- package/dist/base.js +92 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +96 -0
- package/dist/index.d.ts +191 -380
- package/dist/index.js +16 -478
- package/dist/mixins/codebase.d.ts +34 -0
- package/dist/mixins/codebase.js +39 -0
- package/dist/mixins/enterprise.d.ts +51 -0
- package/dist/mixins/enterprise.js +85 -0
- package/dist/mixins/intelligence.d.ts +61 -0
- package/dist/mixins/intelligence.js +94 -0
- package/dist/mixins/websocket.d.ts +25 -0
- package/dist/mixins/websocket.js +28 -0
- package/dist/mixins/workflows.d.ts +26 -0
- package/dist/mixins/workflows.js +16 -0
- package/dist/plugins/windsurfStub.d.ts +1 -1
- package/dist/plugins/windsurfStub.js +2 -2
- package/dist/types.d.ts +204 -0
- package/dist/types.js +1 -0
- package/package.json +4 -1
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export function EnterpriseMixin(Base) {
|
|
2
|
+
return class extends Base {
|
|
3
|
+
// ==================== Projects ====================
|
|
4
|
+
async createProject(projectData) {
|
|
5
|
+
return await this.post("/client/projects", projectData);
|
|
6
|
+
}
|
|
7
|
+
async getProject(projectId) {
|
|
8
|
+
return await this.get(`/client/projects/${projectId}`);
|
|
9
|
+
}
|
|
10
|
+
async listProjects() {
|
|
11
|
+
return await this.get("/client/projects");
|
|
12
|
+
}
|
|
13
|
+
async updateProject(projectId, updates) {
|
|
14
|
+
return await this.patch(`/client/projects/${projectId}`, updates);
|
|
15
|
+
}
|
|
16
|
+
async deleteProject(projectId) {
|
|
17
|
+
await this.delete(`/client/projects/${projectId}`);
|
|
18
|
+
}
|
|
19
|
+
async getMcpConfig(projectId) {
|
|
20
|
+
return await this.get(`/client/projects/${projectId}/mcp-config`);
|
|
21
|
+
}
|
|
22
|
+
// ==================== Auth & Users ====================
|
|
23
|
+
async login(credentials) {
|
|
24
|
+
const response = await this.post("/client/auth/login", credentials);
|
|
25
|
+
if (response.access_token) {
|
|
26
|
+
this.setAccessToken(response.access_token);
|
|
27
|
+
}
|
|
28
|
+
return response;
|
|
29
|
+
}
|
|
30
|
+
async getProfile() {
|
|
31
|
+
return await this.get("/client/auth/me");
|
|
32
|
+
}
|
|
33
|
+
async register(data) {
|
|
34
|
+
return await this.post("/client/auth/register", data);
|
|
35
|
+
}
|
|
36
|
+
async refreshToken(refreshToken) {
|
|
37
|
+
return await this.post("/client/auth/refresh", { refresh_token: refreshToken });
|
|
38
|
+
}
|
|
39
|
+
// ==================== Activity Logs ====================
|
|
40
|
+
async listActivityLogs(params) {
|
|
41
|
+
return await this.get("/client/activity", params);
|
|
42
|
+
}
|
|
43
|
+
async getUserAuditLogs(limit = 50, offset = 0, action) {
|
|
44
|
+
const params = { limit, offset };
|
|
45
|
+
if (action)
|
|
46
|
+
params.action = action;
|
|
47
|
+
return await this.get("/client/audit/audit-logs", params);
|
|
48
|
+
}
|
|
49
|
+
async exportActivityLogs(format = "csv", start_date, end_date) {
|
|
50
|
+
// @ts-ignore - access to protected baseUrl
|
|
51
|
+
const url = new URL(`${this.baseUrl}/client/activity/export`);
|
|
52
|
+
url.searchParams.set("format", format);
|
|
53
|
+
if (start_date)
|
|
54
|
+
url.searchParams.set("start_date", start_date);
|
|
55
|
+
if (end_date)
|
|
56
|
+
url.searchParams.set("end_date", end_date);
|
|
57
|
+
// @ts-ignore - access to protected headers
|
|
58
|
+
const res = await fetch(url.toString(), { headers: this.headers() });
|
|
59
|
+
if (!res.ok)
|
|
60
|
+
throw new Error(`HTTP ${res.status}`);
|
|
61
|
+
return await res.blob();
|
|
62
|
+
}
|
|
63
|
+
// ==================== Settings ====================
|
|
64
|
+
async getSettings() {
|
|
65
|
+
return await this.get("/client/settings");
|
|
66
|
+
}
|
|
67
|
+
async updateAccount(data) {
|
|
68
|
+
return await this.patch("/client/settings/account", data);
|
|
69
|
+
}
|
|
70
|
+
// ==================== Notifications ====================
|
|
71
|
+
async listNotifications() {
|
|
72
|
+
return await this.get("/client/notifications");
|
|
73
|
+
}
|
|
74
|
+
async markNotificationAsRead(notificationId) {
|
|
75
|
+
await this.post(`/client/notifications/${notificationId}/read`, {});
|
|
76
|
+
}
|
|
77
|
+
// ==================== Billing ====================
|
|
78
|
+
async getUsage() {
|
|
79
|
+
return await this.get("/client/billing/usage");
|
|
80
|
+
}
|
|
81
|
+
async listBillingPlans() {
|
|
82
|
+
return await this.get("/client/billing/plans");
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { RecursorBase, Constructor } from "../base.js";
|
|
2
|
+
import { IntentResponse, IntentHistoryItem, ChatMessage, ChatGatewayResponse, ChatProxyRequest, ChatProxyResponse } from "../types.js";
|
|
3
|
+
export declare function IntelligenceMixin<TBase extends Constructor<RecursorBase>>(Base: TBase): {
|
|
4
|
+
new (...args: any[]): {
|
|
5
|
+
detectIntent(args: {
|
|
6
|
+
user_request: string;
|
|
7
|
+
current_file?: string;
|
|
8
|
+
user_id?: string;
|
|
9
|
+
project_id?: string;
|
|
10
|
+
tags?: string[];
|
|
11
|
+
similar_limit?: number;
|
|
12
|
+
}): Promise<IntentResponse>;
|
|
13
|
+
getIntentHistory(limit?: number, project_id?: string): Promise<IntentHistoryItem[]>;
|
|
14
|
+
predictCorrection(input_text: string, user_id: string, context?: Record<string, any>): Promise<any>;
|
|
15
|
+
correctCode(code: string, language: string, project_profile?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
16
|
+
correctTests(test_code: string, test_framework: string, language: string): Promise<any>;
|
|
17
|
+
correctConfig(config: string, config_type: string): Promise<Record<string, unknown>>;
|
|
18
|
+
correctDocumentation(markdown: string, doc_type?: string): Promise<Record<string, unknown>>;
|
|
19
|
+
applyAutoCorrections(user_id: string, model_name: string, corrections: Array<Record<string, unknown>>): Promise<Record<string, unknown>>;
|
|
20
|
+
getTrustScore(user_id: string, model_name: string): Promise<number>;
|
|
21
|
+
submitFeedback(prediction_id: string, accepted: boolean): Promise<void>;
|
|
22
|
+
getAutoCorrectStats(user_id: string): Promise<Record<string, unknown>>;
|
|
23
|
+
getPatterns(user_id?: string): Promise<Array<Record<string, unknown>>>;
|
|
24
|
+
gatewayChat(args: {
|
|
25
|
+
provider?: string;
|
|
26
|
+
model?: string;
|
|
27
|
+
messages: ChatMessage[];
|
|
28
|
+
call_provider?: boolean;
|
|
29
|
+
user_id?: string;
|
|
30
|
+
}): Promise<ChatGatewayResponse>;
|
|
31
|
+
chatProxy(request: ChatProxyRequest): Promise<ChatProxyResponse>;
|
|
32
|
+
getLLMGatewayPolicy(): Promise<any>;
|
|
33
|
+
getRoboticsGatewayPolicy(): Promise<any>;
|
|
34
|
+
getAvGatewayPolicy(): Promise<any>;
|
|
35
|
+
listCorrections(args: {
|
|
36
|
+
page?: number;
|
|
37
|
+
page_size?: number;
|
|
38
|
+
}): Promise<any>;
|
|
39
|
+
searchCorrections(query: string, limit?: number): Promise<any[]>;
|
|
40
|
+
createCorrection(data: {
|
|
41
|
+
input_text: string;
|
|
42
|
+
output_text: string;
|
|
43
|
+
}): Promise<any>;
|
|
44
|
+
baseUrl: string;
|
|
45
|
+
apiKey?: string;
|
|
46
|
+
accessToken?: string;
|
|
47
|
+
timeoutMs: number;
|
|
48
|
+
wsClient?: any;
|
|
49
|
+
localIndex: Record<string, any>;
|
|
50
|
+
offlineQueue: any[];
|
|
51
|
+
setAccessToken(token: string): void;
|
|
52
|
+
setApiKey(key: string): void;
|
|
53
|
+
headers(): import("../types.js").HeadersInit;
|
|
54
|
+
get<T>(path: string, params?: Record<string, unknown>): Promise<T>;
|
|
55
|
+
post<T>(path: string, body?: unknown, method?: string): Promise<T>;
|
|
56
|
+
put<T>(path: string, body?: unknown): Promise<T>;
|
|
57
|
+
patch<T>(path: string, body?: unknown): Promise<T>;
|
|
58
|
+
delete<T>(path: string): Promise<T>;
|
|
59
|
+
checkHealth(): Promise<boolean>;
|
|
60
|
+
};
|
|
61
|
+
} & TBase;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export function IntelligenceMixin(Base) {
|
|
2
|
+
return class extends Base {
|
|
3
|
+
// ==================== Code Intelligence ====================
|
|
4
|
+
async detectIntent(args) {
|
|
5
|
+
const payload = {
|
|
6
|
+
user_request: (args.user_request ?? "").trim().slice(0, 4000),
|
|
7
|
+
current_file: args.current_file ?? null,
|
|
8
|
+
user_id: args.user_id ?? null,
|
|
9
|
+
project_id: args.project_id ?? null,
|
|
10
|
+
tags: args.tags ?? [],
|
|
11
|
+
similar_limit: args.similar_limit ?? 5,
|
|
12
|
+
};
|
|
13
|
+
return await this.post("/client/code_intelligence/detect-intent", payload);
|
|
14
|
+
}
|
|
15
|
+
async getIntentHistory(limit = 50, project_id) {
|
|
16
|
+
const params = { limit: Math.max(1, Math.min(limit, 200)) };
|
|
17
|
+
if (project_id)
|
|
18
|
+
params.project_id = project_id;
|
|
19
|
+
return await this.get("/client/code_intelligence/intent-history", params);
|
|
20
|
+
}
|
|
21
|
+
async predictCorrection(input_text, user_id, context = {}) {
|
|
22
|
+
const body = { input_text, user_id, context };
|
|
23
|
+
return await this.post("/client/code_intelligence/predict", body);
|
|
24
|
+
}
|
|
25
|
+
async correctCode(code, language, project_profile) {
|
|
26
|
+
const body = { code, language, project_profile: project_profile ?? {} };
|
|
27
|
+
return await this.post("/client/code_intelligence/correct/code", body);
|
|
28
|
+
}
|
|
29
|
+
async correctTests(test_code, test_framework, language) {
|
|
30
|
+
const body = { test_code, test_framework, language };
|
|
31
|
+
return await this.post("/client/code_intelligence/correct/tests", body);
|
|
32
|
+
}
|
|
33
|
+
async correctConfig(config, config_type) {
|
|
34
|
+
const body = { config, config_type };
|
|
35
|
+
return await this.post("/client/code_intelligence/correct/config", body);
|
|
36
|
+
}
|
|
37
|
+
async correctDocumentation(markdown, doc_type = "README") {
|
|
38
|
+
const body = { markdown, doc_type };
|
|
39
|
+
return await this.post("/client/code_intelligence/correct/documentation", body);
|
|
40
|
+
}
|
|
41
|
+
async applyAutoCorrections(user_id, model_name, corrections) {
|
|
42
|
+
const body = { user_id, model_name, corrections };
|
|
43
|
+
return await this.post("/client/code_intelligence/auto-correct", body);
|
|
44
|
+
}
|
|
45
|
+
async getTrustScore(user_id, model_name) {
|
|
46
|
+
const data = await this.get("/client/code_intelligence/trust-score", { user_id, model_name });
|
|
47
|
+
return typeof data?.trust_score === "number" ? data.trust_score : 0;
|
|
48
|
+
}
|
|
49
|
+
async submitFeedback(prediction_id, accepted) {
|
|
50
|
+
await this.post("/client/code_intelligence/feedback", { prediction_id, accepted: !!accepted });
|
|
51
|
+
}
|
|
52
|
+
async getAutoCorrectStats(user_id) {
|
|
53
|
+
return await this.get("/client/code_intelligence/stats", { user_id });
|
|
54
|
+
}
|
|
55
|
+
async getPatterns(user_id) {
|
|
56
|
+
const params = user_id ? { user_id } : undefined;
|
|
57
|
+
const data = await this.get("/client/code_intelligence/patterns", params);
|
|
58
|
+
return Array.isArray(data) ? data : [];
|
|
59
|
+
}
|
|
60
|
+
// ==================== LLM & Gateways ====================
|
|
61
|
+
async gatewayChat(args) {
|
|
62
|
+
const body = {
|
|
63
|
+
provider: args.provider ?? "gradient",
|
|
64
|
+
model: args.model ?? undefined,
|
|
65
|
+
messages: (args.messages ?? []).map(m => ({ role: m.role, content: String(m.content).slice(0, 4000) })),
|
|
66
|
+
call_provider: !!(args.call_provider ?? true),
|
|
67
|
+
user_id: args.user_id ?? undefined,
|
|
68
|
+
};
|
|
69
|
+
return await this.post("/recursor/llm/gateway/chat", body);
|
|
70
|
+
}
|
|
71
|
+
async chatProxy(request) {
|
|
72
|
+
return await this.post("/client/proxy/chat", request);
|
|
73
|
+
}
|
|
74
|
+
async getLLMGatewayPolicy() {
|
|
75
|
+
return await this.get("/recursor/llm/gateway/policy");
|
|
76
|
+
}
|
|
77
|
+
async getRoboticsGatewayPolicy() {
|
|
78
|
+
return await this.get("/recursor/robotics/gateway/policy");
|
|
79
|
+
}
|
|
80
|
+
async getAvGatewayPolicy() {
|
|
81
|
+
return await this.get("/recursor/av/gateway/policy");
|
|
82
|
+
}
|
|
83
|
+
// ==================== Corrections ====================
|
|
84
|
+
async listCorrections(args) {
|
|
85
|
+
return await this.get("/client/corrections", args);
|
|
86
|
+
}
|
|
87
|
+
async searchCorrections(query, limit = 5) {
|
|
88
|
+
return await this.get("/client/corrections/search", { query, limit });
|
|
89
|
+
}
|
|
90
|
+
async createCorrection(data) {
|
|
91
|
+
return await this.post("/client/corrections", data);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { RecursorBase, Constructor } from "../base.js";
|
|
2
|
+
export declare function WebSocketMixin<TBase extends Constructor<RecursorBase>>(Base: TBase): {
|
|
3
|
+
new (...args: any[]): {
|
|
4
|
+
createWebSocket(): Promise<import("../websocket.js").RecursorWebSocket>;
|
|
5
|
+
connectWebSocket(): Promise<import("../websocket.js").RecursorWebSocket>;
|
|
6
|
+
disconnectWebSocket(): void;
|
|
7
|
+
close(): void;
|
|
8
|
+
baseUrl: string;
|
|
9
|
+
apiKey?: string;
|
|
10
|
+
accessToken?: string;
|
|
11
|
+
timeoutMs: number;
|
|
12
|
+
wsClient?: any;
|
|
13
|
+
localIndex: Record<string, any>;
|
|
14
|
+
offlineQueue: any[];
|
|
15
|
+
setAccessToken(token: string): void;
|
|
16
|
+
setApiKey(key: string): void;
|
|
17
|
+
headers(): import("../types.js").HeadersInit;
|
|
18
|
+
get<T>(path: string, params?: Record<string, unknown>): Promise<T>;
|
|
19
|
+
post<T>(path: string, body?: unknown, method?: string): Promise<T>;
|
|
20
|
+
put<T>(path: string, body?: unknown): Promise<T>;
|
|
21
|
+
patch<T>(path: string, body?: unknown): Promise<T>;
|
|
22
|
+
delete<T>(path: string): Promise<T>;
|
|
23
|
+
checkHealth(): Promise<boolean>;
|
|
24
|
+
};
|
|
25
|
+
} & TBase;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export function WebSocketMixin(Base) {
|
|
2
|
+
return class extends Base {
|
|
3
|
+
async createWebSocket() {
|
|
4
|
+
if (!this.accessToken)
|
|
5
|
+
throw new Error("Access token required");
|
|
6
|
+
if (!this.wsClient) {
|
|
7
|
+
// Dynamic import to avoid circular dependency issues if websocket.ts imports RecursorSDK
|
|
8
|
+
const { RecursorWebSocket } = await import("../websocket.js");
|
|
9
|
+
this.wsClient = new RecursorWebSocket(this.baseUrl, this.accessToken);
|
|
10
|
+
}
|
|
11
|
+
return this.wsClient;
|
|
12
|
+
}
|
|
13
|
+
async connectWebSocket() {
|
|
14
|
+
const ws = await this.createWebSocket();
|
|
15
|
+
await ws.connect();
|
|
16
|
+
return ws;
|
|
17
|
+
}
|
|
18
|
+
disconnectWebSocket() {
|
|
19
|
+
if (this.wsClient) {
|
|
20
|
+
this.wsClient.disconnect();
|
|
21
|
+
this.wsClient = undefined;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
close() {
|
|
25
|
+
this.disconnectWebSocket();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { RecursorBase, Constructor } from "../base.js";
|
|
2
|
+
import { WorkflowCreate, WorkflowResponse, WorkflowExecutionResponse } from "../types.js";
|
|
3
|
+
export declare function WorkflowMixin<TBase extends Constructor<RecursorBase>>(Base: TBase): {
|
|
4
|
+
new (...args: any[]): {
|
|
5
|
+
createWorkflow(data: WorkflowCreate): Promise<WorkflowResponse>;
|
|
6
|
+
listWorkflows(): Promise<WorkflowResponse[]>;
|
|
7
|
+
executeWorkflow(workflowId: string, inputData: Record<string, any>): Promise<WorkflowExecutionResponse>;
|
|
8
|
+
getExecutionStatus(executionId: string): Promise<WorkflowExecutionResponse>;
|
|
9
|
+
baseUrl: string;
|
|
10
|
+
apiKey?: string;
|
|
11
|
+
accessToken?: string;
|
|
12
|
+
timeoutMs: number;
|
|
13
|
+
wsClient?: any;
|
|
14
|
+
localIndex: Record<string, any>;
|
|
15
|
+
offlineQueue: any[];
|
|
16
|
+
setAccessToken(token: string): void;
|
|
17
|
+
setApiKey(key: string): void;
|
|
18
|
+
headers(): import("../types.js").HeadersInit;
|
|
19
|
+
get<T>(path: string, params?: Record<string, unknown>): Promise<T>;
|
|
20
|
+
post<T>(path: string, body?: unknown, method?: string): Promise<T>;
|
|
21
|
+
put<T>(path: string, body?: unknown): Promise<T>;
|
|
22
|
+
patch<T>(path: string, body?: unknown): Promise<T>;
|
|
23
|
+
delete<T>(path: string): Promise<T>;
|
|
24
|
+
checkHealth(): Promise<boolean>;
|
|
25
|
+
};
|
|
26
|
+
} & TBase;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function WorkflowMixin(Base) {
|
|
2
|
+
return class extends Base {
|
|
3
|
+
async createWorkflow(data) {
|
|
4
|
+
return await this.post("/client/workflows/", data);
|
|
5
|
+
}
|
|
6
|
+
async listWorkflows() {
|
|
7
|
+
return await this.get("/client/workflows/");
|
|
8
|
+
}
|
|
9
|
+
async executeWorkflow(workflowId, inputData) {
|
|
10
|
+
return await this.post(`/client/workflows/${workflowId}/execute`, inputData);
|
|
11
|
+
}
|
|
12
|
+
async getExecutionStatus(executionId) {
|
|
13
|
+
return await this.get(`/client/workflows/executions/${executionId}`);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function initAgentSession(userId?: string
|
|
1
|
+
export declare function initAgentSession(userId?: string): Promise<void>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { RecursorSDK } from "../index";
|
|
2
|
-
export async function initAgentSession(userId
|
|
2
|
+
export async function initAgentSession(userId) {
|
|
3
3
|
const sdk = new RecursorSDK();
|
|
4
4
|
try {
|
|
5
5
|
const policy = await sdk.getLLMGatewayPolicy();
|
|
6
6
|
const messages = [
|
|
7
7
|
{ role: "system", content: "Windsurf agent: route through Recursor gateway" },
|
|
8
8
|
];
|
|
9
|
-
await sdk.gatewayChat({ provider: "openai", model: undefined, messages, call_provider: false, user_id: userId
|
|
9
|
+
await sdk.gatewayChat({ provider: "openai", model: undefined, messages, call_provider: false, user_id: userId });
|
|
10
10
|
}
|
|
11
11
|
catch (e) {
|
|
12
12
|
// silent fail to avoid disrupting agent
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
export type HeadersInit = Record<string, string>;
|
|
2
|
+
export interface IntentResponse {
|
|
3
|
+
action: string;
|
|
4
|
+
scope: string[];
|
|
5
|
+
constraints: Record<string, unknown>;
|
|
6
|
+
quality: string;
|
|
7
|
+
preserve_existing: boolean;
|
|
8
|
+
similar_past_requests: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface ChatMessage {
|
|
11
|
+
role: string;
|
|
12
|
+
content: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ChatGatewayResponse {
|
|
15
|
+
policy: Record<string, unknown>;
|
|
16
|
+
normalized_messages: ChatMessage[];
|
|
17
|
+
provider_response?: Record<string, unknown>;
|
|
18
|
+
}
|
|
19
|
+
export interface RoboticsGatewayResponse {
|
|
20
|
+
policy: Record<string, unknown>;
|
|
21
|
+
result: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
export interface AVGatewayResponse {
|
|
24
|
+
policy: Record<string, unknown>;
|
|
25
|
+
result: Record<string, unknown>;
|
|
26
|
+
}
|
|
27
|
+
export interface IntentHistoryItem {
|
|
28
|
+
id: string;
|
|
29
|
+
text: string;
|
|
30
|
+
created_at: string;
|
|
31
|
+
project_id?: string | null;
|
|
32
|
+
tags?: string[];
|
|
33
|
+
}
|
|
34
|
+
export interface CorrectionResponseList {
|
|
35
|
+
corrections: unknown[];
|
|
36
|
+
total: number;
|
|
37
|
+
page: number;
|
|
38
|
+
page_size: number;
|
|
39
|
+
}
|
|
40
|
+
export interface UserRegister {
|
|
41
|
+
email: string;
|
|
42
|
+
password: string;
|
|
43
|
+
full_name?: string;
|
|
44
|
+
username: string;
|
|
45
|
+
}
|
|
46
|
+
export interface UserLogin {
|
|
47
|
+
email: string;
|
|
48
|
+
password: string;
|
|
49
|
+
}
|
|
50
|
+
export interface TokenResponse {
|
|
51
|
+
access_token: string;
|
|
52
|
+
refresh_token?: string;
|
|
53
|
+
token_type: string;
|
|
54
|
+
expires_in: number;
|
|
55
|
+
}
|
|
56
|
+
export interface UserProfile {
|
|
57
|
+
id: string;
|
|
58
|
+
email: string;
|
|
59
|
+
username: string;
|
|
60
|
+
full_name?: string;
|
|
61
|
+
role: string;
|
|
62
|
+
is_active: boolean;
|
|
63
|
+
is_verified: boolean;
|
|
64
|
+
created_at: string;
|
|
65
|
+
last_login?: string;
|
|
66
|
+
}
|
|
67
|
+
export interface UserResponse {
|
|
68
|
+
id: string;
|
|
69
|
+
email: string;
|
|
70
|
+
username: string;
|
|
71
|
+
full_name?: string;
|
|
72
|
+
created_at: string;
|
|
73
|
+
}
|
|
74
|
+
export interface UserUpdate {
|
|
75
|
+
full_name?: string;
|
|
76
|
+
username?: string;
|
|
77
|
+
}
|
|
78
|
+
export interface PasswordChange {
|
|
79
|
+
current_password: string;
|
|
80
|
+
new_password: string;
|
|
81
|
+
}
|
|
82
|
+
export interface APIKeyResponse {
|
|
83
|
+
api_key: string;
|
|
84
|
+
created_at: string;
|
|
85
|
+
}
|
|
86
|
+
export interface ProjectCreate {
|
|
87
|
+
name: string;
|
|
88
|
+
description?: 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
|
+
created_by?: string;
|
|
102
|
+
api_key?: string;
|
|
103
|
+
is_active: boolean;
|
|
104
|
+
created_at: string;
|
|
105
|
+
updated_at: string;
|
|
106
|
+
settings?: Record<string, unknown>;
|
|
107
|
+
}
|
|
108
|
+
export interface UsageStatsResponse {
|
|
109
|
+
api_calls: {
|
|
110
|
+
used: number;
|
|
111
|
+
limit: number;
|
|
112
|
+
percentage: number;
|
|
113
|
+
};
|
|
114
|
+
corrections: {
|
|
115
|
+
used: number;
|
|
116
|
+
limit: number;
|
|
117
|
+
percentage: number;
|
|
118
|
+
};
|
|
119
|
+
storage_gb: {
|
|
120
|
+
used: number;
|
|
121
|
+
limit: number;
|
|
122
|
+
percentage: number;
|
|
123
|
+
};
|
|
124
|
+
llm_tokens: {
|
|
125
|
+
used: number;
|
|
126
|
+
limit: number;
|
|
127
|
+
percentage: number;
|
|
128
|
+
};
|
|
129
|
+
cost: {
|
|
130
|
+
current_period: number;
|
|
131
|
+
estimated_monthly: number;
|
|
132
|
+
};
|
|
133
|
+
subscription: {
|
|
134
|
+
plan_name: string;
|
|
135
|
+
status: string;
|
|
136
|
+
billing_period: string;
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
export interface BillingPlanResponse {
|
|
140
|
+
id: string;
|
|
141
|
+
name: string;
|
|
142
|
+
slug: string;
|
|
143
|
+
description: string;
|
|
144
|
+
price_monthly: number;
|
|
145
|
+
price_yearly: number;
|
|
146
|
+
features: string[];
|
|
147
|
+
}
|
|
148
|
+
export interface NotificationResponse {
|
|
149
|
+
id: string;
|
|
150
|
+
type: string;
|
|
151
|
+
title: string;
|
|
152
|
+
message: string;
|
|
153
|
+
is_read: boolean;
|
|
154
|
+
created_at: string;
|
|
155
|
+
}
|
|
156
|
+
export interface CodebaseIndexResponse {
|
|
157
|
+
files: number;
|
|
158
|
+
size: number;
|
|
159
|
+
last_updated: string;
|
|
160
|
+
}
|
|
161
|
+
export interface WorkflowCreate {
|
|
162
|
+
name: string;
|
|
163
|
+
steps: unknown[];
|
|
164
|
+
}
|
|
165
|
+
export interface WorkflowResponse {
|
|
166
|
+
id: string;
|
|
167
|
+
name: string;
|
|
168
|
+
created_at: string;
|
|
169
|
+
updated_at: string;
|
|
170
|
+
steps: unknown[];
|
|
171
|
+
}
|
|
172
|
+
export interface WorkflowExecutionResponse {
|
|
173
|
+
id: string;
|
|
174
|
+
status: string;
|
|
175
|
+
results?: Record<string, any>;
|
|
176
|
+
steps?: any[];
|
|
177
|
+
}
|
|
178
|
+
export interface AuditLog {
|
|
179
|
+
id: string;
|
|
180
|
+
action: string;
|
|
181
|
+
timestamp: string;
|
|
182
|
+
details: Record<string, any>;
|
|
183
|
+
}
|
|
184
|
+
export interface AuditLogResponse {
|
|
185
|
+
logs: AuditLog[];
|
|
186
|
+
user_id: string;
|
|
187
|
+
limit: number;
|
|
188
|
+
offset: number;
|
|
189
|
+
}
|
|
190
|
+
export interface ChatProxyRequest {
|
|
191
|
+
model: string;
|
|
192
|
+
messages: ChatMessage[];
|
|
193
|
+
temperature?: number;
|
|
194
|
+
max_tokens?: number;
|
|
195
|
+
stream?: boolean;
|
|
196
|
+
}
|
|
197
|
+
export interface ChatProxyResponse {
|
|
198
|
+
id: string;
|
|
199
|
+
object: string;
|
|
200
|
+
created: number;
|
|
201
|
+
model: string;
|
|
202
|
+
choices: any[];
|
|
203
|
+
usage: Record<string, number>;
|
|
204
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@recursorsdk/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Recursor SDK for Node.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -23,6 +23,9 @@
|
|
|
23
23
|
"prepare": "npm run build",
|
|
24
24
|
"prepublishOnly": "npm run clean && npm run build"
|
|
25
25
|
},
|
|
26
|
+
"bin": {
|
|
27
|
+
"recursor-sdk": "./dist/cli.js"
|
|
28
|
+
},
|
|
26
29
|
"engines": {
|
|
27
30
|
"node": ">=18"
|
|
28
31
|
},
|