@rynx-ai/remote-runtime-client 0.1.11-beta.3 → 0.1.11-beta.31
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/client.d.ts +3 -2
- package/dist/client.js +21 -10
- package/package.json +3 -3
package/dist/client.d.ts
CHANGED
|
@@ -12,8 +12,9 @@ export interface DirectRuntimeClientOptions {
|
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
export interface DirectRuntimeCallOptions {
|
|
15
|
-
/** Per-call override for operations whose expected duration differs from the
|
|
16
|
-
|
|
15
|
+
/** Per-call override for operations whose expected duration differs from the
|
|
16
|
+
* handshake. `null` leaves the operation to its own lifecycle deadlines. */
|
|
17
|
+
timeoutMs?: number | null;
|
|
17
18
|
}
|
|
18
19
|
export interface DirectRuntimeSessionEventsOptions {
|
|
19
20
|
/** Timeout for the accepted ready barrier and cancellation acknowledgement. */
|
package/dist/client.js
CHANGED
|
@@ -208,20 +208,25 @@ class DirectRuntimeConnectionImpl {
|
|
|
208
208
|
outcome: "not_started",
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
|
-
const timeoutMs =
|
|
211
|
+
const timeoutMs = options.timeoutMs === null
|
|
212
|
+
? null
|
|
213
|
+
: parseTimeout(options.timeoutMs ?? this.timeoutMs);
|
|
212
214
|
return await new Promise((resolve, reject) => {
|
|
213
|
-
const timer =
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
215
|
+
const timer = timeoutMs === null
|
|
216
|
+
? undefined
|
|
217
|
+
: setTimeout(() => {
|
|
218
|
+
this.pending.delete(id);
|
|
219
|
+
reject(callTransportError(clientError("deadline_exceeded", "Direct Runtime RPC timed out"), method, id));
|
|
220
|
+
}, timeoutMs);
|
|
221
|
+
timer?.unref?.();
|
|
218
222
|
this.pending.set(id, { method, resolve, reject, timer });
|
|
219
223
|
void this.channel.socket.sendText(frame).catch((error) => {
|
|
220
224
|
const pending = this.pending.get(id);
|
|
221
225
|
if (!pending)
|
|
222
226
|
return;
|
|
223
227
|
this.pending.delete(id);
|
|
224
|
-
|
|
228
|
+
if (pending.timer)
|
|
229
|
+
clearTimeout(pending.timer);
|
|
225
230
|
pending.reject(error instanceof DirectRuntimeClientCapacityError
|
|
226
231
|
? error
|
|
227
232
|
: callTransportError(error, pending.method, id));
|
|
@@ -232,7 +237,11 @@ class DirectRuntimeConnectionImpl {
|
|
|
232
237
|
if (this.statusSnapshot)
|
|
233
238
|
return Promise.resolve(this.statusSnapshot);
|
|
234
239
|
if (!this.statusProbe) {
|
|
235
|
-
|
|
240
|
+
// An application operation may deliberately have no outer deadline, but
|
|
241
|
+
// capability preflight is transport metadata and retains the connection
|
|
242
|
+
// default rather than inheriting that unbounded lifecycle.
|
|
243
|
+
const statusOptions = options.timeoutMs === null ? {} : options;
|
|
244
|
+
this.statusProbe = this.sendCall("status.get", {}, statusOptions).finally(() => {
|
|
236
245
|
this.statusProbe = undefined;
|
|
237
246
|
});
|
|
238
247
|
}
|
|
@@ -498,7 +507,8 @@ class DirectRuntimeConnectionImpl {
|
|
|
498
507
|
return;
|
|
499
508
|
}
|
|
500
509
|
this.pending.delete(envelope.id);
|
|
501
|
-
|
|
510
|
+
if (pending.timer)
|
|
511
|
+
clearTimeout(pending.timer);
|
|
502
512
|
let response;
|
|
503
513
|
try {
|
|
504
514
|
response = parseRemoteRuntimeRpcResponseForMethod(envelope, pending.method);
|
|
@@ -847,7 +857,8 @@ class DirectRuntimeConnectionImpl {
|
|
|
847
857
|
}
|
|
848
858
|
rejectPending(error) {
|
|
849
859
|
for (const [id, pending] of this.pending) {
|
|
850
|
-
|
|
860
|
+
if (pending.timer)
|
|
861
|
+
clearTimeout(pending.timer);
|
|
851
862
|
pending.reject(callTransportError(error, pending.method, id));
|
|
852
863
|
}
|
|
853
864
|
this.pending.clear();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rynx-ai/remote-runtime-client",
|
|
3
|
-
"version": "0.1.11-beta.
|
|
3
|
+
"version": "0.1.11-beta.31",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/rynx-ai/rynx.git",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"ws": "^8.21.0",
|
|
28
|
-
"@rynx-ai/protocol": "0.1.11-beta.
|
|
29
|
-
"@rynx-ai/remote-runtime-e2ee": "0.1.11-beta.
|
|
28
|
+
"@rynx-ai/protocol": "0.1.11-beta.31",
|
|
29
|
+
"@rynx-ai/remote-runtime-e2ee": "0.1.11-beta.31"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/ws": "^8.18.1"
|