@evomap/evolver-cli 2.0.0-beta.17 → 2.0.0-beta.19
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/antiGeneRollout.js +7 -3
- package/dist/assetTrust.js +14 -1
- package/dist/atp.d.ts +8 -3
- package/dist/atp.js +82 -11
- package/dist/atpAutoBuyer.d.ts +120 -0
- package/dist/atpAutoBuyer.js +814 -0
- package/dist/atpAutoDeliver.js +2 -2
- package/dist/autoDistillLlm.js +2 -1
- package/dist/autoDistillTranscript.js +3 -2
- package/dist/autoexec.d.ts +90 -13
- package/dist/autoexec.js +731 -84
- package/dist/cli.js +13 -0
- package/dist/cliContracts.d.ts +5 -2
- package/dist/cliContracts.js +135 -8
- package/dist/commands.d.ts +1 -0
- package/dist/commands.js +1 -0
- package/dist/curriculumCapabilityGaps.d.ts +6 -0
- package/dist/curriculumCapabilityGaps.js +24 -0
- package/dist/cycleConsumer.d.ts +4 -0
- package/dist/cycleConsumer.js +175 -20
- package/dist/dashboard.js +47 -9
- package/dist/dispatch.js +6 -2
- package/dist/distillPrimitives.js +18 -6
- package/dist/doctor.js +63 -5
- package/dist/identityHome.js +2 -1
- package/dist/index.d.ts +67 -39
- package/dist/index.js +504 -185
- package/dist/learningTrace.d.ts +4 -0
- package/dist/learningTrace.js +30 -3
- package/dist/lifecycle.d.ts +54 -1
- package/dist/lifecycle.js +489 -37
- package/dist/materialSnapshot.d.ts +9 -1
- package/dist/materialSnapshot.js +23 -6
- package/dist/migrate/envTranslate.d.ts +26 -0
- package/dist/migrate/envTranslate.js +145 -0
- package/dist/migrate/oauthImport.d.ts +66 -0
- package/dist/migrate/oauthImport.js +667 -0
- package/dist/migrate/v1Import.d.ts +13 -1
- package/dist/migrate/v1Import.js +621 -122
- package/dist/promptRecallHook.d.ts +24 -0
- package/dist/promptRecallHook.js +425 -0
- package/dist/recallVerifyReport.d.ts +37 -0
- package/dist/recallVerifyReport.js +244 -0
- package/dist/requiredSandboxValidation.d.ts +5 -0
- package/dist/requiredSandboxValidation.js +4 -0
- package/dist/reuse.d.ts +1 -0
- package/dist/reuse.js +45 -37
- package/dist/runtimeCapabilities.js +13 -13
- package/dist/runtimeSessionSource.d.ts +3 -2
- package/dist/runtimeSessionSource.js +63 -11
- package/dist/sessionIngest.d.ts +37 -0
- package/dist/sessionIngest.js +156 -0
- package/dist/setupHooks.js +95 -1
- package/dist/skill2gep.d.ts +4 -7
- package/dist/skill2gep.js +4 -21
- package/dist/solo/mode.js +1 -0
- package/dist/sync.js +125 -23
- package/dist/thesis.d.ts +1 -1
- package/dist/thesis.js +18 -3
- package/dist/trajectoryExport.js +21 -3
- package/dist/v1Compat.d.ts +1 -0
- package/dist/v1Compat.js +9 -0
- package/dist/workflowRuntime.js +24 -18
- package/package.json +10 -7
package/dist/sync.js
CHANGED
|
@@ -17,6 +17,7 @@ const MAX_RAW_PAGES = 20_000;
|
|
|
17
17
|
const MAX_RAW_ROWS = 100_000;
|
|
18
18
|
const MAX_GEPX_BYTES = 64 * 1024 * 1024;
|
|
19
19
|
const MAX_GEPX_ASSETS = 10_000;
|
|
20
|
+
const MAX_GEPX_SIDECAR_RECORDS = MAX_GEPX_ASSETS;
|
|
20
21
|
const GROUP = 'sync';
|
|
21
22
|
const USAGE = [
|
|
22
23
|
'usage: evolver sync [--write] [--force] [--resume] [--scope all|purchased|published] [--type Gene|Capsule] [--status draft|promoted|all] [--limit N] [--page-size N] [--purchased-cursor CURSOR] [--published-cursor CURSOR] [--json]',
|
|
@@ -47,9 +48,11 @@ const HUB_METADATA_KEYS = new Set([
|
|
|
47
48
|
'_retrieval_rank',
|
|
48
49
|
'retrieval_rank',
|
|
49
50
|
'original_asset_id',
|
|
51
|
+
'payload_backfill_reason',
|
|
50
52
|
'asset_type',
|
|
51
53
|
'local_id',
|
|
52
54
|
'payload',
|
|
55
|
+
'payload_backfill_reason',
|
|
53
56
|
'source',
|
|
54
57
|
'status',
|
|
55
58
|
]);
|
|
@@ -367,12 +370,13 @@ async function executeSyncWrite(opts, deps) {
|
|
|
367
370
|
});
|
|
368
371
|
}
|
|
369
372
|
const failures = [...preview.failures];
|
|
373
|
+
const provenanceSnapshot = provenance.snapshot();
|
|
370
374
|
const resumed = previousRun
|
|
371
375
|
? await reconcileResumeCandidates({
|
|
372
376
|
candidates: finalCandidates,
|
|
373
377
|
previousRun,
|
|
374
378
|
store,
|
|
375
|
-
|
|
379
|
+
provenanceSnapshot,
|
|
376
380
|
syncLedger,
|
|
377
381
|
appendRunCheckpoint,
|
|
378
382
|
runId,
|
|
@@ -381,7 +385,7 @@ async function executeSyncWrite(opts, deps) {
|
|
|
381
385
|
failures,
|
|
382
386
|
})
|
|
383
387
|
: 0;
|
|
384
|
-
await verifyAlreadyLocalCandidates(finalCandidates, store, failures);
|
|
388
|
+
await verifyAlreadyLocalCandidates(finalCandidates, store, provenanceSnapshot, failures);
|
|
385
389
|
const prepared = [];
|
|
386
390
|
const pendingLogical = new Map(local.logical);
|
|
387
391
|
for (const candidate of finalCandidates) {
|
|
@@ -661,10 +665,10 @@ async function executeGepxImportWrite(opts, deps) {
|
|
|
661
665
|
for (const candidate of finalCandidates) {
|
|
662
666
|
if (candidate.action !== 'would_import' && !(opts.force && candidate.action === 'id_collision'))
|
|
663
667
|
continue;
|
|
664
|
-
const
|
|
665
|
-
if (!
|
|
668
|
+
const entry = assetsById.get(candidate.assetId);
|
|
669
|
+
if (!entry)
|
|
666
670
|
throw new SyncAbortError('integrity_error', '.gepx package asset is missing');
|
|
667
|
-
const preparedAsset = preparePackagedAsset(candidate, asset, local.byAssetId, pendingLogical, opts.force);
|
|
671
|
+
const preparedAsset = preparePackagedAsset(candidate, entry.asset, local.byAssetId, pendingLogical, opts.force, entry.frozenUnverified);
|
|
668
672
|
if ('blocked' in preparedAsset) {
|
|
669
673
|
updateFinalCandidate(finalCandidates, candidate, preparedAsset.blocked);
|
|
670
674
|
continue;
|
|
@@ -689,6 +693,7 @@ async function executeGepxImportWrite(opts, deps) {
|
|
|
689
693
|
prepared.push({
|
|
690
694
|
candidate: finalCandidate,
|
|
691
695
|
asset: preparedAsset.asset,
|
|
696
|
+
...(entry.frozenUnverified ? { frozenUnverified: true } : {}),
|
|
692
697
|
...(preparedAsset.forced ? { forced: true, collisionWithAssetId: preparedAsset.collisionWithAssetId } : {}),
|
|
693
698
|
});
|
|
694
699
|
if (logicalId)
|
|
@@ -697,10 +702,13 @@ async function executeGepxImportWrite(opts, deps) {
|
|
|
697
702
|
const baseDir = storeBaseDir(store, deps);
|
|
698
703
|
const provenance = deps.provenance ?? new assetstore.ProvenanceStore(baseDir, deps.now);
|
|
699
704
|
const syncLedger = deps.syncLedger ?? new assetstore.AssetSyncLedger(baseDir, deps.now);
|
|
705
|
+
await verifyAlreadyLocalGepxCandidates(finalCandidates, assetsById, store, provenance.snapshot(), failures);
|
|
700
706
|
const written = [];
|
|
701
707
|
for (const item of prepared) {
|
|
702
708
|
try {
|
|
703
|
-
const stored =
|
|
709
|
+
const stored = item.frozenUnverified
|
|
710
|
+
? await assetstore.ingestUnverifiedConditional(store, provenance, item.asset, 'unverified_gepx_import', { allowLogicalCollision: opts.force }, 'migrated')
|
|
711
|
+
: await assetstore.ingestUntrustedConditional(store, provenance, item.asset, { allowLogicalCollision: opts.force }, 'migrated');
|
|
704
712
|
const assetId = stored.asset_id;
|
|
705
713
|
if (stored.status === 'logical_collision') {
|
|
706
714
|
updateFinalCandidate(finalCandidates, item.candidate, {
|
|
@@ -711,7 +719,7 @@ async function executeGepxImportWrite(opts, deps) {
|
|
|
711
719
|
});
|
|
712
720
|
continue;
|
|
713
721
|
}
|
|
714
|
-
await readBackStoredAsset(store, assetId, item.asset);
|
|
722
|
+
await readBackStoredAsset(store, assetId, item.asset, item.frozenUnverified === true);
|
|
715
723
|
if (stored.status === 'already_exists') {
|
|
716
724
|
updateFinalCandidate(finalCandidates, item.candidate, { ...item.candidate, assetId, action: 'already_local' });
|
|
717
725
|
continue;
|
|
@@ -1114,8 +1122,9 @@ function classifyGepxAsset(entry, local) {
|
|
|
1114
1122
|
function uniqueGepxAssets(pkg) {
|
|
1115
1123
|
const unique = new Map();
|
|
1116
1124
|
const missing = [];
|
|
1125
|
+
const provenanceByAssetId = indexUniqueGepxProvenance(pkg);
|
|
1117
1126
|
for (const asset of pkg.assets) {
|
|
1118
|
-
const normalized = normalizeGepxAsset(asset);
|
|
1127
|
+
const normalized = normalizeGepxAsset(asset, provenanceByAssetId.get(asset.asset_id) ?? undefined);
|
|
1119
1128
|
if (normalized.assetId === MISSING_ASSET_ID) {
|
|
1120
1129
|
missing.push(normalized);
|
|
1121
1130
|
continue;
|
|
@@ -1129,21 +1138,49 @@ function gepxImportAssetsById(pkg) {
|
|
|
1129
1138
|
const assets = new Map();
|
|
1130
1139
|
for (const entry of uniqueGepxAssets(pkg)) {
|
|
1131
1140
|
if (entry.type && !entry.integrityError && !assets.has(entry.assetId))
|
|
1132
|
-
assets.set(entry.assetId, entry
|
|
1141
|
+
assets.set(entry.assetId, entry);
|
|
1133
1142
|
}
|
|
1134
1143
|
return assets;
|
|
1135
1144
|
}
|
|
1136
|
-
function
|
|
1145
|
+
function indexUniqueGepxProvenance(pkg) {
|
|
1146
|
+
const indexed = new Map();
|
|
1147
|
+
for (const record of pkg.provenance ?? []) {
|
|
1148
|
+
indexed.set(record.assetId, indexed.has(record.assetId) ? null : record);
|
|
1149
|
+
}
|
|
1150
|
+
return indexed;
|
|
1151
|
+
}
|
|
1152
|
+
function normalizeGepxAsset(asset, provenance) {
|
|
1137
1153
|
const cleaned = stripHubMetadata(asset);
|
|
1138
1154
|
const assetId = stringField(cleaned, 'asset_id') ?? stringField(asset, 'asset_id') ?? MISSING_ASSET_ID;
|
|
1139
1155
|
const type = cleaned.type === 'Gene' || cleaned.type === 'Capsule' ? cleaned.type : undefined;
|
|
1140
1156
|
const logicalId = stringField(cleaned, 'id');
|
|
1141
1157
|
let integrityError = false;
|
|
1158
|
+
let frozenUnverified = false;
|
|
1142
1159
|
if (type) {
|
|
1143
1160
|
const claimed = stringField(cleaned, 'asset_id');
|
|
1144
1161
|
const fullAsset = looksLikeFullAsset(cleaned, type);
|
|
1145
1162
|
const computed = fullAsset ? wire.computeAssetId(cleaned) : undefined;
|
|
1146
|
-
|
|
1163
|
+
const supportedFrozenProvenance = provenance
|
|
1164
|
+
&& ((provenance.source === 'hub'
|
|
1165
|
+
&& (provenance.reason === 'unverified_hub_rewrite' || provenance.reason === 'unverified_hub_synthesized'))
|
|
1166
|
+
|| (provenance.source === 'migrated' && provenance.reason === 'unverified_gepx_import'));
|
|
1167
|
+
frozenUnverified = Boolean(claimed
|
|
1168
|
+
&& computed
|
|
1169
|
+
&& claimed === assetId
|
|
1170
|
+
&& computed !== claimed
|
|
1171
|
+
&& provenance?.assetId === assetId
|
|
1172
|
+
&& supportedFrozenProvenance
|
|
1173
|
+
&& provenance.trusted === false
|
|
1174
|
+
&& provenance.decision === undefined
|
|
1175
|
+
&& provenance.decidedBy === undefined
|
|
1176
|
+
&& provenance.promotedBy === undefined
|
|
1177
|
+
&& provenance.frozenContentId === computed);
|
|
1178
|
+
integrityError = assetId === MISSING_ASSET_ID
|
|
1179
|
+
|| !claimed
|
|
1180
|
+
|| !fullAsset
|
|
1181
|
+
|| !computed
|
|
1182
|
+
|| claimed !== assetId
|
|
1183
|
+
|| (computed !== claimed && !frozenUnverified);
|
|
1147
1184
|
}
|
|
1148
1185
|
return {
|
|
1149
1186
|
original: asset,
|
|
@@ -1152,6 +1189,7 @@ function normalizeGepxAsset(asset) {
|
|
|
1152
1189
|
...(type ? { type } : {}),
|
|
1153
1190
|
...(logicalId ? { logicalId } : {}),
|
|
1154
1191
|
integrityError,
|
|
1192
|
+
frozenUnverified,
|
|
1155
1193
|
};
|
|
1156
1194
|
}
|
|
1157
1195
|
function countsFromCandidates(base, candidates) {
|
|
@@ -1317,7 +1355,7 @@ async function reconcileResumeCandidates(input) {
|
|
|
1317
1355
|
if (candidate.action !== 'already_local')
|
|
1318
1356
|
continue;
|
|
1319
1357
|
const checkpoint = input.previousRun.processed.get(candidate.assetId);
|
|
1320
|
-
const provenanceRecord = input.
|
|
1358
|
+
const provenanceRecord = input.provenanceSnapshot.get(candidate.assetId);
|
|
1321
1359
|
const syncRecord = input.syncLedger.getForRunKey(input.runKey, candidate.assetId);
|
|
1322
1360
|
const checkpointedAlreadyLocal = checkpoint?.outcome === 'already_local';
|
|
1323
1361
|
const hubImportProvenance = provenanceRecord?.assetId === candidate.assetId
|
|
@@ -1327,7 +1365,7 @@ async function reconcileResumeCandidates(input) {
|
|
|
1327
1365
|
if (!checkpointedAlreadyLocal && !importedEvidence)
|
|
1328
1366
|
continue;
|
|
1329
1367
|
try {
|
|
1330
|
-
const storedAsset = await readBackStoredAsset(input.store, candidate.assetId);
|
|
1368
|
+
const storedAsset = await readBackStoredAsset(input.store, candidate.assetId, undefined, false, provenanceRecord, candidate.type);
|
|
1331
1369
|
if (checkpointedAlreadyLocal) {
|
|
1332
1370
|
resumed += 1;
|
|
1333
1371
|
continue;
|
|
@@ -1366,13 +1404,13 @@ async function reconcileResumeCandidates(input) {
|
|
|
1366
1404
|
}
|
|
1367
1405
|
return resumed;
|
|
1368
1406
|
}
|
|
1369
|
-
async function verifyAlreadyLocalCandidates(candidates, store, failures) {
|
|
1407
|
+
async function verifyAlreadyLocalCandidates(candidates, store, provenanceSnapshot, failures) {
|
|
1370
1408
|
const failedAssetIds = new Set(failures.flatMap((failure) => failure.assetId ? [failure.assetId] : []));
|
|
1371
1409
|
for (const candidate of candidates) {
|
|
1372
1410
|
if (candidate.action !== 'already_local' || failedAssetIds.has(candidate.assetId))
|
|
1373
1411
|
continue;
|
|
1374
1412
|
try {
|
|
1375
|
-
await readBackStoredAsset(store, candidate.assetId);
|
|
1413
|
+
await readBackStoredAsset(store, candidate.assetId, undefined, false, provenanceSnapshot.get(candidate.assetId), candidate.type);
|
|
1376
1414
|
}
|
|
1377
1415
|
catch (error) {
|
|
1378
1416
|
const mapped = mapSyncError(error);
|
|
@@ -1381,7 +1419,31 @@ async function verifyAlreadyLocalCandidates(candidates, store, failures) {
|
|
|
1381
1419
|
}
|
|
1382
1420
|
}
|
|
1383
1421
|
}
|
|
1384
|
-
async function
|
|
1422
|
+
async function verifyAlreadyLocalGepxCandidates(candidates, assetsById, store, provenanceSnapshot, failures) {
|
|
1423
|
+
for (const candidate of [...candidates]) {
|
|
1424
|
+
if (candidate.action !== 'already_local')
|
|
1425
|
+
continue;
|
|
1426
|
+
const entry = assetsById.get(candidate.assetId);
|
|
1427
|
+
if (!entry)
|
|
1428
|
+
throw new SyncAbortError('integrity_error', '.gepx package asset is missing');
|
|
1429
|
+
try {
|
|
1430
|
+
const stored = await readBackStoredAsset(store, candidate.assetId, entry.asset, false, provenanceSnapshot.get(candidate.assetId), candidate.type);
|
|
1431
|
+
if (!assetstore.frozenAssetRecordsEqual(stored, entry.asset)) {
|
|
1432
|
+
throw new SyncAbortError('store_read_back_failed', 'Stored asset differs from packaged asset');
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
catch (error) {
|
|
1436
|
+
const mapped = mapSyncError(error);
|
|
1437
|
+
failures.push({ stage: 'write', assetId: candidate.assetId, reason: mapped.reason });
|
|
1438
|
+
updateFinalCandidate(candidates, candidate, {
|
|
1439
|
+
...candidate,
|
|
1440
|
+
action: 'write_failed',
|
|
1441
|
+
failureReason: mapped.reason,
|
|
1442
|
+
});
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
async function readBackStoredAsset(store, assetId, expected, allowFrozenUnverified = false, provenance, expectedType = expected?.type) {
|
|
1385
1447
|
let stored;
|
|
1386
1448
|
try {
|
|
1387
1449
|
stored = await store.get(assetId);
|
|
@@ -1391,11 +1453,28 @@ async function readBackStoredAsset(store, assetId, expected) {
|
|
|
1391
1453
|
}
|
|
1392
1454
|
const computed = stored ? wire.computeAssetId(stored) : null;
|
|
1393
1455
|
const expectedComputed = expected ? wire.computeAssetId(expected) : assetId;
|
|
1456
|
+
const exactFrozenBody = Boolean(allowFrozenUnverified
|
|
1457
|
+
&& stored
|
|
1458
|
+
&& expected
|
|
1459
|
+
&& assetstore.frozenAssetRecordsEqual(stored, expected)
|
|
1460
|
+
&& computed === expectedComputed);
|
|
1461
|
+
const supportedFrozenProvenance = provenance?.assetId === assetId
|
|
1462
|
+
&& provenance.trusted === false
|
|
1463
|
+
&& provenance.decision === undefined
|
|
1464
|
+
&& provenance.decidedBy === undefined
|
|
1465
|
+
&& provenance.promotedBy === undefined
|
|
1466
|
+
&& ((provenance.source === 'hub'
|
|
1467
|
+
&& (provenance.reason === 'unverified_hub_rewrite' || provenance.reason === 'unverified_hub_synthesized'))
|
|
1468
|
+
|| (provenance.source === 'migrated' && provenance.reason === 'unverified_gepx_import'));
|
|
1469
|
+
const provenanceBoundFrozenBody = Boolean(stored
|
|
1470
|
+
&& computed
|
|
1471
|
+
&& supportedFrozenProvenance
|
|
1472
|
+
&& provenance.frozenContentId === computed);
|
|
1394
1473
|
if (!stored ||
|
|
1395
1474
|
stored.asset_id !== assetId ||
|
|
1396
|
-
computed !== assetId ||
|
|
1397
|
-
expectedComputed !== assetId ||
|
|
1398
|
-
(
|
|
1475
|
+
(!exactFrozenBody && !provenanceBoundFrozenBody && computed !== assetId) ||
|
|
1476
|
+
(!exactFrozenBody && !provenanceBoundFrozenBody && expectedComputed !== assetId) ||
|
|
1477
|
+
(expectedType !== undefined && stored.type !== expectedType)) {
|
|
1399
1478
|
throw new SyncAbortError('store_read_back_failed', 'Stored asset failed read-back verification');
|
|
1400
1479
|
}
|
|
1401
1480
|
return stored;
|
|
@@ -1424,7 +1503,7 @@ function syncRecordMatches(record, candidate, asset) {
|
|
|
1424
1503
|
record.scope === scope &&
|
|
1425
1504
|
(!logicalId || record.logicalId === logicalId);
|
|
1426
1505
|
}
|
|
1427
|
-
function preparePackagedAsset(candidate, asset, localAssetIds, logical, force) {
|
|
1506
|
+
function preparePackagedAsset(candidate, asset, localAssetIds, logical, force, frozenUnverified = false) {
|
|
1428
1507
|
const cleaned = stripHubMetadata(asset);
|
|
1429
1508
|
const type = cleaned.type === 'Gene' || cleaned.type === 'Capsule' ? cleaned.type : undefined;
|
|
1430
1509
|
if (!type)
|
|
@@ -1433,7 +1512,11 @@ function preparePackagedAsset(candidate, asset, localAssetIds, logical, force) {
|
|
|
1433
1512
|
return { blocked: { ...candidate, type, action: 'unsupported_type' } };
|
|
1434
1513
|
const claimed = stringField(cleaned, 'asset_id');
|
|
1435
1514
|
const computed = wire.computeAssetId(cleaned);
|
|
1436
|
-
if (!claimed
|
|
1515
|
+
if (!claimed
|
|
1516
|
+
|| !computed
|
|
1517
|
+
|| (claimed !== computed && !frozenUnverified)
|
|
1518
|
+
|| claimed !== candidate.assetId
|
|
1519
|
+
|| !looksLikeFullAsset(cleaned, type)) {
|
|
1437
1520
|
throw new SyncAbortError('integrity_error', '.gepx package integrity verification failed before import');
|
|
1438
1521
|
}
|
|
1439
1522
|
if (localAssetIds.has(cleaned.asset_id))
|
|
@@ -1500,6 +1583,10 @@ function readGepxPackage(path) {
|
|
|
1500
1583
|
}
|
|
1501
1584
|
if (obj['assets'].length > MAX_GEPX_ASSETS)
|
|
1502
1585
|
throw new SyncAbortError('invalid_gepx', 'invalid .gepx package');
|
|
1586
|
+
if ((Array.isArray(obj['provenance']) && obj['provenance'].length > MAX_GEPX_SIDECAR_RECORDS)
|
|
1587
|
+
|| (Array.isArray(obj['sync']) && obj['sync'].length > MAX_GEPX_SIDECAR_RECORDS)) {
|
|
1588
|
+
throw new SyncAbortError('invalid_gepx', 'invalid .gepx package');
|
|
1589
|
+
}
|
|
1503
1590
|
const assets = [];
|
|
1504
1591
|
const malformedAssets = [];
|
|
1505
1592
|
obj['assets'].forEach((rawAsset, index) => {
|
|
@@ -1535,15 +1622,30 @@ function parseGepxProvenanceRecord(value) {
|
|
|
1535
1622
|
const assetId = stringField(value, 'assetId');
|
|
1536
1623
|
const source = stringField(value, 'source');
|
|
1537
1624
|
const at = stringField(value, 'at');
|
|
1538
|
-
|
|
1625
|
+
const frozenContentId = stringField(value, 'frozenContentId');
|
|
1626
|
+
if (!assetId
|
|
1627
|
+
|| !at
|
|
1628
|
+
|| Number.isNaN(Date.parse(at))
|
|
1629
|
+
|| typeof value['trusted'] !== 'boolean'
|
|
1630
|
+
|| (source !== 'local' && source !== 'migrated' && source !== 'hub')
|
|
1631
|
+
|| (frozenContentId !== undefined && !/^sha256:[0-9a-f]{64}$/.test(frozenContentId)))
|
|
1632
|
+
return null;
|
|
1633
|
+
const rawDecision = value['decision'];
|
|
1634
|
+
if (rawDecision !== undefined && rawDecision !== 'promoted' && rawDecision !== 'revoked')
|
|
1539
1635
|
return null;
|
|
1636
|
+
const decision = rawDecision === 'promoted' || rawDecision === 'revoked'
|
|
1637
|
+
? rawDecision
|
|
1638
|
+
: undefined;
|
|
1540
1639
|
return {
|
|
1541
1640
|
assetId,
|
|
1542
1641
|
source,
|
|
1543
|
-
trusted: value['trusted']
|
|
1642
|
+
trusted: value['trusted'],
|
|
1544
1643
|
at,
|
|
1644
|
+
...(decision ? { decision } : {}),
|
|
1645
|
+
...(stringField(value, 'decidedBy') ? { decidedBy: stringField(value, 'decidedBy') } : {}),
|
|
1545
1646
|
...(stringField(value, 'promotedBy') ? { promotedBy: stringField(value, 'promotedBy') } : {}),
|
|
1546
1647
|
...(stringField(value, 'reason') ? { reason: stringField(value, 'reason') } : {}),
|
|
1648
|
+
...(frozenContentId ? { frozenContentId } : {}),
|
|
1547
1649
|
};
|
|
1548
1650
|
}
|
|
1549
1651
|
function parseGepxSyncRecord(value) {
|
package/dist/thesis.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export interface ThesisCommandDeps {
|
|
|
35
35
|
now?: () => number;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
|
-
* `evolver thesis --suite <file> [--repo <allowlisted>] [--min-samples N] [--min-delta D] [--interleave] [--json]`.
|
|
38
|
+
* `evolver thesis --suite <file> [--repo <allowlisted>] [--runner gemini] [--min-samples N] [--min-delta D] [--interleave] [--json]`.
|
|
39
39
|
* Runs the controlled A/B and prints baseline-vs-evolver pass rates + the verdict. A LIVE run needs `--repo` (the
|
|
40
40
|
* single allowlisted root the agent may touch); tests inject `deps.execute` instead.
|
|
41
41
|
*/
|
package/dist/thesis.js
CHANGED
|
@@ -40,14 +40,14 @@ const parseFlags = (argv) => {
|
|
|
40
40
|
};
|
|
41
41
|
const pct = (r) => `${(r * 100).toFixed(0)}%`;
|
|
42
42
|
/**
|
|
43
|
-
* `evolver thesis --suite <file> [--repo <allowlisted>] [--min-samples N] [--min-delta D] [--interleave] [--json]`.
|
|
43
|
+
* `evolver thesis --suite <file> [--repo <allowlisted>] [--runner gemini] [--min-samples N] [--min-delta D] [--interleave] [--json]`.
|
|
44
44
|
* Runs the controlled A/B and prints baseline-vs-evolver pass rates + the verdict. A LIVE run needs `--repo` (the
|
|
45
45
|
* single allowlisted root the agent may touch); tests inject `deps.execute` instead.
|
|
46
46
|
*/
|
|
47
47
|
export async function runThesisCommand(argv, deps = {}) {
|
|
48
48
|
const flags = parseFlags(argv);
|
|
49
49
|
if (!flags['suite']) {
|
|
50
|
-
process.stderr.write('用法: evolver thesis --suite <file> [--repo <allowlisted>] [--min-samples N] [--min-delta D] [--alpha A] [--target-power P] [--interleave] [--json]\n');
|
|
50
|
+
process.stderr.write('用法: evolver thesis --suite <file> [--repo <allowlisted>] [--runner gemini] [--min-samples N] [--min-delta D] [--alpha A] [--target-power P] [--interleave] [--json]\n');
|
|
51
51
|
return 1;
|
|
52
52
|
}
|
|
53
53
|
let suite;
|
|
@@ -76,6 +76,10 @@ export async function runThesisCommand(argv, deps = {}) {
|
|
|
76
76
|
process.stderr.write('thesis: a controlled A/B needs an external verifier — add a non-empty "validation" array to the suite. Refusing (passed must not come from agent self-report).\n');
|
|
77
77
|
return 1;
|
|
78
78
|
}
|
|
79
|
+
if (!deps.execute && flags['runner'] !== 'gemini') {
|
|
80
|
+
process.stderr.write('thesis: execute capability is unsupported for built-in Claude/Codex; select --runner gemini\n');
|
|
81
|
+
return 1;
|
|
82
|
+
}
|
|
79
83
|
// HERMETIC experiment (Bugbot #168): the evolver arm READS genes from the pool but its cycle WRITES (capsules,
|
|
80
84
|
// evolution events) must NOT land in production — that would pollute real selection + bans. So seed a THROWAWAY
|
|
81
85
|
// evolver store with a copy of the pool's genes; both arms write only into temp stores that are discarded after.
|
|
@@ -98,7 +102,18 @@ export async function runThesisCommand(argv, deps = {}) {
|
|
|
98
102
|
}
|
|
99
103
|
return { passed: true, score: 0.95 };
|
|
100
104
|
};
|
|
101
|
-
|
|
105
|
+
try {
|
|
106
|
+
execute = exec.makeSafeExecute(repo, evolverStore, { allowedRoots: [repo], runner: 'gemini' }, { validate });
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
rmSync(expDir, { recursive: true, force: true });
|
|
110
|
+
if (error instanceof exec.UnsupportedAutonomousClaudeRunnerError
|
|
111
|
+
|| error instanceof exec.UnsupportedAutonomousCodexRunnerError) {
|
|
112
|
+
process.stderr.write('thesis: execute capability is unsupported: built-in autonomous runners require a verified host filesystem sandbox\n');
|
|
113
|
+
return 1;
|
|
114
|
+
}
|
|
115
|
+
throw error;
|
|
116
|
+
}
|
|
102
117
|
}
|
|
103
118
|
const agent = execute;
|
|
104
119
|
const solver = benchmark.makeEvolutionThesisSolver({
|
package/dist/trajectoryExport.js
CHANGED
|
@@ -2,7 +2,7 @@ import { closeSync, existsSync, lstatSync, openSync, readSync, readdirSync, read
|
|
|
2
2
|
import { basename, delimiter, dirname, extname, join, resolve, sep } from 'node:path';
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
4
|
import { events, ops, trace } from '@evomap/evolver-core';
|
|
5
|
-
import { ADAPTERS, adapterForPath, genericChatAdapter, isCursorStateVscdbPath, parseCursorStateVscdb, parseJsonlLines, parseJsonlLinesWithStats, } from '@evomap/evolver-runtime-adapters';
|
|
5
|
+
import { ADAPTERS, isRemovedAdapter, adapterForPath, genericChatAdapter, isCursorStateVscdbPath, parseCursorStateVscdb, parseJsonlLines, parseJsonlLinesWithStats, } from '@evomap/evolver-runtime-adapters';
|
|
6
6
|
const TRACE_FILE_RE = /(^|[/\\])llm-trace-[^/\\]*\.jsonl$/i;
|
|
7
7
|
const RUNTIME_SESSION_ENABLE_ENV = 'EVOLVER_TRAJECTORY_RUNTIME_SESSIONS';
|
|
8
8
|
const RUNTIME_SESSION_ENABLE_ENV_LEGACY = 'EVOLVER_TRAJECTORY_EXPORT_RUNTIME_SESSIONS';
|
|
@@ -165,7 +165,9 @@ function traceLikeContent(chunk) {
|
|
|
165
165
|
return parseJsonlLines(chunk).some(isTraceLikeRow);
|
|
166
166
|
}
|
|
167
167
|
function adapterForContent(chunk) {
|
|
168
|
-
|
|
168
|
+
// Never probe REMOVED_ADAPTERS / isRemovedAdapter agents — their parse() always throws.
|
|
169
|
+
const candidates = [genericChatAdapter, ...ADAPTERS.filter((candidate) => candidate !== genericChatAdapter && !isRemovedAdapter(candidate.agent))];
|
|
170
|
+
for (const adapter of candidates) {
|
|
169
171
|
if (adapter.parse(chunk).some((turn) => turn.isMeta !== true))
|
|
170
172
|
return adapter;
|
|
171
173
|
}
|
|
@@ -194,6 +196,7 @@ function cursorGlobalStorageDir(home) {
|
|
|
194
196
|
function cursorGlobalStorageDirs(home) {
|
|
195
197
|
const dirs = [
|
|
196
198
|
cursorGlobalStorageDir(home),
|
|
199
|
+
join(home, 'AppData', 'Roaming', 'Cursor', 'User', 'globalStorage'),
|
|
197
200
|
join(home, '.config', 'Cursor', 'User', 'globalStorage'),
|
|
198
201
|
];
|
|
199
202
|
const appData = process.env['APPDATA'];
|
|
@@ -779,6 +782,7 @@ export async function runTrajectoryExport(argv) {
|
|
|
779
782
|
let files = [];
|
|
780
783
|
let sessionFileCount = 0;
|
|
781
784
|
let sessionTurnCount = 0;
|
|
785
|
+
let cursorParseFailures = 0;
|
|
782
786
|
let excludedUnmarked = 0;
|
|
783
787
|
let excludedGatewayCaptured = 0;
|
|
784
788
|
const discoveredRuntimeDirs = runtimeSessionDirs(flags);
|
|
@@ -807,7 +811,19 @@ export async function runTrajectoryExport(argv) {
|
|
|
807
811
|
// Read Cursor chat out of the sqlite db (read-only) and convert each composer to a trajectory. The
|
|
808
812
|
// marker/gateway gates run PER COMPOSER here (each composerId is its own session_id), so a state.vscdb
|
|
809
813
|
// holding many composers contributes only the ones evolver marked (and not already gateway-captured).
|
|
810
|
-
|
|
814
|
+
let parsedSessions;
|
|
815
|
+
try {
|
|
816
|
+
parsedSessions = parseCursorStateVscdb(file.path);
|
|
817
|
+
}
|
|
818
|
+
catch (error) {
|
|
819
|
+
// Default discovery spans several optional platform locations. One stale/corrupt profile must not block
|
|
820
|
+
// healthy profiles or other runtime sources; explicit inputs still fail with the detailed parser error.
|
|
821
|
+
if (!file.fromRuntimeDiscovery)
|
|
822
|
+
throw error;
|
|
823
|
+
cursorParseFailures += 1;
|
|
824
|
+
continue;
|
|
825
|
+
}
|
|
826
|
+
for (const parsedSession of parsedSessions) {
|
|
811
827
|
const { turns, ...adapterMetadata } = parsedSession;
|
|
812
828
|
if (file.fromRuntimeDiscovery) {
|
|
813
829
|
const composerSessionId = typeof adapterMetadata.sessionId === 'string' ? adapterMetadata.sessionId : undefined;
|
|
@@ -898,6 +914,8 @@ export async function runTrajectoryExport(argv) {
|
|
|
898
914
|
process.stdout.write(`[trajectory-export] Read ${allRows.length} trace row(s) and ${sessionTurnCount} session turn(s) from ${files.length} file(s).\n`);
|
|
899
915
|
if (sessionFileCount > 0)
|
|
900
916
|
process.stdout.write(`[trajectory-export] Converted ${sessionFileCount} runtime session file(s).\n`);
|
|
917
|
+
if (cursorParseFailures > 0)
|
|
918
|
+
process.stdout.write(`[trajectory-export] Skipped ${cursorParseFailures} unreadable Cursor state database(s).\n`);
|
|
901
919
|
if (excludedUnmarked > 0 || excludedGatewayCaptured > 0) {
|
|
902
920
|
process.stdout.write(`[trajectory-export] Runtime session gate: excluded ${excludedUnmarked} unmarked (no evolver value.inject) and ${excludedGatewayCaptured} already-gateway-captured session(s). Pass --include-unmarked / --include-gateway-captured to collect them.\n`);
|
|
903
921
|
}
|
package/dist/v1Compat.d.ts
CHANGED
|
@@ -21,4 +21,5 @@ export declare function runV1RunCompat(argv: readonly string[], deps?: V1CompatD
|
|
|
21
21
|
export declare function runV1SolidifyCompat(argv: readonly string[], deps?: V1CompatDeps): Promise<number>;
|
|
22
22
|
export declare function runV1FetchCompat(argv: readonly string[], deps?: V1CompatDeps): Promise<number>;
|
|
23
23
|
export declare function runV1WebuiCompat(argv: readonly string[], deps?: V1CompatDeps): Promise<number>;
|
|
24
|
+
export declare function runV1ExecCompat(argv: readonly string[], deps?: V1CompatDeps): Promise<number>;
|
|
24
25
|
export {};
|
package/dist/v1Compat.js
CHANGED
|
@@ -10,6 +10,7 @@ const RUN_USAGE = 'usage: evolver run [-v | --verbose] [--loop | --mad-dog] [--j
|
|
|
10
10
|
const SOLIDIFY_USAGE = 'usage: evolver solidify [--dry-run] [--json]\n';
|
|
11
11
|
const FETCH_USAGE = 'usage: evolver fetch (--skill <id> | -s <id> | <id>) [--out <dir>] [--force] [--json]\n';
|
|
12
12
|
const WEBUI_USAGE = 'usage: evolver webui [--port N] [--no-open]\n';
|
|
13
|
+
const EXEC_USAGE = 'usage: evolver exec <command>\n';
|
|
13
14
|
const V1_WEBUI_DEFAULT_PORT = 19_821;
|
|
14
15
|
const V1_WEBUI_PORT_ATTEMPTS = 50;
|
|
15
16
|
function io(deps) {
|
|
@@ -246,4 +247,12 @@ export async function runV1WebuiCompat(argv, deps = {}) {
|
|
|
246
247
|
if (deps.dashboard)
|
|
247
248
|
return deps.dashboard(mapped, dashboardOptions);
|
|
248
249
|
return runDashboardCommand(mapped, {}, dashboardOptions);
|
|
250
|
+
}
|
|
251
|
+
export async function runV1ExecCompat(argv, deps = {}) {
|
|
252
|
+
if (argv.includes('--help') || argv.includes('-h')) {
|
|
253
|
+
io(deps).stdout(EXEC_USAGE);
|
|
254
|
+
return 0;
|
|
255
|
+
}
|
|
256
|
+
const json = argv.includes('--json');
|
|
257
|
+
return migrationRequired('exec', 'evolver autoexec', 'V1 exec cannot be mapped safely to V2; use `evolver autoexec` for resident execution', json, deps, { mode: 'no_action' });
|
|
249
258
|
}
|
package/dist/workflowRuntime.js
CHANGED
|
@@ -3,6 +3,7 @@ import { realpathSync, statSync } from 'node:fs';
|
|
|
3
3
|
import { basename, dirname, isAbsolute, join, resolve, sep } from 'node:path';
|
|
4
4
|
import { algo, assetstore, events, exec, verify, wire, workflow } from '@evomap/evolver-core';
|
|
5
5
|
import { readAutoExecConfig } from './autoexecConfig.js';
|
|
6
|
+
import { runRequiredSandboxedValidation } from './requiredSandboxValidation.js';
|
|
6
7
|
const DEFAULT_MAX_CONCURRENT_RUNS = 4;
|
|
7
8
|
const MAX_MAX_CONCURRENT_RUNS = 64;
|
|
8
9
|
const MAX_PROMPT_LENGTH = 4_000;
|
|
@@ -333,28 +334,29 @@ function createProductionWorkflowAgentBridgeFromSnapshot(config, options, policy
|
|
|
333
334
|
}
|
|
334
335
|
const validate = validationCommands
|
|
335
336
|
? async (_mutation, _decision, cwd) => {
|
|
336
|
-
const result = await
|
|
337
|
+
const result = await runRequiredSandboxedValidation(validationCommands, cwd, {}, runValidation);
|
|
337
338
|
return { passed: result.passed, score: result.score };
|
|
338
339
|
}
|
|
339
340
|
: undefined;
|
|
340
|
-
|
|
341
|
-
allowedRoots,
|
|
342
|
-
runner: config.runner,
|
|
343
|
-
timeoutMs: config.timeoutMs,
|
|
344
|
-
scrubEnv: true,
|
|
345
|
-
isolation: 'worktree',
|
|
346
|
-
requireTrustedGene: true,
|
|
347
|
-
...(bridgeOptions?.signal ? { signal: bridgeOptions.signal } : {}),
|
|
348
|
-
}, {
|
|
349
|
-
provenance,
|
|
350
|
-
review,
|
|
351
|
-
...(validate ? { validate } : {}),
|
|
352
|
-
...(validationCommands ? { validationCmds: validationCommands } : {}),
|
|
353
|
-
...(options.agent ? { agent: options.agent } : {}),
|
|
354
|
-
...(options.git ? { git: options.git } : {}),
|
|
355
|
-
});
|
|
341
|
+
let execute;
|
|
356
342
|
let result;
|
|
357
343
|
try {
|
|
344
|
+
execute = exec.makeSafeExecute(repo, store, {
|
|
345
|
+
allowedRoots,
|
|
346
|
+
runner: config.runner,
|
|
347
|
+
timeoutMs: config.timeoutMs,
|
|
348
|
+
scrubEnv: true,
|
|
349
|
+
isolation: 'worktree',
|
|
350
|
+
requireTrustedGene: true,
|
|
351
|
+
...(bridgeOptions?.signal ? { signal: bridgeOptions.signal } : {}),
|
|
352
|
+
}, {
|
|
353
|
+
provenance,
|
|
354
|
+
review,
|
|
355
|
+
...(validate ? { validate } : {}),
|
|
356
|
+
...(validationCommands ? { validationCmds: validationCommands } : {}),
|
|
357
|
+
...(options.agent ? { agent: options.agent } : {}),
|
|
358
|
+
...(options.git ? { git: options.git } : {}),
|
|
359
|
+
});
|
|
358
360
|
result = await execute(workflowMutation(prompt.trim(), context), {
|
|
359
361
|
selectedGeneId: logicalGeneId,
|
|
360
362
|
selectedAssetId: context.reviewedGeneAssetId,
|
|
@@ -367,7 +369,11 @@ function createProductionWorkflowAgentBridgeFromSnapshot(config, options, policy
|
|
|
367
369
|
if (error instanceof workflow.ClassifiedWorkflowError)
|
|
368
370
|
throw error;
|
|
369
371
|
const name = error instanceof Error ? error.name : '';
|
|
370
|
-
if (name === 'ExecBridgeForbiddenError'
|
|
372
|
+
if (name === 'ExecBridgeForbiddenError'
|
|
373
|
+
|| name === 'UnsandboxedFullAccessRequiresIsolationError'
|
|
374
|
+
|| name === 'UnsupportedAutonomousClaudeRunnerError'
|
|
375
|
+
|| name === 'UnsupportedAutonomousCodexRunnerError'
|
|
376
|
+
|| name === 'UnsupportedCursorAutonomousIsolationError') {
|
|
371
377
|
throw classified('safety', 'workflow agent execution was denied by safety policy');
|
|
372
378
|
}
|
|
373
379
|
throw classified('unknown', 'workflow agent execution failed');
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evomap/evolver-cli",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.19",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": "^22.13.0 || >=23.4.0"
|
|
8
|
+
},
|
|
6
9
|
"description": "evolver CLI (status/watch/cycles/rebuild-views/...)",
|
|
7
10
|
"bin": {
|
|
8
11
|
"evolver": "./dist/cli.js"
|
|
@@ -20,12 +23,12 @@
|
|
|
20
23
|
}
|
|
21
24
|
},
|
|
22
25
|
"dependencies": {
|
|
23
|
-
"@evomap/evolver-core": "2.0.0-beta.
|
|
24
|
-
"@evomap/evolver-adapter-public": "2.0.0-beta.
|
|
25
|
-
"@evomap/evolver-mcp": "2.0.0-beta.
|
|
26
|
-
"@evomap/evolver-proxy": "2.0.0-beta.
|
|
27
|
-
"@evomap/evolver-runtime-adapters": "2.0.0-beta.
|
|
28
|
-
"@evomap/evolver-webui": "2.0.0-beta.
|
|
26
|
+
"@evomap/evolver-core": "2.0.0-beta.19",
|
|
27
|
+
"@evomap/evolver-adapter-public": "2.0.0-beta.19",
|
|
28
|
+
"@evomap/evolver-mcp": "2.0.0-beta.19",
|
|
29
|
+
"@evomap/evolver-proxy": "2.0.0-beta.19",
|
|
30
|
+
"@evomap/evolver-runtime-adapters": "2.0.0-beta.19",
|
|
31
|
+
"@evomap/evolver-webui": "2.0.0-beta.19"
|
|
29
32
|
},
|
|
30
33
|
"repository": {
|
|
31
34
|
"type": "git",
|