@happycastle/oh-my-openclaw 0.15.0 → 0.15.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.
- package/dist/hooks/todo-reminder.js +12 -3
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -66,6 +66,11 @@ export function registerAgentEndReminder(api) {
|
|
|
66
66
|
}
|
|
67
67
|
}, { priority: 50 });
|
|
68
68
|
}
|
|
69
|
+
function clearSession(sessionKey, api, reason) {
|
|
70
|
+
resetStore(sessionKey);
|
|
71
|
+
sessionCounters.delete(sessionKey);
|
|
72
|
+
api.logger.info(`${LOG_PREFIX} Todo store cleared (${reason}, session=${sessionKey})`);
|
|
73
|
+
}
|
|
69
74
|
export function registerSessionCleanup(api) {
|
|
70
75
|
api.on('session_start', async (event, ctx) => {
|
|
71
76
|
if (event.resumedFrom)
|
|
@@ -73,10 +78,14 @@ export function registerSessionCleanup(api) {
|
|
|
73
78
|
const sessionKey = ctx.sessionKey ?? ctx.sessionId ?? event.sessionId;
|
|
74
79
|
if (!sessionKey)
|
|
75
80
|
return;
|
|
76
|
-
|
|
77
|
-
sessionCounters.delete(sessionKey);
|
|
78
|
-
api.logger.info(`${LOG_PREFIX} Todo store cleared for new session (${sessionKey})`);
|
|
81
|
+
clearSession(sessionKey, api, 'new session');
|
|
79
82
|
}, { priority: 190 });
|
|
83
|
+
api.on('session_end', async (event, ctx) => {
|
|
84
|
+
const sessionKey = ctx.sessionId ?? event.sessionId;
|
|
85
|
+
if (!sessionKey)
|
|
86
|
+
return;
|
|
87
|
+
clearSession(sessionKey, api, 'session_end');
|
|
88
|
+
}, { priority: 50 });
|
|
80
89
|
}
|
|
81
90
|
export function resetTodoReminderCounters() {
|
|
82
91
|
sessionCounters.clear();
|
package/dist/index.js
CHANGED
|
@@ -114,7 +114,7 @@ export default function register(api) {
|
|
|
114
114
|
safeRegister(api, 'session-cleanup', 'hook', () => {
|
|
115
115
|
registerSessionCleanup(api);
|
|
116
116
|
registry.hooks.push('session-cleanup');
|
|
117
|
-
api.logger.info(`[${PLUGIN_ID}] Session cleanup
|
|
117
|
+
api.logger.info(`[${PLUGIN_ID}] Session cleanup hooks registered (session_start, session_end)`);
|
|
118
118
|
});
|
|
119
119
|
safeRegister(api, 'todo-tools', 'tool', () => {
|
|
120
120
|
registerTodoTools(api);
|
package/package.json
CHANGED