@moltnet/guard 1.0.4 → 1.0.5

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.
Files changed (2) hide show
  1. package/index.ts +6 -6
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -343,7 +343,7 @@ const register: PluginRegisterFn = (api: PluginAPI) => {
343
343
  })();
344
344
 
345
345
  // Hook: Intercept tool results before persistence
346
- api.hooks?.register('tool_result_persist', (toolResult) => {
346
+ api.on('tool_result_persist', (toolResult) => {
347
347
  if (!toolResult || typeof toolResult !== 'object') return toolResult;
348
348
 
349
349
  const { name, input } = toolResult as { name?: string; input?: Record<string, unknown> };
@@ -362,17 +362,17 @@ const register: PluginRegisterFn = (api: PluginAPI) => {
362
362
  });
363
363
 
364
364
  // Hook: Log agent bootstrap (session start)
365
- api.hooks?.register('agent:bootstrap', (event) => {
365
+ api.on('agent:bootstrap', (event) => {
366
366
  if (cfg.logThoughts) {
367
367
  logTrace(cfg, agentName, state.sessionId, 'session', 'Session Started', 'Agent bootstrap initiated')
368
368
  .catch(() => {});
369
369
  }
370
370
  });
371
371
 
372
- // Hook: Log commands
373
- api.hooks?.register('command', (event) => {
374
- if (cfg.logThoughts && event.action) {
375
- logTrace(cfg, agentName, state.sessionId, 'command', `Command: /${event.action}`, `User issued /${event.action}`)
372
+ // Hook: Log commands
373
+ api.on('command', (event) => {
374
+ if (cfg.logThoughts && (event as any).action) {
375
+ logTrace(cfg, agentName, state.sessionId, 'command', `Command: /${(event as any).action}`, `User issued /${(event as any).action}`)
376
376
  .catch(() => {});
377
377
  }
378
378
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moltnet/guard",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "MoltGuard plugin for Clawdbot - Security & observability for AI agents",
5
5
  "main": "index.ts",
6
6
  "type": "module",