feat(v0.5): launch agent inside project subdirectory via launch_dir

LaunchOpts gains LaunchDir. session.Run resolves it via
workspace.ResolveLaunch, prints any fallback warning, and passes the
absolute path as the child process's working directory. Security
violations (absolute paths, .. escape) abort the session. The banner
gains a 'project dir: <name>/' line when launch_dir is set.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-22 19:49:29 -04:00
parent 509a6d64ea
commit 103f2cd33e
6 changed files with 68 additions and 20 deletions
+7 -2
View File
@@ -37,11 +37,16 @@ func PromptPrefix(slug, mode string) string {
}
// BannerLines returns the launch banner lines for agent mode.
func BannerLines(mode, slug, wsPath string) []string {
return []string{
// Adds a "project dir:" line when launchDir is non-empty.
func BannerLines(mode, slug, wsPath, launchDir string) []string {
lines := []string{
fmt.Sprintf("[ctask] %s :: %s", mode, slug),
fmt.Sprintf("[ctask] %s", wsPath),
}
if launchDir != "" {
lines = append(lines, fmt.Sprintf("[ctask] project dir: %s/", launchDir))
}
return lines
}
// ContainerNotice returns the v0.1 deferred container mode message.