Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ All paths in the protocol should be absolute

- Add constants for the method names
- Add variants to {Agent|Client}{Request|Response} enums
- Handle the new method in the `Side::decode_request`/`Side::decode_notification` implementation
- Add the method to markdown_generator.rs SideDocs functions
- Run `npm run generate` and fix any issues that appear
- Run `npm run check`
Expand Down
34 changes: 24 additions & 10 deletions src/bin/generate.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use agent_client_protocol_schema::{
AGENT_METHOD_NAMES, AgentSide, CLIENT_METHOD_NAMES, ClientSide, JsonRpcMessage,
OutgoingMessage, ProtocolVersion,
AGENT_METHOD_NAMES, AgentNotification, AgentRequest, AgentResponse, CLIENT_METHOD_NAMES,
ClientNotification, ClientRequest, ClientResponse, JsonRpcMessage, Notification,
ProtocolVersion, Request, Response,
};
#[cfg(feature = "unstable_cancel_request")]
use agent_client_protocol_schema::{PROTOCOL_LEVEL_METHOD_NAMES, ProtocolLevelNotification};
Expand All @@ -9,28 +10,41 @@ use schemars::{
generate::SchemaSettings,
transform::{RemoveRefSiblings, ReplaceBoolSchemas},
};
use serde::{Deserialize, Serialize};
use std::{env, fs, path::Path};

use markdown_generator::MarkdownGenerator;

#[expect(dead_code)]
#[derive(JsonSchema)]
/// All messages that an agent can send to a client.
#[derive(Serialize, Deserialize, JsonSchema)]
#[serde(untagged)]
#[schemars(inline)]
struct AgentOutgoingMessage(JsonRpcMessage<OutgoingMessage<AgentSide, ClientSide>>);
#[allow(clippy::large_enum_variant)]
enum AgentOutgoingMessage {
Request(Request<AgentRequest>),
Response(Response<AgentResponse>),
Notification(Notification<AgentNotification>),
}

#[expect(dead_code)]
#[derive(JsonSchema)]
/// All messages that a client can send to an agent.
#[derive(Serialize, Deserialize, JsonSchema)]
#[serde(untagged)]
#[schemars(inline)]
struct ClientOutgoingMessage(JsonRpcMessage<OutgoingMessage<ClientSide, AgentSide>>);
#[allow(clippy::large_enum_variant)]
enum ClientOutgoingMessage {
Request(Request<ClientRequest>),
Response(Response<ClientResponse>),
Notification(Notification<ClientNotification>),
}

#[expect(dead_code)]
#[derive(JsonSchema)]
#[serde(untagged)]
#[schemars(title = "Agent Client Protocol")]
#[allow(clippy::large_enum_variant)]
enum AcpTypes {
Agent(AgentOutgoingMessage),
Client(ClientOutgoingMessage),
Agent(JsonRpcMessage<AgentOutgoingMessage>),
Client(JsonRpcMessage<ClientOutgoingMessage>),
#[cfg(feature = "unstable_cancel_request")]
ProtocolLevel(ProtocolLevelNotification),
}
Expand Down
Loading
Loading