187 Commits

Author SHA1 Message Date
Lukas May
cb95ac1c6e fix: Logo link navigates to HQ instead of Initiatives 2026-03-06 16:33:10 +01:00
Lukas May
14041d007f feat: add Errands nav item, /errands route, and CreateErrandDialog
- AppLayout: add Errands nav entry with pending_review badge count
- /errands route: list table with ID, description, branch, status, agent, created columns; empty state with CLI hint; slide-over integration
- CreateErrandDialog: description (max 200 chars with counter), project select, optional base branch; no optimistic UI due to agent spawn latency
- ErrandDetailPanel: checkout from completed dependency commit (4j3ZfR_ZX_4rw7j9uj6DV)

TypeScript compiles clean. Route uses TanStack Router file-based routing; routeTree.gen.ts auto-regenerated on build.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 16:27:44 +01:00
Lukas May
2eccde0ee1 Merge branch 'cw/improved-agent-outputs' into cw-merge-1772810637670 2026-03-06 16:23:57 +01:00
Lukas May
e50eb17c3f Merge branch 'cw/headquarters' into cw-merge-1772810307192 2026-03-06 16:18:27 +01:00
Lukas May
313cf82ea4 Merge branch 'cw/headquarters-task-i16XYnxexfeqf8VCUuTL3' into cw-merge-1772809739062 2026-03-06 16:08:59 +01:00
Lukas May
2ec4ddb2fd feat: Wire up hq.tsx with query, live updates, loading/error states, and section rendering
Replaces the placeholder body in apps/web/src/routes/hq.tsx with the
full Headquarters page. The component fetches from getHeadquartersDashboard,
subscribes to live SSE invalidations via useLiveUpdates, and renders the
four action sections or an empty state. Includes skeleton loading and
error-with-retry states. Also adds apps/web/src/components/ui/skeleton.tsx
(standard shadcn component not yet in the project).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 16:08:35 +01:00
Lukas May
f6938ae7e1 feat: Add live todo strip and Task result preview to AgentOutputViewer
- Derives currentTodos from the most recent TodoWrite tool_call on each render
- Renders a TASKS strip between the header and scroll area with status icons
  (CheckCircle2 for completed, Loader2/animate-spin for in_progress, Circle for pending)
- Caps the strip at 5 rows and shows "+ N more" for overflow
- Updates collapsed tool_result preview to show "{subagent_type} result" for
  Task tool results instead of the raw first-80-chars substring
- Adds 10 new tests covering all todo strip states and Task preview variants

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 16:05:48 +01:00
Lukas May
32f58ddb43 Merge branch 'cw/improved-agent-outputs-phase-parser-enhancement-types-bug-fixes-tool-correlation' into cw-merge-1772809398045 2026-03-06 16:03:18 +01:00
Lukas May
ee6b0da976 feat: Add tool correlation, toolInput metadata, and unknown-type fallbacks to parser
- Extend ParsedMessage.meta with toolInput to expose raw tool arguments
- Add toolUseRegistry to correlate tool_result blocks back to originating tool_use
- Set toolInput on tool_call messages and populate meta.toolName/toolInput on tool_result
- Fix tool_result with is_error:true now correctly produces type "error"
- Add catch-all for unknown top-level event types (emits system message)
- Add catch-all for unknown assistant content block types (emits system message)
- Add unit tests covering all 8 scenarios including regression cases

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 16:02:50 +01:00
Lukas May
752bb67e3a feat: collapse tool_result blocks by default; restyle system messages
tool_result messages now render as a single collapsible preview line
(ChevronRight + first 80 chars) and expand on click to show full content.
system messages drop the Badge/border-l and render as a dim mono inline
line. expandedResults state resets when agentId changes.

Adds full test coverage in AgentOutputViewer.test.tsx (9 tests).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 16:02:20 +01:00
Lukas May
30d5f68f91 feat: Add HQ section components for Headquarters page
Implements the five section components consumed by the HQ page:
- HQWaitingForInputSection, HQNeedsReviewSection, HQNeedsApprovalSection,
  HQBlockedSection, HQEmptyState with typed props from RouterOutputs.
