Expand description
§smix-ai-tier
The AI-assertion tier: hand a screenshot and a plain-language condition to a
local claude CLI, get a structured verdict back. It backs the
assertCondition and extractWithAI yaml verbs.
ⓘ
let verdict = smix_ai_tier::judge(&png, "a red error toast is visible", &cfg).await?;
if !verdict.pass {
// verdict.reason explains what the judge saw
}§This tier is fenced, and the fence is the point
smix senses the screen through the accessibility tree and Vision OCR. Those are deterministic, and they are what every selector resolves through. This tier is not part of that. It is an authoring and CI aid that sits beside the resolver, never inside it:
- Nothing that senses may depend on this crate. Delete
smix-ai-tierand the sense path still compiles and its tests still pass. That deletability is the fence, and it is enforced by a test (tests/fence.rs) rather than asserted in a comment. - Opt-in. The verbs are inert unless a flow turns them on.
- Marked non-deterministic. A verdict is a judgement, not a measurement, and the output says so.
- One provider. The local
claudeCLI, invoked as a subprocess. There is no provider abstraction here and there will not be one.
§Failure is loud
A missing CLI, a timeout, or output that isn’t the verdict we asked for are all
errors. None of them degrade into pass: false — that would report “your app is
broken” when the truth is “the judge never ran”.
Structs§
- AiTier
Config - How to reach the judge.
- Structured
Verdict - What the judge decided.
Enums§
- Attachment
- Something the question is about, alongside the words.
Functions§
- ask
- Ask once, and return what came back.
- ask_
with_ attachments - Ask about something, with the something stated rather than described.
- extract
- Read
fieldsoff the screen. - judge
- Ask the judge whether
conditionholds on the screen inscreenshot_png. - parse_
json_ object - Take the first JSON object out of the reply, tolerating prose around it —
models like to introduce themselves, and that is not a reason to fail a
flow. The generic type is the caller’s target shape; a reply that carries
no object, or one that does not deserialize into
T, yieldsNone.