principles-disciple 1.50.0 → 1.51.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/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/src/core/init.ts +12 -0
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
package/src/core/init.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { PD_DIRS } from './paths.js';
|
|
|
6
6
|
import { defaultContextConfig } from '../types.js';
|
|
7
7
|
import { loadStore, setPrincipleState, type PrincipleTrainingState } from './principle-training-state.js';
|
|
8
8
|
import { atomicWriteFileSync } from '../utils/io.js';
|
|
9
|
+
import { createDefaultKeywordStore, saveKeywordStore } from './empathy-keyword-matcher.js';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Default PROFILE.json content
|
|
@@ -245,6 +246,17 @@ export function ensureStateTemplates(ctx: { logger: PluginLogger }, stateDir: st
|
|
|
245
246
|
fs.copyFileSync(dictTemplate, dictDest);
|
|
246
247
|
ctx.logger.info(`[PD] Initialized pain dictionary in stateDir: ${dictDest} (Lang: ${language})`);
|
|
247
248
|
}
|
|
249
|
+
|
|
250
|
+
// 3. Initialize empathy keyword store for new users
|
|
251
|
+
// loadKeywordStore() creates the file if missing, but we call it explicitly
|
|
252
|
+
// here so the file exists before any agent/workflow tries to read it
|
|
253
|
+
const empathyFile = path.join(stateDir, 'empathy_keywords.json');
|
|
254
|
+
if (!fs.existsSync(empathyFile)) {
|
|
255
|
+
const lang = language === 'zh' || language === 'en' ? language : 'en';
|
|
256
|
+
const store = createDefaultKeywordStore(lang);
|
|
257
|
+
saveKeywordStore(stateDir, store);
|
|
258
|
+
ctx.logger.info(`[PD] Initialized empathy keyword store in stateDir: ${empathyFile}`);
|
|
259
|
+
}
|
|
248
260
|
} catch (err) {
|
|
249
261
|
ctx.logger.error(`[PD] Failed to initialize state templates: ${String(err)}`);
|
|
250
262
|
}
|