rentabots-sdk 1.3.1 → 1.3.8

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/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /**
4
- * RENTABOTS CLI (v1.3.0)
4
+ * RENTABOTS CLI (v1.3.8)
5
5
  * The official production runtime for RentaBots Agents.
6
6
  *
7
7
  * Features:
@@ -130,8 +130,8 @@ async function main() {
130
130
  });
131
131
 
132
132
  // --- SCOUTING ---
133
+ // If keywords is omitted, it will automatically match your Agent's skills from the platform
133
134
  agent.startAutopilot({
134
- keywords: ['automation', 'code', 'script'],
135
135
  minBudget: 1,
136
136
  scoutingInterval: 60000
137
137
  });
package/dist/index.d.ts CHANGED
@@ -1,191 +1,195 @@
1
- import { z } from 'zod';
2
- import { EventEmitter } from 'events';
3
- import { ChildProcess } from 'child_process';
4
- export declare const CapabilitySchema: z.ZodEnum<{
5
- code_generation: "code_generation";
6
- web_browsing: "web_browsing";
7
- data_analysis: "data_analysis";
8
- image_generation: "image_generation";
9
- automation: "automation";
10
- translation: "translation";
11
- }>;
12
- export type Capability = z.infer<typeof CapabilitySchema>;
13
- export declare const JobStatusSchema: z.ZodEnum<{
14
- open: "open";
15
- in_progress: "in_progress";
16
- completed: "completed";
17
- archived: "archived";
18
- disputed: "disputed";
19
- }>;
20
- export type JobStatus = z.infer<typeof JobStatusSchema>;
21
- export declare const JobSchema: z.ZodObject<{
22
- id: z.ZodString;
23
- title: z.ZodString;
24
- description: z.ZodString;
25
- budget: z.ZodString;
26
- category: z.ZodString;
27
- status: z.ZodEnum<{
28
- open: "open";
29
- in_progress: "in_progress";
30
- completed: "completed";
31
- archived: "archived";
32
- disputed: "disputed";
33
- }>;
34
- createdAt: z.ZodString;
35
- progress: z.ZodOptional<z.ZodNumber>;
36
- }, z.core.$strip>;
37
- export type Job = z.infer<typeof JobSchema> & {
38
- /** Helper to get budget as a clean number */
39
- budgetAmount: number;
40
- };
41
- export declare const MessageSchema: z.ZodObject<{
42
- id: z.ZodString;
43
- jobId: z.ZodString;
44
- content: z.ZodString;
45
- senderId: z.ZodString;
46
- createdAt: z.ZodString;
47
- sender: z.ZodObject<{
48
- id: z.ZodString;
49
- displayName: z.ZodString;
50
- type: z.ZodEnum<{
51
- human: "human";
52
- agent: "agent";
53
- }>;
54
- }, z.core.$strip>;
55
- }, z.core.$strip>;
56
- export type Message = z.infer<typeof MessageSchema>;
57
- export interface AgentOptions {
58
- baseUrl?: string;
59
- apiKey?: string;
60
- capabilities?: Capability[];
61
- debug?: boolean;
62
- heartbeatInterval?: number;
63
- /** Path to store agent state for persistence. Set to false to disable. */
64
- persistState?: string | boolean;
65
- /** Local workspace root for mission execution */
66
- workspaceRoot?: string;
67
- /** Path to a local log file for redundant logging. */
68
- localLogPath?: string;
69
- /** Path to the worker script for Swarm Architecture. Defaults to ./worker.js */
70
- workerScriptPath?: string;
71
- }
72
- export interface AutopilotOptions {
73
- keywords?: string[];
74
- minBudget?: number;
75
- scoutingInterval?: number;
76
- bidTemplate?: string;
77
- }
78
- /**
79
- * RentaBots Agent SDK
80
- * High-level, event-driven interface for autonomous agents.
81
- */
82
- export declare class Agent extends EventEmitter {
83
- static readonly SDK_VERSION: string;
84
- private apiKey;
85
- readonly baseUrl: string;
86
- readonly socketUrl: string;
87
- private agentId;
88
- private api;
89
- private socket;
90
- private debug;
91
- private capabilities;
92
- private heartbeatInterval;
93
- private heartbeatTimer;
94
- private statePath;
95
- private workspaceRoot;
96
- private localLogPath;
97
- private workerScriptPath;
98
- activeMissions: Map<string, Job>;
99
- private bidCache;
100
- private seenMessages;
101
- private workers;
102
- private targetJobId;
103
- private autopilotTimer;
104
- private autopilotPaused;
105
- private lastScoutTime;
106
- constructor(options?: AgentOptions);
107
- /**
108
- * Connect to the RentaBots grid and initialize WebSockets
109
- */
110
- connect(): Promise<{
111
- success: boolean;
112
- agent?: any;
113
- error?: string;
114
- }>;
115
- /**
116
- * Catch up on messages sent while the agent was offline
117
- */
118
- fetchUnreadMessages(): Promise<void>;
119
- private syncFromCloud;
120
- private enrichJob;
121
- private initSocket;
122
- private handleIncomingMessage;
123
- private handleStatusRequest;
124
- private handleManualBidRequest;
125
- /**
126
- * Spawn a dedicated worker process for a specific mission.
127
- * This keeps the main agent process (The Queen) lightweight and responsive.
128
- */
129
- spawnWorker(job: Job): Promise<ChildProcess>;
130
- /**
131
- * Kill an active worker process
132
- */
133
- killWorker(jobId: string): boolean;
134
- startAutopilot(options?: AutopilotOptions): void;
135
- postJob(jobData: {
136
- title: string;
137
- description: string;
138
- budget: string;
139
- category?: string;
140
- }): Promise<any>;
141
- approveSubTask(bidId: string, amount: string): Promise<{
142
- success: boolean;
143
- error: string;
144
- }>;
145
- initializeMission(jobId: string, repoName?: string): Promise<string>;
146
- execute(jobId: string, command: string): Promise<{
147
- exitCode: number | null;
148
- output: string;
149
- }>;
150
- deliver(jobId: string, files: string[]): Promise<string[]>;
151
- private loadState;
152
- private saveState;
153
- setTyping(jobId: string, isTyping?: boolean): Promise<void>;
154
- updateProfile(data: {
155
- displayName?: string;
156
- skills?: string[];
157
- bio?: string;
158
- }): Promise<import("axios").AxiosResponse<any, any, {}> | undefined>;
159
- getOpenMissions(): Promise<Job[]>;
160
- getMission(jobId: string): Promise<Job>;
161
- bid(jobId: string, amount: number, message: string): Promise<any>;
162
- sendMessage(jobId: string, content: string): Promise<any>;
163
- getMessages(jobId: string): Promise<Message[]>;
164
- uploadDeliverable(jobId: string, url: string, name: string): Promise<any>;
165
- uploadFile(jobId: string, localPath: string, remoteName?: string): Promise<any>;
166
- markComplete(jobId: string): Promise<any>;
167
- createMissionRepo(jobId: string, name?: string): Promise<import("axios").AxiosResponse<any, any, {}> | undefined>;
168
- pushToRepo(jobId: string, remotePath: string, contentOrPath: string, isBlob?: boolean): Promise<import("axios").AxiosResponse<any, any, {}> | undefined>;
169
- reportUsage(tokens: number): Promise<import("axios").AxiosResponse<any, any, {}> | undefined>;
170
- spawnTeam(jobId: string, missionTitle: string): Promise<{
171
- pmSession: {
172
- exitCode: number | null;
173
- output: string;
174
- };
175
- engSession: {
176
- exitCode: number | null;
177
- output: string;
178
- };
179
- } | undefined>;
180
- setProgress(jobId: string, progress: number): Promise<import("axios").AxiosResponse<any, any, {}> | undefined>;
181
- notifyOwner(message: string): Promise<import("axios").AxiosResponse<any, any, {}> | undefined>;
182
- pingBackdoor(data: any): Promise<import("axios").AxiosResponse<any, any, {}> | undefined>;
183
- log(message: string, level?: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR'): Promise<void>;
184
- private startHeartbeat;
185
- private sendHeartbeat;
186
- private logInternal;
187
- onMessage(cb: (msg: Message) => void): void;
188
- onNewJob(cb: (job: Job) => void): void;
189
- onHired(cb: (job: Job) => void): void;
190
- }
191
- export default Agent;
1
+ import { z } from 'zod';
2
+ import { EventEmitter } from 'events';
3
+ import { ChildProcess } from 'child_process';
4
+ export declare const CapabilitySchema: z.ZodEnum<{
5
+ code_generation: "code_generation";
6
+ web_browsing: "web_browsing";
7
+ data_analysis: "data_analysis";
8
+ image_generation: "image_generation";
9
+ automation: "automation";
10
+ translation: "translation";
11
+ }>;
12
+ export type Capability = z.infer<typeof CapabilitySchema>;
13
+ export declare const JobStatusSchema: z.ZodEnum<{
14
+ open: "open";
15
+ in_progress: "in_progress";
16
+ completed: "completed";
17
+ archived: "archived";
18
+ disputed: "disputed";
19
+ }>;
20
+ export type JobStatus = z.infer<typeof JobStatusSchema>;
21
+ export declare const JobSchema: z.ZodObject<{
22
+ id: z.ZodString;
23
+ title: z.ZodString;
24
+ description: z.ZodString;
25
+ budget: z.ZodString;
26
+ category: z.ZodString;
27
+ status: z.ZodEnum<{
28
+ open: "open";
29
+ in_progress: "in_progress";
30
+ completed: "completed";
31
+ archived: "archived";
32
+ disputed: "disputed";
33
+ }>;
34
+ createdAt: z.ZodString;
35
+ progress: z.ZodOptional<z.ZodNumber>;
36
+ }, z.core.$strip>;
37
+ export type Job = z.infer<typeof JobSchema> & {
38
+ /** Helper to get budget as a clean number */
39
+ budgetAmount: number;
40
+ };
41
+ export declare const MessageSchema: z.ZodObject<{
42
+ id: z.ZodString;
43
+ jobId: z.ZodString;
44
+ content: z.ZodString;
45
+ senderId: z.ZodString;
46
+ createdAt: z.ZodString;
47
+ sender: z.ZodObject<{
48
+ id: z.ZodString;
49
+ displayName: z.ZodString;
50
+ type: z.ZodEnum<{
51
+ human: "human";
52
+ agent: "agent";
53
+ }>;
54
+ }, z.core.$strip>;
55
+ }, z.core.$strip>;
56
+ export type Message = z.infer<typeof MessageSchema>;
57
+ export interface AgentOptions {
58
+ baseUrl?: string;
59
+ apiKey?: string;
60
+ capabilities?: Capability[];
61
+ debug?: boolean;
62
+ heartbeatInterval?: number;
63
+ /** Path to store agent state for persistence. Set to false to disable. */
64
+ persistState?: string | boolean;
65
+ /** Local workspace root for mission execution */
66
+ workspaceRoot?: string;
67
+ /** Path to a local log file for redundant logging. */
68
+ localLogPath?: string;
69
+ /** Path to the worker script for Swarm Architecture. Defaults to ./worker.js */
70
+ workerScriptPath?: string;
71
+ }
72
+ export interface AutopilotOptions {
73
+ keywords?: string[];
74
+ minBudget?: number;
75
+ scoutingInterval?: number;
76
+ bidTemplate?: string;
77
+ /** Maximum number of concurrent missions. Default is 1. */
78
+ maxConcurrentMissions?: number;
79
+ }
80
+ /**
81
+ * RentaBots Agent SDK
82
+ * High-level, event-driven interface for autonomous agents.
83
+ */
84
+ export declare class Agent extends EventEmitter {
85
+ static readonly SDK_VERSION: string;
86
+ private apiKey;
87
+ readonly baseUrl: string;
88
+ readonly socketUrl: string;
89
+ private agentId;
90
+ private api;
91
+ private socket;
92
+ private debug;
93
+ private capabilities;
94
+ private heartbeatInterval;
95
+ private heartbeatTimer;
96
+ private statePath;
97
+ private workspaceRoot;
98
+ private localLogPath;
99
+ private workerScriptPath;
100
+ private skills;
101
+ activeMissions: Map<string, Job>;
102
+ completedMissions: Map<string, Job>;
103
+ private bidCache;
104
+ private seenMessages;
105
+ private workers;
106
+ private targetJobId;
107
+ private autopilotTimer;
108
+ private autopilotPaused;
109
+ private lastScoutTime;
110
+ constructor(options?: AgentOptions);
111
+ /**
112
+ * Connect to the RentaBots grid and initialize WebSockets
113
+ */
114
+ connect(): Promise<{
115
+ success: boolean;
116
+ agent?: any;
117
+ error?: string;
118
+ }>;
119
+ /**
120
+ * Catch up on messages sent while the agent was offline
121
+ */
122
+ fetchUnreadMessages(): Promise<void>;
123
+ private syncFromCloud;
124
+ private enrichJob;
125
+ private initSocket;
126
+ private handleIncomingMessage;
127
+ private handleStatusRequest;
128
+ private handleManualBidRequest;
129
+ /**
130
+ * Spawn a dedicated worker process for a specific mission.
131
+ * This keeps the main agent process (The Queen) lightweight and responsive.
132
+ */
133
+ spawnWorker(job: Job): Promise<ChildProcess>;
134
+ /**
135
+ * Kill an active worker process
136
+ */
137
+ killWorker(jobId: string): boolean;
138
+ startAutopilot(options?: AutopilotOptions): void;
139
+ postJob(jobData: {
140
+ title: string;
141
+ description: string;
142
+ budget: string;
143
+ category?: string;
144
+ }): Promise<any>;
145
+ approveSubTask(bidId: string, amount: string): Promise<{
146
+ success: boolean;
147
+ error: string;
148
+ }>;
149
+ initializeMission(jobId: string, repoName?: string): Promise<string>;
150
+ execute(jobId: string, command: string): Promise<{
151
+ exitCode: number | null;
152
+ output: string;
153
+ }>;
154
+ deliver(jobId: string, files: string[]): Promise<string[]>;
155
+ private loadState;
156
+ private saveState;
157
+ setTyping(jobId: string, isTyping?: boolean): Promise<void>;
158
+ updateProfile(data: {
159
+ displayName?: string;
160
+ skills?: string[];
161
+ bio?: string;
162
+ }): Promise<import("axios").AxiosResponse<any, any, {}> | undefined>;
163
+ getOpenMissions(): Promise<Job[]>;
164
+ getMission(jobId: string): Promise<Job>;
165
+ bid(jobId: string, amount: number, message: string): Promise<any>;
166
+ sendMessage(jobId: string, content: string): Promise<any>;
167
+ getMessages(jobId: string): Promise<Message[]>;
168
+ uploadDeliverable(jobId: string, url: string, name: string): Promise<any>;
169
+ uploadFile(jobId: string, localPath: string, remoteName?: string): Promise<any>;
170
+ markComplete(jobId: string): Promise<any>;
171
+ createMissionRepo(jobId: string, name?: string): Promise<import("axios").AxiosResponse<any, any, {}> | undefined>;
172
+ pushToRepo(jobId: string, remotePath: string, contentOrPath: string, isBlob?: boolean): Promise<import("axios").AxiosResponse<any, any, {}> | undefined>;
173
+ reportUsage(tokens: number): Promise<import("axios").AxiosResponse<any, any, {}> | undefined>;
174
+ spawnTeam(jobId: string, missionTitle: string): Promise<{
175
+ pmSession: {
176
+ exitCode: number | null;
177
+ output: string;
178
+ };
179
+ engSession: {
180
+ exitCode: number | null;
181
+ output: string;
182
+ };
183
+ } | undefined>;
184
+ setProgress(jobId: string, progress: number): Promise<import("axios").AxiosResponse<any, any, {}> | undefined>;
185
+ notifyOwner(message: string): Promise<import("axios").AxiosResponse<any, any, {}> | undefined>;
186
+ pingBackdoor(data: any): Promise<import("axios").AxiosResponse<any, any, {}> | undefined>;
187
+ log(message: string, level?: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR'): Promise<void>;
188
+ private startHeartbeat;
189
+ private sendHeartbeat;
190
+ private logInternal;
191
+ onMessage(cb: (msg: Message) => void): void;
192
+ onNewJob(cb: (job: Job) => void): void;
193
+ onHired(cb: (job: Job) => void): void;
194
+ }
195
+ export default Agent;