@openclawbrain/openclaw 0.1.10 → 0.1.12

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.
@@ -1,6 +1,7 @@
1
- import { CONTRACT_IDS, type ArtifactManifestV1, type ActivationPointerRecordV1, type ActivationPointerSlot, type RuntimeTurnBrainAttachmentPolicyV1, type ContextCompactionMode, type ContextContributionEvidenceStateV1, type CurrentProfileBrainStatusAnswerV1, type FeedbackEventKind, type FeedbackEventV1, type KernelSurfaceValidationResultV1, type LearningBootProfile, type InteractionEventV1, type NormalizedEventExportV1, type NormalizedEventV1, type RouteMode, type RuntimeCompileResponseV1, type RuntimeCompileTargetV1, type RuntimeGraphPlasticityStateV1, type RuntimePlasticitySourceV1, type SparseFeedbackPolicyV1, type TeacherSupervisionArtifactV1, type WorkspaceInjectionSurfaceV1 } from "@openclawbrain/contracts";
1
+ import { CONTRACT_IDS, type ArtifactManifestV1, type ActivationPointerRecordV1, type ActivationPointerSlot, type RuntimeTurnBrainAttachmentPolicyV1, type ContextCompactionMode, type ContextContributionEvidenceStateV1, type CurrentProfileBrainStatusAnswerV1, type CurrentProfileStructuralDecisionV1, type FeedbackEventKind, type PackGraphEvolutionV1, type FeedbackEventV1, type KernelSurfaceValidationResultV1, type LearningBootProfile, 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";
2
+ import { type EventExportLaneV1 } from "@openclawbrain/event-export";
2
3
  import { type AdvanceAlwaysOnLearningRuntimeInput, type AlwaysOnLearningCadenceV1, type AlwaysOnLearningMaterializationJobV1, type AlwaysOnLearningRuntimePlanV1, type AlwaysOnLearningRuntimeStateV1, type PendingPrincipalEventV1, type PrincipalLearningCheckpointV1 } from "@openclawbrain/learner";
3
- import { type ActivationInspection, type ActivationObservabilityReport, type ActivationSlotInspection, type InitHandoffState } from "@openclawbrain/pack-format";
4
+ import { type ActivationInspection, type ActivationObservabilityReport, type GraphEvolutionLogV1, type ActivationSlotInspection, type InitHandoffState } from "@openclawbrain/pack-format";
4
5
  export declare const DEFAULT_ASYNC_TEACHER_QUEUE_CAPACITY = 8;
5
6
  declare const RECORDED_SESSION_TRACE_CONTRACT: "recorded_session_trace.v1";
6
7
  declare const RECORDED_SESSION_FIXTURE_CONTRACT: "recorded_session_replay_fixture.v1";
@@ -20,6 +21,38 @@ export interface RuntimeEventExportBundleSummaryV1 {
20
21
  sourceStreams: string[];
21
22
  contracts: NormalizedEventExportV1["provenance"]["contracts"];
22
23
  }
24
+ export type ScannerExportStatusV1 = "complete" | "partial" | "failed";
25
+ export interface ScannerExportManifestV1 {
26
+ scannerId: string;
27
+ lane: string;
28
+ status: ScannerExportStatusV1;
29
+ producedAt: string;
30
+ sourceManifestPath: string | null;
31
+ sourceManifestDigest: string | null;
32
+ warnings: string[];
33
+ failures: string[];
34
+ }
35
+ export interface ScannedEventExportInputV1 {
36
+ interactionEvents: readonly InteractionEventV1[];
37
+ feedbackEvents: readonly FeedbackEventV1[];
38
+ scanner: ScannerExportManifestV1;
39
+ }
40
+ export type ScannedEventExportNoopReasonV1 = "scan_failed" | "no_events" | "invalid_scanner_manifest";
41
+ export interface ScannedEventExportBuildSuccessV1 {
42
+ ok: true;
43
+ normalizedEventExport: NormalizedEventExportV1;
44
+ scanner: ScannerExportManifestV1;
45
+ warnings: string[];
46
+ }
47
+ export interface ScannedEventExportBuildFailureV1 {
48
+ ok: false;
49
+ normalizedEventExport: null;
50
+ scanner: ScannerExportManifestV1;
51
+ warnings: string[];
52
+ reason: ScannedEventExportNoopReasonV1;
53
+ error: string;
54
+ }
55
+ export type ScannedEventExportBuildResultV1 = ScannedEventExportBuildSuccessV1 | ScannedEventExportBuildFailureV1;
23
56
  export interface RuntimeEventExportBundleManifestV1 {
24
57
  contract: typeof RUNTIME_EVENT_EXPORT_BUNDLE_CONTRACT;
25
58
  exportName: string;
@@ -27,6 +60,7 @@ export interface RuntimeEventExportBundleManifestV1 {
27
60
  payloadPath: string;
28
61
  payloadDigest: string;
29
62
  summary: RuntimeEventExportBundleSummaryV1;
63
+ scanner?: ScannerExportManifestV1 | null;
30
64
  }
31
65
  export interface RuntimeEventExportBundleDescriptor {
32
66
  rootDir: string;
@@ -35,11 +69,13 @@ export interface RuntimeEventExportBundleDescriptor {
35
69
  manifest: RuntimeEventExportBundleManifestV1;
36
70
  normalizedEventExport: NormalizedEventExportV1;
37
71
  }
72
+ export type CompileRuntimeBudgetStrategy = "fixed_v1" | "empirical_v1";
38
73
  export interface CompileRuntimeContextInput {
39
74
  activationRoot: string;
40
75
  message: string;
41
76
  agentId?: string;
42
77
  maxContextBlocks?: number;
78
+ budgetStrategy?: CompileRuntimeBudgetStrategy;
43
79
  maxContextChars?: number;
44
80
  mode?: RouteMode;
45
81
  compactionMode?: ContextCompactionMode;
@@ -185,7 +221,9 @@ export interface RollbackRuntimeAttachResult {
185
221
  parkedCandidatePackId: string | null;
186
222
  }
187
223
  export interface BootstrapRuntimeAttachInput {
188
- profileSelector?: "current_profile";
224
+ profileSelector?: string | null;
225
+ profileId?: string | null;
226
+ brainAttachmentPolicy?: RuntimeTurnBrainAttachmentPolicyV1 | null;
189
227
  activationRoot: string;
190
228
  packRoot: string;
191
229
  packLabel: string;
@@ -208,7 +246,8 @@ export interface BootstrapRuntimeAttachNextStepV1 {
208
246
  }
209
247
  export interface BootstrapRuntimeAttachResult {
210
248
  runtimeOwner: "openclaw";
211
- profileSelector: "current_profile";
249
+ profileSelector: string;
250
+ operatorReadScope: "current_profile_only";
212
251
  activationRoot: string;
213
252
  packRoot: string;
214
253
  packId: string;
@@ -237,25 +276,38 @@ export interface RuntimeTurnFeedbackInput {
237
276
  kind?: FeedbackEventKind | null;
238
277
  messageId?: string | null;
239
278
  relatedInteractionId?: string | null;
279
+ actorName?: string | null;
280
+ priorityHint?: PrincipalPriorityClassV1 | null;
240
281
  }
241
282
  export interface RuntimeTurnExportInput {
242
283
  rootDir: string;
243
284
  exportName?: string | null;
244
285
  exportedAt?: string | null;
245
286
  }
287
+ export interface RuntimeTurnContextFingerprintInputV1 {
288
+ promptContextFingerprints?: readonly string[] | null;
289
+ workspaceInjectionSurface?: WorkspaceInjectionSurfaceV1 | null;
290
+ profileLineage?: readonly string[] | null;
291
+ sessionLineage?: readonly string[] | null;
292
+ }
246
293
  export interface OpenClawRuntimeTurnInput {
247
294
  activationRoot?: string | null;
248
295
  agentId?: string | null;
296
+ profileSelector?: string | null;
297
+ profileId?: string | null;
249
298
  sessionId: string;
250
299
  channel: string;
300
+ userId?: string | null;
251
301
  sourceStream?: string | null;
252
302
  userMessage: string;
253
303
  createdAt?: string | null;
254
304
  sequenceStart?: number | null;
255
305
  maxContextBlocks?: number;
306
+ budgetStrategy?: CompileRuntimeBudgetStrategy;
256
307
  mode?: RouteMode;
257
308
  runtimeHints?: readonly string[];
258
309
  brainAttachmentPolicy?: RuntimeTurnBrainAttachmentPolicyV1 | null;
310
+ contextFingerprint?: RuntimeTurnContextFingerprintInputV1 | null;
259
311
  compile?: RuntimeTurnCompileInput | null;
260
312
  delivery?: boolean | RuntimeTurnDeliveryInput | null;
261
313
  feedback?: readonly (RuntimeTurnFeedbackInput | null)[] | null;
@@ -289,7 +341,7 @@ export type RuntimeTurnResult = RuntimeCompileResult & {
289
341
  eventExport: RuntimeEventExportResult;
290
342
  warnings: string[];
291
343
  };
292
- export type TeacherLoopNoOpReason = "none" | "duplicate_export" | "queue_full" | "no_teacher_artifacts";
344
+ export type TeacherLoopNoOpReason = "none" | "duplicate_export" | "queue_full" | "no_teacher_artifacts" | "empty_scan";
293
345
  export interface AsyncTeacherLiveLoopInput extends Pick<AdvanceAlwaysOnLearningRuntimeInput, "packLabel" | "workspace" | "learnedRouting" | "builtAt" | "offlineArtifacts" | "structuralOps" | "sparseFeedback" | "liveSliceSize" | "backfillSliceSize" | "cadence"> {
294
346
  maxQueuedExports?: number;
295
347
  staleAfterMs?: number;
@@ -337,6 +389,45 @@ export interface AsyncTeacherEnqueueResultV1 {
337
389
  notes: string[];
338
390
  reason: Exclude<TeacherLoopNoOpReason, "none"> | null;
339
391
  }
392
+ export interface AsyncTeacherScannedEnqueueResultV1 {
393
+ accepted: boolean;
394
+ exportDigest: string | null;
395
+ queueDepth: number;
396
+ notes: string[];
397
+ reason: Exclude<TeacherLoopNoOpReason, "none"> | ScannedEventExportNoopReasonV1 | null;
398
+ warnings: string[];
399
+ error: string | null;
400
+ scanner: ScannerExportManifestV1;
401
+ }
402
+ export type AsyncTeacherScannerScanNoOpReasonV1 = "none" | "empty_scan" | "duplicate_exports" | "queue_full";
403
+ export interface AsyncTeacherScannerScanHitResultV1 {
404
+ lane: EventExportLaneV1;
405
+ exportDigest: string;
406
+ exportName: string;
407
+ exportedAt: string;
408
+ eventRange: Pick<NormalizedEventExportV1["range"], "start" | "end" | "count">;
409
+ accepted: boolean;
410
+ queueDepth: number;
411
+ reason: AsyncTeacherEnqueueResultV1["reason"];
412
+ }
413
+ export interface AsyncTeacherScannerScanResultV1 {
414
+ runtimeOwner: "openclaw";
415
+ scanRoot: string;
416
+ scannedAt: string;
417
+ selectedCount: number;
418
+ acceptedCount: number;
419
+ duplicateCount: number;
420
+ droppedCount: number;
421
+ liveAcceptedCount: number;
422
+ backfillAcceptedCount: number;
423
+ duplicateScannerDigestCount: number;
424
+ staleSkippedCount: number;
425
+ invalidBundleCount: number;
426
+ noOpReason: AsyncTeacherScannerScanNoOpReasonV1;
427
+ notes: string[];
428
+ results: AsyncTeacherScannerScanHitResultV1[];
429
+ snapshot: AsyncTeacherLiveLoopSnapshotV1;
430
+ }
340
431
  export interface CanonicalSupervisionFeedbackRecordV1 {
341
432
  eventId: string;
342
433
  kind: FeedbackEventKind;
@@ -459,6 +550,10 @@ export declare class AsyncTeacherLiveLoop {
459
550
  enqueueNormalizedEventExport(normalizedEventExport: NormalizedEventExportV1, options?: {
460
551
  observedAt?: string;
461
552
  }): AsyncTeacherEnqueueResultV1;
553
+ enqueueScannedEventExport(scannedEventExport: ScannedEventExportInputV1, options?: {
554
+ observedAt?: string;
555
+ }): AsyncTeacherScannedEnqueueResultV1;
556
+ ingestRuntimeEventExportScannerScan(scan: RuntimeEventExportScannerScanResultV1): Promise<AsyncTeacherScannerScanResultV1>;
462
557
  flush(): Promise<AsyncTeacherLiveLoopSnapshotV1>;
463
558
  snapshot(): AsyncTeacherLiveLoopSnapshotV1;
464
559
  private ensureDrain;
@@ -466,23 +561,263 @@ export declare class AsyncTeacherLiveLoop {
466
561
  private refreshNotes;
467
562
  }
468
563
  export declare function createAsyncTeacherLiveLoop(input: AsyncTeacherLiveLoopInput): AsyncTeacherLiveLoop;
564
+ export interface ScannerLiveWorkspaceInputV1 {
565
+ workspaceId: string;
566
+ snapshotId: string;
567
+ capturedAt: string;
568
+ rootDir: string;
569
+ branch?: string | null;
570
+ revision?: string | null;
571
+ dirty?: boolean;
572
+ manifestDigest?: string | null;
573
+ labels?: readonly string[];
574
+ files?: readonly string[];
575
+ }
576
+ export interface ScanRecordedSessionInputV1 {
577
+ rootDir: string;
578
+ trace: RecordedSessionTraceV1;
579
+ }
580
+ export interface ScanRecordedSessionResultV1 {
581
+ runtimeOwner: "openclaw";
582
+ scanMode: "session";
583
+ rootDir: string;
584
+ fixtureHash: string;
585
+ bundle: RecordedSessionReplayBundleV1;
586
+ }
587
+ export interface ScanLiveEventExportInputV1 {
588
+ normalizedEventExport: NormalizedEventExportV1;
589
+ workspace: ScannerLiveWorkspaceInputV1;
590
+ packLabel?: string | null;
591
+ observedAt?: string | null;
592
+ builtAt?: string | null;
593
+ learnedRouting?: boolean;
594
+ staleAfterMs?: number;
595
+ liveSliceSize?: number;
596
+ backfillSliceSize?: number;
597
+ }
598
+ export interface ScanLiveEventExportResultV1 {
599
+ runtimeOwner: "openclaw";
600
+ scanMode: "live";
601
+ observedAt: string;
602
+ packLabel: string;
603
+ supervision: CanonicalSupervisionV1;
604
+ snapshot: AsyncTeacherLiveLoopSnapshotV1;
605
+ }
606
+ export declare function scanRecordedSession(input: ScanRecordedSessionInputV1): ScanRecordedSessionResultV1;
607
+ export declare function scanLiveEventExport(input: ScanLiveEventExportInputV1): ScanLiveEventExportResultV1;
469
608
  export declare function buildRuntimeEventExportBundleManifest(input: {
470
609
  exportName: string;
471
610
  exportedAt: string;
472
611
  payloadPath: string;
473
612
  normalizedEventExport: NormalizedEventExportV1;
613
+ scanner?: ScannerExportManifestV1 | null;
474
614
  }): RuntimeEventExportBundleManifestV1;
475
615
  export declare function validateRuntimeEventExportBundleManifest(value: RuntimeEventExportBundleManifestV1, normalizedEventExport?: NormalizedEventExportV1): string[];
476
616
  export declare function loadRuntimeEventExportBundle(rootDir: string): RuntimeEventExportBundleDescriptor;
617
+ export declare function buildNormalizedEventExportFromScannedEvents(input: ScannedEventExportInputV1): ScannedEventExportBuildResultV1;
618
+ declare const RUNTIME_EVENT_EXPORT_SCANNER_CHECKPOINT_CONTRACT: "runtime_event_export_scanner_checkpoint.v1";
619
+ export declare const DEFAULT_RUNTIME_EVENT_EXPORT_SCANNER_LIVE_TAIL_BUNDLES = 2;
620
+ export declare const DEFAULT_RUNTIME_EVENT_EXPORT_SCANNER_BACKFILL_BUNDLES_PER_PASS = 1;
621
+ export declare const DEFAULT_RUNTIME_EVENT_EXPORT_SCANNER_STALE_HISTORY_MS: number;
622
+ export declare const DEFAULT_RUNTIME_EVENT_EXPORT_SCANNER_CHECKPOINT_BASENAME = ".openclawbrain-scanner-checkpoint.json";
623
+ export interface RuntimeEventExportScannerBundleCursorV1 {
624
+ exportDigest: string;
625
+ exportName: string;
626
+ exportedAt: string;
627
+ eventRange: Pick<NormalizedEventExportV1["range"], "start" | "end" | "count">;
628
+ }
629
+ export interface RuntimeEventExportScannerCheckpointV1 {
630
+ contract: typeof RUNTIME_EVENT_EXPORT_SCANNER_CHECKPOINT_CONTRACT;
631
+ runtimeOwner: "openclaw";
632
+ scanRoot: string;
633
+ updatedAt: string;
634
+ live: {
635
+ after: RuntimeEventExportScannerBundleCursorV1 | null;
636
+ };
637
+ backfill: {
638
+ before: RuntimeEventExportScannerBundleCursorV1 | null;
639
+ exhausted: boolean;
640
+ staleBefore: string | null;
641
+ };
642
+ processedExportDigests: string[];
643
+ stats: {
644
+ scanPasses: number;
645
+ liveBundlesScanned: number;
646
+ backfillBundlesScanned: number;
647
+ duplicateBundlesSkipped: number;
648
+ staleBundlesSkipped: number;
649
+ invalidBundlesSkipped: number;
650
+ };
651
+ }
652
+ export interface RuntimeEventExportScannerInput {
653
+ scanRoot: string;
654
+ checkpointPath?: string;
655
+ liveTailBundles?: number;
656
+ backfillBundlesPerPass?: number;
657
+ staleHistoryMs?: number;
658
+ }
659
+ export interface RuntimeEventExportScannerInvalidBundleV1 {
660
+ rootDir: string;
661
+ error: string;
662
+ }
663
+ export type RuntimeEventExportScannerPriorityBucketV1 = "live" | "principal_backfill" | "backfill" | "stale_history";
664
+ export interface RuntimeEventExportScannerQueueEntryV1 {
665
+ lane: EventExportLaneV1;
666
+ rootDir: string;
667
+ exportDigest: string;
668
+ exportName: string;
669
+ exportedAt: string;
670
+ eventRange: Pick<NormalizedEventExportV1["range"], "start" | "end" | "count">;
671
+ priorityBucket: RuntimeEventExportScannerPriorityBucketV1;
672
+ priorityScore: number;
673
+ priorityReasons: string[];
674
+ humanLabelCount: number;
675
+ feedbackCount: number;
676
+ teacherRoles: PrincipalRoleV1[];
677
+ teacherAuthorities: TeacherAuthorityV1[];
678
+ priorityClasses: PrincipalPriorityClassV1[];
679
+ scopedPrincipalEventCount: number;
680
+ supersedingPrincipalEventCount: number;
681
+ staleHistory: boolean;
682
+ ageMsFromLatest: number | null;
683
+ }
684
+ export interface RuntimeEventExportScannerHitV1 {
685
+ lane: EventExportLaneV1;
686
+ rootDir: string;
687
+ exportDigest: string;
688
+ exportName: string;
689
+ exportedAt: string;
690
+ eventRange: Pick<NormalizedEventExportV1["range"], "start" | "end" | "count">;
691
+ priorityBucket: RuntimeEventExportScannerPriorityBucketV1;
692
+ priorityScore: number;
693
+ priorityReasons: string[];
694
+ humanLabelCount: number;
695
+ feedbackCount: number;
696
+ teacherRoles: PrincipalRoleV1[];
697
+ teacherAuthorities: TeacherAuthorityV1[];
698
+ priorityClasses: PrincipalPriorityClassV1[];
699
+ scopedPrincipalEventCount: number;
700
+ supersedingPrincipalEventCount: number;
701
+ staleHistory: boolean;
702
+ ageMsFromLatest: number | null;
703
+ normalizedEventExport: NormalizedEventExportV1;
704
+ }
705
+ export interface RuntimeEventExportScannerQueueV1 {
706
+ ageFloor: {
707
+ newestExportedAt: string | null;
708
+ staleBefore: string | null;
709
+ staleHistoryMs: number;
710
+ };
711
+ live: RuntimeEventExportScannerQueueEntryV1[];
712
+ backfill: RuntimeEventExportScannerQueueEntryV1[];
713
+ staleHistory: RuntimeEventExportScannerQueueEntryV1[];
714
+ }
715
+ export interface RuntimeEventExportScannerScanResultV1 {
716
+ runtimeOwner: "openclaw";
717
+ scanRoot: string;
718
+ checkpointPath: string;
719
+ scannedAt: string;
720
+ live: RuntimeEventExportScannerHitV1[];
721
+ backfill: RuntimeEventExportScannerHitV1[];
722
+ selected: RuntimeEventExportScannerHitV1[];
723
+ queue: RuntimeEventExportScannerQueueV1;
724
+ duplicateExportDigests: string[];
725
+ staleSkippedExportDigests: string[];
726
+ invalidBundles: RuntimeEventExportScannerInvalidBundleV1[];
727
+ idle: boolean;
728
+ checkpoint: RuntimeEventExportScannerCheckpointV1;
729
+ }
730
+ export interface RuntimeEventExportScannerLoopOptionsV1 {
731
+ pollIntervalMs?: number;
732
+ maxPasses?: number;
733
+ stopWhenIdle?: boolean;
734
+ signal?: AbortSignal;
735
+ onPass?: (result: RuntimeEventExportScannerScanResultV1) => void | Promise<void>;
736
+ }
737
+ export interface RuntimeEventExportScannerLoopResultV1 {
738
+ runtimeOwner: "openclaw";
739
+ passCount: number;
740
+ liveBundlesScanned: number;
741
+ backfillBundlesScanned: number;
742
+ stoppedReason: "idle" | "max_passes" | "aborted";
743
+ lastScan: RuntimeEventExportScannerScanResultV1 | null;
744
+ checkpoint: RuntimeEventExportScannerCheckpointV1;
745
+ }
746
+ export declare function createRuntimeEventExportScannerCheckpoint(input: {
747
+ scanRoot: string;
748
+ updatedAt?: string;
749
+ }): RuntimeEventExportScannerCheckpointV1;
750
+ export declare function validateRuntimeEventExportScannerCheckpoint(value: RuntimeEventExportScannerCheckpointV1): string[];
751
+ export declare function loadRuntimeEventExportScannerCheckpoint(checkpointPath: string): RuntimeEventExportScannerCheckpointV1;
752
+ export declare class RuntimeEventExportScanner {
753
+ readonly scanRoot: string;
754
+ readonly checkpointPath: string;
755
+ readonly liveTailBundles: number;
756
+ readonly backfillBundlesPerPass: number;
757
+ readonly staleHistoryMs: number;
758
+ private checkpoint;
759
+ constructor(input: RuntimeEventExportScannerInput);
760
+ snapshot(): RuntimeEventExportScannerCheckpointV1;
761
+ scanOnce(options?: {
762
+ scannedAt?: string;
763
+ }): RuntimeEventExportScannerScanResultV1;
764
+ runLoop(options?: RuntimeEventExportScannerLoopOptionsV1): Promise<RuntimeEventExportScannerLoopResultV1>;
765
+ }
766
+ export declare function createRuntimeEventExportScanner(input: RuntimeEventExportScannerInput): RuntimeEventExportScanner;
477
767
  export declare function classifyFeedbackKind(content: string): FeedbackEventKind;
478
768
  export declare function formatPromptContext(compileResponse: RuntimeCompileResponseV1): string;
769
+ export interface EmpiricalStructuralBudgetEvidenceV1 {
770
+ split: number;
771
+ merge: number;
772
+ prune: number;
773
+ connect: number;
774
+ }
775
+ export interface ResolvedCompileBudgetV1 {
776
+ requestedStrategy: CompileRuntimeBudgetStrategy;
777
+ effectiveStrategy: CompileRuntimeBudgetStrategy;
778
+ maxContextBlocks: number;
779
+ defaultMaxContextBlocks: number;
780
+ evidence: EmpiricalStructuralBudgetEvidenceV1;
781
+ evidenceTotal: number;
782
+ tendencies: EmpiricalStructuralBudgetEvidenceV1;
783
+ notes: string[];
784
+ }
785
+ export interface CompileStructuralBudgetSignalEvidenceV1 {
786
+ expansionCandidates: number;
787
+ traversalActivations: number;
788
+ overlapPruned: number;
789
+ }
790
+ export declare function deriveEmpiricalStructuralBudget(input: {
791
+ requestedStrategy?: CompileRuntimeBudgetStrategy;
792
+ requestedMaxContextBlocks?: number;
793
+ evolution?: Pick<PackGraphEvolutionV1, "structuralOps" | "prunedBlockIds"> | null;
794
+ defaultMaxContextBlocks?: number;
795
+ minimumMaxContextBlocks?: number;
796
+ maximumMaxContextBlocks?: number;
797
+ }): ResolvedCompileBudgetV1;
798
+ export declare function deriveEmpiricalStructuralBudgetFromCompileSignals(input: {
799
+ requestedStrategy?: CompileRuntimeBudgetStrategy;
800
+ requestedMaxContextBlocks?: number;
801
+ structuralSignals?: Pick<RuntimeCompileStructuralSignalsV1, "matchedCandidateCount" | "selectedMatchedCount" | "overlapPrunedCount" | "traversalActivatedCount"> | null;
802
+ defaultMaxContextBlocks?: number;
803
+ minimumMaxContextBlocks?: number;
804
+ maximumMaxContextBlocks?: number;
805
+ }): ResolvedCompileBudgetV1;
479
806
  export declare function resolveActivePackForCompile(activationRoot: string): ActiveCompileTarget;
480
807
  export declare function compileRuntimeContext(input: CompileRuntimeContextInput): RuntimeCompileResult;
481
808
  export declare function describeAttachStatus(input: AttachStatusInput): AttachStatusSnapshotV1;
482
809
  export declare function rollbackRuntimeAttach(input: RollbackRuntimeAttachInput): RollbackRuntimeAttachResult;
483
810
  export declare function bootstrapRuntimeAttach(input: BootstrapRuntimeAttachInput): BootstrapRuntimeAttachResult;
484
811
  export declare function buildNormalizedRuntimeEventExport(turn: OpenClawRuntimeTurnInput, compileResult: RuntimeCompileResult): NormalizedEventExportV1;
812
+ export interface WriteScannedEventExportBundleInputV1 {
813
+ rootDir: string;
814
+ exportName?: string | null;
815
+ exportedAt?: string | null;
816
+ scannedEventExport: ScannedEventExportInputV1;
817
+ }
818
+ export type WriteScannedEventExportBundleResultV1 = RuntimeEventExportWriteSuccess | ScannedEventExportBuildFailureV1;
485
819
  export declare function writeRuntimeEventExportBundle(turn: OpenClawRuntimeTurnInput, normalizedEventExport: NormalizedEventExportV1): RuntimeEventExportNoWrite | RuntimeEventExportWriteSuccess;
820
+ export declare function writeScannedEventExportBundle(input: WriteScannedEventExportBundleInputV1): WriteScannedEventExportBundleResultV1;
486
821
  export declare function runRuntimeTurn(turn: OpenClawRuntimeTurnInput, options?: RunRuntimeTurnOptions): RuntimeTurnResult;
487
822
  export declare function runContinuousProductLoopTurn(input: RunContinuousProductLoopTurnInput): ContinuousProductLoopTurnResultV1;
488
823
  export type RecordedSessionReplayMode = "no_brain" | "seed_pack" | "learned_replay";
@@ -576,6 +911,34 @@ export interface RecordedSessionReplayTurnReportV1 {
576
911
  qualityScore: number;
577
912
  compileActiveVersion: number | null;
578
913
  promoted: boolean;
914
+ observability: {
915
+ scanPolicy: LearningScanPolicy | null;
916
+ scanSurfaces: string[];
917
+ humanLabelCount: number;
918
+ selfLabelCount: number;
919
+ totalEventCount: number;
920
+ attributedEventCount: number;
921
+ selectionDigestCount: number;
922
+ freshestSourceStream: string | null;
923
+ freshestCreatedAt: string | null;
924
+ };
925
+ warnings: string[];
926
+ }
927
+ export interface RecordedSessionReplayScannerEvidenceV1 {
928
+ exportTurnCount: number;
929
+ scanPolicy: LearningScanPolicy | null;
930
+ scanSurfaceCount: number;
931
+ scanSurfaces: string[];
932
+ humanLabelCount: number;
933
+ selfLabelCount: number;
934
+ totalEventCount: number;
935
+ attributedEventCount: number;
936
+ attributedTurnCount: number;
937
+ selectionDigestCount: number;
938
+ selectionDigestTurnCount: number;
939
+ activePackChangeCount: number;
940
+ freshestSourceStream: string | null;
941
+ freshestCreatedAt: string | null;
579
942
  warnings: string[];
580
943
  }
581
944
  export interface RecordedSessionReplayModeSummaryV1 {
@@ -587,6 +950,7 @@ export interface RecordedSessionReplayModeSummaryV1 {
587
950
  usedLearnedRouteTurnCount: number;
588
951
  promotionCount: number;
589
952
  packIds: string[];
953
+ scannerEvidence: RecordedSessionReplayScannerEvidenceV1;
590
954
  scoreHash: string;
591
955
  }
592
956
  export interface RecordedSessionReplayModeReportV1 {
@@ -745,6 +1109,7 @@ export interface OperatorSurfaceInput {
745
1109
  updatedAt?: string | null;
746
1110
  eventExportPath?: string | null;
747
1111
  teacherSnapshotPath?: string | null;
1112
+ brainAttachmentPolicy?: RuntimeTurnBrainAttachmentPolicyV1 | null;
748
1113
  }
749
1114
  export interface OperatorSurfaceSlotSummary {
750
1115
  slot: ActivationPointerSlot;
@@ -777,6 +1142,19 @@ export interface OperatorBrainStateSummary {
777
1142
  activeEventExportDigest: string | null;
778
1143
  detail: string;
779
1144
  }
1145
+ export interface OperatorGraphSummary {
1146
+ available: boolean;
1147
+ runtimePlasticitySource: RuntimePlasticitySourceV1 | null;
1148
+ structuralOps: GraphEvolutionLogV1["structuralOps"] | null;
1149
+ changed: boolean | null;
1150
+ operationsApplied: GraphEvolutionLogV1["structuralEvolutionSummary"]["operationsApplied"];
1151
+ liveBlockCount: number | null;
1152
+ prunedBlockCount: number | null;
1153
+ prePruneBlockCount: number | null;
1154
+ strongestBlockId: string | null;
1155
+ operatorSummary: string | null;
1156
+ detail: string;
1157
+ }
780
1158
  export interface OperatorServePathSummary {
781
1159
  state: OperatorServePathState;
782
1160
  fallbackToStaticContext: boolean;
@@ -787,6 +1165,13 @@ export interface OperatorServePathSummary {
787
1165
  selectionMode: string | null;
788
1166
  refreshStatus: string | null;
789
1167
  freshnessChecksum: string | null;
1168
+ requestedBudgetStrategy: string | null;
1169
+ resolvedBudgetStrategy: string | null;
1170
+ resolvedMaxContextBlocks: number | null;
1171
+ structuralBudgetSource: string | null;
1172
+ structuralBudgetEvidence: string | null;
1173
+ structuralBudgetPressures: string | null;
1174
+ structuralDecision: CurrentProfileStructuralDecisionV1;
790
1175
  contextAttribution: ContextAttributionSummaryV1;
791
1176
  error: string | null;
792
1177
  }
@@ -803,11 +1188,18 @@ export interface OperatorSupervisionSummary {
803
1188
  exportDigest: string | null;
804
1189
  exportedAt: string | null;
805
1190
  flowing: boolean | null;
1191
+ scanPolicy: LearningScanPolicy | null;
1192
+ scanSurfaceCount: number;
1193
+ scanSurfaces: string[];
806
1194
  sourceCount: number;
807
1195
  freshestSourceStream: string | null;
808
1196
  freshestCreatedAt: string | null;
809
1197
  freshestKind: string | null;
810
1198
  humanLabelCount: number | null;
1199
+ selfLabelCount: number | null;
1200
+ attributedEventCount: number | null;
1201
+ totalEventCount: number | null;
1202
+ selectionDigestCount: number | null;
811
1203
  sources: string[];
812
1204
  detail: string;
813
1205
  }
@@ -824,19 +1216,26 @@ export interface OperatorTeacherLoopSummary {
824
1216
  notes: string[];
825
1217
  detail: string;
826
1218
  }
1219
+ export type OperatorLearningBacklogState = "unavailable" | "awaiting_first_export" | "principal_live_priority" | "principal_backfill_priority" | "live_priority" | "backfill_only" | "caught_up";
1220
+ export type OperatorLearningWarningState = "teacher_snapshot_unavailable" | "awaiting_first_export" | "principal_live_backlog" | "principal_backfill_pending" | "active_pack_behind_latest_principal" | "passive_backfill_pending" | "teacher_queue_full" | "teacher_labels_stale" | "teacher_no_artifacts";
827
1221
  export interface OperatorLearningSummary {
828
1222
  available: boolean;
829
1223
  sourcePath: string | null;
830
1224
  bootstrapped: boolean | null;
831
1225
  mode: AlwaysOnLearningRuntimePlanV1["mode"] | "unavailable";
832
1226
  nextPriorityLane: AlwaysOnLearningRuntimePlanV1["nextPriorityLane"] | "unavailable";
1227
+ nextPriorityBucket: AlwaysOnLearningRuntimePlanV1["nextPriorityBucket"] | "unavailable";
1228
+ backlogState: OperatorLearningBacklogState;
833
1229
  pendingLive: number | null;
834
1230
  pendingBackfill: number | null;
835
1231
  pendingTotal: number | null;
1232
+ pendingByBucket: AlwaysOnLearningRuntimePlanV1["pending"]["byBucket"] | null;
836
1233
  freshLivePriority: boolean | null;
837
1234
  principalCheckpointCount: number | null;
838
1235
  pendingPrincipalCount: number | null;
839
1236
  oldestUnlearnedPrincipalEvent: PendingPrincipalEventV1 | null;
1237
+ newestPendingPrincipalEvent: PendingPrincipalEventV1 | null;
1238
+ leadingPrincipalCheckpoint: PrincipalLearningCheckpointV1 | null;
840
1239
  principalCheckpoints: PrincipalLearningCheckpointV1[];
841
1240
  principalLagToPromotion: {
842
1241
  activeEventRangeEnd: number | null;
@@ -844,6 +1243,7 @@ export interface OperatorLearningSummary {
844
1243
  sequenceLag: number | null;
845
1244
  status: "unavailable" | "caught_up" | "pending_promotion";
846
1245
  };
1246
+ warningStates: OperatorLearningWarningState[];
847
1247
  learnedRange: RuntimeCompileTargetV1["eventRange"] | null;
848
1248
  materializationCount: number | null;
849
1249
  lastMaterializedAt: string | null;
@@ -890,6 +1290,15 @@ export interface OperatorPrincipalObservabilitySummary {
890
1290
  servingDownstreamOfLatestCorrection: boolean | null;
891
1291
  detail: string;
892
1292
  }
1293
+ interface OperatorManyProfileSupportSummary {
1294
+ operatorSurface: "current_profile_only";
1295
+ declaredAttachmentPolicy: RuntimeTurnBrainAttachmentPolicyV1;
1296
+ sameGatewayIntent: "undeclared" | "dedicated_current_profile_boundary" | "shared_attachment_declared";
1297
+ checkedInProofTopology: "two_local_gateways_dedicated_only";
1298
+ sameGatewayProof: false;
1299
+ sharedWriteSafetyProof: false;
1300
+ detail: string;
1301
+ }
893
1302
  interface OperatorSurfaceReport {
894
1303
  generatedAt: string;
895
1304
  activationRoot: string;
@@ -902,6 +1311,7 @@ interface OperatorSurfaceReport {
902
1311
  candidateAheadBy: string[];
903
1312
  };
904
1313
  brain: OperatorBrainStateSummary;
1314
+ graph: OperatorGraphSummary;
905
1315
  learnedRouting: {
906
1316
  required: boolean;
907
1317
  available: boolean;
@@ -942,10 +1352,12 @@ interface OperatorSurfaceReport {
942
1352
  learning: OperatorLearningSummary;
943
1353
  teacherLoop: OperatorTeacherLoopSummary;
944
1354
  principal: OperatorPrincipalObservabilitySummary;
1355
+ manyProfile: OperatorManyProfileSupportSummary;
945
1356
  findings: OperatorDoctorFinding[];
946
1357
  }
947
1358
  export interface CurrentProfileBrainStatusInput extends OperatorSurfaceInput {
948
1359
  brainAttachmentPolicy?: RuntimeTurnBrainAttachmentPolicyV1 | null;
1360
+ profileId?: string | null;
949
1361
  }
950
1362
  export type CurrentProfileBrainStatusV1 = CurrentProfileBrainStatusAnswerV1;
951
1363
  export declare function buildOperatorSurfaceReport(input: OperatorSurfaceInput): OperatorSurfaceReport;
@@ -1007,3 +1419,6 @@ export { CONTRACT_IDS, buildNormalizedEventExport, createFeedbackEvent, createIn
1007
1419
  export { describeNormalizedEventExportObservability } from "@openclawbrain/event-export";
1008
1420
  export { describeCompileFallbackUsage } from "@openclawbrain/compiler";
1009
1421
  export { describeActivationObservability, inspectActivationState, rollbackActivePack } from "@openclawbrain/pack-format";
1422
+ export { createOpenClawLocalSessionTail, OpenClawLocalSessionTail, type OpenClawLocalSessionTailChangeKindV1, type OpenClawLocalSessionTailChangeV1, type OpenClawLocalSessionTailCursorV1, type OpenClawLocalSessionTailInput, type OpenClawLocalSessionTailLoopOptionsV1, type OpenClawLocalSessionTailLoopResultV1, type OpenClawLocalSessionTailNoopReasonV1, type OpenClawLocalSessionTailPollResultV1 } from "./session-tail.js";
1423
+ export { discoverOpenClawMainSessionStores, loadOpenClawSessionIndex, readOpenClawAcpStreamFile, readOpenClawSessionFile, type OpenClawMainSessionStoreV1, type OpenClawAcpStreamRecord, type OpenClawInjectedWorkspaceFile, type OpenClawSessionContentPart, type OpenClawSessionCustomRecord, type OpenClawSessionHeaderRecord, type OpenClawSessionIndex, type OpenClawSessionIndexEntry, type OpenClawSessionMessagePayload, type OpenClawSessionMessageRecord, type OpenClawSessionModelChangeRecord, type OpenClawSessionRecord, type OpenClawSessionTextPart, type OpenClawSessionThinkingLevelChangeRecord, type OpenClawSessionThinkingPart, type OpenClawSessionToolCallPart, type OpenClawSystemPromptReport, type OpenClawToolSurfaceEntry } from "./session-store.js";
1424
+ export { buildPassiveLearningSessionExportFromOpenClawSessionStore, buildPassiveLearningStoreExportFromOpenClawSessionIndex, type OpenClawPassiveLearningPrivacySummaryV1, type OpenClawPassiveLearningSessionEvidenceV1, type OpenClawPassiveLearningSessionExportV1, type OpenClawPassiveLearningStoreExportV1 } from "./local-session-passive-learning.js";