Skip to content

amicode: GET /amicode/traces — reader for the turn-level trace spans - #9

Closed
Rchari1 wants to merge 10 commits into
local/amicodefrom
rchari/traces
Closed

amicode: GET /amicode/traces — reader for the turn-level trace spans#9
Rchari1 wants to merge 10 commits into
local/amicodefrom
rchari/traces

Conversation

@Rchari1

@Rchari1 Rchari1 commented Jul 9, 2026

Copy link
Copy Markdown
Member

Turn-level traces, local-first (reader half; pairs with harmoniqs/amicode rchari/traces — the plugin writer).

What

GET /amicode/traces — index: one row per session (span/model/tool counts, error count, input + cache-read token totals, total model ms, first/last ts), newest first. GET /amicode/traces?session=<id>&limit= — that session's spans, bounded (≤5000), newest-last, session id validated (no traversal). Same never-reject discipline as problems.ts; malformed lines skipped (append-only stream).

Contract

The span envelope is defined by the WRITER (harmoniqs/amicode opencode-plugin/traces.ts) and mirrored here — change both in one change-set (one-spine rule, same as run-terminal.ts).

Why

This is the observability slot reserved when we hid the MCP popover: the data that answers "why was that turn slow" (it showed 3 model calls per greeting on the live check), "which turns silently errored" (the Gemini schema bug pattern), and "how do models compare" — locally, without chats leaving the machine. A future panel renders these; a future OTel exporter is a mapping, not a rewrite.

Verification

2 tests (index aggregation incl. malformed-line skip; bounded session read + id validation); typecheck clean; live-verified against a real session (index totals + per-span listing correct).

🤖 Generated with Claude Code

Rchari1 and others added 10 commits July 8, 2026 12:31
…ion-lookup.ts — shared by the About-You card and the onboarding wizard; card keeps debounce/sequencing/race guards

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… about-you with live institution/logo lookup → profile preview + open chat); saves through POST /amicode/profile so the home page autofills affiliation + logo; shows exactly once (fresh profile, dismiss remembered) + tests

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… the starter chips (Open chat owns 'start something'); PDFs upload via POST /amicode/library into ~/.amico/library (sanitized basename, %PDF- magic check, 30MB cap), GET lists newest-first; 'Discuss latest →' hands the agent the paper path + tests

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…jects

On a fresh browser profile against a bare `opencode serve`, the home
page's primary CTA (Meet-Amico card / "Open chat") did nothing: the
persisted client-side project list is empty, so startWithPrompt fell
through to openNewSession(), which needs the same newSessionProject()
that just came back empty and silently returns.

Fall back to the focused server's own working directory, synced from
GET /path (.directory; "" until loaded, so the guard holds). Open and
touch it as a project — self-healing: the home page tracks it from then
on — and start the draft with the prompt preserved. Deliberately not
sync.data.project: the server's "global" record has worktree "/".

Regression spec drives the real UI against a mocked server with no
localStorage seed; verified failing on the unfixed code and passing
with the fix. tsgo -b clean; bun test:unit 376 pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
amicode(home): fix silent dead-end on 'Open chat' with no tracked projects
…' (upload PDFs between about-you and the finish; ✓-list of uploads, continue-without-papers path; step skipped when upload isn't wired); home Library card stays; shared fileToBase64 util

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…mo udd hit exactly this) + trunk

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… demoted to the quiet secondary — the autofilled home is the payoff shot

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
amicode: first-run onboarding wizard — welcome UI that autofills home-page affiliation + logo
…n-level spans (index: per-session counts/tokens/errors/model-ms; ?session= bounded span read); envelope mirrored from the amicode writer (change both in one change-set) + tests

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jack-champagne

Copy link
Copy Markdown
Member

Closing as stale — 293 commits behind, and a rebase is more expensive than a fresh port.

To be clear about why: this was not superseded. I checked, and packages/opencode/src/server/amicode/traces.ts does not exist on local/amicode — the feature was simply never landed and nothing replaced it.

Tracked in #77 so it doesn't get lost. The amicode-side counterpart harmoniqs/amicode#106 is still open and green.

Branch rchari/traces is preserved (not deleted) — the work is recoverable from it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants