@happycastle/oh-my-openclaw 0.8.1 → 0.8.2

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.
@@ -1,3 +1,5 @@
1
+ /** Clear all cached persona file contents. Useful for testing. */
2
+ export declare function clearPersonaCache(): void;
1
3
  /**
2
4
  * Resolve user input ("omoc_atlas", "atlas", or "Atlas") to a canonical agent config ID.
3
5
  */
@@ -1,4 +1,4 @@
1
- import { readFileSync } from 'fs';
1
+ import { readFileSync, statSync } from 'fs';
2
2
  import { promises as fs } from 'fs';
3
3
  import { dirname, join } from 'path';
4
4
  import { fileURLToPath } from 'url';
@@ -7,6 +7,11 @@ const __filename = fileURLToPath(import.meta.url);
7
7
  const __dirname = dirname(__filename);
8
8
  // From dist/agents/ → plugin root is ../../ (same pattern as workflow-commands.ts)
9
9
  const PLUGIN_ROOT = join(__dirname, '..', '..');
10
+ const personaCache = new Map();
11
+ /** Clear all cached persona file contents. Useful for testing. */
12
+ export function clearPersonaCache() {
13
+ personaCache.clear();
14
+ }
10
15
  const AGENT_MD_MAP = {
11
16
  omoc_atlas: 'atlas',
12
17
  omoc_prometheus: 'prometheus',
@@ -43,9 +48,17 @@ export function readPersonaPromptSync(agentId) {
43
48
  }
44
49
  const agentPath = join(PLUGIN_ROOT, '..', 'agents', `${mdName}.md`);
45
50
  try {
46
- return readFileSync(agentPath, 'utf-8');
51
+ const stat = statSync(agentPath);
52
+ const cached = personaCache.get(agentPath);
53
+ if (cached && cached.mtimeMs === stat.mtimeMs) {
54
+ return cached.content;
55
+ }
56
+ const content = readFileSync(agentPath, 'utf-8');
57
+ personaCache.set(agentPath, { content, mtimeMs: stat.mtimeMs });
58
+ return content;
47
59
  }
48
60
  catch {
61
+ personaCache.delete(agentPath);
49
62
  return `[OmOC] Could not read persona file: agents/${mdName}.md (looked in ${agentPath})`;
50
63
  }
51
64
  }
@@ -2,7 +2,7 @@
2
2
  "id": "oh-my-openclaw",
3
3
  "name": "Oh-My-OpenClaw",
4
4
  "description": "Multi-agent orchestration plugin \u2014 11 agents, category-based model routing, todo enforcer, ralph loop, agent setup CLI, and custom tools",
5
- "version": "0.8.1",
5
+ "version": "0.8.2",
6
6
  "skills": ["skills"],
7
7
  "configSchema": {
8
8
  "type": "object",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happycastle/oh-my-openclaw",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "Oh-My-OpenClaw plugin — multi-agent orchestration, todo enforcer, ralph loop, and custom tools for OpenClaw",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",