@evomap/evolver 1.89.10 → 1.89.11

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.
Files changed (68) hide show
  1. package/README.ja-JP.md +1 -1
  2. package/README.ko-KR.md +1 -1
  3. package/README.md +2 -1
  4. package/README.zh-CN.md +1 -1
  5. package/assets/cover.png +0 -0
  6. package/index.js +5 -3
  7. package/package.json +1 -1
  8. package/src/adapters/scripts/evolver-session-end.js +18 -37
  9. package/src/atp/atpExecute.js +27 -71
  10. package/src/atp/serviceHelper.js +28 -36
  11. package/src/config.js +17 -0
  12. package/src/evolve/guards.js +1 -1
  13. package/src/evolve/pipeline/collect.js +1 -1
  14. package/src/evolve/pipeline/dispatch.js +1 -1
  15. package/src/evolve/pipeline/enrich.js +1 -1
  16. package/src/evolve/pipeline/hub.js +1 -1
  17. package/src/evolve/pipeline/select.js +1 -1
  18. package/src/evolve/pipeline/signals.js +1 -1
  19. package/src/evolve/utils.js +1 -1
  20. package/src/evolve.js +1 -1
  21. package/src/gep/a2aProtocol.js +1 -1
  22. package/src/gep/antiAbuseTelemetry.js +1 -1
  23. package/src/gep/autoDistillConv.js +1 -1
  24. package/src/gep/autoDistillLlm.js +1 -1
  25. package/src/gep/candidateEval.js +1 -1
  26. package/src/gep/candidates.js +1 -1
  27. package/src/gep/contentHash.js +1 -1
  28. package/src/gep/conversationSniffer.js +1 -1
  29. package/src/gep/crypto.js +1 -1
  30. package/src/gep/curriculum.js +1 -1
  31. package/src/gep/deviceId.js +1 -1
  32. package/src/gep/envFingerprint.js +1 -1
  33. package/src/gep/epigenetics.js +1 -1
  34. package/src/gep/execBridge.js +1 -1
  35. package/src/gep/explore.js +1 -1
  36. package/src/gep/hash.js +1 -1
  37. package/src/gep/hubFetch.js +1 -1
  38. package/src/gep/hubReview.js +1 -1
  39. package/src/gep/hubSearch.js +1 -1
  40. package/src/gep/hubVerify.js +1 -1
  41. package/src/gep/learningSignals.js +1 -1
  42. package/src/gep/memoryGraph.js +1 -1
  43. package/src/gep/memoryGraphAdapter.js +1 -1
  44. package/src/gep/mutation.js +1 -1
  45. package/src/gep/narrativeMemory.js +1 -1
  46. package/src/gep/oauthLogin.js +9 -3
  47. package/src/gep/openPRRegistry.js +1 -1
  48. package/src/gep/personality.js +1 -1
  49. package/src/gep/policyCheck.js +1 -1
  50. package/src/gep/privacyClient.js +10 -9
  51. package/src/gep/prompt.js +1 -1
  52. package/src/gep/recallInject.js +1 -1
  53. package/src/gep/recallVerifier.js +1 -1
  54. package/src/gep/reflection.js +1 -1
  55. package/src/gep/savingsCore.js +1 -1
  56. package/src/gep/selector.js +1 -1
  57. package/src/gep/signals.js +85 -17
  58. package/src/gep/skillDistiller.js +1 -1
  59. package/src/gep/solidify.js +1 -1
  60. package/src/gep/strategy.js +1 -1
  61. package/src/gep/tokenSavings.js +1 -1
  62. package/src/gep/workspaceKeychain.js +1 -1
  63. package/src/proxy/extensions/traceControl.js +1 -1
  64. package/src/proxy/index.js +100 -3
  65. package/src/proxy/inject.js +1 -1
  66. package/src/proxy/server/routes.js +10 -7
  67. package/src/proxy/trace/extractor.js +1 -1
  68. package/src/proxy/trace/usage.js +1 -1
@@ -233,6 +233,56 @@ function _extractKeywordScore(lower) {
233
233
  var _llmSignalCycleCount = 0;
234
234
  var LLM_SIGNAL_INTERVAL = 5;
235
235
 
236
+ function _curlHubIpFamilyArgs(env) {
237
+ return _curlHubIpFamilyAttempts(env)[0].slice();
238
+ }
239
+
240
+ function _resolveCurlHubIpFamily(env) {
241
+ var source = env || process.env;
242
+ var raw = String(source.EVOMAP_HUB_IP_FAMILY || 'ipv4first').trim().toLowerCase();
243
+ if (raw === 'ipv4' || raw === 'v4' || raw === '4' || raw === 'ipv4first' || raw === 'ipv4-first') return 'ipv4first';
244
+ if (raw === 'ipv4only' || raw === 'ipv4-only') return 'ipv4only';
245
+ if (raw === 'auto' || raw === 'dualstack' || raw === 'dual-stack') return 'auto';
246
+ throw new Error('[signals] EVOMAP_HUB_IP_FAMILY must be "ipv4", "ipv4-only", or "auto" - got ' + JSON.stringify(source.EVOMAP_HUB_IP_FAMILY));
247
+ }
248
+
249
+ function _curlHubIpFamilyAttempts(env) {
250
+ var family = _resolveCurlHubIpFamily(env);
251
+ if (family === 'auto') return [[]];
252
+ if (family === 'ipv4only') return [['-4']];
253
+ // Match hubFetch's default Hub egress posture: IPv4-first with a dual-stack
254
+ // fallback unless EVOMAP_HUB_IP_FAMILY explicitly disables fallback.
255
+ return [['-4'], []];
256
+ }
257
+
258
+ function _curlHeaderConfigValue(value) {
259
+ return '"' + String(value)
260
+ .replace(/\\/g, '\\\\')
261
+ .replace(/"/g, '\\"')
262
+ .replace(/\r/g, '\\r')
263
+ .replace(/\n/g, '\\n')
264
+ .replace(/\t/g, '\\t') + '"';
265
+ }
266
+
267
+ function _curlAuthConfig(nodeSecret) {
268
+ return 'header = ' + _curlHeaderConfigValue('Authorization: Bearer ' + nodeSecret) + '\n';
269
+ }
270
+
271
+ function _withTempPayloadFile(payload, fn) {
272
+ var fs = require('fs');
273
+ var os = require('os');
274
+ var path = require('path');
275
+ var dir = fs.mkdtempSync(path.join(os.tmpdir(), 'evolver-signal-'));
276
+ var file = path.join(dir, 'payload.json');
277
+ try {
278
+ fs.writeFileSync(file, payload, { encoding: 'utf8', mode: 0o600 });
279
+ return fn(file);
280
+ } finally {
281
+ try { fs.unlinkSync(file); } catch (_) {}
282
+ try { fs.rmdirSync(dir); } catch (_) {}
283
+ }
284
+ }
285
+
236
286
  function _extractLLM(corpus) {
237
287
  _llmSignalCycleCount++;
238
288
  if (_llmSignalCycleCount % LLM_SIGNAL_INTERVAL !== 1) return [];
@@ -241,6 +291,7 @@ function _extractLLM(corpus) {
241
291
  var getHubUrl = require('./a2aProtocol').getHubUrl;
242
292
  var getHubNodeSecret = require('./a2aProtocol').getHubNodeSecret;
243
293
  var getNodeId = require('./a2aProtocol').getNodeId;
294
+ var enforceHubScheme = require('./hubFetch').enforceHubScheme;
244
295
  var hubUrl = getHubUrl();
245
296
  var nodeSecret = getHubNodeSecret();
246
297
  if (!hubUrl || !nodeSecret) return [];
@@ -252,27 +303,43 @@ function _extractLLM(corpus) {
252
303
  sender_id: getNodeId() || undefined,
253
304
  });
254
305
 
255
- var url = hubUrl + '/a2a/signal/analyze';
306
+ var url = hubUrl.replace(/\/+$/, '') + '/a2a/signal/analyze';
307
+ enforceHubScheme(url);
256
308
 
257
- // Use execFileSync (no shell) + curl argv array so postData/url/nodeSecret
258
- // are passed as discrete argv entries. This eliminates any possibility of
259
- // shell metacharacters in the corpus (which flows into postData) being
260
- // interpreted by a shell. Sync HTTP is required because this runs inside
261
- // a spin-wait loop where Node's async http callbacks cannot fire.
309
+ // Use execFileSync (no shell) + curl argv array so URL and file paths are
310
+ // passed as discrete argv entries. The bearer token is supplied through
311
+ // curl config on stdin, not argv, so process listings do not expose it.
312
+ // Sync HTTP is required because this runs inside a spin-wait loop where
313
+ // Node's async http callbacks cannot fire.
262
314
  var execFileSync = require('child_process').execFileSync;
263
315
  var stdout = '';
264
316
  try {
265
- stdout = execFileSync('curl', [
266
- '-s', '-m', '10', '-X', 'POST',
267
- '-H', 'Content-Type: application/json',
268
- '-H', 'Authorization: Bearer ' + nodeSecret,
269
- '-d', postData,
270
- url,
271
- ], {
272
- timeout: 12000,
273
- windowsHide: true,
274
- stdio: ['pipe', 'pipe', 'pipe'],
275
- encoding: 'utf8',
317
+ stdout = _withTempPayloadFile(postData, function (payloadFile) {
318
+ var attempts = _curlHubIpFamilyAttempts(process.env);
319
+ var lastErr = null;
320
+ for (var i = 0; i < attempts.length; i++) {
321
+ var curlArgs = [
322
+ '-sS', '-m', '10',
323
+ ].concat(attempts[i], [
324
+ '-X', 'POST',
325
+ '-H', 'Content-Type: application/json',
326
+ '--data-binary', '@' + payloadFile,
327
+ '-K', '-',
328
+ url,
329
+ ]);
330
+ try {
331
+ return execFileSync('curl', curlArgs, {
332
+ input: _curlAuthConfig(nodeSecret),
333
+ timeout: 12000,
334
+ windowsHide: true,
335
+ stdio: ['pipe', 'pipe', 'pipe'],
336
+ encoding: 'utf8',
337
+ });
338
+ } catch (err) {
339
+ lastErr = err;
340
+ }
341
+ }
342
+ throw lastErr || new Error('curl_failed');
276
343
  });
277
344
  } catch (_) {
278
345
  return [];
@@ -659,4 +726,5 @@ module.exports = {
659
726
  extractSignals, hasOpportunitySignal, analyzeRecentHistory,
660
727
  OPPORTUNITY_SIGNALS, SIGNAL_PROFILES,
661
728
  _extractRegex, _extractKeywordScore, _extractLLM, _mergeSignals,
729
+ _curlHubIpFamilyArgs, _curlHubIpFamilyAttempts, _curlAuthConfig,
662
730
  };