@happycastle/oh-my-openclaw 0.11.0 → 0.12.1

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.
@@ -10,7 +10,8 @@ export function registerContextInjector(api) {
10
10
  if (!collectedContext) {
11
11
  return event;
12
12
  }
13
- event.prependContext = collectedContext;
13
+ const existing = event.prependContext || '';
14
+ event.prependContext = existing ? `${existing}\n\n${collectedContext}` : collectedContext;
14
15
  api.logger.info(`[omoc] Context injected: ${entryCount} entries for ${sessionKey}`);
15
16
  return event;
16
17
  }, {
@@ -20,8 +20,8 @@ export function registerMessageMonitor(api) {
20
20
  timestamp,
21
21
  messageCount: nextCount
22
22
  });
23
- // Return undefined to not modify the message
24
- return undefined;
23
+ // Return context unchanged to allow event propagation
24
+ return context;
25
25
  }, {
26
26
  name: 'oh-my-openclaw.message-monitor',
27
27
  description: 'Monitors message events for audit logging'
@@ -31,7 +31,7 @@ export function registerMessageMonitor(api) {
31
31
  const preview = content.substring(0, 100);
32
32
  const channelId = context?.channelId || 'unknown';
33
33
  api.logger.info('[omoc] Message received:', { preview, channelId });
34
- return undefined;
34
+ return context;
35
35
  }, {
36
36
  name: 'oh-my-openclaw.message-received-monitor',
37
37
  description: 'Monitors inbound message events for audit logging'
@@ -1,3 +1,5 @@
1
+ export declare function initPersonaState(filePath?: string): void;
1
2
  export declare function setActivePersona(id: string | null): void;
2
3
  export declare function getActivePersona(): string | null;
3
4
  export declare function resetPersonaState(): void;
5
+ export declare function resetPersonaStateForTesting(): void;
@@ -1,10 +1,48 @@
1
+ import { readFileSync, writeFileSync, mkdirSync } from 'fs';
2
+ import { dirname, join } from 'path';
1
3
  let activePersonaId = null;
4
+ let loaded = false;
5
+ let stateFilePath = join('workspace', '.omoc-state', 'active-persona');
6
+ export function initPersonaState(filePath) {
7
+ if (filePath)
8
+ stateFilePath = filePath;
9
+ loadFromDisk();
10
+ }
2
11
  export function setActivePersona(id) {
3
12
  activePersonaId = id;
13
+ loaded = true;
14
+ saveToDisk();
4
15
  }
5
16
  export function getActivePersona() {
17
+ if (!loaded)
18
+ loadFromDisk();
6
19
  return activePersonaId;
7
20
  }
8
21
  export function resetPersonaState() {
9
22
  activePersonaId = null;
23
+ loaded = true;
24
+ saveToDisk();
25
+ }
26
+ export function resetPersonaStateForTesting() {
27
+ activePersonaId = null;
28
+ loaded = true;
29
+ }
30
+ function loadFromDisk() {
31
+ try {
32
+ const content = readFileSync(stateFilePath, 'utf-8').trim();
33
+ activePersonaId = content || null;
34
+ }
35
+ catch {
36
+ activePersonaId = null;
37
+ }
38
+ loaded = true;
39
+ }
40
+ function saveToDisk() {
41
+ try {
42
+ mkdirSync(dirname(stateFilePath), { recursive: true });
43
+ writeFileSync(stateFilePath, activePersonaId ?? '', 'utf-8');
44
+ }
45
+ catch {
46
+ // silent fail — in-memory state still works
47
+ }
10
48
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happycastle/oh-my-openclaw",
3
- "version": "0.11.0",
3
+ "version": "0.12.1",
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",