@aigne/afs-user-profile-memory 1.3.0-beta.7 → 1.3.0-beta.8

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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.3.0-beta.8](https://github.com/AIGNE-io/aigne-framework/compare/afs-user-profile-memory-v1.3.0-beta.7...afs-user-profile-memory-v1.3.0-beta.8) (2025-12-31)
4
+
5
+
6
+ ### Features
7
+
8
+ * add session compact support for AIAgent ([#863](https://github.com/AIGNE-io/aigne-framework/issues/863)) ([9010918](https://github.com/AIGNE-io/aigne-framework/commit/9010918cd3f18b02b5c60ddc9ed5c34b568d0b28))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @aigne/afs bumped to 1.4.0-beta.5
16
+ * @aigne/afs-history bumped to 1.2.0-beta.5
17
+ * @aigne/core bumped to 1.72.0-beta.8
18
+
3
19
  ## [1.3.0-beta.7](https://github.com/AIGNE-io/aigne-framework/compare/afs-user-profile-memory-v1.3.0-beta.6...afs-user-profile-memory-v1.3.0-beta.7) (2025-12-26)
4
20
 
5
21
 
package/lib/cjs/index.js CHANGED
@@ -4,6 +4,7 @@ exports.UserProfileMemory = void 0;
4
4
  const afs_history_1 = require("@aigne/afs-history");
5
5
  const core_1 = require("@aigne/core");
6
6
  const logger_js_1 = require("@aigne/core/utils/logger.js");
7
+ const uuid_1 = require("@aigne/uuid");
7
8
  const fast_json_patch_1 = require("fast-json-patch");
8
9
  const zod_to_json_schema_1 = require("zod-to-json-schema");
9
10
  const prompt_js_1 = require("./prompt.js");
@@ -60,13 +61,24 @@ class UserProfileMemory {
60
61
  return { data: profile ? [profile] : [] };
61
62
  }
62
63
  async read(path) {
63
- const data = await this.storage.read(path);
64
+ if (path !== "/")
65
+ return {};
66
+ const data = (await this.storage.list({
67
+ orderBy: [["createdAt", "desc"]],
68
+ limit: 1,
69
+ })).data.at(0);
64
70
  if (data)
65
71
  data.description = this.description;
66
72
  return { data };
67
73
  }
68
74
  async write(path, entry) {
69
- const data = await this.storage.create({ ...entry, path });
75
+ const { data: previous } = await this.read("/");
76
+ const data = await this.storage.create({
77
+ ...previous,
78
+ ...entry,
79
+ id: previous?.id || (0, uuid_1.v7)(),
80
+ path,
81
+ });
70
82
  if (data)
71
83
  data.description = this.description;
72
84
  return { data };
package/lib/esm/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { SharedAFSStorage, } from "@aigne/afs-history";
2
2
  import { AIAgent } from "@aigne/core";
3
3
  import { logger } from "@aigne/core/utils/logger.js";
4
+ import { v7 } from "@aigne/uuid";
4
5
  import { applyPatch } from "fast-json-patch";
5
6
  import { zodToJsonSchema } from "zod-to-json-schema";
6
7
  import { USER_PROFILE_MEMORY_EXTRACTOR_PROMPT } from "./prompt.js";
@@ -57,13 +58,24 @@ export class UserProfileMemory {
57
58
  return { data: profile ? [profile] : [] };
58
59
  }
59
60
  async read(path) {
60
- const data = await this.storage.read(path);
61
+ if (path !== "/")
62
+ return {};
63
+ const data = (await this.storage.list({
64
+ orderBy: [["createdAt", "desc"]],
65
+ limit: 1,
66
+ })).data.at(0);
61
67
  if (data)
62
68
  data.description = this.description;
63
69
  return { data };
64
70
  }
65
71
  async write(path, entry) {
66
- const data = await this.storage.create({ ...entry, path });
72
+ const { data: previous } = await this.read("/");
73
+ const data = await this.storage.create({
74
+ ...previous,
75
+ ...entry,
76
+ id: previous?.id || v7(),
77
+ path,
78
+ });
67
79
  if (data)
68
80
  data.description = this.description;
69
81
  return { data };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/afs-user-profile-memory",
3
- "version": "1.3.0-beta.7",
3
+ "version": "1.3.0-beta.8",
4
4
  "description": "AIGNE AFS module for user profile memory",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -47,12 +47,13 @@
47
47
  }
48
48
  },
49
49
  "dependencies": {
50
+ "@aigne/uuid": "^13.0.1",
50
51
  "fast-json-patch": "^3.1.1",
51
52
  "zod": "^3.25.67",
52
53
  "zod-to-json-schema": "^3.24.6",
53
- "@aigne/afs": "^1.4.0-beta.4",
54
- "@aigne/afs-history": "^1.2.0-beta.4",
55
- "@aigne/core": "^1.72.0-beta.7"
54
+ "@aigne/afs": "^1.4.0-beta.5",
55
+ "@aigne/afs-history": "^1.2.0-beta.5",
56
+ "@aigne/core": "^1.72.0-beta.8"
56
57
  },
57
58
  "devDependencies": {
58
59
  "@types/bun": "^1.2.22",