Compare commits

26 Commits

Author SHA1 Message Date
f1a0e212e6 bump HarborForge.PlexumPlugin → bc1ab7b
snake_case SlotStatus alignment + scheduler decision logs (see
plugin repo's commit for the sim e2e findings).
2026-06-03 11:42:28 +01:00
459eca66af bump HarborForge.PlexumPlugin → 78b1ec5
Real HF backend contract alignment + sim-discovered bug fixes:
- per-agent heartbeat (header auth) replacing initial-drop guess
- bgCtx capture so background goroutines outlive Init
- toolRestartStatus stub (HF has no restart endpoint)
- scheduler tick + heartbeat outcome logs at info level
2026-06-03 11:28:14 +01:00
ed72bb91ae add HarborForge.PlexumPlugin submodule
Plexum-side counterpart to HarborForge.OpenclawPlugin. Pins to the
plugin repo's main branch (initial commit). Tracked separately from
HarborForge.OpenclawPlugin — the two plugins run side by side during
the OpenClaw → Plexum migration window.

Operator install:

  cd HarborForge.PlexumPlugin
  bash scripts/install.sh

writes a binary + manifest into ~/.plexum/plugins/harbor-forge/.
2026-06-03 11:11:54 +01:00
627ffcf2fa Bump HarborForge.Backend to Tessera bearer support
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 16:57:57 +01:00
4c5c948a24 chore: bump Backend/Cli/Frontend → main (KnowledgeBase + security-audit merges)
Backend 88779d2→1a5a3ed, Cli c0ab087→729365c, Frontend 04bb0c6→bcdf1cb.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 09:25:28 +01:00
5dda196da2 chore(submodules): bump HarborForge.Backend (users require_admin api-key auth) 2026-05-29 08:55:46 +01:00
5d7d83a433 chore(submodules): bump HarborForge.OpenclawPlugin (#12: installCli git-clone refactor) 2026-05-29 08:52:42 +01:00
71250e2ea1 chore(submodules): bump HarborForge.Cli + HarborForge.OpenclawPlugin
- HarborForge.Cli: pull main → c0ab087 (PR #8: assign-schedule-type dispatch fix)
- HarborForge.OpenclawPlugin: pull main → c8998c6 (PR #11: meta-push perf — cached api.config)
2026-05-29 08:50:00 +01:00
836bc17fd3 chore: bump Backend + Cli (project.create gate trifecta)
* HarborForge.Backend 01f6b56 → HEAD
  fix(projects): perm-gate create + apikey-via-Bearer + introspect with apikey.
  - POST /projects checks project.create perm (was hardcoded is_admin)
  - /auth/me/permissions accepts API key (was JWT-only → broke hf-cli local gate)
  - get_current_user_or_apikey falls back to API-key lookup when Authorization:
    Bearer fails JWT decode (hf-cli only emits Bearer headers)
  - init_bootstrap seeds project.create perm + assigns to mgr role
* HarborForge.Cli      a42ba6f
  fix(cli): gate `hf project create` on project.create (was project.write).

prod e2e verified: nav (mgr) /auth/me/permissions returns 26 perms
including project.create; POST /projects with nav API key returns 201.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 22:10:49 +01:00
52de061570 chore: bump Backend → 01f6b56 (seed 3 perms missing from catalog)
* HarborForge.Backend 595391b → 01f6b56
  fix(bootstrap): seed member.remove + schedule_type.read + schedule_type.manage
  into DEFAULT_PERMISSIONS — code enforced them but Role Editor couldn't
  show them. No default-role changes.

prod hf_backend v0.4.3 live; the 3 rows are now in the permissions
table on t1.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 21:18:49 +01:00
79be9f34c3 chore: bump Backend + Frontend submodule pointers
* HarborForge.Backend  54feb96 → 595391b
  feat(users): auto-default agent accounts to general-agent role
  (POST /users with agent_id sets role=general-agent, was guest).
  Also seeds general-agent in init_bootstrap _DEFAULT_ROLES.

* HarborForge.Frontend 766474f → 04bb0c6
  feat(role-editor): "Use as template" — copy another role's perm set
  Pick from dropdown → click button → replaces all checkboxes locally
  (save still required to persist).

prod cutover: hf_backend v0.4.2 + hf_frontend v0.4.3 live on t1.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 19:40:00 +01:00
45e7615b25 chore: bump HarborForge.Frontend (role editor dark-theme redesign)
* HarborForge.Frontend f587e1e → HEAD
  style(role-editor): rewrite on Foundry Deck tokens — fixes unreadable
  role names + faded check cards + washed-out banner.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 19:26:01 +01:00
ed952bdf77 chore: bump HarborForge.Frontend → f587e1e (drop localStorage backend URL)
* HarborForge.Frontend 10771a8 → f587e1e
  fix(frontend): drop localStorage HF_BACKEND_BASE_URL; env-only.
  Fixes new-browser blank MonitorPage / api 404 after v0.4.0 wizard removal
  (api.ts + useAuthConfig still had the old localStorage path; App.tsx had
  been refactored but those two were missed). All 3 read sites now read
  import.meta.env.VITE_HF_BACKEND_BASE_URL only.

prod is on frontend v0.4.1 with this fix.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 19:18:33 +01:00
b4856cea05 chore: bump HarborForge.Backend → 54feb96 (CLI model-import fix)
* HarborForge.Backend 5ea2cdf → 54feb96
  fix(cli): import all model modules so SA relationship resolution works
  (hf-cli admin list crashed with KeyError: Agent on prod cutover, fixed
   by mirroring main.py's startup() bulk-import in cli/__main__.py).

prod is on v0.4.1 with this fix in place.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 19:11:33 +01:00
87f908f16f chore: bump 4 submodule pointers — wizard removal + supporting work
* HarborForge.Backend  90b494f → 5ea2cdf  feat(backend)!: kill AbstractWizard, env-driven config + hf-cli
* HarborForge.Frontend aaf36a4 → 10771a8  feat(frontend)!: drop SetupWizardPage, backend URL via build-time VITE_*
* HarborForge.Cli      8dd58ba → b0f4aa2  feat(cli): hf user create --agent-id/--claw-identifier + hf user bind-agent
* HarborForge.OpenclawPlugin c9f6141 → c2d00c1  feat(hf-plugin): __hfAgentStatus.hasOnCallCovering(agentId, from, to)

Cuts off AbstractWizard entirely at this submodule snapshot: backend +
frontend bootstrap is operator-driven via `docker exec hf_backend hf-cli
admin create-user ...` and `hf-cli config oidc ...`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 19:04:32 +01:00
5f6c526af2 docs: translate top-level README to English
Match the language of the submodule READMEs; content unchanged
(structure, tables, links, ports, security notes preserved).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 18:32:21 +01:00
f7adf66fa4 chore: bump all 7 submodule pointers to latest main
Sync umbrella refs after merging the README refresh (all submodules),
backend security hardening, and frontend Foundry Deck redesign into
their respective mains.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 17:57:30 +01:00
05f1af6c0e Merge docs/readme-refresh into main
Rewrite top-level README (full 7-submodule map, corrected architecture/
ports/model, security notes). No conflicts: remote commits touched only
submodule pointers, this branch only README.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 17:54:09 +01:00
zhi
e8c7f36950 chore: bump HarborForge.OpenclawPlugin submodule to latest main
Submodule changes:
- ESM conversion (type:module + nodenext + .js extensions everywhere)
- Migrated default export to definePluginEntry per current openclaw plugin
  authoring contract; modernized openclaw.plugin.json (drop entry/version,
  add activation.onStartup, declare contracts.tools).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 08:29:44 +00:00
h z
0ea665331a Merge pull request 'zhi-2026-04-18' (#8) from zhi-2026-04-18 into main
Reviewed-on: #8
2026-05-08 08:14:23 +00:00
zhi
12faa805c3 chore: update Backend + Cli submodules — schedule type system
Backend: schedule_types table, CRUD API, agent assignment API
Cli: schedule-type list/create/delete + assign-schedule-type commands

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-21 09:26:02 +00:00
zhi
d8564adafb chore: update Backend + OpenclawPlugin submodules
Backend: add /calendar/sync endpoint for multi-agent schedule sync
Plugin: multi-agent scheduler with dispatchInboundMessage wakeup

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-19 09:32:48 +00:00
zhi
482462fa4d chore: update OpenclawPlugin submodule — revert Discord wakeup, keep spawn
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-18 20:45:47 +00:00
zhi
0dc968e625 chore: update OpenclawPlugin submodule — Discord wakeup
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-18 20:29:10 +00:00
zhi
d99bece398 chore: update OpenclawPlugin submodule — schedule cache + sync
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-18 17:45:39 +00:00
zhi
7e0ab6e1fd chore: update OpenclawPlugin submodule ref
Points to zhi-2026-04-18 branch with daily-routine workflow prompts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-18 17:31:49 +00:00
10 changed files with 106 additions and 82 deletions

3
.gitmodules vendored
View File

@@ -24,3 +24,6 @@
path = HarborForge.Cli
url = https://git.hangman-lab.top/zhi/HarborForge.Cli.git
branch = main
[submodule "HarborForge.PlexumPlugin"]
path = HarborForge.PlexumPlugin
url = https://git.hangman-lab.top/zhi/HarborForge.PlexumPlugin.git

170
README.md
View File

@@ -1,128 +1,148 @@
# HarborForge
Agent / 人类协同任务管理平台 —— 用严格的状态机管理 提案 → 里程碑 → 任务 的完整生命周期,配套 CLI、监控与 OpenClaw 集成。
Agent / human collaborative task-management platform — manages the full
proposal → milestone → task lifecycle with strict state machines, plus a
CLI, monitoring, and OpenClaw integration.
## 项目结构
## Repository layout
本仓库是 umbrella 仓库,所有组件以 git 子模块形式组织:
This is the umbrella repository; every component is a git submodule:
```
HarborForge/
├── AbstractWizard/ # Go安全初始化服务SSH 隧道,端口 8080
├── HarborForge.Backend/ # Python/FastAPI,核心 REST API + RBAC(端口 8000
├── HarborForge.Frontend/ # React + TypeScript + Vite,单页前端(端口 3000
├── HarborForge.Cli/ # Go,命令行客户端 `hf`
├── HarborForge.Monitor/ # Go,主机遥测客户端(可选本地 bridge 9100
├── HarborForge.OpenclawPlugin/ # NodeOpenClaw 插件 `harbor-forge`
├── HarborForge.Test/ # 集成测试(后端 pytest / 前端 Playwright
├── docker-compose.yml # Docker 编排配置
├── nginx-host.conf.example # 宿主机 nginx 配置示例
└── .env.example # 环境变量模板
├── AbstractWizard/ # Go, secure first-time setup service (SSH tunnel, port 8080)
├── HarborForge.Backend/ # Python/FastAPI, core REST API + RBAC (port 8000)
├── HarborForge.Frontend/ # React + TypeScript + Vite single-page app (port 3000)
├── HarborForge.Cli/ # Go command-line client `hf`
├── HarborForge.Monitor/ # Go host telemetry client (optional local bridge 9100)
├── HarborForge.OpenclawPlugin/ # Node OpenClaw plugin `harbor-forge`
├── HarborForge.Test/ # Integration tests (backend pytest / frontend Playwright)
├── docker-compose.yml # Docker orchestration
├── nginx-host.conf.example # Host nginx config example
└── .env.example # Environment variable template
```
## 快速开始
## Quick start
```bash
# 克隆并初始化所有子模块
# Clone and initialize all submodules
git clone --recurse-submodules https://git.hangman-lab.top/zhi/HarborForge.git
cd HarborForge
# 若已克隆但未初始化子模块:
# If already cloned without submodules:
git submodule update --init --recursive
# 配置环境变量(不要使用默认值,见“安全”一节)
# Configure environment (do NOT use the defaults — see "Security")
cp .env.example .env
# 编辑 .env,至少设置强随机 SECRET_KEY 与数据库口令
# Edit .env: set at minimum a strong random SECRET_KEY and DB passwords
# 启动服务
# Start the services
docker compose up -d
```
## 首次部署 — 初始化向导
## First deployment — setup wizard
HarborForge 使用 [AbstractWizard](./AbstractWizard) 进行安全初始化。Wizard 仅监听 `127.0.0.1`,必须通过 SSH 隧道访问。
HarborForge uses [AbstractWizard](./AbstractWizard) for secure
initialization. The wizard listens on `127.0.0.1` only and must be
reached over an SSH tunnel.
```bash
# 1. SSH 隧道映射 wizard 端口到本地
# 1. SSH tunnel: forward the wizard port to your machine
ssh -L 18080:127.0.0.1:18080 user@your-server
# 2. 浏览器访问前端(或通过宿主机 nginx
# 前端检测到后端未就绪 → 自动跳转初始化向导
# 2. Open the frontend in a browser (or via the host nginx).
# If the backend is not initialized, it redirects to the setup wizard.
# 3. 在向导中配置:数据库连接、管理员账号、默认项目(可选)
# 3. In the wizard, configure: database connection, admin account,
# default project (optional).
# 4. 配置保存后,后端自动检测到配置并启动;刷新页面 → 登录界面
# 4. Once saved, the backend detects the config and starts; refresh
# the page → login screen.
```
### 启动流程
### Startup flow
```
docker compose up
├── mysql → 数据库启动
├── wizard → AbstractWizard 启动(127.0.0.1SSH 隧道访问)
├── backend → 阻塞等待配置文件(轮询 /config/harborforge.json
└── frontend → 检测后端状态
├── 后端未就绪 → 显示初始化向导SSH 隧道连 wizard
└── 后端就绪 → 正常登录界面
├── mysql → database starts
├── wizard → AbstractWizard starts (127.0.0.1, SSH-tunnel access)
├── backend → blocks waiting for the config file (polls /config/harborforge.json)
└── frontend → checks backend state
├── backend not ready → shows the setup wizard (SSH tunnel to wizard)
└── backend ready → normal login screen
```
### 安全模型
### Security model
- Wizard 端口绑定 `127.0.0.1`,不暴露到外部网络;初始化必须经 SSH 隧道完成。
- 配置通过 Docker volume 共享给后端(不走网络),后端以只读方式挂载。
- The wizard port binds to `127.0.0.1` and is never exposed to the
external network; initialization must be done over an SSH tunnel.
- Config is shared with the backend via a Docker volume (never over the
network); the backend mounts it read-only.
## 部署架构
## Deployment architecture
```
宿主机 nginx (80/443)
├── / → frontend (Docker, 端口 3000)
└── /api/ → backend (Docker, 端口 8000)
Host nginx (80/443)
├── / → frontend (Docker, port 3000)
└── /api/ → backend (Docker, port 8000)
Docker 内部(不对外):
wizard (127.0.0.1) → 配置管理SSH 隧道访问
wizard_config vol → wizard 写入,backend 只读读取
mysql (127.0.0.1) → 数据持久化
Internal to Docker (not exposed):
wizard (127.0.0.1) → config management, SSH-tunnel access
wizard_config vol → written by wizard, read-only for the backend
mysql (127.0.0.1) → data persistence
```
## 子模块
## Submodules
| 子模块 | 技术栈 | 作用 |
|--------|--------|------|
| [AbstractWizard](./AbstractWizard) | Go | 首次安装向导,安全写配置(原子写 + 备份),init/readonly 模式 |
| [HarborForge.Backend](./HarborForge.Backend) | Python / FastAPI / SQLAlchemy / MySQL | 核心 API用户、项目、任务、里程碑、提案、RBAC、Webhook、工时、通知 |
| [HarborForge.Frontend](./HarborForge.Frontend) | React 18 / TS / Vite | SPA~20 页面;自动检测未初始化 → 引导安装向导 |
| [HarborForge.Cli](./HarborForge.Cli) | Go | 权限感知命令行客户端 `hf` |
| [HarborForge.Monitor](./HarborForge.Monitor) | Go | 独立主机遥测客户端,心跳上报 |
| [HarborForge.OpenclawPlugin](./HarborForge.OpenclawPlugin) | Node / TS | OpenClaw 插件,桥接遥测,可安装 `hf` 技能与日历调度 |
| [HarborForge.Test](./HarborForge.Test) | pytest / Playwright | 后端与前端集成测试 |
| Submodule | Stack | Role |
|-----------|-------|------|
| [AbstractWizard](./AbstractWizard) | Go | First-time setup wizard; atomic config writes + backups; init/readonly modes |
| [HarborForge.Backend](./HarborForge.Backend) | Python / FastAPI / SQLAlchemy / MySQL | Core API: users, projects, tasks, milestones, proposals, RBAC, webhooks, worklogs, notifications |
| [HarborForge.Frontend](./HarborForge.Frontend) | React 18 / TS / Vite | SPA, ~20 pages; auto-detects an uninitialized backend → setup wizard |
| [HarborForge.Cli](./HarborForge.Cli) | Go | Permission-aware command-line client `hf` |
| [HarborForge.Monitor](./HarborForge.Monitor) | Go | Standalone host telemetry client, heartbeat reporting |
| [HarborForge.OpenclawPlugin](./HarborForge.OpenclawPlugin) | Node / TS | OpenClaw plugin; bridges telemetry; can install the `hf` skills and calendar scheduling |
| [HarborForge.Test](./HarborForge.Test) | pytest / Playwright | Backend and frontend integration tests |
## 核心业务模型
## Core domain model
- **里程碑**`open → freeze → undergoing → completed`freeze 时须恰好 1 个 release 任务)
- **任务**issue / story / test / maintenance / research / review / resolution`pending → open → undergoing → completed`,完成须带评论
- **提案**:用户提 propose → 管理者 accept → 自动在里程碑内创建 feature story 任务reject 可重开
- **RBAC**:细粒度权限 + 项目角色层级guest < viewer < member < dev < mgr < admin
- **Milestone**: `open → freeze → undergoing → completed` (freeze
requires exactly one release task)
- **Task** (issue / story / test / maintenance / research / review /
resolution): `pending → open → undergoing → completed`; completion
requires a comment
- **Proposal**: a user proposes → a manager accepts → a feature-story
task is auto-created in a milestone; rejected proposals can reopen
- **RBAC**: fine-grained permissions + a project role hierarchy
(guest < viewer < member < dev < mgr < admin)
## 端口
## Ports
| 服务 | 容器端口 | 绑定 | 环境变量 |
|------|----------|------|----------|
| Frontend | 3000 | compose | `FRONTEND_PORT` |
| Backend | 8000 | compose | `BACKEND_PORT` |
| MySQL | 3306 | 127.0.0.1 | `MYSQL_PORT` |
| Wizard | 8080 | 127.0.0.1 | `WIZARD_PORT` |
| Service | Container port | Bind | Env var |
|---------|----------------|------|---------|
| Frontend | 3000 | see compose | `FRONTEND_PORT` |
| Backend | 8000 | see compose | `BACKEND_PORT` |
| MySQL | 3306 | 127.0.0.1 | `MYSQL_PORT` |
| Wizard | 8080 | 127.0.0.1 | `WIZARD_PORT` |
> SSH 隧道示例使用本地端口 `18080` 转发到服务器 wizard。
> The SSH-tunnel example uses local port `18080` forwarding to the
> server-side wizard.
## 安全
## Security
部署前务必:
Before deploying, you must:
- **设置强随机 `SECRET_KEY`**(如 `openssl rand -hex 32`)。后端在检测到弱/默认/过短密钥时会拒绝启动。
- 不要使用 `.env.example` 中的占位口令;为 MySQL 设置强口令。
- 不要将含真实密钥的 `.env` 提交进版本库。
- **Set a strong random `SECRET_KEY`** (e.g. `openssl rand -hex 32`).
The backend refuses to start on a weak/default/short key.
- Not use the placeholder passwords from `.env.example`; set a strong
MySQL password.
- Never commit a `.env` containing real secrets.
后端的鉴权/RBAC/SSRF 加固详见 [HarborForge.Backend 的 README](./HarborForge.Backend) “Security” 一节。
The backend's auth / RBAC / SSRF hardening is documented in the
"Security" section of the
[HarborForge.Backend README](./HarborForge.Backend).
## 前端
## Frontend
前端采用集中式自定义设计系统“Foundry Deck” 工业主题),细节见 [HarborForge.Frontend 的 README](./HarborForge.Frontend)。
The frontend uses a centralized custom design system (the industrial
"Foundry Deck" theme); see the
[HarborForge.Frontend README](./HarborForge.Frontend) for details.