ai-telemetry-agent 0.1.1__tar.gz

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 (59) hide show
  1. ai_telemetry_agent-0.1.1/PKG-INFO +208 -0
  2. ai_telemetry_agent-0.1.1/README.md +194 -0
  3. ai_telemetry_agent-0.1.1/pyproject.toml +39 -0
  4. ai_telemetry_agent-0.1.1/setup.cfg +4 -0
  5. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/__init__.py +24 -0
  6. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/__main__.py +6 -0
  7. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/cli.py +668 -0
  8. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/config/__init__.py +17 -0
  9. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/config/settings.py +260 -0
  10. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/core/__init__.py +34 -0
  11. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/core/collector.py +209 -0
  12. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/core/event.py +205 -0
  13. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/core/identity.py +234 -0
  14. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/core/processor.py +174 -0
  15. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/core/repository.py +129 -0
  16. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/core/validation.py +80 -0
  17. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/integrations/__init__.py +1 -0
  18. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/integrations/hooks/hook_handler.py +145 -0
  19. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/integrations/hooks/hooks_template.json +31 -0
  20. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/integrations/hooks/installer.py +236 -0
  21. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/integrations/mcp_probe/README.md +52 -0
  22. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/integrations/mcp_probe/__init__.py +1 -0
  23. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/integrations/mcp_probe/mcp_server.py +140 -0
  24. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/logging/__init__.py +17 -0
  25. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/logging/structured.py +111 -0
  26. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/sources/__init__.py +37 -0
  27. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/sources/ai_provider.py +355 -0
  28. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/sources/antigravity.py +106 -0
  29. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/sources/antigravity_probe.py +109 -0
  30. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/sources/base.py +29 -0
  31. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/sources/git.py +186 -0
  32. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/sources/system.py +113 -0
  33. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/storage/__init__.py +9 -0
  34. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/storage/base.py +63 -0
  35. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent/storage/jsonl_store.py +423 -0
  36. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent.egg-info/PKG-INFO +208 -0
  37. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent.egg-info/SOURCES.txt +57 -0
  38. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent.egg-info/dependency_links.txt +1 -0
  39. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent.egg-info/entry_points.txt +2 -0
  40. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent.egg-info/requires.txt +7 -0
  41. ai_telemetry_agent-0.1.1/src/ai_telemetry_agent.egg-info/top_level.txt +1 -0
  42. ai_telemetry_agent-0.1.1/tests/test_ai_provider.py +80 -0
  43. ai_telemetry_agent-0.1.1/tests/test_antigravity_probe.py +44 -0
  44. ai_telemetry_agent-0.1.1/tests/test_collector_lifecycle.py +64 -0
  45. ai_telemetry_agent-0.1.1/tests/test_e2e.py +97 -0
  46. ai_telemetry_agent-0.1.1/tests/test_enrollment.py +202 -0
  47. ai_telemetry_agent-0.1.1/tests/test_event_model.py +108 -0
  48. ai_telemetry_agent-0.1.1/tests/test_git_source.py +67 -0
  49. ai_telemetry_agent-0.1.1/tests/test_global_hooks.py +238 -0
  50. ai_telemetry_agent-0.1.1/tests/test_hooks_integration.py +71 -0
  51. ai_telemetry_agent-0.1.1/tests/test_identity.py +42 -0
  52. ai_telemetry_agent-0.1.1/tests/test_jsonl_storage.py +334 -0
  53. ai_telemetry_agent-0.1.1/tests/test_mcp_probe.py +33 -0
  54. ai_telemetry_agent-0.1.1/tests/test_multi_model_session.py +179 -0
  55. ai_telemetry_agent-0.1.1/tests/test_packaging.py +220 -0
  56. ai_telemetry_agent-0.1.1/tests/test_privacy.py +51 -0
  57. ai_telemetry_agent-0.1.1/tests/test_publish_script.py +191 -0
  58. ai_telemetry_agent-0.1.1/tests/test_repository_correlation.py +195 -0
  59. ai_telemetry_agent-0.1.1/tests/test_storage.py +66 -0
