@ai-devkit/memory 0.3.0 → 0.4.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/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEtH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;AAC3C,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,CAAC;AAGvG,MAAM,WAAW,kBAAkB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,GAAG,oBAAoB,CASpF;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,mBAAmB,GAAG,qBAAqB,CASvF"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEtH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;AAC3C,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,CAAC;AAGvG,MAAM,WAAW,kBAAkB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,GAAG,oBAAoB,CAapF;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,mBAAmB,GAAG,qBAAqB,CAavF"}
package/dist/api.js CHANGED
@@ -24,23 +24,32 @@ _export(exports, {
24
24
  });
25
25
  const _store = require("./handlers/store");
26
26
  const _search = require("./handlers/search");
27
+ const _database = require("./database");
27
28
  function memoryStoreCommand(options) {
28
- const input = {
29
- title: options.title,
30
- content: options.content,
31
- tags: options.tags ? options.tags.split(',').map((t)=>t.trim()) : undefined,
32
- scope: options.scope
33
- };
34
- return (0, _store.storeKnowledge)(input);
29
+ try {
30
+ const input = {
31
+ title: options.title,
32
+ content: options.content,
33
+ tags: options.tags ? options.tags.split(',').map((t)=>t.trim()) : undefined,
34
+ scope: options.scope
35
+ };
36
+ return (0, _store.storeKnowledge)(input);
37
+ } finally{
38
+ (0, _database.closeDatabase)();
39
+ }
35
40
  }
36
41
  function memorySearchCommand(options) {
37
- const input = {
38
- query: options.query,
39
- contextTags: options.tags ? options.tags.split(',').map((t)=>t.trim()) : undefined,
40
- scope: options.scope,
41
- limit: options.limit
42
- };
43
- return (0, _search.searchKnowledge)(input);
42
+ try {
43
+ const input = {
44
+ query: options.query,
45
+ contextTags: options.tags ? options.tags.split(',').map((t)=>t.trim()) : undefined,
46
+ scope: options.scope,
47
+ limit: options.limit
48
+ };
49
+ return (0, _search.searchKnowledge)(input);
50
+ } finally{
51
+ (0, _database.closeDatabase)();
52
+ }
44
53
  }
45
54
 
46
55
  //# sourceMappingURL=api.js.map
