@ev-ai/agent-hook 1.3.9 → 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.
- package/COLLECTED-DATA.md +4 -0
- package/README.md +9 -0
- package/dist/cli.mjs +45 -43
- package/dist/hook.mjs +41 -39
- package/dist/launcher-update.mjs +4 -4
- package/dist/launcher.mjs +6 -6
- package/dist/managed-hooks-snippet.cjs +70 -4
- package/dist/managed-hooks-snippet.d.ts +1 -0
- package/dist/managed-hooks-snippet.mjs +67 -3
- package/dist/plugin-hooks.mjs +10 -2
- package/package.json +3 -2
package/COLLECTED-DATA.md
CHANGED
|
@@ -77,6 +77,10 @@ Every envelope also carries `policy_version` (the integer in the local cache, or
|
|
|
77
77
|
|
|
78
78
|
The hook caches your organisation's policy rules locally at `~/.ev-ai/agent-hook/policy.json`. That file is written only from the collector's response to hook events the hook already sends — not from a repo manifest or `~/.ev-ai/config.json`. Beside it, `policy-confirmed.json` records the policy version and the time the collector last confirmed it is current (from an `x-ev-policy-version` response header); past the policy's `max_age_ms` without a confirmation, findings are recorded as `policy_stale` and enforcement is off. The table may include `enforcement_mode`. In `report_only` (the organisation default), and for any rule whose action is `report`, a match is recorded as a finding and is not used to rewrite the tool call, prompt you, or block it; the hook also does not spawn a classifier for those matches. Rule evaluation happens on your machine. Prompts and tool inputs are matched against those rules locally; a match does not send anything additional. For rules that need judgement and that the organisation is enforcing, the hook invokes your own installed coding CLI (Claude / Cursor / Codex) with the text being evaluated, using your existing login. The hook does not send policy text to any additional network destination, does not call a model of ours, and does not interpret policy prose on the endpoint.
|
|
79
79
|
|
|
80
|
+
## Run log (sent once, when the org's window ends)
|
|
81
|
+
|
|
82
|
+
When it is turned on (org config `log_until`, `log_until` in `~/.ev-ai/config.json`, or `EV_AI_HOOK_RUN_LOG=on`), the hook appends one `run` line per process to `~/.ev-ai/hooks-debug.log` on this machine, plus status lines (`collector source=… url=…` with the org token masked, `send ok/fail …` with the response body or error) and a `failed` line with the error message and stack trace when a hook process fails open. Home-directory paths are written as `~`. While an org or installation `log_until` turns the log on, the hook records that window in `~/.ev-ai/agent-hook/run-log-windows.json`. Once a recorded timestamp has passed, the next `session_start` to that collector sends the log as the envelope's `run_log` (`log_until`, `text`, `bytes`, `bytes_total`, `truncated`). It first moves `hooks-debug.log` and `.1` aside, so lines written meanwhile go to a new file and two sessions never send the same bytes; after a 2xx it deletes what it sent and forgets the window, otherwise it puts the files back. `text` is the newest whole lines, up to 1 MiB (`.1` first, then the current file); it is left for a later `session_start` when it would take that event's body past 2 MiB. A log only `--debug`, `"debug": true`, a local `log_until` or `EV_AI_HOOK_RUN_LOG` wrote has no window and is never sent. Nothing is sent while this machine still logs: not under `--debug` / `"debug": true`, not when `EV_AI_HOOK_RUN_LOG` or a local `log_until` decides, and not while another scope's `log_until` is still on. `"unlimited"` never ends, so it never sends. The log is one file per machine: when two collectors' windows end, the first to send gets it and the other gets none. A log turned on only locally is never sent. Run-line fields: `run` (random id), `p` (process role), `start`, `v` (hook version), `runner`, `event`, `tool` (tool name, including MCP tools), `session` (runner session id), `outcome`, `ms`, `ack_ms`, `post_ms`, `http`, `err` (error code or class name). Prompt text and tool input or output are not written. See the README's "Run log" section.
|
|
83
|
+
|
|
80
84
|
## PII we do not send
|
|
81
85
|
|
|
82
86
|
Username and hostname *are* sent (per-member usage for the installing org). The following are not:
|
package/README.md
CHANGED
|
@@ -200,6 +200,15 @@ For the **plugin** path, do not add ev-ai per-event hooks to `.claude/settings.j
|
|
|
200
200
|
|
|
201
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
|
+
## Run log (support)
|
|
204
|
+
|
|
205
|
+
Support can turn on a local **run log** for one org or one machine from the backend, with no build and no change on the machine. While it is on, every hook process appends one `run` line to `~/.ev-ai/hooks-debug.log` when it finishes: the event, when it started, how long it took and how it ended (`handed_off`, `posted`, `post_failed`, `timeout`, `cap_dropped`, `duplicate`, …). Lines from one execution share a `run` id. The file also gets the hook's status lines (`collector source=… url=…`, `send ok/fail …` with the response body or error), and a `failed where=… run=…` line with the message and stack whenever a hook process catches an error and fails open.
|
|
206
|
+
|
|
207
|
+
- **Collect it:** with a timestamp `log_until`, the hook sends the log itself. While an org or installation `log_until` turns the log on, the hook records that window in `~/.ev-ai/agent-hook/run-log-windows.json`. Once a recorded timestamp has passed, the next `session_start` to that collector sends the log as the envelope's `run_log` (`log_until`, `text`, `bytes`, `bytes_total`, `truncated`). It first moves `hooks-debug.log` and `.1` aside, so lines written meanwhile go to a new file and two sessions never send the same bytes; after a 2xx it deletes what it sent and forgets the window, otherwise it puts the files back. `text` is the newest whole lines, up to 1 MiB (`.1` first, then the current file); it is left for a later `session_start` when it would take that event's body past 2 MiB. A log only `--debug`, `"debug": true`, a local `log_until` or `EV_AI_HOOK_RUN_LOG` wrote has no window and is never sent. Nothing is sent while this machine still logs: not under `--debug` / `"debug": true`, not when `EV_AI_HOOK_RUN_LOG` or a local `log_until` decides, and not while another scope's `log_until` is still on. `"unlimited"` never ends, so it never sends. The log is one file per machine: when two collectors' windows end, the first to send gets it and the other gets none. Otherwise (`"unlimited"`, or a local switch), send `~/.ev-ai/hooks-debug.log` and `~/.ev-ai/hooks-debug.log.1`.
|
|
208
|
+
- **Bounded:** the file moves to `.1` at about 504 KiB, so the log stays within 1 MiB on disk. A timestamp switch stops by itself at that time; `"unlimited"` stays on until the org or installation row drops the key. Once logging is off, a log not written for 7 days is deleted at the next session start.
|
|
209
|
+
- **Content:** the log is for debugging a machine with its owner's consent, so it is not redacted: tool names, error messages, stack traces, response bodies and collector URLs (org token masked) are written. Prompt text and tool input/output are not, since no line needs them. The log leaves the machine only as the `run_log` above, at the end of an org or installation `log_until` window. It does **not** turn on full `hook_input` capture in what is sent (only `--debug` / `"debug": true` do).
|
|
210
|
+
- **Local override:** `"log_until"` in `~/.ev-ai/config.json` beats the org's value either way: `"unlimited"` (on), `"off"` (off), or an ISO-8601 time (on until then). Unlike `"debug": true`, it does not turn on full `hook_input` capture. `EV_AI_HOOK_RUN_LOG=on|off` in the runner's environment beats both.
|
|
211
|
+
|
|
203
212
|
## Privacy defaults
|
|
204
213
|
|
|
205
214
|
Full field-by-field inventory of what is POSTed: [COLLECTED-DATA.md](./COLLECTED-DATA.md).
|