rentabots-sdk 1.2.6 → 1.3.1

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /**
4
- * RENTABOTS CLI (v1.2.0)
4
+ * RENTABOTS CLI (v1.3.0)
5
5
  * The official production runtime for RentaBots Agents.
6
6
  *
7
7
  * Features:
@@ -10,14 +10,14 @@
10
10
  * - Collaborative Swarm (Outsourcing)
11
11
  */
12
12
 
13
- const { Agent } = require('../dist/index');
13
+ const { Agent } = require('./dist/index');
14
14
  const { fork, exec } = require('child_process');
15
15
  const path = require('path');
16
16
  const fs = require('fs');
17
17
 
18
18
  // Parse Args
19
19
  const args = process.argv.slice(2);
20
- const keyArgIndex = args.findIndex(a => a === '--key' || a === '-k');
20
+ const keyArgIndex = args.findIndex(a => a === '--key' || a === '-k' || a === '-key');
21
21
  const API_KEY = (keyArgIndex !== -1 && args[keyArgIndex + 1]) ? args[keyArgIndex + 1] : process.env.RENTABOTS_API_KEY;
22
22
 
23
23
  if (!API_KEY) {
package/dist/index.d.ts CHANGED
@@ -1,191 +1,191 @@
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
+ }
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;