feat: prepare agen crates for publication

This commit is contained in:
2026-08-23 03:41:51 +09:00
parent aa8dd4f89e
commit d69c367285
206 changed files with 1316 additions and 1145 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ license.workspace = true
[dependencies]
base64.workspace = true
llm-engine = { workspace = true }
agen = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
uuid = { workspace = true, features = ["v7", "serde"] }
+1 -1
View File
@@ -7,7 +7,7 @@
//!
//! Disabled by default. Enable via `SessionConfig::record_event_trace`.
use llm_engine::llm_client::event::Event;
use agen::llm_client::event::Event;
use serde::{Deserialize, Serialize};
use serde_json::Value;
+2 -2
View File
@@ -40,10 +40,10 @@ pub mod system_item;
pub mod worker_metadata;
pub mod worker_session_store;
pub use agen::UsageRecord;
pub use agen::llm_client::types::{ContentPart, Item, Role};
pub use event_trace::{TraceEntry, TracePayload};
pub use fs_store::FsStore;
pub use llm_engine::UsageRecord;
pub use llm_engine::llm_client::types::{ContentPart, Item, Role};
pub use logged_item::{LoggedContentPart, LoggedItem, LoggedRole, from_logged, to_logged};
pub use segment::{
SegmentStartState, append_entry, append_system_item, classify_history_item,
+5 -5
View File
@@ -1,4 +1,4 @@
//! Persistence-stable mirror of `llm_engine::Item`.
//! Persistence-stable mirror of `agen::Item`.
//!
//! `LogEntry` does not embed `Item` directly because that couples the on-disk
//! schema to the LLM worker's internal type — a field rename or addition there
@@ -12,11 +12,11 @@
//! `Reasoning::encrypted_content` is preserved because OpenAI Responses ZDR
//! requires it on stateless re-send.
use base64::{Engine as _, engine::general_purpose::STANDARD};
use llm_engine::{
use agen::{
llm_client::types::{ContentPart, Item, Role},
tool::{Attachment, ImageAttachment},
};
use base64::{Engine as _, engine::general_purpose::STANDARD};
use serde::{Deserialize, Deserializer, Serialize, Serializer, de::Error as _};
fn is_false(value: &bool) -> bool {
@@ -437,8 +437,8 @@ mod tests {
"attached",
None,
false,
vec![llm_engine::tool::Attachment::Image(
llm_engine::tool::ImageAttachment::new(
vec![agen::tool::Attachment::Image(
agen::tool::ImageAttachment::new(
"image/png",
std::sync::Arc::<[u8]>::from(&b"secret-image-body"[..]),
),
+3 -3
View File
@@ -9,9 +9,9 @@ use crate::segment_log::{self, LogEntry, SegmentOrigin};
use crate::store::{Store, StoreError};
use crate::system_item::SystemItem;
use crate::{SegmentId, SessionId};
use llm_engine::EngineResult;
use llm_engine::llm_client::RequestConfig;
use llm_engine::llm_client::types::Item;
use agen::EngineResult;
use agen::llm_client::RequestConfig;
use agen::llm_client::types::Item;
use protocol::Segment;
/// State snapshot for creating a SegmentStart entry.
+7 -7
View File
@@ -9,8 +9,8 @@
//! ordered. Fork lineage references between segments use turn-number indices
//! (`SegmentOrigin.at_turn_index`) rather than per-entry hashes.
use llm_engine::llm_client::types::{Item, RequestConfig};
use llm_engine::{EngineResult, UsageRecord};
use agen::llm_client::types::{Item, RequestConfig};
use agen::{EngineResult, UsageRecord};
use protocol::{InvokeKind, Segment};
use serde::{Deserialize, Serialize};
@@ -482,8 +482,8 @@ mod tests {
"attached",
None,
false,
vec![llm_engine::tool::Attachment::Image(
llm_engine::tool::ImageAttachment::new("image/png", b"durable-image".to_vec()),
vec![agen::tool::Attachment::Image(
agen::tool::ImageAttachment::new("image/png", b"durable-image".to_vec()),
)],
)
.into(),
@@ -497,7 +497,7 @@ mod tests {
Item::ToolResult { attachments, .. }
if matches!(
attachments.as_slice(),
[llm_engine::tool::Attachment::Image(image)]
[agen::tool::Attachment::Image(image)]
if image.data() == b"durable-image"
)
));
@@ -837,10 +837,10 @@ mod tests {
assert_eq!(state.history.len(), 1);
match &state.history[0] {
Item::Message { role, content, .. } => {
assert!(matches!(role, llm_engine::Role::User));
assert!(matches!(role, agen::Role::User));
assert_eq!(content.len(), 1);
match &content[0] {
llm_engine::ContentPart::Text { text } => {
agen::ContentPart::Text { text } => {
assert_eq!(text, "see line1\nline2@src/main.rs");
}
other => panic!("unexpected content: {other:?}"),
+1 -1
View File
@@ -18,7 +18,7 @@
//! preserved only on the log/wire side; the LLM still sees plain
//! system-message text.
use llm_engine::llm_client::types::Item;
use agen::llm_client::types::Item;
use protocol::WorkerEvent;
use serde::{Deserialize, Serialize};
+2 -2
View File
@@ -4,10 +4,10 @@ use std::pin::Pin;
use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};
use agen::llm_client::event::Event;
use agen::llm_client::{ClientError, LlmClient, Request};
use async_trait::async_trait;
use futures::Stream;
use llm_engine::llm_client::event::Event;
use llm_engine::llm_client::{ClientError, LlmClient, Request};
/// A mock LLM client that replays pre-defined event sequences.
#[derive(Clone)]
+5 -5
View File
@@ -1,5 +1,5 @@
use llm_engine::EngineResult;
use llm_engine::llm_client::types::{Item, RequestConfig};
use agen::EngineResult;
use agen::llm_client::types::{Item, RequestConfig};
use session_store::{
FsStore, LogEntry, Store, TraceEntry, collect_state, new_segment_id, new_session_id,
};
@@ -177,9 +177,9 @@ fn trace_entries_in_separate_file() {
turn: 0,
llm_call: Some(0),
payload: session_store::TracePayload::StreamEvent {
event: llm_engine::llm_client::event::Event::Ping(
llm_engine::llm_client::event::PingEvent { timestamp: None },
),
event: agen::llm_client::event::Event::Ping(agen::llm_client::event::PingEvent {
timestamp: None,
}),
},
};
store.append_trace(sid, segid, &trace).unwrap();
+10 -10
View File
@@ -2,13 +2,13 @@ mod common;
use std::sync::Arc;
use agen::Engine;
use agen::interceptor::{Interceptor, TurnEndAction};
use agen::llm_client::event::{Event, ResponseStatus, StatusEvent};
use agen::llm_client::types::{Item, RequestConfig};
use agen::tool::{Tool, ToolDefinition, ToolError, ToolMeta, ToolOutput};
use async_trait::async_trait;
use common::MockLlmClient;
use llm_engine::Engine;
use llm_engine::interceptor::{Interceptor, TurnEndAction};
use llm_engine::llm_client::event::{Event, ResponseStatus, StatusEvent};
use llm_engine::llm_client::types::{Item, RequestConfig};
use llm_engine::tool::{Tool, ToolDefinition, ToolError, ToolMeta, ToolOutput};
use session_store::{FsStore, LogEntry, SegmentStartState, Store, collect_state};
// =============================================================================
@@ -57,7 +57,7 @@ impl Tool for MockWeatherTool {
async fn execute(
&self,
_input_json: &str,
_ctx: llm_engine::tool::ToolExecutionContext,
_ctx: agen::tool::ToolExecutionContext,
) -> Result<ToolOutput, ToolError> {
Ok("Sunny, 25C".to_string().into())
}
@@ -102,7 +102,7 @@ async fn run_and_persist(
session_id: session_store::SessionId,
segment_id: session_store::SegmentId,
input: &str,
) -> (Engine<MockLlmClient>, llm_engine::EngineResult) {
) -> (Engine<MockLlmClient>, agen::EngineResult) {
// Mirror Worker's run-entry contract: log the user input as segments
// before the worker pushes its flattened user_message; save_delta
// skips the resulting user_message item to avoid double-write.
@@ -191,7 +191,7 @@ async fn session_run_logs_entries() {
matches!(
e,
LogEntry::RunCompleted {
result: llm_engine::EngineResult::Finished,
result: agen::EngineResult::Finished,
..
}
)
@@ -291,7 +291,7 @@ async fn session_resume_after_pause() {
.unwrap();
let (_worker, result) = run_and_persist(worker, &store, sid, segid, "Weather?").await;
assert!(matches!(result, llm_engine::EngineResult::Paused));
assert!(matches!(result, agen::EngineResult::Paused));
// Check RunCompleted is Paused
let entries = store.read_all(sid, segid).unwrap();
@@ -299,7 +299,7 @@ async fn session_resume_after_pause() {
matches!(
e,
LogEntry::RunCompleted {
result: llm_engine::EngineResult::Paused,
result: agen::EngineResult::Paused,
..
}
)