@remnic/core 1.1.3 → 1.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 (86) hide show
  1. package/dist/access-cli.js +14 -14
  2. package/dist/access-http.d.ts +2 -2
  3. package/dist/access-http.js +8 -7
  4. package/dist/access-mcp.d.ts +2 -2
  5. package/dist/access-mcp.js +7 -6
  6. package/dist/{access-service-_AEUMVyX.d.ts → access-service-CtXFnprR.d.ts} +59 -7
  7. package/dist/access-service.d.ts +2 -2
  8. package/dist/access-service.js +6 -5
  9. package/dist/bootstrap.d.ts +1 -1
  10. package/dist/briefing.d.ts +1 -1
  11. package/dist/briefing.js +3 -3
  12. package/dist/buffer.d.ts +1 -1
  13. package/dist/causal-consolidation.js +3 -3
  14. package/dist/{chunk-Y3WQ4ZWK.js → chunk-52PDY6GD.js} +2 -2
  15. package/dist/{chunk-BOUYNNYD.js → chunk-67YLUWLG.js} +32 -13
  16. package/dist/{chunk-BOUYNNYD.js.map → chunk-67YLUWLG.js.map} +1 -1
  17. package/dist/{chunk-DR7MCMPS.js → chunk-AEMBDV7M.js} +210 -5
  18. package/dist/chunk-AEMBDV7M.js.map +1 -0
  19. package/dist/{chunk-55FXRRSJ.js → chunk-AGZHRWPT.js} +2 -2
  20. package/dist/{chunk-AKUCB2OG.js → chunk-CUI2STX6.js} +5 -4
  21. package/dist/{chunk-AKUCB2OG.js.map → chunk-CUI2STX6.js.map} +1 -1
  22. package/dist/{chunk-DHRQHX36.js → chunk-EGEPUGN4.js} +2 -2
  23. package/dist/{chunk-LZRYQK6L.js → chunk-F5VQOQ2E.js} +2 -2
  24. package/dist/{chunk-ZGXSCMQN.js → chunk-HIRKCQGF.js} +12 -12
  25. package/dist/{chunk-34F3PLWZ.js → chunk-MUELDH4F.js} +2 -2
  26. package/dist/{chunk-IM3JSE73.js → chunk-NZS2BLTP.js} +20 -14
  27. package/dist/{chunk-IM3JSE73.js.map → chunk-NZS2BLTP.js.map} +1 -1
  28. package/dist/{chunk-7GCMLT7J.js → chunk-TIFRGAKO.js} +4 -4
  29. package/dist/{chunk-R2L7SUX2.js → chunk-V7TEH5I2.js} +2 -2
  30. package/dist/{chunk-L5IIGA5V.js → chunk-W7WWT4FJ.js} +2 -2
  31. package/dist/{chunk-N7X62G74.js → chunk-X6VBWOVZ.js} +4 -4
  32. package/dist/{chunk-LVYGDT5V.js → chunk-XQ4EJLUD.js} +10 -12
  33. package/dist/chunk-XQ4EJLUD.js.map +1 -0
  34. package/dist/{chunk-4PLGJRBV.js → chunk-XRCYKJ3V.js} +130 -3
  35. package/dist/{chunk-4PLGJRBV.js.map → chunk-XRCYKJ3V.js.map} +1 -1
  36. package/dist/{chunk-DCE6SQLA.js → chunk-Y4A6M3B6.js} +2 -2
  37. package/dist/{chunk-SS253RXF.js → chunk-ZIBOQULP.js} +2 -2
  38. package/dist/{cli-x2APT9a6.d.ts → cli-lMql2FCr.d.ts} +2 -2
  39. package/dist/cli.d.ts +3 -3
  40. package/dist/cli.js +14 -13
  41. package/dist/consolidation-provenance-check.d.ts +1 -1
  42. package/dist/consolidation-undo.d.ts +1 -1
  43. package/dist/{engine-ICC2DSQF.js → engine-O6YWKQM3.js} +6 -4
  44. package/dist/entity-retrieval.d.ts +1 -1
  45. package/dist/entity-retrieval.js +3 -3
  46. package/dist/explicit-capture.d.ts +1 -1
  47. package/dist/extraction.js +2 -2
  48. package/dist/index.d.ts +17 -5
  49. package/dist/index.js +25 -19
  50. package/dist/index.js.map +1 -1
  51. package/dist/{memory-governance-KG52RITE.js → memory-governance-JZHZDOLN.js} +4 -4
  52. package/dist/{memory-projection-store-D3vBHS4J.d.ts → memory-projection-store-CY8TU40w.d.ts} +1 -1
  53. package/dist/memory-projection-store.d.ts +1 -1
  54. package/dist/memory-projection-store.js +1 -1
  55. package/dist/memory-worth-outcomes.d.ts +1 -1
  56. package/dist/operator-toolkit.d.ts +1 -1
  57. package/dist/operator-toolkit.js +5 -5
  58. package/dist/orchestrator.d.ts +1 -1
  59. package/dist/orchestrator.js +11 -11
  60. package/dist/schemas.d.ts +22 -22
  61. package/dist/semantic-consolidation.js +3 -3
  62. package/dist/semantic-rule-promotion.js +3 -3
  63. package/dist/semantic-rule-verifier.js +3 -3
  64. package/dist/storage.d.ts +1 -1
  65. package/dist/storage.js +2 -2
  66. package/dist/temporal-supersession.d.ts +1 -1
  67. package/dist/tier-migration.d.ts +1 -1
  68. package/dist/verified-recall.js +3 -3
  69. package/package.json +6 -3
  70. package/scripts/ensure-better-sqlite3.mjs +124 -0
  71. package/dist/chunk-DR7MCMPS.js.map +0 -1
  72. package/dist/chunk-LVYGDT5V.js.map +0 -1
  73. /package/dist/{chunk-Y3WQ4ZWK.js.map → chunk-52PDY6GD.js.map} +0 -0
  74. /package/dist/{chunk-55FXRRSJ.js.map → chunk-AGZHRWPT.js.map} +0 -0
  75. /package/dist/{chunk-DHRQHX36.js.map → chunk-EGEPUGN4.js.map} +0 -0
  76. /package/dist/{chunk-LZRYQK6L.js.map → chunk-F5VQOQ2E.js.map} +0 -0
  77. /package/dist/{chunk-ZGXSCMQN.js.map → chunk-HIRKCQGF.js.map} +0 -0
  78. /package/dist/{chunk-34F3PLWZ.js.map → chunk-MUELDH4F.js.map} +0 -0
  79. /package/dist/{chunk-7GCMLT7J.js.map → chunk-TIFRGAKO.js.map} +0 -0
  80. /package/dist/{chunk-R2L7SUX2.js.map → chunk-V7TEH5I2.js.map} +0 -0
  81. /package/dist/{chunk-L5IIGA5V.js.map → chunk-W7WWT4FJ.js.map} +0 -0
  82. /package/dist/{chunk-N7X62G74.js.map → chunk-X6VBWOVZ.js.map} +0 -0
  83. /package/dist/{chunk-DCE6SQLA.js.map → chunk-Y4A6M3B6.js.map} +0 -0
  84. /package/dist/{chunk-SS253RXF.js.map → chunk-ZIBOQULP.js.map} +0 -0
  85. /package/dist/{engine-ICC2DSQF.js.map → engine-O6YWKQM3.js.map} +0 -0
  86. /package/dist/{memory-governance-KG52RITE.js.map → memory-governance-JZHZDOLN.js.map} +0 -0
