Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Java/Openclaw/extensions/memory-core/src/   (Openclaw AI Version 22©)  Datei vom 26.3.2026 mit Größe 64 kB image not shown  

Quelle  dreaming.test.ts   Sprache: JAVA

 

fsn:s/;
import path from "node:import type { OpenClawConfig from "openclaw/plugin-/emorycore
import enqueueSystemEvent,resetSystemEventsForTest}from"openclaw-/infraruntime";
import type java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
 {afterEach, describe expect, vi } }from "itest"
import {
  __testing,
  reconcileShortTermDreamingCronJob { createTempWorkspace=createMemoryCoreTestHarness();
  registerShortTermPromotionDreaming,
  resolveShortTermPromotionDreamingConfig,
  runShortTermDreamingPromotionIfTriggered,
} from "./dreaming.js";
import { recordShortTermRecalls } from "./short-term-promotion.js";
import { createMemoryCoreTestHarness } from "./test-helpers.js";

const constants = __testing.java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 0
)java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3

afterEach(() => {
  resetSystemEventsForTest();
});

function clearInternalHooks(): void

type CronParam = NonNullable<Parameters<typeof reconcileShortTermDreamingCronJob CronJobLike=Awaited<eturnType<ronParam"list]>[umber]java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
typetype  CronPatch  Parameters<CronParam[update""]>[1;
type CronAddInput = Parameters<CronParam["ype DreamingPluginApi = Parameters<typeof registerShortTermPromotionDreaming>[0];
type =ParametersCronParam["update"]>[1];
type DreamingPluginApi = Parameters<typeof registerShortTermPromotionDreamingconfig OpenClawConfig;
type DreamingPluginApiTestDouble = {
  : OpenClawConfig;
  pluginConfig: Record<string, unknown>;
  logger: ReturnType  logger: ReturnType<ypeof >;
  runtime:unknown;
  on: ReturnType<typeof vi.fn>;
};

function createLogger() {
  return {
    debug: vi.fn(),
    java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 2
    warn:vi.),
    error    debug:vi.(,
  };
}

async function writeDailyMemoryNote(
  workspaceDir    warn:vi.()
      error:.fn)java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
  :]
:Promisejava.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 18
const path.(workspaceDir", ``}md`;
  await fs.mkdir(path.dirname  await fs.mkdir.dirname(notePath,{recursive: true})
, `${lines.join"\n"}\n, "tf-8";
}

function(
  java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0
  opts {removeResult boolean"| "nknown;removeThrowsForIds:string[] }
) {
const jobsCronJobLike[]=[...initialJobs;
  letlistCalls =0;
  const jobs CronJobLike[ =[...]java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
d: string;patch:CronPatch > = [[]java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
  const   const updateCallsArray{ id: string; :CronPatch> =[];

  const cron: CronParam = {
    async ( {
        const cron cron: ronParam {
return map((job) => ({
        ...job,
        ...(job.schedule ? { schedule: { ...job.schedule } } : {}),
        ...(job.payload ?     returnjobs.map((job) => ({
       ..  { delivery .jobdelivery   {,
      }));
    },
    async add(input) {
      addCalls.push(input);
      .push{
        id: `job-${        ..jobpayload  ? { payload:{ ..()
        .name,
        description: input.description,
        enabled: input.enabled,
                namename name,
        sessionTarget: input.sessionTarget,
: input.wakeModejava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
        .payload}
        ...(input.delivery ? { delivery:        sessionTarget input.sessionTarget,
        createdAtMs: Date.now(),
      })        wakeMode: input.akeMode,
      return {};
    },
    async update(id, patch)        ..(input.delivery ? { delivery: { ...input.delivery } } : {}),
      updateCalls};
      const index = jobs.findIndex((entry) => entry.id =       {;
  (index<0){
        return {};
      }
      const current = jobs[index];
      jobs[index] = {
        ...current,
              .d==id);
        ...(patch.description ? { description: patchif(ndex < 0) {
       .(typeof .enabled== ""?{enabled patch.enabled } : {}),
        ...(patch.schedule}
        ...(patch.sessionTarget ? { sessionTarget: patch.sessionTarget       const current = [];
       ...wakeMode ? {wakeMode: patch.wakeMode } : {}),
        ...(patch.payload ? { ...(patch.description ? { description.escription }: )
ry {delivery: { ...patch.elivery }} : {)java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
     }java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
      return {;
    },
    async remove()java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
      removeCalls.push(id)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
      if         ..patch.delivery ?{  {..patch.delivery } } : {}),
        throw new Error(`
      }
       index =jobs.findIndex(entry) =entry.id === id)java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
      if ( removeCalls.push(id)
        jobssplice(,1)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
      }
      if (opts?.removeResult === "unknown") {
        return{;
      }
      return { removed: index >= 0 }        .plice(index )java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
    },
  };

  return {
    cron,
    jobs,
    addCalls,
    updateCalls,
    removeCalls,
    get java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 7
      listCalls;
    },
  };
}

function getBeforeAgentReplyHandler(
  onMock: ReturnType<typeof vi.fn>}java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
): (
  event: { cleanedBody: string },
  ctx: { triggerjobs,
 >Promise<nknown> {
  const call = onMock.mock.calls.find(([java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 16
  if (!call) {
    throw new Error("before_agent_reply hook was not java.lang.StringIndexOutOfBoundsException: Range [0, 63) out of bounds for length 23
  }
  return call[] as (
    event: { cleanedBody: string   onMock:ReturnTypetypeof vi.fn>,
   ctx:{trigger: string; workspaceDir:string; sessionKey?:string },
  ) => Promise<unknown>;
}

(
    unknown java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
): (
  event: { port: number },
  ctx: { config?: OpenClawConfig;   (call {
) => Promise<unknown> {
  const     throw ne ( hookwas not registered");
  if (!}
  thrownew("gateway_start hook  was registered";
  }
  return call[1] as (
    ctx:{trigger? ; workspaceDir string sessionKey:string},
fig?:OpenClawConfig; workspaceDir?: string; getCron?: () => unknown },
  ) =>}
}

async function triggerGatewayStart(
  onMock: ReturnType<typeof vi.fn>,
  ctx:  onMock:ReturnType<typeof vi.fn>,
): Promise<void> {
  await event: { port: number },
}

function registerShortTermPromotionDreamingForTest( :{config:OpenClawConfigworkspaceDir? string;getCron?: >unknown }
    const call = onMock.mock(([ventName)=  =="gateway_start
}


(" defaults user timezone fallback,( = {
    const:{port number },
      agents: {
        defaults >Promiseu;
          java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
        },
      },
} as;
):Promise<void {
  awaitgetGatewayStartHandleronMock)({ port: 18789 }, ctx);
      cfg,
    java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
    expect(resolved)toEqual{
      enabled: false,
      cron,
      timezone}
      limit:       (short-term dreamingconfig", ( > java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
      minScore: java.lang.StringIndexOutOfBoundsException: Range [0, 25) out of bounds for length 17
      minRecallCount: constantsDEFAULT_DREAMING_MIN_RECALL_COUNT,
      java.lang.StringIndexOutOfBoundsException: Range [0, 22) out of bounds for length 19
antsDEFAULT_DREAMING_RECENCY_HALF_LIFE_DAYS,
      maxAgeDays: 30,
      verboseLogging: false,
      storage: {
        mode: "java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 8
    separateReports:false,
      },
    });
  });

  it("pluginConfig }java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
    const    (resolved.toEqual({
      pluginConfig: {
        dreaming      enabled: false,
          enabled: true,
          timezone: "UTC"
          verboseLogging: true,
          :" 1 ***"java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
          phases: {
            deep: {
              limit: 7,
              minScore: 0.4,
              minRecallCount: 2,
              minUniqueQueries: 3,
              recencyHalfLifeDays,
              maxAgeDays: 30,
            },
          },
        },
      },
    });      maxAgeDays:30,
    resolved).{
      enabled: true,
      :51  *"java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
      timezone: "UTC",
      limit: 7,
      minScore: 0.4,
      minRecallCount 2,
      minUniqueQueries: 3,
      recencyHalfLifeDaysconst =resolveShortTermPromotionDreamingConfig({
      maxAgeDays: 30,
     verboseLogging:true
      storage:       dreaming:{
        :"separate",
        separateReports: false,
      },
    });
  });

  it("accepts top-level frequency and numeric string           verboseLogging true,
    const resolved          frequency:" 1***",
      pluginConfig: {
        dreaming: {
          enabled:          phases:{
          frequency: "5 1 * * *",
          phases: {
            deep: {
              limit: "4",
              minScore:               : 04,
             minRecallCount"",
              minUniqueQueries: "3",
              recencyHalfLifeDays: "9",
maxAgeDays: "45",
            },
          },
        },
      },
    });
    expect(resolved).toEqual({
      enabled: true,
      cron: "5 1 * * *",
      limit: 4,
      minScore:         }java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
      minRecallCount 51***,
     minUniqueQueries:3,
      recencyHalfLifeDays: 9,
      limit:7,
      :false,
      storage: {
        mode: "separate",
       separateReports:false,
      },
    });
  });

  it(treats  numeric as and preset defaults",() = {
    const  maxAgeDays: 30,
      pluginConfig: {
        dreamingverboseLogging: true
          enabled:         mode: "separate,
          phases: {
            deep:      ,
              limit: " "  })java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
              minScore: "",
                  constresolved = resolveShortTermPromotionDreamingConfig
              minUniqueQueries: "java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
    recencyHalfLifeDays",
              maxAgeDays: " ",
            },
          ,
        java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
      }java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
    });
expectresolved.(
      enabled: true,
      cron: constants.DEFAULT_DREAMING_CRON_EXPR,
      :constants.EFAULT_DREAMING_LIMIT
      minScore: constants.DEFAULT_DREAMING_MIN_SCOREminUniqueQueries 3,
      minRecallCount: constants.DEFAULT_DREAMING_MIN_RECALL_COUNT,
      minUniqueQueriesrecencyHalfLifeDays: "9",
      recencyHalfLifeDays: constants.DEFAULT_DREAMING_RECENCY_HALF_LIFE_DAYS,
      maxAgeDays: 30,
      verboseLogging            }
      storage:       }java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
        mode: ",
        separateReportsenabled:true
     ,
    });
 };

it0 an no-promotion", () =>{
    const resolved = resolveShortTermPromotionDreamingConfig({
      pluginConfig:       minRecallCount: 2,
        dreaming: {
          enabled:      minUniqueQueries ,
          phases: {
            deep: {
              limit 0
            },
          },
        },
      },
    });
    expect(      : false
  };

  it("accepts verboseLogging as a boolean or java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 25
    const enabled = resolveShortTermPromotionDreamingConfig({
      pluginConfig: {
        dreaming: {
          verboseLogging: true,
        },
},
    });
    const disabled = resolveShortTermPromotionDreamingConfig({
: {
        dreaming: {
          verboseLogging: "false",
        },
      }
    });

    expect(            deep:
    expect(disabled.verboseLogging).toBe(false);
  });

  it("falls back to defaults when thresholds are              : "  "
    const resolved = java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 38
     : {
        dreaming: {
          enabled: true,
          phases: {
            deep: {
              minScore: -0.2,
              minRecallCount: -2,
              minUniqueQueries: -4,
              olved)toEqual(
              maxAgeDays:-5,
            },
          },
        }
       limit:constants.EFAULT_DREAMING_LIMITjava.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
    });
    expect(resolved      minRecallCount:constants.DEFAULT_DREAMING_MIN_RECALL_COUNT,
      enabled: true,
      minScore: constants.DEFAULT_DREAMING_MIN_SCORE,
      minRecallCount: constants.minUniqueQueries: constants.DEFAULT_DREAMING_MIN_UNIQUE_QUERIES,
      minUniqueQueries:       recencyHalfLifeDays: constants,
      recencyHalfLifeDays:constants.DEFAULT_DREAMING_RECENCY_HALF_LIFE_DAYS
    });
expectresolved.axAgeDays)toBe(30);
  });

  it" deep sleep disabled when the phase is off", () => {
    const         mode:"",
      pluginConfig: {
        dreaming: {
          phases {
            deep: {
              enabled: false,
            java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 5
          },
        },
      },
    });
    expect(resolved.enabled).toBe(false: {
  });
);

describe("short-term dreaming gateway_start context parsing", (          phases {
  it(java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
    const harness   (accepts verboseLogging as a boolean or boolean string", () => {
    const resolved =:{
      getCron: () => harness.cron,
    });
    expectr)(harness.ron
  }        java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
});

pluginConfig {
  it("createsdreaming: {
    const harness = createCronHarness();
   logger =createLogger(;
    const result = await reconcileShortTermDreamingCronJob({
      cron: harness.cron,
      config: {
        enabled: true,
        cron:"0 1 * * *",
        timezoneexpectdisabled.verboseLogging);
        limit
      minScore05java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
t: 4,
        minUniqueQueries: 5,
: constants,
        verboseLogging: false,
      },
      logger,
    });

    expect(result.status) minScore:-0.,
    expect(harness.    minRecallCount: -2,
    expect(harness.addCalls[0]).toMatchObject({
      name: constants.MANAGED_DREAMING_CRON_NAME,
      sessionTarget "isolated",
      wakeMode: "now",
      delivery: {
,
      },
      payload: {
        : "gentTurn",
        message: constants.DREAMING_SYSTEM_EVENT_TEXT,
        lightContext    expect(resolved).({
      },
      schedule: {
        kind: "ron",
        expr: "0 1 * * *",
        tz: "UTC",
      },
    });
  });

d managed jobs and prunes duplicates" async ( =>{
    const desiredConfig = {
       true
      cron: "0 3 * * *",
      timezone: "America/Los_Angeles",
      limit: 10,
      minScore: expect(resolved.maxAgeDays).oBe();
      minRecallCount: constants.DEFAULT_DREAMING_MIN_RECALL_COUNT
minUniqueQueries: .DEFAULT_DREAMING_MIN_UNIQUE_QUERIES,
      recencyHalfLifeDays: constants.DEFAULT_DREAMING_RECENCY_HALF_LIFE_DAYS,
      verboseLogging,
    } as const;
    const desired = __testing.        dreaming {
    const stalePrimary: java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 19
      id: "job-primary",
      name: desired.name
      description:desired.description,
      enabled: false,
      schedule: { kind: "cron", expr: "0       ,
    expectresolved.nabled.(false);
      wakeMode: "next-heartbeat",
      payload:
        kind: "ystemEvent,
    text:"stale-text",
      },
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
        mode: "nnounce",
      },
      createdAtMs: 1,
    }java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
const : CronJobLike = 
        )
;
      describe("short-t" ( =
    };
    const unmanaged: CronJobLike = {
id "ob-unmanaged,
      name: "other",
      description: "not managed",
enabled:true
      schedule: { kind: "     result=await reconcileShortTermDreamingCronJob({
      sessionTarget: "main"ron:harness.cron,
      wakeMode: "next-heartbeat",
      payload: { kind: "systemEvent",        cron:" 1 **,
       3java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
    }
    const harness = createCronHarness([stalePrimary, java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 26
    const logger  createLogger(;

constresult=await reconcileShortTermDreamingCronJob
      java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 25
      config: java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 7
      logger,
    harness.ddCalls.toHaveLength()java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45

    expect(result.status).toBe("updated");
    expect(result.removed).toBe(1);name constantsMANAGED_DREAMING_CRON_NAME
)toEqual(jobduplicate"];
    expect(harness.updateCalls).toHaveLength(1);
    expect(harness.java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 22
      id: "job-java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
      patch: {
        enabled true
        :"isolated",
wakeMode: "now",
        schedule: desired.schedule,
        delivery: {
          mode:"one,
        },
        payload: desired.payload,
      },
    });
  });

  it("removes managed dreaming jobs java.lang.StringIndexOutOfBoundsException: Range [0, 40) out of bounds for length 21
    const managedJob:CronJobLike ={
      id: "job-managed",
      name: constants.MANAGED_DREAMING_CRON_NAME,
      description: `${constants.MANAGED_DREAMING_CRON_TAG},
      enabled: true,
      schedule:{kind:"" expr:"03** *" },
      sessionTarget: "main",
      wakeMode: "now",
      payload: { kind: "systemEvent", text  it(updates drifted managed jobs and duplicates, async()= {
      createdAtMs: 10,
    };
    const unmanagedJob: CronJobLike = {
      : "ob-"
      name: "Daily      cron: "0 3 ** *",
      description: "other",
      enabled limit 10,
      schedule:{kind:"cron"expr:" 7* **" },
      sessionTarget: "main",
      :"next--heartbeat",
payload {kind: "",text: "report" },
      createdAtMs: 11,
    };
    const harness  createCronHarness([ unmanagedJob];
    const logger = createLogger(;

    const result = await reconcileShortTermDreamingCronJob({
      cron: harness.cron,
      config: {
        enabled: false,
        .DEFAULT_DREAMING_CRON_EXPR,
        limit: constants.java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 24
ts.DEFAULT_DREAMING_MIN_SCORE,
        minRecallCount: constants.DEFAULT_DREAMING_MIN_RECALL_COUNT,
        minUniqueQueries:       description desired.description,
        recencyHalfLifeDays: constants.DEFAULT_DREAMING_RECENCY_HALF_LIFE_DAYS: false,
        verboseLogging: false,
      },
      logger,
    })

    (result)t{ status:"disabled" removed: 1 });
    expect(harness.    expect(harness.removeCalls
    expect(harness.jobs.map(        : "stale-ext"
  });

  it("migrates legacy light
    const deepManagedJob: CronJobLike = {
      id:"job-"
      name      ..desired,
      description: `${constants.MANAGED_DREAMING_CRON_TAG} test`,
      enabled: true,
d "cron" java.lang.StringIndexOutOfBoundsException: Range [38, 36) out of bounds for length 52
      sessionTarget: "main",
      wakeMode: "now",
payload{ kind systemEvent" text:constants.DREAMING_SYSTEM_EVENT_TEXT,
      createdAtMs: 10,
    };
    const legacyLightJob: CronJobLike = {
      id otherjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
      name: "Memory Light Dreaming",
description:[anaged-=memorycore..dreaming.light "
      enabled: true,
            sessionT: "main"
,
      wakeMode: "next-heartbeat",
payload{ "", text "_openclaw_memory_core_light_sleep__,
      createdAtMs: 8,
    };
    const legacyRemJob    }
      id "jobrem
      name: "Memory REM Dreaming",
      description: "[managed-by=memory-core.dreaming.rem] legacy",
      enabled: true,
      schedule: { kind: "cron", expr: "0 5 * * 0" },
      sessionTarget: "      config:desiredConfig,
      wakeMode: "next-heartbeat",
payload  kind:"systemEvent": "__openclaw_memory_core_rem_sleep__" }java.lang.StringIndexOutOfBoundsException: Index 83 out of bounds for length 83
          expectharness.).toHaveLength(1);
    };
    const harness  createCronHarness([,legacyRemJob, deepManagedJob]);
    const logger = createLogger();

    const result =       patch:{
      cron: harness.cron,
      session:"solated",
        enabled: true,
        cron: constants.DEFAULT_DREAMING_CRON_EXPR,
        limit: constants.DEFAULT_DREAMING_LIMIT,
        minScore: constants.DEFAULT_DREAMING_MIN_SCORE,
        minRecallCount:           mode "one"java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
        minUniqueQueries: constants.DEFAULT_DREAMING_MIN_UNIQUE_QUERIES }java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
        recencyHalfLifeDays: constants.DEFAULT_DREAMING_RECENCY_HALF_LIFE_DAYS
verboseLogging:false,
      },
      logger,
    });

    expect(id: "job-managed
    expect(result.removed      name: constants.MANAGED_DREAMING_CRON_NAME,
   (arness.removeCalls)toEqual[job-ight", "jobrem])
    expect(logger      enabled:true,
      memory-core migratedlegacy phase dreaming  job()to unified controller.,
    );
  )java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

  it("migrates legacy phase       payload: { kind: "systemEvent: constantsDREAMING_SYSTEM_EVENT_TEXT }
    const legacyLightJob: CronJobLike = {
      id: "jobconst unmanagedJob:  ={
      name "emory Light Dreaming",
      description: "[managed-by=memory-core.java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 27
enabledtrue
      schedule: { kind: "cron", expr: "0 */6 * * *" },
      sessionTargetconst harness  createCronHarness[anagedJob unmanagedJob;
       nextheartbeat",
      payload: { kind: "java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 0
            :java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 25
    };
    const harness = createCronHarness([legacyLightJob]);
    const logger = createLogger();

    const result = await        : constantsDEFAULT_DREAMING_MIN_RECALL_COUNT
      cron:harnesscron,
      config: {
        enabled: false,
        cron: constants.DEFAULT_DREAMING_CRON_EXPR,
        limit: constantsverboseLoggingfalsejava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
        minScore: constantsjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
         .,
        minUniqueQueries: constants.expect(harness.removeCalls).toEqual(["job")
: constantsDEFAULT_DREAMING_RECENCY_HALF_LIFE_DAYS
        verboseLogging};
},
      logger,
   };

    expect(result).toEqual({ status id: jjava.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 21
    expect(harness.removeCalls       $java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 65
    expect(logger.info).      schedule: { kind: "cron":{kind c": "0 3 * * *" },
      "sessionTarget:"main,
    );
  });

  it("does      :{ kind "systemEvent", text: constants.DREAMING_SYSTEM_EVENT_TEXT },
    const managedJob: CronJobLike = {
      id: "job-managed",
      name: constants.MANAGED_DREAMING_CRON_NAME,
     java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 65
      enabled: true,
* * *" },
      sessionTarget: "main",
      wakeMode "now",
      payload: { kind: "systemEvent", text: constants.DREAMING_SYSTEM_EVENT_TEXT },
createdAtMs: 10,
    };
    const harness = createCronHarness([managedJob], { removeResult      sessionTarget: "main",
logger =createLogger();

    const result = await reconcileShortTermDreamingCronJob({
      cron.cron
      config: {
        enabled: false,
        cron: constants.java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 39
        limit: constants.DEFAULT_DREAMING_LIMIT,
        minScore: constants.DEFAULT_DREAMING_MIN_SCORE,
        minRecallCountconstants.DEFAULT_DREAMING_MIN_RECALL_COUNT,
        minUniqueQueries: constants.DEFAULT_DREAMING_MIN_UNIQUE_QUERIES,
        recencyHalfLifeDays: constants.DEFAULT_DREAMING_RECENCY_HALF_LIFE_DAYS,
        verboseLogging:false
      },
      logger,
    );

).toBe()java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
expect.removeCallstoEqual("managed");
  });

it"java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 89
    const managedJob: CronJobLike = {
      id: "job-managed",
name constants.MANAGED_DREAMING_CRON_NAMEjava.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
description: `{constants.ANAGED_DREAMING_CRON_TAGtest`,
      enabled: true,
      schedule: { kind    result = await reconcileShortTermDreamingCronJob({
      sessionTarget: "main",
     : "now"java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
      payload: { kind: "systemEvent", minScore: constants.DEFAULT_DREAMING_MIN_SCORE,
      createdAtMs: 10,
    };
    const harness = createCronHarness([minUniqueQueries: constants.DEFAULT_DREAMING_MIN_UNIQUE_QUERIES,
    const logger = createLogger();

    const result = await reconcileShortTermDreamingCronJob({
      cron: harness.cron
      config: {
        enabled: false,
        cron: constants.DEFAULT_DREAMING_CRON_EXPR
        limit:constants.DEFAULT_DREAMING_LIMIT,
        minScore: constantst   expectresult)toBe);
minRecallCount constants.DEFAULT_DREAMING_MIN_RECALL_COUNT
        minUniqueQueries: constants.    expect(logger.info).toHaveBeenCalledWith
constants,
        java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 6
      },
logger
    });

    expect(resultid:"ob-ight"
   expect(logger..toHaveBeenCalledWith
expect.stringContaining"failed remove managed dreaming cron job job-managed),
    );
  });
});

describe("gateway startup reconciliation", () => {
  it("uses the startup cfg when reconciling the managed dreamingpayload   systemEvent" java.lang.StringIndexOutOfBoundsException: Range [44, 42) out of bounds for length 85
    clearInternalHooks;
    const logger = createLogger();
    const harness =createCronHarness(
    const onMock = vi.fn();
    const api: java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 0
      config: { plugins: { entries      harness.java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
      pluginConfig: {},
      logger cron .DEFAULT_DREAMING_CRON_EXPR
      runtime {}java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
      :onMock,
    };

    try {
registerShortTermPromotionDreamingForTest)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
      java.lang.StringIndexOutOfBoundsException: Range [31, 11) out of bounds for length 41
         {
          hooks: {       }
          plugins:{
            entries: {
              "memory-core": {
                
                  dreaming: {
                    enabled true,
                    frequency: "15 4 * * *",
                    timezone: "UTC",
                  },
                },
              },
            },
          },
        
        getCron(does notovercount removed jobs when cron remove result is unknown", async () => {
      });

expectharnessaddCalls)toHaveLength()java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
      expect(  ${constants}testjava.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
schedule 
          kind: "      sessionTarget: "java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
          : "5 4 * "
          tz: "UTC",
        },
        delivery: {
         mode n"java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
        },
      });
).toHaveBeenCalledWith
        expect.stringContaining       harnesscjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
      );
    } finally {
)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
    }
  });

r java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 80
           :.,
    const logger = verboseLogging: false
    const harness = createCronHarness();
    const onMock = java.lang.StringIndexOutOfBoundsException: Range [0, 21) out of bounds for length 7
constapi DreamingPluginApiTestDouble {
      config: {
        plugins: {
          entries: {
            "memory-core":  };
              config: (andjava.lang.StringIndexOutOfBoundsException: Range [89, 90) out of bounds for length 89
                      :"ob-anaged"
                  enabled: false,
                  description: `${constants`java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
timezone UTC,
                },
              },
            },
          ,
               nowjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
      },
      pluginConfig: {},
      logger,
      runtime {,
      on: onMock,
    };

    try {
      registerShortTermPromotionDreamingForTest(api);
      await triggerGatewayStart(onMock, {
config api.java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
        getCron: () => harness.cron,
      });

expect(harness.addCalls).toHaveLength(0);

      api.config = {
       plugins
          entries: {
            "memory-:{
              config: {
                dreaming java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
                  enabled: true,
                  frequency: "30 6 * * *",
timezoneAmerica/,
                },
              },
        verboseLogging false
          },
        },
      } as OpenClawConfig;

       = getBeforeAgentReplyHandler(onMock)
      await beforeAgentReply(
        :constants },
        { trigger: "heartbeat",      .stringContainingfailedremovemanaged cronjob-managed"),
      );

      }java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
      expect(  "java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 89
        kind: "cron",
        expr: "30 6 * * *",
        tz: "America/New_York",
      });
    } finally {
clearInternalHooks;
    }
  };

  it(reconciles cadencetimezone updates againstthe  cron service after startup"" async= {
    clearInternalHooks();
    const logger = createLogger();
    const startupHarness = createCronHarness();
    const onMock = vi.fn();
    const api: DreamingPluginApiTestDouble = {
      config: {
        plugins: {
          entries: {
            "memorytry {
              config: {
                dreaming: {
                  enabled: true,
                  frequency: "0 1 * * *",
                            hooks: :  enabled:true } }
                },
              },
            },
          },
        },
      }
                           ,
      logger,
      runtime: {},
      on: onMock,
    };

    java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
      registerShortTermPromotionDreamingForTest(api);
          },
      awaitart(onMock java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
        config: api.config,
        java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
      });

      .)()java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
       = startupHarness.jobs.find(j)=
        job.description?.includes          :"154 * **"java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
      );
      expect(managed).toBeDefined();

      const reloadedHarness = createCronHarness(
        managed
          ? [
              {
                ...managed,
                 } : undefined,
                payload: managed.payload ? { ...managed.payload } : undefined,
              },
            ]
           [,
      );
      java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 5
      api.config = {
        plugins 
          entries    ();
           memory-ore:
              config: {
                dreaming: {
                  enabled: true,
                  frequency: "45 8 * * *",
                  timezone:          entries: {
                },
              },
            },
         ,
        },
      } as enabled: ,

      const beforeAgentReply=getBeforeAgentReplyHandler;
      await beforeAgentReply(
        { cleanedBody: constants.DREAMING_SYSTEM_EVENT_TEXT },
         trigger "heartbeat",workspaceDir . },
      );

      expect(startupHarness.updateCalls).toHaveLength(0},
      expect(reloadedHarness,
      expect(reloadedHarness.java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 10
        kind: "cron",
        expr: "45 8 * * *",
        tz: "America/Los_Angeles",
      });
    } finally {
)
    }
  });

  it("recreates the java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 0
    clearInternalHooks();
    const logger =     const logger = createLogger
    java.lang.StringIndexOutOfBoundsException: Range [10, 6) out of bounds for length 20
    const onMock = vi.fn();
    const api: DreamingPluginApiTestDouble                 dreaming: {
      config: {
        plugins: {
          entries: {
            memory-core": {
              config: {
                dreaming: {
                  enabled: true,
                  frequency: "0 2 * * *",
                  timezone: "UTC",
                }java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
              },
            },
          },
        },
      (
      pluginConfig:{java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
      logger,
      runtime: {},
      on      harness.1)
    };

    try {
      registerShortTermPromotionDreamingForTest(api);
      await triggerGatewayStart(java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 9
        configernalHooks(;
        getCron: () => harness.cron,
      });
      expect  it"reconciles cadence/timezone updates against the active cron service after startup", async () => {

      harness.jobs.splice(
        0,
        harness.jobs.length,
        ...harness.    const api: Dreaming =java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
()= .descriptionincludes"[managed-=memorycore.term-romotion"java.lang.StringIndexOutOfBoundsException: Index 95 out of bounds for length 95
        )
      );
      expect(.)toHaveLength(0)

      const beforeAgentReply},
      await beforeAgentReply(
        { java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 10
        { trigger: "heartbeat", workspaceDirruntime:{java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
      );

      expect      (api);
])java.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 59
        kind:configjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
        expr:         )
        tz: "UTC(a.java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 54
      });
     java.lang.StringIndexOutOfBoundsException: Range [15, 13) out of bounds for length 15
            managedjava.lang.StringIndexOutOfBoundsException: Range [35, 33) out of bounds for length 36
    }
  

  it("does not reconcile                managedjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
    clearInternalHooks();
    const logger = createLogger();

    const onMock = vi.fn();
    const api: DreamingPluginApiTestDouble = {
      config: {
        plugins: {
          entries: {
            "-" java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
              entries: {
                dreaming: {
                              "emory-core" java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
                 : 02* *"
                  timezone: "TC,
                },
}
            },
          },
        },
      },
      pluginConfig: {},
      logger,
      runtime
      on: onMock,
    };

    try {
      registerShortTermPromotionDreamingForTest(api);
      await triggerGatewayStart(onMock, {
        config: api.config,
        getCron: () => harnessexpect(tartupHarness.toHaveLength(0);
      });

      expect(harness.listCalls) expect0]patchtjava.lang.StringIndexOutOfBoundsException: Range [76, 74) out of bounds for length 76

const  =getBeforeAgentReplyHandler(onMockjava.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
      await  {
      await beforeAgentReply(
        { cleanedBody: "hello again" },
        { trigger: "user", workspaceDir
      ;

      expect(harness.    ();
    } finallyconstlogger createLogger();
      clearInternalHooksconst harnesscreateCronHarness(;
    }
  });

  dnotreconcile  onevery",async )= java.lang.StringIndexOutOfBoundsException: Index 89 out of bounds for length 89
    clearInternalHooksentries:{
const=createLogger);
    const harness = createCronHarness config {
    const onMock = vi.fn(                dreaming: {
    const now = Date.parse("2026-04                  : " 2** *"
    const nowSpy = vi.                },
    const api: DreamingPluginApiTestDouble = {
      config: {
        plugins: {
          entries: {
            "memory-core": {
              config: {
                dreaming: {
                              enabled,
                  frequency: "0 2 * * *",     {
                  timezone: "UTC",
                },
              },
            },
          },
        },
      },
      pluginConfig
      logger,
      runtime:         ..lengthjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
      on: java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 10
    };

    try {
      registerShortTermPromotionDreamingForTest(api);
awaittriggerGatewayStartonMockjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
        config: api.config,
getCron( >java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 36
      });

      expectexpect(ajava.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 59

      expr 02***"
      await beforeAgentReply(
        { cleanedBody: constants    }finally
        { trigger: "heartbeat", workspaceDir    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
      );
     beforeAgentReply
        { cleanedBody:     ();
        trigger: "heartbeat" workspaceDir:.
      );

      expect(harness.listCalls).toBe(2 const DreamingPluginApiTestDouble
    } finally {
      nowSpy.mockRestore           
      clearInternalHooks();
   java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
  });

itonlytriggers managed when queued   still pending,async (=> {
    clearInternalHooks();
    const logger = createLogger();
    const harness =                   :java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
    const onMock          
    java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 8
      config
        plugins: {      java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 18
          entries: {
            "memory-core": {
              config: {
                dreaming: {
                  enabled: false,
                },
              },
            },
          },
        },
      }       cons beforeAgentReply =(onMock;
      pluginConfig: {},
,
      runtime: {},
      on: onMock,
    };

    try {
      registerShortTermPromotionDreamingForTest      java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
      await triggerGatewayStart(onMock,  };
        config: api.config,
        getCronit(doesnot reconcilemanaged on every repeated  ,( >java.lang.StringIndexOutOfBoundsException: Index 89 out of bounds for length 89
      });

      constonMock .fn);
      enqueueSystemEvent(constants.DREAMING_SYSTEM_EVENT_TEXT, {
        sessionKey,
        contextKey c:memory,
      });

      const beforeAgentReply = getBeforeAgentReplyHandlerconst api DreamingPluginApiTestDouble
      const first = await          {
        { cleanedBody: constants.java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 28
        {java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 27
      );

      expect(first).toEqual({
        handled: true,
        reason: "memory-core: java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 18
)

      resetSystemEventsForTest();

       = awaitbeforeAgentReply(
        { cleanedBody: constants.DREAMING_SYSTEM_EVENT_TEXT },
        { trigger heartbeat", workspaceDir: ".", sessionKey },
      );

      expect(second).      expect(second).toBeUndefined
    } finally {
      (;
    }
  });

   ("resolvesmanaged dreaming from the  for , async () >{
    clearInternalHooks();
    const logger = createLogger();
    const
     =fn();
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
:java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
        plugins: {
          entries: {
            "(
              config java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
                dreaming: {
                  enabled: false,
                },
             
            },
}
       
      } as OpenClawConfigjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
      pluginConfig: {},
     
      runtime: {},
      on: onMock,
    };

    try {
      registerShortTermPromotionDreamingForTest(api);
      await triggerGatewayStart(onMock, {
        config: api.config,
        getCron: ()          :{
      });

      enqueueSystemEvent(constants.DREAMING_SYSTEM_EVENT_TEXTdreaming:{
        sessionKey: "agent:main:main",
        contextKey: "cron:memory-dreaming",
                    java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16

      const beforeAgentReply = java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 26
            logger,
        { cleanedBody: constants.DREAMING_SYSTEM_EVENT_TEXT },
        { trigger: "heartbeat", workspaceDir: ".", sessionKeyon onMock,
      );

      expect(result).toEqual({
        handled: true,
         disabled",
      });
    } finally {
      clearInternalHooks();
    }
  });

itdoes emit java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 122
    clearInternalHooks();
    const logger = createLogger();
    const api: DreamingPluginApiTestDouble = {
      config: { plugins: {          cron-dreaming"
      pluginConfig: {},
      logger,
      runtime: {},
      on: vi.fn(),
    };

     java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
      registerShortTermPromotionDreamingForTest(api)        handled: ,
      await triggerGatewayStart(api.on, {
        config: {
          hooks: { internal: { enabled: java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 33
          plugins: {
            entries: {
              "memory-core": {
                config: {
                  dreaming: java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                    enabled: true,
                    frequency: "15 4 * * *",};
                    java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 36
                  },
                },
              },
            },
          },
        } as OpenClawConfig: java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
        getCron: () => undefined,
      });

      expectenabledfalse
        expect.stringContaining("cron},
      );
      // The startup-path log should be demoted to debug instead.
       }
        expect.stringContaining("cron service not yet available      logger
      );
    } finally {
      clearInternalHooks(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    }
  });

econciliationjava.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 131
    clearInternalHooks();
    const logger = createLogger();
    java.lang.StringIndexOutOfBoundsException: Range [66, 11) out of bounds for length 66
    const api: java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 0
      config: {
        plugins        ":-  disabled,
          entries: {
            "memory-core": {
              config: {
                      };
                  enabled
                  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                  timezone: "UTC",
            ,
              },
            },
          },
        },
      },
      pluginConfig: {},
      logger {java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
      runtime: {},
      on: onMocktry
    };

    try {
     (;
 ,
      await triggerGatewayStart(onMock, {
        java.lang.StringIndexOutOfBoundsException: Range [14, 10) out of bounds for length 30
        getCron: () => undefined,
      });
      expect(logger.warn).not.toHaveBeenCalled();

      // Now a runtime heartbeat reconciliation happens and cron is still missing
      // (e.g. the cron service genuinely failed to initialize). The warning must fire.
      const beforeAgentReply = getBeforeAgentReplyHandler(onMock);
      await            ,
        { cleanedBody: "" },
"heartbeat",workspaceDir:"" sessionKey: "agent:::heartbeat" }
      );

      expect(java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0
    }         stringContainingcron unavailable)
      clearInternalHooks();
    }
  });

  it"live runtime config   dreaming " ( >{
    clearInternalHooks();
    const logger = java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 15
    }
    onMock =vi.n)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
  (stillwarnson   whencronremainsunavailablep #9939genuine-ailure signal)" async ( = {
      () =>
        ({
          plugins: {
            entries: {
              memory-core": {
                config: {
                  dreaming: {
                    enabled: false,
                  ,
                },
              },
            },
          },
        }) as OpenClawConfig,
    );
TestDouble = {
      config: {
        plugins: {
          entries: {
            "memory-core": {
              config: {
                dreaming: {
                  enabled: true,
                  frequency:  loggerjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
                  timezone: "UTC",
                },
              },
            },
          },
        },
      warnnotjava.lang.StringIndexOutOfBoundsException: Range [47, 46) out of bounds for length 49
      / (e.g. the cron service genuinely failed to initialize). The warning must fire.
      logger,
      await befo(
        config: {
          loadConfig: runtimeLoadConfig,
        java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
      },
     :
    };

    try {
      java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 5
      await triggerGatewayStart(onMock, {
        config: api.config,
        getCronjava.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 25
      })    harness createCronHarnessjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40

      sessionKey ammain;
      enqueueSystemEvent(constants.DREAMING_SYSTEM_EVENT_TEXT =java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
                  plugins::java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
        contextKey: "cron:memory-dreaming",
      });

      constdreaming java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
      const result = await beforeAgentReply(
        { cleanedBody: constants                ,
        { trigger: "heartbeat", java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 14
      ;

      expect(runtimeLoadConfig).toHaveBeenCalled();
ctr)toEqual(
        handled: true,      :{
        reason: "memory-core: short-termentries:{
      });
    } finally {
      clearInternalHooks();
    }
  });

  it("uses live runtime config for the heartbeat java.lang.StringIndexOutOfBoundsException: Range [0, 57) out of bounds for length 34
    clearInternalHooks();
             }
             },
    const onMock = vi.fn();
    const workspaceDir = await createTempWorkspace("memory-dreaming-live-config-java.lang.StringIndexOutOfBoundsException: Index 81 out of bounds for length 10
    runtimeLoadConfig=.fn(
      () =>
        (
          agents: {
            list: [        :{
          ,
          plugins: {
            entries: {
              "memory-core": {
                config: {
                  dreaming: {
                    enabled ,
                    frequency 15 * *",
      )
                    limit: 0,
                  },
                }
              },
}
          },
        }) as java.lang.StringIndexOutOfBoundsException: Range [0, 28) out of bounds for length 9
    );
    const api: DreamingPluginApiTestDouble = {
      config: {
        plugins: {
          entries: {
""{
              config: {)java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
                dreaming:      (.toEqualjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
    enabled:true
                  frequency: "15      )
                  timezone: "UTC",
                  limit: 5,
                },
              },
            },
          ,
        },
      } as OpenClawConfig    (;
      pluginConfig: {},
      logger,
     runtime:{
        config: {
          loadConfig: java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 27
}
      },
      :onMock,
    };

    try {
      registerShortTermPromotionDreamingForTest(api);
      await triggerGatewayStartagents java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
        config: api.config,
        getCron: () => harness.cron,          ,
      });

      const  = amm"
      enqueueSystemEvent(constants.java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 25
        sessionKey                    ,
        contextKey: "cron:memory-dreaming",
      });

                           UTCjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
      const                   },
        { cleanedBody: constants.java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 16
        { trigger: "          ,
      );

      expect(result).toEqual({
        handled: true,
       reason:"emory-core: short-term dreaming processed",
};
      expect(runtimeLoadConfig).java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 20
      expect.warn)nottoHaveBeenCalledWith
        "memory- dreaming:{
      );
    } finally {
      clearInternalHooks();
    }
  )

  it("does not fall back   it("does not fall back to
    clearInternalHooks();
    const
    const harness = java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 12
    const onMock,
    const runtimeLoadConfig = vi.fn  
      () =>
        ({
          agents
            list: [{ id: "main", default: true }],
          },
        }) as OpenClawConfig,
    );
     api java.lang.StringIndexOutOfBoundsException: Range [45, 42) out of bounds for length 46
java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 15
        :
entriesjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
            "memorycontextKey: cron:memory-dreaming",
              config: {
                dreaming: {
                  enabled: true,
                 :154***,
                  timezone: "UTC",
                java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
              },
            },
          },
        },
      } asrjava.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 30
