@agentskit/memory 0.8.1 → 0.9.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/personalization.ts"],"names":[],"mappings":";;;AA0BO,SAAS,6BAAA,GAAsD;AACpE,EAAA,MAAM,QAAA,uBAAe,GAAA,EAAoC;AAEzD,EAAA,OAAO;AAAA,IACL,MAAM,IAAI,SAAA,EAAW;AACnB,MAAA,MAAM,GAAA,GAAM,QAAA,CAAS,GAAA,CAAI,SAAS,CAAA;AAClC,MAAA,OAAO,GAAA,GAAM,EAAE,GAAG,GAAA,EAAK,MAAA,EAAQ,EAAE,GAAG,GAAA,CAAI,MAAA,EAAO,EAAE,GAAI,IAAA;AAAA,IACvD,CAAA;AAAA,IACA,MAAM,IAAI,OAAA,EAAS;AACjB,MAAA,QAAA,CAAS,GAAA,CAAI,QAAQ,SAAA,EAAW;AAAA,QAC9B,GAAG,OAAA;AAAA,QACH,MAAA,EAAQ,EAAE,GAAG,OAAA,CAAQ,MAAA,EAAO;AAAA,QAC5B,WAAW,OAAA,CAAQ,SAAA,IAAA,iBAAa,IAAI,IAAA,IAAO,WAAA;AAAY,OACxD,CAAA;AAAA,IACH,CAAA;AAAA,IACA,MAAM,KAAA,CAAM,SAAA,EAAW,MAAA,EAAQ;AAC7B,MAAA,MAAM,QAAA,GAAW,QAAA,CAAS,GAAA,CAAI,SAAS,CAAA;AACvC,MAAA,MAAM,IAAA,GAA+B;AAAA,QACnC,SAAA;AAAA,QACA,MAAA,EAAQ,EAAE,GAAI,QAAA,EAAU,UAAU,EAAC,EAAI,GAAG,MAAA,EAAO;AAAA,QACjD,SAAA,EAAA,iBAAW,IAAI,IAAA,EAAK,EAAE,WAAA;AAAY,OACpC;AACA,MAAA,QAAA,CAAS,GAAA,CAAI,WAAW,IAAI,CAAA;AAC5B,MAAA,OAAO,EAAE,GAAG,IAAA,EAAM,MAAA,EAAQ,EAAE,GAAG,IAAA,CAAK,QAAO,EAAE;AAAA,IAC/C,CAAA;AAAA,IACA,MAAM,OAAO,SAAA,EAAW;AACtB,MAAA,QAAA,CAAS,OAAO,SAAS,CAAA;AAAA,IAC3B;AAAA,GACF;AACF;AAOO,SAAS,qBAAqB,OAAA,EAAgD;AACnF,EAAA,IAAI,CAAC,WAAW,MAAA,CAAO,IAAA,CAAK,QAAQ,MAAM,CAAA,CAAE,MAAA,KAAW,CAAA,EAAG,OAAO,EAAA;AACjE,EAAA,MAAM,QAAQ,MAAA,CAAO,OAAA,CAAQ,OAAA,CAAQ,MAAM,EACxC,MAAA,CAAO,CAAC,GAAG,KAAK,CAAA,KAAM,KAAA,KAAU,MAAA,IAAa,KAAA,KAAU,QAAQ,KAAA,KAAU,EAAE,CAAA,CAC3E,GAAA,CAAI,CAAC,CAAC,GAAA,EAAK,KAAK,CAAA,KAAM,KAAK,GAAG,CAAA,EAAA,EAAK,OAAO,KAAA,KAAU,WAAW,KAAA,GAAQ,IAAA,CAAK,SAAA,CAAU,KAAK,CAAC,CAAA,CAAE,CAAA;AACjG,EAAA,IAAI,KAAA,CAAM,MAAA,KAAW,CAAA,EAAG,OAAO,EAAA;AAC/B,EAAA,OAAO,CAAA;AAAA,EAAoB,KAAA,CAAM,IAAA,CAAK,IAAI,CAAC,CAAA,CAAA;AAC7C","file":"personalization.cjs","sourcesContent":["/**\n * Personalization — a persisted profile per subject (user id,\n * account id, device). The agent reads it on every run to\n * condition responses; the runtime updates it when new facts\n * appear.\n */\n\nexport interface PersonalizationProfile {\n subjectId: string\n /** Human-editable notes, facts, preferences. */\n traits: Record<string, unknown>\n /** ISO timestamp of the latest update. */\n updatedAt: string\n}\n\nexport interface PersonalizationStore {\n get: (subjectId: string) => Promise<PersonalizationProfile | null>\n set: (profile: PersonalizationProfile) => Promise<void>\n merge: (subjectId: string, traits: Record<string, unknown>) => Promise<PersonalizationProfile>\n delete?: (subjectId: string) => Promise<void>\n}\n\n/**\n * In-memory personalization store — tests, single-process demos.\n * Bring your own for production (Postgres, Redis, DynamoDB).\n */\nexport function createInMemoryPersonalization(): PersonalizationStore {\n const profiles = new Map<string, PersonalizationProfile>()\n\n return {\n async get(subjectId) {\n const hit = profiles.get(subjectId)\n return hit ? { ...hit, traits: { ...hit.traits } } : null\n },\n async set(profile) {\n profiles.set(profile.subjectId, {\n ...profile,\n traits: { ...profile.traits },\n updatedAt: profile.updatedAt || new Date().toISOString(),\n })\n },\n async merge(subjectId, traits) {\n const existing = profiles.get(subjectId)\n const next: PersonalizationProfile = {\n subjectId,\n traits: { ...(existing?.traits ?? {}), ...traits },\n updatedAt: new Date().toISOString(),\n }\n profiles.set(subjectId, next)\n return { ...next, traits: { ...next.traits } }\n },\n async delete(subjectId) {\n profiles.delete(subjectId)\n },\n }\n}\n\n/**\n * Render a profile into a system-prompt fragment the runtime can\n * prepend. Kept intentionally short — full profile dumps bloat\n * context and leak unnecessary detail to the model.\n */\nexport function renderProfileContext(profile: PersonalizationProfile | null): string {\n if (!profile || Object.keys(profile.traits).length === 0) return ''\n const lines = Object.entries(profile.traits)\n .filter(([, value]) => value !== undefined && value !== null && value !== '')\n .map(([key, value]) => `- ${key}: ${typeof value === 'string' ? value : JSON.stringify(value)}`)\n if (lines.length === 0) return ''\n return `## User profile\\n${lines.join('\\n')}`\n}\n"]}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Personalization — a persisted profile per subject (user id,
3
+ * account id, device). The agent reads it on every run to
4
+ * condition responses; the runtime updates it when new facts
5
+ * appear.
6
+ */
7
+ interface PersonalizationProfile {
8
+ subjectId: string;
9
+ /** Human-editable notes, facts, preferences. */
10
+ traits: Record<string, unknown>;
11
+ /** ISO timestamp of the latest update. */
12
+ updatedAt: string;
13
+ }
14
+ interface PersonalizationStore {
15
+ get: (subjectId: string) => Promise<PersonalizationProfile | null>;
16
+ set: (profile: PersonalizationProfile) => Promise<void>;
17
+ merge: (subjectId: string, traits: Record<string, unknown>) => Promise<PersonalizationProfile>;
18
+ delete?: (subjectId: string) => Promise<void>;
19
+ }
20
+ /**
21
+ * In-memory personalization store — tests, single-process demos.
22
+ * Bring your own for production (Postgres, Redis, DynamoDB).
23
+ */
24
+ declare function createInMemoryPersonalization(): PersonalizationStore;
25
+ /**
26
+ * Render a profile into a system-prompt fragment the runtime can
27
+ * prepend. Kept intentionally short — full profile dumps bloat
28
+ * context and leak unnecessary detail to the model.
29
+ */
30
+ declare function renderProfileContext(profile: PersonalizationProfile | null): string;
31
+
32
+ export { type PersonalizationProfile, type PersonalizationStore, createInMemoryPersonalization, renderProfileContext };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Personalization — a persisted profile per subject (user id,
3
+ * account id, device). The agent reads it on every run to
4
+ * condition responses; the runtime updates it when new facts
5
+ * appear.
6
+ */
7
+ interface PersonalizationProfile {
8
+ subjectId: string;
9
+ /** Human-editable notes, facts, preferences. */
10
+ traits: Record<string, unknown>;
11
+ /** ISO timestamp of the latest update. */
12
+ updatedAt: string;
13
+ }
14
+ interface PersonalizationStore {
15
+ get: (subjectId: string) => Promise<PersonalizationProfile | null>;
16
+ set: (profile: PersonalizationProfile) => Promise<void>;
17
+ merge: (subjectId: string, traits: Record<string, unknown>) => Promise<PersonalizationProfile>;
18
+ delete?: (subjectId: string) => Promise<void>;
19
+ }
20
+ /**
21
+ * In-memory personalization store — tests, single-process demos.
22
+ * Bring your own for production (Postgres, Redis, DynamoDB).
23
+ */
24
+ declare function createInMemoryPersonalization(): PersonalizationStore;
25
+ /**
26
+ * Render a profile into a system-prompt fragment the runtime can
27
+ * prepend. Kept intentionally short — full profile dumps bloat
28
+ * context and leak unnecessary detail to the model.
29
+ */
30
+ declare function renderProfileContext(profile: PersonalizationProfile | null): string;
31
+
32
+ export { type PersonalizationProfile, type PersonalizationStore, createInMemoryPersonalization, renderProfileContext };
@@ -0,0 +1,3 @@
1
+ export { createInMemoryPersonalization, renderProfileContext } from './chunk-G5S2A3MJ.js';
2
+ //# sourceMappingURL=personalization.js.map
3
+ //# sourceMappingURL=personalization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"personalization.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentskit/memory",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "description": "Persistent and vector memory backends for AgentsKit.",
5
5
  "keywords": [
6
6
  "agentskit",
@@ -23,6 +23,7 @@
23
23
  "persistence"
24
24
  ],
