@ev-ai/agent-hook 1.3.8 → 1.3.10

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.
@@ -1106,7 +1106,9 @@ __export(managed_hooks_snippet_exports, {
1106
1106
  CLAUDE_MANAGED_SESSION_START_TIMEOUT_SECONDS: () => CLAUDE_MANAGED_SESSION_START_TIMEOUT_SECONDS,
1107
1107
  NPX_PACKAGE_SPEC: () => NPX_PACKAGE_SPEC,
1108
1108
  buildCollectorUrl: () => buildCollectorUrl,
1109
- managedHooksSnippet: () => managedHooksSnippet
1109
+ managedCodexConfigTomlSnippet: () => managedCodexConfigTomlSnippet,
1110
+ managedHooksSnippet: () => managedHooksSnippet,
1111
+ renderCodexConfigToml: () => renderCodexConfigToml
1110
1112
  });
1111
1113
  module.exports = __toCommonJS(managed_hooks_snippet_exports);
1112
1114
 
@@ -1304,6 +1306,14 @@ var import_composition_identity = __toESM(require_dist(), 1);
1304
1306
  // src/collectors/sys.ts
1305
1307
  var BYTES_PER_MB = 1024 * 1024;
1306
1308
 
1309
+ // src/shared/file-logger.ts
1310
+ var LOG_MAX_BYTES = 1024 * 1024;
1311
+ var LOG_LINE_SLACK_BYTES = 8 * 1024;
1312
+ var LOG_ROTATE_BYTES = LOG_MAX_BYTES / 2 - LOG_LINE_SLACK_BYTES;
1313
+ var LOG_PURGE_AFTER_MS = 7 * 24 * 60 * 60 * 1e3;
1314
+ var HOOK_CONFIG_FILE_MAX_BYTES = 1024 * 1024;
1315
+ var RUN_LOG_WINDOWS_FILE_MAX_BYTES = 64 * 1024;
1316
+
1307
1317
  // src/extract/rule-extract.ts
1308
1318
  var RULE_LAYOUT_ROOTS = userScopePathsFromLayouts(Object.values(PLATFORM_PROJECT_LAYOUT)).rules;
1309
1319
 
@@ -1331,13 +1341,13 @@ var HOOK_INPUT_ALLOWLIST_MAX_BYTES = 4 * 1024;
1331
1341
  var HOOK_INPUT_FULL_MAX_BYTES = 256 * 1024;
1332
1342
  var HOOK_INPUT_MCP_MAX_BYTES = 4 * 1024;
1333
1343
  var GZIP_MIN_BYTES = 32 * 1024;
1334
- var PACKAGE_VERSION = "1.3.8";
1344
+ var PACKAGE_VERSION = "1.3.10";
1335
1345
  var NPX_PACKAGE_SPEC = `@ev-ai/agent-hook@${PACKAGE_VERSION}`;
1336
1346
  var HOOK_STATUS_MESSAGE = "ev-ai runtime report";
1337
1347
 
1338
1348
  // src/config/hook-config.ts
1339
1349
  var HOOK_CONFIG_FETCHED_AT_BUMP_MS = 24 * 60 * 60 * 1e3;
1340
- var HOOK_CONFIG_FILE_MAX_BYTES = 1024 * 1024;
1350
+ var HOOK_CONFIG_FILE_MAX_BYTES2 = 1024 * 1024;
1341
1351
 
1342
1352
  // src/install/install.ts
1343
1353
  function isSessionStartEvent(eventName) {
@@ -1465,16 +1475,72 @@ function withClaudeManagedHookLimits(doc) {
1465
1475
  }
1466
1476
  return { hooks };
1467
1477
  }
