@prmichaelsen/remember-core 0.12.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.
- package/README.md +100 -0
- package/dist/collections/composite-ids.d.ts +47 -0
- package/dist/collections/composite-ids.d.ts.map +1 -0
- package/dist/collections/composite-ids.js +97 -0
- package/dist/collections/composite-ids.js.map +1 -0
- package/dist/collections/dot-notation.d.ts +37 -0
- package/dist/collections/dot-notation.d.ts.map +1 -0
- package/dist/collections/dot-notation.js +100 -0
- package/dist/collections/dot-notation.js.map +1 -0
- package/dist/collections/index.d.ts +7 -0
- package/dist/collections/index.d.ts.map +1 -0
- package/dist/collections/index.js +7 -0
- package/dist/collections/index.js.map +1 -0
- package/dist/collections/tracking-arrays.d.ts +28 -0
- package/dist/collections/tracking-arrays.d.ts.map +1 -0
- package/dist/collections/tracking-arrays.js +67 -0
- package/dist/collections/tracking-arrays.js.map +1 -0
- package/dist/config/debug.d.ts +36 -0
- package/dist/config/debug.d.ts.map +1 -0
- package/dist/config/debug.js +48 -0
- package/dist/config/debug.js.map +1 -0
- package/dist/config/environment.d.ts +71 -0
- package/dist/config/environment.d.ts.map +1 -0
- package/dist/config/environment.js +57 -0
- package/dist/config/environment.js.map +1 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +27 -0
- package/dist/config/index.js.map +1 -0
- package/dist/constants/content-types.d.ts +60 -0
- package/dist/constants/content-types.d.ts.map +1 -0
- package/dist/constants/content-types.js +450 -0
- package/dist/constants/content-types.js.map +1 -0
- package/dist/constants/index.d.ts +3 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +3 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/database/firestore/index.d.ts +8 -0
- package/dist/database/firestore/index.d.ts.map +1 -0
- package/dist/database/firestore/index.js +10 -0
- package/dist/database/firestore/index.js.map +1 -0
- package/dist/database/firestore/init.d.ts +51 -0
- package/dist/database/firestore/init.d.ts.map +1 -0
- package/dist/database/firestore/init.js +92 -0
- package/dist/database/firestore/init.js.map +1 -0
- package/dist/database/firestore/paths.d.ts +54 -0
- package/dist/database/firestore/paths.d.ts.map +1 -0
- package/dist/database/firestore/paths.js +103 -0
- package/dist/database/firestore/paths.js.map +1 -0
- package/dist/database/weaviate/client.d.ts +68 -0
- package/dist/database/weaviate/client.d.ts.map +1 -0
- package/dist/database/weaviate/client.js +157 -0
- package/dist/database/weaviate/client.js.map +1 -0
- package/dist/database/weaviate/index.d.ts +6 -0
- package/dist/database/weaviate/index.d.ts.map +1 -0
- package/dist/database/weaviate/index.js +9 -0
- package/dist/database/weaviate/index.js.map +1 -0
- package/dist/database/weaviate/schema.d.ts +22 -0
- package/dist/database/weaviate/schema.d.ts.map +1 -0
- package/dist/database/weaviate/schema.js +50 -0
- package/dist/database/weaviate/schema.js.map +1 -0
- package/dist/database/weaviate/space-schema.d.ts +36 -0
- package/dist/database/weaviate/space-schema.d.ts.map +1 -0
- package/dist/database/weaviate/space-schema.js +65 -0
- package/dist/database/weaviate/space-schema.js.map +1 -0
- package/dist/database/weaviate/v2-collections.d.ts +160 -0
- package/dist/database/weaviate/v2-collections.d.ts.map +1 -0
- package/dist/database/weaviate/v2-collections.js +275 -0
- package/dist/database/weaviate/v2-collections.js.map +1 -0
- package/dist/errors/app-errors.d.ts +64 -0
- package/dist/errors/app-errors.d.ts.map +1 -0
- package/dist/errors/app-errors.js +90 -0
- package/dist/errors/app-errors.js.map +1 -0
- package/dist/errors/base.error.d.ts +15 -0
- package/dist/errors/base.error.d.ts.map +1 -0
- package/dist/errors/base.error.js +25 -0
- package/dist/errors/base.error.js.map +1 -0
- package/dist/errors/index.d.ts +19 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +25 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/services/confirmation-token.service.d.ts +56 -0
- package/dist/services/confirmation-token.service.d.ts.map +1 -0
- package/dist/services/confirmation-token.service.js +118 -0
- package/dist/services/confirmation-token.service.js.map +1 -0
- package/dist/services/credentials-provider.d.ts +25 -0
- package/dist/services/credentials-provider.d.ts.map +1 -0
- package/dist/services/credentials-provider.js +31 -0
- package/dist/services/credentials-provider.js.map +1 -0
- package/dist/services/index.d.ts +11 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +17 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/memory.service.d.ts +129 -0
- package/dist/services/memory.service.d.ts.map +1 -0
- package/dist/services/memory.service.js +294 -0
- package/dist/services/memory.service.js.map +1 -0
- package/dist/services/preferences.service.d.ts +27 -0
- package/dist/services/preferences.service.d.ts.map +1 -0
- package/dist/services/preferences.service.js +106 -0
- package/dist/services/preferences.service.js.map +1 -0
- package/dist/services/relationship.service.d.ts +75 -0
- package/dist/services/relationship.service.d.ts.map +1 -0
- package/dist/services/relationship.service.js +211 -0
- package/dist/services/relationship.service.js.map +1 -0
- package/dist/services/space-config.service.d.ts +22 -0
- package/dist/services/space-config.service.d.ts.map +1 -0
- package/dist/services/space-config.service.js +50 -0
- package/dist/services/space-config.service.js.map +1 -0
- package/dist/services/space.service.d.ts +160 -0
- package/dist/services/space.service.d.ts.map +1 -0
- package/dist/services/space.service.js +815 -0
- package/dist/services/space.service.js.map +1 -0
- package/dist/testing/index.d.ts +8 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +8 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/test-data-generator.d.ts +100 -0
- package/dist/testing/test-data-generator.d.ts.map +1 -0
- package/dist/testing/test-data-generator.js +194 -0
- package/dist/testing/test-data-generator.js.map +1 -0
- package/dist/testing/weaviate-mock.d.ts +317 -0
- package/dist/testing/weaviate-mock.d.ts.map +1 -0
- package/dist/testing/weaviate-mock.js +233 -0
- package/dist/testing/weaviate-mock.js.map +1 -0
- package/dist/types/auth.types.d.ts +36 -0
- package/dist/types/auth.types.d.ts.map +1 -0
- package/dist/types/auth.types.js +9 -0
- package/dist/types/auth.types.js.map +1 -0
- package/dist/types/context.types.d.ts +78 -0
- package/dist/types/context.types.d.ts.map +1 -0
- package/dist/types/context.types.js +6 -0
- package/dist/types/context.types.js.map +1 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/llm.types.d.ts +8 -0
- package/dist/types/llm.types.d.ts.map +1 -0
- package/dist/types/llm.types.js +8 -0
- package/dist/types/llm.types.js.map +1 -0
- package/dist/types/memory.types.d.ts +83 -0
- package/dist/types/memory.types.d.ts.map +1 -0
- package/dist/types/memory.types.js +6 -0
- package/dist/types/memory.types.js.map +1 -0
- package/dist/types/preferences.types.d.ts +285 -0
- package/dist/types/preferences.types.d.ts.map +1 -0
- package/dist/types/preferences.types.js +195 -0
- package/dist/types/preferences.types.js.map +1 -0
- package/dist/types/result.types.d.ts +60 -0
- package/dist/types/result.types.d.ts.map +1 -0
- package/dist/types/result.types.js +82 -0
- package/dist/types/result.types.js.map +1 -0
- package/dist/types/search.types.d.ts +49 -0
- package/dist/types/search.types.d.ts.map +1 -0
- package/dist/types/search.types.js +6 -0
- package/dist/types/search.types.js.map +1 -0
- package/dist/types/shared.types.d.ts +91 -0
- package/dist/types/shared.types.d.ts.map +1 -0
- package/dist/types/shared.types.js +57 -0
- package/dist/types/shared.types.js.map +1 -0
- package/dist/types/space.types.d.ts +82 -0
- package/dist/types/space.types.d.ts.map +1 -0
- package/dist/types/space.types.js +18 -0
- package/dist/types/space.types.js.map +1 -0
- package/dist/types/utils.types.d.ts +51 -0
- package/dist/types/utils.types.d.ts.map +1 -0
- package/dist/types/utils.types.js +4 -0
- package/dist/types/utils.types.js.map +1 -0
- package/dist/utils/auth-helpers.d.ts +23 -0
- package/dist/utils/auth-helpers.d.ts.map +1 -0
- package/dist/utils/auth-helpers.js +31 -0
- package/dist/utils/auth-helpers.js.map +1 -0
- package/dist/utils/debug.d.ts +45 -0
- package/dist/utils/debug.d.ts.map +1 -0
- package/dist/utils/debug.js +112 -0
- package/dist/utils/debug.js.map +1 -0
- package/dist/utils/error-handler.d.ts +46 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +63 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/filters.d.ts +42 -0
- package/dist/utils/filters.d.ts.map +1 -0
- package/dist/utils/filters.js +132 -0
- package/dist/utils/filters.js.map +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +9 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +22 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +68 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +100 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Space Memory type definitions for remember-core.
|
|
3
|
+
* Ported from remember-mcp/src/types/space-memory.ts
|
|
4
|
+
*
|
|
5
|
+
* Space memories are memories published to shared collections
|
|
6
|
+
* where they can be discovered by other users.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Space display names mapped to IDs
|
|
10
|
+
*/
|
|
11
|
+
export const SPACE_DISPLAY_NAMES = {
|
|
12
|
+
the_void: 'The Void',
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Supported spaces constant
|
|
16
|
+
*/
|
|
17
|
+
export const SUPPORTED_SPACES = ['the_void'];
|
|
18
|
+
//# sourceMappingURL=space.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"space.types.js","sourceRoot":"","sources":["../../src/types/space.types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAiFH;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAA4B;IAC1D,QAAQ,EAAE,UAAU;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAc,CAAC,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Makes all properties optional recursively.
|
|
3
|
+
* Use for test fixture factories and config merge helpers.
|
|
4
|
+
*/
|
|
5
|
+
export type DeepPartial<T> = T extends object ? {
|
|
6
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
7
|
+
} : T;
|
|
8
|
+
/**
|
|
9
|
+
* Adds null to a type
|
|
10
|
+
*/
|
|
11
|
+
export type Nullable<T> = T | null;
|
|
12
|
+
/**
|
|
13
|
+
* Adds undefined to a type
|
|
14
|
+
*/
|
|
15
|
+
export type Optional<T> = T | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Adds null and undefined to a type
|
|
18
|
+
*/
|
|
19
|
+
export type Maybe<T> = T | null | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Gets the resolved value of a Promise
|
|
22
|
+
*/
|
|
23
|
+
export type Awaited<T> = T extends Promise<infer U> ? U : T;
|
|
24
|
+
/**
|
|
25
|
+
* Gets the return type of an async function
|
|
26
|
+
*/
|
|
27
|
+
export type AsyncReturnType<T extends (...args: any[]) => Promise<any>> = Awaited<ReturnType<T>>;
|
|
28
|
+
/**
|
|
29
|
+
* Makes specific keys required, leaves the rest optional
|
|
30
|
+
*/
|
|
31
|
+
export type RequireFields<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
|
32
|
+
/**
|
|
33
|
+
* Makes specific keys optional, leaves the rest required
|
|
34
|
+
*/
|
|
35
|
+
export type OptionalFields<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
36
|
+
/**
|
|
37
|
+
* Gets the value types of T as a union
|
|
38
|
+
*/
|
|
39
|
+
export type Values<T> = T[keyof T];
|
|
40
|
+
/**
|
|
41
|
+
* A type that can be instantiated with `new`
|
|
42
|
+
*/
|
|
43
|
+
export type Constructor<T = object, Args extends any[] = any[]> = new (...args: Args) => T;
|
|
44
|
+
/**
|
|
45
|
+
* Makes all properties and nested properties readonly.
|
|
46
|
+
* Use for config objects and frozen state that should not be mutated.
|
|
47
|
+
*/
|
|
48
|
+
export type Immutable<T> = {
|
|
49
|
+
readonly [K in keyof T]: T[K] extends object ? Immutable<T[K]> : T[K];
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=utils.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.types.d.ts","sourceRoot":"","sources":["../../src/types/utils.types.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GACzC;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACtC,CAAC,CAAC;AAEN;;GAEG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAEnC;;GAEG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;AAExC;;GAEG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,IACpE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAC5C,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAEpC;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAC7C,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAEnC;;GAEG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAEnC;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,MAAM,EAAE,IAAI,SAAS,GAAG,EAAE,GAAG,GAAG,EAAE,IAAI,KAAK,GAAG,IAAI,EAAE,IAAI,KAAK,CAAC,CAAC;AAE3F;;;GAGG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI;IACzB,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACtE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.types.js","sourceRoot":"","sources":["../../src/types/utils.types.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,6DAA6D"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth helper utilities for permission checking.
|
|
3
|
+
*
|
|
4
|
+
* Ported from remember-mcp/src/utils/auth-helpers.ts.
|
|
5
|
+
*/
|
|
6
|
+
import type { AuthContext } from '../types/auth.types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Check if the user has can_moderate permission for a specific group.
|
|
9
|
+
*
|
|
10
|
+
* @param authContext - The current auth context (may be undefined if unauthenticated)
|
|
11
|
+
* @param groupId - The group to check moderation permissions for
|
|
12
|
+
* @returns true if user can moderate the specified group
|
|
13
|
+
*/
|
|
14
|
+
export declare function canModerate(authContext: AuthContext | undefined, groupId: string): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Check if the user has can_moderate permission for ANY group.
|
|
17
|
+
* Useful for space-level moderation where there's no specific group context.
|
|
18
|
+
*
|
|
19
|
+
* @param authContext - The current auth context (may be undefined if unauthenticated)
|
|
20
|
+
* @returns true if user can moderate at least one group
|
|
21
|
+
*/
|
|
22
|
+
export declare function canModerateAny(authContext: AuthContext | undefined): boolean;
|
|
23
|
+
//# sourceMappingURL=auth-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/auth-helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,WAAW,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAM1F;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,WAAW,GAAG,SAAS,GAAG,OAAO,CAK5E"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth helper utilities for permission checking.
|
|
3
|
+
*
|
|
4
|
+
* Ported from remember-mcp/src/utils/auth-helpers.ts.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Check if the user has can_moderate permission for a specific group.
|
|
8
|
+
*
|
|
9
|
+
* @param authContext - The current auth context (may be undefined if unauthenticated)
|
|
10
|
+
* @param groupId - The group to check moderation permissions for
|
|
11
|
+
* @returns true if user can moderate the specified group
|
|
12
|
+
*/
|
|
13
|
+
export function canModerate(authContext, groupId) {
|
|
14
|
+
if (!authContext?.credentials)
|
|
15
|
+
return false;
|
|
16
|
+
const membership = authContext.credentials.group_memberships.find((m) => m.group_id === groupId);
|
|
17
|
+
return membership?.permissions.can_moderate ?? false;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Check if the user has can_moderate permission for ANY group.
|
|
21
|
+
* Useful for space-level moderation where there's no specific group context.
|
|
22
|
+
*
|
|
23
|
+
* @param authContext - The current auth context (may be undefined if unauthenticated)
|
|
24
|
+
* @returns true if user can moderate at least one group
|
|
25
|
+
*/
|
|
26
|
+
export function canModerateAny(authContext) {
|
|
27
|
+
if (!authContext?.credentials)
|
|
28
|
+
return false;
|
|
29
|
+
return authContext.credentials.group_memberships.some((m) => m.permissions.can_moderate);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=auth-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-helpers.js","sourceRoot":"","sources":["../../src/utils/auth-helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,WAAoC,EAAE,OAAe;IAC/E,IAAI,CAAC,WAAW,EAAE,WAAW;QAAE,OAAO,KAAK,CAAC;IAC5C,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,iBAAiB,CAAC,IAAI,CAC/D,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO,CAC9B,CAAC;IACF,OAAO,UAAU,EAAE,WAAW,CAAC,YAAY,IAAI,KAAK,CAAC;AACvD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,WAAoC;IACjE,IAAI,CAAC,WAAW,EAAE,WAAW;QAAE,OAAO,KAAK,CAAC;IAC5C,OAAO,WAAW,CAAC,WAAW,CAAC,iBAAiB,CAAC,IAAI,CACnD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,YAAY,CAClC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Debug logging utility for remember-core.
|
|
3
|
+
*
|
|
4
|
+
* Ported from remember-mcp/src/utils/debug.ts.
|
|
5
|
+
* Design: DebugLogger takes a Logger instance and DebugConfig, no hard dependencies.
|
|
6
|
+
*/
|
|
7
|
+
import type { Logger } from './logger.js';
|
|
8
|
+
import type { DebugConfig } from '../config/debug.js';
|
|
9
|
+
export interface DebugContext {
|
|
10
|
+
tool: string;
|
|
11
|
+
userId?: string;
|
|
12
|
+
operation?: string;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
export declare class DebugLogger {
|
|
16
|
+
private context;
|
|
17
|
+
private logger;
|
|
18
|
+
private debugConfig;
|
|
19
|
+
constructor(context: DebugContext, logger: Logger, debugConfig: DebugConfig);
|
|
20
|
+
trace(message: string, data?: Record<string, unknown>): void;
|
|
21
|
+
debug(message: string, data?: Record<string, unknown>): void;
|
|
22
|
+
info(message: string, data?: Record<string, unknown>): void;
|
|
23
|
+
warn(message: string, data?: Record<string, unknown>): void;
|
|
24
|
+
error(message: string, data?: Record<string, unknown>): void;
|
|
25
|
+
/**
|
|
26
|
+
* Dump full object (TRACE only).
|
|
27
|
+
* Use with caution — may expose sensitive data.
|
|
28
|
+
*/
|
|
29
|
+
dump(label: string, obj: unknown): void;
|
|
30
|
+
/**
|
|
31
|
+
* Time an async operation (DEBUG and above).
|
|
32
|
+
* Logs start, completion, and duration.
|
|
33
|
+
*/
|
|
34
|
+
time<T>(label: string, fn: () => Promise<T>): Promise<T>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Create a debug logger with context.
|
|
38
|
+
*
|
|
39
|
+
* @param context - Context information (tool name, userId, operation, etc.)
|
|
40
|
+
* @param logger - Logger instance to use for output
|
|
41
|
+
* @param debugConfig - Debug configuration controlling verbosity
|
|
42
|
+
* @returns DebugLogger instance
|
|
43
|
+
*/
|
|
44
|
+
export declare function createDebugLogger(context: DebugContext, logger: Logger, debugConfig: DebugConfig): DebugLogger;
|
|
45
|
+
//# sourceMappingURL=debug.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/utils/debug.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGtD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,WAAW,CAAc;gBAErB,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW;IAM3E,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAU5D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAU5D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAU3D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAU3D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAU5D;;;OAGG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI;IAUvC;;;OAGG;IACG,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;CAsB/D;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,GACvB,WAAW,CAEb"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Debug logging utility for remember-core.
|
|
3
|
+
*
|
|
4
|
+
* Ported from remember-mcp/src/utils/debug.ts.
|
|
5
|
+
* Design: DebugLogger takes a Logger instance and DebugConfig, no hard dependencies.
|
|
6
|
+
*/
|
|
7
|
+
import { DebugLevel } from '../config/debug.js';
|
|
8
|
+
export class DebugLogger {
|
|
9
|
+
context;
|
|
10
|
+
logger;
|
|
11
|
+
debugConfig;
|
|
12
|
+
constructor(context, logger, debugConfig) {
|
|
13
|
+
this.context = context;
|
|
14
|
+
this.logger = logger;
|
|
15
|
+
this.debugConfig = debugConfig;
|
|
16
|
+
}
|
|
17
|
+
trace(message, data) {
|
|
18
|
+
if (this.debugConfig.enabled(DebugLevel.TRACE)) {
|
|
19
|
+
this.logger.debug(`[TRACE] ${message}`, {
|
|
20
|
+
...this.context,
|
|
21
|
+
...data,
|
|
22
|
+
debugLevel: 'TRACE',
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
debug(message, data) {
|
|
27
|
+
if (this.debugConfig.enabled(DebugLevel.DEBUG)) {
|
|
28
|
+
this.logger.debug(`[DEBUG] ${message}`, {
|
|
29
|
+
...this.context,
|
|
30
|
+
...data,
|
|
31
|
+
debugLevel: 'DEBUG',
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
info(message, data) {
|
|
36
|
+
if (this.debugConfig.enabled(DebugLevel.INFO)) {
|
|
37
|
+
this.logger.info(`[INFO] ${message}`, {
|
|
38
|
+
...this.context,
|
|
39
|
+
...data,
|
|
40
|
+
debugLevel: 'INFO',
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
warn(message, data) {
|
|
45
|
+
if (this.debugConfig.enabled(DebugLevel.WARN)) {
|
|
46
|
+
this.logger.warn(`[WARN] ${message}`, {
|
|
47
|
+
...this.context,
|
|
48
|
+
...data,
|
|
49
|
+
debugLevel: 'WARN',
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
error(message, data) {
|
|
54
|
+
if (this.debugConfig.enabled(DebugLevel.ERROR)) {
|
|
55
|
+
this.logger.error(`[ERROR] ${message}`, {
|
|
56
|
+
...this.context,
|
|
57
|
+
...data,
|
|
58
|
+
debugLevel: 'ERROR',
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Dump full object (TRACE only).
|
|
64
|
+
* Use with caution — may expose sensitive data.
|
|
65
|
+
*/
|
|
66
|
+
dump(label, obj) {
|
|
67
|
+
if (this.debugConfig.enabled(DebugLevel.TRACE)) {
|
|
68
|
+
this.logger.debug(`[DUMP] ${label}`, {
|
|
69
|
+
...this.context,
|
|
70
|
+
dump: JSON.stringify(obj, null, 2),
|
|
71
|
+
debugLevel: 'TRACE',
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Time an async operation (DEBUG and above).
|
|
77
|
+
* Logs start, completion, and duration.
|
|
78
|
+
*/
|
|
79
|
+
async time(label, fn) {
|
|
80
|
+
if (!this.debugConfig.enabled(DebugLevel.DEBUG)) {
|
|
81
|
+
return fn();
|
|
82
|
+
}
|
|
83
|
+
const start = Date.now();
|
|
84
|
+
this.debug(`${label} - Starting`);
|
|
85
|
+
try {
|
|
86
|
+
const result = await fn();
|
|
87
|
+
const duration = Date.now() - start;
|
|
88
|
+
this.debug(`${label} - Completed`, { durationMs: duration });
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
const duration = Date.now() - start;
|
|
93
|
+
this.error(`${label} - Failed`, {
|
|
94
|
+
durationMs: duration,
|
|
95
|
+
error: error instanceof Error ? error.message : String(error),
|
|
96
|
+
});
|
|
97
|
+
throw error;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Create a debug logger with context.
|
|
103
|
+
*
|
|
104
|
+
* @param context - Context information (tool name, userId, operation, etc.)
|
|
105
|
+
* @param logger - Logger instance to use for output
|
|
106
|
+
* @param debugConfig - Debug configuration controlling verbosity
|
|
107
|
+
* @returns DebugLogger instance
|
|
108
|
+
*/
|
|
109
|
+
export function createDebugLogger(context, logger, debugConfig) {
|
|
110
|
+
return new DebugLogger(context, logger, debugConfig);
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=debug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/utils/debug.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAShD,MAAM,OAAO,WAAW;IACd,OAAO,CAAe;IACtB,MAAM,CAAS;IACf,WAAW,CAAc;IAEjC,YAAY,OAAqB,EAAE,MAAc,EAAE,WAAwB;QACzE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,IAA8B;QACnD,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/C,IAA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AW,EAAE;gBAC9B,UAAU,EAAE,QAAQ;gBACpB,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;aAC9D,CAAC,CAAC;YACH,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAAqB,EACrB,MAAc,EACd,WAAwB;IAExB,OAAO,IAAI,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized error handling utilities.
|
|
3
|
+
*
|
|
4
|
+
* Ported from remember-mcp/src/utils/error-handler.ts.
|
|
5
|
+
* Design: accepts a Logger interface so consumers provide their own logger.
|
|
6
|
+
*/
|
|
7
|
+
import type { Logger } from './logger.js';
|
|
8
|
+
/**
|
|
9
|
+
* Error context for detailed logging.
|
|
10
|
+
*/
|
|
11
|
+
export interface ErrorContext {
|
|
12
|
+
toolName: string;
|
|
13
|
+
userId?: string;
|
|
14
|
+
operation?: string;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Format error with detailed context for logging and throwing.
|
|
19
|
+
*
|
|
20
|
+
* @param error - The caught error
|
|
21
|
+
* @param context - Additional context about where/why the error occurred
|
|
22
|
+
* @param logger - Optional logger instance; if provided, logs the error
|
|
23
|
+
* @returns Formatted error message with stack trace and context
|
|
24
|
+
*/
|
|
25
|
+
export declare function formatDetailedError(error: unknown, context: ErrorContext, logger?: Logger): string;
|
|
26
|
+
/**
|
|
27
|
+
* Handle tool execution error with detailed logging.
|
|
28
|
+
* Logs the error and throws a formatted error with full context.
|
|
29
|
+
*
|
|
30
|
+
* @param error - The caught error
|
|
31
|
+
* @param context - Additional context about the operation
|
|
32
|
+
* @param logger - Optional logger instance
|
|
33
|
+
* @throws Error with detailed message including stack trace and context
|
|
34
|
+
*/
|
|
35
|
+
export declare function handleToolError(error: unknown, context: ErrorContext, logger?: Logger): never;
|
|
36
|
+
/**
|
|
37
|
+
* Wrap an async operation with detailed error handling.
|
|
38
|
+
*
|
|
39
|
+
* @param operation - The async operation to execute
|
|
40
|
+
* @param context - Error context for logging
|
|
41
|
+
* @param logger - Optional logger instance
|
|
42
|
+
* @returns Result of the operation
|
|
43
|
+
* @throws Error with detailed context if operation fails
|
|
44
|
+
*/
|
|
45
|
+
export declare function withErrorHandling<T>(operation: () => Promise<T>, context: ErrorContext, logger?: Logger): Promise<T>;
|
|
46
|
+
//# sourceMappingURL=error-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../../src/utils/error-handler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,YAAY,EACrB,MAAM,CAAC,EAAE,MAAM,GACd,MAAM,CAsBR;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,YAAY,EACrB,MAAM,CAAC,EAAE,MAAM,GACd,KAAK,CAGP;AAED;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EACvC,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,OAAO,EAAE,YAAY,EACrB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,CAAC,CAAC,CAMZ"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized error handling utilities.
|
|
3
|
+
*
|
|
4
|
+
* Ported from remember-mcp/src/utils/error-handler.ts.
|
|
5
|
+
* Design: accepts a Logger interface so consumers provide their own logger.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Format error with detailed context for logging and throwing.
|
|
9
|
+
*
|
|
10
|
+
* @param error - The caught error
|
|
11
|
+
* @param context - Additional context about where/why the error occurred
|
|
12
|
+
* @param logger - Optional logger instance; if provided, logs the error
|
|
13
|
+
* @returns Formatted error message with stack trace and context
|
|
14
|
+
*/
|
|
15
|
+
export function formatDetailedError(error, context, logger) {
|
|
16
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
17
|
+
const errorStack = error instanceof Error ? error.stack : undefined;
|
|
18
|
+
if (logger) {
|
|
19
|
+
logger.error(`${context.toolName} failed:`, {
|
|
20
|
+
error: errorMessage,
|
|
21
|
+
stack: errorStack,
|
|
22
|
+
...context,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
const contextStr = Object.entries(context)
|
|
26
|
+
.filter(([key]) => key !== 'toolName')
|
|
27
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
28
|
+
.join(', ');
|
|
29
|
+
return (`Failed to ${context.operation || 'execute'}: ${errorMessage}` +
|
|
30
|
+
(errorStack ? `\n\nStack trace:\n${errorStack}` : '') +
|
|
31
|
+
(contextStr ? `\n\nContext: ${contextStr}` : ''));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Handle tool execution error with detailed logging.
|
|
35
|
+
* Logs the error and throws a formatted error with full context.
|
|
36
|
+
*
|
|
37
|
+
* @param error - The caught error
|
|
38
|
+
* @param context - Additional context about the operation
|
|
39
|
+
* @param logger - Optional logger instance
|
|
40
|
+
* @throws Error with detailed message including stack trace and context
|
|
41
|
+
*/
|
|
42
|
+
export function handleToolError(error, context, logger) {
|
|
43
|
+
const detailedMessage = formatDetailedError(error, context, logger);
|
|
44
|
+
throw new Error(detailedMessage);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Wrap an async operation with detailed error handling.
|
|
48
|
+
*
|
|
49
|
+
* @param operation - The async operation to execute
|
|
50
|
+
* @param context - Error context for logging
|
|
51
|
+
* @param logger - Optional logger instance
|
|
52
|
+
* @returns Result of the operation
|
|
53
|
+
* @throws Error with detailed context if operation fails
|
|
54
|
+
*/
|
|
55
|
+
export async function withErrorHandling(operation, context, logger) {
|
|
56
|
+
try {
|
|
57
|
+
return await operation();
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
handleToolError(error, context, logger);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=error-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handler.js","sourceRoot":"","sources":["../../src/utils/error-handler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAcH;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAc,EACd,OAAqB,EACrB,MAAe;IAEf,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5E,MAAM,UAAU,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAEpE,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,QAAQ,UAAU,EAAE;YAC1C,KAAK,EAAE,YAAY;YACnB,KAAK,EAAE,UAAU;YACjB,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;SACvC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,UAAU,CAAC;SACrC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC;SACxC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO,CACL,aAAa,OAAO,CAAC,SAAS,IAAI,SAAS,KAAK,YAAY,EAAE;QAC9D,CAAC,UAAU,CAAC,CAAC,CAAC,qBAAqB,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrD,CAAC,UAAU,CAAC,CAAC,CAAC,gBAAgB,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CACjD,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAC7B,KAAc,EACd,OAAqB,EACrB,MAAe;IAEf,MAAM,eAAe,GAAG,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACpE,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;AACnC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,SAA2B,EAC3B,OAAqB,EACrB,MAAe;IAEf,IAAI,CAAC;QACH,OAAO,MAAM,SAAS,EAAE,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Weaviate v3 filter builder utilities.
|
|
3
|
+
*
|
|
4
|
+
* Ported from remember-mcp/src/utils/weaviate-filters.ts.
|
|
5
|
+
* Provides helper functions to build Weaviate v3 filters using the fluent API.
|
|
6
|
+
*/
|
|
7
|
+
import type { SearchFilters, DeletedFilter } from '../types/search.types.js';
|
|
8
|
+
export type { DeletedFilter } from '../types/search.types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Build filters for searching both memories and relationships.
|
|
11
|
+
* Uses OR logic: (doc_type=memory AND memory_filters) OR (doc_type=relationship AND relationship_filters)
|
|
12
|
+
*
|
|
13
|
+
* @param collection - Weaviate collection instance
|
|
14
|
+
* @param filters - Optional search filters
|
|
15
|
+
* @returns Combined filter or undefined if no filters
|
|
16
|
+
*/
|
|
17
|
+
export declare function buildCombinedSearchFilters(collection: any, filters?: SearchFilters): any;
|
|
18
|
+
/**
|
|
19
|
+
* Build filters for memory-only search.
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildMemoryOnlyFilters(collection: any, filters?: SearchFilters): any;
|
|
22
|
+
/**
|
|
23
|
+
* Build filters for relationship-only search.
|
|
24
|
+
*/
|
|
25
|
+
export declare function buildRelationshipOnlyFilters(collection: any, filters?: SearchFilters): any;
|
|
26
|
+
/**
|
|
27
|
+
* Combine multiple filters with AND logic.
|
|
28
|
+
*/
|
|
29
|
+
export declare function combineFiltersWithAnd(filters: any[]): any;
|
|
30
|
+
/**
|
|
31
|
+
* Check if a filter result is non-empty.
|
|
32
|
+
*/
|
|
33
|
+
export declare function hasFilters(filter: any): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Build filter for deleted_at field based on deleted_filter parameter.
|
|
36
|
+
*
|
|
37
|
+
* @param collection - Weaviate collection instance
|
|
38
|
+
* @param deletedFilter - Filter mode: 'exclude' (default), 'include', or 'only'
|
|
39
|
+
* @returns Filter for deleted_at field, or null if no filter needed
|
|
40
|
+
*/
|
|
41
|
+
export declare function buildDeletedFilter(collection: any, deletedFilter?: DeletedFilter): any | null;
|
|
42
|
+
//# sourceMappingURL=filters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../src/utils/filters.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC7E,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,GAAG,EACf,OAAO,CAAC,EAAE,aAAa,GACtB,GAAG,CAeL;AA6ED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,GAAG,EACf,OAAO,CAAC,EAAE,aAAa,GACtB,GAAG,CAEL;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,GAAG,EACf,OAAO,CAAC,EAAE,aAAa,GACtB,GAAG,CAEL;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,CAOzD;AAcD;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAE/C;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,GAAG,EACf,aAAa,GAAE,aAAyB,GACvC,GAAG,GAAG,IAAI,CAOZ"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Weaviate v3 filter builder utilities.
|
|
3
|
+
*
|
|
4
|
+
* Ported from remember-mcp/src/utils/weaviate-filters.ts.
|
|
5
|
+
* Provides helper functions to build Weaviate v3 filters using the fluent API.
|
|
6
|
+
*/
|
|
7
|
+
import { Filters } from 'weaviate-client';
|
|
8
|
+
/**
|
|
9
|
+
* Build filters for searching both memories and relationships.
|
|
10
|
+
* Uses OR logic: (doc_type=memory AND memory_filters) OR (doc_type=relationship AND relationship_filters)
|
|
11
|
+
*
|
|
12
|
+
* @param collection - Weaviate collection instance
|
|
13
|
+
* @param filters - Optional search filters
|
|
14
|
+
* @returns Combined filter or undefined if no filters
|
|
15
|
+
*/
|
|
16
|
+
export function buildCombinedSearchFilters(collection, filters) {
|
|
17
|
+
const memoryFilters = buildDocTypeFilters(collection, 'memory', filters);
|
|
18
|
+
const relationshipFilters = buildDocTypeFilters(collection, 'relationship', filters);
|
|
19
|
+
const validFilters = [memoryFilters, relationshipFilters].filter((f) => f !== undefined && f !== null);
|
|
20
|
+
if (validFilters.length === 0) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
else if (validFilters.length === 1) {
|
|
24
|
+
return validFilters[0];
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
return combineFiltersWithOr(validFilters);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Build filters for a specific doc_type (memory or relationship).
|
|
32
|
+
*/
|
|
33
|
+
function buildDocTypeFilters(collection, docType, filters) {
|
|
34
|
+
const filterList = [];
|
|
35
|
+
filterList.push(collection.filter.byProperty('doc_type').equal(docType));
|
|
36
|
+
// Content type filter — only for memories
|
|
37
|
+
if (docType === 'memory' && filters?.types && filters.types.length > 0) {
|
|
38
|
+
if (filters.types.length === 1) {
|
|
39
|
+
filterList.push(collection.filter.byProperty('content_type').equal(filters.types[0]));
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
filterList.push(collection.filter.byProperty('content_type').containsAny(filters.types));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// Weight range
|
|
46
|
+
if (filters?.weight_min !== undefined) {
|
|
47
|
+
filterList.push(collection.filter.byProperty('weight').greaterThanOrEqual(filters.weight_min));
|
|
48
|
+
}
|
|
49
|
+
if (filters?.weight_max !== undefined) {
|
|
50
|
+
filterList.push(collection.filter.byProperty('weight').lessThanOrEqual(filters.weight_max));
|
|
51
|
+
}
|
|
52
|
+
// Trust range
|
|
53
|
+
if (filters?.trust_min !== undefined) {
|
|
54
|
+
filterList.push(collection.filter.byProperty('trust_score').greaterThanOrEqual(filters.trust_min));
|
|
55
|
+
}
|
|
56
|
+
if (filters?.trust_max !== undefined) {
|
|
57
|
+
filterList.push(collection.filter.byProperty('trust_score').lessThanOrEqual(filters.trust_max));
|
|
58
|
+
}
|
|
59
|
+
// Date range
|
|
60
|
+
if (filters?.date_from) {
|
|
61
|
+
filterList.push(collection.filter
|
|
62
|
+
.byProperty('created_at')
|
|
63
|
+
.greaterThanOrEqual(new Date(filters.date_from)));
|
|
64
|
+
}
|
|
65
|
+
if (filters?.date_to) {
|
|
66
|
+
filterList.push(collection.filter
|
|
67
|
+
.byProperty('created_at')
|
|
68
|
+
.lessThanOrEqual(new Date(filters.date_to)));
|
|
69
|
+
}
|
|
70
|
+
// Tags
|
|
71
|
+
if (filters?.tags && filters.tags.length > 0) {
|
|
72
|
+
filterList.push(collection.filter.byProperty('tags').containsAny(filters.tags));
|
|
73
|
+
}
|
|
74
|
+
return combineFiltersWithAnd(filterList);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Build filters for memory-only search.
|
|
78
|
+
*/
|
|
79
|
+
export function buildMemoryOnlyFilters(collection, filters) {
|
|
80
|
+
return buildDocTypeFilters(collection, 'memory', filters);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Build filters for relationship-only search.
|
|
84
|
+
*/
|
|
85
|
+
export function buildRelationshipOnlyFilters(collection, filters) {
|
|
86
|
+
return buildDocTypeFilters(collection, 'relationship', filters);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Combine multiple filters with AND logic.
|
|
90
|
+
*/
|
|
91
|
+
export function combineFiltersWithAnd(filters) {
|
|
92
|
+
const validFilters = filters.filter((f) => f !== undefined && f !== null);
|
|
93
|
+
if (validFilters.length === 0)
|
|
94
|
+
return undefined;
|
|
95
|
+
if (validFilters.length === 1)
|
|
96
|
+
return validFilters[0];
|
|
97
|
+
return Filters.and(...validFilters);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Combine multiple filters with OR logic.
|
|
101
|
+
*/
|
|
102
|
+
function combineFiltersWithOr(filters) {
|
|
103
|
+
const validFilters = filters.filter((f) => f !== undefined && f !== null);
|
|
104
|
+
if (validFilters.length === 0)
|
|
105
|
+
return undefined;
|
|
106
|
+
if (validFilters.length === 1)
|
|
107
|
+
return validFilters[0];
|
|
108
|
+
return Filters.or(...validFilters);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Check if a filter result is non-empty.
|
|
112
|
+
*/
|
|
113
|
+
export function hasFilters(filter) {
|
|
114
|
+
return filter !== undefined && filter !== null;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Build filter for deleted_at field based on deleted_filter parameter.
|
|
118
|
+
*
|
|
119
|
+
* @param collection - Weaviate collection instance
|
|
120
|
+
* @param deletedFilter - Filter mode: 'exclude' (default), 'include', or 'only'
|
|
121
|
+
* @returns Filter for deleted_at field, or null if no filter needed
|
|
122
|
+
*/
|
|
123
|
+
export function buildDeletedFilter(collection, deletedFilter = 'exclude') {
|
|
124
|
+
if (deletedFilter === 'exclude') {
|
|
125
|
+
return collection.filter.byProperty('deleted_at').isNull(true);
|
|
126
|
+
}
|
|
127
|
+
else if (deletedFilter === 'only') {
|
|
128
|
+
return collection.filter.byProperty('deleted_at').isNull(false);
|
|
129
|
+
}
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=filters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../src/utils/filters.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAI1C;;;;;;;GAOG;AACH,MAAM,UAAU,0BAA0B,CACxC,UAAe,EACf,OAAuB;IAEvB,MAAM,aAAa,GAAG,mBAAmB,CAAC,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACzE,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,UAAU,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;IAErF,MAAM,YAAY,GAAG,CAAC,aAAa,EAAE,mBAAmB,CAA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AC,CAAC,CAAC;IAEtD,OAAO,OAAO,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,MAAW;IACpC,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI,CAAC;AACjD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,UAAe,EACf,gBAA+B,SAAS;IAExC,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;QAChC,OAAO,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACjE,CAAC;SAAM,IAAI,aAAa,KAAK,MAAM,EAAE,CAAC;QACpC,OAAO,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility modules barrel exports.
|
|
3
|
+
*/
|
|
4
|
+
export { createLogger, type Logger, type LogLevel } from './logger.js';
|
|
5
|
+
export { formatDetailedError, handleToolError, withErrorHandling, type ErrorContext as ToolErrorContext, } from './error-handler.js';
|
|
6
|
+
export { buildCombinedSearchFilters, buildMemoryOnlyFilters, buildRelationshipOnlyFilters, combineFiltersWithAnd, hasFilters, buildDeletedFilter, } from './filters.js';
|
|
7
|
+
export { canModerate, canModerateAny } from './auth-helpers.js';
|
|
8
|
+
export { DebugLogger, createDebugLogger, type DebugContext, } from './debug.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,KAAK,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvE,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,KAAK,YAAY,IAAI,gBAAgB,GACtC,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,4BAA4B,EAC5B,qBAAqB,EACrB,UAAU,EACV,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEhE,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,KAAK,YAAY,GAClB,MAAM,YAAY,CAAC"}
|