feat: Add agent preview integration with auto-teardown and simplified commands

- Add agentId label to preview containers (cw.agent-id) for tracking
- Add startForAgent/stopByAgentId methods to PreviewManager
- Auto-teardown: previews torn down on agent:stopped event
- Conditional preview prompt injection for execute/refine/discuss agents
- Agent-simplified CLI: cw preview start/stop --agent <id>
- cw preview setup command with --auto mode for guided config generation
- hasPreviewConfig hint on cw project register output
- New tRPC procedures: startPreviewForAgent, stopPreviewByAgent
This commit is contained in:
Lukas May
2026-03-05 15:39:15 +01:00
parent 66605da30d
commit ebe186bd5e
10 changed files with 381 additions and 22 deletions

View File

@@ -128,6 +128,7 @@ export function generateLabels(opts: {
gatewayPort: number;
previewId: string;
mode: 'preview' | 'dev';
agentId?: string;
}): Record<string, string> {
const labels: Record<string, string> = {
[PREVIEW_LABELS.preview]: 'true',
@@ -143,5 +144,9 @@ export function generateLabels(opts: {
labels[PREVIEW_LABELS.phaseId] = opts.phaseId;
}
if (opts.agentId) {
labels[PREVIEW_LABELS.agentId] = opts.agentId;
}
return labels;
}