@evomap/evolver-cli 2.0.48 → 2.0.50
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/autoDistillTranscript.d.ts +1 -1
- package/dist/autoDistillTranscript.js +9 -2
- package/dist/autoexec.js +3 -0
- package/dist/cliContracts.js +5 -28
- package/dist/cycleConsumer.js +3 -0
- package/dist/distillAdmission.d.ts +8 -1
- package/dist/distillAdmission.js +30 -0
- package/dist/distillObserver.d.ts +0 -6
- package/dist/distillObserver.js +17 -5
- package/dist/distillPrimitives.d.ts +4 -3
- package/dist/distillPrimitives.js +27 -18
- package/dist/doctor.d.ts +3 -0
- package/dist/doctor.js +17 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7 -0
- package/dist/lifecycle.d.ts +9 -0
- package/dist/lifecycle.js +159 -102
- package/dist/lifecycleAutoexecCompanion.d.ts +40 -0
- package/dist/lifecycleAutoexecCompanion.js +102 -0
- package/dist/lifecycleBootstrapTransaction.js +38 -17
- package/dist/llmCycle.js +15 -5
- package/dist/localMemoryGraph.js +29 -19
- package/dist/promptRecallRuntime.d.ts +3 -0
- package/dist/promptRecallRuntime.js +8 -0
- package/dist/promptRecallShared.d.ts +2 -0
- package/dist/promptRecallShared.js +13 -3
- package/dist/protectedAuditStatus.d.ts +22 -0
- package/dist/protectedAuditStatus.js +234 -0
- package/dist/recall.js +2 -3
- package/dist/runtimeCapabilities.d.ts +1 -1
- package/dist/runtimeCapabilities.js +24 -0
- package/dist/runtimeSessionSource.js +4 -4
- package/dist/sessionIngest.js +3 -0
- package/dist/setupHooks.d.ts +3 -0
- package/dist/setupHooks.js +98 -17
- package/dist/setupHooksLifecycle.d.ts +19 -3
- package/dist/setupHooksLifecycle.js +17 -246
- package/dist/setupHooksTransaction.d.ts +12 -0
- package/dist/setupHooksTransaction.js +220 -0
- package/dist/trajectoryExport.js +2 -2
- package/package.json +7 -7
|
@@ -69,7 +69,7 @@ export interface TranscriptDistillTickDeps {
|
|
|
69
69
|
statePath?: string;
|
|
70
70
|
now?: () => number;
|
|
71
71
|
maxPerTick?: number;
|
|
72
|
-
/** Test seam: read a session file. Default
|
|
72
|
+
/** Test seam: read a session file. Default readSessionLog (UTF-8, or the adapter's own decoding). */
|
|
73
73
|
readFile?: (path: string) => string;
|
|
74
74
|
}
|
|
75
75
|
export interface TranscriptDistillTickResult {
|
|
@@ -13,8 +13,9 @@ import { createHash } from 'node:crypto';
|
|
|
13
13
|
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
14
14
|
import { basename, dirname, join } from 'node:path';
|
|
15
15
|
import { algo, assetstore, events, hub, signals } from '@evomap/evolver-core';
|
|
16
|
-
import { adapterForPath } from '@evomap/evolver-runtime-adapters';
|
|
16
|
+
import { adapterForPath, readSessionLog } from '@evomap/evolver-runtime-adapters';
|
|
17
17
|
import { asGeneCandidate, parseDistillOutput, normalizeValidation, jaccardDuplicate, resolveDistillRunner, attachDistillModelName, p3Decide, } from './autoDistillLlm.js';
|
|
18
|
+
import { sessionsDistilledByHost, transcriptSessionIdOf } from './distillAdmission.js';
|
|
18
19
|
import { runRequiredSandboxedValidation } from './requiredSandboxValidation.js';
|
|
19
20
|
const DEFAULT_MIN_TURNS = 2;
|
|
20
21
|
const DEFAULT_MIN_CHARS = 200;
|
|
@@ -258,7 +259,7 @@ export async function runTranscriptDistillTick(deps) {
|
|
|
258
259
|
const out = { scanned: 0, distilled: 0, shadowed: 0, skipped: 0, transient: 0 };
|
|
259
260
|
if (mode === 'off')
|
|
260
261
|
return out;
|
|
261
|
-
const readFile = deps.readFile ??
|
|
262
|
+
const readFile = deps.readFile ?? readSessionLog;
|
|
262
263
|
const statePath = deps.statePath ?? autoDistillTranscriptStatePath();
|
|
263
264
|
const now = deps.now ?? (() => Date.now());
|
|
264
265
|
const maxPerTick = deps.maxPerTick ?? envInt(env, 'EVOLVER_AUTO_DISTILL_TRANSCRIPT_MAX_PER_TICK', DEFAULT_MAX_PER_TICK);
|
|
@@ -268,6 +269,7 @@ export async function runTranscriptDistillTick(deps) {
|
|
|
268
269
|
const tpatch = (hash, patch) => patchTState(statePath, hash, patch, stateCap);
|
|
269
270
|
let spawned = 0;
|
|
270
271
|
const seenThisTick = new Set(); // dedup identical-content files within ONE beat (state only dedups ACROSS beats)
|
|
272
|
+
const hostDistilled = await sessionsDistilledByHost(deps.store);
|
|
271
273
|
for (const file of deps.files) {
|
|
272
274
|
if (spawned >= maxPerTick)
|
|
273
275
|
break;
|
|
@@ -284,6 +286,11 @@ export async function runTranscriptDistillTick(deps) {
|
|
|
284
286
|
continue;
|
|
285
287
|
} // unreadable/unparseable → skip
|
|
286
288
|
out.scanned += 1;
|
|
289
|
+
const sessionId = adapter.parseSession?.(content)?.sessionId ?? transcriptSessionIdOf(content);
|
|
290
|
+
if (sessionId && hostDistilled.has(sessionId)) {
|
|
291
|
+
out.skipped += 1;
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
287
294
|
if (!shouldTranscriptDistill(turns).distill) {
|
|
288
295
|
out.skipped += 1;
|
|
289
296
|
continue;
|
package/dist/autoexec.js
CHANGED
|
@@ -1996,6 +1996,9 @@ export function defaultSessionDirs(env = process.env) {
|
|
|
1996
1996
|
join(h, '.gemini', 'antigravity'),
|
|
1997
1997
|
join(h, '.gemini', 'antigravity-ide'),
|
|
1998
1998
|
join(h, '.kimi'),
|
|
1999
|
+
join(h, '.workbuddy', 'projects'),
|
|
2000
|
+
join(h, '.dsh', 'sessions'),
|
|
2001
|
+
join(h, '.grok', 'sessions'),
|
|
1999
2002
|
join(h, 'Library', 'Application Support', 'Cursor', 'User', 'globalStorage'),
|
|
2000
2003
|
join(h, 'AppData', 'Roaming', 'Cursor', 'User', 'globalStorage'),
|
|
2001
2004
|
join(h, '.config', 'Cursor', 'User', 'globalStorage'),
|
package/dist/cliContracts.js
CHANGED
|
@@ -762,43 +762,20 @@ function checkValidationCommands(original) {
|
|
|
762
762
|
return { allowed: true, unsafeCommands: [] };
|
|
763
763
|
}
|
|
764
764
|
const unsafeCommands = [];
|
|
765
|
+
// 诊断只列出拒绝类别(不暴露原始命令文本,避免泄露安全策略细节)
|
|
766
|
+
const reasons = new Set();
|
|
765
767
|
for (const cmd of validation) {
|
|
766
768
|
if (typeof cmd !== 'string')
|
|
767
769
|
continue;
|
|
768
|
-
|
|
770
|
+
const rejection = verify.validationCommandRejection(cmd);
|
|
771
|
+
if (rejection) {
|
|
769
772
|
unsafeCommands.push(cmd);
|
|
773
|
+
reasons.add(rejection);
|
|
770
774
|
}
|
|
771
775
|
}
|
|
772
776
|
if (unsafeCommands.length === 0) {
|
|
773
777
|
return { allowed: true, unsafeCommands: [] };
|
|
774
778
|
}
|
|
775
|
-
// 构建诊断信息(不暴露原始命令文本,避免泄露安全策略细节)
|
|
776
|
-
const reasons = new Set();
|
|
777
|
-
for (const cmd of unsafeCommands) {
|
|
778
|
-
if (/`|\$\(/.test(cmd)) {
|
|
779
|
-
reasons.add('command_substitution');
|
|
780
|
-
continue;
|
|
781
|
-
}
|
|
782
|
-
const stripped = cmd.replace(/"[^"]*"/g, '').replace(/'[^']*'/g, '');
|
|
783
|
-
if (verify.SHELL_METACHARS.test(stripped)) {
|
|
784
|
-
reasons.add('shell_metacharacters');
|
|
785
|
-
continue;
|
|
786
|
-
}
|
|
787
|
-
const tokens = cmd.split(/\s+/);
|
|
788
|
-
const executable = tokens[0] ?? '';
|
|
789
|
-
const args = tokens.slice(1);
|
|
790
|
-
const badFlag = verify.isNodeExecutable(executable) ? verify.nodeFlagViolation(executable, args) : null;
|
|
791
|
-
if (badFlag) {
|
|
792
|
-
reasons.add('blocked_node_flag');
|
|
793
|
-
continue;
|
|
794
|
-
}
|
|
795
|
-
if (!cmd.trim().startsWith('node ')) {
|
|
796
|
-
reasons.add('non_node_command');
|
|
797
|
-
}
|
|
798
|
-
else {
|
|
799
|
-
reasons.add('unsafe_pattern');
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
779
|
return {
|
|
803
780
|
allowed: false,
|
|
804
781
|
unsafeCommands,
|
package/dist/cycleConsumer.js
CHANGED
|
@@ -150,6 +150,9 @@ function resolveMaterialRunner(material, requestedRunner) {
|
|
|
150
150
|
error: `sourceAgent '${sourceAgent}' execute capability is ${capability.status}: ${capability.evidence}`,
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
|
+
case 'workbuddy':
|
|
154
|
+
case 'dsh':
|
|
155
|
+
case 'grok':
|
|
153
156
|
case 'kiro':
|
|
154
157
|
case 'opencode':
|
|
155
158
|
case 'generic-chat':
|
|
@@ -10,4 +10,11 @@ export interface StoreDraftAdmission {
|
|
|
10
10
|
* unrelated Genes. MAX_SAFE_INTEGER deliberately removes the provider's default result window; silently accepting
|
|
11
11
|
* a duplicate after row 1000 is worse than evaluating all signal-related rows in a mature pool.
|
|
12
12
|
*/
|
|
13
|
-
export declare function assessDraftAdmissionFromStore(store: Pick<assetstore.AssetStoreProvider, 'search'>, candidate: algo.GeneCandidate, additional?: readonly ExistingGeneSignals[], opts?: DraftAdmissionOptions): Promise<StoreDraftAdmission>;
|
|
13
|
+
export declare function assessDraftAdmissionFromStore(store: Pick<assetstore.AssetStoreProvider, 'search'>, candidate: algo.GeneCandidate, additional?: readonly ExistingGeneSignals[], opts?: DraftAdmissionOptions): Promise<StoreDraftAdmission>;
|
|
14
|
+
/**
|
|
15
|
+
* Sessions a host plugin already distilled (its Capsule records the host session id as `source_thread`). The
|
|
16
|
+
* transcript backfill skips them so one session never yields both a plugin draft and a structural one.
|
|
17
|
+
*/
|
|
18
|
+
export declare function sessionsDistilledByHost(store: Pick<assetstore.AssetStoreProvider, 'list'>): Promise<ReadonlySet<string>>;
|
|
19
|
+
/** The host's own session id as a transcript records it near its start (Claude `sessionId`, Codex `session_meta`). */
|
|
20
|
+
export declare function transcriptSessionIdOf(content: string): string | undefined;
|
package/dist/distillAdmission.js
CHANGED
|
@@ -32,4 +32,34 @@ export async function assessDraftAdmissionFromStore(store, candidate, additional
|
|
|
32
32
|
...additional,
|
|
33
33
|
];
|
|
34
34
|
return { admission: assessDraftAdmission(candidate, existing, opts), existing };
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Sessions a host plugin already distilled (its Capsule records the host session id as `source_thread`). The
|
|
38
|
+
* transcript backfill skips them so one session never yields both a plugin draft and a structural one.
|
|
39
|
+
*/
|
|
40
|
+
export async function sessionsDistilledByHost(store) {
|
|
41
|
+
const capsules = await store.list('Capsule', 20_000);
|
|
42
|
+
return new Set(capsules
|
|
43
|
+
.map((capsule) => capsule['env_fingerprint']?.source_thread)
|
|
44
|
+
.filter((thread) => typeof thread === 'string' && thread.length > 0));
|
|
45
|
+
}
|
|
46
|
+
const SESSION_ID_SCAN_LINES = 50;
|
|
47
|
+
/** The host's own session id as a transcript records it near its start (Claude `sessionId`, Codex `session_meta`). */
|
|
48
|
+
export function transcriptSessionIdOf(content) {
|
|
49
|
+
for (const line of content.split('\n', SESSION_ID_SCAN_LINES)) {
|
|
50
|
+
let row;
|
|
51
|
+
try {
|
|
52
|
+
row = JSON.parse(line);
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const direct = row['sessionId'] ?? row['session_id'];
|
|
58
|
+
if (typeof direct === 'string' && direct)
|
|
59
|
+
return direct;
|
|
60
|
+
const meta = row['type'] === 'session_meta' ? row['payload']?.id : undefined;
|
|
61
|
+
if (typeof meta === 'string' && meta)
|
|
62
|
+
return meta;
|
|
63
|
+
}
|
|
64
|
+
return undefined;
|
|
35
65
|
}
|
|
@@ -17,12 +17,6 @@ export interface DistillComposition {
|
|
|
17
17
|
/** Read a session source file → raw chunk. Default fs read; injectable for tests. */
|
|
18
18
|
readSource?: (path: string) => string;
|
|
19
19
|
}
|
|
20
|
-
/**
|
|
21
|
-
* The injected drain side-effect: claim ready material → draft + quarantine genes. `runtime_session` material is
|
|
22
|
-
* distilled (its narration drafts a strategy); `proxy_trace` is observation-only (metadata, no narration) and is
|
|
23
|
-
* acked without drafting. Best-effort per material: a missing/unparseable source never blocks the rest of the
|
|
24
|
-
* batch. Every material in the claimed batch is acked (drafted, skipped, or failed) so the cursor always advances.
|
|
25
|
-
*/
|
|
26
20
|
export declare function makeDistillDrain(c: DistillComposition): () => Promise<{
|
|
27
21
|
drafted: number;
|
|
28
22
|
stalled: boolean;
|
package/dist/distillObserver.js
CHANGED
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
// (This said "not yet wired into autoexec" long after it was wired. A stale WIRING note is worse than none: it
|
|
13
13
|
// reads as a real gap, and a 2026-08 audit did misreport this composition as unwired on the strength of it.)
|
|
14
14
|
import { assetstore, events, observers, signals, algo } from '@evomap/evolver-core';
|
|
15
|
-
import {
|
|
15
|
+
import { readSessionLog } from '@evomap/evolver-runtime-adapters';
|
|
16
16
|
import { Console } from 'node:console';
|
|
17
17
|
import { assessGeneDraft } from './distillPrimitives.js';
|
|
18
|
-
import { assessDraftAdmissionFromStore } from './distillAdmission.js';
|
|
18
|
+
import { assessDraftAdmissionFromStore, sessionsDistilledByHost, transcriptSessionIdOf } from './distillAdmission.js';
|
|
19
19
|
import { reviewLedgerForStore } from './reviewFilter.js';
|
|
20
20
|
import { runtimeSessionSourcesForMaterial } from './materialSnapshot.js';
|
|
21
21
|
/** Consumer group the distill drain claims under — independent cursor from any other material consumer. */
|
|
@@ -28,15 +28,23 @@ const DEFAULT_MAX_PER_TICK = 3;
|
|
|
28
28
|
* acked without drafting. Best-effort per material: a missing/unparseable source never blocks the rest of the
|
|
29
29
|
* batch. Every material in the claimed batch is acked (drafted, skipped, or failed) so the cursor always advances.
|
|
30
30
|
*/
|
|
31
|
+
function sessionIdOfSource(path, readSource) {
|
|
32
|
+
try {
|
|
33
|
+
return transcriptSessionIdOf(readSource(path));
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
31
39
|
export function makeDistillDrain(c) {
|
|
32
40
|
const review = c.review ?? reviewLedgerForStore(c.store);
|
|
33
41
|
const maxPerTick = c.maxPerTick ?? DEFAULT_MAX_PER_TICK;
|
|
34
|
-
const readSource = c.readSource ??
|
|
42
|
+
const readSource = c.readSource ?? readSessionLog;
|
|
35
43
|
let diagnosticConsole;
|
|
36
44
|
// Process ONE claimed material. `ack:true` ⇒ advance the cursor past it; `ack:false` ⇒ either a persist/audit
|
|
37
45
|
// write failed OR the remaining per-tick draft budget was reached — leave it for a retry tick. A bad/unparseable/
|
|
38
46
|
// missing source, a proxy_trace, a too-thin session, or a duplicate are all "handled" (skip + ack).
|
|
39
|
-
async function processOne(m, audited, draftLimit) {
|
|
47
|
+
async function processOne(m, audited, draftLimit, hostDistilled) {
|
|
40
48
|
// Only session narration distills; proxy_trace is observation-only (no turns to draft a strategy from).
|
|
41
49
|
if (m.sourceKind !== 'runtime_session' || m.kind !== 'session_log')
|
|
42
50
|
return { ack: true, drafted: 0 };
|
|
@@ -47,10 +55,13 @@ export function makeDistillDrain(c) {
|
|
|
47
55
|
catch {
|
|
48
56
|
return { ack: true, drafted: 0 }; // bad / missing / unparseable source — nothing to retry
|
|
49
57
|
}
|
|
58
|
+
const fileSessionId = sessionIdOfSource(m.sourcePath, readSource);
|
|
50
59
|
let drafted = 0;
|
|
51
60
|
for (const [sourceIndex, source] of sources.entries()) {
|
|
52
61
|
if (drafted >= draftLimit)
|
|
53
62
|
return { ack: false, drafted };
|
|
63
|
+
if (hostDistilled.has(source.sessionId ?? fileSessionId ?? ''))
|
|
64
|
+
continue;
|
|
54
65
|
const { candidate: draftedCandidate, diagnostics } = assessGeneDraft(source.turns, signals.extractSignals(source.turns), source.agent);
|
|
55
66
|
if (!draftedCandidate) {
|
|
56
67
|
// daemon 的实际日志入口也报告不足;不创建假 Gene 或改变 ack/retry 语义。
|
|
@@ -125,6 +136,7 @@ export function makeDistillDrain(c) {
|
|
|
125
136
|
.filter((e) => e.type === 'gene.distilled')
|
|
126
137
|
.map((e) => String(e.payload?.['assetId'] ?? ''))
|
|
127
138
|
.filter(Boolean));
|
|
139
|
+
const hostDistilled = await sessionsDistilledByHost(c.store);
|
|
128
140
|
let totalDrafted = 0;
|
|
129
141
|
let stalled = false;
|
|
130
142
|
// Draft up to maxPerTick new genes, then stop. A remaining backlog OR a stuck head (a material whose write keeps
|
|
@@ -141,7 +153,7 @@ export function makeDistillDrain(c) {
|
|
|
141
153
|
stalled = true;
|
|
142
154
|
break;
|
|
143
155
|
}
|
|
144
|
-
const { ack, drafted } = await processOne(m, audited, maxPerTick - totalDrafted);
|
|
156
|
+
const { ack, drafted } = await processOne(m, audited, maxPerTick - totalDrafted, hostDistilled);
|
|
145
157
|
totalDrafted += drafted;
|
|
146
158
|
if (ack)
|
|
147
159
|
acked.push(m.materialId);
|
|
@@ -58,14 +58,15 @@ export interface ExistingGeneSignals {
|
|
|
58
58
|
signals_match?: readonly string[];
|
|
59
59
|
}
|
|
60
60
|
export interface DraftAdmissionOptions {
|
|
61
|
-
/** Reject a draft with fewer
|
|
61
|
+
/** Reject a draft with fewer domain-discriminating signals than this (default 2). Generic signals (host tool names,
|
|
62
|
+
* `mcp__*` tools, error-shape classes) stay in signals_match for matching but do not count toward this floor. */
|
|
62
63
|
minSignals?: number;
|
|
63
64
|
/** Reject a draft with fewer strategy steps than this (default 1, i.e. just non-empty like intakeGene; raise it
|
|
64
65
|
* for a stricter substance floor). A real fix can be one concrete step, so the default does not over-filter. */
|
|
65
66
|
minStrategy?: number;
|
|
66
67
|
/** Reject a draft whose discriminating-signal Jaccard similarity to ANY existing gene is >= this (default 0.6).
|
|
67
|
-
*
|
|
68
|
-
*
|
|
68
|
+
* Generic signals are omitted from this SOFT comparison, while the exact-subset check still uses the complete
|
|
69
|
+
* signal sets. */
|
|
69
70
|
maxSimilarity?: number;
|
|
70
71
|
}
|
|
71
72
|
export interface DraftAdmission {
|
|
@@ -420,27 +420,32 @@ export function assessGeneDraft(turns, sigs, agent) {
|
|
|
420
420
|
generation_meta: { source: 'distilled' },
|
|
421
421
|
});
|
|
422
422
|
}
|
|
423
|
-
//
|
|
424
|
-
//
|
|
425
|
-
//
|
|
426
|
-
const
|
|
427
|
-
'reusable_capability',
|
|
428
|
-
|
|
429
|
-
'shell_command',
|
|
430
|
-
'
|
|
431
|
-
'
|
|
432
|
-
'
|
|
433
|
-
'
|
|
434
|
-
'
|
|
435
|
-
'
|
|
436
|
-
'
|
|
437
|
-
'
|
|
423
|
+
// A signal that every session can emit carries no domain identity: the fallback's own markers, the error classes
|
|
424
|
+
// that only describe a failure's shape, the built-in tools of every supported host, and MCP / Evolver tools. Two
|
|
425
|
+
// unrelated drafts sharing them must not look alike, and a draft made only of them is not a reusable capability.
|
|
426
|
+
const GENERIC_SIGNALS = new Set([
|
|
427
|
+
'reusable_capability', 'verified_workflow', 'verified-success', 'verified_success', 'structured_error', 'error_result',
|
|
428
|
+
...SIGNAL_ERROR_CLASSES.map(([, token]) => token),
|
|
429
|
+
'shell', 'shell_command', 'exec_command', 'bash', 'powershell', 'pwsh', 'sh', 'cmd', 'command', 'run_command',
|
|
430
|
+
'run_shell_command', 'run_terminal_command',
|
|
431
|
+
'read', 'read_file', 'view_file', 'write', 'write_file', 'write_to_file', 'edit', 'multiedit', 'replace',
|
|
432
|
+
'search_replace', 'apply_patch', 'grep', 'glob', 'ls', 'list_dir', 'list_directory', 'search_file_content',
|
|
433
|
+
'webfetch', 'web_fetch', 'websearch', 'web_search', 'google_web_search', 'notebookedit', 'notebookread',
|
|
434
|
+
'task', 'agent', 'subagent', 'todowrite', 'todo_write', 'update_plan', 'manage_task', 'taskcreate', 'taskupdate',
|
|
435
|
+
'tasklist', 'taskoutput', 'taskstop', 'bashoutput', 'killshell', 'job_output', 'job_kill', 'list_agents',
|
|
436
|
+
'send_message', 'get_command_or_subagent_output', 'skill', 'toolsearch', 'search_tool', 'use_tool',
|
|
437
|
+
'deferexecutetool', 'askuserquestion', 'ask_user_question', 'ask_question', 'exitplanmode', 'enterplanmode',
|
|
438
|
+
'present', 'present_files', 'senduserfile', 'read_image', 'view_image', 'show_widget', 'widget_guidelines',
|
|
438
439
|
]);
|
|
440
|
+
const GENERIC_SIGNAL_PREFIXES = ['mcp_', 'evolver_'];
|
|
441
|
+
function isGenericSignal(signal) {
|
|
442
|
+
return GENERIC_SIGNALS.has(signal) || GENERIC_SIGNAL_PREFIXES.some((prefix) => signal.startsWith(prefix));
|
|
443
|
+
}
|
|
439
444
|
function normalizeSignalSet(values) {
|
|
440
445
|
return new Set((values ?? []).map((value) => String(value).trim().toLowerCase()).filter(Boolean));
|
|
441
446
|
}
|
|
442
447
|
function noveltySignalSet(signals) {
|
|
443
|
-
const discriminating = [...signals].filter((signal) => !
|
|
448
|
+
const discriminating = [...signals].filter((signal) => !isGenericSignal(signal));
|
|
444
449
|
return discriminating.length > 0 ? new Set(discriminating) : signals;
|
|
445
450
|
}
|
|
446
451
|
/**
|
|
@@ -456,9 +461,13 @@ export function assessDraftAdmission(candidate, existing = [], opts = {}) {
|
|
|
456
461
|
const minStrategy = opts.minStrategy ?? 1;
|
|
457
462
|
const maxSimilarity = opts.maxSimilarity ?? 0.6;
|
|
458
463
|
const sigs = [...normalizeSignalSet(candidate.signals_match)];
|
|
464
|
+
const discriminating = sigs.filter((signal) => !isGenericSignal(signal));
|
|
459
465
|
const strategy = (candidate.strategy ?? []).filter((s) => String(s).trim());
|
|
460
|
-
if (sigs.length
|
|
461
|
-
return { admit: false, reason:
|
|
466
|
+
if (sigs.length > 0 && discriminating.length === 0)
|
|
467
|
+
return { admit: false, reason: 'no_discriminating_signal' };
|
|
468
|
+
if (discriminating.length < minSignals) {
|
|
469
|
+
return { admit: false, reason: `too few signals (${discriminating.length} discriminating < ${minSignals})` };
|
|
470
|
+
}
|
|
462
471
|
if (strategy.length < minStrategy)
|
|
463
472
|
return { admit: false, reason: `strategy too thin (${strategy.length} < ${minStrategy} steps)` };
|
|
464
473
|
const newSet = new Set(sigs);
|
package/dist/doctor.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type MemoryGraphOperatorStatus } from './localMemoryGraph.js';
|
|
2
|
+
import { type ProtectedAuditReadiness } from './protectedAuditStatus.js';
|
|
2
3
|
type DoctorStatus = 'pass' | 'warn' | 'fail';
|
|
3
4
|
export interface DoctorCheck {
|
|
4
5
|
name: string;
|
|
@@ -49,6 +50,8 @@ export interface DoctorDeps {
|
|
|
49
50
|
legacy: string[];
|
|
50
51
|
detail: string;
|
|
51
52
|
};
|
|
53
|
+
/** Test seam for the read-only protected audit service probe (POSIX only). */
|
|
54
|
+
protectedAudit?: () => ProtectedAuditReadiness;
|
|
52
55
|
}
|
|
53
56
|
export interface EnvCatalogResult {
|
|
54
57
|
profile: DoctorProfile;
|
package/dist/doctor.js
CHANGED
|
@@ -8,6 +8,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
10
|
import { LEGACY_TASK_SKIP_ENV, probeLegacyWindowsDaemonTasks } from './windowsLegacyTaskCleanup.js';
|
|
11
|
+
import { PROTECTED_AUDIT_INSTALL_GUIDE } from './protectedAuditStatus.js';
|
|
11
12
|
// Secrets that must live ONLY behind the EVOLVER_ENV_FILE pointer — never inlined into a runtime config (#217).
|
|
12
13
|
const SECRET_KEYS = [
|
|
13
14
|
'A2A_NODE_SECRET',
|
|
@@ -697,6 +698,7 @@ export function runDoctorChecks(deps = {}) {
|
|
|
697
698
|
catch {
|
|
698
699
|
checks.push({ name: 'memory-graph', status: 'warn', detail: 'state=degraded corrupt=1 oversized_lines=0 oversized_files=0 archives=0' });
|
|
699
700
|
}
|
|
701
|
+
checks.push(protectedAuditCheck(deps.platform ?? process.platform, deps.protectedAudit ?? events.protectedAuditReadiness));
|
|
700
702
|
// 5. windows-legacy-tasks (#956): read-only probe for legacy V1 scheduled-task residue
|
|
701
703
|
// (win32 only). A detected residue warns with the manual fix; an INCONCLUSIVE probe
|
|
702
704
|
// also warns — it must never be reported as a confirmed-negative pass.
|
|
@@ -722,6 +724,21 @@ export function runDoctorChecks(deps = {}) {
|
|
|
722
724
|
}
|
|
723
725
|
return checks;
|
|
724
726
|
}
|
|
727
|
+
function protectedAuditCheck(platform, probe) {
|
|
728
|
+
if (platform !== 'linux' && platform !== 'darwin') {
|
|
729
|
+
return { name: 'protected-audit', status: 'pass', detail: `not required on ${platform}; audit events use the local history` };
|
|
730
|
+
}
|
|
731
|
+
const readiness = probe();
|
|
732
|
+
if (readiness.state === 'ready')
|
|
733
|
+
return { name: 'protected-audit', status: 'pass', detail: 'protected audit service is installed and its socket is owned by the service account' };
|
|
734
|
+
if (readiness.state === 'not_required')
|
|
735
|
+
return { name: 'protected-audit', status: 'pass', detail: 'protected audit service is not required for this process' };
|
|
736
|
+
return {
|
|
737
|
+
name: 'protected-audit',
|
|
738
|
+
status: 'fail',
|
|
739
|
+
detail: `protected audit service unavailable (${readiness.reason}); inject, review and autoexec cannot record events until ${PROTECTED_AUDIT_INSTALL_GUIDE}`,
|
|
740
|
+
};
|
|
741
|
+
}
|
|
725
742
|
export function buildEnvCatalog(deps = {}) {
|
|
726
743
|
const env = deps.env ?? process.env;
|
|
727
744
|
const root = deps.configRoot ?? process.cwd();
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { assetstore } from '@evomap/evolver-core';
|
|
|
3
3
|
import { type ImportV1Options } from './migrate/v1Import.js';
|
|
4
4
|
import { type LifecyclePaths } from './lifecycle.js';
|
|
5
5
|
import { type NonGitWorkspaceNoticeOptions } from './nonGitWorkspaceNotice.js';
|
|
6
|
+
import { type ProtectedAuditSessionNoticeOptions } from './protectedAuditStatus.js';
|
|
6
7
|
import { type IngestDeps } from './sessionIngest.js';
|
|
7
8
|
export { runSessionIngestTick, scanSessionDirs, type IngestDeps, type SessionIngestTickResult, } from './sessionIngest.js';
|
|
8
9
|
export interface DistillDeps extends IngestDeps {
|
|
@@ -164,6 +165,8 @@ export interface InjectDeps {
|
|
|
164
165
|
legacyTaskSweep?: () => void;
|
|
165
166
|
/** Test seam for the non-git workspace notice. Production uses cwd + ~/.evomap throttle state. */
|
|
166
167
|
nonGitNotice?: NonGitWorkspaceNoticeOptions;
|
|
168
|
+
/** Test seam for the protected audit probe and its per-session notice state. */
|
|
169
|
+
protectedAuditNotice?: ProtectedAuditSessionNoticeOptions;
|
|
167
170
|
/** Resolving means bytes written, not host receipt or execution. */
|
|
168
171
|
stdout?: (text: string) => void | Promise<void>;
|
|
169
172
|
contextTimeoutMs?: number;
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,7 @@ import { runPromptRecallHook, wrapGeneContext } from './promptRecallHook.js';
|
|
|
26
26
|
import { deliverContextOutput, waitContextDelivery } from './contextDelivery.js';
|
|
27
27
|
import { withContextReadDiagnostics } from '@evomap/evolver-core/prompt-recall';
|
|
28
28
|
import { writeContextReadDiagnostic } from './promptRecallShared.js';
|
|
29
|
+
import { writeProtectedAuditSessionNotice, protectedAuditNoticeStatePath } from './protectedAuditStatus.js';
|
|
29
30
|
import { INGEST_CONSUMER_GROUP, recordSessionMaterial, resolveIngestDeps, toMaterialSourceAgent, } from './sessionIngest.js';
|
|
30
31
|
export { runSessionIngestTick, scanSessionDirs, } from './sessionIngest.js';
|
|
31
32
|
/** Minimal `--flag value` parser (last wins); bare positionals are ignored. */
|
|
@@ -1700,6 +1701,7 @@ async function runInjectOwned(argv, deps) {
|
|
|
1700
1701
|
...(deps.readHookInput ? { readHookInput: deps.readHookInput } : {}),
|
|
1701
1702
|
...(deps.stdout ? { stdout: deps.stdout } : {}),
|
|
1702
1703
|
...(deps.ingestor ? { ingestor: deps.ingestor } : {}),
|
|
1704
|
+
...(deps.protectedAuditNotice ? { protectedAuditNotice: deps.protectedAuditNotice } : {}),
|
|
1703
1705
|
});
|
|
1704
1706
|
}
|
|
1705
1707
|
if (sub !== 'session-start') {
|
|
@@ -1726,6 +1728,11 @@ async function runInjectOwned(argv, deps) {
|
|
|
1726
1728
|
// is written to stdout below — a worst-case sweep (probe + lock wait + cleanup ≈ 170s) must never
|
|
1727
1729
|
// delay the injection past the host SessionStart hook timeout (see the write-out point below).
|
|
1728
1730
|
maybeEmitNonGitWorkspaceNotice(deps.nonGitNotice);
|
|
1731
|
+
const auditReadiness = (deps.protectedAuditNotice?.readiness ?? events.protectedAuditReadiness)();
|
|
1732
|
+
if (auditReadiness.state === 'unavailable') {
|
|
1733
|
+
await writeProtectedAuditSessionNotice(deps.sessionId ?? await readHookSessionId(deps.readHookInput), auditReadiness, deps.protectedAuditNotice?.statePath ?? protectedAuditNoticeStatePath(events.evomapHome()), deps);
|
|
1734
|
+
return 0;
|
|
1735
|
+
}
|
|
1729
1736
|
}
|
|
1730
1737
|
const store = deps.store ?? new assetstore.LocalJsonlProvider(events.assetsDir());
|
|
1731
1738
|
try {
|
package/dist/lifecycle.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
2
|
import { bootstrap as coreBootstrap, util as coreUtil } from '@evomap/evolver-core';
|
|
3
|
+
import { type AutoexecCompanionOutcome } from './lifecycleAutoexecCompanion.js';
|
|
4
|
+
import { type ProtectedAuditInstallState, type ProtectedAuditReadiness } from './protectedAuditStatus.js';
|
|
3
5
|
import { type BootstrapTransactionJournal, type BootstrapArtifactIdentity, type LegacyBootstrapMarkerRead } from './lifecycleBootstrapTransaction.js';
|
|
4
6
|
import { type LegacyTaskCleanupResult, type LegacyTaskRun } from './windowsLegacyTaskCleanup.js';
|
|
5
7
|
export declare function selectExistingPosixCommand(candidates: readonly string[], exists?: (path: string) => boolean): string;
|
|
@@ -46,6 +48,9 @@ export interface LifecycleResult {
|
|
|
46
48
|
service?: string;
|
|
47
49
|
autoexecHome?: string;
|
|
48
50
|
actions?: string[];
|
|
51
|
+
autoexec?: AutoexecCompanionOutcome;
|
|
52
|
+
protected_audit?: ProtectedAuditInstallState;
|
|
53
|
+
protected_audit_next_step?: string;
|
|
49
54
|
/** Files whose absent pre-state is owned by a first-run bootstrap transaction. */
|
|
50
55
|
bootstrapArtifacts?: string[];
|
|
51
56
|
/** Expected bytes recorded before a first-run bootstrap mutates the filesystem. */
|
|
@@ -100,6 +105,8 @@ export interface BootstrapServiceDeps {
|
|
|
100
105
|
inspectSelfUpdate?: InspectDurableSelfUpdate;
|
|
101
106
|
/** Test seam for the post-activation legacy v1 Windows task sweep (#956). */
|
|
102
107
|
legacyTaskCleanupRun?: LegacyTaskRun;
|
|
108
|
+
/** Test seam for the read-only protected audit service probe. */
|
|
109
|
+
protectedAudit?: () => ProtectedAuditReadiness;
|
|
103
110
|
}
|
|
104
111
|
interface ServiceControlResult {
|
|
105
112
|
status: number | null;
|
|
@@ -107,6 +114,8 @@ interface ServiceControlResult {
|
|
|
107
114
|
stdout?: string;
|
|
108
115
|
}
|
|
109
116
|
interface InstallServiceOptions {
|
|
117
|
+
/** Bootstrap's transaction owns only the proxy manager; it installs the autoexec companion separately. */
|
|
118
|
+
proxyOnly?: boolean;
|
|
110
119
|
exclusive?: boolean;
|
|
111
120
|
transactionId?: string;
|
|
112
121
|
onArtifactPublished?: (path: string, claimPath: string) => void;
|