@kingsleyasher/dsh-knowledge-base 0.0.0-stage → 3.1.4

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 (516) hide show
  1. package/ARCHITECTURE.en.md +35 -0
  2. package/ARCHITECTURE.md +40 -0
  3. package/BETA4.md +31 -0
  4. package/BETA7.md +35 -0
  5. package/BETA8.md +39 -0
  6. package/BETA9.md +38 -0
  7. package/CONTRIBUTING.md +5 -0
  8. package/DEVELOPMENT.en.md +26 -0
  9. package/DEVELOPMENT.md +27 -0
  10. package/EXISTING-FRAMEWORK-OPTIMIZATION.md +101 -0
  11. package/LICENSE +21 -0
  12. package/MONOREPO.md +34 -0
  13. package/NPM-EDITION.md +9 -0
  14. package/PARSING-PREVIEW.md +84 -0
  15. package/PERFORMANCE.md +43 -0
  16. package/PRIVACY.md +7 -0
  17. package/PROJECT-RECORD.en.md +778 -0
  18. package/PROJECT-RECORD.md +789 -0
  19. package/README.md +109 -3
  20. package/README.zh-CN.md +117 -0
  21. package/RELEASE.en.md +559 -0
  22. package/RELEASE.md +570 -0
  23. package/RETRIEVAL.md +93 -0
  24. package/SECURITY.md +7 -0
  25. package/THIRD-PARTY-NOTICES.md +5 -0
  26. package/VERSIONING.en.md +51 -0
  27. package/VERSIONING.md +50 -0
  28. package/WORKBENCH.en.md +201 -0
  29. package/WORKBENCH.md +195 -0
  30. package/browser-extension/background.js +146 -0
  31. package/browser-extension/icons/knowledge-base-128.png +0 -0
  32. package/browser-extension/icons/knowledge-base-16.png +0 -0
  33. package/browser-extension/icons/knowledge-base-32.png +0 -0
  34. package/browser-extension/icons/knowledge-base-48.png +0 -0
  35. package/browser-extension/manifest.json +25 -0
  36. package/browser-extension/options.html +22 -0
  37. package/browser-extension/options.js +41 -0
  38. package/browser-extension/popup.html +17 -0
  39. package/browser-extension/popup.js +58 -0
  40. package/browser-extension/style.css +11 -0
  41. package/cordis.patch.yml +88 -0
  42. package/docs/LEGACY-246-BOOTSTRAP.md +21 -0
  43. package/docs/LIBRARY-FRAMEWORK-MIGRATION.md +45 -0
  44. package/docs/ORIGINAL-FILE-INDEX-ARCHITECTURE.md +43 -0
  45. package/docs/TODO-LIFECYCLE-VALIDATION.md +42 -0
  46. package/docs/UPDATE-RECOVERY.en.md +18 -0
  47. package/docs/UPDATE-RECOVERY.md +70 -0
  48. package/docs/WINDOWS-SIGNING.md +30 -0
  49. package/docs/client/ARCHITECTURE.en.md +17 -0
  50. package/docs/client/ARCHITECTURE.md +17 -0
  51. package/docs/client/CONTRIBUTING.md +5 -0
  52. package/docs/client/CROSS-VOLUME-TRASH.md +13 -0
  53. package/docs/client/DEVELOPMENT.en.md +33 -0
  54. package/docs/client/DEVELOPMENT.md +33 -0
  55. package/docs/client/EXISTING-FRAMEWORK-OPTIMIZATION.md +3 -0
  56. package/docs/client/PERFORMANCE.md +3 -0
  57. package/docs/client/PRIVACY.md +7 -0
  58. package/docs/client/PROJECT-RECORD.en.md +199 -0
  59. package/docs/client/PROJECT-RECORD.md +219 -0
  60. package/docs/client/README.md +55 -0
  61. package/docs/client/README.zh-CN.md +45 -0
  62. package/docs/client/RELEASE.en.md +148 -0
  63. package/docs/client/RELEASE.md +149 -0
  64. package/docs/client/RETRIEVAL.md +3 -0
  65. package/docs/client/SECURITY.md +7 -0
  66. package/docs/client/THIRD-PARTY-NOTICES.md +5 -0
  67. package/docs/client/VERSIONING.en.md +9 -0
  68. package/docs/client/VERSIONING.md +9 -0
  69. package/docs/client/WORKBENCH.en.md +24 -0
  70. package/docs/client/WORKBENCH.md +24 -0
  71. package/docs/client/skills/personal-knowledge-base/SKILL.md +38 -0
  72. package/docs/releases/client-1.0.1.md +32 -0
  73. package/docs/releases/client-1.0.2.md +32 -0
  74. package/docs/releases/client-1.0.3.md +31 -0
  75. package/docs/releases/client-1.1.1.md +28 -0
  76. package/docs/releases/client-1.1.2.md +16 -0
  77. package/docs/releases/client-1.1.4.md +7 -0
  78. package/docs/releases/client-2.0.0.en.md +13 -0
  79. package/docs/releases/client-2.0.0.md +13 -0
  80. package/docs/releases/client-2.0.1.en.md +10 -0
  81. package/docs/releases/client-2.0.1.md +10 -0
  82. package/docs/releases/client-2.0.3.en.md +8 -0
  83. package/docs/releases/client-2.0.3.md +8 -0
  84. package/docs/releases/plugin-2.4.1.md +24 -0
  85. package/docs/releases/plugin-2.4.10.md +22 -0
  86. package/docs/releases/plugin-2.4.11.md +14 -0
  87. package/docs/releases/plugin-2.4.12.md +14 -0
  88. package/docs/releases/plugin-2.4.13.md +27 -0
  89. package/docs/releases/plugin-2.4.14.md +18 -0
  90. package/docs/releases/plugin-2.4.2.md +31 -0
  91. package/docs/releases/plugin-2.4.3.md +25 -0
  92. package/docs/releases/plugin-2.4.4.md +31 -0
  93. package/docs/releases/plugin-2.4.5.md +23 -0
  94. package/docs/releases/plugin-2.4.6.md +23 -0
  95. package/docs/releases/plugin-2.4.7.md +14 -0
  96. package/docs/releases/plugin-2.4.8.md +14 -0
  97. package/docs/releases/plugin-2.4.9.md +18 -0
  98. package/docs/releases/plugin-2.5.10.md +11 -0
  99. package/docs/releases/plugin-2.5.13.en.md +11 -0
  100. package/docs/releases/plugin-2.5.13.md +11 -0
  101. package/docs/releases/plugin-2.5.3.md +28 -0
  102. package/docs/releases/plugin-2.5.4.md +14 -0
  103. package/docs/releases/plugin-2.5.5.md +16 -0
  104. package/docs/releases/plugin-2.5.6.md +3 -0
  105. package/docs/releases/plugin-2.5.7.md +7 -0
  106. package/docs/releases/plugin-2.5.8.md +7 -0
  107. package/docs/releases/plugin-2.5.9.md +7 -0
  108. package/docs/releases/plugin-3.0.0.en.md +13 -0
  109. package/docs/releases/plugin-3.0.0.md +13 -0
  110. package/docs/releases/plugin-3.0.1.en.md +10 -0
  111. package/docs/releases/plugin-3.0.1.md +10 -0
  112. package/docs/releases/plugin-3.1.3.en.md +11 -0
  113. package/docs/releases/plugin-3.1.3.md +11 -0
  114. package/docs/validation/windows-auto-update-2.4.13.md +31 -0
  115. package/docs/validation/windows-direct-246-to-2413.md +32 -0
  116. package/package.json +78 -6
  117. package/packages/kb-contracts/desktop.js +29 -0
  118. package/packages/kb-contracts/index.js +132 -0
  119. package/packages/kb-contracts/node.js +3 -0
  120. package/packages/kb-contracts/package.json +17 -0
  121. package/packages/kb-contracts/schema.js +42 -0
  122. package/packages/kb-contracts/tools.js +1 -0
  123. package/packages/kb-contracts/version-policy.js +45 -0
  124. package/packages/kb-core/index.js +9 -0
  125. package/packages/kb-core/package.json +15 -0
  126. package/packages/kb-core/src/capture-surface.js +22 -0
  127. package/packages/kb-core/src/documents.js +105 -0
  128. package/packages/kb-core/src/embedded.js +29 -0
  129. package/packages/kb-core/src/file-catalog.js +151 -0
  130. package/packages/kb-core/src/file-classification.js +60 -0
  131. package/packages/kb-core/src/flow-workspace.js +66 -0
  132. package/packages/kb-core/src/flows.js +1136 -0
  133. package/packages/kb-core/src/fsindex.js +293 -0
  134. package/packages/kb-core/src/import-service.js +486 -0
  135. package/packages/kb-core/src/importer.js +909 -0
  136. package/packages/kb-core/src/inbox-flow.js +2 -0
  137. package/packages/kb-core/src/index-architecture.js +48 -0
  138. package/packages/kb-core/src/index-maintenance.js +81 -0
  139. package/packages/kb-core/src/index-policy-service.js +191 -0
  140. package/packages/kb-core/src/index-policy.js +121 -0
  141. package/packages/kb-core/src/kbcore.js +2519 -0
  142. package/packages/kb-core/src/library-framework.js +186 -0
  143. package/packages/kb-core/src/library-state.js +68 -0
  144. package/packages/kb-core/src/managed-files.js +69 -0
  145. package/packages/kb-core/src/map.js +171 -0
  146. package/packages/kb-core/src/parse-credentials.js +49 -0
  147. package/packages/kb-core/src/parse-discovery.js +119 -0
  148. package/packages/kb-core/src/parse-job-storage.js +40 -0
  149. package/packages/kb-core/src/parse-native.js +87 -0
  150. package/packages/kb-core/src/parse-presets.js +46 -0
  151. package/packages/kb-core/src/parse-source-authority.js +72 -0
  152. package/packages/kb-core/src/parsing.js +2307 -0
  153. package/packages/kb-core/src/relation-name-lookup.js +43 -0
  154. package/packages/kb-core/src/retrieval-api.js +79 -0
  155. package/packages/kb-core/src/retrieval-cache.js +22 -0
  156. package/packages/kb-core/src/retrieval-chunks.js +128 -0
  157. package/packages/kb-core/src/retrieval-pool.js +102 -0
  158. package/packages/kb-core/src/retrieval-worker.js +190 -0
  159. package/packages/kb-core/src/retrieval.js +618 -0
  160. package/packages/kb-core/src/runtime-resources.js +73 -0
  161. package/packages/kb-core/src/service-ownership.js +18 -0
  162. package/packages/kb-core/src/source-references.js +61 -0
  163. package/packages/kb-core/src/storage-io.js +121 -0
  164. package/packages/kb-core/src/system-upgrades.js +104 -0
  165. package/packages/kb-core/src/workbench-backup.js +219 -0
  166. package/packages/kb-core/src/workbench-deliverables.js +73 -0
  167. package/packages/kb-core/src/workbench-files.js +25 -0
  168. package/packages/kb-core/src/workbench-inbox.js +57 -0
  169. package/packages/kb-core/src/workbench-links.js +236 -0
  170. package/packages/kb-core/src/workbench-question.js +131 -0
  171. package/packages/kb-core/src/workbench-relation-index.js +110 -0
  172. package/packages/kb-core/src/workbench-state.js +102 -0
  173. package/packages/kb-core/src/workbench-trash.js +213 -0
  174. package/packages/kb-core/src/workbench.js +936 -0
  175. package/packages/kb-service/auth.js +39 -0
  176. package/packages/kb-service/build.js +18 -0
  177. package/packages/kb-service/cli.js +26 -0
  178. package/packages/kb-service/client.js +64 -0
  179. package/packages/kb-service/clipper.js +15 -0
  180. package/packages/kb-service/compatibility.js +34 -0
  181. package/packages/kb-service/desktop-files.js +514 -0
  182. package/packages/kb-service/desktop-host-links.js +39 -0
  183. package/packages/kb-service/dsh-broker.js +64 -0
  184. package/packages/kb-service/dsh-host.js +168 -0
  185. package/packages/kb-service/dsh-stream-relay.js +32 -0
  186. package/packages/kb-service/engines.js +32 -0
  187. package/packages/kb-service/extension.js +8 -0
  188. package/packages/kb-service/first-library-handoff.js +28 -0
  189. package/packages/kb-service/handoff-api.js +22 -0
  190. package/packages/kb-service/host-adapter.js +151 -0
  191. package/packages/kb-service/host-assets.js +9 -0
  192. package/packages/kb-service/host-python.js +30 -0
  193. package/packages/kb-service/host-updates.js +11 -0
  194. package/packages/kb-service/inbox-host.js +47 -0
  195. package/packages/kb-service/inbox-jobs.js +54 -0
  196. package/packages/kb-service/index.js +3 -0
  197. package/packages/kb-service/io.js +24 -0
  198. package/packages/kb-service/launch-lock.js +27 -0
  199. package/packages/kb-service/launcher.js +18 -0
  200. package/packages/kb-service/legacy-handoff.js +27 -0
  201. package/packages/kb-service/legacy-ports.js +18 -0
  202. package/packages/kb-service/main.js +13 -0
  203. package/packages/kb-service/memory-channel.js +57 -0
  204. package/packages/kb-service/memory-sync.js +42 -0
  205. package/packages/kb-service/migration.js +131 -0
  206. package/packages/kb-service/native.py +216 -0
  207. package/packages/kb-service/operations.js +19 -0
  208. package/packages/kb-service/package.json +1 -0
  209. package/packages/kb-service/runtime.js +185 -0
  210. package/packages/kb-service/safe-update.js +104 -0
  211. package/packages/kb-service/service.js +494 -0
  212. package/packages/kb-service/tool-definitions.json +934 -0
  213. package/packages/kb-service/tool-router.js +45 -0
  214. package/packages/kb-service/vector-profiles.js +41 -0
  215. package/presets/01-knowledge-agent.patch.yml +347 -0
  216. package/runtime/python/LICENSE.txt +676 -0
  217. package/runtime/python/_asyncio.pyd +0 -0
  218. package/runtime/python/_bz2.pyd +0 -0
  219. package/runtime/python/_ctypes.pyd +0 -0
  220. package/runtime/python/_decimal.pyd +0 -0
  221. package/runtime/python/_elementtree.pyd +0 -0
  222. package/runtime/python/_hashlib.pyd +0 -0
  223. package/runtime/python/_lzma.pyd +0 -0
  224. package/runtime/python/_multiprocessing.pyd +0 -0
  225. package/runtime/python/_overlapped.pyd +0 -0
  226. package/runtime/python/_queue.pyd +0 -0
  227. package/runtime/python/_remote_debugging.pyd +0 -0
  228. package/runtime/python/_socket.pyd +0 -0
  229. package/runtime/python/_sqlite3.pyd +0 -0
  230. package/runtime/python/_ssl.pyd +0 -0
  231. package/runtime/python/_uuid.pyd +0 -0
  232. package/runtime/python/_wmi.pyd +0 -0
  233. package/runtime/python/_zoneinfo.pyd +0 -0
  234. package/runtime/python/_zstd.pyd +0 -0
  235. package/runtime/python/libcrypto-3.dll +0 -0
  236. package/runtime/python/libffi-8.dll +0 -0
  237. package/runtime/python/libssl-3.dll +0 -0
  238. package/runtime/python/libtommath.dll +0 -0
  239. package/runtime/python/pyexpat.pyd +0 -0
  240. package/runtime/python/python.cat +0 -0
  241. package/runtime/python/python.exe +0 -0
  242. package/runtime/python/python3.dll +0 -0
  243. package/runtime/python/python314._pth +5 -0
  244. package/runtime/python/python314.dll +0 -0
  245. package/runtime/python/python314.zip +0 -0
  246. package/runtime/python/pythonw.exe +0 -0
  247. package/runtime/python/select.pyd +0 -0
  248. package/runtime/python/sqlite3.dll +0 -0
  249. package/runtime/python/unicodedata.pyd +0 -0
  250. package/runtime/python/vcruntime140.dll +0 -0
  251. package/runtime/python/vcruntime140_1.dll +0 -0
  252. package/runtime/python/winsound.pyd +0 -0
  253. package/skills/personal-knowledge-base/SKILL.md +38 -0
  254. package/src/client/capture-icon-192.png +0 -0
  255. package/src/client/capture-icon-512.png +0 -0
  256. package/src/client/capture-icon.svg +12 -0
  257. package/src/client/capture-sw.js +10 -0
  258. package/src/client/capture.css +1 -0
  259. package/src/client/capture.html +1 -0
  260. package/src/client/capture.js +37 -0
  261. package/src/client/capture.webmanifest +1 -0
  262. package/src/client/inbox-organize-bridge.js +22 -0
  263. package/src/client/index.js +4980 -0
  264. package/src/client/knowledge-ui.css +255 -0
  265. package/src/client/pdfjs/LICENSE +177 -0
  266. package/src/client/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
  267. package/src/client/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
  268. package/src/client/pdfjs/cmaps/78-H.bcmap +0 -0
  269. package/src/client/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
  270. package/src/client/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
  271. package/src/client/pdfjs/cmaps/78-V.bcmap +0 -0
  272. package/src/client/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
  273. package/src/client/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
  274. package/src/client/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
  275. package/src/client/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
  276. package/src/client/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
  277. package/src/client/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
  278. package/src/client/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
  279. package/src/client/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
  280. package/src/client/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
  281. package/src/client/pdfjs/cmaps/Add-H.bcmap +0 -0
  282. package/src/client/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
  283. package/src/client/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
  284. package/src/client/pdfjs/cmaps/Add-V.bcmap +0 -0
  285. package/src/client/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
  286. package/src/client/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
  287. package/src/client/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
  288. package/src/client/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
  289. package/src/client/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
  290. package/src/client/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
  291. package/src/client/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
  292. package/src/client/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  293. package/src/client/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
  294. package/src/client/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
  295. package/src/client/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
  296. package/src/client/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
  297. package/src/client/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
  298. package/src/client/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
  299. package/src/client/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  300. package/src/client/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
  301. package/src/client/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
  302. package/src/client/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
  303. package/src/client/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
  304. package/src/client/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
  305. package/src/client/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
  306. package/src/client/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
  307. package/src/client/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  308. package/src/client/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
  309. package/src/client/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
  310. package/src/client/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
  311. package/src/client/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  312. package/src/client/pdfjs/cmaps/B5-H.bcmap +0 -0
  313. package/src/client/pdfjs/cmaps/B5-V.bcmap +0 -0
  314. package/src/client/pdfjs/cmaps/B5pc-H.bcmap +0 -0
  315. package/src/client/pdfjs/cmaps/B5pc-V.bcmap +0 -0
  316. package/src/client/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
  317. package/src/client/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
  318. package/src/client/pdfjs/cmaps/CNS1-H.bcmap +0 -0
  319. package/src/client/pdfjs/cmaps/CNS1-V.bcmap +0 -0
  320. package/src/client/pdfjs/cmaps/CNS2-H.bcmap +0 -0
  321. package/src/client/pdfjs/cmaps/CNS2-V.bcmap +3 -0
  322. package/src/client/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
  323. package/src/client/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
  324. package/src/client/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
  325. package/src/client/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
  326. package/src/client/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
  327. package/src/client/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
  328. package/src/client/pdfjs/cmaps/EUC-H.bcmap +0 -0
  329. package/src/client/pdfjs/cmaps/EUC-V.bcmap +0 -0
  330. package/src/client/pdfjs/cmaps/Ext-H.bcmap +0 -0
  331. package/src/client/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
  332. package/src/client/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
  333. package/src/client/pdfjs/cmaps/Ext-V.bcmap +0 -0
  334. package/src/client/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
  335. package/src/client/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
  336. package/src/client/pdfjs/cmaps/GB-H.bcmap +4 -0
  337. package/src/client/pdfjs/cmaps/GB-V.bcmap +0 -0
  338. package/src/client/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
  339. package/src/client/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
  340. package/src/client/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
  341. package/src/client/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
  342. package/src/client/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
  343. package/src/client/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
  344. package/src/client/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
  345. package/src/client/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
  346. package/src/client/pdfjs/cmaps/GBT-H.bcmap +0 -0
  347. package/src/client/pdfjs/cmaps/GBT-V.bcmap +0 -0
  348. package/src/client/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
  349. package/src/client/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
  350. package/src/client/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
  351. package/src/client/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
  352. package/src/client/pdfjs/cmaps/H.bcmap +0 -0
  353. package/src/client/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
  354. package/src/client/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
  355. package/src/client/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
  356. package/src/client/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
  357. package/src/client/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
  358. package/src/client/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
  359. package/src/client/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
  360. package/src/client/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
  361. package/src/client/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
  362. package/src/client/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
  363. package/src/client/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
  364. package/src/client/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
  365. package/src/client/pdfjs/cmaps/Hankaku.bcmap +0 -0
  366. package/src/client/pdfjs/cmaps/Hiragana.bcmap +0 -0
  367. package/src/client/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
  368. package/src/client/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
  369. package/src/client/pdfjs/cmaps/KSC-H.bcmap +0 -0
  370. package/src/client/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
  371. package/src/client/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
  372. package/src/client/pdfjs/cmaps/KSC-V.bcmap +0 -0
  373. package/src/client/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
  374. package/src/client/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  375. package/src/client/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  376. package/src/client/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
  377. package/src/client/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
  378. package/src/client/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
  379. package/src/client/pdfjs/cmaps/Katakana.bcmap +0 -0
  380. package/src/client/pdfjs/cmaps/LICENSE +36 -0
  381. package/src/client/pdfjs/cmaps/NWP-H.bcmap +0 -0
  382. package/src/client/pdfjs/cmaps/NWP-V.bcmap +0 -0
  383. package/src/client/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
  384. package/src/client/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
  385. package/src/client/pdfjs/cmaps/Roman.bcmap +0 -0
  386. package/src/client/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  387. package/src/client/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  388. package/src/client/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  389. package/src/client/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  390. package/src/client/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  391. package/src/client/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  392. package/src/client/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  393. package/src/client/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  394. package/src/client/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
  395. package/src/client/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
  396. package/src/client/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
  397. package/src/client/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
  398. package/src/client/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
  399. package/src/client/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
  400. package/src/client/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
  401. package/src/client/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
  402. package/src/client/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  403. package/src/client/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  404. package/src/client/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  405. package/src/client/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  406. package/src/client/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  407. package/src/client/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  408. package/src/client/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  409. package/src/client/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  410. package/src/client/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  411. package/src/client/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  412. package/src/client/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  413. package/src/client/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  414. package/src/client/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  415. package/src/client/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  416. package/src/client/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  417. package/src/client/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  418. package/src/client/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  419. package/src/client/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  420. package/src/client/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  421. package/src/client/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  422. package/src/client/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  423. package/src/client/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  424. package/src/client/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  425. package/src/client/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
  426. package/src/client/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
  427. package/src/client/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
  428. package/src/client/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
  429. package/src/client/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
  430. package/src/client/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
  431. package/src/client/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
  432. package/src/client/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
  433. package/src/client/pdfjs/cmaps/V.bcmap +0 -0
  434. package/src/client/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
  435. package/src/client/pdfjs/pdf.mjs +26779 -0
  436. package/src/client/pdfjs/pdf.worker.mjs +63420 -0
  437. package/src/client/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
  438. package/src/client/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
  439. package/src/client/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
  440. package/src/client/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
  441. package/src/client/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
  442. package/src/client/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
  443. package/src/client/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
  444. package/src/client/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
  445. package/src/client/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
  446. package/src/client/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
  447. package/src/client/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
  448. package/src/client/pdfjs/standard_fonts/LICENSE_LIBERATION +102 -0
  449. package/src/client/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
  450. package/src/client/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
  451. package/src/client/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
  452. package/src/client/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
  453. package/src/client/pdfjs/wasm/LICENSE_JBIG2 +196 -0
  454. package/src/client/pdfjs/wasm/LICENSE_OPENJPEG +39 -0
  455. package/src/client/pdfjs/wasm/LICENSE_PDFJS_JBIG2 +13 -0
  456. package/src/client/pdfjs/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
  457. package/src/client/pdfjs/wasm/LICENSE_PDFJS_QCMS +22 -0
  458. package/src/client/pdfjs/wasm/LICENSE_QCMS +21 -0
  459. package/src/client/pdfjs/wasm/jbig2.wasm +0 -0
  460. package/src/client/pdfjs/wasm/openjpeg.wasm +0 -0
  461. package/src/client/pdfjs/wasm/openjpeg_nowasm_fallback.js +17 -0
  462. package/src/client/pdfjs/wasm/qcms_bg.wasm +0 -0
  463. package/src/client/todo-lifecycle-ui.js +58 -0
  464. package/src/client/workbench-features.js +148 -0
  465. package/src/client/workbench-relations.js +86 -0
  466. package/src/client/workbench-theme.css +81 -0
  467. package/src/client/workbench-ui.js +1761 -0
  468. package/src/host/capture-surface.js +2 -0
  469. package/src/host/citation-guard.js +40 -0
  470. package/src/host/command-description.js +43 -0
  471. package/src/host/flow-workspace.js +62 -0
  472. package/src/host/flows.js +2 -0
  473. package/src/host/fsindex.js +2 -0
  474. package/src/host/gateway.js +916 -0
  475. package/src/host/import-service.js +2 -0
  476. package/src/host/importer.js +2 -0
  477. package/src/host/index-maintenance.js +2 -0
  478. package/src/host/index-policy-service.js +2 -0
  479. package/src/host/index-policy.js +2 -0
  480. package/src/host/index.js +2224 -0
  481. package/src/host/kbcore.js +2 -0
  482. package/src/host/managed-files.js +2 -0
  483. package/src/host/map.js +2 -0
  484. package/src/host/parse-credentials.js +2 -0
  485. package/src/host/parse-discovery.js +2 -0
  486. package/src/host/parse-native.js +2 -0
  487. package/src/host/parse-presets.js +2 -0
  488. package/src/host/parse-source-authority.js +2 -0
  489. package/src/host/parsing.js +7 -0
  490. package/src/host/relation-name-lookup.js +2 -0
  491. package/src/host/retrieval-api.js +2 -0
  492. package/src/host/retrieval-cache.js +2 -0
  493. package/src/host/retrieval-chunks.js +2 -0
  494. package/src/host/retrieval-pool.js +2 -0
  495. package/src/host/retrieval-worker.js +2 -0
  496. package/src/host/retrieval.js +2 -0
  497. package/src/host/runtime-resources.js +2 -0
  498. package/src/host/selftest.js +747 -0
  499. package/src/host/storage-io.js +2 -0
  500. package/src/host/system-upgrades.js +2 -0
  501. package/src/host/todo-lifecycle.js +66 -0
  502. package/src/host/updates.js +281 -0
  503. package/src/host/versioning.js +2 -0
  504. package/src/host/workbench-backup.js +2 -0
  505. package/src/host/workbench-deliverables.js +2 -0
  506. package/src/host/workbench-files.js +2 -0
  507. package/src/host/workbench-inbox.js +2 -0
  508. package/src/host/workbench-links.js +2 -0
  509. package/src/host/workbench-question.js +2 -0
  510. package/src/host/workbench-relation-index.js +2 -0
  511. package/src/host/workbench-state.js +2 -0
  512. package/src/host/workbench-trash.js +2 -0
  513. package/src/host/workbench.js +5 -0
  514. package/tools/kb-local-model.py +141 -0
  515. package/tools/kb-pdf-pages.py +78 -0
  516. package/tools/kb-transactional-update.py +284 -0