package/dist/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api.ts"],"sourcesContent":["import { storeKnowledge } from './handlers/store';\nimport { searchKnowledge } from './handlers/search';\nimport type { StoreKnowledgeInput, SearchKnowledgeInput, StoreKnowledgeResult, SearchKnowledgeResult } from './types';\n\nexport { storeKnowledge, searchKnowledge };\nexport type { StoreKnowledgeInput, SearchKnowledgeInput, StoreKnowledgeResult, SearchKnowledgeResult };\n\n// CLI command handlers for integration with main ai-devkit CLI\nexport interface MemoryStoreOptions {\n title: string;\n content: string;\n tags?: string;\n scope?: string;\n}\n\nexport interface MemorySearchOptions {\n query: string;\n tags?: string;\n scope?: string;\n limit?: number;\n}\n\nexport function memoryStoreCommand(options: MemoryStoreOptions): StoreKnowledgeResult {\n const input: StoreKnowledgeInput = {\n title: options.title,\n content: options.content,\n tags: options.tags ? options.tags.split(',').map(t => t.trim()) : undefined,\n scope: options.scope,\n };\n\n return storeKnowledge(input);\n}\n\nexport function memorySearchCommand(options: MemorySearchOptions): SearchKnowledgeResult {\n const input: SearchKnowledgeInput = {\n query: options.query,\n contextTags: options.tags ? options.tags.split(',').map(t => t.trim()) : undefined,\n scope: options.scope,\n limit: options.limit,\n };\n\n return searchKnowledge(input);\n}\n"],"names":["memorySearchCommand","memoryStoreCommand","searchKnowledge","storeKnowledge","options","input","title","content","tags","split","map","t","trim","undefined","scope","query","contextTags","limit"],"mappings":";;;;;;;;;;;QAiCgBA;eAAAA;;QAXAC;eAAAA;;QAlBSC;eAAAA,uBAAe;;QAA/BC;eAAAA,qBAAc;;;uBAJQ;wBACC;AAqBzB,SAASF,mBAAmBG,OAA2B;IAC1D,MAAMC,QAA6B;QAC/BC,OAAOF,QAAQE,KAAK;QACpBC,SAASH,QAAQG,OAAO;QACxBC,MAAMJ,QAAQI,IAAI,GAAGJ,QAAQI,IAAI,CAACC,KAAK,CAAC,KAAKC,GAAG,CAACC,CAAAA,IAAKA,EAAEC,IAAI,MAAMC;QAClEC,OAAOV,QAAQU,KAAK;IACxB;IAEA,OAAOX,IAAAA,qBAAc,EAACE;AAC1B;AAEO,SAASL,oBAAoBI,OAA4B;IAC5D,MAAMC,QAA8B;QAChCU,OAAOX,QAAQW,KAAK;QACpBC,aAAaZ,QAAQI,IAAI,GAAGJ,QAAQI,IAAI,CAACC,KAAK,CAAC,KAAKC,GAAG,CAACC,CAAAA,IAAKA,EAAEC,IAAI,MAAMC;QACzEC,OAAOV,QAAQU,KAAK;QACpBG,OAAOb,QAAQa,KAAK;IACxB;IAEA,OAAOf,IAAAA,uBAAe,EAACG;AAC3B"}
1
+ {"version":3,"sources":["../src/api.ts"],"sourcesContent":["import { storeKnowledge } from './handlers/store';\nimport { searchKnowledge } from './handlers/search';\nimport { closeDatabase } from './database';\nimport type { StoreKnowledgeInput, SearchKnowledgeInput, StoreKnowledgeResult, SearchKnowledgeResult } from './types';\n\nexport { storeKnowledge, searchKnowledge };\nexport type { StoreKnowledgeInput, SearchKnowledgeInput, StoreKnowledgeResult, SearchKnowledgeResult };\n\n// CLI command handlers for integration with main ai-devkit CLI\nexport interface MemoryStoreOptions {\n title: string;\n content: string;\n tags?: string;\n scope?: string;\n}\n\nexport interface MemorySearchOptions {\n query: string;\n tags?: string;\n scope?: string;\n limit?: number;\n}\n\nexport function memoryStoreCommand(options: MemoryStoreOptions): StoreKnowledgeResult {\n try {\n const input: StoreKnowledgeInput = {\n title: options.title,\n content: options.content,\n tags: options.tags ? options.tags.split(',').map(t => t.trim()) : undefined,\n scope: options.scope,\n };\n\n return storeKnowledge(input);\n } finally {\n closeDatabase();\n }\n}\n\nexport function memorySearchCommand(options: MemorySearchOptions): SearchKnowledgeResult {\n try {\n const input: SearchKnowledgeInput = {\n query: options.query,\n contextTags: options.tags ? options.tags.split(',').map(t => t.trim()) : undefined,\n scope: options.scope,\n limit: options.limit,\n };\n\n return searchKnowledge(input);\n } finally {\n closeDatabase();\n }\n}\n"],"names":["memorySearchCommand","memoryStoreCommand","searchKnowledge","storeKnowledge","options","input","title","content","tags","split","map","t","trim","undefined","scope","closeDatabase","query","contextTags","limit"],"mappings":";;;;;;;;;;;QAsCgBA;eAAAA;;QAfAC;eAAAA;;QAlBSC;eAAAA,uBAAe;;QAA/BC;eAAAA,qBAAc;;;uBALQ;wBACC;0BACF;AAqBvB,SAASF,mBAAmBG,OAA2B;IAC1D,IAAI;QACA,MAAMC,QAA6B;YAC/BC,OAAOF,QAAQE,KAAK;YACpBC,SAASH,QAAQG,OAAO;YACxBC,MAAMJ,QAAQI,IAAI,GAAGJ,QAAQI,IAAI,CAACC,KAAK,CAAC,KAAKC,GAAG,CAACC,CAAAA,IAAKA,EAAEC,IAAI,MAAMC;YAClEC,OAAOV,QAAQU,KAAK;QACxB;QAEA,OAAOX,IAAAA,qBAAc,EAACE;IAC1B,SAAU;QACNU,IAAAA,uBAAa;IACjB;AACJ;AAEO,SAASf,oBAAoBI,OAA4B;IAC5D,IAAI;QACA,MAAMC,QAA8B;YAChCW,OAAOZ,QAAQY,KAAK;YACpBC,aAAab,QAAQI,IAAI,GAAGJ,QAAQI,IAAI,CAACC,KAAK,CAAC,KAAKC,GAAG,CAACC,CAAAA,IAAKA,EAAEC,IAAI,MAAMC;YACzEC,OAAOV,QAAQU,KAAK;YACpBI,OAAOd,QAAQc,KAAK;QACxB;QAEA,OAAOhB,IAAAA,uBAAe,EAACG;IAC3B,SAAU;QACNU,IAAAA,uBAAa;IACjB;AACJ"}
package/dist/index.js CHANGED
@@ -18,9 +18,13 @@ function _export_star(from, to) {
18
18
  });
19
19
  return from;
20
20
  }
21
- (0, _server.runServer)().catch((error)=>{
22
- console.error('Failed to start server:', error);
23
- process.exit(1);
24
- });
21
+ // Only start MCP server when this file is run directly as a binary
22
+ // Not when imported as a library (e.g., by CLI commands)
23
+ if (require.main === module) {
24
+ (0, _server.runServer)().catch((error)=>{
25
+ console.error('Failed to start server:', error);
26
+ process.exit(1);
27
+ });
28
+ }
25
29
 
26
30
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { runServer } from './server';\n\nexport * from './api';\n\nrunServer().catch((error: Error) => {\n console.error('Failed to start server:', error);\n process.exit(1);\n});\n"],"names":["runServer","catch","error","console","process","exit"],"mappings":";;;;;wBAE0B;qBAEZ;;;;;;;;;;;;;;AAEdA,IAAAA,iBAAS,IAAGC,KAAK,CAAC,CAACC;IACfC,QAAQD,KAAK,CAAC,2BAA2BA;IACzCE,QAAQC,IAAI,CAAC;AACjB"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { runServer } from './server';\n\nexport * from './api';\n\n// Only start MCP server when this file is run directly as a binary\n// Not when imported as a library (e.g., by CLI commands)\nif (require.main === module) {\n runServer().catch((error: Error) => {\n console.error('Failed to start server:', error);\n process.exit(1);\n });\n}\n"],"names":["require","main","module","runServer","catch","error","console","process","exit"],"mappings":";;;;;wBAE0B;qBAEZ;;;;;;;;;;;;;;AAEd,mEAAmE;AACnE,yDAAyD;AACzD,IAAIA,QAAQC,IAAI,KAAKC,QAAQ;IACzBC,IAAAA,iBAAS,IAAGC,KAAK,CAAC,CAACC;QACfC,QAAQD,KAAK,CAAC,2BAA2BA;QACzCE,QAAQC,IAAI,CAAC;IACjB;AACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-devkit/memory",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Lightweight MCP-based memory service for AI agents - store and retrieve actionable knowledge",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",