#[non_exhaustive]pub struct NewSessionRequest {
pub cwd: PathBuf,
pub additional_directories: Vec<PathBuf>,
pub mcp_servers: Vec<McpServer>,
pub system_prompt: Option<SystemPrompt>,
pub config_options: Vec<InitialSessionConfigOption>,
pub meta: Option<Meta>,
}Expand description
Request parameters for creating a new session.
See protocol docs: Creating a Session
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.cwd: PathBufThe working directory for this session. Must be an absolute path.
additional_directories: Vec<PathBuf>Additional workspace roots for this session. Each path MUST be absolute.
These expand the session’s filesystem scope without changing cwd, which
remains the base for relative paths. When omitted or empty, no
additional roots are activated for the new session.
mcp_servers: Vec<McpServer>List of MCP (Model Context Protocol) servers the agent should connect to.
system_prompt: Option<SystemPrompt>System-level instructions for the new session.
Optional. Omitted and null are equivalent and mean the Agent uses its
own default instructions. Clients MUST only send this when the Agent
advertises sessionCapabilities.systemPrompt.
config_options: Vec<InitialSessionConfigOption>unstable_session_options only.UNSTABLE
This capability is not part of the spec yet, and may be removed or changed at any point.
Initial values for the session’s config options.
Optional. Omitted and null are equivalent to an empty list. Clients MUST only send
this when the Agent advertises sessionCapabilities.options.
The Agent applies the entries in list order, as if the Client had called
session/set_config_option for each entry after the session was set up. Malformed
entries and duplicate configId values fail the request with -32602. The Agent MUST
ignore an entry whose configId is unknown, whose type does not match the option,
or whose value is not allowed when it is applied. The configOptions in the response contain the values the session actually
has. The Agent SHOULD NOT send config_option_update notifications for these entries,
and SHOULD NOT send other session/update notifications caused by applying them
before it responds.
meta: Option<Meta>The _meta property is reserved by ACP to allow clients and agents to attach additional metadata to their interactions. Implementations MUST NOT make assumptions about values at these keys.
See protocol docs: Extensibility
Implementations§
Source§impl NewSessionRequest
impl NewSessionRequest
Sourcepub fn new(cwd: impl Into<PathBuf>) -> Self
pub fn new(cwd: impl Into<PathBuf>) -> Self
Builds NewSessionRequest with the required request fields set. Optional fields start unset or empty.
Sourcepub fn additional_directories(
self,
additional_directories: Vec<PathBuf>,
) -> Self
pub fn additional_directories( self, additional_directories: Vec<PathBuf>, ) -> Self
Additional workspace roots for this session. Each path MUST be absolute.
Sourcepub fn mcp_servers(self, mcp_servers: Vec<McpServer>) -> Self
pub fn mcp_servers(self, mcp_servers: Vec<McpServer>) -> Self
List of MCP (Model Context Protocol) servers the agent should connect to.
Sourcepub fn system_prompt(self, system_prompt: impl IntoOption<SystemPrompt>) -> Self
pub fn system_prompt(self, system_prompt: impl IntoOption<SystemPrompt>) -> Self
System-level instructions for the new session.
Sourcepub fn config_options(
self,
config_options: Vec<InitialSessionConfigOption>,
) -> Self
Available on crate feature unstable_session_options only.
pub fn config_options( self, config_options: Vec<InitialSessionConfigOption>, ) -> Self
unstable_session_options only.UNSTABLE
This capability is not part of the spec yet, and may be removed or changed at any point.
Initial values for the session’s config options.
Optional. Omitted and null are equivalent to an empty list. Clients MUST only send
this when the Agent advertises sessionCapabilities.options.
The Agent applies the entries in list order, as if the Client had called
session/set_config_option for each entry after the session was set up. Malformed
entries and duplicate configId values fail the request with -32602. The Agent MUST
ignore an entry whose configId is unknown, whose type does not match the option,
or whose value is not allowed when it is applied. The configOptions in the response contain the values the session actually
has. The Agent SHOULD NOT send config_option_update notifications for these entries,
and SHOULD NOT send other session/update notifications caused by applying them
before it responds.
Sourcepub fn meta(self, meta: impl IntoOption<Meta>) -> Self
pub fn meta(self, meta: impl IntoOption<Meta>) -> Self
The _meta property is reserved by ACP to allow clients and agents to attach additional metadata to their interactions. Implementations MUST NOT make assumptions about values at these keys.
See protocol docs: Extensibility
Trait Implementations§
Source§impl Clone for NewSessionRequest
impl Clone for NewSessionRequest
Source§impl Debug for NewSessionRequest
impl Debug for NewSessionRequest
Source§impl<'de> Deserialize<'de> for NewSessionRequest
impl<'de> Deserialize<'de> for NewSessionRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for NewSessionRequest
Source§impl JsonSchema for NewSessionRequest
impl JsonSchema for NewSessionRequest
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for NewSessionRequest
impl PartialEq for NewSessionRequest
Source§impl Serialize for NewSessionRequest
impl Serialize for NewSessionRequest
impl StructuralPartialEq for NewSessionRequest
Auto Trait Implementations§
impl Forget for NewSessionRequest
impl Freeze for NewSessionRequest
impl Move for NewSessionRequest
impl RefUnwindSafe for NewSessionRequest
impl Send for NewSessionRequest
impl Sync for NewSessionRequest
impl Unpin for NewSessionRequest
impl UnsafeUnpin for NewSessionRequest
impl UnwindSafe for NewSessionRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.