@evomap/evolver-cli 2.0.0-beta.1 → 2.0.0-beta.12
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 +12 -0
- package/dist/antiGeneEvidence.d.ts +15 -0
- package/dist/antiGeneEvidence.js +49 -0
- package/dist/antiGeneRollout.d.ts +3 -1
- package/dist/antiGeneRollout.js +16 -2
- package/dist/assetHealth.d.ts +6 -0
- package/dist/assetHealth.js +107 -0
- package/dist/assetSidecarRecovery.d.ts +14 -0
- package/dist/assetSidecarRecovery.js +171 -0
- package/dist/assetTrust.d.ts +24 -0
- package/dist/assetTrust.js +218 -0
- package/dist/atp.js +4 -2
- package/dist/autoDistillLlm.d.ts +6 -0
- package/dist/autoDistillLlm.js +44 -7
- package/dist/autoexec.d.ts +14 -12
- package/dist/autoexec.js +84 -34
- package/dist/autoexecConfig.d.ts +10 -0
- package/dist/autoexecConfig.js +68 -0
- package/dist/cli.js +12 -5
- package/dist/cliContracts.js +30 -3
- package/dist/cliLifecycle.d.ts +7 -0
- package/dist/cliLifecycle.js +9 -0
- package/dist/cycleConsumer.d.ts +61 -1
- package/dist/cycleConsumer.js +551 -16
- package/dist/dashboard.d.ts +33 -0
- package/dist/dashboard.js +352 -0
- package/dist/dispatch.d.ts +10 -1
- package/dist/dispatch.js +40 -2
- package/dist/distillAdmission.d.ts +13 -0
- package/dist/distillAdmission.js +35 -0
- package/dist/distillObserver.js +6 -8
- package/dist/distillPrimitives.d.ts +9 -7
- package/dist/distillPrimitives.js +65 -12
- package/dist/doctor.d.ts +2 -0
- package/dist/doctor.js +49 -3
- package/dist/index.d.ts +8 -2
- package/dist/index.js +350 -42
- package/dist/issueReport.d.ts +7 -0
- package/dist/issueReport.js +291 -0
- package/dist/lifecycle.d.ts +22 -1
- package/dist/lifecycle.js +226 -29
- package/dist/localMemoryGraph.d.ts +97 -0
- package/dist/localMemoryGraph.js +889 -0
- package/dist/login.d.ts +20 -4
- package/dist/login.js +58 -8
- package/dist/materialPackage.d.ts +52 -0
- package/dist/materialPackage.js +401 -0
- package/dist/materialSnapshot.d.ts +54 -0
- package/dist/materialSnapshot.js +370 -0
- package/dist/memoryEventMirror.d.ts +23 -0
- package/dist/memoryEventMirror.js +140 -0
- package/dist/migrate/fieldMap.js +25 -0
- package/dist/migrate/v1Import.d.ts +7 -1
- package/dist/migrate/v1Import.js +132 -11
- package/dist/nonGitWorkspaceNotice.d.ts +24 -0
- package/dist/nonGitWorkspaceNotice.js +122 -0
- package/dist/proxyToken.d.ts +10 -0
- package/dist/proxyToken.js +80 -0
- package/dist/recipe.d.ts +12 -2
- package/dist/recipe.js +381 -8
- package/dist/reuse.d.ts +5 -3
- package/dist/reuse.js +126 -15
- package/dist/reuseReport.js +16 -16
- package/dist/runtimeCapabilities.d.ts +18 -0
- package/dist/runtimeCapabilities.js +81 -0
- package/dist/runtimeSessionSource.d.ts +10 -0
- package/dist/runtimeSessionSource.js +32 -5
- package/dist/setupHooks.d.ts +11 -1
- package/dist/setupHooks.js +235 -16
- package/dist/skill2gep.d.ts +38 -9
- package/dist/skill2gep.js +147 -14
- package/dist/skillDistill.d.ts +1 -0
- package/dist/skillDistill.js +4 -4
- package/dist/skillFetch.d.ts +18 -0
- package/dist/skillFetch.js +391 -0
- package/dist/solo/mode.js +5 -0
- package/dist/sync.d.ts +38 -0
- package/dist/sync.js +1981 -0
- package/dist/trajectoryExport.js +23 -12
- package/dist/v1Compat.d.ts +24 -0
- package/dist/v1Compat.js +249 -0
- package/dist/workflow.d.ts +39 -0
- package/dist/workflow.js +386 -0
- package/dist/workflowRuntime.d.ts +66 -0
- package/dist/workflowRuntime.js +631 -0
- package/package.json +12 -6
package/dist/reuse.js
CHANGED
|
@@ -14,6 +14,7 @@ import { assetstore, events, hub as hubNs, wire } from '@evomap/evolver-core';
|
|
|
14
14
|
import { AuthError, HubClientError, HubUnreachableError, connectPublicHub, isHubDryRunEnabled } from '@evomap/evolver-adapter-public';
|
|
15
15
|
import { loadEnvFileFromEnv } from '@evomap/evolver-mcp';
|
|
16
16
|
import { createRecipeHubFromEnv } from './recipe.js';
|
|
17
|
+
import { getCliVersion } from './version.js';
|
|
17
18
|
const REUSE_CONTRACT = 'reuse.v1';
|
|
18
19
|
const MAX_ID_LENGTH = 200;
|
|
19
20
|
const REUSE_USAGE = [
|
|
@@ -23,6 +24,8 @@ const REUSE_USAGE = [
|
|
|
23
24
|
// Flags that consume the following token as their value. firstPositional must skip those values so a flag value
|
|
24
25
|
// (e.g. the `reference` in `--mode reference`) is never mistaken for a bare positional asset id.
|
|
25
26
|
const VALUE_FLAGS = new Set(['--id', '--mode', '--run']);
|
|
27
|
+
// Keep this list limited to Hub-only fields. `confidence` is canonical Capsule content and must
|
|
28
|
+
// survive integrity verification even though delivery rows also use a field with that name.
|
|
26
29
|
const HUB_METADATA_KEYS = new Set([
|
|
27
30
|
'credit_cost',
|
|
28
31
|
'gdi_score',
|
|
@@ -86,12 +89,29 @@ export async function runReuseCommand(argv, deps = {}) {
|
|
|
86
89
|
}
|
|
87
90
|
// 3) Pull the global asset by id, write it into the local recall library (put dedups → idempotent on repeat).
|
|
88
91
|
const hub = deps.hub ?? createRecipeHubFromEnv(env, deps.connectHub ?? connectPublicHub);
|
|
92
|
+
// One-shot CLIs never heartbeat, so the hub may hold no env fingerprint for this node and its anti-abuse
|
|
93
|
+
// layer then 403s /a2a/fetch (`bulk_fetch_blocked: IP antibody`, #555). A fingerprinted hello
|
|
94
|
+
// (rotate:false + preserveCredentials:true) neither requests nor applies credential mutation while establishing
|
|
95
|
+
// trust. Best-effort by design:
|
|
96
|
+
// a hello failure must not block the fetch — the fetch's own error path classifies precisely.
|
|
97
|
+
await establishReuseTrust(hub);
|
|
89
98
|
const asset = await hub.fetchAssetById(opts.id);
|
|
90
99
|
if (!asset)
|
|
91
100
|
return emit({ ok: false, status: 'not_found', message: `asset ${opts.id} not found on the hub` }, ctx);
|
|
92
|
-
const
|
|
93
|
-
logReuse(deps, opts,
|
|
94
|
-
|
|
101
|
+
const { record, verified } = await ingestHubAsset(store, deps, asset, opts.id);
|
|
102
|
+
logReuse(deps, opts, record, 'hub');
|
|
103
|
+
// Both land the asset (exit 0). A verified reuse is a plain success; an unverified one is a first-class
|
|
104
|
+
// success too — the operator's save happened — but carries reason `unverified` so the desktop adapter can
|
|
105
|
+
// surface "added (unverified)" instead of a plain "added". status stays `ok` so older desktop builds, which
|
|
106
|
+
// key success on status==='ok' and ignore reason, keep working unchanged.
|
|
107
|
+
return emit(verified
|
|
108
|
+
? { ok: true, status: 'ok', message: 'reused into local recall library' }
|
|
109
|
+
: {
|
|
110
|
+
ok: true,
|
|
111
|
+
status: 'ok',
|
|
112
|
+
reason: 'unverified',
|
|
113
|
+
message: 'reused into local recall library as untrusted: hub-delivered content does not match its content fingerprint and could not be verified',
|
|
114
|
+
}, ctx);
|
|
95
115
|
}
|
|
96
116
|
catch (e) {
|
|
97
117
|
return emit(mapError(e), ctx);
|
|
@@ -158,23 +178,68 @@ export function parseReuseArgs(argv) {
|
|
|
158
178
|
const runId = flagValue(argv, '--run');
|
|
159
179
|
return { ok: true, value: { id, mode: modeRaw === 'direct' ? 'direct' : 'reference', ...(runId ? { runId } : {}) } };
|
|
160
180
|
}
|
|
181
|
+
// Integrity rejection is a first-class outcome, not an internal fault: the hub demonstrably rewrites
|
|
182
|
+
// delivered payloads (injected `validation`, wholesale `payload_backfill_reason` synthesis — #570), so the
|
|
183
|
+
// desktop adapter needs a typed reason to tell "this asset cannot be verified" apart from "the engine broke".
|
|
184
|
+
// Messages are fixed strings by construction (hard rule 2: nothing dynamic can reach a stream).
|
|
185
|
+
class ReuseIntegrityError extends Error {
|
|
186
|
+
}
|
|
187
|
+
const INTEGRITY_MISMATCH_MESSAGE = 'hub-delivered content does not match the asset content fingerprint';
|
|
188
|
+
const INTEGRITY_BACKFILLED_MESSAGE = 'hub delivered a synthesized payload for this asset; the original published content is unavailable for verification';
|
|
189
|
+
const INTEGRITY_LOGICAL_ID_MESSAGE = 'hub-delivered asset does not match the requested logical id';
|
|
190
|
+
function integrityError(synthesized) {
|
|
191
|
+
return new ReuseIntegrityError(synthesized ? INTEGRITY_BACKFILLED_MESSAGE : INTEGRITY_MISMATCH_MESSAGE);
|
|
192
|
+
}
|
|
161
193
|
async function ingestHubAsset(store, deps, asset, requestedId) {
|
|
162
|
-
const
|
|
194
|
+
const delivered = stripHubMetadata(unwrapHubAssetContent(asset));
|
|
195
|
+
// `payload_backfill_reason` is a hub DELIVERY marker (unwrapHubAssetContent lifts it onto the content so a
|
|
196
|
+
// synthesized payload can be classified). It is NOT publisher content, so it must be excluded from EVERY hash
|
|
197
|
+
// — identity, the local-conflict check, AND the stored bytes — and never persisted. Capture the
|
|
198
|
+
// classification fact, then drop the marker ONCE, up front: hashing it here but stripping it before storage
|
|
199
|
+
// made assertNoLocalReuseIdConflict hash a different byte string than what landed on disk, throwing a false
|
|
200
|
+
// id conflict on the second reuse of the same synthesized asset (Bugbot HIGH, broke idempotency).
|
|
201
|
+
const synthesized = stringField(delivered, 'payload_backfill_reason') !== undefined;
|
|
202
|
+
const cleaned = withoutHubDeliveryMarkers(delivered);
|
|
163
203
|
const actualAssetId = wire.computeAssetId(cleaned);
|
|
164
204
|
const contentAssetId = stringField(cleaned, 'asset_id');
|
|
165
|
-
if (!actualAssetId || !contentAssetId
|
|
166
|
-
|
|
205
|
+
if (!actualAssetId || !contentAssetId) {
|
|
206
|
+
// Malformed beyond classification — no computable hash or no declared id — stays a hard reject.
|
|
207
|
+
throw integrityError(synthesized);
|
|
167
208
|
}
|
|
168
|
-
|
|
169
|
-
|
|
209
|
+
// Identity guards stay STRICT: a hub that returned a DIFFERENT asset than requested (a self-consistent asset
|
|
210
|
+
// B under a request for A, or a different logical id) is a delivery fault, not the hub's known content-rewrite
|
|
211
|
+
// of the RIGHT asset — reject it so a reuse never silently pulls the wrong gene.
|
|
212
|
+
if (isContentAssetId(requestedId)) {
|
|
213
|
+
if (contentAssetId !== requestedId)
|
|
214
|
+
throw integrityError(synthesized);
|
|
170
215
|
}
|
|
171
|
-
if (
|
|
172
|
-
throw new
|
|
216
|
+
else if (stringField(cleaned, 'id') !== requestedId) {
|
|
217
|
+
throw new ReuseIntegrityError(INTEGRITY_LOGICAL_ID_MESSAGE);
|
|
173
218
|
}
|
|
174
219
|
await assertNoLocalReuseIdConflict(cleaned, store);
|
|
175
220
|
const provenance = new assetstore.ProvenanceStore(storeBaseDir(store, deps));
|
|
176
|
-
|
|
177
|
-
|
|
221
|
+
// Identity is confirmed; now content integrity. When the (marker-free) payload hashes to its declared id it
|
|
222
|
+
// lands verified (still sidecar-marked untrusted per #30). When it does NOT, the hub rewrote the delivered
|
|
223
|
+
// bytes of the right asset (#570) — DOWNGRADE instead of reject: freeze it under the network id and mark it
|
|
224
|
+
// unverified so the save actually happens and the loop (which already reuses hub content without
|
|
225
|
+
// re-verifying) can use it, while trust-first selection keeps it out of the reasoning pool until promotion.
|
|
226
|
+
if (actualAssetId === contentAssetId) {
|
|
227
|
+
const stored = await assetstore.ingestUntrusted(store, provenance, cleaned, 'hub');
|
|
228
|
+
return { record: { ...cleaned, asset_id: stored.asset_id }, verified: true };
|
|
229
|
+
}
|
|
230
|
+
const reason = synthesized ? 'unverified_hub_synthesized' : 'unverified_hub_rewrite';
|
|
231
|
+
const stored = await assetstore.ingestUnverified(store, provenance, cleaned, reason, 'hub');
|
|
232
|
+
return { record: { ...cleaned, asset_id: stored.asset_id }, verified: false };
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Drop hub DELIVERY markers that unwrapHubAssetContent lifts onto the content for classification but that must
|
|
236
|
+
* never reach content-addressed storage. Right now that is `payload_backfill_reason`; keeping this as a named
|
|
237
|
+
* helper localizes the "these keys describe HOW the hub delivered the asset, not the asset" rule.
|
|
238
|
+
*/
|
|
239
|
+
function withoutHubDeliveryMarkers(asset) {
|
|
240
|
+
const rest = { ...asset };
|
|
241
|
+
delete rest['payload_backfill_reason'];
|
|
242
|
+
return rest;
|
|
178
243
|
}
|
|
179
244
|
async function resolveLocalReuseAsset(store, id) {
|
|
180
245
|
const direct = await store.get(id);
|
|
@@ -203,6 +268,18 @@ async function assertNoLocalReuseIdConflict(asset, store) {
|
|
|
203
268
|
if (incomingAssetId !== localAssetId)
|
|
204
269
|
throw new Error('local asset id conflict');
|
|
205
270
|
}
|
|
271
|
+
function unwrapHubAssetContent(asset) {
|
|
272
|
+
const payload = asset.payload;
|
|
273
|
+
if (payload && typeof payload === 'object' && !Array.isArray(payload) && stringField(payload, 'asset_id')) {
|
|
274
|
+
const content = payload;
|
|
275
|
+
const backfillReason = stringField(asset, 'payload_backfill_reason');
|
|
276
|
+
if (backfillReason && stringField(payload, 'payload_backfill_reason') === undefined) {
|
|
277
|
+
return { ...content, payload_backfill_reason: backfillReason };
|
|
278
|
+
}
|
|
279
|
+
return content;
|
|
280
|
+
}
|
|
281
|
+
return asset;
|
|
282
|
+
}
|
|
206
283
|
function stripHubMetadata(asset) {
|
|
207
284
|
const out = {};
|
|
208
285
|
for (const [key, value] of Object.entries(asset))
|
|
@@ -232,17 +309,51 @@ function logReuse(deps, opts, asset, source) {
|
|
|
232
309
|
extra: { source },
|
|
233
310
|
});
|
|
234
311
|
}
|
|
312
|
+
async function establishReuseTrust(hub) {
|
|
313
|
+
if (typeof hub.hello !== 'function')
|
|
314
|
+
return;
|
|
315
|
+
try {
|
|
316
|
+
await hub.hello({ rotate: false, evolverVersion: getCliVersion(), preserveCredentials: true });
|
|
317
|
+
}
|
|
318
|
+
catch { /* fetch decides the outcome */ }
|
|
319
|
+
}
|
|
320
|
+
const ANTI_ABUSE_BLOCK_MESSAGE = 'hub anti-abuse temporarily blocked asset fetch for this node; keep the local Evolver proxy running so the node builds trust, then retry';
|
|
321
|
+
function antiAbuseOutcome() {
|
|
322
|
+
return { ok: false, status: 'rate_limited', message: ANTI_ABUSE_BLOCK_MESSAGE };
|
|
323
|
+
}
|
|
324
|
+
function isAntiAbuseFetchBlock(status, code) {
|
|
325
|
+
return status === 403 && code !== undefined && /antibody|bulk_fetch|anti[-_]?abuse/i.test(code);
|
|
326
|
+
}
|
|
327
|
+
function hubErrorField(body) {
|
|
328
|
+
if (!body || typeof body !== 'object')
|
|
329
|
+
return undefined;
|
|
330
|
+
const err = body['error'];
|
|
331
|
+
return typeof err === 'string' ? err : undefined;
|
|
332
|
+
}
|
|
235
333
|
function mapError(e) {
|
|
236
|
-
if (e instanceof
|
|
334
|
+
if (e instanceof ReuseIntegrityError) {
|
|
335
|
+
return { ok: false, status: 'integrity_failed', message: e.message };
|
|
336
|
+
}
|
|
337
|
+
if (e instanceof AuthError) {
|
|
338
|
+
// hubFetch raises AuthError for BOTH 401 and 403, so the hub's anti-abuse 403
|
|
339
|
+
// (`bulk_fetch_blocked: IP antibody active`) used to be misreported as "log in" — it is an
|
|
340
|
+
// abuse-control block on a perfectly healthy credential, not an auth failure (#555).
|
|
341
|
+
if (isAntiAbuseFetchBlock(e.status, e.errorCode))
|
|
342
|
+
return antiAbuseOutcome();
|
|
237
343
|
return { ok: false, status: 'unauthorized', message: 'hub authentication failed; run `evolver login` or set EVOMAP_NODE_SECRET' };
|
|
344
|
+
}
|
|
238
345
|
if (e instanceof HubUnreachableError)
|
|
239
346
|
return { ok: false, status: 'network', message: 'hub is unreachable' };
|
|
240
347
|
if (e instanceof HubClientError) {
|
|
348
|
+
if (e.status === 429)
|
|
349
|
+
return { ok: false, status: 'rate_limited', message: 'hub rate limited the request; retry later' };
|
|
350
|
+
if (isAntiAbuseFetchBlock(e.status, hubErrorField(e.body)))
|
|
351
|
+
return antiAbuseOutcome();
|
|
241
352
|
if (e.status === 401 || e.status === 403)
|
|
242
353
|
return { ok: false, status: 'unauthorized', message: 'hub authentication failed; run `evolver login` or set EVOMAP_NODE_SECRET' };
|
|
243
354
|
if (e.status === 404)
|
|
244
355
|
return { ok: false, status: 'not_found', message: 'asset not found on the hub' };
|
|
245
|
-
if (e.status
|
|
356
|
+
if (e.status >= 500)
|
|
246
357
|
return { ok: false, status: 'network', message: 'hub is temporarily unavailable' };
|
|
247
358
|
return { ok: false, status: 'internal_error', message: 'hub rejected the reuse request' };
|
|
248
359
|
}
|
|
@@ -264,7 +375,7 @@ function mapError(e) {
|
|
|
264
375
|
function emit(outcome, ctx) {
|
|
265
376
|
if (ctx.jsonOut) {
|
|
266
377
|
// stdout ONLY, exactly one object — the desktop adapter json.Unmarshals the whole stdout stream.
|
|
267
|
-
const envelope = { ok: outcome.ok, contract: REUSE_CONTRACT, status: outcome.status, reason: outcome.status, message: outcome.message };
|
|
378
|
+
const envelope = { ok: outcome.ok, contract: REUSE_CONTRACT, status: outcome.status, reason: outcome.reason ?? outcome.status, message: outcome.message };
|
|
268
379
|
ctx.stdout(JSON.stringify(envelope));
|
|
269
380
|
}
|
|
270
381
|
else if (outcome.ok) {
|
package/dist/reuseReport.js
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
// `--anti-gene` is the read-only operator view for #326: it surfaces local AntiGene assets, review state, shadow
|
|
17
17
|
// observations, and whether approved warnings have actually appeared in selection decisions.
|
|
18
18
|
import { events, ops, assetstore, algo } from '@evomap/evolver-core';
|
|
19
|
+
import { formatAntiGeneEvidenceAction, formatAntiGeneEvidenceSummary, summarizeAntiGeneEvidence } from './antiGeneEvidence.js';
|
|
19
20
|
function parseFlags(argv) {
|
|
20
21
|
let quarantine = false, promote = false, antiGene = false, minNegative = 3, minUnsafe = 1;
|
|
21
22
|
for (let i = 0; i < argv.length; i++) {
|
|
@@ -70,7 +71,7 @@ async function reportProbation(deps, log) {
|
|
|
70
71
|
return 0;
|
|
71
72
|
}
|
|
72
73
|
function reviewState(review, assetId) {
|
|
73
|
-
return reviewRecord(review, assetId)?.state ?? '
|
|
74
|
+
return reviewRecord(review, assetId)?.state ?? 'unreviewed';
|
|
74
75
|
}
|
|
75
76
|
function reviewRecord(review, assetId) {
|
|
76
77
|
return review?.get?.(assetId) ?? null;
|
|
@@ -81,12 +82,6 @@ function stringArray(value) {
|
|
|
81
82
|
function optionalString(value) {
|
|
82
83
|
return typeof value === 'string' && value.trim().length > 0 ? value.trim() : undefined;
|
|
83
84
|
}
|
|
84
|
-
function countLabel(value) {
|
|
85
|
-
return Array.isArray(value) ? String(value.length) : '0';
|
|
86
|
-
}
|
|
87
|
-
function numberLabel(value) {
|
|
88
|
-
return typeof value === 'number' && Number.isFinite(value) ? String(value) : '-';
|
|
89
|
-
}
|
|
90
85
|
function reviewAuditLabel(record) {
|
|
91
86
|
if (!record)
|
|
92
87
|
return '';
|
|
@@ -146,26 +141,31 @@ async function reportAntiGenes(deps, log) {
|
|
|
146
141
|
log('anti-gene: no AntiGene assets or shadow observations recorded yet.');
|
|
147
142
|
return 0;
|
|
148
143
|
}
|
|
149
|
-
const counts = { approved: 0, quarantined: 0, rejected: 0 };
|
|
144
|
+
const counts = { approved: 0, quarantined: 0, rejected: 0, unreviewed: 0 };
|
|
150
145
|
for (const asset of assets)
|
|
151
146
|
counts[reviewState(review, String(asset.asset_id))] += 1;
|
|
152
|
-
log(`anti-gene: ${assets.length} stored asset(s); review approved=${counts.approved} quarantined=${counts.quarantined} rejected=${counts.rejected}; shadow candidate=${shadowCandidates.length} declined=${shadowDeclines.length}`);
|
|
147
|
+
log(`anti-gene: ${assets.length} stored asset(s); review approved=${counts.approved} quarantined=${counts.quarantined} rejected=${counts.rejected} unreviewed=${counts.unreviewed}; shadow candidate=${shadowCandidates.length} declined=${shadowDeclines.length}`);
|
|
153
148
|
for (const asset of assets) {
|
|
154
149
|
const assetId = String(asset.asset_id);
|
|
155
150
|
const id = typeof asset['id'] === 'string' ? String(asset['id']) : assetId;
|
|
156
151
|
const record = reviewRecord(review, assetId);
|
|
157
|
-
const state = record?.state ?? '
|
|
152
|
+
const state = record?.state ?? 'unreviewed';
|
|
158
153
|
const severity = optionalString(asset['severity']) ?? '-';
|
|
159
154
|
const trigger = stringArray(asset['trigger']).slice(0, 6).join(',');
|
|
160
155
|
const avoid = stringArray(asset['avoid']).slice(0, 2).join(' | ');
|
|
161
|
-
const evidence = `failures=${numberLabel(asset['failure_count'])} clusters=${countLabel(asset['source_clusters'])} evidence=${countLabel(asset['evidence_capsules'])}`;
|
|
162
156
|
const audit = reviewAuditLabel(record);
|
|
163
157
|
const injected = (injectedCounts.get(id) ?? 0) + (id === assetId ? 0 : injectedCounts.get(assetId) ?? 0);
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
158
|
+
const evidenceSummary = summarizeAntiGeneEvidence(asset, injected);
|
|
159
|
+
const evidence = `${formatAntiGeneEvidenceSummary(evidenceSummary)} ${formatAntiGeneEvidenceAction(evidenceSummary, state)}`;
|
|
160
|
+
const next = state === 'unreviewed' && injected > 0
|
|
161
|
+
? `observed historically in ${injected} decision(s); explicit approval required`
|
|
162
|
+
: state === 'quarantined' || state === 'unreviewed'
|
|
163
|
+
? evidenceSummary.strength === 'weak'
|
|
164
|
+
? `reject/defer, or approve with evolver review --approve ${id} --allow-weak-evidence before warning injection`
|
|
165
|
+
: 'approve with evolver review --approve before warning injection'
|
|
166
|
+
: state === 'approved'
|
|
167
|
+
? (injected > 0 ? `observed in ${injected} decision(s)` : 'approved; waiting for matching selection')
|
|
168
|
+
: 'rejected; withheld from warning injection';
|
|
169
169
|
log(` ${id} {${state}} severity=${severity} trigger=${trigger || '-'} avoid=${avoid || '-'} ${evidence}${audit ? ` ${audit}` : ''} ${next}`);
|
|
170
170
|
}
|
|
171
171
|
if (shadowCandidates.length > 0 || shadowDeclines.length > 0) {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type RuntimeCapabilityStatus = 'supported' | 'experimental' | 'unsupported';
|
|
2
|
+
type RuntimeCapabilityId = 'claude-code' | 'codex' | 'cursor' | 'gemini' | 'antigravity' | 'kimi' | 'kiro' | 'opencode' | 'generic-chat';
|
|
3
|
+
interface RuntimeCapability {
|
|
4
|
+
status: RuntimeCapabilityStatus;
|
|
5
|
+
evidence: string;
|
|
6
|
+
}
|
|
7
|
+
interface RuntimeCapabilityEntry {
|
|
8
|
+
runtime: RuntimeCapabilityId;
|
|
9
|
+
ingest: RuntimeCapability;
|
|
10
|
+
inject: RuntimeCapability;
|
|
11
|
+
execute: RuntimeCapability;
|
|
12
|
+
verify: RuntimeCapability;
|
|
13
|
+
resume: RuntimeCapability;
|
|
14
|
+
}
|
|
15
|
+
/** Product-level runtime matrix. A transcript parser never implies execution, verification, or resumability. */
|
|
16
|
+
export declare const RUNTIME_CAPABILITY_MATRIX: Readonly<Record<RuntimeCapabilityId, RuntimeCapabilityEntry>>;
|
|
17
|
+
export declare function runtimeCapabilities(): RuntimeCapabilityEntry[];
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
const supported = (evidence) => ({ status: 'supported', evidence });
|
|
2
|
+
const experimental = (evidence) => ({ status: 'experimental', evidence });
|
|
3
|
+
const unsupported = (evidence) => ({ status: 'unsupported', evidence });
|
|
4
|
+
/** Product-level runtime matrix. A transcript parser never implies execution, verification, or resumability. */
|
|
5
|
+
export const RUNTIME_CAPABILITY_MATRIX = {
|
|
6
|
+
'claude-code': {
|
|
7
|
+
runtime: 'claude-code',
|
|
8
|
+
ingest: supported('normalized Claude Code JSONL adapter'),
|
|
9
|
+
inject: supported('MCP registration plus SessionStart hook'),
|
|
10
|
+
execute: supported('run-verified claude -p runner'),
|
|
11
|
+
verify: supported('git diff proof plus external validation hook'),
|
|
12
|
+
resume: unsupported('cycle runner does not bind ingested session ids to claude resume'),
|
|
13
|
+
},
|
|
14
|
+
codex: {
|
|
15
|
+
runtime: 'codex',
|
|
16
|
+
ingest: supported('normalized Codex rollout adapter'),
|
|
17
|
+
inject: supported('project MCP config plus SessionStart hook'),
|
|
18
|
+
execute: supported('run-verified codex exec runner'),
|
|
19
|
+
verify: supported('git diff proof plus external validation hook'),
|
|
20
|
+
resume: unsupported('cycle runner starts a new codex exec session'),
|
|
21
|
+
},
|
|
22
|
+
cursor: {
|
|
23
|
+
runtime: 'cursor',
|
|
24
|
+
ingest: supported('Cursor transcript and state.vscdb adapters'),
|
|
25
|
+
inject: supported('always-on project rules injection'),
|
|
26
|
+
execute: experimental('CLI flags are contract-tested but the repository still treats the runner as a scaffold'),
|
|
27
|
+
verify: supported('git diff proof plus external validation hook'),
|
|
28
|
+
resume: unsupported('no verified headless session resume mapping'),
|
|
29
|
+
},
|
|
30
|
+
gemini: {
|
|
31
|
+
runtime: 'gemini',
|
|
32
|
+
ingest: supported('normalized Gemini CLI session adapter'),
|
|
33
|
+
inject: unsupported('no Evolver Gemini injection installer'),
|
|
34
|
+
execute: experimental('hermetic Gemini CLI 0.46.0 headless JSON contract exists, but provider-backed live E2E smoke is not complete'),
|
|
35
|
+
verify: experimental('hermetic structured-result and git-diff proof contract exists, but provider-backed live E2E verification is not complete'),
|
|
36
|
+
resume: unsupported('Gemini resume accepts latest/index; ingested UUIDs cannot be mapped reliably'),
|
|
37
|
+
},
|
|
38
|
+
antigravity: {
|
|
39
|
+
runtime: 'antigravity',
|
|
40
|
+
ingest: supported('strict Antigravity transcript adapter'),
|
|
41
|
+
inject: supported('user-level MCP tool discovery only; no SessionStart hook'),
|
|
42
|
+
execute: unsupported('agy is not installed or live-verified in the implementation environment'),
|
|
43
|
+
verify: unsupported('no Antigravity runner result is wired to state proof'),
|
|
44
|
+
resume: unsupported('no verified transcript-id to agy resume contract'),
|
|
45
|
+
},
|
|
46
|
+
kimi: {
|
|
47
|
+
runtime: 'kimi',
|
|
48
|
+
ingest: supported('normalized Kimi session adapter'),
|
|
49
|
+
inject: unsupported('no Evolver Kimi injection installer'),
|
|
50
|
+
execute: unsupported('no verified Kimi runner contract'),
|
|
51
|
+
verify: unsupported('no Kimi execution runner exists'),
|
|
52
|
+
resume: unsupported('no verified Kimi resume contract'),
|
|
53
|
+
},
|
|
54
|
+
kiro: {
|
|
55
|
+
runtime: 'kiro',
|
|
56
|
+
ingest: supported('normalized Kiro session adapter'),
|
|
57
|
+
inject: unsupported('automatic Kiro setup is not available on the current main branch'),
|
|
58
|
+
execute: unsupported('no verified Kiro runner contract'),
|
|
59
|
+
verify: unsupported('no Kiro execution runner exists'),
|
|
60
|
+
resume: unsupported('no verified Kiro resume contract'),
|
|
61
|
+
},
|
|
62
|
+
opencode: {
|
|
63
|
+
runtime: 'opencode',
|
|
64
|
+
ingest: supported('normalized OpenCode session adapter'),
|
|
65
|
+
inject: unsupported('automatic OpenCode setup is not available on the current main branch'),
|
|
66
|
+
execute: unsupported('no verified OpenCode runner contract'),
|
|
67
|
+
verify: unsupported('no OpenCode execution runner exists'),
|
|
68
|
+
resume: unsupported('no verified OpenCode resume contract'),
|
|
69
|
+
},
|
|
70
|
+
'generic-chat': {
|
|
71
|
+
runtime: 'generic-chat',
|
|
72
|
+
ingest: supported('normalized standard OpenAI and Anthropic message JSON/JSONL adapter'),
|
|
73
|
+
inject: unsupported('generic transcript interchange has no Evolver injection installer'),
|
|
74
|
+
execute: unsupported('generic chat transcripts do not identify a runnable provider or CLI contract'),
|
|
75
|
+
verify: unsupported('no provider-backed execution runner exists for generic chat transcripts'),
|
|
76
|
+
resume: unsupported('no provider or session identity contract exists for generic chat transcripts'),
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
export function runtimeCapabilities() {
|
|
80
|
+
return Object.values(RUNTIME_CAPABILITY_MATRIX);
|
|
81
|
+
}
|
|
@@ -5,5 +5,15 @@ export interface RuntimeSessionSource {
|
|
|
5
5
|
sessionId?: string;
|
|
6
6
|
turns: NormalizedTurn[];
|
|
7
7
|
}
|
|
8
|
+
export interface RuntimeSessionParseDiagnostics {
|
|
9
|
+
rowsScanned: number;
|
|
10
|
+
rowsRead: number;
|
|
11
|
+
invalidJson: number;
|
|
12
|
+
}
|
|
13
|
+
export interface RuntimeSessionParseResult {
|
|
14
|
+
sources: RuntimeSessionSource[];
|
|
15
|
+
diagnostics: RuntimeSessionParseDiagnostics;
|
|
16
|
+
}
|
|
8
17
|
export declare function isRuntimeSessionSourcePath(path: string): boolean;
|
|
18
|
+
export declare function parseRuntimeSessionSourcesWithDiagnostics(path: string, readSource?: (path: string) => string): RuntimeSessionParseResult;
|
|
9
19
|
export declare function parseRuntimeSessionSources(path: string, readSource?: (path: string) => string): RuntimeSessionSource[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
|
-
import { adapterForPath, isCursorStateVscdbPath, parseCursorStateVscdb, } from '@evomap/evolver-runtime-adapters';
|
|
3
|
+
import { adapterForPath, isCursorStateVscdbPath, parseJsonlLinesWithStats, parseCursorStateVscdb, stripUtf8Bom, } from '@evomap/evolver-runtime-adapters';
|
|
4
|
+
const EMPTY_DIAGNOSTICS = { rowsScanned: 0, rowsRead: 0, invalidJson: 0 };
|
|
4
5
|
export function isRuntimeSessionSourcePath(path) {
|
|
5
6
|
return isCursorStateVscdbPath(path) || adapterForPath(path) !== undefined;
|
|
6
7
|
}
|
|
@@ -15,15 +16,41 @@ function cursorSourceFromSession(session, index) {
|
|
|
15
16
|
turns: session.turns,
|
|
16
17
|
};
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
+
function diagnosticsForRuntimeSource(raw) {
|
|
20
|
+
const trimmed = stripUtf8Bom(raw).trim();
|
|
21
|
+
if (!trimmed)
|
|
22
|
+
return { ...EMPTY_DIAGNOSTICS };
|
|
23
|
+
try {
|
|
24
|
+
JSON.parse(trimmed);
|
|
25
|
+
return { rowsScanned: 1, rowsRead: 1, invalidJson: 0 };
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return parseJsonlLinesWithStats(raw).stats;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export function parseRuntimeSessionSourcesWithDiagnostics(path, readSource = (p) => readFileSync(p, 'utf8')) {
|
|
19
32
|
const absPath = resolve(path);
|
|
20
33
|
if (isCursorStateVscdbPath(absPath)) {
|
|
21
|
-
|
|
34
|
+
const sources = parseCursorStateVscdb(absPath)
|
|
22
35
|
.map(cursorSourceFromSession)
|
|
23
36
|
.filter((source) => source !== null);
|
|
37
|
+
return { sources, diagnostics: { ...EMPTY_DIAGNOSTICS } };
|
|
24
38
|
}
|
|
25
39
|
const adapter = adapterForPath(absPath);
|
|
26
40
|
if (!adapter)
|
|
27
|
-
return [];
|
|
28
|
-
|
|
41
|
+
return { sources: [], diagnostics: { ...EMPTY_DIAGNOSTICS } };
|
|
42
|
+
const raw = readSource(absPath);
|
|
43
|
+
const sessionId = adapter.sessionIdFromPath?.(absPath)?.trim();
|
|
44
|
+
return {
|
|
45
|
+
sources: [{
|
|
46
|
+
agent: adapter.agent,
|
|
47
|
+
label: sessionId ? `${adapter.agent}:${sessionId}` : adapter.agent,
|
|
48
|
+
...(sessionId ? { sessionId } : {}),
|
|
49
|
+
turns: adapter.parse(raw),
|
|
50
|
+
}],
|
|
51
|
+
diagnostics: diagnosticsForRuntimeSource(raw),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export function parseRuntimeSessionSources(path, readSource = (p) => readFileSync(p, 'utf8')) {
|
|
55
|
+
return parseRuntimeSessionSourcesWithDiagnostics(path, readSource).sources;
|
|
29
56
|
}
|
package/dist/setupHooks.d.ts
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
+
import { type InstallScope } from '@evomap/evolver-mcp';
|
|
1
2
|
import { assetstore } from '@evomap/evolver-core';
|
|
2
|
-
|
|
3
|
+
import { maybeEmitNonGitWorkspaceNotice } from './nonGitWorkspaceNotice.js';
|
|
4
|
+
interface SetupHooksDeps {
|
|
5
|
+
emitNonGitWorkspaceNotice?: typeof maybeEmitNonGitWorkspaceNotice;
|
|
6
|
+
runtimeAvailable?: (runtime: 'opencode' | 'kiro', configRoot: string, scope: InstallScope) => boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function commandNamesForPath(command: string, platform: NodeJS.Platform, pathExt: string | undefined): string[];
|
|
9
|
+
export declare function safeSetupOperationError(error: unknown): string;
|
|
10
|
+
export declare function safeSetupResultError(error: unknown): string;
|
|
11
|
+
export declare function runSetupHooks(argv: readonly string[], store?: assetstore.AssetStoreProvider, review?: assetstore.ReviewLedger, deps?: SetupHooksDeps): Promise<number>;
|
|
12
|
+
export {};
|