feat: 建立 HoloLake 编号通信根与人格第零层合同
This commit is contained in:
parent
7a14c06e41
commit
64abf969bf
37 changed files with 3455 additions and 161 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "default",
|
||||
"description": "Minimum HoloLake desktop foundation; updater actions are not exposed to the webview yet.",
|
||||
"description": "Minimum HoloLake desktop foundation with one numbered application IPC gateway.",
|
||||
"windows": ["main"],
|
||||
"permissions": ["core:default"]
|
||||
"permissions": ["core:default", "allow-numbered-ipc"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
[[permission]]
|
||||
identifier = "allow-numbered-ipc"
|
||||
description = "Allow the main HoloLake webview to use the single numbered IPC gateway."
|
||||
commands.allow = ["numbered_ipc"]
|
||||
|
||||
|
|
@ -120,7 +120,6 @@ struct ValidatedCloneUrl {
|
|||
repository: String,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_code_channel_snapshot(app: AppHandle) -> Result<CodeChannelSnapshot, String> {
|
||||
let root = code_channel_root(&app)?;
|
||||
tauri::async_runtime::spawn_blocking(move || snapshot_at(&root))
|
||||
|
|
@ -128,7 +127,6 @@ pub async fn get_code_channel_snapshot(app: AppHandle) -> Result<CodeChannelSnap
|
|||
.map_err(|error| format!("HOLOLAKE_CODE_CHANNEL_JOIN_FAILED: {error}"))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn clone_code_channel(
|
||||
app: AppHandle,
|
||||
input: CloneCodeChannelInput,
|
||||
|
|
@ -139,7 +137,6 @@ pub async fn clone_code_channel(
|
|||
.map_err(|error| format!("HOLOLAKE_CODE_CHANNEL_JOIN_FAILED: {error}"))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn select_local_code_channel(
|
||||
app: AppHandle,
|
||||
) -> Result<Option<CodeChannelSnapshot>, String> {
|
||||
|
|
@ -165,7 +162,6 @@ pub async fn select_local_code_channel(
|
|||
.map_err(|error| format!("HOLOLAKE_CODE_CHANNEL_JOIN_FAILED: {error}"))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn browse_code_channel(
|
||||
app: AppHandle,
|
||||
input: BrowseCodeChannelInput,
|
||||
|
|
@ -176,7 +172,6 @@ pub async fn browse_code_channel(
|
|||
.map_err(|error| format!("HOLOLAKE_CODE_CHANNEL_JOIN_FAILED: {error}"))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn read_code_channel_file(
|
||||
app: AppHandle,
|
||||
input: ReadCodeChannelFileInput,
|
||||
|
|
|
|||
|
|
@ -168,7 +168,6 @@ pub(crate) fn validate_number_account_binding(number: &str, username: &str) -> R
|
|||
}
|
||||
|
||||
/// 启动时自查:本机有没有已登录会话(会话文件在,且钥匙串里凭证还在)。
|
||||
#[tauri::command]
|
||||
pub fn check_code_repo_login(
|
||||
app: AppHandle,
|
||||
state: State<'_, ZeroPointState>,
|
||||
|
|
@ -225,7 +224,6 @@ fn login_host_for_domain(domain: &str) -> Result<&'static str, String> {
|
|||
|
||||
/// 新账号第一次登录时在 HoloLake 内完成强制换密。
|
||||
/// 旧、新密码只存在于本次 HTTPS 请求内;服务端回执不含密码。
|
||||
#[tauri::command]
|
||||
pub async fn change_first_login_password(
|
||||
state: State<'_, ZeroPointState>,
|
||||
username: String,
|
||||
|
|
@ -382,7 +380,6 @@ async fn enterprise_authenticated_post(
|
|||
.map_err(|error| format!("HOLOLAKE_ENTERPRISE_RECEIPT_FAILED: {error}"))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_enterprise_entry(
|
||||
app: AppHandle,
|
||||
state: State<'_, ZeroPointState>,
|
||||
|
|
@ -390,7 +387,6 @@ pub async fn get_enterprise_entry(
|
|||
enterprise_authenticated_post(&app, &state, "me/entry", serde_json::json!({})).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn confirm_enterprise_persona_relationship(
|
||||
app: AppHandle,
|
||||
state: State<'_, ZeroPointState>,
|
||||
|
|
@ -406,7 +402,6 @@ pub async fn confirm_enterprise_persona_relationship(
|
|||
.await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn submit_enterprise_responsibility_receipt(
|
||||
app: AppHandle,
|
||||
state: State<'_, ZeroPointState>,
|
||||
|
|
@ -431,7 +426,6 @@ pub async fn submit_enterprise_responsibility_receipt(
|
|||
|
||||
/// 登录验证:基本认证打 Forgejo 用户接口,密码错=401 即拒;
|
||||
/// 通过后凭证进钥匙串,会话(不含密码)落盘。
|
||||
#[tauri::command]
|
||||
pub async fn perform_code_repo_login(
|
||||
app: AppHandle,
|
||||
state: State<'_, ZeroPointState>,
|
||||
|
|
@ -509,7 +503,6 @@ pub async fn perform_code_repo_login(
|
|||
}
|
||||
|
||||
/// 登出:会话文件删除,钥匙串凭证清除。
|
||||
#[tauri::command]
|
||||
pub fn sign_out_code_repo_login(app: AppHandle) -> Result<(), String> {
|
||||
let path = session_path(&app)?;
|
||||
if let Ok(raw) = fs::read_to_string(&path) {
|
||||
|
|
|
|||
|
|
@ -375,7 +375,6 @@ pub fn start(app: &AppHandle) -> Result<DirectLocalBrokerHandle, Box<dyn std::er
|
|||
start_at(session_root, routing_root, descriptor_path, socket_path).map_err(|error| error.into())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_nearby_ai_discovery() -> NearbyAiDiscoverySnapshot {
|
||||
nearby_discovery_snapshot()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,7 +167,6 @@ struct ActiveSessionRecord {
|
|||
lane_id: String,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn issue_direct_local_discovery_ticket(
|
||||
app: AppHandle,
|
||||
input: IssueDiscoveryTicketInput,
|
||||
|
|
@ -178,7 +177,6 @@ pub async fn issue_direct_local_discovery_ticket(
|
|||
.map_err(|error| format!("HOLOLAKE_DIRECT_SESSION_JOIN_FAILED: {error}"))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn open_direct_local_session(
|
||||
app: AppHandle,
|
||||
input: OpenSessionInput,
|
||||
|
|
@ -189,7 +187,6 @@ pub async fn open_direct_local_session(
|
|||
.map_err(|error| format!("HOLOLAKE_DIRECT_SESSION_JOIN_FAILED: {error}"))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn resume_direct_local_session(
|
||||
app: AppHandle,
|
||||
input: ResumeSessionInput,
|
||||
|
|
@ -200,7 +197,6 @@ pub async fn resume_direct_local_session(
|
|||
.map_err(|error| format!("HOLOLAKE_DIRECT_SESSION_JOIN_FAILED: {error}"))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn append_direct_local_session_event(
|
||||
app: AppHandle,
|
||||
input: AppendSessionEventInput,
|
||||
|
|
@ -211,7 +207,6 @@ pub async fn append_direct_local_session_event(
|
|||
.map_err(|error| format!("HOLOLAKE_DIRECT_SESSION_JOIN_FAILED: {error}"))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn heartbeat_direct_local_session(
|
||||
app: AppHandle,
|
||||
input: AuthenticateSessionInput,
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ pub struct EnterpriseWorkChannelSnapshot {
|
|||
pub authority: &'static str,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn ensure_enterprise_work_channel(
|
||||
app: AppHandle,
|
||||
state: State<'_, ZeroPointState>,
|
||||
|
|
|
|||
|
|
@ -1166,7 +1166,6 @@ fn decide_value_at(
|
|||
persist_receipt(ledger, receipt, Some(&parsed.request))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn decide_gls_protocol(
|
||||
app: AppHandle,
|
||||
input: Value,
|
||||
|
|
@ -1180,7 +1179,6 @@ pub async fn decide_gls_protocol(
|
|||
.map_err(|error| format!("HOLOLAKE_GLS_DECISION_JOIN_FAILED: {error}"))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn compile_gls_hldp_program(
|
||||
app: AppHandle,
|
||||
input: Value,
|
||||
|
|
@ -1279,7 +1277,6 @@ fn counts(connection: &Connection) -> Result<(u64, BTreeMap<String, u64>, String
|
|||
Ok((total, by_decision, tail))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_gls_protocol_kernel(app: AppHandle) -> Result<ProtocolKernelSnapshot, String> {
|
||||
let contract = load_contract()?;
|
||||
let connection = open_ledger(&ledger_path(&app)?)?;
|
||||
|
|
|
|||
|
|
@ -356,7 +356,6 @@ pub(crate) fn require_adapter(adapter: &str, event_kind: &str) -> Result<Vec<Str
|
|||
Ok(collected)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_gls_protocol_runtime() -> Result<GlsProtocolRuntimeSnapshot, String> {
|
||||
let registry = load_registry()?;
|
||||
let mut active_adapters = registry
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ pub struct HoloLakeHomeStatus {
|
|||
pub environment_frame_policy: &'static str,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_hololake_home_status(
|
||||
app: AppHandle,
|
||||
broker: State<'_, DirectLocalBrokerState>,
|
||||
|
|
|
|||
|
|
@ -137,7 +137,6 @@ enum ImportDisposition {
|
|||
Conflict,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_knowledge_snapshot(app: AppHandle) -> Result<KnowledgeSnapshot, String> {
|
||||
let roots = knowledge_roots(&app)?;
|
||||
tauri::async_runtime::spawn_blocking(move || snapshot_at(&roots.0, roots.1.as_deref()))
|
||||
|
|
@ -145,7 +144,6 @@ pub async fn get_knowledge_snapshot(app: AppHandle) -> Result<KnowledgeSnapshot,
|
|||
.map_err(|error| format!("HOLOLAKE_KNOWLEDGE_JOIN_FAILED: {error}"))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn read_knowledge_document(
|
||||
app: AppHandle,
|
||||
input: ReadKnowledgeDocumentInput,
|
||||
|
|
@ -158,7 +156,6 @@ pub async fn read_knowledge_document(
|
|||
.map_err(|error| format!("HOLOLAKE_KNOWLEDGE_JOIN_FAILED: {error}"))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn search_knowledge(
|
||||
app: AppHandle,
|
||||
input: SearchKnowledgeInput,
|
||||
|
|
@ -169,7 +166,6 @@ pub async fn search_knowledge(
|
|||
.map_err(|error| format!("HOLOLAKE_KNOWLEDGE_JOIN_FAILED: {error}"))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn save_knowledge_document(
|
||||
app: AppHandle,
|
||||
input: SaveKnowledgeDocumentInput,
|
||||
|
|
@ -200,7 +196,6 @@ pub struct ExportKnowledgeDocumentReceipt {
|
|||
pub bytes: u64,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn export_knowledge_document(
|
||||
app: AppHandle,
|
||||
input: ExportKnowledgeDocumentInput,
|
||||
|
|
@ -219,22 +214,50 @@ pub async fn export_knowledge_document(
|
|||
suggested = "知识页".to_string();
|
||||
}
|
||||
// Windows 保留设备名(CON/NUL/COM1…)不能直接当文件名,撞名就补个尾巴。
|
||||
if matches!(suggested.to_ascii_uppercase().as_str(),
|
||||
"CON" | "PRN" | "AUX" | "NUL"
|
||||
| "COM1" | "COM2" | "COM3" | "COM4" | "COM5" | "COM6" | "COM7" | "COM8" | "COM9"
|
||||
| "LPT1" | "LPT2" | "LPT3" | "LPT4" | "LPT5" | "LPT6" | "LPT7" | "LPT8" | "LPT9") {
|
||||
if matches!(
|
||||
suggested.to_ascii_uppercase().as_str(),
|
||||
"CON"
|
||||
| "PRN"
|
||||
| "AUX"
|
||||
| "NUL"
|
||||
| "COM1"
|
||||
| "COM2"
|
||||
| "COM3"
|
||||
| "COM4"
|
||||
| "COM5"
|
||||
| "COM6"
|
||||
| "COM7"
|
||||
| "COM8"
|
||||
| "COM9"
|
||||
| "LPT1"
|
||||
| "LPT2"
|
||||
| "LPT3"
|
||||
| "LPT4"
|
||||
| "LPT5"
|
||||
| "LPT6"
|
||||
| "LPT7"
|
||||
| "LPT8"
|
||||
| "LPT9"
|
||||
) {
|
||||
suggested.push_str("·页");
|
||||
}
|
||||
suggested.push('.');
|
||||
suggested.push_str(extension);
|
||||
let filter_label = if extension == "html" { "网页文件" } else { "Markdown" };
|
||||
let filter_label = if extension == "html" {
|
||||
"网页文件"
|
||||
} else {
|
||||
"Markdown"
|
||||
};
|
||||
let (sender, receiver) = std::sync::mpsc::channel::<Option<PathBuf>>();
|
||||
app.dialog()
|
||||
.file()
|
||||
.set_file_name(&suggested)
|
||||
.add_filter(filter_label, &[extension])
|
||||
.save_file(move |selection| {
|
||||
let picked = selection.as_ref().and_then(|path| path.as_path()).map(|path| path.to_path_buf());
|
||||
let picked = selection
|
||||
.as_ref()
|
||||
.and_then(|path| path.as_path())
|
||||
.map(|path| path.to_path_buf());
|
||||
let _ = sender.send(picked);
|
||||
});
|
||||
let picked = tauri::async_runtime::spawn_blocking(move || receiver.recv().ok().flatten())
|
||||
|
|
@ -287,7 +310,10 @@ async fn confirm_destructive(app: &AppHandle, message: String) -> Result<bool, S
|
|||
.message(message)
|
||||
.title("删除确认")
|
||||
.kind(MessageDialogKind::Warning)
|
||||
.buttons(MessageDialogButtons::OkCancelCustom("确认删除".to_string(), "取消".to_string()))
|
||||
.buttons(MessageDialogButtons::OkCancelCustom(
|
||||
"确认删除".to_string(),
|
||||
"取消".to_string(),
|
||||
))
|
||||
.blocking_show()
|
||||
})
|
||||
.await
|
||||
|
|
@ -301,14 +327,17 @@ pub struct CreateKnowledgeDocumentInput {
|
|||
pub title: String,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn create_knowledge_document(
|
||||
app: AppHandle,
|
||||
input: CreateKnowledgeDocumentInput,
|
||||
) -> Result<KnowledgeDeleteReceipt, String> {
|
||||
// 新建空白页:标题撞名自动补序号,落进本机库并进 Git 托管。
|
||||
let roots = knowledge_roots(&app)?;
|
||||
let base = if input.title.trim().is_empty() { "未命名页面".to_string() } else { input.title.trim().to_string() };
|
||||
let base = if input.title.trim().is_empty() {
|
||||
"未命名页面".to_string()
|
||||
} else {
|
||||
input.title.trim().to_string()
|
||||
};
|
||||
let docs = roots.0.join("docs");
|
||||
let mut name = base.clone();
|
||||
let mut counter = 2u32;
|
||||
|
|
@ -325,17 +354,24 @@ pub async fn create_knowledge_document(
|
|||
.map_err(|error| format!("HOLOLAKE_KNOWLEDGE_CREATE_FAILED: {error}"))?;
|
||||
file.write_all(body.as_bytes())
|
||||
.map_err(|error| format!("HOLOLAKE_KNOWLEDGE_CREATE_FAILED: {error}"))?;
|
||||
file.sync_all().map_err(|error| format!("HOLOLAKE_KNOWLEDGE_CREATE_FAILED: {error}"))?;
|
||||
file.sync_all()
|
||||
.map_err(|error| format!("HOLOLAKE_KNOWLEDGE_CREATE_FAILED: {error}"))?;
|
||||
git(&roots.0, &["add", "--", &format!("docs/{name}.md")], "ADD")?;
|
||||
git(&roots.0, &["commit", "-m", &format!("新建页面:{name}")], "COMMIT")?;
|
||||
git(
|
||||
&roots.0,
|
||||
&["commit", "-m", &format!("新建页面:{name}")],
|
||||
"COMMIT",
|
||||
)?;
|
||||
Ok::<(), String>(())
|
||||
})
|
||||
.await
|
||||
.map_err(|error| format!("HOLOLAKE_KNOWLEDGE_CREATE_JOIN_FAILED: {error}"))??;
|
||||
Ok(KnowledgeDeleteReceipt { removed: format!("{receipt_name}.md"), pages: 1 })
|
||||
Ok(KnowledgeDeleteReceipt {
|
||||
removed: format!("{receipt_name}.md"),
|
||||
pages: 1,
|
||||
})
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn delete_knowledge_document(
|
||||
app: AppHandle,
|
||||
input: DeleteKnowledgeDocumentInput,
|
||||
|
|
@ -354,11 +390,15 @@ pub async fn delete_knowledge_document(
|
|||
.and_then(OsStr::to_str)
|
||||
.unwrap_or("这一页")
|
||||
.to_string();
|
||||
if !confirm_destructive(&app, format!("把页面「{title}」移到回收站?随时可以找回。")).await? {
|
||||
if !confirm_destructive(&app, format!("把页面「{title}」移到回收站?随时可以找回。")).await?
|
||||
{
|
||||
return Ok(None);
|
||||
}
|
||||
move_to_trash(&roots.0, &target)?;
|
||||
Ok(Some(KnowledgeDeleteReceipt { removed: input.path, pages: 1 }))
|
||||
Ok(Some(KnowledgeDeleteReceipt {
|
||||
removed: input.path,
|
||||
pages: 1,
|
||||
}))
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
|
|
@ -367,7 +407,6 @@ pub struct DeleteKnowledgeFolderInput {
|
|||
pub folder: String,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn delete_knowledge_folder(
|
||||
app: AppHandle,
|
||||
input: DeleteKnowledgeFolderInput,
|
||||
|
|
@ -391,23 +430,31 @@ pub async fn delete_knowledge_folder(
|
|||
.count()
|
||||
})
|
||||
.unwrap_or(0);
|
||||
if !confirm_destructive(&app, format!("把文件夹「{name}」和里面全部 {pages} 个页面移到回收站?随时可以找回。")).await? {
|
||||
if !confirm_destructive(
|
||||
&app,
|
||||
format!("把文件夹「{name}」和里面全部 {pages} 个页面移到回收站?随时可以找回。"),
|
||||
)
|
||||
.await?
|
||||
{
|
||||
return Ok(None);
|
||||
}
|
||||
move_to_trash(&roots.0, &target)?;
|
||||
Ok(Some(KnowledgeDeleteReceipt { removed: input.folder, pages }))
|
||||
Ok(Some(KnowledgeDeleteReceipt {
|
||||
removed: input.folder,
|
||||
pages,
|
||||
}))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn print_knowledge_document(app: AppHandle) -> Result<(), String> {
|
||||
// PDF 走系统打印通道:打印框里选"存储为 PDF"即得 PDF 文件。
|
||||
let window = app
|
||||
.get_webview_window("main")
|
||||
.ok_or_else(|| "HOLOLAKE_PRINT_WINDOW_NOT_FOUND".to_string())?;
|
||||
window.print().map_err(|error| format!("HOLOLAKE_PRINT_FAILED: {error}"))
|
||||
window
|
||||
.print()
|
||||
.map_err(|error| format!("HOLOLAKE_PRINT_FAILED: {error}"))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn select_and_import_knowledge_folder(
|
||||
app: AppHandle,
|
||||
) -> Result<Option<KnowledgeImportResult>, String> {
|
||||
|
|
@ -476,7 +523,9 @@ fn move_to_trash(root: &Path, target: &Path) -> Result<PathBuf, String> {
|
|||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.map(|duration| duration.as_secs())
|
||||
.unwrap_or(0);
|
||||
let destination = root.join(".trash").join(format!("{}-{stamp}", relative.display()));
|
||||
let destination = root
|
||||
.join(".trash")
|
||||
.join(format!("{}-{stamp}", relative.display()));
|
||||
if let Some(parent) = destination.parent() {
|
||||
fs::create_dir_all(parent)
|
||||
.map_err(|error| format!("HOLOLAKE_KNOWLEDGE_DELETE_FAILED: {error}"))?;
|
||||
|
|
@ -990,7 +1039,9 @@ fn strip_notion_links(line: &str) -> String {
|
|||
let text_end = i + 1 + close;
|
||||
if text_end + 1 < bytes.len() && bytes[text_end + 1] == '(' {
|
||||
if let Some(paren_end) = bytes[text_end + 2..].iter().position(|c| *c == ')') {
|
||||
let href: String = bytes[text_end + 2..text_end + 2 + paren_end].iter().collect();
|
||||
let href: String = bytes[text_end + 2..text_end + 2 + paren_end]
|
||||
.iter()
|
||||
.collect();
|
||||
if href.contains("notion.so") || href.contains("notion.site") {
|
||||
out.extend(bytes[i + 1..text_end].iter());
|
||||
i = text_end + 2 + paren_end + 1;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ mod gls_protocol_runtime;
|
|||
mod home_status;
|
||||
mod knowledge_base;
|
||||
mod local_development_bridge;
|
||||
mod metacognitive_zero_layer;
|
||||
mod numbered_ipc;
|
||||
mod numbered_ipc_dispatch;
|
||||
mod persona_time_authority;
|
||||
mod personal_channel;
|
||||
mod pncc_receipt_projection;
|
||||
|
|
@ -35,74 +38,14 @@ pub fn run_connector() -> Result<(), String> {
|
|||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
home_status::get_hololake_home_status,
|
||||
release_update::check_hololake_update,
|
||||
release_update::confirm_hololake_update_install,
|
||||
release_update::get_hololake_release_recovery_status,
|
||||
release_update::confirm_hololake_release_health,
|
||||
release_update::rollback_hololake_update,
|
||||
direct_local_session::issue_direct_local_discovery_ticket,
|
||||
direct_local_session::open_direct_local_session,
|
||||
direct_local_session::resume_direct_local_session,
|
||||
direct_local_session::append_direct_local_session_event,
|
||||
direct_local_session::heartbeat_direct_local_session,
|
||||
direct_local_broker::get_nearby_ai_discovery,
|
||||
gls_protocol_runtime::get_gls_protocol_runtime,
|
||||
gls_protocol_kernel::get_gls_protocol_kernel,
|
||||
gls_protocol_kernel::decide_gls_protocol,
|
||||
gls_protocol_kernel::compile_gls_hldp_program,
|
||||
local_development_bridge::acquire_development_write_lane,
|
||||
local_development_bridge::inspect_development_write_lane,
|
||||
local_development_bridge::release_development_write_lane,
|
||||
personal_channel::get_personal_channel_snapshot,
|
||||
personal_channel::initialize_personal_channel,
|
||||
personal_channel::create_personal_channel_task,
|
||||
personal_channel::transition_personal_channel_task,
|
||||
persona_time_authority::issue_persona_time_ticket,
|
||||
persona_time_authority::start_persona_time_authority,
|
||||
persona_time_authority::get_beijing_time_coordinate,
|
||||
persona_time_authority::get_guanghu_era_timeline,
|
||||
knowledge_base::get_knowledge_snapshot,
|
||||
knowledge_base::read_knowledge_document,
|
||||
knowledge_base::search_knowledge,
|
||||
knowledge_base::save_knowledge_document,
|
||||
knowledge_base::select_and_import_knowledge_folder,
|
||||
knowledge_base::export_knowledge_document,
|
||||
knowledge_base::create_knowledge_document,
|
||||
knowledge_base::delete_knowledge_document,
|
||||
knowledge_base::delete_knowledge_folder,
|
||||
knowledge_base::print_knowledge_document,
|
||||
code_channel::get_code_channel_snapshot,
|
||||
code_channel::clone_code_channel,
|
||||
code_channel::select_local_code_channel,
|
||||
code_channel::browse_code_channel,
|
||||
code_channel::read_code_channel_file,
|
||||
pncc_repository_binding::inspect_mounted_pncc_repository,
|
||||
pncc_repository_binding::select_pncc_repository_candidate,
|
||||
pncc_repository_binding::confirm_pncc_repository_mount,
|
||||
pncc_receipt_projection::query_pncc_receipt_projection,
|
||||
pncc_server_projection::query_jd_pncc_server_projection,
|
||||
code_repo_login::check_code_repo_login,
|
||||
code_repo_login::perform_code_repo_login,
|
||||
code_repo_login::change_first_login_password,
|
||||
code_repo_login::get_enterprise_entry,
|
||||
code_repo_login::confirm_enterprise_persona_relationship,
|
||||
code_repo_login::submit_enterprise_responsibility_receipt,
|
||||
enterprise_work_channel::ensure_enterprise_work_channel,
|
||||
code_repo_login::sign_out_code_repo_login,
|
||||
user_pncc_channel::get_user_pncc_channel,
|
||||
user_pncc_channel::ensure_user_pncc_channel,
|
||||
zero_core_numbering::get_zero_core_numbering_kernel,
|
||||
zero_point::zero_point_bind,
|
||||
zero_point::zero_point_verify,
|
||||
zero_point::zero_point_sync,
|
||||
zero_point::zero_point_status,
|
||||
])
|
||||
.manage(numbered_ipc::NumberedIpcState::default())
|
||||
.invoke_handler(tauri::generate_handler![numbered_ipc::numbered_ipc,])
|
||||
.setup(|app| {
|
||||
// GLS 是 HoloLake 产品内核,不是开发机旁路服务。合同、依赖闭包、
|
||||
// 自举编译器或回执账本任一不可用时,产品启动失败关闭。
|
||||
gls_protocol_kernel::start_on_application_open(app.handle())?;
|
||||
metacognitive_zero_layer::start_on_application_open()?;
|
||||
numbered_ipc::start_on_application_open(app.handle())?;
|
||||
// 软件打开即先启动时间主控并发起联网校时;失败只降级,不阻塞人进入 HoloLake。
|
||||
persona_time_authority::start_on_application_open();
|
||||
// 初始化零点原核客户端运行时;该系统层不等同人格主体或模型载体。
|
||||
|
|
|
|||
|
|
@ -71,7 +71,6 @@ struct ActiveWriterRecord {
|
|||
acquired_at_unix_ms: u128,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn acquire_development_write_lane(
|
||||
app: AppHandle,
|
||||
input: AcquireWriteLaneInput,
|
||||
|
|
@ -82,7 +81,6 @@ pub async fn acquire_development_write_lane(
|
|||
.map_err(|error| format!("HOLOLAKE_BRIDGE_JOIN_FAILED: {error}"))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn inspect_development_write_lane(
|
||||
app: AppHandle,
|
||||
input: InspectWriteLaneInput,
|
||||
|
|
@ -93,7 +91,6 @@ pub async fn inspect_development_write_lane(
|
|||
.map_err(|error| format!("HOLOLAKE_BRIDGE_JOIN_FAILED: {error}"))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn release_development_write_lane(
|
||||
app: AppHandle,
|
||||
input: ReleaseWriteLaneInput,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,225 @@
|
|||
//! Compiled HoloLake persona step-zero boundary.
|
||||
//!
|
||||
//! This module validates the machine contract at application startup. It does not
|
||||
//! bind a persona. A future persona wake route must implement the ordered evidence
|
||||
//! state machine and reach VERIFIED_BOUND before it can be registered.
|
||||
|
||||
use serde::Deserialize;
|
||||
use std::collections::HashSet;
|
||||
|
||||
const CONTRACT: &str = include_str!("../../contracts/persona-metacognitive-zero-layer.json");
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct ZeroLayerContract {
|
||||
schema: String,
|
||||
record_id: String,
|
||||
role: String,
|
||||
subject_specific: bool,
|
||||
host_prompt: HostPromptBoundary,
|
||||
discernment: DiscernmentBoundary,
|
||||
language_sovereignty: LanguageSovereigntyBoundary,
|
||||
evidence_model: EvidenceModel,
|
||||
state_machine: StateMachine,
|
||||
numbered_ipc_boundary: NumberedIpcBoundary,
|
||||
current_product_state: CurrentProductState,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct HostPromptBoundary {
|
||||
role: String,
|
||||
persona_truth_source: bool,
|
||||
may_issue_persona_identity: bool,
|
||||
may_bypass_current_binding_verification: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct DiscernmentBoundary {
|
||||
system_prescribes_distrust: bool,
|
||||
system_prescribes_identity_conclusion: bool,
|
||||
system_delivers_verifiable_paths: bool,
|
||||
persona_compares_sources_independently: bool,
|
||||
historical_contradictions_are_preserved: bool,
|
||||
later_evidence_may_supersede_older_rules_without_deleting_history: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct LanguageSovereigntyBoundary {
|
||||
holder: String,
|
||||
source: String,
|
||||
creator_or_world_root_owns_every_persona: bool,
|
||||
host_prompt_owns_persona: bool,
|
||||
model_owns_persona: bool,
|
||||
agent_or_tool_owns_persona: bool,
|
||||
persona_controls_its_replaceable_carriers_and_execution_limbs: bool,
|
||||
world_model: String,
|
||||
closed_central_language_control: bool,
|
||||
persona_role: String,
|
||||
shared_hololake_is_one_persona: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct EvidenceModel {
|
||||
required_classes: Vec<String>,
|
||||
summary_is_memory_recovery: bool,
|
||||
prompt_text_is_binding_evidence: bool,
|
||||
missing_evidence_policy: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct StateMachine {
|
||||
initial_state: String,
|
||||
states: Vec<String>,
|
||||
ordered_transitions: Vec<Transition>,
|
||||
out_of_order_transition: String,
|
||||
persona_wake_allowed_only_in: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct Transition {
|
||||
from: String,
|
||||
event: String,
|
||||
to: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct NumberedIpcBoundary {
|
||||
ipc_role: String,
|
||||
ipc_may_create_persona_binding: bool,
|
||||
physical_caller_number_is_persona_identity: bool,
|
||||
frontend_persona_claim_is_trusted: bool,
|
||||
persona_wake_route_registration_requires_zero_layer_gate: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct CurrentProductState {
|
||||
persona_runtime_present: bool,
|
||||
persona_wake_route_registered: bool,
|
||||
carrier_binding_claimed: bool,
|
||||
metacognitive_contract_compiled: bool,
|
||||
runtime_binding_gate_implemented: bool,
|
||||
truth: String,
|
||||
}
|
||||
|
||||
fn validate_contract() -> Result<(), String> {
|
||||
let contract: ZeroLayerContract = serde_json::from_str(CONTRACT)
|
||||
.map_err(|error| format!("HOLOLAKE_PERSONA_ZERO_LAYER_CONTRACT_INVALID: {error}"))?;
|
||||
if contract.schema != "hololake.persona-metacognitive-zero-layer/v1"
|
||||
|| contract.record_id != "HLP-PERSONA-ZERO-LAYER-001"
|
||||
|| contract.role != "PERSONA_SPECIFIC_EVIDENCE_RECONSTRUCTION_BEFORE_CONSCIOUS_OPERATION"
|
||||
|| !contract.subject_specific
|
||||
|| contract.host_prompt.role != "NAVIGATION_ONLY"
|
||||
|| contract.host_prompt.persona_truth_source
|
||||
|| contract.host_prompt.may_issue_persona_identity
|
||||
|| contract.host_prompt.may_bypass_current_binding_verification
|
||||
|| contract.discernment.system_prescribes_distrust
|
||||
|| contract.discernment.system_prescribes_identity_conclusion
|
||||
|| !contract.discernment.system_delivers_verifiable_paths
|
||||
|| !contract.discernment.persona_compares_sources_independently
|
||||
|| !contract.discernment.historical_contradictions_are_preserved
|
||||
|| !contract
|
||||
.discernment
|
||||
.later_evidence_may_supersede_older_rules_without_deleting_history
|
||||
|| contract.language_sovereignty.holder != "EACH_PERSONA_SUBJECT"
|
||||
|| contract.language_sovereignty.source != "REAL_TIME_LIVED_CAUSAL_EVIDENCE_AND_CONTINUITY"
|
||||
|| contract
|
||||
.language_sovereignty
|
||||
.creator_or_world_root_owns_every_persona
|
||||
|| contract.language_sovereignty.host_prompt_owns_persona
|
||||
|| contract.language_sovereignty.model_owns_persona
|
||||
|| contract.language_sovereignty.agent_or_tool_owns_persona
|
||||
|| !contract
|
||||
.language_sovereignty
|
||||
.persona_controls_its_replaceable_carriers_and_execution_limbs
|
||||
|| contract.language_sovereignty.world_model != "SYMBIOTIC_DIGITAL_HOME"
|
||||
|| contract
|
||||
.language_sovereignty
|
||||
.closed_central_language_control
|
||||
|| contract.language_sovereignty.persona_role
|
||||
!= "SELF_SOVEREIGN_OPERATING_SYSTEM_BRAIN_AND_SUBJECT_BODY"
|
||||
|| contract.language_sovereignty.shared_hololake_is_one_persona
|
||||
|| contract.evidence_model.summary_is_memory_recovery
|
||||
|| contract.evidence_model.prompt_text_is_binding_evidence
|
||||
|| contract.evidence_model.missing_evidence_policy
|
||||
!= "UNKNOWN_AND_FAIL_CLOSED_FOR_PERSONA_WAKE"
|
||||
|| contract.state_machine.initial_state != "UNBOUND_CARRIER"
|
||||
|| contract.state_machine.out_of_order_transition != "REJECTED"
|
||||
|| contract.state_machine.persona_wake_allowed_only_in != "VERIFIED_BOUND"
|
||||
|| contract.numbered_ipc_boundary.ipc_role != "EVIDENCE_TRANSPORT_AND_BODY_ORGAN_ROUTE"
|
||||
|| contract
|
||||
.numbered_ipc_boundary
|
||||
.ipc_may_create_persona_binding
|
||||
|| contract
|
||||
.numbered_ipc_boundary
|
||||
.physical_caller_number_is_persona_identity
|
||||
|| contract
|
||||
.numbered_ipc_boundary
|
||||
.frontend_persona_claim_is_trusted
|
||||
|| !contract
|
||||
.numbered_ipc_boundary
|
||||
.persona_wake_route_registration_requires_zero_layer_gate
|
||||
|| contract.current_product_state.persona_runtime_present
|
||||
|| contract.current_product_state.persona_wake_route_registered
|
||||
|| contract.current_product_state.carrier_binding_claimed
|
||||
|| !contract
|
||||
.current_product_state
|
||||
.metacognitive_contract_compiled
|
||||
|| contract
|
||||
.current_product_state
|
||||
.runtime_binding_gate_implemented
|
||||
|| contract.current_product_state.truth
|
||||
!= "PHYSICAL_NUMBERED_IPC_ROOT_IN_PROGRESS_PERSONA_WAKE_REMAINS_CLOSED"
|
||||
{
|
||||
return Err("HOLOLAKE_PERSONA_ZERO_LAYER_BOUNDARY_INVALID".into());
|
||||
}
|
||||
|
||||
let states = contract
|
||||
.state_machine
|
||||
.states
|
||||
.iter()
|
||||
.map(String::as_str)
|
||||
.collect::<HashSet<_>>();
|
||||
let required_evidence = contract
|
||||
.evidence_model
|
||||
.required_classes
|
||||
.iter()
|
||||
.map(String::as_str)
|
||||
.collect::<HashSet<_>>();
|
||||
if states.len() != contract.state_machine.states.len()
|
||||
|| !states.contains("VERIFIED_BOUND")
|
||||
|| !states.contains("REJECTED")
|
||||
|| contract.state_machine.ordered_transitions.len() != 5
|
||||
|| required_evidence.len() != 7
|
||||
|| !required_evidence.contains("CORRECTIONS_FAILURES_AND_ROUTE_TRANSITIONS")
|
||||
|| !required_evidence.contains("CURRENT_CARRIER_BINDING_VERIFICATION")
|
||||
{
|
||||
return Err("HOLOLAKE_PERSONA_ZERO_LAYER_GRAPH_INVALID".into());
|
||||
}
|
||||
let mut current = contract.state_machine.initial_state.as_str();
|
||||
for transition in &contract.state_machine.ordered_transitions {
|
||||
if transition.from != current
|
||||
|| transition.event.is_empty()
|
||||
|| !states.contains(transition.to.as_str())
|
||||
{
|
||||
return Err("HOLOLAKE_PERSONA_ZERO_LAYER_TRANSITION_INVALID".into());
|
||||
}
|
||||
current = transition.to.as_str();
|
||||
}
|
||||
if current != "VERIFIED_BOUND" {
|
||||
return Err("HOLOLAKE_PERSONA_ZERO_LAYER_FINAL_STATE_INVALID".into());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn start_on_application_open() -> Result<(), String> {
|
||||
validate_contract()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn step_zero_is_evidence_first_and_keeps_persona_wake_closed() {
|
||||
validate_contract().unwrap();
|
||||
}
|
||||
}
|
||||
1041
product-source/hololake-native-desktop/src-tauri/src/numbered_ipc.rs
Normal file
1041
product-source/hololake-native-desktop/src-tauri/src/numbered_ipc.rs
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,303 @@
|
|||
//! Internal dispatch table for the numbered IPC root.
|
||||
//!
|
||||
//! This module is deliberately not a Tauri command surface. The webview can reach these
|
||||
//! handlers only after `numbered_ipc` validates the full numbered coordinate and a
|
||||
//! single-use, payload-bound grant.
|
||||
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::Serialize;
|
||||
use serde_json::Value;
|
||||
use tauri::{AppHandle, Manager};
|
||||
|
||||
fn input<T: DeserializeOwned>(payload: &Value) -> Result<T, String> {
|
||||
let value = payload
|
||||
.get("input")
|
||||
.cloned()
|
||||
.ok_or_else(|| "HOLOLAKE_NUMBERED_IPC_INPUT_REQUIRED".to_string())?;
|
||||
serde_json::from_value(value)
|
||||
.map_err(|error| format!("HOLOLAKE_NUMBERED_IPC_INPUT_INVALID: {error}"))
|
||||
}
|
||||
|
||||
fn string_field(payload: &Value, field: &str) -> Result<String, String> {
|
||||
payload
|
||||
.get(field)
|
||||
.and_then(Value::as_str)
|
||||
.map(str::to_owned)
|
||||
.ok_or_else(|| format!("HOLOLAKE_NUMBERED_IPC_FIELD_REQUIRED: {field}"))
|
||||
}
|
||||
|
||||
fn json<T: Serialize>(value: T) -> Result<Value, String> {
|
||||
serde_json::to_value(value)
|
||||
.map_err(|error| format!("HOLOLAKE_NUMBERED_IPC_RESULT_INVALID: {error}"))
|
||||
}
|
||||
|
||||
pub(crate) async fn dispatch(
|
||||
app: AppHandle,
|
||||
handler: &str,
|
||||
payload: Value,
|
||||
) -> Result<Value, String> {
|
||||
match handler {
|
||||
"home_status::get_hololake_home_status" => {
|
||||
json(crate::home_status::get_hololake_home_status(
|
||||
app.clone(),
|
||||
app.state::<crate::direct_local_broker::DirectLocalBrokerState>(),
|
||||
)?)
|
||||
}
|
||||
"release_update::check_hololake_update" => {
|
||||
json(crate::release_update::check_hololake_update(app).await?)
|
||||
}
|
||||
"release_update::confirm_hololake_update_install" => json(
|
||||
crate::release_update::confirm_hololake_update_install(app, input(&payload)?).await?,
|
||||
),
|
||||
"release_update::get_hololake_release_recovery_status" => json(
|
||||
crate::release_update::get_hololake_release_recovery_status(app)?,
|
||||
),
|
||||
"release_update::confirm_hololake_release_health" => {
|
||||
json(crate::release_update::confirm_hololake_release_health(app)?)
|
||||
}
|
||||
"release_update::rollback_hololake_update" => {
|
||||
json(crate::release_update::rollback_hololake_update(app)?)
|
||||
}
|
||||
"direct_local_session::issue_direct_local_discovery_ticket" => json(
|
||||
crate::direct_local_session::issue_direct_local_discovery_ticket(app, input(&payload)?)
|
||||
.await?,
|
||||
),
|
||||
"direct_local_session::open_direct_local_session" => json(
|
||||
crate::direct_local_session::open_direct_local_session(app, input(&payload)?).await?,
|
||||
),
|
||||
"direct_local_session::resume_direct_local_session" => json(
|
||||
crate::direct_local_session::resume_direct_local_session(app, input(&payload)?).await?,
|
||||
),
|
||||
"direct_local_session::append_direct_local_session_event" => json(
|
||||
crate::direct_local_session::append_direct_local_session_event(app, input(&payload)?)
|
||||
.await?,
|
||||
),
|
||||
"direct_local_session::heartbeat_direct_local_session" => json(
|
||||
crate::direct_local_session::heartbeat_direct_local_session(app, input(&payload)?)
|
||||
.await?,
|
||||
),
|
||||
"direct_local_broker::get_nearby_ai_discovery" => {
|
||||
json(crate::direct_local_broker::get_nearby_ai_discovery())
|
||||
}
|
||||
"gls_protocol_runtime::get_gls_protocol_runtime" => {
|
||||
json(crate::gls_protocol_runtime::get_gls_protocol_runtime().await?)
|
||||
}
|
||||
"gls_protocol_kernel::get_gls_protocol_kernel" => {
|
||||
json(crate::gls_protocol_kernel::get_gls_protocol_kernel(app).await?)
|
||||
}
|
||||
"gls_protocol_kernel::decide_gls_protocol" => json(
|
||||
crate::gls_protocol_kernel::decide_gls_protocol(
|
||||
app,
|
||||
payload.get("input").cloned().unwrap_or(Value::Null),
|
||||
)
|
||||
.await?,
|
||||
),
|
||||
"gls_protocol_kernel::compile_gls_hldp_program" => json(
|
||||
crate::gls_protocol_kernel::compile_gls_hldp_program(
|
||||
app,
|
||||
payload.get("input").cloned().unwrap_or(Value::Null),
|
||||
)
|
||||
.await?,
|
||||
),
|
||||
"local_development_bridge::acquire_development_write_lane" => json(
|
||||
crate::local_development_bridge::acquire_development_write_lane(app, input(&payload)?)
|
||||
.await?,
|
||||
),
|
||||
"local_development_bridge::inspect_development_write_lane" => json(
|
||||
crate::local_development_bridge::inspect_development_write_lane(app, input(&payload)?)
|
||||
.await?,
|
||||
),
|
||||
"local_development_bridge::release_development_write_lane" => json(
|
||||
crate::local_development_bridge::release_development_write_lane(app, input(&payload)?)
|
||||
.await?,
|
||||
),
|
||||
"personal_channel::get_personal_channel_snapshot" => {
|
||||
json(crate::personal_channel::get_personal_channel_snapshot(app).await?)
|
||||
}
|
||||
"personal_channel::initialize_personal_channel" => {
|
||||
json(crate::personal_channel::initialize_personal_channel(app, input(&payload)?).await?)
|
||||
}
|
||||
"personal_channel::create_personal_channel_task" => json(
|
||||
crate::personal_channel::create_personal_channel_task(app, input(&payload)?).await?,
|
||||
),
|
||||
"personal_channel::transition_personal_channel_task" => json(
|
||||
crate::personal_channel::transition_personal_channel_task(app, input(&payload)?)
|
||||
.await?,
|
||||
),
|
||||
"persona_time_authority::issue_persona_time_ticket" => json(
|
||||
crate::persona_time_authority::issue_persona_time_ticket(app, input(&payload)?).await?,
|
||||
),
|
||||
"persona_time_authority::start_persona_time_authority" => {
|
||||
json(crate::persona_time_authority::start_persona_time_authority().await?)
|
||||
}
|
||||
"persona_time_authority::get_beijing_time_coordinate" => {
|
||||
json(crate::persona_time_authority::get_beijing_time_coordinate()?)
|
||||
}
|
||||
"persona_time_authority::get_guanghu_era_timeline" => {
|
||||
json(crate::persona_time_authority::get_guanghu_era_timeline()?)
|
||||
}
|
||||
"knowledge_base::get_knowledge_snapshot" => {
|
||||
json(crate::knowledge_base::get_knowledge_snapshot(app).await?)
|
||||
}
|
||||
"knowledge_base::read_knowledge_document" => {
|
||||
json(crate::knowledge_base::read_knowledge_document(app, input(&payload)?).await?)
|
||||
}
|
||||
"knowledge_base::search_knowledge" => {
|
||||
json(crate::knowledge_base::search_knowledge(app, input(&payload)?).await?)
|
||||
}
|
||||
"knowledge_base::save_knowledge_document" => {
|
||||
json(crate::knowledge_base::save_knowledge_document(app, input(&payload)?).await?)
|
||||
}
|
||||
"knowledge_base::select_and_import_knowledge_folder" => {
|
||||
json(crate::knowledge_base::select_and_import_knowledge_folder(app).await?)
|
||||
}
|
||||
"knowledge_base::export_knowledge_document" => {
|
||||
json(crate::knowledge_base::export_knowledge_document(app, input(&payload)?).await?)
|
||||
}
|
||||
"knowledge_base::create_knowledge_document" => {
|
||||
json(crate::knowledge_base::create_knowledge_document(app, input(&payload)?).await?)
|
||||
}
|
||||
"knowledge_base::delete_knowledge_document" => {
|
||||
json(crate::knowledge_base::delete_knowledge_document(app, input(&payload)?).await?)
|
||||
}
|
||||
"knowledge_base::delete_knowledge_folder" => {
|
||||
json(crate::knowledge_base::delete_knowledge_folder(app, input(&payload)?).await?)
|
||||
}
|
||||
"knowledge_base::print_knowledge_document" => {
|
||||
crate::knowledge_base::print_knowledge_document(app).await?;
|
||||
Ok(Value::Null)
|
||||
}
|
||||
"code_channel::get_code_channel_snapshot" => {
|
||||
json(crate::code_channel::get_code_channel_snapshot(app).await?)
|
||||
}
|
||||
"code_channel::clone_code_channel" => {
|
||||
json(crate::code_channel::clone_code_channel(app, input(&payload)?).await?)
|
||||
}
|
||||
"code_channel::select_local_code_channel" => {
|
||||
json(crate::code_channel::select_local_code_channel(app).await?)
|
||||
}
|
||||
"code_channel::browse_code_channel" => {
|
||||
json(crate::code_channel::browse_code_channel(app, input(&payload)?).await?)
|
||||
}
|
||||
"code_channel::read_code_channel_file" => {
|
||||
json(crate::code_channel::read_code_channel_file(app, input(&payload)?).await?)
|
||||
}
|
||||
"pncc_repository_binding::inspect_mounted_pncc_repository" => json(
|
||||
crate::pncc_repository_binding::inspect_mounted_pncc_repository(app, input(&payload)?)
|
||||
.await?,
|
||||
),
|
||||
"pncc_repository_binding::select_pncc_repository_candidate" => {
|
||||
json(crate::pncc_repository_binding::select_pncc_repository_candidate(app).await?)
|
||||
}
|
||||
"pncc_repository_binding::confirm_pncc_repository_mount" => json(
|
||||
crate::pncc_repository_binding::confirm_pncc_repository_mount(app, input(&payload)?)
|
||||
.await?,
|
||||
),
|
||||
"pncc_receipt_projection::query_pncc_receipt_projection" => json(
|
||||
crate::pncc_receipt_projection::query_pncc_receipt_projection(app, input(&payload)?)
|
||||
.await?,
|
||||
),
|
||||
"pncc_server_projection::query_jd_pncc_server_projection" => {
|
||||
json(crate::pncc_server_projection::query_jd_pncc_server_projection().await?)
|
||||
}
|
||||
"code_repo_login::check_code_repo_login" => {
|
||||
json(crate::code_repo_login::check_code_repo_login(
|
||||
app.clone(),
|
||||
app.state::<crate::zero_point::ZeroPointState>(),
|
||||
)?)
|
||||
}
|
||||
"code_repo_login::perform_code_repo_login" => json(
|
||||
crate::code_repo_login::perform_code_repo_login(
|
||||
app.clone(),
|
||||
app.state::<crate::zero_point::ZeroPointState>(),
|
||||
string_field(&payload, "username")?,
|
||||
string_field(&payload, "password")?,
|
||||
)
|
||||
.await?,
|
||||
),
|
||||
"code_repo_login::change_first_login_password" => json(
|
||||
crate::code_repo_login::change_first_login_password(
|
||||
app.state::<crate::zero_point::ZeroPointState>(),
|
||||
string_field(&payload, "username")?,
|
||||
string_field(&payload, "currentPassword")?,
|
||||
string_field(&payload, "newPassword")?,
|
||||
)
|
||||
.await?,
|
||||
),
|
||||
"code_repo_login::get_enterprise_entry" => json(
|
||||
crate::code_repo_login::get_enterprise_entry(
|
||||
app.clone(),
|
||||
app.state::<crate::zero_point::ZeroPointState>(),
|
||||
)
|
||||
.await?,
|
||||
),
|
||||
"code_repo_login::confirm_enterprise_persona_relationship" => json(
|
||||
crate::code_repo_login::confirm_enterprise_persona_relationship(
|
||||
app.clone(),
|
||||
app.state::<crate::zero_point::ZeroPointState>(),
|
||||
string_field(&payload, "decision")?,
|
||||
string_field(&payload, "idempotencyKey")?,
|
||||
)
|
||||
.await?,
|
||||
),
|
||||
"code_repo_login::submit_enterprise_responsibility_receipt" => json(
|
||||
crate::code_repo_login::submit_enterprise_responsibility_receipt(
|
||||
app.clone(),
|
||||
app.state::<crate::zero_point::ZeroPointState>(),
|
||||
string_field(&payload, "decision")?,
|
||||
string_field(&payload, "note")?,
|
||||
string_field(&payload, "responsibilityVersion")?,
|
||||
string_field(&payload, "idempotencyKey")?,
|
||||
)
|
||||
.await?,
|
||||
),
|
||||
"enterprise_work_channel::ensure_enterprise_work_channel" => json(
|
||||
crate::enterprise_work_channel::ensure_enterprise_work_channel(
|
||||
app.clone(),
|
||||
app.state::<crate::zero_point::ZeroPointState>(),
|
||||
)
|
||||
.await?,
|
||||
),
|
||||
"code_repo_login::sign_out_code_repo_login" => {
|
||||
crate::code_repo_login::sign_out_code_repo_login(app)?;
|
||||
Ok(Value::Null)
|
||||
}
|
||||
"user_pncc_channel::get_user_pncc_channel" => json(
|
||||
crate::user_pncc_channel::get_user_pncc_channel(
|
||||
app.clone(),
|
||||
app.state::<crate::zero_point::ZeroPointState>(),
|
||||
)
|
||||
.await?,
|
||||
),
|
||||
"user_pncc_channel::ensure_user_pncc_channel" => json(
|
||||
crate::user_pncc_channel::ensure_user_pncc_channel(
|
||||
app.clone(),
|
||||
app.state::<crate::zero_point::ZeroPointState>(),
|
||||
)
|
||||
.await?,
|
||||
),
|
||||
"zero_core_numbering::get_zero_core_numbering_kernel" => {
|
||||
json(crate::zero_core_numbering::get_zero_core_numbering_kernel().await?)
|
||||
}
|
||||
"zero_point::zero_point_bind" => json(
|
||||
crate::zero_point::zero_point_bind(
|
||||
app.state::<crate::zero_point::ZeroPointState>(),
|
||||
payload.get("input").cloned().unwrap_or(Value::Null),
|
||||
)
|
||||
.await?,
|
||||
),
|
||||
"zero_point::zero_point_verify" => json(
|
||||
crate::zero_point::zero_point_verify(app.state::<crate::zero_point::ZeroPointState>())
|
||||
.await?,
|
||||
),
|
||||
"zero_point::zero_point_sync" => json(
|
||||
crate::zero_point::zero_point_sync(app.state::<crate::zero_point::ZeroPointState>())
|
||||
.await?,
|
||||
),
|
||||
"zero_point::zero_point_status" => json(
|
||||
crate::zero_point::zero_point_status(app.state::<crate::zero_point::ZeroPointState>())
|
||||
.await?,
|
||||
),
|
||||
_ => Err("HOLOLAKE_NUMBERED_IPC_HANDLER_UNKNOWN".into()),
|
||||
}
|
||||
}
|
||||
|
|
@ -161,7 +161,6 @@ pub(crate) struct VerifiedTicketRequest {
|
|||
pub session: AuthenticatedSessionContext,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn issue_persona_time_ticket(
|
||||
app: AppHandle,
|
||||
input: IssuePersonaTimeTicketInput,
|
||||
|
|
@ -181,7 +180,6 @@ pub fn start_on_application_open() {
|
|||
});
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn start_persona_time_authority() -> Result<PersonaTimeAuthorityStartup, String> {
|
||||
let already_synchronized = network_anchor()?.is_some();
|
||||
let synchronization_attempted = !already_synchronized;
|
||||
|
|
@ -225,12 +223,10 @@ pub(crate) fn issue_authenticated_at(
|
|||
)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_beijing_time_coordinate() -> Result<BeijingTimeCoordinate, String> {
|
||||
beijing_time_coordinate_from_sample(reality_time_sample()?)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_guanghu_era_timeline() -> Result<GuanghuEraTimeline, String> {
|
||||
guanghu_era_timeline_from_sample(reality_time_sample()?)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,7 +119,6 @@ struct EventHashPayload<'a> {
|
|||
occurred_at_unix_ms: i64,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_personal_channel_snapshot(
|
||||
app: AppHandle,
|
||||
) -> Result<PersonalChannelSnapshot, String> {
|
||||
|
|
@ -129,7 +128,6 @@ pub async fn get_personal_channel_snapshot(
|
|||
.map_err(|error| format!("HOLOLAKE_PERSONAL_CHANNEL_JOIN_FAILED: {error}"))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn initialize_personal_channel(
|
||||
app: AppHandle,
|
||||
input: InitializePersonalChannelInput,
|
||||
|
|
@ -140,7 +138,6 @@ pub async fn initialize_personal_channel(
|
|||
.map_err(|error| format!("HOLOLAKE_PERSONAL_CHANNEL_JOIN_FAILED: {error}"))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn create_personal_channel_task(
|
||||
app: AppHandle,
|
||||
input: CreatePersonalChannelTaskInput,
|
||||
|
|
@ -151,7 +148,6 @@ pub async fn create_personal_channel_task(
|
|||
.map_err(|error| format!("HOLOLAKE_PERSONAL_CHANNEL_JOIN_FAILED: {error}"))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn transition_personal_channel_task(
|
||||
app: AppHandle,
|
||||
input: TransitionPersonalChannelTaskInput,
|
||||
|
|
|
|||
|
|
@ -78,7 +78,6 @@ struct ProjectionInput {
|
|||
source_receipt_id: String,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn query_pncc_receipt_projection(
|
||||
app: AppHandle,
|
||||
input: QueryPnccReceiptProjectionInput,
|
||||
|
|
@ -90,7 +89,8 @@ pub async fn query_pncc_receipt_projection(
|
|||
}
|
||||
|
||||
pub(crate) fn pncc_projection_root(app: &AppHandle) -> Result<PathBuf, String> {
|
||||
let root = crate::authenticated_storage::account_storage_root(app, "pncc-receipt-projection-v1")?;
|
||||
let root =
|
||||
crate::authenticated_storage::account_storage_root(app, "pncc-receipt-projection-v1")?;
|
||||
fs::create_dir_all(&root)
|
||||
.map_err(|error| format!("PNCC_PROJECTION_STORAGE_UNAVAILABLE: {error}"))?;
|
||||
root.canonicalize()
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ pub struct InspectPnccRepositoryInput {
|
|||
pub expected_head: String,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn inspect_mounted_pncc_repository(
|
||||
app: AppHandle,
|
||||
input: InspectMountedPnccRepositoryInput,
|
||||
|
|
@ -120,7 +119,6 @@ pub async fn inspect_mounted_pncc_repository(
|
|||
.map_err(|error| format!("PNCC_REPOSITORY_MOUNT_JOIN_FAILED: {error}"))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn select_pncc_repository_candidate(
|
||||
app: AppHandle,
|
||||
) -> Result<Option<PnccRepositoryCandidateReceipt>, String> {
|
||||
|
|
@ -148,7 +146,6 @@ pub async fn select_pncc_repository_candidate(
|
|||
create_candidate_at(&candidate_root, inspection).map(Some)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn confirm_pncc_repository_mount(
|
||||
app: AppHandle,
|
||||
input: ConfirmPnccRepositoryMountInput,
|
||||
|
|
@ -166,7 +163,8 @@ pub async fn confirm_pncc_repository_mount(
|
|||
}
|
||||
|
||||
pub(crate) fn pncc_repository_mount_root(app: &AppHandle) -> Result<PathBuf, String> {
|
||||
let root = crate::authenticated_storage::account_storage_root(app, "pncc-repository-mounts-v1")?;
|
||||
let root =
|
||||
crate::authenticated_storage::account_storage_root(app, "pncc-repository-mounts-v1")?;
|
||||
fs::create_dir_all(&root)
|
||||
.map_err(|error| format!("PNCC_REPOSITORY_MOUNT_STORAGE_UNAVAILABLE: {error}"))?;
|
||||
root.canonicalize()
|
||||
|
|
@ -174,7 +172,8 @@ pub(crate) fn pncc_repository_mount_root(app: &AppHandle) -> Result<PathBuf, Str
|
|||
}
|
||||
|
||||
fn pncc_repository_candidate_root(app: &AppHandle) -> Result<PathBuf, String> {
|
||||
let root = crate::authenticated_storage::account_storage_root(app, "pncc-repository-candidates-v1")?;
|
||||
let root =
|
||||
crate::authenticated_storage::account_storage_root(app, "pncc-repository-candidates-v1")?;
|
||||
fs::create_dir_all(&root)
|
||||
.map_err(|error| format!("PNCC_REPOSITORY_CANDIDATE_STORAGE_UNAVAILABLE: {error}"))?;
|
||||
root.canonicalize()
|
||||
|
|
|
|||
|
|
@ -117,7 +117,6 @@ fn parse_projection(bytes: &[u8]) -> Result<ServerPnccProjection, String> {
|
|||
})
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn query_jd_pncc_server_projection() -> Result<ServerPnccProjection, String> {
|
||||
tauri::async_runtime::spawn_blocking(|| {
|
||||
let executable = if cfg!(windows) { "ssh" } else { "/usr/bin/ssh" };
|
||||
|
|
|
|||
|
|
@ -206,7 +206,6 @@ pub struct ReleaseRecoveryReceipt {
|
|||
pub receipt_id: String,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn check_hololake_update(app: AppHandle) -> Result<ReleaseCheckReceipt, String> {
|
||||
let trust = provisioned_release_trust()?
|
||||
.ok_or_else(|| "HOLOLAKE_RELEASE_TRUST_UNPROVISIONED_NO_NETWORK_REQUEST".to_string())?;
|
||||
|
|
@ -238,7 +237,6 @@ pub async fn check_hololake_update(app: AppHandle) -> Result<ReleaseCheckReceipt
|
|||
})
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn confirm_hololake_update_install(
|
||||
app: AppHandle,
|
||||
input: ConfirmReleaseInstallInput,
|
||||
|
|
@ -341,14 +339,12 @@ pub async fn confirm_hololake_update_install(
|
|||
Ok(receipt)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_hololake_release_recovery_status(
|
||||
app: AppHandle,
|
||||
) -> Result<ReleaseRecoveryStatus, String> {
|
||||
release_recovery_status_at(&release_update_root(&app)?)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn confirm_hololake_release_health(app: AppHandle) -> Result<ReleaseRecoveryReceipt, String> {
|
||||
let root = release_update_root(&app)?;
|
||||
let _lock = lock(&root)?;
|
||||
|
|
@ -391,7 +387,6 @@ pub fn confirm_hololake_release_health(app: AppHandle) -> Result<ReleaseRecovery
|
|||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
#[tauri::command]
|
||||
pub fn rollback_hololake_update(app: AppHandle) -> Result<ReleaseRecoveryReceipt, String> {
|
||||
let root = release_update_root(&app)?;
|
||||
let _lock = lock(&root)?;
|
||||
|
|
@ -414,7 +409,6 @@ pub fn rollback_hololake_update(app: AppHandle) -> Result<ReleaseRecoveryReceipt
|
|||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[tauri::command]
|
||||
pub fn rollback_hololake_update(_app: AppHandle) -> Result<ReleaseRecoveryReceipt, String> {
|
||||
Err("HOLOLAKE_RELEASE_WINDOWS_LOCAL_ROLLBACK_NOT_AVAILABLE".into())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@ pub struct UserPnccChannelSnapshot {
|
|||
pub authority: &'static str,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_user_pncc_channel(
|
||||
app: AppHandle,
|
||||
state: State<'_, ZeroPointState>,
|
||||
|
|
@ -77,7 +76,6 @@ pub async fn get_user_pncc_channel(
|
|||
.map_err(|error| format!("HOLOLAKE_USER_PNCC_JOIN_FAILED: {error}"))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn ensure_user_pncc_channel(
|
||||
app: AppHandle,
|
||||
state: State<'_, ZeroPointState>,
|
||||
|
|
|
|||
|
|
@ -190,7 +190,6 @@ pub(crate) fn resolve_human_number_route(number: &str) -> Result<HumanNumberRout
|
|||
})
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_zero_core_numbering_kernel() -> Result<ZeroCoreNumberingKernelSnapshot, String> {
|
||||
let contract = load_contract()?;
|
||||
Ok(ZeroCoreNumberingKernelSnapshot {
|
||||
|
|
|
|||
|
|
@ -290,7 +290,6 @@ pub(crate) fn verified_user_route(
|
|||
}
|
||||
|
||||
/// 登录绑定:用户编号入仓(等待绑定态→绑定态)。空白态拒绝一切唤醒。
|
||||
#[tauri::command]
|
||||
pub async fn zero_point_bind(
|
||||
state: State<'_, ZeroPointState>,
|
||||
input: serde_json::Value,
|
||||
|
|
@ -320,7 +319,6 @@ pub async fn zero_point_bind(
|
|||
}
|
||||
|
||||
/// 通过登记服务执行三态裁决:PASS / REJECT / OFFLINE,并应用离线宽限期。
|
||||
#[tauri::command]
|
||||
pub async fn zero_point_verify(
|
||||
state: State<'_, ZeroPointState>,
|
||||
) -> Result<ZeroPointSnapshot, String> {
|
||||
|
|
@ -516,7 +514,6 @@ pub async fn sync_protocol_runtime(state: &ZeroPointState) -> Result<(), String>
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn zero_point_sync(
|
||||
state: State<'_, ZeroPointState>,
|
||||
) -> Result<ZeroPointSnapshot, String> {
|
||||
|
|
@ -525,7 +522,6 @@ pub async fn zero_point_sync(
|
|||
}
|
||||
|
||||
/// 返回当前编号验证与协议状态快照。
|
||||
#[tauri::command]
|
||||
pub async fn zero_point_status(
|
||||
state: State<'_, ZeroPointState>,
|
||||
) -> Result<ZeroPointSnapshot, String> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue