@ev-ai/agent-hook 1.3.7 → 1.3.9
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 +40 -39
- package/dist/hook.mjs +37 -36
- package/dist/launcher-update.mjs +4 -4
- package/dist/launcher.mjs +6 -5
- package/dist/managed-hooks-snippet.cjs +6 -2
- package/dist/managed-hooks-snippet.mjs +6 -2
- package/dist/plugin-hooks.mjs +22 -15
- 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.9";
|
|
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,13 @@ 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
|
+
const root = `\${${PLUGIN_ROOT_VARIABLE.cursor}}`;
|
|
140
|
+
return `"${root}/scripts/run-node.cmd" "${root}/${PLUGIN_HOOK_ENTRY}" --runner cursor ; exit 0`;
|
|
141
|
+
}
|
|
136
142
|
function pluginLauncherCodexWindowsCommand() {
|
|
137
143
|
const variable = PLUGIN_ROOT_VARIABLE.codex;
|
|
138
144
|
return `node (Join-Path (Get-Item Env:${variable}).Value '${PLUGIN_HOOK_ENTRY}') --runner codex; exit 0`;
|
|
@@ -150,7 +156,9 @@ function buildClaudePluginHooks(command) {
|
|
|
150
156
|
}
|
|
151
157
|
function buildClaudeMarketplacePluginHooks() {
|
|
152
158
|
const hooks = {};
|
|
153
|
-
for (const [eventName, groups] of Object.entries(
|
|
159
|
+
for (const [eventName, groups] of Object.entries(
|
|
160
|
+
desiredClaudeHookGroups(claudePluginCommand())
|
|
161
|
+
)) {
|
|
154
162
|
const timeout = isSessionStartEvent(eventName) ? CLAUDE_SESSION_START_TIMEOUT_SECONDS : CLAUDE_HOOK_TIMEOUT_SECONDS;
|
|
155
163
|
hooks[eventName] = groups.map((group) => ({
|
|
156
164
|
...group,
|
|
@@ -204,7 +212,7 @@ function writeJson(path, value) {
|
|
|
204
212
|
function writeMarketplacePluginHooks(marketplaceRoot) {
|
|
205
213
|
const paths = marketplacePluginHookPaths(marketplaceRoot);
|
|
206
214
|
writeJson(paths.claude, buildClaudeMarketplacePluginHooks());
|
|
207
|
-
writeJson(paths.cursor, buildCursorPluginHooks(
|
|
215
|
+
writeJson(paths.cursor, buildCursorPluginHooks(cursorPluginCommand()));
|
|
208
216
|
writeJson(paths.codex, buildCodexPluginHooks(pluginLauncherCodexCommand()));
|
|
209
217
|
return paths;
|
|
210
218
|
}
|
|
@@ -240,7 +248,7 @@ function copyMarketplacePluginPayload(marketplaceRoot, packageRoot) {
|
|
|
240
248
|
function expectedMarketplacePluginHooks() {
|
|
241
249
|
return {
|
|
242
250
|
claude: buildClaudeMarketplacePluginHooks(),
|
|
243
|
-
cursor: buildCursorPluginHooks(
|
|
251
|
+
cursor: buildCursorPluginHooks(cursorPluginCommand()),
|
|
244
252
|
codex: buildCodexPluginHooks(pluginLauncherCodexCommand())
|
|
245
253
|
};
|
|
246
254
|
}
|
|
@@ -259,13 +267,12 @@ export {
|
|
|
259
267
|
buildCursorPluginHooks,
|
|
260
268
|
claudePluginCommand,
|
|
261
269
|
copyMarketplacePluginPayload,
|
|
270
|
+
cursorPluginCommand,
|
|
262
271
|
expectedMarketplacePluginHooks,
|
|
263
272
|
marketplacePluginHookPaths,
|
|
264
273
|
pluginLauncherCodexCommand,
|
|
265
274
|
pluginLauncherCodexWindowsCommand,
|
|
266
|
-
pluginLauncherCommands,
|
|
267
275
|
pluginLauncherPosixCommand,
|
|
268
|
-
pluginLauncherPowerShellCommand,
|
|
269
276
|
pluginPackageManifest,
|
|
270
277
|
writeMarketplacePluginHooks
|
|
271
278
|
};
|
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.9",
|
|
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"
|