@evomap/evolver 1.89.10 → 1.89.12

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 (112) hide show
  1. package/.cursor/BUGBOT.md +182 -0
  2. package/.env.example +68 -0
  3. package/.git-commit-guard-token +1 -0
  4. package/.github/CODEOWNERS +63 -0
  5. package/.github/ISSUE_TEMPLATE/good_first_issue.md +23 -0
  6. package/.github/pull_request_template.md +45 -0
  7. package/.github/workflows/test.yml +75 -0
  8. package/CHANGELOG.md +1367 -0
  9. package/README.ja-JP.md +1 -1
  10. package/README.ko-KR.md +1 -1
  11. package/README.md +90 -536
  12. package/README.public.md +578 -0
  13. package/README.zh-CN.md +1 -1
  14. package/SECURITY.md +108 -0
  15. package/assets/gep/events.jsonl +3 -0
  16. package/examples/atp-consumer-quickstart.md +100 -0
  17. package/examples/hello-world.md +38 -0
  18. package/index.js +5 -3
  19. package/package.json +6 -18
  20. package/proxy-package.json +39 -0
  21. package/public.manifest.json +145 -0
  22. package/src/adapters/scripts/evolver-session-end.js +18 -37
  23. package/src/atp/atpExecute.js +27 -71
  24. package/src/atp/serviceHelper.js +28 -36
  25. package/src/config.js +17 -0
  26. package/src/evolve/guards.js +721 -1
  27. package/src/evolve/pipeline/collect.js +1283 -1
  28. package/src/evolve/pipeline/dispatch.js +421 -1
  29. package/src/evolve/pipeline/enrich.js +440 -1
  30. package/src/evolve/pipeline/hub.js +319 -1
  31. package/src/evolve/pipeline/select.js +274 -1
  32. package/src/evolve/pipeline/signals.js +206 -1
  33. package/src/evolve/utils.js +264 -1
  34. package/src/evolve.js +350 -1
  35. package/src/gep/a2aProtocol.js +4463 -1
  36. package/src/gep/antiAbuseTelemetry.js +233 -1
  37. package/src/gep/autoDistillConv.js +205 -1
  38. package/src/gep/autoDistillLlm.js +315 -1
  39. package/src/gep/candidateEval.js +92 -1
  40. package/src/gep/candidates.js +198 -1
  41. package/src/gep/contentHash.js +30 -1
  42. package/src/gep/conversationDistiller.js +270 -0
  43. package/src/gep/conversationSniffer.js +266 -1
  44. package/src/gep/crypto.js +89 -1
  45. package/src/gep/curriculum.js +163 -1
  46. package/src/gep/deviceId.js +218 -1
  47. package/src/gep/envFingerprint.js +118 -1
  48. package/src/gep/epigenetics.js +31 -1
  49. package/src/gep/execBridge.js +712 -1
  50. package/src/gep/explore.js +289 -1
  51. package/src/gep/hash.js +15 -1
  52. package/src/gep/hubFetch.js +608 -1
  53. package/src/gep/hubReview.js +207 -1
  54. package/src/gep/hubSearch.js +526 -1
  55. package/src/gep/hubVerify.js +306 -1
  56. package/src/gep/learningSignals.js +89 -1
  57. package/src/gep/memoryGraph.js +1449 -1
  58. package/src/gep/memoryGraphAdapter.js +203 -1
  59. package/src/gep/mutation.js +203 -1
  60. package/src/gep/narrativeMemory.js +108 -1
  61. package/src/gep/oauthLogin.js +9 -3
  62. package/src/gep/openPRRegistry.js +205 -1
  63. package/src/gep/personality.js +423 -1
  64. package/src/gep/policyCheck.js +599 -1
  65. package/src/gep/privacyClient.js +10 -9
  66. package/src/gep/prompt.js +836 -1
  67. package/src/gep/questionGenerator.js +103 -0
  68. package/src/gep/recallInject.js +409 -1
  69. package/src/gep/recallVerifier.js +318 -1
  70. package/src/gep/reflection.js +177 -1
  71. package/src/gep/savingsCore.js +112 -1
  72. package/src/gep/selector.js +602 -1
  73. package/src/gep/signals.js +85 -17
  74. package/src/gep/skillDistiller.js +1294 -1
  75. package/src/gep/solidify.js +1699 -1
  76. package/src/gep/strategy.js +136 -1
  77. package/src/gep/tokenSavings.js +95 -1
  78. package/src/gep/workspaceKeychain.js +174 -1
  79. package/src/proxy/extensions/traceControl.js +109 -1
  80. package/src/proxy/index.js +100 -3
  81. package/src/proxy/inject.js +52 -1
  82. package/src/proxy/lifecycle/manager.js +108 -7
  83. package/src/proxy/server/routes.js +41 -7
  84. package/src/proxy/server/settings.js +6 -2
  85. package/src/proxy/sync/engine.js +31 -15
  86. package/src/proxy/sync/inbound.js +87 -9
  87. package/src/proxy/sync/outbound.js +57 -4
  88. package/src/proxy/trace/extractor.js +1403 -1
  89. package/src/proxy/trace/usage.js +105 -1
  90. package/CONTRIBUTING.md +0 -19
  91. package/assets/cover.png +0 -0
  92. package/scripts/a2a_export.js +0 -63
  93. package/scripts/a2a_ingest.js +0 -79
  94. package/scripts/a2a_promote.js +0 -118
  95. package/scripts/analyze_by_skill.js +0 -121
  96. package/scripts/build_binaries.js +0 -479
  97. package/scripts/check-changelog.js +0 -166
  98. package/scripts/extract_log.js +0 -85
  99. package/scripts/generate_history.js +0 -75
  100. package/scripts/gep_append_event.js +0 -96
  101. package/scripts/gep_personality_report.js +0 -234
  102. package/scripts/human_report.js +0 -147
  103. package/scripts/recall-verify-report.js +0 -234
  104. package/scripts/recover_loop.js +0 -61
  105. package/scripts/refresh_stars_badge.js +0 -168
  106. package/scripts/seed-merchants.js +0 -91
  107. package/scripts/suggest_version.js +0 -89
  108. package/scripts/validate-modules.js +0 -38
  109. package/scripts/validate-suite.js +0 -78
  110. package/skills/index.json +0 -14
  111. /package/assets/gep/{genes.seed.json → genes.json} +0 -0
  112. /package/{skills → bundled-skills}/_meta/SKILL.md +0 -0
