HEL-913: unified-experience run package — fixed-version manifest, sanitized templates, offline zero-real-call verification (34/34), mem0 cp311 gap verified, capability list + one-shot enablement proposal
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -0,0 +1,166 @@
|
||||
# HEL-913 · 统一体验运行包(固定版本,未部署、cap=0)
|
||||
|
||||
> 本目录是把已通过 HEL-912 审核的统一候选装成的**可交接运行包**:精确源码版本、
|
||||
> 产物与哈希、脱敏配置模板、唯一启动方式、独立空资料空间、停止/备份/保留资料
|
||||
> 回退说明,以及一次零真实调用的运行准备验证记录。**本卡未部署任何现网服务、
|
||||
> 未监听 836x/8082/9880/8090、未改任何现有实例;实际启用与新用量由总管统一
|
||||
> 向白栖知说明后再执行。**
|
||||
|
||||
## 0. 精确版本与授权来源
|
||||
|
||||
- **候选分支** `agent/2/8e99cc2cc592`,head **`4a38106eef21c43ba24ab7d07992b1bfe539137d`**
|
||||
(HEL-911:AgentHandoff/shutdown 接缝修复 + 3.66s endpointing 等待归因修复)。
|
||||
父线:`407fc81`(HEL-910 窗口记录)← `958c696`(HEL-908 R1/R2 返工)。
|
||||
- 审核:HEL-912 结论「通过,无必须修复项」。主卡 HEL-797;本卡 HEL-913。
|
||||
- 需求基准 v1.12(`docs/requirements/`),需求检查见 handoff-HEL-913.json。
|
||||
|
||||
## 1. 交付物清单(本目录)
|
||||
|
||||
| 文件 | 作用 |
|
||||
| --- | --- |
|
||||
| `README.md` | 本运行说明(唯一照抄入口) |
|
||||
| `manifest.json` | 机器可读清单:head、锁文件、dist 哈希、环境引用 |
|
||||
| `dist-manifest.json` | web dist 8 文件 SHA256(复用 HEL-910 实测构建) |
|
||||
| `models.template.yaml` | 脱敏模型/预算配置(**一切预算=0**;占位符标注待批写入位置) |
|
||||
| `voice.template.yaml` | 脱敏语音配置(LiveKit/TTS/面板指向占位,真实值服务器本地) |
|
||||
| `worker.env.template` | 语音 worker 环境模板(agent venv 运行) |
|
||||
| `api_ctl.sh` | 统一实例 API 启停(单进程 HTTP+HTTPS 双入口) |
|
||||
| `worker_ctl.sh` | 语音 worker 启停(只按 PID 句柄停止) |
|
||||
| `verify_offline.py` | 零真实调用运行准备验证(34 项检查;TestClient 进程内,不监听端口) |
|
||||
| `mem0-cp311-wheels.txt` | 真实 Mem0 记忆栈 cp311 缺项轮清单(40 项,待批一次性下载) |
|
||||
|
||||
运行记录:`docs/rework/hel913/verify-offline-run.txt`(.12 产品 3.11 venv 实跑 34/34)。
|
||||
|
||||
## 2. 版本固定与产物复用
|
||||
|
||||
- **源码**:head `4a38106`(含 `requirements.lock` 19 项固定版本,Python 3.11 实测)。
|
||||
- **web dist 复用**:`git diff 958c696 4a38106 -- web/` 为空(网页源码零变动),
|
||||
直接复用 HEL-910 已实测部署的 dist(.12 `/opt/cybergril-hel910/current/web/dist`,
|
||||
REVISION 标记 `958c6962…`),只读拷贝,不安装 node、不重建。8 文件哈希见
|
||||
`dist-manifest.json`(2026-10-29 于 .12 逐文件实测),部署时核对一致即可。
|
||||
- **解释器(既有环境引用,不新建)**:
|
||||
- 产品 API:`.12 /opt/cybergril-hel879/current/.venv311`(Python 3.11.16,
|
||||
requirements.lock 全量,fastapi 0.159.1 / uvicorn 0.54.0 / httpx 0.28.1 / pydantic 2.14.1)。
|
||||
- 语音 worker:`.12 /opt/voice-agent/agent/venv`(livekit-agents 1.8.8,含 silero VAD)。
|
||||
- 证书:`.12 /opt/cybergril-voice-certs/cybergril-voice.{pem,key}`(既有自签,
|
||||
覆盖 192.168.200.12;语音页 secure context 依赖 HTTPS 入口)。
|
||||
- 本机 LiveKit `ws://127.0.0.1:7880`(常驻);TTS 9880 / 面板 8090 / 语音桥
|
||||
按获批窗口另行启动,未获批保持停机。
|
||||
|
||||
## 3. 目标实例布局(唯一布局;用户实例 data 必须为空)
|
||||
|
||||
```
|
||||
/opt/cybergril-hel913/ # 实例根(名字可换;以下结构固定)
|
||||
current/ # git clone 后 checkout 4a38106(或 git archive 解包)
|
||||
web/dist/ # 按 dist-manifest.json 核哈希后放入(只读复用件)
|
||||
etc/
|
||||
models.yaml # 由 models.template.yaml 复制,填入获批网关与预算
|
||||
voice.yaml # 由 voice.template.yaml 复制,填入服务器本地值
|
||||
data/ # 独立空资料空间:新库从零初始化
|
||||
worker/.env # 由 worker.env.template 复制
|
||||
logs/
|
||||
```
|
||||
|
||||
**不打包进她的正式档案**:任何历史测试库(8360 团队库、HEL-907/910 窗口库)、
|
||||
聊天记录、LiveKit/TTS 凭据、自签证书私钥、agent venv 内实物。用户实例在用户
|
||||
亲自创建前 `companion` 表必须为空(离线验证第 3 项复现该守门)。
|
||||
|
||||
## 4. 启动与停止(唯一方式)
|
||||
|
||||
```bash
|
||||
# 4.1 API:单进程双入口(HTTP 8360 + HTTPS 8361 共用同一 app 状态;lifespan 只进一次)
|
||||
cd /opt/cybergril-hel913/current
|
||||
HEL913_BASE=/opt/cybergril-hel913 bash deploy/hel913-unified/api_ctl.sh start
|
||||
# 健康检查:curl -s http://127.0.0.1:8360/api/health(version=R4-assembly,
|
||||
# semantic_backend=stub;llm.ok=false 是诚实状态——cap=0 且未配网关)
|
||||
|
||||
# 4.2 语音 worker(语音窗口获批后;TTS 9880 先起、面板 8090 可选)
|
||||
HEL913_BASE=/opt/cybergril-hel913 bash deploy/hel913-unified/worker_ctl.sh start
|
||||
# worker 经 PYTHONPATH=current/src 用 agent venv 运行,注册到本机 LiveKit 7880,
|
||||
# 健康口 8082( HEL913_WORKER_HEALTH 可改);只按 logs/worker.pid 停止。
|
||||
|
||||
# 4.3 停止顺序:先 worker 后 API(语音会话先释放,再关统一进程)
|
||||
HEL913_BASE=/opt/cybergril-hel913 bash deploy/hel913-unified/worker_ctl.sh stop
|
||||
HEL913_BASE=/opt/cybergril-hel913 bash deploy/hel913-unified/api_ctl.sh stop
|
||||
```
|
||||
|
||||
同一数据目录**绝不允许**两个写入实例并存(双入口由 `deploy/voice/serve_dual_8360_8361.py`
|
||||
在同一进程内保证;另起独立 uvicorn 会触发 lifespan 重入 fail-closed)。
|
||||
|
||||
## 5. 备份与保留资料回退
|
||||
|
||||
- **发布/阶段归档**(本包口径,沿用 HEL-896 收口工具,一致性快照):
|
||||
```bash
|
||||
# 停服口径(推荐;目录内 SQLite 一并 checkpoint+逐表核对)
|
||||
systemctl stop <实例> # 或 api_ctl.sh stop
|
||||
.venv311/bin/python tools/release_snapshot_hel896.py snapshot \
|
||||
--name <阶段名> --db /opt/cybergril-hel913/data/companion.db \
|
||||
--file /opt/cybergril-hel913/data --out /opt/cybergril-hel913/archives/
|
||||
```
|
||||
产物含逐文件 SHA256、代码精确提交、逐表行数与回退演练;旧归档不删。
|
||||
- **回退**:停服 → 解包快照到新 data 目录(按 rollback_plan 源路径映射)→
|
||||
`current` 切回上一提交(`git checkout <旧head>`)→ 起服务 → `verify` 通过。
|
||||
- **整实例撤销但保留资料**:`api_ctl.sh stop`,data/ 原样保留,systemd 单元
|
||||
disable;重新启用 = 同一 data 目录再 start(epoch 递增、聊天记忆保留,离线
|
||||
验证第 11 组复现)。
|
||||
- **CG-009 每日自动备份/用户手动完整导出(R6)尚未实现**,本节只是发布归档,
|
||||
不得冒充 R6 完成。
|
||||
|
||||
## 6. 零真实调用运行准备验证(已执行,34/34)
|
||||
|
||||
在 .12 产品 3.11 venv 对候选 head 树实跑 `verify_offline.py`(进程内 TestClient,
|
||||
零监听、零出站——网关地址重写为 127.0.0.1:1 + provider.stream 出站哨兵双保险):
|
||||
|
||||
- 包完整性:Python 3.11.16、候选树 import、锁定依赖版本、记忆栈四项缺置如实。
|
||||
- 入口/创建守门:health 诚实(llm.ok=false)、空库 404 无伪造档案、预览本地
|
||||
计算、创建 201、二次创建 409、底色落库与预览一致、persona 在 cap=0 下诚实
|
||||
failed(无编造诠释)。
|
||||
- 传输:SSE 对话在预算 0 下诚实 `chat.error`,零 provider 出站;失败轮如实
|
||||
落库;同轮重试幂等拒绝。
|
||||
- 日子与回忆:未分享生活服务端裁剪(told=1)、分页形状、未知回执/详情 404。
|
||||
- 语音:status 诚实 voice=false;TTS 不可达时开房 503 拒绝(绝不建房);
|
||||
未知会话 DELETE 404。
|
||||
- 重开:epoch=2、身份/关系/聊天保留、无伪造回复。
|
||||
- dist:GET / 出 index.html;8 文件哈希与 manifest 全符。
|
||||
- worker 接线:agent venv(livekit-agents 1.8.8)下 `import cybergril.voice.worker`
|
||||
通过(只读 import,未启动注册)。
|
||||
|
||||
**预算 0 下只能诚实拒绝的**:一切真实创建诠释/习惯、对话生成、生活事件生成、
|
||||
判定/成长/gist、主动措辞、嵌入、语音开房。`/api/health` 的 200 不代表模型已
|
||||
运行——`llm.ok=false` 才是诚实状态。
|
||||
|
||||
## 7. 真实记忆(Mem0)运行缺项 —— 已核实,未安装
|
||||
|
||||
- **服务器 .12 现状(2026-10-29 只读实测)**:产品 `.venv311`(3.11.16)内
|
||||
`mem0 / qdrant_client / fastembed / onnxruntime` 四项均未安装;服务器全盘无
|
||||
mem0 安装、无固定 tarball、无已建轮、无 fastembed 缓存、uv 缓存仅 28K。
|
||||
**没有另一个已准备好的 3.11 兼容环境**;旧 3.10 `hel857-venv`(3.10.12,
|
||||
工作站本地)不能混入 3.11 进程。
|
||||
- **已有实物(工作站本地,未上服务器)**:固定源 `mem0-2c81af3.tar.gz`
|
||||
(sha256 `9dcef930…`,与 `deploy/mem0-stack.lock` 一致,本卡复验);固定源
|
||||
离线构建轮 `mem0ai-2.2.1-py3-none-any.whl`(sha256 `698284b6…`,本卡复验);
|
||||
fastembed 模型缓存 92MB(Qdrant/bge-small-zh-v1.5 + bm25);本地 uv 缓存可
|
||||
复用 3 轮(greenlet/pillow/truststore cp311)。
|
||||
- **最少安装动作(待一次性批准;本卡零安装零下载)**,唯一入口
|
||||
`deploy/hel895-release-candidate.md` §4:
|
||||
1. tarball 哈希核对(或直接复用已建轮并核对 `698284b6…`);
|
||||
2. 获批窗口内 `pip download --only-binary :all: --implementation cp
|
||||
--python-version 3.11 --platform manylinux2014_x86_64 --abi cp311
|
||||
-r deploy/hel913-unified/mem0-cp311-wheels.txt -d wheels/`(40 项,
|
||||
逐项 sha256 留证;其中 3 项可从工作站缓存离线复用);
|
||||
3. 传输轮目录 + fastembed 缓存(92MB)到服务器;
|
||||
4. `uv pip install --python .venv311/bin/python --no-index --find-links wheels/
|
||||
mem0ai==2.2.1 qdrant-client==1.20.0 fastembed==0.9.1 <40项>`;
|
||||
5. co-import 冒烟 + fastembed cache_dir 指向实例数据目录内缓存拷贝。
|
||||
**空间/影响**:.venv311 增约 300–400MB(3.10 同栈实测 366MB 参考)+ 轮暂存
|
||||
约 150MB + 模型缓存 92MB;首次本地嵌入零下载(缓存就位)。激活语义层仍需
|
||||
B 部分嵌入/提取预算(见 docs/hel913-capability-and-enablement.md §2)。
|
||||
在此之前 `CYBERGRIL_SEMANTIC=stub`,长期检索走词面 FTS,不以 stub 冒充
|
||||
真实 Mem0。
|
||||
|
||||
## 8. 本包不做的事
|
||||
|
||||
不部署、不监听现网端口、不恢复 9880/8090/836x/8082、不触 4080、不下载任何
|
||||
依赖/模型/浏览器、不改模型/认证/运行时绑定、不合并 PR、不替换正式界面、
|
||||
8300/8310/8320/8350 与既有资料不动、8340/ComfyUI 保持停机。旧三次测试窗口
|
||||
余额不结转;一切提额是待批准建议。
|
||||
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env bash
|
||||
# HEL-913 统一体验运行包 · 统一实例 API 启停(单进程 HTTP+HTTPS 双入口)
|
||||
#
|
||||
# 与 HEL-910 的 api_ctl.sh 同构,去掉一次性路径硬编码:实例根、端口、证书、
|
||||
# 解释器全部可用环境变量覆盖。启动器 deploy/voice/serve_dual_8360_8361.py
|
||||
# 保证 HTTP 与 HTTPS 共用同一 API 进程/同一份状态(lifespan 只进一次)。
|
||||
#
|
||||
# 用法: [ENV=..] bash deploy/hel913-unified/api_ctl.sh start|stop|status
|
||||
# 环境变量(默认值按部署说明的实例布局):
|
||||
# HEL913_BASE 实例根目录(含 current/ etc/ data/ logs/)
|
||||
# HEL913_HTTP HTTP 端口(默认 8360)
|
||||
# HEL913_HTTPS HTTPS 端口(默认 8361;语音页需要 secure context)
|
||||
# HEL913_VENV 产品 3.11 venv python(默认 /opt/cybergril-hel879/current/.venv311/bin/python)
|
||||
# HEL913_CERT / HEL913_KEY 证书路径(默认 /opt/cybergril-voice-certs/ 下既有证书)
|
||||
set -u
|
||||
BASE=${HEL913_BASE:-/opt/cybergril-hel913}
|
||||
CODE=${HEL913_CODE:-$BASE/current}
|
||||
HTTP=${HEL913_HTTP:-8360}
|
||||
HTTPS=${HEL913_HTTPS:-8361}
|
||||
VENV=${HEL913_VENV:-/opt/cybergril-hel879/current/.venv311/bin/python}
|
||||
CERT=${HEL913_CERT:-/opt/cybergril-voice-certs/cybergril-voice.pem}
|
||||
KEY=${HEL913_KEY:-/opt/cybergril-voice-certs/cybergril-voice.key}
|
||||
LOG=$BASE/logs/api.log
|
||||
PIDF=$BASE/logs/api.pid
|
||||
PAT="cybergril.*serve_dual"
|
||||
|
||||
stop() {
|
||||
if [ -f "$PIDF" ]; then
|
||||
P=$(cat "$PIDF")
|
||||
if [ "$P" != "$$" ] && kill -0 "$P" 2>/dev/null; then kill "$P"; sleep 3; fi
|
||||
if [ "$P" != "$$" ] && kill -0 "$P" 2>/dev/null; then kill -9 "$P"; fi
|
||||
rm -f "$PIDF"
|
||||
fi
|
||||
echo "api stopped"
|
||||
}
|
||||
|
||||
case "${1:-}" in
|
||||
stop) stop; exit 0 ;;
|
||||
status)
|
||||
[ -f "$PIDF" ] && { P=$(cat "$PIDF"); kill -0 "$P" 2>/dev/null && echo "running pid $P" || echo "pid $P not alive"; }
|
||||
curl -s --max-time 3 "http://127.0.0.1:$HTTP/api/health" && echo " <- health" || echo "health not answering"
|
||||
exit 0 ;;
|
||||
esac
|
||||
|
||||
stop
|
||||
cd "$CODE"
|
||||
set -a
|
||||
export CYBERGRIL_DB=$BASE/data/companion.db
|
||||
export CYBERGRIL_SEMANTIC=${HEL913_SEMANTIC:-stub}
|
||||
export CYBERGRIL_R2_ENABLED=${HEL913_R2:-1}
|
||||
export CYBERGRIL_MODELS=$BASE/etc/models.yaml
|
||||
export CYBERGRIL_VOICE_CONFIG=$BASE/etc/voice.yaml
|
||||
export CYBERGRIL_WEB=$CODE/web/dist
|
||||
export PYTHONPATH=$CODE/src
|
||||
set +a
|
||||
nohup "$VENV" deploy/voice/serve_dual_8360_8361.py \
|
||||
--http-port "$HTTP" --https-port "$HTTPS" --cert "$CERT" --key "$KEY" \
|
||||
> "$LOG" 2>&1 &
|
||||
echo $! > "$PIDF"
|
||||
echo "api starting (pid $(cat "$PIDF")) http=$HTTP https=$HTTPS"
|
||||
sleep 6
|
||||
curl -s --max-time 3 "http://127.0.0.1:$HTTP/api/health" >/dev/null && echo "OK: $HTTP healthy" || { echo "FAIL:"; tail -20 "$LOG"; exit 1; }
|
||||
curl -sk --max-time 3 "https://127.0.0.1:$HTTPS/api/health" >/dev/null && echo "OK: $HTTPS healthy" || { echo "FAIL $HTTPS:"; tail -20 "$LOG"; exit 1; }
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"assets/her-room.jpg": "51ca450a454c108d304feee2745070fbbbd3232863096126badf279ee53a925a",
|
||||
"assets/her-talk.jpg": "0b9e91b58d75afb836efdad3d8e8f0aab0c44df64b2c4ddd59d011fd499aeb33",
|
||||
"assets/icons.svg": "8630691c7349dd33c1accf2331cb4c844ffd9b70465021b1c18bf8f5aea0588e",
|
||||
"assets/index-B8TdHoQm.css": "a0af3163f564f2ff9cfe7d995378b7ac436bfe2f9fabda9f370ca0aa30c2412f",
|
||||
"assets/index-Vm-EFPLb.js": "81f55e20c5c2afe4673ccc9020264a2bf99b3c84998c275f03fa48fe4f940bb0",
|
||||
"demo-material.json": "78fd67e8e4a680e8b3277db4a922360a83fa0be1ceee0cb257ba1c74bc6ede37",
|
||||
"index.html": "8d84f131b6922fe92ac0c562f5fec73aacd9c6e4db2cfa28f6190b4246f9c8d0",
|
||||
"vendor/livekit-client-2.22.4.umd.min.js": "040db4c0db72e7f7599cd0e06b0f58f95e0082a395cdde410ca26224a79a0626"
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"task": "HEL-913",
|
||||
"head": "4a38106eef21c43ba24ab7d07992b1bfe539137d",
|
||||
"branch": "agent/2/8e99cc2cc592",
|
||||
"review": "HEL-912 01a187e8-1058-7a2d-84e7-bd1896f212cb passed, no must-fix items",
|
||||
"requirements_lock": "requirements.lock (19 pinned, Python 3.11.16 verified)",
|
||||
"web_dist_reuse": {
|
||||
"source": "/opt/cybergril-hel910/current/web/dist (REVISION 958c6962fb1f2a4462a6df794d893aee1fcb0667)",
|
||||
"justification": "git diff 958c696 4a38106 -- web/ is empty",
|
||||
"manifest": "deploy/hel913-unified/dist-manifest.json (8 files, sha256 measured on .12 2026-10-29)"
|
||||
},
|
||||
"environments": {
|
||||
"api_python": "/opt/cybergril-hel879/current/.venv311 (Python 3.11.16)",
|
||||
"worker_python": "/opt/voice-agent/agent/venv (livekit-agents 1.8.8)",
|
||||
"certs": "/opt/cybergril-voice-certs/cybergril-voice.{pem,key}",
|
||||
"livekit": "ws://127.0.0.1:7880 (standing)",
|
||||
"tts_panel": "9880/8090 stopped until approved window"
|
||||
},
|
||||
"package_files": [
|
||||
"deploy/hel913-unified/README.md",
|
||||
"deploy/hel913-unified/manifest.json",
|
||||
"deploy/hel913-unified/dist-manifest.json",
|
||||
"deploy/hel913-unified/models.template.yaml",
|
||||
"deploy/hel913-unified/voice.template.yaml",
|
||||
"deploy/hel913-unified/worker.env.template",
|
||||
"deploy/hel913-unified/api_ctl.sh",
|
||||
"deploy/hel913-unified/worker_ctl.sh",
|
||||
"deploy/hel913-unified/verify_offline.py",
|
||||
"deploy/hel913-unified/mem0-cp311-wheels.txt",
|
||||
"docs/rework/hel913/verify-offline-run.txt",
|
||||
"docs/hel913-capability-and-enablement.md"
|
||||
],
|
||||
"offline_verification": {
|
||||
"where": ".12 product .venv311, candidate tree at /tmp/hel913-verify (cleaned after run)",
|
||||
"result": "34/34 checks passed; worker import ok under livekit-agents 1.8.8",
|
||||
"zero_real_calls": "models base_url rewritten to 127.0.0.1:1 + provider.stream outbound sentinel; no listening sockets; no rooms; no gateway contact"
|
||||
},
|
||||
"memory_gap": {
|
||||
"server_venv311": "mem0/qdrant_client/fastembed/onnxruntime all absent (verified 2026-10-29)",
|
||||
"no_other_311_env_on_server": true,
|
||||
"local_artifacts": {
|
||||
"mem0-2c81af3.tar.gz": "9dcef9303ebcec116eec6739f01b8b35bd24459de6a569686b4d19b9412dda23",
|
||||
"mem0ai-2.2.1-py3-none-any.whl": "698284b6083ab8b7761454d65876a6d1bb983d278ad21a7bee38d760cb20e9db",
|
||||
"fastembed_cache": "92MB (Qdrant/bge-small-zh-v1.5 + bm25)",
|
||||
"hel857_venv": "Python 3.10.12 — must not mix into 3.11 process"
|
||||
},
|
||||
"minimal_install": "deploy/hel913-unified/mem0-cp311-wheels.txt (40 wheels, one approved window) + wheel transfer + --no-index install + co-import; entry remains deploy/hel895-release-candidate.md §4"
|
||||
},
|
||||
"boundaries": "not deployed; nothing listening; caps all 0; no PR; existing instances and data untouched; no downloads this card"
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
# HEL-913 记忆栈 cp311 缺项轮清单(40 项;来源 docs/rework/hel879/sdk-audit/sdk-audit.json 闭包 55-产品已有)
|
||||
# mem0ai 不在本表:只认固定源码轮 sha256 698284b6…(deploy/hel895-release-candidate.md §4 唯一入口)。
|
||||
# 获批下载命令:pip download --only-binary :all: --implementation cp --python-version 3.11 \
|
||||
# --platform manylinux2014_x86_64 --abi cp311 -r 本文件 -d wheels/ 逐项 sha256 留证。
|
||||
# 其中 greenlet/pillow/truststore 三项已在工作站 uv 缓存命中(hel-879 release-artifacts 记录),可离线复用。
|
||||
backoff==2.2.1
|
||||
charset-normalizer==3.5.2
|
||||
coloredlogs==15.0.1
|
||||
distro==1.9.0
|
||||
fastembed==0.9.1
|
||||
filelock==4.1.0
|
||||
flatbuffers==25.12.19
|
||||
fsspec==2026.9.0
|
||||
greenlet==3.5.6
|
||||
grpcio==1.84.1
|
||||
h2==4.4.1
|
||||
hf-xet==1.7.0
|
||||
hpack==4.2.0
|
||||
httpcore2==2.14.0
|
||||
httpx2==2.14.0
|
||||
huggingface-hub==1.33.0
|
||||
humanfriendly==10.0
|
||||
hyperframe==6.1.0
|
||||
jiter==0.18.0
|
||||
loguru==0.7.3
|
||||
mmh3==5.3.1
|
||||
mpmath==1.3.0
|
||||
numpy==2.2.6
|
||||
onnxruntime==1.23.2
|
||||
openai==3.37.0
|
||||
pillow==12.3.0
|
||||
portalocker==4.4.1
|
||||
posthog==7.75.11
|
||||
protobuf==6.33.6
|
||||
py-rust-stemmers==0.1.8
|
||||
pytz==2026.5
|
||||
qdrant-client==1.20.0
|
||||
requests==2.34.2
|
||||
sniffio==1.3.1
|
||||
sqlalchemy==2.0.55
|
||||
sympy==1.14.0
|
||||
tokenizers==0.23.3
|
||||
tqdm==4.70.1
|
||||
truststore==0.10.5
|
||||
urllib3==2.8.0
|
||||
@@ -0,0 +1,89 @@
|
||||
# HEL-913 统一体验运行包 · models 配置模板(脱敏;本文件一切预算=0)
|
||||
#
|
||||
# 用法:复制到 <实例>/etc/models.yaml,按部署说明只改 base_url 指向获批网关、
|
||||
# 按批准包写入预算值。未经批准一律保持 0(发送前拒绝,fail-closed)。
|
||||
# 候选分支 config/models.yaml 的 tiers/routing 与本模板一致;本模板把
|
||||
# base_url 换成占位符并保留 HEL-908 reasoning: buffer_turn 与 HEL-911/912
|
||||
# 审核通过的调度修正(turn_detection=None 在代码侧,见 src/cybergril/voice/worker.py)。
|
||||
tiers:
|
||||
high:
|
||||
provider: openai_compat
|
||||
model: <获批模型名>
|
||||
base_url: <http://内网网关:端口/v1>
|
||||
api_key_env: null
|
||||
timeout: 60.0
|
||||
temperature: 0.85
|
||||
reasoning: buffer_turn
|
||||
standard:
|
||||
provider: openai_compat
|
||||
model: <获批模型名>
|
||||
base_url: <http://内网网关:端口/v1>
|
||||
api_key_env: null
|
||||
timeout: 40.0
|
||||
temperature: 0.7
|
||||
reasoning: buffer_turn
|
||||
low:
|
||||
provider: openai_compat
|
||||
model: <获批模型名>
|
||||
base_url: <http://内网网关:端口/v1>
|
||||
api_key_env: null
|
||||
timeout: 20.0
|
||||
temperature: 0.4
|
||||
reasoning: buffer_turn
|
||||
routing:
|
||||
dialogue_main: high
|
||||
dialogue_followup: standard
|
||||
proactive_message: high
|
||||
crisis: high
|
||||
life_event: low
|
||||
memory_gist: low
|
||||
fact_extract: low
|
||||
output_guard: low
|
||||
pattern_detect: low
|
||||
filler: none
|
||||
tick: none
|
||||
reach_out: none
|
||||
avatar_drive: none
|
||||
budget:
|
||||
daily_tokens: 0
|
||||
warn_ratio: 0.7
|
||||
hard_stop_ratio: 0.95
|
||||
daily_requests:
|
||||
dialogue: 0
|
||||
life: 0
|
||||
background: 0
|
||||
semantic: 0
|
||||
# 用户实例永不配置一次性总量(total_requests/total_tokens 保持缺省):
|
||||
# 一次性总量只属于独立团队测试实例,见 docs/budget-package-hel895.md §6。
|
||||
asr:
|
||||
provider: scripted
|
||||
model: qwen3-asr-1.7b
|
||||
language: zh
|
||||
paralinguistic:
|
||||
provider: scripted
|
||||
model: sensevoice-small
|
||||
window_ms: 1500
|
||||
enabled: true
|
||||
tts:
|
||||
provider: silence
|
||||
model: fun-cosyvoice3-0.5b
|
||||
voice_ref: null
|
||||
sample_rate: 16000
|
||||
vad:
|
||||
provider: energy
|
||||
model: silero-v6
|
||||
sample_rate: 16000
|
||||
turn:
|
||||
provider: heuristic
|
||||
silence_min_ms: 150
|
||||
silence_hard_end_ms: 800
|
||||
embedding:
|
||||
provider: openai_compat
|
||||
model: qwen3-embedding-0.6b
|
||||
base_url: null
|
||||
api_key_env: null
|
||||
dim: 1024
|
||||
avatar:
|
||||
route: vrm
|
||||
renderer: three.js
|
||||
lipsync: envelope
|
||||
@@ -0,0 +1,273 @@
|
||||
"""HEL-913 运行准备离线验证:零真实调用(cap=0 + 死地址双重保险)。
|
||||
|
||||
在进程内用 TestClient 走统一实例的关键接线:入口健康、创建守门、传输
|
||||
(SSE 对话在预算 0 下诚实拒绝且绝不触发出站)、关系调整、日子与回忆
|
||||
读取的服务端裁剪、语音诚实拒绝、重开(epoch/资料保留)、静态页与 dist
|
||||
哈希。不监听任何端口(836x/8082/9880/8090 全程不出现监听 socket),
|
||||
不访问真实网关(models.base_url 重写为 127.0.0.1:1,livekit 指向死地址,
|
||||
即使预算闸失效也只能连本机死端口)。
|
||||
|
||||
用法(在候选 head 检出根目录、产品 3.11 venv 下):
|
||||
PYTHONPATH=src <venv311>/python deploy/hel913-unified/verify_offline.py \
|
||||
[--web <dist目录>] [--keep]
|
||||
退出码 0 = 全部通过;任一 FAIL 即非 0。临时库写在 <root>/.hel913-verify-tmp,
|
||||
默认结束后删除(--keep 保留)。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import atexit
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
import uuid
|
||||
from pathlib import Path
|
||||
|
||||
RESULTS: list[tuple[bool, str]] = []
|
||||
|
||||
|
||||
def check(ok: bool, label: str) -> bool:
|
||||
RESULTS.append((bool(ok), label))
|
||||
print(("PASS " if ok else "FAIL ") + label)
|
||||
return bool(ok)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--web", default=None, help="web dist 目录(只读;默认不挂静态)")
|
||||
parser.add_argument("--keep", action="store_true")
|
||||
args = parser.parse_args()
|
||||
|
||||
root = Path(__file__).resolve().parents[2]
|
||||
os.chdir(root)
|
||||
tmp = Path(tempfile.mkdtemp(prefix="hel913-verify-", dir=root))
|
||||
if not args.keep:
|
||||
atexit.register(shutil.rmtree, tmp, ignore_errors=True)
|
||||
|
||||
# ---- 0. 包完整性:Python / 锁定依赖 / 模块树 -----------------------------
|
||||
check(sys.version_info[:2] == (3, 11), f"python 3.11 (actual {sys.version_info[:3]})")
|
||||
import cybergril # noqa: E402
|
||||
|
||||
check(str(Path(cybergril.__file__).resolve()).startswith(str(root / "src")),
|
||||
f"cybergril imported from candidate tree ({cybergril.__file__})")
|
||||
import fastapi # noqa: E402
|
||||
import httpx # noqa: E402
|
||||
import pydantic # noqa: E402
|
||||
import uvicorn # noqa: E402
|
||||
import yaml # noqa: E402
|
||||
|
||||
check(True, f"deps: fastapi {fastapi.__version__} uvicorn {uvicorn.__version__} "
|
||||
f"httpx {httpx.__version__} pydantic {pydantic.__version__}")
|
||||
from cybergril.api.app import create_app # noqa: E402
|
||||
from cybergril.voice.router import build_voice_router # noqa: E402
|
||||
from cybergril.voice.session import load_voice_config # noqa: E402
|
||||
|
||||
check(True, "product modules import (api.app / voice.router / voice.session)")
|
||||
|
||||
# 记忆栈缺项如实呈现(不允许 stub 冒充真实 mem0)
|
||||
for mod, expect in (("mem0", False), ("qdrant_client", False), ("fastembed", False)):
|
||||
try:
|
||||
__import__(mod)
|
||||
got = True
|
||||
except Exception:
|
||||
got = False
|
||||
check(got == expect, f"{mod} {'absent' if not expect else 'present'} in product venv (as documented)")
|
||||
|
||||
# ---- 1. 脱敏配置:cap=0 + 死地址 ----------------------------------------
|
||||
models_src = (root / "config" / "models.yaml").read_text()
|
||||
assert "daily_tokens" in models_src, "models.yaml missing budget block"
|
||||
dead = models_src.replace("192.168.200.11:8731", "127.0.0.1:1")
|
||||
assert "192.168" not in dead, "real gateway address survived rewrite"
|
||||
models_path = tmp / "models.yaml"
|
||||
models_path.write_text(dead)
|
||||
|
||||
voice_path = tmp / "voice.yaml"
|
||||
voice_path.write_text(
|
||||
"# HEL-913 offline template: everything points at dead local ports;\n"
|
||||
"# no real LiveKit/TTS/panel is contacted by this verification.\n"
|
||||
"livekit_url: ws://127.0.0.1:1\n"
|
||||
"livekit_internal: http://127.0.0.1:1\n"
|
||||
"api_key: dead\n"
|
||||
"api_secret: dead\n"
|
||||
"agent_name: cybergril-voice-agent\n"
|
||||
"tts_health_url: http://127.0.0.1:1/health\n"
|
||||
"panel_url: https://127.0.0.1:1\n"
|
||||
"tts_url: http://127.0.0.1:1\n"
|
||||
"registry_file: " + str(tmp / "voices.json") + "\n"
|
||||
"worker_state_file: " + str(tmp / "voice_state.json") + "\n"
|
||||
"token_ttl_seconds: 300\n"
|
||||
"session_ttl_seconds: 900\n"
|
||||
)
|
||||
db_path = tmp / "companion.db"
|
||||
|
||||
env = {
|
||||
"CYBERGRIL_DB": str(db_path),
|
||||
"CYBERGRIL_MODELS": str(models_path),
|
||||
"CYBERGRIL_VOICE_CONFIG": str(voice_path),
|
||||
"CYBERGRIL_SEMANTIC": "stub",
|
||||
"CYBERGRIL_R2_ENABLED": "1",
|
||||
**({"CYBERGRIL_WEB": args.web} if args.web else {}),
|
||||
}
|
||||
old = {k: os.environ.get(k) for k in env}
|
||||
os.environ.update(env)
|
||||
|
||||
from fastapi.testclient import TestClient # noqa: E402
|
||||
|
||||
app = create_app()
|
||||
# 出站哨兵:把所有已装配 provider 的 stream 打上标记——预算 0 下任何
|
||||
# 真实发送意图都会把本验证置为 FAIL(而不是悄悄连死地址)。
|
||||
outbound = []
|
||||
client = TestClient(app)
|
||||
|
||||
with client:
|
||||
st = app.state
|
||||
router = st.life.router # LifeRuntime 持有本实例同一 router
|
||||
for tier in router.available_tiers():
|
||||
prov = router.provider_for(tier)
|
||||
|
||||
def _guard_stream(self, *a, __orig=prov.stream, __name=getattr(prov, "name", tier), **kw):
|
||||
outbound.append(__name)
|
||||
raise AssertionError(f"unexpected outbound stream via {__name}")
|
||||
|
||||
prov.stream = _guard_stream.__get__(prov, type(prov))
|
||||
|
||||
birth = {"birth": "2001-08-16", "hour": "辰时", "name": "临川", "relation": "朋友",
|
||||
"nickname": "", "boundary": "轻松相处"}
|
||||
|
||||
# 2. 入口健康
|
||||
r = client.get("/api/health")
|
||||
h = r.json()
|
||||
check(r.status_code == 200 and h["ok"] and h["capabilities"]["text"] is True,
|
||||
"GET /api/health 200, text capability true")
|
||||
check(h["companion_created"] is False, "health: companion_created=false before creation")
|
||||
check(h["llm"]["ok"] is False, "health: llm honestly not ok (dead addr, cap=0)")
|
||||
|
||||
# 3. 创建守门:空库 404,不能读出任何伪造档案
|
||||
check(client.get("/api/companion").status_code == 404,
|
||||
"GET /api/companion 404 before creation (no fabricated profile)")
|
||||
|
||||
# 4. 生辰预览:纯本地计算,无模型参与(BirthInput 只收 name/birth/hour)
|
||||
r = client.post("/api/companion/preview",
|
||||
json={k: birth[k] for k in ("name", "birth", "hour")})
|
||||
preview_pillars = r.json().get("pillars") if r.status_code == 200 else None
|
||||
check(r.status_code == 200 and "pillars" in r.json() and "sections" in r.json(),
|
||||
"POST /api/companion/preview 200 (local bazi compile)")
|
||||
|
||||
# 5. 创建 + 底色只读落库
|
||||
r = client.post("/api/companion", json=birth)
|
||||
check(r.status_code == 201 and r.json()["name"] == "临川",
|
||||
"POST /api/companion 201")
|
||||
row = st.store.query_one("SELECT pillars FROM bazi_core WHERE id=1")
|
||||
saved_day = json.loads(row["pillars"])["day"][0] if row else None
|
||||
prev_day = (preview_pillars or {}).get("day", [None])[0]
|
||||
check(saved_day is not None and saved_day == prev_day,
|
||||
f"bazi_core persisted and matches preview (day master {saved_day})")
|
||||
check(client.post("/api/companion", json=birth).status_code == 409,
|
||||
"second create refused 409 (single companion guard)")
|
||||
pv = client.get("/api/persona").json()
|
||||
check(pv["interpretation"] is None and pv["state"] in {"failed", "loading", "disabled"},
|
||||
f"persona honest at cap=0 (state={pv['state']}, no fabricated interpretation)")
|
||||
|
||||
# 6. 传输:SSE 对话在预算 0 下诚实拒绝,零出站
|
||||
turn1 = str(uuid.uuid4())
|
||||
with client.stream("POST", "/api/chat",
|
||||
json={"text": "在吗", "turn_id": turn1, "epoch": st.epoch}) as resp:
|
||||
check(resp.status_code == 200 and resp.headers["content-type"].startswith("text/event-stream"),
|
||||
"POST /api/chat opens SSE stream")
|
||||
kinds = [json.loads(line[6:])["t"] for line in resp.iter_lines()
|
||||
if line.startswith("data: ")]
|
||||
check("chat.error" in kinds and "chat.final" not in kinds,
|
||||
f"chat honestly errors at cap=0 (frames={kinds})")
|
||||
check(not outbound, f"zero provider stream calls (outbound={outbound})")
|
||||
msgs = client.get("/api/messages").json()["messages"]
|
||||
check(msgs and msgs[-1]["role"] == "user" and msgs[-1]["status"] in {"failed", "cancelled"},
|
||||
"failed turn persisted as user row, no fake companion reply")
|
||||
with client.stream("POST", "/api/chat",
|
||||
json={"text": "在吗", "turn_id": turn1, "epoch": st.epoch}) as resp:
|
||||
kinds2 = [json.loads(line[6:])["t"] for line in resp.iter_lines()
|
||||
if line.startswith("data: ")]
|
||||
check("chat.error" in kinds2 and not outbound,
|
||||
"retry same failed turn: honest error again, still zero outbound")
|
||||
|
||||
# 7. 关系可调整、名字保留
|
||||
r = client.patch("/api/relation", json={"relation": "恋人"})
|
||||
check(r.status_code == 200 and r.json()["relation"] == "恋人" and r.json()["name"] == "临川",
|
||||
"PATCH /api/relation 200 (relation adjustable, name kept)")
|
||||
|
||||
# 8. 日子与回忆:服务端裁剪 + 分页形状(told=1 之外不可见)
|
||||
r = client.get("/api/life")
|
||||
check(r.status_code == 200 and r.json()["events"] == [],
|
||||
"GET /api/life 200 empty (only told events, none yet)")
|
||||
r = client.get("/api/memories")
|
||||
check(r.status_code == 200 and r.json()["memories"] == [],
|
||||
"GET /api/memories 200 empty")
|
||||
check(client.get("/api/life/1").status_code == 404,
|
||||
"GET /api/life/1 404 (unshared detail refused)")
|
||||
bogus = {"message_id": 99999, "turn_id": str(uuid.uuid4()), "epoch": st.epoch,
|
||||
"token": "x" * 40, "text_hash": "0" * 64}
|
||||
check(client.post("/api/chat/received", json=bogus).status_code == 404,
|
||||
"POST /api/chat/received 404 on unknown receipt")
|
||||
|
||||
# 9. 语音诚实拒绝:配置指向死地址 → 开房必须 503,绝不建房
|
||||
r = client.get("/api/voice/status")
|
||||
check(r.status_code == 200 and r.json()["configured"] is True and r.json()["voice"] is False,
|
||||
"GET /api/voice/status 200, voice honestly false")
|
||||
r = client.post("/api/voice/session")
|
||||
check(r.status_code == 503,
|
||||
f"POST /api/voice/session honest 503 when TTS unreachable ({r.status_code})")
|
||||
check(client.delete("/api/voice/session/no-such").status_code == 404,
|
||||
"DELETE /api/voice/session/{unknown} honest 404")
|
||||
|
||||
# 10. 静态页与 dist 哈希(只读)
|
||||
if args.web:
|
||||
page = client.get("/")
|
||||
check(page.status_code == 200 and b"<div id=" in page.content,
|
||||
"GET / serves web dist index.html")
|
||||
|
||||
# 11. 重开:新进程入口、epoch 递增、资料保留
|
||||
with TestClient(app) as client2:
|
||||
h2 = client2.get("/api/health").json()
|
||||
check(h2["epoch"] == 2, f"reopen: epoch=2 (got {h2['epoch']})")
|
||||
c2 = client2.get("/api/companion").json()
|
||||
check(c2["name"] == "临川" and c2["relation"] == "恋人" and c2["birth"] == "2001-08-16",
|
||||
"reopen: companion identity + adjusted relation retained")
|
||||
m2 = client2.get("/api/messages").json()["messages"]
|
||||
check(len(m2) == 1 and m2[0]["role"] == "user",
|
||||
"reopen: chat history retained, still no fabricated replies")
|
||||
|
||||
if args.web:
|
||||
manifest = json.loads((Path(__file__).parent / "dist-manifest.json").read_text())
|
||||
bad = []
|
||||
for rel, want in manifest.items():
|
||||
p = Path(args.web) / rel
|
||||
if not p.is_file():
|
||||
bad.append(f"{rel} missing")
|
||||
continue
|
||||
import hashlib
|
||||
|
||||
got = hashlib.sha256(p.read_bytes()).hexdigest()
|
||||
if got != want:
|
||||
bad.append(f"{rel} {got[:12]}!={want[:12]}")
|
||||
check(not bad, f"dist matches manifest ({len(manifest)} files; bad={bad})")
|
||||
|
||||
for k, v in old.items():
|
||||
if v is None:
|
||||
os.environ.pop(k, None)
|
||||
else:
|
||||
os.environ[k] = v
|
||||
|
||||
failed = [label for ok, label in RESULTS if not ok]
|
||||
print(f"\n{len(RESULTS) - len(failed)}/{len(RESULTS)} checks passed")
|
||||
if failed:
|
||||
print("FAILED:")
|
||||
for f in failed:
|
||||
print(" - " + f)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,19 @@
|
||||
# HEL-913 统一体验运行包 · voice 配置模板(脱敏)
|
||||
#
|
||||
# 用法:复制到 <实例>/etc/voice.yaml。真实值属于服务器本地(不入仓库):
|
||||
# livekit 指向 .12 本机 LiveKit(内部明文 7880;浏览器侧若走独立 TLS 桥,
|
||||
# 由部署时的 wss 桥地址替换 livekit_url,桥属可选件);TTS/面板地址在
|
||||
# 语音窗口获批启动后填本机 9880/8090。registry/worker_state 落在实例数据
|
||||
# 目录内,与产品库同空间,随实例备份。
|
||||
livekit_url: <ws://127.0.0.1:7880 或获批 wss 桥地址>
|
||||
livekit_internal: http://127.0.0.1:7880
|
||||
api_key: <LiveKit api key,服务器本地>
|
||||
api_secret: <LiveKit api secret,服务器本地>
|
||||
agent_name: cybergril-voice-agent
|
||||
tts_health_url: http://127.0.0.1:9880/health
|
||||
panel_url: https://127.0.0.1:8090
|
||||
tts_url: http://127.0.0.1:9880
|
||||
registry_file: <实例数据目录>/voices.json
|
||||
worker_state_file: <实例数据目录>/voice_state_cybergril.json
|
||||
token_ttl_seconds: 300
|
||||
session_ttl_seconds: 900
|
||||
@@ -0,0 +1,12 @@
|
||||
# HEL-913 统一体验运行包 · 语音 worker 环境模板(脱敏)
|
||||
# 用法:复制到 <实例>/worker/.env。真实 LiveKit 凭据属于服务器本地。
|
||||
# 运行解释器是 agent venv(livekit-agents 1.8.8),不是产品 .venv311。
|
||||
CYBERGRIL_API_BASE=http://127.0.0.1:<API HTTP 端口>
|
||||
CYBERGRIL_AGENT_NAME=cybergril-voice-agent
|
||||
LIVEKIT_URL=ws://127.0.0.1:7880
|
||||
LIVEKIT_API_KEY=<LiveKit api key,服务器本地>
|
||||
LIVEKIT_API_SECRET=<LiveKit api secret,服务器本地>
|
||||
CYBERGRIL_WORKER_HEALTH_PORT=<worker 健康端口,如 8082,须未占用>
|
||||
CYBERGRIL_VOICE_STATE=<实例数据目录>/voice_state_cybergril.json
|
||||
# ASR 用量账本独立于产品库,落在实例数据目录:
|
||||
CYBERGRIL_ASR_USAGE_LEDGER=<实例数据目录>/asr-usage.jsonl
|
||||
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
# HEL-913 统一体验运行包 · 专属语音 worker 启停(只按 PID 句柄停止)
|
||||
#
|
||||
# 运行解释器是 agent venv(livekit-agents 1.8.8),产品代码经 PYTHONPATH 注入。
|
||||
# worker 只连接本实例 API 与本机 LiveKit;停止只杀自己写的 PID,不匹配进程名。
|
||||
#
|
||||
# 用法: [ENV=..] bash deploy/hel913-unified/worker_ctl.sh start|stop|status
|
||||
# 环境变量:
|
||||
# HEL913_BASE 实例根目录(含 current/ worker/ 等)
|
||||
# HEL913_AGENT_VENV agent venv python(默认 /opt/voice-agent/agent/venv/bin/python)
|
||||
# HEL913_WORKER_HEALTH 健康端口(默认 8082;与 worker/.env 中一致)
|
||||
set -u
|
||||
BASE=${HEL913_BASE:-/opt/cybergril-hel913}
|
||||
VENV=${HEL913_AGENT_VENV:-/opt/voice-agent/agent/venv/bin/python}
|
||||
HEALTH=${HEL913_WORKER_HEALTH:-8082}
|
||||
LOG=$BASE/logs/worker.log
|
||||
PIDF=$BASE/logs/worker.pid
|
||||
|
||||
stop() {
|
||||
if [ -f "$PIDF" ]; then
|
||||
P=$(cat "$PIDF")
|
||||
if [ "$P" != "$$" ] && kill -0 "$P" 2>/dev/null; then kill "$P"; sleep 3; fi
|
||||
if [ "$P" != "$$" ] && kill -0 "$P" 2>/dev/null; then kill -9 "$P"; fi
|
||||
rm -f "$PIDF"
|
||||
echo "worker stopped (pid $P)"
|
||||
else
|
||||
echo "no pid file; nothing stopped"
|
||||
fi
|
||||
}
|
||||
|
||||
case "${1:-}" in
|
||||
stop) stop; exit 0 ;;
|
||||
status)
|
||||
if [ -f "$PIDF" ]; then P=$(cat "$PIDF"); kill -0 "$P" 2>/dev/null && echo "running pid $P" || echo "pid $P not alive"; fi
|
||||
curl -s --max-time 3 "http://127.0.0.1:$HEALTH/" >/dev/null && echo "health ok" || echo "health port not answering"
|
||||
exit 0 ;;
|
||||
esac
|
||||
|
||||
cd "$BASE/worker"
|
||||
set -a
|
||||
source "$BASE/worker/.env"
|
||||
set +a
|
||||
PYTHONPATH="$BASE/current/src" nohup "$VENV" -m cybergril.voice.worker start > "$LOG" 2>&1 &
|
||||
echo $! > "$PIDF"
|
||||
echo "worker starting (pid $(cat "$PIDF"))"
|
||||
sleep 18
|
||||
grep -m1 "registered worker" "$LOG" >/dev/null && echo "OK: worker registered" \
|
||||
|| { echo "FAIL:"; tail -8 "$LOG"; exit 1; }
|
||||
@@ -0,0 +1,76 @@
|
||||
# HEL-913 · 一页能力清单与一次真实启用建议
|
||||
|
||||
依据:候选 head `4a38106`(HEL-912 审核通过)、HEL-907/910 真实窗口记录、
|
||||
HEL-913 离线验证 34/34(`docs/rework/hel913/verify-offline-run.txt`)。分级只分
|
||||
三种:**✅接好且已验证**(真实窗口或真实服务验证过)/ **🟡有实现、缺真实验证**
|
||||
(代码与离线/替身验证在,真实链路未跑或未批预算)/ **❌尚未接入**。不照抄
|
||||
旧表:语音已接(HEL-907/910 实测),下述端口/能力以当前源码为准。
|
||||
|
||||
## 1. 能力清单(按用户使用顺序)
|
||||
|
||||
| # | 用户动作 | 现状 | 具体行为与证据 |
|
||||
| --- | --- | --- | --- |
|
||||
| 1 | 打开网页 | ✅ | HTTPS 入口出界面(自签证书需浏览器「高级→继续」);`GET /` 出 index.html、dist 8 文件哈希核过(HEL-913 验证)。导航:此刻/交谈/日子/设置(`web/src/app/RealApp.tsx`) |
|
||||
| 2 | 自己给她起名、选生日、选关系 | ✅(起名/生日/关系)/ 🟡(自主诠释与初始习惯) | 用户亲选关系(不预选,AM-002)、亲起名(AM-003);创建守门 404/409、八字底色落库只读、公历农历四柱展示(`src/cybergril/api/app.py:427`、`src/cybergril/core/birth_view.py`)。**自主诠释/习惯生成(persona)从未真实跑过**:所有真实窗口 background=0 诚实拒绝(HEL-910 预检证实),首次用户体验需预算 |
|
||||
| 3 | 文字聊天 | ✅ | 真实网页 Enter 发送、SSE 流式回复、完整落库;语音在播时文字打断=旧声停+完整文字回复+语音恢复(HEL-910 两通实测);生成中取消/被打断轮回执缺席(HEL-908 修复,HEL-910 实测);失败轮诚实 error 不伪造 |
|
||||
| 4 | 她的生活(自己运行) | 🟡 | 生活循环/活动线程/分享判定/回执代码接好(`src/cybergril/life/`);未分享生活服务端裁剪(told=1,AM-001)离线+真实服务浏览器验证;**真实生活事件生成未发生**(life 预算 0),日子页真实模式下尚无真实事件可看 |
|
||||
| 5 | 记忆 | 🟡(分两层) | 聊天记忆:逐轮落库、遗忘下限、词面检索(FTS)已接,真实窗口对话随轮落库(团队测试库);**语义记忆(真实 Mem0)缺依赖**:.12 venv311 四项未装(2026-10-29 实测),安装路径见运行包 §7;激活还需 B 部分嵌入/提取预算 |
|
||||
| 6 | 关掉网页再回来 | ✅ | 同一位她保留:聊天/关系/八字/记忆持久;epoch 递增同步、分页缺口不跳留言、未读标记(HEL-895/896 真实服务浏览器 9 项检查;HEL-913 离线重开验证) |
|
||||
| 7 | 她主动留言 | 🟡 | 时机判定+网页内留言卡+回来即看的前端链路已接并经真实服务浏览器验证(种子数据);**真实 LLM 主动措辞生成未发生**(proactive 预算 0);不接手机推送(CG-011 首版范围) |
|
||||
| 8 | 语音通话 | ✅(工程验证) | 真实网页开通话、连续对话、字幕同步、挂断删房;文字打断在播旧声实测停(≤~1.4s);首声原实测 9.53s,HEL-911 移除 3.66s 等待后**未实测复测**(离线推算 ~5.9s);真人麦克风打断/生成中文字取消正面样本未取得(承接) |
|
||||
| 9 | 自定义声音 | ✅(工程验证) | 网页上传参考音频→登记→真 TTS 试听→应用→下一通生效;通话中改选不换声(HEL-907 全链 13/14 步实测,call1/2 以 cg- 音色真实合成);用户本人尚未亲自用过 |
|
||||
| 10 | 换城市/天气跟随 | ❌ | 设置页城市项为演示(`web/src/manage/ManagePanel.tsx` cap=demo/off);后端无天气源(CG-023 承接 R6,T-07) |
|
||||
| 11 | 换外观素材 | ❌ | 设置页外观项为演示;素材规范/导入未定稿(CG-005/030,T-03,R6;视觉参考见 PR#8 prototypes/hel-793/) |
|
||||
| 12 | 备份导出/每日自动备份 | ❌(演示导出除外) | 设置页「本地演示导出」为演示件;CG-009 每日自动备份+手动完整导出未实现(R6);现阶段只有发布归档工具 `tools/release_snapshot_hel896.py`(工程用,不冒充 R6) |
|
||||
| 13 | 摄像头观察 | ❌ | 无视觉服务接入;CG-021/022(R7),4080 未触,部署由用户负责(T-05) |
|
||||
| 14 | 真实人物口型/交谈半身 | ❌ | 交谈时人物为静帧参考图(`assets/her-talk.jpg`);成品视频选片与实时驱动器未选型(CG-029,T-09;8340/ComfyUI 停机) |
|
||||
|
||||
机器可读口径:`GET /api/health` 的 `capabilities`(voice/vision/weather/materials/
|
||||
backup=false 为诚实声明;text=true)。
|
||||
|
||||
## 2. 一次真实启用建议(待批准;当前配置仍全 0,不继承旧窗口余额)
|
||||
|
||||
**原则**:团队检查、用户首体验、长期后台三本账分开(独立实例/独立库,
|
||||
HEL-896 §6 分账语义),任何一本用完不自动转到另一本;所有硬闸发送前拒绝、
|
||||
碰顶即停、封账不解除;提额永远是新批准。费用均为内网自持服务
|
||||
(LLM 网关 .11:8731、TTS/ASR/LiveKit 在 .12),**无新增现金支出**,
|
||||
消耗的是授权额度与本机资源;用户不需要理解 token/EOU,只批下面三件事:
|
||||
开多久、要不要记忆、语音几通。
|
||||
|
||||
### A · 团队验收检查(总管权限内新批,不用问用户)
|
||||
- 沿用 `docs/budget-package-hel895.md` §6:独立团队实例 55 次/500,000 tokens/
|
||||
0 嵌入,体验链 1–7 走完即 `seal_budget_hel879.py` 封账归档。用途:发布前
|
||||
把创建→诠释→对话→生活→情绪关系→主动联系→重开同步整体走一遍(本清单
|
||||
🟡 项的团队级补证)。
|
||||
|
||||
### B · 用户首体验(建议一次批准;最小够用)
|
||||
- **时长**:建议 3 个自然日窗口(如周五晚–周日晚),期内任意使用,期满
|
||||
配置归 0、数据全保留(她不重置)。
|
||||
- **文字与生活**:对话 60 轮/日、生活 8 次/日、判定/成长/摘要 40 次/日、
|
||||
日 token 池 2,000,000(C 表值);创建+诠释+习惯 4 次一次性。
|
||||
- **记忆**:如批准,先执行运行包 §7 的 Mem0 安装(40 轮一次性下载安装,
|
||||
约 500–600MB 磁盘),再按 B 算式:提取 LLM 累计 60 次、嵌入新增 180 条
|
||||
(embed_cap=680、冻结 2 条不动)、语义类 40 次/日。**不批安装则记忆停在
|
||||
词面检索**,其余体验不受影响(stub 已验证可全链跑通)。
|
||||
- **语音**:3 通/窗口、累计 ≤2 小时(与 v1.12 授权同形,新批);需用户当场
|
||||
在浏览器允许麦克风(HTTPS+自签证书「高级→继续」);ASR ≤1800 秒/窗口、
|
||||
TTS ≤60 段/窗口、建房即用即删。自定义声音当场可用(上传→试听→应用)。
|
||||
- **停**:任一类别到顶当次诚实拒绝、当日该类停;窗口到期统一归零封账;
|
||||
团队账耗尽不影响本账,反之亦然。
|
||||
- **断开与恢复**:关网页/断开后她的档案、聊天、关系、记忆原样保留(重开
|
||||
验证过);语音所需的共享 TTS 9880/面板 8090 只在批准窗口内启动、窗口后
|
||||
停回(`deploy/voice/restart_cybergril.sh.example` 流程参考),LiveKit 7880
|
||||
常驻无需动。
|
||||
- **如实告知用户的已知边界**:首声延迟修复后未实测(原 9.5s、离线推算
|
||||
~5.9s);真人打断正面样本未取得;日子/主动留言的真实生成首次发生在这
|
||||
个窗口里,质量如不足属正常迭代范围。
|
||||
|
||||
### C · 长期后台
|
||||
- 暂不批。首体验结束后凭实际用量与质量报告(`llm_ops`/`embed_ops`/日账
|
||||
导出)再定常驻节奏;在此之前 `CYBERGRIL_R2_ENABLED` 保持按窗口启停。
|
||||
|
||||
## 3. 不变边界
|
||||
|
||||
本建议不改变任何需求与验收状态:8300/8310/8320/8350 与资料不动、正式界面
|
||||
不替换、PR 不合并、4080 不触、旧三窗口余额不结转;阶段体验不等于完整产品
|
||||
完成,R5–R7 未完项继续按主卡承接。
|
||||
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"baseline_version": "1.12",
|
||||
"read_commit": "4a38106eef21c43ba24ab7d07992b1bfe539137d",
|
||||
"task": "HEL-913:把通过 HEL-912 审核的统一候选(agent/2/8e99cc2cc592 @ 4a38106)装成可交接的统一体验运行包:固定版本清单与哈希、脱敏配置模板、单进程 HTTP/HTTPS 唯一启动方式、worker 接线、独立空资料空间与停止/备份/保留资料回退说明;一次零真实调用的运行准备离线验证(.12 产品 3.11 venv,TestClient 34/34,零监听零出站);核实真实记忆运行缺项(.12 venv311 四项未装、服务器无任何已备 3.11 环境或离线包;工作站持有固定 tarball/已建轮/92MB 模型缓存,40 轮待批一次性下载安装);按用户使用顺序的一页能力清单;集中一次真实启用建议(A 团队检查 / B 用户首体验 / C 长期后台三本账,全部待批,当前配置仍 0)。本卡不部署、不监听 836x/8082/9880/8090、不触 4080、不下载、不合 PR、不动现有实例与资料。",
|
||||
"requirement_ids": [
|
||||
"CG-006",
|
||||
"CG-007",
|
||||
"CG-008",
|
||||
"CG-009",
|
||||
"CG-010",
|
||||
"CG-012",
|
||||
"CG-013",
|
||||
"CG-014",
|
||||
"CG-015",
|
||||
"CG-016",
|
||||
"CG-018",
|
||||
"CG-019",
|
||||
"CG-020",
|
||||
"CG-021",
|
||||
"CG-023",
|
||||
"AM-001",
|
||||
"AM-002",
|
||||
"AM-003",
|
||||
"GOV-001",
|
||||
"GOV-002",
|
||||
"GOV-003",
|
||||
"GOV-004",
|
||||
"GOV-006",
|
||||
"DEL-001"
|
||||
],
|
||||
"deliverable": "deploy/hel913-unified/(README 运行说明、manifest.json、dist-manifest.json 8 文件 SHA256、models/voice/worker.env 三份脱敏模板全 0、api_ctl.sh/worker_ctl.sh 启停、verify_offline.py、mem0-cp311-wheels.txt 40 项缺轮清单);docs/rework/hel913/verify-offline-run.txt(34/34 实跑记录);docs/hel913-capability-and-enablement.md(一页能力清单 14 项三态分级 + 一次启用建议)。web dist 复用依据:git diff 958c696 4a38106 -- web/ 为空,HEL-910 实测构建件哈希核对后只读复用,不装 node 不重建。",
|
||||
"acceptance": [
|
||||
"运行包完整性:精确 head/锁文件/环境引用(venv311=3.11.16、agent venv=livekit-agents 1.8.8、证书路径、LiveKit 7880 常驻)齐备;唯一启动方式=deploy/voice/serve_dual_8360_8361.py 单进程双入口;停止顺序 worker→api;备份=release_snapshot_hel896 一致性快照;回退=快照+git 切回旧 head;撤销留资料=data 目录原样保留",
|
||||
"零真实调用验证(.12 venv311 实跑 34/34):包完整(候选树 import+锁定依赖)、入口健康诚实(llm.ok=false)、空库 404 无伪造档案、创建守门 409、八字落库与预览一致、persona 在 cap=0 诚实 failed、SSE 对话预算 0 下诚实 chat.error 且 provider.stream 出站哨兵 0 次、失败轮如实落库、同轮重试幂等、关系可调名字保留、未分享生活服务端裁剪、未知回执/详情 404、语音 TTS 不可达开房 503 不建房、未知会话 DELETE 404、重开 epoch=2 资料全保留、GET / 出 index.html、dist 8 文件哈希全符;worker 在 agent venv import 通过(未启动注册)",
|
||||
"记忆缺项核实:.12 venv311 无 mem0/qdrant_client/fastembed/onnxruntime(实测);服务器全盘无固定 tarball/已建轮/fastembed 缓存,uv 缓存 28K,无另一 3.11 环境;工作站实物 tarball sha256 9dcef930… 与 lock 一致、固定源轮 698284b6… 一致、fastembed 缓存 92MB、hel857-venv 为 3.10 不可混;最少安装=运行包 README §7(40 轮一次批准窗口 + --no-index 安装 + co-import),空间约 500–600MB,本卡零安装零下载",
|
||||
"能力清单 14 项按用户顺序三态分级(语音已接并以 HEL-907/910 实测纠正旧表;天气/素材/备份/摄像头/真实口型如实标 ❌ 并追到当前文件与承接);启用建议分 A/B/C 三本账、含时长/上限/费用(内网自持零现金)/何时停/开麦/断开保留/共享服务恢复/记忆前置,全部待批、默认 0、旧三窗口余额不结转",
|
||||
"边界保持:未部署未监听、8300/8310/8320/8350 与资料未动、8340/ComfyUI 停机、.12 临时树 /tmp/hel913-verify 与本机 tar 均已清理、需求与用户原话零改动"
|
||||
],
|
||||
"deferred": [
|
||||
"实际部署与启用:待总管向白栖知说明获批后按 deploy/hel913-unified/README.md 执行(含端口选择、团队/用户实例分账配置)",
|
||||
"Mem0 cp311 安装(40 轮下载+安装+co-import+缓存落位):待一次性批准,唯一入口 deploy/hel895-release-candidate.md §4",
|
||||
"persona 自主诠释、生活事件、主动留言的真实生成:从未在真实窗口发生(预算 0),A 团队检查与 B 用户首体验窗口补证",
|
||||
"语音遗留:修复后首声实测(原 9.53s、离线推算 ~5.9s)、真人麦克风打断、生成中文字取消正面样本、真机/手机/Safari(承接 HEL-910/911 deferred)",
|
||||
"R5–R7 完整功能(每日自动备份/天气/素材/摄像头/真实口型)继续主卡承接,不因运行包完成而关闭"
|
||||
],
|
||||
"requirement_changes": [],
|
||||
"verification": [
|
||||
"python3 scripts/check_requirements.py --base-ref origin/main 与 --base-ref 4a38106eef21c43ba24ab7d07992b1bfe539137d,均带 --handoff docs/requirements/handoff-HEL-913.json 通过(结构检查,不代替原话核对与体验验收)",
|
||||
"docs/rework/hel913/verify-offline-run.txt:34/34(.12 venv311、候选树、零监听零出站:网关地址重写 127.0.0.1:1 + stream 出站哨兵);agent venv worker import ok",
|
||||
"dist 复用:git diff 958c696 4a38106 -- web/ 为空;8 文件 sha256 于 .12 实测与 dist-manifest.json 一致",
|
||||
"记忆缺项:.12 实测 import 四项失败;服务器 find 无 mem0 轮/缓存;工作站 tarball/wheel sha256 本卡复验一致",
|
||||
"未验证(如实):运行包尚未在任何现网端口实际起服(cap=0 未部署);修复后语音首声、真机、Safari——见 deferred,不冒充"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
PASS python 3.11 (actual (3, 11, 16))
|
||||
PASS cybergril imported from candidate tree (/tmp/hel913-verify/src/cybergril/__init__.py)
|
||||
PASS deps: fastapi 0.159.1 uvicorn 0.54.0 httpx 0.28.1 pydantic 2.14.1
|
||||
PASS product modules import (api.app / voice.router / voice.session)
|
||||
PASS mem0 absent in product venv (as documented)
|
||||
PASS qdrant_client absent in product venv (as documented)
|
||||
PASS fastembed absent in product venv (as documented)
|
||||
PASS GET /api/health 200, text capability true
|
||||
PASS health: companion_created=false before creation
|
||||
PASS health: llm honestly not ok (dead addr, cap=0)
|
||||
PASS GET /api/companion 404 before creation (no fabricated profile)
|
||||
PASS POST /api/companion/preview 200 (local bazi compile)
|
||||
PASS POST /api/companion 201
|
||||
PASS bazi_core persisted and matches preview (day master 辛)
|
||||
PASS second create refused 409 (single companion guard)
|
||||
PASS persona honest at cap=0 (state=failed, no fabricated interpretation)
|
||||
PASS POST /api/chat opens SSE stream
|
||||
PASS chat honestly errors at cap=0 (frames=['chat.error'])
|
||||
PASS zero provider stream calls (outbound=[])
|
||||
PASS failed turn persisted as user row, no fake companion reply
|
||||
PASS retry same failed turn: honest error again, still zero outbound
|
||||
PASS PATCH /api/relation 200 (relation adjustable, name kept)
|
||||
PASS GET /api/life 200 empty (only told events, none yet)
|
||||
PASS GET /api/memories 200 empty
|
||||
PASS GET /api/life/1 404 (unshared detail refused)
|
||||
PASS POST /api/chat/received 404 on unknown receipt
|
||||
PASS GET /api/voice/status 200, voice honestly false
|
||||
PASS POST /api/voice/session honest 503 when TTS unreachable (503)
|
||||
PASS DELETE /api/voice/session/{unknown} honest 404
|
||||
PASS GET / serves web dist index.html
|
||||
PASS reopen: epoch=2 (got 2)
|
||||
PASS reopen: companion identity + adjusted relation retained
|
||||
PASS reopen: chat history retained, still no fabricated replies
|
||||
PASS dist matches manifest (8 files; bad=[])
|
||||
|
||||
34/34 checks passed
|
||||
Reference in New Issue
Block a user