blib/lib/Langertha/Plugin.pm

filter: Statementstmt 72.5% 37 / 51 Branchbran 50.0% 2 / 4 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 64.2% 9 / 14 Podpod 100% 11 / 11 totaltotal 72.9% 62 / 85 CC 4 SCAR 7.8
CC
4
Cov
71%
raider
6.0
__ANON__
3.0
plugin_before_raid
2.0
CRAP 2.2
« blib/lib/Langertha/Engine/Anthropic.pm ↑ Summary blib/lib/Langertha/Engine/MoonshotAnthropic.pm »
1 package Langertha::Plugin;
2 # ABSTRACT: Base class for plugins
3 19 our $VERSION = '0.505';
4 19 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 19 ▶use Future::AsyncAwait;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7  
8 19 has host => (
9 is => 'ro',
10 weak_ref => 1,
11 required => 1,
12 );
13  
14  
15 120 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
16 120 my ( $orig, $class, @args ) = @_;
17 # Let Moose normalize first: new() also takes one HashRef.
18 120 my $args = $class->$orig(@args);
19 120 ▶ if ($args->{raider} && !$args->{host}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$args{"raider"} and not $$args{"host"}) 2 118 120
Condition66%2/3
$$args{"raider"} and not $$args{"host"}
!ll&&!rl&&r
11802
MC/DC50%1/2
$$args{"raider"} and not $$args{"host"}
$$args{"raider"} not $$args{"host"}
Truth table66%2/3
A and not(B)
A= $$args{"raider"}B= not $$args{"host"}
ABresult
0X0
100
111
20 2 $args->{host} = delete $args->{raider};
21 }
22 120 return $args;
23 19 };
24  
25 0 ▶sub raider {
Subroutine raider: not called CC=2 SCAR=17.9
Pod documented
26 0 my ( $self ) = @_;
27 0 my $host = $self->host;
28 0 ▶ return $host if $host->isa('Langertha::Raider');
Branch: 1 branch
BranchTrueFalseTotal
if $host->isa("Langertha::Raider") 0 0 0
29 0 return undef;
30 }
31  
32  
33 # --- Hook methods (identity/passthrough defaults) ---
34  
35 0 ▶async sub plugin_before_raid {
Subroutine plugin_before_raid: not called CC=1 SCAR=6.9
Pod documented
36 0 my ( $self, $messages ) = @_;
37 0 return $messages;
38 19 }
39  
40 0 ▶async sub plugin_build_conversation {
Subroutine plugin_build_conversation: not called CC=1 SCAR=6.9
Pod documented
41 0 my ( $self, $conversation ) = @_;
42 0 return $conversation;
43 19 }
44  
45 22 ▶async sub plugin_before_llm_call {
Subroutine plugin_before_llm_call: called CC=1 SCAR=0.0
Pod documented
46 22 my ( $self, $conversation, $iteration ) = @_;
47 22 return $conversation;
48 19 }
49  
50 15 ▶async sub plugin_after_llm_response {
Subroutine plugin_after_llm_response: called CC=1 SCAR=0.0
Pod documented
51 15 my ( $self, $data, $iteration ) = @_;
52 15 return $data;
53 19 }
54  
55 19 ▶async sub plugin_before_tool_call {
Subroutine plugin_before_tool_call: called CC=1 SCAR=0.0
Pod documented
56 19 my ( $self, $name, $input ) = @_;
57 19 return ($name, $input);
58 19 }
59  
60 21 ▶async sub plugin_after_tool_call {
Subroutine plugin_after_tool_call: called CC=1 SCAR=0.0
Pod documented
61 21 my ( $self, $name, $input, $result ) = @_;
62 21 return $result;
63 19 }
64  
65 0 ▶async sub plugin_after_raid {
Subroutine plugin_after_raid: not called CC=1 SCAR=6.9
Pod documented
66 0 my ( $self, $result ) = @_;
67 0 return $result;
68 19 }
69  
70  
71 0 ▶sub self_tools { [] }
Subroutine self_tools: not called CC=1 SCAR=6.9
Pod documented
72  
73  
74 100 ▶sub provides_events { [] }
Subroutine provides_events: called CC=1 SCAR=0.0
Pod documented
75  
76  
77 100 ▶sub requires_events { [] }
Subroutine requires_events: called CC=1 SCAR=0.0
Pod documented
78  
79 19 __PACKAGE__->meta->make_immutable;
80  
81 19 1;
82  
83 __END__
« blib/lib/Langertha/Engine/Anthropic.pm ↑ Summary blib/lib/Langertha/Engine/MoonshotAnthropic.pm »