aidaemon_core/approval.rs
1//! Typed call effects and owner approvals.
2//!
3//! A tool declares what one call does and to which target
4//! ([`Tool::effects`](crate::Tool::effects)), so policies judge effects
5//! rather than tool names. A hook that wants the owner to decide returns
6//! [`InterruptKind::OwnerApproval`]; when the resolver denies it, the kernel
7//! remembers the request's effects in [`crate::RunState::declined`] for the
8//! rest of the run.
9
10use serde::{Deserialize, Serialize};
11
12/// Prefix of the reason recorded when the owner declines an approval.
13pub const OWNER_DECLINED: &str = "[OWNER DECLINED]";
14
15/// Prefix of the reason for a call whose owner card got no answer (it
16/// expired, could not be delivered, or the turn was cancelled). Not a
17/// refusal: nothing is remembered as declined.
18pub const OWNER_UNANSWERED: &str = "[NO ANSWER]";
19
20/// Prefix of the reason an outbound secret scan (the
21/// [`crate::Safeguard::Egress`] hook) gives when it refuses a call.
22pub const EGRESS_BLOCKED: &str = "[EGRESS BLOCKED]";
23
24/// Prefix of the reason the [`crate::AuthorityHook`] gives when a call is
25/// outside what the run may do.
26pub const AUTHORITY_BLOCKED: &str = "[AUTHORITY BLOCKED]";
27
28/// Prefix of the refusal a rejected egress call returns to the model after
29/// the run read untrusted content.
30pub const UNTRUSTED_BLOCKED: &str = "[UNTRUSTED BLOCKED]";
31
32/// What kind of thing a call does.
33#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
34#[serde(rename_all = "snake_case")]
35#[non_exhaustive]
36pub enum EffectClass {
37 /// Sends data or acts on a host outside the owner's machine.
38 Egress,
39 /// Deletes a path.
40 Delete,
41 /// Creates or modifies a path.
42 Write,
43 /// Changes configuration stored at a path.
44 Configuration,
45 /// Uses a stored credential.
46 Credential,
47 /// Starts a program.
48 Process,
49 /// One exact call, named by its approval subject. Recorded when the
50 /// owner declines a request that declared no effects, so the identical
51 /// request is not put to the owner again.
52 Call,
53}
54
55impl std::fmt::Display for EffectClass {
56 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
57 f.write_str(match self {
58 Self::Egress => "egress",
59 Self::Delete => "delete",
60 Self::Write => "write",
61 Self::Configuration => "configuration",
62 Self::Credential => "credential",
63 Self::Process => "process",
64 Self::Call => "call",
65 })
66 }
67}
68
69impl EffectClass {
70 /// Whether targets of this class are paths, so a target covers the
71 /// paths below it.
72 fn is_path(self) -> bool {
73 matches!(self, Self::Delete | Self::Write | Self::Configuration)
74 }
75}
76
77/// One effect of a call on one target.
78///
79/// The producer normalizes `target`: lowercase `host:port` for
80/// [`EffectClass::Egress`]; an absolute, normalized path for
81/// [`EffectClass::Delete`], [`EffectClass::Write`] and
82/// [`EffectClass::Configuration`]; the profile name for
83/// [`EffectClass::Credential`]; the program name for [`EffectClass::Process`].
84/// Build keys with [`EffectKey::path`], [`EffectKey::egress`] and
85/// [`EffectKey::named`] so every producer uses the same convention.
86#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
87pub struct EffectKey {
88 pub class: EffectClass,
89 pub target: String,
90}
91
92impl EffectKey {
93 /// A path effect (`Delete`, `Write`, `Configuration`) on an absolute
94 /// path, normalized lexically: empty and `.` components dropped, `..`
95 /// resolved, no trailing slash. `None` for a relative path or one that
96 /// climbs above `/`. The filesystem is not consulted (symlinks are not
97 /// resolved). A Windows path with a drive (`C:\Users\x`, `c:/Users/x`)
98 /// is absolute too, written `C:/Users/x`: `\` and `/` both separate its
99 /// components, and the drive letter is uppercase.
100 pub fn path(class: EffectClass, raw: &str) -> Option<EffectKey> {
101 let (root, rest, separators): (String, &str, &[char]) = match raw.as_bytes() {
102 [b'/', ..] => (String::new(), raw, &['/']),
103 [drive, b':', b'\\' | b'/', ..] if drive.is_ascii_alphabetic() => (
104 format!("{}:", (*drive as char).to_ascii_uppercase()),
105 &raw[2..],
106 &['/', '\\'],
107 ),
108 _ => return None,
109 };
110 let mut parts: Vec<&str> = Vec::new();
111 for part in rest.split(separators) {
112 match part {
113 "" | "." => {}
114 ".." => {
115 parts.pop()?;
116 }
117 part => parts.push(part),
118 }
119 }
120 Some(EffectKey {
121 class,
122 target: format!("{root}/{}", parts.join("/")),
123 })
124 }
125
126 /// An egress effect on `host`, with target `host:port`: the host
127 /// lowercased and without a trailing dot (`h.example.` is `h.example`),
128 /// and the port given or else the scheme's default (http
129 /// 80, https 443, ssh 22; 0 for an unknown scheme).
130 pub fn egress(scheme: &str, host: &str, port: Option<u16>) -> EffectKey {
131 let port = port.unwrap_or_else(|| match scheme.to_ascii_lowercase().as_str() {
132 "http" => 80,
133 "https" => 443,
134 "ssh" => 22,
135 _ => 0,
136 });
137 EffectKey {
138 class: EffectClass::Egress,
139 target: format!("{}:{port}", host.to_ascii_lowercase().trim_end_matches('.')),
140 }
141 }
142
143 /// An effect named by an identifier rather than a path or host: the
144 /// profile name for [`EffectClass::Credential`], the program name for
145 /// [`EffectClass::Process`].
146 pub fn named(class: EffectClass, name: &str) -> EffectKey {
147 EffectKey {
148 class,
149 target: name.to_string(),
150 }
151 }
152
153 /// Same class, and the same target or, for path classes, one target is
154 /// the other or below it. Targets are compared as given, so both keys
155 /// must be normalized (built with [`EffectKey::path`],
156 /// [`EffectKey::egress`] or [`EffectKey::named`]): `h.example.invalid`
157 /// does not overlap `h.example.invalid:443`, and `/a/../b` does not
158 /// overlap `/b`.
159 pub fn overlaps(&self, other: &EffectKey) -> bool {
160 if self.class != other.class {
161 return false;
162 }
163 if self.target == other.target {
164 return true;
165 }
166 self.class.is_path()
167 && (path_covers(&self.target, &other.target)
168 || path_covers(&other.target, &self.target))
169 }
170}
171
172/// Whether `inner` is `outer` or a path below it, compared by component.
173fn path_covers(outer: &str, inner: &str) -> bool {
174 let outer = outer.trim_end_matches('/');
175 let inner = inner.trim_end_matches('/');
176 if outer == inner {
177 return true;
178 }
179 // After trimming, the root is empty and covers every absolute path.
180 inner
181 .strip_prefix(outer)
182 .is_some_and(|rest| rest.starts_with('/'))
183}
184
185/// The effects of one call, declared by its tool from the arguments.
186#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
187pub struct CallEffects {
188 pub keys: Vec<EffectKey>,
189 /// `keys` lists everything the call does. `false` means the tool could
190 /// not tell (an opaque script), so policies must not read the list as
191 /// exhaustive.
192 pub complete: bool,
193 /// Every part of the call was read and `keys` name what it changes,
194 /// though the tool does not vouch for the list as `complete` (a shell
195 /// command made only of programs it models: a copy into the work area,
196 /// a listing, `date`). After the owner declines a step, such a call that
197 /// deletes nothing and reaches nothing outside is not taken for the
198 /// declined action by another route.
199 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
200 pub understood: bool,
201}
202
203impl CallEffects {
204 /// Effects not declared: the call may do anything.
205 pub fn unknown() -> Self {
206 Self {
207 keys: Vec::new(),
208 complete: false,
209 understood: false,
210 }
211 }
212
213 /// The call has no effects (a read).
214 pub fn none() -> Self {
215 Self {
216 keys: Vec::new(),
217 complete: true,
218 understood: true,
219 }
220 }
221
222 /// The effects a call's declared access implies, for a tool that
223 /// declares [`crate::Tool::access`] but not [`crate::Tool::effects`]:
224 /// every written path ([`EffectKey::path`]) a [`EffectClass::Write`]
225 /// (and a [`EffectClass::Delete`] too for a destructive tool), every
226 /// host contacted an [`EffectClass::Egress`] (`host:port`, the port
227 /// from the declaration, else the scheme's, https for a bare host), every command a
228 /// [`EffectClass::Process`] named by its program. A read-only tool
229 /// changes nothing, so only its hosts count. Never `complete`: the tool
230 /// declared what it touches, not that the list is all it does. A
231 /// relative path names no key (declare absolute paths, as
232 /// `Workspace::declare` gives). [`CallEffects::unknown`] for an empty
233 /// manifest.
234 ///
235 /// With these keys an owner's denial binds the rest of the run: a later
236 /// call that writes the same path, by any tool, is refused.
237 pub fn from_access(
238 access: &crate::AccessManifest,
239 annotations: crate::ToolAnnotations,
240 ) -> Self {
241 let mut keys: Vec<EffectKey> = Vec::new();
242 let mut push = |key: EffectKey| {
243 if !keys.contains(&key) {
244 keys.push(key);
245 }
246 };
247 if !annotations.read_only {
248 for path in &access.writes {
249 if let Some(key) = EffectKey::path(EffectClass::Write, path) {
250 if annotations.destructive {
251 push(EffectKey {
252 class: EffectClass::Delete,
253 target: key.target.clone(),
254 });
255 }
256 push(key);
257 }
258 }
259 for command in &access.commands {
260 if let Some(program) = program_name(command) {
261 push(EffectKey::named(EffectClass::Process, program));
262 }
263 }
264 }
265 for host in &access.hosts {
266 if let Some(key) = host_effect(host) {
267 push(key);
268 }
269 }
270 Self {
271 keys,
272 complete: false,
273 understood: false,
274 }
275 }
276
277 /// The tool vouches that the call changes no file: the list is
278 /// `complete` and names no path. For a call that may change things
279 /// (whose default effects are [`CallEffects::unknown`]), scope and
280 /// approval policies take an empty [`crate::AccessManifest`] as "changes
281 /// no path", not "paths not declared". A delegation, a ticket or an
282 /// order lookup declares this with [`CallEffects::none`] or its own
283 /// non-path keys. Effects never describe reads.
284 pub fn touches_no_paths(&self) -> bool {
285 self.complete && !self.keys.iter().any(|key| key.class.is_path())
286 }
287}
288
289/// The program a declared command runs: its first word, without its
290/// directory.
291fn program_name(command: &str) -> Option<&str> {
292 let first = command.split_whitespace().next()?;
293 let program = first.rsplit('/').next().unwrap_or(first);
294 (!program.is_empty()).then_some(program)
295}
296
297/// The egress effect of a declared host: `host`, `host:port`, or a URL
298/// (`scheme://user@host:port/path`).
299fn host_effect(declared: &str) -> Option<EffectKey> {
300 let declared = declared.trim();
301 let (scheme, rest) = match declared.split_once("://") {
302 Some((scheme, rest)) => (scheme, rest),
303 None => ("https", declared),
304 };
305 let authority = rest.split(['/', '?', '#']).next().unwrap_or(rest);
306 let authority = authority.rsplit('@').next().unwrap_or(authority);
307 let (host, port) = if let Some(bracketed) = authority.strip_prefix('[') {
308 // An IPv6 literal: `[::1]` or `[::1]:8080`.
309 let (host, after) = bracketed.split_once(']')?;
310 (host, after.strip_prefix(':').and_then(|p| p.parse().ok()))
311 } else {
312 match authority.rsplit_once(':') {
313 Some((host, port)) if !port.is_empty() && port.bytes().all(|b| b.is_ascii_digit()) => {
314 (host, port.parse().ok())
315 }
316 _ => (authority, None),
317 }
318 };
319 if host.is_empty() {
320 return None;
321 }
322 Some(EffectKey::egress(scheme, host, port))
323}
324
325/// How much is at stake in an approval request.
326#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
327#[serde(rename_all = "snake_case")]
328#[non_exhaustive]
329pub enum ApprovalRisk {
330 /// A call new to the owner with nothing known to be at stake.
331 Low,
332 Medium,
333 High,
334 Critical,
335}
336
337/// What the owner is asked to approve.
338#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
339pub struct OwnerApprovalRequest {
340 /// The effects the call would have. A denial records them in
341 /// [`crate::RunState::declined`].
342 pub effects: Vec<EffectKey>,
343 /// What the owner sees.
344 pub summary: String,
345 /// The exact action string that stored grants are matched against (for
346 /// example a command line, or `METHOD url`).
347 pub subject: String,
348 pub risk: ApprovalRisk,
349 #[serde(default, skip_serializing_if = "Vec::is_empty")]
350 pub warnings: Vec<String>,
351 /// What the card says, as typed facts each channel renders. Plain
352 /// words only, never authority: grants match `subject`. `None` shows
353 /// `summary` and `warnings` as they are.
354 #[serde(default, skip_serializing_if = "Option::is_none")]
355 pub card: Option<Box<ApprovalCard>>,
356}
357
358impl OwnerApprovalRequest {
359 /// The request to ask the owner about `call`, the way
360 /// `aidaemon_policies::ApprovalPolicy` asks: the call's declared effects
361 /// (from `info`), its tool and arguments as the subject grants match,
362 /// [`ApprovalRisk::Critical`] for a destructive tool and
363 /// [`ApprovalRisk::High`] otherwise, and a card naming the action (a
364 /// command line collapsed under its title, else the tool with its
365 /// arguments collapsed). `why` ends the summary when it is not empty.
366 ///
367 /// A hook asks with it through [`crate::ToolDecision::ask`]:
368 ///
369 /// ```
370 /// use aidaemon_core::{OwnerApprovalRequest, ToolCall, ToolDecision, ToolInfo};
371 ///
372 /// fn decide(call: &ToolCall, info: &ToolInfo) -> ToolDecision {
373 /// ToolDecision::ask(OwnerApprovalRequest::for_call(call, info, "it spends money"))
374 /// }
375 /// ```
376 pub fn for_call(call: &crate::ToolCall, info: &crate::ToolInfo, why: &str) -> Self {
377 Self::for_tool(&call.name, &call.arguments, info, why)
378 }
379
380 /// [`OwnerApprovalRequest::for_call`] from a tool name and arguments
381 /// (`Value::Null` when there are none).
382 pub fn for_tool(
383 tool: &str,
384 arguments: &serde_json::Value,
385 info: &crate::ToolInfo,
386 why: &str,
387 ) -> Self {
388 let subject = if arguments.is_null() {
389 tool.to_string()
390 } else {
391 format!("{tool} {arguments}")
392 };
393 let why = why.trim();
394 Self {
395 card: Some(Box::new(call_card(tool, arguments, info))),
396 effects: info.effects.keys.clone(),
397 summary: if why.is_empty() {
398 format!("Run {subject}")
399 } else {
400 format!("Run {subject}: {why}")
401 },
402 subject,
403 risk: if info.annotations.destructive {
404 ApprovalRisk::Critical
405 } else {
406 ApprovalRisk::High
407 },
408 warnings: Vec::new(),
409 }
410 }
411}
412
413/// The card for a call asked about, from the call's own fields and its
414/// annotations: a command line (with its own title) shown collapsed under a
415/// plain sentence, else the tool's name with its arguments collapsed. Never
416/// the raw JSON as the headline.
417fn call_card(tool: &str, arguments: &serde_json::Value, info: &crate::ToolInfo) -> ApprovalCard {
418 let text = |key: &str| arguments.get(key).and_then(serde_json::Value::as_str);
419 let action = match text("command").or_else(|| text("script")) {
420 Some(line) => CardAction::Command {
421 line: line.to_string(),
422 title: text("description")
423 .map(|title| title.split_whitespace().collect::<Vec<_>>().join(" "))
424 .filter(|title| !title.is_empty()),
425 looks_inside: Vec::new(),
426 },
427 None => CardAction::Use {
428 what: format!("use {}", tool.replace('_', " ")),
429 detail: (!arguments.is_null()).then(|| arguments.to_string()),
430 },
431 };
432 ApprovalCard {
433 impact: info.annotations.destructive.then(|| HighImpact::Deletes {
434 targets: Vec::new(),
435 }),
436 ..ApprovalCard::new(action)
437 }
438}
439
440/// An approval card's content as facts, so every channel says the same
441/// thing in its own formatting: who asks, what will happen, why the owner
442/// is asked, and the one high-impact effect worth a warning.
443#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
444pub struct ApprovalCard {
445 /// The helper asking ("Drupal install"); `None` for the assistant
446 /// itself.
447 #[serde(default, skip_serializing_if = "Option::is_none")]
448 pub asked_by: Option<String>,
449 pub action: CardAction,
450 #[serde(default, skip_serializing_if = "Option::is_none")]
451 pub reason: Option<AskReason>,
452 /// The effect that earns a warning. `None` for ordinary work, which
453 /// gets no warning however the request's risk is rated.
454 #[serde(default, skip_serializing_if = "Option::is_none")]
455 pub impact: Option<HighImpact>,
456}
457
458impl ApprovalCard {
459 pub fn new(action: CardAction) -> Self {
460 Self {
461 asked_by: None,
462 action,
463 reason: None,
464 impact: None,
465 }
466 }
467}
468
469/// What allowing the call does.
470#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
471#[serde(rename_all = "snake_case", tag = "kind")]
472#[non_exhaustive]
473pub enum CardAction {
474 /// Run a command on the owner's computer.
475 Command {
476 /// The exact line that runs (secrets hidden); shown collapsed,
477 /// never as the headline.
478 line: String,
479 /// The few plain words the call gave for itself (`description`).
480 #[serde(default, skip_serializing_if = "Option::is_none")]
481 title: Option<String>,
482 /// The folders a read-only command only looks inside, by name.
483 #[serde(default, skip_serializing_if = "Vec::is_empty")]
484 looks_inside: Vec<String>,
485 },
486 /// Let the browser open a site on this computer.
487 OpenLocalSite {
488 site: String,
489 /// How long a one-time allowance lasts.
490 once_minutes: u64,
491 },
492 /// Click a button on a web site in the browser (one whose effect the
493 /// page's script decides). Allow Once covers only this click; allowing
494 /// it for the session covers buttons on `site` (an origin) until the
495 /// browser session ends. Forms, passwords and payment fields still ask
496 /// every time.
497 ClickOnSite {
498 site: String,
499 /// The selector the click targets, shown collapsed.
500 #[serde(default, skip_serializing_if = "Option::is_none")]
501 target: Option<String>,
502 },
503 /// Use a tool; `what` completes "wants to …".
504 Use {
505 what: String,
506 /// The call's arguments as they would run, shown collapsed.
507 #[serde(default, skip_serializing_if = "Option::is_none")]
508 detail: Option<String>,
509 },
510 /// The agent asks the owner to do something themselves on a live
511 /// surface (sign in, enter a code), then press Done. `what` is the
512 /// agent's few words; `site` the host only.
513 TakeOver {
514 surface_id: String,
515 what: String,
516 #[serde(default, skip_serializing_if = "Option::is_none")]
517 site: Option<String>,
518 /// Whether a sign-in made there is kept for later tasks.
519 #[serde(default, skip_serializing_if = "Option::is_none")]
520 keeps_sign_in: Option<bool>,
521 /// Where the owner's app opens the live view, when the daemon has an
522 /// address a phone can reach. The id in it grants nothing alone.
523 #[serde(default, skip_serializing_if = "Option::is_none")]
524 open_url: Option<String>,
525 },
526}
527
528/// Why the owner is asked.
529#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
530#[serde(rename_all = "snake_case", tag = "kind")]
531#[non_exhaustive]
532pub enum AskReason {
533 /// The work read content from outside, and the clean check could not
534 /// confirm this step fits the request.
535 ReadOutsideContent {
536 /// The check's one sentence, addressed to the owner.
537 #[serde(default, skip_serializing_if = "Option::is_none")]
538 check_says: Option<String>,
539 },
540 /// The owner said no to a step earlier in this run, and what this call
541 /// does cannot be fully told, so it is not run unasked.
542 AfterADecline {
543 /// What the owner said no to, in a few plain words (the declined
544 /// step's own title, or what it would have changed).
545 #[serde(default, skip_serializing_if = "Option::is_none")]
546 declined: Option<String>,
547 },
548}
549
550/// An effect that deserves a warning on the card.
551#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
552#[serde(rename_all = "snake_case", tag = "kind")]
553#[non_exhaustive]
554pub enum HighImpact {
555 /// Deletes files: the targets when they can be read.
556 Deletes {
557 #[serde(default, skip_serializing_if = "Vec::is_empty")]
558 targets: Vec<String>,
559 },
560 /// Sends or posts something to another service.
561 Sends,
562 /// Spends money.
563 Spends,
564 /// Writes outside the work area.
565 WritesOutsideWorkArea,
566}
567
568/// Who an interruption is waiting for.
569#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
570#[serde(rename_all = "snake_case")]
571#[non_exhaustive]
572pub enum InterruptKind {
573 /// A check of a call made after the run read untrusted content (and,
574 /// for interruptions saved before kinds existed, any interruption).
575 #[default]
576 Untrusted,
577 /// The owner must approve the call.
578 OwnerApproval(OwnerApprovalRequest),
579}
580
581/// Owner declines shared by a family of runs: a run and the child runs it
582/// starts (and their children). A decline recorded in any of them reaches
583/// every other one before its next call, so a parent is refused an effect
584/// the owner declined inside its child, and a running child is refused one
585/// the owner declined in its parent after the child started.
586///
587/// Attach it with [`crate::RunState::share_declines`]. The kernel exchanges
588/// it with the run's own [`crate::RunState::declined`] when a turn starts,
589/// before each call is judged, when the owner declines, and when the run
590/// ends; the run's own list stays the serialized source of truth (so a
591/// parent whose child was declined something never ends `Succeeded`). The
592/// handle itself is not serialized: a run resumed from saved state keeps
593/// its own declines and shares them again once the application reattaches
594/// a set.
595///
596/// It only grows. Clones share one set.
597#[derive(Clone, Default)]
598pub struct SharedDeclines(std::sync::Arc<std::sync::Mutex<Vec<EffectKey>>>);
599
600impl SharedDeclines {
601 pub fn new() -> Self {
602 Self::default()
603 }
604
605 fn lock(&self) -> std::sync::MutexGuard<'_, Vec<EffectKey>> {
606 self.0.lock().unwrap_or_else(|e| e.into_inner())
607 }
608
609 /// Add effects (duplicates are ignored).
610 pub fn record(&self, effects: &[EffectKey]) {
611 let mut shared = self.lock();
612 for effect in effects {
613 if !shared.contains(effect) {
614 shared.push(effect.clone());
615 }
616 }
617 }
618
619 /// Every effect declined so far, in the order first recorded.
620 pub fn snapshot(&self) -> Vec<EffectKey> {
621 self.lock().clone()
622 }
623
624 /// Publish `local`'s effects and take in the others'. Returns whether
625 /// `local` grew.
626 pub(crate) fn exchange(&self, local: &mut Vec<EffectKey>) -> bool {
627 let mut shared = self.lock();
628 for effect in local.iter() {
629 if !shared.contains(effect) {
630 shared.push(effect.clone());
631 }
632 }
633 let before = local.len();
634 for effect in shared.iter() {
635 if !local.contains(effect) {
636 local.push(effect.clone());
637 }
638 }
639 local.len() > before
640 }
641
642 /// Both handles share one set.
643 pub fn same_set(&self, other: &SharedDeclines) -> bool {
644 std::sync::Arc::ptr_eq(&self.0, &other.0)
645 }
646}
647
648/// Two handles are equal when they share one set.
649impl PartialEq for SharedDeclines {
650 fn eq(&self, other: &Self) -> bool {
651 self.same_set(other)
652 }
653}
654
655impl std::fmt::Debug for SharedDeclines {
656 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
657 f.debug_tuple("SharedDeclines")
658 .field(&self.snapshot())
659 .finish()
660 }
661}