mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
Add turn-scoped context contributions (#28911)
## Summary - keep context injection on a single ContextContributor trait - split context injection into thread-scoped and turn-scoped contribution methods - wire turn-scoped fragments into initial context assembly so extensions can contribute context from turn-local state
This commit is contained in:
@@ -74,7 +74,11 @@ async fn contribute_prompt(
|
||||
) -> Vec<codex_extension_api::PromptFragment> {
|
||||
let mut fragments = Vec::new();
|
||||
for contributor in registry.context_contributors() {
|
||||
fragments.extend(contributor.contribute(session_store, thread_store).await);
|
||||
fragments.extend(
|
||||
contributor
|
||||
.contribute_thread_context(session_store, thread_store)
|
||||
.await,
|
||||
);
|
||||
}
|
||||
fragments
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ pub fn install(registry: &mut ExtensionRegistryBuilder<()>) {
|
||||
struct StyleContributor;
|
||||
|
||||
impl ContextContributor for StyleContributor {
|
||||
fn contribute<'a>(
|
||||
fn contribute_thread_context<'a>(
|
||||
&'a self,
|
||||
session_store: &'a ExtensionData,
|
||||
thread_store: &'a ExtensionData,
|
||||
@@ -37,7 +37,7 @@ impl ContextContributor for StyleContributor {
|
||||
struct UsageContributor;
|
||||
|
||||
impl ContextContributor for UsageContributor {
|
||||
fn contribute<'a>(
|
||||
fn contribute_thread_context<'a>(
|
||||
&'a self,
|
||||
session_store: &'a ExtensionData,
|
||||
thread_store: &'a ExtensionData,
|
||||
|
||||
Reference in New Issue
Block a user