@openclawbrain/openclaw 0.2.3 → 0.3.0

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.
Files changed (36) hide show
  1. package/dist/extension/index.d.ts +1 -0
  2. package/dist/extension/index.js +73 -0
  3. package/dist/extension/index.js.map +1 -0
  4. package/dist/extension/runtime-guard.d.ts +61 -0
  5. package/dist/extension/runtime-guard.js +230 -0
  6. package/dist/extension/runtime-guard.js.map +1 -0
  7. package/dist/src/cli.d.ts +8 -4
  8. package/dist/src/cli.js +501 -154
  9. package/dist/src/cli.js.map +1 -1
  10. package/dist/src/daemon.d.ts +7 -4
  11. package/dist/src/daemon.js +275 -47
  12. package/dist/src/daemon.js.map +1 -1
  13. package/dist/src/index.d.ts +150 -2
  14. package/dist/src/index.js +769 -139
  15. package/dist/src/index.js.map +1 -1
  16. package/dist/src/learning-spine.d.ts +2 -1
  17. package/dist/src/learning-spine.js +8 -0
  18. package/dist/src/learning-spine.js.map +1 -1
  19. package/dist/src/ollama-client.d.ts +46 -0
  20. package/dist/src/ollama-client.js +231 -0
  21. package/dist/src/ollama-client.js.map +1 -0
  22. package/dist/src/provider-config.d.ts +28 -0
  23. package/dist/src/provider-config.js +150 -0
  24. package/dist/src/provider-config.js.map +1 -0
  25. package/dist/src/resolve-activation-root.d.ts +3 -3
  26. package/dist/src/resolve-activation-root.js +68 -21
  27. package/dist/src/resolve-activation-root.js.map +1 -1
  28. package/dist/src/shadow-extension-proof.d.ts +40 -0
  29. package/dist/src/shadow-extension-proof.js +214 -0
  30. package/dist/src/shadow-extension-proof.js.map +1 -0
  31. package/dist/src/teacher-labeler.d.ts +50 -0
  32. package/dist/src/teacher-labeler.js +424 -0
  33. package/dist/src/teacher-labeler.js.map +1 -0
  34. package/extension/index.ts +5 -1
  35. package/extension/runtime-guard.ts +17 -2
  36. package/package.json +8 -7
@@ -1,8 +1,10 @@
1
1
  import { type CompileSelectionMode } from "@openclawbrain/compiler";