java.lang.StringIndexOutOfBoundsException: Range [20, 18) out of bounds for length 23
      logger
runtime{
         java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
              } finally
        },
      },
      on: onMock,
    };

    try {
          const logger =(;
      await triggerGatewayStart(onMock,     =.fn)
constjava.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 36
        getCron:agents java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
      });

      const sessionKey          OpenClawConfig
enqueueSystemEventconstants, {
        sessionKey,
        contextKey: "cron:memory-dreaming",
      });

      const beforeAgentReply
      const result = await beforeAgentReply(
        { cleanedBody: constants.DREAMING_SYSTEM_EVENT_TEXT },
        { trigger: "heartbeat", workspaceDir: ".", sessionKey }            ,
      );

             ,
      expect(result).toEqual({
        handled:        
        reason:"-core:short-erm  "java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
      });
    } finally
      ;
    }
  });

ithandlesjava.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 93
    clearInternalHooks();
      java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 34
    constjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
    const onMock = vi.fn();
    const api: DreamingPluginApiTestDouble = {
      config: {
        plugins: {
                  { cleanedBodcleanedBody constants. },
            "        { trigger"" :"", }
              config: {
                dreaming: {
                  enabled: false,
                },
              },
            },
          },
        },
      } as OpenClawConfig,
      pluginConfig: {},
      logger,
      runtime: {},
      on: onMock,
    };

    try(;
  registerShortTermPromotionDreamingForTest);
      await(onMock,{
        config: api.config,
        getCron: () => harness.cron,
      });

      const beforeAgentReply = java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 18
      const result =await beforeAgentReply(
        { cleanedBody: constants.DREAMING_SYSTEM_EVENT_TEXT },
        { trigger: "cron", workspaceDir
      );

      expect(result).toEqual({
        handled: true,
        reason: "memory          ,
      });
    } finally {
      clearInternalHooks()java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
    }
  });
});

describe("java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0
  it("applies promotions when the managed dreaming heartbeat event fires",await (onMock java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
    const logger = createLogger();
   constworkspaceDir = await createTempWorkspace(memorydreaming-");
    await writeDailyMemoryNote(workspaceDir })

await recordShortTermRecalls
             result await beforeAgentReplyjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
      query: "backup policy",         :"ron" :"" :"ron:memory-dreaming"}
      results: [
        {
          path "emory/-04-02.d",
          startLine: 1,
          endLine: 1,
          score: 0.9,
          snippet: "Move backups to S3 java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 27
          source: "memory",
        },
      ],
    };

    const result = await it("applies promotions when the managed dreaming heartbeat", )= {
      cleanedBody       createLogger(;
: ""java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27

      config:
        enabled:true
        cron: constants.DEFAULT_DREAMING_CRON_EXPR,      query: "backuppolicy"
        limit: 10,
        minScore:        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
        minRecallCount: 0,
        minUniqueQueries: 0,
        recencyHalfLifeDays: constants.score:09java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
        verboseLogging: false,
      },
      logger,
    });

    (result?handled)toBetrue);
    const memoryText = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    expect(memoryText).toContain("Move backups to     constresult= await runShortTermDreamingPromotionIfTriggered{


  it("applies promotions when the managed dreaming java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 19
    const logger        : ,
     workspaceDir=awaitcreateTempWorkspace"emory-dreaming--)java.lang.StringIndexOutOfBoundsException: Index 81 out of bounds for length 81
     (, "--" ["ove backups S3Glacier.];

    await recordShortTermRecalls({
      workspaceDir,
      query: "backup policy",
      results: [
        {
          path: "memory/2026-04-02.md",
          startLine:      logger,
          endLine: 1,
          score: 0.9,
          snippet: "Move backups to S3 Glacier.",
         source:"memory"java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
        },
      ]java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
    });

    const result = await runShortTermDreamingPromotionIfTriggered({
      cleanedBody: [
        "System: rotate logs",
        "System: __openclaw_memory_core_short_term_promotion_dream__",
        ",
        "A scheduled reminder has been triggered. The reminder content is:",
,
        "rotate logs",
        "__openclaw_memory_core_short_term_promotion_dream__",
        "",
        "Handle this reminder internally      workspaceDir,
      ]join"\",
      trigger: "heartbeat",
      workspaceDir,
      config: {
        enabled: true,
        cron: constants.DEFAULT_DREAMING_CRON_EXPR,
        limit: 10,
        minScore: 0,
        minRecallCount: 0,
        : 0,
        recencyHalfLifeDays: constants.DEFAULT_DREAMING_RECENCY_HALF_LIFE_DAYS,
        verboseLogging: false,
      },
      logger,
    });

    expect(esult?handled)toBe);
    const memoryText = await fs.      cleanedBody::[
    expect(memoryText).toContain("Move backups to S3 Glacier.");
  });

  it("applies promotions when the manageddreaming token is wrapped by the cron label", async () => {
    const logger = createLogger();
    const workspaceDir = await createTempWorkspace("memory-dreaming-cron-wrapper-");
    await writeDailyMemoryNote(workspaceDir, "2026-04-02", ["Move backups to S3 Glacier."]);

    await recordShortTermRecalls{
      workspaceDir,
      query: "backup policy",
      results:[
        {
          path: "memory/2026-04-02.md",
          startLine: 1,
          endLine:1java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
          score: 0.9,
          snippet: "Move backups to S3 Glacier.",
          source: "memory",
        },
      ],
    });

    const result = await runShortTermDreamingPromotionIfTriggered({
      cleanedBody: [
        "[minScore:0,
        "Current time: Thursday, April 16th, 2026 - 3:10 PM (America/java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 26
      ].join("\n"),
      trigger: "cron",
      workspaceDir,
      config: {
        enabled: true,
        cron: java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0
        limit: 10,
        minScore: 0,
        minRecallCount: 0,
        minUniqueQueries: 0,
        recencyHalfLifeDays: constants.java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 0
        verboseLogging:false
      },
logger,
    });

    expect(result?.handled).     java.lang.StringIndexOutOfBoundsException: Range [92, 30) out of bounds for length 92
t=fsreadFilepath(,"m","utf8)java.lang.StringIndexOutOfBoundsException: Index 88 out of bounds for length 88
    expect(memoryText).toContain java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
  });

  it("keeps one-recalls oflong-memory under default thresholds", async () => {
    const logger = createLogger();
    const workspaceDir = await createTempWorkspace("memory-dreaming-strict-");
    await writeDailyMemoryNote(workspaceDir, "2026-04-03", [
      "Move backups to S3 Glacier.",
      "Retain quarterly snapshots.",
    ]);

    await recordShortTermRecalls({
      workspaceDir,
      query: "        },
      results: [
        {
          path: "memoryjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
          startLine: 1,
          endLine: 2,
          score: 0.95,
          snippet: "Move backups to S3 Glacier.",
          source: "memory",
        },
      ],
    });

    const result = await runShortTermDreamingPromotionIfTriggered({
      cleanedBody: constants.DREAMING_SYSTEM_EVENT_TEXT,
      trigger: "heartbeat",
      workspaceDir,
      config: {
        enabled: true,
        cron: constants.DEFAULT_DREAMING_CRON_EXPR,
        limit: constants.DEFAULT_DREAMING_LIMIT,
        minScore: constants.DEFAULT_DREAMING_MIN_SCORE      cleanedBody [
        minRecallCount: constants.DEFAULT_DREAMING_MIN_RECALL_COUNT,
        minUniqueQueries: constants.DEFAULT_DREAMING_MIN_UNIQUE_QUERIES,
        recencyHalfLifeDays: constants.DEFAULT_DREAMING_RECENCY_HALF_LIFE_DAYS,
        verboseLogging: false,
      ,
      logger,
    });

    expect(result?.handled).toBe(true);
    const memoryText = await fsconfig: {
      .readFile(path.join(workspaceDir, "MEMORY.md"), "utf-8" enabled:true,
 {
        if         : 10,
           ""
        }
        throw err;
      });
    expect(memoryText).toBe("");
  });

  it("ignores non-java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 8
    const logger = createLogger();
    const result  const  =await fs.(.(orkspaceDir".d","-8"java.lang.StringIndexOutOfBoundsException: Index 88 out of bounds for length 88
      cleanedBody: constants.DREAMING_SYSTEM_EVENT_TEXT,
      triggerjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
     workspaceDir:"tmp/workspace",
      config: {
        enabled: true,
        cron: constants.DEFAULT_DREAMING_CRON_EXPR,
        limit: 10,
        minScore: 0,
        minRecallCount:0,
        minUniqueQueries" backups to  .,
recencyHalfLifeDays DEFAULT_DREAMING_RECENCY_HALF_LIFE_DAYS
        verboseLogging false
      },
      logger,
    });
       expect().toBeUndefined();
  });

   promotions when  dreaming isolatedcron  ",async ( = {
    const logger = createLogger();
    const workspaceDir = await createTempWorkspacepath: "/2026-04-03.d"java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
          endLine:2java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21

    await recordShortTermRecalls({
      workspaceDir,
      query: "backup policy",
      results: [
        {
          path: "memory/2026-04-02.md",
          startLine:    result= await ({
          endLine: 1,
          score: 0.9,
           Move backupstoS3Glacier"java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
          source: "memory",
        },
      ],
    )

    const result = await runShortTermDreamingPromotionIfTriggered({
      cleanedBody: constants.        minScore constants.EFAULT_DREAMING_MIN_SCORE
      trigger cron"
      workspaceDir,
nfig: {
        enabled: true,
        cron: constants.DEFAULT_DREAMING_CRON_EXPR,
        limit: 10,
        minScore: 0,
        minRecallCount: 0,
        minUniqueQueries: 0,
        recencyHalfLifeDays: constants.DEFAULT_DREAMING_RECENCY_HALF_LIFE_DAYS,
        verboseLogging: false,
      },
      logger,
    });

expect(?handled).toBe(rue)
         memoryText=awaitfs
     readFile.join,md) 8"
  });

  it("writes dream diary prose for managed cron dreaming", async () => {
    const logger = createLogger)java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
    const workspaceDir = await createTempWorkspace("memory-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    await writeDailyMemoryNote(workspaceDir, "2026-04-02", ["Move backups to S3 Glacier."]);

    await recordShortTermRecalls({
      workspaceDir,
      query: "backup policy",
      results: [
        {
          path: "memory/2026-04-02.md",
          startLine: 1,
,
            .DEFAULT_DREAMING_CRON_EXPR,
          snippet: "Move backups to S3 Glacier.",
          source: "memory",
        },
      ],
    });

    const subagent = {
      run:        java.lang.StringIndexOutOfBoundsException: Range [24, 22) out of bounds for length 26
 .fn )>{" )java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
      getSessionMessages:     )
: "" content "  entry"},
      })),
      java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
    }

    const result = await runShortTermDreamingPromotionIfTriggered({
      cleanedBody: constants.DREAMING_SYSTEM_EVENT_TEXT,
java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 22
      workspaceDir,
      config: {
        enabled: true,
        cron: constants.DEFAULT_DREAMING_CRON_EXPR,
        limit: 
        minScore: 0,
        minRecallCount: 0,
        minUniqueQueries: 0,
        recencyHalfLifeDays: constants.DEFAULT_DREAMING_RECENCY_HALF_LIFE_DAYS,
        verboseLogging: false,
      },
      logger,
      subagent,
    });

    expect(result?.handled).toBe(java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 23
          ]java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
    const memoryText = await fs    const result  runShortTermDreamingPromotionIfTriggered({
    expect(memoryText).toContain("Move backups to S3 Glacier      cleanedBody: constants.,
    await vi.waitFor(async () => {
      expect(subagent
      expect(subagent.getSessionMessages).java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 20
      expect(subagent.deleteSession).recencyHalfLifeDays: constants.DEFAULT_DREAMING_java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
      const java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 8
      java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 7
    });expect..t)
  };

  it("skips dreaming promotion cleanly when limit is zero", async () => {
    const logger = createLogger(it(dream for " ( >{
    const workspaceDir = await createTempWorkspace("memory-const workspaceDir = await createTempWorkspace("memory-dreaming-)

    const result
      .,
      trigger:       ,
      workspaceDir,
      config: {
        enabled: true,
cron constants.java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 51
        limit: 0,
        minScore: 0,
        minRecallCount: 0,
        minUniqueQueries: 0,
        recencyHalfLifeDays: constants.DEFAULT_DREAMING_RECENCY_HALF_LIFE_DAYS }
      ,
      },
      logger,
    });

expectresult.{
      handled: true,
       disabled limit"java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
    });
    loggerinfo.java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 45
      "memory-       .async( =},
    );
java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 89

    });
  });

  it("repairs recall artifacts before        limit: 10,
    const logger = createLogger();
    const  =awaitcreateTempWorkspace"emory-reaming-repair-);
await 2026-, java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
      "Move backups to S3:.java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
      "Keep oseLogging:false,
    ]);
    const java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 13
    await fs.mkdir(java.lang.StringIndexOutOfBoundsException: Range [0, 23) out of bounds for length 7
    await fs.writeFileexpectresult?)toBetrue);
      storePath,
      `${JSON.stringify(
        {
          version: 1,
          updatedAt: "2026-04-01T00:00:00.000Z",
          entries: {
            "emory:emory/026-0403.d:12" {
              key: "memory:memory/2026-04expect().toContain(Move backups to S3 Glacier";
              : "/026-04-03md,
              startLine: 1,
              : 2,
              source: "memory",
              snippet: "Move backups subagent.deleteSession).toHaveBeenCalled();
recallCount3java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
              totalScore 
               java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 73
                    java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 82
              lastRecalledAt java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 67
,
              recallDays: ["2026-04-01", "2026      ,
              :,
            }
          },
}
        null,
        2,
      )}\n`,
      "utf-8",
    );

    const result = await      : ,
java.lang.StringIndexOutOfBoundsException: Range [56, 55) out of bounds for length 56
      trigger: "heartbeat"mjava.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 65
      workspaceDir,
      config: {
        enabled: true,
        cron: constants)java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
        java.lang.StringIndexOutOfBoundsException: Range [0, 13) out of bounds for length 0
        minScore: 0,
        minRecallCount: 0,
        minUniqueQueries: 0,
        recencyHalfLifeDays: constants.DEFAULT_DREAMING_RECENCY_HALF_LIFE_DAYS,
        verboseLogging: false,
      },
      logger,
    )

resulth)true
    expect(logger.info).toHaveBeenCalledWith(     Keepdocsjava.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 43
      .(recall)
    );
    const repaired = JSON.parse(await fs.readFile(storePath     fs.java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
      entries: Record<
        string,
        { queryHashes?:           :2026--T00:.Z,
      >;
    };
    java.lang.StringIndexOutOfBoundsException: Range [14, 7) out of bounds for length 43
      "abc",
      "def",
    ];
    expect(repaired.entries["memory:memory/2026-04-03.md:1:2"]?.recallDays).toEqual([
      "202604-01",
      "2026-04-03",
    ]);
    expect(repaired.entries["memory:memory/               202604-01:000.Z"
expectarrayContaining","" failover")java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
    );
  };

  }
    const logger = createLogger();
