[feat] Session catalog: expose workspace aggregates for project lists

Abierto
#2,245 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust

Línea de trabajo

Start by reading the session.catalog implementation and the owner Session row and activity timestamp definitions; the issue does not name their file paths. Compare the existing cwd filtering with the proposed project-scoped summaries, and review #1956 and #1099 for related semantics. Done means a bounded paged read returns workspace counts and latest activity with origin, closed-session, ordering, cursor, compatibility, and performance behavior defined and documented.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

core design enhancement P1

Problem / Context

Desktop clients need a bounded project/workspace list: for each workspace they render a Session count and the latest activity time, and they page workspaces. session.catalog exposes Session rows filtered by cwd, but it has no aggregate for a workspace.

The Electron client currently pages every Session row for the requested cwds and aggregates sessionCount, nonAcpSessionCount, createdAt and latestUpdatedAt locally in SessionService.listWorkspacePage (packages/desktop/packages/electron-main/src/services/session-service.ts). The renderer asks for workspace pages on startup and after activity changes; each refresh can walk the whole catalog for every requested workspace. This is O(Sessions in those workspaces) per read, repeated in every window, and every client would have to implement the same filtering and ordering.

session.catalog already accepts a cwd set (session.catalog.workspaces), but it still returns individual rows. Desktop issue #279 wired that cwd filter; it did not add aggregates.

Proposal

Add a read-only owner projection, for example:

session.workspace.summaries {
  cwds?: string[],
  projectCwd?: string,
  limit?: number,
  cursor?: string
}
-> {
  items: [{
    cwd: string,
    projectCwd?: string,
    sessionCount: number,
    nonAcpSessionCount: number,
    createdAt: number,
    latestUpdatedAt: number
  }],
  nextCursor?: string
}

or an includeWorkspaceSummaries option on session.catalog that returns aggregates for the requested cwds. The preferred shape is project-scoped (projectCwd) so it composes with #1956.

Semantics to define:

  • which origins count (client, acp, internal, automation), or return separate counts;
  • whether closed Sessions count (probably no by default; expose includeClosed if needed);
  • whether latestUpdatedAt is the same fact as catalog updatedAt (see #1099: real activity only);
  • stable ordering and cursor semantics.

Why this belongs in App Server

Workspace counts and latest activity are derived from owner Session rows. The owner already owns the catalog, worktree association and activity timestamp. A client cannot compute them without reading every row, and each client will drift on ACP/automation/closed filtering. This is a read projection, not a new store.

Client-local archive is a Desktop preference (upstream #279 declined a cross-client archive fact). Desktop can subtract locally archived ids from counts if the summary includes enough identity; otherwise it will treat counts as unfiltered or drop them. Do not make the owner aware of client archive state.

If upstream declines

If workspace aggregates are considered unnecessary, say so explicitly. Desktop will remove per-workspace counts and workspace pagination, load one Session page on demand, and stop scanning the catalog for summaries. We will not add a Desktop-local workspace index.

Acceptance

  • A client can read per-workspace counts and latest activity for a requested cwd set in one bounded, paged owner read.
  • Worktree Sessions can be aggregated under projectCwd when #1956 is available.
  • ACP/automation/closed filtering is explicit and documented.
  • An older client ignores the new method/fields; a feature gate is advertised.
  • Performance evidence shows the read is bounded by the requested workspace/page, not by the total Session count.

Boundaries

  • No new Session store or index in clients.
  • No client archive/attention/settle state in the owner.
  • No payloads, titles, previews or message content beyond the aggregate fields.

Related

  • Desktop tracking issue will be linked in a comment.
  • #1956
  • #1099 (updatedAt should mean real activity, not restore bookkeeping)
  • Desktop #279 (closed: only cwd filtering was wired)
Lenguaje dominante
Rust
Estrellas
584
Forks
42
Merge medio
9 h 41 min
PR fusionados (30 d)
929

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de arcships/dim

Todos los issues de arcships/dim

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.