src/provider.js
/**
 * Extend the craft ai context of an agent using providers.
 *
 * @param {Array<Provider>} providers Array of Provider that have the function extendConfiguration
 * that return an object with the context properties to add.
 * @param {Object} context context properties object to add to the agent's context.
 *
 * @returns craft ai agent's context
 */
Extend the craft ai context of an agent using providers.
@param {Array} providers Array of Provider that have the function extendConfiguration
that return an object with the context properties to add.
@param {Object} context context properties object to add to the agent's context.

@returns craft ai agent's context
Extend the craft ai context of an agent using providers . @param { Array } providers Array of Provider that have the function extendConfiguration that return an object with the context properties to add . @param { Object } context context properties object to add to the agent ' s context . @returns craft ai agent ' s context
async function extendConfiguration(providers, context) {
  if (!providers.length) {
    return context;
  }
  return Promise.all(
    providers.map((provider) => provider.extendConfiguration())
  )
    .then((extensions) => Object.assign(context, ...extensions));
}
async function extendConfiguration ( providers , context ) { if ( ! providers . length ) { return context ; } return Promise . all ( providers . map ( ( provider ) => provider . extendConfiguration ( ) ) ) . then ( ( extensions ) => Object . assign ( context , ... extensions ) ) ; }
Extend the craft ai context of an agent using providers.
Extend the craft ai context of an agent using providers .
// TODO: Submit the endpoint's metadata to the providers for validation // TODO: Validate the 'refresh' object from the provider