Branch Coverage

blib/lib/SignalWire/Agents/Agent/AgentBase.pm
Criterion Covered Total %
branch 137 176 77.8


line true false branch
121 21 342 if $r ne "/"
151 108 51 if $opts{'bullets'}
159 6 0 if ($sec->{'title'} eq $parent_title)
162 2 4 if $opts{'bullets'}
173 5 0 if ($sec->{'title'} eq $title)
174 1 4 if ($opts{'body'})
177 4 1 if ($opts{'bullets'})
190 28 37 if $sec->{'title'} eq $title
197 24 51 if ($self->use_pom and @{$self->pom_sections;})
212 150 12 defined $handler ? :
221 614 2 if $k =~ /^(name|description|parameters|handler)$/
228 161 1 unless grep {$_ eq $name;} @{$self->tool_order;}
238 22 0 unless grep {$_ eq $name;} @{$self->tool_order;}
245 4 0 if (ref $t eq "HASH")
246 2 2 if (exists $t->{'function'}) { }
259 3 21 unless $tool and $tool->{'_handler'}
345 1 1 unless (defined $self->internal_fillers)
517 1 69 if defined $self->webhook_url
520 58 11 $self->route eq '/' ? :
524 1 68 if (%{$self->swaig_query_params;})
537 0 70 if defined $self->post_prompt_url
539 59 11 $self->route eq '/' ? :
546 0 142 if defined $self->proxy_url_base
553 1 141 if ($proto and $fhost)
559 1 140 if $orig
563 0 140 if $scheme eq "on"
571 0 4 $self->route eq '/' ? :
573 2 2 if ($opts{'include_auth'})
593 70 0 unless $webhook_url =~ /\@/
595 70 0 unless $post_prompt_url =~ /\@/
604 69 1 if ($self->auto_answer)
606 1 68 if %{$self->answer_config;}
611 4 66 if ($self->record_call)
612 3 1 $self->record_stereo ? :
643 22 48 if (ref $prompt eq 'ARRAY') { }
647 6 42 if $prompt
651 3 67 if (%{$self->prompt_llm_params;})
659 4 66 if ($self->post_prompt and $self->post_prompt ne "")
661 1 3 if (%{$self->post_prompt_llm_params;})
668 70 0 if $post_prompt_url
671 3 67 if %{$self->params;}
676 6 64 if @all_hints
679 1 69 if @{$self->languages;}
682 1 69 if @{$self->pronunciations;}
691 0 20 unless $tool
697 17 53 if @functions
701 2 68 if @{$self->native_functions;}
705 2 68 if @{$self->function_includes;}
707 21 49 if %$swaig
711 10 60 if %{$self->global_data;}
714 2 68 if (defined $self->internal_fillers)
720 2 68 if ($self->debug_events_level > 0)
726 1 69 if ($self->context_builder and $self->context_builder->has_contexts)
745 13 9 if $route eq "/"
756 10 10 unless $path eq "/"
759 4 16 if ($path eq "/health")
763 2 14 if ($path eq "/ready")
769 11 3 $route eq '' ? :
775 10 4 if ($route eq "" and $path eq "/")
779 1 0 if ($is_main or $is_swaig or $is_post_prompt)
781 6 8 unless ($auth_ok)
789 7 1 if ($is_main and $req->method eq 'GET' || $req->method eq 'POST') { }
1 0 elsif ($is_swaig and $req->method eq 'POST') { }
0 0 elsif ($is_post_prompt and $req->method eq 'POST') { }
810 1 19 if ($env->{'REQUEST_METHOD'} eq "POST" or $env->{'REQUEST_METHOD'} eq "PUT")
812 1 0 if ($input)
818 0 1 if ($total > $max_body_size)
835 20 0 if (ref $res eq "ARRAY")
850 3 11 unless $auth_header =~ /^Basic\s+(.+)$/i
853 1 10 unless defined $user and defined $pass
862 8 2 $user_ok && $pass_ok ? :
880 1 6 if ($self->dynamic_config_callback)
884 0 1 if ($req->method eq "POST" and $req->content_length)
889 1 9 if ($k =~ /^HTTP_(.+)/)
906 0 1 unless ($body and ref $body eq "HASH")
912 0 1 unless ($func_name and exists $self->tools->{$func_name})
919 1 0 if ($body->{'argument'} and ref $body->{'argument'}{'parsed'} eq "ARRAY" and @{$body->{'argument'}{'parsed'};})
925 0 1 unless (defined $result)
932 0 1 if (builtin::blessed($result) and $result->can('to_hash')) { }
1 0 elsif (ref $result eq 'HASH') { }
949 0 0 if ($self->summary_callback)
951 0 0 if ($body->{'post_prompt_data'})
996 0 3 defined $self->internal_fillers ? :
1033 65 0 if (open my $fh, "<:raw", "/dev/urandom")
1036 65 0 if (defined $read and $read == 32)
1049 0 0 unless ref $body eq "HASH"
1057 0 0 if ($from =~ /^sip:([^\@]+)\@/i)
1062 0 0 if (my $cid = $body->{'call'}{'caller_id_number'} // $body->{'caller_id_number'})