Function getRawHistory

  • Retrieves the raw, unmodified history for a given client session.

    This function fetches the complete history associated with a client’s active agent in a swarm session, without any filtering or modifications. It is wrapped in beginContext for a clean execution environment and logs the operation if enabled via GLOBAL_CONFIG. The function validates the session and swarm, retrieves the current agent, and uses historyPublicService.toArrayForRaw to obtain the raw history as an array. The result is a fresh copy of the history array.

    Parameters

    • clientId: string

      The unique identifier of the client session whose raw history is to be retrieved.

    Returns Promise<IModelMessage<object>[]>

    A promise that resolves to an array containing the raw history entries.

    If session or swarm validation fails, or if history retrieval encounters an issue.

    const rawHistory = await getRawHistory("client-123");
    console.log(rawHistory); // Outputs the full raw history array