From 5c276c8e14beeee60d100d0d431bbab7c23c4201 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Tue, 7 Apr 2026 15:52:11 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20b6-pdf-extract-v2=20=E2=80=94=20batch?= =?UTF-8?q?=206?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rust/crates/runtime/src/config.rs | 32 ++++++++++++++++++++++ rust/crates/runtime/src/config_validate.rs | 4 +++ 2 files changed, 36 insertions(+) diff --git a/rust/crates/runtime/src/config.rs b/rust/crates/runtime/src/config.rs index 9f00baf..70d69b3 100644 --- a/rust/crates/runtime/src/config.rs +++ b/rust/crates/runtime/src/config.rs @@ -69,6 +69,7 @@ pub struct RuntimePluginConfig { install_root: Option, registry_path: Option, bundled_root: Option, + max_output_tokens: Option, } /// Structured feature configuration consumed by runtime subsystems. @@ -541,6 +542,15 @@ impl RuntimePluginConfig { self.bundled_root.as_deref() } + #[must_use] + pub fn max_output_tokens(&self) -> Option { + self.max_output_tokens + } + + pub fn set_max_output_tokens(&mut self, max_output_tokens: Option) { + self.max_output_tokens = max_output_tokens; + } + pub fn set_plugin_state(&mut self, plugin_id: String, enabled: bool) { self.enabled_plugins.insert(plugin_id, enabled); } @@ -823,6 +833,7 @@ fn parse_optional_plugin_config(root: &JsonValue) -> Result, + key: &str, + context: &str, +) -> Result, ConfigError> { + match object.get(key) { + Some(value) => { + let Some(number) = value.as_i64() else { + return Err(ConfigError::Parse(format!( + "{context}: field {key} must be a non-negative integer" + ))); + }; + let number = u32::try_from(number).map_err(|_| { + ConfigError::Parse(format!("{context}: field {key} is out of range")) + })?; + Ok(Some(number)) + } + None => Ok(None), + } +} + fn optional_u64( object: &BTreeMap, key: &str, diff --git a/rust/crates/runtime/src/config_validate.rs b/rust/crates/runtime/src/config_validate.rs index dc3376a..31ccde1 100644 --- a/rust/crates/runtime/src/config_validate.rs +++ b/rust/crates/runtime/src/config_validate.rs @@ -242,6 +242,10 @@ const PLUGINS_FIELDS: &[FieldSpec] = &[ name: "bundledRoot", expected: FieldType::String, }, + FieldSpec { + name: "maxOutputTokens", + expected: FieldType::Number, + }, ]; const SANDBOX_FIELDS: &[FieldSpec] = &[