@agent-watch-ai/edge 0.4.0 → 0.6.0

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.
Files changed (109) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +8 -7
  3. package/SECURITY.md +1 -1
  4. package/dist/config/config-store.js +1 -1
  5. package/dist/config/repo-config.js +1 -1
  6. package/dist/config/schemas/config.schema.d.ts +93 -857
  7. package/dist/config/schemas/config.schema.js +5 -5
  8. package/dist/credentials/credentials.js +2 -2
  9. package/dist/credentials/schemas/device-api.schema.d.ts +4 -51
  10. package/dist/credentials/schemas/device-state.schema.d.ts +3 -38
  11. package/dist/events/constants/events.constants.d.ts +5 -2
  12. package/dist/events/constants/events.constants.js +4 -1
  13. package/dist/events/index.d.ts +1 -0
  14. package/dist/events/product-event.d.ts +7 -4
  15. package/dist/events/types/repo-snapshot.types.d.ts +1 -4
  16. package/dist/events/types/repo-tree.types.d.ts +24 -0
  17. package/dist/events/types/repo-tree.types.js +1 -0
  18. package/dist/git/code-state.d.ts +33 -0
  19. package/dist/git/code-state.js +44 -0
  20. package/dist/git/constants/git.constants.d.ts +6 -0
  21. package/dist/git/constants/git.constants.js +6 -0
  22. package/dist/git/constants/tree.constants.d.ts +71 -0
  23. package/dist/git/constants/tree.constants.js +92 -0
  24. package/dist/git/git-context.d.ts +1 -0
  25. package/dist/git/git-context.js +3 -2
  26. package/dist/git/index.d.ts +2 -1
  27. package/dist/git/index.js +1 -0
  28. package/dist/git/repo-tree.d.ts +69 -0
  29. package/dist/git/repo-tree.js +130 -0
  30. package/dist/git/types/git.types.d.ts +11 -2
  31. package/dist/git/types/snapshot.types.d.ts +12 -0
  32. package/dist/pipeline/hook-pipeline.js +40 -24
  33. package/dist/privacy/command-fingerprint.d.ts +42 -0
  34. package/dist/privacy/command-fingerprint.js +249 -0
  35. package/dist/privacy/constants/command-fingerprint.constants.d.ts +34 -0
  36. package/dist/privacy/constants/command-fingerprint.constants.js +38 -0
  37. package/dist/privacy/index.d.ts +3 -1
  38. package/dist/privacy/index.js +2 -0
  39. package/dist/privacy/product-capture.js +53 -6
  40. package/dist/privacy/types/privacy.types.d.ts +7 -0
  41. package/dist/providers/antigravity/antigravity.adapter.js +3 -0
  42. package/dist/providers/antigravity/schemas/antigravity.schema.d.ts +18 -492
  43. package/dist/providers/claude/claude.adapter.js +12 -1
  44. package/dist/providers/claude/constants/claude.constants.d.ts +6 -0
  45. package/dist/providers/claude/constants/claude.constants.js +6 -0
  46. package/dist/providers/claude/schemas/claude.schema.d.ts +1 -43
  47. package/dist/providers/codex/codex.adapter.js +14 -0
  48. package/dist/providers/codex/schemas/codex.schema.d.ts +1 -41
  49. package/dist/providers/cursor/cursor.adapter.js +5 -2
  50. package/dist/providers/cursor/schemas/cursor.schema.d.ts +5 -85
  51. package/dist/providers/gemini/constants/gemini.constants.d.ts +2 -0
  52. package/dist/providers/gemini/constants/gemini.constants.js +2 -0
  53. package/dist/providers/gemini/constants/gemini.otel.constants.d.ts +10 -1
  54. package/dist/providers/gemini/constants/gemini.otel.constants.js +11 -2
  55. package/dist/providers/gemini/gemini.detect.d.ts +11 -0
  56. package/dist/providers/gemini/gemini.detect.js +14 -1
  57. package/dist/providers/gemini/gemini.hooks.d.ts +3 -3
  58. package/dist/providers/gemini/gemini.hooks.js +5 -5
  59. package/dist/providers/gemini/gemini.otel.d.ts +6 -6
  60. package/dist/providers/gemini/gemini.otel.js +392 -121
  61. package/dist/providers/gemini/schemas/gemini.schema.d.ts +1 -49
  62. package/dist/providers/shared/event-builder.d.ts +17 -2
  63. package/dist/providers/shared/event-builder.js +43 -3
  64. package/dist/providers/shared/install-record.d.ts +2 -0
  65. package/dist/providers/shared/install-record.js +3 -2
  66. package/dist/providers/shared/tooling.d.ts +7 -0
  67. package/dist/providers/shared/tooling.js +10 -1
  68. package/dist/providers/shared/types/adapter.types.d.ts +18 -0
  69. package/dist/snapshot/branch-selection.js +3 -1
  70. package/dist/snapshot/budget.js +2 -2
  71. package/dist/snapshot/constants/snapshot-stages.constants.d.ts +8 -0
  72. package/dist/snapshot/constants/snapshot-stages.constants.js +8 -0
  73. package/dist/snapshot/constants/snapshot.constants.d.ts +6 -0
  74. package/dist/snapshot/constants/snapshot.constants.js +6 -0
  75. package/dist/snapshot/index.d.ts +5 -0
  76. package/dist/snapshot/index.js +2 -0
  77. package/dist/snapshot/snapshot-event.d.ts +7 -0
  78. package/dist/snapshot/snapshot-event.js +8 -5
  79. package/dist/snapshot/snapshot-state.js +19 -1
  80. package/dist/snapshot/tree-event.d.ts +14 -0
  81. package/dist/snapshot/tree-event.js +91 -0
  82. package/dist/snapshot/tree-pipeline.d.ts +12 -0
  83. package/dist/snapshot/tree-pipeline.js +153 -0
  84. package/dist/snapshot/types/snapshot.types.d.ts +44 -1
  85. package/dist/storage/schemas/storage.schema.d.ts +11 -175
  86. package/dist/storage/schemas/storage.schema.js +7 -1
  87. package/dist/transport/constants/transport.constants.d.ts +5 -0
  88. package/dist/transport/constants/transport.constants.js +5 -0
  89. package/dist/transport/queue.js +40 -6
  90. package/dist/transport/schemas/queue.schema.d.ts +1 -16
  91. package/dist/transport/schemas/queue.schema.js +1 -1
  92. package/dist/turns/constants/turns.constants.d.ts +17 -0
  93. package/dist/turns/constants/turns.constants.js +17 -0
  94. package/dist/turns/index.d.ts +3 -2
  95. package/dist/turns/index.js +1 -0
  96. package/dist/turns/tool-events.d.ts +15 -0
  97. package/dist/turns/tool-events.js +59 -0
  98. package/dist/turns/turn-state.js +2 -2
  99. package/dist/turns/turn-summary.d.ts +1 -1
  100. package/dist/turns/turn-summary.js +4 -4
  101. package/dist/turns/turn-tracker.js +138 -7
  102. package/dist/turns/types/turn-state.types.d.ts +28 -1
  103. package/dist/turns/types/turn-summary.types.d.ts +33 -5
  104. package/dist/turns/types/turn-tracker.types.d.ts +10 -0
  105. package/docs/AUDIT_PROMPT.md +11 -0
  106. package/docs/DATA_HANDLING.md +132 -33
  107. package/docs/ENTERPRISE_DEPLOYMENT.md +2 -1
  108. package/docs/PERFORMANCE.md +17 -0
  109. package/package.json +9 -8
