chore: rebrand project to crank
This commit is contained in:
@@ -7,12 +7,12 @@ version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
axum.workspace = true
|
||||
mcpaas-core = { path = "../../crates/mcpaas-core" }
|
||||
mcpaas-mapping = { path = "../../crates/mcpaas-mapping" }
|
||||
mcpaas-proto = { path = "../../crates/mcpaas-proto" }
|
||||
mcpaas-registry = { path = "../../crates/mcpaas-registry" }
|
||||
mcpaas-runtime = { path = "../../crates/mcpaas-runtime" }
|
||||
mcpaas-schema = { path = "../../crates/mcpaas-schema" }
|
||||
crank-core = { path = "../../crates/crank-core" }
|
||||
crank-mapping = { path = "../../crates/crank-mapping" }
|
||||
crank-proto = { path = "../../crates/crank-proto" }
|
||||
crank-registry = { path = "../../crates/crank-registry" }
|
||||
crank-runtime = { path = "../../crates/crank-runtime" }
|
||||
crank-schema = { path = "../../crates/crank-schema" }
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
serde_yaml.workspace = true
|
||||
@@ -24,6 +24,6 @@ tracing-subscriber.workspace = true
|
||||
uuid.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
mcpaas-adapter-grpc = { path = "../../crates/mcpaas-adapter-grpc", features = ["test-support"] }
|
||||
crank-adapter-grpc = { path = "../../crates/crank-adapter-grpc", features = ["test-support"] }
|
||||
reqwest.workspace = true
|
||||
sqlx.workspace = true
|
||||
|
||||
@@ -18,7 +18,7 @@ WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/target/release/admin-api /usr/local/bin/admin-api
|
||||
|
||||
ENV MCPAAS_ADMIN_BIND=0.0.0.0:3001
|
||||
ENV CRANK_ADMIN_BIND=0.0.0.0:3001
|
||||
|
||||
EXPOSE 3001
|
||||
|
||||
|
||||
@@ -80,14 +80,14 @@ mod tests {
|
||||
};
|
||||
|
||||
use axum::{Json, Router, routing::post};
|
||||
use mcpaas_adapter_grpc::test_support as grpc_test_support;
|
||||
use mcpaas_core::{
|
||||
use crank_adapter_grpc::test_support as grpc_test_support;
|
||||
use crank_core::{
|
||||
DescriptorId, ExecutionConfig, GraphqlOperationType, GraphqlTarget, GrpcTarget, HttpMethod,
|
||||
Protocol, RestTarget, Target, ToolDescription,
|
||||
};
|
||||
use mcpaas_mapping::{MappingRule, MappingSet};
|
||||
use mcpaas_registry::PostgresRegistry;
|
||||
use mcpaas_schema::{Schema, SchemaKind};
|
||||
use crank_mapping::{MappingRule, MappingSet};
|
||||
use crank_registry::PostgresRegistry;
|
||||
use crank_schema::{Schema, SchemaKind};
|
||||
use serde_json::{Value, json};
|
||||
use sqlx::{Executor, postgres::PgPoolOptions};
|
||||
use tokio::net::TcpListener;
|
||||
@@ -621,7 +621,7 @@ mod tests {
|
||||
|
||||
async fn test_registry() -> PostgresRegistry {
|
||||
let database_url = env::var("TEST_DATABASE_URL")
|
||||
.unwrap_or_else(|_| "postgres://rmcp:rmcp@127.0.0.1:5432/rmcp".to_owned());
|
||||
.unwrap_or_else(|_| "postgres://crank:crank@127.0.0.1:5432/crank".to_owned());
|
||||
let admin_pool = PgPoolOptions::new()
|
||||
.max_connections(1)
|
||||
.connect(&database_url)
|
||||
@@ -648,7 +648,7 @@ mod tests {
|
||||
|
||||
fn test_storage_root(name: &str) -> std::path::PathBuf {
|
||||
env::temp_dir().join(format!(
|
||||
"rmcp_admin_api_{name}_{}_{}",
|
||||
"crank_admin_api_{name}_{}_{}",
|
||||
std::process::id(),
|
||||
SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
|
||||
@@ -3,10 +3,10 @@ use axum::{
|
||||
http::StatusCode,
|
||||
response::{IntoResponse, Response},
|
||||
};
|
||||
use mcpaas_mapping::MappingError;
|
||||
use mcpaas_registry::RegistryError;
|
||||
use mcpaas_runtime::RuntimeError;
|
||||
use mcpaas_schema::SchemaError;
|
||||
use crank_mapping::MappingError;
|
||||
use crank_registry::RegistryError;
|
||||
use crank_runtime::RuntimeError;
|
||||
use crank_schema::SchemaError;
|
||||
use serde_json::{Value, json};
|
||||
use thiserror::Error;
|
||||
use tracing::{error, warn};
|
||||
|
||||
@@ -7,7 +7,7 @@ mod storage;
|
||||
|
||||
use std::{env, net::SocketAddr, path::PathBuf};
|
||||
|
||||
use mcpaas_registry::PostgresRegistry;
|
||||
use crank_registry::PostgresRegistry;
|
||||
use tokio::net::TcpListener;
|
||||
use tracing::info;
|
||||
|
||||
@@ -17,16 +17,16 @@ use crate::{app::build_app, service::AdminService, state::AppState};
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter(
|
||||
env::var("MCPAAS_LOG_LEVEL")
|
||||
env::var("CRANK_LOG_LEVEL")
|
||||
.unwrap_or_else(|_| "admin_api=info,tower_http=info".into()),
|
||||
)
|
||||
.init();
|
||||
|
||||
let database_url = env::var("MCPAAS_DATABASE_URL")?;
|
||||
let database_url = env::var("CRANK_DATABASE_URL")?;
|
||||
let storage_root = PathBuf::from(
|
||||
env::var("MCPAAS_STORAGE_ROOT").unwrap_or_else(|_| "/var/lib/rmcp/storage".into()),
|
||||
env::var("CRANK_STORAGE_ROOT").unwrap_or_else(|_| "/var/lib/crank/storage".into()),
|
||||
);
|
||||
let bind_addr = env::var("MCPAAS_ADMIN_BIND").unwrap_or_else(|_| "0.0.0.0:3001".into());
|
||||
let bind_addr = env::var("CRANK_ADMIN_BIND").unwrap_or_else(|_| "0.0.0.0:3001".into());
|
||||
let socket_addr: SocketAddr = bind_addr.parse()?;
|
||||
let registry = PostgresRegistry::connect(&database_url).await?;
|
||||
let state = AppState {
|
||||
|
||||
@@ -96,7 +96,7 @@ pub async fn upload_input_json(
|
||||
.service
|
||||
.save_json_sample(
|
||||
&operation_id.as_str().into(),
|
||||
mcpaas_registry::SampleKind::InputJson,
|
||||
crank_registry::SampleKind::InputJson,
|
||||
&payload,
|
||||
)
|
||||
.await?;
|
||||
@@ -117,7 +117,7 @@ pub async fn upload_output_json(
|
||||
.service
|
||||
.save_json_sample(
|
||||
&operation_id.as_str().into(),
|
||||
mcpaas_registry::SampleKind::OutputJson,
|
||||
crank_registry::SampleKind::OutputJson,
|
||||
&payload,
|
||||
)
|
||||
.await?;
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use mcpaas_core::{
|
||||
use crank_core::{
|
||||
AuthConfig, AuthKind, AuthProfile, AuthProfileId, ConfigExport, ExportMode, GeneratedDraft,
|
||||
GeneratedDraftStatus, OperationId, OperationStatus, Protocol, SampleId, Samples, Target,
|
||||
};
|
||||
use mcpaas_mapping::{JsonPathRoot, MappingSet, infer_mapping_from_samples};
|
||||
use mcpaas_proto::{ProtoService, services_from_descriptor_set_bytes};
|
||||
use mcpaas_registry::{
|
||||
use crank_mapping::{JsonPathRoot, MappingSet, infer_mapping_from_samples};
|
||||
use crank_proto::{ProtoService, services_from_descriptor_set_bytes};
|
||||
use crank_registry::{
|
||||
CreateVersionRequest, OperationSampleMetadata, OperationSummary, OperationVersionRecord,
|
||||
PostgresRegistry, PublishRequest, RegistryOperation, SampleKind, SaveAuthProfileRequest,
|
||||
SaveDescriptorMetadataRequest, SaveSampleMetadataRequest,
|
||||
};
|
||||
use mcpaas_runtime::{PreparedRequest, RuntimeError, RuntimeExecutor, RuntimeOperation};
|
||||
use mcpaas_schema::Schema;
|
||||
use crank_runtime::{PreparedRequest, RuntimeError, RuntimeExecutor, RuntimeOperation};
|
||||
use crank_schema::Schema;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{Value, json};
|
||||
use time::{OffsetDateTime, format_description::well_known::Rfc3339};
|
||||
@@ -38,8 +38,8 @@ pub struct OperationPayload {
|
||||
pub output_schema: Schema,
|
||||
pub input_mapping: MappingSet,
|
||||
pub output_mapping: MappingSet,
|
||||
pub execution_config: mcpaas_core::ExecutionConfig,
|
||||
pub tool_description: mcpaas_core::ToolDescription,
|
||||
pub execution_config: crank_core::ExecutionConfig,
|
||||
pub tool_description: crank_core::ToolDescription,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
@@ -395,13 +395,13 @@ impl AdminService {
|
||||
|
||||
let services = services_from_descriptor_set_bytes(payload)
|
||||
.map_err(|error| ApiError::validation(error.to_string()))?;
|
||||
let descriptor_id = mcpaas_core::DescriptorId::new(new_prefixed_id("desc"));
|
||||
let descriptor_id = crank_core::DescriptorId::new(new_prefixed_id("desc"));
|
||||
let storage_ref = self
|
||||
.storage
|
||||
.write_descriptor(
|
||||
operation_id,
|
||||
summary.current_draft_version,
|
||||
mcpaas_registry::DescriptorKind::DescriptorSet,
|
||||
crank_registry::DescriptorKind::DescriptorSet,
|
||||
&descriptor_id,
|
||||
source_name,
|
||||
payload,
|
||||
@@ -410,11 +410,11 @@ impl AdminService {
|
||||
|
||||
self.registry
|
||||
.save_descriptor_metadata(SaveDescriptorMetadataRequest {
|
||||
descriptor: &mcpaas_registry::DescriptorMetadata {
|
||||
descriptor: &crank_registry::DescriptorMetadata {
|
||||
id: descriptor_id.clone(),
|
||||
operation_id: Some(operation_id.clone()),
|
||||
version: Some(summary.current_draft_version),
|
||||
descriptor_kind: mcpaas_registry::DescriptorKind::DescriptorSet,
|
||||
descriptor_kind: crank_registry::DescriptorKind::DescriptorSet,
|
||||
storage_ref,
|
||||
source_name: source_name.map(ToOwned::to_owned),
|
||||
package_index: Some(
|
||||
@@ -452,13 +452,13 @@ impl AdminService {
|
||||
));
|
||||
}
|
||||
|
||||
let descriptor_id = mcpaas_core::DescriptorId::new(new_prefixed_id("desc"));
|
||||
let descriptor_id = crank_core::DescriptorId::new(new_prefixed_id("desc"));
|
||||
let storage_ref = self
|
||||
.storage
|
||||
.write_descriptor(
|
||||
operation_id,
|
||||
summary.current_draft_version,
|
||||
mcpaas_registry::DescriptorKind::ProtoUpload,
|
||||
crank_registry::DescriptorKind::ProtoUpload,
|
||||
&descriptor_id,
|
||||
source_name,
|
||||
payload,
|
||||
@@ -467,11 +467,11 @@ impl AdminService {
|
||||
|
||||
self.registry
|
||||
.save_descriptor_metadata(SaveDescriptorMetadataRequest {
|
||||
descriptor: &mcpaas_registry::DescriptorMetadata {
|
||||
descriptor: &crank_registry::DescriptorMetadata {
|
||||
id: descriptor_id.clone(),
|
||||
operation_id: Some(operation_id.clone()),
|
||||
version: Some(summary.current_draft_version),
|
||||
descriptor_kind: mcpaas_registry::DescriptorKind::ProtoUpload,
|
||||
descriptor_kind: crank_registry::DescriptorKind::ProtoUpload,
|
||||
storage_ref,
|
||||
source_name: source_name.map(ToOwned::to_owned),
|
||||
package_index: None,
|
||||
@@ -513,7 +513,7 @@ impl AdminService {
|
||||
.into_iter()
|
||||
.rev()
|
||||
.find(|descriptor| {
|
||||
descriptor.descriptor_kind == mcpaas_registry::DescriptorKind::DescriptorSet
|
||||
descriptor.descriptor_kind == crank_registry::DescriptorKind::DescriptorSet
|
||||
})
|
||||
.ok_or_else(|| ApiError::not_found("descriptor set was not uploaded"))?;
|
||||
let bytes = self.storage.read_bytes(&descriptor.storage_ref).await?;
|
||||
@@ -809,10 +809,10 @@ impl AdminService {
|
||||
fn build_request_preview(
|
||||
mapping: &MappingSet,
|
||||
input: &Value,
|
||||
) -> Result<Value, mcpaas_mapping::MappingError> {
|
||||
) -> Result<Value, crank_mapping::MappingError> {
|
||||
let mapped = mapping.apply(&json!({ "mcp": input }))?;
|
||||
let prepared = PreparedRequest::from_mapping_output(&mapped).map_err(|error| {
|
||||
mcpaas_mapping::MappingError::InvalidJsonPath {
|
||||
crank_mapping::MappingError::InvalidJsonPath {
|
||||
path: error.to_string(),
|
||||
}
|
||||
})?;
|
||||
@@ -890,9 +890,9 @@ fn proto_service_summary(service: ProtoService) -> Result<GrpcServiceSummary, Ap
|
||||
Ok(GrpcMethodSummary {
|
||||
name: method.name.clone(),
|
||||
kind: "unary".to_owned(),
|
||||
input_schema: mcpaas_proto::message_to_schema(&method.input)
|
||||
input_schema: crank_proto::message_to_schema(&method.input)
|
||||
.map_err(|error| ApiError::validation(error.to_string()))?,
|
||||
output_schema: mcpaas_proto::message_to_schema(&method.output)
|
||||
output_schema: crank_proto::message_to_schema(&method.output)
|
||||
.map_err(|error| ApiError::validation(error.to_string()))?,
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use mcpaas_core::{DescriptorId, OperationId, SampleId};
|
||||
use mcpaas_registry::{DescriptorKind, SampleKind};
|
||||
use crank_core::{DescriptorId, OperationId, SampleId};
|
||||
use crank_registry::{DescriptorKind, SampleKind};
|
||||
use serde_json::Value;
|
||||
use thiserror::Error;
|
||||
use tokio::fs;
|
||||
|
||||
Reference in New Issue
Block a user