@olane/o-tool 0.3.9 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/interfaces/run-params.interface.d.ts +4 -0
- package/dist/interfaces/run-params.interface.d.ts.map +1 -0
- package/dist/interfaces/run-params.interface.js +1 -0
- package/dist/interfaces/run-result.interface.d.ts +4 -0
- package/dist/interfaces/run-result.interface.d.ts.map +1 -0
- package/dist/interfaces/run-result.interface.js +1 -0
- package/dist/interfaces/run-tool.interface.d.ts +6 -0
- package/dist/interfaces/run-tool.interface.d.ts.map +1 -0
- package/dist/interfaces/run-tool.interface.js +1 -0
- package/dist/interfaces/tool-result.interface.d.ts +4 -0
- package/dist/interfaces/tool-result.interface.d.ts.map +1 -0
- package/dist/interfaces/tool-result.interface.js +1 -0
- package/dist/interfaces/tool.interface.d.ts +4 -0
- package/dist/interfaces/tool.interface.d.ts.map +1 -0
- package/dist/interfaces/tool.interface.js +1 -0
- package/dist/o-tool.d.ts +8 -0
- package/dist/o-tool.d.ts.map +1 -0
- package/dist/o-tool.js +284 -0
- package/dist/src/nodes/client.node.d.ts +1 -1
- package/dist/src/nodes/client.node.d.ts.map +1 -1
- package/dist/src/nodes/client.node.js +1 -1
- package/dist/tool.utils.d.ts +6 -0
- package/dist/tool.utils.d.ts.map +1 -0
- package/dist/tool.utils.js +17 -0
- package/dist/virtual.tool.d.ts +10 -0
- package/dist/virtual.tool.d.ts.map +1 -0
- package/dist/virtual.tool.js +7 -0
- package/package.json +7 -7
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './o-tool.js';
|
|
2
|
+
export * from './interfaces/tool.interface.js';
|
|
3
|
+
export * from './interfaces/run-result.interface.js';
|
|
4
|
+
export * from './interfaces/run-params.interface.js';
|
|
5
|
+
export * from './interfaces/run-tool.interface.js';
|
|
6
|
+
export * from './interfaces/tool-result.interface.js';
|
|
7
|
+
export * from './tool.utils.js';
|
|
8
|
+
export * from './virtual.tool.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC;AACtD,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './o-tool.js';
|
|
2
|
+
export * from './interfaces/tool.interface.js';
|
|
3
|
+
export * from './interfaces/run-result.interface.js';
|
|
4
|
+
export * from './interfaces/run-params.interface.js';
|
|
5
|
+
export * from './interfaces/run-tool.interface.js';
|
|
6
|
+
export * from './interfaces/tool-result.interface.js';
|
|
7
|
+
export * from './tool.utils.js';
|
|
8
|
+
export * from './virtual.tool.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-params.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/run-params.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-result.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/run-result.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-tool.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/run-tool.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,WAAW,OAAQ,SAAQ,aAAa;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-result.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/tool-result.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/tool.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/o-tool.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { oCoreNode } from '@olane/o-core';
|
|
2
|
+
/**
|
|
3
|
+
* oTool is a mixin that extends the base class and implements the oTool interface
|
|
4
|
+
* @param Base - The base class to extend
|
|
5
|
+
* @returns A new class that extends the base class and implements the oTool interface
|
|
6
|
+
*/
|
|
7
|
+
export declare function oTool<T extends new (...args: any[]) => oCoreNode>(Base: T): T;
|
|
8
|
+
//# sourceMappingURL=o-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"o-tool.d.ts","sourceRoot":"","sources":["../src/o-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,SAAS,EAMV,MAAM,eAAe,CAAC;AASvB;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,SAAS,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAkV7E"}
|
package/dist/o-tool.js
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { CoreUtils, oAddress, oRequest, oToolError, oToolErrorCodes, } from '@olane/o-core';
|
|
2
|
+
import { oProtocolMethods } from '@olane/o-protocol';
|
|
3
|
+
import { ToolUtils } from './tool.utils.js';
|
|
4
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
5
|
+
/**
|
|
6
|
+
* oTool is a mixin that extends the base class and implements the oTool interface
|
|
7
|
+
* @param Base - The base class to extend
|
|
8
|
+
* @returns A new class that extends the base class and implements the oTool interface
|
|
9
|
+
*/
|
|
10
|
+
export function oTool(Base) {
|
|
11
|
+
return class extends Base {
|
|
12
|
+
constructor(...args) {
|
|
13
|
+
super(...args);
|
|
14
|
+
const config = args[0];
|
|
15
|
+
}
|
|
16
|
+
validateToolCall(oRequest) {
|
|
17
|
+
this.logger.debug('Validating tool call: ' + oRequest.method);
|
|
18
|
+
const method = oRequest.method;
|
|
19
|
+
if (!method) {
|
|
20
|
+
throw new Error('method parameter is required');
|
|
21
|
+
}
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
if (!this[`_tool_${method}`]) {
|
|
24
|
+
throw new Error(`Tool ${method} is not implemented`);
|
|
25
|
+
}
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
async handleProtocol(address) {
|
|
29
|
+
this.logger.debug('Handling protocol: ' + address.protocol);
|
|
30
|
+
await this.p2pNode.handle(address.protocol, this.handleStream.bind(this));
|
|
31
|
+
}
|
|
32
|
+
async initialize() {
|
|
33
|
+
await super.initialize();
|
|
34
|
+
this.logger.debug('Handling protocol: ' + this.address.protocol);
|
|
35
|
+
await this.handleProtocol(this.address);
|
|
36
|
+
if (this.staticAddress &&
|
|
37
|
+
this.staticAddress?.toString() !== this.address.toString()) {
|
|
38
|
+
await this.handleProtocol(this.staticAddress);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async use(address, data) {
|
|
42
|
+
// check if we call ourselves
|
|
43
|
+
if (address.toString() === this.address.toString() ||
|
|
44
|
+
address.toString() === this.staticAddress.toString()) {
|
|
45
|
+
// let's call our own tool
|
|
46
|
+
this.logger.debug('Calling ourselves, skipping...', data);
|
|
47
|
+
const request = new oRequest({
|
|
48
|
+
method: data.method,
|
|
49
|
+
params: {
|
|
50
|
+
_connectionId: 0,
|
|
51
|
+
_requestMethod: data.method,
|
|
52
|
+
...data.params,
|
|
53
|
+
},
|
|
54
|
+
id: 0,
|
|
55
|
+
});
|
|
56
|
+
let success = true;
|
|
57
|
+
const result = await this.execute(request).catch((error) => {
|
|
58
|
+
this.logger.error('Error executing tool: ' + error);
|
|
59
|
+
success = false;
|
|
60
|
+
return {
|
|
61
|
+
error: error.message,
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
if (success) {
|
|
65
|
+
this.successCount++;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
this.errorCount++;
|
|
69
|
+
}
|
|
70
|
+
return ToolUtils.buildResponse(request, result, result?.error);
|
|
71
|
+
}
|
|
72
|
+
return super.use(address, data);
|
|
73
|
+
}
|
|
74
|
+
async handleStream(streamData) {
|
|
75
|
+
const { stream } = streamData;
|
|
76
|
+
const requestConfig = await CoreUtils.processStream(stream);
|
|
77
|
+
const request = new oRequest(requestConfig);
|
|
78
|
+
let success = true;
|
|
79
|
+
const result = await this.execute(request, stream).catch((error) => {
|
|
80
|
+
this.logger.error('Error executing tool: ' + error, typeof error);
|
|
81
|
+
success = false;
|
|
82
|
+
const responseError = error instanceof oToolError
|
|
83
|
+
? error
|
|
84
|
+
: new oToolError(oToolErrorCodes.TOOL_ERROR, error.message);
|
|
85
|
+
return {
|
|
86
|
+
error: responseError,
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
if (success) {
|
|
90
|
+
this.successCount++;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
this.errorCount++;
|
|
94
|
+
}
|
|
95
|
+
// compose the response & add the expected connection + request fields
|
|
96
|
+
const response = ToolUtils.buildResponse(request, result, result?.error);
|
|
97
|
+
// add the request method to the response
|
|
98
|
+
return CoreUtils.sendResponse(response, streamData.stream);
|
|
99
|
+
}
|
|
100
|
+
async execute(req, stream) {
|
|
101
|
+
this.logger.debug('Tool handling incoming stream: ' + this.address.protocol);
|
|
102
|
+
// const protocolUsageCounter = this.p2pNode.metrics?.registerCounter(
|
|
103
|
+
// 'libp2p_protocol_custom_track',
|
|
104
|
+
// {
|
|
105
|
+
// help: 'Total number of protocol interactions',
|
|
106
|
+
// label: this.address.toString(),
|
|
107
|
+
// },
|
|
108
|
+
// );
|
|
109
|
+
// protocolUsageCounter?.increment();
|
|
110
|
+
let request = req;
|
|
111
|
+
const requestConfig = req.toJSON();
|
|
112
|
+
// validate and run the tool
|
|
113
|
+
this.validateToolCall(request);
|
|
114
|
+
// check if it's a route and we have reached the destination
|
|
115
|
+
if (request.method === oProtocolMethods.ROUTE &&
|
|
116
|
+
request.params.address === this.address.value) {
|
|
117
|
+
const { payload } = request.params;
|
|
118
|
+
this.logger.debug('Reached destination, processing payload', payload);
|
|
119
|
+
request = new oRequest({
|
|
120
|
+
id: requestConfig.id,
|
|
121
|
+
method: payload.method,
|
|
122
|
+
params: {
|
|
123
|
+
_connectionId: requestConfig.params?._connectionId,
|
|
124
|
+
_requestMethod: payload.method,
|
|
125
|
+
...(payload.params || {}), // TODO: is this correct? this line used to be ...payload
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
this.logger.debug('Processed request: ', request);
|
|
129
|
+
}
|
|
130
|
+
const result = await this.run(request, stream);
|
|
131
|
+
return result;
|
|
132
|
+
}
|
|
133
|
+
async run(request, stream) {
|
|
134
|
+
// TODO: this will process the input and prepare required parameters
|
|
135
|
+
// const processedParams = this.processRunInputs(params);
|
|
136
|
+
const missingParams = this.findMissingParams(request.method, request.params || {});
|
|
137
|
+
if (missingParams.length > 0) {
|
|
138
|
+
this.logger.error('Missing required parameters: ', missingParams, ' with passed params: ', request.params);
|
|
139
|
+
throw new oToolError(oToolErrorCodes.TOOL_MISSING_PARAMETERS, 'Missing required parameters', {
|
|
140
|
+
parameters: missingParams,
|
|
141
|
+
toolAddress: this.address.toString(),
|
|
142
|
+
data: request.params,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
return this.callMyTool(request, stream);
|
|
146
|
+
}
|
|
147
|
+
myTools() {
|
|
148
|
+
return Object.getOwnPropertyNames(this.constructor.prototype)
|
|
149
|
+
.filter((key) => key.startsWith('_tool_'))
|
|
150
|
+
.filter((key) => !!key)
|
|
151
|
+
.map((key) => key.replace('_tool_', ''));
|
|
152
|
+
}
|
|
153
|
+
myToolParams(tool) {
|
|
154
|
+
const func = Object.keys(this).find((key) => key.startsWith('_params_' + tool));
|
|
155
|
+
if (!func) {
|
|
156
|
+
throw new Error(`Tool ${tool} not found`);
|
|
157
|
+
}
|
|
158
|
+
// @ts-ignore
|
|
159
|
+
return this[func]();
|
|
160
|
+
}
|
|
161
|
+
async callMyTool(request, stream) {
|
|
162
|
+
const method = request.method;
|
|
163
|
+
this.logger.debug('Calling tool: ' + method);
|
|
164
|
+
// @ts-ignore
|
|
165
|
+
return this[`_tool_${method}`]({ ...request.toJSON(), stream });
|
|
166
|
+
}
|
|
167
|
+
async index() {
|
|
168
|
+
const metadata = await this.whoami();
|
|
169
|
+
if (!metadata.tools.length && !metadata.description) {
|
|
170
|
+
this.logger.warn('No metadata found, skipping...');
|
|
171
|
+
return {
|
|
172
|
+
provider: 'Empty node',
|
|
173
|
+
summary: 'Empty node',
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
for (const method in this.methods) {
|
|
177
|
+
const m = this.methods[method];
|
|
178
|
+
await this.use(new oAddress('o://vector-store'), {
|
|
179
|
+
method: 'add_documents',
|
|
180
|
+
params: {
|
|
181
|
+
documents: [
|
|
182
|
+
{
|
|
183
|
+
pageContent: m.description,
|
|
184
|
+
metadata: {
|
|
185
|
+
address: this.address?.toString() + '/' + method,
|
|
186
|
+
id: uuidv4(),
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
let summary = metadata.description ? metadata.description : null;
|
|
194
|
+
if (!summary) {
|
|
195
|
+
this.logger.debug('No description found, generating summary...');
|
|
196
|
+
const response = await this.use(new oAddress('o://intelligence'), {
|
|
197
|
+
method: 'prompt',
|
|
198
|
+
params: {
|
|
199
|
+
prompt: `You are a helpful assistant that summarizes what a service does by looking at the service description and the details of the tools that the service contains. \n
|
|
200
|
+
Format the output in JSON using this template:` +
|
|
201
|
+
JSON.stringify({
|
|
202
|
+
summary: 'string',
|
|
203
|
+
}) +
|
|
204
|
+
'Do NOT include any other text other than the JSON response. The following is the JSON input of the service: ' +
|
|
205
|
+
JSON.stringify(metadata),
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
const { result } = response;
|
|
209
|
+
const { success } = result;
|
|
210
|
+
if (!success) {
|
|
211
|
+
this.logger.error('Failed to index network: ', result);
|
|
212
|
+
throw new Error('Failed to index network');
|
|
213
|
+
}
|
|
214
|
+
const data = result.data;
|
|
215
|
+
const { message } = data;
|
|
216
|
+
const json = JSON.parse(message);
|
|
217
|
+
summary = json.summary;
|
|
218
|
+
}
|
|
219
|
+
try {
|
|
220
|
+
if (summary) {
|
|
221
|
+
await this.use(new oAddress('o://vector-store'), {
|
|
222
|
+
method: 'add_documents',
|
|
223
|
+
params: {
|
|
224
|
+
documents: [
|
|
225
|
+
{
|
|
226
|
+
pageContent: summary,
|
|
227
|
+
metadata: {
|
|
228
|
+
address: this.address?.toString(),
|
|
229
|
+
id: uuidv4(),
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
},
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
return {
|
|
237
|
+
summary: summary,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
catch (e) {
|
|
241
|
+
this.logger.error('Error indexing network: ', e);
|
|
242
|
+
throw e;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
async _tool_index_network(request) {
|
|
246
|
+
this.logger.debug('Indexing network...');
|
|
247
|
+
// collect all the information from the child nodes
|
|
248
|
+
return await this.index();
|
|
249
|
+
}
|
|
250
|
+
async whoami() {
|
|
251
|
+
const metadata = await super.whoami();
|
|
252
|
+
return {
|
|
253
|
+
tools: this.myTools(),
|
|
254
|
+
description: this.description,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
async _tool_hello_world(request) {
|
|
258
|
+
return {
|
|
259
|
+
message: 'Hello, world!',
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
// ensure that the required parameters are present
|
|
263
|
+
findMissingParams(methodName, params) {
|
|
264
|
+
const method = this.methods[methodName];
|
|
265
|
+
const protectedMethods = Object.values(oProtocolMethods);
|
|
266
|
+
if (protectedMethods.includes(methodName)) {
|
|
267
|
+
return [];
|
|
268
|
+
}
|
|
269
|
+
if (!method) {
|
|
270
|
+
this.logger.warn('No parameter configuration found for method. This is expected for some methods, but may impact AI performance around improvisation.', methodName);
|
|
271
|
+
return [];
|
|
272
|
+
}
|
|
273
|
+
const requiredParams = method.parameters;
|
|
274
|
+
if (!requiredParams || !requiredParams.filter) {
|
|
275
|
+
this.logger.error('[Provider] No handshake parameters found for method: ', methodName);
|
|
276
|
+
return [];
|
|
277
|
+
}
|
|
278
|
+
const missingParams = requiredParams
|
|
279
|
+
.filter((p) => !params[p.name])
|
|
280
|
+
.filter((p) => p.required === undefined || p.required === true);
|
|
281
|
+
return missingParams;
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CoreConfig } from '@olane/o-core';
|
|
2
|
-
import { oVirtualTool } from '../virtual.tool';
|
|
2
|
+
import { oVirtualTool } from '../virtual.tool.js';
|
|
3
3
|
export declare class oClientNode extends oVirtualTool {
|
|
4
4
|
constructor(config: CoreConfig);
|
|
5
5
|
configureTransports(): any[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.node.d.ts","sourceRoot":"","sources":["../../../src/nodes/client.node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAS,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"client.node.d.ts","sourceRoot":"","sources":["../../../src/nodes/client.node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAS,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,qBAAa,WAAY,SAAQ,YAAY;gBAC/B,MAAM,EAAE,UAAU;IAU9B,mBAAmB,IAAI,GAAG,EAAE;CAG7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.utils.d.ts","sourceRoot":"","sources":["../src/tool.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,qBAAa,SAAS;IACpB,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,GAAG,SAAS;CAc5E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { oResponse } from '@olane/o-core';
|
|
2
|
+
export class ToolUtils {
|
|
3
|
+
static buildResponse(request, result, error) {
|
|
4
|
+
let success = true;
|
|
5
|
+
if (error) {
|
|
6
|
+
success = false;
|
|
7
|
+
}
|
|
8
|
+
return new oResponse({
|
|
9
|
+
id: request.id,
|
|
10
|
+
data: result,
|
|
11
|
+
error: result?.error,
|
|
12
|
+
...{ success },
|
|
13
|
+
_requestMethod: request.method,
|
|
14
|
+
_connectionId: request.params?._connectionId,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { oToolConfig } from './interfaces/tool.interface.js';
|
|
2
|
+
import { oAddress } from '@olane/o-core';
|
|
3
|
+
declare const oVirtualTool_base: any;
|
|
4
|
+
export declare class oVirtualTool extends oVirtualTool_base {
|
|
5
|
+
constructor(config: oToolConfig & {
|
|
6
|
+
address: oAddress;
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=virtual.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtual.tool.d.ts","sourceRoot":"","sources":["../src/virtual.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAgB,MAAM,eAAe,CAAC;iCAEG,GAAG;AAA7D,qBAAa,YAAa,SAAQ,iBAA4B;gBAChD,MAAM,EAAE,WAAW,GAAG;QAAE,OAAO,EAAE,QAAQ,CAAA;KAAE;CAGxD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olane/o-tool",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@eslint/eslintrc": "^3.3.1",
|
|
36
36
|
"@eslint/js": "^9.29.0",
|
|
37
|
-
"@olane/o-config": "
|
|
38
|
-
"@olane/o-core": "
|
|
39
|
-
"@olane/o-protocol": "
|
|
37
|
+
"@olane/o-config": "file:../o-config",
|
|
38
|
+
"@olane/o-core": "file:../..",
|
|
39
|
+
"@olane/o-protocol": "file:../o-protocol",
|
|
40
40
|
"@tsconfig/node20": "^20.1.6",
|
|
41
41
|
"@types/jest": "^30.0.0",
|
|
42
42
|
"@types/uuid": "^10.0.0",
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
"typescript": "^5.8.3"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@olane/o-config": "^0.
|
|
60
|
-
"@olane/o-core": "^0.
|
|
61
|
-
"@olane/o-protocol": "^0.
|
|
59
|
+
"@olane/o-config": "^0.4.0",
|
|
60
|
+
"@olane/o-core": "^0.4.0",
|
|
61
|
+
"@olane/o-protocol": "^0.4.0"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"debug": "^4.4.1",
|