Skip to main content

Types

TypeScript type definitions exported by the library.

Import

import type { AgentCard, AgentSkill, AgentCapabilities, ChatMessage } from "@open-resource-discovery/a2a-editor";

Agent Card Types

AgentCard

The main agent card type following the A2A specification.

interface AgentCard {
name: string;
url: string;
version: string;
description?: string;
documentationUrl?: string;
iconUrl?: string;
provider?: AgentProvider;
capabilities: AgentCapabilities;
skills: AgentSkill[];
securitySchemes?: Record<string, SecurityScheme>;
security?: SecurityRequirement[];
defaultInputModes?: string[];
defaultOutputModes?: string[];
protocolVersions?: string[];
extensions?: AgentExtension[];
}

AgentSkill

interface AgentSkill {
id: string;
name: string;
description: string;
tags?: string[];
inputModes?: string[];
outputModes?: string[];
examples?: string[];
}

AgentCapabilities

interface AgentCapabilities {
streaming?: boolean;
pushNotifications?: boolean;
stateTransitionHistory?: boolean;
extendedAgentCard?: boolean;
}

AgentProvider

interface AgentProvider {
name: string;
organization?: string;
url?: string;
}

Chat Types

ChatMessage

interface ChatMessage {
id: string;
role: "user" | "agent";
parts: Part[];
timestamp: Date;
contextId?: string;
taskId?: string;
status?: TaskState;
isStreaming?: boolean;
artifacts?: Artifact[];
compliant?: boolean;
linkedChatMessageId?: string;
}

Part

type Part = TextPart | FilePart | DataPart;

interface TextPart {
text: string;
}

interface FilePart {
file: { uri: string; mimeType?: string; name?: string } | string;
}

interface DataPart {
data: Record<string, unknown>;
}

Connection Types

ConnectionStatus

type ConnectionStatus = "disconnected" | "connecting" | "connected" | "error";

AuthType

type AuthType = "none" | "apiKey" | "oauth2" | "basic";

PredefinedAgent

interface PredefinedAgent {
id: string;
name: string;
description: string;
url: string;
iconUrl?: string;
authType: AuthType;
authConfig?: BasicCredentials | OAuth2Credentials | ApiKeyCredentials;
tags?: string[];
}

Security Types

SecurityScheme

interface SecurityScheme {
type: "apiKey" | "http" | "oauth2" | "openIdConnect" | "mutualTLS";
description?: string;
name?: string;
in?: "query" | "header" | "cookie";
scheme?: string;
bearerFormat?: string;
flows?: OAuthFlows;
openIdConnectUrl?: string;
}

SecurityRequirement

type SecurityRequirement = Record<string, string[]>;