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

Aperta
#2,245 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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)
Lingua principale
Rust
Stelle
584
Fork
42
Merge medio
9h 41m
PR unite (30g)
929

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di arcships/dim

Tutte le issue di arcships/dim

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.