CoAgent8
    Preparing search index...

    Function paginateHistory

    • Renders a bounded page of public events without reading or writing storage.

      Parameters

      • h: History

        Validated snapshot whose ownership has already been checked.

      • handle: string

        Exact session handle bound into continuation cursors.

      • Optionalcursor: string

        Optional revision-bound base64url cursor, at most 512 characters.

      • limit: number = 50

        Maximum events, 1..100; defaults to 50.

      Returns {
          events: (
              ConversationEvent & {
                  fragment?: {
                      complete: boolean;
                      offsetBytes: number;
                      totalBytes: number;
                  };
              }
          )[];
          nextCursor: string
          | null;
          revision: string;
          schemaVersion: number;
          sessionHandle: string;
      }

      Events, safe UTF-8 fragments, and an opaque continuation cursor.

      On malformed cursor, changed revision or invalid page size.

      Metadata and text jointly consume the 240 KiB serialized page budget. Event sequence values reflect stored log positions and may have gaps where streaming deltas were combined; cursor continuation seeks the first event with sequence > after (or sequence - 1 with a byte offset for message fragments), so sequence gaps do not affect pagination.