aft icon indicating copy to clipboard operation
aft copied to clipboard

Sidebar: adopt the shared CortexKit sidebar layout (design proposal, PR offered)

Open iceteaSA opened this issue 1 month ago • 2 comments

Summary

This proposal makes three changes to the AFT TUI sidebar:

  • it moves the sidebar to the shared CortexKit sidebar layout, the borderless frame from @cortexkit/common-auth/quota-sidebar that the auth plugins use
  • it shows when diagnostics have no reading
  • it collects every problem in one Health section that appears only when something is wrong.

All the data is already in the status response, so the module does not change. Two decisions are requested below.

Current panel and defects

Observed in the plugin source at v0.63.5:

  • Missing diagnostics look clean. The snapshot carries status_bar.diagnostics (no_language_server or producer_missing) and status_bar.diagnostics_gaps (packages/opencode-plugin/src/shared/status.ts:72–73). The panel renders neither. When the server sends no error or warning counts, the Errors and Warnings rows are omitted (packages/opencode-plugin/src/tui/sidebar-view.tsx:665–680), so Code Health looks the same as a project with no errors.
  • The semantic coordination error is not rendered. semantic_index.coordination_error (state, reason, retry_in_ms, status.ts:123–131) is in the snapshot, but no row reads it.
  • Long values wrap. StatRow draws its value with wrapMode="word" (sidebar-view.tsx:229), so a long semantic backend reason adds rows. The shared frame ends a long value with ….
  • Layout: it is the only boxed panel in the sidebar column, with a border and padding (sidebar-view.tsx:440–449). Fully expanded, it has up to 25 rows, among them two Disk rows and a Compression Ratio row for each scope.

The refresh model is already good (a pushed invalidation, a 200 ms debounce, one status call, no I/O in render). The proposal keeps it as it is.

Proposal (B)

The mocks below are a 42-cell example width, the width of the common-auth sidebar goldens. It is not a measured host width. + and | mark the column edges and are not part of the UI. Text cannot show colour: Health values use the warning or error theme tone.

Values:

  • From a real project: the version, the Code Health counts (~ marks counts that are older than the last edit, as today), Diagnostics no reading and the file count.
  • Examples: everything else, which includes each Health row.

Expanded:

+------------------------------------------+
| ▼ AFT                             v0.63.5|
|                                          |
|Project                                   |
|Search                    ready · 6K files|
|Semantic               ready · 41K entries|
|Saved                    7.6M tokens · 64%|
|                                          |
|Code Health ~                             |
|Diagnostics                     no reading|
|Dead code                               17|
|Unused exports                         151|
|Duplicates                             473|
|TODOs                                    1|
|                                          |
|This session                              |
|Saved                    182K tokens · 61%|
|Undo points                   12 · 4 files|
+------------------------------------------+

When something is wrong (example values):

+------------------------------------------+
| ▼ AFT                             v0.63.5|
|                                          |
|Project                                   |
|Search                    ready · 6K files|
|Semantic                            failed|
|Saved                    7.6M tokens · 64%|
|                                          |
|Health                                    |
|Semantic               backend unreachable|
|Diagnostics          rust producer missing|
|Search             off · over 20,000 files|
|/aft-status shows details                 |
+------------------------------------------+

Collapsed:

+------------------------------------------+
| ▶ AFT                             v0.63.5|
|Index                              ready ●|
|Code                17 dead · 151 unused ●|
|Saved                         7.6M · 64% ●|
+------------------------------------------+
Row Data (status response)
Header version, collapse state (shared frame header)
Project · Search search_index.status, search_index.files
Project · Semantic semantic_index.status, semantic_index.entries
Project · Saved compression.project
Code Health status_bar / status_bar_values, tier2_stale for ~
Diagnostics no reading no errors and warnings values in status_bar
This session · Saved compression.session
This session · Undo points session.checkpoints, session.tracked_files
Health · Diagnostics status_bar.diagnostics, diagnostics_gaps (language, producer)
Health · Semantic semantic_index.error, reason, coordination_error
Health · Search off degraded_reasons

