lingshu-skill 5.61.0 → 5.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/README.md +1 -1
- package/SKILL-lite.md +1 -1
- package/SKILL-tiny.md +1 -1
- package/SKILL.md +1 -1
- package/assets/panel.html +2 -2
- package/manifest.json +461 -0
- package/package.json +8 -2
- package/scripts/astrbot_plugin_lingshu/CHECKSUMS.json +11 -11
- package/scripts/astrbot_plugin_lingshu/engine/CHANGELOG.md +30 -0
- package/scripts/astrbot_plugin_lingshu/engine/README.md +1 -1
- package/scripts/astrbot_plugin_lingshu/engine/SKILL-lite.md +1 -1
- package/scripts/astrbot_plugin_lingshu/engine/SKILL-tiny.md +1 -1
- package/scripts/astrbot_plugin_lingshu/engine/SKILL.md +1 -1
- package/scripts/astrbot_plugin_lingshu/engine/assets/panel.html +2 -2
- package/scripts/astrbot_plugin_lingshu/engine/scripts/growth.py +3 -4
- package/scripts/astrbot_plugin_lingshu/engine/scripts/make_dsh_tgz.py +20 -3
- package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_build.py +13 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_server.py +30 -10
- package/scripts/astrbot_plugin_lingshu/engine/scripts/panels.py +1 -0
- package/scripts/growth.py +3 -4
- package/scripts/make_dsh_tgz.py +20 -3
- package/scripts/make_manifest.py +15 -10
- package/scripts/make_plugin_zip.py +7 -3
- package/scripts/panel_build.py +13 -0
- package/scripts/panel_server.py +30 -10
- package/scripts/panels.py +1 -0
- package/scripts/_ci_env_probe.py +0 -81
- package/scripts/_panel_smoke_v299.py +0 -27
- package/scripts/_scratch/_tmp_backup_race.py +0 -70
- package/scripts/_scratch/_tmp_cleanup_move.py +0 -34
- package/scripts/_scratch/_tmp_count_kinds.py +0 -25
- package/scripts/_scratch/_tmp_diag_paths.py +0 -48
- package/scripts/_scratch/_tmp_facts.py +0 -63
- package/scripts/_scratch/_tmp_find_copies.py +0 -31
- package/scripts/_scratch/_tmp_find_pin.py +0 -29
- package/scripts/_scratch/_tmp_fix_pin.py +0 -36
- package/scripts/_scratch/_tmp_fold_fixture.py +0 -55
- package/scripts/_scratch/_tmp_fold_test.mjs +0 -81
- package/scripts/_scratch/_tmp_inject_secs.py +0 -30
- package/scripts/_scratch/_tmp_kb_balance.py +0 -159
- package/scripts/_scratch/_tmp_lines.py +0 -15
- package/scripts/_scratch/_tmp_market_probe.py +0 -13
- package/scripts/_scratch/_tmp_move_partial.py +0 -16
- package/scripts/_scratch/_tmp_patch_b3.py +0 -41
- package/scripts/_scratch/_tmp_patch_b5.py +0 -62
- package/scripts/_scratch/_tmp_patch_crash_excl.py +0 -24
- package/scripts/_scratch/_tmp_patch_handoff.py +0 -21
- package/scripts/_scratch/_tmp_patch_ps1.py +0 -25
- package/scripts/_scratch/_tmp_patch_stat.py +0 -27
- package/scripts/_scratch/_tmp_patch_todo.py +0 -25
- package/scripts/_scratch/_tmp_patch_todo2.py +0 -64
- package/scripts/_scratch/_tmp_probe_session.py +0 -51
- package/scripts/_scratch/_tmp_style_probe.py +0 -40
- package/scripts/_scratch/_tmp_write_note.py +0 -139
- package/scripts/_scratch/_/346/235/245/346/272/220/350/256/260/345/275/225.txt +0 -1
- package/scripts/_scratch/asar_compaction/dsh-compaction-basic__lib__index.js +0 -1044
- package/scripts/_scratch/asar_compaction/dsh-compaction-tool-result-pruner__lib__index.js +0 -194
- package/scripts/_scratch/asar_compaction/dsh-compaction__lib__index.js +0 -175
- package/scripts/_scratch/asar_compaction/dsh-compaction__lib__types__tool-pairing.js +0 -97
- package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction-image-offload__lib__types__image-offload.js +0 -47
- package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction-image-offload__lib__types__index.js +0 -40
- package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction-image-offload__lib__types__project-message.js +0 -37
- package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction__lib__types__brand.js +0 -9
- package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction__lib__types__checkpoint.js +0 -36
- package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction__lib__types__types.js +0 -10
- package/scripts/_scratch/commit_msg_occ.txt +0 -16
- package/scripts/_scratch/commit_msg_struct.txt +0 -16
- package/scripts/_scratch/v5.34_changelog.txt +0 -36
- package/scripts/_smoke_v299.py +0 -31
- package/scripts/_sync_trae_cn.py +0 -102
- package/scripts/_tmp_add_s10.py +0 -54
- package/scripts/_tmp_add_s11.py +0 -61
- package/scripts/_tmp_add_s12.py +0 -66
- package/scripts/_tmp_add_s13.py +0 -69
- package/scripts/_tmp_add_s14.py +0 -80
- package/scripts/_tmp_add_s9.py +0 -68
- package/scripts/_tmp_cache_load.py +0 -82
- package/scripts/_tmp_clean_market.py +0 -40
- package/scripts/_tmp_clean_pruned.py +0 -81
- package/scripts/_tmp_cleanup_docs.py +0 -39
- package/scripts/_tmp_cmp_ranker.py +0 -17
- package/scripts/_tmp_dolater_note.py +0 -35
- package/scripts/_tmp_dust_why.py +0 -27
- package/scripts/_tmp_explicit_import.py +0 -40
- package/scripts/_tmp_extract_compaction.py +0 -35
- package/scripts/_tmp_extract_compaction2.py +0 -63
- package/scripts/_tmp_extract_compaction3.py +0 -51
- package/scripts/_tmp_extract_compaction4.py +0 -54
- package/scripts/_tmp_finalize_s14.py +0 -39
- package/scripts/_tmp_find_compaction.py +0 -43
- package/scripts/_tmp_fix_b4.py +0 -22
- package/scripts/_tmp_fix_cli76.py +0 -26
- package/scripts/_tmp_fix_docs.py +0 -38
- package/scripts/_tmp_fix_docs_b.py +0 -46
- package/scripts/_tmp_fix_docs_b2.py +0 -22
- package/scripts/_tmp_fix_i3.py +0 -23
- package/scripts/_tmp_fix_s10.py +0 -83
- package/scripts/_tmp_fix_s11.py +0 -14
- package/scripts/_tmp_fix_s9_status.py +0 -19
- package/scripts/_tmp_fix_shadow_sim.py +0 -37
- package/scripts/_tmp_fix_traits_value.py +0 -41
- package/scripts/_tmp_import_idem.py +0 -106
- package/scripts/_tmp_log_ack.py +0 -45
- package/scripts/_tmp_mark_batch.py +0 -28
- package/scripts/_tmp_mark_batch2.py +0 -32
- package/scripts/_tmp_mark_dolater.py +0 -26
- package/scripts/_tmp_mark_dolater2.py +0 -31
- package/scripts/_tmp_move_self.py +0 -16
- package/scripts/_tmp_occ_cli.py +0 -22
- package/scripts/_tmp_occ_link.py +0 -108
- package/scripts/_tmp_optimize_recall.py +0 -54
- package/scripts/_tmp_panel_audit.py +0 -26
- package/scripts/_tmp_patch_batch3.py +0 -65
- package/scripts/_tmp_patch_rrf.py +0 -46
- package/scripts/_tmp_patch_s2s3.py +0 -80
- package/scripts/_tmp_patch_s4.py +0 -39
- package/scripts/_tmp_patch_s7.py +0 -43
- package/scripts/_tmp_patch_s8.py +0 -91
- package/scripts/_tmp_patch_skill.py +0 -17
- package/scripts/_tmp_release_guard.py +0 -57
- package/scripts/_tmp_rerank_breaker.py +0 -62
- package/scripts/_tmp_s16.py +0 -41
- package/scripts/_tmp_scan_asar.py +0 -41
- package/scripts/_tmp_scan_asar2.py +0 -37
- package/scripts/_tmp_speed_survey.py +0 -49
- package/scripts/_tmp_struct_docs.py +0 -49
- package/scripts/_tmp_sum_fallback.py +0 -42
- package/scripts/_tmp_sweep.py +0 -81
- package/scripts/_tmp_sync_check.py +0 -69
- package/scripts/_tmp_sync_tail.py +0 -39
- package/scripts/_tmp_todo_clean.py +0 -67
- package/scripts/_tmp_verify_copy.py +0 -17
- package/scripts/_tmp_wire_extras.py +0 -93
- package/scripts/_tmp_wire_hsum.py +0 -34
- package/scripts/_tmp_wire_occ_b5.py +0 -40
- package/scripts/_tmp_wire_ranker.py +0 -13
- package/scripts/_tmp_wire_shadow_timeline.py +0 -45
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_ci_env_probe.py +0 -81
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_panel_smoke_v299.py +0 -27
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_smoke_v299.py +0 -31
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_sync_trae_cn.py +0 -102
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s10.py +0 -54
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s11.py +0 -61
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s12.py +0 -66
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s13.py +0 -69
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s14.py +0 -80
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s9.py +0 -68
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_cache_load.py +0 -82
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_clean_market.py +0 -40
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_clean_pruned.py +0 -81
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_cleanup_docs.py +0 -39
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_cmp_ranker.py +0 -17
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_dolater_note.py +0 -35
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_dust_why.py +0 -27
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_explicit_import.py +0 -40
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_extract_compaction.py +0 -35
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_extract_compaction2.py +0 -63
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_extract_compaction3.py +0 -51
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_extract_compaction4.py +0 -54
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_finalize_s14.py +0 -39
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_find_compaction.py +0 -43
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_b4.py +0 -22
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_cli76.py +0 -26
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_docs.py +0 -38
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_docs_b.py +0 -46
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_docs_b2.py +0 -22
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_i3.py +0 -23
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_s10.py +0 -83
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_s11.py +0 -14
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_s9_status.py +0 -19
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_shadow_sim.py +0 -37
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_traits_value.py +0 -41
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_import_idem.py +0 -106
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_log_ack.py +0 -45
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_mark_batch.py +0 -28
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_mark_batch2.py +0 -32
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_mark_dolater.py +0 -26
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_mark_dolater2.py +0 -31
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_move_self.py +0 -16
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_occ_cli.py +0 -22
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_occ_link.py +0 -108
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_optimize_recall.py +0 -54
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_panel_audit.py +0 -26
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_batch3.py +0 -65
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_rrf.py +0 -46
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_s2s3.py +0 -80
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_s4.py +0 -39
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_s7.py +0 -43
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_s8.py +0 -91
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_skill.py +0 -17
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_release_guard.py +0 -57
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_rerank_breaker.py +0 -62
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_s16.py +0 -41
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_scan_asar.py +0 -41
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_scan_asar2.py +0 -37
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_speed_survey.py +0 -49
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_struct_docs.py +0 -49
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_sum_fallback.py +0 -42
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_sweep.py +0 -81
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_sync_check.py +0 -69
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_sync_tail.py +0 -39
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_todo_clean.py +0 -67
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_verify_copy.py +0 -17
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_extras.py +0 -93
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_hsum.py +0 -34
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_occ_b5.py +0 -40
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_ranker.py +0 -13
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_shadow_timeline.py +0 -45
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## v5.63(2026-12-04)
|
|
4
|
+
|
|
5
|
+
### 🖥️ 150 项审计第七批:面板后端数据与契约安全组闭环修复
|
|
6
|
+
|
|
7
|
+
对照 `灵枢项目-150项问题待办.md` 完成针对性修复与自动化回归覆盖:
|
|
8
|
+
|
|
9
|
+
1. **LS-071(高·删除面板 NameError 修复)**:`panels.py` 补充导入缺失的 `time` 模块,彻底解决删除面板移入垃圾桶时抛 `NameError: name 'time' is not defined` 导致删除崩溃的隐患。单测验证通过。
|
|
10
|
+
2. **LS-073(中·保留 keep=0 不修剪语义)**:`panel_server.py` 的 `_api_data_backup` 严格保留 `keep=0` 的真实语义(`data.get("keep") is not None`),杜绝将手动的显式 `0` 误兜底为默认 `20` 导致静默误剪裁历史备份。单测验证通过。
|
|
11
|
+
3. **LS-078(高·只读模式拦截 self-review)**:`panel_server.py` 的 `_api_skill_self_review` 增加只读检查,当处于只读模式时返回 403 明确阻断写历史与记账。单测验证通过。
|
|
12
|
+
4. **LS-079(高·消除 GET 接口写副作用)**:`/api/extensions/ollama/status` 从 GET 请求中剥离异步写盘探测操作,严格遵守 HTTP GET 幂等无写副作用规范。
|
|
13
|
+
5. **LS-082(高·体检摘要 SCRIPTS 未定义修复)**:`panel_server.py` 的 `/api/doctor/summary` 修复 `SCRIPTS` 变量未定义的致命 NameError,动态解析 `Path(__file__).resolve().parent`。单测验证通过。
|
|
14
|
+
6. **LS-083(高·体检前端统一携带 Token)**:`dochealth.js` 将原生 `fetch("/api/doctor/summary")` 升级为统一的 `api("/api/doctor/summary")`,自动附带 Bearer token,彻底消除由于缺凭据导致的 403 拒绝与控制台报错。
|
|
15
|
+
7. **LS-086 / LS-087(高·技能安装契约与风险确认统一)**:`panel_server.py` 的 `_api_skill` 统一兼容 `accept_risk`、`accepted_risk` 与 `yes` 字段;并在响应中同时挂载 `result` 与 `skill` 双键,与前端接口契约严格对称。单测验证通过。
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## v5.62(2026-12-04)
|
|
20
|
+
|
|
21
|
+
### 📦 150 项审计第六批:构建、打包与部署过滤组闭环修复
|
|
22
|
+
|
|
23
|
+
对照 `灵枢项目-150项问题待办.md` 完成针对性修复与自动化回归覆盖:
|
|
24
|
+
|
|
25
|
+
1. **LS-116 / LS-117(高·npm 发布包白名单强化)**:`package.json` 显式将 `manifest.json` 纳入发布文件,保证安装后能够逐文件校验 SHA256 完整性;同时通过模式匹配排除 `_tmp*`、`_scratch`、`_ci_env_probe` 等开发探针。单测与 `npm pack --dry-run` 验证通过。
|
|
26
|
+
2. **LS-118(中·AstrBot 插件过滤)**:`make_plugin_zip.py` 补充排除 `_tmp*`、`_ci_env_probe`、`_panel_smoke` 及 `_scratch`,严防开发与一次性脚本混入发布 zip。单测验证通过。
|
|
27
|
+
3. **LS-119 / LS-120(高·DSH tgz 严谨构建)**:`make_dsh_tgz.py` 在打包前强校验 manifest 所列文件在本地必须全部存在,若有缺失立即抛错终止,严防打出残缺空壳包;并将 `manifest.json` 自身打入 `package/` 根目录。单测验证通过。
|
|
28
|
+
4. **LS-121(中·二进制精确哈希)**:`make_manifest.py` 与 `growth.py` 修复哈希规范化规则——仅对文本文件执行换行符 CRLF→LF 归一化与剥 BOM;对 PNG、ICO 等二进制资产,严格按原始字节计算 SHA256 与文件大小,杜绝字节被篡改或哈希对不上。单测验证通过。
|
|
29
|
+
5. **LS-123(中·面板构建占位符强校验)**:`panel_build.py` 增加块消费完整度校验,若模板中缺少对应 `<!--@@BLOCK:i@@-->` 占位符、残留未消费块标记或块数量不一致,立即抛出 `ValueError`,杜绝残缺面板产物溜进发布。单测验证通过。
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
3
33
|
## v5.61(2026-12-04)
|
|
4
34
|
|
|
5
35
|
### 🔒 150 项审计第五批:锁机制与并发安全组闭环修复
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> 名字取自《黄帝内经》:**算力给思考,人格给灵魂,记忆给生命。**
|
|
4
4
|
|
|
5
|
-
> 当前版本 **v5.
|
|
5
|
+
> 当前版本 **v5.63**(变更见 [CHANGELOG.md](CHANGELOG.md))
|
|
6
6
|
|
|
7
7
|
> 🔁 **双仓库镜像**:GitHub(主)与 Gitee(镜像)保持同步——[gitee.com/htmcwy_0/lingshu-skill](https://gitee.com/htmcwy_0/lingshu-skill)。灵枢的更新检查会探测两边最新提交,**谁更新就自动从谁拉取**;任一边不可达(Gitee 匿名风控 / GitHub 限额)时走另一边兜底。
|
|
8
8
|
|
|
@@ -7832,8 +7832,8 @@ setTimeout(() => checkUpdate(true), 1200);
|
|
|
7832
7832
|
if (!sEl) return;
|
|
7833
7833
|
sEl.innerHTML = `<div class="sub">正在执行快速分级诊断…</div>`;
|
|
7834
7834
|
try {
|
|
7835
|
-
|
|
7836
|
-
const data = await
|
|
7835
|
+
// LS-083 (v5.63): 体检前端请求统一通过 api() 携带 token 凭据,防止被 403 阻拦
|
|
7836
|
+
const data = await api("/api/doctor/summary");
|
|
7837
7837
|
if (!data || !data.counts) {
|
|
7838
7838
|
sEl.innerHTML = `<div class="sub">体检摘要获取失败</div>`;
|
|
7839
7839
|
return;
|
|
@@ -1688,12 +1688,11 @@ def apply_update(src_dir: Path, dst_dir: Path,
|
|
|
1688
1688
|
+ ", ".join(sorted(_missing)[:8])
|
|
1689
1689
|
+ (f" 等 {len(_missing)} 个" if len(_missing) > 8 else ""))
|
|
1690
1690
|
def _norm_sha(p: Path) -> str:
|
|
1691
|
+
# LS-121(v5.62):二进制文件(png, ico等)不执行文本换行归一化,直接取原始字节 SHA
|
|
1692
|
+
if p.suffix.lower() in {".png", ".ico", ".jpg", ".jpeg", ".webp", ".gif", ".pdf", ".woff", ".woff2", ".ttf"}:
|
|
1693
|
+
return _sha256_file(p)
|
|
1691
1694
|
# 规范形态哈希:与 make_manifest.py 生成侧完全一致——
|
|
1692
1695
|
# CRLF→LF 归一化(autocrlf/git clone 的换行符差异)+ 剥 UTF-8 BOM
|
|
1693
|
-
# (raw 下载/记事本保存可能带 BOM)。字节形态不同但内容没变的文件
|
|
1694
|
-
# 放行,内容真被篡改仍然拦得住。
|
|
1695
|
-
# 注意分块方式:\r 必须暂存到下一块拼回来再 replace——否则恰好在
|
|
1696
|
-
# 64KB 边界被切成 \r|\n 的换行符会漏归一化,大文件哈希对不上。
|
|
1697
1696
|
h = hashlib.sha256()
|
|
1698
1697
|
first = True
|
|
1699
1698
|
tail = b""
|
|
@@ -33,9 +33,26 @@ EXCLUDE_NAMES = {"panel-token.txt", ".env", "LINGSHU_PANEL_TOKEN", "config.json"
|
|
|
33
33
|
|
|
34
34
|
def collect() -> list[Path]:
|
|
35
35
|
"""manifest 发布文件 + engine/ 全目录(都要先 sync 生成)。"""
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
manifest_p = ROOT / "manifest.json"
|
|
37
|
+
if not manifest_p.is_file():
|
|
38
|
+
raise SystemExit("[错误] 找不到 manifest.json,拒绝打包")
|
|
39
|
+
manifest = json.loads(manifest_p.read_text(encoding="utf-8"))
|
|
40
|
+
|
|
41
|
+
# LS-119(v5.62):DSH 打包遇到清单缺文件必须失败非零退出!
|
|
42
|
+
missing = []
|
|
43
|
+
files = []
|
|
44
|
+
for rel in manifest.get("files", {}):
|
|
45
|
+
p = ROOT / rel
|
|
46
|
+
if not p.is_file():
|
|
47
|
+
missing.append(rel)
|
|
48
|
+
else:
|
|
49
|
+
files.append(p)
|
|
50
|
+
if missing:
|
|
51
|
+
raise SystemExit(f"[错误] DSH 打包失败:manifest 中有 {len(missing)} 个文件在本地缺失!\n 缺失示例: {', '.join(missing[:5])}")
|
|
52
|
+
|
|
53
|
+
# LS-120(v5.62):将 manifest.json 本身加入 DSH tgz 的根目录,保证安装后能做完整哈希校验
|
|
54
|
+
files.append(manifest_p)
|
|
55
|
+
|
|
39
56
|
# engine/ 派生副本(打包时生成,不入库)
|
|
40
57
|
engine = ROOT / "scripts" / "astrbot_plugin_lingshu" / "engine"
|
|
41
58
|
if engine.is_dir():
|
|
@@ -82,11 +82,24 @@ def build(src: Path = SRC, out: Path | None = OUT) -> bytes:
|
|
|
82
82
|
"""拼装产物;out=None 时只返回字节、不落盘(--check 用,检查不该改文件)。"""
|
|
83
83
|
shell = (src / "index.html").read_bytes()
|
|
84
84
|
meta = json.loads((src / "blocks.json").read_text(encoding="utf-8"))
|
|
85
|
+
consumed = 0
|
|
85
86
|
for i, blk in enumerate(meta):
|
|
86
87
|
token = f"<!--@@BLOCK:{i}@@-->".encode()
|
|
88
|
+
if token not in shell:
|
|
89
|
+
raise ValueError(f"LS-123 缺失占位符:index.html 中未找到 {token.decode()} 无法嵌入块 {blk['file']}")
|
|
87
90
|
body = (src / blk["file"]).read_bytes()
|
|
88
91
|
close = b"</style>" if blk["kind"] == "style" else b"</script>"
|
|
89
92
|
shell = shell.replace(token, blk["open"].encode() + body + close, 1)
|
|
93
|
+
consumed += 1
|
|
94
|
+
|
|
95
|
+
# LS-123(v5.62):面板构建校验所有占位符和块均被消费!
|
|
96
|
+
# 检查产物中是否仍残留未被替换的 <!--@@BLOCK:*@@--> 占位符
|
|
97
|
+
leftover = re.findall(rb"<!--@@BLOCK:\d+@@-->", shell)
|
|
98
|
+
if leftover:
|
|
99
|
+
raise ValueError(f"LS-123 构建产物中残留未消费的占位符:{[x.decode() for x in leftover]}")
|
|
100
|
+
if consumed != len(meta):
|
|
101
|
+
raise ValueError(f"LS-123 ���消费不全:定义了 {len(meta)} 个块,实际消费 {consumed} 个")
|
|
102
|
+
|
|
90
103
|
if out is not None:
|
|
91
104
|
out.parent.mkdir(parents=True, exist_ok=True)
|
|
92
105
|
out.write_bytes(shell)
|
|
@@ -1148,10 +1148,12 @@ class Handler(BaseHTTPRequestHandler):
|
|
|
1148
1148
|
"stage": st, "health": st.get("health")})
|
|
1149
1149
|
return
|
|
1150
1150
|
if path == "/api/doctor/summary":
|
|
1151
|
-
# OPS-02: 运行 doctor 并返回按级别分类的摘要(P0/P1 判据)
|
|
1151
|
+
# OPS-02 & LS-082 (v5.63): 运行 doctor 并返回按级别分类的摘要(P0/P1 判据)
|
|
1152
|
+
# 修复 NameError: name 'SCRIPTS' is not defined —— SCRIPTS 未在该函数或全局定义
|
|
1152
1153
|
try:
|
|
1153
1154
|
import subprocess, sys as _sys
|
|
1154
|
-
|
|
1155
|
+
scripts_dir = Path(__file__).resolve().parent
|
|
1156
|
+
proc = subprocess.run([_sys.executable, str(scripts_dir / "brain.py"), "doctor", "--json"],
|
|
1155
1157
|
capture_output=True, text=True, encoding="utf-8", timeout=30)
|
|
1156
1158
|
data = json.loads(proc.stdout) if proc.stdout else {}
|
|
1157
1159
|
except Exception as exc:
|
|
@@ -1199,10 +1201,10 @@ class Handler(BaseHTTPRequestHandler):
|
|
|
1199
1201
|
self._json({"items": panel_settings.all_items()})
|
|
1200
1202
|
return
|
|
1201
1203
|
if path == "/api/extensions/ollama/status":
|
|
1202
|
-
# Ollama
|
|
1203
|
-
#
|
|
1204
|
-
#
|
|
1205
|
-
|
|
1204
|
+
# Ollama 扩展状态:只读返回安装/服务/模型/配置 + 进度
|
|
1205
|
+
# LS-079 (v5.63): 消除 GET 请求的写副作用!
|
|
1206
|
+
# 旧代码在 GET 中调用 _ollama_auto_probe_async(),后台会自动下载模型并写 config.json,
|
|
1207
|
+
# 违反 HTTP GET 无副作用的规范。自动探测接管改由 POST /api/extensions/ollama/probe 显式触发。
|
|
1206
1208
|
self._json(ollama_status())
|
|
1207
1209
|
return
|
|
1208
1210
|
if path == "/api/panels/market":
|
|
@@ -1490,10 +1492,21 @@ def _api_persona_update(self, path, data):
|
|
|
1490
1492
|
|
|
1491
1493
|
|
|
1492
1494
|
def _api_data_backup(self, path, data):
|
|
1493
|
-
"""
|
|
1495
|
+
"""立即备份。保留 keep=0 的不修剪语义(LS-073)。"""
|
|
1494
1496
|
import panel_data
|
|
1497
|
+
# LS-073 (v5.63): 保留手动备份 keep=0 的不修剪语义!
|
|
1498
|
+
# 旧代码 _to_int(data.get("keep"), 20) or 20 会把显式的 0 当作假值再次兜底成 20,
|
|
1499
|
+
# 破坏了 panel_data.make_backup(keep=0) "不修剪" 的明确语义。
|
|
1500
|
+
raw_k = data.get("keep")
|
|
1501
|
+
if raw_k is not None:
|
|
1502
|
+
try:
|
|
1503
|
+
keep_val = int(raw_k)
|
|
1504
|
+
except (ValueError, TypeError):
|
|
1505
|
+
keep_val = 20
|
|
1506
|
+
else:
|
|
1507
|
+
keep_val = 20
|
|
1495
1508
|
try:
|
|
1496
|
-
r = panel_data.make_backup(keep=
|
|
1509
|
+
r = panel_data.make_backup(keep=keep_val)
|
|
1497
1510
|
except PermissionError as exc:
|
|
1498
1511
|
self._json({"error": str(exc)}, 403)
|
|
1499
1512
|
return
|
|
@@ -1845,6 +1858,10 @@ def _api_daily(self, path, data):
|
|
|
1845
1858
|
|
|
1846
1859
|
|
|
1847
1860
|
def _api_skill_self_review(self, path, data):
|
|
1861
|
+
# LS-078 (v5.63): 只读模式下禁止通过 self-review 写入历史!
|
|
1862
|
+
if brain.READONLY:
|
|
1863
|
+
self._json({"error": "数据目录当前只读,无法执行 self-review 写历史"}, 403)
|
|
1864
|
+
return
|
|
1848
1865
|
# P2-4:自审也记一笔(成长阶段要用"self-review 次数")
|
|
1849
1866
|
try:
|
|
1850
1867
|
growth.record_doctor_run(0, 0, 0, kind="self-review")
|
|
@@ -2165,9 +2182,12 @@ def _api_skill(self, path, data):
|
|
|
2165
2182
|
except KeyError as exc:
|
|
2166
2183
|
self._json({"error": f"{_src_pref} 下载源不可用:{exc}"}, 502)
|
|
2167
2184
|
return
|
|
2185
|
+
# LS-086 & LS-087 (v5.63): 统一风险确认字段(兼容 accept_risk、accepted_risk 与 yes)
|
|
2186
|
+
# 并统一技能安装结果包装字段:返回 {"ok": True, "result": res, "skill": res} 双键对齐前端契约
|
|
2187
|
+
risk_ok = bool(data.get("accept_risk") or data.get("accepted_risk") or data.get("yes"))
|
|
2168
2188
|
res = growth.install_skill(_name, force=bool(data.get("force")), from_dir=_from,
|
|
2169
|
-
accept_risk=
|
|
2170
|
-
self._json({"ok": True, "skill": res, "workspace": workspace()})
|
|
2189
|
+
accept_risk=risk_ok)
|
|
2190
|
+
self._json({"ok": True, "result": res, "skill": res, "workspace": workspace()})
|
|
2171
2191
|
elif act == "uninstall":
|
|
2172
2192
|
res = growth.uninstall_skill(data.get("name", ""), managed_only=True)
|
|
2173
2193
|
self._json({"ok": True, "skill": res, "workspace": workspace()})
|
package/scripts/growth.py
CHANGED
|
@@ -1688,12 +1688,11 @@ def apply_update(src_dir: Path, dst_dir: Path,
|
|
|
1688
1688
|
+ ", ".join(sorted(_missing)[:8])
|
|
1689
1689
|
+ (f" 等 {len(_missing)} 个" if len(_missing) > 8 else ""))
|
|
1690
1690
|
def _norm_sha(p: Path) -> str:
|
|
1691
|
+
# LS-121(v5.62):二进制文件(png, ico等)不执行文本换行归一化,直接取原始字节 SHA
|
|
1692
|
+
if p.suffix.lower() in {".png", ".ico", ".jpg", ".jpeg", ".webp", ".gif", ".pdf", ".woff", ".woff2", ".ttf"}:
|
|
1693
|
+
return _sha256_file(p)
|
|
1691
1694
|
# 规范形态哈希:与 make_manifest.py 生成侧完全一致——
|
|
1692
1695
|
# CRLF→LF 归一化(autocrlf/git clone 的换行符差异)+ 剥 UTF-8 BOM
|
|
1693
|
-
# (raw 下载/记事本保存可能带 BOM)。字节形态不同但内容没变的文件
|
|
1694
|
-
# 放行,内容真被篡改仍然拦得住。
|
|
1695
|
-
# 注意分块方式:\r 必须暂存到下一块拼回来再 replace——否则恰好在
|
|
1696
|
-
# 64KB 边界被切成 \r|\n 的换行符会漏归一化,大文件哈希对不上。
|
|
1697
1696
|
h = hashlib.sha256()
|
|
1698
1697
|
first = True
|
|
1699
1698
|
tail = b""
|
package/scripts/make_dsh_tgz.py
CHANGED
|
@@ -33,9 +33,26 @@ EXCLUDE_NAMES = {"panel-token.txt", ".env", "LINGSHU_PANEL_TOKEN", "config.json"
|
|
|
33
33
|
|
|
34
34
|
def collect() -> list[Path]:
|
|
35
35
|
"""manifest 发布文件 + engine/ 全目录(都要先 sync 生成)。"""
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
manifest_p = ROOT / "manifest.json"
|
|
37
|
+
if not manifest_p.is_file():
|
|
38
|
+
raise SystemExit("[错误] 找不到 manifest.json,拒绝打包")
|
|
39
|
+
manifest = json.loads(manifest_p.read_text(encoding="utf-8"))
|
|
40
|
+
|
|
41
|
+
# LS-119(v5.62):DSH 打包遇到清单缺文件必须失败非零退出!
|
|
42
|
+
missing = []
|
|
43
|
+
files = []
|
|
44
|
+
for rel in manifest.get("files", {}):
|
|
45
|
+
p = ROOT / rel
|
|
46
|
+
if not p.is_file():
|
|
47
|
+
missing.append(rel)
|
|
48
|
+
else:
|
|
49
|
+
files.append(p)
|
|
50
|
+
if missing:
|
|
51
|
+
raise SystemExit(f"[错误] DSH 打包失败:manifest 中有 {len(missing)} 个文件在本地缺失!\n 缺失示例: {', '.join(missing[:5])}")
|
|
52
|
+
|
|
53
|
+
# LS-120(v5.62):将 manifest.json 本身加入 DSH tgz 的根目录,保证安装后能做完整哈希校验
|
|
54
|
+
files.append(manifest_p)
|
|
55
|
+
|
|
39
56
|
# engine/ 派生副本(打包时生成,不入库)
|
|
40
57
|
engine = ROOT / "scripts" / "astrbot_plugin_lingshu" / "engine"
|
|
41
58
|
if engine.is_dir():
|
package/scripts/make_manifest.py
CHANGED
|
@@ -54,19 +54,24 @@ def _excluded(rel: str, name: str) -> bool:
|
|
|
54
54
|
return name.startswith("test_") and name.endswith(".py")
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
# 二进制扩展名白名单(图片、图标、音频等):绝不执行换行符归一化
|
|
58
|
+
BINARY_EXTS = {".png", ".ico", ".jpg", ".jpeg", ".webp", ".gif", ".pdf", ".woff", ".woff2", ".ttf"}
|
|
59
59
|
|
|
60
|
-
manifest 是发布契约——它必须对应"发布内容的规范形态",而不是作者本机的
|
|
61
|
-
磁盘形态。作者机器 core.autocrlf=true + 记事本存盘会把工作区文件写成
|
|
62
|
-
CRLF+带 BOM,逐字节哈希记录的就是这套形态;用户按 raw / zip 拿到的是
|
|
63
|
-
LF+无 BOM,逐字节比对永远失败(v2.52 只修了比对侧,没修生成侧)。
|
|
64
|
-
换行符与 BOM 都不改变内容语义,归一化后哈希才与发布内容对齐;
|
|
65
|
-
真正的内容篡改仍拦得住。
|
|
66
60
|
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
def sha256_file(p: Path) -> tuple[str, int]:
|
|
62
|
+
"""计算文件的 SHA256 与大小。
|
|
63
|
+
LS-121(v5.62):仅对文本文件执行换行符归一化(CRLF→LF + 剥 BOM);
|
|
64
|
+
二进制文件(如 png, ico)按原始字节计算哈希与大小,绝不能当作文本替换字节破坏文件哈希!
|
|
69
65
|
"""
|
|
66
|
+
if p.suffix.lower() in BINARY_EXTS:
|
|
67
|
+
h = hashlib.sha256()
|
|
68
|
+
size = 0
|
|
69
|
+
with open(p, "rb") as f:
|
|
70
|
+
for chunk in iter(lambda: f.read(1 << 16), b""):
|
|
71
|
+
h.update(chunk)
|
|
72
|
+
size += len(chunk)
|
|
73
|
+
return h.hexdigest(), size
|
|
74
|
+
|
|
70
75
|
h = hashlib.sha256()
|
|
71
76
|
size = 0
|
|
72
77
|
first = True
|
|
@@ -25,8 +25,8 @@ sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
|
25
25
|
|
|
26
26
|
REPO = Path(__file__).resolve().parent.parent
|
|
27
27
|
SRC = REPO / "scripts" / "astrbot_plugin_lingshu"
|
|
28
|
-
EXCLUDE_DIRS = {"__pycache__"}
|
|
29
|
-
EXCLUDE_SUFFIX = {".pyc", ".pyo", ".log", ".zip"}
|
|
28
|
+
EXCLUDE_DIRS = {"__pycache__", "_scratch", "垃圾桶", "_ui_probe", "tests"}
|
|
29
|
+
EXCLUDE_SUFFIX = {".pyc", ".pyo", ".log", ".zip", ".tmp"}
|
|
30
30
|
EXCLUDE_NAMES = {"panel-token.txt", ".home", "consent.json",
|
|
31
31
|
"hippocampus.jsonl", "persona.json", "emotions.jsonl"}
|
|
32
32
|
|
|
@@ -36,7 +36,11 @@ def collect() -> list[Path]:
|
|
|
36
36
|
for p in sorted(SRC.rglob("*")):
|
|
37
37
|
if p.is_dir():
|
|
38
38
|
continue
|
|
39
|
-
|
|
39
|
+
rel_parts = p.relative_to(SRC).parts
|
|
40
|
+
if any(part in EXCLUDE_DIRS for part in rel_parts):
|
|
41
|
+
continue
|
|
42
|
+
# LS-118(v5.62):排除开发探针、临时脚本和冒烟代码
|
|
43
|
+
if p.name.startswith(("_tmp", "_ci_env_probe", "_panel_smoke")):
|
|
40
44
|
continue
|
|
41
45
|
if p.suffix.lower() in EXCLUDE_SUFFIX or p.name in EXCLUDE_NAMES:
|
|
42
46
|
continue
|
package/scripts/panel_build.py
CHANGED
|
@@ -82,11 +82,24 @@ def build(src: Path = SRC, out: Path | None = OUT) -> bytes:
|
|
|
82
82
|
"""拼装产物;out=None 时只返回字节、不落盘(--check 用,检查不该改文件)。"""
|
|
83
83
|
shell = (src / "index.html").read_bytes()
|
|
84
84
|
meta = json.loads((src / "blocks.json").read_text(encoding="utf-8"))
|
|
85
|
+
consumed = 0
|
|
85
86
|
for i, blk in enumerate(meta):
|
|
86
87
|
token = f"<!--@@BLOCK:{i}@@-->".encode()
|
|
88
|
+
if token not in shell:
|
|
89
|
+
raise ValueError(f"LS-123 缺失占位符:index.html 中未找到 {token.decode()} 无法嵌入块 {blk['file']}")
|
|
87
90
|
body = (src / blk["file"]).read_bytes()
|
|
88
91
|
close = b"</style>" if blk["kind"] == "style" else b"</script>"
|
|
89
92
|
shell = shell.replace(token, blk["open"].encode() + body + close, 1)
|
|
93
|
+
consumed += 1
|
|
94
|
+
|
|
95
|
+
# LS-123(v5.62):面板构建校验所有占位符和块均被消费!
|
|
96
|
+
# 检查产物中是否仍残留未被替换的 <!--@@BLOCK:*@@--> 占位符
|
|
97
|
+
leftover = re.findall(rb"<!--@@BLOCK:\d+@@-->", shell)
|
|
98
|
+
if leftover:
|
|
99
|
+
raise ValueError(f"LS-123 构建产物中残留未消费的占位符:{[x.decode() for x in leftover]}")
|
|
100
|
+
if consumed != len(meta):
|
|
101
|
+
raise ValueError(f"LS-123 ���消费不全:定义了 {len(meta)} 个块,实际消费 {consumed} 个")
|
|
102
|
+
|
|
90
103
|
if out is not None:
|
|
91
104
|
out.parent.mkdir(parents=True, exist_ok=True)
|
|
92
105
|
out.write_bytes(shell)
|
package/scripts/panel_server.py
CHANGED
|
@@ -1148,10 +1148,12 @@ class Handler(BaseHTTPRequestHandler):
|
|
|
1148
1148
|
"stage": st, "health": st.get("health")})
|
|
1149
1149
|
return
|
|
1150
1150
|
if path == "/api/doctor/summary":
|
|
1151
|
-
# OPS-02: 运行 doctor 并返回按级别分类的摘要(P0/P1 判据)
|
|
1151
|
+
# OPS-02 & LS-082 (v5.63): 运行 doctor 并返回按级别分类的摘要(P0/P1 判据)
|
|
1152
|
+
# 修复 NameError: name 'SCRIPTS' is not defined —— SCRIPTS 未在该函数或全局定义
|
|
1152
1153
|
try:
|
|
1153
1154
|
import subprocess, sys as _sys
|
|
1154
|
-
|
|
1155
|
+
scripts_dir = Path(__file__).resolve().parent
|
|
1156
|
+
proc = subprocess.run([_sys.executable, str(scripts_dir / "brain.py"), "doctor", "--json"],
|
|
1155
1157
|
capture_output=True, text=True, encoding="utf-8", timeout=30)
|
|
1156
1158
|
data = json.loads(proc.stdout) if proc.stdout else {}
|
|
1157
1159
|
except Exception as exc:
|
|
@@ -1199,10 +1201,10 @@ class Handler(BaseHTTPRequestHandler):
|
|
|
1199
1201
|
self._json({"items": panel_settings.all_items()})
|
|
1200
1202
|
return
|
|
1201
1203
|
if path == "/api/extensions/ollama/status":
|
|
1202
|
-
# Ollama
|
|
1203
|
-
#
|
|
1204
|
-
#
|
|
1205
|
-
|
|
1204
|
+
# Ollama 扩展状态:只读返回安装/服务/模型/配置 + 进度
|
|
1205
|
+
# LS-079 (v5.63): 消除 GET 请求的写副作用!
|
|
1206
|
+
# 旧代码在 GET 中调用 _ollama_auto_probe_async(),后台会自动下载模型并写 config.json,
|
|
1207
|
+
# 违反 HTTP GET 无副作用的规范。自动探测接管改由 POST /api/extensions/ollama/probe 显式触发。
|
|
1206
1208
|
self._json(ollama_status())
|
|
1207
1209
|
return
|
|
1208
1210
|
if path == "/api/panels/market":
|
|
@@ -1490,10 +1492,21 @@ def _api_persona_update(self, path, data):
|
|
|
1490
1492
|
|
|
1491
1493
|
|
|
1492
1494
|
def _api_data_backup(self, path, data):
|
|
1493
|
-
"""
|
|
1495
|
+
"""立即备份。保留 keep=0 的不修剪语义(LS-073)。"""
|
|
1494
1496
|
import panel_data
|
|
1497
|
+
# LS-073 (v5.63): 保留手动备份 keep=0 的不修剪语义!
|
|
1498
|
+
# 旧代码 _to_int(data.get("keep"), 20) or 20 会把显式的 0 当作假值再次兜底成 20,
|
|
1499
|
+
# 破坏了 panel_data.make_backup(keep=0) "不修剪" 的明确语义。
|
|
1500
|
+
raw_k = data.get("keep")
|
|
1501
|
+
if raw_k is not None:
|
|
1502
|
+
try:
|
|
1503
|
+
keep_val = int(raw_k)
|
|
1504
|
+
except (ValueError, TypeError):
|
|
1505
|
+
keep_val = 20
|
|
1506
|
+
else:
|
|
1507
|
+
keep_val = 20
|
|
1495
1508
|
try:
|
|
1496
|
-
r = panel_data.make_backup(keep=
|
|
1509
|
+
r = panel_data.make_backup(keep=keep_val)
|
|
1497
1510
|
except PermissionError as exc:
|
|
1498
1511
|
self._json({"error": str(exc)}, 403)
|
|
1499
1512
|
return
|
|
@@ -1845,6 +1858,10 @@ def _api_daily(self, path, data):
|
|
|
1845
1858
|
|
|
1846
1859
|
|
|
1847
1860
|
def _api_skill_self_review(self, path, data):
|
|
1861
|
+
# LS-078 (v5.63): 只读模式下禁止通过 self-review 写入历史!
|
|
1862
|
+
if brain.READONLY:
|
|
1863
|
+
self._json({"error": "数据目录当前只读,无法执行 self-review 写历史"}, 403)
|
|
1864
|
+
return
|
|
1848
1865
|
# P2-4:自审也记一笔(成长阶段要用"self-review 次数")
|
|
1849
1866
|
try:
|
|
1850
1867
|
growth.record_doctor_run(0, 0, 0, kind="self-review")
|
|
@@ -2165,9 +2182,12 @@ def _api_skill(self, path, data):
|
|
|
2165
2182
|
except KeyError as exc:
|
|
2166
2183
|
self._json({"error": f"{_src_pref} 下载源不可用:{exc}"}, 502)
|
|
2167
2184
|
return
|
|
2185
|
+
# LS-086 & LS-087 (v5.63): 统一风险确认字段(兼容 accept_risk、accepted_risk 与 yes)
|
|
2186
|
+
# 并统一技能安装结果包装字段:返回 {"ok": True, "result": res, "skill": res} 双键对齐前端契约
|
|
2187
|
+
risk_ok = bool(data.get("accept_risk") or data.get("accepted_risk") or data.get("yes"))
|
|
2168
2188
|
res = growth.install_skill(_name, force=bool(data.get("force")), from_dir=_from,
|
|
2169
|
-
accept_risk=
|
|
2170
|
-
self._json({"ok": True, "skill": res, "workspace": workspace()})
|
|
2189
|
+
accept_risk=risk_ok)
|
|
2190
|
+
self._json({"ok": True, "result": res, "skill": res, "workspace": workspace()})
|
|
2171
2191
|
elif act == "uninstall":
|
|
2172
2192
|
res = growth.uninstall_skill(data.get("name", ""), managed_only=True)
|
|
2173
2193
|
self._json({"ok": True, "skill": res, "workspace": workspace()})
|
package/scripts/panels.py
CHANGED
package/scripts/_ci_env_probe.py
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""CI 诊断探针:只在 sync_engine 失败时被调用,把环境事实打出来。
|
|
3
|
-
|
|
4
|
-
为什么单独成文件:内联在 workflow 的 heredoc 会破坏 YAML 缩进(实测解析失败),
|
|
5
|
-
而这一段逻辑值得留档——它回答的是"为什么在 Windows runner 上失败、Linux 上不".
|
|
6
|
-
"""
|
|
7
|
-
import locale
|
|
8
|
-
import pathlib
|
|
9
|
-
import sys
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def main() -> int:
|
|
13
|
-
root = pathlib.Path(".").resolve()
|
|
14
|
-
print(f" cwd={root}")
|
|
15
|
-
print(f" python={sys.version.split()[0]}")
|
|
16
|
-
print(f" fsencoding={sys.getfilesystemencoding()}")
|
|
17
|
-
print(f" preferred={locale.getpreferredencoding(False)}")
|
|
18
|
-
|
|
19
|
-
print(" --- 关键路径 ---")
|
|
20
|
-
for rel in ("scripts",
|
|
21
|
-
"scripts/astrbot_plugin_lingshu",
|
|
22
|
-
"scripts/astrbot_plugin_lingshu/engine",
|
|
23
|
-
"docs/panel-api.md", "docs/commands.md",
|
|
24
|
-
"docs/mechanics.md", "docs/models.md", "docs/recovery.md",
|
|
25
|
-
"assets/panel.html"):
|
|
26
|
-
p = root / rel
|
|
27
|
-
kind = "-" if not p.exists() else ("dir" if p.is_dir() else f"{p.stat().st_size}B")
|
|
28
|
-
print(f" {rel}: {kind}")
|
|
29
|
-
|
|
30
|
-
# 换行抽样:CI 若在 Windows 上 checkout 成 CRLF,这里能直接看出来
|
|
31
|
-
print(" --- 换行抽样(前 5 个 .md/.py)---")
|
|
32
|
-
shown = 0
|
|
33
|
-
for p in sorted(root.rglob("*")):
|
|
34
|
-
if shown >= 5:
|
|
35
|
-
break
|
|
36
|
-
if p.is_file() and p.suffix.lower() in (".md", ".py") and "node_modules" not in str(p):
|
|
37
|
-
b = p.read_bytes()[:400]
|
|
38
|
-
crlf = b.count(b"\r\n")
|
|
39
|
-
lf = b.count(b"\n") - crlf
|
|
40
|
-
print(f" {p.relative_to(root)}: CRLF={crlf} LF={lf}")
|
|
41
|
-
shown += 1
|
|
42
|
-
|
|
43
|
-
# engine 里是否残留已从根目录删掉的文档
|
|
44
|
-
eng = root / "scripts" / "astrbot_plugin_lingshu" / "engine"
|
|
45
|
-
if eng.is_dir():
|
|
46
|
-
stale = [p.name for p in eng.rglob("*.md")
|
|
47
|
-
if not (root / p.relative_to(eng)).exists()]
|
|
48
|
-
print(f" --- engine 里根目录已无对应项的 .md: {stale[:8] or '无'}")
|
|
49
|
-
return 0
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
def _ensure_utf8_stdout() -> None:
|
|
53
|
-
"""把 stdout/stderr 切到 UTF-8,避免 Windows 控制台(cp1252/cp936)编不了中文就崩。
|
|
54
|
-
|
|
55
|
-
CI 的 windows-latest stdout 是 cp1252:脚本一 print 中文就 UnicodeEncodeError
|
|
56
|
-
直接退出(实测 sync_engine.py / make_checksums.py 都因此挂过,Ubuntu 同期正常)。
|
|
57
|
-
这不是业务 bug,是"中文输出 + 非 UTF-8 控制台"的必然结果。
|
|
58
|
-
"""
|
|
59
|
-
for name in ("stdout", "stderr"):
|
|
60
|
-
stream = getattr(sys, name, None)
|
|
61
|
-
fn = getattr(stream, "reconfigure", None)
|
|
62
|
-
if callable(fn):
|
|
63
|
-
try:
|
|
64
|
-
fn(encoding="utf-8", errors="replace")
|
|
65
|
-
continue
|
|
66
|
-
except (OSError, ValueError, AttributeError):
|
|
67
|
-
pass
|
|
68
|
-
try:
|
|
69
|
-
import io
|
|
70
|
-
buf = getattr(stream, "buffer", None)
|
|
71
|
-
if buf is not None:
|
|
72
|
-
setattr(sys, name,
|
|
73
|
-
io.TextIOWrapper(buf, encoding="utf-8", errors="replace",
|
|
74
|
-
line_buffering=True))
|
|
75
|
-
except Exception: # noqa: BLE001
|
|
76
|
-
pass
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if __name__ == "__main__":
|
|
80
|
-
_ensure_utf8_stdout()
|
|
81
|
-
sys.exit(main())
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""验证脚本:后台起 panel_server(临时 HOME),查 /api/extensions/ollama/status,然后关掉。"""
|
|
3
|
-
import os, subprocess, sys, tempfile, time, urllib.request
|
|
4
|
-
|
|
5
|
-
tmp = os.path.join(tempfile.gettempdir(), "lingshu-panel-smoke")
|
|
6
|
-
os.makedirs(tmp, exist_ok=True)
|
|
7
|
-
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
8
|
-
flags = getattr(subprocess, "CREATE_NO_WINDOW", 0)
|
|
9
|
-
proc = subprocess.Popen([sys.executable, os.path.join(root, "scripts", "panel_server.py"),
|
|
10
|
-
"--port", "8791", "--no-browser", "--home", tmp],
|
|
11
|
-
cwd=root, creationflags=flags,
|
|
12
|
-
stdout=subprocess.DEVNULL, stderr=subprocess.PIPE)
|
|
13
|
-
time.sleep(6)
|
|
14
|
-
try:
|
|
15
|
-
with urllib.request.urlopen("http://127.0.0.1:8791/api/extensions/ollama/status", timeout=10) as r:
|
|
16
|
-
print("STATUS:", r.read().decode("utf-8"))
|
|
17
|
-
except Exception as exc:
|
|
18
|
-
print("ERR:", exc)
|
|
19
|
-
finally:
|
|
20
|
-
proc.terminate()
|
|
21
|
-
try:
|
|
22
|
-
_, err = proc.communicate(timeout=10)
|
|
23
|
-
if err:
|
|
24
|
-
print("STDERR:", err.decode("utf-8", "replace")[-800:])
|
|
25
|
-
except Exception:
|
|
26
|
-
proc.kill()
|
|
27
|
-
print("PANEL SMOKE DONE")
|