Skip to main content

objectiveai_cli/command/agents/logs/read/
id.rs

1//! `agents logs read id <id>` — resolve a `objectiveai.messages."index"`
2//! to its typed [`Response`] variant. The dispatch logic lives in
3//! [`crate::db::logs::read_by_id`]; this handler is a thin wrapper.
4
5use objectiveai_sdk::cli::command::agents::logs::read::id::{Request, Response};
6
7use crate::context::Context;
8use crate::error::Error;
9
10pub async fn execute(ctx: &Context, request: Request) -> Result<Response, Error> {
11    crate::db::logs::read_by_id(ctx.db_client().await?, request.id)
12        .await?
13        .ok_or_else(|| {
14            Error::Filesystem(crate::filesystem::Error::NotFound(format!(
15                "objectiveai.messages row at index {}",
16                request.id
17            )))
18        })
19}
20
21pub mod request_schema {
22    use objectiveai_sdk::cli::command::agents::logs::read::id as sdk;
23    use objectiveai_sdk::cli::command::agents::logs::read::id::request_schema::{Request, Response};
24
25    use crate::context::Context;
26    use crate::error::Error;
27
28    pub async fn execute(_ctx: &Context, _request: Request) -> Result<Response, Error> {
29        Ok(objectiveai_sdk::cli::command::ResponseSchema(schemars::schema_for!(sdk::Request)))
30    }
31}
32
33pub mod response_schema {
34    use objectiveai_sdk::cli::command::agents::logs::read::id as sdk;
35    use objectiveai_sdk::cli::command::agents::logs::read::id::response_schema::{Request, Response};
36
37    use crate::context::Context;
38    use crate::error::Error;
39
40    pub async fn execute(_ctx: &Context, _request: Request) -> Result<Response, Error> {
41        Ok(objectiveai_sdk::cli::command::ResponseSchema(schemars::schema_for!(sdk::Response)))
42    }
43}