ultravisor 1.0.11 → 1.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultravisor",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "Cyclic process execution with ai integration.",
5
5
  "main": "source/Ultravisor.cjs",
6
6
  "bin": {
@@ -33,7 +33,7 @@
33
33
  "pict": "^1.0.359",
34
34
  "pict-service-commandlineutility": "^1.0.19",
35
35
  "pict-serviceproviderbase": "^1.0.4",
36
- "ultravisor-beacon": "^0.0.5",
36
+ "ultravisor-beacon": "^0.0.7",
37
37
  "ws": "^8.20.0"
38
38
  },
39
39
  "devDependencies": {
@@ -135,15 +135,21 @@ module.exports =
135
135
  if (tmpOutputs.URL && !tmpOutputs.URL.startsWith('http'))
136
136
  {
137
137
  let tmpBeaconDef = tmpCoordinator.getBeacon(tmpResolved.BeaconID);
138
+ pTask.log.info(`Resolve Address: URL is relative, looking up BindAddresses for beacon ${tmpResolved.BeaconID}. getBeacon returned: ${tmpBeaconDef ? 'found' : 'null'}, BindAddresses: ${JSON.stringify(tmpBeaconDef && tmpBeaconDef.BindAddresses)}`);
138
139
  let tmpBindAddresses = tmpBeaconDef && tmpBeaconDef.BindAddresses ? tmpBeaconDef.BindAddresses : [];
139
140
  // Prefer non-loopback addresses
140
141
  let tmpBind = tmpBindAddresses.find(function (pB) { return pB.IP !== '127.0.0.1' && pB.IP !== '::1'; }) || tmpBindAddresses[0];
141
142
  if (tmpBind)
142
143
  {
143
144
  let tmpBaseURL = (tmpBind.Protocol || 'http') + '://' + tmpBind.IP + ':' + tmpBind.Port;
145
+ pTask.log.info(`Resolve Address: using bind address ${tmpBaseURL}`);
144
146
  tmpOutputs.DirectURL = _buildDirectURL(tmpBaseURL);
145
147
  tmpOutputs.URL = tmpOutputs.DirectURL;
146
148
  }
149
+ else
150
+ {
151
+ pTask.log.warn(`Resolve Address: no BindAddresses available for beacon ${tmpResolved.BeaconID} — URL will remain relative`);
152
+ }
147
153
  }
148
154
 
149
155
  let tmpStateWrites = {};
@@ -209,7 +215,19 @@ module.exports =
209
215
  // Already exists — fine
210
216
  }
211
217
 
212
- pTask.log.info(`File Transfer: downloading ${tmpSourceURL} ${tmpFilename}`);
218
+ let tmpTimeoutMs = parseInt(pResolvedSettings.TimeoutMs, 10) || 300000;
219
+
220
+ pTask.log.info(`File Transfer: downloading ${tmpSourceURL} → ${tmpFilename} (timeout ${Math.round(tmpTimeoutMs / 1000)}s)`);
221
+
222
+ // Validate URL before attempting request
223
+ if (!tmpSourceURL.startsWith('http://') && !tmpSourceURL.startsWith('https://'))
224
+ {
225
+ return fCallback(null, {
226
+ EventToFire: 'Error',
227
+ Outputs: { LocalPath: '', BytesTransferred: 0, DurationMs: 0 },
228
+ Log: [`File Transfer: invalid URL (no protocol): ${tmpSourceURL}`]
229
+ });
230
+ }
213
231
 
214
232
  let tmpLib = tmpSourceURL.startsWith('https') ? libHTTPS : libHTTP;
215
233
  let tmpRequest = tmpLib.get(tmpSourceURL, function (pResponse)
@@ -253,10 +271,10 @@ module.exports =
253
271
  });
254
272
  });
255
273
 
256
- // Set a 5-minute timeout on the request
257
- tmpRequest.setTimeout(300000, function ()
274
+ // Set timeout on the request (configurable via TimeoutMs setting, default 5 min)
275
+ tmpRequest.setTimeout(tmpTimeoutMs, function ()
258
276
  {
259
- tmpRequest.destroy(new Error('File Transfer: download timed out after 5 minutes'));
277
+ tmpRequest.destroy(new Error(`File Transfer: download timed out after ${Math.round(tmpTimeoutMs / 1000)} seconds`));
260
278
  });
261
279
  }
262
280
  },
@@ -2062,7 +2062,8 @@ class UltravisorAPIServer extends libPictService
2062
2062
  Operations: pData.Operations,
2063
2063
  MaxConcurrent: pData.MaxConcurrent,
2064
2064
  Tags: pData.Tags,
2065
- Contexts: pData.Contexts
2065
+ Contexts: pData.Contexts,
2066
+ BindAddresses: pData.BindAddresses
2066
2067
  });
2067
2068
 
2068
2069
  pWebSocket._BeaconID = tmpBeacon.BeaconID;