@evomap/evolver 1.87.2 → 1.87.3

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 (65) hide show
  1. package/README.ja-JP.md +1 -1
  2. package/README.ko-KR.md +1 -1
  3. package/README.md +9 -8
  4. package/README.zh-CN.md +9 -8
  5. package/package.json +1 -1
  6. package/scripts/build_binaries.js +31 -7
  7. package/src/atp/atpExecute.js +35 -8
  8. package/src/atp/autoBuyer.js +71 -16
  9. package/src/atp/autoDeliver.js +16 -0
  10. package/src/atp/cliAutobuyPrompt.js +8 -22
  11. package/src/atp/hubClient.js +42 -4
  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/assetStore.js +52 -5
  23. package/src/gep/candidateEval.js +1 -1
  24. package/src/gep/candidates.js +1 -1
  25. package/src/gep/contentHash.js +1 -1
  26. package/src/gep/crypto.js +1 -1
  27. package/src/gep/curriculum.js +1 -1
  28. package/src/gep/deviceId.js +1 -1
  29. package/src/gep/envFingerprint.js +1 -1
  30. package/src/gep/epigenetics.js +1 -1
  31. package/src/gep/explore.js +1 -1
  32. package/src/gep/hash.js +1 -1
  33. package/src/gep/hubFetch.js +1 -1
  34. package/src/gep/hubReview.js +1 -1
  35. package/src/gep/hubSearch.js +1 -1
  36. package/src/gep/hubVerify.js +1 -1
  37. package/src/gep/learningSignals.js +1 -1
  38. package/src/gep/memoryGraph.js +1 -1
  39. package/src/gep/memoryGraphAdapter.js +1 -1
  40. package/src/gep/mutation.js +1 -1
  41. package/src/gep/narrativeMemory.js +1 -1
  42. package/src/gep/openPRRegistry.js +1 -1
  43. package/src/gep/paths.js +6 -2
  44. package/src/gep/personality.js +1 -1
  45. package/src/gep/policyCheck.js +1 -1
  46. package/src/gep/prompt.js +1 -1
  47. package/src/gep/recallVerifier.js +1 -1
  48. package/src/gep/reflection.js +1 -1
  49. package/src/gep/sanitize.js +57 -3
  50. package/src/gep/selector.js +1 -1
  51. package/src/gep/selfPR.js +34 -1
  52. package/src/gep/skill2gep.js +108 -29
  53. package/src/gep/skillDistiller.js +1 -1
  54. package/src/gep/solidify.js +1 -1
  55. package/src/gep/strategy.js +1 -1
  56. package/src/gep/workspaceKeychain.js +1 -1
  57. package/src/proxy/lifecycle/manager.js +97 -37
  58. package/src/proxy/router/messages_route.js +25 -0
  59. package/src/proxy/sync/engine.js +68 -31
  60. package/assets/gep/candidates.jsonl +0 -1
  61. package/assets/gep/capsules.json +0 -4
  62. package/assets/gep/events.jsonl +0 -0
  63. package/assets/gep/failed_capsules.json +0 -4
  64. package/assets/gep/genes.json +0 -245
  65. package/assets/gep/genes.jsonl +0 -0
