mirror of
https://github.com/openai/codex.git
synced 2026-11-18 23:02:23 +00:00
Add experimental app-server project APIs (#38940)
## What changed - Add SQLite-backed `project/list`, `project/read`, `project/create`, `project/import`, `project/update`, `project/move`, and `project/delete` endpoints with ordered roots, metadata, manual positioning, pagination, and idempotent creation. - Add project assignment to thread start, metadata updates, list filtering, and fork inheritance. Project deletion clears assignments without deleting threads. - Emit `project/changed` and `thread/project/updated` notifications after committed changes, and export the new protocol schemas and TypeScript types. ## Testing - Cover project lifecycle and ordering, idempotency, atomic imports, cursor and filter validation, thread assignment, deletion, and fork inheritance. GitOrigin-RevId: 47ae621be01ab8ef70a74a629fb29a5c5709ea33
This commit is contained in:
1 parent
1f41cc5d92
commit
3b4569a920
107 files changed
+4210
-52
No files matched your search
@@ -190,7 +190,7 @@ pub struct ThreadSectionAppearance {
|
||||
pub color: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS, ExperimentalApi)]
|
||||
#[derive(Serialize, Debug, Clone, PartialEq, JsonSchema, TS, ExperimentalApi)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct Thread {
|
||||
@@ -216,6 +216,12 @@ pub struct Thread {
|
||||
#[serde(default)]
|
||||
#[ts(type = "number | null")]
|
||||
pub section_entered_at: Option<i64>,
|
||||
/// Canonical project assignment owned by app-server, if any.
|
||||
#[schemars(
|
||||
required,
|
||||
schema_with = "crate::protocol::serde_helpers::nullable_string_schema"
|
||||
)]
|
||||
pub project_id: Option<String>,
|
||||
/// Persisted thread history contract selected when this thread was created.
|
||||
#[experimental("thread.historyMode")]
|
||||
#[serde(default)]
|
||||
@@ -262,6 +268,82 @@ pub struct Thread {
|
||||
pub turns: Vec<Turn>,
|
||||
}
|
||||
|
||||
// TODO: Remove this compatibility decoder after app-server versions that omitted
|
||||
// `projectId` have aged out of the supported TUI -> remote app-server version-skew window.
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct ThreadCompatibility {
|
||||
id: String,
|
||||
extra: Option<ThreadExtra>,
|
||||
session_id: String,
|
||||
forked_from_id: Option<String>,
|
||||
parent_thread_id: Option<String>,
|
||||
preview: String,
|
||||
ephemeral: bool,
|
||||
#[serde(default)]
|
||||
section: Option<ThreadSection>,
|
||||
#[serde(default)]
|
||||
section_entered_at: Option<i64>,
|
||||
#[serde(default)]
|
||||
project_id: Option<String>,
|
||||
#[serde(default)]
|
||||
history_mode: ThreadHistoryMode,
|
||||
model_provider: String,
|
||||
created_at: i64,
|
||||
updated_at: i64,
|
||||
recency_at: Option<i64>,
|
||||
status: ThreadStatus,
|
||||
path: Option<PathBuf>,
|
||||
cwd: AbsolutePathBuf,
|
||||
cli_version: String,
|
||||
source: SessionSource,
|
||||
can_accept_direct_input: Option<bool>,
|
||||
thread_source: Option<ThreadSource>,
|
||||
agent_nickname: Option<String>,
|
||||
agent_role: Option<String>,
|
||||
git_info: Option<GitInfo>,
|
||||
name: Option<String>,
|
||||
turns: Vec<Turn>,
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for Thread {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: serde::Deserializer<'de>,
|
||||
{
|
||||
let thread = ThreadCompatibility::deserialize(deserializer)?;
|
||||
Ok(Self {
|
||||
id: thread.id,
|
||||
extra: thread.extra,
|
||||
session_id: thread.session_id,
|
||||
forked_from_id: thread.forked_from_id,
|
||||
parent_thread_id: thread.parent_thread_id,
|
||||
preview: thread.preview,
|
||||
ephemeral: thread.ephemeral,
|
||||
section: thread.section,
|
||||
section_entered_at: thread.section_entered_at,
|
||||
project_id: thread.project_id,
|
||||
history_mode: thread.history_mode,
|
||||
model_provider: thread.model_provider,
|
||||
created_at: thread.created_at,
|
||||
updated_at: thread.updated_at,
|
||||
recency_at: thread.recency_at,
|
||||
status: thread.status,
|
||||
path: thread.path,
|
||||
cwd: thread.cwd,
|
||||
cli_version: thread.cli_version,
|
||||
source: thread.source,
|
||||
can_accept_direct_input: thread.can_accept_direct_input,
|
||||
thread_source: thread.thread_source,
|
||||
agent_nickname: thread.agent_nickname,
|
||||
agent_role: thread.agent_role,
|
||||
git_info: thread.git_info,
|
||||
name: thread.name,
|
||||
turns: thread.turns,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
|
||||
Reference in new issue
Block a user