- Shared types.ts defines the 5 item types from getHeadquartersDashboard.
- Adds RouterOutputs export to trpc.ts via inferRouterOutputs<AppRouter>.
- 22 unit tests verify rendering, navigation CTAs, truncation, and edge cases.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 15:53:15 +01:00
Lukas May
48c324ac15 chore: Update tsbuildinfo after web build 2026-03-06 15:27:41 +01:00
Lukas May
3c55349c4c feat: Add /hq route, nav item, and update root redirect
- Create apps/web/src/routes/hq.tsx with HeadquartersPage shell component
- Add "HQ" as first entry in AppLayout.tsx navItems array
- Change root redirect from /initiatives to /hq
- Regenerate routeTree.gen.ts with the new /hq route

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 15:27:09 +01:00
Lukas May
c069049c35 fix: Retry blocked task button does nothing due to missing query invalidation
retryBlockedTask was not in the centralized invalidation map, so the
mutation succeeded server-side but the UI never refreshed. Also changed
the button to wait for the mutation response before closing the slide-over
and show a loading spinner.
2026-03-06 15:00:38 +01:00
Lukas May
2bef0fa682 Merge branch 'cw/project-management-operations-to-ui' into cw-merge-1772805244951 2026-03-06 14:54:05 +01:00
Lukas May
7a4d0d2582 feat: Add Sync All button to projects settings page with tests
- Adds syncAllMutation calling trpc.syncAllProjects once for all cards
- Shows Sync All button in header when ≥1 project exists (hidden otherwise)
- Propagates isPending to ProjectCard.syncAllPending to disable per-card sync
- On success: toasts all-success or failure count; invalidates listProjects + getProjectSyncStatus per project
- On network error: toasts Sync failed with err.message
- Adds unit tests for ProjectSyncManager.syncAllProjects: empty list, all succeed, partial failure, result shape, and failure counting logic

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 14:39:58 +01:00
Lukas May
4c99f89462 feat: Improve RegisterProjectDialog UX for long-running clone
- Add Loader2 spinner with "Cloning repository…" label while pending
- Keep Cancel button always enabled (no disabled gate)
- Map INTERNAL_SERVER_ERROR to user-friendly clone failure message
- Invalidate listProjects cache on success so new card appears immediately

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 14:34:34 +01:00
Lukas May
d867a5f397 Merge branch 'main' into cw/account-ui-conflict-1772803526476
# Conflicts:
#	apps/server/trpc/router.test.ts
#	docs/server-api.md
2026-03-06 14:27:38 +01:00
Lukas May
23964374d1 Merge branch 'cw/agent-details' into cw-merge-1772802959182 2026-03-06 14:15:59 +01:00
Lukas May
6f38ae21ed Merge branch 'main' into cw/agent-details-conflict-1772802863659
# Conflicts:
#	docs/server-api.md
2026-03-06 14:15:30 +01:00
Lukas May
30b27f8b4a fix: Conflict agent auto-dismiss fails on page load/remount
prevStateRef was initialized with current state, so when the page loaded
with an already-idle conflict agent, the transition guard was immediately
false and dismiss() never fired. Initialize with null instead.
2026-03-06 14:13:42 +01:00
Lukas May
a94e72ccbc feat: Wire AddAccountDialog and UpdateCredentialsDialog into health page and AccountCard
- health.tsx: Add Account button + AddAccountDialog, Refresh button with
  tooltip and spinner calling refreshAccounts mutation, inline account
  error state instead of full-page error, updated empty state text, and
  active-agent warning on delete confirm
- AccountCard.tsx: Show KeyRound button when credentials/token invalid,
  opens UpdateCredentialsDialog pre-populated with account identity

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 13:35:14 +01:00
Lukas May
1629285778 Merge branch 'refs/heads/main' into cw/agent-details-conflict-1772799979862
# Conflicts:
#	apps/server/drizzle/meta/_journal.json
2026-03-06 13:34:28 +01:00
Lukas May
e3246baf51 feat: Show resolving_conflict activity state on initiative cards
Add 'resolving_conflict' to InitiativeActivityState and detect active
conflict agents (name starts with conflict-) in deriveInitiativeActivity.
Conflict resolution takes priority over pending_review since the agent
is actively working.

- Add resolving_conflict to shared types and activity derivation
- Include conflict agents in listInitiatives agent filter (name + mode)
- Map resolving_conflict to urgent variant with pulse in InitiativeCard
- Add merge: prefix to INITIATIVE_LIST_RULES for merge event routing
- Add spawnConflictResolutionAgent to INVALIDATION_MAP
- Add getActiveConflictAgent to detail page agent: SSE invalidation
2026-03-06 13:32:37 +01:00
Lukas May
b4baba67a5 Merge branch 'cw/account-ui-phase-updatecredentialsdialog-component' into cw-merge-1772800279801 2026-03-06 13:31:20 +01:00
Lukas May
05efa9c08e fix: Replace getTaskAgent polling with event-driven invalidation
Add getTaskAgent to the agent: prefix SSE invalidation rule so spawned
agents are picked up immediately instead of polling every 5s.
2026-03-06 13:30:18 +01:00
Lukas May
575ad48a55 feat: Add UpdateCredentialsDialog component for re-authenticating accounts
Implements a self-contained dialog that allows users to update credentials
for an existing account without deleting and re-adding it. Supports two
modes: token-based (Tab A) and credentials JSON (Tab B).

