MCPcopy Index your code
hub / github.com/AI45Lab/Code / program_verification_hints

Function program_verification_hints

core/src/program.rs:584–647  ·  view source on GitHub ↗
(
    result: &ProgramResult,
    trace: Option<&ProgramTrace>,
)

Source from the content-addressed store, hash-verified

582}
583
584pub fn program_verification_hints(
585 result: &ProgramResult,
586 trace: Option<&ProgramTrace>,
587) -> Vec<ProgramVerificationHint> {
588 let mut hints = match result.program_name.as_str() {
589 "program_code_search" => vec![ProgramVerificationHint::new(
590 "inspect_matches",
591 "Review matched files before editing or drawing conclusions.",
592 )
593 .required()
594 .with_suggested_tools(["read", "grep"])],
595 "program_repo_map" => vec![ProgramVerificationHint::new(
596 "inspect_project_files",
597 "Use detected project files to choose build, test, and lint commands.",
598 )
599 .required()
600 .with_suggested_tools(["read", "glob"])],
601 _ => Vec::new(),
602 };
603
604 if !result.success {
605 let failed_steps = result
606 .steps
607 .iter()
608 .filter(|step| !step.success)
609 .map(|step| step.label.as_deref().unwrap_or(&step.tool_name))
610 .collect::<Vec<_>>();
611 let message = if failed_steps.is_empty() {
612 "Investigate the failed program execution before relying on its result.".to_string()
613 } else {
614 format!(
615 "Investigate failed program step(s): {}.",
616 failed_steps.join(", ")
617 )
618 };
619 hints.push(
620 ProgramVerificationHint::new("investigate_failed_steps", message)
621 .required()
622 .with_suggested_tools(["read", "grep"]),
623 );
624 }
625
626 if let Some(trace) = trace {
627 let evidence_uris = trace
628 .steps
629 .iter()
630 .filter_map(|step| step.artifact.as_ref())
631 .map(|artifact| artifact.artifact_uri.clone())
632 .collect::<Vec<_>>();
633
634 if !evidence_uris.is_empty() {
635 hints.push(
636 ProgramVerificationHint::new(
637 "inspect_artifacts",
638 "Inspect compacted program artifacts before treating summarized output as complete evidence.",
639 )
640 .required()
641 .with_evidence_uris(evidence_uris),

Calls 6

as_strMethod · 0.45
is_emptyMethod · 0.45
with_suggested_toolsMethod · 0.45
requiredMethod · 0.45
cloneMethod · 0.45
with_evidence_urisMethod · 0.45