@evomap/evolver-cli 2.0.19 → 2.0.24
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/autoDistillAntiGene.js +7 -5
- package/dist/autoDistillLlm.js +10 -12
- package/dist/autoexec.js +39 -7
- package/dist/cliContracts.d.ts +5 -0
- package/dist/cliContracts.js +85 -29
- package/dist/commandCatalog.d.ts +1 -0
- package/dist/commandCatalog.js +1 -0
- package/dist/cycleConsumer.js +3 -3
- package/dist/dispatch.js +2 -0
- package/dist/distillObserver.js +6 -4
- package/dist/doctor.d.ts +11 -0
- package/dist/doctor.js +24 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +98 -31
- package/dist/lifecycle.d.ts +23 -0
- package/dist/lifecycle.js +108 -6
- package/dist/modelCompatibility.d.ts +10 -0
- package/dist/modelCompatibility.js +296 -0
- package/dist/recipe.d.ts +7 -1
- package/dist/recipe.js +112 -10
- package/dist/requiredSandboxValidation.d.ts +2 -1
- package/dist/requiredSandboxValidation.js +36 -2
- package/dist/reviewFilter.d.ts +3 -1
- package/dist/reviewFilter.js +3 -1
- package/dist/setupHooks.js +12 -6
- package/dist/skill2gep.js +72 -8
- package/dist/valueDigest.js +8 -1
- package/dist/windowsLegacyTaskCleanup.d.ts +228 -0
- package/dist/windowsLegacyTaskCleanup.js +1475 -0
- package/dist/workflowRuntime.js +2 -2
- package/package.json +7 -7
|
@@ -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.js
CHANGED
|
@@ -167,14 +167,16 @@ async function collectDistillInput(store, maxCapsules, minSuccessScore) {
|
|
|
167
167
|
const successCapsules = capsules.filter((record) => isSuccessCapsule(record, minSuccessScore)).slice(-maxCapsules);
|
|
168
168
|
return { dataHash: hashCapsules(successCapsules), successCapsules, existingGenes };
|
|
169
169
|
}
|
|
170
|
-
function buildDistillPrompt(input) {
|
|
171
|
-
const
|
|
172
|
-
const
|
|
170
|
+
function buildDistillPrompt(input, redact = true) {
|
|
171
|
+
const rawCapsules = input.successCapsules.map(capsuleDigestView);
|
|
172
|
+
const rawGenes = input.existingGenes.map((gene) => ({
|
|
173
173
|
id: gene['id'],
|
|
174
174
|
category: gene['category'],
|
|
175
175
|
signals_match: gene['signals_match'],
|
|
176
176
|
summary: gene['summary'],
|
|
177
|
-
}))
|
|
177
|
+
}));
|
|
178
|
+
const capsules = redact ? hub.redactDeep(rawCapsules) : rawCapsules;
|
|
179
|
+
const genes = redact ? hub.redactDeep(rawGenes) : rawGenes;
|
|
178
180
|
// Scope-language alignment (review ②): show the model the signals the store ACTUALLY uses BEFORE it chooses a
|
|
179
181
|
// scope facet. The autonomous-scope experiment (result-recovery-autoscope-joint-metric.json) isolated the
|
|
180
182
|
// failure as structural, not a model weakness — the distiller reads solved source code and never observes the
|
|
@@ -537,16 +539,12 @@ export async function autoDistillLlm(options) {
|
|
|
537
539
|
}
|
|
538
540
|
const runner = options.runner ?? resolveDistillRunner(env);
|
|
539
541
|
const timeoutMs = envInt(env, 'EVOLVE_DISTILL_TIMEOUT_MS', DEFAULT_TIMEOUT_MS);
|
|
540
|
-
|
|
541
|
-
//
|
|
542
|
-
|
|
543
|
-
// appearing verbatim in the payload — catching custom-format secrets no pattern matches. The prompt is an
|
|
544
|
-
// off-box egress (stdin to a spawned `claude`), so hold it to the same floor the repo enforces on publish: if a
|
|
545
|
-
// daemon env secret leaked into a capsule, fail CLOSED and never send it. This is a data-hygiene block, not a
|
|
546
|
-
// deterministic claude failure, so — like a transient exit below — it does NOT bump failed_attempts.
|
|
547
|
-
if (hub.detectEnvValueLeaks(prompt, env).length > 0) {
|
|
542
|
+
// LLM prompt 属于外部输出边界。先对脱敏前的同构内容执行反向环境变量扫描,
|
|
543
|
+
// 避免高熵模式先替换秘密后让泄漏检查误判为安全;该阻断不计入确定性失败次数。
|
|
544
|
+
if (hub.detectEnvValueLeaks(buildDistillPrompt(input, false), env).length > 0) {
|
|
548
545
|
return { ok: false, mode, reason: 'prompt_env_leak_blocked', dataHash: input.dataHash };
|
|
549
546
|
}
|
|
547
|
+
const prompt = buildDistillPrompt(input);
|
|
550
548
|
const llm = await runner(prompt, { cwd, timeoutMs, env });
|
|
551
549
|
if (llm.exitCode !== 0) {
|
|
552
550
|
// V1 parity: a PROCESS-level claude failure — spawn error/ENOENT or timeout→SIGKILL (exitCode === null), OR a
|
package/dist/autoexec.js
CHANGED
|
@@ -194,7 +194,8 @@ function isAutoExecVerdict(value, taskId) {
|
|
|
194
194
|
|| candidate.status === 'skipped'
|
|
195
195
|
|| candidate.status === 'solidified'
|
|
196
196
|
|| candidate.status === 'failed'
|
|
197
|
-
|| candidate.status === 'innovated'
|
|
197
|
+
|| candidate.status === 'innovated'
|
|
198
|
+
|| candidate.status === 'unsafe_to_replay');
|
|
198
199
|
}
|
|
199
200
|
function persistedClaimReceipt(dirs, claim, taskId) {
|
|
200
201
|
try {
|
|
@@ -209,7 +210,7 @@ function persistedClaimReceipt(dirs, claim, taskId) {
|
|
|
209
210
|
|| (receipt.destination !== 'done' && receipt.destination !== 'refused')
|
|
210
211
|
|| !isAutoExecVerdict(receipt.verdict, taskId))
|
|
211
212
|
return null;
|
|
212
|
-
const expectedDestination = receipt.verdict.status === 'refused' ? 'refused' : 'done';
|
|
213
|
+
const expectedDestination = receipt.verdict.status === 'refused' || receipt.verdict.status === 'unsafe_to_replay' ? 'refused' : 'done';
|
|
213
214
|
if (receipt.destination !== expectedDestination)
|
|
214
215
|
return null;
|
|
215
216
|
return receipt;
|
|
@@ -329,7 +330,7 @@ export async function autoExecPass(dirs, runOne, options = {}) {
|
|
|
329
330
|
const startedPath = join(dirs.inflight, startedName);
|
|
330
331
|
renameSync(taskPath, startedPath);
|
|
331
332
|
const v = await runOne(task).catch((e) => ({ taskId: task.id, status: 'failed', reason: e instanceof Error ? e.message : String(e) }));
|
|
332
|
-
const destination = v.status === 'refused' ? 'refused' : 'done';
|
|
333
|
+
const destination = v.status === 'refused' || v.status === 'unsafe_to_replay' ? 'refused' : 'done';
|
|
333
334
|
const dest = destination === 'refused' ? dirs.refused : dirs.done;
|
|
334
335
|
persistClaimReceipt(dirs, { claimName: startedName, destination, verdict: v });
|
|
335
336
|
writeFileSync(join(dest, claim.originalName), JSON.stringify(v, null, 2));
|
|
@@ -628,7 +629,7 @@ const DISTILL_TICK_EXPLORATION_SIGNALS = ['stable_success_plateau', 'runtime_ses
|
|
|
628
629
|
* refused/skipped ran no cycle — there is nothing to attribute, so no report.
|
|
629
630
|
*/
|
|
630
631
|
export function verdictToOutcomeStatus(status) {
|
|
631
|
-
if (status === 'solidified'
|
|
632
|
+
if (status === 'solidified')
|
|
632
633
|
return 'success';
|
|
633
634
|
if (status === 'failed')
|
|
634
635
|
return 'failed';
|
|
@@ -1579,8 +1580,20 @@ export async function runAutoExec(argv) {
|
|
|
1579
1580
|
const selectionFloor = selectionFloorFromEnv();
|
|
1580
1581
|
// File-only and best-effort: tracing must never fail or slow a task.
|
|
1581
1582
|
const learningTrace = resolveLearningTrace(process.env);
|
|
1583
|
+
const executionBindingAuthority = {
|
|
1584
|
+
claimLease: () => false,
|
|
1585
|
+
acceptanceSpec: () => false,
|
|
1586
|
+
budget: () => false,
|
|
1587
|
+
consent: () => false,
|
|
1588
|
+
};
|
|
1582
1589
|
const deps = withAutoExecSelectionConfig({
|
|
1583
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
|
+
},
|
|
1584
1597
|
...(learningTrace.config ? { learningTrace: learningTrace.config } : {}),
|
|
1585
1598
|
// Probation (#306, gated, default OFF via EVOLVER_GENE_PROBATION): try unproven auto-distilled genes (with their
|
|
1586
1599
|
// strategy embedded) so the cross-AI loop self-closes — contained by the proven exec gates + worktree isolation.
|
|
@@ -1592,13 +1605,32 @@ export async function runAutoExec(argv) {
|
|
|
1592
1605
|
// Validate through the hardened sandbox verifier so a validation command can't exfiltrate or phone home to game
|
|
1593
1606
|
// the result. Validation is bounded by the sandbox's own per-command cap (NOT the agent exec timeout, a
|
|
1594
1607
|
// different unit) so a long suite is not silently SIGKILL'd against the wrong budget.
|
|
1595
|
-
validate: (task) => async (_m, _d, cwd) => {
|
|
1608
|
+
validate: (task) => async (_m, _d, cwd, signal) => {
|
|
1596
1609
|
const cmds = task.validationCmds ?? [];
|
|
1597
|
-
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 } : {}) });
|
|
1598
1616
|
const validationSummary = summarizeSandboxedValidation(r);
|
|
1599
1617
|
if (validationSummary)
|
|
1600
1618
|
process.stdout.write(` validation: ${validationSummary}\n`);
|
|
1601
|
-
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
|
+
};
|
|
1602
1634
|
},
|
|
1603
1635
|
}, process.env);
|
|
1604
1636
|
const safety = { allowedRoots: cfg.allowedRoots, timeoutMs: cfg.timeoutMs, runner: cfg.runner };
|
package/dist/cliContracts.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export interface PublishParseResult {
|
|
|
17
17
|
autoPair?: boolean;
|
|
18
18
|
dryRun?: boolean;
|
|
19
19
|
repair?: boolean;
|
|
20
|
+
noRecipe?: boolean;
|
|
20
21
|
jsonOut?: boolean;
|
|
21
22
|
reason?: ContractReason;
|
|
22
23
|
message?: string;
|
|
@@ -27,8 +28,10 @@ interface GateSummary {
|
|
|
27
28
|
schema?: 'pass' | 'fail';
|
|
28
29
|
bundle?: 'pass' | 'fail';
|
|
29
30
|
quality?: 'pass' | 'fail';
|
|
31
|
+
quality_evidence?: PublishQualityEvidenceSource;
|
|
30
32
|
validation_command?: 'pass' | 'fail';
|
|
31
33
|
}
|
|
34
|
+
type PublishQualityEvidenceSource = 'local_history' | 'bundle_seed' | 'none' | 'unavailable';
|
|
32
35
|
interface PublishAssetSummary {
|
|
33
36
|
asset_id?: string;
|
|
34
37
|
type?: assetstore.AssetKind;
|
|
@@ -57,6 +60,7 @@ interface ContractHubTransport {
|
|
|
57
60
|
fetchAssetById(assetId: string): Promise<assetstore.AssetRecord | null>;
|
|
58
61
|
validate(bundle: readonly assetstore.AssetRecord[]): Promise<HubCallResult>;
|
|
59
62
|
publish(bundle: readonly assetstore.AssetRecord[]): Promise<HubCallResult>;
|
|
63
|
+
composeRecipe?(payload: hub.RecipeComposeInput): Promise<hub.RecipeComposeResult>;
|
|
60
64
|
}
|
|
61
65
|
interface PrivateContractProxy {
|
|
62
66
|
status(): Promise<unknown>;
|
|
@@ -71,6 +75,7 @@ interface PrivateContractProxy {
|
|
|
71
75
|
submitAssetBundle(bundle: {
|
|
72
76
|
assets: unknown[];
|
|
73
77
|
expected_hub_mode?: 'private';
|
|
78
|
+
compose_recipe?: boolean;
|
|
74
79
|
}): Promise<unknown>;
|
|
75
80
|
}
|
|
76
81
|
export interface CliContractDeps {
|
package/dist/cliContracts.js
CHANGED
|
@@ -16,9 +16,9 @@ const PRIVATE_AUTH_REQUIRED_MESSAGE = 'Private Hub authentication failed; verify
|
|
|
16
16
|
const BUNDLE_REQUIRED_MESSAGE = 'publish requires Gene + Capsule bundle; pass --gene <id|path> --capsule <id|path>';
|
|
17
17
|
const MAX_ASSETS = 50;
|
|
18
18
|
const PUBLISH_USAGE = [
|
|
19
|
-
'usage: evolver publish --asset <gene_id_or_path> --asset <capsule_id_or_path> --json [--dry-run] [--repair]',
|
|
20
|
-
' evolver publish --gene <id_or_path> --capsule <id_or_path> --json [--dry-run]',
|
|
21
|
-
' evolver publish --gene <id_or_path> --auto-pair --json [--dry-run]',
|
|
19
|
+
'usage: evolver publish --asset <gene_id_or_path> --asset <capsule_id_or_path> --json [--dry-run] [--repair] [--no-recipe]',
|
|
20
|
+
' evolver publish --gene <id_or_path> --capsule <id_or_path> --json [--dry-run] [--no-recipe]',
|
|
21
|
+
' evolver publish --gene <id_or_path> --auto-pair --json [--dry-run] [--no-recipe]',
|
|
22
22
|
].join('\n');
|
|
23
23
|
const ASSET_FLAGS = new Set(['--asset', '--gene', '--capsule', '--event']);
|
|
24
24
|
const STABLE_CONTRACT_REASONS = new Set([
|
|
@@ -174,7 +174,9 @@ export async function runPublishCommand(args, deps = {}) {
|
|
|
174
174
|
assets: bundle.assets,
|
|
175
175
|
}), 1);
|
|
176
176
|
}
|
|
177
|
-
const transport = deps.transport ?? createDefaultTransport(runtimeDeps
|
|
177
|
+
const transport = deps.transport ?? createDefaultTransport(runtimeDeps, {
|
|
178
|
+
composeRecipe: parsed.noRecipe !== true,
|
|
179
|
+
});
|
|
178
180
|
const validate = deps.validate ?? transport.validate;
|
|
179
181
|
// A field-level refusal is a defect in the RECORD, not a verdict on the work in it. Read the Hub's own
|
|
180
182
|
// `details[]`, mend what is mechanically derivable, and (only when asked) try once more — otherwise the
|
|
@@ -268,6 +270,9 @@ export async function runPublishCommand(args, deps = {}) {
|
|
|
268
270
|
const bundleId = stringField(payload, 'bundle_id');
|
|
269
271
|
const publishedBundle = { ...bundle, sanitized: [...effectiveAssets] };
|
|
270
272
|
appendPublishedCapsuleCall(publishedBundle, deps, { status, receiptId, bundleId });
|
|
273
|
+
const recipeId = parsed.noRecipe || deps.publish
|
|
274
|
+
? undefined
|
|
275
|
+
: await composePublishedRecipe(transport, effectiveAssets);
|
|
271
276
|
return write({
|
|
272
277
|
ok: true,
|
|
273
278
|
contract: PUBLISH_CONTRACT,
|
|
@@ -276,7 +281,9 @@ export async function runPublishCommand(args, deps = {}) {
|
|
|
276
281
|
reversibility: REVERSIBILITY,
|
|
277
282
|
...(receiptId ? { receipt_id: receiptId } : {}),
|
|
278
283
|
...(bundleId ? { bundle_id: bundleId } : {}),
|
|
284
|
+
...(recipeId ? { recipe_id: recipeId } : {}),
|
|
279
285
|
...(safetyCandidate ? { hub_reason: hubReason } : {}),
|
|
286
|
+
gates: bundle.gates,
|
|
280
287
|
// What the Hub actually holds — after a repair that is the mended record, not the one first submitted.
|
|
281
288
|
assets: repairApplied?.applied === true ? summarizePublishAssets(effectiveAssets) : bundle.assets,
|
|
282
289
|
...(publishCredits ? { credits: publishCredits } : {}),
|
|
@@ -435,6 +442,7 @@ export function parsePublishArgs(args) {
|
|
|
435
442
|
let autoPair = false;
|
|
436
443
|
let dryRun = false;
|
|
437
444
|
let repair = false;
|
|
445
|
+
let noRecipe = false;
|
|
438
446
|
let jsonOut = false;
|
|
439
447
|
for (let i = 0; i < args.length; i++) {
|
|
440
448
|
const token = args[i];
|
|
@@ -456,6 +464,10 @@ export function parsePublishArgs(args) {
|
|
|
456
464
|
repair = true;
|
|
457
465
|
continue;
|
|
458
466
|
}
|
|
467
|
+
if (token === '--no-recipe') {
|
|
468
|
+
noRecipe = true;
|
|
469
|
+
continue;
|
|
470
|
+
}
|
|
459
471
|
const equalFlag = [...ASSET_FLAGS].find((flag) => token.startsWith(`${flag}=`));
|
|
460
472
|
if (equalFlag) {
|
|
461
473
|
const value = token.slice(equalFlag.length + 1).trim();
|
|
@@ -508,7 +520,16 @@ export function parsePublishArgs(args) {
|
|
|
508
520
|
return { ok: false, reason: 'bundle_required', message: 'publish requires --asset <id|path>' };
|
|
509
521
|
if (refs.length > MAX_ASSETS)
|
|
510
522
|
return { ok: false, reason: 'bundle_required', message: `publish supports at most ${MAX_ASSETS} assets` };
|
|
511
|
-
return {
|
|
523
|
+
return {
|
|
524
|
+
ok: true,
|
|
525
|
+
assetRefs: refs,
|
|
526
|
+
...(geneRef ? { geneRef } : {}),
|
|
527
|
+
...(autoPair ? { autoPair: true } : {}),
|
|
528
|
+
dryRun,
|
|
529
|
+
repair,
|
|
530
|
+
...(noRecipe ? { noRecipe: true } : {}),
|
|
531
|
+
jsonOut,
|
|
532
|
+
};
|
|
512
533
|
}
|
|
513
534
|
export async function buildPublishBundle(refs, deps = {}) {
|
|
514
535
|
let original;
|
|
@@ -562,6 +583,7 @@ export async function buildPublishBundle(refs, deps = {}) {
|
|
|
562
583
|
schema: 'pass',
|
|
563
584
|
bundle: 'pass',
|
|
564
585
|
quality: geneProven ? 'pass' : 'fail',
|
|
586
|
+
quality_evidence: geneEvidence?.source ?? 'unavailable',
|
|
565
587
|
validation_command: validationCommandResult.allowed ? 'pass' : 'fail',
|
|
566
588
|
};
|
|
567
589
|
const blockReasons = [];
|
|
@@ -586,10 +608,9 @@ export async function buildPublishBundle(refs, deps = {}) {
|
|
|
586
608
|
assets: summarizePublishAssets(sanitized),
|
|
587
609
|
};
|
|
588
610
|
}
|
|
589
|
-
//
|
|
590
|
-
//
|
|
591
|
-
//
|
|
592
|
-
// infra hiccup must not block an otherwise-valid publish.
|
|
611
|
+
// 评估 bundle 中 Gene 的成功证据。历史记录来自本地 Capsule store;显式提交的、
|
|
612
|
+
// 通过完整校验的成功 Capsule 也可作为首次发布的 seed。没有 gene id 或 store
|
|
613
|
+
// 读取失败时保持 fail-open,因为这道预检只增加本地门槛,最终质量判定仍由 Hub 负责。
|
|
593
614
|
async function assessPublishGeneEvidence(original, deps) {
|
|
594
615
|
const gene = original.find((asset) => asset.type === 'Gene');
|
|
595
616
|
if (!gene)
|
|
@@ -599,6 +620,8 @@ async function assessPublishGeneEvidence(original, deps) {
|
|
|
599
620
|
const geneId = businessId ?? assetId;
|
|
600
621
|
if (!geneId)
|
|
601
622
|
return null;
|
|
623
|
+
const geneIds = new Set([businessId, assetId].filter((id) => Boolean(id)));
|
|
624
|
+
const hasBundleSeed = hasVerifiedSuccessfulBundleCapsule(original, geneIds);
|
|
602
625
|
try {
|
|
603
626
|
const store = deps.assetStore ?? new assetstore.LocalJsonlProvider(contractAssetsDir(deps));
|
|
604
627
|
const primary = await algo.assessGenePublishEvidence(store, geneId);
|
|
@@ -607,28 +630,43 @@ async function assessPublishGeneEvidence(original, deps) {
|
|
|
607
630
|
// contain failures under the business id and a success under asset_id, so
|
|
608
631
|
// both aliases must contribute to the gate rather than only falling back
|
|
609
632
|
// when the primary alias has no rows at all.
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
eligible,
|
|
623
|
-
reason: eligible ? 'eligible' : 'no_proven_success',
|
|
624
|
-
};
|
|
625
|
-
}
|
|
626
|
-
return primary;
|
|
633
|
+
const byAssetId = assetId && assetId !== geneId
|
|
634
|
+
? await algo.assessGenePublishEvidence(store, assetId)
|
|
635
|
+
: undefined;
|
|
636
|
+
const localEvidence = {
|
|
637
|
+
success: primary.success + (byAssetId?.success ?? 0),
|
|
638
|
+
inert: primary.inert + (byAssetId?.inert ?? 0),
|
|
639
|
+
};
|
|
640
|
+
if (algo.isGenePublishEligible(localEvidence))
|
|
641
|
+
return { eligible: true, source: 'local_history' };
|
|
642
|
+
if (hasBundleSeed)
|
|
643
|
+
return { eligible: true, source: 'bundle_seed' };
|
|
644
|
+
return { eligible: false, source: 'none' };
|
|
627
645
|
}
|
|
628
646
|
catch {
|
|
647
|
+
// 本地 store 不可用时保持历史 fail-open 行为。显式 Capsule 只有在上面的
|
|
648
|
+
// content hash 和 wire schema 校验都通过后才会计入,非法文件不会变成证据。
|
|
649
|
+
if (hasBundleSeed)
|
|
650
|
+
return { eligible: true, source: 'bundle_seed' };
|
|
629
651
|
return null;
|
|
630
652
|
}
|
|
631
653
|
}
|
|
654
|
+
/**
|
|
655
|
+
* 首次发布可以把已经生成的成功 Capsule 作为同一 bundle 的证据提交。
|
|
656
|
+
* 之前这里只读取本地 capsules.jsonl,导致 `--gene file --capsule file`
|
|
657
|
+
* 即使带有成功 Capsule 也在到达 Hub 前被 `gene_unproven` 拦截。
|
|
658
|
+
*
|
|
659
|
+
* 外部文件不是本地历史,必须先通过完整 wire schema 和 content hash 校验;
|
|
660
|
+
* 失败或缺少成功 outcome 的 Capsule 不会解锁 quality gate。该证据只用于
|
|
661
|
+
* 本地预检,Hub 仍然负责最终质量判定和持久化。
|
|
662
|
+
*/
|
|
663
|
+
function hasVerifiedSuccessfulBundleCapsule(original, geneIds) {
|
|
664
|
+
const capsule = original.find((asset) => (asset.type === 'Capsule' && geneIds.has(stringField(asset, 'gene') ?? '')));
|
|
665
|
+
if (!capsule || !wire.validateWireDeep(capsule).ok || !wire.verifyAssetId(capsule)) {
|
|
666
|
+
return false;
|
|
667
|
+
}
|
|
668
|
+
return stringField(asRecord(capsule['outcome']), 'status') === 'success';
|
|
669
|
+
}
|
|
632
670
|
/**
|
|
633
671
|
* 检查 Gene 资产中的验证命令是否安全。
|
|
634
672
|
* 只检查 Gene 类型的资产,不影响 Capsule 或 EvolutionEvent。
|
|
@@ -1064,11 +1102,25 @@ async function withMachineJsonConsole(enabled, deps, fn) {
|
|
|
1064
1102
|
machineJsonStdoutBypass = previousBypass;
|
|
1065
1103
|
}
|
|
1066
1104
|
}
|
|
1067
|
-
function
|
|
1105
|
+
async function composePublishedRecipe(transport, assets) {
|
|
1106
|
+
if (!transport.composeRecipe)
|
|
1107
|
+
return undefined;
|
|
1108
|
+
try {
|
|
1109
|
+
const composed = await transport.composeRecipe({
|
|
1110
|
+
compose_recipe: true,
|
|
1111
|
+
assets: [...assets],
|
|
1112
|
+
});
|
|
1113
|
+
return composed.ok && composed.recipeId ? composed.recipeId : undefined;
|
|
1114
|
+
}
|
|
1115
|
+
catch {
|
|
1116
|
+
return undefined;
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
function createDefaultTransport(deps, opts = {}) {
|
|
1068
1120
|
const env = loadContractEnv(deps);
|
|
1069
1121
|
const hubMode = configuredHubMode(env);
|
|
1070
1122
|
if (hubMode === 'private') {
|
|
1071
|
-
return createPrivateTransport(env, deps.resolveProxyClient ?? resolveDefaultPrivateProxy);
|
|
1123
|
+
return createPrivateTransport(env, deps.resolveProxyClient ?? resolveDefaultPrivateProxy, opts.composeRecipe !== false);
|
|
1072
1124
|
}
|
|
1073
1125
|
const hubUrl = resolveHubUrl(env);
|
|
1074
1126
|
const evomapDir = resolveIdentityHome(env);
|
|
@@ -1105,6 +1157,9 @@ function createDefaultTransport(deps) {
|
|
|
1105
1157
|
fetchAssetById: (assetId) => connected.hub.fetchAssetById(assetId),
|
|
1106
1158
|
validate: (bundle) => call('/a2a/validate', 'validate', bundle),
|
|
1107
1159
|
publish: (bundle) => call('/a2a/publish', 'publish', bundle),
|
|
1160
|
+
...(opts.composeRecipe === false ? {} : {
|
|
1161
|
+
composeRecipe: (payload) => hub.composeRecipeAfterAssetPublish(connected.hub, payload),
|
|
1162
|
+
}),
|
|
1108
1163
|
};
|
|
1109
1164
|
}
|
|
1110
1165
|
function loadContractEnv(deps) {
|
|
@@ -1133,7 +1188,7 @@ function configuredHubMode(env) {
|
|
|
1133
1188
|
function resolveDefaultPrivateProxy(env) {
|
|
1134
1189
|
return proxyClientFromEnv(env);
|
|
1135
1190
|
}
|
|
1136
|
-
function createPrivateTransport(env, resolveProxy) {
|
|
1191
|
+
function createPrivateTransport(env, resolveProxy, composeRecipe = true) {
|
|
1137
1192
|
const proxy = resolveProxy(env);
|
|
1138
1193
|
if (!proxy)
|
|
1139
1194
|
throw new Error('private Hub proxy credentials are not configured');
|
|
@@ -1174,6 +1229,7 @@ function createPrivateTransport(env, resolveProxy) {
|
|
|
1174
1229
|
const body = normalizePrivatePublishBody(await proxy.submitAssetBundle({
|
|
1175
1230
|
assets: [...bundle],
|
|
1176
1231
|
expected_hub_mode: 'private',
|
|
1232
|
+
...(composeRecipe ? {} : { compose_recipe: false }),
|
|
1177
1233
|
}));
|
|
1178
1234
|
return { ok: !privatePublishExplicitFailure(body) && normalizePublishStatus(body) !== undefined, status: 200, body };
|
|
1179
1235
|
}
|
package/dist/commandCatalog.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export declare const COMMAND_GROUPS: {
|
|
|
59
59
|
readonly exec: "Tools";
|
|
60
60
|
readonly 'anti-gene-benchmark': "Advanced";
|
|
61
61
|
readonly 'anti-gene-rollout': "Advanced";
|
|
62
|
+
readonly 'model-compatibility-replay': "Advanced";
|
|
62
63
|
readonly 'reset-local-secret': "Advanced";
|
|
63
64
|
readonly 'skill-distill': "Advanced";
|
|
64
65
|
readonly 'skill-md-update': "Advanced";
|
package/dist/commandCatalog.js
CHANGED
|
@@ -72,6 +72,7 @@ export const COMMAND_GROUPS = {
|
|
|
72
72
|
exec: 'Tools',
|
|
73
73
|
'anti-gene-benchmark': 'Advanced',
|
|
74
74
|
'anti-gene-rollout': 'Advanced',
|
|
75
|
+
'model-compatibility-replay': 'Advanced',
|
|
75
76
|
'reset-local-secret': 'Advanced',
|
|
76
77
|
'skill-distill': 'Advanced',
|
|
77
78
|
'skill-md-update': 'Advanced',
|
package/dist/cycleConsumer.js
CHANGED
|
@@ -86,11 +86,11 @@ function makeCycleValidationHook(validationCmds, fallback, runSandboxedValidatio
|
|
|
86
86
|
return fallback;
|
|
87
87
|
return (task) => {
|
|
88
88
|
const fallbackHook = fallback?.(task);
|
|
89
|
-
return async (mutation, decision, cwd) => {
|
|
90
|
-
const fallbackResult = fallbackHook ? await fallbackHook(mutation, decision, cwd) : null;
|
|
89
|
+
return async (mutation, decision, cwd, signal) => {
|
|
90
|
+
const fallbackResult = fallbackHook ? await fallbackHook(mutation, decision, cwd, signal) : null;
|
|
91
91
|
if (fallbackResult && !fallbackResult.passed)
|
|
92
92
|
return fallbackResult;
|
|
93
|
-
const result = await runRequiredSandboxedValidation(task.validationCmds ?? validationCmds, cwd, {}, runSandboxedValidation);
|
|
93
|
+
const result = await runRequiredSandboxedValidation(task.validationCmds ?? validationCmds, cwd, { signal }, runSandboxedValidation);
|
|
94
94
|
return { passed: result.passed, score: result.score };
|
|
95
95
|
};
|
|
96
96
|
};
|
package/dist/dispatch.js
CHANGED
|
@@ -36,6 +36,7 @@ import { runAssetRepairCommand } from './assetRepair.js';
|
|
|
36
36
|
import { runV1FetchCompat, runV1RunCompat, runV1SolidifyCompat, runV1WebuiCompat, runV1ExecCompat } from './v1Compat.js';
|
|
37
37
|
import { runWorkflowCommand } from './workflow.js';
|
|
38
38
|
import { runMemoryGraphCommand } from './memoryGraphOps.js';
|
|
39
|
+
import { runModelCompatibilityReplay } from './modelCompatibility.js';
|
|
39
40
|
import { SYNC_COMMAND_NAMES } from './commandCatalog.js';
|
|
40
41
|
export async function runProxyCommand(argv, importer = () => import('@evomap/evolver-proxy/bin/evolver-proxy')) {
|
|
41
42
|
const { runProxyCli } = await importer();
|
|
@@ -91,6 +92,7 @@ const ASYNC_COMMAND_TABLE = {
|
|
|
91
92
|
webui: runV1WebuiCompat,
|
|
92
93
|
exec: runV1ExecCompat,
|
|
93
94
|
workflow: runWorkflowCommand,
|
|
95
|
+
'model-compatibility-replay': runModelCompatibilityReplay,
|
|
94
96
|
};
|
|
95
97
|
export const ASYNC_COMMANDS = ASYNC_COMMAND_TABLE;
|
|
96
98
|
/** Verbs handled by the synchronous runCli core (read-only views + local ops). Kept in sync with runCli's switch
|
package/dist/distillObserver.js
CHANGED
|
@@ -5,10 +5,12 @@
|
|
|
5
5
|
// gene.distilled. It reuses the exact same `draftGeneCandidate` as `evolver ingest --distill`, so the one-shot and
|
|
6
6
|
// the auto path never drift.
|
|
7
7
|
//
|
|
8
|
-
// WIRING (#117 / #106):
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
8
|
+
// WIRING (#117 / #106): LIVE. `autoexec.ts` imports `resolveDistillObserver`, builds it inside
|
|
9
|
+
// `resolveDistillProducer`, registers it on the daemon's ObserverBus, drives `distill.tick()` every beat, and
|
|
10
|
+
// `kick()`s it on boot to drain any backlog left un-acked by a prior run. The `material.batch_ready` producer is
|
|
11
|
+
// the session-ingest tick on the same Ingestor. See distillObserver.test.ts for the isolated proof.
|
|
12
|
+
// (This said "not yet wired into autoexec" long after it was wired. A stale WIRING note is worse than none: it
|
|
13
|
+
// reads as a real gap, and a 2026-08 audit did misreport this composition as unwired on the strength of it.)
|
|
12
14
|
import { assetstore, events, observers, signals, algo } from '@evomap/evolver-core';
|
|
13
15
|
import { readFileSync } from 'node:fs';
|
|
14
16
|
import { draftGeneCandidate } from './distillPrimitives.js';
|
package/dist/doctor.d.ts
CHANGED
|
@@ -38,6 +38,17 @@ export interface DoctorDeps {
|
|
|
38
38
|
profile?: DoctorProfile;
|
|
39
39
|
label?: string;
|
|
40
40
|
memoryGraphStatus?: (env: Record<string, string | undefined>) => MemoryGraphOperatorStatus;
|
|
41
|
+
/** Runtime platform override (tests). Defaults to process.platform. */
|
|
42
|
+
platform?: NodeJS.Platform;
|
|
43
|
+
/** Test seam for the read-only legacy v1 Windows scheduled-task probe (#956). */
|
|
44
|
+
legacyWindowsTasks?: (options: {
|
|
45
|
+
env: NodeJS.ProcessEnv;
|
|
46
|
+
platform?: NodeJS.Platform;
|
|
47
|
+
}) => {
|
|
48
|
+
conclusive: boolean;
|
|
49
|
+
legacy: string[];
|
|
50
|
+
detail: string;
|
|
51
|
+
};
|
|
41
52
|
}
|
|
42
53
|
export interface EnvCatalogResult {
|
|
43
54
|
profile: DoctorProfile;
|
package/dist/doctor.js
CHANGED
|
@@ -7,6 +7,7 @@ import { isAbsolute, join } from 'node:path';
|
|
|
7
7
|
import { bootstrap, events, issueReporter } from '@evomap/evolver-core';
|
|
8
8
|
import { expandHomePath, parseEnvFile } from '@evomap/evolver-mcp';
|
|
9
9
|
import { formatMemoryGraphOperatorStatus, loadMemoryGraphOperatorStatus } from './localMemoryGraph.js';
|
|
10
|
+
import { LEGACY_TASK_SKIP_ENV, probeLegacyWindowsDaemonTasks } from './windowsLegacyTaskCleanup.js';
|
|
10
11
|
// Secrets that must live ONLY behind the EVOLVER_ENV_FILE pointer — never inlined into a runtime config (#217).
|
|
11
12
|
const SECRET_KEYS = [
|
|
12
13
|
'A2A_NODE_SECRET',
|
|
@@ -696,6 +697,29 @@ export function runDoctorChecks(deps = {}) {
|
|
|
696
697
|
catch {
|
|
697
698
|
checks.push({ name: 'memory-graph', status: 'warn', detail: 'state=degraded corrupt=1 oversized_lines=0 oversized_files=0 archives=0' });
|
|
698
699
|
}
|
|
700
|
+
// 5. windows-legacy-tasks (#956): read-only probe for legacy V1 scheduled-task residue
|
|
701
|
+
// (win32 only). A detected residue warns with the manual fix; an INCONCLUSIVE probe
|
|
702
|
+
// also warns — it must never be reported as a confirmed-negative pass.
|
|
703
|
+
if ((deps.platform ?? process.platform) === 'win32') {
|
|
704
|
+
try {
|
|
705
|
+
const probe = (deps.legacyWindowsTasks ?? probeLegacyWindowsDaemonTasks)({
|
|
706
|
+
env: effectiveEnv,
|
|
707
|
+
platform: 'win32',
|
|
708
|
+
});
|
|
709
|
+
if (!probe.conclusive) {
|
|
710
|
+
checks.push({ name: 'windows-legacy-tasks', status: 'warn', detail: `probe inconclusive (${probe.detail}); legacy v1 residue cannot be ruled out — run evolver lifecycle cleanup-legacy-tasks --dry-run, or set ${LEGACY_TASK_SKIP_ENV}=1 to silence the automatic probes on restricted hosts` });
|
|
711
|
+
}
|
|
712
|
+
else if (probe.legacy.length > 0) {
|
|
713
|
+
checks.push({ name: 'windows-legacy-tasks', status: 'warn', detail: `detected legacy v1 scheduled task(s): ${probe.legacy.join(', ')} — run evolver lifecycle cleanup-legacy-tasks` });
|
|
714
|
+
}
|
|
715
|
+
else {
|
|
716
|
+
checks.push({ name: 'windows-legacy-tasks', status: 'pass', detail: 'no legacy v1-style scheduled tasks registered' });
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
catch {
|
|
720
|
+
checks.push({ name: 'windows-legacy-tasks', status: 'warn', detail: `probe inconclusive (internal error); legacy v1 residue cannot be ruled out — run evolver lifecycle cleanup-legacy-tasks --dry-run, or set ${LEGACY_TASK_SKIP_ENV}=1 to silence the automatic probes on restricted hosts` });
|
|
721
|
+
}
|
|
722
|
+
}
|
|
699
723
|
return checks;
|
|
700
724
|
}
|
|
701
725
|
export function buildEnvCatalog(deps = {}) {
|
package/dist/index.d.ts
CHANGED
|
@@ -160,6 +160,8 @@ export interface InjectDeps {
|
|
|
160
160
|
readHookInput?: () => string | undefined;
|
|
161
161
|
/** Test seam for the hook-time proxy daemon recovery path. Default is maybeAutoRestartProxyForSessionStart. */
|
|
162
162
|
ensureProxyAutostart?: () => Promise<void>;
|
|
163
|
+
/** Test seam for the hook-time legacy v1 Windows scheduled-task sweep (#956). */
|
|
164
|
+
legacyTaskSweep?: () => void;
|
|
163
165
|
/** Test seam for the non-git workspace notice. Production uses cwd + ~/.evomap throttle state. */
|
|
164
166
|
nonGitNotice?: NonGitWorkspaceNoticeOptions;
|
|
165
167
|
}
|