import { definePlugin, defineView } from '@jaspers-ai/sdk' import { z } from 'zod' import { news } from './news' import { earnings, guidance, ratings } from './calendars-analyst' import { dividends, economics, ipos, splits } from './calendars-corporate' import { NewsView } from './NewsView' export default definePlugin({ id: 'benzinga', secrets: { apikey: { label: 'Benzinga API token' } }, sources: { news, ratings, earnings, dividends, splits, ipos, economics, guidance }, views: { news: defineView(NewsView, { title: 'Benzinga news', state: z.object({ tickers: z.array(z.string()).max(50).default([]).describe('Tickers to show news for; empty for all news.'), channels: z.array(z.string()).max(20).default([]).describe('Benzinga channels to filter on, like Earnings.'), pageSize: z.number().int().min(1).max(100).default(30).describe('How many headlines.'), }), output: z.object({ tickers: z.array(z.string()), count: z.number(), headlines: z.array(z.object({ created: z.string(), title: z.string() })), }), instructions: 'A scrolling list of recent Benzinga headlines, newest first. Set state.tickers (like ["AAPL"]), optionally state.channels and state.pageSize.', renders: [news], summarize: (state, output) => `Benzinga news ${state.tickers?.length ? state.tickers.join(',') : 'all'}: ${output.count} headlines`, }), }, })