@olane/o-tool-registry 0.7.2 → 0.7.4

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 CHANGED
@@ -0,0 +1,976 @@
1
+ # @olane/o-tool-registry
2
+
3
+ > ⚠️ **Deprecation Notice**: This package is being phased out. Tools should now be referenced and installed independently.
4
+
5
+ A collection of pre-built tools for Olane OS including OAuth authentication, text embeddings, NER (Named Entity Recognition), and vector storage.
6
+
7
+ [![npm version](https://img.shields.io/npm/v/@olane/o-tool-registry.svg)](https://www.npmjs.com/package/@olane/o-tool-registry)
8
+ [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)
9
+
10
+ ## Overview {#overview}
11
+
12
+ This package was originally designed as a convenient registry for commonly-used tools in Olane OS. However, we're transitioning to a model where **each tool can be referenced and installed independently** for better modularity and maintenance.
13
+
14
+ **Current Status**:
15
+ - ✅ **Still functional** - All tools work as documented
16
+ - 🔄 **Being replaced** - Individual tool packages coming soon
17
+ - 📦 **Legacy support** - Will be maintained until migration is complete
18
+
19
+ ## Migration Path {#migration}
20
+
21
+ If you're using `o-tool-registry`, you should plan to migrate to individual tool packages:
22
+
23
+ | Current Import | Future Package (Coming Soon) |
24
+ |---------------|------------------------------|
25
+ | `OAuthTool` | `@olane/o-tool-oauth` |
26
+ | `TextEmbeddingsTool` | `@olane/o-tool-embeddings` |
27
+ | `HuggingfaceTextEmbeddingsTool` | `@olane/o-tool-embeddings-hf` |
28
+ | `NERTool` | `@olane/o-tool-ner` |
29
+ | `VectorMemoryStorageTool` | `@olane/o-tool-vector-store` |
30
+ | `LangchainMemoryVectorStoreTool` | `@olane/o-tool-vector-store-langchain` |
31
+
32
+ > **Timeline**: Individual packages will be released in version 0.8.0. This package will be deprecated in version 1.0.0.
33
+
34
+ ## Installation {#installation}
35
+
36
+ ```bash
37
+ npm install @olane/o-tool-registry
38
+ ```
39
+
40
+ **Peer Dependencies** (automatically installed):
41
+ ```bash
42
+ npm install @olane/o-core @olane/o-tool @olane/o-lane @olane/o-intelligence @olane/o-mcp
43
+ ```
44
+
45
+ ## Quick Start {#quick-start}
46
+
47
+ ### Using the Full Registry
48
+
49
+ Initialize all tools as child nodes of a parent node:
50
+
51
+ ```typescript
52
+ import { oLaneTool } from '@olane/o-lane';
53
+ import { initRegistryTools } from '@olane/o-tool-registry';
54
+ import { oAddress } from '@olane/o-core';
55
+
56
+ // Create a parent node
57
+ const parentNode = new oLaneTool({
58
+ name: 'my-application',
59
+ address: new oAddress('o://my-app')
60
+ });
61
+
62
+ await parentNode.start();
63
+
64
+ // Initialize all registry tools as children
65
+ await initRegistryTools(parentNode);
66
+
67
+ // Now tools are available at:
68
+ // - o://my-app/ner
69
+ // - o://my-app/intelligence
70
+ // - o://my-app/embeddings-text
71
+ // - o://my-app/vector-store
72
+ // - o://my-app/mcp
73
+ ```
74
+
75
+ ### Using Individual Tools
76
+
77
+ Import and use specific tools independently:
78
+
79
+ ```typescript
80
+ import { OAuthTool } from '@olane/o-tool-registry';
81
+ import { oAddress } from '@olane/o-core';
82
+
83
+ const oauthTool = new OAuthTool({
84
+ name: 'oauth',
85
+ address: new oAddress('o://auth/oauth')
86
+ });
87
+
88
+ await oauthTool.start();
89
+ ```
90
+
91
+ ## Available Tools {#tools}
92
+
93
+ ### 1. OAuth Authentication Tool {#oauth-tool}
94
+
95
+ Generic OAuth 2.0 client for custom provider services with PKCE support.
96
+
97
+ **Address**: `o://oauth`
98
+
99
+ #### Features
100
+
101
+ - 🔐 **OAuth 2.0 Flow** - Full authorization code flow with PKCE
102
+ - 🔄 **Token Refresh** - Automatic token refresh handling
103
+ - 🔍 **Multi-Provider** - Support for multiple OAuth services
104
+ - 💾 **Token Storage** - Built-in token management
105
+
106
+ #### Quick Example
107
+
108
+ ```typescript
109
+ import { OAuthTool } from '@olane/o-tool-registry';
110
+
111
+ const oauth = new OAuthTool({
112
+ name: 'oauth',
113
+ parent: myNode.address
114
+ });
115
+ await oauth.start();
116
+
117
+ // Configure OAuth provider
118
+ await oauth.use({
119
+ method: 'configure',
120
+ params: {
121
+ serviceName: 'github',
122
+ clientId: 'your_client_id',
123
+ clientSecret: 'your_client_secret',
124
+ redirectUri: 'http://localhost:3000/callback',
125
+ authorizationUrl: 'https://github.com/login/oauth/authorize',
126
+ tokenUrl: 'https://github.com/login/oauth/access_token',
127
+ userInfoUrl: 'https://api.github.com/user',
128
+ scope: 'read:user user:email'
129
+ }
130
+ });
131
+
132
+ // Get authorization URL
133
+ const authUrl = await oauth.use({
134
+ method: 'getAuthorizationUrl',
135
+ params: {
136
+ serviceName: 'github',
137
+ state: 'random_state_string'
138
+ }
139
+ });
140
+
141
+ console.log(authUrl.authorizationUrl);
142
+ // https://github.com/login/oauth/authorize?client_id=...
143
+ ```
144
+
145
+ #### Available Methods
146
+
147
+ | Method | Description | Parameters |
148
+ |--------|-------------|------------|
149
+ | **configure** | Configure OAuth provider | `serviceName`, `clientId`, `clientSecret`, `redirectUri`, `authorizationUrl`, `tokenUrl`, `userInfoUrl`, `scope` |
150
+ | **getAuthorizationUrl** | Generate authorization URL | `serviceName`, `state?`, `scope?` |
151
+ | **exchangeCode** | Exchange auth code for tokens | `serviceName`, `code`, `state?` |
152
+ | **refreshToken** | Refresh access token | `serviceName`, `refreshToken` |
153
+ | **getUserInfo** | Get user information | `serviceName`, `accessToken` |
154
+ | **validateToken** | Validate access token | `serviceName`, `accessToken` |
155
+ | **revokeToken** | Revoke access/refresh token | `serviceName`, `token`, `tokenType?` |
156
+ | **listServices** | List configured services | None |
157
+ | **getStoredTokens** | Get stored tokens | `serviceName?` |
158
+ | **clearTokens** | Clear stored tokens | `serviceName?` |
159
+
160
+ #### Complete OAuth Flow Example
161
+
162
+ ```typescript
163
+ // Step 1: Configure provider
164
+ await oauth.use({
165
+ method: 'configure',
166
+ params: {
167
+ serviceName: 'google',
168
+ clientId: process.env.GOOGLE_CLIENT_ID,
169
+ clientSecret: process.env.GOOGLE_CLIENT_SECRET,
170
+ redirectUri: 'http://localhost:3000/auth/callback',
171
+ authorizationUrl: 'https://accounts.google.com/o/oauth2/v2/auth',
172
+ tokenUrl: 'https://oauth2.googleapis.com/token',
173
+ userInfoUrl: 'https://www.googleapis.com/oauth2/v2/userinfo',
174
+ scope: 'openid profile email'
175
+ }
176
+ });
177
+
178
+ // Step 2: Get authorization URL
179
+ const { authorizationUrl } = await oauth.use({
180
+ method: 'getAuthorizationUrl',
181
+ params: {
182
+ serviceName: 'google',
183
+ state: crypto.randomUUID()
184
+ }
185
+ });
186
+
187
+ // User visits authorizationUrl and is redirected back with code
188
+
189
+ // Step 3: Exchange code for tokens
190
+ const { tokens } = await oauth.use({
191
+ method: 'exchangeCode',
192
+ params: {
193
+ serviceName: 'google',
194
+ code: 'authorization_code_from_callback'
195
+ }
196
+ });
197
+
198
+ console.log(tokens.access_token); // Use for API calls
199
+
200
+ // Step 4: Get user info
201
+ const { userInfo } = await oauth.use({
202
+ method: 'getUserInfo',
203
+ params: {
204
+ serviceName: 'google',
205
+ accessToken: tokens.access_token
206
+ }
207
+ });
208
+
209
+ console.log(userInfo); // { email: "...", name: "...", ... }
210
+ ```
211
+
212
+ #### Token Management
213
+
214
+ ```typescript
215
+ // Check stored tokens
216
+ const { tokens } = await oauth.use({
217
+ method: 'getStoredTokens',
218
+ params: { serviceName: 'google' }
219
+ });
220
+
221
+ // Refresh expired token
222
+ if (tokens.expires_in < 300) { // Less than 5 minutes left
223
+ const refreshed = await oauth.use({
224
+ method: 'refreshToken',
225
+ params: {
226
+ serviceName: 'google',
227
+ refreshToken: tokens.refresh_token
228
+ }
229
+ });
230
+ console.log(refreshed.tokens.access_token);
231
+ }
232
+
233
+ // Clear tokens on logout
234
+ await oauth.use({
235
+ method: 'clearTokens',
236
+ params: { serviceName: 'google' }
237
+ });
238
+ ```
239
+
240
+ ---
241
+
242
+ ### 2. Text Embeddings Tools {#embeddings}
243
+
244
+ Generate vector embeddings from text for semantic search and similarity operations.
245
+
246
+ **Address**: `o://embeddings-text`
247
+
248
+ #### Base Class: TextEmbeddingsTool
249
+
250
+ Abstract base class for text embedding implementations.
251
+
252
+ ```typescript
253
+ import { TextEmbeddingsTool } from '@olane/o-tool-registry';
254
+
255
+ abstract class TextEmbeddingsTool extends oLaneTool {
256
+ abstract _tool_embed_documents(request: oRequest): Promise<number[][]>;
257
+ abstract _tool_embed_query(request: oRequest): Promise<number[]>;
258
+ }
259
+ ```
260
+
261
+ #### Implementation: HuggingfaceTextEmbeddingsTool
262
+
263
+ Uses Hugging Face's `all-MiniLM-L6-v2` model for fast, local embeddings.
264
+
265
+ **Features**:
266
+ - 🚀 **Fast** - Optimized transformer model
267
+ - 🏠 **Local** - Runs entirely offline
268
+ - 📦 **384 dimensions** - Compact vector size
269
+ - 🎯 **Multi-lingual** - Supports 100+ languages
270
+
271
+ **Example**:
272
+
273
+ ```typescript
274
+ import { HuggingfaceTextEmbeddingsTool } from '@olane/o-tool-registry';
275
+
276
+ const embeddings = new HuggingfaceTextEmbeddingsTool({
277
+ name: 'embeddings-text',
278
+ parent: myNode.address
279
+ });
280
+ await embeddings.start();
281
+
282
+ // Embed multiple documents
283
+ const docEmbeddings = await embeddings.use({
284
+ method: 'embed_documents',
285
+ params: {
286
+ documents: [
287
+ 'Olane OS is a distributed operating system',
288
+ 'Tools are executable methods on nodes',
289
+ 'Vector embeddings enable semantic search'
290
+ ]
291
+ }
292
+ });
293
+
294
+ console.log(docEmbeddings.result); // [[0.1, -0.2, ...], [...], [...]]
295
+
296
+ // Embed a search query
297
+ const queryEmbedding = await embeddings.use({
298
+ method: 'embed_query',
299
+ params: {
300
+ query: 'What is Olane OS?'
301
+ }
302
+ });
303
+
304
+ console.log(queryEmbedding.result); // [0.05, -0.15, ...]
305
+ ```
306
+
307
+ #### Available Methods
308
+
309
+ | Method | Description | Parameters | Returns |
310
+ |--------|-------------|------------|---------|
311
+ | **embed_documents** | Embed multiple documents | `documents: string[]` | `number[][]` |
312
+ | **embed_query** | Embed single query | `query: string` | `number[]` |
313
+
314
+ ---
315
+
316
+ ### 3. Named Entity Recognition (NER) Tool {#ner}
317
+
318
+ Extract named entities (people, organizations, locations, etc.) from text.
319
+
320
+ **Address**: `o://ner`
321
+
322
+ #### Example
323
+
324
+ ```typescript
325
+ import { NERTool } from '@olane/o-tool-registry';
326
+
327
+ const ner = new NERTool({
328
+ name: 'ner',
329
+ parent: myNode.address,
330
+ leader: leaderAddress
331
+ });
332
+ await ner.start();
333
+
334
+ // Extract entities
335
+ const result = await ner.use({
336
+ method: 'extract',
337
+ params: {
338
+ text: 'Apple Inc. was founded by Steve Jobs in Cupertino, California on April 1, 1976.'
339
+ }
340
+ });
341
+
342
+ console.log(result);
343
+ // {
344
+ // entities: [
345
+ // { text: 'Apple Inc.', type: 'ORGANIZATION' },
346
+ // { text: 'Steve Jobs', type: 'PERSON' },
347
+ // { text: 'Cupertino', type: 'LOCATION' },
348
+ // { text: 'California', type: 'LOCATION' },
349
+ // { text: 'April 1, 1976', type: 'DATE' }
350
+ // ]
351
+ // }
352
+ ```
353
+
354
+ #### Available Methods
355
+
356
+ | Method | Description | Parameters | Returns |
357
+ |--------|-------------|------------|---------|
358
+ | **extract** | Extract named entities | `text: string` | Entity list with types |
359
+
360
+ > **Note**: Uses `o-intelligence` for entity extraction via LLM prompting.
361
+
362
+ ---
363
+
364
+ ### 4. Vector Storage Tools {#vector-store}
365
+
366
+ Store and search document embeddings for semantic similarity search.
367
+
368
+ **Address**: `o://vector-store`
369
+
370
+ #### Base Class: VectorMemoryStorageTool
371
+
372
+ Abstract base class for vector store implementations.
373
+
374
+ ```typescript
375
+ abstract class VectorMemoryStorageTool extends oLaneTool {
376
+ abstract _tool_search_similar(request: oRequest): Promise<ToolResult>;
377
+ abstract _tool_add_documents(request: oRequest): Promise<ToolResult>;
378
+ abstract _tool_delete_documents(request: oRequest): Promise<ToolResult>;
379
+ abstract _tool_update_documents(request: oRequest): Promise<ToolResult>;
380
+ }
381
+ ```
382
+
383
+ #### Implementation: LangchainMemoryVectorStoreTool
384
+
385
+ In-memory vector store using LangChain.
386
+
387
+ **Features**:
388
+ - 💾 **In-Memory** - Fast, no external database
389
+ - 🔍 **Semantic Search** - Find similar documents
390
+ - 🔗 **Integrated** - Uses `o://embeddings-text` automatically
391
+ - 📄 **Document Metadata** - Store and retrieve metadata
392
+
393
+ **Example**:
394
+
395
+ ```typescript
396
+ import { LangchainMemoryVectorStoreTool } from '@olane/o-tool-registry';
397
+
398
+ const vectorStore = new LangchainMemoryVectorStoreTool({
399
+ name: 'vector-store',
400
+ parent: myNode.address,
401
+ leader: leaderAddress
402
+ });
403
+ await vectorStore.start();
404
+
405
+ // Add documents
406
+ await vectorStore.use({
407
+ method: 'add_documents',
408
+ params: {
409
+ documents: [
410
+ {
411
+ pageContent: 'Olane OS is a distributed operating system for AI agents',
412
+ metadata: { source: 'docs', page: 1 }
413
+ },
414
+ {
415
+ pageContent: 'Tools are executable methods that agents can call',
416
+ metadata: { source: 'docs', page: 2 }
417
+ },
418
+ {
419
+ pageContent: 'Nodes are processes running on Olane OS',
420
+ metadata: { source: 'docs', page: 3 }
421
+ }
422
+ ]
423
+ }
424
+ });
425
+
426
+ // Search for similar documents
427
+ const results = await vectorStore.use({
428
+ method: 'search_similar',
429
+ params: {
430
+ query: 'What are agents?',
431
+ limit: 2
432
+ }
433
+ });
434
+
435
+ console.log(results);
436
+ // [
437
+ // {
438
+ // pageContent: 'Olane OS is a distributed operating system for AI agents',
439
+ // metadata: { source: 'docs', page: 1 }
440
+ // },
441
+ // {
442
+ // pageContent: 'Tools are executable methods that agents can call',
443
+ // metadata: { source: 'docs', page: 2 }
444
+ // }
445
+ // ]
446
+ ```
447
+
448
+ #### Available Methods
449
+
450
+ | Method | Description | Parameters | Returns |
451
+ |--------|-------------|------------|---------|
452
+ | **add_documents** | Add documents to store | `documents: Array<{pageContent: string, metadata?: any}>` | Document IDs |
453
+ | **search_similar** | Find similar documents | `query: string, limit?: number` | Document array |
454
+ | **delete_documents** | Remove documents | `ids: string[]` | ❌ Not implemented |
455
+ | **update_documents** | Update documents | `id: string, document: Document` | ❌ Not implemented |
456
+
457
+ > **Note**: Delete and update methods will be implemented in individual tool packages.
458
+
459
+ ---
460
+
461
+ ## Usage Patterns {#usage-patterns}
462
+
463
+ ### Pattern 1: Full Registry Initialization
464
+
465
+ Best for quick prototypes and all-in-one applications.
466
+
467
+ ```typescript
468
+ import { oLaneTool } from '@olane/o-lane';
469
+ import { initRegistryTools } from '@olane/o-tool-registry';
470
+
471
+ const app = new oLaneTool({
472
+ name: 'my-app',
473
+ address: new oAddress('o://app')
474
+ });
475
+
476
+ await app.start();
477
+ await initRegistryTools(app);
478
+
479
+ // All tools available as children:
480
+ // - o://app/ner
481
+ // - o://app/intelligence
482
+ // - o://app/embeddings-text
483
+ // - o://app/vector-store
484
+ // - o://app/mcp
485
+ ```
486
+
487
+ **Initialized Tools**:
488
+ - `NERTool` at `o://parent/ner`
489
+ - `IntelligenceTool` at `o://parent/intelligence`
490
+ - `HuggingfaceTextEmbeddingsTool` at `o://parent/embeddings-text`
491
+ - `LangchainMemoryVectorStoreTool` at `o://parent/vector-store`
492
+ - `McpBridgeTool` at `o://parent/mcp`
493
+
494
+ ---
495
+
496
+ ### Pattern 2: Selective Tool Import
497
+
498
+ Best for production - only import what you need.
499
+
500
+ ```typescript
501
+ import { OAuthTool, HuggingfaceTextEmbeddingsTool } from '@olane/o-tool-registry';
502
+
503
+ // Only use OAuth and embeddings
504
+ const oauth = new OAuthTool({ name: 'oauth', parent: app.address });
505
+ const embeddings = new HuggingfaceTextEmbeddingsTool({
506
+ name: 'embeddings',
507
+ parent: app.address
508
+ });
509
+
510
+ await Promise.all([oauth.start(), embeddings.start()]);
511
+ ```
512
+
513
+ ---
514
+
515
+ ### Pattern 3: Custom Tool Extension
516
+
517
+ Extend base classes for custom implementations.
518
+
519
+ ```typescript
520
+ import { TextEmbeddingsTool } from '@olane/o-tool-registry';
521
+ import { oRequest } from '@olane/o-core';
522
+
523
+ class OpenAIEmbeddingsTool extends TextEmbeddingsTool {
524
+ private apiKey: string;
525
+
526
+ constructor(config) {
527
+ super(config);
528
+ this.apiKey = process.env.OPENAI_API_KEY;
529
+ }
530
+
531
+ async _tool_embed_documents(request: oRequest): Promise<number[][]> {
532
+ const { documents } = request.params;
533
+
534
+ // Call OpenAI API
535
+ const response = await fetch('https://api.openai.com/v1/embeddings', {
536
+ method: 'POST',
537
+ headers: {
538
+ 'Authorization': `Bearer ${this.apiKey}`,
539
+ 'Content-Type': 'application/json'
540
+ },
541
+ body: JSON.stringify({
542
+ model: 'text-embedding-3-small',
543
+ input: documents
544
+ })
545
+ });
546
+
547
+ const data = await response.json();
548
+ return data.data.map(item => item.embedding);
549
+ }
550
+
551
+ async _tool_embed_query(request: oRequest): Promise<number[]> {
552
+ const embeddings = await this._tool_embed_documents({
553
+ ...request,
554
+ params: { documents: [request.params.query] }
555
+ });
556
+ return embeddings[0];
557
+ }
558
+ }
559
+ ```
560
+
561
+ ---
562
+
563
+ ## Complete Example: RAG Application {#rag-example}
564
+
565
+ Build a Retrieval-Augmented Generation system using the tool registry.
566
+
567
+ ```typescript
568
+ import { oLaneTool } from '@olane/o-lane';
569
+ import {
570
+ HuggingfaceTextEmbeddingsTool,
571
+ LangchainMemoryVectorStoreTool,
572
+ initRegistryTools
573
+ } from '@olane/o-tool-registry';
574
+ import { oAddress } from '@olane/o-core';
575
+
576
+ // Create RAG application node
577
+ class RAGApplication extends oLaneTool {
578
+ constructor() {
579
+ super({
580
+ name: 'rag-app',
581
+ address: new oAddress('o://rag')
582
+ });
583
+ }
584
+
585
+ async initialize() {
586
+ await super.initialize();
587
+
588
+ // Initialize all registry tools
589
+ await initRegistryTools(this);
590
+
591
+ // Load documents into vector store
592
+ await this.loadDocuments();
593
+ }
594
+
595
+ async loadDocuments() {
596
+ const documents = [
597
+ {
598
+ pageContent: 'Olane OS is a distributed operating system designed for AI agents.',
599
+ metadata: { source: 'intro.md', section: 'overview' }
600
+ },
601
+ {
602
+ pageContent: 'Tools are executable methods on nodes that agents can invoke.',
603
+ metadata: { source: 'concepts.md', section: 'tools' }
604
+ },
605
+ {
606
+ pageContent: 'Nodes are processes running on Olane OS with unique o:// addresses.',
607
+ metadata: { source: 'concepts.md', section: 'nodes' }
608
+ }
609
+ ];
610
+
611
+ await this.use(new oAddress('o://rag/vector-store'), {
612
+ method: 'add_documents',
613
+ params: { documents }
614
+ });
615
+
616
+ this.logger.info('Documents loaded into vector store');
617
+ }
618
+
619
+ async _tool_ask(request: oRequest) {
620
+ const { question } = request.params;
621
+
622
+ // Step 1: Search for relevant documents
623
+ const searchResult = await this.use(
624
+ new oAddress('o://rag/vector-store'),
625
+ {
626
+ method: 'search_similar',
627
+ params: { query: question, limit: 3 }
628
+ }
629
+ );
630
+
631
+ const context = searchResult.result
632
+ .map(doc => doc.pageContent)
633
+ .join('\n\n');
634
+
635
+ // Step 2: Generate answer with context
636
+ const answer = await this.use(
637
+ new oAddress('o://rag/intelligence'),
638
+ {
639
+ method: 'prompt',
640
+ params: {
641
+ prompt: `Context:\n${context}\n\nQuestion: ${question}\n\nAnswer based on the context above:`
642
+ }
643
+ }
644
+ );
645
+
646
+ return {
647
+ question,
648
+ answer: answer.result,
649
+ sources: searchResult.result.map(doc => doc.metadata)
650
+ };
651
+ }
652
+ }
653
+
654
+ // Start the application
655
+ const rag = new RAGApplication();
656
+ await rag.start();
657
+
658
+ // Ask questions
659
+ const response = await rag.use({
660
+ method: 'ask',
661
+ params: {
662
+ question: 'What are tools in Olane OS?'
663
+ }
664
+ });
665
+
666
+ console.log(response);
667
+ // {
668
+ // question: 'What are tools in Olane OS?',
669
+ // answer: 'Tools are executable methods on nodes that agents can invoke...',
670
+ // sources: [{ source: 'concepts.md', section: 'tools' }]
671
+ // }
672
+ ```
673
+
674
+ ---
675
+
676
+ ## API Reference {#api}
677
+
678
+ ### initRegistryTools(parentNode: oLaneTool)
679
+
680
+ Initialize all registry tools as child nodes of a parent.
681
+
682
+ **Parameters:**
683
+ - `parentNode` (oLaneTool, required): Parent node to attach tools to
684
+
685
+ **Returns:** `Promise<void>`
686
+
687
+ **Behavior:**
688
+ - Creates 5 child nodes (NER, Intelligence, Embeddings, Vector Store, MCP)
689
+ - Starts all tools automatically
690
+ - Registers tools with parent's hierarchy
691
+
692
+ **Example:**
693
+ ```typescript
694
+ await initRegistryTools(myNode);
695
+ // Tools now available at:
696
+ // - o://my-node/ner
697
+ // - o://my-node/intelligence
698
+ // - o://my-node/embeddings-text
699
+ // - o://my-node/vector-store
700
+ // - o://my-node/mcp
701
+ ```
702
+
703
+ ---
704
+
705
+ ## Architecture {#architecture}
706
+
707
+ ### Tool Hierarchy
708
+
709
+ ```
710
+ ┌─────────────────────────────────────────────────────┐
711
+ │ Parent Node (Your Application) │
712
+ │ o://my-app │
713
+ └─────────────────────────────────────────────────────┘
714
+ ⬇ initRegistryTools()
715
+ ┌────────────┼────────────┬──────────┐
716
+ ⬇ ⬇ ⬇ ⬇
717
+ ┌──────────────┐ ┌──────────┐ ┌───────────┐ ┌────────────┐
718
+ │ NER Tool │ │ Embeddings│ │ Vector │ │ Intelligence│
719
+ │ o://app/ner │ │ o://app/ │ │ Store │ │ o://app/ │
720
+ │ │ │ embeddings│ │ o://app/ │ │ intelligence│
721
+ └──────────────┘ └──────────┘ │ vector- │ └────────────┘
722
+ │ store │
723
+ └───────────┘
724
+ ```
725
+
726
+ ### Tool Dependencies
727
+
728
+ ```
729
+ ┌────────────────────────────────────────┐
730
+ │ LangchainMemoryVectorStoreTool │
731
+ │ (stores documents) │
732
+ └────────────────────────────────────────┘
733
+ ⬇ uses for embeddings
734
+ ┌────────────────────────────────────────┐
735
+ │ HuggingfaceTextEmbeddingsTool │
736
+ │ (generates vectors) │
737
+ └────────────────────────────────────────┘
738
+ ```
739
+
740
+ ```
741
+ ┌────────────────────────────────────────┐
742
+ │ NERTool │
743
+ │ (extracts entities) │
744
+ └────────────────────────────────────────┘
745
+ ⬇ uses for LLM
746
+ ┌────────────────────────────────────────┐
747
+ │ IntelligenceTool │
748
+ │ (from @olane/o-intelligence) │
749
+ └────────────────────────────────────────┘
750
+ ```
751
+
752
+ ---
753
+
754
+ ## Troubleshooting {#troubleshooting}
755
+
756
+ ### Error: "Cannot find module '@huggingface/transformers'"
757
+
758
+ **Cause**: Missing peer dependencies.
759
+
760
+ **Solution**: Install all peer dependencies:
761
+ ```bash
762
+ npm install @huggingface/transformers @langchain/community @langchain/core langchain
763
+ ```
764
+
765
+ ---
766
+
767
+ ### Error: "OAuth configuration not found for service: xyz"
768
+
769
+ **Cause**: Service not configured before use.
770
+
771
+ **Solution**: Configure the service first:
772
+ ```typescript
773
+ await oauth.use({
774
+ method: 'configure',
775
+ params: {
776
+ serviceName: 'xyz',
777
+ clientId: '...',
778
+ clientSecret: '...',
779
+ // ... other config
780
+ }
781
+ });
782
+ ```
783
+
784
+ ---
785
+
786
+ ### Error: "No user info URL configured for service"
787
+
788
+ **Cause**: OAuth provider doesn't have `userInfoUrl` set.
789
+
790
+ **Solution**: Either configure it or pass it explicitly:
791
+ ```typescript
792
+ // Option 1: Configure in setup
793
+ await oauth.use({
794
+ method: 'configure',
795
+ params: {
796
+ serviceName: 'github',
797
+ userInfoUrl: 'https://api.github.com/user',
798
+ // ...
799
+ }
800
+ });
801
+
802
+ // Option 2: Pass per-request
803
+ await oauth.use({
804
+ method: 'getUserInfo',
805
+ params: {
806
+ serviceName: 'github',
807
+ accessToken: '...',
808
+ userInfoUrl: 'https://api.github.com/user'
809
+ }
810
+ });
811
+ ```
812
+
813
+ ---
814
+
815
+ ### Vector Store Returns Empty Results
816
+
817
+ **Cause**: Documents not added or embeddings not generated.
818
+
819
+ **Solution**: Ensure documents are added before searching:
820
+ ```typescript
821
+ // First, add documents
822
+ await vectorStore.use({
823
+ method: 'add_documents',
824
+ params: {
825
+ documents: [
826
+ { pageContent: 'Some text', metadata: {} }
827
+ ]
828
+ }
829
+ });
830
+
831
+ // Then search
832
+ const results = await vectorStore.use({
833
+ method: 'search_similar',
834
+ params: { query: 'Some text', limit: 5 }
835
+ });
836
+ ```
837
+
838
+ ---
839
+
840
+ ### Slow Embedding Generation
841
+
842
+ **Cause**: First run downloads Hugging Face model (~90MB).
843
+
844
+ **Solution**: Model is cached after first use. For production:
845
+ ```typescript
846
+ // Pre-load during initialization
847
+ const embeddings = new HuggingfaceTextEmbeddingsTool({ ... });
848
+ await embeddings.start();
849
+
850
+ // First call downloads model (slow)
851
+ await embeddings.use({
852
+ method: 'embed_query',
853
+ params: { query: 'warmup' }
854
+ });
855
+
856
+ // Subsequent calls are fast
857
+ ```
858
+
859
+ ---
860
+
861
+ ## Migration Guide {#migration-guide}
862
+
863
+ ### From Bundled Registry to Individual Packages
864
+
865
+ When individual packages are released (version 0.8.0+), follow this guide:
866
+
867
+ #### Before (v0.7.x)
868
+
869
+ ```typescript
870
+ import {
871
+ OAuthTool,
872
+ HuggingfaceTextEmbeddingsTool,
873
+ NERTool
874
+ } from '@olane/o-tool-registry';
875
+ ```
876
+
877
+ #### After (v0.8.0+)
878
+
879
+ ```typescript
880
+ import { OAuthTool } from '@olane/o-tool-oauth';
881
+ import { HuggingfaceEmbeddingsTool } from '@olane/o-tool-embeddings-hf';
882
+ import { NERTool } from '@olane/o-tool-ner';
883
+ ```
884
+
885
+ #### Update package.json
886
+
887
+ **Remove**:
888
+ ```json
889
+ {
890
+ "dependencies": {
891
+ "@olane/o-tool-registry": "^0.7.2"
892
+ }
893
+ }
894
+ ```
895
+
896
+ **Replace with**:
897
+ ```json
898
+ {
899
+ "dependencies": {
900
+ "@olane/o-tool-oauth": "^0.8.0",
901
+ "@olane/o-tool-embeddings-hf": "^0.8.0",
902
+ "@olane/o-tool-ner": "^0.8.0"
903
+ }
904
+ }
905
+ ```
906
+
907
+ #### No Code Changes Required
908
+
909
+ All tool APIs remain the same - only import paths change.
910
+
911
+ ---
912
+
913
+ ## Package Information {#package-info}
914
+
915
+ ### Dependencies
916
+
917
+ **Core Olane Packages** (peer dependencies):
918
+ - `@olane/o-core` - Core primitives
919
+ - `@olane/o-tool` - Tool framework
920
+ - `@olane/o-lane` - Agent capability loop
921
+ - `@olane/o-intelligence` - LLM integration
922
+ - `@olane/o-mcp` - MCP bridge
923
+
924
+ **External Libraries**:
925
+ - `@huggingface/transformers` - Embedding models
926
+ - `@langchain/community` - LangChain integrations
927
+ - `@langchain/core` - LangChain core
928
+ - `langchain` - Vector store implementations
929
+
930
+ ### Repository
931
+
932
+ **GitHub**: [olane-labs/olane](https://github.com/olane-labs/olane)
933
+ **Package**: `packages/o-tool-registry`
934
+
935
+ ### License
936
+
937
+ ISC License - see LICENSE file for details.
938
+
939
+ ---
940
+
941
+ ## Related Packages {#related}
942
+
943
+ | Package | Description | Documentation |
944
+ |---------|-------------|---------------|
945
+ | **[@olane/o-tool](/packages/o-tool)** | Base tool framework | Tool architecture |
946
+ | **[@olane/o-lane](/packages/o-lane)** | Agent capability loop | Complex nodes |
947
+ | **[@olane/o-intelligence](/packages/o-intelligence)** | LLM integration | AI capabilities |
948
+ | **[@olane/o-mcp](/packages/o-mcp)** | MCP protocol bridge | MCP integration |
949
+ | **[@olane/o-node](/packages/o-node)** | Node framework | Network tools |
950
+
951
+ ---
952
+
953
+ ## Support {#support}
954
+
955
+ - **Documentation**: [olane.dev](https://olane.dev)
956
+ - **Issues**: [GitHub Issues](https://github.com/olane-labs/olane/issues)
957
+ - **Discussions**: [GitHub Discussions](https://github.com/olane-labs/olane/discussions)
958
+
959
+ ---
960
+
961
+ ## Version History {#versions}
962
+
963
+ | Version | Status | Notes |
964
+ |---------|--------|-------|
965
+ | **0.7.2** | ✅ Current | Last bundled release |
966
+ | **0.8.0** | 🔜 Planned | Individual packages |
967
+ | **1.0.0** | 🔜 Future | Registry deprecated |
968
+
969
+ ---
970
+
971
+ **Next Steps**:
972
+ - Read [Tool Concepts](/concepts/tools-nodes-applications) to understand tool architecture
973
+ - Learn about [Simple vs Complex Nodes](/concepts/tool-nodes/overview)
974
+ - Build your first [Tool Node](/guides/building-tool-nodes)
975
+ - Explore [Package Combinations](/packages/package-combinations)
976
+
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/init.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,eAAO,MAAM,iBAAiB,UAAiB,SAAS,KAAG,QAAQ,IAAI,CAoCtE,CAAC"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/init.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,eAAO,MAAM,iBAAiB,UAAiB,SAAS,KAAG,QAAQ,IAAI,CAqCtE,CAAC"}
package/dist/src/init.js CHANGED
@@ -3,7 +3,7 @@ import { HuggingfaceTextEmbeddingsTool } from './embeddings/index.js';
3
3
  import { LangchainMemoryVectorStoreTool } from './vector-store/index.js';
4
4
  import { IntelligenceTool } from '@olane/o-intelligence';
5
5
  import { McpBridgeTool } from '@olane/o-mcp';
6
- import { NodeType } from '@olane/o-core';
6
+ import { NodeType, oAddress } from '@olane/o-core';
7
7
  export const initRegistryTools = async (oNode) => {
8
8
  const params = {
9
9
  parent: oNode.address,
@@ -30,6 +30,7 @@ export const initRegistryTools = async (oNode) => {
30
30
  }),
31
31
  new McpBridgeTool({
32
32
  name: 'mcp',
33
+ address: new oAddress('o://mcp'),
33
34
  ...params,
34
35
  }),
35
36
  ];
@@ -1,14 +1,17 @@
1
1
  import { oRequest } from '@olane/o-core';
2
2
  import { VectorMemoryStorageTool } from './vector-memory.tool.js';
3
+ import { DocumentInterface } from '@langchain/core/documents';
3
4
  import { oNodeToolConfig } from '@olane/o-node';
4
5
  export declare class LangchainMemoryVectorStoreTool extends VectorMemoryStorageTool {
5
6
  private vectorStore;
6
7
  constructor(config: oNodeToolConfig);
7
8
  private embeddingsTool;
8
9
  initialize(): Promise<void>;
9
- _tool_add_documents(request: oRequest): Promise<any>;
10
+ _tool_add_documents(request: oRequest): Promise<{
11
+ success: boolean;
12
+ }>;
10
13
  _tool_delete_documents(request: oRequest): Promise<any>;
11
14
  _tool_update_documents(request: oRequest): Promise<any>;
12
- _tool_search_similar(request: oRequest): Promise<any>;
15
+ _tool_search_similar(request: oRequest): Promise<DocumentInterface[]>;
13
16
  }
14
17
  //# sourceMappingURL=langchain-memory.vector-store.tool.d.ts.map
@@ -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;AAEnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAIlE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,qBAAa,8BAA+B,SAAQ,uBAAuB;IACzE,OAAO,CAAC,WAAW,CAAqB;gBAE5B,MAAM,EAAE,eAAe;IAOnC,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"}
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;AAEnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,EAGL,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,qBAAa,8BAA+B,SAAQ,uBAAuB;IACzE,OAAO,CAAC,WAAW,CAAqB;gBAE5B,MAAM,EAAE,eAAe;IAOnC,OAAO,CAAC,cAAc;IAuBhB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAK3B,mBAAmB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAWrE,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,iBAAiB,EAAE,CAAC;CAO5E"}
@@ -1,7 +1,7 @@
1
1
  import { MemoryVectorStore } from 'langchain/vectorstores/memory';
2
2
  import { oAddress } from '@olane/o-core';
3
3
  import { VectorMemoryStorageTool } from './vector-memory.tool.js';
4
- import { Document } from '@langchain/core/documents';
4
+ import { Document, } from '@langchain/core/documents';
5
5
  import { VECTOR_STORE_PARAMS } from './methods/vector-store.methods.js';
6
6
  export class LangchainMemoryVectorStoreTool extends VectorMemoryStorageTool {
7
7
  constructor(config) {
@@ -38,9 +38,11 @@ export class LangchainMemoryVectorStoreTool extends VectorMemoryStorageTool {
38
38
  }
39
39
  async _tool_add_documents(request) {
40
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;
41
+ const formattedDocs = Array.from(documents).map((doc) => new Document(doc));
42
+ await this.vectorStore.addDocuments(formattedDocs);
43
+ return {
44
+ success: true,
45
+ };
44
46
  }
45
47
  async _tool_delete_documents(request) {
46
48
  throw new Error('Not implemented');
@@ -1 +1 @@
1
- {"version":3,"file":"vector-memory.tool.d.ts","sourceRoot":"","sources":["../../../src/vector-store/vector-memory.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAY,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,8BAAsB,uBAAwB,SAAQ,SAAS;gBACjD,MAAM,EAAE,eAAe;IASnC,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"}
1
+ {"version":3,"file":"vector-memory.tool.d.ts","sourceRoot":"","sources":["../../../src/vector-store/vector-memory.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAY,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,8BAAsB,uBAAwB,SAAQ,SAAS;gBACjD,MAAM,EAAE,eAAe;IASnC,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olane/o-tool-registry",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "type": "module",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -32,7 +32,7 @@
32
32
  "url": "git+https://github.com/olane-labs/olane.git"
33
33
  },
34
34
  "author": "oLane Inc.",
35
- "license": "ISC",
35
+ "license": "(MIT OR Apache-2.0)",
36
36
  "description": "oLane server tool registry",
37
37
  "devDependencies": {
38
38
  "@eslint/eslintrc": "^3.3.1",
@@ -55,14 +55,14 @@
55
55
  "typescript": "5.4.5"
56
56
  },
57
57
  "peerDependencies": {
58
- "@olane/o-config": "^0.7.1",
59
- "@olane/o-core": "^0.7.1",
60
- "@olane/o-intelligence": "^0.7.1",
61
- "@olane/o-lane": "^0.7.1",
62
- "@olane/o-mcp": "^0.7.1",
63
- "@olane/o-protocol": "^0.7.1",
64
- "@olane/o-tool": "^0.7.1",
65
- "@olane/o-tools-common": "^0.7.1"
58
+ "@olane/o-config": "^0.7.3",
59
+ "@olane/o-core": "^0.7.3",
60
+ "@olane/o-intelligence": "^0.7.3",
61
+ "@olane/o-lane": "^0.7.3",
62
+ "@olane/o-mcp": "^0.7.3",
63
+ "@olane/o-protocol": "^0.7.3",
64
+ "@olane/o-tool": "^0.7.3",
65
+ "@olane/o-tools-common": "^0.7.3"
66
66
  },
67
67
  "dependencies": {
68
68
  "@huggingface/transformers": "^3.5.2",