@evomap/evolver-cli 2.0.0-beta.19 → 2.0.0-beta.22
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/dist/antiGeneBenchmark.js +2 -0
- package/dist/antiGeneRollout.js +2 -0
- package/dist/assetRepair.d.ts +24 -0
- package/dist/assetRepair.js +172 -0
- package/dist/autoDistillAntiGene.js +7 -5
- package/dist/autoDistillLlm.d.ts +20 -0
- package/dist/autoDistillLlm.js +77 -15
- package/dist/autoexec.d.ts +11 -0
- package/dist/autoexec.js +65 -10
- package/dist/autoexecConfig.js +2 -1
- package/dist/cliContracts.d.ts +10 -0
- package/dist/cliContracts.js +407 -81
- package/dist/commandCatalog.d.ts +72 -0
- package/dist/commandCatalog.js +120 -0
- package/dist/cycleConsumer.d.ts +9 -0
- package/dist/cycleConsumer.js +14 -3
- package/dist/dispatch.d.ts +0 -1
- package/dist/dispatch.js +10 -4
- package/dist/distillObserver.js +23 -6
- package/dist/doctor.d.ts +11 -0
- package/dist/doctor.js +81 -6
- package/dist/index.d.ts +5 -1
- package/dist/index.js +200 -68
- package/dist/lifecycle.d.ts +126 -3
- package/dist/lifecycle.js +4390 -188
- package/dist/lifecycleBootstrapTransaction.d.ts +235 -0
- package/dist/lifecycleBootstrapTransaction.js +2182 -0
- package/dist/localMemoryGraph.d.ts +90 -3
- package/dist/localMemoryGraph.js +2031 -231
- package/dist/materialSnapshot.d.ts +2 -0
- package/dist/materialSnapshot.js +8 -0
- package/dist/memoryGraphOps.d.ts +8 -0
- package/dist/memoryGraphOps.js +140 -0
- package/dist/migrate/assetFormatMap.d.ts +61 -0
- package/dist/migrate/assetFormatMap.js +53 -0
- package/dist/migrate/envTranslate.js +2 -0
- package/dist/migrate/fieldMap.d.ts +7 -5
- package/dist/migrate/fieldMap.js +20 -14
- package/dist/migrate/v1Import.d.ts +80 -1
- package/dist/migrate/v1Import.js +961 -120
- package/dist/modelCompatibility.d.ts +10 -0
- package/dist/modelCompatibility.js +296 -0
- package/dist/recipe.d.ts +7 -1
- package/dist/recipe.js +113 -11
- package/dist/repairedAssetStore.d.ts +2 -0
- package/dist/repairedAssetStore.js +12 -0
- package/dist/reuse.d.ts +4 -1
- package/dist/reuse.js +212 -107
- package/dist/reviewFilter.d.ts +3 -1
- package/dist/reviewFilter.js +3 -1
- package/dist/runtimeSessionSource.d.ts +5 -0
- package/dist/selectionPolicyConfig.d.ts +8 -0
- package/dist/selectionPolicyConfig.js +18 -0
- package/dist/semanticIdfConfig.d.ts +2 -0
- package/dist/semanticIdfConfig.js +4 -0
- package/dist/sessionIngest.d.ts +7 -1
- package/dist/sessionIngest.js +25 -1
- package/dist/setupHooks.js +12 -6
- package/dist/skill2gep.js +57 -6
- package/dist/skillDistill.js +1 -0
- package/dist/sync.d.ts +1 -1
- package/dist/sync.js +761 -174
- package/dist/thesis.js +2 -0
- package/dist/valueDigest.js +8 -1
- package/dist/windowsLegacyTaskCleanup.d.ts +228 -0
- package/dist/windowsLegacyTaskCleanup.js +1475 -0
- package/dist/workflowRuntime.js +7 -6
- package/package.json +7 -7
|
@@ -2,6 +2,7 @@ import { mkdtempSync, readFileSync } from 'node:fs';
|
|
|
2
2
|
import { tmpdir } from 'node:os';
|
|
3
3
|
import { join, resolve } from 'node:path';
|
|
4
4
|
import { assetstore, benchmark, events } from '@evomap/evolver-core';
|
|
5
|
+
import { semanticIdfEnabled } from './semanticIdfConfig.js';
|
|
5
6
|
const usage = '用法: evolver anti-gene-benchmark --suite <file> [--assets <dir>] [--review-dir <dir>] [--events <file>] [--json] [--min-samples N] [--min-failure-delta D]\n'
|
|
6
7
|
+ ' 或: evolver anti-gene-benchmark --report <events-file> [--json]\n';
|
|
7
8
|
function parseFlags(argv) {
|
|
@@ -172,6 +173,7 @@ export async function runAntiGeneBenchmarkCommand(argv, deps = {}) {
|
|
|
172
173
|
const report = await benchmark.runAntiGeneBenchmark(suite, { store, review }, {
|
|
173
174
|
eventsPath,
|
|
174
175
|
now: deps.now,
|
|
176
|
+
...(!semanticIdfEnabled() ? { disableSemanticIdf: true } : {}),
|
|
175
177
|
...(flags.minSamples !== undefined ? { minSamples: flags.minSamples } : {}),
|
|
176
178
|
...(flags.minFailureDelta !== undefined ? { minFailureDelta: flags.minFailureDelta } : {}),
|
|
177
179
|
});
|
package/dist/antiGeneRollout.js
CHANGED
|
@@ -3,6 +3,7 @@ import { tmpdir } from 'node:os';
|
|
|
3
3
|
import { join, resolve } from 'node:path';
|
|
4
4
|
import { spawn } from 'node:child_process';
|
|
5
5
|
import { assetstore, benchmark, events, exec } from '@evomap/evolver-core';
|
|
6
|
+
import { semanticIdfEnabled } from './semanticIdfConfig.js';
|
|
6
7
|
const usage = '用法: evolver anti-gene-rollout --suite <file> --repo <path> [--assets <dir>] [--review-dir <dir>] [--events <file>] [--runner claude|codex|gemini] [--json] [--min-samples N] [--min-failure-delta D]\n'
|
|
7
8
|
+ ' 或: evolver anti-gene-rollout --report <events-file> [--json]\n';
|
|
8
9
|
function parseFlags(argv) {
|
|
@@ -281,6 +282,7 @@ export async function runAntiGeneRolloutCommand(argv, deps = {}) {
|
|
|
281
282
|
const report = await benchmark.runAntiGeneRollout(suite, { store, review, makeExecute }, {
|
|
282
283
|
eventsPath,
|
|
283
284
|
now: deps.now,
|
|
285
|
+
...(!semanticIdfEnabled() ? { disableSemanticIdf: true } : {}),
|
|
284
286
|
...(flags.minSamples !== undefined ? { minSamples: flags.minSamples } : {}),
|
|
285
287
|
...(flags.minFailureDelta !== undefined ? { minFailureDelta: flags.minFailureDelta } : {}),
|
|
286
288
|
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { assetstore } from '@evomap/evolver-core';
|
|
2
|
+
import { type CliContractDeps } from './cliContracts.js';
|
|
3
|
+
export interface AssetRepairDeps extends CliContractDeps {
|
|
4
|
+
stdout?: (line: string) => void;
|
|
5
|
+
stderr?: (line: string) => void;
|
|
6
|
+
store?: assetstore.AssetStoreProvider;
|
|
7
|
+
readRejection?: (path: string) => string;
|
|
8
|
+
}
|
|
9
|
+
interface ParsedArgs {
|
|
10
|
+
refs: string[];
|
|
11
|
+
rejectionPath?: string;
|
|
12
|
+
apply: boolean;
|
|
13
|
+
jsonOut: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function runAssetRepairCommand(argv: readonly string[], deps?: AssetRepairDeps): Promise<number>;
|
|
16
|
+
export declare function parseAssetRepairArgs(argv: readonly string[]): {
|
|
17
|
+
ok: true;
|
|
18
|
+
value: ParsedArgs;
|
|
19
|
+
} | {
|
|
20
|
+
ok: false;
|
|
21
|
+
error: string;
|
|
22
|
+
value?: ParsedArgs;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
// `evolver asset-repair --asset <id|path> [--rejection <file|->] [--apply] --json`
|
|
2
|
+
//
|
|
3
|
+
// An asset the network refuses is not automatically a bad asset: the Hub rejects field-by-field (missing
|
|
4
|
+
// `asset_id`, a key its envelope does not allow), and its own deliveries come back stripped of fields the GEP
|
|
5
|
+
// schema requires. Before this command the only options were "publish failed, good luck" and "asset discarded",
|
|
6
|
+
// so distilled work was lost to defects that are mechanically fixable.
|
|
7
|
+
//
|
|
8
|
+
// This command reads the refusal — the local schema gate, plus the Hub's own `details[]` when the operator
|
|
9
|
+
// feeds the rejection body back in — and reports exactly what it can fix and what it cannot. `--apply` writes
|
|
10
|
+
// the repaired record into the local recall library under its recomputed content id; the original is left
|
|
11
|
+
// untouched, so a repair is additive and the operator can still publish either one.
|
|
12
|
+
import { readFileSync } from 'node:fs';
|
|
13
|
+
import { resolve } from 'node:path';
|
|
14
|
+
import { assetrepair, assetstore, events } from '@evomap/evolver-core';
|
|
15
|
+
import { loadEnvFileFromEnv } from '@evomap/evolver-mcp';
|
|
16
|
+
import { loadAssetRef } from './cliContracts.js';
|
|
17
|
+
import { storeRepairedAsset } from './repairedAssetStore.js';
|
|
18
|
+
const CONTRACT = 'asset_repair.v1';
|
|
19
|
+
const ASSET_REPAIR_USAGE = [
|
|
20
|
+
'usage: evolver asset-repair --asset <id|path> [--asset <id|path>] --json [--rejection <file|->] [--apply]',
|
|
21
|
+
].join('\n');
|
|
22
|
+
export async function runAssetRepairCommand(argv, deps = {}) {
|
|
23
|
+
const stdout = deps.stdout ?? ((line) => { process.stdout.write(`${line}\n`); });
|
|
24
|
+
const stderr = deps.stderr ?? ((line) => { process.stderr.write(`${line}\n`); });
|
|
25
|
+
if (argv.includes('--help') || argv.includes('-h')) {
|
|
26
|
+
stdout(ASSET_REPAIR_USAGE);
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
29
|
+
const parsed = parseAssetRepairArgs(argv);
|
|
30
|
+
if (!parsed.ok)
|
|
31
|
+
return emit({ status: 'invalid_arg', message: parsed.error, assets: [] }, parsed.value?.jsonOut ?? argv.includes('--json'), stdout, stderr);
|
|
32
|
+
const { refs, rejectionPath, apply, jsonOut } = parsed.value;
|
|
33
|
+
const env = deps.env ?? process.env;
|
|
34
|
+
loadEnvFileFromEnv(env);
|
|
35
|
+
const loaded = await Promise.all(refs.map(async (ref) => {
|
|
36
|
+
try {
|
|
37
|
+
return { ref, record: await loadAssetRef(ref, { ...deps, env }) };
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
// Ref resolution is the only failure mode here, and its message is caller-controlled text — report the
|
|
41
|
+
// ref we were given, never the underlying error string.
|
|
42
|
+
return { ref, record: undefined };
|
|
43
|
+
}
|
|
44
|
+
}));
|
|
45
|
+
let hubIssuesByIndex;
|
|
46
|
+
try {
|
|
47
|
+
hubIssuesByIndex = rejectionPath === undefined
|
|
48
|
+
? new Map()
|
|
49
|
+
: assetrepair.hubRejectionIssues(JSON.parse(readRejectionBody(rejectionPath, deps)), {
|
|
50
|
+
assetTypes: loaded.map((entry) => (typeof entry.record?.type === 'string' ? entry.record.type : undefined)),
|
|
51
|
+
}).byAssetIndex;
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return emit({ status: 'invalid_arg', message: 'rejection body is not readable JSON', assets: [] }, jsonOut, stdout, stderr);
|
|
55
|
+
}
|
|
56
|
+
const store = deps.store ?? new assetstore.LocalJsonlProvider(events.assetsDir(env));
|
|
57
|
+
const outcomes = [];
|
|
58
|
+
for (const [index, entry] of loaded.entries()) {
|
|
59
|
+
if (!entry.record) {
|
|
60
|
+
outcomes.push({ ref: entry.ref, repair_status: 'not_found', changes: [], blockers: [] });
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
outcomes.push(await repairOne(entry.ref, entry.record, index, { deps, env, store, apply, hubIssuesByIndex }));
|
|
64
|
+
}
|
|
65
|
+
const status = outcomes.some((outcome) => outcome.repair_status === 'not_found')
|
|
66
|
+
? 'not_found'
|
|
67
|
+
: outcomes.some((outcome) => outcome.repair_status === 'unrepairable')
|
|
68
|
+
? 'unrepairable'
|
|
69
|
+
: 'ok';
|
|
70
|
+
return emit({ status, message: summaryMessage(status, apply), assets: outcomes }, jsonOut, stdout, stderr);
|
|
71
|
+
}
|
|
72
|
+
async function repairOne(ref, original, index, ctx) {
|
|
73
|
+
const hubIssues = [...(ctx.hubIssuesByIndex.get(index) ?? []), ...(ctx.hubIssuesByIndex.get(-1) ?? [])];
|
|
74
|
+
const report = assetrepair.repairAssetRecord(original, { hubIssues });
|
|
75
|
+
const base = {
|
|
76
|
+
ref,
|
|
77
|
+
repair_status: report.status,
|
|
78
|
+
...(original.asset_id ? { asset_id: original.asset_id } : {}),
|
|
79
|
+
changes: report.changes,
|
|
80
|
+
blockers: report.blockers,
|
|
81
|
+
};
|
|
82
|
+
if (report.status !== 'repaired' || !report.asset)
|
|
83
|
+
return base;
|
|
84
|
+
const repairedAssetId = report.asset.asset_id;
|
|
85
|
+
if (!ctx.apply)
|
|
86
|
+
return { ...base, repaired_asset_id: repairedAssetId, stored: false };
|
|
87
|
+
const stored = await storeRepairedAsset(report.asset, ctx.store, ctx.env);
|
|
88
|
+
return { ...base, repaired_asset_id: repairedAssetId, stored };
|
|
89
|
+
}
|
|
90
|
+
export function parseAssetRepairArgs(argv) {
|
|
91
|
+
const refs = [];
|
|
92
|
+
let rejectionPath;
|
|
93
|
+
let apply = false;
|
|
94
|
+
let jsonOut = false;
|
|
95
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
96
|
+
const token = argv[i];
|
|
97
|
+
if (token === undefined)
|
|
98
|
+
continue;
|
|
99
|
+
if (token === '--json') {
|
|
100
|
+
jsonOut = true;
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
if (token === '--apply') {
|
|
104
|
+
apply = true;
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
const valued = valueOf(token, argv, i);
|
|
108
|
+
if (valued?.flag === '--asset') {
|
|
109
|
+
refs.push(valued.value);
|
|
110
|
+
i += valued.consumed;
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
if (valued?.flag === '--rejection') {
|
|
114
|
+
rejectionPath = valued.value;
|
|
115
|
+
i += valued.consumed;
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if (token === '--asset' || token === '--rejection')
|
|
119
|
+
return { ok: false, error: `${token} requires a value` };
|
|
120
|
+
return { ok: false, error: 'unsupported asset-repair argument' };
|
|
121
|
+
}
|
|
122
|
+
if (!jsonOut)
|
|
123
|
+
return { ok: false, error: 'asset-repair requires --json' };
|
|
124
|
+
if (refs.length === 0)
|
|
125
|
+
return { ok: false, error: 'asset-repair requires --asset <id|path>', value: { refs, apply, jsonOut } };
|
|
126
|
+
return { ok: true, value: { refs, ...(rejectionPath !== undefined ? { rejectionPath } : {}), apply, jsonOut } };
|
|
127
|
+
}
|
|
128
|
+
function valueOf(token, argv, index) {
|
|
129
|
+
for (const flag of ['--asset', '--rejection']) {
|
|
130
|
+
if (token.startsWith(`${flag}=`)) {
|
|
131
|
+
const value = token.slice(flag.length + 1).trim();
|
|
132
|
+
return value ? { flag, value, consumed: 0 } : undefined;
|
|
133
|
+
}
|
|
134
|
+
if (token === flag) {
|
|
135
|
+
const next = argv[index + 1]?.trim();
|
|
136
|
+
return next && !next.startsWith('--') ? { flag, value: next, consumed: 1 } : undefined;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return undefined;
|
|
140
|
+
}
|
|
141
|
+
function readRejectionBody(path, deps) {
|
|
142
|
+
if (deps.readRejection)
|
|
143
|
+
return deps.readRejection(path);
|
|
144
|
+
return readFileSync(path === '-' ? 0 : resolve(path), 'utf8');
|
|
145
|
+
}
|
|
146
|
+
function summaryMessage(status, apply) {
|
|
147
|
+
if (status === 'not_found')
|
|
148
|
+
return 'one or more asset references could not be resolved';
|
|
149
|
+
if (status === 'unrepairable')
|
|
150
|
+
return 'one or more assets need fields that cannot be derived; see blockers';
|
|
151
|
+
return apply ? 'repaired assets written to the local recall library' : 'repair plan only; re-run with --apply to write it';
|
|
152
|
+
}
|
|
153
|
+
function emit(result, jsonOut, stdout, stderr) {
|
|
154
|
+
const ok = result.status === 'ok';
|
|
155
|
+
if (jsonOut) {
|
|
156
|
+
stdout(JSON.stringify({ ok, contract: CONTRACT, status: result.status, message: result.message, assets: result.assets }));
|
|
157
|
+
return ok ? 0 : 1;
|
|
158
|
+
}
|
|
159
|
+
for (const asset of result.assets) {
|
|
160
|
+
const detail = asset.repair_status === 'repaired'
|
|
161
|
+
? `${asset.changes.length} change(s)${asset.repaired_asset_id ? ` → ${asset.repaired_asset_id}` : ''}`
|
|
162
|
+
: asset.repair_status === 'unrepairable'
|
|
163
|
+
? `blocked on ${asset.blockers.map((blocker) => blocker.path).join(', ')}`
|
|
164
|
+
: asset.repair_status;
|
|
165
|
+
stdout(`asset-repair ${asset.ref}: ${detail}`);
|
|
166
|
+
}
|
|
167
|
+
if (ok)
|
|
168
|
+
stdout(`asset-repair: ${result.message}`);
|
|
169
|
+
else
|
|
170
|
+
stderr(`asset-repair failed (${result.status}): ${result.message}`);
|
|
171
|
+
return ok ? 0 : 1;
|
|
172
|
+
}
|
|
@@ -197,8 +197,8 @@ function slug(value) {
|
|
|
197
197
|
const out = value.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 64);
|
|
198
198
|
return out || 'recurring-failure-guardrail';
|
|
199
199
|
}
|
|
200
|
-
function buildAntiGenePrompt(input) {
|
|
201
|
-
const
|
|
200
|
+
function buildAntiGenePrompt(input, redact = true) {
|
|
201
|
+
const rawClusters = input.failureClusters.map((cluster) => ({
|
|
202
202
|
clusterId: cluster.clusterId,
|
|
203
203
|
trigger: cluster.trigger,
|
|
204
204
|
sharedTrigger: cluster.sharedTrigger,
|
|
@@ -212,7 +212,8 @@ function buildAntiGenePrompt(input) {
|
|
|
212
212
|
outcome: capsule.outcome,
|
|
213
213
|
proofOfWork: capsule.proofOfWork,
|
|
214
214
|
})),
|
|
215
|
-
}))
|
|
215
|
+
}));
|
|
216
|
+
const clusters = redact ? hub.redactDeep(rawClusters) : rawClusters;
|
|
216
217
|
return [
|
|
217
218
|
'You are synthesizing one EvoMap AntiGene from recurring failed Capsules.',
|
|
218
219
|
'An AntiGene is a guardrail: it says what to avoid or check before repeating a known failure pattern.',
|
|
@@ -343,10 +344,11 @@ export async function autoDistillAntiGene(options) {
|
|
|
343
344
|
if (!patchState(statePath, input.dataHash, { last_attempt_at: new Date(now).toISOString() }, hashCap)) {
|
|
344
345
|
return { ok: false, mode, reason: 'state_write_failed', dataHash: input.dataHash };
|
|
345
346
|
}
|
|
346
|
-
|
|
347
|
-
if (hub.detectEnvValueLeaks(
|
|
347
|
+
// 先扫描脱敏前的同构 prompt,防止新增的模式脱敏掩盖反向环境变量泄漏证据。
|
|
348
|
+
if (hub.detectEnvValueLeaks(buildAntiGenePrompt(input, false), env).length > 0) {
|
|
348
349
|
return { ok: false, mode, reason: 'prompt_env_leak_blocked', dataHash: input.dataHash };
|
|
349
350
|
}
|
|
351
|
+
const prompt = buildAntiGenePrompt(input);
|
|
350
352
|
const runner = options.runner ?? resolveDistillRunner(env);
|
|
351
353
|
const timeoutMs = envInt(env, 'EVOLVE_DISTILL_TIMEOUT_MS', DEFAULT_TIMEOUT_MS);
|
|
352
354
|
const llm = await runner(prompt, { cwd: options.cwd ?? process.cwd(), timeoutMs, env });
|
package/dist/autoDistillLlm.d.ts
CHANGED
|
@@ -62,6 +62,26 @@ export declare function p3Decide(mode: Exclude<AutoDistillLlmMode, 'off'>, rec:
|
|
|
62
62
|
cooldownMs?: number;
|
|
63
63
|
maxAttempts?: number;
|
|
64
64
|
}): 'spawn' | 'enforced_idempotent_skip' | 'shadow_idempotent_skip' | 'failed_exhausted' | 'p3_cooldown';
|
|
65
|
+
/**
|
|
66
|
+
* Resolve a distilled candidate's hard scope facets against the vocabulary the existing genes actually declare.
|
|
67
|
+
*
|
|
68
|
+
* This closes the failure the autonomous-scope experiment isolated (bench/thesis/result-recovery-autoscope-joint-metric.json):
|
|
69
|
+
* a distiller told that `required:<tag>` is a hard facet chose one in 5/5 runs and aimed it at the right dimension, but
|
|
70
|
+
* wrote `required:v2` where the live signal is `rounding-v2`. A facet is matched against live signals, so it never
|
|
71
|
+
* matched and the asset was never eligible anywhere. The distiller cannot be blamed for that: it reads solved code and
|
|
72
|
+
* never observes the retrieval vocabulary. Here the substrate supplies what it cannot see.
|
|
73
|
+
*
|
|
74
|
+
* Conservative by construction: only an exact hit or a single unambiguous qualifier relation is rewritten. Ambiguous
|
|
75
|
+
* and unknown tags are left EXACTLY as the distiller wrote them, because silently retargeting a scope key on a weak
|
|
76
|
+
* similarity would be a worse governance failure than an unmatched facet — scope decides what enters agent context.
|
|
77
|
+
*/
|
|
78
|
+
export declare function resolveCandidateScopeFacets(candidate: algo.GeneCandidate, existingGenes: readonly assetstore.AssetRecord[]): {
|
|
79
|
+
candidate: algo.GeneCandidate;
|
|
80
|
+
rewrites: Array<{
|
|
81
|
+
from: string;
|
|
82
|
+
to: string;
|
|
83
|
+
}>;
|
|
84
|
+
};
|
|
65
85
|
export declare function parseDistillOutput(stdout: string): unknown | null;
|
|
66
86
|
export declare function asGeneCandidate(value: unknown): algo.GeneCandidate | null;
|
|
67
87
|
export declare function jaccardDuplicate(candidate: algo.GeneCandidate, existing: readonly algo.ExistingGeneRef[], threshold?: number): string | null;
|
package/dist/autoDistillLlm.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createHash, randomUUID } from 'node:crypto';
|
|
|
2
2
|
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, readSync, realpathSync, renameSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
3
|
import { tmpdir } from 'node:os';
|
|
4
4
|
import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
5
|
-
import { algo, assetstore, events, exec, hub, verify } from '@evomap/evolver-core';
|
|
5
|
+
import { algo, assetstore, events, exec, hub, signals, verify } from '@evomap/evolver-core';
|
|
6
6
|
import { runRequiredSandboxedValidation } from './requiredSandboxValidation.js';
|
|
7
7
|
const DEFAULT_MIN_CAPSULES = 10;
|
|
8
8
|
const DEFAULT_MAX_CAPSULES = 24;
|
|
@@ -99,6 +99,37 @@ function normalizedSignals(record) {
|
|
|
99
99
|
const raw = record['signals_match'];
|
|
100
100
|
return Array.isArray(raw) ? raw.map(String).filter(Boolean) : [];
|
|
101
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Resolve a distilled candidate's hard scope facets against the vocabulary the existing genes actually declare.
|
|
104
|
+
*
|
|
105
|
+
* This closes the failure the autonomous-scope experiment isolated (bench/thesis/result-recovery-autoscope-joint-metric.json):
|
|
106
|
+
* a distiller told that `required:<tag>` is a hard facet chose one in 5/5 runs and aimed it at the right dimension, but
|
|
107
|
+
* wrote `required:v2` where the live signal is `rounding-v2`. A facet is matched against live signals, so it never
|
|
108
|
+
* matched and the asset was never eligible anywhere. The distiller cannot be blamed for that: it reads solved code and
|
|
109
|
+
* never observes the retrieval vocabulary. Here the substrate supplies what it cannot see.
|
|
110
|
+
*
|
|
111
|
+
* Conservative by construction: only an exact hit or a single unambiguous qualifier relation is rewritten. Ambiguous
|
|
112
|
+
* and unknown tags are left EXACTLY as the distiller wrote them, because silently retargeting a scope key on a weak
|
|
113
|
+
* similarity would be a worse governance failure than an unmatched facet — scope decides what enters agent context.
|
|
114
|
+
*/
|
|
115
|
+
export function resolveCandidateScopeFacets(candidate, existingGenes) {
|
|
116
|
+
const tags = candidate.signals_match?.map(String) ?? [];
|
|
117
|
+
if (tags.length === 0 || existingGenes.length === 0)
|
|
118
|
+
return { candidate, rewrites: [] };
|
|
119
|
+
const vocab = signals.scopeVocabularyFromRecords(existingGenes);
|
|
120
|
+
const rewrites = [];
|
|
121
|
+
const next = tags.map((tag) => {
|
|
122
|
+
if (!tag.startsWith('required:'))
|
|
123
|
+
return tag;
|
|
124
|
+
const r = signals.resolveScopeTag(tag, vocab);
|
|
125
|
+
if (r.status !== 'resolved')
|
|
126
|
+
return tag;
|
|
127
|
+
const to = `required:${r.resolved}`;
|
|
128
|
+
rewrites.push({ from: tag, to });
|
|
129
|
+
return to;
|
|
130
|
+
});
|
|
131
|
+
return rewrites.length > 0 ? { candidate: { ...candidate, signals_match: next }, rewrites } : { candidate, rewrites: [] };
|
|
132
|
+
}
|
|
102
133
|
function existingGeneRefs(records) {
|
|
103
134
|
return records.map((record) => ({
|
|
104
135
|
id: typeof record['id'] === 'string' ? record['id'] : undefined,
|
|
@@ -136,14 +167,25 @@ async function collectDistillInput(store, maxCapsules, minSuccessScore) {
|
|
|
136
167
|
const successCapsules = capsules.filter((record) => isSuccessCapsule(record, minSuccessScore)).slice(-maxCapsules);
|
|
137
168
|
return { dataHash: hashCapsules(successCapsules), successCapsules, existingGenes };
|
|
138
169
|
}
|
|
139
|
-
function buildDistillPrompt(input) {
|
|
140
|
-
const
|
|
141
|
-
const
|
|
170
|
+
function buildDistillPrompt(input, redact = true) {
|
|
171
|
+
const rawCapsules = input.successCapsules.map(capsuleDigestView);
|
|
172
|
+
const rawGenes = input.existingGenes.map((gene) => ({
|
|
142
173
|
id: gene['id'],
|
|
143
174
|
category: gene['category'],
|
|
144
175
|
signals_match: gene['signals_match'],
|
|
145
176
|
summary: gene['summary'],
|
|
146
|
-
}))
|
|
177
|
+
}));
|
|
178
|
+
const capsules = redact ? hub.redactDeep(rawCapsules) : rawCapsules;
|
|
179
|
+
const genes = redact ? hub.redactDeep(rawGenes) : rawGenes;
|
|
180
|
+
// Scope-language alignment (review ②): show the model the signals the store ACTUALLY uses BEFORE it chooses a
|
|
181
|
+
// scope facet. The autonomous-scope experiment (result-recovery-autoscope-joint-metric.json) isolated the
|
|
182
|
+
// failure as structural, not a model weakness — the distiller reads solved source code and never observes the
|
|
183
|
+
// retrieval vocabulary its consumers present, so it wrote `required:v2` where the live signal was `rounding-v2`
|
|
184
|
+
// and the asset matched nothing. `resolveCandidateScopeFacets` corrects that post-hoc only for the single
|
|
185
|
+
// unambiguous qualifier relation; surfacing the real vocabulary up front lets the model pick a signal that
|
|
186
|
+
// EXISTS in the first place, covering the ambiguous/unknown cases the post-hoc rewrite deliberately refuses to
|
|
187
|
+
// guess. Descriptive, not prescriptive: it does not forbid a genuinely new signal, only makes the real ones visible.
|
|
188
|
+
const vocab = signals.scopeVocabularyFromRecords(input.existingGenes);
|
|
147
189
|
return [
|
|
148
190
|
'You are synthesizing one high-quality EvoMap Gene from recurring successful Capsules.',
|
|
149
191
|
'Return only JSON. Do not use markdown. Do not include commentary.',
|
|
@@ -154,11 +196,23 @@ function buildDistillPrompt(input) {
|
|
|
154
196
|
'- Strategy steps must be concrete, defensive, and reusable.',
|
|
155
197
|
'- Validation must be light. Prefer ["node --version"]. Do not use test suites, node --test, jest, mocha, or node -e.',
|
|
156
198
|
'- Avoid duplicating existing genes.',
|
|
199
|
+
// Scope facets are matched against LIVE retrieval signals, so a facet naming a signal that does not exist is
|
|
200
|
+
// dead on arrival. Reuse a signal from OBSERVED_SIGNALS below when it names the scope you mean; only invent a
|
|
201
|
+
// new signal for a genuinely new scope dimension. For a hard scope facet write `required:<signal>` using the
|
|
202
|
+
// EXACT signal string as it appears there (e.g. `required:rounding-v2`, never a bare qualifier like `required:v2`).
|
|
203
|
+
'- Scope signals must name signals that exist: reuse an OBSERVED_SIGNALS entry verbatim unless the scope is genuinely new.',
|
|
204
|
+
// K_auto coordinates (optional but preferred). Intake fills honest defaults when omitted; when present they
|
|
205
|
+
// must use closed vocabularies so the gene can enter automatic claim-level governance.
|
|
206
|
+
'- Optional K_auto fields: claims (closed predicates), scope.signals (prefer namespaced terms like capability:<signal> or repo:org/name), runtime_profile, verifier_profile.',
|
|
207
|
+
'- claims[].predicate MUST be one of: source_of_truth, requires_service, requires_tool, forbids_action, output_contract, ordering_constraint, environment_precondition.',
|
|
157
208
|
'',
|
|
158
209
|
'Required JSON shape:',
|
|
159
|
-
'{"type":"Gene","id":"gene_distilled_<descriptive-kebab-name>","summary":"...","category":"repair|optimize|innovate|explore","signals_match":["signal"],"preconditions":["condition"],"strategy":["step"],"constraints":{"max_files":3,"forbidden_paths":[".git","node_modules"]},"validation":["node --version"]}',
|
|
210
|
+
'{"type":"Gene","id":"gene_distilled_<descriptive-kebab-name>","summary":"...","category":"repair|optimize|innovate|explore","signals_match":["signal"],"preconditions":["condition"],"strategy":["step"],"constraints":{"max_files":3,"forbidden_paths":[".git","node_modules"]},"validation":["node --version"],"claims":[{"predicate":"output_contract","kind":"behavioral"}],"scope":{"signals":["capability:signal"]},"runtime_profile":{"runtime":"model-id","env_class":"local"},"verifier_profile":{"verifier":"evolver-sandboxed-validation","decision":"pass"}}',
|
|
160
211
|
'',
|
|
161
212
|
`DATA_HASH: ${input.dataHash}`,
|
|
213
|
+
'OBSERVED_SIGNALS (signal (asset_count), most-used first — reuse these exact strings for scope):',
|
|
214
|
+
signals.renderScopeVocabulary(vocab),
|
|
215
|
+
'',
|
|
162
216
|
'SUCCESS_CAPSULES:',
|
|
163
217
|
JSON.stringify(capsules, null, 2),
|
|
164
218
|
'',
|
|
@@ -268,6 +322,12 @@ export function asGeneCandidate(value) {
|
|
|
268
322
|
},
|
|
269
323
|
} : {}),
|
|
270
324
|
...(Array.isArray(value['validation']) ? { validation: value['validation'].map(String) } : {}),
|
|
325
|
+
// K_auto coordinates: pass through when the model supplies them. intakeGene normalizes + fills honest
|
|
326
|
+
// defaults for any missing coordinate so forward genes can enter strict K_auto without inventing claims.
|
|
327
|
+
...(value['claims'] !== undefined ? { claims: value['claims'] } : {}),
|
|
328
|
+
...(value['scope'] !== undefined ? { scope: value['scope'] } : {}),
|
|
329
|
+
...(value['runtime_profile'] !== undefined ? { runtime_profile: value['runtime_profile'] } : {}),
|
|
330
|
+
...(value['verifier_profile'] !== undefined ? { verifier_profile: value['verifier_profile'] } : {}),
|
|
271
331
|
// An LLM-distilled gene is distilled from prior capsule/session evidence (not a verified fail→pass trajectory,
|
|
272
332
|
// not a human-taught gene) → `distilled` per V1 #302 classifyProvenance. intakeGene normalizes + validates it.
|
|
273
333
|
generation_meta: { source: 'distilled' },
|
|
@@ -479,16 +539,12 @@ export async function autoDistillLlm(options) {
|
|
|
479
539
|
}
|
|
480
540
|
const runner = options.runner ?? resolveDistillRunner(env);
|
|
481
541
|
const timeoutMs = envInt(env, 'EVOLVE_DISTILL_TIMEOUT_MS', DEFAULT_TIMEOUT_MS);
|
|
482
|
-
|
|
483
|
-
//
|
|
484
|
-
|
|
485
|
-
// appearing verbatim in the payload — catching custom-format secrets no pattern matches. The prompt is an
|
|
486
|
-
// off-box egress (stdin to a spawned `claude`), so hold it to the same floor the repo enforces on publish: if a
|
|
487
|
-
// daemon env secret leaked into a capsule, fail CLOSED and never send it. This is a data-hygiene block, not a
|
|
488
|
-
// deterministic claude failure, so — like a transient exit below — it does NOT bump failed_attempts.
|
|
489
|
-
if (hub.detectEnvValueLeaks(prompt, env).length > 0) {
|
|
542
|
+
// LLM prompt 属于外部输出边界。先对脱敏前的同构内容执行反向环境变量扫描,
|
|
543
|
+
// 避免高熵模式先替换秘密后让泄漏检查误判为安全;该阻断不计入确定性失败次数。
|
|
544
|
+
if (hub.detectEnvValueLeaks(buildDistillPrompt(input, false), env).length > 0) {
|
|
490
545
|
return { ok: false, mode, reason: 'prompt_env_leak_blocked', dataHash: input.dataHash };
|
|
491
546
|
}
|
|
547
|
+
const prompt = buildDistillPrompt(input);
|
|
492
548
|
const llm = await runner(prompt, { cwd, timeoutMs, env });
|
|
493
549
|
if (llm.exitCode !== 0) {
|
|
494
550
|
// V1 parity: a PROCESS-level claude failure — spawn error/ENOENT or timeout→SIGKILL (exitCode === null), OR a
|
|
@@ -509,7 +565,13 @@ export async function autoDistillLlm(options) {
|
|
|
509
565
|
return { ok: false, mode, reason: 'no_gene_in_response', dataHash: input.dataHash };
|
|
510
566
|
}
|
|
511
567
|
const existing = existingGeneRefs(input.existingGenes);
|
|
512
|
-
|
|
568
|
+
// Resolve hard scope facets against the observed vocabulary BEFORE dedup/intake, so a near-miss facet
|
|
569
|
+
// (`required:v2` for a store that declares `rounding-v2`) becomes eligible instead of silently unmatched.
|
|
570
|
+
const scoped = resolveCandidateScopeFacets(candidate0, input.existingGenes);
|
|
571
|
+
if (scoped.rewrites.length > 0) {
|
|
572
|
+
console.warn(`[AutoDistill] resolved scope facet(s) against store vocabulary: ${scoped.rewrites.map((r) => `${r.from} -> ${r.to}`).join(', ')}`);
|
|
573
|
+
}
|
|
574
|
+
const normalized = normalizeValidation(scoped.candidate, cwd).candidate;
|
|
513
575
|
const duplicate = jaccardDuplicate(normalized, existing, envFloat(env, 'EVOLVER_AUTO_DISTILL_LLM_DUP_JACCARD', DEFAULT_DUP_JACCARD));
|
|
514
576
|
if (duplicate) {
|
|
515
577
|
patchState(statePath, input.dataHash, { failed_attempts_inc: true }, hashCap);
|
package/dist/autoexec.d.ts
CHANGED
|
@@ -10,7 +10,18 @@ import { type AutoDistillAntiGeneMode, type AutoDistillAntiGeneResult } from './
|
|
|
10
10
|
import { type AutoDistillTranscriptMode, type TranscriptDistillTickResult } from './autoDistillTranscript.js';
|
|
11
11
|
import { type SessionIngestTickResult } from './sessionIngest.js';
|
|
12
12
|
import { AtpAutoBuyer, type AtpAutoBuyerClient, type AtpAutoBuyerRequest } from './atpAutoBuyer.js';
|
|
13
|
+
import { type ConfiguredSelectionGuard } from './selectionPolicyConfig.js';
|
|
13
14
|
export { readAutoExecConfig, type AutoExecConfig } from './autoexecConfig.js';
|
|
15
|
+
export { semanticIdfEnabled } from './semanticIdfConfig.js';
|
|
16
|
+
export { selectionFloorFromEnv, selectionGuardFromEnv, selectionPolicyFromEnv, type ConfiguredSelectionGuard, } from './selectionPolicyConfig.js';
|
|
17
|
+
export declare function withAutoExecSelectionPolicy<T extends object>(deps: T, env?: NodeJS.ProcessEnv): T & {
|
|
18
|
+
selectionPolicy?: exec.AutoExecDeps['selectionPolicy'];
|
|
19
|
+
};
|
|
20
|
+
export declare function withAutoExecSelectionConfig<T extends object>(deps: T, env?: NodeJS.ProcessEnv): T & {
|
|
21
|
+
selectionPolicy?: exec.AutoExecDeps['selectionPolicy'];
|
|
22
|
+
selectionGuard: ConfiguredSelectionGuard;
|
|
23
|
+
selectionFloor?: number;
|
|
24
|
+
};
|
|
14
25
|
export interface AutoExecDirs {
|
|
15
26
|
base: string;
|
|
16
27
|
tasks: string;
|
package/dist/autoexec.js
CHANGED
|
@@ -33,7 +33,25 @@ import { initializeWorkflowStartupRecovery } from './workflowRuntime.js';
|
|
|
33
33
|
import { readAutoExecConfig } from './autoexecConfig.js';
|
|
34
34
|
import { makeCurriculumCapabilityGapsProvider } from './curriculumCapabilityGaps.js';
|
|
35
35
|
import { resolveLearningTrace } from './learningTrace.js';
|
|
36
|
+
import { semanticIdfEnabled } from './semanticIdfConfig.js';
|
|
37
|
+
import { selectionFloorFromEnv, selectionGuardFromEnv, selectionPolicyFromEnv, } from './selectionPolicyConfig.js';
|
|
36
38
|
export { readAutoExecConfig } from './autoexecConfig.js';
|
|
39
|
+
export { semanticIdfEnabled } from './semanticIdfConfig.js';
|
|
40
|
+
export { selectionFloorFromEnv, selectionGuardFromEnv, selectionPolicyFromEnv, } from './selectionPolicyConfig.js';
|
|
41
|
+
export function withAutoExecSelectionPolicy(deps, env = process.env) {
|
|
42
|
+
const policy = selectionPolicyFromEnv(env);
|
|
43
|
+
return policy === 'engine-health' ? deps : { ...deps, selectionPolicy: policy };
|
|
44
|
+
}
|
|
45
|
+
export function withAutoExecSelectionConfig(deps, env = process.env) {
|
|
46
|
+
const withPolicy = withAutoExecSelectionPolicy(deps, env);
|
|
47
|
+
const selectionGuard = selectionGuardFromEnv(env);
|
|
48
|
+
const selectionFloor = selectionFloorFromEnv(env);
|
|
49
|
+
return {
|
|
50
|
+
...withPolicy,
|
|
51
|
+
selectionGuard,
|
|
52
|
+
...(selectionFloor !== undefined ? { selectionFloor } : {}),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
37
55
|
const ENV_FILE_UNAVAILABLE_DIAGNOSTIC = '[evolver-autoexec] env_file_unavailable\n';
|
|
38
56
|
/** Create the queue layout under <home>/autoexec/{tasks,inflight,done,refused}. */
|
|
39
57
|
export function ensureAutoExecDirs(base) {
|
|
@@ -176,7 +194,8 @@ function isAutoExecVerdict(value, taskId) {
|
|
|
176
194
|
|| candidate.status === 'skipped'
|
|
177
195
|
|| candidate.status === 'solidified'
|
|
178
196
|
|| candidate.status === 'failed'
|
|
179
|
-
|| candidate.status === 'innovated'
|
|
197
|
+
|| candidate.status === 'innovated'
|
|
198
|
+
|| candidate.status === 'unsafe_to_replay');
|
|
180
199
|
}
|
|
181
200
|
function persistedClaimReceipt(dirs, claim, taskId) {
|
|
182
201
|
try {
|
|
@@ -191,7 +210,7 @@ function persistedClaimReceipt(dirs, claim, taskId) {
|
|
|
191
210
|
|| (receipt.destination !== 'done' && receipt.destination !== 'refused')
|
|
192
211
|
|| !isAutoExecVerdict(receipt.verdict, taskId))
|
|
193
212
|
return null;
|
|
194
|
-
const expectedDestination = receipt.verdict.status === 'refused' ? 'refused' : 'done';
|
|
213
|
+
const expectedDestination = receipt.verdict.status === 'refused' || receipt.verdict.status === 'unsafe_to_replay' ? 'refused' : 'done';
|
|
195
214
|
if (receipt.destination !== expectedDestination)
|
|
196
215
|
return null;
|
|
197
216
|
return receipt;
|
|
@@ -311,7 +330,7 @@ export async function autoExecPass(dirs, runOne, options = {}) {
|
|
|
311
330
|
const startedPath = join(dirs.inflight, startedName);
|
|
312
331
|
renameSync(taskPath, startedPath);
|
|
313
332
|
const v = await runOne(task).catch((e) => ({ taskId: task.id, status: 'failed', reason: e instanceof Error ? e.message : String(e) }));
|
|
314
|
-
const destination = v.status === 'refused' ? 'refused' : 'done';
|
|
333
|
+
const destination = v.status === 'refused' || v.status === 'unsafe_to_replay' ? 'refused' : 'done';
|
|
315
334
|
const dest = destination === 'refused' ? dirs.refused : dirs.done;
|
|
316
335
|
persistClaimReceipt(dirs, { claimName: startedName, destination, verdict: v });
|
|
317
336
|
writeFileSync(join(dest, claim.originalName), JSON.stringify(v, null, 2));
|
|
@@ -610,7 +629,7 @@ const DISTILL_TICK_EXPLORATION_SIGNALS = ['stable_success_plateau', 'runtime_ses
|
|
|
610
629
|
* refused/skipped ran no cycle — there is nothing to attribute, so no report.
|
|
611
630
|
*/
|
|
612
631
|
export function verdictToOutcomeStatus(status) {
|
|
613
|
-
if (status === 'solidified'
|
|
632
|
+
if (status === 'solidified')
|
|
614
633
|
return 'success';
|
|
615
634
|
if (status === 'failed')
|
|
616
635
|
return 'failed';
|
|
@@ -1555,29 +1574,65 @@ export async function runAutoExec(argv) {
|
|
|
1555
1574
|
const solidifyPermit = resolveSolidifyPermitGate(process.env);
|
|
1556
1575
|
const strategyName = process.env['EVOLVE_STRATEGY'];
|
|
1557
1576
|
const probationOn = geneProbationEnabled();
|
|
1577
|
+
const semanticIdfOn = semanticIdfEnabled();
|
|
1578
|
+
const selectionPolicy = selectionPolicyFromEnv();
|
|
1579
|
+
const selectionGuard = selectionGuardFromEnv();
|
|
1580
|
+
const selectionFloor = selectionFloorFromEnv();
|
|
1558
1581
|
// File-only and best-effort: tracing must never fail or slow a task.
|
|
1559
1582
|
const learningTrace = resolveLearningTrace(process.env);
|
|
1560
|
-
const
|
|
1583
|
+
const executionBindingAuthority = {
|
|
1584
|
+
claimLease: () => false,
|
|
1585
|
+
acceptanceSpec: () => false,
|
|
1586
|
+
budget: () => false,
|
|
1587
|
+
consent: () => false,
|
|
1588
|
+
};
|
|
1589
|
+
const deps = withAutoExecSelectionConfig({
|
|
1561
1590
|
engine, store, provenance, review, personality: personalityStore, memoryGraph,
|
|
1591
|
+
executionBinding: {
|
|
1592
|
+
journal: new exec.ExecutionBindingJournal(ingestor),
|
|
1593
|
+
authority: executionBindingAuthority,
|
|
1594
|
+
now: () => Date.now(),
|
|
1595
|
+
maxRuntimeMs: cfg.timeoutMs,
|
|
1596
|
+
},
|
|
1562
1597
|
...(learningTrace.config ? { learningTrace: learningTrace.config } : {}),
|
|
1563
1598
|
// Probation (#306, gated, default OFF via EVOLVER_GENE_PROBATION): try unproven auto-distilled genes (with their
|
|
1564
1599
|
// strategy embedded) so the cross-AI loop self-closes — contained by the proven exec gates + worktree isolation.
|
|
1565
1600
|
...(probationOn ? { includeProbation: true } : {}),
|
|
1601
|
+
...(!semanticIdfOn ? { disableSemanticIdf: true } : {}),
|
|
1566
1602
|
...(hubLink ? { hubReuse: hubLink.seam } : {}),
|
|
1567
1603
|
...(solidifyPermit ? { solidifyPermit } : {}),
|
|
1568
1604
|
...(strategyName !== undefined ? { strategyName } : {}),
|
|
1569
1605
|
// Validate through the hardened sandbox verifier so a validation command can't exfiltrate or phone home to game
|
|
1570
1606
|
// the result. Validation is bounded by the sandbox's own per-command cap (NOT the agent exec timeout, a
|
|
1571
1607
|
// different unit) so a long suite is not silently SIGKILL'd against the wrong budget.
|
|
1572
|
-
validate: (task) => async (_m, _d, cwd) => {
|
|
1608
|
+
validate: (task) => async (_m, _d, cwd, signal) => {
|
|
1573
1609
|
const cmds = task.validationCmds ?? [];
|
|
1574
|
-
const
|
|
1610
|
+
const bindingRuntimeMs = task.execution_binding?.resource_grant.max_runtime_ms;
|
|
1611
|
+
const safetyRuntimeMs = cfg.timeoutMs;
|
|
1612
|
+
const validationTimeoutMs = bindingRuntimeMs === undefined
|
|
1613
|
+
? safetyRuntimeMs
|
|
1614
|
+
: Math.min(bindingRuntimeMs, safetyRuntimeMs);
|
|
1615
|
+
const r = await runRequiredSandboxedValidation(cmds, cwd, { timeoutMs: validationTimeoutMs, ...(signal ? { signal } : {}) });
|
|
1575
1616
|
const validationSummary = summarizeSandboxedValidation(r);
|
|
1576
1617
|
if (validationSummary)
|
|
1577
1618
|
process.stdout.write(` validation: ${validationSummary}\n`);
|
|
1578
|
-
return {
|
|
1619
|
+
return {
|
|
1620
|
+
passed: r.passed,
|
|
1621
|
+
score: r.score,
|
|
1622
|
+
validator: {
|
|
1623
|
+
id: 'required_sandboxed_validation',
|
|
1624
|
+
version: 'sandboxed_validation.v1',
|
|
1625
|
+
status: 'ran',
|
|
1626
|
+
plan_digest: exec.computeValidationPlanDigest(cmds),
|
|
1627
|
+
passed: r.passed,
|
|
1628
|
+
score: r.score,
|
|
1629
|
+
results: r.results,
|
|
1630
|
+
skipped: r.skipped,
|
|
1631
|
+
isolated: r.isolated,
|
|
1632
|
+
},
|
|
1633
|
+
};
|
|
1579
1634
|
},
|
|
1580
|
-
};
|
|
1635
|
+
}, process.env);
|
|
1581
1636
|
const safety = { allowedRoots: cfg.allowedRoots, timeoutMs: cfg.timeoutMs, runner: cfg.runner };
|
|
1582
1637
|
// #268/#274 soft re-order — DEFAULT ON (kill switch: EVOLVER_REUSE_SIGNAL=0). Fold the latest cross-runtime reuse
|
|
1583
1638
|
// outcomes + observed recall into selection as a SMALL, bounded, clamped nudge (±REUSE_WEIGHT); reuseSignalAb.test
|
|
@@ -1612,7 +1667,7 @@ export async function runAutoExec(argv) {
|
|
|
1612
1667
|
const atpAutoDeliver = resolveAtpAutoDeliver(process.env);
|
|
1613
1668
|
const uninstallBrokenPipeGuards = installAutoexecBrokenPipeGuards();
|
|
1614
1669
|
const reuseEnabled = process.env['EVOLVER_REUSE_BEFORE_SOLVE'] === '1' && hubLink !== undefined;
|
|
1615
|
-
process.stdout.write(`evolver autoexec: runner=${cfg.runner} queue=${dirs.tasks} allowlist=${JSON.stringify(cfg.allowedRoots)} poll=${cfg.pollMs}ms reuse=${reuseEnabled ? 'on' : 'off'} reuse-signal=${reuseSignalOn ? 'on' : 'off'} probation=${probationOn ? 'on' : 'off'} questions=${hubQuestionLink ? 'on' : 'off'} permit=${solidifyPermit ? 'on' : 'off'} value-digest=${digest.enabled ? 'on' : 'off'} reflection=${reflection.enabled ? 'on' : 'off'} learning-trace=${learningTrace.enabled ? `on(upload=${learningTrace.upload})` : 'off'} memory-event-mirror=${memoryEventMirror.enabled ? 'on' : `off(${memoryEventMirror.reason ?? 'no_hub'})`} cursor-rewrite=${cursorRewrite.enabled ? 'on' : `off(${cursorRewrite.reason})`} auto-distill=${distill.enabled ? 'on' : 'off'} auto-distill-llm=${llmDistill.enabled ? llmDistill.mode : 'off'} auto-distill-anti-gene=${antiGeneDistill.enabled ? antiGeneDistill.mode : 'off'} auto-distill-transcript=${transcriptDistill.enabled ? transcriptDistill.mode : 'off'} atp-autodeliver=${atpAutoDeliver.enabled ? 'on' : `off(${atpAutoDeliver.reason})`}\n`);
|
|
1670
|
+
process.stdout.write(`evolver autoexec: runner=${cfg.runner} queue=${dirs.tasks} allowlist=${JSON.stringify(cfg.allowedRoots)} poll=${cfg.pollMs}ms reuse=${reuseEnabled ? 'on' : 'off'} reuse-signal=${reuseSignalOn ? 'on' : 'off'} semantic-idf=${semanticIdfOn ? 'on' : 'off'} selection-policy=${selectionPolicy} selection-guard=${selectionGuard} selection-floor=${selectionFloor === undefined ? 'unset' : selectionFloor} probation=${probationOn ? 'on' : 'off'} questions=${hubQuestionLink ? 'on' : 'off'} permit=${solidifyPermit ? 'on' : 'off'} value-digest=${digest.enabled ? 'on' : 'off'} reflection=${reflection.enabled ? 'on' : 'off'} learning-trace=${learningTrace.enabled ? `on(upload=${learningTrace.upload})` : 'off'} memory-event-mirror=${memoryEventMirror.enabled ? 'on' : `off(${memoryEventMirror.reason ?? 'no_hub'})`} cursor-rewrite=${cursorRewrite.enabled ? 'on' : `off(${cursorRewrite.reason})`} auto-distill=${distill.enabled ? 'on' : 'off'} auto-distill-llm=${llmDistill.enabled ? llmDistill.mode : 'off'} auto-distill-anti-gene=${antiGeneDistill.enabled ? antiGeneDistill.mode : 'off'} auto-distill-transcript=${transcriptDistill.enabled ? transcriptDistill.mode : 'off'} atp-autodeliver=${atpAutoDeliver.enabled ? 'on' : `off(${atpAutoDeliver.reason})`}\n`);
|
|
1616
1671
|
if (cfg.allowedRoots.length === 0)
|
|
1617
1672
|
process.stdout.write(' (allowlist empty → deny-by-default: nothing runs until you add a repo to config.json)\n');
|
|
1618
1673
|
// Single-instance lock (#106): a second daemon on the same home would double-process the queue. That is harmless
|
package/dist/autoexecConfig.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { verify } from '@evomap/evolver-core';
|
|
4
|
-
|
|
4
|
+
// Default resident-loop cadence: 30s base, still multiplied by idle sleepMultiplier and single-flight gated.
|
|
5
|
+
const DEFAULT_POLL_MS = 30_000;
|
|
5
6
|
const DEFAULT_TIMEOUT_MS = 600_000;
|
|
6
7
|
const MAX_VALIDATION_PROFILES = 32;
|
|
7
8
|
const MAX_VALIDATION_COMMANDS = 16;
|