25
25
  "type": "module",
26
+ "sideEffects": false,
26
27
  "main": "./dist/index.cjs",
27
28
  "module": "./dist/index.js",
28
29
  "types": "./dist/index.d.ts",
@@ -31,6 +32,11 @@
31
32
  "types": "./dist/index.d.ts",
32
33
  "import": "./dist/index.js",
33
34
  "require": "./dist/index.cjs"
35
+ },
36
+ "./personalization": {
37
+ "types": "./dist/personalization.d.ts",
38
+ "import": "./dist/personalization.js",
39
+ "require": "./dist/personalization.cjs"
34
40
  }
35
41
  },
36
42
  "files": [
@@ -40,17 +46,17 @@
40
46
  "access": "public"
41
47
  },
42
48
  "dependencies": {
43
- "@agentskit/core": "1.7.1"
49
+ "@agentskit/core": "1.8.0"
44
50
  },
45
51
  "devDependencies": {
46
- "@types/better-sqlite3": "^7.6.12",
47
- "@types/node": "^25.6.0",
48
- "better-sqlite3": "^12.9.0",
49
- "redis": "^5.12.1",
50
- "tsup": "^8.5.0",
52
+ "@types/better-sqlite3": "^7.6.13",
53
+ "@types/node": "^25.9.2",
54
+ "better-sqlite3": "^12.10.0",
55
+ "redis": "^6.0.0",
56
+ "tsup": "^8.5.1",
51
57
  "typescript": "^6.0.3",
52
- "vectra": "^0.14.0",
53
- "vitest": "^4.1.5"
58
+ "vectra": "^0.15.0",
59
+ "vitest": "^4.1.8"
54
60
  },
55
61
  "agentskit": {
56
62
  "stability": "stable",