@agiflowai/hooks-adapter 0.0.1 → 0.0.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.
package/README.md CHANGED
@@ -78,11 +78,9 @@ interface HookResponse {
78
78
 
79
79
  ### ClaudeCodeAdapter
80
80
 
81
- Adapter for Claude Code PreToolUse hooks. Parses Claude Code's JSON stdin format and formats responses accordingly.
81
+ Unified adapter for both Claude Code PreToolUse and PostToolUse hooks. Automatically detects the hook event type from the input and formats responses accordingly.
82
82
 
83
- ### ClaudeCodePostToolUseAdapter
84
-
85
- Adapter for Claude Code PostToolUse hooks. Handles post-execution hook format with tool response data.
83
+ The adapter stores the `hook_event_name` during parsing and morphs its output format based on whether it's handling a PreToolUse or PostToolUse event.
86
84
 
87
85
  ### BaseAdapter
88
86
 
@@ -103,19 +101,21 @@ AdapterProxyService.execute(agentName, hookType, callback);
103
101
  Tracks hook executions to prevent duplicate actions within a session.
104
102
 
105
103
  ```typescript
104
+ // Create a service instance for the session
105
+ const executionLog = new ExecutionLogService(sessionId);
106
+
106
107
  // Check if already executed
107
- const executed = await ExecutionLogService.hasExecuted(sessionId, filePath, decision);
108
+ const executed = await executionLog.hasExecuted({ filePath, decision });
108
109
 
109
110
  // Log an execution
110
- await ExecutionLogService.logExecution({
111
- sessionId,
111
+ await executionLog.logExecution({
112
112
  filePath,
113
113
  operation: 'read',
114
114
  decision: 'allow',
115
115
  });
116
116
 
117
117
  // Check if file has changed since last execution
118
- const changed = await ExecutionLogService.hasFileChanged(sessionId, filePath, decision);
118
+ const changed = await executionLog.hasFileChanged(filePath, decision);
119
119
  ```
120
120
 
121
121
  ## License