@@ -0,0 +1,7 @@
1
+ ## 插件 2.5.9 · 安全接管知识库服务
2
+
3
+ 更新器等待知识库任务结束,继续使用已校验的安装包。旧服务正常退出后才切换插件,并在支持热重载的 DSH 中自动加载。新版宿主和服务都就绪后才确认完成。
4
+
5
+ ## Plugin 2.5.9 · Safe service handoff
6
+
7
+ The updater reuses its verified package while knowledge-base work is active. When idle, it drains the old service, applies the package and uses DSH hot reload where available. Completion requires the new Host and worker to be active.
@@ -0,0 +1,13 @@
1
+ ## Plugin 3.0.0 / Client 2.0.0 · Major release
2
+
3
+ Consolidates release, cross-round and visual review fixes. Both products work independently or share one library. Compatibility continues to use the shared protocol, storage generation and negotiated capabilities; changing the product major version does not force migration or rebuilding.
4
+
5
+ - Fixes first-run creation, interrupted initialization, migration, backup restoration, grant renewal, concurrent ingestion and update handoff.
6
+ - External edits within the library trigger scoped maintenance with retryable continuous saves. Startup reads coalesce, healthy indexes are reused, and permission changes hide stale content.
7
+ - Restores shared management control styling, aligned switches, light/dark themes, readable badges, modal scrolling and visible keyboard focus.
8
+ - Checks build/package fingerprints and regenerates real-library launcher pairing metadata for the exact companion plugin.
9
+
10
+ Existing originals stay in place. A version upgrade alone does not migrate or rebuild the entire library. Copy imports watch the library copy, not the external source. The client checks and verifies downloads; installation still uses the installer. Historical host installation constraints and the 2.4.6 recovery boundary remain unchanged.
11
+
12
+ Release tags are v3.0.0 and client-v2.0.0, with separate plugin TGZ, client EXE and product manifests. The installer is unsigned and requires an empty destination. Publication does not install into production. See release assets for checksums and validation scope.
13
+
@@ -0,0 +1,13 @@
1
+ ## 插件 3.0.0 / 客户端 2.0.0 · 大版本发布
2
+
3
+ 汇总本轮发布审查、交叉审查和界面检查修复:插件与客户端可独立使用,也可连接同一知识库;兼容性仍依据共享协议、存储代次及能力协商,不因产品主版本变化强制重建或迁移。
4
+
5
+ - 首次建库、中断恢复、迁移、备份恢复、授权续期、并发入库和更新交接修复。
6
+ - 外部修改库内原件按受影响路径更新,连续保存可重试;启动读取合并、健康索引复用,权限变化及时隐藏旧内容。
7
+ - 管理界面共享控件样式、开关对齐、深浅主题、状态徽标、弹窗滚动和焦点可见性修复。
8
+ - 编译与打包指纹一致性检查,并按本次插件重新生成真实库引导所需配套身份,避免沿用旧版元数据。
9
+
10
+ 现有资料保留原位,不因版本号升级自动迁移或全库重建。复制导入后只监视知识库内副本;修改外部源文件不会自动同步副本。客户端支持检查与校验下载,安装仍通过安装器完成。旧宿主安装能力限制及历史 2.4.6 恢复边界保持不变。
11
+
12
+ 发布标签为 v3.0.0 与 client-v2.0.0,附件分别提供插件 TGZ、客户端 EXE 和产品清单。安装器未签名,要求空安装目录;发布不修改生产环境。验证范围与摘要见发布附件。
13
+
@@ -0,0 +1,10 @@
1
+ ## 2026-11-11 · Plugin 3.0.1 / client 2.0.1 · Update transaction recovery patch
2
+
3
+ Fixes abandoned prepared receipts blocking later updates after a separate Host installation. Under the profile writer lock, archive the complete old receipt and abort only its preparation before staging a new update. Preserve the installed version, candidates and backups, and reject stale confirmations. Publishing/unknown phases, publication backups and active writer locks still require recovery or waiting. Update dialogs distinguish recovery from writer contention.
4
+
5
+ Adds a preparation-only `cancel-prepared` recovery command and bilingual instructions. Archive before cancellation; never roll back a publishing transaction through this command.
6
+
7
+ An installed older version still runs its older updater. An already blocked installation needs one-time safe cancellation of the preparation-only receipt before the normal update to 3.0.1; the not-yet-installed patch cannot repair that updater in advance. This machine's historical receipt was backed up and cancelled. Client 2.0.1 includes the matching repaired backend and plugin.
8
+
9
+ Validation covers real pnpm archive/restage/commit, stale confirmation rejection, writer/publication guards, real Windows service drain and reconnection, and an isolated copy of the installed profile. Synchronizes bilingual records, product feeds and download links. No protocol/storage epoch change or library rebuild. The unsigned client installer still requires an empty destination.
10
+
@@ -0,0 +1,10 @@
1
+ ## 2026-11-11 · 插件 3.0.1 / 客户端 2.0.1 · 自动更新事务恢复补丁
2
+
3
+ 修复旧更新停留在 prepared、宿主后来已安装其他版本时,新更新永久受阻的问题。持有配置写锁后完整归档旧事务并取消旧准备,再准备本次更新;不回退当前安装、不删除候选与备份。旧确认请求失效。publishing、未知状态、已存在发布备份或活跃写入锁仍需恢复或等待。更新弹窗区分安装恢复与写入占用。
4
+
5
+ 提供仅取消准备的 `cancel-prepared` 恢复入口及中英文步骤,先归档再取消,拒绝对安装中状态执行回滚。
6
+
7
+ 已安装旧版仍使用旧更新器;若已被历史事务阻塞,须先按恢复说明安全结束“仅准备”的旧事务,不能指望尚未安装的新包修复旧更新器。本机该历史事务已备份取消。此后可按正常入口更新到 3.0.1。客户端 2.0.1 携带相同修复内核及配套插件。
8
+
9
+ 验证包含真实 pnpm 的归档/重新准备/提交、旧确认拒绝、锁与发布保护,真实 Windows 服务停服交接、安装后重新连接,以及真实安装配置隔离副本的升级。中英文文档、产品清单与下载入口同步;不改变协议和存储代次,不重建知识库。客户端仍需空目录安装,安装器未签名。
10
+
@@ -0,0 +1,11 @@
1
+ # Plugin 3.1.3 · File tree and patrol performance
2
+
3
+ Date: 2026-11-16.
4
+
5
+ - Catalog and exclusion policy are cached by file identity; listings read the policy once, precompile prefix lookups, and use the validated parent directory for one lstat per entry.
6
+ - Directory listings are reused for 15 seconds behind directory, policy, catalog and privacy signatures.
7
+ - Patrol compares file stat digests and requests/import-sources content digests and reuses the persisted catalog when nothing changed instead of hashing the library.
8
+ - Measured: the 687-entry real directory went from 376 ms to 32 ms first read and 0.8 ms on repeat; a 250-entry directory with 400 exclusion groups from 819 ms to 49 ms; catalog parsing from 16.5 ms to 0.4 ms; unchanged patrol from about 1.9 s to 0.1 s.
9
+ - Index policy, architecture, maintenance, classification, workbench, large-library and service integration checks pass, with new policy-matcher equivalence, listing-cache invalidation and patrol-reuse checks.
10
+
11
+ Release artifacts: `local-dsh-knowledge-base-3.1.3.tgz`, `release-manifest-v2.json`, `SHA256SUMS`. Client 2.0.3 is published alongside it (unsigned installer, empty destination required).
@@ -0,0 +1,11 @@
1
+ # 插件 3.1.3 · 文件树与周期维护性能
2
+
3
+ 日期:2026-11-16。
4
+
5
+ - 文件目录与排除策略按文件身份缓存;列表只读取一次策略并预编译前缀匹配,条目使用已校验父目录直接 lstat。
6
+ - 目录列表在 15 秒内复用,并校验目录签名、策略签名、目录版本与隐私设置。
7
+ - 索引巡检先比较文件 stat 与 requests/import-sources 内容摘要,未变化时复用已持久化目录,不再全库哈希。
8
+ - 实测:687 项真实目录首次 376 ms → 32 ms、重复 0.8 ms;400 组排除策略的 250 项目录 819 ms → 49 ms;目录解析 16.5 ms → 0.4 ms;未变化巡检约 1.9 s → 0.1 s。
9
+ - 索引策略、架构、维护、分类、工作台、大库与服务集成检查通过,并新增策略匹配一致性、列表缓存失效与巡检复用检查。
10
+
11
+ 发布制品:`local-dsh-knowledge-base-3.1.3.tgz`、`release-manifest-v2.json`、`SHA256SUMS`。客户端同步发布 2.0.3(未签名安装器,需空目录安装)。
@@ -0,0 +1,31 @@
1
+ # Windows 自动升级实机验证:2.4.6 → 2.4.13
2
+
3
+ 另已补做 [未经修改的原版 2.4.6 直接到 2.4.13 验证](windows-direct-246-to-2413.md):最小有效 profile 的原自动安装路径通过,三个受阻场景分别保留旧版。该隔离验证没有使用本文件实机救援中的临时兼容补丁。
4
+
5
+ ## 补验:完整 2.4.3 直接到 2.4.13
6
+
7
+ 2026-11-05 重新执行 `tests/direct-243-upgrade.test.mjs`,1 项 Windows 定向检查通过。测试先验证受损旧代码从固定摘要的公开 2.4.3 归档恢复为完整原包,然后从该 2.4.3 直接安装正式 2.4.13,中间没有安装 2.4.6。恢复步骤是该用例额外覆盖的损坏场景,不是正常 2.4.3 用户直升的前置要求。
8
+
9
+ 原版 2.4.3 检查器接受当前正式 2.4.13 清单并判定可自动更新;真实 pnpm 在旧服务在线时完成安装,旧连接仍能应答。释放连接后,新运行时通过旧服务自然退出及清理确认完成交接,服务支持新版安全停服协议,合成原件保持不变。
10
+
11
+ 此结果证明该公开旧包、隔离 profile、真实 Windows 安装器与运行服务的直接兼容路径。用例由测试程序调用 pnpm,未驱动完整 Electron 界面或证明所有用户环境都会自动触发;未覆盖其他更早版本或复杂宿主依赖组合。已受旧待确认记录阻断的 2.4.6 是另一个前置故障,不能把其限制推广到正常 2.4.3。
12
+
13
+ 日期:2026-11-05。该记录补充发布后验证,不改变 2.4.13 的包字节或构建号。
14
+
15
+ 旧客户端的待确认记录目标已经安装,但共享 POST 状态漏返回构建号。对旧客户端应用有原件备份的单次兼容恢复,使其通过已有只读 GET 状态完成原有精确确认;随后由原自动更新器检查、下载及提交安装,没有通过独立安装脚本或宿主手动安装入口提交安装。仅发布更新源不能改变一份已运行的旧客户端;本次实机结果是在这次受控兼容恢复后取得。
16
+
17
+ 自动准备阶段另暴露宿主相对路径插件及未公开内置 SDK 固定版本。安装器改为只解析知识库无依赖包,并合并对应三组锁记录,保留其他配置和锁记录。
18
+
19
+ - 安装事务:`committed`,目标 `2.4.13 / 280919e50a3d55eb`。
20
+ - 已安装 474 个文件逐一符合正式包摘要。
21
+ - 其他 profile 配置和不属于知识库的锁记录与更新前基线一致。
22
+ - 正在运行的共享服务为 active,运行时构建 `996f2d95de9faa74` 与发布代码一致。
23
+ - 实机只读 `kb_flow(action="list")` 返回 `ok=true, action=list`;未公开流程内容,未运行或重放用户流程。
24
+
25
+ 未使用真实录音或模型推理,未证明笔记生成质量。未修改知识库文档、解析记录或凭据。该次成功不代表所有旧版 profile 均可无恢复步骤升级。
26
+
27
+ ## 2.4.6 升级范围补充(2026-11-05)
28
+
29
+ 原版 2.4.6 的旧回执确认会在下载新包前阻断更新,旧准备器还可能重新解析其他宿主依赖。仅发布 2.4.13 或过渡包不能修复已经运行的旧代码;本机经过单次兼容恢复后成功,不代表其他原版用户均能零操作升级。
30
+
31
+ 现提供独立的 [2.4.6 通用升级恢复入口](../LEGACY-246-BOOTSTRAP.md),校验公开原包后事务安装未改动的正式 2.4.13,支持自动发现单一 profile 或明确选择其他 profile。它是一次性外部恢复,不是静默自动升级。4 项 Windows 入口/真实 pnpm 检查和 2 项旧客户端边界检查通过,覆盖其他依赖保持、提交 EPERM 回滚、忙碌拒绝、多 profile 选择和独立 Python。历史安全事务不匹配仍可能阻止后续安装,不能宣称通用零操作自动迁移已经完成;这需要 DSH 宿主独立恢复通道。
@@ -0,0 +1,32 @@
1
+ # 原版 2.4.6 直接升级正式 2.4.13:Windows 定向验证
2
+
3
+ 日期:2026-11-05。
4
+
5
+ **结论:原版 2.4.6 存在成功直升 2.4.13 的自动安装路径,无需经过中间版,也无需预先修改旧代码或使用恢复工具。** 本次通过的是无历史待确认记录、仅注册知识库包的有效隔离 profile。安装返回需要重启,重新启动 Host 后确认正式 2.4.13 生效。不能将这一结果推广为所有 2.4.6 profile 均可自动成功。
6
+
7
+ ## 验证对象与方法
8
+
9
+ - 旧包:正式 `local-dsh-knowledge-base-2.4.6.tgz`,构建 `5c9679e46cbc1498`,SHA-256 `dba33f268771d01435aafa6bf331fb00d83901daeaab2353c2bdc3832ca93c45`。
10
+ - 目标:正式 `local-dsh-knowledge-base-2.4.13.tgz`,构建 `280919e50a3d55eb`,SHA-256 `a7966d297df119573d85a4cbca532359beab1018fd469f387a0a496cc8984b49`。
11
+ - 完整解出公开旧包后核对其构建。调用原包中的自动决策、客户端更新状态机、Host adapter HTTP API、下载器、Python 事务安装器及运行服务,没有替换成新安装器或补丁。
12
+ - 宿主接口由最小测试外壳提供,HTTP API 和后台服务真实运行,pnpm 真实执行。原客户端函数在 VM 中执行,浏览器存储由独立内存对象替代。下载接口返回固定摘要的正式清单和 TGZ 原始字节,不将联网或镜像可用性纳入本次结论。
13
+ - 新版确认在另一个全新 Node Host 进程中执行,避免模块缓存继续复用旧代码。所有库内容、依赖名称、历史回执及状态均为隔离合成数据,没有使用正式用户 profile。
14
+
15
+ ## 结果
16
+
17
+ | 场景 | 实际结果 | 旧版保留情况 |
18
+ | --- | --- | --- |
19
+ | 无旧回执、仅知识库依赖 | 原版自动决策触发检查、下载、准备和提交;事务 `committed`,返回 `restart-required`。新 Host 加载 2.4.13 后,新客户端自行确认并清除该次待确认记录 | 旧服务有匹配的干净退出回执;合成原件不变 |
20
+ | 已有失效的旧 Host 回执 | POST 状态确实缺 build,GET 有 build;原客户端停在待确认,没有调用准备安装 | 旧包及 profile 清单/锁不变,旧服务仍 active |
21
+ | profile 内其他插件使用相对 `file:` 依赖 | 原版旧安装器在准备阶段拒绝,未调用提交安装 | 旧包及 profile 清单/锁不变,旧服务仍 active |
22
+ | 新增 SDK 固定版本不在原锁文件及离线缓存中 | 旧安装器重新解析 profile 时准备失败,未调用提交安装 | 旧包及 profile 清单/锁不变,旧服务仍 active |
23
+
24
+ SDK 场景有意包含缺失的锁记录,不能据此断言所有已完整锁定的私有 SDK 都会失败;它证明旧准备流程对需要重新解析、但离线不可用的其他依赖仍会受阻。
25
+
26
+ 成功场景的新运行服务构建为 `996f2d95de9faa74`,与正式 2.4.13 代码一致。没有运行恢复工具,没有安装任何中间版本,没有用新版本的更新器替代旧版本来执行首次提交。
27
+
28
+ 命令:`node --test tests/direct-246-upgrade.test.mjs`。4 个子场景断言全部通过(Node 汇总计入外层测试共 5 项)。后三个子场景通过是指预期阻断及旧版保留成立,不代表升级成功。
29
+
30
+ ## 边界
31
+
32
+ 本次没有驱动完整 DSH Electron 窗口,也没有验证自动重启、真实用户的全部插件组合、在线更新源可达性、真实解析任务或模型调用。成功场景按原版返回结果执行一次新 Host 启动,不能宣传为完全无操作的激活。已被旧状态阻断的实例仍需独立恢复,详见 [恢复说明](../UPDATE-RECOVERY.md)。
package/package.json CHANGED
@@ -1,6 +1,78 @@
1
- {
2
- "name": "@kingsleyasher/dsh-knowledge-base",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "@kingsleyasher/dsh-knowledge-base",
3
+ "version": "3.1.4",
4
+ "description": "个人知识工作台:可控隐私、首次设置、目录地图、快速收集、阅读摘录、引用问答与按需备份。",
5
+ "icon": "./src/client/capture-icon.svg",
6
+ "type": "module",
7
+ "main": "./src/host/index.js",
8
+ "exports": {
9
+ ".": "./src/host/index.js",
10
+ "./package.json": "./package.json",
11
+ "./client": "./src/client/index.js",
12
+ "./core": "./packages/kb-core/index.js",
13
+ "./contracts": "./packages/kb-contracts/index.js",
14
+ "./service": "./packages/kb-service/index.js"
15
+ },
16
+ "files": [
17
+ "src",
18
+ "cordis.patch.yml",
19
+ "README.md",
20
+ "PARSING-PREVIEW.md",
21
+ "WORKBENCH.md",
22
+ "BETA4.md",
23
+ "browser-extension",
24
+ "presets",
25
+ "skills",
26
+ "tools/kb-pdf-pages.py",
27
+ "tools/kb-local-model.py",
28
+ "tools/kb-transactional-update.py",
29
+ "BETA7.md",
30
+ "BETA8.md",
31
+ "BETA9.md",
32
+ "VERSIONING.md",
33
+ "PROJECT-RECORD.md",
34
+ "RETRIEVAL.md",
35
+ "PERFORMANCE.md",
36
+ "RELEASE.md",
37
+ "RELEASE.en.md",
38
+ "PROJECT-RECORD.en.md",
39
+ "WORKBENCH.en.md",
40
+ "VERSIONING.en.md",
41
+ "EXISTING-FRAMEWORK-OPTIMIZATION.md",
42
+ "packages/kb-core",
43
+ "packages/kb-contracts",
44
+ "packages/kb-service",
45
+ "runtime/python",
46
+ "docs",
47
+ "ARCHITECTURE.md",
48
+ "ARCHITECTURE.en.md",
49
+ "DEVELOPMENT.md",
50
+ "DEVELOPMENT.en.md",
51
+ "MONOREPO.md",
52
+ "PRIVACY.md",
53
+ "SECURITY.md",
54
+ "THIRD-PARTY-NOTICES.md",
55
+ "CONTRIBUTING.md",
56
+ "NPM-EDITION.md"
57
+ ],
58
+ "dsh": {
59
+ "bundle": {
60
+ "patch": [
61
+ "./cordis.patch.yml",
62
+ "./presets/01-knowledge-agent.patch.yml"
63
+ ]
64
+ },
65
+ "client": {
66
+ "inject": [
67
+ "slots"
68
+ ],
69
+ "platform": "web"
70
+ }
71
+ },
72
+ "license": "MIT",
73
+ "repository": {
74
+ "type": "git",
75
+ "url": "git+https://github.com/KingsleyAsher/Personal-Knowledge-Base.git"
76
+ },
77
+ "homepage": "https://github.com/KingsleyAsher/Personal-Knowledge-Base/tree/npm/plugin-3.1.4"
78
+ }
@@ -0,0 +1,29 @@
1
+ const str=(max=4096)=>({type:'string',min:1,max});
2
+ const obj=(properties,required=Object.keys(properties))=>({type:'object',properties,required});
3
+ const integer=(max)=>({type:'integer',min:0,max});
4
+ const optional=(properties)=>obj(properties,[]);
5
+ export const DESKTOP_METHODS=Object.freeze({
6
+ 'desktop.list':{access:'read',args:optional({parent:{type:'string',max:4096},offset:integer(10000),limit:{type:'integer',min:1,max:500}})},
7
+ 'desktop.listSorted':{access:'read',args:optional({parent:{type:'string',max:4096},offset:integer(10000),limit:{type:'integer',min:1,max:500},sort:{type:'string',enum:['name-asc','name-desc','modified-desc','modified-asc']}})},
8
+ 'desktop.stat':{access:'read',args:obj({path:str()})},
9
+ 'desktop.preview':{access:'read',args:obj({path:str()})},
10
+ 'desktop.trashPreview':{access:'read',args:obj({id:str(128),path:{type:'string',max:4096}},['id'])},
11
+ 'desktop.editOriginal':{access:'read',args:obj({path:str(),originalKey:str(128)})},
12
+ 'desktop.fileReplace':{access:'edit',idempotent:true,args:obj({path:str(),expectedRevision:str(128),stageId:str(128)})},
13
+ 'desktop.editStage':{access:'edit',args:obj({name:str(255),data:{type:'string',max:360000},stageId:{type:'string',max:128},final:{type:'boolean'}},['name','data','final'])},
14
+ 'desktop.media':{access:'read',args:obj({handle:str(128),offset:integer(1073741824),length:{type:'integer',min:1,max:262144}})},
15
+ 'desktop.search':{access:'read',args:obj({query:str(4096),mode:{type:'string',enum:['name','fulltext']}})},
16
+ 'desktop.plan':{access:'write',args:obj({operation:{type:'string',enum:['create','mkdir','move','trash','restore','purge','import']},path:{type:'string',max:4096},destination:{type:'string',max:4096},revision:{type:'string',max:128}},['operation'])},
17
+ 'desktop.commit':{access:'write',idempotent:true,args:obj({planId:str(128),text:{type:'string',max:524288}},['planId'])},
18
+ 'desktop.trash':{access:'read',args:obj({})},
19
+ 'desktop.backups':{access:'read',args:obj({})},
20
+ 'desktop.backupCreate':{access:'admin',idempotent:true,args:obj({})},
21
+ 'desktop.backupDelete':{access:'admin',idempotent:true,args:obj({backupId:str(128),expectedDigest:str(64)})},
22
+ 'desktop.restorePreview':{access:'admin',args:obj({backupId:str(128)})},
23
+ 'desktop.restoreCommit':{access:'admin',idempotent:true,args:obj({planId:str(128)})},
24
+ 'desktop.restoreState':{access:'admin',idempotent:true,args:obj({})},
25
+ 'desktop.tasks':{access:'read',args:obj({})},
26
+ 'desktop.importStage':{access:'write',args:obj({name:str(255),data:{type:'string',max:360000},stageId:{type:'string',max:128},final:{type:'boolean'}},['name','data','final'])},
27
+ 'desktop.importPlan':{access:'write',args:obj({stageId:str(128),destination:str()})},
28
+ });
29
+
@@ -0,0 +1,132 @@
1
+ import { DESKTOP_METHODS } from './desktop.js'
2
+ import {TOOL_NAMES} from './tools.js'
3
+ // Shared boundary contract. Host adapters authenticate callers before using these validators.
4
+ export const CONTRACT = Object.freeze({ version: '0.5.0', protocolMajor: 1, protocolMinor: 5, status: 'parity-candidate' })
5
+ export const MAX_FRAME_BYTES = 1024 * 1024
6
+ const text = (max = 512) => ({ type: 'string', min: 1, max })
7
+ const boolean = { type: 'boolean' }
8
+ const revision = { type: 'integer', min: 0 }
9
+ const object = (properties, required = Object.keys(properties)) => ({ type: 'object', properties, required })
10
+ const array = (items, max = 100) => ({ type: 'array', items, max })
11
+ const choice = values => ({ type: 'string', enum: values })
12
+ const optional = (properties, required) => object(properties, required)
13
+ const relative = { ...text(4096), relativePath: true }
14
+ const library = object({ kbId: text(128), instanceId: text(128) })
15
+ const empty = object({})
16
+ const snapshotRef = optional({ kbId: text(128), instanceId: text(128), documentId: text(128), path: relative, revision: text(128), kind: choice(['file','excerpt','annotation']), excerpt:text(65536), annotationId:text(128) }, ['kbId','instanceId','documentId','path','revision'])
17
+ export const HELLO = object({
18
+ protocolMajor: { const: 1 }, protocolMinor: { type: 'integer', min: 0 },
19
+ client: object({ kind: choice(['desktop', 'dsh-adapter']), version: text(64), buildId: text(128) }),
20
+ capabilities: array(text(64), 32),
21
+ })
22
+ export const METHODS = Object.freeze({
23
+ ...DESKTOP_METHODS,
24
+ 'service.health': { access: 'read', args: empty },
25
+ 'service.prepareUpgrade': { access: 'admin', args: empty },
26
+ 'service.shutdown': { access: 'admin', args: empty },
27
+ 'connection.grant': { access: 'admin', args: object({ label: text(128), access: array(choice(['read','edit','write','admin','host','chat','chat-write','approval']), 8), expiresAt: { type: 'integer', min: 1 } }) },
28
+ 'connection.revoke': { access: 'admin', args: object({ grantId: text(128) }) },
29
+ 'migration.preview': { access: 'admin', args: object({ sourceHandles: array(text(128), 20) }) },
30
+ 'migration.commit': { access: 'admin', idempotent: true, args: object({ planId: text(128), quiescent: { const: true } }) },
31
+ 'migration.recover': { access: 'admin', idempotent: true, args: object({ direction: choice(['complete','rollback']) }) },
32
+ 'adapter.dispatch': { access: 'read', args: object({ operation: { type: 'json' } }) },
33
+ 'host.tool': { access: 'host', args: object({ name: choice(TOOL_NAMES), input: { type: 'json' },hostSession:text(128),hostAuthority:choice(['knowledge','workspace']),sourceStage:text(128)},['name','input']) },
34
+ 'workspace.read': {access:'read',args:object({operation:{type:'json'}})},
35
+ 'workspace.write': {access:'admin',idempotent:true,args:object({operation:{type:'json'}})},
36
+ 'providers.get': {access:'read',args:empty},
37
+ 'providers.source': {access:'admin',idempotent:true,args:object({source:choice(['auto','shared','independent']),expectedRevision:revision})},
38
+ 'providers.syncPlugin': {access:'host',idempotent:true,args:object({sourceId:text(256),config:{type:'json'},embeddingApiKey:{type:'string',max:8192},rerankApiKey:{type:'string',max:8192}},['sourceId','config'])},
39
+ 'host.bridge': {access:'host',args:object({action:choice(['register','poll','result','event','memory-changed','leave']),hostInstanceId:text(128),label:text(256),workspaceId:text(128),workspacePath:text(8192),capabilities:array(text(64),32),taskId:text(128),token:text(128),result:{type:'json'},error:{type:'json'},sessionId:text(128),data:{type:'json'},revision:text(128)},['action','hostInstanceId'])},
40
+ 'dsh.status': {access:'read',args:empty},
41
+ 'library.snapshot': { access: 'read', args: empty },
42
+ 'library.tree': { access: 'read', args: optional({ prefix: { type: 'string', max: 4096 }, limit: { type: 'integer', min: 1, max: 500 } }, []) },
43
+ 'document.read': { access: 'read', args: object({ path: relative }) },
44
+ 'document.readForEdit': { access: 'edit', args: object({ path: relative }) },
45
+ 'document.create': { access: 'write', idempotent: true, args: object({ path: relative, expectedAbsent: { const: true }, text: { type: 'string', max: 1048576 } }) },
46
+ 'document.save': { access: 'write', idempotent: true, args: object({ path: relative, expectedRevision: text(128), text: { type: 'string', max: 1048576 } }) },
47
+ 'document.move': { access: 'write', idempotent: true, args: object({ path: relative, destination: relative, expectedRevision: text(128), planId: text(128) }) },
48
+ 'document.trash': { access: 'write', idempotent: true, args: object({ path: relative, expectedRevision: text(128) }) },
49
+ 'state.patch': { access: 'write', idempotent: true, args: object({ expectedRevision: revision, domain: choice(['reading', 'annotations', 'links', 'reviews']), patch: array(object({ op: choice(['put', 'remove']), key: text(4096), value: { type: 'json' } }, ['op', 'key']), 100) }) },
50
+ 'search.query': { access: 'read', args: object({ query: text(4096), limit: { type: 'integer', min: 1, max: 100 } }) },
51
+ 'relations.query': { access: 'read', args: optional({ path: relative, limit: { type: 'integer', min: 1, max: 500 } }, []) },
52
+ 'inbox.list': { access: 'read', args: optional({ offset: revision, limit: { type: 'integer', min: 1, max: 500 } }, []) },
53
+ 'inbox.organize': { access: 'write', idempotent: true, args: empty },
54
+ 'inbox.organizeResolve': {access:'admin',idempotent:true,args:object({taskId:text(128),state:choice(['launched','failed']),sessionId:{type:'string',max:128},confirm:{const:true}},['taskId','state','confirm'])},
55
+ 'inbox.organizeStatus': { access: 'read', args: empty },
56
+ 'inbox.organizeBridge': { access: 'host', args: object({action:choice(['heartbeat','claim','report','leave']),clientId:text(80),execution:{type:'json'},taskId:text(128),token:text(128),state:choice(['launched','failed','unknown']),sessionId:{type:'string',max:128},message:{type:'string',max:600}},['action','clientId']) },
57
+ 'inbox.import': { access: 'write', idempotent: true, args: object({ sourceHandle: text(128) }) },
58
+ 'policy.get': { access: 'read', args: empty },
59
+ 'policy.setIndexExcluded': { access: 'admin', idempotent: true, args: object({ paths: array(relative,500), excluded: boolean, expectedRevision: revision }) },
60
+ 'task.get': { access: 'read', args: object({ taskId: text(128) }) },
61
+ 'task.cancel': { access: 'write', idempotent: true, args: object({ taskId: text(128) }) },
62
+ 'backup.create': { access: 'admin', idempotent: true, args: object({ destinationHandle: text(128) }) },
63
+ 'backup.restorePreview': { access: 'admin', args: object({ backupId: text(128), destinationHandle: text(128) }) },
64
+ 'backup.restoreCommit': { access: 'admin', idempotent: true, args: object({ planId: text(128), expectedRevision: revision }) },
65
+ 'events.subscribe': { access: 'read', args: optional({ bootId: text(128), afterSeq: revision }, []) },
66
+ 'operation.status': { access: 'read', args: object({ requestId: text(128) }) },
67
+ 'dsh.sessions': { access: 'chat', args: optional({ hostInstanceId: text(128), workspaceId: text(128), cursor: text(1024) }, ['hostInstanceId', 'workspaceId']) },
68
+ 'dsh.createSession': { access: 'chat-write', idempotent: true, args: object({ hostInstanceId: text(128), workspaceId: text(128), preset: text(128) }) },
69
+ 'dsh.history': { access: 'chat', args: optional({ hostInstanceId: text(128), sessionId: text(128), beforeSeq: revision, throughSeq: {type:'integer',min:-1}, limit: { type: 'integer', min: 1, max: 100 } }, ['hostInstanceId', 'sessionId', 'limit']) },
70
+ 'dsh.modelCatalog': { access: 'chat', args: object({ hostInstanceId: text(128), sessionId: text(128) }) },
71
+ 'dsh.selectModel': { access: 'chat-write', idempotent: true, args: optional({ hostInstanceId: text(128), sessionId: text(128), provider: text(256), model: text(256), reasoningEffort: text(64) }, ['hostInstanceId', 'sessionId', 'provider', 'model']) },
72
+ 'dsh.capabilities': {access:'chat',args:object({hostInstanceId:text(128),sessionId:text(128)})},
73
+ 'dsh.presets': {access:'chat',args:object({hostInstanceId:text(128)})},
74
+ 'dsh.selectPreset': {access:'chat-write',idempotent:true,args:object({hostInstanceId:text(128),sessionId:text(128),preset:text(128)})},
75
+ 'dsh.interactions': {access:'chat',args:object({hostInstanceId:text(128),sessionId:text(128)})},
76
+ 'dsh.follow': { access: 'chat', args: object({ hostInstanceId: text(128), sessionId: text(128) }) },
77
+ 'dsh.prompt': { access: 'chat-write', idempotent: true, args: object({ hostInstanceId: text(128), sessionId: text(128), text: { type: 'string', max: 262144 }, references: array(snapshotRef, 20) }) },
78
+ 'dsh.cancel': { access: 'chat-write', idempotent: true, args: object({ hostInstanceId: text(128), sessionId: text(128) }) },
79
+ 'dsh.answerInteraction': { access: 'approval', idempotent: true, args: object({ hostInstanceId: text(128), sessionId: text(128), eventId: text(128), interactionRevision: text(128), answer: { type: 'json' } }) },
80
+ })
81
+ export const ERRORS = Object.freeze(['BAD_REQUEST','UNAUTHORIZED','FORBIDDEN','PROTOCOL_UNSUPPORTED','CAPABILITY_UNSUPPORTED','BINDING_CHANGED','POLICY_CHANGED','CONFLICT','NOT_FOUND','READ_ONLY','STATE_BUSY','RECOVERY_REQUIRED','IDEMPOTENCY_MISMATCH','RESULT_UNKNOWN','RESYNC_REQUIRED','HOST_UNAVAILABLE','INTERACTION_EXPIRED','SERVICE_UPGRADE_REQUIRED','API_AUTH','API_TIMEOUT','API_NETWORK','API_VECTOR','API_LIMIT','API_CONFIG','API_REQUEST','API_TEMPORARY','SEARCH_BUSY','SETTINGS_CHANGED'])
82
+ export function validate(schema, value, location = '$') {
83
+ const error = message => { throw Object.assign(new Error(location + ': ' + message), { code: 'BAD_REQUEST' }) }
84
+ if ('const' in schema) { if (value !== schema.const) error('constant mismatch'); return }
85
+ if (schema.type === 'json') { if (value === undefined || !isJson(value)) error('JSON value required'); return }
86
+ if (schema.type === 'object') {
87
+ if (!value || typeof value !== 'object' || Array.isArray(value) || Object.getPrototypeOf(value) !== Object.prototype) error('plain object required')
88
+ for (const key of Object.keys(value)) if (!Object.hasOwn(schema.properties, key)) error('unknown field ' + key)
89
+ for (const key of schema.required) if (!Object.hasOwn(value, key)) error('missing ' + key)
90
+ for (const [key, child] of Object.entries(value)) validate(schema.properties[key], child, location + '.' + key)
91
+ } else if (schema.type === 'array') {
92
+ if (!Array.isArray(value) || value.length > schema.max) error('bounded array required')
93
+ value.forEach((child, index) => validate(schema.items, child, location + '[' + index + ']'))
94
+ } else if (schema.type === 'integer') {
95
+ if (!Number.isSafeInteger(value) || value < (schema.min ?? 0) || value > (schema.max ?? Number.MAX_SAFE_INTEGER)) error('integer out of bounds')
96
+ } else if (schema.type === 'boolean') {
97
+ if (typeof value !== 'boolean') error('boolean required')
98
+ } else {
99
+ if (typeof value !== 'string' || value.length < (schema.min ?? 0) || value.length > (schema.max ?? 4096)) error('bounded string required')
100
+ if (schema.enum && !schema.enum.includes(value)) error('unknown enum')
101
+ if (schema.relativePath && (value.includes('\\') || value.includes(':') || value.startsWith('/') || value.split('/').some(part => !part || part === '.' || part === '..' || /[. ]$/.test(part)) || /[\u0000-\u001f]/.test(value))) error('invalid library-relative path')
102
+ }
103
+ }
104
+ function isJson(value, depth = 0) {
105
+ if (depth > 32) return false
106
+ if (value === null || typeof value === 'string' || typeof value === 'boolean') return true
107
+ if (typeof value === 'number') return Number.isFinite(value)
108
+ if (Array.isArray(value)) return value.length <= 1000 && value.every(child => isJson(child, depth + 1))
109
+ return value && Object.getPrototypeOf(value) === Object.prototype && Object.keys(value).length <= 256 && Object.keys(value).every(k => !['__proto__', 'constructor', 'prototype'].includes(k) && isJson(value[k], depth + 1))
110
+ }
111
+ export function validateCall(call) {
112
+ if (!isJson(call) || new TextEncoder().encode(JSON.stringify(call)).byteLength > MAX_FRAME_BYTES) throw Object.assign(new Error('bounded JSON frame required'), { code: 'BAD_REQUEST' })
113
+ validate(object({ protocolMajor: { const: 1 }, requestId: text(128), library, policyVersion: text(128), method: choice(Object.keys(METHODS)), args: { type: 'json' } }), call)
114
+ validate(METHODS[call.method].args, call.args, '$.args')
115
+ if (call.method === 'events.subscribe' && Boolean(call.args.bootId) !== Object.hasOwn(call.args, 'afterSeq')) throw Object.assign(new Error('bootId and afterSeq must be supplied together'), { code: 'BAD_REQUEST' })
116
+ if (call.method === 'state.patch' && call.args.patch.some(row => row.op === 'put' ? !Object.hasOwn(row, 'value') : Object.hasOwn(row, 'value'))) throw Object.assign(new Error('put requires value; remove forbids value'), { code: 'BAD_REQUEST' })
117
+ return METHODS[call.method]
118
+ }
119
+ export function authorize(call, grant, supported = Object.keys(METHODS)) {
120
+ const definition = validateCall(call)
121
+ if (!supported.includes(call.method)) throw Object.assign(new Error('capability unavailable'), { code: 'CAPABILITY_UNSUPPORTED' })
122
+ if (!grant || grant.revoked || !grant.access.includes(definition.access)) throw Object.assign(new Error('connection grant does not allow operation'), { code: 'FORBIDDEN' })
123
+ if (grant.kbId !== call.library.kbId || grant.instanceId !== call.library.instanceId) throw Object.assign(new Error('library instance changed'), { code: 'BINDING_CHANGED' })
124
+ if (grant.policyVersion !== call.policyVersion) throw Object.assign(new Error('policy changed'), { code: 'POLICY_CHANGED' })
125
+ if (call.method.startsWith('dsh.') && call.args.workspaceId && !grant.workspaces.includes(call.args.workspaceId)) throw Object.assign(new Error('workspace outside grant'), { code: 'FORBIDDEN' })
126
+ if (call.method.startsWith('dsh.') && (grant.hostInstanceId !== call.args.hostInstanceId || call.args.sessionId && !grant.sessions.includes(call.args.sessionId))) throw Object.assign(new Error('session outside grant'), { code: 'FORBIDDEN' })
127
+ return true
128
+ }
129
+ export function canonicalCall(call) {
130
+ const stable = value => Array.isArray(value) ? value.map(stable) : value && typeof value === 'object' ? Object.fromEntries(Object.keys(value).sort().map(key => [key, stable(value[key])])) : value
131
+ return JSON.stringify(stable({ method: call.method, library: call.library, policyVersion: call.policyVersion, args: call.args }))
132
+ }
@@ -0,0 +1,3 @@
1
+ import { createHash } from 'node:crypto'
2
+ import { canonicalCall } from './index.js'
3
+ export const fingerprint = call => createHash('sha256').update(canonicalCall(call)).digest('hex')
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "@local/kb-contracts",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "main": "./index.js",
7
+ "files": [
8
+ "index.js",
9
+ "schema.js",
10
+ "node.js"
11
+ ],
12
+ "exports": {
13
+ ".": "./index.js",
14
+ "./schema": "./schema.js",
15
+ "./node": "./node.js"
16
+ }
17
+ }
@@ -0,0 +1,42 @@
1
+ import { CONTRACT, HELLO, METHODS, ERRORS, MAX_FRAME_BYTES } from './index.js'
2
+ function convert(s) {
3
+ if ('const' in s) return { const: s.const }
4
+ if (s.type === 'json') return {}
5
+ if (s.type === 'object') return { type: 'object', additionalProperties: false, properties: Object.fromEntries(Object.entries(s.properties).map(([key, value]) => [key, convert(value)])), required: s.required }
6
+ if (s.type === 'array') return { type: 'array', items: convert(s.items), maxItems: s.max }
7
+ if (s.type === 'integer') return { type: 'integer', minimum: s.min ?? 0, ...(s.max === undefined ? {} : { maximum: s.max }) }
8
+ if (s.type === 'boolean') return { type: 'boolean' }
9
+ return { type: 'string', ...(s.min === undefined ? {} : { minLength: s.min }), ...(s.max === undefined ? {} : { maxLength: s.max }), ...(s.enum ? { enum: s.enum } : {}), ...(s.relativePath ? { description: 'Unescaped library-relative path. Service must also reject traversal, aliases, symlinks and out-of-root resolutions.' } : {}) }
10
+ }
11
+ const nonempty = { type: 'string', minLength: 1, maxLength: 128 }
12
+ const library = { type: 'object', additionalProperties: false, properties: { kbId: nonempty, instanceId: nonempty }, required: ['kbId', 'instanceId'] }
13
+ export const wireSchema = {
14
+ $schema: 'https://json-schema.org/draft/2020-12/schema',
15
+ $id: 'urn:kb-desktop:phase2:protocol:0.2.0',
16
+ $ref: '#/$defs/call',
17
+ title: 'Knowledge base shared service protocol phase two',
18
+ description: 'Candidate wire contract. Capability discovery determines implemented methods; credentials and caller authority are never accepted as call arguments.',
19
+ 'x-contract': CONTRACT, 'x-maxFrameBytes': MAX_FRAME_BYTES,
20
+ $defs: {
21
+ hello: convert(HELLO),
22
+ helloFrame: { type:'object',additionalProperties:false,properties:{type:{const:'hello'},hello:convert(HELLO),grantId:nonempty,clientNonce:{type:'string',pattern:'^[a-f0-9]{64}$'}},required:['type','hello','grantId','clientNonce'] },
23
+ challenge: { type:'object',additionalProperties:false,properties:{type:{const:'challenge'},proof:{type:'string',pattern:'^[a-f0-9]{64}$'},transcript:{type:'object',additionalProperties:false,properties:{grantId:nonempty,clientNonce:nonempty,serverNonce:nonempty,bootId:nonempty,library,protocolMajor:{const:1}},required:['grantId','clientNonce','serverNonce','bootId','library','protocolMajor']}},required:['type','proof','transcript'] },
24
+ authenticate: { type:'object',additionalProperties:false,properties:{type:{const:'authenticate'},proof:{type:'string',pattern:'^[a-f0-9]{64}$'}},required:['type','proof'] },
25
+ welcome: { type: 'object', additionalProperties: false, properties: { type:{const:'welcome'},policyVersion:nonempty,protocolMajor: { const: 1 }, protocolMinor: { type: 'integer', minimum: 0 }, bootId: nonempty, serviceBuildId: nonempty, library,
26
+ storageSchemas: { type: 'object', additionalProperties: false, properties: { kbMeta: { const: 1 }, sharedState: { const: 1 } }, required: ['kbMeta', 'sharedState'] },
27
+ capabilities: { type: 'array', maxItems: 128, items: { type: 'string', maxLength: 64 } } }, required: ['type','policyVersion','protocolMajor', 'protocolMinor', 'bootId', 'serviceBuildId', 'library', 'storageSchemas', 'capabilities'] },
28
+ call: { oneOf: Object.entries(METHODS).map(([method, definition]) => ({
29
+ type: 'object', additionalProperties: false,
30
+ properties: { protocolMajor: { const: 1 }, requestId: nonempty, library, policyVersion: nonempty, method: { const: method }, args: convert(definition.args) },
31
+ required: ['protocolMajor', 'requestId', 'library', 'policyVersion', 'method', 'args'],
32
+ 'x-requiredAccess': definition.access, 'x-durableIdempotencyRequired': Boolean(definition.idempotent),
33
+ })) },
34
+ reply: { oneOf: [
35
+ { type: 'object', additionalProperties: false, properties: { requestId: nonempty, ok: { const: true }, value: {}, bootId: nonempty,policyVersion:nonempty }, required: ['requestId', 'ok', 'value', 'bootId','policyVersion'] },
36
+ { type: 'object', additionalProperties: false, properties: { requestId: nonempty, ok: { const: false }, bootId: nonempty,policyVersion:nonempty,
37
+ error: { type: 'object', additionalProperties: false, properties: { code: { enum: ERRORS }, message: { type: 'string', maxLength: 1024 }, retryable: { type: 'boolean' }, operationState: { enum: ['not-started', 'committed', 'pending', 'unknown'] } }, required: ['code', 'message', 'retryable', 'operationState'] } }, required: ['requestId', 'ok', 'bootId', 'error','policyVersion'] },
38
+ ] },
39
+ event: { type: 'object', additionalProperties: false, properties: { protocolMajor: { const: 1 }, bootId: nonempty, library, seq: { type: 'integer', minimum: 1 }, policyVersion: nonempty,
40
+ type: { const:'event' },event:{enum:['snapshot.required','dsh.event']}, data: {type:'object'} }, required: ['protocolMajor', 'bootId', 'library', 'seq', 'policyVersion', 'type','event', 'data'] },
41
+ },
42
+ }
@@ -0,0 +1 @@
1
+ export const TOOL_NAMES=Object.freeze(['kb_inbox','kb_question_search','kb_question_read','kb_relation_review','kb_deliverable','kb_validate_citations','kb_status','kb_bind','kb_init','kb_record','kb_search','kb_check','kb_import','kb_flow','kb_flow_resolve','kb_parse']);
@@ -0,0 +1,45 @@
1
+ // Published versions use MAJOR.MINOR.PATCH or MAJOR.MINOR-betaN.
2
+ // The old MAJOR.MINOR.PATCH-betaN form is accepted only while migrating
3
+ // already installed builds and the historical preview feed.
4
+ const part = '(0|[1-9]\\d*)'
5
+ const stablePattern = new RegExp(`^${part}\\.${part}\\.${part}$`)
6
+ const previewPattern = new RegExp(`^${part}\\.${part}-beta([1-9]\\d*)$`)
7
+ const legacyPreviewPattern = new RegExp(`^${part}\\.${part}\\.${part}-beta([1-9]\\d*)$`)
8
+
9
+ export function parseKnowledgeVersion(value, { allowLegacyPreview = false } = {}) {
10
+ if (typeof value !== 'string' || value.length > 80) return null
11
+ let match = stablePattern.exec(value)
12
+ if (match) return { version: value, major: BigInt(match[1]), minor: BigInt(match[2]), patch: BigInt(match[3]), channel: 'stable', legacy: false }
13
+ match = previewPattern.exec(value)
14
+ if (match) return { version: value, major: BigInt(match[1]), minor: BigInt(match[2]), beta: BigInt(match[3]), channel: 'preview', legacy: false }
15
+ if (!allowLegacyPreview) return null
16
+ match = legacyPreviewPattern.exec(value)
17
+ if (!match) return null
18
+ return { version: value, major: BigInt(match[1]), minor: BigInt(match[2]), beta: BigInt(match[4]), channel: 'preview', legacy: true }
19
+ }
20
+
21
+ export function compareKnowledgeVersions(a, b) {
22
+ const left = parseKnowledgeVersion(a, { allowLegacyPreview: true })
23
+ const right = parseKnowledgeVersion(b, { allowLegacyPreview: true })
24
+ if (!left || !right) throw Error('版本号格式无效')
25
+ for (const key of ['major', 'minor']) if (left[key] !== right[key]) return left[key] > right[key] ? 1 : -1
26
+ if (left.channel !== right.channel) return left.channel === 'stable' ? 1 : -1
27
+ const key = left.channel === 'stable' ? 'patch' : 'beta'
28
+ if (left[key] !== right[key]) return left[key] > right[key] ? 1 : -1
29
+ if (left.channel === 'preview' && left.legacy !== right.legacy) return left.legacy ? -1 : 1
30
+ return 0
31
+ }
32
+
33
+ // Both products use the same eligibility rule; executors enforce safe installation.
34
+ export const UPDATE_POLICY = Object.freeze({ mode: 'automatic', stableFormat: 'x.y.z', previewFormat: 'x.y-betaN', automaticMajor: true, automaticPreview: true, automaticChannelSwitch: false, verifyPayload: true })
35
+ export function updateDecision(current, next) {
36
+ const installed=parseKnowledgeVersion(current,{allowLegacyPreview:true}),candidate=parseKnowledgeVersion(next)
37
+ if(!installed||!candidate)throw Error('版本号格式无效')
38
+ const available=compareKnowledgeVersions(next,current)>0
39
+ return {available,automatic:available,requiresManualUpdate:false,channel:candidate.channel}
40
+ }
41
+ export function packageVersion(version) {
42
+ const v=parseKnowledgeVersion(version)
43
+ if(!v)throw Error('发布版本必须为 x.y.z 或 x.y-betaN')
44
+ return v.channel==='stable'?version:`${v.major}.${v.minor}.0-beta.${v.beta}`
45
+ }
@@ -0,0 +1,9 @@
1
+ export { VERSION, SCHEMA_VERSION, createCore } from './src/kbcore.js'
2
+ export { createWorkbench } from './src/workbench.js'
3
+ export { createLibraryState } from './src/library-state.js'
4
+ export { createDocumentService } from './src/documents.js'
5
+ export { createEmbeddedKernel } from './src/embedded.js'
6
+ export { createParsingService } from './src/parsing.js'
7
+ export { createImportService } from './src/import-service.js'
8
+ export { createFlowEngine } from './src/flows.js'
9
+ export { createIndexMaintenance } from './src/index-maintenance.js'
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@local/kb-core",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "main": "./index.js",
7
+ "files": [
8
+ "index.js",
9
+ "src"
10
+ ],
11
+ "exports": {
12
+ ".": "./index.js",
13
+ "./*": "./src/*.js"
14
+ }
15
+ }
@@ -0,0 +1,22 @@
1
+ export async function sharedDraft(req) {
2
+ if (req.method === 'GET') {
3
+ const url = new URL(req.url, 'http://localhost')
4
+ return { title: String(url.searchParams.get('title') || '').slice(0, 200), text: String(url.searchParams.get('text') || '').slice(0, 1048576), url: String(url.searchParams.get('url') || '').slice(0, 8192), files: [] }
5
+ }
6
+ if (req.method !== 'POST') throw Error('只支持打开页面或分享资料')
7
+ const chunks = []; let bytes = 0
8
+ for await (const part of req) { bytes += part.length; if (bytes > 12 * 1024 * 1024) throw Error('分享内容超过 12 MiB'); chunks.push(part) }
9
+ const form = await new Request('http://localhost/share', { method: 'POST', headers: { 'content-type': req.headers['content-type'] || '' }, body: Buffer.concat(chunks) }).formData()
10
+ const draft = { title: String(form.get('title') || '').slice(0, 200), text: String(form.get('text') || '').slice(0, 1048576), url: String(form.get('url') || '').slice(0, 8192), files: [] }
11
+ for (const file of form.getAll('files')) {
12
+ if (typeof file.arrayBuffer !== 'function') continue
13
+ if (file.size > 8 * 1024 * 1024) throw Error('单个文件超过 8 MiB')
14
+ draft.files.push({ filename: file.name, base64: Buffer.from(await file.arrayBuffer()).toString('base64') })
15
+ }
16
+ return draft
17
+ }
18
+
19
+ export function captureDocument(template, draft) {
20
+ const data = JSON.stringify(draft).replaceAll('<', '\\u003c').replaceAll('>', '\\u003e').replaceAll('&', '\\u0026')
21
+ return template.replace('__KB_CAPTURE_DRAFT__', data)
22
+ }