Metadata-Version: 2.4
Name: openearth-ai
Version: 0.4.7
Summary: Self-evolving agent system — 越用越强 · 明文优先,权重兜底
Project-URL: Homepage, https://github.com/coo-2022/OpenEarth
Requires-Python: >=3.9
Requires-Dist: beautifulsoup4>=4.12
Requires-Dist: eval-type-backport>=0.2; python_version < '3.10'
Requires-Dist: fastapi>=0.110
Requires-Dist: lxml>=4.9
Requires-Dist: markitdown>=0.0.1
Requires-Dist: pydantic-ai-slim[openai]>=1.0
Requires-Dist: pydantic>=2
Requires-Dist: pymupdf>=1.23
Requires-Dist: python-docx>=1.1
Requires-Dist: python-pptx>=0.6.23
Requires-Dist: pyyaml>=6
Requires-Dist: trafilatura>=1.6
Requires-Dist: uvicorn>=0.29
Provides-Extra: agent
Requires-Dist: openai>=1.0; extra == 'agent'
Provides-Extra: codegraph
Requires-Dist: tree-sitter-python>=0.23; extra == 'codegraph'
Requires-Dist: tree-sitter>=0.23; extra == 'codegraph'
Provides-Extra: connectors
Provides-Extra: dev
Requires-Dist: httpx>=0.27; extra == 'dev'
Requires-Dist: pytest>=7; extra == 'dev'
Provides-Extra: light
Provides-Extra: spreadsheet
Requires-Dist: openpyxl>=3; extra == 'spreadsheet'
Provides-Extra: swebench
Requires-Dist: pandas>=2; extra == 'swebench'
Requires-Dist: pyarrow>=10; extra == 'swebench'
Requires-Dist: swebench>=2; extra == 'swebench'
Requires-Dist: unidiff>=0.7; extra == 'swebench'
Description-Content-Type: text/markdown

<div align="center">

# OpenEarth

**Self-evolving agent system — 让你的 coding agent 越用越强。**

[![CI](https://github.com/coo-2022/OpenEarth/actions/workflows/ci.yml/badge.svg)](https://github.com/coo-2022/OpenEarth/actions/workflows/ci.yml)
[![Release](https://img.shields.io/github/v/release/coo-2022/OpenEarth?sort=semver&color=E07A5F)](https://github.com/coo-2022/OpenEarth/releases)
[![Python](https://img.shields.io/badge/python-3.10–3.13-4A90B8)](https://github.com/coo-2022/OpenEarth)

[English](README.en.md) · 简体中文

</div>

## 介绍

OpenEarth 把 agent 运行过程中的**全部经验** —— 轨迹、技能、知识、记忆 —— 沉淀成可检视、可演进、可分享的明文数据,下次会话直接用上,越用越强。

- 📡 **无感采集**:后台读各 agent 原生会话库(零插桩),采下完整轨迹(思考 / 工具调用 / 结果),训练与推理共用一套。
- 🗂️ **经验即数据**:轨迹 / 技能 / 知识 / 记忆进同一个明文 git store,可检视、可版本化、可分享。
- 🌿 **从经验演进**:在 `train/*` 分支上从轨迹蒸馏技能,**无回退 gate** 通过才合并进 `main`。
- 📚 **知识库**:文档摄入成可检索 wiki,agent 直接读。
- 🔌 **多 agent**:opencode · claude-code · codex · cursor · codeagent。

## 安装

OpenEarth 有三种角色:

| 角色 | 场景 | 需要 LLM | 连接 |
|---|---|---|---|
| **standalone** | 个人使用,全部本地闭环 | 是 | 不连接 OpenEarth server |
| **server** | 接受 client push,提供 pull,承载文档解析 | 是 | 监听 HTTP |
| **client** | 与 server 同步轨迹 / 知识 / 技能 | 否 | 连 server |

> **把对应模式的 skill 复制给你的 agent,它会自动装好。** 详细部署指南见 [docs/deployment.md](docs/deployment.md)。

### standalone / server

````markdown
---
name: openearth-setup
description: 安装并初始化 OpenEarth standalone 或 server 模式。
---

# openearth-setup

**不要索要或回显 API key 明文**,需要就让用户设环境变量。

## 1. 装包

```bash
pip install openearth-ai
```

Windows 如果 Python < 3.10,从 python.org 装新版。Linux (Ubuntu 24.04) 用 venv:
```bash
python3 -m venv ~/.venv-openearth && ~/.venv-openearth/bin/pip install openearth-ai
```

## 2. 设环境变量

**API key 只能放环境变量,不要 echo 明文。**

Windows (PowerShell,重开终端生效):
```powershell
setx OPENEARTH_DOMAIN_AGENT_KEY "sk-..."
```

Linux:
```bash
export OPENEARTH_DOMAIN_AGENT_KEY=sk-...      # 加到 ~/.bashrc 或 ~/.profile
```

## 3. 初始化配置

```bash
openearth config --init
```

编辑 `~/.openearth/config.yaml`,确认 `domain_agent`(`base_url` / `model`),`api_key` 保持 `env:` 形式:

```yaml
domain_agent:
  agent_backend: pydantic-ai
  model: <your-model>
  base_url: https://<your-openai-compatible-endpoint>/v1
  api_key: env:OPENEARTH_DOMAIN_AGENT_KEY
```

> 如果 LLM endpoint 在内网,确认 `no_proxy` 包含其 IP,否则 LLM 请求走 proxy 会被拒绝。

## 4a. standalone:直接启动

```bash
openearth install         # 装技能 + 写 Knowledge pointer + 起 daemon
openearth service status
openearth agents
```

## 4b. server:onboard 后启动

```bash
openearth onboard --role server --host 0.0.0.0 --port <port>
openearth service start
```

`onboard` 会保留上一步的 LLM 配置并打印 **join token**(保存好,client 用它连接)。
daemon 运行 knowledge / trajectory / skills / link 服务。

## 5. 加文档到知识库

```bash
openearth knowledge ingest <path>
openearth knowledge progress
```
````

### client

````markdown
---
name: openearth-client-setup
description: 安装 openearth client,连接到已运行的 server。
---

# openearth-client-setup

client 不需要 LLM 配置 —— 文档解析在 server 端完成。

## 1. 装包

```bash
pip install openearth-ai
```

## 2. Onboard 为 client

需要 server 的 URL 和 join token:

```bash
openearth onboard --role client \
  --server-url http://<server-ip>:<server-port> \
  --token <join-token> \
  --materialize
```

## 3. 启动 daemon

```bash
openearth service start
openearth service status
```

daemon 自动连接 server、上传轨迹、拉取知识 / 技能、安装到本地 agent(materialize)。

## 4. 提交文档

```bash
openearth doc submit <file> --topic "<topic>"
openearth doc status <job-id>
```
````

锁版本 / 离线:到 [Releases](https://github.com/coo-2022/OpenEarth/releases) 下载 `.whl`,`pip install openearth_ai-<ver>-py3-none-any.whl`。
