11use std:: collections:: HashMap ;
22use std:: path:: PathBuf ;
3- use std:: sync:: Arc ;
43use std:: time:: Duration ;
54
65use futures:: future:: BoxFuture ;
@@ -34,6 +33,11 @@ pub struct RemoteExecServerConnectArgs {
3433}
3534
3635/// Registry-authorized material for one Noise rendezvous connection attempt.
36+ ///
37+ /// Treat this as an atomic, single-use bundle. The URL authorization, executor
38+ /// registration, pinned executor key, and harness-key authorization describe one
39+ /// physical connection attempt and must not be mixed with values from another
40+ /// registry response.
3741pub struct NoiseRendezvousConnectBundle {
3842 pub websocket_url : String ,
3943 pub environment_id : String ,
@@ -58,6 +62,10 @@ impl std::fmt::Debug for NoiseRendezvousConnectBundle {
5862}
5963
6064/// Connection arguments for an authenticated Noise rendezvous exec-server.
65+ ///
66+ /// `harness_identity` identifies the logical harness endpoint and may be reused
67+ /// across reconnects. In contrast, callers must supply a fresh
68+ /// [`NoiseRendezvousConnectBundle`] for each physical connection attempt.
6169pub struct NoiseRendezvousConnectArgs {
6270 pub bundle : NoiseRendezvousConnectBundle ,
6371 pub harness_identity : NoiseChannelIdentity ,
@@ -80,20 +88,6 @@ impl std::fmt::Debug for NoiseRendezvousConnectArgs {
8088 }
8189}
8290
83- /// Supplies fresh registry-authorized material for Noise rendezvous connections.
84- ///
85- /// Implementations must preserve one endpoint-local harness identity while
86- /// refreshing short-lived registry material for every physical connection attempt.
87- pub trait NoiseRendezvousConnectProvider : Send + Sync {
88- /// Environment ID this provider is authorized to connect to.
89- fn environment_id ( & self ) -> & str ;
90-
91- /// Returns a fresh atomic bundle for one physical connection attempt.
92- fn connect_args ( & self ) -> BoxFuture < ' _ , Result < NoiseRendezvousConnectArgs , ExecServerError > > ;
93- }
94-
95- pub type SharedNoiseRendezvousConnectProvider = Arc < dyn NoiseRendezvousConnectProvider > ;
96-
9791/// Stdio connection arguments for a command-backed exec-server.
9892#[ derive( Debug , Clone , PartialEq , Eq ) ]
9993pub ( crate ) struct StdioExecServerConnectArgs {
@@ -113,52 +107,20 @@ pub(crate) struct StdioExecServerCommand {
113107}
114108
115109/// Parameters used to connect to a remote exec-server environment.
116- #[ derive( Clone ) ]
110+ #[ derive( Debug , Clone , PartialEq , Eq ) ]
117111pub ( crate ) enum ExecServerTransportParams {
118112 WebSocketUrl {
119113 websocket_url : String ,
120114 connect_timeout : Duration ,
121115 initialize_timeout : Duration ,
122116 } ,
123- NoiseRendezvous {
124- provider : SharedNoiseRendezvousConnectProvider ,
125- } ,
126117 #[ allow( dead_code) ]
127118 StdioCommand {
128119 command : StdioExecServerCommand ,
129120 initialize_timeout : Duration ,
130121 } ,
131122}
132123
133- impl std:: fmt:: Debug for ExecServerTransportParams {
134- fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
135- match self {
136- Self :: WebSocketUrl {
137- websocket_url,
138- connect_timeout,
139- initialize_timeout,
140- } => f
141- . debug_struct ( "WebSocketUrl" )
142- . field ( "websocket_url" , websocket_url)
143- . field ( "connect_timeout" , connect_timeout)
144- . field ( "initialize_timeout" , initialize_timeout)
145- . finish ( ) ,
146- Self :: NoiseRendezvous { provider } => f
147- . debug_struct ( "NoiseRendezvous" )
148- . field ( "environment_id" , & provider. environment_id ( ) )
149- . finish ( ) ,
150- Self :: StdioCommand {
151- command,
152- initialize_timeout,
153- } => f
154- . debug_struct ( "StdioCommand" )
155- . field ( "command" , command)
156- . field ( "initialize_timeout" , initialize_timeout)
157- . finish ( ) ,
158- }
159- }
160- }
161-
162124impl ExecServerTransportParams {
163125 pub ( crate ) fn websocket_url ( websocket_url : String ) -> Self {
164126 Self :: WebSocketUrl {
@@ -169,6 +131,7 @@ impl ExecServerTransportParams {
169131 }
170132}
171133
134+ /// Removes URL query and fragment data before a rendezvous URL reaches logs or errors.
172135pub ( crate ) fn redacted_websocket_url ( websocket_url : & str ) -> String {
173136 match url:: Url :: parse ( websocket_url) {
174137 Ok ( mut url) => {
0 commit comments