Skip to content

Commit 404efb6

Browse files
authored
Merge pull request #110 from SWangHash/wc/rebase_2
Add SECURITY.md policy and enhance tool handling features
2 parents eebfd75 + f3d1ecc commit 404efb6

867 files changed

Lines changed: 68451 additions & 31252 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ jobs:
9797
- name: Run core Rust tests
9898
run: cargo test --locked -p bitfun-core
9999

100+
- name: Run desktop Rust tests
101+
run: cargo test --locked -p bitfun-desktop
102+
100103
# ── Frontend: build ────────────────────────────────────────────────
101104
frontend-build:
102105
name: Frontend Build

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,5 @@ Cross.toml
7979
ASSETS_LICENSES.md
8080

8181
external/
82+
/.bitfun/search/flashgrep-index/
83+
.agents/

‎AGENTS-CN.md‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,28 @@ BitFun 是一个由 Rust workspace 与 React 前端组成的项目。
1515

1616
## 分层模块索引
1717

18-
依赖关系按自上而下读取:上层只能依赖下层,同层 crate 也应保持最小依赖。
18+
依赖关系按自上而下读取。下表是物理 crate 布局,不是完整概念架构;Product Feature、Agent Kernel、
19+
Execution、Extension、Cross-platform Adapter 的边界以
20+
[`docs/architecture/core-decomposition.md`](docs/architecture/core-decomposition.md)
21+
为准。同层 crate 也应保持最小依赖。
1922

2023
| # | 层级 | 路径 | 职责 | 模块 / 入口 | 层级文档 |
2124
|---|---|---|---|---|---|
2225
| 1 | 接口与入口层 | `src/apps/*`, `src/web-ui`, `src/mobile-web`, `BitFun-Installer`, `tests/e2e`, `src/crates/interfaces` | 产品宿主、命令、UI 入口、协议接口和跨形态测试 | desktop、CLI、server、relay、Web UI、mobile web、installer、E2E、`acp` | 最近的本地 `AGENTS.md`;[interfaces](src/crates/interfaces/AGENTS.md) |
2326
| 2 | 产品组装层 | `src/crates/assembly` | 兼容导出、产品能力选择、product-full 接线和 adapter/service 注册 | `core`, `product-capabilities` | [AGENTS.md](src/crates/assembly/AGENTS.md) |
2427
| 3 | 适配层 | `src/crates/adapters` | AI/API/transport/WebDriver 协议 adapter 和外部 provider 转换 | `ai-adapters`, `api-layer`, `transport`, `webdriver` | [AGENTS.md](src/crates/adapters/AGENTS.md) |
25-
| 4 | 服务实现层 | `src/crates/services` | 可复用 OS、filesystem、terminal、MCP、remote、git、watch、process、session persistence primitives、network 和 MiniApp runtime IO 实现 | `services-core`, `services-integrations`, `terminal` | [AGENTS.md](src/crates/services/AGENTS.md) |
28+
| 4 | 服务实现层 | `src/crates/services` | 可复用 OS、filesystem、terminal、MCP、remote、git、watch、process、LSP plugin registry、session persistence primitives、network 和 MiniApp runtime IO 实现 | `services-core`, `services-integrations`, `terminal` | [AGENTS.md](src/crates/services/AGENTS.md) |
2629
| 5 | 执行原语层 | `src/crates/execution` | 可移植 agent、harness、stream、DeepReview policy/report、typed-service、tool-contract、tool-group 和 tool-execution 构件 | `agent-runtime`, `agent-stream`, `tool-contracts`, `harness`, `runtime-services`, `tool-provider-groups`, `tool-execution` | [AGENTS.md](src/crates/execution/AGENTS.md) |
27-
| 6 | 稳定契约与产品领域层 | `src/crates/contracts` | 跨层共享 DTO、事件形状、runtime port、产品领域契约和策略 | `core-types`, `events`, `runtime-ports`, `product-domains` | [AGENTS.md](src/crates/contracts/AGENTS.md) |
30+
| 6 | 稳定契约与产品领域层 | `src/crates/contracts` | 跨层共享 DTO、事件形状、runtime port、LSP protocol/plugin DTO、产品领域契约和策略 | `core-types`, `events`, `runtime-ports`, `product-domains` | [AGENTS.md](src/crates/contracts/AGENTS.md) |
2831

