@openclawbrain/cli 0.4.32 → 0.4.33
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/src/cli.js
CHANGED
|
@@ -4774,13 +4774,13 @@ function resolveServeTimeLearningRuntimeInput(activationRoot, normalizedEventExp
|
|
|
4774
4774
|
: readHistoricalServeTimeDecisions(logPath, collectServeTimeDecisionRecoveryTargets(normalizedEventExport));
|
|
4775
4775
|
const serveTimeDecisions = mergeHistoricalServeTimeDecisions(historicalRecovery.decisions, boundedServeTimeDecisions);
|
|
4776
4776
|
const decisionLogCount = serveTimeDecisions.length;
|
|
4777
|
-
const pgVersion =
|
|
4777
|
+
const pgVersion = "v2";
|
|
4778
4778
|
const resolvedFallbackReason = combineServeTimeLearningFallbackReasons(fallbackReason, historicalRecovery.scanFailed ? "historical_recovery_scan_failed" : null);
|
|
4779
4779
|
return {
|
|
4780
4780
|
pgVersion,
|
|
4781
4781
|
serveTimeDecisions,
|
|
4782
4782
|
decisionLogCount,
|
|
4783
|
-
baselineState:
|
|
4783
|
+
baselineState: loadOrInitBaseline(activationRoot),
|
|
4784
4784
|
fallbackReason: resolvedFallbackReason === null ? null : `serve_time_decision_log_${resolvedFallbackReason}`
|
|
4785
4785
|
};
|
|
4786
4786
|
}
|
|
@@ -384,11 +384,15 @@ function buildCoverageSnapshot({ attachedSetLine, runtimeLoadProofSnapshot, open
|
|
|
384
384
|
profiles
|
|
385
385
|
};
|
|
386
386
|
}
|
|
387
|
-
function buildHardeningSnapshot({ attachTruthLine, serveLine, routeFnLine, surfaceLine, verdict, statusSignals }) {
|
|
387
|
+
function buildHardeningSnapshot({ attachTruthLine, serveLine, routeFnLine, surfaceLine, brainLine, routeLine, learningLine, learningPathLine, verdict, statusSignals }) {
|
|
388
388
|
const attachTruth = extractKeyValuePairs(attachTruthLine);
|
|
389
389
|
const serve = extractKeyValuePairs(serveLine);
|
|
390
390
|
const routeFn = extractKeyValuePairs(routeFnLine);
|
|
391
391
|
const surface = extractKeyValuePairs(surfaceLine);
|
|
392
|
+
const brain = extractKeyValuePairs(brainLine);
|
|
393
|
+
const route = extractKeyValuePairs(routeLine);
|
|
394
|
+
const learning = extractKeyValuePairs(learningLine);
|
|
395
|
+
const learningPath = extractKeyValuePairs(learningPathLine);
|
|
392
396
|
return {
|
|
393
397
|
contract: "openclaw_operator_hardening_snapshot.v1",
|
|
394
398
|
generatedAt: new Date().toISOString(),
|
|
@@ -427,6 +431,27 @@ function buildHardeningSnapshot({ attachTruthLine, serveLine, routeFnLine, surfa
|
|
|
427
431
|
available: routeFn.available ?? null,
|
|
428
432
|
freshness: routeFn.freshness ?? null,
|
|
429
433
|
},
|
|
434
|
+
routeLayer: {
|
|
435
|
+
activePackId: brain.pack ?? null,
|
|
436
|
+
routerIdentity: brain.router ?? route.router ?? null,
|
|
437
|
+
routeFreshness: brain.routeFreshness ?? null,
|
|
438
|
+
routeFingerprint: route.freshness ?? null,
|
|
439
|
+
lastPromotionAt: brain.lastPromotion ?? null,
|
|
440
|
+
brainState: brain.state ?? null,
|
|
441
|
+
initMode: brain.init ?? null,
|
|
442
|
+
serveState: serve.state ?? null,
|
|
443
|
+
usedLearnedRouteFn: serve.usedRouteFn ?? null,
|
|
444
|
+
routeFnAvailable: routeFn.available ?? null,
|
|
445
|
+
routeFnFreshness: routeFn.freshness ?? null,
|
|
446
|
+
learningState: learning.state ?? null,
|
|
447
|
+
learningMode: learning.mode ?? null,
|
|
448
|
+
learningPathSource: learningPath.source ?? null,
|
|
449
|
+
learningPathPg: learningPath.pg ?? null,
|
|
450
|
+
learningPathMethod: learningPath.method ?? null,
|
|
451
|
+
learningPathTarget: learningPath.target ?? null,
|
|
452
|
+
learningPathConnect: learningPath.connect ?? null,
|
|
453
|
+
learningPathTrajectories: learningPath.trajectories ?? null,
|
|
454
|
+
},
|
|
430
455
|
verdict: {
|
|
431
456
|
verdict: verdict.verdict,
|
|
432
457
|
severity: verdict.severity,
|
|
@@ -576,7 +601,7 @@ function buildVerdict({ steps, gatewayStatus, pluginInspect, statusSignals, brea
|
|
|
576
601
|
};
|
|
577
602
|
}
|
|
578
603
|
|
|
579
|
-
function buildSummary({ options, steps, verdict, gatewayStatusText, pluginInspectText, statusSignals, breadcrumbs, runtimeLoadProofSnapshot, surfaceLine, surfacesLine, surfaceNoteLine, hotfixLine, guardLine, feedbackLine, attributionLine, attributionCoverageLine, learningPathLine, learningFlowLine, learningHealthLine, coverageSnapshot, hardeningSnapshot }) {
|
|
604
|
+
function buildSummary({ options, steps, verdict, gatewayStatusText, pluginInspectText, statusSignals, breadcrumbs, runtimeLoadProofSnapshot, surfaceLine, surfacesLine, surfaceNoteLine, hotfixLine, guardLine, brainLine, routeLine, learningLine, feedbackLine, attributionLine, attributionCoverageLine, learningPathLine, learningFlowLine, learningHealthLine, coverageSnapshot, hardeningSnapshot }) {
|
|
580
605
|
const passed = [];
|
|
581
606
|
const missing = [];
|
|
582
607
|
const warnings = Array.isArray(verdict.warnings) ? verdict.warnings : [];
|
|
@@ -660,6 +685,21 @@ function buildSummary({ options, steps, verdict, gatewayStatusText, pluginInspec
|
|
|
660
685
|
? ["- runtime guard line not reported by detailed status"]
|
|
661
686
|
: [`- ${guardLine}`]),
|
|
662
687
|
"",
|
|
688
|
+
"## Route Layer Truth",
|
|
689
|
+
...(brainLine === null
|
|
690
|
+
? ["- brain line not reported by detailed status"]
|
|
691
|
+
: [`- ${brainLine}`]),
|
|
692
|
+
...(routeLine === null
|
|
693
|
+
? ["- route line not reported by detailed status"]
|
|
694
|
+
: [`- ${routeLine}`]),
|
|
695
|
+
...(learningLine === null
|
|
696
|
+
? ["- learning line not reported by detailed status"]
|
|
697
|
+
: [`- ${learningLine}`]),
|
|
698
|
+
...(learningPathLine === null
|
|
699
|
+
? ["- path line not reported by detailed status"]
|
|
700
|
+
: [`- ${learningPathLine}`]),
|
|
701
|
+
`- derived: activePack=${hardeningSnapshot.routeLayer.activePackId ?? "none"} router=${hardeningSnapshot.routeLayer.routerIdentity ?? "none"} routeFreshness=${hardeningSnapshot.routeLayer.routeFreshness ?? "none"} routeFingerprint=${hardeningSnapshot.routeLayer.routeFingerprint ?? "none"} usedLearnedRouteFn=${hardeningSnapshot.routeLayer.usedLearnedRouteFn ?? "none"}`,
|
|
702
|
+
"",
|
|
663
703
|
"## Learning Flow",
|
|
664
704
|
...(learningPathLine === null
|
|
665
705
|
? ["- learning path line not reported by detailed status"]
|
|
@@ -988,6 +1028,9 @@ export function captureOperatorProofBundle(options) {
|
|
|
988
1028
|
const serveLine = extractDetailedStatusLine(statusCapture.stdout, "serve");
|
|
989
1029
|
const routeFnLine = extractDetailedStatusLine(statusCapture.stdout, "routeFn");
|
|
990
1030
|
const guardLine = extractDetailedStatusLine(statusCapture.stdout, "guard");
|
|
1031
|
+
const brainLine = extractDetailedStatusLine(statusCapture.stdout, "brain");
|
|
1032
|
+
const routeLine = extractDetailedStatusLine(statusCapture.stdout, "route");
|
|
1033
|
+
const learningLine = extractDetailedStatusLine(statusCapture.stdout, "learning");
|
|
991
1034
|
const learningFlowLine = extractDetailedStatusLine(statusCapture.stdout, "learnFlow");
|
|
992
1035
|
const learningHealthLine = extractDetailedStatusLine(statusCapture.stdout, "health");
|
|
993
1036
|
const feedbackLine = extractDetailedStatusLine(statusCapture.stdout, "feedback");
|
|
@@ -1024,6 +1067,10 @@ export function captureOperatorProofBundle(options) {
|
|
|
1024
1067
|
serveLine,
|
|
1025
1068
|
routeFnLine,
|
|
1026
1069
|
surfaceLine,
|
|
1070
|
+
brainLine,
|
|
1071
|
+
routeLine,
|
|
1072
|
+
learningLine,
|
|
1073
|
+
learningPathLine,
|
|
1027
1074
|
verdict,
|
|
1028
1075
|
statusSignals,
|
|
1029
1076
|
});
|
|
@@ -1053,6 +1100,9 @@ export function captureOperatorProofBundle(options) {
|
|
|
1053
1100
|
surfaceNoteLine,
|
|
1054
1101
|
hotfixLine,
|
|
1055
1102
|
guardLine,
|
|
1103
|
+
brainLine,
|
|
1104
|
+
routeLine,
|
|
1105
|
+
learningLine,
|
|
1056
1106
|
learningFlowLine,
|
|
1057
1107
|
learningHealthLine,
|
|
1058
1108
|
feedbackLine,
|
|
@@ -1075,6 +1125,9 @@ export function captureOperatorProofBundle(options) {
|
|
|
1075
1125
|
surfaceNoteLine,
|
|
1076
1126
|
hotfixLine,
|
|
1077
1127
|
guardLine,
|
|
1128
|
+
brainLine,
|
|
1129
|
+
routeLine,
|
|
1130
|
+
learningLine,
|
|
1078
1131
|
learningFlowLine,
|
|
1079
1132
|
learningHealthLine,
|
|
1080
1133
|
feedbackLine,
|
|
@@ -3,6 +3,7 @@ import { homedir } from "node:os";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
5
|
import { describeOpenClawBrainInstallLayout, findInstalledOpenClawBrainPlugin } from "./openclaw-plugin-install.js";
|
|
6
|
+
import { inspectOpenClawBrainHookStatus } from "./openclaw-hook-truth.js";
|
|
6
7
|
const REQUIRED_RUNTIME_GUARD_EXPORTS = [
|
|
7
8
|
"createBeforePromptBuildHandler",
|
|
8
9
|
"isActivationRootPlaceholder",
|
|
@@ -70,6 +71,10 @@ export function inspectInstalledOpenClawBrainExtension(openclawHome, extensionId
|
|
|
70
71
|
}
|
|
71
72
|
export async function proveInstalledOpenClawBrainExtensionLoad(openclawHome, extensionId = "openclawbrain") {
|
|
72
73
|
const inspected = inspectInstalledOpenClawBrainExtension(openclawHome, extensionId);
|
|
74
|
+
const hookStatus = inspectOpenClawBrainHookStatus(openclawHome);
|
|
75
|
+
if (hookStatus.loadability !== "loadable") {
|
|
76
|
+
throw new Error(`[shadow-extension-load-proof] Installed hook is not loadable enough to prove its loader: ${hookStatus.detail}`);
|
|
77
|
+
}
|
|
73
78
|
const runtimeGuardModule = await importWithHelpfulError(inspected.runtimeGuardPath, `runtime-guard.js (${describeOpenClawBrainInstallLayout(inspected.installLayout)})`);
|
|
74
79
|
const runtimeGuardExportNames = Object.keys(runtimeGuardModule).sort((left, right) => left.localeCompare(right));
|
|
75
80
|
const missingRuntimeGuardExports = REQUIRED_RUNTIME_GUARD_EXPORTS.filter((exportName) => !runtimeGuardExportNames.includes(exportName));
|
package/package.json
CHANGED