Also sets up web component test infrastructure: vitest now includes
apps/web/**/*.test.tsx files with happy-dom environment, @vitejs/plugin-react
for JSX, and @testing-library/{react,jest-dom,user-event} packages.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 13:27:13 +01:00
Lukas May
ebef093d3f fix: Add missing event routing for initiative status real-time refresh
7 of 12 initiative activity state transitions were broken due to missing
event routing at three layers: SSE event arrays, live-update prefix rules,
and mutation invalidation map.

- Add initiative:changes_requested to ALL_EVENT_TYPES and TASK_EVENT_TYPES
- Add initiative:/agent: prefix rules to initiatives list and detail pages
- Add approveInitiativeReview, requestInitiativeChanges, requestPhaseChanges
  to INVALIDATION_MAP; add listInitiatives to approvePhase
- Extract INITIATIVE_LIST_RULES constant for reuse
2026-03-06 13:25:31 +01:00
Lukas May
7088c511a9 feat: Add Details tab to agent right-panel with metadata, input files, and prompt sections
Adds an Output/Details tab bar to the agents page right-panel. The Details
tab renders AgentDetailsPanel, which surfaces agent metadata (status, mode,
provider, initiative link, task name, exit code), input files with a
file-picker UI, and the effective prompt text — all streamed via the new
getAgent/getAgentInputFiles/getAgentPrompt tRPC procedures.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 13:21:59 +01:00
Lukas May
89282d33b3 feat: Add AddAccountDialog component for account management UI
Two-tab dialog (setup token + credentials JSON) with full validation,
error handling, provider select with fallback, and state reset on open.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 13:21:55 +01:00
Lukas May
d52317ac5d feat: Add timestamps to agent logs and fix horizontal scroll
- getAgentOutput now returns timestamped chunks ({ content, createdAt }[])
  instead of a flat string, preserving DB chunk timestamps
- parseAgentOutput accepts TimestampedChunk[] and propagates timestamps
  to each ParsedMessage
- AgentOutputViewer displays HH:MM:SS timestamps on text, tool_call,
  system, and session_end messages
- Live subscription chunks get client-side Date.now() timestamps
- Fix horizontal scroll: overflow-x-hidden + break-words on content areas
- AgentLogsTab polls getTaskAgent every 5s until an agent is found,
  then stops polling for live subscription to take over
- Fix slide-over layout: details tab scrolls independently, logs tab
  fills remaining flex space for proper AgentOutputViewer sizing
2026-03-06 13:18:42 +01:00
Lukas May
3f3954672e feat: Add Agent Logs tab to task slide-over
Add getTaskAgent tRPC procedure to find the most recent agent for a task.
TaskSlideOver now has Details/Agent Logs tabs — logs tab renders
AgentOutputViewer when an agent exists, or an empty state otherwise.
2026-03-06 13:10:46 +01:00
Lukas May
deffdc7c4f fix: Move project pills inline after initiative name 2026-03-06 13:07:25 +01:00
Lukas May
b6218584ee feat: Show project pills on initiative cards in list view
Add projects to the listInitiatives tRPC response and render them as
outline badge pills between the initiative name and activity row.
2026-03-06 13:06:33 +01:00
Lukas May
243f24a397 fix: Eliminate content page flickering from layout shifts and double invalidation
- Reserve fixed height for "Saving..." indicator instead of conditionally
  rendering it, preventing layout shift on every auto-save cycle
- Remove getPage from updatePage mutation cache invalidation — useAutoSave
  already handles optimistic updates, and SSE events cover external changes.
  This eliminates double-invalidation (mutation + SSE) refetch storms.
- Memoize TiptapEditor extensions array to avoid recreating extensions and
  pageLinkDeletionDetector on every render
