Make Codex and Claude Code subscriptions go further: a local model router that gives routine agent work to economical models and keeps your strongest model for the hard parts.
Rust ai-agentsai-gatewayclaude-codecodexcoding-agentcost-optimizationdeepseekllm-gatewayllm-routerlocal-firstmodel-routingrusttask-routingtauri
Prepare 0.3.1 and preserve released CLI connection probes (#100)
澄潭1186ce2368b0
diff --git a/Cargo.lock b/Cargo.lockindex cc08bcce..cb10b804 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -2211,7 +2211,7 @@ dependencies = [[[package]]name = "hiroute-application-api"-version = "0.3.0"+version = "0.3.1"dependencies = ["hiroute-domain","serde",@@ -2222,7 +2222,7 @@ dependencies = [[[package]]name = "hiroute-cli"-version = "0.3.0"+version = "0.3.1"dependencies = ["getrandom 0.3.4","hiroute-application",@@ -2284,7 +2284,7 @@ dependencies = [[[package]]name = "hiroute-daemon"-version = "0.3.0"+version = "0.3.1"dependencies = ["agent-client-protocol","arc-swap",@@ -2321,7 +2321,7 @@ dependencies = [[[package]]name = "hiroute-desktop"-version = "0.3.0"+version = "0.3.1"dependencies = ["command-fds","fs2",@@ -2358,7 +2358,7 @@ dependencies = [[[package]]name = "hiroute-diagnostics"-version = "0.3.0"+version = "0.3.1"dependencies = ["fs2","getrandom 0.3.4",diff --git a/apps/desktop/package-lock.json b/apps/desktop/package-lock.jsonindex d6481e85..c7d985ba 100644--- a/apps/desktop/package-lock.json+++ b/apps/desktop/package-lock.json@@ -1,12 +1,12 @@{"name": "hiroute-desktop-ui",- "version": "0.3.0",+ "version": "0.3.1","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "hiroute-desktop-ui",- "version": "0.3.0",+ "version": "0.3.1","dependencies": {"@tauri-apps/api": "2.11.1","@tauri-apps/plugin-clipboard-manager": "2.3.2",diff --git a/apps/desktop/package.json b/apps/desktop/package.jsonindex 199b3928..05203928 100644--- a/apps/desktop/package.json+++ b/apps/desktop/package.json@@ -1,6 +1,6 @@{"name": "hiroute-desktop-ui",- "version": "0.3.0",+ "version": "0.3.1","private": true,"type": "module","scripts": {diff --git a/apps/desktop/src-tauri/Cargo.toml b/apps/desktop/src-tauri/Cargo.tomlindex 08875a47..213de8c8 100644--- a/apps/desktop/src-tauri/Cargo.toml+++ b/apps/desktop/src-tauri/Cargo.toml@@ -1,6 +1,6 @@[package]name = "hiroute-desktop"-version = "0.3.0"+version = "0.3.1"edition.workspace = truelicense.workspace = truerust-version.workspace = truediff --git a/apps/desktop/src-tauri/src/bridge/model_connections.rs b/apps/desktop/src-tauri/src/bridge/model_connections.rsindex b55c9f39..5a666887 100644--- a/apps/desktop/src-tauri/src/bridge/model_connections.rs+++ b/apps/desktop/src-tauri/src/bridge/model_connections.rs@@ -451,6 +451,9 @@ pub async fn check_registered_model_connection(request: RegisteredModelConnectionCheckRequestV1,) -> Result<ModelConnectionCheckViewV1, DesktopFailure> {main_window(&window)?;+ if request.display_name.is_none() {+ return Err("REQUEST_INVALID".into());+ }let client = state.0.lock()diff --git a/apps/desktop/src-tauri/tauri.conf.json b/apps/desktop/src-tauri/tauri.conf.jsonindex 8aff9cd1..501ba67a 100644--- a/apps/desktop/src-tauri/tauri.conf.json+++ b/apps/desktop/src-tauri/tauri.conf.json@@ -1,7 +1,7 @@{"$schema": "https://schema.tauri.app/config/2","productName": "HiRoute",- "version": "0.3.0",+ "version": "0.3.1","identifier": "ai.hiroute.desktop","build": {"frontendDist": "../dist"diff --git a/apps/desktop/tests/v3/browser/product-shell-scenarios.mjs b/apps/desktop/tests/v3/browser/product-shell-scenarios.mjsindex e90cfa41..14d356f8 100644--- a/apps/desktop/tests/v3/browser/product-shell-scenarios.mjs+++ b/apps/desktop/tests/v3/browser/product-shell-scenarios.mjs@@ -20,6 +20,17 @@ async function deviceScan() {all('.add-choice').find(item => item.textContent.includes('扫描本机')).click();await until(() => button('设置订阅连接代理') && !button('设置订阅连接代理').disabled, 'ready device scan');}+async function newBailianAPI() {+ await click('添加模型');+ await until(() => all('.add-choice').some(item => item.textContent.includes('新建 API 接入')), 'new API entry');+ all('.add-choice').find(item => item.textContent.includes('新建 API 接入')).click();+ await until(() => all('.connection-provider-card').some(item => item.querySelector('strong')?.textContent === '百炼'), 'Bailian provider');+ all('.connection-provider-card').find(item => item.querySelector('strong')?.textContent === '百炼').click();+ await until(() => all('.connection-product-card').some(item => item.querySelector('strong')?.textContent.includes('Coding Plan')), 'Bailian Coding Plan');+ all('.connection-product-card').find(item => item.querySelector('strong')?.textContent.includes('Coding Plan')).click();+ await until(() => all('[role="dialog"] input[type="password"]').length === 1 && !button('检查并继续')?.disabled, 'visible API configuration');+ return all('[role="dialog"] input[type="password"]')[0];+}async function fresh(setup = () => {}) {c().reset(); setup(); await until(() => visible(document.querySelector('.sidebar-health .status-dot.good')), 'ready DesktopApp');}@@ -226,15 +237,12 @@ const scenarios = [return c().fixtureResponse('apply_compute_save', payload);};});- await click('模型'); await click('添加模型');- await until(() => all('button').some(item => item.textContent.includes('新建 API 接入')), 'new connection entry');- all('button').find(item => item.textContent.includes('新建 API 接入')).click();- await until(() => document.querySelector('[role="dialog"] input[type="password"]'), 'key field');- setInput(document.querySelector('[role="dialog"] input[type="password"]'), 'synthetic-selection-key');- await click('检查接入');+ await click('模型');+ setInput(await newBailianAPI(), 'synthetic-selection-key');+ await click('检查并继续');await until(() => all('.model-result-row input[type="checkbox"]').length, 'model choices');all('.model-result-row input[type="checkbox"]')[0].click(); await pause(40);- await click('保存接入');+ await click('保存连接');await until(() => !document.querySelector('[role="dialog"]') && calls('get_compute_save_result').length, 'completed initial save');await click('按接入');await until(() => document.querySelector('.models-feature .detail-identity h2')?.textContent === b.display_name, 'saved connection focus');@@ -248,22 +256,25 @@ const scenarios = [assert(document.querySelector('.models-feature .detail-identity h2')?.textContent === '接入 A 已改名', 'Refresh jumped to the previous saved connection');assert(JSON.stringify(b) === beforeB, 'Another connection changed while renaming A');}),- scenario('desktop.models.connection-template-directory-layout', ['model-connections'], 'The production stylesheet renders searchable template rows and pagination', async () => {+ scenario('desktop.models.connection-template-directory-layout', ['model-connections'], 'The production stylesheet renders the complete searchable provider and product directory', async () => {await fresh(); await click('模型'); await click('添加模型');await until(() => all('button').some(item => item.textContent.includes('新建 API 接入')), 'new connection entry');all('button').find(item => item.textContent.includes('新建 API 接入')).click();- await until(() => all('.mc-template-row').length > 0, 'template directory');- assert(getComputedStyle(document.querySelector('.mc-template-directory')).display === 'grid', 'Production directory layout missing');- for (const row of all('.mc-template-row')) {- assert(getComputedStyle(row).display === 'flex' && getComputedStyle(row).alignItems === 'center', 'Template row is not aligned');- assert(getComputedStyle(row.querySelector('.field-help')).display === 'block', 'Template protocol is not on its own line');+ await until(() => all('.connection-provider-card').length === 13, 'complete provider directory');+ assert(document.querySelector('.connection-directory-intro').textContent.includes('18 种接入方式'), 'Directory omits supported products');+ assert(getComputedStyle(document.querySelector('.connection-provider-grid')).display === 'grid', 'Production provider layout missing');+ for (const row of all('.connection-provider-card')) {+ assert(getComputedStyle(row).display === 'grid' && getComputedStyle(row).alignItems === 'center', 'Provider card is not aligned');+ assert(row.scrollWidth <= row.clientWidth + 1, 'Provider card overflows horizontally');+ }+ setInput(document.querySelector('.connection-directory input[type="search"]'), '百炼');+ await until(() => all('.connection-provider-card').length === 1 && all('.connection-provider-card')[0].textContent.includes('百炼'), 'filtered provider');+ all('.connection-provider-card')[0].click();+ await until(() => all('.connection-product-card').length === 3, 'all Bailian products');+ for (const row of all('.connection-product-card')) {+ assert(getComputedStyle(row).display === 'flex' && getComputedStyle(row).alignItems === 'center', 'Product row is not aligned');+ assert(getComputedStyle(row.querySelector('.row-main')).display === 'grid', 'Product description is not on its own line');}- const selected = document.querySelector('.mc-template-row input:checked');- assert(selected?.closest('.mc-template-row').classList.contains('selected'), 'Selection styling missing');- setInput(document.querySelector('.mc-template-directory input[type="search"]'), '百炼');- await until(() => all('.mc-template-row').every(row => row.textContent.includes('百炼')), 'filtered templates');- assert(all('.mc-template-row').length > 0, 'Search removed matching templates');- assert(getComputedStyle(document.querySelector('.mc-template-pagination')).display === 'flex', 'Pagination layout missing');const close = all('[role="dialog"] button[aria-label="取消添加"]')[0];assert(close, 'Template dialog close control missing');close.click();@@ -348,11 +359,8 @@ const scenarios = [await until(() => calls('apply_compute_save').length === 1, 'single remove apply');}),scenario('desktop.models.tool-check-selection', ['model-connections'], 'A tool check retains the chosen model with its fresh reference without selecting new inventory', async () => {- await fresh(); await click('模型'); await click('添加模型');- await until(() => all('button').some(item => item.textContent.includes('新建 API 接入')), 'add API entry');- all('button').find(item => item.textContent.includes('新建 API 接入')).click();- await until(() => document.querySelector('[role="dialog"] input[type="password"]'), 'API key input');- setInput(document.querySelector('[role="dialog"] input[type="password"]'), 'synthetic-tool-check-input');+ await fresh(); await click('模型');+ setInput(await newBailianAPI(), 'synthetic-tool-check-input');c().handlers.check_registered_model_connection = payload => {const result = c().fixtureResponse('check_registered_model_connection', payload);if (payload.request.inference_model_id) {@@ -361,15 +369,15 @@ const scenarios = [}return result;};- await click('检查接入');+ await click('检查并继续');await until(() => all('.model-result-row input[type="checkbox"]').length === 2, 'inventory');assert(all('.model-result-row input:checked').length === 0, 'Inventory selected models without consent');all('.model-result-row input[type="checkbox"]')[0].click(); await pause(40);await click('验证工具调用(仅所选模型,可能计费)');- await until(() => calls('check_registered_model_connection').length === 2 && button('保存接入'), 'tool check completed');+ await until(() => calls('check_registered_model_connection').length === 2 && button('保存连接'), 'tool check completed');assert(all('.model-result-row input:checked').length === 1, 'Tool check lost the explicit model selection');- assert(!button('保存接入').disabled, 'Successful tool check disabled save');- await click('保存接入');+ assert(!button('保存连接').disabled, 'Successful tool check disabled save');+ await click('保存连接');await until(() => calls('preview_compute_save').length === 1, 'save preview');const preview = JSON.stringify(calls('preview_compute_save')[0].payload);assert(preview.includes('model-ref/qwen3-coder-plus/checked') && !preview.includes('model-ref/qwen3-max/checked'), 'Save did not use only the selected fresh model reference');@@ -835,13 +843,9 @@ const scenarios = [all('button').find(item => item.textContent.includes('GPT-6-Astra')).click();await until(() => text().includes('接入就绪'), 'readiness status');assert(text().includes('不代表上游推理或工具调用已验证'), 'Local readiness claims upstream inference verification');- await click('添加模型');- await until(() => all('button').some(item => item.textContent.includes('新建 API 接入')), 'add API entry');- all('button').find(item => item.textContent.includes('新建 API 接入')).click();- await until(() => document.querySelector('[role="dialog"] input[type="password"]'), 'API key input');- const key = document.querySelector('[role="dialog"] input[type="password"]');+ const key = await newBailianAPI();setInput(key, 'synthetic-input-preserved'); await pause(40);- const link = all('a').find(item => item.textContent.includes('官方说明与获取 Key'));+ const link = all('[role="dialog"] a').find(item => item.textContent.includes('获取 API Key'));assert(link?.target === '_blank' && link.rel.includes('noreferrer') && link.href.startsWith('https://'), 'Web documentation link is unavailable');c().handlers.open_external_url = () => { throw new Error('BROWSER_UNAVAILABLE'); };link.click(); await until(() => text().includes('当前表单内容已保留'), 'native browser failure feedback');diff --git a/contracts/cli/contract-set.v1.json b/contracts/cli/contract-set.v1.jsonindex ec6a7f12..a167996b 100644--- a/contracts/cli/contract-set.v1.json+++ b/contracts/cli/contract-set.v1.json@@ -13,7 +13,7 @@"delegation-start-request.v1.schema.json": "sha256:033885686bf77cb03344c8ccc5ae245e9407e5c8010bf94e59d2232fb0b3a7b4","delegation-wait-request.v1.schema.json": "sha256:9aba6c969923f455ea376a5d8bc034efb4acd103d5b79df1d0d3aebb3d57b9e9","empty-request.v1.schema.json": "sha256:44d40c4601343ddfb543fd04751cc0a0a994fe8d7963adc541fe4a245ceba2b1",- "local-control-hello.v2.schema.json": "sha256:a7743035116338dabb267350146b3e145bc0ed7ae2c18dd373ad1a4b7a471d36",+ "local-control-hello.v2.schema.json": "sha256:32fbce882152a886b79bd139d3b4e459b48d94e0634e56ccb189b2c9971ad772","local-control.v2.schema.json": "sha256:4b654de90cd6e333b3953379e5b2e1c5125f1dcbe307b7c7c73f12bb2032d18c","machine-envelope.v2.schema.json": "sha256:5a0b47ce1fd80628f760a3da5a88de7dc01f6df83cb6eef47fd4a6c8289070ba","manifest.v1.json": "sha256:a98cee2750c670be1bbbb2cfa132bbd14e13a48f623580d807ecfbc410231d9e",diff --git a/contracts/cli/local-control-hello.v2.schema.json b/contracts/cli/local-control-hello.v2.schema.jsonindex 48dad315..a0903da1 100644--- a/contracts/cli/local-control-hello.v2.schema.json+++ b/contracts/cli/local-control-hello.v2.schema.json@@ -12,7 +12,7 @@"type": "string"},"client_version": {- "const": "0.3.0"+ "const": "0.3.1"},"machine_schema_version": {"$ref": "local-control.v2.schema.json#/properties/schema_version"diff --git a/contracts/compatibility-support.v1.json b/contracts/compatibility-support.v1.jsonindex fc5ff43b..de6f590b 100644--- a/contracts/compatibility-support.v1.json+++ b/contracts/compatibility-support.v1.json@@ -1348,6 +1348,21 @@"allowed_paths": ["crates/diagnostics/tests/response_failure_compatibility.rs"]+ },+ {+ "contract": "hiroute.compute-connection-test/v1",+ "field": "registered request omits display_name",+ "mode": "recovery_read_only",+ "owner": "compute-management",+ "allowed_paths": [+ "crates/application-api/src/model_connections.rs",+ "crates/application-api/tests/fixtures/v0.3.0-registered-connection-test.json",+ "crates/application-api/tests/fixtures/README.md",+ "crates/daemon/src/control/runtime/model_connections/registered.rs",+ "crates/application/src/compute_management/dispatch.rs"+ ],+ "reason": "Released public compute connection test callers from supported 0.2.0 and 0.3.0 omit the label. Normalize only that omission to the authenticated catalog option name; current named requests preserve the supplied label and protected Desktop checks still require an explicit label. Explicit null/invalid names, unknown fields and untrusted catalog facts remain rejected.",+ "removal_condition": "Remove only after the supported released public request shape is explicitly retired with a caller migration path under the release support policy. Do not regenerate the frozen released request with the current producer."}]}diff --git a/crates/application-api/Cargo.toml b/crates/application-api/Cargo.tomlindex 2985450a..220a4537 100644--- a/crates/application-api/Cargo.toml+++ b/crates/application-api/Cargo.toml@@ -1,6 +1,6 @@[package]name = "hiroute-application-api"-version = "0.3.0"+version = "0.3.1"edition.workspace = truelicense.workspace = truerust-version.workspace = truediff --git a/crates/application-api/src/model_connections.rs b/crates/application-api/src/model_connections.rsindex 3496b1b8..5c2557f0 100644--- a/crates/application-api/src/model_connections.rs+++ b/crates/application-api/src/model_connections.rs@@ -136,8 +136,14 @@ pub struct RegisteredModelConnectionCheckRequestV1 {#[serde(default)]pub models: Vec<NativeUserModelDeclarationV1>,pub connection_option_id: String,- /// User-visible label only; product identity and execution facts remain catalog-owned.- pub display_name: String,+ /// Current callers provide a label; released public CLI requests may omit it.+ /// The daemon resolves only that historical omission from the authenticated catalog.+ #[serde(+ default,+ skip_serializing_if = "Option::is_none",+ deserialize_with = "registered_connection_name"+ )]+ pub display_name: Option<String>,pub expected_catalog: crate::ComputeCatalogProvenanceViewV1,#[serde(default, skip_serializing_if = "Option::is_none")]pub candidate_ref: Option<String>,@@ -173,6 +179,14 @@ impl PrepareDiscoveredModelConnectionRequestV1 {}}+fn registered_connection_name<'de, D>(deserializer: D) -> Result<Option<String>, D::Error>+where+ D: serde::Deserializer<'de>,+{+ // An explicit null is not a released omission and must remain invalid.+ String::deserialize(deserializer).map(Some)+}+impl RegisteredModelConnectionCheckRequestV1 {pub fn valid(&self) -> bool {let bounded = |value: &str| {@@ -182,7 +196,7 @@ impl RegisteredModelConnectionCheckRequestV1 {&& !value.contains('\0')};bounded(&self.connection_option_id)- && bounded(&self.display_name)+ && self.display_name.as_deref().is_none_or(bounded)&& self.candidate_ref.as_ref().is_none_or(|candidate_ref| {bounded(candidate_ref) && candidate_ref == &self.input_candidate.candidate_ref})@@ -421,6 +435,23 @@ mod tests {use hiroute_domain::{GatewayAuthenticationSemanticsV1, UpstreamProtocol};use serde_json::json;+ #[test]+ fn released_public_registered_probe_preserves_omitted_name() {+ let payload = include_str!("../tests/fixtures/v0.3.0-registered-connection-test.json");+ let ComputeConnectionTestRequestV1::Registered { request } =+ serde_json::from_str(payload).unwrap()+ else {+ panic!("released fixture is not registered");+ };+ assert!(request.valid());+ let roundtrip =+ serde_json::to_value(ComputeConnectionTestRequestV1::Registered { request }).unwrap();+ assert_eq!(+ roundtrip,+ serde_json::from_str::<serde_json::Value>(payload).unwrap()+ );+ }+#[test]fn check_view_rejects_protected_transport_fields() {let value = json!({@@ -475,7 +506,7 @@ mod tests {inference_model_id: None,models: Vec::new(),connection_option_id: "bailian.payg.cn.v1".into(),- display_name: "团队百炼".into(),+ display_name: Some("团队百炼".into()),expected_catalog: crate::ComputeCatalogProvenanceViewV1 {product_release: "release-v1".into(),catalog_binding_id: "client-bundled/current".into(),@@ -499,17 +530,22 @@ mod tests {let encoded = serde_json::to_value(&request).unwrap();let mut missing_name = encoded.clone();missing_name.as_object_mut().unwrap().remove("display_name");- assert!(+ let legacy =serde_json::from_value::<RegisteredModelConnectionCheckRequestV1>(missing_name)- .is_err()+ .unwrap();+ assert!(legacy.display_name.is_none() && legacy.valid());+ let mut null_name = encoded.clone();+ null_name["display_name"] = serde_json::Value::Null;+ assert!(+ serde_json::from_value::<RegisteredModelConnectionCheckRequestV1>(null_name).is_err());for name in ["", " ", " trailing ", "bad\0name"] {- request.display_name = name.into();+ request.display_name = Some(name.into());assert!(!request.valid());}- request.display_name = "x".repeat(257);+ request.display_name = Some("x".repeat(257));assert!(!request.valid());- request.display_name = "团队百炼".into();+ request.display_name = Some("团队百炼".into());for forbidden in ["base_url","billing_class",diff --git a/crates/application-api/tests/fixtures/README.md b/crates/application-api/tests/fixtures/README.mdnew file mode 100644index 00000000..eea12d9a--- /dev/null+++ b/crates/application-api/tests/fixtures/README.md@@ -0,0 +1 @@+The registered connection request freezes the legal JSON submitted through the official 0.3.0 CLI/daemon package at ce4c480256c7590aacba080e701d7413a6736426. Its catalog provenance was read from that installed release. The same request was accepted, saved, and used for a real Worker task on 2026-10-12. It contains only opaque protected-input references, never credential bytes. The released request has no display_name; its checked draft uses the authenticated catalog option name. Preserve these bytes as historical input rather than regenerating them with the current writer.diff --git a/crates/application-api/tests/fixtures/v0.3.0-registered-connection-test.json b/crates/application-api/tests/fixtures/v0.3.0-registered-connection-test.jsonnew file mode 100644index 00000000..6986b955--- /dev/null+++ b/crates/application-api/tests/fixtures/v0.3.0-registered-connection-test.json@@ -0,0 +1,60 @@+{+ "kind": "registered",+ "request": {+ "connection_option_id": "bailian.token-plan.cn.v1",+ "expected_catalog": {+ "catalog_binding_id": "client-bundled/current",+ "connector_registry_digest": "sha256:3da14f731490fcbab5894f4a3417ac1de4534672abfc79e19e20881dfb35aba4",+ "cross_reference_digest": "sha256:3b1b0c623e2c773273638b9a94dfb7f807fa659221fe45cc2ebcdb5ce1587c8c",+ "model_data_digest": "sha256:1593b63e8d37520e7269e4c366b69006235dd4b7ae39aaf78e2c1f7360e212c5",+ "product_release": "mvp-current",+ "release_sequence": 1+ },+ "models": [+ {+ "upstream_model_id": "qwen3.6-plus",+ "display_name": "qwen3.6-plus",+ "catalog_configuration_id": null,+ "membership": "user_declared",+ "capabilities": {+ "tool": {+ "value": true,+ "basis": "user_declared"+ },+ "vision": {+ "value": false,+ "basis": "user_declared"+ },+ "streaming": {+ "value": true,+ "basis": "user_declared"+ },+ "context_tokens": {+ "value": 32768,+ "basis": "user_declared"+ },+ "max_output_tokens": {+ "value": 4096,+ "basis": "user_declared"+ },+ "native_reasoning": {+ "value": {+ "kind": "fixed",+ "profile": "provider-default"+ },+ "basis": "user_declared"+ }+ }+ }+ ],+ "candidate_ref": "candidate/release030/final",+ "lineage_ref": "lineage/release030/final",+ "edit_revision": 1,+ "check_id": "check/release030/final",+ "input_candidate": {+ "candidate_ref": "candidate/release030/final",+ "candidate_revision": 1+ },+ "inference_model_id": null+ }+}diff --git a/crates/application/src/compute_management/dispatch.rs b/crates/application/src/compute_management/dispatch.rsindex 46e6e11d..4763be68 100644--- a/crates/application/src/compute_management/dispatch.rs+++ b/crates/application/src/compute_management/dispatch.rs@@ -315,6 +315,9 @@ pub(crate) fn dispatch_compute_management(else {return failed(ErrorCode::InvalidArguments, request_id);};+ if check.display_name.is_none() {+ return failed(ErrorCode::InvalidArguments, request_id);+ }let digest = match CanonicalDigest::of(&check) {Ok(value) => value,Err(_) => return failed(ErrorCode::InvalidArguments, request_id),diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.tomlindex a7734816..09e142f9 100644--- a/crates/cli/Cargo.toml+++ b/crates/cli/Cargo.toml@@ -1,6 +1,6 @@[package]name = "hiroute-cli"-version = "0.3.0"+version = "0.3.1"edition.workspace = truelicense.workspace = truerust-version.workspace = truediff --git a/crates/client-core/tests/transport.rs b/crates/client-core/tests/transport.rsindex 4601352c..458dc08f 100644--- a/crates/client-core/tests/transport.rs+++ b/crates/client-core/tests/transport.rs@@ -275,7 +275,7 @@ async fn registered_model_check_uses_the_protected_closed_operation() {inference_model_id: None,models: Vec::new(),connection_option_id: "bailian.payg.cn.v1".into(),- display_name: "Team Bailian".into(),+ display_name: Some("Team Bailian".into()),expected_catalog: ComputeCatalogProvenanceViewV1 {product_release: "mvp-current".into(),catalog_binding_id: "fixture-catalog".into(),diff --git a/crates/daemon/Cargo.toml b/crates/daemon/Cargo.tomlindex 09b04e52..3152c8f8 100644--- a/crates/daemon/Cargo.toml+++ b/crates/daemon/Cargo.toml@@ -1,6 +1,6 @@[package]name = "hiroute-daemon"-version = "0.3.0"+version = "0.3.1"edition.workspace = truelicense.workspace = truerust-version.workspace = truediff --git a/crates/daemon/src/control/runtime/model_connections/registered.rs b/crates/daemon/src/control/runtime/model_connections/registered.rsindex d4adb28c..ed661884 100644--- a/crates/daemon/src/control/runtime/model_connections/registered.rs+++ b/crates/daemon/src/control/runtime/model_connections/registered.rs@@ -161,7 +161,10 @@ impl LocalControlAdapter {candidate_ref: request.candidate_ref.clone(),lineage_ref: request.lineage_ref.clone(),trusted_lineage_digest: None,- display_name: request.display_name.clone(),+ display_name: request+ .display_name+ .clone()+ .unwrap_or_else(|| resolved.option.display_name.clone()),existing_source_id: request.existing_source_id.clone(),edit_revision: request.edit_revision,check_id: request.check_id.clone(),@@ -390,7 +393,7 @@ mod tests {inference_model_id: None,models: Vec::new(),connection_option_id: connection_option_id.into(),- display_name: "团队 API".into(),+ display_name: Some("团队 API".into()),expected_catalog: ComputeCatalogProvenanceViewV1 {product_release: provenance.product_release,catalog_binding_id: provenance.catalog_binding_id,@@ -482,6 +485,54 @@ mod tests {.adapter.trusted_registered_draft(&request(&catalog, "bailian.payg.cn.v1")).unwrap();+ assert_eq!(bailian.display_name, "团队 API");+ let legacy = serde_json::from_str::<hiroute_application_api::ComputeConnectionTestRequestV1>(+ include_str!("../../../../../application-api/tests/fixtures/v0.3.0-registered-connection-test.json"),+ ).unwrap();+ let hiroute_application_api::ComputeConnectionTestRequestV1::Registered { request: legacy } =+ legacy+ else {+ panic!("released fixture is not registered");+ };+ let legacy_draft = runtime.adapter.trusted_registered_draft(&legacy).unwrap();+ let option = listed+ .options+ .iter()+ .find(|option| option.connection_option_id == legacy.connection_option_id)+ .unwrap();+ assert_eq!(legacy_draft.display_name, option.display_name);+ let app = hiroute_application::ApplicationService::new(runtime.application_ports());+ let protected = |payload| {+ hiroute_application_api::LocalControlWireRequestV2 {+ schema_version: hiroute_application_api::SchemaVersion::new(2, 0),+ request_id: "registered-name-authority".into(),+ operation_id:+ hiroute_application_api::CHECK_REGISTERED_MODEL_CONNECTION_OPERATION_V1.into(),+ payload,+ protected_grant: Some(hiroute_application_api::ProtectedClientGrantV2 {+ principal_kind: hiroute_application_api::PrincipalKind::Desktop,+ capability: "invalid-capability".into(),+ }),+ }+ .authenticate_ambient()+ };+ let absent_name = app.dispatch(protected(serde_json::to_value(&legacy).unwrap()));+ assert_eq!(+ absent_name.error.unwrap().code,+ hiroute_application_api::ErrorCode::InvalidArguments+ );+ let current = request(&catalog, "bailian.payg.cn.v1");+ let named = app.dispatch(protected(serde_json::to_value(current).unwrap()));+ assert_eq!(+ named.error.unwrap().code,+ hiroute_application_api::ErrorCode::CapabilityDenied+ );++ assert_eq!(legacy_draft.protocol, UpstreamProtocol::ChatCompletions);+ let mut forged = legacy.clone();+ forged.expected_catalog.cross_reference_digest =+ hiroute_domain::CanonicalDigest::of_bytes(b"untrusted");+ assert!(runtime.adapter.trusted_registered_draft(&forged).is_err());assert_eq!(bailian.base_url, "https://dashscope.aliyuncs.com");assert_eq!(bailian.request_path_override.as_deref(),diff --git a/crates/daemon/src/control/runtime/model_connections/saved.rs b/crates/daemon/src/control/runtime/model_connections/saved.rsindex 27930bbe..93fc47b8 100644--- a/crates/daemon/src/control/runtime/model_connections/saved.rs+++ b/crates/daemon/src/control/runtime/model_connections/saved.rs@@ -108,7 +108,7 @@ impl LocalControlAdapter {inference_model_id: None,models: Vec::new(),connection_option_id: connection_option_id.clone(),- display_name: source.display_name.clone(),+ display_name: Some(source.display_name.clone()),expected_catalog: ComputeCatalogProvenanceViewV1 {product_release: provenance.product_release,catalog_binding_id: provenance.catalog_binding_id,@@ -414,7 +414,7 @@ mod tests {inference_model_id: None,models: Vec::new(),connection_option_id: "bailian.payg.cn.v1".into(),- display_name: "团队百炼 · 生产".into(),+ display_name: Some("团队百炼 · 生产".into()),expected_catalog: ComputeCatalogProvenanceViewV1 {product_release: provenance.product_release,catalog_binding_id: provenance.catalog_binding_id,diff --git a/crates/diagnostics/Cargo.toml b/crates/diagnostics/Cargo.tomlindex 95dcdea2..27191c5f 100644--- a/crates/diagnostics/Cargo.toml+++ b/crates/diagnostics/Cargo.toml@@ -1,6 +1,6 @@[package]name = "hiroute-diagnostics"-version = "0.3.0"+version = "0.3.1"edition.workspace = truelicense.workspace = truerust-version.workspace = truediff --git a/docs/code-map/architecture.md b/docs/code-map/architecture.mdindex 648b992a..c4a442a4 100644--- a/docs/code-map/architecture.md+++ b/docs/code-map/architecture.md@@ -34,7 +34,7 @@ The name must fit any runtime root that supports `hiroute/control.sock`, includi| User step | Owners to follow | Representative guard || --- | --- | --- |-| Add an API connection and choose its models | [Connection directory](../../apps/desktop/src/features/model-connections/ConnectionDirectory.tsx), [form and draft ownership](../../apps/desktop/src/features/model-connections/README.md), [registered check](../../crates/daemon/src/control/runtime/model_connections/registered.rs) | The executable catalog supplies the complete directory. A source name survives check/save; per-product credentials stay in the dialog and protected input. |+| Add an API connection and choose its models | [Connection directory](../../apps/desktop/src/features/model-connections/ConnectionDirectory.tsx), [form and draft ownership](../../apps/desktop/src/features/model-connections/README.md), [registered check](../../crates/daemon/src/control/runtime/model_connections/registered.rs) | The executable catalog supplies the complete directory. A source name survives check/save; per-product credentials stay in the dialog and protected input. Released public registered probes may omit the name and use the authenticated option label; the current Desktop check requires an explicit label. || Discover a native source without executing it | [Native model connections](../../crates/integrations/src/model_connections), [Pi reader](../../crates/integrations/src/agents/pi_sources.rs), [DSH reader](../../crates/integrations/src/agents/dsh_sources.rs) | Static declarations and supported credential references only; OAuth/helpers are not executed by discovery || Display, prepare and save the selected source | [Safe Desktop projection](../../apps/desktop/src-tauri/src/bridge/model_connection_web.rs), [daemon preparation](../../crates/daemon/src/control/runtime/model_connections/pi_discovered.rs) | Provider/model identity remains visible; privileged scan material stays private; source changes invalidate the prepared candidate || Rename a connection, append models or remove saved configuration | [Shared lifecycle planner](../../crates/application/src/compute_management/mutations/lifecycle.rs), [transactional reference guards](../../crates/local-storage/src/control/compute/management/references.rs), [Desktop lifecycle dialog](../../apps/desktop/src/features/models/ConnectionLifecycleDialog.tsx) | Templates do not own credentials. Explicit append preserves saved members; enabled/disabled routes and retained recovery versions block removal. Removing the last model requires explicit connection deletion; owned secrets follow the same recoverable operation. |