@restregular/dsh-memory 0.9.6 → 0.9.8

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.
@@ -46,6 +46,37 @@
46
46
 
47
47
 
48
48
 
49
+ /**
50
+ * 自动召回的“模式”就是一组**标签**。工具调用的 name / description / 参数
51
+ * 命中任一标签时触发一次定向召回;失败调用则始终用 description 触发。
52
+ * 标签来自用户的记忆数据(如 release / database / credentials),可在设置里增删,
53
+ * 不需要写正则,也不只服务发布部署。
54
+ */
55
+
56
+
57
+                    
58
+
59
+                       
60
+
61
+                          
62
+
63
+                    
64
+
65
+
66
+
67
+ /** 默认触发标签:覆盖发布、部署、数据库、凭据、破坏性操作、依赖、远程等域。 */
68
+ export const DEFAULT_AUTO_RECALL_TAGS = [
69
+ 'release', 'publish', 'deploy', 'deployment', 'rollback', 'restore', 'backup',
70
+ 'database', 'migration', 'migrate', 'schema', 'credentials', 'credential', 'auth', 'token',
71
+ 'secret', 'login', 'permission', 'security', 'destructive', 'delete', 'drop', 'truncate',
72
+ 'install', 'upgrade', 'network', 'ssh', 'server', 'git', 'push', 'github', 'npm',
73
+ 'devcred', 'docker', 'kubectl', 'terraform', 'production', 'prod',
74
+ '发布', '推送', '部署', '回滚', '恢复', '备份', '数据库', '迁移', '凭据', '认证',
75
+ '权限', '安全', '删除', '清空', '安装', '升级', '网络', '服务器', '生产',
76
+ ]
77
+
78
+
79
+
49
80
 
50
81
                                    
51
82
 
@@ -62,6 +93,7 @@
62
93
 
63
94
 
64
95
 
96
+
65
97
 
66
98
 
67
99
 
@@ -72,6 +104,13 @@ export const defaultInjectSettings = {
72
104
  impression: { enabled: true, chars: 120 },
73
105
  policy: { enabled: true },
74
106
  rules: { enabled: true, maxItems: 10, tokenBudget: 300, delta: true },
107
+ autoRecall: {
108
+ enabled: true,
109
+ useToolDescription: true,
110
+ maxQueryChars: 240,
111
+ tags: DEFAULT_AUTO_RECALL_TAGS,
112
+ useMemoryTags: true,
113
+ },
75
114
  turnEnd: { enabled: false },
76
115
  sidebar: { enabled: false },
77
116
  }
@@ -110,8 +149,21 @@ export function normalizeInjectSettings(raw , base = def
110
149
  const impression = section('impression')
111
150
  const policy = section('policy')
112
151
  const rules = section('rules')
152
+ const autoRecall = section('autoRecall')
113
153
  const turnEnd = section('turnEnd')
114
154
  const sidebar = section('sidebar')
155
+ const rawTags = Array.isArray(autoRecall.tags) ? autoRecall.tags : base.autoRecall.tags
156
+ const normalizedTags = []
157
+ const seenTags = new Set ()
158
+ for (const raw of rawTags.slice(0, 60)) {
159
+ if (typeof raw !== 'string') continue
160
+ const tag = raw.trim()
161
+ if (tag === '') continue
162
+ const key = tag.toLowerCase()
163
+ if (seenTags.has(key)) continue
164
+ seenTags.add(key)
165
+ normalizedTags.push(tag)
166
+ }
115
167
  return {
116
168
  recall: {
117
169
  enabled: bool(recall.enabled, base.recall.enabled),
@@ -136,6 +188,13 @@ export function normalizeInjectSettings(raw , base = def
136
188
  tokenBudget: clampInt(rules.tokenBudget, 50, 4000, base.rules.tokenBudget),
137
189
  delta: bool(rules.delta, base.rules.delta),
138
190
  },
191
+ autoRecall: {
192
+ enabled: bool(autoRecall.enabled, base.autoRecall.enabled),
193
+ useToolDescription: bool(autoRecall.useToolDescription, base.autoRecall.useToolDescription),
194
+ maxQueryChars: clampInt(autoRecall.maxQueryChars, 40, 500, base.autoRecall.maxQueryChars),
195
+ tags: normalizedTags,
196
+ useMemoryTags: bool(autoRecall.useMemoryTags, base.autoRecall.useMemoryTags),
197
+ },
139
198
  turnEnd: { enabled: bool(turnEnd.enabled, base.turnEnd.enabled) },
140
199
  sidebar: { enabled: bool(sidebar.enabled, base.sidebar.enabled) },
141
200
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@restregular/dsh-memory",
3
- "version": "0.9.6",
3
+ "version": "0.9.8",
4
4
  "description": "DeepSeek Harness 本地长期记忆(单包单入口):JSONL 存储 + 本地向量检索(BGE-M3)+ 五个模型工具 + 自动召回注入 + 管理面板。",
5
5
  "icon": "./icon.svg",
6
6
  "type": "module",