Skip to content
Merged
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
24 changes: 12 additions & 12 deletions crates/deep-code-agent/src/sandbox/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@ const LANDLOCK_ABI: ABI = ABI::V1;
/// Always-blocked syscalls (escape / privilege / host-tampering). Limited to
/// numbers present on both x86_64 and aarch64.
const DANGEROUS_SYSCALLS: &[i64] = &[
libc::SYS_ptrace as i64,
libc::SYS_mount as i64,
libc::SYS_umount2 as i64,
libc::SYS_pivot_root as i64,
libc::SYS_chroot as i64,
libc::SYS_reboot as i64,
libc::SYS_kexec_load as i64,
libc::SYS_init_module as i64,
libc::SYS_finit_module as i64,
libc::SYS_delete_module as i64,
libc::SYS_bpf as i64,
libc::SYS_ptrace,
libc::SYS_mount,
libc::SYS_umount2,
libc::SYS_pivot_root,
libc::SYS_chroot,
libc::SYS_reboot,
libc::SYS_kexec_load,
libc::SYS_init_module,
libc::SYS_finit_module,
libc::SYS_delete_module,
libc::SYS_bpf,
];

/// Blocked when the policy forbids network. Denying `socket` stops any new
/// socket (no network of any family); `connect` is belt-and-suspenders.
const NETWORK_SYSCALLS: &[i64] = &[libc::SYS_socket as i64, libc::SYS_connect as i64];
const NETWORK_SYSCALLS: &[i64] = &[libc::SYS_socket, libc::SYS_connect];

/// Write-class access rights: everything Landlock can govern minus the
/// read/execute rights, so reads stay unrestricted.
Expand Down
4 changes: 2 additions & 2 deletions crates/deep-code-agent/src/sandbox/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ pub fn detect_capabilities() -> SandboxCapabilities {

#[cfg(target_os = "linux")]
{
return linux::capabilities();
linux::capabilities()
}

#[cfg(target_os = "windows")]
{
return windows::capabilities();
windows::capabilities()
}

#[cfg(not(any(target_os = "macos", target_os = "linux", target_os = "windows")))]
Expand Down
2 changes: 1 addition & 1 deletion crates/deep-code-agent/src/session_store/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl SessionStore for JsonSessionStore {
}
}

records.sort_by(|left, right| right.updated_at_ms.cmp(&left.updated_at_ms));
records.sort_by_key(|record| std::cmp::Reverse(record.updated_at_ms));
Ok(records)
}

Expand Down
2 changes: 1 addition & 1 deletion crates/deep-code-agent/src/subagent/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl SubAgentManager {
.filter(|agent| agent.session_boot_id.as_deref() == Some(self.session_boot_id.as_str()))
.cloned()
.collect();
agents.sort_by(|left, right| right.started_at_ms.cmp(&left.started_at_ms));
agents.sort_by_key(|agent| std::cmp::Reverse(agent.started_at_ms));
agents
}

Expand Down
2 changes: 1 addition & 1 deletion crates/deep-code-runtime/src/threads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ impl RuntimeThreadStore {

pub async fn list_threads(&self) -> Vec<RuntimeThread> {
let mut threads = self.inner.lock().await.threads.clone();
threads.sort_by(|left, right| right.updated_at_ms.cmp(&left.updated_at_ms));
threads.sort_by_key(|thread| std::cmp::Reverse(thread.updated_at_ms));
threads
}

Expand Down
8 changes: 3 additions & 5 deletions crates/deep-code-tui/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,9 @@ impl App {
/// Cache hit rate as a percentage, or `None` when no prompt tokens were billed.
pub(crate) fn cache_hit_percent(hit: u32, miss: u32) -> Option<u8> {
let total = u64::from(hit) + u64::from(miss);
if total == 0 {
None
} else {
Some((u64::from(hit) * 100 / total) as u8)
}
(u64::from(hit) * 100)
.checked_div(total)
.map(|percent| percent as u8)
}

pub(crate) fn format_turn_telemetry(telemetry: &TurnTelemetry, currency: CostCurrency) -> String {
Expand Down
Loading