mirror of
https://github.com/openai/codex.git
synced 2026-11-10 16:44:38 +00:00
Classify contextual fragments with content kinds (#40180)
## What changed - Require each `ContextualUserFragment` to provide a stable `<feature>.<name>` `ContentItemKind`. - Add `AnnotatedContent` and `RenderedFragment` so rendered text, its role, and its classification can travel together to API boundaries. - Derive extension-owned world-state classifications from the extension ID and keep the skills catalog classification with its fragment implementation. ## Testing - Verify that an extension-owned world-state section renders with an `<extension-id>.instructions` content kind. GitOrigin-RevId: e46b74a0bb41e0b6112667c9d36bc9e7f2714451
This commit is contained in:
1 parent
a1d4aea265
commit
422239eb4b
48 files changed
+375
-15
No files matched your search
@@ -9,7 +9,6 @@ use codex_exec_server::FileSystemSandboxContext;
|
||||
use codex_exec_server::LOCAL_ENVIRONMENT_ID;
|
||||
use codex_exec_server::ResolvedSelectedCapabilityRoot;
|
||||
use codex_extension_api::ConfigContributor;
|
||||
use codex_extension_api::ContentItemKind;
|
||||
use codex_extension_api::ContextContributor;
|
||||
use codex_extension_api::ContextualUserFragment;
|
||||
use codex_extension_api::ExtensionData;
|
||||
@@ -238,10 +237,7 @@ where
|
||||
rendered
|
||||
.fragment
|
||||
.map(|fragment| {
|
||||
PromptFragment::developer_capability(
|
||||
fragment.render(),
|
||||
ContentItemKind("skills.catalog".to_string()),
|
||||
)
|
||||
PromptFragment::developer_capability(fragment.render(), fragment.content_kind())
|
||||
})
|
||||
.into_iter()
|
||||
.collect()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use codex_extension_api::ContextualUserFragment;
|
||||
use codex_protocol::models::ContentItemKind;
|
||||
use codex_protocol::protocol::SKILLS_INSTRUCTIONS_CLOSE_TAG;
|
||||
use codex_protocol::protocol::SKILLS_INSTRUCTIONS_OPEN_TAG;
|
||||
|
||||
@@ -40,6 +41,10 @@ impl ContextualUserFragment for AvailableSkillsInstructions {
|
||||
"developer"
|
||||
}
|
||||
|
||||
fn content_kind(&self) -> ContentItemKind {
|
||||
ContentItemKind("skills.catalog".to_string())
|
||||
}
|
||||
|
||||
fn markers(&self) -> (&'static str, &'static str) {
|
||||
Self::type_markers()
|
||||
}
|
||||
@@ -73,6 +78,10 @@ impl ContextualUserFragment for SkillInstructions {
|
||||
"user"
|
||||
}
|
||||
|
||||
fn content_kind(&self) -> ContentItemKind {
|
||||
ContentItemKind("skills.selected_skill_instructions".to_string())
|
||||
}
|
||||
|
||||
fn markers(&self) -> (&'static str, &'static str) {
|
||||
Self::type_markers()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user