Skip to content
Merged
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
23 changes: 0 additions & 23 deletions JaxI18n.slnx

This file was deleted.

23 changes: 23 additions & 0 deletions LocaleSmith.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Solution>
<Folder Name="/src/">
<Project Path="src/LocaleSmith.App/LocaleSmith.App.csproj" />
<Project Path="src/LocaleSmith.Application/LocaleSmith.Application.csproj" />
<Project Path="src/LocaleSmith.Archive/LocaleSmith.Archive.csproj" />
<Project Path="src/LocaleSmith.Core/LocaleSmith.Core.csproj" />
<Project Path="src/LocaleSmith.Infrastructure/LocaleSmith.Infrastructure.csproj" />
<Project Path="src/LocaleSmith.Mcp/LocaleSmith.Mcp.csproj" />
<Project Path="src/LocaleSmith.McpHost/LocaleSmith.McpHost.csproj" />
<Project Path="src/LocaleSmith.NativeInterop/LocaleSmith.NativeInterop.csproj" />
<Project Path="src/LocaleSmith.Presentation/LocaleSmith.Presentation.csproj" />
</Folder>
<Folder Name="/tests/">
<Project Path="tests/LocaleSmith.App.Tests/LocaleSmith.App.Tests.csproj" />
<Project Path="tests/LocaleSmith.Application.Tests/LocaleSmith.Application.Tests.csproj" />
<Project Path="tests/LocaleSmith.Archive.Tests/LocaleSmith.Archive.Tests.csproj" />
<Project Path="tests/LocaleSmith.Core.Tests/LocaleSmith.Core.Tests.csproj" />
<Project Path="tests/LocaleSmith.Infrastructure.Tests/LocaleSmith.Infrastructure.Tests.csproj" />
<Project Path="tests/LocaleSmith.Mcp.Tests/LocaleSmith.Mcp.Tests.csproj" />
<Project Path="tests/LocaleSmith.NativeInterop.Tests/LocaleSmith.NativeInterop.Tests.csproj" />
<Project Path="tests/LocaleSmith.Presentation.Tests/LocaleSmith.Presentation.Tests.csproj" />
</Folder>
</Solution>
66 changes: 38 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

<div align="center">
<img
src="./packaging/JaxI18n.Package/Assets/Square150x150Logo.png"
src="./packaging/LocaleSmith.Package/Assets/Square150x150Logo.png"
width="132"
alt="LocaleSmith 标志"
/>

<h1>LocaleSmith · 译匠</h1>
<h1>LocaleSmith | 译匠</h1>

<p><strong>为 Minecraft Java 内容打造的 Windows 原生 AI 本地化工作台</strong></p>
<p>安全扫描模组与资源包,连接本地或云端模型,以可验证、可回滚的流水线生成本地化产物。</p>
Expand All @@ -24,6 +24,7 @@
<a href="#项目概览">项目概览</a> ·
<a href="#核心能力">核心能力</a> ·
<a href="#快速开始">快速开始</a> ·
<a href="#翻译日志与持久化设置">翻译日志</a> ·
<a href="#安全边界">安全边界</a> ·
<a href="#开源许可">开源许可</a>
</p>
Expand All @@ -34,7 +35,7 @@

## 项目概览

LocaleSmith(译匠)面向 Minecraft: Java Edition 模组、资源包与光影包,将**安全扫描、增量翻译、结构验证和事务重建**整合进一个 Windows 原生桌面工作台。
**LocaleSmith | 译匠**,面向 Minecraft: Java Edition 模组、资源包与光影包,将**安全扫描、增量翻译、结构验证和事务重建**整合进一个 Windows 原生桌面工作台。

项目采用 Rust 原生扫描核心与 .NET 10 / WinUI 3 桌面应用:Rust 负责 JAR、ZIP、Loader 元数据和受支持字节码模式的解析,.NET 负责归档事务、模型接入、安全存储、翻译队列与用户界面。

