@j0hanz/memdb 1.0.8 → 1.0.10

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.
Files changed (117) hide show
  1. package/dist/core/database-schema.d.ts +3 -0
  2. package/dist/core/database-schema.d.ts.map +1 -0
  3. package/dist/core/database-schema.js +65 -0
  4. package/dist/core/database-schema.js.map +1 -0
  5. package/dist/core/database.d.ts +4 -0
  6. package/dist/core/database.d.ts.map +1 -0
  7. package/dist/core/database.js +44 -0
  8. package/dist/core/database.js.map +1 -0
  9. package/dist/core/memory-create.d.ts +8 -0
  10. package/dist/core/memory-create.d.ts.map +1 -0
  11. package/dist/core/memory-create.js +34 -0
  12. package/dist/core/memory-create.js.map +1 -0
  13. package/dist/core/memory-db.d.ts +3 -0
  14. package/dist/core/memory-db.d.ts.map +1 -0
  15. package/dist/core/memory-db.js +32 -0
  16. package/dist/core/memory-db.js.map +1 -0
  17. package/dist/core/memory-read.d.ts +4 -0
  18. package/dist/core/memory-read.d.ts.map +1 -0
  19. package/dist/core/memory-read.js +14 -0
  20. package/dist/core/memory-read.js.map +1 -0
  21. package/dist/core/memory-relations.d.ts +11 -0
  22. package/dist/core/memory-relations.d.ts.map +1 -0
  23. package/dist/core/memory-relations.js +58 -0
  24. package/dist/core/memory-relations.js.map +1 -0
  25. package/dist/core/memory-search.d.ts +9 -0
  26. package/dist/core/memory-search.d.ts.map +1 -0
  27. package/dist/core/memory-search.js +17 -0
  28. package/dist/core/memory-search.js.map +1 -0
  29. package/dist/core/memory-stats.d.ts +3 -0
  30. package/dist/core/memory-stats.d.ts.map +1 -0
  31. package/dist/core/memory-stats.js +52 -0
  32. package/dist/core/memory-stats.js.map +1 -0
  33. package/dist/core/memory-updates.d.ts +11 -0
  34. package/dist/core/memory-updates.d.ts.map +1 -0
  35. package/dist/core/memory-updates.js +116 -0
  36. package/dist/core/memory-updates.js.map +1 -0
  37. package/dist/core/relation-queries.d.ts +8 -0
  38. package/dist/core/relation-queries.d.ts.map +1 -0
  39. package/dist/core/relation-queries.js +126 -0
  40. package/dist/core/relation-queries.js.map +1 -0
  41. package/dist/core/row-mappers.d.ts +7 -0
  42. package/dist/core/row-mappers.d.ts.map +1 -0
  43. package/dist/core/row-mappers.js +53 -0
  44. package/dist/core/row-mappers.js.map +1 -0
  45. package/dist/core/search-errors.d.ts +2 -0
  46. package/dist/core/search-errors.d.ts.map +1 -0
  47. package/dist/core/search-errors.js +31 -0
  48. package/dist/core/search-errors.js.map +1 -0
  49. package/dist/core/search.d.ts +13 -0
  50. package/dist/core/search.d.ts.map +1 -0
  51. package/dist/core/search.js +88 -0
  52. package/dist/core/search.js.map +1 -0
  53. package/dist/core/sqlite.d.ts +11 -0
  54. package/dist/core/sqlite.d.ts.map +1 -0
  55. package/dist/core/sqlite.js +74 -0
  56. package/dist/core/sqlite.js.map +1 -0
  57. package/dist/core/tags.d.ts +2 -0
  58. package/dist/core/tags.d.ts.map +1 -0
  59. package/dist/core/tags.js +28 -0
  60. package/dist/core/tags.js.map +1 -0
  61. package/dist/index.d.ts +3 -0
  62. package/dist/index.d.ts.map +1 -0
  63. package/dist/index.js +77 -0
  64. package/dist/index.js.map +1 -0
  65. package/dist/lib/errors.d.ts +20 -0
  66. package/dist/lib/errors.d.ts.map +1 -0
  67. package/dist/lib/errors.js +23 -0
  68. package/dist/lib/errors.js.map +1 -0
  69. package/dist/schemas/inputs.d.ts +45 -0
  70. package/dist/schemas/inputs.d.ts.map +1 -0
  71. package/dist/schemas/inputs.js +98 -0
  72. package/dist/schemas/inputs.js.map +1 -0
  73. package/dist/schemas/outputs.d.ts +10 -0
  74. package/dist/schemas/outputs.d.ts.map +1 -0
  75. package/dist/schemas/outputs.js +29 -0
  76. package/dist/schemas/outputs.js.map +1 -0
  77. package/dist/tools/definitions/memory-core.d.ts +3 -0
  78. package/dist/tools/definitions/memory-core.d.ts.map +1 -0
  79. package/dist/tools/definitions/memory-core.js +80 -0
  80. package/dist/tools/definitions/memory-core.js.map +1 -0
  81. package/dist/tools/definitions/memory-relations.d.ts +3 -0
  82. package/dist/tools/definitions/memory-relations.d.ts.map +1 -0
  83. package/dist/tools/definitions/memory-relations.js +44 -0
  84. package/dist/tools/definitions/memory-relations.js.map +1 -0
  85. package/dist/tools/definitions/memory-search.d.ts +3 -0
  86. package/dist/tools/definitions/memory-search.d.ts.map +1 -0
  87. package/dist/tools/definitions/memory-search.js +30 -0
  88. package/dist/tools/definitions/memory-search.js.map +1 -0
  89. package/dist/tools/definitions/memory-stats.d.ts +3 -0
  90. package/dist/tools/definitions/memory-stats.d.ts.map +1 -0
  91. package/dist/tools/definitions/memory-stats.js +21 -0
  92. package/dist/tools/definitions/memory-stats.js.map +1 -0
  93. package/dist/tools/index.d.ts +3 -0
  94. package/dist/tools/index.d.ts.map +1 -0
  95. package/dist/tools/index.js +16 -0
  96. package/dist/tools/index.js.map +1 -0
  97. package/dist/tools/tool-handlers.d.ts +4 -0
  98. package/dist/tools/tool-handlers.d.ts.map +1 -0
  99. package/dist/tools/tool-handlers.js +20 -0
  100. package/dist/tools/tool-handlers.js.map +1 -0
  101. package/dist/tools/tool-types.d.ts +15 -0
  102. package/dist/tools/tool-types.d.ts.map +1 -0
  103. package/dist/tools/tool-types.js +2 -0
  104. package/dist/tools/tool-types.js.map +1 -0
  105. package/dist/types/index.d.ts +38 -0
  106. package/dist/types/index.d.ts.map +1 -0
  107. package/dist/types/index.js +2 -0
  108. package/dist/types/index.js.map +1 -0
  109. package/dist/utils/config.d.ts +7 -0
  110. package/dist/utils/config.d.ts.map +1 -0
  111. package/dist/utils/config.js +100 -0
  112. package/dist/utils/config.js.map +1 -0
  113. package/dist/utils/logger.d.ts +6 -0
  114. package/dist/utils/logger.d.ts.map +1 -0
  115. package/dist/utils/logger.js +21 -0
  116. package/dist/utils/logger.js.map +1 -0
  117. package/package.json +2 -2
