@alisio/plugin-memory 0.1.0-alpha.5 → 0.1.0-alpha.6

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.
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ import { memoryConfigSchema } from "./config.js";
8
8
  import { COMPACTION_GUIDANCE, formatObservation, MEMORY_PROTOCOL, memoryLine, OBSERVATIONS_FIELD, parseObservations, parseSessionSummary, renderInjection, SESSION_SUMMARY_SYSTEM, } from "./format.js";
9
9
  import { projectId, SQLiteMemoryStore } from "./store.js";
10
10
  import { memoryContextText, memoryTools } from "./tools.js";
11
+ import { loadVersion } from "./version.js";
11
12
  const userTexts = (messages) => messages.flatMap((m) => (m.role === "user" && !m.summary && m.text.trim() ? [m.text] : []));
12
13
  function transcript(messages, maxChars = 60_000) {
13
14
  const lines = messages.map((m) => m.role === "user"
@@ -43,7 +44,7 @@ export function createMemoryPlugin(rawOptions, context) {
43
44
  id: "memory",
44
45
  name: "Memory",
45
46
  description: "Persistent memory and memory-aware context compaction",
46
- version: "0.1.0",
47
+ version: loadVersion(import.meta.url),
47
48
  apiVersion: 1,
48
49
  async setup(api) {
49
50
  const project = await projectId(context.workspace);
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Reads this plugin package's version at runtime so plugin metadata, user-agent defaults and CLI
3
+ * reports stay in sync with the published package without a build-time constant to update.
4
+ * The manifest is resolved relative to the module (`src/version.ts` → `../package.json` in the
5
+ * source tree; `dist/version.js` → `../package.json` of the installed package). Standalone
6
+ * binaries inject the version at build time via ALISIO_PACKAGE_VERSION (scripts/binary-build.ts).
7
+ */
8
+ export declare function loadVersion(fromHere: string): string;
@@ -0,0 +1,28 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { dirname, join } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ /**
5
+ * Fallback used when neither the build-time injection nor the package manifest is readable
6
+ * (e.g. an unpackaged embed). Keep it a development marker, never a publish literal, so it
7
+ * cannot silently desync from the published package.
8
+ */
9
+ const FALLBACK = "dev";
10
+ /**
11
+ * Reads this plugin package's version at runtime so plugin metadata, user-agent defaults and CLI
12
+ * reports stay in sync with the published package without a build-time constant to update.
13
+ * The manifest is resolved relative to the module (`src/version.ts` → `../package.json` in the
14
+ * source tree; `dist/version.js` → `../package.json` of the installed package). Standalone
15
+ * binaries inject the version at build time via ALISIO_PACKAGE_VERSION (scripts/binary-build.ts).
16
+ */
17
+ export function loadVersion(fromHere) {
18
+ if (process.env.ALISIO_PACKAGE_VERSION)
19
+ return process.env.ALISIO_PACKAGE_VERSION;
20
+ try {
21
+ const manifest = join(dirname(fileURLToPath(fromHere)), "..", "package.json");
22
+ const parsed = JSON.parse(readFileSync(manifest, "utf8"));
23
+ return typeof parsed.version === "string" && parsed.version ? parsed.version : FALLBACK;
24
+ }
25
+ catch {
26
+ return FALLBACK;
27
+ }
28
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alisio/plugin-memory",
3
- "version": "0.1.0-alpha.5",
3
+ "version": "0.1.0-alpha.6",
4
4
  "description": "Engram-style persistent memory for Alisio: SQLite FTS5 observations with topic-key upserts, memory-aware compaction, session summaries and recall tools. Built-in, disableable plugin.",
5
5
  "author": "Gustavo Gutiérrez",
6
6
  "license": "MIT",