dsh-daoing-memory 0.1.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 (80) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +91 -0
  3. package/README.zh-CN.md +91 -0
  4. package/cordis.patch.yml +22 -0
  5. package/lib/client.js +10339 -0
  6. package/lib/client.js.map +1 -0
  7. package/lib/index.js +3138 -0
  8. package/lib/invariant.js +33 -0
  9. package/lib/tools.js +1472 -0
  10. package/lib/typert.host.d.ts +3 -0
  11. package/lib/typert.host.js +4058 -0
  12. package/lib/typert.remote-client.d.ts +149 -0
  13. package/lib/typert.remote-client.d.ts.map +1 -0
  14. package/lib/typert.remote-client.js +3167 -0
  15. package/lib/types/client/ExperiencePage.d.ts +15 -0
  16. package/lib/types/client/ExperiencePage.d.ts.map +1 -0
  17. package/lib/types/client/ExperiencePage.js +117 -0
  18. package/lib/types/client/ExperiencePage.js.map +1 -0
  19. package/lib/types/client/FactDiaryPage.d.ts +17 -0
  20. package/lib/types/client/FactDiaryPage.d.ts.map +1 -0
  21. package/lib/types/client/FactDiaryPage.js +155 -0
  22. package/lib/types/client/FactDiaryPage.js.map +1 -0
  23. package/lib/types/client/HumanOpsPage.d.ts +16 -0
  24. package/lib/types/client/HumanOpsPage.d.ts.map +1 -0
  25. package/lib/types/client/HumanOpsPage.js +208 -0
  26. package/lib/types/client/HumanOpsPage.js.map +1 -0
  27. package/lib/types/client/LedgerPage.d.ts +13 -0
  28. package/lib/types/client/LedgerPage.d.ts.map +1 -0
  29. package/lib/types/client/LedgerPage.js +113 -0
  30. package/lib/types/client/LedgerPage.js.map +1 -0
  31. package/lib/types/client/MemoryNavSection.d.ts +20 -0
  32. package/lib/types/client/MemoryNavSection.d.ts.map +1 -0
  33. package/lib/types/client/MemoryNavSection.js +23 -0
  34. package/lib/types/client/MemoryNavSection.js.map +1 -0
  35. package/lib/types/client/Workbench.d.ts +23 -0
  36. package/lib/types/client/Workbench.d.ts.map +1 -0
  37. package/lib/types/client/Workbench.js +140 -0
  38. package/lib/types/client/Workbench.js.map +1 -0
  39. package/lib/types/client/actions.d.ts +165 -0
  40. package/lib/types/client/actions.d.ts.map +1 -0
  41. package/lib/types/client/actions.js +51 -0
  42. package/lib/types/client/actions.js.map +1 -0
  43. package/lib/types/client/index.d.ts +24 -0
  44. package/lib/types/client/index.d.ts.map +1 -0
  45. package/lib/types/client/index.js +103 -0
  46. package/lib/types/client/index.js.map +1 -0
  47. package/lib/types/client/navStore.d.ts +45 -0
  48. package/lib/types/client/navStore.d.ts.map +1 -0
  49. package/lib/types/client/navStore.js +36 -0
  50. package/lib/types/client/navStore.js.map +1 -0
  51. package/lib/types/core.d.ts +195 -0
  52. package/lib/types/core.d.ts.map +1 -0
  53. package/lib/types/core.js +1304 -0
  54. package/lib/types/core.js.map +1 -0
  55. package/lib/types/index.d.ts +71 -0
  56. package/lib/types/index.d.ts.map +1 -0
  57. package/lib/types/index.js +97 -0
  58. package/lib/types/index.js.map +1 -0
  59. package/lib/types/invariant.d.ts +21 -0
  60. package/lib/types/invariant.d.ts.map +1 -0
  61. package/lib/types/invariant.js +33 -0
  62. package/lib/types/invariant.js.map +1 -0
  63. package/lib/types/service.d.ts +130 -0
  64. package/lib/types/service.d.ts.map +1 -0
  65. package/lib/types/service.js +417 -0
  66. package/lib/types/service.js.map +1 -0
  67. package/lib/types/store.d.ts +244 -0
  68. package/lib/types/store.d.ts.map +1 -0
  69. package/lib/types/store.js +864 -0
  70. package/lib/types/store.js.map +1 -0
  71. package/lib/types/tools.d.ts +25 -0
  72. package/lib/types/tools.d.ts.map +1 -0
  73. package/lib/types/tools.js +1144 -0
  74. package/lib/types/tools.js.map +1 -0
  75. package/lib/types/types.d.ts +836 -0
  76. package/lib/types/types.d.ts.map +1 -0
  77. package/lib/types/types.js +8 -0
  78. package/lib/types/types.js.map +1 -0
  79. package/package.json +106 -0
  80. package/skill/memory-extraction.md +62 -0
@@ -0,0 +1,33 @@
1
+ //#region lib/types/invariant.js
2
+ /**
3
+ * Package-owned memory invariants. Asserts the append-only ledger's owned
4
+ * relationship — every block's hash chains to its predecessor, recomputed
5
+ * from the block content — against the durable store at companion attach
6
+ * time. Ledger appends happen in-process through MemoryCore, which chains
7
+ * each new block to the live head, so a broken chain at attach time means
8
+ * the persisted file was corrupted or tampered with externally.
9
+ * @module dsh-daoing-memory/invariant
10
+ */
11
+ const PACKAGE_NAME = "dsh-daoing-memory";
12
+ /** Cordis companion plugin name. */
13
+ const name = "memory-invariant";
14
+ /** Service required before the companion can reserve package ownership. */
15
+ const inject = ["invariants"];
16
+ /** Verify the ledger hash chain end to end against the live store. */
17
+ const install = Object.assign((ctx, fail) => {
18
+ const memory = ctx.get("memory");
19
+ if (memory === void 0) {
20
+ fail("memory invariant: the memory service is not provided");
21
+ return;
22
+ }
23
+ const result = memory.verifyLedgerIntegrity();
24
+ if (!result.ok) fail(`memory ledger hash chain broken at seq ${String(result.brokenAt ?? 0)} (checked ${String(result.checked)} blocks)`);
25
+ }, { inject: ["memory"] });
26
+ /**
27
+ * Register the memory invariant companion.
28
+ * @param ctx - Cordis context carrying the invariant service.
29
+ * @returns the installed registration's disposer after setup succeeds.
30
+ */
31
+ const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
32
+ //#endregion
33
+ export { apply, inject, name };