export type GetApiWellKnownAgentJsonOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * A2A agent card * * GET /.well-known/agent.json */ export const getApiWellKnownAgentJson = async (options?: GetApiWellKnownAgentJsonOptions) => { const {baseUrl = "https://agentsearch.luthersystems.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/.well-known/agent.json${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };