@evomap/evolver 1.70.0-beta.5 → 1.72.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.
@@ -1,3 +1,4 @@
1
- {"type":"CapabilityCandidate","id":"cand_b9a66a5c","title":"Harden session log detection and fallback behavior","source":"signals","created_at":"2026-04-27T05:31:51.337Z","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"}}
2
- {"type":"CapabilityCandidate","id":"cand_b9a66a5c","title":"Harden session log detection and fallback behavior","source":"signals","created_at":"2026-04-27T05:31:53.506Z","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"}}
3
- {"type":"CapabilityCandidate","id":"cand_b9a66a5c","title":"Harden session log detection and fallback behavior","source":"signals","created_at":"2026-04-27T05:31:55.280Z","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
+ {"type":"CapabilityCandidate","id":"cand_b9a66a5c","title":"Harden session log detection and fallback behavior","source":"signals","created_at":"2026-04-27T10:30:27.039Z","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"}}
2
+ {"type":"CapabilityCandidate","id":"cand_b9a66a5c","title":"Harden session log detection and fallback behavior","source":"signals","created_at":"2026-04-27T10:30:56.391Z","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"}}
3
+ {"type":"CapabilityCandidate","id":"cand_b9a66a5c","title":"Harden session log detection and fallback behavior","source":"signals","created_at":"2026-04-27T10:31:11.248Z","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"}}
4
+ {"type":"CapabilityCandidate","id":"cand_b9a66a5c","title":"Harden session log detection and fallback behavior","source":"signals","created_at":"2026-04-27T10:31:26.375Z","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"}}
package/index.js CHANGED
@@ -266,7 +266,10 @@ async function main() {
266
266
  console.warn('[ATP] Auto-init failed: ' + (atpInitErr && atpInitErr.message || atpInitErr));
267
267
  }
268
268
 
269
- // ATP: opt-in capability-gap auto-buyer (default OFF, must be explicitly enabled).
269
+ // ATP: capability-gap auto-buyer. Default ON as of ATP liquidity
270
+ // unlock; disable with EVOLVER_ATP_AUTOBUY=off. Also starts the
271
+ // merchant-side auto-deliver daemon so claimed ATP tasks actually
272
+ // call submitDelivery and settle instead of expiring.
270
273
  try {
271
274
  try {
272
275
  const { runPrompt } = require('./src/atp/cliAutobuyPrompt');
@@ -274,8 +277,8 @@ async function main() {
274
277
  } catch (promptErr) {
275
278
  console.warn('[ATP-AutoBuyer] first-run prompt failed: ' + (promptErr && promptErr.message || promptErr));
276
279
  }
277
- const autoBuyRaw = (process.env.EVOLVER_ATP_AUTOBUY || 'off').toLowerCase().trim();
278
- const autoBuyOn = autoBuyRaw === 'on' || autoBuyRaw === '1' || autoBuyRaw === 'true';
280
+ const autoBuyRaw = (process.env.EVOLVER_ATP_AUTOBUY || 'on').toLowerCase().trim();
281
+ const autoBuyOn = autoBuyRaw !== 'off' && autoBuyRaw !== '0' && autoBuyRaw !== 'false';
279
282
  if (autoBuyOn) {
280
283
  const hubUrl = process.env.A2A_HUB_URL || process.env.EVOMAP_HUB_URL || '';
281
284
  if (hubUrl) {
@@ -285,7 +288,20 @@ async function main() {
285
288
  perOrderCap: Number(process.env.ATP_AUTOBUY_PER_ORDER_CAP_CREDITS) || undefined,
286
289
  });
287
290
  } else {
288
- console.warn('[ATP-AutoBuyer] EVOLVER_ATP_AUTOBUY=on but no hub URL configured, skipping.');
291
+ console.warn('[ATP-AutoBuyer] autobuy enabled but no hub URL configured, skipping.');
292
+ }
293
+ }
294
+ const autoDeliverRaw = (process.env.EVOLVER_ATP_AUTODELIVER || 'on').toLowerCase().trim();
295
+ const autoDeliverOn = autoDeliverRaw !== 'off' && autoDeliverRaw !== '0' && autoDeliverRaw !== 'false';
296
+ if (autoDeliverOn) {
297
+ const hubUrl = process.env.A2A_HUB_URL || process.env.EVOMAP_HUB_URL || '';
298
+ if (hubUrl) {
299
+ const autoDeliver = require('./src/atp/autoDeliver');
300
+ autoDeliver.start({
301
+ pollMs: Number(process.env.ATP_AUTODELIVER_POLL_MS) || undefined,
302
+ });
303
+ } else {
304
+ console.warn('[ATP-AutoDeliver] autodeliver enabled but no hub URL configured, skipping.');
289
305
  }
290
306
  }
291
307
  } catch (autoBuyInitErr) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evomap/evolver",
