Compare commits

...
101 Commits
Author SHA1 Message Date
mika kuns 5c3ec4810e Merge origin/main (v2.1.0 changelog)
Changelog / changelog (push) Successful in 1s
Release / release (push) Successful in 38s
2026-07-24 13:25:42 +02:00
mika kuns 49222a92a4 Merge claudedo/5d627df8 — #12 planning permission-mode default 2026-07-24 13:20:19 +02:00
mika kuns 109a35c505 feat(review): submit interactive (ConPTY) work for review
An embedded ConPTY session leaves its worktree changed but never touches
task status, so hand-driven work had no path into the review/merge flow.

Add SubmitTaskForReview: commit the worktree (same auto-commit as a headless
run), then transition Idle/Failed -> WaitingForReview via the new
TaskStateService.SubmitInteractiveForReviewAsync. Approve then merges it.

Surfaces: a 'Submit for review' button in the detail work console (shown for
an Idle/Failed task with a worktree) and on the ConPTY Command Center pane
header (task-based panes; closes the pane on success). Tests cover the new
transition (Idle/Failed accepted, Running/Queued/Done/Review rejected).
2026-07-24 13:05:22 +02:00
mika kuns 34b17537fc Merge claudedo/f9809a93 — Approve & Merge diff gate 2026-07-24 12:53:07 +02:00
mika kuns 2aaaa23912 feat(review): gate Approve & Merge behind opening the diff
Approve & Merge is disabled until the pending changes have been inspected:
DetailsIslandViewModel tracks ReviewDiffViewed (reset on task switch and on
every state change), MergeSectionViewModel raises DiffViewed when a diff or
combined diff is opened and exposes HasReviewableDiff, and a hint sits next
to the button. A review with nothing to inspect (sandbox run, no worktree)
approves straight through.

ClaudeDo-Task: f9809a93
2026-07-24 12:52:57 +02:00
mika kuns 624ec7a668 fix(planning): use default permission mode so MCP planning tools don't prompt
Interactive planning sessions launched with --permission-mode plan, which
gates EVERY MCP tool call regardless of --allowedTools (verified: even a
read-only mcp__claudedo__list_task_lists is denied under plan mode). So the
session prompted the user on the first CreateChildTask -- the whole point of
a planning session.

Switch BuildPlanningStartArgs/BuildPlanningResumeArgs to --permission-mode
default, which honours the allowlist. File edits stay blocked via the planning
system prompt + AllowedTools omitting Write/Edit/Bash. Resume also re-passes
--allowedTools, since the CLI does not restore it across --resume.

The earlier 'glob does not match' hypothesis was empirically falsified:
mcp__claudedo__*, the bare server name, and the explicit tool name all allow
the tool with zero permission_denials in default mode.
2026-07-24 12:38:45 +02:00
mika kuns 3e9ea3ad58 Merge claudedo/c14606f009e44e4ba04bfe5bcbc884ad 2026-07-24 12:13:18 +02:00
mika kuns ef285b21fd feat(planning): run interactive planning sessions via embedded ConPTY
Planning start/resume opened an external Windows Terminal (wt) window.
Route them through the embedded ConPTY Command Center pane instead, matching
the existing interactive-session UX (no external window).

- Extract bare planning arg builders (BuildPlanningStartArgs/ResumeArgs) from
  WindowsTerminalLauncher; the wt path still uses them (kept, not removed).
- InteractiveLaunchSpecService.BuildPlanningStart/Resume map a planning
  context into a LaunchSpec (planning args + env: MAX_THINKING_TOKENS,
  CLAUDEDO_PLANNING_TOKEN). Hub GetPlanningStart/ResumeLaunchSpec run
  StartAsync/ResumeAsync then return the spec.
- UI: OpenPlanningSession + the resume branch raise OpenPlanningConPtyRequested;
  the shell opens Mission Control and hosts a planning ConPTY pane.

Env is process-global by design (sequential human-paced sessions). wt planning
code retained. Tests added for the arg/env mapping.
2026-07-24 12:12:23 +02:00
mika kuns 2612831a5e docs(planning): spec for ConPTY planning sessions 2026-07-24 12:12:22 +02:00
mika kuns 5e27486b18 chore(claude-do): Update notif popup is still not in the bottom Right hand cor
THe update notification should be in the Bottom Rught hand corner as a Small Popup card. IT should have the Update and Dismiss Butotns. It should only show when there is a new Update available, not if everything is up to date

ClaudeDo-Task: c14606f009e44e4ba04bfe5bcbc884ad
2026-07-24 11:55:29 +02:00
mika kuns 04044bd115 docs(fix-plan): record session progress (A/B done, C#9+#11, D#13+#14; C#10/#12 + group E deferred) 2026-07-24 11:44:21 +02:00
mika kuns 798d100636 feat(ui): AskUser question banner in the detail island
The inline answer banner for a running task's AskUser question only existed
in Mission Control. Surface the same banner in the detail pane, bound to the
detail island's existing TaskMonitorViewModel (shared state — no new state,
no duplication) so a question can be answered without opening Mission
Control. Mirrors MC: live TaskQuestionAsked events for the selected task.
2026-07-24 11:41:12 +02:00
mika kuns e8f7e3a47a fix(ui): hide misleading Idle chip on planning parents
A planning parent stays Status=Idle while its session is Active (or
Finalized-but-not-queued), so the lifecycle chip read "Idle"/"Parked"
next to the PLANNING/PLANNED badge. Hide the chip in that case; the badge
already conveys the state.
2026-07-24 11:38:49 +02:00
mika kuns 8a7275a75f fix: show structured-output summary instead of raw JSON in OUTCOME
A --json-schema run can echo the structured {"summary":...} JSON as the
result text, which then landed verbatim in task.Result and rendered raw in
the OUTCOME card. Unwrap the summary in StreamAnalyzer when the result text
is itself such a JSON object (a plain markdown result is kept as-is), and
add a UI safety net in ApplyOutcome for rows already persisted as raw JSON.
2026-07-24 11:36:25 +02:00
mika kuns f4dd67d595 fix(ui): live-refresh child rows on parent planning transitions
Finalize/Discard broadcast only the parent's TaskUpdated; the delta path
updated the parent row but never recomputed child-derived flags or dropped
discarded children, so subtasks stayed "Draft" after finalize and deleted
rows lingered after discard until a manual reload. Reconcile the whole
list when the updated task is (or owns) a planning subtree.
2026-07-24 11:26:19 +02:00
mika kuns 0226c98076 fix(ui): restore turn/token counts on task reload
Turns/Tokens were never populated from history, so a reloaded terminal
task showed "0/max". Restore them from the latest task_run.
2026-07-24 11:21:21 +02:00
mika kuns b9b3053051 fix(ui): clearer rename display in diff viewer
Show renames as old → new in the file header and suppress the misleading
"+0 −0" stats for a pure rename (the R badge already conveys it).
2026-07-24 11:21:20 +02:00
mika kuns 671c886c75 fix(ui): diagnostic error surfacing on attachment drop
Opening the dropped IStorageFile stream ran outside the try, so a
first-drop failure escaped the async-void handler as an unobserved fault
(generic "An error occurred"). Wrap the stream-open loop and surface the
exception type via DropStatus; include the exception type in the generic
add-file failure too, so the intermittent case is analyzable.
2026-07-24 11:18:06 +02:00
mika kuns ffff1ee183 fix(ui): surface resume-planning-session failures
ResumePlanningSessionAsync wrapped everything in an empty catch, so a
failed resume vanished silently. Report it via the footer error channel
with a dedicated planningResumeFailed message.
2026-07-24 11:17:57 +02:00
mika kuns da6a70aec1 feat(ui): conflict resolver shows why Continue is disabled
Continue was already gated on CanContinue (all files resolved); surface a
footer hint counting the still-unresolved conflicts/files so the disabled
state is explained, not just for binary files.
2026-07-24 11:14:06 +02:00
mika kuns 85d0f9dcec feat(ui): session-skills empty-state + neutral subtask terminology
Show an explanatory empty-state under the install row when no skills are
installed. Rename the unified-parent status/labels from "Improvements" to
neutral "Subtasks" (waitingForChildren, agentStatus.children,
childOutcomesLabel) since WaitingForChildren now covers planning too.
2026-07-24 11:14:01 +02:00
mika kuns ad2acddc9a fix(ui): render Plus and agent-settings gear icons
Icon.Plus was stroke-only geometry, invisible when used in a PathIcon
(fills). Author it as a filled cross, fixing every PathIcon use at once
(New-session, add-list, add-task). Replace the header bar's raw gear
TextBlock with the shared Icon.Settings PathIcon for consistency.
2026-07-24 11:13:52 +02:00
mika kuns efd7cc9b0a docs(verification): add fix-plan for fresh session (findings grouped by fixability); defer §10, mark §11 OK per Mika 2026-07-24 11:06:57 +02:00
mika kuns 75a6e0efc4 docs(verification): §3 UnfinishedPlanning modal (Finalize/Discard PASS, Resume BUG); generalize child-row live-refresh finding; edges done 2026-07-24 11:00:56 +02:00
mika kuns 9efc5c90f4 docs(verification): finding — Resume planning session is broken (session_id never captured) + error swallowed by empty catch 2026-07-24 10:58:37 +02:00
mika kuns 6ca8cac79f docs(verification): §1 DiffModal error-state resolved via code analysis (defensive/unreachable, gates prevent it) 2026-07-24 10:34:05 +02:00
mika kuns 9a1fa3dbaf docs(verification): §4 merge-editor Abort PASS (tree clean, task stays WaitingForReview) 2026-07-24 10:32:12 +02:00
mika kuns 9b4d3431b0 docs(verification): §9 attachments drag&drop UI PASS (overlay/drop/picker/remove); finding — intermittent first-drop error 2026-07-24 10:26:42 +02:00
mika kuns a1ba3b6ebb docs(verification): §8 Session Skills complete (Remove PASS); refresh handoff summary + fixture state 2026-07-24 10:15:45 +02:00
mika kuns 9b041ba791 docs(verification): §8 per-task activation + no-leak counterprobe PASS; UI partial (cards/general-tab open) 2026-07-24 10:12:39 +02:00
mika kuns 39fc594b98 docs(verification): finding — agent-settings gear uses Unicode glyph, not Icon.Settings PathIcon (inconsistent) 2026-07-24 10:10:15 +02:00
mika kuns b353ed6cfd docs(verification): §8 skill install PASS (6 skills, commit-pinned); finding — Skills tab has no empty-state 2026-07-24 10:06:31 +02:00
mika kuns 416e47ecef docs(verification): note Mika explicitly wants AskUser interaction in detail island 2026-07-24 10:04:06 +02:00
mika kuns e8b5e97a9b docs(verification): §7 AskUser complete — timeout UI-cleanup visually verified (banner clears) 2026-07-24 10:01:56 +02:00
mika kuns d19ef5403f docs(verification): §7 AskUser PASS (happy-path + backend timeout); finding — banner only in Mission Control, absent in detail island 2026-07-24 09:54:07 +02:00
mika kuns ded068c564 docs(verification): note fixture cleanup (verif tasks/worktrees removed, ClaudeDoTests reset) 2026-07-24 09:37:00 +02:00
mika kuns 9556e0e848 docs(verification): refresh handoff for next session — progress, remaining (§7-§11+edges), gotchas, fixture state 2026-07-24 09:33:53 +02:00
mika kuns 9d39a8fc69 docs(open): trim to actively-verified 2026-07-24 findings; drop stale manual-verif/historical blocks 2026-07-24 09:30:56 +02:00
mika kuns b536b6fb66 docs(verification): §5 ConPTY/Mission Control PASS (prompt-send, close kills proc); ad-hoc icon invisible + re-open re-sends noted 2026-07-24 09:27:22 +02:00
mika kuns 1b80bb0a2d docs(open): §5 findings — invisible New-session icon (Icon.Plus stroke-only), re-open re-sends prompt 2026-07-24 09:24:15 +02:00
mika kuns 4394623bb0 docs(verification): §3 PASS end-to-end (+§1 children-band, +§4 planning-conflict); dequeue-X UX nit 2026-07-24 09:18:10 +02:00
mika kuns f0b0582517 docs(open): §3 finalize findings — improvements-mislabel, child-badge live-refresh, chain not visualized 2026-07-24 09:10:44 +02:00
mika kuns 07de897147 docs(open): planning session permission-prompt bug + planning-active parent shows Idle (UX) 2026-07-24 09:06:03 +02:00
mika kuns 21012283a9 docs(verification): clean additive approve PASS 2026-07-24 08:56:57 +02:00
mika kuns 8241bf8d41 docs(verification): §1 commit-range-after-merge PASS; blocked-merge silent-fail confirmed on clean path too 2026-07-24 08:52:12 +02:00
mika kuns 255705d8bf docs(verification): §4 merge editor PASS end-to-end + UX findings (continue-btn, multi-file, blocked-merge) 2026-07-24 08:48:03 +02:00
mika kuns 3dfd75fba8 docs(open): Approve & Merge silently swallows a blocked merge (no footer error) 2026-07-24 08:43:37 +02:00
mika kuns 26c03a5a5f docs(verification): §1 findings — raw-JSON outcome bug, rename/turns nits, session-tab expected 2026-07-24 08:26:33 +02:00
mika kuns 3211bfc0f9 docs: correct permission finding — auto+haiku denies writes (not a CLI regression), §2 happy-path PASS 2026-07-24 08:08:15 +02:00
mika kuns 79ce7afe46 docs(verification): log autonomous-batch results (§2/§6/§9/§12) 2026-07-24 07:54:20 +02:00
mika kuns 0ad93f48b5 docs(open): track CLI 2.1.207 --permission-mode auto write-denial regression 2026-07-24 07:50:44 +02:00
mika kuns fee69998f8 fix(worker): kill cancelled runs' processes and make MCP approve actually merge
- CancelAsync now signals the running Claude process of the cancelled task and
  its cascaded children via the new RunCancellationRegistry (queue + override
  slots register their CTS there) instead of only flipping DB state.
- external MCP review_task 'approve' now mirrors the hub's ApproveReview:
  unit merge for parents, ApproveAndMergeAsync for childless tasks, optional
  targetBranch; ReviewTaskResult carries mergeStatus/conflicts.
2026-07-23 20:24:36 +02:00
mika kuns 451afc80f8 Merge task branch for: fix(worker): external MCP optional params are generated as required; errors are opaque 2026-07-23 20:08:26 +02:00
mika kuns 4b2667062f Merge task branch for: chore: remove dead GitService.MergeFfOnlyAsync, move AgentMcpTools to its own file, fix stale Zitadel doc note 2026-07-23 20:08:15 +02:00
mika kuns 305eb6ee8b fix(ui): UnifiedDiffParser handles paths with spaces and git-quoted paths
# Conflicts:
#	docs/open.md
2026-07-23 20:07:53 +02:00
mika kuns 15bef2a2e3 fix(git): merge preflights ignore untracked files (HasChangesAsync includeUntracked)
# Conflicts:
#	docs/open.md
2026-07-23 20:07:33 +02:00
mika kuns d7ebafd556 fix(worker): make external MCP filter params optional, surface tool errors
Nullable filter/patch params across the External/ MCP tool classes (ListTasks,
UpdateTask, AddSubtask, ReviewTask, SetMyDay, SetListConfig/SetTaskConfig,
CreateList/UpdateList) lacked C# default values, so the generated tool schema
marked them required — MCP clients omitting them (the common case) failed.
Gave every such parameter a default value.

Also registered a call-tool filter (ExternalMcpExceptionFilter) on the external
MCP host that translates InvalidOperationException/ArgumentException into
McpException, since the SDK's own catch-all discards ex.Message for any other
exception type and returns a generic "An error occurred invoking 'X'." string.

Added a reflection-based schema test sweeping every [McpServerToolType] class
to guard against reintroducing a required-but-nullable parameter.
2026-07-23 18:21:46 +02:00
mika kuns 14e4c086e2 fix(data): merge preflights ignore untracked files in target working tree
HasChangesAsync counted untracked files, so a stray file in the shared
target working dir (e.g. left by a concurrent session) blocked merge
preflights even though nothing tracked changed. Add an includeUntracked
overload defaulting to true, and pass includeUntracked: false only from
the two target-working-tree merge preflights (TaskMergeService.MergeAsync,
PlanningMergeOrchestrator.StartAsync). Auto-commit and the worktree
cleanup data-loss guard keep counting untracked files, since those
callers need to know about them.
2026-07-23 18:14:46 +02:00
mika kuns 0f2d202b01 fix(ui): UnifiedDiffParser mishandles paths with spaces and git-quoted paths
diff --git headers pack two paths on one space-delimited line, which broke
for unquoted paths containing spaces and for git's C-style octal-quoted
paths (non-ASCII filenames). Add quote-aware header splitting plus a git
unquote helper, and prefer the unambiguous "--- a/"/"+++ b/" lines to
correct the file's identity when present.
2026-07-23 18:11:52 +02:00
mika kuns 2a4633fdd8 chore: remove dead MergeFfOnlyAsync, split AgentMcpTools into its own file, fix stale Zitadel doc
- GitService.MergeFfOnlyAsync had no callers anywhere in code; removed.
- AgentMcpTools moved out of LifecycleMcpTools.cs into External/AgentMcpTools.cs (no behavior change).
- Worker CLAUDE.md described ZitadelAuthProvider as a Phase 2 stub; it's fully implemented (OIDC discovery + refresh-token flow), updated both mentions.
2026-07-23 18:07:48 +02:00
mika kuns 3d668da65c docs(open): remove chain-cascade bug bullet (fixed in 110364a) 2026-07-23 18:03:15 +02:00
mika kuns f18e03354a fix(merge): validate conflict resolution before staging in ContinueMergeAsync
# Conflicts:
#	docs/open.md
2026-07-23 18:01:49 +02:00
mika kuns a1986dd485 Merge task branch for: fix(worker): deleting the last non-terminal child leaves the parent stuck in WaitingForChildren 2026-07-23 18:00:48 +02:00
mika kuns 110364aa6c Merge task branch for: fix(worker): planning-chain cascade stalls at an Idle middle link 2026-07-23 18:00:40 +02:00
mika kuns 0b86ccd74b Merge task branch for: fix(worker): cascade cancel of a WaitingForChildren parent to its non-terminal children 2026-07-23 18:00:34 +02:00
mika kuns d6891b8bd4 docs: explore-notes convention + verification handoff for manual checks 2026-07-23 17:58:48 +02:00
mika kuns 377409e633 fix(worker): validate conflict markers before staging in ContinueMergeAsync
git add -A resolves the index U-stage regardless of file content, so a
conflicted file whose markers were never removed still got staged and
committed as-is. Check previously-conflicted files for leftover
<<<<<<< markers before staging; refuse with a conflict result if any
remain, leaving the repo mid-merge so Abort still cleans up.

Adds a regression test that leaves one conflict unresolved and asserts
ContinueMergeAsync refuses (no commit) and AbortMergeAsync still
restores a clean tree.
2026-07-23 17:16:46 +02:00
mika kuns 941c8b98cc fix(worker): cascade cancel of a WaitingForChildren parent to its non-terminal children
Confirmed via docs/open.md (Korrektheits-Review 2026-06-09): TaskStateService.CancelAsync
only flipped the target row to Cancelled - a Queued/Running child kept going and could
still commit into its worktree after the parent was gone.

CancelAsync now also cancels the task's own non-terminal children (Idle/Queued/Running/
WaitingForReview/WaitingForChildren) in the same pass, clearing BlockedByTaskId so no
successor is left wedged, and broadcasts TaskUpdated for each.
2026-07-23 17:14:33 +02:00
mika kuns 2452e39345 fix(worker): advance parent when the last non-terminal child is deleted
DeleteTask never re-evaluated a WaitingForChildren parent, so deleting
the last non-terminal child left it stuck (the BlockedByTaskId SET NULL
FK only repairs the blocked chain, not parent status). Expose
TaskStateService.TryAdvanceParentAsync on the interface and call it
from ExternalMcpService.DeleteTask after a child delete.
2026-07-23 17:13:11 +02:00
mika kuns 816f247d90 fix(worker): keep planning-chain cascade moving past an Idle middle link
OnChildFinishedAsync ignored CancelAsync's result. If a chain successor
sat in a non-cancellable state (e.g. parked to Idle out of band) when
its predecessor failed/was cancelled, CancelAsync was a silent no-op and
the cascade stopped there, leaving the rest of the chain Queued+blocked
forever. Now it walks past any link CancelAsync can't touch and keeps
cancelling downstream.
2026-07-23 17:09:55 +02:00
ClaudeDo CI ad58129194 docs(changelog): update for v2.1.0 2026-07-23 14:47:45 +00:00
mika kuns 85c7e650c9 docs(interactive): update ConPTY spec + open items to final state
Changelog / changelog (push) Successful in 2s
Release / release (push) Successful in 41s
Correct the spec's binding approach (library LaunchProcess, not the abandoned
custom-pty bypass), add the monospace-font sizing gotcha, on-demand worktree +
prompt seeding, and the deferred Avalonia 12.1 upgrade. Add a ConPTY manual-
verification entry to open.md.
2026-07-23 16:47:16 +02:00
mika kuns c412a84fdf refactor(interactive): remove streaming interactive stack (superseded by ConPTY)
The embedded ConPTY terminal replaced the in-app streaming interactive session, so
delete the dead stack: StreamingClaudeSession, InteractiveSessionService,
ProcessClaudeStreamTransport, IClaudeStreamTransport, ILiveSession, LiveSessionRegistry,
IdleSessionReaper (+ WorkerConfig.InteractiveIdleTimeoutMinutes), the WorkerHub
interactive methods + HubBroadcaster events, IWorkerClient interactive members, the
TaskMonitorViewModel composer + SessionTerminalView composer markup, and the old
'Run interactively' entry. AskUser/PendingQuestionRegistry, the autonomous path,
planning, ResumeTaskInTerminal, and all ConPTY code are kept. Localization pruned.
2026-07-23 16:47:16 +02:00
mika kuns d8194ad57e feat(interactive): seed fresh task session with the task prompt
A fresh (non-resume) task-based ConPTY session now opens claude on the task's
prompt (title + description) as the positional argument, so the session starts on
the task instead of an empty prompt. Resume sessions and ad-hoc sessions are
unchanged.
2026-07-23 16:47:16 +02:00
mika kuns d9a4627a1f fix(interactive): set monospace font + stretch on ConPTY terminal
The control derives Cols/Rows from arranged-size / character-cell-size; without an
explicit monospace font (as the working spike set) the cell metrics are off and the
terminal miscomputes its size, so the child TUI renders into the wrong area. Match
the spike's font/BufferSize and stretch to fill the pane.
2026-07-23 16:47:15 +02:00
mika kuns 2b06ab0ab4 fix(interactive): use library LaunchProcess instead of custom pty bypass
The custom Porta.Pty bypass (own read loop, key tunneling, resize sync) rendered
wrong, lagged, and dropped input. The spike proved TerminalControl.LaunchProcess()
renders correctly and stays responsive, so hand pty/input/render/resize/focus back
to the library. PtyTerminalSession shrinks to a thin wrapper: apply descriptor.Env
process-wide (Porta.Pty inherits the process env; no per-launch env seam), set
Process/Args/StartingDirectory, LaunchProcess(). Process="" still suppresses the
control's auto-launch so exactly one process starts.
2026-07-23 16:47:15 +02:00
mika kuns bb62740ac8 fix(interactive): correct ConPTY terminal size + reduce lag
Sizing: the pty was spawned at the stale 80x24 default because terminal.Cols/Rows
were read before any layout pass; and a resize during the spawn await was missed.
Force UpdateLayout() before reading the size, subscribe Resized before spawn,
resync once after, and add a LayoutUpdated-driven resync (deduped) as a safety net.
Lag: the read loop awaited a UI-thread dispatch per chunk, serializing pipe reads
behind rendering; switch to Dispatcher.Post (FIFO preserved, no backpressure).
2026-07-23 16:47:15 +02:00
mika kuns 25922a2768 fix(interactive): forward keyboard input to ConPTY terminal
TerminalView's OnKeyDown/OnTextInput early-return when its private pty connection
is null -- which it always is, since we bypass LaunchProcess() to inject a custom
env -- so keystrokes were silently dropped, and Terminal.DataReceived only carries
terminal auto-replies, never user input. Tunnel KeyDown/TextInput on the control,
translate via the terminal's public GenerateKeyInput/GenerateCharInput, and write
to our own IPtyConnection. Focus the control on start (LaunchProcess would have).
2026-07-23 16:47:15 +02:00
mika kuns 3feb08d9d9 feat(interactive): New session button for ad-hoc ConPTY sessions
Adds a 'New session' header button in Mission Control that opens a folder picker
and starts a task-less embedded ConPTY session in the chosen directory. ConPtyPaneViewModel
TaskId is now nullable (ad-hoc panes have no task and are never deduped) with a
CreateAdHoc factory; the view does the picking, the VM stays picker-agnostic.
2026-07-23 16:47:15 +02:00
mika kuns 9ab48d7094 feat(interactive): fresh-worktree-on-demand + ad-hoc launch specs
BuildForTaskAsync now creates a worktree on demand (via WorktreeManager.CreateAsync,
the same path TaskRunner uses) when a task has a configured working dir but no
Active/Kept worktree, returning a fresh-start spec -- so never-run tasks can be
opened interactively. Adds BuildForDirectoryAsync + GetAdHocLaunchSpec hub/client
for ad-hoc sessions in an arbitrary directory (no task, no worktree, no skill seeding).
2026-07-23 16:47:15 +02:00
mika kuns 0513265c49 feat(interactive): host task-based ConPTY sessions in Command Center
Adds an 'Open ConPTY session' entry that fetches a task's launch spec and hosts
an embedded ConPTY terminal as a Mission Control pane, coexisting with the
streamed-log monitor panes (streaming stack untouched). Introduces IMissionControlPane
+ ConPtyPaneViewModel, a non-destructive Panes mirror (Monitors prefix + ConPtySessions
suffix) so unrelated monitor churn never tears down a live terminal, and a grid<->tabs
layout toggle. Launch failures surface via the footer error strip.
2026-07-23 16:47:15 +02:00
mika kuns d28c63d2df docs(interactive): record ConPTY library + binding decision from spike 2026-07-23 16:47:15 +02:00
mika kuns 5f740c05d8 feat(interactive): embedded ConPTY terminal host in UI
Adds a self-contained terminal host: PtyTerminalSession drives a Porta.Pty child
directly (custom env) and pumps it through Iciclecreek's XTerm.NET renderer via
TerminalControl.Terminal, bypassing LaunchProcess() so a fully-populated
environment can be passed. InteractiveTerminalView/ViewModel host it with an
order-independent attach/start. Adds Iciclecreek.Avalonia.Terminal 2.0.3.
Sets Process="" to suppress the control's auto-launch of a stray shell.
2026-07-23 16:47:15 +02:00
mika kuns 1245e75902 feat(interactive): worker launch-spec for embedded ConPTY sessions
Adds InteractiveLaunchSpecService + GetInteractiveLaunchSpec hub method that
prepares a task worktree (session-skills seeding, run env) and returns a
LaunchSpec {cwd,exe,args,env} for a UI-hosted ConPTY terminal. Reuses
ISessionSkillSeeder, TaskRunner.UnionSkillNames, and WindowsTerminalLauncher
resume-arg/resolve logic. Guards mirror ResumeTaskInTerminal; a never-run task
yields a fresh-start spec instead of an error.
2026-07-23 16:47:15 +02:00
mika kuns d91ad2d635 docs(interactive): ConPTY interactive sessions spec + plan 2026-07-23 16:47:15 +02:00
mika kuns 17235a6cde Fix empty error message 2026-07-23 16:47:15 +02:00
Mika Kuns f33838d028 docs(open): session skills verification items 2026-07-23 16:47:14 +02:00
Mika Kuns 1cfd96c15f test(ui): load Loc.Current in session-skills tab test to fix ordering flake 2026-07-23 16:47:14 +02:00
Mika Kuns 7c3c061428 feat(ui): session skills registry tab + per-level selectors 2026-07-23 16:47:14 +02:00
Mika Kuns b4c58087d2 feat(worker): session skills SignalR surface + per-level persistence 2026-07-23 16:47:14 +02:00
Mika Kuns 4626481359 feat(worker): resolve and seed session skills before each run 2026-07-23 16:47:14 +02:00
Mika Kuns dea2b7db8b feat(worker): session skill registry (install/update/remove, pinned clone) 2026-07-23 16:47:14 +02:00
Mika Kuns 54cdaf89d5 feat(data): session skills entity, repository, and migration 2026-07-23 16:47:14 +02:00
Mika Kuns dbaefe92c6 docs(skills): mark cwd-skill discovery verified in headless mode 2026-07-23 16:47:14 +02:00
Mika Kuns 62b245aaea docs(skills): revise for multi-skill plugin repos (ponytail) 2026-07-23 16:47:14 +02:00
Mika Kuns 4e5057d3f6 docs(skills): spec + plan for per-level session skills 2026-07-23 16:47:14 +02:00
Mika Kuns 1bf08eca27 docs(open): pick up a task's session in a terminal — verification 2026-07-23 16:47:14 +02:00
Mika Kuns eb88dc130c feat(ui): pick up a task's session in a terminal 2026-07-23 16:47:13 +02:00
Mika Kuns 140ae2fda1 feat(worker): resume a task's claude session in a terminal 2026-07-23 16:47:13 +02:00
Mika Kuns 865e12c0de fix(worker): seed planning brief via file to avoid newline truncation 2026-07-23 16:47:13 +02:00
ClaudeDo CI 914fa5aa9f docs(changelog): update for v2.0.0 2026-06-26 14:12:23 +00:00
165 changed files with 8086 additions and 2659 deletions
+125
View File
@@ -1,5 +1,130 @@
# Changelog # Changelog
## v2.1.0 — 2026-07-23
### Features
- seed fresh task session with the task prompt (d8194ad)
- New session button for ad-hoc ConPTY sessions (3feb08d)
- fresh-worktree-on-demand + ad-hoc launch specs (9ab48d7)
- host task-based ConPTY sessions in Command Center (0513265)
- embedded ConPTY terminal host in UI (5f740c0)
- worker launch-spec for embedded ConPTY sessions (1245e75)
- session skills registry tab + per-level selectors (7c3c061)
- session skills SignalR surface + per-level persistence (b4c5808)
- resolve and seed session skills before each run (4626481)
- session skill registry (install/update/remove, pinned clone) (dea2b7d)
- session skills entity, repository, and migration (54cdaf8)
- pick up a task's session in a terminal (eb88dc1)
- resume a task's claude session in a terminal (140ae2f)
### Fixes
- set monospace font + stretch on ConPTY terminal (d9a4627)
- use library LaunchProcess instead of custom pty bypass (2b06ab0)
- correct ConPTY terminal size + reduce lag (bb62740)
- forward keyboard input to ConPTY terminal (25922a2)
- seed planning brief via file to avoid newline truncation (865e12c)
### Refactoring
- remove streaming interactive stack (superseded by ConPTY) (c412a84)
### Documentation
- update ConPTY spec + open items to final state (85c7e65)
- record ConPTY library + binding decision from spike (d28c63d)
- ConPTY interactive sessions spec + plan (d91ad2d)
- session skills verification items (f33838d)
- mark cwd-skill discovery verified in headless mode (dbaefe9)
- revise for multi-skill plugin repos (ponytail) (62b245a)
- spec + plan for per-level session skills (4e5057d)
- pick up a task's session in a terminal — verification (1bf08ec)
- update for v2.0.0 (914fa5a)
## v2.0.0 — 2026-06-26
### Features
- remove a queued interactive message with a ✕ (afe7218)
- remove a queued interactive message (fd1e38f)
- show queued interactive messages above the composer (7c9ff18)
- broadcast interactive message queue + delivery (84034e8)
- highlight user chat messages + opt-in interrupt (stop) button (786eb28)
- queue interactive messages by default, interrupt opt-in (bdda98e)
- interactive chat composer in the session terminal + work console (1fe72a1)
- interactive chat composer state on the session monitor VM (140b8e1)
- worker client surface for in-app interactive sessions (9effdde)
- in-app interactive session service, replacing the wt terminal launch (30e87e6)
- persistent streaming Claude session + live session registry (d8a043f)
- answer a running task's question inline in Mission Control (917301d)
- AskUser MCP tool so a running task can ask the user mid-run (c7f8280)
- replace OLE task-row drag with custom ghost drag (bec26b2)
- ghost-window drag infrastructure for task rows (05aec8e)
- drag a task into Mission Control to queue it (3b629c2)
- read-only queue side strip in Mission Control (9eb54a0)
- batch MCP tools for the external endpoint (1c94fbd)
- open Settings from the Mission Control header (7f4dc8b)
- drag-reorder Mission Control panes by their header (f6ecfc9)
- mission control pane header actions + status tinting (e2fad88)
- mission control detach/redock toggle, clear review panes, reorder helper (fbcffce)
- detach a monitor into its own window (5f6e748)
- open Mission Control from the title bar (b1bd912)
- add MissionControl window + grid (283310a)
- add MonitorPaneView (15a3e65)
- reveal a task by id from anywhere (5a21d67)
- add MissionControlViewModel (42da840)
- extract TaskMonitorViewModel streaming core; DetailsIsland delegates (aa7a49f)
- collapse parent task rows by default with granular row sync (38defee)
- shell-style review prompt line in WorkConsole (0a119f1)
- Log Visualizer overlay reachable from a clickable footer log line (c4f74a7)
- route Serilog Warn/Error to footer + buffer recent logs for overlay (08a4f97)
- segmented Description/Steps/Files header (9301bbc)
- drag-and-drop file attachments on the detail pane (d8ff8cc)
- MCP tools to attach/list/remove task files (f7e946e)
- inject reference files into the run + clean up files on delete (6a0c0f5)
- data layer for task file attachments (3f9f047)
### Fixes
- reap idle interactive sessions so they don't pile up (711374e)
- kill spawned claude trees when the worker dies (faf6104)
- scroll revealed task into view + stronger selection highlight (f63be28)
- persist Online Inbox tab on settings save (66907d2)
- paint accent buttons with moss tokens instead of Fluent blue (178fd25)
- make worktree state chips readable with on-theme tints (df84fc3)
- keep interactive & planning prompts intact past Windows Terminal (ea16da2)
- honor runtime disable in sync loop to stop OIDC discovery (f86b785)
- surface interactive/planning launch errors in footer (134b9fb)
- render X remove icon as filled geometry (637886f)
- hide batch Merge All in the global overview (5231ad6)
### Refactoring
- split LogLineViewModel into its own file (7b6a8f0)
- single DiffViewer replaces DiffModal + WorktreeModal + PlanningDiff (167d2fe)
- single AgentConfigEditor for list + task scopes (eb0ddb5)
- drop self-update, publish stable-named ClaudeDo.Installer.exe (3cb4802)
- single IMergeCoordinator replaces the 5 conflict seams (5be4b5c)
- single IDialogService replaces scattered Show* dialog seams (d598a53)
- route UI quick-add through TaskRepository.AddAsync (1fb2e34)
- drop dead hunks conflict API (b3e099c)
### Documentation
- queued messages can be removed via ✕ (3eea2b7)
- queued messages show in a pending strip above the composer (e7fa373)
- interactive send=queue, interrupt opt-in via stop button (8e1732a)
- manual-verification items for in-app interactive sessions (9c292e5)
- spec + plan for in-app interactive sessions (10342bc)
- spec + plan for answering Claude's mid-run questions in Mission Control (946d26c)
- add Mission Control multi-task monitoring spec + plan (d80a578)
- document footer log routing + Log Visualizer overlay (4022bd7)
- spec + plan for worker-log footer routing and log visualizer overlay (60eb671)
- document task file attachments across project docs (8716dd8)
- spec + phased plan for one-component-per-feature (0993eb0)
- update for v1.9.0 (bae8921)
## v1.9.0 — 2026-06-19 ## v1.9.0 — 2026-06-19
### Features ### Features
+2 -1
View File
@@ -39,7 +39,7 @@ Each project has its own `CLAUDE.md` — those are the living per-project docs.
- EF Core migrations manage schema (Migrations/ folder in ClaudeDo.Data) - EF Core migrations manage schema (Migrations/ folder in ClaudeDo.Data)
- `IDbContextFactory<ClaudeDoDbContext>` used by singleton consumers (e.g. Worker) - `IDbContextFactory<ClaudeDoDbContext>` used by singleton consumers (e.g. Worker)
- Entity configuration via `IEntityTypeConfiguration<T>` in Configuration/ folder - Entity configuration via `IEntityTypeConfiguration<T>` in Configuration/ folder
- Task status flow: Idle | Queued -> Running -> WaitingForReview -> Done | Failed | Cancelled. A task that spawns/has children passes through WaitingForChildren first, then surfaces for review once every child is terminal — this is the single parent model for both planning and improvement parents (planning/improvement *children* themselves go straight to Done, only the parent is reviewed). From review you can approve, reject-rerun (Queued, resumes the session with feedback), reject-park (Idle), or cancel. Approve is the single review+merge action: a childless task merges its own worktree then Done (conflicts keep it in WaitingForReview); a task with children drives the unit merge (parent worktree if any + each Done child in order, with conflict continue/abort). Tasks with no active worktree (sandbox run) approve straight to Done. - Task status flow: Idle | Queued -> Running -> WaitingForReview -> Done | Failed | Cancelled. A task that spawns/has children passes through WaitingForChildren first, then surfaces for review once every child is terminal — this is the single parent model for both planning and improvement parents (planning/improvement *children* themselves go straight to Done, only the parent is reviewed). From review you can approve, reject-rerun (Queued, resumes the session with feedback), reject-park (Idle), or cancel. Approve is the single review+merge action: a childless task merges its own worktree then Done (conflicts keep it in WaitingForReview); a task with children drives the unit merge (parent worktree if any + each Done child in order, with conflict continue/abort). Tasks with no active worktree (sandbox run) approve straight to Done. In the detail pane, **Approve & Merge is gated behind opening the diff**: when there is something to inspect (worktree diff / merged range / children combined diff) the button stays disabled until the diff or combined-diff viewer has been opened once, and re-locks per run (any state change resets it); tasks with nothing to inspect are never gated. The row-level quick-approve in the task list is an intentional bypass.
- Worktree state flow: Active -> Merged | Discarded | Kept - Worktree state flow: Active -> Merged | Discarded | Kept
- The queue picker claims tasks by `Status=Queued` (with `BlockedByTaskId IS NULL`); the legacy tag system was removed - The queue picker claims tasks by `Status=Queued` (with `BlockedByTaskId IS NULL`); the legacy tag system was removed
- Interfaces live in an `Interfaces/` subfolder beside their consumers (namespace unchanged) - Interfaces live in an `Interfaces/` subfolder beside their consumers (namespace unchanged)
@@ -84,3 +84,4 @@ dotnet test tests/ClaudeDo.Worker.Tests/ClaudeDo.Worker.Tests.csproj -c Release
- `docs/improvement-plan.md` — improvement snapshot from 2026-04-13 (historical) - `docs/improvement-plan.md` — improvement snapshot from 2026-04-13 (historical)
- `docs/prompts-inventory.md`, `docs/mailbox-proposal.md` — reference material (mailbox integration is parked) - `docs/prompts-inventory.md`, `docs/mailbox-proposal.md` — reference material (mailbox integration is parked)
- `CHANGELOG.md` — Keep a Changelog format, maintained on release - `CHANGELOG.md` — Keep a Changelog format, maintained on release
- `docs/explore-notes/` — distilled maps of complex subsystems from deep exploration (detail too fine for a CLAUDE.md). **Before** deep-exploring a subsystem, check for a matching note first; **after** a deep explore, distill durable findings back and bump its "verified against" commit. Always verify against current code before trusting. See `docs/explore-notes/README.md`.
+38
View File
@@ -0,0 +1,38 @@
# Explore-notes
Distilled, reusable maps of complex subsystems, produced by deep code exploration.
The goal: stop re-exploring the same subsystem from scratch in every new session.
These sit **between** the CLAUDE.md files and the code:
- **CLAUDE.md** — high-level orientation, hand-maintained, always-loaded.
- **explore-notes** — deeper subsystem detail (flows, who-calls-whom, invariants) that is
too fine-grained for a CLAUDE.md but stable enough to be worth caching. Read on demand.
- **code** — the only source of truth.
## Rules
- **Only stable structure.** Flows, responsibilities, entry points, invariants, relative
file paths. **No line numbers**, no exhaustive symbol dumps — those rot fastest.
- **Verify before trusting.** A note is a starting map, not authority. Always confirm
against current code before acting on it. Each note records the commit it was verified
against so you can diff for drift.
- **Not a substitute for CLAUDE.md.** If a fact belongs in orientation, put it there.
## Header every note must carry
```
> **Explore-note — verify before trusting.** Distilled map of a subsystem, not authoritative.
> Last verified against commit `<short-hash>` (<date>).
> Drift check: `git log --oneline <short-hash>..HEAD -- <paths this note covers>`
> Stable structure only (no line numbers). See docs/explore-notes/README.md.
```
## Workflow
1. **Before** deep-exploring a subsystem, check for a matching note here and read it first;
explore only to fill gaps or confirm.
2. **After** a deep explore, distill the durable findings into a new/updated note and bump
its "verified against" commit line.
3. If the drift check shows the covered paths changed a lot since the verified commit, treat
the note as suspect and re-verify the parts you rely on.
+124
View File
@@ -0,0 +1,124 @@
> **Explore-note — verify before trusting.** Distilled map of a subsystem, not authoritative.
> Last verified against commit `896d4b5` (2026-07-23).
> Drift check: `git log --oneline 896d4b5..HEAD -- src/ClaudeDo.Worker`
> Stable structure only (no line numbers). See docs/explore-notes/README.md.
# Worker: Task Execution Pipeline
How a task moves Queued → Running → terminal, across `src/ClaudeDo.Worker`
(Queue, Runner, Lifecycle, State, Agents, Worktrees, Hub).
## End-to-End Flow (Queued → Terminal)
1. **Enqueue**`ITaskStateService.EnqueueAsync()` (State/TaskStateService.cs)
- Idle → Queued, then wakes the dispatcher via `IQueueWaker.Wake()`.
2. **Dispatch**`QueueService` loop (Queue/QueueService.cs)
- `BackgroundService`; waits for a wake signal or a backstop timer.
- Reads the max-parallel limit from settings; claims a free slot if under limit.
3. **Atomic Claim**`IQueuePicker.ClaimNextAsync()` (Queue/QueuePicker.cs)
- Raw SQL `UPDATE ... RETURNING` in one transaction: picks an eligible Queued task
(unblocked, due or unscheduled; sorted by sort_order/created_at), sets status→Running
+ started_at, returns the row. Prevents two workers claiming the same task (TOCTOU).
4. **Slot Execution**`QueueService.RunInSlotAsync()` (Queue/QueueService.cs)
- For review feedback: resume the prior session if one exists, else fold feedback into
the prompt. Calls `TaskRunner.RunAsync()` / `ContinueAsync()` with `alreadyClaimed=true`.
5. **Run Preparation**`TaskRunner.RunAsync()` (Runner/TaskRunner.cs)
- Loads task, list config, subtasks, attachments from the DB.
- `PrepareRunDirectoryAsync()`: worktree (via WorktreeManager) if the list has a WorkingDir,
else sandbox. Generates a per-run MCP token, writes MCP config to disk.
- `StartRunningAsync()` (only if not pre-claimed): atomic Queued → Running. Broadcasts TaskStarted.
6. **Claude Execution**`TaskRunner.RunOnceAsync()` (Runner/TaskRunner.cs)
- Creates a TaskRunEntity, points the task at the run's log path.
- Builds claude CLI args (ClaudeArgsBuilder), spawns the process via `IClaudeProcess.RunAsync()`
with prompt + working dir + streaming callback.
- Stream lines → NDJSON log + broadcast via TaskMessage. MCP tools (AskUser, SuggestImprovement)
are scoped by the per-run token.
7. **Result Handling**`TaskRunner.HandleSuccess()` / `MarkFailed()` (Runner/TaskRunner.cs)
- Success (exit 0 + result markdown): if worktree, commit + broadcast WorktreeUpdated; then
transition to Done / WaitingForReview / WaitingForChildren (CompleteAsync / SubmitForReviewAsync
/ SubmitForChildrenAsync).
- Failure: if a session exists, auto-retry once via ContinueAsync; else MarkFailed → FailAsync.
- All terminal writes use `CancellationToken.None` so a task is never left Running.
8. **Terminal States**`ITaskStateService` transitions (State/TaskStateService.cs)
- **Done** CompleteAsync (Running → Done) — top-level success.
- **WaitingForReview** SubmitForReviewAsync (Running → WaitingForReview) — review gate.
- **WaitingForChildren** SubmitForChildrenAsync (Running → WaitingForChildren) — blocks on children.
- **Failed** FailAsync (Running/Queued → Failed).
- **Cancelled** CancelAsync (Running/Queued/WaitingForReview/WaitingForChildren → Cancelled).
## Component Responsibilities
**Queue/**
- `QueueService` — main dispatch loop; slot limit; decides when to start tasks.
- `QueuePicker` — atomic Queued→Running claim via raw SQL.
- `QueueWaker` — semaphore for non-blocking, idempotent wake signals.
- `OverrideSlotService` — owns the RunNow / ContinueTask slot (bypasses the queue).
**Runner/**
- `TaskRunner` — orchestrates the run (prepare, execute, handle result).
- `WorktreeManager` — creates/manages git worktrees; self-heals stale branches.
- `ClaudeProcess` — spawns the claude CLI subprocess; manages streams/logs.
- `TaskRunMcpService` — runtime MCP tools (AskUser, SuggestImprovement).
- `TaskRunTokenRegistry` — per-run MCP identity for tool-access control.
- `InteractiveLaunchSpecService` — config for the task's claude run.
**State/**
- `TaskStateService` — all task status transitions; guards preconditions; signals queue/hub.
**Lifecycle/** (startup recovery)
- `StaleTaskRecovery` — tasks stuck Running after a crash/restart → Failed.
- `OrphanRecovery` — dequeues children whose parent is no longer planning (stays attached).
- `AttachmentOrphanRecovery` — cleans orphaned attachment files.
- `TaskResetService` — manual reset to Idle.
- `TaskMergeService` — conflict resolution for worktree merges.
**Hub/**
- `HubBroadcaster` — single SignalR broadcast point (TaskStarted/TaskUpdated/TaskMessage/RunCreated…).
- `WorkerHub` — SignalR hub + client methods.
**Agents/**
- `AgentFileService` — file I/O for custom agents.
- `DefaultAgentSeeder` — seeds built-in agents on startup.
**Worktrees/**
- `WorktreeMaintenanceService` — cleanup, state tracking, overview reporting.
## Entry Points & Call Chain
```
Program.cs (DI setup)
├─ QueueService (BackgroundService) → ExecuteAsync loop
│ ├─ waits: IQueueWaker.WaitAsync() or timer
│ ├─ claims: IQueuePicker.ClaimNextAsync()
│ └─ runs: TaskRunner.RunAsync() / ContinueAsync()
├─ Hub clients → WorkerHub methods
│ ├─ Enqueue → ITaskStateService.EnqueueAsync() → Wake()
│ ├─ RunNow → OverrideSlotService.RunNow() → TaskRunner.RunAsync()
│ ├─ ContinueTask→ OverrideSlotService.ContinueTask()→ TaskRunner.ContinueAsync()
│ └─ CancelTask → QueueService.CancelTask()
├─ Lifecycle recovery (startup): StaleTaskRecovery / OrphanRecovery / AttachmentOrphanRecovery
└─ State transitions → HubBroadcaster.TaskUpdated()
```
## Invariants & Conventions
- **Atomic claiming** — QueuePicker's `UPDATE ... RETURNING` makes Queued→Running atomic.
- **Slot limit** — respects MaxParallelExecutions; a backstop timer wakes even if a Wake() is missed.
- **Pre-claimed tasks** — the dispatcher pre-claims via the picker; the override slot
(RunNow/ContinueTask) must call StartRunningAsync if a task is not pre-claimed.
- **Terminal writes** — use `CancellationToken.None`; a task is never left Running after crash/cancel.
- **Per-run MCP tokens** — each run gets a unique token scoping tool access; unregistered on end.
- **Auto-retry** — one automatic retry if a session exists and the first run failed.
- **Worktree self-heal** — on branch collision, remove phantom worktrees, prune, delete branch, retry add.
- **Review feedback** — stored on the task; consumed once a run reaches a terminal state; a re-queued
task resumes the session or folds feedback into the prompt.
- **Child tasks** — planning creates draft children; finalization requires no Queued children remain;
OrphanRecovery dequeues children if the parent is not planning.
- **Lifecycle recovery** runs at startup: stale-Running → Failed; orphaned children → dequeued but attached.
+189
View File
@@ -0,0 +1,189 @@
# Fix-Plan — Verifikations-Findings (Stand 2026-07-24)
Einstiegspunkt für eine **frische Fix-Session**. Sammelt die in der manuellen Verifikation
(§7–§9 + Kanten §1/§3/§4) gefundenen Probleme, gruppiert nach **Fixbarkeit**. Volltext je
Finding (mit Kontext/Wiederholschritten) steht in `docs/open.md`; hier steht der Fix-Blick:
Root-Cause, konkreter Ansatz, Loc/Test-Hinweise, und **welche Punkte vor der Umsetzung eine
Entscheidung brauchen**.
**Immer zuerst:** file:line-Angaben gegen den aktuellen Code prüfen (können minimal driften).
Build/Test-Regeln + Gotchas s. Projekt-`CLAUDE.md` (u.a. `.slnx` braucht .NET 9 → einzelne
`.csproj -c Release`; Localization.Tests erzwingt en/de-Parität; Subagents `sonnet`, Dateien
pfad-scoped stagen). Pro Fix ein Conventional Commit.
---
## Bearbeitungsstand (Session 2026-07-24, nicht gepusht)
**Erledigt & committed:**
- Gruppe A #15 + beide Optional-Nits (Icon.Plus gefüllt, Gear-PathIcon, Skills-Empty-State,
„Subtasks"-Terminologie, Conflict-Continue-Hinweis, Rename-Darstellung, Turns/Tokens-Reload).
- Gruppe B #7 (Resume-Fehler surfacen) + #8 (Attachment-Drop-Diagnose).
- Gruppe C #9 (AskUser-Banner in Detail-Insel via geteiltem `TaskMonitorViewModel`),
#11 (OUTCOME zeigt `summary` statt rohem JSON: Worker-Unwrap + UI-Sicherheitsnetz).
- Gruppe D #13 (Kind-Rows live-refresh bei Parent-Planning-Transitionen) + #14 (Idle-Chip auf
Planning-Parents ausgeblendet). *Visual-Verification für #13 (Finalize/Discard live) offen.*
**#6** war im aktuellen Code bereits abgedeckt (Worker wirft `HubException` bei `blocked`
→ UI-Dialog); zusätzlich als ClaudeDo-Task `f9809a93` erfasst. Nicht angefasst.
**Offen:**
- **#10 + #12** — bewusst gebündelt mit dem ConPTY-Planning-Task `5d627df8` (dort lässt sich
die Session-Id sauber greifen bzw. das MCP-Permission-Verhalten klären). Sofort-Schutz für
#10 (Resume ausgrauen wenn keine Id) wurde NICHT gebaut — bräuchte Worker-Plumbing, das der
ConPTY-Umbau ohnehin liefert; der #7-Fix verhindert bereits das stille Scheitern.
- **Gruppe E** — nur noch design-/feature-behaftete Punkte. Der scheinbare Quick-Win
„Dequeue-X auf blockierten Kettengliedern" wurde bewusst NICHT umgesetzt: einzelnes Dequeue
eines Kettenglieds hinterlässt hängende Nachfolger (deren `BlockedByTaskId` zeigt weiter auf
das nun idle Glied) → braucht Chain-Repair-Design.
---
## Gruppe A — Mechanisch, sofort fixbar (keine Entscheidung nötig)
Ideale Kandidaten für den Start / parallele Subagents (disjunkte Dateien).
1. **„New session"-Button unsichtbar (Icon.Plus strich-only)**
`IslandStyles.axaml` (`Icon.Plus` = `M12 5v14M5 12h14`, reine Linie) wird in einem
`<PathIcon>` (MissionControlView.axaml, füllt Geometrie) unsichtbar gerendert.
**Fix:** `Icon.Plus` als gefüllte Geometrie authoren ODER als gestricheltes `Path`
rendern (vgl. `Path.plan-icon`). **Andere `Icon.Plus`-Verwendungen mitprüfen.**
2. **Agent-Settings-Gear weicht vom Listen-Gear ab**
`TaskHeaderBar.axaml:68` rendert `<TextBlock Text="⚙">`; überall sonst `Icon.Settings`
(PathIcon, IslandStyles.axaml:110). **Fix:** den `⚙`-TextBlock durch
`<PathIcon Data="{StaticResource Icon.Settings}" Width=".." Height=".."/>` ersetzen.
3. **Session-Skills-Tab ohne Empty-State**
Bei 0 Skills nur nackte Fläche. **Fix:** Empty-State-Text unter der Install-Zeile
(z.B. „No skills installed — paste a GitHub URL above"). **Loc:** neue Keys in en.json
**und** de.json (Parität!). Datei: `SessionSkillsSettingsTab*`.
4. **„Waiting for Improvements" für Planning-Parents (Terminologie)**
`en.json` `taskStatus.waitingForChildren`/`agentStatus.children`/`childOutcomesLabel`
sagen „Improvements". Seit unified-parent gilt `WaitingForChildren` auch für Planning.
**Fix:** auf neutrales „Waiting for Subtasks"/„Subtasks"/„SUBTASKS" umstellen — en **und**
de (Parität).
5. **Conflict-Resolver: Continue-Button klickbar trotz offener Konflikte**
Merge passiert korrekt erst nach Auflösung, aber der Button ist nicht disabled → früher
Klick = stummer No-op. **Fix:** `CanContinue`/`AllResolved` an `IsEnabled` binden (ggf.
Hinweis „N Konflikte in M Dateien offen"). Datei: `ConflictResolverView(.axaml)` +
`ConflictResolverViewModel`.
Optional-Nits (gleiche Gruppe, niedrige Prio):
- **Diff-Viewer Rename schwach dargestellt** (alt→neu-Pfad + „renamed"-Label statt „+0 0").
- **Header-TurnsText `0/max`** bei terminalem Reload — `Turns` aus `task_runs.turnCount`
restaurieren.
---
## Gruppe B — Error-Surfacing (klare Richtung: kein stiller/leerer Fehlerpfad)
Leitlinie `feedback_ui_error_surfacing`: User-Action-Fehler in den Footer
(`FlashFooterError`) bzw. Dialog, nie leerer `catch`/stiller No-op.
6. **Approve & Merge schluckt „blocked" still**
`DetailsIslandViewModel.ApproveReviewAsync` reagiert nur auf `Status == "conflict"`; bei
`"blocked"` (z.B. dirty Ziel-Tree) passiert nichts. **Fix:** bei `blocked`/unerwartetem
Status `result.ErrorMessage` surfacen. *(Als ClaudeDo-Task `f9809a93` erfasst — koppelt
„Approve erzwingt Diff/Review vor Merge".)*
7. **„Resume planning session" verschluckt den Fehler (Teil-Fix hier, Rest → Gruppe C #10)**
`TasksIslandViewModel.ResumePlanningSessionAsync` (~Zeile 870) hüllt alles in `catch { }`.
**Sofort-Fix:** den Fehler surfacen statt schlucken. Der eigentliche Resume-Defekt braucht
eine Entscheidung → #10.
8. **Attachments: intermittenter erster-Drop-Fehler („An error occurred")**
Einmalig beobachtet (erster Drop der Session, nichts persistiert), nicht reproduzierbar.
**Fix (diagnostisch):** `AddFilesAsync`/`OnDrop` robustes Error-Logging geben (die genaue
Exception fehlt, weil `DropStatus` nur `{fileName}: {ex.Message}` zeigt) — damit der
nächste Fall auswertbar ist. Kandidaten-Ursachen: SQLite-Contention (UI schreibt `todo.db`
direkt, während der Worker sie hält) oder Drop-Stream-Pfad (`IStorageFile.OpenReadAsync`
im Code-Behind, außerhalb des `try`).
---
## Gruppe C — Erst Entscheidung/Brainstorm, DANN umsetzen (nicht blind fixen)
9. **AskUser-Interaktion auch in der Detail-Insel** *(von Mika ausdrücklich gewünscht)*
Der `ask_user`-Banner + Inline-Antwort existiert nur in Mission Control
(`MonitorPaneView`); die Detail-Insel zeigt für den laufenden Task nichts.
**Entscheidung:** wie den Zustand teilen — `TaskMonitorViewModel` hält ihn bereits; für
die Detail-Insel replizieren, teilen, oder ein gemeinsames Banner-Control? Danach:
Banner + `AnswerDraft`/`SubmitAnswer` in `DetailsIslandView(Model)` einhängen.
10. **„Resume planning session" grundsätzlich kaputt (Session-Id nie erfasst)**
`PlanningSessionManager.ResumeAsync:238` wirft immer „No Claude session ID captured yet",
weil `TaskRepository.UpdatePlanningSessionIdAsync:322` **keinen Aufrufer** hat →
`planning_session_id` bleibt NULL. **Entscheidung:** (a) claude-Session-Id der
wt-Planning-Session erfassen + via `UpdatePlanningSessionIdAsync` persistieren (echtes
Resume) ODER (b) Resume entfernen/deaktivieren, wenn keine Id vorliegt. Hängt mit der
Design-Entscheidung „Planning über embedded ConPTY statt wt" zusammen (ClaudeDo-Task
`5d627df8`) — dort ließe sich die Session-Id sauber greifen.
11. **OUTCOME-Karte rendert rohes Structured-Output-JSON**
`TaskMonitorViewModel.ApplyOutcome` setzt bei Tasks ohne Roadblock `SessionOutcome`
= `task.Result` wörtlich; der Worker legt dort rohes `{"summary":…}` ab.
**Entscheidung:** (a) UI parst JSON-Result und zeigt `summary`, oder (b) Worker schreibt
`summary`/`resultMarkdown` statt JSON in `task.Result`.
12. **Planning-Session prompted nach MCP-Tool-Permission**
Trotz `--allowedTools "mcp__claudedo__*,…"` + `--permission-mode plan` prompted die
wt-Planning-Session beim ersten `create_child_task`. **Untersuchen/Entscheiden:** matcht
der `mcp__claudedo__*`-Glob in CLI 2.1.207 nicht (Syntax evtl. ganzer Server-Name), oder
gated Plan-Mode MCP-Writes generell? Gekoppelt an ConPTY-Planning-Task `5d627df8`.
---
## Gruppe D — Erst Root-Cause pinnen (Investigation)
13. **Kind-Rows aktualisieren nach Parent-Planning-Transitionen nicht live**
Nach **Finalize** bleiben Kind-Badges „Draft" statt „Planned"; nach **Discard** bleiben
die (in der DB gelöschten) Kind-Rows sichtbar — bis Listen-Reload. Doppelt verifiziert §3.
**Untersuchen:** wie wird die Kinderliste/-gruppierung auf ein Parent-`TaskUpdated`
reagierend neu aufgelöst? Vermutlich fehlt ein Regroup/Refetch der Children beim
Parent-Broadcast (`TasksIslandViewModel` hierarchie-Regrouping). Fix danach: Children bei
Parent-Transition live neu auflösen.
14. **Planning-aktiver Parent zeigt weiter „Idle"**
Parent `planning_phase=active` hat `Status=Idle` (korrekt im Modell), aber der Row-Chip
zeigt „Idle"; `PlanningBadge` überschreibt das nicht sichtbar. **Untersuchen/Design:** ein
klarer „Planning/Draft aktiv"-Zustand, der den Idle-Chip überschreibt. (Verwandt mit #13
Row-Statusdarstellung.)
---
## Gruppe E — UX-Nits / Feature-Wünsche (niedrige Prio, sammeln)
- **Conflict-Resolver: mehrere Konfliktdateien schlecht erkennbar** — prominentere Datei-Liste
/ „x von y Dateien".
- **Blocked-by-Kette nicht visualisiert** — Reihenfolge/Abhängigkeit darstellen
(„wartet auf <Vorgänger>").
- **Dequeue-„X" fehlt auf blockierten Kettengliedern** — `CanRemoveFromQueue` erweitern
(`IsWaiting` einschließen).
- **„Open ConPTY session" erneut = Prompt wird neu gesendet** — Resume-Affordance / Re-Open-
Warnung (bewusst kein Session-Persist).
- **Conflict-Resolver: farbliches Hervorheben übernommener Zeilen im Result-Pane** (Feature).
---
## Nicht anfassen / Kontext
- **§1 DiffModal-Fehler-State** (`vm.diff.unavailable`) ist **defensiver, über die UI
unerreichbarer** Code — alle Aufrufer sind gegated (`CanDiffMergedRange` verlangt base+head
non-null; `ConfigureWorktree` nur mit existierendem Pfad). Kein Fix nötig.
- **`--permission-mode auto` + `haiku` denied Writes** — modellabhängiges Verhalten, keine
Regression; Default (sonnet) unbetroffen. Beobachten (Memory `auto_permission_haiku_footgun`).
- **§10 Daily Prep/Weekly** — Verifikation zurückgestellt bis zum geplanten Rework.
---
## Empfohlene Reihenfolge
1. **Gruppe A** (mechanisch, schnell, teils parallel) → sofort sichtbare Wins.
2. **Gruppe B** (Error-Surfacing, klein & risikoarm).
3. **Gruppe C** — pro Punkt kurz brainstormen/entscheiden, dann umsetzen (#10 + #12 zusammen
mit der ConPTY-Planning-Entscheidung betrachten).
4. **Gruppe D** — Investigation, dann Fix (#13 zuerst — betrifft mehrere Planning-Flows).
5. **Gruppe E** — nach Bedarf.
+30 -45
View File
@@ -1,64 +1,49 @@
# ClaudeDo — Offene Punkte # ClaudeDo — Offene Punkte
Stand: 2026-06-10. **Nur noch offene Punkte.** Was erledigt ist, steht in den Commits und im Code nicht hier. Stand: 2026-07-24. Diese Datei listet die **aktiv verifizierten Findings** aus der Verifikations-Session vom 2026-07-24. Die laufende Verifikations-Checkliste (Pass/Fail je Abschnitt, inkl. noch offener Abschnitte §7–§11 und Kanten) lebt in `docs/verification-handoff.md`. Erledigtes steht in den Commits/im Code, nicht hier.
--- ---
## Manuelle Verifikation (offen) ## Bugs (verifiziert 2026-07-24)
Kein Code-Aufwand, nur Durchspielen mit explizit notiertem Pass-Kriterium. Der Großteil der Pipeline ist laut User bereits in der Praxis getestet; hier das, was noch ein falsifizierbares Observable braucht. - **OUTCOME-Karte rendert rohes Structured-Output-JSON:** `TaskMonitorViewModel.ApplyOutcome` (ClaudeDo.Ui) setzt bei Tasks ohne Roadblock-Marker `SessionOutcome = result` wörtlich (Zeile ~261). Der Worker legt in `task.Result` das rohe `{"summary":…,"files_changed":[…]}` ab (die lesbare Fassung steht in `task_runs.resultMarkdown`), also zeigt die Detail-Insel OUTCOME als JSON-Blob statt als Text. Fix: (a) UI parst ein JSON-Result und zeigt `summary`, oder (b) Worker schreibt `summary`/`resultMarkdown` statt des JSON in `task.Result`. Verifiziert am Task `verif §1 diff matrix`. Deckt sich mit Memory `worker_testing_findings`.
- **Approve & Merge schluckt einen „blocked"-Merge still:** `DetailsIslandViewModel.ApproveReviewAsync` reagiert nur auf `result.Status == "conflict"` (öffnet den Resolver); bei `"blocked"` (z.B. Ziel-Working-Tree hat uncommittete getrackte Änderungen) und anderen Nicht-`merged`/Nicht-`conflict`-Status passiert **nichts** — kein Footer-Fehler, kein Dialog (der `catch` greift nur bei Exceptions, „blocked" ist aber ein normaler Rückgabewert mit `ErrorMessage`). User sieht „Klick tut nichts". Doppelt verifiziert (Konflikt-Approve UND sauberer additiver Approve `verif §1b`, beide bei dirty `main`-Checkout still). Fix: bei `blocked`/unerwartetem Status `result.ErrorMessage` via `ShowErrorAsync`/`FlashFooterError` surfacen. Verstößt gegen `feedback_ui_error_surfacing`. (Der Konflikt-Resolver + 3-Pane-Editor funktionieren, sobald der Ziel-Tree sauber ist.)
- **„Waiting for Improvements" für Planning-Parents (Terminologie):** `taskStatus.waitingForChildren` = „Waiting for Improvements" (en.json:504), `agentStatus.children` dito (503), `childOutcomesLabel` = „IMPROVEMENTS" (191). Seit dem unified-parent-Modell gilt `WaitingForChildren` für Planning **und** Improvement-Parents — „Improvements" ist für einen Planning-Parent falsch. Auf neutrales „Waiting for Subtasks"/„Subtasks" umstellen (en **und** de — Localization.Tests-Parität). Verifiziert §3.
- **Kind-Rows aktualisieren nach Parent-Planning-Transitionen nicht live:** Parent-getriebene Änderungen propagieren nicht auf die Kind-`TaskRowViewModel`s ohne Listen-Reload. (a) Nach „Finalize planning" bleiben Kind-Rows auf „Draft" (`IsDraft`) statt „Planned" (`IsPlanned`) — der geänderte `ParentFinalized` kommt nicht über das Parent-`TaskUpdated`-Broadcast an. (b) Nach „Discard" bleiben die (in der DB gelöschten) Draft-Kind-Rows sichtbar, bis die Liste neu geladen wird. Gemeinsame Ursache: die Kinderliste/-zustände werden bei Parent-Transitionen nicht live neu aufgelöst. Doppelt verifiziert §3 (Finalize **und** Discard, 2026-07-24).
- **AskUser-Frage erscheint NUR in Mission Control, nicht in der Task-Detail-Insel:** Der `ask_user`-Banner (Frage + Antwort-Eingabe) lebt ausschließlich in `MonitorPaneView` (Mission Control). Die Detail-Insel (`DetailsIslandView`) streamt zwar den Live-Log eines laufenden Tasks, zeigt aber **kein** Frage-Banner — ein Nutzer, der nur die Detailansicht offen hat, sieht nicht, dass der Run auf eine Antwort wartet, und läuft nach 3 min in den Timeout-Fallback. Verifiziert §7 (User schaute Detailansicht, Frage war unsichtbar; erst in Mission Control sichtbar). Fix: Frage-Banner + Inline-Antwort auch in der Detail-Insel für den gebundenen laufenden Task surfacen (VM-Zustand liegt bereits in `TaskMonitorViewModel`, müsste für die Detail-Insel repliziert/geteilt werden). **Von Mika bei der §7-Verifikation ausdrücklich gewünscht** („vermisse diese Interaktion in der Detail-Ansicht"). §7.
- **„New session"-Button (Mission Control) unsichtbar — Icon.Plus ist Strich-Only:** `Icon.Plus` = `M12 5v14M5 12h14` (IslandStyles.axaml:61) ist reine Linien-Geometrie ohne Fläche; im `<PathIcon>` (MissionControlView.axaml:38, füllt Geometrie) rendert sie **unsichtbar** → der Ad-hoc-„New session"-Button erscheint leer und ist nicht auffindbar (Feature + VM `OpenAdHocConPtySessionAsync` + Tests funktionieren, nur das Icon fehlt sichtbar). Fix: Icon.Plus als gefüllte Geometrie authoren ODER als gestricheltes `Path` rendern (Icon-Gotcha in CLAUDE.md). **Andere `Icon.Plus`-Verwendungen mitprüfen.** Verifiziert §5.
- **Worktree-Pipeline:** ## UX / Nits (verifiziert 2026-07-24)
- Worktree-Happy-Path → `worktrees.state='active'`, `head_commit` gesetzt, `diff_stat` non-empty, Branch `claudedo/<id>` auf Disk.
- No-Changes-Run → `status='Done'`, `head_commit IS NULL`, `diff_stat IS NULL`.
- Kein Git-Repo (`working_dir=C:\Temp`) → `status='Failed'`, **keine** `worktrees`-Row, Git-Fehler im Log.
- **Feature-Walkthroughs:** Planning-Session-Flow (Draft→Finalize→Chain), Prime/Daily-Prep-Trigger, Weekly-Report-Generierung, Self-Update (Banner → Update → „up to date").
- **UI-Sichtprüfung (neu, 2026-06-09):** Diff-Viewer (Dateiliste, Added/Deleted/Renamed/Binary-Erkennung, Commit-Range-Diff nach Merge) und das „children need attention"-Band auf dem Session-Tab des Parents.
- **UI-Sichtprüfung (neu, 2026-06-10, nach Refactoring-Merges):** Detail-Insel komplett durchklicken (Output/Git/Session-Tabs, Merge-Sektion, Agent-Settings-Overrides, Prep-Panel) — `DetailsIslandViewModel` wurde in Sektions-VMs aufgeteilt, Bindings angepasst. Außerdem: DiffModal-Fehler-State „Diff nicht mehr verfügbar" (Commit-Range ohne aufgezeichnete Commits) und der In-App-Konflikt-Resolver (Hub-Methoden umbenannt).
- **UI-Sichtprüfung (neu, 2026-06-19, Rider-Style 3-Pane Merge-Editor):** Echten Konflikt auslösen (Single-Task-Approve mit Konflikt **und** Planning-Unit-Merge) und prüfen: drei Panes (Ours read-only | Result editierbar | Theirs read-only), Konfliktblöcke rot / aufgelöst grün in allen Panes, Inline-Accept ``/`` in den Zwischen-Guttern landen die jeweilige Seite im Result, nur Konfliktregionen im Result editierbar (Stable read-only), synchrones vertikales Scrollen, File-Switcher bei mehreren Dateien, `M conflicts · K resolved`-Readout, Continue erst bei allen Konflikten gelöst, Binär-Guard. **Bekannte Kanten:** (1) Konflikt mit leerer Ours-Seite → Result-Region ist null-lang (Gutter via 1-Zeichen-Probe positioniert, Accept funktioniert; nur Hand-Tippen in die leere Region ist fummelig). (2) Gutter-Y nutzt `TranslatePoint` vom Result-`TextView` — bei sehr hohen Fenstern / großen Scrollständen die Ausrichtung gegenprüfen. (3) Blöcke richten sich nur über Stable-Text aus; nach einem Konflikt mit unterschiedlicher Zeilenzahl je Seite driften nachfolgende Blöcke vertikal (aligned/virtual-space Scroll ist bewusst zurückgestellt).
- **Worker-Autostart am Gerät:** Logoff/Logon-Autostart, Update-Pfad, Uninstall entfernt die Startup-`.lnk`.
- **In-App Interactive Sessions (neu, 2026-06-26):** ersetzt den externen `wt`-„Run interactively"-Launch durch einen In-App-Streaming-Chat (`StreamingClaudeSession`, `claude --input-format stream-json`). Real-CLI-Smoke (kein xUnit, kein Claude in Tests):
- Task rechtsklick → „Run interactively" startet **keinen** Terminal mehr; der Stream erscheint im Detail-Output-Tab des (selektierten) Tasks und als Monitor in Mission Control.
- Composer: Nachricht tippen + Enter/Send → erscheint sofort als `log-user`-Zeile in **Akzentfarbe** (via `LogKindForegroundConverter`, lokale Bindung schlägt den dim Style), Claude antwortet im selben Prozess.
- **Senden während Claude arbeitet = Queue (Default):** die Nachricht wird gepuffert und beim `result` des laufenden Turns abgeschickt (kein Interrupt). Mehrere Queue-Nachrichten FIFO, eine pro Turn. Gequeute Nachrichten erscheinen in einem **Pending-Streifen über der Eingabezeile** (⧗-Liste, via `InteractiveQueueChanged`); eine Nachricht landet erst im Transkript (`log-user`-Zeile via `InteractiveMessageSent`), wenn sie tatsächlich an Claude zugestellt wird. Der seeded Erst-Prompt erscheint als erste User-Zeile. Jede gequeute Zeile hat ein **✕ zum Entfernen** (`RemoveQueuedInteractiveMessage`, by-text first-match; Worker re-broadcastet die Queue).
- **Interrupt opt-in:** der kleine ■-Stop-Button neben Send unterbricht den laufenden Turn (`control_request`/`interrupt`, verifiziert mit CLI 2.1.191; Abbruch-`result` = `error_during_execution`, als Turn-Ende behandelt) — danach flusht die ggf. gequeute Nachricht im selben Prozess mit erhaltenem Kontext. Stop-Button ist immer sichtbar solange live (Interrupt im Idle ist ein No-op; Turn-in-flight wird nicht in die UI gebroadcastet).
- Session-Ende: Prozess-Exit/Stop → `InteractiveSessionEnded`, Composer verschwindet, Monitor wird „done".
- **Sicht-Konsistenz:** Mission-Control-Composer (SessionTerminalView-Bottom-Row mit Send-Button) vs. Detail-Composer (WorkConsole-Shell-Prompt ` … [Send]`) sehen unterschiedlich aus — ggf. angleichen.
- **Drag-and-drop file attachments on the detail pane:** verify the "Drop to attach" hover overlay, drop round-trip (file appears in the list), "Add file…" picker, remove button, and that files land under `~/.todo-app/attachments/<taskId>/`. Also verify the MCP `AddTaskAttachment`/`ListTaskAttachments`/`RemoveTaskAttachment` tools and that a Running task refuses add/remove. (Manual; can't be unit-tested.)
## Offene Code-Punkte - **„Resume planning session" ist grundsätzlich kaputt (Session-Id wird nie erfasst) + Fehler wird verschluckt:** Im UnfinishedPlanning-Modal macht **Resume** nichts. Ursache: `PlanningSessionManager.ResumeAsync` (PlanningSessionManager.cs:238) bricht mit `InvalidOperationException("No Claude session ID captured yet; cannot resume.")` ab, wenn `task.PlanningSessionId` leer ist — und der Setter `TaskRepository.UpdatePlanningSessionIdAsync` (TaskRepository.cs:322) hat **keinen einzigen Aufrufer** im Worker, d.h. `planning_session_id` wird nie befüllt (verifiziert an `verif §3 resume-discard`: `planning_session_id=NULL`, Token gesetzt, Drafts angelegt). Resume kann also **nie** erfolgreich sein. Zusätzlich verschluckt `TasksIslandViewModel.ResumePlanningSessionAsync` den ganzen Block in einem leeren `catch { }` (~Zeile 870) → der Button ist ein **stummer No-op**, kein Footer-Fehler, kein Dialog (verstößt gegen `feedback_ui_error_surfacing`). Hintergrund: die wt-Planning-Session ist interaktiv; ClaudeDo erfasst die claude-Session-Id dort nicht (analog zur bewusst nicht persistierten ConPTY-Session-Id, §5). Fix-Optionen: (a) beim Planning-Start/-Lauf die claude-Session-Id erfassen und via `UpdatePlanningSessionIdAsync` persistieren, damit Resume echt resumen kann; ODER (b) Resume entfernen/deaktivieren, wenn keine Session-Id vorliegt; in JEDEM Fall den Fehler statt des leeren `catch` surfacen. Verifiziert §3. §3.
- **Attachments: erster Drag&Drop der Session schlug einmalig fehl („An error occurred"):** Beim allerersten Drop-to-attach einer UI-Session zeigte die `DropStatus`-Zeile inline einen generischen Fehler und es wurde nichts persistiert (kein File, keine DB-Row); alle folgenden Drops derselben Session + der „Add file…"-Picker + Remove funktionierten fehlerfrei. Nicht reproduzierbar nach dem ersten Mal (App-Neustart nötig, um die „erster-Drop"-Bedingung wiederherzustellen). Kandidaten: transiente SQLite-Contention (der UI-Prozess schreibt `todo.db` direkt via `new TaskAttachmentRepository`, während der Worker dieselbe DB hält) ODER ein Fehler im Drop-Stream-Pfad (`IStorageFile.OpenReadAsync` im Code-Behind, außerhalb des `try` in `AddFilesAsync`). Falls es erneut auftritt: `AddFilesAsync`/`OnDrop` mit robusterem Error-Logging versehen (die genaue Exception-Message fehlt, weil `DropStatus` nur `{fileName}: {ex.Message}` zeigt). Verifiziert §9 (einmalig beobachtet). §9.
- **Agent-Settings-Gear weicht vom übrigen Settings-Icon ab:** Der Agent-Settings-Flyout-Button (`TaskHeaderBar.axaml:68`) rendert ein Unicode-Glyph `⚙` (`<TextBlock Text="⚙">`), während die Listen-Nav (`ListsIslandView.axaml:56`) und die Listen-Settings (`TasksIslandView.axaml:47`) das gefüllte `Icon.Settings`-PathIcon (Gear-StreamGeometry, IslandStyles.axaml:110) nutzen → optisch ein anderes Zahnrad. Angleichen: den `⚙`-TextBlock durch `<PathIcon Data="{StaticResource Icon.Settings}" .../>` ersetzen. Verifiziert §8 (User-Sichtprüfung). §8.
- **Session-Skills-Tab hat keinen Empty-State:** Bei 0 installierten Skills zeigt der Skills-Tab (Settings) nur eine nackte leere Fläche unter der Install-Zeile — kein erklärender Hinweis (z.B. „Noch keine Skills installiert — GitHub-URL oben einfügen"). Verifiziert §8 (frischer Zustand vor ponytail-Install). Kleiner Empty-State-Text ergänzen.
- **Status-Bar Live-Update:** Prüfen, ob `RunNow`-Enable/Disable pro Task-Row bei Connection-Change sauber re-evaluiert. Connection-Status lebt in `IslandsShellViewModel` / `WorkerConnectionModalViewModel` (es gibt keinen `StatusBarViewModel` mehr). Erst messen, dann ggf. fixen. Klein. - **Diff-Viewer: reiner Rename schwach dargestellt:** Rename korrekt erkannt (`UnifiedDiffParser``DiffFileStatus.Renamed`, Badge `StatusCode="R"`), aber der File-Tree zeigt nur den neuen Namen + „+0 0" ohne „alt → neu"-Pfad; liest sich wie „keine Änderung". Optional: alten Pfad + „renamed"-Label anzeigen. §1.
- **`AgentMcpTools` liegt in `LifecycleMcpTools.cs`** — beim Suchen irreführend; in eigene Datei verschieben. Ein-Minuten-Fix, lohnt keinen Agent-Lauf — beim nächsten Worker-Touch mitnehmen. - **Header-TurnsText zeigt `0/max` für abgeschlossene Runs:** `TurnsText => {Turns}/{EffectiveMaxTurns}``Turns` wird beim Laden eines terminalen Tasks nicht aus `task_runs.turnCount` restauriert (nur live gefüllt). Kosmetisch. §1.
- **Conflict-Resolver: Continue/Merge-Button klickbar trotz offener Konflikte:** Gate greift funktional (merged erst wenn alle Konflikte in allen Dateien gelöst), aber der Button ist nicht disabled/gegraut → früher Klick ist ein stummer No-op. Besser: disabled bis `AllResolved`, oder Hinweis „N Konflikte in M Dateien offen". §4.
- **Conflict-Resolver: mehrere Konfliktdateien schlecht erkennbar:** Beim 2-Datei-Konflikt schwer zu sehen, dass zwei Dateien betroffen sind (File-Switcher/Anzahl zu unauffällig). Prominentere Datei-Liste / „x von y Dateien". §4.
- **Planning-aktiver Parent zeigt weiter „Idle":** Parent in `planning_phase=active` hat `Status=Idle` (korrekt im Modell), aber der Row-Status-Chip zeigt „Idle"; der `PlanningBadge` ersetzt das nicht sichtbar → liest sich wie ein normaler Idle-Task. Wunsch: klarer „Planning/Draft aktiv"-Zustand, der Idle überschreibt. (Kinder zeigen korrekt „Draft".) §3.
- **Blocked-by-Kette nicht sichtbar:** Nach Finalize ist die sequentielle Kette korrekt gesetzt (child[i] blocked-by child[i-1]), aber die UI stellt die Reihenfolge/Abhängigkeit nicht dar. Wunsch: Kette visualisieren (z.B. „wartet auf <Vorgänger>"), nicht nur der „waiting"-Chip nach dem Queueen. §3.
- **Dequeue-„X" fehlt auf wartenden (blockierten) Kettengliedern:** `CanRemoveFromQueue = IsQueued || HasQueuedSubtasks`, `IsQueued` verlangt leeres `blocked_by`. Ein gequeuetes, aber blockiertes Kind (`IsWaiting`) bekommt daher kein Remove-from-queue-X — nur Parent + erstes (entsperrtes) Kind. §3.
- **„Open ConPTY session" erneut = Prompt wird neu gesendet, kein Resume:** Da die ConPTY-Session-Id bewusst nicht persistiert wird, startet ein erneutes „Open ConPTY session" auf demselben Task eine frische Session und sendet den Task-Prompt erneut (re-runt die Arbeit im selben Worktree) statt zu resumen. So designt, aber UX-Falle — evtl. „Resume"-Affordance oder Re-Open-Warnung. §5.
## Nachklapp Refactoring-/Bug-Runde (2026-06-09/10) ## Feature-Wünsche (aus der Session)
Alle 9 Review-Tasks (5 Refactorings, 4 Bugfixes) sind umgesetzt und gemerged; Details in den Commits. Offen geblieben: - **Conflict-Resolver: farbliches Hervorheben eingefügter Zeilen im Result-Pane** (grüner „flow" der übernommenen Zeilen). §4.
- Als ClaudeDo-Tasks in Liste „Claude do" erfasst: **Approve erzwingt Diff/Review vor Merge** (koppelt den blocked-Merge-Silent-Fail-Fix) und **interaktive Planning-Session über embedded ConPTY statt externem wt-Fenster** (koppelt den Planning-Permission-Prompt).
- **`DetailsIslandViewModel` ist nach dem Split noch 1258 Zeilen** (Ziel war ~800) — die drei Sektions-VMs (AgentSettings, Merge, Prep) sind extrahiert, weitere Extraktion (z.B. ChildOutcomes/Subtasks-Sektion) lohnt erst, wenn die Datei wieder wächst. ## Beobachtung (offen — Entscheidung Mika)
- **Bewusst zurückgestellt:** WorkerHub-Split nach Concern (~60 Methoden in einer Hub-Klasse). Die Interface-Parität löst das akute Testbarkeits-Problem; ein Hub-Split ist eine größere Architekturentscheidung → erst besprechen.
- **Lessons learned:** Der `StartRunningAsync`-Guard-Task hat isoliert grün getestet, aber den Queue-Pfad gebrochen (Picker claimt vor dem Dispatch) — Integrationsfix `74ca2e0`. Bei parallelen Tasks, die denselben Pfad berühren, nach JEDEM Merge-Schwung die volle Suite auf main fahren.
## Bug-Befunde (Korrektheits-Review 2026-06-09) - **`--permission-mode auto` + Modell `haiku` → Writes werden denied:** Kontrolliert verifiziert (CLI 2.1.207): unter dem Default-Mode `auto` bekommt **sonnet** Writes auto-approved (`permission_denials:[]`), **haiku** wird `denied` (`permission_denials:[Write]`, keine Datei) — eine haiku-Task macht unter `auto` still nichts und landet ohne Änderung in `WaitingForReview`. Normalbetrieb (Default = sonnet) nicht betroffen. KEINE CLI-Regression, sondern modellabhängiges `auto`-Verhalten. Optionen falls es nervt: haiku aus der Auswahl nehmen, ODER Runner auf `acceptEdits`/`bypassPermissions` (modell-unabhängig). Mika: erstmal beobachten. Siehe Memory `auto_permission_haiku_footgun`.
**Plausibel, noch nicht einzeln verifiziert (bei Gelegenheit prüfen):**
- Cancel eines `WaitingForChildren`-Parents kaskadiert nicht auf laufende/queued Kinder (verwaiste Worktree-Commits).
- Ketten-Kaskade stoppt an einem `Idle`-Mittelglied (`OnChildFinishedAsync` prüft `CancelAsync`-Ergebnis nicht) → Rest bleibt `Queued+blocked`.
- Delete des *letzten* nicht-terminalen Kindes triggert kein `TryAdvanceParentAsync` → Parent kann in `WaitingForChildren` hängen (FK `SET NULL` rettet nur die Blocked-Kette).
- `ContinueMergeAsync` staged per `git add -A` vor dem Konflikt-Check (Marker im Index, Abort danach ggf. unsauber).
- `HasChangesAsync` zählt untracked Files → blockiert Merges unnötig (`--untracked-files=no`).
- `UnifiedDiffParser`: Pfade mit Leerzeichen / git-gequotete Pfade aus `diff --git` falsch geparst.
- Kleinkram: MergePreview-Race bei schnellem Target-Wechsel, CTS-Dispose-Leak in Debounce-Saves, `Environment.CurrentDirectory`-Fallback im Konflikt-Dialog, Doppel-Continue-Fenster im Orchestrator.
**Geprüft und verworfen (keine Bugs):** ReviewFeedback-„Endlosschleife" (Fallback existiert), Cross-Thread-Crashes im DetailsIslandViewModel (Dispatcher-Marshalling im WorkerClient), Chain-Wedge nach Child-Delete (FK `ON DELETE SET NULL`), `\ No newline`-Parsing.
--- ---
## Bewusst verworfen (nicht erneut vorschlagen) ## Bewusst verworfen (nicht erneut vorschlagen)
- **CI-Build/Test-Pipeline** — push-to-main + release-on-push deckt das ab; Tests laufen am Ende jeder Session. - **CI-Build/Test-Pipeline** — push-to-main + release-on-push deckt das ab; Tests laufen am Ende jeder Session.
- **Real-`claude`-Smoke-Test als xUnit-Test** — kein Claude in `dotnet test`; bleibt manueller Check (siehe oben). Tests nutzen `FakeClaudeProcess`. - **Real-`claude`-Smoke-Test als xUnit-Test** — kein Claude in `dotnet test`; bleibt manueller Check. Tests nutzen `FakeClaudeProcess`.
- **`architecture.md` / ADRs** — die per-Projekt-`CLAUDE.md`-Dateien sind die lebende Doku; ADRs lohnen solo nicht. - **`architecture.md` / ADRs** — die per-Projekt-`CLAUDE.md`-Dateien sind die lebende Doku.
- **Task-Mailbox-Integration** — geparkt; das generische `mcp__mailbox__*`-Plugin reicht (Begründung in `mailbox-proposal.md`). - **Task-Mailbox-Integration** — geparkt; das generische `mcp__mailbox__*`-Plugin reicht (`mailbox-proposal.md`).
- **Tag-Negation, Tag-Multi-Select, Notes-`lists.kind`-Switch, Install-Service-Skript** — durch die aktuelle Architektur überholt (Tag-System entfernt, Notes/Autostart anders gelöst). - **Tag-Negation, Tag-Multi-Select, Notes-`lists.kind`-Switch, Install-Service-Skript** — durch die aktuelle Architektur überholt.
@@ -0,0 +1,94 @@
# Session Skills — Implementation Plan
Spec: `docs/superpowers/specs/2026-07-03-session-skills-design.md`
Approach: subagent-driven TDD (sonnet), build + test + commit per task, stage files by
path (never `git add -A`).
**Pre-flight (do first, before building anything):** manual smoke test — drop a skill
into a scratch worktree's `.claude/skills/` and run `claude -p` to confirm cwd skills are
discovered in headless mode. The whole feature rests on this. If it fails, stop and
redesign around `CLAUDE_CONFIG_DIR`.
---
## Task 1 — Data layer: columns + registry table + migration
- Add nullable `SessionSkills` (string, JSON array) to `TaskEntity`, `ListConfigEntity`,
`AppSettingsEntity`; map `session_skills` columns in their `*Configuration.cs`.
- New `SessionSkillEntity` (`name` PK, `source_url`, `pinned_ref`, `subpath`,
`description`, `added_at`) — one row per skill; a multi-skill repo writes N rows sharing
`source_url`/`pinned_ref` — + configuration + `session_skills` table.
- New `SessionSkillRepository` (async, CancellationToken): `ListAsync`, `GetAsync(name)`,
`UpsertAsync`, `DeleteAsync(name)`, `DeleteBySourceAsync(url)`, `ListBySourceAsync(url)`.
- EF migration `AddSessionSkills` (columns + table).
- **Tests (Data.Tests):** repository CRUD on real SQLite; JSON column round-trips a
name list.
## Task 2 — Registry service (install / update / remove)
- `Skills/SessionSkillRegistry` + `Skills/Interfaces/ISessionSkillRegistry`,
`IRepoCloner` (clone abstraction so tests inject a local source dir).
- `GitRepoCloner` (production) does `git clone` + resolves HEAD SHA.
- Install: clone → **detect layout** (`skills/*/SKILL.md` bundle → each subskill; else
root `SKILL.md` → single; else reject) → per skill parse YAML frontmatter (`name`,
`description`), copy its dir **flat** to `~/.todo-app/session-skills/<name>/`, upsert a
row with `subpath`. Reject collision with a skill from a different source; reinstalling
the same source refreshes.
- Update(sourceUrl) / Remove(sourceUrl) per spec (act on all of a source's skills).
- **Tests (Worker.Tests):** install a **multi-skill** fixture (fake cloner, mirrors
ponytail's `skills/*/SKILL.md`) → N rows + N flat dirs; install a root-`SKILL.md`
fixture → 1 row; neither → rejected; cross-source name collision rejected;
remove-by-source deletes all its dirs + rows. **No real network / no real claude CLI.**
## Task 3 — Resolution: union into ClaudeRunConfig
- Add `IReadOnlyList<string> SkillNames` to `ClaudeRunConfig` (default empty).
- In `TaskRunner.ResolveConfigAsync`: parse each level's `session_skills`, union + dedup,
filter to registry-existing names (drop + log missing).
- **Tests (Worker.Tests):** union across the three levels; dedup; unknown name dropped.
## Task 4 — Seeder
- `Skills/SessionSkillSeeder` + interface. `SeedAsync(cwd, skillNames, isWorktree, ct)`:
copy each installed skill dir → `<cwd>/.claude/skills/<name>/`; if worktree, append
`/.claude/skills/<name>/` to `git rev-parse --git-path info/exclude` target if absent.
- Wire into `TaskRunner` after run-dir resolution, before `ClaudeProcess.RunAsync`
(both worktree and sandbox paths).
- **Tests (Worker.Tests):** seeds into real temp dir; idempotent re-seed; worktree
exclude line written once and not duplicated; seeded path is git-ignored (real git
temp repo → `git status` clean for the seeded dir).
## Task 5 — Hub + DTOs + client
- `WorkerHub`: `GetSessionSkills`, `InstallSessionSkill(url)`, `UpdateSessionSkill(name)`,
`RemoveSessionSkill(name)`.
- New `SessionSkillDto`; extend `AppSettingsDto`, `ListConfigDto`, `UpdateListConfigDto`,
`UpdateTaskAgentSettingsDto` with skill-name lists; map in the update handlers.
- `IWorkerClient` + `WorkerClient` additions.
- **Update hand-rolled fakes** in Worker.Tests + Ui.Tests (memory
`iworkerclient_fakes_sync`).
- **Tests:** hub method round-trip via existing hub test harness where present.
## Task 6 — UI: registry tab + selectors
- `SessionSkillsSettingsTabViewModel` + a **Skills** tab in `SettingsModalView.axaml`:
installed list, Add (URL), Update, Remove, status line. Mirror
`FilesSettingsTabViewModel`.
- Global multi-select in General settings tab → `AppSettings.SessionSkills`.
- Skills multi-select in shared `AgentConfigEditor` (covers List + Task) with inheritance
badge, wired through `AgentConfigEditorViewModel`.
- Localization: add EN + DE keys in parity (Localization.Tests enforces).
- **Tests (Ui.Tests / Localization.Tests):** VM load/save of selections; locale parity.
- **Visual verification is Mika's** — flag the gaps.
## Task 7 — Wiring, build, end-to-end smoke
- DI registration (registry, cloner, seeder) in `Program.cs`.
- Build all touched projects `-c Release`; run Worker/Data/Ui/Localization test projects.
- Manual E2E: install ponytail via the UI, enable per-task, run a task, confirm the skill
is available to the agent and **not** committed and **not** in interactive sessions.
---
Commit per task with Conventional Commits (`feat(worker|ui|data): …`). Commit the
spec + plan docs first.
@@ -0,0 +1,88 @@
# Plan — ConPTY Interactive Sessions
Spec: `docs/superpowers/specs/2026-07-23-conpty-interactive-sessions-design.md`
Date: 2026-07-23
Execution: subagent-driven-development, sonnet model, TDD where meaningful,
build + test + commit per task. Stage files explicitly by path (never
`git add -A`). Terminal rendering is visual — flagged for the user's visual pass.
## Task 0 — Spike: embed a ConPTY terminal running `claude`
Not TDD; a throwaway proof. Add a temporary window/view that embeds each
candidate control and launches `claude` in a known worktree.
- Evaluate **SvcSystems.UI.Terminal** and **Iciclecreek.Avalonia.Terminal**.
- Acceptance: the real `claude` TUI renders correctly — colors, resize/reflow,
and a live permission prompt is usable; input reaches the CLI.
- Output: pick one library; note the control API (start with cwd/exe/args/env,
process-exited event, dispose/kill). Record the decision in the spec.
- Remove the throwaway harness before Task 1 (or keep as a manual dev sample,
not wired into the app).
**Stop for the user's visual verification of the spike before continuing.**
## Task 1 — Worker: interactive launch-spec endpoint
- Add a Worker service/hub method that, given a taskId, prepares the worktree
(session-skills seeding, agent files, MCP config, env — reuse the autonomous
run prep path) and returns a `LaunchSpec { cwd, exe, args, env }`.
- Reuse `WindowsTerminalLauncher.BuildResumeCommand` for exe/args.
- Guards mirror `ResumeTaskInTerminal` (not Running/Queued, persisted SessionId,
worktree Active/Kept). Never-run task → spec without `--resume` (fresh start).
- Tests (Worker.Tests, real SQLite/git): guard cases, spec contents for a
resumable task, fresh-start case. No real `claude` in tests.
## Task 2 — Worker: ad-hoc launch-spec
- Method to build a `LaunchSpec` for a free session in a given directory:
MCP config + env set up, no task/session-skills seeding.
- Tests: env/MCP presence, arbitrary cwd.
## Task 3 — UI: terminal host control + view model
- Wrap the chosen library in an app control/view (e.g. `InteractiveTerminalView`
+ `InteractiveTerminalViewModel`) that starts from a `LaunchSpec` and exposes
running/exited state.
- `IWorkerClient`: add methods to fetch the task and ad-hoc launch specs; wire
the SignalR client + hub method.
- Update hand-rolled `IWorkerClient`/hub fakes in BOTH test projects.
- Tests: view model starts/stops lifecycle with a fake terminal backend;
fake worker returns a spec.
## Task 4 — Command Center: host interactive panes + entry points
- `MonitorPaneView`: autonomous panes keep the streamed log; interactive panes
host the terminal control.
- Entry points: "Open interactive session" from a task (task-based) and a
"New session" action (ad-hoc, pick directory).
- Layout toggle: focus (tabs) ↔ overview (grid); reuse/extend the existing
`UniformGrid` column logic for the grid mode.
- Tests: view-model level (pane kind selection, layout toggle state). Rendering
is a visual-pass item.
## Task 5 — Remove the streaming interactive stack
Only after Tasks 14 land and the terminal path works.
- Worker: delete `StreamingClaudeSession`, `InteractiveSessionService`,
interactive `WorkerHub` methods + broadcast events, DI registrations.
Verify `LiveSessionRegistry` / `IdleSessionReaper` usage first; remove only if
unreferenced.
- UI: remove composer bits on `TaskMonitorViewModel`, the composer/queued portion
of `SessionTerminalView`, `IWorkerClient` interactive methods.
- Update fakes and delete now-dead tests. Full build + all test projects green.
## Task 6 — Docs
- Update `docs/open.md` with visual-verification items (spike render, terminal
resize/focus, grid vs tabs).
- Update affected per-project `CLAUDE.md` (Worker interactive removal, UI new
terminal host).
## Verification gates
- After Task 0: user visual pass on the spike.
- After Task 4: user visual pass on Command Center (task + ad-hoc, tabs + grid,
permission prompt round-trip).
- Never claim the terminal UI works without the user running it.
@@ -0,0 +1,169 @@
# Session Skills — Design
**Date:** 2026-07-03
**Status:** Approved (design), implementation not started
## Problem
Mika wants to give headless task agents a specific Claude skill (e.g.
[ponytail](https://github.com/DietrichGebert/ponytail)) **without** installing it
globally in `~/.claude/skills/`, where it would leak into every interactive session.
Skills should be a first-class, per-level session setting alongside `model`,
`max_turns`, and `system_prompt` — configurable **global / per-list / per-task** — and
sourced from a GitHub URL.
## Key facts that shape the design
- The Claude CLI discovers skills from two places: the **global** `~/.claude/skills/`
(every session — undesirable here) and the **working directory's** `.claude/skills/`
(plus plugins). ClaudeDo fully controls each spawned session's `WorkingDirectory`
(`ClaudeProcess.cs:30`), so a skill dropped into the session cwd is scoped to exactly
that headless run.
- **Auto-commit uses `git add -A`** (`WorktreeManager.CommitIfChangedAsync`
`_git.AddAllAsync`, `WorktreeManager.cs:142`). Anything seeded into a worktree's
`.claude/skills/` would be committed unless explicitly excluded → the seeder must add
the seeded paths to the worktree's `info/exclude`.
- A skill is not just prompt text: `SKILL.md` may reference scripts that run via Bash.
Headless agents run with `--permission-mode auto` (effectively unattended), so a skill
pulled from an arbitrary URL is **unattended third-party code execution**. This is why
install is a deliberate, pinned, reviewable step — not a live per-run URL fetch.
## Decisions (locked)
1. **Install-and-pin, not live fetch.** A dedicated registry screen installs a skill
once: clone the repo, pin to the current commit, store locally. Per-level config then
references installed skills **by name** (checkboxes), never a URL.
2. **Three levels, additive union.** Effective skill set = `global list task`.
(Unlike `model`/`prompt`, which override — skills add up. Trade-off accepted: an
inherited skill can't be switched off for a single task in the MVP.)
3. **A repo can contribute multiple skills.** Installer detects the layout:
- `skills/*/SKILL.md` (plugin bundle) → import **each** subskill flat. This is
ponytail: it ships 6 skills (`ponytail`, `-help`, `-review`, `-audit`, `-debt`,
`-gain`) under `skills/<name>/SKILL.md` plus `.claude-plugin/`, hooks, commands, an
MCP — none of which we consume; we take only the `skills/<name>/` dirs.
- root `SKILL.md` → single skill.
- neither → reject.
The CLI expects `.claude/skills/<name>/SKILL.md` **flat**, so subskills are flattened
on install. Selection is **per individual skill name** (enable just `ponytail` +
`ponytail-help` if you want, not all six).
4. **Public repos only** (plain `git clone` over HTTPS, no auth) for MVP.
> **Correction (2026-07-03, from the smoke test):** the original "one repo = one skill
> at root" MVP was wrong for the very target repo — ponytail is a multi-skill plugin.
> Decision 3 above replaces it.
## Architecture
### Storage & registry
- Each discovered skill is copied **flat** to `~/.todo-app/session-skills/<name>/` (its
own self-contained dir with `SKILL.md` at the root of that dir), so the seeder just
copies `<name>/` → cwd.
- New DB table `session_skills`, one row **per skill** (a multi-skill repo writes N rows
sharing `source_url` + `pinned_ref`): `name` (PK), `source_url`, `pinned_ref` (commit
SHA), `subpath` (dir within the repo the skill came from, e.g. `skills/ponytail` or
`.` for root), `description`, `added_at`. Repo-level ops act on all rows with the same
`source_url` (no separate sources table — keep it flat).
- New worker service `SessionSkillRegistry` (in a new `Skills/` area under the Worker):
- `InstallAsync(url)` — clone to temp → **detect layout** (`skills/*/SKILL.md` bundle
vs root `SKILL.md`) → for each discovered skill parse frontmatter (`name`,
`description`), resolve HEAD SHA as `pinned_ref`, copy its dir flat into place, upsert
a row. Returns the list of installed skill names. Name collision (a skill name from a
*different* source) → error surfaced to UI; reinstalling the same source updates.
Clone is injected (`IRepoCloner`) so tests use a local source dir — **no real network,
no real CLI**.
- `UpdateAsync(sourceUrl)` — re-clone, re-detect, refresh that source's skills +
`pinned_ref`.
- `RemoveAsync(sourceUrl)` — delete all its skill dirs + rows.
- `ListAsync()` — registry entries for the UI (grouped by source for display).
### Resolution
`TaskRunner.ResolveConfigAsync` (`TaskRunner.cs:488`) already merges
task → list → global for the other fields. Add:
```
SkillNames = Union(task.SessionSkills, listConfig?.SessionSkills, global.SessionSkills)
```
deduped, filtered to names that still exist in the registry (a removed skill is silently
dropped — logged). Add `IReadOnlyList<string> SkillNames` to `ClaudeRunConfig`
(`ClaudeArgsBuilder.cs:5`). **No CLI flag is emitted** — skills are seeded on disk, not
passed as args. `ClaudeArgsBuilder.Build` is unchanged for skills.
Per-level storage: a nullable TEXT column `session_skills` (JSON array of names) on
`tasks`, `list_config`, and `app_settings`.
### Seeding
New service `SessionSkillSeeder`, called by `TaskRunner` after the working dir is
resolved and before `ClaudeProcess.RunAsync`:
- For each resolved skill name, copy `~/.todo-app/session-skills/<name>/`
`<cwd>/.claude/skills/<name>/` (overwrite → idempotent for resume/re-run).
- If the cwd is a git worktree, append `/.claude/skills/<name>/` to the worktree's
`info/exclude` (path via `git rev-parse --git-path info/exclude`, so it targets the
per-worktree exclude), only if not already present. **Only the seeded subdirs are
excluded** — never blanket-exclude `/.claude/`, in case the target project commits its
own `.claude/`.
- Sandbox runs (not a repo) skip the exclude step.
- No separate cleanup: seeded dirs vanish with the worktree/sandbox.
### allowedTools caveat
`--allowedTools` is only emitted when set (`ClaudeArgsBuilder.cs:80`); normal task runs
leave it null → all tools allowed → the `Skill` tool is available. If a future per-task
allowedTools restriction is added, it must include `Skill`. Noted, not handled in MVP.
## UI
Mirror the existing agent-file pattern.
- **Registry screen ("extra mask"):** a new **Skills** tab in the Settings modal
(`SettingsModalView.axaml`) with `SessionSkillsSettingsTabViewModel`. **Add** (URL text
box → install a repo, which may yield several skills); lists installed skills grouped by
source (name, description, source, short ref); **Update** / **Remove** act per source
(repo). Status/error line like `FilesSettingsTabViewModel`.
- **Global selector:** multi-select (checkbox list) of installed skills in the General
settings tab → `AppSettings.SessionSkills`.
- **List + Task selectors:** add a skills multi-select to the shared
`AgentConfigEditor` control (`AgentConfigEditor.axaml` /
`AgentConfigEditorViewModel.cs`), which is already reused by both List settings and the
per-task flyout — one addition covers both levels, with the existing inheritance-badge
pattern.
### Hub / client surface
New `WorkerHub` methods + `IWorkerClient` entries (update hand-rolled fakes in both test
projects — see memory `iworkerclient_fakes_sync`):
`GetSessionSkills`, `InstallSessionSkill(url)`, `UpdateSessionSkill(sourceUrl)`,
`RemoveSessionSkill(sourceUrl)`. Extend `AppSettingsDto`, `ListConfigDto`,
`UpdateListConfigDto`, `UpdateTaskAgentSettingsDto` with the selected skill-name lists.
New `SessionSkillDto`.
## Edge cases
- **Removed skill still referenced** by a level → dropped at resolve time, logged, no
failure.
- **Name collision on install** → reject with a clear message; offer Update instead.
- **Repo without root `SKILL.md`** → reject at install.
- **Target project already has `.claude/skills/`** → additive copy; exclude only our
subdirs.
- **Resume / re-run** reuses the worktree → re-seed overwrites, exclude append is
idempotent.
## Verification (must-check, can't be unit-tested)
- **Does `claude -p` actually load and invoke a skill placed in cwd `.claude/skills/`?**
**CONFIRMED 2026-07-03.** Mika ran, in a stable terminal, a `claude -p` invocation in a
scratch cwd holding `.claude/skills/ponytail*/SKILL.md`; the model invoked the
`ponytail-help` skill and returned its exact Lite/Full/Ultra table. Headless mode does
surface cwd skills → the whole approach holds; no `CLAUDE_CONFIG_DIR` fallback needed.
- Seeded skill is **not** committed by the auto-commit step (worktree run).
- Skill does not appear in a normal interactive session (no global leak).
## Out of scope (MVP)
Private-repo auth; consuming a plugin's *non-skill* parts (hooks, commands, MCP — we take
only `skills/<name>/`); auto-update & update notifications; per-task *disabling* of an
inherited skill; surfacing skill invocation in the run log.
@@ -0,0 +1,171 @@
# ConPTY Interactive Sessions — Design
Date: 2026-07-23
Status: Approved (design), implementation not started
## Problem
The current in-app interactive session path streams `stream-json` from a
`claude` process spawned **in the Worker** and renders it as a chat log with a
composer. It does not surface permission requests, AskUser questions, and other
TUI-native interactions well — the rendering is a partial reimplementation of
what the real Claude Code TUI already does. We want full fidelity for
interactive work without rebuilding the TUI.
## Decision
**Hybrid execution model:**
- **Autonomous queue tasks** (`Status=Queued`, picked by the queue): unchanged.
Headless `stream-json`, full orchestration (status flow, diff, review, merge).
- **Interactive sessions**: an **embedded ConPTY terminal** running the real
`claude` CLI, rendered in the **UI process**. Full TUI fidelity (permission
prompts, questions, colors, everything the standalone CLI does). Detached from
the review/merge/status machinery — these are a manual cockpit.
This is the third direction for interactive (external `wt` terminal → streaming
chat → embedded ConPTY). The streaming interactive stack is **removed**, not run
in parallel — accepted as discarded work in exchange for one interactive path
and full fidelity.
## Architecture
### Process location
ConPTY terminal controls render in-process and spawn their child (`claude`) as a
child of the host process. Therefore interactive sessions move **out of the
Worker and into the UI process**. They no longer flow over SignalR. This mirrors
the existing `ResumeTaskInTerminal` behavior (launch real `claude`), but embedded
instead of via external `wt.exe`.
### Worktree preparation (task-based sessions)
Interactive task sessions get the **same worktree preparation as autonomous
runs**: session-skills seeding, agent files, MCP config, environment. The Worker
performs the prep and returns a launch spec to the UI:
```
LaunchSpec {
cwd: string // worktree path
exe: string // resolved claude executable / shell
args: string[] // e.g. --resume <sessionId>
env: Dictionary<string,string>
}
```
The command construction reuses `WindowsTerminalLauncher.BuildResumeArgs`/`Resolve`.
Guards mirror `ResumeTaskInTerminal` for Running/Queued (rejected). Worktree
handling (FINAL):
- Existing Active/Kept worktree + persisted SessionId → `--resume <id>`.
- No usable worktree but the list has a WorkingDir (git repo) → create a worktree
**on demand** via `WorktreeManager.CreateAsync` (the same path autonomous runs
use), then a fresh-start spec. This lets never-run tasks be opened interactively.
- Fresh (non-resume) session → the task's prompt (title + description) is passed
as claude's positional prompt so the session starts on the task.
- No worktree and no WorkingDir → clear error.
Interactive sessions are detached: ClaudeDo does NOT record their claude session
id (ConPTY is opaque, no stream-json), so resuming a specific past interactive
conversation is only via claude's own `--continue`/`--resume` in the worktree dir.
### Free / ad-hoc sessions
In addition to task-based sessions, the user can open an ad-hoc terminal in a
chosen directory (no task). These also get MCP config + env set up so the
`claudedo` tools are available, but no per-level session-skills seeding tied to a
task.
### Terminal host control — RESOLVED by spike (2026-07-23)
**Library: `Iciclecreek.Avalonia.Terminal` 2.0.3** (namespace `Iciclecreek.Terminal`).
It needs Avalonia >= 12.0.2; the repo is on 12.0.4 → compatible, no bump.
`SvcSystems.UI.Terminal` (latest) needs Avalonia 12.1+ → rejected.
Visual pass (user, 2026-07-23): the real `claude` TUI renders correctly inside
the embedded control — Claude Code opened and was usable.
**Binding approach — use the library's own `LaunchProcess()` (FINAL).**
An initial attempt drove `Porta.Pty` ourselves (own read loop, key tunneling via
`GenerateKeyInput`/`GenerateCharInput`, manual resize) to bypass
`LaunchProcess()` and inject a custom `PtyOptions.Environment`. That was a
mistake: it rendered wrong, lagged, and dropped input. The spike had proven the
library's own `TerminalControl.LaunchProcess()` pipeline renders correctly, stays
responsive, and handles input/resize/focus. So `PtyTerminalSession` is a thin
wrapper (`src/ClaudeDo.Ui/Services/PtyTerminalSession.cs`):
- Set `control.Process = descriptor.Exe`, `control.Args = descriptor.Args`,
`control.StartingDirectory = descriptor.Cwd`, then `await control.LaunchProcess()`.
- Relay the control's own `ProcessExited` event and `Kill()`.
- `Process=""` stays on the AXAML `TerminalControl` to suppress the library's
auto-launch-on-load, so exactly one process starts (our manual launch).
**Environment:** `LaunchProcess()` gives no per-launch env dict, but
`Porta.Pty.SpawnAsync` inherits the *current process* environment. So apply
`descriptor.Env` entries via `Environment.SetEnvironmentVariable(key, value)`
(process scope) before `LaunchProcess()`. The only var needed is
`MCP_TOOL_TIMEOUT`; session-skills/agent-files/MCP-config are on disk / globally
registered, independent of env. (The earlier "child gets zero env vars" claim was
wrong — Porta.Pty seeds from the process env.)
**Sizing gotcha (critical):** the control derives Cols/Rows from
`arranged-size / character-cell-size`. Without an EXPLICIT monospace font the cell
metrics are wrong and the child TUI renders into the wrong area. Set
`FontFamily="Cascadia Mono,Consolas,monospace"`, `FontSize`, `BufferSize`, and
`HorizontalAlignment/VerticalAlignment=Stretch` on the `TerminalControl` (matching
the spike) — this is what made rendering correct in the pane.
**Lesson:** do not hand-roll pty/input/render around this control — use its
`LaunchProcess()` pipeline.
### Command Center layout
- `MonitorPaneView` keeps the streamed log for autonomous tasks.
- Interactive panes host the terminal control instead of the log+composer.
- Layout is **toggleable**: focus mode (tabs, one session large) ↔ overview mode
(grid, several sessions at once).
## Removals
Worker:
- `StreamingClaudeSession`, `InteractiveSessionService`
- `WorkerHub` interactive methods: `OpenInteractiveTerminal`,
`SendInteractiveMessage`, `RemoveQueuedInteractiveMessage`,
`StopInteractiveSession`, `InterruptInteractiveSession`
- Broadcast events: `InteractiveSessionStarted/Ended`, `InteractiveQueueChanged`,
`InteractiveMessageSent`
- `IdleSessionReaper` and `LiveSessionRegistry` **iff** unused elsewhere
(verify during implementation — do not delete blindly).
UI:
- Composer on `TaskMonitorViewModel`: `ComposerDraft`, `SubmitComposerCommand`,
`InterruptInteractiveCommand`, `StopInteractiveCommand`, `QueuedMessages`,
`IsInteractiveLive`.
- The composer + queued-messages portion of `SessionTerminalView` (the log
portion stays for autonomous panes).
- `IWorkerClient` interactive methods.
## Open items (implementation time)
- Whether `LiveSessionRegistry` is referenced outside the interactive path.
- Session-id availability for a never-run task (no `--resume` → start fresh).
Resolved: env approach (see Terminal host control — add custom vars on top of the
inherited process env via `PtyOptions.Environment`); library + binding seam.
## Non-goals
- No screen-scraping of terminal output back into task status/diff/review.
- No change to the autonomous queue execution path.
## Status (2026-07-23)
Implemented on main (not pushed) and visually verified by the user (rendering,
input, responsiveness correct after switching to `LaunchProcess()` + setting a
monospace font). Done: worker launch-spec (task + ad-hoc, on-demand worktree,
prompt seeding), UI terminal host, Command Center hosting (grid↔tabs), streaming
stack removed. Permission mode: left to claude's default (not forced), per user.
Deferred: **Avalonia 12.1 upgrade** — blocked, not adopted. 12.1's XAML source
generator needs Roslyn 4.14 (.NET 9.0.3xx SDK); the repo pins .NET 8 in
`global.json`, and bumping the SDK floor risks the Gitea Actions release build.
Staying on Avalonia 12.0.x (Iciclecreek 2.0.3 works there). Revisit only with a
deliberate SDK-floor decision.
@@ -0,0 +1,61 @@
# ConPTY Planning Sessions — Design (2026-07-24)
**Task:** `5d627df8` — interaktive Planning-Session über embedded ConPTY statt externem `wt`-Fenster.
## Problem
Planning-Sessions (`StartPlanningSession`/`ResumePlanningSession`) öffnen heute ein externes
Windows-Terminal (`WindowsTerminalLauncher``wt.exe`). Seit ConPTY existiert (embedded
claude-TUI im UI-Prozess, Command Center), soll die interaktive Planning-Session denselben
Weg nutzen: konsistente UX, keine externen Fenster.
## Approved decisions (Brainstorm 2026-07-24)
- **Env-Isolation:** Prozess-global akzeptiert (Sessions werden sequenziell per Klick geöffnet;
jedes claude-Child snapshottet Env beim Spawn). Keine Änderung an `PtyTerminalSession`.
- **wt-Launcher:** Code bleibt; nur das Routing für Planning wird auf ConPTY umgestellt
(kein Rip-out von `LaunchPlanningStart/ResumeAsync`).
- Planning-Kachel im Command Center (Mission Control), wie andere ConPTY-Sessions.
Finalize/Discard/Queue-Plan bleiben unverändert auf den bestehenden Buttons.
## Change map
### Worker
1. `WindowsTerminalLauncher`: Planning-Start-Args in einen bare Builder
`BuildPlanningStartArgs(PlanningSessionStartContext) -> IReadOnlyList<string>` herausziehen
(analog `BuildResumeArgs`); `BuildPlanningStartCommand` nutzt ihn weiter (wt unverändert).
Resume-Args `BuildPlanningResumeArgs(sessionId) = ["--permission-mode","plan","--resume",id]`
(bisher inline in `LaunchPlanningResumeAsync`).
2. `InteractiveLaunchSpecService`: `BuildPlanningStart(PlanningSessionStartContext) -> LaunchSpec`
und `BuildPlanningResume(PlanningSessionResumeContext) -> LaunchSpec` — resolve claude,
Args aus (1), Env `MAX_THINKING_TOKENS=20000` + `CLAUDEDO_PLANNING_TOKEN=<token>`
(+ `MCP_TOOL_TIMEOUT` wie interaktiv), Cwd = ctx.WorkingDir. Nimmt den Kontext (keine
Manager-Kopplung).
3. Hub: `GetPlanningStartLaunchSpec(taskId) -> LaunchSpec` (ruft `_planning.StartAsync`,
broadcastet `TaskUpdated`, baut Spec; bei Fehler discard+rethrow wie heute),
`GetPlanningResumeLaunchSpec(taskId) -> LaunchSpec` (ruft `_planning.ResumeAsync`).
### UI
4. `IWorkerClient`/`WorkerClient`: `GetPlanningStartLaunchSpecAsync`/`GetPlanningResumeLaunchSpecAsync`
(mirror `GetInteractiveLaunchSpecAsync`).
5. `MissionControlViewModel`: `OpenPlanningConPtySessionAsync(taskId, resume)` — dedupt nach
TaskId, holt die Planning-Spec, baut `TerminalLaunchDescriptor``ConPtyPaneViewModel`
(Titel „<task> (Planning)").
6. `TasksIslandViewModel`: `OpenPlanningSessionAsync`/`ResumePlanningSessionAsync` (Resume-Zweig
der `UnfinishedPlanningModal`) öffnen die Planning-ConPTY-Kachel via neuem Event
`OpenPlanningConPtyRequested(taskId, resume)`, statt `StartPlanningSessionAsync`/wt.
`IslandsShellViewModel` verdrahtet das Event → `OpenMissionControl()` +
`MissionControl.OpenPlanningConPtySessionAsync`.
### #12 (Nebenbefund)
MCP-Permission-Prompt trotz `--allowedTools "mcp__claudedo__*"`: im interaktiven ConPTY vom
User bestätigbar (kein Blocker wie headless). Beim Testen prüfen, ob der Glob den Prompt in
der aktuellen CLI unterdrückt; falls nicht, allowedTools/`--permission-mode`-Kombi nachziehen.
## Out of scope
- Entfernen des wt-Codes / `ResumeTaskInTerminal`.
- Per-Child-Env-Isolation in `PtyTerminalSession`.
- Änderungen an Finalize/Discard/Queue-Plan-Lifecycle.
## Verification
- Build Worker + App (`-c Release`), Worker.Tests + Ui.Tests grün.
- Visual (User): Planning-Start öffnet Command-Center-Kachel mit claude-TUI im Plan-Modus;
create_child_task erzeugt Draft-Kinder live; Resume greift die Session; kein wt-Fenster.
+113
View File
@@ -0,0 +1,113 @@
# Verifikations-Handoff (Stand 2026-07-24)
Manuelle Verifikation am laufenden System. **Mika bedient die UI, die Session protokolliert Pass/Fail** und bereitet Fixtures vor (Tasks via ClaudeDo-MCP, Git-Setups im Testrepo). Aktive Findings landen in `docs/open.md`; hier steht der Fortschritt je Abschnitt.
## Handoff für die nächste Session
**Erledigt (2026-07-24):** §1 Detail-Insel/Diff-Viewer (bis auf DiffModal-Fehler-State), §2 Worktree-Pipeline (alle 3), §3 Planning-Walkthrough (inkl. UnfinishedPlanning-Modal: dismiss/Finalize/Discard PASS, **Resume BUG**), §4 Merge-Editor (Single-Task **und** Planning-Unit-Konflikt **und** Abort), §6 Pick-up-Gating (Code), §7 AskUser (Happy-Path + Timeout + UI-Cleanup; Finding: Banner nur in Mission Control), §8 Session Skills (Install/Aktivierung/Seeding/Gegenprobe/Remove; Findings: fehlender Empty-State + abweichendes Agent-Gear-Icon), §9 Attachments (Drag&Drop-UI + MCP + ComposedPreview; Finding: intermittenter erster-Drop-Fehler), §12 RunNow (moot).
**Noch offen:**
- **§10 Daily Prep/Weekly** — **Bewusst zurückgestellt (2026-07-24)**: Mika will Daily Prep + Weekly Report ohnehin überarbeiten — Verifikation lohnt erst nach dem Rework.
- **§11 Self-Update/Autostart** — **Nicht formell gefahren, aber laut Mika „läuft bisher sehr gut" (2026-07-24)** → als OK behandelt; bei Bedarf später gezielt nachtesten.
- ~~**Kanten:** §1 DiffModal-Fehler-State, §3 UnfinishedPlanning-Modal, §4 Abort~~ — **alle erledigt (2026-07-24)**: §4 Abort PASS, §3 Modal (Finalize/Discard PASS, Resume BUG), §1 via Code-Analyse geklärt (defensiv/unerreichbar).
**Vorbedingungen:** Worker + App laufen (SignalR 37821, External MCP 47822 — lt. `~/.todo-app/worker.config.json`). Testliste **`ClaudeDoTests`** (`C:\TestRepos\ClaudeDoTests`, listId `e7992fee6035448394b646d069690e05`) für zerstörungsfreie Runs.
**Wichtige Gotchas / Lessons (diese Session):**
- **NIE `model:"haiku"` für schreibende Task-/Verifikations-Runs** — unter dem Default `--permission-mode auto` werden haiku-Writes denied (still no-op). Immer **sonnet**. (Memory `auto_permission_haiku_footgun`.)
- **Merge-Preflight blockt bei dirty Ziel-Working-Tree** (getrackte uncommittete Änderung im `main`-Checkout) — und **Approve schluckt das still** (Bug, open.md). Vor Merge-Checks `git -C C:\TestRepos\ClaudeDoTests status --short` prüfen; fremde WIP nur mit Rücksprache verwerfen (Memory `shared_worktree_partial_commits`: nur pfad-scoped committen).
- **Konflikt-Fixture-Rezept:** Task (sonnet) überschreibt eine getrackte Datei im Branch → danach dieselbe Datei auf `main` divergent ändern + `git commit -- <pfad>` → Approve konfliktet. Für Planning-Unit-Konflikt: main-Edit erst scharfschalten, wenn der Parent in WaitingForReview steht.
- **Datenwahrheit** notfalls direkt aus der DB: `sqlite3 -readonly ~/.todo-app/todo.db "SELECT substr(id,1,8),status,planning_phase,substr(blocked_by_task_id,1,8),title FROM tasks WHERE …"`.
**Testrepo-/Fixture-Zustand:** Aufgeräumt (2026-07-24, §7+§8-Session-Ende) — alle `verif §7/§8`-Tasks gelöscht, deren Worktrees + Branches entfernt, `ClaudeDoTests`-`main` unangetastet bei `ecad650` (Tree clean; die §7-Runs liefen isoliert in Worktrees, main nie berührt). ponytail-Skills nach dem Remove-Test wieder deinstalliert (`session_skills` leer, `~/.todo-app/session-skills/` leer). Keine `verif`-Tasks und keine claudedotests-Worktrees übrig. Die übrigen `claudedo/*`-Branches im Testrepo stammen aus früheren Sessions — nicht anfassen. **Die nächste Session baut Fixtures frisch** (Rezepte s. Gotchas oben).
**Erfasste Folge-Tasks** (Liste „Claude do", Idle, brauchen Brainstorm vor Umsetzung): `f9809a93` Approve erzwingt Diff/Review vor Merge (+ blocked-Merge-Silent-Fail-Fix), `5d627df8` Planning-Session über embedded ConPTY statt wt (+ Planning-Permission-Prompt).
**Fix-Session:** Alle fixbaren Findings sind für eine frische Session in **`docs/fix-plan-2026-07-24.md`** aufbereitet (gruppiert nach Fixbarkeit: A mechanisch, B error-surfacing, C entscheidungsbedürftig, D investigation, E nits). Volltext je Finding bleibt in `docs/open.md`.
**Nacharbeit:** Erledigtes aus `docs/open.md` austragen; dieses File löschen, sobald §10 (nach Rework) + evtl. §11-Nachtest erledigt sind.
---
## 1. Detail-Insel & Diff-Viewer (reines Durchklicken)
- [~] Detail-Insel komplett: Output/Git/Session-Tabs, Merge-Sektion, Agent-Settings-Overrides (InheritedBadge korrekt), Prep-Panel — nach dem VM-Split (`DetailsIslandViewModel` → Sektions-VMs) alles gebunden, keine leeren Panels. — **TEILWEISE (2026-07-24, User-Sichtprüfung an `verif §1 diff matrix`):** Output/Git-Tabs, Merge-Sektion, Agent-Badges vorhanden & gebunden, keine leeren Panels. Git-Tab: `+1 37`, „merges cleanly" korrekt. **BUG:** OUTCOME-Karte zeigt rohes JSON (s. open.md). Session-Tab fehlt — **erwartet** (nur bei Parent mit Kindern, `HasChildOutcomes`; wird in §4/§3 mit echtem Parent geprüft). Minor: TurnsText `0/max` bei terminalem Reload (open.md). Prep-Panel → §10.
- [~] Diff-Viewer: Dateiliste, Added/Deleted/Renamed/Binary-Erkennung, Commit-Range-Diff nach einem Merge. — **Added/Deleted/Binary PASS**; **Renamed** erkannt + „R"-Badge, aber schwach dargestellt (kein alt→neu-Pfad, „+0 0" — nit, s. open.md); „Review Combined Diff" korrekt ausgegraut (kein Planning-Parent). **Commit-Range-Diff nach Merge: PASS (2026-07-24)** — Diff des gemergten Done-Tasks rendert über `base..head` trotz entferntem Worktree.
- [x] DiffModal-Fehler-State: Commit-Range ohne aufgezeichnete Commits → „Diff nicht mehr verfügbar" statt Crash/leer. — **GEKLÄRT via Code-Analyse (2026-07-24): der Fehler-State ist defensiv/unerreichbar.** `vm.diff.unavailable` (DiffViewerViewModel.cs:117-119) feuert nur bei `FromCommitRange && (BaseRef==null || HeadCommit==null)` oder `WorktreePath==null`. Alle Aufrufer sind gegated: `MergeSectionViewModel.OpenDiffAsync` ruft `ConfigureCommitRange` nur unter `CanDiffMergedRange` (base **und** head non-null) und `ConfigureWorktree` nur unter `hasLiveWorktree` (Pfad non-null + existiert); `WorktreesOverviewModalViewModel` übergibt `row.Path` (non-null). Damit können die Null-Checks über die UI nie wahr werden — der „Crash/leer"-Fall, den der Check absichern wollte, ist durch die CanExecute-/Modus-Gates ausgeschlossen. (Fehlende Commit-Objekte bei vorhandenem base+head → `GetCommitRangeDiffAsync` wirft → „loadFailed", nicht „unavailable".) Nicht manuell auslösbar; kein Bug.
- [x] „children need attention"-Band auf dem Session-Tab eines Parents mit failed/blocked Kind. — **PASS (2026-07-24, in §3)**: Band + OUTCOMES-Liste mit Roadblock-Hinweis auf dem Session-Tab des Planning-Parents (`verif §3`, Roadblock-Kind).
## 2. Worktree-Pipeline (3 falsifizierbare Fälle)
- [x] Happy-Path: Task mit WorkingDir → `worktrees.state='active'`, `head_commit` gesetzt, `diff_stat` non-empty, Branch `claudedo/<id[:8]>` existiert auf Disk. — **PASS (2026-07-24)** via Task `e63eb2f5` (sonnet): Worktree active, `headCommit 8a3ae86` (ahead=1 vom Base), `diff_stat` non-empty (`review-cancel.txt`), Branch `claudedo/e63eb2f5…` auf Disk. (Mein erster Versuch mit `model=haiku` schlug fehl — das war ein haiku/auto-Footgun, keine Pipeline-Sache; s. open.md.)
- [x] No-Changes-Run: → `status='Done'`, `head_commit IS NULL`, `diff_stat IS NULL`. — **PASS (2026-07-24)**; Präzisierung: aktueller Flow endet in `WaitingForReview` (nicht `Done`, das ist erst nach Approve) — Doc-„Done" ist veraltet. Kein neuer Commit, leerer Diff bestätigt.
- [x] Kein Git-Repo (WorkingDir = `C:\Temp`): → `status='Failed'`, KEINE `worktrees`-Row, Git-Fehler im Log. — **PASS (2026-07-24)**; Fehler: „Worktree creation failed: working_dir is not a git repository".
## 3. Planning-Flow-Walkthrough
- [x] Draft → Finalize → Kette: Finalize queued NICHT automatisch (Kinder bleiben Idle); „Queue plan" setzt alle nicht-terminalen Kinder Queued, Kette läuft sequenziell durch (blocked-by löst sich je Vorgänger). — **PASS (2026-07-24, End-to-End mit `verif §3`)**: 3 Kinder gedraftet, Finalize → Parent WaitingForChildren+finalized, Kinder Idle+Kette (clean→conflict→roadblock), Queue plan → sequenzieller Durchlauf, alle Done. **Begleit-Findings (open.md):** „Waiting for Improvements"-Mislabel, Kind-Badge-Live-Refresh (Draft→Planned erst nach Listenwechsel), Kette nicht visualisiert, planning-aktiver Parent zeigt „Idle", Dequeue-X fehlt auf wartenden Kindern, Planning-Permission-Prompt, Planning nutzt wt statt ConPTY.
- [x] Parent landet nach letztem terminalen Kind in WaitingForReview; Approve merged die ganze Unit (Parent-Worktree falls Active + jedes Done-Kind in Reihenfolge). — **PASS (2026-07-24)**: Parent → WaitingForReview auch mit Roadblock-Kind; Approve → Unit-Merge (child-clean clean, child-conflict → Konflikt-Editor pro Subtask → aufgelöst → Continue, child-roadblock no-op) → Parent Done, Merge gelandet.
- [x] UnfinishedPlanning-Modal: Resume / FinalizeNow / Discard. — **GETESTET (2026-07-24, `verif §3 unfinished-planning` + `verif §3 resume-discard`)**: Modal wird via Rechtsklick→„Resume planning session" ausgelöst, zeigt Titel + „N draft task(s) waiting to be finalized" + Buttons Discard/Finalize/Resume + ×. **× (dismiss)**: No-op (State bleibt `active`). **Finalize**: Parent → `finalized`+`WaitingForChildren`, Kinder Idle+Blocked-by-Kette (= Planned) — PASS. **Discard**: Draft-Kinder gelöscht, Parent → `none`+`idle` — funktional PASS. **Resume: BUG — macht nichts** (`planning_session_id` nie erfasst → `ResumeAsync` wirft „No Claude session ID captured yet", vom UI im leeren `catch` verschluckt; s. open.md). Beide State-ändernden Aktionen reproduzieren das Kind-Rows-Live-Refresh-Finding (Finalize: Badges stale; Discard: gelöschte Rows bleiben bis Reload; open.md).
## 4. Merge-Editor (Rider-Style 3-Pane) mit echtem Konflikt
Konflikt provozieren: gleiche Datei auf main ändern, während der Task-Branch sie ändert. Beide Wege testen: **(a)** Single-Task-Approve mit Konflikt, **(b)** Planning-Unit-Merge mit Konflikt in einem Subtask (`PlanningMergeConflict` → Editor öffnet pro Subtask).
**Verifiziert 2026-07-24 (Single-Task-Approve mit Konflikt, 2 Dateien, `verif §4`): End-to-End PASS** — Approve→Konflikt→3-Pane-Resolver→beide Dateien auflösen→Continue→Merge→Task Done (Merge-Commit gelandet). Sauberer additiver Approve (`verif §1b`, kein Konflikt) → direkt gemergt → Done, kein Editor: **PASS (2026-07-24)**. ⚠ **Vorbedingung-Fund:** ein dirty Ziel-Working-Tree (getrackte uncommittete Änderung) blockt den Merge und Approve schluckt das **still** (s. open.md „Approve & Merge schluckt blocked"). Planning-Unit-Merge-Konflikt (Weg b): **PASS (2026-07-24, in §3)** — Approve eines Planning-Parents mit einem konfliktenden Subtask öffnet den 3-Pane-Editor pro Subtask (`PlanningMergeConflict`), Continue führt den Unit-Merge fort → Parent Done.
- [x] Drei Panes: MAIN read-only | Result editierbar | INCOMING read-only; Konfliktblöcke rot, aufgelöst grün, in allen Panes. — **PASS**.
- [x] Gutter-Toggle ``/``: Seite rein/raus, Klickreihenfolge = Reihenfolge im Result; main/incoming/beide/keine möglich. — **PASS**.
- [x] Nur Konfliktregionen im Result editierbar (Stable read-only); Edits fließen in den Block zurück. — **PASS**.
- [~] Synchrones vertikales Scrollen; File-Switcher bei mehreren Dateien; `M conflicts · K resolved`-Readout; Conflict-Ruler (Klick springt). — **PASS**, aber **Multi-File schlecht erkennbar** (2 Konfliktdateien schwer zu sehen — UX-Nit, open.md).
- [~] Continue erst aktiv, wenn ALLE Konflikte in ALLEN Dateien gelöst; Binär-Guard greift. — **funktional PASS** (merged erst nach Auflösung beider Dateien), aber **Button ist klickbar statt disabled** solange offen → stummer No-op (UX-Bug, open.md). Binär-Guard hier n/a.
- [x] Abort: Tree sauber, Task bleibt WaitingForReview. — **PASS (2026-07-24, `verif §4 abort`)**: Single-Task-Approve mit divergentem main→Konflikt→3-Pane-Editor→**Abort**: Editor schließt, Task bleibt `WaitingForReview`, `main`-Tree sauber (kein `MERGE_HEAD`, kein dirty), `main`-Inhalt + HEAD unverändert.
- [FEATURE-WUNSCH] farbliches Hervorheben der übernommenen/eingefügten Zeilen im Result-Pane (open.md).
- Bekannte Kanten (nur gegenprüfen, nicht als Fail werten): leere Ours-Seite → null-lange Result-Region (Accept geht, Handtippen fummelig); Gutter-Y-Ausrichtung bei sehr hohen Fenstern/großem Scroll; vertikaler Drift nachfolgender Blöcke nach Konflikt mit ungleicher Zeilenzahl.
## 5. Embedded ConPTY / Mission Control
- [x] **Kritisch:** Task-basiert (Kontextmenü „Open ConPTY session"): frischer Task → Worktree wird on-demand angelegt, `claude` startet — Task-Prompt wirklich GESENDET. — **PASS (2026-07-24)**: Agent antwortete mit dem Marker `CONPTY-PROMPT-RECEIVED-4Q7`, Worktree on-demand angelegt.
- [~] Ad-hoc: „New session"-Button → Ordnerwahl → freie Session im gewählten Verzeichnis. — **funktioniert, aber Button unsichtbar**: `Icon.Plus` ist Strich-Only → `PathIcon` rendert nichts (Bug, open.md). Über Tooltip/Klick auf die leere Header-Fläche erreichbar; Ordnerwahl + Ad-hoc-Session funktionieren.
- [x] Grid↔Tabs-Toggle; Close killt den Prozess + entfernt die Kachel; mehrere Sessions parallel; Pane-Resize reflowt das TUI. — **PASS (2026-07-24)**: Resize/Reflow ok; Close entfernt Kachel UND killt den Prozess (verifiziert: ConPTY-PID 50964, Kind von ClaudeDo.App, nach Close tot).
- [~] Resume: im Worktree-Dir per `claude --continue` möglich (ClaudeDo persistiert die ConPTY-Session-Id bewusst nicht). — **wie designt**: erneutes „Open ConPTY session" resumt NICHT, sondern startet frisch und **sendet den Prompt erneut** (UX-Falle, open.md). In-App-Resume gibt es nicht; nur claude-eigenes `--continue`/`--resume` im Worktree-Dir.
## 6. Pick up in terminal
- [x] Sichtbarkeit: Kontextmenü-Eintrag + Terminal-Button (ArrowOut) NUR bei WaitingForReview und Failed; bei Idle/Running/Queued/Done nicht. — **PASS (2026-07-24, Code+Test)**: `CanPickUpInTerminal => Status is WaitingForReview or Failed` (TaskRowViewModel.cs:69, DetailsIslandViewModel.cs:898), gebunden in TaskRowView.axaml:56 + TaskHeaderBar.axaml:34, Notify bei Statuswechsel, Unit-Test `CanPickUpInTerminal_OnlyForReviewOrFailed`. (Klick→Terminal + Fehler-Surfacing bleiben manueller UI/CLI-Check.)
- [ ] Klick → neues Windows-Terminal im Worktree-Verzeichnis, `claude --resume <id>` nimmt die Session mit Kontext wieder auf.
- [ ] Fehlerfälle surfacen sauber (Footer-Strip bzw. Fehlerdialog): laufende/gequeuete Task, keine persistierte Session-Id, kein aktiver Worktree.
- Bekannte Kante: parked-Idle (reject-park) hat oft Session+Worktree, zeigt die Aktion aber bewusst NICHT (Idle nicht unterscheidbar). Nervt das in der Praxis → `CanPickUpInTerminal` erweitern.
## 7. AskUser (Frage aus laufendem Task)
Runtime-Toolname ist `mcp__claudedo_run__ask_user` (snake_case, nicht `AskUser`). Fixture: sonnet-Task mit Prompt „zwei sich widersprechende, irreversible Optionen — du MUSST `ask_user` fragen, nicht raten" erzwingt den Call zuverlässig.
- [x] Task, dessen Prompt eine Rückfrage erzwingt → Frage erscheint im Task-Monitor (Mission Control), Prozess wartet. — **PASS (2026-07-24, `verif §7 askuser 2`)**: Banner in Mission Control, Run blockiert im `ask_user`-Tool-Call. **BUG:** in der Task-Detail-Insel erscheint KEIN Banner (nur Mission Control) → s. open.md.
- [x] Antwort inline absenden → Run läuft mit der Antwort weiter. — **PASS (2026-07-24)**: Antwort „A" inline gesendet → Agent bekam „option A", benannte `merge-playground.txt``renamed-by-agent.txt` um, schrieb `askuser-result.txt` = „USER CHOSE: A", Task → WaitingForReview.
- [x] Timeout-/Cleanup-Verhalten der PendingQuestionRegistry (Frage unbeantwortet lassen): Task schlägt kontrolliert fehl, UI räumt die Frage auf (MCP_TOOL_TIMEOUT-Gotcha). — **PASS (2026-07-24)**: Backend (`verif §7 askuser`) nach exakt 3 min Fallback zurück, Agent hielt sich an „MUST NOT guess", meldete `CLAUDEDO_BLOCKED`, Repo untouched, Registry im `finally` aufgeräumt, Run endete `success` → WaitingForReview. **UI-Cleanup visuell bestätigt** (`verif §7 timeout-ui`, MC-Kachel offen/subscribt bis zum Timeout): Banner verschwindet beim Timeout automatisch (`TaskQuestionResolved``ClearPendingQuestion`).
## 8. Session Skills (E2E + UI)
- [x] Settings → Skills: `https://github.com/DietrichGebert/ponytail` installieren → 6 Skills erscheinen (ponytail, -help, -review, -audit, -debt, -gain), auf Commit gepinnt, Dateien unter `~/.todo-app/session-skills/<name>/`. — **PASS (2026-07-24)**: 6 Rows in `session_skills`, alle auf Commit `16f29800` gepinnt, `subpath=skills/<name>`, Dateien inkl. `SKILL.md` am erwarteten Ort. UI-Install nahm die URL an. **Nit:** Skills-Tab hat keinen Empty-State (s. open.md).
- [x] Skill per-Task (Agent-Settings-Flyout) oder global aktivieren → Task laufen lassen → im Worktree liegt `.claude/skills/<name>/`, Agent kann ihn nutzen, `git status` im Worktree bleibt sauber (info/exclude greift). — **PASS (2026-07-24, per-Task, `verif §8 skill-activate`)**: `ponytail-help` per Flyout aktiviert (`task.SessionSkills=["ponytail-help"]`), Run → `.claude/skills/ponytail-help/SKILL.md` im Worktree, `info/exclude` bekam `/.claude/skills/ponytail-help/`, `git status` clean, Auto-Commit enthält NUR `skill-proof.txt` (Skill NICHT im Tree). Agent hat den Skill nachweislich genutzt (`skill-proof.txt` = ponytail-help-Referenzkarte verbatim). Global-Aktivierung (AppSettings.SessionSkills, General-Tab) nutzt denselben Seeding-Union-Pfad — funktional äquivalent, nicht separat gefahren.
- [x] Gegenprobe: nicht-aktivierte/andere interaktive Session sieht den Skill NICHT (kein Leak nach `~/.claude`). — **PASS (2026-07-24)**: `~/.claude/skills/` enthält nur die vorbestehenden globalen Skills, KEIN ponytail. Seeder schreibt per Konstruktion nur nach `<workingDir>/.claude/skills` (SessionSkillSeeder), nie nach `~/.claude`.
- [~] UI: Skills-Tab (Install-Zeile, Karten mit Update/Remove), Checkbox-Listen im General-Tab + AgentConfigEditor (Flyout-Höhe!), leerer Zustand (0 Skills — Empty-State fehlt evtl., dann entscheiden), lange Namen/URLs (Trimming). — **TEILWEISE (2026-07-24)**: Install-Zeile nimmt URL an (PASS); AgentConfigEditor-Flyout-Checkbox-Liste zeigt alle 6 Skills, Höhe ok, Trimming ok (User: „funktioniert wie erhofft"). **Empty-State fehlt** (nackte Fläche — open.md). **Agent-Settings-Gear ⚙ weicht vom Listen-Gear ab** (open.md). Skills-Tab-**Karten** (Name/Beschreibung/Pinned-Commit + Update/Remove) und **General-Tab-Checkbox-Liste** (6 Skills) sichtgeprüft (User: „sieht alles gut aus"). **Remove PASS (2026-07-24)**: ein Remove-Klick auf eine ponytail-Karte entfernte alle 6 Skills per Quell-URL (`session_skills` leer, alle Verzeichnisse unter `~/.todo-app/session-skills/` weg). **Update** nicht separat gefahren (Code-Pfad `SessionSkillRegistry.UpdateAsync`).
## 9. Attachments (Drag & Drop + MCP)
- [x] Drop aufs Detail-Pane: „Drop to attach"-Overlay, Datei erscheint in der Liste, landet unter `~/.todo-app/attachments/<taskId>/`; „Add file…"-Picker; Remove-Button. — **PASS (2026-07-24, `verif §9 attachments-ui`)**: Overlay/Highlight beim Drüberziehen, Drop-Round-Trip (`drop-me.txt` in Liste + Disk + DB, 29 B), „Add file…"-Picker (`pick-me.md`), Remove (Datei aus Liste + Disk + DB) — alle bestätigt. **Finding:** der ALLERERSTE Drop der Session schlug einmalig mit inline „An error occurred" fehl (nichts persistiert), danach fehlerfrei — intermittierend, nicht reproduzierbar (s. open.md).
- [x] `ComposedPreview` enthält die Attachment-Pfade („## Reference files"). — **PASS (2026-07-24, Code+Test)**: TaskPromptComposer.cs:31 emittiert „## Reference files", ComposedPreview reicht Pfade durch, TaskRunner.cs:132 injiziert zur Laufzeit; TaskPromptComposerTests decken es ab.
- [x] MCP: `add_task_attachment` / `list_task_attachments` / `remove_task_attachment`; Running-Task verweigert add/remove. — **PASS (2026-07-24)** für add/list/remove-Round-Trip inkl. Datei unter `~/.todo-app/attachments/<taskId>/` (71 B, korrekt, nach Remove weg). Running-Task-Verweigerung ist code-guarded (AttachmentMcpTools), aber ohne dauerhaft laufende Task nicht live geprüft → manueller Rest.
## 10. Daily Prep (Prime) & Weekly Report
- [ ] Prime-Trigger: Schedule feuert bzw. „Plan day" manuell → Prep-Log streamt live, `daily-prep.log` enthält letzten Run, MyDay-Auswahl respektiert `DailyPrepMaxTasks`.
- [ ] Weekly Report: Range-Default „seit letztem Standup-Wochentag → heute", Markdown rendert, Cache pro Range.
## 11. Self-Update & Autostart (am Gerät)
- [ ] Update-Banner → Update durchführen → danach „up to date".
- [ ] Autostart: Logoff/Logon startet den Worker (Startup-`.lnk`); Update-Pfad erhält den Autostart; Uninstall entfernt die `.lnk`.
## 12. Status-Bar / RunNow (Mini-Codecheck, erst messen)
- [x] Worker trennen/verbinden → prüfen, ob RunNow-Enable pro Task-Row sauber re-evaluiert (Connection-State lebt in `IslandsShellViewModel`). Nur fixen, wenn tatsächlich kaputt. — **PASS/moot (2026-07-24, Code)**: Es gibt kein per-Row-RunNow-Control in der UI; `RunNowAsync` (IWorkerClient/WorkerClient) hat keinen VM/View-Aufrufer (RunNow nur via MCP `run_task_now`). Die realen Detail-Pane-Aktionen (Enqueue/Dequeue/Continue/ResetAndRetry) re-evaluieren korrekt bei Connection-Change (DetailsIslandViewModel.cs:317-323). Nebenbefund: `RunNowAsync` in der UI ist toter Code.
+1
View File
@@ -51,6 +51,7 @@ public class ClaudeDoDbContext : DbContext
public DbSet<PrimeScheduleEntity> PrimeSchedules => Set<PrimeScheduleEntity>(); public DbSet<PrimeScheduleEntity> PrimeSchedules => Set<PrimeScheduleEntity>();
public DbSet<DailyNoteEntity> DailyNotes => Set<DailyNoteEntity>(); public DbSet<DailyNoteEntity> DailyNotes => Set<DailyNoteEntity>();
public DbSet<WeekReportEntity> WeekReports => Set<WeekReportEntity>(); public DbSet<WeekReportEntity> WeekReports => Set<WeekReportEntity>();
public DbSet<SessionSkillEntity> SessionSkills => Set<SessionSkillEntity>();
private static readonly ValueConverter<DateTime, DateTime> UtcConverter = private static readonly ValueConverter<DateTime, DateTime> UtcConverter =
new(v => v, v => DateTime.SpecifyKind(v, DateTimeKind.Utc)); new(v => v, v => DateTime.SpecifyKind(v, DateTimeKind.Utc));
@@ -44,6 +44,8 @@ public class AppSettingsEntityConfiguration : IEntityTypeConfiguration<AppSettin
builder.Property(s => s.DailyPrepMaxTasks) builder.Property(s => s.DailyPrepMaxTasks)
.HasColumnName("daily_prep_max_tasks").IsRequired().HasDefaultValue(5); .HasColumnName("daily_prep_max_tasks").IsRequired().HasDefaultValue(5);
builder.Property(s => s.SessionSkills).HasColumnName("session_skills");
builder.HasData(new AppSettingsEntity { Id = AppSettingsEntity.SingletonId }); builder.HasData(new AppSettingsEntity { Id = AppSettingsEntity.SingletonId });
} }
} }
@@ -16,5 +16,6 @@ public class ListConfigEntityConfiguration : IEntityTypeConfiguration<ListConfig
builder.Property(c => c.SystemPrompt).HasColumnName("system_prompt"); builder.Property(c => c.SystemPrompt).HasColumnName("system_prompt");
builder.Property(c => c.AgentPath).HasColumnName("agent_path"); builder.Property(c => c.AgentPath).HasColumnName("agent_path");
builder.Property(c => c.MaxTurns).HasColumnName("max_turns"); builder.Property(c => c.MaxTurns).HasColumnName("max_turns");
builder.Property(c => c.SessionSkills).HasColumnName("session_skills");
} }
} }
@@ -0,0 +1,21 @@
using ClaudeDo.Data.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace ClaudeDo.Data.Configuration;
public class SessionSkillEntityConfiguration : IEntityTypeConfiguration<SessionSkillEntity>
{
public void Configure(EntityTypeBuilder<SessionSkillEntity> builder)
{
builder.ToTable("session_skills");
builder.HasKey(s => s.Name);
builder.Property(s => s.Name).HasColumnName("name");
builder.Property(s => s.SourceUrl).HasColumnName("source_url").IsRequired();
builder.Property(s => s.PinnedRef).HasColumnName("pinned_ref").IsRequired();
builder.Property(s => s.Subpath).HasColumnName("subpath").IsRequired();
builder.Property(s => s.Description).HasColumnName("description").IsRequired();
builder.Property(s => s.AddedAt).HasColumnName("added_at").IsRequired();
}
}
@@ -91,6 +91,7 @@ public class TaskEntityConfiguration : IEntityTypeConfiguration<TaskEntity>
builder.Property(t => t.IsMyDay).HasColumnName("is_my_day").HasDefaultValue(false); builder.Property(t => t.IsMyDay).HasColumnName("is_my_day").HasDefaultValue(false);
builder.Property(t => t.Notes).HasColumnName("notes"); builder.Property(t => t.Notes).HasColumnName("notes");
builder.Property(t => t.SortOrder).HasColumnName("sort_order").IsRequired().HasDefaultValue(0); builder.Property(t => t.SortOrder).HasColumnName("sort_order").IsRequired().HasDefaultValue(0);
builder.Property(t => t.SessionSkills).HasColumnName("session_skills");
builder.Property(t => t.ParentTaskId).HasColumnName("parent_task_id"); builder.Property(t => t.ParentTaskId).HasColumnName("parent_task_id");
builder.Property(t => t.PlanningSessionId).HasColumnName("planning_session_id"); builder.Property(t => t.PlanningSessionId).HasColumnName("planning_session_id");
+15 -9
View File
@@ -71,9 +71,22 @@ public sealed class GitService
return stdout; return stdout;
} }
public async Task<bool> HasChangesAsync(string worktreePath, CancellationToken ct = default) public Task<bool> HasChangesAsync(string worktreePath, CancellationToken ct = default) =>
HasChangesAsync(worktreePath, includeUntracked: true, ct);
/// <summary>
/// Uncommitted-changes check. <paramref name="includeUntracked"/>=false ignores untracked
/// files — use this for merge preflights on a shared target working dir, where stray
/// untracked files (e.g. from a concurrent session) shouldn't block a merge. Auto-commit
/// and data-loss-guard callers keep the default (true): a new file a task created, or an
/// untracked file about to be discarded, is a real uncommitted change.
/// </summary>
public async Task<bool> HasChangesAsync(string worktreePath, bool includeUntracked, CancellationToken ct = default)
{ {
var (exitCode, stdout, stderr) = await RunGitAsync(worktreePath, ["status", "--porcelain"], ct); string[] args = includeUntracked
? ["status", "--porcelain"]
: ["status", "--porcelain", "--untracked-files=no"];
var (exitCode, stdout, stderr) = await RunGitAsync(worktreePath, args, ct);
if (exitCode != 0) if (exitCode != 0)
throw new InvalidOperationException($"git status --porcelain failed (exit {exitCode}): {stderr}"); throw new InvalidOperationException($"git status --porcelain failed (exit {exitCode}): {stderr}");
return !string.IsNullOrWhiteSpace(stdout); return !string.IsNullOrWhiteSpace(stdout);
@@ -330,13 +343,6 @@ public sealed class GitService
.Count(s => s.Length > 0); .Count(s => s.Length > 0);
} }
public async Task MergeFfOnlyAsync(string repoDir, string branchName, CancellationToken ct = default)
{
var (exitCode, _, stderr) = await RunGitAsync(repoDir, ["merge", "--ff-only", branchName], ct);
if (exitCode != 0)
throw new InvalidOperationException($"Fast-forward merge of '{branchName}' failed. Manual merge required. git stderr: {stderr}");
}
private static async Task<(int ExitCode, string Stdout, string Stderr)> RunGitAsync( private static async Task<(int ExitCode, string Stdout, string Stderr)> RunGitAsync(
string workDir, IEnumerable<string> args, CancellationToken ct, string? stdinData = null, bool trimOutput = true) string workDir, IEnumerable<string> args, CancellationToken ct, string? stdinData = null, bool trimOutput = true)
{ {
@@ -0,0 +1,786 @@
// <auto-generated />
using System;
using ClaudeDo.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace ClaudeDo.Data.Migrations
{
[DbContext(typeof(ClaudeDoDbContext))]
[Migration("20260703072917_AddSessionSkills")]
partial class AddSessionSkills
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "8.0.11");
modelBuilder.Entity("ClaudeDo.Data.Models.AppSettingsEntity", b =>
{
b.Property<int>("Id")
.HasColumnType("INTEGER")
.HasColumnName("id");
b.Property<string>("CentralWorktreeRoot")
.HasColumnType("TEXT")
.HasColumnName("central_worktree_root");
b.Property<int>("DailyPrepMaxTasks")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(5)
.HasColumnName("daily_prep_max_tasks");
b.Property<string>("DefaultClaudeInstructions")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValue("")
.HasColumnName("default_claude_instructions");
b.Property<int>("DefaultMaxTurns")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(30)
.HasColumnName("default_max_turns");
b.Property<string>("DefaultModel")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValue("sonnet")
.HasColumnName("default_model");
b.Property<string>("DefaultPermissionMode")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValue("bypassPermissions")
.HasColumnName("default_permission_mode");
b.Property<int>("MaxParallelExecutions")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(1)
.HasColumnName("max_parallel_executions");
b.Property<string>("RepoImportFolders")
.HasColumnType("TEXT")
.HasColumnName("repo_import_folders");
b.Property<string>("ReportExcludedPaths")
.HasColumnType("TEXT")
.HasColumnName("report_excluded_paths");
b.Property<string>("SessionSkills")
.HasColumnType("TEXT")
.HasColumnName("session_skills");
b.Property<int>("StandupWeekday")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(3)
.HasColumnName("standup_weekday");
b.Property<int>("WorktreeAutoCleanupDays")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(7)
.HasColumnName("worktree_auto_cleanup_days");
b.Property<bool>("WorktreeAutoCleanupEnabled")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(false)
.HasColumnName("worktree_auto_cleanup_enabled");
b.Property<string>("WorktreeStrategy")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValue("sibling")
.HasColumnName("worktree_strategy");
b.HasKey("Id");
b.ToTable("app_settings", (string)null);
b.HasData(
new
{
Id = 1,
DailyPrepMaxTasks = 5,
DefaultClaudeInstructions = "",
DefaultMaxTurns = 100,
DefaultModel = "sonnet",
DefaultPermissionMode = "auto",
MaxParallelExecutions = 1,
StandupWeekday = 3,
WorktreeAutoCleanupDays = 7,
WorktreeAutoCleanupEnabled = false,
WorktreeStrategy = "sibling"
});
});
modelBuilder.Entity("ClaudeDo.Data.Models.DailyNoteEntity", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT")
.HasColumnName("created_at");
b.Property<DateOnly>("Date")
.HasColumnType("TEXT")
.HasColumnName("note_date");
b.Property<int>("SortOrder")
.HasColumnType("INTEGER")
.HasColumnName("sort_order");
b.Property<string>("Text")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("text");
b.HasKey("Id");
b.HasIndex("Date");
b.ToTable("daily_notes", (string)null);
});
modelBuilder.Entity("ClaudeDo.Data.Models.ListConfigEntity", b =>
{
b.Property<string>("ListId")
.HasColumnType("TEXT")
.HasColumnName("list_id");
b.Property<string>("AgentPath")
.HasColumnType("TEXT")
.HasColumnName("agent_path");
b.Property<int?>("MaxTurns")
.HasColumnType("INTEGER")
.HasColumnName("max_turns");
b.Property<string>("Model")
.HasColumnType("TEXT")
.HasColumnName("model");
b.Property<string>("SessionSkills")
.HasColumnType("TEXT")
.HasColumnName("session_skills");
b.Property<string>("SystemPrompt")
.HasColumnType("TEXT")
.HasColumnName("system_prompt");
b.HasKey("ListId");
b.ToTable("list_config", (string)null);
});
modelBuilder.Entity("ClaudeDo.Data.Models.ListEntity", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT")
.HasColumnName("created_at");
b.Property<string>("DefaultCommitType")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValue("chore")
.HasColumnName("default_commit_type");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("name");
b.Property<int>("SortOrder")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(0)
.HasColumnName("sort_order");
b.Property<string>("WorkingDir")
.HasColumnType("TEXT")
.HasColumnName("working_dir");
b.HasKey("Id");
b.HasIndex("SortOrder")
.HasDatabaseName("idx_lists_sort");
b.ToTable("lists", (string)null);
});
modelBuilder.Entity("ClaudeDo.Data.Models.PrimeScheduleEntity", b =>
{
b.Property<Guid>("Id")
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("TEXT")
.HasColumnName("created_at");
b.Property<int>("Days")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(31)
.HasColumnName("days_of_week");
b.Property<bool>("Enabled")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(true)
.HasColumnName("enabled");
b.Property<DateTimeOffset?>("LastRunAt")
.HasColumnType("TEXT")
.HasColumnName("last_run_at");
b.Property<string>("PromptOverride")
.HasColumnType("TEXT")
.HasColumnName("prompt_override");
b.Property<TimeSpan>("TimeOfDay")
.HasColumnType("TEXT")
.HasColumnName("time_of_day");
b.HasKey("Id");
b.ToTable("prime_schedules", (string)null);
});
modelBuilder.Entity("ClaudeDo.Data.Models.SessionSkillEntity", b =>
{
b.Property<string>("Name")
.HasColumnType("TEXT")
.HasColumnName("name");
b.Property<DateTimeOffset>("AddedAt")
.HasColumnType("TEXT")
.HasColumnName("added_at");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("description");
b.Property<string>("PinnedRef")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("pinned_ref");
b.Property<string>("SourceUrl")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("source_url");
b.Property<string>("Subpath")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("subpath");
b.HasKey("Name");
b.ToTable("session_skills", (string)null);
});
modelBuilder.Entity("ClaudeDo.Data.Models.SubtaskEntity", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<bool>("Completed")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(false)
.HasColumnName("completed");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT")
.HasColumnName("created_at");
b.Property<int>("OrderNum")
.HasColumnType("INTEGER")
.HasColumnName("order_num");
b.Property<string>("TaskId")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("task_id");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("title");
b.HasKey("Id");
b.HasIndex("TaskId")
.HasDatabaseName("idx_subtasks_task_id");
b.ToTable("subtasks", (string)null);
});
modelBuilder.Entity("ClaudeDo.Data.Models.TaskAttachmentEntity", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<long>("ByteSize")
.HasColumnType("INTEGER")
.HasColumnName("byte_size");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT")
.HasColumnName("created_at");
b.Property<string>("FileName")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("file_name");
b.Property<string>("TaskId")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("task_id");
b.HasKey("Id");
b.HasIndex("TaskId")
.HasDatabaseName("idx_task_attachments_task_id");
b.ToTable("task_attachments", (string)null);
});
modelBuilder.Entity("ClaudeDo.Data.Models.TaskEntity", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<string>("AgentPath")
.HasColumnType("TEXT")
.HasColumnName("agent_path");
b.Property<string>("BlockedByTaskId")
.HasColumnType("TEXT")
.HasColumnName("blocked_by_task_id");
b.Property<string>("CommitType")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValue("chore")
.HasColumnName("commit_type");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT")
.HasColumnName("created_at");
b.Property<string>("CreatedBy")
.HasColumnType("TEXT")
.HasColumnName("created_by");
b.Property<string>("Description")
.HasColumnType("TEXT")
.HasColumnName("description");
b.Property<DateTime?>("FinishedAt")
.HasColumnType("TEXT")
.HasColumnName("finished_at");
b.Property<bool>("IsMyDay")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(false)
.HasColumnName("is_my_day");
b.Property<bool>("IsStarred")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(false)
.HasColumnName("is_starred");
b.Property<string>("ListId")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("list_id");
b.Property<string>("LogPath")
.HasColumnType("TEXT")
.HasColumnName("log_path");
b.Property<int?>("MaxTurns")
.HasColumnType("INTEGER")
.HasColumnName("max_turns");
b.Property<string>("Model")
.HasColumnType("TEXT")
.HasColumnName("model");
b.Property<string>("Notes")
.HasColumnType("TEXT")
.HasColumnName("notes");
b.Property<string>("ParentTaskId")
.HasColumnType("TEXT")
.HasColumnName("parent_task_id");
b.Property<DateTime?>("PlanningFinalizedAt")
.HasColumnType("TEXT")
.HasColumnName("planning_finalized_at");
b.Property<string>("PlanningPhase")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValue("none")
.HasColumnName("planning_phase");
b.Property<string>("PlanningSessionId")
.HasColumnType("TEXT")
.HasColumnName("planning_session_id");
b.Property<string>("PlanningSessionToken")
.HasColumnType("TEXT")
.HasColumnName("planning_session_token");
b.Property<string>("Result")
.HasColumnType("TEXT")
.HasColumnName("result");
b.Property<string>("ReviewFeedback")
.HasColumnType("TEXT")
.HasColumnName("review_feedback");
b.Property<int>("RoadblockCount")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(0)
.HasColumnName("roadblock_count");
b.Property<DateTime?>("ScheduledFor")
.HasColumnType("TEXT")
.HasColumnName("scheduled_for");
b.Property<string>("SessionSkills")
.HasColumnType("TEXT")
.HasColumnName("session_skills");
b.Property<int>("SortOrder")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(0)
.HasColumnName("sort_order");
b.Property<DateTime?>("StartedAt")
.HasColumnType("TEXT")
.HasColumnName("started_at");
b.Property<string>("Status")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("status");
b.Property<string>("SystemPrompt")
.HasColumnType("TEXT")
.HasColumnName("system_prompt");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("title");
b.HasKey("Id");
b.HasIndex("BlockedByTaskId")
.HasDatabaseName("idx_tasks_blocked_by");
b.HasIndex("ListId")
.HasDatabaseName("idx_tasks_list_id");
b.HasIndex("ParentTaskId")
.HasDatabaseName("idx_tasks_parent_task_id");
b.HasIndex("Status")
.HasDatabaseName("idx_tasks_status");
b.HasIndex("ListId", "SortOrder")
.HasDatabaseName("idx_tasks_list_sort");
b.ToTable("tasks", (string)null);
});
modelBuilder.Entity("ClaudeDo.Data.Models.TaskRunEntity", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<string>("ErrorMarkdown")
.HasColumnType("TEXT")
.HasColumnName("error_markdown");
b.Property<int?>("ExitCode")
.HasColumnType("INTEGER")
.HasColumnName("exit_code");
b.Property<DateTime?>("FinishedAt")
.HasColumnType("TEXT")
.HasColumnName("finished_at");
b.Property<bool>("IsRetry")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(false)
.HasColumnName("is_retry");
b.Property<string>("LogPath")
.HasColumnType("TEXT")
.HasColumnName("log_path");
b.Property<string>("Prompt")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("prompt");
b.Property<string>("ResultMarkdown")
.HasColumnType("TEXT")
.HasColumnName("result_markdown");
b.Property<int>("RunNumber")
.HasColumnType("INTEGER")
.HasColumnName("run_number");
b.Property<string>("SessionId")
.HasColumnType("TEXT")
.HasColumnName("session_id");
b.Property<DateTime?>("StartedAt")
.HasColumnType("TEXT")
.HasColumnName("started_at");
b.Property<string>("StructuredOutputJson")
.HasColumnType("TEXT")
.HasColumnName("structured_output");
b.Property<string>("TaskId")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("task_id");
b.Property<int?>("TokensIn")
.HasColumnType("INTEGER")
.HasColumnName("tokens_in");
b.Property<int?>("TokensOut")
.HasColumnType("INTEGER")
.HasColumnName("tokens_out");
b.Property<int?>("TurnCount")
.HasColumnType("INTEGER")
.HasColumnName("turn_count");
b.HasKey("Id");
b.HasIndex("TaskId")
.HasDatabaseName("idx_task_runs_task_id");
b.ToTable("task_runs", (string)null);
});
modelBuilder.Entity("ClaudeDo.Data.Models.WeekReportEntity", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT")
.HasColumnName("id");
b.Property<DateOnly>("EndDate")
.HasColumnType("TEXT")
.HasColumnName("end_date");
b.Property<DateTime>("GeneratedAt")
.HasColumnType("TEXT")
.HasColumnName("generated_at");
b.Property<string>("Markdown")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("markdown");
b.Property<DateOnly>("StartDate")
.HasColumnType("TEXT")
.HasColumnName("start_date");
b.HasKey("Id");
b.HasIndex("StartDate", "EndDate")
.IsUnique();
b.ToTable("week_reports", (string)null);
});
modelBuilder.Entity("ClaudeDo.Data.Models.WorktreeEntity", b =>
{
b.Property<string>("TaskId")
.HasColumnType("TEXT")
.HasColumnName("task_id");
b.Property<string>("BaseCommit")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("base_commit");
b.Property<string>("BranchName")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("branch_name");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT")
.HasColumnName("created_at");
b.Property<string>("DiffStat")
.HasColumnType("TEXT")
.HasColumnName("diff_stat");
b.Property<string>("HeadCommit")
.HasColumnType("TEXT")
.HasColumnName("head_commit");
b.Property<string>("Path")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("path");
b.Property<string>("State")
.IsRequired()
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValue("active")
.HasColumnName("state");
b.HasKey("TaskId");
b.ToTable("worktrees", (string)null);
});
modelBuilder.Entity("ClaudeDo.Data.Models.ListConfigEntity", b =>
{
b.HasOne("ClaudeDo.Data.Models.ListEntity", "List")
.WithOne("Config")
.HasForeignKey("ClaudeDo.Data.Models.ListConfigEntity", "ListId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("List");
});
modelBuilder.Entity("ClaudeDo.Data.Models.SubtaskEntity", b =>
{
b.HasOne("ClaudeDo.Data.Models.TaskEntity", "Task")
.WithMany("Subtasks")
.HasForeignKey("TaskId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Task");
});
modelBuilder.Entity("ClaudeDo.Data.Models.TaskAttachmentEntity", b =>
{
b.HasOne("ClaudeDo.Data.Models.TaskEntity", "Task")
.WithMany()
.HasForeignKey("TaskId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Task");
});
modelBuilder.Entity("ClaudeDo.Data.Models.TaskEntity", b =>
{
b.HasOne("ClaudeDo.Data.Models.TaskEntity", null)
.WithMany()
.HasForeignKey("BlockedByTaskId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("ClaudeDo.Data.Models.ListEntity", "List")
.WithMany("Tasks")
.HasForeignKey("ListId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ClaudeDo.Data.Models.TaskEntity", "Parent")
.WithMany("Children")
.HasForeignKey("ParentTaskId")
.OnDelete(DeleteBehavior.Restrict);
b.Navigation("List");
b.Navigation("Parent");
});
modelBuilder.Entity("ClaudeDo.Data.Models.TaskRunEntity", b =>
{
b.HasOne("ClaudeDo.Data.Models.TaskEntity", "Task")
.WithMany("Runs")
.HasForeignKey("TaskId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Task");
});
modelBuilder.Entity("ClaudeDo.Data.Models.WorktreeEntity", b =>
{
b.HasOne("ClaudeDo.Data.Models.TaskEntity", "Task")
.WithOne("Worktree")
.HasForeignKey("ClaudeDo.Data.Models.WorktreeEntity", "TaskId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Task");
});
modelBuilder.Entity("ClaudeDo.Data.Models.ListEntity", b =>
{
b.Navigation("Config");
b.Navigation("Tasks");
});
modelBuilder.Entity("ClaudeDo.Data.Models.TaskEntity", b =>
{
b.Navigation("Children");
b.Navigation("Runs");
b.Navigation("Subtasks");
b.Navigation("Worktree");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,75 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ClaudeDo.Data.Migrations
{
/// <inheritdoc />
public partial class AddSessionSkills : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "session_skills",
table: "tasks",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "session_skills",
table: "list_config",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "session_skills",
table: "app_settings",
type: "TEXT",
nullable: true);
migrationBuilder.CreateTable(
name: "session_skills",
columns: table => new
{
name = table.Column<string>(type: "TEXT", nullable: false),
source_url = table.Column<string>(type: "TEXT", nullable: false),
pinned_ref = table.Column<string>(type: "TEXT", nullable: false),
subpath = table.Column<string>(type: "TEXT", nullable: false),
description = table.Column<string>(type: "TEXT", nullable: false),
added_at = table.Column<DateTimeOffset>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_session_skills", x => x.name);
});
migrationBuilder.UpdateData(
table: "app_settings",
keyColumn: "id",
keyValue: 1,
column: "session_skills",
value: null);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "session_skills");
migrationBuilder.DropColumn(
name: "session_skills",
table: "tasks");
migrationBuilder.DropColumn(
name: "session_skills",
table: "list_config");
migrationBuilder.DropColumn(
name: "session_skills",
table: "app_settings");
}
}
}
@@ -74,6 +74,10 @@ namespace ClaudeDo.Data.Migrations
.HasColumnType("TEXT") .HasColumnType("TEXT")
.HasColumnName("report_excluded_paths"); .HasColumnName("report_excluded_paths");
b.Property<string>("SessionSkills")
.HasColumnType("TEXT")
.HasColumnName("session_skills");
b.Property<int>("StandupWeekday") b.Property<int>("StandupWeekday")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("INTEGER") .HasColumnType("INTEGER")
@@ -168,6 +172,10 @@ namespace ClaudeDo.Data.Migrations
.HasColumnType("TEXT") .HasColumnType("TEXT")
.HasColumnName("model"); .HasColumnName("model");
b.Property<string>("SessionSkills")
.HasColumnType("TEXT")
.HasColumnName("session_skills");
b.Property<string>("SystemPrompt") b.Property<string>("SystemPrompt")
.HasColumnType("TEXT") .HasColumnType("TEXT")
.HasColumnName("system_prompt"); .HasColumnName("system_prompt");
@@ -256,6 +264,41 @@ namespace ClaudeDo.Data.Migrations
b.ToTable("prime_schedules", (string)null); b.ToTable("prime_schedules", (string)null);
}); });
modelBuilder.Entity("ClaudeDo.Data.Models.SessionSkillEntity", b =>
{
b.Property<string>("Name")
.HasColumnType("TEXT")
.HasColumnName("name");
b.Property<DateTimeOffset>("AddedAt")
.HasColumnType("TEXT")
.HasColumnName("added_at");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("description");
b.Property<string>("PinnedRef")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("pinned_ref");
b.Property<string>("SourceUrl")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("source_url");
b.Property<string>("Subpath")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("subpath");
b.HasKey("Name");
b.ToTable("session_skills", (string)null);
});
modelBuilder.Entity("ClaudeDo.Data.Models.SubtaskEntity", b => modelBuilder.Entity("ClaudeDo.Data.Models.SubtaskEntity", b =>
{ {
b.Property<string>("Id") b.Property<string>("Id")
@@ -437,6 +480,10 @@ namespace ClaudeDo.Data.Migrations
.HasColumnType("TEXT") .HasColumnType("TEXT")
.HasColumnName("scheduled_for"); .HasColumnName("scheduled_for");
b.Property<string>("SessionSkills")
.HasColumnType("TEXT")
.HasColumnName("session_skills");
b.Property<int>("SortOrder") b.Property<int>("SortOrder")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("INTEGER") .HasColumnType("INTEGER")
@@ -27,4 +27,7 @@ public sealed class AppSettingsEntity
// Max number of open tasks the daily prep ("Prime Claude") may place in MyDay. // Max number of open tasks the daily prep ("Prime Claude") may place in MyDay.
public int DailyPrepMaxTasks { get; set; } = 5; public int DailyPrepMaxTasks { get; set; } = 5;
// JSON array of session skill names applied by default to new tasks.
public string? SessionSkills { get; set; }
} }
@@ -7,6 +7,7 @@ public sealed class ListConfigEntity
public string? SystemPrompt { get; set; } public string? SystemPrompt { get; set; }
public string? AgentPath { get; set; } public string? AgentPath { get; set; }
public int? MaxTurns { get; set; } public int? MaxTurns { get; set; }
public string? SessionSkills { get; set; }
// Navigation property // Navigation property
public ListEntity List { get; set; } = null!; public ListEntity List { get; set; } = null!;
@@ -0,0 +1,11 @@
namespace ClaudeDo.Data.Models;
public sealed class SessionSkillEntity
{
public required string Name { get; init; }
public required string SourceUrl { get; set; }
public required string PinnedRef { get; set; }
public required string Subpath { get; set; }
public required string Description { get; set; }
public required DateTimeOffset AddedAt { get; set; }
}
+1
View File
@@ -45,6 +45,7 @@ public sealed class TaskEntity
public bool IsMyDay { get; set; } public bool IsMyDay { get; set; }
public string? Notes { get; set; } public string? Notes { get; set; }
public int SortOrder { get; set; } public int SortOrder { get; set; }
public string? SessionSkills { get; set; }
public string? ParentTaskId { get; set; } public string? ParentTaskId { get; set; }
public string? PlanningSessionId { get; set; } public string? PlanningSessionId { get; set; }
@@ -64,6 +64,7 @@ public sealed class AppSettingsRepository
? null : updated.ReportExcludedPaths; ? null : updated.ReportExcludedPaths;
row.StandupWeekday = updated.StandupWeekday; row.StandupWeekday = updated.StandupWeekday;
row.DailyPrepMaxTasks = updated.DailyPrepMaxTasks < 1 ? 1 : updated.DailyPrepMaxTasks; row.DailyPrepMaxTasks = updated.DailyPrepMaxTasks < 1 ? 1 : updated.DailyPrepMaxTasks;
row.SessionSkills = string.IsNullOrWhiteSpace(updated.SessionSkills) ? null : updated.SessionSkills;
await _context.SaveChangesAsync(ct); await _context.SaveChangesAsync(ct);
} }
@@ -77,6 +77,7 @@ public sealed class ListRepository
existing.SystemPrompt = config.SystemPrompt; existing.SystemPrompt = config.SystemPrompt;
existing.AgentPath = config.AgentPath; existing.AgentPath = config.AgentPath;
existing.MaxTurns = config.MaxTurns; existing.MaxTurns = config.MaxTurns;
existing.SessionSkills = config.SessionSkills;
} }
await _context.SaveChangesAsync(ct); await _context.SaveChangesAsync(ct);
} }
@@ -0,0 +1,61 @@
using ClaudeDo.Data.Models;
using Microsoft.EntityFrameworkCore;
namespace ClaudeDo.Data.Repositories;
public sealed class SessionSkillRepository
{
private readonly ClaudeDoDbContext _context;
public SessionSkillRepository(ClaudeDoDbContext context) => _context = context;
public async Task<IReadOnlyList<SessionSkillEntity>> ListAsync(CancellationToken ct = default)
{
return await _context.SessionSkills.AsNoTracking()
.OrderBy(s => s.Name)
.ToListAsync(ct);
}
public async Task<SessionSkillEntity?> GetAsync(string name, CancellationToken ct = default) =>
await _context.SessionSkills.AsNoTracking().FirstOrDefaultAsync(s => s.Name == name, ct);
public async Task UpsertAsync(SessionSkillEntity entity, CancellationToken ct = default)
{
var existing = await _context.SessionSkills.FirstOrDefaultAsync(s => s.Name == entity.Name, ct);
if (existing is null)
{
_context.SessionSkills.Add(entity);
}
else
{
existing.SourceUrl = entity.SourceUrl;
existing.PinnedRef = entity.PinnedRef;
existing.Subpath = entity.Subpath;
existing.Description = entity.Description;
existing.AddedAt = entity.AddedAt;
}
await _context.SaveChangesAsync(ct);
}
public async Task DeleteAsync(string name, CancellationToken ct = default)
{
await _context.SessionSkills
.Where(s => s.Name == name)
.ExecuteDeleteAsync(ct);
}
public async Task DeleteBySourceAsync(string sourceUrl, CancellationToken ct = default)
{
await _context.SessionSkills
.Where(s => s.SourceUrl == sourceUrl)
.ExecuteDeleteAsync(ct);
}
public async Task<IReadOnlyList<SessionSkillEntity>> ListBySourceAsync(string sourceUrl, CancellationToken ct = default)
{
return await _context.SessionSkills.AsNoTracking()
.Where(s => s.SourceUrl == sourceUrl)
.OrderBy(s => s.Name)
.ToListAsync(ct);
}
}
@@ -189,6 +189,7 @@ public sealed class TaskRepository
string? systemPrompt, string? systemPrompt,
string? agentPath, string? agentPath,
int? maxTurns = null, int? maxTurns = null,
string? sessionSkills = null,
CancellationToken ct = default) CancellationToken ct = default)
{ {
await _context.Tasks await _context.Tasks
@@ -197,7 +198,8 @@ public sealed class TaskRepository
.SetProperty(t => t.Model, model) .SetProperty(t => t.Model, model)
.SetProperty(t => t.SystemPrompt, systemPrompt) .SetProperty(t => t.SystemPrompt, systemPrompt)
.SetProperty(t => t.AgentPath, agentPath) .SetProperty(t => t.AgentPath, agentPath)
.SetProperty(t => t.MaxTurns, maxTurns), ct); .SetProperty(t => t.MaxTurns, maxTurns)
.SetProperty(t => t.SessionSkills, sessionSkills), ct);
} }
#endregion #endregion
+35 -16
View File
@@ -9,6 +9,7 @@
"tabWorktrees": "Worktrees", "tabWorktrees": "Worktrees",
"tabFiles": "Dateien", "tabFiles": "Dateien",
"tabPrime": "Prime Claude", "tabPrime": "Prime Claude",
"tabSkills": "Skills",
"general": { "general": {
"defaultInstructions": "Standard-Anweisungen", "defaultInstructions": "Standard-Anweisungen",
"defaultInstructionsPlaceholder": "Basis-Anweisungen, die auf jede Aufgabe angewendet werden", "defaultInstructionsPlaceholder": "Basis-Anweisungen, die auf jede Aufgabe angewendet werden",
@@ -25,7 +26,9 @@
"weekdayWednesday": "Mittwoch", "weekdayWednesday": "Mittwoch",
"weekdayThursday": "Donnerstag", "weekdayThursday": "Donnerstag",
"weekdayFriday": "Freitag", "weekdayFriday": "Freitag",
"weekdaySaturday": "Samstag" "weekdaySaturday": "Samstag",
"sessionSkills": "Session-Skills",
"sessionSkillsHint": "Gilt für jede Aufgabe. Kombiniert sich mit Listen- und Aufgaben-Auswahl."
}, },
"worktrees": { "worktrees": {
"strategy": "Strategie", "strategy": "Strategie",
@@ -95,7 +98,18 @@
"systemPrompt": "System-Prompt (angehängt)", "systemPrompt": "System-Prompt (angehängt)",
"promptPrepended": "Wird automatisch vorangestellt:", "promptPrepended": "Wird automatisch vorangestellt:",
"agentFile": "Agent-Datei", "agentFile": "Agent-Datei",
"browse": "Durchsuchen..." "browse": "Durchsuchen...",
"sessionSkills": "Session-Skills",
"sessionSkillsHint": "Kombiniert sich additiv mit globaler (und Listen-)Auswahl."
},
"skills": {
"installSection": "INSTALLIEREN",
"installUrlPlaceholder": "Git-Repo-URL (owner/repo oder vollständige URL)",
"installButton": "Installieren",
"installedSection": "INSTALLIERT",
"updateButton": "Aktualisieren",
"removeButton": "Entfernen",
"emptyState": "Keine Skills installiert — oben eine GitHub-URL einfügen, um einen hinzuzufügen."
} }
}, },
"tasks": { "tasks": {
@@ -115,7 +129,8 @@
"ctxMarkAs": "Markieren als", "ctxMarkAs": "Markieren als",
"ctxMarkDone": "Erledigt", "ctxMarkDone": "Erledigt",
"ctxMarkCancelled": "Abgebrochen", "ctxMarkCancelled": "Abgebrochen",
"ctxRunInteractively": "Interaktiv ausführen", "ctxOpenConPtySession": "ConPTY-Sitzung öffnen",
"ctxPickUpInTerminal": "Im Terminal fortsetzen",
"ctxOpenPlanningSession": "Planungssitzung öffnen", "ctxOpenPlanningSession": "Planungssitzung öffnen",
"ctxResumePlanningSession": "Planungssitzung fortsetzen", "ctxResumePlanningSession": "Planungssitzung fortsetzen",
"ctxFinalizePlanningSession": "Plan finalisieren", "ctxFinalizePlanningSession": "Plan finalisieren",
@@ -162,6 +177,7 @@
"addReposTip": "Repos als Listen hinzufügen" "addReposTip": "Repos als Listen hinzufügen"
}, },
"details": { "details": {
"pickUpInTerminalTip": "Diese Sitzung im Terminal fortsetzen",
"deleteTaskTip": "Aufgabe löschen", "deleteTaskTip": "Aufgabe löschen",
"killSessionTip": "Laufende Sitzung beenden", "killSessionTip": "Laufende Sitzung beenden",
"closeTip": "Schließen", "closeTip": "Schließen",
@@ -173,7 +189,7 @@
"mergeTargetLabel": "Merge-Ziel", "mergeTargetLabel": "Merge-Ziel",
"reviewCombinedDiff": "Kombiniertes Diff prüfen", "reviewCombinedDiff": "Kombiniertes Diff prüfen",
"mergeAllSubtasks": "Alle Teilaufgaben mergen", "mergeAllSubtasks": "Alle Teilaufgaben mergen",
"childOutcomesLabel": "VERBESSERUNGEN", "childOutcomesLabel": "TEILAUFGABEN",
"stepsLabel": "SCHRITTE", "stepsLabel": "SCHRITTE",
"addStepPlaceholder": "Schritt hinzufügen...", "addStepPlaceholder": "Schritt hinzufügen...",
"detailsLabel": "DETAILS", "detailsLabel": "DETAILS",
@@ -194,6 +210,7 @@
"addedSummary": "✓ Hinzugefügt: {0} ({1} Datei(en))", "addedSummary": "✓ Hinzugefügt: {0} ({1} Datei(en))",
"overLimitError": "Konnte {0} nicht hinzufügen: {1}", "overLimitError": "Konnte {0} nicht hinzufügen: {1}",
"invalidNameError": "Konnte {0} nicht hinzufügen: {1}", "invalidNameError": "Konnte {0} nicht hinzufügen: {1}",
"dropReadError": "Abgelegte Dateien konnten nicht gelesen werden: {0}",
"selectIdleTask": "Zuerst eine inaktive Aufgabe auswählen" "selectIdleTask": "Zuerst eine inaktive Aufgabe auswählen"
}, },
"sections": { "sections": {
@@ -231,15 +248,7 @@
"chipDone": "FERTIG", "chipDone": "FERTIG",
"chipFailed": "FEHLGESCHLAGEN", "chipFailed": "FEHLGESCHLAGEN",
"reviewContinueTip": "Dieses Feedback senden und die Aufgabe erneut ausführen", "reviewContinueTip": "Dieses Feedback senden und die Aufgabe erneut ausführen",
"reviewResetTip": "Alle Änderungen verwerfen und die Aufgabe auf Leerlauf zurücksetzen", "reviewResetTip": "Alle Änderungen verwerfen und die Aufgabe auf Leerlauf zurücksetzen"
"composer": {
"placeholder": "Nachricht an die Sitzung…",
"send": "Senden",
"stop": "Sitzung beenden",
"interrupt": "Aktuellen Zug unterbrechen",
"queued": "Wartet — wird nach dem aktuellen Zug gesendet",
"unqueue": "Aus Warteschlange entfernen"
}
}, },
"missionControl": { "missionControl": {
"openInApp": "In App öffnen", "openInApp": "In App öffnen",
@@ -247,11 +256,20 @@
"detach": "Abdocken", "detach": "Abdocken",
"redock": "Andocken", "redock": "Andocken",
"windowTitle": "Mission Control", "windowTitle": "Mission Control",
"newSession": "Neue Sitzung",
"clearFinished": "Erledigte entfernen", "clearFinished": "Erledigte entfernen",
"empty": "Keine laufenden Aufgaben", "empty": "Keine laufenden Aufgaben",
"settings": "Einstellungen", "settings": "Einstellungen",
"queue": "Warteschlange", "queue": "Warteschlange",
"blocked": "Blockiert", "blocked": "Blockiert",
"focusMode": "Fokus",
"overviewMode": "Übersicht",
"closeSession": "Sitzung schließen",
"conptyLaunchFailed": "ConPTY-Sitzung konnte nicht geöffnet werden: {0}",
"submitForReviewFailed": "Einreichen zum Review fehlgeschlagen: {0}",
"submitForReview": "Zum Review einreichen",
"submitForReviewTip": "Diesen Worktree committen und den Task ins Review bringen, damit er gemergt werden kann",
"planningTitleSuffix": " (Planung)",
"question": { "question": {
"title": "Claude fragt nach", "title": "Claude fragt nach",
"placeholder": "Antwort eingeben…", "placeholder": "Antwort eingeben…",
@@ -488,11 +506,11 @@
"vm": { "vm": {
"connection": { "online": "Online", "connecting": "Verbinden…", "offline": "Offline" }, "connection": { "online": "Online", "connecting": "Verbinden…", "offline": "Offline" },
"shell": { "restartingWorker": "Worker wird neu gestartet…" }, "shell": { "restartingWorker": "Worker wird neu gestartet…" },
"agentStatus": { "idle": "Leerlauf", "queued": "In Warteschlange", "running": "Läuft", "review": "Prüfung", "children": "Wartet auf Verbesserungen", "done": "Fertig", "failed": "Fehlgeschlagen", "cancelled": "Abgebrochen" }, "agentStatus": { "idle": "Leerlauf", "queued": "In Warteschlange", "running": "Läuft", "review": "Prüfung", "children": "Wartet auf Teilaufgaben", "done": "Fertig", "failed": "Fehlgeschlagen", "cancelled": "Abgebrochen" },
"taskStatus": { "idle": "Leerlauf", "queued": "In Warteschlange", "running": "Läuft", "waitingForReview": "Wartet auf Prüfung", "waitingForChildren": "Wartet auf Verbesserungen", "done": "Fertig", "failed": "Fehlgeschlagen", "cancelled": "Abgebrochen", "parked": "Geparkt" }, "taskStatus": { "idle": "Leerlauf", "queued": "In Warteschlange", "running": "Läuft", "waitingForReview": "Wartet auf Prüfung", "waitingForChildren": "Wartet auf Teilaufgaben", "done": "Fertig", "failed": "Fehlgeschlagen", "cancelled": "Abgebrochen", "parked": "Geparkt" },
"planningBadge": { "active": "PLANUNG", "finalized": "GEPLANT" }, "planningBadge": { "active": "PLANUNG", "finalized": "GEPLANT" },
"taskRow": { "createdPrefix": "Erstellt {0}", "stepsText": "{0}/{1} Schritte" }, "taskRow": { "createdPrefix": "Erstellt {0}", "stepsText": "{0}/{1} Schritte" },
"tasksIsland": { "completedHeader": "ABGESCHLOSSEN", "completedHeaderCount": "ABGESCHLOSSEN · {0}", "runInteractiveFailed": "Interaktiv ausführen fehlgeschlagen: {0}", "planningOpenFailed": "Planungssitzung konnte nicht geöffnet werden: {0}" }, "tasksIsland": { "completedHeader": "ABGESCHLOSSEN", "completedHeaderCount": "ABGESCHLOSSEN · {0}", "planningOpenFailed": "Planungssitzung konnte nicht geöffnet werden: {0}", "planningResumeFailed": "Planungssitzung konnte nicht fortgesetzt werden: {0}", "pickUpInTerminalFailed": "Im Terminal fortsetzen fehlgeschlagen: {0}", "approveFailed": "Genehmigen & Mergen fehlgeschlagen: {0}" },
"diff": { "loadFailed": "Diff konnte nicht geladen werden: {0}", "noChanges": "Keine Änderungen anzuzeigen.", "unavailable": "Diff nicht mehr verfügbar — Commit-Bereich unvollständig." }, "diff": { "loadFailed": "Diff konnte nicht geladen werden: {0}", "noChanges": "Keine Änderungen anzuzeigen.", "unavailable": "Diff nicht mehr verfügbar — Commit-Bereich unvollständig." },
"planningDiff": { "hubError": "Kombinierte Vorschau konnte nicht erstellt werden (Hub-Fehler).", "conflict": "Kombinierte Vorschau nicht möglich: Teilaufgabe {0} steht im Konflikt mit einer früheren Teilaufgabe ({1} Dateien)." }, "planningDiff": { "hubError": "Kombinierte Vorschau konnte nicht erstellt werden (Hub-Fehler).", "conflict": "Kombinierte Vorschau nicht möglich: Teilaufgabe {0} steht im Konflikt mit einer früheren Teilaufgabe ({1} Dateien)." },
"merge": { "commitMessage": "Merge-Aufgabe: {0}", "workerOfflineBranches": "Worker offline — Branches können nicht aufgelistet werden.", "loadBranchesFailed": "Branches konnten nicht geladen werden: {0}", "merged": "Zusammengeführt.", "conflict": "Merge-Konflikt — Ziel-Branch wiederhergestellt. Manuell oder über Fortsetzen lösen, dann erneut versuchen.", "blocked": "Blockiert: {0}", "unknownStatus": "Unbekannter Status: {0}", "mergeFailed": "Merge fehlgeschlagen: {0}" }, "merge": { "commitMessage": "Merge-Aufgabe: {0}", "workerOfflineBranches": "Worker offline — Branches können nicht aufgelistet werden.", "loadBranchesFailed": "Branches konnten nicht geladen werden: {0}", "merged": "Zusammengeführt.", "conflict": "Merge-Konflikt — Ziel-Branch wiederhergestellt. Manuell oder über Fortsetzen lösen, dann erneut versuchen.", "blocked": "Blockiert: {0}", "unknownStatus": "Unbekannter Status: {0}", "mergeFailed": "Merge fehlgeschlagen: {0}" },
@@ -501,6 +519,7 @@
"onlineInbox": { "workerOffline": "Worker offline — Konfiguration kann nicht geladen werden.", "saved": "Konfiguration gespeichert.", "saveFailed": "Speichern fehlgeschlagen: {0}", "signedIn": "Erfolgreich angemeldet.", "signedInNoRole": "Angemeldet, aber diesem Konto fehlt die Rolle 'user' in Zitadel — die Online-Synchronisierung wird abgelehnt, bis die Rolle im ClaudeDo-Projekt zugewiesen wird.", "signInFailed": "Anmeldung fehlgeschlagen: {0}", "signedOut": "Abgemeldet.", "signOutFailed": "Abmeldung fehlgeschlagen: {0}" }, "onlineInbox": { "workerOffline": "Worker offline — Konfiguration kann nicht geladen werden.", "saved": "Konfiguration gespeichert.", "saveFailed": "Speichern fehlgeschlagen: {0}", "signedIn": "Erfolgreich angemeldet.", "signedInNoRole": "Angemeldet, aber diesem Konto fehlt die Rolle 'user' in Zitadel — die Online-Synchronisierung wird abgelehnt, bis die Rolle im ClaudeDo-Projekt zugewiesen wird.", "signInFailed": "Anmeldung fehlgeschlagen: {0}", "signedOut": "Abgemeldet.", "signOutFailed": "Abmeldung fehlgeschlagen: {0}" },
"weeklyReport": { "invalidRange": "Ungültiger Datumsbereich.", "generating": "Bericht wird erstellt…", "error": "Fehler: {0}" }, "weeklyReport": { "invalidRange": "Ungültiger Datumsbereich.", "generating": "Bericht wird erstellt…", "error": "Fehler: {0}" },
"filesTab": { "workerOffline": "Worker offline.", "noneBundled": "Keine Standard-Agenten mitgeliefert.", "allPresent": "Alle Standard-Agenten bereits vorhanden.", "restored": "{0} Standard-Agent(en) wiederhergestellt.", "restoreFailed": "Wiederherstellung fehlgeschlagen: {0}", "openFailed": "Öffnen fehlgeschlagen: {0}" }, "filesTab": { "workerOffline": "Worker offline.", "noneBundled": "Keine Standard-Agenten mitgeliefert.", "allPresent": "Alle Standard-Agenten bereits vorhanden.", "restored": "{0} Standard-Agent(en) wiederhergestellt.", "restoreFailed": "Wiederherstellung fehlgeschlagen: {0}", "openFailed": "Öffnen fehlgeschlagen: {0}" },
"sessionSkillsTab": { "installed": "Installiert: {0}", "installFailed": "Installation fehlgeschlagen: {0}", "updated": "Aktualisiert.", "updateFailed": "Aktualisierung fehlgeschlagen: {0}", "removed": "Entfernt.", "removeFailed": "Entfernen fehlgeschlagen: {0}" },
"worktreesTab": { "workerOffline": "Worker offline.", "removed": "{0} Worktree(s) entfernt.", "blocked": "Zwangsentfernung nicht möglich: {0} Aufgabe(n) laufen noch. Brich sie zuerst ab.", "removedFrom": "{0} Worktree(s) von {1} Aufgabe(n) entfernt." }, "worktreesTab": { "workerOffline": "Worker offline.", "removed": "{0} Worktree(s) entfernt.", "blocked": "Zwangsentfernung nicht möglich: {0} Aufgabe(n) laufen noch. Brich sie zuerst ab.", "removedFrom": "{0} Worktree(s) von {1} Aufgabe(n) entfernt." },
"worktreesOverview": { "titleAll": "Worktrees", "titleList": "Worktrees — {0}", "listFallback": "Liste", "cleanupFailed": "Aufräumen fehlgeschlagen.", "removed": "{0} Worktree(s) entfernt.", "discardFailed": "Worktree konnte nicht verworfen werden.", "keepFailed": "Worktree konnte nicht behalten werden.", "cannotForceRunning": "Eine laufende Aufgabe kann nicht zwangsweise entfernt werden.", "forceRemoveFailed": "Zwangsentfernung fehlgeschlagen.", "batchProgress": "Merge {0}/{1}…", "batchDone": "{0} gemergt, {1} zu lösen." }, "worktreesOverview": { "titleAll": "Worktrees", "titleList": "Worktrees — {0}", "listFallback": "Liste", "cleanupFailed": "Aufräumen fehlgeschlagen.", "removed": "{0} Worktree(s) entfernt.", "discardFailed": "Worktree konnte nicht verworfen werden.", "keepFailed": "Worktree konnte nicht behalten werden.", "cannotForceRunning": "Eine laufende Aufgabe kann nicht zwangsweise entfernt werden.", "forceRemoveFailed": "Zwangsentfernung fehlgeschlagen.", "batchProgress": "Merge {0}/{1}…", "batchDone": "{0} gemergt, {1} zu lösen." },
"listSettings": { "untitled": "Unbenannt" }, "listSettings": { "untitled": "Unbenannt" },
+35 -16
View File
@@ -9,6 +9,7 @@
"tabWorktrees": "Worktrees", "tabWorktrees": "Worktrees",
"tabFiles": "Files", "tabFiles": "Files",
"tabPrime": "Prime Claude", "tabPrime": "Prime Claude",
"tabSkills": "Skills",
"general": { "general": {
"defaultInstructions": "Default instructions", "defaultInstructions": "Default instructions",
"defaultInstructionsPlaceholder": "Baseline instructions applied to every task", "defaultInstructionsPlaceholder": "Baseline instructions applied to every task",
@@ -25,7 +26,9 @@
"weekdayWednesday": "Wednesday", "weekdayWednesday": "Wednesday",
"weekdayThursday": "Thursday", "weekdayThursday": "Thursday",
"weekdayFriday": "Friday", "weekdayFriday": "Friday",
"weekdaySaturday": "Saturday" "weekdaySaturday": "Saturday",
"sessionSkills": "Session skills",
"sessionSkillsHint": "Applied to every task. Combines with list- and task-level selections."
}, },
"worktrees": { "worktrees": {
"strategy": "Strategy", "strategy": "Strategy",
@@ -95,7 +98,18 @@
"systemPrompt": "System prompt (appended)", "systemPrompt": "System prompt (appended)",
"promptPrepended": "Prepended automatically:", "promptPrepended": "Prepended automatically:",
"agentFile": "Agent file", "agentFile": "Agent file",
"browse": "Browse..." "browse": "Browse...",
"sessionSkills": "Session skills",
"sessionSkillsHint": "Combines additively with global (and list) selections."
},
"skills": {
"installSection": "INSTALL",
"installUrlPlaceholder": "Git repo URL (owner/repo or full URL)",
"installButton": "Install",
"installedSection": "INSTALLED",
"updateButton": "Update",
"removeButton": "Remove",
"emptyState": "No skills installed — paste a GitHub URL above to add one."
} }
}, },
"tasks": { "tasks": {
@@ -115,7 +129,8 @@
"ctxMarkAs": "Mark as", "ctxMarkAs": "Mark as",
"ctxMarkDone": "Done", "ctxMarkDone": "Done",
"ctxMarkCancelled": "Cancelled", "ctxMarkCancelled": "Cancelled",
"ctxRunInteractively": "Run interactively", "ctxOpenConPtySession": "Open ConPTY session",
"ctxPickUpInTerminal": "Pick up in terminal",
"ctxOpenPlanningSession": "Open planning Session", "ctxOpenPlanningSession": "Open planning Session",
"ctxResumePlanningSession": "Resume planning Session", "ctxResumePlanningSession": "Resume planning Session",
"ctxFinalizePlanningSession": "Finalize plan", "ctxFinalizePlanningSession": "Finalize plan",
@@ -162,6 +177,7 @@
"addReposTip": "Add repos as lists" "addReposTip": "Add repos as lists"
}, },
"details": { "details": {
"pickUpInTerminalTip": "Pick up this session in a terminal",
"deleteTaskTip": "Delete task", "deleteTaskTip": "Delete task",
"killSessionTip": "Kill the running session", "killSessionTip": "Kill the running session",
"closeTip": "Close", "closeTip": "Close",
@@ -173,7 +189,7 @@
"mergeTargetLabel": "Merge target", "mergeTargetLabel": "Merge target",
"reviewCombinedDiff": "Review combined diff", "reviewCombinedDiff": "Review combined diff",
"mergeAllSubtasks": "Merge all subtasks", "mergeAllSubtasks": "Merge all subtasks",
"childOutcomesLabel": "IMPROVEMENTS", "childOutcomesLabel": "SUBTASKS",
"stepsLabel": "STEPS", "stepsLabel": "STEPS",
"addStepPlaceholder": "Add a step...", "addStepPlaceholder": "Add a step...",
"detailsLabel": "DETAILS", "detailsLabel": "DETAILS",
@@ -194,6 +210,7 @@
"addedSummary": "✓ Added {0} ({1} file(s))", "addedSummary": "✓ Added {0} ({1} file(s))",
"overLimitError": "Could not add {0}: {1}", "overLimitError": "Could not add {0}: {1}",
"invalidNameError": "Could not add {0}: {1}", "invalidNameError": "Could not add {0}: {1}",
"dropReadError": "Couldn't read the dropped files: {0}",
"selectIdleTask": "Select an idle task first" "selectIdleTask": "Select an idle task first"
}, },
"sections": { "sections": {
@@ -231,15 +248,7 @@
"chipDone": "DONE", "chipDone": "DONE",
"chipFailed": "FAILED", "chipFailed": "FAILED",
"reviewContinueTip": "Send this feedback and re-run the task", "reviewContinueTip": "Send this feedback and re-run the task",
"reviewResetTip": "Discard all changes and reset the task to Idle", "reviewResetTip": "Discard all changes and reset the task to Idle"
"composer": {
"placeholder": "Message the session…",
"send": "Send",
"stop": "Stop session",
"interrupt": "Interrupt current turn",
"queued": "Queued — sends after the current turn",
"unqueue": "Remove from queue"
}
}, },
"missionControl": { "missionControl": {
"openInApp": "Open in app", "openInApp": "Open in app",
@@ -247,11 +256,20 @@
"detach": "Detach", "detach": "Detach",
"redock": "Re-dock", "redock": "Re-dock",
"windowTitle": "Mission Control", "windowTitle": "Mission Control",
"newSession": "New session",
"clearFinished": "Clear finished", "clearFinished": "Clear finished",
"empty": "No running tasks", "empty": "No running tasks",
"settings": "Settings", "settings": "Settings",
"queue": "Queue", "queue": "Queue",
"blocked": "Blocked", "blocked": "Blocked",
"focusMode": "Focus",
"overviewMode": "Overview",
"closeSession": "Close session",
"conptyLaunchFailed": "Couldn't open ConPTY session: {0}",
"submitForReviewFailed": "Couldn't submit for review: {0}",
"submitForReview": "Submit for review",
"submitForReviewTip": "Commit this worktree and move the task to review so it can be merged",
"planningTitleSuffix": " (Planning)",
"question": { "question": {
"title": "Claude is asking", "title": "Claude is asking",
"placeholder": "Type your answer…", "placeholder": "Type your answer…",
@@ -488,11 +506,11 @@
"vm": { "vm": {
"connection": { "online": "Online", "connecting": "Connecting…", "offline": "Offline" }, "connection": { "online": "Online", "connecting": "Connecting…", "offline": "Offline" },
"shell": { "restartingWorker": "Restarting worker…" }, "shell": { "restartingWorker": "Restarting worker…" },
"agentStatus": { "idle": "Idle", "queued": "Queued", "running": "Running", "review": "Review", "children": "Waiting for Improvements", "done": "Done", "failed": "Failed", "cancelled": "Cancelled" }, "agentStatus": { "idle": "Idle", "queued": "Queued", "running": "Running", "review": "Review", "children": "Waiting for Subtasks", "done": "Done", "failed": "Failed", "cancelled": "Cancelled" },
"taskStatus": { "idle": "Idle", "queued": "Queued", "running": "Running", "waitingForReview": "Waiting for Review", "waitingForChildren": "Waiting for Improvements", "done": "Done", "failed": "Failed", "cancelled": "Cancelled", "parked": "Parked" }, "taskStatus": { "idle": "Idle", "queued": "Queued", "running": "Running", "waitingForReview": "Waiting for Review", "waitingForChildren": "Waiting for Subtasks", "done": "Done", "failed": "Failed", "cancelled": "Cancelled", "parked": "Parked" },
"planningBadge": { "active": "PLANNING", "finalized": "PLANNED" }, "planningBadge": { "active": "PLANNING", "finalized": "PLANNED" },
"taskRow": { "createdPrefix": "Created {0}", "stepsText": "{0}/{1} steps" }, "taskRow": { "createdPrefix": "Created {0}", "stepsText": "{0}/{1} steps" },
"tasksIsland": { "completedHeader": "COMPLETED", "completedHeaderCount": "COMPLETED · {0}", "runInteractiveFailed": "Run interactively failed: {0}", "planningOpenFailed": "Couldn't open planning session: {0}" }, "tasksIsland": { "completedHeader": "COMPLETED", "completedHeaderCount": "COMPLETED · {0}", "planningOpenFailed": "Couldn't open planning session: {0}", "planningResumeFailed": "Couldn't resume planning session: {0}", "pickUpInTerminalFailed": "Pick up in terminal failed: {0}", "approveFailed": "Approve & merge failed: {0}" },
"diff": { "loadFailed": "Failed to load diff: {0}", "noChanges": "No changes to show.", "unavailable": "Diff no longer available — commit range incomplete." }, "diff": { "loadFailed": "Failed to load diff: {0}", "noChanges": "No changes to show.", "unavailable": "Diff no longer available — commit range incomplete." },
"planningDiff": { "hubError": "Could not build combined preview (hub error).", "conflict": "Cannot build combined preview: subtask {0} conflicts with an earlier subtask ({1} files)." }, "planningDiff": { "hubError": "Could not build combined preview (hub error).", "conflict": "Cannot build combined preview: subtask {0} conflicts with an earlier subtask ({1} files)." },
"merge": { "commitMessage": "Merge task: {0}", "workerOfflineBranches": "Worker offline — cannot list branches.", "loadBranchesFailed": "Failed to load branches: {0}", "merged": "Merged.", "conflict": "Merge conflict — target branch restored. Resolve manually or via Continue, then retry.", "blocked": "Blocked: {0}", "unknownStatus": "Unknown status: {0}", "mergeFailed": "Merge failed: {0}" }, "merge": { "commitMessage": "Merge task: {0}", "workerOfflineBranches": "Worker offline — cannot list branches.", "loadBranchesFailed": "Failed to load branches: {0}", "merged": "Merged.", "conflict": "Merge conflict — target branch restored. Resolve manually or via Continue, then retry.", "blocked": "Blocked: {0}", "unknownStatus": "Unknown status: {0}", "mergeFailed": "Merge failed: {0}" },
@@ -501,6 +519,7 @@
"onlineInbox": { "workerOffline": "Worker offline — cannot load config.", "saved": "Config saved.", "saveFailed": "Save failed: {0}", "signedIn": "Signed in successfully.", "signedInNoRole": "Signed in, but this account is missing the 'user' role in Zitadel — online sync will be rejected until the role is granted in the ClaudeDo project.", "signInFailed": "Sign-in failed: {0}", "signedOut": "Signed out.", "signOutFailed": "Sign-out failed: {0}" }, "onlineInbox": { "workerOffline": "Worker offline — cannot load config.", "saved": "Config saved.", "saveFailed": "Save failed: {0}", "signedIn": "Signed in successfully.", "signedInNoRole": "Signed in, but this account is missing the 'user' role in Zitadel — online sync will be rejected until the role is granted in the ClaudeDo project.", "signInFailed": "Sign-in failed: {0}", "signedOut": "Signed out.", "signOutFailed": "Sign-out failed: {0}" },
"weeklyReport": { "invalidRange": "Invalid date range.", "generating": "Generating report…", "error": "Error: {0}" }, "weeklyReport": { "invalidRange": "Invalid date range.", "generating": "Generating report…", "error": "Error: {0}" },
"filesTab": { "workerOffline": "Worker offline.", "noneBundled": "No default agents bundled.", "allPresent": "All default agents already present.", "restored": "Restored {0} default agent(s).", "restoreFailed": "Restore failed: {0}", "openFailed": "Open failed: {0}" }, "filesTab": { "workerOffline": "Worker offline.", "noneBundled": "No default agents bundled.", "allPresent": "All default agents already present.", "restored": "Restored {0} default agent(s).", "restoreFailed": "Restore failed: {0}", "openFailed": "Open failed: {0}" },
"sessionSkillsTab": { "installed": "Installed: {0}", "installFailed": "Install failed: {0}", "updated": "Updated.", "updateFailed": "Update failed: {0}", "removed": "Removed.", "removeFailed": "Remove failed: {0}" },
"worktreesTab": { "workerOffline": "Worker offline.", "removed": "Removed {0} worktree(s).", "blocked": "Cannot force-remove: {0} task(s) still running. Cancel them first.", "removedFrom": "Removed {0} worktree(s) from {1} task(s)." }, "worktreesTab": { "workerOffline": "Worker offline.", "removed": "Removed {0} worktree(s).", "blocked": "Cannot force-remove: {0} task(s) still running. Cancel them first.", "removedFrom": "Removed {0} worktree(s) from {1} task(s)." },
"worktreesOverview": { "titleAll": "Worktrees", "titleList": "Worktrees — {0}", "listFallback": "list", "cleanupFailed": "Cleanup failed.", "removed": "Removed {0} worktree(s).", "discardFailed": "Failed to discard worktree.", "keepFailed": "Failed to keep worktree.", "cannotForceRunning": "Cannot force-remove a running task.", "forceRemoveFailed": "Force remove failed.", "batchProgress": "Merging {0}/{1}…", "batchDone": "Merged {0}, {1} need resolution." }, "worktreesOverview": { "titleAll": "Worktrees", "titleList": "Worktrees — {0}", "listFallback": "list", "cleanupFailed": "Cleanup failed.", "removed": "Removed {0} worktree(s).", "discardFailed": "Failed to discard worktree.", "keepFailed": "Failed to keep worktree.", "cannotForceRunning": "Cannot force-remove a running task.", "forceRemoveFailed": "Force remove failed.", "batchProgress": "Merging {0}/{1}…", "batchDone": "Merged {0}, {1} need resolution." },
"listSettings": { "untitled": "Untitled" }, "listSettings": { "untitled": "Untitled" },
+3 -3
View File
@@ -35,8 +35,8 @@ Design/ — Tokens.axaml (design tokens; merged before styles) + IslandStyle
- **IslandsShellViewModel** — root coordinator; owns the three island VMs and the `WorkerClient`, wires cross-island events (selection, notes/prep mode, conflict resolution), owns connection state, the update banner, the inline worker-log strip (clickable → Log Visualizer overlay via `OpenLogVisualizerCommand`; `FlashFooterError` surfaces UI-action failures + the worker's Serilog Warn/Error there), responsive-layout flags (`ShowLists`/`ShowDetails` by window width), `PrimeStatus` flash, and the modal openers (About, RepoImport, WeeklyReport, WorktreesOverview, WorkerConnection help, LogVisualizer) plus `RestartWorkerAsync`/`CheckForUpdatesAsync`. Hosts `UpdateCheckService`. - **IslandsShellViewModel** — root coordinator; owns the three island VMs and the `WorkerClient`, wires cross-island events (selection, notes/prep mode, conflict resolution), owns connection state, the update banner, the inline worker-log strip (clickable → Log Visualizer overlay via `OpenLogVisualizerCommand`; `FlashFooterError` surfaces UI-action failures + the worker's Serilog Warn/Error there), responsive-layout flags (`ShowLists`/`ShowDetails` by window width), `PrimeStatus` flash, and the modal openers (About, RepoImport, WeeklyReport, WorktreesOverview, WorkerConnection help, LogVisualizer) plus `RestartWorkerAsync`/`CheckForUpdatesAsync`. Hosts `UpdateCheckService`.
- **ListsIslandViewModel** — smart lists (My Day, Important, Planned, virtual queued/running/review), user lists, selection, list CRUD, drag-reorder, badge counts, opens list settings / repo import / worktrees overview, `OpenInExplorer`/`OpenInTerminal`. - **ListsIslandViewModel** — smart lists (My Day, Important, Planned, virtual queued/running/review), user lists, selection, list CRUD, drag-reorder, badge counts, opens list settings / repo import / worktrees overview, `OpenInExplorer`/`OpenInTerminal`.
- **TasksIslandViewModel** — open/overdue/completed groups for the selected list with hierarchy-aware regrouping; task CRUD, drag-reorder, toggle done/star, schedule, enqueue/dequeue, cancel; review actions (approve, reject-rerun, reject-park, cancel); planning session lifecycle (open/resume/discard/finalize, `QueuePlanningSubtasksAsync`); `RunInteractivelyAsync`, `RefineTask`; MyDay extras (`IsMyDayList`, `ClearDayCommand`, `ShowPrepLogCommand`) and the pinned Notes pseudo-row (`ShowNotesRow`, `OpenNotesCommand`). Raises `NotesRequested`/`PrepRequested` events consumed by the shell. - **TasksIslandViewModel** — open/overdue/completed groups for the selected list with hierarchy-aware regrouping; task CRUD, drag-reorder, toggle done/star, schedule, enqueue/dequeue, cancel; review actions (approve, reject-rerun, reject-park, cancel); planning session lifecycle (open/resume/discard/finalize, `QueuePlanningSubtasksAsync`); `RefineTask`, `OpenConPtySessionRequested` (embedded ConPTY terminal), `PickUpInTerminalAsync`; MyDay extras (`IsMyDayList`, `ClearDayCommand`, `ShowPrepLogCommand`) and the pinned Notes pseudo-row (`ShowNotesRow`, `OpenNotesCommand`). Raises `NotesRequested`/`PrepRequested` events consumed by the shell.
- **DetailsIslandViewModel** — the detail pane for a bound `TaskRowViewModel`. Owns live-log streaming (`Log` via `StreamLineFormatter`), debounced title/description editing, subtasks, session-outcome/roadblock split (splits `Result` at the roadblock marker into two cards), the three-tab work console (`output`/`git`/`session`), child surfacing (`ChildOutcomes` rows plus `ChildrenNeedingAttention`/`HasChildrenNeedingAttention` — children that failed, were cancelled, await review, or reported roadblocks — drive an attention band on the Session tab, which is only visible when `HasChildOutcomes`), and the modes: `IsNotesMode` (hosts `NotesEditorViewModel`), `IsPrepMode`, computed `IsTaskDetailVisible = !IsNotesMode && !IsPrepMode`. Three concerns are extracted into section VMs exposed as properties: **AgentConfigEditorViewModel** (scope=Task; per-task Model/MaxTurns/AgentPath overrides with `InheritedBadge` + `InheritanceResolver`, additive SystemPrompt, debounced auto-save; exposed as `AgentSettings`), **MergeSectionViewModel** (merge-target selection, mergeability indicator via `MergePreviewPresenter` over `PreviewMergeAsync`, `OpenDiffAsync` and `ReviewCombinedDiffCommand` — both build a `DiffViewerViewModel` and call `ShowDiffViewer`), **PrepPanelViewModel** (daily-prep panel: `PrepLog`, `PlanDayCommand``RunDailyPrepNowAsync`, persisted last run via `GetLastPrepLogAsync`). Attachments: `Attachments` (`ObservableCollection<AttachmentRowViewModel>`), `IsDragOver`, `DropStatus`, `CanAcceptDrop`, `AddFilesAsync`, `RemoveAttachmentCommand`; loads on task change; `ComposedPreview` includes attachment paths. Writes directly via `new AttachmentStore()` + `new TaskAttachmentRepository(ctx)`. Helper rows (`ChildOutcomeRowViewModel`, `SubtaskRowViewModel`, `LogLineViewModel`, `AttachmentRowViewModel`) live in the same file. - **DetailsIslandViewModel** — the detail pane for a bound `TaskRowViewModel`. Owns live-log streaming (`Log` via `StreamLineFormatter`), debounced title/description editing, subtasks, session-outcome/roadblock split (splits `Result` at the roadblock marker into two cards), the three-tab work console (`output`/`git`/`session`), child surfacing (`ChildOutcomes` rows plus `ChildrenNeedingAttention`/`HasChildrenNeedingAttention` — children that failed, were cancelled, await review, or reported roadblocks — drive an attention band on the Session tab, which is only visible when `HasChildOutcomes`), and the modes: `IsNotesMode` (hosts `NotesEditorViewModel`), `IsPrepMode`, computed `IsTaskDetailVisible = !IsNotesMode && !IsPrepMode`. Three concerns are extracted into section VMs exposed as properties: **AgentConfigEditorViewModel** (scope=Task; per-task Model/MaxTurns/AgentPath overrides with `InheritedBadge` + `InheritanceResolver`, additive SystemPrompt, debounced auto-save; exposed as `AgentSettings`), **MergeSectionViewModel** (merge-target selection, mergeability indicator via `MergePreviewPresenter` over `PreviewMergeAsync`, `OpenDiffAsync` and `ReviewCombinedDiffCommand` — both build a `DiffViewerViewModel`, call `ShowDiffViewer`, and fire the `DiffViewed` callback; `HasReviewableDiff` reports whether anything is inspectable, feeding the review gate), **PrepPanelViewModel** (daily-prep panel: `PrepLog`, `PlanDayCommand``RunDailyPrepNowAsync`, persisted last run via `GetLastPrepLogAsync`). Attachments: `Attachments` (`ObservableCollection<AttachmentRowViewModel>`), `IsDragOver`, `DropStatus`, `CanAcceptDrop`, `AddFilesAsync`, `RemoveAttachmentCommand`; loads on task change; `ComposedPreview` includes attachment paths. Writes directly via `new AttachmentStore()` + `new TaskAttachmentRepository(ctx)`. Helper rows (`ChildOutcomeRowViewModel`, `SubtaskRowViewModel`, `LogLineViewModel`, `AttachmentRowViewModel`) live in the same file.
- **TaskRowViewModel** / **ListNavItemViewModel** — lightweight display VMs (task row: status, planning phase, parent/blocked links, roadblock count, computed `IsDraft`/`IsPlanned`/`IsChild`/`IsPlanningParent`/`CanRefine`; list row: kind Smart/Virtual/User, count, icon/dot keys, drop hints). - **TaskRowViewModel** / **ListNavItemViewModel** — lightweight display VMs (task row: status, planning phase, parent/blocked links, roadblock count, computed `IsDraft`/`IsPlanned`/`IsChild`/`IsPlanningParent`/`CanRefine`; list row: kind Smart/Virtual/User, count, icon/dot keys, drop hints).
- **NotesEditorViewModel** — day navigator + bullet CRUD for daily notes via `INotesApi`. - **NotesEditorViewModel** — day navigator + bullet CRUD for daily notes via `INotesApi`.
- **Modal VMs** — `SettingsModalViewModel` (four tabs: General, Worktrees, Files prompt-paths, Prime Claude incl. `DailyPrepMaxTasks` + prime-schedule rows), `ListSettingsModalViewModel` (name, working dir, commit type, delete list; hosts shared `AgentConfigEditorViewModel` as `Agent` property (scope=List) — save delegates to `Agent.SaveAsync()`), `RepoImportModalViewModel` (bulk-create lists from git repos found under chosen parents; already-wired repos disabled), `WeeklyReportModalViewModel` (range pickers default "since last standup weekday → today", cached per range, markdown via MarkdownView), `MergeModalViewModel` (single-task merge form, called from the diff modal), `WorktreesOverviewModalViewModel` (global/per-list worktree rows, batch merge + state ops), `UnfinishedPlanningModalViewModel` (Resume/FinalizeNow/Discard for a draft planning session), `WorkerConnectionModalViewModel` (offline help), `AboutModalViewModel`, `LogVisualizerViewModel` (worker logs, last 30 min, all levels + a warn/error-only filter; loads via `GetRecentLogsAsync`). - **Modal VMs** — `SettingsModalViewModel` (four tabs: General, Worktrees, Files prompt-paths, Prime Claude incl. `DailyPrepMaxTasks` + prime-schedule rows), `ListSettingsModalViewModel` (name, working dir, commit type, delete list; hosts shared `AgentConfigEditorViewModel` as `Agent` property (scope=List) — save delegates to `Agent.SaveAsync()`), `RepoImportModalViewModel` (bulk-create lists from git repos found under chosen parents; already-wired repos disabled), `WeeklyReportModalViewModel` (range pickers default "since last standup weekday → today", cached per range, markdown via MarkdownView), `MergeModalViewModel` (single-task merge form, called from the diff modal), `WorktreesOverviewModalViewModel` (global/per-list worktree rows, batch merge + state ops), `UnfinishedPlanningModalViewModel` (Resume/FinalizeNow/Discard for a draft planning session), `WorkerConnectionModalViewModel` (offline help), `AboutModalViewModel`, `LogVisualizerViewModel` (worker logs, last 30 min, all levels + a warn/error-only filter; loads via `GetRecentLogsAsync`).
@@ -45,7 +45,7 @@ Design/ — Tokens.axaml (design tokens; merged before styles) + IslandStyle
## Services ## Services
- **WorkerClient** / **IWorkerClient** — SignalR client connecting to `http://127.0.0.1:47821/hub`, auto-reconnect with exponential backoff. The surface tracks `WorkerHub` (see `src/ClaudeDo.Worker/CLAUDE.md` for the canonical method/event list); groups: task execution (RunNow/Cancel/Continue/Reset/SetTaskStatus), review (`ApproveReviewAsync(taskId, targetBranch) -> MergeResultDto`, reject-to-queue/idle, cancel review, `PreviewMergeAsync -> MergePreviewDto`), planning sessions (start/resume/discard/finalize, queue subtasks, pending draft count, interactive terminal, refine), planning aggregate/integration-branch diffs, unit-merge continue/abort, single-task conflict resolving (start/get-conflict-documents/write-resolution/continue/abort), worktrees (overview, set state, force remove, cleanup, reset all), agents, app settings, lists/config, weekly report, daily notes, daily prep (`RunDailyPrepNowAsync`, `ClearMyDayAsync`, `GetLastPrepLogAsync`), prime schedules, recent worker logs (`GetRecentLogsAsync`). Events mirror `HubBroadcaster` (task/worktree/list/run updates, prep events, planning-merge events, refine events, worker log). Lifecycle (`StartAsync`/`StopAsync`) and a few admin methods live only on the concrete `WorkerClient`. - **WorkerClient** / **IWorkerClient** — SignalR client connecting to `http://127.0.0.1:47821/hub`, auto-reconnect with exponential backoff. The surface tracks `WorkerHub` (see `src/ClaudeDo.Worker/CLAUDE.md` for the canonical method/event list); groups: task execution (RunNow/Cancel/Continue/Reset/SetTaskStatus), review (`ApproveReviewAsync(taskId, targetBranch) -> MergeResultDto`, reject-to-queue/idle, cancel review, `PreviewMergeAsync -> MergePreviewDto`), planning sessions (start/resume/discard/finalize, queue subtasks, pending draft count, refine), pick-up-in-terminal + embedded ConPTY launch specs (`GetInteractiveLaunchSpecAsync`/`GetAdHocLaunchSpecAsync`), planning aggregate/integration-branch diffs, unit-merge continue/abort, single-task conflict resolving (start/get-conflict-documents/write-resolution/continue/abort), worktrees (overview, set state, force remove, cleanup, reset all), agents, app settings, lists/config, weekly report, daily notes, daily prep (`RunDailyPrepNowAsync`, `ClearMyDayAsync`, `GetLastPrepLogAsync`), prime schedules, recent worker logs (`GetRecentLogsAsync`). Events mirror `HubBroadcaster` (task/worktree/list/run updates, prep events, planning-merge events, refine events, worker log). Lifecycle (`StartAsync`/`StopAsync`) and a few admin methods live only on the concrete `WorkerClient`.
- **INotesApi** / **WorkerNotesApi** — daily-note CRUD (`ListAsync(day)`, `AddAsync`, `UpdateAsync`, `DeleteAsync`); UI DTO `DailyNoteDto(Id, Date, Text, SortOrder)`. - **INotesApi** / **WorkerNotesApi** — daily-note CRUD (`ListAsync(day)`, `AddAsync`, `UpdateAsync`, `DeleteAsync`); UI DTO `DailyNoteDto(Id, Date, Text, SortOrder)`.
- **IPrimeScheduleApi** — prime-schedule CRUD (`ListAsync`, `UpsertAsync`, `DeleteAsync`). - **IPrimeScheduleApi** — prime-schedule CRUD (`ListAsync`, `UpsertAsync`, `DeleteAsync`).
- **UpdateCheckService** — polls releases, exposes `LastCheckStatus`/`LatestVersion`/`CheckNowAsync` (feeds the shell's update banner). - **UpdateCheckService** — polls releases, exposes `LastCheckStatus`/`LatestVersion`/`CheckNowAsync` (feeds the shell's update banner).
+1
View File
@@ -16,6 +16,7 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" /> <PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageReference Include="Duende.IdentityModel.OidcClient" Version="7.1.0" /> <PackageReference Include="Duende.IdentityModel.OidcClient" Version="7.1.0" />
<PackageReference Include="Iciclecreek.Avalonia.Terminal" Version="2.0.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
+9 -2
View File
@@ -57,8 +57,8 @@
<!-- Icon.Search --> <!-- Icon.Search -->
<StreamGeometry x:Key="Icon.Search">M11 4a7 7 0 1 0 0 14A7 7 0 0 0 11 4z M20 20l-3.5-3.5</StreamGeometry> <StreamGeometry x:Key="Icon.Search">M11 4a7 7 0 1 0 0 14A7 7 0 0 0 11 4z M20 20l-3.5-3.5</StreamGeometry>
<!-- Icon.Plus --> <!-- Icon.Plus — filled cross (PathIcon fills, so a stroke-only plus renders invisible) -->
<StreamGeometry x:Key="Icon.Plus">M12 5v14M5 12h14</StreamGeometry> <StreamGeometry x:Key="Icon.Plus">M10.6 5 H13.4 V10.6 H19 V13.4 H13.4 V19 H10.6 V13.4 H5 V10.6 H10.6 Z</StreamGeometry>
<!-- Icon.MoreHorizontal (three filled dots) — uses fill so rendered via PathIcon with fill brush --> <!-- Icon.MoreHorizontal (three filled dots) — uses fill so rendered via PathIcon with fill brush -->
<StreamGeometry x:Key="Icon.MoreHorizontal">M5 12m-1.3 0a1.3 1.3 0 1 0 2.6 0 1.3 1.3 0 1 0-2.6 0 M12 12m-1.3 0a1.3 1.3 0 1 0 2.6 0 1.3 1.3 0 1 0-2.6 0 M19 12m-1.3 0a1.3 1.3 0 1 0 2.6 0 1.3 1.3 0 1 0-2.6 0</StreamGeometry> <StreamGeometry x:Key="Icon.MoreHorizontal">M5 12m-1.3 0a1.3 1.3 0 1 0 2.6 0 1.3 1.3 0 1 0-2.6 0 M12 12m-1.3 0a1.3 1.3 0 1 0 2.6 0 1.3 1.3 0 1 0-2.6 0 M19 12m-1.3 0a1.3 1.3 0 1 0 2.6 0 1.3 1.3 0 1 0-2.6 0</StreamGeometry>
@@ -1162,6 +1162,13 @@
<Setter Property="BorderBrush" Value="{StaticResource AccentBrush}" /> <Setter Property="BorderBrush" Value="{StaticResource AccentBrush}" />
<Setter Property="TextElement.Foreground" Value="{StaticResource TextBrush}" /> <Setter Property="TextElement.Foreground" Value="{StaticResource TextBrush}" />
</Style> </Style>
<!-- Disabled: drop the accent so a gated action (e.g. Approve before the diff is
opened) reads clearly as unavailable instead of looking clickable. -->
<Style Selector="Button.accent:disabled /template/ ContentPresenter">
<Setter Property="Background" Value="{StaticResource Surface2Brush}" />
<Setter Property="BorderBrush" Value="{StaticResource LineBrush}" />
<Setter Property="TextElement.Foreground" Value="{StaticResource TextMuteBrush}" />
</Style>
<!-- ============================================================ --> <!-- ============================================================ -->
<!-- DAY TOGGLE --> <!-- DAY TOGGLE -->
@@ -25,11 +25,6 @@ public interface IWorkerClient : INotifyPropertyChanged
/// <summary>A pending question was answered, timed out, or the run ended: (taskId, questionId).</summary> /// <summary>A pending question was answered, timed out, or the run ended: (taskId, questionId).</summary>
event Action<string, string>? TaskQuestionResolvedEvent; event Action<string, string>? TaskQuestionResolvedEvent;
event Action<string>? InteractiveSessionStartedEvent;
event Action<string>? InteractiveSessionEndedEvent;
event Action<string, IReadOnlyList<string>>? InteractiveQueueChangedEvent;
event Action<string, string>? InteractiveMessageSentEvent;
event Action? PrepStartedEvent; event Action? PrepStartedEvent;
event Action<string>? PrepLineEvent; event Action<string>? PrepLineEvent;
event Action<bool>? PrepFinishedEvent; event Action<bool>? PrepFinishedEvent;
@@ -51,10 +46,6 @@ public interface IWorkerClient : INotifyPropertyChanged
Task ContinueTaskAsync(string taskId, string followUpPrompt); Task ContinueTaskAsync(string taskId, string followUpPrompt);
/// <summary>Answer a question a running task raised via AskUser.</summary> /// <summary>Answer a question a running task raised via AskUser.</summary>
Task AnswerTaskQuestionAsync(string taskId, string questionId, string answer); Task AnswerTaskQuestionAsync(string taskId, string questionId, string answer);
Task SendInteractiveMessageAsync(string taskId, string text);
Task RemoveQueuedInteractiveMessageAsync(string taskId, string text);
Task StopInteractiveSessionAsync(string taskId);
Task InterruptInteractiveSessionAsync(string taskId);
/// <summary>The question a running task is currently blocked on, if any (for re-attach).</summary> /// <summary>The question a running task is currently blocked on, if any (for re-attach).</summary>
Task<PendingQuestionDto?> GetPendingQuestionAsync(string taskId); Task<PendingQuestionDto?> GetPendingQuestionAsync(string taskId);
Task ResetTaskAsync(string taskId); Task ResetTaskAsync(string taskId);
@@ -64,6 +55,10 @@ public interface IWorkerClient : INotifyPropertyChanged
Task<SeedResultDto?> RestoreDefaultAgentsAsync(); Task<SeedResultDto?> RestoreDefaultAgentsAsync();
Task<ListConfigDto?> GetListConfigAsync(string listId); Task<ListConfigDto?> GetListConfigAsync(string listId);
Task UpdateTaskAgentSettingsAsync(UpdateTaskAgentSettingsDto dto); Task UpdateTaskAgentSettingsAsync(UpdateTaskAgentSettingsDto dto);
Task<List<SessionSkillDto>> GetSessionSkillsAsync();
Task<List<string>> InstallSessionSkillAsync(string url);
Task UpdateSessionSkillAsync(string sourceUrl);
Task RemoveSessionSkillAsync(string sourceUrl);
Task SetTaskStatusAsync(string taskId, TaskStatus status); Task SetTaskStatusAsync(string taskId, TaskStatus status);
Task<MergeResultDto?> ApproveReviewAsync(string taskId, string targetBranch); Task<MergeResultDto?> ApproveReviewAsync(string taskId, string targetBranch);
Task<MergePreviewDto?> PreviewMergeAsync(string taskId, string targetBranch); Task<MergePreviewDto?> PreviewMergeAsync(string taskId, string targetBranch);
@@ -79,7 +74,22 @@ public interface IWorkerClient : INotifyPropertyChanged
Task<MergeResultDto> ContinueConflictMergeAsync(string taskId); Task<MergeResultDto> ContinueConflictMergeAsync(string taskId);
Task AbortConflictMergeAsync(string taskId); Task AbortConflictMergeAsync(string taskId);
Task StartPlanningSessionAsync(string taskId, CancellationToken ct = default); Task StartPlanningSessionAsync(string taskId, CancellationToken ct = default);
Task OpenInteractiveTerminalAsync(string taskId, CancellationToken ct = default); // Picks up a task's Claude session in a real terminal window (--resume).
Task ResumeTaskInTerminalAsync(string taskId, CancellationToken ct = default);
/// <summary>Commits an interactively-worked task's worktree and moves it to WaitingForReview
/// (the only path that flips a hand-driven ConPTY session into the review/merge pipeline).</summary>
Task SubmitTaskForReviewAsync(string taskId, CancellationToken ct = default);
/// <summary>Launch spec for an embedded ConPTY terminal to open an interactive session
/// in a task's worktree (same worktree prep as an autonomous run).</summary>
Task<LaunchSpec> GetInteractiveLaunchSpecAsync(string taskId, CancellationToken ct = default);
/// <summary>Launch spec for an ad-hoc interactive session in an arbitrary directory --
/// no task, no worktree.</summary>
Task<LaunchSpec> GetAdHocLaunchSpecAsync(string directory, CancellationToken ct = default);
/// <summary>Starts a planning session and returns the launch spec for an embedded ConPTY
/// planning terminal (replaces StartPlanningSessionAsync's external wt window).</summary>
Task<LaunchSpec> GetPlanningStartLaunchSpecAsync(string taskId, CancellationToken ct = default);
/// <summary>Resumes a planning session and returns its embedded-ConPTY launch spec.</summary>
Task<LaunchSpec> GetPlanningResumeLaunchSpecAsync(string taskId, CancellationToken ct = default);
Task ResumePlanningSessionAsync(string taskId, CancellationToken ct = default); Task ResumePlanningSessionAsync(string taskId, CancellationToken ct = default);
Task<DiscardPlanningOutcome> DiscardPlanningSessionAsync(string taskId, bool dequeueQueuedChildren = false, CancellationToken ct = default); Task<DiscardPlanningOutcome> DiscardPlanningSessionAsync(string taskId, bool dequeueQueuedChildren = false, CancellationToken ct = default);
Task FinalizePlanningSessionAsync(string taskId, bool queueAgentTasks = true, CancellationToken ct = default); Task FinalizePlanningSessionAsync(string taskId, bool queueAgentTasks = true, CancellationToken ct = default);
@@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Iciclecreek.Terminal;
namespace ClaudeDo.Ui.Services;
/// <summary>
/// Thin wrapper around <see cref="TerminalControl.LaunchProcess()"/> — the library owns the
/// Porta.Pty spawn, keyboard input, rendering, resize, and focus end to end (see
/// <c>spikes/ConPtyTerminal/MainWindow.axaml.cs</c>, which proved this renders correctly and
/// stays responsive). We only:
/// 1) apply <see cref="TerminalLaunchDescriptor.Env"/> onto the current process environment
/// before launching — Porta.Pty inherits the calling process's environment and there is no
/// per-launch env seam on <see cref="TerminalControl"/>/<see cref="TerminalControl.LaunchProcess()"/> —
/// 2) relay the control's own <see cref="TerminalControl.ProcessExited"/> event and
/// <see cref="TerminalControl.Kill()"/> method.
/// </summary>
public sealed class PtyTerminalSession : IDisposable
{
private TerminalControl? _control;
private bool _disposed;
public bool IsRunning { get; private set; }
public int? ExitCode { get; private set; }
/// <summary>Raised when the child process exits, on the UI thread, with its exit code.</summary>
public event EventHandler<int>? ProcessExited;
/// <summary>
/// Applies <paramref name="descriptor"/>'s env vars to the current process, then drives
/// <paramref name="control"/> to launch it via <see cref="TerminalControl.LaunchProcess()"/>.
/// </summary>
public async Task StartAsync(TerminalLaunchDescriptor descriptor, TerminalControl control, CancellationToken ct = default)
{
if (_control is not null) throw new InvalidOperationException("Session already started.");
_control = control;
control.ProcessExited += OnControlProcessExited;
foreach (var (key, value) in descriptor.Env)
Environment.SetEnvironmentVariable(key, value);
control.Process = descriptor.Exe;
control.Args = new List<string>(descriptor.Args);
control.StartingDirectory = descriptor.Cwd;
await control.LaunchProcess();
IsRunning = true;
}
private void OnControlProcessExited(object? sender, ProcessExitedEventArgs e)
{
IsRunning = false;
ExitCode = e.ExitCode;
ProcessExited?.Invoke(this, e.ExitCode);
}
public void Kill()
{
try { _control?.Kill(); }
catch (Exception) { /* already exited */ }
}
public void Dispose()
{
if (_disposed) return;
_disposed = true;
if (_control is not null)
_control.ProcessExited -= OnControlProcessExited;
}
}
@@ -0,0 +1,10 @@
using System.Collections.Generic;
namespace ClaudeDo.Ui.Services;
/// <summary>Plain launch spec for an embedded ConPTY terminal session — no worker/SignalR coupling.</summary>
public sealed record TerminalLaunchDescriptor(
string Cwd,
string Exe,
IReadOnlyList<string> Args,
IReadOnlyDictionary<string, string> Env);
+47 -54
View File
@@ -49,10 +49,6 @@ public partial class WorkerClient : ObservableObject, IAsyncDisposable, IWorkerC
public event Action<string>? TaskUpdatedEvent; public event Action<string>? TaskUpdatedEvent;
public event Action<string, string, string>? TaskQuestionAskedEvent; public event Action<string, string, string>? TaskQuestionAskedEvent;
public event Action<string, string>? TaskQuestionResolvedEvent; public event Action<string, string>? TaskQuestionResolvedEvent;
public event Action<string>? InteractiveSessionStartedEvent;
public event Action<string>? InteractiveSessionEndedEvent;
public event Action<string, IReadOnlyList<string>>? InteractiveQueueChangedEvent;
public event Action<string, string>? InteractiveMessageSentEvent;
public event Action? ConnectionRestoredEvent; public event Action? ConnectionRestoredEvent;
public event Action<string>? WorktreeUpdatedEvent; public event Action<string>? WorktreeUpdatedEvent;
public event Action<string>? ListUpdatedEvent; public event Action<string>? ListUpdatedEvent;
@@ -152,26 +148,6 @@ public partial class WorkerClient : ObservableObject, IAsyncDisposable, IWorkerC
Dispatcher.UIThread.Post(() => TaskQuestionResolvedEvent?.Invoke(taskId, questionId)); Dispatcher.UIThread.Post(() => TaskQuestionResolvedEvent?.Invoke(taskId, questionId));
}); });
_hub.On<string>("InteractiveSessionStarted", taskId =>
{
Dispatcher.UIThread.Post(() => InteractiveSessionStartedEvent?.Invoke(taskId));
});
_hub.On<string>("InteractiveSessionEnded", taskId =>
{
Dispatcher.UIThread.Post(() => InteractiveSessionEndedEvent?.Invoke(taskId));
});
_hub.On<string, IReadOnlyList<string>>("InteractiveQueueChanged", (taskId, pending) =>
{
Dispatcher.UIThread.Post(() => InteractiveQueueChangedEvent?.Invoke(taskId, pending));
});
_hub.On<string, string>("InteractiveMessageSent", (taskId, text) =>
{
Dispatcher.UIThread.Post(() => InteractiveMessageSentEvent?.Invoke(taskId, text));
});
_hub.On<string>("WorktreeUpdated", taskId => _hub.On<string>("WorktreeUpdated", taskId =>
{ {
Dispatcher.UIThread.Post(() => WorktreeUpdatedEvent?.Invoke(taskId)); Dispatcher.UIThread.Post(() => WorktreeUpdatedEvent?.Invoke(taskId));
@@ -303,30 +279,6 @@ public partial class WorkerClient : ObservableObject, IAsyncDisposable, IWorkerC
catch { /* offline or already resolved — the UI clears optimistically */ } catch { /* offline or already resolved — the UI clears optimistically */ }
} }
public async Task SendInteractiveMessageAsync(string taskId, string text)
{
try { await _hub.InvokeAsync("SendInteractiveMessage", taskId, text); }
catch { /* offline or session already ended */ }
}
public async Task RemoveQueuedInteractiveMessageAsync(string taskId, string text)
{
try { await _hub.InvokeAsync("RemoveQueuedInteractiveMessage", taskId, text); }
catch { /* offline or session already ended */ }
}
public async Task StopInteractiveSessionAsync(string taskId)
{
try { await _hub.InvokeAsync("StopInteractiveSession", taskId); }
catch { /* offline */ }
}
public async Task InterruptInteractiveSessionAsync(string taskId)
{
try { await _hub.InvokeAsync("InterruptInteractiveSession", taskId); }
catch { /* offline */ }
}
public Task<PendingQuestionDto?> GetPendingQuestionAsync(string taskId) public Task<PendingQuestionDto?> GetPendingQuestionAsync(string taskId)
=> TryInvokeAsync<PendingQuestionDto>("GetPendingQuestion", taskId); => TryInvokeAsync<PendingQuestionDto>("GetPendingQuestion", taskId);
@@ -481,6 +433,18 @@ public partial class WorkerClient : ObservableObject, IAsyncDisposable, IWorkerC
await _hub.InvokeAsync("UpdateTaskAgentSettings", dto); await _hub.InvokeAsync("UpdateTaskAgentSettings", dto);
} }
public async Task<List<SessionSkillDto>> GetSessionSkillsAsync()
=> await TryInvokeAsync<List<SessionSkillDto>>("GetSessionSkills") ?? [];
public Task<List<string>> InstallSessionSkillAsync(string url)
=> _hub.InvokeAsync<List<string>>("InstallSessionSkill", url);
public Task UpdateSessionSkillAsync(string sourceUrl)
=> _hub.InvokeAsync("UpdateSessionSkill", sourceUrl);
public Task RemoveSessionSkillAsync(string sourceUrl)
=> _hub.InvokeAsync("RemoveSessionSkill", sourceUrl);
public async Task SetTaskStatusAsync(string taskId, ClaudeDo.Data.Models.TaskStatus status) public async Task SetTaskStatusAsync(string taskId, ClaudeDo.Data.Models.TaskStatus status)
{ {
await _hub.InvokeAsync("SetTaskStatus", taskId, status.ToString()); await _hub.InvokeAsync("SetTaskStatus", taskId, status.ToString());
@@ -546,8 +510,23 @@ public partial class WorkerClient : ObservableObject, IAsyncDisposable, IWorkerC
public async Task<PlanningSessionResumeInfo> ResumePlanningSessionAsync(string taskId, CancellationToken ct = default) public async Task<PlanningSessionResumeInfo> ResumePlanningSessionAsync(string taskId, CancellationToken ct = default)
=> await _hub.InvokeAsync<PlanningSessionResumeInfo>("ResumePlanningSessionAsync", taskId, ct); => await _hub.InvokeAsync<PlanningSessionResumeInfo>("ResumePlanningSessionAsync", taskId, ct);
public async Task OpenInteractiveTerminalAsync(string taskId, CancellationToken ct = default) public async Task ResumeTaskInTerminalAsync(string taskId, CancellationToken ct = default)
=> await _hub.InvokeAsync("OpenInteractiveTerminalAsync", taskId, ct); => await _hub.InvokeAsync("ResumeTaskInTerminal", taskId, ct);
public async Task SubmitTaskForReviewAsync(string taskId, CancellationToken ct = default)
=> await _hub.InvokeAsync("SubmitTaskForReview", taskId, ct);
public async Task<LaunchSpec> GetInteractiveLaunchSpecAsync(string taskId, CancellationToken ct = default)
=> await _hub.InvokeAsync<LaunchSpec>("GetInteractiveLaunchSpec", taskId, ct);
public async Task<LaunchSpec> GetAdHocLaunchSpecAsync(string directory, CancellationToken ct = default)
=> await _hub.InvokeAsync<LaunchSpec>("GetAdHocLaunchSpec", directory, ct);
public async Task<LaunchSpec> GetPlanningStartLaunchSpecAsync(string taskId, CancellationToken ct = default)
=> await _hub.InvokeAsync<LaunchSpec>("GetPlanningStartLaunchSpec", taskId, ct);
public async Task<LaunchSpec> GetPlanningResumeLaunchSpecAsync(string taskId, CancellationToken ct = default)
=> await _hub.InvokeAsync<LaunchSpec>("GetPlanningResumeLaunchSpec", taskId, ct);
public async Task<DiscardPlanningOutcome> DiscardPlanningSessionAsync(string taskId, bool dequeueQueuedChildren = false, CancellationToken ct = default) public async Task<DiscardPlanningOutcome> DiscardPlanningSessionAsync(string taskId, bool dequeueQueuedChildren = false, CancellationToken ct = default)
=> await _hub.InvokeAsync<DiscardPlanningOutcome>("DiscardPlanningSessionAsync", taskId, dequeueQueuedChildren, ct); => await _hub.InvokeAsync<DiscardPlanningOutcome>("DiscardPlanningSessionAsync", taskId, dequeueQueuedChildren, ct);
@@ -624,7 +603,15 @@ public sealed record AppSettingsDto(
int WorktreeAutoCleanupDays, int WorktreeAutoCleanupDays,
string? ReportExcludedPaths, string? ReportExcludedPaths,
int StandupWeekday, int StandupWeekday,
int DailyPrepMaxTasks); int DailyPrepMaxTasks,
List<string>? SessionSkills = null);
public sealed record SessionSkillDto(
string Name,
string Description,
string SourceUrl,
string PinnedRef,
DateTimeOffset AddedAt);
public sealed record WorktreeCleanupDto(int Removed); public sealed record WorktreeCleanupDto(int Removed);
public sealed record WorktreeResetDto(int Removed, int TasksAffected, bool Blocked, int RunningTasks); public sealed record WorktreeResetDto(int Removed, int TasksAffected, bool Blocked, int RunningTasks);
@@ -635,9 +622,9 @@ public record MergeConflictDocumentsDto(string TaskId, IReadOnlyList<ConflictDoc
public record ConflictDocumentDto(string Path, bool IsBinary, IReadOnlyList<MergeSegmentDto> Segments); public record ConflictDocumentDto(string Path, bool IsBinary, IReadOnlyList<MergeSegmentDto> Segments);
public record MergeSegmentDto(bool IsConflict, string Text, string Ours, string? Base, string Theirs); public record MergeSegmentDto(bool IsConflict, string Text, string Ours, string? Base, string Theirs);
public sealed record UpdateListDto(string Id, string Name, string? WorkingDir, string DefaultCommitType); public sealed record UpdateListDto(string Id, string Name, string? WorkingDir, string DefaultCommitType);
public sealed record UpdateListConfigDto(string ListId, string? Model, string? SystemPrompt, string? AgentPath, int? MaxTurns = null); public sealed record UpdateListConfigDto(string ListId, string? Model, string? SystemPrompt, string? AgentPath, int? MaxTurns = null, List<string>? SessionSkills = null);
public sealed record UpdateTaskAgentSettingsDto(string TaskId, string? Model, string? SystemPrompt, string? AgentPath, int? MaxTurns = null); public sealed record UpdateTaskAgentSettingsDto(string TaskId, string? Model, string? SystemPrompt, string? AgentPath, int? MaxTurns = null, List<string>? SessionSkills = null);
public sealed record ListConfigDto(string? Model, string? SystemPrompt, string? AgentPath, int? MaxTurns = null); public sealed record ListConfigDto(string? Model, string? SystemPrompt, string? AgentPath, int? MaxTurns = null, List<string>? SessionSkills = null);
public sealed record SeedResultDto(int Copied, int Skipped); public sealed record SeedResultDto(int Copied, int Skipped);
public sealed record WorktreeOverviewDto( public sealed record WorktreeOverviewDto(
@@ -654,6 +641,12 @@ public sealed record WorktreeOverviewDto(
DateTime CreatedAt, DateTime CreatedAt,
bool PathExistsOnDisk); bool PathExistsOnDisk);
public sealed record LaunchSpec(
string Cwd,
string Exe,
IReadOnlyList<string> Args,
IReadOnlyDictionary<string, string> Env);
public sealed record ForceRemoveResultDto(bool Removed, string? Reason); public sealed record ForceRemoveResultDto(bool Removed, string? Reason);
public sealed record PendingQuestionDto(string TaskId, string QuestionId, string Question); public sealed record PendingQuestionDto(string TaskId, string QuestionId, string Question);
@@ -1,4 +1,7 @@
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Text.Json;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using ClaudeDo.Data.Models; using ClaudeDo.Data.Models;
@@ -57,6 +60,7 @@ public sealed partial class AgentConfigEditorViewModel : ViewModelBase, IDisposa
public ObservableCollection<string> ModelOptions { get; } = new(ModelRegistry.Aliases); public ObservableCollection<string> ModelOptions { get; } = new(ModelRegistry.Aliases);
public ObservableCollection<AgentInfo> Agents { get; } = new(); public ObservableCollection<AgentInfo> Agents { get; } = new();
public ObservableCollection<SelectableSkillViewModel> SessionSkills { get; } = new();
public AgentConfigEditorViewModel(IWorkerClient worker, AgentConfigScope scope) public AgentConfigEditorViewModel(IWorkerClient worker, AgentConfigScope scope)
{ {
@@ -67,9 +71,31 @@ public sealed partial class AgentConfigEditorViewModel : ViewModelBase, IDisposa
// short-lived modal recreated with the current language on each open. // short-lived modal recreated with the current language on each open.
if (scope == AgentConfigScope.Task) if (scope == AgentConfigScope.Task)
Loc.LanguageChanged += _langChangedHandler; Loc.LanguageChanged += _langChangedHandler;
SessionSkills.CollectionChanged += OnSessionSkillsCollectionChanged;
} }
public void Dispose() => Loc.LanguageChanged -= _langChangedHandler; private void OnSessionSkillsCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
{
if (e.NewItems is not null)
foreach (SelectableSkillViewModel item in e.NewItems)
item.PropertyChanged += OnSkillItemPropertyChanged;
if (e.OldItems is not null)
foreach (SelectableSkillViewModel item in e.OldItems)
item.PropertyChanged -= OnSkillItemPropertyChanged;
}
private void OnSkillItemPropertyChanged(object? sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(SelectableSkillViewModel.IsSelected)) QueueSave();
}
public void Dispose()
{
Loc.LanguageChanged -= _langChangedHandler;
SessionSkills.CollectionChanged -= OnSessionSkillsCollectionChanged;
foreach (var s in SessionSkills) s.PropertyChanged -= OnSkillItemPropertyChanged;
}
partial void OnModelChanged(string? value) { RecomputeModelBadge(); QueueSave(); } partial void OnModelChanged(string? value) { RecomputeModelBadge(); QueueSave(); }
@@ -154,11 +180,18 @@ public sealed partial class AgentConfigEditorViewModel : ViewModelBase, IDisposa
var sp = string.IsNullOrWhiteSpace(SystemPrompt) ? null : SystemPrompt; var sp = string.IsNullOrWhiteSpace(SystemPrompt) ? null : SystemPrompt;
var ap = SelectedAgent is null || string.IsNullOrWhiteSpace(SelectedAgent.Path) ? null : SelectedAgent.Path; var ap = SelectedAgent is null || string.IsNullOrWhiteSpace(SelectedAgent.Path) ? null : SelectedAgent.Path;
var turns = MaxTurns is decimal d ? (int?)d : null; var turns = MaxTurns is decimal d ? (int?)d : null;
var skills = SelectedSessionSkillNames();
if (_scope == AgentConfigScope.Task) if (_scope == AgentConfigScope.Task)
await _worker.UpdateTaskAgentSettingsAsync(new UpdateTaskAgentSettingsDto(TargetId, model, sp, ap, turns)); await _worker.UpdateTaskAgentSettingsAsync(new UpdateTaskAgentSettingsDto(TargetId, model, sp, ap, turns, skills));
else else
await _worker.UpdateListConfigAsync(new UpdateListConfigDto(TargetId, model, sp, ap, turns)); await _worker.UpdateListConfigAsync(new UpdateListConfigDto(TargetId, model, sp, ap, turns, skills));
}
private List<string>? SelectedSessionSkillNames()
{
var names = SessionSkills.Where(s => s.IsSelected).Select(s => s.Name).ToList();
return names.Count == 0 ? null : names;
} }
public async System.Threading.Tasks.Task LoadForListAsync(string listId, CancellationToken ct = default) public async System.Threading.Tasks.Task LoadForListAsync(string listId, CancellationToken ct = default)
@@ -172,6 +205,7 @@ public sealed partial class AgentConfigEditorViewModel : ViewModelBase, IDisposa
var cfg = await _worker.GetListConfigAsync(listId); var cfg = await _worker.GetListConfigAsync(listId);
ApplyConfig(cfg?.Model, cfg?.MaxTurns, cfg?.SystemPrompt, cfg?.AgentPath); ApplyConfig(cfg?.Model, cfg?.MaxTurns, cfg?.SystemPrompt, cfg?.AgentPath);
await ReloadSessionSkillsAsync(cfg?.SessionSkills);
_listModel = null; _listMaxTurns = null; _listAgentName = null; _listModel = null; _listMaxTurns = null; _listAgentName = null;
EffectiveSystemPromptHint = ""; EffectiveSystemPromptHint = "";
@@ -189,6 +223,7 @@ public sealed partial class AgentConfigEditorViewModel : ViewModelBase, IDisposa
TargetId = entity.Id; TargetId = entity.Id;
await ReloadAgentsAsync("(inherited)"); await ReloadAgentsAsync("(inherited)");
ApplyConfig(entity.Model, entity.MaxTurns, entity.SystemPrompt, entity.AgentPath); ApplyConfig(entity.Model, entity.MaxTurns, entity.SystemPrompt, entity.AgentPath);
await ReloadSessionSkillsAsync(ParseSessionSkills(entity.SessionSkills));
var listCfg = await _worker.GetListConfigAsync(entity.ListId); var listCfg = await _worker.GetListConfigAsync(entity.ListId);
await LoadGlobalDefaultsAsync(); await LoadGlobalDefaultsAsync();
@@ -214,12 +249,30 @@ public sealed partial class AgentConfigEditorViewModel : ViewModelBase, IDisposa
MaxTurns = null; MaxTurns = null;
SystemPrompt = ""; SystemPrompt = "";
SelectedAgent = null; SelectedAgent = null;
foreach (var s in SessionSkills) s.IsSelected = false;
} }
finally { _suppressSave = false; } finally { _suppressSave = false; }
EffectiveSystemPromptHint = ""; EffectiveSystemPromptHint = "";
TargetId = null; TargetId = null;
} }
private static List<string>? ParseSessionSkills(string? json)
{
if (string.IsNullOrWhiteSpace(json)) return null;
try { return JsonSerializer.Deserialize<List<string>>(json); }
catch (JsonException) { return null; }
}
private async System.Threading.Tasks.Task ReloadSessionSkillsAsync(IReadOnlyCollection<string>? selected)
{
var installed = await _worker.GetSessionSkillsAsync();
var selectedSet = selected is null ? new HashSet<string>() : new HashSet<string>(selected);
foreach (var s in SessionSkills) s.PropertyChanged -= OnSkillItemPropertyChanged;
SessionSkills.Clear();
foreach (var s in installed)
SessionSkills.Add(new SelectableSkillViewModel(s.Name, s.Description, selectedSet.Contains(s.Name)));
}
private async System.Threading.Tasks.Task ReloadAgentsAsync(string placeholderName) private async System.Threading.Tasks.Task ReloadAgentsAsync(string placeholderName)
{ {
Agents.Clear(); Agents.Clear();
@@ -255,5 +308,6 @@ public sealed partial class AgentConfigEditorViewModel : ViewModelBase, IDisposa
MaxTurns = null; MaxTurns = null;
SystemPrompt = ""; SystemPrompt = "";
SelectedAgent = Agents.Count > 0 ? Agents[0] : null; SelectedAgent = Agents.Count > 0 ? Agents[0] : null;
foreach (var s in SessionSkills) s.IsSelected = false;
} }
} }
@@ -0,0 +1,23 @@
using CommunityToolkit.Mvvm.ComponentModel;
namespace ClaudeDo.Ui.ViewModels.Agent;
/// <summary>
/// One installed session skill shown as a checkbox row. Reused by the global (General tab),
/// list, and task selectors — selection is additive-union across all three levels, so this
/// is deliberately just a name + checked flag with no inheritance/override state.
/// </summary>
public sealed partial class SelectableSkillViewModel : ViewModelBase
{
public string Name { get; }
public string Description { get; }
[ObservableProperty] private bool _isSelected;
public SelectableSkillViewModel(string name, string description = "", bool isSelected = false)
{
Name = name;
Description = description;
_isSelected = isSelected;
}
}
@@ -103,9 +103,19 @@ public sealed partial class ConflictResolverViewModel : ObservableObject
} }
} }
public string ContinueHint => HasBinaryFiles public string ContinueHint
? "Binary conflicts must be resolved externally — abort and resolve in your editor." {
: ""; get
{
if (HasBinaryFiles)
return "Binary conflicts must be resolved externally — abort and resolve in your editor.";
var openFiles = Files.Count(f => !f.AllResolved);
if (openFiles == 0) return "";
var openConflicts = _flat.Count(x => !x.Block.IsResolved);
return $"{openConflicts} {(openConflicts == 1 ? "conflict" : "conflicts")} in " +
$"{openFiles} {(openFiles == 1 ? "file" : "files")} still unresolved.";
}
}
private bool InRange => CurrentIndex >= 0 && CurrentIndex < _flat.Count; private bool InRange => CurrentIndex >= 0 && CurrentIndex < _flat.Count;
@@ -188,6 +198,7 @@ public sealed partial class ConflictResolverViewModel : ObservableObject
OnPropertyChanged(nameof(HasBinaryFiles)); OnPropertyChanged(nameof(HasBinaryFiles));
OnPropertyChanged(nameof(HasMultipleFiles)); OnPropertyChanged(nameof(HasMultipleFiles));
OnPropertyChanged(nameof(FilesSummary)); OnPropertyChanged(nameof(FilesSummary));
OnPropertyChanged(nameof(ContinueHint));
RecomputeCanContinue(); RecomputeCanContinue();
if (_flat.Count > 0) if (_flat.Count > 0)
MoveTo(0); // also sets ActiveFile via MoveTo MoveTo(0); // also sets ActiveFile via MoveTo
@@ -211,6 +222,7 @@ public sealed partial class ConflictResolverViewModel : ObservableObject
OnPropertyChanged(nameof(PositionText)); OnPropertyChanged(nameof(PositionText));
OnPropertyChanged(nameof(ActiveResultText)); OnPropertyChanged(nameof(ActiveResultText));
OnPropertyChanged(nameof(FilesSummary)); OnPropertyChanged(nameof(FilesSummary));
OnPropertyChanged(nameof(ContinueHint));
} }
} }
@@ -0,0 +1,84 @@
using System;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using ClaudeDo.Ui.Services;
using Iciclecreek.Terminal;
namespace ClaudeDo.Ui.ViewModels;
/// <summary>
/// Hosts a <see cref="PtyTerminalSession"/> for an embedded ConPTY terminal. The view attaches
/// its <see cref="TerminalControl"/> once loaded via <see cref="AttachControl"/>; <see cref="Start"/>
/// can be called before or after attach — whichever happens second triggers the launch.
/// </summary>
public sealed partial class InteractiveTerminalViewModel : ViewModelBase, IDisposable
{
private readonly PtyTerminalSession _session = new();
private TerminalControl? _control;
private TerminalLaunchDescriptor? _pendingDescriptor;
[ObservableProperty] private bool _isRunning;
[ObservableProperty] private bool _hasExited;
[ObservableProperty] private int? _exitCode;
[ObservableProperty] private string? _startError;
public InteractiveTerminalViewModel()
{
_session.ProcessExited += OnSessionProcessExited;
}
/// <summary>Called by the view once its <see cref="TerminalControl"/> has loaded (template applied).</summary>
public void AttachControl(TerminalControl control)
{
_control = control;
if (_pendingDescriptor is { } descriptor)
{
_pendingDescriptor = null;
_ = StartCoreAsync(descriptor);
}
}
public void Start(TerminalLaunchDescriptor descriptor)
{
if (_control is null)
{
_pendingDescriptor = descriptor;
return;
}
_ = StartCoreAsync(descriptor);
}
private async Task StartCoreAsync(TerminalLaunchDescriptor descriptor)
{
if (_control is null) return;
try
{
StartError = null;
await _session.StartAsync(descriptor, _control);
IsRunning = true;
HasExited = false;
ExitCode = null;
}
catch (Exception ex)
{
IsRunning = false;
HasExited = true;
StartError = ex.Message;
}
}
private void OnSessionProcessExited(object? sender, int exitCode)
{
IsRunning = false;
HasExited = true;
ExitCode = exitCode;
}
public void Kill() => _session.Kill();
public void Dispose()
{
_session.ProcessExited -= OnSessionProcessExited;
_session.Dispose();
}
}
@@ -296,6 +296,15 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
AgentSettings = new AgentConfigEditorViewModel(worker, AgentConfigScope.Task); AgentSettings = new AgentConfigEditorViewModel(worker, AgentConfigScope.Task);
Merge = new MergeSectionViewModel(worker, services); Merge = new MergeSectionViewModel(worker, services);
Merge.DiffViewed = () => ReviewDiffViewed = true;
Merge.PropertyChanged += (_, e) =>
{
if (e.PropertyName == nameof(MergeSectionViewModel.HasReviewableDiff))
{
ApproveReviewCommand.NotifyCanExecuteChanged();
OnPropertyChanged(nameof(ShowReviewDiffHint));
}
};
Prep = new PrepPanelViewModel(worker); Prep = new PrepPanelViewModel(worker);
Notes = new NotesEditorViewModel(_notesApi); Notes = new NotesEditorViewModel(_notesApi);
@@ -399,6 +408,13 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
DequeueCommand.NotifyCanExecuteChanged(); DequeueCommand.NotifyCanExecuteChanged();
ResetAndRetryCommand.NotifyCanExecuteChanged(); ResetAndRetryCommand.NotifyCanExecuteChanged();
ContinueCommand.NotifyCanExecuteChanged(); ContinueCommand.NotifyCanExecuteChanged();
// A state change means a new run/review cycle: the diff must be
// re-inspected before merge can be approved again.
ReviewDiffViewed = false;
ApproveReviewCommand.NotifyCanExecuteChanged();
OnPropertyChanged(nameof(ShowReviewDiffHint));
OnPropertyChanged(nameof(CanSubmitForReview));
SubmitForReviewCommand.NotifyCanExecuteChanged();
AgentSettings.IsRunning = IsRunning; AgentSettings.IsRunning = IsRunning;
NotifySessionSections(); NotifySessionSections();
OnPropertyChanged(nameof(CanAcceptDrop)); OnPropertyChanged(nameof(CanAcceptDrop));
@@ -536,6 +552,10 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
var latestRun = await runRepo.GetLatestByTaskIdAsync(row.Id, ct); var latestRun = await runRepo.GetLatestByTaskIdAsync(row.Id, ct);
ct.ThrowIfCancellationRequested(); ct.ThrowIfCancellationRequested();
LatestRunSessionId = latestRun?.SessionId; LatestRunSessionId = latestRun?.SessionId;
// Restore turn/token counts from the last run so a reloaded terminal task
// shows its real turns instead of "0/max".
Turns = latestRun?.TurnCount ?? 0;
Tokens = (latestRun?.TokensIn ?? 0) + (latestRun?.TokensOut ?? 0);
Monitor.ApplyOutcome(entity.Result, latestRun?.ErrorMarkdown); Monitor.ApplyOutcome(entity.Result, latestRun?.ErrorMarkdown);
Monitor.SetTaskId(row.Id); Monitor.SetTaskId(row.Id);
@@ -740,6 +760,8 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
Merge.SyncWorktree(WorktreePath, WorktreeBaseCommit, WorktreeHeadCommit, Merge.SyncWorktree(WorktreePath, WorktreeBaseCommit, WorktreeHeadCommit,
WorktreeStateLabel, _listWorkingDir); WorktreeStateLabel, _listWorkingDir);
NotifySessionSections(); NotifySessionSections();
OnPropertyChanged(nameof(CanSubmitForReview));
SubmitForReviewCommand.NotifyCanExecuteChanged();
} }
partial void OnWorktreeHeadCommitChanged(string? value) => partial void OnWorktreeHeadCommitChanged(string? value) =>
@@ -748,9 +770,11 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
partial void OnTaskChanged(TaskRowViewModel? value) partial void OnTaskChanged(TaskRowViewModel? value)
{ {
ReviewDiffViewed = false;
Merge.SyncTaskContext(Task?.Id, Task?.Title, Task?.IsPlanningParent == true); Merge.SyncTaskContext(Task?.Id, Task?.Title, Task?.IsPlanningParent == true);
NotifySessionSections(); NotifySessionSections();
OnPropertyChanged(nameof(CanAcceptDrop)); OnPropertyChanged(nameof(CanAcceptDrop));
OnPropertyChanged(nameof(CanPickUpInTerminal));
} }
[RelayCommand] [RelayCommand]
@@ -892,6 +916,24 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
catch { /* offline */ } catch { /* offline */ }
} }
// Pick up in a terminal only where a session + worktree reliably still exist (parked
// for review or failed mid-run); the worker reports a clear error otherwise.
public bool CanPickUpInTerminal => Task is not null
&& Task.Status is ClaudeDo.Data.Models.TaskStatus.WaitingForReview
or ClaudeDo.Data.Models.TaskStatus.Failed;
[RelayCommand]
private async System.Threading.Tasks.Task PickUpInTerminalAsync()
{
if (Task is null) return;
ClaudeDo.Ui.Services.ForegroundHelper.AllowAny();
try { await _worker.ResumeTaskInTerminalAsync(Task.Id); }
catch (System.Exception ex)
{
if (ShowErrorAsync != null) await ShowErrorAsync(ex.Message);
}
}
[RelayCommand(CanExecute = nameof(CanEnqueue))] [RelayCommand(CanExecute = nameof(CanEnqueue))]
private async System.Threading.Tasks.Task EnqueueAsync() private async System.Threading.Tasks.Task EnqueueAsync()
{ {
@@ -958,7 +1000,20 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
private bool CanResetAndRetry() => private bool CanResetAndRetry() =>
Task != null && _worker.IsConnected && ShowResetAndRetry; Task != null && _worker.IsConnected && ShowResetAndRetry;
[RelayCommand] // Set once the user opens the diff/combined-diff for the current review. Reset on
// task switch and on every state change (a new run means a new diff to read), so
// Approve & Merge stays blocked until the pending changes have been inspected.
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(ApproveReviewCommand))]
[NotifyPropertyChangedFor(nameof(ShowReviewDiffHint))]
private bool _reviewDiffViewed;
// True while a review is pending, there is a diff to inspect, and it has not been
// opened yet — drives the "open the diff first" hint next to Approve & Merge.
public bool ShowReviewDiffHint =>
IsWaitingForReview && Merge.HasReviewableDiff && !ReviewDiffViewed;
[RelayCommand(CanExecute = nameof(CanApproveReview))]
private async System.Threading.Tasks.Task ApproveReviewAsync() private async System.Threading.Tasks.Task ApproveReviewAsync()
{ {
if (Task is null || !_worker.IsConnected) return; if (Task is null || !_worker.IsConnected) return;
@@ -976,6 +1031,30 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
} }
} }
// Force the diff to have been opened before a merge can happen — but only when
// there is actually something to inspect (a childless sandbox run with no worktree
// has no diff, so it approves straight through).
private bool CanApproveReview() =>
Task != null && _worker.IsConnected && IsWaitingForReview
&& (!Merge.HasReviewableDiff || ReviewDiffViewed);
// An interactive (ConPTY) session leaves its worktree changed but never flips the task
// status. Offer "Submit for review" for an Idle/Failed task that still has a worktree, so
// its hand-driven work can enter the normal review/merge flow (commits first, server-side).
public bool CanSubmitForReview =>
Task != null && _worker.IsConnected && (IsIdle || IsFailed) && !string.IsNullOrEmpty(WorktreePath);
[RelayCommand(CanExecute = nameof(CanSubmitForReview))]
private async System.Threading.Tasks.Task SubmitForReviewAsync()
{
if (Task is null || !_worker.IsConnected) return;
try { await _worker.SubmitTaskForReviewAsync(Task.Id); }
catch (Exception ex)
{
if (ShowErrorAsync != null) await ShowErrorAsync(ex.Message);
}
}
[RelayCommand(CanExecute = nameof(HasReviewFeedback))] [RelayCommand(CanExecute = nameof(HasReviewFeedback))]
private async System.Threading.Tasks.Task RejectReviewAsync() private async System.Threading.Tasks.Task RejectReviewAsync()
{ {
@@ -1080,7 +1159,8 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase, IDisposable
} }
catch (Exception ex) catch (Exception ex)
{ {
failures.Add($"{fileName}: {ex.Message}"); // Keep the exception type in the message so an intermittent failure is analyzable.
failures.Add($"{fileName}: {ex.GetType().Name}: {ex.Message}");
} }
} }
@@ -48,6 +48,15 @@ public sealed partial class MergeSectionViewModel : ViewModelBase
public Func<DiffViewerViewModel, System.Threading.Tasks.Task>? ShowDiffViewer { get; set; } public Func<DiffViewerViewModel, System.Threading.Tasks.Task>? ShowDiffViewer { get; set; }
public Func<MergeModalViewModel, System.Threading.Tasks.Task>? ShowMergeModal { get; set; } public Func<MergeModalViewModel, System.Threading.Tasks.Task>? ShowMergeModal { get; set; }
// Raised when the user opens a diff/combined-diff for the current task, so the
// review gate can record that the changes were inspected before merging.
public Action? DiffViewed { get; set; }
// True when there is something to inspect before merging (a live worktree diff,
// a merged commit range, or a planning/children combined diff). When false there
// is nothing to read, so the review gate must not block approve.
public bool HasReviewableDiff => CanOpenDiff() || CanReviewDiff();
public MergeSectionViewModel(IWorkerClient worker, IServiceProvider services) public MergeSectionViewModel(IWorkerClient worker, IServiceProvider services)
{ {
_worker = worker; _worker = worker;
@@ -69,6 +78,7 @@ public sealed partial class MergeSectionViewModel : ViewModelBase
_worktreeStateLabel = worktreeState; _worktreeStateLabel = worktreeState;
_listWorkingDir = listWorkDir; _listWorkingDir = listWorkDir;
OnPropertyChanged(nameof(ShowMergeSection)); OnPropertyChanged(nameof(ShowMergeSection));
OnPropertyChanged(nameof(HasReviewableDiff));
OpenDiffCommand.NotifyCanExecuteChanged(); OpenDiffCommand.NotifyCanExecuteChanged();
OpenWorktreeCommand.NotifyCanExecuteChanged(); OpenWorktreeCommand.NotifyCanExecuteChanged();
} }
@@ -79,6 +89,7 @@ public sealed partial class MergeSectionViewModel : ViewModelBase
TaskTitle = taskTitle; TaskTitle = taskTitle;
_isPlanningParent = isPlanningParent; _isPlanningParent = isPlanningParent;
OnPropertyChanged(nameof(ShowMergeSection)); OnPropertyChanged(nameof(ShowMergeSection));
OnPropertyChanged(nameof(HasReviewableDiff));
} }
internal void SyncChildOutcomes(bool hasChildOutcomes, int subtaskCount) internal void SyncChildOutcomes(bool hasChildOutcomes, int subtaskCount)
@@ -86,6 +97,7 @@ public sealed partial class MergeSectionViewModel : ViewModelBase
_hasChildOutcomes = hasChildOutcomes; _hasChildOutcomes = hasChildOutcomes;
_subtaskCount = subtaskCount; _subtaskCount = subtaskCount;
OnPropertyChanged(nameof(ShowMergeSection)); OnPropertyChanged(nameof(ShowMergeSection));
OnPropertyChanged(nameof(HasReviewableDiff));
ReviewCombinedDiffCommand.NotifyCanExecuteChanged(); ReviewCombinedDiffCommand.NotifyCanExecuteChanged();
} }
@@ -128,6 +140,7 @@ public sealed partial class MergeSectionViewModel : ViewModelBase
var vm = _services.GetRequiredService<DiffViewerViewModel>(); var vm = _services.GetRequiredService<DiffViewerViewModel>();
vm.ConfigurePlanning(TaskId, SelectedMergeTarget ?? "main"); vm.ConfigurePlanning(TaskId, SelectedMergeTarget ?? "main");
await vm.LoadAsync(); await vm.LoadAsync();
DiffViewed?.Invoke();
await ShowDiffViewer(vm); await ShowDiffViewer(vm);
} }
@@ -157,6 +170,7 @@ public sealed partial class MergeSectionViewModel : ViewModelBase
else return; else return;
await vm.LoadAsync(); await vm.LoadAsync();
DiffViewed?.Invoke();
await ShowDiffViewer(vm); await ShowDiffViewer(vm);
} }
@@ -1,5 +1,6 @@
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Text; using System.Text;
using System.Text.Json;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using ClaudeDo.Data; using ClaudeDo.Data;
@@ -7,11 +8,12 @@ using ClaudeDo.Data.Repositories;
using ClaudeDo.Ui.Helpers; using ClaudeDo.Ui.Helpers;
using ClaudeDo.Ui.Localization; using ClaudeDo.Ui.Localization;
using ClaudeDo.Ui.Services; using ClaudeDo.Ui.Services;
using ClaudeDo.Ui.ViewModels.MissionControl;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace ClaudeDo.Ui.ViewModels.Islands; namespace ClaudeDo.Ui.ViewModels.Islands;
public sealed partial class TaskMonitorViewModel : ViewModelBase, IDisposable public sealed partial class TaskMonitorViewModel : ViewModelBase, IMissionControlPane, IDisposable
{ {
private readonly IDbContextFactory<ClaudeDoDbContext> _dbFactory; private readonly IDbContextFactory<ClaudeDoDbContext> _dbFactory;
private readonly IWorkerClient _worker; private readonly IWorkerClient _worker;
@@ -70,9 +72,6 @@ public sealed partial class TaskMonitorViewModel : ViewModelBase, IDisposable
private const string RoadblockMarker = "Roadblocks reported during the run:"; private const string RoadblockMarker = "Roadblocks reported during the run:";
public ObservableCollection<QueuedMessageViewModel> QueuedMessages { get; } = new();
public bool HasQueuedMessages => QueuedMessages.Count > 0;
// Captured handler delegates for disposal // Captured handler delegates for disposal
private readonly Action<string, string> _onTaskMessage; private readonly Action<string, string> _onTaskMessage;
private readonly Action<string, string, DateTime> _onTaskStarted; private readonly Action<string, string, DateTime> _onTaskStarted;
@@ -80,19 +79,6 @@ public sealed partial class TaskMonitorViewModel : ViewModelBase, IDisposable
private readonly Action<string> _onTaskUpdated; private readonly Action<string> _onTaskUpdated;
private readonly Action<string, string, string> _onTaskQuestionAsked; private readonly Action<string, string, string> _onTaskQuestionAsked;
private readonly Action<string, string> _onTaskQuestionResolved; private readonly Action<string, string> _onTaskQuestionResolved;
private readonly Action<string> _onInteractiveStarted;
private readonly Action<string> _onInteractiveEnded;
private readonly Action<string, IReadOnlyList<string>> _onInteractiveQueueChanged;
private readonly Action<string, string> _onInteractiveMessageSent;
// Interactive composer — active while the worker is in an interactive session.
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(SubmitComposerCommand))]
private bool _isInteractiveLive;
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(SubmitComposerCommand))]
private string _composerDraft = string.Empty;
// A question the running task raised via AskUser and is blocking on, plus the answer // A question the running task raised via AskUser and is blocking on, plus the answer
// the user is typing. Ephemeral (in-memory + live events) — the task is still Running. // the user is typing. Ephemeral (in-memory + live events) — the task is still Running.
@@ -160,46 +146,6 @@ public sealed partial class TaskMonitorViewModel : ViewModelBase, IDisposable
ClearPendingQuestion(); ClearPendingQuestion();
}; };
_worker.TaskQuestionResolvedEvent += _onTaskQuestionResolved; _worker.TaskQuestionResolvedEvent += _onTaskQuestionResolved;
_onInteractiveStarted = taskId =>
{
if (taskId == _subscribedTaskId) { IsInteractiveLive = true; AgentState = "running"; }
};
_worker.InteractiveSessionStartedEvent += _onInteractiveStarted;
_onInteractiveEnded = taskId =>
{
if (taskId != _subscribedTaskId) return;
IsInteractiveLive = false;
AgentState = "done";
QueuedMessages.Clear();
OnPropertyChanged(nameof(HasQueuedMessages));
};
_worker.InteractiveSessionEndedEvent += _onInteractiveEnded;
_onInteractiveQueueChanged = (taskId, pending) =>
{
if (taskId != _subscribedTaskId) return;
QueuedMessages.Clear();
foreach (var m in pending)
{
var text = m;
QueuedMessages.Add(new QueuedMessageViewModel
{
Text = text,
RemoveCommand = new CommunityToolkit.Mvvm.Input.RelayCommand(() => _ = RemoveQueuedAsync(text)),
});
}
OnPropertyChanged(nameof(HasQueuedMessages));
};
_worker.InteractiveQueueChangedEvent += _onInteractiveQueueChanged;
_onInteractiveMessageSent = (taskId, text) =>
{
if (taskId == _subscribedTaskId)
Log.Add(new LogLineViewModel { Kind = LogKind.User, Text = text });
};
_worker.InteractiveMessageSentEvent += _onInteractiveMessageSent;
} }
// Surface a pending question (used by live event + re-attach hydration). // Surface a pending question (used by live event + re-attach hydration).
@@ -209,45 +155,6 @@ public sealed partial class TaskMonitorViewModel : ViewModelBase, IDisposable
PendingQuestion = question; PendingQuestion = question;
} }
// Used by Mission Control when it creates the monitor after the started event already fired.
public void SetInteractiveLive(bool live)
{
IsInteractiveLive = live;
if (live) AgentState = "running";
}
[RelayCommand(CanExecute = nameof(CanSubmitComposer))]
private async System.Threading.Tasks.Task SubmitComposer()
{
if (string.IsNullOrEmpty(_subscribedTaskId)) return;
var text = ComposerDraft;
if (string.IsNullOrWhiteSpace(text)) return;
ComposerDraft = string.Empty;
await _worker.SendInteractiveMessageAsync(_subscribedTaskId, text);
}
private bool CanSubmitComposer() => IsInteractiveLive && !string.IsNullOrWhiteSpace(ComposerDraft);
[RelayCommand]
private async System.Threading.Tasks.Task StopInteractive()
{
if (!string.IsNullOrEmpty(_subscribedTaskId) && IsInteractiveLive)
await _worker.StopInteractiveSessionAsync(_subscribedTaskId);
}
[RelayCommand]
private async System.Threading.Tasks.Task InterruptInteractive()
{
if (!string.IsNullOrEmpty(_subscribedTaskId) && IsInteractiveLive)
await _worker.InterruptInteractiveSessionAsync(_subscribedTaskId);
}
private async System.Threading.Tasks.Task RemoveQueuedAsync(string text)
{
if (!string.IsNullOrEmpty(_subscribedTaskId))
await _worker.RemoveQueuedInteractiveMessageAsync(_subscribedTaskId, text);
}
private void ClearPendingQuestion() private void ClearPendingQuestion()
{ {
PendingQuestionId = null; PendingQuestionId = null;
@@ -296,10 +203,6 @@ public sealed partial class TaskMonitorViewModel : ViewModelBase, IDisposable
SessionOutcome = null; SessionOutcome = null;
Roadblocks = null; Roadblocks = null;
ClearPendingQuestion(); ClearPendingQuestion();
IsInteractiveLive = false;
ComposerDraft = string.Empty;
QueuedMessages.Clear();
OnPropertyChanged(nameof(HasQueuedMessages));
} }
[ObservableProperty] [ObservableProperty]
@@ -356,16 +259,38 @@ public sealed partial class TaskMonitorViewModel : ViewModelBase, IDisposable
var idx = result.IndexOf(RoadblockMarker, StringComparison.Ordinal); var idx = result.IndexOf(RoadblockMarker, StringComparison.Ordinal);
if (idx < 0) if (idx < 0)
{ {
SessionOutcome = result; SessionOutcome = UnwrapSummary(result);
Roadblocks = null; Roadblocks = null;
return; return;
} }
var summary = result[..idx].TrimEnd().TrimEnd('⚠').TrimEnd(); var summary = result[..idx].TrimEnd().TrimEnd('⚠').TrimEnd();
SessionOutcome = string.IsNullOrWhiteSpace(summary) ? null : summary; SessionOutcome = string.IsNullOrWhiteSpace(summary) ? null : UnwrapSummary(summary);
Roadblocks = result[(idx + RoadblockMarker.Length)..].Trim(); Roadblocks = result[(idx + RoadblockMarker.Length)..].Trim();
} }
/// <summary>Safety net for older rows persisted as raw structured-output JSON: if the outcome
/// is a JSON object with a string <c>summary</c>, show that; otherwise keep the text as-is.</summary>
private static string? UnwrapSummary(string? text)
{
if (string.IsNullOrWhiteSpace(text)) return text;
var trimmed = text.TrimStart();
if (trimmed.Length == 0 || trimmed[0] != '{') return text;
try
{
using var doc = JsonDocument.Parse(trimmed);
if (doc.RootElement.ValueKind == JsonValueKind.Object &&
doc.RootElement.TryGetProperty("summary", out var s) &&
s.ValueKind == JsonValueKind.String)
{
var summary = s.GetString();
if (!string.IsNullOrWhiteSpace(summary)) return summary;
}
}
catch { }
return text;
}
public async System.Threading.Tasks.Task ReplayLogFileAsync(string? logPath, CancellationToken ct) public async System.Threading.Tasks.Task ReplayLogFileAsync(string? logPath, CancellationToken ct)
{ {
if (string.IsNullOrWhiteSpace(logPath)) return; if (string.IsNullOrWhiteSpace(logPath)) return;
@@ -523,15 +448,5 @@ public sealed partial class TaskMonitorViewModel : ViewModelBase, IDisposable
_worker.TaskUpdatedEvent -= _onTaskUpdated; _worker.TaskUpdatedEvent -= _onTaskUpdated;
_worker.TaskQuestionAskedEvent -= _onTaskQuestionAsked; _worker.TaskQuestionAskedEvent -= _onTaskQuestionAsked;
_worker.TaskQuestionResolvedEvent -= _onTaskQuestionResolved; _worker.TaskQuestionResolvedEvent -= _onTaskQuestionResolved;
_worker.InteractiveSessionStartedEvent -= _onInteractiveStarted;
_worker.InteractiveSessionEndedEvent -= _onInteractiveEnded;
_worker.InteractiveQueueChangedEvent -= _onInteractiveQueueChanged;
_worker.InteractiveMessageSentEvent -= _onInteractiveMessageSent;
} }
} }
public sealed class QueuedMessageViewModel
{
public required string Text { get; init; }
public required System.Windows.Input.ICommand RemoveCommand { get; init; }
}
@@ -63,6 +63,11 @@ public sealed partial class TaskRowViewModel : ViewModelBase
&& !IsChild; && !IsChild;
public bool CanResumeOrDiscardPlanning => PlanningPhase == PlanningPhase.Active; public bool CanResumeOrDiscardPlanning => PlanningPhase == PlanningPhase.Active;
// Pick up in a terminal only where a session + worktree reliably still exist: a task
// parked for review, or one that failed mid-run. The worker validates and reports a
// clear error if there's no resumable session/worktree.
public bool CanPickUpInTerminal => Status is TaskStatus.WaitingForReview or TaskStatus.Failed;
public string? PlanningBadge => PlanningPhase switch public string? PlanningBadge => PlanningPhase switch
{ {
PlanningPhase.Active => Loc.T("vm.planningBadge.active"), PlanningPhase.Active => Loc.T("vm.planningBadge.active"),
@@ -123,6 +128,11 @@ public sealed partial class TaskRowViewModel : ViewModelBase
_ => Status.ToString(), _ => Status.ToString(),
}; };
// A planning parent that is still Idle (Active planning, or Finalized-but-not-yet-queued)
// already shows its state via the PLANNING/PLANNED badge next to the title. The lifecycle
// chip would read "Idle" (or "Parked"), which is misleading, so hide it in that case.
public bool ShowStatusChip => !(PlanningPhase != PlanningPhase.None && Status == TaskStatus.Idle);
public string StatusChipClass => (Status, IsBlocked: !string.IsNullOrEmpty(BlockedByTaskId)) switch public string StatusChipClass => (Status, IsBlocked: !string.IsNullOrEmpty(BlockedByTaskId)) switch
{ {
(TaskStatus.Running, _) => "running", (TaskStatus.Running, _) => "running",
@@ -139,8 +149,10 @@ public sealed partial class TaskRowViewModel : ViewModelBase
{ {
OnPropertyChanged(nameof(StatusChipClass)); OnPropertyChanged(nameof(StatusChipClass));
OnPropertyChanged(nameof(StatusLabel)); OnPropertyChanged(nameof(StatusLabel));
OnPropertyChanged(nameof(ShowStatusChip));
OnPropertyChanged(nameof(IsRunning)); OnPropertyChanged(nameof(IsRunning));
OnPropertyChanged(nameof(IsWaitingForReview)); OnPropertyChanged(nameof(IsWaitingForReview));
OnPropertyChanged(nameof(CanPickUpInTerminal));
OnPropertyChanged(nameof(IsParked)); OnPropertyChanged(nameof(IsParked));
OnPropertyChanged(nameof(IsQueued)); OnPropertyChanged(nameof(IsQueued));
OnPropertyChanged(nameof(IsWaiting)); OnPropertyChanged(nameof(IsWaiting));
@@ -183,6 +195,7 @@ public sealed partial class TaskRowViewModel : ViewModelBase
{ {
OnPropertyChanged(nameof(IsPlanningParent)); OnPropertyChanged(nameof(IsPlanningParent));
OnPropertyChanged(nameof(PlanningBadge)); OnPropertyChanged(nameof(PlanningBadge));
OnPropertyChanged(nameof(ShowStatusChip));
OnPropertyChanged(nameof(IsPlanActive)); OnPropertyChanged(nameof(IsPlanActive));
OnPropertyChanged(nameof(IsPlanFinalized)); OnPropertyChanged(nameof(IsPlanFinalized));
OnPropertyChanged(nameof(CanOpenPlanningSession)); OnPropertyChanged(nameof(CanOpenPlanningSession));
@@ -151,6 +151,18 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
.Include(t => t.Worktree) .Include(t => t.Worktree)
.FirstOrDefaultAsync(t => t.Id == taskId); .FirstOrDefaultAsync(t => t.Id == taskId);
// A parent transition (finalize/discard) broadcasts only the parent's id, but it
// changes its children's derived state — finalize flips them Draft→Planned, discard
// deletes them. The delta path below only touches the parent row and never recomputes
// the child-derived flags (ParentFinalized, HasPlanningChildren) nor drops deleted
// children, so reconcile the whole list when the updated task is (or owns) a subtree.
if (entity is not null &&
(entity.PlanningPhase != PlanningPhase.None || Items.Any(r => r.ParentTaskId == entity.Id)))
{
LoadForList(list);
return;
}
var existing = Items.FirstOrDefault(r => r.Id == taskId); var existing = Items.FirstOrDefault(r => r.Id == taskId);
if (entity is null) if (entity is null)
@@ -732,7 +744,7 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
{ {
if (row is null || !row.IsWaitingForReview || _worker is null) return; if (row is null || !row.IsWaitingForReview || _worker is null) return;
try { await _worker.ApproveReviewAsync(row.Id, ""); } try { await _worker.ApproveReviewAsync(row.Id, ""); }
catch { /* offline; broadcast reconciles on return */ } catch (Exception ex) { ErrorReported?.Invoke(Loc.T("vm.tasksIsland.approveFailed", ex.Message)); }
} }
public async Task RejectReviewToQueueAsync(TaskRowViewModel row, string feedback) public async Task RejectReviewToQueueAsync(TaskRowViewModel row, string feedback)
@@ -801,22 +813,38 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
private void OpenListSettings() => OpenListSettingsRequested?.Invoke(this, EventArgs.Empty); private void OpenListSettings() => OpenListSettingsRequested?.Invoke(this, EventArgs.Empty);
[RelayCommand] [RelayCommand]
private async Task OpenPlanningSessionAsync(TaskRowViewModel? row) private void OpenPlanningSession(TaskRowViewModel? row)
{ {
if (row is null) return; if (row is null) return;
if (row.Status != TaskStatus.Idle || row.PlanningPhase != PlanningPhase.None) return; if (row.Status != TaskStatus.Idle || row.PlanningPhase != PlanningPhase.None) return;
ForegroundHelper.AllowAny(); // Planning now runs as an embedded ConPTY pane in the Command Center (not an external wt
try { await _worker!.StartPlanningSessionAsync(row.Id); } // window). The shell owns Mission Control, so raise an event; the actual StartAsync happens
catch (Exception ex) { ErrorReported?.Invoke(Loc.T("vm.tasksIsland.planningOpenFailed", ex.Message)); } // server-side inside GetPlanningStartLaunchSpec when the pane opens.
OpenPlanningConPtyRequested?.Invoke(row.Id, false);
}
// Opens the task in an embedded ConPTY terminal pane in the Command Center. The shell owns
// the Mission Control view model, so this just raises an event for it to act on.
public event Action<string>? OpenConPtySessionRequested;
// Opens (resume=false) or resumes (resume=true) a planning session as an embedded ConPTY
// pane in the Command Center.
public event Action<string, bool>? OpenPlanningConPtyRequested;
[RelayCommand]
private void OpenConPtySession(TaskRowViewModel? row)
{
if (row is null) return;
OpenConPtySessionRequested?.Invoke(row.Id);
} }
[RelayCommand] [RelayCommand]
private async Task RunInteractivelyAsync(TaskRowViewModel? row) private async Task PickUpInTerminalAsync(TaskRowViewModel? row)
{ {
if (row is null || _worker is null) return; if (row is null || _worker is null) return;
ForegroundHelper.AllowAny(); ForegroundHelper.AllowAny();
try { await _worker.OpenInteractiveTerminalAsync(row.Id); } try { await _worker.ResumeTaskInTerminalAsync(row.Id); }
catch (Exception ex) { ErrorReported?.Invoke(Loc.T("vm.tasksIsland.runInteractiveFailed", ex.Message)); } catch (Exception ex) { ErrorReported?.Invoke(Loc.T("vm.tasksIsland.pickUpInTerminalFailed", ex.Message)); }
} }
[RelayCommand] [RelayCommand]
@@ -842,8 +870,9 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
switch (choice) switch (choice)
{ {
case UnfinishedPlanningModalResult.Resume: case UnfinishedPlanningModalResult.Resume:
ForegroundHelper.AllowAny(); // Resume as an embedded ConPTY pane (server-side ResumeAsync runs inside
await _worker.ResumePlanningSessionAsync(row.Id); // GetPlanningResumeLaunchSpec when the pane opens).
OpenPlanningConPtyRequested?.Invoke(row.Id, true);
break; break;
case UnfinishedPlanningModalResult.FinalizeNow: case UnfinishedPlanningModalResult.FinalizeNow:
await _worker.FinalizePlanningSessionAsync(row.Id, queueAgentTasks: false); await _worker.FinalizePlanningSessionAsync(row.Id, queueAgentTasks: false);
@@ -856,7 +885,7 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
break; break;
} }
} }
catch { } catch (Exception ex) { ErrorReported?.Invoke(Loc.T("vm.tasksIsland.planningResumeFailed", ex.Message)); }
} }
[RelayCommand] [RelayCommand]
@@ -97,7 +97,6 @@ public sealed partial class IslandsShellViewModel : ViewModelBase, IDisposable
[ObservableProperty] private bool _isUpdateBannerVisible; [ObservableProperty] private bool _isUpdateBannerVisible;
[ObservableProperty] private string? _updateBannerLatestVersion; [ObservableProperty] private string? _updateBannerLatestVersion;
[ObservableProperty] private string? _inlineUpdateStatus;
private bool _bannerDismissedThisSession; private bool _bannerDismissedThisSession;
[ObservableProperty] [ObservableProperty]
@@ -215,6 +214,7 @@ public sealed partial class IslandsShellViewModel : ViewModelBase, IDisposable
MissionControl.OpenInApp = id => _ = RevealTaskAsync(id); MissionControl.OpenInApp = id => _ = RevealTaskAsync(id);
MissionControl.ShowDetached = (monitor, reDock) => Dialogs?.ShowDetachedMonitor(monitor, reDock); MissionControl.ShowDetached = (monitor, reDock) => Dialogs?.ShowDetachedMonitor(monitor, reDock);
MissionControl.OpenSettingsRequested = () => Lists.OpenSettingsCommand.Execute(null); MissionControl.OpenSettingsRequested = () => Lists.OpenSettingsCommand.Execute(null);
MissionControl.ErrorReported += FlashFooterError;
_updateCheck = updateCheck; _updateCheck = updateCheck;
_installerLocator = installerLocator; _installerLocator = installerLocator;
_workerLocator = workerLocator; _workerLocator = workerLocator;
@@ -228,6 +228,16 @@ public sealed partial class IslandsShellViewModel : ViewModelBase, IDisposable
Tasks.NotesRequested += () => Details.ShowNotes(); Tasks.NotesRequested += () => Details.ShowNotes();
Tasks.PrepRequested += () => Details.ShowPrep(); Tasks.PrepRequested += () => Details.ShowPrep();
Tasks.ErrorReported += FlashFooterError; Tasks.ErrorReported += FlashFooterError;
Tasks.OpenConPtySessionRequested += taskId =>
{
OpenMissionControl();
_ = MissionControl.OpenConPtySessionAsync(taskId);
};
Tasks.OpenPlanningConPtyRequested += (taskId, resume) =>
{
OpenMissionControl();
_ = MissionControl.OpenPlanningConPtySessionAsync(taskId, resume);
};
Tasks.TasksChanged += (_, _) => _ = Lists.RefreshCountsAsync(); Tasks.TasksChanged += (_, _) => _ = Lists.RefreshCountsAsync();
Tasks.OpenListSettingsRequested += (_, _) => Tasks.OpenListSettingsRequested += (_, _) =>
{ {
@@ -299,25 +309,15 @@ public sealed partial class IslandsShellViewModel : ViewModelBase, IDisposable
if (_bannerDismissedThisSession) { IsUpdateBannerVisible = false; break; } if (_bannerDismissedThisSession) { IsUpdateBannerVisible = false; break; }
UpdateBannerLatestVersion = _updateCheck.LatestVersion; UpdateBannerLatestVersion = _updateCheck.LatestVersion;
IsUpdateBannerVisible = true; IsUpdateBannerVisible = true;
InlineUpdateStatus = null;
break; break;
case UpdateCheckStatus.UpToDate: case UpdateCheckStatus.UpToDate:
IsUpdateBannerVisible = false; IsUpdateBannerVisible = false;
ShowInlineStatus($"You're up to date (v{_updateCheck.CurrentVersion})");
break; break;
case UpdateCheckStatus.CheckFailed: case UpdateCheckStatus.CheckFailed:
ShowInlineStatus("Could not check for updates");
break; break;
} }
} }
private async void ShowInlineStatus(string text)
{
InlineUpdateStatus = text;
await Task.Delay(3000);
if (InlineUpdateStatus == text) InlineUpdateStatus = null;
}
[RelayCommand] [RelayCommand]
private void OpenMissionControl() private void OpenMissionControl()
{ {
@@ -0,0 +1,74 @@
using System;
using System.ComponentModel;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using ClaudeDo.Ui.Services;
namespace ClaudeDo.Ui.ViewModels.MissionControl;
/// <summary>
/// Command Center pane hosting an embedded ConPTY terminal for either one task's interactive
/// Claude session, or an ad-hoc/free session in a user-chosen directory (no task, <see cref="TaskId"/>
/// is null — ad-hoc panes are never deduped, unlike task-based ones). Distinct from the streamed-log
/// <see cref="ClaudeDo.Ui.ViewModels.Islands.TaskMonitorViewModel"/> pane; the two coexist until
/// the streaming interactive stack is removed.
/// </summary>
public sealed partial class ConPtyPaneViewModel : ViewModelBase, IMissionControlPane, IDisposable
{
public string? TaskId { get; }
// Only a task-based pane can be submitted for review (an ad-hoc directory session has no task).
public bool IsTaskBased => TaskId is not null;
[ObservableProperty] private string _displayTitle;
public InteractiveTerminalViewModel Terminal { get; } = new();
/// <summary>Raised when the terminal failed to start — the host surfaces this via the footer error strip.</summary>
public event Action<string>? ErrorReported;
/// <summary>Set by the host (Mission Control) to remove this pane from its collection.</summary>
public Action<ConPtyPaneViewModel>? CloseRequested { get; set; }
/// <summary>Raised when the user submits this task's hand-driven work for review; the host
/// commits the worktree and moves the task to WaitingForReview.</summary>
public event Action<string>? SubmitForReviewRequested;
/// <summary>Task-based pane — dedup'd by <see cref="TaskId"/>. Pass null for an ad-hoc pane
/// (no task, never deduped); prefer <see cref="CreateAdHoc"/> at ad-hoc call sites.</summary>
public ConPtyPaneViewModel(string? taskId, string displayTitle, TerminalLaunchDescriptor descriptor)
{
TaskId = taskId;
_displayTitle = displayTitle;
Terminal.PropertyChanged += OnTerminalPropertyChanged;
Terminal.Start(descriptor);
}
/// <summary>Ad-hoc pane — no task, no dedup.</summary>
public static ConPtyPaneViewModel CreateAdHoc(string displayTitle, TerminalLaunchDescriptor descriptor)
=> new(null, displayTitle, descriptor);
private void OnTerminalPropertyChanged(object? sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(InteractiveTerminalViewModel.StartError) && Terminal.StartError is { Length: > 0 } error)
ErrorReported?.Invoke(error);
}
[RelayCommand]
private void Close() => CloseRequested?.Invoke(this);
private bool CanSubmitForReview() => IsTaskBased;
[RelayCommand(CanExecute = nameof(CanSubmitForReview))]
private void SubmitForReview()
{
if (TaskId is { } id) SubmitForReviewRequested?.Invoke(id);
}
public void Dispose()
{
Terminal.PropertyChanged -= OnTerminalPropertyChanged;
Terminal.Kill();
Terminal.Dispose();
}
}
@@ -0,0 +1,12 @@
namespace ClaudeDo.Ui.ViewModels.MissionControl;
/// <summary>
/// Common contract for anything hosted as a pane in the Command Center — implemented by both
/// the streamed-log <see cref="ClaudeDo.Ui.ViewModels.Islands.TaskMonitorViewModel"/> and the
/// embedded ConPTY <see cref="ConPtyPaneViewModel"/> — so the layout toggle (grid/tabs) can
/// bind one heterogeneous pane collection.
/// </summary>
public interface IMissionControlPane
{
string DisplayTitle { get; }
}
@@ -1,12 +1,15 @@
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.IO;
using System.Linq; using System.Linq;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using ClaudeDo.Data; using ClaudeDo.Data;
using ClaudeDo.Data.Repositories; using ClaudeDo.Data.Repositories;
using ClaudeDo.Ui.Localization;
using ClaudeDo.Ui.Services; using ClaudeDo.Ui.Services;
using ClaudeDo.Ui.ViewModels.Islands; using ClaudeDo.Ui.ViewModels.Islands;
using ClaudeDo.Ui.ViewModels.MissionControl;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace ClaudeDo.Ui.ViewModels; namespace ClaudeDo.Ui.ViewModels;
@@ -19,12 +22,31 @@ public sealed partial class MissionControlViewModel : ViewModelBase, IDisposable
private readonly Action<string, string, string, DateTime> _onTaskFinished; private readonly Action<string, string, string, DateTime> _onTaskFinished;
private readonly Action<string> _onTaskUpdated; private readonly Action<string> _onTaskUpdated;
private readonly Action _onConnectionRestored; private readonly Action _onConnectionRestored;
private readonly Action<string> _onInteractiveStarted;
public ObservableCollection<TaskMonitorViewModel> Monitors { get; } = new(); public ObservableCollection<TaskMonitorViewModel> Monitors { get; } = new();
// Embedded ConPTY sessions (task-based only) — a manual cockpit detached from the
// review/merge/status machinery. Mirrored into Panes alongside the streamed-log Monitors.
public ObservableCollection<ConPtyPaneViewModel> ConPtySessions { get; } = new();
// Unified view of Monitors ++ ConPtySessions (in that order) so the layout toggle can
// present one heterogeneous collection as either a grid or tabs.
public ObservableCollection<IMissionControlPane> Panes { get; } = new();
[ObservableProperty] private int _columnCount = 1; [ObservableProperty] private int _columnCount = 1;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(LayoutToggleLabel))]
private bool _isFocusMode;
[ObservableProperty] private IMissionControlPane? _focusedPane;
public string LayoutToggleLabel => Loc.T(IsFocusMode ? "missionControl.overviewMode" : "missionControl.focusMode");
/// <summary>Surfaces a Command Center failure (e.g. a ConPTY launch spec fetch) — the shell
/// wires this into the footer error strip, same as the island view models' ErrorReported.</summary>
public event Action<string>? ErrorReported;
private Action<string>? _openInApp; private Action<string>? _openInApp;
public Action<string>? OpenInApp public Action<string>? OpenInApp
{ {
@@ -44,6 +66,7 @@ public sealed partial class MissionControlViewModel : ViewModelBase, IDisposable
public Action? OpenSettingsRequested { get; set; } public Action? OpenSettingsRequested { get; set; }
public bool HasMonitors => Monitors.Count > 0; public bool HasMonitors => Monitors.Count > 0;
public bool HasPanes => Panes.Count > 0;
// Read-only view of the worker queue (tasks waiting to run), shown as a side strip. // Read-only view of the worker queue (tasks waiting to run), shown as a side strip.
public ObservableCollection<QueuedTaskViewModel> Queued { get; } = new(); public ObservableCollection<QueuedTaskViewModel> Queued { get; } = new();
@@ -55,6 +78,8 @@ public sealed partial class MissionControlViewModel : ViewModelBase, IDisposable
_worker = worker; _worker = worker;
Monitors.CollectionChanged += OnMonitorsChanged; Monitors.CollectionChanged += OnMonitorsChanged;
ConPtySessions.CollectionChanged += OnConPtySessionsChanged;
Panes.CollectionChanged += OnPanesChanged;
_onTaskStarted = (slot, taskId, startedAt) => { EnsureMonitor(taskId); _ = RefreshQueueAsync(); }; _onTaskStarted = (slot, taskId, startedAt) => { EnsureMonitor(taskId); _ = RefreshQueueAsync(); };
_worker.TaskStartedEvent += _onTaskStarted; _worker.TaskStartedEvent += _onTaskStarted;
@@ -68,14 +93,6 @@ public sealed partial class MissionControlViewModel : ViewModelBase, IDisposable
_onConnectionRestored = () => { SeedActive(); _ = RefreshQueueAsync(); }; _onConnectionRestored = () => { SeedActive(); _ = RefreshQueueAsync(); };
_worker.ConnectionRestoredEvent += _onConnectionRestored; _worker.ConnectionRestoredEvent += _onConnectionRestored;
_onInteractiveStarted = taskId =>
{
EnsureMonitor(taskId);
var m = Monitors.FirstOrDefault(x => x.SubscribedTaskId == taskId);
m?.SetInteractiveLive(true);
};
_worker.InteractiveSessionStartedEvent += _onInteractiveStarted;
SeedActive(); SeedActive();
_ = RefreshQueueAsync(); _ = RefreshQueueAsync();
} }
@@ -192,6 +209,9 @@ public sealed partial class MissionControlViewModel : ViewModelBase, IDisposable
[RelayCommand] [RelayCommand]
private void OpenSettings() => OpenSettingsRequested?.Invoke(); private void OpenSettings() => OpenSettingsRequested?.Invoke();
[RelayCommand]
private void ToggleLayout() => IsFocusMode = !IsFocusMode;
public void MoveMonitor(TaskMonitorViewModel dragged, TaskMonitorViewModel target) public void MoveMonitor(TaskMonitorViewModel dragged, TaskMonitorViewModel target)
{ {
if (ReferenceEquals(dragged, target)) return; if (ReferenceEquals(dragged, target)) return;
@@ -201,15 +221,187 @@ public sealed partial class MissionControlViewModel : ViewModelBase, IDisposable
Monitors.Move(from, to); Monitors.Move(from, to);
} }
// Fetches the launch spec for a task's worktree and hosts an embedded ConPTY session as a
// Command Center pane (task-based only).
public async System.Threading.Tasks.Task OpenConPtySessionAsync(string taskId)
{
if (string.IsNullOrEmpty(taskId)) return;
if (ConPtySessions.FirstOrDefault(s => s.TaskId == taskId) is { } existing)
{
FocusedPane = existing;
return;
}
var title = taskId;
try
{
await using var ctx = await _dbFactory.CreateDbContextAsync();
var entity = await ctx.Tasks.AsNoTracking().FirstOrDefaultAsync(t => t.Id == taskId);
if (entity?.Title is { Length: > 0 } t) title = t;
}
catch { /* best-effort title lookup */ }
try
{
var spec = await _worker.GetInteractiveLaunchSpecAsync(taskId);
var descriptor = new TerminalLaunchDescriptor(spec.Cwd, spec.Exe, spec.Args, spec.Env);
var pane = new ConPtyPaneViewModel(taskId, title, descriptor);
pane.ErrorReported += OnConPtyPaneError;
pane.CloseRequested += CloseConPtySession;
pane.SubmitForReviewRequested += OnPaneSubmitForReview;
ConPtySessions.Add(pane);
}
catch (Exception ex)
{
ErrorReported?.Invoke(Loc.T("missionControl.conptyLaunchFailed", ex.Message));
}
}
// Starts (or resumes) a planning session and hosts it as an embedded ConPTY Command Center
// pane — the ConPTY replacement for the old external wt planning window. Deduped by TaskId
// like OpenConPtySessionAsync.
public async System.Threading.Tasks.Task OpenPlanningConPtySessionAsync(string taskId, bool resume)
{
if (string.IsNullOrEmpty(taskId)) return;
if (ConPtySessions.FirstOrDefault(s => s.TaskId == taskId) is { } existing)
{
FocusedPane = existing;
return;
}
var title = taskId;
try
{
await using var ctx = await _dbFactory.CreateDbContextAsync();
var entity = await ctx.Tasks.AsNoTracking().FirstOrDefaultAsync(t => t.Id == taskId);
if (entity?.Title is { Length: > 0 } t) title = t;
}
catch { /* best-effort title lookup */ }
title += Loc.T("missionControl.planningTitleSuffix");
try
{
var spec = resume
? await _worker.GetPlanningResumeLaunchSpecAsync(taskId)
: await _worker.GetPlanningStartLaunchSpecAsync(taskId);
var descriptor = new TerminalLaunchDescriptor(spec.Cwd, spec.Exe, spec.Args, spec.Env);
var pane = new ConPtyPaneViewModel(taskId, title, descriptor);
pane.ErrorReported += OnConPtyPaneError;
pane.CloseRequested += CloseConPtySession;
pane.SubmitForReviewRequested += OnPaneSubmitForReview;
ConPtySessions.Add(pane);
}
catch (Exception ex)
{
ErrorReported?.Invoke(Loc.T("missionControl.conptyLaunchFailed", ex.Message));
}
}
// Ad-hoc (task-less) ConPTY session in a user-chosen directory. Never deduped — every call
// opens a fresh pane, unlike the task-based OpenConPtySessionAsync above.
public async System.Threading.Tasks.Task OpenAdHocConPtySessionAsync(string directory)
{
if (string.IsNullOrEmpty(directory)) return;
var title = Path.GetFileName(directory.TrimEnd('\\', '/'));
if (string.IsNullOrEmpty(title)) title = directory;
try
{
var spec = await _worker.GetAdHocLaunchSpecAsync(directory);
var descriptor = new TerminalLaunchDescriptor(spec.Cwd, spec.Exe, spec.Args, spec.Env);
var pane = ConPtyPaneViewModel.CreateAdHoc(title, descriptor);
pane.ErrorReported += OnConPtyPaneError;
pane.CloseRequested += CloseConPtySession;
pane.SubmitForReviewRequested += OnPaneSubmitForReview;
ConPtySessions.Add(pane);
}
catch (Exception ex)
{
ErrorReported?.Invoke(Loc.T("missionControl.conptyLaunchFailed", ex.Message));
}
}
private void OnConPtyPaneError(string message) => ErrorReported?.Invoke(message);
// Submit a task's hand-driven ConPTY work for review, then close the pane (the interactive
// session is finished). The worker commits the worktree and moves the task to WaitingForReview.
private async void OnPaneSubmitForReview(string taskId)
{
try
{
await _worker.SubmitTaskForReviewAsync(taskId);
if (ConPtySessions.FirstOrDefault(s => s.TaskId == taskId) is { } pane)
CloseConPtySession(pane);
}
catch (Exception ex)
{
ErrorReported?.Invoke(Loc.T("missionControl.submitForReviewFailed", ex.Message));
}
}
private void CloseConPtySession(ConPtyPaneViewModel pane)
{
if (!ConPtySessions.Contains(pane)) return;
pane.ErrorReported -= OnConPtyPaneError;
pane.CloseRequested -= CloseConPtySession;
ConPtySessions.Remove(pane);
pane.Dispose();
}
// Mirrors Monitors' add/remove/move into the front (Monitors-prefix) section of Panes.
private void OnMonitorsChanged(object? sender, NotifyCollectionChangedEventArgs e) private void OnMonitorsChanged(object? sender, NotifyCollectionChangedEventArgs e)
{ {
ColumnCount = Monitors.Count switch switch (e.Action)
{
case NotifyCollectionChangedAction.Add:
Panes.Insert(e.NewStartingIndex, (TaskMonitorViewModel)e.NewItems![0]!);
break;
case NotifyCollectionChangedAction.Remove:
Panes.RemoveAt(e.OldStartingIndex);
break;
case NotifyCollectionChangedAction.Move:
Panes.Move(e.OldStartingIndex, e.NewStartingIndex);
break;
default: // Reset (Dispose's Monitors.Clear())
foreach (var p in Panes.OfType<TaskMonitorViewModel>().ToList())
Panes.Remove(p);
break;
}
OnPropertyChanged(nameof(HasMonitors));
}
// Mirrors ConPtySessions' add/remove into the tail (ConPtySessions-suffix) section of Panes.
private void OnConPtySessionsChanged(object? sender, NotifyCollectionChangedEventArgs e)
{
switch (e.Action)
{
case NotifyCollectionChangedAction.Add:
Panes.Insert(Monitors.Count + e.NewStartingIndex, (ConPtyPaneViewModel)e.NewItems![0]!);
break;
case NotifyCollectionChangedAction.Remove:
Panes.RemoveAt(Monitors.Count + e.OldStartingIndex);
break;
default: // Reset
foreach (var p in Panes.OfType<ConPtyPaneViewModel>().ToList())
Panes.Remove(p);
break;
}
}
private void OnPanesChanged(object? sender, NotifyCollectionChangedEventArgs e)
{
ColumnCount = Panes.Count switch
{ {
<= 1 => 1, <= 1 => 1,
<= 4 => 2, <= 4 => 2,
_ => 3, _ => 3,
}; };
OnPropertyChanged(nameof(HasMonitors)); OnPropertyChanged(nameof(HasPanes));
if (e.Action == NotifyCollectionChangedAction.Add && e.NewItems?[0] is IMissionControlPane added)
FocusedPane = added;
else if (e.Action == NotifyCollectionChangedAction.Remove && ReferenceEquals(FocusedPane, e.OldItems?[0]))
FocusedPane = Panes.LastOrDefault();
} }
public void Dispose() public void Dispose()
@@ -218,10 +410,19 @@ public sealed partial class MissionControlViewModel : ViewModelBase, IDisposable
_worker.TaskFinishedEvent -= _onTaskFinished; _worker.TaskFinishedEvent -= _onTaskFinished;
_worker.TaskUpdatedEvent -= _onTaskUpdated; _worker.TaskUpdatedEvent -= _onTaskUpdated;
_worker.ConnectionRestoredEvent -= _onConnectionRestored; _worker.ConnectionRestoredEvent -= _onConnectionRestored;
_worker.InteractiveSessionStartedEvent -= _onInteractiveStarted;
Monitors.CollectionChanged -= OnMonitorsChanged; Monitors.CollectionChanged -= OnMonitorsChanged;
ConPtySessions.CollectionChanged -= OnConPtySessionsChanged;
Panes.CollectionChanged -= OnPanesChanged;
foreach (var m in Monitors) m.Dispose(); foreach (var m in Monitors) m.Dispose();
Monitors.Clear(); Monitors.Clear();
foreach (var c in ConPtySessions.ToList())
{
c.ErrorReported -= OnConPtyPaneError;
c.CloseRequested -= CloseConPtySession;
c.Dispose();
}
ConPtySessions.Clear();
Panes.Clear();
} }
} }
@@ -54,6 +54,14 @@ public sealed class DiffFileViewModel
/// A text file that produced no diff hunks (e.g. a newly added empty file). /// A text file that produced no diff hunks (e.g. a newly added empty file).
public bool IsEmptyContent => !IsBinary && Lines.Count == 0; public bool IsEmptyContent => !IsBinary && Lines.Count == 0;
/// A rename with no content change — showing "+0 0" for it is misleading.
public bool IsPureRename => Status == DiffFileStatus.Renamed && Additions == 0 && Deletions == 0;
/// Header path label: for a rename, spell out old → new; otherwise just the path.
public string HeaderPath => Status == DiffFileStatus.Renamed && !string.IsNullOrEmpty(OldPath)
? $"{OldPath} → {Path}"
: Path;
} }
/// One row in the planning subtask list (left pane in Planning mode). /// One row in the planning subtask list (left pane in Planning mode).
@@ -72,7 +80,7 @@ public sealed partial class DiffTreeNodeViewModel : ViewModelBase
[ObservableProperty] private bool _isExpanded = true; [ObservableProperty] private bool _isExpanded = true;
public string? StatusCode => File?.StatusCode; public string? StatusCode => File?.StatusCode;
public bool ShowStats => File is { IsBinary: false }; public bool ShowStats => File is { IsBinary: false, IsPureRename: false };
public int Additions => File?.Additions ?? 0; public int Additions => File?.Additions ?? 0;
public int Deletions => File?.Deletions ?? 0; public int Deletions => File?.Deletions ?? 0;
} }
@@ -1,5 +1,8 @@
using System.Collections.ObjectModel;
using ClaudeDo.Data.Models; using ClaudeDo.Data.Models;
using ClaudeDo.Localization; using ClaudeDo.Localization;
using ClaudeDo.Ui.Services;
using ClaudeDo.Ui.ViewModels.Agent;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
namespace ClaudeDo.Ui.ViewModels.Modals.Settings; namespace ClaudeDo.Ui.ViewModels.Modals.Settings;
@@ -22,6 +25,8 @@ public sealed partial class GeneralSettingsTabViewModel : ViewModelBase
public IReadOnlyList<string> Models { get; } = ModelRegistry.Aliases; public IReadOnlyList<string> Models { get; } = ModelRegistry.Aliases;
public IReadOnlyList<string> PermissionModes { get; } = PermissionModeRegistry.Modes; public IReadOnlyList<string> PermissionModes { get; } = PermissionModeRegistry.Modes;
public ObservableCollection<SelectableSkillViewModel> SessionSkills { get; } = new();
public GeneralSettingsTabViewModel() { } public GeneralSettingsTabViewModel() { }
public GeneralSettingsTabViewModel(ILocalizer localizer, Action<string> persist) public GeneralSettingsTabViewModel(ILocalizer localizer, Action<string> persist)
@@ -51,4 +56,20 @@ public sealed partial class GeneralSettingsTabViewModel : ViewModelBase
return "Max parallel executions must be between 1 and 20."; return "Max parallel executions must be between 1 and 20.";
return null; return null;
} }
/// <summary>Loads the installed-skills checkbox list, reflecting the given selection.</summary>
public async Task LoadSessionSkillsAsync(IWorkerClient worker, IReadOnlyCollection<string>? selected)
{
var installed = await worker.GetSessionSkillsAsync();
var selectedSet = selected is null ? new HashSet<string>() : new HashSet<string>(selected);
SessionSkills.Clear();
foreach (var s in installed)
SessionSkills.Add(new SelectableSkillViewModel(s.Name, s.Description, selectedSet.Contains(s.Name)));
}
public List<string>? SelectedSessionSkillNames()
{
var names = SessionSkills.Where(s => s.IsSelected).Select(s => s.Name).ToList();
return names.Count == 0 ? null : names;
}
} }
@@ -0,0 +1,80 @@
using System.Collections.ObjectModel;
using ClaudeDo.Ui.Localization;
using ClaudeDo.Ui.Services;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
namespace ClaudeDo.Ui.ViewModels.Modals.Settings;
public sealed partial class SessionSkillsSettingsTabViewModel : ViewModelBase
{
private readonly IWorkerClient _worker;
[ObservableProperty] private string _installUrl = "";
[ObservableProperty] private string _statusMessage = "";
[ObservableProperty] private bool _isBusy;
[ObservableProperty] private bool _isEmpty = true;
public ObservableCollection<SessionSkillDto> Skills { get; } = new();
public SessionSkillsSettingsTabViewModel(IWorkerClient worker) => _worker = worker;
public async Task LoadAsync()
{
IsBusy = true;
try
{
var skills = await _worker.GetSessionSkillsAsync();
Skills.Clear();
foreach (var s in skills) Skills.Add(s);
IsEmpty = Skills.Count == 0;
}
finally { IsBusy = false; }
}
[RelayCommand]
private async Task InstallAsync()
{
if (string.IsNullOrWhiteSpace(InstallUrl)) return;
IsBusy = true; StatusMessage = "";
try
{
var installed = await _worker.InstallSessionSkillAsync(InstallUrl.Trim());
StatusMessage = Loc.T("vm.sessionSkillsTab.installed", string.Join(", ", installed));
InstallUrl = "";
await LoadAsync();
}
catch (Exception ex) { StatusMessage = Loc.T("vm.sessionSkillsTab.installFailed", ex.Message); }
finally { IsBusy = false; }
}
[RelayCommand]
private async Task UpdateAsync(string? sourceUrl)
{
if (string.IsNullOrWhiteSpace(sourceUrl)) return;
IsBusy = true; StatusMessage = "";
try
{
await _worker.UpdateSessionSkillAsync(sourceUrl);
StatusMessage = Loc.T("vm.sessionSkillsTab.updated");
await LoadAsync();
}
catch (Exception ex) { StatusMessage = Loc.T("vm.sessionSkillsTab.updateFailed", ex.Message); }
finally { IsBusy = false; }
}
[RelayCommand]
private async Task RemoveAsync(string? sourceUrl)
{
if (string.IsNullOrWhiteSpace(sourceUrl)) return;
IsBusy = true; StatusMessage = "";
try
{
await _worker.RemoveSessionSkillAsync(sourceUrl);
StatusMessage = Loc.T("vm.sessionSkillsTab.removed");
await LoadAsync();
}
catch (Exception ex) { StatusMessage = Loc.T("vm.sessionSkillsTab.removeFailed", ex.Message); }
finally { IsBusy = false; }
}
}
@@ -18,6 +18,7 @@ public sealed partial class SettingsModalViewModel : ViewModelBase
public FilesSettingsTabViewModel Files { get; } public FilesSettingsTabViewModel Files { get; }
public PrimeClaudeTabViewModel Prime { get; } public PrimeClaudeTabViewModel Prime { get; }
public OnlineInboxSettingsViewModel OnlineInbox { get; } public OnlineInboxSettingsViewModel OnlineInbox { get; }
public SessionSkillsSettingsTabViewModel SessionSkills { get; }
[ObservableProperty] private string _validationError = ""; [ObservableProperty] private string _validationError = "";
[ObservableProperty] private bool _isBusy; [ObservableProperty] private bool _isBusy;
@@ -39,6 +40,7 @@ public sealed partial class SettingsModalViewModel : ViewModelBase
Files = new FilesSettingsTabViewModel(worker); Files = new FilesSettingsTabViewModel(worker);
Prime = prime; Prime = prime;
OnlineInbox = new OnlineInboxSettingsViewModel(worker, onlineLoginService); OnlineInbox = new OnlineInboxSettingsViewModel(worker, onlineLoginService);
SessionSkills = new SessionSkillsSettingsTabViewModel(worker);
} }
public async Task LoadAsync() public async Task LoadAsync()
@@ -69,6 +71,8 @@ public sealed partial class SettingsModalViewModel : ViewModelBase
await Prime.LoadAsync(); await Prime.LoadAsync();
await OnlineInbox.LoadAsync(); await OnlineInbox.LoadAsync();
await SessionSkills.LoadAsync();
await General.LoadSessionSkillsAsync(_worker, dto?.SessionSkills);
} }
finally { IsBusy = false; } finally { IsBusy = false; }
} }
@@ -97,7 +101,8 @@ public sealed partial class SettingsModalViewModel : ViewModelBase
General.ReportExcludedPaths General.ReportExcludedPaths
.Split('\n').Select(l => l.Trim().TrimEnd('\r')).Where(l => l.Length > 0).ToList()), .Split('\n').Select(l => l.Trim().TrimEnd('\r')).Where(l => l.Length > 0).ToList()),
General.StandupWeekday, General.StandupWeekday,
Prime.DailyPrepMaxTasks); Prime.DailyPrepMaxTasks,
General.SelectedSessionSkillNames());
await _worker.UpdateAppSettingsAsync(dto); await _worker.UpdateAppSettingsAsync(dto);
await Prime.SaveAsync(); await Prime.SaveAsync();
await OnlineInbox.SaveAsync(); await OnlineInbox.SaveAsync();
@@ -1,3 +1,5 @@
using System.Text;
namespace ClaudeDo.Ui.ViewModels.Modals; namespace ClaudeDo.Ui.ViewModels.Modals;
/// Shared unified-diff parser used by both the per-task diff viewer and the /// Shared unified-diff parser used by both the per-task diff viewer and the
@@ -16,10 +18,13 @@ public static class UnifiedDiffParser
{ {
if (line.StartsWith("diff --git ", StringComparison.Ordinal)) if (line.StartsWith("diff --git ", StringComparison.Ordinal))
{ {
// e.g. "diff --git a/src/Foo.cs b/src/Foo.cs" // e.g. "diff --git a/src/Foo.cs b/src/Foo.cs". Paths may each be
var parts = line.Split(' '); // git-quoted (C-style, octal-escaped) when they contain non-ASCII
var path = parts.Length >= 4 ? parts[3][2..] : line; // bytes, and unquoted paths may themselves contain spaces, so the
current = new DiffFileViewModel { Path = path }; // two paths can't be split on a plain ' ' - this is only a best
// effort default; "--- "/"+++ "/rename lines below correct it.
var (_, newPath) = SplitGitHeaderPaths(line["diff --git ".Length..]);
current = new DiffFileViewModel { Path = newPath };
files.Add(current); files.Add(current);
oldLine = 0; newLine = 0; oldLine = 0; newLine = 0;
continue; continue;
@@ -41,13 +46,13 @@ public static class UnifiedDiffParser
if (line.StartsWith("rename from ", StringComparison.Ordinal)) if (line.StartsWith("rename from ", StringComparison.Ordinal))
{ {
current.Status = DiffFileStatus.Renamed; current.Status = DiffFileStatus.Renamed;
current.OldPath = line["rename from ".Length..]; current.OldPath = UnquotePath(line["rename from ".Length..]);
continue; continue;
} }
if (line.StartsWith("rename to ", StringComparison.Ordinal)) if (line.StartsWith("rename to ", StringComparison.Ordinal))
{ {
current.Status = DiffFileStatus.Renamed; current.Status = DiffFileStatus.Renamed;
current.Path = line["rename to ".Length..]; current.Path = UnquotePath(line["rename to ".Length..]);
continue; continue;
} }
if (line.StartsWith("Binary files", StringComparison.Ordinal) || if (line.StartsWith("Binary files", StringComparison.Ordinal) ||
@@ -64,10 +69,27 @@ public static class UnifiedDiffParser
continue; continue;
} }
// "--- a/..." / "+++ b/..." each carry a single unambiguous path (unlike
// the two-paths-on-one-line "diff --git" header above), so use them to
// correct the file's identity - git also appends a disambiguating tab
// after unquoted paths that contain whitespace, which must be trimmed.
if (line.StartsWith("--- ", StringComparison.Ordinal))
{
var oldPath = UnquotePath(line[4..].TrimEnd('\t'));
if (oldPath != "/dev/null" && current.Status == DiffFileStatus.Deleted)
current.Path = StripPrefix(oldPath, "a/");
continue;
}
if (line.StartsWith("+++ ", StringComparison.Ordinal))
{
var newPath = UnquotePath(line[4..].TrimEnd('\t'));
if (newPath != "/dev/null" && current.Status != DiffFileStatus.Renamed)
current.Path = StripPrefix(newPath, "b/");
continue;
}
// Skip remaining diff metadata lines // Skip remaining diff metadata lines
if (line.StartsWith("--- ", StringComparison.Ordinal) || if (line.StartsWith("index ", StringComparison.Ordinal) ||
line.StartsWith("+++ ", StringComparison.Ordinal) ||
line.StartsWith("index ", StringComparison.Ordinal) ||
line.StartsWith("old mode", StringComparison.Ordinal) || line.StartsWith("old mode", StringComparison.Ordinal) ||
line.StartsWith("new mode", StringComparison.Ordinal) || line.StartsWith("new mode", StringComparison.Ordinal) ||
line.StartsWith("similarity index", StringComparison.Ordinal) || line.StartsWith("similarity index", StringComparison.Ordinal) ||
@@ -140,4 +162,111 @@ public static class UnifiedDiffParser
newStart = n; newStart = n;
} }
} }
/// Splits a "diff --git" header's remainder ("a/&lt;old&gt; b/&lt;new&gt;", where
/// either side may be individually git-quoted) into its two paths.
private static (string OldPath, string NewPath) SplitGitHeaderPaths(string content)
{
string oldToken, newToken;
if (content.Length > 0 && content[0] == '"')
{
var close = FindClosingQuote(content, 0);
oldToken = content[..(close + 1)];
newToken = content[(close + 1)..].TrimStart(' ');
}
else
{
var quoteAt = content.IndexOf('"');
if (quoteAt >= 0)
{
// Mixed quoting: an unquoted path never contains a literal quote
// (git would have quoted it), so the quote marks the other side.
oldToken = content[..quoteAt].TrimEnd(' ');
newToken = content[quoteAt..];
}
else
{
var splitAt = content.IndexOf(" b/", StringComparison.Ordinal);
oldToken = splitAt < 0 ? content : content[..splitAt];
newToken = splitAt < 0 ? content : content[(splitAt + 1)..];
}
}
return (StripPrefix(UnquotePath(oldToken), "a/"), StripPrefix(UnquotePath(newToken), "b/"));
}
private static int FindClosingQuote(string s, int start)
{
var i = start + 1;
while (i < s.Length)
{
if (s[i] == '\\') { i += 2; continue; }
if (s[i] == '"') return i;
i++;
}
return s.Length - 1;
}
private static string StripPrefix(string path, string prefix) =>
path.StartsWith(prefix, StringComparison.Ordinal) ? path[prefix.Length..] : path;
/// Reverses git's C-style path quoting: a quoted token is wrapped in double
/// quotes with '\\', '"' and non-ASCII bytes escaped as \nnn octal sequences
/// (used whenever core.quotePath would otherwise consider the path "unusual").
private static string UnquotePath(string token)
{
if (token.Length < 2 || token[0] != '"' || token[^1] != '"')
return token;
var bytes = new List<byte>();
var end = token.Length - 1;
var i = 1;
while (i < end)
{
var c = token[i];
if (c != '\\')
{
bytes.Add((byte)c);
i++;
continue;
}
i++;
if (i >= end) break;
switch (token[i])
{
case '"': bytes.Add((byte)'"'); i++; break;
case '\\': bytes.Add((byte)'\\'); i++; break;
case 'a': bytes.Add(0x07); i++; break;
case 'b': bytes.Add(0x08); i++; break;
case 'f': bytes.Add(0x0C); i++; break;
case 'n': bytes.Add((byte)'\n'); i++; break;
case 'r': bytes.Add((byte)'\r'); i++; break;
case 't': bytes.Add((byte)'\t'); i++; break;
case 'v': bytes.Add(0x0B); i++; break;
default:
if (token[i] is >= '0' and <= '7')
{
var value = 0;
var digits = 0;
while (digits < 3 && i < end && token[i] is >= '0' and <= '7')
{
value = value * 8 + (token[i] - '0');
i++;
digits++;
}
bytes.Add((byte)value);
}
else
{
bytes.Add((byte)token[i]);
i++;
}
break;
}
}
return Encoding.UTF8.GetString(bytes.ToArray());
}
} }
@@ -67,7 +67,7 @@
<TextBlock Grid.Column="0" Classes="meta" VerticalAlignment="Center" <TextBlock Grid.Column="0" Classes="meta" VerticalAlignment="Center"
Foreground="{DynamicResource BloodBrush}" Foreground="{DynamicResource BloodBrush}"
Text="{Binding ContinueHint}" Text="{Binding ContinueHint}"
IsVisible="{Binding HasBinaryFiles}"/> IsVisible="{Binding ContinueHint, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
<StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="8"> <StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="8">
<Button Classes="btn accent" Content="{loc:Tr conflictResolver.continue}" <Button Classes="btn accent" Content="{loc:Tr conflictResolver.continue}"
Command="{Binding ContinueCommand}" IsEnabled="{Binding CanContinue}"/> Command="{Binding ContinueCommand}" IsEnabled="{Binding CanContinue}"/>
@@ -81,5 +81,20 @@
IsVisible="{Binding SelectedAgent.Path, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/> IsVisible="{Binding SelectedAgent.Path, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
</StackPanel> </StackPanel>
<!-- Session skills (additive union with list/global; no inheritance badge) -->
<StackPanel Spacing="4">
<TextBlock Classes="field-label" Text="{loc:Tr settings.agentEditor.sessionSkills}"/>
<TextBlock Classes="meta" Opacity="0.6" TextWrapping="Wrap"
Text="{loc:Tr settings.agentEditor.sessionSkillsHint}"/>
<ItemsControl ItemsSource="{Binding SessionSkills}">
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="vm:SelectableSkillViewModel">
<CheckBox IsChecked="{Binding IsSelected, Mode=TwoWay}" Content="{Binding Name}"
ToolTip.Tip="{Binding Description}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</StackPanel> </StackPanel>
</UserControl> </UserControl>
@@ -0,0 +1,26 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:ClaudeDo.Ui.ViewModels"
xmlns:term="using:Iciclecreek.Terminal"
x:Class="ClaudeDo.Ui.Views.InteractiveTerminalView"
x:DataType="vm:InteractiveTerminalViewModel"
x:Name="Root">
<!--
Process="" suppresses TerminalView.OnLoaded's built-in auto-launch (it otherwise spawns its
own cmd.exe/bash the moment this control loads). PtyTerminalSession sets Process/Args/
StartingDirectory to our real target and calls TerminalControl.LaunchProcess() exactly once,
once the view model's descriptor is known (see AttachControl/Start).
-->
<!--
Font + BufferSize match the working spike. The control derives Cols/Rows from
(arranged size / character cell size), so an explicit monospace font is what keeps that
calculation correct; without it the terminal miscomputes its size and the child TUI renders
into the wrong area. Stretch so the pane's full size reaches the control's Arrange pass.
-->
<term:TerminalControl x:Name="TerminalHost" Process=""
FontFamily="Cascadia Mono,Consolas,monospace"
FontSize="14"
BufferSize="2000"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" />
</UserControl>
@@ -0,0 +1,28 @@
using System;
using Avalonia.Controls;
using Avalonia.Interactivity;
using ClaudeDo.Ui.ViewModels;
namespace ClaudeDo.Ui.Views;
public partial class InteractiveTerminalView : UserControl
{
public InteractiveTerminalView()
{
InitializeComponent();
TerminalHost.Loaded += OnTerminalHostLoaded;
DataContextChanged += OnDataContextChanged;
}
private void OnDataContextChanged(object? sender, EventArgs e)
{
if (DataContext is InteractiveTerminalViewModel vm && TerminalHost.IsLoaded)
vm.AttachControl(TerminalHost);
}
private void OnTerminalHostLoaded(object? sender, RoutedEventArgs e)
{
if (DataContext is InteractiveTerminalViewModel vm)
vm.AttachControl(TerminalHost);
}
}
@@ -6,7 +6,7 @@
x:Class="ClaudeDo.Ui.Views.Islands.Detail.TaskHeaderBar" x:Class="ClaudeDo.Ui.Views.Islands.Detail.TaskHeaderBar"
x:DataType="vm:DetailsIslandViewModel"> x:DataType="vm:DetailsIslandViewModel">
<Grid ColumnDefinitions="*,Auto,Auto"> <Grid ColumnDefinitions="*,Auto,Auto,Auto">
<!-- Column 0: id badge + editable title --> <!-- Column 0: id badge + editable title -->
<StackPanel Grid.Column="0" Spacing="0"> <StackPanel Grid.Column="0" Spacing="0">
@@ -27,8 +27,18 @@
Padding="0"/> Padding="0"/>
</StackPanel> </StackPanel>
<!-- Column 1: trash button (not running) --> <!-- Column 1: pick up in terminal (review / failed) -->
<Button Grid.Column="1" Classes="icon-btn" <Button Grid.Column="1" Classes="icon-btn"
Command="{Binding PickUpInTerminalCommand}"
ToolTip.Tip="{loc:Tr details.pickUpInTerminalTip}"
IsVisible="{Binding CanPickUpInTerminal}"
VerticalAlignment="Top"
Margin="6,0,0,0">
<PathIcon Data="{StaticResource Icon.ArrowOut}" Width="14" Height="14"/>
</Button>
<!-- Column 2: trash button (not running) -->
<Button Grid.Column="2" Classes="icon-btn"
Command="{Binding DeleteTaskCommand}" Command="{Binding DeleteTaskCommand}"
ToolTip.Tip="{loc:Tr details.deleteTaskTip}" ToolTip.Tip="{loc:Tr details.deleteTaskTip}"
IsVisible="{Binding !IsRunning}" IsVisible="{Binding !IsRunning}"
@@ -38,8 +48,8 @@
Foreground="{DynamicResource BloodBrush}"/> Foreground="{DynamicResource BloodBrush}"/>
</Button> </Button>
<!-- Column 1: skull button (running) --> <!-- Column 2: skull button (running) -->
<Button Grid.Column="1" Classes="icon-btn" <Button Grid.Column="2" Classes="icon-btn"
Command="{Binding StopCommand}" Command="{Binding StopCommand}"
ToolTip.Tip="{loc:Tr details.killSessionTip}" ToolTip.Tip="{loc:Tr details.killSessionTip}"
IsVisible="{Binding IsRunning}" IsVisible="{Binding IsRunning}"
@@ -49,13 +59,13 @@
Foreground="{DynamicResource BloodBrush}"/> Foreground="{DynamicResource BloodBrush}"/>
</Button> </Button>
<!-- Column 2: gear button with agent settings flyout --> <!-- Column 3: gear button with agent settings flyout -->
<Button Grid.Column="2" Classes="icon-btn" <Button Grid.Column="3" Classes="icon-btn"
ToolTip.Tip="{loc:Tr details.agentSettingsTip}" ToolTip.Tip="{loc:Tr details.agentSettingsTip}"
IsEnabled="{Binding AgentSettings.IsEnabled}" IsEnabled="{Binding AgentSettings.IsEnabled}"
VerticalAlignment="Top" VerticalAlignment="Top"
Margin="6,0,0,0"> Margin="6,0,0,0">
<TextBlock Text="⚙" FontSize="{StaticResource FontSizeTaskTitle}"/> <PathIcon Data="{StaticResource Icon.Settings}" Width="15" Height="15"/>
<Button.Flyout> <Button.Flyout>
<Flyout Placement="BottomEdgeAlignedRight" ShowMode="Standard"> <Flyout Placement="BottomEdgeAlignedRight" ShowMode="Standard">
<StackPanel Width="340" Spacing="10" Margin="4"> <StackPanel Width="340" Spacing="10" Margin="4">
@@ -263,83 +263,6 @@
Command="{Binding RejectReviewCommand}" /> Command="{Binding RejectReviewCommand}" />
</Grid> </Grid>
<!-- Interactive composer + queued strip — chat with a live in-app session -->
<StackPanel DockPanel.Dock="Bottom" Orientation="Vertical">
<!-- Queued messages strip -->
<Border IsVisible="{Binding Monitor.HasQueuedMessages}"
BorderBrush="{DynamicResource LineBrush}"
BorderThickness="0,1,0,0"
Padding="12,4">
<StackPanel Spacing="2">
<TextBlock Classes="meta"
Text="{loc:Tr session.composer.queued}"
Foreground="{DynamicResource TextMuteBrush}" />
<ItemsControl ItemsSource="{Binding Monitor.QueuedMessages}">
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="vm:QueuedMessageViewModel">
<Grid ColumnDefinitions="Auto,*,Auto" Margin="0,1">
<TextBlock Grid.Column="0"
Text="⧗"
Foreground="{DynamicResource TextMuteBrush}"
FontFamily="{StaticResource MonoFont}"
FontSize="{StaticResource FontSizeMono}"
VerticalAlignment="Center"
Margin="0,0,6,0" />
<TextBlock Grid.Column="1"
Text="{Binding Text}"
Foreground="{DynamicResource TextDimBrush}"
FontFamily="{StaticResource MonoFont}"
FontSize="{StaticResource FontSizeMono}"
TextTrimming="CharacterEllipsis"
VerticalAlignment="Center" />
<Button Grid.Column="2"
Classes="title-ctrl"
Command="{Binding RemoveCommand}"
ToolTip.Tip="{loc:Tr session.composer.unqueue}"
Margin="4,0,0,0">
<PathIcon Data="{StaticResource Icon.WinClose}" Width="8" Height="8"/>
</Button>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</Border>
<!-- Composer input row -->
<Grid IsVisible="{Binding Monitor.IsInteractiveLive}"
ColumnDefinitions="Auto,*,Auto,Auto"
Margin="12,2,12,8">
<TextBlock Grid.Column="0" Text="&#x276F;"
FontFamily="{StaticResource MonoFont}"
FontSize="{StaticResource FontSizeMono}"
Foreground="{DynamicResource AccentBrush}"
VerticalAlignment="Center" Margin="0,0,8,0" />
<TextBox Grid.Column="1"
Classes="review-prompt"
Text="{Binding Monitor.ComposerDraft, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
AcceptsReturn="False"
TextWrapping="Wrap"
MaxHeight="160"
PlaceholderText="{loc:Tr session.composer.placeholder}"
VerticalContentAlignment="Center"
FontFamily="{StaticResource MonoFont}"
FontSize="{StaticResource FontSizeMono}">
<TextBox.KeyBindings>
<KeyBinding Gesture="Enter" Command="{Binding Monitor.SubmitComposerCommand}" />
</TextBox.KeyBindings>
</TextBox>
<Button Grid.Column="2" Classes="prompt-action"
VerticalAlignment="Center" Margin="12,0,0,0"
Command="{Binding Monitor.InterruptInteractiveCommand}"
ToolTip.Tip="{loc:Tr session.composer.interrupt}">
<PathIcon Data="{StaticResource Icon.Stop}" Width="10" Height="10"/>
</Button>
<Button Grid.Column="3" Classes="prompt-action accent" Content="[Send]"
VerticalAlignment="Center" Margin="4,0,0,0"
Command="{Binding Monitor.SubmitComposerCommand}" />
</Grid>
</StackPanel>
<ScrollViewer Name="LogScroll" <ScrollViewer Name="LogScroll"
VerticalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible"
AllowAutoHide="False" AllowAutoHide="False"
@@ -425,6 +348,16 @@
<Border Height="1" Background="{DynamicResource LineBrush}" <Border Height="1" Background="{DynamicResource LineBrush}"
IsVisible="{Binding Merge.ShowMergeSection}" /> IsVisible="{Binding Merge.ShowMergeSection}" />
<!-- Gate: you must open the diff before Approve & Merge unlocks. -->
<StackPanel Orientation="Horizontal" Spacing="6"
IsVisible="{Binding ShowReviewDiffHint}">
<PathIcon Data="{StaticResource Icon.ArrowOut}" Width="11" Height="11"
Foreground="{DynamicResource AmberBrush}" VerticalAlignment="Center" />
<TextBlock Classes="meta" VerticalAlignment="Center"
Foreground="{DynamicResource AmberBrush}"
Text="Open the diff to enable merge" />
</StackPanel>
<WrapPanel Orientation="Horizontal"> <WrapPanel Orientation="Horizontal">
<Button Classes="btn accent" Content="Approve &amp; Merge" Margin="0,0,8,8" <Button Classes="btn accent" Content="Approve &amp; Merge" Margin="0,0,8,8"
Command="{Binding ApproveReviewCommand}" /> Command="{Binding ApproveReviewCommand}" />
@@ -439,6 +372,17 @@
ToolTip.Tip="{loc:Tr session.reviewResetTip}" ToolTip.Tip="{loc:Tr session.reviewResetTip}"
Command="{Binding ResetReviewCommand}" /> Command="{Binding ResetReviewCommand}" />
</StackPanel> </StackPanel>
<!-- Submit an interactive (ConPTY) session for review: an Idle/Failed task that
still has a worktree. Commits the worktree, then moves it to WaitingForReview. -->
<StackPanel Spacing="8" IsVisible="{Binding CanSubmitForReview}">
<Border Height="1" Background="{DynamicResource LineBrush}" />
<TextBlock Classes="meta" TextWrapping="Wrap"
Foreground="{DynamicResource TextMuteBrush}"
Text="Worked on this by hand? Submit the worktree for review to merge it." />
<Button Classes="btn accent" Content="Submit for review" HorizontalAlignment="Left"
Command="{Binding SubmitForReviewCommand}" />
</StackPanel>
</StackPanel> </StackPanel>
</ScrollViewer> </ScrollViewer>
@@ -80,6 +80,37 @@
Foreground="{DynamicResource TextDimBrush}"/> Foreground="{DynamicResource TextDimBrush}"/>
</StackPanel> </StackPanel>
</Border> </Border>
<!-- Question prompt (AskUser): answer the running task's question inline, mirroring
the Mission Control banner. State is shared via the same TaskMonitorViewModel. -->
<Border DockPanel.Dock="Top"
IsVisible="{Binding Monitor.HasPendingQuestion}"
Margin="0,0,0,10" Padding="12,8"
Background="{DynamicResource AccentSoftBrush}"
BorderBrush="{DynamicResource AccentBrush}"
BorderThickness="1" CornerRadius="10">
<StackPanel Spacing="6">
<TextBlock Classes="meta"
Text="{loc:Tr missionControl.question.title}"
Foreground="{DynamicResource AccentBrush}" FontWeight="SemiBold"/>
<TextBlock Text="{Binding Monitor.PendingQuestion}" TextWrapping="Wrap"
Foreground="{DynamicResource TextBrush}"/>
<Grid ColumnDefinitions="*,Auto" ColumnSpacing="6">
<TextBox Grid.Column="0"
Text="{Binding Monitor.AnswerDraft, UpdateSourceTrigger=PropertyChanged}"
PlaceholderText="{loc:Tr missionControl.question.placeholder}"
AcceptsReturn="False">
<TextBox.KeyBindings>
<KeyBinding Gesture="Enter" Command="{Binding Monitor.SubmitAnswerCommand}"/>
</TextBox.KeyBindings>
</TextBox>
<Button Grid.Column="1"
Content="{loc:Tr missionControl.question.send}"
Command="{Binding Monitor.SubmitAnswerCommand}"/>
</Grid>
</StackPanel>
</Border>
<detail:WorkConsole/> <detail:WorkConsole/>
</DockPanel> </DockPanel>
@@ -81,6 +81,8 @@ public partial class DetailsIslandView : UserControl
if (items is null) return; if (items is null) return;
var files = new List<(string FileName, System.IO.Stream Content)>(); var files = new List<(string FileName, System.IO.Stream Content)>();
try
{
foreach (var item in items) foreach (var item in items)
{ {
if (item is IStorageFile sf) if (item is IStorageFile sf)
@@ -89,6 +91,18 @@ public partial class DetailsIslandView : UserControl
files.Add((sf.Name, stream)); files.Add((sf.Name, stream));
} }
} }
}
catch (Exception ex)
{
// Opening the dropped stream can fail (shell IO, file lock) before AddFilesAsync
// ever runs; surface it with the exception type so the next occurrence is analyzable
// instead of vanishing as an unobserved async-void fault.
_vm.DropStatus = string.Format(
ClaudeDo.Ui.Localization.Loc.T("details.attachments.dropReadError"),
$"{ex.GetType().Name}: {ex.Message}");
foreach (var (_, s) in files) await s.DisposeAsync();
return;
}
if (files.Count == 0) return; if (files.Count == 0) return;
@@ -50,79 +50,6 @@
</Border> </Border>
</Grid> </Grid>
<!-- ── Queued strip + Composer bar ── -->
<StackPanel DockPanel.Dock="Bottom" Orientation="Vertical">
<!-- Queued messages strip -->
<Border IsVisible="{Binding #Root.HasQueuedMessages}"
Background="{DynamicResource Surface2Brush}"
BorderBrush="{DynamicResource LineBrush}"
BorderThickness="0,0,0,1"
Padding="8,4">
<StackPanel Spacing="2">
<TextBlock Classes="meta"
Text="{loc:Tr session.composer.queued}"
Foreground="{DynamicResource TextMuteBrush}" />
<ItemsControl ItemsSource="{Binding #Root.QueuedMessages}">
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="vm:QueuedMessageViewModel">
<Grid ColumnDefinitions="Auto,*,Auto" Margin="0,1">
<TextBlock Grid.Column="0"
Text="⧗"
Foreground="{DynamicResource TextMuteBrush}"
FontFamily="{StaticResource MonoFont}"
FontSize="{StaticResource FontSizeMono}"
VerticalAlignment="Center"
Margin="0,0,6,0" />
<TextBlock Grid.Column="1"
Text="{Binding Text}"
Foreground="{DynamicResource TextDimBrush}"
FontFamily="{StaticResource MonoFont}"
FontSize="{StaticResource FontSizeMono}"
TextTrimming="CharacterEllipsis"
VerticalAlignment="Center" />
<Button Grid.Column="2"
Classes="title-ctrl"
Command="{Binding RemoveCommand}"
ToolTip.Tip="{loc:Tr session.composer.unqueue}"
Margin="4,0,0,0">
<PathIcon Data="{StaticResource Icon.WinClose}" Width="8" Height="8"/>
</Button>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</Border>
<!-- Composer input row -->
<Border IsVisible="{Binding #Root.IsComposerVisible}"
Background="{DynamicResource Surface2Brush}"
BorderBrush="{DynamicResource LineBrush}"
BorderThickness="0,1,0,0"
Padding="6,5">
<Grid ColumnDefinitions="*,Auto,Auto">
<TextBox Grid.Column="0"
Text="{Binding #Root.ComposerText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
PlaceholderText="{Binding #Root.ComposerPlaceholder}"
AcceptsReturn="False">
<TextBox.KeyBindings>
<KeyBinding Gesture="Enter" Command="{Binding #Root.SubmitCommand}"/>
</TextBox.KeyBindings>
</TextBox>
<Button Grid.Column="1"
Margin="6,0,0,0"
Classes="title-ctrl"
Command="{Binding #Root.InterruptCommand}"
ToolTip.Tip="{loc:Tr session.composer.interrupt}">
<PathIcon Data="{StaticResource Icon.Stop}" Width="10" Height="10"/>
</Button>
<Button Grid.Column="2"
Margin="6,0,0,0"
Content="{loc:Tr session.composer.send}"
Command="{Binding #Root.SubmitCommand}"/>
</Grid>
</Border>
</StackPanel>
<!-- ── Log output ── --> <!-- ── Log output ── -->
<ScrollViewer Name="LogScroll" <ScrollViewer Name="LogScroll"
VerticalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible"
@@ -1,9 +1,7 @@
using System.Collections; using System.Collections;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Windows.Input;
using Avalonia; using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Data;
namespace ClaudeDo.Ui.Views.Islands; namespace ClaudeDo.Ui.Views.Islands;
@@ -19,33 +17,12 @@ public partial class SessionTerminalView : UserControl
AvaloniaProperty.Register<SessionTerminalView, bool>(nameof(IsDone)); AvaloniaProperty.Register<SessionTerminalView, bool>(nameof(IsDone));
public static readonly StyledProperty<bool> IsFailedProperty = public static readonly StyledProperty<bool> IsFailedProperty =
AvaloniaProperty.Register<SessionTerminalView, bool>(nameof(IsFailed)); AvaloniaProperty.Register<SessionTerminalView, bool>(nameof(IsFailed));
public static readonly StyledProperty<bool> IsComposerVisibleProperty =
AvaloniaProperty.Register<SessionTerminalView, bool>(nameof(IsComposerVisible), defaultValue: false);
public static readonly StyledProperty<string?> ComposerTextProperty =
AvaloniaProperty.Register<SessionTerminalView, string?>(nameof(ComposerText), defaultBindingMode: BindingMode.TwoWay);
public static readonly StyledProperty<ICommand?> SubmitCommandProperty =
AvaloniaProperty.Register<SessionTerminalView, ICommand?>(nameof(SubmitCommand));
public static readonly StyledProperty<ICommand?> InterruptCommandProperty =
AvaloniaProperty.Register<SessionTerminalView, ICommand?>(nameof(InterruptCommand));
public static readonly StyledProperty<string?> ComposerPlaceholderProperty =
AvaloniaProperty.Register<SessionTerminalView, string?>(nameof(ComposerPlaceholder));
public static readonly StyledProperty<System.Collections.IEnumerable?> QueuedMessagesProperty =
AvaloniaProperty.Register<SessionTerminalView, System.Collections.IEnumerable?>(nameof(QueuedMessages));
public static readonly StyledProperty<bool> HasQueuedMessagesProperty =
AvaloniaProperty.Register<SessionTerminalView, bool>(nameof(HasQueuedMessages), defaultValue: false);
public IEnumerable? Entries { get => GetValue(EntriesProperty); set => SetValue(EntriesProperty, value); } public IEnumerable? Entries { get => GetValue(EntriesProperty); set => SetValue(EntriesProperty, value); }
public string? Label { get => GetValue(LabelProperty); set => SetValue(LabelProperty, value); } public string? Label { get => GetValue(LabelProperty); set => SetValue(LabelProperty, value); }
public bool IsRunning { get => GetValue(IsRunningProperty); set => SetValue(IsRunningProperty, value); } public bool IsRunning { get => GetValue(IsRunningProperty); set => SetValue(IsRunningProperty, value); }
public bool IsDone { get => GetValue(IsDoneProperty); set => SetValue(IsDoneProperty, value); } public bool IsDone { get => GetValue(IsDoneProperty); set => SetValue(IsDoneProperty, value); }
public bool IsFailed { get => GetValue(IsFailedProperty); set => SetValue(IsFailedProperty, value); } public bool IsFailed { get => GetValue(IsFailedProperty); set => SetValue(IsFailedProperty, value); }
public bool IsComposerVisible { get => GetValue(IsComposerVisibleProperty); set => SetValue(IsComposerVisibleProperty, value); }
public string? ComposerText { get => GetValue(ComposerTextProperty); set => SetValue(ComposerTextProperty, value); }
public ICommand? SubmitCommand { get => GetValue(SubmitCommandProperty); set => SetValue(SubmitCommandProperty, value); }
public ICommand? InterruptCommand { get => GetValue(InterruptCommandProperty); set => SetValue(InterruptCommandProperty, value); }
public string? ComposerPlaceholder { get => GetValue(ComposerPlaceholderProperty); set => SetValue(ComposerPlaceholderProperty, value); }
public System.Collections.IEnumerable? QueuedMessages { get => GetValue(QueuedMessagesProperty); set => SetValue(QueuedMessagesProperty, value); }
public bool HasQueuedMessages { get => GetValue(HasQueuedMessagesProperty); set => SetValue(HasQueuedMessagesProperty, value); }
private INotifyCollectionChanged? _subscribedCollection; private INotifyCollectionChanged? _subscribedCollection;
@@ -49,8 +49,11 @@
<MenuItem Header="{loc:Tr tasks.ctxMarkCancelled}" Tag="Cancelled" Click="OnSetStatusClick"/> <MenuItem Header="{loc:Tr tasks.ctxMarkCancelled}" Tag="Cancelled" Click="OnSetStatusClick"/>
</MenuItem> </MenuItem>
<Separator/> <Separator/>
<MenuItem Header="{loc:Tr tasks.ctxRunInteractively}" <MenuItem Header="{loc:Tr tasks.ctxOpenConPtySession}"
Click="OnRunInteractivelyClick"/> Click="OnOpenConPtySessionClick"/>
<MenuItem Header="{loc:Tr tasks.ctxPickUpInTerminal}"
Click="OnPickUpInTerminalClick"
IsVisible="{Binding CanPickUpInTerminal}"/>
<MenuItem Header="{loc:Tr tasks.ctxOpenPlanningSession}" <MenuItem Header="{loc:Tr tasks.ctxOpenPlanningSession}"
Click="OnOpenPlanningSessionClick" Click="OnOpenPlanningSessionClick"
IsVisible="{Binding CanOpenPlanningSession}"/> IsVisible="{Binding CanOpenPlanningSession}"/>
@@ -153,6 +156,7 @@
<!-- Status chip --> <!-- Status chip -->
<Border Classes="chip" <Border Classes="chip"
IsVisible="{Binding ShowStatusChip}"
Classes.parked="{Binding IsParked}" Classes.parked="{Binding IsParked}"
Classes.running="{Binding Status, Converter={StaticResource EqStatus}, ConverterParameter=Running}" Classes.running="{Binding Status, Converter={StaticResource EqStatus}, ConverterParameter=Running}"
Classes.review="{Binding Status, Converter={StaticResource EqStatus}, ConverterParameter=WaitingForReview}" Classes.review="{Binding Status, Converter={StaticResource EqStatus}, ConverterParameter=WaitingForReview}"
@@ -55,16 +55,22 @@ public partial class TaskRowView : UserControl
await vm.RemoveFromMyDayCommand.ExecuteAsync(row); await vm.RemoveFromMyDayCommand.ExecuteAsync(row);
} }
private async void OnOpenPlanningSessionClick(object? sender, RoutedEventArgs e) private void OnOpenPlanningSessionClick(object? sender, RoutedEventArgs e)
{ {
if (DataContext is TaskRowViewModel row && FindTasksVm() is { } vm) if (DataContext is TaskRowViewModel row && FindTasksVm() is { } vm)
await vm.OpenPlanningSessionCommand.ExecuteAsync(row); vm.OpenPlanningSessionCommand.Execute(row);
} }
private async void OnRunInteractivelyClick(object? sender, RoutedEventArgs e) private void OnOpenConPtySessionClick(object? sender, RoutedEventArgs e)
{ {
if (DataContext is TaskRowViewModel row && FindTasksVm() is { } vm) if (DataContext is TaskRowViewModel row && FindTasksVm() is { } vm)
await vm.RunInteractivelyCommand.ExecuteAsync(row); vm.OpenConPtySessionCommand.Execute(row);
}
private async void OnPickUpInTerminalClick(object? sender, RoutedEventArgs e)
{
if (DataContext is TaskRowViewModel row && FindTasksVm() is { } vm)
await vm.PickUpInTerminalCommand.ExecuteAsync(row);
} }
private async void OnResumePlanningSessionClick(object? sender, RoutedEventArgs e) private async void OnResumePlanningSessionClick(object? sender, RoutedEventArgs e)
+34 -41
View File
@@ -22,7 +22,7 @@
<KeyBinding Gesture="Shift+OemQuestion" Command="{Binding FocusSearchCommand}"/> <KeyBinding Gesture="Shift+OemQuestion" Command="{Binding FocusSearchCommand}"/>
<KeyBinding Gesture="Ctrl+N" Command="{Binding FocusAddTaskCommand}"/> <KeyBinding Gesture="Ctrl+N" Command="{Binding FocusAddTaskCommand}"/>
</Window.KeyBindings> </Window.KeyBindings>
<Grid x:Name="RootGrid" RowDefinitions="36,Auto,*,22"> <Grid x:Name="RootGrid" RowDefinitions="36,*,22">
<!-- Custom title bar --> <!-- Custom title bar -->
<Border Grid.Row="0" <Border Grid.Row="0"
Background="{DynamicResource DeepBrush}" Background="{DynamicResource DeepBrush}"
@@ -107,45 +107,8 @@
</Grid> </Grid>
</Border> </Border>
<!-- Update banner -->
<Border Grid.Row="1"
Background="{DynamicResource DeepBrush}"
BorderBrush="{DynamicResource LineBrush}"
BorderThickness="0,0,0,1"
Padding="14,6"
IsVisible="{Binding IsUpdateBannerVisible}">
<Grid ColumnDefinitions="*,Auto,Auto">
<TextBlock Grid.Column="0"
Classes="body"
VerticalAlignment="Center">
<Run Text="{loc:Tr shell.update.available}"/>
<Run Text="{Binding UpdateCheck.CurrentVersion}"/>
<Run Text=" → v"/>
<Run Text="{Binding UpdateBannerLatestVersion}"/>
</TextBlock>
<Button Grid.Column="1"
Classes="btn"
Margin="0,0,8,0"
Content="{loc:Tr shell.update.updateNow}"
Command="{Binding UpdateNowCommand}"/>
<Button Grid.Column="2"
Classes="btn"
Content="{loc:Tr shell.update.dismiss}"
Command="{Binding DismissBannerCommand}"/>
</Grid>
</Border>
<!-- Inline update status (appears at right of banner row when no banner) -->
<TextBlock Grid.Row="1"
Classes="meta"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Margin="0,0,14,0"
Text="{Binding InlineUpdateStatus}"
IsVisible="{Binding InlineUpdateStatus, Converter={x:Static ObjectConverters.IsNotNull}}"/>
<!-- Background gradient layer --> <!-- Background gradient layer -->
<Border Grid.Row="2"> <Border Grid.Row="1">
<Border.Background> <Border.Background>
<RadialGradientBrush Center="50%,50%" GradientOrigin="50%,50%" RadiusX="70%" RadiusY="70%"> <RadialGradientBrush Center="50%,50%" GradientOrigin="50%,50%" RadiusX="70%" RadiusY="70%">
<GradientStop Offset="0" Color="{StaticResource DeepColor}" /> <GradientStop Offset="0" Color="{StaticResource DeepColor}" />
@@ -155,7 +118,7 @@
</Border> </Border>
<!-- Three islands (user-resizable) --> <!-- Three islands (user-resizable) -->
<Grid Grid.Row="2" Margin="7"> <Grid Grid.Row="1" Margin="7">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="260" MinWidth="200"/> <ColumnDefinition Width="260" MinWidth="200"/>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
@@ -196,7 +159,7 @@
</Grid> </Grid>
<!-- Footer: connection status --> <!-- Footer: connection status -->
<Border Grid.Row="3" <Border Grid.Row="2"
Background="{DynamicResource DeepBrush}" Background="{DynamicResource DeepBrush}"
BorderBrush="{DynamicResource LineBrush}" BorderBrush="{DynamicResource LineBrush}"
BorderThickness="0,1,0,0"> BorderThickness="0,1,0,0">
@@ -255,5 +218,35 @@
<Panel/> <Panel/>
</DockPanel> </DockPanel>
</Border> </Border>
<!-- Update popup card — bottom-right corner, only when update available -->
<Border Grid.Row="0" Grid.RowSpan="3"
VerticalAlignment="Bottom" HorizontalAlignment="Right"
Margin="0,0,16,30"
ZIndex="100"
IsVisible="{Binding IsUpdateBannerVisible}"
Background="{DynamicResource DeepBrush}"
BorderBrush="{DynamicResource LineBrush}"
BorderThickness="1"
CornerRadius="6"
Padding="14,10">
<StackPanel Spacing="8" Width="260">
<TextBlock Classes="body">
<Run Text="{loc:Tr shell.update.available}"/>
<Run Text=" v"/>
<Run Text="{Binding UpdateCheck.CurrentVersion}"/>
<Run Text=" → v"/>
<Run Text="{Binding UpdateBannerLatestVersion}"/>
</TextBlock>
<StackPanel Orientation="Horizontal" Spacing="8" HorizontalAlignment="Right">
<Button Classes="btn"
Content="{loc:Tr shell.update.dismiss}"
Command="{Binding DismissBannerCommand}"/>
<Button Classes="btn"
Content="{loc:Tr shell.update.updateNow}"
Command="{Binding UpdateNowCommand}"/>
</StackPanel>
</StackPanel>
</Border>
</Grid> </Grid>
</Window> </Window>
@@ -0,0 +1,52 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:ClaudeDo.Ui.ViewModels.MissionControl"
xmlns:views="using:ClaudeDo.Ui.Views"
xmlns:loc="using:ClaudeDo.Ui.Localization"
xmlns:conv="using:Avalonia.Data.Converters"
x:DataType="vm:ConPtyPaneViewModel"
x:Class="ClaudeDo.Ui.Views.MissionControl.ConPtyPaneView">
<Border Classes="monitor-pane" BorderThickness="1" CornerRadius="10" ClipToBounds="True">
<DockPanel LastChildFill="True">
<!-- Header: title + close -->
<Border DockPanel.Dock="Top"
Background="{DynamicResource Surface2Brush}"
BorderBrush="{DynamicResource LineBrush}"
BorderThickness="0,0,0,1" Padding="8,3">
<Grid ColumnDefinitions="*,Auto,Auto">
<TextBlock Grid.Column="0" Classes="meta" Text="{Binding DisplayTitle}"
TextTrimming="CharacterEllipsis"
ToolTip.Tip="{Binding DisplayTitle}"
Foreground="{DynamicResource TextDimBrush}"
VerticalAlignment="Center" Margin="4,0,0,0" />
<Button Grid.Column="1" Classes="btn" Margin="0,0,6,0"
IsVisible="{Binding IsTaskBased}"
Content="{loc:Tr missionControl.submitForReview}"
ToolTip.Tip="{loc:Tr missionControl.submitForReviewTip}"
Command="{Binding SubmitForReviewCommand}" />
<Button Grid.Column="2" Classes="title-ctrl"
Command="{Binding CloseCommand}"
ToolTip.Tip="{loc:Tr missionControl.closeSession}">
<PathIcon Data="{StaticResource Icon.WinClose}" Width="12" Height="12"/>
</Button>
</Grid>
</Border>
<!-- Start-failure banner -->
<Border DockPanel.Dock="Top"
IsVisible="{Binding Terminal.StartError, Converter={x:Static conv:ObjectConverters.IsNotNull}}"
Background="{DynamicResource ErrorTintBrush}"
BorderBrush="{DynamicResource BloodBrush}"
BorderThickness="0,0,0,1" Padding="12,6">
<TextBlock Classes="meta" Text="{Binding Terminal.StartError}"
Foreground="{DynamicResource BloodBrush}"
TextWrapping="Wrap" />
</Border>
<!-- Embedded ConPTY terminal -->
<views:InteractiveTerminalView DataContext="{Binding Terminal}" />
</DockPanel>
</Border>
</UserControl>
@@ -0,0 +1,8 @@
using Avalonia.Controls;
namespace ClaudeDo.Ui.Views.MissionControl;
public partial class ConPtyPaneView : UserControl
{
public ConPtyPaneView() => InitializeComponent();
}
@@ -2,10 +2,21 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:ClaudeDo.Ui.ViewModels" xmlns:vm="using:ClaudeDo.Ui.ViewModels"
xmlns:vmi="using:ClaudeDo.Ui.ViewModels.Islands" xmlns:vmi="using:ClaudeDo.Ui.ViewModels.Islands"
xmlns:vmm="using:ClaudeDo.Ui.ViewModels.MissionControl"
xmlns:mc="using:ClaudeDo.Ui.Views.MissionControl" xmlns:mc="using:ClaudeDo.Ui.Views.MissionControl"
xmlns:loc="using:ClaudeDo.Ui.Localization" xmlns:loc="using:ClaudeDo.Ui.Localization"
x:DataType="vm:MissionControlViewModel" x:DataType="vm:MissionControlViewModel"
x:Class="ClaudeDo.Ui.Views.MissionControl.MissionControlView"> x:Class="ClaudeDo.Ui.Views.MissionControl.MissionControlView">
<UserControl.DataTemplates>
<!-- Polymorphic pane templates: both the grid ItemsControl and the focus-mode TabControl
resolve per-item content through these (no explicit ItemTemplate on either). -->
<DataTemplate DataType="vmi:TaskMonitorViewModel">
<mc:MonitorPaneView Margin="6" />
</DataTemplate>
<DataTemplate DataType="vmm:ConPtyPaneViewModel">
<mc:ConPtyPaneView Margin="6" />
</DataTemplate>
</UserControl.DataTemplates>
<DockPanel LastChildFill="True" Background="{DynamicResource VoidBrush}" <DockPanel LastChildFill="True" Background="{DynamicResource VoidBrush}"
DragDrop.AllowDrop="True"> DragDrop.AllowDrop="True">
@@ -21,6 +32,18 @@
LetterSpacing="1.4" VerticalAlignment="Center" /> LetterSpacing="1.4" VerticalAlignment="Center" />
<StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="8" <StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="8"
VerticalAlignment="Center"> VerticalAlignment="Center">
<Button Classes="icon-btn"
Click="OnNewSessionClicked"
ToolTip.Tip="{loc:Tr missionControl.newSession}">
<PathIcon Data="{StaticResource Icon.Plus}" Width="15" Height="15"
Foreground="{DynamicResource TextMuteBrush}"/>
</Button>
<Button Classes="icon-btn"
Command="{Binding ToggleLayoutCommand}"
ToolTip.Tip="{Binding LayoutToggleLabel}">
<PathIcon Data="{StaticResource Icon.Grid}" Width="15" Height="15"
Foreground="{DynamicResource TextMuteBrush}"/>
</Button>
<Button Classes="icon-btn" <Button Classes="icon-btn"
Command="{Binding OpenSettingsCommand}" Command="{Binding OpenSettingsCommand}"
ToolTip.Tip="{loc:Tr missionControl.settings}"> ToolTip.Tip="{loc:Tr missionControl.settings}">
@@ -72,22 +95,29 @@
</DockPanel> </DockPanel>
</Border> </Border>
<!-- Grid / empty state --> <!-- Grid / tabs / empty state -->
<Panel Margin="6"> <Panel Margin="6">
<ItemsControl ItemsSource="{Binding Monitors}" IsVisible="{Binding HasMonitors}"> <!-- Overview mode: the existing UniformGrid, one tile per pane -->
<ItemsControl ItemsSource="{Binding Panes}" IsVisible="{Binding !IsFocusMode}">
<ItemsControl.ItemsPanel> <ItemsControl.ItemsPanel>
<ItemsPanelTemplate> <ItemsPanelTemplate>
<UniformGrid x:CompileBindings="False" Columns="{Binding ColumnCount}" /> <UniformGrid x:CompileBindings="False" Columns="{Binding ColumnCount}" />
</ItemsPanelTemplate> </ItemsPanelTemplate>
</ItemsControl.ItemsPanel> </ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="vmi:TaskMonitorViewModel">
<mc:MonitorPaneView Margin="6" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl> </ItemsControl>
<TextBlock IsVisible="{Binding !HasMonitors}" <!-- Focus mode: one pane large, switched via tabs -->
<TabControl ItemsSource="{Binding Panes}"
SelectedItem="{Binding FocusedPane}"
IsVisible="{Binding IsFocusMode}">
<TabControl.ItemTemplate>
<DataTemplate x:DataType="vmm:IMissionControlPane">
<TextBlock Text="{Binding DisplayTitle}" TextTrimming="CharacterEllipsis" MaxWidth="160" />
</DataTemplate>
</TabControl.ItemTemplate>
</TabControl>
<TextBlock IsVisible="{Binding !HasPanes}"
Text="{loc:Tr missionControl.empty}" Text="{loc:Tr missionControl.empty}"
Foreground="{DynamicResource TextMuteBrush}" Foreground="{DynamicResource TextMuteBrush}"
HorizontalAlignment="Center" VerticalAlignment="Center" /> HorizontalAlignment="Center" VerticalAlignment="Center" />
@@ -2,6 +2,7 @@ using System.Linq;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Input; using Avalonia.Input;
using Avalonia.Interactivity; using Avalonia.Interactivity;
using Avalonia.Platform.Storage;
using Avalonia.VisualTree; using Avalonia.VisualTree;
using ClaudeDo.Ui.ViewModels; using ClaudeDo.Ui.ViewModels;
using ClaudeDo.Ui.ViewModels.Islands; using ClaudeDo.Ui.ViewModels.Islands;
@@ -21,6 +22,23 @@ public partial class MissionControlView : UserControl
AddHandler(DragDrop.DropEvent, OnPaneDrop); AddHandler(DragDrop.DropEvent, OnPaneDrop);
} }
// Ad-hoc ConPTY session: the view owns the folder picker, the VM only takes the chosen path.
private async void OnNewSessionClicked(object? sender, RoutedEventArgs e)
{
if (DataContext is not MissionControlViewModel vm) return;
var topLevel = TopLevel.GetTopLevel(this);
if (topLevel is null) return;
var folders = await topLevel.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
{
Title = "Choose a directory",
AllowMultiple = false,
});
if (folders.Count == 0) return;
await vm.OpenAdHocConPtySessionAsync(folders[0].Path.LocalPath);
}
private void OnPaneDragOver(object? sender, DragEventArgs e) private void OnPaneDragOver(object? sender, DragEventArgs e)
{ {
var dt = e.DataTransfer; var dt = e.DataTransfer;
@@ -107,14 +107,7 @@
Label="{Binding DisplayTitle}" Label="{Binding DisplayTitle}"
IsRunning="{Binding IsRunning}" IsRunning="{Binding IsRunning}"
IsDone="{Binding IsDone}" IsDone="{Binding IsDone}"
IsFailed="{Binding IsFailed}" IsFailed="{Binding IsFailed}" />
IsComposerVisible="{Binding IsInteractiveLive}"
ComposerText="{Binding ComposerDraft, Mode=TwoWay}"
SubmitCommand="{Binding SubmitComposerCommand}"
InterruptCommand="{Binding InterruptInteractiveCommand}"
ComposerPlaceholder="{loc:Tr session.composer.placeholder}"
QueuedMessages="{Binding QueuedMessages}"
HasQueuedMessages="{Binding HasQueuedMessages}" />
</DockPanel> </DockPanel>
</Border> </Border>
@@ -131,7 +131,7 @@
FontFamily="{DynamicResource MonoFont}" FontSize="{StaticResource FontSizeEyebrow}" FontFamily="{DynamicResource MonoFont}" FontSize="{StaticResource FontSizeEyebrow}"
Foreground="{DynamicResource TextBrush}"/> Foreground="{DynamicResource TextBrush}"/>
</Border> </Border>
<TextBlock Grid.Column="1" Classes="path-mono" Text="{Binding SelectedFile.Path}" <TextBlock Grid.Column="1" Classes="path-mono" Text="{Binding SelectedFile.HeaderPath}"
VerticalAlignment="Center" TextTrimming="PrefixCharacterEllipsis"/> VerticalAlignment="Center" TextTrimming="PrefixCharacterEllipsis"/>
</Grid> </Grid>
</Border> </Border>
@@ -2,6 +2,8 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:ClaudeDo.Ui.ViewModels.Modals" xmlns:vm="using:ClaudeDo.Ui.ViewModels.Modals"
xmlns:settings="using:ClaudeDo.Ui.ViewModels.Modals.Settings" xmlns:settings="using:ClaudeDo.Ui.ViewModels.Modals.Settings"
xmlns:agent="using:ClaudeDo.Ui.ViewModels.Agent"
xmlns:services="using:ClaudeDo.Ui.Services"
xmlns:ctl="using:ClaudeDo.Ui.Views.Controls" xmlns:ctl="using:ClaudeDo.Ui.Views.Controls"
xmlns:loc="using:ClaudeDo.Ui.Localization" xmlns:loc="using:ClaudeDo.Ui.Localization"
xmlns:locm="using:ClaudeDo.Localization" xmlns:locm="using:ClaudeDo.Localization"
@@ -108,6 +110,19 @@
<ComboBoxItem Content="{loc:Tr settings.general.weekdaySaturday}"/> <ComboBoxItem Content="{loc:Tr settings.general.weekdaySaturday}"/>
</ComboBox> </ComboBox>
</StackPanel> </StackPanel>
<StackPanel Spacing="4">
<TextBlock Classes="field-label" Text="{loc:Tr settings.general.sessionSkills}"/>
<TextBlock Classes="meta" Opacity="0.6" TextWrapping="Wrap"
Text="{loc:Tr settings.general.sessionSkillsHint}"/>
<ItemsControl ItemsSource="{Binding General.SessionSkills}">
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="agent:SelectableSkillViewModel">
<CheckBox IsChecked="{Binding IsSelected, Mode=TwoWay}" Content="{Binding Name}"
ToolTip.Tip="{Binding Description}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</StackPanel> </StackPanel>
</ScrollViewer> </ScrollViewer>
</TabItem> </TabItem>
@@ -354,6 +369,61 @@
</ScrollViewer> </ScrollViewer>
</TabItem> </TabItem>
<TabItem Header="{loc:Tr settings.tabSkills}">
<ScrollViewer>
<StackPanel Spacing="12" Margin="0,8,0,0">
<StackPanel Spacing="6">
<TextBlock Classes="section-label" Text="{loc:Tr settings.skills.installSection}"/>
<Grid ColumnDefinitions="*,Auto" ColumnSpacing="8">
<TextBox Grid.Column="0" Text="{Binding SessionSkills.InstallUrl, Mode=TwoWay}"
PlaceholderText="{loc:Tr settings.skills.installUrlPlaceholder}"/>
<Button Grid.Column="1" Classes="btn" Content="{loc:Tr settings.skills.installButton}"
Command="{Binding SessionSkills.InstallCommand}"
IsEnabled="{Binding !SessionSkills.IsBusy}"/>
</Grid>
</StackPanel>
<Border BorderBrush="{DynamicResource LineBrush}" BorderThickness="0,1,0,0" Margin="0,2,0,0"/>
<StackPanel Spacing="6">
<TextBlock Classes="section-label" Text="{loc:Tr settings.skills.installedSection}"/>
<ItemsControl ItemsSource="{Binding SessionSkills.Skills}">
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="services:SessionSkillDto">
<Border BorderBrush="{DynamicResource LineBrush}" BorderThickness="1"
CornerRadius="6" Padding="10,8" Margin="0,0,0,8"
Background="{DynamicResource DeepBrush}">
<StackPanel Spacing="4">
<Grid ColumnDefinitions="*,Auto,Auto">
<TextBlock Grid.Column="0" Classes="title" Text="{Binding Name}"/>
<Button Grid.Column="1" Classes="btn" Content="{loc:Tr settings.skills.updateButton}"
Margin="0,0,6,0"
Command="{Binding $parent[ItemsControl].((vm:SettingsModalViewModel)DataContext).SessionSkills.UpdateCommand}"
CommandParameter="{Binding SourceUrl}"/>
<Button Grid.Column="2" Classes="btn danger" Content="{loc:Tr settings.skills.removeButton}"
Command="{Binding $parent[ItemsControl].((vm:SettingsModalViewModel)DataContext).SessionSkills.RemoveCommand}"
CommandParameter="{Binding SourceUrl}"/>
</Grid>
<TextBlock Classes="meta" Text="{Binding Description}" TextWrapping="Wrap"
IsVisible="{Binding Description, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
<TextBlock Classes="meta" Opacity="0.6" Text="{Binding PinnedRef}"/>
<TextBlock Classes="path-mono" Text="{Binding SourceUrl}" TextTrimming="PrefixCharacterEllipsis"/>
</StackPanel>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<TextBlock Classes="meta" Opacity="0.6" TextWrapping="Wrap"
Text="{loc:Tr settings.skills.emptyState}"
IsVisible="{Binding SessionSkills.IsEmpty}"/>
</StackPanel>
<TextBlock Classes="meta" Text="{Binding SessionSkills.StatusMessage}"
IsVisible="{Binding SessionSkills.StatusMessage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
</StackPanel>
</ScrollViewer>
</TabItem>
</TabControl> </TabControl>
</DockPanel> </DockPanel>
+9 -8
View File
@@ -7,12 +7,12 @@ ASP.NET Core hosted service that executes tasks via Claude CLI in isolated envir
``` ```
Worker/ Worker/
State/ — TaskStateService + TransitionResult (sole owner of Status/PlanningPhase/BlockedBy writes) State/ — TaskStateService + TransitionResult (sole owner of Status/PlanningPhase/BlockedBy writes)
Queue/ — IQueueWaker, IQueuePicker, QueueService (BackgroundService), OverrideSlotService Queue/ — IQueueWaker, IQueuePicker, QueueService (BackgroundService), OverrideSlotService, RunCancellationRegistry (taskId → running-run CTS; lets TaskStateService.CancelAsync kill the process of a cancelled task/child without a DI cycle)
Lifecycle/ — StaleTaskRecovery, TaskResetService, TaskMergeService, ClaudeCliPreflight, OrphanRecovery, PlanningLineageRecovery, AttachmentOrphanRecovery (startup sweep: deletes any `attachments/<taskId>/` dirs whose task no longer exists) Lifecycle/ — StaleTaskRecovery, TaskResetService, TaskMergeService, ClaudeCliPreflight, OrphanRecovery, PlanningLineageRecovery, AttachmentOrphanRecovery (startup sweep: deletes any `attachments/<taskId>/` dirs whose task no longer exists)
Worktrees/ — WorktreeMaintenanceService Worktrees/ — WorktreeMaintenanceService
Agents/ — AgentFileService, DefaultAgentSeeder Agents/ — AgentFileService, DefaultAgentSeeder
Runner/ — TaskRunner + Claude CLI integration; TaskRunMcpService/TaskRunMcpContext/TaskRunTokenRegistry (in-task MCP wired during execution) Runner/ — TaskRunner + Claude CLI integration; TaskRunMcpService/TaskRunMcpContext/TaskRunTokenRegistry (in-task MCP wired during execution)
Planning/ — PlanningSessionManager, PlanningChainCoordinator, PlanningMcpService, PlanningMergeOrchestrator, PlanningAggregator, PlanningSessionContext/PlanningTokenAuth/PlanningMcpContextAccessor, WindowsTerminalLauncher (ITerminalLauncher) — wt launcher for planning + interactive sessions Planning/ — PlanningSessionManager, PlanningChainCoordinator, PlanningMcpService, PlanningMergeOrchestrator, PlanningAggregator, PlanningSessionContext/PlanningTokenAuth/PlanningMcpContextAccessor, WindowsTerminalLauncher (ITerminalLauncher) — wt launcher for planning sessions + pick-up-in-terminal
Refine/ — RefineRunner + RefinePrompt (hub `RefineTask`; broadcasts RefineStarted/RefineFinished) Refine/ — RefineRunner + RefinePrompt (hub `RefineTask`; broadcasts RefineStarted/RefineFinished)
External/ — ExternalMcpService + sibling tool classes External/ — ExternalMcpService + sibling tool classes
Config/ — WorkerConfig Config/ — WorkerConfig
@@ -20,7 +20,7 @@ Worker/
Logging/ — LogRingBuffer (30-min in-memory log window) + BroadcastLogSink (Serilog sink → footer + overlay) Logging/ — LogRingBuffer (30-min in-memory log window) + BroadcastLogSink (Serilog sink → footer + overlay)
Report/ — ClaudeHistoryReader, WeekReportPromptBuilder, WeekReportService; interfaces in Report/Interfaces/ Report/ — ClaudeHistoryReader, WeekReportPromptBuilder, WeekReportService; interfaces in Report/Interfaces/
Prime/ — daily-prep ("Prime Claude"): PrimeScheduler (BackgroundService), PrimeRunner (runs the daily prep), DailyPrepPrompt (fixed prompt + CLI args + LogPath() helper), NextDueCalculator, PrimeScheduleSignal; interfaces in Prime/Interfaces/ (IPrimeRunner, IPrimeClock, IPrimeScheduleSignal, IPrimeBroadcaster) Prime/ — daily-prep ("Prime Claude"): PrimeScheduler (BackgroundService), PrimeRunner (runs the daily prep), DailyPrepPrompt (fixed prompt + CLI args + LogPath() helper), NextDueCalculator, PrimeScheduleSignal; interfaces in Prime/Interfaces/ (IPrimeRunner, IPrimeClock, IPrimeScheduleSignal, IPrimeBroadcaster)
Online/ — optional Online Inbox sync: OnlineInboxConfig (config record), Dtos (RemoteList/RemoteTask/MirrorTask), IOnlineInboxApi, OnlineInboxApiClient (typed HttpClient, bearer auth, HTTPS guard), OnlineTokenStore (DPAPI refresh-token store, Windows-only), StaticTokenAuthProvider (default/test IOnlineAuthProvider), ZitadelAuthProvider (stub — TODO(online-inbox) Phase 2), OnlineSyncService (BackgroundService: reconcile loop), OnlineBacklog (Idle-backlog filter/query); interface in Online/Interfaces/ (IOnlineAuthProvider) Online/ — optional Online Inbox sync: OnlineInboxConfig (config record), Dtos (RemoteList/RemoteTask/MirrorTask), IOnlineInboxApi, OnlineInboxApiClient (typed HttpClient, bearer auth, HTTPS guard), OnlineTokenStore (DPAPI refresh-token store, Windows-only), StaticTokenAuthProvider (default/test IOnlineAuthProvider), ZitadelAuthProvider (OIDC discovery + refresh-token flow), OnlineSyncService (BackgroundService: reconcile loop), OnlineBacklog (Idle-backlog filter/query); interface in Online/Interfaces/ (IOnlineAuthProvider)
``` ```
Interfaces (e.g. `IQueueWaker`, `IPrimeClock`, `ITaskStateService`) live in an `Interfaces/` subfolder within their area; the namespace stays the area namespace. Interfaces (e.g. `IQueueWaker`, `IPrimeClock`, `ITaskStateService`) live in an `Interfaces/` subfolder within their area; the namespace stays the area namespace.
@@ -32,13 +32,13 @@ Interfaces (e.g. `IQueueWaker`, `IPrimeClock`, `ITaskStateService`) live in an `
- **IQueueWaker / IQueuePicker / QueueService** — waker is a singleton `SemaphoreSlim`; picker performs the atomic `Queued → Running` claim filtered by `BlockedByTaskId IS NULL` and schedule; QueueService is a thin `BackgroundService` that loops on the waker and dispatches via `TaskRunner`. - **IQueueWaker / IQueuePicker / QueueService** — waker is a singleton `SemaphoreSlim`; picker performs the atomic `Queued → Running` claim filtered by `BlockedByTaskId IS NULL` and schedule; QueueService is a thin `BackgroundService` that loops on the waker and dispatches via `TaskRunner`.
- **OverrideSlotService** — owns `RunNow` / `ContinueTask`; goes through `TaskStateService.StartRunningAsync` (caller-driven, serialized by slot lock). - **OverrideSlotService** — owns `RunNow` / `ContinueTask`; goes through `TaskStateService.StartRunningAsync` (caller-driven, serialized by slot lock).
- **StaleTaskRecovery** — startup-only service; calls `TaskStateService.RecoverStaleRunningAsync` to flip orphaned `Running` rows to `Failed`. - **StaleTaskRecovery** — startup-only service; calls `TaskStateService.RecoverStaleRunningAsync` to flip orphaned `Running` rows to `Failed`.
- **External/*** — always-on MCP tools for general Claude sessions, scoped to *starting* and *observing* sessions (no worktree/merge, multi-turn, planning, or app-settings writes). Auth via optional `X-ClaudeDo-Key` header. Registered explicitly in `Program.cs`'s external app via `.WithTools<T>()`. Organized by concern: - **External/*** — always-on MCP tools for general Claude sessions, scoped to *starting* and *observing* sessions (no worktree/merge, multi-turn, planning, or app-settings writes). Auth via optional `X-ClaudeDo-Key` header. Registered explicitly in `Program.cs`'s external app via `.WithTools<T>()`. Every optional/filter parameter across these tools must carry a C# default value (e.g. `string? status = null`) — the MCP schema only marks a parameter optional when it has one; nullability alone doesn't do it (`ExternalMcpToolSchemaTests` guards this by reflection). `ExternalMcpExceptionFilter.Wrap` is registered as a call-tool filter so `InvalidOperationException`/`ArgumentException` messages survive as `McpException` — otherwise the SDK's own catch-all replaces any non-`McpException` with a generic "An error occurred invoking 'X'." Organized by concern:
- `ExternalMcpService` — task CRUD + execution: `ListTaskLists`, `ListTasks`, `GetTask`, `AddTask`, `AddSubtask`, `UpdateTask`, `UpdateTaskStatus` (`Idle` / `Queued`), `GetTaskStatusValues`, `ReviewTask` (`approve` / `reject_rerun` / `reject_park` / `cancel` for a WaitingForReview task), `RunTaskNow`, `ContinueTask`, `CancelTask`, `DeleteTask`; worktree/git: `GetTaskWorktree`, `GetTaskDiff`, `MergeTask`, `ListWorktrees`, `CleanupTaskWorktree` - `ExternalMcpService` — task CRUD + execution: `ListTaskLists`, `ListTasks`, `GetTask`, `AddTask`, `AddSubtask`, `UpdateTask`, `UpdateTaskStatus` (`Idle` / `Queued`), `GetTaskStatusValues`, `ReviewTask` (`approve` / `reject_rerun` / `reject_park` / `cancel` for a WaitingForReview task; approve is review+merge exactly like the hub's `ApproveReview` — unit merge for parents, worktree merge into optional `targetBranch` for childless tasks, conflicts reported in the `ReviewTaskResult`), `RunTaskNow`, `ContinueTask`, `CancelTask`, `DeleteTask`; worktree/git: `GetTaskWorktree`, `GetTaskDiff`, `MergeTask`, `ListWorktrees`, `CleanupTaskWorktree`
- `BatchMcpTools` — best-effort batch variants that loop the `ExternalMcpService` single-entity methods (sequential — the scoped DbContext is not thread-safe; merge/review stay single-task): `BatchGetTasks`, `BatchAddTasks`, `BatchUpdateTaskStatus`, `BatchCancelTasks`, `BatchDeleteTasks`, `BatchSetMyDay`, `BatchCleanupTaskWorktrees`. Every tool returns a per-item result array ({ id/index, ok, error?, … }) — a failing item never aborts the rest — and rejects batches over 100 items. - `BatchMcpTools` — best-effort batch variants that loop the `ExternalMcpService` single-entity methods (sequential — the scoped DbContext is not thread-safe; merge/review stay single-task): `BatchGetTasks`, `BatchAddTasks`, `BatchUpdateTaskStatus`, `BatchCancelTasks`, `BatchDeleteTasks`, `BatchSetMyDay`, `BatchCleanupTaskWorktrees`. Every tool returns a per-item result array ({ id/index, ok, error?, … }) — a failing item never aborts the rest — and rejects batches over 100 items.
- `ListMcpTools``CreateList`, `UpdateList`, `DeleteList` - `ListMcpTools``CreateList`, `UpdateList`, `DeleteList`
- `ConfigMcpTools``GetListConfig`, `SetListConfig`, `GetTaskConfig`, `SetTaskConfig` - `ConfigMcpTools``GetListConfig`, `SetListConfig`, `GetTaskConfig`, `SetTaskConfig`
- `RunHistoryMcpTools``ListRuns`, `GetRun`, `GetTaskLog` (latest run's log, tail-capped at 256 KB) - `RunHistoryMcpTools``ListRuns`, `GetRun`, `GetTaskLog` (latest run's log, tail-capped at 256 KB)
- `AgentMcpTools``ListAgents` (class lives in `LifecycleMcpTools.cs`) - `AgentMcpTools``ListAgents`
- `LifecycleMcpTools``ResetFailedTask` - `LifecycleMcpTools``ResetFailedTask`
- `AppSettingsMcpTools``GetAppSettings` (read-only) - `AppSettingsMcpTools``GetAppSettings` (read-only)
- `AttachmentMcpTools``AddTaskAttachment(taskId, fileName, textContent?|base64Content?)`, `ListTaskAttachments`, `RemoveTaskAttachment`. Re-attaching the same fileName overwrites; add/remove refuse on a Running task. - `AttachmentMcpTools``AddTaskAttachment(taskId, fileName, textContent?|base64Content?)`, `ListTaskAttachments`, `RemoveTaskAttachment`. Re-attaching the same fileName overwrites; add/remove refuse on a Running task.
@@ -154,7 +154,8 @@ Each CLI invocation is recorded in the `task_runs` table via `TaskRunRepository`
- Execution: `Ping`, `GetActive`, `RunNow`, `CancelTask`, `WakeQueue`, `ContinueTask`, `ResetTask`, `SetTaskStatus`, `RefineTask` - Execution: `Ping`, `GetActive`, `RunNow`, `CancelTask`, `WakeQueue`, `ContinueTask`, `ResetTask`, `SetTaskStatus`, `RefineTask`
- Review/merge: `ApproveReview(taskId, targetBranch) -> MergeResultDto` (childless task: merges its worktree then Done, conflict stays WaitingForReview; task with children: drives `PlanningMergeOrchestrator` to merge the whole unit), `ContinuePlanningMerge` / `AbortPlanningMerge` (resolve a unit-merge conflict), `PreviewMerge(taskId, targetBranch) -> MergePreviewDto` (non-destructive mergeability check), `RejectReviewToQueue`, `RejectReviewToIdle`, `CancelReview`, `MergeTask`, `GetMergeTargets` - Review/merge: `ApproveReview(taskId, targetBranch) -> MergeResultDto` (childless task: merges its worktree then Done, conflict stays WaitingForReview; task with children: drives `PlanningMergeOrchestrator` to merge the whole unit), `ContinuePlanningMerge` / `AbortPlanningMerge` (resolve a unit-merge conflict), `PreviewMerge(taskId, targetBranch) -> MergePreviewDto` (non-destructive mergeability check), `RejectReviewToQueue`, `RejectReviewToIdle`, `CancelReview`, `MergeTask`, `GetMergeTargets`
- Single-task conflict resolver (Layer C): `StartConflictMerge`, `GetMergeConflictDocuments` (segments), `WriteConflictResolution`, `ContinueConflictMerge`, `AbortConflictMerge` (service-level `TaskMergeService.ContinueMergeAsync`/`AbortMergeAsync` keep their names) - Single-task conflict resolver (Layer C): `StartConflictMerge`, `GetMergeConflictDocuments` (segments), `WriteConflictResolution`, `ContinueConflictMerge`, `AbortConflictMerge` (service-level `TaskMergeService.ContinueMergeAsync`/`AbortMergeAsync` keep their names)
- Planning sessions: `StartPlanningSession`, `ResumePlanningSession`, `DiscardPlanningSession`, `FinalizePlanningSession`, `QueuePlanningSubtasks`, `GetPendingDraftCount`, `OpenInteractiveTerminal`, `GetPlanningAggregate` (per-subtask diffs), `BuildPlanningIntegrationBranch` (combined diff) - Planning sessions: `StartPlanningSession`, `ResumePlanningSession`, `DiscardPlanningSession`, `FinalizePlanningSession`, `QueuePlanningSubtasks`, `GetPendingDraftCount`, `GetPlanningAggregate` (per-subtask diffs), `BuildPlanningIntegrationBranch` (combined diff)
- Interactive sessions (embedded ConPTY, UI process): `ResumeTaskInTerminal` (pick-up-in-terminal), `GetInteractiveLaunchSpec`, `GetAdHocLaunchSpec`
- Worktrees: `CleanupFinishedWorktrees`, `ResetAllWorktrees`, `GetWorktreesOverview`, `SetWorktreeState`, `ForceRemoveWorktree` - Worktrees: `CleanupFinishedWorktrees`, `ResetAllWorktrees`, `GetWorktreesOverview`, `SetWorktreeState`, `ForceRemoveWorktree`
- Agents/settings/lists: `GetAgents`, `RefreshAgents`, `RestoreDefaultAgents`, `GetAppSettings`, `UpdateAppSettings`, `UpdateList`, `UpdateListConfig`, `GetListConfig`, `UpdateTaskAgentSettings` - Agents/settings/lists: `GetAgents`, `RefreshAgents`, `RestoreDefaultAgents`, `GetAppSettings`, `UpdateAppSettings`, `UpdateList`, `UpdateListConfig`, `GetListConfig`, `UpdateTaskAgentSettings`
- Reports/notes/prep: `GetWeekReport`, `GenerateWeekReport`, `GetDailyNotes`, `AddDailyNote`, `UpdateDailyNote`, `DeleteDailyNote`, `RunDailyPrepNow`, `ClearMyDay`, `GetLastPrepLog`, `ListPrimeSchedules`, `UpsertPrimeSchedule`, `DeletePrimeSchedule` - Reports/notes/prep: `GetWeekReport`, `GenerateWeekReport`, `GetDailyNotes`, `AddDailyNote`, `UpdateDailyNote`, `DeleteDailyNote`, `RunDailyPrepNow`, `ClearMyDay`, `GetLastPrepLog`, `ListPrimeSchedules`, `UpsertPrimeSchedule`, `DeletePrimeSchedule`
@@ -176,7 +177,7 @@ Loaded from `~/.todo-app/worker.config.json`:
- `enabled` (bool, default false) — when false the entire `Online/` stack is not registered - `enabled` (bool, default false) — when false the entire `Online/` stack is not registered
- `api_base_url` (string) — must be HTTPS or loopback; validated at startup when enabled - `api_base_url` (string) — must be HTTPS or loopback; validated at startup when enabled
- `poll_interval_seconds` (int, default 60) - `poll_interval_seconds` (int, default 60)
- `zitadel.authority`, `zitadel.client_id`, `zitadel.scopes` (Phase 2; not used until ZitadelAuthProvider is wired) - `zitadel.authority`, `zitadel.client_id`, `zitadel.scopes` — used by `ZitadelAuthProvider` (OIDC discovery + refresh-token flow)
- The refresh token is NOT in this file — stored encrypted via DPAPI at `~/.todo-app/online-inbox.token` - The refresh token is NOT in this file — stored encrypted via DPAPI at `~/.todo-app/online-inbox.token`
Per-list config (`list_config` in DB) provides defaults for `model`, `system_prompt`, `agent_path`; tasks can override each individually. Task-generating MCP tools (`AddTask`, planning `CreateChildTask`, `SuggestImprovement`) accept an optional `model` (alias-validated via `ModelRegistry.NormalizeAlias` — `haiku`/`sonnet`/`opus`, blank = inherit) so Claude assigns the cheapest capable model at creation time; the planning/system/improvement prompts instruct it to do so (`ModelRegistry.ByCostAscending` = the cost order). Per-list config (`list_config` in DB) provides defaults for `model`, `system_prompt`, `agent_path`; tasks can override each individually. Task-generating MCP tools (`AddTask`, planning `CreateChildTask`, `SuggestImprovement`) accept an optional `model` (alias-validated via `ModelRegistry.NormalizeAlias` — `haiku`/`sonnet`/`opus`, blank = inherit) so Claude assigns the cheapest capable model at creation time; the planning/system/improvement prompts instruct it to do so (`ModelRegistry.ByCostAscending` = the cost order).
@@ -41,10 +41,6 @@ public sealed class WorkerConfig
[JsonPropertyName("external_mcp_api_key")] [JsonPropertyName("external_mcp_api_key")]
public string? ExternalMcpApiKey { get; set; } public string? ExternalMcpApiKey { get; set; }
/// <summary>Interactive/streaming sessions idle longer than this are stopped by IdleSessionReaper. 0 disables reaping.</summary>
[JsonPropertyName("interactive_idle_timeout_minutes")]
public int InteractiveIdleTimeoutMinutes { get; set; } = 30;
[JsonPropertyName("online_inbox")] [JsonPropertyName("online_inbox")]
public OnlineInboxConfig OnlineInbox { get; set; } = new(); public OnlineInboxConfig OnlineInbox { get; set; } = new();
+18
View File
@@ -0,0 +1,18 @@
using System.ComponentModel;
using ClaudeDo.Data.Models;
using ClaudeDo.Worker.Agents;
using ModelContextProtocol.Server;
namespace ClaudeDo.Worker.External;
[McpServerToolType]
public sealed class AgentMcpTools
{
private readonly AgentFileService _agents;
public AgentMcpTools(AgentFileService agents) => _agents = agents;
[McpServerTool, Description("List available agent definition files (name, description, path) for use as a task's agent path.")]
public async Task<IReadOnlyList<AgentInfo>> ListAgents(CancellationToken cancellationToken)
=> await _agents.ScanAsync(cancellationToken);
}
+5 -3
View File
@@ -31,7 +31,8 @@ public sealed class ConfigMcpTools
[McpServerTool, Description("Set a list's default model/system prompt/agent path/max turns. Passing all four as null clears the list config.")] [McpServerTool, Description("Set a list's default model/system prompt/agent path/max turns. Passing all four as null clears the list config.")]
public async Task SetListConfig( public async Task SetListConfig(
string listId, string? model, string? systemPrompt, string? agentPath, int? maxTurns, CancellationToken cancellationToken) string listId, string? model = null, string? systemPrompt = null, string? agentPath = null,
int? maxTurns = null, CancellationToken cancellationToken = default)
{ {
_ = await _lists.GetByIdAsync(listId, cancellationToken) _ = await _lists.GetByIdAsync(listId, cancellationToken)
?? throw new InvalidOperationException($"List {listId} not found."); ?? throw new InvalidOperationException($"List {listId} not found.");
@@ -53,12 +54,13 @@ public sealed class ConfigMcpTools
[McpServerTool, Description("Set per-task config overrides (model/system prompt/agent path/max turns). Pass null for any field to clear that override.")] [McpServerTool, Description("Set per-task config overrides (model/system prompt/agent path/max turns). Pass null for any field to clear that override.")]
public async Task SetTaskConfig( public async Task SetTaskConfig(
string taskId, string? model, string? systemPrompt, string? agentPath, int? maxTurns, CancellationToken cancellationToken) string taskId, string? model = null, string? systemPrompt = null, string? agentPath = null,
int? maxTurns = null, CancellationToken cancellationToken = default)
{ {
_ = await _tasks.GetByIdAsync(taskId, cancellationToken) _ = await _tasks.GetByIdAsync(taskId, cancellationToken)
?? throw new InvalidOperationException($"Task {taskId} not found."); ?? throw new InvalidOperationException($"Task {taskId} not found.");
await _tasks.UpdateAgentSettingsAsync(taskId, model.NullIfBlank(), systemPrompt.NullIfBlank(), agentPath.NullIfBlank(), maxTurns, cancellationToken); await _tasks.UpdateAgentSettingsAsync(taskId, model.NullIfBlank(), systemPrompt.NullIfBlank(), agentPath.NullIfBlank(), maxTurns, ct: cancellationToken);
await _broadcaster.TaskUpdated(taskId); await _broadcaster.TaskUpdated(taskId);
} }
@@ -0,0 +1,32 @@
using ModelContextProtocol;
using ModelContextProtocol.Protocol;
using ModelContextProtocol.Server;
namespace ClaudeDo.Worker.External;
/// <summary>
/// The MCP SDK's own call-tool catch-all only preserves ex.Message for <see cref="McpException"/> —
/// any other exception type is replaced with a generic "An error occurred invoking 'X'." with no detail.
/// This filter translates the expected validation exceptions thrown across the External/ tool classes
/// (task/list not found, bad status, unknown model, etc.) into McpException so callers see why a call failed.
/// </summary>
public static class ExternalMcpExceptionFilter
{
public static McpRequestHandler<CallToolRequestParams, CallToolResult> Wrap(
McpRequestHandler<CallToolRequestParams, CallToolResult> next) =>
async (request, cancellationToken) =>
{
try
{
return await next(request, cancellationToken);
}
catch (InvalidOperationException ex)
{
throw new McpException(ex.Message, ex);
}
catch (ArgumentException ex)
{
throw new McpException(ex.Message, ex);
}
};
}
+65 -18
View File
@@ -6,6 +6,7 @@ using ClaudeDo.Data.Models;
using ClaudeDo.Data.Repositories; using ClaudeDo.Data.Repositories;
using ClaudeDo.Worker.Hub; using ClaudeDo.Worker.Hub;
using ClaudeDo.Worker.Lifecycle; using ClaudeDo.Worker.Lifecycle;
using ClaudeDo.Worker.Planning;
using ClaudeDo.Worker.Queue; using ClaudeDo.Worker.Queue;
using ClaudeDo.Worker.State; using ClaudeDo.Worker.State;
using ClaudeDo.Worker.Worktrees; using ClaudeDo.Worker.Worktrees;
@@ -18,6 +19,7 @@ namespace ClaudeDo.Worker.External;
public sealed record TaskListDto(string Id, string Name, string? WorkingDir); public sealed record TaskListDto(string Id, string Name, string? WorkingDir);
public sealed record DeleteTaskResult(bool Deleted, string Id); public sealed record DeleteTaskResult(bool Deleted, string Id);
public sealed record CancelTaskResult(bool Cancelled, string Id); public sealed record CancelTaskResult(bool Cancelled, string Id);
public sealed record ReviewTaskResult(TaskDto Task, string? MergeStatus, IReadOnlyList<string> MergeConflicts, string? MergeMessage);
public sealed record StatusValueDto(string Status, string Meaning); public sealed record StatusValueDto(string Status, string Meaning);
public sealed record TaskDto( public sealed record TaskDto(
@@ -72,6 +74,7 @@ public sealed class ExternalMcpService
private readonly IDbContextFactory<ClaudeDoDbContext> _dbFactory; private readonly IDbContextFactory<ClaudeDoDbContext> _dbFactory;
private readonly WorktreeMaintenanceService _maintenance; private readonly WorktreeMaintenanceService _maintenance;
private readonly TaskMergeService _merge; private readonly TaskMergeService _merge;
private readonly PlanningMergeOrchestrator _planningMerge;
public ExternalMcpService( public ExternalMcpService(
TaskRepository tasks, TaskRepository tasks,
@@ -82,7 +85,8 @@ public sealed class ExternalMcpService
GitService git, GitService git,
IDbContextFactory<ClaudeDoDbContext> dbFactory, IDbContextFactory<ClaudeDoDbContext> dbFactory,
WorktreeMaintenanceService maintenance, WorktreeMaintenanceService maintenance,
TaskMergeService merge) TaskMergeService merge,
PlanningMergeOrchestrator planningMerge)
{ {
_tasks = tasks; _tasks = tasks;
_lists = lists; _lists = lists;
@@ -93,6 +97,7 @@ public sealed class ExternalMcpService
_dbFactory = dbFactory; _dbFactory = dbFactory;
_maintenance = maintenance; _maintenance = maintenance;
_merge = merge; _merge = merge;
_planningMerge = planningMerge;
} }
[McpServerTool, Description("List all task lists available in ClaudeDo.")] [McpServerTool, Description("List all task lists available in ClaudeDo.")]
@@ -107,9 +112,9 @@ public sealed class ExternalMcpService
"Valid status values: Idle, Queued, Running, WaitingForReview, WaitingForChildren, Done, Failed, Cancelled.")] "Valid status values: Idle, Queued, Running, WaitingForReview, WaitingForChildren, Done, Failed, Cancelled.")]
public async Task<IReadOnlyList<TaskDto>> ListTasks( public async Task<IReadOnlyList<TaskDto>> ListTasks(
string listId, string listId,
string? createdBy, string? createdBy = null,
string? status, string? status = null,
CancellationToken cancellationToken) CancellationToken cancellationToken = default)
{ {
TaskStatus? statusFilter = null; TaskStatus? statusFilter = null;
if (!string.IsNullOrWhiteSpace(status)) if (!string.IsNullOrWhiteSpace(status))
@@ -193,10 +198,10 @@ public sealed class ExternalMcpService
[McpServerTool, Description("Update an existing task's title, description, and/or commit type. Pass null to leave a field unchanged. Refuses if the task is currently Running.")] [McpServerTool, Description("Update an existing task's title, description, and/or commit type. Pass null to leave a field unchanged. Refuses if the task is currently Running.")]
public async Task<TaskDto> UpdateTask( public async Task<TaskDto> UpdateTask(
string taskId, string taskId,
string? title, string? title = null,
string? description, string? description = null,
string? commitType, string? commitType = null,
CancellationToken cancellationToken) CancellationToken cancellationToken = default)
{ {
var task = await _tasks.GetByIdAsync(taskId, cancellationToken) var task = await _tasks.GetByIdAsync(taskId, cancellationToken)
?? throw new InvalidOperationException($"Task {taskId} not found."); ?? throw new InvalidOperationException($"Task {taskId} not found.");
@@ -219,8 +224,8 @@ public sealed class ExternalMcpService
public async Task<TaskDto> AddSubtask( public async Task<TaskDto> AddSubtask(
string taskId, string taskId,
string title, string title,
int? orderNum, int? orderNum = null,
CancellationToken cancellationToken) CancellationToken cancellationToken = default)
{ {
if (string.IsNullOrWhiteSpace(title)) if (string.IsNullOrWhiteSpace(title))
throw new InvalidOperationException("title is required."); throw new InvalidOperationException("title is required.");
@@ -292,23 +297,60 @@ public sealed class ExternalMcpService
[McpServerTool, Description( [McpServerTool, Description(
"Review a task that is WaitingForReview. " + "Review a task that is WaitingForReview. " +
"decision='approve' → Done. " + "decision='approve' → review+merge, exactly like the UI's Approve: a childless task merges its worktree into " +
"targetBranch (default: the repo's current branch) then goes Done; a task with children drives the unit merge " +
"(parent worktree if active + each Done child in order); a task without an active worktree approves straight to Done. " +
"mergeStatus 'conflict' means the merge stopped on conflicts (files listed) — resolve them in the ClaudeDo UI. " +
"decision='reject_rerun' → Queued and re-runs, resuming the agent's session with your feedback as the next turn (feedback is required). " + "decision='reject_rerun' → Queued and re-runs, resuming the agent's session with your feedback as the next turn (feedback is required). " +
"decision='reject_park' → Idle for manual editing (feedback ignored). " + "decision='reject_park' → Idle for manual editing (feedback ignored). " +
"decision='cancel' → Cancelled. " + "decision='cancel' → Cancelled. " +
"Fails if the task is not currently WaitingForReview (except cancel, which also works while Running/Queued).")] "Fails if the task is not currently WaitingForReview (except cancel, which also works while Running/Queued).")]
public async Task<TaskDto> ReviewTask( public async Task<ReviewTaskResult> ReviewTask(
string taskId, string taskId,
string decision, string decision,
string? feedback, string? feedback = null,
CancellationToken cancellationToken) string? targetBranch = null,
CancellationToken cancellationToken = default)
{ {
_ = await _tasks.GetByIdAsync(taskId, cancellationToken) _ = await _tasks.GetByIdAsync(taskId, cancellationToken)
?? throw new InvalidOperationException($"Task {taskId} not found."); ?? throw new InvalidOperationException($"Task {taskId} not found.");
string? mergeStatus = null;
IReadOnlyList<string> mergeConflicts = Array.Empty<string>();
string? mergeMessage = null;
if (decision.Trim().ToLowerInvariant() == "approve")
{
// Approve is the single review+merge action — mirror the hub's ApproveReview
// routing instead of only flipping the status (which left branches unmerged).
bool hasChildren;
await using (var ctx = await _dbFactory.CreateDbContextAsync(cancellationToken))
hasChildren = await ctx.Tasks.AnyAsync(t => t.ParentTaskId == taskId, cancellationToken);
if (hasChildren)
{
await _planningMerge.StartAsync(taskId, targetBranch ?? "", cancellationToken);
var parentDone = (await _tasks.GetByIdAsync(taskId, cancellationToken))!.Status == TaskStatus.Done;
mergeStatus = parentDone ? TaskMergeService.StatusMerged : TaskMergeService.StatusConflict;
if (!parentDone)
mergeMessage = "unit merge paused on a conflict — resolve and continue it in the ClaudeDo UI";
}
else
{
var r = await _merge.ApproveAndMergeAsync(taskId, targetBranch ?? "", cancellationToken);
if (r.Status == TaskMergeService.StatusBlocked)
throw new InvalidOperationException(r.ErrorMessage ?? "approve failed");
mergeStatus = r.Status;
mergeConflicts = r.ConflictFiles;
mergeMessage = r.Status == TaskMergeService.StatusConflict
? "merge conflict — the task stays WaitingForReview; resolve it in the ClaudeDo UI"
: r.ErrorMessage;
}
}
else
{
TransitionResult result = decision.Trim().ToLowerInvariant() switch TransitionResult result = decision.Trim().ToLowerInvariant() switch
{ {
"approve" => await _state.ApproveReviewAsync(taskId, cancellationToken),
"reject_rerun" => await _state.RejectToQueueAsync(taskId, feedback ?? "", cancellationToken), "reject_rerun" => await _state.RejectToQueueAsync(taskId, feedback ?? "", cancellationToken),
"reject_park" => await _state.RejectToIdleAsync(taskId, cancellationToken), "reject_park" => await _state.RejectToIdleAsync(taskId, cancellationToken),
"cancel" => await _state.CancelAsync(taskId, DateTime.UtcNow, cancellationToken), "cancel" => await _state.CancelAsync(taskId, DateTime.UtcNow, cancellationToken),
@@ -318,8 +360,11 @@ public sealed class ExternalMcpService
if (!result.Ok) if (!result.Ok)
throw new InvalidOperationException(result.Reason ?? "Review action failed."); throw new InvalidOperationException(result.Reason ?? "Review action failed.");
}
return ToDto((await _tasks.GetByIdAsync(taskId, cancellationToken))!); return new ReviewTaskResult(
ToDto((await _tasks.GetByIdAsync(taskId, cancellationToken))!),
mergeStatus, mergeConflicts, mergeMessage);
} }
[McpServerTool, Description("Immediately run a task in the override execution slot (bypasses the agent queue).")] [McpServerTool, Description("Immediately run a task in the override execution slot (bypasses the agent queue).")]
@@ -357,6 +402,8 @@ public sealed class ExternalMcpService
throw new InvalidOperationException("Cannot delete a running task. Cancel it first."); throw new InvalidOperationException("Cannot delete a running task. Cancel it first.");
await _tasks.DeleteAsync(taskId, cancellationToken); await _tasks.DeleteAsync(taskId, cancellationToken);
if (task.ParentTaskId is not null)
await _state.TryAdvanceParentAsync(task.ParentTaskId);
await _broadcaster.TaskUpdated(taskId); await _broadcaster.TaskUpdated(taskId);
return new DeleteTaskResult(true, taskId); return new DeleteTaskResult(true, taskId);
} }
@@ -617,8 +664,8 @@ public sealed class ExternalMcpService
public async Task<TaskDto> SetMyDay( public async Task<TaskDto> SetMyDay(
string taskId, string taskId,
bool isMyDay, bool isMyDay,
int? sortOrder, int? sortOrder = null,
CancellationToken cancellationToken) CancellationToken cancellationToken = default)
{ {
await using var ctx = await _dbFactory.CreateDbContextAsync(cancellationToken); await using var ctx = await _dbFactory.CreateDbContextAsync(cancellationToken);
-14
View File
@@ -1,25 +1,11 @@
using System.ComponentModel; using System.ComponentModel;
using ClaudeDo.Data.Models;
using ClaudeDo.Data.Repositories; using ClaudeDo.Data.Repositories;
using ClaudeDo.Worker.Agents;
using ClaudeDo.Worker.Lifecycle; using ClaudeDo.Worker.Lifecycle;
using ModelContextProtocol.Server; using ModelContextProtocol.Server;
using TaskStatus = ClaudeDo.Data.Models.TaskStatus; using TaskStatus = ClaudeDo.Data.Models.TaskStatus;
namespace ClaudeDo.Worker.External; namespace ClaudeDo.Worker.External;
[McpServerToolType]
public sealed class AgentMcpTools
{
private readonly AgentFileService _agents;
public AgentMcpTools(AgentFileService agents) => _agents = agents;
[McpServerTool, Description("List available agent definition files (name, description, path) for use as a task's agent path.")]
public async Task<IReadOnlyList<AgentInfo>> ListAgents(CancellationToken cancellationToken)
=> await _agents.ScanAsync(cancellationToken);
}
[McpServerToolType] [McpServerToolType]
public sealed class LifecycleMcpTools public sealed class LifecycleMcpTools
{ {
+3 -2
View File
@@ -22,7 +22,7 @@ public sealed class ListMcpTools
[McpServerTool, Description("Create a new task list. workingDir sets the git repo tasks run against; commitType defaults to 'chore'.")] [McpServerTool, Description("Create a new task list. workingDir sets the git repo tasks run against; commitType defaults to 'chore'.")]
public async Task<ListSummaryDto> CreateList( public async Task<ListSummaryDto> CreateList(
string name, string? workingDir, string? commitType, CancellationToken cancellationToken) string name, string? workingDir = null, string? commitType = null, CancellationToken cancellationToken = default)
{ {
if (string.IsNullOrWhiteSpace(name)) if (string.IsNullOrWhiteSpace(name))
throw new InvalidOperationException("name is required."); throw new InvalidOperationException("name is required.");
@@ -42,7 +42,8 @@ public sealed class ListMcpTools
[McpServerTool, Description("Rename a list and/or change its working dir and default commit type. Pass null to leave a field unchanged.")] [McpServerTool, Description("Rename a list and/or change its working dir and default commit type. Pass null to leave a field unchanged.")]
public async Task<ListSummaryDto> UpdateList( public async Task<ListSummaryDto> UpdateList(
string listId, string? name, string? workingDir, string? commitType, CancellationToken cancellationToken) string listId, string? name = null, string? workingDir = null, string? commitType = null,
CancellationToken cancellationToken = default)
{ {
var entity = await _lists.GetByIdAsync(listId, cancellationToken) var entity = await _lists.GetByIdAsync(listId, cancellationToken)
?? throw new InvalidOperationException($"List {listId} not found."); ?? throw new InvalidOperationException($"List {listId} not found.");
-12
View File
@@ -77,16 +77,4 @@ public sealed class HubBroadcaster : IPrimeBroadcaster, IRefineBroadcaster
Task IRefineBroadcaster.RefineStartedAsync(string taskId) => RefineStarted(taskId); Task IRefineBroadcaster.RefineStartedAsync(string taskId) => RefineStarted(taskId);
Task IRefineBroadcaster.RefineFinishedAsync(string taskId, bool success, string? error) => Task IRefineBroadcaster.RefineFinishedAsync(string taskId, bool success, string? error) =>
RefineFinished(taskId, success, error); RefineFinished(taskId, success, error);
public Task InteractiveSessionStarted(string taskId) =>
_hub.Clients.All.SendAsync("InteractiveSessionStarted", taskId);
public Task InteractiveSessionEnded(string taskId) =>
_hub.Clients.All.SendAsync("InteractiveSessionEnded", taskId);
public Task InteractiveQueueChanged(string taskId, IReadOnlyList<string> pending) =>
_hub.Clients.All.SendAsync("InteractiveQueueChanged", taskId, pending);
public Task InteractiveMessageSent(string taskId, string text) =>
_hub.Clients.All.SendAsync("InteractiveMessageSent", taskId, text);
} }
+177 -22
View File
@@ -15,8 +15,10 @@ using ClaudeDo.Worker.Queue;
using ClaudeDo.Worker.Refine; using ClaudeDo.Worker.Refine;
using ClaudeDo.Worker.Report; using ClaudeDo.Worker.Report;
using ClaudeDo.Worker.Report.Interfaces; using ClaudeDo.Worker.Report.Interfaces;
using ClaudeDo.Worker.Skills;
using ClaudeDo.Worker.State; using ClaudeDo.Worker.State;
using ClaudeDo.Worker.Worktrees; using ClaudeDo.Worker.Worktrees;
using System.Text.Json;
using TaskStatus = ClaudeDo.Data.Models.TaskStatus; using TaskStatus = ClaudeDo.Data.Models.TaskStatus;
using Microsoft.AspNetCore.SignalR; using Microsoft.AspNetCore.SignalR;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
@@ -37,7 +39,15 @@ public record AppSettingsDto(
int WorktreeAutoCleanupDays, int WorktreeAutoCleanupDays,
string? ReportExcludedPaths, string? ReportExcludedPaths,
int StandupWeekday, int StandupWeekday,
int DailyPrepMaxTasks); int DailyPrepMaxTasks,
List<string>? SessionSkills = null);
public record SessionSkillDto(
string Name,
string Description,
string SourceUrl,
string PinnedRef,
DateTimeOffset AddedAt);
public record WorktreeCleanupDto(int Removed); public record WorktreeCleanupDto(int Removed);
public record WorktreeResetDto(int Removed, int TasksAffected, bool Blocked, int RunningTasks); public record WorktreeResetDto(int Removed, int TasksAffected, bool Blocked, int RunningTasks);
@@ -65,9 +75,9 @@ public record MergeConflictDocumentsDto(string TaskId, IReadOnlyList<ConflictDoc
public record ConflictDocumentDto(string Path, bool IsBinary, IReadOnlyList<MergeSegmentDto> Segments); public record ConflictDocumentDto(string Path, bool IsBinary, IReadOnlyList<MergeSegmentDto> Segments);
public record MergeSegmentDto(bool IsConflict, string Text, string Ours, string? Base, string Theirs); public record MergeSegmentDto(bool IsConflict, string Text, string Ours, string? Base, string Theirs);
public record UpdateListDto(string Id, string Name, string? WorkingDir, string DefaultCommitType); public record UpdateListDto(string Id, string Name, string? WorkingDir, string DefaultCommitType);
public record UpdateListConfigDto(string ListId, string? Model, string? SystemPrompt, string? AgentPath, int? MaxTurns = null); public record UpdateListConfigDto(string ListId, string? Model, string? SystemPrompt, string? AgentPath, int? MaxTurns = null, List<string>? SessionSkills = null);
public record UpdateTaskAgentSettingsDto(string TaskId, string? Model, string? SystemPrompt, string? AgentPath, int? MaxTurns = null); public record UpdateTaskAgentSettingsDto(string TaskId, string? Model, string? SystemPrompt, string? AgentPath, int? MaxTurns = null, List<string>? SessionSkills = null);
public record ListConfigDto(string? Model, string? SystemPrompt, string? AgentPath, int? MaxTurns = null); public record ListConfigDto(string? Model, string? SystemPrompt, string? AgentPath, int? MaxTurns = null, List<string>? SessionSkills = null);
public record SeedResultDto(int Copied, int Skipped); public record SeedResultDto(int Copied, int Skipped);
public record OnlineInboxStateDto( public record OnlineInboxStateDto(
@@ -117,8 +127,10 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
private readonly OnlineInboxConfig _onlineInboxConfig; private readonly OnlineInboxConfig _onlineInboxConfig;
private readonly OnlineTokenStore _onlineTokenStore; private readonly OnlineTokenStore _onlineTokenStore;
private readonly Runner.PendingQuestionRegistry _pendingQuestions; private readonly Runner.PendingQuestionRegistry _pendingQuestions;
private readonly InteractiveSessionService _interactive;
private readonly LogRingBuffer? _logBuffer; private readonly LogRingBuffer? _logBuffer;
private readonly ISessionSkillRegistry _skillRegistry;
private readonly IInteractiveLaunchSpecService? _interactiveLaunchSpec;
private readonly WorktreeManager? _worktreeManager;
public WorkerHub( public WorkerHub(
QueueService queue, QueueService queue,
@@ -144,8 +156,10 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
OnlineInboxConfig onlineInboxConfig, OnlineInboxConfig onlineInboxConfig,
OnlineTokenStore onlineTokenStore, OnlineTokenStore onlineTokenStore,
Runner.PendingQuestionRegistry pendingQuestions, Runner.PendingQuestionRegistry pendingQuestions,
InteractiveSessionService interactive, ISessionSkillRegistry skillRegistry,
LogRingBuffer? logBuffer = null) LogRingBuffer? logBuffer = null,
IInteractiveLaunchSpecService? interactiveLaunchSpec = null,
WorktreeManager? worktreeManager = null)
{ {
_queue = queue; _queue = queue;
_waker = waker; _waker = waker;
@@ -170,8 +184,23 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
_onlineInboxConfig = onlineInboxConfig; _onlineInboxConfig = onlineInboxConfig;
_onlineTokenStore = onlineTokenStore; _onlineTokenStore = onlineTokenStore;
_pendingQuestions = pendingQuestions; _pendingQuestions = pendingQuestions;
_interactive = interactive; _skillRegistry = skillRegistry;
_logBuffer = logBuffer; _logBuffer = logBuffer;
_interactiveLaunchSpec = interactiveLaunchSpec;
_worktreeManager = worktreeManager;
}
// Persistence boundary for the session_skills JSON-array columns (task/list/global).
// A null/empty selection persists as null so "inherit / none" stays clean, and the
// shape matches TaskRunner.UnionSkillNames's expected JSON string array.
private static string? SkillsToJson(List<string>? names) =>
names is null or { Count: 0 } ? null : JsonSerializer.Serialize(names);
private static List<string>? SkillsFromJson(string? json)
{
if (string.IsNullOrWhiteSpace(json)) return null;
try { return JsonSerializer.Deserialize<List<string>>(json); }
catch (JsonException) { return null; }
} }
/// <summary>Deliver the user's answer to a question a running task raised via AskUser. /// <summary>Deliver the user's answer to a question a running task raised via AskUser.
@@ -288,7 +317,8 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
row.WorktreeAutoCleanupDays, row.WorktreeAutoCleanupDays,
row.ReportExcludedPaths, row.ReportExcludedPaths,
row.StandupWeekday, row.StandupWeekday,
row.DailyPrepMaxTasks); row.DailyPrepMaxTasks,
SkillsFromJson(row.SessionSkills));
} }
public async Task UpdateAppSettings(AppSettingsDto dto) public async Task UpdateAppSettings(AppSettingsDto dto)
@@ -310,9 +340,28 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
ReportExcludedPaths = dto.ReportExcludedPaths, ReportExcludedPaths = dto.ReportExcludedPaths,
StandupWeekday = dto.StandupWeekday is >= 0 and <= 6 ? dto.StandupWeekday : (int)DayOfWeek.Wednesday, StandupWeekday = dto.StandupWeekday is >= 0 and <= 6 ? dto.StandupWeekday : (int)DayOfWeek.Wednesday,
DailyPrepMaxTasks = dto.DailyPrepMaxTasks, DailyPrepMaxTasks = dto.DailyPrepMaxTasks,
SessionSkills = SkillsToJson(dto.SessionSkills),
}); });
} }
public async Task<List<SessionSkillDto>> GetSessionSkills()
{
var rows = await _skillRegistry.ListAsync(Context.ConnectionAborted);
return rows.Select(r => new SessionSkillDto(r.Name, r.Description, r.SourceUrl, r.PinnedRef, r.AddedAt)).ToList();
}
public Task<List<string>> InstallSessionSkill(string url) => HubGuard(async () =>
{
var installed = await _skillRegistry.InstallAsync(url, Context.ConnectionAborted);
return installed.ToList();
});
public Task UpdateSessionSkill(string sourceUrl) => HubGuard(
() => _skillRegistry.UpdateAsync(sourceUrl, Context.ConnectionAborted));
public Task RemoveSessionSkill(string sourceUrl) => HubGuard(
() => _skillRegistry.RemoveAsync(sourceUrl, Context.ConnectionAborted));
public async Task<WorktreeCleanupDto> CleanupFinishedWorktrees(string? listId = null) public async Task<WorktreeCleanupDto> CleanupFinishedWorktrees(string? listId = null)
{ {
var result = await _wtMaintenance.CleanupFinishedAsync(listId, Context.ConnectionAborted); var result = await _wtMaintenance.CleanupFinishedAsync(listId, Context.ConnectionAborted);
@@ -456,8 +505,9 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
var model = dto.Model.NullIfBlank(); var model = dto.Model.NullIfBlank();
var systemPrompt = dto.SystemPrompt.NullIfBlank(); var systemPrompt = dto.SystemPrompt.NullIfBlank();
var agentPath = dto.AgentPath.NullIfBlank(); var agentPath = dto.AgentPath.NullIfBlank();
var sessionSkills = SkillsToJson(dto.SessionSkills);
if (model is null && systemPrompt is null && agentPath is null && dto.MaxTurns is null) if (model is null && systemPrompt is null && agentPath is null && dto.MaxTurns is null && sessionSkills is null)
{ {
await repo.DeleteConfigAsync(dto.ListId); await repo.DeleteConfigAsync(dto.ListId);
} }
@@ -470,6 +520,7 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
SystemPrompt = systemPrompt, SystemPrompt = systemPrompt,
AgentPath = agentPath, AgentPath = agentPath,
MaxTurns = dto.MaxTurns, MaxTurns = dto.MaxTurns,
SessionSkills = sessionSkills,
}); });
} }
@@ -482,7 +533,7 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
var repo = new ListRepository(ctx); var repo = new ListRepository(ctx);
var config = await repo.GetConfigAsync(listId); var config = await repo.GetConfigAsync(listId);
if (config is null) return null; if (config is null) return null;
return new ListConfigDto(config.Model, config.SystemPrompt, config.AgentPath, config.MaxTurns); return new ListConfigDto(config.Model, config.SystemPrompt, config.AgentPath, config.MaxTurns, SkillsFromJson(config.SessionSkills));
} }
public async Task SetTaskStatus(string taskId, string status) public async Task SetTaskStatus(string taskId, string status)
@@ -543,7 +594,8 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
dto.Model.NullIfBlank(), dto.Model.NullIfBlank(),
dto.SystemPrompt.NullIfBlank(), dto.SystemPrompt.NullIfBlank(),
dto.AgentPath.NullIfBlank(), dto.AgentPath.NullIfBlank(),
dto.MaxTurns); dto.MaxTurns,
SkillsToJson(dto.SessionSkills));
await _broadcaster.TaskUpdated(dto.TaskId); await _broadcaster.TaskUpdated(dto.TaskId);
} }
@@ -572,20 +624,123 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
return ctx; return ctx;
} }
public Task OpenInteractiveTerminalAsync(string taskId) => // Picks up a task's Claude session in a real terminal window (--resume) so the user can
_interactive.StartAsync(taskId, Context.ConnectionAborted); // drive it by hand. Only for tasks the worker isn't actively running, with a persisted
// session id and a live worktree.
public Task ResumeTaskInTerminal(string taskId) => HubGuard(async () =>
{
await using var ctx = await _dbFactory.CreateDbContextAsync();
public Task SendInteractiveMessage(string taskId, string text) => var task = await new TaskRepository(ctx).GetByIdAsync(taskId, Context.ConnectionAborted)
_interactive.SendAsync(taskId, text, Context.ConnectionAborted); ?? throw new KeyNotFoundException();
if (task.Status is TaskStatus.Running or TaskStatus.Queued)
throw new InvalidOperationException("Can't pick up a running or queued task — interrupt it first.");
public Task StopInteractiveSession(string taskId) => var run = await new TaskRunRepository(ctx).GetLatestByTaskIdAsync(taskId, Context.ConnectionAborted);
_interactive.StopAsync(taskId, Context.ConnectionAborted); if (run?.SessionId is not { Length: > 0 } sessionId)
throw new InvalidOperationException("This task has no resumable Claude session yet.");
public Task InterruptInteractiveSession(string taskId) => var worktree = await new WorktreeRepository(ctx).GetByTaskIdAsync(taskId, Context.ConnectionAborted);
_interactive.InterruptAsync(taskId, Context.ConnectionAborted); if (worktree is null || worktree.State is not (WorktreeState.Active or WorktreeState.Kept))
throw new InvalidOperationException("This task has no active worktree to resume in.");
if (!Directory.Exists(worktree.Path))
throw new InvalidOperationException("The task's worktree directory no longer exists.");
public Task RemoveQueuedInteractiveMessage(string taskId, string text) => try
_interactive.RemoveQueuedAsync(taskId, text, Context.ConnectionAborted); {
await _launcher.LaunchResumeAsync(worktree.Path, sessionId, Context.ConnectionAborted);
}
catch (TerminalLaunchException ex)
{
throw new InvalidOperationException(ex.Message);
}
});
// Builds the launch spec an embedded ConPTY terminal (UI process) needs to open an
// interactive Claude session in a task's worktree -- same worktree prep as an
// autonomous run (session-skills seeding, run env vars), --resume if the task has a
// persisted session or a fresh-start spec otherwise. Guards mirror ResumeTaskInTerminal.
public Task<LaunchSpec> GetInteractiveLaunchSpec(string taskId) => HubGuard(() =>
{
if (_interactiveLaunchSpec is null)
throw new InvalidOperationException("Interactive launch spec service is not configured.");
return _interactiveLaunchSpec.BuildForTaskAsync(taskId, Context.ConnectionAborted);
});
// Builds the launch spec for an ad-hoc interactive session in an arbitrary directory --
// no task, no worktree, no session-skills seeding.
public Task<LaunchSpec> GetAdHocLaunchSpec(string directory) => HubGuard(() =>
{
if (_interactiveLaunchSpec is null)
throw new InvalidOperationException("Interactive launch spec service is not configured.");
return _interactiveLaunchSpec.BuildForDirectoryAsync(directory, Context.ConnectionAborted);
});
// Starts a planning session (worktree + prompt files + token, task -> Planning) and returns
// the launch spec for an embedded ConPTY planning terminal -- the ConPTY replacement for
// StartPlanningSessionAsync's external wt window. On any spec-build failure the just-started
// session is discarded (no children exist yet), mirroring StartPlanningSessionAsync.
public Task<LaunchSpec> GetPlanningStartLaunchSpec(string taskId) => HubGuard(async () =>
{
if (_interactiveLaunchSpec is null)
throw new InvalidOperationException("Interactive launch spec service is not configured.");
var ctx = await _planning.StartAsync(taskId, Context.ConnectionAborted);
try
{
var spec = _interactiveLaunchSpec.BuildPlanningStart(ctx);
await Clients.All.SendAsync("TaskUpdated", taskId);
return spec;
}
catch
{
await _planning.DiscardAsync(taskId, dequeueQueuedChildren: true, Context.ConnectionAborted);
throw;
}
});
// Resumes a planning session and returns the ConPTY launch spec (--permission-mode plan
// --resume). ConPTY replacement for ResumePlanningSessionAsync's external wt window.
public Task<LaunchSpec> GetPlanningResumeLaunchSpec(string taskId) => HubGuard(async () =>
{
if (_interactiveLaunchSpec is null)
throw new InvalidOperationException("Interactive launch spec service is not configured.");
var ctx = await _planning.ResumeAsync(taskId, Context.ConnectionAborted);
return _interactiveLaunchSpec.BuildPlanningResume(ctx);
});
// Submits an interactively-worked task for review: commits whatever the ConPTY session left
// in the worktree (so there is a diff to merge), then transitions Idle/Failed -> WaitingForReview.
// The normal Approve flow then merges it. This is the only path that flips a hand-driven session
// into the review pipeline — a ConPTY session never touches task status on its own.
public Task SubmitTaskForReview(string taskId) => HubGuard(async () =>
{
if (_worktreeManager is null)
throw new InvalidOperationException("Worktree manager is not configured.");
await using var ctx = await _dbFactory.CreateDbContextAsync();
var task = await new TaskRepository(ctx).GetByIdAsync(taskId, Context.ConnectionAborted)
?? throw new KeyNotFoundException();
if (task.Status is TaskStatus.Running or TaskStatus.Queued)
throw new InvalidOperationException("Can't submit a running or queued task — interrupt it first.");
if (task.Status is TaskStatus.WaitingForReview or TaskStatus.WaitingForChildren)
throw new InvalidOperationException("Task is already awaiting review.");
var worktree = await new WorktreeRepository(ctx).GetByTaskIdAsync(taskId, Context.ConnectionAborted);
if (worktree is null || worktree.State is not (WorktreeState.Active or WorktreeState.Kept))
throw new InvalidOperationException("This task has no active worktree to submit.");
if (!Directory.Exists(worktree.Path))
throw new InvalidOperationException("The task's worktree directory no longer exists.");
var list = await new ListRepository(ctx).GetByIdAsync(task.ListId, Context.ConnectionAborted)
?? throw new InvalidOperationException("Task list not found.");
var wtCtx = new WorktreeContext(worktree.Path, worktree.BranchName, worktree.BaseCommit);
await _worktreeManager.CommitIfChangedAsync(wtCtx, task, list, Context.ConnectionAborted);
var result = await _state.SubmitInteractiveForReviewAsync(taskId, DateTime.UtcNow, Context.ConnectionAborted);
if (!result.Ok)
throw new InvalidOperationException(result.Reason ?? "Could not submit for review.");
});
public async Task<DiscardPlanningOutcome> DiscardPlanningSessionAsync(string taskId, bool dequeueQueuedChildren = false) public async Task<DiscardPlanningOutcome> DiscardPlanningSessionAsync(string taskId, bool dequeueQueuedChildren = false)
{ {
@@ -115,7 +115,7 @@ public sealed class TaskMergeService
return Blocked("working directory is not a git repository"); return Blocked("working directory is not a git repository");
if (await _git.IsMidMergeAsync(list.WorkingDir, ct)) if (await _git.IsMidMergeAsync(list.WorkingDir, ct))
return Blocked("target working directory is mid-merge"); return Blocked("target working directory is mid-merge");
if (await _git.HasChangesAsync(list.WorkingDir, ct)) if (await _git.HasChangesAsync(list.WorkingDir, includeUntracked: false, ct))
return Blocked("target working tree has uncommitted changes"); return Blocked("target working tree has uncommitted changes");
var currentBranch = await _git.GetCurrentBranchAsync(list.WorkingDir, ct); var currentBranch = await _git.GetCurrentBranchAsync(list.WorkingDir, ct);
@@ -204,6 +204,26 @@ public sealed class TaskMergeService
if (!await _git.IsMidMergeAsync(list.WorkingDir, ct)) if (!await _git.IsMidMergeAsync(list.WorkingDir, ct))
return Blocked("repo is not mid-merge"); return Blocked("repo is not mid-merge");
// Validate BEFORE staging: `git add` marks a conflicted path resolved regardless of
// its content, so an unresolved file with markers still in it would otherwise get
// staged (and committed) as-is. Check text content for markers first; binary files
// can't carry markers, so they're left to the post-stage index check below.
var unresolved = await _git.ListConflictedFilesAsync(list.WorkingDir, ct);
var stillConflicted = new List<string>();
foreach (var path in unresolved)
{
var full = Path.Combine(list.WorkingDir, path.Replace('/', Path.DirectorySeparatorChar));
string text;
try { text = await File.ReadAllTextAsync(full, ct); }
catch { continue; }
if (!LooksBinary(text) && ConflictMarkerParser.HasConflicts(text))
stillConflicted.Add(path);
}
if (stillConflicted.Count > 0)
return new MergeResult(StatusConflict, stillConflicted, "conflicts not fully resolved");
await _git.AddAllAsync(list.WorkingDir, ct); await _git.AddAllAsync(list.WorkingDir, ct);
var remaining = await _git.ListConflictedFilesAsync(list.WorkingDir, ct); var remaining = await _git.ListConflictedFilesAsync(list.WorkingDir, ct);
@@ -1,172 +0,0 @@
using System.Text;
using ClaudeDo.Data;
using ClaudeDo.Data.Models;
using ClaudeDo.Data.Repositories;
using ClaudeDo.Worker.Config;
using ClaudeDo.Worker.Hub;
using ClaudeDo.Worker.Runner;
using ClaudeDo.Worker.Runner.Interfaces;
using Microsoft.EntityFrameworkCore;
namespace ClaudeDo.Worker.Planning;
public sealed class InteractiveSessionService
{
private readonly IDbContextFactory<ClaudeDoDbContext> _dbFactory;
private readonly WorkerConfig _cfg;
private readonly HubBroadcaster _broadcaster;
private readonly LiveSessionRegistry _registry;
private readonly ILoggerFactory _loggerFactory;
// Optional factory for tests. Signature: (onLine) -> (session, waitForExitTask).
// The waitForExitTask completes when the underlying process has exited.
private readonly Func<string, IReadOnlyList<string>, Func<string, Task>, (ILiveSession session, Task exitTask)>? _sessionFactory;
public InteractiveSessionService(
IDbContextFactory<ClaudeDoDbContext> dbFactory,
WorkerConfig cfg,
HubBroadcaster broadcaster,
LiveSessionRegistry registry,
ILoggerFactory loggerFactory,
Func<string, IReadOnlyList<string>, Func<string, Task>, (ILiveSession session, Task exitTask)>? sessionFactory = null)
{
_dbFactory = dbFactory;
_cfg = cfg;
_broadcaster = broadcaster;
_registry = registry;
_loggerFactory = loggerFactory;
_sessionFactory = sessionFactory;
}
public async Task StartAsync(string taskId, CancellationToken ct)
{
if (_registry.TryGet(taskId, out _))
throw new InvalidOperationException("An interactive session is already running for this task.");
await using var ctx = _dbFactory.CreateDbContext();
var tasks = new TaskRepository(ctx);
var lists = new ListRepository(ctx);
var task = await tasks.GetByIdAsync(taskId, ct)
?? throw new InvalidOperationException($"Task {taskId} not found.");
var list = await lists.GetByIdAsync(task.ListId, ct)
?? throw new InvalidOperationException($"List {task.ListId} not found.");
var workingDir = list.WorkingDir;
if (string.IsNullOrWhiteSpace(workingDir) || !Directory.Exists(workingDir))
throw new InvalidOperationException(
$"List '{list.Name}' has no valid working directory configured.");
var seededPrompt = BuildInteractivePrompt(task);
var args = new[]
{
"-p",
"--input-format", "stream-json",
"--output-format", "stream-json",
"--verbose",
"--replay-user-messages",
"--model", ModelRegistry.PlanningAlias,
"--permission-mode", "auto",
};
Func<string, Task> onLine = line =>
{
_registry.Touch(taskId);
return _broadcaster.TaskMessage(taskId, "[stdout] " + line);
};
ILiveSession session;
Task exitTask;
if (_sessionFactory is not null)
{
// Factory is responsible for providing a ready-to-use session and its exit signal.
(session, exitTask) = _sessionFactory(workingDir, args, onLine);
}
else
{
var transport = new ProcessClaudeStreamTransport(
_cfg,
_loggerFactory.CreateLogger<ProcessClaudeStreamTransport>());
var streamingSession = new StreamingClaudeSession(
transport,
onLine,
_loggerFactory.CreateLogger<StreamingClaudeSession>(),
onQueueChanged: pending => _ = _broadcaster.InteractiveQueueChanged(taskId, pending),
onUserMessageSent: text => _ = _broadcaster.InteractiveMessageSent(taskId, text));
await streamingSession.StartAsync(args, workingDir, seededPrompt, ct);
session = streamingSession;
exitTask = transport.WaitForExitAsync();
}
_registry.Register(taskId, session);
await _broadcaster.InteractiveSessionStarted(taskId);
var logger = _loggerFactory.CreateLogger<InteractiveSessionService>();
_ = WatchExitAsync(taskId, exitTask, logger);
}
private async Task WatchExitAsync(string taskId, Task exitTask, ILogger logger)
{
try
{
await exitTask;
}
catch (Exception ex)
{
logger.LogWarning(ex, "Interactive session exit watcher caught an exception for task {task_id}", taskId);
}
finally
{
_registry.Unregister(taskId);
try { await _broadcaster.InteractiveSessionEnded(taskId); }
catch (Exception ex) { logger.LogWarning(ex, "InteractiveSessionEnded broadcast failed for task {task_id}", taskId); }
}
}
public async Task SendAsync(string taskId, string text, CancellationToken ct)
{
if (!_registry.TryGet(taskId, out var session))
throw new InvalidOperationException("No interactive session is running for this task.");
_registry.Touch(taskId);
await session.SendUserMessageAsync(text, ct);
}
public async Task RemoveQueuedAsync(string taskId, string text, CancellationToken ct)
{
if (_registry.TryGet(taskId, out var session))
{
_registry.Touch(taskId);
await session.RemoveQueuedAsync(text, ct);
}
}
public async Task InterruptAsync(string taskId, CancellationToken ct)
{
if (_registry.TryGet(taskId, out var session))
{
_registry.Touch(taskId);
await session.InterruptAsync(ct);
}
}
public async Task StopAsync(string taskId, CancellationToken ct)
{
// StopAsync removes from registry and kills the session.
// The exit watcher will fire InteractiveSessionEnded once the process exits,
// so we don't broadcast here — the watcher is the single authoritative source.
await _registry.StopAsync(taskId);
}
private static string BuildInteractivePrompt(TaskEntity task)
{
var sb = new StringBuilder();
sb.AppendLine($"# Task: {task.Title}");
if (!string.IsNullOrWhiteSpace(task.Description))
{
sb.AppendLine();
sb.AppendLine(task.Description);
}
return sb.ToString();
}
}
@@ -2,11 +2,15 @@ namespace ClaudeDo.Worker.Planning;
// Launches the Claude CLI in a visible terminal for human-driven planning sessions. // Launches the Claude CLI in a visible terminal for human-driven planning sessions.
// Not used for headless task execution (that path is ClaudeProcess, prompt over stdin) // Not used for headless task execution (that path is ClaudeProcess, prompt over stdin)
// nor for interactive sessions (those use InteractiveSessionService + StreamingClaudeSession). // nor for embedded ConPTY interactive sessions (those use IInteractiveLaunchSpecService).
public interface ITerminalLauncher public interface ITerminalLauncher
{ {
Task LaunchPlanningStartAsync(PlanningSessionStartContext ctx, CancellationToken cancellationToken); Task LaunchPlanningStartAsync(PlanningSessionStartContext ctx, CancellationToken cancellationToken);
Task LaunchPlanningResumeAsync(PlanningSessionResumeContext ctx, CancellationToken cancellationToken); Task LaunchPlanningResumeAsync(PlanningSessionResumeContext ctx, CancellationToken cancellationToken);
// Resumes an arbitrary task's Claude session (--resume <id>) in a visible terminal so
// the user can pick up the conversation by hand — the "pick up in terminal" action.
Task LaunchResumeAsync(string workingDir, string claudeSessionId, CancellationToken cancellationToken);
} }
public sealed class TerminalLaunchException : Exception public sealed class TerminalLaunchException : Exception
@@ -92,14 +92,7 @@ public sealed class PlanningChainCoordinator
public async Task<string?> OnChildFinishedAsync( public async Task<string?> OnChildFinishedAsync(
string childTaskId, TaskStatus finalStatus, CancellationToken ct = default) string childTaskId, TaskStatus finalStatus, CancellationToken ct = default)
{ {
await using var ctx = await _dbFactory.CreateDbContextAsync(ct); var nextId = await FindSuccessorAsync(childTaskId, ct);
// The successor is whichever sibling explicitly blocks on this child.
var nextId = await ctx.Tasks
.AsNoTracking()
.Where(t => t.BlockedByTaskId == childTaskId)
.OrderBy(t => t.SortOrder).ThenBy(t => t.CreatedAt)
.Select(t => t.Id)
.FirstOrDefaultAsync(ct);
if (nextId is null) return null; if (nextId is null) return null;
if (finalStatus == TaskStatus.Done) if (finalStatus == TaskStatus.Done)
@@ -108,10 +101,33 @@ public sealed class PlanningChainCoordinator
return nextId; return nextId;
} }
// Child failed or was cancelled: cancel the immediate successor so the chain // Child failed or was cancelled: cancel the immediate successor so the chain is
// is not left wedged. CancelAsync triggers OnChildTerminalAsync → OnChildFinishedAsync // not left wedged. If it's cancellable, CancelAsync's own OnChildTerminalAsync
// for that successor, cascading cancellation through the rest of the chain. // callback recurses into this method for its successor, cascading cancellation
await _state().CancelAsync(nextId, DateTime.UtcNow, ct); // through the rest of the chain. If it's not (e.g. it was parked back to Idle
return null; // out of band), CancelAsync is a no-op and nothing will ever call back for it —
// keep walking the chain ourselves so the tail isn't left wedged forever.
var predecessorId = nextId;
while (true)
{
var result = await _state().CancelAsync(predecessorId, DateTime.UtcNow, ct);
if (result.Ok) return null;
var following = await FindSuccessorAsync(predecessorId, ct);
if (following is null) return null;
predecessorId = following;
}
}
// The successor is whichever sibling explicitly blocks on this task.
private async Task<string?> FindSuccessorAsync(string taskId, CancellationToken ct)
{
await using var ctx = await _dbFactory.CreateDbContextAsync(ct);
return await ctx.Tasks
.AsNoTracking()
.Where(t => t.BlockedByTaskId == taskId)
.OrderBy(t => t.SortOrder).ThenBy(t => t.CreatedAt)
.Select(t => t.Id)
.FirstOrDefaultAsync(ct);
} }
} }
@@ -87,7 +87,7 @@ public sealed class PlanningMergeOrchestrator
if (await _git.IsMidMergeAsync(workingDir, ct)) if (await _git.IsMidMergeAsync(workingDir, ct))
throw new InvalidOperationException( throw new InvalidOperationException(
"repo is mid-merge; use AbortPlanningMerge to reset the repository, then Approve again"); "repo is mid-merge; use AbortPlanningMerge to reset the repository, then Approve again");
if (await _git.HasChangesAsync(workingDir, ct)) if (await _git.HasChangesAsync(workingDir, includeUntracked: false, ct))
throw new InvalidOperationException("working tree has uncommitted changes"); throw new InvalidOperationException("working tree has uncommitted changes");
var idsToMerge = new List<string>(); var idsToMerge = new List<string>();
@@ -2,15 +2,21 @@
// Thinking budget: env var MAX_THINKING_TOKENS=20000 (no CLI flag exists) // Thinking budget: env var MAX_THINKING_TOKENS=20000 (no CLI flag exists)
// Allowed-tools: --allowedTools (camelCase), comma-separated tokens // Allowed-tools: --allowedTools (camelCase), comma-separated tokens
// System prompt: --append-system-prompt-file <path> (file form) // System prompt: --append-system-prompt-file <path> (file form)
// Extra read roots: --add-dir <dir...> (variadic)
// Session ID: no pre-assign flag; resume with --resume <id> // Session ID: no pre-assign flag; resume with --resume <id>
// Launch model: wt.exe -> powershell -> claude.exe (UseShellExecute=false). // Launch model: wt.exe -> powershell -> claude.exe (UseShellExecute=false).
// wt.exe treats ';' as a tab/command delimiter in EVERY argument, regardless of // wt.exe treats ';' as a tab/command delimiter in EVERY argument, regardless of
// quoting, and there is no escape that survives (microsoft/terminal#13264). So the // quoting (microsoft/terminal#13264), so nothing containing ';' may appear on the wt
// free-text prompt must never appear on the wt command line. We hand it to PowerShell // command line. Every token we place there is a controlled constant or a filesystem
// out-of-band via an environment variable and reference it as $env:VAR — PowerShell // path under ~/.todo-app/sessions/<taskId> — none can contain ';' — and each is
// binds a variable's value as a single argument without re-tokenizing it, so the prompt // single-quoted for PowerShell.
// is robust to ';', '&', quotes, and newlines. All other (controlled) tokens are //
// single-quoted. No cmd shim: cmd re-parses %VAR% and would re-introduce the problem. // The free-text task brief is NEVER passed as an argument. An interactive `claude`
// session auto-submits its positional prompt, and a newline in that prompt ends the
// first line — a multi-line brief was silently truncated at the first newline. So we
// hand claude a single-line kickoff that points it at the brief FILE (written by
// PlanningSessionManager) and expose that file's directory via --add-dir so the Read
// tool can open it. The full multi-line brief reaches claude intact via the file.
using System.Diagnostics; using System.Diagnostics;
using System.Text; using System.Text;
@@ -27,10 +33,6 @@ public sealed class WindowsTerminalLauncher : ITerminalLauncher
private const string AllowedTools = "mcp__claudedo__*,Read,Grep,Glob,WebFetch,WebSearch,Skill"; private const string AllowedTools = "mcp__claudedo__*,Read,Grep,Glob,WebFetch,WebSearch,Skill";
private const string Model = ModelRegistry.PlanningAlias; private const string Model = ModelRegistry.PlanningAlias;
// Carries the free-text initial prompt to PowerShell out-of-band (never on the
// command line) so wt.exe cannot split it on ';'.
private const string PromptEnvVar = "CLAUDEDO_LAUNCH_PROMPT";
private readonly string _wtPath; private readonly string _wtPath;
private readonly string _claudePath; private readonly string _claudePath;
@@ -53,22 +55,12 @@ public sealed class WindowsTerminalLauncher : ITerminalLauncher
var resolvedWt = ResolveWtOrThrow(); var resolvedWt = ResolveWtOrThrow();
var resolvedClaude = ResolveClaudeOrThrow(); var resolvedClaude = ResolveClaudeOrThrow();
// Arg order: --allowedTools is variadic (space-separated). The positional prompt var command = BuildPlanningStartCommand(resolvedClaude, ctx);
// must follow a single-value flag, or it will be swallowed —
// --append-system-prompt-file serves as that buffer.
var command = BuildPwshCommand(resolvedClaude, new[]
{
"--model", Model,
"--permission-mode", "plan",
"--allowedTools", AllowedTools,
"--append-system-prompt-file", ctx.Files.SystemPromptPath,
}, appendPrompt: true);
StartInWindowsTerminal(resolvedWt, ctx.WorkingDir, command, env => StartInWindowsTerminal(resolvedWt, ctx.WorkingDir, command, env =>
{ {
env["MAX_THINKING_TOKENS"] = "20000"; env["MAX_THINKING_TOKENS"] = "20000";
env["CLAUDEDO_PLANNING_TOKEN"] = ctx.Token; env["CLAUDEDO_PLANNING_TOKEN"] = ctx.Token;
env[PromptEnvVar] = File.ReadAllText(ctx.Files.InitialPromptPath);
}); });
return Task.CompletedTask; return Task.CompletedTask;
@@ -82,11 +74,7 @@ public sealed class WindowsTerminalLauncher : ITerminalLauncher
var resolvedWt = ResolveWtOrThrow(); var resolvedWt = ResolveWtOrThrow();
var resolvedClaude = ResolveClaudeOrThrow(); var resolvedClaude = ResolveClaudeOrThrow();
var command = BuildPwshCommand(resolvedClaude, new[] var command = BuildPwshCommand(resolvedClaude, BuildPlanningResumeArgs(ctx.ClaudeSessionId));
{
"--permission-mode", "plan",
"--resume", ctx.ClaudeSessionId,
}, appendPrompt: false);
StartInWindowsTerminal(resolvedWt, ctx.WorkingDir, command, env => StartInWindowsTerminal(resolvedWt, ctx.WorkingDir, command, env =>
{ {
@@ -96,26 +84,86 @@ public sealed class WindowsTerminalLauncher : ITerminalLauncher
return Task.CompletedTask; return Task.CompletedTask;
} }
public Task LaunchResumeAsync(string workingDir, string claudeSessionId, CancellationToken cancellationToken)
{
if (!Directory.Exists(workingDir))
throw new TerminalLaunchException($"Working directory does not exist: {workingDir}");
var resolvedWt = ResolveWtOrThrow();
var resolvedClaude = ResolveClaudeOrThrow();
var command = BuildResumeCommand(resolvedClaude, claudeSessionId);
StartInWindowsTerminal(resolvedWt, workingDir, command, static _ => { });
return Task.CompletedTask;
}
// Resumes a session by id with no extra flags: the user drives every tool approval in the
// terminal, unlike planning which additionally allowlists its MCP planning tools.
internal static string BuildResumeCommand(string claudePath, string claudeSessionId) =>
BuildPwshCommand(claudePath, BuildResumeArgs(claudeSessionId));
// The raw claude CLI args for a --resume launch, shared with InteractiveLaunchSpecService
// (which needs the bare Exe/Args pair for a ConPTY host, not a wrapped pwsh command line).
internal static IReadOnlyList<string> BuildResumeArgs(string claudeSessionId) =>
new[] { "--resume", claudeSessionId };
// Builds the PowerShell command that launches an interactive planning session.
// Arg order matters: variadic flags (--allowedTools, --add-dir) come first; the
// single-line kickoff prompt is positional, so it must follow a single-value flag
// (--append-system-prompt-file) or a variadic flag would swallow it.
internal static string BuildPlanningStartCommand(string claudePath, PlanningSessionStartContext ctx) =>
BuildPwshCommand(claudePath, BuildPlanningStartArgs(ctx));
// The raw claude CLI args for an interactive planning START, shared with the embedded-ConPTY
// planning path (InteractiveLaunchSpecService), which needs the bare Exe/Args pair rather than
// a pwsh-wrapped command line. Arg order matters: variadic flags (--allowedTools, --add-dir)
// come first; the single-line kickoff prompt is positional, so it must follow a single-value
// flag (--append-system-prompt-file) or a variadic flag would swallow it.
internal static IReadOnlyList<string> BuildPlanningStartArgs(PlanningSessionStartContext ctx)
{
var kickoff =
$"Read the file {ctx.Files.InitialPromptPath} first. It contains the task you must plan. " +
"After reading it, begin the planning session as your instructions describe.";
return new[]
{
"--model", Model,
// NOT --permission-mode plan: plan mode gates EVERY MCP tool call regardless of
// --allowedTools, so the session would prompt the user on the first CreateChildTask
// (the whole point of a planning session). Default mode honours the allowlist below,
// and file edits stay blocked anyway — the planning system prompt forbids them and
// AllowedTools omits Write/Edit/Bash (an unexpected edit would prompt, not run silently).
"--permission-mode", "default",
"--allowedTools", AllowedTools,
"--add-dir", ctx.Files.SessionDirectory,
"--append-system-prompt-file", ctx.Files.SystemPromptPath,
kickoff,
};
}
// The raw claude CLI args for an interactive planning RESUME, shared with the embedded-ConPTY
// planning path. Re-passes the planning allowlist in default mode (not --resume alone): the CLI
// does not restore --allowedTools across a resume, and plan mode would gate the MCP tools.
internal static IReadOnlyList<string> BuildPlanningResumeArgs(string claudeSessionId) =>
new[] { "--permission-mode", "default", "--allowedTools", AllowedTools, "--resume", claudeSessionId };
private string ResolveWtOrThrow() => private string ResolveWtOrThrow() =>
Resolve(_wtPath) ?? throw new TerminalLaunchException($"Windows Terminal not found: {_wtPath}"); Resolve(_wtPath) ?? throw new TerminalLaunchException($"Windows Terminal not found: {_wtPath}");
private string ResolveClaudeOrThrow() => private string ResolveClaudeOrThrow() =>
Resolve(_claudePath) ?? throw new TerminalLaunchException($"claude executable not found: {_claudePath}"); Resolve(_claudePath) ?? throw new TerminalLaunchException($"claude executable not found: {_claudePath}");
// Builds the PowerShell command that invokes claude with the given (controlled) // Builds the PowerShell command that invokes claude with the given tokens. Each token
// arguments, optionally appending the free-text prompt from $env:CLAUDEDO_LAUNCH_PROMPT. // is single-quoted, so ';', '&', spaces, quotes, and backslashes pass through to the
// The prompt is referenced as a variable so PowerShell binds its value as ONE argument // child process untouched. No cmd shim: cmd would re-parse the arguments.
// (never re-tokenized). The `-replace '"','\"'` works around Windows PowerShell 5.1's private static string BuildPwshCommand(string claudePath, IReadOnlyList<string> args)
// native-argument quirk, which otherwise strips embedded double-quotes before the child
// sees them; all other characters (';', '&', spaces, backslashes, newlines) pass through.
private static string BuildPwshCommand(string claudePath, IReadOnlyList<string> args, bool appendPrompt)
{ {
var sb = new StringBuilder(); var sb = new StringBuilder();
sb.Append("& ").Append(PwshQuote(claudePath)); sb.Append("& ").Append(PwshQuote(claudePath));
foreach (var a in args) foreach (var a in args)
sb.Append(' ').Append(PwshQuote(a)); sb.Append(' ').Append(PwshQuote(a));
if (appendPrompt)
sb.Append(" ($env:").Append(PromptEnvVar).Append(" -replace '\"','\\\"')");
return sb.ToString(); return sb.ToString();
} }
@@ -146,7 +194,9 @@ public sealed class WindowsTerminalLauncher : ITerminalLauncher
?? throw new TerminalLaunchException("Failed to start Windows Terminal process."); ?? throw new TerminalLaunchException("Failed to start Windows Terminal process.");
} }
private static string? Resolve(string pathOrName) // Not private: reused by InteractiveLaunchSpecService to resolve the claude executable
// for a ConPTY-hosted launch spec the same way a wt-launched terminal resolves it.
internal static string? Resolve(string pathOrName)
{ {
if (File.Exists(pathOrName)) if (File.Exists(pathOrName))
return pathOrName; return pathOrName;
+9 -3
View File
@@ -18,6 +18,7 @@ using ClaudeDo.Worker.Prime;
using ClaudeDo.Worker.Refine; using ClaudeDo.Worker.Refine;
using ClaudeDo.Worker.Report; using ClaudeDo.Worker.Report;
using ClaudeDo.Worker.Report.Interfaces; using ClaudeDo.Worker.Report.Interfaces;
using ClaudeDo.Worker.Skills;
using ClaudeDo.Worker.Worktrees; using ClaudeDo.Worker.Worktrees;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Serilog; using Serilog;
@@ -73,6 +74,10 @@ builder.Services.AddSingleton<WorktreeManager>();
builder.Services.AddSingleton<ClaudeArgsBuilder>(); builder.Services.AddSingleton<ClaudeArgsBuilder>();
builder.Services.AddSingleton<TaskRunTokenRegistry>(); builder.Services.AddSingleton<TaskRunTokenRegistry>();
builder.Services.AddSingleton<PendingQuestionRegistry>(); builder.Services.AddSingleton<PendingQuestionRegistry>();
builder.Services.AddSingleton<IRepoCloner, GitRepoCloner>();
builder.Services.AddSingleton<ISessionSkillRegistry, SessionSkillRegistry>();
builder.Services.AddSingleton<ISessionSkillSeeder, SessionSkillSeeder>();
builder.Services.AddSingleton<IInteractiveLaunchSpecService, InteractiveLaunchSpecService>();
builder.Services.AddSingleton<TaskRunner>(); builder.Services.AddSingleton<TaskRunner>();
builder.Services.AddSingleton<WorktreeMaintenanceService>(); builder.Services.AddSingleton<WorktreeMaintenanceService>();
builder.Services.AddSingleton<TaskResetService>(); builder.Services.AddSingleton<TaskResetService>();
@@ -80,9 +85,6 @@ builder.Services.AddSingleton<TaskMergeService>();
builder.Services.AddSingleton<PlanningAggregator>(); builder.Services.AddSingleton<PlanningAggregator>();
builder.Services.AddSingleton<PlanningMergeOrchestrator>(); builder.Services.AddSingleton<PlanningMergeOrchestrator>();
builder.Services.AddSingleton<PlanningChainCoordinator>(); builder.Services.AddSingleton<PlanningChainCoordinator>();
builder.Services.AddSingleton<LiveSessionRegistry>();
builder.Services.AddSingleton<InteractiveSessionService>();
builder.Services.AddHostedService<IdleSessionReaper>();
// Queue dispatch primitives. QueueWaker holds the wake semaphore; the queue picker // Queue dispatch primitives. QueueWaker holds the wake semaphore; the queue picker
// performs atomic Queued→Running claim. Both injected into the state service so it // performs atomic Queued→Running claim. Both injected into the state service so it
@@ -90,6 +92,7 @@ builder.Services.AddHostedService<IdleSessionReaper>();
builder.Services.AddSingleton<QueueWaker>(); builder.Services.AddSingleton<QueueWaker>();
builder.Services.AddSingleton<IQueueWaker>(sp => sp.GetRequiredService<QueueWaker>()); builder.Services.AddSingleton<IQueueWaker>(sp => sp.GetRequiredService<QueueWaker>());
builder.Services.AddSingleton<IQueuePicker, QueuePicker>(); builder.Services.AddSingleton<IQueuePicker, QueuePicker>();
builder.Services.AddSingleton<RunCancellationRegistry>();
builder.Services.AddSingleton<Func<ITaskStateService>>(sp => () => sp.GetRequiredService<ITaskStateService>()); builder.Services.AddSingleton<Func<ITaskStateService>>(sp => () => sp.GetRequiredService<ITaskStateService>());
builder.Services.AddSingleton<ITaskStateService>(sp => new TaskStateService( builder.Services.AddSingleton<ITaskStateService>(sp => new TaskStateService(
@@ -97,6 +100,7 @@ builder.Services.AddSingleton<ITaskStateService>(sp => new TaskStateService(
sp.GetRequiredService<HubBroadcaster>(), sp.GetRequiredService<HubBroadcaster>(),
sp.GetRequiredService<IQueueWaker>(), sp.GetRequiredService<IQueueWaker>(),
sp.GetRequiredService<PlanningChainCoordinator>(), sp.GetRequiredService<PlanningChainCoordinator>(),
sp.GetRequiredService<RunCancellationRegistry>(),
sp.GetRequiredService<ILogger<TaskStateService>>())); sp.GetRequiredService<ILogger<TaskStateService>>()));
// Agent file management. // Agent file management.
@@ -267,6 +271,7 @@ if (cfg.ExternalMcpPort > 0)
externalBuilder.Services.AddSingleton(app.Services.GetRequiredService<GitService>()); externalBuilder.Services.AddSingleton(app.Services.GetRequiredService<GitService>());
externalBuilder.Services.AddSingleton(app.Services.GetRequiredService<WorktreeMaintenanceService>()); externalBuilder.Services.AddSingleton(app.Services.GetRequiredService<WorktreeMaintenanceService>());
externalBuilder.Services.AddSingleton(app.Services.GetRequiredService<TaskMergeService>()); externalBuilder.Services.AddSingleton(app.Services.GetRequiredService<TaskMergeService>());
externalBuilder.Services.AddSingleton(app.Services.GetRequiredService<PlanningMergeOrchestrator>());
externalBuilder.Services.AddScoped<ExternalMcpService>(); externalBuilder.Services.AddScoped<ExternalMcpService>();
externalBuilder.Services.AddScoped<BatchMcpTools>(); externalBuilder.Services.AddScoped<BatchMcpTools>();
externalBuilder.Services.AddScoped<ListMcpTools>(); externalBuilder.Services.AddScoped<ListMcpTools>();
@@ -280,6 +285,7 @@ if (cfg.ExternalMcpPort > 0)
externalBuilder.Services.AddScoped<AttachmentMcpTools>(); externalBuilder.Services.AddScoped<AttachmentMcpTools>();
externalBuilder.Services.AddMcpServer() externalBuilder.Services.AddMcpServer()
.WithHttpTransport() .WithHttpTransport()
.WithRequestFilters(f => f.AddCallToolFilter(ExternalMcpExceptionFilter.Wrap))
.WithTools<ExternalMcpService>() .WithTools<ExternalMcpService>()
.WithTools<BatchMcpTools>() .WithTools<BatchMcpTools>()
.WithTools<ListMcpTools>() .WithTools<ListMcpTools>()
@@ -10,6 +10,7 @@ public sealed class OverrideSlotService
private readonly IDbContextFactory<ClaudeDoDbContext> _dbFactory; private readonly IDbContextFactory<ClaudeDoDbContext> _dbFactory;
private readonly TaskRunner _runner; private readonly TaskRunner _runner;
private readonly ILogger<OverrideSlotService> _logger; private readonly ILogger<OverrideSlotService> _logger;
private readonly RunCancellationRegistry _runCancels;
private readonly object _lock = new(); private readonly object _lock = new();
private volatile QueueSlotState? _slot; private volatile QueueSlotState? _slot;
@@ -17,11 +18,13 @@ public sealed class OverrideSlotService
public OverrideSlotService( public OverrideSlotService(
IDbContextFactory<ClaudeDoDbContext> dbFactory, IDbContextFactory<ClaudeDoDbContext> dbFactory,
TaskRunner runner, TaskRunner runner,
ILogger<OverrideSlotService> logger) ILogger<OverrideSlotService> logger,
RunCancellationRegistry runCancels)
{ {
_dbFactory = dbFactory; _dbFactory = dbFactory;
_runner = runner; _runner = runner;
_logger = logger; _logger = logger;
_runCancels = runCancels;
} }
public QueueSlotState? CurrentSlot => _slot; public QueueSlotState? CurrentSlot => _slot;
@@ -66,12 +69,14 @@ public sealed class OverrideSlotService
var cts = new CancellationTokenSource(); var cts = new CancellationTokenSource();
_slot = new QueueSlotState { TaskId = taskId, StartedAt = DateTime.UtcNow, Cts = cts }; _slot = new QueueSlotState { TaskId = taskId, StartedAt = DateTime.UtcNow, Cts = cts };
_runCancels.Register(taskId, cts);
_ = work(cts.Token).ContinueWith(t => _ = work(cts.Token).ContinueWith(t =>
{ {
if (t.IsFaulted) if (t.IsFaulted)
_logger.LogError(t.Exception, faultMessage, taskId); _logger.LogError(t.Exception, faultMessage, taskId);
lock (_lock) { _slot = null; } lock (_lock) { _slot = null; }
_runCancels.Unregister(taskId, cts);
cts.Dispose(); cts.Dispose();
}, TaskScheduler.Default); }, TaskScheduler.Default);
} }
+6 -1
View File
@@ -19,6 +19,7 @@ public sealed class QueueService : BackgroundService
private readonly IQueuePicker _picker; private readonly IQueuePicker _picker;
private readonly OverrideSlotService _override; private readonly OverrideSlotService _override;
private readonly ITaskStateService _state; private readonly ITaskStateService _state;
private readonly RunCancellationRegistry _runCancels;
private readonly object _lock = new(); private readonly object _lock = new();
private readonly Dictionary<string, QueueSlotState> _queueSlots = new(); private readonly Dictionary<string, QueueSlotState> _queueSlots = new();
@@ -31,7 +32,8 @@ public sealed class QueueService : BackgroundService
QueueWaker waker, QueueWaker waker,
IQueuePicker picker, IQueuePicker picker,
OverrideSlotService overrideSlot, OverrideSlotService overrideSlot,
ITaskStateService state) ITaskStateService state,
RunCancellationRegistry runCancels)
{ {
_dbFactory = dbFactory; _dbFactory = dbFactory;
_runner = runner; _runner = runner;
@@ -41,6 +43,7 @@ public sealed class QueueService : BackgroundService
_picker = picker; _picker = picker;
_override = overrideSlot; _override = overrideSlot;
_state = state; _state = state;
_runCancels = runCancels;
} }
public IReadOnlyList<(string slot, string taskId, DateTime startedAt)> GetActive() public IReadOnlyList<(string slot, string taskId, DateTime startedAt)> GetActive()
@@ -125,12 +128,14 @@ public sealed class QueueService : BackgroundService
{ {
var cts = CancellationTokenSource.CreateLinkedTokenSource(stoppingToken); var cts = CancellationTokenSource.CreateLinkedTokenSource(stoppingToken);
_queueSlots[task.Id] = new QueueSlotState { TaskId = task.Id, StartedAt = DateTime.UtcNow, Cts = cts }; _queueSlots[task.Id] = new QueueSlotState { TaskId = task.Id, StartedAt = DateTime.UtcNow, Cts = cts };
_runCancels.Register(task.Id, cts);
_ = RunInSlotAsync(task.Id, cts.Token).ContinueWith(t => _ = RunInSlotAsync(task.Id, cts.Token).ContinueWith(t =>
{ {
if (t.IsFaulted) if (t.IsFaulted)
_logger.LogError(t.Exception, "RunInSlotAsync failed for task {TaskId} in queue slot", task.Id); _logger.LogError(t.Exception, "RunInSlotAsync failed for task {TaskId} in queue slot", task.Id);
lock (_lock) { _queueSlots.Remove(task.Id); } lock (_lock) { _queueSlots.Remove(task.Id); }
_runCancels.Unregister(task.Id, cts);
cts.Dispose(); cts.Dispose();
_waker.Wake(); // Check for next task immediately. _waker.Wake(); // Check for next task immediately.
}, TaskScheduler.Default); }, TaskScheduler.Default);
@@ -0,0 +1,35 @@
using System.Collections.Concurrent;
namespace ClaudeDo.Worker.Queue;
/// Maps a running task id to the CancellationTokenSource driving its Claude process.
/// QueueService and OverrideSlotService register their slots here so components that
/// cancel tasks DB-side (TaskStateService.CancelAsync and its child cascade) can also
/// stop the process — without depending on the queue services, which would create a
/// DI cycle (QueueService → TaskRunner → ITaskStateService).
public sealed class RunCancellationRegistry
{
private readonly ConcurrentDictionary<string, CancellationTokenSource> _running = new(StringComparer.Ordinal);
public void Register(string taskId, CancellationTokenSource cts) => _running[taskId] = cts;
/// Removes the registration only if <paramref name="cts"/> is still the registered
/// one — a re-run may already have registered a newer CTS under the same task id.
public void Unregister(string taskId, CancellationTokenSource cts) =>
_running.TryRemove(new KeyValuePair<string, CancellationTokenSource>(taskId, cts));
public bool TryCancel(string taskId)
{
if (!_running.TryGetValue(taskId, out var cts)) return false;
try
{
cts.Cancel();
return true;
}
catch (ObjectDisposedException)
{
// Slot cleanup raced us; the run is already finished.
return false;
}
}
}
@@ -10,8 +10,12 @@ public sealed record ClaudeRunConfig(
int? MaxTurns = null, int? MaxTurns = null,
string? PermissionMode = null, string? PermissionMode = null,
string? McpConfigPath = null, string? McpConfigPath = null,
string? AllowedTools = null string? AllowedTools = null,
); IReadOnlyList<string>? SkillNames = null
)
{
public IReadOnlyList<string> SkillNames { get; init; } = SkillNames ?? Array.Empty<string>();
}
public sealed class ClaudeArgsBuilder public sealed class ClaudeArgsBuilder
{ {
@@ -1,49 +0,0 @@
using ClaudeDo.Worker.Config;
namespace ClaudeDo.Worker.Runner;
// Stops interactive/streaming sessions that have gone idle. Interactive `claude` processes wait
// on stdin and never exit on their own, and there is no client-disconnect teardown — so an
// abandoned chat (UI closed, navigated away, crashed) keeps its claude.exe (+ conhost) alive for
// the worker's entire lifetime. Under a long-running autostart worker these pile up (observed:
// ~170 child processes). This sweep reaps the idle ones.
public sealed class IdleSessionReaper : BackgroundService
{
private static readonly TimeSpan SweepInterval = TimeSpan.FromMinutes(5);
private readonly LiveSessionRegistry _registry;
private readonly WorkerConfig _cfg;
private readonly ILogger<IdleSessionReaper> _logger;
public IdleSessionReaper(LiveSessionRegistry registry, WorkerConfig cfg, ILogger<IdleSessionReaper> logger)
{
_registry = registry;
_cfg = cfg;
_logger = logger;
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
var idleTimeout = TimeSpan.FromMinutes(_cfg.InteractiveIdleTimeoutMinutes);
if (idleTimeout <= TimeSpan.Zero)
return; // reaper disabled
using var timer = new PeriodicTimer(SweepInterval);
while (await timer.WaitForNextTickAsync(stoppingToken))
{
try
{
var reaped = await _registry.ReapIdleAsync(DateTime.UtcNow, idleTimeout);
if (reaped.Count > 0)
_logger.LogInformation(
"Reaped {session_count} idle interactive session(s) after {idle_minutes} min: {task_ids}",
reaped.Count, _cfg.InteractiveIdleTimeoutMinutes, string.Join(", ", reaped));
}
catch (OperationCanceledException) { throw; }
catch (Exception ex)
{
_logger.LogWarning(ex, "Idle session reap sweep failed");
}
}
}
}
@@ -0,0 +1,185 @@
using ClaudeDo.Data;
using ClaudeDo.Data.Models;
using ClaudeDo.Data.Repositories;
using ClaudeDo.Worker.Config;
using ClaudeDo.Worker.Planning;
using ClaudeDo.Worker.Skills;
using Microsoft.EntityFrameworkCore;
using TaskStatus = ClaudeDo.Data.Models.TaskStatus;
namespace ClaudeDo.Worker.Runner;
// Builds the launch spec an embedded ConPTY terminal needs to open an interactive Claude
// session in an existing task's worktree -- the SAME worktree prep as an autonomous run:
// session-skills seeded onto disk (reuses ISessionSkillSeeder + TaskRunner.UnionSkillNames,
// exactly like TaskRunner.RunAsync/ContinueAsync) and the same run environment variables
// (reuses ClaudeProcess's MCP_TOOL_TIMEOUT). Exe/Args reuse WindowsTerminalLauncher's
// --resume argument construction. Guards mirror WorkerHub.ResumeTaskInTerminal, except a
// never-run task (no persisted SessionId) is not an error here -- it's a fresh-start spec.
//
// The run-scoped "claudedo_run" MCP server (AskUser/SuggestImprovement) that TaskRunner
// wires per headless run is intentionally NOT reused: it exists so an unattended run can
// ask the user a question, which is moot when the user is already driving the session by
// hand. The always-on `mcp__claudedo__*` tools remain available via the globally-registered
// MCP server (installer's RegisterMcpStep), exactly as they already are for a plain
// `--resume` pickup in a Windows Terminal window.
public sealed class InteractiveLaunchSpecService : IInteractiveLaunchSpecService
{
private readonly IDbContextFactory<ClaudeDoDbContext> _dbFactory;
private readonly ISessionSkillSeeder _skillSeeder;
private readonly ISessionSkillRegistry _skillRegistry;
private readonly WorktreeManager _wtManager;
private readonly string _claudePath;
public InteractiveLaunchSpecService(
IDbContextFactory<ClaudeDoDbContext> dbFactory,
ISessionSkillSeeder skillSeeder,
ISessionSkillRegistry skillRegistry,
WorktreeManager wtManager,
WorkerConfig cfg)
{
_dbFactory = dbFactory;
_skillSeeder = skillSeeder;
_skillRegistry = skillRegistry;
_wtManager = wtManager;
_claudePath = cfg.ClaudeBin;
}
public async Task<LaunchSpec> BuildForTaskAsync(string taskId, CancellationToken ct)
{
await using var ctx = await _dbFactory.CreateDbContextAsync(ct);
var task = await new TaskRepository(ctx).GetByIdAsync(taskId, ct)
?? throw new KeyNotFoundException();
if (task.Status is TaskStatus.Running or TaskStatus.Queued)
throw new InvalidOperationException("Can't open an interactive session for a running or queued task -- interrupt it first.");
var worktree = await new WorktreeRepository(ctx).GetByTaskIdAsync(taskId, ct);
var isFreshWorktree = false;
if (worktree is null || worktree.State is not (WorktreeState.Active or WorktreeState.Kept))
{
// No usable worktree yet -- if the task's list points at a git repo, create one
// on demand via the SAME mechanism an autonomous run uses (WorktreeManager.CreateAsync:
// branch naming, base commit resolution, worktree-root strategy, DB registration).
var list = await new ListRepository(ctx).GetByIdAsync(task.ListId, ct);
if (list?.WorkingDir is null)
throw new InvalidOperationException("This task has no working directory configured -- can't create a worktree.");
await _wtManager.CreateAsync(task, list, ct);
worktree = await new WorktreeRepository(ctx).GetByTaskIdAsync(taskId, ct)
?? throw new InvalidOperationException("Worktree creation did not persist a worktree row.");
isFreshWorktree = true;
}
else if (!Directory.Exists(worktree.Path))
{
throw new InvalidOperationException("The task's worktree directory no longer exists.");
}
var listConfig = await new ListRepository(ctx).GetConfigAsync(task.ListId, ct);
var globalSettings = await new AppSettingsRepository(ctx).GetAsync(ct);
// A brand-new worktree has no prior session to resume, regardless of any session
// history the task accumulated before its previous worktree went away.
var run = isFreshWorktree ? null : await new TaskRunRepository(ctx).GetLatestByTaskIdAsync(taskId, ct);
var requestedSkills = TaskRunner.UnionSkillNames(task.SessionSkills, listConfig?.SessionSkills, globalSettings.SessionSkills);
var skillNames = await FilterToInstalledSkillsAsync(requestedSkills, ct);
await _skillSeeder.SeedAsync(worktree.Path, skillNames, isWorktree: true, ct);
var resolvedClaude = WindowsTerminalLauncher.Resolve(_claudePath)
?? throw new InvalidOperationException($"claude executable not found: {_claudePath}");
// Resume an existing session as-is; for a fresh session, seed the interactive TUI with
// the task's prompt (title + description) as claude's positional prompt so it starts on
// the task -- the user then supervises/answers rather than retyping it.
var args = run?.SessionId is { Length: > 0 } sessionId
? WindowsTerminalLauncher.BuildResumeArgs(sessionId)
: BuildFreshPromptArgs(task);
// Same run environment variable ClaudeProcess sets for every headless run: the
// AskUser MCP tool call caps at 60s unless raised, and lifting it is harmless for
// every other tool.
var env = new Dictionary<string, string>
{
["MCP_TOOL_TIMEOUT"] = "200000",
};
return new LaunchSpec(worktree.Path, resolvedClaude, args, env);
}
public LaunchSpec BuildPlanningStart(PlanningSessionStartContext ctx)
{
var resolvedClaude = WindowsTerminalLauncher.Resolve(_claudePath)
?? throw new InvalidOperationException($"claude executable not found: {_claudePath}");
// Mirrors the env the wt planning launcher set (MAX_THINKING_TOKENS + the per-session
// planning token); MCP_TOOL_TIMEOUT matches the other embedded-ConPTY specs. Applied to
// the UI process env at spawn time (see PtyTerminalSession) — process-global by design.
var env = new Dictionary<string, string>
{
["MAX_THINKING_TOKENS"] = "20000",
["CLAUDEDO_PLANNING_TOKEN"] = ctx.Token,
["MCP_TOOL_TIMEOUT"] = "200000",
};
return new LaunchSpec(
ctx.WorkingDir, resolvedClaude, WindowsTerminalLauncher.BuildPlanningStartArgs(ctx), env);
}
public LaunchSpec BuildPlanningResume(PlanningSessionResumeContext ctx)
{
var resolvedClaude = WindowsTerminalLauncher.Resolve(_claudePath)
?? throw new InvalidOperationException($"claude executable not found: {_claudePath}");
var env = new Dictionary<string, string>
{
["CLAUDEDO_PLANNING_TOKEN"] = ctx.Token,
["MCP_TOOL_TIMEOUT"] = "200000",
};
return new LaunchSpec(
ctx.WorkingDir, resolvedClaude, WindowsTerminalLauncher.BuildPlanningResumeArgs(ctx.ClaudeSessionId), env);
}
public Task<LaunchSpec> BuildForDirectoryAsync(string directory, CancellationToken ct)
{
if (!Directory.Exists(directory))
throw new InvalidOperationException($"Directory does not exist: {directory}");
var resolvedClaude = WindowsTerminalLauncher.Resolve(_claudePath)
?? throw new InvalidOperationException($"claude executable not found: {_claudePath}");
var env = new Dictionary<string, string>
{
["MCP_TOOL_TIMEOUT"] = "200000",
};
return Task.FromResult(new LaunchSpec(directory, resolvedClaude, Array.Empty<string>(), env));
}
// The positional prompt claude opens the interactive session on. Empty (no positional arg)
// if the task has neither a title nor a description.
private static IReadOnlyList<string> BuildFreshPromptArgs(TaskEntity task)
{
var title = task.Title?.Trim();
var description = task.Description?.Trim();
var prompt = (string.IsNullOrEmpty(title), string.IsNullOrEmpty(description)) switch
{
(false, false) => $"{title}\n\n{description}",
(false, true) => title!,
(true, false) => description!,
_ => string.Empty,
};
return string.IsNullOrEmpty(prompt) ? Array.Empty<string>() : new[] { prompt };
}
private async Task<IReadOnlyList<string>> FilterToInstalledSkillsAsync(IReadOnlyList<string> requested, CancellationToken ct)
{
if (requested.Count == 0) return requested;
var installed = (await _skillRegistry.ListAsync(ct))
.Select(s => s.Name)
.ToHashSet(StringComparer.Ordinal);
return requested.Where(installed.Contains).ToList();
}
}
@@ -1,11 +0,0 @@
namespace ClaudeDo.Worker.Runner.Interfaces;
public interface IClaudeStreamTransport : IAsyncDisposable
{
Task StartAsync(IReadOnlyList<string> args, string workingDirectory, CancellationToken ct);
Task WriteLineAsync(string jsonLine, CancellationToken ct);
event Func<string, Task>? LineReceived;
event Func<string, Task>? StderrReceived;
void Kill();
Task WaitForExitAsync();
}

Some files were not shown because too many files have changed in this diff Show More