@evomap/evolver-cli 2.0.0-beta.1 → 2.0.0-beta.4
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 +105 -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.js +4 -1
- package/dist/autoexec.d.ts +13 -3
- package/dist/autoexec.js +71 -13
- package/dist/cli.js +12 -5
- package/dist/cliContracts.js +8 -2
- 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 +23 -0
- package/dist/dashboard.js +191 -0
- package/dist/dispatch.d.ts +10 -1
- package/dist/dispatch.js +36 -2
- package/dist/distillObserver.js +2 -2
- package/dist/distillPrimitives.d.ts +1 -1
- package/dist/distillPrimitives.js +29 -2
- package/dist/doctor.d.ts +2 -0
- package/dist/doctor.js +33 -3
- package/dist/index.d.ts +7 -2
- package/dist/index.js +292 -36
- package/dist/lifecycle.d.ts +19 -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 +404 -0
- package/dist/materialSnapshot.d.ts +30 -0
- package/dist/materialSnapshot.js +148 -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 +10 -2
- package/dist/recipe.js +349 -7
- 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 +6 -1
- package/dist/setupHooks.js +5 -2
- 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 +26 -0
- package/dist/sync.js +988 -0
- package/dist/trajectoryExport.js +23 -12
- package/dist/v1Compat.d.ts +24 -0
- package/dist/v1Compat.js +249 -0
- package/package.json +12 -6
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type MemoryGraphOperatorStatus } from './localMemoryGraph.js';
|
|
2
|
+
export interface DashboardServer {
|
|
3
|
+
readonly token: string;
|
|
4
|
+
readonly launchTicket: string;
|
|
5
|
+
listen(port?: number): Promise<number>;
|
|
6
|
+
close(): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export interface DashboardDeps {
|
|
9
|
+
createServer?: (memoryGraphStatus: () => MemoryGraphOperatorStatus) => DashboardServer;
|
|
10
|
+
openUrl?: (url: string) => Promise<boolean>;
|
|
11
|
+
waitForShutdown?: () => Promise<void>;
|
|
12
|
+
stdout?: (text: string) => void;
|
|
13
|
+
stderr?: (text: string) => void;
|
|
14
|
+
memoryGraphStatus?: () => MemoryGraphOperatorStatus;
|
|
15
|
+
}
|
|
16
|
+
export interface DashboardCommandOptions {
|
|
17
|
+
eaddrinusePortAttempts?: number;
|
|
18
|
+
}
|
|
19
|
+
export declare function dashboardOpenCommand(url: string, platform?: NodeJS.Platform): {
|
|
20
|
+
command: string;
|
|
21
|
+
args: string[];
|
|
22
|
+
};
|
|
23
|
+
export declare function runDashboardCommand(argv: readonly string[], deps?: DashboardDeps, options?: DashboardCommandOptions): Promise<number>;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { assetstore, events, ops, personality } from '@evomap/evolver-core';
|
|
3
|
+
import { loadPriceTable } from '@evomap/evolver-adapter-public';
|
|
4
|
+
import { createGithubPrDiagnosticsProvider, readLogDiagnostics, readPersonalityDiagnostics, WebUIServer, } from '@evomap/evolver-webui';
|
|
5
|
+
import { lifecyclePaths } from './lifecycle.js';
|
|
6
|
+
import { formatMemoryGraphOperatorStatus, loadMemoryGraphOperatorStatus } from './localMemoryGraph.js';
|
|
7
|
+
const USAGE = 'usage: evolver dashboard [--port N] [--no-open]\n';
|
|
8
|
+
function parsePort(raw) {
|
|
9
|
+
if (!/^\d+$/.test(raw))
|
|
10
|
+
return null;
|
|
11
|
+
const port = Number(raw);
|
|
12
|
+
return Number.isSafeInteger(port) && port >= 0 && port <= 65_535 ? port : null;
|
|
13
|
+
}
|
|
14
|
+
function parseDashboardOptions(argv) {
|
|
15
|
+
const options = { help: false, noOpen: false, port: 0 };
|
|
16
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
17
|
+
const arg = argv[i] ?? '';
|
|
18
|
+
if (arg === '--help' || arg === '-h') {
|
|
19
|
+
options.help = true;
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
if (arg === '--no-open') {
|
|
23
|
+
options.noOpen = true;
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
if (arg === '--port') {
|
|
27
|
+
const raw = argv[i + 1];
|
|
28
|
+
if (raw === undefined || raw.startsWith('--'))
|
|
29
|
+
return { ok: false, error: 'missing_port' };
|
|
30
|
+
const port = parsePort(raw);
|
|
31
|
+
if (port === null)
|
|
32
|
+
return { ok: false, error: 'invalid_port' };
|
|
33
|
+
options.port = port;
|
|
34
|
+
i += 1;
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (arg.startsWith('--port=')) {
|
|
38
|
+
const port = parsePort(arg.slice('--port='.length));
|
|
39
|
+
if (port === null)
|
|
40
|
+
return { ok: false, error: 'invalid_port' };
|
|
41
|
+
options.port = port;
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
return { ok: false, error: 'unknown_argument' };
|
|
45
|
+
}
|
|
46
|
+
return { ok: true, options };
|
|
47
|
+
}
|
|
48
|
+
function createDashboardServer(memoryGraphStatus) {
|
|
49
|
+
const eventsPath = events.rootEventsPath();
|
|
50
|
+
const tracesDir = events.tracesDir();
|
|
51
|
+
const store = new assetstore.LocalJsonlProvider(events.assetsDir());
|
|
52
|
+
const prices = loadPriceTable();
|
|
53
|
+
const personalityStore = new personality.PersonalityStore();
|
|
54
|
+
const logFile = lifecyclePaths().logFile;
|
|
55
|
+
const githubPrDiagnostics = createGithubPrDiagnosticsProvider({ cwd: process.cwd() });
|
|
56
|
+
return new WebUIServer({
|
|
57
|
+
eventsPath,
|
|
58
|
+
store,
|
|
59
|
+
valueSummary: (window, eventSnapshot) => ops.loadValueSummary({
|
|
60
|
+
traces: ops.readTraceRecords(tracesDir),
|
|
61
|
+
events: eventSnapshot,
|
|
62
|
+
prices,
|
|
63
|
+
}, window),
|
|
64
|
+
retentionReport: () => events.buildRetentionReport(),
|
|
65
|
+
personalityDiagnostics: () => readPersonalityDiagnostics(() => personalityStore.load()),
|
|
66
|
+
logDiagnostics: () => readLogDiagnostics(logFile),
|
|
67
|
+
githubPrDiagnostics: () => githubPrDiagnostics.read(),
|
|
68
|
+
memoryGraphStatus,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
export function dashboardOpenCommand(url, platform = process.platform) {
|
|
72
|
+
if (platform === 'win32')
|
|
73
|
+
return { command: 'rundll32.exe', args: ['url.dll,FileProtocolHandler', url] };
|
|
74
|
+
if (platform === 'darwin')
|
|
75
|
+
return { command: 'open', args: [url] };
|
|
76
|
+
return { command: 'xdg-open', args: [url] };
|
|
77
|
+
}
|
|
78
|
+
async function openDashboardUrl(url) {
|
|
79
|
+
const command = dashboardOpenCommand(url);
|
|
80
|
+
return new Promise((resolve) => {
|
|
81
|
+
const child = spawn(command.command, command.args, {
|
|
82
|
+
detached: true,
|
|
83
|
+
shell: false,
|
|
84
|
+
stdio: 'ignore',
|
|
85
|
+
windowsHide: true,
|
|
86
|
+
});
|
|
87
|
+
child.once('error', () => resolve(false));
|
|
88
|
+
child.once('spawn', () => {
|
|
89
|
+
child.unref();
|
|
90
|
+
resolve(true);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function waitForShutdownSignal() {
|
|
95
|
+
return new Promise((resolve) => {
|
|
96
|
+
const finish = () => {
|
|
97
|
+
process.removeListener('SIGINT', finish);
|
|
98
|
+
process.removeListener('SIGTERM', finish);
|
|
99
|
+
resolve();
|
|
100
|
+
};
|
|
101
|
+
process.once('SIGINT', finish);
|
|
102
|
+
process.once('SIGTERM', finish);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function isAddressInUse(error) {
|
|
106
|
+
return typeof error === 'object'
|
|
107
|
+
&& error !== null
|
|
108
|
+
&& 'code' in error
|
|
109
|
+
&& error.code === 'EADDRINUSE';
|
|
110
|
+
}
|
|
111
|
+
async function listenWithPortFallback(server, requestedPort, maxAttempts) {
|
|
112
|
+
const attempts = requestedPort === 0
|
|
113
|
+
? 1
|
|
114
|
+
: Math.min(Math.max(1, maxAttempts), 65_536 - requestedPort);
|
|
115
|
+
for (let attempt = 0; attempt < attempts; attempt += 1) {
|
|
116
|
+
try {
|
|
117
|
+
return await server.listen(requestedPort + attempt);
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
if (!isAddressInUse(error) || attempt === attempts - 1)
|
|
121
|
+
throw error;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
throw new Error('dashboard_start_failed');
|
|
125
|
+
}
|
|
126
|
+
export async function runDashboardCommand(argv, deps = {}, options = {}) {
|
|
127
|
+
const stdout = deps.stdout ?? ((text) => { process.stdout.write(text); });
|
|
128
|
+
const stderr = deps.stderr ?? ((text) => { process.stderr.write(text); });
|
|
129
|
+
const parsed = parseDashboardOptions(argv);
|
|
130
|
+
if (!parsed.ok) {
|
|
131
|
+
stderr(`dashboard: ${parsed.error}\n${USAGE}`);
|
|
132
|
+
return 2;
|
|
133
|
+
}
|
|
134
|
+
if (parsed.options.help) {
|
|
135
|
+
stdout(USAGE);
|
|
136
|
+
return 0;
|
|
137
|
+
}
|
|
138
|
+
const createServer = deps.createServer ?? createDashboardServer;
|
|
139
|
+
const memoryGraphStatus = deps.memoryGraphStatus ?? loadMemoryGraphOperatorStatus;
|
|
140
|
+
const openUrl = deps.openUrl ?? openDashboardUrl;
|
|
141
|
+
const waitForShutdown = deps.waitForShutdown ?? waitForShutdownSignal;
|
|
142
|
+
let server;
|
|
143
|
+
try {
|
|
144
|
+
server = createServer(memoryGraphStatus);
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
stderr('dashboard: dashboard_start_failed\n');
|
|
148
|
+
return 1;
|
|
149
|
+
}
|
|
150
|
+
let listening = false;
|
|
151
|
+
try {
|
|
152
|
+
const port = await listenWithPortFallback(server, parsed.options.port, options.eaddrinusePortAttempts ?? 1);
|
|
153
|
+
listening = true;
|
|
154
|
+
let graphStatus;
|
|
155
|
+
try {
|
|
156
|
+
graphStatus = memoryGraphStatus();
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
graphStatus = { recovery: 'degraded', compactedRecords: 0, activeRecords: 0, corruptLines: 1, oversizedLines: 0, oversizedFiles: 0, archives: 0 };
|
|
160
|
+
}
|
|
161
|
+
stdout(`dashboard: memory-graph ${formatMemoryGraphOperatorStatus(graphStatus)}\n`);
|
|
162
|
+
const baseUrl = `http://127.0.0.1:${port}/`;
|
|
163
|
+
const launchUrl = `${baseUrl}launch?ticket=${encodeURIComponent(server.launchTicket)}`;
|
|
164
|
+
if (parsed.options.noOpen) {
|
|
165
|
+
stdout(`dashboard: ${launchUrl}\n`);
|
|
166
|
+
}
|
|
167
|
+
else if (await openUrl(launchUrl)) {
|
|
168
|
+
stdout(`dashboard: ${baseUrl}\n`);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
stderr('dashboard: browser_open_failed\n');
|
|
172
|
+
stdout(`dashboard: ${launchUrl}\n`);
|
|
173
|
+
}
|
|
174
|
+
await waitForShutdown();
|
|
175
|
+
return 0;
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
stderr(`dashboard: ${listening ? 'dashboard_runtime_failed' : 'dashboard_start_failed'}\n`);
|
|
179
|
+
return 1;
|
|
180
|
+
}
|
|
181
|
+
finally {
|
|
182
|
+
if (listening) {
|
|
183
|
+
try {
|
|
184
|
+
await server.close();
|
|
185
|
+
}
|
|
186
|
+
catch {
|
|
187
|
+
// The process is already shutting down; avoid replacing the command result with a close race.
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
package/dist/dispatch.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
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
9
|
/** Verbs dispatched asynchronously ahead of the synchronous runCli core. cli.ts drives its dispatch from this. */
|
|
3
10
|
export declare const ASYNC_COMMANDS: Readonly<Record<string, CommandHandler>>;
|
|
@@ -6,5 +13,7 @@ export declare const ASYNC_COMMANDS: Readonly<Record<string, CommandHandler>>;
|
|
|
6
13
|
export declare const SYNC_COMMANDS: readonly ["status", "cycles", "trigger", "value", "narrative", "retention", "gene-value", "replay", "rebuild-views", "reset-local-secret"];
|
|
7
14
|
/** Every top-level verb `evolver` resolves to (async-dispatched ∪ runCli core). */
|
|
8
15
|
export declare const ALL_COMMANDS: ReadonlySet<string>;
|
|
16
|
+
export declare function v1TopLevelRunArgs(argv: readonly string[]): readonly string[] | undefined;
|
|
9
17
|
/** Run a top-level argv against the registry: async handler if present, else the synchronous runCli core. */
|
|
10
|
-
export declare function dispatch(argv: readonly string[]): Promise<number> | number;
|
|
18
|
+
export declare function dispatch(argv: readonly string[]): Promise<number> | number;
|
|
19
|
+
export {};
|
package/dist/dispatch.js
CHANGED
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
import { runCli, runMigrate, runAssetLog, runDistill, runIngest, runInject, runReview, } from './index.js';
|
|
7
7
|
import { runAutoExec } from './autoexec.js';
|
|
8
8
|
import { runAtpCommand, runBuyCommand, runOrdersCommand, runVerifyCommand } from './atp.js';
|
|
9
|
-
import { runLogin } from './login.js';
|
|
9
|
+
import { runLogin, runLogout } from './login.js';
|
|
10
10
|
import { runSetupHooks } from './setupHooks.js';
|
|
11
11
|
import { runSkillDistill, runSkillMdUpdate } from './skillDistill.js';
|
|
12
|
+
import { runSkillCommand } from './skillFetch.js';
|
|
12
13
|
import { runThesisCommand } from './thesis.js';
|
|
13
14
|
import { getCliVersion } from './version.js';
|
|
14
15
|
import { runRecipeCommand } from './recipe.js';
|
|
@@ -19,10 +20,21 @@ import { runReuseReportCommand } from './reuseReport.js';
|
|
|
19
20
|
import { runDoctorCommand } from './doctor.js';
|
|
20
21
|
import { runPhubCommand } from './phub.js';
|
|
21
22
|
import { runTrajectoryExport } from './trajectoryExport.js';
|
|
23
|
+
import { runSyncCommand } from './sync.js';
|
|
22
24
|
import { runAntiGeneBenchmarkCommand } from './antiGeneBenchmark.js';
|
|
23
25
|
import { runAntiGeneRolloutCommand } from './antiGeneRollout.js';
|
|
24
26
|
import { runLifecycleCommand } from './lifecycle.js';
|
|
25
27
|
import { runCycleCommand } from './cycleConsumer.js';
|
|
28
|
+
import { runProxyToken } from './proxyToken.js';
|
|
29
|
+
import { runMaterialCommand } from './materialPackage.js';
|
|
30
|
+
import { runDashboardCommand } from './dashboard.js';
|
|
31
|
+
import { runAssetTrustCommand } from './assetTrust.js';
|
|
32
|
+
import { runAssetHealthCommand } from './assetHealth.js';
|
|
33
|
+
import { runV1FetchCompat, runV1RunCompat, runV1SolidifyCompat, runV1WebuiCompat } from './v1Compat.js';
|
|
34
|
+
export async function runProxyCommand(argv, importer = () => import('@evomap/evolver-proxy/bin/evolver-proxy')) {
|
|
35
|
+
const { runProxyCli } = await importer();
|
|
36
|
+
return runProxyCli({ argv: ['proxy', ...argv] });
|
|
37
|
+
}
|
|
26
38
|
/** Verbs dispatched asynchronously ahead of the synchronous runCli core. cli.ts drives its dispatch from this. */
|
|
27
39
|
export const ASYNC_COMMANDS = {
|
|
28
40
|
migrate: runMigrate,
|
|
@@ -31,11 +43,14 @@ export const ASYNC_COMMANDS = {
|
|
|
31
43
|
ingest: runIngest,
|
|
32
44
|
inject: runInject,
|
|
33
45
|
review: runReview,
|
|
46
|
+
skill: runSkillCommand,
|
|
34
47
|
'skill-distill': runSkillDistill,
|
|
35
48
|
'skill-md-update': runSkillMdUpdate,
|
|
36
49
|
thesis: runThesisCommand,
|
|
37
50
|
autoexec: runAutoExec,
|
|
38
51
|
login: runLogin,
|
|
52
|
+
logout: runLogout,
|
|
53
|
+
'proxy-token': runProxyToken,
|
|
39
54
|
'setup-hooks': runSetupHooks,
|
|
40
55
|
buy: runBuyCommand,
|
|
41
56
|
orders: runOrdersCommand,
|
|
@@ -44,15 +59,25 @@ export const ASYNC_COMMANDS = {
|
|
|
44
59
|
recipe: runRecipeCommand,
|
|
45
60
|
reuse: runReuseCommand,
|
|
46
61
|
publish: runPublishCommand,
|
|
62
|
+
sync: runSyncCommand,
|
|
47
63
|
recall: runRecallCommand,
|
|
48
64
|
'reuse-report': runReuseReportCommand,
|
|
49
65
|
doctor: runDoctorCommand,
|
|
50
66
|
phub: runPhubCommand,
|
|
51
67
|
lifecycle: runLifecycleCommand,
|
|
52
68
|
cycle: runCycleCommand,
|
|
69
|
+
material: runMaterialCommand,
|
|
53
70
|
'trajectory-export': runTrajectoryExport,
|
|
54
71
|
'anti-gene-benchmark': runAntiGeneBenchmarkCommand,
|
|
55
72
|
'anti-gene-rollout': runAntiGeneRolloutCommand,
|
|
73
|
+
dashboard: runDashboardCommand,
|
|
74
|
+
'asset-trust': runAssetTrustCommand,
|
|
75
|
+
'asset-health': runAssetHealthCommand,
|
|
76
|
+
proxy: runProxyCommand,
|
|
77
|
+
run: runV1RunCompat,
|
|
78
|
+
solidify: runV1SolidifyCompat,
|
|
79
|
+
fetch: runV1FetchCompat,
|
|
80
|
+
webui: runV1WebuiCompat,
|
|
56
81
|
};
|
|
57
82
|
/** Verbs handled by the synchronous runCli core (read-only views + local ops). Kept in sync with runCli's switch
|
|
58
83
|
* — the source of truth for these stays runCli; this list completes the surface for the registry contract. */
|
|
@@ -64,9 +89,18 @@ export const ALL_COMMANDS = new Set([
|
|
|
64
89
|
...Object.keys(ASYNC_COMMANDS),
|
|
65
90
|
...SYNC_COMMANDS,
|
|
66
91
|
]);
|
|
92
|
+
export function v1TopLevelRunArgs(argv) {
|
|
93
|
+
if (argv.length === 0)
|
|
94
|
+
return [];
|
|
95
|
+
const hasLoopMode = argv.includes('--loop') || argv.includes('--mad-dog');
|
|
96
|
+
return argv[0]?.startsWith('-') && hasLoopMode ? argv : undefined;
|
|
97
|
+
}
|
|
67
98
|
/** Run a top-level argv against the registry: async handler if present, else the synchronous runCli core. */
|
|
68
99
|
export function dispatch(argv) {
|
|
69
|
-
|
|
100
|
+
const topLevelRunArgs = v1TopLevelRunArgs(argv);
|
|
101
|
+
if (topLevelRunArgs)
|
|
102
|
+
return runV1RunCompat(topLevelRunArgs);
|
|
103
|
+
if (argv.length === 1 && (argv[0] === '--version' || argv[0] === '-v')) {
|
|
70
104
|
process.stdout.write(`${getCliVersion()}\n`);
|
|
71
105
|
return 0;
|
|
72
106
|
}
|
package/dist/distillObserver.js
CHANGED
|
@@ -13,7 +13,7 @@ import { assetstore, events, observers, signals, algo } from '@evomap/evolver-co
|
|
|
13
13
|
import { readFileSync } from 'node:fs';
|
|
14
14
|
import { draftGeneCandidate, assessDraftAdmission } from './distillPrimitives.js';
|
|
15
15
|
import { reviewLedgerForStore } from './reviewFilter.js';
|
|
16
|
-
import {
|
|
16
|
+
import { runtimeSessionSourcesForMaterial } from './materialSnapshot.js';
|
|
17
17
|
/** Consumer group the distill drain claims under — independent cursor from any other material consumer. */
|
|
18
18
|
export const DISTILL_CONSUMER_GROUP = 'distill';
|
|
19
19
|
/** Drafts created per tick — bound the auto-draft rate so an idle daemon does not flood the human review queue. */
|
|
@@ -37,7 +37,7 @@ export function makeDistillDrain(c) {
|
|
|
37
37
|
return { ack: true, drafted: 0 };
|
|
38
38
|
let sources;
|
|
39
39
|
try {
|
|
40
|
-
sources =
|
|
40
|
+
sources = runtimeSessionSourcesForMaterial(m, readSource);
|
|
41
41
|
}
|
|
42
42
|
catch {
|
|
43
43
|
return { ack: true, drafted: 0 }; // bad / missing / unparseable source — nothing to retry
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { algo, type signals } from '@evomap/evolver-core';
|
|
2
2
|
import type { NormalizedTurn } from '@evomap/evolver-runtime-adapters';
|
|
3
3
|
/** Short matchable signal tokens from the STRONG signals only (toolName + a known error class). Every strong
|
|
4
4
|
* signal yields ≥1 token: if it has no toolName and matches no known error class (e.g. `FAILED: …` or
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// Distill primitives (#117 A1) — the PURE session→gene-draft logic, extracted from runIngest so the one-shot
|
|
2
|
+
// `evolver ingest --distill` and the live distillObserver reuse ONE copy (no forked distill logic). Zero behavior
|
|
3
|
+
// change vs the inline version: same tokens, same step drafting, same candidate shape. No I/O — the caller parses
|
|
4
|
+
// the session into turns + extracts signals; this turns them into a draft GeneCandidate (or null when too thin).
|
|
5
|
+
import { algo } from '@evomap/evolver-core';
|
|
1
6
|
// Map a strong signal's free-text to a SHORT, matchable token (so a gene's signals_match stays a few
|
|
2
7
|
// keywords, not a dumped error blob). Deterministic + testable; unknown errors fall back to the tool name only.
|
|
3
8
|
const SIGNAL_ERROR_CLASSES = [
|
|
@@ -100,13 +105,35 @@ export function draftStrategy(turns) {
|
|
|
100
105
|
export function draftGeneCandidate(turns, sigs, agent) {
|
|
101
106
|
const signals_match = signalTokens(sigs);
|
|
102
107
|
const strategy = draftStrategy(turns);
|
|
103
|
-
if (signals_match.length === 0 || strategy.length === 0)
|
|
104
|
-
|
|
108
|
+
if (signals_match.length === 0 || strategy.length === 0) {
|
|
109
|
+
const hit = algo.sniffConversationCapabilities(turns)[0];
|
|
110
|
+
if (!hit)
|
|
111
|
+
return null;
|
|
112
|
+
const fallbackStrategy = hit.evidence;
|
|
113
|
+
if (fallbackStrategy.length === 0)
|
|
114
|
+
return null;
|
|
115
|
+
return {
|
|
116
|
+
category: 'innovate',
|
|
117
|
+
signals_match: hit.signals,
|
|
118
|
+
strategy: fallbackStrategy.slice(0, 6),
|
|
119
|
+
summary: `Auto-drafted verified capability from ${agent} session (UNPROVEN — curate via review): ${hit.summary}`,
|
|
120
|
+
preconditions: [
|
|
121
|
+
'A live agent conversation explicitly described a reusable capability.',
|
|
122
|
+
'The same conversation included validation or successful tool evidence.',
|
|
123
|
+
],
|
|
124
|
+
validation: ['node --version'],
|
|
125
|
+
generation_meta: { source: 'distilled' },
|
|
126
|
+
};
|
|
127
|
+
}
|
|
105
128
|
return {
|
|
106
129
|
category: 'repair',
|
|
107
130
|
signals_match,
|
|
108
131
|
strategy,
|
|
109
132
|
summary: `Auto-drafted from ${agent} session (UNPROVEN — curate via review): ${signals_match.slice(0, 3).join(', ')}`,
|
|
133
|
+
// A session-distilled gene has execution evidence (the session's turns) but no verified fail→pass-with-blast
|
|
134
|
+
// trajectory → `distilled` per V1 #302 classifyProvenance. Tagged so future governance/selection can grade it
|
|
135
|
+
// apart from evolved (solve→fail→mutate→pass) and manual (human-taught) genes.
|
|
136
|
+
generation_meta: { source: 'distilled' },
|
|
110
137
|
};
|
|
111
138
|
}
|
|
112
139
|
/**
|
package/dist/doctor.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type MemoryGraphOperatorStatus } from './localMemoryGraph.js';
|
|
1
2
|
type DoctorStatus = 'pass' | 'warn' | 'fail';
|
|
2
3
|
export interface DoctorCheck {
|
|
3
4
|
name: string;
|
|
@@ -36,6 +37,7 @@ export interface DoctorDeps {
|
|
|
36
37
|
statMode?: (p: string) => number | undefined;
|
|
37
38
|
profile?: DoctorProfile;
|
|
38
39
|
label?: string;
|
|
40
|
+
memoryGraphStatus?: (env: Record<string, string | undefined>) => MemoryGraphOperatorStatus;
|
|
39
41
|
}
|
|
40
42
|
export interface EnvCatalogResult {
|
|
41
43
|
profile: DoctorProfile;
|
package/dist/doctor.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { readFileSync, existsSync, statSync } from 'node:fs';
|
|
6
6
|
import { isAbsolute, join } from 'node:path';
|
|
7
7
|
import { expandHomePath, parseEnvFile } from '@evomap/evolver-mcp';
|
|
8
|
+
import { formatMemoryGraphOperatorStatus, loadMemoryGraphOperatorStatus } from './localMemoryGraph.js';
|
|
8
9
|
// Secrets that must live ONLY behind the EVOLVER_ENV_FILE pointer — never inlined into a runtime config (#217).
|
|
9
10
|
const SECRET_KEYS = [
|
|
10
11
|
'A2A_NODE_SECRET',
|
|
@@ -85,6 +86,13 @@ const ENV_CATALOG_DEFINITIONS = [
|
|
|
85
86
|
purpose: 'Hub base URL for public/private adapter connections.',
|
|
86
87
|
requiredFor: 'hub sync, PHub runtime, live smoke',
|
|
87
88
|
},
|
|
89
|
+
{
|
|
90
|
+
name: 'EVOLVER_DEFAULT_HUB_URL',
|
|
91
|
+
group: 'hub-runtime',
|
|
92
|
+
purpose: 'Deployment-time default Hub URL override used when A2A_HUB_URL and EVOMAP_HUB_URL are unset.',
|
|
93
|
+
requiredFor: 'release/deployment default Hub selection',
|
|
94
|
+
defaultValue: 'https://evomap.ai',
|
|
95
|
+
},
|
|
88
96
|
{
|
|
89
97
|
name: 'EVOMAP_PRIVATE_ADAPTER_MODULE',
|
|
90
98
|
group: 'hub-runtime',
|
|
@@ -425,6 +433,12 @@ const ENV_CATALOG_DEFINITIONS = [
|
|
|
425
433
|
purpose: 'Public key used to verify self-update artifacts.',
|
|
426
434
|
requiredFor: 'self-update verification',
|
|
427
435
|
},
|
|
436
|
+
{
|
|
437
|
+
name: 'EVOLVER_SELF_UPDATE_SUPERVISOR',
|
|
438
|
+
group: 'self-update',
|
|
439
|
+
purpose: 'Attests that a generated durable service launcher owns relaunch.',
|
|
440
|
+
requiredFor: 'automatic self-update',
|
|
441
|
+
},
|
|
428
442
|
{
|
|
429
443
|
name: 'EVOLVER_SELF_UPDATE_TARGET_PATH',
|
|
430
444
|
group: 'self-update',
|
|
@@ -561,6 +575,17 @@ export function runDoctorChecks(deps = {}) {
|
|
|
561
575
|
if (deps.profile === 'private-runtime') {
|
|
562
576
|
checks.push(...privateRuntimeChecks(env, envFileValues, envFileReadiness));
|
|
563
577
|
}
|
|
578
|
+
try {
|
|
579
|
+
const status = (deps.memoryGraphStatus ?? loadMemoryGraphOperatorStatus)(effectiveEnv);
|
|
580
|
+
checks.push({
|
|
581
|
+
name: 'memory-graph',
|
|
582
|
+
status: status.recovery === 'degraded' ? 'warn' : 'pass',
|
|
583
|
+
detail: formatMemoryGraphOperatorStatus(status),
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
catch {
|
|
587
|
+
checks.push({ name: 'memory-graph', status: 'warn', detail: 'state=degraded corrupt=1 oversized_lines=0 oversized_files=0 archives=0' });
|
|
588
|
+
}
|
|
564
589
|
return checks;
|
|
565
590
|
}
|
|
566
591
|
export function buildEnvCatalog(deps = {}) {
|
|
@@ -688,9 +713,9 @@ function privateRuntimeChecks(env, envFile, envFileReadiness) {
|
|
|
688
713
|
else {
|
|
689
714
|
checks.push({ name: 'phub-mode', status: 'fail', detail: `EVOMAP_HUB_MODE=${redact(mode)}; expected private for PHub runtime` });
|
|
690
715
|
}
|
|
691
|
-
const hubUrl =
|
|
716
|
+
const hubUrl = privateHubUrlValue(env, envFile);
|
|
692
717
|
if (!hubUrl) {
|
|
693
|
-
checks.push({ name: 'phub-url', status: 'fail', detail: '
|
|
718
|
+
checks.push({ name: 'phub-url', status: 'fail', detail: 'Hub URL is missing; set EVOMAP_HUB_URL in EVOLVER_ENV_FILE, or use A2A_HUB_URL / EVOLVER_DEFAULT_HUB_URL for explicit compatibility' });
|
|
694
719
|
}
|
|
695
720
|
else if (isProductionLikeHubUrl(hubUrl)) {
|
|
696
721
|
checks.push({ name: 'phub-url', status: 'warn', detail: `${redact(hubUrl)} does not look like a test-env URL; do not run live smoke against production PHub` });
|
|
@@ -771,7 +796,7 @@ function privateLiveSmokeCheck(env, envFile, essentials) {
|
|
|
771
796
|
if (essentials.mode !== 'private')
|
|
772
797
|
missing.push('EVOMAP_HUB_MODE=private');
|
|
773
798
|
if (!essentials.hubUrl)
|
|
774
|
-
missing.push('EVOMAP_HUB_URL');
|
|
799
|
+
missing.push('EVOMAP_HUB_URL|A2A_HUB_URL|EVOLVER_DEFAULT_HUB_URL');
|
|
775
800
|
if (essentials.tokenCount === 0)
|
|
776
801
|
missing.push(`one of ${PRIVATE_TOKEN_KEYS.join('|')}`);
|
|
777
802
|
if (missing.length > 0) {
|
|
@@ -827,6 +852,11 @@ function privateValue(env, envFile, key) {
|
|
|
827
852
|
const fromEnv = env[key]?.trim();
|
|
828
853
|
return fromEnv || undefined;
|
|
829
854
|
}
|
|
855
|
+
function privateHubUrlValue(env, envFile) {
|
|
856
|
+
return privateValue(env, envFile, 'EVOMAP_HUB_URL')
|
|
857
|
+
?? privateValue(env, envFile, 'A2A_HUB_URL')
|
|
858
|
+
?? privateValue(env, envFile, 'EVOLVER_DEFAULT_HUB_URL');
|
|
859
|
+
}
|
|
830
860
|
function isLoopbackProxyUrl(raw) {
|
|
831
861
|
try {
|
|
832
862
|
const url = new URL(raw);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { events, ops } from '@evomap/evolver-core';
|
|
2
2
|
import { assetstore, material as materialNs } from '@evomap/evolver-core';
|
|
3
|
+
import { type NonGitWorkspaceNoticeOptions } from './nonGitWorkspaceNotice.js';
|
|
3
4
|
/**
|
|
4
5
|
* Composition seam for ingest's substrate dependencies. The CLI is the composition layer that wires the
|
|
5
6
|
* MaterialStore (M1 raw-material substrate) + the watermark cursor (file-level re-ingest dedup) + the AE
|
|
@@ -16,6 +17,7 @@ export interface SessionIngestTickResult {
|
|
|
16
17
|
sourceAgents: string[];
|
|
17
18
|
signalKinds: string[];
|
|
18
19
|
signalStrengths: string[];
|
|
20
|
+
invalidJsonRows?: number;
|
|
19
21
|
}
|
|
20
22
|
export declare const PACKAGE = "@evomap/evolver-cli";
|
|
21
23
|
export interface RebuildOptions {
|
|
@@ -41,7 +43,7 @@ export declare function runResetLocalSecret(argv: readonly string[], opts?: Rese
|
|
|
41
43
|
export declare function rebuildViews(opts?: RebuildOptions): {
|
|
42
44
|
rebuilt: string[];
|
|
43
45
|
};
|
|
44
|
-
/** migrate import-v1 <v1dir> [outDir]
|
|
46
|
+
/** migrate import-v1 <v1dir> [outDir] --workspace <path>: v1→v2 read-only migration. */
|
|
45
47
|
export declare function runMigrate(argv: readonly string[]): Promise<number>;
|
|
46
48
|
/** One-line summary of an asset for `asset-log` (pure, testable). */
|
|
47
49
|
export declare function formatAssetLine(a: assetstore.AssetRecord): string;
|
|
@@ -111,7 +113,7 @@ export declare function promoteHint(v: assetstore.GeneLearningView): string;
|
|
|
111
113
|
* gene); `--approve`/`--reject <id>` is the audited human act that lifts an auto-distilled draft out of (or
|
|
112
114
|
* confirms it out of) quarantine. Approval is what lets a distilled gene's strategy be embedded into a real run
|
|
113
115
|
* (the gate lives in makeTrustedGeneResolver, #45+review). The id may be a logical id or an asset_id.
|
|
114
|
-
* Usage: evolver review [limit] | evolver review --approve <id> [reason…] | evolver review --reject <id> [reason…]
|
|
116
|
+
* Usage: evolver review [limit] | evolver review --approve <id> [--allow-weak-evidence] [reason…] | evolver review --reject <id> [reason…]
|
|
115
117
|
*/
|
|
116
118
|
export declare function runReview(argv: readonly string[], store?: assetstore.AssetStoreProvider, review?: assetstore.ReviewLedger, deps?: IngestDeps): Promise<number>;
|
|
117
119
|
/** Injection seam for `value` (#113): tests point these at temp paths / a fixed clock; defaults are the live home.
|
|
@@ -139,6 +141,7 @@ export interface RetentionDeps {
|
|
|
139
141
|
rootEventsPath?: string;
|
|
140
142
|
materialStorePath?: string;
|
|
141
143
|
materialCursorPath?: string;
|
|
144
|
+
materialCursorPaths?: readonly string[];
|
|
142
145
|
now?: () => number;
|
|
143
146
|
}
|
|
144
147
|
export declare function formatRetentionReport(report: events.RetentionReport): string;
|
|
@@ -172,6 +175,8 @@ export interface InjectDeps {
|
|
|
172
175
|
readHookInput?: () => string | undefined;
|
|
173
176
|
/** Test seam for the hook-time proxy daemon recovery path. Default is maybeAutoRestartProxyForSessionStart. */
|
|
174
177
|
ensureProxyAutostart?: () => Promise<void>;
|
|
178
|
+
/** Test seam for the non-git workspace notice. Production uses cwd + ~/.evomap throttle state. */
|
|
179
|
+
nonGitNotice?: NonGitWorkspaceNoticeOptions;
|
|
175
180
|
}
|
|
176
181
|
/**
|
|
177
182
|
* `evolver inject session-start`: the SessionStart hook entrypoint (the command every installer registers).
|