@j0hanz/memory-mcp 1.5.0 → 1.6.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/dist/completions/index.d.ts +1 -0
- package/dist/completions/index.d.ts.map +1 -0
- package/dist/db/index.d.ts +1 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +10 -8
- package/dist/db/typed.d.ts +1 -0
- package/dist/db/typed.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/lib/errors.d.ts +1 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/hash.d.ts +1 -0
- package/dist/lib/hash.d.ts.map +1 -0
- package/dist/lib/instructions.d.ts +1 -0
- package/dist/lib/instructions.d.ts.map +1 -0
- package/dist/lib/json-schema.d.ts +1 -0
- package/dist/lib/json-schema.d.ts.map +1 -0
- package/dist/lib/mcp-utils.d.ts +1 -0
- package/dist/lib/mcp-utils.d.ts.map +1 -0
- package/dist/lib/pagination.d.ts +1 -0
- package/dist/lib/pagination.d.ts.map +1 -0
- package/dist/lib/search-cursor.d.ts +1 -0
- package/dist/lib/search-cursor.d.ts.map +1 -0
- package/dist/lib/search.d.ts +1 -0
- package/dist/lib/search.d.ts.map +1 -0
- package/dist/lib/search.js +31 -23
- package/dist/lib/sql.d.ts +1 -0
- package/dist/lib/sql.d.ts.map +1 -0
- package/dist/lib/tool-contracts.d.ts +1 -0
- package/dist/lib/tool-contracts.d.ts.map +1 -0
- package/dist/lib/tool-contracts.js +65 -93
- package/dist/lib/tool-execution.d.ts +13 -0
- package/dist/lib/tool-execution.d.ts.map +1 -0
- package/dist/lib/tool-execution.js +28 -0
- package/dist/lib/tool-response.d.ts +1 -0
- package/dist/lib/tool-response.d.ts.map +1 -0
- package/dist/lib/types.d.ts +1 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/prompts/index.d.ts +1 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +12 -8
- package/dist/resources/index.d.ts +1 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +65 -38
- package/dist/resources/instructions.d.ts +1 -0
- package/dist/resources/instructions.d.ts.map +1 -0
- package/dist/resources/instructions.js +44 -37
- package/dist/resources/server-config.d.ts +1 -0
- package/dist/resources/server-config.d.ts.map +1 -0
- package/dist/resources/server-config.js +33 -22
- package/dist/resources/tool-catalog.d.ts +1 -0
- package/dist/resources/tool-catalog.d.ts.map +1 -0
- package/dist/resources/tool-catalog.js +10 -5
- package/dist/resources/tool-info.d.ts +1 -0
- package/dist/resources/tool-info.d.ts.map +1 -0
- package/dist/resources/tool-info.js +17 -8
- package/dist/resources/workflows.d.ts +1 -0
- package/dist/resources/workflows.d.ts.map +1 -0
- package/dist/resources/workflows.js +69 -40
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/inputs.d.ts +1 -0
- package/dist/schemas/inputs.d.ts.map +1 -0
- package/dist/schemas/inputs.js +14 -10
- package/dist/schemas/outputs.d.ts +7 -6
- package/dist/schemas/outputs.d.ts.map +1 -0
- package/dist/schemas/outputs.js +7 -6
- package/dist/server.d.ts +1 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +11 -4
- package/dist/tools/create-relationship.d.ts +1 -0
- package/dist/tools/create-relationship.d.ts.map +1 -0
- package/dist/tools/create-relationship.js +14 -19
- package/dist/tools/delete-memories.d.ts +1 -0
- package/dist/tools/delete-memories.d.ts.map +1 -0
- package/dist/tools/delete-memories.js +27 -37
- package/dist/tools/delete-memory.d.ts +1 -0
- package/dist/tools/delete-memory.d.ts.map +1 -0
- package/dist/tools/delete-memory.js +9 -15
- package/dist/tools/delete-relationship.d.ts +1 -0
- package/dist/tools/delete-relationship.d.ts.map +1 -0
- package/dist/tools/delete-relationship.js +7 -12
- package/dist/tools/get-memory.d.ts +1 -0
- package/dist/tools/get-memory.d.ts.map +1 -0
- package/dist/tools/get-memory.js +9 -14
- package/dist/tools/get-relationships.d.ts +1 -0
- package/dist/tools/get-relationships.d.ts.map +1 -0
- package/dist/tools/get-relationships.js +12 -17
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/memory-stats.d.ts +1 -0
- package/dist/tools/memory-stats.d.ts.map +1 -0
- package/dist/tools/memory-stats.js +22 -28
- package/dist/tools/progress.d.ts +1 -0
- package/dist/tools/progress.d.ts.map +1 -0
- package/dist/tools/progress.js +30 -23
- package/dist/tools/recall.d.ts +1 -0
- package/dist/tools/recall.d.ts.map +1 -0
- package/dist/tools/recall.js +77 -48
- package/dist/tools/register-contract.d.ts +1 -0
- package/dist/tools/register-contract.d.ts.map +1 -0
- package/dist/tools/result.d.ts +1 -0
- package/dist/tools/result.d.ts.map +1 -0
- package/dist/tools/retrieve-context.d.ts +1 -0
- package/dist/tools/retrieve-context.d.ts.map +1 -0
- package/dist/tools/retrieve-context.js +47 -33
- package/dist/tools/search-memories.d.ts +1 -0
- package/dist/tools/search-memories.d.ts.map +1 -0
- package/dist/tools/search-memories.js +24 -30
- package/dist/tools/store-memories.d.ts +1 -0
- package/dist/tools/store-memories.d.ts.map +1 -0
- package/dist/tools/store-memories.js +32 -42
- package/dist/tools/store-memory.d.ts +1 -0
- package/dist/tools/store-memory.d.ts.map +1 -0
- package/dist/tools/store-memory.js +12 -18
- package/dist/tools/update-memory.d.ts +1 -0
- package/dist/tools/update-memory.d.ts.map +1 -0
- package/dist/tools/update-memory.js +41 -46
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/completions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAoB9C,wBAAgB,4BAA4B,CAC1C,EAAE,EAAE,OAAO,GACV,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,EAAE,CAO7B"}
|
package/dist/db/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/db/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AA6LzD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAWvD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGvD"}
|
package/dist/db/index.js
CHANGED
|
@@ -63,6 +63,14 @@ const SCHEMA_SQL = `
|
|
|
63
63
|
CREATE INDEX IF NOT EXISTS idx_relationships_to
|
|
64
64
|
ON relationships(to_hash);
|
|
65
65
|
`;
|
|
66
|
+
const RELATIONSHIP_EDGE_COLUMNS = new Set(['from_hash', 'to_hash']);
|
|
67
|
+
function isMemoryRelationshipForeignKey(row) {
|
|
68
|
+
return row.table === 'memories' && RELATIONSHIP_EDGE_COLUMNS.has(row.from);
|
|
69
|
+
}
|
|
70
|
+
function ensureRelationshipIndexes(db) {
|
|
71
|
+
db.exec('CREATE INDEX IF NOT EXISTS idx_relationships_from ON relationships(from_hash)');
|
|
72
|
+
db.exec('CREATE INDEX IF NOT EXISTS idx_relationships_to ON relationships(to_hash)');
|
|
73
|
+
}
|
|
66
74
|
function runImmediateTransaction(db, action) {
|
|
67
75
|
db.exec('BEGIN IMMEDIATE');
|
|
68
76
|
try {
|
|
@@ -101,13 +109,8 @@ function needsRelationshipsCascadeUpdateMigration(db) {
|
|
|
101
109
|
const rows = db
|
|
102
110
|
.prepare("PRAGMA foreign_key_list('relationships')")
|
|
103
111
|
.all();
|
|
104
|
-
if (rows.length === 0) {
|
|
105
|
-
return false;
|
|
106
|
-
}
|
|
107
112
|
for (const row of rows) {
|
|
108
|
-
|
|
109
|
-
(row.from === 'from_hash' || row.from === 'to_hash');
|
|
110
|
-
if (!isMemoryEdge) {
|
|
113
|
+
if (!isMemoryRelationshipForeignKey(row)) {
|
|
111
114
|
continue;
|
|
112
115
|
}
|
|
113
116
|
if (row.on_update.toUpperCase() !== 'CASCADE') {
|
|
@@ -126,8 +129,7 @@ function migrateRelationshipsCascadeUpdate(db) {
|
|
|
126
129
|
FROM relationships_old
|
|
127
130
|
`);
|
|
128
131
|
db.exec('DROP TABLE relationships_old');
|
|
129
|
-
db
|
|
130
|
-
db.exec('CREATE INDEX IF NOT EXISTS idx_relationships_to ON relationships(to_hash)');
|
|
132
|
+
ensureRelationshipIndexes(db);
|
|
131
133
|
});
|
|
132
134
|
}
|
|
133
135
|
function applyMigrations(db) {
|
package/dist/db/typed.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed.d.ts","sourceRoot":"","sources":["../../src/db/typed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,yBAAyB,EAC1B,MAAM,aAAa,CAAC;AAErB,KAAK,SAAS,GAAG,SAAS,aAAa,EAAE,CAAC;AAE1C,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,GAAG,CAAC,GAAG,MAAM,EAAE,SAAS,GAAG,CAAC,EAAE,CAAC;IAC/B,GAAG,CAAC,GAAG,MAAM,EAAE,SAAS,GAAG,CAAC,GAAG,SAAS,CAAC;IACzC,GAAG,CAAC,GAAG,MAAM,EAAE,SAAS,GAAG,yBAAyB,CAAC;CACtD;AAED,qBAAa,OAAO;IAGN,OAAO,CAAC,QAAQ,CAAC,EAAE;IAF/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA8C;gBAEvC,EAAE,EAAE,YAAY;IAE7C,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC;IAI1C,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC;IAU9C,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC;IAYlC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIvB,KAAK,IAAI,IAAI;CAId;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,YAAY,GAAG,OAAO,CAEvD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/lib/errors.d.ts
CHANGED
|
@@ -8,3 +8,4 @@ export declare const E_UNKNOWN = "E_UNKNOWN";
|
|
|
8
8
|
export declare function getErrorMessage(err: unknown): string;
|
|
9
9
|
export declare function isMcpError(err: unknown): err is McpError;
|
|
10
10
|
export declare function rethrowMcpError(err: unknown): void;
|
|
11
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/lib/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAE9D,eAAO,MAAM,WAAW,gBAAgB,CAAC;AACzC,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AACnD,eAAO,MAAM,UAAU,eAAe,CAAC;AACvC,eAAO,MAAM,UAAU,eAAe,CAAC;AACvC,eAAO,MAAM,WAAW,gBAAgB,CAAC;AACzC,eAAO,MAAM,SAAS,cAAc,CAAC;AAGrC,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAIpD;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,QAAQ,CAExD;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAElD"}
|
package/dist/lib/hash.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../src/lib/hash.ts"],"names":[],"mappings":"AAiBA,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,MAAM,EAAE,GACtB,MAAM,CAKR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../../src/lib/instructions.ts"],"names":[],"mappings":"AAIA,wBAAgB,gBAAgB,IAAI,MAAM,CAGzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema.d.ts","sourceRoot":"","sources":["../../src/lib/json-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEvD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,GAAG,gBAAgB,CAMrE"}
|
package/dist/lib/mcp-utils.d.ts
CHANGED
|
@@ -3,3 +3,4 @@ type LogLevel = 'debug' | 'info' | 'notice' | 'warning' | 'error';
|
|
|
3
3
|
export declare function logToolEvent(server: McpServer, logger: string, data: unknown, level?: LogLevel): Promise<void>;
|
|
4
4
|
export declare function notifyMemoryResourceUpdated(server: McpServer, hash: string): Promise<void>;
|
|
5
5
|
export {};
|
|
6
|
+
//# sourceMappingURL=mcp-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-utils.d.ts","sourceRoot":"","sources":["../../src/lib/mcp-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,KAAK,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAOlE,wBAAsB,YAAY,CAChC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,KAAK,GAAE,QAAiB,GACvB,OAAO,CAAC,IAAI,CAAC,CAUf;AAID,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CAYf"}
|
package/dist/lib/pagination.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ export interface PageSlice<T> {
|
|
|
5
5
|
export declare function encodeCursor(offset: number): string;
|
|
6
6
|
export declare function decodeCursor(cursor: string): number;
|
|
7
7
|
export declare function splitPage<T>(rows: readonly T[], limit: number): PageSlice<T>;
|
|
8
|
+
//# sourceMappingURL=pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/lib/pagination.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,OAAO,EAAE,OAAO,CAAC;CAClB;AAwCD,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAGnD;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMnD;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,CAM5E"}
|
|
@@ -10,3 +10,4 @@ export type DecodedSearchCursor = {
|
|
|
10
10
|
export declare function buildSearchCursorScope(query: string, filters: MemoryFilters): string;
|
|
11
11
|
export declare function encodeSearchCursor(scope: string, rank: number, hash: string): string;
|
|
12
12
|
export declare function decodeSearchCursor(cursor: string, expectedScope: string): DecodedSearchCursor;
|
|
13
|
+
//# sourceMappingURL=search-cursor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-cursor.d.ts","sourceRoot":"","sources":["../../src/lib/search-cursor.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAoBjD,MAAM,MAAM,mBAAmB,GAC3B;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,GACD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA+DN,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,aAAa,GACrB,MAAM,CAKR;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX,MAAM,CASR;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,GACpB,mBAAmB,CAuBrB"}
|
package/dist/lib/search.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/lib/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAW5C,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOtD;AAED,MAAM,WAAW,aAAa;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,aAAa,EAAE,CAAC;CACzB;AAOD,MAAM,MAAM,iBAAiB,GACzB;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,GACD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAWN,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,aAAa,GAAG,aAAa,CAaxE;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAMtE;AAsDD,wBAAgB,oBAAoB,CAClC,EAAE,EAAE,OAAO,EACX,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,iBAAiB,GAAG,SAAS,EACrC,OAAO,EAAE,aAAa,GACrB,SAAS,EAAE,CAIb;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE;IACtC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC,GAAG,aAAa,CAUhB"}
|
package/dist/lib/search.js
CHANGED
|
@@ -35,15 +35,18 @@ export function buildAndWhereClause(clauses) {
|
|
|
35
35
|
}
|
|
36
36
|
return ` AND ${clauses.join(' AND ')}`;
|
|
37
37
|
}
|
|
38
|
+
function buildBaseSearchWhere(whereExtra) {
|
|
39
|
+
return `${BASE_RANKED_SEARCH_SQL}
|
|
40
|
+
WHERE memories_fts MATCH ?${whereExtra}`;
|
|
41
|
+
}
|
|
38
42
|
function buildRankedSearchSql(whereExtra, cursor) {
|
|
43
|
+
const whereSql = buildBaseSearchWhere(whereExtra);
|
|
39
44
|
if (!cursor || cursor.mode === 'offset') {
|
|
40
|
-
return `${
|
|
41
|
-
WHERE memories_fts MATCH ?${whereExtra}
|
|
45
|
+
return `${whereSql}
|
|
42
46
|
ORDER BY memories_fts.rank, m.hash
|
|
43
47
|
LIMIT ? OFFSET ?`;
|
|
44
48
|
}
|
|
45
|
-
return `${
|
|
46
|
-
WHERE memories_fts MATCH ?${whereExtra}
|
|
49
|
+
return `${whereSql}
|
|
47
50
|
AND (
|
|
48
51
|
memories_fts.rank > ?
|
|
49
52
|
OR (memories_fts.rank = ? AND m.hash > ?)
|
|
@@ -51,28 +54,33 @@ function buildRankedSearchSql(whereExtra, cursor) {
|
|
|
51
54
|
ORDER BY memories_fts.rank, m.hash
|
|
52
55
|
LIMIT ?`;
|
|
53
56
|
}
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
const filter = buildFilterClauses(filters);
|
|
57
|
-
const whereExtra = buildAndWhereClause(filter.clauses);
|
|
58
|
-
const sql = buildRankedSearchSql(whereExtra, cursor);
|
|
59
|
-
const stmt = db.prepareOnce(sql);
|
|
57
|
+
function buildRankedSearchParams(ftsQuery, filterParams, limit, cursor) {
|
|
58
|
+
const baseParams = [ftsQuery, ...filterParams];
|
|
60
59
|
if (!cursor || cursor.mode === 'offset') {
|
|
61
60
|
const offset = cursor?.offset ?? 0;
|
|
62
|
-
return
|
|
61
|
+
return [...baseParams, limit + 1, offset];
|
|
63
62
|
}
|
|
64
|
-
return
|
|
63
|
+
return [...baseParams, cursor.rank, cursor.rank, cursor.hash, limit + 1];
|
|
64
|
+
}
|
|
65
|
+
function buildSearchPlan(query, limit, cursor, filters) {
|
|
66
|
+
const filter = buildFilterClauses(filters);
|
|
67
|
+
const sql = buildRankedSearchSql(buildAndWhereClause(filter.clauses), cursor);
|
|
68
|
+
const params = buildRankedSearchParams(query, filter.params, limit, cursor);
|
|
69
|
+
return { sql, params };
|
|
70
|
+
}
|
|
71
|
+
export function loadRankedSearchRows(db, query, limit, cursor, filters) {
|
|
72
|
+
const ftsQuery = sanitizeFtsQuery(query);
|
|
73
|
+
const plan = buildSearchPlan(ftsQuery, limit, cursor, filters);
|
|
74
|
+
return db.prepareOnce(plan.sql).all(...plan.params);
|
|
65
75
|
}
|
|
66
76
|
export function toMemoryFilters(params) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
return filters;
|
|
77
|
+
return {
|
|
78
|
+
...(params.min_importance != null
|
|
79
|
+
? { min_importance: params.min_importance }
|
|
80
|
+
: {}),
|
|
81
|
+
...(params.max_importance != null
|
|
82
|
+
? { max_importance: params.max_importance }
|
|
83
|
+
: {}),
|
|
84
|
+
...(params.memory_type != null ? { memory_type: params.memory_type } : {}),
|
|
85
|
+
};
|
|
78
86
|
}
|
package/dist/lib/sql.d.ts
CHANGED
|
@@ -14,3 +14,4 @@ export declare const MEMORY_AGGREGATE_SQL = "SELECT COUNT(*) AS total,\n
|
|
|
14
14
|
export declare const RELATIONSHIP_COUNT_SQL = "SELECT COUNT(*) AS total FROM relationships";
|
|
15
15
|
/** Per-type memory breakdown. */
|
|
16
16
|
export declare const TYPE_COUNTS_SQL = "SELECT memory_type, COUNT(*) AS count FROM memories GROUP BY memory_type ORDER BY count DESC";
|
|
17
|
+
//# sourceMappingURL=sql.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql.d.ts","sourceRoot":"","sources":["../../src/lib/sql.ts"],"names":[],"mappings":"AAAA;mDACmD;AAEnD,8EAA8E;AAC9E,eAAO,MAAM,iBAAiB,0IACC,CAAC;AAEhC,mEAAmE;AACnE,eAAO,MAAM,iBAAiB,wCAAwC,CAAC;AAEvE,uCAAuC;AACvC,eAAO,MAAM,yBAAyB,0CACG,CAAC;AAE1C,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB,6CACS,CAAC;AAE7C,qDAAqD;AACrD,eAAO,MAAM,oBAAoB,yKAIhB,CAAC;AAElB,gCAAgC;AAChC,eAAO,MAAM,sBAAsB,gDACY,CAAC;AAEhD,iCAAiC;AACjC,eAAO,MAAM,eAAe,iGACoE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-contracts.d.ts","sourceRoot":"","sources":["../../src/lib/tool-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,QAAQ,CAAC;AAgChC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC;IACvB,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC;IACxB,WAAW,EAAE;QACX,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;KACzB,CAAC;CACH;AAsCD,eAAO,MAAM,cAAc,EAAE,YAAY,EAuHxC,CAAC;AAMF,wBAAgB,gBAAgB,IAAI,YAAY,EAAE,CAEjD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAM1D"}
|
|
@@ -1,167 +1,139 @@
|
|
|
1
1
|
import {} from 'zod/v4';
|
|
2
2
|
import { CreateRelationshipInputSchema, DeleteMemoriesInputSchema, DeleteMemoryInputSchema, DeleteRelationshipInputSchema, GetMemoryInputSchema, GetRelationshipsInputSchema, MemoryStatsInputSchema, RecallInputSchema, RetrieveContextInputSchema, SearchMemoriesInputSchema, StoreMemoriesInputSchema, StoreMemoryInputSchema, UpdateMemoryInputSchema, } from '../schemas/inputs.js';
|
|
3
3
|
import { BatchResultSchema, CreateRelationshipResultSchema, DeleteRelationshipResultSchema, DeleteResultSchema, MemoryResultSchema, RecallResultSchema, RelationshipResultSchema, RetrieveContextResultSchema, SearchResultSchema, StatsResultSchema, StoreResultSchema, UpdateResultSchema, } from '../schemas/outputs.js';
|
|
4
|
+
const DEFAULT_ANNOTATIONS = {
|
|
5
|
+
readOnlyHint: false,
|
|
6
|
+
idempotentHint: false,
|
|
7
|
+
destructiveHint: false,
|
|
8
|
+
openWorldHint: false,
|
|
9
|
+
};
|
|
10
|
+
const READ_ONLY_ANNOTATIONS = {
|
|
11
|
+
readOnlyHint: true,
|
|
12
|
+
};
|
|
13
|
+
const IDEMPOTENT_ANNOTATIONS = {
|
|
14
|
+
idempotentHint: true,
|
|
15
|
+
};
|
|
16
|
+
const DESTRUCTIVE_ANNOTATIONS = {
|
|
17
|
+
destructiveHint: true,
|
|
18
|
+
};
|
|
19
|
+
function createToolContract(definition) {
|
|
20
|
+
const { annotations, ...rest } = definition;
|
|
21
|
+
return {
|
|
22
|
+
...rest,
|
|
23
|
+
annotations: {
|
|
24
|
+
...DEFAULT_ANNOTATIONS,
|
|
25
|
+
...annotations,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
4
29
|
export const TOOL_CONTRACTS = [
|
|
5
|
-
{
|
|
30
|
+
createToolContract({
|
|
6
31
|
name: 'store_memory',
|
|
7
32
|
title: 'Store Memory',
|
|
8
33
|
description: 'Store single memory. Returns hash. Idempotent (created: false if exists). Prefer store_memories.',
|
|
9
34
|
inputSchema: StoreMemoryInputSchema,
|
|
10
35
|
outputSchema: StoreResultSchema,
|
|
11
|
-
annotations:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
destructiveHint: false,
|
|
15
|
-
openWorldHint: false,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
{
|
|
36
|
+
annotations: IDEMPOTENT_ANNOTATIONS,
|
|
37
|
+
}),
|
|
38
|
+
createToolContract({
|
|
19
39
|
name: 'store_memories',
|
|
20
40
|
title: 'Store Memories (Batch)',
|
|
21
41
|
description: 'Store 1-50 memories atomically. Idempotent. Rolls back on error.',
|
|
22
42
|
inputSchema: StoreMemoriesInputSchema,
|
|
23
43
|
outputSchema: BatchResultSchema,
|
|
24
|
-
annotations:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
destructiveHint: false,
|
|
28
|
-
openWorldHint: false,
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
{
|
|
44
|
+
annotations: IDEMPOTENT_ANNOTATIONS,
|
|
45
|
+
}),
|
|
46
|
+
createToolContract({
|
|
32
47
|
name: 'get_memory',
|
|
33
48
|
title: 'Get Memory',
|
|
34
49
|
description: 'Retrieve memory by SHA-256 hash. Returns E_NOT_FOUND if missing.',
|
|
35
50
|
inputSchema: GetMemoryInputSchema,
|
|
36
51
|
outputSchema: MemoryResultSchema,
|
|
37
|
-
annotations:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
openWorldHint: false,
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
{
|
|
52
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
53
|
+
}),
|
|
54
|
+
createToolContract({
|
|
44
55
|
name: 'search_memories',
|
|
45
56
|
title: 'Search Memories',
|
|
46
57
|
description: 'Full-text search (content+tags). Ranked, paginated. Alphanumeric/underscore only. Implicit AND.',
|
|
47
58
|
inputSchema: SearchMemoriesInputSchema,
|
|
48
59
|
outputSchema: SearchResultSchema,
|
|
49
|
-
annotations:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
openWorldHint: false,
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
{
|
|
60
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
61
|
+
}),
|
|
62
|
+
createToolContract({
|
|
56
63
|
name: 'retrieve_context',
|
|
57
64
|
title: 'Retrieve Context',
|
|
58
65
|
description: 'FTS search within token budget. Sorts by relevance/importance/recency. Returns truncated: true if limit hit.',
|
|
59
66
|
inputSchema: RetrieveContextInputSchema,
|
|
60
67
|
outputSchema: RetrieveContextResultSchema,
|
|
61
|
-
annotations:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
openWorldHint: false,
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
69
|
+
}),
|
|
70
|
+
createToolContract({
|
|
68
71
|
name: 'recall',
|
|
69
72
|
title: 'Recall (BFS Graph Traversal)',
|
|
70
73
|
description: 'FTS search + BFS traversal (depth hops). Returns memories+edges. Emits progress. Aborts on limit.',
|
|
71
74
|
inputSchema: RecallInputSchema,
|
|
72
75
|
outputSchema: RecallResultSchema,
|
|
73
|
-
annotations:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
openWorldHint: false,
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
{
|
|
76
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
77
|
+
}),
|
|
78
|
+
createToolContract({
|
|
80
79
|
name: 'update_memory',
|
|
81
80
|
title: 'Update Memory',
|
|
82
81
|
description: 'Update content/tags. Returns old+new hash. Cascade updates relationships.',
|
|
83
82
|
inputSchema: UpdateMemoryInputSchema,
|
|
84
83
|
outputSchema: UpdateResultSchema,
|
|
85
|
-
annotations:
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
openWorldHint: false,
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
{
|
|
84
|
+
annotations: DESTRUCTIVE_ANNOTATIONS,
|
|
85
|
+
}),
|
|
86
|
+
createToolContract({
|
|
92
87
|
name: 'delete_memory',
|
|
93
88
|
title: 'Delete Memory',
|
|
94
89
|
description: 'Delete memory by hash. Cascade deletes relationships. Idempotent.',
|
|
95
90
|
inputSchema: DeleteMemoryInputSchema,
|
|
96
91
|
outputSchema: DeleteResultSchema,
|
|
97
92
|
annotations: {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
destructiveHint: true,
|
|
101
|
-
openWorldHint: false,
|
|
93
|
+
...DESTRUCTIVE_ANNOTATIONS,
|
|
94
|
+
...IDEMPOTENT_ANNOTATIONS,
|
|
102
95
|
},
|
|
103
|
-
},
|
|
104
|
-
{
|
|
96
|
+
}),
|
|
97
|
+
createToolContract({
|
|
105
98
|
name: 'delete_memories',
|
|
106
99
|
title: 'Delete Memories (Batch)',
|
|
107
100
|
description: 'Delete 1-50 memories atomically. Cascade deletes. Rolls back on error.',
|
|
108
101
|
inputSchema: DeleteMemoriesInputSchema,
|
|
109
102
|
outputSchema: BatchResultSchema,
|
|
110
|
-
annotations:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
openWorldHint: false,
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
{
|
|
103
|
+
annotations: DESTRUCTIVE_ANNOTATIONS,
|
|
104
|
+
}),
|
|
105
|
+
createToolContract({
|
|
117
106
|
name: 'create_relationship',
|
|
118
107
|
title: 'Create Relationship',
|
|
119
108
|
description: 'Create directed edge. Idempotent. Errors if endpoints missing.',
|
|
120
109
|
inputSchema: CreateRelationshipInputSchema,
|
|
121
110
|
outputSchema: CreateRelationshipResultSchema,
|
|
122
|
-
annotations:
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
destructiveHint: false,
|
|
126
|
-
openWorldHint: false,
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
{
|
|
111
|
+
annotations: IDEMPOTENT_ANNOTATIONS,
|
|
112
|
+
}),
|
|
113
|
+
createToolContract({
|
|
130
114
|
name: 'delete_relationship',
|
|
131
115
|
title: 'Delete Relationship',
|
|
132
116
|
description: 'Delete edge. Exact match required. Errors if missing.',
|
|
133
117
|
inputSchema: DeleteRelationshipInputSchema,
|
|
134
118
|
outputSchema: DeleteRelationshipResultSchema,
|
|
135
|
-
annotations:
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
openWorldHint: false,
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
{
|
|
119
|
+
annotations: DESTRUCTIVE_ANNOTATIONS,
|
|
120
|
+
}),
|
|
121
|
+
createToolContract({
|
|
142
122
|
name: 'get_relationships',
|
|
143
123
|
title: 'Get Relationships',
|
|
144
124
|
description: 'Get relationships for memory. Filter direction. Inlines related memory.',
|
|
145
125
|
inputSchema: GetRelationshipsInputSchema,
|
|
146
126
|
outputSchema: RelationshipResultSchema,
|
|
147
|
-
annotations:
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
openWorldHint: false,
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
{
|
|
127
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
128
|
+
}),
|
|
129
|
+
createToolContract({
|
|
154
130
|
name: 'memory_stats',
|
|
155
131
|
title: 'Memory Stats',
|
|
156
132
|
description: 'Get global stats: counts, timestamps, importance.',
|
|
157
133
|
inputSchema: MemoryStatsInputSchema,
|
|
158
134
|
outputSchema: StatsResultSchema,
|
|
159
|
-
annotations:
|
|
160
|
-
|
|
161
|
-
destructiveHint: false,
|
|
162
|
-
openWorldHint: false,
|
|
163
|
-
},
|
|
164
|
-
},
|
|
135
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
136
|
+
}),
|
|
165
137
|
];
|
|
166
138
|
const TOOL_CONTRACTS_BY_NAME = new Map(TOOL_CONTRACTS.map((contract) => [contract.name, contract]));
|
|
167
139
|
export function getToolContracts() {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
interface BatchSummary {
|
|
3
|
+
succeeded: number;
|
|
4
|
+
failed: number;
|
|
5
|
+
matched: number;
|
|
6
|
+
}
|
|
7
|
+
interface BatchItemLike {
|
|
8
|
+
ok: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function executeToolSafely(work: () => Promise<CallToolResult> | CallToolResult): Promise<CallToolResult>;
|
|
11
|
+
export declare function summarizeBatch<T extends BatchItemLike>(items: readonly T[], isMatched: (item: T) => boolean): BatchSummary;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=tool-execution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-execution.d.ts","sourceRoot":"","sources":["../../src/lib/tool-execution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAKzE,UAAU,YAAY;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,aAAa;IACrB,EAAE,EAAE,OAAO,CAAC;CACb;AAED,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,OAAO,CAAC,cAAc,CAAC,GAAG,cAAc,GACnD,OAAO,CAAC,cAAc,CAAC,CAOzB;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,aAAa,EACpD,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,SAAS,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,GAC9B,YAAY,CAkBd"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { E_UNKNOWN, getErrorMessage, rethrowMcpError } from './errors.js';
|
|
2
|
+
import { createErrorResponse } from './tool-response.js';
|
|
3
|
+
export async function executeToolSafely(work) {
|
|
4
|
+
try {
|
|
5
|
+
return await work();
|
|
6
|
+
}
|
|
7
|
+
catch (err) {
|
|
8
|
+
rethrowMcpError(err);
|
|
9
|
+
return createErrorResponse(E_UNKNOWN, getErrorMessage(err));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export function summarizeBatch(items, isMatched) {
|
|
13
|
+
let succeeded = 0;
|
|
14
|
+
let matched = 0;
|
|
15
|
+
for (const item of items) {
|
|
16
|
+
if (item.ok) {
|
|
17
|
+
succeeded += 1;
|
|
18
|
+
}
|
|
19
|
+
if (isMatched(item)) {
|
|
20
|
+
matched += 1;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
succeeded,
|
|
25
|
+
failed: items.length - succeeded,
|
|
26
|
+
matched,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
2
|
export declare function createToolResponse(payload: Record<string, unknown>): CallToolResult;
|
|
3
3
|
export declare function createErrorResponse(code: string, message: string): CallToolResult;
|
|
4
|
+
//# sourceMappingURL=tool-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-response.d.ts","sourceRoot":"","sources":["../../src/lib/tool-response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAyBzE,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,cAAc,CAMhB;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,cAAc,CAMhB"}
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,sBAAuB,SAAQ,YAAY;IAC1D,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,MAAM,gBAAgB,GAAG,IAAI,CACjC,YAAY,EACZ,WAAW,GAAG,SAAS,GAAG,eAAe,CAC1C,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,OAAO;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,OAAO;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;CACd;AAQD,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAOpD;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM,CAarD"}
|
package/dist/prompts/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAsCzE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAS1D"}
|
package/dist/prompts/index.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { loadInstructions } from '../lib/instructions.js';
|
|
2
2
|
const INSTRUCTIONS_CONTENT = loadInstructions();
|
|
3
|
+
const GET_HELP_PROMPT = {
|
|
4
|
+
name: 'get-help',
|
|
5
|
+
title: 'Get Help',
|
|
6
|
+
description: 'Return full usage instructions.',
|
|
7
|
+
};
|
|
3
8
|
function createHelpMessages(instructions) {
|
|
4
9
|
return [
|
|
5
10
|
{
|
|
@@ -19,13 +24,12 @@ function createHelpMessages(instructions) {
|
|
|
19
24
|
];
|
|
20
25
|
}
|
|
21
26
|
const HELP_MESSAGES = createHelpMessages(INSTRUCTIONS_CONTENT);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
description: 'Return full usage instructions.',
|
|
26
|
-
};
|
|
27
|
+
function createGetHelpPromptResult() {
|
|
28
|
+
return { messages: HELP_MESSAGES };
|
|
29
|
+
}
|
|
27
30
|
export function registerAllPrompts(server) {
|
|
28
|
-
server.registerPrompt(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
server.registerPrompt(GET_HELP_PROMPT.name, {
|
|
32
|
+
title: GET_HELP_PROMPT.title,
|
|
33
|
+
description: GET_HELP_PROMPT.description,
|
|
34
|
+
}, createGetHelpPromptResult);
|
|
31
35
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAKzE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAsQ9C,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,GAAG,IAAI,CAkEzE"}
|