Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 12 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ name: CI
on:
push:
branches: [master]
# Every pull request runs the checks, whatever its base: stacked PRs are
# reviewed against the PR below them.
pull_request:
branches: [master]

concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -390,49 +395,31 @@ jobs:
working-directory: bindings/flutter/example
run: flutter test

# ── Contract tests: shared JSON fixtures (catches cross-language type drift) ──
# Generated files must match their generators.
contract-tests:
name: Contract tests
name: Generator drift checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: ProviderName generator drift (checked-in files must match generator output)
run: python3 scripts/gen_provider_names.py --check
- name: Providers doc generator drift (docs/api/providers.md must match generator output)
run: python3 scripts/gen_providers_doc.py --check
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Run Rust contract tests
run: cargo test --test contract_test -p aimux-core
- name: ts-rs export drift (checked-in types must match generator output)
run: python3 scripts/gen_ts_types.py --check
- name: Build Node binding
working-directory: bindings/node
run: |
npm ci
npx napi build --platform
- name: Run Node contract tests
working-directory: contract-tests
run: |
node --experimental-strip-types run-node.ts

# ── Swift contract tests: the eighth binding joins the shared fixtures ─────
# Needs macOS (XCTest) and the FFI cdylib, which the Swift package links via
# the CAimuxFFI system module. The Dart side needs no job here: flutter-binding
# already runs `flutter test`, which picks up bindings/flutter/test/contract_test.dart.
# Swift tests need macOS (XCTest) and the FFI cdylib, which the Swift package
# links via the CAimuxFFI system module.
swift-contract-tests:
name: Swift contract tests
name: Swift tests
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build the FFI library the Swift package links against
run: cargo build -p aimux-ffi --release
- name: Run Swift contract tests
- name: Run Swift tests
working-directory: bindings/swift
env:
DYLD_LIBRARY_PATH: ${{ github.workspace }}/target/release
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Breaking

- Removed the generated `ProviderName` type in every binding (Rust enum, TS
const object, Go/Java/Kotlin consts, Swift enum, Dart consts, Python
`Literal`) and `scripts/gen_provider_names.py`. Provider names are plain
strings: `provider("groq", ...)`. Built-in and overlay-registered names now
share one string path. The provider list lives in
[docs/api/providers.md](docs/api/providers.md); Rust also gains
`provider_names()`.

**Rust (aimux-stream)**

- `SseStream` is now a thin adapter over the `sse-stream` crate (WHATWG
Expand Down
7 changes: 1 addition & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ aimux/
├── aimux-provider-utils/ # HTTP utilities: retry, backoff, error parsing, API-key loading
├── aimux-ffi/ # C ABI (opaque handle + JSON + push callback) for non-native bindings
├── bindings/ # Node, Python, Swift, Kotlin, Flutter, Go, C — share one Rust core
├── contract-tests/ # Shared JSON fixtures exercised across languages
├── rfc/ # Design docs (RFCs)
├── docs/ # Public product docs (see docs/README.md)
└── scripts/ # Code-generation and maintenance scripts
Expand Down Expand Up @@ -50,9 +49,6 @@ cargo test --workspace

# A single crate
cargo test -p aimux-providers --tests

# Contract tests (cross-language shared fixtures)
cargo test --test contract_test -p aimux-core
```

If you add or change a provider's request/response shapes, record a new
Expand Down Expand Up @@ -108,8 +104,7 @@ Keep the subject line imperative and ≤ 72 characters.
2. Make your change with focused commits.
3. Ensure `cargo fmt`, `cargo clippy -D warnings`, and `cargo test --workspace`
all pass locally. CI runs the same.
4. If you add a provider or binding, include cassette tests or contract
fixtures as appropriate.
4. If you add a provider or binding, include cassette tests.
5. Update the relevant doc (README, `docs/`, or `rfc/`) if your change affects
the public surface.
6. Open a PR against `master` and fill in the template.
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,18 +275,16 @@ session.close()
```rust
// OpenAI → DeepSeek: only the provider name changes (registry-backed;
// key read from the provider's env var)
use aimux_providers::{provider, provider_from_env, ProviderName};
use aimux_providers::{provider, provider_from_env};

// 推荐:类型化 ProviderName(IDE 补全 + 编译期检查)
let model = provider(ProviderName::Deepseek, None, "deepseek-chat", None)?;
// 字符串形式同样可用:
let model = provider("deepseek", None, "deepseek-chat", None)?;
let model = provider_from_env("deepseek", "deepseek-chat", None)?;
// model usage is identical — it's all dyn LanguageModel
```

All registry-backed OpenAI-compatible providers share one entry:
`provider(name, ...)` in every binding, with typed `ProviderName`
(enum/union/consts per language).
`provider(name, ...)` in every binding. Provider names are runtime strings;
the generated provider list is the discovery surface.
The retired per-provider shell types (`XxxConfig`/`XxxProvider`) are gone —
see [docs/API.md](docs/API.md#providers).

Expand Down
2 changes: 1 addition & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ aimux 是 **provider 接入与治理的运行时**:

版本语义:
- **Rust 层 breaking**:A2 删枚举、#185 换类型。
- **绑定源码级 breaking**:A2 删除 Go / Java / Kotlin / Swift / Flutter / Node / Python 的 `ProviderName` 类型化常量,改为字符串(Node 由 `gen_ts_types.py` 生成 string-literal union 保留补全);CHANGELOG 需给迁移说明。
- **绑定源码级 breaking**:A2 删除 Go / Java / Kotlin / Swift / Flutter / Node / Python 的 `ProviderName` 类型化常量,改为字符串,Node 也不保留 string-literal union(overlay 注册的名字无法进入编译期联合类型,保留它就是保留第二条路径);CHANGELOG 需给迁移说明。
- binding wire 与 C ABI 不变。

### 0.7.0 ——「L1 协议层 + auth」(~5-6 周)
Expand Down
Loading
Loading