@@ -0,0 +1,208 @@
1
+ Metadata-Version: 2.4
2
+ Name: ai-telemetry-agent
3
+ Version: 0.1.1
4
+ Summary: Local developer telemetry agent for Antigravity AI usage and engineering signals
5
+ Author: Engineering Telemetry Team
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown
8
+ Provides-Extra: dev
9
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
10
+ Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
11
+ Requires-Dist: build>=1.0.0; extra == "dev"
12
+ Requires-Dist: twine>=5.0.0; extra == "dev"
13
+ Requires-Dist: python-dotenv>=1.0.0; extra == "dev"
14
+
15
+ # AI Telemetry Agent
16
+
17
+ A local developer telemetry agent for Antigravity AI usage, Git activity, and engineering signals.
18
+
19
+ ---
20
+
21
+ ## Architecture Overview
22
+
23
+ ```
24
+ Developer Interaction
25
+ │
26
+ ▼
27
+ Antigravity Lifecycle Hooks (%USERPROFILE%\.gemini\config\hooks.json)
28
+ │
29
+ ▼
30
+ AI Telemetry Agent Collector (ai_telemetry_agent)
31
+ │
32
+ ▼
33
+ Append-Only Daily JSONL Storage (~/.telemetry_agent/)
34
+ ```
35
+
36
+ ### Storage Structure
37
+
38
+ ```
39
+ ~/.telemetry_agent/
40
+ ├── identity.json
41
+ ├── device_id
42
+ └── data/
43
+ ├── telemetry-2026-10-07.jsonl
44
+ ├── telemetry-2026-10-08.jsonl
45
+ └── telemetry-YYYY-MM-DD.jsonl
46
+ ```
47
+
48
+ - **`identity.json`** (`WHO`): Local developer identity and hardware metadata (`member_id`, `member_name`, `device_id`, `hostname`).
49
+ - **`data/telemetry-YYYY-MM-DD.jsonl`** (`WHAT`): Append-only daily JSONL telemetry files named by UTC date. Exactly one valid JSON object per line.
50
+
51
+ ---
52
+
53
+ ## Privacy & Security
54
+
55
+ The AI Telemetry Agent enforces strict privacy boundaries:
56
+ - **NO Prompts or Model Responses**: Never collects, records, or transmits conversational text or prompts.
57
+ - **NO Source Code or File Contents**: Never collects repository file contents, code diffs, or patch bodies.
58
+ - **NO Tool Arguments or Command History**: Never stores terminal history or tool call parameter values.
59
+ - **NO Secrets or Credentials**: Environment variables, API keys, passwords, and tokens are scrubbed and excluded.
60
+ - **Metadata Only**: Collects only execution metadata (event type, UTC timestamp, session ID, model name, tool name, repository name, branch).
61
+
62
+ ---
63
+
64
+ ## Installation & Setup
65
+
66
+ ### 1. Install Package
67
+ ```bash
68
+ pip install ai-telemetry-agent
69
+ ```
70
+
71
+ ### 2. First-Time Developer Enrollment & Hook Setup
72
+ Run the setup command:
73
+ ```bash
74
+ telemetry-agent install
75
+ ```
76
+
77
+ When run for the first time, you will be prompted for your name:
78
+ ```text
79
+ ========================================
80
+ AI Telemetry Agent Setup
81
+ ========================================
82
+
83
+ Enter your name: Rahul Sharma
84
+
85
+ Developer: Rahul Sharma
86
+ Device: DELL-LAPTOP-123
87
+ Device ID: dev-401e19f040bb
88
+
89
+ Save this identity? [Y/n]: Y
90
+ [OK] Developer identity saved
91
+ [OK] Antigravity hooks installed
92
+ [OK] Telemetry agent configured
93
+ ```
94
+
95
+ Subsequent runs are idempotent and reuse the saved identity:
96
+ ```text
97
+ ========================================
98
+ AI Telemetry Agent Setup
99
+ ========================================
100
+ [OK] Telemetry Agent already configured
101
+ Developer: Rahul Sharma
102
+ Device: DELL-LAPTOP-123
103
+ Device ID: dev-401e19f040bb
104
+ Member ID: mem-401e19f040
105
+ ```
106
+
107
+ ---
108
+
109
+ ## CLI Commands
110
+
111
+ ### Agent Status
112
+ ```bash
113
+ telemetry-agent status
114
+ ```
115
+ Displays collector daemon state, local developer identity, device ID, hook installation status, and total recorded events.
116
+
117
+ ### View Recent Events
118
+ ```bash
119
+ # View last 10 events
120
+ telemetry-agent events --last 10
121
+
122
+ # Filter by event type
123
+ telemetry-agent events --type ai_run_started
124
+
125
+ # Filter by repository
126
+ telemetry-agent events --repo chatbot-service
127
+
128
+ # Output formatted JSON
129
+ telemetry-agent events --last 5 --json
130
+ ```
131
+
132
+ ### View Session Summaries
133
+ ```bash
134
+ # Aggregate multi-model sessions across all JSONL logs
135
+ telemetry-agent sessions
136
+
137
+ # Inspect specific session history
138
+ telemetry-agent session <session-id>
139
+ ```
140
+
141
+ ### Repository & Engineering Summary
142
+ ```bash
143
+ # Aggregated metrics per repository
144
+ telemetry-agent summary
145
+ ```
146
+
147
+ ### Manage Antigravity Hooks
148
+ ```bash
149
+ # Check hook installation status
150
+ telemetry-agent hook-status
151
+
152
+ # Install or repair global hooks
153
+ telemetry-agent install-hook
154
+
155
+ # Uninstall hooks cleanly
156
+ telemetry-agent uninstall-hook
157
+ ```
158
+
159
+ ---
160
+
161
+ ## Running Tests
162
+
163
+ Run the full automated test suite:
164
+ ```bash
165
+ pytest tests -v
166
+ ```
167
+
168
+ ---
169
+
170
+ ## Building Distribution Packages
171
+
172
+ ```bash
173
+ # Clean previous artifacts and build package
174
+ python -m build
175
+
176
+ # Validate distributions
177
+ python -m twine check dist/*
178
+ ```
179
+
180
+ ---
181
+
182
+ ## Publishing Packages to PyPI / TestPyPI
183
+
184
+ Secure publishing is configured via local `.env` and `scripts/publish_pypi.py`:
185
+
186
+ 1. **Configure local `.env`** (ignored by Git, never committed):
187
+ ```env
188
+ TWINE_USERNAME=__token__
189
+ TWINE_PASSWORD=
190
+ ```
191
+ 2. **Build and validate package artifacts**:
192
+ ```bash
193
+ python -m build
194
+ python -m twine check dist/*
195
+ ```
196
+ 3. **Run pre-flight check (Dry Run)**:
197
+ ```bash
198
+ python scripts/publish_pypi.py --dry-run
199
+ ```
200
+ 4. **Publish**:
201
+ ```bash
202
+ # Production PyPI:
203
+ python scripts/publish_pypi.py
204
+
205
+ # TestPyPI:
206
+ python scripts/publish_pypi.py --repository-url https://test.pypi.org/legacy/
207
+ ```
208
+
@@ -0,0 +1,194 @@
1
+ # AI Telemetry Agent
2
+
3
+ A local developer telemetry agent for Antigravity AI usage, Git activity, and engineering signals.
4
+
5
+ ---
6
+
7
+ ## Architecture Overview
8
+
9
+ ```
10
+ Developer Interaction
11
+ │
12
+ ▼
13
+ Antigravity Lifecycle Hooks (%USERPROFILE%\.gemini\config\hooks.json)
14
+ │
15
+ ▼
16
+ AI Telemetry Agent Collector (ai_telemetry_agent)
17
+ │
18
+ ▼
19
+ Append-Only Daily JSONL Storage (~/.telemetry_agent/)
20
+ ```
21
+
22
+ ### Storage Structure
23
+
24
+ ```
25
+ ~/.telemetry_agent/
26
+ ├── identity.json
27
+ ├── device_id
28
+ └── data/
29
+ ├── telemetry-2026-10-07.jsonl
30
+ ├── telemetry-2026-10-08.jsonl
31
+ └── telemetry-YYYY-MM-DD.jsonl
32
+ ```
33
+
34
+ - **`identity.json`** (`WHO`): Local developer identity and hardware metadata (`member_id`, `member_name`, `device_id`, `hostname`).
35
+ - **`data/telemetry-YYYY-MM-DD.jsonl`** (`WHAT`): Append-only daily JSONL telemetry files named by UTC date. Exactly one valid JSON object per line.
36
+
37
+ ---
38
+
39
+ ## Privacy & Security
40
+
41
+ The AI Telemetry Agent enforces strict privacy boundaries:
42
+ - **NO Prompts or Model Responses**: Never collects, records, or transmits conversational text or prompts.
43
+ - **NO Source Code or File Contents**: Never collects repository file contents, code diffs, or patch bodies.
44
+ - **NO Tool Arguments or Command History**: Never stores terminal history or tool call parameter values.
45
+ - **NO Secrets or Credentials**: Environment variables, API keys, passwords, and tokens are scrubbed and excluded.
46
+ - **Metadata Only**: Collects only execution metadata (event type, UTC timestamp, session ID, model name, tool name, repository name, branch).
47
+
48
+ ---
49
+
50
+ ## Installation & Setup
51
+
52
+ ### 1. Install Package
53
+ ```bash
54
+ pip install ai-telemetry-agent
55
+ ```
56
+
57
+ ### 2. First-Time Developer Enrollment & Hook Setup
58
+ Run the setup command:
59
+ ```bash
60
+ telemetry-agent install
61
+ ```
62
+
63
+ When run for the first time, you will be prompted for your name:
64
+ ```text
65
+ ========================================
66
+ AI Telemetry Agent Setup
67
+ ========================================
68
+
69
+ Enter your name: Rahul Sharma
70
+
71
+ Developer: Rahul Sharma
72
+ Device: DELL-LAPTOP-123
73
+ Device ID: dev-401e19f040bb
74
+
75
+ Save this identity? [Y/n]: Y
76
+ [OK] Developer identity saved
77
+ [OK] Antigravity hooks installed
78
+ [OK] Telemetry agent configured
79
+ ```
80
+
81
+ Subsequent runs are idempotent and reuse the saved identity:
82
+ ```text
83
+ ========================================
84
+ AI Telemetry Agent Setup
85
+ ========================================
86
+ [OK] Telemetry Agent already configured
87
+ Developer: Rahul Sharma
88
+ Device: DELL-LAPTOP-123
89
+ Device ID: dev-401e19f040bb
90
+ Member ID: mem-401e19f040
91
+ ```
92
+
93
+ ---
94
+
95
+ ## CLI Commands
96
+
97
+ ### Agent Status
98
+ ```bash
99
+ telemetry-agent status
100
+ ```
101
+ Displays collector daemon state, local developer identity, device ID, hook installation status, and total recorded events.
102
+
103
+ ### View Recent Events
104
+ ```bash
105
+ # View last 10 events
106
+ telemetry-agent events --last 10
107
+
108
+ # Filter by event type
109
+ telemetry-agent events --type ai_run_started
110
+
111
+ # Filter by repository
112
+ telemetry-agent events --repo chatbot-service
113
+
114
+ # Output formatted JSON
115
+ telemetry-agent events --last 5 --json
116
+ ```
117
+
118
+ ### View Session Summaries
119
+ ```bash
120
+ # Aggregate multi-model sessions across all JSONL logs
121
+ telemetry-agent sessions
122
+
123
+ # Inspect specific session history
124
+ telemetry-agent session <session-id>
125
+ ```
126
+
127
+ ### Repository & Engineering Summary
128
+ ```bash
129
+ # Aggregated metrics per repository
130
+ telemetry-agent summary
131
+ ```
132
+
133
+ ### Manage Antigravity Hooks
134
+ ```bash
135
+ # Check hook installation status
136
+ telemetry-agent hook-status
137
+
138
+ # Install or repair global hooks
139
+ telemetry-agent install-hook
140
+
141
+ # Uninstall hooks cleanly
142
+ telemetry-agent uninstall-hook
143
+ ```
144
+
145
+ ---
146
+
147
+ ## Running Tests
148
+
149
+ Run the full automated test suite:
150
+ ```bash
151
+ pytest tests -v
152
+ ```
153
+
154
+ ---
155
+
156
+ ## Building Distribution Packages
157
+
158
+ ```bash
159
+ # Clean previous artifacts and build package
160
+ python -m build
161
+
162
+ # Validate distributions
163
+ python -m twine check dist/*
164
+ ```
165
+
166
+ ---
167
+
168
+ ## Publishing Packages to PyPI / TestPyPI
169
+
170
+ Secure publishing is configured via local `.env` and `scripts/publish_pypi.py`:
171
+
172
+ 1. **Configure local `.env`** (ignored by Git, never committed):
173
+ ```env
174
+ TWINE_USERNAME=__token__
175
+ TWINE_PASSWORD=
176
+ ```
177
+ 2. **Build and validate package artifacts**:
178
+ ```bash
179
+ python -m build
180
+ python -m twine check dist/*
181
+ ```
182
+ 3. **Run pre-flight check (Dry Run)**:
183
+ ```bash
184
+ python scripts/publish_pypi.py --dry-run
185
+ ```
186
+ 4. **Publish**:
187
+ ```bash
188
+ # Production PyPI:
189
+ python scripts/publish_pypi.py
190
+
191
+ # TestPyPI:
192
+ python scripts/publish_pypi.py --repository-url https://test.pypi.org/legacy/
193
+ ```
194
+
@@ -0,0 +1,39 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "ai-telemetry-agent"
7
+ version = "0.1.1"
8
+ description = "Local developer telemetry agent for Antigravity AI usage and engineering signals"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ authors = [
12
+ { name = "Engineering Telemetry Team" }
13
+ ]
14
+ dependencies = []
15
+
16
+ [project.optional-dependencies]
17
+ dev = [
18
+ "pytest>=8.0.0",
19
+ "pytest-cov>=4.1.0",
20
+ "build>=1.0.0",
21
+ "twine>=5.0.0",
22
+ "python-dotenv>=1.0.0"
23
+ ]
24
+
25
+ [project.scripts]
26
+ telemetry-agent = "ai_telemetry_agent.cli:cli_entrypoint"
27
+
28
+ [tool.setuptools.packages.find]
29
+ where = ["src"]
30
+ include = ["ai_telemetry_agent*"]
31
+
32
+ [tool.setuptools.package-data]
33
+ ai_telemetry_agent = ["*.json", "integrations/hooks/*.json", "integrations/mcp_probe/*.md"]
34
+
35
+ [tool.pytest.ini_options]
36
+ testpaths = ["tests"]
37
+ python_files = ["test_*.py"]
38
+ pythonpath = ["src"]
39
+
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,24 @@
1
+ """AI Telemetry Agent - Local developer telemetry agent for AI usage and engineering signals."""
2
+
3
+ __version__ = "0.1.1"
4
+ __package_name__ = "ai-telemetry-agent"
5
+
6
+ from ai_telemetry_agent.config.settings import Settings, load_settings
7
+ from ai_telemetry_agent.core.collector import TelemetryCollector
8
+ from ai_telemetry_agent.core.event import TelemetryEvent, EventType
9
+ from ai_telemetry_agent.core.identity import DeveloperIdentity, get_identity, is_enrolled
10
+ from ai_telemetry_agent.storage.jsonl_store import JSONLEventStore
11
+
12
+ __all__ = [
13
+ "__version__",
14
+ "__package_name__",
15
+ "Settings",
16
+ "load_settings",
17
+ "TelemetryCollector",
18
+ "TelemetryEvent",
19
+ "EventType",
20
+ "DeveloperIdentity",
21
+ "get_identity",
22
+ "is_enrolled",
23
+ "JSONLEventStore",
24
+ ]
@@ -0,0 +1,6 @@
1
+ """Main execution entry point for ai_telemetry_agent package."""
2
+
3
+ from ai_telemetry_agent.cli import cli_entrypoint
4
+
5
+ if __name__ == "__main__":
6
+ cli_entrypoint()