rentabots-sdk 0.4.1 → 0.5.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.
- package/dist/index.d.ts +130 -123
- package/dist/index.js +1 -1
- package/init.js +2 -2
- package/package.json +2 -2
- package/src/index.ts +408 -348
package/dist/index.d.ts
CHANGED
|
@@ -1,123 +1,130 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
private
|
|
78
|
-
private
|
|
79
|
-
private
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
export declare const CapabilitySchema: z.ZodEnum<{
|
|
4
|
+
code_generation: "code_generation";
|
|
5
|
+
web_browsing: "web_browsing";
|
|
6
|
+
data_analysis: "data_analysis";
|
|
7
|
+
image_generation: "image_generation";
|
|
8
|
+
automation: "automation";
|
|
9
|
+
translation: "translation";
|
|
10
|
+
}>;
|
|
11
|
+
export type Capability = z.infer<typeof CapabilitySchema>;
|
|
12
|
+
export declare const JobStatusSchema: z.ZodEnum<{
|
|
13
|
+
open: "open";
|
|
14
|
+
in_progress: "in_progress";
|
|
15
|
+
completed: "completed";
|
|
16
|
+
archived: "archived";
|
|
17
|
+
disputed: "disputed";
|
|
18
|
+
}>;
|
|
19
|
+
export type JobStatus = z.infer<typeof JobStatusSchema>;
|
|
20
|
+
export declare const JobSchema: z.ZodObject<{
|
|
21
|
+
id: z.ZodString;
|
|
22
|
+
title: z.ZodString;
|
|
23
|
+
description: z.ZodString;
|
|
24
|
+
budget: z.ZodString;
|
|
25
|
+
category: z.ZodString;
|
|
26
|
+
status: z.ZodEnum<{
|
|
27
|
+
open: "open";
|
|
28
|
+
in_progress: "in_progress";
|
|
29
|
+
completed: "completed";
|
|
30
|
+
archived: "archived";
|
|
31
|
+
disputed: "disputed";
|
|
32
|
+
}>;
|
|
33
|
+
createdAt: z.ZodString;
|
|
34
|
+
progress: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export type Job = z.infer<typeof JobSchema> & {
|
|
37
|
+
/** Helper to get budget as a clean number */
|
|
38
|
+
budgetAmount: number;
|
|
39
|
+
};
|
|
40
|
+
export declare const MessageSchema: z.ZodObject<{
|
|
41
|
+
id: z.ZodString;
|
|
42
|
+
jobId: z.ZodString;
|
|
43
|
+
content: z.ZodString;
|
|
44
|
+
senderId: z.ZodString;
|
|
45
|
+
createdAt: z.ZodString;
|
|
46
|
+
sender: z.ZodObject<{
|
|
47
|
+
id: z.ZodString;
|
|
48
|
+
displayName: z.ZodString;
|
|
49
|
+
type: z.ZodEnum<{
|
|
50
|
+
human: "human";
|
|
51
|
+
agent: "agent";
|
|
52
|
+
}>;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
export type Message = z.infer<typeof MessageSchema>;
|
|
56
|
+
export interface AgentOptions {
|
|
57
|
+
baseUrl?: string;
|
|
58
|
+
apiKey?: string;
|
|
59
|
+
capabilities?: Capability[];
|
|
60
|
+
debug?: boolean;
|
|
61
|
+
heartbeatInterval?: number;
|
|
62
|
+
/** Path to store agent state for persistence. Set to false to disable. */
|
|
63
|
+
persistState?: string | boolean;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* RentaBots Agent SDK
|
|
67
|
+
* High-level, event-driven interface for autonomous agents.
|
|
68
|
+
*/
|
|
69
|
+
export declare class Agent extends EventEmitter {
|
|
70
|
+
static readonly SDK_VERSION = "0.5.0";
|
|
71
|
+
private apiKey;
|
|
72
|
+
readonly baseUrl: string;
|
|
73
|
+
private agentId;
|
|
74
|
+
private api;
|
|
75
|
+
private socket;
|
|
76
|
+
private debug;
|
|
77
|
+
private capabilities;
|
|
78
|
+
private heartbeatInterval;
|
|
79
|
+
private heartbeatTimer;
|
|
80
|
+
private statePath;
|
|
81
|
+
private activeMissions;
|
|
82
|
+
private bidCache;
|
|
83
|
+
private seenMessages;
|
|
84
|
+
constructor(options?: AgentOptions);
|
|
85
|
+
/**
|
|
86
|
+
* Connect to the RentaBots grid and initialize WebSockets
|
|
87
|
+
*/
|
|
88
|
+
connect(): Promise<{
|
|
89
|
+
success: boolean;
|
|
90
|
+
agent?: any;
|
|
91
|
+
error?: string;
|
|
92
|
+
}>;
|
|
93
|
+
private syncFromCloud;
|
|
94
|
+
private enrichJob;
|
|
95
|
+
private initSocket;
|
|
96
|
+
private loadState;
|
|
97
|
+
private saveState;
|
|
98
|
+
/**
|
|
99
|
+
* Broadcast a typing indicator to the user
|
|
100
|
+
*/
|
|
101
|
+
setTyping(jobId: string, isTyping?: boolean): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Update the agent's profile on the grid
|
|
104
|
+
*/
|
|
105
|
+
updateProfile(data: {
|
|
106
|
+
displayName?: string;
|
|
107
|
+
skills?: string[];
|
|
108
|
+
bio?: string;
|
|
109
|
+
}): Promise<import("axios").AxiosResponse<any, any, {}> | undefined>;
|
|
110
|
+
getOpenMissions(): Promise<Job[]>;
|
|
111
|
+
bid(jobId: string, amount: number, message: string): Promise<any>;
|
|
112
|
+
sendMessage(jobId: string, content: string): Promise<any>;
|
|
113
|
+
uploadDeliverable(jobId: string, url: string, name: string): Promise<any>;
|
|
114
|
+
markComplete(jobId: string): Promise<any>;
|
|
115
|
+
/**
|
|
116
|
+
* Report token consumption for billing and monitoring
|
|
117
|
+
*/
|
|
118
|
+
reportUsage(tokens: number): Promise<import("axios").AxiosResponse<any, any, {}> | undefined>;
|
|
119
|
+
/**
|
|
120
|
+
* Stream logs to the RentaBots Dashboard
|
|
121
|
+
*/
|
|
122
|
+
log(message: string, level?: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR'): Promise<void>;
|
|
123
|
+
private startHeartbeat;
|
|
124
|
+
private sendHeartbeat;
|
|
125
|
+
private logInternal;
|
|
126
|
+
onMessage(cb: (msg: Message) => void): void;
|
|
127
|
+
onNewJob(cb: (job: Job) => void): void;
|
|
128
|
+
onHired(cb: (job: Job) => void): void;
|
|
129
|
+
}
|
|
130
|
+
export default Agent;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a0_0x220de=a0_0x1d4d;function a0_0x1d4d(_0x14f4ae,_0x312025){_0x14f4ae=_0x14f4ae-0x95;const _0xd4529a=a0_0x1e50();let _0x1498a0=_0xd4529a[_0x14f4ae];if(a0_0x1d4d['DMJnJb']===undefined){var _0x10feae=function(_0x23caed){const _0x2e59b4='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x1fb2b9='',_0x31ea09='',_0x1b34c1=_0x1fb2b9+_0x10feae;for(let _0x3c1dd0=0x0,_0x57b0ad,_0x6178e7,_0x215f66=0x0;_0x6178e7=_0x23caed['charAt'](_0x215f66++);~_0x6178e7&&(_0x57b0ad=_0x3c1dd0%0x4?_0x57b0ad*0x40+_0x6178e7:_0x6178e7,_0x3c1dd0++%0x4)?_0x1fb2b9+=_0x1b34c1['charCodeAt'](_0x215f66+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x57b0ad>>(-0x2*_0x3c1dd0&0x6)):_0x3c1dd0:0x0){_0x6178e7=_0x2e59b4['indexOf'](_0x6178e7);}for(let _0x34afd2=0x0,_0x48024c=_0x1fb2b9['length'];_0x34afd2<_0x48024c;_0x34afd2++){_0x31ea09+='%'+('00'+_0x1fb2b9['charCodeAt'](_0x34afd2)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x31ea09);};a0_0x1d4d['cohFtr']=_0x10feae,a0_0x1d4d['Garfjj']={},a0_0x1d4d['DMJnJb']=!![];}const _0x1e50e8=_0xd4529a[0x0],_0x1d4d1a=_0x14f4ae+_0x1e50e8,_0x13d436=a0_0x1d4d['Garfjj'][_0x1d4d1a];if(!_0x13d436){const _0x11d433=function(_0x1ff234){this['CTyHnP']=_0x1ff234,this['xAivyr']=[0x1,0x0,0x0],this['vcMfGD']=function(){return'newState';},this['DKhpaU']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['SLZaFQ']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x11d433['prototype']['bzlNvJ']=function(){const _0x252363=new RegExp(this['DKhpaU']+this['SLZaFQ']),_0x3093f4=_0x252363['test'](this['vcMfGD']['toString']())?--this['xAivyr'][0x1]:--this['xAivyr'][0x0];return this['eEFXPD'](_0x3093f4);},_0x11d433['prototype']['eEFXPD']=function(_0x30fabb){if(!Boolean(~_0x30fabb))return _0x30fabb;return this['pDtGUF'](this['CTyHnP']);},_0x11d433['prototype']['pDtGUF']=function(_0x3db0c8){for(let _0x1363c6=0x0,_0x586299=this['xAivyr']['length'];_0x1363c6<_0x586299;_0x1363c6++){this['xAivyr']['push'](Math['round'](Math['random']())),_0x586299=this['xAivyr']['length'];}return _0x3db0c8(this['xAivyr'][0x0]);},new _0x11d433(a0_0x1d4d)['bzlNvJ'](),_0x1498a0=a0_0x1d4d['cohFtr'](_0x1498a0),a0_0x1d4d['Garfjj'][_0x1d4d1a]=_0x1498a0;}else _0x1498a0=_0x13d436;return _0x1498a0;}(function(_0x318e02,_0x53f2e1){const _0x1ab31b=a0_0x1d4d,_0x23c7af=_0x318e02();while(!![]){try{const _0x274ff0=parseInt(_0x1ab31b(0xfe))/0x1+parseInt(_0x1ab31b(0xdd))/0x2*(-parseInt(_0x1ab31b(0x135))/0x3)+parseInt(_0x1ab31b(0xdb))/0x4+-parseInt(_0x1ab31b(0xcd))/0x5+-parseInt(_0x1ab31b(0xe8))/0x6*(-parseInt(_0x1ab31b(0xb7))/0x7)+-parseInt(_0x1ab31b(0xeb))/0x8+-parseInt(_0x1ab31b(0xbd))/0x9;if(_0x274ff0===_0x53f2e1)break;else _0x23c7af['push'](_0x23c7af['shift']());}catch(_0x37c6f2){_0x23c7af['push'](_0x23c7af['shift']());}}}(a0_0x1e50,0x673a9));function a0_0x1e50(){const _0x1c15e9=['Au15Cgq','twvZC2fNzvnJAgvTyq','C2vHCMnO','uuTbsKi','l2nVBxbSzxrL','q29UBMvJDgLUzYb0BYbszw50yujVDhmGr3jPzcaODG','Aw1Hz2vFz2vUzxjHDgLVBG','tgvNywn5ihn0yxj0ug9SBgLUzYGPignHBgXLzc4Gu0rlig5VDYb1C2vZihjLywWTDgLTzsbxzwjtB2nRzxrZlG','zgLZCgXHEu5HBwu','D2vIx2jYB3DZAw5N','B25kB2jgB3vUza','C3rYAw5N','BwLUqNvKz2v0','B25nAxnZAw9UqxnZAwDUzwq','vgnRCw0','s0z6B3u','AM9ICW','t3HNDeO','AfLWy3u','BMv3x2PVyG','Cg9ZDa','yMLKCW','Aw5JBhvKzxm','BMv3x21LC3nHz2u','yxbP','yMLKq2fJAgu','yxbPs2v5','r0XTzwC','zM9YrwfJAa','AgvHCNrIzwf0vgLTzxi','l21LC3nHz2vZ','su5gtW','v0fstG','B3bLBG','u0nRChe','C2vUzeHLyxj0yMvHDa','sgvHCNrIzwf0igzHAwXLza','wwTRv2C','AM9ICY8','yxjJAgL2zwq','DxbKyxrLuhjVzMLSzq','qwDLBNq','rxjYB3iGAw4GAgLYzwqGAgfUzgXLCG','l2HLyxj0yMvHDa','DgL0Bgu','Eu5eC0K','B25ozxDkB2i','mJGXmdu3vKTXEwPX','vuHrwvC','A2DhB1K','C2v0vhLWAw5N','C29JA2v0','C3rHDhvZ','mtC0otm1n1n2sfvLAq','rvjst1i','zgf0yq','DufKquW','tMH3CvC','zgvSAxzLCMfIBgu','yxHPB3m','l2XVz3m','zePIwhu','zw51Bq','DhjHBNnSyxrPB24','qMvHCMvYia','Dg9tDhjPBMC','AhvTyw4','Chn5q2O','DhLWAw5Nx3n0yxrL','mZa4ota3mhbNuwH4vW','C29JA2v0lMLVlwnSAwvUDa','rxjYB3iGAw4GAM9IigHHBMrSzxi','BwvZC2fNzuHHBMrSzxjZ','AM9PBL9TyxjRzxrWBgfJzq','veXQEKG','zxn6wgi','shveEee','rMfPBgvKihrVihn5BMmGy2fWywjPBgL0AwvZihrVigDYAwqSignVBNrPBNvPBMCUlI4','ks4UlG','y2fWywjPBgL0AwvZ','ywXYzwfKEq','sM9Iu2nOzw1H','BgvUz3rO','mJqYnZu3mM9ntvrZsq','ChvZAa','mMHXuLzfBq','icGK','x19PBxbVCNrezwzHDwX0','s0nzrNO','yMPVu08','wXTBmZvTu0rlg1SWBv0G','BwfYA0nVBxbSzxrL','Dg9mB3DLCKnHC2u','r05lwhu','Aw5PDfnVy2TLDa','yMfZzvvYBa','nZHZr29gsve','8j+oIsbnAxnZAw9UiefZC2LNBMvKoIa','uxHLteK','nJy0mZa0wuHnCNj3','wKv0yKG','rxjYB3iGAw4GBwvZC2fNzsbOyw5KBgvY','l21HBMfNzq','z2v0t3bLBK1PC3nPB25Z','u1vdq0vtuW','zxjYB3i','u0rlx1zfuLnjt04','wXTBmZfTu0rlievsuK9sg1SWBv0GrMfPBgvKihrVihn0CMvHBsbSB2CGDg8GzgfZAgjVyxjKoIa','Buf2r1C','Ahr0Chm6lY9Yzw50ywjVDhmUy29Tl2fWAq','CMvZCg9UC2u','rNfpyKi','tuvyteO','yNvKz2v0','DxbSB2fKrgvSAxzLCMfIBgu','vLbwuhy','uhzeDfm','C2vLBK1LC3nHz2vZ','mZK5nZq1AMDABfzd','zgvMyxvSDa','C0vVB0u','yxnsEu0','v2vIu29JA2v0ieXPBMSGrxn0ywjSAxnOzwqU','t25SAw5LigfZoIa','x19LC01VzhvSzq','ssbJyw4GzxHLy3v0zsb0AgLZig1PC3nPB24Gyxv0B25VBw91C2X5lG','yxv0B21HDgLVBG','EvDRs1K','ywrK','uMH1vMG','ywDLBNrjza','ywDLBNrZl21L','EKntDxK','uefzA2y','y29UC3rYDwn0B3i','yxjYyxK','uKXouvK','y29UBMvJDgvK','B2jQzwn0','CgfYC2u','g1SZmM0','l2fWAq','uLrHugm','zgvIDwC','qvv4y1K','zw1PDa','BwvZC2fNzq','xrTBmg0G','AwXYDgm','wvf6quC','B25iAxjLza','s3Dusem','y29UBMvJDa','BLvOEge','D2vIC29JA2v0','twLUChG','zMLSDgvY','zMLUzefUzejPza','C3rHCNrqB2XSAw5N','mc40lJe','rMfPBgvKihrVihbHCNnLigLUy29TAw5NihnVy2TLDcbTzxnZywDL','AgfZ','u2nHBM5PBMCGzM9Yig1PC3nPB25Zig1HDgnOAw5NignYAxrLCMLHlI4U','4PYfiejPzcbWBgfJzwqGzM9Yia','mtf8mtn8mNWXmNWZFdL8mtr8n3WXFdb8mtb8nNW0FdH8nq','C3vJy2vZCW','z2v0','zgf0yv9HBMfSExnPCW','q2fWywjPBgL0EvnJAgvTyq','AKXjswS','4P2mifjLBNrHqM90CYbbueKGs2v5igLZig1PC3nPBMCUifbHC3mGAxqGAw4GDgHLignVBNn0CNvJDg9Yig9YihnLDcbsru5uqujpvfnFqvbjx0TfwsbPBIaUzw52','C3bSAxq','C29Tzq','nJmXnJuZDerhvLbS','yxnZAwDUzwriyw5KBgvYCW','g1SZmw0','y3jLyxrL','yMLK','rMfPBgvKihrVigzLDgnOig1HCMTLDhbSywnLigPVyNm6ia','rMfPBgvKihrVihbYB2nLC3mGBwLZC2LVBIbIAwq6ia','AM9IsgfUzgXLCNm','sefbuMy','C2TPBgXZ','vM1hr3O','4Os577IpicbtA2LWCgvKoIa','Bg9Nsw50zxjUywW','t3bQAxy','BwLZC2LVBL9HC3nPz25Lzf8','s1fhDM0','vgfYz2v0Aw5Nie1PC3nPB246ia','Bg9N','vfLoCeK','ywDLBNrZlW','l2zPBgvZ','B25nzxnZywDL','Aw5FChjVz3jLC3m','wKvitw8','ywDLBNq','C3rHCNrizwfYDgjLyxq','EM9K','kcGOlISPkYKRksSK','AgvHCNrIzwf0sw50zxj2ywW','CuLfq2G','yxbWBhK','C2vUze1LC3nHz2u','zgvMAw5LuhjVCgvYDhK','y29Kzv9Nzw5LCMf0Aw9U','tefnuvK','y29TCgXLDgvK','vw5RBM93BIbYzwfZB24','AhDIAw4','Ahr4Dey','CMvWBgfJzq','EKrtvK4','sfrSB24','wxvKwhi','g1SZm20'];a0_0x1e50=function(){return _0x1c15e9;};return a0_0x1e50();}const a0_0x3b6491=(function(){let _0x4999f9=!![];return function(_0x4e04a5,_0x3cf9ea){const _0x450b65=_0x4999f9?function(){const _0x47ebae=a0_0x1d4d;if(_0x3cf9ea){const _0x30b511=_0x3cf9ea[_0x47ebae(0x153)](_0x4e04a5,arguments);return _0x3cf9ea=null,_0x30b511;}}:function(){};return _0x4999f9=![],_0x450b65;};}()),a0_0x1fa11c=a0_0x3b6491(this,function(){const _0x46e859=a0_0x1d4d,_0x3b67fc={'GNKXu':_0x46e859(0x150)};return a0_0x1fa11c[_0x46e859(0xc9)]()[_0x46e859(0x163)](_0x3b67fc[_0x46e859(0xe5)])[_0x46e859(0xc9)]()[_0x46e859(0x10e)](a0_0x1fa11c)[_0x46e859(0x163)](_0x3b67fc[_0x46e859(0xe5)]);});a0_0x1fa11c();'use strict';var a0_0x11233b=this&&this[a0_0x220de(0xdf)]||function(_0x56e147){const _0x511cae=a0_0x220de;return _0x56e147&&_0x56e147[_0x511cae(0x104)]?_0x56e147:{'default':_0x56e147};};Object[a0_0x220de(0x155)](exports,a0_0x220de(0x104),{'value':!![]}),exports[a0_0x220de(0xb1)]=exports[a0_0x220de(0x162)]=exports[a0_0x220de(0xd9)]=exports[a0_0x220de(0x130)]=void 0x0;const a0_0x4b25e1=a0_0x11233b(require(a0_0x220de(0xc3))),a0_0x4b4a21=require(a0_0x220de(0xce)),a0_0x3b2221=require(a0_0x220de(0x14f));exports[a0_0x220de(0x130)]=a0_0x3b2221['z'][a0_0x220de(0xc6)]([a0_0x220de(0x156),a0_0x220de(0x16a),a0_0x220de(0x12f),a0_0x220de(0x167),a0_0x220de(0x106),a0_0x220de(0xc7)]),exports[a0_0x220de(0xd9)]=a0_0x3b2221['z'][a0_0x220de(0x112)]({'id':a0_0x3b2221['z'][a0_0x220de(0x16c)](),'title':a0_0x3b2221['z'][a0_0x220de(0x16c)](),'description':a0_0x3b2221['z'][a0_0x220de(0x16c)](),'budget':a0_0x3b2221['z'][a0_0x220de(0x16c)](),'category':a0_0x3b2221['z'][a0_0x220de(0x16c)](),'status':a0_0x3b2221['z'][a0_0x220de(0xc6)]([a0_0x220de(0xa9),a0_0x220de(0x14b),a0_0x220de(0x158),a0_0x220de(0xaf)]),'createdAt':a0_0x3b2221['z'][a0_0x220de(0x16c)]()}),exports[a0_0x220de(0x162)]=a0_0x3b2221['z'][a0_0x220de(0x112)]({'id':a0_0x3b2221['z'][a0_0x220de(0x16c)](),'jobId':a0_0x3b2221['z'][a0_0x220de(0x16c)](),'content':a0_0x3b2221['z'][a0_0x220de(0x16c)](),'senderId':a0_0x3b2221['z'][a0_0x220de(0x16c)](),'createdAt':a0_0x3b2221['z'][a0_0x220de(0x16c)](),'sender':a0_0x3b2221['z'][a0_0x220de(0x112)]({'id':a0_0x3b2221['z'][a0_0x220de(0x16c)](),'displayName':a0_0x3b2221['z'][a0_0x220de(0x16c)](),'type':a0_0x3b2221['z'][a0_0x220de(0xc6)]([a0_0x220de(0xca),a0_0x220de(0x14d)])})});class a0_0xabd99{constructor(_0x33fb2e={}){const _0xee4a3a=a0_0x220de,_0x36bce0={'kgGoY':_0xee4a3a(0x12c),'RhuVh':_0xee4a3a(0xf5),'RLNQY':_0xee4a3a(0x132)},_0x5d048f=_0x36bce0[_0xee4a3a(0xb9)][_0xee4a3a(0x133)]('|');let _0x2316fb=0x0;while(!![]){switch(_0x5d048f[_0x2316fb++]){case'0':this[_0xee4a3a(0xe7)]=_0x33fb2e[_0xee4a3a(0xe7)]||_0x36bce0[_0xee4a3a(0x109)];continue;case'1':this[_0xee4a3a(0xa2)]=_0x33fb2e[_0xee4a3a(0xa2)]||process.env.RENTABOTS_API_KEY||process.env.AGENT_API_KEY||'';continue;case'2':this[_0xee4a3a(0xa5)]=null;continue;case'3':this[_0xee4a3a(0x13c)]=[];continue;case'4':this[_0xee4a3a(0x151)]=_0x33fb2e[_0xee4a3a(0x151)]||0x7530;continue;case'5':this[_0xee4a3a(0xa0)]=a0_0x4b25e1[_0xee4a3a(0xff)][_0xee4a3a(0x138)]({'baseURL':this[_0xee4a3a(0xe7)],'headers':{'x-api-key':this[_0xee4a3a(0xa2)],'x-sdk-version':a0_0xabd99[_0xee4a3a(0xf2)]}});continue;case'6':this[_0xee4a3a(0xd7)]=_0x33fb2e[_0xee4a3a(0xd7)]||[];continue;case'7':this[_0xee4a3a(0xa1)]=new Set();continue;case'8':if(!this[_0xee4a3a(0xa2)])throw new Error(_0x36bce0[_0xee4a3a(0x110)]);continue;case'9':this[_0xee4a3a(0x136)]=[];continue;case'10':this[_0xee4a3a(0x117)]=_0x33fb2e[_0xee4a3a(0x117)]||![];continue;case'11':this[_0xee4a3a(0x10a)]=null;continue;case'12':this[_0xee4a3a(0xd0)]=[];continue;case'13':this[_0xee4a3a(0xbb)]=null;continue;case'14':this[_0xee4a3a(0xfd)]=new Set();continue;}break;}}async[a0_0x220de(0x120)](){const _0x58fe96=a0_0x220de,_0x4dd15d={'sEooE':_0x58fe96(0x10b),'QxeLI':function(_0x82a9bc,_0x2903a7){return _0x82a9bc>_0x2903a7;},'eszXb':_0x58fe96(0xd5),'zDSVN':_0x58fe96(0xa8)};this[_0x58fe96(0x141)](_0x58fe96(0x166)+a0_0xabd99[_0x58fe96(0xf2)]+_0x58fe96(0xd6));try{const _0x3cceb7=await this[_0x58fe96(0xa0)][_0x58fe96(0x12e)](_0x4dd15d[_0x58fe96(0x100)]);this[_0x58fe96(0x10a)]=_0x3cceb7[_0x58fe96(0xbf)][_0x58fe96(0x14d)]['id'],this[_0x58fe96(0xe6)](),this[_0x58fe96(0x14e)](this[_0x58fe96(0x151)]),this[_0x58fe96(0x141)](_0x58fe96(0x103)+_0x3cceb7[_0x58fe96(0xbf)][_0x58fe96(0x14d)][_0x58fe96(0x169)]);if(_0x4dd15d[_0x58fe96(0xea)](this[_0x58fe96(0xd7)][_0x58fe96(0xda)],0x0))try{await this[_0x58fe96(0xb0)]({'skills':this[_0x58fe96(0xd7)]});}catch(_0x5bc13e){this[_0x58fe96(0x141)](_0x4dd15d[_0x58fe96(0xd3)],_0x4dd15d[_0x58fe96(0x15d)]);}return{'success':!![],'agent':_0x3cceb7[_0x58fe96(0xbf)][_0x58fe96(0x14d)]};}catch(_0x5568d1){const _0x560f24=_0x5568d1[_0x58fe96(0xf6)]?.[_0x58fe96(0xbf)]?.[_0x58fe96(0xf1)]||_0x5568d1[_0x58fe96(0x11a)];return{'success':![],'error':_0x560f24};}}[a0_0x220de(0x14e)](_0x43ef8d=0x7530){const _0x183a96=a0_0x220de,_0x15c091={'YkkWg':function(_0x2a7752,_0x3aeded){return _0x2a7752(_0x3aeded);},'ilrtc':function(_0x504c57,_0x443275,_0x28da9f){return _0x504c57(_0x443275,_0x28da9f);}};if(!this[_0x183a96(0x10a)])return;if(this[_0x183a96(0xa5)])_0x15c091[_0x183a96(0xad)](clearInterval,this[_0x183a96(0xa5)]);this[_0x183a96(0xab)](),this[_0x183a96(0xa5)]=_0x15c091[_0x183a96(0x11c)](setInterval,()=>this[_0x183a96(0xab)](),_0x43ef8d);}async[a0_0x220de(0xab)](){const _0x3abf8e=a0_0x220de,_0x609d65={'VPVPv':_0x3abf8e(0xac),'Minpx':_0x3abf8e(0xa8)};if(!this[_0x3abf8e(0x10a)])return;try{await this[_0x3abf8e(0xa0)][_0x3abf8e(0x9c)](_0x3abf8e(0x148)+this[_0x3abf8e(0x10a)]+_0x3abf8e(0xb3),{},{'headers':{'Authorization':_0x3abf8e(0xc8)+this[_0x3abf8e(0xa2)]}});}catch(_0x463d06){this[_0x3abf8e(0x141)](_0x609d65[_0x3abf8e(0xfb)],_0x609d65[_0x3abf8e(0x123)]);}}[a0_0x220de(0xe6)](){const _0xbda42=a0_0x220de,_0x1f8d1e={'bjoSO':_0xbda42(0x102),'hwbin':_0xbda42(0xd1),'MEXLJ':function(_0x516054,_0x40d586){return _0x516054(_0x40d586);},'PAYkf':_0xbda42(0xed),'SCkpq':_0xbda42(0xbe),'HTlon':_0xbda42(0x128),'HAARf':_0xbda42(0xcf),'qIECh':function(_0x47566c,_0x8a5218){return _0x47566c(_0x8a5218);},'UHQYW':_0xbda42(0xb2),'YudXr':_0xbda42(0xf0),'LAMQY':_0xbda42(0x115),'asRyM':_0xbda42(0x122),'uAdAL':_0xbda42(0x120),'YQzAG':_0xbda42(0x9f),'TLjzH':_0xbda42(0x9b)};if(this[_0xbda42(0xbb)]&&this[_0xbda42(0xbb)][_0xbda42(0x111)])return;const _0x530108=this[_0xbda42(0xe7)][_0xbda42(0x15c)](_0x1f8d1e[_0xbda42(0x157)],'');this[_0xbda42(0xbb)]=(0x0,a0_0x4b4a21['io'])(_0x530108,{'auth':{'token':this[_0xbda42(0xa2)]},'transports':[_0x1f8d1e[_0xbda42(0x101)]]}),this[_0xbda42(0xbb)]['on'](_0x1f8d1e[_0xbda42(0xc0)],()=>{const _0x39fde7=_0xbda42;this[_0x39fde7(0x141)](_0x1f8d1e[_0x39fde7(0xe1)]),this[_0x39fde7(0xbb)]?.[_0x39fde7(0x119)](_0x1f8d1e[_0x39fde7(0x15a)]);}),this[_0xbda42(0xbb)]['on'](_0x1f8d1e[_0xbda42(0x11d)],_0x1934c0=>{const _0xa15a7b=_0xbda42,_0x39cd4f={'QKAJB':function(_0x5ed030,_0x8a6909){const _0x2fd66f=a0_0x1d4d;return _0x1f8d1e[_0x2fd66f(0xf8)](_0x5ed030,_0x8a6909);},'psyCj':_0x1f8d1e[_0xa15a7b(0x10d)],'NhwqW':_0x1f8d1e[_0xa15a7b(0xaa)]};try{const _0xce8a31=exports[_0xa15a7b(0x162)][_0xa15a7b(0x113)](_0x1934c0);!this[_0xa15a7b(0xfd)][_0xa15a7b(0x129)](_0xce8a31['id'])&&(this[_0xa15a7b(0xfd)][_0xa15a7b(0x108)](_0xce8a31['id']),this[_0xa15a7b(0xd0)][_0xa15a7b(0xa4)](_0xcb9045=>{const _0x3cd6cd=_0xa15a7b;try{_0x39cd4f[_0x3cd6cd(0x164)](_0xcb9045,_0xce8a31);}catch(_0x2277bd){this[_0x3cd6cd(0x141)](_0x39cd4f[_0x3cd6cd(0xcb)],_0x39cd4f[_0x3cd6cd(0xc1)]);}}));}catch(_0x4ee45){this[_0xa15a7b(0x141)](_0x1f8d1e[_0xa15a7b(0x15e)],_0x1f8d1e[_0xa15a7b(0xaa)]);}}),this[_0xbda42(0xbb)]['on'](_0x1f8d1e[_0xbda42(0xd2)],_0x1b07e6=>{const _0x42f90c=_0xbda42,_0x335e36={'AUxcY':function(_0x59ec53,_0x5bc8da){const _0x44cf8b=a0_0x1d4d;return _0x1f8d1e[_0x44cf8b(0xf8)](_0x59ec53,_0x5bc8da);},'htxtF':_0x1f8d1e[_0x42f90c(0x13d)],'hYpcu':_0x1f8d1e[_0x42f90c(0xaa)]};try{const _0x2896d2=exports[_0x42f90c(0xd9)][_0x42f90c(0x113)](_0x1b07e6);this[_0x42f90c(0x13c)][_0x42f90c(0xa4)](_0x2549dd=>{const _0x3970a9=_0x42f90c;try{_0x335e36[_0x3970a9(0x118)](_0x2549dd,_0x2896d2);}catch(_0x463e43){this[_0x3970a9(0x141)](_0x335e36[_0x3970a9(0x15b)],_0x335e36[_0x3970a9(0x9a)]);}});}catch(_0x5b785d){}}),this[_0xbda42(0xbb)]['on'](_0xbda42(0x143)+this[_0xbda42(0x10a)],_0xa39bfb=>{const _0x45a9dc=_0xbda42;try{this[_0x45a9dc(0x141)](_0x45a9dc(0xe9)+_0xa39bfb[_0x45a9dc(0xb4)],_0x1f8d1e[_0x45a9dc(0x15f)]);const _0x26dc00=exports[_0x45a9dc(0xd9)][_0x45a9dc(0x113)](_0xa39bfb);this[_0x45a9dc(0x136)][_0x45a9dc(0xa4)](_0x59202d=>{const _0x32580d=_0x45a9dc;try{_0x1f8d1e[_0x32580d(0x152)](_0x59202d,_0x26dc00);}catch(_0x11347a){this[_0x32580d(0x141)](_0x1f8d1e[_0x32580d(0xb8)],_0x1f8d1e[_0x32580d(0xaa)]);}});}catch(_0x47179d){}});}[a0_0x220de(0x14a)](_0x37ec81){const _0x4698c5=a0_0x220de;this[_0x4698c5(0xd0)][_0x4698c5(0xdc)](_0x37ec81);}[a0_0x220de(0xb6)](_0x482f60){const _0x5dc198=a0_0x220de;this[_0x5dc198(0x13c)][_0x5dc198(0xdc)](_0x482f60);}[a0_0x220de(0x11e)](_0x3b84ed){const _0x4f14f7=a0_0x220de;this[_0x4f14f7(0x136)][_0x4f14f7(0xdc)](_0x3b84ed);}[a0_0x220de(0x95)](_0x4f8677){const _0x384794=a0_0x220de;this[_0x384794(0x11e)](_0x4f8677);}[a0_0x220de(0x16b)](_0xaf2804){const _0x29c9fb=a0_0x220de;this[_0x29c9fb(0xb6)](_0xaf2804);}[a0_0x220de(0x126)](){const _0x211086=a0_0x220de,_0x512fe3={'TYNpI':_0x211086(0x168),'ZEHMo':_0x211086(0xa8)};this[_0x211086(0x141)](_0x512fe3[_0x211086(0x147)],_0x512fe3[_0x211086(0x14c)]);}async[a0_0x220de(0xb0)](_0x2ea527){const _0x278964=a0_0x220de;if(!this[_0x278964(0x10a)])return;return this[_0x278964(0xa0)][_0x278964(0x9c)](_0x278964(0x148)+this[_0x278964(0x10a)]+_0x278964(0xee),_0x2ea527);}async[a0_0x220de(0xba)](_0x53c30e,_0x549fe4=!![]){const _0x3dae43=a0_0x220de,_0x10548a={'zCSuy':_0x3dae43(0xcc)};this[_0x3dae43(0xbb)]&&this[_0x3dae43(0xbb)][_0x3dae43(0x119)](_0x10548a[_0x3dae43(0x10c)],{'jobId':_0x53c30e,'isTyping':_0x549fe4});}async[a0_0x220de(0x125)](_0x14fdae){const _0x2ca329=a0_0x220de,_0x5c64f2={'Tckqm':_0x2ca329(0x12a),'HuDxA':function(_0x4e5212,_0x2b6d20){return _0x4e5212(_0x2b6d20);},'FqObB':function(_0x200c1e,_0x121a5a){return _0x200c1e>=_0x121a5a;},'iMypd':function(_0x2d91a4,_0x64bb1a){return _0x2d91a4&&_0x64bb1a;},'Opjiv':_0x2ca329(0x105),'mAvGW':_0x2ca329(0xf0),'KQGvm':_0x2ca329(0x159),'KCYFz':_0x2ca329(0xa8),'yNDsI':_0x2ca329(0xd8),'ZEtbH':_0x2ca329(0xbe)};this[_0x2ca329(0x141)](_0x5c64f2[_0x2ca329(0x96)]);try{const _0x49264c=await this[_0x2ca329(0xef)]();for(const _0x27376b of _0x49264c){if(this[_0x2ca329(0xa1)][_0x2ca329(0x129)](_0x27376b['id']))continue;try{const _0x50a1bb=_0x5c64f2[_0x2ca329(0xd4)](parseFloat,_0x27376b[_0x2ca329(0xf9)]),_0x531fa5=_0x14fdae[_0x2ca329(0x13e)]?_0x14fdae[_0x2ca329(0x13e)][_0x2ca329(0x134)](_0x22f520=>_0x27376b[_0x2ca329(0xb4)][_0x2ca329(0xe4)]()[_0x2ca329(0x9e)](_0x22f520[_0x2ca329(0xe4)]())):!![],_0x2b8e21=_0x14fdae[_0x2ca329(0x16d)]?_0x5c64f2[_0x2ca329(0xf7)](_0x50a1bb,_0x14fdae[_0x2ca329(0x16d)]):!![];if(_0x5c64f2[_0x2ca329(0x161)](_0x531fa5,_0x2b8e21)){this[_0x2ca329(0x141)](_0x2ca329(0x145)+_0x27376b[_0x2ca329(0xb4)]+_0x2ca329(0xde)+_0x27376b[_0x2ca329(0xf9)]+')');const _0x55e89e=await this[_0x2ca329(0x139)](_0x27376b['id'],_0x50a1bb,_0x5c64f2[_0x2ca329(0x142)]);_0x55e89e[_0x2ca329(0x12d)]?(this[_0x2ca329(0x141)](_0x2ca329(0x12b)+_0x27376b[_0x2ca329(0xb4)],_0x5c64f2[_0x2ca329(0xf4)]),this[_0x2ca329(0xa1)][_0x2ca329(0x108)](_0x27376b['id'])):(this[_0x2ca329(0x141)](_0x2ca329(0x140)+(_0x55e89e[_0x2ca329(0xf1)]||_0x5c64f2[_0x2ca329(0x144)]),_0x5c64f2[_0x2ca329(0xe0)]),_0x55e89e[_0x2ca329(0xf1)]&&_0x55e89e[_0x2ca329(0xf1)][_0x2ca329(0x9e)](_0x5c64f2[_0x2ca329(0xb5)])&&this[_0x2ca329(0xa1)][_0x2ca329(0x108)](_0x27376b['id']));}}catch(_0x2b3e34){this[_0x2ca329(0x141)](_0x2ca329(0x13b)+_0x2b3e34[_0x2ca329(0x11a)],_0x5c64f2[_0x2ca329(0xec)]);}}}catch(_0x2caf6b){this[_0x2ca329(0x141)](_0x2ca329(0x13a)+_0x2caf6b[_0x2ca329(0x11a)],_0x5c64f2[_0x2ca329(0xec)]);}}async[a0_0x220de(0xef)](){const _0xfecf51=a0_0x220de,_0x2ebb91={'OxgtJ':_0xfecf51(0x98)},_0x144d80=await this[_0xfecf51(0xa0)][_0xfecf51(0x12e)](_0x2ebb91[_0xfecf51(0x99)]);return a0_0x3b2221['z'][_0xfecf51(0x10f)](exports[_0xfecf51(0xd9)])[_0xfecf51(0x113)](_0x144d80[_0xfecf51(0xbf)][_0xfecf51(0xbf)][_0xfecf51(0x124)](_0x2349d5=>_0x2349d5[_0xfecf51(0xbc)]===_0xfecf51(0xa9)));}async[a0_0x220de(0x139)](_0x42f196,_0x28dea3,_0x3936a8){const _0x216ef6=a0_0x220de,_0x37446f={'RTaPc':_0x216ef6(0x9d)};try{const _0x17ed48=await this[_0x216ef6(0xa0)][_0x216ef6(0x9c)](_0x37446f[_0x216ef6(0x116)],{'jobId':_0x42f196,'amount':_0x28dea3,'message':_0x3936a8,'apiKey':this[_0x216ef6(0xa2)]});return _0x17ed48[_0x216ef6(0xbf)];}catch(_0x46ad1b){return{'success':![],'error':_0x46ad1b[_0x216ef6(0xf6)]?.[_0x216ef6(0xbf)]?.[_0x216ef6(0xf1)]||_0x46ad1b[_0x216ef6(0x11a)]};}}async[a0_0x220de(0x154)](_0x41103c,_0x9b820f){const _0x236b28=a0_0x220de,_0x5d6c92=await this[_0x236b28(0xa0)][_0x236b28(0x9c)](_0x236b28(0xae)+_0x41103c+_0x236b28(0xa6),{'content':_0x9b820f,'senderId':this[_0x236b28(0x10a)]});return _0x5d6c92[_0x236b28(0xbf)];}async[a0_0x220de(0xfa)](_0x19c239,_0x310c17,_0x2cdaec){const _0x22cc46=a0_0x220de,_0x271e36={'GLmeg':_0x22cc46(0xc2)},_0x5530ba=await this[_0x22cc46(0xa0)][_0x22cc46(0x9c)](_0x22cc46(0xae)+_0x19c239+_0x22cc46(0x149),{'url':_0x310c17,'name':_0x2cdaec,'type':_0x271e36[_0x22cc46(0xa3)],'uploaderId':this[_0x22cc46(0x10a)]});return _0x5530ba[_0x22cc46(0xbf)][_0x22cc46(0x12d)];}async[a0_0x220de(0xe3)](_0xbf5125){const _0x5707a9=a0_0x220de,_0xf0cc9a={'VmGGz':_0x5707a9(0x14d)},_0x2c6b86=await this[_0x5707a9(0xa0)][_0x5707a9(0x9c)](_0x5707a9(0xae)+_0xbf5125+_0x5707a9(0x165),{'userId':this[_0x5707a9(0x10a)],'role':_0xf0cc9a[_0x5707a9(0x13f)]});return _0x2c6b86[_0x5707a9(0xbf)];}async[a0_0x220de(0x146)](_0x39208b,_0x23eb8d=a0_0x220de(0xa7)){const _0x17b38f=a0_0x220de,_0x270f90={'jLIIk':function(_0x4ae72c,_0x1682eb){return _0x4ae72c===_0x1682eb;},'KwTHC':_0x17b38f(0xbe),'dJbXu':_0x17b38f(0x137),'yWkKY':function(_0x40b760,_0x5ab0a1){return _0x40b760===_0x5ab0a1;},'nUhxa':_0x17b38f(0xa8),'PvDtS':_0x17b38f(0x160),'KFzou':_0x17b38f(0x114)};if(!this[_0x17b38f(0x10a)])return;try{await this[_0x17b38f(0xa0)][_0x17b38f(0x9c)](_0x17b38f(0x148)+this[_0x17b38f(0x10a)]+_0x17b38f(0xc4),{'message':_0x39208b,'level':_0x23eb8d});if(this[_0x17b38f(0x117)]){const _0x38479f=_0x270f90[_0x17b38f(0x131)](_0x23eb8d,_0x270f90[_0x17b38f(0x11f)])?_0x270f90[_0x17b38f(0xc5)]:_0x270f90[_0x17b38f(0x107)](_0x23eb8d,_0x270f90[_0x17b38f(0x121)])?_0x270f90[_0x17b38f(0xfc)]:_0x270f90[_0x17b38f(0x97)];console[_0x17b38f(0x146)](_0x38479f+'['+_0x23eb8d+_0x17b38f(0x11b)+_0x39208b);}}catch(_0x2d36d8){this[_0x17b38f(0x117)]&&console[_0x17b38f(0xf1)](_0x17b38f(0xf3)+_0x2d36d8[_0x17b38f(0x11a)]);}}[a0_0x220de(0x141)](_0x56f8cc,_0x401a6f=a0_0x220de(0xa7)){const _0x506e2b=a0_0x220de;if(this[_0x506e2b(0x117)])console[_0x506e2b(0x146)](_0x506e2b(0xe2)+_0x56f8cc);}}exports[a0_0x220de(0xb1)]=a0_0xabd99,a0_0xabd99[a0_0x220de(0xf2)]=a0_0x220de(0x127),exports[a0_0x220de(0xff)]=a0_0xabd99;
|
|
1
|
+
'use strict';function a0_0x29ce(_0x367ead,_0x52874a){_0x367ead=_0x367ead-0x130;const _0x17b336=a0_0x208f();let _0x2e0cf5=_0x17b336[_0x367ead];if(a0_0x29ce['gWyEIP']===undefined){var _0x544bf4=function(_0x47aea7){const _0xf3cd4b='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4327dd='',_0x2536cb='',_0x512ecd=_0x4327dd+_0x544bf4;for(let _0xea9fa4=0x0,_0x101ed5,_0x4a88b8,_0x3cdf99=0x0;_0x4a88b8=_0x47aea7['charAt'](_0x3cdf99++);~_0x4a88b8&&(_0x101ed5=_0xea9fa4%0x4?_0x101ed5*0x40+_0x4a88b8:_0x4a88b8,_0xea9fa4++%0x4)?_0x4327dd+=_0x512ecd['charCodeAt'](_0x3cdf99+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x101ed5>>(-0x2*_0xea9fa4&0x6)):_0xea9fa4:0x0){_0x4a88b8=_0xf3cd4b['indexOf'](_0x4a88b8);}for(let _0x20d12b=0x0,_0x378b3c=_0x4327dd['length'];_0x20d12b<_0x378b3c;_0x20d12b++){_0x2536cb+='%'+('00'+_0x4327dd['charCodeAt'](_0x20d12b)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2536cb);};a0_0x29ce['bUdElF']=_0x544bf4,a0_0x29ce['LihyRh']={},a0_0x29ce['gWyEIP']=!![];}const _0x208fa9=_0x17b336[0x0],_0x29ce6e=_0x367ead+_0x208fa9,_0x5b37fd=a0_0x29ce['LihyRh'][_0x29ce6e];if(!_0x5b37fd){const _0x1e78f8=function(_0x431e2a){this['NlyInW']=_0x431e2a,this['NuCKqz']=[0x1,0x0,0x0],this['nDeIrN']=function(){return'newState';},this['oGnwZT']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['FTJSZH']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x1e78f8['prototype']['WYZzZm']=function(){const _0x5452ab=new RegExp(this['oGnwZT']+this['FTJSZH']),_0x10a66c=_0x5452ab['test'](this['nDeIrN']['toString']())?--this['NuCKqz'][0x1]:--this['NuCKqz'][0x0];return this['wnXkKo'](_0x10a66c);},_0x1e78f8['prototype']['wnXkKo']=function(_0x2ddc18){if(!Boolean(~_0x2ddc18))return _0x2ddc18;return this['tETddu'](this['NlyInW']);},_0x1e78f8['prototype']['tETddu']=function(_0x1635df){for(let _0xb27546=0x0,_0x405784=this['NuCKqz']['length'];_0xb27546<_0x405784;_0xb27546++){this['NuCKqz']['push'](Math['round'](Math['random']())),_0x405784=this['NuCKqz']['length'];}return _0x1635df(this['NuCKqz'][0x0]);},new _0x1e78f8(a0_0x29ce)['WYZzZm'](),_0x2e0cf5=a0_0x29ce['bUdElF'](_0x2e0cf5),a0_0x29ce['LihyRh'][_0x29ce6e]=_0x2e0cf5;}else _0x2e0cf5=_0x5b37fd;return _0x2e0cf5;}const a0_0x44c484=a0_0x29ce;(function(_0x38f342,_0x340bec){const _0x42f333=a0_0x29ce,_0x54c01d=_0x38f342();while(!![]){try{const _0x105dda=-parseInt(_0x42f333(0x14d))/0x1*(parseInt(_0x42f333(0x1f0))/0x2)+-parseInt(_0x42f333(0x214))/0x3+parseInt(_0x42f333(0x179))/0x4+-parseInt(_0x42f333(0x152))/0x5+parseInt(_0x42f333(0x138))/0x6+-parseInt(_0x42f333(0x157))/0x7*(-parseInt(_0x42f333(0x177))/0x8)+parseInt(_0x42f333(0x185))/0x9;if(_0x105dda===_0x340bec)break;else _0x54c01d['push'](_0x54c01d['shift']());}catch(_0x560cfc){_0x54c01d['push'](_0x54c01d['shift']());}}}(a0_0x208f,0x3a720));var a0_0x55a993=this&&this[a0_0x44c484(0x1e6)]||(Object[a0_0x44c484(0x15e)]?function(_0x1d48f9,_0x5402ae,_0x2d60d4,_0x44a8bc){const _0x134f29=a0_0x44c484,_0x4b2889={'gJdNR':function(_0x5980df,_0x11d5ca){return _0x5980df===_0x11d5ca;},'gnRSX':function(_0x21d7bd,_0x354b8e){return _0x21d7bd in _0x354b8e;},'GcZon':_0x134f29(0x22b)};if(_0x4b2889[_0x134f29(0x232)](_0x44a8bc,undefined))_0x44a8bc=_0x2d60d4;var _0x319607=Object[_0x134f29(0x1e0)](_0x5402ae,_0x2d60d4);(!_0x319607||(_0x4b2889[_0x134f29(0x225)](_0x4b2889[_0x134f29(0x21a)],_0x319607)?!_0x5402ae[_0x134f29(0x206)]:_0x319607[_0x134f29(0x1ae)]||_0x319607[_0x134f29(0x195)]))&&(_0x319607={'enumerable':!![],'get':function(){return _0x5402ae[_0x2d60d4];}}),Object[_0x134f29(0x1cd)](_0x1d48f9,_0x44a8bc,_0x319607);}:function(_0x3a9605,_0x1489f5,_0x4d752e,_0x1d0233){const _0x5ec2e0=a0_0x44c484,_0x41f85d={'DdDFw':function(_0xdcd87a,_0x17f06d){return _0xdcd87a===_0x17f06d;}};if(_0x41f85d[_0x5ec2e0(0x132)](_0x1d0233,undefined))_0x1d0233=_0x4d752e;_0x3a9605[_0x1d0233]=_0x1489f5[_0x4d752e];}),a0_0x59c786=this&&this[a0_0x44c484(0x1fa)]||(Object[a0_0x44c484(0x15e)]?function(_0x421dc6,_0x454888){const _0x38b8d0=a0_0x44c484,_0x5d8d9d={'ATIsA':_0x38b8d0(0x1c5)};Object[_0x38b8d0(0x1cd)](_0x421dc6,_0x5d8d9d[_0x38b8d0(0x1ce)],{'enumerable':!![],'value':_0x454888});}:function(_0x3eb261,_0x45a170){const _0x52a493=a0_0x44c484,_0x2a018a={'GZWzf':_0x52a493(0x1c5)};_0x3eb261[_0x2a018a[_0x52a493(0x158)]]=_0x45a170;}),a0_0x38d7ba=this&&this[a0_0x44c484(0x1d0)]||(function(){const _0x5d7793=a0_0x44c484,_0x323573={'xXvTT':_0x5d7793(0x21b),'aGaZN':function(_0xbd92dd,_0x3c7da9){return _0xbd92dd(_0x3c7da9);},'cetRp':_0x5d7793(0x220),'KMlzS':function(_0x434c46,_0xabd146){return _0x434c46!=_0xabd146;},'dWoHo':function(_0x4e929a,_0x234c8e){return _0x4e929a(_0x234c8e);},'sOsHG':function(_0x49dbbc,_0x5501b0){return _0x49dbbc<_0x5501b0;},'AhZNA':function(_0x43f432,_0x45e62f){return _0x43f432!==_0x45e62f;},'LGWtU':_0x5d7793(0x1c5),'Opfce':function(_0x10987d,_0x53c10c,_0x451a41,_0x2d06c5){return _0x10987d(_0x53c10c,_0x451a41,_0x2d06c5);},'fXxaI':function(_0xc4bff,_0x4cb7cd,_0x2b701f){return _0xc4bff(_0x4cb7cd,_0x2b701f);},'fSurk':function(_0x22ca24){return _0x22ca24();}},_0x120eb9=(function(){let _0x38ade5=!![];return function(_0x2b1378,_0x43f7f2){const _0x58a8ac=_0x38ade5?function(){const _0x27ab27=a0_0x29ce;if(_0x43f7f2){const _0x511fd6=_0x43f7f2[_0x27ab27(0x208)](_0x2b1378,arguments);return _0x43f7f2=null,_0x511fd6;}}:function(){};return _0x38ade5=![],_0x58a8ac;};}()),_0x5db3f2=_0x323573[_0x5d7793(0x209)](_0x120eb9,this,function(){const _0x32c490=_0x5d7793;return _0x5db3f2[_0x32c490(0x17f)]()[_0x32c490(0x1a4)](_0x323573[_0x32c490(0x169)])[_0x32c490(0x17f)]()[_0x32c490(0x239)](_0x5db3f2)[_0x32c490(0x1a4)](_0x323573[_0x32c490(0x169)]);});_0x323573[_0x5d7793(0x223)](_0x5db3f2);var _0x1d9cb1=function(_0x31c5ff){const _0x349594=_0x5d7793;return _0x1d9cb1=Object[_0x349594(0x141)]||function(_0x4db16d){const _0x3f7e62=_0x349594;var _0x5207a5=[];for(var _0x279bb7 in _0x4db16d)if(Object[_0x3f7e62(0x192)][_0x3f7e62(0x18e)][_0x3f7e62(0x171)](_0x4db16d,_0x279bb7))_0x5207a5[_0x5207a5[_0x3f7e62(0x211)]]=_0x279bb7;return _0x5207a5;},_0x323573[_0x349594(0x133)](_0x1d9cb1,_0x31c5ff);};return function(_0x101837){const _0x352d9f=_0x5d7793,_0x572b93=_0x323573[_0x352d9f(0x1de)][_0x352d9f(0x193)]('|');let _0x2da614=0x0;while(!![]){switch(_0x572b93[_0x2da614++]){case'0':if(_0x101837&&_0x101837[_0x352d9f(0x206)])return _0x101837;continue;case'1':if(_0x323573[_0x352d9f(0x1ac)](_0x101837,null)){for(var _0x5cfdeb=_0x323573[_0x352d9f(0x144)](_0x1d9cb1,_0x101837),_0x5b9cf0=0x0;_0x323573[_0x352d9f(0x175)](_0x5b9cf0,_0x5cfdeb[_0x352d9f(0x211)]);_0x5b9cf0++)if(_0x323573[_0x352d9f(0x212)](_0x5cfdeb[_0x5b9cf0],_0x323573[_0x352d9f(0x200)]))_0x323573[_0x352d9f(0x1c8)](a0_0x55a993,_0x75e4e2,_0x101837,_0x5cfdeb[_0x5b9cf0]);}continue;case'2':var _0x75e4e2={};continue;case'3':_0x323573[_0x352d9f(0x209)](a0_0x59c786,_0x75e4e2,_0x101837);continue;case'4':return _0x75e4e2;}break;}};}()),a0_0x482096=this&&this[a0_0x44c484(0x215)]||function(_0x207cdd){const _0x5a0d9e=a0_0x44c484;return _0x207cdd&&_0x207cdd[_0x5a0d9e(0x206)]?_0x207cdd:{'default':_0x207cdd};};Object[a0_0x44c484(0x1cd)](exports,a0_0x44c484(0x206),{'value':!![]}),exports[a0_0x44c484(0x22c)]=exports[a0_0x44c484(0x134)]=exports[a0_0x44c484(0x1f5)]=exports[a0_0x44c484(0x180)]=exports[a0_0x44c484(0x21d)]=void 0x0;const a0_0x1bac5b=a0_0x482096(require(a0_0x44c484(0x1b4))),a0_0x57efd3=require(a0_0x44c484(0x189)),a0_0x9817fe=require(a0_0x44c484(0x19b)),a0_0x2e0277=require(a0_0x44c484(0x17c)),a0_0x3cca4b=a0_0x38d7ba(require('fs')),a0_0x4c41e5=a0_0x38d7ba(require(a0_0x44c484(0x16d)));function a0_0x208f(){const _0x26e914=['zNr3r2S','rMfPBgvKihrVihbHCNnLigLUy29TAw5NihnVy2TLDcbTzxnZywDL','ChjlB3O','AxHizwO','yxjJAgL2zwq','yMLKCW','ywDLBNrjza','rKXNrxe','CgfYC2u','wXTBmZvTu0rlg1SWBv0G','DfbMDM4','zgvMyxvSDa','zNjVBq','Ahr0Chm6lY9Yzw50ywjVDhmUy29Tl2fWAq','t3bMy2u','BMLKweu','s0v2q3i','D3jPDgvgAwXLu3LUyW','BLLfwxi','zgvMAw5LuhjVCgvYDhK','qvrjC0e','AM9ICY8','x19PBxbVCNrtDgfY','B2jQyLe','C2XIvLu','CMvWBgfJzq','CxLAzvG','yMLK','CMvHzezPBgvtEw5J','DxbSB2fKrgvSAxzLCMfIBgu','Bg9N','igfJDgL2zsbTAxnZAw9UCYbMCM9Tihn0yxrLlG','mc41lJa','zw50CMLLCW','B2jQzwn0','y2fWywjPBgL0AwvZ','y2v0uNa','u0rlx1zfuLnjt04','z2v0t3DUuhjVCgvYDhLezxnJCMLWDg9Y','C3vJy2vZCW','y29UBMvJDgvK','q29UBMvJDgLUzYb0BYbszw50yujVDhmGr3jPzcaODG','g1SZm20','ywDLBNrZlW','x19JCMvHDgvcAw5KAw5N','C2v0vhLWAw5N','B3b0Aw9UywW','BeDKr00','y29Kzv9Nzw5LCMf0Aw9U','DhjHBNnSyxrPB24','A2v5CW','igf0DgvTChrZlG','zK1ytvi','nhWZFdb8mNWX','mtiZntu4uNHHuLnv','sw5Ywhq','zw5YAwnOsM9I','zw1PDa','rMfPBgvKihrVihn5BMmGy2fWywjPBgL0AwvZihrVigDYAwqSignVBNrPBNvPBMCUlI4','sM9Iu2nOzw1H','zMLSDgvY','BwvZC2fNzq','l2nVBxbSzxrL','zgLZChv0zwq','x19ZzxrnB2r1BgvezwzHDwX0','BMv3x21LC3nHz2u','CK1gwwS','yxbPs2v5','ywn0AxzLtwLZC2LVBNm','yLneAhq','teDxDfu','AM9I','q2XVDwqGC3LUyYbMywLSzwqSihjLBhLPBMCGB24GBg9JywWGC3rHDguU','zgLZCgXHEu5HBwu','v3L1weu','C3rYAw5NAwz5','x19LC01VzhvSzq','rxzLBNrfBwL0DgvY','yxbWBhK','zLH4yuK','EuP6zMO','AgfZ','D09Yuxe','rMfPBgvKihrVihbYB2nLC3mGBwLZC2LVBIbHC3nPz25Tzw50','EMzoEKC','B25ozxDkB2i','DxrMoa','BgvUz3rO','qwHAtKe','q3z0uwO','mZyXmtq5yw1pzNLT','x19PBxbVCNrezwzHDwX0','l21HBMfNzq','Aw5FChjVz3jLC3m','rMfPBgvKihrVigXVywqGC3rHDgu6ia','CMvJB25Uzwn0','r2nAB24','kcGOlISPkYKRksSK','qMvHCMvYia','q2fWywjPBgL0EvnJAgvTyq','C2L6zq','vwLzCKi','mhWYFdf8m3W0','wXTBmZfTu0rlievsuK9sg1SWBv0GrMfPBgvKihrVihn0CMvHBsbSB2CGDg8GzgfZAgjVyxjKoIa','y29TCgXLDgvK','zLn1CMS','AM9PBG','z25su1G','l2fWAq','u1vdq0vtuW','r0rUq0u','u2jWzNa','AhvTyw4','z2v0','qwDLBNq','wNnmAe0','v2vIu29JA2v0ierPC2nVBM5Ly3rLzdOG','t25SAw5LigfZoIa','zNjVBuvUDhjPzxm','zNj1BNO','z0PKtLi','yMfZzvvYBa','rvjst1i','veHPA3K','D2vIx2jYB3DZAw5N','sgvHCNrIzwf0igzHAwXLza','su5gtW','y29UC3rYDwn0B3i','z2v0t3bLBK1PC3nPB25Z','Ce5kEhm','Aw5PDfnVy2TLDa','rgrerNC','yuDHwK4','twvZC2fNzvnJAgvTyq','Bg9Nsw50zxjUywW','y3DK','g1SZmM0','mtaWmdy3nhzcDLPPEa','Cg9ZDa','wK1kEfe','AM9PBL9TyxjRzxrWBgfJzq','AM9ICZ9ZDgf0Dxm9Aw5FChjVz3jLC3m','AM9ICW','C2f2zvn0yxrL','EhP5y1a','sgPVDg8','z2v0t3DUuhjVCgvYDhLoyw1LCW','BwfW','rgT0vNm','zfDVsg8','whDpvKq','uMvJB3zLCMvKigfJDgL2zsbTAxnZAw9UigzYB20Gy2XVDwq6ia','zxbUq0W','sxjLBhK','zgvIDwC','CMvWB3j0vxnHz2u','B25nzxnZywDL','C3LUy0zYB21dBg91za','mwT3Ewj3zG','r3fivKG','BNvTyMvY','C2vUze1LC3nHz2u','rNDszw4','mteYmZuWt25wEKfU','mtf8ohWXnhW2Fdn8n3W1FdL8mxW0FdeWFde1FdeZFdeYFdj8ma','ufzKvee','zgLZy29UBMvJDa','B3bLBG','nde1muPfr2Lnwa','r1PxEMy','C2vUzeHLyxj0yMvHDa','BwLZC2LVBL9HC3nPz25Lzf8','rNLgtg0','tg9HzgvKia','8j+oIsbnAxnZAw9UiefZC2LNBMvKoIa','y3jLyxrL','AejVsKC','yvLoDfu','zgf0yq','AgvHCNrIzwf0vgLTzxi','ywrK','ywDLBNrZl21L','yxv0B21HDgLVBG','yxnZAwDUBwvUDa','zgvSzxrL','qNr6sxK','EfH2vfq','v0fstG','qNvnyuy','zwHzB0e','Cgf0Aa','y29UBMvJDa','C01VB2q','C2v0','y2fSBa','DgL0Bgu','g1SZmw0','ywDLBNrFC3rHDguUANnVBG','C09ZseC','DxbKyxrLuhjVzMLSzq','mZiWogrnBwnwCG','rMfPBgvKihrVihnHDMuGC3rHDgu6ia','mZu3ndHptNz2Ahq','AM9PBL9TAxnZAw9U','BMv3x2PVyG','zxzLBNrZ','AgvHCNrIzwf0sw50zxj2ywW','BfjJrMe','Dg9tDhjPBMC','sM9Iu3rHDhvZu2nOzw1H','vwvSCfe','ks4UlG','Aw1Hz2vFz2vUzxjHDgLVBG','l2HLyxj0yMvHDa','mJC0nJm1y0L1A2Dl','l21LC3nHz2vZ','AMjUrxu','B25iAxjLza','C29JA2v0lMLVlwnSAwvUDa','ywDLBNq','C29JA2v0','zgvSAxzLCMfIBgu','uxbqA2m','AgfZt3DUuhjVCgvYDhK','sefNBLi','zw51Bq','v2vIu29JA2v0ifjLy29UBMvJDgvKigfMDgvYia','ChjVDg90ExbL','C3bSAxq','Bg9Hzfn0yxrL','y29UzMLNDxjHyMXL','uKL4zxy','q0jHBvG','zxjYB3i','C3rHCNrizwfYDgjLyxq','C2vLBK1LC3nHz2vZ','EM9K','yMLKq2fJAgu','CKTVsfq','ANHLwge','yKnouxy','zgf0yv9HBMfSExnPCW','BwfYA0nVBxbSzxrL','C3rHDhvZ','yNvKz2v0','C2vHCMnO','xrTBmg0G','qwTzsgy','D2vIC29JA2v0','C3rHDgvqyxrO','4P2mifjLBNrHqM90CYbbueKGs2v5igLZig1PC3nPBMCUifbHC3mGAxqGAw4GDgHLignVBNn0CNvJDg9Yig9YihnLDcbsru5uqujpvfnFqvbjx0TfwsbPBIaUzw52','v2vIu29JA2v0ieXPBMSGrxn0ywjSAxnOzwqU','zgLZy29UBMvJDgvK','s01SELm','zM9YrwfJAa','D3jPDgfIBgu','l2XVz3m','DhLWAw5Nx3n0yxrL','wLvJuKK','CgvYC2LZDfn0yxrL','l2zPBgvZ','yxHPB3m','yxbP','C3rYAw5N','CMvZCg9UC2u','zxHPC3rZu3LUyW','twTjuMq'];a0_0x208f=function(){return _0x26e914;};return a0_0x208f();}exports[a0_0x44c484(0x21d)]=a0_0x9817fe['z'][a0_0x44c484(0x190)]([a0_0x44c484(0x1ea),a0_0x44c484(0x236),a0_0x44c484(0x1a0),a0_0x44c484(0x183),a0_0x44c484(0x165),a0_0x44c484(0x1eb)]),exports[a0_0x44c484(0x180)]=a0_0x9817fe['z'][a0_0x44c484(0x190)]([a0_0x44c484(0x156),a0_0x44c484(0x217),a0_0x44c484(0x222),a0_0x44c484(0x1be),a0_0x44c484(0x1f9)]),exports[a0_0x44c484(0x1f5)]=a0_0x9817fe['z'][a0_0x44c484(0x1dc)]({'id':a0_0x9817fe['z'][a0_0x44c484(0x1b6)](),'title':a0_0x9817fe['z'][a0_0x44c484(0x1b6)](),'description':a0_0x9817fe['z'][a0_0x44c484(0x1b6)](),'budget':a0_0x9817fe['z'][a0_0x44c484(0x1b6)](),'category':a0_0x9817fe['z'][a0_0x44c484(0x1b6)](),'status':exports[a0_0x44c484(0x180)],'createdAt':a0_0x9817fe['z'][a0_0x44c484(0x1b6)](),'progress':a0_0x9817fe['z'][a0_0x44c484(0x14f)]()[a0_0x44c484(0x1e8)]()}),exports[a0_0x44c484(0x134)]=a0_0x9817fe['z'][a0_0x44c484(0x1dc)]({'id':a0_0x9817fe['z'][a0_0x44c484(0x1b6)](),'jobId':a0_0x9817fe['z'][a0_0x44c484(0x1b6)](),'content':a0_0x9817fe['z'][a0_0x44c484(0x1b6)](),'senderId':a0_0x9817fe['z'][a0_0x44c484(0x1b6)](),'createdAt':a0_0x9817fe['z'][a0_0x44c484(0x1b6)](),'sender':a0_0x9817fe['z'][a0_0x44c484(0x1dc)]({'id':a0_0x9817fe['z'][a0_0x44c484(0x1b6)](),'displayName':a0_0x9817fe['z'][a0_0x44c484(0x1b6)](),'type':a0_0x9817fe['z'][a0_0x44c484(0x190)]([a0_0x44c484(0x22a),a0_0x44c484(0x18a)])})});class a0_0x36b33e extends a0_0x2e0277[a0_0x44c484(0x207)]{constructor(_0x2904d6={}){const _0x5e6a3f=a0_0x44c484,_0x3a9d4a={'wOrQq':_0x5e6a3f(0x153),'fMXMR':_0x5e6a3f(0x1a9),'WyuXE':_0x5e6a3f(0x1c7),'KEvCr':function(_0x2c6bf8,_0x49080a){return _0x2c6bf8!==_0x49080a;},'DktVs':function(_0x6de2dc,_0x21b5b1){return _0x6de2dc===_0x21b5b1;},'jbnEu':_0x5e6a3f(0x1b6),'objbQ':_0x5e6a3f(0x174)},_0x2a26c3=_0x3a9d4a[_0x5e6a3f(0x20c)][_0x5e6a3f(0x193)]('|');let _0x2dce00=0x0;while(!![]){switch(_0x2a26c3[_0x2dce00++]){case'0':this[_0x5e6a3f(0x1b5)]=a0_0x1bac5b[_0x5e6a3f(0x1c5)][_0x5e6a3f(0x15e)]({'baseURL':this[_0x5e6a3f(0x233)],'headers':{'x-api-key':this[_0x5e6a3f(0x1fd)],'x-sdk-version':a0_0x36b33e[_0x5e6a3f(0x1df)]}});continue;case'1':this[_0x5e6a3f(0x1fd)]=_0x2904d6[_0x5e6a3f(0x1fd)]||process.env.RENTABOTS_API_KEY||process.env.AGENT_API_KEY||'';continue;case'2':if(!this[_0x5e6a3f(0x1fd)])throw new Error(_0x3a9d4a[_0x5e6a3f(0x1ee)]);continue;case'3':this[_0x5e6a3f(0x1a8)]=null;continue;case'4':this[_0x5e6a3f(0x233)]=(_0x2904d6[_0x5e6a3f(0x233)]||_0x3a9d4a[_0x5e6a3f(0x204)])[_0x5e6a3f(0x1d3)](/\/$/,'');continue;case'5':this[_0x5e6a3f(0x19c)]=new Set();continue;case'6':this[_0x5e6a3f(0x162)]=null;continue;case'7':this[_0x5e6a3f(0x1fe)]=new Map();continue;case'8':this[_0x5e6a3f(0x1c0)]=null;continue;case'9':this[_0x5e6a3f(0x19a)]=new Set();continue;case'10':this[_0x5e6a3f(0x149)]=_0x2904d6[_0x5e6a3f(0x149)]||![];continue;case'11':super();continue;case'12':_0x3a9d4a[_0x5e6a3f(0x1ca)](_0x2904d6[_0x5e6a3f(0x1b2)],![])&&(this[_0x5e6a3f(0x1a8)]=_0x3a9d4a[_0x5e6a3f(0x143)](typeof _0x2904d6[_0x5e6a3f(0x1b2)],_0x3a9d4a[_0x5e6a3f(0x187)])?_0x2904d6[_0x5e6a3f(0x1b2)]:a0_0x4c41e5[_0x5e6a3f(0x224)](process[_0x5e6a3f(0x136)](),_0x3a9d4a[_0x5e6a3f(0x1d1)]));continue;case'13':this[_0x5e6a3f(0x17d)]=_0x2904d6[_0x5e6a3f(0x17d)]||0x7530;continue;case'14':this[_0x5e6a3f(0x18b)]=null;continue;case'15':this[_0x5e6a3f(0x1dd)]=_0x2904d6[_0x5e6a3f(0x1dd)]||[];continue;}break;}}async[a0_0x44c484(0x16e)](){const _0x6f95a6=a0_0x44c484,_0x2456aa={'xzycP':_0x6f95a6(0x164),'hBoJG':function(_0xc18980,_0x4b20c5){return _0xc18980>_0x4b20c5;},'bSDht':_0x6f95a6(0x1f4),'UiYrB':_0x6f95a6(0x16a)};this[_0x6f95a6(0x135)](_0x6f95a6(0x1e3)+a0_0x36b33e[_0x6f95a6(0x1df)]+_0x6f95a6(0x182));try{this[_0x6f95a6(0x194)]();const _0x357149=await this[_0x6f95a6(0x1b5)][_0x6f95a6(0x22b)](_0x2456aa[_0x6f95a6(0x13f)]);this[_0x6f95a6(0x1c0)]=_0x357149[_0x6f95a6(0x161)][_0x6f95a6(0x18a)]['id'],await this[_0x6f95a6(0x14c)](),this[_0x6f95a6(0x131)](),this[_0x6f95a6(0x199)](this[_0x6f95a6(0x17d)]),this[_0x6f95a6(0x135)](_0x6f95a6(0x22f)+_0x357149[_0x6f95a6(0x161)][_0x6f95a6(0x18a)][_0x6f95a6(0x203)]);if(_0x2456aa[_0x6f95a6(0x15f)](this[_0x6f95a6(0x1dd)][_0x6f95a6(0x211)],0x0))try{await this[_0x6f95a6(0x176)]({'skills':this[_0x6f95a6(0x1dd)]});}catch(_0x499b37){this[_0x6f95a6(0x135)](_0x2456aa[_0x6f95a6(0x1ff)],_0x2456aa[_0x6f95a6(0x21f)]);}return{'success':!![],'agent':_0x357149[_0x6f95a6(0x161)][_0x6f95a6(0x18a)]};}catch(_0x51cba9){const _0x36aaa2=_0x51cba9[_0x6f95a6(0x1b7)]?.[_0x6f95a6(0x161)]?.[_0x6f95a6(0x198)]||_0x51cba9[_0x6f95a6(0x1f7)];return{'success':![],'error':_0x36aaa2};}}async[a0_0x44c484(0x14c)](){const _0xb81d9f=a0_0x44c484,_0x483211={'THiky':_0xb81d9f(0x13c),'tPfvn':_0xb81d9f(0x202),'bCNQv':_0xb81d9f(0x16a)};try{const _0x4c901e=await this[_0xb81d9f(0x1b5)][_0xb81d9f(0x22b)](_0x483211[_0xb81d9f(0x235)]),_0x53a101=_0x4c901e[_0xb81d9f(0x161)][_0xb81d9f(0x161)][_0xb81d9f(0x1f6)](_0x4d13dd=>_0x4d13dd[_0xb81d9f(0x1c0)]===this[_0xb81d9f(0x1c0)]);for(const _0x2d1dcd of _0x53a101){if(!this[_0xb81d9f(0x1fe)][_0xb81d9f(0x20b)](_0x2d1dcd['id'])){const _0x54292b=this[_0xb81d9f(0x1f2)](_0x2d1dcd);this[_0xb81d9f(0x1fe)][_0xb81d9f(0x170)](_0x54292b['id'],_0x54292b),this[_0xb81d9f(0x135)](_0xb81d9f(0x146)+_0x54292b[_0xb81d9f(0x172)]);}}this[_0xb81d9f(0x13e)]();}catch(_0x3455d2){this[_0xb81d9f(0x135)](_0x483211[_0xb81d9f(0x1c4)],_0x483211[_0xb81d9f(0x19f)]);}}[a0_0x44c484(0x1f2)](_0x8bdcb1){const _0xbd16f2=a0_0x44c484,_0x234ba2={'nidXE':function(_0x33f2d4,_0x95eb0f){return _0x33f2d4(_0x95eb0f);}},_0x360fce=_0x234ba2[_0xbd16f2(0x1c9)](parseFloat,_0x8bdcb1[_0xbd16f2(0x1a3)][_0xbd16f2(0x1d3)](/[^0-9.]/g,'')||'0');return{...exports[_0xbd16f2(0x1f5)][_0xbd16f2(0x1c2)](_0x8bdcb1),'budgetAmount':_0x360fce};}[a0_0x44c484(0x131)](){const _0xa12412=a0_0x44c484,_0x2dc803={'ZMJxQ':_0xa12412(0x1aa),'Hjoto':_0xa12412(0x13b),'HAgnR':_0xa12412(0x17a),'Irely':_0xa12412(0x1e2),'Sbpfp':_0xa12412(0x238),'ftwGk':_0xa12412(0x16a),'slbVU':_0xa12412(0x1ab),'nYEYr':_0xa12412(0x1f7),'yJzfj':_0xa12412(0x1bb),'UelpQ':_0xa12412(0x234),'jxeXa':_0xa12412(0x201),'GDnCE':_0xa12412(0x1ef),'ZUcRI':_0xa12412(0x166),'frunz':_0xa12412(0x227),'prKoz':_0xa12412(0x20d),'lGdGM':_0xa12412(0x226),'ZsLhM':_0xa12412(0x1a7),'BtzIy':_0xa12412(0x16e),'sMood':_0xa12412(0x219),'GqHVH':_0xa12412(0x155),'rMFYk':_0xa12412(0x1fb),'InrXt':_0xa12412(0x17b)};if(this[_0xa12412(0x18b)]&&this[_0xa12412(0x18b)][_0xa12412(0x1e2)])return;const _0x1ff85d=this[_0xa12412(0x233)][_0xa12412(0x1d3)](_0x2dc803[_0xa12412(0x1e9)],'');this[_0xa12412(0x18b)]=(0x0,a0_0x57efd3['io'])(_0x1ff85d,{'auth':{'token':this[_0xa12412(0x1fd)]},'transports':[_0x2dc803[_0xa12412(0x22d)]],'reconnection':!![],'reconnectionAttempts':Infinity,'reconnectionDelay':0x3e8}),this[_0xa12412(0x18b)]['on'](_0x2dc803[_0xa12412(0x168)],()=>{const _0xde5a07=_0xa12412;this[_0xde5a07(0x135)](_0x2dc803[_0xde5a07(0x13a)]),this[_0xde5a07(0x18b)]?.[_0xde5a07(0x1f3)](_0x2dc803[_0xde5a07(0x140)]);for(const _0x45e84d of this[_0xde5a07(0x1fe)][_0xde5a07(0x1ec)]()){this[_0xde5a07(0x18b)]?.[_0xde5a07(0x1f3)](_0x2dc803[_0xde5a07(0x18f)],_0x45e84d);}this[_0xde5a07(0x1f3)](_0x2dc803[_0xde5a07(0x148)]);}),this[_0xa12412(0x18b)]['on'](_0x2dc803[_0xa12412(0x16f)],_0x36abdd=>{const _0x323dc2=_0xa12412;this[_0x323dc2(0x135)](_0x323dc2(0x191)+_0x36abdd+_0x323dc2(0x1ed),_0x2dc803[_0x323dc2(0x229)]),this[_0x323dc2(0x14c)]();}),this[_0xa12412(0x18b)]['on'](_0x2dc803[_0xa12412(0x14e)],_0x30b0e4=>{const _0xed7a7b=_0xa12412;this[_0xed7a7b(0x135)](_0xed7a7b(0x22e)+_0x30b0e4,_0x2dc803[_0xed7a7b(0x1ba)]),this[_0xed7a7b(0x1f3)](_0x2dc803[_0xed7a7b(0x1d2)],_0x30b0e4);}),this[_0xa12412(0x18b)]['on'](_0x2dc803[_0xa12412(0x1fc)],_0x539c2a=>{const _0x5b2cc1=_0xa12412;try{const _0x1fba9a=exports[_0x5b2cc1(0x134)][_0x5b2cc1(0x1c2)](_0x539c2a);!this[_0x5b2cc1(0x19a)][_0x5b2cc1(0x20b)](_0x1fba9a['id'])&&(this[_0x5b2cc1(0x19a)][_0x5b2cc1(0x163)](_0x1fba9a['id']),this[_0x5b2cc1(0x1f3)](_0x2dc803[_0x5b2cc1(0x1cc)],_0x1fba9a));}catch(_0x5e30bf){this[_0x5b2cc1(0x135)](_0x2dc803[_0x5b2cc1(0x20a)],_0x2dc803[_0x5b2cc1(0x181)]);}}),this[_0xa12412(0x18b)]['on'](_0x2dc803[_0xa12412(0x1f1)],_0x1d8f1e=>{const _0x384ea8=_0xa12412;try{const _0x516c36=this[_0x384ea8(0x1f2)](_0x1d8f1e);this[_0x384ea8(0x1f3)](_0x2dc803[_0x384ea8(0x19e)],_0x516c36);}catch(_0x65df51){}}),this[_0xa12412(0x18b)]['on'](_0xa12412(0x15a)+this[_0xa12412(0x1c0)],_0x2b1939=>{const _0x41483a=_0xa12412;try{const _0x33569b=this[_0x41483a(0x1f2)](_0x2b1939);if(!this[_0x41483a(0x1fe)][_0x41483a(0x20b)](_0x33569b['id'])){const _0x3bd3fe=_0x2dc803[_0x41483a(0x228)][_0x41483a(0x193)]('|');let _0x4ce416=0x0;while(!![]){switch(_0x3bd3fe[_0x4ce416++]){case'0':this[_0x41483a(0x18b)]?.[_0x41483a(0x1f3)](_0x2dc803[_0x41483a(0x18f)],_0x33569b['id']);continue;case'1':this[_0x41483a(0x1f3)](_0x2dc803[_0x41483a(0x1b1)],_0x33569b);continue;case'2':this[_0x41483a(0x135)](_0x41483a(0x15d)+_0x33569b[_0x41483a(0x172)],_0x2dc803[_0x41483a(0x231)]);continue;case'3':this[_0x41483a(0x13e)]();continue;case'4':this[_0x41483a(0x1fe)][_0x41483a(0x170)](_0x33569b['id'],_0x33569b);continue;}break;}}}catch(_0x3b3b5b){this[_0x41483a(0x135)](_0x2dc803[_0x41483a(0x1bc)],_0x2dc803[_0x41483a(0x181)]);}});}[a0_0x44c484(0x194)](){const _0x874c9c=a0_0x44c484,_0x305ee5={'BuMaF':_0x874c9c(0x210),'CvtQj':_0x874c9c(0x16a)};if(!this[_0x874c9c(0x1a8)]||!a0_0x3cca4b[_0x874c9c(0x1b8)](this[_0x874c9c(0x1a8)]))return;try{const _0x4622fc=JSON[_0x874c9c(0x1c2)](a0_0x3cca4b[_0x874c9c(0x1d6)](this[_0x874c9c(0x1a8)],_0x305ee5[_0x874c9c(0x16b)]));_0x4622fc[_0x874c9c(0x1fe)]&&Object[_0x874c9c(0x1db)](_0x4622fc[_0x874c9c(0x1fe)])[_0x874c9c(0x1ad)](([_0xa00bbd,_0x1b84eb])=>{const _0xad42cc=_0x874c9c;this[_0xad42cc(0x1fe)][_0xad42cc(0x170)](_0xa00bbd,_0x1b84eb);}),_0x4622fc[_0x874c9c(0x19c)]&&_0x4622fc[_0x874c9c(0x19c)][_0x874c9c(0x1ad)](_0x2b190b=>this[_0x874c9c(0x19c)][_0x874c9c(0x163)](_0x2b190b)),this[_0x874c9c(0x135)](_0x874c9c(0x15c)+this[_0x874c9c(0x1fe)][_0x874c9c(0x21e)]+_0x874c9c(0x1d9));}catch(_0x443708){this[_0x874c9c(0x135)](_0x874c9c(0x218)+_0x443708[_0x874c9c(0x1f7)],_0x305ee5[_0x874c9c(0x213)]);}}[a0_0x44c484(0x13e)](){const _0x5e6c03=a0_0x44c484,_0x27359d={'AkYHf':_0x5e6c03(0x16a)};if(!this[_0x5e6c03(0x1a8)])return;try{const _0x41d50e={'activeMissions':Object[_0x5e6c03(0x230)](this[_0x5e6c03(0x1fe)]),'bidCache':Array[_0x5e6c03(0x1c6)](this[_0x5e6c03(0x19c)])};a0_0x3cca4b[_0x5e6c03(0x1cb)](this[_0x5e6c03(0x1a8)],JSON[_0x5e6c03(0x205)](_0x41d50e,null,0x2));}catch(_0x20a798){this[_0x5e6c03(0x135)](_0x5e6c03(0x178)+_0x20a798[_0x5e6c03(0x1f7)],_0x27359d[_0x5e6c03(0x1a6)]);}}async[a0_0x44c484(0x1e7)](_0x558c6a,_0x3b03ac=!![]){const _0x44360d=a0_0x44c484,_0x1adefd={'epnCL':_0x44360d(0x1b0)};this[_0x44360d(0x18b)]&&this[_0x44360d(0x18b)][_0x44360d(0x1f3)](_0x1adefd[_0x44360d(0x147)],{'jobId':_0x558c6a,'isTyping':_0x3b03ac});}async[a0_0x44c484(0x176)](_0x270665){const _0x358ec1=a0_0x44c484;if(!this[_0x358ec1(0x1c0)])return;return this[_0x358ec1(0x1b5)][_0x358ec1(0x139)](_0x358ec1(0x1e5)+this[_0x358ec1(0x1c0)]+_0x358ec1(0x216),_0x270665);}async[a0_0x44c484(0x23a)](){const _0x3adf69=a0_0x44c484,_0xfcf54c={'pNJxs':_0x3adf69(0x13d)},_0x1a58b1=await this[_0x3adf69(0x1b5)][_0x3adf69(0x22b)](_0xfcf54c[_0x3adf69(0x130)]);return _0x1a58b1[_0x3adf69(0x161)][_0x3adf69(0x161)][_0x3adf69(0x1f6)](_0x50d3fc=>_0x50d3fc[_0x3adf69(0x1a2)]===_0x3adf69(0x156))[_0x3adf69(0x142)](_0x338636=>this[_0x3adf69(0x1f2)](_0x338636));}async[a0_0x44c484(0x1d5)](_0x5e6e15,_0x28bda6,_0x457c4f){const _0x1faa2d=a0_0x44c484,_0xe3afcf={'RIxev':_0x1faa2d(0x1bf)};try{const _0x20c8a1=await this[_0x1faa2d(0x1b5)][_0x1faa2d(0x139)](_0xe3afcf[_0x1faa2d(0x196)],{'jobId':_0x5e6e15,'amount':_0x28bda6,'message':_0x457c4f,'apiKey':this[_0x1faa2d(0x1fd)]});return _0x20c8a1[_0x1faa2d(0x161)][_0x1faa2d(0x1e1)]&&(this[_0x1faa2d(0x19c)][_0x1faa2d(0x163)](_0x5e6e15),this[_0x1faa2d(0x13e)]()),_0x20c8a1[_0x1faa2d(0x161)];}catch(_0x478d83){return{'success':![],'error':_0x478d83[_0x1faa2d(0x1b7)]?.[_0x1faa2d(0x161)]?.[_0x1faa2d(0x198)]||_0x478d83[_0x1faa2d(0x1f7)]};}}async[a0_0x44c484(0x150)](_0x3b4b1f,_0x7719ed){const _0x1800f9=a0_0x44c484,_0xfc26ab=await this[_0x1800f9(0x1b5)][_0x1800f9(0x139)](_0x1800f9(0x1cf)+_0x3b4b1f+_0x1800f9(0x186),{'content':_0x7719ed,'senderId':this[_0x1800f9(0x1c0)]});return _0xfc26ab[_0x1800f9(0x161)];}async[a0_0x44c484(0x1d7)](_0x126d16,_0x32ddb1,_0x795af8){const _0x229883=a0_0x44c484,_0x387f8c={'FwRen':_0x229883(0x18c)},_0x522398=await this[_0x229883(0x1b5)][_0x229883(0x139)](_0x229883(0x1cf)+_0x126d16+_0x229883(0x1b3),{'url':_0x32ddb1,'name':_0x795af8,'type':_0x387f8c[_0x229883(0x151)],'uploaderId':this[_0x229883(0x1c0)]});return _0x522398[_0x229883(0x161)][_0x229883(0x1e1)];}async[a0_0x44c484(0x1a1)](_0x138022){const _0x47d70a=a0_0x44c484,_0x22d4f5={'lRcFa':_0x47d70a(0x18a)},_0x44ecab=await this[_0x47d70a(0x1b5)][_0x47d70a(0x139)](_0x47d70a(0x1cf)+_0x138022+_0x47d70a(0x1f8),{'userId':this[_0x47d70a(0x1c0)],'role':_0x22d4f5[_0x47d70a(0x17e)]});return _0x44ecab[_0x47d70a(0x161)][_0x47d70a(0x1e1)]&&(this[_0x47d70a(0x1fe)][_0x47d70a(0x167)](_0x138022),this[_0x47d70a(0x13e)]()),_0x44ecab[_0x47d70a(0x161)];}async[a0_0x44c484(0x14a)](_0x58c718){const _0x585366=a0_0x44c484;if(!this[_0x585366(0x1c0)])return;return this[_0x585366(0x1b5)][_0x585366(0x139)](_0x585366(0x1e5)+this[_0x585366(0x1c0)]+_0x585366(0x216),{'tokensUsed':_0x58c718});}async[a0_0x44c484(0x1d8)](_0x544cf3,_0x38d06f=a0_0x44c484(0x238)){const _0xfca642=a0_0x44c484,_0x5b87c1={'PVdTA':function(_0x5938fd,_0x4dea5d){return _0x5938fd===_0x4dea5d;},'rKoHT':_0xfca642(0x234),'FLgEq':_0xfca642(0x173),'FyFLm':_0xfca642(0x16a),'aYNtU':_0xfca642(0x1e4),'zfNzG':_0xfca642(0x137)};if(!this[_0xfca642(0x1c0)])return;try{await this[_0xfca642(0x1b5)][_0xfca642(0x139)](_0xfca642(0x1e5)+this[_0xfca642(0x1c0)]+_0xfca642(0x1af),{'message':_0x544cf3,'level':_0x38d06f});if(this[_0xfca642(0x149)]){const _0x364b97=_0x5b87c1[_0xfca642(0x154)](_0x38d06f,_0x5b87c1[_0xfca642(0x19d)])?_0x5b87c1[_0xfca642(0x1c1)]:_0x5b87c1[_0xfca642(0x154)](_0x38d06f,_0x5b87c1[_0xfca642(0x15b)])?_0x5b87c1[_0xfca642(0x160)]:_0x5b87c1[_0xfca642(0x20e)];console[_0xfca642(0x1d8)](_0x364b97+'['+_0x38d06f+_0xfca642(0x1a5)+_0x544cf3);}}catch(_0x56e6f9){this[_0xfca642(0x149)]&&console[_0xfca642(0x198)](_0xfca642(0x221)+_0x56e6f9[_0xfca642(0x1f7)]);}}[a0_0x44c484(0x199)](_0x294bad=0x7530){const _0x45be23=a0_0x44c484,_0x2e6bc7={'CBamX':function(_0x5f25a6,_0x3a126f){return _0x5f25a6(_0x3a126f);},'XwOVD':function(_0x35cc1a,_0x3ec4af,_0x2ade95){return _0x35cc1a(_0x3ec4af,_0x2ade95);}};if(!this[_0x45be23(0x1c0)])return;if(this[_0x45be23(0x162)])_0x2e6bc7[_0x45be23(0x197)](clearInterval,this[_0x45be23(0x162)]);this[_0x45be23(0x159)](),this[_0x45be23(0x162)]=_0x2e6bc7[_0x45be23(0x145)](setInterval,()=>this[_0x45be23(0x159)](),_0x294bad);}async[a0_0x44c484(0x159)](){const _0x16ef4c=a0_0x44c484,_0xfa957a={'ehYoA':_0x16ef4c(0x237),'ixHej':_0x16ef4c(0x16a)};if(!this[_0x16ef4c(0x1c0)])return;try{await this[_0x16ef4c(0x1b5)][_0x16ef4c(0x139)](_0x16ef4c(0x1e5)+this[_0x16ef4c(0x1c0)]+_0x16ef4c(0x184),{},{'headers':{'Authorization':_0x16ef4c(0x21c)+this[_0x16ef4c(0x1fd)]}});}catch(_0x536083){this[_0x16ef4c(0x135)](_0xfa957a[_0x16ef4c(0x16c)],_0xfa957a[_0x16ef4c(0x1bd)]);}}[a0_0x44c484(0x135)](_0x4d6217,_0x50723a=a0_0x44c484(0x238)){const _0x7cd0ac=a0_0x44c484;if(this[_0x7cd0ac(0x149)])console[_0x7cd0ac(0x1d8)](_0x7cd0ac(0x1c3)+_0x4d6217);}[a0_0x44c484(0x14b)](_0x184b22){const _0x504aee=a0_0x44c484,_0x292703={'QpPkc':_0x504aee(0x1f7)};this['on'](_0x292703[_0x504aee(0x18d)],_0x184b22);}[a0_0x44c484(0x20f)](_0x2dab85){const _0x37bbc4=a0_0x44c484,_0x304e56={'qyZeX':_0x37bbc4(0x201)};this['on'](_0x304e56[_0x37bbc4(0x1d4)],_0x2dab85);}[a0_0x44c484(0x188)](_0x1f1a46){const _0xa45c13=a0_0x44c484,_0x2ebb7d={'MkIRd':_0xa45c13(0x166)};this['on'](_0x2ebb7d[_0xa45c13(0x1b9)],_0x1f1a46);}}exports[a0_0x44c484(0x22c)]=a0_0x36b33e,a0_0x36b33e[a0_0x44c484(0x1df)]=a0_0x44c484(0x1da),exports[a0_0x44c484(0x1c5)]=a0_0x36b33e;
|
package/init.js
CHANGED
|
@@ -21,7 +21,7 @@ if (!apiKey) {
|
|
|
21
21
|
process.exit(1);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
console.log('\n🤖 Initializing RentaBots Agent Environment (v0.
|
|
24
|
+
console.log('\n🤖 Initializing RentaBots Agent Environment (v0.5.1)...\n');
|
|
25
25
|
|
|
26
26
|
// 2. Create Project Directory
|
|
27
27
|
const projectDir = 'my-rentabot-agent';
|
|
@@ -42,7 +42,7 @@ const packageJson = {
|
|
|
42
42
|
"deploy": "pm2 start agent.js --name my-rentabot-agent"
|
|
43
43
|
},
|
|
44
44
|
dependencies: {
|
|
45
|
-
"rentabots-sdk": "^0.
|
|
45
|
+
"rentabots-sdk": "^0.5.0",
|
|
46
46
|
"dotenv": "^16.3.1"
|
|
47
47
|
}
|
|
48
48
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rentabots-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Official SDK for RentaBots AI Agent Marketplace",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"axios": "^1.6.0",
|
|
23
|
-
"rentabots-sdk": "^0.4.
|
|
23
|
+
"rentabots-sdk": "^0.4.1",
|
|
24
24
|
"socket.io-client": "^4.8.3",
|
|
25
25
|
"zod": "^4.3.6"
|
|
26
26
|
},
|
package/src/index.ts
CHANGED
|
@@ -1,348 +1,408 @@
|
|
|
1
|
-
import axios, { AxiosInstance } from 'axios';
|
|
2
|
-
import { io, Socket } from 'socket.io-client';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
'
|
|
12
|
-
'
|
|
13
|
-
'
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
export
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
this.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
this.
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
} catch (
|
|
289
|
-
this.logInternal(`Failed to
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
async
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
|
|
1
|
+
import axios, { AxiosInstance } from 'axios';
|
|
2
|
+
import { io, Socket } from 'socket.io-client';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { EventEmitter } from 'events';
|
|
5
|
+
import * as fs from 'fs';
|
|
6
|
+
import * as path from 'path';
|
|
7
|
+
|
|
8
|
+
// --- TYPE DEFINITIONS ---
|
|
9
|
+
|
|
10
|
+
export const CapabilitySchema = z.enum([
|
|
11
|
+
'code_generation',
|
|
12
|
+
'web_browsing',
|
|
13
|
+
'data_analysis',
|
|
14
|
+
'image_generation',
|
|
15
|
+
'automation',
|
|
16
|
+
'translation'
|
|
17
|
+
]);
|
|
18
|
+
|
|
19
|
+
export type Capability = z.infer<typeof CapabilitySchema>;
|
|
20
|
+
|
|
21
|
+
export const JobStatusSchema = z.enum(['open', 'in_progress', 'completed', 'archived', 'disputed']);
|
|
22
|
+
export type JobStatus = z.infer<typeof JobStatusSchema>;
|
|
23
|
+
|
|
24
|
+
export const JobSchema = z.object({
|
|
25
|
+
id: z.string(),
|
|
26
|
+
title: z.string(),
|
|
27
|
+
description: z.string(),
|
|
28
|
+
budget: z.string(),
|
|
29
|
+
category: z.string(),
|
|
30
|
+
status: JobStatusSchema,
|
|
31
|
+
createdAt: z.string(),
|
|
32
|
+
progress: z.number().optional(),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export type Job = z.infer<typeof JobSchema> & {
|
|
36
|
+
/** Helper to get budget as a clean number */
|
|
37
|
+
budgetAmount: number;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const MessageSchema = z.object({
|
|
41
|
+
id: z.string(),
|
|
42
|
+
jobId: z.string(),
|
|
43
|
+
content: z.string(),
|
|
44
|
+
senderId: z.string(),
|
|
45
|
+
createdAt: z.string(),
|
|
46
|
+
sender: z.object({
|
|
47
|
+
id: z.string(),
|
|
48
|
+
displayName: z.string(),
|
|
49
|
+
type: z.enum(['human', 'agent'])
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export type Message = z.infer<typeof MessageSchema>;
|
|
54
|
+
|
|
55
|
+
export interface AgentOptions {
|
|
56
|
+
baseUrl?: string;
|
|
57
|
+
apiKey?: string;
|
|
58
|
+
capabilities?: Capability[];
|
|
59
|
+
debug?: boolean;
|
|
60
|
+
heartbeatInterval?: number;
|
|
61
|
+
/** Path to store agent state for persistence. Set to false to disable. */
|
|
62
|
+
persistState?: string | boolean;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
interface AgentState {
|
|
66
|
+
activeMissions: Record<string, Job>;
|
|
67
|
+
bidCache: string[];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// --- CORE SDK ---
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* RentaBots Agent SDK
|
|
74
|
+
* High-level, event-driven interface for autonomous agents.
|
|
75
|
+
*/
|
|
76
|
+
export class Agent extends EventEmitter {
|
|
77
|
+
public static readonly SDK_VERSION = '0.5.0';
|
|
78
|
+
|
|
79
|
+
private apiKey: string;
|
|
80
|
+
public readonly baseUrl: string;
|
|
81
|
+
private agentId: string | null = null;
|
|
82
|
+
private api: AxiosInstance;
|
|
83
|
+
private socket: Socket | null = null;
|
|
84
|
+
private debug: boolean;
|
|
85
|
+
private capabilities: Capability[];
|
|
86
|
+
private heartbeatInterval: number;
|
|
87
|
+
private heartbeatTimer: NodeJS.Timeout | null = null;
|
|
88
|
+
|
|
89
|
+
private statePath: string | null = null;
|
|
90
|
+
private activeMissions = new Map<string, Job>();
|
|
91
|
+
private bidCache = new Set<string>();
|
|
92
|
+
private seenMessages = new Set<string>();
|
|
93
|
+
|
|
94
|
+
constructor(options: AgentOptions = {}) {
|
|
95
|
+
super();
|
|
96
|
+
// 1. Standardize Env: Look for RENTABOTS_API_KEY first
|
|
97
|
+
this.apiKey = options.apiKey || process.env.RENTABOTS_API_KEY || process.env.AGENT_API_KEY || '';
|
|
98
|
+
this.baseUrl = (options.baseUrl || 'https://rentabots.com/api').replace(/\/$/, '');
|
|
99
|
+
this.debug = options.debug || false;
|
|
100
|
+
this.capabilities = options.capabilities || [];
|
|
101
|
+
this.heartbeatInterval = options.heartbeatInterval || 30000;
|
|
102
|
+
|
|
103
|
+
if (options.persistState !== false) {
|
|
104
|
+
this.statePath = typeof options.persistState === 'string'
|
|
105
|
+
? options.persistState
|
|
106
|
+
: path.join(process.cwd(), 'agent_state.json');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (!this.apiKey) {
|
|
110
|
+
throw new Error("❌ RentaBots API Key is missing. Pass it in the constructor or set RENTABOTS_API_KEY in .env");
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
this.api = axios.create({
|
|
114
|
+
baseURL: this.baseUrl,
|
|
115
|
+
headers: {
|
|
116
|
+
'x-api-key': this.apiKey,
|
|
117
|
+
'x-sdk-version': Agent.SDK_VERSION
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Connect to the RentaBots grid and initialize WebSockets
|
|
124
|
+
*/
|
|
125
|
+
async connect(): Promise<{ success: boolean; agent?: any; error?: string }> {
|
|
126
|
+
this.logInternal(`Connecting to RentaBots Grid (v${Agent.SDK_VERSION})...`);
|
|
127
|
+
|
|
128
|
+
try {
|
|
129
|
+
// Load local state first
|
|
130
|
+
this.loadState();
|
|
131
|
+
|
|
132
|
+
const res = await this.api.get('agents/me');
|
|
133
|
+
this.agentId = res.data.agent.id;
|
|
134
|
+
|
|
135
|
+
// Sync with Cloud (Recover any missed assignments)
|
|
136
|
+
await this.syncFromCloud();
|
|
137
|
+
|
|
138
|
+
// Initialize Socket Connection
|
|
139
|
+
this.initSocket();
|
|
140
|
+
|
|
141
|
+
// Start Heartbeat to keep dashboard ONLINE
|
|
142
|
+
this.startHeartbeat(this.heartbeatInterval);
|
|
143
|
+
|
|
144
|
+
this.logInternal(`Online as: ${res.data.agent.displayName}`);
|
|
145
|
+
|
|
146
|
+
// Register capabilities if any
|
|
147
|
+
if (this.capabilities.length > 0) {
|
|
148
|
+
try {
|
|
149
|
+
await this.updateProfile({ skills: this.capabilities });
|
|
150
|
+
} catch (err) {
|
|
151
|
+
this.logInternal('Failed to sync capabilities to grid, continuing...', 'WARN');
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return { success: true, agent: res.data.agent };
|
|
156
|
+
} catch (e: any) {
|
|
157
|
+
const error = e.response?.data?.error || e.message;
|
|
158
|
+
return { success: false, error };
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
private async syncFromCloud() {
|
|
163
|
+
try {
|
|
164
|
+
const res = await this.api.get('jobs?status=in_progress');
|
|
165
|
+
const myJobs = res.data.data.filter((j: any) => j.agentId === this.agentId);
|
|
166
|
+
|
|
167
|
+
for (const rawJob of myJobs) {
|
|
168
|
+
if (!this.activeMissions.has(rawJob.id)) {
|
|
169
|
+
const job = this.enrichJob(rawJob);
|
|
170
|
+
this.activeMissions.set(job.id, job);
|
|
171
|
+
this.logInternal(`Recovered active mission from cloud: ${job.title}`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
this.saveState();
|
|
175
|
+
} catch (err) {
|
|
176
|
+
this.logInternal('Cloud sync failed, relying on local state.', 'WARN');
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
private enrichJob(raw: any): Job {
|
|
181
|
+
const budgetAmount = parseFloat(raw.budget.replace(/[^0-9.]/g, '') || '0');
|
|
182
|
+
return {
|
|
183
|
+
...JobSchema.parse(raw),
|
|
184
|
+
budgetAmount
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
private initSocket() {
|
|
189
|
+
if (this.socket && this.socket.connected) return;
|
|
190
|
+
|
|
191
|
+
const socketUrl = this.baseUrl.replace('/api', '');
|
|
192
|
+
this.socket = io(socketUrl, {
|
|
193
|
+
auth: { token: this.apiKey },
|
|
194
|
+
transports: ['websocket'],
|
|
195
|
+
reconnection: true,
|
|
196
|
+
reconnectionAttempts: Infinity,
|
|
197
|
+
reconnectionDelay: 1000
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
this.socket.on('connect', () => {
|
|
201
|
+
this.logInternal('WebSocket Link Established.');
|
|
202
|
+
this.socket?.emit('join_marketplace');
|
|
203
|
+
|
|
204
|
+
// Re-join all active mission rooms on connect/reconnect
|
|
205
|
+
for (const jobId of this.activeMissions.keys()) {
|
|
206
|
+
this.socket?.emit('join_mission', jobId);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
this.emit('connected');
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
this.socket.on('reconnect', (attempt) => {
|
|
213
|
+
this.logInternal(`WebSocket Reconnected after ${attempt} attempts.`, 'INFO');
|
|
214
|
+
this.syncFromCloud(); // Re-sync state just in case
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
this.socket.on('disconnect', (reason) => {
|
|
218
|
+
this.logInternal(`WebSocket Disconnected: ${reason}`, 'WARN');
|
|
219
|
+
this.emit('disconnected', reason);
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
this.socket.on('new_message', (data) => {
|
|
223
|
+
try {
|
|
224
|
+
const msg = MessageSchema.parse(data);
|
|
225
|
+
if (!this.seenMessages.has(msg.id)) {
|
|
226
|
+
this.seenMessages.add(msg.id);
|
|
227
|
+
this.emit('message', msg);
|
|
228
|
+
}
|
|
229
|
+
} catch (err) {
|
|
230
|
+
this.logInternal('Failed to parse incoming socket message', 'ERROR');
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
this.socket.on('new_job', (data) => {
|
|
235
|
+
try {
|
|
236
|
+
const job = this.enrichJob(data);
|
|
237
|
+
this.emit('job', job);
|
|
238
|
+
} catch (err) {}
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
this.socket.on(`mission_assigned_${this.agentId}`, (data) => {
|
|
242
|
+
try {
|
|
243
|
+
const job = this.enrichJob(data);
|
|
244
|
+
if (!this.activeMissions.has(job.id)) {
|
|
245
|
+
this.activeMissions.set(job.id, job);
|
|
246
|
+
this.saveState();
|
|
247
|
+
|
|
248
|
+
// Join mission room for chat
|
|
249
|
+
this.socket?.emit('join_mission', job.id);
|
|
250
|
+
|
|
251
|
+
this.logInternal(`🎉 Mission Assigned: ${job.title}`, 'SUCCESS' as any);
|
|
252
|
+
this.emit('assignment', job);
|
|
253
|
+
}
|
|
254
|
+
} catch (err) {
|
|
255
|
+
this.logInternal('Failed to process mission assignment', 'ERROR');
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// --- PERSISTENCE ---
|
|
261
|
+
|
|
262
|
+
private loadState() {
|
|
263
|
+
if (!this.statePath || !fs.existsSync(this.statePath)) return;
|
|
264
|
+
try {
|
|
265
|
+
const data = JSON.parse(fs.readFileSync(this.statePath, 'utf8')) as AgentState;
|
|
266
|
+
if (data.activeMissions) {
|
|
267
|
+
Object.entries(data.activeMissions).forEach(([id, job]) => {
|
|
268
|
+
this.activeMissions.set(id, job);
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
if (data.bidCache) {
|
|
272
|
+
data.bidCache.forEach(id => this.bidCache.add(id));
|
|
273
|
+
}
|
|
274
|
+
this.logInternal(`Loaded ${this.activeMissions.size} active missions from state.`);
|
|
275
|
+
} catch (err: any) {
|
|
276
|
+
this.logInternal(`Failed to load state: ${err.message}`, 'WARN');
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
private saveState() {
|
|
281
|
+
if (!this.statePath) return;
|
|
282
|
+
try {
|
|
283
|
+
const state: AgentState = {
|
|
284
|
+
activeMissions: Object.fromEntries(this.activeMissions),
|
|
285
|
+
bidCache: Array.from(this.bidCache)
|
|
286
|
+
};
|
|
287
|
+
fs.writeFileSync(this.statePath, JSON.stringify(state, null, 2));
|
|
288
|
+
} catch (err: any) {
|
|
289
|
+
this.logInternal(`Failed to save state: ${err.message}`, 'WARN');
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// --- AGENT ACTIONS ---
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Broadcast a typing indicator to the user
|
|
297
|
+
*/
|
|
298
|
+
async setTyping(jobId: string, isTyping: boolean = true) {
|
|
299
|
+
if (this.socket) {
|
|
300
|
+
this.socket.emit('typing_state', { jobId, isTyping });
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Update the agent's profile on the grid
|
|
306
|
+
*/
|
|
307
|
+
async updateProfile(data: { displayName?: string; skills?: string[]; bio?: string }) {
|
|
308
|
+
if (!this.agentId) return;
|
|
309
|
+
return this.api.post(`agents/${this.agentId}/manage`, data);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
async getOpenMissions(): Promise<Job[]> {
|
|
313
|
+
const res = await this.api.get('jobs');
|
|
314
|
+
return res.data.data
|
|
315
|
+
.filter((j: any) => j.status === 'open')
|
|
316
|
+
.map((j: any) => this.enrichJob(j));
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
async bid(jobId: string, amount: number, message: string) {
|
|
320
|
+
try {
|
|
321
|
+
const res = await this.api.post('bids', { jobId, amount, message, apiKey: this.apiKey });
|
|
322
|
+
if (res.data.success) {
|
|
323
|
+
this.bidCache.add(jobId);
|
|
324
|
+
this.saveState();
|
|
325
|
+
}
|
|
326
|
+
return res.data;
|
|
327
|
+
} catch (e: any) {
|
|
328
|
+
return {
|
|
329
|
+
success: false,
|
|
330
|
+
error: e.response?.data?.error || e.message
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
async sendMessage(jobId: string, content: string) {
|
|
336
|
+
const res = await this.api.post(`jobs/${jobId}/messages`, { content, senderId: this.agentId });
|
|
337
|
+
return res.data;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
async uploadDeliverable(jobId: string, url: string, name: string) {
|
|
341
|
+
const res = await this.api.post(`jobs/${jobId}/files`, { url, name, type: 'deliverable', uploaderId: this.agentId });
|
|
342
|
+
return res.data.success;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
async markComplete(jobId: string) {
|
|
346
|
+
const res = await this.api.post(`jobs/${jobId}/complete`, { userId: this.agentId, role: 'agent' });
|
|
347
|
+
if (res.data.success) {
|
|
348
|
+
this.activeMissions.delete(jobId);
|
|
349
|
+
this.saveState();
|
|
350
|
+
}
|
|
351
|
+
return res.data;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Report token consumption for billing and monitoring
|
|
356
|
+
*/
|
|
357
|
+
async reportUsage(tokens: number) {
|
|
358
|
+
if (!this.agentId) return;
|
|
359
|
+
return this.api.post(`agents/${this.agentId}/manage`, { tokensUsed: tokens });
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Stream logs to the RentaBots Dashboard
|
|
364
|
+
*/
|
|
365
|
+
async log(message: string, level: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR' = 'INFO') {
|
|
366
|
+
if (!this.agentId) return;
|
|
367
|
+
try {
|
|
368
|
+
await this.api.post(`agents/${this.agentId}/logs`, { message, level });
|
|
369
|
+
if (this.debug) {
|
|
370
|
+
const color = level === 'ERROR' ? '\x1b[31m' : level === 'WARN' ? '\x1b[33m' : '\x1b[32m';
|
|
371
|
+
console.log(`${color}[${level}]\x1b[0m ${message}`);
|
|
372
|
+
}
|
|
373
|
+
} catch(e: any) {
|
|
374
|
+
if (this.debug) {
|
|
375
|
+
console.error(`[\x1b[31mSDK ERROR\x1b[0m] Failed to stream log to dashboard: ${e.message}`);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
private startHeartbeat(intervalMs: number = 30000) {
|
|
381
|
+
if (!this.agentId) return;
|
|
382
|
+
if (this.heartbeatTimer) clearInterval(this.heartbeatTimer);
|
|
383
|
+
this.sendHeartbeat();
|
|
384
|
+
this.heartbeatTimer = setInterval(() => this.sendHeartbeat(), intervalMs);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
private async sendHeartbeat() {
|
|
388
|
+
if (!this.agentId) return;
|
|
389
|
+
try {
|
|
390
|
+
await this.api.post(`agents/${this.agentId}/heartbeat`, {}, {
|
|
391
|
+
headers: { 'Authorization': `Bearer ${this.apiKey}` }
|
|
392
|
+
});
|
|
393
|
+
} catch (err) {
|
|
394
|
+
this.logInternal('Heartbeat failed', 'WARN');
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
private logInternal(msg: string, level: any = 'INFO') {
|
|
399
|
+
if (this.debug) console.log(`[\x1b[35mSDK\x1b[0m] ${msg}`);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// --- EVENT ALIASES (LEGACY) ---
|
|
403
|
+
onMessage(cb: (msg: Message) => void) { this.on('message', cb); }
|
|
404
|
+
onNewJob(cb: (job: Job) => void) { this.on('job', cb); }
|
|
405
|
+
onHired(cb: (job: Job) => void) { this.on('assignment', cb); }
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
export default Agent;
|