@@ -11,6 +11,7 @@ use codex_protocol::items::AgentMessageContent as CoreAgentMessageContent;
1111use codex_protocol:: items:: TurnItem as CoreTurnItem ;
1212use codex_protocol:: models:: ResponseItem ;
1313use codex_protocol:: parse_command:: ParsedCommand as CoreParsedCommand ;
14+ use codex_protocol:: protocol:: CreditsSnapshot as CoreCreditsSnapshot ;
1415use codex_protocol:: protocol:: RateLimitSnapshot as CoreRateLimitSnapshot ;
1516use codex_protocol:: protocol:: RateLimitWindow as CoreRateLimitWindow ;
1617use codex_protocol:: user_input:: UserInput as CoreUserInput ;
@@ -994,13 +995,15 @@ pub struct AccountRateLimitsUpdatedNotification {
994995pub struct RateLimitSnapshot {
995996 pub primary : Option < RateLimitWindow > ,
996997 pub secondary : Option < RateLimitWindow > ,
998+ pub credits : Option < CreditsSnapshot > ,
997999}
9981000
9991001impl From < CoreRateLimitSnapshot > for RateLimitSnapshot {
10001002 fn from ( value : CoreRateLimitSnapshot ) -> Self {
10011003 Self {
10021004 primary : value. primary . map ( RateLimitWindow :: from) ,
10031005 secondary : value. secondary . map ( RateLimitWindow :: from) ,
1006+ credits : value. credits . map ( CreditsSnapshot :: from) ,
10041007 }
10051008 }
10061009}
@@ -1024,6 +1027,25 @@ impl From<CoreRateLimitWindow> for RateLimitWindow {
10241027 }
10251028}
10261029
1030+ #[ derive( Serialize , Deserialize , Debug , Clone , PartialEq , JsonSchema , TS ) ]
1031+ #[ serde( rename_all = "camelCase" ) ]
1032+ #[ ts( export_to = "v2/" ) ]
1033+ pub struct CreditsSnapshot {
1034+ pub has_credits : bool ,
1035+ pub unlimited : bool ,
1036+ pub balance : Option < String > ,
1037+ }
1038+
1039+ impl From < CoreCreditsSnapshot > for CreditsSnapshot {
1040+ fn from ( value : CoreCreditsSnapshot ) -> Self {
1041+ Self {
1042+ has_credits : value. has_credits ,
1043+ unlimited : value. unlimited ,
1044+ balance : value. balance ,
1045+ }
1046+ }
1047+ }
1048+
10271049#[ derive( Serialize , Deserialize , Debug , Clone , PartialEq , JsonSchema , TS ) ]
10281050#[ serde( rename_all = "camelCase" ) ]
10291051#[ ts( export_to = "v2/" ) ]
0 commit comments