2932
边界规则:
3033

3134
- 接口与入口层暴露选定产品行为;可复用行为应下移。
3235
- 组装层只接线下层并选择产品能力事实,不实现具体 adapter、OS 或 service 细节。
33-
- 适配层翻译协议和外部系统,不拥有产品能力选择或可复用 OS service 行为。
34-
- 服务实现层负责可复用的 OS、process、terminal、MCP、remote、git、filesystem、session persistence primitives 和 MiniApp runtime IO 能力。
36+
- 产品特性只在内核能力之上组装用户侧命令、UI contribution、设置和默认策略;长程任务、scheduler、permission、session/workspace、memory、DFX、hook 和 event 事实属于 Agent Kernel owner。
37+
- 适配层翻译协议和外部 provider 形状,不拥有产品能力选择或可复用 OS service 行为。
38+
- 服务实现层负责可复用的 OS、process、terminal、MCP、remote、git、filesystem、LSP plugin registry、session persistence primitives 和 MiniApp runtime IO 能力。
39+
- 外部系统是边界外资源,不是仓库内层级。只有已注册的 adapter、service 或 app-local provider 应调用它们;其他层消费 port 和稳定契约。
3540
- 执行原语层只放可移植运行时构件,不拥有宿主或交付形态。
3641
- 契约层保持轻行为,不得向上依赖。
3742

‎AGENTS.md‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,29 @@ Repository rule: **keep product logic platform-agnostic, then expose it through
1515

1616
## Layered Module Index
1717

18-
Dependencies flow top to bottom. A layer may depend on lower layers only; keep
19-
crate dependencies inside each layer to the smallest set needed.
18+
Dependencies flow top to bottom. This table is the physical crate layout, not
19+
the full conceptual architecture. For Product Feature / Agent Kernel /
20+
Execution / Extension / Cross-platform Adapter boundaries, read
21+
[`docs/architecture/core-decomposition.md`](docs/architecture/core-decomposition.md).
22+
Keep crate dependencies inside each layer to the smallest set needed.
2023

2124
| # | Layer | Path | Owns | Modules / entries | Layer doc |
2225
|---|---|---|---|---|---|
2326
| 1 | Interfaces and entrypoints | `src/apps/*`, `src/web-ui`, `src/mobile-web`, `BitFun-Installer`, `tests/e2e`, `src/crates/interfaces` | Product hosts, commands, UI entrypoints, protocol interfaces, and cross-surface tests | desktop, CLI, server, relay, Web UI, mobile web, installer, E2E, `acp` | nearest local `AGENTS.md`; [interfaces](src/crates/interfaces/AGENTS.md) |
2427
| 2 | Product assembly | `src/crates/assembly` | Compatibility exports, product capability selection, product-full wiring, and adapter/service registration | `core`, `product-capabilities` | [AGENTS.md](src/crates/assembly/AGENTS.md) |
2528
| 3 | Adapters | `src/crates/adapters` | AI/API/transport/WebDriver protocol adapters and external-provider translation | `ai-adapters`, `api-layer`, `transport`, `webdriver` | [AGENTS.md](src/crates/adapters/AGENTS.md) |
26-
| 4 | Services | `src/crates/services` | Reusable OS, filesystem, terminal, MCP, remote, git, watch, process, session persistence primitives, MiniApp runtime IO, and network implementations | `services-core`, `services-integrations`, `terminal` | [AGENTS.md](src/crates/services/AGENTS.md) |
29+
| 4 | Services | `src/crates/services` | Reusable OS, filesystem, terminal, MCP, remote, git, watch, process, LSP plugin registry, session persistence primitives, MiniApp runtime IO, and network implementations | `services-core`, `services-integrations`, `terminal` | [AGENTS.md](src/crates/services/AGENTS.md) |
2730
| 5 | Execution primitives | `src/crates/execution` | Portable agent, harness, stream, DeepReview policy/report, typed-service, tool-contract, tool-group, and tool-execution building blocks | `agent-runtime`, `agent-stream`, `tool-contracts`, `harness`, `runtime-services`, `tool-provider-groups`, `tool-execution` | [AGENTS.md](src/crates/execution/AGENTS.md) |
28-
| 6 | Stable contracts and product domains | `src/crates/contracts` | Shared DTOs, event shapes, runtime ports, and product domain contracts/policies | `core-types`, `events`, `runtime-ports`, `product-domains` | [AGENTS.md](src/crates/contracts/AGENTS.md) |
31+
| 6 | Stable contracts and product domains | `src/crates/contracts` | Shared DTOs, event shapes, runtime ports, LSP protocol/plugin DTOs, and product domain contracts/policies | `core-types`, `events`, `runtime-ports`, `product-domains` | [AGENTS.md](src/crates/contracts/AGENTS.md) |
2932

