Skip to content

Commit 1c29399

Browse files
committed
fix wasm builds
1 parent 7272c81 commit 1c29399

7 files changed

Lines changed: 76 additions & 28 deletions

File tree

app/src/ai/blocklist/agent_view/agent_input_footer/mod.rs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,9 @@ pub struct AgentInputFooter {
228228
// Fast-forward (auto-approve) toggle button shown in the agent view footer.
229229
fast_forward_button: ViewHandle<ActionButton>,
230230

231-
// "Hand off to cloud" chip. Visibility is gated only on the
232-
// `OzHandoff && HandoffLocalCloud` feature flags. Per-conversation
233-
// eligibility is enforced by `Workspace::start_local_to_cloud_handoff`,
234-
// which falls through to splitting a fresh cloud-mode pane when the
235-
// active conversation isn't handoff-able.
231+
// "Hand off to cloud" chip. Visibility is gated on native/local handoff
232+
// availability. Per-conversation eligibility is enforced by
233+
// `Workspace::start_local_to_cloud_handoff`.
236234
handoff_to_cloud_button: ViewHandle<ActionButton>,
237235

238236
// CLI agent voice input state (self-contained, bypasses editor voice flow).
@@ -358,9 +356,7 @@ impl AgentInputFooter {
358356

359357
// "Hand off to cloud" chip. On click dispatches the workspace action that
360358
// splits a new cloud-mode pane next to the local pane; that pane handles
361-
// the rest of the handoff flow. The chip is always visible when the feature
362-
// flags are on; per-conversation eligibility falls through to splitting a
363-
// fresh cloud-mode pane in `Workspace::start_local_to_cloud_handoff`.
359+
// the rest of the handoff flow when native/local handoff is available.
364360
let handoff_to_cloud_button = ctx.add_typed_action_view(|_ctx| {
365361
ActionButton::new("", AgentInputButtonTheme)
366362
.with_icon(Icon::UploadCloud)
@@ -1976,12 +1972,10 @@ impl AgentInputFooter {
19761972
.is_enabled()
19771973
.then(|| ChildView::new(&self.fast_forward_button).finish()),
19781974
AgentToolbarItemKind::HandoffToCloud => {
1979-
if !FeatureFlag::OzHandoff.is_enabled()
1980-
|| !FeatureFlag::HandoffLocalCloud.is_enabled()
1981-
{
1975+
if !AgentToolbarItemKind::handoff_to_cloud_available() {
19821976
return None;
19831977
}
1984-
// Always render the chip when the feature flags are on.
1978+
// Render the chip when the native/local handoff surface is available.
19851979
// Per-conversation eligibility (synced server token, non-empty
19861980
// history) is enforced by `Workspace::start_local_to_cloud_handoff`,
19871981
// which falls through to splitting a fresh cloud-mode pane when
@@ -2451,9 +2445,11 @@ impl TypedActionView for AgentInputFooter {
24512445
});
24522446
}
24532447
AgentInputFooterAction::OpenHandoffPane => {
2454-
ctx.emit(AgentInputFooterEvent::OpenHandoffPane {
2455-
initial_prompt: None,
2456-
});
2448+
if AgentToolbarItemKind::handoff_to_cloud_available() {
2449+
ctx.emit(AgentInputFooterEvent::OpenHandoffPane {
2450+
initial_prompt: None,
2451+
});
2452+
}
24572453
}
24582454
AgentInputFooterAction::ShowContextMenu { position } => {
24592455
ctx.emit(AgentInputFooterEvent::ShowContextMenu {

app/src/ai/blocklist/agent_view/agent_input_footer/toolbar_item.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ pub enum AgentToolbarItemKind {
7474
}
7575

7676
impl AgentToolbarItemKind {
77+
pub fn handoff_to_cloud_available() -> bool {
78+
FeatureFlag::OzHandoff.is_enabled()
79+
&& FeatureFlag::HandoffLocalCloud.is_enabled()
80+
&& cfg!(all(feature = "local_fs", not(target_family = "wasm")))
81+
}
7782
pub fn available_in(&self) -> ToolbarAvailability {
7883
match self {
7984
Self::ContextChip(_) | Self::VoiceInput | Self::FileAttach | Self::ShareSession => {
@@ -187,7 +192,7 @@ impl AgentToolbarItemKind {
187192
{
188193
items.push(Self::ShareSession);
189194
}
190-
if FeatureFlag::OzHandoff.is_enabled() && FeatureFlag::HandoffLocalCloud.is_enabled() {
195+
if Self::handoff_to_cloud_available() {
191196
items.push(Self::HandoffToCloud);
192197
}
193198
items.push(Self::VoiceInput);
@@ -216,7 +221,7 @@ impl AgentToolbarItemKind {
216221
{
217222
items.push(Self::ShareSession);
218223
}
219-
if FeatureFlag::OzHandoff.is_enabled() && FeatureFlag::HandoffLocalCloud.is_enabled() {
224+
if Self::handoff_to_cloud_available() {
220225
items.push(Self::HandoffToCloud);
221226
}
222227
items

app/src/search/slash_command_menu/static_commands/commands.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,10 @@ fn all_commands() -> Vec<StaticCommand> {
701701
commands.push(CLOUD_AGENT.clone());
702702
}
703703

704-
if FeatureFlag::OzHandoff.is_enabled() && FeatureFlag::HandoffLocalCloud.is_enabled() {
704+
if FeatureFlag::OzHandoff.is_enabled()
705+
&& FeatureFlag::HandoffLocalCloud.is_enabled()
706+
&& cfg!(all(feature = "local_fs", not(target_family = "wasm")))
707+
{
705708
commands.push(MOVE_TO_CLOUD.clone());
706709
}
707710

app/src/terminal/input/slash_commands/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,7 @@ impl Input {
876876
ctx.dispatch_typed_action(&TerminalAction::ToggleUsageFooter);
877877
}
878878
}
879+
#[cfg(all(feature = "local_fs", not(target_family = "wasm")))]
879880
move_to_cloud if command.name == commands::MOVE_TO_CLOUD.name => {
880881
if !FeatureFlag::OzHandoff.is_enabled()
881882
|| !FeatureFlag::HandoffLocalCloud.is_enabled()

app/src/terminal/view/ambient_agent/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ pub use host_selector::{
1919
Host, HostSelector, HostSelectorAction, HostSelectorEvent, NakedHeaderButtonTheme,
2020
};
2121
pub use loading_screen::{render_cloud_mode_error_screen, render_cloud_mode_loading_screen};
22+
#[cfg(all(feature = "local_fs", not(target_family = "wasm")))]
23+
pub use model::HandoffSubmissionState;
24+
#[cfg(all(feature = "local_fs", not(target_family = "wasm")))]
2225
pub(crate) use model::PendingHandoff;
23-
pub use model::{
24-
AgentProgress, AmbientAgentViewModel, AmbientAgentViewModelEvent, HandoffSubmissionState,
25-
Status,
26-
};
26+
pub use model::{AgentProgress, AmbientAgentViewModel, AmbientAgentViewModelEvent, Status};
2727
pub use model_selector::{ModelSelector, ModelSelectorAction, ModelSelectorEvent};
2828
pub use progress::{render_progress, ProgressProps, ProgressStep, ProgressStepState};
2929
pub use progress_ui_state::AmbientAgentProgressUIState;

app/src/terminal/view/ambient_agent/model.rs

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ use warpui::r#async::{SpawnedFutureHandle, Timer};
99
use warpui::{AppContext, Entity, EntityId, ModelContext, SingletonEntity};
1010

1111
use crate::ai::active_agent_views_model::ActiveAgentViewsModel;
12+
#[cfg(all(feature = "local_fs", not(target_family = "wasm")))]
1213
use crate::ai::agent::api::ServerConversationToken;
1314
use crate::ai::agent::{conversation::AIConversationId, extract_user_query_mode};
15+
#[cfg(all(feature = "local_fs", not(target_family = "wasm")))]
1416
use crate::ai::agent_sdk::driver::upload_snapshot_for_handoff;
1517
use crate::ai::ambient_agents::spawn::{spawn_task, submit_run_followup, AmbientAgentEvent};
1618
use crate::ai::ambient_agents::task::HarnessConfig;
@@ -19,6 +21,7 @@ use crate::ai::ambient_agents::AmbientAgentTaskId;
1921
use crate::ai::ambient_agents::{
2022
OUT_OF_CREDITS_TASK_FAILURE_MESSAGE, SERVER_OVERLOADED_TASK_FAILURE_MESSAGE,
2123
};
24+
#[cfg(all(feature = "local_fs", not(target_family = "wasm")))]
2225
use crate::ai::blocklist::handoff::touched_repos::TouchedWorkspace;
2326
use crate::ai::blocklist::BlocklistAIHistoryModel;
2427
use crate::ai::cloud_environments::CloudAmbientAgentEnvironment;
@@ -73,6 +76,7 @@ pub enum SessionStartupKind {
7376
/// the pane opens; flips to `Starting` when the user submits and the snapshot
7477
/// upload runs; flips to `Failed` if the upload fails so the user can retry by
7578
/// re-submitting from the same pane.
79+
#[cfg(all(feature = "local_fs", not(target_family = "wasm")))]
7680
#[derive(Debug, Clone, PartialEq, Eq, Default)]
7781
pub enum HandoffSubmissionState {
7882
#[default]
@@ -85,6 +89,7 @@ pub enum HandoffSubmissionState {
8589
/// fresh cloud-mode pane and consumed by `submit_handoff`. Its presence is the
8690
/// single source of truth for "this pane is in handoff mode" via
8791
/// `is_local_to_cloud_handoff()`.
92+
#[cfg(all(feature = "local_fs", not(target_family = "wasm")))]
8893
#[derive(Debug, Clone)]
8994
pub(crate) struct PendingHandoff {
9095
/// Source conversation id (the local conversation's `server_conversation_token`).
@@ -175,6 +180,7 @@ pub struct AmbientAgentViewModel {
175180
pending_followup_prompt: Option<String>,
176181

177182
/// See [`PendingHandoff`].
183+
#[cfg(all(feature = "local_fs", not(target_family = "wasm")))]
178184
pending_handoff: Option<PendingHandoff>,
179185
}
180186

@@ -210,6 +216,7 @@ impl AmbientAgentViewModel {
210216
active_execution_session_id: None,
211217
last_ended_execution_session_id: None,
212218
pending_followup_prompt: None,
219+
#[cfg(all(feature = "local_fs", not(target_family = "wasm")))]
213220
pending_handoff: None,
214221
}
215222
}
@@ -363,7 +370,14 @@ impl AmbientAgentViewModel {
363370
/// spawn, so post-spawn flows (queued-prompt rendering, V2-input suppression,
364371
/// submit interception) all observe the same source of truth.
365372
pub(crate) fn is_local_to_cloud_handoff(&self) -> bool {
366-
self.pending_handoff.is_some()
373+
#[cfg(all(feature = "local_fs", not(target_family = "wasm")))]
374+
{
375+
self.pending_handoff.is_some()
376+
}
377+
#[cfg(not(all(feature = "local_fs", not(target_family = "wasm"))))]
378+
{
379+
false
380+
}
367381
}
368382

369383
/// True when this pane is a handoff pane AND the async
@@ -373,15 +387,23 @@ impl AmbientAgentViewModel {
373387
/// must leave the prompt and pending attachments alone instead of
374388
/// silently dropping them on the floor.
375389
pub(crate) fn is_handoff_ready_to_submit(&self) -> bool {
376-
let Some(handoff) = self.pending_handoff.as_ref() else {
377-
return false;
378-
};
379-
handoff.touched_workspace.is_some()
380-
&& !matches!(handoff.submission_state, HandoffSubmissionState::Starting)
390+
#[cfg(all(feature = "local_fs", not(target_family = "wasm")))]
391+
{
392+
let Some(handoff) = self.pending_handoff.as_ref() else {
393+
return false;
394+
};
395+
handoff.touched_workspace.is_some()
396+
&& !matches!(handoff.submission_state, HandoffSubmissionState::Starting)
397+
}
398+
#[cfg(not(all(feature = "local_fs", not(target_family = "wasm"))))]
399+
{
400+
false
401+
}
381402
}
382403

383404
/// Seeds the handoff context onto this pane. Called by the workspace bootstrap
384405
/// after splitting in a fresh cloud-mode pane and entering agent view.
406+
#[cfg(all(feature = "local_fs", not(target_family = "wasm")))]
385407
pub(crate) fn set_pending_handoff(
386408
&mut self,
387409
pending: Option<PendingHandoff>,
@@ -393,6 +415,7 @@ impl AmbientAgentViewModel {
393415

394416
/// Updates the touched workspace once async derivation completes.
395417
/// No-op when no handoff context is set.
418+
#[cfg(all(feature = "local_fs", not(target_family = "wasm")))]
396419
pub(crate) fn set_pending_handoff_workspace(
397420
&mut self,
398421
workspace: TouchedWorkspace,
@@ -407,6 +430,7 @@ impl AmbientAgentViewModel {
407430

408431
/// Updates the submission state on the pending handoff. No-op when no handoff
409432
/// context is set.
433+
#[cfg(all(feature = "local_fs", not(target_family = "wasm")))]
410434
pub(crate) fn set_pending_handoff_submission_state(
411435
&mut self,
412436
state: HandoffSubmissionState,
@@ -1139,6 +1163,7 @@ impl AmbientAgentViewModel {
11391163
/// set and routes it through the same `spawn_agent_with_request` path that
11401164
/// regular cloud-mode runs use — so `WaitingForSession` → `SessionStarted`
11411165
/// streaming reaches the same pane unchanged.
1166+
#[cfg(all(feature = "local_fs", not(target_family = "wasm")))]
11421167
pub(crate) fn submit_handoff(
11431168
&mut self,
11441169
prompt: String,
@@ -1221,6 +1246,16 @@ impl AmbientAgentViewModel {
12211246
);
12221247
}
12231248

1249+
#[cfg(not(all(feature = "local_fs", not(target_family = "wasm"))))]
1250+
pub(crate) fn submit_handoff(
1251+
&mut self,
1252+
prompt: String,
1253+
attachments: Vec<AttachmentInput>,
1254+
ctx: &mut ModelContext<Self>,
1255+
) {
1256+
self.spawn_agent(prompt, attachments, ctx);
1257+
}
1258+
12241259
/// Cancels the ambient agent task if one is currently running.
12251260
/// Sends a cancellation request to the server (if task_id is available) and transitions to the Cancelled state.
12261261
pub fn cancel_task(&mut self, ctx: &mut ModelContext<Self>) {

app/src/workspace/view.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,15 @@ use crate::util::openable_file_type::FileTarget;
113113
#[cfg(feature = "local_fs")]
114114
use crate::util::openable_file_type::{resolve_file_target_with_editor_choice, EditorLayout};
115115

116+
#[cfg(all(feature = "local_fs", not(target_family = "wasm")))]
116117
use crate::ai::blocklist::agent_view::agent_input_footer::sort_environments_by_recency;
118+
#[cfg(all(feature = "local_fs", not(target_family = "wasm")))]
117119
use crate::ai::blocklist::handoff::touched_repos::{
118120
derive_touched_workspace, extract_paths_from_conversation, pick_handoff_overlap_env,
119121
};
120122
use crate::ai::blocklist::history_model::CloudConversationData;
121123
use crate::ai::blocklist::FORK_PREFIX;
124+
#[cfg(all(feature = "local_fs", not(target_family = "wasm")))]
122125
use crate::ai::cloud_environments::CloudAmbientAgentEnvironment;
123126
#[cfg(not(target_family = "wasm"))]
124127
use crate::terminal::cli_agent_sessions::plugin_manager::{plugin_manager_for, PluginModalKind};
@@ -318,6 +321,7 @@ use crate::terminal::session_settings::{
318321
};
319322
use crate::terminal::settings::{SpacingMode, TerminalSettings};
320323
use crate::terminal::shell::ShellType;
324+
#[cfg(all(feature = "local_fs", not(target_family = "wasm")))]
321325
use crate::terminal::view::ambient_agent::{HandoffSubmissionState, PendingHandoff};
322326
#[cfg(feature = "local_tty")]
323327
use crate::terminal::view::docker_sandbox::DEFAULT_DOCKER_SANDBOX_BASE_IMAGE;
@@ -12874,6 +12878,7 @@ impl Workspace {
1287412878
/// cloud-mode pane (no handoff context) so the chip is always-clickable per the
1287512879
/// existing posture — there's nothing meaningful to hand off in that state, but
1287612880
/// the user clearly wanted a cloud-mode pane.
12881+
#[cfg(all(feature = "local_fs", not(target_family = "wasm")))]
1287712882
fn start_local_to_cloud_handoff(
1287812883
&mut self,
1287912884
initial_prompt: Option<String>,
@@ -20181,7 +20186,10 @@ impl TypedActionView for Workspace {
2018120186
self.add_tab_for_code_file(path, None, ctx);
2018220187
}
2018320188
OpenLocalToCloudHandoffPane { initial_prompt } => {
20189+
#[cfg(all(feature = "local_fs", not(target_family = "wasm")))]
2018420190
self.start_local_to_cloud_handoff(initial_prompt.clone(), ctx);
20191+
#[cfg(not(all(feature = "local_fs", not(target_family = "wasm"))))]
20192+
let _ = initial_prompt;
2018520193
}
2018620194
OpenNetworkLogPane => {
2018720195
self.open_network_log_pane(ctx);

0 commit comments

Comments
 (0)