@olane/o-tool 0.5.1 → 0.6.2

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.
@@ -1 +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,CA0U7E"}
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,CAqV7E"}
@@ -53,10 +53,13 @@ export function oTool(Base) {
53
53
  });
54
54
  let success = true;
55
55
  const result = await this.execute(request).catch((error) => {
56
- this.logger.error('Error executing tool: ' + error);
56
+ this.logger.error('Error executing tool: ', error);
57
57
  success = false;
58
+ const responseError = error instanceof oToolError
59
+ ? error
60
+ : new oToolError(oToolErrorCodes.TOOL_ERROR, error.message);
58
61
  return {
59
- error: error.message,
62
+ error: responseError.toJSON(),
60
63
  };
61
64
  });
62
65
  if (success) {
@@ -75,13 +78,13 @@ export function oTool(Base) {
75
78
  const request = new oRequest(requestConfig);
76
79
  let success = true;
77
80
  const result = await this.execute(request, stream).catch((error) => {
78
- this.logger.error('Error executing tool: ' + error, typeof error);
81
+ this.logger.error('Error executing tool: ', error, typeof error);
79
82
  success = false;
80
83
  const responseError = error instanceof oToolError
81
84
  ? error
82
85
  : new oToolError(oToolErrorCodes.TOOL_ERROR, error.message);
83
86
  return {
84
- error: responseError,
87
+ error: responseError.toJSON(),
85
88
  };
86
89
  });
87
90
  if (success) {
@@ -137,13 +140,15 @@ export function oTool(Base) {
137
140
  data: request.params,
138
141
  });
139
142
  }
140
- return this.callMyTool(request, stream);
141
- }
142
- myTools() {
143
- return Object.getOwnPropertyNames(this.constructor.prototype)
144
- .filter((key) => key.startsWith('_tool_'))
145
- .filter((key) => !!key)
146
- .map((key) => key.replace('_tool_', ''));
143
+ // resolve o:// addresses
144
+ // THIS HAS A RECURSIVE CALL issue
145
+ this.logger.debug('Calling function at address: ', this.address.toString(), 'with request: ', request.method);
146
+ // const isPlaceholder = this.address.toString().includes('placeholder');
147
+ // request = await oRequest.translateToRawRequest(request, this);
148
+ let result = await this.callMyTool(request, stream);
149
+ // result = await oRequest.translateResultForAgent(result, this);
150
+ return result;
151
+ // translate to o:// addresses
147
152
  }
148
153
  myToolParams(tool) {
149
154
  const func = Object.keys(this).find((key) => key.startsWith('_params_' + tool));
@@ -245,6 +250,7 @@ export function oTool(Base) {
245
250
  async whoami() {
246
251
  const metadata = await super.whoami();
247
252
  return {
253
+ // @ts-ignore
248
254
  tools: this.myTools(),
249
255
  description: this.description,
250
256
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olane/o-tool",
3
- "version": "0.5.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -31,13 +31,10 @@
31
31
  },
32
32
  "author": "oLane Inc.",
33
33
  "license": "ISC",
34
- "description": "oLane Core",
34
+ "description": "oLane base tool class",
35
35
  "devDependencies": {
36
36
  "@eslint/eslintrc": "^3.3.1",
37
37
  "@eslint/js": "^9.29.0",
38
- "@olane/o-config": "0.5.1",
39
- "@olane/o-core": "0.5.1",
40
- "@olane/o-protocol": "0.5.1",
41
38
  "@tsconfig/node20": "^20.1.6",
42
39
  "@types/jest": "^30.0.0",
43
40
  "@types/uuid": "^10.0.0",
@@ -57,9 +54,9 @@
57
54
  "typescript": "^5.8.3"
58
55
  },
59
56
  "peerDependencies": {
60
- "@olane/o-config": "^0.5.1",
61
- "@olane/o-core": "^0.5.1",
62
- "@olane/o-protocol": "^0.5.1"
57
+ "@olane/o-config": "^0.6.2",
58
+ "@olane/o-core": "^0.6.2",
59
+ "@olane/o-protocol": "^0.6.2"
63
60
  },
64
61
  "dependencies": {
65
62
  "debug": "^4.4.1",