lingshu-skill 0.0.0-stage → 3.82.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 +2605 -0
- package/LICENSE +21 -0
- package/README.md +698 -3
- package/SKILL-lite.md +45 -0
- package/SKILL-tiny.md +37 -0
- package/SKILL.md +379 -0
- package/assets/panel.html +5616 -0
- package/cordis-plugin/lingshu-cron/cordis.patch.yml +3 -0
- package/cordis-plugin/lingshu-cron/index.js +4 -0
- package/cordis-plugin/lingshu-cron/package.json +34 -0
- package/cordis-plugin/lingshu-cron/plugin.js +1040 -0
- package/cordis-plugin/lingshu-guard/plugin.js +473 -0
- package/cordis-plugin/lingshu-im/plugin.js +635 -0
- package/cordis-plugin/lingshu-startup/README.md +123 -0
- package/cordis-plugin/lingshu-startup/cordis.patch.yml +3 -0
- package/cordis-plugin/lingshu-startup/index.js +4 -0
- package/cordis-plugin/lingshu-startup/package.json +25 -0
- package/cordis-plugin/lingshu-startup/plugin.js +352 -0
- package/cordis.patch.yml +3 -0
- package/docs/commands.md +243 -0
- package/docs/mechanics.md +610 -0
- package/docs/models.md +52 -0
- package/docs/npm-/345/217/221/345/270/203/350/257/264/346/230/216.md +49 -0
- package/docs/panel-api.md +198 -0
- package/docs/recovery.md +90 -0
- package/docs/tgz-/345/256/211/350/243/205/350/257/264/346/230/216.md +53 -0
- package/docs//350/277/233/345/261/225/344/270/216/345/276/205/345/212/236.md +804 -0
- package/index.js +102 -0
- package/package.json +52 -6
- package/scripts/_panel_smoke_v299.py +27 -0
- package/scripts/_smoke_v299.py +31 -0
- package/scripts/_sync_trae_cn.py +34 -0
- package/scripts/assembler.py +197 -0
- package/scripts/astrbot_plugin_lingshu/CHECKSUMS.json +53 -0
- package/scripts/astrbot_plugin_lingshu/PATCH_NOTES.md +28 -0
- package/scripts/astrbot_plugin_lingshu/README.md +58 -0
- package/scripts/astrbot_plugin_lingshu/_conf_schema.json +92 -0
- package/scripts/astrbot_plugin_lingshu/engine/CHANGELOG.md +2605 -0
- package/scripts/astrbot_plugin_lingshu/engine/README.md +698 -0
- package/scripts/astrbot_plugin_lingshu/engine/SKILL-lite.md +45 -0
- package/scripts/astrbot_plugin_lingshu/engine/SKILL-tiny.md +37 -0
- package/scripts/astrbot_plugin_lingshu/engine/SKILL.md +379 -0
- package/scripts/astrbot_plugin_lingshu/engine/assets/panel.html +5616 -0
- package/scripts/astrbot_plugin_lingshu/engine/docs/commands.md +243 -0
- package/scripts/astrbot_plugin_lingshu/engine/docs/mechanics.md +610 -0
- package/scripts/astrbot_plugin_lingshu/engine/docs/models.md +52 -0
- package/scripts/astrbot_plugin_lingshu/engine/docs/panel-api.md +198 -0
- package/scripts/astrbot_plugin_lingshu/engine/docs/recovery.md +90 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_panel_smoke_v299.py +27 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_smoke_v299.py +31 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_sync_trae_cn.py +34 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/assembler.py +197 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/behavior_baseline.py +280 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/bench.py +192 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/brain.py +46 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/check_pressure_sync.py +55 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/check_tag.py +215 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/checkpoint.py +165 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/cli.py +4867 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/context_ab.py +260 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/core.py +2028 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/dream.py +1137 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/emotion.py +1180 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/failures.py +107 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/fallback_embed.py +114 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/growth.py +4745 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/growth_parts.py +263 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/insights.py +131 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/make_dsh_tgz.py +92 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/mem_dialogue.py +242 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/mem_embed.py +159 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/mem_lesson.py +160 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/mem_score.py +210 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/mem_topic.py +177 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/memory.py +4417 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/npm_prepack.py +31 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_build.py +115 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_cloud.py +609 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_server.py +2703 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/panels.py +591 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/persona.py +2309 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/retriever.py +195 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/safety.py +368 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/session_import.py +736 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/session_rag.py +228 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/session_summary.py +123 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/summarizer.py +252 -0
- package/scripts/astrbot_plugin_lingshu/main.py +703 -0
- package/scripts/astrbot_plugin_lingshu/make_checksums.py +87 -0
- package/scripts/astrbot_plugin_lingshu/metadata.yaml +7 -0
- package/scripts/behavior_baseline.py +280 -0
- package/scripts/bench.py +192 -0
- package/scripts/brain.py +46 -0
- package/scripts/check_pressure_sync.py +55 -0
- package/scripts/check_tag.py +215 -0
- package/scripts/check_version.py +265 -0
- package/scripts/checkpoint.py +165 -0
- package/scripts/cli.py +4867 -0
- package/scripts/context_ab.py +260 -0
- package/scripts/core.py +2028 -0
- package/scripts/dream.py +1137 -0
- package/scripts/emotion.py +1180 -0
- package/scripts/failures.py +107 -0
- package/scripts/fallback_embed.py +114 -0
- package/scripts/growth.py +4745 -0
- package/scripts/growth_parts.py +263 -0
- package/scripts/hooks/pre-commit +18 -0
- package/scripts/hooks/pre-push +20 -0
- package/scripts/insights.py +131 -0
- package/scripts/make_dsh_tgz.py +92 -0
- package/scripts/make_manifest.py +254 -0
- package/scripts/make_plugin_zip.py +88 -0
- package/scripts/mem_dialogue.py +242 -0
- package/scripts/mem_embed.py +159 -0
- package/scripts/mem_lesson.py +160 -0
- package/scripts/mem_score.py +210 -0
- package/scripts/mem_topic.py +177 -0
- package/scripts/memory.py +4417 -0
- package/scripts/npm_prepack.py +31 -0
- package/scripts/panel_build.py +115 -0
- package/scripts/panel_cloud.py +609 -0
- package/scripts/panel_server.py +2703 -0
- package/scripts/panels.py +591 -0
- package/scripts/persona.py +2309 -0
- package/scripts/recreate_push.ps1 +117 -0
- package/scripts/retriever.py +195 -0
- package/scripts/run_tests.py +91 -0
- package/scripts/safety.py +368 -0
- package/scripts/session_import.py +736 -0
- package/scripts/session_rag.py +228 -0
- package/scripts/session_summary.py +123 -0
- package/scripts/summarizer.py +252 -0
- package/scripts/sync_engine.py +139 -0
- package/scripts/update_dsh_copy.ps1 +107 -0
- package/start-panel.bat +60 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""engine 副本同步:根 scripts/*.py ↔ scripts/astrbot_plugin_lingshu/engine/scripts/*.py。
|
|
4
|
+
|
|
5
|
+
AstrBot 桥接插件内置一份核心引擎副本(engine/scripts/)。两边内容必须一致,
|
|
6
|
+
否则用户装插件得到旧核心。历史教训:CRLF 差异会让"裸 sha256 比较"全部误报,
|
|
7
|
+
因此本脚本按「换行归一化(CRLF→LF)后逐字比较」为准。
|
|
8
|
+
|
|
9
|
+
**文档副本也归这里管**(v3.47):插件里还随包发 SKILL.md / README / CHANGELOG /
|
|
10
|
+
docs,以前从没人同步,实测插件里躺着一份 v2.87 的 SKILL.md(主仓库已 v3.47,差
|
|
11
|
+
60 个版本)——AstrBot 用户看到的说明书是半年前的。现在它们与 .py 一起校验。
|
|
12
|
+
|
|
13
|
+
用法:
|
|
14
|
+
python scripts/sync_engine.py # 把根目录的 .py 与文档同步到 engine 副本
|
|
15
|
+
python scripts/sync_engine.py --check # 只校验一致性,不一致退出码 1(CI/pre-commit 用)
|
|
16
|
+
"""
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import argparse
|
|
20
|
+
import shutil
|
|
21
|
+
import sys
|
|
22
|
+
from pathlib import Path
|
|
23
|
+
|
|
24
|
+
ROOT = Path(__file__).resolve().parent.parent
|
|
25
|
+
SRC = ROOT / "scripts"
|
|
26
|
+
DST = ROOT / "scripts" / "astrbot_plugin_lingshu" / "engine" / "scripts"
|
|
27
|
+
ENGINE = ROOT / "scripts" / "astrbot_plugin_lingshu" / "engine"
|
|
28
|
+
|
|
29
|
+
# 不参与同步的辅助脚本(桥接侧用不到 / 依赖仓库根的其他文件)
|
|
30
|
+
# 注意:panel_server.py **不在此列**(v3.47 B 方案)。插件 README 的「打开面板 → 拓展商店
|
|
31
|
+
# 一键导出」流程要求 `engine/scripts/panel_server.py` 真的存在;它只依赖标准库 + 同目录
|
|
32
|
+
# 的 brain/panels/growth,`ASSETS` 按 `__file__` 的父父目录解析,正好指向 engine/assets。
|
|
33
|
+
# 以前把它跳过,插件里就只剩一份跑不起来的面板产物。
|
|
34
|
+
# run_tests.py 是开发期跑测入口(v3.54),桥接侧不需要,不进副本。
|
|
35
|
+
SKIP = {"sync_engine.py", "make_manifest.py", "make_checksums.py",
|
|
36
|
+
"check_version.py", "make_plugin_zip.py", "run_tests.py"}
|
|
37
|
+
|
|
38
|
+
# 随插件发布的文件副本(路径相对仓库根,保持同名同目录)。
|
|
39
|
+
# assets/panel.html 是 panel_src 的构建产物:`panel_build.py --check` 保证源码↔产物一致,
|
|
40
|
+
# 这里再保证「主仓库产物 ↔ 插件副本一致」——两道闸合起来,插件里的面板不会再停在旧代。
|
|
41
|
+
DOC_FILES = [
|
|
42
|
+
"SKILL.md", "SKILL-lite.md", "SKILL-tiny.md", "README.md", "CHANGELOG.md",
|
|
43
|
+
"docs/panel-api.md", "docs/commands.md", "docs/mechanics.md", "docs/models.md",
|
|
44
|
+
"docs/recovery.md", "assets/panel.html",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _norm(text: str) -> str:
|
|
49
|
+
return text.replace("\r\n", "\n").replace("\r", "\n")
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def _read(p: Path) -> str:
|
|
53
|
+
return p.read_text(encoding="utf-8-sig")
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def sources() -> list[Path]:
|
|
57
|
+
return sorted(p for p in SRC.glob("*.py") if p.name not in SKIP and not p.name.startswith("test_"))
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def sync() -> int:
|
|
61
|
+
DST.mkdir(parents=True, exist_ok=True)
|
|
62
|
+
changed = 0
|
|
63
|
+
for src in sources():
|
|
64
|
+
dst = DST / src.name
|
|
65
|
+
if dst.exists() and _norm(_read(dst)) == _norm(_read(src)):
|
|
66
|
+
continue
|
|
67
|
+
shutil.copy2(src, dst)
|
|
68
|
+
changed += 1
|
|
69
|
+
# 反向清理:副本里有、根目录已删掉的脚本一并移除,避免僵尸核心
|
|
70
|
+
removed = 0
|
|
71
|
+
keep = {p.name for p in sources()}
|
|
72
|
+
for dst in sorted(DST.glob("*.py")):
|
|
73
|
+
if dst.name not in keep:
|
|
74
|
+
dst.unlink()
|
|
75
|
+
removed += 1
|
|
76
|
+
# 文档副本:主仓库有就同步过去,主仓库删了就同步删掉(不给插件留过期页面)
|
|
77
|
+
doc_changed = doc_removed = 0
|
|
78
|
+
for rel in DOC_FILES:
|
|
79
|
+
src, dst = ROOT / rel, ENGINE / rel
|
|
80
|
+
if not src.is_file():
|
|
81
|
+
if dst.exists():
|
|
82
|
+
dst.unlink()
|
|
83
|
+
doc_removed += 1
|
|
84
|
+
continue
|
|
85
|
+
if dst.exists() and _norm(_read(dst)) == _norm(_read(src)):
|
|
86
|
+
continue
|
|
87
|
+
dst.parent.mkdir(parents=True, exist_ok=True)
|
|
88
|
+
shutil.copy2(src, dst)
|
|
89
|
+
doc_changed += 1
|
|
90
|
+
print(f"[sync] engine 副本已同步:脚本 更新 {changed} 个 / 清理 {removed} 个;"
|
|
91
|
+
f"文档 更新 {doc_changed} 个 / 清理 {doc_removed} 个")
|
|
92
|
+
return 0
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def check() -> int:
|
|
96
|
+
bad = []
|
|
97
|
+
names = {p.name for p in sources()}
|
|
98
|
+
for src in sources():
|
|
99
|
+
dst = DST / src.name
|
|
100
|
+
if not dst.exists():
|
|
101
|
+
bad.append(f"{src.name}: 副本缺失")
|
|
102
|
+
continue
|
|
103
|
+
if _norm(_read(dst)) != _norm(_read(src)):
|
|
104
|
+
bad.append(f"{src.name}: 内容不一致(换行归一化后)")
|
|
105
|
+
for dst in sorted(DST.glob("*.py")):
|
|
106
|
+
if dst.name not in names:
|
|
107
|
+
bad.append(f"{dst.name}: 副本多出僵尸文件(根目录已删除)")
|
|
108
|
+
doc_checked = 0
|
|
109
|
+
for rel in DOC_FILES:
|
|
110
|
+
src, dst = ROOT / rel, ENGINE / rel
|
|
111
|
+
if not src.is_file():
|
|
112
|
+
if dst.exists():
|
|
113
|
+
bad.append(f"{rel}: 主仓库已删除,但副本还在")
|
|
114
|
+
continue
|
|
115
|
+
doc_checked += 1
|
|
116
|
+
if not dst.exists():
|
|
117
|
+
bad.append(f"{rel}: 文档副本缺失")
|
|
118
|
+
elif _norm(_read(dst)) != _norm(_read(src)):
|
|
119
|
+
bad.append(f"{rel}: 文档副本过期(内容与主仓库不一致)")
|
|
120
|
+
if bad:
|
|
121
|
+
print("[sync] engine 副本与根 scripts / 文档不一致:", file=sys.stderr)
|
|
122
|
+
for b in bad:
|
|
123
|
+
print(f" - {b}", file=sys.stderr)
|
|
124
|
+
print("运行 python scripts/sync_engine.py 修复。", file=sys.stderr)
|
|
125
|
+
return 1
|
|
126
|
+
print(f"[sync] OK:engine 副本 {len(names)} 个脚本 + {doc_checked} 个文档"
|
|
127
|
+
f"与根目录一致(换行归一化后)")
|
|
128
|
+
return 0
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def main(argv: list[str] | None = None) -> int:
|
|
132
|
+
ap = argparse.ArgumentParser(description="灵枢:engine 副本同步与校验")
|
|
133
|
+
ap.add_argument("--check", action="store_true", help="只校验一致性,不写文件")
|
|
134
|
+
args = ap.parse_args(argv)
|
|
135
|
+
return check() if args.check else sync()
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
if __name__ == "__main__":
|
|
139
|
+
sys.exit(main())
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# 灵枢 → DSH 插件目录热同步(按发布清单精确复制,不重启 DSH)
|
|
2
|
+
#
|
|
3
|
+
# 用法(从哪个目录跑都行,脚本自己定位仓库根):
|
|
4
|
+
# powershell -ExecutionPolicy Bypass -File "<仓库>\scripts\update_dsh_copy.ps1"
|
|
5
|
+
# powershell -ExecutionPolicy Bypass -File "<仓库>\scripts\update_dsh_copy.ps1" -Profile desktop
|
|
6
|
+
#
|
|
7
|
+
# 为什么不再用 robocopy /E 整目录复制:那会把仓库旁边的本地杂物一起塞进插件目录
|
|
8
|
+
# (实测 .tmp_refs 129 MB、_ui_probe 12 MB、panel_src/tests 若干),而 DSH 只需要
|
|
9
|
+
# 发布清单 manifest.json 里的交付物。现在只拷清单里列出的文件(当前 65 个)。
|
|
10
|
+
#
|
|
11
|
+
# P1-1:engine/ 是 scripts/+docs/ 的派生副本,已从 git 移除(见 .gitignore)。
|
|
12
|
+
# 它不在发布清单里,本脚本也不复制它——目标副本的 engine 由市场包安装时带进来。
|
|
13
|
+
# 若从全新 clone 跑本脚本,磁盘可能还没有 engine;此时先手动跑一次
|
|
14
|
+
# `python scripts\sync_engine.py` 生成(幂等),否则同步后 doctor 的 engine-sync
|
|
15
|
+
# 会因源端缺 engine 而红。生成 engine 属于发版/打包职责,不塞进本脚本以免引入
|
|
16
|
+
# "找不到 python 解释器"的新失败点。
|
|
17
|
+
# 退出码:0 成功;1 有文件没拷成(多半是 DSH 正占用,完全退出 DSH 后重跑)。
|
|
18
|
+
|
|
19
|
+
param(
|
|
20
|
+
[string]$Profile = ""
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
$ErrorActionPreference = "Stop"
|
|
24
|
+
|
|
25
|
+
$src = Split-Path -Parent $PSScriptRoot # 仓库根目录(本脚本在 scripts/ 下)
|
|
26
|
+
$profilesRoot = Join-Path $env:USERPROFILE ".dsh\profiles"
|
|
27
|
+
|
|
28
|
+
function Get-CopyVersion($dir) {
|
|
29
|
+
try {
|
|
30
|
+
$pkg = Get-Content -LiteralPath (Join-Path $dir "package.json") -Raw -Encoding UTF8 | ConvertFrom-Json
|
|
31
|
+
return [string]$pkg.version
|
|
32
|
+
} catch {
|
|
33
|
+
return "?"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
# 1) 找目标副本:指定 profile,否则自动挑所有已装 lingshu-skill 的 profile
|
|
38
|
+
$targets = @()
|
|
39
|
+
if ($Profile) {
|
|
40
|
+
$one = Join-Path $profilesRoot "$Profile\node_modules\lingshu-skill"
|
|
41
|
+
if (-not (Test-Path $one)) {
|
|
42
|
+
Write-Host "[错误] profile「$Profile」下没有 lingshu-skill:$one" -ForegroundColor Red
|
|
43
|
+
exit 1
|
|
44
|
+
}
|
|
45
|
+
$targets = @($one)
|
|
46
|
+
} elseif (Test-Path $profilesRoot) {
|
|
47
|
+
foreach ($p in Get-ChildItem -LiteralPath $profilesRoot -Directory) {
|
|
48
|
+
$d = Join-Path $p.FullName "node_modules\lingshu-skill"
|
|
49
|
+
if (Test-Path $d) { $targets += $d }
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (-not $targets) {
|
|
53
|
+
Write-Host "[错误] 找不到任何 DSH profile 里的 lingshu-skill 副本。" -ForegroundColor Red
|
|
54
|
+
Write-Host " 先让 DSH 装一次 lingshu-skill,或用 -Profile <名字> 指定 profile。" -ForegroundColor Red
|
|
55
|
+
exit 1
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
# 2) 读发布清单
|
|
59
|
+
$mfPath = Join-Path $src "manifest.json"
|
|
60
|
+
if (-not (Test-Path $mfPath)) {
|
|
61
|
+
Write-Host "[错误] 缺少 manifest.json(发布清单):$mfPath" -ForegroundColor Red
|
|
62
|
+
Write-Host " 先在仓库根运行:python scripts\make_manifest.py" -ForegroundColor Red
|
|
63
|
+
exit 1
|
|
64
|
+
}
|
|
65
|
+
$manifest = Get-Content -LiteralPath $mfPath -Raw -Encoding UTF8 | ConvertFrom-Json
|
|
66
|
+
$files = @($manifest.files.PSObject.Properties | ForEach-Object { $_.Name })
|
|
67
|
+
if ($files.Count -eq 0) {
|
|
68
|
+
Write-Host "[错误] manifest.json 里没有任何文件条目。" -ForegroundColor Red
|
|
69
|
+
exit 1
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
# 3) 逐文件复制(不删除目标里多出来的旧文件,避免误删用户自装的东西)
|
|
73
|
+
$hadFailure = $false
|
|
74
|
+
foreach ($dst in $targets) {
|
|
75
|
+
$before = Get-CopyVersion $dst
|
|
76
|
+
$copied = 0
|
|
77
|
+
$failed = @()
|
|
78
|
+
foreach ($rel in $files) {
|
|
79
|
+
$relWin = $rel -replace '/', '\'
|
|
80
|
+
$s = Join-Path $src $relWin
|
|
81
|
+
$d = Join-Path $dst $relWin
|
|
82
|
+
try {
|
|
83
|
+
if (-not (Test-Path -LiteralPath $s)) { throw "源文件缺失" }
|
|
84
|
+
$dDir = Split-Path -Parent $d
|
|
85
|
+
if (-not (Test-Path -LiteralPath $dDir)) {
|
|
86
|
+
New-Item -ItemType Directory -Force -Path $dDir | Out-Null
|
|
87
|
+
}
|
|
88
|
+
Copy-Item -LiteralPath $s -Destination $d -Force
|
|
89
|
+
$copied++
|
|
90
|
+
} catch {
|
|
91
|
+
$failed += ("{0} —— {1}" -f $rel, $_.Exception.Message)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
$after = Get-CopyVersion $dst
|
|
95
|
+
Write-Host ("[同步] {0}" -f $dst)
|
|
96
|
+
Write-Host (" 版本 {0} -> {1},复制 {2}/{3} 个文件" -f $before, $after, $copied, $files.Count) -ForegroundColor Green
|
|
97
|
+
if ($failed.Count -gt 0) {
|
|
98
|
+
$hadFailure = $true
|
|
99
|
+
Write-Host (" 失败 {0} 个(多半是 DSH 正在占用文件,完全退出 DSH 后重跑):" -f $failed.Count) -ForegroundColor Yellow
|
|
100
|
+
$failed | Select-Object -First 5 | ForEach-Object { Write-Host (" - {0}" -f $_) -ForegroundColor Yellow }
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if ($hadFailure) { exit 1 }
|
|
105
|
+
|
|
106
|
+
Write-Host "[完成] 把 lingshu-skill 插件关一次再开一次(或重启 DSH),新版本才会被加载。" -ForegroundColor Green
|
|
107
|
+
Write-Host " 自检:python scripts\brain.py doctor (看 release-drift 那一项)"
|
package/start-panel.bat
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
@echo off
|
|
2
|
+
setlocal
|
|
3
|
+
cd /d "%~dp0"
|
|
4
|
+
|
|
5
|
+
set "PORT=%~1"
|
|
6
|
+
if "%PORT%"=="" set "PORT=8765"
|
|
7
|
+
|
|
8
|
+
set "PY="
|
|
9
|
+
rem Probe policy: `where` only proves existence, not usability -- the
|
|
10
|
+
rem WindowsApps python stub also matches `where` but is a fake command that
|
|
11
|
+
rem just opens the Store. So run every candidate once; only a candidate that
|
|
12
|
+
rem prints its version counts. Use the first one that works.
|
|
13
|
+
call :probe python
|
|
14
|
+
if not defined PY call :probe py -3
|
|
15
|
+
if not defined PY call :probe python3
|
|
16
|
+
goto :after-probe
|
|
17
|
+
|
|
18
|
+
:probe
|
|
19
|
+
%1 --version >nul 2>nul && set "PY=%*"
|
|
20
|
+
exit /b 0
|
|
21
|
+
|
|
22
|
+
:after-probe
|
|
23
|
+
|
|
24
|
+
if "%PY%"=="" (
|
|
25
|
+
echo.
|
|
26
|
+
echo [error] Python not found.
|
|
27
|
+
echo Install Python 3.10+ and check "Add Python to PATH" during setup.
|
|
28
|
+
echo Download: https://www.python.org/downloads/
|
|
29
|
+
echo.
|
|
30
|
+
pause
|
|
31
|
+
exit /b 1
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
if not exist "scripts\panel_server.py" (
|
|
35
|
+
echo.
|
|
36
|
+
echo [error] scripts\panel_server.py not found.
|
|
37
|
+
echo Make sure start-panel.bat and the scripts folder are in the same skill directory.
|
|
38
|
+
echo.
|
|
39
|
+
pause
|
|
40
|
+
exit /b 1
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
echo.
|
|
44
|
+
echo Lingshu memory panel is starting...
|
|
45
|
+
echo URL: http://127.0.0.1:%PORT%
|
|
46
|
+
echo Close this window to stop the service.
|
|
47
|
+
echo.
|
|
48
|
+
|
|
49
|
+
%PY% "scripts\panel_server.py" --port %PORT%
|
|
50
|
+
if errorlevel 1 (
|
|
51
|
+
echo.
|
|
52
|
+
echo [hint] Failed to start. Common causes:
|
|
53
|
+
echo 1. Port %PORT% is in use -- use another port: start-panel.bat 8766
|
|
54
|
+
echo 2. Firewall is blocking -- the panel only listens on 127.0.0.1
|
|
55
|
+
echo 3. Python is too old -- 3.10 or newer is required
|
|
56
|
+
echo.
|
|
57
|
+
pause
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
endlocal
|