@remnic/plugin-openclaw 9.3.636 → 9.3.637

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.
package/dist/index.js CHANGED
@@ -4322,6 +4322,85 @@ async function loadHourlySummaryCronJobsData(cronFilePath) {
4322
4322
  };
4323
4323
  }
4324
4324
  }
4325
+ function resolveHourlySummaryCronRouting(cfg) {
4326
+ const model = cfg.summaryModel || cfg.taskModelChain?.primary || void 0;
4327
+ if (!model || model !== cfg.taskModelChain?.primary) {
4328
+ return { model, fallbacks: [] };
4329
+ }
4330
+ const fallbacks = [];
4331
+ const seen = /* @__PURE__ */ new Set([model]);
4332
+ const add = (value) => {
4333
+ if (typeof value !== "string") return;
4334
+ const trimmed = value.trim();
4335
+ if (trimmed.length === 0 || seen.has(trimmed)) return;
4336
+ seen.add(trimmed);
4337
+ fallbacks.push(trimmed);
4338
+ };
4339
+ for (const fb of cfg.taskModelChain?.fallbacks ?? []) add(fb);
4340
+ const gatewayDefault = cfg.gatewayConfig?.agents?.defaults?.model;
4341
+ add(gatewayDefault?.primary);
4342
+ for (const fb of Array.isArray(gatewayDefault?.fallbacks) ? gatewayDefault.fallbacks : []) {
4343
+ add(fb);
4344
+ }
4345
+ return { model, fallbacks };
4346
+ }
4347
+ function buildHourlySummaryCronJob(cfg, opts) {
4348
+ const { model, fallbacks } = resolveHourlySummaryCronRouting(cfg);
4349
+ return {
4350
+ id: opts.jobId,
4351
+ agentId: "generalist",
4352
+ ...model ? { model } : {},
4353
+ name: "Remnic Hourly Summary",
4354
+ enabled: true,
4355
+ createdAtMs: opts.nowMs,
4356
+ updatedAtMs: opts.nowMs,
4357
+ schedule: {
4358
+ kind: "cron",
4359
+ expr: `${opts.minute} * * * *`,
4360
+ // Every hour at the given minute
4361
+ tz: "America/Chicago"
4362
+ },
4363
+ sessionTarget: "isolated",
4364
+ wakeMode: "now",
4365
+ payload: {
4366
+ kind: "agentTurn",
4367
+ timeoutSeconds: 120,
4368
+ thinking: "off",
4369
+ ...model ? { model } : {},
4370
+ ...fallbacks.length > 0 ? { fallbacks } : {},
4371
+ message: "You are OpenClaw automation.\n\nTask: Generate Remnic hourly summaries.\n\nCall the tool `memory_summarize_hourly` with empty params.\n\nOutput policy:\n- If you generated summaries successfully: output exactly NO_REPLY.\n- If there is an error: output one concise line describing it.\n\nRules:\n- Do NOT send anything to Discord.\n- Never print secrets.\n"
4372
+ },
4373
+ delivery: { mode: "none" },
4374
+ state: {}
4375
+ };
4376
+ }
4377
+ function reconcileHourlySummaryCronRouting(existing, cfg, opts) {
4378
+ if (!isRecordLike(existing.payload)) {
4379
+ return { changed: false, job: existing };
4380
+ }
4381
+ const { model, fallbacks } = resolveHourlySummaryCronRouting(cfg);
4382
+ const desiredModel = model ?? void 0;
4383
+ const desiredFallbacks = fallbacks.length > 0 ? fallbacks : void 0;
4384
+ const payload = { ...existing.payload };
4385
+ const curRoot = typeof existing.model === "string" ? existing.model : void 0;
4386
+ const curPayloadModel = typeof payload.model === "string" ? payload.model : void 0;
4387
+ const curFallbacks = Array.isArray(payload.fallbacks) ? payload.fallbacks : void 0;
4388
+ const fallbacksEqual = curFallbacks === void 0 && desiredFallbacks === void 0 ? true : JSON.stringify(curFallbacks) === JSON.stringify(desiredFallbacks);
4389
+ const changed = curRoot !== desiredModel || curPayloadModel !== desiredModel || !fallbacksEqual;
4390
+ if (!changed) return { changed: false, job: existing };
4391
+ if (desiredModel === void 0) delete payload.model;
4392
+ else payload.model = desiredModel;
4393
+ if (desiredFallbacks === void 0) delete payload.fallbacks;
4394
+ else payload.fallbacks = desiredFallbacks;
4395
+ const job = {
4396
+ ...existing,
4397
+ payload,
4398
+ updatedAtMs: opts.nowMs
4399
+ };
4400
+ if (desiredModel === void 0) delete job.model;
4401
+ else job.model = desiredModel;
4402
+ return { changed: true, job };
4403
+ }
4325
4404
  async function realPathLater(filePath) {
4326
4405
  const fs2 = await import(NODE_FS_PROMISES_MODULE_ID);
4327
4406
  return fs2.realpath(filePath);
@@ -6420,11 +6499,12 @@ Keep the reflection grounded in the evidence below.
6420
6499
  };
6421
6500
  const remnicMemoryFlushPlanResolver = () => {
6422
6501
  const maxTurnChars = typeof cfg.extractionMaxTurnChars === "number" && Number.isFinite(cfg.extractionMaxTurnChars) ? Math.max(1e3, Math.floor(cfg.extractionMaxTurnChars)) : 8e3;
6502
+ const flushModel = typeof cfg.summaryModel === "string" && cfg.summaryModel.length > 0 ? cfg.summaryModel : cfg.taskModelChain?.primary;
6423
6503
  return {
6424
6504
  softThresholdTokens: 24e3,
6425
6505
  forceFlushTranscriptBytes: Math.max(16384, maxTurnChars * 4),
6426
6506
  reserveTokensFloor: 2e3,
6427
- model: typeof cfg.summaryModel === "string" && cfg.summaryModel.length > 0 ? cfg.summaryModel : cfg.model,
6507
+ ...flushModel ? { model: flushModel } : {},
6428
6508
  prompt: "Flush the recent OpenClaw transcript into Remnic memory. Preserve durable user preferences, project facts, decisions, corrections, and commitments. Ignore runtime metadata, credentials, and transient command noise.",
6429
6509
  systemPrompt: "You are Remnic's memory flush planner. Produce concise durable memory candidates only when the transcript contains information worth remembering.",
6430
6510
  relativePath: ["state", "plugins", serviceId, "flush-plan.md"].join("/")
@@ -7118,38 +7198,31 @@ Keep the reflection grounded in the evidence below.
7118
7198
  return;
7119
7199
  }
7120
7200
  const jobsData = loadedJobs.status === "loaded" ? loadedJobs.jobsData : { version: 1, jobs: [] };
7121
- const exists = jobsData.jobs.some((j) => j.id === jobId);
7122
- if (exists) {
7123
- logger_exports.log.debug("hourly summary cron job already exists");
7201
+ const existingIndex = jobsData.jobs.findIndex((j) => j.id === jobId);
7202
+ if (existingIndex >= 0) {
7203
+ const { changed, job } = reconcileHourlySummaryCronRouting(
7204
+ jobsData.jobs[existingIndex],
7205
+ cfg,
7206
+ { nowMs: Date.now() }
7207
+ );
7208
+ if (!changed) {
7209
+ logger_exports.log.debug("hourly summary cron job already up to date");
7210
+ return;
7211
+ }
7212
+ jobsData.jobs[existingIndex] = job;
7213
+ await writeTextFileLater(
7214
+ cronFilePath,
7215
+ JSON.stringify(jobsData, null, 2)
7216
+ );
7217
+ logger_exports.log.info("reconciled hourly summary cron job routing to configured task model");
7124
7218
  return;
7125
7219
  }
7126
- const model = cfg.summaryModel || cfg.model || config_exports.DEFAULT_REASONING_MODEL;
7127
7220
  const randomMinute = Math.floor(Math.random() * 59) + 1;
7128
- const newJob = {
7129
- id: jobId,
7130
- agentId: "generalist",
7131
- model,
7132
- name: "Remnic Hourly Summary",
7133
- enabled: true,
7134
- createdAtMs: Date.now(),
7135
- updatedAtMs: Date.now(),
7136
- schedule: {
7137
- kind: "cron",
7138
- expr: `${randomMinute} * * * *`,
7139
- // Every hour at random minute
7140
- tz: "America/Chicago"
7141
- },
7142
- sessionTarget: "isolated",
7143
- wakeMode: "now",
7144
- payload: {
7145
- kind: "agentTurn",
7146
- timeoutSeconds: 120,
7147
- thinking: "off",
7148
- message: "You are OpenClaw automation.\n\nTask: Generate Remnic hourly summaries.\n\nCall the tool `memory_summarize_hourly` with empty params.\n\nOutput policy:\n- If you generated summaries successfully: output exactly NO_REPLY.\n- If there is an error: output one concise line describing it.\n\nRules:\n- Do NOT send anything to Discord.\n- Never print secrets.\n"
7149
- },
7150
- delivery: { mode: "none" },
7151
- state: {}
7152
- };
7221
+ const newJob = buildHourlySummaryCronJob(cfg, {
7222
+ jobId,
7223
+ minute: randomMinute,
7224
+ nowMs: Date.now()
7225
+ });
7153
7226
  jobsData.jobs.push(newJob);
7154
7227
  await writeTextFileLater(
7155
7228
  cronFilePath,
@@ -7914,4 +7987,4 @@ async function checkDaemonHealth(host, port) {
7914
7987
  }
7915
7988
  }
7916
7989
  var export_loadDaySummaryPrompt = day_summary_exports.loadDaySummaryPrompt;
7917
- export { checkDaemonHealth, src_default as default, detectBridgeMode, embedWithOpenClawProvider, listRemnicPublicArtifacts, export_loadDaySummaryPrompt as loadDaySummaryPrompt, loadHourlySummaryCronJobsData, loadOpenClawMemoryEmbeddingSdk, parseHourlySummaryCronJobsData, selectOpenClawMemoryEmbeddingSdk };
7990
+ export { buildHourlySummaryCronJob, checkDaemonHealth, src_default as default, detectBridgeMode, embedWithOpenClawProvider, listRemnicPublicArtifacts, export_loadDaySummaryPrompt as loadDaySummaryPrompt, loadHourlySummaryCronJobsData, loadOpenClawMemoryEmbeddingSdk, parseHourlySummaryCronJobsData, reconcileHourlySummaryCronRouting, selectOpenClawMemoryEmbeddingSdk };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "openclaw-remnic",
3
3
  "name": "Remnic OpenClaw Plugin",
4
- "version": "9.3.636",
4
+ "version": "9.3.637",
5
5
  "kind": "memory",
6
6
  "description": "Local semantic memory for OpenClaw with bundled Remnic core runtime. Requires plugins.slots.memory set to this plugin id for hooks to fire.",
7
7
  "setup": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnic/plugin-openclaw",
3
- "version": "9.3.636",
3
+ "version": "9.3.637",
4
4
  "description": "OpenClaw adapter for Remnic memory with bundled @remnic/core runtime",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -72,7 +72,7 @@
72
72
  "dependencies": {
73
73
  "@sinclair/typebox": "^0.34.0",
74
74
  "openai": "^6.0.0",
75
- "@remnic/core": "^9.3.636"
75
+ "@remnic/core": "^9.3.637"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "openclaw": ">=2026.4.1 || 2026.4.7-1 || 2026.4.9-beta.1 || 2026.4.11-beta.1 || 2026.4.12-beta.1 || 2026.4.14-beta.1 || 2026.4.15-beta.1 || 2026.4.15-beta.2 || 2026.4.19-beta.1 || 2026.4.19-beta.2 || 2026.4.20-beta.1 || 2026.4.20-beta.2 || 2026.4.22-beta.1 || 2026.4.23-beta.1 || 2026.4.23-beta.2 || 2026.4.23-beta.3 || 2026.4.23-beta.4 || 2026.4.23-beta.5 || 2026.4.23-beta.6 || 2026.4.24-beta.1 || 2026.4.24-beta.2 || 2026.4.24-beta.3 || 2026.4.24-beta.4 || 2026.4.24-beta.5 || 2026.4.24-beta.6 || 2026.4.25-beta.1 || 2026.4.25-beta.2 || 2026.4.25-beta.3 || 2026.4.25-beta.4 || 2026.4.25-beta.5 || 2026.4.25-beta.6 || 2026.4.25-beta.7 || 2026.4.25-beta.8 || 2026.4.25-beta.9 || 2026.4.25-beta.10 || 2026.4.25-beta.11 || 2026.4.26-beta.1 || 2026.4.27-beta.1 || 2026.4.29-beta.1 || 2026.4.29-beta.2 || 2026.4.29-beta.3 || 2026.4.29-beta.4 || 2026.4.30-beta.1 || 2026.5.2-beta.1 || 2026.5.2-beta.2 || 2026.5.2-beta.3 || 2026.5.3-1 || 2026.5.3-beta.1 || 2026.5.3-beta.2 || 2026.5.3-beta.3 || 2026.5.3-beta.4 || 2026.5.4-beta.1 || 2026.5.4-beta.2 || 2026.5.4-beta.3 || 2026.5.5-beta.1 || 2026.5.5-beta.2 || 2026.5.6-beta.1 || 2026.5.7-beta.1 || 2026.5.9-beta.1 || 2026.5.10-beta.1 || 2026.5.10-beta.2 || 2026.5.10-beta.3 || 2026.5.10-beta.4 || 2026.5.10-beta.5 || 2026.5.10-beta.6 || 2026.5.12-beta.1 || 2026.5.12-beta.2 || 2026.5.12-beta.3 || 2026.5.12-beta.4 || 2026.5.12-beta.5 || 2026.5.12-beta.6 || 2026.5.12-beta.7 || 2026.5.12-beta.8 || 2026.5.14-beta.1 || 2026.5.14-beta.2 || 2026.5.16-beta.1 || 2026.5.16-beta.2 || 2026.5.16-beta.3 || 2026.5.16-beta.4 || 2026.5.16-beta.5 || 2026.5.16-beta.6 || 2026.5.16-beta.7 || 2026.5.18-beta.1 || 2026.5.19-alpha.1 || 2026.5.19-beta.1 || 2026.5.19-beta.2 || 2026.5.20-beta.1 || 2026.5.20-beta.2 || 2026.5.21-alpha.1 || 2026.5.21-beta.1 || 2026.5.22-beta.1 || 2026.5.23-alpha.1 || 2026.5.24-alpha.1 || 2026.5.24-beta.1 || 2026.5.24-beta.2 || 2026.5.25-alpha.1 || 2026.5.25-alpha.2 || 2026.5.25-beta.1 || 2026.5.26-beta.1 || 2026.5.26-beta.2 || 2026.5.27-alpha.1 || 2026.5.27-beta.1 || 2026.5.28-alpha.1 || 2026.5.28-beta.1 || 2026.5.28-beta.2 || 2026.5.28-beta.3 || 2026.5.28-beta.4 || 2026.5.29-alpha.1 || 2026.5.30-beta.1 || 2026.5.30-beta.2 || 2026.5.31-alpha.1 || 2026.5.31-beta.1 || 2026.5.31-beta.2 || 2026.5.31-beta.3 || 2026.5.31-beta.4 || 2026.6.1-alpha.1 || 2026.6.1-alpha.2 || 2026.6.1-alpha.3 || 2026.6.1-beta.1 || 2026.6.1-beta.2 || 2026.6.1-beta.3 || 2026.6.2-alpha.1 || 2026.6.2-alpha.2 || 2026.6.2-beta.1 || 2026.6.3-alpha.1 || 2026.6.4-alpha.1 || 2026.6.5-alpha.1 || 2026.6.5-alpha.2 || 2026.6.5-beta.1 || 2026.6.5-beta.2 || 2026.6.6-alpha.1 || 2026.6.6-beta.2 || 2026.6.6"
@@ -82,7 +82,7 @@
82
82
  "acorn": "^8.16.0",
83
83
  "tsup": "^8.5.1",
84
84
  "typescript": "^5.9.3",
85
- "@remnic/core": "^9.3.636"
85
+ "@remnic/core": "^9.3.637"
86
86
  },
87
87
  "license": "MIT",
88
88
  "repository": {