Skip to main content

Crate tea_tools

Crate tea_tools 

Source
Expand description

Portable tool specifications and execution contracts for tea-rs.

§Example

use std::str::FromStr;

use tea_protocol::ToolIdempotency;
use tea_tools::{
    SchedulerClass, ToolConcurrency, ToolEffect, ToolExecutionSemantics,
    ToolName, ToolRetrySafety, ToolSpec, ToolTimeout, ToolVersion,
};
use serde_json::json;

let tool = ToolSpec::new(
    ToolName::from_str("read_file")?,
    ToolVersion::from_str("1.0.0")?,
    "Reads one workspace file.",
    json!({"type":"object","properties":{"path":{"type":"string"}},"required":["path"]}),
    json!({"type":"object","properties":{"content":{"type":"string"}},"required":["content"]}),
    [ToolEffect::FsRead],
    ToolExecutionSemantics::new(
        ToolIdempotency::Idempotent,
        ToolRetrySafety::Automatic,
        ToolConcurrency::Parallel,
        ToolTimeout::from_millis(5_000)?,
    )?,
)?;
assert_eq!(tool.scheduler_class(), SchedulerClass::ParallelReadOnly);

Structs§

ArgumentResourceResolver
Resolver reading one string argument as a resource locator.
CompiledToolSchema
Offline compiled Draft 2020-12 tool schema.
SchemaValidationError
Normalized bounded schema validation error.
StaticResourceResolver
Resolver returning one deterministic static resource set.
ToolAuditMetadata
Bounded tool provenance and declared-capability metadata for durable audit.
ToolAuditResource
Already-redacted resource presentation safe for durable audit metadata.
ToolEffectParseError
Error returned when parsing a tool effect.
ToolExecutionFailure
Bounded machine-readable tool execution failure.
ToolExecutionSemantics
Recovery, retry, concurrency, and timeout semantics for a tool.
ToolInvocation
Untrusted complete tool invocation before registry validation.
ToolName
Stable canonical tool name used for registry lookup.
ToolProgress
Non-durable tool execution progress.
ToolRegistry
Deterministic active tool registry.
ToolResource
Canonical resource affected by a tool invocation.
ToolResult
Successful terminal tool result.
ToolSource
Stable, bounded provenance for one frozen tool descriptor.
ToolSpec
Portable specification separated from tool executor behavior.
ToolStreamValidator
Deterministic tool stream grammar validator.
ToolTimeout
Bounded tool timeout metadata consumed by a future kernel.
ToolVersion
Semantic version of one tool contract.
ValidatedToolInvocation
Invocation proven valid against a registered tool schema and resource resolver.

Enums§

SchedulerClass
Conservative scheduler lane derived only from declared tool metadata.
SchemaCompilationError
Error compiling a tool schema.
SchemaValidationFailure
Failure validating one tool argument or output value.
ToolAuditMetadataError
Error returned when validating or encoding tool audit metadata.
ToolBinding
Complete executable binding associated with one portable ToolSpec.
ToolConcurrency
Declared concurrency constraint for one tool.
ToolEffect
Declared capability or external effect of a tool invocation.
ToolExecutionEvent
One normalized tool execution stream event.
ToolExecutionFailureCode
Stable tool execution failure code.
ToolIdentityParseError
Error returned when parsing tool identity values.
ToolInvocationError
Error constructing an untrusted invocation.
ToolRegistryError
Registry validation, conflict, or resource failure.
ToolResourceAccess
Access requested for a resolved resource.
ToolResourceError
Resource construction or resolution failure.
ToolResultError
Error constructing tool results/failures.
ToolRetrySafety
Whether and by whom a failed or interrupted invocation may be retried.
ToolRoutePreference
Preferred route for a hybrid tool with hosted and client implementations.
ToolSourceError
Error returned when validating tool-source provenance.
ToolSourceKind
Provider-neutral origin category for a registered tool.
ToolSpecError
Error returned when constructing tool specifications.
ToolStreamViolation
Tool execution stream grammar violation.
ToolTrust
Host-assigned trust class for a tool source.

Constants§

MAX_SCHEMA_ERRORS
Maximum normalized validation errors returned for one value.
MAX_TOOL_RESOURCES
Maximum resolved resources for one invocation.
MAX_TOOL_VALUE_BYTES
Maximum encoded JSON bytes in one tool schema or validated value.
MAX_TOOL_VALUE_DEPTH
Maximum JSON nesting depth in one tool schema or validated value.
TOOL_AUDIT_METADATA_NAMESPACE
Metadata namespace used on durable tool-call request envelopes.

Traits§

ToolExecutionStream
Provider-neutral asynchronous tool event stream.
ToolExecutor
Object-safe executor receiving only registry-validated invocations.
ToolResourceResolver
Pure resource resolver used before policy and execution.

Type Aliases§

BoxToolExecutionStream
Object-safe boxed tool execution stream.