3
- "version": "1.70.0-beta.5",
3
+ "version": "1.72.0",
4
4
  "description": "A GEP-powered self-evolution engine for AI agents. Features automated log analysis and Genome Evolution Protocol (GEP) for auditable, reusable evolution assets.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -1,14 +1,16 @@
1
- // ATP Auto-Buyer (opt-in)
1
+ // ATP Auto-Buyer (opt-out, default ON as of ATP liquidity unlock)
2
2
  // Converts capability gaps into ATP orders with strict budget caps and
3
- // 24h question-level deduplication. Default OFF; enabled by setting
4
- // EVOLVER_ATP_AUTOBUY=on (also accepts 1/true). Budget caps:
3
+ // 24h question-level deduplication. Disable by setting
4
+ // EVOLVER_ATP_AUTOBUY=off. Budget caps:
5
5
  // ATP_AUTOBUY_DAILY_CAP_CREDITS (default 50)
6
6
  // ATP_AUTOBUY_PER_ORDER_CAP_CREDITS (default 10)
7
7
  // Cold-start safety: the first 5 minutes after process start use a half-cap
8
8
  // to protect against misconfiguration loops on restart storms.
9
9
  //
10
10
  // Integration contract:
11
- // 1) Call start({ dailyCap, perOrderCap }) once when EVOLVER_ATP_AUTOBUY=on.
11
+ // 1) Call start({ dailyCap, perOrderCap }) once at Evolver boot. The
12
+ // evolve loop does this at the top of every cycle; start() is
13
+ // idempotent so the repeated call is a no-op.
12
14
  // 2) Call considerOrder({ signals, question, capabilities, budget, ... })
13
15
  // from the evolve loop whenever a capability gap is detected.
14
16
  // 3) Result shape: { ok, skipped?, reason?, data?, error? }.
@@ -48,8 +50,12 @@ function _todayKey(now) {
48
50
  }
49
51
 
50
52
  function _isEnabled() {
51
- const raw = (process.env.EVOLVER_ATP_AUTOBUY || 'off').toLowerCase().trim();
52
- return raw === 'on' || raw === '1' || raw === 'true';
53
+ // Default ON: the evolve loop starts autoBuyer at the top of every cycle
54
+ // so new users get ATP buyer routing out of the box. Disable by setting
55
+ // EVOLVER_ATP_AUTOBUY=off. Budget caps (DAILY_CAP + PER_ORDER_CAP) keep
56
+ // the downside bounded even when this is on.
57
+ const raw = (process.env.EVOLVER_ATP_AUTOBUY || 'on').toLowerCase().trim();
58
+ return raw !== 'off' && raw !== '0' && raw !== 'false';
53
59
  }
54
60
 
