@agent-watch-ai/edge 0.3.1 → 0.5.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 (123) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/README.md +10 -6
  3. package/SECURITY.md +7 -4
  4. package/dist/cli/constants/cli.constants.d.ts +2 -0
  5. package/dist/cli/constants/cli.constants.js +3 -1
  6. package/dist/cli/doctor.js +13 -2
  7. package/dist/cli/setup.js +138 -29
  8. package/dist/cli/toggle.js +5 -1
  9. package/dist/cli/types/cli.types.d.ts +6 -0
  10. package/dist/cli/uninstall.js +1 -1
  11. package/dist/cli.js +14 -3
  12. package/dist/config/config-store.d.ts +1 -1
  13. package/dist/config/config-store.js +2 -2
  14. package/dist/config/constants/config.constants.d.ts +4 -1
  15. package/dist/config/constants/config.constants.js +7 -2
  16. package/dist/config/repo-config.js +1 -1
  17. package/dist/config/schemas/config.schema.d.ts +113 -767
  18. package/dist/config/schemas/config.schema.js +17 -8
  19. package/dist/credentials/constants/credentials.constants.d.ts +8 -0
  20. package/dist/credentials/constants/credentials.constants.js +9 -1
  21. package/dist/credentials/credential-status.js +8 -4
  22. package/dist/credentials/credentials.d.ts +16 -2
  23. package/dist/credentials/credentials.js +30 -5
  24. package/dist/credentials/device-api.d.ts +10 -1
  25. package/dist/credentials/device-api.js +12 -1
  26. package/dist/credentials/identity.d.ts +12 -1
  27. package/dist/credentials/identity.js +12 -1
  28. package/dist/credentials/migration.d.ts +1 -1
  29. package/dist/credentials/migration.js +1 -1
  30. package/dist/credentials/schemas/device-api.schema.d.ts +4 -51
  31. package/dist/credentials/schemas/device-state.schema.d.ts +3 -38
  32. package/dist/credentials/sign-in.d.ts +14 -1
  33. package/dist/credentials/sign-in.js +24 -5
  34. package/dist/credentials/types/credentials.types.d.ts +12 -1
  35. package/dist/enforcement/decision-client.js +2 -1
  36. package/dist/enforcement/enforcement.js +7 -5
  37. package/dist/enforcement/types/enforcement.types.d.ts +2 -2
  38. package/dist/git/code-state.d.ts +33 -0
  39. package/dist/git/code-state.js +44 -0
  40. package/dist/git/constants/git.constants.d.ts +6 -0
  41. package/dist/git/constants/git.constants.js +6 -0
  42. package/dist/git/index.d.ts +2 -1
  43. package/dist/git/index.js +1 -0
  44. package/dist/git/types/git.types.d.ts +6 -0
  45. package/dist/pipeline/constants/pipeline.constants.d.ts +3 -0
  46. package/dist/pipeline/constants/pipeline.constants.js +3 -0
  47. package/dist/pipeline/hook-pipeline.js +56 -7
  48. package/dist/privacy/command-fingerprint.d.ts +42 -0
  49. package/dist/privacy/command-fingerprint.js +249 -0
  50. package/dist/privacy/constants/command-fingerprint.constants.d.ts +34 -0
  51. package/dist/privacy/constants/command-fingerprint.constants.js +38 -0
  52. package/dist/privacy/index.d.ts +3 -1
  53. package/dist/privacy/index.js +2 -0
  54. package/dist/privacy/product-capture.js +20 -0
  55. package/dist/privacy/types/privacy.types.d.ts +7 -0
  56. package/dist/providers/antigravity/antigravity.adapter.js +3 -0
  57. package/dist/providers/antigravity/schemas/antigravity.schema.d.ts +18 -492
  58. package/dist/providers/claude/claude.adapter.js +12 -1
  59. package/dist/providers/claude/constants/claude.constants.d.ts +6 -0
  60. package/dist/providers/claude/constants/claude.constants.js +6 -0
  61. package/dist/providers/claude/schemas/claude.schema.d.ts +1 -43
  62. package/dist/providers/codex/codex.adapter.js +14 -0
  63. package/dist/providers/codex/codex.otel.d.ts +12 -1
  64. package/dist/providers/codex/codex.otel.js +61 -11
  65. package/dist/providers/codex/constants/codex.otel.constants.d.ts +5 -0
  66. package/dist/providers/codex/constants/codex.otel.constants.js +5 -0
  67. package/dist/providers/codex/schemas/codex.schema.d.ts +1 -41
  68. package/dist/providers/constants/provider.constants.d.ts +8 -0
  69. package/dist/providers/constants/provider.constants.js +8 -0
  70. package/dist/providers/cursor/constants/cursor.constants.d.ts +2 -0
  71. package/dist/providers/cursor/constants/cursor.constants.js +2 -0
  72. package/dist/providers/cursor/cursor.adapter.js +84 -5
  73. package/dist/providers/cursor/schemas/cursor.schema.d.ts +5 -85
  74. package/dist/providers/gemini/constants/gemini.constants.d.ts +2 -0
  75. package/dist/providers/gemini/constants/gemini.constants.js +2 -0
  76. package/dist/providers/gemini/constants/gemini.otel.constants.d.ts +16 -1
  77. package/dist/providers/gemini/constants/gemini.otel.constants.js +16 -1
  78. package/dist/providers/gemini/gemini.detect.d.ts +11 -0
  79. package/dist/providers/gemini/gemini.detect.js +14 -1
  80. package/dist/providers/gemini/gemini.hooks.d.ts +3 -3
  81. package/dist/providers/gemini/gemini.hooks.js +5 -5
  82. package/dist/providers/gemini/gemini.otel.d.ts +14 -4
  83. package/dist/providers/gemini/gemini.otel.js +418 -107
  84. package/dist/providers/gemini/schemas/gemini.schema.d.ts +1 -49
  85. package/dist/providers/shared/bearer-rewrite.d.ts +19 -0
  86. package/dist/providers/shared/bearer-rewrite.js +46 -0
  87. package/dist/providers/shared/constants/tooling.constants.d.ts +6 -0
  88. package/dist/providers/shared/constants/tooling.constants.js +6 -0
  89. package/dist/providers/shared/event-builder.d.ts +17 -2
  90. package/dist/providers/shared/event-builder.js +43 -3
  91. package/dist/providers/shared/install-record.d.ts +2 -0
  92. package/dist/providers/shared/install-record.js +3 -2
  93. package/dist/providers/shared/tooling.d.ts +35 -0
  94. package/dist/providers/shared/tooling.js +61 -1
  95. package/dist/providers/shared/types/adapter.types.d.ts +18 -0
  96. package/dist/providers/types/provider.types.d.ts +24 -0
  97. package/dist/storage/atomic-file.d.ts +14 -0
  98. package/dist/storage/atomic-file.js +19 -0
  99. package/dist/storage/constants/storage.constants.d.ts +2 -0
  100. package/dist/storage/constants/storage.constants.js +2 -0
  101. package/dist/storage/schemas/storage.schema.d.ts +11 -175
  102. package/dist/storage/schemas/storage.schema.js +7 -1
  103. package/dist/transport/schemas/queue.schema.d.ts +1 -16
  104. package/dist/transport/schemas/queue.schema.js +1 -1
  105. package/dist/turns/constants/turns.constants.d.ts +17 -0
  106. package/dist/turns/constants/turns.constants.js +17 -0
  107. package/dist/turns/index.d.ts +3 -2
  108. package/dist/turns/index.js +1 -0
  109. package/dist/turns/tool-events.d.ts +15 -0
  110. package/dist/turns/tool-events.js +59 -0
  111. package/dist/turns/turn-state.js +2 -2
  112. package/dist/turns/turn-summary.d.ts +1 -1
  113. package/dist/turns/turn-summary.js +1 -0
  114. package/dist/turns/turn-tracker.js +138 -7
  115. package/dist/turns/types/turn-state.types.d.ts +28 -1
  116. package/dist/turns/types/turn-summary.types.d.ts +30 -0
  117. package/dist/turns/types/turn-tracker.types.d.ts +10 -0
  118. package/dist/turns/work-checkout.d.ts +5 -3
  119. package/dist/turns/work-checkout.js +46 -12
  120. package/docs/AUDIT_PROMPT.md +11 -0
  121. package/docs/DATA_HANDLING.md +69 -14
  122. package/docs/ENTERPRISE_DEPLOYMENT.md +21 -5
  123. package/package.json +9 -8
