@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 CHANGED
@@ -10,7 +10,11 @@ What `@ev-ai/agent-hook` POSTs to the ev-ai collector (`POST /{orgToken}/hook`,
10
10
  | `session_end` | Session stops |
11
11
  | `tool_invoked` | Tool, skill, MCP, shell, or file-edit hook fires |
12
12
 
13
- Every event also carries: UTC timestamp, `installation_id` (per-machine under `~/.ev-ai/agent-hook/installation.json`; on ephemeral CI/cloud homes derived from platform seeds such as `GITHUB_REPOSITORY_ID`+`GITHUB_ACTOR` / `CODESPACE_NAME` / Cursor Cloud `CURSOR_PROJECT_DIR`+`CURSOR_USER_EMAIL` / Claude Code remote origin remote + git author email, or pinned via `EV_AI_HOOK_INSTALLATION_ID`), runner `platform` (`claude` / `cursor` / `codex`), `platform_agent_id` (Layer-1 inventory join key: `{owner}/{repo}:{scopePath/}{markerDir}`, e.g. `acme/my-app:.claude` or `acme/my-app:apps/web/.cursor`), `session_id`, `turn_id`, raw `runner_event` name, `agent_hook_version`, `hook_delivery` (`plugin` when a runner plugin started the hook, `npx` when an npx hook command did, otherwise `null`), `host_arch`, `node_version`, `build_ms` (wall-clock milliseconds to assemble the envelope before the collector POST; not tool/session duration), and `self_config.operator` (human identity — see Operator identity below; skipped when `EV_AI_HOOK_USER_SPEC=off`). When the process was started by the npx launcher (`dist/launcher.mjs`), the envelope also includes `launcher_version`, `hook_source` (`bundled` / `cached` / `bootstrap`), `hook_fallback_reason` (string or `null`), and `launcher_scope_match` (whether the hook's POST URL hashes to the same collector scope the launcher resolved). Direct `node dist/hook.mjs`, the compiled binary, and the marketplace plugin launcher omit those four fields. On `session_start` only, a launcher-started hook also adds `launcher_scope` (the opaque collector-scope hash from `EV_AI_LAUNCHER_SCOPE`, never a token) and `launcher_attempt` (`n`, `latest_claim`, `outcome`, `finished_at`, `selection_version`). `outcome` is a `.done` result (`updated`, `current`, `repaired`, `bundled`, `skipped:below_floor`, `skipped:quarantined`, `failed:*`, …) or `incomplete` when the latest claim has no `.done` past its owner budget. A log read error omits `launcher_attempt` and never delays the runner ack. Other events carry only the four launcher fields above.
13
+ Every event also carries: UTC timestamp, `installation_id` (per-machine under `~/.ev-ai/agent-hook/installation.json`; on ephemeral CI/cloud homes derived from platform seeds such as `GITHUB_REPOSITORY_ID`+`GITHUB_ACTOR` / `CODESPACE_NAME` / Cursor Cloud `CURSOR_PROJECT_DIR`+`CURSOR_USER_EMAIL` / Claude Code remote origin remote + git author email, or pinned via `EV_AI_HOOK_INSTALLATION_ID`), runner `platform` (`claude` / `cursor` / `codex`), `platform_agent_id` (Layer-1 inventory join key: `{owner}/{repo}:{scopePath/}{markerDir}`, e.g. `acme/my-app:.claude` or `acme/my-app:apps/web/.cursor`), `session_id`, `turn_id`, raw `runner_event` name, `agent_hook_version`, `hook_delivery` (`plugin` when a runner plugin started the hook, `npx` when an npx hook command did, otherwise `null`), `host_arch`, `node_version`, `build_ms` (wall-clock milliseconds to assemble the envelope before the collector POST; not tool/session duration), and `self_config.operator` (human identity — see Operator identity below; skipped when `EV_AI_HOOK_USER_SPEC=off`). When the process was started by the npx launcher (`dist/launcher.mjs`), the envelope also includes `launcher_version`, `hook_source` (`bundled` / `cached` / `bootstrap`), `hook_fallback_reason` (string or `null`), and `launcher_scope_match` (whether the hook's POST URL hashes to the same collector scope the launcher resolved). Direct `node dist/hook.mjs`, the compiled binary, and the marketplace plugin launcher omit those four fields. On `session_start` only, a launcher-started hook also adds `launcher_scope` (the opaque collector-scope hash from `EV_AI_LAUNCHER_SCOPE`, never a token) and `launcher_attempt` (`n`, `latest_claim`, `outcome`, `finished_at`, `selection_version`, and when the `.done` recorded them `started_at`, `check_ms`, `download_ms`, `install_ms`, `total_ms`). `outcome` is a `.done` result (`updated`, `current`, `repaired`, `bundled`, `skipped:below_floor`, `skipped:quarantined`, `failed:*`, …) or `incomplete` when the latest claim has no `.done` past its owner budget. `started_at` is an ISO timestamp; the four `*_ms` fields are whole milliseconds for that update attempt: `check_ms` is the `/version` fetch, `download_ms` the hook artifact GET (absent when an installed or packaged copy was used), `install_ms` the local lookup, verify and install work, and `total_ms` the time from the attempt's claim (`started_at`) to its `.done`; a phase that did not run is omitted, and all five are absent for `incomplete` and for `.done` files written by older launchers. They are recorded even when `EV_AI_HOOK_PERF=0`. A log read error omits `launcher_attempt` and never delays the runner ack. Other events carry only the four launcher fields above.
14
+
15
+ Every event also carries `perf`, timings of the hook's own run (no event content): `base` (`l` launcher, `h` hook process or `w` worker: whose start is time 0), `t` (one timeline in milliseconds since `base`: the start of each process, `l` / `h` / `w`, plus its marks `l0`–`l6`, `l6r` (replay spawn), `h0`–`h3`, `w0`–`w5` and `w4e` (operator identity done); see `docs/hooks/time-measure.md` in the source repo), `ack_ms` (a lower bound of how long the runner waited for the ack: until the hook process handed off to its background worker; absent for in-process events), `bootstrap` (true when the launcher blocked on a first-run update), `spans` (per-collector milliseconds, only on the `session_start` that ran the collectors: `git`, `operator`, `mcp_declared`, `self_config`, `virt`, `cloud`, `host_env`), and `prev` (the previous POST from this machine: `at` epoch ms when it finished, `post_ms` its duration). The previous POST's duration is kept in `~/.ev-ai/agent-hook/perf-prev.json`; reading it does not delete it, each POST overwrites it, and a record older than 24 hours is ignored. Set `EV_AI_HOOK_PERF=0` to omit those timings and stop writing that file.
16
+
17
+ Unless machine telemetry is off, `perf` also carries `sys`, a sample of the machine and of the process that built the envelope, from Node built-ins only (no event content): `cpu_busy_ms` / `cpu_idle_ms` (CPU time since boot summed across cores; the backend diffs two events for the machine's CPU %; on Linux, iowait, softirq and steal are in neither), `uptime_s`, `mem_free_mb`, `mem_avail_mb` (Linux only, Node 20.13+ / 22+), `load_1m` / `load_5m` / `load_15m` (not on Windows), `proc_cpu_user_ms` / `proc_cpu_sys_ms`, `proc_max_rss_mb`, `proc_page_faults` (soft faults included on Windows), `proc_invol_ctx` (not on Windows), `node_boot_ms` and `sample_us` (the sample's own cost). Fields named `*_mb` are MiB (2^20 bytes). On `session_start`, `host_env` also carries `cpu_count`, `cpu_model`, `mem_total_mb`, `mem_limit_mb` (only under a container limit below physical memory) and `uptime_h`. Every event carries `telemetry_source` (`env`, `local_config`, `org_config` or `default`): which setting decided. Turn telemetry off with `EV_AI_HOOK_TELEMETRY=off`, `"telemetry": false` in `~/.ev-ai/config.json`, or the org's `collect_telemetry: false`; see `docs/hooks/telemetry.md` in the source repo.
14
18
 
15
19
  ## Tracked data points
16
20
 
package/README.md CHANGED
@@ -198,7 +198,7 @@ For the **plugin** path, do not add ev-ai per-event hooks to `.claude/settings.j
198
198
  - Teardown events stay in-process (sync POST) — Claude `SessionEnd` / `StopFailure`, Codex `Stop`, and `SubagentStop`, because the runner may kill detached children when the session/worker tree is torn down
199
199
  - POST / spawn failures log to stderr only
200
200
 
201
- Debug envelope logging: `EV_AI_HOOK_DEBUG=1` (redacted summary). Full envelope: `EV_AI_HOOK_DEBUG=full`. Force all events in-process: `EV_AI_HOOK_SYNC=1`. Disable duplicate-config claim collapsing by setting `EVENT_CLAIM_DEDUP_ENABLED` to `false` in source (use when two configs for the same runner must POST to different collectors).
201
+ Debug envelope logging: `EV_AI_HOOK_DEBUG=1` (redacted summary). Full envelope: `EV_AI_HOOK_DEBUG=full`. Force all events in-process: `EV_AI_HOOK_SYNC=1`. Turn off the per-run `perf` timings (and `~/.ev-ai/agent-hook/perf-prev.json`): `EV_AI_HOOK_PERF=0`; with telemetry on, `perf` still carries `sys`. Turn off machine telemetry (`perf.sys` and the `host_env` machine specs; nothing is sampled): `EV_AI_HOOK_TELEMETRY=off` (`on` forces it on), or `"telemetry": false` in `~/.ev-ai/config.json` (a repo manifest's `telemetry` is ignored). Either local setting beats the org's `collect_telemetry`; see `docs/hooks/telemetry.md`. Disable duplicate-config claim collapsing by setting `EVENT_CLAIM_DEDUP_ENABLED` to `false` in source (use when two configs for the same runner must POST to different collectors).
202
202
 
203
203
  ## Privacy defaults
204
204