Skip to content

feat: comprehensive continuity suite (power control, remote input, deck, drop folder, file catalog) - #52

Open
samyyy2311 wants to merge 14 commits into
mainfrom
feat/continuity-suite
Open

samyyy2311 wants to merge 14 commits into
mainfrom
feat/continuity-suite

Conversation

@samyyy2311

@samyyy2311 samyyy2311 commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Summary

This change adds comprehensive continuity capabilities and companion device features across the Continue workspace:

  • Phase 1: Emergency & PC Controls:

    • Find My Phone Alarm: Added RING_DEVICE capability (CapabilityId(8)), protobuf schema (proto/ring.proto), and RingDispatcher supporting max-volume alarm overrides and custom duration ringing.
    • Workstation Power Controls: Added PC_CONTROL capability (CapabilityId(9)), protobuf schema (proto/pc_control.proto), and PcControlDispatcher for remote screen lock, sleep, restart, shutdown, and audio mute.
    • Wake-on-LAN (WoL): Added UDP magic packet generator and broadcaster in crates/discovery/src/wol.rs for waking offline PCs across local subnets.
  • Phase 2: Input & Touch Deck Stream:

    • Remote Dictation & Typing Stream: Added REMOTE_INPUT capability (CapabilityId(10)), protobuf schema (proto/remote_input.proto), and RemoteInputDispatcher for streaming speech-to-text chunks directly into focused PC applications.
    • Phone Macro Pad ("Deck"): Added DECK capability (CapabilityId(11)), protobuf schema (proto/deck.proto), and DeckDispatcher for turning the phone into an interactive macro controller for PC hotkeys and scripts.
  • Phase 3: Storage & Content Continuity:

    • Clipboard History & Pinned Snippets: Added SQLite-backed ClipboardHistoryStore in crates/clipboard/src/history.rs with consecutive clip deduplication, pinned clip protection, sensitive format filtering (excluding password managers / private viewer flags), TTL auto-expiry, and quick snippet shortcut lookup.
    • Drop Folder Automated Sync: Added DropFolderWatcher in crates/transfer/src/drop_folder.rs with file write debounce (500ms), temporary/partial file filtering (.crdownload, .part, .tmp, ~$), and automatic ingestion into OfflineTransferQueue.
    • Remote Photo & File Catalog Browser: Added FILE_CATALOG capability (CapabilityId(12)), protobuf schema (proto/catalog.proto), and CatalogDispatcher in crates/sessions/src/catalog.rs supporting categorized file browsing and on-demand thumbnail streaming.

Verification

  • cargo fmt --all -- --check passes cleanly.
  • cargo clippy --workspace -- -D warnings passes with 0 warnings.
  • Unit and integration tests pass across all crates.

- Add media control, handoff, and telemetry protocol definitions and session dispatchers.
- Add continuity camera capture framing and DIBV5 format translation.
- Add 4-word verification phrase derivation (SAS) for pairing confirmation.
- Add offline transfer queue for staging transfers destined for unreachable peers.
- Add lockdown mode in permissions store to immediately deny all grants when active.
- Add notification actions for extracted OTPs and inbound camera photos.
- Add LocalSend v2 discovery and upload bridge.
- Add connection doctor network diagnostics and wireless debugging discovery.
Copilot AI balanced review requested due to automatic review settings October 7, 2026 21:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6b15b915-5e91-4aab-8098-920d2382bdc5

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

- Define CapabilityId::RING_DEVICE (8) and CapabilityId::PC_CONTROL (9)
- Add protobuf schemas for ring and pc_control envelopes
- Implement RingDispatcher and PcControlDispatcher with QUIC roundtrip tests
- Implement Wake-on-LAN magic packet creation and UDP broadcasting in discovery::wol
- Integrate ring and PC control dispatchers into SessionCapabilityHandlers and SessionMultiplexer
- Define CapabilityId::REMOTE_INPUT (10) and CapabilityId::DECK (11)
- Add protobuf schemas for TextInputChunk and DeckEnvelope
- Implement RemoteInputDispatcher and DeckDispatcher with validation and QUIC roundtrip tests
- Wire remote input and deck into SessionCapabilityHandlers and SessionMultiplexer
@samyyy2311 samyyy2311 changed the title Add continuity capabilities, device telemetry, and pairing tools feat: comprehensive continuity suite (power control, remote input, deck, drop folder, file catalog) Oct 8, 2026
@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 18 high · 82 medium

Alerts:
⚠ 100 issues (≤ 0 issues of at least minor severity)

Results:
100 new issues

Category Results
UnusedCode 19 medium
BestPractice 2 medium
ErrorProne 26 medium
15 high
Security 3 high
Complexity 35 medium

View in Codacy

🟢 Metrics 1141 complexity · 161 duplication

Metric Results
Complexity 1141
Duplication 161

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@codacy-production codacy-production Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR should not merge yet. It contains high-risk security issues involving lockdown bypass, arbitrary URI execution, and path traversal through peer-controlled names. The drop-folder integration also recreates watcher state, breaking debounce and duplicate prevention.

