super-memory-pro 0.2.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 +247 -0
- package/dist/config.d.ts +6 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +25 -0
- package/dist/config.js.map +1 -0
- package/dist/db/connection.d.ts +20 -0
- package/dist/db/connection.d.ts.map +1 -0
- package/dist/db/connection.js +66 -0
- package/dist/db/connection.js.map +1 -0
- package/dist/db/migrations/001_initial.sql +102 -0
- package/dist/db/migrations.d.ts +14 -0
- package/dist/db/migrations.d.ts.map +1 -0
- package/dist/db/migrations.js +86 -0
- package/dist/db/migrations.js.map +1 -0
- package/dist/db/queries.d.ts +24 -0
- package/dist/db/queries.d.ts.map +1 -0
- package/dist/db/queries.js +179 -0
- package/dist/db/queries.js.map +1 -0
- package/dist/hooks/event-handler.d.ts +13 -0
- package/dist/hooks/event-handler.d.ts.map +1 -0
- package/dist/hooks/event-handler.js +80 -0
- package/dist/hooks/event-handler.js.map +1 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +7 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/message-handler.d.ts +13 -0
- package/dist/hooks/message-handler.d.ts.map +1 -0
- package/dist/hooks/message-handler.js +47 -0
- package/dist/hooks/message-handler.js.map +1 -0
- package/dist/hooks/session-compactor.d.ts +15 -0
- package/dist/hooks/session-compactor.d.ts.map +1 -0
- package/dist/hooks/session-compactor.js +40 -0
- package/dist/hooks/session-compactor.js.map +1 -0
- package/dist/hooks/system-transform.d.ts +27 -0
- package/dist/hooks/system-transform.d.ts.map +1 -0
- package/dist/hooks/system-transform.js +76 -0
- package/dist/hooks/system-transform.js.map +1 -0
- package/dist/hooks/tool-handler.d.ts +14 -0
- package/dist/hooks/tool-handler.d.ts.map +1 -0
- package/dist/hooks/tool-handler.js +94 -0
- package/dist/hooks/tool-handler.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +152 -0
- package/dist/index.js.map +1 -0
- package/dist/installer/index.d.ts +19 -0
- package/dist/installer/index.d.ts.map +1 -0
- package/dist/installer/index.js +553 -0
- package/dist/installer/index.js.map +1 -0
- package/dist/memory/extractor.d.ts +29 -0
- package/dist/memory/extractor.d.ts.map +1 -0
- package/dist/memory/extractor.js +426 -0
- package/dist/memory/extractor.js.map +1 -0
- package/dist/memory/index.d.ts +7 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +7 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/processor.d.ts +50 -0
- package/dist/memory/processor.d.ts.map +1 -0
- package/dist/memory/processor.js +199 -0
- package/dist/memory/processor.js.map +1 -0
- package/dist/memory/search.d.ts +35 -0
- package/dist/memory/search.d.ts.map +1 -0
- package/dist/memory/search.js +170 -0
- package/dist/memory/search.js.map +1 -0
- package/dist/memory/store.d.ts +32 -0
- package/dist/memory/store.d.ts.map +1 -0
- package/dist/memory/store.js +112 -0
- package/dist/memory/store.js.map +1 -0
- package/dist/server/index.d.ts +16 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +49 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/middleware/async-handler.d.ts +11 -0
- package/dist/server/middleware/async-handler.d.ts.map +1 -0
- package/dist/server/middleware/async-handler.js +14 -0
- package/dist/server/middleware/async-handler.js.map +1 -0
- package/dist/server/middleware/error-handler.d.ts +11 -0
- package/dist/server/middleware/error-handler.d.ts.map +1 -0
- package/dist/server/middleware/error-handler.js +18 -0
- package/dist/server/middleware/error-handler.js.map +1 -0
- package/dist/server/routes/health.d.ts +2 -0
- package/dist/server/routes/health.d.ts.map +1 -0
- package/dist/server/routes/health.js +25 -0
- package/dist/server/routes/health.js.map +1 -0
- package/dist/server/routes/memory.d.ts +2 -0
- package/dist/server/routes/memory.d.ts.map +1 -0
- package/dist/server/routes/memory.js +139 -0
- package/dist/server/routes/memory.js.map +1 -0
- package/dist/server/schemas.d.ts +51 -0
- package/dist/server/schemas.d.ts.map +1 -0
- package/dist/server/schemas.js +23 -0
- package/dist/server/schemas.js.map +1 -0
- package/dist/tools/definitions.d.ts +130 -0
- package/dist/tools/definitions.d.ts.map +1 -0
- package/dist/tools/definitions.js +78 -0
- package/dist/tools/definitions.js.map +1 -0
- package/dist/tools/index.d.ts +32 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +148 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/types.d.ts +108 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Request, Response, NextFunction } from 'express';
|
|
2
|
+
/**
|
|
3
|
+
* Wraps an async Express route handler so rejected promises are forwarded
|
|
4
|
+
* to the Express error handler via `next(err)`.
|
|
5
|
+
*
|
|
6
|
+
* Express v5 catches async errors natively, but this wrapper provides a
|
|
7
|
+
* uniform error-forwarding pattern and a single place to add cross-cutting
|
|
8
|
+
* error formatting if needed in the future.
|
|
9
|
+
*/
|
|
10
|
+
export declare function asyncHandler(fn: (req: Request, res: Response, next: NextFunction) => Promise<void>): (req: Request, res: Response, next: NextFunction) => void;
|
|
11
|
+
//# sourceMappingURL=async-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async-handler.d.ts","sourceRoot":"","sources":["../../../src/server/middleware/async-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE/D;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,EAAE,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,IAE9D,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,KAAG,IAAI,CAG/D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps an async Express route handler so rejected promises are forwarded
|
|
3
|
+
* to the Express error handler via `next(err)`.
|
|
4
|
+
*
|
|
5
|
+
* Express v5 catches async errors natively, but this wrapper provides a
|
|
6
|
+
* uniform error-forwarding pattern and a single place to add cross-cutting
|
|
7
|
+
* error formatting if needed in the future.
|
|
8
|
+
*/
|
|
9
|
+
export function asyncHandler(fn) {
|
|
10
|
+
return (req, res, next) => {
|
|
11
|
+
Promise.resolve(fn(req, res, next)).catch(next);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=async-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async-handler.js","sourceRoot":"","sources":["../../../src/server/middleware/async-handler.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAC1B,EAAsE;IAEtE,OAAO,CAAC,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAQ,EAAE;QAC/D,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Request, Response, NextFunction } from 'express';
|
|
2
|
+
/**
|
|
3
|
+
* Global Express error-handling middleware.
|
|
4
|
+
*
|
|
5
|
+
* - Zod validation errors → 400 with `{ error }`
|
|
6
|
+
* - Everything else → 500 with `{ error }`
|
|
7
|
+
*
|
|
8
|
+
* Always returns the uniform `{ error: string }` envelope.
|
|
9
|
+
*/
|
|
10
|
+
export declare function errorHandler(err: Error, _req: Request, res: Response, _next: NextFunction): void;
|
|
11
|
+
//# sourceMappingURL=error-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../../../src/server/middleware/error-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG/D;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,KAAK,EACV,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,YAAY,GAClB,IAAI,CAQN"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ZodError } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Global Express error-handling middleware.
|
|
4
|
+
*
|
|
5
|
+
* - Zod validation errors → 400 with `{ error }`
|
|
6
|
+
* - Everything else → 500 with `{ error }`
|
|
7
|
+
*
|
|
8
|
+
* Always returns the uniform `{ error: string }` envelope.
|
|
9
|
+
*/
|
|
10
|
+
export function errorHandler(err, _req, res, _next) {
|
|
11
|
+
if (err instanceof ZodError) {
|
|
12
|
+
res.status(400).json({ error: `Validation error: ${err.message}` });
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
console.error('[UltraMemory] Server error:', err.message);
|
|
16
|
+
res.status(500).json({ error: err.message || 'Internal server error' });
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=error-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handler.js","sourceRoot":"","sources":["../../../src/server/middleware/error-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAE/B;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAC1B,GAAU,EACV,IAAa,EACb,GAAa,EACb,KAAmB;IAEnB,IAAI,GAAG,YAAY,QAAQ,EAAE,CAAC;QAC5B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,qBAAqB,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACpE,OAAO;IACT,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAC1D,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,IAAI,uBAAuB,EAAE,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../../src/server/routes/health.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY,4CAAW,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import { healthCheck } from '../../db/connection.js';
|
|
3
|
+
const VERSION = '0.1.0';
|
|
4
|
+
export const healthRouter = Router();
|
|
5
|
+
/**
|
|
6
|
+
* GET /health
|
|
7
|
+
*
|
|
8
|
+
* Returns server health status including database connectivity.
|
|
9
|
+
*/
|
|
10
|
+
healthRouter.get('/health', async (_req, res) => {
|
|
11
|
+
try {
|
|
12
|
+
const db = await healthCheck();
|
|
13
|
+
res.json({
|
|
14
|
+
status: 'ok',
|
|
15
|
+
db,
|
|
16
|
+
uptime: process.uptime(),
|
|
17
|
+
version: VERSION,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
const message = err instanceof Error ? err.message : 'Unknown error';
|
|
22
|
+
res.status(500).json({ error: message });
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=health.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.js","sourceRoot":"","sources":["../../../src/server/routes/health.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,MAAM,OAAO,GAAG,OAAO,CAAC;AAExB,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,EAAE,CAAC;AAErC;;;;GAIG;AACH,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;IAC9C,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,MAAM,WAAW,EAAE,CAAC;QAC/B,GAAG,CAAC,IAAI,CAAC;YACP,MAAM,EAAE,IAAa;YACrB,EAAE;YACF,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE;YACxB,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;QACrE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../src/server/routes/memory.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,YAAY,4CAAW,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import { ZodError } from 'zod';
|
|
3
|
+
import { createMemory, getMemory, searchMemories, updateMemory, deleteMemory, getMemoryStats, } from '../../db/queries.js';
|
|
4
|
+
import { CreateMemorySchema, SearchQuerySchema, UpdateMemorySchema } from '../schemas.js';
|
|
5
|
+
export const memoryRouter = Router();
|
|
6
|
+
/**
|
|
7
|
+
* POST /api/memory
|
|
8
|
+
*
|
|
9
|
+
* Create a new memory record. Upserts on (memory_type, project_id, key) conflict.
|
|
10
|
+
*/
|
|
11
|
+
memoryRouter.post('/memory', async (req, res) => {
|
|
12
|
+
try {
|
|
13
|
+
const data = CreateMemorySchema.parse(req.body);
|
|
14
|
+
const result = await createMemory({
|
|
15
|
+
memory_type: data.type,
|
|
16
|
+
key: data.key,
|
|
17
|
+
content: data.content,
|
|
18
|
+
importance: data.importance,
|
|
19
|
+
project_id: data.projectId ?? null,
|
|
20
|
+
});
|
|
21
|
+
res.status(201).json(result);
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
if (err instanceof ZodError) {
|
|
25
|
+
res.status(400).json({ error: err.message });
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const message = err instanceof Error ? err.message : 'Unknown error';
|
|
29
|
+
res.status(500).json({ error: message });
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* GET /api/memory/search?q=&type=&limit=
|
|
34
|
+
*
|
|
35
|
+
* Full-text search across memories with optional type filter and limit.
|
|
36
|
+
*/
|
|
37
|
+
memoryRouter.get('/memory/search', async (req, res) => {
|
|
38
|
+
try {
|
|
39
|
+
const { q, type, limit } = SearchQuerySchema.parse(req.query);
|
|
40
|
+
const results = await searchMemories({
|
|
41
|
+
query: q,
|
|
42
|
+
types: type ? [type] : undefined,
|
|
43
|
+
limit,
|
|
44
|
+
});
|
|
45
|
+
res.json(results);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
if (err instanceof ZodError) {
|
|
49
|
+
res.status(400).json({ error: err.message });
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const message = err instanceof Error ? err.message : 'Unknown error';
|
|
53
|
+
res.status(500).json({ error: message });
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* GET /api/memory/stats
|
|
58
|
+
*
|
|
59
|
+
* Return memory counts grouped by type.
|
|
60
|
+
*/
|
|
61
|
+
memoryRouter.get('/memory/stats', async (_req, res) => {
|
|
62
|
+
try {
|
|
63
|
+
const stats = await getMemoryStats();
|
|
64
|
+
res.json(stats);
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
const message = err instanceof Error ? err.message : 'Unknown error';
|
|
68
|
+
res.status(500).json({ error: message });
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
/**
|
|
72
|
+
* GET /api/memory/:id
|
|
73
|
+
*
|
|
74
|
+
* Retrieve a single memory by its UUID.
|
|
75
|
+
*/
|
|
76
|
+
memoryRouter.get('/memory/:id', async (req, res) => {
|
|
77
|
+
try {
|
|
78
|
+
const { id } = req.params;
|
|
79
|
+
const memory = await getMemory(id);
|
|
80
|
+
if (!memory) {
|
|
81
|
+
res.status(404).json({ error: 'Memory not found' });
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
res.json(memory);
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
const message = err instanceof Error ? err.message : 'Unknown error';
|
|
88
|
+
res.status(500).json({ error: message });
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
/**
|
|
92
|
+
* PUT /api/memory/:id
|
|
93
|
+
*
|
|
94
|
+
* Partially update a memory (content and/or importance).
|
|
95
|
+
*/
|
|
96
|
+
memoryRouter.put('/memory/:id', async (req, res) => {
|
|
97
|
+
try {
|
|
98
|
+
const data = UpdateMemorySchema.parse(req.body);
|
|
99
|
+
const { id } = req.params;
|
|
100
|
+
const result = await updateMemory(id, {
|
|
101
|
+
content: data.content,
|
|
102
|
+
importance: data.importance,
|
|
103
|
+
});
|
|
104
|
+
if (!result) {
|
|
105
|
+
res.status(404).json({ error: 'Memory not found' });
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
res.json(result);
|
|
109
|
+
}
|
|
110
|
+
catch (err) {
|
|
111
|
+
if (err instanceof ZodError) {
|
|
112
|
+
res.status(400).json({ error: err.message });
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const message = err instanceof Error ? err.message : 'Unknown error';
|
|
116
|
+
res.status(500).json({ error: message });
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
/**
|
|
120
|
+
* DELETE /api/memory/:id
|
|
121
|
+
*
|
|
122
|
+
* Delete a memory by its UUID.
|
|
123
|
+
*/
|
|
124
|
+
memoryRouter.delete('/memory/:id', async (req, res) => {
|
|
125
|
+
try {
|
|
126
|
+
const { id } = req.params;
|
|
127
|
+
const deleted = await deleteMemory(id);
|
|
128
|
+
if (!deleted) {
|
|
129
|
+
res.status(404).json({ error: 'Memory not found' });
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
res.json({ deleted: true });
|
|
133
|
+
}
|
|
134
|
+
catch (err) {
|
|
135
|
+
const message = err instanceof Error ? err.message : 'Unknown error';
|
|
136
|
+
res.status(500).json({ error: message });
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
//# sourceMappingURL=memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../../src/server/routes/memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,EACL,YAAY,EACZ,SAAS,EACT,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE1F,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,EAAE,CAAC;AAOrC;;;;GAIG;AACH,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;IACjE,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAChD,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC;YAChC,WAAW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G,CAAC,OAAO,EAAE,CAAC,CAAC;YAC7C,OAAO;QACT,CAAC;QACD,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;QACrE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC,CAAC,CAAC;AAEH;;;;GAIG;AACH,YAAY,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,EAAE,GAAsB,EAAE,GAAa,EAAE,EAAE;IACjF,IAAI,CAAC;QACH,MAAM,EAAE,EAAE,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC;QAC1B,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,EAAE,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC,CAAC;YACpD,OAAO;QACT,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;QACrE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Schema for creating a memory */
|
|
3
|
+
export declare const CreateMemorySchema: z.ZodObject<{
|
|
4
|
+
key: z.ZodString;
|
|
5
|
+
content: z.ZodString;
|
|
6
|
+
type: z.ZodEnum<{
|
|
7
|
+
user_profile: "user_profile";
|
|
8
|
+
tech_stack: "tech_stack";
|
|
9
|
+
project_context: "project_context";
|
|
10
|
+
session: "session";
|
|
11
|
+
pattern: "pattern";
|
|
12
|
+
decision: "decision";
|
|
13
|
+
explicit: "explicit";
|
|
14
|
+
}>;
|
|
15
|
+
importance: z.ZodDefault<z.ZodNumber>;
|
|
16
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
/** Schema for search query parameters */
|
|
19
|
+
export declare const SearchQuerySchema: z.ZodObject<{
|
|
20
|
+
q: z.ZodString;
|
|
21
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
22
|
+
user_profile: "user_profile";
|
|
23
|
+
tech_stack: "tech_stack";
|
|
24
|
+
project_context: "project_context";
|
|
25
|
+
session: "session";
|
|
26
|
+
pattern: "pattern";
|
|
27
|
+
decision: "decision";
|
|
28
|
+
explicit: "explicit";
|
|
29
|
+
}>>;
|
|
30
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
/** Schema for updating a memory (partial) */
|
|
33
|
+
export declare const UpdateMemorySchema: z.ZodObject<{
|
|
34
|
+
content: z.ZodOptional<z.ZodString>;
|
|
35
|
+
importance: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export type CreateMemoryInput = z.infer<typeof CreateMemorySchema>;
|
|
38
|
+
export type SearchQueryInput = z.infer<typeof SearchQuerySchema>;
|
|
39
|
+
export type UpdateMemoryInput = z.infer<typeof UpdateMemorySchema>;
|
|
40
|
+
/** Standard error response */
|
|
41
|
+
export interface ErrorResponse {
|
|
42
|
+
error: string;
|
|
43
|
+
}
|
|
44
|
+
/** Health check response */
|
|
45
|
+
export interface HealthResponse {
|
|
46
|
+
status: 'ok';
|
|
47
|
+
db: boolean;
|
|
48
|
+
uptime: number;
|
|
49
|
+
version: string;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/server/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,mCAAmC;AACnC,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;iBAM7B,CAAC;AAEH,yCAAyC;AACzC,eAAO,MAAM,iBAAiB;;;;;;;;;;;;iBAI5B,CAAC;AAEH,6CAA6C;AAC7C,eAAO,MAAM,kBAAkB;;;iBAG7B,CAAC;AAIH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACnE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AACjE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEnE,8BAA8B;AAC9B,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,4BAA4B;AAC5B,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,IAAI,CAAC;IACb,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MEMORY_TYPES } from '../types.js';
|
|
3
|
+
// ─── Request validation schemas ────────────────────────────────────────────
|
|
4
|
+
/** Schema for creating a memory */
|
|
5
|
+
export const CreateMemorySchema = z.object({
|
|
6
|
+
key: z.string(),
|
|
7
|
+
content: z.string(),
|
|
8
|
+
type: z.enum(MEMORY_TYPES),
|
|
9
|
+
importance: z.number().min(1).max(5).default(3),
|
|
10
|
+
projectId: z.string().optional(),
|
|
11
|
+
});
|
|
12
|
+
/** Schema for search query parameters */
|
|
13
|
+
export const SearchQuerySchema = z.object({
|
|
14
|
+
q: z.string(),
|
|
15
|
+
type: z.enum(MEMORY_TYPES).optional(),
|
|
16
|
+
limit: z.coerce.number().min(1).max(100).default(10),
|
|
17
|
+
});
|
|
18
|
+
/** Schema for updating a memory (partial) */
|
|
19
|
+
export const UpdateMemorySchema = z.object({
|
|
20
|
+
content: z.string().optional(),
|
|
21
|
+
importance: z.number().min(1).max(5).optional(),
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/server/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,8EAA8E;AAE9E,mCAAmC;AACnC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC;IAC1B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC;AAEH,yCAAyC;AACzC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE;IACb,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE;IACrC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CACrD,CAAC,CAAC;AAEH,6CAA6C;AAC7C,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CAChD,CAAC,CAAC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Save a memory explicitly.
|
|
4
|
+
*/
|
|
5
|
+
export declare const memSave: {
|
|
6
|
+
description: string;
|
|
7
|
+
args: {
|
|
8
|
+
key: z.ZodString;
|
|
9
|
+
content: z.ZodString;
|
|
10
|
+
type: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
11
|
+
user_profile: "user_profile";
|
|
12
|
+
tech_stack: "tech_stack";
|
|
13
|
+
project_context: "project_context";
|
|
14
|
+
pattern: "pattern";
|
|
15
|
+
decision: "decision";
|
|
16
|
+
explicit: "explicit";
|
|
17
|
+
}>>>;
|
|
18
|
+
importance: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
19
|
+
};
|
|
20
|
+
execute(args: {
|
|
21
|
+
key: string;
|
|
22
|
+
content: string;
|
|
23
|
+
type: "user_profile" | "tech_stack" | "project_context" | "pattern" | "decision" | "explicit";
|
|
24
|
+
importance: number;
|
|
25
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Search memories.
|
|
29
|
+
*/
|
|
30
|
+
export declare const memSearch: {
|
|
31
|
+
description: string;
|
|
32
|
+
args: {
|
|
33
|
+
query: z.ZodString;
|
|
34
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
35
|
+
user_profile: "user_profile";
|
|
36
|
+
tech_stack: "tech_stack";
|
|
37
|
+
project_context: "project_context";
|
|
38
|
+
session: "session";
|
|
39
|
+
pattern: "pattern";
|
|
40
|
+
decision: "decision";
|
|
41
|
+
explicit: "explicit";
|
|
42
|
+
}>>;
|
|
43
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
44
|
+
};
|
|
45
|
+
execute(args: {
|
|
46
|
+
query: string;
|
|
47
|
+
limit: number;
|
|
48
|
+
type?: "user_profile" | "tech_stack" | "project_context" | "session" | "pattern" | "decision" | "explicit" | undefined;
|
|
49
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Forget/delete a memory.
|
|
53
|
+
*/
|
|
54
|
+
export declare const memForget: {
|
|
55
|
+
description: string;
|
|
56
|
+
args: {
|
|
57
|
+
id: z.ZodString;
|
|
58
|
+
};
|
|
59
|
+
execute(args: {
|
|
60
|
+
id: string;
|
|
61
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* List all memory types with counts.
|
|
65
|
+
*/
|
|
66
|
+
export declare const memStats: {
|
|
67
|
+
description: string;
|
|
68
|
+
args: {};
|
|
69
|
+
execute(args: Record<string, never>, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
70
|
+
};
|
|
71
|
+
export declare const toolDefinitions: {
|
|
72
|
+
mem_save: {
|
|
73
|
+
description: string;
|
|
74
|
+
args: {
|
|
75
|
+
key: z.ZodString;
|
|
76
|
+
content: z.ZodString;
|
|
77
|
+
type: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
78
|
+
user_profile: "user_profile";
|
|
79
|
+
tech_stack: "tech_stack";
|
|
80
|
+
project_context: "project_context";
|
|
81
|
+
pattern: "pattern";
|
|
82
|
+
decision: "decision";
|
|
83
|
+
explicit: "explicit";
|
|
84
|
+
}>>>;
|
|
85
|
+
importance: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
86
|
+
};
|
|
87
|
+
execute(args: {
|
|
88
|
+
key: string;
|
|
89
|
+
content: string;
|
|
90
|
+
type: "user_profile" | "tech_stack" | "project_context" | "pattern" | "decision" | "explicit";
|
|
91
|
+
importance: number;
|
|
92
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
93
|
+
};
|
|
94
|
+
mem_search: {
|
|
95
|
+
description: string;
|
|
96
|
+
args: {
|
|
97
|
+
query: z.ZodString;
|
|
98
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
99
|
+
user_profile: "user_profile";
|
|
100
|
+
tech_stack: "tech_stack";
|
|
101
|
+
project_context: "project_context";
|
|
102
|
+
session: "session";
|
|
103
|
+
pattern: "pattern";
|
|
104
|
+
decision: "decision";
|
|
105
|
+
explicit: "explicit";
|
|
106
|
+
}>>;
|
|
107
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
108
|
+
};
|
|
109
|
+
execute(args: {
|
|
110
|
+
query: string;
|
|
111
|
+
limit: number;
|
|
112
|
+
type?: "user_profile" | "tech_stack" | "project_context" | "session" | "pattern" | "decision" | "explicit" | undefined;
|
|
113
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
114
|
+
};
|
|
115
|
+
mem_forget: {
|
|
116
|
+
description: string;
|
|
117
|
+
args: {
|
|
118
|
+
id: z.ZodString;
|
|
119
|
+
};
|
|
120
|
+
execute(args: {
|
|
121
|
+
id: string;
|
|
122
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
123
|
+
};
|
|
124
|
+
mem_stats: {
|
|
125
|
+
description: string;
|
|
126
|
+
args: {};
|
|
127
|
+
execute(args: Record<string, never>, context: import("@opencode-ai/plugin").ToolContext): Promise<import("@opencode-ai/plugin").ToolResult>;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=definitions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;CAqBlB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;CAkBpB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;CAQpB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;CAMnB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAK3B,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { tool } from '@opencode-ai/plugin';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* Save a memory explicitly.
|
|
5
|
+
*/
|
|
6
|
+
export const memSave = tool({
|
|
7
|
+
description: 'Save a piece of information to Ultra Memory for future recall across sessions',
|
|
8
|
+
args: {
|
|
9
|
+
key: z.string().describe('Unique key for this memory (e.g. "favorite-framework")'),
|
|
10
|
+
content: z.string().describe('The memory content to store'),
|
|
11
|
+
type: z
|
|
12
|
+
.enum(['user_profile', 'tech_stack', 'project_context', 'pattern', 'decision', 'explicit'])
|
|
13
|
+
.optional()
|
|
14
|
+
.default('explicit')
|
|
15
|
+
.describe('Optional memory category'),
|
|
16
|
+
importance: z
|
|
17
|
+
.number().min(1).max(5)
|
|
18
|
+
.optional()
|
|
19
|
+
.default(3)
|
|
20
|
+
.describe('Importance level 1-5 (higher = more likely to be recalled)'),
|
|
21
|
+
},
|
|
22
|
+
execute: async (args) => {
|
|
23
|
+
const { key, content, type, importance } = args;
|
|
24
|
+
const result = { action: 'save', key, content, type, importance };
|
|
25
|
+
return JSON.stringify(result);
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* Search memories.
|
|
30
|
+
*/
|
|
31
|
+
export const memSearch = tool({
|
|
32
|
+
description: 'Search through all stored Ultra Memory entries across sessions',
|
|
33
|
+
args: {
|
|
34
|
+
query: z.string().describe('Search text to find relevant memories'),
|
|
35
|
+
type: z
|
|
36
|
+
.enum(['user_profile', 'tech_stack', 'project_context', 'session', 'pattern', 'decision', 'explicit'])
|
|
37
|
+
.optional()
|
|
38
|
+
.describe('Optional filter by memory type'),
|
|
39
|
+
limit: z
|
|
40
|
+
.number().int().min(1).max(100)
|
|
41
|
+
.optional()
|
|
42
|
+
.default(10)
|
|
43
|
+
.describe('Maximum number of results to return'),
|
|
44
|
+
},
|
|
45
|
+
execute: async (args) => {
|
|
46
|
+
const { query, type, limit } = args;
|
|
47
|
+
return JSON.stringify({ action: 'search', query, type, limit });
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
/**
|
|
51
|
+
* Forget/delete a memory.
|
|
52
|
+
*/
|
|
53
|
+
export const memForget = tool({
|
|
54
|
+
description: 'Remove a specific memory from Ultra Memory by its ID',
|
|
55
|
+
args: {
|
|
56
|
+
id: z.string().uuid().describe('UUID of the memory to delete'),
|
|
57
|
+
},
|
|
58
|
+
execute: async (args) => {
|
|
59
|
+
return JSON.stringify({ action: 'forget', id: args.id });
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* List all memory types with counts.
|
|
64
|
+
*/
|
|
65
|
+
export const memStats = tool({
|
|
66
|
+
description: 'Get statistics about stored memories — counts by type, total entries',
|
|
67
|
+
args: {},
|
|
68
|
+
execute: async () => {
|
|
69
|
+
return JSON.stringify({ action: 'stats' });
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
export const toolDefinitions = {
|
|
73
|
+
mem_save: memSave,
|
|
74
|
+
mem_search: memSearch,
|
|
75
|
+
mem_forget: memForget,
|
|
76
|
+
mem_stats: memStats,
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC;IAC1B,WAAW,EAAE,+EAA+E;IAC5F,IAAI,EAAE;QACJ,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wDAAwD,CAAC;QAClF,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;QAC3D,IAAI,EAAE,CAAC;aACJ,IAAI,CAAC,CAAC,cAAc,EAAE,YAAY,EAAE,iBAAiB,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;aAC1F,QAAQ,EAAE;aACV,OAAO,CAAC,UAAU,CAAC;aACnB,QAAQ,CAAC,0BAA0B,CAAC;QACvC,UAAU,EAAE,CAAC;aACV,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;aACtB,QAAQ,EAAE;aACV,OAAO,CAAC,CAAC,CAAC;aACV,QAAQ,CAAC,4DAA4D,CAAC;KAC1E;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EA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E;QACJ,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;KAC/D;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACtB,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,QAAiB,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC;CACF,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAC;IAC3B,WAAW,EAAE,sEAAsE;IACnF,IAAI,EAAE,EAAE;IACR,OAAO,EAAE,KAAK,IAAI,EAAE;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,OAAgB,EAAE,CAAC,CAAC;IACtD,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,QAAQ,EAAE,OAAO;IACjB,UAAU,EAAE,SAAS;IACrB,UAAU,EAAE,SAAS;IACrB,SAAS,EAAE,QAAQ;CACpB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ToolResult, ToolContext } from '@opencode-ai/plugin';
|
|
2
|
+
/**
|
|
3
|
+
* Save a memory explicitly via tool call.
|
|
4
|
+
* Delegates to createMemory() with derived project context.
|
|
5
|
+
*/
|
|
6
|
+
export declare function executeMemSave(args: {
|
|
7
|
+
key: string;
|
|
8
|
+
content: string;
|
|
9
|
+
type?: string;
|
|
10
|
+
importance?: number;
|
|
11
|
+
}, context: ToolContext): Promise<ToolResult>;
|
|
12
|
+
/**
|
|
13
|
+
* Search stored memories via tool call.
|
|
14
|
+
* Formats results as a clean numbered list for the LLM.
|
|
15
|
+
*/
|
|
16
|
+
export declare function executeMemSearch(args: {
|
|
17
|
+
query: string;
|
|
18
|
+
type?: string;
|
|
19
|
+
limit?: number;
|
|
20
|
+
}, context: ToolContext): Promise<ToolResult>;
|
|
21
|
+
/**
|
|
22
|
+
* Delete a specific memory by ID via tool call.
|
|
23
|
+
*/
|
|
24
|
+
export declare function executeMemForget(args: {
|
|
25
|
+
id: string;
|
|
26
|
+
}, _context: ToolContext): Promise<ToolResult>;
|
|
27
|
+
/**
|
|
28
|
+
* Get memory statistics via tool call.
|
|
29
|
+
* Returns counts grouped by memory type.
|
|
30
|
+
*/
|
|
31
|
+
export declare function executeMemStats(_args: Record<string, never>, _context: ToolContext): Promise<ToolResult>;
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAoBnE;;;GAGG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,EAC1E,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,CAAC,CA4BrB;AAID;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EACtD,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,CAAC,CAqCrB;AAID;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EACpB,QAAQ,EAAE,WAAW,GACpB,OAAO,CAAC,UAAU,CAAC,CAyBrB;AAID;;;GAGG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAC5B,QAAQ,EAAE,WAAW,GACpB,OAAO,CAAC,UAAU,CAAC,CA0BrB"}
|