@olane/o-tool-registry 0.8.2 → 0.8.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 +70 -100
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> ⚠️ **Deprecation Notice**: This package is being phased out. Tools should now be referenced and installed independently.
|
|
4
4
|
|
|
5
|
-
A collection of pre-built tools for Olane OS including OAuth authentication, text embeddings,
|
|
5
|
+
A collection of pre-built tools for Olane OS including OAuth authentication, text embeddings, and vector storage.
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/@olane/o-tool-registry)
|
|
8
8
|
[](https://opensource.org/licenses/ISC)
|
|
@@ -20,26 +20,25 @@ This package was originally designed as a convenient registry for commonly-used
|
|
|
20
20
|
|
|
21
21
|
If you're using `o-tool-registry`, you should plan to migrate to individual tool packages:
|
|
22
22
|
|
|
23
|
-
| Current Import | Future Package
|
|
23
|
+
| Current Import | Future Package |
|
|
24
24
|
|---------------|------------------------------|
|
|
25
25
|
| `OAuthTool` | `@olane/o-tool-oauth` |
|
|
26
26
|
| `TextEmbeddingsTool` | `@olane/o-tool-embeddings` |
|
|
27
27
|
| `HuggingfaceTextEmbeddingsTool` | `@olane/o-tool-embeddings-hf` |
|
|
28
|
-
| `NERTool` | `@olane/o-tool-ner` |
|
|
29
28
|
| `VectorMemoryStorageTool` | `@olane/o-tool-vector-store` |
|
|
30
29
|
| `LangchainMemoryVectorStoreTool` | `@olane/o-tool-vector-store-langchain` |
|
|
31
30
|
|
|
32
|
-
> **Timeline**:
|
|
31
|
+
> **Timeline**: These tools are already deprecated as of v0.8.0. Individual tool packages are being released. This bundled package will be fully removed in version 1.0.0.
|
|
33
32
|
|
|
34
33
|
## Installation {#installation}
|
|
35
34
|
|
|
36
35
|
```bash
|
|
37
|
-
|
|
36
|
+
pnpm add @olane/o-tool-registry
|
|
38
37
|
```
|
|
39
38
|
|
|
40
39
|
**Peer Dependencies** (automatically installed):
|
|
41
40
|
```bash
|
|
42
|
-
|
|
41
|
+
pnpm add @olane/o-core @olane/o-tool @olane/o-lane @olane/o-intelligence @olane/o-mcp
|
|
43
42
|
```
|
|
44
43
|
|
|
45
44
|
## Quick Start {#quick-start}
|
|
@@ -65,7 +64,6 @@ await parentNode.start();
|
|
|
65
64
|
await initRegistryTools(parentNode);
|
|
66
65
|
|
|
67
66
|
// Now tools are available at:
|
|
68
|
-
// - o://my-app/ner
|
|
69
67
|
// - o://my-app/intelligence
|
|
70
68
|
// - o://my-app/embeddings-text
|
|
71
69
|
// - o://my-app/vector-store
|
|
@@ -82,7 +80,7 @@ import { oAddress } from '@olane/o-core';
|
|
|
82
80
|
|
|
83
81
|
const oauthTool = new OAuthTool({
|
|
84
82
|
name: 'oauth',
|
|
85
|
-
address: new oAddress('o://
|
|
83
|
+
address: new oAddress('o://oauth')
|
|
86
84
|
});
|
|
87
85
|
|
|
88
86
|
await oauthTool.start();
|
|
@@ -130,7 +128,7 @@ await oauth.use({
|
|
|
130
128
|
});
|
|
131
129
|
|
|
132
130
|
// Get authorization URL
|
|
133
|
-
const
|
|
131
|
+
const authUrlResponse = await oauth.use({
|
|
134
132
|
method: 'getAuthorizationUrl',
|
|
135
133
|
params: {
|
|
136
134
|
serviceName: 'github',
|
|
@@ -138,7 +136,7 @@ const authUrl = await oauth.use({
|
|
|
138
136
|
}
|
|
139
137
|
});
|
|
140
138
|
|
|
141
|
-
console.log(
|
|
139
|
+
console.log(authUrlResponse.result.data.authorizationUrl);
|
|
142
140
|
// https://github.com/login/oauth/authorize?client_id=...
|
|
143
141
|
```
|
|
144
142
|
|
|
@@ -176,7 +174,7 @@ await oauth.use({
|
|
|
176
174
|
});
|
|
177
175
|
|
|
178
176
|
// Step 2: Get authorization URL
|
|
179
|
-
const
|
|
177
|
+
const authResponse = await oauth.use({
|
|
180
178
|
method: 'getAuthorizationUrl',
|
|
181
179
|
params: {
|
|
182
180
|
serviceName: 'google',
|
|
@@ -184,10 +182,11 @@ const { authorizationUrl } = await oauth.use({
|
|
|
184
182
|
}
|
|
185
183
|
});
|
|
186
184
|
|
|
185
|
+
const authorizationUrl = authResponse.result.data.authorizationUrl;
|
|
187
186
|
// User visits authorizationUrl and is redirected back with code
|
|
188
187
|
|
|
189
188
|
// Step 3: Exchange code for tokens
|
|
190
|
-
const
|
|
189
|
+
const tokenResponse = await oauth.use({
|
|
191
190
|
method: 'exchangeCode',
|
|
192
191
|
params: {
|
|
193
192
|
serviceName: 'google',
|
|
@@ -195,10 +194,11 @@ const { tokens } = await oauth.use({
|
|
|
195
194
|
}
|
|
196
195
|
});
|
|
197
196
|
|
|
197
|
+
const tokens = tokenResponse.result.data.tokens;
|
|
198
198
|
console.log(tokens.access_token); // Use for API calls
|
|
199
199
|
|
|
200
200
|
// Step 4: Get user info
|
|
201
|
-
const
|
|
201
|
+
const userInfoResponse = await oauth.use({
|
|
202
202
|
method: 'getUserInfo',
|
|
203
203
|
params: {
|
|
204
204
|
serviceName: 'google',
|
|
@@ -206,18 +206,20 @@ const { userInfo } = await oauth.use({
|
|
|
206
206
|
}
|
|
207
207
|
});
|
|
208
208
|
|
|
209
|
-
console.log(userInfo); // { email: "...", name: "...", ... }
|
|
209
|
+
console.log(userInfoResponse.result.data.userInfo); // { email: "...", name: "...", ... }
|
|
210
210
|
```
|
|
211
211
|
|
|
212
212
|
#### Token Management
|
|
213
213
|
|
|
214
214
|
```typescript
|
|
215
215
|
// Check stored tokens
|
|
216
|
-
const
|
|
216
|
+
const storedResponse = await oauth.use({
|
|
217
217
|
method: 'getStoredTokens',
|
|
218
218
|
params: { serviceName: 'google' }
|
|
219
219
|
});
|
|
220
220
|
|
|
221
|
+
const tokens = storedResponse.result.data.tokens;
|
|
222
|
+
|
|
221
223
|
// Refresh expired token
|
|
222
224
|
if (tokens.expires_in < 300) { // Less than 5 minutes left
|
|
223
225
|
const refreshed = await oauth.use({
|
|
@@ -227,7 +229,7 @@ if (tokens.expires_in < 300) { // Less than 5 minutes left
|
|
|
227
229
|
refreshToken: tokens.refresh_token
|
|
228
230
|
}
|
|
229
231
|
});
|
|
230
|
-
console.log(refreshed.tokens.access_token);
|
|
232
|
+
console.log(refreshed.result.data.tokens.access_token);
|
|
231
233
|
}
|
|
232
234
|
|
|
233
235
|
// Clear tokens on logout
|
|
@@ -291,7 +293,7 @@ const docEmbeddings = await embeddings.use({
|
|
|
291
293
|
}
|
|
292
294
|
});
|
|
293
295
|
|
|
294
|
-
console.log(docEmbeddings.result); // [[0.1, -0.2, ...], [...], [...]]
|
|
296
|
+
console.log(docEmbeddings.result.data); // [[0.1, -0.2, ...], [...], [...]]
|
|
295
297
|
|
|
296
298
|
// Embed a search query
|
|
297
299
|
const queryEmbedding = await embeddings.use({
|
|
@@ -301,7 +303,7 @@ const queryEmbedding = await embeddings.use({
|
|
|
301
303
|
}
|
|
302
304
|
});
|
|
303
305
|
|
|
304
|
-
console.log(queryEmbedding.result); // [0.05, -0.15, ...]
|
|
306
|
+
console.log(queryEmbedding.result.data); // [0.05, -0.15, ...]
|
|
305
307
|
```
|
|
306
308
|
|
|
307
309
|
#### Available Methods
|
|
@@ -313,55 +315,7 @@ console.log(queryEmbedding.result); // [0.05, -0.15, ...]
|
|
|
313
315
|
|
|
314
316
|
---
|
|
315
317
|
|
|
316
|
-
### 3.
|
|
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}
|
|
318
|
+
### 3. Vector Storage Tools {#vector-store}
|
|
365
319
|
|
|
366
320
|
Store and search document embeddings for semantic similarity search.
|
|
367
321
|
|
|
@@ -477,15 +431,13 @@ await app.start();
|
|
|
477
431
|
await initRegistryTools(app);
|
|
478
432
|
|
|
479
433
|
// All tools available as children:
|
|
480
|
-
// - o://app/
|
|
481
|
-
// - o://app/intelligence
|
|
434
|
+
// - o://app/intelligence
|
|
482
435
|
// - o://app/embeddings-text
|
|
483
436
|
// - o://app/vector-store
|
|
484
437
|
// - o://app/mcp
|
|
485
438
|
```
|
|
486
439
|
|
|
487
|
-
**Initialized Tools
|
|
488
|
-
- `NERTool` at `o://parent/ner`
|
|
440
|
+
**Initialized Tools** (4 tools):
|
|
489
441
|
- `IntelligenceTool` at `o://parent/intelligence`
|
|
490
442
|
- `HuggingfaceTextEmbeddingsTool` at `o://parent/embeddings-text`
|
|
491
443
|
- `LangchainMemoryVectorStoreTool` at `o://parent/vector-store`
|
|
@@ -628,7 +580,7 @@ class RAGApplication extends oLaneTool {
|
|
|
628
580
|
}
|
|
629
581
|
);
|
|
630
582
|
|
|
631
|
-
const context = searchResult.result
|
|
583
|
+
const context = searchResult.result.data
|
|
632
584
|
.map(doc => doc.pageContent)
|
|
633
585
|
.join('\n\n');
|
|
634
586
|
|
|
@@ -645,8 +597,8 @@ class RAGApplication extends oLaneTool {
|
|
|
645
597
|
|
|
646
598
|
return {
|
|
647
599
|
question,
|
|
648
|
-
answer: answer.result,
|
|
649
|
-
sources: searchResult.result.map(doc => doc.metadata)
|
|
600
|
+
answer: answer.result.data,
|
|
601
|
+
sources: searchResult.result.data.map(doc => doc.metadata)
|
|
650
602
|
};
|
|
651
603
|
}
|
|
652
604
|
}
|
|
@@ -685,7 +637,7 @@ Initialize all registry tools as child nodes of a parent.
|
|
|
685
637
|
**Returns:** `Promise<void>`
|
|
686
638
|
|
|
687
639
|
**Behavior:**
|
|
688
|
-
- Creates
|
|
640
|
+
- Creates 4 child nodes (Intelligence, Embeddings, Vector Store, MCP)
|
|
689
641
|
- Starts all tools automatically
|
|
690
642
|
- Registers tools with parent's hierarchy
|
|
691
643
|
|
|
@@ -693,7 +645,6 @@ Initialize all registry tools as child nodes of a parent.
|
|
|
693
645
|
```typescript
|
|
694
646
|
await initRegistryTools(myNode);
|
|
695
647
|
// Tools now available at:
|
|
696
|
-
// - o://my-node/ner
|
|
697
648
|
// - o://my-node/intelligence
|
|
698
649
|
// - o://my-node/embeddings-text
|
|
699
650
|
// - o://my-node/vector-store
|
|
@@ -715,9 +666,9 @@ await initRegistryTools(myNode);
|
|
|
715
666
|
┌────────────┼────────────┬──────────┐
|
|
716
667
|
⬇ ⬇ ⬇ ⬇
|
|
717
668
|
┌──────────────┐ ┌──────────┐ ┌───────────┐ ┌────────────┐
|
|
718
|
-
│
|
|
719
|
-
│ o://app/
|
|
720
|
-
│
|
|
669
|
+
│ Intelligence │ │ Embeddings│ │ Vector │ │ MCP Bridge │
|
|
670
|
+
│ o://app/ │ │ o://app/ │ │ Store │ │ o://app/ │
|
|
671
|
+
│ intelligence │ │ embeddings│ │ o://app/ │ │ mcp │
|
|
721
672
|
└──────────────┘ └──────────┘ │ vector- │ └────────────┘
|
|
722
673
|
│ store │
|
|
723
674
|
└───────────┘
|
|
@@ -737,17 +688,39 @@ await initRegistryTools(myNode);
|
|
|
737
688
|
└────────────────────────────────────────┘
|
|
738
689
|
```
|
|
739
690
|
|
|
691
|
+
---
|
|
692
|
+
|
|
693
|
+
## Response Structure {#response-structure}
|
|
694
|
+
|
|
695
|
+
All `use()` calls return responses following the standard Olane response wrapping pattern:
|
|
696
|
+
|
|
697
|
+
```typescript
|
|
698
|
+
const response = await tool.use({
|
|
699
|
+
method: 'some_method',
|
|
700
|
+
params: { ... }
|
|
701
|
+
});
|
|
702
|
+
|
|
703
|
+
// Response structure:
|
|
704
|
+
// {
|
|
705
|
+
// jsonrpc: "2.0",
|
|
706
|
+
// id: "request-id",
|
|
707
|
+
// result: {
|
|
708
|
+
// success: boolean, // Whether the operation succeeded
|
|
709
|
+
// data: any, // The returned data (on success)
|
|
710
|
+
// error?: string // Error details (on failure)
|
|
711
|
+
// }
|
|
712
|
+
// }
|
|
713
|
+
|
|
714
|
+
// Always check success before accessing data
|
|
715
|
+
if (response.result.success) {
|
|
716
|
+
const data = response.result.data;
|
|
717
|
+
console.log(data);
|
|
718
|
+
} else {
|
|
719
|
+
console.error('Error:', response.result.error);
|
|
720
|
+
}
|
|
740
721
|
```
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
│ (extracts entities) │
|
|
744
|
-
└────────────────────────────────────────┘
|
|
745
|
-
⬇ uses for LLM
|
|
746
|
-
┌────────────────────────────────────────┐
|
|
747
|
-
│ IntelligenceTool │
|
|
748
|
-
│ (from @olane/o-intelligence) │
|
|
749
|
-
└────────────────────────────────────────┘
|
|
750
|
-
```
|
|
722
|
+
|
|
723
|
+
> **Important**: Access data via `response.result.data`, not `response.result` directly. Always check `response.result.success` before accessing `response.result.data`.
|
|
751
724
|
|
|
752
725
|
---
|
|
753
726
|
|
|
@@ -759,7 +732,7 @@ await initRegistryTools(myNode);
|
|
|
759
732
|
|
|
760
733
|
**Solution**: Install all peer dependencies:
|
|
761
734
|
```bash
|
|
762
|
-
|
|
735
|
+
pnpm add @huggingface/transformers @langchain/community @langchain/core langchain
|
|
763
736
|
```
|
|
764
737
|
|
|
765
738
|
---
|
|
@@ -862,15 +835,14 @@ await embeddings.use({
|
|
|
862
835
|
|
|
863
836
|
### From Bundled Registry to Individual Packages
|
|
864
837
|
|
|
865
|
-
|
|
838
|
+
This package is already deprecated as of v0.8.0. Follow this guide to migrate:
|
|
866
839
|
|
|
867
840
|
#### Before (v0.7.x)
|
|
868
841
|
|
|
869
842
|
```typescript
|
|
870
|
-
import {
|
|
843
|
+
import {
|
|
871
844
|
OAuthTool,
|
|
872
|
-
HuggingfaceTextEmbeddingsTool
|
|
873
|
-
NERTool
|
|
845
|
+
HuggingfaceTextEmbeddingsTool
|
|
874
846
|
} from '@olane/o-tool-registry';
|
|
875
847
|
```
|
|
876
848
|
|
|
@@ -879,7 +851,6 @@ import {
|
|
|
879
851
|
```typescript
|
|
880
852
|
import { OAuthTool } from '@olane/o-tool-oauth';
|
|
881
853
|
import { HuggingfaceEmbeddingsTool } from '@olane/o-tool-embeddings-hf';
|
|
882
|
-
import { NERTool } from '@olane/o-tool-ner';
|
|
883
854
|
```
|
|
884
855
|
|
|
885
856
|
#### Update package.json
|
|
@@ -898,8 +869,7 @@ import { NERTool } from '@olane/o-tool-ner';
|
|
|
898
869
|
{
|
|
899
870
|
"dependencies": {
|
|
900
871
|
"@olane/o-tool-oauth": "^0.8.0",
|
|
901
|
-
"@olane/o-tool-embeddings-hf": "^0.8.0"
|
|
902
|
-
"@olane/o-tool-ner": "^0.8.0"
|
|
872
|
+
"@olane/o-tool-embeddings-hf": "^0.8.0"
|
|
903
873
|
}
|
|
904
874
|
}
|
|
905
875
|
```
|
|
@@ -962,9 +932,9 @@ ISC License - see LICENSE file for details.
|
|
|
962
932
|
|
|
963
933
|
| Version | Status | Notes |
|
|
964
934
|
|---------|--------|-------|
|
|
965
|
-
| **0.7.2** |
|
|
966
|
-
| **0.8.0** |
|
|
967
|
-
| **1.0.0** |
|
|
935
|
+
| **0.7.2** | Legacy | Last bundled release |
|
|
936
|
+
| **0.8.0** | Deprecated | Individual packages released, NER tool removed |
|
|
937
|
+
| **1.0.0** | Planned | Registry fully removed |
|
|
968
938
|
|
|
969
939
|
---
|
|
970
940
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olane/o-tool-registry",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -57,17 +57,17 @@
|
|
|
57
57
|
"@huggingface/transformers": "^3.5.2",
|
|
58
58
|
"@langchain/community": "0.3.47",
|
|
59
59
|
"@langchain/core": "0.3.61",
|
|
60
|
-
"@olane/o-config": "0.8.
|
|
61
|
-
"@olane/o-core": "0.8.
|
|
62
|
-
"@olane/o-intelligence": "0.8.
|
|
63
|
-
"@olane/o-lane": "0.8.
|
|
64
|
-
"@olane/o-mcp": "0.8.
|
|
65
|
-
"@olane/o-protocol": "0.8.
|
|
66
|
-
"@olane/o-tool": "0.8.
|
|
67
|
-
"@olane/o-tools-common": "0.8.
|
|
60
|
+
"@olane/o-config": "0.8.4",
|
|
61
|
+
"@olane/o-core": "0.8.4",
|
|
62
|
+
"@olane/o-intelligence": "0.8.4",
|
|
63
|
+
"@olane/o-lane": "0.8.4",
|
|
64
|
+
"@olane/o-mcp": "0.8.4",
|
|
65
|
+
"@olane/o-protocol": "0.8.4",
|
|
66
|
+
"@olane/o-tool": "0.8.4",
|
|
67
|
+
"@olane/o-tools-common": "0.8.4",
|
|
68
68
|
"debug": "^4.4.1",
|
|
69
69
|
"dotenv": "^16.5.0",
|
|
70
70
|
"langchain": "0.3.29"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "b53623b1ad4365133911722f80d5597a72b65bf2"
|
|
73
73
|
}
|