@@ -12,10 +12,11 @@ require root, proxy model requests, or enforce an administrator-proof policy.
12
12
  ## Defaults and upgrade consent
13
13
 
14
14
  **Prompt text and tool content are opt-in; response text is never collected.**
15
- By default a prompt or response is represented only by its length and SHA-256.
16
- Ticket keys named in a prompt are the one exception: they are extracted on the
17
- machine and sent as `prompt_jira_ids`, unfiltered (the platform keeps only keys it
18
- knows); the prompt text is not.
15
+ By default nothing about a prompt or response is sent: not its text, not its
16
+ length, not a digest of it. The first ticket key named in the session's opening
17
+ prompt is the one exception: it is extracted on the machine and sent as
18
+ `prompt_jira_ids` (the platform keeps it only if it knows the key); the prompt
19
+ text is not.
19
20
  There is no capture flag for response text.
20
21
 
21
22
  Prompt text, tool input and tool output bodies, and session titles, are not collected by default.
@@ -41,10 +42,12 @@ every agent the edge supports: Claude Code, Codex, Cursor, Gemini CLI and
41
42
  Antigravity. The command's working directory is used as a candidate when the agent
42
43
  reports it (Cursor's shell `cwd`, Gemini's `dir_path`, Antigravity's `Cwd`), and so
43
44
  are the folders a Cursor window has open. Only checkout roots confirmed on disk
44
- are kept, in local turn state, until the turn closes. The command is never stored,
45
- queued, logged or sent for that purpose. This happens only while `capture.git` is
46
- on. Separately, with `toolInput` on, the command text itself is sent on the turn
47
- summary (see `tool_inputs` below).
45
+ are kept, in local turn state, until the turn closes. The command text is never
46
+ stored, queued, logged or sent for that purpose. This happens only while
47
+ `capture.git` is on. Separately, and also only while `capture.git` is on, a sha256
48
+ fingerprint of the normalized command is sent in the turn summary's `tool_events`
49
+ (below), never the text; with `toolInput` on, the command text itself is sent on
50
+ the turn summary (see `tool_inputs` below).
48
51
 
49
52
  Configurations written by earlier releases may still carry `capture.prompts` or
50
53
  `capture.responses`. Those keys are ignored on load whatever their value —
@@ -73,7 +76,7 @@ fields.
73
76
  Current policy is reapplied to old turn state before queueing, and to every queued
74
77
  record before HTTP delivery: summaries always lose `prompt` and `response` text an
75
78
  older release may have written, lose `prompt_text`, `tool_inputs`, `session_name` and `session_title` unless their
76
- flag is on with consent, lose every path list once `capture.files` is off, and repository snapshots are dropped entirely once
79
+ flag is on with consent, lose every path list once `capture.files` is off, lose `tool_events` once `capture.git` is off, and repository snapshots are dropped entirely once
77
80
  `capture.git` is off. Old files are not erased by an upgrade; their original content
78
81
  may remain locally until consumed or expired, but it is never sent.
79
82
 
@@ -88,7 +91,8 @@ whatever the consent state, and never enables Gemini detailed traces, which can
88
91
  carry prompts. Codex and Gemini usage logs can contain tool arguments/results
89
92
  without a reliable per-field filter, so the Edge configures those logs only when
90
93
  global consent exists and both `toolInput` and `toolOutput` are enabled. Gemini
91
- metrics may run without content consent. This can leave `llm.call` usage
94
+ gets no native export at all without that consent, metrics included, because it
95
+ ignores `OTEL_LOGS_EXPORTER=none` and `OTEL_TRACES_EXPORTER=none`. This can leave `llm.call` usage
92
96
  unavailable by default for Codex and Gemini. Codex turns still carry token
93
97
  counts: the Edge reads only the `token_count` and `turn_context` rows of the
94
98
  Codex rollout file locally (per-request token numbers and the model name) and
@@ -96,13 +100,15 @@ puts the totals on the turn summary; no rollout content is read into it or sent.
96
100
 
97
101
  ## Outbound records
98
102
 
99
- There are three public event types, not a raw lifecycle or tool event stream:
103
+ There are five public event types, not a raw lifecycle or tool event stream:
100
104
 
101
105
  | Type | Source and purpose |
102
106
  | --- | --- |
103
107
  | `turn.summary` | Edge hooks assemble one completed turn and send it to the events endpoint, or queue it. |
104
108
  | `llm.call` | Agents export native OTLP directly. The backend/library normalizes supported completed request records into per-call usage. Edge does not proxy native OTLP. |
105
109
  | `repo.snapshot` | Edge queues changed repository branch/commit metadata after a closed turn when Git capture is enabled. |
110
+ | `session.billing` | Edge states how the session's developer pays (`api` or `subscription`, detected from the agent's local auth state), once, when the session opens. |
111
+ | `repo.tree` | Edge queues the default branch's source file paths and top-level declaration names after a closed turn when Git and file capture are enabled, once per repository per install identity. Never file contents. |
106
112
 
