lingshu-skill 5.69.0 → 5.71.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/SKILL-lite.md +1 -1
  3. package/SKILL-tiny.md +1 -1
  4. package/SKILL.md +1 -1
  5. package/cordis-plugin/lingshu-cron/plugin.js +36 -14
  6. package/cordis-plugin/lingshu-im/plugin.js +67 -15
  7. package/manifest.json +43 -43
  8. package/package.json +1 -1
  9. package/scripts/assembler.py +8 -2
  10. package/scripts/astrbot_plugin_lingshu/CHECKSUMS.json +90 -18
  11. package/scripts/astrbot_plugin_lingshu/engine/CHANGELOG.md +66 -0
  12. package/scripts/astrbot_plugin_lingshu/engine/SKILL-lite.md +1 -1
  13. package/scripts/astrbot_plugin_lingshu/engine/SKILL-tiny.md +1 -1
  14. package/scripts/astrbot_plugin_lingshu/engine/SKILL.md +1 -1
  15. package/scripts/astrbot_plugin_lingshu/engine/scripts/assembler.py +8 -2
  16. package/scripts/astrbot_plugin_lingshu/engine/scripts/checkpoint.py +13 -2
  17. package/scripts/astrbot_plugin_lingshu/engine/scripts/desktop_shortcut.py +10 -1
  18. package/scripts/astrbot_plugin_lingshu/engine/scripts/dream.py +45 -0
  19. package/scripts/astrbot_plugin_lingshu/engine/scripts/emotion.py +13 -2
  20. package/scripts/astrbot_plugin_lingshu/engine/scripts/growth.py +5629 -5575
  21. package/scripts/astrbot_plugin_lingshu/engine/scripts/growth_parts.py +5 -1
  22. package/scripts/astrbot_plugin_lingshu/engine/scripts/memory.py +62 -6
  23. package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_cloud.py +47 -1
  24. package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_server.py +12 -2
  25. package/scripts/astrbot_plugin_lingshu/engine/scripts/persona.py +10 -4
  26. package/scripts/astrbot_plugin_lingshu/engine/scripts/safety.py +6 -1
  27. package/scripts/astrbot_plugin_lingshu/engine/scripts/session_import.py +6 -2
  28. package/scripts/astrbot_plugin_lingshu/engine/scripts/session_rag.py +68 -21
  29. package/scripts/astrbot_plugin_lingshu/make_checksums.py +8 -4
  30. package/scripts/checkpoint.py +13 -2
  31. package/scripts/desktop_shortcut.py +10 -1
  32. package/scripts/dream.py +45 -0
  33. package/scripts/emotion.py +13 -2
  34. package/scripts/growth.py +5629 -5575
  35. package/scripts/growth_parts.py +5 -1
  36. package/scripts/memory.py +62 -6
  37. package/scripts/panel_cloud.py +47 -1
  38. package/scripts/panel_server.py +12 -2
  39. package/scripts/persona.py +10 -4
  40. package/scripts/run_tests.py +240 -171
  41. package/scripts/safety.py +6 -1
  42. package/scripts/session_import.py +6 -2
  43. package/scripts/session_rag.py +68 -21
  44. package/scripts/update_dsh_copy.ps1 +42 -6
@@ -26,11 +26,19 @@ $src = Split-Path -Parent $PSScriptRoot # 仓库根目录(本脚本
26
26
  $profilesRoot = Join-Path $env:USERPROFILE ".dsh\profiles"
27
27
 
28
28
  function Get-CopyVersion($dir) {
29
+ # LS-139(v5.70):坏 package.json 必须失败而非返回 "?"!
30
+ # 旧实现 catch 一切返回 "?"——解析错误被当成"没版本",脚本继续跑、最终报成功,
31
+ # 但副本里的 package.json 已经损坏,DSH 加载必崩。
29
32
  try {
30
33
  $pkg = Get-Content -LiteralPath (Join-Path $dir "package.json") -Raw -Encoding UTF8 | ConvertFrom-Json
31
- return [string]$pkg.version
34
+ $v = [string]$pkg.version
35
+ if (-not $v) { throw "package.json 无 version 字段" }
36
+ return $v
32
37
  } catch {
33
- return "?"
38
+ if (-not (Test-Path -LiteralPath (Join-Path $dir "package.json"))) {
39
+ return ""
40
+ }
41
+ throw "目标副本 package.json 解析失败(副本已损坏,拒绝在其上继续操作):$($_.Exception.Message)"
34
42
  }
35
43
  }
36
44
 
@@ -70,11 +78,27 @@ if ($files.Count -eq 0) {
70
78
  }
71
79
 
72
80
  # 3) 逐文件复制(不删除目标里多出来的旧文件,避免误删用户自装的东西)
81
+ # LS-140(v5.70):PowerShell 热同步具备事务与回滚!
82
+ # 旧实现直接 Copy-Item 覆盖——中途失败留下"一半新一半旧"的混合副本。
83
+ # 现在:先整目录备份,失败时整体回滚,绝不留混合树。
73
84
  $hadFailure = $false
74
85
  foreach ($dst in $targets) {
75
86
  $before = Get-CopyVersion $dst
87
+ if (-not $before) {
88
+ Write-Host ("[跳过] {0}:副本尚未安装(package.json 不存在)" -f $dst) -ForegroundColor Yellow
89
+ continue
90
+ }
76
91
  $copied = 0
77
92
  $failed = @()
93
+ # —— 备份目标(事务回滚的退路)——
94
+ $backup = "$dst.bak-$(Get-Date -Format yyyyMMddHHmmss)"
95
+ try {
96
+ Copy-Item -LiteralPath $dst -Destination $backup -Recurse -Force
97
+ } catch {
98
+ Write-Host ("[错误] 无法备份目标副本 {0},拒绝在其上继续复制:{1}" -f $dst, $_.Exception.Message) -ForegroundColor Red
99
+ exit 1
100
+ }
101
+ $allOk = $true
78
102
  foreach ($rel in $files) {
79
103
  $relWin = $rel -replace '/', '\'
80
104
  $s = Join-Path $src $relWin
@@ -89,16 +113,28 @@ foreach ($dst in $targets) {
89
113
  $copied++
90
114
  } catch {
91
115
  $failed += ("{0} —— {1}" -f $rel, $_.Exception.Message)
116
+ $allOk = $false
92
117
  }
93
118
  }
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) {
119
+ if (-not $allOk) {
120
+ # LS-140:回滚——删除部分更新的副本,从备份恢复原状
121
+ Write-Host ("[回滚] {0}:复制失败,恢复备份状态" -f $dst) -ForegroundColor Yellow
122
+ try {
123
+ Remove-Item -LiteralPath $dst -Recurse -Force
124
+ Rename-Item -LiteralPath $backup -NewName (Split-Path -Leaf $dst)
125
+ } catch {
126
+ Write-Host ("[严重] 回滚失败!副本 {0} 处于混合状态,请手动从备份 {1} 恢复" -f $dst, $backup) -ForegroundColor Red
127
+ }
98
128
  $hadFailure = $true
99
129
  Write-Host (" 失败 {0} 个(多半是 DSH 正在占用文件,完全退出 DSH 后重跑):" -f $failed.Count) -ForegroundColor Yellow
100
130
  $failed | Select-Object -First 5 | ForEach-Object { Write-Host (" - {0}" -f $_) -ForegroundColor Yellow }
131
+ continue
101
132
  }
133
+ # 成功:清理备份
134
+ try { Remove-Item -LiteralPath $backup -Recurse -Force } catch {}
135
+ $after = Get-CopyVersion $dst
136
+ Write-Host ("[同步] {0}" -f $dst)
137
+ Write-Host (" 版本 {0} -> {1},复制 {2}/{3} 个文件" -f $before, $after, $copied, $files.Count) -ForegroundColor Green
102
138
  }
103
139
 
104
140
  if ($hadFailure) { exit 1 }