open-agents-ai 0.103.42 → 0.103.43
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.js +12 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12297,9 +12297,9 @@ async function handleCmd(cmd) {
|
|
|
12297
12297
|
if (!peerId) { writeResp(id, { ok: false, output: 'target_peer is required' }); return; }
|
|
12298
12298
|
dlog('invoke_capability: peer=' + peerId.slice(0, 20) + ' cap=' + capability);
|
|
12299
12299
|
try {
|
|
12300
|
-
// Wrap in a
|
|
12301
|
-
const INVOKE_TIMEOUT =
|
|
12302
|
-
const invokePromise = nexus.invokeCapability(peerId, capability, typeof input === 'string' ? { prompt: input } : input, { stream: false, maxDurationMs:
|
|
12300
|
+
// Wrap in a 300s timeout \u2014 remote API inference (Chutes, etc.) can take 60-180s for large models
|
|
12301
|
+
const INVOKE_TIMEOUT = 300_000;
|
|
12302
|
+
const invokePromise = nexus.invokeCapability(peerId, capability, typeof input === 'string' ? { prompt: input } : input, { stream: false, maxDurationMs: 240000 });
|
|
12303
12303
|
const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error('invoke_capability timed out after ' + (INVOKE_TIMEOUT / 1000) + 's (client-side timeout)')), INVOKE_TIMEOUT));
|
|
12304
12304
|
const result = await Promise.race([invokePromise, timeoutPromise]);
|
|
12305
12305
|
dlog('invoke_capability: SUCCESS');
|
|
@@ -12349,8 +12349,8 @@ async function handleCmd(cmd) {
|
|
|
12349
12349
|
// Direct invoke on specified peer
|
|
12350
12350
|
dlog('remote_infer: invoking ' + riCapName + ' on explicit peer ' + riTargetPeer.slice(0, 20));
|
|
12351
12351
|
try {
|
|
12352
|
-
var RI_TIMEOUT =
|
|
12353
|
-
var riInvokeP = nexus.invokeCapability(riTargetPeer, riCapName, riData, { stream: false, maxDurationMs:
|
|
12352
|
+
var RI_TIMEOUT = 300000; // 5 min \u2014 remote APIs (Chutes, etc.) can be slow for large models
|
|
12353
|
+
var riInvokeP = nexus.invokeCapability(riTargetPeer, riCapName, riData, { stream: false, maxDurationMs: 240000 });
|
|
12354
12354
|
var riTimeoutP = new Promise(function(_, reject) { setTimeout(function() { reject(new Error('remote_infer timed out after ' + (RI_TIMEOUT / 1000) + 's')); }, RI_TIMEOUT); });
|
|
12355
12355
|
var riResult = await Promise.race([riInvokeP, riTimeoutP]);
|
|
12356
12356
|
dlog('remote_infer: SUCCESS (explicit peer)');
|
|
@@ -12378,8 +12378,8 @@ async function handleCmd(cmd) {
|
|
|
12378
12378
|
var rPid = riCandidates[ri];
|
|
12379
12379
|
dlog('remote_infer: trying peer ' + rPid.slice(0, 20) + '...');
|
|
12380
12380
|
try {
|
|
12381
|
-
var PEER_INVOKE_TIMEOUT =
|
|
12382
|
-
var specInvoke = nexus.invokeCapability(rPid, riCapName, riData, { stream: false, maxDurationMs:
|
|
12381
|
+
var PEER_INVOKE_TIMEOUT = 180000; // 3 min per peer \u2014 remote API inference can be slow
|
|
12382
|
+
var specInvoke = nexus.invokeCapability(rPid, riCapName, riData, { stream: false, maxDurationMs: 150000 });
|
|
12383
12383
|
var specTimeout = new Promise(function(_, reject) {
|
|
12384
12384
|
setTimeout(function() { reject(new Error('peer invoke timeout')); }, PEER_INVOKE_TIMEOUT);
|
|
12385
12385
|
});
|
|
@@ -12698,7 +12698,7 @@ async function handleCmd(cmd) {
|
|
|
12698
12698
|
} catch { /* offline \u2014 use zero rates */ }
|
|
12699
12699
|
|
|
12700
12700
|
// Build pricing menu \u2014 match local models to market rates
|
|
12701
|
-
const margin = parseFloat(args.margin || '0
|
|
12701
|
+
const margin = parseFloat(args.margin || '0'); // default free \u2014 set margin > 0 to enable x402 pricing
|
|
12702
12702
|
const pricingMenu = [];
|
|
12703
12703
|
|
|
12704
12704
|
for (const model of models) {
|
|
@@ -12837,6 +12837,7 @@ async function handleCmd(cmd) {
|
|
|
12837
12837
|
method: 'POST',
|
|
12838
12838
|
headers: chatHeaders,
|
|
12839
12839
|
body: JSON.stringify(chatBody),
|
|
12840
|
+
signal: AbortSignal.timeout(210000), // 3.5 min \u2014 upstream API may be slow
|
|
12840
12841
|
});
|
|
12841
12842
|
genData = await genResp.json();
|
|
12842
12843
|
dlog('expose: ollama response keys=' + Object.keys(genData).join(',') + ' choices=' + (genData.choices ? genData.choices.length : 0));
|
|
@@ -12879,6 +12880,7 @@ async function handleCmd(cmd) {
|
|
|
12879
12880
|
messages: [{ role: 'user', content: flatPrompt }],
|
|
12880
12881
|
stream: false,
|
|
12881
12882
|
}),
|
|
12883
|
+
signal: AbortSignal.timeout(210000), // 3.5 min
|
|
12882
12884
|
});
|
|
12883
12885
|
genData = await genResp.json();
|
|
12884
12886
|
var ptChoices = genData.choices || [];
|
|
@@ -12905,6 +12907,7 @@ async function handleCmd(cmd) {
|
|
|
12905
12907
|
prompt: flatPrompt,
|
|
12906
12908
|
stream: false,
|
|
12907
12909
|
}),
|
|
12910
|
+
signal: AbortSignal.timeout(210000), // 3.5 min
|
|
12908
12911
|
});
|
|
12909
12912
|
genData = await genResp.json();
|
|
12910
12913
|
output = genData.response || '';
|
|
@@ -28484,7 +28487,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
28484
28487
|
}
|
|
28485
28488
|
this._targetUrl = options.targetUrl ?? DEFAULT_TARGETS[options.kind];
|
|
28486
28489
|
this._stateDir = options.stateDir ?? null;
|
|
28487
|
-
this._margin = options.margin ?? 0
|
|
28490
|
+
this._margin = options.margin ?? 0;
|
|
28488
28491
|
this._passthrough = options.passthrough ?? false;
|
|
28489
28492
|
this._loadbalance = options.loadbalance ?? false;
|
|
28490
28493
|
this._endpointAuth = options.endpointAuth;
|
package/package.json
CHANGED