@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/login.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare function publicOAuthTokenPath(opts?: PublicAuthPathOptions): stri
|
|
|
18
18
|
*
|
|
19
19
|
* Hub URL follows A2A_HUB_URL -> EVOMAP_HUB_URL -> EVOLVER_DEFAULT_HUB_URL -> https://evomap.ai. Credential
|
|
20
20
|
* home follows the same public Hub precedence as publish/ATP:
|
|
21
|
-
*
|
|
21
|
+
* EVOMAP_HOME → EVOMAP_DIR → EVOLVER_HOME → ~/.evomap. The token replaces
|
|
22
22
|
* node_secret for publish + /a2a calls (it carries the `a2a` scope).
|
|
23
23
|
*/
|
|
24
24
|
export declare function runLogin(argv: readonly string[]): Promise<number>;
|
package/dist/login.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { existsSync, unlinkSync } from 'node:fs';
|
|
2
|
-
import { homedir } from 'node:os';
|
|
3
2
|
import { join } from 'node:path';
|
|
4
3
|
import { PublicOAuthProvider, createOAuthHttpTransport, resolveHubUrl } from '@evomap/evolver-adapter-public';
|
|
5
4
|
import { loadEnvFileFromEnv } from '@evomap/evolver-mcp';
|
|
5
|
+
import { resolveIdentityHome } from './identityHome.js';
|
|
6
6
|
const LOGIN_USAGE = 'usage: evolver login\n';
|
|
7
7
|
function publicAuthDir(opts = {}) {
|
|
8
8
|
const env = opts.env ?? process.env;
|
|
9
|
-
return env
|
|
9
|
+
return resolveIdentityHome(env, opts.homeDir);
|
|
10
10
|
}
|
|
11
11
|
export function publicOAuthTokenPath(opts = {}) {
|
|
12
12
|
return join(publicAuthDir(opts), 'token.json');
|
|
@@ -18,7 +18,7 @@ export function publicOAuthTokenPath(opts = {}) {
|
|
|
18
18
|
*
|
|
19
19
|
* Hub URL follows A2A_HUB_URL -> EVOMAP_HUB_URL -> EVOLVER_DEFAULT_HUB_URL -> https://evomap.ai. Credential
|
|
20
20
|
* home follows the same public Hub precedence as publish/ATP:
|
|
21
|
-
*
|
|
21
|
+
* EVOMAP_HOME → EVOMAP_DIR → EVOLVER_HOME → ~/.evomap. The token replaces
|
|
22
22
|
* node_secret for publish + /a2a calls (it carries the `a2a` scope).
|
|
23
23
|
*/
|
|
24
24
|
export async function runLogin(argv) {
|
package/dist/materialPackage.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
2
|
import { assetstore, algo, events, hub, material as materialNs, schema, signals } from '@evomap/evolver-core';
|
|
3
3
|
import { runtimeSessionSourcesForMaterial, runtimeSessionSourcesFromMaterialPayload } from './materialSnapshot.js';
|
|
4
|
-
import {
|
|
4
|
+
import { draftGeneCandidate } from './distillPrimitives.js';
|
|
5
|
+
import { assessDraftAdmissionFromStore } from './distillAdmission.js';
|
|
5
6
|
import { reviewLedgerForStore } from './reviewFilter.js';
|
|
6
7
|
import { buildPublishBundle } from './cliContracts.js';
|
|
7
8
|
const GROUP = 'material.package_gene';
|
|
@@ -165,10 +166,6 @@ async function draftGeneFromMaterial(material, store, readSource) {
|
|
|
165
166
|
}
|
|
166
167
|
if (sources.length === 0)
|
|
167
168
|
return { blocker: 'source_unavailable', message: 'material has no usable runtime session source', sourceCount: 0, signalCount: 0 };
|
|
168
|
-
const existing = (await store.list('Gene', 10_000)).map((g) => ({
|
|
169
|
-
id: typeof g['id'] === 'string' ? String(g['id']) : undefined,
|
|
170
|
-
signals_match: Array.isArray(g['signals_match']) ? g['signals_match'] : [],
|
|
171
|
-
}));
|
|
172
169
|
let signalCount = 0;
|
|
173
170
|
let sawCandidate = false;
|
|
174
171
|
let lastIntakeError = '';
|
|
@@ -188,7 +185,7 @@ async function draftGeneFromMaterial(material, store, readSource) {
|
|
|
188
185
|
if (alreadyStored?.type === 'Gene') {
|
|
189
186
|
return { gene: alreadyStored, sourceCount: sources.length, signalCount, stored: true };
|
|
190
187
|
}
|
|
191
|
-
const admission =
|
|
188
|
+
const { admission, existing } = await assessDraftAdmissionFromStore(store, candidate);
|
|
192
189
|
if (!admission.admit) {
|
|
193
190
|
lastIntakeError = admission.reason ?? 'gene draft admission rejected the candidate';
|
|
194
191
|
continue;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { schema } from '@evomap/evolver-core';
|
|
2
|
+
import { type RuntimeSessionEvidenceCoverage, type RuntimeSessionEvidenceCounts, type RuntimeSessionEvidenceGapCode, type RuntimeSessionEvidenceSummary } from '@evomap/evolver-runtime-adapters';
|
|
2
3
|
import { type RuntimeSessionSource } from './runtimeSessionSource.js';
|
|
3
4
|
export declare const MATERIAL_RUNTIME_SESSION_SNAPSHOT_SCHEMA = "evolver.material.runtime_session_snapshot.v1";
|
|
4
5
|
interface SnapshotTurn {
|
|
@@ -12,6 +13,10 @@ interface SnapshotSource {
|
|
|
12
13
|
agent: string;
|
|
13
14
|
label: string;
|
|
14
15
|
sessionId?: string;
|
|
16
|
+
resumeIdentityProvenance?: 'canonical_native_transcript';
|
|
17
|
+
/** Optional resolved task domain slug; omitted for old snapshots / unresolved sources. */
|
|
18
|
+
taskDomain?: string;
|
|
19
|
+
evidenceSummary: RuntimeSessionEvidenceSummary;
|
|
15
20
|
turns: SnapshotTurn[];
|
|
16
21
|
}
|
|
17
22
|
export interface RuntimeSessionMaterialSnapshotV1 {
|
|
@@ -19,12 +24,41 @@ export interface RuntimeSessionMaterialSnapshotV1 {
|
|
|
19
24
|
sourceKind: 'runtime_session';
|
|
20
25
|
kind: 'session_log';
|
|
21
26
|
sources: SnapshotSource[];
|
|
27
|
+
sourceCount: number;
|
|
28
|
+
omittedSourceCount: number;
|
|
29
|
+
omittedEvidenceAggregate?: RuntimeSessionEvidenceAggregate;
|
|
22
30
|
truncated: boolean;
|
|
23
31
|
maxChars: number;
|
|
24
32
|
}
|
|
33
|
+
export interface RuntimeSessionEvidenceSummarySource {
|
|
34
|
+
agent: string;
|
|
35
|
+
label: string;
|
|
36
|
+
sessionId?: string;
|
|
37
|
+
resumeIdentityProvenance?: 'canonical_native_transcript';
|
|
38
|
+
evidenceSummary: RuntimeSessionEvidenceSummary;
|
|
39
|
+
}
|
|
40
|
+
export interface RuntimeSessionEvidenceAggregate {
|
|
41
|
+
sourceCount: number;
|
|
42
|
+
coverageCounts: Record<RuntimeSessionEvidenceCoverage, number>;
|
|
43
|
+
counts: RuntimeSessionEvidenceCounts;
|
|
44
|
+
gapCodes: RuntimeSessionEvidenceGapCode[];
|
|
45
|
+
}
|
|
46
|
+
export interface RuntimeSessionEvidenceSummaryCollection {
|
|
47
|
+
sourceCount: number;
|
|
48
|
+
omittedSourceCount: number;
|
|
49
|
+
summaries: RuntimeSessionEvidenceSummarySource[];
|
|
50
|
+
omittedEvidenceAggregate?: RuntimeSessionEvidenceAggregate;
|
|
51
|
+
}
|
|
25
52
|
export declare function buildRuntimeSessionMaterialSnapshot(sources: readonly RuntimeSessionSource[], maxChars?: number): RuntimeSessionMaterialSnapshotV1;
|
|
26
53
|
export declare function runtimeSessionSourcesFromMaterialPayload(payload: unknown): RuntimeSessionSource[];
|
|
54
|
+
export declare function runtimeSessionEvidenceSummariesFromMaterialPayload(payload: unknown): RuntimeSessionEvidenceSummaryCollection | null;
|
|
27
55
|
export declare function materialHasRuntimeSessionSnapshot(material: schema.Material): boolean;
|
|
28
56
|
export declare function materialSourceAvailable(material: schema.Material): boolean;
|
|
29
|
-
export
|
|
57
|
+
export interface RuntimeSessionMaterialSources {
|
|
58
|
+
sources: RuntimeSessionSource[];
|
|
59
|
+
liveSources?: RuntimeSessionSource[];
|
|
60
|
+
sourceError?: unknown;
|
|
61
|
+
}
|
|
62
|
+
export declare function runtimeSessionSourcesForMaterialDetails(material: schema.Material, readSource?: (path: string) => string, nativeSessionHome?: string): RuntimeSessionMaterialSources;
|
|
63
|
+
export declare function runtimeSessionSourcesForMaterial(material: schema.Material, readSource?: (path: string) => string, nativeSessionHome?: string): RuntimeSessionSource[];
|
|
30
64
|
export {};
|
package/dist/materialSnapshot.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { hub, schema } from '@evomap/evolver-core';
|
|
3
|
+
import { summarizeSessionEvidence, } from '@evomap/evolver-runtime-adapters';
|
|
3
4
|
import { parseRuntimeSessionSources } from './runtimeSessionSource.js';
|
|
4
5
|
export const MATERIAL_RUNTIME_SESSION_SNAPSHOT_SCHEMA = 'evolver.material.runtime_session_snapshot.v1';
|
|
5
6
|
const DEFAULT_MATERIAL_SNAPSHOT_MAX_CHARS = 24 * 1024;
|
|
7
|
+
const SNAPSHOT_AGENT_MAX_CHARS = 64;
|
|
8
|
+
const SNAPSHOT_IDENTITY_MAX_CHARS = 256;
|
|
9
|
+
const SNAPSHOT_SOURCE_MAX_COUNT = 32;
|
|
10
|
+
const SNAPSHOT_TURN_MAX_COUNT = 256;
|
|
6
11
|
function isRecord(value) {
|
|
7
12
|
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
8
13
|
}
|
|
@@ -20,19 +25,169 @@ function snapshotTurnText(turn) {
|
|
|
20
25
|
function fitsInline(snapshot) {
|
|
21
26
|
return Buffer.byteLength(JSON.stringify(snapshot), 'utf8') <= schema.MATERIAL_PAYLOAD_INLINE_MAX_BYTES;
|
|
22
27
|
}
|
|
28
|
+
function snapshotIdentity(value, maxChars) {
|
|
29
|
+
return hub.redactString(value).replace(/\s+/g, ' ').trim().slice(0, maxChars);
|
|
30
|
+
}
|
|
31
|
+
function appendEvidenceAggregate(aggregate, summary) {
|
|
32
|
+
const coverageCounts = aggregate
|
|
33
|
+
? { ...aggregate.coverageCounts }
|
|
34
|
+
: { complete: 0, partial: 0, empty: 0 };
|
|
35
|
+
coverageCounts[summary.coverage] += 1;
|
|
36
|
+
const counts = {};
|
|
37
|
+
for (const key of EVIDENCE_COUNT_KEYS) {
|
|
38
|
+
counts[key] = (aggregate?.counts[key] ?? 0) + summary.counts[key];
|
|
39
|
+
}
|
|
40
|
+
const gapCodes = [];
|
|
41
|
+
if (coverageCounts.empty > 0)
|
|
42
|
+
gapCodes.push('empty_session');
|
|
43
|
+
if (counts.missingToolResults > 0)
|
|
44
|
+
gapCodes.push('missing_tool_result');
|
|
45
|
+
if (counts.unmatchedToolResults > 0)
|
|
46
|
+
gapCodes.push('unmatched_tool_result');
|
|
47
|
+
return {
|
|
48
|
+
sourceCount: (aggregate?.sourceCount ?? 0) + 1,
|
|
49
|
+
coverageCounts,
|
|
50
|
+
counts,
|
|
51
|
+
gapCodes,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const EVIDENCE_COUNT_KEYS = [
|
|
55
|
+
'nonMetaTurns',
|
|
56
|
+
'toolCalls',
|
|
57
|
+
'toolResults',
|
|
58
|
+
'matchedToolResults',
|
|
59
|
+
'missingToolResults',
|
|
60
|
+
'unmatchedToolResults',
|
|
61
|
+
'failedToolResults',
|
|
62
|
+
];
|
|
63
|
+
const EVIDENCE_GAP_CODES = new Set([
|
|
64
|
+
'empty_session',
|
|
65
|
+
'missing_tool_result',
|
|
66
|
+
'unmatched_tool_result',
|
|
67
|
+
]);
|
|
68
|
+
function evidenceSummaryFromSnapshot(value) {
|
|
69
|
+
if (!isRecord(value) || !isRecord(value['counts']) || !Array.isArray(value['gapCodes']))
|
|
70
|
+
return null;
|
|
71
|
+
const coverage = value['coverage'];
|
|
72
|
+
if (coverage !== 'complete' && coverage !== 'partial' && coverage !== 'empty')
|
|
73
|
+
return null;
|
|
74
|
+
const counts = {};
|
|
75
|
+
for (const key of EVIDENCE_COUNT_KEYS) {
|
|
76
|
+
const count = value['counts'][key];
|
|
77
|
+
if (!Number.isSafeInteger(count) || count < 0)
|
|
78
|
+
return null;
|
|
79
|
+
counts[key] = count;
|
|
80
|
+
}
|
|
81
|
+
const gapCodes = value['gapCodes'];
|
|
82
|
+
if (!gapCodes.every((gap) => (typeof gap === 'string' && EVIDENCE_GAP_CODES.has(gap))))
|
|
83
|
+
return null;
|
|
84
|
+
if (new Set(gapCodes).size !== gapCodes.length
|
|
85
|
+
|| counts.toolCalls + counts.toolResults > counts.nonMetaTurns
|
|
86
|
+
|| counts.matchedToolResults > counts.toolCalls
|
|
87
|
+
|| counts.matchedToolResults > counts.toolResults
|
|
88
|
+
|| counts.missingToolResults !== counts.toolCalls - counts.matchedToolResults
|
|
89
|
+
|| counts.unmatchedToolResults !== counts.toolResults - counts.matchedToolResults
|
|
90
|
+
|| counts.failedToolResults > counts.toolResults)
|
|
91
|
+
return null;
|
|
92
|
+
const expectedGaps = [];
|
|
93
|
+
if (counts.nonMetaTurns === 0)
|
|
94
|
+
expectedGaps.push('empty_session');
|
|
95
|
+
else {
|
|
96
|
+
if (counts.missingToolResults > 0)
|
|
97
|
+
expectedGaps.push('missing_tool_result');
|
|
98
|
+
if (counts.unmatchedToolResults > 0)
|
|
99
|
+
expectedGaps.push('unmatched_tool_result');
|
|
100
|
+
}
|
|
101
|
+
const expectedCoverage = counts.nonMetaTurns === 0
|
|
102
|
+
? 'empty'
|
|
103
|
+
: expectedGaps.length > 0 ? 'partial' : 'complete';
|
|
104
|
+
if (coverage !== expectedCoverage
|
|
105
|
+
|| gapCodes.length !== expectedGaps.length
|
|
106
|
+
|| gapCodes.some((gap, index) => gap !== expectedGaps[index]))
|
|
107
|
+
return null;
|
|
108
|
+
return { coverage, counts, gapCodes: [...gapCodes] };
|
|
109
|
+
}
|
|
110
|
+
function evidenceAggregateFromSnapshot(value) {
|
|
111
|
+
if (!isRecord(value)
|
|
112
|
+
|| !Number.isSafeInteger(value['sourceCount'])
|
|
113
|
+
|| value['sourceCount'] <= 0
|
|
114
|
+
|| !isRecord(value['coverageCounts'])
|
|
115
|
+
|| !isRecord(value['counts'])
|
|
116
|
+
|| !Array.isArray(value['gapCodes']))
|
|
117
|
+
return null;
|
|
118
|
+
const sourceCount = value['sourceCount'];
|
|
119
|
+
const coverageCounts = {};
|
|
120
|
+
for (const coverage of ['complete', 'partial', 'empty']) {
|
|
121
|
+
const count = value['coverageCounts'][coverage];
|
|
122
|
+
if (!Number.isSafeInteger(count) || count < 0)
|
|
123
|
+
return null;
|
|
124
|
+
coverageCounts[coverage] = count;
|
|
125
|
+
}
|
|
126
|
+
if (coverageCounts.complete + coverageCounts.partial + coverageCounts.empty !== sourceCount)
|
|
127
|
+
return null;
|
|
128
|
+
const counts = {};
|
|
129
|
+
for (const key of EVIDENCE_COUNT_KEYS) {
|
|
130
|
+
const count = value['counts'][key];
|
|
131
|
+
if (!Number.isSafeInteger(count) || count < 0)
|
|
132
|
+
return null;
|
|
133
|
+
counts[key] = count;
|
|
134
|
+
}
|
|
135
|
+
const gapCodes = value['gapCodes'];
|
|
136
|
+
if (!gapCodes.every((gap) => (typeof gap === 'string' && EVIDENCE_GAP_CODES.has(gap))) || new Set(gapCodes).size !== gapCodes.length
|
|
137
|
+
|| counts.toolCalls + counts.toolResults > counts.nonMetaTurns
|
|
138
|
+
|| counts.matchedToolResults > counts.toolCalls
|
|
139
|
+
|| counts.matchedToolResults > counts.toolResults
|
|
140
|
+
|| counts.missingToolResults !== counts.toolCalls - counts.matchedToolResults
|
|
141
|
+
|| counts.unmatchedToolResults !== counts.toolResults - counts.matchedToolResults
|
|
142
|
+
|| counts.failedToolResults > counts.toolResults)
|
|
143
|
+
return null;
|
|
144
|
+
const nonEmptySourceCount = coverageCounts.complete + coverageCounts.partial;
|
|
145
|
+
const structuralGapCount = counts.missingToolResults + counts.unmatchedToolResults;
|
|
146
|
+
if (counts.nonMetaTurns < nonEmptySourceCount
|
|
147
|
+
|| (coverageCounts.empty === sourceCount && counts.nonMetaTurns !== 0)
|
|
148
|
+
|| (coverageCounts.partial > 0) !== (structuralGapCount > 0)
|
|
149
|
+
|| structuralGapCount < coverageCounts.partial)
|
|
150
|
+
return null;
|
|
151
|
+
const expectedGaps = [];
|
|
152
|
+
if (coverageCounts.empty > 0)
|
|
153
|
+
expectedGaps.push('empty_session');
|
|
154
|
+
if (counts.missingToolResults > 0)
|
|
155
|
+
expectedGaps.push('missing_tool_result');
|
|
156
|
+
if (counts.unmatchedToolResults > 0)
|
|
157
|
+
expectedGaps.push('unmatched_tool_result');
|
|
158
|
+
if (gapCodes.length !== expectedGaps.length
|
|
159
|
+
|| gapCodes.some((gap, index) => gap !== expectedGaps[index]))
|
|
160
|
+
return null;
|
|
161
|
+
return { sourceCount, coverageCounts, counts, gapCodes: [...gapCodes] };
|
|
162
|
+
}
|
|
23
163
|
export function buildRuntimeSessionMaterialSnapshot(sources, maxChars = DEFAULT_MATERIAL_SNAPSHOT_MAX_CHARS) {
|
|
24
|
-
const safeMaxChars =
|
|
164
|
+
const safeMaxChars = Number.isFinite(maxChars)
|
|
165
|
+
? Math.max(0, Math.min(Math.trunc(maxChars), DEFAULT_MATERIAL_SNAPSHOT_MAX_CHARS))
|
|
166
|
+
: 0;
|
|
25
167
|
let remaining = safeMaxChars;
|
|
26
168
|
let truncated = false;
|
|
169
|
+
let retainedTurnCount = 0;
|
|
170
|
+
let omittedEvidenceAggregate;
|
|
27
171
|
const snapshotSources = [];
|
|
28
172
|
for (const source of sources) {
|
|
173
|
+
const evidenceSummary = summarizeSessionEvidence({ turns: source.turns });
|
|
174
|
+
if (snapshotSources.length >= SNAPSHOT_SOURCE_MAX_COUNT) {
|
|
175
|
+
omittedEvidenceAggregate = appendEvidenceAggregate(omittedEvidenceAggregate, evidenceSummary);
|
|
176
|
+
truncated = true;
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
29
179
|
const turns = [];
|
|
30
180
|
for (const turn of source.turns) {
|
|
181
|
+
if (retainedTurnCount >= SNAPSHOT_TURN_MAX_COUNT) {
|
|
182
|
+
truncated = true;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
31
185
|
const rawText = snapshotTurnText(turn);
|
|
32
186
|
const trimmed = trimText(rawText, remaining);
|
|
33
187
|
remaining -= trimmed.used;
|
|
34
188
|
truncated = truncated || trimmed.truncated;
|
|
35
189
|
if (trimmed.text.length > 0) {
|
|
190
|
+
retainedTurnCount += 1;
|
|
36
191
|
turns.push({
|
|
37
192
|
role: turn.role,
|
|
38
193
|
text: trimmed.text,
|
|
@@ -46,29 +201,46 @@ export function buildRuntimeSessionMaterialSnapshot(sources, maxChars = DEFAULT_
|
|
|
46
201
|
break;
|
|
47
202
|
}
|
|
48
203
|
}
|
|
204
|
+
const safeSessionId = source.sessionId
|
|
205
|
+
? snapshotIdentity(source.sessionId, SNAPSHOT_IDENTITY_MAX_CHARS)
|
|
206
|
+
: '';
|
|
207
|
+
const safeTaskDomain = source.taskDomain
|
|
208
|
+
? snapshotIdentity(source.taskDomain, SNAPSHOT_AGENT_MAX_CHARS)
|
|
209
|
+
: '';
|
|
49
210
|
snapshotSources.push({
|
|
50
|
-
agent: source.agent,
|
|
51
|
-
label: source.label,
|
|
52
|
-
...(
|
|
211
|
+
agent: snapshotIdentity(source.agent, SNAPSHOT_AGENT_MAX_CHARS) || 'unknown',
|
|
212
|
+
label: snapshotIdentity(source.label, SNAPSHOT_IDENTITY_MAX_CHARS) || 'unknown',
|
|
213
|
+
...(safeSessionId ? { sessionId: safeSessionId } : {}),
|
|
214
|
+
...(source.resumeIdentityProvenance ? { resumeIdentityProvenance: source.resumeIdentityProvenance } : {}),
|
|
215
|
+
...(safeTaskDomain ? { taskDomain: safeTaskDomain } : {}),
|
|
216
|
+
evidenceSummary,
|
|
53
217
|
turns,
|
|
54
218
|
});
|
|
55
|
-
if (remaining <= 0)
|
|
56
|
-
break;
|
|
57
219
|
}
|
|
58
220
|
const snapshot = {
|
|
59
221
|
schema: MATERIAL_RUNTIME_SESSION_SNAPSHOT_SCHEMA,
|
|
60
222
|
sourceKind: 'runtime_session',
|
|
61
223
|
kind: 'session_log',
|
|
62
224
|
sources: snapshotSources,
|
|
63
|
-
|
|
225
|
+
sourceCount: sources.length,
|
|
226
|
+
omittedSourceCount: omittedEvidenceAggregate?.sourceCount ?? 0,
|
|
227
|
+
...(omittedEvidenceAggregate ? { omittedEvidenceAggregate } : {}),
|
|
228
|
+
truncated: truncated || omittedEvidenceAggregate !== undefined,
|
|
64
229
|
maxChars: safeMaxChars,
|
|
65
230
|
};
|
|
231
|
+
// Source and turn caps make this loop constant-bounded even for very large Cursor databases.
|
|
66
232
|
while (!fitsInline(snapshot) && snapshot.sources.length > 0) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
233
|
+
let sourceWithTurns = snapshot.sources.length - 1;
|
|
234
|
+
while (sourceWithTurns >= 0 && snapshot.sources[sourceWithTurns]?.turns.length === 0) {
|
|
235
|
+
sourceWithTurns -= 1;
|
|
236
|
+
}
|
|
237
|
+
if (sourceWithTurns >= 0)
|
|
238
|
+
snapshot.sources[sourceWithTurns].turns.pop();
|
|
239
|
+
else {
|
|
240
|
+
const omitted = snapshot.sources.pop();
|
|
241
|
+
snapshot.omittedEvidenceAggregate = appendEvidenceAggregate(snapshot.omittedEvidenceAggregate, omitted.evidenceSummary);
|
|
242
|
+
snapshot.omittedSourceCount += 1;
|
|
243
|
+
}
|
|
72
244
|
snapshot.truncated = true;
|
|
73
245
|
}
|
|
74
246
|
return snapshot;
|
|
@@ -103,10 +275,18 @@ function sourceFromSnapshot(value) {
|
|
|
103
275
|
if (turns.length === 0)
|
|
104
276
|
return null;
|
|
105
277
|
const sessionId = typeof value['sessionId'] === 'string' && value['sessionId'].trim() ? value['sessionId'] : undefined;
|
|
278
|
+
const resumeIdentityProvenance = value['resumeIdentityProvenance'] === 'canonical_native_transcript'
|
|
279
|
+
? value['resumeIdentityProvenance']
|
|
280
|
+
: undefined;
|
|
281
|
+
const taskDomain = typeof value['taskDomain'] === 'string' && value['taskDomain'].trim()
|
|
282
|
+
? value['taskDomain'].trim()
|
|
283
|
+
: undefined;
|
|
106
284
|
return {
|
|
107
285
|
agent,
|
|
108
286
|
label,
|
|
109
287
|
...(sessionId ? { sessionId } : {}),
|
|
288
|
+
...(resumeIdentityProvenance ? { resumeIdentityProvenance } : {}),
|
|
289
|
+
...(taskDomain ? { taskDomain } : {}),
|
|
110
290
|
turns,
|
|
111
291
|
};
|
|
112
292
|
}
|
|
@@ -122,27 +302,94 @@ export function runtimeSessionSourcesFromMaterialPayload(payload) {
|
|
|
122
302
|
.map(sourceFromSnapshot)
|
|
123
303
|
.filter((source) => source !== null);
|
|
124
304
|
}
|
|
305
|
+
export function runtimeSessionEvidenceSummariesFromMaterialPayload(payload) {
|
|
306
|
+
if (!isRecord(payload))
|
|
307
|
+
return null;
|
|
308
|
+
if (payload['schema'] !== MATERIAL_RUNTIME_SESSION_SNAPSHOT_SCHEMA)
|
|
309
|
+
return null;
|
|
310
|
+
if (payload['sourceKind'] !== 'runtime_session' || payload['kind'] !== 'session_log')
|
|
311
|
+
return null;
|
|
312
|
+
const sources = Array.isArray(payload['sources']) ? payload['sources'] : [];
|
|
313
|
+
const hasCountMetadata = payload['sourceCount'] !== undefined || payload['omittedSourceCount'] !== undefined;
|
|
314
|
+
const sourceCount = hasCountMetadata ? payload['sourceCount'] : sources.length;
|
|
315
|
+
const omittedSourceCount = hasCountMetadata ? payload['omittedSourceCount'] : 0;
|
|
316
|
+
if (!Number.isSafeInteger(sourceCount)
|
|
317
|
+
|| sourceCount < sources.length
|
|
318
|
+
|| !Number.isSafeInteger(omittedSourceCount)
|
|
319
|
+
|| omittedSourceCount < 0
|
|
320
|
+
|| omittedSourceCount !== sourceCount - sources.length)
|
|
321
|
+
return null;
|
|
322
|
+
const omittedEvidenceAggregate = payload['omittedEvidenceAggregate'] === undefined
|
|
323
|
+
? undefined
|
|
324
|
+
: evidenceAggregateFromSnapshot(payload['omittedEvidenceAggregate']);
|
|
325
|
+
if (omittedSourceCount > 0) {
|
|
326
|
+
if (!omittedEvidenceAggregate || omittedEvidenceAggregate.sourceCount !== omittedSourceCount)
|
|
327
|
+
return null;
|
|
328
|
+
}
|
|
329
|
+
else if (payload['omittedEvidenceAggregate'] !== undefined)
|
|
330
|
+
return null;
|
|
331
|
+
const summaries = sources.flatMap((source) => {
|
|
332
|
+
if (!isRecord(source)
|
|
333
|
+
|| typeof source['agent'] !== 'string'
|
|
334
|
+
|| !source['agent'].trim()
|
|
335
|
+
|| typeof source['label'] !== 'string'
|
|
336
|
+
|| !source['label'].trim())
|
|
337
|
+
return [];
|
|
338
|
+
const summary = evidenceSummaryFromSnapshot(source['evidenceSummary']);
|
|
339
|
+
if (!summary)
|
|
340
|
+
return [];
|
|
341
|
+
const sessionId = typeof source['sessionId'] === 'string' && source['sessionId'].trim()
|
|
342
|
+
? source['sessionId']
|
|
343
|
+
: undefined;
|
|
344
|
+
const resumeIdentityProvenance = source['resumeIdentityProvenance'] === 'canonical_native_transcript'
|
|
345
|
+
? 'canonical_native_transcript'
|
|
346
|
+
: undefined;
|
|
347
|
+
return [{
|
|
348
|
+
agent: source['agent'],
|
|
349
|
+
label: source['label'],
|
|
350
|
+
...(sessionId ? { sessionId } : {}),
|
|
351
|
+
...(resumeIdentityProvenance ? { resumeIdentityProvenance } : {}),
|
|
352
|
+
evidenceSummary: summary,
|
|
353
|
+
}];
|
|
354
|
+
});
|
|
355
|
+
if (hasCountMetadata && summaries.length !== sources.length)
|
|
356
|
+
return null;
|
|
357
|
+
return {
|
|
358
|
+
sourceCount: sourceCount,
|
|
359
|
+
omittedSourceCount: omittedSourceCount,
|
|
360
|
+
summaries,
|
|
361
|
+
...(omittedEvidenceAggregate ? { omittedEvidenceAggregate } : {}),
|
|
362
|
+
};
|
|
363
|
+
}
|
|
125
364
|
export function materialHasRuntimeSessionSnapshot(material) {
|
|
126
365
|
return runtimeSessionSourcesFromMaterialPayload(material.payload).length > 0;
|
|
127
366
|
}
|
|
128
367
|
export function materialSourceAvailable(material) {
|
|
129
368
|
return existsSync(material.sourcePath);
|
|
130
369
|
}
|
|
131
|
-
export function
|
|
370
|
+
export function runtimeSessionSourcesForMaterialDetails(material, readSource, nativeSessionHome) {
|
|
132
371
|
let sourceError;
|
|
133
372
|
try {
|
|
134
|
-
const
|
|
135
|
-
const sourcesWithTurns =
|
|
373
|
+
const liveSources = parseRuntimeSessionSources(material.sourcePath, readSource, nativeSessionHome);
|
|
374
|
+
const sourcesWithTurns = liveSources.filter((source) => source.turns.length > 0);
|
|
136
375
|
if (sourcesWithTurns.length > 0)
|
|
137
|
-
return sourcesWithTurns;
|
|
376
|
+
return { sources: sourcesWithTurns, liveSources };
|
|
377
|
+
const snapshotSources = runtimeSessionSourcesFromMaterialPayload(material.payload);
|
|
378
|
+
return {
|
|
379
|
+
sources: snapshotSources,
|
|
380
|
+
liveSources,
|
|
381
|
+
};
|
|
138
382
|
}
|
|
139
383
|
catch (error) {
|
|
140
384
|
sourceError = error;
|
|
141
385
|
}
|
|
142
386
|
const snapshotSources = runtimeSessionSourcesFromMaterialPayload(material.payload);
|
|
143
387
|
if (snapshotSources.length > 0)
|
|
144
|
-
return snapshotSources;
|
|
388
|
+
return { sources: snapshotSources, sourceError };
|
|
145
389
|
if (sourceError)
|
|
146
390
|
throw sourceError;
|
|
147
|
-
return [];
|
|
391
|
+
return { sources: [] };
|
|
392
|
+
}
|
|
393
|
+
export function runtimeSessionSourcesForMaterial(material, readSource, nativeSessionHome) {
|
|
394
|
+
return runtimeSessionSourcesForMaterialDetails(material, readSource, nativeSessionHome).sources;
|
|
148
395
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LocalMemoryGraph } from './localMemoryGraph.js';
|
|
2
|
+
export interface MemoryGraphOpsDeps {
|
|
3
|
+
env?: Record<string, string | undefined>;
|
|
4
|
+
stdout?: (text: string) => void;
|
|
5
|
+
stderr?: (text: string) => void;
|
|
6
|
+
createGraph?: (dir: string) => LocalMemoryGraph;
|
|
7
|
+
}
|
|
8
|
+
export declare function runMemoryGraphCommand(argv: readonly string[], deps?: MemoryGraphOpsDeps): Promise<number>;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operator maintenance CLI for local MemoryGraph (Refs #674).
|
|
3
|
+
*/
|
|
4
|
+
import { events } from '@evomap/evolver-core';
|
|
5
|
+
import { loadEnvFileFromEnv } from '@evomap/evolver-mcp';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
import { LocalMemoryGraph, formatMemoryGraphOperatorStatus, loadMemoryGraphOperatorStatus, resolveLocalMemoryUserIdentity, } from './localMemoryGraph.js';
|
|
8
|
+
const USAGE = [
|
|
9
|
+
'Usage:',
|
|
10
|
+
' evolver memory-graph status [--json]',
|
|
11
|
+
' evolver memory-graph maintain [--json] # recovery or threshold rotation + compaction',
|
|
12
|
+
' evolver memory-graph prune [--json] # enforce rotated-archive retention',
|
|
13
|
+
' evolver memory-graph recover [--json] # rebuild compact from retained current-epoch state',
|
|
14
|
+
' evolver memory-graph reset --yes [--json] # copy a backup, then advance the local epoch',
|
|
15
|
+
'',
|
|
16
|
+
'Graph dir: $EVOLVER_HOME/evolution, then $EVOMAP_HOME/evolution, then ~/.evomap/evolution.',
|
|
17
|
+
'Destructive reset requires --yes. Predictive cross-epoch weighting remains deferred (#670).',
|
|
18
|
+
'',
|
|
19
|
+
].join('\n');
|
|
20
|
+
function writeJson(write, value) {
|
|
21
|
+
write(`${JSON.stringify(value)}\n`);
|
|
22
|
+
}
|
|
23
|
+
function graphFor(env, deps) {
|
|
24
|
+
const home = events.evomapHome(env);
|
|
25
|
+
if (!home.trim())
|
|
26
|
+
throw new Error('memory_graph_home_rejected');
|
|
27
|
+
const dir = join(home, 'evolution');
|
|
28
|
+
if (deps.createGraph)
|
|
29
|
+
return deps.createGraph(dir);
|
|
30
|
+
return new LocalMemoryGraph({ dir, ...resolveLocalMemoryUserIdentity(dir) });
|
|
31
|
+
}
|
|
32
|
+
function renderMaintain(report, stdout) {
|
|
33
|
+
stdout([
|
|
34
|
+
`rotated=${report.rotated ? 1 : 0}`,
|
|
35
|
+
`compacted=${report.compactedRecords}`,
|
|
36
|
+
`corrupt=${report.corruptLines}`,
|
|
37
|
+
`oversized_lines=${report.oversizedLines}`,
|
|
38
|
+
`archives=${report.archives}`,
|
|
39
|
+
`recovery=${report.recovery}`,
|
|
40
|
+
].join(' ') + '\n');
|
|
41
|
+
}
|
|
42
|
+
function renderReset(report, stdout) {
|
|
43
|
+
renderMaintain(report, stdout);
|
|
44
|
+
stdout(`backup_id=${report.backupId ?? 'none'} backup_files=${report.backupFiles} epoch_id=${report.epochId ?? 'unchanged'}\n`);
|
|
45
|
+
}
|
|
46
|
+
function writeFailure(command, reason, json, stdout, stderr, usage = false) {
|
|
47
|
+
if (json)
|
|
48
|
+
writeJson(stdout, { ok: false, command, reason });
|
|
49
|
+
else
|
|
50
|
+
stderr(`[memory-graph] ${reason}\n${usage ? USAGE : ''}`);
|
|
51
|
+
return reason === 'unknown_argument' || reason === 'confirmation_required' ? 2 : 1;
|
|
52
|
+
}
|
|
53
|
+
function writeMaintenance(command, report, json, stdout) {
|
|
54
|
+
const ok = report.recovery !== 'degraded';
|
|
55
|
+
if (json)
|
|
56
|
+
writeJson(stdout, { ok, command, report });
|
|
57
|
+
else
|
|
58
|
+
renderMaintain(report, stdout);
|
|
59
|
+
return ok ? 0 : 1;
|
|
60
|
+
}
|
|
61
|
+
function operationFailureReason(error) {
|
|
62
|
+
const message = error instanceof Error ? error.message : '';
|
|
63
|
+
return new Set([
|
|
64
|
+
'memory_graph_busy',
|
|
65
|
+
'memory_graph_dir_rejected',
|
|
66
|
+
'memory_graph_epoch_rejected',
|
|
67
|
+
'memory_graph_home_rejected',
|
|
68
|
+
'memory_graph_append_rollback_failed',
|
|
69
|
+
'memory_graph_path_rejected',
|
|
70
|
+
'memory_graph_rotation_backup_failed',
|
|
71
|
+
'memory_graph_rotation_journal_rejected',
|
|
72
|
+
'memory_graph_rotation_recovery_failed',
|
|
73
|
+
'memory_graph_reset_backup_failed',
|
|
74
|
+
'memory_graph_reset_failed',
|
|
75
|
+
'memory_graph_write_failed',
|
|
76
|
+
]).has(message) ? message : 'memory_graph_operation_failed';
|
|
77
|
+
}
|
|
78
|
+
export async function runMemoryGraphCommand(argv, deps = {}) {
|
|
79
|
+
const stdout = deps.stdout ?? ((text) => { process.stdout.write(text); });
|
|
80
|
+
const stderr = deps.stderr ?? ((text) => { process.stderr.write(text); });
|
|
81
|
+
if (argv.length === 0 || argv.includes('--help') || argv.includes('-h')) {
|
|
82
|
+
stdout(USAGE);
|
|
83
|
+
return argv.length === 0 ? 1 : 0;
|
|
84
|
+
}
|
|
85
|
+
const sub = argv[0] ?? '';
|
|
86
|
+
const rest = argv.slice(1);
|
|
87
|
+
const json = rest.includes('--json') || argv.includes('--json');
|
|
88
|
+
const known = new Set(['status', 'maintain', 'prune', 'recover', 'reset']);
|
|
89
|
+
if (!known.has(sub)) {
|
|
90
|
+
if (json)
|
|
91
|
+
writeJson(stdout, { ok: false, command: sub, reason: 'unknown_subcommand' });
|
|
92
|
+
else
|
|
93
|
+
stderr(`unknown memory-graph subcommand: ${sub}\n${USAGE}`);
|
|
94
|
+
return 1;
|
|
95
|
+
}
|
|
96
|
+
const allowed = new Set(sub === 'reset' ? ['--json', '--yes'] : ['--json']);
|
|
97
|
+
if (rest.some((arg) => !allowed.has(arg))) {
|
|
98
|
+
return writeFailure(sub, 'unknown_argument', json, stdout, stderr, true);
|
|
99
|
+
}
|
|
100
|
+
if (sub === 'reset' && !rest.includes('--yes')) {
|
|
101
|
+
return writeFailure(sub, 'confirmation_required', json, stdout, stderr, true);
|
|
102
|
+
}
|
|
103
|
+
const env = { ...(deps.env ?? process.env) };
|
|
104
|
+
const envFile = loadEnvFileFromEnv(env);
|
|
105
|
+
if (envFile.error)
|
|
106
|
+
return writeFailure(sub, 'env_file_unavailable', json, stdout, stderr);
|
|
107
|
+
if (!events.evomapHome(env).trim()) {
|
|
108
|
+
return writeFailure(sub, 'memory_graph_home_rejected', json, stdout, stderr);
|
|
109
|
+
}
|
|
110
|
+
if (sub === 'status') {
|
|
111
|
+
const status = loadMemoryGraphOperatorStatus(env);
|
|
112
|
+
const ok = status.recovery !== 'degraded' && status.busy !== true;
|
|
113
|
+
if (json)
|
|
114
|
+
writeJson(stdout, { ok, command: 'status', status });
|
|
115
|
+
else
|
|
116
|
+
stdout(`${formatMemoryGraphOperatorStatus(status)}\n`);
|
|
117
|
+
return ok ? 0 : 1;
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
const graph = graphFor(env, deps);
|
|
121
|
+
if (sub === 'maintain')
|
|
122
|
+
return writeMaintenance(sub, graph.maintain(), json, stdout);
|
|
123
|
+
if (sub === 'prune')
|
|
124
|
+
return writeMaintenance(sub, graph.prune(), json, stdout);
|
|
125
|
+
if (sub === 'recover')
|
|
126
|
+
return writeMaintenance(sub, graph.recoverFromArchives(), json, stdout);
|
|
127
|
+
const report = graph.resetGraph();
|
|
128
|
+
if (report.lockReleaseWarning) {
|
|
129
|
+
stderr(`[memory-graph] reset completed; lock release incomplete: ${report.lockReleaseWarning}\n`);
|
|
130
|
+
}
|
|
131
|
+
if (json)
|
|
132
|
+
writeJson(stdout, { ok: true, command: 'reset', report });
|
|
133
|
+
else
|
|
134
|
+
renderReset(report, stdout);
|
|
135
|
+
return 0;
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
return writeFailure(sub, operationFailureReason(error), json, stdout, stderr);
|
|
139
|
+
}
|
|
140
|
+
}
|