Skip to content

Commit e443276

Browse files
authored
chore: Rename typia to rustia (#346)
1 parent 9170b25 commit e443276

32 files changed

Lines changed: 5519 additions & 71 deletions

AGENTS.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@
5555
- `docs/project-thenv.md`: Thenv multi-component project index.
5656
- `docs/project-public-docs.md`: Public docs app project index.
5757
- `docs/project-serde-feather.md`: Serde Feather multi-crate project index.
58-
- `docs/project-typia.md`: Typia multi-crate project index.
58+
- `docs/project-rustia.md`: Rustia multi-crate project index.
5959
- `docs/project-dexdex.md`: DexDex multi-runtime project index.
60-
- `docs/crates-typia-core-foundation.md`: Typia core runtime LLM data contract.
61-
- `docs/crates-typia-llm-foundation.md`: Typia aisdk tool adapter contract.
62-
- `docs/crates-typia-macros-foundation.md`: Typia macros derive contract.
60+
- `docs/crates-rustia-core-foundation.md`: Rustia core runtime LLM data contract.
61+
- `docs/crates-rustia-llm-foundation.md`: Rustia aisdk tool adapter contract.
62+
- `docs/crates-rustia-macros-foundation.md`: Rustia macros derive contract.
6363
- `docs/apps-dexdex-desktop-app-foundation.md`: DexDex app runtime and integration foundation contract.
6464
- `docs/apps-dexdex-ui-contract.md`: DexDex UI and interaction contract.
6565
- `docs/apps-dexdex-user-guide-contract.md`: DexDex end-user workflow contract.
@@ -93,7 +93,7 @@ enum ProjectId {
9393
DevkitRemoteFilePicker = "devkit-remote-file-picker",
9494
Thenv = "thenv",
9595
SerdeFeather = "serde-feather",
96-
Typia = "typia",
96+
Rustia = "rustia",
9797
PublicDocs = "public-docs",
9898
DexDex = "dexdex",
9999
}
@@ -111,7 +111,7 @@ enum ProjectId {
111111
- `devkit-remote-file-picker` -> `apps/devkit/src/apps/remote-file-picker`
112112
- `thenv` -> `cmds/thenv`, `servers/thenv`, `apps/devkit/src/apps/thenv`
113113
- `serde-feather` -> `crates/serde-feather`, `crates/serde-feather-macros`
114-
- `typia` -> `crates/typia`, `crates/typia-llm`, `crates/typia-macros`
114+
- `rustia` -> `crates/rustia`, `crates/rustia-llm`, `crates/rustia-macros`
115115
- `public-docs` -> `apps/public-docs`
116116
- `dexdex` -> `servers/dexdex-main-server`, `servers/dexdex-worker-server`, `apps/dexdex`, `protos/dexdex`
117117

@@ -187,21 +187,21 @@ enum SerdeFeatherComponent {
187187
- `Core` -> `crates/serde-feather`
188188
- `Macros` -> `crates/serde-feather-macros`
189189

190-
### Typia Component Contract
190+
### Rustia Component Contract
191191

192-
`typia` is a three-component project with fixed mapping:
192+
`rustia` is a three-component project with fixed mapping:
193193

194194
```ts
195-
enum TypiaComponent {
195+
enum RustiaComponent {
196196
Core = "core",
197197
Llm = "llm",
198198
Macros = "macros",
199199
}
200200
```
201201

202-
- `Core` -> `crates/typia`
203-
- `Llm` -> `crates/typia-llm`
204-
- `Macros` -> `crates/typia-macros`
202+
- `Core` -> `crates/rustia`
203+
- `Llm` -> `crates/rustia-llm`
204+
- `Macros` -> `crates/rustia-macros`
205205

206206
### DexDex Component Contract
207207

Cargo.lock

Lines changed: 39 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ members = [
55
"crates/nodeup",
66
"crates/serde-feather",
77
"crates/serde-feather-macros",
8-
"crates/typia",
9-
"crates/typia-llm",
10-
"crates/typia-macros",
8+
"crates/rustia",
9+
"crates/rustia-llm",
10+
"crates/rustia-macros",
1111
]
1212

1313
[workspace.metadata.cargo-mono.publish.tag]
14-
packages = ["nodeup", "cargo-mono", "typia", "typia-macros", "typia-llm"]
14+
packages = ["nodeup", "cargo-mono", "rustia-rs", "rustia-macros", "rustia-llm"]
1515

1616
# Release profile optimizations
1717
[profile.release]

crates/AGENTS.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
- `crates/nodeup`: Rust-based Node.js version manager.
1212
- `crates/serde-feather`: Size-first serde runtime-facing core crate.
1313
- `crates/serde-feather-macros`: Proc-macro companion crate for serde-feather.
14-
- `crates/typia`: Serde-based LLM JSON runtime crate.
15-
- `crates/typia-llm`: aisdk tool adapter crate for typia-based function-calling input validation.
16-
- `crates/typia-macros`: Proc-macro derive companion crate for typia.
14+
- `crates/rustia`: Serde-based LLM JSON runtime crate.
15+
- `crates/rustia-llm`: aisdk tool adapter crate for rustia-based function-calling input validation.
16+
- `crates/rustia-macros`: Proc-macro derive companion crate for rustia.
1717

1818
### Rust Workspace Rules
1919

@@ -44,20 +44,20 @@
4444
- Keep binary-size-first defaults: minimal default features and no convenience dependencies by default.
4545
- Keep stable derive macro identifiers (`FeatherSerialize`, `FeatherDeserialize`) aligned with `docs/project-serde-feather.md` and crate component docs.
4646

47-
### typia-Specific Rules
47+
### rustia-Specific Rules
4848

49-
- Keep `typia` as the runtime-facing crate, `typia-llm` as the aisdk adapter crate, and `typia-macros` as the proc-macro companion crate.
50-
- Keep stable typia identifiers (`Validate`, `IValidation`, `IValidationError`, `LLMData`, `LlmJsonParseResult`, `LlmJsonParseError`, `LlmToolInput`, `LlmToolOutput`, `LlmToolSpec`, `tool`, `LlmToolBuildError`, `LlmToolInputError`, `LlmToolExecutionError`, and `#[derive(LLMData)]`) synchronized with `docs/project-typia.md`, `docs/crates-typia-core-foundation.md`, `docs/crates-typia-llm-foundation.md`, and `docs/crates-typia-macros-foundation.md`.
51-
- Keep non-contracted v0 identifiers explicitly documented as unstable until promoted in typia contract docs.
52-
- Keep future macro/runtime compatibility constraints synchronized with typia project and crate contracts.
49+
- Keep `rustia` as the runtime-facing crate, `rustia-llm` as the aisdk adapter crate, and `rustia-macros` as the proc-macro companion crate.
50+
- Keep stable rustia identifiers (`Validate`, `IValidation`, `IValidationError`, `LLMData`, `LlmJsonParseResult`, `LlmJsonParseError`, `LlmToolInput`, `LlmToolOutput`, `LlmToolSpec`, `tool`, `LlmToolBuildError`, `LlmToolInputError`, `LlmToolExecutionError`, and `#[derive(LLMData)]`) synchronized with `docs/project-rustia.md`, `docs/crates-rustia-core-foundation.md`, `docs/crates-rustia-llm-foundation.md`, and `docs/crates-rustia-macros-foundation.md`.
51+
- Keep non-contracted v0 identifiers explicitly documented as unstable until promoted in rustia contract docs.
52+
- Keep future macro/runtime compatibility constraints synchronized with rustia project and crate contracts.
5353

5454
### Multi-Component Contract Sync
5555

5656
- `serde-feather` core crate changes must update `docs/crates-serde-feather-core-foundation.md` and `docs/project-serde-feather.md`.
5757
- `serde-feather-macros` changes must update `docs/crates-serde-feather-macros-foundation.md` and `docs/project-serde-feather.md`.
58-
- `typia` core crate changes must update `docs/crates-typia-core-foundation.md` and `docs/project-typia.md`.
59-
- `typia-llm` crate changes must update `docs/crates-typia-llm-foundation.md` and `docs/project-typia.md`.
60-
- `typia-macros` crate changes must update `docs/crates-typia-macros-foundation.md` and `docs/project-typia.md`.
58+
- `rustia` core crate changes must update `docs/crates-rustia-core-foundation.md` and `docs/project-rustia.md`.
59+
- `rustia-llm` crate changes must update `docs/crates-rustia-llm-foundation.md` and `docs/project-rustia.md`.
60+
- `rustia-macros` crate changes must update `docs/crates-rustia-macros-foundation.md` and `docs/project-rustia.md`.
6161

6262
### Testing and Validation
6363

crates/rustia-llm/Cargo.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[package]
2+
name = "rustia-llm"
3+
version = "0.1.1"
4+
edition = "2024"
5+
license = "MIT"
6+
description = "Rustia-powered LLM tool-calling adapter for aisdk"
7+
homepage = "https://github.com/delinoio/oss/tree/main/crates/rustia-llm"
8+
repository = "https://github.com/delinoio/oss"
9+
readme = "README.md"
10+
publish = true
11+
12+
[dependencies]
13+
aisdk = { version = "0.5.2", default-features = false }
14+
schemars = "1.0.4"
15+
serde = { version = "1.0.219", features = ["derive"] }
16+
serde_json = "1.0.145"
17+
tracing = "0.1.41"
18+
rustia-rs = { version = "0.1.1", path = "../rustia" }

crates/rustia-llm/README.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# rustia-llm
2+
3+
`rustia-llm` provides a typed adapter from Rust `rustia` models to `aisdk::core::tools::Tool`.
4+
5+
The adapter enforces rustia's three-layer harness for tool input:
6+
7+
1. Lenient JSON parsing
8+
2. Parse-time type coercion
9+
3. Validation feedback
10+
11+
## Quick Start
12+
13+
```rust
14+
use schemars::JsonSchema;
15+
use serde::{Deserialize, Serialize};
16+
use rustia::LLMData;
17+
use rustia_llm::{LlmToolSpec, tool};
18+
19+
#[derive(Debug, Serialize, Deserialize, JsonSchema, LLMData)]
20+
struct WeatherInput {
21+
city: String,
22+
days: u8,
23+
}
24+
25+
#[derive(Debug, Serialize, Deserialize)]
26+
struct WeatherOutput {
27+
summary: String,
28+
}
29+
30+
fn main() {
31+
let weather_tool = tool::<WeatherInput, WeatherOutput, _, std::convert::Infallible>(
32+
LlmToolSpec::new(
33+
"get_weather",
34+
"Get a short weather summary for a city and forecast length",
35+
),
36+
|input| {
37+
Ok(WeatherOutput {
38+
summary: format!("{} forecast for {} day(s)", input.city, input.days),
39+
})
40+
},
41+
)
42+
.expect("tool should build");
43+
44+
let output = weather_tool
45+
.execute
46+
.call(serde_json::json!({ "city": "seoul", "days": "2" }))
47+
.expect("tool execution should succeed");
48+
49+
println!("{output}");
50+
}
51+
```
52+
53+
## API Key Setup
54+
55+
`rustia-llm` only builds typed `Tool` adapters. API key configuration is handled by
56+
the `aisdk` provider you use (for example, OpenAI).
57+
58+
If you use OpenAI, enable the provider feature in your app crate:
59+
60+
```bash
61+
cargo add aisdk --features openai
62+
```
63+
64+
### Option A: Environment Variable (recommended)
65+
66+
```bash
67+
export OPENAI_API_KEY="<YOUR_OPENAI_API_KEY>"
68+
```
69+
70+
Then use your tool with `aisdk`:
71+
72+
```rust
73+
use aisdk::{core::LanguageModelRequest, providers::OpenAI};
74+
75+
let response = LanguageModelRequest::builder()
76+
.model(OpenAI::gpt_5())
77+
.prompt("Use the provided tool to answer the request.")
78+
.with_tool(weather_tool)
79+
.build()
80+
.generate_text()
81+
.await?;
82+
```
83+
84+
### Option B: Explicit API Key in Provider Builder
85+
86+
```rust
87+
use aisdk::providers::OpenAI;
88+
89+
let mut openai = OpenAI::gpt_5();
90+
openai.settings.api_key = "<YOUR_OPENAI_API_KEY>".to_owned();
91+
```
92+
93+
Use `openai` as the model in `LanguageModelRequest::builder().model(openai)`.
94+
95+
## API Surface
96+
97+
- `LlmToolInput`: `rustia::LLMData + schemars::JsonSchema + Send + Sync + 'static`
98+
- `LlmToolOutput`: `serde::Serialize + Send + Sync + 'static`
99+
- `LlmToolSpec`
100+
- `tool<I, O, F, E>(spec, handler) -> Result<aisdk::core::tools::Tool, LlmToolBuildError>`
101+
102+
## Error Model
103+
104+
- `LlmToolBuildError`
105+
- `LlmToolInputError`
106+
- `LlmToolExecutionError`
107+
108+
Input parsing and validation failures return deterministic feedback text in the tool error payload, including rustia validation paths (`$input...`) and expected constraints.
109+
110+
## Local Validation
111+
112+
Run from repository root:
113+
114+
```bash
115+
cargo test -p rustia-llm
116+
cargo test --workspace --all-targets
117+
```
118+
119+
## Documentation Links
120+
121+
- Project index: [`docs/project-rustia.md`](../../docs/project-rustia.md)
122+
- rustia-llm contract: [`docs/crates-rustia-llm-foundation.md`](../../docs/crates-rustia-llm-foundation.md)
123+
- rustia core contract: [`docs/crates-rustia-core-foundation.md`](../../docs/crates-rustia-core-foundation.md)

0 commit comments

Comments
 (0)