@evomap/evolver-cli 2.0.0-beta.2 → 2.0.0-beta.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/antiGeneBenchmark.js +2 -0
- package/dist/antiGeneRollout.js +9 -3
- package/dist/assetHealth.d.ts +6 -0
- package/dist/assetHealth.js +107 -0
- package/dist/assetRepair.d.ts +24 -0
- package/dist/assetRepair.js +172 -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 +231 -0
- package/dist/atp.d.ts +10 -5
- package/dist/atp.js +119 -26
- package/dist/atpAutoBuyer.d.ts +120 -0
- package/dist/atpAutoBuyer.js +814 -0
- package/dist/atpAutoDeliver.js +2 -2
- package/dist/autoDistillAntiGene.js +7 -5
- package/dist/autoDistillLlm.d.ts +26 -0
- package/dist/autoDistillLlm.js +119 -22
- package/dist/autoDistillTranscript.js +3 -2
- package/dist/autoexec.d.ts +111 -24
- package/dist/autoexec.js +887 -120
- package/dist/autoexecConfig.d.ts +10 -0
- package/dist/autoexecConfig.js +69 -0
- package/dist/cli.js +13 -0
- package/dist/cliContracts.d.ts +33 -2
- package/dist/cliContracts.js +818 -78
- package/dist/commandCatalog.d.ts +72 -0
- package/dist/commandCatalog.js +120 -0
- 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 +17 -2
- package/dist/cycleConsumer.js +374 -50
- package/dist/dashboard.d.ts +13 -1
- package/dist/dashboard.js +235 -18
- package/dist/dispatch.d.ts +9 -2
- package/dist/dispatch.js +29 -6
- package/dist/distillAdmission.d.ts +13 -0
- package/dist/distillAdmission.js +35 -0
- package/dist/distillObserver.js +27 -12
- package/dist/distillPrimitives.d.ts +11 -8
- package/dist/distillPrimitives.js +116 -22
- package/dist/doctor.d.ts +13 -0
- package/dist/doctor.js +177 -10
- package/dist/identityHome.d.ts +9 -0
- package/dist/identityHome.js +47 -0
- package/dist/index.d.ts +73 -40
- package/dist/index.js +745 -207
- package/dist/issueReport.d.ts +7 -0
- package/dist/issueReport.js +291 -0
- package/dist/learningTrace.d.ts +15 -0
- package/dist/learningTrace.js +73 -0
- package/dist/lifecycle.d.ts +199 -2
- package/dist/lifecycle.js +4999 -152
- package/dist/lifecycleBootstrapTransaction.d.ts +235 -0
- package/dist/lifecycleBootstrapTransaction.js +2182 -0
- package/dist/localMemoryGraph.d.ts +184 -0
- package/dist/localMemoryGraph.js +2689 -0
- package/dist/login.d.ts +1 -1
- package/dist/login.js +3 -3
- package/dist/materialPackage.js +3 -6
- package/dist/materialSnapshot.d.ts +35 -1
- package/dist/materialSnapshot.js +265 -18
- package/dist/memoryGraphOps.d.ts +8 -0
- package/dist/memoryGraphOps.js +140 -0
- package/dist/migrate/assetFormatMap.d.ts +61 -0
- package/dist/migrate/assetFormatMap.js +53 -0
- package/dist/migrate/envTranslate.d.ts +26 -0
- package/dist/migrate/envTranslate.js +147 -0
- package/dist/migrate/fieldMap.d.ts +7 -5
- package/dist/migrate/fieldMap.js +20 -14
- package/dist/migrate/oauthImport.d.ts +66 -0
- package/dist/migrate/oauthImport.js +667 -0
- package/dist/migrate/v1Import.d.ts +98 -1
- package/dist/migrate/v1Import.js +1532 -71
- package/dist/modelCompatibility.d.ts +10 -0
- package/dist/modelCompatibility.js +296 -0
- 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/recipe.d.ts +14 -2
- package/dist/recipe.js +543 -65
- package/dist/repairedAssetStore.d.ts +2 -0
- package/dist/repairedAssetStore.js +12 -0
- package/dist/requiredSandboxValidation.d.ts +5 -0
- package/dist/requiredSandboxValidation.js +4 -0
- package/dist/reuse.d.ts +18 -4
- package/dist/reuse.js +375 -107
- package/dist/reviewFilter.d.ts +3 -1
- package/dist/reviewFilter.js +3 -1
- package/dist/runtimeCapabilities.d.ts +18 -0
- package/dist/runtimeCapabilities.js +81 -0
- package/dist/runtimeSessionSource.d.ts +8 -2
- package/dist/runtimeSessionSource.js +63 -11
- package/dist/selectionPolicyConfig.d.ts +8 -0
- package/dist/selectionPolicyConfig.js +18 -0
- package/dist/semanticIdfConfig.d.ts +2 -0
- package/dist/semanticIdfConfig.js +4 -0
- package/dist/sessionIngest.d.ts +43 -0
- package/dist/sessionIngest.js +180 -0
- package/dist/setupHooks.d.ts +5 -0
- package/dist/setupHooks.js +330 -14
- package/dist/skill2gep.d.ts +13 -9
- package/dist/skill2gep.js +99 -36
- package/dist/skillDistill.d.ts +8 -4
- package/dist/skillDistill.js +39 -9
- package/dist/solo/mode.js +1 -0
- package/dist/sync.d.ts +13 -1
- package/dist/sync.js +1947 -265
- package/dist/thesis.d.ts +1 -1
- package/dist/thesis.js +20 -3
- package/dist/trajectoryExport.js +21 -3
- package/dist/v1Compat.d.ts +1 -0
- package/dist/v1Compat.js +9 -0
- package/dist/valueDigest.js +8 -1
- package/dist/windowsLegacyTaskCleanup.d.ts +228 -0
- package/dist/windowsLegacyTaskCleanup.js +1475 -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 +638 -0
- package/package.json +14 -7
package/dist/dashboard.js
CHANGED
|
@@ -1,8 +1,157 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
|
-
import {
|
|
2
|
+
import { lstatSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { assetstore, events, mailbox, ops, personality, workflow } from '@evomap/evolver-core';
|
|
3
5
|
import { loadPriceTable } from '@evomap/evolver-adapter-public';
|
|
4
|
-
import {
|
|
6
|
+
import { loadEnvFileFromEnv } from '@evomap/evolver-mcp';
|
|
7
|
+
import { createGithubPrDiagnosticsProvider, readLogDiagnostics, readPersonalityDiagnostics, WebUIServer, } from '@evomap/evolver-webui';
|
|
8
|
+
import { lifecyclePaths } from './lifecycle.js';
|
|
9
|
+
import { formatMemoryGraphOperatorStatus, loadMemoryGraphOperatorStatus } from './localMemoryGraph.js';
|
|
5
10
|
const USAGE = 'usage: evolver dashboard [--port N] [--no-open]\n';
|
|
11
|
+
class DashboardEnvFileUnavailableError extends Error {
|
|
12
|
+
constructor() {
|
|
13
|
+
super('dashboard_env_file_unavailable');
|
|
14
|
+
this.name = 'DashboardEnvFileUnavailableError';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function resolveDashboardEnv(env) {
|
|
18
|
+
const resolvedEnv = { ...env };
|
|
19
|
+
const envFile = loadEnvFileFromEnv(resolvedEnv);
|
|
20
|
+
if (envFile.error)
|
|
21
|
+
throw new DashboardEnvFileUnavailableError();
|
|
22
|
+
return resolvedEnv;
|
|
23
|
+
}
|
|
24
|
+
function dashboardStartupError(error) {
|
|
25
|
+
return error instanceof DashboardEnvFileUnavailableError
|
|
26
|
+
? 'dashboard_env_file_unavailable'
|
|
27
|
+
: 'dashboard_start_failed';
|
|
28
|
+
}
|
|
29
|
+
function record(value) {
|
|
30
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value) ? value : null;
|
|
31
|
+
}
|
|
32
|
+
function stringField(value) {
|
|
33
|
+
return typeof value === 'string' ? value : null;
|
|
34
|
+
}
|
|
35
|
+
function runSummary(value) {
|
|
36
|
+
const state = record(value);
|
|
37
|
+
if (!state)
|
|
38
|
+
return null;
|
|
39
|
+
const runId = stringField(state['runId']);
|
|
40
|
+
const workflowId = stringField(state['workflowId']);
|
|
41
|
+
const status = stringField(state['status']);
|
|
42
|
+
const createdAt = stringField(state['createdAt']);
|
|
43
|
+
const updatedAt = stringField(state['updatedAt']);
|
|
44
|
+
if (!runId || !workflowId || !status || !createdAt || !updatedAt)
|
|
45
|
+
return null;
|
|
46
|
+
const currentKey = stringField(state['currentStep']);
|
|
47
|
+
const steps = record(state['steps']);
|
|
48
|
+
const currentState = currentKey && steps ? record(steps[currentKey]) : null;
|
|
49
|
+
const currentStep = currentState && currentState['status'] !== 'succeeded'
|
|
50
|
+
? stringField(currentState['executionId']) ?? stringField(currentState['stepId']) ?? currentKey
|
|
51
|
+
: currentState ? null : currentKey;
|
|
52
|
+
return {
|
|
53
|
+
runId,
|
|
54
|
+
workflowId,
|
|
55
|
+
status,
|
|
56
|
+
currentStep,
|
|
57
|
+
createdAt,
|
|
58
|
+
updatedAt,
|
|
59
|
+
completedAt: stringField(state['completedAt']),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function historyRows(value) {
|
|
63
|
+
if (Array.isArray(value))
|
|
64
|
+
return value;
|
|
65
|
+
const envelope = record(value);
|
|
66
|
+
if (!envelope)
|
|
67
|
+
return [];
|
|
68
|
+
if (Array.isArray(envelope['history']))
|
|
69
|
+
return envelope['history'];
|
|
70
|
+
if (Array.isArray(envelope['entries']))
|
|
71
|
+
return envelope['entries'];
|
|
72
|
+
return [];
|
|
73
|
+
}
|
|
74
|
+
function historyEntry(value, index) {
|
|
75
|
+
const entry = record(value);
|
|
76
|
+
if (!entry)
|
|
77
|
+
return null;
|
|
78
|
+
const actor = record(entry['actor']);
|
|
79
|
+
const timestamp = stringField(entry['timestamp'])
|
|
80
|
+
?? stringField(entry['createdAt'])
|
|
81
|
+
?? stringField(entry['at'])
|
|
82
|
+
?? stringField(entry['ts']);
|
|
83
|
+
const type = stringField(entry['type'])
|
|
84
|
+
?? stringField(entry['event'])
|
|
85
|
+
?? stringField(entry['operation'])
|
|
86
|
+
?? stringField(entry['kind']);
|
|
87
|
+
if (!timestamp || !type)
|
|
88
|
+
return null;
|
|
89
|
+
const rawSequence = entry['sequence'] ?? entry['seq'];
|
|
90
|
+
const sequence = typeof rawSequence === 'number' && Number.isSafeInteger(rawSequence) && rawSequence >= 0
|
|
91
|
+
? rawSequence
|
|
92
|
+
: index;
|
|
93
|
+
const status = stringField(entry['status']);
|
|
94
|
+
const stepId = stringField(entry['stepId']);
|
|
95
|
+
const executionId = stringField(entry['executionId']);
|
|
96
|
+
const gateId = stringField(entry['gateId']);
|
|
97
|
+
const attempt = typeof entry['attempt'] === 'number' && Number.isSafeInteger(entry['attempt']) && entry['attempt'] >= 0
|
|
98
|
+
? entry['attempt']
|
|
99
|
+
: null;
|
|
100
|
+
const actorId = stringField(entry['actorId']) ?? stringField(entry['actor']) ?? stringField(actor?.['id']);
|
|
101
|
+
const errorClass = stringField(entry['errorClass']);
|
|
102
|
+
return {
|
|
103
|
+
sequence,
|
|
104
|
+
timestamp,
|
|
105
|
+
type,
|
|
106
|
+
...(status ? { status } : {}),
|
|
107
|
+
...(stepId ? { stepId } : {}),
|
|
108
|
+
...(executionId ? { executionId } : {}),
|
|
109
|
+
...(gateId ? { gateId } : {}),
|
|
110
|
+
...(attempt !== null ? { attempt } : {}),
|
|
111
|
+
...(actorId ? { actorId } : {}),
|
|
112
|
+
...(errorClass ? { errorClass } : {}),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function readDurableHistory(store, runId, state) {
|
|
116
|
+
const candidate = store;
|
|
117
|
+
const reader = candidate.readHistory ?? candidate.listHistory ?? candidate.history;
|
|
118
|
+
if (reader)
|
|
119
|
+
return historyRows(reader.call(store, runId));
|
|
120
|
+
return historyRows(record(state)?.['history']);
|
|
121
|
+
}
|
|
122
|
+
export function createWorkflowDashboardProvider(store) {
|
|
123
|
+
const read = (runId) => {
|
|
124
|
+
try {
|
|
125
|
+
return store.read(runId);
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
if (error instanceof workflow.WorkflowStateError && error.code === 'STATE_NOT_FOUND')
|
|
129
|
+
return null;
|
|
130
|
+
throw error;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
return {
|
|
134
|
+
listRuns: () => store.listRunIds()
|
|
135
|
+
.map((runId) => runSummary(read(runId)))
|
|
136
|
+
.filter((run) => run !== null)
|
|
137
|
+
.sort((a, b) => b.updatedAt.localeCompare(a.updatedAt) || a.runId.localeCompare(b.runId)),
|
|
138
|
+
getRun: (runId) => runSummary(read(runId)),
|
|
139
|
+
getHistory: (runId) => {
|
|
140
|
+
const state = read(runId);
|
|
141
|
+
if (state === null)
|
|
142
|
+
return null;
|
|
143
|
+
return readDurableHistory(store, runId, state)
|
|
144
|
+
.map(historyEntry)
|
|
145
|
+
.filter((entry) => entry !== null);
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
export function createDashboardWorkflowProvider(env = process.env, defaultStateDir = workflow.defaultWorkflowStateDir) {
|
|
150
|
+
const resolvedEnv = resolveDashboardEnv(env);
|
|
151
|
+
const configuredStateDir = resolvedEnv['EVOLVER_WORKFLOW_STATE_DIR']?.trim();
|
|
152
|
+
const stateDir = configuredStateDir || defaultStateDir();
|
|
153
|
+
return createWorkflowDashboardProvider(new workflow.WorkflowStateStore(stateDir));
|
|
154
|
+
}
|
|
6
155
|
function parsePort(raw) {
|
|
7
156
|
if (!/^\d+$/.test(raw))
|
|
8
157
|
return null;
|
|
@@ -43,21 +192,74 @@ function parseDashboardOptions(argv) {
|
|
|
43
192
|
}
|
|
44
193
|
return { ok: true, options };
|
|
45
194
|
}
|
|
46
|
-
function createDashboardServer() {
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const
|
|
195
|
+
export function createDashboardServer(memoryGraphStatus, env = process.env) {
|
|
196
|
+
const resolvedEnv = resolveDashboardEnv(env);
|
|
197
|
+
const eventsPath = events.rootEventsPath(resolvedEnv);
|
|
198
|
+
const tracesDir = events.tracesDir(resolvedEnv);
|
|
199
|
+
const store = new assetstore.LocalJsonlProvider(events.assetsDir(resolvedEnv));
|
|
50
200
|
const prices = loadPriceTable();
|
|
51
|
-
|
|
201
|
+
const personalityStore = new personality.PersonalityStore({
|
|
202
|
+
path: events.personalityStatePath(resolvedEnv),
|
|
203
|
+
});
|
|
204
|
+
const logFile = lifecyclePaths(resolvedEnv).logFile;
|
|
205
|
+
const githubPrDiagnostics = createGithubPrDiagnosticsProvider({ cwd: process.cwd() });
|
|
206
|
+
const mailboxStore = openDashboardMailbox(resolvedEnv);
|
|
207
|
+
const server = new WebUIServer({
|
|
52
208
|
eventsPath,
|
|
53
209
|
store,
|
|
210
|
+
...(mailboxStore ? { mailbox: mailboxStore } : {}),
|
|
54
211
|
valueSummary: (window, eventSnapshot) => ops.loadValueSummary({
|
|
55
212
|
traces: ops.readTraceRecords(tracesDir),
|
|
56
213
|
events: eventSnapshot,
|
|
57
214
|
prices,
|
|
58
215
|
}, window),
|
|
59
|
-
retentionReport: () => events.buildRetentionReport(
|
|
216
|
+
retentionReport: () => events.buildRetentionReport({
|
|
217
|
+
rootEventsPath: eventsPath,
|
|
218
|
+
materialStorePath: events.materialStorePath(resolvedEnv),
|
|
219
|
+
materialCursorPath: events.materialWatermarkPath(resolvedEnv),
|
|
220
|
+
}),
|
|
221
|
+
personalityDiagnostics: () => readPersonalityDiagnostics(() => personalityStore.load()),
|
|
222
|
+
logDiagnostics: () => readLogDiagnostics(logFile),
|
|
223
|
+
githubPrDiagnostics: () => githubPrDiagnostics.read(),
|
|
224
|
+
memoryGraphStatus,
|
|
225
|
+
workflow: createDashboardWorkflowProvider(resolvedEnv),
|
|
60
226
|
});
|
|
227
|
+
if (!mailboxStore)
|
|
228
|
+
return server;
|
|
229
|
+
let closed = false;
|
|
230
|
+
return {
|
|
231
|
+
token: server.token,
|
|
232
|
+
launchTicket: server.launchTicket,
|
|
233
|
+
listen: (port) => server.listen(port),
|
|
234
|
+
close: async () => {
|
|
235
|
+
if (closed)
|
|
236
|
+
return;
|
|
237
|
+
closed = true;
|
|
238
|
+
try {
|
|
239
|
+
await server.close();
|
|
240
|
+
}
|
|
241
|
+
catch (error) {
|
|
242
|
+
if (error.code !== 'ERR_SERVER_NOT_RUNNING')
|
|
243
|
+
throw error;
|
|
244
|
+
}
|
|
245
|
+
finally {
|
|
246
|
+
mailboxStore.close();
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
function openDashboardMailbox(env) {
|
|
252
|
+
const configured = env['EVOLVER_PROXY_STORE']?.trim();
|
|
253
|
+
const path = configured || join(events.evomapHome(env), 'proxy', 'mailbox.db');
|
|
254
|
+
try {
|
|
255
|
+
const stat = lstatSync(path);
|
|
256
|
+
if (!stat.isFile() || stat.isSymbolicLink())
|
|
257
|
+
return undefined;
|
|
258
|
+
return new mailbox.MailboxStore({ path });
|
|
259
|
+
}
|
|
260
|
+
catch {
|
|
261
|
+
return undefined;
|
|
262
|
+
}
|
|
61
263
|
}
|
|
62
264
|
export function dashboardOpenCommand(url, platform = process.platform) {
|
|
63
265
|
if (platform === 'win32')
|
|
@@ -127,20 +329,37 @@ export async function runDashboardCommand(argv, deps = {}, options = {}) {
|
|
|
127
329
|
return 0;
|
|
128
330
|
}
|
|
129
331
|
const createServer = deps.createServer ?? createDashboardServer;
|
|
332
|
+
let env;
|
|
333
|
+
try {
|
|
334
|
+
env = resolveDashboardEnv(deps.env ?? process.env);
|
|
335
|
+
}
|
|
336
|
+
catch (error) {
|
|
337
|
+
stderr(`dashboard: ${dashboardStartupError(error)}\n`);
|
|
338
|
+
return 1;
|
|
339
|
+
}
|
|
340
|
+
const memoryGraphStatus = deps.memoryGraphStatus ?? (() => loadMemoryGraphOperatorStatus(env));
|
|
130
341
|
const openUrl = deps.openUrl ?? openDashboardUrl;
|
|
131
342
|
const waitForShutdown = deps.waitForShutdown ?? waitForShutdownSignal;
|
|
132
343
|
let server;
|
|
133
344
|
try {
|
|
134
|
-
server = createServer();
|
|
345
|
+
server = createServer(memoryGraphStatus, env);
|
|
135
346
|
}
|
|
136
|
-
catch {
|
|
137
|
-
stderr(
|
|
347
|
+
catch (error) {
|
|
348
|
+
stderr(`dashboard: ${dashboardStartupError(error)}\n`);
|
|
138
349
|
return 1;
|
|
139
350
|
}
|
|
140
351
|
let listening = false;
|
|
141
352
|
try {
|
|
142
353
|
const port = await listenWithPortFallback(server, parsed.options.port, options.eaddrinusePortAttempts ?? 1);
|
|
143
354
|
listening = true;
|
|
355
|
+
let graphStatus;
|
|
356
|
+
try {
|
|
357
|
+
graphStatus = memoryGraphStatus();
|
|
358
|
+
}
|
|
359
|
+
catch {
|
|
360
|
+
graphStatus = { recovery: 'degraded', compactedRecords: 0, activeRecords: 0, corruptLines: 1, oversizedLines: 0, oversizedFiles: 0, archives: 0 };
|
|
361
|
+
}
|
|
362
|
+
stdout(`dashboard: memory-graph ${formatMemoryGraphOperatorStatus(graphStatus)}\n`);
|
|
144
363
|
const baseUrl = `http://127.0.0.1:${port}/`;
|
|
145
364
|
const launchUrl = `${baseUrl}launch?ticket=${encodeURIComponent(server.launchTicket)}`;
|
|
146
365
|
if (parsed.options.noOpen) {
|
|
@@ -161,13 +380,11 @@ export async function runDashboardCommand(argv, deps = {}, options = {}) {
|
|
|
161
380
|
return 1;
|
|
162
381
|
}
|
|
163
382
|
finally {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
// The process is already shutting down; avoid replacing the command result with a close race.
|
|
170
|
-
}
|
|
383
|
+
try {
|
|
384
|
+
await server.close();
|
|
385
|
+
}
|
|
386
|
+
catch {
|
|
387
|
+
// The command result takes precedence over a close race or an unbound HTTP server.
|
|
171
388
|
}
|
|
172
389
|
}
|
|
173
390
|
}
|
package/dist/dispatch.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
interface ProxyCliModule {
|
|
2
|
+
runProxyCli(options: {
|
|
3
|
+
argv: readonly string[];
|
|
4
|
+
}): Promise<number>;
|
|
5
|
+
}
|
|
6
|
+
type ProxyCliImporter = () => Promise<ProxyCliModule>;
|
|
7
|
+
export declare function runProxyCommand(argv: string[], importer?: ProxyCliImporter): Promise<number>;
|
|
1
8
|
export type CommandHandler = (argv: string[]) => Promise<number>;
|
|
2
|
-
/** Verbs dispatched asynchronously ahead of the synchronous runCli core. cli.ts drives its dispatch from this. */
|
|
3
9
|
export declare const ASYNC_COMMANDS: Readonly<Record<string, CommandHandler>>;
|
|
4
10
|
/** Verbs handled by the synchronous runCli core (read-only views + local ops). Kept in sync with runCli's switch
|
|
5
11
|
* — the source of truth for these stays runCli; this list completes the surface for the registry contract. */
|
|
@@ -8,4 +14,5 @@ export declare const SYNC_COMMANDS: readonly ["status", "cycles", "trigger", "va
|
|
|
8
14
|
export declare const ALL_COMMANDS: ReadonlySet<string>;
|
|
9
15
|
export declare function v1TopLevelRunArgs(argv: readonly string[]): readonly string[] | undefined;
|
|
10
16
|
/** Run a top-level argv against the registry: async handler if present, else the synchronous runCli core. */
|
|
11
|
-
export declare function dispatch(argv: readonly string[]): Promise<number> | number;
|
|
17
|
+
export declare function dispatch(argv: readonly string[]): Promise<number> | number;
|
|
18
|
+
export {};
|
package/dist/dispatch.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// this module holds the dispatch DATA so the surface is importable and assertable (see commandSurface.test.ts).
|
|
4
4
|
// The "phantom command" trap this guards against: an installer baking `evolver <verb>` into a user's runtime
|
|
5
5
|
// config for a verb the CLI never actually dispatches — a green build hides it, the user hits a usage error.
|
|
6
|
-
import { runCli, runMigrate, runAssetLog, runDistill, runIngest, runInject, runReview, } from './index.js';
|
|
6
|
+
import { runCli, runMigrate, runAssetLog, runDistill, runIngest, runInject, runReview, runDaily, } from './index.js';
|
|
7
7
|
import { runAutoExec } from './autoexec.js';
|
|
8
8
|
import { runAtpCommand, runBuyCommand, runOrdersCommand, runVerifyCommand } from './atp.js';
|
|
9
9
|
import { runLogin, runLogout } from './login.js';
|
|
@@ -17,6 +17,7 @@ import { runReuseCommand } from './reuse.js';
|
|
|
17
17
|
import { runPublishCommand } from './cliContracts.js';
|
|
18
18
|
import { runRecallCommand } from './recall.js';
|
|
19
19
|
import { runReuseReportCommand } from './reuseReport.js';
|
|
20
|
+
import { runRecallVerifyReportCommand } from './recallVerifyReport.js';
|
|
20
21
|
import { runDoctorCommand } from './doctor.js';
|
|
21
22
|
import { runPhubCommand } from './phub.js';
|
|
22
23
|
import { runTrajectoryExport } from './trajectoryExport.js';
|
|
@@ -28,15 +29,28 @@ import { runCycleCommand } from './cycleConsumer.js';
|
|
|
28
29
|
import { runProxyToken } from './proxyToken.js';
|
|
29
30
|
import { runMaterialCommand } from './materialPackage.js';
|
|
30
31
|
import { runDashboardCommand } from './dashboard.js';
|
|
31
|
-
import {
|
|
32
|
+
import { runIssueReportCommand } from './issueReport.js';
|
|
33
|
+
import { runAssetTrustCommand } from './assetTrust.js';
|
|
34
|
+
import { runAssetHealthCommand } from './assetHealth.js';
|
|
35
|
+
import { runAssetRepairCommand } from './assetRepair.js';
|
|
36
|
+
import { runV1FetchCompat, runV1RunCompat, runV1SolidifyCompat, runV1WebuiCompat, runV1ExecCompat } from './v1Compat.js';
|
|
37
|
+
import { runWorkflowCommand } from './workflow.js';
|
|
38
|
+
import { runMemoryGraphCommand } from './memoryGraphOps.js';
|
|
39
|
+
import { runModelCompatibilityReplay } from './modelCompatibility.js';
|
|
40
|
+
import { SYNC_COMMAND_NAMES } from './commandCatalog.js';
|
|
41
|
+
export async function runProxyCommand(argv, importer = () => import('@evomap/evolver-proxy/bin/evolver-proxy')) {
|
|
42
|
+
const { runProxyCli } = await importer();
|
|
43
|
+
return runProxyCli({ argv: ['proxy', ...argv] });
|
|
44
|
+
}
|
|
32
45
|
/** Verbs dispatched asynchronously ahead of the synchronous runCli core. cli.ts drives its dispatch from this. */
|
|
33
|
-
|
|
46
|
+
const ASYNC_COMMAND_TABLE = {
|
|
34
47
|
migrate: runMigrate,
|
|
35
48
|
'asset-log': runAssetLog,
|
|
36
49
|
distill: runDistill,
|
|
37
50
|
ingest: runIngest,
|
|
38
51
|
inject: runInject,
|
|
39
52
|
review: runReview,
|
|
53
|
+
daily: runDaily,
|
|
40
54
|
skill: runSkillCommand,
|
|
41
55
|
'skill-distill': runSkillDistill,
|
|
42
56
|
'skill-md-update': runSkillMdUpdate,
|
|
@@ -56,7 +70,9 @@ export const ASYNC_COMMANDS = {
|
|
|
56
70
|
sync: runSyncCommand,
|
|
57
71
|
recall: runRecallCommand,
|
|
58
72
|
'reuse-report': runReuseReportCommand,
|
|
73
|
+
'recall-verify-report': runRecallVerifyReportCommand,
|
|
59
74
|
doctor: runDoctorCommand,
|
|
75
|
+
'memory-graph': runMemoryGraphCommand,
|
|
60
76
|
phub: runPhubCommand,
|
|
61
77
|
lifecycle: runLifecycleCommand,
|
|
62
78
|
cycle: runCycleCommand,
|
|
@@ -65,16 +81,23 @@ export const ASYNC_COMMANDS = {
|
|
|
65
81
|
'anti-gene-benchmark': runAntiGeneBenchmarkCommand,
|
|
66
82
|
'anti-gene-rollout': runAntiGeneRolloutCommand,
|
|
67
83
|
dashboard: runDashboardCommand,
|
|
84
|
+
'issue-report': runIssueReportCommand,
|
|
85
|
+
'asset-trust': runAssetTrustCommand,
|
|
86
|
+
'asset-health': runAssetHealthCommand,
|
|
87
|
+
'asset-repair': runAssetRepairCommand,
|
|
88
|
+
proxy: runProxyCommand,
|
|
68
89
|
run: runV1RunCompat,
|
|
69
90
|
solidify: runV1SolidifyCompat,
|
|
70
91
|
fetch: runV1FetchCompat,
|
|
71
92
|
webui: runV1WebuiCompat,
|
|
93
|
+
exec: runV1ExecCompat,
|
|
94
|
+
workflow: runWorkflowCommand,
|
|
95
|
+
'model-compatibility-replay': runModelCompatibilityReplay,
|
|
72
96
|
};
|
|
97
|
+
export const ASYNC_COMMANDS = ASYNC_COMMAND_TABLE;
|
|
73
98
|
/** Verbs handled by the synchronous runCli core (read-only views + local ops). Kept in sync with runCli's switch
|
|
74
99
|
* — the source of truth for these stays runCli; this list completes the surface for the registry contract. */
|
|
75
|
-
export const SYNC_COMMANDS =
|
|
76
|
-
'status', 'cycles', 'trigger', 'value', 'narrative', 'retention', 'gene-value', 'replay', 'rebuild-views', 'reset-local-secret',
|
|
77
|
-
];
|
|
100
|
+
export const SYNC_COMMANDS = SYNC_COMMAND_NAMES;
|
|
78
101
|
/** Every top-level verb `evolver` resolves to (async-dispatched ∪ runCli core). */
|
|
79
102
|
export const ALL_COMMANDS = new Set([
|
|
80
103
|
...Object.keys(ASYNC_COMMANDS),
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type algo, type assetstore } from '@evomap/evolver-core';
|
|
2
|
+
import { type DraftAdmission, type DraftAdmissionOptions, type ExistingGeneSignals } from './distillPrimitives.js';
|
|
3
|
+
export interface StoreDraftAdmission {
|
|
4
|
+
admission: DraftAdmission;
|
|
5
|
+
existing: ExistingGeneSignals[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Build the complete dedupe context without loading the entire pool. Any subset or positive-Jaccard duplicate must
|
|
9
|
+
* share at least one candidate signal, so a store-side signalsAny query is complete for admission while excluding
|
|
10
|
+
* unrelated Genes. MAX_SAFE_INTEGER deliberately removes the provider's default result window; silently accepting
|
|
11
|
+
* a duplicate after row 1000 is worse than evaluating all signal-related rows in a mature pool.
|
|
12
|
+
*/
|
|
13
|
+
export declare function assessDraftAdmissionFromStore(store: Pick<assetstore.AssetStoreProvider, 'search'>, candidate: algo.GeneCandidate, additional?: readonly ExistingGeneSignals[], opts?: DraftAdmissionOptions): Promise<StoreDraftAdmission>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {} from '@evomap/evolver-core';
|
|
2
|
+
import { assessDraftAdmission, } from './distillPrimitives.js';
|
|
3
|
+
function normalizedCandidateSignals(candidate) {
|
|
4
|
+
return [...new Set((candidate.signals_match ?? [])
|
|
5
|
+
.map((signal) => String(signal).trim().toLowerCase())
|
|
6
|
+
.filter(Boolean))];
|
|
7
|
+
}
|
|
8
|
+
function geneSignalRef(record) {
|
|
9
|
+
if (record.type !== 'Gene')
|
|
10
|
+
return null;
|
|
11
|
+
return {
|
|
12
|
+
id: typeof record['id'] === 'string' ? String(record['id']) : undefined,
|
|
13
|
+
signals_match: Array.isArray(record['signals_match']) ? record['signals_match'] : [],
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Build the complete dedupe context without loading the entire pool. Any subset or positive-Jaccard duplicate must
|
|
18
|
+
* share at least one candidate signal, so a store-side signalsAny query is complete for admission while excluding
|
|
19
|
+
* unrelated Genes. MAX_SAFE_INTEGER deliberately removes the provider's default result window; silently accepting
|
|
20
|
+
* a duplicate after row 1000 is worse than evaluating all signal-related rows in a mature pool.
|
|
21
|
+
*/
|
|
22
|
+
export async function assessDraftAdmissionFromStore(store, candidate, additional = [], opts = {}) {
|
|
23
|
+
const intrinsic = assessDraftAdmission(candidate, [], opts);
|
|
24
|
+
if (!intrinsic.admit)
|
|
25
|
+
return { admission: intrinsic, existing: [...additional] };
|
|
26
|
+
const signalsAny = normalizedCandidateSignals(candidate);
|
|
27
|
+
const stored = signalsAny.length > 0
|
|
28
|
+
? await store.search({ kind: 'Gene', signalsAny, limit: Number.MAX_SAFE_INTEGER })
|
|
29
|
+
: [];
|
|
30
|
+
const existing = [
|
|
31
|
+
...stored.map(geneSignalRef).filter((ref) => ref !== null),
|
|
32
|
+
...additional,
|
|
33
|
+
];
|
|
34
|
+
return { admission: assessDraftAdmission(candidate, existing, opts), existing };
|
|
35
|
+
}
|
package/dist/distillObserver.js
CHANGED
|
@@ -5,13 +5,16 @@
|
|
|
5
5
|
// gene.distilled. It reuses the exact same `draftGeneCandidate` as `evolver ingest --distill`, so the one-shot and
|
|
6
6
|
// the auto path never drift.
|
|
7
7
|
//
|
|
8
|
-
// WIRING (#117 / #106):
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
8
|
+
// WIRING (#117 / #106): LIVE. `autoexec.ts` imports `resolveDistillObserver`, builds it inside
|
|
9
|
+
// `resolveDistillProducer`, registers it on the daemon's ObserverBus, drives `distill.tick()` every beat, and
|
|
10
|
+
// `kick()`s it on boot to drain any backlog left un-acked by a prior run. The `material.batch_ready` producer is
|
|
11
|
+
// the session-ingest tick on the same Ingestor. See distillObserver.test.ts for the isolated proof.
|
|
12
|
+
// (This said "not yet wired into autoexec" long after it was wired. A stale WIRING note is worse than none: it
|
|
13
|
+
// reads as a real gap, and a 2026-08 audit did misreport this composition as unwired on the strength of it.)
|
|
12
14
|
import { assetstore, events, observers, signals, algo } from '@evomap/evolver-core';
|
|
13
15
|
import { readFileSync } from 'node:fs';
|
|
14
|
-
import { draftGeneCandidate
|
|
16
|
+
import { draftGeneCandidate } from './distillPrimitives.js';
|
|
17
|
+
import { assessDraftAdmissionFromStore } from './distillAdmission.js';
|
|
15
18
|
import { reviewLedgerForStore } from './reviewFilter.js';
|
|
16
19
|
import { runtimeSessionSourcesForMaterial } from './materialSnapshot.js';
|
|
17
20
|
/** Consumer group the distill drain claims under — independent cursor from any other material consumer. */
|
|
@@ -46,16 +49,28 @@ export function makeDistillDrain(c) {
|
|
|
46
49
|
for (const source of sources) {
|
|
47
50
|
if (drafted >= draftLimit)
|
|
48
51
|
return { ack: false, drafted };
|
|
49
|
-
const
|
|
50
|
-
if (!
|
|
52
|
+
const draftedCandidate = draftGeneCandidate(source.turns, signals.extractSignals(source.turns), source.agent);
|
|
53
|
+
if (!draftedCandidate)
|
|
51
54
|
continue; // too thin to distill
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
// Carry producer-resolved task domain into draft signals_match so selection can score domain evidence.
|
|
56
|
+
// Only attach when the source already carries a resolved slug (fail-closed stamp at ingest).
|
|
57
|
+
let candidate = draftedCandidate;
|
|
58
|
+
if (source.taskDomain) {
|
|
59
|
+
try {
|
|
60
|
+
const domainToken = signals.taskDomainSignal(source.taskDomain);
|
|
61
|
+
const existingSignals = candidate.signals_match ?? [];
|
|
62
|
+
if (!existingSignals.includes(domainToken)) {
|
|
63
|
+
candidate = { ...candidate, signals_match: [...existingSignals, domainToken] };
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
// Invalid slug on the source — leave signals_match untouched (never invent).
|
|
68
|
+
}
|
|
69
|
+
}
|
|
56
70
|
// Value/novelty gate (#117 improvement 3): drop thin / near-duplicate drafts BEFORE they reach the human
|
|
57
71
|
// review queue. Ack the material (a deliberate skip, not a failure — nothing to retry).
|
|
58
|
-
|
|
72
|
+
const { admission, existing } = await assessDraftAdmissionFromStore(c.store, candidate);
|
|
73
|
+
if (!admission.admit)
|
|
59
74
|
continue;
|
|
60
75
|
const r = algo.intakeGene(candidate, existing);
|
|
61
76
|
if (!r.ok || !r.gene)
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { algo, type signals } from '@evomap/evolver-core';
|
|
2
2
|
import type { NormalizedTurn } from '@evomap/evolver-runtime-adapters';
|
|
3
|
-
/** Short matchable signal tokens from
|
|
4
|
-
* signal yields ≥1 token: if it has no toolName and matches no known error class (e.g. `FAILED: …` or
|
|
3
|
+
/** Short matchable signal tokens from STRONG signals (error classes) and SUCCESS signals (verified capabilities).
|
|
4
|
+
* Every strong signal yields ≥1 token: if it has no toolName and matches no known error class (e.g. `FAILED: …` or
|
|
5
5
|
* `Error: connection refused`), it falls back to its kind (`structured_error`/`error_result`) so a real strong
|
|
6
6
|
* signal is never silently tokenless — keeping `signals_match.length === 0` an honest "no strong signal" gate.
|
|
7
|
+
* Success signals (#578) also produce tokens so a purely successful session can yield a matchable gene.
|
|
7
8
|
* Deduped, ≤8. */
|
|
8
9
|
export declare function signalTokens(sigs: readonly signals.ExtractedSignal[]): string[];
|
|
9
10
|
/** Draft strategy steps = the agent's own substantive (non-meta) turns — boundary-trimmed (never chopped
|
|
@@ -30,7 +31,9 @@ export interface DraftAdmissionOptions {
|
|
|
30
31
|
/** Reject a draft with fewer strategy steps than this (default 1, i.e. just non-empty like intakeGene; raise it
|
|
31
32
|
* for a stricter substance floor). A real fix can be one concrete step, so the default does not over-filter. */
|
|
32
33
|
minStrategy?: number;
|
|
33
|
-
/** Reject a draft whose signal
|
|
34
|
+
/** Reject a draft whose discriminating-signal Jaccard similarity to ANY existing gene is >= this (default 0.6).
|
|
35
|
+
* Generated fallback markers and generic command runners are omitted from this SOFT comparison, while the
|
|
36
|
+
* exact-subset check still uses the complete signal sets. */
|
|
34
37
|
maxSimilarity?: number;
|
|
35
38
|
}
|
|
36
39
|
export interface DraftAdmission {
|
|
@@ -39,10 +42,10 @@ export interface DraftAdmission {
|
|
|
39
42
|
}
|
|
40
43
|
/**
|
|
41
44
|
* Value/novelty gate run BEFORE a draft is quarantined (#117 improvement 3). `intakeGene` already rejects
|
|
42
|
-
* empty/structurally-invalid candidates and EXACT signal subsets (fullyOverlaps)
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
45
|
+
* empty/structurally-invalid candidates and EXACT signal subsets (fullyOverlaps). Admission mirrors that subset
|
|
46
|
+
* check so a duplicate is a per-candidate skip instead of aborting a whole batch, then adds the two missing noise
|
|
47
|
+
* controls: a substance floor and a SOFT near-duplicate comparison. Unattended auto-distill turns that trickle
|
|
48
|
+
* into a flood, and a review gate nobody reads is no gate. Pure and deterministic; the caller decides what to do
|
|
49
|
+
* with a non-admit (skip, never an error).
|
|
47
50
|
*/
|
|
48
51
|
export declare function assessDraftAdmission(candidate: algo.GeneCandidate, existing?: readonly ExistingGeneSignals[], opts?: DraftAdmissionOptions): DraftAdmission;
|