Expand All @@ -45,7 +46,9 @@ LocaleSmith(译匠)面向 Minecraft: Java Edition 模组、资源包与光
| **安全归档扫描** | 识别路径穿越、Loader 元数据、语言资源、签名证据与受支持的 Java 字符串引用。 |
| **增量翻译流水线** | 按内容哈希复用译文,校验占位符与结构,并在失败时回滚整个作业。 |
| **多模型接入** | 统一支持 Ollama、OpenAI-compatible Chat Completions 与 Anthropic Messages。 |
| **原生桌面体验** | 提供首次引导、翻译队列、双语助手、模型源管理、设置和 CLI 风险确认。 |
| **提供方预设** | DeepSeek、Qwen、MiMo、MiniMax、OpenAI、豆包、智谱与 Kimi 等预设会同步填充服务地址、模型名和推荐 Token 字段;也可明确选择不发送 Token 上限字段。 |
| **持久化诊断日志** | 日志目录可写时,每次翻译在后台有界写入独立的 Debug 与 All levels `.log`;可在左侧“日志”页查看并在引导或设置中修改目录。 |
| **原生桌面体验** | 提供首次引导、翻译队列、双语助手、模型源管理、日志、设置和 CLI 风险确认。 |
| **凭据与配置保护** | API Key 存入 Windows Credential Manager,其他配置使用 AES-256-GCM 加密。 |
| **受控 MCP / CLI** | 模型只能读取安全上下文并提出命令;执行必须经过策略复核和用户明确确认。 |

Expand Down Expand Up @@ -75,6 +78,12 @@ flowchart LR

每个作业只生成用户选择的一种翻译风格。另一种风格可以单独入队,并复用相同原文哈希下已经缓存的对应译文。

## 翻译日志与持久化设置

左侧导航中的“日志”页按翻译作业列出持久化记录,并默认显示 Debug 视图;切换到 All levels 可查看包含细粒度进度在内的完整级别记录。日志是最大限度的后台诊断功能:目录正常可写且写入器有容量时,作业会创建一对 `.debug.log` / `.all.log` 文件并增量刷新到磁盘;慢设备或队列已满时可能跳过文件或丢弃部分诊断条目,但不会阻塞翻译。进程异常退出后,已经成功刷新的内容仍可用于定位最后一个阶段。

默认目录为 `%LOCALAPPDATA%\LocaleSmith\logs\translations`。首次引导和“设置”页都可以浏览或手动修改为本地目录;更改保存后从下一次翻译起生效,并会在软件关闭时与语言、主题、工作区等最后一次有效设置一起写入加密配置。程序只保留并列出最新 500 次会话;清理仅匹配 LocaleSmith 自有命名格式,不删除目录内的其他文件。日志仅记录任务 ID、包文件名、阶段、进度、结果与错误类型,不写入 API Key、完整提示词或用户选择路径的父目录;常见 Bearer / Token / API Key 形式还会在写盘前再次脱敏。

## 快速开始

### 环境要求
Expand All @@ -96,41 +105,41 @@ flowchart LR
git clone https://github.com/DZXH-TX/LocaleSmith.git
Set-Location LocaleSmith

cargo build --manifest-path native/jax_i18n_core/Cargo.toml --release
dotnet restore JaxI18n.slnx
dotnet build JaxI18n.slnx -c Release
cargo build --manifest-path native/localesmith_core/Cargo.toml --release
dotnet restore LocaleSmith.slnx
dotnet build LocaleSmith.slnx -c Release
```

> [!NOTE]
> `dotnet build JaxI18n.slnx` 不会生成 WAP / MSIX;打包工程位于 `packaging/JaxI18n.Package`,需要在具备对应 Visual Studio targets 的开发环境中单独构建。
> `dotnet build LocaleSmith.slnx` 不会生成 WAP / MSIX;打包工程位于 `packaging/LocaleSmith.Package`,需要在具备对应 Visual Studio targets 的开发环境中单独构建。

<details>
<summary><strong>运行完整验证门</strong></summary>

```powershell
cargo fmt --manifest-path native/jax_i18n_core/Cargo.toml --all -- --check
cargo clippy --manifest-path native/jax_i18n_core/Cargo.toml --all-targets --all-features -- -D warnings
cargo test --manifest-path native/jax_i18n_core/Cargo.toml --all-targets
cargo fmt --manifest-path native/localesmith_core/Cargo.toml --all -- --check
cargo clippy --manifest-path native/localesmith_core/Cargo.toml --all-targets --all-features -- -D warnings
cargo test --manifest-path native/localesmith_core/Cargo.toml --all-targets

