chore: retire openhub and pi ts runtime

This commit is contained in:
Agent Board
2026-07-12 14:18:26 +08:00
parent 62959b0c4d
commit 2f5902e3e7
45 changed files with 367 additions and 925 deletions
+1 -10
View File
@@ -2301,16 +2301,7 @@ async fn handle_control_plane_auth_action(
});
let provider_sync_results = if matches!(flow, "signUp" | "signIn") {
let directory_grants = state
.control_plane()
.list_directory_grants_for_actor(&resolved.user.id)
.unwrap_or_default();
let results = sync_provider_identities(
&resolved.user,
&password_for_provider_sync,
&directory_grants,
)
.await;
let results = sync_provider_identities(&resolved.user, &password_for_provider_sync).await;
let _ = state.control_plane().append_audit(AppendAuditInput {
actor_user_id: Some(resolved.user.id.clone()),
action: "control.auth.provider_identities_synced".to_string(),
@@ -5,7 +5,6 @@ use crate::page_aggregate::{
PageAggregate, PageAggregateSource, PageBody, PageHead, PageIdentity, PageLayout, PageOptions,
PagePermissions, PageStats, PageTree,
};
use crate::provider_identity_sync::sync_openhub_directory_permissions_for_user_id;
use crate::routes::local_markdown_parser::{
file_stem_title, parse_markdown_attachment_refs, parse_markdown_page, split_frontmatter,
};
@@ -2442,14 +2441,6 @@ pub async fn create_local_access_grant(
) -> Result<(StatusCode, Json<Value>), WebError> {
let payload = add_control_plane_local_access_grant_for_context(&state, &context, request)
.map_err(|error| error.with_context(&context))?;
if let Some(user_id) = payload
.pointer("/grant/userId")
.and_then(Value::as_str)
.map(str::trim)
.filter(|value| !value.is_empty())
{
sync_openhub_directory_permissions_for_user_id(state.control_plane(), user_id).await;
}
Ok((StatusCode::OK, Json(payload)))
}
@@ -2460,14 +2451,6 @@ pub async fn create_user_access_grant(
) -> Result<(StatusCode, Json<Value>), WebError> {
let payload = add_control_plane_user_access_grant_for_context(&state, &context, request)
.map_err(|error| error.with_context(&context))?;
if let Some(user_id) = payload
.pointer("/grant/userId")
.and_then(Value::as_str)
.map(str::trim)
.filter(|value| !value.is_empty())
{
sync_openhub_directory_permissions_for_user_id(state.control_plane(), user_id).await;
}
Ok((StatusCode::OK, Json(payload)))
}
@@ -2478,14 +2461,6 @@ pub async fn delete_local_access_grant(
) -> Result<(StatusCode, Json<Value>), WebError> {
let payload = delete_control_plane_local_access_grant_for_context(&state, &context, &grant_id)
.map_err(|error| error.with_context(&context))?;
if let Some(user_id) = payload
.get("revokedUserId")
.and_then(Value::as_str)
.map(str::trim)
.filter(|value| !value.is_empty())
{
sync_openhub_directory_permissions_for_user_id(state.control_plane(), user_id).await;
}
Ok((StatusCode::OK, Json(payload)))
}
@@ -2496,14 +2471,6 @@ pub async fn delete_user_access_grant(
) -> Result<(StatusCode, Json<Value>), WebError> {
let payload = delete_control_plane_user_access_grant_for_context(&state, &context, &grant_id)
.map_err(|error| error.with_context(&context))?;
if let Some(user_id) = payload
.get("revokedUserId")
.and_then(Value::as_str)
.map(str::trim)
.filter(|value| !value.is_empty())
{
sync_openhub_directory_permissions_for_user_id(state.control_plane(), user_id).await;
}
Ok((StatusCode::OK, Json(payload)))
}
-63
View File
@@ -28,7 +28,6 @@ mod onlyoffice;
pub(crate) mod onlyoffice_bridge;
mod page_ai_board;
mod page_ai_opencode;
mod page_ai_openhub;
mod page_ai_pi;
mod page_ai_workflow;
mod query_support;
@@ -408,68 +407,6 @@ pub fn build_router(state: AppState) -> Router {
"/api/page-ai/opencode/status",
get(page_ai_opencode::status),
)
.route("/api/page-ai/openhub/status", get(page_ai_openhub::status))
.route(
"/api/page-ai/openhub/bootstrap",
post(page_ai_openhub::bootstrap),
)
.route(
"/api/page-ai/openhub/artifact-index",
get(page_ai_openhub::artifact_index_get).post(page_ai_openhub::artifact_index_upsert),
)
.route("/page-ai/openhub/ai", get(page_ai_openhub::ai_shell))
.route(
"/page-ai/openhub/ai/{*path}",
any(page_ai_openhub::ai_proxy),
)
.route(
"/page-ai/openhub/login",
any(page_ai_openhub::non_ai_route_guard),
)
.route(
"/page-ai/openhub/login/{*path}",
any(page_ai_openhub::non_ai_route_guard),
)
.route(
"/page-ai/openhub/admin",
any(page_ai_openhub::non_ai_route_guard),
)
.route(
"/page-ai/openhub/admin/{*path}",
any(page_ai_openhub::non_ai_route_guard),
)
.route(
"/page-ai/openhub/file",
any(page_ai_openhub::non_ai_route_guard),
)
.route(
"/page-ai/openhub/file/{*path}",
any(page_ai_openhub::non_ai_route_guard),
)
.route(
"/page-ai/openhub/files",
any(page_ai_openhub::non_ai_route_guard),
)
.route(
"/page-ai/openhub/files/{*path}",
any(page_ai_openhub::non_ai_route_guard),
)
.route(
"/page-ai/openhub/knowledge",
any(page_ai_openhub::non_ai_route_guard),
)
.route(
"/page-ai/openhub/knowledge/{*path}",
any(page_ai_openhub::non_ai_route_guard),
)
.route(
"/page-ai/openhub/git",
any(page_ai_openhub::non_ai_route_guard),
)
.route(
"/page-ai/openhub/git/{*path}",
any(page_ai_openhub::non_ai_route_guard),
)
.route(
"/api/page-ai/opencode/session",
post(page_ai_opencode::bind_session),
File diff suppressed because it is too large Load Diff
+2 -12
View File
@@ -1,6 +1,6 @@
//! Pi-first Page AI Lab — MNote 托管的后端垂直切片。
//!
//! 该模块默认启用 MNote 托管的 Pi Rust Page AI 后端;OpenHub 仅保留为迁移期兼容 / admin 边界。
//! 该模块默认启用 MNote 托管的 Pi Rust Page AI 后端;OpenHub 与 Pi TS 已退役到 recycle 边界。
//! Pi 进程通过 RPC subprocess 托管,MNote bridge tools 在 Rust 后端按 allowed roots 执行权限校验。
use crate::app::AppState;
@@ -60,7 +60,6 @@ const PI_LAB_MAX_STARTS_PER_WINDOW: usize = 4;
const PI_LAB_MAX_SENDS_PER_WINDOW: usize = 12;
const PI_LAB_MAX_TOOLS_PER_WINDOW: usize = 40;
const PI_LAB_RUNTIME_IMPL_RUST: &str = "pi-rust";
const PI_LAB_RUNTIME_IMPL_TS: &str = "pi-ts";
const PI_LAB_MANAGED_BUILTIN_TOOLS: [&str; 8] = [
"read",
"write",
@@ -970,9 +969,6 @@ fn pi_binary() -> String {
if let Some(explicit) = env_trimmed("MNOTE_PAGE_AI_PI_BIN") {
return explicit;
}
if pi_runtime_impl() == PI_LAB_RUNTIME_IMPL_TS {
return env_trimmed("MNOTE_PAGE_AI_PI_TS_BIN").unwrap_or_else(|| "pi".into());
}
env_trimmed("MNOTE_PAGE_AI_PI_RUST_BIN")
.or_else(first_existing_pi_rust_binary)
.unwrap_or_else(|| "pi-rust".into())
@@ -983,7 +979,6 @@ fn pi_runtime_impl() -> String {
.or_else(|| env_trimmed("MNOTE_PAGE_AI_PI_RUNTIME_IMPL"))
.unwrap_or_else(|| PI_LAB_RUNTIME_IMPL_RUST.into());
match raw.trim().to_ascii_lowercase().as_str() {
"ts" | "typescript" | "pi-ts" | "legacy-ts" => PI_LAB_RUNTIME_IMPL_TS.into(),
"rust" | "rs" | "pi-rust" | "pi_agent_rust" | "pi-agent-rust" => {
PI_LAB_RUNTIME_IMPL_RUST.into()
}
@@ -1026,15 +1021,10 @@ fn pi_runtime_binary_available(binary: &str) -> bool {
.any(|candidate| candidate.is_file())
}
fn pi_runtime_install_hint(runtime_impl: &str, binary: &str) -> Option<String> {
fn pi_runtime_install_hint(_runtime_impl: &str, binary: &str) -> Option<String> {
if runtime_mode() == "mock" || pi_runtime_binary_available(binary) {
return None;
}
if runtime_impl == PI_LAB_RUNTIME_IMPL_TS {
return Some(format!(
"未找到 Pi TS runtime: {binary}。请设置 MNOTE_PAGE_AI_PI_TS_BIN 或 MNOTE_PAGE_AI_PI_BIN。"
));
}
Some(format!(
"未找到 Pi Rust runtime: {binary}。请安装到 ~/.local/share/mnote/pi-rust/bin/pi,或设置 MNOTE_PAGE_AI_PI_RUST_BIN / MNOTE_PAGE_AI_PI_BIN。"
))