@ev-ai/agent-hook 1.3.6 → 1.3.8
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/COLLECTED-DATA.md +5 -1
- package/README.md +1 -1
- package/dist/cli.mjs +39 -39
- package/dist/hook.mjs +36 -36
- package/dist/launcher-update.mjs +4 -4
- package/dist/launcher.mjs +6 -5
- package/dist/managed-hooks-snippet.cjs +10 -4
- package/dist/managed-hooks-snippet.mjs +10 -4
- package/dist/plugin-hooks.mjs +44 -16
- package/package.json +2 -2
package/dist/plugin-hooks.mjs
CHANGED
|
@@ -3,7 +3,14 @@ const require = __createRequire(import.meta.url);
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
// src/install/plugin-hooks.ts
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
chmodSync,
|
|
8
|
+
copyFileSync,
|
|
9
|
+
existsSync,
|
|
10
|
+
mkdirSync,
|
|
11
|
+
readFileSync,
|
|
12
|
+
writeFileSync
|
|
13
|
+
} from "node:fs";
|
|
7
14
|
import { dirname, join } from "node:path";
|
|
8
15
|
|
|
9
16
|
// src/launcher/constants.ts
|
|
@@ -26,7 +33,7 @@ var HOOK_INPUT_ALLOWLIST_MAX_BYTES = 4 * 1024;
|
|
|
26
33
|
var HOOK_INPUT_FULL_MAX_BYTES = 256 * 1024;
|
|
27
34
|
var HOOK_INPUT_MCP_MAX_BYTES = 4 * 1024;
|
|
28
35
|
var GZIP_MIN_BYTES = 32 * 1024;
|
|
29
|
-
var PACKAGE_VERSION = "1.3.
|
|
36
|
+
var PACKAGE_VERSION = "1.3.8";
|
|
30
37
|
var NPX_PACKAGE_SPEC = `@ev-ai/agent-hook@${PACKAGE_VERSION}`;
|
|
31
38
|
var HOOK_STATUS_MESSAGE = "ev-ai runtime report";
|
|
32
39
|
var PLUGIN_ROOT_VARIABLE = {
|
|
@@ -35,8 +42,10 @@ var PLUGIN_ROOT_VARIABLE = {
|
|
|
35
42
|
codex: "PLUGIN_ROOT"
|
|
36
43
|
};
|
|
37
44
|
|
|
45
|
+
// src/collectors/sys.ts
|
|
46
|
+
var BYTES_PER_MB = 1024 * 1024;
|
|
47
|
+
|
|
38
48
|
// src/config/hook-config.ts
|
|
39
|
-
var HOOK_CONFIG_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
40
49
|
var HOOK_CONFIG_FETCHED_AT_BUMP_MS = 24 * 60 * 60 * 1e3;
|
|
41
50
|
var HOOK_CONFIG_FILE_MAX_BYTES = 1024 * 1024;
|
|
42
51
|
|
|
@@ -123,16 +132,12 @@ var PLUGIN_PACKAGE_FILE = "package.json";
|
|
|
123
132
|
function pluginLauncherPosixCommand(runner) {
|
|
124
133
|
return `node "\${${PLUGIN_ROOT_VARIABLE[runner]}}/${PLUGIN_HOOK_ENTRY}" --runner ${runner} ; exit 0`;
|
|
125
134
|
}
|
|
126
|
-
function pluginLauncherPowerShellCommand(runner) {
|
|
127
|
-
const variable = PLUGIN_ROOT_VARIABLE[runner];
|
|
128
|
-
return `powershell -NoProfile -NonInteractive -Command "node (Join-Path (Get-Item Env:${variable}).Value '${PLUGIN_HOOK_ENTRY}') --runner ${runner}" ; exit 0`;
|
|
129
|
-
}
|
|
130
|
-
function pluginLauncherCommands(runner) {
|
|
131
|
-
return [pluginLauncherPosixCommand(runner), pluginLauncherPowerShellCommand(runner)];
|
|
132
|
-
}
|
|
133
135
|
function claudePluginCommand() {
|
|
134
136
|
return pluginLauncherPosixCommand("claude");
|
|
135
137
|
}
|
|
138
|
+
function cursorPluginCommand() {
|
|
139
|
+
return pluginLauncherPosixCommand("cursor");
|
|
140
|
+
}
|
|
136
141
|
function pluginLauncherCodexWindowsCommand() {
|
|
137
142
|
const variable = PLUGIN_ROOT_VARIABLE.codex;
|
|
138
143
|
return `node (Join-Path (Get-Item Env:${variable}).Value '${PLUGIN_HOOK_ENTRY}') --runner codex; exit 0`;
|
|
@@ -143,9 +148,30 @@ function pluginLauncherCodexCommand() {
|
|
|
143
148
|
commandWindows: pluginLauncherCodexWindowsCommand()
|
|
144
149
|
};
|
|
145
150
|
}
|
|
151
|
+
var CLAUDE_HOOK_TIMEOUT_SECONDS = 5;
|
|
152
|
+
var CLAUDE_SESSION_START_TIMEOUT_SECONDS = 10;
|
|
146
153
|
function buildClaudePluginHooks(command) {
|
|
147
154
|
return { hooks: desiredClaudeHookGroups(command) };
|
|
148
155
|
}
|
|
156
|
+
function buildClaudeMarketplacePluginHooks() {
|
|
157
|
+
const hooks = {};
|
|
158
|
+
for (const [eventName, groups] of Object.entries(
|
|
159
|
+
desiredClaudeHookGroups(claudePluginCommand())
|
|
160
|
+
)) {
|
|
161
|
+
const timeout = isSessionStartEvent(eventName) ? CLAUDE_SESSION_START_TIMEOUT_SECONDS : CLAUDE_HOOK_TIMEOUT_SECONDS;
|
|
162
|
+
hooks[eventName] = groups.map((group) => ({
|
|
163
|
+
...group,
|
|
164
|
+
hooks: group.hooks.map(({ type, command, ...rest }) => ({
|
|
165
|
+
type,
|
|
166
|
+
timeout,
|
|
167
|
+
async: true,
|
|
168
|
+
command,
|
|
169
|
+
...rest
|
|
170
|
+
}))
|
|
171
|
+
}));
|
|
172
|
+
}
|
|
173
|
+
return { hooks };
|
|
174
|
+
}
|
|
149
175
|
function buildCursorPluginHooks(command) {
|
|
150
176
|
const hooks = {};
|
|
151
177
|
for (const eventName of CURSOR_WIRED_HOOK_EVENTS) {
|
|
@@ -184,8 +210,8 @@ function writeJson(path, value) {
|
|
|
184
210
|
}
|
|
185
211
|
function writeMarketplacePluginHooks(marketplaceRoot) {
|
|
186
212
|
const paths = marketplacePluginHookPaths(marketplaceRoot);
|
|
187
|
-
writeJson(paths.claude,
|
|
188
|
-
writeJson(paths.cursor, buildCursorPluginHooks(
|
|
213
|
+
writeJson(paths.claude, buildClaudeMarketplacePluginHooks());
|
|
214
|
+
writeJson(paths.cursor, buildCursorPluginHooks(cursorPluginCommand()));
|
|
189
215
|
writeJson(paths.codex, buildCodexPluginHooks(pluginLauncherCodexCommand()));
|
|
190
216
|
return paths;
|
|
191
217
|
}
|
|
@@ -220,30 +246,32 @@ function copyMarketplacePluginPayload(marketplaceRoot, packageRoot) {
|
|
|
220
246
|
}
|
|
221
247
|
function expectedMarketplacePluginHooks() {
|
|
222
248
|
return {
|
|
223
|
-
claude:
|
|
224
|
-
cursor: buildCursorPluginHooks(
|
|
249
|
+
claude: buildClaudeMarketplacePluginHooks(),
|
|
250
|
+
cursor: buildCursorPluginHooks(cursorPluginCommand()),
|
|
225
251
|
codex: buildCodexPluginHooks(pluginLauncherCodexCommand())
|
|
226
252
|
};
|
|
227
253
|
}
|
|
228
254
|
export {
|
|
255
|
+
CLAUDE_HOOK_TIMEOUT_SECONDS,
|
|
256
|
+
CLAUDE_SESSION_START_TIMEOUT_SECONDS,
|
|
229
257
|
MARKETPLACE_NAME,
|
|
230
258
|
MARKETPLACE_PLUGIN_DIRS,
|
|
231
259
|
MARKETPLACE_PLUGIN_NAME,
|
|
232
260
|
PLUGIN_HOOK_ENTRY,
|
|
233
261
|
PLUGIN_PACKAGE_FILE,
|
|
234
262
|
PLUGIN_PAYLOAD_FILES,
|
|
263
|
+
buildClaudeMarketplacePluginHooks,
|
|
235
264
|
buildClaudePluginHooks,
|
|
236
265
|
buildCodexPluginHooks,
|
|
237
266
|
buildCursorPluginHooks,
|
|
238
267
|
claudePluginCommand,
|
|
239
268
|
copyMarketplacePluginPayload,
|
|
269
|
+
cursorPluginCommand,
|
|
240
270
|
expectedMarketplacePluginHooks,
|
|
241
271
|
marketplacePluginHookPaths,
|
|
242
272
|
pluginLauncherCodexCommand,
|
|
243
273
|
pluginLauncherCodexWindowsCommand,
|
|
244
|
-
pluginLauncherCommands,
|
|
245
274
|
pluginLauncherPosixCommand,
|
|
246
|
-
pluginLauncherPowerShellCommand,
|
|
247
275
|
pluginPackageManifest,
|
|
248
276
|
writeMarketplacePluginHooks
|
|
249
277
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ev-ai/agent-hook",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.8",
|
|
4
4
|
"description": "Cross-runner runtime telemetry hook for Claude Code, Cursor, and Codex",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"evAi": {
|
|
27
27
|
"launcherProtocol": 1,
|
|
28
28
|
"minLauncherProtocol": 1,
|
|
29
|
-
"launcherRevision":
|
|
29
|
+
"launcherRevision": 7
|
|
30
30
|
},
|
|
31
31
|
"engines": {
|
|
32
32
|
"node": ">=18"
|