@aigne/afs-user-profile-memory 1.3.0 → 1.4.0-beta
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 +18 -0
- package/lib/cjs/index.d.ts +7 -4
- package/lib/cjs/index.js +10 -11
- package/lib/dts/index.d.ts +7 -4
- package/lib/esm/index.d.ts +7 -4
- package/lib/esm/index.js +6 -7
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.4.0-beta](https://github.com/AIGNE-io/aigne-framework/compare/afs-user-profile-memory-v1.3.0...afs-user-profile-memory-v1.4.0-beta) (2026-01-20)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **afs:** add @aigne/afs-utils package ([#927](https://github.com/AIGNE-io/aigne-framework/issues/927)) ([3922635](https://github.com/AIGNE-io/aigne-framework/commit/3922635981aab4578607c5bf1fb882c8e45725ce))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @aigne/afs-history bumped to 1.3.0-beta
|
|
16
|
+
* @aigne/afs-utils bumped to 1.0.0
|
|
17
|
+
* @aigne/core bumped to 1.73.0-beta
|
|
18
|
+
* devDependencies
|
|
19
|
+
* @aigne/test-utils bumped to 0.5.70-beta
|
|
20
|
+
|
|
3
21
|
## [1.3.0](https://github.com/AIGNE-io/aigne-framework/compare/afs-user-profile-memory-v1.3.0-beta.25...afs-user-profile-memory-v1.3.0) (2026-01-16)
|
|
4
22
|
|
|
5
23
|
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { AFSAccessMode, AFSEntry, AFSListOptions, AFSListResult, AFSModule, AFSModuleLoadParams, AFSOperationOptions, AFSReadResult, AFSRoot, AFSSearchOptions, AFSSearchResult, AFSWriteEntryPayload, AFSWriteResult } from "@aigne/afs";
|
|
2
|
-
import {
|
|
2
|
+
import { type AFSStorage, type AFSStorageSQLiteOptions } from "@aigne/afs-history";
|
|
3
3
|
import { AIAgent } from "@aigne/core";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { userProfileJsonPathSchema } from "./schema.js";
|
|
6
6
|
export interface UserProfileMemoryOptions {
|
|
7
|
-
storage?:
|
|
7
|
+
storage?: AFSStorage | AFSStorageSQLiteOptions;
|
|
8
8
|
description?: string;
|
|
9
9
|
/**
|
|
10
10
|
* Access mode for this module.
|
|
@@ -14,7 +14,7 @@ export interface UserProfileMemoryOptions {
|
|
|
14
14
|
}
|
|
15
15
|
export declare class UserProfileMemory implements AFSModule {
|
|
16
16
|
options: UserProfileMemoryOptions;
|
|
17
|
-
static schema(): z.ZodObject<{
|
|
17
|
+
static schema(): z.ZodEffects<z.ZodObject<{
|
|
18
18
|
description: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
19
19
|
accessMode: z.ZodType<"readonly" | "readwrite" | undefined, z.ZodTypeDef, "readonly" | "readwrite" | undefined>;
|
|
20
20
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -23,7 +23,10 @@ export declare class UserProfileMemory implements AFSModule {
|
|
|
23
23
|
}, {
|
|
24
24
|
description?: string | undefined;
|
|
25
25
|
accessMode?: "readonly" | "readwrite" | undefined;
|
|
26
|
-
}
|
|
26
|
+
}>, {
|
|
27
|
+
description?: string | undefined;
|
|
28
|
+
accessMode?: "readonly" | "readwrite" | undefined;
|
|
29
|
+
}, any>;
|
|
27
30
|
static load({ parsed }: AFSModuleLoadParams): Promise<UserProfileMemory>;
|
|
28
31
|
constructor(options: UserProfileMemoryOptions);
|
|
29
32
|
private storage;
|
package/lib/cjs/index.js
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UserProfileMemory = void 0;
|
|
4
4
|
const afs_history_1 = require("@aigne/afs-history");
|
|
5
|
+
const index_js_1 = require("@aigne/afs-utils/zod/index.js");
|
|
5
6
|
const core_1 = require("@aigne/core");
|
|
6
|
-
const schema_js_1 = require("@aigne/core/loader/schema.js");
|
|
7
7
|
const logger_js_1 = require("@aigne/core/utils/logger.js");
|
|
8
8
|
const uuid_1 = require("@aigne/uuid");
|
|
9
9
|
const fast_json_patch_1 = require("fast-json-patch");
|
|
10
10
|
const zod_1 = require("zod");
|
|
11
11
|
const zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
12
12
|
const prompt_js_1 = require("./prompt.js");
|
|
13
|
-
const
|
|
13
|
+
const schema_js_1 = require("./schema.js");
|
|
14
14
|
const DEFAULT_DESCRIPTION = `\
|
|
15
15
|
User Profile Memory: This contains structured information about the user that has been \
|
|
16
16
|
automatically extracted from previous conversations. It includes personal details such as name, \
|
|
@@ -18,9 +18,9 @@ location, interests, family members, projects, and other relevant information th
|
|
|
18
18
|
Use this memory to personalize responses and maintain context about the user across conversations. \
|
|
19
19
|
The profile is continuously updated as new information is learned.
|
|
20
20
|
`;
|
|
21
|
-
const userProfileMemoryOptionsSchema = (0,
|
|
22
|
-
description: (0,
|
|
23
|
-
accessMode: (0,
|
|
21
|
+
const userProfileMemoryOptionsSchema = (0, index_js_1.camelize)(zod_1.z.object({
|
|
22
|
+
description: (0, index_js_1.optionalize)(zod_1.z.string().describe("Description of the user profile memory")),
|
|
23
|
+
accessMode: (0, index_js_1.optionalize)(zod_1.z.enum(["readonly", "readwrite"]).describe("Access mode for this module")),
|
|
24
24
|
}));
|
|
25
25
|
class UserProfileMemory {
|
|
26
26
|
options;
|
|
@@ -33,10 +33,9 @@ class UserProfileMemory {
|
|
|
33
33
|
}
|
|
34
34
|
constructor(options) {
|
|
35
35
|
this.options = options;
|
|
36
|
-
this.storage =
|
|
37
|
-
options
|
|
38
|
-
|
|
39
|
-
: new afs_history_1.SharedAFSStorage(options?.storage).withModule(this);
|
|
36
|
+
this.storage = (0, afs_history_1.isAFSStorage)(options?.storage)
|
|
37
|
+
? options.storage
|
|
38
|
+
: new afs_history_1.AFSStorageSQLite(this, options?.storage);
|
|
40
39
|
this.description = options.description || DEFAULT_DESCRIPTION;
|
|
41
40
|
this.accessMode = options.accessMode ?? "readwrite";
|
|
42
41
|
}
|
|
@@ -46,7 +45,7 @@ class UserProfileMemory {
|
|
|
46
45
|
description;
|
|
47
46
|
extractor = core_1.AIAgent.from({
|
|
48
47
|
instructions: prompt_js_1.USER_PROFILE_MEMORY_EXTRACTOR_PROMPT,
|
|
49
|
-
outputSchema:
|
|
48
|
+
outputSchema: schema_js_1.userProfileJsonPathSchema,
|
|
50
49
|
});
|
|
51
50
|
onMount(afs) {
|
|
52
51
|
afs.on("historyCreated", async ({ entry }, options) => {
|
|
@@ -66,7 +65,7 @@ class UserProfileMemory {
|
|
|
66
65
|
const { ops } = await (options?.context)
|
|
67
66
|
.newContext({ reset: true })
|
|
68
67
|
.invoke(this.extractor, {
|
|
69
|
-
schema: (0, zod_to_json_schema_1.zodToJsonSchema)(
|
|
68
|
+
schema: (0, zod_to_json_schema_1.zodToJsonSchema)(schema_js_1.userProfileSchema),
|
|
70
69
|
profile: previous?.content,
|
|
71
70
|
entry,
|
|
72
71
|
});
|
package/lib/dts/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { AFSAccessMode, AFSEntry, AFSListOptions, AFSListResult, AFSModule, AFSModuleLoadParams, AFSOperationOptions, AFSReadResult, AFSRoot, AFSSearchOptions, AFSSearchResult, AFSWriteEntryPayload, AFSWriteResult } from "@aigne/afs";
|
|
2
|
-
import {
|
|
2
|
+
import { type AFSStorage, type AFSStorageSQLiteOptions } from "@aigne/afs-history";
|
|
3
3
|
import { AIAgent } from "@aigne/core";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { userProfileJsonPathSchema } from "./schema.js";
|
|
6
6
|
export interface UserProfileMemoryOptions {
|
|
7
|
-
storage?:
|
|
7
|
+
storage?: AFSStorage | AFSStorageSQLiteOptions;
|
|
8
8
|
description?: string;
|
|
9
9
|
/**
|
|
10
10
|
* Access mode for this module.
|
|
@@ -14,7 +14,7 @@ export interface UserProfileMemoryOptions {
|
|
|
14
14
|
}
|
|
15
15
|
export declare class UserProfileMemory implements AFSModule {
|
|
16
16
|
options: UserProfileMemoryOptions;
|
|
17
|
-
static schema(): z.ZodObject<{
|
|
17
|
+
static schema(): z.ZodEffects<z.ZodObject<{
|
|
18
18
|
description: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
19
19
|
accessMode: z.ZodType<"readonly" | "readwrite" | undefined, z.ZodTypeDef, "readonly" | "readwrite" | undefined>;
|
|
20
20
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -23,7 +23,10 @@ export declare class UserProfileMemory implements AFSModule {
|
|
|
23
23
|
}, {
|
|
24
24
|
description?: string | undefined;
|
|
25
25
|
accessMode?: "readonly" | "readwrite" | undefined;
|
|
26
|
-
}
|
|
26
|
+
}>, {
|
|
27
|
+
description?: string | undefined;
|
|
28
|
+
accessMode?: "readonly" | "readwrite" | undefined;
|
|
29
|
+
}, any>;
|
|
27
30
|
static load({ parsed }: AFSModuleLoadParams): Promise<UserProfileMemory>;
|
|
28
31
|
constructor(options: UserProfileMemoryOptions);
|
|
29
32
|
private storage;
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { AFSAccessMode, AFSEntry, AFSListOptions, AFSListResult, AFSModule, AFSModuleLoadParams, AFSOperationOptions, AFSReadResult, AFSRoot, AFSSearchOptions, AFSSearchResult, AFSWriteEntryPayload, AFSWriteResult } from "@aigne/afs";
|
|
2
|
-
import {
|
|
2
|
+
import { type AFSStorage, type AFSStorageSQLiteOptions } from "@aigne/afs-history";
|
|
3
3
|
import { AIAgent } from "@aigne/core";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { userProfileJsonPathSchema } from "./schema.js";
|
|
6
6
|
export interface UserProfileMemoryOptions {
|
|
7
|
-
storage?:
|
|
7
|
+
storage?: AFSStorage | AFSStorageSQLiteOptions;
|
|
8
8
|
description?: string;
|
|
9
9
|
/**
|
|
10
10
|
* Access mode for this module.
|
|
@@ -14,7 +14,7 @@ export interface UserProfileMemoryOptions {
|
|
|
14
14
|
}
|
|
15
15
|
export declare class UserProfileMemory implements AFSModule {
|
|
16
16
|
options: UserProfileMemoryOptions;
|
|
17
|
-
static schema(): z.ZodObject<{
|
|
17
|
+
static schema(): z.ZodEffects<z.ZodObject<{
|
|
18
18
|
description: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
19
19
|
accessMode: z.ZodType<"readonly" | "readwrite" | undefined, z.ZodTypeDef, "readonly" | "readwrite" | undefined>;
|
|
20
20
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -23,7 +23,10 @@ export declare class UserProfileMemory implements AFSModule {
|
|
|
23
23
|
}, {
|
|
24
24
|
description?: string | undefined;
|
|
25
25
|
accessMode?: "readonly" | "readwrite" | undefined;
|
|
26
|
-
}
|
|
26
|
+
}>, {
|
|
27
|
+
description?: string | undefined;
|
|
28
|
+
accessMode?: "readonly" | "readwrite" | undefined;
|
|
29
|
+
}, any>;
|
|
27
30
|
static load({ parsed }: AFSModuleLoadParams): Promise<UserProfileMemory>;
|
|
28
31
|
constructor(options: UserProfileMemoryOptions);
|
|
29
32
|
private storage;
|
package/lib/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AFSStorageSQLite, isAFSStorage, } from "@aigne/afs-history";
|
|
2
|
+
import { camelize, optionalize } from "@aigne/afs-utils/zod/index.js";
|
|
2
3
|
import { AIAgent } from "@aigne/core";
|
|
3
|
-
import { camelizeSchema, optionalize } from "@aigne/core/loader/schema.js";
|
|
4
4
|
import { logger } from "@aigne/core/utils/logger.js";
|
|
5
5
|
import { v7 } from "@aigne/uuid";
|
|
6
6
|
import { applyPatch } from "fast-json-patch";
|
|
@@ -15,7 +15,7 @@ location, interests, family members, projects, and other relevant information th
|
|
|
15
15
|
Use this memory to personalize responses and maintain context about the user across conversations. \
|
|
16
16
|
The profile is continuously updated as new information is learned.
|
|
17
17
|
`;
|
|
18
|
-
const userProfileMemoryOptionsSchema =
|
|
18
|
+
const userProfileMemoryOptionsSchema = camelize(z.object({
|
|
19
19
|
description: optionalize(z.string().describe("Description of the user profile memory")),
|
|
20
20
|
accessMode: optionalize(z.enum(["readonly", "readwrite"]).describe("Access mode for this module")),
|
|
21
21
|
}));
|
|
@@ -30,10 +30,9 @@ export class UserProfileMemory {
|
|
|
30
30
|
}
|
|
31
31
|
constructor(options) {
|
|
32
32
|
this.options = options;
|
|
33
|
-
this.storage =
|
|
34
|
-
options
|
|
35
|
-
|
|
36
|
-
: new SharedAFSStorage(options?.storage).withModule(this);
|
|
33
|
+
this.storage = isAFSStorage(options?.storage)
|
|
34
|
+
? options.storage
|
|
35
|
+
: new AFSStorageSQLite(this, options?.storage);
|
|
37
36
|
this.description = options.description || DEFAULT_DESCRIPTION;
|
|
38
37
|
this.accessMode = options.accessMode ?? "readwrite";
|
|
39
38
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/afs-user-profile-memory",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0-beta",
|
|
4
4
|
"description": "AIGNE AFS module for user profile memory",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -52,15 +52,16 @@
|
|
|
52
52
|
"zod": "^3.25.67",
|
|
53
53
|
"zod-to-json-schema": "^3.24.6",
|
|
54
54
|
"@aigne/afs": "^1.4.0",
|
|
55
|
-
"@aigne/afs-
|
|
56
|
-
"@aigne/core": "^1.
|
|
55
|
+
"@aigne/afs-utils": "^1.0.0",
|
|
56
|
+
"@aigne/core": "^1.73.0-beta",
|
|
57
|
+
"@aigne/afs-history": "^1.3.0-beta"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
60
|
"@types/bun": "^1.2.22",
|
|
60
61
|
"npm-run-all": "^4.1.5",
|
|
61
62
|
"rimraf": "^6.0.1",
|
|
62
63
|
"typescript": "^5.9.2",
|
|
63
|
-
"@aigne/test-utils": "^0.5.
|
|
64
|
+
"@aigne/test-utils": "^0.5.70-beta"
|
|
64
65
|
},
|
|
65
66
|
"scripts": {
|
|
66
67
|
"lint": "tsc --noEmit",
|