3033
Boundary rules:
3134

3235
- Interfaces and app entrypoints expose selected product behavior; reusable behavior moves down.
3336
- Assembly wires lower layers and selects product capability facts; it must not implement concrete adapter, OS, or service details.
34-
- Adapters translate protocols and external systems; they should not own product capability selection or reusable OS service behavior.
35-
- Services implement reusable concrete OS, process, terminal, MCP, remote, git, filesystem, and MiniApp runtime IO capabilities.
37+
- Product features assemble user-facing commands, UI contributions, settings, and default policy on top of kernel capabilities; long-running task, scheduler, permission, session/workspace, memory, DFX, hook, and event facts stay in Agent Kernel owners.
38+
- Adapters translate protocols and external-provider shapes; they should not own product capability selection or reusable OS service behavior.
39+
- Services implement reusable concrete OS, process, terminal, MCP, remote, git, filesystem, LSP plugin registry, and MiniApp runtime IO capabilities.
40+
- External systems are boundary resources, not repository layers. Only registered adapters/services/app-local providers should call them; other layers consume ports and stable contracts.
3641
- Execution crates are portable runtime building blocks, not host-specific or delivery-profile owners.
3742
- Contracts stay behavior-light and must not depend upward.
3843

‎BitFun-Installer/package-lock.json‎

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

‎BitFun-Installer/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bitfun-installer",
3-
"version": "0.2.10",
3+
"version": "0.2.12",
44
"private": true,
55
"type": "module",
66
"description": "BitFun Custom Installer - Modern branded installation experience",

‎BitFun-Installer/src-tauri/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bitfun-installer"
3-
version = "0.2.10"
3+
version = "0.2.12"
44
authors = ["BitFun Team"]
55
edition = "2021"
66
description = "BitFun Custom Installer - Modern branded installation experience"

‎BitFun-Installer/src-tauri/src/installer/types.rs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ impl From<bitfun_ai_adapters::types::RemoteModelInfo> for RemoteModelInfo {
7070
pub enum ConnectionTestMessageCode {
7171
ToolCallsNotDetected,
7272
ImageInputCheckFailed,
73+
TlsOrCertificateIssue,
74+
ProxyIssue,
75+
NetworkIssue,
7376
}
7477

7578
impl From<bitfun_ai_adapters::types::ConnectionTestMessageCode> for ConnectionTestMessageCode {
@@ -81,6 +84,13 @@ impl From<bitfun_ai_adapters::types::ConnectionTestMessageCode> for ConnectionTe
8184
bitfun_ai_adapters::types::ConnectionTestMessageCode::ImageInputCheckFailed => {
8285
Self::ImageInputCheckFailed
8386
}
87+
bitfun_ai_adapters::types::ConnectionTestMessageCode::TlsOrCertificateIssue => {
88+
Self::TlsOrCertificateIssue
89+
}
90+
bitfun_ai_adapters::types::ConnectionTestMessageCode::ProxyIssue => Self::ProxyIssue,
91+
bitfun_ai_adapters::types::ConnectionTestMessageCode::NetworkIssue => {
92+
Self::NetworkIssue
93+
}
8494
}
8595
}
8696
}

