koishi-plugin-chatluna-long-memory 1.3.3 → 1.3.5

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/lib/index.cjs CHANGED
@@ -2073,7 +2073,7 @@ var STOP_WORDS = /* @__PURE__ */ new Set([
2073
2073
  ]);
2074
2074
  function format(items) {
2075
2075
  return items.map((item) => String(item).trim().replace(/\s+/g, " ")).filter(Boolean).map(
2076
- (item) => /^[\x00-\x7F]+$/.test(item) ? item.toLowerCase() : item
2076
+ (item) => Array.from(item).every((char) => char.charCodeAt(0) <= 127) ? item.toLowerCase() : item
2077
2077
  );
2078
2078
  }
2079
2079
  __name(format, "format");
@@ -2945,36 +2945,85 @@ function buildMemoryInfo(config) {
2945
2945
  }
2946
2946
  __name(buildMemoryInfo, "buildMemoryInfo");
2947
2947
  async function apply10(ctx, config, plugin) {
2948
+ const params = { embeddings: void 0 };
2948
2949
  plugin.registerTool("memory_search", {
2950
+ description: new MemorySearchTool(ctx, params).description,
2949
2951
  selector(history) {
2950
2952
  return true;
2951
2953
  },
2952
- createTool(params) {
2953
- return new MemorySearchTool(ctx, params);
2954
+ meta: {
2955
+ source: "extension",
2956
+ group: "long-memory",
2957
+ tags: ["long-memory", "search"],
2958
+ defaultAvailability: {
2959
+ enabled: true,
2960
+ main: true,
2961
+ chatluna: true,
2962
+ characterScope: "none"
2963
+ }
2964
+ },
2965
+ createTool(params2) {
2966
+ return new MemorySearchTool(ctx, params2);
2954
2967
  }
2955
2968
  });
2956
2969
  plugin.registerTool("memory_add", {
2970
+ description: new MemoryAddTool(ctx, params).description,
2957
2971
  selector(history) {
2958
2972
  return true;
2959
2973
  },
2960
- createTool(params) {
2961
- return new MemoryAddTool(ctx, params);
2974
+ meta: {
2975
+ source: "extension",
2976
+ group: "long-memory",
2977
+ tags: ["long-memory", "add"],
2978
+ defaultAvailability: {
2979
+ enabled: true,
2980
+ main: true,
2981
+ chatluna: true,
2982
+ characterScope: "all"
2983
+ }
2984
+ },
2985
+ createTool(params2) {
2986
+ return new MemoryAddTool(ctx, params2);
2962
2987
  }
2963
2988
  });
2964
2989
  plugin.registerTool("memory_delete", {
2990
+ description: new MemoryDeleteTool(ctx, params).description,
2965
2991
  selector(history) {
2966
2992
  return true;
2967
2993
  },
2968
- createTool(params) {
2969
- return new MemoryDeleteTool(ctx, params);
2994
+ meta: {
2995
+ source: "extension",
2996
+ group: "long-memory",
2997
+ tags: ["long-memory", "delete"],
2998
+ defaultAvailability: {
2999
+ enabled: true,
3000
+ main: true,
3001
+ chatluna: true,
3002
+ characterScope: "all"
3003
+ }
3004
+ },
3005
+ createTool(params2) {
3006
+ return new MemoryDeleteTool(ctx, params2);
2970
3007
  }
2971
3008
  });
2972
3009
  plugin.registerTool("memory_update", {
3010
+ description: new MemoryUpdateTool(ctx, params).description,
2973
3011
  selector(history) {
2974
3012
  return true;
2975
3013
  },
2976
- createTool(params) {
2977
- return new MemoryUpdateTool(ctx, params);
3014
+ meta: {
3015
+ source: "extension",
3016
+ group: "long-memory",
3017
+ tags: ["long-memory", "update"],
3018
+ defaultAvailability: {
3019
+ enabled: true,
3020
+ main: true,
3021
+ chatluna: true,
3022
+ characterScope: "all"
3023
+ }
3024
+ },
3025
+ createTool(params2) {
3026
+ return new MemoryUpdateTool(ctx, params2);
2978
3027
  }
2979
3028
  });
2980
3029
  }
package/lib/index.mjs CHANGED
@@ -2036,7 +2036,7 @@ var STOP_WORDS = /* @__PURE__ */ new Set([
2036
2036
  ]);
2037
2037
  function format(items) {
2038
2038
  return items.map((item) => String(item).trim().replace(/\s+/g, " ")).filter(Boolean).map(
2039
- (item) => /^[\x00-\x7F]+$/.test(item) ? item.toLowerCase() : item
2039
+ (item) => Array.from(item).every((char) => char.charCodeAt(0) <= 127) ? item.toLowerCase() : item
2040
2040
  );
2041
2041
  }
2042
2042
  __name(format, "format");
@@ -2908,36 +2908,85 @@ function buildMemoryInfo(config) {
2908
2908
  }
2909
2909
  __name(buildMemoryInfo, "buildMemoryInfo");
2910
2910
  async function apply10(ctx, config, plugin) {
2911
+ const params = { embeddings: void 0 };
2911
2912
  plugin.registerTool("memory_search", {
2913
+ description: new MemorySearchTool(ctx, params).description,
2912
2914
  selector(history) {
2913
2915
  return true;
2914
2916
  },
2915
- createTool(params) {
2916
- return new MemorySearchTool(ctx, params);
2917
+ meta: {
2918
+ source: "extension",
2919
+ group: "long-memory",
2920
+ tags: ["long-memory", "search"],
2921
+ defaultAvailability: {
2922
+ enabled: true,
2923
+ main: true,
2924
+ chatluna: true,
2925
+ characterScope: "none"
2926
+ }
2927
+ },
2928
+ createTool(params2) {
2929
+ return new MemorySearchTool(ctx, params2);
2917
2930
  }
2918
2931
  });
2919
2932
  plugin.registerTool("memory_add", {
2933
+ description: new MemoryAddTool(ctx, params).description,
2920
2934
  selector(history) {
2921
2935
  return true;
2922
2936
  },
2923
- createTool(params) {
2924
- return new MemoryAddTool(ctx, params);
2937
+ meta: {
2938
+ source: "extension",
2939
+ group: "long-memory",
2940
+ tags: ["long-memory", "add"],
2941
+ defaultAvailability: {
2942
+ enabled: true,
2943
+ main: true,
2944
+ chatluna: true,
2945
+ characterScope: "all"
2946
+ }
2947
+ },
2948
+ createTool(params2) {
2949
+ return new MemoryAddTool(ctx, params2);
2925
2950
  }
2926
2951
  });
2927
2952
  plugin.registerTool("memory_delete", {
2953
+ description: new MemoryDeleteTool(ctx, params).description,
2928
2954
  selector(history) {
2929
2955
  return true;
2930
2956
  },
2931
- createTool(params) {
2932
- return new MemoryDeleteTool(ctx, params);
2957
+ meta: {
2958
+ source: "extension",
2959
+ group: "long-memory",
2960
+ tags: ["long-memory", "delete"],
2961
+ defaultAvailability: {
2962
+ enabled: true,
2963
+ main: true,
2964
+ chatluna: true,
2965
+ characterScope: "all"
2966
+ }
2967
+ },
2968
+ createTool(params2) {
2969
+ return new MemoryDeleteTool(ctx, params2);
2933
2970
  }
2934
2971
  });
2935
2972
  plugin.registerTool("memory_update", {
2973
+ description: new MemoryUpdateTool(ctx, params).description,
2936
2974
  selector(history) {
2937
2975
  return true;
2938
2976
  },
2939
- createTool(params) {
2940
- return new MemoryUpdateTool(ctx, params);
2977
+ meta: {
2978
+ source: "extension",
2979
+ group: "long-memory",
2980
+ tags: ["long-memory", "update"],
2981
+ defaultAvailability: {
2982
+ enabled: true,
2983
+ main: true,
2984
+ chatluna: true,
2985
+ characterScope: "all"
2986
+ }
2987
+ },
2988
+ createTool(params2) {
2989
+ return new MemoryUpdateTool(ctx, params2);
2941
2990
  }
2942
2991
  });
2943
2992
  }
@@ -15,10 +15,10 @@ export declare class MemorySearchTool extends StructuredTool {
15
15
  layer: z.ZodArray<z.ZodUnion<[z.ZodLiteral<"user">, z.ZodLiteral<"preset">, z.ZodLiteral<"guild">, z.ZodLiteral<"global">]>, "many">;
16
16
  }, "strip", z.ZodTypeAny, {
17
17
  content?: string;
18
- layer?: ("global" | "preset" | "user" | "guild")[];
18
+ layer?: ("user" | "preset" | "guild" | "global")[];
19
19
  }, {
20
20
  content?: string;
21
- layer?: ("global" | "preset" | "user" | "guild")[];
21
+ layer?: ("user" | "preset" | "guild" | "global")[];
22
22
  }>;
23
23
  constructor(ctx: Context, params: CreateToolParams);
24
24
  /** @ignore */
@@ -45,14 +45,14 @@ export declare class MemoryAddTool extends StructuredTool {
45
45
  }>, "many">;
46
46
  layer: z.ZodArray<z.ZodUnion<[z.ZodLiteral<"user">, z.ZodLiteral<"preset">, z.ZodLiteral<"guild">, z.ZodLiteral<"global">]>, "many">;
47
47
  }, "strip", z.ZodTypeAny, {
48
- layer?: ("global" | "preset" | "user" | "guild")[];
48
+ layer?: ("user" | "preset" | "guild" | "global")[];
49
49
  memories?: {
50
50
  content?: string;
51
51
  type?: MemoryType;
52
52
  importance?: number;
53
53
  }[];
54
54
  }, {
55
- layer?: ("global" | "preset" | "user" | "guild")[];
55
+ layer?: ("user" | "preset" | "guild" | "global")[];
56
56
  memories?: {
57
57
  content?: string;
58
58
  type?: MemoryType;
@@ -72,10 +72,10 @@ export declare class MemoryDeleteTool extends StructuredTool {
72
72
  memoryIds: z.ZodArray<z.ZodString, "many">;
73
73
  layer: z.ZodArray<z.ZodUnion<[z.ZodLiteral<"user">, z.ZodLiteral<"preset">, z.ZodLiteral<"guild">, z.ZodLiteral<"global">]>, "many">;
74
74
  }, "strip", z.ZodTypeAny, {
75
- layer?: ("global" | "preset" | "user" | "guild")[];
75
+ layer?: ("user" | "preset" | "guild" | "global")[];
76
76
  memoryIds?: string[];
77
77
  }, {
78
- layer?: ("global" | "preset" | "user" | "guild")[];
78
+ layer?: ("user" | "preset" | "guild" | "global")[];
79
79
  memoryIds?: string[];
80
80
  }>;
81
81
  constructor(ctx: Context, params: CreateToolParams);
@@ -104,7 +104,7 @@ export declare class MemoryUpdateTool extends StructuredTool {
104
104
  }>, "many">;
105
105
  layer: z.ZodArray<z.ZodUnion<[z.ZodLiteral<"user">, z.ZodLiteral<"preset">, z.ZodLiteral<"guild">, z.ZodLiteral<"global">]>, "many">;
106
106
  }, "strip", z.ZodTypeAny, {
107
- layer?: ("global" | "preset" | "user" | "guild")[];
107
+ layer?: ("user" | "preset" | "guild" | "global")[];
108
108
  memoryIds?: string[];
109
109
  newMemories?: {
110
110
  content?: string;
@@ -112,7 +112,7 @@ export declare class MemoryUpdateTool extends StructuredTool {
112
112
  importance?: number;
113
113
  }[];
114
114
  }, {
115
- layer?: ("global" | "preset" | "user" | "guild")[];
115
+ layer?: ("user" | "preset" | "guild" | "global")[];
116
116
  memoryIds?: string[];
117
117
  newMemories?: {
118
118
  content?: string;
@@ -0,0 +1,14 @@
1
+ import { Context, Session } from 'koishi';
2
+ export declare function getMemoryScope(ctx: Context, session: Session, options: {
3
+ conversationId?: string;
4
+ presetLane?: string;
5
+ type?: string;
6
+ }): Promise<{
7
+ conversation: Parameters<Context['chatluna']['clearCache']>[0];
8
+ preset: string;
9
+ info: {
10
+ presetId: string;
11
+ guildId: string;
12
+ userId: string;
13
+ };
14
+ } | null>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-chatluna-long-memory",
3
3
  "description": "long memory for chatluna",
4
- "version": "1.3.3",
4
+ "version": "1.3.5",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "lib/index.mjs",
7
7
  "typings": "lib/index.d.ts",
@@ -62,7 +62,7 @@
62
62
  },
63
63
  "peerDependencies": {
64
64
  "koishi": "^4.18.9",
65
- "koishi-plugin-chatluna": "^1.3.33"
65
+ "koishi-plugin-chatluna": "^1.3.36"
66
66
  },
67
67
  "resolutions": {
68
68
  "@langchain/core": "^0.3.80",