From cad4ac0d0dde57704dddfbb2126f5366323a0c2f Mon Sep 17 00:00:00 2001 From: scotares Date: Fri, 20 Nov 2026 15:17:14 +0800 Subject: [PATCH 1/6] build(rutis): upgrade the plugin runtime to 0.23 Pin rutis, rutis-loader, rutis-bridge and rutis-types at 0.23.0, with the bundled Node runtime, the repository TypeScript plugins, the npm peer range and the Python SDK. Session protocol 5 moves every bundled end together. 0.21 changed rutis_bridge::session::Error::Value to a struct variant, so the 83 constructors call Error::value; the 29 string-literal arguments drop the now-ambiguous .into(). 0.23 chunks frames over 16 MiB, so the oversized notification case now meets Dim's own too_large frame limit instead of rutis's bad-value. Fixes #1918 --- .github/workflows/ci.yml | 8 +- Cargo.lock | 22 ++-- Cargo.toml | 6 +- .../src/auxiliary_model.rs | 2 +- .../src/file_storage/face.rs | 17 ++- crates/dim-agent-capabilities/src/methods.rs | 19 ++- .../dim-agent-capabilities/src/port_faces.rs | 2 +- .../src/prompt_guide.rs | 6 +- .../src/session_files.rs | 6 +- .../src/tool_registry.rs | 17 ++- .../src/timeline_store_face.rs | 28 ++--- crates/dim-agent-scheduler/src/loops.rs | 2 +- crates/dim-agent-scheduler/src/methods.rs | 4 +- crates/dim-agent-scheduler/src/wakeups.rs | 2 +- .../examples/session_typescript_spike.rs | 2 +- .../src/collaboration/approvals.rs | 2 +- crates/dim-app-server/src/connection.rs | 7 +- crates/dim-app-server/src/hooks_settings.rs | 2 +- crates/dim-app-server/src/managed_provider.rs | 4 +- crates/dim-app-server/src/mcp/face.rs | 2 +- crates/dim-app-server/src/plugin_files.rs | 4 +- .../dim-app-server/src/settings/declared.rs | 11 +- crates/dim-app-server/src/storage/face.rs | 20 +-- crates/dim-app-server/src/storage/metadata.rs | 4 +- crates/dim-app-server/src/storage/sqlite.rs | 8 +- .../transport_flow/session_typescript.rs | 17 ++- crates/dim-event-hub/src/bridge.rs | 10 +- crates/dim-event-hub/tests/support/fixture.rs | 6 +- crates/dim-modality/src/targets.rs | 2 +- crates/dim-session-title/src/lib.rs | 2 +- .../rust-agent/generated/modules.json | 2 +- npm/branch-services.d.ts | 118 +++++++++--------- npm/package.json | 2 +- runtime/package-lock.json | 72 +++++------ runtime/package.json | 6 +- runtime/plugins/light-ocr/package-lock.json | 8 +- runtime/plugins/light-ocr/package.json | 2 +- runtime/plugins/workflow/package-lock.json | 8 +- runtime/plugins/workflow/package.json | 2 +- runtime/python-requirements.txt | 2 +- xtask/Cargo.toml | 2 +- 41 files changed, 228 insertions(+), 240 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index efc0a32534..d212902546 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -250,14 +250,12 @@ jobs: shell: bash run: | set -euo pipefail - # 0.19's TypeScript test tool runs plugins on a real rutis-host; the + # The TypeScript test tool runs plugins on a real rutis-host; the # tests run from the repository root, so name it explicitly. export RUTIS_HOST="$PWD/runtime/node_modules/.bin/rutis-host" node --test runtime/plugin-sdk.test.mjs runtime/light-ocr-*.test.mjs - # The workflow plugin tests stay off: no double of a - # test's can receive the plugin definition they register, because - # 0.19.3's test tool does not take one (rutis-0.19-upgrade M10). The - # Node-backed Rust flows below still load it for real, and `tsc` + # The workflow plugin has no plugin test that needs a definition + # double; the Node-backed Rust flows load it for real, and `tsc` # checks it. node runtime/node_modules/typescript/bin/tsc -p runtime/plugins/workflow/tsconfig.json export DIM_TEST_NODE="$(command -v node)" diff --git a/Cargo.lock b/Cargo.lock index 6048ecc9ad..bada16c3c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4179,9 +4179,9 @@ checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" [[package]] name = "rutis" -version = "0.19.3" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37143a70e4a943d50dd1e3303b7f2b856460a56a362ee62fa62712e55882961a" +checksum = "9108ed4d1074c48a674b17e44b4f02ed4a650f4f152370f588f50bee6bd655ee" dependencies = [ "erased-serde", "rutis-macros", @@ -4195,9 +4195,9 @@ dependencies = [ [[package]] name = "rutis-bridge" -version = "0.19.3" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1e15efcf6926d6c0f8c5ca78a3a7c0af80bdeac3fac95c1332086c779266959" +checksum = "bc5b5671633d5054a4b4a1ba34d1560b98fd9e2b871383db314386824c811f0d" dependencies = [ "getrandom 0.2.17", "libc", @@ -4205,6 +4205,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.9", + "shuttle", "tempfile", "thiserror 2.0.20", "tokio", @@ -4213,9 +4214,9 @@ dependencies = [ [[package]] name = "rutis-loader" -version = "0.19.3" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa6a552b9bd8f52acf066104bfc859bb4458b860db38f486ad85e99a12254d06" +checksum = "56d4db8006f9de93c7a86bf6c3346f2208dd827c64085638c0bc1e635c2bffb7" dependencies = [ "libc", "rutis", @@ -4223,15 +4224,16 @@ dependencies = [ "schemars 1.2.2", "serde", "serde_json", + "shuttle", "thiserror 2.0.20", "tokio", ] [[package]] name = "rutis-macros" -version = "0.19.3" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91dacd6ec042c7f181577318cfa73a05598b0878fb119071b971a67ff1e01db0" +checksum = "c291572eeef520ce82a5c99982618fab42053296a7e61f8edb05702473346f8e" dependencies = [ "proc-macro2", "quote", @@ -4240,9 +4242,9 @@ dependencies = [ [[package]] name = "rutis-types" -version = "0.19.3" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86c93f394dffdbc00686ffcb182141bc8b4a9e940d3e96e18f16fc39d2a3a785" +checksum = "101ff463b2d6d808df7a3f404bf8e8e1dfb9403ea841e054942543c7ab9defa4" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 0012cb3be9..2889c7a30f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,9 +14,9 @@ repository = "https://github.com/arcships/dim" allow_attributes_without_reason = "warn" [workspace.dependencies] -rutis = "0.19.3" -rutis-loader = { version = "0.19.3", features = ["node"] } -rutis-bridge = "0.19.3" +rutis = "0.23.0" +rutis-loader = { version = "0.23.0", features = ["node"] } +rutis-bridge = "0.23.0" schemars = "1" dim-agent-types = { path = "crates/dim-agent-types" } dim-agent-runtime = { path = "crates/dim-agent-runtime" } diff --git a/crates/dim-agent-capabilities/src/auxiliary_model.rs b/crates/dim-agent-capabilities/src/auxiliary_model.rs index 5d0c4da729..4d646d0e52 100644 --- a/crates/dim-agent-capabilities/src/auxiliary_model.rs +++ b/crates/dim-agent-capabilities/src/auxiliary_model.rs @@ -150,7 +150,7 @@ impl HostDispatch for AuxiliaryModel { fn invoke(&self, method: &str, args: Value) -> Reply { if method != "complete" { - return Err(Error::Value(format!( + return Err(Error::value(format!( "unknown auxiliaryModel method {method}" ))); } diff --git a/crates/dim-agent-capabilities/src/file_storage/face.rs b/crates/dim-agent-capabilities/src/file_storage/face.rs index eb0a582dee..633b747d81 100644 --- a/crates/dim-agent-capabilities/src/file_storage/face.rs +++ b/crates/dim-agent-capabilities/src/file_storage/face.rs @@ -474,13 +474,13 @@ impl HostDispatch for FsHost { fn invoke(&self, method: &str, args: Value) -> Reply { let [request]: [serde_json::Value; 1] = serde_json::from_value(args.json()?) - .map_err(|error| Error::Value(error.to_string()))?; + .map_err(|error| Error::value(error.to_string()))?; if !request.is_object() { - return Err(Error::Value("fsHost request must be an object".into())); + return Err(Error::value("fsHost request must be an object")); } let request: Request = serde_json::from_value(serde_json::json!({"method":method,"request":request})) - .map_err(|error| Error::Value(error.to_string()))?; + .map_err(|error| Error::value(error.to_string()))?; let caller = rutis_bridge::session::caller_row().map(|row| row.ctx().clone()); let owner = self.clone(); Ok(Value::cancellable_future(async move { @@ -494,8 +494,8 @@ impl HostDispatch for FsHost { .map_err(failure)? ), Request::Lock(request) => { - let caller = caller - .ok_or_else(|| Error::Value("fsHost.lock requires a calling row".into()))?; + let caller = + caller.ok_or_else(|| Error::value("fsHost.lock requires a calling row"))?; let id = owner .lock(&caller, &request.path, &cancel) .await @@ -562,14 +562,13 @@ impl HostDispatch for FsHost { serde_json::json!({}) } Request::OpenRead(request) => { - let caller = caller.ok_or_else(|| { - Error::Value("fsHost.openRead requires a calling row".into()) - })?; + let caller = caller + .ok_or_else(|| Error::value("fsHost.openRead requires a calling row"))?; let result = owner .open_read(&caller, request.path, &cancel) .await .map_err(failure)?; - serde_json::to_value(result).map_err(|error| Error::Value(error.to_string()))? + serde_json::to_value(result).map_err(|error| Error::value(error.to_string()))? } Request::ReadAt(request) => { let bytes = owner diff --git a/crates/dim-agent-capabilities/src/methods.rs b/crates/dim-agent-capabilities/src/methods.rs index 8cadabf573..a15649740a 100644 --- a/crates/dim-agent-capabilities/src/methods.rs +++ b/crates/dim-agent-capabilities/src/methods.rs @@ -882,7 +882,7 @@ pub fn foreign_handler(call: Reference) -> Handler { let [data]: [BridgeValue; 1] = args .list()? .try_into() - .map_err(|_| BridgeError::Value("progress needs one argument".into()))?; + .map_err(|_| BridgeError::value("progress needs one argument"))?; progress.send(data.json()?); Ok(BridgeValue::Undefined) }); @@ -906,7 +906,7 @@ pub fn foreign_handler(call: Reference) -> Handler { let reply = reply .and_then(|value| { serde_json::from_value::(value) - .map_err(|error| BridgeError::Value(error.to_string())) + .map_err(|error| BridgeError::value(error.to_string())) }) .map_err(|error| { rethrown(&error).unwrap_or_else(|| { @@ -1099,14 +1099,13 @@ impl HostDispatch for ForeignMethods { } fn invoke(&self, method: &str, args: BridgeValue) -> Reply { if method != "register" { - return Err(BridgeError::Value(format!("no method {method}"))); + return Err(BridgeError::value(format!("no method {method}"))); } let caller = rutis_bridge::session::caller_row() .map(|row| row.ctx().clone()) .ok_or_else(|| { - BridgeError::Value( - "register needs the calling row's context: only a row of a language runtime can call it" - .into(), + BridgeError::value( + "register needs the calling row's context: only a row of a language runtime can call it", ) })?; let mut args = match args { @@ -1114,7 +1113,7 @@ impl HostDispatch for ForeignMethods { args => args.list()?, }; if args.len() > 3 { - return Err(BridgeError::Value(format!( + return Err(BridgeError::value(format!( "expected at most 3 arguments, received {}", args.len() ))); @@ -1126,15 +1125,15 @@ impl HostDispatch for ForeignMethods { let Some(BridgeValue::Reference(call)) = args.next().filter( |call| matches!(call, BridgeValue::Reference(reference) if reference.is_function()), ) else { - return Err(BridgeError::Value( - "register needs a namespace, its declarations and its call function".into(), + return Err(BridgeError::value( + "register needs a namespace, its declarations and its call function", )); }; let registered = self .0 .register_foreign(&caller, &namespace, declarations, call) .map(|()| BridgeValue::Undefined) - .map_err(|error| BridgeError::Value(error.to_string())); + .map_err(|error| BridgeError::value(error.to_string())); Ok(BridgeValue::future(async move { registered })) } } diff --git a/crates/dim-agent-capabilities/src/port_faces.rs b/crates/dim-agent-capabilities/src/port_faces.rs index 37e8dc5cc2..9af22e7ee0 100644 --- a/crates/dim-agent-capabilities/src/port_faces.rs +++ b/crates/dim-agent-capabilities/src/port_faces.rs @@ -81,7 +81,7 @@ pub(crate) fn invalid(port: &str, message: impl std::fmt::Display) -> BridgeErro /// A method the port does not serve. pub(crate) fn unknown_method(port: &str, method: &str) -> BridgeError { - BridgeError::Value(format!("{port} has no method {method}")) + BridgeError::value(format!("{port} has no method {method}")) } /// Runs an owner read in the caller's task. Cancelling or dropping the call diff --git a/crates/dim-agent-capabilities/src/prompt_guide.rs b/crates/dim-agent-capabilities/src/prompt_guide.rs index f0417a8ce5..14f701936d 100644 --- a/crates/dim-agent-capabilities/src/prompt_guide.rs +++ b/crates/dim-agent-capabilities/src/prompt_guide.rs @@ -271,7 +271,7 @@ impl HostDispatch for ForeignGuideEntries { } fn invoke(&self, method: &str, args: Value) -> Reply { if method != "register" { - return Err(BridgeError::Value(format!( + return Err(BridgeError::value(format!( "guideEntries has no method {method}" ))); } @@ -305,7 +305,7 @@ fn request(args: Value) -> Result<(GuideScope, GuideEntry), BridgeError> { args => args.list()?, }; if args.len() > 2 { - return Err(BridgeError::Value(format!( + return Err(BridgeError::value(format!( "expected at most 2 arguments, received {}", args.len() ))); @@ -315,7 +315,7 @@ fn request(args: Value) -> Result<(GuideScope, GuideEntry), BridgeError> { let scope = args.next().expect("two arguments").json()?; let entry = args.next().expect("two arguments").json()?; let invalid = - |error| BridgeError::Value(format!("register takes a scope and an entry: {error}")); + |error| BridgeError::value(format!("register takes a scope and an entry: {error}")); Ok(( serde_json::from_value(scope).map_err(invalid)?, serde_json::from_value(entry).map_err(invalid)?, diff --git a/crates/dim-agent-capabilities/src/session_files.rs b/crates/dim-agent-capabilities/src/session_files.rs index 5d6260020e..545f8b1813 100644 --- a/crates/dim-agent-capabilities/src/session_files.rs +++ b/crates/dim-agent-capabilities/src/session_files.rs @@ -284,13 +284,13 @@ impl rutis_bridge::session::HostDispatch for SessionFiles { } let parameters = args.json()?; let [mut object] = serde_json::from_value::<[serde_json::Value; 1]>(parameters) - .map_err(|e| Error::Value(e.to_string()))?; + .map_err(|e| Error::value(e.to_string()))?; object .as_object_mut() - .ok_or_else(|| Error::Value("Expected one request object".into()))? + .ok_or_else(|| Error::value("Expected one request object"))? .insert("method".into(), method.into()); let operation: Operation = - serde_json::from_value(object).map_err(|e| Error::Value(e.to_string()))?; + serde_json::from_value(object).map_err(|e| Error::value(e.to_string()))?; let files = self.0.clone(); Ok(Value::cancellable_future(async move { let cancel = CancellationToken::new(); diff --git a/crates/dim-agent-capabilities/src/tool_registry.rs b/crates/dim-agent-capabilities/src/tool_registry.rs index 9945ae78c6..268ea6e4a2 100644 --- a/crates/dim-agent-capabilities/src/tool_registry.rs +++ b/crates/dim-agent-capabilities/src/tool_registry.rs @@ -807,16 +807,15 @@ impl HostDispatch for ForeignRegistry { } fn invoke(&self, method: &str, args: Value) -> Reply { if method != "register" { - return Err(BridgeError::Value(format!( + return Err(BridgeError::value(format!( "toolRegistry has no method {method}" ))); } let caller = rutis_bridge::session::caller_row() .map(|row| row.ctx().clone()) .ok_or_else(|| { - BridgeError::Value( - "register needs the calling row's context: only a row of a language runtime can call it" - .into(), + BridgeError::value( + "register needs the calling row's context: only a row of a language runtime can call it", ) })?; let mut args = match args { @@ -824,7 +823,7 @@ impl HostDispatch for ForeignRegistry { args => args.list()?, }; if args.len() > 3 { - return Err(BridgeError::Value(format!( + return Err(BridgeError::value(format!( "expected at most 3 arguments, received {}", args.len() ))); @@ -835,8 +834,8 @@ impl HostDispatch for ForeignRegistry { let Some(Value::Reference(execute)) = args.next().filter( |execute| matches!(execute, Value::Reference(reference) if reference.is_function()), ) else { - return Err(BridgeError::Value( - "register needs the tool's declaration and its execute function".into(), + return Err(BridgeError::value( + "register needs the tool's declaration and its execute function", )); }; let options = match args.next().expect("three arguments") { @@ -844,11 +843,11 @@ impl HostDispatch for ForeignRegistry { options => Some(options.json()?), }; let registered = foreign_concurrency(options) - .map_err(|error| BridgeError::Value(error.to_string())) + .map_err(|error| BridgeError::value(error.to_string())) .and_then(|concurrency| { self.0 .register_foreign(&caller, declaration, execute, concurrency) - .map_err(|error| BridgeError::Value(error.to_string())) + .map_err(|error| BridgeError::value(error.to_string())) }) .map(|()| Value::Undefined); Ok(Value::future(async move { registered })) diff --git a/crates/dim-agent-runtime/src/timeline_store_face.rs b/crates/dim-agent-runtime/src/timeline_store_face.rs index 0dd237d52a..bd40341968 100644 --- a/crates/dim-agent-runtime/src/timeline_store_face.rs +++ b/crates/dim-agent-runtime/src/timeline_store_face.rs @@ -334,19 +334,17 @@ impl HostDispatch for TimelineStoreBinding { if method == "commits" { let caller = rutis_bridge::session::caller_row() .map(|row| row.ctx().clone()) - .ok_or_else(|| Error::Value("commits needs the calling row's context".into()))?; + .ok_or_else(|| Error::value("commits needs the calling row's context"))?; let [request, listener]: [Value; 2] = args .list()? .try_into() - .map_err(|_| Error::Value("commits expects a request and listener".into()))?; + .map_err(|_| Error::value("commits expects a request and listener"))?; let request = request.json()?; if !request.is_object() { - return Err(Error::Value( - "timelineStore request must be an object".into(), - )); + return Err(Error::value("timelineStore request must be an object")); } let request: TimelineSessionRequest = - serde_json::from_value(request).map_err(|error| Error::Value(error.to_string()))?; + serde_json::from_value(request).map_err(|error| Error::value(error.to_string()))?; let listener = listener.reference()?; let owner = self.clone(); return Ok(Value::future(async move { @@ -381,7 +379,7 @@ impl HostDispatch for TimelineStoreBinding { Ok(None) } }) - .map_err(|error| Error::Value(error.to_string()))?; + .map_err(|error| Error::value(error.to_string()))?; owner .0 .subscriptions @@ -400,17 +398,15 @@ impl HostDispatch for TimelineStoreBinding { if let Some(disposer) = disposer { let _ = disposer.dispose().await; } - return Err(Error::Value(error.to_string())); + return Err(Error::value(error.to_string())); } Ok(json!({"subscriptionId":id}).into()) })); } let [request]: [serde_json::Value; 1] = serde_json::from_value(args.json()?) - .map_err(|error| Error::Value(error.to_string()))?; + .map_err(|error| Error::value(error.to_string()))?; if !request.is_object() { - return Err(Error::Value( - "timelineStore request must be an object".into(), - )); + return Err(Error::value("timelineStore request must be an object")); } if method == "append" { if rutis_bridge::session::caller().is_some() { @@ -419,7 +415,7 @@ impl HostDispatch for TimelineStoreBinding { ))); } let p: TimelineAppend = - serde_json::from_value(request).map_err(|error| Error::Value(error.to_string()))?; + serde_json::from_value(request).map_err(|error| Error::value(error.to_string()))?; if p.events.is_empty() { return Err(failure(AgentError::InvalidInput( "timeline batch must not be empty".into(), @@ -439,7 +435,7 @@ impl HostDispatch for TimelineStoreBinding { } if method == "closeCommits" { let p: Close = - serde_json::from_value(request).map_err(|error| Error::Value(error.to_string()))?; + serde_json::from_value(request).map_err(|error| Error::value(error.to_string()))?; let disposer = self .0 .subscriptions @@ -451,13 +447,13 @@ impl HostDispatch for TimelineStoreBinding { disposer .dispose() .await - .map_err(|error| Error::Value(error.to_string()))?; + .map_err(|error| Error::value(error.to_string()))?; } Ok(json!({}).into()) })); } let request: Request = serde_json::from_value(json!({"method":method,"request":request})) - .map_err(|error| Error::Value(error.to_string()))?; + .map_err(|error| Error::value(error.to_string()))?; let store = self.clone(); Ok(Value::future(async move { let result: crate::Result = async { diff --git a/crates/dim-agent-scheduler/src/loops.rs b/crates/dim-agent-scheduler/src/loops.rs index 0d930de643..8d64b2f8ee 100644 --- a/crates/dim-agent-scheduler/src/loops.rs +++ b/crates/dim-agent-scheduler/src/loops.rs @@ -1187,7 +1187,7 @@ impl HostDispatch for LoopsFace { }) } _ => { - return Err(BridgeError::Value(format!("unknown loops method {method}"))); + return Err(BridgeError::value(format!("unknown loops method {method}"))); } }; Ok(operation) diff --git a/crates/dim-agent-scheduler/src/methods.rs b/crates/dim-agent-scheduler/src/methods.rs index b02203195b..921dae1e2d 100644 --- a/crates/dim-agent-scheduler/src/methods.rs +++ b/crates/dim-agent-scheduler/src/methods.rs @@ -1349,7 +1349,7 @@ impl HostDispatch for ScheduleJobsFace { fn invoke(&self, method: &str, args: BridgeValue) -> Reply { if method != "call" { - return Err(BridgeError::Value(format!( + return Err(BridgeError::value(format!( "unknown scheduleJobs method {method}" ))); } @@ -1466,7 +1466,7 @@ pub(crate) fn face_call( match result { Ok(Ok(reply)) => Ok(reply.into()), Ok(Err(error)) => face_failure(error), - Err(error) => Err(BridgeError::Value(error.to_string())), + Err(error) => Err(BridgeError::value(error.to_string())), } }) } diff --git a/crates/dim-agent-scheduler/src/wakeups.rs b/crates/dim-agent-scheduler/src/wakeups.rs index 1e272fc0d2..df07ee07c1 100644 --- a/crates/dim-agent-scheduler/src/wakeups.rs +++ b/crates/dim-agent-scheduler/src/wakeups.rs @@ -595,7 +595,7 @@ impl HostDispatch for WakeupsFace { }) } _ => { - return Err(BridgeError::Value(format!( + return Err(BridgeError::value(format!( "unknown wakeups method {method}" ))); } diff --git a/crates/dim-app-server/examples/session_typescript_spike.rs b/crates/dim-app-server/examples/session_typescript_spike.rs index 59fdbbe0c4..bf1b9f7b69 100644 --- a/crates/dim-app-server/examples/session_typescript_spike.rs +++ b/crates/dim-app-server/examples/session_typescript_spike.rs @@ -114,7 +114,7 @@ impl HostDispatch for SessionHost { self.1.fetch_add(1, Ordering::SeqCst); Ok(Value::Undefined) } - _ => Err(rutis_bridge::session::Error::Value(format!( + _ => Err(rutis_bridge::session::Error::value(format!( "unknown method {method}" ))), } diff --git a/crates/dim-app-server/src/collaboration/approvals.rs b/crates/dim-app-server/src/collaboration/approvals.rs index 0b2781efbb..2bf2ba43ce 100644 --- a/crates/dim-app-server/src/collaboration/approvals.rs +++ b/crates/dim-app-server/src/collaboration/approvals.rs @@ -113,7 +113,7 @@ impl rutis_bridge::session::HostDispatch for CollaborationSession { args: rutis_bridge::session::Value, ) -> rutis_bridge::session::Reply { if method != "approvalDestination" { - return Err(rutis_bridge::session::Error::Value(format!( + return Err(rutis_bridge::session::Error::value(format!( "collaborationSession has no method {method}" ))); } diff --git a/crates/dim-app-server/src/connection.rs b/crates/dim-app-server/src/connection.rs index 2c3bbc5f76..8d379ec7a5 100644 --- a/crates/dim-app-server/src/connection.rs +++ b/crates/dim-app-server/src/connection.rs @@ -2590,9 +2590,8 @@ impl HostDispatch for ForeignCallChannel { // Read the caller inside `invoke`: a future returned here runs later // and no longer sees it. let row = caller_row().ok_or_else(|| { - BridgeError::Value( - "callChannel needs the calling row's context: only a row of a language runtime can call it" - .into(), + BridgeError::value( + "callChannel needs the calling row's context: only a row of a language runtime can call it", ) })?; let instance = row.instance(); @@ -2650,7 +2649,7 @@ struct ClosedRequest { /// One request object; anything else is the caller's programming error. fn request(args: BridgeValue) -> Result { let invalid = |detail: String| { - BridgeError::Value(format!("expected one callChannel request object: {detail}")) + BridgeError::value(format!("expected one callChannel request object: {detail}")) }; let Value::Array(args) = args.json()? else { return Err(invalid("not an argument list".into())); diff --git a/crates/dim-app-server/src/hooks_settings.rs b/crates/dim-app-server/src/hooks_settings.rs index 20a6d680a2..06c7dc2829 100644 --- a/crates/dim-app-server/src/hooks_settings.rs +++ b/crates/dim-app-server/src/hooks_settings.rs @@ -526,7 +526,7 @@ impl rutis_bridge::session::HostDispatch for HooksService { let PluginRequest { plugin } = face_request(args)?; rutis_bridge::session::arg(&self.plugin_refusal(&plugin)) } - _ => Err(rutis_bridge::session::Error::Value(format!( + _ => Err(rutis_bridge::session::Error::value(format!( "unknown hooksService method {method}" ))), } diff --git a/crates/dim-app-server/src/managed_provider.rs b/crates/dim-app-server/src/managed_provider.rs index f408e5e8a1..79fbdb4646 100644 --- a/crates/dim-app-server/src/managed_provider.rs +++ b/crates/dim-app-server/src/managed_provider.rs @@ -739,13 +739,13 @@ impl HostDispatch for ManagedSearch { fn invoke(&self, method: &str, args: ServiceValue) -> Reply { if method != "search" { - return Err(BridgeError::Value(format!( + return Err(BridgeError::value(format!( "unknown managedSearch method {method}" ))); } let [request]: [WebSearchRequest; 1] = serde_json::from_value(args.json()?).map_err(|error| { - BridgeError::Value(format!( + BridgeError::value(format!( "expected one managedSearch request object: {error}" )) })?; diff --git a/crates/dim-app-server/src/mcp/face.rs b/crates/dim-app-server/src/mcp/face.rs index e1fdc8009c..f5b8c9c97d 100644 --- a/crates/dim-app-server/src/mcp/face.rs +++ b/crates/dim-app-server/src/mcp/face.rs @@ -145,7 +145,7 @@ impl HostDispatch for McpService { let Plugin { plugin } = request(args)?; arg(&self.plugin_refusal(&plugin)) } - _ => Err(Error::Value(format!("mcpService has no method {method}"))), + _ => Err(Error::value(format!("mcpService has no method {method}"))), } } } diff --git a/crates/dim-app-server/src/plugin_files.rs b/crates/dim-app-server/src/plugin_files.rs index 30dcf12ccc..6bd5a58e40 100644 --- a/crates/dim-app-server/src/plugin_files.rs +++ b/crates/dim-app-server/src/plugin_files.rs @@ -50,7 +50,7 @@ fn success(value: Value) -> Value { Value::Record([("ok".into(), json!(true).into()), ("value".into(), value)].into()) } fn invalid() -> Error { - Error::Value("invalid file operation".into()) + Error::value("invalid file operation") } fn private_permissions() -> Option { #[cfg(unix)] @@ -169,7 +169,7 @@ impl Scope { let caller = self .caller .clone() - .ok_or_else(|| Error::Value("openRead requires a calling row".into()))?; + .ok_or_else(|| Error::value("openRead requires a calling row"))?; self.operation(args, move |files, _, path, cancel| { Box::pin(async move { Ok( diff --git a/crates/dim-app-server/src/settings/declared.rs b/crates/dim-app-server/src/settings/declared.rs index ee06d08a07..96cdec4b7e 100644 --- a/crates/dim-app-server/src/settings/declared.rs +++ b/crates/dim-app-server/src/settings/declared.rs @@ -306,7 +306,7 @@ fn envelope(result: Result) -> RpcValue { .into() } fn request(args: RpcValue) -> std::result::Result { - let invalid = || Error::Value("expected one settings request object".into()); + let invalid = || Error::value("expected one settings request object"); let Value::Array(args) = args.json()? else { return Err(invalid()); }; @@ -389,16 +389,15 @@ impl HostDispatch for Settings { let caller = rutis_bridge::session::caller_row() .map(|row| row.ctx().clone()) .ok_or_else(|| { - Error::Value( - "register needs the calling row's context: only a row of a language runtime can call it" - .into(), + Error::value( + "register needs the calling row's context: only a row of a language runtime can call it", ) })?; let registered = request(args).and_then(|declaration| { service .register(&caller, declaration) .map(|()| RpcValue::Undefined) - .map_err(|error| Error::Value(error.to_string())) + .map_err(|error| Error::value(error.to_string())) }); Ok(RpcValue::future(async move { registered })) } @@ -435,7 +434,7 @@ impl HostDispatch for Settings { )) })) } - _ => Err(Error::Value(format!("unknown settings method {method}"))), + _ => Err(Error::value(format!("unknown settings method {method}"))), } } } diff --git a/crates/dim-app-server/src/storage/face.rs b/crates/dim-app-server/src/storage/face.rs index 5ae66b1855..9022406c20 100644 --- a/crates/dim-app-server/src/storage/face.rs +++ b/crates/dim-app-server/src/storage/face.rs @@ -297,19 +297,19 @@ impl HostDispatch for Store { let mut args = args.list()?.into_iter(); let directory = args .next() - .ok_or_else(|| Error::Value("missing directory".into()))? + .ok_or_else(|| Error::value("missing directory"))? .json()?; if !directory.is_object() { - return Err(Error::Value("store request must be an object".into())); + return Err(Error::value("store request must be an object")); } let directory: Directory = serde_json::from_value(directory) - .map_err(|error| Error::Value(error.to_string()))?; + .map_err(|error| Error::value(error.to_string()))?; let remove = args .next() - .ok_or_else(|| Error::Value("missing removal callback".into()))? + .ok_or_else(|| Error::value("missing removal callback"))? .reference()?; if args.next().is_some() { - return Err(Error::Value("unexpected removeWorktree argument".into())); + return Err(Error::value("unexpected removeWorktree argument")); } let owner = self.clone(); return Ok(Value::future(async move { @@ -353,13 +353,13 @@ impl HostDispatch for Store { })); } let [request]: [serde_json::Value; 1] = serde_json::from_value(args.json()?) - .map_err(|error| Error::Value(error.to_string()))?; + .map_err(|error| Error::value(error.to_string()))?; if !request.is_object() { - return Err(Error::Value("store request must be an object".into())); + return Err(Error::value("store request must be an object")); } if method == "catalog" { let p: Catalog = - serde_json::from_value(request).map_err(|error| Error::Value(error.to_string()))?; + serde_json::from_value(request).map_err(|error| Error::value(error.to_string()))?; let owner = self.clone(); return Ok(Value::cancellable_future(async move { let cancel = tokio_util::sync::CancellationToken::new(); @@ -369,12 +369,12 @@ impl HostDispatch for Store { .await .map_err(failure)?; Ok(serde_json::to_value(page) - .map_err(|error| Error::Value(error.to_string()))? + .map_err(|error| Error::value(error.to_string()))? .into()) })); } let request: Request = serde_json::from_value(json!({"method":method,"request":request})) - .map_err(|error| Error::Value(error.to_string()))?; + .map_err(|error| Error::value(error.to_string()))?; let owner = self.clone(); Ok(Value::future(async move { let result: dim_agent_runtime::Result = async { diff --git a/crates/dim-app-server/src/storage/metadata.rs b/crates/dim-app-server/src/storage/metadata.rs index 88251f15d1..790ff5e1e3 100644 --- a/crates/dim-app-server/src/storage/metadata.rs +++ b/crates/dim-app-server/src/storage/metadata.rs @@ -301,7 +301,7 @@ fn present<'de, D: Deserializer<'de>>(value: D) -> Result, D::Erro /// One request object; anything else is the caller's programming error. fn request(args: RpcValue) -> Result { let invalid = |detail: String| { - Error::Value(format!( + Error::value(format!( "expected one sessionMetadata request object: {detail}" )) }; @@ -376,7 +376,7 @@ mod binding { )) })) } - _ => Err(Error::Value(format!( + _ => Err(Error::value(format!( "unknown sessionMetadata method {method}" ))), } diff --git a/crates/dim-app-server/src/storage/sqlite.rs b/crates/dim-app-server/src/storage/sqlite.rs index 1f8e1e71b3..a9a8062348 100644 --- a/crates/dim-app-server/src/storage/sqlite.rs +++ b/crates/dim-app-server/src/storage/sqlite.rs @@ -2552,10 +2552,10 @@ impl HostDispatch for SqliteDispatch { fn invoke(&self, method: &str, args: BridgeValue) -> Reply { let [request]: [serde_json::Value; 1] = serde_json::from_value(args.json()?) - .map_err(|error| BridgeError::Value(error.to_string()))?; + .map_err(|error| BridgeError::value(error.to_string()))?; if !request.is_object() { - return Err(BridgeError::Value( - "sqliteStorage request must be an object".into(), + return Err(BridgeError::value( + "sqliteStorage request must be an object", )); } #[derive(Deserialize)] @@ -2660,7 +2660,7 @@ impl HostDispatch for SqliteDispatch { } let request = serde_json::from_value(serde_json::json!({"method":method,"request":request})) - .map_err(|error| BridgeError::Value(error.to_string()))?; + .map_err(|error| BridgeError::value(error.to_string()))?; let db = self.0.clone(); Ok(BridgeValue::cancellable_future(async move { let value = match request { diff --git a/crates/dim-app-server/tests/transport_flow/session_typescript.rs b/crates/dim-app-server/tests/transport_flow/session_typescript.rs index 45ecd9c3cd..a7c3a4cc32 100644 --- a/crates/dim-app-server/tests/transport_flow/session_typescript.rs +++ b/crates/dim-app-server/tests/transport_flow/session_typescript.rs @@ -1877,8 +1877,8 @@ impl rutis::host::DynPlugin for ControlledGate { struct GateValue; impl rutis_bridge::session::HostDispatch for GateValue { fn invoke(&self, _: &str, _: rutis_bridge::session::Value) -> rutis_bridge::session::Reply { - Err(rutis_bridge::session::Error::Value( - "fixture dependency is not a tool".into(), + Err(rutis_bridge::session::Error::value( + "fixture dependency is not a tool", )) } fn methods(&self) -> Option { @@ -2937,12 +2937,9 @@ async fn node_session_typescript_call_channel_checks_the_call_and_the_connection } /// A.2: an oversized notification from another language writes nothing and -/// keeps the connection open. The bridge that carries the payload already -/// refuses any message over 16 MiB, the same limit as the notification -/// frame, so the refusal a foreign provider can actually observe is the -/// bridge's (`bad-value`), not `too_large`: a request the App Server would -/// encode past its frame limit cannot reach it. `too_large` itself is -/// covered by the Rust binding's flow test. +/// keeps the connection open. rutis 0.23 chunks frames over 16 MiB, so the +/// bridge delivers the payload; the refusal a foreign provider observes is the +/// App Server's own frame limit (`too_large`). #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore = "requires DIM_TEST_NODE and DIM_TEST_JS_RUNTIME"] async fn node_session_typescript_oversized_notification_writes_nothing_and_keeps_the_connection() { @@ -2972,11 +2969,11 @@ async fn node_session_typescript_oversized_notification_writes_nothing_and_keeps json!({"sessionId": session}), ) .await; - assert_eq!(reply["result"]["code"], "bad-value", "{reply}"); + assert_eq!(reply["result"]["code"], "too_large", "{reply}"); assert!( reply["result"]["message"] .as_str() - .is_some_and(|message| message.contains("16 MiB")), + .is_some_and(|message| message.contains("exceeds the frame limit")), "{reply}" ); assert_ok(&client.rpc("daemon.ping", json!({})).await); diff --git a/crates/dim-event-hub/src/bridge.rs b/crates/dim-event-hub/src/bridge.rs index f7d86281a2..0a0c9d81fd 100644 --- a/crates/dim-event-hub/src/bridge.rs +++ b/crates/dim-event-hub/src/bridge.rs @@ -54,7 +54,7 @@ impl HostDispatch for ForeignEventHub { .map_err(bridge_error) })) } - _ => Err(BridgeError::Value(format!( + _ => Err(BridgeError::value(format!( "eventHub has no method {method}" ))), } @@ -64,12 +64,12 @@ impl HostDispatch for ForeignEventHub { /// The single request object a bridge call carries. fn request(args: Value) -> Result { let serde_json::Value::Array(args) = args.json()? else { - return Err(BridgeError::Value("expected one request object".into())); + return Err(BridgeError::value("expected one request object")); }; let Ok([request]) = <[serde_json::Value; 1]>::try_from(args) else { - return Err(BridgeError::Value("expected one request object".into())); + return Err(BridgeError::value("expected one request object")); }; - serde_json::from_value(request).map_err(|error| BridgeError::Value(error.to_string())) + serde_json::from_value(request).map_err(|error| BridgeError::value(error.to_string())) } fn bridge_error(error: EventHubError) -> BridgeError { @@ -148,7 +148,7 @@ impl HostDispatch for ForeignEventSubscriptions { let call: crate::ListCall = request(args)?; Ok(service.list(call).into()) } - _ => Err(BridgeError::Value(format!( + _ => Err(BridgeError::value(format!( "eventSubscriptions has no method {method}" ))), } diff --git a/crates/dim-event-hub/tests/support/fixture.rs b/crates/dim-event-hub/tests/support/fixture.rs index ca7e67767b..c637a3421e 100644 --- a/crates/dim-event-hub/tests/support/fixture.rs +++ b/crates/dim-event-hub/tests/support/fixture.rs @@ -175,10 +175,10 @@ impl HostDispatch for FakeSessions { } fn invoke(&self, method: &str, args: Value) -> Reply { let Json::Array(args) = args.json()? else { - return Err(BridgeError::Value("expected one request object".into())); + return Err(BridgeError::value("expected one request object")); }; let Ok([write]) = <[Json; 1]>::try_from(args) else { - return Err(BridgeError::Value("expected one request object".into())); + return Err(BridgeError::value("expected one request object")); }; match method { // The `sessions.lookup` reply (design §2.4). @@ -211,7 +211,7 @@ impl HostDispatch for FakeSessions { } "input" => {} other => { - return Err(BridgeError::Value(format!( + return Err(BridgeError::value(format!( "the fixture sessions service has no method {other}" ))); } diff --git a/crates/dim-modality/src/targets.rs b/crates/dim-modality/src/targets.rs index a396d7527e..6c2ee66647 100644 --- a/crates/dim-modality/src/targets.rs +++ b/crates/dim-modality/src/targets.rs @@ -152,7 +152,7 @@ impl HostDispatch for ModalityTargets { fn invoke(&self, method: &str, args: Value) -> Reply { if method != "resolve" { - return Err(BridgeError::Value(format!( + return Err(BridgeError::value(format!( "unknown modalityTargets method {method}" ))); } diff --git a/crates/dim-session-title/src/lib.rs b/crates/dim-session-title/src/lib.rs index 8c973353e5..dc6bb30a15 100644 --- a/crates/dim-session-title/src/lib.rs +++ b/crates/dim-session-title/src/lib.rs @@ -642,7 +642,7 @@ impl Owner { )?; let data = settle(reply).await?.json()?; serde_json::from_value::(data) - .map_err(|error| rutis_bridge::session::Error::Value(error.to_string())) + .map_err(|error| rutis_bridge::session::Error::value(error.to_string())) } .await; if cancel.is_cancelled() { diff --git a/docs/architecture/rust-agent/generated/modules.json b/docs/architecture/rust-agent/generated/modules.json index ad92551a62..d311e5fc41 100644 --- a/docs/architecture/rust-agent/generated/modules.json +++ b/docs/architecture/rust-agent/generated/modules.json @@ -56404,7 +56404,7 @@ }, { "module": "dim_agent_capabilities::session_files", - "path": "Error::Value" + "path": "Error::value" }, { "module": "dim_agent_capabilities::session_files", diff --git a/npm/branch-services.d.ts b/npm/branch-services.d.ts index b89bf93026..adadc3b24a 100644 --- a/npm/branch-services.d.ts +++ b/npm/branch-services.d.ts @@ -12,12 +12,12 @@ export type BranchSource = | /** A host operation: a client's own entry, or a plugin's id. */ { kind: "host"; operation_id: string } | /** A line a client opened through `session.branch_create`, whose opener is the user. It is a conversation line, so the core tells it from a plugin's without reading the operation's id. */ { kind: "user"; operation_id: string } -export interface ApprovalCallData { +export type ApprovalCallData = { name: string input: import('./plugin.js').BridgeJsonObject } -export interface ApprovalRequestData { +export type ApprovalRequestData = { approval_id: string source: BranchSource call: ApprovalCallData @@ -42,7 +42,7 @@ export interface Approval { } /** The connections attached to one Session now. */ -export interface SessionPresenceRequest { +export type SessionPresenceRequest = { sessionId: string } @@ -53,14 +53,14 @@ export interface SessionPresenceRequest { export type ClientChannel = "tui" | "cli" | "web" | "acp" | "remote" | "desktop" | "unknown" /** One attached connection. */ -export interface ClientPresence { +export type ClientPresence = { channel: ClientChannel /** The client's self-declared `hello.clientName`; never an identity. */ label?: string | null } /** The `presences` reply; an unknown Session is empty. */ -export interface SessionPresencesReply { +export type SessionPresencesReply = { presences: ClientPresence[] } @@ -81,7 +81,7 @@ export interface SessionClientsHost { * paths are UTF-8 strings, as every path that crosses is ([service faces * §1](../../../docs/design/service-faces.md#1-规则)). */ -export interface WorktreeAssociation { +export type WorktreeAssociation = { sessionId: string repository: string root: string @@ -106,7 +106,7 @@ export interface WorktreeAssociations { } /** The `variables` reply: the names only, never a credential value. */ -export interface CredentialVariablesReply { +export type CredentialVariablesReply = { variables: string[] } @@ -121,7 +121,7 @@ export interface CredentialVariablesHost { variables(): Promise } -export interface ToolExecutionContext { +export type ToolExecutionContext = { turnId: string requestId: string branchId: string @@ -144,7 +144,7 @@ export interface ToolHost { export type ImageSourceType = "base64" | "url" | "file" -export interface ImageSource { +export type ImageSource = { fileId?: string | null type: ImageSourceType mediaType: string @@ -154,7 +154,7 @@ export interface ImageSource { export type ContentBlock = { type: "text"; text: string } | { type: "image"; source: ImageSource } -export interface UserInput { +export type UserInput = { content: ContentBlock[] } @@ -170,12 +170,12 @@ export type InputMode = "queue" | "steer" | "append" * The handover one input is addressed to: only the continuation of that * handover consumes it, and InputQueue deletes it otherwise. */ -export interface InputHandover { +export type InputHandover = { turn_id: string request_id: string } -export interface InputMessageData { +export type InputMessageData = { submission_id?: string | null user?: UserInput | null blocks?: InputBlock[] @@ -184,7 +184,7 @@ export interface InputMessageData { } /** The identity of one committed input. */ -export interface InputRef { +export type InputRef = { inputId: string sequence: number | bigint } @@ -193,7 +193,7 @@ export interface InputRef { * A command to withdraw an input InputQueue still holds unapplied. It is * never a fact about the input by itself: only `input/deleted` is. */ -export interface InputWithdrawData { +export type InputWithdrawData = { input_id: string /** Text for clients to show with the deleted input; no decision reads it. */ reason?: string | null @@ -237,14 +237,14 @@ export interface InputQueue { * `progress` belong to an actual registration, not to the question, so they do * not cross. */ -export interface ReservedMethod { +export type ReservedMethod = { name: string mutating: boolean notifications?: string[] } /** A namespace and the declarations it would register. */ -export interface ReservedMethodsRequest { +export type ReservedMethodsRequest = { namespace: string declarations?: ReservedMethod[] } @@ -286,12 +286,12 @@ export type PromptScope = | { kind: "turn"; timeline: string; id: string } | { kind: "task"; timeline: string; id: string } -export interface PromptSourceTarget { +export type PromptSourceTarget = { source: string scope: PromptScope } -export interface ModelId { +export type ModelId = { providerId: string modelId: string } @@ -302,7 +302,7 @@ export interface ModelId { * a property of the catalog, which carries [`CatalogCapabilities`] and * converts through [`CatalogCapabilities::declared`]. */ -export interface ModelCapabilities { +export type ModelCapabilities = { modalities: string[] toolCalling: boolean streaming: boolean @@ -315,7 +315,7 @@ export interface ModelCapabilities { providerState?: import('./plugin.js').BridgeJsonObject | null } -export interface ReasoningBudget { +export type ReasoningBudget = { min?: number | null max?: number | null default?: number | null @@ -328,7 +328,7 @@ export type ReasoningOff = | { kind: "enable_thinking"; value: boolean } | { kind: "chat_template_kwargs"; keys: string[] } -export interface ModelReasoning { +export type ModelReasoning = { supported: boolean defaultEnabled?: boolean | null mode?: string | null @@ -347,13 +347,13 @@ export interface ModelReasoning { off?: ReasoningOff | null } -export interface ModelServiceTier { +export type ModelServiceTier = { supported: boolean default?: string | null options?: string[] } -export interface ModelCapabilitySnapshot { +export type ModelCapabilitySnapshot = { target: ModelId capabilities: ModelCapabilities reasoning?: ModelReasoning | null @@ -376,7 +376,7 @@ export type StartupAuth = "anonymous" | "apiKey" | "bearer" * Non-secret connection declaration. Credentials are rebound in Provider * memory; this identity remains valid across Session unload and restore. */ -export interface StartupConnectionSource { +export type StartupConnectionSource = { id: string apiFormat: ModelProtocol baseUrl: string @@ -388,7 +388,7 @@ export interface StartupConnectionSource { * Adopted startup policy, copied with the model at a branch cut and into * newly created native members and summary requests. Contains no secrets. */ -export interface ModelStartup { +export type ModelStartup = { connection?: StartupConnectionSource | null autoCompactWindow?: number | bigint | null } @@ -412,7 +412,7 @@ export type RequestMetadata = { * The model-owned part of configuration. Tool declarations and system content * are adopted by their own capabilities, not supplied by a provider. */ -export interface ModelSelection { +export type ModelSelection = { providerId: string modelId: string capabilitySnapshot?: ModelCapabilitySnapshot | null @@ -420,7 +420,7 @@ export interface ModelSelection { metadata?: RequestMetadata | null } -export interface ConfigureUpdate { +export type ConfigureUpdate = { sources: PromptSourceTarget[] model?: ModelSelection | null } @@ -447,7 +447,7 @@ export type ReplyLanguage = "en" | "zh-CN" | "zh-Hant" | "ja" | "ko" | "id" | "d * The `get` reply: the Session's reply language when the operator selected * one, `null` otherwise. */ -export interface SessionLanguageReply { +export type SessionLanguageReply = { language?: ReplyLanguage | null } @@ -468,7 +468,7 @@ export interface SessionLanguage { } /** The `get` reply: the factory instructions text, when the assembly set one. */ -export interface SkillsConfigReply { +export type SkillsConfigReply = { instructions?: string | null } @@ -484,7 +484,7 @@ export interface SkillsConfig { get(): Promise } -export interface TimelineInfo { +export type TimelineInfo = { id: string parent?: string | null branch_point?: number | bigint | null @@ -536,12 +536,12 @@ export type TimelineQueryDirection = | /** Increasing key values; position order runs from root to branch. */ "ascending" | /** Decreasing key values. */ "descending" -export interface QueryOrder { +export type QueryOrder = { key: QueryOrderKey direction: TimelineQueryDirection } -export interface QuerySpec { +export type QuerySpec = { filter?: QueryFilter | null select: QuerySelect group_by?: string[] @@ -556,18 +556,18 @@ export type QueryValue = | { kind: "elements"; values: QueryValue[] } /** Continuation data bound to the query and logical scope, without server-side state. */ -export interface QueryCursor { +export type QueryCursor = { binding: string keys: QueryValue[] } -export interface QueryPage { +export type QueryPage = { limit: number | bigint after?: QueryCursor | null } /** A property read at a fixed branch boundary (ADR 022). */ -export interface TimelineQuery { +export type TimelineQuery = { scope: TimelineQueryScope from?: { branch_id: string; sequence: number | bigint } | null through?: number | bigint | null @@ -576,12 +576,12 @@ export interface TimelineQuery { page?: QueryPage | null } -export interface QueryRow { +export type QueryRow = { group: QueryValue[] values: QueryValue[] } -export interface QueryEvent { +export type QueryEvent = { group: QueryValue[] position: { branch_id: string; sequence: number | bigint } event: import('./plugin.js').BranchEvent @@ -593,13 +593,13 @@ export type QueryOutput = | { kind: "count"; count: number | bigint } | { kind: "exists"; exists: boolean } -export interface TimelineQueryReply { +export type TimelineQueryReply = { through: number | bigint result: QueryOutput next?: QueryCursor | null } -export interface BranchOptions { +export type BranchOptions = { prompt: string source: BranchSource } @@ -720,7 +720,7 @@ export type TaskError = * One page of a task's registered output file, as * `session.exec.output.page` answers it. */ -export interface OutputPage { +export type OutputPage = { /** The page's text, sanitized like the tail preview. */ text: string /** @@ -750,7 +750,7 @@ export type OutputPageError = export type ExecStatus = "completed" | "failed" | "cancelled" -export interface ExecEndedData { +export type ExecEndedData = { task_id: string status: ExecStatus result: import('./plugin.js').ToolResult @@ -793,7 +793,7 @@ export interface BackgroundExec { stop(taskId: string): Promise } -export interface AgentConfig2 { +export type AgentConfig2 = { name: string systemPrompt: string model: ModelId @@ -978,7 +978,7 @@ export interface PartRegistry { } /** A branch of a Session. */ -export interface SessionRef { +export type SessionRef = { sessionId: string branchId: string } @@ -987,7 +987,7 @@ export interface SessionRef { * The dispatched policy; `version` is the local sequence of the last * `permission/changed` of this branch, 0 when there is none. */ -export interface PermissionState { +export type PermissionState = { version: number | bigint policy: import('./plugin.js').PermissionPolicy } @@ -1005,7 +1005,7 @@ export type SessionsError = | { code: "publication_unknown"; message: string } | { code: "failed"; message: string } -export interface Empty { +export type Empty = { } /** Read-only policy access through the stable Agents directory. */ @@ -1026,7 +1026,7 @@ export interface SessionPermissions { * The `get` reply: each description text the assembly configured, or `null` * for the built-in one. */ -export interface CollaborationConfigReply { +export type CollaborationConfigReply = { leaderDescription?: string | null memberDescription?: string | null } @@ -1041,14 +1041,14 @@ export interface CollaborationConfig { } /** One member relation as `collaborationDirectory.relations` answers it. */ -export interface CollaborationRelation { +export type CollaborationRelation = { memberSessionId: string leaderSessionId: string memberAgentId: string } /** The `relations` reply: every member relation this process holds. */ -export interface CollaborationRelationsReply { +export type CollaborationRelationsReply = { relations: CollaborationRelation[] } @@ -1089,7 +1089,7 @@ export type McpSourceState = | /** The transport is gone but the last tools stay published and callable. The reason is kept until a connection succeeds. */ { state: "disconnected"; message: string } | /** The server needs the user to sign in; clears by itself once the server's credential changes. */ { state: "authRequired"; expired: boolean } -export interface McpSessionState { +export type McpSessionState = { servers: Record catalogError?: string | null closed: boolean @@ -1121,7 +1121,7 @@ export type JsonSchema = { * The mount read's reply (MCP Apps §4.1). `text` and `blob` are exclusive; * `app` is the document's own `_meta.ui`, which the host applies. */ -export interface McpWidgetResult { +export type McpWidgetResult = { server: string name: string description?: string | null @@ -1139,7 +1139,7 @@ export type ToolContent = string | ContentBlock[] * A view's tool result (MCP Apps §4.2), `_meta` included. It is the reply to * the client that asked; the Timeline's `ToolResult` is never built from it. */ -export interface McpAppCallResult { +export type McpAppCallResult = { content: ToolContent structuredContent?: import('./plugin.js').BridgeJsonObject | null isError?: boolean | null @@ -1181,7 +1181,7 @@ export interface McpSession { export type WorkflowRoot = { project: string } | { package: string } -export interface WorkflowReadRequest { +export type WorkflowReadRequest = { root: WorkflowRoot path: string } @@ -1197,7 +1197,7 @@ export type WorkflowFilesError = | { code: "not_found"; message: string } | { code: "invalid_data"; message: string } -export interface WorkflowDirectoryRequest { +export type WorkflowDirectoryRequest = { root: WorkflowRoot } @@ -1207,12 +1207,12 @@ export type EntryKind = | "directory" | /** A symbolic link, reparse point or special file. Storage operations never follow it. */ "other" -export interface WorkflowFileEntry { +export type WorkflowFileEntry = { name: string kind: EntryKind } -export interface WorkflowReplaceRequest { +export type WorkflowReplaceRequest = { root: WorkflowRoot path: string bytes: Uint8Array @@ -1246,7 +1246,7 @@ export interface WorkflowFiles { * The `read` reply: the addresses as UTF-8 text, as every path that crosses * is ([service faces §1](../../../docs/design/service-faces.md#1-规则)). */ -export interface BoundAddresses { +export type BoundAddresses = { unixPath?: string | null pipeName?: string | null websocketAddress?: string | null @@ -1264,18 +1264,18 @@ export interface ListenAddresses { read(): Promise } -export interface PublishFile { +export type PublishFile = { /** Absolute host path inside an already authorized FileStorage root. */ path: string mediaType: string } -export interface ResourceRef { +export type ResourceRef = { sessionId: string id: string } -export interface ResourceError { +export type ResourceError = { code: string message: string } diff --git a/npm/package.json b/npm/package.json index 53359acafd..38d2bc3ebc 100644 --- a/npm/package.json +++ b/npm/package.json @@ -9,7 +9,7 @@ "files": ["bin", "README.md", "LICENSE", "NOTICE", "plugin.d.ts", "branch-services.d.ts", "ui.d.ts", "client-protocol.d.ts"], "typesVersions": { "*": { "plugin": ["plugin.d.ts"], "ui": ["ui.d.ts"] } }, "engines": { "node": "^22.19.0 || >=23.11.0" }, - "peerDependencies": { "@arcships/rutis": "~0.19.0" }, + "peerDependencies": { "@arcships/rutis": "~0.23.0" }, "peerDependenciesMeta": { "@arcships/rutis": { "optional": true } }, "optionalDependencies": { "dimcode-web": "0.1.0-alpha.26", diff --git a/runtime/package-lock.json b/runtime/package-lock.json index 288d1cace4..6e438cf2be 100644 --- a/runtime/package-lock.json +++ b/runtime/package-lock.json @@ -8,19 +8,19 @@ "name": "dimcode-plugin-runtime", "version": "0.1.0-alpha.26", "dependencies": { - "@arcships/rutis-runtime": "0.19.3" + "@arcships/rutis-runtime": "0.23.0" }, "devDependencies": { - "@arcships/rutis": "0.19.3", - "@arcships/rutis-host": "0.19.3", + "@arcships/rutis": "0.23.0", + "@arcships/rutis-host": "0.23.0", "@modelcontextprotocol/sdk": "1.31.0", "zod": "4.6.7" } }, "node_modules/@arcships/rutis": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@arcships/rutis/-/rutis-0.19.3.tgz", - "integrity": "sha512-mpeVQ2tIZFyiKibgmRtyEhFu0NW3xam/OMUWSkddXIj8a/QqyW3AiE37GKlb4ihpHtuRx1dIz9HyCYHgvnecJw==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@arcships/rutis/-/rutis-0.23.0.tgz", + "integrity": "sha512-t6UPTljbF0NqaAFb5GOtp34735ny3LPtn+csvbXoogI9TEVqg2t5Pub9/8aPm31ob+4oCaNW4GNRr6m6nFOjpg==", "dev": true, "license": "MIT", "engines": { @@ -29,13 +29,13 @@ } }, "node_modules/@arcships/rutis-host": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@arcships/rutis-host/-/rutis-host-0.19.3.tgz", - "integrity": "sha512-7kNzPkKTBMTdA4RzWSSPGHaR+LevAuADnMtFu3qrtXj5UI1GAIU2bEIqqHUiyJLNCoht/tgk6wdtmfTXRq5xtA==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@arcships/rutis-host/-/rutis-host-0.23.0.tgz", + "integrity": "sha512-3WrR3qb1X+sJkAH+JxSktc/Kxf5HjFHijb+/Tau5mup4d/p0sTSMqAXEAw97FZ0OH7n6Av0pFa3zwOzbJ8yxLQ==", "dev": true, "license": "MIT", "dependencies": { - "@arcships/rutis-runtime": "0.19.3" + "@arcships/rutis-runtime": "0.23.0" }, "bin": { "rutis-host": "bin/rutis-host.mjs" @@ -44,17 +44,17 @@ "node": ">=22" }, "optionalDependencies": { - "@arcships/rutis-host-darwin-arm64": "0.19.3", - "@arcships/rutis-host-darwin-x64": "0.19.3", - "@arcships/rutis-host-linux-arm64": "0.19.3", - "@arcships/rutis-host-linux-x64": "0.19.3", - "@arcships/rutis-host-win32-x64": "0.19.3" + "@arcships/rutis-host-darwin-arm64": "0.23.0", + "@arcships/rutis-host-darwin-x64": "0.23.0", + "@arcships/rutis-host-linux-arm64": "0.23.0", + "@arcships/rutis-host-linux-x64": "0.23.0", + "@arcships/rutis-host-win32-x64": "0.23.0" } }, "node_modules/@arcships/rutis-host-darwin-arm64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@arcships/rutis-host-darwin-arm64/-/rutis-host-darwin-arm64-0.19.3.tgz", - "integrity": "sha512-LNcFlWjExhq8upkzxzGZzTOWL6B74SxJLXhhVsmT6HpByRTs0cG/VHnUzWu0saw2zi0A0un+7I2iYjN9T5VnmA==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@arcships/rutis-host-darwin-arm64/-/rutis-host-darwin-arm64-0.23.0.tgz", + "integrity": "sha512-6XQN+RjGX3MVZdZXPE1euLd6RJ6vFM6s883a4Z60YHFWd03lscA48eBlqp9mrx93Kxu5uxCUdYJGxYjUXymJkA==", "cpu": [ "arm64" ], @@ -66,9 +66,9 @@ ] }, "node_modules/@arcships/rutis-host-darwin-x64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@arcships/rutis-host-darwin-x64/-/rutis-host-darwin-x64-0.19.3.tgz", - "integrity": "sha512-pTzfq40YxuxChnULHUeIJd4GGW/DZNLpi+X9H9CnFeMi6NiWoYoPq3eZrOCjd6QdfjQgMytlVnp1auJs106ZQg==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@arcships/rutis-host-darwin-x64/-/rutis-host-darwin-x64-0.23.0.tgz", + "integrity": "sha512-yghjIxfP6YjcSZbC+BtuCiE8UsWRujExKhA9b0v0IaVX0QGbi4u3OC5v5OPujhQVxYoLFR9jNZfys6273VVNzA==", "cpu": [ "x64" ], @@ -80,9 +80,9 @@ ] }, "node_modules/@arcships/rutis-host-linux-arm64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@arcships/rutis-host-linux-arm64/-/rutis-host-linux-arm64-0.19.3.tgz", - "integrity": "sha512-bbdwpnOdPqgrqLGdd0oGDwm/yx7DsND+4qKeApyb/CAqbFZy6nhDXYlKqeQCESB580v9g9W9YjOkphzrl/M3KQ==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@arcships/rutis-host-linux-arm64/-/rutis-host-linux-arm64-0.23.0.tgz", + "integrity": "sha512-QRODn8oKcRkR6eIttV2PLZjLJ/7fMCZw7nTFvvpklrtbUS2xiDUfv7g9zgqsvhOd2JxDSctRTl+1RXc4NWnqVA==", "cpu": [ "arm64" ], @@ -94,9 +94,9 @@ ] }, "node_modules/@arcships/rutis-host-linux-x64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@arcships/rutis-host-linux-x64/-/rutis-host-linux-x64-0.19.3.tgz", - "integrity": "sha512-LQYNy517RuCoR/4mTnzVzqF0XWJrm2e4A8tWEt7Ak1UNkFK02K1h3cuTiZQTAIV8gH/ARSyup8MtTj6Va842zg==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@arcships/rutis-host-linux-x64/-/rutis-host-linux-x64-0.23.0.tgz", + "integrity": "sha512-Kd9rq6mc2IbEiNKCW0auhJ02gufGmmL+Yi7mc/kaCXsgOnV40gsuA548rfhayinb2+4ensebw5zpqiAkx5VFdQ==", "cpu": [ "x64" ], @@ -108,9 +108,9 @@ ] }, "node_modules/@arcships/rutis-host-win32-x64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@arcships/rutis-host-win32-x64/-/rutis-host-win32-x64-0.19.3.tgz", - "integrity": "sha512-Pe0YoC4KFQ3TzwuvNI25XonwcSlFgOn4yXzgTMYqh68SCsm6gZ/2IuYrRajEOE2Bz8wZ8+GVYTmopG2v8ItpfQ==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@arcships/rutis-host-win32-x64/-/rutis-host-win32-x64-0.23.0.tgz", + "integrity": "sha512-jRDb4uyebHWGVPHX3kjPEdryoEJMdmv+YlpWk5ygLMjiP7xo4LMpkEqtWaXCBpOOf1uYZyoo98AadOBMYSbUWQ==", "cpu": [ "x64" ], @@ -122,9 +122,9 @@ ] }, "node_modules/@arcships/rutis-runtime": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@arcships/rutis-runtime/-/rutis-runtime-0.19.3.tgz", - "integrity": "sha512-x20X0+1Fhr5VdnyCNh5awhkUsbY/Jy7pAz+Z3ryF4TLu3op9ByA4LKM/G7SZtOtWDJMu4llpG6YI4cZX84AZrg==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@arcships/rutis-runtime/-/rutis-runtime-0.23.0.tgz", + "integrity": "sha512-UF5CckIjGcC9fAJwpFAHYdtGErZd4vzagZ2p46QqFDme7oRw0+P13pQgz7SkjP0CNB7O12m58a5itGsvgWJpPw==", "license": "MIT", "dependencies": { "@deepseek-ai/cordis": "4.0.4", @@ -1951,9 +1951,9 @@ "license": "ISC" }, "node_modules/ws": { - "version": "8.22.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.22.1.tgz", - "integrity": "sha512-oyL6OPYme/CmiFvNuGzeoxCJ4nOrZE2O1FwM9MWM1AsGri6nLXB2pg+lNA8aLeXMSav0J6eIVS1j6vUPzUtK9g==", + "version": "8.23.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.23.0.tgz", + "integrity": "sha512-wCkmX8QMOrKjgO8HW2WyDbTSGeqkocxgDzS9iR79rEAexty6/2qzilx3Ag8Tqf9ykop3irLKle0MtVn5qjVnoQ==", "license": "MIT", "engines": { "node": ">=10.0.0" diff --git a/runtime/package.json b/runtime/package.json index 22d2fe0698..c2592ba605 100644 --- a/runtime/package.json +++ b/runtime/package.json @@ -4,11 +4,11 @@ "version": "0.1.0-alpha.26", "type": "module", "dependencies": { - "@arcships/rutis-runtime": "0.19.3" + "@arcships/rutis-runtime": "0.23.0" }, "devDependencies": { - "@arcships/rutis": "0.19.3", - "@arcships/rutis-host": "0.19.3", + "@arcships/rutis": "0.23.0", + "@arcships/rutis-host": "0.23.0", "@modelcontextprotocol/sdk": "1.31.0", "zod": "4.6.7" } diff --git a/runtime/plugins/light-ocr/package-lock.json b/runtime/plugins/light-ocr/package-lock.json index a0bf2bcaea..f863d3f105 100644 --- a/runtime/plugins/light-ocr/package-lock.json +++ b/runtime/plugins/light-ocr/package-lock.json @@ -8,7 +8,7 @@ "dependencies": { "@arcships/light-ocr": "0.5.9", "@arcships/light-ocr-runtime": "0.1.9", - "@arcships/rutis": "0.19.3" + "@arcships/rutis": "0.23.0" } }, "node_modules/@arcships/light-ocr": { @@ -205,9 +205,9 @@ } }, "node_modules/@arcships/rutis": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@arcships/rutis/-/rutis-0.19.3.tgz", - "integrity": "sha512-mpeVQ2tIZFyiKibgmRtyEhFu0NW3xam/OMUWSkddXIj8a/QqyW3AiE37GKlb4ihpHtuRx1dIz9HyCYHgvnecJw==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@arcships/rutis/-/rutis-0.23.0.tgz", + "integrity": "sha512-t6UPTljbF0NqaAFb5GOtp34735ny3LPtn+csvbXoogI9TEVqg2t5Pub9/8aPm31ob+4oCaNW4GNRr6m6nFOjpg==", "license": "MIT", "engines": { "bun": ">=1.4", diff --git a/runtime/plugins/light-ocr/package.json b/runtime/plugins/light-ocr/package.json index 5ce69c3549..927db0805a 100644 --- a/runtime/plugins/light-ocr/package.json +++ b/runtime/plugins/light-ocr/package.json @@ -5,6 +5,6 @@ "dependencies": { "@arcships/light-ocr": "0.5.9", "@arcships/light-ocr-runtime": "0.1.9", - "@arcships/rutis": "0.19.3" + "@arcships/rutis": "0.23.0" } } diff --git a/runtime/plugins/workflow/package-lock.json b/runtime/plugins/workflow/package-lock.json index 8c92fb554c..72f8e7c843 100644 --- a/runtime/plugins/workflow/package-lock.json +++ b/runtime/plugins/workflow/package-lock.json @@ -8,7 +8,7 @@ "name": "@dimcode/workflow", "version": "0.1.0", "dependencies": { - "@arcships/rutis": "0.19.3", + "@arcships/rutis": "0.23.0", "yaml": "2.9.1", "zod": "4.6.7" }, @@ -17,9 +17,9 @@ } }, "node_modules/@arcships/rutis": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@arcships/rutis/-/rutis-0.19.3.tgz", - "integrity": "sha512-mpeVQ2tIZFyiKibgmRtyEhFu0NW3xam/OMUWSkddXIj8a/QqyW3AiE37GKlb4ihpHtuRx1dIz9HyCYHgvnecJw==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@arcships/rutis/-/rutis-0.23.0.tgz", + "integrity": "sha512-t6UPTljbF0NqaAFb5GOtp34735ny3LPtn+csvbXoogI9TEVqg2t5Pub9/8aPm31ob+4oCaNW4GNRr6m6nFOjpg==", "license": "MIT", "engines": { "bun": ">=1.4", diff --git a/runtime/plugins/workflow/package.json b/runtime/plugins/workflow/package.json index 26740754dd..24626d5b67 100644 --- a/runtime/plugins/workflow/package.json +++ b/runtime/plugins/workflow/package.json @@ -5,7 +5,7 @@ "type": "module", "exports": "./index.ts", "dependencies": { - "@arcships/rutis": "0.19.3", + "@arcships/rutis": "0.23.0", "yaml": "2.9.1", "zod": "4.6.7" }, diff --git a/runtime/python-requirements.txt b/runtime/python-requirements.txt index 22768d72ed..a7bc8d4bb3 100644 --- a/runtime/python-requirements.txt +++ b/runtime/python-requirements.txt @@ -1,3 +1,3 @@ # The rutis Python runtime and SDK for `py:` rows; the version matches the # host's rutis (Cargo.toml) and runtime/package.json. -rutis==0.19.3 --hash=sha256:f6a123e10b676b2380ac3ccc73540da502e5109230417def56fa36ea4c5d4bd6 +rutis==0.23.0 --hash=sha256:39f9af00b04a9b764d8a16078330ac53af78b0c4ebc54ee1302de5dc4b8a672d diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index b91816d1f9..564553d221 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -26,7 +26,7 @@ dim-agent-types.workspace = true dim-client.workspace = true rutis.workspace = true rutis-bridge.workspace = true -rutis-types = "0.19.3" +rutis-types = "0.23.0" rutis-loader.workspace = true tokio.workspace = true tokio-util.workspace = true From f3cb3ec319ab22835931032380c6fec5060d169b Mon Sep 17 00:00:00 2001 From: scotares Date: Fri, 20 Nov 2026 15:17:20 +0800 Subject: [PATCH 2/6] docs(rutis): record the 0.23 baseline Add ADR 025 and update the current version pins and architecture history. Keep the 0.19 upgrade, its zh mirror and the evidence documents as snapshots. --- docs/INDEX.md | 1 + docs/adr/015-scopes-are-plugins.md | 6 +- docs/adr/025-rutis-0-23.md | 96 +++++++++++++++++++++ docs/adr/README.md | 1 + docs/architecture/README.md | 2 +- docs/architecture/rust-agent/lifecycle.md | 2 +- docs/architecture/rust-agent/single-tree.md | 6 +- docs/design/plugins/PluginManager.md | 2 +- docs/design/plugins/RuntimeManager.md | 2 +- docs/design/process-typescript.md | 2 +- docs/design/rutis-usage.md | 2 +- docs/design/session-typescript.md | 2 +- docs/design/thin-instances.md | 4 + docs/typescript-plugin-authoring.md | 4 +- docs/zh/design/plugins/PluginManager.md | 2 +- docs/zh/design/plugins/RuntimeManager.md | 2 +- docs/zh/design/rutis-usage.md | 2 +- 17 files changed, 121 insertions(+), 17 deletions(-) create mode 100644 docs/adr/025-rutis-0-23.md diff --git a/docs/INDEX.md b/docs/INDEX.md index a974bf8787..4a70b07ac4 100644 --- a/docs/INDEX.md +++ b/docs/INDEX.md @@ -49,6 +49,7 @@ This index is navigation. Delivery status lives in issues, not here. - [Architecture decisions](adr/README.md) - [ADR 022 — Timeline 属性查询与正文重建](adr/022-event-property-queries.md)(中文):目标 API 与模块结构、属性查询、业务状态恢复和正文释放 - [ADR 023 — 上下文用量由独立分支部件维护](adr/023-context-usage.md)(中文):ContextUsage 的职责、增量统计、服务商校准及后续设计边界 +- [ADR 025 — The plugin runtime baseline is rutis 0.23](adr/025-rutis-0-23.md): the protocol-5 upgrade, shared version pin and chunked transport - [Resume:按业务对象设计计算与读取](design/resume-read-design.md)(中文,草案):usage、输入队列、Prompt、显示详情、SQL 执行和恢复校验的分项设计与成本验收 - [当前状态字段索引](design/appserver/timeline-state-read-indexes.md)(中文,草案):现有API缺口、完整索引键、源位置前驱和SQL扫描验收 - [状态保存与恢复读取](design/owner-state-indexed-reads.md)(中文,草案):按业务对象决定持久化;当前队列点查、Prompt有效引用、Usage数字和真实流程读写数量 diff --git a/docs/adr/015-scopes-are-plugins.md b/docs/adr/015-scopes-are-plugins.md index 053fba16b8..2bf0f142d8 100644 --- a/docs/adr/015-scopes-are-plugins.md +++ b/docs/adr/015-scopes-are-plugins.md @@ -30,7 +30,7 @@ loader's own instance table. Being a loader instance costs the rest of the assem loader creates an instance only from a row's context, so the parts create it through `SessionLoader`, from the Session scope row. -rutis 0.19.3, which the 0.19 upgrade pins, resolves a foreign copy's instances from its position in +rutis 0.23.0, which [ADR 025](025-rutis-0-23.md) pins, resolves a foreign copy's instances from its position in the plugin tree, and lets a host mark a plain plugin as the scope of a group (`mark_scope`, [rutis#948](https://github.com/arcships/rutis/issues/948)). @@ -56,8 +56,8 @@ The Agent group stays an instanced loader group: its row isolates the Agent's pr - Creation reads no loader entries, and `Loader::entries()` lists process rows and the Agent group's rows only. -- Dim builds on rutis 0.19.3, as the 0.19 upgrade pins it; nothing is asked of rutis. Foreign copies - resolve through 0.19.3's mounter. Rust copies qualify their keys with their scopes' instance ids, +- Dim builds on rutis 0.23.0, as [ADR 025](025-rutis-0-23.md) pins it; nothing is asked of rutis. Foreign copies + resolve through 0.23.0's mounter. Rust copies qualify their keys with their scopes' instance ids, as they can today. - A part's nearest row is its Agent's anchor row. - A Session is a child of its Agent's anchor, so the anchor must not reload: a reload would dispose diff --git a/docs/adr/025-rutis-0-23.md b/docs/adr/025-rutis-0-23.md new file mode 100644 index 0000000000..b94a257063 --- /dev/null +++ b/docs/adr/025-rutis-0-23.md @@ -0,0 +1,96 @@ +# 025: The plugin runtime baseline is rutis 0.23 + +Decision status: Proposed. + +## Context + +Dim embeds [rutis](https://github.com/arcships/rutis) as its plugin runtime. The host crates, the `xtask` +type generator, the bundled Node runtime, the repository's TypeScript plugins and the Python SDK all pin the +same release, currently 0.19.3. + +rutis 0.23.0 was released on 2026-11-20. Its session protocol is **5**; a protocol-4 host, runtime or SDK is +refused at the handshake, so every end of one deployment must move together. Between 0.19 and 0.23 rutis also +changed behavior Dim relies on: unload order, declared services and runtime-row `inject` gating (0.20), +`Error::Value` and error texts (0.21), synchronous filters, `provide` after unload and listener withdrawal +(0.22), and cancel acknowledgement, the `awaited` signal and chunked frames (0.23). + +Dim bundles its Node and Python runtimes, so it cannot mix rutis versions inside one installation. The 0.19.3 +pins therefore cannot stay while any bundled end moves. + +## Decision + +### D1. Pin one rutis release on every surface + +Dim pins **rutis 0.23.0** in the workspace (`rutis`, `rutis-loader`, `rutis-bridge`), in `xtask`'s +`rutis-types`, in the bundled Node runtime and its TypeScript plugins, in the npm peer dependency and in the +Python requirement. One installation upgrades all of them together. There is no dual-version mode, no +compatibility shim and no runtime fallback. + +### D2. Adopt rutis's forms directly + +Where 0.21 changed `rutis_bridge::session::Error::Value` from a tuple variant to a struct variant, Dim calls +`Error::value`. Where 0.20–0.22 tightened plugin behavior, the plugin or row is corrected at its owner; Dim +adds no wrapper that reconstructs the old behavior. + +`UndeclaredPolicy` remains at its default `Publish`. It is a service-name policy, not an authentication or +sandbox boundary, and this upgrade does not adopt it. + +### D3. Chunking is transport, not a payload target + +A 0.23 session keeps the 16 MiB transport message limit and adds the `chunk` frame: a larger frame is split +into chunks of at most 8 MiB and reassembled before dispatch. `max_transfer` is the ceiling for one frame +(256 MiB by default, `RUTIS_MAX_TRANSFER` for a deployment), not a default payload size. Dim keeps the +default ceiling and does not fragment payloads itself. A sender over its ceiling fails that call; a receiver +whose ceiling is smaller ends the session, so both ends of a deployment must agree on the limit. + +### D4. Behavior changes belong to their owner + +- A TypeScript or Python plugin declares every service it reads in `inject`, or in `optional` when it can run + without it. +- A runtime row's `inject` gates the row. A name the catalog does not share does not gate a Node row, so the + audit checks each row's names against the shared catalog rather than assuming the row started. +- Event filter predicates answer synchronously. +- A cleanup does not provide services, register another cleanup or wait for another cleanup. +- A callback handed over by another plugin or the host is awaited outside a synchronous call. +- Tests that asserted the old 16 MiB refusal now assert Dim's own `too_large` refusal after the frame has + crossed the session. + +### D5. One reviewable upgrade + +The version bumps, the mechanical `Error::value` rewrite, the runtime and plugin updates, the test changes, +the generated artifacts and this ADR land in one pull request. The migration rationale stays in the linked +rutis guides; this ADR records only the decision and its consequences. + +## Consequences + +- Session protocol 5 only. An older peer is refused with `incompatible session: the far end speaks protocol 4, + this side 5: upgrade the far end`; there is no mixed-version session. +- 83 `Error::Value` call sites in 27 files change to `Error::value`; 29 arguments contain `.into()`, and the + string-literal ones lose it because `Error::value` takes `impl Into`. +- Error texts are not a contract; codes are. Dim matches no rutis error text, and tests that assert a text are + updated only where they describe a behavior Dim owns. +- Cancelled calls are acknowledged by the callee; queued writes and close semantics change; event order around + a row ending or unloading changes. The upgrade verifies these flows rather than adding new mechanisms. +- Generated service graphs and `npm/branch-services.d.ts` change: the graph records `Error::value`, and data + objects become `type` aliases instead of `interface`s. +- `Session::new` reads `RUTIS_MAX_TRANSFER` and fails host startup on an invalid value. Dim accepts that + failure instead of adding a second validation path. +- The 0.19 upgrade document and other 0.19.3 records remain snapshots; this ADR does not rewrite them. + +## Non-goals + +- Go, Swift and Kotlin runtimes, dylib plugins, remote runtimes, `rutis-host` dial/listen rows and the Cordis + host. +- rutis 1.0 stabilization, a new plugin API or a new `rutis.json` format. +- Adopting `UndeclaredPolicy` as a security boundary or redesigning instance-level composition. + +## Supersession + +This ADR follows [ADR 015](015-scopes-are-plugins.md) for the scope model and sets the runtime version +baseline; it does not change ADR 015's decisions. No accepted ADR is modified. + +References: [issue #1918](https://github.com/arcships/dim/issues/1918), rutis +[0.20](https://github.com/arcships/rutis/blob/v0.23.0/docs/migration-0.20.en.md), +[0.21](https://github.com/arcships/rutis/blob/v0.23.0/docs/migration-0.21.en.md), +[0.22](https://github.com/arcships/rutis/blob/v0.23.0/docs/migration-0.22.en.md) and +[0.23](https://github.com/arcships/rutis/blob/v0.23.0/docs/migration-0.23.en.md) migrations. diff --git a/docs/adr/README.md b/docs/adr/README.md index f6bdba0811..63e7ad7b77 100644 --- a/docs/adr/README.md +++ b/docs/adr/README.md @@ -32,6 +32,7 @@ original text. | [022 — Timeline 属性查询与正文重建](022-event-property-queries.md) | Proposed | Supersedes 019's event-only results, skip-based paging and start-only positions, and 020's single-predicate limit; retains 021's read ownership | | [023 — 上下文用量由独立分支部件维护](023-context-usage.md) | Accepted | Follows 021 and 022; separates context usage statistics from request preparation | | [024 — Web 抓取层使用请求库,地址策略在请求之前执行](024-web-fetch-transport.md) | Proposed | Follows 006 D1; replaces the hand-written transport and narrows the address policy to a pre-request check | +| [025 — The plugin runtime baseline is rutis 0.23](025-rutis-0-23.md) | Proposed | Follows 015; sets the rutis version baseline and the protocol-5 upgrade rule | Source baseline: [initial foundation parent](https://github.com/arcships/dim/commit/aaaffa5768e031d781abb73e45b1915b05dc2aa0). This baseline includes lifecycle fixes not necessarily present on the default branch. diff --git a/docs/architecture/README.md b/docs/architecture/README.md index 50f014fcaa..27ef58053e 100644 --- a/docs/architecture/README.md +++ b/docs/architecture/README.md @@ -17,7 +17,7 @@ Terminal / npm launcher `dim-agent-types` owns serialized data. `dim-agent-runtime` owns instance construction, timeline ordering and close coordination. Capabilities own their work, cancellation and state. Model and tool adapters provide typed ports; transport and product configuration belong to the App Server. The CLI is a client, not another agent execution engine. -Parts are rutis 0.19.3 plugins; a part that depends on services by name is a `host::DynPlugin` that keeps their keys ([How Dim uses rutis, appendix A](../design/rutis-usage.md#appendix-a-rust-binding)). Dependencies are declared once; the catalog keys each name for the instances a copy runs in. A managed provider is an optional Rust process plugin that an account build's own executable installs; without it, managed-provider requests fail explicitly while API-key providers remain available. +Parts are rutis 0.23.0 plugins; a part that depends on services by name is a `host::DynPlugin` that keeps their keys ([How Dim uses rutis, appendix A](../design/rutis-usage.md#appendix-a-rust-binding)). Dependencies are declared once; the catalog keys each name for the instances a copy runs in. A managed provider is an optional Rust process plugin that an account build's own executable installs; without it, managed-provider requests fail explicitly while API-key providers remain available. Plugin and part factories are pure and preserve plugin names and dependency keys. Configuration that must survive reload belongs to the captured plugin configuration; each `apply` acquires fresh I/O resources and registers their cleanup. FileStorage clones share the append-only authorized-root identities, while directory handles, operations and leases belong to one service generation. Rebuilding from the initial root list would let a later project reuse an earlier project's index. diff --git a/docs/architecture/rust-agent/lifecycle.md b/docs/architecture/rust-agent/lifecycle.md index b2054a6062..5eaa63d4f9 100644 --- a/docs/architecture/rust-agent/lifecycle.md +++ b/docs/architecture/rust-agent/lifecycle.md @@ -36,7 +36,7 @@ flowchart TB ## 2. rutis 能力 -生命周期按 crates.io rutis 0.19.3 设计;接口见[单树装配](single-tree.md#rutis)。 +生命周期按 crates.io rutis 0.23.0 设计;接口见[单树装配](single-tree.md#rutis)。 | 项目 | 使用方式 | | --- | --- | diff --git a/docs/architecture/rust-agent/single-tree.md b/docs/architecture/rust-agent/single-tree.md index a5376618ea..ebdf1a78f0 100644 --- a/docs/architecture/rust-agent/single-tree.md +++ b/docs/architecture/rust-agent/single-tree.md @@ -17,7 +17,7 @@ Product assembly preflight remains incomplete; proposals are recorded in descriptive contracts that assembly does not check. External protocols include v1/v2/v3; see [dim-app-server](../../../crates/dim-app-server/README.md). -本文统一按 rutis 0.19.3 设计,定义服务、事件与装配合同;产品 caps、依赖环预检与跨进程授权由项目实现。本文描述当前 Rust 实现;目标插件契约(插件即一行、实例挂载为它登记的部件、按名字的服务目录)见 [ADR 006](../../adr/006-plugin-contract.md) 与[插件契约](../../design/plugin-contract.md),迁移完成前以本文为准。 +本文统一按 rutis 0.23.0 设计,定义服务、事件与装配合同;产品 caps、依赖环预检与跨进程授权由项目实现。本文描述当前 Rust 实现;目标插件契约(插件即一行、实例挂载为它登记的部件、按名字的服务目录)见 [ADR 006](../../adr/006-plugin-contract.md) 与[插件契约](../../design/plugin-contract.md),迁移完成前以本文为准。 ## 结构 @@ -320,7 +320,7 @@ Dispatcher 与 before 的精确名称、`*`、`领域/*` 只过滤同一分支 ## rutis -设计基准为 crates.io [rutis 0.19.3](https://github.com/arcships/rutis/releases/tag/v0.19.3)。核心服务与生命周期接口沿用 0.10.0 的合同,事件接口为 0.13 起的统一事件;接口依据见 [0.19.3 源码](https://github.com/arcships/rutis/tree/v0.19.3/crates/rutis/src)。 +设计基准为 crates.io [rutis 0.23.0](https://github.com/arcships/rutis/releases/tag/v0.23.0)。核心服务与生命周期接口沿用 0.10.0 的合同,事件接口为 0.13 起的统一事件;接口依据见 [0.23.0 源码](https://github.com/arcships/rutis/tree/v0.23.0/crates/rutis/src)。 0.5.0 → 0.9.1 的内核变化不改变本文合同:错误、诊断记录与 `EventOptions` 标为 `#[non_exhaustive]`;`RuntimeDiagnostics::event_backlogs` 报告同键 `emit` 积压;根关闭先取消子树再排空实例事件,根 `dispose()` 与 `shutdown()` 并发时共享关闭结果;新增 `TypedPlugin`、`Ctx::dispose_self`、`Ctx::view`、`ServiceChanged`。`apply` 显式返回 `InjectUnsatisfied` 且本代有失败的严格读取时回到 Pending;项目代码不返回该错误,`require` 失败仍是 `ServiceRead`。 @@ -331,6 +331,8 @@ Dispatcher 与 before 的精确名称、`*`、`领域/*` 只过滤同一分支 0.12.1 → 0.16.0:插件 trait、effect、实例服务键、loader 分组与 `Exports` 的合同不变。事件按名字找监听方,载荷为 serde,每个 root 只有一条平总线;带实例的事件键、`SyncEvent`、`Process::emit` 与 `emits` 声明被移除。Dim 的对应改动见 [rutis 0.16 升级](../../design/rutis-0.16-upgrade.md)。 0.16.0 → 0.19.3:插件 trait、effect、实例服务键与 loader 分组的合同不变。0.17 加入插件定义(`Definition`),去掉构建脚本的服务清单(`Exports::service_in`)。0.19 去掉 `waterfall_sync`(0.19.1 以 `waterfall(..).sync(..)` 补回),服务目录按名共享每个未另行注册的名字;本地运行时成为 rutis session 的远端,节点链接、对端、传输与身份层被去掉,App Server 以连接行 `session-node`、`py` 启动运行时,根提供 `LocalId("dim-daemon")`。0.19.3 把 rutis 自己的两个服务改名为 `rutis/loader`、`rutis/sessions`,并把被 dispose 或子树 shutdown 取消的构造的清理错误放回结果。Dim 的对应改动见 [rutis 0.19 升级](../../design/rutis-0.19-upgrade.md)。 +0.19.3 → 0.23.0:插件 trait、effect、实例服务键与 loader 分组的合同不变。0.20 把 cleanups 与服务撤回放到一个逆序栈,`inject` 成为 row 的声明,增加 `optional` 服务并对 runtime row 的 `inject` 做 gating;0.21 把 `Error::Value` 改为结构体变体并重写错误文本(code 不变);0.22 要求 filter 同步、禁止 unload 后 `provide`、自撤 listener 返回空结果;0.23 把 session protocol 升到 5(`ack`、`awaited`、`chunk`/`chunked`),并调整 row 结束或卸载的事件顺序。Dim 的对应改动见 [ADR 025](../../adr/025-rutis-0-23.md)。 + | 能力 | 接口 | | --- | --- | | 实例键 | `Ctx::instance()`、`TypeKey::instance`/`with_instance`;provide、读取、门控与诊断按作用域子树校验,越界返回 `InstanceOutOfScope` | diff --git a/docs/design/plugins/PluginManager.md b/docs/design/plugins/PluginManager.md index a9ede0e039..ce2a57ab21 100644 --- a/docs/design/plugins/PluginManager.md +++ b/docs/design/plugins/PluginManager.md @@ -359,7 +359,7 @@ PluginManager is not a Capability: it has no Timeline state, writes no Timeline ## 9. Requirements raised to mechanism owners -None to rutis: every loader operation used exists in rutis-loader 0.19.3. +None to rutis: every loader operation used exists in rutis-loader 0.23.0. **R1. Settings: sources registered at run time (M1).** diff --git a/docs/design/plugins/RuntimeManager.md b/docs/design/plugins/RuntimeManager.md index dbf3629f5d..d53e395269 100644 --- a/docs/design/plugins/RuntimeManager.md +++ b/docs/design/plugins/RuntimeManager.md @@ -229,7 +229,7 @@ RuntimeManager is not a Capability: it has no Timeline state, writes no Timeline ## 9. Requirements raised to mechanism owners -None to rutis: a connection row starts its process only once its launch command is provided, and rows wait for its session under rutis-loader 0.19.3's existing gating. +None to rutis: a connection row starts its process only once its launch command is provided, and rows wait for its session under rutis-loader 0.23.0's existing gating. **R1. PluginManager: Python links, the runtime request, and a plugin's npm packages (M1).** diff --git a/docs/design/process-typescript.md b/docs/design/process-typescript.md index 382d8a73d0..84eab652d0 100644 --- a/docs/design/process-typescript.md +++ b/docs/design/process-typescript.md @@ -339,7 +339,7 @@ Status: the feature binding is accepted by the maintainer in with the dependency and recovery constraints below. This replaces #35's per-call owner replacement requirement. Full Scheduler/Workflow Ready remains separate. -Use the current rutis 0.19.3 row dependencies. The Scheduler Session tool row +Use the current rutis 0.23.0 row dependencies. The Scheduler Session tool row module declares `scheduleJobs` in `definePlugin.inject`; the Workflow Session tool module declares `workflowRuns`. This is the dependency description the runtime resolver uses to gate the row; a loader option alone is not a replacement diff --git a/docs/design/rutis-usage.md b/docs/design/rutis-usage.md index d4d726a862..143ade3c18 100644 --- a/docs/design/rutis-usage.md +++ b/docs/design/rutis-usage.md @@ -262,7 +262,7 @@ Since rutis 0.15.1 there is one flat bus per root. How Dim's parts consume bus events and which public bus events Dim defines are in the [plugin contract §5.3](plugin-contract.md#53-bus-events). -*Today:* Dim is on rutis 0.19.3, and this section holds. The bus spans every rutis session: each end +*Today:* Dim is on rutis 0.23.0, and this section holds. The bus spans every rutis session: each end announces its listener names, an event reaches the listeners of its name at either end, and every emit of a language runtime goes through the host. diff --git a/docs/design/session-typescript.md b/docs/design/session-typescript.md index f1aa7638a7..5636366391 100644 --- a/docs/design/session-typescript.md +++ b/docs/design/session-typescript.md @@ -2,7 +2,7 @@ Status: tool/method and leaf broadcast bindings implemented for [C4 #63](https://github.com/arcships/dim/issues/63) and [#168](https://github.com/arcships/dim/issues/168), following the approved [#174 contract](https://github.com/arcships/dim/pull/174). -The runtime uses rutis 0.19.3. +The runtime uses rutis 0.23.0. The verification section distinguishes executable acceptance from platform limits. The [spike](session-typescript-spike.md) establishes transport feasibility; its private service names and combined fixture are not this API. diff --git a/docs/design/thin-instances.md b/docs/design/thin-instances.md index b8fde6ac87..d0de566997 100644 --- a/docs/design/thin-instances.md +++ b/docs/design/thin-instances.md @@ -13,6 +13,10 @@ and has landed. It replaces the "one row per instance" draft of this design, and read [#645](https://github.com/arcships/dim/pull/645) added goes with it. Decision: [ADR 015](../adr/015-scopes-are-plugins.md) (Proposed). +The design landed on 0.19.3; the current runtime baseline is 0.23.0 +([ADR 025](../adr/025-rutis-0-23.md)). The source line numbers below are the 0.19.3 ones and stay as the +design's record. + ## 1. Scope and non-goals A Session or branch is a loader instance today for one reason. When a part of another language is diff --git a/docs/typescript-plugin-authoring.md b/docs/typescript-plugin-authoring.md index 67eafc82a9..bf79c697d8 100644 --- a/docs/typescript-plugin-authoring.md +++ b/docs/typescript-plugin-authoring.md @@ -6,14 +6,14 @@ state the rules in any language; this guide shows how to write them today. Dim i shapes change with the phase that needs them, together with this guide. Dim loads trusted JavaScript/TypeScript plugins through rutis. Match `@arcships/rutis` -to the host's pinned runtime: main uses 0.19.3. +to the host's pinned runtime: main uses 0.23.0. Use type-only imports from `dimcode/plugin` for Dim's implemented named services. These declarations add no runtime wrapper or service. The source declaration is [npm/plugin.d.ts](../npm/plugin.d.ts). The types of the services Dim's Rust types serve to other languages are generated into [npm/branch-services.d.ts](../npm/branch-services.d.ts) and re-exported through the same entry point as `Services`. -The pinned rutis 0.19.3 declarations pass `tsc --strict` without `skipLibCheck`. +The pinned rutis 0.23.0 declarations pass `tsc --strict` without `skipLibCheck`. This does not disable checking a plugin's calls against the service interfaces. `BridgeJsonValue` and `BridgeJsonObject` describe JSON-compatible data carried by the diff --git a/docs/zh/design/plugins/PluginManager.md b/docs/zh/design/plugins/PluginManager.md index 6759f97824..2970935d7c 100644 --- a/docs/zh/design/plugins/PluginManager.md +++ b/docs/zh/design/plugins/PluginManager.md @@ -320,7 +320,7 @@ PluginManager 不是 Capability:它没有 Timeline 状态,不写 Timeline ## 9. 向机制所有者提出的需求 -没有向 rutis 提出的需求:用到的每个 loader 操作在 rutis-loader 0.19.3 中都已存在。 +没有向 rutis 提出的需求:用到的每个 loader 操作在 rutis-loader 0.23.0 中都已存在。 **R1. Settings:在运行时登记来源(M1)。** diff --git a/docs/zh/design/plugins/RuntimeManager.md b/docs/zh/design/plugins/RuntimeManager.md index c8540f3550..d105722043 100644 --- a/docs/zh/design/plugins/RuntimeManager.md +++ b/docs/zh/design/plugins/RuntimeManager.md @@ -229,7 +229,7 @@ RuntimeManager 不是 Capability:它没有 Timeline 状态,不写 Timeline ## 9. 向机制所有者提出的需求 -对 rutis 没有:连接行要等启动命令提供后才启动进程,行按 rutis-loader 0.19.3 已有的依赖等待来等它的会话。 +对 rutis 没有:连接行要等启动命令提供后才启动进程,行按 rutis-loader 0.23.0 已有的依赖等待来等它的会话。 **R1. PluginManager:Python 链接、运行时请求与插件的 npm 包(M1)。** diff --git a/docs/zh/design/rutis-usage.md b/docs/zh/design/rutis-usage.md index 75cbbc95aa..5a8dee4014 100644 --- a/docs/zh/design/rutis-usage.md +++ b/docs/zh/design/rutis-usage.md @@ -198,7 +198,7 @@ Dim 在此之上增加发布与关闭两个阶段([插件契约 §7](plugin-co Dim 的部件如何消费总线事件,以及 Dim 定义了哪些公开总线事件,见[插件契约 §5.3](plugin-contract.md#53-总线事件)。 -*现状:*Dim 已在 rutis 0.19.3 上,本节成立。总线跨越每个 rutis session:两端各自宣告自己的监听名,事件到达任一端 +*现状:*Dim 已在 rutis 0.23.0 上,本节成立。总线跨越每个 rutis session:两端各自宣告自己的监听名,事件到达任一端 该名称的监听器,语言运行时的每次 emit 都经过宿主。 ## 6. 向机制所有者提出的需求 From 3c19363ed613b69dc4a904c6fa9024e930130a77 Mon Sep 17 00:00:00 2001 From: scotares Date: Fri, 20 Nov 2026 16:59:08 +0800 Subject: [PATCH 3/6] fix(plugin-files): keep the oversized text replace refusal rutis 0.23 chunks a frame over the 16 MiB transport limit, so the runtime no longer refuses an oversized call before it arrives. Enforce the published admission limit at the pluginFiles boundary: a text record over the frame fails with bad-value and leaves the file unchanged. --- crates/dim-app-server/src/plugin_files.rs | 35 ++++++++----- .../dim-app-server/tests/plugin_files_flow.rs | 50 +++++++++++++++++++ docs/design/process-typescript.md | 8 +-- 3 files changed, 77 insertions(+), 16 deletions(-) diff --git a/crates/dim-app-server/src/plugin_files.rs b/crates/dim-app-server/src/plugin_files.rs index 6bd5a58e40..8c182b6b86 100644 --- a/crates/dim-app-server/src/plugin_files.rs +++ b/crates/dim-app-server/src/plugin_files.rs @@ -25,6 +25,12 @@ const FORMAT_VERSION: u32 = 1; /// room, and bounds one allocation. Streaming operations have no such limit. pub const MAX_WHOLE_FILE_BYTES: usize = 8 * 1024 * 1024; +/// The serialized text record may use this much of the runtime's 16 MiB frame; +/// the rest is the call envelope. rutis 0.23 chunks a frame over the transport +/// limit, so the plugin runtime no longer refuses this call before it arrives: +/// this boundary keeps the published refusal and leaves the file unchanged. +const TEXT_REPLACE_FRAME_BYTES: usize = crate::outbound::MAX_FRAME_BYTES - 64 * 1024; + #[derive(Deserialize, Serialize)] #[serde(deny_unknown_fields)] struct StoredFile { @@ -445,18 +451,23 @@ fn lease_value(lease: Arc>>, tasks: TaskTra Err(error) => Err(error), } } - ("replace", LeaseArgument::Text(text)) => lease - .replace( - serde_json::to_vec(&StoredFile { - version: FORMAT_VERSION, - text, - }) - .expect("text records contain only serializable fields"), - private_permissions(), - &cancel, - ) - .await - .map(|_| json!(null).into()), + ("replace", LeaseArgument::Text(text)) => { + let bytes = serde_json::to_vec(&StoredFile { + version: FORMAT_VERSION, + text, + }) + .expect("text records contain only serializable fields"); + if bytes.len() > TEXT_REPLACE_FRAME_BYTES { + return Err(Error::value(format!( + "text replace is {} bytes, over the plugin runtime's 16 MiB frame", + bytes.len() + ))); + } + lease + .replace(bytes, private_permissions(), &cancel) + .await + .map(|_| json!(null).into()) + } ("replaceBytes", LeaseArgument::Bytes(bytes)) if bytes.len() <= MAX_WHOLE_FILE_BYTES => { diff --git a/crates/dim-app-server/tests/plugin_files_flow.rs b/crates/dim-app-server/tests/plugin_files_flow.rs index 92b362c490..0480b05610 100644 --- a/crates/dim-app-server/tests/plugin_files_flow.rs +++ b/crates/dim-app-server/tests/plugin_files_flow.rs @@ -365,6 +365,56 @@ async fn versioned_records_reopen_and_preserve_rejected_files() { root.shutdown().await.unwrap(); } +#[tokio::test(flavor = "multi_thread", worker_threads = 4)] +async fn a_text_replace_over_the_frame_limit_leaves_the_file_unchanged() { + let directory = Directory::new(); + let (_root, scope, _) = mount(&directory.0).await; + let result = call( + &scope, + "withLock", + vec![ + json!("state.txt").into(), + Value::callback(|args| { + let file = args.list()?.remove(0); + Ok(Value::future(async move { + assert_eq!( + call(&file, "replace", vec![json!("original").into()]) + .await + .json() + .unwrap(), + json!({"ok":true,"value":null}) + ); + let text = "x".repeat(16 * 1024 * 1024); + let pending = member(&file, "replace") + .reference() + .unwrap() + .call_async(Value::List(vec![json!(text).into()])) + .await + .unwrap(); + let Value::Reference(reference) = pending else { + panic!("replace returns a future") + }; + let error = reference + .wait_async() + .await + .expect_err("a text replace over the frame limit is refused"); + assert_eq!(error.code(), Some("bad-value")); + assert!(error.to_string().contains("16 MiB"), "{error}"); + assert_eq!( + call(&file, "read", vec![]).await.json().unwrap(), + json!({"ok":true,"value":"original"}) + ); + Ok(json!(null).into()) + })) + }), + ], + ) + .await + .json() + .unwrap(); + assert_eq!(result, json!({"ok":true,"value":null})); +} + #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn quiesce_cancels_waiters_but_settles_issued_transactions_and_isolates_scopes() { tokio::time::timeout(Duration::from_secs(5), async { diff --git a/docs/design/process-typescript.md b/docs/design/process-typescript.md index 84eab652d0..b2150cd78d 100644 --- a/docs/design/process-typescript.md +++ b/docs/design/process-typescript.md @@ -459,10 +459,10 @@ untouched, and a binary read of a text file returns its envelope bytes. The byte operations are whole-buffer and capped at 8 MiB, below the 12 MiB raw ceiling the base64-encoded runtime frame implies. A buffer large enough that its call message would exceed the runtime's 16 MiB -frame is refused by the plugin's own runtime before it is sent, failing only -that call with a `RangeError` coded `bad-value` while the row and the file -store stay up, and the same holds for any call argument, a large text -`replace` included. +frame is refused before the file changes, failing only that call with `bad-value` +while the row and the file store stay up. Since rutis 0.23 chunks a larger frame, +the `pluginFiles` boundary now makes this refusal for a text `replace`; a rejected +write leaves the previous contents intact. `scope.directory(name)` creates missing parents and returns the node-local work path. `scope.openRead(name)` returns a pinned reader ID and size, or null for a missing file. Use `fsHost.readAt` to read. The reader remains valid across `scope.close()` until From 4d38ab574934916d7c5e85ff8948a0e81e6ae215 Mon Sep 17 00:00:00 2001 From: scotares Date: Fri, 20 Nov 2026 17:15:23 +0800 Subject: [PATCH 4/6] docs(adr): note the pluginFiles admission boundary Record that a Dim boundary which published a 16 MiB admission limit enforces it itself after 0.23 chunking; pluginFiles text replace is the first case. --- docs/adr/025-rutis-0-23.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/adr/025-rutis-0-23.md b/docs/adr/025-rutis-0-23.md index b94a257063..f6742f5b01 100644 --- a/docs/adr/025-rutis-0-23.md +++ b/docs/adr/025-rutis-0-23.md @@ -41,7 +41,9 @@ A 0.23 session keeps the 16 MiB transport message limit and adds the `chunk` fra into chunks of at most 8 MiB and reassembled before dispatch. `max_transfer` is the ceiling for one frame (256 MiB by default, `RUTIS_MAX_TRANSFER` for a deployment), not a default payload size. Dim keeps the default ceiling and does not fragment payloads itself. A sender over its ceiling fails that call; a receiver -whose ceiling is smaller ends the session, so both ends of a deployment must agree on the limit. +whose ceiling is smaller ends the session, so both ends of a deployment must agree on the limit. Where Dim +published a 16 MiB admission limit of its own, the boundary enforces it before the write; `pluginFiles` text +`replace` is the first such case. ### D4. Behavior changes belong to their owner From 08544819bf7fc66efc55ab6a5a49d06006ef8f8d Mon Sep 17 00:00:00 2001 From: scotares Date: Fri, 20 Nov 2026 18:03:57 +0800 Subject: [PATCH 5/6] fix(plugin-files): keep the text replace admission contract Admit a text record up to the full 16 MiB frame, so a near-limit write that 0.19.3 accepted still succeeds, and cover both the near-limit success and the oversized rejection. The Node fixture asserts the binding-visible BindingError and bad-value code. Update the app-server README, authoring guide and process-typescript design to the protocol-5 model, and scope ADR 025's consequences to the artifacts this upgrade changes. --- crates/dim-app-server/README.md | 2 +- crates/dim-app-server/src/plugin_files.rs | 17 ++++++++--------- .../dim-app-server/tests/plugin_files_flow.rs | 19 +++++++++++++++++++ .../transport_flow/process_typescript.rs | 14 ++++++++++++++ docs/adr/025-rutis-0-23.md | 11 ++++++----- docs/design/process-typescript.md | 14 +++++++------- docs/typescript-plugin-authoring.md | 9 +++++---- runtime/fixtures/files-session.ts | 14 +++++++++++++- 8 files changed, 73 insertions(+), 27 deletions(-) diff --git a/crates/dim-app-server/README.md b/crates/dim-app-server/README.md index 20804fb606..8c7c74a7ee 100644 --- a/crates/dim-app-server/README.md +++ b/crates/dim-app-server/README.md @@ -536,7 +536,7 @@ A scope offers `withLock(name, callback, cancelled?)`, `list(prefix)`, `remove(n `list(prefix)` returns one level of the directory `prefix`, sorted by name, each entry its name relative to the authorized root and its kind (`file`, `directory`, or `other` for a link or special file, never followed). A returned name is the stored components joined by `/`, so it can be passed straight to another operation; on Unix a backslash is part of a name, and on Windows it is a separator. It does not recurse and does not enter a directory entry, and the root itself is not listed, so a prefix names a directory. An entry whose name is not valid UTF-8 is omitted: these operations address names as strings, so it could not be read either, but removing the directory removes it. `remove(name)` removes a file, or a directory and everything beneath it. A file a lease holds, and a directory with a lease held beneath it, fail `locked`; an absent entry counts as removed, so a retry is safe. Removal is not atomic: an error can leave part of a tree removed. -Every file is either a text envelope or raw bytes. `read()` and `replace(text)` use the envelope below. `readBytes()` returns the file's bytes whole, so a text file returns its stored envelope; `replaceBytes(bytes)` writes raw bytes with no envelope. A text read of a raw file fails `invalid_data` and leaves it untouched. Both byte operations are whole-buffer and capped at [`MAX_WHOLE_FILE_BYTES`](src/plugin_files.rs) (8 MiB): the runtime channel's frame is 16 MiB and carries bytes base64-encoded, four bytes for every three, so 12 MiB is the raw ceiling before any envelope and 8 MiB leaves the envelope and both sides' copies room while bounding one allocation. A file over the cap fails `invalid_data` before it is read, and a replacement over it fails `invalid_data` without writing. A buffer large enough that its call message would exceed the runtime's 16 MiB frame never reaches the host: the plugin's own runtime refuses that call before sending it, with a `RangeError` coded `bad-value` naming the argument and the limit, and neither the plugin row nor the file store is affected — the same holds for any call argument, a large text `replace` included. For larger files use a pinned reader or a streamed replacement as described below. +Every file is either a text envelope or raw bytes. `read()` and `replace(text)` use the envelope below. `readBytes()` returns the file's bytes whole, so a text file returns its stored envelope; `replaceBytes(bytes)` writes raw bytes with no envelope. A text read of a raw file fails `invalid_data` and leaves it untouched. Both byte operations are whole-buffer and capped at [`MAX_WHOLE_FILE_BYTES`](src/plugin_files.rs) (8 MiB), which bounds one allocation; a file over the cap fails `invalid_data` before it is read, and a replacement over it fails `invalid_data` without writing. A text `replace` is admitted when its serialized record fits the runtime's 16 MiB frame; a larger one fails that call with a `BindingError` coded `bad-value` naming the limit, and leaves the file unchanged. rutis 0.23 chunks a larger call frame up to the deployment's `max_transfer`, so the runtime no longer refuses a call at the 16 MiB boundary; limits that a Dim face does not enforce are not guaranteed. For larger files use a pinned reader or a streamed replacement as described below. `PluginFiles::open(ctx)` ties a Rust scope to its row. EventHub uses `PluginFiles::scope(Some(ctx.clone()))` so admitted publishes can finish their writes across a row restart. The caller releases its last `Arc` after those operations settle. Stopping the file provider cancels and drains its active operations. The scope’s `with_lock(name, change)` runs `change` on the inner text under the file's lock. `change` receives `None` for a missing file and returns the replacement text (`None` keeps the file as it is) together with its own result. The host writes and checks the same `{version: 1, text}` envelope. An envelope that is not version 1 fails with `InvalidData` before `change` runs, and its bytes stay unchanged. diff --git a/crates/dim-app-server/src/plugin_files.rs b/crates/dim-app-server/src/plugin_files.rs index 94c87ff792..4cc0ef6de2 100644 --- a/crates/dim-app-server/src/plugin_files.rs +++ b/crates/dim-app-server/src/plugin_files.rs @@ -19,17 +19,16 @@ use tokio_util::{sync::CancellationToken, task::TaskTracker}; const FORMAT_VERSION: u32 = 1; -/// The largest file a whole-buffer operation accepts. Bytes cross the plugin -/// runtime's channel base64-encoded in a 16 MiB frame, which costs four bytes -/// for every three; 8 MiB leaves the frame envelope and both sides' copies -/// room, and bounds one allocation. Streaming operations have no such limit. +/// The largest file a whole-buffer operation accepts. 8 MiB bounds one +/// allocation and leaves room for both sides' copies; streaming operations +/// have no such limit. pub const MAX_WHOLE_FILE_BYTES: usize = 8 * 1024 * 1024; -/// The serialized text record may use this much of the runtime's 16 MiB frame; -/// the rest is the call envelope. rutis 0.23 chunks a frame over the transport -/// limit, so the plugin runtime no longer refuses this call before it arrives: -/// this boundary keeps the published refusal and leaves the file unchanged. -const TEXT_REPLACE_FRAME_BYTES: usize = crate::outbound::MAX_FRAME_BYTES - 64 * 1024; +/// The serialized text record must fit the runtime's 16 MiB frame. rutis 0.23 +/// chunks a frame over the transport limit, so the plugin runtime no longer +/// refuses this call before it arrives: this boundary keeps the admission limit +/// and leaves the file unchanged. +const TEXT_REPLACE_FRAME_BYTES: usize = crate::outbound::MAX_FRAME_BYTES; #[derive(Deserialize, Serialize)] #[serde(deny_unknown_fields)] diff --git a/crates/dim-app-server/tests/plugin_files_flow.rs b/crates/dim-app-server/tests/plugin_files_flow.rs index cf2811a6c3..e364c655a2 100644 --- a/crates/dim-app-server/tests/plugin_files_flow.rs +++ b/crates/dim-app-server/tests/plugin_files_flow.rs @@ -385,6 +385,25 @@ async fn a_text_replace_over_the_frame_limit_leaves_the_file_unchanged() { Value::callback(|args| { let file = args.list()?.remove(0); Ok(Value::future(async move { + assert_eq!( + call(&file, "replace", vec![json!("original").into()]) + .await + .json() + .unwrap(), + json!({"ok":true,"value":null}) + ); + let near = "y".repeat(16 * 1024 * 1024 - 40 * 1024); + assert_eq!( + call(&file, "replace", vec![json!(near.clone()).into()]) + .await + .json() + .unwrap(), + json!({"ok":true,"value":null}) + ); + assert_eq!( + call(&file, "read", vec![]).await.json().unwrap(), + json!({"ok":true,"value":near}) + ); assert_eq!( call(&file, "replace", vec![json!("original").into()]) .await diff --git a/crates/dim-app-server/tests/transport_flow/process_typescript.rs b/crates/dim-app-server/tests/transport_flow/process_typescript.rs index f430f8e11f..651d0ba8b4 100644 --- a/crates/dim-app-server/tests/transport_flow/process_typescript.rs +++ b/crates/dim-app-server/tests/transport_flow/process_typescript.rs @@ -277,6 +277,20 @@ async fn node_public_plugin_files_session_only_configuration() { client.rpc("session.files.write", params.clone()).await["result"], json!({"ok":true,"value":{"ok":true,"value":null}}) ); + let refused = client.rpc("session.files.too_large", params.clone()).await; + assert_eq!(refused["result"]["ok"], false, "{refused}"); + assert_eq!(refused["result"]["name"], "BindingError", "{refused}"); + assert_eq!(refused["result"]["code"], "bad-value", "{refused}"); + assert!( + refused["result"]["message"] + .as_str() + .is_some_and(|message| message.contains("16 MiB")), + "{refused}" + ); + assert_eq!( + files_available(&mut client, "session.files.read", params.clone()).await, + json!({"ok":true,"value":{"ok":true,"value":"public Session text"}}) + ); let held = client.send("session.files.hold", params.clone()).await; let (mut release, _) = tokio::time::timeout(Duration::from_secs(10), gate.accept()) .await diff --git a/docs/adr/025-rutis-0-23.md b/docs/adr/025-rutis-0-23.md index f6742f5b01..1c05a0b123 100644 --- a/docs/adr/025-rutis-0-23.md +++ b/docs/adr/025-rutis-0-23.md @@ -41,9 +41,10 @@ A 0.23 session keeps the 16 MiB transport message limit and adds the `chunk` fra into chunks of at most 8 MiB and reassembled before dispatch. `max_transfer` is the ceiling for one frame (256 MiB by default, `RUTIS_MAX_TRANSFER` for a deployment), not a default payload size. Dim keeps the default ceiling and does not fragment payloads itself. A sender over its ceiling fails that call; a receiver -whose ceiling is smaller ends the session, so both ends of a deployment must agree on the limit. Where Dim -published a 16 MiB admission limit of its own, the boundary enforces it before the write; `pluginFiles` text -`replace` is the first such case. +whose ceiling is smaller ends the session, so both ends of a deployment must agree on the limit. Where a +Dim face published an admission limit that the runtime used to enforce before chunking, the face now enforces +it before the write; `pluginFiles` text `replace` admits a serialized record up to the 16 MiB frame and is the +first case in this upgrade. ### D4. Behavior changes belong to their owner @@ -73,8 +74,8 @@ rutis guides; this ADR records only the decision and its consequences. updated only where they describe a behavior Dim owns. - Cancelled calls are acknowledged by the callee; queued writes and close semantics change; event order around a row ending or unloading changes. The upgrade verifies these flows rather than adding new mechanisms. -- Generated service graphs and `npm/branch-services.d.ts` change: the graph records `Error::value`, and data - objects become `type` aliases instead of `interface`s. +- `npm/branch-services.d.ts` changes: data objects become `type` aliases instead of `interface`s. The module + graph snapshots are not part of this change; #1946 retired them. - `Session::new` reads `RUTIS_MAX_TRANSFER` and fails host startup on an invalid value. Dim accepts that failure instead of adding a second validation path. - The 0.19 upgrade document and other 0.19.3 records remain snapshots; this ADR does not rewrite them. diff --git a/docs/design/process-typescript.md b/docs/design/process-typescript.md index b2150cd78d..bd9deaaa7b 100644 --- a/docs/design/process-typescript.md +++ b/docs/design/process-typescript.md @@ -456,13 +456,13 @@ while a lease holds it or a file beneath it. Text and binary are separate operat `read` and `replace` use the v1 text envelope, `readBytes` and `replaceBytes` carry raw bytes. A text read of a raw file fails `invalid_data` and leaves it untouched, and a binary read of a text file returns its envelope bytes. The byte -operations are whole-buffer and capped at 8 MiB, below the 12 MiB raw ceiling -the base64-encoded runtime frame implies. -A buffer large enough that its call message would exceed the runtime's 16 MiB -frame is refused before the file changes, failing only that call with `bad-value` -while the row and the file store stay up. Since rutis 0.23 chunks a larger frame, -the `pluginFiles` boundary now makes this refusal for a text `replace`; a rejected -write leaves the previous contents intact. +operations are whole-buffer and capped at 8 MiB, which bounds one allocation. +A text `replace` is admitted when its serialized record fits the runtime's 16 MiB +frame; a larger one fails that call with a `BindingError` coded `bad-value` +before the file changes, while the row and the file store stay up. Since rutis +0.23 chunks a larger frame, the `pluginFiles` boundary makes this refusal itself; +a rejected write leaves the previous contents intact. A call argument that no Dim +face limits is no longer refused by the runtime at the 16 MiB boundary. `scope.directory(name)` creates missing parents and returns the node-local work path. `scope.openRead(name)` returns a pinned reader ID and size, or null for a missing file. Use `fsHost.readAt` to read. The reader remains valid across `scope.close()` until diff --git a/docs/typescript-plugin-authoring.md b/docs/typescript-plugin-authoring.md index bf79c697d8..44695393ff 100644 --- a/docs/typescript-plugin-authoring.md +++ b/docs/typescript-plugin-authoring.md @@ -328,10 +328,11 @@ a present file returns its size and a pinned reader ID for `fsHost.readAt` and `fsHost.closeRead`. The opening row's unload closes outstanding readers. `scope.writeStream(name, next)` pulls chunks until null and preserves the old file on failure or cancellation. `scope.directory(name)` creates the work directory -and returns its node-local path. A buffer large enough that its call message would exceed the runtime's -16 MiB frame fails that call before it is sent, as a `RangeError` coded -`bad-value`; the row and the file store are unaffected, and the same holds for -any call argument, a large text `replace` included. +and returns its node-local path. A text `replace` whose serialized record would +exceed the runtime's 16 MiB frame fails that call with a `BindingError` coded +`bad-value`; the file is unchanged. rutis 0.23 chunks a larger call frame up to +the deployment's `max_transfer`, so the runtime no longer refuses a call at the +16 MiB boundary; limits that a Dim face does not enforce are not guaranteed. Native storage locking and durability do not make remote side effects atomic. After an uncertain external outcome, use that system's reconciliation contract diff --git a/runtime/fixtures/files-session.ts b/runtime/fixtures/files-session.ts index c9029791e4..b841a0ae92 100644 --- a/runtime/fixtures/files-session.ts +++ b/runtime/fixtures/files-session.ts @@ -13,7 +13,7 @@ export const part = definePlugin({ ctx.effect(() => scope.close()) await ctx.use('sessionMethods').register( 'session.files', - ['read', 'write', 'hold'].map(name => ({ + ['read', 'write', 'hold', 'too_large'].map(name => ({ name: `session.files.${name}`, mutating: name !== 'read', interruption: 'drain', progress: false, })), @@ -33,6 +33,18 @@ export const part = definePlugin({ await connected return { kind: 'value', value: null } } + if (call.method === 'session.files.too_large') { + try { + await scope.withLock('public-files/state.json', async file => + await file.replace('x'.repeat(16 * 1024 * 1024))) + return { kind: 'value', value: { ok: true } } + } catch (error) { + const failure = error as { name?: string; code?: string; message?: string } + return { kind: 'value', value: { + ok: false, name: failure.name ?? '', code: failure.code ?? '', message: String(failure.message ?? error), + } } + } + } const result = await scope.withLock('public-files/state.json', async file => call.method === 'session.files.write' ? await file.replace('public Session text') From 5dc83cfaf1843614bfe4933d81780dacfb9454a5 Mon Sep 17 00:00:00 2001 From: scotares Date: Fri, 20 Nov 2026 19:26:40 +0800 Subject: [PATCH 6/6] test(collaboration): give permission shutdown a longer deadline The 10s poll raced the Permission part shutdown under the CI load; the outer deadline was 15s. Allow 30s for the state to disappear and 45s for the test. --- .../tests/transport_flow/collaboration.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/crates/dim-app-server/tests/transport_flow/collaboration.rs b/crates/dim-app-server/tests/transport_flow/collaboration.rs index 4235da2d1f..d675844a12 100644 --- a/crates/dim-app-server/tests/transport_flow/collaboration.rs +++ b/crates/dim-app-server/tests/transport_flow/collaboration.rs @@ -1320,8 +1320,16 @@ async fn assert_no_collaboration_facts(session: &Session) { /// Polls `check` until it yields a value; fails at the 10s deadline instead /// of hanging. -async fn poll(what: &str, mut check: impl AsyncFnMut() -> Option) -> T { - tokio::time::timeout(Duration::from_secs(10), async { +async fn poll(what: &str, check: impl AsyncFnMut() -> Option) -> T { + poll_within(Duration::from_secs(10), what, check).await +} + +async fn poll_within( + limit: Duration, + what: &str, + mut check: impl AsyncFnMut() -> Option, +) -> T { + tokio::time::timeout(limit, async { loop { if let Some(value) = check().await { return value; @@ -8290,7 +8298,7 @@ async fn a_stopped_turn_keeps_a_delivered_members_later_approval_reachable() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn missing_permission_state_refuses_a_committed_member_request_without_creating_a_member() { - tokio::time::timeout(Duration::from_secs(15), async { + tokio::time::timeout(Duration::from_secs(45), async { let entered = Arc::new(tokio::sync::Notify::new()); let release = Arc::new(tokio::sync::Notify::new()); let hold: Hold = Arc::new({ @@ -8352,7 +8360,7 @@ async fn missing_permission_state_refuses_a_committed_member_request_without_cre .expect("the same branch's Permission part"); let view = ctx.view(permission.id).unwrap(); let closing = tokio::spawn(view.shutdown()); - poll("permission state is unavailable", async || { + poll_within(Duration::from_secs(30), "permission state is unavailable", async || { (!matches!(session.get::("main"), Ok(Some(_)))).then_some(()) }).await; release.notify_one();