107
113
  Generated records share `schemaVersion`, `id`, `timestamp`, `event.type`,
108
114
  `event.providerEventType`, `agent.provider`, `agent.name`, session identifiers,
@@ -114,21 +120,25 @@ availability determines which identifiers and usage values exist.
114
120
  The hook-generated flat fields are `provider`, `surface`, `session_id`, `turn_id`,
115
121
  `developer_id`, `repository`, `branch`, `commit`, `jira_ids`, `prompt_jira_ids`, `work_evidence`,
116
122
  `parent_session_id`, `content_hashes`, `manifest_repository`, `files_changed`, `files_touched`, `files_read`, `external_files_touched`,
117
- `external_files_read`, `prompt_evidence`, `prompt_text`, `session_name`, `session_title`, `tool_inputs`, `response_evidence`,
118
- `tool_calls`, `tools_used`, `model`, `billing_mode`, `input_tokens`,
123
+ `external_files_read`, `prompt_text`, `session_name`, `session_title`, `tool_inputs`,
124
+ `tool_calls`, `tools_used`, `tool_events`, `model`, `billing_mode`, `input_tokens`,
119
125
  `cached_input_tokens`, `cache_creation_input_tokens`, `output_tokens`,
120
126
  `usage_status`, `started_at`, and `ended_at`. The nested `session` contains `id`,
121
127
  `providerId`, and optionally `turnId`.
122
128
 
123
- `prompt_jira_ids` are the ticket keys (same syntax as the branch keys in `jira_ids`)
124
- found in the session's opening prompt, extracted on the machine and sent on every
125
- turn at every tier, with no consent step. Only the keys are sent, never the prompt
126
- text. `capture.git: false` withholds them, as it does `jira_ids`.
129
+ `prompt_jira_ids` holds the first ticket key (same syntax as the branch keys in
130
+ `jira_ids`) found in the session's opening prompt, extracted on the machine and
131
+ sent on every turn at every tier, with no consent step: at most one key, since
132
+ the platform reads only the first. Never the prompt text. `capture.git: false`
133
+ withholds it, as it does `jira_ids`. A prompt's length and SHA-256 are not sent
134
+ (older releases sent them as `prompt_evidence` and `response_evidence`; a summary
135
+ they queued loses them at delivery).
127
136
 
128
137
  A prompt is free text, so a string like `INV-204391`, `MRN-123456` or `UTF-8`
129
- matches the key syntax too. The edge sends every candidate unfiltered, in order,
130
- deduplicated and capped at 50; the platform matches them against the keys it knows
131
- (branch names, connected trackers) and ignores the rest, so an unknown key is inert.
138
+ matches the key syntax too. The edge keeps the candidates on the machine in
139
+ order, deduplicated and capped at 50, and sends the first; the platform matches it
140
+ against the keys it knows (branch names, connected trackers) and ignores it
141
+ otherwise, so an unknown key is inert.
132
142
 
133
143
  On the machine the keys are kept in `prompt-tickets.json` in the session's local
134
144
  turn state (mode 0600): keys only, written once by the opening prompt, and an
@@ -139,10 +149,8 @@ every key the prompt named. The 24-hour
139
149
  sweep deletes it, counted from SessionEnd, so a session resumed within a day of
140
150
  ending keeps its keys.
141
151
 
142
- No field carries response text. Evidence contains `length` and `sha256` of the
143
- text the developer typed and the agent answered; it is not raw text, but hashes
144
- and lengths can still reveal information about short or guessable text. The
145
- prompt evidence hashes the prompt as the agent reported it.
152
+ No field carries response text, and no field carries a length or a hash of the
153
+ text the developer typed or the agent answered.
146
154
 
147
155
  - `prompt_text` (only under `promptText` with consent): the turn's first prompt,
148
156
  with `<system-reminder>` blocks the agent's harness injected removed, secrets
@@ -172,8 +180,52 @@ prompt evidence hashes the prompt as the agent reported it.
172
180
  call, `{tool, command}` or `{tool, server, name, arguments}` with the arguments as
173
181
  JSON text; sensitive argument keys are redacted before that, every string is cut
174
182
  at 2,000 characters after scrubbing, and at most 50 calls are sent per turn.
175
- Tool output bodies are not sent on the summary; enabling tool flags does not add
176
- a tool event stream.
183
+ Tool output bodies are not sent on the summary; enabling tool flags adds nothing
184
+ to `tool_events`, which never carries content.
185
+ - `tool_events` (under `git`, on by default): one record per tool call, in call
186
+ order, at most 200 per turn (`tool_calls` and `tools_used` still count every
187
+ call). Each record holds only `seq` (its order), `tool` (the tool's name, as in
188
+ `tools_used`), `tool_call_id` (the agent's own id for the call, where its hook payload names
189
+ one: Claude Code, Codex, Cursor's generic tool hooks, Gemini CLI when it sends
190
+ `tool_use_id`), `status` (`ok` or `failed`),
191
+ `exit_code` (where the agent states one: Codex, and Claude Code's failed shell
192
+ calls), `started_at` (from the provider's duration, or from the call's start
193
+ hook paired on its call id or Antigravity's step index; a call with neither, such
194
+ as a Gemini CLI call without `tool_use_id`, sends none), `ended_at`, `input_fp`, `check`,
195
+ `commit` and `diff_fp`. There is no field for a command, a path, arguments or
196
+ an output.
197
+ - `input_fp`: for a shell call, the sha256 of the command after normalization
198
+ (quotes undone, whitespace collapsed, `cd` segments, redirections and leading
199
+ `VAR=value` words dropped; for a check, of the check's own segment only); for a
200
+ connector (MCP) call, the sha256 of its arguments as JSON. Other tools send
201
+ none. The command and arguments are read in memory in the hook, hashed and
202
+ dropped: the text is never stored, queued, logged or sent without `toolInput`.
203
+ A hash is not the text, but a hash of a short or common command (`npm test`,
204
+ `git status`) can be confirmed by anyone who hashes the same guess. The platform re-keys every stored fingerprint with a key per
205
+ tenant, so a stored value cannot be compared across tenants or confirmed
206
+ without that key.
207
+ - `check`: the command is on a fixed allowlist of test, lint, typecheck and build
208
+ commands (`npm`/`pnpm`/`yarn` `test`, `lint`, `typecheck`, `check`, `verify`,
209
+ `build`; `vitest`, `jest`, `tsc`, `pytest`, `go test`, `cargo test`,
210
+ `make test|check`, `pr-tests.sh`, also through `npx` or `python -m`) and ran
211
+ for at least 60 seconds. A call with no start time
212
+ is never a check.
213
+ - `commit` and `diff_fp`, on a check only: HEAD, and the sha256 of the
214
+ uncommitted diff of tracked files against HEAD when the check finished
215
+ (`git diff HEAD --binary`, streamed into the hash; a clean checkout hashes
216
+ the empty diff; untracked files are not covered). The diff itself never
217
+ leaves the hook process. These two, and the start record's lookup, are the
218
+ only extra work a check costs the hook: `git rev-parse HEAD` and `git diff`,
219
+ both read-only and run with `--no-optional-locks`, so they write nothing to
220
+ the repository and never take the agent's index lock.
221
+
222
+ On the machine, a tool call's start is kept in local turn state (mode 0600) until
223
+ the turn closes, only while `capture.git` is on: its time and the agent's call id
224
+ (or Antigravity's step index), nothing else. The platform also reads tool calls
225
+ from the agents' own OTLP export, where Claude Code, Codex and Gemini CLI include
226
+ a shell call's command when their own tool-detail logging is on; the platform
227
+ reads that command in memory only, to fingerprint it the same way, and drops it
228
+ (core AWT-674). The two records of one call are joined on `tool_call_id`.
177
229
  - `external_files_touched` / `external_files_read` (under `files`, and only while
178
230
  `git` is on, since that is what tells inside a checkout from outside): files outside
179
231
  every checkout, home-relative (`~/Documents/a.xlsx`); a path outside the home
@@ -231,11 +283,12 @@ and [Gemini telemetry](https://geminicli.com/docs/cli/telemetry/) for provider g
231
283
 
232
284
  Snapshots contain `provider`, `surface`, `repository`, optional `developer_id`,
233
285
  `default_branch`, `captured_at`, and `branches`. Each branch has `name`,
234
- `head_sha`, optional `last_commit_at`, and `commits`; each commit has `sha`,
235
- `subject`, optional `authored_at`, and optional `files`. `files` lists the files
236
- that commit changed as `{ path, status }`: `path` is repository-relative as git
237
- names it, and `status` is git's name-status letter (`A`, `M`, `D` or `T`; a
238
- rename is sent as its delete and its add). **Names only, never file contents.**
286
+ `head_sha` and `commits`; each commit has `sha`, `subject` and optional `files`.
287
+ `files` lists the files that commit changed as `{ path }`, repository-relative as
288
+ git names it (a rename is listed as both its old and its new path). No commit or
289
+ branch times and no change-type letter are sent (older releases sent
290
+ `authored_at`, `last_commit_at` and a `status`; a snapshot they queued loses them
291
+ at delivery). **Names only, never file contents.**
239
292
  Files named like credentials (`.env`, `.env.*`, `*.pem`, `*.key`, `*.p12`, `*.pfx`,
240
293
  `id_rsa`/`id_ed25519`/`id_ecdsa`, `credentials`, `credentials.*`, `.npmrc`, `.netrc`), paths
241
294
  over 1,024 characters and paths holding control characters are left out. A
@@ -253,6 +306,51 @@ sensitive business information even though they are classified as metadata.
253
306
  Set global `capture.git: false` to disable new snapshots; already-queued snapshots
254
307
  are then discarded at delivery rather than sent.
255
308
 
309
+ ### `repo.tree`
310
+
311
+ A tree contains the same identity fields as a snapshot (`provider`, `surface`,
312
+ `repository`, optional `developer_id`), plus `captured_at`, `truncated` and
313
+ `files`. Each file is `{ path, names }`: no blob id, no tree id and no branch
314
+ name are sent. It is what a tenant with no GitHub App gets its code feature
315
+ catalog named from.
316
+
317
+ - **Which tree.** The default branch as the remote knows it (`origin/<trunk>`),
318
+ the local trunk only when that ref does not exist. Read from git's object
319
+ store (`git ls-tree`, `git grep <tree>`), never the working copy: uncommitted
320
+ files, local edits and other branches are not in it.
321
+ - **Which files.** Source files only, by extension (TS/JS, Python, Go, Ruby,
322
+ Rust, Java, Kotlin, Elixir, PHP, Dart, C#, SQL, Prisma, C/C++/Objective-C,
323
+ IDL), minus tests, fixtures, vendored, built and `node_modules` trees, docs,
324
+ migrations and `.d.ts`. Credential-named files, over-long paths and paths
325
+ with control characters are left out, as in a snapshot.
326
+ - **`names`.** The identifiers a file declares at top level, as `git grep -o`
327
+ prints the matching declaration line's head: exported TS/JS declarations,
328
+ column-0 Python and Ruby `def`/`class`/`module`, exported Go functions, Java,
329
+ Kotlin, C#, PHP, Rust and Dart type names and column-0 functions, Elixir
330
+ modules. The one string content read is a **route path** from a Nest, Express
331
+ or Spring route declaration (`'v1/invoices'`). **No function body, comment,
332
+ string literal or other code is read out of git.** A blob over 1 MiB or
333
+ binary sends no names. At most 64 names per file, 200 characters each.
334
+ - **Bounds.** At most 20,000 files and ~4 MiB per record; over a bound, files
335
+ are kept in `ls-tree` order and `truncated` is `true`.
336
+ - **When.** Once per repository per install identity: on the first closed turn
337
+ in that repository, inside the snapshot's one-second budget. Once queued, it is
338
+ never sent again for that identity — later trunk changes are not re-sent (the
339
+ files a session changes already travel in its turn summary and branch
340
+ snapshot). A re-setup with a new credential, or another account, sends it
341
+ again. A failed attempt (no trunk, listing failed, budget spent) is retried at
342
+ most hourly until the first tree is queued; the queue then retries delivery.
343
+ The snapshot state file on the machine records that the tree was sent, its
344
+ git tree id and a digest of the identity it was sent as — never the
345
+ credential; none of these is sent.
346
+ - **Consent.** Needs both `capture.git` and `capture.files`; a repository's own
347
+ `capture.files: false` stops the listing from running at all. A queued tree is
348
+ discarded at delivery when either flag is off.
349
+
350
+ Declaration and route names are identifiers chosen by developers and can reveal
351
+ product or business vocabulary, the same as file paths do; they are metadata,
352
+ not code, and run through the same secret scrubber as every record.
353
+
256
354
  Remote URL userinfo is removed before normalization. Normalization yields
257
355
  `host/org/repo`, omitting scheme, query, fragment and `.git` suffix. A SHA-256 hash
258
356
  of that normalized identity is available for Git attribution. **Repository names
@@ -388,7 +486,8 @@ blob id: the SHA-1 Git itself assigns the content (`git hash-object`). A file ov
388
486
  on both the named path and its real target; other names such as `.envrc` or
389
487
  `credentials-prod.json` are not skipped), and a file whose real path lies
390
488
  outside the session folder, symlinks included, is skipped. The summary carries up
391
- to 20 `{path, blob_sha}` pairs, the path relative to the session folder. This feature adds no file content and no path from outside the session folder: a file whose real path lies outside it is skipped, and only its name can appear, under `external_files_touched` or `external_files_read` when `files` is on, as described above. With debug logging on, a failed read can log that file's path on this machine. A blob id is an object id of the same kind as the commit SHAs already
489
+ to 20 `{blob_sha}` entries, without the file's path (older releases sent the path
490
+ beside it; a summary they queued loses it at delivery). This feature adds no file content and no path from outside the session folder: a file whose real path lies outside it is skipped, and only its name can appear, under `external_files_touched` or `external_files_read` when `files` is on, as described above. With debug logging on, a failed read can log that file's path on this machine. A blob id is an object id of the same kind as the commit SHAs already
392
491
  sent, but a guessable file's id can still be confirmed by someone who has that
393
492
  file.
394
493
 
@@ -487,7 +586,7 @@ and this is a property of those agents rather than a choice made here.** Neither
487
586
  CLI has a mechanism for fetching a credential at request time, so the only way
488
587
  to authenticate their native OTLP exporters is to write the bearer into the file
489
588
  they read at startup: `~/.codex/config.toml` for Codex, and
490
- `OTEL_EXPORTER_OTLP_HEADERS` inside `~/.gemini/settings.json` for Gemini. Claude
589
+ `OTEL_EXPORTER_OTLP_HEADERS` inside `~/.gemini/.env` for Gemini. Claude
491
590
  Code does have such a mechanism — `otelHeadersHelper`, which calls
492
591
  `agentwatch otel-headers` at runtime — so no Claude configuration file ever
493
592
  contains a token. Cursor and Antigravity have no managed native exporter, so the
@@ -26,7 +26,8 @@ list the package's ownership rules are built on. Everything else lives under
26
26
  | --- | --- | --- |
27
27
  | `~/.claude/settings.json` | AgentWatch hook entries, and `otelHeadersHelper` plus OTel env keys when native telemetry is configured | `uninstall` removes exactly the entries recorded as owned; unrelated hooks and settings are preserved |
28
28
  | `~/.codex/config.toml` | A managed `[otel]` block; the file is set to 0600 **only** when that block carries a bearer token | `uninstall` removes the block and restores the permission bits the file had before AgentWatch tightened it |
