@evomap/evolver 1.90.0 → 2.0.0-beta.0

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 (231) hide show
  1. package/README.md +27 -564
  2. package/bin/evolver-llm-proxy.js +3 -0
  3. package/bin/evolver-mcp.js +2 -0
  4. package/bin/evolver-proxy.js +3 -0
  5. package/bin/evolver.js +4 -0
  6. package/index.js +1 -3670
  7. package/package.json +32 -62
  8. package/CONTRIBUTING.md +0 -19
  9. package/LICENSE +0 -641
  10. package/README.ja-JP.md +0 -521
  11. package/README.ko-KR.md +0 -520
  12. package/README.zh-CN.md +0 -531
  13. package/SKILL.md +0 -365
  14. package/assets/cover.png +0 -0
  15. package/assets/gep/genes.seed.json +0 -496
  16. package/conformance/savings-core/constants.json +0 -30
  17. package/conformance/savings-core/golden-vectors.json +0 -333
  18. package/scripts/a2a_export.js +0 -63
  19. package/scripts/a2a_ingest.js +0 -79
  20. package/scripts/a2a_promote.js +0 -118
  21. package/scripts/analyze_by_skill.js +0 -121
  22. package/scripts/build_binaries.js +0 -479
  23. package/scripts/check-changelog.js +0 -166
  24. package/scripts/extract_log.js +0 -85
  25. package/scripts/generate_history.js +0 -75
  26. package/scripts/gep_append_event.js +0 -96
  27. package/scripts/gep_personality_report.js +0 -234
  28. package/scripts/human_report.js +0 -147
  29. package/scripts/recall-verify-report.js +0 -234
  30. package/scripts/recover_loop.js +0 -61
  31. package/scripts/refresh_stars_badge.js +0 -168
  32. package/scripts/seed-merchants.js +0 -91
  33. package/scripts/skill2recipes.js +0 -118
  34. package/scripts/suggest_version.js +0 -89
  35. package/scripts/validate-modules.js +0 -38
  36. package/scripts/validate-suite.js +0 -78
  37. package/src/adapters/claudeCode.js +0 -194
  38. package/src/adapters/codex.js +0 -216
  39. package/src/adapters/cursor.js +0 -91
  40. package/src/adapters/hookAdapter.js +0 -469
  41. package/src/adapters/kiro.js +0 -195
  42. package/src/adapters/opencode.js +0 -326
  43. package/src/adapters/scripts/_lockPaths.js +0 -74
  44. package/src/adapters/scripts/_memoryFiltering.js +0 -35
  45. package/src/adapters/scripts/_runtimePaths.js +0 -440
  46. package/src/adapters/scripts/evolver-session-end.js +0 -321
  47. package/src/adapters/scripts/evolver-session-start.js +0 -587
  48. package/src/adapters/scripts/evolver-signal-detect.js +0 -98
  49. package/src/adapters/scripts/evolver-task-recall.js +0 -173
  50. package/src/atp/atpExecute.js +0 -283
  51. package/src/atp/atpTaskPickup.js +0 -233
  52. package/src/atp/autoBuyer.js +0 -382
  53. package/src/atp/autoDeliver.js +0 -215
  54. package/src/atp/cli.js +0 -354
  55. package/src/atp/cliAutobuyPrompt.js +0 -154
  56. package/src/atp/consumerAgent.js +0 -157
  57. package/src/atp/defaultHandler.js +0 -69
  58. package/src/atp/heartbeatSignalsHandler.js +0 -254
  59. package/src/atp/hubClient.js +0 -317
  60. package/src/atp/index.js +0 -38
  61. package/src/atp/merchantAgent.js +0 -118
  62. package/src/atp/protocol.js +0 -41
  63. package/src/atp/questionComposer.js +0 -133
  64. package/src/atp/serviceHelper.js +0 -92
  65. package/src/canary.js +0 -13
  66. package/src/config.js +0 -351
  67. package/src/evolve/guards.js +0 -1
  68. package/src/evolve/pipeline/collect.js +0 -1
  69. package/src/evolve/pipeline/dispatch.js +0 -1
  70. package/src/evolve/pipeline/enrich.js +0 -1
  71. package/src/evolve/pipeline/hub.js +0 -1
  72. package/src/evolve/pipeline/select.js +0 -1
  73. package/src/evolve/pipeline/signals.js +0 -1
  74. package/src/evolve/utils.js +0 -1
  75. package/src/evolve.js +0 -1
  76. package/src/experiment/agentRunner.js +0 -229
  77. package/src/experiment/cli.js +0 -159
  78. package/src/experiment/comparison.js +0 -233
  79. package/src/experiment/metrics.js +0 -75
  80. package/src/forceUpdate.js +0 -991
  81. package/src/gep/a2a.js +0 -173
  82. package/src/gep/a2aProtocol.js +0 -1
  83. package/src/gep/analyzer.js +0 -35
  84. package/src/gep/antiAbuseTelemetry.js +0 -1
  85. package/src/gep/assetCallLog.js +0 -197
  86. package/src/gep/assetStore.js +0 -723
  87. package/src/gep/assets.js +0 -36
  88. package/src/gep/autoDistillConv.js +0 -1
  89. package/src/gep/autoDistillLlm.js +0 -1
  90. package/src/gep/bridge.js +0 -138
  91. package/src/gep/candidateEval.js +0 -1
  92. package/src/gep/candidates.js +0 -1
  93. package/src/gep/claimNudge.js +0 -121
  94. package/src/gep/cliContracts.js +0 -1190
  95. package/src/gep/contentHash.js +0 -1
  96. package/src/gep/conversationDistiller.js +0 -1
  97. package/src/gep/conversationSniffer.js +0 -1
  98. package/src/gep/crypto.js +0 -1
  99. package/src/gep/curriculum.js +0 -1
  100. package/src/gep/deviceId.js +0 -1
  101. package/src/gep/directoryClient.js +0 -115
  102. package/src/gep/envFingerprint.js +0 -1
  103. package/src/gep/epigenetics.js +0 -1
  104. package/src/gep/execBridge.js +0 -1
  105. package/src/gep/executionTrace.js +0 -291
  106. package/src/gep/explore.js +0 -1
  107. package/src/gep/featureFlags.js +0 -121
  108. package/src/gep/gitOps.js +0 -265
  109. package/src/gep/hash.js +0 -1
  110. package/src/gep/hostErrorClassifier.js +0 -34
  111. package/src/gep/hubFetch.js +0 -1
  112. package/src/gep/hubReview.js +0 -1
  113. package/src/gep/hubSearch.js +0 -1
  114. package/src/gep/hubVerify.js +0 -1
  115. package/src/gep/idleScheduler.js +0 -400
  116. package/src/gep/issueReporter.js +0 -416
  117. package/src/gep/learningSignals.js +0 -1
  118. package/src/gep/llmReview.js +0 -92
  119. package/src/gep/localStateAwareness.js +0 -243
  120. package/src/gep/mailboxTransport.js +0 -119
  121. package/src/gep/memoryGraph.js +0 -1
  122. package/src/gep/memoryGraphAdapter.js +0 -1
  123. package/src/gep/mutation.js +0 -1
  124. package/src/gep/narrativeMemory.js +0 -1
  125. package/src/gep/oauthLogin.js +0 -181
  126. package/src/gep/openPRRegistry.js +0 -1
  127. package/src/gep/paths.js +0 -522
  128. package/src/gep/personality.js +0 -1
  129. package/src/gep/policyCheck.js +0 -1
  130. package/src/gep/portable.js +0 -103
  131. package/src/gep/privacyClient.js +0 -235
  132. package/src/gep/prompt.js +0 -1
  133. package/src/gep/questionGenerator.js +0 -518
  134. package/src/gep/recallInject.js +0 -1
  135. package/src/gep/recallVerifier.js +0 -1
  136. package/src/gep/reflection.js +0 -1
  137. package/src/gep/sanitize.js +0 -264
  138. package/src/gep/savingsCore.js +0 -1
  139. package/src/gep/schemas/capsule.js +0 -170
  140. package/src/gep/schemas/gene.js +0 -154
  141. package/src/gep/schemas/index.js +0 -8
  142. package/src/gep/schemas/protocol.js +0 -51
  143. package/src/gep/schemas/task.js +0 -74
  144. package/src/gep/selector.js +0 -1
  145. package/src/gep/selfPR.js +0 -469
  146. package/src/gep/signals.js +0 -776
  147. package/src/gep/skill2gep.js +0 -1056
  148. package/src/gep/skill2gepAudit.js +0 -303
  149. package/src/gep/skill2recipes.js +0 -511
  150. package/src/gep/skillDistiller.js +0 -1
  151. package/src/gep/skillPublisher.js +0 -358
  152. package/src/gep/solidify.js +0 -1
  153. package/src/gep/strategy.js +0 -1
  154. package/src/gep/taskReceiver.js +0 -575
  155. package/src/gep/tokenSavings.js +0 -1
  156. package/src/gep/trajectoryExport.js +0 -1
  157. package/src/gep/validationReport.js +0 -55
  158. package/src/gep/validator/index.js +0 -411
  159. package/src/gep/validator/reporter.js +0 -210
  160. package/src/gep/validator/sandboxExecutor.js +0 -480
  161. package/src/gep/validator/stakeBootstrap.js +0 -357
  162. package/src/gep/workspaceKeychain.js +0 -1
  163. package/src/ops/cleanup.js +0 -80
  164. package/src/ops/commentary.js +0 -60
  165. package/src/ops/health_check.js +0 -104
  166. package/src/ops/index.js +0 -11
  167. package/src/ops/innovation.js +0 -67
  168. package/src/ops/lifecycle.js +0 -798
  169. package/src/ops/self_repair.js +0 -76
  170. package/src/ops/skills_monitor.js +0 -147
  171. package/src/ops/trigger.js +0 -33
  172. package/src/proxy/clientSettings.js +0 -405
  173. package/src/proxy/envelope.js +0 -59
  174. package/src/proxy/extensions/dmHandler.js +0 -45
  175. package/src/proxy/extensions/sessionHandler.js +0 -141
  176. package/src/proxy/extensions/skillUpdater.js +0 -64
  177. package/src/proxy/extensions/traceControl.js +0 -1
  178. package/src/proxy/index.js +0 -1395
  179. package/src/proxy/inject.js +0 -1
  180. package/src/proxy/lifecycle/manager.js +0 -1568
  181. package/src/proxy/mailbox/state.js +0 -207
  182. package/src/proxy/mailbox/store.js +0 -602
  183. package/src/proxy/router/cache_passthrough.js +0 -26
  184. package/src/proxy/router/features.js +0 -84
  185. package/src/proxy/router/gemini_route.js +0 -154
  186. package/src/proxy/router/messages_route.js +0 -535
  187. package/src/proxy/router/model_router.js +0 -113
  188. package/src/proxy/router/models_route.js +0 -52
  189. package/src/proxy/router/ollama_route.js +0 -103
  190. package/src/proxy/router/responses_route.js +0 -170
  191. package/src/proxy/router/vertex_route.js +0 -110
  192. package/src/proxy/server/http.js +0 -363
  193. package/src/proxy/server/routes.js +0 -558
  194. package/src/proxy/server/settings.js +0 -115
  195. package/src/proxy/sync/engine.js +0 -179
  196. package/src/proxy/sync/inbound.js +0 -211
  197. package/src/proxy/sync/outbound.js +0 -361
  198. package/src/proxy/task/monitor.js +0 -131
  199. package/src/proxy/trace/extractor.js +0 -1
  200. package/src/proxy/trace/usage.js +0 -1
  201. package/src/solo/breaker.js +0 -25
  202. package/src/solo/gitGuard.js +0 -65
  203. package/src/webui/client/clientJs/assets.js +0 -111
  204. package/src/webui/client/clientJs/bootstrap.js +0 -92
  205. package/src/webui/client/clientJs/common.js +0 -77
  206. package/src/webui/client/clientJs/i18n.js +0 -366
  207. package/src/webui/client/clientJs/index.js +0 -35
  208. package/src/webui/client/clientJs/interactions.js +0 -351
  209. package/src/webui/client/clientJs/overview.js +0 -152
  210. package/src/webui/client/clientJs/personality.js +0 -285
  211. package/src/webui/client/clientJs/pipelines.js +0 -330
  212. package/src/webui/client/indexHtml.js +0 -221
  213. package/src/webui/client/static.js +0 -23
  214. package/src/webui/client/stylesCss.js +0 -639
  215. package/src/webui/client/vendor/README.md +0 -15
  216. package/src/webui/client/vendor/echarts.min.js +0 -45
  217. package/src/webui/index.js +0 -14
  218. package/src/webui/observer/assets.js +0 -146
  219. package/src/webui/observer/index.js +0 -37
  220. package/src/webui/observer/interactions.js +0 -127
  221. package/src/webui/observer/jsonl.js +0 -75
  222. package/src/webui/observer/paths.js +0 -46
  223. package/src/webui/observer/personality.js +0 -43
  224. package/src/webui/observer/pipelineEvents.js +0 -58
  225. package/src/webui/observer/redact.js +0 -63
  226. package/src/webui/observer/runs.js +0 -356
  227. package/src/webui/observer/safety.js +0 -57
  228. package/src/webui/observer/skills.js +0 -70
  229. package/src/webui/observer/status.js +0 -71
  230. package/src/webui/server/http.js +0 -138
  231. package/src/webui/server/routes.js +0 -41