1478
+ function tomlBasicString(value) {
1479
+ return JSON.stringify(value);
1480
+ }
1481
+ function renderCodexConfigToml(doc) {
1482
+ const hooks = doc.hooks;
1483
+ const lines = [];
1484
+ for (const [eventName, groups] of Object.entries(hooks)) {
1485
+ for (const group of groups) {
1486
+ lines.push(`[[hooks.${eventName}]]`);
1487
+ if (typeof group.matcher === "string") {
1488
+ lines.push(`matcher = ${tomlBasicString(group.matcher)}`);
1489
+ }
1490
+ for (const handler of group.hooks ?? []) {
1491
+ lines.push(`[[hooks.${eventName}.hooks]]`);
1492
+ lines.push(
1493
+ `type = ${tomlBasicString(typeof handler.type === "string" ? handler.type : "command")}`
1494
+ );
1495
+ if (typeof handler.timeout === "number") {
1496
+ lines.push(`timeout = ${handler.timeout}`);
1497
+ }
1498
+ if (typeof handler.command === "string") {
1499
+ lines.push(`command = ${tomlBasicString(handler.command)}`);
1500
+ }
1501
+ if (typeof handler.commandWindows === "string") {
1502
+ lines.push(`commandWindows = ${tomlBasicString(handler.commandWindows)}`);
1503
+ }
1504
+ }
1505
+ lines.push("");
1506
+ }
1507
+ }
1508
+ return `${lines.join("\n").trimEnd()}
1509
+ `;
1510
+ }
1468
1511
  function managedHooksSnippet(runner, collectorUrl, packageSpec) {
1469
1512
  const command = withUrlFlag(withRunnerFlag(npxHookCommand(packageSpec), runner), collectorUrl);
1470
1513
  const doc = runner === "cursor" ? buildCursorPluginHooks(command) : runner === "claude" ? withClaudeManagedHookLimits(buildClaudePluginHooks(command)) : buildCodexPluginHooks(command);
1471
1514
  return JSON.stringify(doc, null, 2);
1472
1515
  }
1516
+ function withCodexHookTimeouts(doc) {
1517
+ const hooks = {};
1518
+ for (const [eventName, groups] of Object.entries(doc.hooks)) {
1519
+ const timeout = isSessionStartEvent(eventName) ? CLAUDE_SESSION_START_TIMEOUT_SECONDS : CLAUDE_HOOK_TIMEOUT_SECONDS;
1520
+ hooks[eventName] = groups.map(
1521
+ (group) => ({
1522
+ ...group,
1523
+ hooks: (group.hooks ?? []).map((entry) => ({ ...entry, timeout }))
1524
+ })
1525
+ );
1526
+ }
1527
+ return { hooks };
1528
+ }
1529
+ function managedCodexConfigTomlSnippet(collectorUrl, packageSpec) {
1530
+ const command = withUrlFlag(withRunnerFlag(npxHookCommand(packageSpec), "codex"), collectorUrl);
1531
+ const hooks = renderCodexConfigToml(withCodexHookTimeouts(buildCodexPluginHooks(command)));
1532
+ return `[features]
1533
+ hooks = true
1534
+
1535
+ ${hooks}`;
1536
+ }
1473
1537
  // Annotate the CommonJS export names for ESM import in node:
1474
1538
  0 && (module.exports = {
1475
1539
  CLAUDE_MANAGED_HOOK_TIMEOUT_SECONDS,
1476
1540
  CLAUDE_MANAGED_SESSION_START_TIMEOUT_SECONDS,
1477
1541
  NPX_PACKAGE_SPEC,
1478
1542
  buildCollectorUrl,
1479
- managedHooksSnippet
1543
+ managedCodexConfigTomlSnippet,
1544
+ managedHooksSnippet,
1545
+ renderCodexConfigToml
1480
1546
  });
@@ -6,3 +6,4 @@ export function managedHooksSnippet(
6
6
  collectorUrl: string,
7
7
  packageSpec?: string,
8
8
  ): string;
9
+ export function managedCodexConfigTomlSnippet(collectorUrl: string, packageSpec?: string): string;
@@ -1293,6 +1293,14 @@ var import_composition_identity = __toESM(require_dist(), 1);
1293
1293
  // src/collectors/sys.ts
1294
1294
  var BYTES_PER_MB = 1024 * 1024;
1295
1295
 
1296
+ // src/shared/file-logger.ts
1297
+ var LOG_MAX_BYTES = 1024 * 1024;
1298
+ var LOG_LINE_SLACK_BYTES = 8 * 1024;
1299
+ var LOG_ROTATE_BYTES = LOG_MAX_BYTES / 2 - LOG_LINE_SLACK_BYTES;
1300
+ var LOG_PURGE_AFTER_MS = 7 * 24 * 60 * 60 * 1e3;
1301
+ var HOOK_CONFIG_FILE_MAX_BYTES = 1024 * 1024;
1302
+ var RUN_LOG_WINDOWS_FILE_MAX_BYTES = 64 * 1024;
1303
+
1296
1304
  // src/extract/rule-extract.ts
1297
1305
  var RULE_LAYOUT_ROOTS = userScopePathsFromLayouts(Object.values(PLATFORM_PROJECT_LAYOUT)).rules;
1298
1306
 
@@ -1320,13 +1328,13 @@ var HOOK_INPUT_ALLOWLIST_MAX_BYTES = 4 * 1024;
1320
1328
  var HOOK_INPUT_FULL_MAX_BYTES = 256 * 1024;
1321
1329
  var HOOK_INPUT_MCP_MAX_BYTES = 4 * 1024;
1322
1330
  var GZIP_MIN_BYTES = 32 * 1024;
1323
- var PACKAGE_VERSION = "1.3.8";
1331
+ var PACKAGE_VERSION = "1.3.10";
1324
1332
  var NPX_PACKAGE_SPEC = `@ev-ai/agent-hook@${PACKAGE_VERSION}`;
1325
1333
  var HOOK_STATUS_MESSAGE = "ev-ai runtime report";
1326
1334
 
1327
1335
  // src/config/hook-config.ts
1328
1336
  var HOOK_CONFIG_FETCHED_AT_BUMP_MS = 24 * 60 * 60 * 1e3;
1329
- var HOOK_CONFIG_FILE_MAX_BYTES = 1024 * 1024;
1337
+ var HOOK_CONFIG_FILE_MAX_BYTES2 = 1024 * 1024;
1330
1338
 
1331
1339
  // src/install/install.ts
1332
1340
  function isSessionStartEvent(eventName) {
@@ -1454,15 +1462,71 @@ function withClaudeManagedHookLimits(doc) {
1454
1462
  }
1455
1463
  return { hooks };
1456
1464
  }
1465
+ function tomlBasicString(value) {
1466
+ return JSON.stringify(value);
1467
+ }
1468
+ function renderCodexConfigToml(doc) {
1469
+ const hooks = doc.hooks;
1470
+ const lines = [];
1471
+ for (const [eventName, groups] of Object.entries(hooks)) {
1472
+ for (const group of groups) {
1473
+ lines.push(`[[hooks.${eventName}]]`);
1474
+ if (typeof group.matcher === "string") {
1475
+ lines.push(`matcher = ${tomlBasicString(group.matcher)}`);
1476
+ }
1477
+ for (const handler of group.hooks ?? []) {
1478
+ lines.push(`[[hooks.${eventName}.hooks]]`);
1479
+ lines.push(
1480
+ `type = ${tomlBasicString(typeof handler.type === "string" ? handler.type : "command")}`
1481
+ );
1482
+ if (typeof handler.timeout === "number") {
1483
+ lines.push(`timeout = ${handler.timeout}`);
1484
+ }
1485
+ if (typeof handler.command === "string") {
1486
+ lines.push(`command = ${tomlBasicString(handler.command)}`);
1487
+ }
1488
+ if (typeof handler.commandWindows === "string") {
1489
+ lines.push(`commandWindows = ${tomlBasicString(handler.commandWindows)}`);
1490
+ }
1491
+ }
1492
+ lines.push("");
1493
+ }
1494
+ }
1495
+ return `${lines.join("\n").trimEnd()}
1496
+ `;
1497
+ }
1457
1498
  function managedHooksSnippet(runner, collectorUrl, packageSpec) {
1458
1499
  const command = withUrlFlag(withRunnerFlag(npxHookCommand(packageSpec), runner), collectorUrl);
1459
1500
  const doc = runner === "cursor" ? buildCursorPluginHooks(command) : runner === "claude" ? withClaudeManagedHookLimits(buildClaudePluginHooks(command)) : buildCodexPluginHooks(command);
1460
1501
  return JSON.stringify(doc, null, 2);
1461
1502
  }
1503
+ function withCodexHookTimeouts(doc) {
1504
+ const hooks = {};
1505
+ for (const [eventName, groups] of Object.entries(doc.hooks)) {
1506
+ const timeout = isSessionStartEvent(eventName) ? CLAUDE_SESSION_START_TIMEOUT_SECONDS : CLAUDE_HOOK_TIMEOUT_SECONDS;
1507
+ hooks[eventName] = groups.map(
1508
+ (group) => ({
1509
+ ...group,
1510
+ hooks: (group.hooks ?? []).map((entry) => ({ ...entry, timeout }))
1511
+ })
1512
+ );
1513
+ }
1514
+ return { hooks };
1515
+ }
1516
+ function managedCodexConfigTomlSnippet(collectorUrl, packageSpec) {
1517
+ const command = withUrlFlag(withRunnerFlag(npxHookCommand(packageSpec), "codex"), collectorUrl);
1518
+ const hooks = renderCodexConfigToml(withCodexHookTimeouts(buildCodexPluginHooks(command)));
1519
+ return `[features]
1520
+ hooks = true
1521
+
1522
+ ${hooks}`;
1523
+ }
1462
1524
  export {
1463
1525
  CLAUDE_MANAGED_HOOK_TIMEOUT_SECONDS,
1464
1526
  CLAUDE_MANAGED_SESSION_START_TIMEOUT_SECONDS,
1465
1527
  NPX_PACKAGE_SPEC,
1466
1528
  buildCollectorUrl,
1467
- managedHooksSnippet
1529
+ managedCodexConfigTomlSnippet,
1530
+ managedHooksSnippet,
1531
+ renderCodexConfigToml
1468
1532
  };
@@ -33,7 +33,7 @@ var HOOK_INPUT_ALLOWLIST_MAX_BYTES = 4 * 1024;
33
33
  var HOOK_INPUT_FULL_MAX_BYTES = 256 * 1024;
34
34
  var HOOK_INPUT_MCP_MAX_BYTES = 4 * 1024;
35
35
  var GZIP_MIN_BYTES = 32 * 1024;
36
- var PACKAGE_VERSION = "1.3.8";
36
+ var PACKAGE_VERSION = "1.3.10";
37
37
  var NPX_PACKAGE_SPEC = `@ev-ai/agent-hook@${PACKAGE_VERSION}`;
38
38
  var HOOK_STATUS_MESSAGE = "ev-ai runtime report";
39
39
  var PLUGIN_ROOT_VARIABLE = {
@@ -45,9 +45,17 @@ var PLUGIN_ROOT_VARIABLE = {
45
45
  // src/collectors/sys.ts
46
46
  var BYTES_PER_MB = 1024 * 1024;
47
47
 
48
+ // src/shared/file-logger.ts
49
+ var LOG_MAX_BYTES = 1024 * 1024;
50
+ var LOG_LINE_SLACK_BYTES = 8 * 1024;
51
+ var LOG_ROTATE_BYTES = LOG_MAX_BYTES / 2 - LOG_LINE_SLACK_BYTES;
52
+ var LOG_PURGE_AFTER_MS = 7 * 24 * 60 * 60 * 1e3;
53
+ var HOOK_CONFIG_FILE_MAX_BYTES = 1024 * 1024;
54
+ var RUN_LOG_WINDOWS_FILE_MAX_BYTES = 64 * 1024;
55
+
48
56
  // src/config/hook-config.ts
49
57
  var HOOK_CONFIG_FETCHED_AT_BUMP_MS = 24 * 60 * 60 * 1e3;
50
- var HOOK_CONFIG_FILE_MAX_BYTES = 1024 * 1024;
58
+ var HOOK_CONFIG_FILE_MAX_BYTES2 = 1024 * 1024;
51
59
 
52
60
  // src/install/install.ts
53
61
  function isSessionStartEvent(eventName) {
@@ -136,7 +144,8 @@ function claudePluginCommand() {
136
144
  return pluginLauncherPosixCommand("claude");
137
145
  }
138
146
  function cursorPluginCommand() {
139
- return pluginLauncherPosixCommand("cursor");
147
+ const root = `\${${PLUGIN_ROOT_VARIABLE.cursor}}`;
148
+ return `"${root}/scripts/run-node.cmd" "${root}/${PLUGIN_HOOK_ENTRY}" --runner cursor ; exit 0`;
140
149
  }
141
150
  function pluginLauncherCodexWindowsCommand() {
142
151
  const variable = PLUGIN_ROOT_VARIABLE.codex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ev-ai/agent-hook",
3
- "version": "1.3.8",
3
+ "version": "1.3.10",
4
4
  "description": "Cross-runner runtime telemetry hook for Claude Code, Cursor, and Codex",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,7 +12,8 @@
12
12
  "import": "./dist/managed-hooks-snippet.mjs",
13
13
  "require": "./dist/managed-hooks-snippet.cjs",
14
14
  "default": "./dist/managed-hooks-snippet.cjs"
15
- }
15
+ },
16
+ "./package.json": "./package.json"
16
17
  },
17
18
  "files": [
18
19
  "dist",