@olane/o-tool-registry 0.4.4 → 0.6.1
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/mcp/methods/mcp-bridge.methods.d.ts.map +1 -1
- package/dist/mcp/methods/mcp-bridge.methods.js +29 -1
- package/dist/src/auth/index.d.ts +4 -0
- package/dist/src/auth/index.d.ts.map +1 -0
- package/dist/src/auth/index.js +3 -0
- package/dist/src/auth/interfaces/index.d.ts +4 -0
- package/dist/src/auth/interfaces/index.d.ts.map +1 -0
- package/dist/src/auth/interfaces/index.js +3 -0
- package/dist/src/auth/interfaces/oAuth-tokens.interface.d.ts +9 -0
- package/dist/src/auth/interfaces/oAuth-tokens.interface.d.ts.map +1 -0
- package/dist/src/auth/interfaces/oAuth-tokens.interface.js +1 -0
- package/dist/src/auth/interfaces/oAuth-user-info.interface.d.ts +8 -0
- package/dist/src/auth/interfaces/oAuth-user-info.interface.d.ts.map +1 -0
- package/dist/src/auth/interfaces/oAuth-user-info.interface.js +1 -0
- package/dist/src/auth/interfaces/oAuth.config.d.ts +14 -0
- package/dist/src/auth/interfaces/oAuth.config.d.ts.map +1 -0
- package/dist/src/auth/interfaces/oAuth.config.js +1 -0
- package/dist/src/auth/methods/auth.methods.d.ts +5 -0
- package/dist/src/auth/methods/auth.methods.d.ts.map +1 -0
- package/dist/src/auth/methods/auth.methods.js +302 -0
- package/dist/src/auth/oAuth.tool.d.ts +20 -0
- package/dist/src/auth/oAuth.tool.d.ts.map +1 -0
- package/dist/src/auth/oAuth.tool.js +419 -0
- package/dist/src/embeddings/embeddings.tool.d.ts +6 -0
- package/dist/src/embeddings/embeddings.tool.d.ts.map +1 -0
- package/dist/src/embeddings/embeddings.tool.js +11 -0
- package/dist/src/embeddings/huggingface-text-embeddings.tool.d.ts +9 -0
- package/dist/src/embeddings/huggingface-text-embeddings.tool.d.ts.map +1 -0
- package/dist/src/embeddings/huggingface-text-embeddings.tool.js +20 -0
- package/dist/src/embeddings/index.d.ts +4 -0
- package/dist/src/embeddings/index.d.ts.map +1 -0
- package/dist/src/embeddings/index.js +3 -0
- package/dist/src/embeddings/methods/text-embeddings.method.d.ts +5 -0
- package/dist/src/embeddings/methods/text-embeddings.method.d.ts.map +1 -0
- package/dist/src/embeddings/methods/text-embeddings.method.js +29 -0
- package/dist/src/embeddings/text-embeddings.tool.d.ts +9 -0
- package/dist/src/embeddings/text-embeddings.tool.d.ts.map +1 -0
- package/dist/src/embeddings/text-embeddings.tool.js +13 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +4 -0
- package/dist/src/init.d.ts +3 -0
- package/dist/src/init.d.ts.map +1 -0
- package/dist/src/init.js +36 -0
- package/dist/src/intelligence/anthropic-intelligence.tool.d.ts +224 -0
- package/dist/src/intelligence/anthropic-intelligence.tool.d.ts.map +1 -0
- package/dist/src/intelligence/anthropic-intelligence.tool.js +477 -0
- package/dist/src/intelligence/gemini-intelligence.tool.d.ts +29 -0
- package/dist/src/intelligence/gemini-intelligence.tool.d.ts.map +1 -0
- package/dist/src/intelligence/gemini-intelligence.tool.js +267 -0
- package/dist/src/intelligence/index.d.ts +6 -0
- package/dist/src/intelligence/index.d.ts.map +1 -0
- package/dist/src/intelligence/index.js +5 -0
- package/dist/src/intelligence/intelligence.tool.d.ts +11 -0
- package/dist/src/intelligence/intelligence.tool.d.ts.map +1 -0
- package/dist/src/intelligence/intelligence.tool.js +134 -0
- package/dist/src/intelligence/methods/intelligence.methods.d.ts +5 -0
- package/dist/src/intelligence/methods/intelligence.methods.d.ts.map +1 -0
- package/dist/src/intelligence/methods/intelligence.methods.js +132 -0
- package/dist/src/intelligence/ollama-intelligence.tool.d.ts +36 -0
- package/dist/src/intelligence/ollama-intelligence.tool.d.ts.map +1 -0
- package/dist/src/intelligence/ollama-intelligence.tool.js +312 -0
- package/dist/src/intelligence/openai-intelligence.tool.d.ts +30 -0
- package/dist/src/intelligence/openai-intelligence.tool.d.ts.map +1 -0
- package/dist/src/intelligence/openai-intelligence.tool.js +255 -0
- package/dist/src/intelligence/perplexity-intelligence.tool.d.ts +28 -0
- package/dist/src/intelligence/perplexity-intelligence.tool.d.ts.map +1 -0
- package/dist/src/intelligence/perplexity-intelligence.tool.js +310 -0
- package/dist/src/mcp/index.d.ts +3 -0
- package/dist/src/mcp/index.d.ts.map +1 -0
- package/dist/src/mcp/index.js +2 -0
- package/dist/src/mcp/mcp-bridge.tool.d.ts +12 -0
- package/dist/src/mcp/mcp-bridge.tool.d.ts.map +1 -0
- package/dist/src/mcp/mcp-bridge.tool.js +107 -0
- package/dist/src/mcp/mcp.tool.d.ts +15 -0
- package/dist/src/mcp/mcp.tool.d.ts.map +1 -0
- package/dist/src/mcp/mcp.tool.js +85 -0
- package/dist/src/mcp/methods/mcp-bridge.methods.d.ts +5 -0
- package/dist/src/mcp/methods/mcp-bridge.methods.d.ts.map +1 -0
- package/dist/src/mcp/methods/mcp-bridge.methods.js +58 -0
- package/dist/src/nlp/index.d.ts +2 -0
- package/dist/src/nlp/index.d.ts.map +1 -0
- package/dist/src/nlp/index.js +1 -0
- package/dist/src/nlp/methods/nlp.methods.d.ts +5 -0
- package/dist/src/nlp/methods/nlp.methods.d.ts.map +1 -0
- package/dist/src/nlp/methods/nlp.methods.js +15 -0
- package/dist/src/nlp/ner.tool.d.ts +7 -0
- package/dist/src/nlp/ner.tool.d.ts.map +1 -0
- package/dist/src/nlp/ner.tool.js +25 -0
- package/dist/src/vector-store/index.d.ts +3 -0
- package/dist/src/vector-store/index.d.ts.map +1 -0
- package/dist/src/vector-store/index.js +2 -0
- package/dist/src/vector-store/langchain-memory.vector-store.tool.d.ts +14 -0
- package/dist/src/vector-store/langchain-memory.vector-store.tool.d.ts.map +1 -0
- package/dist/src/vector-store/langchain-memory.vector-store.tool.js +58 -0
- package/dist/src/vector-store/methods/vector-store.methods.d.ts +5 -0
- package/dist/src/vector-store/methods/vector-store.methods.d.ts.map +1 -0
- package/dist/src/vector-store/methods/vector-store.methods.js +60 -0
- package/dist/src/vector-store/vector-memory.tool.d.ts +11 -0
- package/dist/src/vector-store/vector-memory.tool.d.ts.map +1 -0
- package/dist/src/vector-store/vector-memory.tool.js +13 -0
- package/dist/test/methods.spec.d.ts +2 -0
- package/dist/test/methods.spec.d.ts.map +1 -0
- package/dist/test/methods.spec.js +54 -0
- package/dist/vector-store/langchain-memory.vector-store.tool.d.ts.map +1 -1
- package/dist/vector-store/langchain-memory.vector-store.tool.js +2 -0
- package/package.json +24 -13
- package/dist/apple/apple.tool.d.ts +0 -5
- package/dist/apple/apple.tool.d.ts.map +0 -1
- package/dist/apple/apple.tool.js +0 -11
- package/dist/apple/index.d.ts +0 -1
- package/dist/apple/index.d.ts.map +0 -1
- package/dist/apple/index.js +0 -1
- package/dist/apple/notes.tool.d.ts +0 -14
- package/dist/apple/notes.tool.d.ts.map +0 -1
- package/dist/apple/notes.tool.js +0 -215
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { oVirtualTool } from '@olane/o-tool';
|
|
2
|
+
import { oAddress } from '@olane/o-core';
|
|
3
|
+
import { NLP_PARAMS } from './methods/nlp.methods.js';
|
|
4
|
+
export class NERTool extends oVirtualTool {
|
|
5
|
+
constructor(config) {
|
|
6
|
+
super({
|
|
7
|
+
...config,
|
|
8
|
+
address: new oAddress('o://ner'),
|
|
9
|
+
methods: NLP_PARAMS,
|
|
10
|
+
description: 'Tool to extract named entities from text',
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
async _tool_extract(request) {
|
|
14
|
+
const params = request.params;
|
|
15
|
+
const { text } = params;
|
|
16
|
+
this.logger.debug('Extracting entities from text', text);
|
|
17
|
+
const response = await this.use(new oAddress('o://intelligence'), {
|
|
18
|
+
method: 'prompt',
|
|
19
|
+
params: {
|
|
20
|
+
prompt: `Extract named entities and their metadata from the following text: ${text}`,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
return response.result;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vector-store/index.ts"],"names":[],"mappings":"AAAA,cAAc,yCAAyC,CAAC;AACxD,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { oRequest } from '@olane/o-core';
|
|
2
|
+
import { oToolConfig } from '@olane/o-tool';
|
|
3
|
+
import { VectorMemoryStorageTool } from './vector-memory.tool.js';
|
|
4
|
+
export declare class LangchainMemoryVectorStoreTool extends VectorMemoryStorageTool {
|
|
5
|
+
private vectorStore;
|
|
6
|
+
constructor(config: oToolConfig);
|
|
7
|
+
private embeddingsTool;
|
|
8
|
+
initialize(): Promise<void>;
|
|
9
|
+
_tool_add_documents(request: oRequest): Promise<any>;
|
|
10
|
+
_tool_delete_documents(request: oRequest): Promise<any>;
|
|
11
|
+
_tool_update_documents(request: oRequest): Promise<any>;
|
|
12
|
+
_tool_search_similar(request: oRequest): Promise<any>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=langchain-memory.vector-store.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"langchain-memory.vector-store.tool.d.ts","sourceRoot":"","sources":["../../../src/vector-store/langchain-memory.vector-store.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,QAAQ,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAKlE,qBAAa,8BAA+B,SAAQ,uBAAuB;IACzE,OAAO,CAAC,WAAW,CAAqB;gBAE5B,MAAM,EAAE,WAAW;IAO/B,OAAO,CAAC,cAAc;IAuBhB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAK3B,mBAAmB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;IAOpD,sBAAsB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;IAIvD,sBAAsB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;IAIvD,oBAAoB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;CAO5D"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { MemoryVectorStore } from 'langchain/vectorstores/memory';
|
|
2
|
+
import { oAddress } from '@olane/o-core';
|
|
3
|
+
import { VectorMemoryStorageTool } from './vector-memory.tool.js';
|
|
4
|
+
import { Document } from '@langchain/core/documents';
|
|
5
|
+
import { VECTOR_STORE_PARAMS } from './methods/vector-store.methods.js';
|
|
6
|
+
export class LangchainMemoryVectorStoreTool extends VectorMemoryStorageTool {
|
|
7
|
+
constructor(config) {
|
|
8
|
+
super({
|
|
9
|
+
...config,
|
|
10
|
+
methods: VECTOR_STORE_PARAMS,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
embeddingsTool() {
|
|
14
|
+
return {
|
|
15
|
+
embedDocuments: async (documents) => {
|
|
16
|
+
const response = await this.use(new oAddress('o://embeddings-text'), {
|
|
17
|
+
method: 'embed_documents',
|
|
18
|
+
params: {
|
|
19
|
+
documents,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
return response.result.data;
|
|
23
|
+
},
|
|
24
|
+
embedQuery: async (document) => {
|
|
25
|
+
const response = await this.use(new oAddress('o://embeddings-text'), {
|
|
26
|
+
method: 'embed_query',
|
|
27
|
+
params: {
|
|
28
|
+
query: document,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
return response.result.data;
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
async initialize() {
|
|
36
|
+
await super.initialize();
|
|
37
|
+
this.vectorStore = new MemoryVectorStore(this.embeddingsTool());
|
|
38
|
+
}
|
|
39
|
+
async _tool_add_documents(request) {
|
|
40
|
+
const { documents } = request.params;
|
|
41
|
+
const docs = documents.map((doc) => new Document(doc));
|
|
42
|
+
const result = await this.vectorStore.addDocuments(docs);
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
async _tool_delete_documents(request) {
|
|
46
|
+
throw new Error('Not implemented');
|
|
47
|
+
}
|
|
48
|
+
async _tool_update_documents(request) {
|
|
49
|
+
throw new Error('Not implemented');
|
|
50
|
+
}
|
|
51
|
+
async _tool_search_similar(request) {
|
|
52
|
+
const params = request.params;
|
|
53
|
+
const query = params.query;
|
|
54
|
+
const limit = params.limit;
|
|
55
|
+
const results = await this.vectorStore.similaritySearch(query, limit);
|
|
56
|
+
return results;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector-store.methods.d.ts","sourceRoot":"","sources":["../../../../src/vector-store/methods/vector-store.methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,eAAO,MAAM,mBAAmB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CA2DzD,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export const VECTOR_STORE_PARAMS = {
|
|
2
|
+
add_documents: {
|
|
3
|
+
name: 'add_documents',
|
|
4
|
+
description: 'Add documents to the store',
|
|
5
|
+
dependencies: [],
|
|
6
|
+
parameters: [
|
|
7
|
+
{
|
|
8
|
+
name: 'documents',
|
|
9
|
+
type: 'array',
|
|
10
|
+
value: '{pageContent: string, metadata: object}',
|
|
11
|
+
description: 'The documents to add',
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
delete_documents: {
|
|
16
|
+
name: 'delete_documents',
|
|
17
|
+
description: 'Delete documents from the store',
|
|
18
|
+
dependencies: [],
|
|
19
|
+
parameters: [
|
|
20
|
+
{
|
|
21
|
+
name: 'documents',
|
|
22
|
+
type: 'array',
|
|
23
|
+
value: 'object[]',
|
|
24
|
+
description: 'The documents to update',
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
search_similar: {
|
|
29
|
+
name: 'search_similar',
|
|
30
|
+
description: 'Search for similar documents in the store',
|
|
31
|
+
dependencies: [],
|
|
32
|
+
parameters: [
|
|
33
|
+
{
|
|
34
|
+
name: 'query',
|
|
35
|
+
type: 'string',
|
|
36
|
+
value: 'string',
|
|
37
|
+
description: 'The query to search for',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'limit',
|
|
41
|
+
type: 'number',
|
|
42
|
+
value: 'number',
|
|
43
|
+
description: 'The limit of documents to return',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
update_documents: {
|
|
48
|
+
name: 'update_documents',
|
|
49
|
+
description: 'Update documents in the store',
|
|
50
|
+
dependencies: [],
|
|
51
|
+
parameters: [
|
|
52
|
+
{
|
|
53
|
+
name: 'documents',
|
|
54
|
+
type: 'array',
|
|
55
|
+
value: 'object[]',
|
|
56
|
+
description: 'The documents to update',
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { oVirtualTool, ToolResult } from '@olane/o-tool';
|
|
2
|
+
import { oRequest } from '@olane/o-core';
|
|
3
|
+
import { oToolConfig } from '@olane/o-tool';
|
|
4
|
+
export declare abstract class VectorMemoryStorageTool extends oVirtualTool {
|
|
5
|
+
constructor(config: oToolConfig);
|
|
6
|
+
abstract _tool_search_similar(request: oRequest): Promise<ToolResult>;
|
|
7
|
+
abstract _tool_add_documents(request: oRequest): Promise<ToolResult>;
|
|
8
|
+
abstract _tool_delete_documents(request: oRequest): Promise<ToolResult>;
|
|
9
|
+
abstract _tool_update_documents(request: oRequest): Promise<ToolResult>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=vector-memory.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector-memory.tool.d.ts","sourceRoot":"","sources":["../../../src/vector-store/vector-memory.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAY,QAAQ,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,8BAAsB,uBAAwB,SAAQ,YAAY;gBACpD,MAAM,EAAE,WAAW;IAS/B,QAAQ,CAAC,oBAAoB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IACrE,QAAQ,CAAC,mBAAmB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IACpE,QAAQ,CAAC,sBAAsB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IACvE,QAAQ,CAAC,sBAAsB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;CACxE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { oVirtualTool } from '@olane/o-tool';
|
|
2
|
+
import { oAddress } from '@olane/o-core';
|
|
3
|
+
import { VECTOR_STORE_PARAMS } from './methods/vector-store.methods.js';
|
|
4
|
+
export class VectorMemoryStorageTool extends oVirtualTool {
|
|
5
|
+
constructor(config) {
|
|
6
|
+
super({
|
|
7
|
+
...config,
|
|
8
|
+
address: new oAddress('o://vector-store'),
|
|
9
|
+
methods: VECTOR_STORE_PARAMS,
|
|
10
|
+
description: 'Vector store tool for storing and searching documents',
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods.spec.d.ts","sourceRoot":"","sources":["../../test/methods.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import { OAuthTool } from '../src/auth/oAuth.tool.js';
|
|
3
|
+
import { EmbeddingsTool } from '../src/embeddings/embeddings.tool.js';
|
|
4
|
+
import { NERTool } from '../src/nlp/ner.tool.js';
|
|
5
|
+
import { LangchainMemoryVectorStoreTool } from '../src/vector-store/index.js';
|
|
6
|
+
import { IntelligenceTool } from '@olane/o-intelligence';
|
|
7
|
+
function checkMethods(tool, methods) {
|
|
8
|
+
const tools = tool.myTools();
|
|
9
|
+
for (const tool of tools) {
|
|
10
|
+
expect(methods[tool]).to.not.be.undefined;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
describe('registry tool metadata tests', () => {
|
|
14
|
+
it('should verify auth method metadata is present', async () => {
|
|
15
|
+
const authTool = new OAuthTool({
|
|
16
|
+
description: 'Auth tool',
|
|
17
|
+
leader: null,
|
|
18
|
+
parent: null,
|
|
19
|
+
});
|
|
20
|
+
checkMethods(authTool, authTool.methods);
|
|
21
|
+
});
|
|
22
|
+
it('should verify embeddings method metadata is present', async () => {
|
|
23
|
+
const embeddingsTool = new EmbeddingsTool({
|
|
24
|
+
description: 'Embeddings tool',
|
|
25
|
+
leader: null,
|
|
26
|
+
parent: null,
|
|
27
|
+
});
|
|
28
|
+
checkMethods(embeddingsTool, embeddingsTool.methods);
|
|
29
|
+
});
|
|
30
|
+
it('should verify intelligence method metadata is present', async () => {
|
|
31
|
+
const intelligenceTool = new IntelligenceTool({
|
|
32
|
+
description: 'Intelligence tool',
|
|
33
|
+
leader: null,
|
|
34
|
+
parent: null,
|
|
35
|
+
});
|
|
36
|
+
checkMethods(intelligenceTool, intelligenceTool.methods);
|
|
37
|
+
});
|
|
38
|
+
it('should verify nlp method metadata is present', async () => {
|
|
39
|
+
const nlpTool = new NERTool({
|
|
40
|
+
description: 'NLP tool',
|
|
41
|
+
leader: null,
|
|
42
|
+
parent: null,
|
|
43
|
+
});
|
|
44
|
+
checkMethods(nlpTool, nlpTool.methods);
|
|
45
|
+
});
|
|
46
|
+
it('should verify vector-store method metadata is present', async () => {
|
|
47
|
+
const vectorStoreTool = new LangchainMemoryVectorStoreTool({
|
|
48
|
+
description: 'Vector store tool',
|
|
49
|
+
leader: null,
|
|
50
|
+
parent: null,
|
|
51
|
+
});
|
|
52
|
+
checkMethods(vectorStoreTool, vectorStoreTool.methods);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"langchain-memory.vector-store.tool.d.ts","sourceRoot":"","sources":["../../src/vector-store/langchain-memory.vector-store.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,QAAQ,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"langchain-memory.vector-store.tool.d.ts","sourceRoot":"","sources":["../../src/vector-store/langchain-memory.vector-store.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,QAAQ,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAKlE,qBAAa,8BAA+B,SAAQ,uBAAuB;IACzE,OAAO,CAAC,WAAW,CAAqB;gBAE5B,MAAM,EAAE,WAAW;IAO/B,OAAO,CAAC,cAAc;IAwBhB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAK3B,mBAAmB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;IAOpD,sBAAsB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;IAIvD,sBAAsB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;IAIvD,oBAAoB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;CAQ5D"}
|
|
@@ -2,10 +2,12 @@ import { MemoryVectorStore } from 'langchain/vectorstores/memory';
|
|
|
2
2
|
import { oAddress } from '@olane/o-core';
|
|
3
3
|
import { VectorMemoryStorageTool } from './vector-memory.tool.js';
|
|
4
4
|
import { Document } from '@langchain/core/documents';
|
|
5
|
+
import { VECTOR_STORE_PARAMS } from './methods/vector-store.methods.js';
|
|
5
6
|
export class LangchainMemoryVectorStoreTool extends VectorMemoryStorageTool {
|
|
6
7
|
constructor(config) {
|
|
7
8
|
super({
|
|
8
9
|
...config,
|
|
10
|
+
methods: VECTOR_STORE_PARAMS,
|
|
9
11
|
});
|
|
10
12
|
}
|
|
11
13
|
embeddingsTool() {
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olane/o-tool-registry",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
5
|
+
"main": "dist/src/index.js",
|
|
6
|
+
"types": "dist/src/index.d.ts",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
|
-
"types": "./dist/index.d.ts",
|
|
10
|
-
"default": "./dist/index.js"
|
|
9
|
+
"types": "./dist/src/index.d.ts",
|
|
10
|
+
"default": "./dist/src/index.js"
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
@@ -16,13 +16,16 @@
|
|
|
16
16
|
"LICENSE"
|
|
17
17
|
],
|
|
18
18
|
"scripts": {
|
|
19
|
-
"test": "
|
|
19
|
+
"test": "aegir test",
|
|
20
|
+
"test:node": "aegir test -t node",
|
|
21
|
+
"test:browser": "aegir test -t browser",
|
|
22
|
+
"deep:clean": "rm -rf node_modules && rm package-lock.json",
|
|
20
23
|
"dev": "npm run build --prefix ../o-core && npm run build --prefix ../o-tool && npm run build --prefix ../o-tools-common && DEBUG=o-protocol:* npx tsx src/index.ts",
|
|
21
24
|
"build": "tsc",
|
|
22
25
|
"start:prod": "node dist/index.js",
|
|
23
26
|
"prepublishOnly": "npm run build",
|
|
24
27
|
"update:lib": "npm install @olane/o-core@latest",
|
|
25
|
-
"lint": "
|
|
28
|
+
"lint": "aegir lint"
|
|
26
29
|
},
|
|
27
30
|
"repository": {
|
|
28
31
|
"type": "git",
|
|
@@ -32,6 +35,13 @@
|
|
|
32
35
|
"license": "ISC",
|
|
33
36
|
"description": "oLane Core",
|
|
34
37
|
"devDependencies": {
|
|
38
|
+
"@olane/o-config": "file:../o-config",
|
|
39
|
+
"@olane/o-core": "file:../..",
|
|
40
|
+
"@olane/o-protocol": "file:../o-protocol",
|
|
41
|
+
"@olane/o-tool": "file:../o-tool",
|
|
42
|
+
"@olane/o-tools-common": "file:../o-tools-common",
|
|
43
|
+
"@olane/o-mcp": "file:../o-mcp",
|
|
44
|
+
"@olane/o-intelligence": "file:../o-intelligence",
|
|
35
45
|
"@eslint/eslintrc": "^3.3.1",
|
|
36
46
|
"@eslint/js": "^9.29.0",
|
|
37
47
|
"@tsconfig/node20": "^20.1.6",
|
|
@@ -51,17 +61,18 @@
|
|
|
51
61
|
"typescript": "5.4.5"
|
|
52
62
|
},
|
|
53
63
|
"peerDependencies": {
|
|
54
|
-
"@olane/o-config": "^0.
|
|
55
|
-
"@olane/o-core": "^0.
|
|
56
|
-
"@olane/o-protocol": "^0.
|
|
57
|
-
"@olane/o-tool": "^0.
|
|
58
|
-
"@olane/o-tools-common": "^0.
|
|
64
|
+
"@olane/o-config": "^0.6.1",
|
|
65
|
+
"@olane/o-core": "^0.6.1",
|
|
66
|
+
"@olane/o-protocol": "^0.6.1",
|
|
67
|
+
"@olane/o-tool": "^0.6.1",
|
|
68
|
+
"@olane/o-tools-common": "^0.6.1",
|
|
69
|
+
"@olane/o-mcp": "^0.6.1",
|
|
70
|
+
"@olane/o-intelligence": "^0.6.1"
|
|
59
71
|
},
|
|
60
72
|
"dependencies": {
|
|
61
73
|
"@huggingface/transformers": "^3.5.2",
|
|
62
74
|
"@langchain/community": "^0.3.47",
|
|
63
75
|
"@langchain/core": "^0.3.61",
|
|
64
|
-
"@modelcontextprotocol/sdk": "^1.13.0",
|
|
65
76
|
"debug": "^4.4.1",
|
|
66
77
|
"dotenv": "^16.5.0",
|
|
67
78
|
"langchain": "^0.3.29"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apple.tool.d.ts","sourceRoot":"","sources":["../../src/apple/apple.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGjE,qBAAa,SAAU,SAAQ,YAAY;gBAC7B,MAAM,EAAE,WAAW;CAOhC"}
|
package/dist/apple/apple.tool.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { oVirtualTool } from '@olane/o-tool';
|
|
2
|
-
import { oAddress } from '@olane/o-core';
|
|
3
|
-
export class AppleTool extends oVirtualTool {
|
|
4
|
-
constructor(config) {
|
|
5
|
-
super({
|
|
6
|
-
...config,
|
|
7
|
-
address: new oAddress('o://apple'),
|
|
8
|
-
description: config.description || 'Base class tool for Apple tools',
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
}
|
package/dist/apple/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/apple/index.ts"],"names":[],"mappings":""}
|
package/dist/apple/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { oToolConfig, oVirtualTool } from '@olane/o-tool';
|
|
2
|
-
import { oRequest } from '@olane/o-core';
|
|
3
|
-
export declare class NotesTool extends oVirtualTool {
|
|
4
|
-
private jxaScriptPath;
|
|
5
|
-
constructor(config: oToolConfig);
|
|
6
|
-
private executeJxaScript;
|
|
7
|
-
_tool_get_notes(request: oRequest): Promise<any>;
|
|
8
|
-
_tool_create_note(request: oRequest): Promise<any>;
|
|
9
|
-
_tool_update_note(request: oRequest): Promise<any>;
|
|
10
|
-
_tool_delete_note(request: oRequest): Promise<any>;
|
|
11
|
-
_tool_get_folders(request: oRequest): Promise<any>;
|
|
12
|
-
_tool_create_folder(request: oRequest): Promise<any>;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=notes.tool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notes.tool.d.ts","sourceRoot":"","sources":["../../src/apple/notes.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAY,QAAQ,EAAgB,MAAM,eAAe,CAAC;AAOjE,qBAAa,SAAU,SAAQ,YAAY;IACzC,OAAO,CAAC,aAAa,CAAS;gBAElB,MAAM,EAAE,WAAW;YAWjB,gBAAgB;IA0BxB,eAAe,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;IA0BhD,iBAAiB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;IA6ClD,iBAAiB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;IA4ClD,iBAAiB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;IAmClD,iBAAiB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;IA0BlD,mBAAmB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;CAmC3D"}
|
package/dist/apple/notes.tool.js
DELETED
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import { oVirtualTool } from '@olane/o-tool';
|
|
2
|
-
import { oAddress } from '@olane/o-core';
|
|
3
|
-
import { exec } from 'child_process';
|
|
4
|
-
import { promisify } from 'util';
|
|
5
|
-
import * as path from 'path';
|
|
6
|
-
const execAsync = promisify(exec);
|
|
7
|
-
export class NotesTool extends oVirtualTool {
|
|
8
|
-
constructor(config) {
|
|
9
|
-
super({
|
|
10
|
-
...config,
|
|
11
|
-
address: new oAddress('o://notes'),
|
|
12
|
-
description: 'Tool to interact with Apple Notes',
|
|
13
|
-
});
|
|
14
|
-
// Set the path to the JXA script
|
|
15
|
-
this.jxaScriptPath = path.join(__dirname, 'notes.jxa');
|
|
16
|
-
}
|
|
17
|
-
async executeJxaScript(command, args = []) {
|
|
18
|
-
try {
|
|
19
|
-
const commandArgs = [command, ...args]
|
|
20
|
-
.map((arg) => `"${arg.replace(/"/g, '\\"')}"`)
|
|
21
|
-
.join(' ');
|
|
22
|
-
const fullCommand = `${this.jxaScriptPath} ${commandArgs}`;
|
|
23
|
-
this.logger.debug(`Executing JXA command: ${fullCommand}`);
|
|
24
|
-
const { stdout, stderr } = await execAsync(fullCommand);
|
|
25
|
-
if (stderr) {
|
|
26
|
-
this.logger.warn(`JXA stderr: ${stderr}`);
|
|
27
|
-
}
|
|
28
|
-
const result = JSON.parse(stdout.trim());
|
|
29
|
-
return result;
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
this.logger.error(`Failed to execute JXA script: ${error}`);
|
|
33
|
-
throw new Error(`JXA execution failed: ${error.message}`);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
async _tool_get_notes(request) {
|
|
37
|
-
try {
|
|
38
|
-
this.logger.debug('Getting all notes from Apple Notes');
|
|
39
|
-
const result = await this.executeJxaScript('get_notes');
|
|
40
|
-
if (!result.success) {
|
|
41
|
-
return {
|
|
42
|
-
success: false,
|
|
43
|
-
error: result.error,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
return {
|
|
47
|
-
success: true,
|
|
48
|
-
data: result.data,
|
|
49
|
-
message: `Retrieved ${result.data.length} notes successfully`,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
this.logger.error(`Error getting notes: ${error}`);
|
|
54
|
-
return {
|
|
55
|
-
success: false,
|
|
56
|
-
error: error.message,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
async _tool_create_note(request) {
|
|
61
|
-
try {
|
|
62
|
-
const { title, body, folder } = request.params;
|
|
63
|
-
if (!title || !body) {
|
|
64
|
-
return {
|
|
65
|
-
success: false,
|
|
66
|
-
error: 'Title and body are required for creating a note',
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
this.logger.debug(`Creating note with title: ${title}`);
|
|
70
|
-
const args = [title, body];
|
|
71
|
-
if (folder) {
|
|
72
|
-
args.push(folder);
|
|
73
|
-
}
|
|
74
|
-
const result = await this.executeJxaScript('create_note', args);
|
|
75
|
-
if (!result.success) {
|
|
76
|
-
return {
|
|
77
|
-
success: false,
|
|
78
|
-
error: result.error,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
return {
|
|
82
|
-
success: true,
|
|
83
|
-
data: result.data,
|
|
84
|
-
message: 'Note created successfully',
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
catch (error) {
|
|
88
|
-
this.logger.error(`Error creating note: ${error}`);
|
|
89
|
-
return {
|
|
90
|
-
success: false,
|
|
91
|
-
error: error.message,
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
async _tool_update_note(request) {
|
|
96
|
-
try {
|
|
97
|
-
const { id, title, body } = request.params;
|
|
98
|
-
if (!id || !title || !body) {
|
|
99
|
-
return {
|
|
100
|
-
success: false,
|
|
101
|
-
error: 'ID, title, and body are required for updating a note',
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
this.logger.debug(`Updating note with ID: ${id}`);
|
|
105
|
-
const result = await this.executeJxaScript('update_note', [
|
|
106
|
-
id,
|
|
107
|
-
title,
|
|
108
|
-
body,
|
|
109
|
-
]);
|
|
110
|
-
if (!result.success) {
|
|
111
|
-
return {
|
|
112
|
-
success: false,
|
|
113
|
-
error: result.error,
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
return {
|
|
117
|
-
success: true,
|
|
118
|
-
data: result.data,
|
|
119
|
-
message: 'Note updated successfully',
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
catch (error) {
|
|
123
|
-
this.logger.error(`Error updating note: ${error}`);
|
|
124
|
-
return {
|
|
125
|
-
success: false,
|
|
126
|
-
error: error.message,
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
async _tool_delete_note(request) {
|
|
131
|
-
try {
|
|
132
|
-
const { id } = request.params;
|
|
133
|
-
if (!id) {
|
|
134
|
-
return {
|
|
135
|
-
success: false,
|
|
136
|
-
error: 'ID is required for deleting a note',
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
this.logger.debug(`Deleting note with ID: ${id}`);
|
|
140
|
-
const result = await this.executeJxaScript('delete_note', [id]);
|
|
141
|
-
if (!result.success) {
|
|
142
|
-
return {
|
|
143
|
-
success: false,
|
|
144
|
-
error: result.error,
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
return {
|
|
148
|
-
success: true,
|
|
149
|
-
message: result.message || 'Note deleted successfully',
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
catch (error) {
|
|
153
|
-
this.logger.error(`Error deleting note: ${error}`);
|
|
154
|
-
return {
|
|
155
|
-
success: false,
|
|
156
|
-
error: error.message,
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
async _tool_get_folders(request) {
|
|
161
|
-
try {
|
|
162
|
-
this.logger.debug('Getting all folders from Apple Notes');
|
|
163
|
-
const result = await this.executeJxaScript('get_folders');
|
|
164
|
-
if (!result.success) {
|
|
165
|
-
return {
|
|
166
|
-
success: false,
|
|
167
|
-
error: result.error,
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
return {
|
|
171
|
-
success: true,
|
|
172
|
-
data: result.data,
|
|
173
|
-
message: `Retrieved ${result.data.length} folders successfully`,
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
catch (error) {
|
|
177
|
-
this.logger.error(`Error getting folders: ${error}`);
|
|
178
|
-
return {
|
|
179
|
-
success: false,
|
|
180
|
-
error: error.message,
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
async _tool_create_folder(request) {
|
|
185
|
-
try {
|
|
186
|
-
const { name } = request.params;
|
|
187
|
-
if (!name) {
|
|
188
|
-
return {
|
|
189
|
-
success: false,
|
|
190
|
-
error: 'Name is required for creating a folder',
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
this.logger.debug(`Creating folder with name: ${name}`);
|
|
194
|
-
const result = await this.executeJxaScript('create_folder', [name]);
|
|
195
|
-
if (!result.success) {
|
|
196
|
-
return {
|
|
197
|
-
success: false,
|
|
198
|
-
error: result.error,
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
return {
|
|
202
|
-
success: true,
|
|
203
|
-
data: result.data,
|
|
204
|
-
message: 'Folder created successfully',
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
catch (error) {
|
|
208
|
-
this.logger.error(`Error creating folder: ${error}`);
|
|
209
|
-
return {
|
|
210
|
-
success: false,
|
|
211
|
-
error: error.message,
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|