dotnet test JaxI18n.slnx -c Release
dotnet format JaxI18n.slnx --verify-no-changes --no-restore
dotnet test LocaleSmith.slnx -c Release
dotnet format LocaleSmith.slnx --verify-no-changes --no-restore
```

</details>

## 源码结构

```text
native/jax_i18n_core/ Rust ZIP/JAR、metadata 与 classfile 扫描核心
src/JaxI18n.Core/ 领域模型和统一服务契约
src/JaxI18n.NativeInterop/ C ABI 投影、DLL 解析与类型化清单
src/JaxI18n.Application/ 翻译编排、增量计划、队列与事务边界
src/JaxI18n.Archive/ 安全快照、提取、重建、验证与回滚
src/JaxI18n.Infrastructure/ 模型适配、凭据、加密、CLI 与环境检测
src/JaxI18n.Mcp/ MCP JSON-RPC / stdio 协议与工具目录
src/JaxI18n.McpHost/ 独立 MCP 控制台宿主
src/JaxI18n.Presentation/ 可测试的 MVVM ViewModel 与 UI 契约
src/JaxI18n.App/ WinUI 3 视图、组合根和本地应用服务
native/localesmith_core/ Rust ZIP/JAR、metadata 与 classfile 扫描核心
src/LocaleSmith.Core/ 领域模型和统一服务契约
src/LocaleSmith.NativeInterop/ C ABI 投影、DLL 解析与类型化清单
src/LocaleSmith.Application/ 翻译编排、增量计划、队列与事务边界
src/LocaleSmith.Archive/ 安全快照、提取、重建、验证与回滚
src/LocaleSmith.Infrastructure/ 模型适配、凭据、加密、CLI 与环境检测
src/LocaleSmith.Mcp/ MCP JSON-RPC / stdio 协议与工具目录
src/LocaleSmith.McpHost/ 独立 MCP 控制台宿主
src/LocaleSmith.Presentation/ 可测试的 MVVM ViewModel 与 UI 契约
src/LocaleSmith.App/ WinUI 3 视图、组合根和本地应用服务
tests/ 八个 .NET 测试项目和受限 CLI probe
packaging/ x64 WAP / MSIX manifest、双语资源和图标
```
Expand All @@ -141,6 +150,7 @@ packaging/ x64 WAP / MSIX manifest、双语资源和图标

- **模型不能授权命令执行。** Provider 工具循环只允许读取安全上下文和提出命令,完整命令仍需用户查看、勾选风险确认并批准。
- **签名 JAR 默认禁止修改。** 没有原作者私钥就无法保持原签名;项目只会阻断修改,或在用户明确选择后生成 unsigned copy。
- **CLI 不搜索进程 PATH。** 默认不信任任何进程型可执行文件;后续显式白名单必须使用已批准的绝对路径。私有 CLI 沙箱默认位于 `%LOCALAPPDATA%\LocaleSmith\CliSandbox`,并在创建前后检查重解析点。
- **Low IL 不等于 AppContainer。** 受限 token、私有 desktop 与 Job Object 会缩小执行面,但不会自动阻断网络,也不能阻止读取当前用户 ACL 已允许的文件。

<details>
Expand All @@ -160,14 +170,14 @@ packaging/ x64 WAP / MSIX manifest、双语资源和图标
<details>
<summary><strong>模型工具与 CLI 隔离</strong></summary>

MCP stdio Host 只暴露 `system.context` 与 `cli.propose`,不暴露 `cli.execute`。允许执行的命令必须通过动态白名单、绝对拒绝规则、工作目录与敏感参数检查,并绑定一次性确认 token;启动前审计不可写时不会启动进程。Kimi 的私有 `reasoning_content` 仅在同一 Kimi 工具循环内有界回放,不进入用户可见内容,也不会发送给其他 Provider。
MCP stdio Host 只暴露 `system.context` 与 `cli.propose`,不暴露 `cli.execute`。允许执行的命令必须来自已经批准的绝对路径,并通过绝对拒绝规则、工作目录与敏感参数检查,再绑定一次性确认 token;启动前审计不可写时不会启动进程。Kimi 的私有 `reasoning_content` 仅在同一 Kimi 工具循环内有界回放,不进入用户可见内容,也不会发送给其他 Provider。

</details>

<details>
<summary><strong>MSIX 开发包状态</strong></summary>

当前 manifest 版本为 `0.1.0.1`,开发包已完成 payload、PRI、MCP Host、开发签名和 loose AppsFolder 启动验证。但其证书为未受信任、无可信时间戳的自签名开发证书,尚未完成生产证书替换及干净机安装、升级、修复和卸载验证
当前 manifest 版本为 `0.1.0.2`。仓库中的历史开发包曾完成 payload、PRI、MCP Host、SignPath Authenticode 签名与本机启动验证,但该证据不覆盖本次源码修复;当前提交需重新生成、签名和安装验证 MSIX,微软商店上架前还需使用 Partner Center 分配的正式包身份

</details>

Expand All @@ -177,10 +187,10 @@ MCP stdio Host 只暴露 `system.context` 与 `cli.propose`,不暴露 `cli.exe

