@radaros/core 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +174 -1
- package/dist/index.js +822 -37
- package/package.json +6 -2
- package/src/index.ts +14 -1
- package/src/models/providers/vertex.ts +400 -0
- package/src/models/registry.ts +17 -0
- package/src/toolkits/base.ts +15 -0
- package/src/toolkits/gmail.ts +226 -0
- package/src/toolkits/hackernews.ts +121 -0
- package/src/toolkits/websearch.ts +158 -0
- package/src/toolkits/whatsapp.ts +209 -0
package/dist/index.d.ts
CHANGED
|
@@ -491,6 +491,11 @@ declare function google(modelId: string, config?: {
|
|
|
491
491
|
declare function ollama(modelId: string, config?: {
|
|
492
492
|
host?: string;
|
|
493
493
|
}): ModelProvider;
|
|
494
|
+
declare function vertex(modelId: string, config?: {
|
|
495
|
+
project?: string;
|
|
496
|
+
location?: string;
|
|
497
|
+
credentials?: string;
|
|
498
|
+
}): ModelProvider;
|
|
494
499
|
|
|
495
500
|
interface OpenAIConfig {
|
|
496
501
|
apiKey?: string;
|
|
@@ -584,6 +589,42 @@ declare class OllamaProvider implements ModelProvider {
|
|
|
584
589
|
private normalizeResponse;
|
|
585
590
|
}
|
|
586
591
|
|
|
592
|
+
interface VertexAIConfig {
|
|
593
|
+
project?: string;
|
|
594
|
+
location?: string;
|
|
595
|
+
/** Service account key JSON string or path (optional — uses ADC by default). */
|
|
596
|
+
credentials?: string;
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Vertex AI provider using Google's @google/genai SDK in Vertex mode.
|
|
600
|
+
*
|
|
601
|
+
* Authentication (in order of precedence):
|
|
602
|
+
* 1. Explicit `project` + `location` in config
|
|
603
|
+
* 2. GOOGLE_CLOUD_PROJECT / GOOGLE_CLOUD_LOCATION env vars
|
|
604
|
+
* 3. Application Default Credentials (gcloud auth)
|
|
605
|
+
*/
|
|
606
|
+
declare class VertexAIProvider implements ModelProvider {
|
|
607
|
+
readonly providerId = "vertex";
|
|
608
|
+
readonly modelId: string;
|
|
609
|
+
private ai;
|
|
610
|
+
private GoogleGenAICtor;
|
|
611
|
+
private project;
|
|
612
|
+
private location;
|
|
613
|
+
constructor(modelId: string, config?: VertexAIConfig);
|
|
614
|
+
private getClient;
|
|
615
|
+
generate(messages: ChatMessage[], options?: ModelConfig & {
|
|
616
|
+
tools?: ToolDefinition[];
|
|
617
|
+
}): Promise<ModelResponse>;
|
|
618
|
+
stream(messages: ChatMessage[], options?: ModelConfig & {
|
|
619
|
+
tools?: ToolDefinition[];
|
|
620
|
+
}): AsyncGenerator<StreamChunk>;
|
|
621
|
+
private toGoogleMessages;
|
|
622
|
+
private partToGoogle;
|
|
623
|
+
private toGoogleTools;
|
|
624
|
+
private cleanJsonSchema;
|
|
625
|
+
private normalizeResponse;
|
|
626
|
+
}
|
|
627
|
+
|
|
587
628
|
declare function defineTool<T extends z.ZodObject<any>>(config: {
|
|
588
629
|
name: string;
|
|
589
630
|
description: string;
|
|
@@ -1107,4 +1148,136 @@ declare class A2ARemoteAgent {
|
|
|
1107
1148
|
private partsToText;
|
|
1108
1149
|
}
|
|
1109
1150
|
|
|
1110
|
-
|
|
1151
|
+
/**
|
|
1152
|
+
* Base class for all RadarOS Toolkits.
|
|
1153
|
+
* A Toolkit is a collection of related tools that share configuration.
|
|
1154
|
+
*/
|
|
1155
|
+
declare abstract class Toolkit {
|
|
1156
|
+
abstract readonly name: string;
|
|
1157
|
+
/**
|
|
1158
|
+
* Returns all tools provided by this toolkit as ToolDef[].
|
|
1159
|
+
* Spread them into an Agent's `tools` array.
|
|
1160
|
+
*/
|
|
1161
|
+
abstract getTools(): ToolDef[];
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
interface WebSearchConfig {
|
|
1165
|
+
/** Search provider: "tavily" or "serpapi". */
|
|
1166
|
+
provider: "tavily" | "serpapi";
|
|
1167
|
+
/** API key for the search provider. Falls back to TAVILY_API_KEY or SERPAPI_API_KEY env vars. */
|
|
1168
|
+
apiKey?: string;
|
|
1169
|
+
/** Max results to return per search (default 5). */
|
|
1170
|
+
maxResults?: number;
|
|
1171
|
+
}
|
|
1172
|
+
/**
|
|
1173
|
+
* Web Search Toolkit — search the web from your agent.
|
|
1174
|
+
*
|
|
1175
|
+
* Supports Tavily and SerpAPI backends.
|
|
1176
|
+
*
|
|
1177
|
+
* @example
|
|
1178
|
+
* ```ts
|
|
1179
|
+
* const search = new WebSearchToolkit({ provider: "tavily" });
|
|
1180
|
+
* const agent = new Agent({ tools: [...search.getTools()] });
|
|
1181
|
+
* ```
|
|
1182
|
+
*/
|
|
1183
|
+
declare class WebSearchToolkit extends Toolkit {
|
|
1184
|
+
readonly name = "websearch";
|
|
1185
|
+
private config;
|
|
1186
|
+
constructor(config: WebSearchConfig);
|
|
1187
|
+
private getApiKey;
|
|
1188
|
+
getTools(): ToolDef[];
|
|
1189
|
+
private searchTavily;
|
|
1190
|
+
private searchSerpApi;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
interface GmailConfig {
|
|
1194
|
+
/** Path to OAuth2 credentials JSON file. Falls back to GMAIL_CREDENTIALS_PATH env var. */
|
|
1195
|
+
credentialsPath?: string;
|
|
1196
|
+
/** Path to saved token JSON file. Falls back to GMAIL_TOKEN_PATH env var. */
|
|
1197
|
+
tokenPath?: string;
|
|
1198
|
+
/** Pre-authenticated OAuth2 client (if you handle auth yourself). */
|
|
1199
|
+
authClient?: any;
|
|
1200
|
+
}
|
|
1201
|
+
/**
|
|
1202
|
+
* Gmail Toolkit — send, search, and read emails from your agent.
|
|
1203
|
+
*
|
|
1204
|
+
* Requires: npm install googleapis
|
|
1205
|
+
*
|
|
1206
|
+
* @example
|
|
1207
|
+
* ```ts
|
|
1208
|
+
* const gmail = new GmailToolkit({ credentialsPath: "./credentials.json", tokenPath: "./token.json" });
|
|
1209
|
+
* const agent = new Agent({ tools: [...gmail.getTools()] });
|
|
1210
|
+
* ```
|
|
1211
|
+
*/
|
|
1212
|
+
declare class GmailToolkit extends Toolkit {
|
|
1213
|
+
readonly name = "gmail";
|
|
1214
|
+
private config;
|
|
1215
|
+
private gmail;
|
|
1216
|
+
constructor(config?: GmailConfig);
|
|
1217
|
+
private getGmailClient;
|
|
1218
|
+
getTools(): ToolDef[];
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
interface WhatsAppConfig {
|
|
1222
|
+
/** WhatsApp Business API access token. Falls back to WHATSAPP_ACCESS_TOKEN env var. */
|
|
1223
|
+
accessToken?: string;
|
|
1224
|
+
/** WhatsApp Business phone number ID. Falls back to WHATSAPP_PHONE_NUMBER_ID env var. */
|
|
1225
|
+
phoneNumberId?: string;
|
|
1226
|
+
/** API version (default "v22.0"). Falls back to WHATSAPP_VERSION env var. */
|
|
1227
|
+
version?: string;
|
|
1228
|
+
/** Default recipient WhatsApp ID. Falls back to WHATSAPP_RECIPIENT_WAID env var. */
|
|
1229
|
+
recipientWaid?: string;
|
|
1230
|
+
}
|
|
1231
|
+
/**
|
|
1232
|
+
* WhatsApp Toolkit — send messages via WhatsApp Business Cloud API (Meta).
|
|
1233
|
+
*
|
|
1234
|
+
* Uses the WhatsApp Cloud API directly (no Twilio).
|
|
1235
|
+
* Setup: https://developers.facebook.com/docs/whatsapp/cloud-api/get-started
|
|
1236
|
+
*
|
|
1237
|
+
* @example
|
|
1238
|
+
* ```ts
|
|
1239
|
+
* const whatsapp = new WhatsAppToolkit({
|
|
1240
|
+
* accessToken: "...",
|
|
1241
|
+
* phoneNumberId: "...",
|
|
1242
|
+
* });
|
|
1243
|
+
* const agent = new Agent({ tools: [...whatsapp.getTools()] });
|
|
1244
|
+
* ```
|
|
1245
|
+
*/
|
|
1246
|
+
declare class WhatsAppToolkit extends Toolkit {
|
|
1247
|
+
readonly name = "whatsapp";
|
|
1248
|
+
private accessToken;
|
|
1249
|
+
private phoneNumberId;
|
|
1250
|
+
private version;
|
|
1251
|
+
private recipientWaid;
|
|
1252
|
+
constructor(config?: WhatsAppConfig);
|
|
1253
|
+
private getBaseUrl;
|
|
1254
|
+
private validate;
|
|
1255
|
+
private resolveRecipient;
|
|
1256
|
+
getTools(): ToolDef[];
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
interface HackerNewsConfig {
|
|
1260
|
+
/** Enable fetching top stories (default true). */
|
|
1261
|
+
enableGetTopStories?: boolean;
|
|
1262
|
+
/** Enable fetching user details (default true). */
|
|
1263
|
+
enableGetUserDetails?: boolean;
|
|
1264
|
+
}
|
|
1265
|
+
/**
|
|
1266
|
+
* Hacker News Toolkit — search top stories and user details from HN.
|
|
1267
|
+
*
|
|
1268
|
+
* No API key required — uses the public Hacker News API.
|
|
1269
|
+
*
|
|
1270
|
+
* @example
|
|
1271
|
+
* ```ts
|
|
1272
|
+
* const hn = new HackerNewsToolkit();
|
|
1273
|
+
* const agent = new Agent({ tools: [...hn.getTools()] });
|
|
1274
|
+
* ```
|
|
1275
|
+
*/
|
|
1276
|
+
declare class HackerNewsToolkit extends Toolkit {
|
|
1277
|
+
readonly name = "hackernews";
|
|
1278
|
+
private config;
|
|
1279
|
+
constructor(config?: HackerNewsConfig);
|
|
1280
|
+
getTools(): ToolDef[];
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
export { type A2AAgentCard, type A2AArtifact, type A2ADataPart, type A2AFilePart, type A2AJsonRpcRequest, type A2AJsonRpcResponse, type A2AMessage, type A2APart, A2ARemoteAgent, type A2ARemoteAgentConfig, type A2ASendParams, type A2ASkill, type A2ATask, type A2ATaskQueryParams, type A2ATaskState, type A2ATextPart, Agent, type AgentConfig, type AgentEventMap, type AgentHooks, type AgentStep, AnthropicProvider, type Artifact, type AudioPart, BaseVectorStore, type ChatMessage, type ConditionStep, type ContentPart, type EmbeddingProvider, EventBus, type FilePart, type FunctionStep, type GmailConfig, GmailToolkit, GoogleEmbedding, type GoogleEmbeddingConfig, GoogleProvider, type GuardrailResult, type HackerNewsConfig, HackerNewsToolkit, type ImagePart, InMemoryStorage, InMemoryVectorStore, type InputGuardrail, KnowledgeBase, type KnowledgeBaseConfig, type KnowledgeBaseToolConfig, LLMLoop, type LogLevel, Logger, type LoggerConfig, MCPToolProvider, type MCPToolProviderConfig, Memory, type MemoryConfig, type MemoryEntry, type MessageContent, type MessageRole, type ModelConfig, type ModelProvider, ModelRegistry, type ModelResponse, MongoDBStorage, type MongoDBVectorConfig, MongoDBVectorStore, OllamaProvider, OpenAIEmbedding, type OpenAIEmbeddingConfig, OpenAIProvider, type OutputGuardrail, type ParallelStep, type PgVectorConfig, PgVectorStore, PostgresStorage, type QdrantConfig, QdrantVectorStore, RunContext, type RunOpts, type RunOutput, type Session, SessionManager, SqliteStorage, type StepDef, type StepResult, type StorageDriver, type StreamChunk, Team, type TeamConfig, TeamMode, type TextPart, type TokenUsage, type ToolCall, type ToolCallResult, type ToolDef, type ToolDefinition, ToolExecutor, type ToolResult, Toolkit, type VectorDocument, type VectorSearchOptions, type VectorSearchResult, type VectorStore, type VertexAIConfig, VertexAIProvider, type WebSearchConfig, WebSearchToolkit, type WhatsAppConfig, WhatsAppToolkit, Workflow, type WorkflowConfig, type WorkflowResult, anthropic, defineTool, getTextContent, google, isMultiModal, ollama, openai, registry, vertex };
|