@openclawbrain/cli 0.4.3 → 0.4.5
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/README.md +9 -9
- package/dist/src/cli.d.ts +1 -0
- package/dist/src/cli.js +120 -64
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/learning-spine.d.ts +1 -1
- package/dist/src/learning-spine.js +1 -1
- package/dist/src/local-learner.d.ts +490 -0
- package/dist/src/local-learner.js +4979 -0
- package/dist/src/openclaw-hook-truth.js +5 -5
- package/dist/src/openclaw-plugin-install.d.ts +8 -0
- package/dist/src/openclaw-plugin-install.js +116 -14
- package/dist/src/traced-learning-bridge.js +48 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
# @openclawbrain/cli
|
|
2
2
|
|
|
3
|
-
`@openclawbrain/cli@0.4.
|
|
3
|
+
`@openclawbrain/cli@0.4.5` is the published operator CLI package for OpenClawBrain.
|
|
4
4
|
|
|
5
5
|
Primary public flow:
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
openclaw plugins install @openclawbrain/openclaw@0.4.0
|
|
9
|
-
npx @openclawbrain/cli@0.4.
|
|
9
|
+
npx @openclawbrain/cli@0.4.5 install --openclaw-home ~/.openclaw
|
|
10
10
|
openclaw gateway restart
|
|
11
|
-
npx @openclawbrain/cli@0.4.
|
|
11
|
+
npx @openclawbrain/cli@0.4.5 status --openclaw-home ~/.openclaw --detailed
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Patch note for `0.4.
|
|
14
|
+
Patch note for `0.4.4`: the CLI now normalizes `plugins.allow` / `plugins.entries.openclawbrain` correctly on reinstall and reports the canonical `openclawbrain` install identity in status output.
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Host release note: patched OpenClaw host builds no longer emit the old `openclaw` vs `openclawbrain` mismatch warning. Older host builds may still show that warning until the host-side alias fix is released there.
|
|
17
17
|
|
|
18
18
|
This package carries the `openclawbrain` CLI, daemon controls, import/export helpers, and install/status/operator management code. `@openclawbrain/openclaw` is the plugin/runtime payload.
|
|
19
19
|
|
|
20
20
|
## Commands
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
npx @openclawbrain/cli@0.4.
|
|
24
|
-
npx @openclawbrain/cli@0.4.
|
|
25
|
-
npx @openclawbrain/cli@0.4.
|
|
26
|
-
npx @openclawbrain/cli@0.4.
|
|
23
|
+
npx @openclawbrain/cli@0.4.5 install --openclaw-home ~/.openclaw
|
|
24
|
+
npx @openclawbrain/cli@0.4.5 status --openclaw-home ~/.openclaw --detailed
|
|
25
|
+
npx @openclawbrain/cli@0.4.5 rollback --activation-root /var/openclawbrain/activation --dry-run
|
|
26
|
+
npx @openclawbrain/cli@0.4.5 daemon status --activation-root /var/openclawbrain/activation
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
If the CLI is already on your `PATH`, `openclawbrain ...` is the same command surface. The docs lead with `npx` because that is the clean-host public-registry lane that already passed on `redogfood`.
|
package/dist/src/cli.d.ts
CHANGED
|
@@ -139,6 +139,7 @@ export interface WatchCommandRuntimeV1 {
|
|
|
139
139
|
teacherLoop: ReturnType<typeof createAsyncTeacherLiveLoop>;
|
|
140
140
|
localSessionTail: ReturnType<typeof createOpenClawLocalSessionTail>;
|
|
141
141
|
embedder: TextEmbedder | null;
|
|
142
|
+
consumeBaselinePersisted: () => boolean;
|
|
142
143
|
}
|
|
143
144
|
export interface CreateWatchCommandRuntimeInputV1 {
|
|
144
145
|
activationRoot: string;
|
package/dist/src/cli.js
CHANGED
|
@@ -9,18 +9,18 @@ import { DEFAULT_OLLAMA_EMBEDDING_MODEL, createOllamaEmbedder } from "@openclawb
|
|
|
9
9
|
import { ensureManagedLearnerServiceForActivationRoot, inspectManagedLearnerService, removeManagedLearnerServiceForActivationRoot, parseDaemonArgs, runDaemonCommand } from "./daemon.js";
|
|
10
10
|
import { exportBrain, importBrain } from "./import-export.js";
|
|
11
11
|
import { buildNormalizedEventExport } from "@openclawbrain/contracts";
|
|
12
|
-
import { buildTeacherSupervisionArtifactsFromNormalizedEventExport, createAlwaysOnLearningRuntimeState, describeAlwaysOnLearningRuntimeState, drainAlwaysOnLearningRuntime, loadOrInitBaseline, reindexCandidatePackBuildResultWithEmbedder, materializeAlwaysOnLearningCandidatePack, persistBaseline } from "
|
|
12
|
+
import { buildTeacherSupervisionArtifactsFromNormalizedEventExport, createAlwaysOnLearningRuntimeState, describeAlwaysOnLearningRuntimeState, drainAlwaysOnLearningRuntime, loadOrInitBaseline, reindexCandidatePackBuildResultWithEmbedder, materializeAlwaysOnLearningCandidatePack, persistBaseline } from "./local-learner.js";
|
|
13
13
|
import { inspectActivationState, loadPackFromActivation, promoteCandidatePack, readLearningSpineLogEntries, stageCandidatePack } from "@openclawbrain/pack-format";
|
|
14
14
|
import { resolveActivationRoot } from "./resolve-activation-root.js";
|
|
15
15
|
import { describeOpenClawHomeInspection, discoverOpenClawHomes, formatOpenClawHomeLayout, formatOpenClawHomeProfileSource, inspectOpenClawHome } from "./openclaw-home-layout.js";
|
|
16
16
|
import { inspectOpenClawBrainHookStatus, inspectOpenClawBrainPluginAllowlist } from "./openclaw-hook-truth.js";
|
|
17
|
-
import { describeOpenClawBrainInstallIdentity, describeOpenClawBrainInstallLayout, findInstalledOpenClawBrainPlugin, getOpenClawBrainKnownPluginIds, pinInstalledOpenClawBrainPluginActivationRoot, resolveOpenClawBrainInstallTarget } from "./openclaw-plugin-install.js";
|
|
17
|
+
import { describeOpenClawBrainInstallIdentity, describeOpenClawBrainInstallLayout, findInstalledOpenClawBrainPlugin, getOpenClawBrainKnownPluginIds, normalizeOpenClawBrainPluginsConfig, pinInstalledOpenClawBrainPluginActivationRoot, resolveOpenClawBrainInstallTarget } from "./openclaw-plugin-install.js";
|
|
18
18
|
import { loadAttachmentPolicyDeclaration, resolveEffectiveAttachmentPolicyTruth, writeAttachmentPolicyDeclaration } from "./attachment-policy-truth.js";
|
|
19
19
|
import { DEFAULT_WATCH_POLL_INTERVAL_SECONDS, buildNormalizedEventExportFromScannedEvents, bootstrapRuntimeAttach, buildOperatorSurfaceReport, clearOpenClawProfileRuntimeLoadProof, compileRuntimeContext, createAsyncTeacherLiveLoop, createOpenClawLocalSessionTail, createRuntimeEventExportScanner, describeCurrentProfileBrainStatus, formatOperatorRollbackReport, listOpenClawProfileRuntimeLoadProofs, loadRuntimeEventExportBundle, loadWatchTeacherSnapshotState, persistWatchTeacherSnapshot, rollbackRuntimeAttach, resolveAttachmentRuntimeLoadProofsPath, resolveOperatorTeacherSnapshotPath, resolveAsyncTeacherLiveLoopSnapshotPath, resolveWatchSessionTailCursorPath, resolveWatchStateRoot, resolveWatchTeacherSnapshotPath, scanLiveEventExport, scanRecordedSession, summarizeLearningPathFromMaterialization, summarizeNormalizedEventExportLabelFlow, writeScannedEventExportBundle } from "./index.js";
|
|
20
20
|
import { appendLearningUpdateLogs } from "./learning-spine.js";
|
|
21
21
|
import { buildPassiveLearningSessionExportFromOpenClawSessionStore } from "./local-session-passive-learning.js";
|
|
22
22
|
import { summarizePackVectorEmbeddingState } from "./embedding-status.js";
|
|
23
|
-
import {
|
|
23
|
+
import { buildTracedLearningBridgePayloadFromRuntime, buildTracedLearningStatusSurface, persistTracedLearningBridgeState } from "./traced-learning-bridge.js";
|
|
24
24
|
import { discoverOpenClawSessionStores, loadOpenClawSessionIndex, readOpenClawSessionFile } from "./session-store.js";
|
|
25
25
|
import { readOpenClawBrainProviderDefaults, readOpenClawBrainProviderConfig, readOpenClawBrainProviderConfigFromSources, resolveOpenClawBrainProviderDefaultsPath } from "./provider-config.js";
|
|
26
26
|
const OPENCLAWBRAIN_EMBEDDER_BASE_URL_ENV = "OPENCLAWBRAIN_EMBEDDER_BASE_URL";
|
|
@@ -3581,46 +3581,42 @@ function readOpenClawJsonConfig(openclawHome) {
|
|
|
3581
3581
|
function ensureOpenClawBrainPluginConfig(openclawHome) {
|
|
3582
3582
|
const { path: openclawJsonPath, config } = readOpenClawJsonConfig(openclawHome);
|
|
3583
3583
|
const selectedInstall = findInstalledOpenClawBrainPlugin(openclawHome).selectedInstall;
|
|
3584
|
-
const knownPluginIds = selectedInstall === null
|
|
3585
|
-
? ["openclawbrain", "openclaw"]
|
|
3586
|
-
: getOpenClawBrainKnownPluginIds(selectedInstall);
|
|
3587
3584
|
const plugins = readJsonObjectRecord(config.plugins);
|
|
3588
3585
|
if (plugins === null) {
|
|
3589
3586
|
return {
|
|
3590
3587
|
path: openclawJsonPath,
|
|
3591
3588
|
changed: false,
|
|
3592
|
-
detail: `Left ${shortenPath(openclawJsonPath)} unchanged because plugins
|
|
3589
|
+
detail: `Left ${shortenPath(openclawJsonPath)} unchanged because plugins config is not configured`
|
|
3593
3590
|
};
|
|
3594
3591
|
}
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
}
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3592
|
+
const normalizedPlugins = normalizeOpenClawBrainPluginsConfig(plugins, selectedInstall);
|
|
3593
|
+
if (!normalizedPlugins.changed) {
|
|
3594
|
+
const details = [];
|
|
3595
|
+
if (!Object.prototype.hasOwnProperty.call(plugins, "allow")) {
|
|
3596
|
+
details.push("plugins.allow is not configured");
|
|
3597
|
+
}
|
|
3598
|
+
else if (!Array.isArray(plugins.allow)) {
|
|
3599
|
+
details.push("plugins.allow is not an array");
|
|
3600
|
+
}
|
|
3601
|
+
else {
|
|
3602
|
+
details.push(`plugins.allow already includes ${normalizedPlugins.allowedPluginIds.join(", ")}`);
|
|
3603
|
+
}
|
|
3604
|
+
const entries = readJsonObjectRecord(plugins.entries);
|
|
3605
|
+
if (entries !== null && Object.prototype.hasOwnProperty.call(entries, normalizedPlugins.canonicalEntryId)) {
|
|
3606
|
+
details.push(`plugins.entries already uses ${normalizedPlugins.canonicalEntryId}`);
|
|
3607
|
+
}
|
|
3611
3608
|
return {
|
|
3612
3609
|
path: openclawJsonPath,
|
|
3613
3610
|
changed: false,
|
|
3614
|
-
detail: `Verified ${shortenPath(openclawJsonPath)}
|
|
3611
|
+
detail: `Verified ${shortenPath(openclawJsonPath)} ${details.join("; ")}`
|
|
3615
3612
|
};
|
|
3616
3613
|
}
|
|
3617
|
-
plugins
|
|
3618
|
-
config.plugins = plugins;
|
|
3614
|
+
config.plugins = normalizedPlugins.pluginsConfig;
|
|
3619
3615
|
writeFileSync(openclawJsonPath, `${JSON.stringify(config, null, 2)}\n`, "utf8");
|
|
3620
3616
|
return {
|
|
3621
3617
|
path: openclawJsonPath,
|
|
3622
3618
|
changed: true,
|
|
3623
|
-
detail: `Repaired ${shortenPath(openclawJsonPath)}
|
|
3619
|
+
detail: `Repaired ${shortenPath(openclawJsonPath)} by ${normalizedPlugins.changes.join("; ")}`
|
|
3624
3620
|
};
|
|
3625
3621
|
}
|
|
3626
3622
|
function scrubOpenClawBrainPluginConfig(openclawHome) {
|
|
@@ -3979,6 +3975,37 @@ function resolveServeTimeLearningRuntimeInput(activationRoot) {
|
|
|
3979
3975
|
fallbackReason
|
|
3980
3976
|
};
|
|
3981
3977
|
}
|
|
3978
|
+
function resolveActivationInspectionPackId(inspection, slot) {
|
|
3979
|
+
return inspection?.[slot]?.packId ?? inspection?.pointers?.[slot]?.packId ?? null;
|
|
3980
|
+
}
|
|
3981
|
+
function resolveWatchTeacherArtifactCount(snapshot) {
|
|
3982
|
+
if (typeof snapshot?.teacher?.artifactCount === "number") {
|
|
3983
|
+
return snapshot.teacher.artifactCount;
|
|
3984
|
+
}
|
|
3985
|
+
if (typeof snapshot?.diagnostics?.emittedArtifactCount === "number") {
|
|
3986
|
+
return snapshot.diagnostics.emittedArtifactCount;
|
|
3987
|
+
}
|
|
3988
|
+
return 0;
|
|
3989
|
+
}
|
|
3990
|
+
function persistWatchTracedLearningBridgeSurface(input) {
|
|
3991
|
+
const lastMaterialization = input.snapshot?.learner?.lastMaterialization ?? null;
|
|
3992
|
+
const materializedPackId = lastMaterialization?.candidate?.summary?.packId ?? null;
|
|
3993
|
+
return persistTracedLearningBridgeState(input.activationRoot, buildTracedLearningBridgePayloadFromRuntime({
|
|
3994
|
+
updatedAt: input.updatedAt,
|
|
3995
|
+
lastMaterialization,
|
|
3996
|
+
teacherArtifactCount: resolveWatchTeacherArtifactCount(input.snapshot),
|
|
3997
|
+
serveTimeLearning: resolveServeTimeLearningRuntimeInput(input.activationRoot),
|
|
3998
|
+
materializedPackId,
|
|
3999
|
+
promoted: materializedPackId !== null &&
|
|
4000
|
+
resolveActivationInspectionPackId(input.inspection, "active") === materializedPackId,
|
|
4001
|
+
baselinePersisted: input.baselinePersisted,
|
|
4002
|
+
source: {
|
|
4003
|
+
command: "watch",
|
|
4004
|
+
scanRoot: input.scanRoot,
|
|
4005
|
+
teacherSnapshotPath: input.teacherSnapshotPath
|
|
4006
|
+
}
|
|
4007
|
+
}));
|
|
4008
|
+
}
|
|
3982
4009
|
function runLearnCommand(parsed) {
|
|
3983
4010
|
const learnStatePath = path.join(parsed.activationRoot, "learn-cli-state.json");
|
|
3984
4011
|
const teacherSnapshotPath = resolveAsyncTeacherLiveLoopSnapshotPath(parsed.activationRoot);
|
|
@@ -4216,9 +4243,6 @@ function runLearnCommand(parsed) {
|
|
|
4216
4243
|
const lastMaterialization = learnerResult.materializations.at(-1) ?? null;
|
|
4217
4244
|
const plan = describeAlwaysOnLearningRuntimeState(learnerResult.state, lastMaterialization);
|
|
4218
4245
|
const learningPath = summarizeLearningPathFromMaterialization(lastMaterialization);
|
|
4219
|
-
const supervisionCount = lastMaterialization?.candidate.summary.learnedRouter.supervisionCount ?? 0;
|
|
4220
|
-
const routerUpdateCount = lastMaterialization?.candidate.summary.learnedRouter.updateCount ?? 0;
|
|
4221
|
-
const routerNoOpReason = lastMaterialization?.candidate.summary.learnedRouter.noOpReason ?? null;
|
|
4222
4246
|
const graphEvolution = lastMaterialization?.candidate.payloads.graph.evolution;
|
|
4223
4247
|
const graphSummary = graphEvolution === undefined
|
|
4224
4248
|
? null
|
|
@@ -4229,18 +4253,28 @@ function runLearnCommand(parsed) {
|
|
|
4229
4253
|
const connectSummary = graphSummary?.connectDiagnostics === null || graphSummary?.connectDiagnostics === undefined
|
|
4230
4254
|
? ""
|
|
4231
4255
|
: ` connect candidates=${graphSummary.connectDiagnostics.candidatePairCount} applied=${graphSummary.connectDiagnostics.appliedPairCount} edges=${graphSummary.connectDiagnostics.createdEdgeCount}.`;
|
|
4232
|
-
const
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4256
|
+
const tracedLearningPreview = buildTracedLearningBridgePayloadFromRuntime({
|
|
4257
|
+
updatedAt: now,
|
|
4258
|
+
lastMaterialization,
|
|
4259
|
+
teacherArtifactCount: teacherArtifacts.length,
|
|
4260
|
+
serveTimeLearning,
|
|
4261
|
+
source: {
|
|
4262
|
+
command: "learn",
|
|
4263
|
+
exportDigest: learningExport.provenance.exportDigest,
|
|
4264
|
+
teacherSnapshotPath
|
|
4265
|
+
}
|
|
4266
|
+
});
|
|
4267
|
+
const supervisionCount = tracedLearningPreview.supervisionCount;
|
|
4268
|
+
const routerUpdateCount = tracedLearningPreview.routerUpdateCount;
|
|
4269
|
+
const routerNoOpReason = tracedLearningPreview.routerNoOpReason;
|
|
4240
4270
|
const learnPathReport = {
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4271
|
+
learnedRoutingPath: lastMaterialization?.candidate.routingBuild?.learnedRoutingPath ??
|
|
4272
|
+
(serveTimeLearning.pgVersion === "v2" ? "policy_gradient_v2" : "policy_gradient_v1"),
|
|
4273
|
+
pgVersionRequested: tracedLearningPreview.pgVersionRequested,
|
|
4274
|
+
pgVersionUsed: tracedLearningPreview.pgVersionUsed,
|
|
4275
|
+
decisionLogCount: tracedLearningPreview.decisionLogCount,
|
|
4276
|
+
fallbackReason: tracedLearningPreview.fallbackReason,
|
|
4277
|
+
updatedBaseline: lastMaterialization?.candidate.routingBuild?.updatedBaseline ?? null
|
|
4244
4278
|
};
|
|
4245
4279
|
let promoted = false;
|
|
4246
4280
|
let materializedPackId = null;
|
|
@@ -4269,6 +4303,20 @@ function runLearnCommand(parsed) {
|
|
|
4269
4303
|
materializedPackId = candidateDescriptor.manifest.packId;
|
|
4270
4304
|
promoted = true;
|
|
4271
4305
|
}
|
|
4306
|
+
const tracedLearningPayload = buildTracedLearningBridgePayloadFromRuntime({
|
|
4307
|
+
updatedAt: now,
|
|
4308
|
+
lastMaterialization,
|
|
4309
|
+
teacherArtifactCount: teacherArtifacts.length,
|
|
4310
|
+
serveTimeLearning,
|
|
4311
|
+
materializedPackId,
|
|
4312
|
+
promoted,
|
|
4313
|
+
baselinePersisted,
|
|
4314
|
+
source: {
|
|
4315
|
+
command: "learn",
|
|
4316
|
+
exportDigest: learningExport.provenance.exportDigest,
|
|
4317
|
+
teacherSnapshotPath
|
|
4318
|
+
}
|
|
4319
|
+
});
|
|
4272
4320
|
persistLearnCliState(learnerResult.state, now);
|
|
4273
4321
|
writeJsonFile(teacherSnapshotPath, {
|
|
4274
4322
|
runtimeOwner: "openclaw",
|
|
@@ -4315,31 +4363,10 @@ function runLearnCommand(parsed) {
|
|
|
4315
4363
|
lastAppliedMaterializationJobId: lastMaterialization?.jobId ?? null
|
|
4316
4364
|
}
|
|
4317
4365
|
});
|
|
4318
|
-
const tracedLearningBridge =
|
|
4319
|
-
updatedAt: now,
|
|
4320
|
-
routeTraceCount: lastMaterialization?.candidate.summary.learnedRouter.routeTraceCount ?? serveTimeLearning.decisionLogCount,
|
|
4321
|
-
supervisionCount,
|
|
4322
|
-
routerUpdateCount,
|
|
4323
|
-
teacherArtifactCount: teacherArtifacts.length,
|
|
4324
|
-
pgVersionRequested: learnPathReport.pgVersionRequested,
|
|
4325
|
-
pgVersionUsed: learnPathReport.pgVersionUsed,
|
|
4326
|
-
decisionLogCount: learnPathReport.decisionLogCount,
|
|
4327
|
-
fallbackReason: learnPathReport.fallbackReason,
|
|
4328
|
-
routerNoOpReason,
|
|
4329
|
-
materializedPackId,
|
|
4330
|
-
promoted,
|
|
4331
|
-
baselinePersisted,
|
|
4332
|
-
source: {
|
|
4333
|
-
command: "learn",
|
|
4334
|
-
exportDigest: learningExport.provenance.exportDigest,
|
|
4335
|
-
teacherSnapshotPath
|
|
4336
|
-
}
|
|
4337
|
-
}, loadBrainStoreTracedLearningBridge());
|
|
4366
|
+
const tracedLearningBridge = persistTracedLearningBridgeState(activationRoot, tracedLearningPayload);
|
|
4338
4367
|
const surfacedSupervisionCount = tracedLearningBridge.supervisionCount;
|
|
4339
4368
|
const surfacedRouterUpdateCount = tracedLearningBridge.routerUpdateCount;
|
|
4340
4369
|
const surfacedRouterNoOpReason = tracedLearningBridge.routerNoOpReason;
|
|
4341
|
-
persistBrainStoreTracedLearningBridge(tracedLearningBridge);
|
|
4342
|
-
writeTracedLearningBridge(activationRoot, tracedLearningBridge);
|
|
4343
4370
|
const summaryMessage = materializedPackId === null
|
|
4344
4371
|
? `Scanned ${totalSessions} sessions, ${totalEvents} new events, no candidate materialized, no promotion.`
|
|
4345
4372
|
: `Scanned ${totalSessions} sessions, ${totalEvents} new events, materialized ${materializedPackId}, promoted.${connectSummary}`;
|
|
@@ -4971,6 +4998,7 @@ export async function createWatchCommandRuntime(input) {
|
|
|
4971
4998
|
const restoredTeacherState = loadWatchTeacherSnapshotState(teacherSnapshotPath);
|
|
4972
4999
|
const log = input.log ?? watchLog;
|
|
4973
5000
|
const startupWarnings = [];
|
|
5001
|
+
let baselinePersisted = false;
|
|
4974
5002
|
mkdirSync(scanRoot, { recursive: true });
|
|
4975
5003
|
mkdirSync(resolveWatchStateRoot(activationRoot), { recursive: true });
|
|
4976
5004
|
log(`Watch starting — activation: ${shortenPath(activationRoot)}`);
|
|
@@ -5024,6 +5052,7 @@ export async function createWatchCommandRuntime(input) {
|
|
|
5024
5052
|
persistUpdatedBaseline: (state) => {
|
|
5025
5053
|
try {
|
|
5026
5054
|
persistBaseline(activationRoot, state);
|
|
5055
|
+
baselinePersisted = true;
|
|
5027
5056
|
}
|
|
5028
5057
|
catch (error) {
|
|
5029
5058
|
log(`Baseline persist failed: ${formatWatchError(error)}`);
|
|
@@ -5143,6 +5172,17 @@ export async function createWatchCommandRuntime(input) {
|
|
|
5143
5172
|
log(replayPromotion.logLine);
|
|
5144
5173
|
bootstrapSnapshot = teacherLoop.snapshot();
|
|
5145
5174
|
}
|
|
5175
|
+
const bootstrapInspection = inspectActivationState(activationRoot, bootstrapObservedAt);
|
|
5176
|
+
persistWatchTracedLearningBridgeSurface({
|
|
5177
|
+
activationRoot,
|
|
5178
|
+
updatedAt: bootstrapObservedAt,
|
|
5179
|
+
snapshot: bootstrapSnapshot,
|
|
5180
|
+
inspection: bootstrapInspection,
|
|
5181
|
+
scanRoot,
|
|
5182
|
+
teacherSnapshotPath,
|
|
5183
|
+
baselinePersisted
|
|
5184
|
+
});
|
|
5185
|
+
baselinePersisted = false;
|
|
5146
5186
|
const bootstrapCursor = localSessionTail.snapshot();
|
|
5147
5187
|
persistWatchTeacherSnapshot(teacherSnapshotPath, {
|
|
5148
5188
|
lastRunAt: bootstrapObservedAt,
|
|
@@ -5192,7 +5232,12 @@ export async function createWatchCommandRuntime(input) {
|
|
|
5192
5232
|
scanner,
|
|
5193
5233
|
teacherLoop,
|
|
5194
5234
|
localSessionTail,
|
|
5195
|
-
embedder: resolvedEmbedder.embedder
|
|
5235
|
+
embedder: resolvedEmbedder.embedder,
|
|
5236
|
+
consumeBaselinePersisted: () => {
|
|
5237
|
+
const persisted = baselinePersisted;
|
|
5238
|
+
baselinePersisted = false;
|
|
5239
|
+
return persisted;
|
|
5240
|
+
}
|
|
5196
5241
|
};
|
|
5197
5242
|
}
|
|
5198
5243
|
export async function runWatchCommandPass(runtime, options = {}) {
|
|
@@ -5271,6 +5316,17 @@ export async function runWatchCommandPass(runtime, options = {}) {
|
|
|
5271
5316
|
}
|
|
5272
5317
|
}
|
|
5273
5318
|
const afterInspection = inspectActivationState(runtime.activationRoot, observedAt);
|
|
5319
|
+
persistWatchTracedLearningBridgeSurface({
|
|
5320
|
+
activationRoot: runtime.activationRoot,
|
|
5321
|
+
updatedAt: observedAt,
|
|
5322
|
+
snapshot,
|
|
5323
|
+
inspection: afterInspection,
|
|
5324
|
+
scanRoot: runtime.scanRoot,
|
|
5325
|
+
teacherSnapshotPath: runtime.teacherSnapshotPath,
|
|
5326
|
+
baselinePersisted: typeof runtime.consumeBaselinePersisted === "function"
|
|
5327
|
+
? runtime.consumeBaselinePersisted()
|
|
5328
|
+
: false
|
|
5329
|
+
});
|
|
5274
5330
|
const lastObservedDelta = buildWatchLastObservedDelta({
|
|
5275
5331
|
observedAt,
|
|
5276
5332
|
localPoll,
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type CompileSelectionMode } from "@openclawbrain/compiler";
|
|
2
2
|
import { CONTRACT_IDS, type ArtifactManifestV1, type ActivationPointerRecordV1, type ActivationPointerSlot, type RuntimeTurnBrainAttachmentPolicyV1, type ContextCompactionMode, type ContextContributionEvidenceStateV1, type CurrentProfileBrainStatusAnswerV1, type CurrentProfileActivationStateV1, type CurrentProfilePassiveLearningDeltaSummaryV1, type CurrentProfilePassiveLearningWatchStateV1, type CurrentProfileAttachmentStateV1, type CurrentProfileAttachmentProofStateV1, type CurrentProfileHookInstallStateV1, type CurrentProfileHookLoadabilityV1, type CurrentProfileHookLoadProofV1, type BrainServeHotPathTimingV1, type CurrentProfileStructuralDecisionV1, type FeedbackEventKind, type PackGraphConnectDiagnosticsV1, type PackGraphEvolutionV1, type EventSemanticSurfaceV1, type FeedbackEventV1, type KernelSurfaceValidationResultV1, type LearningBootProfile, type LearningCadence, type LearningScanPolicy, type InteractionEventV1, type NormalizedEventExportV1, type NormalizedEventV1, type PrincipalPriorityClassV1, type PrincipalRoleV1, type RouteMode, type RuntimeCompileResponseV1, type RuntimeCompileStructuralSignalsV1, type RuntimeCompileTargetV1, type RuntimeGraphPlasticityStateV1, type RuntimePlasticitySourceV1, type SparseFeedbackPolicyV1, type TeacherAuthorityV1, type TeacherSupervisionArtifactV1, type WorkspaceInjectionSurfaceV1 } from "@openclawbrain/contracts";
|
|
3
3
|
import { type EventExportLaneV1 } from "@openclawbrain/event-export";
|
|
4
|
-
import { type AdvanceAlwaysOnLearningRuntimeInput, type AlwaysOnLearningCadenceV1, type AlwaysOnLearningMaterializationJobV1, type AlwaysOnLearningRuntimePlanV1, type AlwaysOnLearningRuntimeStateV1, type BaselineStateV1, type PendingPrincipalEventV1, type PrincipalLearningCheckpointV1 } from "
|
|
4
|
+
import { type AdvanceAlwaysOnLearningRuntimeInput, type AlwaysOnLearningCadenceV1, type AlwaysOnLearningMaterializationJobV1, type AlwaysOnLearningRuntimePlanV1, type AlwaysOnLearningRuntimeStateV1, type BaselineStateV1, type PendingPrincipalEventV1, type PrincipalLearningCheckpointV1 } from "./local-learner.js";
|
|
5
5
|
import { type ActivationInspection, type ActivationObservabilityReport, type GraphEvolutionLogV1, type LearningSpineServeRouteBreadcrumbsV1, type ActivationSlotInspection, type InitHandoffState, type LearningSpineServeRouteDecisionLogEntryV1 } from "@openclawbrain/pack-format";
|
|
6
6
|
export { clearOpenClawProfileRuntimeLoadProof, listOpenClawProfileRuntimeLoadProofs, recordOpenClawProfileRuntimeLoadProof, resolveAttachmentRuntimeLoadProofsPath, type OpenClawProfileRuntimeLoadProofRecordV1, type OpenClawProfileRuntimeLoadProofSetV1, type OpenClawProfileRuntimeLoadProofsV1 } from "./attachment-truth.js";
|
|
7
7
|
import { type AsyncTeacherLabelerConfigV1 } from "./teacher-labeler.js";
|
package/dist/src/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import process from "node:process";
|
|
|
5
5
|
import { compileRuntimeFromActivation } from "@openclawbrain/compiler";
|
|
6
6
|
import { CONTRACT_IDS, buildEventSemanticSurface, buildNormalizedEventExport, canonicalJson, checksumJsonPayload, createFeedbackEvent, createInteractionEvent, sortNormalizedEvents, validateKernelSurface, validateNormalizedEventExport } from "@openclawbrain/contracts";
|
|
7
7
|
import { classifyFeedbackSignalContent, describeNormalizedEventExportObservability } from "@openclawbrain/event-export";
|
|
8
|
-
import { DEFAULT_TEACHER_SUPERVISION_STALE_AFTER_MS, advanceAlwaysOnLearningRuntime, buildTeacherSupervisionArtifactsFromNormalizedEventExport, createAlwaysOnLearningRuntimeState, describeAlwaysOnLearningRuntimeState, materializeAlwaysOnLearningCandidatePack, materializeCandidatePackFromNormalizedEventExport } from "
|
|
8
|
+
import { DEFAULT_TEACHER_SUPERVISION_STALE_AFTER_MS, advanceAlwaysOnLearningRuntime, buildTeacherSupervisionArtifactsFromNormalizedEventExport, createAlwaysOnLearningRuntimeState, describeAlwaysOnLearningRuntimeState, materializeAlwaysOnLearningCandidatePack, materializeCandidatePackFromNormalizedEventExport } from "./local-learner.js";
|
|
9
9
|
import { LEARNING_SPINE_LOG_LAYOUT, activatePack, describeActivationObservability, describeActivationTarget, describePackCompileTarget, inspectActivationState, loadPackFromActivation, promoteCandidatePack, readLearningSpineLogEntries, rollbackActivePack, stageCandidatePack } from "@openclawbrain/pack-format";
|
|
10
10
|
import { inspectOpenClawBrainHookStatus, summarizeOpenClawBrainHookLoad } from "./openclaw-hook-truth.js";
|
|
11
11
|
import { appendLearningUpdateLogs, appendServeTimeRouteDecisionLog } from "./learning-spine.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AlwaysOnLearningMaterializationJobV1 } from "
|
|
1
|
+
import { type AlwaysOnLearningMaterializationJobV1 } from "./local-learner.js";
|
|
2
2
|
import { type BrainServeHotPathTimingV1, type NormalizedEventExportV1, type RouteMode, type RuntimeCompileResponseV1 } from "@openclawbrain/contracts";
|
|
3
3
|
import { type LearningSpinePgRouteUpdateLogEntryV1, type LearningSpineServeRouteBreadcrumbsV1, type LearningSpineServeRouteDecisionLogEntryV1, type PackDescriptor } from "@openclawbrain/pack-format";
|
|
4
4
|
type CompileFailureLike = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { rankContextBlocks } from "@openclawbrain/compiler";
|
|
3
|
-
import { describeSparseFeedbackEventDispositions } from "
|
|
3
|
+
import { describeSparseFeedbackEventDispositions } from "./local-learner.js";
|
|
4
4
|
import { CONTRACT_IDS } from "@openclawbrain/contracts";
|
|
5
5
|
import { appendLearningSpineLogEntry, buildLearningSpineLogId, loadActivationPointers, loadPack, loadPackFromActivation, readLearningSpineLogEntries } from "@openclawbrain/pack-format";
|
|
6
6
|
function noteValue(notes, prefix) {
|