| 检查项 | 基线 |
| --- | --- |
| .NET Release | `260 / 260` tests,`0` warnings,`0` errors |
| .NET Release | `391 / 391` tests,`0` warnings,`0` errors |
| Rust | `26 / 26` tests,`rustfmt` 与 `clippy -D warnings` 通过 |
| 双语资源 | `zh-CN` / `en-US` 各 `332` 个 key,完全对齐 |
| 源码安全审计 | FINAL GREEN,P0 / P1 / P2 均为 `0` |
| 双语资源 | `zh-CN` / `en-US` 各 `366` 个 key,完全对齐 |
| 源码安全审计 | 本地路径、归档、CLI、凭据和迁移回归门通过;GitHub CodeQL 结果以当前提交的远端重扫为准,不在 README 中宣称零告警 |

这些结果证明当前自动化覆盖的源码行为,不替代外部渗透测试、真实 Provider 验证或 Minecraft / Loader 运行时兼容测试。

Expand Down
63 changes: 0 additions & 63 deletions native/jax_i18n_core/include/jax_i18n_core.h

This file was deleted.

File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[package]
name = "jax_i18n_core"
name = "localesmith_core"
version = "0.1.0"
edition = "2024"
rust-version = "1.85"
publish = false
description = "Panic-safe native archive inspection core for JAX i18n"
description = "Panic-safe native archive inspection core for LocaleSmith"

[lib]
name = "localesmith_core"
crate-type = ["cdylib", "rlib"]

[dependencies]
Expand Down
63 changes: 63 additions & 0 deletions native/localesmith_core/include/localesmith_core.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#ifndef LOCALESMITH_CORE_H
#define LOCALESMITH_CORE_H

#include <stdint.h>

#if defined(_WIN32)
# define LOCALESMITH_API __declspec(dllimport)
#else
# define LOCALESMITH_API
#endif

#ifdef __cplusplus
extern "C" {
#endif

/* Stable return/error codes. */
typedef enum localesmith_error_code {
LOCALESMITH_OK = 0,
LOCALESMITH_ERROR_NULL_POINTER = 1,
LOCALESMITH_ERROR_INVALID_UTF8 = 2,
LOCALESMITH_ERROR_IO = 3,
LOCALESMITH_ERROR_INVALID_ARCHIVE = 4,
LOCALESMITH_ERROR_LIMIT_EXCEEDED = 5,
LOCALESMITH_ERROR_UNSAFE_ARCHIVE_PATH = 6,
LOCALESMITH_ERROR_SERIALIZATION = 7,
LOCALESMITH_ERROR_PANIC = 8,
LOCALESMITH_ERROR_INVALID_ARGUMENT = 9
} localesmith_error_code;

/* Process-lifetime UTF-8 string. Do not free. */
LOCALESMITH_API const char *localesmith_core_version(void);

/* Current JSON manifest schema version. */
LOCALESMITH_API uint32_t localesmith_manifest_schema_version(void);

/*
* Scan one ZIP/JAR path encoded as NUL-terminated UTF-8.
*
* On success, returns LOCALESMITH_OK and stores a newly allocated UTF-8 JSON
* string in *out_json_utf8. Release it once with localesmith_string_free.
* On failure, *out_json_utf8 is null and the thread-local error is updated.
*/
LOCALESMITH_API int32_t localesmith_scan_archive_json(
const char *path_utf8,
char **out_json_utf8);

/* Free a non-static string returned by this library. Null is accepted. */
LOCALESMITH_API void localesmith_string_free(char *value);

/* Calling-thread error code from the most recent scan call. */
LOCALESMITH_API int32_t localesmith_last_error_code(void);

/*
* Copy the calling-thread error message into a newly allocated UTF-8 string.
* Release the result once with localesmith_string_free.
*/
LOCALESMITH_API char *localesmith_last_error_message(void);

#ifdef __cplusplus
}
#endif

#endif /* LOCALESMITH_CORE_H */
File renamed without changes.
Loading