-
Notifications
You must be signed in to change notification settings - Fork 2
feat(acp-nats-ws): unblock remote ACP clients #126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
c3aad6f
fix(acp-nats-ws): align websocket bridge with acp transport draft
yordis 38d7d3b
feat(acp-nats-ws): unblock streamable HTTP clients
yordis db2f17a
chore(acp-nats-ws): keep lockfile aligned
yordis 32deb24
fix(acp-nats-ws): restore rust ci signal
yordis 5c738a7
fix(acp-nats-ws): keep websocket logs accurate
yordis 0646d6b
fix(acp-nats-ws): drain HTTP connections on shutdown
yordis bb6d8a0
fix(acp-nats-ws): preserve session stream boundaries
yordis a252d07
fix(acp-nats-ws): accept proxy-shaped headers
yordis d7d81ac
fix(acp-nats-ws): protect HTTP streams from slow clients
yordis 38fbedc
fix(acp-nats-ws): preserve HTTP transport failure context
yordis 92146c6
fix(acp-nats-ws): keep GET stream headers consistent
yordis bd76027
fix(acp-nats-ws): accept null JSON-RPC responses
yordis 55623d6
fix(acp-nats-ws): close transport review gaps
yordis ff6742a
refactor(acp-nats-ws): align transport errors with workspace style
yordis 8b56be4
test(acp-nats-ws): keep manual transport errors covered
yordis c73e94c
refactor(acp-nats-ws): drop pre-spec websocket alias
yordis 7b3306a
test(acp-nats-ws): cover the single-endpoint router
yordis f5f83ff
fix(acp-nats-ws): prevent protocol drift on HTTP
yordis 32a0c51
fix(acp-nats-ws): close transport compliance gaps
yordis 0e92e05
fix(acp-nats-ws): honor session activation flow
yordis 3322300
refactor(acp-nats-ws): make explicit ids the primary constructor
yordis 8898cb1
refactor(acp-nats-ws): keep generated ids behind default
yordis 8805ee2
refactor(acp-nats-ws): keep transport defaults centralized
yordis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| #[derive(Clone, Debug, PartialEq, Eq, Hash)] | ||
| pub struct AcpConnectionId(uuid::Uuid); | ||
|
|
||
| impl AcpConnectionId { | ||
| pub fn new(uuid: uuid::Uuid) -> Self { | ||
| Self(uuid) | ||
| } | ||
|
|
||
| pub fn parse(s: &str) -> Result<Self, AcpConnectionIdError> { | ||
| uuid::Uuid::parse_str(s) | ||
| .map(Self::new) | ||
| .map_err(AcpConnectionIdError::InvalidUuid) | ||
| } | ||
| } | ||
|
|
||
| impl Default for AcpConnectionId { | ||
| fn default() -> Self { | ||
| Self::new(uuid::Uuid::now_v7()) | ||
| } | ||
| } | ||
|
|
||
| impl std::fmt::Display for AcpConnectionId { | ||
| fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
| self.0.fmt(f) | ||
| } | ||
| } | ||
|
|
||
| #[derive(Debug)] | ||
| pub enum AcpConnectionIdError { | ||
| InvalidUuid(uuid::Error), | ||
| } | ||
|
|
||
| impl std::fmt::Display for AcpConnectionIdError { | ||
| fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
| match self { | ||
| Self::InvalidUuid(error) => write!(f, "invalid ACP connection id: {error}"), | ||
| } | ||
| } | ||
| } | ||
|
|
||
| impl std::error::Error for AcpConnectionIdError { | ||
| fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { | ||
| match self { | ||
| Self::InvalidUuid(error) => Some(error), | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
| use std::error::Error as _; | ||
|
|
||
| #[test] | ||
| fn new_wraps_existing_uuid() { | ||
| let uuid = uuid::Uuid::nil(); | ||
| assert_eq!(AcpConnectionId::new(uuid).to_string(), uuid.to_string()); | ||
| } | ||
|
|
||
| #[test] | ||
| fn parse_round_trips_uuid() { | ||
| let id = AcpConnectionId::default(); | ||
| let parsed = AcpConnectionId::parse(&id.to_string()).unwrap(); | ||
| assert_eq!(parsed, id); | ||
| } | ||
|
|
||
| #[test] | ||
| fn parse_rejects_invalid_uuid() { | ||
| assert!(AcpConnectionId::parse("not-a-uuid").is_err()); | ||
| } | ||
|
|
||
| #[test] | ||
| fn default_generates_non_empty_id() { | ||
| assert!(!AcpConnectionId::default().to_string().is_empty()); | ||
| } | ||
|
|
||
| #[test] | ||
| fn parse_error_displays_context() { | ||
| let error = AcpConnectionId::parse("not-a-uuid").unwrap_err(); | ||
| assert!(error.to_string().contains("invalid ACP connection id")); | ||
| } | ||
|
|
||
| #[test] | ||
| fn parse_error_exposes_uuid_source() { | ||
| let error = AcpConnectionId::parse("not-a-uuid").unwrap_err(); | ||
| assert!(error.source().is_some()); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,12 @@ | ||
| use std::net::{IpAddr, Ipv4Addr}; | ||
|
|
||
| pub const ACP_CONNECTION_ID_HEADER: &str = "acp-connection-id"; | ||
| pub const ACP_ENDPOINT: &str = "/acp"; | ||
| pub const ACP_PROTOCOL_VERSION_HEADER: &str = "acp-protocol-version"; | ||
| pub const ACP_SESSION_ID_HEADER: &str = "acp-session-id"; | ||
| pub const DEFAULT_HOST: IpAddr = IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)); | ||
| pub const DEFAULT_PORT: u16 = 8080; | ||
| pub const DUPLEX_BUFFER_SIZE: usize = 64 * 1024; | ||
| pub const HTTP_CHANNEL_CAPACITY: usize = 64; | ||
| pub const THREAD_NAME: &str = "acp-ws-local"; | ||
| pub const X_ACCEL_BUFFERING_HEADER: &str = "x-accel-buffering"; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.