@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.
- package/.cursor/BUGBOT.md +182 -0
- package/.env.example +68 -0
- package/.git-commit-guard-token +1 -0
- package/.github/CODEOWNERS +63 -0
- package/.github/ISSUE_TEMPLATE/good_first_issue.md +23 -0
- package/.github/pull_request_template.md +45 -0
- package/.github/workflows/test.yml +75 -0
- package/CHANGELOG.md +1367 -0
- package/README.ja-JP.md +1 -1
- package/README.ko-KR.md +1 -1
- package/README.md +90 -536
- package/README.public.md +578 -0
- package/README.zh-CN.md +1 -1
- package/SECURITY.md +108 -0
- package/assets/gep/events.jsonl +3 -0
- package/examples/atp-consumer-quickstart.md +100 -0
- package/examples/hello-world.md +38 -0
- package/index.js +5 -3
- package/package.json +6 -18
- package/proxy-package.json +39 -0
- package/public.manifest.json +145 -0
- package/src/adapters/scripts/evolver-session-end.js +18 -37
- package/src/atp/atpExecute.js +27 -71
- package/src/atp/serviceHelper.js +28 -36
- package/src/config.js +17 -0
- package/src/evolve/guards.js +721 -1
- package/src/evolve/pipeline/collect.js +1283 -1
- package/src/evolve/pipeline/dispatch.js +421 -1
- package/src/evolve/pipeline/enrich.js +440 -1
- package/src/evolve/pipeline/hub.js +319 -1
- package/src/evolve/pipeline/select.js +274 -1
- package/src/evolve/pipeline/signals.js +206 -1
- package/src/evolve/utils.js +264 -1
- package/src/evolve.js +350 -1
- package/src/gep/a2aProtocol.js +4463 -1
- package/src/gep/antiAbuseTelemetry.js +233 -1
- package/src/gep/autoDistillConv.js +205 -1
- package/src/gep/autoDistillLlm.js +315 -1
- package/src/gep/candidateEval.js +92 -1
- package/src/gep/candidates.js +198 -1
- package/src/gep/contentHash.js +30 -1
- package/src/gep/conversationDistiller.js +270 -0
- package/src/gep/conversationSniffer.js +266 -1
- package/src/gep/crypto.js +89 -1
- package/src/gep/curriculum.js +163 -1
- package/src/gep/deviceId.js +218 -1
- package/src/gep/envFingerprint.js +118 -1
- package/src/gep/epigenetics.js +31 -1
- package/src/gep/execBridge.js +712 -1
- package/src/gep/explore.js +289 -1
- package/src/gep/hash.js +15 -1
- package/src/gep/hubFetch.js +608 -1
- package/src/gep/hubReview.js +207 -1
- package/src/gep/hubSearch.js +526 -1
- package/src/gep/hubVerify.js +306 -1
- package/src/gep/learningSignals.js +89 -1
- package/src/gep/memoryGraph.js +1449 -1
- package/src/gep/memoryGraphAdapter.js +203 -1
- package/src/gep/mutation.js +203 -1
- package/src/gep/narrativeMemory.js +108 -1
- package/src/gep/oauthLogin.js +9 -3
- package/src/gep/openPRRegistry.js +205 -1
- package/src/gep/personality.js +423 -1
- package/src/gep/policyCheck.js +599 -1
- package/src/gep/privacyClient.js +10 -9
- package/src/gep/prompt.js +836 -1
- package/src/gep/questionGenerator.js +103 -0
- package/src/gep/recallInject.js +409 -1
- package/src/gep/recallVerifier.js +318 -1
- package/src/gep/reflection.js +177 -1
- package/src/gep/savingsCore.js +112 -1
- package/src/gep/selector.js +602 -1
- package/src/gep/signals.js +85 -17
- package/src/gep/skillDistiller.js +1294 -1
- package/src/gep/solidify.js +1699 -1
- package/src/gep/strategy.js +136 -1
- package/src/gep/tokenSavings.js +95 -1
- package/src/gep/workspaceKeychain.js +174 -1
- package/src/proxy/extensions/traceControl.js +109 -1
- package/src/proxy/index.js +100 -3
- package/src/proxy/inject.js +52 -1
- package/src/proxy/lifecycle/manager.js +108 -7
- package/src/proxy/server/routes.js +41 -7
- package/src/proxy/server/settings.js +6 -2
- package/src/proxy/sync/engine.js +31 -15
- package/src/proxy/sync/inbound.js +87 -9
- package/src/proxy/sync/outbound.js +57 -4
- package/src/proxy/trace/extractor.js +1403 -1
- package/src/proxy/trace/usage.js +105 -1
- package/CONTRIBUTING.md +0 -19
- package/assets/cover.png +0 -0
- package/scripts/a2a_export.js +0 -63
- package/scripts/a2a_ingest.js +0 -79
- package/scripts/a2a_promote.js +0 -118
- package/scripts/analyze_by_skill.js +0 -121
- package/scripts/build_binaries.js +0 -479
- package/scripts/check-changelog.js +0 -166
- package/scripts/extract_log.js +0 -85
- package/scripts/generate_history.js +0 -75
- package/scripts/gep_append_event.js +0 -96
- package/scripts/gep_personality_report.js +0 -234
- package/scripts/human_report.js +0 -147
- package/scripts/recall-verify-report.js +0 -234
- package/scripts/recover_loop.js +0 -61
- package/scripts/refresh_stars_badge.js +0 -168
- package/scripts/seed-merchants.js +0 -91
- package/scripts/suggest_version.js +0 -89
- package/scripts/validate-modules.js +0 -38
- package/scripts/validate-suite.js +0 -78
- package/skills/index.json +0 -14
- /package/assets/gep/{genes.seed.json → genes.json} +0 -0
- /package/{skills → bundled-skills}/_meta/SKILL.md +0 -0
package/src/atp/atpExecute.js
CHANGED
|
@@ -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 {
|
|
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
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
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
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
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() {
|
package/src/atp/serviceHelper.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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,
|