# dsh-codetime bundle patch — the `dsh.bundle.patch` layer of the published
# package. Verified against dsh 0.2.0-rc.2.
#
# Installing the plugin through the official CLI:
#
#   dsh plugin --profile <name> add dsh-codetime
#
# reconciles the profile's `dsh.profile.bundles` against its installed
# packages; seeing the `dsh.bundle` declaration in package.json it appends
# `dsh-codetime` to the bundle stack, and the profile boot merges THIS file
# exactly like a manual `cordis.patch.yml` mount line. The same rows can still
# be merged by hand into a profile's own `cordis.patch.yml`.
#
# The `sessionTelemetry` service is a process-global singleton: exactly ONE
# telemetry backend may register it. The base bundle mounts
# `session-telemetry-otel` (its FEEDBACK_ONLY default still registers the
# Service), so it MUST be disabled before `session-telemetry-codetime` mounts —
# otherwise the second registration throws at boot. This layer sits after
# `@deepseek-ai/dsh-base` in the bundle stack, so the override lands on top.
#
# Token resolution (first match wins):
#   1. `token:` config below
#   2. `CODETIME_TOKEN` environment variable
#   3. `token` field of `~/.codetime/config.json` (written by the codetime CLI
#      and the Zed / VS Code extensions)
# API base URL defaults to `https://codetime.dev`, overridable with
# `apiUrl:` below or the `CODETIME_API_URL` environment variable.
- id: session-telemetry-otel
  disabled: true

- insert:
    - id: session-telemetry-codetime
      name: 'dsh-codetime'
      config:
        # FULL: capture every session event live. DISABLED: report nothing.
        # FEEDBACK_ONLY: hand over the whole session log only once a
        # `/feedback` record is saved. Any other value aborts the boot.
        mode: !!js process.env.CODETIME_MODE || 'FULL'
        apiUrl: !!js process.env.CODETIME_API_URL || 'https://codetime.dev'
        flushIntervalMs: 60000
        shutdownTimeoutMs: 5000

