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
20 changes: 16 additions & 4 deletions app/src/ai/blocklist/controller/input_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub(super) fn input_context_for_request(
{
let session_context = SessionContext::from_session(active_session, app);
if session_context.is_remote() {
add_remote_codebase_context(&mut context, app);
add_remote_codebase_context(&mut context, &session_context, app);
} else {
add_local_codebase_context(&mut context, app);
}
Expand Down Expand Up @@ -118,8 +118,15 @@ fn add_local_codebase_context(context: &mut Vec<AIAgentContext>, app: &AppContex
}

#[cfg(not(target_family = "wasm"))]
fn add_remote_codebase_context(context: &mut Vec<AIAgentContext>, app: &AppContext) {
for codebase in RemoteCodebaseIndexModel::as_ref(app).codebases_for_agent_context() {
fn add_remote_codebase_context(
context: &mut Vec<AIAgentContext>,
session_context: &SessionContext,
app: &AppContext,
) {
let Some(host_id) = session_context.host_id() else {
return;
};
for codebase in RemoteCodebaseIndexModel::as_ref(app).codebases_for_agent_context(host_id) {
context.push(AIAgentContext::Codebase {
name: codebase.name,
path: codebase.path,
Expand All @@ -128,7 +135,12 @@ fn add_remote_codebase_context(context: &mut Vec<AIAgentContext>, app: &AppConte
}

#[cfg(target_family = "wasm")]
fn add_remote_codebase_context(_context: &mut Vec<AIAgentContext>, _app: &AppContext) {}
fn add_remote_codebase_context(
_context: &mut Vec<AIAgentContext>,
_session_context: &SessionContext,
_app: &AppContext,
) {
}

/// Parses context reference strings like <block:123> from the user query and returns
/// a map of reference strings to AIAgentAttachment objects.
Expand Down
22 changes: 19 additions & 3 deletions app/src/ai/codebase_auto_indexing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ impl CodebaseAutoIndexingSurface {
}
}

pub(crate) fn should_use_codebase_indexing(
surface: CodebaseAutoIndexingSurface,
ctx: &AppContext,
) -> bool {
codebase_indexing_enabled(
surface,
UserWorkspaces::as_ref(ctx).is_codebase_context_enabled(ctx),
)
}

pub(crate) fn should_auto_index_codebase(
surface: CodebaseAutoIndexingSurface,
ctx: &AppContext,
Expand All @@ -33,15 +43,21 @@ pub(crate) fn should_auto_index_codebase(
)
}

pub(crate) fn codebase_auto_indexing_enabled(
fn codebase_indexing_enabled(
surface: CodebaseAutoIndexingSurface,
codebase_context_enabled: bool,
auto_indexing_enabled: bool,
) -> bool {
FeatureFlag::FullSourceCodeEmbedding.is_enabled()
&& surface.required_feature_enabled()
&& codebase_context_enabled
&& auto_indexing_enabled
}

pub(crate) fn codebase_auto_indexing_enabled(
surface: CodebaseAutoIndexingSurface,
codebase_context_enabled: bool,
auto_indexing_enabled: bool,
) -> bool {
codebase_indexing_enabled(surface, codebase_context_enabled) && auto_indexing_enabled
}

pub(crate) fn auto_index_candidate_roots<Root>(
Expand Down
Loading
Loading