@codelia/runtime 0.1.79 → 0.1.80

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.
@@ -13429,7 +13429,23 @@ var requestClientToolCall = async (state, params, timeoutMs) => {
13429
13429
  params
13430
13430
  };
13431
13431
  send(request);
13432
- return await state.waitForUiResponse(id, timeoutMs);
13432
+ return await state.waitForUiResponse(
13433
+ id,
13434
+ timeoutMs,
13435
+ () => {
13436
+ const notification = {
13437
+ jsonrpc: "2.0",
13438
+ method: "client.tool.cancel",
13439
+ params: {
13440
+ request_id: id,
13441
+ run_id: params.run_id,
13442
+ name: params.name,
13443
+ reason: "timeout"
13444
+ }
13445
+ };
13446
+ send(notification);
13447
+ }
13448
+ );
13433
13449
  };
13434
13450
 
13435
13451
  // src/tools/client.ts
@@ -16268,12 +16284,16 @@ var RuntimeState = class {
16268
16284
  this.uiRequestCounter += 1;
16269
16285
  return `ui_${this.uiRequestCounter}`;
16270
16286
  }
16271
- waitForUiResponse(id, timeoutMs) {
16287
+ waitForUiResponse(id, timeoutMs, onTimeout) {
16272
16288
  return new Promise((resolve, reject) => {
16273
16289
  const resolveUnknown = (value) => resolve(value);
16274
16290
  const timeout = timeoutMs ? setTimeout(() => {
16275
- this.pendingUiRequests.delete(id);
16276
- reject(new Error("ui request timed out"));
16291
+ try {
16292
+ onTimeout?.();
16293
+ } finally {
16294
+ this.pendingUiRequests.delete(id);
16295
+ reject(new Error("ui request timed out"));
16296
+ }
16277
16297
  }, timeoutMs) : void 0;
16278
16298
  this.pendingUiRequests.set(id, {
16279
16299
  resolve: resolveUnknown,
package/dist/index.cjs CHANGED
@@ -13383,7 +13383,23 @@ var requestClientToolCall = async (state, params, timeoutMs) => {
13383
13383
  params
13384
13384
  };
13385
13385
  send(request);
13386
- return await state.waitForUiResponse(id, timeoutMs);
13386
+ return await state.waitForUiResponse(
13387
+ id,
13388
+ timeoutMs,
13389
+ () => {
13390
+ const notification = {
13391
+ jsonrpc: "2.0",
13392
+ method: "client.tool.cancel",
13393
+ params: {
13394
+ request_id: id,
13395
+ run_id: params.run_id,
13396
+ name: params.name,
13397
+ reason: "timeout"
13398
+ }
13399
+ };
13400
+ send(notification);
13401
+ }
13402
+ );
13387
13403
  };
13388
13404
 
13389
13405
  // src/tools/client.ts
@@ -16212,12 +16228,16 @@ var RuntimeState = class {
16212
16228
  this.uiRequestCounter += 1;
16213
16229
  return `ui_${this.uiRequestCounter}`;
16214
16230
  }
16215
- waitForUiResponse(id, timeoutMs) {
16231
+ waitForUiResponse(id, timeoutMs, onTimeout) {
16216
16232
  return new Promise((resolve, reject) => {
16217
16233
  const resolveUnknown = (value) => resolve(value);
16218
16234
  const timeout = timeoutMs ? setTimeout(() => {
16219
- this.pendingUiRequests.delete(id);
16220
- reject(new Error("ui request timed out"));
16235
+ try {
16236
+ onTimeout?.();
16237
+ } finally {
16238
+ this.pendingUiRequests.delete(id);
16239
+ reject(new Error("ui request timed out"));
16240
+ }
16221
16241
  }, timeoutMs) : void 0;
16222
16242
  this.pendingUiRequests.set(id, {
16223
16243
  resolve: resolveUnknown,
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  startRuntime
3
- } from "./chunk-CQ3JCCVC.js";
3
+ } from "./chunk-J73OBTWI.js";
4
4
 
5
5
  // src/index.ts
6
6
  void startRuntime().catch((error) => {
package/dist/sdk.cjs CHANGED
@@ -13395,7 +13395,23 @@ var requestClientToolCall = async (state, params, timeoutMs) => {
13395
13395
  params
13396
13396
  };
13397
13397
  send(request);
13398
- return await state.waitForUiResponse(id, timeoutMs);
13398
+ return await state.waitForUiResponse(
13399
+ id,
13400
+ timeoutMs,
13401
+ () => {
13402
+ const notification = {
13403
+ jsonrpc: "2.0",
13404
+ method: "client.tool.cancel",
13405
+ params: {
13406
+ request_id: id,
13407
+ run_id: params.run_id,
13408
+ name: params.name,
13409
+ reason: "timeout"
13410
+ }
13411
+ };
13412
+ send(notification);
13413
+ }
13414
+ );
13399
13415
  };
13400
13416
 
13401
13417
  // src/tools/client.ts
@@ -16224,12 +16240,16 @@ var RuntimeState = class {
16224
16240
  this.uiRequestCounter += 1;
16225
16241
  return `ui_${this.uiRequestCounter}`;
16226
16242
  }
16227
- waitForUiResponse(id, timeoutMs) {
16243
+ waitForUiResponse(id, timeoutMs, onTimeout) {
16228
16244
  return new Promise((resolve, reject) => {
16229
16245
  const resolveUnknown = (value) => resolve(value);
16230
16246
  const timeout = timeoutMs ? setTimeout(() => {
16231
- this.pendingUiRequests.delete(id);
16232
- reject(new Error("ui request timed out"));
16247
+ try {
16248
+ onTimeout?.();
16249
+ } finally {
16250
+ this.pendingUiRequests.delete(id);
16251
+ reject(new Error("ui request timed out"));
16252
+ }
16233
16253
  }, timeoutMs) : void 0;
16234
16254
  this.pendingUiRequests.set(id, {
16235
16255
  resolve: resolveUnknown,
package/dist/sdk.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  startRuntime
3
- } from "./chunk-CQ3JCCVC.js";
3
+ } from "./chunk-J73OBTWI.js";
4
4
  export {
5
5
  startRuntime
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codelia/runtime",
3
- "version": "0.1.79",
3
+ "version": "0.1.80",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "engines": {
@@ -29,14 +29,14 @@
29
29
  "typecheck": "tsc --noEmit"
30
30
  },
31
31
  "dependencies": {
32
- "@codelia/config": "0.1.79",
33
- "@codelia/config-loader": "0.1.79",
34
- "@codelia/core": "0.1.79",
35
- "@codelia/logger": "0.1.79",
36
- "@codelia/model-metadata": "0.1.79",
37
- "@codelia/protocol": "0.1.79",
38
- "@codelia/shared-types": "0.1.79",
39
- "@codelia/storage": "0.1.79",
32
+ "@codelia/config": "0.1.80",
33
+ "@codelia/config-loader": "0.1.80",
34
+ "@codelia/core": "0.1.80",
35
+ "@codelia/logger": "0.1.80",
36
+ "@codelia/model-metadata": "0.1.80",
37
+ "@codelia/protocol": "0.1.80",
38
+ "@codelia/shared-types": "0.1.80",
39
+ "@codelia/storage": "0.1.80",
40
40
  "eventsource-parser": "^3.0.6",
41
41
  "oauth4webapi": "^3.8.4",
42
42
  "zod": "^4.3.5"