@@ -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
 
@@ -36,11 +37,15 @@ or the Secret Service keyring (Linux with a desktop session). `uninstall` withou
36
37
  `--agent` removes it; a Windows DPAPI blob or the no-keychain fallback file lives
37
38
  in `~/.agentwatch/credentials/` and goes with `--purge` as well.
38
39
 
39
- An MDM rollout that sets `$AGENTWATCH_TOKEN` hands setup the install key as
40
+ The MDM templates in `examples/mdm/` deploy no key: `agentwatch setup
41
+ <enrollment-url> --defer-sign-in` configures the organization, and the machine
42
+ sends nothing until its developer runs `agentwatch setup` and signs in.
43
+
44
+ A legacy MDM rollout that sets `$AGENTWATCH_TOKEN` hands setup the install key as
40
45
  before; the edge exchanges it for a device credential during that setup run, or
41
46
  on the first later run that reaches the backend. The key stays in `config.json`
42
- (0600) beside the device until AWT-357, because Codex and Gemini still present
43
- it; re-running setup with the same key keeps the existing device rather than
47
+ (0600) beside the device, to enroll again when the device secret expires; Codex
48
+ and Gemini get the device's access token, and the key only until the exchange succeeds. Re-running setup with the same key keeps the existing device rather than
44
49
  enrolling a new one. On Windows the exchange happens in setup only. Headless Linux has no keychain: the secret is a 0600 file and
45
50
  `agentwatch doctor` reports the credential check as a warning.
46
51
 
@@ -84,7 +89,18 @@ The npm package itself is never removed by `uninstall`; `npm rm -g
84
89
 
85
90
  ## Release operation
86
91
 
87
- Nothing runs on pushes or PRs. A release starts with a `workflow_dispatch` of
92
+ Nothing runs on PRs or branch pushes. The runtime packages `@agent-watch-ai/otel`
93
+ and `agent-watch-otel` are released together by pushing an `otel-vX.Y.Z` tag on
94
+ `main` (`otel-release.yml`, gated by the `otel-release` environment, trusted
95
+ publishing on npm and PyPI). Before the first tag: on PyPI, change the
96
+ `agent-watch-otel` trusted publisher from `python-release.yml` / `pypi-release`
97
+ to `otel-release.yml` / `otel-release`. npm trusted publishing can only be set
98
+ up on a package that exists, so the first publish uses a short-lived granular
99
+ npm token (read and write on the `@agent-watch-ai` scope, 2FA bypass) stored as
100
+ the `NPM_TOKEN` secret of the `otel-release` environment; then add the npm
101
+ trusted publisher (`otel-release.yml`, `otel-release`), delete the secret
102
+ and revoke the token. The workflow publishes PyPI first, then npm; a rerun skips
103
+ what is already published. The CLI release starts with a `workflow_dispatch` of
88
104
  `release.yml`, which verifies and builds artifacts; locally the same is: run
89
105
  `npm ci`, the test/lint/typecheck/build checks, then `npm run release:artifacts`
90
106
  to create a verified tarball, production dependency SBOM, and `SHA256SUMS`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-watch-ai/edge",
3
- "version": "0.3.1",
3
+ "version": "0.5.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
  }