export type CircuitBreakerTripRequest = {scope?: ('global' | 'tenant' | 'client' | 'policy') | undefined, scope_id?: string | undefined, reason?: ('manual' | 'policy_violation' | 'risk_level' | 'error_rate') | undefined, comment?: string | undefined, duration_minutes?: number | undefined}; export type CreateApiApiV1EmergencyStopArgs = {Authorization: string, body: CircuitBreakerTripRequest}; export type CreateApiApiV1EmergencyStopOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Emergency stop (alias of circuit-breaker trip) * * POST /api/v1/emergency-stop */ export const createApiApiV1EmergencyStop = async (args: CreateApiApiV1EmergencyStopArgs, options?: CreateApiApiV1EmergencyStopOptions) => { const {baseUrl = "https://agent.getaxonflow.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/emergency-stop${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };