@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
package/CHANGELOG.md CHANGED
@@ -6,6 +6,56 @@
6
6
  together from one `otel-vX.Y.Z` tag by `otel-release.yml`, at one version and
7
7
  only when both suites pass. `python-release.yml` no longer publishes alone.
8
8
 
9
+ ## 0.6.0
10
+
11
+ ### New record: `repo.tree`
12
+
13
+ Once per repository per install identity, on the first closed turn in it, the
14
+ edge sends the default branch's source file paths and their top-level
15
+ declaration and route names, read from git's object store: never file contents,
16
+ never the working copy, no blob or tree ids. It is what a tenant with no GitHub
17
+ App gets its feature catalog named from. Needs `capture.git` and
18
+ `capture.files`; `docs/DATA_HANDLING.md` lists every field. Needs a platform
19
+ that accepts `repo.tree` (AWT-680).
20
+
21
+ ### Fields nothing reads are no longer sent
22
+
23
+ `turn.summary` drops `prompt_evidence` and `response_evidence` (a prompt's and
24
+ response's length and SHA-256), sends at most one `prompt_jira_ids` key (the
25
+ platform reads only the first), and sends `content_hashes` as blob ids without
26
+ paths. `repo.snapshot` drops branch `last_commit_at`, commit `authored_at` and
27
+ each file's `status` letter. Records queued by an older release lose the same
28
+ fields at delivery. Needs a platform that accepts their absence (AWT-682).
29
+
30
+ ## 0.5.0
31
+
32
+ ### Behaviour change: turn summaries carry per-tool-call records
33
+
34
+ `turn.summary` gains `tool_events`: one content-free record per tool call, in
35
+ call order and capped at 200, from Claude Code, Codex, Cursor, Gemini CLI and
36
+ Antigravity. Each record has the tool, call id, status, exit code, start and
37
+ end times, and a fingerprint of the command or connector arguments, hashed in
38
+ memory. An allowlisted check that ran also carries HEAD and a digest of the
39
+ working tree. Nothing is sent with `capture.git` off. `docs/DATA_HANDLING.md`
40
+ lists every field. Needs a platform that accepts `tool_events` (AWT-674).
41
+
42
+ ### Behaviour change: Gemini CLI telemetry moves to `~/.gemini/.env`
43
+
44
+ Gemini CLI 0.63 and later ignore the `env` block in `settings.json`, so native
45
+ telemetry sent nothing. Setup, the hook bearer rewrite, `inspect`, the exporter
46
+ sweep and uninstall now use `~/.gemini/.env`, and remove a block an older
47
+ version left in `settings.json`. Re-run setup on machines with Gemini CLI.
48
+
49
+ ### Security: dependency updates
50
+
51
+ - `smol-toml`, the TOML parser the edge reads agent config files
52
+ with, is now `^1.9.1`, which clears GHSA-r4xh-jqrq-34v2 (quadratic-time
53
+ `parse()` on `<= 1.8.0`). No behaviour change.
54
+ - `zod` is now `^4.6.7` (from 3.x), which clears GHSA-mrhx-c7xc-m3w5
55
+ (memory exhaustion validating oversized constrained collections). It parses
56
+ the config, the delivery queue and every hook payload. No behaviour change:
57
+ nested config defaults still fill in from an empty section.
58
+
9
59
  ## 0.4.0
10
60
 
11
61
  - A Cursor MCP call keeps its server name: the before-hook carries it to the
package/README.md CHANGED
@@ -46,7 +46,7 @@ tracer_provider.add_span_processor(AgentWatchSpanProcessor(token="..."))
46
46
  |---|---|---|---|
47
47
  | **Claude Code** | `~/.claude/settings.json` | Logs, Traces, Metrics | Yes |
48
48
  | **OpenAI Codex** | `~/.codex/hooks.json` | Logs, Traces (`~/.codex/config.toml`) | Yes |
49
- | **Gemini CLI** | `~/.gemini/settings.json` | Logs, Traces, Metrics | Yes |
49
+ | **Gemini CLI** | `~/.gemini/settings.json` | Logs, Traces, Metrics (`~/.gemini/.env`) | Yes |
50
50
  | **Cursor** | `~/.cursor/hooks.json` | None | **No** |
51
51
  | **Google Antigravity** | `~/.gemini/config/hooks.json` | None | **No** |
52
52
 
@@ -57,7 +57,7 @@ branches, ticket keys — is reported for all five.
57
57
  Per-agent notes:
58
58
 
59
59
  * **OpenAI Codex** — new hooks must be trusted once: launch `codex`, type `/hooks`, approve the AgentWatch entries.
60
- * **Gemini CLI** — telemetry runs through `GEMINI_TELEMETRY_ENABLED` with `GEMINI_TELEMETRY_TARGET=local`, and the ingest token travels in `OTEL_EXPORTER_OTLP_HEADERS`; Gemini has no `otelHeadersHelper`.
60
+ * **Gemini CLI** — telemetry is written to `~/.gemini/.env` (Gemini 0.63+ does not apply the `settings.json` `env` block): `GEMINI_TELEMETRY_ENABLED` with `GEMINI_TELEMETRY_TARGET=local`, and the access token in `OTEL_EXPORTER_OTLP_HEADERS`; Gemini has no `otelHeadersHelper`. Gemini loads that file only in a trusted folder, and a project `.env` or `.gemini/.env` found first replaces it. The switch, target and endpoint are also set in the `settings.json` `telemetry` block, and `agentwatch status` warns when a project `.env` hides the token.
61
61
  * **Google Antigravity** — a turn is one *execution*: `PreInvocation`/`PostInvocation` bracket the model calls inside it and only `Stop` closes it. The prompt comes from `common.lastUserInput`; there is no user-prompt hook.
62
62
  * **Cursor** — the CLI emits shell hooks only; the full lifecycle exists in IDE sessions. Cloud agents need a committed `.cursor/hooks.json` and the package installed in the cloud environment. Accepted tab edits (`afterTabFileEdit`) are monitored; high-frequency `beforeTabFileRead` is ignored.
63
63
 
@@ -105,10 +105,10 @@ One global file: `~/.agentwatch/config.json`, written by `agentwatch setup`.
105
105
 
106
106
  Prompt text, tool inputs, tool outputs and session titles are off by default. Turning one on takes **two** things —
107
107
  the global `contentCaptureConsent` marker *and* the individual flag. The marker alone enables
108
- nothing; a flag alone collects nothing. With all of them off a prompt or response is recorded only
109
- as a length and a SHA-256, so turn counts and cost attribution work without the text. Ticket keys
110
- named in the opening prompt are extracted on the machine and sent as `prompt_jira_ids`, unfiltered
111
- (the platform keeps only keys it knows); the prompt text is not.
108
+ nothing; a flag alone collects nothing. With all of them off nothing about a prompt or response
109
+ is sent — no text, no length, no hash — and turn counts and cost attribution still work. The first
110
+ ticket key named in the opening prompt is extracted on the machine and sent as `prompt_jira_ids`
111
+ (the platform keeps it only if it knows the key); the prompt text is not.
112
112
 
113
113
  ```json
114
114
  {
@@ -267,9 +267,10 @@ To try it locally: `BLOCK=1 npm run example` refuses every check.
267
267
 
268
268
  | Record | How | Contents |
269
269
  |---|---|---|
270
- | `turn.summary` | Edge hooks → `POST <backend>/v1/events` | One completed turn: prompt/response length and hash, tool counts, file paths (repo-relative, and home-relative outside a checkout), Git branch, ticket keys from the branch name and the opening prompt. Prompt text and shell/connector inputs only when opted in. Never response text. |
270
+ | `turn.summary` | Edge hooks → `POST <backend>/v1/events` | One completed turn: tool counts, file paths (repo-relative, and home-relative outside a checkout), Git branch, ticket keys from the branch name and the first from the opening prompt. With Git capture on, `tool_events`: per tool call its order, status, exit code, times, a sha256 fingerprint of the normalized command or connector arguments (never the text), and for a test/lint/build check over 60 s the commit and a working-tree digest. Prompt text and shell/connector inputs only when opted in. Never response text. |
271
271
  | `llm.call` | The agent's own OTLP → `POST <backend>/v1/otlp/v1/logs` | Token usage, cost and latency per model request. The edge does not proxy this. |
272
272
  | `repo.snapshot` | Edge hooks, after a closed turn | Changed branch/commit metadata, including commit subjects, when Git capture is on. |
273
+ | `repo.tree` | Edge hooks, after the first closed turn in a repository, once per install identity | The default branch's source paths and top-level declaration and route names, when Git and file capture are on. Never file contents. |
273
274
 
274
275
  The backend joins `llm.call` to `turn.summary` on conversation and turn ids.
275
276
 
package/SECURITY.md CHANGED
@@ -23,7 +23,7 @@ bugs of the highest priority:
23
23
  Codex has no headers-helper mechanism, so its OTel exporter carries the device's one-hour
24
24
  access token inside `~/.codex/config.toml` — which setup therefore keeps at mode 0600, and
25
25
  every hook rewrites as the token rotates. Gemini stores the same access token in
26
- `~/.gemini/settings.json` (0600); it has no headers helper. The device secret is never written
26
+ `~/.gemini/.env` (0600); it has no headers helper. The device secret is never written
27
27
  to either file, and the install key only while the machine has no device yet: the
28
28
  first hook with a device token replaces it, and on Windows the next successful setup does (docs/NATIVE_OTLP_TOKENS.md).
29
29
  - a long-lived credential on disk in plaintext where an OS keychain exists. The edge exchanges
@@ -309,5 +309,5 @@ function fallbackConfig() {
309
309
  * @returns The joined description.
310
310
  */
311
311
  function describeIssues(issues) {
312
- return issues.map((issue) => `${issue.path.join('.')}: ${issue.message}`).join('; ');
312
+ return issues.map((issue) => `${issue.path.map(String).join('.')}: ${issue.message}`).join('; ');
313
313
  }
@@ -51,7 +51,7 @@ export function mergeRepoConfig(global, repoValue) {
51
51
  const merged = overlay(global, narrowed.value);
52
52
  const parsed = configSchema.safeParse(merged);
53
53
  if (!parsed.success) {
54
- const detail = parsed.error.issues.map((issue) => `${issue.path.join('.')}: ${issue.message}`).join('; ');
54
+ const detail = parsed.error.issues.map((issue) => `${issue.path.map(String).join('.')}: ${issue.message}`).join('; ');
55
55
  return { config: global, warnings: [...warnings, `${REPO_CONFIG_NAME}: invalid overrides ignored (${detail})`] };
56
56
  }
57
57
  return { config: parsed.data, warnings };