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:
@@ -74,11 +74,7 @@ public sealed class WindowsTerminalLauncher : ITerminalLauncher
|
||||
var resolvedWt = ResolveWtOrThrow();
|
||||
var resolvedClaude = ResolveClaudeOrThrow();
|
||||
|
||||
var command = BuildPwshCommand(resolvedClaude, new[]
|
||||
{
|
||||
"--permission-mode", "plan",
|
||||
"--resume", ctx.ClaudeSessionId,
|
||||
});
|
||||
var command = BuildPwshCommand(resolvedClaude, BuildPlanningResumeArgs(ctx.ClaudeSessionId));
|
||||
|
||||
StartInWindowsTerminal(resolvedWt, ctx.WorkingDir, command, env =>
|
||||
{
|
||||
@@ -117,13 +113,21 @@ public sealed class WindowsTerminalLauncher : ITerminalLauncher
|
||||
// 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)
|
||||
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 BuildPwshCommand(claudePath, new[]
|
||||
return new[]
|
||||
{
|
||||
"--model", Model,
|
||||
"--permission-mode", "plan",
|
||||
@@ -131,9 +135,14 @@ public sealed class WindowsTerminalLauncher : ITerminalLauncher
|
||||
"--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. Pins --permission-mode plan (unlike a plain --resume pickup).
|
||||
internal static IReadOnlyList<string> BuildPlanningResumeArgs(string claudeSessionId) =>
|
||||
new[] { "--permission-mode", "plan", "--resume", claudeSessionId };
|
||||
|
||||
private string ResolveWtOrThrow() =>
|
||||
Resolve(_wtPath) ?? throw new TerminalLaunchException($"Windows Terminal not found: {_wtPath}");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user