Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ portable-pty = "0.9.0"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
sha2 = "0.10"
tar = "0.4"
tar = "0.4.45"
tempfile = "3"
thiserror = "2"
time = { version = "0.3", features = ["formatting", "macros", "parsing", "serde", "serde-human-readable"] }
tokio = { version = "1.50.0", features = ["io-util", "macros", "net", "rt-multi-thread", "sync", "time"] }
ureq = "2.12"
ureq = "2.12.1"
uuid = { version = "1.22.0", features = ["serde", "v7"] }
webkit6 = { version = "0.6.1", features = ["v2_50"] }
xz2 = "0.1"
Expand Down
100 changes: 97 additions & 3 deletions crates/taskers-control/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,12 +382,18 @@ impl InMemoryController {
)
}
ControlCommand::StartSurfaceAgentSession {
workspace_id,
pane_id,
workspace_id: _,
pane_id: _,
surface_id,
agent_kind,
} => {
model.start_surface_agent_session(workspace_id, pane_id, surface_id, agent_kind)?;
let current = resolve_identify_context(model, None, None, Some(surface_id))?;
model.start_surface_agent_session(
current.workspace_id,
current.pane_id,
surface_id,
agent_kind,
)?;
(
ControlResponse::Ack {
message: "surface agent session started".into(),
Expand Down Expand Up @@ -1087,6 +1093,94 @@ mod tests {
);
}

#[test]
fn surface_agent_start_follows_a_moved_surface_even_with_stale_pane_context() {
let controller = InMemoryController::new(AppModel::new("Main"));
let snapshot = controller.snapshot();
let source_workspace = snapshot.model.active_workspace().expect("workspace");
let source_workspace_id = source_workspace.id;
let source_pane_id = source_workspace.active_pane;

controller
.handle(ControlCommand::CreateSurface {
workspace_id: source_workspace_id,
pane_id: source_pane_id,
kind: PaneKind::Browser,
})
.expect("create moved surface");
let moved_surface_id = controller
.snapshot()
.model
.workspaces
.get(&source_workspace_id)
.and_then(|workspace| workspace.panes.get(&source_pane_id))
.map(|pane| pane.active_surface)
.expect("moved surface");

controller
.handle(ControlCommand::CreateWorkspace {
label: "Docs".into(),
})
.expect("create target workspace");
let target_workspace_id = controller
.snapshot()
.model
.active_workspace_id()
.expect("target workspace");

controller
.handle(ControlCommand::MoveSurfaceToWorkspace {
source_workspace_id,
source_pane_id,
surface_id: moved_surface_id,
target_workspace_id,
})
.expect("move surface");

controller
.handle(ControlCommand::StartSurfaceAgentSession {
workspace_id: source_workspace_id,
pane_id: source_pane_id,
surface_id: moved_surface_id,
agent_kind: "codex".into(),
})
.expect("start moved surface agent session");

let snapshot = controller.snapshot();
let target_surface = snapshot
.model
.workspaces
.values()
.flat_map(|workspace| {
workspace.panes.values().flat_map(move |pane| {
pane.surfaces
.values()
.map(move |surface| (workspace, pane, surface))
})
})
.find(|(_, _, surface)| surface.id == moved_surface_id)
.expect("target surface");

assert_eq!(target_surface.0.id, target_workspace_id);
assert!(target_surface.2.agent_process.is_some());
assert!(target_surface.2.agent_session.is_none());
assert_eq!(
target_surface.2.metadata.agent_kind.as_deref(),
Some("codex")
);
assert_eq!(target_surface.2.metadata.agent_active, true);
assert!(
snapshot
.model
.workspaces
.get(&source_workspace_id)
.and_then(|workspace| workspace.panes.get(&source_pane_id))
.and_then(|pane| pane.active_surface())
.and_then(|surface| surface.agent_process.as_ref())
.is_none()
);
}

#[test]
fn surface_agent_stop_follows_a_moved_surface_even_with_stale_pane_context() {
let controller = InMemoryController::new(AppModel::new("Main"));
Expand Down
4 changes: 2 additions & 2 deletions crates/taskers-ghostty/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ build = "build.rs"
[dependencies]
libloading = "0.8"
serde.workspace = true
tar = "0.4"
tar.workspace = true
taskers-domain = { version = "0.3.1", path = "../taskers-domain" }
taskers-paths.workspace = true
taskers-runtime = { version = "0.3.1", path = "../taskers-runtime" }
thiserror.workspace = true
ureq = "2.12"
ureq.workspace = true
xz2 = "0.1"

[target.'cfg(target_os = "linux")'.dependencies]
Expand Down