@radaros/core 0.1.0 → 0.3.0

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 CHANGED
@@ -138,6 +138,8 @@ interface ToolDef {
138
138
  description: string;
139
139
  parameters: z.ZodObject<any>;
140
140
  execute: (args: Record<string, unknown>, ctx: RunContext) => Promise<string | ToolResult>;
141
+ /** Raw JSON Schema to send to the LLM, bypassing Zod-to-JSON conversion (used by MCP tools). */
142
+ rawJsonSchema?: Record<string, unknown>;
141
143
  }
142
144
  interface ToolCallResult {
143
145
  toolCallId: string;
@@ -489,6 +491,11 @@ declare function google(modelId: string, config?: {
489
491
  declare function ollama(modelId: string, config?: {
490
492
  host?: string;
491
493
  }): ModelProvider;
494
+ declare function vertex(modelId: string, config?: {
495
+ project?: string;
496
+ location?: string;
497
+ credentials?: string;
498
+ }): ModelProvider;
492
499
 
493
500
  interface OpenAIConfig {
494
501
  apiKey?: string;
@@ -582,6 +589,42 @@ declare class OllamaProvider implements ModelProvider {
582
589
  private normalizeResponse;
583
590
  }
584
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
+
585
628
  declare function defineTool<T extends z.ZodObject<any>>(config: {
586
629
  name: string;
587
630
  description: string;
@@ -884,4 +927,225 @@ declare class SessionManager {
884
927
  deleteSession(sessionId: string): Promise<void>;
885
928
  }
886
929
 
887
- export { 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, GoogleEmbedding, type GoogleEmbeddingConfig, GoogleProvider, type GuardrailResult, type ImagePart, InMemoryStorage, InMemoryVectorStore, type InputGuardrail, KnowledgeBase, type KnowledgeBaseConfig, type KnowledgeBaseToolConfig, LLMLoop, type LogLevel, Logger, type LoggerConfig, 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, type VectorDocument, type VectorSearchOptions, type VectorSearchResult, type VectorStore, Workflow, type WorkflowConfig, type WorkflowResult, anthropic, defineTool, getTextContent, google, isMultiModal, ollama, openai, registry };
930
+ interface MCPToolProviderConfig {
931
+ name: string;
932
+ transport: "stdio" | "http";
933
+ /** For stdio transport: command to spawn */
934
+ command?: string;
935
+ /** For stdio transport: args for the command */
936
+ args?: string[];
937
+ /** For stdio transport: environment variables */
938
+ env?: Record<string, string>;
939
+ /** For http transport: server URL */
940
+ url?: string;
941
+ /** For http transport: custom headers */
942
+ headers?: Record<string, string>;
943
+ }
944
+ /**
945
+ * Connects to an MCP (Model Context Protocol) server and exposes its tools
946
+ * as native RadarOS ToolDef[] that any Agent can use.
947
+ *
948
+ * Supports stdio and HTTP (Streamable HTTP) transports.
949
+ * Requires: npm install @modelcontextprotocol/sdk
950
+ */
951
+ declare class MCPToolProvider {
952
+ readonly name: string;
953
+ private config;
954
+ private client;
955
+ private transportInstance;
956
+ private tools;
957
+ private connected;
958
+ constructor(config: MCPToolProviderConfig);
959
+ connect(): Promise<void>;
960
+ private discoverTools;
961
+ private jsonSchemaToZod;
962
+ /**
963
+ * Returns tools from this MCP server as RadarOS ToolDef[].
964
+ * Optionally filter by tool names to reduce token usage.
965
+ *
966
+ * @param filter - Tool names to include (without the server name prefix).
967
+ * If omitted, returns all tools.
968
+ *
969
+ * @example
970
+ * // All tools
971
+ * await mcp.getTools()
972
+ *
973
+ * // Only specific tools (pass the original MCP tool names, not prefixed)
974
+ * await mcp.getTools({ include: ["get_latest_release", "search_repositories"] })
975
+ *
976
+ * // Exclude specific tools
977
+ * await mcp.getTools({ exclude: ["push_files", "create_repository"] })
978
+ */
979
+ getTools(filter?: {
980
+ include?: string[];
981
+ exclude?: string[];
982
+ }): Promise<ToolDef[]>;
983
+ /** Refresh the tool list from the MCP server. */
984
+ refresh(): Promise<void>;
985
+ /** Disconnect from the MCP server. */
986
+ close(): Promise<void>;
987
+ }
988
+
989
+ /**
990
+ * A2A (Agent-to-Agent) Protocol types.
991
+ * Based on the A2A specification v0.2.
992
+ * https://google.github.io/A2A/specification/
993
+ */
994
+ interface A2ATextPart {
995
+ kind: "text";
996
+ text: string;
997
+ }
998
+ interface A2AFilePart {
999
+ kind: "file";
1000
+ file: {
1001
+ name?: string;
1002
+ mimeType?: string;
1003
+ bytes?: string;
1004
+ uri?: string;
1005
+ };
1006
+ }
1007
+ interface A2ADataPart {
1008
+ kind: "data";
1009
+ data: Record<string, unknown>;
1010
+ }
1011
+ type A2APart = A2ATextPart | A2AFilePart | A2ADataPart;
1012
+ interface A2AMessage {
1013
+ role: "user" | "agent";
1014
+ parts: A2APart[];
1015
+ messageId?: string;
1016
+ taskId?: string;
1017
+ referenceTaskIds?: string[];
1018
+ metadata?: Record<string, unknown>;
1019
+ }
1020
+ type A2ATaskState = "submitted" | "working" | "input-required" | "completed" | "failed" | "canceled";
1021
+ interface A2AArtifact {
1022
+ artifactId: string;
1023
+ name?: string;
1024
+ description?: string;
1025
+ parts: A2APart[];
1026
+ metadata?: Record<string, unknown>;
1027
+ }
1028
+ interface A2ATask {
1029
+ id: string;
1030
+ sessionId?: string;
1031
+ status: {
1032
+ state: A2ATaskState;
1033
+ message?: A2AMessage;
1034
+ timestamp?: string;
1035
+ };
1036
+ artifacts?: A2AArtifact[];
1037
+ history?: A2AMessage[];
1038
+ metadata?: Record<string, unknown>;
1039
+ }
1040
+ interface A2ASkill {
1041
+ id: string;
1042
+ name: string;
1043
+ description?: string;
1044
+ tags?: string[];
1045
+ examples?: string[];
1046
+ }
1047
+ interface A2AAgentCard {
1048
+ name: string;
1049
+ description?: string;
1050
+ url: string;
1051
+ version?: string;
1052
+ provider?: {
1053
+ organization: string;
1054
+ url?: string;
1055
+ };
1056
+ capabilities?: {
1057
+ streaming?: boolean;
1058
+ pushNotifications?: boolean;
1059
+ stateTransitionHistory?: boolean;
1060
+ };
1061
+ authentication?: {
1062
+ schemes?: string[];
1063
+ credentials?: string;
1064
+ };
1065
+ skills?: A2ASkill[];
1066
+ defaultInputModes?: string[];
1067
+ defaultOutputModes?: string[];
1068
+ supportedInputModes?: string[];
1069
+ supportedOutputModes?: string[];
1070
+ }
1071
+ interface A2AJsonRpcRequest {
1072
+ jsonrpc: "2.0";
1073
+ id: string | number;
1074
+ method: string;
1075
+ params?: Record<string, unknown>;
1076
+ }
1077
+ interface A2AJsonRpcResponse {
1078
+ jsonrpc: "2.0";
1079
+ id: string | number;
1080
+ result?: unknown;
1081
+ error?: {
1082
+ code: number;
1083
+ message: string;
1084
+ data?: unknown;
1085
+ };
1086
+ }
1087
+ interface A2ASendParams {
1088
+ message: A2AMessage;
1089
+ configuration?: {
1090
+ acceptedOutputModes?: string[];
1091
+ blocking?: boolean;
1092
+ };
1093
+ metadata?: Record<string, unknown>;
1094
+ }
1095
+ interface A2ATaskQueryParams {
1096
+ id: string;
1097
+ historyLength?: number;
1098
+ }
1099
+
1100
+ interface A2ARemoteAgentConfig {
1101
+ url: string;
1102
+ /** Custom headers for every request (e.g. auth tokens). */
1103
+ headers?: Record<string, string>;
1104
+ /** Override the discovered name. */
1105
+ name?: string;
1106
+ /** Request timeout in ms (default 60000). */
1107
+ timeoutMs?: number;
1108
+ }
1109
+ /**
1110
+ * A2ARemoteAgent wraps a remote A2A-compliant agent.
1111
+ * It can be used as a tool, a Team member, or called directly.
1112
+ */
1113
+ declare class A2ARemoteAgent {
1114
+ readonly url: string;
1115
+ name: string;
1116
+ instructions: string;
1117
+ skills: Array<{
1118
+ id: string;
1119
+ name: string;
1120
+ description?: string;
1121
+ }>;
1122
+ private headers;
1123
+ private timeoutMs;
1124
+ private card;
1125
+ private rpcId;
1126
+ get tools(): ToolDef[];
1127
+ get modelId(): string;
1128
+ get providerId(): string;
1129
+ get hasStructuredOutput(): boolean;
1130
+ constructor(config: A2ARemoteAgentConfig);
1131
+ /**
1132
+ * Fetch the Agent Card from /.well-known/agent.json and populate metadata.
1133
+ */
1134
+ discover(): Promise<A2AAgentCard>;
1135
+ /**
1136
+ * Synchronous run: sends message/send and returns RunOutput.
1137
+ */
1138
+ run(input: string, opts?: RunOpts): Promise<RunOutput>;
1139
+ /**
1140
+ * Streaming run: sends message/stream and yields StreamChunks from SSE.
1141
+ */
1142
+ stream(input: string, opts?: RunOpts): AsyncGenerator<StreamChunk>;
1143
+ /**
1144
+ * Wrap this remote agent as a ToolDef so it can be used by an orchestrator agent.
1145
+ */
1146
+ asTool(): ToolDef;
1147
+ getAgentCard(): A2AAgentCard | null;
1148
+ private partsToText;
1149
+ }
1150
+
1151
+ 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, GoogleEmbedding, type GoogleEmbeddingConfig, GoogleProvider, type GuardrailResult, 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, type VectorDocument, type VectorSearchOptions, type VectorSearchResult, type VectorStore, type VertexAIConfig, VertexAIProvider, Workflow, type WorkflowConfig, type WorkflowResult, anthropic, defineTool, getTextContent, google, isMultiModal, ollama, openai, registry, vertex };