@@ -19,7 +19,7 @@ enum SessionType {
1919 TYPE_MACAROON_ADMIN = 1 ;
2020 TYPE_MACAROON_CUSTOM = 2 ;
2121 TYPE_UI_PASSWORD = 3 ;
22- reserved 4 ;
22+ TYPE_AUTOPILOT = 4 ;
2323 TYPE_MACAROON_ACCOUNT = 5 ;
2424}
2525
@@ -67,6 +67,8 @@ message AddSessionResponse {
6767}
6868
6969message Session {
70+ bytes id = 14 ;
71+
7072 string label = 1 ;
7173
7274 SessionState session_state = 2 ;
@@ -92,6 +94,18 @@ message Session {
9294 MacaroonRecipe macaroon_recipe = 12 ;
9395
9496 string account_id = 13 ;
97+
98+ map <string , RulesMap > autopilot_feature_info = 15 ;
99+
100+ /*
101+ The unix timestamp indicating the time at which the session was revoked.
102+ Note that this field has not been around since the beginning and so it
103+ could be the case that a session has been revoked but that this field
104+ will not have been set for that session. Therefore, it is suggested that
105+ readers should not assume that if this field is zero that the session is
106+ not revoked. Readers should instead first check the session_state field.
107+ */
108+ uint64 revoked_at = 16 [jstype = JS_STRING ];
95109}
96110
97111message MacaroonRecipe {
@@ -113,3 +127,125 @@ message RevokeSessionRequest {
113127
114128message RevokeSessionResponse {
115129}
130+
131+ message RulesMap {
132+ /*
133+ A map of rule name to RuleValue. The RuleValue should be parsed based on
134+ the name of the rule.
135+ */
136+ map <string , RuleValue > rules = 1 ;
137+ }
138+
139+ message RuleValue {
140+ oneof value {
141+ RateLimit rate_limit = 1 ;
142+ ChannelPolicyBounds chan_policy_bounds = 2 ;
143+ HistoryLimit history_limit = 3 ;
144+ OffChainBudget off_chain_budget = 4 ;
145+ OnChainBudget on_chain_budget = 5 ;
146+ SendToSelf send_to_self = 6 ;
147+ ChannelRestrict channel_restrict = 7 ;
148+ PeerRestrict peer_restrict = 8 ;
149+ }
150+ }
151+
152+ message RateLimit {
153+ /*
154+ The rate limit for read-only calls.
155+ */
156+ Rate read_limit = 1 ;
157+
158+ /*
159+ The rate limit for write/execution calls.
160+ */
161+ Rate write_limit = 2 ;
162+ }
163+
164+ message Rate {
165+ /*
166+ The number of times a call is allowed in num_hours number of hours.
167+ */
168+ uint32 iterations = 1 ;
169+
170+ /*
171+ The number of hours in which the iterations count takes place over.
172+ */
173+ uint32 num_hours = 2 ;
174+ }
175+
176+ message HistoryLimit {
177+ /*
178+ The absolute unix timestamp in seconds before which no information should
179+ be shared. This should only be set if duration is not set.
180+ */
181+ uint64 start_time = 1 [jstype = JS_STRING ];
182+
183+ /*
184+ The maximum relative duration in seconds that a request is allowed to query
185+ for. This should only be set if start_time is not set.
186+ */
187+ uint64 duration = 2 [jstype = JS_STRING ];
188+ }
189+
190+ message ChannelPolicyBounds {
191+ /*
192+ The minimum base fee in msat that the autopilot can set for a channel.
193+ */
194+ uint64 min_base_msat = 1 [jstype = JS_STRING ];
195+
196+ /*
197+ The maximum base fee in msat that the autopilot can set for a channel.
198+ */
199+ uint64 max_base_msat = 2 [jstype = JS_STRING ];
200+
201+ /*
202+ The minimum ppm fee in msat that the autopilot can set for a channel.
203+ */
204+ uint32 min_rate_ppm = 3 ;
205+
206+ /*
207+ The maximum ppm fee in msat that the autopilot can set for a channel.
208+ */
209+ uint32 max_rate_ppm = 4 ;
210+
211+ /*
212+ The minimum cltv delta that the autopilot may set for a channel.
213+ */
214+ uint32 min_cltv_delta = 5 ;
215+
216+ /*
217+ The maximum cltv delta that the autopilot may set for a channel.
218+ */
219+ uint32 max_cltv_delta = 6 ;
220+
221+ /*
222+ The minimum htlc msat that the autopilot may set for a channel.
223+ */
224+ uint64 min_htlc_msat = 7 [jstype = JS_STRING ];
225+
226+ /*
227+ The maximum htlc msat that the autopilot may set for a channel.
228+ */
229+ uint64 max_htlc_msat = 8 [jstype = JS_STRING ];
230+ }
231+
232+ message OffChainBudget {
233+ uint64 max_amt_msat = 1 [jstype = JS_STRING ];
234+ uint64 max_fees_msat = 2 [jstype = JS_STRING ];
235+ }
236+
237+ message OnChainBudget {
238+ uint64 absolute_amt_sats = 1 [jstype = JS_STRING ];
239+ uint64 max_sat_per_v_byte = 2 [jstype = JS_STRING ];
240+ }
241+
242+ message SendToSelf {
243+ }
244+
245+ message ChannelRestrict {
246+ repeated uint64 channel_ids = 1 [jstype = JS_STRING ];
247+ }
248+
249+ message PeerRestrict {
250+ repeated string peer_ids = 1 ;
251+ }
0 commit comments