
ggoggam/vitre
Developer toolsЭта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал
Автоматизация WebView для Kotlin Multiplatform. Запускайте рабочие процессы страниц в встроенном WebView на Android, iOS и десктопе из вашего приложения, теста или LLM-агента через MCP или Koog.
Обзор
Опишите, что хотите сделать на странице, в виде списка шагов, затем запустите это внутри встроенного WebView на Android, iOS и на рабочем столе: из вашего приложения, из теста или от LLM-агента через протокол Model Context Protocol или Koog. Один и тот же словарь доступен четырьмя способами: как в DSL Kotlin, как композитный файл Compose вы помещаетесь на экран, а для агента, который никогда не видел страницу, — как инструменты MCP или Koog. Последние два — это две поставки одного набора семантики, а не две их реализации. Блок — это строитель, а не скрипт. Он запускается один раз, сначала, чтобы собрать список шагов, который затем выполняет WorkflowEngine, так что обычный Kotlin, если он внутри, выбирает, что будет в рабочем процессе. Когда решение принадлежит запуску — элементу, который присутствует лишь иногда, значение, извлечённое на предыдущем этапе — runIf добавляет шаг, который движок оценивает на странице.
Обзор (машинный перевод)
Автоматизация WebView для Kotlin Multiplatform. Опишите, что вы хотите сделать со страницей, в виде списка затем запустить его внутри встроенного WebView на Android, iOS и на рабочем столе: из вашего приложения, из тест или от LLM-агента по протоколу Model Context Protocol или Koog.
Та же лексика доступна четырьмя способами: как в Kotlin DSL выше, как композитируемый Composable вы появляется на экране, а для агента, который никогда не видел страницу, — как инструменты MCP или как инструменты Koog. Последние два — это две передачи одного набора семантики, а не две их реализации.
Блок — это строитель, а не скрипт. Он запускается один раз, сначала, чтобы собрать список шагов
WorkflowEngine затем идёт, так что обычный Kotlin if внутри него выбирает, что в процессе содержит.
Когда решение принадлежит потоку — элементу, который присутствует лишь иногда, значение
ранее извлечённый шаг — runIf добавляет шаг, который движок оценивает по отношению к странице. T
WorkflowStep конструкторы остаются публичными и эквивалентными; именно их использует vitre-mcp, поскольку
шаги агента приходят в виде JSON, а не Котлина.
Почему
Эта страница переведена автоматически. Технические детали смотрите в оригинале.
README
Показан фрагмент оригинального README. Открыть оригинал.
Vitre
WebView automation for Kotlin Multiplatform. Describe what you want done to a page as a list of steps, then run it inside an embedded WebView on Android, iOS and the desktop: from your app, from a test, or from an LLM agent over the Model Context Protocol or Koog.
val workflow = workflow("hn-top-story", "Hacker News top story") {
navigate("https://news.ycombinator.com/")
waitFor(".titleline > a", timeoutMs = 15_000)
extract(".titleline > a", into = "headline")
extract(".titleline > a", into = "url", from = Source.Attribute("href"))
}
WorkflowEngine(controller).run(workflow).collect { event ->
if (event is WorkflowEvent.Completed) println(event.variables["headline"])
}
The same vocabulary is available four ways: as the Kotlin DSL above, as a Compose composable you drop into a screen, and, for an agent that has never seen the page, as MCP tools or as Koog tools. Those last two are two deliveries of one set of semantics rather than two implementations of them.
The block is a builder rather than a script. It runs once, up front, to assemble the step list that
WorkflowEngine then walks, so ordinary Kotlin if inside it chooses what the workflow contains.
When the decision belongs to the run instead — an element that is only sometimes there, a value an
earlier step extracted — runIf appends a step the engine evaluates against the page. The
WorkflowStep constructors remain public and equivalent; they are what vitre-mcp uses, since
an agent’s steps arrive as JSON rather than as Kotlin.
Why
Mobile apps already embed WebViews, and everything people want to do with them (read a page, fill a
form, talk to the page’s own script, scrape a table, run four sites at once) ends up as one-off
evaluateJavascript calls glued to a callback. Those calls race each other, they race the UI, and
none of it is shared between Android, iOS and the desktop.
Vitre makes the page something you can drive: one ordering guarantee, one step vocabulary, one codebase for every platform, and a snapshot format an agent can read.
- The steps are declarative:
Navigate,LoadHtml,WaitFor,Click,Input,Extract,ExtractRows,Snapshot,EvaluateJs,PostMessage,AwaitMessage,Iffor the branches the page decides rather than the builder, andForEachto visit every page an earlier step found — search results in, one product page each out. - Elements are addressed three ways: CSS, XPath, and handles issued by a page snapshot.
evaluateJsreturns a script’s result JSON-encoded on every platform, so
Установка
This server does not publish a one-line install command.
Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →