dsh-world 0.7.0 → 0.7.2

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 (84) hide show
  1. package/CHANGELOG.md +379 -347
  2. package/INSTALL.md +314 -314
  3. package/LICENSE +21 -21
  4. package/NOTES.md +32 -10
  5. package/README.md +7 -6
  6. package/client/index.js +58 -3
  7. package/cordis.patch.yml +6 -6
  8. package/lib/archive.d.ts +3 -1
  9. package/lib/archive.js +6 -4
  10. package/lib/console/routes.d.ts +7 -0
  11. package/lib/console/routes.js +26 -8
  12. package/lib/console/snapshot.d.ts +7 -0
  13. package/lib/console/snapshot.js +3 -2
  14. package/lib/ecosystem/qq/route.d.ts +2 -1
  15. package/lib/ecosystem/qq/route.js +10 -2
  16. package/lib/ecosystem/qq-native/batch.d.ts +2 -0
  17. package/lib/ecosystem/qq-native/batch.js +3 -1
  18. package/lib/ecosystem/qq-native/home.d.ts +1 -0
  19. package/lib/ecosystem/qq-native/home.js +10 -3
  20. package/lib/ecosystem/qq-native/index.d.ts +2 -0
  21. package/lib/ecosystem/qq-native/index.js +21 -4
  22. package/lib/ecosystem/qq-native/native-bridge.js +5 -2
  23. package/lib/ecosystem/qq-native/replies.d.ts +7 -1
  24. package/lib/ecosystem/qq-native/replies.js +30 -1
  25. package/lib/ecosystem/shared/context.d.ts +6 -1
  26. package/lib/ecosystem/shared/context.js +6 -1
  27. package/lib/ecosystem/shared/identity.d.ts +12 -0
  28. package/lib/ecosystem/shared/identity.js +17 -1
  29. package/lib/ecosystem/shared/turn.d.ts +8 -5
  30. package/lib/ecosystem/shared/turn.js +16 -17
  31. package/lib/ecosystem/wechat/archive.d.ts +2 -0
  32. package/lib/ecosystem/wechat/archive.js +3 -1
  33. package/lib/ecosystem/wechat/home.js +9 -4
  34. package/lib/ecosystem/wechat/messages.d.ts +11 -0
  35. package/lib/ecosystem/wechat/messages.js +9 -1
  36. package/lib/ecosystem/wechat/sending.js +36 -9
  37. package/lib/ecosystem/wechat/supervisor.d.ts +11 -2
  38. package/lib/ecosystem/wechat/supervisor.js +90 -9
  39. package/lib/history.d.ts +6 -4
  40. package/lib/history.js +61 -12
  41. package/lib/hostContract.d.ts +4 -1
  42. package/lib/index.d.ts +1 -0
  43. package/lib/index.js +27 -7
  44. package/lib/life/activity.d.ts +2 -0
  45. package/lib/life/activity.js +1 -1
  46. package/lib/life/alarm.d.ts +12 -4
  47. package/lib/life/alarm.js +21 -6
  48. package/lib/life/diary.d.ts +6 -0
  49. package/lib/life/diary.js +23 -2
  50. package/lib/life/runtime.d.ts +1 -0
  51. package/lib/life/runtime.js +57 -9
  52. package/lib/life/toolRegistry.d.ts +4 -3
  53. package/lib/life/toolRegistry.js +13 -3
  54. package/lib/life/types.d.ts +6 -1
  55. package/lib/memory.js +1 -4
  56. package/lib/memoryFiles.d.ts +1 -4
  57. package/lib/memoryFiles.js +18 -43
  58. package/lib/memoryStore.d.ts +1 -3
  59. package/lib/memoryStore.js +1 -1
  60. package/lib/memoryTools.js +2 -2
  61. package/lib/promptSection.d.ts +5 -4
  62. package/lib/promptSection.js +9 -8
  63. package/lib/runtime.d.ts +8 -3
  64. package/lib/runtime.js +60 -94
  65. package/lib/sourceArchive.js +4 -5
  66. package/lib/store.d.ts +1 -1
  67. package/lib/store.js +1 -1
  68. package/lib/types.d.ts +1 -4
  69. package/lib/worldPrompt.js +1 -1
  70. package/lib/worldSwitch.d.ts +15 -1
  71. package/lib/worldSwitch.js +24 -1
  72. package/package.json +1 -1
  73. package/scripts/compact-home.mjs +29 -29
  74. package/scripts/enable-tool-free-compaction.ps1 +33 -33
  75. package/scripts/import-stickers.mjs +17 -17
  76. package/scripts/update-world.mjs +2 -2
  77. package/src/ecosystem/wechat/windows/README.md +5 -3
  78. package/src/ecosystem/wechat/windows/adapter.py +6 -0
  79. package/src/ecosystem/wechat/windows/engine/NOTICE.md +6 -0
  80. package/src/ecosystem/wechat/windows/engine/build.ps1 +8 -2
  81. package/src/ecosystem/wechat/windows/engine/profiles.json +142 -114
  82. package/src/ecosystem/wechat/windows/presence.py +109 -109
  83. package/src/ecosystem/wechat/windows/sender.py +17 -5
  84. package/templates/alarm.md +1 -1
@@ -69,6 +69,22 @@ def selectProfile(path, profiles):
69
69
  raise ValueError(f'不支持当前微信构建,已适配版本:{versions};文件大小与 SHA256 必须同时匹配,禁止加载原生桥')
70
70
 
71
71
 
72
+ class BuildStale(RuntimeError):
73
+ """No build of the native bridge matches its source: `engine/build.ps1` makes one, nothing else may stand in."""
74
+
75
+
76
+ def currentBuild(engineDir):
77
+ """The build record in `engineDir`, only if it was compiled from the bridge source shipped beside this file."""
78
+ buildFile = Path(engineDir) / 'current.json'
79
+ if not buildFile.is_file():
80
+ raise BuildStale('还没有构建原生桥,请先运行 Build')
81
+ build = json.loads(buildFile.read_text(encoding='utf-8-sig'))
82
+ source = Path(__file__).parent / 'engine/bridge.cpp'
83
+ if hashlib.sha256(source.read_bytes()).hexdigest() != build['sourceSha256']:
84
+ raise BuildStale('原生桥源码已变化,请先重新 Build')
85
+ return build
86
+
87
+
72
88
  class NativeSender:
73
89
  def __init__(self, config, checkProcess):
74
90
  import psutil
@@ -84,13 +100,9 @@ class NativeSender:
84
100
  self.profile = selectProfile(core, profiles)
85
101
  # The build sits beside the adapter's config.json, which is where the adapter runs from or is managed by the plugin.
86
102
  engineDir = Path(config['engineDir']) if config.get('engineDir') else Path(__file__).resolve().parents[4] / '.host/wechat/engine'
87
- buildFile = engineDir / 'current.json'
88
- build = json.loads(buildFile.read_text(encoding='utf-8-sig'))
103
+ build = currentBuild(engineDir)
89
104
  self.dll = Path(build['file']).resolve()
90
105
  verifyFile(self.dll, self.dll.stat().st_size, build['sha256'])
91
- source = Path(__file__).parent / 'engine/bridge.cpp'
92
- if hashlib.sha256(source.read_bytes()).hexdigest() != build['sourceSha256']:
93
- raise RuntimeError('原生桥源码已变化,请先重新 Build')
94
106
  self.api = c.WinDLL('kernel32', use_last_error=True)
95
107
  signatures = {
96
108
  'OpenProcess': (w.HANDLE, [w.DWORD, w.BOOL, w.DWORD]),
@@ -27,7 +27,7 @@
27
27
  ## 每日回顾
28
28
  {{date}} 快过完了,回头看看今天吧。{{#conversations}}今天的聊天记录在 {{conversations}}{{/conversations}}{{^conversations}}今天家里没有聊天记录{{/conversations}}{{#activity}},今天做过的事在 {{activity}}{{/activity}},日记在 {{diaryDir}}。
29
29
  先写日记,再看自己:
30
- 1. 日记:一件一件地想,今天发生了什么,我当时是什么感受,现在回头看又怎么想,写进今天的日记;已经写过的,就补上漏掉的。
30
+ 1. 日记:一件一件地想,今天发生了什么,我当时是什么感受,现在回头看又怎么想,写进今天的日记;已经写过的,就补上漏掉的。以前的日记不改:哪天记错了、现在想法不一样了,就写在今天的日记里。
31
31
  2. 我是谁:问问自己有没有变——新的喜好、新的想法,脾气、看法变了,或者说话方式(语气、句子长短、常用表达、玩笑、表情、拆成多条消息的习惯)有了想长期保留或调整的地方。变了,就把变化提炼成一两句,合并进 {{selfFile}} 里对应的地方,写成现在的我;今天发生的事不写进去,也不从日记里搬内容。分清我和聊天对象的话,不把别人的口吻当成自己的。没有变就不用改。{{#snapshot}}改之前的那份已经留在 {{snapshot}}。{{/snapshot}}{{late}}
32
32
 
33
33
  ## 额度用完