@@ -1,84 +0,0 @@
1
- 'use strict';
2
-
3
- // Stateless feature extraction for the Anthropic /v1/messages request body.
4
- // Mirrors the field shapes consumed by model_router.js so pickForTurn can
5
- // classify without per-session state. Phase C's "empty history" mode means
6
- // last_assistant_output_tokens / last_assistant_stop_reason are always 0 /
7
- // null; the JS classifier never reads stop_reason anyway (verified in the
8
- // fixture round-trip; documented in model_router.js).
9
-
10
- const PLAN_RE = /\b(plan|design|architect|brainstorm|outline|think through|let'?s think)\b/i;
11
- const SIMPLE_LOOKUP_MAX_CHARS = 80;
12
-
13
- function lastMessageOfRole(messages, role) {
14
- if (!Array.isArray(messages)) return null;
15
- for (let i = messages.length - 1; i >= 0; i--) {
16
- const m = messages[i];
17
- if (m && m.role === role) return m;
18
- }
19
- return null;
20
- }
21
-
22
- function blocksOf(msg) {
23
- if (!msg) return [];
24
- const c = msg.content;
25
- if (typeof c === 'string') return [{ type: 'text', text: c }];
26
- return Array.isArray(c) ? c : [];
27
- }
28
-
29
- function tailUserText(messages) {
30
- if (!Array.isArray(messages) || messages.length === 0) return '';
31
- const tail = messages[messages.length - 1];
32
- if (!tail || tail.role !== 'user') return '';
33
- return blocksOf(tail)
34
- .filter((b) => b && b.type === 'text' && typeof b.text === 'string')
35
- .map((b) => b.text)
36
- .join('\n');
37
- }
38
-
39
- function extractFeatures(body) {
40
- const messages = Array.isArray(body && body.messages) ? body.messages : [];
41
-
42
- const lastAssistant = lastMessageOfRole(messages, 'assistant');
43
- const lastAssistantBlocks = blocksOf(lastAssistant);
44
- const toolCallCount = lastAssistantBlocks.filter((b) => b && b.type === 'tool_use').length;
45
-
46
- const tail = messages[messages.length - 1];
47
- const tailIsUser = !!(tail && tail.role === 'user');
48
- const tailBlocks = blocksOf(tail);
49
- const lastUserIsToolResultOnly = tailIsUser
50
- && tailBlocks.length > 0
51
- && tailBlocks.every((b) => b && b.type === 'tool_result');
52
-
53
- const userText = tailUserText(messages);
54
- const userRequestedPlanning = userText.length > 0 && PLAN_RE.test(userText);
55
- const userSimpleLookup = userText.length > 0
56
- && !lastUserIsToolResultOnly
57
- && !userRequestedPlanning
58
- && userText.trim().length <= SIMPLE_LOOKUP_MAX_CHARS;
59
-
60
- // last_assistant_stop_reason is gated by the classifier's
61
- // post_tool_result_synthesis branch (model_router.js parity invariant).
62
- // We don't have the real Anthropic response on the request side, but the
63
- // shape of the last assistant message lets us reconstruct it deterministically:
64
- // an assistant message with any tool_use block must have ended with
65
- // stop_reason: 'tool_use' (otherwise the API would not have returned that
66
- // block); a text-only assistant message ended with 'end_turn' ('Stop' in the
67
- // Rust enum). Only 'ToolUse' is read by the classifier.
68
- let stopReason = null;
69
- if (lastAssistant) {
70
- stopReason = toolCallCount > 0 ? 'ToolUse' : 'Stop';
71
- }
72
-
73
- return {
74
- last_assistant_tool_call_count: toolCallCount,
75
- last_assistant_had_tool_call: toolCallCount > 0,
76
- last_user_is_tool_result_only: lastUserIsToolResultOnly,
77
- user_requested_planning: userRequestedPlanning,
78
- user_simple_lookup: userSimpleLookup,
79
- last_assistant_output_tokens: 0,
80
- last_assistant_stop_reason: stopReason,
81
- };
82
- }
83
-
84
- module.exports = { extractFeatures, PLAN_RE, SIMPLE_LOOKUP_MAX_CHARS };
@@ -1,154 +0,0 @@
1
- 'use strict';
2
-
3
- // Gemini passthrough handler (format-aware routing, NO translation). A Gemini-shaped request — Google's native
4
- // `/v1beta/models/<model>:generateContent` | `:streamGenerateContent` path, body `{contents, generationConfig,
5
- // systemInstruction, tools}` — is forwarded verbatim to the Gemini upstream. The model + action live in the
6
- // PATH (not the body), so we reconstruct the path (+ query like ?alt=sse) and pass it through. Trace capture
7
- // mirrors the other providers (usage/finish/stream tee). Point the Gemini CLI/SDK's base URL at the proxy and
8
- // it works unmodified — no Anthropic/OpenAI conversion (lossy translation is deliberately avoided).
9
-
10
- const { createProxyTrace } = require('../trace/extractor');
11
-
12
- const GEMINI_RESPONSE_HEADER_ALLOWLIST = new Set([
13
- 'content-type',
14
- 'retry-after',
15
- 'x-request-id',
16
- ]);
17
-
18
- function hasGeminiUpstreamCredential() {
19
- return !!(process.env.EVOMAP_GEMINI_API_KEY || process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY);
20
- }
21
-
22
- function upstreamStatus(err, fallback = 502) {
23
- const status = Number(err && err.statusCode);
24
- return Number.isFinite(status) ? status : fallback;
25
- }
26
-
27
- function asUpstreamError(err, fallback = 502) {
28
- if (err && err.statusCode && /^gemini upstream /.test(err.message || '')) return err;
29
- const out = new Error('gemini upstream request failed');
30
- out.statusCode = upstreamStatus(err, fallback);
31
- out.cause = err;
32
- return out;
33
- }
34
-
35
- function responseToBody(raw, status, headers, log) {
36
- if (!raw) return {};
37
- try {
38
- return JSON.parse(raw);
39
- } catch {
40
- log.warn?.(JSON.stringify({
41
- event: 'gemini_fallback',
42
- reason: 'upstream_non_json',
43
- upstream_status: status,
44
- content_type: (headers && headers['content-type']) || '',
45
- response_bytes: Buffer.byteLength(raw),
46
- }));
47
- return { error: raw };
48
- }
49
- }
50
-
51
- function copyGeminiResponseHeaders(headers = {}) {
52
- const out = {};
53
- for (const [name, value] of Object.entries(headers || {})) {
54
- const lower = String(name || '').toLowerCase();
55
- if (!GEMINI_RESPONSE_HEADER_ALLOWLIST.has(lower) && !lower.startsWith('x-goog-')) continue;
56
- if (value === undefined || value === null) continue;
57
- const headerValue = Array.isArray(value) ? value.join(', ') : String(value);
58
- if (/[\r\n]/.test(headerValue)) continue;
59
- out[lower] = headerValue;
60
- }
61
- return out;
62
- }
63
-
64
- // `<model>:<action>` — the model can contain dots/dashes; the action is the part after the LAST colon
65
- // (generateContent | streamGenerateContent | countTokens | ...). Returns {model, action} (action '' if absent).
66
- function parseModelAction(modelAction) {
67
- const s = String(modelAction || '');
68
- const idx = s.lastIndexOf(':');
69
- if (idx === -1) return { model: s, action: '' };
70
- return { model: s.slice(0, idx), action: s.slice(idx + 1) };
71
- }
72
-
73
- function buildGeminiHandler({ geminiProxy, logger, traceStore, onTraceQueued } = {}) {
74
- if (typeof geminiProxy !== 'function') {
75
- throw new Error('buildGeminiHandler requires geminiProxy(path, body, opts)');
76
- }
77
- const log = logger || console;
78
-
79
- return async ({ body, headers, params, query }) => {
80
- const inboundHeaders = headers || {};
81
- if (!hasGeminiUpstreamCredential()) {
82
- throw Object.assign(new Error('gemini api key required'), { statusCode: 401 });
83
- }
84
-
85
- const modelAction = (params && params.modelAction) || '';
86
- const { model, action } = parseModelAction(modelAction);
87
- // Reconstruct the native Gemini path + query (e.g. ?alt=sse for streaming) and forward verbatim.
88
- const qs = query && Object.keys(query).length ? '?' + new URLSearchParams(query).toString() : '';
89
- const reqPath = `/v1beta/models/${modelAction}${qs}`;
90
-
91
- let trace = null;
92
- try {
93
- trace = createProxyTrace({
94
- route: `POST /v1beta/models/${modelAction}`,
95
- headers: inboundHeaders,
96
- body,
97
- upstreamMode: 'gemini',
98
- originalModel: model,
99
- chosenModel: model,
100
- store: traceStore,
101
- logger: traceStore ? log : null,
102
- onTraceQueued,
103
- });
104
- } catch (_) { /* best-effort trace; never break the request */ }
105
-
106
- let upstream;
107
- try {
108
- upstream = await geminiProxy(reqPath, body, { inboundHeaders, upstreamMode: 'gemini' });
109
- } catch (err) {
110
- const wrapped = asUpstreamError(err, upstreamStatus(err));
111
- trace?.record({ status: wrapped.statusCode, error: wrapped, upstreamMode: 'gemini', model });
112
- throw wrapped;
113
- }
114
-
115
- if (upstream.stream) {
116
- const forwardHeaders = copyGeminiResponseHeaders(upstream.headers);
117
- const ct = upstream.headers && upstream.headers['content-type'];
118
- if (ct) forwardHeaders['Content-Type'] = ct;
119
- trace?.recordStreamStart({ status: upstream.status, upstreamMode: 'gemini', model, headers: forwardHeaders });
120
- return {
121
- status: upstream.status,
122
- // Tee the Gemini SSE body so the deferred trace captures usageMetadata + finishReason. Bytes unchanged.
123
- stream: trace ? trace.observeStream(upstream.stream) : upstream.stream,
124
- headers: forwardHeaders,
125
- };
126
- }
127
-
128
- let raw = '';
129
- if (upstream.text) {
130
- try {
131
- raw = await upstream.text();
132
- } catch (err) {
133
- const wrapped = asUpstreamError(err, upstreamStatus(err));
134
- trace?.record({ status: wrapped.statusCode, error: wrapped, upstreamMode: 'gemini', model });
135
- throw wrapped;
136
- }
137
- }
138
- const respBody = responseToBody(raw, upstream.status, upstream.headers, log);
139
- trace?.record({ status: upstream.status, responseBody: respBody, upstreamMode: 'gemini', model, headers: upstream.headers });
140
- return {
141
- status: upstream.status,
142
- body: respBody,
143
- headers: copyGeminiResponseHeaders(upstream.headers),
144
- };
145
- };
146
- }
147
-
148
- module.exports = {
149
- buildGeminiHandler,
150
- copyGeminiResponseHeaders,
151
- hasGeminiUpstreamCredential,
152
- responseToBody,
153
- parseModelAction,
154
- };