@@ -0,0 +1,124 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { createRequire } from "node:module";
3
+ import path from "node:path";
4
+
5
+ const require = createRequire(import.meta.url);
6
+
7
+ if (process.env.REMNIC_SKIP_BETTER_SQLITE3_VERIFY === "1") {
8
+ console.log("[remnic] Skipping better-sqlite3 verification by request.");
9
+ process.exit(0);
10
+ }
11
+
12
+ try {
13
+ verifyBetterSqlite3();
14
+ console.log("[remnic] better-sqlite3 native binding verified.");
15
+ process.exit(0);
16
+ } catch (error) {
17
+ console.warn(`[remnic] better-sqlite3 verification failed: ${errorMessage(error)}`);
18
+ }
19
+
20
+ const packageDir = betterSqlite3PackageDir();
21
+ if (!packageDir) {
22
+ console.error("[remnic] Could not resolve better-sqlite3/package.json.");
23
+ process.exit(1);
24
+ }
25
+
26
+ const rebuild = rebuildBetterSqlite3(packageDir);
27
+ if (!rebuild.ok) {
28
+ console.error("[remnic] better-sqlite3 native rebuild failed.");
29
+ if (rebuild.output) console.error(rebuild.output);
30
+ console.error(
31
+ `[remnic] Try manually from this install directory: npx node-gyp rebuild --directory=${packageDir}`,
32
+ );
33
+ process.exit(rebuild.status ?? 1);
34
+ }
35
+
36
+ try {
37
+ clearBetterSqlite3RequireCache(packageDir);
38
+ verifyBetterSqlite3();
39
+ console.log("[remnic] better-sqlite3 native binding rebuilt and verified.");
40
+ } catch (error) {
41
+ console.error(
42
+ `[remnic] better-sqlite3 rebuild completed but the binding still does not load: ${errorMessage(error)}`,
43
+ );
44
+ process.exit(1);
45
+ }
46
+
47
+ function verifyBetterSqlite3() {
48
+ const loaded = require("better-sqlite3");
49
+ const Database = typeof loaded === "function" ? loaded : loaded?.default;
50
+ if (typeof Database !== "function") {
51
+ throw new Error("module did not export a constructor");
52
+ }
53
+ const db = new Database(":memory:");
54
+ db.pragma("journal_mode = MEMORY");
55
+ db.close();
56
+ }
57
+
58
+ function betterSqlite3PackageDir() {
59
+ try {
60
+ return path.dirname(require.resolve("better-sqlite3/package.json"));
61
+ } catch {
62
+ return null;
63
+ }
64
+ }
65
+
66
+ function rebuildBetterSqlite3(cwd) {
67
+ const localNodeGyp = resolveOptional("node-gyp/bin/node-gyp.js");
68
+ if (localNodeGyp) {
69
+ return runRebuild(process.execPath, [localNodeGyp, "rebuild", "--release"], cwd);
70
+ }
71
+
72
+ const npm = process.platform === "win32" ? "npm.cmd" : "npm";
73
+ return runRebuild(
74
+ npm,
75
+ ["exec", "--yes", "node-gyp", "--", "rebuild", "--release"],
76
+ cwd,
77
+ );
78
+ }
79
+
80
+ function resolveOptional(specifier) {
81
+ try {
82
+ return require.resolve(specifier);
83
+ } catch {
84
+ return null;
85
+ }
86
+ }
87
+
88
+ function runRebuild(command, args, cwd) {
89
+ console.log(`[remnic] Rebuilding better-sqlite3 native binding in ${cwd}`);
90
+ const result = spawnSync(command, args, {
91
+ cwd,
92
+ encoding: "utf8",
93
+ env: {
94
+ ...process.env,
95
+ npm_config_build_from_source: "true",
96
+ },
97
+ windowsHide: true,
98
+ });
99
+
100
+ return {
101
+ ok: result.status === 0,
102
+ status: result.status,
103
+ output: [
104
+ result.error ? String(result.error) : "",
105
+ result.stdout ?? "",
106
+ result.stderr ?? "",
107
+ ]
108
+ .filter((part) => part.trim().length > 0)
109
+ .join("\n")
110
+ .trim(),
111
+ };
112
+ }
113
+
114
+ function clearBetterSqlite3RequireCache(packageDir) {
115
+ for (const key of Object.keys(require.cache)) {
116
+ if (key.startsWith(packageDir)) {
117
+ delete require.cache[key];
118
+ }
119
+ }
120
+ }
121
+
122
+ function errorMessage(error) {
123
+ return error instanceof Error ? error.message : String(error);
124
+ }