mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
e639e8c4bd
## Why Connector metadata is consumed by connector discovery, ChatGPT integration, core, and TUI code. Treating app-server's wire DTO as the shared domain model reverses the intended dependency direction. ## What changed - Added connector-owned app branding, review, screenshot, metadata, and info types. - Added explicit conversions in app-server and TUI while preserving app-server's wire payloads. - Removed production app-server-protocol dependencies from connectors and ChatGPT connector code. ## Stack This is PR 4 of 6, stacked on [PR #29722](https://github.com/openai/codex/pull/29722). Review only the delta from `codex/split-config-layer-types`. Next: [PR #29724](https://github.com/openai/codex/pull/29724). ## Validation - Connector and tools coverage passed. - App-server app-list coverage passed: 13 tests.
32 lines
909 B
Rust
32 lines
909 B
Rust
use crate::AppInfo;
|
|
|
|
pub fn connector_display_label(connector: &AppInfo) -> String {
|
|
connector.name.clone()
|
|
}
|
|
|
|
pub fn connector_mention_slug(connector: &AppInfo) -> String {
|
|
connector_mention_slug_from_name(&connector_display_label(connector))
|
|
}
|
|
|
|
pub fn connector_mention_slug_from_name(name: &str) -> String {
|
|
crate::connector_name_slug(name)
|
|
}
|
|
|
|
pub fn connector_install_url(name: &str, connector_id: &str) -> String {
|
|
crate::connector_install_url(name, connector_id)
|
|
}
|
|
|
|
pub fn sanitize_name(name: &str) -> String {
|
|
crate::connector_name_slug(name).replace("-", "_")
|
|
}
|
|
|
|
pub(crate) fn sort_connectors_by_accessibility_and_name(connectors: &mut [AppInfo]) {
|
|
connectors.sort_by(|left, right| {
|
|
right
|
|
.is_accessible
|
|
.cmp(&left.is_accessible)
|
|
.then_with(|| left.name.cmp(&right.name))
|
|
.then_with(|| left.id.cmp(&right.id))
|
|
});
|
|
}
|