@agenr/openclaw-plugin 1.3.0 → 1.4.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.
package/dist/index.js CHANGED
@@ -2770,7 +2770,7 @@ function asRecord(value) {
2770
2770
  var openclaw_plugin_default = {
2771
2771
  id: "agenr",
2772
2772
  name: "agenr",
2773
- version: "1.2.0",
2773
+ version: "1.4.0",
2774
2774
  description: "agenr memory plugin for OpenClaw",
2775
2775
  kind: "memory",
2776
2776
  contracts: {
@@ -2784,6 +2784,14 @@ var openclaw_plugin_default = {
2784
2784
  configPath: {
2785
2785
  label: "Config path",
2786
2786
  help: "Optional path to agenr's config.json. Defaults to AGENR_CONFIG_PATH, then config.json next to dbPath when dbPath is set, then ~/.agenr/config.json."
2787
+ },
2788
+ continuityModel: {
2789
+ label: "Continuity summary model",
2790
+ help: "Optional model override for continuity summary generation (provider/model format). Falls back to the agent's primary model when unset."
2791
+ },
2792
+ episodeModel: {
2793
+ label: "Episode summary model",
2794
+ help: "Optional model override for episode summary generation (provider/model format). Falls back to the agent's primary model when unset."
2787
2795
  }
2788
2796
  },
2789
2797
  configSchema: {
@@ -2797,6 +2805,16 @@ var openclaw_plugin_default = {
2797
2805
  configPath: {
2798
2806
  type: "string",
2799
2807
  minLength: 1
2808
+ },
2809
+ continuityModel: {
2810
+ type: "string",
2811
+ minLength: 1,
2812
+ description: "Model override for continuity summary generation (e.g. 'openai/gpt-5.4-mini'). Falls back to the agent's primary model."
2813
+ },
2814
+ episodeModel: {
2815
+ type: "string",
2816
+ minLength: 1,
2817
+ description: "Model override for episode summary generation (e.g. 'openai/gpt-5.4-mini'). Falls back to the agent's primary model."
2800
2818
  }
2801
2819
  }
2802
2820
  }
@@ -2822,7 +2840,21 @@ function normalizeAgenrOpenClawPluginConfig(value) {
2822
2840
  if (rawConfigPath !== void 0 && !configPath) {
2823
2841
  errors.push("configPath must be a non-empty string when provided");
2824
2842
  }
2825
- const allowedKeys = /* @__PURE__ */ new Set(["dbPath", "configPath"]);
2843
+ const rawContinuityModel = value.continuityModel;
2844
+ const continuityModel = typeof rawContinuityModel === "string" ? rawContinuityModel.trim() : void 0;
2845
+ if (rawContinuityModel !== void 0 && !continuityModel) {
2846
+ errors.push("continuityModel must be a non-empty string when provided");
2847
+ } else if (continuityModel && !continuityModel.includes("/")) {
2848
+ errors.push("continuityModel must use provider/model format when provided");
2849
+ }
2850
+ const rawEpisodeModel = value.episodeModel;
2851
+ const episodeModel = typeof rawEpisodeModel === "string" ? rawEpisodeModel.trim() : void 0;
2852
+ if (rawEpisodeModel !== void 0 && !episodeModel) {
2853
+ errors.push("episodeModel must be a non-empty string when provided");
2854
+ } else if (episodeModel && !episodeModel.includes("/")) {
2855
+ errors.push("episodeModel must use provider/model format when provided");
2856
+ }
2857
+ const allowedKeys = /* @__PURE__ */ new Set(["dbPath", "configPath", "continuityModel", "episodeModel"]);
2826
2858
  for (const key of Object.keys(value)) {
2827
2859
  if (!allowedKeys.has(key)) {
2828
2860
  errors.push(`unknown config field: ${key}`);
@@ -2835,7 +2867,9 @@ function normalizeAgenrOpenClawPluginConfig(value) {
2835
2867
  ok: true,
2836
2868
  value: {
2837
2869
  ...dbPath ? { dbPath } : {},
2838
- ...configPath ? { configPath } : {}
2870
+ ...configPath ? { configPath } : {},
2871
+ ...continuityModel ? { continuityModel } : {},
2872
+ ...episodeModel ? { episodeModel } : {}
2839
2873
  }
2840
2874
  };
2841
2875
  }
@@ -4009,7 +4043,7 @@ async function writeOpenClawPredecessorEpisode(params) {
4009
4043
  );
4010
4044
  return;
4011
4045
  }
4012
- const episodeExecution = resolveEpisodeSummaryExecution(params.services.openClaw, params.ctx.agentId);
4046
+ const episodeExecution = resolveEpisodeSummaryExecution(params.services.openClaw, params.ctx.agentId, params.services.pluginConfig.episodeModel);
4013
4047
  const episodeModel = formatResolvedEpisodeSummaryModel(episodeExecution.provider, episodeExecution.model);
4014
4048
  const transcript = capEpisodeTranscript(renderTranscript(cleanedMessages), MAX_EPISODE_TRANSCRIPT_CHARS);
4015
4049
  const episodeSummaryLlm = createEpisodeSummaryLlm({
@@ -4142,8 +4176,21 @@ async function generateEpisodeSummaryResponse(params) {
4142
4176
  await cleanupTempEpisodeSummarySessionFile(tempSessionFile);
4143
4177
  }
4144
4178
  }
4145
- function resolveEpisodeSummaryExecution(openClaw, requestedAgentId) {
4179
+ function resolveEpisodeSummaryExecution(openClaw, requestedAgentId, modelOverride) {
4146
4180
  const agentId = requestedAgentId?.trim() || resolveDefaultAgentId(openClaw.config);
4181
+ if (modelOverride) {
4182
+ const parsedModelRef2 = parseModelRef(modelOverride, DEFAULT_PROVIDER);
4183
+ if (!parsedModelRef2) {
4184
+ throw new Error(`Invalid episode model override: ${modelOverride}`);
4185
+ }
4186
+ return {
4187
+ agentId,
4188
+ agentDir: openClaw.runtime.agent.resolveAgentDir(openClaw.config, agentId),
4189
+ workspaceDir: openClaw.runtime.agent.resolveAgentWorkspaceDir(openClaw.config, agentId),
4190
+ provider: parsedModelRef2.provider,
4191
+ model: parsedModelRef2.model
4192
+ };
4193
+ }
4147
4194
  const modelRef = resolveAgentEffectiveModelPrimary(openClaw.config, agentId);
4148
4195
  const parsedModelRef = modelRef ? parseModelRef(modelRef, DEFAULT_PROVIDER) : null;
4149
4196
  return {
@@ -4380,7 +4427,7 @@ function isFileNotFound(error) {
4380
4427
  // ../../src/adapters/openclaw/session/continuity/continuity-summary-generator.ts
4381
4428
  var MIN_CONTINUITY_SUMMARY_MESSAGES = 4;
4382
4429
  var MAX_CONTINUITY_TRANSCRIPT_CHARS = 14e3;
4383
- var CONTINUITY_SUMMARY_TIMEOUT_MS = 15e3;
4430
+ var CONTINUITY_SUMMARY_TIMEOUT_MS = 3e4;
4384
4431
  var CONTINUITY_SUMMARY_SYSTEM_PROMPT = [
4385
4432
  "You write concise narrative continuity summaries that help the next session continue smoothly.",
4386
4433
  "The transcript can be about any domain. Do not assume technical, project, or coding context unless the transcript shows it.",
@@ -4429,7 +4476,7 @@ async function generateAndWriteOpenClawContinuitySummary(params) {
4429
4476
  transcriptChars: normalizedTranscript.length
4430
4477
  };
4431
4478
  }
4432
- const continuitySummaryExecution = resolveContinuitySummaryExecution(params.openClaw, params.agentId);
4479
+ const continuitySummaryExecution = resolveContinuitySummaryExecution(params.openClaw, params.agentId, params.pluginConfig?.continuityModel);
4433
4480
  const continuitySummaryModel = formatResolvedContinuitySummaryModel(continuitySummaryExecution.provider, continuitySummaryExecution.model);
4434
4481
  const prompt = [
4435
4482
  "Produce a concise continuity summary for the next session.",
@@ -4567,8 +4614,22 @@ function normalizeContinuitySummary(value) {
4567
4614
  const trimmed = value.trim();
4568
4615
  return trimmed.replace(/^# .+\n+/u, "").trim();
4569
4616
  }
4570
- function resolveContinuitySummaryExecution(openClaw, requestedAgentId) {
4617
+ function resolveContinuitySummaryExecution(openClaw, requestedAgentId, modelOverride) {
4571
4618
  const agentId = requestedAgentId?.trim() || resolveDefaultAgentId2(openClaw.config);
4619
+ if (modelOverride) {
4620
+ const parsedModelRef2 = parseModelRef2(modelOverride, DEFAULT_PROVIDER2);
4621
+ if (!parsedModelRef2) {
4622
+ throw new Error(`Invalid continuity model override: ${modelOverride}`);
4623
+ }
4624
+ return {
4625
+ agentId,
4626
+ agentDir: openClaw.runtime.agent.resolveAgentDir(openClaw.config, agentId),
4627
+ workspaceDir: openClaw.runtime.agent.resolveAgentWorkspaceDir(openClaw.config, agentId),
4628
+ modelRef: modelOverride,
4629
+ provider: parsedModelRef2.provider,
4630
+ model: parsedModelRef2.model
4631
+ };
4632
+ }
4572
4633
  const modelRef = resolveAgentEffectiveModelPrimary2(openClaw.config, agentId);
4573
4634
  const parsedModelRef = modelRef ? parseModelRef2(modelRef, DEFAULT_PROVIDER2) : null;
4574
4635
  return {
@@ -5001,7 +5062,7 @@ function capRecentSession(value, maxChars) {
5001
5062
  }
5002
5063
 
5003
5064
  // ../../src/adapters/openclaw/session/continuity/index.ts
5004
- var READ_TIME_CONTINUITY_SUMMARY_TIMEOUT_MS = 2e4;
5065
+ var READ_TIME_CONTINUITY_SUMMARY_TIMEOUT_MS = 35e3;
5005
5066
  var READ_TIME_CONTINUITY_SUMMARY_TIMEOUT = /* @__PURE__ */ Symbol("read-time-continuity-summary-timeout");
5006
5067
  async function resolvePredecessorContinuity(ctx, tracker, services, logger) {
5007
5068
  const sessionContext = formatSessionContext(ctx.sessionId, ctx.sessionKey);
@@ -5050,7 +5111,8 @@ async function loadPredecessorContinuitySummaryContent(sessionContext, sessionFi
5050
5111
  sessionFile,
5051
5112
  agentId,
5052
5113
  openClaw: services.openClaw,
5053
- logger
5114
+ logger,
5115
+ pluginConfig: services.pluginConfig
5054
5116
  }),
5055
5117
  READ_TIME_CONTINUITY_SUMMARY_TIMEOUT_MS
5056
5118
  );
@@ -5376,6 +5438,7 @@ var SCHEMA_VERSION = "4";
5376
5438
  var VECTOR_INDEX_NAME = "idx_entries_embedding";
5377
5439
  var EPISODE_VECTOR_INDEX_NAME = "idx_episodes_embedding";
5378
5440
  var BULK_WRITE_STATE_META_KEY = "bulk_write_state";
5441
+ var LAST_BULK_INGEST_META_KEY = "last_bulk_ingest_at";
5379
5442
  var CREATE_ENTRIES_TABLE_SQL = `
5380
5443
  CREATE TABLE IF NOT EXISTS entries (
5381
5444
  id TEXT PRIMARY KEY,
@@ -5815,6 +5878,14 @@ async function finalizeBulkWrites(db) {
5815
5878
  sql: "DELETE FROM _meta WHERE key = ?",
5816
5879
  args: [BULK_WRITE_STATE_META_KEY]
5817
5880
  });
5881
+ await db.execute({
5882
+ sql: `
5883
+ INSERT INTO _meta (key, value)
5884
+ VALUES (?, ?)
5885
+ ON CONFLICT(key) DO UPDATE SET value = excluded.value
5886
+ `,
5887
+ args: [LAST_BULK_INGEST_META_KEY, (/* @__PURE__ */ new Date()).toISOString()]
5888
+ });
5818
5889
  });
5819
5890
  }
5820
5891
  async function getSchemaVersion(db) {
@@ -7270,6 +7341,7 @@ async function createAgenrOpenClawServices(config, options) {
7270
7341
  return {
7271
7342
  openClaw: options.openClaw,
7272
7343
  config: resolvedConfig,
7344
+ pluginConfig: config,
7273
7345
  agenrConfig,
7274
7346
  dbPath,
7275
7347
  database,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "agenr",
3
3
  "name": "agenr",
4
- "version": "1.3.0",
4
+ "version": "1.4.0",
5
5
  "description": "agenr memory plugin for OpenClaw",
6
6
  "kind": "memory",
7
7
  "contracts": {
@@ -15,6 +15,14 @@
15
15
  "configPath": {
16
16
  "label": "Config path",
17
17
  "help": "Optional path to agenr's config.json. Defaults to AGENR_CONFIG_PATH, then config.json next to dbPath when dbPath is set, then ~/.agenr/config.json."
18
+ },
19
+ "continuityModel": {
20
+ "label": "Continuity summary model",
21
+ "help": "Optional model override for continuity summary generation (provider/model format). Falls back to the agent's primary model when unset."
22
+ },
23
+ "episodeModel": {
24
+ "label": "Episode summary model",
25
+ "help": "Optional model override for episode summary generation (provider/model format). Falls back to the agent's primary model when unset."
18
26
  }
19
27
  },
20
28
  "configSchema": {
@@ -28,6 +36,16 @@
28
36
  "configPath": {
29
37
  "type": "string",
30
38
  "minLength": 1
39
+ },
40
+ "continuityModel": {
41
+ "type": "string",
42
+ "minLength": 1,
43
+ "description": "Model override for continuity summary generation (e.g. 'openai/gpt-5.4-mini'). Falls back to the agent's primary model."
44
+ },
45
+ "episodeModel": {
46
+ "type": "string",
47
+ "minLength": 1,
48
+ "description": "Model override for episode summary generation (e.g. 'openai/gpt-5.4-mini'). Falls back to the agent's primary model."
31
49
  }
32
50
  }
33
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenr/openclaw-plugin",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "agenr memory plugin for OpenClaw",
5
5
  "type": "module",
6
6
  "exports": {