@haisto/opencode-mem 2.16.0-beta.3 → 2.16.0-beta.4

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,3 +1,5 @@
1
1
  import type { PluginInput } from "@opencode-ai/plugin";
2
+ import type { UserProfileData } from "./user-profile/types.js";
2
3
  export declare function performUserProfileLearning(ctx: PluginInput, directory: string): Promise<void>;
4
+ export declare function generateChangeSummary(oldProfile: UserProfileData, newProfile: UserProfileData): string;
3
5
  //# sourceMappingURL=user-memory-learning.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"user-memory-learning.d.ts","sourceRoot":"","sources":["../../src/services/user-memory-learning.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAWvD,wBAAsB,0BAA0B,CAC9C,GAAG,EAAE,WAAW,EAChB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAuEf"}
1
+ {"version":3,"file":"user-memory-learning.d.ts","sourceRoot":"","sources":["../../src/services/user-memory-learning.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAOvD,OAAO,KAAK,EAAe,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI5E,wBAAsB,0BAA0B,CAC9C,GAAG,EAAE,WAAW,EAChB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAuEf;AAED,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,eAAe,GAAG,MAAM,CAiCtG"}
@@ -53,17 +53,37 @@ export async function performUserProfileLearning(ctx, directory) {
53
53
  isLearningRunning = false;
54
54
  }
55
55
  }
56
- function generateChangeSummary(oldProfile, newProfile) {
56
+ export function generateChangeSummary(oldProfile, newProfile) {
57
57
  const changes = [];
58
- const prefDiff = newProfile.preferences.length - oldProfile.preferences.length;
59
- if (prefDiff > 0)
60
- changes.push(`+${prefDiff} preferences`);
61
- const patternDiff = newProfile.patterns.length - oldProfile.patterns.length;
62
- if (patternDiff > 0)
63
- changes.push(`+${patternDiff} patterns`);
64
- const workflowDiff = newProfile.workflows.length - oldProfile.workflows.length;
65
- if (workflowDiff > 0)
66
- changes.push(`+${workflowDiff} workflows`);
58
+ // 新增
59
+ const prefAdd = newProfile.preferences.length - oldProfile.preferences.length;
60
+ if (prefAdd > 0)
61
+ changes.push(`+${prefAdd} preferences`);
62
+ const patternAdd = newProfile.patterns.length - oldProfile.patterns.length;
63
+ if (patternAdd > 0)
64
+ changes.push(`+${patternAdd} patterns`);
65
+ const workflowAdd = newProfile.workflows.length - oldProfile.workflows.length;
66
+ if (workflowAdd > 0)
67
+ changes.push(`+${workflowAdd} workflows`);
68
+ // 修改:按 category 匹配,检测 description 变化
69
+ const modifiedPrefs = newProfile.preferences.filter((p) => {
70
+ const old = oldProfile.preferences.find((o) => o.category === p.category);
71
+ return old && old.description !== p.description;
72
+ }).length;
73
+ if (modifiedPrefs > 0)
74
+ changes.push(`${modifiedPrefs} preferences modified`);
75
+ const modifiedPatterns = newProfile.patterns.filter((p) => {
76
+ const old = oldProfile.patterns.find((o) => o.category === p.category);
77
+ return old && old.description !== p.description;
78
+ }).length;
79
+ if (modifiedPatterns > 0)
80
+ changes.push(`${modifiedPatterns} patterns modified`);
81
+ const modifiedWorkflows = newProfile.workflows.filter((w) => {
82
+ const old = oldProfile.workflows.find((o) => o.description === w.description);
83
+ return old && old.steps && w.steps && JSON.stringify(old.steps) !== JSON.stringify(w.steps);
84
+ }).length;
85
+ if (modifiedWorkflows > 0)
86
+ changes.push(`${modifiedWorkflows} workflows modified`);
67
87
  return changes.length > 0 ? changes.join(", ") : "Profile refinement";
68
88
  }
69
89
  function buildUserAnalysisContext(prompts, existingProfile) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haisto/opencode-mem",
3
- "version": "2.16.0-beta.3",
3
+ "version": "2.16.0-beta.4",
4
4
  "description": "OpenCode plugin that gives coding agents persistent memory using local vector database",
5
5
  "type": "module",
6
6
  "main": "dist/plugin.js",