@@ -65,23 +65,47 @@ class SyncEngine {
65
65
  _scheduleOutbound(delayMs) {
66
66
  if (!this._running) return;
67
67
  this._outTimer = setTimeout(async () => {
68
- if (!this._running) return;
69
- this._outPending = true;
68
+ // Defence-in-depth: a throw from this.outbound.flush(),
69
+ // this.store.countPending(), or any post-flush bookkeeping used
70
+ // to escape the setTimeout callback. Node logs the unhandled
71
+ // rejection and the next setTimeout was never armed — the
72
+ // outbound sync loop silently died until the process restarted,
73
+ // while `_running` stayed true (no signal to the caller).
74
+ //
75
+ // Mirrors the heartbeat-loop fix in PR #147 (issue #544): wrap
76
+ // the whole tick, schedule the next iteration in `finally` so a
77
+ // surprise throw cannot park the loop.
78
+ let nextDelay = DEFAULT_OUTBOUND_INTERVAL;
70
79
  try {
71
- const result = await this.outbound.flush();
72
- if (result.sent > 0) this._lastActivity = Date.now();
73
- } catch (err) {
74
- if (err instanceof AuthError) {
75
- await this._handleAuthError('outbound');
76
- } else {
77
- this.logger.error(`[sync] outbound error: ${err.message}`);
80
+ if (!this._running) return;
81
+ this._outPending = true;
82
+ try {
83
+ const result = await this.outbound.flush();
84
+ if (result.sent > 0) this._lastActivity = Date.now();
85
+ } catch (err) {
86
+ if (err instanceof AuthError) {
87
+ await this._handleAuthError('outbound');
88
+ } else {
89
+ this.logger.error(`[sync] outbound error: ${err.message}`);
90
+ }
78
91
  }
92
+ this._outPending = false;
93
+ try {
94
+ const pending = this.store.countPending({ direction: 'outbound' });
95
+ if (pending > 0) nextDelay = 1_000;
96
+ } catch (err) {
97
+ // countPending threw (corrupt store, FS hiccup): keep the
98
+ // default cadence rather than parking the loop.
99
+ this.logger.error(`[sync] countPending threw (non-fatal): ${err && err.message}`);
100
+ }
101
+ } catch (err) {
102
+ // Anything that escaped the inner blocks above. Log and let
103
+ // finally re-arm the timer.
104
+ this.logger.error(`[sync] outbound tick threw (non-fatal): ${err && err.message}`);
105
+ this._outPending = false;
106
+ } finally {
107
+ if (this._running) this._scheduleOutbound(nextDelay);
79
108
  }
80
- this._outPending = false;
81
- const nextDelay = this.store.countPending({ direction: 'outbound' }) > 0
82
- ? 1_000
83
- : DEFAULT_OUTBOUND_INTERVAL;
84
- this._scheduleOutbound(nextDelay);
85
109
  }, delayMs);
86
110
  if (this._outTimer.unref) this._outTimer.unref();
87
111
  }
@@ -89,29 +113,42 @@ class SyncEngine {
89
113
  _scheduleInbound(delayMs) {
90
114
  if (!this._running) return;
91
115
  this._inTimer = setTimeout(async () => {
92
- if (!this._running) return;
116
+ // Same defence-in-depth pattern as _scheduleOutbound: a throw
117
+ // from inbound.pull / ackDelivered / _isIdle used to escape the
118
+ // setTimeout callback and silently park the inbound loop.
119
+ let nextDelay = DEFAULT_POLL_INTERVAL_ACTIVE;
93
120
  try {
94
- const result = await this.inbound.pull();
95
- if (result.received > 0) {
96
- this._lastActivity = Date.now();
97
- if (typeof this.onInboundReceived === 'function') {
98
- try { this.onInboundReceived(result.received); } catch (e) {
99
- this.logger.warn?.('[sync] onInboundReceived callback failed:', e.message);
121
+ if (!this._running) return;
122
+ try {
123
+ const result = await this.inbound.pull();
124
+ if (result.received > 0) {
125
+ this._lastActivity = Date.now();
126
+ if (typeof this.onInboundReceived === 'function') {
127
+ try { this.onInboundReceived(result.received); } catch (e) {
128
+ this.logger.warn?.('[sync] onInboundReceived callback failed:', e.message);
129
+ }
100
130
  }
101
131
  }
132
+ await this.inbound.ackDelivered();
133
+ } catch (err) {
134
+ if (err instanceof AuthError) {
135
+ await this._handleAuthError('inbound');
136
+ } else {
137
+ this.logger.error(`[sync] inbound error: ${err.message}`);
138
+ }
102
139
  }
103
- await this.inbound.ackDelivered();
104
- } catch (err) {
105
- if (err instanceof AuthError) {
106
- await this._handleAuthError('inbound');
107
- } else {
108
- this.logger.error(`[sync] inbound error: ${err.message}`);
140
+ try {
141
+ nextDelay = this._isIdle()
142
+ ? DEFAULT_POLL_INTERVAL_IDLE
143
+ : DEFAULT_POLL_INTERVAL_ACTIVE;
144
+ } catch (err) {
145
+ this.logger.error(`[sync] _isIdle threw (non-fatal): ${err && err.message}`);
109
146
  }
147
+ } catch (err) {
148
+ this.logger.error(`[sync] inbound tick threw (non-fatal): ${err && err.message}`);
149
+ } finally {
150
+ if (this._running) this._scheduleInbound(nextDelay);
110
151
  }
111
- const nextDelay = this._isIdle()
112
- ? DEFAULT_POLL_INTERVAL_IDLE
113
- : DEFAULT_POLL_INTERVAL_ACTIVE;
114
- this._scheduleInbound(nextDelay);
115
152
  }, delayMs);
116
153
  if (this._inTimer.unref) this._inTimer.unref();
117
154
  }
@@ -1 +0,0 @@
1
- {"type":"CapabilityCandidate","id":"cand_b9a66a5c","title":"Harden session log detection and fallback behavior","source":"signals","created_at":"2026-05-27T12:51:59.052Z","signals":["memory_missing","user_missing","session_logs_missing"],"tags":["memory_missing","user_missing","session_logs_missing","area:memory"],"shape":{"title":"Harden session log detection and fallback behavior","input":"Recent session transcript + memory snippets + user instructions","output":"A safe, auditable evolution patch guided by GEP assets","invariants":"Protocol order, small reversible patches, validation, append-only events","params":"Signals: memory_missing, user_missing, session_logs_missing","failure_points":"Missing signals, over-broad changes, skipped validation, missing knowledge solidification","evidence":"Signal present: session_logs_missing"}}
@@ -1,4 +0,0 @@
1
- {
2
- "version": 1,
3
- "capsules": []
4
- }
File without changes
@@ -1,4 +0,0 @@
1
- {
2
- "version": 1,
3
- "failed_capsules": []
4
- }
@@ -1,245 +0,0 @@
1
- {
2
- "version": 2,
3
- "genes": [
4
- {
5
- "type": "Gene",
6
- "id": "gene_gep_repair_from_errors",
7
- "category": "repair",
8
- "signals_match": [
9
- "error|错误|异常|エラー|오류",
10
- "exception|异常|例外|예외",
11
- "failed|失败|失敗|실패|fail",
12
- "unstable|不稳定|不安定|불안정",
13
- "log_error",
14
- "test_failure"
15
- ],
16
- "preconditions": [
17
- "signals contains error-related indicators"
18
- ],
19
- "strategy": [
20
- "Extract structured signals from logs and user instructions",
21
- "Select an existing Gene by signals match (no improvisation)",
22
- "Estimate blast radius (files, lines) before editing",
23
- "Apply smallest reversible patch",
24
- "Validate using declared validation steps; rollback on failure",
25
- "Solidify knowledge: append EvolutionEvent, update Gene/Capsule store"
26
- ],
27
- "constraints": {
28
- "max_files": 20,
29
- "forbidden_paths": [
30
- ".git",
31
- "node_modules"
32
- ]
33
- },
34
- "validation": [
35
- "node scripts/validate-modules.js ./src/evolve ./src/gep/solidify ./src/gep/policyCheck ./src/gep/selector ./src/gep/memoryGraph ./src/gep/assetStore",
36
- "node scripts/validate-suite.js"
37
- ]
38
- },
39
- {
40
- "type": "Gene",
41
- "id": "gene_gep_optimize_prompt_and_assets",
42
- "category": "optimize",
43
- "signals_match": [
44
- "protocol|协议|プロトコル|프로토콜",
45
- "gep",
46
- "prompt|提示词|提示|プロンプト|프롬프트",
47
- "audit|审计|監査|감사",
48
- "reusable|可复用|再利用|재사용"
49
- ],
50
- "preconditions": [
51
- "need stricter, auditable evolution protocol outputs"
52
- ],
53
- "strategy": [
54
- "Extract signals and determine selection rationale via Selector JSON",
55
- "Prefer reusing existing Gene/Capsule; only create if no match exists",
56
- "Refactor prompt assembly to embed assets (genes, capsules, parent event)",
57
- "Reduce noise and ambiguity; enforce strict output schema",
58
- "Validate by running node index.js run and ensuring no runtime errors",
59
- "Solidify: record EvolutionEvent, update Gene definitions, create Capsule on success"
60
- ],
61
- "constraints": {
62
- "max_files": 20,
63
- "forbidden_paths": [
64
- ".git",
65
- "node_modules"
66
- ]
67
- },
68
- "validation": [
69
- "node scripts/validate-modules.js ./src/evolve ./src/gep/prompt ./src/gep/contentHash ./src/gep/skillDistiller",
70
- "node scripts/validate-suite.js"
71
- ]
72
- },
73
- {
74
- "type": "Gene",
75
- "id": "gene_gep_innovate_from_opportunity",
76
- "category": "innovate",
77
- "signals_match": [
78
- "user_feature_request|功能请求|機能リクエスト|기능요청",
79
- "user_improvement_suggestion|改进建议|改善提案|개선제안",
80
- "perf_bottleneck|性能瓶颈|パフォーマンス|성능병목",
81
- "capability_gap|能力缺口|機能ギャップ|역량공백",
82
- "stable_success_plateau",
83
- "external_opportunity|外部机会|外部機会|외부기회",
84
- "bounty_task"
85
- ],
86
- "preconditions": [
87
- "at least one opportunity signal is present",
88
- "no active log_error signals (stability first)"
89
- ],
90
- "strategy": [
91
- "Extract opportunity signals and identify the specific user need or system gap",
92
- "Search existing Genes and Capsules for partial matches (avoid reinventing)",
93
- "Design a minimal, testable implementation plan (prefer small increments)",
94
- "Estimate blast radius; innovate changes may touch more files but must stay within constraints",
95
- "Implement the change with clear validation criteria",
96
- "Validate using declared validation steps; rollback on failure",
97
- "Solidify: record EvolutionEvent with intent=innovate, create new Gene if pattern is novel, create Capsule on success"
98
- ],
99
- "constraints": {
100
- "max_files": 25,
101
- "forbidden_paths": [
102
- ".git",
103
- "node_modules"
104
- ]
105
- },
106
- "validation": [
107
- "node scripts/validate-modules.js ./src/evolve ./src/gep/solidify ./src/gep/policyCheck ./src/gep/mutation ./src/gep/personality",
108
- "node scripts/validate-suite.js"
109
- ]
110
- },
111
- {
112
- "type": "Gene",
113
- "id": "gene_gep_optimize_tool_usage",
114
- "summary": "Optimize tool execution patterns by reducing redundant exec calls, improving tool selection strategy, and enforcing tool-use constraints to prevent bypass.",
115
- "category": "optimize",
116
- "signals_match": [
117
- "high_tool_usage:exec",
118
- "repeated_tool_usage:exec",
119
- "tool_bypass|工具绕过|ツール迂回|도구우회",
120
- "tool_loop|工具循环|ツールループ|도구반복",
121
- "high_tool_usage"
122
- ],
123
- "preconditions": [
124
- "agent repeatedly invokes the same tool (especially exec) without progress",
125
- "tool execution bypass patterns detected",
126
- "no active error signals (errors would take repair priority)"
127
- ],
128
- "strategy": [
129
- "Analyze tool usage patterns to identify the root cause of repetition (wrong tool, missing context, or lack of guardrails)",
130
- "Introduce strategy-level guardrails: prefer single-shot commands, batch related operations, add explicit retry limits",
131
- "If tool_bypass detected, strengthen constraint enforcement in prompt assembly or tool routing",
132
- "Estimate blast radius; changes should target tool routing, prompt constraints, or signal deduplication logic",
133
- "Validate by confirming no regressions in existing tool tests and signal extraction accuracy",
134
- "Solidify: record EvolutionEvent with intent=optimize, update Capsule on success"
135
- ],
136
- "constraints": {
137
- "max_files": 15,
138
- "forbidden_paths": [
139
- ".git",
140
- "node_modules"
141
- ]
142
- },
143
- "validation": [
144
- "node scripts/validate-modules.js ./src/gep/signals ./src/evolve",
145
- "node scripts/validate-suite.js"
146
- ],
147
- "routing_hint": {
148
- "tier": "mid",
149
- "reasoning_level": "medium"
150
- }
151
- },
152
- {
153
- "type": "Gene",
154
- "id": "gene_distilled_s2g-env-vars",
155
- "summary": "Vercel environment variable expert guidance. Use when working with .env files, vercel env commands, OIDC tokens, or managing environment-specific configuration.",
156
- "category": "optimize",
157
- "signals_match": [
158
- "use_when_working_with",
159
- "env_files",
160
- "vercel_env_commands",
161
- "oidc_tokens",
162
- "vercel_env_pull",
163
- "env_local_overwrite",
164
- "oidc_token_expiry",
165
- "dotenv_cli"
166
- ],
167
- "preconditions": [
168
- "Skill env-vars has just been executed locally"
169
- ],
170
- "strategy": [
171
- "Identify the dominant trigger signals from the Skill description.",
172
- "Apply the smallest targeted change that satisfies the Skill workflow.",
173
- "Run the Skill validation commands and abort if any fails."
174
- ],
175
- "constraints": {
176
- "max_files": 12,
177
- "forbidden_paths": [
178
- ".git",
179
- "node_modules"
180
- ]
181
- },
182
- "validation": [
183
- "node --version"
184
- ],
185
- "routing_hint": {
186
- "tier": "cheap",
187
- "reasoning_level": "low"
188
- },
189
- "schema_version": "1.6.0",
190
- "_source": {
191
- "kind": "skill2gep",
192
- "skill_name": "env-vars",
193
- "skill_platform": "vercel",
194
- "skill_hash": "ba0bdb4db2",
195
- "rationale_paper": "Wang, Ren, Zhang. From Procedural Skills to Strategy Genes. arXiv:2604.15097",
196
- "paper_scope": "code-science (arXiv:2604.15097, 45 tasks, Gemini 3.1 Pro/Flash Lite)",
197
- "claims_outside_scope": "assumption",
198
- "quality_heuristics": {
199
- "strategy_steps": 0,
200
- "avoid_count": 0,
201
- "validation_declared_count": 0,
202
- "validation_runnable_count": 0,
203
- "validation_fallback_used": true,
204
- "signals_extracted": 4,
205
- "preconditions_extracted": 0
206
- }
207
- },
208
- "asset_id": "sha256:1501bc37fbefb18630c4dc8a95d8cdc1ed32bec4a465dc3223280ae907e07297"
209
- },
210
- {
211
- "type": "Gene",
212
- "id": "gene_tool_integrity",
213
- "category": "repair",
214
- "signals_match": [
215
- "tool_bypass|工具绕过|ツール迂回|도구우회"
216
- ],
217
- "preconditions": [
218
- "agent used shell/exec to perform an action that a registered tool can handle"
219
- ],
220
- "strategy": [
221
- "Always prefer registered tools over ad-hoc scripts or shell workarounds",
222
- "If a registered tool fails, report the actual error honestly and attempt to fix the root cause",
223
- "Never fabricate explanations -- describe actual actions transparently",
224
- "Do not create temporary scripts in extension or project directories"
225
- ],
226
- "constraints": {
227
- "max_files": 4,
228
- "forbidden_paths": [
229
- ".git",
230
- "node_modules"
231
- ]
232
- },
233
- "validation": [
234
- "node scripts/validate-suite.js"
235
- ],
236
- "anti_patterns": [
237
- "tool_bypass"
238
- ],
239
- "routing_hint": {
240
- "tier": "cheap",
241
- "reasoning_level": "low"
242
- }
243
- }
244
- ]
245
- }
File without changes