Files
xiaozhou233 4c3798735b Docs: add v5.0.0 release notes and changelog
- docs/update: add v5.0.0 release notes (bilingual) covering the v1 -> v2 breaking config change, migration steps and the BuiltIn / CustomJar modes

- docs/update: add CHANGELOG starting from v4.1.2
2026-10-15 20:09:37 +08:00

164 lines
6.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# JuiceAgent 5.0.0 Release Notes
## 中文
### ⚠️ 破坏性变更
- **配置文件升级到 v2**:`CONFIG_VERSION` 提升为 `2`。加载器启动时会校验 `JuiceAgent.Version`,版本不匹配将直接拒绝加载,因此旧版 v1 配置必须先迁移。
v1(不再支持):
```toml
[JuiceAgent]
Version = 1
[JuiceAgent.Loader]
JuiceAgentNativeLibraryPath = ""
[JuiceAgent.Modules]
[JuiceAgent.Modules.JarLoader]
Enabled = true
InjectionDir = "./injection"
JarPath = "./MyCustomJar.jar"
EntryClass = "Example.Main"
EntryMethod = "run"
```
v2(当前):
```toml
[JuiceAgent]
Version = 2
JuiceAgentNativeLibraryPath = ""
[JarLoader]
Enabled = true
Mode = "BuiltIn"
InjectionDir = "./injection"
JarPath = "./MyCustomJar.jar"
EntryClass = "Example.Main"
EntryMethod = "run"
```
迁移要点:
- `Version` 由 `1` 改为 `2`。
- `JuiceAgentNativeLibraryPath` 由 `[JuiceAgent.Loader]` 移到 `[JuiceAgent]`。
- 原 `[JuiceAgent.Modules.JarLoader]` 展平为顶层 `[JarLoader]`。
- 新增必填项 `Mode`(`BuiltIn` 或 `CustomJar`)。
- 完整说明见 [docs/config.md](../config.md)。
### ✨ 新功能
- 新增两种 JAR 加载模式(`JarLoader.Mode`):
- `BuiltIn`(推荐):加载器解出内嵌的 JuiceAgent-API jar 并注入系统类加载器,agent 通过 API 引导,再由 JarLoader 模块加载目标 JAR 并调用入口方法。
- `CustomJar`:不再使用 JuiceAgent-API,加载器直接把 `JarPath` 加入系统类加载器并调用 `EntryClass.EntryMethod`,便于接入自定义引导。
- 新增 `JarLoader.Enabled` 开关(默认 `false`),可在 `BuiltIn` 模式下关闭 JarLoader 模块。
- 新增配置解析与访问的错误日志:配置缺失或类型不匹配时会给出明确提示。
### 🐛 修复
- 修复自定义 JAR 入口类查找失败:将类名规范化为 JNI 内部形式(`.` → `/`),`FindClass` 现在能正确解析 `Example.Main` 这类 Java 二进制名(修复 `NoClassDefFoundError`)。
- 修复集成测试的二进制拷贝脚本 `tests/copy-bin.bat`:改用原生 `COPY /Y`,在目标文件被占用时明确报错,不再静默失败导致测试使用旧二进制。
- 修复 `GetClassBytesByName` 集成测试:先加载目标类再按名获取字节码(该 API 只解析已加载的类)。
### 🔧 内部改动
- TOML 解析器由 `toml11` 迁移到 `toml++`。
- 移除未使用的 `LoaderConfig` / `get_loader_config` / `print_loader_config`(其中仍引用着 v1 的配置键)。
### 📝 文档
- 新增 [docs/config.md](../config.md):完整的 v2 配置参考(含两种模式流程与各键默认值)。
- 重写 [docs/advanced.md](../advanced.md):改为描述 `JarLoader.Mode = "CustomJar"`,移除已废弃的 `JUICEAGENT_API_*` 环境变量说明。
- README(中/英)的 Quick Start 配置示例升级到 v2 并链接 `docs/config.md`;示例列表补充 `inject-via-java-api`。
- 同步更新 `examples/inject-via-java-api` 的说明文档(中/英,md/txt)。
---
## English
### ⚠️ Breaking Changes
- **Configuration upgraded to v2**: `CONFIG_VERSION` is now `2`. The loader validates `JuiceAgent.Version` at startup and refuses to load on a mismatch, so existing v1 configs must be migrated first.
v1 (no longer supported):
```toml
[JuiceAgent]
Version = 1
[JuiceAgent.Loader]
JuiceAgentNativeLibraryPath = ""
[JuiceAgent.Modules]
[JuiceAgent.Modules.JarLoader]
Enabled = true
InjectionDir = "./injection"
JarPath = "./MyCustomJar.jar"
EntryClass = "Example.Main"
EntryMethod = "run"
```
v2 (current):
```toml
[JuiceAgent]
Version = 2
JuiceAgentNativeLibraryPath = ""
[JarLoader]
Enabled = true
Mode = "BuiltIn"
InjectionDir = "./injection"
JarPath = "./MyCustomJar.jar"
EntryClass = "Example.Main"
EntryMethod = "run"
```
Migration:
- `Version`: `1` → `2`.
- `JuiceAgentNativeLibraryPath` moved from `[JuiceAgent.Loader]` to `[JuiceAgent]`.
- `[JuiceAgent.Modules.JarLoader]` flattened to a top-level `[JarLoader]`.
- New required key `Mode` (`BuiltIn` or `CustomJar`).
- Full reference: [docs/config.md](../config.md).
### ✨ Features
- Two JAR loading modes (`JarLoader.Mode`):
- `BuiltIn` (recommended): the loader extracts the embedded JuiceAgent-API jar and adds it to the system class loader, the agent bootstraps it, and the JarLoader module loads the target JAR and invokes its entry method.
- `CustomJar`: JuiceAgent-API is not used; the loader adds `JarPath` to the system class loader and invokes `EntryClass.EntryMethod`, so you can plug in your own bootstrap.
- New `JarLoader.Enabled` switch (default `false`) to turn the JarLoader module off in `BuiltIn` mode.
- New logging for config parse and access errors, with clear messages when a key is missing or has the wrong type.
### 🐛 Fixes
- Fix entry class lookup for custom jars: class names are normalized to the JNI internal form (`.` → `/`) so `FindClass` resolves Java binary names like `Example.Main` (fixes `NoClassDefFoundError`).
- Fix the integration test helper `tests/copy-bin.bat`: it now uses native `COPY /Y` and reports a clear error when a target file is locked, instead of failing silently and testing against stale binaries.
- Fix the `GetClassBytesByName` integration test: load the target class before looking it up by name (the API only resolves already-loaded classes).
### 🔧 Internal
- Migrate the TOML parser from `toml11` to `toml++`.
- Remove the unused `LoaderConfig` / `get_loader_config` / `print_loader_config` (which still referenced a v1 config key).
### 📝 Docs
- Add [docs/config.md](../config.md): the complete v2 configuration reference (mode workflows and key defaults).
- Rewrite [docs/advanced.md](../advanced.md) around `JarLoader.Mode = "CustomJar"`, dropping the removed `JUICEAGENT_API_*` environment variables.
- Update the Quick Start config example in both READMEs to v2 and link `docs/config.md`; add `inject-via-java-api` to the examples list.
- Update the `examples/inject-via-java-api` guides (EN/ZH, md/txt).
---
如果您在使用过程中遇到问题,可以加入我们的QQ/Discord群组
If you encounter any issues during use, you can join our QQ/Discord group
Discord: [JuiceDev](https://discord.gg/AQTnUyWNNJ)
QQ群: 1103504356
**Full Changelog**: https://github.com/xiaozhou233/JuiceAgent/compare/v4.1.2...v5.0.0