@agiflowai/hooks-adapter 0.0.0 → 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 +8 -8
- package/dist/index.cjs +337 -210
- package/dist/index.d.cts +316 -123
- package/dist/index.d.mts +316 -123
- package/dist/index.mjs +329 -208
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -78,11 +78,9 @@ interface HookResponse {
|
|
|
78
78
|
|
|
79
79
|
### ClaudeCodeAdapter
|
|
80
80
|
|
|
81
|
-
|
|
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
|
-
|
|
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
|
|
108
|
+
const executed = await executionLog.hasExecuted({ filePath, decision });
|
|
108
109
|
|
|
109
110
|
// Log an execution
|
|
110
|
-
await
|
|
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
|
|
118
|
+
const changed = await executionLog.hasFileChanged(filePath, decision);
|
|
119
119
|
```
|
|
120
120
|
|
|
121
121
|
## License
|