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.
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
using ClaudeDo.Data;
|
||||
using ClaudeDo.Ui.ViewModels.Islands;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ClaudeDo.Ui.Tests.ViewModels;
|
||||
|
||||
public class TasksIslandOpenConPtySessionTests : IDisposable
|
||||
{
|
||||
private readonly string _dbPath;
|
||||
|
||||
public TasksIslandOpenConPtySessionTests()
|
||||
{
|
||||
_dbPath = Path.Combine(Path.GetTempPath(), $"claudedo_conpty_cmd_{Guid.NewGuid():N}.db");
|
||||
using var ctx = NewContext();
|
||||
ctx.Database.EnsureCreated();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
try { File.Delete(_dbPath); } catch { }
|
||||
try { File.Delete(_dbPath + "-wal"); } catch { }
|
||||
try { File.Delete(_dbPath + "-shm"); } catch { }
|
||||
}
|
||||
|
||||
private ClaudeDoDbContext NewContext()
|
||||
{
|
||||
var opts = new DbContextOptionsBuilder<ClaudeDoDbContext>()
|
||||
.UseSqlite($"Data Source={_dbPath}")
|
||||
.Options;
|
||||
return new ClaudeDoDbContext(opts);
|
||||
}
|
||||
|
||||
private sealed class TestDbFactory : IDbContextFactory<ClaudeDoDbContext>
|
||||
{
|
||||
private readonly Func<ClaudeDoDbContext> _create;
|
||||
public TestDbFactory(Func<ClaudeDoDbContext> create) => _create = create;
|
||||
public ClaudeDoDbContext CreateDbContext() => _create();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void OpenConPtySessionCommand_RaisesOpenConPtySessionRequested_WithTaskId()
|
||||
{
|
||||
var vm = new TasksIslandViewModel(new TestDbFactory(NewContext), worker: null);
|
||||
string? requestedId = null;
|
||||
vm.OpenConPtySessionRequested += id => requestedId = id;
|
||||
|
||||
vm.OpenConPtySessionCommand.Execute(new TaskRowViewModel { Id = "t1" });
|
||||
|
||||
Assert.Equal("t1", requestedId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void OpenConPtySessionCommand_NullRow_DoesNotRaiseEvent()
|
||||
{
|
||||
var vm = new TasksIslandViewModel(new TestDbFactory(NewContext), worker: null);
|
||||
var raised = false;
|
||||
vm.OpenConPtySessionRequested += _ => raised = true;
|
||||
|
||||
vm.OpenConPtySessionCommand.Execute(null);
|
||||
|
||||
Assert.False(raised);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user