Skip to content

feat(studio): L01 versions tab timeline - #1002

Merged
LinuxDevil merged 1 commit into
mainfrom
fb-l01-versions-tab
Nov 9, 2026
Merged

LinuxDevil merged 1 commit into
mainfrom
fb-l01-versions-tab

Conversation

@LinuxDevil

Copy link
Copy Markdown
Owner

Summary

Implements ticket L01 (Forge Builder P7): the /agents/:id/versions tab.

  • src/screens/agentDetail/VersionsTab.tsx + versions.css: newest-first timeline — version number, kind/source labels, "Current" pill on the newest item, relative time, summary (skeleton + visually-hidden "Writing a summary" while pending, baseline hint for external edits), curly-quoted request text, changed-field chips (max 4 + +N), empty .version-actions slot for L02/L03/L14b.
  • src/screens/agentDetail/versionLabels.ts: FIELD_LABELS (every spec field + labels), KIND_LABELS, SOURCE_LABELS, fieldLabel, kindLabel (Restored from v<n>), summaryPending (2-minute window).
  • src/screens/agentDetail/useVersions.ts: fetch on mount/agentId change with stale-response guard; version.summary events patch summaries in place; agent.changed with version/restore/import/save reasons re-fetch.
  • Save version button: disabled + aria-busy while pending; success toast Saved v<n>, info toast Nothing changed since v<n> on the server no-op, error toast on failure; then refresh.
  • Registered versions in tabScreens.ts and BUILT_AGENT_TABS (agents/agentTabs.ts); added relativeTime to components/formatTime.ts.

Deviations from the ticket contract (D07 already landed on main):

  • runtimeClient.listVersions/saveVersion already exist; saveVersion returns { item, created } rather than a bare VersionListItem — the created flag drives the "Nothing changed" toast.
  • VersionKind/VersionSource/VersionListItem already declared in shared/wireTypes.ts (incl. 'copy' source → "as a copy" label).
  • VersionsTab takes no props and reads the agent id from AgentDetailContext, matching RunsTab/TAB_SCREENS (() => ReactNode).

Test plan

  • npx vitest run --root apps/agent-forge src/screens/agentDetail src/screens/agents — 17 files / 115 tests pass, incl. new versionLabels.test.ts (11) and VersionsTab.test.tsx (12: ordering, Current pill, pending skeleton + version.summary swap, chip overflow, baseline hint, empty/error/loading, save toasts).
  • npm run typecheck --workspace apps/agent-forge — clean.
  • npx eslint on touched files — clean; npx fallow dead-code apps/agent-forge — no issues (one fallow-ignore on KIND_LABELS, a contract export for L02/L03/L14b).

Adds /agents/:id/versions: newest-first timeline of every saved version
(number, kind/source, Current pill, relative time, summary or pending
skeleton, quoted request text, changed-field chips capped at 4 + +N,
baseline hint) plus a Save version button. Live via /events:
version.summary fills skeletons in place, agent.changed version reasons
re-fetch. New versionLabels.ts (FIELD_LABELS/KIND_LABELS/SOURCE_LABELS,
kindLabel, summaryPending) and useVersions.ts hook; registered in
tabScreens.ts and BUILT_AGENT_TABS. relativeTime added to formatTime.ts.

D07 already shipped listVersions/saveVersion/getVersion on
runtimeClient (saveVersion returns {item, created}); wireTypes already
declare the Contract B version types.
@LinuxDevil
LinuxDevil merged commit 9d7e434 into main Nov 9, 2026
6 checks passed
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.

1 participant