@latitude-data/openclaw-telemetry 0.0.2 → 0.0.4

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.
package/README.md CHANGED
@@ -4,22 +4,23 @@ OpenClaw plugin that streams every agent run to [Latitude](https://latitude.so)
4
4
 
5
5
  ## Install
6
6
 
7
+ Requires OpenClaw **2026.4.25 or newer** on PATH. Older versions are detected up-front and the installer aborts with an upgrade message.
8
+
7
9
  ```bash
8
10
  npx -y @latitude-data/openclaw-telemetry install
11
+ openclaw gateway restart
9
12
  ```
10
13
 
11
14
  The installer prompts for your Latitude API key and project slug, then:
12
15
 
13
- 1. Materializes the plugin's runtime files into `~/.openclaw/extensions/latitude-telemetry/` (where OpenClaw's plugin discovery scans).
14
- 2. Writes the plugin entry to `~/.openclaw/openclaw.json` under `plugins.entries["@latitude-data/openclaw-telemetry"].config` credentials, base URL, and the `allowConversationAccess` flag all live here.
15
-
16
- Restart the OpenClaw gateway after install:
17
-
18
- ```bash
19
- openclaw gateway restart
20
- ```
16
+ 1. Verifies your OpenClaw version (aborts on `< 2026.4.25`).
17
+ 2. Hands plugin placement to OpenClaw via `openclaw plugins install <package-path> --force`. OpenClaw copies files into `~/.openclaw/extensions/<id>/`, writes the install record to `~/.openclaw/plugins/installs.json`, and creates the `plugins.entries[id]` block.
18
+ 3. Layers our config on top in `~/.openclaw/openclaw.json`:
19
+ - **`config.*`** — credentials, baseUrl, and `allowConversationAccess` (the payload-content gate the plugin's runtime reads).
20
+ - **`hooks.allowConversationAccess`** — the dispatch gate OpenClaw's runtime checks before forwarding LLM/tool/agent events to non-bundled plugins. Always mirrored to the same value as `config.allowConversationAccess`.
21
+ 4. Adds the plugin id to `plugins.allow` (running `npx install` is the trust signal). Pass `--no-trust` to opt out.
21
22
 
22
- That's it. Traces show up at `https://console.latitude.so/projects/<your-slug>`.
23
+ Traces show up at `https://console.latitude.so/projects/<your-slug>` once the gateway restarts.
23
24
 
24
25
  ### Install flags
25
26
 
@@ -30,9 +31,10 @@ That's it. Traces show up at `https://console.latitude.so/projects/<your-slug>`.
30
31
  | `--staging` | Target `https://staging.latitude.so` / `https://staging-ingest.latitude.so`. |
31
32
  | `--dev` | Target `http://localhost:3000` / `http://localhost:3002`. |
32
33
  | `--yes` / `--no-prompt` | Skip all prompts. Required for non-TTY / CI invocations. |
33
- | `--no-content` | Skip raw prompt/response/tool I/O capture. Spans still emit with timing, token usage, model name, and ids. |
34
+ | `--no-content` | Skip raw prompt/response/tool I/O capture. Spans still emit with timing, token usage, model name, and ids. Mirrored into both `config.allowConversationAccess` and `hooks.allowConversationAccess`. |
35
+ | `--no-trust` | Skip auto-adding the plugin id to `plugins.allow`. OpenClaw will keep printing `plugins.allow is empty` warnings until you add it manually. |
34
36
 
35
- Re-running `install` is idempotent — existing values are preserved.
37
+ Re-running `install` is idempotent — credentials/baseUrl are overwritten from prompts, but hand-edited `enabled`, `debug`, and `allowConversationAccess` values in `openclaw.json` are preserved unless you pass the corresponding flag.
36
38
 
37
39
  ## Uninstall
38
40
 
@@ -40,7 +42,7 @@ Re-running `install` is idempotent — existing values are preserved.
40
42
  npx -y @latitude-data/openclaw-telemetry uninstall
41
43
  ```
42
44
 
43
- Shows a plan, asks for confirmation, then removes the plugin entry from `~/.openclaw/openclaw.json` and the materialized files at `~/.openclaw/extensions/latitude-telemetry/`. A backup of the settings file is saved at `openclaw.json.latitude-bak`.
45
+ Shows a plan, asks for confirmation, then runs `openclaw plugins uninstall @latitude-data/openclaw-telemetry --force` (which removes files, the install record, the plugin entry, and the `plugins.allow` entry). Defensive cleanup follows for any leftover keys, with a backup at `openclaw.json.latitude-bak`.
44
46
 
45
47
  ## What gets sent
46
48
 
@@ -70,36 +72,59 @@ OpenClaw runs LLM hooks **fire-and-forget** (see [`src/plugins/hooks.ts`](https:
70
72
 
71
73
  ## Configuration reference
72
74
 
73
- The installer writes the plugin entry under `plugins.entries[id].config`. Every key is optional except `apiKey` and `project`. You can hand-edit `~/.openclaw/openclaw.json` to tweak:
75
+ The installer writes two blocks to `plugins.entries["@latitude-data/openclaw-telemetry"]`:
74
76
 
75
- ### `plugins.entries["@latitude-data/openclaw-telemetry"].config`
77
+ ### `.config` — read by the plugin's runtime
76
78
 
77
79
  | Key | Required | Default | Description |
78
80
  | --- | --- | --- | --- |
79
81
  | `apiKey` | yes | — | Bearer token for Latitude ingestion. |
80
82
  | `project` | yes | — | Slug of the project to route traces into. |
81
83
  | `baseUrl` | no | `https://ingest.latitude.so` | Override OTLP ingest origin. Installer sets this only when you pass `--staging` or `--dev`. |
82
- | `allowConversationAccess` | no | `false` | When `true`, attach raw prompts, assistant responses, system instructions, and tool I/O to spans. When `false`, emit only timing, token usage, model name, agent id, and structural ids — same span tree, scrubbed payloads. |
84
+ | `allowConversationAccess` | no | `false` | When `true`, attach raw prompts, assistant responses, system instructions, and tool I/O to spans. When `false`, emit only timing, token usage, model name, agent id, and structural ids — same span tree, scrubbed payloads. **Must match `hooks.allowConversationAccess` below — see "the two flags".** |
83
85
  | `enabled` | no | `true` | Set to `false` to pause emission without uninstalling. |
84
86
  | `debug` | no | `false` | Log diagnostic lines to stderr (visible in the gateway log). |
85
87
 
88
+ ### `.hooks` — read by OpenClaw's runtime
89
+
90
+ | Key | Required | Default | Description |
91
+ | --- | --- | --- | --- |
92
+ | `allowConversationAccess` | yes (on 2026.4.25+) | — | OpenClaw's hook dispatcher gates `llm_input` / `llm_output` / `before_tool_call` / `after_tool_call` / `agent_end` events on this. When `false` or absent, every typed hook is blocked and the plugin never sees an event — which means no traces, with the gateway log showing `[plugins] typed hook "..." blocked because non-bundled plugins must set plugins.entries.<id>.hooks.allowConversationAccess=true`. |
93
+
94
+ ### The two flags
95
+
96
+ `hooks.allowConversationAccess` and `config.allowConversationAccess` mean different things:
97
+
98
+ - **`hooks.*`** is the **dispatch gate**. `false` → OpenClaw never forwards events to us. No traces.
99
+ - **`config.*`** is the **payload-content gate**. `false` → we emit spans normally but scrub message content from them. Structural-only telemetry.
100
+
101
+ For *this* plugin, we always couple them — the installer writes both from the same source. If you hand-edit, set them to the same value:
102
+
103
+ - **Both `true`**: full content capture (the default).
104
+ - **Both `false`**: structural-only telemetry (set via `--no-content`).
105
+ - Anything else is incoherent: `hooks: false + config: true` means dispatch is off and content gating is moot; `hooks: true + config: false` works but is what you'd get with both `false` plus extra ceremony.
106
+
86
107
  ### Environment variable fallbacks
87
108
 
88
- If a key isn't set in `config`, the runtime falls back to environment variables on the gateway process. `LATITUDE_API_KEY`, `LATITUDE_PROJECT`, `LATITUDE_BASE_URL`, `LATITUDE_DEBUG`, and `LATITUDE_OPENCLAW_ENABLED` are all read this way. The installer doesn't set them — pluginConfig is the canonical surface — but they're useful for kicking debug on/off without editing `openclaw.json`.
109
+ If a `config.*` key isn't set, the runtime falls back to env vars on the gateway process: `LATITUDE_API_KEY`, `LATITUDE_PROJECT`, `LATITUDE_BASE_URL`, `LATITUDE_DEBUG`, `LATITUDE_OPENCLAW_ENABLED`. The installer doesn't set them — pluginConfig is the canonical surface — but they're useful for flipping `debug` without editing `openclaw.json`.
89
110
 
90
111
  ### Manual installation
91
112
 
92
- If the installer doesn't fit your setup, you need two things:
113
+ If you can't run the installer, do exactly what it does:
93
114
 
94
- 1. **The plugin files** under a directory OpenClaw discovers (`~/.openclaw/extensions/<name>/` or any path listed in `plugins.load.paths`). The directory must contain at minimum `openclaw.plugin.json` and the compiled `dist/plugin.js`. Easiest: copy them out of the installed `node_modules/@latitude-data/openclaw-telemetry/`.
95
- 2. **The plugin entry** in `~/.openclaw/openclaw.json`:
115
+ 1. **Hand placement to OpenClaw** with `openclaw plugins install <path-to-extracted-package> --force`. This is what populates `~/.openclaw/extensions/`, writes the install record, and creates the (initially empty) `plugins.entries[id]` block. Don't hand-place files into the extensions directory the persisted plugin index won't see them.
116
+ 2. **Add the config + hooks block** to `~/.openclaw/openclaw.json`:
96
117
 
97
118
  ```jsonc
98
119
  {
99
120
  "plugins": {
121
+ "allow": ["@latitude-data/openclaw-telemetry"],
100
122
  "entries": {
101
123
  "@latitude-data/openclaw-telemetry": {
102
124
  "enabled": true,
125
+ "hooks": {
126
+ "allowConversationAccess": true
127
+ },
103
128
  "config": {
104
129
  "apiKey": "lat_xxx",
105
130
  "project": "my-openclaw-project",
@@ -111,21 +136,24 @@ If the installer doesn't fit your setup, you need two things:
111
136
  }
112
137
  ```
113
138
 
114
- Don't put `LATITUDE_*` keys at top-level `env`OpenClaw's strict zod schema rejects them. Don't put `allowConversationAccess` under `hooks` either — that field is OpenClaw's strict reserved namespace and only accepts `allowPromptInjection` (older versions) or `allowPromptInjection` + `allowConversationAccess` (2026.4.22+). Our config bucket is `plugins.entries[id].config`, which is `record(string, unknown)` and accepted across all versions.
115
-
116
- After editing, run `openclaw config validate` — it should print `valid: true`. Then `openclaw gateway restart`.
139
+ Run `openclaw config validate` — should print `valid: true`. Then `openclaw gateway restart`.
117
140
 
118
141
  ## Privacy
119
142
 
120
- By default we emit **structural telemetry only** span tree, timings, token usage, model name, agent name, run/session ids — but **no prompt or response content**. You opt in to content capture by setting `allowConversationAccess: true` (the default the interactive installer writes).
143
+ There are two defaults at playkeep them straight:
144
+
145
+ - **Installer default**: when you run `npx -y @latitude-data/openclaw-telemetry install` without `--no-content`, the installer writes `allowConversationAccess: true` to both the `hooks` and `config` blocks. **You get full content capture** — prompts, assistant responses, system instructions, tool I/O — shipped to Latitude alongside structural telemetry.
146
+ - **Runtime default for absent keys**: if you hand-write `openclaw.json` and leave `allowConversationAccess` out entirely, `config.allowConversationAccess` falls back to `false` at the plugin's runtime (privacy-preserving) and `hooks.allowConversationAccess` falls back to OpenClaw's default (also `false`, which means dispatch is blocked and you get nothing). **Manual installs without those keys produce no traces, not "structural-only traces".**
147
+
148
+ The installer always writes both keys to the same value, so the installer-driven path is unambiguous. The runtime-default trap only matters for hand-rolled configs.
121
149
 
122
- When `allowConversationAccess` is on, every LLM call's full input messages, assistant output, system instructions, and tool I/O are attached to spans. Pass `--no-content` to the installer (or set the flag to `false` in `openclaw.json`) if you want telemetry without payloads.
150
+ When you pass `--no-content` (or hand-edit both flags to `false`), we emit the same span tree but scrub the content attributes (`gen_ai.input.messages`, `gen_ai.output.messages`, `gen_ai.system_instructions`, `gen_ai.tool.call.arguments`/`result`, the interaction's `user_prompt`). Timings, token usage, model name, agent name, ids, and the `latitude.captured.content: false` boolean still flow.
123
151
 
124
- To pause emission entirely without uninstalling, set `LATITUDE_OPENCLAW_ENABLED=0` in the gateway environment.
152
+ To pause emission entirely without uninstalling, set `LATITUDE_OPENCLAW_ENABLED=0` in the gateway environment, or set `enabled: false` on the plugin entry in `openclaw.json`.
125
153
 
126
154
  ## Supported OpenClaw versions
127
155
 
128
- Requires OpenClaw **2026.3.0+** for the `llm_input` / `llm_output` hooks. Older versions lack these hooks and would only surface metadata via `model.usage` diagnostics not enough for full trace fidelity.
156
+ Requires OpenClaw **2026.4.25 or newer**. The installer detects the version up-front via `openclaw --version` and aborts with an upgrade message on older versions supporting the full range with portability shims would mean shipping known-broken behaviour (≤ 2026.4.21 reject `hooks.allowConversationAccess` outright; 2026.4.22 2026.4.24 have unverified dispatch gating). Run `npm install -g openclaw@latest` to upgrade.
129
157
 
130
158
  ## How it fails
131
159