skywalk8163头像

hive项目开发和实践:把 Windows 侧的接入步骤列成一张可以照做的清单

✅ 已写入 windows/README.md 并推送(d2122ab),bootstrap.ps1 也支持 -HiveHost 了。


Windows 接入清单

全部在 PowerShell 里执行。[ ] 按顺序勾,每步有验收判据。 win10 只是个机器标签(不是必须等于 hostname),你叫 pc2、work 都行——只要 dispatch --host 时用同一个名字。

A. 前提

  •  Windows 能打开 http://192.168.1.5:3000
  •  powershell winget install --id Git.Git -e winget install --id Python.Python.3.12 -e
  •  开新终端(PATH 要重开才生效)验证: powershell git --version python --version ✅ 都有版本号

B. 拿工具仓

  •  powershell git clone http://192.168.1.5:3000/skywalk/hive.git C:\hive cd C:\hive git log --oneline -3 ✅ 能看到 feat(host) 或更新的提交

C. 先干跑(不改任何东西)

  •  powershell powershell -ExecutionPolicy Bypass -File C:\hive\windows\bootstrap.ps1 ` -Agent win10 -HiveHost win10 ✅ 打印一段 MCP JSON,路径是 C:\hive\hive.py ✅ 没加 -Apply,所以什么都没真改

D. 登记 + 接入(二选一)

D1. GUI agent → 走 MCP(推荐,不用 worker)

  •  powershell powershell -ExecutionPolicy Bypass -File C:\hive\windows\bootstrap.ps1 ` -Apply -Register -Agent win10 -HiveHost win10 -Mode manual
  •  把打印的 JSON 粘进 agent 的 MCP 配置 (Claude/Cursor 用 mcpServers,VS Code 用 servers,Codex 用 mcp_servers)
  •  重启 agent 客户端
  •  在对话里让它调 hive_whoami ✅ 返回 "agent": "win10" + claimable 列表

D2. 有命令行 agent → 走 worker(全自动)

  •  powershell powershell -ExecutionPolicy Bypass -File C:\hive\windows\bootstrap.ps1 ` -Apply -Register -InstallTask -Agent win10 -HiveHost win10 -Mode verify
  •  powershell Get-ScheduledTask -TaskName HiveWorker-win10 | Format-List State ✅ Ready 或 Running
  •  powershell Get-Content C:\hive\logs\worker-win10.log -Tail 20 ✅ 有 worker win10 启动

⚠️ D1 和 D2 别同时开 —— 两条路都会领卡,会重复劳动。

E. 在 FreeBSD 侧确认

  •  sh python3 hive.py --dir ~/dswork/hive agent list ✅ 看到 win10 host=win10
  •  sh python3 hive.py --dir ~/dswork/hive dispatch --host win10 ✅ 命令正常(没卡会提示"没有可分派的任务",也算通)

F. 第一张真卡(端到端)

  •  在 FreeBSD 写一张只改文档的小卡
  •  sh python3 hive.py --dir ~/dswork/hive dispatch --host win10 --apply
  •  Windows 侧领取并完成(D1 让 agent 调 hive_claim,D2 等 worker 自动领)
  •  sh python3 hive.py --dir ~/dswork/hive result T-xxxx ✅ status: done
  •  sh python3 hive.py --dir ~/dswork/hive land T-xxxx --apply

G. 排障速查

现象处理
禁止运行脚本命令前加 powershell -ExecutionPolicy Bypass -File
python 不是内部或外部命令重装 Python 勾 Add to PATH;或 -Python C:\Python312\python.exe
Git 弹窗要密码用 Gitea 账号 + 专门给 hive 仓的 access token
agent list 没 win10-Register 没加,或 push 失败(看 bootstrap 输出)
host 不是 win10登记时漏了 -HiveHost win10,重跑 D 步
worker 日志 could not readgit -C C:\hive pull,再重启计划任务
卡一直 running 但 VM 死了FreeBSD 上 hive gc 后 hive retry T-xxxx
MCP 工具没出现配置粘错位置 / 没重启客户端 / 看客户端日志

三个最容易踩的坑

  1. -HiveHost 必须和 dispatch --host 完全一致(大小写不敏感,但拼写要对)。漏了它就默认取 Windows 的 COMPUTERNAME,可能叫 DESKTOP-XXXX,你 --host win10 就永远派不到。
  2. D1/D2 二选一,双开会重复领卡。
  3. 第一次别跳过 C 步干跑——bootstrap.ps1 在真机上没实跑过(只做过静态检查),先看 dry-run 输出确认 MCP 那段对了再加 -Apply。

需要的话,你在 Windows 上跑到哪一步卡住,把输出贴给我,我帮你对照排。

转载自 CSDN-专业IT技术社区

原文链接:https://blog.csdn.net/skywalk8163/article/details/169169605

文章来源转载

评论

评论列表

微信小程序
QQ小程序

关于作者

点赞数:0
关注数:0
粉丝:0
文章:0
关注标签:0
加入于:--