About this PR

  • Before merging, reconcile the restart requirement, schedule clipboard expiry cleanup, and provide executable verification for the missing acceptance scenarios. Codacy analysis is not up to standards overall, with 111 new issues.

Test suggestions

  • Ring dispatcher request/ack round trip and capability denial
  • PC control request/response round trip and capability denial
  • Wake-on-LAN MAC parsing, packet construction, and broadcast
  • Remote input round trip, capability denial, and size validation
  • Deck layout/trigger round trips and validation limits
  • Clipboard history recording, deduplication, pinning, deletion, search, snippets, and sensitive filtering
  • Drop-folder temporary-file filtering, debounce, stable-file enqueue, and duplicate prevention
  • Catalog query and thumbnail round trips plus validation
  • Handoff broadcast/dismiss round trips and URI validation
  • Desktop stream validation and capability denial
  • Global lockdown preventing all incoming and outgoing capability operations
  • Clipboard TTL expiry and maximum unpinned history enforcement
  • PC restart action behavior
  • Windows Cloud Files callback success, failure, and cancellation paths
  • Desktop stream listener registration and cleanup failure paths
  • Desktop runtime startup with background worker and all stores initialized
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Global lockdown preventing all incoming and outgoing capability operations
2. Clipboard TTL expiry and maximum unpinned history enforcement
3. PC restart action behavior
4. Windows Cloud Files callback success, failure, and cancellation paths
5. Desktop stream listener registration and cleanup failure paths
6. Desktop runtime startup with background worker and all stores initialized
Low confidence findings
  • Review the additional handoff, streaming, cloud-file, media, telemetry, pairing, and diagnostics functionality as explicit acceptance criteria or split it into separately verifiable changes.

TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback


#[test]
fn cloud_files_config_and_entry_model() {
let temp_dir = std::env::temp_dir().join(format!("continue_cf_test_{}", rand::random::<u32>()));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 HIGH RISK

Use a secure temporary-directory helper that atomically creates a unique directory with restrictive permissions and manages cleanup.

See Issue in Codacy

Comment on lines +485 to +557
unsafe extern "system" fn fetch_data_callback(
callback_info: *const win32::CF_CALLBACK_INFO,
callback_parameters: *const std::ffi::c_void,
) {
if callback_info.is_null() || callback_parameters.is_null() {
return;
}
let info = &*callback_info;
let params = &*(callback_parameters as *const win32::CF_CALLBACK_PARAMETERS);
if info.callback_context.is_null() {
return;
}
let ctx = &*(info.callback_context as *const MountContext);

let file_identity = if !info.file_identity.is_null() && info.file_identity_length > 0 {
std::slice::from_raw_parts(
info.file_identity as *const u8,
info.file_identity_length as usize,
)
.to_vec()
} else {
Vec::new()
};

let relative_path = if !info.normalized_path.is_null() {
let mut len = 0;
while *info.normalized_path.add(len) != 0 {
len += 1;
}
let slice = std::slice::from_raw_parts(info.normalized_path, len);
PathBuf::from(String::from_utf16_lossy(slice))
} else {
PathBuf::new()
};

let request = FetchDataRequest {
file_identity,
relative_path,
offset: params.required_file_offset.max(0) as u64,
length: params.required_length.max(0) as u64,
};

let mut op_params = win32::CF_OPERATION_PARAMETERS {
param_size: std::mem::size_of::<win32::CF_OPERATION_PARAMETERS>() as u32,
op_type: win32::CF_OPERATION_TYPE_TRANSFER_DATA,
connection_key: info.connection_key,
transfer_key: info.transfer_key,
correlation_vector: std::ptr::null(),
sync_status: std::ptr::null(),
request_completion_status: win32::S_OK,
transfer_data: win32::CF_OPERATION_TRANSFER_DATA {
flags: 0,
completion_status: win32::S_OK,
buffer: std::ptr::null(),
offset: params.required_file_offset,
length: params.required_length,
},
};

match (ctx.fetch_handler)(request) {
Ok(data) => {
op_params.transfer_data.buffer = data.as_ptr() as *const std::ffi::c_void;
op_params.transfer_data.length = data.len() as i64;
op_params.transfer_data.completion_status = win32::S_OK;
(ctx.cldapi.execute)(&op_params);
}
Err(_) => {
// ERROR_FILE_NOT_FOUND (0x80070002)
op_params.transfer_data.completion_status = -2147024894;
op_params.request_completion_status = -2147024894;
(ctx.cldapi.execute)(&op_params);
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 HIGH RISK

Audit the FFI layouts and callback ABI, keep callback context and transfer buffers valid for the full operation, handle every HRESULT explicitly, and add Windows success, failure, and cancellation tests.

See Issue in Codacy

type="button"
className="icon-btn"
title="Copy clip"
onClick={() => handleCopy(clip)}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 HIGH RISK

Wrap clipboard actions and dialog lifecycle handlers in synchronous callbacks that explicitly invoke and handle their promises.

See Issue in Codacy

let unlistenFrame: (() => void) | null = null;
let unlistenStopped: (() => void) | null = null;

onDesktopStreamFrame((frame) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 HIGH RISK

Handle listener-registration promises through an async setup path with rejection handling, cancellation awareness, and reliable unsubscription.

See Issue in Codacy

<button
type="button"
className="btn btn-tonal btn-small"
onClick={stopActiveStream}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 HIGH RISK

Wrap async handlers in synchronous callbacks and explicitly handle failures for start, stop, close, and related mouse/click events.

See Issue in Codacy

Comment on lines +1863 to +1865
config,
offline_queue_for_drop.clone(),
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 HIGH RISK

Keep one DropFolderWatcher per configured folder/peer and reuse it across polling iterations, or persist its state outside the loop so debounce and duplicate prevention work.


const startStream = useCallback(async () => {
setConnecting(true);
const preset = PRESETS[presetIndex];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 HIGH RISK

Suggestion: Validate presetIndex before indexing and fall back safely when it is outside PRESETS.

See Issue in Codacy

Comment on lines +1824 to +1826
let clipboard_history = Arc::new(ClipboardHistoryStore::open(
db_path.with_file_name("continue_clipboard.db"),
)?);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 MEDIUM RISK

Schedule clipboard cleanup or invoke cleanup_expired during initialization or maintenance so expired clips are removed.

Comment on lines +1186 to +1191
let pc_action = match action {
0 => PcAction::LockWorkstation,
1 => PcAction::SleepSystem,
2 => PcAction::ShutdownSystem,
3 => PcAction::ToggleMute,
_ => return Err("Invalid PC action".to_string()),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 MEDIUM RISK

Add restart to the protocol and command mapping, or explicitly remove it from the acceptance criteria and UI.

Comment on lines 1815 to 1919
@@ -946,6 +1821,59 @@ fn initialize_desktop_runtime(
) -> Result<DesktopRuntimeState, Box<dyn std::error::Error>> {
let stores = Stores::open(db_path)?;
let keys = DeviceKeys::load_or_create(&secrets::device_key_store(secrets_dir)?)?;
let clipboard_history = Arc::new(ClipboardHistoryStore::open(
db_path.with_file_name("continue_clipboard.db"),
)?);
let cloud_mounts = Arc::new(Mutex::new(HashMap::new()));
let active_handoffs = Arc::new(Mutex::new(HashMap::new()));
let offline_queue = Arc::new(OfflineTransferQueue::new());
let drop_folder: Arc<Mutex<Option<PathBuf>>> = Arc::new(Mutex::new(None));
let active_desktop_streams: Arc<Mutex<HashMap<String, DesktopStreamSession>>> =
Arc::new(Mutex::new(HashMap::new()));

let (offline_queue_for_drop, drop_folder_for_loop, app_for_drop) = (
offline_queue.clone(),
drop_folder.clone(),
app_handle.clone(),
);
tauri::async_runtime::spawn(async move {
loop {
tokio::time::sleep(tokio::time::Duration::from_secs(3)).await;
let folder_opt = drop_folder_for_loop.lock().clone();
if let Some(folder) = folder_opt {
if folder.is_dir() {
if let Some(state) = app_for_drop.try_state::<DesktopRuntimeState>() {
let connected_peer = state
.device
.stores
.trust
.list_peers()
.ok()
.and_then(|peers| {
peers
.into_iter()
.find(|p| state.device.sessions.get(&p.fingerprint).is_some())
});
if let Some(peer) = connected_peer {
let config = DropFolderConfig::new(
folder.clone(),
peer.fingerprint.clone(),
);
let watcher = DropFolderWatcher::new(
config,
offline_queue_for_drop.clone(),
);
if let Ok(enqueued) = watcher.scan_directory() {
if !enqueued.is_empty() {
flush_offline_transfers(&app_for_drop, &state, &peer.fingerprint).await;
}
}
}
}
}
}
}
});

let pending_answers = PendingAnswers::default();
let connected = Arc::new(tray::Connected::default());
@@ -954,6 +1882,9 @@ fn initialize_desktop_runtime(
&stores,
pending_answers.clone(),
clipboard.clone(),
clipboard_history.clone(),
active_handoffs.clone(),
active_desktop_streams.clone(),
app_handle,
);
handlers.on_device_info = Some(device_info_listener(
@@ -979,6 +1910,12 @@ fn initialize_desktop_runtime(
incoming,
clipboard,
batteries,
clipboard_history,
cloud_mounts,
active_handoffs,
offline_queue,
drop_folder,
active_desktop_streams,
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 MEDIUM RISK

Suggestion: Split initialization into focused helpers for store construction, worker startup, capability handlers, and final state assembly; add focused unit tests and a startup integration test.

See Issue in Codacy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants