FluidUse: local computer use on Apple Silicon with Laya and CUA-S1-FORMS
Swift package that reads a form in a running Mac app through the Accessibility API, asks an on-device model what belongs in each field, and types it in. ~1 ms per decision.
# FluidUse
Local computer use on Apple silicon. FluidUse reads a form in a running Mac
app or browser through the Accessibility API, asks a small on-device model
what belongs in each field, and types the answer into the real app. About
1 ms per decision on the Neural Engine, nothing leaves the machine.
The first model is [CUA-S1-FORMS](https://huggingface.co/FluidInference/cua-s1-forms-coreml),
a 706K-parameter form specialist from [Cua](https://github.com/trycua/cua),
converted to Core ML and served by [FluidAudio](https://github.com/FluidInference/FluidAudio).
## Demo video
https://github.com/user-attachments/assets/a0b31285-05be-4bcf-a645-4283eb327c35
## Use
```swift
.package(url: "https://github.com/FluidInference/FluidUse.git", from: "0.2.0")
```
```swift
import FluidAudio
import FluidUse
let model = try await CuaS1FormsManager.load()
let driver = AccessibilityFormDriver(application: safari) // any NSRunningApplication
let page = try await driver.snapshot() // fields, labels, values
let options = FormSchema.renderOptions(entities: profile) // "fill Email: …", check, click, skip
for field in page.elements where field.isActionable {
let context = FormSchema.renderContext(formTitle: page.title, element: field)
let decision = try await model.score(context: context, options: options)
// decode with FormSchema.decode, then driver.type / driver.click
}
```
`WebFormDriver` does the same for an embedded `WKWebView`. `DocumentEntities`
turns a PDF or text file of `Label: value` lines into the profile; an optional
`PredeterminedAnswer` sheet covers question-style fields the model does not decide.
## laya typed decisions
[laya](https://github.com/NandhaKishorM/laya) (Convai Innovations, Apache-2.0) is an open
Jev-style dec