@openclawbrain/cli 0.4.14 → 0.4.15

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.
@@ -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;
@@ -1013,7 +1035,7 @@ export declare function writeRuntimeEventExportBundle(turn: OpenClawRuntimeTurnI
1013
1035
  export declare function writeScannedEventExportBundle(input: WriteScannedEventExportBundleInputV1): WriteScannedEventExportBundleResultV1;
1014
1036
  export declare function runRuntimeTurn(turn: OpenClawRuntimeTurnInput, options?: RunRuntimeTurnOptions): RuntimeTurnResult;
1015
1037
  export declare function runContinuousProductLoopTurn(input: RunContinuousProductLoopTurnInput): ContinuousProductLoopTurnResultV1;
1016
- export type RecordedSessionReplayMode = "no_brain" | "seed_pack" | "learned_replay";
1038
+ export type RecordedSessionReplayMode = "no_brain" | RuntimeComparativeReplayMode;
1017
1039
  export interface RecordedSessionReplayWorkspaceV1 {
1018
1040
  workspaceId: string;
1019
1041
  snapshotId: string;
@@ -1059,6 +1081,7 @@ export interface RecordedSessionTraceV1 {
1059
1081
  notes: string[];
1060
1082
  };
1061
1083
  workspace: RecordedSessionReplayWorkspaceV1;
1084
+ evalTurnCount?: number;
1062
1085
  seedBuiltAt: string;
1063
1086
  seedActivatedAt: string;
1064
1087
  seedCues: readonly RecordedSessionSeedCueV1[];
@@ -1080,17 +1103,24 @@ export interface RecordedSessionReplayFixtureV1 {
1080
1103
  fixtureHash: string;
1081
1104
  privacy: RecordedSessionTraceV1["privacy"];
1082
1105
  workspace: RecordedSessionReplayWorkspaceV1;
1106
+ evalTurnCount?: number;
1083
1107
  seedBuiltAt: string;
1084
1108
  seedActivatedAt: string;
1085
1109
  seedExport: NormalizedEventExportV1;
1086
1110
  turns: RecordedSessionReplayTurnFixtureV1[];
1087
1111
  }
1112
+ export type RecordedSessionReplayTurnPhase = "train" | "eval";
1088
1113
  export interface RecordedSessionReplayTurnReportV1 {
1089
1114
  turnId: string;
1115
+ replayMode: RecordedSessionReplayMode;
1116
+ phase: RecordedSessionReplayTurnPhase;
1090
1117
  compileOk: boolean;
1091
1118
  fallbackToStaticContext: boolean;
1092
1119
  hardRequirementViolated: boolean;
1093
1120
  activePackId: string | null;
1121
+ modeRequested: RouteMode | null;
1122
+ modeEffective: RouteMode | null;
1123
+ selectionEngine: CompileSelectionMode | null;
1094
1124
  usedLearnedRouteFn: boolean;
1095
1125
  routerIdentity: string | null;
1096
1126
  selectionDigest: string | null;
@@ -1136,6 +1166,9 @@ export interface RecordedSessionReplayScannerEvidenceV1 {
1136
1166
  }
1137
1167
  export interface RecordedSessionReplayModeSummaryV1 {
1138
1168
  mode: RecordedSessionReplayMode;
1169
+ activationStrategy: "no_brain" | "seed_pack" | "continuous_learned_loop";
1170
+ modeRequested: RouteMode | null;
1171
+ selectionEngine: CompileSelectionMode | null;
1139
1172
  qualityScore: number;
1140
1173
  compileOkCount: number;
1141
1174
  phraseHitCount: number;
@@ -1143,6 +1176,10 @@ export interface RecordedSessionReplayModeSummaryV1 {
1143
1176
  usedLearnedRouteTurnCount: number;
1144
1177
  promotionCount: number;
1145
1178
  packIds: string[];
1179
+ trainTurnCount: number;
1180
+ evalTurnCount: number;
1181
+ frozenEvalPackId: string | null;
1182
+ frozenEvalRouterIdentity: string | null;
1146
1183
  scannerEvidence: RecordedSessionReplayScannerEvidenceV1;
1147
1184
  scoreHash: string;
1148
1185
  }
@@ -1183,10 +1220,208 @@ export interface RecordedSessionReplayBundleHashVerificationV1 {
1183
1220
  bundleHashMatches: boolean;
1184
1221
  scoreHashMatches: boolean;
1185
1222
  }
1223
+ export interface RecordedSessionReplayProofManifestV1 {
1224
+ contract: "recorded_session_replay_proof_manifest.v1";
1225
+ traceId: string;
1226
+ source: RecordedSessionReplayBundleV1["source"];
1227
+ recordedAt: string;
1228
+ generatedAt: string;
1229
+ hashAlgorithm: "sha256";
1230
+ modeOrder: RecordedSessionReplayMode[];
1231
+ contracts: {
1232
+ trace: typeof RECORDED_SESSION_TRACE_CONTRACT;
1233
+ fixture: typeof RECORDED_SESSION_FIXTURE_CONTRACT;
1234
+ bundle: typeof RECORDED_SESSION_BUNDLE_CONTRACT;
1235
+ environment: "recorded_session_replay_environment.v1";
1236
+ summaryTables: "recorded_session_replay_summary_tables.v1";
1237
+ coverageSnapshot: "recorded_session_replay_coverage_snapshot.v1";
1238
+ hardeningSnapshot: "recorded_session_replay_hardening_snapshot.v1";
1239
+ hashes: "recorded_session_replay_hashes.v1";
1240
+ };
1241
+ hashes: {
1242
+ traceHash: string;
1243
+ fixtureHash: string;
1244
+ scoreHash: string;
1245
+ bundleHash: string;
1246
+ };
1247
+ files: {
1248
+ trace: string;
1249
+ fixture: string;
1250
+ bundle: string;
1251
+ environment: string;
1252
+ summary: string;
1253
+ summaryTables: string;
1254
+ coverageSnapshot: string;
1255
+ hardeningSnapshot: string;
1256
+ hashes: string;
1257
+ modes: Array<{
1258
+ mode: RecordedSessionReplayMode;
1259
+ path: string;
1260
+ }>;
1261
+ };
1262
+ }
1263
+ export interface RecordedSessionReplayProofEnvironmentV1 {
1264
+ contract: "recorded_session_replay_environment.v1";
1265
+ runtimeOwner: "openclaw";
1266
+ generator: {
1267
+ packageName: "@openclawbrain/cli";
1268
+ entrypoint: "writeRecordedSessionReplayProofBundle";
1269
+ nodeVersion: string;
1270
+ platform: string;
1271
+ arch: string;
1272
+ };
1273
+ determinism: {
1274
+ hashAlgorithm: "sha256";
1275
+ canonicalJson: true;
1276
+ modeOrder: RecordedSessionReplayMode[];
1277
+ scratchReplayRoot: "temporary_directory";
1278
+ };
1279
+ }
1280
+ export interface RecordedSessionReplayProofModeTableRowV1 {
1281
+ mode: RecordedSessionReplayMode;
1282
+ turnCount: number;
1283
+ qualityScore: number;
1284
+ compileOkCount: number;
1285
+ phraseHitCount: number;
1286
+ phraseCount: number;
1287
+ usedLearnedRouteTurnCount: number;
1288
+ promotionCount: number;
1289
+ exportTurnCount: number;
1290
+ humanLabelCount: number;
1291
+ attributedTurnCount: number;
1292
+ activePackChangeCount: number;
1293
+ warningCount: number;
1294
+ scoreHash: string;
1295
+ }
1296
+ export interface RecordedSessionReplayProofTurnTableRowV1 {
1297
+ mode: RecordedSessionReplayMode;
1298
+ turnId: string;
1299
+ qualityScore: number;
1300
+ compileOk: boolean;
1301
+ phraseHitCount: number;
1302
+ phraseCount: number;
1303
+ usedLearnedRouteFn: boolean;
1304
+ promoted: boolean;
1305
+ activePackId: string | null;
1306
+ selectionDigest: string | null;
1307
+ eventExportDigest: string | null;
1308
+ warningCount: number;
1309
+ }
1310
+ export interface RecordedSessionReplayProofSummaryTablesV1 {
1311
+ contract: "recorded_session_replay_summary_tables.v1";
1312
+ traceId: string;
1313
+ winnerMode: RecordedSessionReplayMode | null;
1314
+ ranking: RecordedSessionReplayBundleV1["summary"]["ranking"];
1315
+ modes: RecordedSessionReplayProofModeTableRowV1[];
1316
+ turns: RecordedSessionReplayProofTurnTableRowV1[];
1317
+ }
1318
+ export interface RecordedSessionReplayProofCoverageSnapshotModeRowV1 {
1319
+ mode: RecordedSessionReplayMode;
1320
+ turnCount: number;
1321
+ compileOkRate: number | null;
1322
+ phraseHitRate: number | null;
1323
+ learnedRouteTurnRate: number | null;
1324
+ attributedTurnRate: number | null;
1325
+ }
1326
+ export interface RecordedSessionReplayProofCoverageSnapshotV1 {
1327
+ contract: "recorded_session_replay_coverage_snapshot.v1";
1328
+ traceId: string;
1329
+ winnerMode: RecordedSessionReplayMode | null;
1330
+ totalTurns: number;
1331
+ compileOkTurnCount: number;
1332
+ compileOkRate: number | null;
1333
+ phraseHitCount: number;
1334
+ phraseCount: number;
1335
+ phraseHitRate: number | null;
1336
+ modes: RecordedSessionReplayProofCoverageSnapshotModeRowV1[];
1337
+ }
1338
+ export interface RecordedSessionReplayProofHardeningSnapshotModeRowV1 {
1339
+ mode: RecordedSessionReplayMode;
1340
+ warningCount: number;
1341
+ compileFailureCount: number;
1342
+ promotionCount: number;
1343
+ exportTurnCount: number;
1344
+ attributedTurnCount: number;
1345
+ }
1346
+ export interface RecordedSessionReplayProofHardeningSnapshotV1 {
1347
+ contract: "recorded_session_replay_hardening_snapshot.v1";
1348
+ traceId: string;
1349
+ totalTurns: number;
1350
+ compileFailureCount: number;
1351
+ compileFailureRate: number | null;
1352
+ warningCount: number;
1353
+ promotionCount: number;
1354
+ exportTurnCount: number;
1355
+ attributedTurnCount: number;
1356
+ modes: RecordedSessionReplayProofHardeningSnapshotModeRowV1[];
1357
+ }
1358
+ export interface RecordedSessionReplayProofFileHashEntryV1 {
1359
+ path: string;
1360
+ digest: string;
1361
+ }
1362
+ export interface RecordedSessionReplayProofHashesV1 {
1363
+ contract: "recorded_session_replay_hashes.v1";
1364
+ algorithm: "sha256";
1365
+ semantic: {
1366
+ traceHash: string;
1367
+ fixtureHash: string;
1368
+ scoreHash: string;
1369
+ bundleHash: string;
1370
+ };
1371
+ files: RecordedSessionReplayProofFileHashEntryV1[];
1372
+ }
1373
+ export interface RecordedSessionReplayProofModeOutputV1 {
1374
+ mode: RecordedSessionReplayMode;
1375
+ path: string;
1376
+ report: RecordedSessionReplayModeReportV1;
1377
+ }
1378
+ export interface RecordedSessionReplayProofBundleDescriptorV1 {
1379
+ rootDir: string;
1380
+ manifestPath: string;
1381
+ tracePath: string;
1382
+ fixturePath: string;
1383
+ bundlePath: string;
1384
+ environmentPath: string;
1385
+ summaryPath: string;
1386
+ summaryTablesPath: string;
1387
+ coverageSnapshotPath: string;
1388
+ hardeningSnapshotPath: string;
1389
+ hashesPath: string;
1390
+ manifest: RecordedSessionReplayProofManifestV1;
1391
+ trace: RecordedSessionTraceV1;
1392
+ fixture: RecordedSessionReplayFixtureV1;
1393
+ bundle: RecordedSessionReplayBundleV1;
1394
+ environment: RecordedSessionReplayProofEnvironmentV1;
1395
+ summaryText: string;
1396
+ summaryTables: RecordedSessionReplayProofSummaryTablesV1;
1397
+ coverageSnapshot: RecordedSessionReplayProofCoverageSnapshotV1;
1398
+ hardeningSnapshot: RecordedSessionReplayProofHardeningSnapshotV1;
1399
+ hashes: RecordedSessionReplayProofHashesV1;
1400
+ modeOutputs: RecordedSessionReplayProofModeOutputV1[];
1401
+ }
1402
+ export interface RecordedSessionReplayProofBundleValidationV1 {
1403
+ contract: "recorded_session_replay_proof_validation.v1";
1404
+ ok: boolean;
1405
+ rootDir: string;
1406
+ expectedFileCount: number;
1407
+ verifiedFileCount: number;
1408
+ fileHashesMatch: boolean;
1409
+ bundleHashMatches: boolean;
1410
+ scoreHashMatches: boolean;
1411
+ errors: string[];
1412
+ }
1413
+ export interface WriteRecordedSessionReplayProofBundleInputV1 {
1414
+ rootDir: string;
1415
+ trace: RecordedSessionTraceV1;
1416
+ scratchRootDir?: string | null;
1417
+ }
1186
1418
  export declare function buildRecordedSessionReplayFixture(trace: RecordedSessionTraceV1): RecordedSessionReplayFixtureV1;
1187
1419
  export declare function runRecordedSessionReplay(rootDir: string, fixture: RecordedSessionReplayFixtureV1): RecordedSessionReplayBundleV1;
1188
1420
  export declare function rescoreRecordedSessionReplayBundle(bundle: RecordedSessionReplayBundleV1): RecordedSessionReplayRescoreReportV1;
1189
1421
  export declare function verifyRecordedSessionReplayBundleHashes(bundle: RecordedSessionReplayBundleV1): RecordedSessionReplayBundleHashVerificationV1;
1422
+ export declare function loadRecordedSessionReplayProofBundle(rootDir: string): RecordedSessionReplayProofBundleDescriptorV1;
1423
+ export declare function validateRecordedSessionReplayProofBundle(rootDir: string): RecordedSessionReplayProofBundleValidationV1;
1424
+ export declare function writeRecordedSessionReplayProofBundle(input: WriteRecordedSessionReplayProofBundleInputV1): RecordedSessionReplayProofBundleDescriptorV1;
1190
1425
  export type OperatorSurfaceStatus = "ok" | "warn" | "fail";
1191
1426
  export type OperatorFindingSeverity = "pass" | "warn" | "fail";
1192
1427
  export type OperatorLastPromotionConfidence = "proven_from_previous_pointer" | "unknown_from_local_pointers" | "no_active_pack";
@@ -1574,6 +1809,10 @@ interface OperatorHookSummary {
1574
1809
  installState: CurrentProfileHookInstallStateV1;
1575
1810
  loadability: CurrentProfileHookLoadabilityV1;
1576
1811
  loadProof: CurrentProfileHookLoadProofV1;
1812
+ guardSeverity: import("./openclaw-hook-truth.js").OpenClawBrainHookGuardSeverity;
1813
+ guardActionability: import("./openclaw-hook-truth.js").OpenClawBrainHookGuardActionability;
1814
+ guardSummary: string;
1815
+ guardAction: string;
1577
1816
  desynced: boolean;
1578
1817
  detail: string;
1579
1818
  }