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

Method verify_commands

core/src/agent_api/session_verification.rs:52–90  ·  view source on GitHub ↗
(
        &self,
        subject: &str,
        commands: &[VerificationCommand],
    )

Source from the content-addressed store, hash-verified

50 }
51
52 pub(super) async fn verify_commands(
53 &self,
54 subject: &str,
55 commands: &[VerificationCommand],
56 ) -> Result<VerificationReport> {
57 let mut checks = Vec::with_capacity(commands.len());
58
59 for command in commands {
60 let mut args = serde_json::json!({ "command": command.command });
61 if let Some(timeout_ms) = command.timeout_ms {
62 args["timeout"] = serde_json::json!(timeout_ms);
63 }
64
65 let check = match self
66 .tool_executor
67 .execute_with_context("bash", &args, &self.tool_context)
68 .await
69 {
70 Ok(result) => {
71 let exit_code = result
72 .metadata
73 .as_ref()
74 .and_then(|metadata| metadata.get("exit_code"))
75 .and_then(|value| value.as_i64())
76 .and_then(|value| i32::try_from(value).ok())
77 .unwrap_or(result.exit_code);
78 command.check_from_execution(exit_code, result.metadata.as_ref(), None)
79 }
80 Err(err) => command.check_from_execution(1, None, Some(&err.to_string())),
81 };
82 checks.push(check);
83 }
84
85 let report = VerificationReport::new(subject, checks);
86 self.record([report.clone()]);
87 self.persistence.auto_save_if_enabled().await;
88
89 Ok(report)
90 }
91
92 pub(super) fn presets(&self) -> Vec<VerificationPreset> {
93 verification_presets_for_workspace(&self.workspace)

Calls 7

check_from_executionMethod · 0.80
auto_save_if_enabledMethod · 0.80
lenMethod · 0.45
execute_with_contextMethod · 0.45
getMethod · 0.45
recordMethod · 0.45
cloneMethod · 0.45