‎BitFun-Installer/src/pages/LanguageSelect.tsx‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ export function LanguageSelect({ onSelect }: LanguageSelectProps) {
4444
<img src={logoUrl} alt="BitFun" style={{
4545
display: 'block', margin: '0 auto 16px',
4646
width: 56, height: 56, borderRadius: 14,
47-
filter: 'drop-shadow(0 0 40px rgba(100, 180, 255, 0.15))',
47+
filter: 'drop-shadow(0 0 40px var(--color-accent-100))',
4848
}} />
4949
<h1 style={{
5050
fontFamily: 'var(--font-sans)', fontSize: 42, fontWeight: 700,
5151
color: 'var(--color-text-primary)', letterSpacing: '-0.03em',
5252
lineHeight: 0.95, margin: '0 0 16px 0',
53-
textShadow: '0 0 60px rgba(100, 180, 255, 0.3)',
53+
textShadow: '0 0 60px var(--color-accent-200)',
5454
}}>BitFun</h1>
5555
</div>
5656

@@ -72,7 +72,7 @@ export function LanguageSelect({ onSelect }: LanguageSelectProps) {
7272
opacity: 0.6,
7373
letterSpacing: '0.5px',
7474
}}>
75-
Version 0.2.10
75+
Version 0.2.12
7676
</div>
7777
</div>
7878
</div>
@@ -106,9 +106,9 @@ export function LanguageSelect({ onSelect }: LanguageSelectProps) {
106106
style={{
107107
display: 'flex', alignItems: 'center', gap: 12,
108108
padding: '14px 16px', width: '100%',
109-
background: isSelected ? 'rgba(96, 165, 250, 0.14)' : 'rgba(148, 163, 184, 0.08)',
109+
background: isSelected ? 'var(--color-accent-100)' : 'var(--element-bg-subtle)',
110110
border: 'none',
111-
borderRadius: 'var(--radius-sm)',
111+
borderRadius: 'var(--size-radius-sm)',
112112
cursor: 'pointer', textAlign: 'left',
113113
transition: 'all 0.25s ease',
114114
outline: 'none',
@@ -117,12 +117,12 @@ export function LanguageSelect({ onSelect }: LanguageSelectProps) {
117117
}}
118118
onMouseEnter={(e) => {
119119
if (!isSelected) {
120-
e.currentTarget.style.background = 'rgba(148, 163, 184, 0.14)';
120+
e.currentTarget.style.background = 'var(--element-bg-soft)';
121121
}
122122
}}
123123
onMouseLeave={(e) => {
124124
if (!isSelected) {
125-
e.currentTarget.style.background = 'rgba(148, 163, 184, 0.08)';
125+
e.currentTarget.style.background = 'var(--element-bg-subtle)';
126126
}
127127
}}
128128
>

‎BitFun-Installer/src/pages/Options.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export function Options({
107107
</div>
108108
) : null}
109109
{!existingInstall.mainBinaryPresent ? (
110-
<div style={{ marginBottom: 8, color: 'var(--color-warning, #c9a227)' }}>
110+
<div style={{ marginBottom: 8, color: 'var(--color-warning)' }}>
111111
{t('options.existingInstallBinaryMissing')}
112112
</div>
113113
) : null}

0 commit comments

Comments
 (0)