@aliyunrds/ctxdb 0.0.8-beta.4 → 0.0.8-beta.5

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.
@@ -30,17 +30,15 @@ function slimRecalledMemoriesBlock(memories, userId) {
30
30
  if (!raw.includes("Stored memories for ")) {
31
31
  return raw;
32
32
  }
33
- return slimRewrite(raw, userId);
33
+ return slimRewrite(raw, userId, memories.length);
34
34
  }
35
- function slimRewrite(raw, userId) {
35
+ function slimRewrite(raw, userId, memoryCount) {
36
36
  const lines = raw.split("\n");
37
37
  const isBullet = (l) => l.startsWith("- ");
38
38
  const isCategory = (l) => CATEGORY_LABEL_RE.test(l) && !l.startsWith("Stored");
39
- let bulletCount = 0;
40
39
  let categoryCount = 0;
41
40
  for (const l of lines) {
42
- if (isBullet(l)) bulletCount++;
43
- else if (isCategory(l)) categoryCount++;
41
+ if (isCategory(l)) categoryCount++;
44
42
  }
45
43
  const dropCategoryLabels = categoryCount <= 1;
46
44
  const out = [];
@@ -51,7 +49,7 @@ function slimRewrite(raw, userId) {
51
49
  continue;
52
50
  }
53
51
  if (line.startsWith("Stored memories for ")) {
54
- out.push(`Recalled ${bulletCount} memories for "${userId}":`);
52
+ out.push(`Recalled ${memoryCount} memories for "${userId}":`);
55
53
  continue;
56
54
  }
57
55
  if (line === "") continue;
@@ -84,6 +82,10 @@ function slimRewrite(raw, userId) {
84
82
  }
85
83
 
86
84
  // src/lib/recall-orchestrator.ts
85
+ function stripSystemReminders(raw) {
86
+ const cleaned = raw.replace(/<system-reminder>[\s\S]*?<\/system-reminder>/g, "").trim();
87
+ return cleaned || raw;
88
+ }
87
89
  var EMPTY = {
88
90
  ok: false,
89
91
  reason: "",
@@ -97,8 +99,9 @@ async function recallTurn(prompt, cfg, client, agent = "default") {
97
99
  return { ...EMPTY, reason: "config_incomplete" };
98
100
  }
99
101
  if (!cfg.autoRecall) return { ...EMPTY, reason: "auto_recall_disabled" };
102
+ const query = stripSystemReminders(prompt);
100
103
  const body = {
101
- query: prompt,
104
+ query,
102
105
  user_id: cfg.userId,
103
106
  top_k: cfg.topK,
104
107
  threshold: cfg.threshold
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  fetchKbCatalogBlock,
4
4
  recallTurn
5
- } from "../chunk-ZIG7FIPN.js";
5
+ } from "../chunk-6PIRPPWU.js";
6
6
  import "../chunk-6S5RJYBC.js";
7
7
  import {
8
8
  isCircuitOpen
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  fetchKbCatalogBlock,
4
4
  recallTurn
5
- } from "../chunk-ZIG7FIPN.js";
5
+ } from "../chunk-6PIRPPWU.js";
6
6
  import "../chunk-6S5RJYBC.js";
7
7
  import {
8
8
  isCircuitOpen
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aliyunrds/ctxdb",
3
- "version": "0.0.8-beta.4",
3
+ "version": "0.0.8-beta.5",
4
4
  "type": "module",
5
5
  "description": "Unified access layer for RDS ContextDatabase: `ctxdb` CLI (memory + KB ops), one-shot `setup --agent <qoder|codex|claude>` installer, per-agent config, hooks, and SKILL.md.",
6
6
  "license": "Apache-2.0",