@agiflowai/hooks-adapter 0.0.10 → 0.0.11
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/index.cjs +7 -2
- package/dist/index.d.cts +5 -1
- package/dist/index.d.mts +5 -1
- package/dist/index.mjs +7 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -105,11 +105,16 @@ var BaseAdapter = class {
|
|
|
105
105
|
* Execute multiple hooks with shared stdin (read once, execute all)
|
|
106
106
|
* This is useful when multiple hooks need to process the same input
|
|
107
107
|
* @param callbacks - Array of callback functions to execute
|
|
108
|
+
* @param additionalContext - Optional additional fields to merge into context
|
|
108
109
|
*/
|
|
109
|
-
async executeMultiple(callbacks) {
|
|
110
|
+
async executeMultiple(callbacks, additionalContext) {
|
|
110
111
|
try {
|
|
111
112
|
const stdin = await this.readStdin();
|
|
112
|
-
const
|
|
113
|
+
const parsedContext = this.parseInput(stdin);
|
|
114
|
+
const context = additionalContext ? {
|
|
115
|
+
...parsedContext,
|
|
116
|
+
...additionalContext
|
|
117
|
+
} : parsedContext;
|
|
113
118
|
const responses = [];
|
|
114
119
|
for (const callback of callbacks) {
|
|
115
120
|
const response = await callback(context);
|
package/dist/index.d.cts
CHANGED
|
@@ -195,8 +195,9 @@ declare abstract class BaseAdapter<TContext = any> {
|
|
|
195
195
|
* Execute multiple hooks with shared stdin (read once, execute all)
|
|
196
196
|
* This is useful when multiple hooks need to process the same input
|
|
197
197
|
* @param callbacks - Array of callback functions to execute
|
|
198
|
+
* @param additionalContext - Optional additional fields to merge into context
|
|
198
199
|
*/
|
|
199
|
-
executeMultiple(callbacks: Array<(context: TContext) => Promise<HookResponse
|
|
200
|
+
executeMultiple(callbacks: Array<(context: TContext) => Promise<HookResponse>>, additionalContext?: Partial<TContext>): Promise<void>;
|
|
200
201
|
/**
|
|
201
202
|
* Read stdin from AI agent
|
|
202
203
|
* @returns Promise resolving to stdin content
|
|
@@ -225,6 +226,7 @@ interface ClaudeCodePreToolUseInput {
|
|
|
225
226
|
transcript_path: string;
|
|
226
227
|
permission_mode: string;
|
|
227
228
|
llm_tool?: string;
|
|
229
|
+
tool_config?: Record<string, unknown>;
|
|
228
230
|
}
|
|
229
231
|
/**
|
|
230
232
|
* Claude Code hook input format (PostToolUse)
|
|
@@ -240,6 +242,7 @@ interface ClaudeCodePostToolUseInput {
|
|
|
240
242
|
transcript_path: string;
|
|
241
243
|
permission_mode: string;
|
|
242
244
|
llm_tool?: string;
|
|
245
|
+
tool_config?: Record<string, unknown>;
|
|
243
246
|
}
|
|
244
247
|
/**
|
|
245
248
|
* Union type for both hook input formats
|
|
@@ -286,6 +289,7 @@ interface GeminiCliHookInput {
|
|
|
286
289
|
session_id: string;
|
|
287
290
|
event: 'BeforeTool' | 'AfterTool' | 'BeforeModel' | 'AfterModel';
|
|
288
291
|
llm_tool?: string;
|
|
292
|
+
tool_config?: Record<string, unknown>;
|
|
289
293
|
}
|
|
290
294
|
/**
|
|
291
295
|
* Adapter for Gemini CLI hook format
|
package/dist/index.d.mts
CHANGED
|
@@ -195,8 +195,9 @@ declare abstract class BaseAdapter<TContext = any> {
|
|
|
195
195
|
* Execute multiple hooks with shared stdin (read once, execute all)
|
|
196
196
|
* This is useful when multiple hooks need to process the same input
|
|
197
197
|
* @param callbacks - Array of callback functions to execute
|
|
198
|
+
* @param additionalContext - Optional additional fields to merge into context
|
|
198
199
|
*/
|
|
199
|
-
executeMultiple(callbacks: Array<(context: TContext) => Promise<HookResponse
|
|
200
|
+
executeMultiple(callbacks: Array<(context: TContext) => Promise<HookResponse>>, additionalContext?: Partial<TContext>): Promise<void>;
|
|
200
201
|
/**
|
|
201
202
|
* Read stdin from AI agent
|
|
202
203
|
* @returns Promise resolving to stdin content
|
|
@@ -225,6 +226,7 @@ interface ClaudeCodePreToolUseInput {
|
|
|
225
226
|
transcript_path: string;
|
|
226
227
|
permission_mode: string;
|
|
227
228
|
llm_tool?: string;
|
|
229
|
+
tool_config?: Record<string, unknown>;
|
|
228
230
|
}
|
|
229
231
|
/**
|
|
230
232
|
* Claude Code hook input format (PostToolUse)
|
|
@@ -240,6 +242,7 @@ interface ClaudeCodePostToolUseInput {
|
|
|
240
242
|
transcript_path: string;
|
|
241
243
|
permission_mode: string;
|
|
242
244
|
llm_tool?: string;
|
|
245
|
+
tool_config?: Record<string, unknown>;
|
|
243
246
|
}
|
|
244
247
|
/**
|
|
245
248
|
* Union type for both hook input formats
|
|
@@ -286,6 +289,7 @@ interface GeminiCliHookInput {
|
|
|
286
289
|
session_id: string;
|
|
287
290
|
event: 'BeforeTool' | 'AfterTool' | 'BeforeModel' | 'AfterModel';
|
|
288
291
|
llm_tool?: string;
|
|
292
|
+
tool_config?: Record<string, unknown>;
|
|
289
293
|
}
|
|
290
294
|
/**
|
|
291
295
|
* Adapter for Gemini CLI hook format
|
package/dist/index.mjs
CHANGED
|
@@ -74,11 +74,16 @@ var BaseAdapter = class {
|
|
|
74
74
|
* Execute multiple hooks with shared stdin (read once, execute all)
|
|
75
75
|
* This is useful when multiple hooks need to process the same input
|
|
76
76
|
* @param callbacks - Array of callback functions to execute
|
|
77
|
+
* @param additionalContext - Optional additional fields to merge into context
|
|
77
78
|
*/
|
|
78
|
-
async executeMultiple(callbacks) {
|
|
79
|
+
async executeMultiple(callbacks, additionalContext) {
|
|
79
80
|
try {
|
|
80
81
|
const stdin = await this.readStdin();
|
|
81
|
-
const
|
|
82
|
+
const parsedContext = this.parseInput(stdin);
|
|
83
|
+
const context = additionalContext ? {
|
|
84
|
+
...parsedContext,
|
|
85
|
+
...additionalContext
|
|
86
|
+
} : parsedContext;
|
|
82
87
|
const responses = [];
|
|
83
88
|
for (const callback of callbacks) {
|
|
84
89
|
const response = await callback(context);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agiflowai/hooks-adapter",
|
|
3
3
|
"description": "Hook adapters for normalizing AI agent hook formats (Claude Code, Gemini, etc.)",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.11",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"author": "AgiflowIO",
|
|
7
7
|
"repository": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@agiflowai/aicode-utils": "1.0.10",
|
|
29
|
-
"@agiflowai/coding-agent-bridge": "1.0.
|
|
29
|
+
"@agiflowai/coding-agent-bridge": "1.0.13"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^22.0.0",
|