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§
- Argument
Resource Resolver - Resolver reading one string argument as a resource locator.
- Compiled
Tool Schema - Offline compiled Draft 2020-12 tool schema.
- Schema
Validation Error - Normalized bounded schema validation error.
- Static
Resource Resolver - Resolver returning one deterministic static resource set.
- Tool
Audit Metadata - Bounded tool provenance and declared-capability metadata for durable audit.
- Tool
Audit Resource - Already-redacted resource presentation safe for durable audit metadata.
- Tool
Effect Parse Error - Error returned when parsing a tool effect.
- Tool
Execution Failure - Bounded machine-readable tool execution failure.
- Tool
Execution Semantics - Recovery, retry, concurrency, and timeout semantics for a tool.
- Tool
Invocation - Untrusted complete tool invocation before registry validation.
- Tool
Name - Stable canonical tool name used for registry lookup.
- Tool
Progress - Non-durable tool execution progress.
- Tool
Registry - Deterministic active tool registry.
- Tool
Resource - Canonical resource affected by a tool invocation.
- Tool
Result - Successful terminal tool result.
- Tool
Source - Stable, bounded provenance for one frozen tool descriptor.
- Tool
Spec - Portable specification separated from tool executor behavior.
- Tool
Stream Validator - Deterministic tool stream grammar validator.
- Tool
Timeout - Bounded tool timeout metadata consumed by a future kernel.
- Tool
Version - Semantic version of one tool contract.
- Validated
Tool Invocation - Invocation proven valid against a registered tool schema and resource resolver.
Enums§
- Scheduler
Class - Conservative scheduler lane derived only from declared tool metadata.
- Schema
Compilation Error - Error compiling a tool schema.
- Schema
Validation Failure - Failure validating one tool argument or output value.
- Tool
Audit Metadata Error - Error returned when validating or encoding tool audit metadata.
- Tool
Binding - Complete executable binding associated with one portable
ToolSpec. - Tool
Concurrency - Declared concurrency constraint for one tool.
- Tool
Effect - Declared capability or external effect of a tool invocation.
- Tool
Execution Event - One normalized tool execution stream event.
- Tool
Execution Failure Code - Stable tool execution failure code.
- Tool
Identity Parse Error - Error returned when parsing tool identity values.
- Tool
Invocation Error - Error constructing an untrusted invocation.
- Tool
Registry Error - Registry validation, conflict, or resource failure.
- Tool
Resource Access - Access requested for a resolved resource.
- Tool
Resource Error - Resource construction or resolution failure.
- Tool
Result Error - Error constructing tool results/failures.
- Tool
Retry Safety - Whether and by whom a failed or interrupted invocation may be retried.
- Tool
Route Preference - Preferred route for a hybrid tool with hosted and client implementations.
- Tool
Source Error - Error returned when validating tool-source provenance.
- Tool
Source Kind - Provider-neutral origin category for a registered tool.
- Tool
Spec Error - Error returned when constructing tool specifications.
- Tool
Stream Violation - Tool execution stream grammar violation.
- Tool
Trust - 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§
- Tool
Execution Stream - Provider-neutral asynchronous tool event stream.
- Tool
Executor - Object-safe executor receiving only registry-validated invocations.
- Tool
Resource Resolver - Pure resource resolver used before policy and execution.
Type Aliases§
- BoxTool
Execution Stream - Object-safe boxed tool execution stream.