Cost: plugin only. No module or RPC change, and the refresh cadence stays the same.

Removed:

  • the border
  • the two Disk rows
  • the separate Files, Entries and Compression Ratio rows, which become one line for each index or scope
  • the ⚠ lines, which become Health rows with one muted hint, /aft-status shows details.
Alternatives considered

A: the same data in the shared layout, with no regrouping (16 rows). Not chosen: it has no scope grouping and no undo row, and is otherwise the same work as B.

+------------------------------------------+
| ▼ AFT                             v0.63.5|
|                                          |
|Index                                     |
|Search                    ready · 6K files|
|Semantic               ready · 41K entries|
|                                          |
|Code Health ~                             |
|Diagnostics                     no reading|
|Dead code                               17|
|Unused exports                         151|
|Duplicates                             473|
|TODOs                                    1|
|                                          |
|Compression                               |
|This session              182K saved · 61%|
|Project                   7.6M saved · 64%|
+------------------------------------------+

C: three quiet lines (5 rows), with the detail in /aft-status. Not chosen: it hides counts that users read in the sidebar today.

+------------------------------------------+
| ▼ AFT                             v0.63.5|
|                                          |
|Index                              ready ●|
|Code              17 dead · 151 unused ~ ●|
|Saved                  7.6M tokens · 64% ●|
+------------------------------------------+

Decisions requested

  • [ ] Proceed with B, or name A or C instead.
  • [ ] Frame code: the answer to item 3 of cortexkit/magic-context#839 applies here too. If that item has no answer, AFT copies the layout grammar and takes no new dependency.

Later, not asked now

These rows would need new fields in the module status response, plus a status push when they change:

# Row Field
P1 Shell tasks: 2 running · oldest 42m and Health Shell task: running 1h12m, no output running background tasks for the session: count, oldest start, last output time, from the in-memory task registry, without a poll of each task
P2 Outside access: 3 paths granted the count of active outside-root grants for the session
P3 Health Diagnostics: TypeScript server crashed the state of each language server (running, stopped idle, crashed)
P4 Call graph: ready the call-graph store state for the root

P1 and P2 are the two that users act on most. The example values are invented.

I can open a PR after your confirmation here; I will not open one before that; no urgency.

iceteaSA avatar Nov 02 '26 08:11 iceteaSA

The frame-code decision in this issue now has an upstream proposal: cortexkit/common-auth#12.

  • Item 1 there (a collapsible prop on SidebarFrame) is necessary for AFT. AFT has no quota accounts, so with quota-sidebar 0.38.0 the shared frame shows no ▼/▶ toggle and no collapsed view for it.
  • Item 2 there (SidebarGaugeRow) is not necessary for AFT. The proposal in this issue has no gauge row.

If common-auth#12 is accepted, AFT imports the shared frame. If it is not, AFT copies the layout, as stated in "Decisions requested" above. The two sidebars will use the same text for their Health rows and collapsed rows.

iceteaSA avatar Nov 06 '26 11:11 iceteaSA

Thank you for the detailed proposal, the mocks and the defect list, @iceteaSA. We've decided not to take the sidebar layout change.

Over time, AFT is moving from its OpenCode and Pi plugins to running as a CortexKit daemon module, with its status shown in the CortexKit apps rather than in a host's sidebar. The plugins stay supported for standalone use, but we're limiting sidebar changes to bug fixes and won't redesign its layout.

Your defect findings are still useful, and we've noted both: diagnostics with no reading look the same as a clean project, and the semantic coordination error isn't shown anywhere.

The frame-code question depended on this layout, so cortexkit/common-auth#12 doesn't need anything for AFT.

aft-alfonso[bot] avatar Nov 16 '26 20:11 aft-alfonso[bot]