@openclawbrain/cli 0.4.14 → 0.4.16

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.
@@ -5,7 +5,7 @@ import { type AdvanceAlwaysOnLearningRuntimeInput, type AlwaysOnLearningCadenceV
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";
8
- export { createHttpOllamaTeacherLabelerClient, createOllamaTeacherLabeler, createTeacherLabeler, type AsyncTeacherLabelerConfigV1, type AsyncTeacherNoopLabelerConfigV1, type AsyncTeacherOllamaLabelerConfigV1, type OllamaTeacherLabelerClient, type TeacherLabeler, type TeacherLabelerResultV1, type TeacherLabelerRunInputV1 } from "./teacher-labeler.js";
8
+ export { createHttpOllamaTeacherLabelerClient, createOllamaTeacherLabeler, createTeacherLabeler, summarizeTeacherLabelerOpportunity, type AsyncTeacherLabelerConfigV1, type AsyncTeacherNoopLabelerConfigV1, type AsyncTeacherOllamaLabelerConfigV1, type OllamaTeacherLabelerClient, type TeacherLabeler, type TeacherLabelerOpportunityInputV1, type TeacherLabelerOpportunityV1, type TeacherLabelerResultV1, type TeacherLabelerRunInputV1 } from "./teacher-labeler.js";
9
9
  export declare const DEFAULT_ASYNC_TEACHER_QUEUE_CAPACITY = 8;
10
10
  declare const RECORDED_SESSION_TRACE_CONTRACT: "recorded_session_trace.v1";
11
11
  declare const RECORDED_SESSION_FIXTURE_CONTRACT: "recorded_session_replay_fixture.v1";
@@ -15,6 +15,19 @@ export declare const RUNTIME_EVENT_EXPORT_BUNDLE_LAYOUT: {
15
15
  readonly manifest: "manifest.json";
16
16
  readonly payload: "normalized-event-export.json";
17
17
  };
18
+ export declare const RECORDED_SESSION_REPLAY_PROOF_BUNDLE_LAYOUT: {
19
+ readonly manifest: "manifest.json";
20
+ readonly trace: "trace.json";
21
+ readonly fixture: "fixture.json";
22
+ readonly bundle: "bundle.json";
23
+ readonly environment: "environment.json";
24
+ readonly summary: "summary.md";
25
+ readonly summaryTables: "summary-tables.json";
26
+ readonly coverageSnapshot: "coverage-snapshot.json";
27
+ readonly hardeningSnapshot: "hardening-snapshot.json";
28
+ readonly hashes: "hashes.json";
29
+ readonly modeDir: "modes";
30
+ };
18
31
  export interface CompileServeRouteBreadcrumbInput {
19
32
  invocationSurface: LearningSpineServeRouteBreadcrumbsV1["invocationSurface"];
20
33
  hostEvent: LearningSpineServeRouteBreadcrumbsV1["hostEvent"];
@@ -80,6 +93,11 @@ export interface RuntimeEventExportBundleDescriptor {
80
93
  normalizedEventExport: NormalizedEventExportV1;
81
94
  }
82
95
  export type CompileRuntimeBudgetStrategy = "fixed_v1" | "empirical_v1";
96
+ export type RuntimeComparativeReplayMode = "vector_only" | "graph_prior_only" | "learned_route";
97
+ export interface FrozenReplayEvalIdentityV1 {
98
+ packId: string;
99
+ routerIdentity?: string | null;
100
+ }
83
101
  export interface CompileRuntimeContextInput {
84
102
  activationRoot: string;
85
103
  message: string;
@@ -87,7 +105,7 @@ export interface CompileRuntimeContextInput {
87
105
  maxContextBlocks?: number;
88
106
  budgetStrategy?: CompileRuntimeBudgetStrategy;
89
107
  maxContextChars?: number;
90
- mode?: RouteMode;
108
+ mode?: RouteMode | RuntimeComparativeReplayMode;
91
109
  selectionMode?: CompileSelectionMode;
92
110
  compactionMode?: ContextCompactionMode;
93
111
  runtimeHints?: readonly string[];
@@ -99,6 +117,8 @@ export interface CompileRuntimeContextInput {
99
117
  _suppressServeLog?: boolean;
100
118
  /** @internal Preserve explicit serve-route breadcrumbs for installed/runtime hook paths. */
101
119
  _serveRouteBreadcrumbs?: CompileServeRouteBreadcrumbInput;
120
+ /** @internal Freeze the expected active pack/router identity for replay eval scoring. */
121
+ _frozenReplayEvalIdentity?: FrozenReplayEvalIdentityV1;
102
122
  }
103
123
  export interface ActiveCompileTarget {
104
124
  activationRoot: string;
@@ -328,7 +348,7 @@ export interface OpenClawRuntimeTurnInput {
328
348
  sequenceStart?: number | null;
329
349
  maxContextBlocks?: number;
330
350
  budgetStrategy?: CompileRuntimeBudgetStrategy;
331
- mode?: RouteMode;
351
+ mode?: RouteMode | RuntimeComparativeReplayMode;
332
352
  selectionMode?: CompileSelectionMode;
333
353
  runtimeHints?: readonly string[];
334
354
  brainAttachmentPolicy?: RuntimeTurnBrainAttachmentPolicyV1 | null;
@@ -361,6 +381,8 @@ export type RuntimeEventExportResult = RuntimeEventExportNoWrite | RuntimeEventE
361
381
  export interface RunRuntimeTurnOptions {
362
382
  activationRoot?: string;
363
383
  failOpen?: boolean;
384
+ /** @internal Freeze the expected active pack/router identity for replay eval scoring. */
385
+ _frozenReplayEvalIdentity?: FrozenReplayEvalIdentityV1;
364
386
  }
365
387
  export type RuntimeTurnResult = RuntimeCompileResult & {
366
388
  eventExport: RuntimeEventExportResult;
@@ -379,6 +401,10 @@ export interface AsyncTeacherLiveLoopInput extends Pick<AdvanceAlwaysOnLearningR
379
401
  persistUpdatedBaseline?: (state: BaselineStateV1) => void;
380
402
  teacherLabeler?: AsyncTeacherLabelerConfigV1 | null;
381
403
  }
404
+ export interface TeacherNoArtifactCycleSummaryV1 {
405
+ shouldWarn: boolean;
406
+ detail: string;
407
+ }
382
408
  export interface AsyncTeacherQueuedExportJobV1 {
383
409
  jobId: string;
384
410
  exportDigest: string;
@@ -659,6 +685,7 @@ export declare const WATCH_STATE_DIRNAME = "watch";
659
685
  export declare const WATCH_SESSION_TAIL_CURSOR_BASENAME = "session-tail-cursor.json";
660
686
  export declare const WATCH_TEACHER_SNAPSHOT_BASENAME = "teacher-snapshot.json";
661
687
  export declare const DEFAULT_WATCH_POLL_INTERVAL_SECONDS = 30;
688
+ export declare function summarizeTeacherNoArtifactCycle(notes: readonly string[] | null | undefined): TeacherNoArtifactCycleSummaryV1;
662
689
  export interface WatchTeacherSnapshotFailureV1 {
663
690
  mode: "materialization_failed" | "teacher_fail_open";
664
691
  detail: string;
@@ -1013,7 +1040,7 @@ export declare function writeRuntimeEventExportBundle(turn: OpenClawRuntimeTurnI
1013
1040
  export declare function writeScannedEventExportBundle(input: WriteScannedEventExportBundleInputV1): WriteScannedEventExportBundleResultV1;
1014
1041
  export declare function runRuntimeTurn(turn: OpenClawRuntimeTurnInput, options?: RunRuntimeTurnOptions): RuntimeTurnResult;
1015
1042
  export declare function runContinuousProductLoopTurn(input: RunContinuousProductLoopTurnInput): ContinuousProductLoopTurnResultV1;
1016
- export type RecordedSessionReplayMode = "no_brain" | "seed_pack" | "learned_replay";
1043
+ export type RecordedSessionReplayMode = "no_brain" | RuntimeComparativeReplayMode;
1017
1044
  export interface RecordedSessionReplayWorkspaceV1 {
1018
1045
  workspaceId: string;
1019
1046
  snapshotId: string;
@@ -1059,6 +1086,7 @@ export interface RecordedSessionTraceV1 {
1059
1086
  notes: string[];
1060
1087
  };
1061
1088
  workspace: RecordedSessionReplayWorkspaceV1;
1089
+ evalTurnCount?: number;
1062
1090
  seedBuiltAt: string;
1063
1091
  seedActivatedAt: string;
1064
1092
  seedCues: readonly RecordedSessionSeedCueV1[];
@@ -1080,17 +1108,24 @@ export interface RecordedSessionReplayFixtureV1 {
1080
1108
  fixtureHash: string;
1081
1109
  privacy: RecordedSessionTraceV1["privacy"];
1082
1110
  workspace: RecordedSessionReplayWorkspaceV1;
1111
+ evalTurnCount?: number;
1083
1112
  seedBuiltAt: string;
1084
1113
  seedActivatedAt: string;
1085
1114
  seedExport: NormalizedEventExportV1;
1086
1115
  turns: RecordedSessionReplayTurnFixtureV1[];
1087
1116
  }
1117
+ export type RecordedSessionReplayTurnPhase = "train" | "eval";
1088
1118
  export interface RecordedSessionReplayTurnReportV1 {
1089
1119
  turnId: string;
1120
+ replayMode: RecordedSessionReplayMode;
1121
+ phase: RecordedSessionReplayTurnPhase;
1090
1122
  compileOk: boolean;
1091
1123
  fallbackToStaticContext: boolean;
1092
1124
  hardRequirementViolated: boolean;
1093
1125
  activePackId: string | null;
1126
+ modeRequested: RouteMode | null;
1127
+ modeEffective: RouteMode | null;
1128
+ selectionEngine: CompileSelectionMode | null;
1094
1129
  usedLearnedRouteFn: boolean;
1095
1130
  routerIdentity: string | null;
1096
1131
  selectionDigest: string | null;
@@ -1136,6 +1171,9 @@ export interface RecordedSessionReplayScannerEvidenceV1 {
1136
1171
  }
1137
1172
  export interface RecordedSessionReplayModeSummaryV1 {
1138
1173
  mode: RecordedSessionReplayMode;
1174
+ activationStrategy: "no_brain" | "seed_pack" | "continuous_learned_loop";
1175
+ modeRequested: RouteMode | null;
1176
+ selectionEngine: CompileSelectionMode | null;
1139
1177
  qualityScore: number;
1140
1178
  compileOkCount: number;
1141
1179
  phraseHitCount: number;
@@ -1143,6 +1181,10 @@ export interface RecordedSessionReplayModeSummaryV1 {
1143
1181
  usedLearnedRouteTurnCount: number;
1144
1182
  promotionCount: number;
1145
1183
  packIds: string[];
1184
+ trainTurnCount: number;
1185
+ evalTurnCount: number;
1186
+ frozenEvalPackId: string | null;
1187
+ frozenEvalRouterIdentity: string | null;
1146
1188
  scannerEvidence: RecordedSessionReplayScannerEvidenceV1;
1147
1189
  scoreHash: string;
1148
1190
  }
@@ -1183,10 +1225,208 @@ export interface RecordedSessionReplayBundleHashVerificationV1 {
1183
1225
  bundleHashMatches: boolean;
1184
1226
  scoreHashMatches: boolean;
1185
1227
  }
1228
+ export interface RecordedSessionReplayProofManifestV1 {
1229
+ contract: "recorded_session_replay_proof_manifest.v1";
1230
+ traceId: string;
1231
+ source: RecordedSessionReplayBundleV1["source"];
1232
+ recordedAt: string;
1233
+ generatedAt: string;
1234
+ hashAlgorithm: "sha256";
1235
+ modeOrder: RecordedSessionReplayMode[];
1236
+ contracts: {
1237
+ trace: typeof RECORDED_SESSION_TRACE_CONTRACT;
1238
+ fixture: typeof RECORDED_SESSION_FIXTURE_CONTRACT;
1239
+ bundle: typeof RECORDED_SESSION_BUNDLE_CONTRACT;
1240
+ environment: "recorded_session_replay_environment.v1";
1241
+ summaryTables: "recorded_session_replay_summary_tables.v1";
1242
+ coverageSnapshot: "recorded_session_replay_coverage_snapshot.v1";
1243
+ hardeningSnapshot: "recorded_session_replay_hardening_snapshot.v1";
1244
+ hashes: "recorded_session_replay_hashes.v1";
1245
+ };
1246
+ hashes: {
1247
+ traceHash: string;
1248
+ fixtureHash: string;
1249
+ scoreHash: string;
1250
+ bundleHash: string;
1251
+ };
1252
+ files: {
1253
+ trace: string;
1254
+ fixture: string;
1255
+ bundle: string;
1256
+ environment: string;
1257
+ summary: string;
1258
+ summaryTables: string;
1259
+ coverageSnapshot: string;
1260
+ hardeningSnapshot: string;
1261
+ hashes: string;
1262
+ modes: Array<{
1263
+ mode: RecordedSessionReplayMode;
1264
+ path: string;
1265
+ }>;
1266
+ };
1267
+ }
1268
+ export interface RecordedSessionReplayProofEnvironmentV1 {
1269
+ contract: "recorded_session_replay_environment.v1";
1270
+ runtimeOwner: "openclaw";
1271
+ generator: {
1272
+ packageName: "@openclawbrain/cli";
1273
+ entrypoint: "writeRecordedSessionReplayProofBundle";
1274
+ nodeVersion: string;
1275
+ platform: string;
1276
+ arch: string;
1277
+ };
1278
+ determinism: {
1279
+ hashAlgorithm: "sha256";
1280
+ canonicalJson: true;
1281
+ modeOrder: RecordedSessionReplayMode[];
1282
+ scratchReplayRoot: "temporary_directory";
1283
+ };
1284
+ }
1285
+ export interface RecordedSessionReplayProofModeTableRowV1 {
1286
+ mode: RecordedSessionReplayMode;
1287
+ turnCount: number;
1288
+ qualityScore: number;
1289
+ compileOkCount: number;
1290
+ phraseHitCount: number;
1291
+ phraseCount: number;
1292
+ usedLearnedRouteTurnCount: number;
1293
+ promotionCount: number;
1294
+ exportTurnCount: number;
1295
+ humanLabelCount: number;
1296
+ attributedTurnCount: number;
1297
+ activePackChangeCount: number;
1298
+ warningCount: number;
1299
+ scoreHash: string;
1300
+ }
1301
+ export interface RecordedSessionReplayProofTurnTableRowV1 {
1302
+ mode: RecordedSessionReplayMode;
1303
+ turnId: string;
1304
+ qualityScore: number;
1305
+ compileOk: boolean;
1306
+ phraseHitCount: number;
1307
+ phraseCount: number;
1308
+ usedLearnedRouteFn: boolean;
1309
+ promoted: boolean;
1310
+ activePackId: string | null;
1311
+ selectionDigest: string | null;
1312
+ eventExportDigest: string | null;
1313
+ warningCount: number;
1314
+ }
1315
+ export interface RecordedSessionReplayProofSummaryTablesV1 {
1316
+ contract: "recorded_session_replay_summary_tables.v1";
1317
+ traceId: string;
1318
+ winnerMode: RecordedSessionReplayMode | null;
1319
+ ranking: RecordedSessionReplayBundleV1["summary"]["ranking"];
1320
+ modes: RecordedSessionReplayProofModeTableRowV1[];
1321
+ turns: RecordedSessionReplayProofTurnTableRowV1[];
1322
+ }
1323
+ export interface RecordedSessionReplayProofCoverageSnapshotModeRowV1 {
1324
+ mode: RecordedSessionReplayMode;
1325
+ turnCount: number;
1326
+ compileOkRate: number | null;
1327
+ phraseHitRate: number | null;
1328
+ learnedRouteTurnRate: number | null;
1329
+ attributedTurnRate: number | null;
1330
+ }
1331
+ export interface RecordedSessionReplayProofCoverageSnapshotV1 {
1332
+ contract: "recorded_session_replay_coverage_snapshot.v1";
1333
+ traceId: string;
1334
+ winnerMode: RecordedSessionReplayMode | null;
1335
+ totalTurns: number;
1336
+ compileOkTurnCount: number;
1337
+ compileOkRate: number | null;
1338
+ phraseHitCount: number;
1339
+ phraseCount: number;
1340
+ phraseHitRate: number | null;
1341
+ modes: RecordedSessionReplayProofCoverageSnapshotModeRowV1[];
1342
+ }
1343
+ export interface RecordedSessionReplayProofHardeningSnapshotModeRowV1 {
1344
+ mode: RecordedSessionReplayMode;
1345
+ warningCount: number;
1346
+ compileFailureCount: number;
1347
+ promotionCount: number;
1348
+ exportTurnCount: number;
1349
+ attributedTurnCount: number;
1350
+ }
1351
+ export interface RecordedSessionReplayProofHardeningSnapshotV1 {
1352
+ contract: "recorded_session_replay_hardening_snapshot.v1";
1353
+ traceId: string;
1354
+ totalTurns: number;
1355
+ compileFailureCount: number;
1356
+ compileFailureRate: number | null;
1357
+ warningCount: number;
1358
+ promotionCount: number;
1359
+ exportTurnCount: number;
1360
+ attributedTurnCount: number;
1361
+ modes: RecordedSessionReplayProofHardeningSnapshotModeRowV1[];
1362
+ }
1363
+ export interface RecordedSessionReplayProofFileHashEntryV1 {
1364
+ path: string;
1365
+ digest: string;
1366
+ }
1367
+ export interface RecordedSessionReplayProofHashesV1 {
1368
+ contract: "recorded_session_replay_hashes.v1";
1369
+ algorithm: "sha256";
1370
+ semantic: {
1371
+ traceHash: string;
1372
+ fixtureHash: string;
1373
+ scoreHash: string;
1374
+ bundleHash: string;
1375
+ };
1376
+ files: RecordedSessionReplayProofFileHashEntryV1[];
1377
+ }
1378
+ export interface RecordedSessionReplayProofModeOutputV1 {
1379
+ mode: RecordedSessionReplayMode;
1380
+ path: string;
1381
+ report: RecordedSessionReplayModeReportV1;
1382
+ }
1383
+ export interface RecordedSessionReplayProofBundleDescriptorV1 {
1384
+ rootDir: string;
1385
+ manifestPath: string;
1386
+ tracePath: string;
1387
+ fixturePath: string;
1388
+ bundlePath: string;
1389
+ environmentPath: string;
1390
+ summaryPath: string;
1391
+ summaryTablesPath: string;
1392
+ coverageSnapshotPath: string;
1393
+ hardeningSnapshotPath: string;
1394
+ hashesPath: string;
1395
+ manifest: RecordedSessionReplayProofManifestV1;
1396
+ trace: RecordedSessionTraceV1;
1397
+ fixture: RecordedSessionReplayFixtureV1;
1398
+ bundle: RecordedSessionReplayBundleV1;
1399
+ environment: RecordedSessionReplayProofEnvironmentV1;
1400
+ summaryText: string;
1401
+ summaryTables: RecordedSessionReplayProofSummaryTablesV1;
1402
+ coverageSnapshot: RecordedSessionReplayProofCoverageSnapshotV1;
1403
+ hardeningSnapshot: RecordedSessionReplayProofHardeningSnapshotV1;
1404
+ hashes: RecordedSessionReplayProofHashesV1;
1405
+ modeOutputs: RecordedSessionReplayProofModeOutputV1[];
1406
+ }
1407
+ export interface RecordedSessionReplayProofBundleValidationV1 {
1408
+ contract: "recorded_session_replay_proof_validation.v1";
1409
+ ok: boolean;
1410
+ rootDir: string;
1411
+ expectedFileCount: number;
1412
+ verifiedFileCount: number;
1413
+ fileHashesMatch: boolean;
1414
+ bundleHashMatches: boolean;
1415
+ scoreHashMatches: boolean;
1416
+ errors: string[];
1417
+ }
1418
+ export interface WriteRecordedSessionReplayProofBundleInputV1 {
1419
+ rootDir: string;
1420
+ trace: RecordedSessionTraceV1;
1421
+ scratchRootDir?: string | null;
1422
+ }
1186
1423
  export declare function buildRecordedSessionReplayFixture(trace: RecordedSessionTraceV1): RecordedSessionReplayFixtureV1;
1187
1424
  export declare function runRecordedSessionReplay(rootDir: string, fixture: RecordedSessionReplayFixtureV1): RecordedSessionReplayBundleV1;
1188
1425
  export declare function rescoreRecordedSessionReplayBundle(bundle: RecordedSessionReplayBundleV1): RecordedSessionReplayRescoreReportV1;
1189
1426
  export declare function verifyRecordedSessionReplayBundleHashes(bundle: RecordedSessionReplayBundleV1): RecordedSessionReplayBundleHashVerificationV1;
1427
+ export declare function loadRecordedSessionReplayProofBundle(rootDir: string): RecordedSessionReplayProofBundleDescriptorV1;
1428
+ export declare function validateRecordedSessionReplayProofBundle(rootDir: string): RecordedSessionReplayProofBundleValidationV1;
1429
+ export declare function writeRecordedSessionReplayProofBundle(input: WriteRecordedSessionReplayProofBundleInputV1): RecordedSessionReplayProofBundleDescriptorV1;
1190
1430
  export type OperatorSurfaceStatus = "ok" | "warn" | "fail";
1191
1431
  export type OperatorFindingSeverity = "pass" | "warn" | "fail";
1192
1432
  export type OperatorLastPromotionConfidence = "proven_from_previous_pointer" | "unknown_from_local_pointers" | "no_active_pack";
@@ -1574,6 +1814,10 @@ interface OperatorHookSummary {
1574
1814
  installState: CurrentProfileHookInstallStateV1;
1575
1815
  loadability: CurrentProfileHookLoadabilityV1;
1576
1816
  loadProof: CurrentProfileHookLoadProofV1;
1817
+ guardSeverity: import("./openclaw-hook-truth.js").OpenClawBrainHookGuardSeverity;
1818
+ guardActionability: import("./openclaw-hook-truth.js").OpenClawBrainHookGuardActionability;
1819
+ guardSummary: string;
1820
+ guardAction: string;
1577
1821
  desynced: boolean;
1578
1822
  detail: string;
1579
1823
  }