Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
65fcf2b
docs: AIBridge Rust 重构设计文档
WingkySky Jul 7, 2026
350177c
feat(aibridge): 阶段0.1 Cargo workspace 骨架
WingkySky Jul 7, 2026
1b7414e
chore: 提交 Cargo.lock 保证可复现构建
WingkySky Jul 7, 2026
414678d
feat(aibridge-core): 阶段0.2-0.4 基础设施/数据模型/Adapter/Client/Router
WingkySky Jul 7, 2026
ddafa26
feat(aibridge-ffi): 阶段0.5 C ABI 层(runtime/句柄/JSON边界/cbindgen)
WingkySky Jul 7, 2026
8020c9c
feat(aibridge-core): echo 适配器用于阶段0.6 管线验证
WingkySky Jul 7, 2026
f36ee7c
feat(aibridge-go): 阶段0.6 CGO 绑定 + hello world
WingkySky Jul 7, 2026
5118eeb
feat(aibridge-jvm): 阶段0.6 JNA 绑定 + hello world
WingkySky Jul 7, 2026
2ecfb58
feat(aibridge-node): 阶段0.6 napi-rs 绑定 + hello world
WingkySky Jul 7, 2026
268cd49
feat(aibridge-python): 阶段0.6 PyO3 绑定 + hello world 管线验证
WingkySky Jul 7, 2026
0a802b9
feat(aibridge-dotnet): 阶段0.6 P/Invoke 绑定
WingkySky Jul 7, 2026
b81dab5
chore: 提交阶段0.6 五语言绑定依赖锁
WingkySky Jul 7, 2026
60de645
feat(aibridge-core): 阶段1.0 OpenAI 兼容适配器地基
WingkySky Jul 7, 2026
d9a66e3
feat(aibridge-core): 阶段1.1 openai 适配器
WingkySky Jul 7, 2026
a8ca9d0
feat(aibridge-core): 阶段1.3 volcengine_cv 适配器(火山引擎)
WingkySky Jul 7, 2026
cc2026e
feat(aibridge-core): 阶段1.4 gemini 适配器
WingkySky Jul 7, 2026
0200d41
feat(aibridge-core): 阶段1.2 agnes 适配器
WingkySky Jul 7, 2026
bf5cb1d
feat(aibridge-core): 阶段1 收尾 注册四 MVP 适配器到工厂
WingkySky Jul 7, 2026
68954d2
feat: 阶段1.5 跨语言一致性测试 + 错误 code 统一
WingkySky Jul 7, 2026
e5df4f3
fix(aibridge-python): dylib 产物名改为 _aibridge 避免与 ffi 冲突
WingkySky Jul 7, 2026
7b4a79d
fix: 阶段1 Python/Node 流式桥接重构(真实 IO 不阻塞事件循环)
WingkySky Jul 7, 2026
03d3e05
feat(aibridge-core): 阶段2a azure 适配器
WingkySky Jul 7, 2026
5fd3638
feat(aibridge-core): 阶段2a aggregation_platforms 适配器
WingkySky Jul 7, 2026
cb4536a
feat(aibridge-core): 阶段2a 第一批收尾 注册 azure + 聚合平台到工厂
WingkySky Jul 7, 2026
083a283
chore: cargo fmt 收尾 aibridge-node/python lib.rs
WingkySky Jul 7, 2026
65fab2f
feat(aibridge-core): 阶段2a additional_models 适配器
WingkySky Jul 7, 2026
3fd6df3
feat(aibridge-core): 阶段2a more_models 适配器
WingkySky Jul 7, 2026
a0eb96d
feat(aibridge-core): 阶段2a 第二批收尾 注册 additional_models + more_models 到工厂
WingkySky Jul 7, 2026
ba4a78b
feat(aibridge-core): 阶段2a emerging_models 适配器
WingkySky Jul 7, 2026
43e923f
feat(aibridge-core): 阶段2a chinese 适配器(中文模型聚合)
WingkySky Jul 7, 2026
3880168
feat(aibridge-core): 阶段2a 第三批收尾 注册 emerging_models + chinese 到工厂(阶段2a…
WingkySky Jul 7, 2026
37a1b9a
docs: AIBridge Rust 重构进度文档 + AGENTS.md 接手指引
WingkySky Jul 7, 2026
954d153
feat(aibridge-core): 阶段2b anthropic 适配器
WingkySky Jul 7, 2026
e6151da
feat(aibridge-core): 阶段2b stability 适配器
WingkySky Jul 7, 2026
04fd202
feat(aibridge-core): 阶段2b 第一批收尾 注册 anthropic + stability 到工厂
WingkySky Jul 7, 2026
0247589
feat(aibridge-core): 阶段2b runway 适配器
WingkySky Jul 7, 2026
0124c5c
feat(aibridge-core): 阶段2b pika 适配器
WingkySky Jul 7, 2026
3f05c39
feat(aibridge-core): 阶段2b 第二批收尾 注册 runway + pika 到工厂
WingkySky Jul 7, 2026
ee89f32
feat(aibridge-core): 阶段2b kling 适配器(可灵)
WingkySky Jul 7, 2026
d6493c7
feat(aibridge-core): 阶段2c edge-tts 适配器(免费 TTS)
WingkySky Jul 7, 2026
03776d2
feat(aibridge-core): 阶段2b+2c 收尾 注册 kling + edge-tts 到工厂(edge-tts 免认证)
WingkySky Jul 7, 2026
0b7c205
feat(aibridge-core): 阶段2c elevenlabs 适配器
WingkySky Jul 7, 2026
5c2d659
feat(aibridge-core): 阶段2c cartesia 适配器
WingkySky Jul 7, 2026
ac0a3c8
feat(aibridge-core): 阶段2c 第二批收尾 注册 elevenlabs + cartesia 到工厂
WingkySky Jul 7, 2026
e533bff
feat(aibridge-core): 阶段2c deepgram 适配器
WingkySky Jul 7, 2026
3fb46be
feat(aibridge-core): 阶段2c assemblyai 适配器
WingkySky Jul 7, 2026
12925ad
feat(aibridge-core): 阶段2c 第三批收尾 注册 deepgram + assemblyai 到工厂(阶段2 全部完成)
WingkySky Jul 7, 2026
141ec2e
docs: 阶段3 Python v1→v2 迁移指南 + README + 进度更新
WingkySky Jul 7, 2026
3eb07ce
feat: 阶段3 CI 矩阵 + 五语言打包脚本
WingkySky Jul 7, 2026
93ede4d
feat(aibridge-python): 补全全部能力绑定(image/video/transcribe/embed/list_mod…
WingkySky Jul 7, 2026
3d4b83a
test: 阶段3 真实 API 测试脚本 + .env.example 模板
WingkySky Jul 7, 2026
aad7ff3
fix(aibridge-agnes): video mode 映射对齐方舟 agnes 平台(ti2vid/keyframes/mult…
WingkySky Jul 8, 2026
88e5ace
test: 真实 API 测试脚本(agnes/volcengine 单 provider)+ .env.example 补 endpoi…
WingkySky Jul 8, 2026
6a0fa33
fix: 阶段3 CI 修复(.NET/Go/Python wheel 构建)
WingkySky Jul 10, 2026
814b042
fix(ci): Go windows GNU 工具链 + Python universal2 + 移除 macos-x64
WingkySky Jul 12, 2026
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
43 changes: 28 additions & 15 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
# Agnes AI
AGN_AGNES_API_KEY=your-agnes-api-key
AGN_AGNES_BASE_URL=https://api.agnes.ai/v1
# AIBridge 真实 API 测试环境变量
#
# ⚠️ 重要:本文件是模板(.env.example),可上传 GitHub。
# 实际 API key 请填在 .env 文件里(已 gitignore,不会上传 GitHub)。
#
# 用法:
# 1. cp .env.example .env
# 2. 在 .env 填入真实 API key(等号右边)
# 3. python examples/test_real_providers.py
#
# 测试脚本会从 .env 读 key,并用 list_models() 实时拉取真实 model 名字(model 经常变,不硬编码)。

# OpenAI
AGN_OPENAI_API_KEY=your-openai-api-key
# Agnes AI(https://agnes.ai)
AGNES_API_KEY=
AGNES_BASE_URL=https://api.agnes.ai/v1

# Azure OpenAI
AGN_AZURE_API_KEY=your-azure-api-key
AGN_AZURE_BASE_URL=https://your-resource.openai.azure.com/openai/deployments/your-deployment
AGN_AZURE_API_VERSION=2024-02-15-preview
# OpenAI(https://platform.openai.com)
OPENAI_API_KEY=
OPENAI_BASE_URL=https://api.openai.com/v1

# Runway
AGN_RUNWAY_API_KEY=your-runway-api-key
# Google Gemini(https://ai.google.dev)
GEMINI_API_KEY=
GEMINI_BASE_URL=https://generativelanguage.googleapis.com/v1beta

# Pika
AGN_PIKA_API_KEY=your-pika-api-key
# 火山引擎 CV / 方舟(https://www.volcengine.com)
# base_url 固定 https://ark.cn-beijing.volces.com/api/v3(agent plan/coding plan/普通 api 都是订阅计划,地址统一)
VOLCENGINE_CV_API_KEY=
VOLCENGINE_CV_BASE_URL=https://ark.cn-beijing.volces.com/api/v3

# Stability AI
AGN_STABILITY_API_KEY=your-stability-api-key
# 火山方舟接入点 ID(在控制台「模型推理」创建接入点获取,形如 ep-2024xxxxxx-xxxxx)
# 图像模型(doubao-seedream)和视频模型(doubao-seedance)各创建一个接入点
VOLCENGINE_IMAGE_ENDPOINT=
VOLCENGINE_VIDEO_ENDPOINT=
267 changes: 267 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
# AIBridge CI 矩阵
#
# 对应设计文档第 12.3 节:平台(linux/macos/windows × amd64/arm64)× 语言。
# 共 6 个 job:Rust 核心+ffi / Python / Node / Go / JVM / .NET。
# 触发:push 到 feat/aibridge-rust-rewrite + 所有 PR。
#
# 说明:
# - 不实际发布(无 token),仅验证跨平台构建 + 产出 artifact 供下载。
# - cargo 用 Swatinem/rust-cache 缓存;npm 由 setup-node 缓存;gradle 由 setup-gradle 缓存。
# - ubuntu-24.04-arm 提供 linux arm64 runner;macos-x64 runner 已弃用(24h 超时),仅保留 macos-arm64。

name: CI

on:
push:
branches: [feat/aibridge-rust-rewrite]
pull_request:

env:
CARGO_TERM_COLOR: always
CARGO_NET_RETRY: 3

jobs:
# ──────────────────────────────────────────────────────────────────────────
# 1. Rust 核心 + ffi(跨平台 build + test)
# ──────────────────────────────────────────────────────────────────────────
rust-core-ffi:
name: Rust 核心+ffi (${{ matrix.label }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
label: linux-x64
- os: ubuntu-24.04-arm
label: linux-arm64
- os: macos-latest
label: macos-arm64
- os: windows-latest
label: windows-x64
steps:
- uses: actions/checkout@v4
- name: 安装 Rust 工具链
uses: dtolnay/rust-toolchain@stable
- name: 缓存 cargo
uses: Swatinem/rust-cache@v2
- name: cargo build(core + ffi)
run: cargo build -p aibridge-core -p aibridge-ffi
- name: cargo test(core + ffi)
run: cargo test -p aibridge-core -p aibridge-ffi

# ──────────────────────────────────────────────────────────────────────────
# 2. Python 绑定(maturin build wheel)
# macOS 产 universal2 wheel(同时含 amd64+arm64)
# ──────────────────────────────────────────────────────────────────────────
python-bindings:
name: Python wheel (${{ matrix.label }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
label: linux-x64
- os: ubuntu-24.04-arm
label: linux-arm64
- os: macos-latest
label: macos-universal2
- os: windows-latest
label: windows-x64
steps:
- uses: actions/checkout@v4
- name: 安装 Rust 工具链
uses: dtolnay/rust-toolchain@stable
- name: 添加 macOS universal2 交叉编译 target
if: matrix.label == 'macos-universal2'
run: rustup target add x86_64-apple-darwin aarch64-apple-darwin
- name: 缓存 cargo
uses: Swatinem/rust-cache@v2
- name: 安装 Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: 安装 maturin
run: pip install maturin
- name: maturin build wheel
shell: bash
run: |
if [ "${{ matrix.label }}" = "macos-universal2" ]; then
# universal2: maturin 分别编译 x86_64/aarch64-apple-darwin 后 lipo 合并
# (maturin 1.x 不支持 --universal2 标志,改用 --target universal2-apple-darwin)
maturin build --manifest-path crates/aibridge-python/Cargo.toml --release --target universal2-apple-darwin
else
maturin build --manifest-path crates/aibridge-python/Cargo.toml --release
fi
- name: 上传 wheel 产物
uses: actions/upload-artifact@v4
with:
name: python-wheel-${{ matrix.label }}
path: target/wheels/*.whl
if-no-files-found: warn

# ──────────────────────────────────────────────────────────────────────────
# 3. Node 绑定(napi build .node)
# ──────────────────────────────────────────────────────────────────────────
node-bindings:
name: Node .node (${{ matrix.label }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
label: linux-x64
- os: ubuntu-24.04-arm
label: linux-arm64
- os: macos-latest
label: macos-arm64
- os: windows-latest
label: windows-x64
steps:
- uses: actions/checkout@v4
- name: 安装 Rust 工具链
uses: dtolnay/rust-toolchain@stable
- name: 缓存 cargo
uses: Swatinem/rust-cache@v2
- name: 安装 Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: crates/aibridge-node/package-lock.json
- name: npm install
run: |
cd crates/aibridge-node
npm install
- name: napi build
run: |
cd crates/aibridge-node
npx napi build --platform --release
- name: 上传 .node 产物
uses: actions/upload-artifact@v4
with:
name: node-binary-${{ matrix.label }}
path: crates/aibridge-node/*.node
if-no-files-found: warn

# ──────────────────────────────────────────────────────────────────────────
# 4. Go 绑定(cargo build ffi + go build,CGO)
# windows CGO 标记为 experimental(失败不阻断 CI)
# ──────────────────────────────────────────────────────────────────────────
go-bindings:
name: Go 绑定 (${{ matrix.label }})
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
label: linux-x64
experimental: false
- os: macos-latest
label: macos-arm64
experimental: false
- os: windows-latest
label: windows-x64
experimental: true
steps:
- uses: actions/checkout@v4
- name: 安装 Rust 工具链
uses: dtolnay/rust-toolchain@stable
- name: 缓存 cargo
uses: Swatinem/rust-cache@v2
- name: 安装 Go
uses: actions/setup-go@v5
with:
go-version: '1.26'
cache: false
- name: 构建 libaibridge (ffi, release)
shell: bash
run: |
if [ "${{ matrix.label }}" = "windows-x64" ]; then
# Windows: 用 GNU target 编译,避免 MSVC 产 .lib 与 Go MinGW gcc 链接不兼容
# (Go CGO 在 Windows 用 MinGW gcc;MSVC 运行时符号如 __chkstk 它找不到)
rustup target add x86_64-pc-windows-gnu
cargo build -p aibridge-ffi --release --target x86_64-pc-windows-gnu
# GNU target 产 libaibridge.dll.a(import lib)+ aibridge.dll,拷到 Go cgo 默认查找的 target/release
cp target/x86_64-pc-windows-gnu/release/libaibridge.dll.a target/release/ 2>/dev/null || \
cp target/x86_64-pc-windows-gnu/release/libaibridge.a target/release/ 2>/dev/null || true
cp target/x86_64-pc-windows-gnu/release/aibridge.dll target/release/ 2>/dev/null || true
else
cargo build -p aibridge-ffi --release
fi
- name: go build + vet (CGO)
shell: bash
env:
CGO_ENABLED: '1'
LIBAIBRIDGE_DIR: ${{ github.workspace }}/target/release
run: |
cd bindings/go
case "$(uname -s)" in
Darwin) export DYLD_LIBRARY_PATH="$LIBAIBRIDGE_DIR" ;;
Linux) export LD_LIBRARY_PATH="$LIBAIBRIDGE_DIR" ;;
esac
go build ./...
go vet ./...

# ──────────────────────────────────────────────────────────────────────────
# 5. JVM 绑定(cargo build ffi + gradle build,动态库打进 jar)
# ──────────────────────────────────────────────────────────────────────────
jvm-bindings:
name: JVM 绑定 (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: 安装 Rust 工具链
uses: dtolnay/rust-toolchain@stable
- name: 缓存 cargo
uses: Swatinem/rust-cache@v2
- name: 安装 Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
- name: 配置 Gradle
uses: gradle/actions/setup-gradle@v4
- name: 构建 libaibridge (ffi, release)
run: cargo build -p aibridge-ffi --release
- name: gradle build(含 native 进 jar)
shell: bash
run: |
cd bindings/jvm
./gradlew build -PembedNative=true

# ──────────────────────────────────────────────────────────────────────────
# 6. .NET 绑定(cargo build ffi + dotnet build,动态库打进 NuGet)
# ──────────────────────────────────────────────────────────────────────────
dotnet-bindings:
name: .NET 绑定 (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: 安装 Rust 工具链
uses: dtolnay/rust-toolchain@stable
- name: 缓存 cargo
uses: Swatinem/rust-cache@v2
- name: 安装 .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: 构建 libaibridge (ffi, release)
run: cargo build -p aibridge-ffi --release
- name: dotnet build
shell: bash
run: |
cd bindings/dotnet/AIBridge
dotnet build
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,14 @@ Thumbs.db
# Project specific
output/
*.egg-info/

# Rust(target/ 已在上方忽略)
# Cargo.lock 提交以保证可复现构建(workspace 含 cdylib 产物)

# Node / napi-rs
node_modules/
*.node

# 原生库发布产物(target/ 外的)
*.dylib
*.dll
4 changes: 4 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

> 本文件是 Agent 执行任务时必须首先加载和理解的项目指南,包含项目目标、架构、规范、验收标准等关键信息。

> ⚠️ **Rust 重构进行中**:本项目正在用 Rust 重构为跨语言 SDK `aibridge`(分支 `feat/aibridge-rust-rewrite`)。
> 接手 Rust 重构工作请先读 **[docs/PROGRESS.md](docs/PROGRESS.md)**(完整进度 + 接手指南)+ [设计文档](docs/superpowers/specs/2026-07-07-aibridge-rust-rewrite-design.md) + [实现计划](docs/superpowers/plans/2026-07-07-aibridge-implementation-plan.md)。
> 本文档(AGENTS.md)描述的是 Python 旧版(agn-sdk v1),Rust 新版以 PROGRESS.md + 设计文档为准。

---

## 1. 项目概述
Expand Down
Loading
Loading