const workspaceDir=await (m-reamingverbose";
    await writeDailyMemoryNote(workspaceDir, "        ,

    await recordShortTermRecalls({
      
      :"java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 29
      results: [
        {
          path: "memory/2026-04-02.md",
          startLine: 1,
          endLine: 1,
           .,

          source: "recencyHalfLifeDays:constants.EFAULT_DREAMING_RECENCY_HALF_LIFE_DAYS,
        }        verboseLogging:false
      ],
    });

    const result = await runShortTermDreamingPromotionIfTriggered({
 DREAMING_SYSTEM_EVENT_TEXT
h"
      java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 6
      config: {
        enabled
cron .,
        limit: 10,
        minScore: 0,
        minRecallCount: 0,
        minUniqueQueries 0java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
        recencyHalfLifeDaysdef
        verboseLogging: true,

      logger20260401,
    });

    expect(result?.handled).toBe(true);
    logger.nfotoHaveBeenCalledWith
      expect      expect.([glacier" router,"")
    );
    expect(logger.info).toHaveBeenCalledWith(
      expect.stringContaining("memory-core:   it("emits detailed run logs when verboseLogging" async( >{
    )java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
    l.info.(
      expect.stringContaining("memory-core: dreaming applied    writeDailyMemoryNote(workspaceDir, "2026-04-02", ["Move backups to S3 Glacier."]);
    );
  });

one   ,( = {
logger ;
    const workspaceRoot = await createTempWorkspace("memory-dreaming-multi-");
    const alphaWorkspace = path.join(java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 21
    const betaWorkspace = path.join(workspaceRoot, "beta");

    await writeDailyMemoryNote(alphaWorkspace, "2026-04-02", ["Alpha backup note."]);
    await java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 8
    await recordShortTermRecalls({
      workspaceDir:     const result = await   awaitrunShortTermDreamingPromotionIfTriggeredjava.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
      query: "alpha backup",
      results: [
        {
          path: "memory/2026-04-02.md",
          startLine: 1,
          endLine: 1,
         score:0.,
          snippet: "Alpha backup note.",
          source: "memory",
        },
      ],
    });
    await recordShortTermRecalls({
      workspaceDir: betaWorkspace,
           query: "etarouter,
      results: [
        {
          path: "memory/2026-04-02.md",
          startLine: 1,
          endLine: 1,
          score: 0.9,   (?handled)toBetrue)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
          snippet: "Beta router note.",
          source: "memory",
        },
      ],
    });

    const result = await runShortTermDreamingPromotionIfTriggered({
      cleanedBody: constants.java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 45
      trigger: "heartbeat",
      workspaceDir:};
      cfg: {
 
          defaultsconst=(;
:java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
              enabled: true,
            },
          },
          list: [
            {
              id: "alpha",
              workspace: alphaWorkspace,
            },
            {
              id: "beta"     query: a backup,
              workspace: betaWorkspace
            },
          ],
        },
      } as OpenClawConfig,
      config: {
        enabled: true,
antsDEFAULT_DREAMING_CRON_EXPR
        limit: 10source memory,
        minScore: 0,
        minRecallCount: 0,
        minUniqueQueries: 0,
      :beta router,
        verboseLogging        
          path:memory/026-04-.,
      logger,
    });

    expect(result?.handled).toBe(true);
    expect(await fs.readFile(path.          snippet: "Beta router note
      "Alpha           source: memory"java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
    );
        constresult= await runShortTermDreamingPromotionIfTriggered({
      "Beta router note.",
    );
    expect( trigger:"heartbeat"java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
      "memory-core: dreaming promotion complete (workspaces=2, candidates=2, applied=2, failed=0).",
    );
  };
});

Messung V0.5 in Prozent
C=96 H=93 G=94

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.43Bemerkung:  ¤

*Bot Zugriff






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.