@aiwayds/dsh-topics-memory 0.13.1 → 0.14.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/src/config.ts CHANGED
@@ -58,6 +58,20 @@ export const TopicsConfig = z.object({
58
58
  * Default 8: with the batch loop, one run then drains ~30-40 observations
59
59
  * instead of ~10, which is what makes a real backlog actually shrink. */
60
60
  distillMaxModelCalls: z.number().default(8),
61
+ /** Consolidation lane (整理) cadence: how often a session start may run the
62
+ * LLM gardener over the EXISTING pool (merge near-duplicates, promote
63
+ * settled drafts, deprecate superseded, refresh metadata). Reuses the
64
+ * distill model route; off disables the lane entirely. */
65
+ consolidateCadence: z.string().default('daily'),
66
+ /** Deprecated topics older than this many days are dropped at session start
67
+ * (local TTL sweep, no model; each drop is its own git commit, so history
68
+ * stays recoverable on the remote). 0 disables the sweep. */
69
+ deprecatedTtlDays: z.number().default(15),
70
+ /** UsageBoost (ADR 0015): behavioral bonus for topics injected/opened in
71
+ * the last 30 days, folded into the gate score — capped at 0.2 and never
72
+ * granted to zero-lexical candidates; the structural gate still applies.
73
+ * 0 = off. */
74
+ usageBoost: z.number().default(0.15),
61
75
  /** Debounced push delay in GitHub mode. */
62
76
  pushDebounceSeconds: z.number().default(45),
63
77
  })
@@ -85,6 +99,9 @@ export type TopicsConfigValue = {
85
99
  distillModel: string
86
100
  distillBatchSize: number
87
101
  distillMaxModelCalls: number
102
+ consolidateCadence: string
103
+ deprecatedTtlDays: number
104
+ usageBoost: number
88
105
  pushDebounceSeconds: number
89
106
  }
90
107
 
@@ -111,6 +128,9 @@ export const CONFIG_KEYS = [
111
128
  'distillModel',
112
129
  'distillBatchSize',
113
130
  'distillMaxModelCalls',
131
+ 'consolidateCadence',
132
+ 'deprecatedTtlDays',
133
+ 'usageBoost',
114
134
  'pushDebounceSeconds',
115
135
  ] as const
116
136
 
@@ -149,6 +169,7 @@ export function parseConfigValue(key: ConfigKey, raw: string): boolean | number
149
169
  case 'distillEveryTurns':
150
170
  case 'distillBatchSize':
151
171
  case 'distillMaxModelCalls':
172
+ case 'deprecatedTtlDays':
152
173
  case 'pushDebounceSeconds': {
153
174
  const n = Number(raw)
154
175
  if (!Number.isFinite(n) || n < 0 || !Number.isInteger(n)) return { error: `${key} 需要非负整数` }
@@ -158,12 +179,17 @@ export function parseConfigValue(key: ConfigKey, raw: string): boolean | number
158
179
  if (raw === 'pointer' || raw === 'digest') return raw
159
180
  return { error: 'inject-mode 取值 pointer|digest' }
160
181
  }
182
+ case 'consolidateCadence': {
183
+ if (raw === 'off' || raw === 'daily' || raw === '3d' || raw === '7d') return raw
184
+ return { error: 'consolidate-cadence 取值 off|daily|3d|7d' }
185
+ }
161
186
  case 'qualityLane': {
162
187
  if (raw === 'off' || raw === 'sampled' || raw === 'always') return raw
163
188
  return { error: 'quality-lane 取值 off|sampled|always' }
164
189
  }
165
190
  case 'matchThreshold':
166
- case 'tagBoost': {
191
+ case 'tagBoost':
192
+ case 'usageBoost': {
167
193
  const n = Number(raw)
168
194
  if (!Number.isFinite(n) || n < 0) return { error: `${key} 需要非负数` }
169
195
  return n