Skip to content

Commit 6b5089a

Browse files
authored
chore: reorganize to v1 module (#1094)
Internal reorg for now to allow for having schemas for multiple versions.
1 parent 674fdbc commit 6b5089a

15 files changed

Lines changed: 71 additions & 65 deletions

src/lib.rs

Lines changed: 2 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -50,61 +50,6 @@
5050
//! For the complete protocol specification and documentation, visit:
5151
//! [https://agentclientprotocol.com](https://agentclientprotocol.com)
5252
53-
mod agent;
54-
mod client;
55-
mod content;
56-
#[cfg(feature = "unstable_elicitation")]
57-
mod elicitation;
58-
mod error;
59-
mod ext;
60-
#[cfg(feature = "unstable_nes")]
61-
mod nes;
62-
mod plan;
63-
#[cfg(feature = "unstable_cancel_request")]
64-
mod protocol_level;
65-
mod rpc;
66-
mod serde_util;
67-
mod tool_call;
68-
mod version;
53+
pub mod v1;
6954

70-
pub use agent::*;
71-
pub use client::*;
72-
pub use content::*;
73-
use derive_more::{Display, From};
74-
#[cfg(feature = "unstable_elicitation")]
75-
pub use elicitation::*;
76-
pub use error::*;
77-
pub use ext::*;
78-
#[cfg(feature = "unstable_nes")]
79-
pub use nes::*;
80-
pub use plan::*;
81-
#[cfg(feature = "unstable_cancel_request")]
82-
pub use protocol_level::*;
83-
pub use rpc::*;
84-
pub use serde_json::value::RawValue;
85-
pub use serde_util::*;
86-
pub use tool_call::*;
87-
pub use version::*;
88-
89-
use schemars::JsonSchema;
90-
use serde::{Deserialize, Serialize};
91-
use std::sync::Arc;
92-
93-
/// A unique identifier for a conversation session between a client and agent.
94-
///
95-
/// Sessions maintain their own context, conversation history, and state,
96-
/// allowing multiple independent interactions with the same agent.
97-
///
98-
/// See protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)
99-
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq, Hash, Display, From)]
100-
#[serde(transparent)]
101-
#[from(Arc<str>, String, &'static str)]
102-
#[non_exhaustive]
103-
pub struct SessionId(pub Arc<str>);
104-
105-
impl SessionId {
106-
#[must_use]
107-
pub fn new(id: impl Into<Arc<str>>) -> Self {
108-
Self(id.into())
109-
}
110-
}
55+
pub use v1::*;

src/agent.rs renamed to src/v1/agent.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::{
2727
};
2828

2929
#[cfg(feature = "unstable_nes")]
30-
use crate::nes::{
30+
use crate::{
3131
DOCUMENT_DID_CHANGE_METHOD_NAME, DOCUMENT_DID_CLOSE_METHOD_NAME,
3232
DOCUMENT_DID_FOCUS_METHOD_NAME, DOCUMENT_DID_OPEN_METHOD_NAME, DOCUMENT_DID_SAVE_METHOD_NAME,
3333
NES_ACCEPT_METHOD_NAME, NES_CLOSE_METHOD_NAME, NES_REJECT_METHOD_NAME, NES_START_METHOD_NAME,

src/client.rs renamed to src/v1/client.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ use serde::{Deserialize, Serialize};
1111
use serde_with::{DefaultOnError, VecSkipError, serde_as, skip_serializing_none};
1212

1313
#[cfg(feature = "unstable_elicitation")]
14-
use crate::elicitation::{
14+
use crate::{
1515
CompleteElicitationNotification, CreateElicitationRequest, CreateElicitationResponse,
1616
ElicitationCapabilities,
1717
};
1818
use crate::{
19-
ContentBlock, ExtNotification, ExtRequest, ExtResponse, IntoOption, Meta, Plan,
20-
SessionConfigOption, SessionId, SessionModeId, SkipListener, ToolCall, ToolCallUpdate,
19+
ContentBlock, ExtNotification, ExtRequest, ExtResponse, IntoMaybeUndefined, IntoOption,
20+
MaybeUndefined, Meta, Plan, SessionConfigOption, SessionId, SessionModeId, SkipListener,
21+
ToolCall, ToolCallUpdate,
2122
};
22-
use crate::{IntoMaybeUndefined, MaybeUndefined};
2323

2424
#[cfg(feature = "unstable_nes")]
2525
use crate::{ClientNesCapabilities, PositionEncodingKind};
File renamed without changes.
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ use schemars::JsonSchema;
1212
use serde::{Deserialize, Serialize};
1313
use serde_with::{DefaultOnError, serde_as, skip_serializing_none};
1414

15-
use crate::client::{ELICITATION_COMPLETE_NOTIFICATION, ELICITATION_CREATE_METHOD_NAME};
16-
use crate::tool_call::ToolCallId;
17-
use crate::{IntoOption, Meta, RequestId, SessionId};
15+
use crate::{
16+
ELICITATION_COMPLETE_NOTIFICATION, ELICITATION_CREATE_METHOD_NAME, IntoOption, Meta, RequestId,
17+
SessionId, ToolCallId,
18+
};
1819

1920
/// **UNSTABLE**
2021
///
File renamed without changes.
File renamed without changes.

src/v1/mod.rs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
//! Agent Client Protocol version 1 types.
2+
3+
mod agent;
4+
mod client;
5+
mod content;
6+
#[cfg(feature = "unstable_elicitation")]
7+
mod elicitation;
8+
mod error;
9+
mod ext;
10+
#[cfg(feature = "unstable_nes")]
11+
mod nes;
12+
mod plan;
13+
#[cfg(feature = "unstable_cancel_request")]
14+
mod protocol_level;
15+
mod rpc;
16+
mod serde_util;
17+
mod tool_call;
18+
mod version;
19+
20+
pub use agent::*;
21+
pub use client::*;
22+
pub use content::*;
23+
use derive_more::{Display, From};
24+
#[cfg(feature = "unstable_elicitation")]
25+
pub use elicitation::*;
26+
pub use error::*;
27+
pub use ext::*;
28+
#[cfg(feature = "unstable_nes")]
29+
pub use nes::*;
30+
pub use plan::*;
31+
#[cfg(feature = "unstable_cancel_request")]
32+
pub use protocol_level::*;
33+
pub use rpc::*;
34+
pub use serde_json::value::RawValue;
35+
pub use serde_util::*;
36+
pub use tool_call::*;
37+
pub use version::*;
38+
39+
use schemars::JsonSchema;
40+
use serde::{Deserialize, Serialize};
41+
use std::sync::Arc;
42+
43+
/// A unique identifier for a conversation session between a client and agent.
44+
///
45+
/// Sessions maintain their own context, conversation history, and state,
46+
/// allowing multiple independent interactions with the same agent.
47+
///
48+
/// See protocol docs: [Session ID](https://agentclientprotocol.com/protocol/session-setup#session-id)
49+
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq, Hash, Display, From)]
50+
#[serde(transparent)]
51+
#[from(Arc<str>, String, &'static str)]
52+
#[non_exhaustive]
53+
pub struct SessionId(pub Arc<str>);
54+
55+
impl SessionId {
56+
#[must_use]
57+
pub fn new(id: impl Into<Arc<str>>) -> Self {
58+
Self(id.into())
59+
}
60+
}
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)