Skip to content

Commit cab9a0a

Browse files
RoyLinRoyLin
authored andcommitted
fix(ci): resolve clippy and sdk version drift
1 parent 0facf3d commit cab9a0a

7 files changed

Lines changed: 58 additions & 49 deletions

File tree

check-version.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#!/bin/bash
22
# Check version alignment across all SDK files
33

4+
set -euo pipefail
5+
6+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7+
cd "$SCRIPT_DIR"
8+
49
echo "=========================================="
510
echo "Version Alignment Check"
611
echo "=========================================="
@@ -10,20 +15,23 @@ echo ""
1015
CORE_VERSION=$(grep '^version = ' core/Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
1116
NODE_CARGO_VERSION=$(grep '^version = ' sdk/node/Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
1217
NODE_PKG_VERSION=$(grep '"version":' sdk/node/package.json | sed 's/.*"version": "\(.*\)".*/\1/')
18+
NODE_LOCK_VERSION=$(node -p "require('./sdk/node/package-lock.json').packages[''].version")
1319
PYTHON_CARGO_VERSION=$(grep '^version = ' sdk/python/Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
1420
PYTHON_PYPROJECT_VERSION=$(grep '^version = ' sdk/python/pyproject.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
1521

1622
echo "Current versions:"
1723
echo " core/Cargo.toml: ${CORE_VERSION}"
1824
echo " sdk/node/Cargo.toml: ${NODE_CARGO_VERSION}"
1925
echo " sdk/node/package.json: ${NODE_PKG_VERSION}"
26+
echo " sdk/node/package-lock: ${NODE_LOCK_VERSION}"
2027
echo " sdk/python/Cargo.toml: ${PYTHON_CARGO_VERSION}"
2128
echo " sdk/python/pyproject.toml: ${PYTHON_PYPROJECT_VERSION}"
2229
echo ""
2330

2431
# Check alignment
2532
if [ "$CORE_VERSION" = "$NODE_CARGO_VERSION" ] && \
2633
[ "$CORE_VERSION" = "$NODE_PKG_VERSION" ] && \
34+
[ "$CORE_VERSION" = "$NODE_LOCK_VERSION" ] && \
2735
[ "$CORE_VERSION" = "$PYTHON_CARGO_VERSION" ] && \
2836
[ "$CORE_VERSION" = "$PYTHON_PYPROJECT_VERSION" ]; then
2937
echo "✅ All versions aligned: ${CORE_VERSION}"
@@ -35,6 +43,7 @@ else
3543
echo "Mismatches:"
3644
[ "$CORE_VERSION" != "$NODE_CARGO_VERSION" ] && echo " - sdk/node/Cargo.toml: ${NODE_CARGO_VERSION}"
3745
[ "$CORE_VERSION" != "$NODE_PKG_VERSION" ] && echo " - sdk/node/package.json: ${NODE_PKG_VERSION}"
46+
[ "$CORE_VERSION" != "$NODE_LOCK_VERSION" ] && echo " - sdk/node/package-lock.json: ${NODE_LOCK_VERSION}"
3847
[ "$CORE_VERSION" != "$PYTHON_CARGO_VERSION" ] && echo " - sdk/python/Cargo.toml: ${PYTHON_CARGO_VERSION}"
3948
[ "$CORE_VERSION" != "$PYTHON_PYPROJECT_VERSION" ] && echo " - sdk/python/pyproject.toml: ${PYTHON_PYPROJECT_VERSION}"
4049
exit 1

core/src/default_parser.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pub trait DefaultParserOcrProvider: Send + Sync {
2323
) -> Result<Option<String>>;
2424
}
2525

26+
#[derive(Default)]
2627
pub struct DefaultParser {
2728
config: crate::config::DefaultParserConfig,
2829
ocr_provider: Option<Arc<dyn DefaultParserOcrProvider>>,
@@ -59,15 +60,6 @@ impl DefaultParser {
5960
}
6061
}
6162

62-
impl Default for DefaultParser {
63-
fn default() -> Self {
64-
Self {
65-
config: crate::config::DefaultParserConfig::default(),
66-
ocr_provider: None,
67-
}
68-
}
69-
}
70-
7163
impl crate::document_parser::DocumentParser for DefaultParser {
7264
fn name(&self) -> &str {
7365
"default-parser"

core/src/document_parser.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub enum DocumentBlockKind {
5555
Raw,
5656
}
5757

58-
#[derive(Debug, Clone, PartialEq, Eq)]
58+
#[derive(Debug, Clone, Default, PartialEq, Eq)]
5959
pub struct DocumentBlockLocation {
6060
pub source: Option<String>,
6161
pub page: Option<usize>,
@@ -106,16 +106,6 @@ impl DocumentBlock {
106106
}
107107
}
108108

109-
impl Default for DocumentBlockLocation {
110-
fn default() -> Self {
111-
Self {
112-
source: None,
113-
page: None,
114-
ordinal: None,
115-
}
116-
}
117-
}
118-
119109
#[derive(Debug, Clone, Default, PartialEq, Eq)]
120110
pub struct ParsedDocument {
121111
pub title: Option<String>,

core/src/orchestrator/agent.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,16 +175,16 @@ impl AgentOrchestrator {
175175
let task_handle = tokio::spawn(async move { wrapper.execute().await });
176176

177177
// 创建句柄
178-
let handle = SubAgentHandle::new(
179-
id.clone(),
178+
let handle = SubAgentHandle::new(crate::orchestrator::handle::SubAgentHandleParts {
179+
id: id.clone(),
180180
config,
181181
control_tx,
182182
subagent_event_tx,
183183
event_history,
184-
state.clone(),
185-
activity.clone(),
184+
state: state.clone(),
185+
activity: activity.clone(),
186186
task_handle,
187-
);
187+
});
188188

189189
// 注册到 orchestrator
190190
self.subagents

core/src/orchestrator/handle.rs

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,31 +43,33 @@ pub struct SubAgentHandle {
4343
task_handle: Arc<tokio::task::JoinHandle<Result<String>>>,
4444
}
4545

46+
pub(crate) struct SubAgentHandleParts {
47+
pub id: String,
48+
pub config: SubAgentConfig,
49+
pub control_tx: tokio::sync::mpsc::Sender<ControlSignal>,
50+
pub subagent_event_tx: tokio::sync::broadcast::Sender<OrchestratorEvent>,
51+
pub event_history: Arc<RwLock<std::collections::VecDeque<OrchestratorEvent>>>,
52+
pub state: Arc<RwLock<SubAgentState>>,
53+
pub activity: Arc<RwLock<SubAgentActivity>>,
54+
pub task_handle: tokio::task::JoinHandle<Result<String>>,
55+
}
56+
4657
impl SubAgentHandle {
4758
/// 创建新的句柄
48-
pub(crate) fn new(
49-
id: String,
50-
config: SubAgentConfig,
51-
control_tx: tokio::sync::mpsc::Sender<ControlSignal>,
52-
subagent_event_tx: tokio::sync::broadcast::Sender<OrchestratorEvent>,
53-
event_history: Arc<RwLock<std::collections::VecDeque<OrchestratorEvent>>>,
54-
state: Arc<RwLock<SubAgentState>>,
55-
activity: Arc<RwLock<SubAgentActivity>>,
56-
task_handle: tokio::task::JoinHandle<Result<String>>,
57-
) -> Self {
59+
pub(crate) fn new(parts: SubAgentHandleParts) -> Self {
5860
Self {
59-
id,
60-
config,
61+
id: parts.id,
62+
config: parts.config,
6163
created_at: std::time::SystemTime::now()
6264
.duration_since(std::time::UNIX_EPOCH)
6365
.unwrap()
6466
.as_millis() as u64,
65-
control_tx,
66-
subagent_event_tx,
67-
event_history,
68-
state,
69-
activity,
70-
task_handle: Arc::new(task_handle),
67+
control_tx: parts.control_tx,
68+
subagent_event_tx: parts.subagent_event_tx,
69+
event_history: parts.event_history,
70+
state: parts.state,
71+
activity: parts.activity,
72+
task_handle: Arc::new(parts.task_handle),
7173
}
7274
}
7375

core/src/tools/builtin/agentic_parse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ fn render_document_for_llm(
295295
section.push_str(&format!(" ({})", label));
296296
}
297297
}
298-
section.push_str("\n");
298+
section.push('\n');
299299
if let Some(location) = &block.location {
300300
let location = block_location_label(location);
301301
if !location.is_empty() {

sdk/node/package-lock.json

Lines changed: 21 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)