@olane/o-tool 0.6.12 → 0.6.13

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,CAqV7E"}
1
+ {"version":3,"file":"o-tool.d.ts","sourceRoot":"","sources":["../../src/o-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,EAKV,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,CAsW7E"}
@@ -158,11 +158,27 @@ export function oTool(Base) {
158
158
  // @ts-ignore
159
159
  return this[func]();
160
160
  }
161
+ async _tool_cancel_request(request) {
162
+ const { requestId } = request.params;
163
+ delete this.requests[requestId];
164
+ return {
165
+ message: 'Request cancelled',
166
+ };
167
+ }
161
168
  async callMyTool(request, stream) {
162
169
  const method = request.method;
163
170
  this.logger.debug('Calling tool: ' + method);
171
+ this.requests[request.id] = request;
164
172
  // @ts-ignore
165
- return this[`_tool_${method}`]({ ...request.toJSON(), stream });
173
+ const result = await this[`_tool_${method}`]({
174
+ ...request.toJSON(),
175
+ stream,
176
+ }).catch((error) => {
177
+ delete this.requests[request.id];
178
+ throw error;
179
+ });
180
+ delete this.requests[request.id];
181
+ return result;
166
182
  }
167
183
  async index() {
168
184
  const metadata = await this.whoami();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olane/o-tool",
3
- "version": "0.6.12",
3
+ "version": "0.6.13",
4
4
  "type": "module",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -55,9 +55,9 @@
55
55
  "typescript": "^5.8.3"
56
56
  },
57
57
  "peerDependencies": {
58
- "@olane/o-config": "^0.6.11",
59
- "@olane/o-core": "^0.6.11",
60
- "@olane/o-protocol": "^0.6.11"
58
+ "@olane/o-config": "^0.6.12",
59
+ "@olane/o-core": "^0.6.12",
60
+ "@olane/o-protocol": "^0.6.12"
61
61
  },
62
62
  "dependencies": {
63
63
  "debug": "^4.4.1",