deepctl-telemetry 0.0.5__tar.gz → 0.0.7__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepctl-telemetry
3
- Version: 0.0.5
3
+ Version: 0.0.7
4
4
  Summary: Opt-out phone-home telemetry for deepctl
5
5
  Author-email: Deepgram <devrel@deepgram.com>
6
6
  Maintainer-email: Deepgram <devrel@deepgram.com>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "deepctl-telemetry"
7
- version = "0.0.5" # x-release-please-version
7
+ version = "0.0.7" # x-release-please-version
8
8
  description = "Opt-out phone-home telemetry for deepctl"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -10,4 +10,4 @@ __all__ = [
10
10
  "render_notice",
11
11
  ]
12
12
 
13
- __version__ = "0.0.5" # x-release-please-version
13
+ __version__ = "0.0.7" # x-release-please-version
@@ -131,6 +131,25 @@ def _is_mcp_transient_noise(event: Event) -> bool:
131
131
  return True
132
132
 
133
133
 
134
+ def _is_broken_pipe(event: Event) -> bool:
135
+ """Identify events caused by writing to a closed/broken output stream.
136
+
137
+ When `dg mcp` runs as an MCP server, the host can close stdio while the
138
+ CLI is still finishing up. Any residual write (an advisory notification, a
139
+ console error message) then raises ``BrokenPipeError`` — or rich's
140
+ ``ValueError: I/O operation on closed file`` when the underlying stream is
141
+ already closed. Neither is an actionable CLI bug, so drop them rather than
142
+ page the DX team.
143
+ """
144
+ for exc in (event.get("exception") or {}).get("values") or []:
145
+ exc_type = exc.get("type") or ""
146
+ if exc_type == "BrokenPipeError":
147
+ return True
148
+ if exc_type == "ValueError" and "closed file" in (exc.get("value") or ""):
149
+ return True
150
+ return False
151
+
152
+
134
153
  def _scrub_event(event: Event, _hint: Hint) -> Event | None:
135
154
  """Drop request bodies, headers, and any user-identifying data.
136
155
 
@@ -138,9 +157,10 @@ def _scrub_event(event: Event, _hint: Hint) -> Event | None:
138
157
  Auth tokens, project IDs, and file paths can still leak through
139
158
  breadcrumbs and exception messages. This is a defense-in-depth scrub.
140
159
 
141
- Also drops known-noise events (see ``_is_mcp_transient_noise``).
160
+ Also drops known-noise events (see ``_is_mcp_transient_noise`` and
161
+ ``_is_broken_pipe``).
142
162
  """
143
- if _is_mcp_transient_noise(event):
163
+ if _is_mcp_transient_noise(event) or _is_broken_pipe(event):
144
164
  return None
145
165
 
146
166
  request: dict[str, Any] = event.get("request") or {}
@@ -10,9 +10,12 @@ if TYPE_CHECKING:
10
10
  from deepctl_core import Config
11
11
 
12
12
 
13
+ # There is no `dg config` command, so the notice names the two opt-outs that
14
+ # actually exist: the env var for one run, and the config file to persist it.
13
15
  NOTICE_ON = (
14
16
  "Telemetry is on (anonymous error reports). "
15
- "Disable: dg config set telemetry.enabled false"
17
+ "Disable: DEEPCTL_TELEMETRY_DISABLED=1, "
18
+ "or set telemetry.enabled: false in your deepctl config.yaml"
16
19
  )
17
20
  NOTICE_OFF = "Telemetry is off."
18
21
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepctl-telemetry
3
- Version: 0.0.5
3
+ Version: 0.0.7
4
4
  Summary: Opt-out phone-home telemetry for deepctl
5
5
  Author-email: Deepgram <devrel@deepgram.com>
6
6
  Maintainer-email: Deepgram <devrel@deepgram.com>