29
- | `~/.gemini/settings.json` | AgentWatch hook entries and an `env` block including `OTEL_EXPORTER_OTLP_HEADERS`; 0600 **only** when that block carries a bearer token | as above — owned keys only, and the original mode is restored |
29
+ | `~/.gemini/settings.json` | AgentWatch hook entries | `uninstall` removes the entries it recorded |
30
+ | `~/.gemini/.env` | Native telemetry lines including `OTEL_EXPORTER_OTLP_HEADERS`; 0600 **only** when they carry a bearer token | `uninstall` removes the owned lines and restores the original mode; a file AgentWatch created and left empty is deleted |
30
31
  | Cursor / Antigravity hook configuration | AgentWatch hook entries only; neither has a managed native exporter | `uninstall` removes the entries it recorded |
31
32
  | Nothing else | No daemon, no launchd/systemd unit, no PATH change, no shell profile edit, no root requirement, no file outside the paths above | — |
32
33
 
@@ -57,6 +57,23 @@ a ten-branch snapshot whose every branch is at the cap carries at most ~210 KB o
57
57
  25 such snapshots in one drain pass stay under the gateway's 8 MiB body limit. If the output
58
58
  ceiling (1 MiB) cuts a listing short, the commits it did not reach are sent without `files`.
59
59
 
