Agent/Engine.pm

filter: Statementstmt 48.1% 13 / 27 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 66.6% 4 / 6 Podpod 0.0% 0 / 2 totaltotal 35.4% 17 / 48 CC 9 SCAR 31.8
CC
9
Cov
33%
dependencies_satisfied
42.0
is_enqueued_or_active
20.0
BEGIN
1.0
CRAP 24.0
« Agent/LLM/Ollama.pm ↑ Summary Agent/Compiler.pm »
1 package Sim::Agent::Engine;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 package Sim::Agent::Engine;
7  
8 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 sub dependencies_satisfied
12 0 ▶{
Subroutine dependencies_satisfied: not called CC=6 SCAR=37.4
Pod undocumented
13 0 my ($agent, $state) = @_;
14  
15 0 ▶ return 1 unless @{ $agent->{wait_for} || [] };
Branch: 1 branch
BranchTrueFalseTotal
unless @{$agent->{"wait_for"} or [];} 0 0 0
Condition0%0/2
$agent->{'wait_for'} || []
l!l
00
MC/DC0%0/1
$agent->{'wait_for'} || []
$agent->{'wait_for'}
Truth table0%0/2
A
A= $agent->{'wait_for'}
Aresult
11
00
16  
17 0 for my $dep (@{ $agent->{wait_for} })
18 {
19 0 ▶ return 0 unless exists $state->{completed}->{$dep};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $state->{"completed"}{$dep} 0 0 0
20 0 ▶ return 0 unless $state->{completed}->{$dep}->{status} eq 'ok';
Branch: 1 branch
BranchTrueFalseTotal
unless $state->{"completed"}{$dep}{"status"} eq "ok" 0 0 0
21 }
22  
23 0 return 1;
24 }
25  
26 sub is_enqueued_or_active
27 0 ▶{
Subroutine is_enqueued_or_active: not called CC=4 SCAR=30.0
Pod undocumented
28 0 my ($state, $agent) = @_;
29  
30 0 ▶ return 1 if $state->{active}->{$agent};
Branch: 1 branch
BranchTrueFalseTotal
if $state->{"active"}{$agent} 0 0 0
31  
32 0 for my $queued (@{ $state->{queue} })
33 {
34 0 ▶ return 1 if $queued eq $agent;
Branch: 1 branch
BranchTrueFalseTotal
if $queued eq $agent 0 0 0
35 }
36  
37 0 return 0;
38 }
39  
40  
41 1 1;
42  
43 =pod
44  
45 =head1 NAME
46  
47 Sim::Agent::Engine - Small pure helper routines used by the runner
48  
49 =head1 DESCRIPTION
50  
51 Internal helpers used by the runner (e.g. dependency checks, queue guards). Intentionally minimal and side-effect free.
52  
53 See L<Sim::Agent>.
54  
55 =head1 AUTHOR
56  
57 Gian Luca Brunetti (2026), gianluca.brunetti@gmail.com
58  
59 =head1 LICENSE
60  
61 The GNU General Public License v3.0
62  
63 =cut
64  
« Agent/LLM/Ollama.pm ↑ Summary Agent/Compiler.pm »