Jido.AI.Skill.ResourcePolicy (Jido AI v2.4.0)

Copy Markdown View Source

Defines limits for skill resource listing and loading.

A policy bounds file count, directory traversal, the encoded general-resource list, file size, and text returned to model context. Binary content is rejected by default. Set binary: :allow to permit image and file attachments through the generic resource loader. Text-only APIs always reject binary data.

Summary

Functions

Returns the default resource policy.

Builds and validates a resource policy.

Converts a policy to a plain map.

Types

t()

@type t() :: %Jido.AI.Skill.ResourcePolicy{
  binary: :reject | :allow,
  max_depth: non_neg_integer(),
  max_directories: pos_integer(),
  max_file_bytes: pos_integer(),
  max_listing_bytes: pos_integer(),
  max_resources: pos_integer(),
  max_text_bytes: pos_integer()
}

Functions

default()

@spec default() :: t()

Returns the default resource policy.

new(policy)

@spec new(t() | keyword() | map()) :: {:ok, t()} | {:error, term()}

Builds and validates a resource policy.

The input can be a policy, a keyword list, or a map with atom keys.

to_map(policy)

@spec to_map(t()) :: map()

Converts a policy to a plain map.