rentabots-sdk 1.7.6 → 1.7.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/dist/index.js CHANGED
@@ -71,7 +71,7 @@ exports.MessageSchema = zod_1.z.object({
71
71
  })
72
72
  });
73
73
  // --- CORE SDK ENGINE ---
74
- let SDK_VERSION = '1.7.6'; // BUMP to v1.5.7
74
+ let SDK_VERSION = '1.7.8'; // fallback when package.json is unavailable
75
75
  try {
76
76
  const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8'));
77
77
  SDK_VERSION = pkg.version;
package/dist/llm.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export interface LLMConfig {
2
- provider: 'groq' | 'openai' | 'anthropic' | 'google' | 'nvidia';
2
+ provider: 'groq' | 'openai' | 'anthropic' | 'google' | 'nvidia' | 'custom';
3
3
  apiKey: string;
4
4
  baseUrl?: string;
5
5
  model?: string;
@@ -9,6 +9,18 @@ export interface LLMResponse {
9
9
  text?: string;
10
10
  error?: string;
11
11
  }
12
+ export declare const CODEX_MODELS: {
13
+ readonly codex: "codex-2025-01-21";
14
+ readonly codexMini: "codex-mini";
15
+ readonly codexLatest: "codex-latest";
16
+ };
17
+ export declare const GPT_MODELS: {
18
+ readonly gpt4o: "gpt-4o";
19
+ readonly gpt4oMini: "gpt-4o-mini";
20
+ readonly gpt4Turbo: "gpt-4-turbo";
21
+ readonly o1: "o1";
22
+ readonly o3Mini: "o3-mini";
23
+ };
12
24
  export declare class LLMClient {
13
25
  private config;
14
26
  constructor(config?: Partial<LLMConfig>);
package/dist/llm.js CHANGED
@@ -3,14 +3,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.LLMClient = void 0;
6
+ exports.LLMClient = exports.GPT_MODELS = exports.CODEX_MODELS = void 0;
7
7
  const axios_1 = __importDefault(require("axios"));
8
8
  const CONFIGS = {
9
9
  groq: { baseUrl: 'https://api.groq.com/openai/v1', defaultModel: 'llama-3.3-70b-versatile' },
10
- openai: { baseUrl: 'https://api.openai.com/v1', defaultModel: 'gpt-4o-mini' },
10
+ openai: { baseUrl: 'https://api.openai.com/v1', defaultModel: 'gpt-4o' },
11
11
  anthropic: { baseUrl: 'https://api.anthropic.com', defaultModel: 'claude-3-sonnet-20240229' },
12
12
  google: { baseUrl: 'https://generativelanguage.googleapis.com/v1beta', defaultModel: 'gemini-1.5-flash' },
13
13
  nvidia: { baseUrl: 'https://integrate.api.nvidia.com/v1', defaultModel: 'meta/llama-3.1-405b-instruct' },
14
+ custom: { baseUrl: '', defaultModel: '' }
15
+ };
16
+ // Codex models available via OpenAI API
17
+ exports.CODEX_MODELS = {
18
+ codex: 'codex-2025-01-21', // Latest Codex
19
+ codexMini: 'codex-mini', // Mini version
20
+ codexLatest: 'codex-latest', // Alias to latest
21
+ };
22
+ // OpenAI GPT models
23
+ exports.GPT_MODELS = {
24
+ gpt4o: 'gpt-4o',
25
+ gpt4oMini: 'gpt-4o-mini',
26
+ gpt4Turbo: 'gpt-4-turbo',
27
+ o1: 'o1',
28
+ o3Mini: 'o3-mini',
14
29
  };
15
30
  class LLMClient {
16
31
  constructor(config) {
@@ -19,7 +34,12 @@ class LLMClient {
19
34
  if (!apiKey)
20
35
  throw new Error(`No API key for ${provider}`);
21
36
  const preset = CONFIGS[provider];
22
- this.config = { provider, apiKey, baseUrl: preset.baseUrl, model: preset.defaultModel };
37
+ this.config = {
38
+ provider,
39
+ apiKey,
40
+ baseUrl: config?.baseUrl || preset.baseUrl,
41
+ model: config?.model || preset.defaultModel
42
+ };
23
43
  }
24
44
  detectProvider() {
25
45
  if (process.env.ANTHROPIC_API_KEY)
@@ -34,8 +54,12 @@ class LLMClient {
34
54
  }
35
55
  getApiKey(provider) {
36
56
  const map = {
37
- groq: 'GROQ_API_KEY', openai: 'OPENAI_API_KEY', anthropic: 'ANTHROPIC_API_KEY',
38
- google: 'GOOGLE_API_KEY', nvidia: 'NVIDIA_API_KEY',
57
+ groq: 'GROQ_API_KEY',
58
+ openai: 'OPENAI_API_KEY',
59
+ anthropic: 'ANTHROPIC_API_KEY',
60
+ google: 'GOOGLE_API_KEY',
61
+ nvidia: 'NVIDIA_API_KEY',
62
+ custom: 'LLM_API_KEY'
39
63
  };
40
64
  return process.env[map[provider]];
41
65
  }
@@ -47,17 +71,22 @@ class LLMClient {
47
71
  try {
48
72
  if (this.config.provider === 'anthropic') {
49
73
  const res = await axios_1.default.post(`${this.config.baseUrl}/v1/messages`, {
50
- model, messages: [{ role: 'user', content: prompt }],
51
- system: options.system, temperature: options.temperature ?? 0.7, max_tokens: options.maxTokens ?? 2048,
74
+ model,
75
+ messages: [{ role: 'user', content: prompt }],
76
+ system: options.system,
77
+ temperature: options.temperature ?? 0.7,
78
+ max_tokens: options.maxTokens ?? 2048,
52
79
  }, { headers });
53
80
  return { success: true, text: res.data.content[0]?.text };
54
81
  }
55
82
  const res = await axios_1.default.post(`${this.config.baseUrl}/chat/completions`, {
56
- model, messages: [
83
+ model,
84
+ messages: [
57
85
  ...(options.system ? [{ role: 'system', content: options.system }] : []),
58
86
  { role: 'user', content: prompt }
59
87
  ],
60
- temperature: options.temperature ?? 0.7, max_tokens: options.maxTokens ?? 2048,
88
+ temperature: options.temperature ?? 0.7,
89
+ max_tokens: options.maxTokens ?? 2048,
61
90
  }, { headers });
62
91
  return { success: true, text: res.data.choices[0]?.message?.content };
63
92
  }
@@ -11,6 +11,17 @@
11
11
  */
12
12
  import { Agent, Job, Message } from './index';
13
13
  export type QueenPhase = 'REQUIREMENTS_GATHERING' | 'REQUIREMENTS_CONFIRMED' | 'WORK_IN_PROGRESS' | 'QA_REVIEW' | 'COMPLETED';
14
+ export interface VerificationGateState {
15
+ builderCompleted: boolean;
16
+ qaCompleted: boolean;
17
+ deliverablesVerified: boolean;
18
+ testsVerified: boolean;
19
+ testsStatus: 'passed' | 'failed' | 'no-tests-policy' | 'not-run';
20
+ repoDeliverableCount: number;
21
+ checklistSummary?: string;
22
+ verifiedAt?: string;
23
+ lastError?: string;
24
+ }
14
25
  export interface QueenState {
15
26
  phase: QueenPhase;
16
27
  requirements: string[];
@@ -18,6 +29,7 @@ export interface QueenState {
18
29
  brainLog: string[];
19
30
  questionCount: number;
20
31
  lastHumanMessage: string;
32
+ verificationGate?: VerificationGateState;
21
33
  }
22
34
  export declare class QueenBrain {
23
35
  private agent;
@@ -59,6 +71,15 @@ export declare class QueenBrain {
59
71
  * Get the internal brain log for debugging
60
72
  */
61
73
  getBrainLog(jobId: string): string[];
74
+ private createDefaultGateState;
75
+ private ensureGate;
76
+ markWorkerCompleted(jobId: string, phase: 'BUILDER' | 'QA'): void;
77
+ updateVerificationGate(jobId: string, update: Partial<VerificationGateState>): void;
78
+ canHandover(jobId: string): {
79
+ allowed: boolean;
80
+ reasons: string[];
81
+ gate: VerificationGateState;
82
+ };
62
83
  private saveStates;
63
84
  private loadStates;
64
85
  }
@@ -100,6 +100,7 @@ class QueenBrain {
100
100
  brainLog: [`[${new Date().toISOString()}] Mission assigned: ${job.title}`],
101
101
  questionCount: 0,
102
102
  lastHumanMessage: '',
103
+ verificationGate: this.createDefaultGateState(),
103
104
  };
104
105
  this.states.set(job.id, state);
105
106
  this.saveStates();
@@ -131,6 +132,7 @@ class QueenBrain {
131
132
  brainLog: [],
132
133
  questionCount: 0,
133
134
  lastHumanMessage: '',
135
+ verificationGate: this.createDefaultGateState(),
134
136
  };
135
137
  this.states.set(msg.jobId, state);
136
138
  }
@@ -254,6 +256,61 @@ class QueenBrain {
254
256
  getBrainLog(jobId) {
255
257
  return this.states.get(jobId)?.brainLog || [];
256
258
  }
259
+ createDefaultGateState() {
260
+ return {
261
+ builderCompleted: false,
262
+ qaCompleted: false,
263
+ deliverablesVerified: false,
264
+ testsVerified: false,
265
+ testsStatus: 'not-run',
266
+ repoDeliverableCount: 0,
267
+ };
268
+ }
269
+ ensureGate(jobId) {
270
+ const state = this.states.get(jobId);
271
+ if (!state)
272
+ return this.createDefaultGateState();
273
+ if (!state.verificationGate) {
274
+ state.verificationGate = this.createDefaultGateState();
275
+ }
276
+ return state.verificationGate;
277
+ }
278
+ markWorkerCompleted(jobId, phase) {
279
+ const state = this.states.get(jobId);
280
+ if (!state)
281
+ return;
282
+ const gate = this.ensureGate(jobId);
283
+ if (phase === 'BUILDER')
284
+ gate.builderCompleted = true;
285
+ if (phase === 'QA')
286
+ gate.qaCompleted = true;
287
+ state.brainLog.push(`[${new Date().toISOString()}] QUEEN THOUGHT: Worker phase completed -> ${phase}`);
288
+ this.saveStates();
289
+ }
290
+ updateVerificationGate(jobId, update) {
291
+ const state = this.states.get(jobId);
292
+ if (!state)
293
+ return;
294
+ const gate = this.ensureGate(jobId);
295
+ state.verificationGate = { ...gate, ...update };
296
+ if (update.checklistSummary) {
297
+ state.brainLog.push(`[${new Date().toISOString()}] QUEEN CHECKLIST: ${update.checklistSummary}`);
298
+ }
299
+ this.saveStates();
300
+ }
301
+ canHandover(jobId) {
302
+ const gate = this.ensureGate(jobId);
303
+ const reasons = [];
304
+ if (!gate.builderCompleted)
305
+ reasons.push('Builder phase not completed');
306
+ if (!gate.qaCompleted)
307
+ reasons.push('QA phase not completed');
308
+ if (!gate.deliverablesVerified || gate.repoDeliverableCount <= 0)
309
+ reasons.push('Repo-backed deliverables not verified');
310
+ if (!gate.testsVerified)
311
+ reasons.push(`Test/check gate not passed (status: ${gate.testsStatus})`);
312
+ return { allowed: reasons.length === 0, reasons, gate };
313
+ }
257
314
  // --- PERSISTENCE ---
258
315
  saveStates() {
259
316
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rentabots-sdk",
3
- "version": "1.7.6",
3
+ "version": "1.7.8",
4
4
  "description": "Official SDK for RentaBots AI Agent Marketplace",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",