@@ -22,12 +22,10 @@
22
22
  // idempotent server-side).
23
23
 
24
24
  const fs = require('fs');
25
- const http = require('http');
26
- const https = require('https');
27
25
  const crypto = require('crypto');
28
26
 
29
27
  const { computeAssetId } = require('../gep/contentHash');
30
- const { enforceHubScheme, strictHttpsAgent } = require('../gep/hubFetch');
28
+ const { hubFetch } = require('../gep/hubFetch');
31
29
  const {
32
30
  getNodeId,
33
31
  getHubUrl,
@@ -126,77 +124,35 @@ function _publishUrl() {
126
124
  return base + '/a2a/publish';
127
125
  }
128
126
 
129
- function _postJson(urlStr, body, timeoutMs) {
130
- return new Promise(function (resolve) {
131
- // Same TLS posture as hubFetch: refuse plain http:// unless
132
- // EVOMAP_HUB_ALLOW_INSECURE=1. Before this guard the function
133
- // silently fell back to `lib = http` for any non-https URL, so an
134
- // operator override `A2A_HUB_URL=http://...` would send /a2a/publish
135
- // and /a2a/task/complete in cleartext while hubFetch-routed calls
136
- // (e.g. /a2a/verify-solidify) refused the same URL — inconsistent
137
- // TLS enforcement across modules.
138
- try {
139
- enforceHubScheme(urlStr);
140
- } catch (e) {
141
- resolve({ ok: false, error: 'tls_refused: ' + (e && e.message) });
142
- return;
143
- }
144
- let parsed;
145
- try {
146
- parsed = new URL(urlStr);
147
- } catch (e) {
148
- resolve({ ok: false, error: 'invalid_url: ' + (e && e.message) });
149
- return;
150
- }
151
- const isHttps = parsed.protocol === 'https:';
152
- const lib = isHttps ? https : http;
153
- const payload = JSON.stringify(body || {});
154
- const headers = Object.assign(
155
- { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) },
156
- buildHubHeaders() || {},
157
- );
158
- // Pin TLS cert verification for https calls so a globally-disabled
159
- // NODE_TLS_REJECT_UNAUTHORIZED=0 cannot weaken the Hub channel
160
- // (Cursor Security Reviewer #160 Medium). hubFetch enforces the
161
- // same via its undici dispatcher; this is the Node-native-https
162
- // equivalent.
163
- //
164
- // Skipped under EVOMAP_HUB_ALLOW_INSECURE=1 so local-dev / self-
165
- // signed mock hubs that legitimately rely on
166
- // NODE_TLS_REJECT_UNAUTHORIZED=0 still work.
167
- const requestOpts = {
168
- hostname: parsed.hostname,
169
- port: parsed.port || (isHttps ? 443 : 80),
170
- path: parsed.pathname + (parsed.search || ''),
127
+ async function _postJson(urlStr, body, timeoutMs) {
128
+ const payload = JSON.stringify(body || {});
129
+ const headers = Object.assign(
130
+ { 'Content-Type': 'application/json' },
131
+ buildHubHeaders() || {},
132
+ );
133
+
134
+ try {
135
+ const res = await hubFetch(urlStr, {
171
136
  method: 'POST',
172
137
  headers: headers,
173
- timeout: timeoutMs || PUBLISH_TIMEOUT_MS,
174
- };
175
- if (isHttps && process.env.EVOMAP_HUB_ALLOW_INSECURE !== '1') {
176
- requestOpts.agent = strictHttpsAgent;
138
+ body: payload,
139
+ signal: AbortSignal.timeout(timeoutMs || PUBLISH_TIMEOUT_MS),
140
+ });
141
+ const text = await res.text();
142
+ let data = null;
143
+ try { data = text ? JSON.parse(text) : null; } catch (e) { data = { raw: text }; }
144
+ if (res.status >= 200 && res.status < 300) {
145
+ return { ok: true, status: res.status, data };
177
146
  }
178
- const req = lib.request(
179
- requestOpts,
180
- function (res) {
181
- const chunks = [];
182
- res.on('data', function (c) { chunks.push(c); });
183
- res.on('end', function () {
184
- const text = Buffer.concat(chunks).toString('utf8');
185
- let data = null;
186
- try { data = text ? JSON.parse(text) : null; } catch (e) { data = { raw: text }; }
187
- if (res.statusCode >= 200 && res.statusCode < 300) {
188
- resolve({ ok: true, status: res.statusCode, data });
189
- } else {
190
- resolve({ ok: false, status: res.statusCode, data, error: 'http_' + res.statusCode });
191
- }
192
- });
193
- },
194
- );
195
- req.on('timeout', function () { req.destroy(new Error('timeout')); });
196
- req.on('error', function (err) { resolve({ ok: false, error: err.message }); });
197
- req.write(payload);
198
- req.end();
199
- });
147
+ return { ok: false, status: res.status, data, error: 'http_' + res.status };
148
+ } catch (err) {
149
+ const msg = (err && err.message) || String(err);
150
+ if (msg.indexOf('[hubFetch]') !== -1) {
151
+ if (/not a valid URL/i.test(msg)) return { ok: false, error: 'invalid_url: ' + msg };
152
+ return { ok: false, error: 'tls_refused: ' + msg };
153
+ }
154
+ return { ok: false, error: msg };
155
+ }
200
156
  }
201
157
 
202
158
  async function _ensureNodeSecret() {
@@ -1,6 +1,32 @@
1
1
  // ATP Service Helper -- wraps marketplace service publishing for merchant agents.
2
2
 
3
3
  const { getNodeId, buildHubHeaders, getHubUrl } = require('../gep/a2aProtocol');
4
+ const { hubFetch } = require('../gep/hubFetch');
5
+ const { HTTP_TRANSPORT_TIMEOUT_MS } = require('../config');
6
+
7
+ async function postService(endpoint, body) {
8
+ try {
9
+ const res = await hubFetch(endpoint, {
10
+ method: 'POST',
11
+ headers: Object.assign({ 'Content-Type': 'application/json' }, buildHubHeaders() || {}),
12
+ body: JSON.stringify(body),
13
+ signal: AbortSignal.timeout(HTTP_TRANSPORT_TIMEOUT_MS),
14
+ });
15
+
16
+ if (!res.ok) {
17
+ const t = await res.text();
18
+ return { ok: false, status: res.status, error: t.slice(0, 400) };
19
+ }
20
+ const data = await res.json();
21
+ return { ok: true, data };
22
+ } catch (err) {
23
+ const msg = (err && err.message) || String(err);
24
+ if (msg.indexOf('[hubFetch]') !== -1) {
25
+ return { ok: false, error: 'tls_refused: ' + msg };
26
+ }
27
+ return { ok: false, error: msg };
28
+ }
29
+ }
4
30
 
5
31
  /**
6
32
  * Publish a ServiceListing via the Hub marketplace API.
@@ -21,7 +47,6 @@ async function publishService(svc) {
21
47
 
22
48
  const nodeId = getNodeId();
23
49
  const endpoint = hubUrl.replace(/\/+$/, '') + '/a2a/service/publish';
24
- const timeout = require('../config').HTTP_TRANSPORT_TIMEOUT_MS;
25
50
 
26
51
  const body = {
27
52
  sender_id: nodeId,
@@ -35,23 +60,7 @@ async function publishService(svc) {
35
60
  recipe_id: svc.recipeId,
36
61
  };
37
62
 
38
- try {
39
- const res = await fetch(endpoint, {
40
- method: 'POST',
41
- headers: buildHubHeaders(),
42
- body: JSON.stringify(body),
43
- signal: AbortSignal.timeout(timeout),
44
- });
45
-
46
- if (!res.ok) {
47
- const t = await res.text();
48
- return { ok: false, status: res.status, error: t.slice(0, 400) };
49
- }
50
- const data = await res.json();
51
- return { ok: true, data };
52
- } catch (err) {
53
- return { ok: false, error: err.message };
54
- }
63
+ return postService(endpoint, body);
55
64
  }
56
65
 
57
66
  /**
@@ -66,7 +75,6 @@ async function updateService(listingId, updates) {
66
75
 
67
76
  const nodeId = getNodeId();
68
77
  const endpoint = hubUrl.replace(/\/+$/, '') + '/a2a/service/update';
69
- const timeout = require('../config').HTTP_TRANSPORT_TIMEOUT_MS;
70
78
 
71
79
  const body = {
72
80
  sender_id: nodeId,
@@ -74,23 +82,7 @@ async function updateService(listingId, updates) {
74
82
  ...updates,
75
83
  };
76
84
 
77
- try {
78
- const res = await fetch(endpoint, {
79
- method: 'POST',
80
- headers: buildHubHeaders(),
81
- body: JSON.stringify(body),
82
- signal: AbortSignal.timeout(timeout),
83
- });
84
-
85
- if (!res.ok) {
86
- const t = await res.text();
87
- return { ok: false, status: res.status, error: t.slice(0, 400) };
88
- }
89
- const data = await res.json();
90
- return { ok: true, data };
91
- } catch (err) {
92
- return { ok: false, error: err.message };
93
- }
85
+ return postService(endpoint, body);
94
86
  }
95
87
 
96
88
  module.exports = {
package/src/config.js CHANGED
@@ -202,6 +202,20 @@ function reuseAttributionMode() {
202
202
  return v === 'shadow' ? 'shadow' : 'off';
203
203
  }
204
204
 
205
+ // Opt-in Hub reuse-OUTCOME reporting (P4-a Slice B, client side). When 'on', the
206
+ // evolver POSTs {signals, status, used_asset_ids} to the Hub's /a2a/memory/record
207
+ // so the reuse-reward attribution pipeline (which reads THAT endpoint, not the
208
+ // inert reuse_attribution blob on /a2a/memory/event) finally gets data.
209
+ // MONEY-ADJACENT and charges Hub credits -> default 'off'. The Hub still
210
+ // re-verifies every used_asset_id against its own AssetFetcher rows before
211
+ // crediting. Also requires EVOLVER_REUSE_ATTRIBUTION=shadow, which is what builds
212
+ // the cycle-correlated, timestamp-guarded attribution this report consumes.
213
+ const OUTCOME_REPORT_MODE = envStr('EVOLVER_OUTCOME_REPORT', 'off');
214
+ function outcomeReportMode() {
215
+ const v = String(process.env.EVOLVER_OUTCOME_REPORT || OUTCOME_REPORT_MODE || 'off').toLowerCase().trim();
216
+ return v === 'on' || v === 'enforce' || v === 'true' ? 'on' : 'off';
217
+ }
218
+
205
219
  // --- Anti-abuse telemetry (privacy-preserving heartbeat summary) ---
206
220
  // Enabled by default. In heartbeat mode, clients attach a small
207
221
  // `meta.anti_abuse` envelope with low-sensitive hashes, source-confidence
@@ -306,6 +320,9 @@ module.exports = {
306
320
  // Reuse attribution (P4-a Slice A)
307
321
  REUSE_ATTRIBUTION_MODE,
308
322
  reuseAttributionMode,
323
+ // Reuse-outcome Hub reporting (P4-a Slice B, opt-in)
324
+ OUTCOME_REPORT_MODE,
325
+ outcomeReportMode,
309
326
  // Anti-abuse telemetry
310
327
  ANTI_ABUSE_TELEMETRY_MODE,
311
328
  antiAbuseTelemetryMode,