60
+ Trunk tree in `repo.tree`, October 25, 2026: same machine. Once per repository per
61
+ install identity, the first closing hook in a repository runs `ls-tree -r -l -z` and three
62
+ `git grep -o <tree>` searches side by side (the spike's declarations as one anchored ERE,
63
+ route paths as PCRE, the extra languages over their own files), inside the snapshot's
64
+ one-second budget. Every later turn reads the snapshot state file and stops: no git
65
+ process. Five runs each, warm cache, real state file, event bytes after sanitizing:
66
+
67
+ | Repository | Source files | Names | Event bytes | First turn | Every later turn |
68
+ | --- | ---: | ---: | ---: | ---: | ---: |
69
+ | agent-watch-core | 1,704 | 6,080 | 341,340 | 195–236 ms | 0.15–0.35 ms, 0 git |
70
+ | tripPlanner | 699 | 2,372 | 141,447 | 95–180 ms | 0.15–0.28 ms, 0 git |
71
+ | agent-watch-edge | 266 | 1,366 | 55,407 | 81–142 ms | 0.12–0.14 ms, 0 git |
72
+
73
+ Anchoring matters: one search mixing anchored and unanchored patterns took ~800 ms on
74
+ agent-watch-core, because git can no longer reject a line at its first byte. A tree is
75
+ drained last and alone in its own batch, so it never shares the gateway's 8 MiB body limit.
76
+
60
77
  These are observations, not an SLA or a cross-machine comparison. At 30 samples,
61
78
  p99 is effectively the maximum. CI retains its own JSON measurements on Linux
62
79
  and macOS rather than enforcing unstable absolute timing thresholds on shared
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-watch-ai/edge",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Usage and cost telemetry for Claude Code, Codex, Cursor, Gemini CLI and Antigravity. No daemon, no proxy.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -81,19 +81,20 @@
81
81
  "hooks"
82
82
  ],
83
83
  "dependencies": {
84
- "smol-toml": "^1.3.1",
85
- "zod": "^3.24.0"
84
+ "smol-toml": "^1.9.1",
85
+ "zod": "^4.6.7"
86
86
  },
87
87
  "devDependencies": {
88
- "@eslint/js": "^9.17.0",
88
+ "@eslint/js": "^10.0.1",
89
89
  "@stylistic/eslint-plugin": "^5.10.0",
90
- "@types/node": "^22.10.0",
91
- "@vitest/coverage-v8": "^2.1.9",
92
- "eslint": "^9.17.0",
90
+ "@types/node": "^26.6.5",
91
+ "@vitest/coverage-v8": "^4.1.11",
92
+ "eslint": "^10.13.0",
93
93
  "eslint-plugin-import-x": "^4.17.1",
94
94
  "eslint-plugin-jsdoc": "^63.3.3",
95
95
  "typescript": "^5.7.0",
96
96
  "typescript-eslint": "^8.19.0",
97
- "vitest": "^2.1.8"
97
+ "vite-node": "^6.0.0",
98
+ "vitest": "^4.1.11"
98
99
  }
99
100
  }