@remnic/core 9.26.0 → 9.27.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 (145) hide show
  1. package/dist/access-admin-ops-surface.d.ts +5 -5
  2. package/dist/access-admin-ops-surface.js +7 -7
  3. package/dist/access-authorization-probe.d.ts +5 -5
  4. package/dist/access-authorization-probe.js +8 -8
  5. package/dist/access-boundary.d.ts +5 -5
  6. package/dist/access-boundary.js +7 -7
  7. package/dist/access-cli.js +27 -27
  8. package/dist/access-http-lcm-compaction.d.ts +5 -5
  9. package/dist/access-http.d.ts +5 -5
  10. package/dist/access-http.js +12 -12
  11. package/dist/access-identity-continuity-surface.d.ts +4 -4
  12. package/dist/access-identity-continuity-surface.js +7 -7
  13. package/dist/access-lcm-surface.d.ts +5 -5
  14. package/dist/access-lcm-surface.js +7 -7
  15. package/dist/access-mcp.d.ts +5 -5
  16. package/dist/access-mcp.js +10 -10
  17. package/dist/access-namespace-preflight.js +7 -7
  18. package/dist/access-observe-write-surface.d.ts +5 -5
  19. package/dist/access-observe-write-surface.js +7 -7
  20. package/dist/access-operations-batch.js +8 -8
  21. package/dist/access-operations.d.ts +5 -5
  22. package/dist/access-operations.js +9 -9
  23. package/dist/access-recall-concurrency.d.ts +5 -5
  24. package/dist/access-recall-concurrency.js +7 -7
  25. package/dist/access-recall-response.d.ts +5 -5
  26. package/dist/access-recall-response.js +7 -7
  27. package/dist/access-recall-surface.d.ts +5 -5
  28. package/dist/access-recall-surface.js +7 -7
  29. package/dist/{access-service-DL8FJnTj.d.ts → access-service-B4-Fu9x2.d.ts} +3 -3
  30. package/dist/access-service.d.ts +5 -5
  31. package/dist/access-service.js +7 -7
  32. package/dist/access-surface-catalog.d.ts +5 -5
  33. package/dist/access-wearables-meetings-surface.d.ts +2 -2
  34. package/dist/bootstrap.d.ts +4 -4
  35. package/dist/briefing.d.ts +1 -1
  36. package/dist/briefing.js +2 -2
  37. package/dist/buffer.d.ts +1 -1
  38. package/dist/causal-consolidation.js +3 -3
  39. package/dist/{chunk-E6EAB4J6.js → chunk-2RAC4JIG.js} +6 -6
  40. package/dist/{chunk-HBVOJNV4.js → chunk-4MJZTF42.js} +2 -2
  41. package/dist/{chunk-WMDRLTNA.js → chunk-5BRT4Z2I.js} +2 -2
  42. package/dist/{chunk-SN3ZESWQ.js → chunk-BHLN7L7M.js} +3 -3
  43. package/dist/{chunk-7XXCIO6X.js → chunk-BNGPHGVZ.js} +2 -2
  44. package/dist/{chunk-IHMXPG4P.js → chunk-CI26JDZA.js} +2 -2
  45. package/dist/{chunk-UZK7VVPD.js → chunk-CIQXI47W.js} +671 -9
  46. package/dist/chunk-CIQXI47W.js.map +1 -0
  47. package/dist/{chunk-LIIQPDFN.js → chunk-EOLC6EXV.js} +2 -2
  48. package/dist/{chunk-MIFF37NN.js → chunk-EUSLKI4X.js} +2 -2
  49. package/dist/{chunk-PQPSZICJ.js → chunk-EYJSW2RV.js} +2 -2
  50. package/dist/{chunk-Y6E37WRG.js → chunk-FRVTCCGD.js} +2 -2
  51. package/dist/{chunk-4KKV7W62.js → chunk-HEXSNYJD.js} +3 -3
  52. package/dist/{chunk-YN4AUGNF.js → chunk-HORJVJ6K.js} +13 -13
  53. package/dist/{chunk-NKDVXEFU.js → chunk-JDOJZTFF.js} +2 -2
  54. package/dist/{chunk-EXM2Q555.js → chunk-MEBQFQ26.js} +2 -2
  55. package/dist/{chunk-F6LSNPPB.js → chunk-MG6MNSP4.js} +5 -5
  56. package/dist/{chunk-2XP3PWL3.js → chunk-NUWMZIYZ.js} +5 -5
  57. package/dist/{chunk-PX7VDW7R.js → chunk-RGJBM7Z3.js} +15 -15
  58. package/dist/{chunk-ZHP4SUPB.js → chunk-RNY3BO35.js} +2 -2
  59. package/dist/{chunk-XAAIUXJO.js → chunk-RPA2RX5P.js} +2 -2
  60. package/dist/{chunk-67DSDRUB.js → chunk-RSYJV25N.js} +5 -5
  61. package/dist/{chunk-M2KGXXTL.js → chunk-U3TH5Q2Q.js} +2 -2
  62. package/dist/{chunk-VGEH3STZ.js → chunk-UT3OQPFA.js} +2 -2
  63. package/dist/{chunk-H2PBM562.js → chunk-WEAO45M4.js} +2 -2
  64. package/dist/{chunk-KPWLZBXZ.js → chunk-XKO7BM2C.js} +2 -2
  65. package/dist/{chunk-FE5FKTCI.js → chunk-XQ4EH6DI.js} +2 -2
  66. package/dist/{chunk-XNUBF6RF.js → chunk-YSGBD3QN.js} +2 -2
  67. package/dist/{cli-BoouX6LX.d.ts → cli-Bz7X7dGx.d.ts} +3 -3
  68. package/dist/cli.d.ts +6 -6
  69. package/dist/cli.js +21 -21
  70. package/dist/compounding/engine.d.ts +1 -1
  71. package/dist/compounding/engine.js +2 -2
  72. package/dist/connectors/codex-materialize-runner.js +2 -2
  73. package/dist/connectors/index.js +2 -2
  74. package/dist/consolidation-provenance-check.d.ts +1 -1
  75. package/dist/consolidation-undo.d.ts +1 -1
  76. package/dist/contradiction/index.d.ts +1 -1
  77. package/dist/corpus-watermark.js +4 -4
  78. package/dist/entity-retrieval.d.ts +1 -1
  79. package/dist/entity-retrieval.js +2 -2
  80. package/dist/explicit-capture.d.ts +4 -4
  81. package/dist/index.d.ts +10 -10
  82. package/dist/index.js +27 -27
  83. package/dist/maintenance/memory-governance.js +2 -2
  84. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +1 -1
  85. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +2 -2
  86. package/dist/maintenance/rebuild-memory-projection.d.ts +1 -1
  87. package/dist/maintenance/rebuild-memory-projection.js +3 -3
  88. package/dist/{maintenance-DD22oIx9.d.ts → maintenance-DgnD2z8S.d.ts} +1 -1
  89. package/dist/mcp-memory-inspector-app.d.ts +5 -5
  90. package/dist/memory-worth-outcomes.d.ts +1 -1
  91. package/dist/namespaces/migrate.d.ts +1 -1
  92. package/dist/namespaces/migrate.js +3 -3
  93. package/dist/namespaces/storage.d.ts +1 -1
  94. package/dist/namespaces/storage.js +2 -2
  95. package/dist/operator-doctor-corpus.js +5 -5
  96. package/dist/operator-toolkit.d.ts +1 -1
  97. package/dist/operator-toolkit.js +8 -8
  98. package/dist/orchestration/compression-guideline-coordinator.d.ts +1 -1
  99. package/dist/orchestration/maintenance.d.ts +2 -2
  100. package/dist/orchestration/maintenance.js +7 -7
  101. package/dist/{orchestrator-CFJ_TG6D.d.ts → orchestrator-rIHmHpv1.d.ts} +3 -3
  102. package/dist/orchestrator.d.ts +4 -4
  103. package/dist/orchestrator.js +27 -27
  104. package/dist/semantic-consolidation.js +3 -3
  105. package/dist/semantic-rule-promotion.js +2 -2
  106. package/dist/semantic-rule-verifier.js +2 -2
  107. package/dist/{service-Z8uzoAST.d.ts → service-cTvil7D_.d.ts} +1 -1
  108. package/dist/{storage-BZVMn8yJ.d.ts → storage-C9ibpTme.d.ts} +0 -3
  109. package/dist/storage.d.ts +1 -1
  110. package/dist/storage.js +1 -1
  111. package/dist/temporal-supersession.d.ts +1 -1
  112. package/dist/tier-migration.d.ts +1 -1
  113. package/dist/verified-recall.js +2 -2
  114. package/package.json +2 -2
  115. package/src/storage/profile-header.ts +897 -0
  116. package/src/storage-profile-timestamp.test.ts +3290 -0
  117. package/src/storage.ts +5 -8
  118. package/src/testing/subjects/profile-header-write.test.ts +71 -0
  119. package/dist/chunk-UZK7VVPD.js.map +0 -1
  120. /package/dist/{chunk-E6EAB4J6.js.map → chunk-2RAC4JIG.js.map} +0 -0
  121. /package/dist/{chunk-HBVOJNV4.js.map → chunk-4MJZTF42.js.map} +0 -0
  122. /package/dist/{chunk-WMDRLTNA.js.map → chunk-5BRT4Z2I.js.map} +0 -0
  123. /package/dist/{chunk-SN3ZESWQ.js.map → chunk-BHLN7L7M.js.map} +0 -0
  124. /package/dist/{chunk-7XXCIO6X.js.map → chunk-BNGPHGVZ.js.map} +0 -0
  125. /package/dist/{chunk-IHMXPG4P.js.map → chunk-CI26JDZA.js.map} +0 -0
  126. /package/dist/{chunk-LIIQPDFN.js.map → chunk-EOLC6EXV.js.map} +0 -0
  127. /package/dist/{chunk-MIFF37NN.js.map → chunk-EUSLKI4X.js.map} +0 -0
  128. /package/dist/{chunk-PQPSZICJ.js.map → chunk-EYJSW2RV.js.map} +0 -0
  129. /package/dist/{chunk-Y6E37WRG.js.map → chunk-FRVTCCGD.js.map} +0 -0
  130. /package/dist/{chunk-4KKV7W62.js.map → chunk-HEXSNYJD.js.map} +0 -0
  131. /package/dist/{chunk-YN4AUGNF.js.map → chunk-HORJVJ6K.js.map} +0 -0
  132. /package/dist/{chunk-NKDVXEFU.js.map → chunk-JDOJZTFF.js.map} +0 -0
  133. /package/dist/{chunk-EXM2Q555.js.map → chunk-MEBQFQ26.js.map} +0 -0
  134. /package/dist/{chunk-F6LSNPPB.js.map → chunk-MG6MNSP4.js.map} +0 -0
  135. /package/dist/{chunk-2XP3PWL3.js.map → chunk-NUWMZIYZ.js.map} +0 -0
  136. /package/dist/{chunk-PX7VDW7R.js.map → chunk-RGJBM7Z3.js.map} +0 -0
  137. /package/dist/{chunk-ZHP4SUPB.js.map → chunk-RNY3BO35.js.map} +0 -0
  138. /package/dist/{chunk-XAAIUXJO.js.map → chunk-RPA2RX5P.js.map} +0 -0
  139. /package/dist/{chunk-67DSDRUB.js.map → chunk-RSYJV25N.js.map} +0 -0
  140. /package/dist/{chunk-M2KGXXTL.js.map → chunk-U3TH5Q2Q.js.map} +0 -0
  141. /package/dist/{chunk-VGEH3STZ.js.map → chunk-UT3OQPFA.js.map} +0 -0
  142. /package/dist/{chunk-H2PBM562.js.map → chunk-WEAO45M4.js.map} +0 -0
  143. /package/dist/{chunk-KPWLZBXZ.js.map → chunk-XKO7BM2C.js.map} +0 -0
  144. /package/dist/{chunk-FE5FKTCI.js.map → chunk-XQ4EH6DI.js.map} +0 -0
  145. /package/dist/{chunk-XNUBF6RF.js.map → chunk-YSGBD3QN.js.map} +0 -0
package/src/storage.ts CHANGED
@@ -20,6 +20,7 @@ import path from "node:path";
20
20
  import { log } from "./logger.js";
21
21
  import { assertMemoryFrontmatterId, warnProjectionFallback } from "./storage-guards.js";
22
22
  import { MemoryReadStore } from "./storage/memory-read-store.js";
23
+ import { renderProfileWithLastUpdated } from "./storage/profile-header.js";
23
24
  import { readMaybeEncryptedLines, readMemoryActionEventRowsFromLines } from "./storage/secure-line-reader.js";
24
25
  import {
25
26
  appendLifecycleEventsSerialized,
@@ -4251,15 +4252,13 @@ export class StorageManager {
4251
4252
  }
4252
4253
 
4253
4254
  async writeProfile(content: string): Promise<void> {
4255
+ const stampedContent = renderProfileWithLastUpdated(content, new Date().toISOString());
4254
4256
  await this.ensureDirectories();
4255
4257
  await this.snapshotBeforeWrite(this.profilePath, "consolidation");
4256
- await this.writeStorageSecureFile(this.profilePath, content);
4258
+ await this.writeStorageSecureFile(this.profilePath, stampedContent);
4257
4259
  log.debug("updated profile.md");
4258
4260
  }
4259
4261
 
4260
- /**
4261
- * Normalize a string for fuzzy profile dedup: lowercase, strip punctuation, collapse whitespace.
4262
- */
4263
4262
  private static normalizeForDedup(s: string): string {
4264
4263
  if (typeof s !== "string") return "";
4265
4264
  return s
@@ -4308,15 +4307,13 @@ export class StorageManager {
4308
4307
  const content = [
4309
4308
  "# Behavioral Profile",
4310
4309
  "",
4311
- `*Last updated: ${new Date().toISOString()}*`,
4312
- "",
4313
4310
  ...newBullets.map((b) => `- ${b}`),
4314
4311
  "",
4315
4312
  ].join("\n");
4316
4313
  await this.writeProfile(content);
4317
4314
  } else {
4318
- const updatedTimestamp = existing.replace(/\*Last updated:.*\*/, `*Last updated: ${new Date().toISOString()}*`);
4319
- const withBullets = updatedTimestamp.trimEnd() + "\n" + newBullets.map((b) => `- ${b}`).join("\n") + "\n";
4315
+ const withBullets =
4316
+ existing.trimEnd() + "\n" + newBullets.map((b) => `- ${b}`).join("\n") + "\n";
4320
4317
  await this.writeProfile(withBullets);
4321
4318
  }
4322
4319
  }
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Profile-header write-boundary subject for the lifecycle scenario matrix.
3
+ * Profile content is not session state, so only the session-end mutation row
4
+ * applies; the remaining canonical rows are explicit skips rather than false
5
+ * extraction-lifecycle coverage.
6
+ */
7
+
8
+ import assert from "node:assert/strict";
9
+
10
+ import { StorageManager } from "../../storage.js";
11
+ import { type LifecycleSubject, type MatrixRow, runLifecycleMatrix } from "../lifecycle-matrix.js";
12
+ import { cleanupDir, mkTempMemoryDir } from "../orchestrator-lite.js";
13
+
14
+ interface ProfileHeaderState {
15
+ dir: string;
16
+ storage: StorageManager;
17
+ writeStartedAt?: number;
18
+ }
19
+
20
+ const STALE_PROFILE = [
21
+ "# Behavioral Profile",
22
+ "",
23
+ "*Last updated: 2024-01-02T03:04:05.000Z*",
24
+ "",
25
+ "- Profile content survives the write boundary.",
26
+ "",
27
+ ].join("\n");
28
+
29
+ const subject: LifecycleSubject<ProfileHeaderState> = {
30
+ appliesTo(row: MatrixRow): boolean | string {
31
+ return row.id === "session-end"
32
+ ? true
33
+ : "profile writes have no provider, restart, or replay variants; direct profile tests cover those boundaries";
34
+ },
35
+
36
+ async setup(row: MatrixRow): Promise<ProfileHeaderState> {
37
+ const dir = await mkTempMemoryDir(`profile-header-${row.id}`);
38
+ try {
39
+ return { dir, storage: new StorageManager(dir) };
40
+ } catch (error) {
41
+ await cleanupDir(dir);
42
+ throw error;
43
+ }
44
+ },
45
+
46
+ async exercise(state: ProfileHeaderState): Promise<void> {
47
+ state.writeStartedAt = Date.now();
48
+ await state.storage.writeProfile(STALE_PROFILE);
49
+ },
50
+
51
+ async invariants(state: ProfileHeaderState): Promise<void> {
52
+ const profile = await state.storage.readProfile();
53
+ const headers = profile.match(/^\*Last updated: .*\*$/gm) ?? [];
54
+ assert.equal(headers.length, 1, "profile writes leave one canonical Last updated header");
55
+ assert.notEqual(headers[0], "*Last updated: 2024-01-02T03:04:05.000Z*");
56
+ assert.match(profile, /^# Behavioral Profile$/m);
57
+
58
+ const timestamp = headers[0]?.match(/^\*Last updated: ([^*]+)\*$/)?.[1];
59
+ assert.ok(timestamp, "the canonical header contains an ISO timestamp");
60
+ const updatedAt = Date.parse(timestamp);
61
+ assert.ok(Number.isFinite(updatedAt), "the profile header timestamp is parseable");
62
+ assert.ok(updatedAt >= (state.writeStartedAt ?? 0), "the header advances at the write boundary");
63
+ assert.ok(updatedAt <= Date.now(), "the header is not in the future");
64
+ },
65
+
66
+ async teardown(state: ProfileHeaderState): Promise<void> {
67
+ await cleanupDir(state.dir);
68
+ },
69
+ };
70
+
71
+ runLifecycleMatrix("profile-header-write", subject);