@ducci/jarvis 1.0.20 → 1.0.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ducci/jarvis",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "description": "A fully automated agent system that lives on a server.",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -300,6 +300,44 @@ async function run() {
300
300
  }
301
301
  }
302
302
 
303
+ // --- PERPLEXITY STEP (OPTIONAL) ---
304
+ const existingPerplexityKey = loadEnvVar('PERPLEXITY_API_KEY');
305
+ const { configurePerplexity } = await inquirer.prompt([
306
+ {
307
+ type: 'confirm',
308
+ name: 'configurePerplexity',
309
+ message: 'Do you want to configure Perplexity web search?',
310
+ default: !!existingPerplexityKey
311
+ }
312
+ ]);
313
+
314
+ if (configurePerplexity) {
315
+ let keepPerplexityKey = false;
316
+ if (existingPerplexityKey) {
317
+ const { keep } = await inquirer.prompt([
318
+ {
319
+ type: 'confirm',
320
+ name: 'keep',
321
+ message: 'A PERPLEXITY_API_KEY is already configured. Do you want to keep it?',
322
+ default: true
323
+ }
324
+ ]);
325
+ keepPerplexityKey = keep;
326
+ }
327
+ if (!keepPerplexityKey) {
328
+ const { perplexityKey } = await inquirer.prompt([
329
+ {
330
+ type: 'password',
331
+ name: 'perplexityKey',
332
+ message: 'Enter your Perplexity API key (from perplexity.ai/settings/api):',
333
+ validate: (input) => input.trim().length > 0 || 'API key cannot be empty.'
334
+ }
335
+ ]);
336
+ saveEnvVar('PERPLEXITY_API_KEY', perplexityKey.trim());
337
+ console.log(chalk.green('Perplexity API key saved.'));
338
+ }
339
+ }
340
+
303
341
  console.log(chalk.green.bold('\nSetup complete!'));
304
342
  }
305
343
 
@@ -221,6 +221,51 @@ const SEED_TOOLS = {
221
221
  }
222
222
  `,
223
223
  },
224
+ perplexity_search: {
225
+ definition: {
226
+ type: 'function',
227
+ function: {
228
+ name: 'perplexity_search',
229
+ description: 'Search the web using Perplexity AI. Returns an answer grounded in real-time web results with citations. Use this for current events, factual lookups, or research questions.',
230
+ parameters: {
231
+ type: 'object',
232
+ properties: {
233
+ query: {
234
+ type: 'string',
235
+ description: 'The search query or question.',
236
+ },
237
+ model: {
238
+ type: 'string',
239
+ enum: ['sonar', 'sonar-pro', 'sonar-deep-research'],
240
+ description: 'Search model to use. sonar: fast and cheap, good for simple lookups. sonar-pro: deeper multi-step search, more citations, better for complex questions. sonar-deep-research: long-form research reports. Defaults to sonar.',
241
+ },
242
+ search_recency_filter: {
243
+ type: 'string',
244
+ enum: ['hour', 'day', 'week', 'month', 'year'],
245
+ description: 'Optional time filter to restrict results to recent content.',
246
+ },
247
+ },
248
+ required: ['query'],
249
+ },
250
+ },
251
+ },
252
+ code: `
253
+ const OpenAI = require('openai');
254
+ const client = new OpenAI({
255
+ apiKey: process.env.PERPLEXITY_API_KEY,
256
+ baseURL: 'https://api.perplexity.ai',
257
+ });
258
+ const params = {
259
+ model: args.model || 'sonar',
260
+ messages: [{ role: 'user', content: args.query }],
261
+ };
262
+ if (args.search_recency_filter) params.search_recency_filter = args.search_recency_filter;
263
+ const response = await client.chat.completions.create(params);
264
+ const answer = response.choices[0].message.content;
265
+ const citations = response.citations || [];
266
+ return { answer, citations };
267
+ `,
268
+ },
224
269
  get_recent_sessions: {
225
270
  definition: {
226
271
  type: 'function',