Cyclium.Intent.SignatureMatcher (Cyclium v0.5.2)

Copy Markdown View Source

Matches a tool call from an action plan against allowed tool signatures.

A step matches only when a signature with the same tool name exists and that signature allows the step's action (see Cyclium.Intent.ToolSignature.allows_action?/2). Matching the name alone would let a plan reach any call/3 clause the tool module happens to implement, including ones withheld from this actor on purpose.

Summary

Functions

Whether any step calls a write / external_effect action. Uses the action's own side-effect class when the signature declares one, otherwise the tool's class. A step that does not match any signature is not counted; the gate denies it before preview is considered.

Functions

has_side_effects?(steps, signatures)

@spec has_side_effects?([Cyclium.Intent.ToolCallStep.t()], [
  Cyclium.Intent.ToolSignature.t()
]) ::
  boolean()

Whether any step calls a write / external_effect action. Uses the action's own side-effect class when the signature declares one, otherwise the tool's class. A step that does not match any signature is not counted; the gate denies it before preview is considered.

match(tool_call_step, signatures)

@spec match(Cyclium.Intent.ToolCallStep.t(), [Cyclium.Intent.ToolSignature.t()]) ::
  {:ok, Cyclium.Intent.ToolSignature.t()}
  | {:error, :no_matching_signature | :action_not_allowed}