Add tool quality report contract
This commit is contained in:
@@ -20,10 +20,10 @@ use crate::{
|
||||
capabilities::get_capabilities,
|
||||
observability::{get_agent_usage, get_log, get_operation_usage, get_usage, list_logs},
|
||||
operations::{
|
||||
archive_operation, create_operation, create_version, delete_operation,
|
||||
export_operation, generate_draft, get_operation, get_operation_version,
|
||||
list_operations, publish_operation, run_test, update_operation, upload_input_json,
|
||||
upload_output_json,
|
||||
analyze_operation_quality, archive_operation, create_operation, create_version,
|
||||
delete_operation, export_operation, generate_draft, get_operation,
|
||||
get_operation_version, list_operations, publish_operation, run_test, update_operation,
|
||||
upload_input_json, upload_output_json,
|
||||
},
|
||||
secrets::{create_secret, delete_secret, get_secret, list_secrets, rotate_secret},
|
||||
upstreams::{create_upstream, list_upstreams, update_upstream},
|
||||
@@ -35,6 +35,10 @@ use crate::{
|
||||
pub fn build_app(state: AppState) -> Router {
|
||||
let workspace_router = Router::new()
|
||||
.route("/operations", get(list_operations).post(create_operation))
|
||||
.route(
|
||||
"/operations/analyze-quality",
|
||||
post(analyze_operation_quality),
|
||||
)
|
||||
.route("/operations/import", post(import_operation))
|
||||
.route(
|
||||
"/operations/{operation_id}",
|
||||
|
||||
@@ -64,6 +64,18 @@ pub async fn create_operation(
|
||||
Ok(Json(json!(created)))
|
||||
}
|
||||
|
||||
pub async fn analyze_operation_quality(
|
||||
Path(path): Path<WorkspacePath>,
|
||||
State(state): State<AppState>,
|
||||
Json(payload): Json<OperationPayload>,
|
||||
) -> Result<Json<Value>, ApiError> {
|
||||
let report = state
|
||||
.service
|
||||
.analyze_operation_quality(&path.workspace_id.as_str().into(), payload)
|
||||
.await?;
|
||||
Ok(Json(json!(report)))
|
||||
}
|
||||
|
||||
pub async fn get_operation(
|
||||
Path(path): Path<WorkspaceOperationPath>,
|
||||
State(state): State<AppState>,
|
||||
|
||||
@@ -1443,6 +1443,18 @@ impl AdminService {
|
||||
})
|
||||
}
|
||||
|
||||
#[instrument(skip(self, payload), fields(protocol = ?payload.protocol, operation_name = %payload.name))]
|
||||
pub async fn analyze_operation_quality(
|
||||
&self,
|
||||
workspace_id: &WorkspaceId,
|
||||
payload: OperationPayload,
|
||||
) -> Result<crank_core::ToolQualityReport, ApiError> {
|
||||
self.validate_operation_payload(&payload)?;
|
||||
self.ensure_workspace_exists(workspace_id).await?;
|
||||
|
||||
Ok(crank_core::ToolQualityReport::empty())
|
||||
}
|
||||
|
||||
#[instrument(skip(self, payload), fields(operation_id = %operation_id.as_str(), protocol = ?payload.operation.protocol))]
|
||||
pub async fn create_version(
|
||||
&self,
|
||||
|
||||
Reference in New Issue
Block a user