@mondaydotcomorg/atp-client
Version:
Client SDK for Agent Tool Protocol
79 lines • 2.63 kB
TypeScript
import type { ClientHooks } from './types.js';
import type { ClientToolDefinition } from '@mondaydotcomorg/atp-protocol';
export interface ISession {
init(clientInfo?: {
name?: string;
version?: string;
[key: string]: unknown;
}, tools?: ClientToolDefinition[], services?: {
hasLLM: boolean;
hasApproval: boolean;
hasEmbedding: boolean;
hasTools: boolean;
}): Promise<{
clientId: string;
token: string;
expiresAt: number;
tokenRotateAt: number;
}>;
getClientId(): string;
ensureInitialized(): Promise<void>;
getHeaders(): Record<string, string>;
getBaseUrl(): string;
updateToken(response: Response): void;
prepareHeaders(method: string, url: string, body?: unknown): Promise<Record<string, string>>;
}
export declare class ClientSession implements ISession {
private baseUrl;
private customHeaders;
private clientId?;
private clientToken?;
private initPromise?;
private hooks?;
constructor(baseUrl: string, headers?: Record<string, string>, hooks?: ClientHooks);
/**
* Initializes the client session with the server.
* This MUST be called before any other operations.
* The server generates and returns a unique client ID and token.
* @param clientInfo - Optional client information
* @param tools - Optional client tool definitions to register with the server
* @param services - Optional client service capabilities (LLM, approval, embedding)
*/
init(clientInfo?: {
name?: string;
version?: string;
[key: string]: unknown;
}, tools?: ClientToolDefinition[], services?: {
hasLLM: boolean;
hasApproval: boolean;
hasEmbedding: boolean;
hasTools: boolean;
}): Promise<{
clientId: string;
token: string;
expiresAt: number;
tokenRotateAt: number;
}>;
/**
* Gets the unique client ID.
*/
getClientId(): string;
/**
* Ensures the client is initialized before making requests.
*/
ensureInitialized(): Promise<void>;
/**
* Creates HTTP headers for requests.
*/
getHeaders(): Record<string, string>;
getBaseUrl(): string;
/**
* Updates the client token from response headers (token refresh).
*/
updateToken(response: Response): void;
/**
* Prepares headers for a request, calling preRequest hook if configured
*/
prepareHeaders(method: string, url: string, body?: unknown): Promise<Record<string, string>>;
}
//# sourceMappingURL=session.d.ts.map