@@ -0,0 +1,23 @@
1
+ const toNonEmptyString = (value) => {
2
+ if (typeof value === 'string' && value.length > 0)
3
+ return value;
4
+ return undefined;
5
+ };
6
+ export function getErrorMessage(error) {
7
+ if (error instanceof Error)
8
+ return error.message;
9
+ return toNonEmptyString(error) ?? 'Unknown error';
10
+ }
11
+ export function createErrorResponse(code, message, result) {
12
+ const structured = {
13
+ ok: false,
14
+ error: { code, message },
15
+ ...(result !== undefined ? { result } : {}),
16
+ };
17
+ return {
18
+ content: [{ type: 'text', text: JSON.stringify(structured) }],
19
+ structuredContent: structured,
20
+ isError: true,
21
+ };
22
+ }
23
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/lib/errors.ts"],"names":[],"mappings":"AAYA,MAAM,gBAAgB,GAAG,CAAC,KAAc,EAAsB,EAAE;IAC9D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IAChE,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,IAAI,KAAK,YAAY,KAAK;QAAE,OAAO,KAAK,CAAC,OAAO,CAAC;IACjD,OAAO,gBAAgB,CAAC,KAAK,CAAC,IAAI,eAAe,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,IAAY,EACZ,OAAe,EACf,MAAgB;IAEhB,MAAM,UAAU,GAAuC;QACrD,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;QACxB,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC5C,CAAC;IACF,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7D,iBAAiB,EAAE,UAAU;QAC7B,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { z } from 'zod';
2
+ export declare const StoreMemoryInputSchema: z.ZodObject<{
3
+ content: z.ZodString;
4
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
5
+ importance: z.ZodOptional<z.ZodNumber>;
6
+ memoryType: z.ZodOptional<z.ZodString>;
7
+ }, z.core.$strict>;
8
+ export declare const SearchMemoriesInputSchema: z.ZodObject<{
9
+ query: z.ZodString;
10
+ limit: z.ZodOptional<z.ZodNumber>;
11
+ offset: z.ZodOptional<z.ZodNumber>;
12
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
13
+ minRelevance: z.ZodOptional<z.ZodNumber>;
14
+ }, z.core.$strict>;
15
+ export declare const GetMemoryInputSchema: z.ZodObject<{
16
+ hash: z.ZodString;
17
+ }, z.core.$strict>;
18
+ export declare const DeleteMemoryInputSchema: z.ZodObject<{
19
+ hash: z.ZodString;
20
+ }, z.core.$strict>;
21
+ export declare const LinkMemoriesInputSchema: z.ZodObject<{
22
+ fromHash: z.ZodString;
23
+ toHash: z.ZodString;
24
+ relationType: z.ZodString;
25
+ }, z.core.$strict>;
26
+ export declare const GetRelatedInputSchema: z.ZodObject<{
27
+ hash: z.ZodString;
28
+ relationType: z.ZodOptional<z.ZodString>;
29
+ depth: z.ZodOptional<z.ZodNumber>;
30
+ direction: z.ZodOptional<z.ZodEnum<{
31
+ outgoing: "outgoing";
32
+ incoming: "incoming";
33
+ both: "both";
34
+ }>>;
35
+ }, z.core.$strict>;
36
+ export declare const UpdateMemoryInputSchema: z.ZodObject<{
37
+ hash: z.ZodString;
38
+ importance: z.ZodOptional<z.ZodNumber>;
39
+ memoryType: z.ZodOptional<z.ZodString>;
40
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
41
+ addTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
42
+ removeTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
43
+ }, z.core.$strict>;
44
+ export declare const MemoryStatsInputSchema: z.ZodObject<{}, z.core.$strict>;
45
+ //# sourceMappingURL=inputs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inputs.d.ts","sourceRoot":"","sources":["../../src/schemas/inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,eAAO,MAAM,sBAAsB;;;;;kBAYjC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;kBAyBpC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;kBAE/B,CAAC;AAEH,eAAO,MAAM,uBAAuB;;kBAElC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;kBAIlC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;kBAgBhC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;kBAoBlC,CAAC;AAEH,eAAO,MAAM,sBAAsB,iCAEe,CAAC"}
@@ -0,0 +1,98 @@
1
+ import { z } from 'zod';
2
+ const hashSchema = z.string().regex(/^[a-f0-9]{32}$/i);
3
+ const tagSchema = z.string().min(1).max(50);
4
+ const tagsSchema = z.array(tagSchema);
5
+ const contentSchema = z.string().min(1).max(100000);
6
+ const querySchema = z.string().trim().min(1).max(1000);
7
+ const importanceSchema = z.number().int().min(0).max(10);
8
+ const memoryTypeSchema = z.string().min(1).max(50);
9
+ export const StoreMemoryInputSchema = z.strictObject({
10
+ content: contentSchema.meta({ description: 'The content of the memory' }),
11
+ tags: tagsSchema.max(100).optional().meta({
12
+ description: 'Tags to categorize the memory (max 100 tags, each max 50 chars)',
13
+ }),
14
+ importance: importanceSchema
15
+ .optional()
16
+ .meta({ description: 'Importance score (0-10)' }),
17
+ memoryType: memoryTypeSchema
18
+ .optional()
19
+ .meta({ description: 'Type of memory (e.g., conversation, fact, rule)' }),
20
+ });
21
+ export const SearchMemoriesInputSchema = z.strictObject({
22
+ query: querySchema.meta({ description: 'Search query' }),
23
+ limit: z
24
+ .number()
25
+ .int()
26
+ .min(1)
27
+ .max(100)
28
+ .optional()
29
+ .meta({ description: 'Maximum number of results' }),
30
+ offset: z
31
+ .number()
32
+ .int()
33
+ .min(0)
34
+ .max(1000)
35
+ .optional()
36
+ .meta({ description: 'Pagination offset (skip N results)' }),
37
+ tags: tagsSchema.max(50).optional().meta({
38
+ description: 'Filter by tags (max 50 tags)',
39
+ }),
40
+ minRelevance: z
41
+ .number()
42
+ .min(0)
43
+ .max(1)
44
+ .optional()
45
+ .meta({ description: 'Minimum relevance score' }),
46
+ });
47
+ export const GetMemoryInputSchema = z.strictObject({
48
+ hash: hashSchema.meta({ description: 'MD5 hash of the memory' }),
49
+ });
50
+ export const DeleteMemoryInputSchema = z.strictObject({
51
+ hash: hashSchema.meta({ description: 'MD5 hash of the memory' }),
52
+ });
53
+ export const LinkMemoriesInputSchema = z.strictObject({
54
+ fromHash: hashSchema.meta({ description: 'Hash of the source memory' }),
55
+ toHash: hashSchema.meta({ description: 'Hash of the target memory' }),
56
+ relationType: memoryTypeSchema.meta({ description: 'Type of relationship' }),
57
+ });
58
+ export const GetRelatedInputSchema = z.strictObject({
59
+ hash: hashSchema.meta({ description: 'Hash of the memory' }),
60
+ relationType: memoryTypeSchema
61
+ .optional()
62
+ .meta({ description: 'Filter by relationship type' }),
63
+ depth: z
64
+ .number()
65
+ .int()
66
+ .min(1)
67
+ .max(3)
68
+ .optional()
69
+ .meta({ description: 'Traversal depth (1-3)' }),
70
+ direction: z.enum(['outgoing', 'incoming', 'both']).optional().meta({
71
+ description: 'Relationship direction: outgoing (default), incoming, or both',
72
+ }),
73
+ });
74
+ export const UpdateMemoryInputSchema = z.strictObject({
75
+ hash: hashSchema.meta({ description: 'MD5 hash of the memory to update' }),
76
+ importance: importanceSchema
77
+ .optional()
78
+ .meta({ description: 'New importance score (0-10)' }),
79
+ memoryType: memoryTypeSchema
80
+ .optional()
81
+ .meta({ description: 'New memory type' }),
82
+ tags: tagsSchema
83
+ .max(100)
84
+ .optional()
85
+ .meta({ description: 'Replace all tags with these (max 100 tags)' }),
86
+ addTags: tagsSchema
87
+ .max(100)
88
+ .optional()
89
+ .meta({ description: 'Tags to add (max 100 tags)' }),
90
+ removeTags: tagsSchema
91
+ .max(100)
92
+ .optional()
93
+ .meta({ description: 'Tags to remove (max 100 tags)' }),
94
+ });
95
+ export const MemoryStatsInputSchema = z
96
+ .strictObject({})
97
+ .meta({ description: 'No parameters required' });
98
+ //# sourceMappingURL=inputs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inputs.js","sourceRoot":"","sources":["../../src/schemas/inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;AACvD,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAC5C,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACtC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACpD,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACvD,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AACzD,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAEnD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,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CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC;QAClE,WAAW,EACT,+DAA+D;KAClE,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,YAAY,CAAC;IACpD,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;IAC1E,UAAU,EAAE,gBAAgB;SACzB,QAAQ,EAAE;SACV,IAAI,CAAC,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;IACvD,UAAU,EAAE,gBAAgB;SACzB,QAAQ,EAAE;SACV,IAAI,CAAC,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;IAC3C,IAAI,EAAE,UAAU;SACb,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,EAAE;SACV,IAAI,CAAC,EAAE,WAAW,EAAE,4CAA4C,EAAE,CAAC;IACtE,OAAO,EAAE,UAAU;SAChB,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,EAAE;SACV,IAAI,CAAC,EAAE,WAAW,EAAE,4BAA4B,EAAE,CAAC;IACtD,UAAU,EAAE,UAAU;SACnB,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,EAAE;SACV,IAAI,CAAC,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;CAC1D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC;KACpC,YAAY,CAAC,EAAE,CAAC;KAChB,IAAI,CAAC,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ export declare const DefaultOutputSchema: z.ZodObject<{
3
+ ok: z.ZodBoolean;
4
+ result: z.ZodOptional<z.ZodUnknown>;
5
+ error: z.ZodOptional<z.ZodObject<{
6
+ code: z.ZodString;
7
+ message: z.ZodString;
8
+ }, z.core.$strict>>;
9
+ }, z.core.$strict>;
10
+ //# sourceMappingURL=outputs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outputs.d.ts","sourceRoot":"","sources":["../../src/schemas/outputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,CAAC,EAAE,MAAM,KAAK,CAAC;AAyB5C,eAAO,MAAM,mBAAmB;;;;;;;kBAa/B,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ const ErrorSchema = z.strictObject({
3
+ code: z.string(),
4
+ message: z.string(),
5
+ });
6
+ const DefaultOutputSchemaBase = z.strictObject({
7
+ ok: z.boolean(),
8
+ result: z.unknown().optional(),
9
+ error: ErrorSchema.optional(),
10
+ });
11
+ const addIssue = (ctx, path, message) => {
12
+ ctx.addIssue({
13
+ code: 'custom',
14
+ message,
15
+ path,
16
+ });
17
+ };
18
+ export const DefaultOutputSchema = DefaultOutputSchemaBase.superRefine((value, ctx) => {
19
+ if (value.ok) {
20
+ if (value.error !== undefined) {
21
+ addIssue(ctx, ['error'], 'error must be absent when ok is true');
22
+ }
23
+ return;
24
+ }
25
+ if (value.error === undefined) {
26
+ addIssue(ctx, ['error'], 'error is required when ok is false');
27
+ }
28
+ });
29
+ //# sourceMappingURL=outputs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outputs.js","sourceRoot":"","sources":["../../src/schemas/outputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,CAAC,EAAE,MAAM,KAAK,CAAC;AAE5C,MAAM,WAAW,GAAG,CAAC,CAAC,YAAY,CAAC;IACjC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC;AAEH,MAAM,uBAAuB,GAAG,CAAC,CAAC,YAAY,CAAC;IAC7C,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE;IACf,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC9B,KAAK,EAAE,WAAW,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAC;AAEH,MAAM,QAAQ,GAAG,CACf,GAAkB,EAClB,IAAc,EACd,OAAe,EACT,EAAE;IACR,GAAG,CAAC,QAAQ,CAAC;QACX,IAAI,EAAE,QAAQ;QACd,OAAO;QACP,IAAI;KACL,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAAuB,CAAC,WAAW,CACpE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACb,IAAI,KAAK,CAAC,EAAE,EAAE,CAAC;QACb,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAC9B,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,sCAAsC,CAAC,CAAC;QACnE,CAAC;QACD,OAAO;IACT,CAAC;IAED,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC9B,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,oCAAoC,CAAC,CAAC;IACjE,CAAC;AACH,CAAC,CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ToolDef } from '../tool-types.js';
2
+ export declare const coreTools: ToolDef[];
3
+ //# sourceMappingURL=memory-core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-core.d.ts","sourceRoot":"","sources":["../../../src/tools/definitions/memory-core.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD,eAAO,MAAM,SAAS,EAAE,OAAO,EA0E9B,CAAC"}
@@ -0,0 +1,80 @@
1
+ import { createMemory } from '../../core/memory-create.js';
2
+ import { deleteMemory, getMemory } from '../../core/memory-read.js';
3
+ import { updateMemory } from '../../core/memory-updates.js';
4
+ import { createErrorResponse } from '../../lib/errors.js';
5
+ import { DeleteMemoryInputSchema, GetMemoryInputSchema, StoreMemoryInputSchema, UpdateMemoryInputSchema, } from '../../schemas/inputs.js';
6
+ import { DefaultOutputSchema } from '../../schemas/outputs.js';
7
+ import { ok, wrapHandler } from '../tool-handlers.js';
8
+ export const coreTools = [
9
+ {
10
+ name: 'store_memory',
11
+ options: {
12
+ title: 'Store Memory',
13
+ description: 'Store a new memory with optional tags',
14
+ inputSchema: StoreMemoryInputSchema,
15
+ outputSchema: DefaultOutputSchema,
16
+ annotations: { idempotentHint: true },
17
+ },
18
+ handler: wrapHandler('E_STORE_MEMORY', (params) => {
19
+ const input = StoreMemoryInputSchema.parse(params);
20
+ return ok(createMemory({
21
+ content: input.content,
22
+ tags: input.tags ?? [],
23
+ importance: input.importance ?? 0,
24
+ memoryType: input.memoryType ?? 'general',
25
+ }));
26
+ }),
27
+ },
28
+ {
29
+ name: 'get_memory',
30
+ options: {
31
+ title: 'Get Memory',
32
+ description: 'Retrieve memory by hash',
33
+ inputSchema: GetMemoryInputSchema,
34
+ outputSchema: DefaultOutputSchema,
35
+ annotations: { readOnlyHint: true },
36
+ },
37
+ handler: wrapHandler('E_GET_MEMORY', (params) => {
38
+ const input = GetMemoryInputSchema.parse(params);
39
+ const result = getMemory(input.hash);
40
+ if (!result) {
41
+ return createErrorResponse('E_NOT_FOUND', 'Memory not found');
42
+ }
43
+ return ok(result);
44
+ }),
45
+ },
46
+ {
47
+ name: 'delete_memory',
48
+ options: {
49
+ title: 'Delete Memory',
50
+ description: 'Delete by hash',
51
+ inputSchema: DeleteMemoryInputSchema,
52
+ outputSchema: DefaultOutputSchema,
53
+ annotations: { destructiveHint: true },
54
+ },
55
+ handler: wrapHandler('E_DELETE_MEMORY', (params) => {
56
+ const input = DeleteMemoryInputSchema.parse(params);
57
+ const result = deleteMemory(input.hash);
58
+ if (result.changes === 0) {
59
+ return createErrorResponse('E_NOT_FOUND', 'Memory not found');
60
+ }
61
+ return ok({ deleted: true });
62
+ }),
63
+ },
64
+ {
65
+ name: 'update_memory',
66
+ options: {
67
+ title: 'Update Memory',
68
+ description: 'Update memory metadata (importance, type, tags). Content cannot be changed.',
69
+ inputSchema: UpdateMemoryInputSchema,
70
+ outputSchema: DefaultOutputSchema,
71
+ annotations: { idempotentHint: true },
72
+ },
73
+ handler: wrapHandler('E_UPDATE_MEMORY', (params) => {
74
+ const input = UpdateMemoryInputSchema.parse(params);
75
+ const { hash, ...options } = input;
76
+ return ok(updateMemory(hash, options));
77
+ }),
78
+ },
79
+ ];
80
+ //# sourceMappingURL=memory-core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-core.js","sourceRoot":"","sources":["../../../src/tools/definitions/memory-core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGtD,MAAM,CAAC,MAAM,SAAS,GAAc;IAClC;QACE,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE;YACP,KAAK,EAAE,cAAc;YACrB,WAAW,EAAE,uCAAuC;YACpD,WAAW,EAAE,sBAAsB;YACnC,YAAY,EAAE,mBAAmB;YACjC,WAAW,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE;SACtC;QACD,OAAO,EAAE,WAAW,CAAC,gBAAgB,EAAE,CAAC,MAAM,EAAE,EAAE;YAChD,MAAM,KAAK,GAAG,sBAAsB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACnD,OAAO,EAAE,CACP,YAAY,CAAC;gBACX,OAAO,EAAE,KAAK,CAAC,OAAO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BACzB,OAAO,mBAAmB,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;YAChE,CAAC;YACD,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/B,CAAC,CAAC;KACH;IACD;QACE,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE;YACP,KAAK,EAAE,eAAe;YACtB,WAAW,EACT,6EAA6E;YAC/E,WAAW,EAAE,uBAAuB;YACpC,YAAY,EAAE,mBAAmB;YACjC,WAAW,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE;SACtC;QACD,OAAO,EAAE,WAAW,CAAC,iBAAiB,EAAE,CAAC,MAAM,EAAE,EAAE;YACjD,MAAM,KAAK,GAAG,uBAAuB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACpD,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,GAAG,KAAK,CAAC;YACnC,OAAO,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;QACzC,CAAC,CAAC;KACH;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ToolDef } from '../tool-types.js';
2
+ export declare const relationTools: ToolDef[];
3
+ //# sourceMappingURL=memory-relations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-relations.d.ts","sourceRoot":"","sources":["../../../src/tools/definitions/memory-relations.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD,eAAO,MAAM,aAAa,EAAE,OAAO,EAsClC,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { getRelated, linkMemories } from '../../core/memory-relations.js';
2
+ import { GetRelatedInputSchema, LinkMemoriesInputSchema, } from '../../schemas/inputs.js';
3
+ import { DefaultOutputSchema } from '../../schemas/outputs.js';
4
+ import { ok, wrapHandler } from '../tool-handlers.js';
5
+ export const relationTools = [
6
+ {
7
+ name: 'link_memories',
8
+ options: {
9
+ title: 'Link Memories',
10
+ description: 'Create relationship between memories',
11
+ inputSchema: LinkMemoriesInputSchema,
12
+ outputSchema: DefaultOutputSchema,
13
+ annotations: { idempotentHint: true },
14
+ },
15
+ handler: wrapHandler('E_LINK_MEMORIES', (params) => {
16
+ const input = LinkMemoriesInputSchema.parse(params);
17
+ linkMemories(input.fromHash, input.toHash, input.relationType);
18
+ return ok({ linked: true });
19
+ }),
20
+ },
21
+ {
22
+ name: 'get_related',
23
+ options: {
24
+ title: 'Get Related Memories',
25
+ description: 'Get memories related to a given memory',
26
+ inputSchema: GetRelatedInputSchema,
27
+ outputSchema: DefaultOutputSchema,
28
+ annotations: { readOnlyHint: true },
29
+ },
30
+ handler: wrapHandler('E_GET_RELATED', (params) => {
31
+ const input = GetRelatedInputSchema.parse(params);
32
+ const relatedInput = {
33
+ hash: input.hash,
34
+ depth: input.depth ?? 1,
35
+ direction: input.direction ?? 'outgoing',
36
+ ...(input.relationType !== undefined
37
+ ? { relationType: input.relationType }
38
+ : {}),
39
+ };
40
+ return ok(getRelated(relatedInput));
41
+ }),
42
+ },
43
+ ];
44
+ //# sourceMappingURL=memory-relations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-relations.js","sourceRoot":"","sources":["../../../src/tools/definitions/memory-relations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EACL,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGtD,MAAM,CAAC,MAAM,aAAa,GAAc;IACtC;QACE,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE;YACP,KAAK,EAAE,eAAe;YACtB,WAAW,EAAE,sCAAsC;YACnD,WAAW,EAAE,uBAAuB;YACpC,YAAY,E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memory-search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-search.d.ts","sourceRoot":"","sources":["../../../src/tools/definitions/memory-search.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD,eAAO,MAAM,WAAW,EAAE,OAAO,EAwBhC,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { searchMemories } from '../../core/memory-search.js';
2
+ import { SearchMemoriesInputSchema } from '../../schemas/inputs.js';
3
+ import { DefaultOutputSchema } from '../../schemas/outputs.js';
4
+ import { ok, wrapHandler } from '../tool-handlers.js';
5
+ export const searchTools = [
6
+ {
7
+ name: 'search_memories',
8
+ options: {
9
+ title: 'Search Memories',
10
+ description: 'Full-text search with filters',
11
+ inputSchema: SearchMemoriesInputSchema,
12
+ outputSchema: DefaultOutputSchema,
13
+ annotations: { readOnlyHint: true },
14
+ },
15
+ handler: wrapHandler('E_SEARCH_MEMORIES', (params) => {
16
+ const input = SearchMemoriesInputSchema.parse(params);
17
+ const searchInput = {
18
+ query: input.query,
19
+ limit: input.limit ?? 10,
20
+ tags: input.tags ?? [],
21
+ ...(input.minRelevance !== undefined
22
+ ? { minRelevance: input.minRelevance }
23
+ : {}),
24
+ ...(input.offset !== undefined ? { offset: input.offset } : {}),
25
+ };
26
+ return ok(searchMemories(searchInput));
27
+ }),
28
+ },
29
+ ];
30
+ //# sourceMappingURL=memory-search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-search.js","sourceRoot":"","sources":["../../../src/tools/definitions/memory-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGtD,MAAM,CAAC,MAAM,WAAW,GAAc;IACpC;QACE,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE;YACP,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,+BAA+B;YAC5C,WAAW,EAAE,yBAAyB;YACtC,YAAY,EAAE,mBAAmB;YACjC,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;SACpC;QACD,OAAO,EAAE,WAAW,CAAC,mBAAmB,EAAE,CAAC,MAAM,EAAE,EAAE;YACnD,MAAM,KAAK,GAAG,yBAAyB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACtD,MAAM,WAAW,GAAG;gBAClB,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,EAAE;gBACxB,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,EAAE;gBACtB,GAAG,CAAC,KAAK,CAAC,YAAY,KAAK,SAAS;oBAClC,CAAC,CAAC,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE;oBACtC,CAAC,CAAC,EAAE,CAAC;gBACP,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAChE,CAAC;YACF,OAAO,EAAE,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;QACzC,CAAC,CAAC;KACH;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ToolDef } from '../tool-types.js';
2
+ export declare const statsTools: ToolDef[];
3
+ //# sourceMappingURL=memory-stats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-stats.d.ts","sourceRoot":"","sources":["../../../src/tools/definitions/memory-stats.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD,eAAO,MAAM,UAAU,EAAE,OAAO,EAe/B,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { getStats } from '../../core/memory-stats.js';
2
+ import { MemoryStatsInputSchema } from '../../schemas/inputs.js';
3
+ import { DefaultOutputSchema } from '../../schemas/outputs.js';
4
+ import { ok, wrapHandler } from '../tool-handlers.js';
5
+ export const statsTools = [
6
+ {
7
+ name: 'memory_stats',
8
+ options: {
9
+ title: 'Memory Stats',
10
+ description: 'Database statistics and health',
11
+ inputSchema: MemoryStatsInputSchema,
12
+ outputSchema: DefaultOutputSchema,
13
+ annotations: { readOnlyHint: true },
14
+ },
15
+ handler: wrapHandler('E_MEMORY_STATS', (params) => {
16
+ MemoryStatsInputSchema.parse(params);
17
+ return ok(getStats());
18
+ }),
19
+ },
20
+ ];
21
+ //# sourceMappingURL=memory-stats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-stats.js","sourceRoot":"","sources":["../../../src/tools/definitions/memory-stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGtD,MAAM,CAAC,MAAM,UAAU,GAAc;IACnC;QACE,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE;YACP,KAAK,EAAE,cAAc;YACrB,WAAW,EAAE,gCAAgC;YAC7C,WAAW,EAAE,sBAAsB;YACnC,YAAY,EAAE,mBAAmB;YACjC,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;SACpC;QACD,OAAO,EAAE,WAAW,CAAC,gBAAgB,EAAE,CAAC,MAAM,EAAE,EAAE;YAChD,sBAAsB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACrC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;QACxB,CAAC,CAAC;KACH;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare function registerAllTools(server: McpServer): void;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAezE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAQxD"}
@@ -0,0 +1,16 @@
1
+ import { coreTools } from './definitions/memory-core.js';
2
+ import { relationTools } from './definitions/memory-relations.js';
3
+ import { searchTools } from './definitions/memory-search.js';
4
+ import { statsTools } from './definitions/memory-stats.js';
5
+ const tools = [
6
+ ...coreTools,
7
+ ...searchTools,
8
+ ...relationTools,
9
+ ...statsTools,
10
+ ];
11
+ export function registerAllTools(server) {
12
+ for (const tool of tools) {
13
+ server.registerTool(tool.name, tool.options, (params) => Promise.resolve(tool.handler(params)));
14
+ }
15
+ }
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAG3D,MAAM,KAAK,GAAc;IACvB,GAAG,SAAS;IACZ,GAAG,WAAW;IACd,GAAG,aAAa;IAChB,GAAG,UAAU;CACd,CAAC;AAEF,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IAChD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,CAAC,YAAY,CACjB,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,OAAO,EACZ,CAAC,MAA+B,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAC3E,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
2
+ export declare const ok: (result: unknown) => CallToolResult;
3
+ export declare const wrapHandler: (code: string, handler: (params: Record<string, unknown>) => CallToolResult) => ((params: Record<string, unknown>) => CallToolResult);
4
+ //# sourceMappingURL=tool-handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-handlers.d.ts","sourceRoot":"","sources":["../../src/tools/tool-handlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAIzE,eAAO,MAAM,EAAE,GAAI,QAAQ,OAAO,KAAG,cAMpC,CAAC;AAUF,eAAO,MAAM,WAAW,GACtB,MAAM,MAAM,EACZ,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,cAAc,KAC3D,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,cAAc,CAEtD,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { createErrorResponse, getErrorMessage } from '../lib/errors.js';
2
+ export const ok = (result) => {
3
+ const structured = { ok: true, result };
4
+ return {
5
+ content: [{ type: 'text', text: JSON.stringify(structured) }],
6
+ structuredContent: structured,
7
+ };
8
+ };
9
+ const withError = (code, fn) => {
10
+ try {
11
+ return fn();
12
+ }
13
+ catch (err) {
14
+ return createErrorResponse(code, getErrorMessage(err));
15
+ }
16
+ };
17
+ export const wrapHandler = (code, handler) => {
18
+ return (params) => withError(code, () => handler(params));
19
+ };
20
+ //# sourceMappingURL=tool-handlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-handlers.js","sourceRoot":"","sources":["../../src/tools/tool-handlers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAe,EAAkB,EAAE;IACpD,MAAM,UAAU,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IACxC,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7D,iBAAiB,EAAE,UAAU;KAC9B,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,EAAwB,EAAkB,EAAE;IAC3E,IAAI,CAAC;QACH,OAAO,EAAE,EAAE,CAAC;IACd,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,mBAAmB,CAAC,IAAI,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC;IACzD,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,IAAY,EACZ,OAA4D,EACL,EAAE;IACzD,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;AAC5D,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { AnySchema, ZodRawShapeCompat } from '@modelcontextprotocol/sdk/server/zod-compat.js';
2
+ import type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';
3
+ export type ToolSchema = ZodRawShapeCompat | AnySchema;
4
+ export interface ToolDef {
5
+ name: string;
6
+ options: {
7
+ title: string;
8
+ description: string;
9
+ inputSchema: ToolSchema;
10
+ outputSchema: ToolSchema;
11
+ annotations?: ToolAnnotations;
12
+ };
13
+ handler: (params: Record<string, unknown>) => CallToolResult;
14
+ }
15
+ //# sourceMappingURL=tool-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-types.d.ts","sourceRoot":"","sources":["../../src/tools/tool-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,iBAAiB,EAClB,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAChB,MAAM,oCAAoC,CAAC;AAE5C,MAAM,MAAM,UAAU,GAAG,iBAAiB,GAAG,SAAS,CAAC;AAEvD,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,UAAU,CAAC;QACxB,YAAY,EAAE,UAAU,CAAC;QACzB,WAAW,CAAC,EAAE,eAAe,CAAC;KAC/B,CAAC;IACF,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,cAAc,CAAC;CAC9D"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=tool-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-types.js","sourceRoot":"","sources":["../../src/tools/tool-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,38 @@
1
+ export interface Memory {
2
+ readonly id: number;
3
+ readonly content: string;
4
+ readonly summary: string | undefined;
5
+ readonly importance: number;
6
+ readonly memory_type: string;
7
+ readonly created_at: string;
8
+ readonly accessed_at: string;
9
+ readonly hash: string;
10
+ }
11
+ export interface SearchResult extends Memory {
12
+ readonly relevance: number;
13
+ }
14
+ export interface RelatedMemory extends Memory {
15
+ readonly relation_type: string;
16
+ readonly depth: number;
17
+ }
18
+ export interface StatementResult {
19
+ readonly changes: number;
20
+ }
21
+ export interface MemoryInsertResult {
22
+ readonly id: number;
23
+ readonly hash: string;
24
+ readonly isNew: boolean;
25
+ }
26
+ export interface MemoryUpdateResult {
27
+ readonly updated: boolean;
28
+ readonly hash: string;
29
+ }
30
+ export interface MemoryStats {
31
+ readonly memoryCount: number;
32
+ readonly relationshipCount: number;
33
+ readonly tagCount: number;
34
+ readonly memoryTypes: Record<string, number>;
35
+ readonly oldestMemory: string | null;
36
+ readonly newestMemory: string | null;
37
+ }
38
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,YAAa,SAAQ,MAAM;IAC1C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,aAAc,SAAQ,MAAM;IAC3C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ export type LogLevel = 'error' | 'info' | 'warn';
2
+ export declare const config: {
3
+ dbPath: string;
4
+ logLevel: LogLevel;
5
+ shutdownTimeout: number;
6
+ };
7
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAyGjD,eAAO,MAAM,MAAM;;;;CAsBlB,CAAC"}