mirror of
https://github.com/openai/codex.git
synced 2026-09-08 15:50:34 +00:00
## 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
77 lines
1.8 KiB
Rust
77 lines
1.8 KiB
Rust
use std::collections::BTreeMap;
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub struct StoredProjectRoot {
|
|
pub path: String,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub struct StoredProject {
|
|
pub id: String,
|
|
pub name: String,
|
|
pub roots: Vec<StoredProjectRoot>,
|
|
pub metadata: BTreeMap<String, String>,
|
|
pub position: i64,
|
|
pub created_at_ms: i64,
|
|
pub updated_at_ms: i64,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub struct StoredProjectsPage {
|
|
pub projects: Vec<StoredProject>,
|
|
pub next_cursor: Option<String>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub struct ListProjectsParams {
|
|
pub cursor: Option<String>,
|
|
pub limit: usize,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub struct CreateProjectParams {
|
|
pub name: String,
|
|
pub roots: Vec<StoredProjectRoot>,
|
|
pub metadata: BTreeMap<String, String>,
|
|
pub thread_ids: Vec<String>,
|
|
pub idempotency_key: String,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub struct CreatedProject {
|
|
pub project: StoredProject,
|
|
pub created: bool,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub struct UpdateProjectParams {
|
|
pub project_id: String,
|
|
pub name: Option<String>,
|
|
pub roots: Option<Vec<StoredProjectRoot>>,
|
|
pub metadata: Option<BTreeMap<String, String>>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub struct MoveProjectParams {
|
|
pub project_id: String,
|
|
pub before_project_id: Option<String>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub enum ProjectMoveOutcome {
|
|
Unchanged,
|
|
Moved,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub struct UpdatedProject {
|
|
pub project: StoredProject,
|
|
pub changed: bool,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub struct DeletedProject {
|
|
pub affected_active_thread_ids: Vec<String>,
|
|
pub affected_archived_thread_ids: Vec<String>,
|
|
}
|