2
- 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 { CONTRACT_IDS, type ArtifactManifestV1, type ActivationPointerRecordV1, type ActivationPointerSlot, type RuntimeTurnBrainAttachmentPolicyV1, type ContextCompactionMode, type ContextContributionEvidenceStateV1, type CurrentProfileBrainStatusAnswerV1, type CurrentProfileActivationStateV1, type CurrentProfileStructuralDecisionV1, type FeedbackEventKind, type PackGraphEvolutionV1, 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
4
  import { type AdvanceAlwaysOnLearningRuntimeInput, type AlwaysOnLearningCadenceV1, type AlwaysOnLearningMaterializationJobV1, type AlwaysOnLearningRuntimePlanV1, type AlwaysOnLearningRuntimeStateV1, type BaselineStateV1, type PendingPrincipalEventV1, type PrincipalLearningCheckpointV1 } from "@openclawbrain/learner";
5
- import { type ActivationInspection, type ActivationObservabilityReport, type GraphEvolutionLogV1, type ActivationSlotInspection, type InitHandoffState, type LearningSpineServeRouteDecisionLogEntryV1 } from "@openclawbrain/pack-format";
5
+ import { type ActivationInspection, type ActivationObservabilityReport, type GraphEvolutionLogV1, type LearningSpineServeRouteBreadcrumbsV1, type ActivationSlotInspection, type InitHandoffState, type LearningSpineServeRouteDecisionLogEntryV1 } from "@openclawbrain/pack-format";
6
+ import { type AsyncTeacherLabelerConfigV1 } from "./teacher-labeler.js";
7
+ export { createHttpOllamaTeacherLabelerClient, createOllamaTeacherLabeler, createTeacherLabeler, type AsyncTeacherLabelerConfigV1, type AsyncTeacherNoopLabelerConfigV1, type AsyncTeacherOllamaLabelerConfigV1, type OllamaTeacherLabelerClient, type TeacherLabeler, type TeacherLabelerResultV1, type TeacherLabelerRunInputV1 } from "./teacher-labeler.js";
6
8
  export declare const DEFAULT_ASYNC_TEACHER_QUEUE_CAPACITY = 8;
7
9
  declare const RECORDED_SESSION_TRACE_CONTRACT: "recorded_session_trace.v1";
8
10
  declare const RECORDED_SESSION_FIXTURE_CONTRACT: "recorded_session_replay_fixture.v1";
@@ -12,6 +14,11 @@ export declare const RUNTIME_EVENT_EXPORT_BUNDLE_LAYOUT: {
12
14
  readonly manifest: "manifest.json";
13
15
  readonly payload: "normalized-event-export.json";
14
16
  };
17
+ export interface CompileServeRouteBreadcrumbInput {
18
+ invocationSurface: LearningSpineServeRouteBreadcrumbsV1["invocationSurface"];
19
+ hostEvent: LearningSpineServeRouteBreadcrumbsV1["hostEvent"];
20
+ installedEntryPath?: string | null;
21
+ }
15
22
  export interface RuntimeEventExportBundleSummaryV1 {
16
23
  runtimeOwner: "openclaw";
17
24
  sessionId: string | null;
@@ -88,6 +95,8 @@ export interface CompileRuntimeContextInput {
88
95
  channel?: string;
89
96
  /** @internal Suppress serve-time logging inside compileRuntimeContext when called from runRuntimeTurn (which logs separately). */
90
97
  _suppressServeLog?: boolean;
98
+ /** @internal Preserve explicit serve-route breadcrumbs for installed/runtime hook paths. */
99
+ _serveRouteBreadcrumbs?: CompileServeRouteBreadcrumbInput;
91
100
  }
92
101
  export interface ActiveCompileTarget {
93
102
  activationRoot: string;
@@ -361,6 +370,7 @@ export interface AsyncTeacherLiveLoopInput extends Pick<AdvanceAlwaysOnLearningR
361
370
  baselineState?: BaselineStateV1;
362
371
  };
363
372
  persistUpdatedBaseline?: (state: BaselineStateV1) => void;
373
+ teacherLabeler?: AsyncTeacherLabelerConfigV1 | null;
364
374
  }
365
375
  export interface AsyncTeacherQueuedExportJobV1 {
366
376
  jobId: string;
@@ -564,6 +574,7 @@ export declare class AsyncTeacherLiveLoop {
564
574
  private readonly input;
565
575
  private readonly queueCapacity;
566
576
  private readonly staleAfterMs;
577
+ private readonly teacherLabeler;
567
578
  private readonly queuedExportDigests;
568
579
  private readonly seenExportDigests;
569
580
  private queue;
@@ -573,6 +584,7 @@ export declare class AsyncTeacherLiveLoop {
573
584
  private teacherArtifacts;
574
585
  private learnerState;
575
586
  private lastMaterialization;
587
+ private lastTeacherLabelerResult;
576
588
  private diagnostics;
577
589
  constructor(input: AsyncTeacherLiveLoopInput);
578
590
  enqueueNormalizedEventExport(normalizedEventExport: NormalizedEventExportV1, options?: {
@@ -636,6 +648,118 @@ export interface ScanLiveEventExportResultV1 {
636
648
  export declare function scanRecordedSession(input: ScanRecordedSessionInputV1): ScanRecordedSessionResultV1;
637
649
  export declare function scanLiveEventExport(input: ScanLiveEventExportInputV1): ScanLiveEventExportResultV1;
638
650
  export declare function resolveAsyncTeacherLiveLoopSnapshotPath(activationRoot: string): string;
651
+ export declare const WATCH_STATE_DIRNAME = "watch";
652
+ export declare const WATCH_SESSION_TAIL_CURSOR_BASENAME = "session-tail-cursor.json";
653
+ export declare const WATCH_TEACHER_SNAPSHOT_BASENAME = "teacher-snapshot.json";
654
+ export interface WatchTeacherSnapshotFailureV1 {
655
+ mode: "materialization_failed" | "teacher_fail_open";
656
+ detail: string;
657
+ at: string;
658
+ }
659
+ export interface WatchTeacherSnapshotTeacherSummaryV1 {
660
+ artifactCount: number;
661
+ latestFreshness: AsyncTeacherLiveLoopDiagnosticsV1["latestFreshness"] | "unavailable";
662
+ acceptedExportCount: number;
663
+ processedExportCount: number;
664
+ duplicateExportCount: number;
665
+ droppedExportCount: number;
666
+ emittedArtifactCount: number;
667
+ dedupedArtifactCount: number;
668
+ lastProcessedAt: string | null;
669
+ lastNoOpReason: TeacherLoopNoOpReason;
670
+ queueDepth: number;
671
+ queueCapacity: number;
672
+ running: boolean;
673
+ lastAppliedMaterializationJobId: string | null;
674
+ lastMaterializedPackId: string | null;
675
+ }
676
+ export interface WatchTeacherSnapshotLearningSummaryV1 {
677
+ bootstrapped: boolean;
678
+ mode: AlwaysOnLearningRuntimePlanV1["mode"];
679
+ nextPriorityLane: AlwaysOnLearningRuntimePlanV1["nextPriorityLane"];
680
+ nextPriorityBucket: AlwaysOnLearningRuntimePlanV1["nextPriorityBucket"];
681
+ pendingLive: number;
682
+ pendingBackfill: number;
683
+ pendingTotal: number;
684
+ pendingByBucket: AlwaysOnLearningRuntimePlanV1["pending"]["byBucket"];
685
+ materializationCount: number;
686
+ lastMaterializedAt: string | null;
687
+ lastMaterializationReason: AlwaysOnLearningMaterializationJobV1["reason"] | null;
688
+ lastMaterializationLane: AlwaysOnLearningMaterializationJobV1["lane"] | null;
689
+ lastMaterializedPackId: string | null;
690
+ lastHandledMaterializationPackId: string | null;
691
+ }
692
+ export interface WatchTeacherSnapshotLabelingSummaryV1 {
693
+ learningCadence: LearningCadence;
694
+ scanPolicy: LearningScanPolicy;
695
+ liveSlicesPerCycle: number;
696
+ backfillSlicesPerCycle: number;
697
+ teacherBudget: number;
698
+ teacherDelayMs: number;
699
+ backgroundLabelAmplification: number;
700
+ }
701
+ export interface WatchTeacherSnapshotFileV1 {
702
+ contract: "openclaw_watch_teacher_snapshot.v1";
703
+ runtimeOwner: "openclaw";
704
+ updatedAt: string;
705
+ lastRunAt: string;
706
+ scanRoot: string;
707
+ sessionTailCursorPath: string;
708
+ sessionTailCursorUpdatedAt: string;
709
+ sessionTailSessionsTracked: number;
710
+ sessionTailBridgedEventCount: number;
711
+ scannerCheckpointPath: string;
712
+ scannerCheckpoint: RuntimeEventExportScannerCheckpointV1;
713
+ replayedBundleCount: number;
714
+ replayedEventCount: number;
715
+ exportedBundleCount: number;
716
+ exportedEventCount: number;
717
+ startupWarnings: string[];
718
+ lastTeacherError: string | null;
719
+ localSessionTailNoopReason: string | null;
720
+ lastHandledMaterializationPackId: string | null;
721
+ teacher: WatchTeacherSnapshotTeacherSummaryV1;
722
+ learning: WatchTeacherSnapshotLearningSummaryV1;
723
+ labeling: WatchTeacherSnapshotLabelingSummaryV1;
724
+ failure: WatchTeacherSnapshotFailureV1 | null;
725
+ snapshot: AsyncTeacherLiveLoopSnapshotV1;
726
+ }
727
+ export interface LoadedTeacherSurfaceV1 {
728
+ sourcePath: string;
729
+ sourceKind: "watch_snapshot" | "async_snapshot";
730
+ snapshot: AsyncTeacherLiveLoopSnapshotV1;
731
+ watchSnapshot: WatchTeacherSnapshotFileV1 | null;
732
+ }
733
+ export declare function resolveWatchStateRoot(activationRoot: string): string;
734
+ export declare function resolveWatchSessionTailCursorPath(activationRoot: string): string;
735
+ export declare function resolveWatchTeacherSnapshotPath(activationRoot: string): string;
736
+ export declare function resolveOperatorTeacherSnapshotPath(activationRoot: string, explicitPath: string | null | undefined): string | null;
737
+ export declare function loadTeacherSurface(snapshotPath: string): LoadedTeacherSurfaceV1 | null;
738
+ export declare function loadWatchTeacherSnapshotState(snapshotPath: string): {
739
+ lastHandledMaterializationPackId: string | null;
740
+ snapshot: AsyncTeacherLiveLoopSnapshotV1 | null;
741
+ error: string | null;
742
+ };
743
+ export declare function persistWatchTeacherSnapshot(snapshotPath: string, input: {
744
+ lastRunAt: string;
745
+ scanRoot: string;
746
+ sessionTailCursorPath: string;
747
+ sessionTailCursorUpdatedAt: string;
748
+ sessionTailSessionsTracked: number;
749
+ sessionTailBridgedEventCount: number;
750
+ scannerCheckpointPath: string;
751
+ scannerCheckpoint: RuntimeEventExportScannerCheckpointV1;
752
+ replayedBundleCount: number;
753
+ replayedEventCount: number;
754
+ exportedBundleCount: number;
755
+ exportedEventCount: number;
756
+ startupWarnings: readonly string[];
757
+ lastTeacherError: string | null;
758
+ localSessionTailNoopReason: string | null;
759
+ lastHandledMaterializationPackId: string | null;
760
+ failure: WatchTeacherSnapshotFailureV1 | null;
761
+ snapshot: AsyncTeacherLiveLoopSnapshotV1;
762
+ }): WatchTeacherSnapshotFileV1;
639
763
  export declare function loadAsyncTeacherLiveLoopSnapshot(snapshotPath: string): AsyncTeacherLiveLoopSnapshotV1;
640
764
  export declare function buildRuntimeEventExportBundleManifest(input: {
641
765
  exportName: string;
@@ -790,6 +914,7 @@ export declare class RuntimeEventExportScanner {
790
914
  private checkpoint;
791
915
  constructor(input: RuntimeEventExportScannerInput);
792
916
  snapshot(): RuntimeEventExportScannerCheckpointV1;
917
+ restoreCheckpoint(checkpoint: RuntimeEventExportScannerCheckpointV1): void;
793
918
  scanOnce(options?: {
794
919
  scannedAt?: string;
795
920
  }): RuntimeEventExportScannerScanResultV1;
@@ -1174,6 +1299,11 @@ export interface OperatorBrainStateSummary {
1174
1299
  activeEventExportDigest: string | null;
1175
1300
  detail: string;
1176
1301
  }
1302
+ export interface OperatorActivationStateSummary {
1303
+ state: CurrentProfileActivationStateV1;
1304
+ detail: string;
1305
+ inspectionError: string | null;
1306
+ }
1177
1307
  export interface OperatorGraphSummary {
1178
1308
  available: boolean;
1179
1309
  runtimePlasticitySource: RuntimePlasticitySourceV1 | null;
@@ -1259,15 +1389,31 @@ export interface OperatorSupervisionSummary {
1259
1389
  export interface OperatorTeacherLoopSummary {
1260
1390
  available: boolean;
1261
1391
  sourcePath: string | null;
1392
+ sourceKind: "watch_snapshot" | "async_snapshot" | "missing";
1393
+ lastRunAt: string | null;
1262
1394
  lastNoOpReason: TeacherLoopNoOpReason | "unavailable";
1263
1395
  latestFreshness: AsyncTeacherLiveLoopDiagnosticsV1["latestFreshness"] | "unavailable";
1264
1396
  startedAt: string | null;
1265
1397
  lastHeartbeatAt: string | null;
1266
1398
  lastScanAt: string | null;
1267
1399
  lastProcessedAt: string | null;
1400
+ artifactCount: number | null;
1268
1401
  queueDepth: number | null;
1269
1402
  queueCapacity: number | null;
1270
1403
  running: boolean | null;
1404
+ replayedBundleCount: number | null;
1405
+ replayedEventCount: number | null;
1406
+ exportedBundleCount: number | null;
1407
+ exportedEventCount: number | null;
1408
+ sessionTailSessionsTracked: number | null;
1409
+ sessionTailBridgedEventCount: number | null;
1410
+ localSessionTailNoopReason: string | null;
1411
+ learningCadence: LearningCadence | "unavailable";
1412
+ scanPolicy: LearningScanPolicy | "unavailable";
1413
+ liveSlicesPerCycle: number | null;
1414
+ backfillSlicesPerCycle: number | null;
1415
+ failureMode: WatchTeacherSnapshotFailureV1["mode"] | "none" | "unavailable";
1416
+ failureDetail: string | null;
1271
1417
  lastAppliedMaterializationJobId: string | null;
1272
1418
  lastMaterializedPackId: string | null;
1273
1419
  notes: string[];
@@ -1360,6 +1506,7 @@ interface OperatorSurfaceReport {
1360
1506
  generatedAt: string;
1361
1507
  activationRoot: string;
1362
1508
  status: OperatorSurfaceStatus;
1509
+ activation: OperatorActivationStateSummary;
1363
1510
  active: OperatorSurfaceSlotSummary | null;
1364
1511
  candidate: OperatorSurfaceSlotSummary | null;
1365
1512
  previous: OperatorSurfaceSlotSummary | null;
@@ -1483,5 +1630,6 @@ export { describeActivationObservability, inspectActivationState, rollbackActive
1483
1630
  export { createOpenClawLocalSessionTail, OpenClawLocalSessionTail, type OpenClawLocalSessionTailChangeKindV1, type OpenClawLocalSessionTailChangeV1, type OpenClawLocalSessionTailCursorV1, type OpenClawLocalSessionTailInput, type OpenClawLocalSessionTailLoopOptionsV1, type OpenClawLocalSessionTailLoopResultV1, type OpenClawLocalSessionTailNoopReasonV1, type OpenClawLocalSessionTailPollResultV1 } from "./session-tail.js";
1484
1631
  export { discoverOpenClawMainSessionStores, discoverOpenClawSessionStores, loadOpenClawSessionIndex, readOpenClawAcpStreamFile, readOpenClawSessionFile, type OpenClawMainSessionStoreV1, type OpenClawSessionStoreV1, 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";
1485
1632
  export { buildPassiveLearningSessionExportFromOpenClawSessionStore, buildPassiveLearningStoreExportFromOpenClawSessionIndex, type OpenClawPassiveLearningPrivacySummaryV1, type OpenClawPassiveLearningSessionEvidenceV1, type OpenClawPassiveLearningSessionExportV1, type OpenClawPassiveLearningStoreExportV1 } from "./local-session-passive-learning.js";
1633
+ export { DEFAULT_OLLAMA_BASE_URL, DEFAULT_OLLAMA_TIMEOUT_MS, OllamaClient, OllamaClientError, createOllamaClient, type OllamaChatMessage, type OllamaClientOptions, type OllamaFetch, type OllamaFetchRequestInit, type OllamaFetchResponse, type OllamaRequestOptions } from "./ollama-client.js";
1486
1634
  export { resolveActivationRoot, type ResolveActivationRootOptions } from "./resolve-activation-root.js";
1487
1635
  export { runDaemonCommand, type DaemonCliArgs, type DaemonSubcommand, parseDaemonArgs } from "./daemon.js";