| 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
Condition66%2/3
$$args{"raider"} and not $$args{"host"}
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"}
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||