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
35 changes: 18 additions & 17 deletions Cargo.lock

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

26 changes: 26 additions & 0 deletions crates/openfang-api/src/channel_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,32 @@ impl ChannelBridgeHandle for KernelBridgeAdapter {
.map(|_| ())
}

async fn check_session_gap(&self, agent_id: AgentId) {
// Resolve the session's user_id so the per-(agent, user) tracker
// works. Falling back to the default user matches everywhere else
// in the kernel that reads a session without a logged-in caller.
let user_id = self
.kernel
.registry
.get(agent_id)
.and_then(|e| self.kernel.memory.get_session(e.session_id).ok().flatten())
.map(|s| s.user_id)
.unwrap_or_else(openfang_memory::session::default_user_id);

self.kernel
.detect_and_run_session_gap(agent_id, user_id)
.await;
}

fn channel_compaction_enabled(&self) -> bool {
// Mirrors the opt-in invariant in docs/CONTINUOUS_COMPACTION.md: with
// no `[compaction]` knobs set and no context_sources, the feature is
// completely off and channel dispatch must not pay for the
// per-message gap probe (lock acquisition + session read).
let c = &self.kernel.config.compaction;
c.continuous_interval > 0 || c.gap_secs > 0 || !c.context_sources.is_empty()
}

async fn check_auto_reply(&self, agent_id: AgentId, message: &str) -> Option<String> {
// Check if auto-reply should fire for this message
let channel_type = "bridge"; // Generic; the bridge layer handles specifics
Expand Down
1 change: 1 addition & 0 deletions crates/openfang-api/src/openai_compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ fn convert_messages(oai_messages: &[OaiMessage]) -> Vec<Message> {
provider_msg_id: None,
role,
content,
source: None,
})
})
.collect()
Expand Down
Loading
Loading