- Memoize useLiveUpdates rules array in initiative detail page
2026-03-06 12:46:39 +01:00
Lukas May
08c1bed465 Merge branch 'cw/unified-event-flow' into cw-merge-1772797070237 2026-03-06 12:37:50 +01:00
Lukas May
a69527b7d6 fix: Remove upward box-shadow on ReviewHeader that covers tab bar
The sticky ReviewHeader had shadow-[0_-50px_0_0_hsl(var(--background))]
which painted a 50px background-color rectangle upward, overlapping the
tab navigation bar (only ~12px away). The header's bg-card is already
opaque, making the shadow unnecessary for scroll coverage.
2026-03-06 12:18:31 +01:00
Lukas May
6034f6d854 Merge branch 'main' into cw/unified-event-flow-conflict-1772795597661
# Conflicts:
#	apps/web/src/components/review/ReviewTab.tsx
#	apps/web/src/routes/initiatives/$id.tsx
2026-03-06 12:16:07 +01:00
Lukas May
9f5715558e fix: Auto-dismiss conflict panel and re-check mergeability on completion
Instead of showing a manual "Re-check Mergeability" button after the
conflict agent finishes, auto-dismiss the agent and trigger mergeability
re-check immediately when the state transitions to completed.
2026-03-06 12:14:16 +01:00
Lukas May
1e723611e7 feat: Allow editing review comments
Add update method to ReviewCommentRepository, updateReviewComment tRPC
procedure, and inline edit UI in CommentThread. Edit button appears on
user-authored comments (not agent comments) when unresolved. Uses the
existing CommentForm with a new initialValue prop.
2026-03-06 11:58:08 +01:00
Lukas May
49970eb1d7 fix: Use overflow-clip instead of overflow-hidden on FileCard
overflow-hidden creates a scroll container that breaks sticky positioning
for file headers. overflow-clip provides the same visual clipping for
rounded corners without affecting the scroll/sticky context.
2026-03-06 11:44:45 +01:00
Lukas May
0c04a1d273 fix: Prevent conflict resolution agent from destroying initiative branch
spawnConflictResolutionAgent was passing the initiative branch as branchName,
causing SimpleGitWorktreeManager.create() to force-reset it to the target
branch. Now spawns on a unique temp branch based off the initiative branch,
with the agent using git update-ref to advance the initiative branch after
resolving conflicts. Also fixes stale diff/commits cache after resolution.
2026-03-06 11:40:22 +01:00
Lukas May
f428ec027e fix: Sticky file headers sit below review header using CSS variable
Sets --review-header-h on the card wrapper from measured header height.
FileCard reads it for sticky top offset so file headers dock just below
the review header instead of overlapping it.
2026-03-06 11:36:28 +01:00
Lukas May
c87aac44cc fix: Cover transparent gap above sticky header with upward box-shadow
Uses a 50px upward box-shadow in bg-background color to paint over the
main padding gap that shows above the stuck review header.
2026-03-06 11:33:31 +01:00
Lukas May
5b497b84a0 fix: Restore sticky header and sidebar by simplifying layout
Removed wrapper divs that broke sticky positioning. ReviewHeader now
accepts a ref prop directly, with sticky top-0 on its own root element.
Card wrapper restored as the tall containing block so both header and
sidebar have room to stick within it.
2026-03-06 11:26:43 +01:00
Lukas May
4664644cda fix: Use pseudo-element to cover all transparent space above sticky header
Replaces negative margin hack with a ::before that extends upward from
the sticky header to paint bg-background over the main padding gap.
2026-03-06 11:22:30 +01:00
Lukas May
19cd0a2cb0 fix: Cover transparent gap above sticky review header
Use negative margin to pull sticky header into the parent space-y-3 gap,
with matching padding and bg-background to paint over it when stuck.
2026-03-06 11:21:08 +01:00
Lukas May
01f2279735 fix: Eliminate whitespace above sticky review header
Moved card border/rounding onto the sticky header wrapper itself so it
scrolls flush to top-0 with no gap. The body grid gets its own border-x
and border-b to preserve the card appearance. ResizeObserver now measures
border-box size for accurate sidebar offset.
2026-03-06 11:17:29 +01:00
Lukas May
6cf6bd076f feat: Add merge conflict detection and agent resolution in initiative review
Pre-merge mergeability check via `git merge-tree --write-tree` (dry-run, no
side effects). When conflicts exist the "Merge & Push" button is disabled and
a ConflictResolutionPanel shows conflict files with options to resolve manually
or spawn a conflict-resolution agent. Agent questions appear inline via
QuestionForm; on completion the mergeability re-checks automatically.

New server-side: MergeabilityResult type, BranchManager.checkMergeability,
conflict-resolution prompt, checkInitiativeMergeability query,
spawnConflictResolutionAgent mutation, getActiveConflictAgent query.

New frontend: useConflictAgent hook, ConflictResolutionPanel component,
mergeability badge + panel integration in InitiativeReview.
2026-03-06 11:17:25 +01:00
Lukas May
3a01b9e9ca fix: Restore sticky positioning on header wrapper div 2026-03-06 11:15:25 +01:00