@olane/o-tool-registry 0.6.12 → 0.7.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/README.md +0 -253
- package/dist/auth/index.d.ts +4 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +3 -0
- package/dist/auth/interfaces/index.d.ts +4 -0
- package/dist/auth/interfaces/index.d.ts.map +1 -0
- package/dist/auth/interfaces/index.js +3 -0
- package/dist/auth/interfaces/oAuth-tokens.interface.d.ts +9 -0
- package/dist/auth/interfaces/oAuth-tokens.interface.d.ts.map +1 -0
- package/dist/auth/interfaces/oAuth-tokens.interface.js +1 -0
- package/dist/auth/interfaces/oAuth-user-info.interface.d.ts +8 -0
- package/dist/auth/interfaces/oAuth-user-info.interface.d.ts.map +1 -0
- package/dist/auth/interfaces/oAuth-user-info.interface.js +1 -0
- package/dist/auth/interfaces/oAuth.config.d.ts +14 -0
- package/dist/auth/interfaces/oAuth.config.d.ts.map +1 -0
- package/dist/auth/interfaces/oAuth.config.js +1 -0
- package/dist/auth/methods/auth.methods.d.ts +5 -0
- package/dist/auth/methods/auth.methods.d.ts.map +1 -0
- package/dist/auth/methods/auth.methods.js +302 -0
- package/dist/auth/oAuth.tool.d.ts +20 -0
- package/dist/auth/oAuth.tool.d.ts.map +1 -0
- package/dist/auth/oAuth.tool.js +419 -0
- package/dist/embeddings/embeddings.tool.d.ts +6 -0
- package/dist/embeddings/embeddings.tool.d.ts.map +1 -0
- package/dist/embeddings/embeddings.tool.js +11 -0
- package/dist/embeddings/huggingface-text-embeddings.tool.d.ts +9 -0
- package/dist/embeddings/huggingface-text-embeddings.tool.d.ts.map +1 -0
- package/dist/embeddings/huggingface-text-embeddings.tool.js +21 -0
- package/dist/embeddings/index.d.ts +4 -0
- package/dist/embeddings/index.d.ts.map +1 -0
- package/dist/embeddings/index.js +3 -0
- package/dist/embeddings/methods/text-embeddings.method.d.ts +5 -0
- package/dist/embeddings/methods/text-embeddings.method.d.ts.map +1 -0
- package/dist/embeddings/methods/text-embeddings.method.js +29 -0
- package/dist/embeddings/text-embeddings.tool.d.ts +9 -0
- package/dist/embeddings/text-embeddings.tool.d.ts.map +1 -0
- package/dist/embeddings/text-embeddings.tool.js +13 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/init.d.ts +3 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +36 -0
- package/dist/intelligence/anthropic-intelligence.tool.d.ts +224 -0
- package/dist/intelligence/anthropic-intelligence.tool.d.ts.map +1 -0
- package/dist/intelligence/anthropic-intelligence.tool.js +477 -0
- package/dist/intelligence/gemini-intelligence.tool.d.ts +29 -0
- package/dist/intelligence/gemini-intelligence.tool.d.ts.map +1 -0
- package/dist/intelligence/gemini-intelligence.tool.js +267 -0
- package/dist/intelligence/index.d.ts +6 -0
- package/dist/intelligence/index.d.ts.map +1 -0
- package/dist/intelligence/index.js +5 -0
- package/dist/intelligence/intelligence.tool.d.ts +11 -0
- package/dist/intelligence/intelligence.tool.d.ts.map +1 -0
- package/dist/intelligence/intelligence.tool.js +120 -0
- package/dist/intelligence/methods/intelligence.methods.d.ts +5 -0
- package/dist/intelligence/methods/intelligence.methods.d.ts.map +1 -0
- package/dist/intelligence/methods/intelligence.methods.js +98 -0
- package/dist/intelligence/ollama-intelligence.tool.d.ts +36 -0
- package/dist/intelligence/ollama-intelligence.tool.d.ts.map +1 -0
- package/dist/intelligence/ollama-intelligence.tool.js +312 -0
- package/dist/intelligence/openai-intelligence.tool.d.ts +30 -0
- package/dist/intelligence/openai-intelligence.tool.d.ts.map +1 -0
- package/dist/intelligence/openai-intelligence.tool.js +255 -0
- package/dist/intelligence/perplexity-intelligence.tool.d.ts +27 -0
- package/dist/intelligence/perplexity-intelligence.tool.d.ts.map +1 -0
- package/dist/intelligence/perplexity-intelligence.tool.js +309 -0
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +2 -0
- package/dist/mcp/mcp-bridge.tool.d.ts +12 -0
- package/dist/mcp/mcp-bridge.tool.d.ts.map +1 -0
- package/dist/mcp/mcp-bridge.tool.js +126 -0
- package/dist/mcp/mcp.tool.d.ts +14 -0
- package/dist/mcp/mcp.tool.d.ts.map +1 -0
- package/dist/mcp/mcp.tool.js +83 -0
- package/dist/mcp/methods/mcp-bridge.methods.d.ts +5 -0
- package/dist/mcp/methods/mcp-bridge.methods.d.ts.map +1 -0
- package/dist/mcp/methods/mcp-bridge.methods.js +79 -0
- package/dist/nlp/index.d.ts +2 -0
- package/dist/nlp/index.d.ts.map +1 -0
- package/dist/nlp/index.js +1 -0
- package/dist/nlp/methods/nlp.methods.d.ts +5 -0
- package/dist/nlp/methods/nlp.methods.d.ts.map +1 -0
- package/dist/nlp/methods/nlp.methods.js +15 -0
- package/dist/nlp/ner.tool.d.ts +7 -0
- package/dist/nlp/ner.tool.d.ts.map +1 -0
- package/dist/nlp/ner.tool.js +25 -0
- package/dist/src/auth/oAuth.tool.d.ts +4 -3
- package/dist/src/auth/oAuth.tool.d.ts.map +1 -1
- package/dist/src/auth/oAuth.tool.js +2 -2
- package/dist/src/embeddings/embeddings.tool.d.ts +4 -4
- package/dist/src/embeddings/embeddings.tool.d.ts.map +1 -1
- package/dist/src/embeddings/embeddings.tool.js +2 -2
- package/dist/src/embeddings/text-embeddings.tool.d.ts +4 -4
- package/dist/src/embeddings/text-embeddings.tool.d.ts.map +1 -1
- package/dist/src/embeddings/text-embeddings.tool.js +2 -2
- package/dist/src/init.d.ts +2 -2
- package/dist/src/init.d.ts.map +1 -1
- package/dist/src/init.js +8 -4
- 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/ner.tool.d.ts +5 -3
- package/dist/src/nlp/ner.tool.d.ts.map +1 -1
- package/dist/src/nlp/ner.tool.js +2 -2
- package/dist/src/vector-store/langchain-memory.vector-store.tool.d.ts +2 -2
- package/dist/src/vector-store/langchain-memory.vector-store.tool.d.ts.map +1 -1
- package/dist/src/vector-store/vector-memory.tool.d.ts +5 -4
- package/dist/src/vector-store/vector-memory.tool.d.ts.map +1 -1
- package/dist/src/vector-store/vector-memory.tool.js +2 -2
- package/dist/vector-store/index.d.ts +3 -0
- package/dist/vector-store/index.d.ts.map +1 -0
- package/dist/vector-store/index.js +2 -0
- package/dist/vector-store/langchain-memory.vector-store.tool.d.ts +14 -0
- package/dist/vector-store/langchain-memory.vector-store.tool.d.ts.map +1 -0
- package/dist/vector-store/langchain-memory.vector-store.tool.js +60 -0
- package/dist/vector-store/methods/vector-store.methods.d.ts +5 -0
- package/dist/vector-store/methods/vector-store.methods.d.ts.map +1 -0
- package/dist/vector-store/methods/vector-store.methods.js +60 -0
- package/dist/vector-store/vector-memory.tool.d.ts +11 -0
- package/dist/vector-store/vector-memory.tool.d.ts.map +1 -0
- package/dist/vector-store/vector-memory.tool.js +13 -0
- package/package.json +9 -8
package/README.md
CHANGED
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
# o-Tool Registry
|
|
2
|
-
|
|
3
|
-
A registry of tools for the oLane network, including the OllamaIntelligenceTool for interacting with local Ollama instances.
|
|
4
|
-
|
|
5
|
-
## OllamaIntelligenceTool
|
|
6
|
-
|
|
7
|
-
The `OllamaIntelligenceTool` provides a comprehensive API interface to interact with a local Ollama instance. It supports chat completion, text generation, model management, and server status monitoring.
|
|
8
|
-
|
|
9
|
-
### Features
|
|
10
|
-
|
|
11
|
-
- **Chat Completion**: Multi-turn conversations with Ollama models
|
|
12
|
-
- **Text Generation**: Single-prompt text generation
|
|
13
|
-
- **Model Management**: List, pull, delete, and get information about models
|
|
14
|
-
- **Server Status**: Check if Ollama server is running
|
|
15
|
-
- **Configurable**: Customizable base URL and default model
|
|
16
|
-
|
|
17
|
-
### Configuration
|
|
18
|
-
|
|
19
|
-
The tool accepts the following configuration options:
|
|
20
|
-
|
|
21
|
-
```typescript
|
|
22
|
-
{
|
|
23
|
-
ollamaUrl: 'http://localhost:11434', // Default Ollama server URL
|
|
24
|
-
defaultModel: 'llama2' // Default model to use
|
|
25
|
-
}
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### Available Methods
|
|
29
|
-
|
|
30
|
-
#### 1. `completion` - Chat Completion
|
|
31
|
-
|
|
32
|
-
Performs chat completion with a conversation history.
|
|
33
|
-
|
|
34
|
-
**Parameters:**
|
|
35
|
-
- `model` (string, optional): Model name to use (defaults to configured default)
|
|
36
|
-
- `messages` (array, required): Array of chat messages with role and content
|
|
37
|
-
- `options` (object, optional): Generation options (temperature, top_p, etc.)
|
|
38
|
-
|
|
39
|
-
**Example:**
|
|
40
|
-
```json
|
|
41
|
-
{
|
|
42
|
-
"method": "completion",
|
|
43
|
-
"params": {
|
|
44
|
-
"model": "llama2",
|
|
45
|
-
"messages": [
|
|
46
|
-
{"role": "system", "content": "You are a helpful assistant."},
|
|
47
|
-
{"role": "user", "content": "What is the capital of France?"}
|
|
48
|
-
],
|
|
49
|
-
"options": {
|
|
50
|
-
"temperature": 0.7,
|
|
51
|
-
"top_p": 0.9
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
#### 2. `generate` - Text Generation
|
|
58
|
-
|
|
59
|
-
Generates text from a single prompt.
|
|
60
|
-
|
|
61
|
-
**Parameters:**
|
|
62
|
-
- `model` (string, optional): Model name to use (defaults to configured default)
|
|
63
|
-
- `prompt` (string, required): Text prompt for generation
|
|
64
|
-
- `system` (string, optional): System prompt
|
|
65
|
-
- `options` (object, optional): Generation options
|
|
66
|
-
|
|
67
|
-
**Example:**
|
|
68
|
-
```json
|
|
69
|
-
{
|
|
70
|
-
"method": "generate",
|
|
71
|
-
"params": {
|
|
72
|
-
"model": "llama2",
|
|
73
|
-
"prompt": "Write a short story about a robot learning to paint.",
|
|
74
|
-
"system": "You are a creative writing assistant.",
|
|
75
|
-
"options": {
|
|
76
|
-
"temperature": 0.8,
|
|
77
|
-
"num_predict": 200
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
#### 3. `list_models` - List Available Models
|
|
84
|
-
|
|
85
|
-
Lists all available models on the Ollama server.
|
|
86
|
-
|
|
87
|
-
**Parameters:** None
|
|
88
|
-
|
|
89
|
-
**Example:**
|
|
90
|
-
```json
|
|
91
|
-
{
|
|
92
|
-
"method": "list_models",
|
|
93
|
-
"params": {}
|
|
94
|
-
}
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
#### 4. `pull_model` - Pull a Model
|
|
98
|
-
|
|
99
|
-
Downloads a model from the Ollama library.
|
|
100
|
-
|
|
101
|
-
**Parameters:**
|
|
102
|
-
- `model` (string, required): Model name to pull
|
|
103
|
-
- `insecure` (boolean, optional): Allow insecure registry connections (default: false)
|
|
104
|
-
|
|
105
|
-
**Example:**
|
|
106
|
-
```json
|
|
107
|
-
{
|
|
108
|
-
"method": "pull_model",
|
|
109
|
-
"params": {
|
|
110
|
-
"model": "llama2:7b",
|
|
111
|
-
"insecure": false
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
#### 5. `delete_model` - Delete a Model
|
|
117
|
-
|
|
118
|
-
Removes a model from the local Ollama installation.
|
|
119
|
-
|
|
120
|
-
**Parameters:**
|
|
121
|
-
- `model` (string, required): Model name to delete
|
|
122
|
-
|
|
123
|
-
**Example:**
|
|
124
|
-
```json
|
|
125
|
-
{
|
|
126
|
-
"method": "delete_model",
|
|
127
|
-
"params": {
|
|
128
|
-
"model": "llama2:7b"
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
#### 6. `model_info` - Get Model Information
|
|
134
|
-
|
|
135
|
-
Retrieves detailed information about a specific model.
|
|
136
|
-
|
|
137
|
-
**Parameters:**
|
|
138
|
-
- `model` (string, optional): Model name (defaults to configured default)
|
|
139
|
-
|
|
140
|
-
**Example:**
|
|
141
|
-
```json
|
|
142
|
-
{
|
|
143
|
-
"method": "model_info",
|
|
144
|
-
"params": {
|
|
145
|
-
"model": "llama2"
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
#### 7. `status` - Check Server Status
|
|
151
|
-
|
|
152
|
-
Checks if the Ollama server is running and accessible.
|
|
153
|
-
|
|
154
|
-
**Parameters:** None
|
|
155
|
-
|
|
156
|
-
**Example:**
|
|
157
|
-
```json
|
|
158
|
-
{
|
|
159
|
-
"method": "status",
|
|
160
|
-
"params": {}
|
|
161
|
-
}
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
### Generation Options
|
|
165
|
-
|
|
166
|
-
All generation methods support the following options:
|
|
167
|
-
|
|
168
|
-
- `temperature` (number): Controls randomness (0.0 to 1.0)
|
|
169
|
-
- `top_p` (number): Nucleus sampling parameter (0.0 to 1.0)
|
|
170
|
-
- `top_k` (number): Top-k sampling parameter
|
|
171
|
-
- `num_predict` (number): Maximum number of tokens to generate
|
|
172
|
-
- `stop` (array): Array of strings to stop generation
|
|
173
|
-
- `seed` (number): Random seed for reproducible results
|
|
174
|
-
- `num_ctx` (number): Context window size
|
|
175
|
-
- `num_gpu` (number): Number of GPUs to use
|
|
176
|
-
- `num_thread` (number): Number of CPU threads to use
|
|
177
|
-
- `repeat_penalty` (number): Penalty for repeating tokens
|
|
178
|
-
- `repeat_last_n` (number): Number of tokens to consider for repetition penalty
|
|
179
|
-
- `tfs_z` (number): Tail free sampling parameter
|
|
180
|
-
- `mirostat` (number): Mirostat sampling algorithm (0, 1, or 2)
|
|
181
|
-
- `mirostat_tau` (number): Mirostat target entropy
|
|
182
|
-
- `mirostat_eta` (number): Mirostat learning rate
|
|
183
|
-
- `penalize_newline` (boolean): Penalize newline tokens
|
|
184
|
-
- `presence_penalty` (number): Presence penalty
|
|
185
|
-
- `frequency_penalty` (number): Frequency penalty
|
|
186
|
-
|
|
187
|
-
### Response Format
|
|
188
|
-
|
|
189
|
-
All methods return a `ToolResult` object with the following structure:
|
|
190
|
-
|
|
191
|
-
**Success Response:**
|
|
192
|
-
```json
|
|
193
|
-
{
|
|
194
|
-
"success": true,
|
|
195
|
-
"response": "Generated text content",
|
|
196
|
-
"model": "model_name",
|
|
197
|
-
"done": true,
|
|
198
|
-
"total_duration": 1234,
|
|
199
|
-
"eval_count": 50,
|
|
200
|
-
"eval_duration": 1000
|
|
201
|
-
}
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
**Error Response:**
|
|
205
|
-
```json
|
|
206
|
-
{
|
|
207
|
-
"success": false,
|
|
208
|
-
"error": "Error description"
|
|
209
|
-
}
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
### Prerequisites
|
|
213
|
-
|
|
214
|
-
1. **Ollama Installation**: Make sure Ollama is installed and running locally
|
|
215
|
-
2. **Model Availability**: Ensure the required models are available or can be pulled
|
|
216
|
-
3. **Network Access**: The tool needs network access to pull models from the Ollama library
|
|
217
|
-
|
|
218
|
-
### Getting Started
|
|
219
|
-
|
|
220
|
-
1. Start your Ollama server:
|
|
221
|
-
```bash
|
|
222
|
-
ollama serve
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
2. Pull a model (if not already available):
|
|
226
|
-
```bash
|
|
227
|
-
ollama pull llama2
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
3. Use the tool through the oLane network with the appropriate method calls.
|
|
231
|
-
|
|
232
|
-
### Error Handling
|
|
233
|
-
|
|
234
|
-
The tool provides comprehensive error handling for:
|
|
235
|
-
- Network connectivity issues
|
|
236
|
-
- Invalid model names
|
|
237
|
-
- Missing required parameters
|
|
238
|
-
- Ollama server errors
|
|
239
|
-
- Model availability issues
|
|
240
|
-
|
|
241
|
-
### Performance Considerations
|
|
242
|
-
|
|
243
|
-
- **Streaming**: The tool currently uses non-streaming responses for simplicity
|
|
244
|
-
- **Timeout**: Consider setting appropriate timeouts for long-running operations
|
|
245
|
-
- **Memory**: Large models may require significant memory resources
|
|
246
|
-
- **GPU**: Enable GPU acceleration in Ollama for better performance
|
|
247
|
-
|
|
248
|
-
### Security Notes
|
|
249
|
-
|
|
250
|
-
- The tool connects to localhost by default for security
|
|
251
|
-
- Use HTTPS when connecting to remote Ollama instances
|
|
252
|
-
- Be cautious with the `insecure` flag when pulling models
|
|
253
|
-
- Validate all input parameters before processing
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oAuth-tokens.interface.d.ts","sourceRoot":"","sources":["../../../src/auth/interfaces/oAuth-tokens.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oAuth-user-info.interface.d.ts","sourceRoot":"","sources":["../../../src/auth/interfaces/oAuth-user-info.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface OAuthConfig {
|
|
2
|
+
clientId: string;
|
|
3
|
+
clientSecret?: string;
|
|
4
|
+
redirectUri: string;
|
|
5
|
+
authorizationUrl: string;
|
|
6
|
+
tokenUrl: string;
|
|
7
|
+
userInfoUrl?: string;
|
|
8
|
+
scope?: string;
|
|
9
|
+
responseType?: 'code' | 'token';
|
|
10
|
+
grantType?: 'authorization_code' | 'client_credentials' | 'refresh_token';
|
|
11
|
+
tokenValidationUrl?: string;
|
|
12
|
+
tokenRevocationUrl?: string;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=oAuth.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oAuth.config.d.ts","sourceRoot":"","sources":["../../../src/auth/interfaces/oAuth.config.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,SAAS,CAAC,EAAE,oBAAoB,GAAG,oBAAoB,GAAG,eAAe,CAAC;IAC1E,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.methods.d.ts","sourceRoot":"","sources":["../../../src/auth/methods/auth.methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,eAAO,MAAM,YAAY,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAwTlD,CAAC"}
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
export const oauthMethods = {
|
|
2
|
+
configure: {
|
|
3
|
+
name: 'configure',
|
|
4
|
+
description: 'Configure OAuth service settings',
|
|
5
|
+
dependencies: [],
|
|
6
|
+
parameters: [
|
|
7
|
+
{
|
|
8
|
+
name: 'serviceName',
|
|
9
|
+
type: 'string',
|
|
10
|
+
value: 'string',
|
|
11
|
+
description: 'Name of the OAuth service (e.g., myapp-auth, custom-provider)',
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'clientId',
|
|
16
|
+
type: 'string',
|
|
17
|
+
value: 'string',
|
|
18
|
+
description: 'OAuth client ID from your service',
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'clientSecret',
|
|
23
|
+
type: 'string',
|
|
24
|
+
value: 'string',
|
|
25
|
+
description: 'OAuth client secret (optional for public clients)',
|
|
26
|
+
required: false,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'redirectUri',
|
|
30
|
+
type: 'string',
|
|
31
|
+
value: 'string',
|
|
32
|
+
description: 'OAuth redirect URI registered with your service',
|
|
33
|
+
required: true,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'authorizationUrl',
|
|
37
|
+
type: 'string',
|
|
38
|
+
value: 'string',
|
|
39
|
+
description: 'OAuth authorization endpoint URL from your service',
|
|
40
|
+
required: true,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'tokenUrl',
|
|
44
|
+
type: 'string',
|
|
45
|
+
value: 'string',
|
|
46
|
+
description: 'OAuth token endpoint URL from your service',
|
|
47
|
+
required: true,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'userInfoUrl',
|
|
51
|
+
type: 'string',
|
|
52
|
+
value: 'string',
|
|
53
|
+
description: 'User info endpoint URL from your service',
|
|
54
|
+
required: false,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'scope',
|
|
58
|
+
type: 'string',
|
|
59
|
+
value: 'string',
|
|
60
|
+
description: 'OAuth scope (default: openid profile email)',
|
|
61
|
+
required: false,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'responseType',
|
|
65
|
+
type: 'string',
|
|
66
|
+
value: 'string',
|
|
67
|
+
description: 'OAuth response type (default: code)',
|
|
68
|
+
required: false,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'grantType',
|
|
72
|
+
type: 'string',
|
|
73
|
+
value: 'string',
|
|
74
|
+
description: 'OAuth grant type (default: authorization_code)',
|
|
75
|
+
required: false,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'tokenValidationUrl',
|
|
79
|
+
type: 'string',
|
|
80
|
+
value: 'string',
|
|
81
|
+
description: 'Token validation endpoint URL from your service',
|
|
82
|
+
required: false,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'tokenRevocationUrl',
|
|
86
|
+
type: 'string',
|
|
87
|
+
value: 'string',
|
|
88
|
+
description: 'Token revocation endpoint URL from your service',
|
|
89
|
+
required: false,
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
getAuthorizationUrl: {
|
|
94
|
+
name: 'getAuthorizationUrl',
|
|
95
|
+
description: 'Get OAuth authorization URL',
|
|
96
|
+
dependencies: [],
|
|
97
|
+
parameters: [
|
|
98
|
+
{
|
|
99
|
+
name: 'serviceName',
|
|
100
|
+
type: 'string',
|
|
101
|
+
value: 'string',
|
|
102
|
+
description: 'Name of the OAuth service',
|
|
103
|
+
required: true,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'state',
|
|
107
|
+
type: 'string',
|
|
108
|
+
value: 'string',
|
|
109
|
+
description: 'OAuth state parameter for CSRF protection',
|
|
110
|
+
required: false,
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: 'scope',
|
|
114
|
+
type: 'string',
|
|
115
|
+
value: 'string',
|
|
116
|
+
description: 'Override default scope',
|
|
117
|
+
required: false,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: 'additionalParams',
|
|
121
|
+
type: 'object',
|
|
122
|
+
value: 'object',
|
|
123
|
+
description: 'Additional query parameters to include in authorization URL',
|
|
124
|
+
required: false,
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
exchangeCode: {
|
|
129
|
+
name: 'exchangeCode',
|
|
130
|
+
description: 'Exchange authorization code for access token',
|
|
131
|
+
dependencies: [],
|
|
132
|
+
parameters: [
|
|
133
|
+
{
|
|
134
|
+
name: 'serviceName',
|
|
135
|
+
type: 'string',
|
|
136
|
+
value: 'string',
|
|
137
|
+
description: 'Name of the OAuth service',
|
|
138
|
+
required: true,
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
name: 'code',
|
|
142
|
+
type: 'string',
|
|
143
|
+
value: 'string',
|
|
144
|
+
description: 'Authorization code from OAuth callback',
|
|
145
|
+
required: true,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: 'state',
|
|
149
|
+
type: 'string',
|
|
150
|
+
value: 'string',
|
|
151
|
+
description: 'OAuth state parameter',
|
|
152
|
+
required: false,
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
},
|
|
156
|
+
refreshToken: {
|
|
157
|
+
name: 'refreshToken',
|
|
158
|
+
description: 'Refresh access token using refresh token',
|
|
159
|
+
dependencies: [],
|
|
160
|
+
parameters: [
|
|
161
|
+
{
|
|
162
|
+
name: 'serviceName',
|
|
163
|
+
type: 'string',
|
|
164
|
+
value: 'string',
|
|
165
|
+
description: 'Name of the OAuth service',
|
|
166
|
+
required: true,
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: 'refreshToken',
|
|
170
|
+
type: 'string',
|
|
171
|
+
value: 'string',
|
|
172
|
+
description: 'Refresh token to exchange for new access token',
|
|
173
|
+
required: true,
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
},
|
|
177
|
+
getUserInfo: {
|
|
178
|
+
name: 'getUserInfo',
|
|
179
|
+
description: 'Get user information using access token',
|
|
180
|
+
dependencies: [],
|
|
181
|
+
parameters: [
|
|
182
|
+
{
|
|
183
|
+
name: 'serviceName',
|
|
184
|
+
type: 'string',
|
|
185
|
+
value: 'string',
|
|
186
|
+
description: 'Name of the OAuth service',
|
|
187
|
+
required: true,
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: 'accessToken',
|
|
191
|
+
type: 'string',
|
|
192
|
+
value: 'string',
|
|
193
|
+
description: 'Access token to use for user info request',
|
|
194
|
+
required: true,
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
name: 'userInfoUrl',
|
|
198
|
+
type: 'string',
|
|
199
|
+
value: 'string',
|
|
200
|
+
description: 'Override default user info URL',
|
|
201
|
+
required: false,
|
|
202
|
+
},
|
|
203
|
+
],
|
|
204
|
+
},
|
|
205
|
+
validateToken: {
|
|
206
|
+
name: 'validateToken',
|
|
207
|
+
description: 'Validate access token',
|
|
208
|
+
dependencies: [],
|
|
209
|
+
parameters: [
|
|
210
|
+
{
|
|
211
|
+
name: 'serviceName',
|
|
212
|
+
type: 'string',
|
|
213
|
+
value: 'string',
|
|
214
|
+
description: 'Name of the OAuth service',
|
|
215
|
+
required: true,
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
name: 'accessToken',
|
|
219
|
+
type: 'string',
|
|
220
|
+
value: 'string',
|
|
221
|
+
description: 'Access token to validate',
|
|
222
|
+
required: true,
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: 'tokenValidationUrl',
|
|
226
|
+
type: 'string',
|
|
227
|
+
value: 'string',
|
|
228
|
+
description: 'Override default token validation URL',
|
|
229
|
+
required: false,
|
|
230
|
+
},
|
|
231
|
+
],
|
|
232
|
+
},
|
|
233
|
+
revokeToken: {
|
|
234
|
+
name: 'revokeToken',
|
|
235
|
+
description: 'Revoke access or refresh token',
|
|
236
|
+
dependencies: [],
|
|
237
|
+
parameters: [
|
|
238
|
+
{
|
|
239
|
+
name: 'serviceName',
|
|
240
|
+
type: 'string',
|
|
241
|
+
value: 'string',
|
|
242
|
+
description: 'Name of the OAuth service',
|
|
243
|
+
required: true,
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
name: 'token',
|
|
247
|
+
type: 'string',
|
|
248
|
+
value: 'string',
|
|
249
|
+
description: 'Token to revoke (access or refresh token)',
|
|
250
|
+
required: true,
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
name: 'tokenType',
|
|
254
|
+
type: 'string',
|
|
255
|
+
value: 'string',
|
|
256
|
+
description: 'Type of token to revoke (access_token or refresh_token)',
|
|
257
|
+
required: false,
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
name: 'tokenRevocationUrl',
|
|
261
|
+
type: 'string',
|
|
262
|
+
value: 'string',
|
|
263
|
+
description: 'Override default token revocation URL',
|
|
264
|
+
required: false,
|
|
265
|
+
},
|
|
266
|
+
],
|
|
267
|
+
},
|
|
268
|
+
listServices: {
|
|
269
|
+
name: 'listServices',
|
|
270
|
+
description: 'List all configured OAuth services',
|
|
271
|
+
dependencies: [],
|
|
272
|
+
parameters: [],
|
|
273
|
+
},
|
|
274
|
+
getStoredTokens: {
|
|
275
|
+
name: 'getStoredTokens',
|
|
276
|
+
description: 'Get stored tokens for OAuth service',
|
|
277
|
+
dependencies: [],
|
|
278
|
+
parameters: [
|
|
279
|
+
{
|
|
280
|
+
name: 'serviceName',
|
|
281
|
+
type: 'string',
|
|
282
|
+
value: 'string',
|
|
283
|
+
description: 'Name of the OAuth service (if not provided, returns all)',
|
|
284
|
+
required: false,
|
|
285
|
+
},
|
|
286
|
+
],
|
|
287
|
+
},
|
|
288
|
+
clearTokens: {
|
|
289
|
+
name: 'clearTokens',
|
|
290
|
+
description: 'Clear stored tokens for OAuth service',
|
|
291
|
+
dependencies: [],
|
|
292
|
+
parameters: [
|
|
293
|
+
{
|
|
294
|
+
name: 'serviceName',
|
|
295
|
+
type: 'string',
|
|
296
|
+
value: 'string',
|
|
297
|
+
description: 'Name of the OAuth service (if not provided, clears all)',
|
|
298
|
+
required: false,
|
|
299
|
+
},
|
|
300
|
+
],
|
|
301
|
+
},
|
|
302
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { oToolConfig, oVirtualTool } from '@olane/o-tool';
|
|
2
|
+
export declare class OAuthTool extends oVirtualTool {
|
|
3
|
+
private oauthConfigs;
|
|
4
|
+
private tokenStore;
|
|
5
|
+
constructor(config: oToolConfig);
|
|
6
|
+
_tool_configure(request: any): Promise<any>;
|
|
7
|
+
_tool_getAuthorizationUrl(request: any): Promise<any>;
|
|
8
|
+
_tool_exchangeCode(request: any): Promise<any>;
|
|
9
|
+
_tool_refreshToken(request: any): Promise<any>;
|
|
10
|
+
_tool_getUserInfo(request: any): Promise<any>;
|
|
11
|
+
_tool_validateToken(request: any): Promise<any>;
|
|
12
|
+
_tool_revokeToken(request: any): Promise<any>;
|
|
13
|
+
_tool_listServices(request: any): Promise<any>;
|
|
14
|
+
_tool_getStoredTokens(request: any): Promise<any>;
|
|
15
|
+
_tool_clearTokens(request: any): Promise<any>;
|
|
16
|
+
private generateCodeVerifier;
|
|
17
|
+
private generateCodeChallenge;
|
|
18
|
+
private base64URLEncode;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=oAuth.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oAuth.tool.d.ts","sourceRoot":"","sources":["../../src/auth/oAuth.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAO1D,qBAAa,SAAU,SAAQ,YAAY;IACzC,OAAO,CAAC,YAAY,CAAuC;IAC3D,OAAO,CAAC,UAAU,CAAuC;gBAE7C,MAAM,EAAE,WAAW;IAWzB,eAAe,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAuC3C,yBAAyB,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAqDrD,kBAAkB,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAuE9C,kBAAkB,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAuE9C,iBAAiB,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAgD7C,mBAAmB,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAgD/C,iBAAiB,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAoF7C,kBAAkB,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAU9C,qBAAqB,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAyCjD,iBAAiB,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IA4BnD,OAAO,CAAC,oBAAoB;YAMd,qBAAqB;IAOnC,OAAO,CAAC,eAAe;CAMxB"}
|