Pod-ID (UUID)の削除

This commit is contained in:
Keisuke Hirata 2026-04-11 03:44:37 +09:00
parent 7d1b74fb32
commit 3883fab29d
6 changed files with 13 additions and 21 deletions

View File

@ -1 +1,7 @@
設計指針を固め、全体の設計を進めるために、全体の俯瞰と細かいディテールを往復している。 設計指針を固め、全体の設計を進めるために、全体の俯瞰と細かいディテールを往復している。
---
`TODO.md`、`tickets/`はgitで管理されていて、時系列の管理はgitを参照して把握すること。
ticketは完了したら削除され、`TODO.md`はチェックを付けて積まれていく。
TODO.mdのリンクは完了後に切れるが、そのリンクを元にgitで消されたファイルを読み、内容を把握できる。

View File

@ -1 +1,7 @@
設計指針を固め、全体の設計を進めるために、全体の俯瞰と細かいディテールを往復している。 設計指針を固め、全体の設計を進めるために、全体の俯瞰と細かいディテールを往復している。
---
`TODO.md`、`tickets/`はgitで管理されていて、時系列の管理はgitを参照して把握すること。
ticketは完了したら削除され、`TODO.md`はチェックを付けて積まれていく。
TODO.mdのリンクは完了後に切れるが、そのリンクを元にgitで消されたファイルを読み、内容を把握できる。

1
Cargo.lock generated
View File

@ -1173,7 +1173,6 @@ dependencies = [
"thiserror", "thiserror",
"tokio", "tokio",
"toml", "toml",
"uuid",
] ]
[[package]] [[package]]

View File

@ -16,7 +16,6 @@ serde_json = "1.0.149"
thiserror = "2.0" thiserror = "2.0"
tokio = { version = "1.49", features = ["fs", "io-util", "macros", "net", "rt-multi-thread", "signal", "sync"] } tokio = { version = "1.49", features = ["fs", "io-util", "macros", "net", "rt-multi-thread", "signal", "sync"] }
toml = "1.1.2" toml = "1.1.2"
uuid = { version = "1.23.0", features = ["v7", "serde"] }
[dev-dependencies] [dev-dependencies]
async-trait = "0.1.89" async-trait = "0.1.89"

View File

@ -7,7 +7,7 @@ mod pod;
pub use controller::{PodController, PodHandle}; pub use controller::{PodController, PodHandle};
pub use manifest::{PodManifest, ProviderConfig, ProviderKind, Scope}; pub use manifest::{PodManifest, ProviderConfig, ProviderKind, Scope};
pub use pod::{Pod, PodError, PodId, PodRunResult, apply_worker_manifest, new_pod_id}; pub use pod::{Pod, PodError, PodRunResult, apply_worker_manifest};
pub use protocol::{ErrorCode, Event, Method, TurnResult}; pub use protocol::{ErrorCode, Event, Method, TurnResult};
pub use provider::{ProviderError, build_client}; pub use provider::{ProviderError, build_client};
pub use runtime_dir::RuntimeDir; pub use runtime_dir::RuntimeDir;

View File

@ -7,20 +7,11 @@ use llm_worker_persistence::{
use manifest::{PodManifest, Scope, WorkerManifest}; use manifest::{PodManifest, Scope, WorkerManifest};
/// Pod identifier. UUID v7 (time-ordered).
pub type PodId = uuid::Uuid;
/// Generate a new Pod ID.
pub fn new_pod_id() -> PodId {
uuid::Uuid::now_v7()
}
/// An independent agent execution unit. /// An independent agent execution unit.
/// ///
/// Wraps a persistent [`Session`] with manifest metadata and an optional /// Wraps a persistent [`Session`] with manifest metadata and an optional
/// directory scope. This is the primary abstraction in insomnia. /// directory scope. This is the primary abstraction in insomnia.
pub struct Pod<C: LlmClient, St: Store> { pub struct Pod<C: LlmClient, St: Store> {
id: PodId,
manifest: PodManifest, manifest: PodManifest,
session: Session<C, St>, session: Session<C, St>,
scope: Option<Scope>, scope: Option<Scope>,
@ -40,7 +31,6 @@ impl<C: LlmClient, St: Store> Pod<C, St> {
) -> Result<Self, PodError> { ) -> Result<Self, PodError> {
let session = Session::new(worker, store, SessionConfig::default()).await?; let session = Session::new(worker, store, SessionConfig::default()).await?;
Ok(Self { Ok(Self {
id: new_pod_id(),
manifest, manifest,
session, session,
scope, scope,
@ -49,7 +39,6 @@ impl<C: LlmClient, St: Store> Pod<C, St> {
/// Restore a Pod from a persisted session. /// Restore a Pod from a persisted session.
pub async fn restore( pub async fn restore(
id: PodId,
session_id: SessionId, session_id: SessionId,
manifest: PodManifest, manifest: PodManifest,
client: C, client: C,
@ -58,18 +47,12 @@ impl<C: LlmClient, St: Store> Pod<C, St> {
) -> Result<Self, PodError> { ) -> Result<Self, PodError> {
let session = Session::restore(client, store, session_id, SessionConfig::default()).await?; let session = Session::restore(client, store, session_id, SessionConfig::default()).await?;
Ok(Self { Ok(Self {
id,
manifest, manifest,
session, session,
scope, scope,
}) })
} }
/// The Pod's unique identifier.
pub fn id(&self) -> PodId {
self.id
}
/// The session ID used for persistence. /// The session ID used for persistence.
pub fn session_id(&self) -> SessionId { pub fn session_id(&self) -> SessionId {
self.session.session_id() self.session.session_id()
@ -121,7 +104,6 @@ impl<St: Store> Pod<Box<dyn LlmClient>, St> {
apply_worker_manifest(&mut worker, &manifest.worker); apply_worker_manifest(&mut worker, &manifest.worker);
let session = Session::new(worker, store, SessionConfig::default()).await?; let session = Session::new(worker, store, SessionConfig::default()).await?;
Ok(Self { Ok(Self {
id: new_pod_id(),
manifest, manifest,
session, session,
scope, scope,