An open API service indexing awesome lists of open source software.

https://github.com/zach-klippenstein/laygent

The AI-native Compose layout for token-maxxers.
https://github.com/zach-klippenstein/laygent

ai ai-agents compose-multiplatform jetbrains-compose jetpack-compose layout layout-engine

Last synced: 20 days ago
JSON representation

The AI-native Compose layout for token-maxxers.

Awesome Lists containing this project

README

          

# Laygent ![jetpack compose badge](https://img.shields.io/badge/Jetpack_Compose-supported-green) ![compose multiplatform badge](https://img.shields.io/badge/Jetbrains_Compose-supported-blue) ![ai-native badge](https://img.shields.io/badge/AI-native-purple)

**Laygent is the AI-native Compose layout for token-maxxers.**

Describe the layout you want in plain English and the algorithm is written for you at runtime, then
cached so your frames stay fast. The whole library is 100% AI-generated code — the humans just held
the keyboard.

## Example

```kotlin
val config = LaygentConfig.defaultOpenAi(openAiApiKey = myOpenAiKey)

@Composable
fun Example() {
val state = rememberLaygentState(config) {
"Arrange items in a 3-column grid with 8 dp of spacing between them."
}

Laygent(state) {
repeat(12) {
Box(Modifier.size(50.dp).background(Color.Blue))
}
}
}
```

## Installation

The library is published to Maven Central:

```kotlin
repositories {
mavenCentral()
}

dependencies {
implementation("com.zachklipp:laygent:0.1.0")
}
```

## Demos

- **Desktop:** `./gradlew :demo:run` — full-featured Compose Desktop demo.
- **Web:** `./gradlew :demo-web:wasmJsBrowserDevelopmentRun` — runs the same Laygent runtime in
the browser via Compose Multiplatform / wasmJs. Once it prints a localhost URL, open it and paste
an OpenAI key to drive the LLM-generated layout.

## Targets

The `:laygent` library publishes for `jvm`, `iosArm64`, `iosSimulatorArm64`, `iosX64`, and
`wasmJs`. The host JavaScript runtime is platform-specific:

- `jvm` and the iOS targets use [quickjs-kt](https://github.com/dokar3/quickjs-kt).
- `wasmJs` uses the browser's JS engine directly via `eval` and a `globalThis.layoutContext` bridge.