true-mem 1.0.9 → 1.0.10

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAS,MAAM,qBAAqB,CAAC;AAmBzD,QAAA,MAAM,UAAU,EAAE,MAqGjB,CAAC;AAEF,eAAe,UAAU,CAAC;AAG1B,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAS,MAAM,qBAAqB,CAAC;AAsBzD,QAAA,MAAM,UAAU,EAAE,MAyGjB,CAAC;AAEF,eAAe,UAAU,CAAC;AAG1B,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -3011,15 +3011,30 @@ init_logger();
3011
3011
  // src/utils/version.ts
3012
3012
  import fs from "fs";
3013
3013
  import path from "path";
3014
- var __dirname = "/home/runner/work/true-mem/true-mem/src/utils";
3014
+ import { fileURLToPath } from "url";
3015
+ function findPackageJsonUp(startDir) {
3016
+ let currentDir = startDir;
3017
+ while (currentDir !== path.dirname(currentDir)) {
3018
+ const pkgPath = path.join(currentDir, "package.json");
3019
+ if (fs.existsSync(pkgPath)) {
3020
+ return pkgPath;
3021
+ }
3022
+ currentDir = path.dirname(currentDir);
3023
+ }
3024
+ return null;
3025
+ }
3015
3026
  function getVersion() {
3016
3027
  try {
3017
- const distDir = __dirname;
3018
- const pkgPath = path.join(distDir, "..", "package.json");
3019
- const content = fs.readFileSync(pkgPath, "utf-8");
3020
- const pkg = JSON.parse(content);
3021
- return pkg.version ?? "unknown";
3022
- } catch {
3028
+ const currentDir = path.dirname(fileURLToPath(import.meta.url));
3029
+ const pkgPath = findPackageJsonUp(currentDir);
3030
+ if (pkgPath) {
3031
+ const content = fs.readFileSync(pkgPath, "utf-8");
3032
+ const pkg = JSON.parse(content);
3033
+ return pkg.version ?? "unknown";
3034
+ }
3035
+ return "unknown";
3036
+ } catch (error) {
3037
+ console.error("[True-Mem] Version detection error:", error);
3023
3038
  return "unknown";
3024
3039
  }
3025
3040
  }
@@ -3038,8 +3053,16 @@ var state = {
3038
3053
  ctx: null,
3039
3054
  realHooks: null
3040
3055
  };
3056
+ var hasShownToast = false;
3041
3057
  var TrueMemory = async (ctx) => {
3042
3058
  state.ctx = ctx;
3059
+ if (!hasShownToast) {
3060
+ hasShownToast = true;
3061
+ const version = getVersion();
3062
+ setTimeout(() => {
3063
+ showToast(ctx, `True-Mem v${version}`, "Memory active.", "info", 4000);
3064
+ }, 2000);
3065
+ }
3043
3066
  state.initPromise = (async () => {
3044
3067
  log("Phase 1: Initializing plugin (lightweight)...");
3045
3068
  if (!state.ctx) {
@@ -3060,10 +3083,6 @@ var TrueMemory = async (ctx) => {
3060
3083
  log("True-Mem: Plugin registered (immediate init mode)");
3061
3084
  return {
3062
3085
  event: async ({ event }) => {
3063
- if (event.type === "session.created" && state.ctx) {
3064
- const version = getVersion();
3065
- showToast(state.ctx, `True-Mem v${version}`, "Persistent memory plugin active.", "info");
3066
- }
3067
3086
  const silentEvents = new Set(["message.part.delta", "message.part.updated", "session.diff"]);
3068
3087
  if (silentEvents.has(event.type))
3069
3088
  return;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Read version from package.json at RUNTIME.
3
- * This ensures the version is always current, even after npm version bump.
3
+ * Searches upward from the current module directory.
4
4
  */
5
5
  export declare function getVersion(): string;
6
6
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAWnC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":"AAmBA;;;GAGG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAcnC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "true-mem",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "Persistent memory plugin for OpenCode with cognitive psychology-based memory management",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",