Collect the report from explicit sources: `probes` are the agent adapters, `packaged` the agents with an integration package.
(
sources: &Sources,
probes: &[AgentProbe],
packaged: &[String],
)
| 530 | /// Collect the report from explicit sources: `probes` are the agent |
| 531 | /// adapters, `packaged` the agents with an integration package. |
| 532 | pub(crate) fn collect_from( |
| 533 | sources: &Sources, |
| 534 | probes: &[AgentProbe], |
| 535 | packaged: &[String], |
| 536 | ) -> Report { |
| 537 | let home = sources.home.as_deref(); |
| 538 | let display_name = |agent: &str| { |
| 539 | probes |
| 540 | .iter() |
| 541 | .find(|probe| probe.name == agent) |
| 542 | .map_or_else(|| agent.to_string(), |probe| probe.display_name.clone()) |
| 543 | }; |
| 544 | |
| 545 | // Receipts, for every packaged agent plus any receipt on disk for an |
| 546 | // agent this binary no longer lists — that is exactly the |
| 547 | // version-skew case a support conversation needs to see. |
| 548 | let mut agents_with_packages: Vec<String> = packaged |
| 549 | .iter() |
| 550 | .filter(|name| *name != SKILLS_PACKAGE) |
| 551 | .cloned() |
| 552 | .collect(); |
| 553 | if let Ok(root) = &sources.integrations_root { |
| 554 | for name in receipts_on_disk(root) { |
| 555 | if name != SKILLS_PACKAGE && !agents_with_packages.contains(&name) { |
| 556 | agents_with_packages.push(name); |
| 557 | } |
| 558 | } |
| 559 | } |
| 560 | agents_with_packages.sort(); |
| 561 | let receipts: Vec<(String, ReceiptLookup)> = agents_with_packages |
| 562 | .into_iter() |
| 563 | .map(|agent| { |
| 564 | let lookup = match &sources.integrations_root { |
| 565 | Ok(root) => read_receipt(&root.join(&agent).join(RECEIPT_FILE)), |
| 566 | Err(_) => ReceiptLookup::Unreadable(ReceiptError::IntegrationsHome), |
| 567 | }; |
| 568 | (agent, lookup) |
| 569 | }) |
| 570 | .collect(); |
| 571 | let receipt_for = |agent: &str| { |
| 572 | receipts |
| 573 | .iter() |
| 574 | .find(|(name, _)| name == agent) |
| 575 | .map(|(_, lookup)| lookup) |
| 576 | }; |
| 577 | |
| 578 | let package = match &sources.integrations_root { |
| 579 | Ok(root) => read_skills_package(&root.join(SKILLS_PACKAGE).join("repo")), |
| 580 | Err(reason) => SkillsPackage::Unreadable { |
| 581 | reason: format!("integrations directory unresolved: {reason}"), |
| 582 | }, |
| 583 | }; |
| 584 | let declared = match &package { |
| 585 | SkillsPackage::Available { skills, .. } => Some(skills.as_slice()), |
| 586 | _ => None, |
| 587 | }; |
| 588 | |
| 589 | let hook_activity = match &sources.workspace { |