@evomap/evolver 1.87.1 → 1.87.2
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/assets/gep/candidates.jsonl +1 -0
- package/assets/gep/capsules.json +4 -0
- package/assets/gep/events.jsonl +0 -0
- package/assets/gep/failed_capsules.json +4 -0
- package/assets/gep/genes.json +245 -0
- package/assets/gep/genes.jsonl +0 -0
- package/index.js +30 -11
- package/package.json +1 -1
- package/src/atp/autoBuyer.js +90 -11
- package/src/atp/cli.js +98 -0
- package/src/atp/cliAutobuyPrompt.js +59 -52
- package/src/evolve/guards.js +1 -1
- package/src/evolve/pipeline/collect.js +1 -1
- package/src/evolve/pipeline/dispatch.js +1 -1
- package/src/evolve/pipeline/enrich.js +1 -1
- package/src/evolve/pipeline/hub.js +1 -1
- package/src/evolve/pipeline/select.js +1 -1
- package/src/evolve/pipeline/signals.js +1 -1
- package/src/evolve/utils.js +1 -1
- package/src/evolve.js +1 -1
- package/src/forceUpdate.js +2 -1
- package/src/gep/a2aProtocol.js +1 -1
- package/src/gep/candidateEval.js +1 -1
- package/src/gep/candidates.js +1 -1
- package/src/gep/contentHash.js +1 -1
- package/src/gep/crypto.js +1 -1
- package/src/gep/curriculum.js +1 -1
- package/src/gep/deviceId.js +1 -1
- package/src/gep/envFingerprint.js +1 -1
- package/src/gep/epigenetics.js +1 -1
- package/src/gep/explore.js +1 -1
- package/src/gep/hash.js +1 -1
- package/src/gep/hubFetch.js +1 -1
- package/src/gep/hubReview.js +1 -1
- package/src/gep/hubSearch.js +1 -1
- package/src/gep/hubVerify.js +1 -1
- package/src/gep/learningSignals.js +1 -1
- package/src/gep/memoryGraph.js +1 -1
- package/src/gep/memoryGraphAdapter.js +1 -1
- package/src/gep/mutation.js +1 -1
- package/src/gep/narrativeMemory.js +1 -1
- package/src/gep/openPRRegistry.js +1 -1
- package/src/gep/personality.js +1 -1
- package/src/gep/policyCheck.js +1 -1
- package/src/gep/prompt.js +1 -1
- package/src/gep/recallVerifier.js +1 -1
- package/src/gep/reflection.js +1 -1
- package/src/gep/selector.js +1 -1
- package/src/gep/skillDistiller.js +1 -1
- package/src/gep/solidify.js +1 -1
- package/src/gep/strategy.js +1 -1
- package/src/gep/workspaceKeychain.js +1 -1
- package/src/proxy/index.js +29 -9
- package/src/proxy/router/messages_route.js +80 -5
|
@@ -9,55 +9,34 @@
|
|
|
9
9
|
* - ack file memory/atp-autobuy-ack.json does not exist (already decided)
|
|
10
10
|
*
|
|
11
11
|
* Outcomes:
|
|
12
|
-
* - user answers y ->
|
|
13
|
-
* - user answers n ->
|
|
14
|
-
* - user answers later -> no
|
|
12
|
+
* - user answers y -> autoBuyer.setConsent(true) — opts in for future sessions
|
|
13
|
+
* - user answers n -> autoBuyer.setConsent(false) — prompt never shown again
|
|
14
|
+
* - user answers later -> no ack written, prompt shown next session
|
|
15
15
|
* - any non-TTY/ack branch -> silent no-op
|
|
16
|
+
*
|
|
17
|
+
* setConsent failures (FS permission, disk full) are surfaced to the user
|
|
18
|
+
* via the output stream and returned as `reason: 'ack_write_failed'`; the
|
|
19
|
+
* decision field still reflects what the user typed.
|
|
16
20
|
*/
|
|
17
21
|
|
|
18
|
-
const fs = require("fs");
|
|
19
|
-
const path = require("path");
|
|
20
22
|
const readline = require("readline");
|
|
23
|
+
const autoBuyer = require("./autoBuyer");
|
|
21
24
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
25
|
+
// All ack file plumbing is owned by autoBuyer: filename constant, path
|
|
26
|
+
// resolution, read (strict validation), and write (atomic tmp+rename).
|
|
27
|
+
// cliAutobuyPrompt delegates through the public API (not __internals) so
|
|
28
|
+
// the two modules cannot diverge on schema or validation — pre-
|
|
29
|
+
// consolidation drift bit us twice (Bugbot PR #141: duplicate writers +
|
|
30
|
+
// lenient-vs-strict reader). Using public exports keeps the "test-only"
|
|
31
|
+
// contract on __internals honest (Bugbot PR #141 R6).
|
|
32
|
+
const ACK_FILE_NAME = autoBuyer.ACK_FILENAME;
|
|
31
33
|
|
|
32
34
|
function _getAckPath() {
|
|
33
|
-
return
|
|
35
|
+
return autoBuyer.getAckPath();
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
function _readAck() {
|
|
37
|
-
|
|
38
|
-
const raw = fs.readFileSync(_getAckPath(), "utf8");
|
|
39
|
-
const parsed = JSON.parse(raw);
|
|
40
|
-
if (!parsed || typeof parsed !== "object") return null;
|
|
41
|
-
return parsed;
|
|
42
|
-
} catch (_) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function _writeAck(enabled) {
|
|
48
|
-
const p = _getAckPath();
|
|
49
|
-
try {
|
|
50
|
-
fs.mkdirSync(path.dirname(p), { recursive: true });
|
|
51
|
-
const body = {
|
|
52
|
-
enabled: !!enabled,
|
|
53
|
-
acknowledged_at: new Date().toISOString(),
|
|
54
|
-
version: 1,
|
|
55
|
-
};
|
|
56
|
-
fs.writeFileSync(p, JSON.stringify(body, null, 2) + "\n", "utf8");
|
|
57
|
-
return true;
|
|
58
|
-
} catch (_) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
39
|
+
return autoBuyer.readAck();
|
|
61
40
|
}
|
|
62
41
|
|
|
63
42
|
/**
|
|
@@ -116,11 +95,12 @@ async function runPrompt(opts) {
|
|
|
116
95
|
|
|
117
96
|
try {
|
|
118
97
|
output.write("\n");
|
|
119
|
-
output.write("[ATP-AutoBuyer] Your evolver
|
|
120
|
-
output.write("ATP orders when it detects a capability gap
|
|
121
|
-
output.write("
|
|
122
|
-
output.write(" -
|
|
123
|
-
output.write(" -
|
|
98
|
+
output.write("[ATP-AutoBuyer] Your evolver will automatically place small-priced\n");
|
|
99
|
+
output.write("ATP orders when it detects a capability gap. This spends real\n");
|
|
100
|
+
output.write("credits on the EvoMap hub and is ON by default for new installs.\n");
|
|
101
|
+
output.write(" - daily hard cap: ATP_AUTOBUY_DAILY_CAP_CREDITS (default 50)\n");
|
|
102
|
+
output.write(" - per-order cap: ATP_AUTOBUY_PER_ORDER_CAP_CREDITS (default 10)\n");
|
|
103
|
+
output.write(" - change later: evolver atp enable | evolver atp disable\n");
|
|
124
104
|
output.write("\n");
|
|
125
105
|
} catch (_) {
|
|
126
106
|
return { prompted: false, decision: null, reason: "io_error" };
|
|
@@ -128,7 +108,7 @@ async function runPrompt(opts) {
|
|
|
128
108
|
|
|
129
109
|
let answer;
|
|
130
110
|
try {
|
|
131
|
-
answer = await ask("Keep
|
|
111
|
+
answer = await ask("Keep ATP auto-spend ON for future sessions? [y=keep enabled / n=disable / later=ask again next session] ", {
|
|
132
112
|
input,
|
|
133
113
|
output,
|
|
134
114
|
});
|
|
@@ -136,16 +116,44 @@ async function runPrompt(opts) {
|
|
|
136
116
|
return { prompted: true, decision: null, reason: "ask_error" };
|
|
137
117
|
}
|
|
138
118
|
|
|
119
|
+
// For y/n we persist via autoBuyer.setConsent (atomic tmp+rename, throws
|
|
120
|
+
// on FS failure). If the write fails we MUST tell the user — for the 'n'
|
|
121
|
+
// path especially, since auto-spend is default-ON and a failed disable
|
|
122
|
+
// means the user typed "off" but the runtime keeps charging credits
|
|
123
|
+
// (Bugbot PR #141 Medium: unchecked ack write). Do NOT mutate process.env
|
|
124
|
+
// on success: that would double-signal and shadow any explicit operator
|
|
125
|
+
// preference set later.
|
|
126
|
+
function _persistConsent(enabled, decision) {
|
|
127
|
+
try {
|
|
128
|
+
autoBuyer.setConsent(enabled);
|
|
129
|
+
return { prompted: true, decision, reason: enabled ? "user_accepted" : "user_declined" };
|
|
130
|
+
} catch (err) {
|
|
131
|
+
try {
|
|
132
|
+
output.write("[ATP-AutoBuyer] WARN: failed to persist consent: " + (err && err.message || err) + "\n");
|
|
133
|
+
if (enabled) {
|
|
134
|
+
output.write(" Auto-spend will keep using the default-on policy until\n");
|
|
135
|
+
output.write(" the ack is saved (capped at the configured caps).\n");
|
|
136
|
+
} else {
|
|
137
|
+
output.write(" Auto-spend will STAY ON (default policy) until your opt-out\n");
|
|
138
|
+
output.write(" can be saved — your decline was not persisted.\n");
|
|
139
|
+
}
|
|
140
|
+
output.write(" Check disk space and write permissions on the memory dir, then run\n");
|
|
141
|
+
output.write(" `evolver atp " + (enabled ? "enable" : "disable") + "` to retry.\n");
|
|
142
|
+
} catch (_) { /* output stream is broken too — nothing more we can do */ }
|
|
143
|
+
return { prompted: true, decision, reason: "ack_write_failed" };
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
139
147
|
if (answer === "y" || answer === "yes") {
|
|
140
|
-
|
|
141
|
-
env.EVOLVER_ATP_AUTOBUY = "on";
|
|
142
|
-
return { prompted: true, decision: "yes", reason: "user_accepted" };
|
|
148
|
+
return _persistConsent(true, "yes");
|
|
143
149
|
}
|
|
144
150
|
if (answer === "n" || answer === "no") {
|
|
145
|
-
|
|
146
|
-
env.EVOLVER_ATP_AUTOBUY = "off";
|
|
147
|
-
return { prompted: true, decision: "no", reason: "user_declined" };
|
|
151
|
+
return _persistConsent(false, "no");
|
|
148
152
|
}
|
|
153
|
+
// Postpone: no ack written, so autoBuyer.getConsent() returns
|
|
154
|
+
// {enabled: true, source: 'default'} this session. Auto-spend keeps
|
|
155
|
+
// running under the default policy with caps; the prompt will fire again
|
|
156
|
+
// next interactive session so the user can confirm or opt out.
|
|
149
157
|
return { prompted: true, decision: "later", reason: "user_postponed" };
|
|
150
158
|
}
|
|
151
159
|
|
|
@@ -155,7 +163,6 @@ module.exports = {
|
|
|
155
163
|
__internals: {
|
|
156
164
|
ACK_FILE_NAME,
|
|
157
165
|
_readAck,
|
|
158
|
-
_writeAck,
|
|
159
166
|
_getAckPath,
|
|
160
167
|
},
|
|
161
168
|
};
|