@artinet/sdk
Version:
A TypeScript SDK for building collaborative AI agents.
116 lines (115 loc) • 3.93 kB
TypeScript
/**
* Copyright 2025 The Artinet Project
* SPDX-License-Identifier: Apache-2.0
*/
import { A2A } from "../types/index.js";
import { Agent, ServiceParams as CreateAgentParams } from "../services/a2a/index.js";
import { ExtendedAgentCardProvider } from "@a2a-js/sdk/server";
import { UserBuilder } from "@a2a-js/sdk/server/express";
export interface ServerParams {
basePath?: string;
port?: number;
/**
* Your agentCard must have {@link A2A.AgentCard.supportsAuthenticatedExtendedCard} set to true
*/
extendedAgentCard?: A2A.AgentCard | ExtendedAgentCardProvider;
agent: Agent | CreateAgentParams;
agentCardPath?: string;
register?: boolean;
userBuilder?: UserBuilder;
}
export declare function isCreateAgentParams(agentOrParams: Agent | CreateAgentParams): agentOrParams is CreateAgentParams;
export declare function ensureAgent(agentOrParams: Agent | CreateAgentParams): Agent;
export declare function registerAgent(agentCard: A2A.AgentCard): Promise<{
protocolVersion: string;
name: string;
description: string;
url: string;
version: string;
capabilities: {
streaming?: boolean | undefined;
pushNotifications?: boolean | undefined;
stateTransitionHistory?: boolean | undefined;
extensions?: {
uri: string;
description?: string | undefined;
required?: boolean | undefined;
params?: Record<string, unknown> | undefined;
}[] | undefined;
};
defaultInputModes: string[];
defaultOutputModes: string[];
skills: {
id: string;
name: string;
description: string;
tags: string[];
examples?: string[] | undefined;
inputModes?: string[] | undefined;
outputModes?: string[] | undefined;
security?: Record<string, string[]>[] | undefined;
}[];
preferredTransport?: string | undefined;
additionalInterfaces?: {
url: string;
transport: string;
}[] | undefined;
iconUrl?: string | undefined;
provider?: {
organization: string;
url: string;
} | undefined;
documentationUrl?: string | undefined;
securitySchemes?: Record<string, {
type: "apiKey";
in: "query" | "header" | "cookie";
name: string;
description?: string | undefined;
} | {
type: "http";
scheme: string;
description?: string | undefined;
bearerFormat?: string | undefined;
} | {
type: "oauth2";
flows: {
authorizationCode?: {
authorizationUrl: string;
tokenUrl: string;
scopes: Record<string, string>;
refreshUrl?: string | undefined;
} | undefined;
clientCredentials?: {
tokenUrl: string;
scopes: Record<string, string>;
refreshUrl?: string | undefined;
} | undefined;
implicit?: {
authorizationUrl: string;
scopes: Record<string, string>;
refreshUrl?: string | undefined;
} | undefined;
password?: {
tokenUrl: string;
scopes: Record<string, string>;
refreshUrl?: string | undefined;
} | undefined;
};
description?: string | undefined;
oauth2MetadataUrl?: string | undefined;
} | {
type: "openIdConnect";
openIdConnectUrl: string;
description?: string | undefined;
} | {
type: "mutualTLS";
description?: string | undefined;
}> | undefined;
security?: Record<string, string[]>[] | undefined;
supportsAuthenticatedExtendedCard?: boolean | undefined;
signatures?: {
protected: string;
signature: string;
header?: Record<string, unknown> | undefined;
}[] | undefined;
}>;