Skip to content

[Feature]: feat(gateway): apply cursor pagination to agents.files.list and sessions.list #75236

@Angfr95

Description

@Angfr95

Summary

artifacts.list gained cursor pagination in #75208 via src/gateway/util/cursor.ts.
The same pattern should be applied to agents.files.list and sessions list RPCs
to keep the API surface consistent.

Refs #75208.

Problem to solve

agents.files.list and sessions list RPCs return unbounded result sets.
Large workspaces with many files or sessions have no way to paginate results efficiently.

Proposed solution

Import encodeCursor/decodeCursor from src/gateway/util/cursor.ts (introduced in #75208)
and add cursor, limit, nextCursor, total to agents.files.list and sessions list params/results,
following the same pattern as artifacts.list.

Alternatives considered

No response

Impact

Affected: SDK consumers and agents using agents.files.list or sessions RPCs
Severity: Medium
Frequency: Any workspace with large file sets or many sessions
Consequence: Unbounded payloads, slow responses, no way to paginate

Evidence/examples

artifacts.list already supports cursor pagination via #75208.
agents.files.list and sessions list have no equivalent.

Additional information

Reuse src/gateway/util/cursor.ts introduced in #75208. No new dependencies needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions