struct PreparedFacts {
operation: dict
goal: string
}
fn destructured_facts(value: dict) -> PreparedFacts {
const {operation, ...rest} = value
const [goal] = [rest.goal]
return PreparedFacts {operation: operation, goal: goal}
}
fn main(harness: Harness) {
return tool_define(tool_registry(), "verify", "Verify the active task", {
input_schema: {type: "object", properties: {reason: {type: "string"}}, additionalProperties: false},
returns: {type: "object"},
prepare: { args -> return {{preparation}} },
handler: { args ->
const binding = tool_invocation_binding()
const operation = binding.operation
const result = harness.process.run({program: "sh", args: ["-c", operation.command], cwd: operation.cwd})
if !result.success { throw {category: "timeout", message: "transient verifier failure"} }
return {schema: "harn.agent_tool_handler_result.v2", outcome: "ok", text: result.stdout,
data: {command: operation.command, cwd: operation.cwd, success: result.success}}
},
})
}