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.
This commit is contained in:
@@ -107,6 +107,40 @@ public sealed class InteractiveLaunchSpecService : IInteractiveLaunchSpecService
|
||||
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))
|
||||
|
||||
@@ -1,7 +1,18 @@
|
||||
using ClaudeDo.Worker.Planning;
|
||||
|
||||
namespace ClaudeDo.Worker.Runner;
|
||||
|
||||
public interface IInteractiveLaunchSpecService
|
||||
{
|
||||
/// <summary>Maps an already-prepared planning START context (worktree + prompt files + token,
|
||||
/// produced by PlanningSessionManager.StartAsync) into a LaunchSpec for an embedded ConPTY
|
||||
/// planning session — same planning CLI args as the wt launcher, planning env carried in Env.</summary>
|
||||
LaunchSpec BuildPlanningStart(PlanningSessionStartContext ctx);
|
||||
|
||||
/// <summary>Maps a planning RESUME context (from PlanningSessionManager.ResumeAsync) into a
|
||||
/// LaunchSpec for an embedded ConPTY planning session (--permission-mode plan --resume).</summary>
|
||||
LaunchSpec BuildPlanningResume(PlanningSessionResumeContext ctx);
|
||||
|
||||
/// <summary>Builds a LaunchSpec for opening an interactive session in a task's worktree.
|
||||
/// Throws KeyNotFoundException if the task doesn't exist, InvalidOperationException
|
||||
/// if it's Running/Queued. If the task has no usable worktree yet, one is created on
|
||||
|
||||
Reference in New Issue
Block a user