NAME

Claude::Agent::Types - Slot types and constructor helpers for Claude::Agent classes

SYNOPSIS

use Claude::Agent::Types;

BEGIN {
    Object::Proto::define('My::Class',
        'tools:StrList:predicate',
        'mode:PermissionMode:predicate',
    );
}

my $obj = My::Class->new(Claude::Agent::Types::known_args('My::Class', $decoded));

DESCRIPTION

Every class in this distribution is an Object::Proto class. This module registers the slot types those classes share and provides the helpers their factories use. Load it before the BEGIN block that defines a class using one of the types; a type name that is not registered is silently ignored.

TYPES

  • StrList - an array reference of defined, non-reference strings

  • StrOrHashRef - a string or a hash reference

  • StrOrArrayRef - a string or an array reference

  • PermissionMode - one of @Claude::Agent::Types::PERMISSION_MODES: default, acceptEdits, bypassPermissions, dontAsk, plan, auto, manual

  • Effort - one of @Claude::Agent::Types::EFFORT_LEVELS: low, medium, high, xhigh, max

FUNCTIONS

known_args

my %args = Claude::Agent::Types::known_args($class, \%hash);

Returns the name/value pairs of %hash whose names are slots of $class and whose values are defined. Factories that build objects from decoded JSON call this first: an Object::Proto class with no default slot reads a pair list positionally when its first name is unknown, and typed slots reject undef, so JSON null and unexpected keys are dropped here rather than reaching new.

check_args

my %args = Claude::Agent::Types::check_args($class, %args);

Returns %args unchanged, or croaks naming every key that is not a slot of $class. Claude::Agent::Options->create uses it to make a misspelt option fatal; new itself ignores unknown keys.

defined_args

my %args = Claude::Agent::Types::defined_args(%args);

Returns the pairs of %args whose values are defined, so a caller can pass optional values straight through to a constructor whose slots are typed.

AUTHOR

LNATION, <email at lnation.org>

LICENSE

This software is Copyright (c) 2026 by LNATION.

This is free software, licensed under The Artistic License 2.0 (GPL Compatible).