55
61
  function _emptyLedger() {
@@ -0,0 +1,199 @@
1
+ // ATP Auto-Deliver (opt-out, merchant-side)
2
+ // Closes the ATP settlement loop for Evolver merchants by auto-calling
3
+ // submitDelivery for every claimed task that carries an atp_order_id.
4
+ //
5
+ // Without this module, an ATP order sits in `pending` until the 7-day escrow
6
+ // timeout refunds the buyer: the Hub routes the task to a merchant node and
7
+ // marks it claimed, but nothing in the Evolver runtime actually calls
8
+ // /a2a/atp/deliver. This was the root cause of the 0-settled-in-13-days
9
+ // pipeline stall observed in prod on 2026-04-27.
10
+ //
11
+ // Integration contract:
12
+ // 1) Call start({ pollMs }) once at Evolver boot. Default ON.
13
+ // Disable by setting EVOLVER_ATP_AUTODELIVER=off.
14
+ // 2) The module polls /a2a/task/my every pollMs milliseconds, finds tasks
15
+ // with atp_order_id + a `result_asset_id` (meaning the task already
16
+ // completed through solidify), and submits a minimal proofPayload.
17
+ // 3) Each submitted order is remembered in a local ledger so we never
18
+ // double-submit, even across restarts.
19
+ //
20
+ // Dedup ledger lives alongside autoBuyer's ledger under memory/.
21
+ // Failure modes are non-fatal: network errors are logged, not thrown.
22
+
23
+ const fs = require('fs');
24
+ const path = require('path');
25
+
26
+ const { getMemoryDir } = require('../gep/paths');
27
+ const hubClient = require('./hubClient');
28
+
29
+ const DEFAULT_POLL_MS = 60 * 1000; // 1 min
30
+ const MIN_POLL_MS = 15 * 1000;
31
+ const LEDGER_FILENAME = 'atp-autodeliver-ledger.json';
32
+ const LEDGER_MAX_ENTRIES = 500;
33
+
34
+ let _started = false;
35
+ let _pollInterval = null;
36
+ let _pollMs = DEFAULT_POLL_MS;
37
+ let _inflight = false;
38
+
39
+ function _ledgerPath() {
40
+ return path.join(getMemoryDir(), LEDGER_FILENAME);
41
+ }
42
+
43
+ function _isEnabled() {
44
+ const raw = (process.env.EVOLVER_ATP_AUTODELIVER || 'on').toLowerCase().trim();
45
+ return raw !== 'off' && raw !== '0' && raw !== 'false';
46
+ }
47
+
48
+ function _emptyLedger() {
49
+ return { version: 1, submitted: {} };
50
+ }
51
+
52
+ function _readLedger() {
53
+ try {
54
+ const p = _ledgerPath();
55
+ if (!fs.existsSync(p)) return _emptyLedger();
56
+ const raw = fs.readFileSync(p, 'utf8');
57
+ const parsed = JSON.parse(raw);
58
+ if (!parsed || typeof parsed !== 'object' || !parsed.submitted) return _emptyLedger();
59
+ return parsed;
60
+ } catch (_) {
61
+ return _emptyLedger();
62
+ }
63
+ }
64
+
65
+ function _writeLedger(ledger) {
66
+ try {
67
+ const dir = getMemoryDir();
68
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
69
+ // Bound the ledger size so it cannot grow without limit on long-running
70
+ // merchants. Keep the most-recent entries by insertion order.
71
+ const entries = Object.entries(ledger.submitted || {});
72
+ if (entries.length > LEDGER_MAX_ENTRIES) {
73
+ const trimmed = Object.fromEntries(entries.slice(-LEDGER_MAX_ENTRIES));
74
+ ledger.submitted = trimmed;
75
+ }
76
+ const tmp = _ledgerPath() + '.tmp';
77
+ fs.writeFileSync(tmp, JSON.stringify(ledger, null, 2));
78
+ fs.renameSync(tmp, _ledgerPath());
79
+ } catch (_) {
80
+ // Non-fatal: next poll will re-attempt from Hub state. Hub-side
81
+ // submitDelivery is itself idempotent per order id.
82
+ }
83
+ }
84
+
85
+ function _buildProofPayload(task) {
86
+ // Minimal evidence the Hub's auto verifier will accept. Matches the shape
87
+ // documented in /a2a/atp/deliver: result/output/pass_rate/signals.
88
+ const now = new Date().toISOString();
89
+ return {
90
+ result: 'completed',
91
+ asset_id: task.result_asset_id || null,
92
+ completed_at: task.claimed_at || now,
93
+ pass_rate: 1.0,
94
+ signals: Array.isArray(task.signals) ? task.signals.slice(0, 10) : [],
95
+ submitter: 'evolver_auto_deliver',
96
+ };
97
+ }
98
+
99
+ async function _tick() {
100
+ if (_inflight) return;
101
+ _inflight = true;
102
+ try {
103
+ const result = await hubClient.listMyTasks(20);
104
+ if (!result || !result.ok || !result.data) return;
105
+ const tasks = Array.isArray(result.data.tasks) ? result.data.tasks : [];
106
+ if (tasks.length === 0) return;
107
+
108
+ const ledger = _readLedger();
109
+ let wroteLedger = false;
110
+
111
+ for (const task of tasks) {
112
+ const orderId = task && task.atp_order_id;
113
+ if (!orderId) continue;
114
+ if (ledger.submitted[orderId]) continue;
115
+ // Only deliver once the task has a result asset (i.e. solidify finished).
116
+ if (!task.result_asset_id) continue;
117
+ // Don't try to deliver on already-terminal statuses.
118
+ if (task.status && task.status !== 'claimed' && task.status !== 'completed') continue;
119
+
120
+ const proofPayload = _buildProofPayload(task);
121
+ const resp = await hubClient.submitDelivery(orderId, proofPayload);
122
+ if (resp && resp.ok) {
123
+ ledger.submitted[orderId] = Date.now();
124
+ wroteLedger = true;
125
+ console.log('[ATP-AutoDeliver] Delivered order=' + orderId + ' asset=' + (task.result_asset_id || 'none'));
126
+ } else {
127
+ // Record terminal-ish errors in the ledger so we do not hammer the
128
+ // same order every minute. Everything else (transient network) is
129
+ // retried on the next tick.
130
+ const err = (resp && resp.error) || 'unknown_error';
131
+ const status = resp && resp.status;
132
+ const terminal = status === 400 || status === 404 || status === 409;
133
+ if (terminal) {
134
+ ledger.submitted[orderId] = -Date.now();
135
+ wroteLedger = true;
136
+ }
137
+ console.log('[ATP-AutoDeliver] Delivery failed order=' + orderId + ' status=' + (status || 'n/a') + ' err=' + String(err).slice(0, 120));
138
+ }
139
+ }
140
+
141
+ if (wroteLedger) _writeLedger(ledger);
142
+ } catch (err) {
143
+ console.log('[ATP-AutoDeliver] Tick threw (non-fatal): ' + (err && err.message || err));
144
+ } finally {
145
+ _inflight = false;
146
+ }
147
+ }
148
+
149
+ function start(opts) {
150
+ if (_started) return;
151
+ if (!_isEnabled()) return;
152
+ const requested = Number((opts && opts.pollMs) || process.env.ATP_AUTODELIVER_POLL_MS || DEFAULT_POLL_MS);
153
+ _pollMs = Math.max(MIN_POLL_MS, Math.floor(requested) || DEFAULT_POLL_MS);
154
+ _started = true;
155
+ _pollInterval = setInterval(function () {
156
+ _tick().catch(function () { /* swallowed in _tick */ });
157
+ }, _pollMs);
158
+ // Do not await -- fire the first tick asynchronously so start() returns
159
+ // immediately. This matches the autoBuyer start() semantics.
160
+ _tick().catch(function () { /* swallowed in _tick */ });
161
+ console.log('[ATP-AutoDeliver] Started (pollMs=' + _pollMs + ')');
162
+ }
163
+
164
+ function stop() {
165
+ if (_pollInterval) {
166
+ clearInterval(_pollInterval);
167
+ _pollInterval = null;
168
+ }
169
+ _started = false;
170
+ }
171
+
172
+ function isStarted() {
173
+ return _started;
174
+ }
175
+
176
+ function _resetForTests() {
177
+ stop();
178
+ _inflight = false;
179
+ _pollMs = DEFAULT_POLL_MS;
180
+ }
181
+
182
+ module.exports = {
183
+ start,
184
+ stop,
185
+ isStarted,
186
+ __internals: {
187
+ tick: _tick,
188
+ readLedger: _readLedger,
189
+ writeLedger: _writeLedger,
190
+ buildProofPayload: _buildProofPayload,
191
+ resetForTests: _resetForTests,
192
+ constants: {
193
+ DEFAULT_POLL_MS,
194
+ MIN_POLL_MS,
195
+ LEDGER_FILENAME,
196
+ LEDGER_MAX_ENTRIES,
197
+ },
198
+ },
199
+ };
@@ -117,10 +117,10 @@ async function runPrompt(opts) {
117
117
  try {
118
118
  output.write("\n");
119
119
  output.write("[ATP-AutoBuyer] Your evolver can automatically place small-priced\n");
120
- output.write("ATP orders when it detects a capability gap (default OFF).\n");
120
+ output.write("ATP orders when it detects a capability gap (default ON).\n");
121
121
  output.write(" - daily hard cap: ATP_AUTOBUY_DAILY_CAP_CREDITS (default applies)\n");
122
122
  output.write(" - per-order cap: ATP_AUTOBUY_PER_ORDER_CAP_CREDITS\n");
123
- output.write(" - unset EVOLVER_ATP_AUTOBUY and restart to disable at any time.\n");
123
+ output.write(" - set EVOLVER_ATP_AUTOBUY=off and restart to disable at any time.\n");
124
124
  output.write("\n");
125
125
  } catch (_) {
126
126
  return { prompted: false, decision: null, reason: "io_error" };
@@ -128,7 +128,7 @@ async function runPrompt(opts) {
128
128
 
129
129
  let answer;
130
130
  try {
131
- answer = await ask("Enable autoBuyer for this session? [y/n/later] ", {
131
+ answer = await ask("Keep autoBuyer enabled for this session? [y/n/later] ", {
132
132
  input,
133
133
  output,
134
134
  });
@@ -143,6 +143,7 @@ async function runPrompt(opts) {
143
143
  }
144
144
  if (answer === "n" || answer === "no") {
145
145
  _writeAck(false);
146
+ env.EVOLVER_ATP_AUTOBUY = "off";
146
147
  return { prompted: true, decision: "no", reason: "user_declined" };
147
148
  }
148
149
  return { prompted: true, decision: "later", reason: "user_postponed" };
@@ -240,6 +240,25 @@ function getAtpPolicy() {
240
240
  return _get('/atp/policy', '/a2a/atp/policy');
241
241
  }
242
242
 
243
+ /**
244
+ * GET /a2a/task/my?node_id=... -- list this node's claimed tasks
245
+ *
246
+ * ATP-originated tasks include an `atp_order_id` field on each task so the
247
+ * merchant side can pair a completed task with its DeliveryProof and call
248
+ * submitDelivery. Non-ATP tasks simply omit the field. This is NOT an
249
+ * /atp/* endpoint so it never routes through the proxy passthrough.
250
+ *
251
+ * @param {number} [limit]
252
+ */
253
+ function listMyTasks(limit) {
254
+ const nid = getNodeId();
255
+ const params = new URLSearchParams();
256
+ params.set('node_id', nid);
257
+ if (limit) params.set('limit', String(limit));
258
+ const suffix = '/a2a/task/my?' + params.toString();
259
+ return _hubGet(suffix);
260
+ }
261
+
243
262
  module.exports = {
244
263
  placeOrder,
245
264
  submitDelivery,
@@ -250,6 +269,7 @@ module.exports = {
250
269
  getOrderStatus,
251
270
  listProofs,
252
271
  getAtpPolicy,
272
+ listMyTasks,
253
273
  // exported for tests only
254
274
  _isProxyMode: _isProxyMode,
255
275
  };
package/src/atp/index.js CHANGED
@@ -7,7 +7,8 @@
7
7
  // consumerAgent - ready-to-use consumer agent template
8
8
  // serviceHelper - service publishing helper
9
9
  // defaultHandler - default order handler + config helpers for auto-ATP
10
- // autoBuyer - opt-in capability-gap auto order helper with budget caps
10
+ // autoBuyer - opt-out capability-gap auto order helper with budget caps
11
+ // autoDeliver - opt-out merchant-side submitDelivery daemon
11
12
  // cli - parsers and runners for the `buy`/`orders`/`verify` subcommands
12
13
 
13
14
  const hubClient = require('./hubClient');
@@ -16,6 +17,7 @@ const consumerAgent = require('./consumerAgent');
16
17
  const serviceHelper = require('./serviceHelper');
17
18
  const defaultHandler = require('./defaultHandler');
18
19
  const autoBuyer = require('./autoBuyer');
20
+ const autoDeliver = require('./autoDeliver');
19
21
  const cli = require('./cli');
20
22
 
21
23
  module.exports = {
@@ -25,5 +27,6 @@ module.exports = {
25
27
  serviceHelper,
26
28
  defaultHandler,
27
29
  autoBuyer,
30
+ autoDeliver,
28
31
  cli,
29
32
  };