@latitude-data/openclaw-telemetry-cli 0.0.7
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/LICENSE +157 -0
- package/README.md +149 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +1052 -0
- package/dist/cli.js.map +1 -0
- package/package.json +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
|
|
3
|
+
Version 3, 29 June 2007
|
|
4
|
+
|
|
5
|
+
Copyright (C) 2007 Free Software Foundation, Inc.
|
|
6
|
+
<https://fsf.org/>
|
|
7
|
+
|
|
8
|
+
Everyone is permitted to copy and distribute verbatim copies of this
|
|
9
|
+
license document, but changing it is not allowed.
|
|
10
|
+
|
|
11
|
+
This version of the GNU Lesser General Public License incorporates the
|
|
12
|
+
terms and conditions of version 3 of the GNU General Public License,
|
|
13
|
+
supplemented by the additional permissions listed below.
|
|
14
|
+
|
|
15
|
+
## 0. Additional Definitions.
|
|
16
|
+
|
|
17
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
18
|
+
General Public License, and the "GNU GPL" refers to version 3 of the
|
|
19
|
+
GNU General Public License.
|
|
20
|
+
|
|
21
|
+
"The Library" refers to a covered work governed by this License, other
|
|
22
|
+
than an Application or a Combined Work as defined below.
|
|
23
|
+
|
|
24
|
+
An "Application" is any work that makes use of an interface provided
|
|
25
|
+
by the Library, but which is not otherwise based on the Library.
|
|
26
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
27
|
+
of using an interface provided by the Library.
|
|
28
|
+
|
|
29
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
30
|
+
Application with the Library. The particular version of the Library
|
|
31
|
+
with which the Combined Work was made is also called the "Linked
|
|
32
|
+
Version".
|
|
33
|
+
|
|
34
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
35
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
36
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
37
|
+
based on the Application, and not on the Linked Version.
|
|
38
|
+
|
|
39
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
40
|
+
object code and/or source code for the Application, including any data
|
|
41
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
42
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
43
|
+
|
|
44
|
+
## 1. Exception to Section 3 of the GNU GPL.
|
|
45
|
+
|
|
46
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
47
|
+
without being bound by section 3 of the GNU GPL.
|
|
48
|
+
|
|
49
|
+
## 2. Conveying Modified Versions.
|
|
50
|
+
|
|
51
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
52
|
+
facility refers to a function or data to be supplied by an Application
|
|
53
|
+
that uses the facility (other than as an argument passed when the
|
|
54
|
+
facility is invoked), then you may convey a copy of the modified
|
|
55
|
+
version:
|
|
56
|
+
|
|
57
|
+
- a) under this License, provided that you make a good faith effort
|
|
58
|
+
to ensure that, in the event an Application does not supply the
|
|
59
|
+
function or data, the facility still operates, and performs
|
|
60
|
+
whatever part of its purpose remains meaningful, or
|
|
61
|
+
- b) under the GNU GPL, with none of the additional permissions of
|
|
62
|
+
this License applicable to that copy.
|
|
63
|
+
|
|
64
|
+
## 3. Object Code Incorporating Material from Library Header Files.
|
|
65
|
+
|
|
66
|
+
The object code form of an Application may incorporate material from a
|
|
67
|
+
header file that is part of the Library. You may convey such object
|
|
68
|
+
code under terms of your choice, provided that, if the incorporated
|
|
69
|
+
material is not limited to numerical parameters, data structure
|
|
70
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
71
|
+
(ten or fewer lines in length), you do both of the following:
|
|
72
|
+
|
|
73
|
+
- a) Give prominent notice with each copy of the object code that
|
|
74
|
+
the Library is used in it and that the Library and its use are
|
|
75
|
+
covered by this License.
|
|
76
|
+
- b) Accompany the object code with a copy of the GNU GPL and this
|
|
77
|
+
license document.
|
|
78
|
+
|
|
79
|
+
## 4. Combined Works.
|
|
80
|
+
|
|
81
|
+
You may convey a Combined Work under terms of your choice that, taken
|
|
82
|
+
together, effectively do not restrict modification of the portions of
|
|
83
|
+
the Library contained in the Combined Work and reverse engineering for
|
|
84
|
+
debugging such modifications, if you also do each of the following:
|
|
85
|
+
|
|
86
|
+
- a) Give prominent notice with each copy of the Combined Work that
|
|
87
|
+
the Library is used in it and that the Library and its use are
|
|
88
|
+
covered by this License.
|
|
89
|
+
- b) Accompany the Combined Work with a copy of the GNU GPL and this
|
|
90
|
+
license document.
|
|
91
|
+
- c) For a Combined Work that displays copyright notices during
|
|
92
|
+
execution, include the copyright notice for the Library among
|
|
93
|
+
these notices, as well as a reference directing the user to the
|
|
94
|
+
copies of the GNU GPL and this license document.
|
|
95
|
+
- d) Do one of the following:
|
|
96
|
+
- 0) Convey the Minimal Corresponding Source under the terms of
|
|
97
|
+
this License, and the Corresponding Application Code in a form
|
|
98
|
+
suitable for, and under terms that permit, the user to
|
|
99
|
+
recombine or relink the Application with a modified version of
|
|
100
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
101
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
102
|
+
Corresponding Source.
|
|
103
|
+
- 1) Use a suitable shared library mechanism for linking with
|
|
104
|
+
the Library. A suitable mechanism is one that (a) uses at run
|
|
105
|
+
time a copy of the Library already present on the user's
|
|
106
|
+
computer system, and (b) will operate properly with a modified
|
|
107
|
+
version of the Library that is interface-compatible with the
|
|
108
|
+
Linked Version.
|
|
109
|
+
- e) Provide Installation Information, but only if you would
|
|
110
|
+
otherwise be required to provide such information under section 6
|
|
111
|
+
of the GNU GPL, and only to the extent that such information is
|
|
112
|
+
necessary to install and execute a modified version of the
|
|
113
|
+
Combined Work produced by recombining or relinking the Application
|
|
114
|
+
with a modified version of the Linked Version. (If you use option
|
|
115
|
+
4d0, the Installation Information must accompany the Minimal
|
|
116
|
+
Corresponding Source and Corresponding Application Code. If you
|
|
117
|
+
use option 4d1, you must provide the Installation Information in
|
|
118
|
+
the manner specified by section 6 of the GNU GPL for conveying
|
|
119
|
+
Corresponding Source.)
|
|
120
|
+
|
|
121
|
+
## 5. Combined Libraries.
|
|
122
|
+
|
|
123
|
+
You may place library facilities that are a work based on the Library
|
|
124
|
+
side by side in a single library together with other library
|
|
125
|
+
facilities that are not Applications and are not covered by this
|
|
126
|
+
License, and convey such a combined library under terms of your
|
|
127
|
+
choice, if you do both of the following:
|
|
128
|
+
|
|
129
|
+
- a) Accompany the combined library with a copy of the same work
|
|
130
|
+
based on the Library, uncombined with any other library
|
|
131
|
+
facilities, conveyed under the terms of this License.
|
|
132
|
+
- b) Give prominent notice with the combined library that part of it
|
|
133
|
+
is a work based on the Library, and explaining where to find the
|
|
134
|
+
accompanying uncombined form of the same work.
|
|
135
|
+
|
|
136
|
+
## 6. Revised Versions of the GNU Lesser General Public License.
|
|
137
|
+
|
|
138
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
139
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
140
|
+
versions will be similar in spirit to the present version, but may
|
|
141
|
+
differ in detail to address new problems or concerns.
|
|
142
|
+
|
|
143
|
+
Each version is given a distinguishing version number. If the Library
|
|
144
|
+
as you received it specifies that a certain numbered version of the
|
|
145
|
+
GNU Lesser General Public License "or any later version" applies to
|
|
146
|
+
it, you have the option of following the terms and conditions either
|
|
147
|
+
of that published version or of any later version published by the
|
|
148
|
+
Free Software Foundation. If the Library as you received it does not
|
|
149
|
+
specify a version number of the GNU Lesser General Public License, you
|
|
150
|
+
may choose any version of the GNU Lesser General Public License ever
|
|
151
|
+
published by the Free Software Foundation.
|
|
152
|
+
|
|
153
|
+
If the Library as you received it specifies that a proxy can decide
|
|
154
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
155
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
156
|
+
permanent authorization for you to choose that version for the
|
|
157
|
+
Library.
|
package/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# @latitude-data/openclaw-telemetry-cli
|
|
2
|
+
|
|
3
|
+
One-shot installer for the [`@latitude-data/openclaw-telemetry`](https://github.com/latitude-dev/latitude-llm/tree/main/packages/telemetry/openclaw#readme) OpenClaw plugin. Wraps `openclaw plugins install` + the manual `openclaw config set` flow into a single `npx -y` command, with TTY prompts, CI flags, dry-run, custom config dir, upgrade detection, and the gateway restart.
|
|
4
|
+
|
|
5
|
+
For details on the plugin runtime itself — what it sends, the span tree, and the manual install flow — see the [runtime README](https://github.com/latitude-dev/latitude-llm/tree/main/packages/telemetry/openclaw#readme).
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- **OpenClaw 2026.4.25 or newer** on PATH.
|
|
10
|
+
- A **Latitude API key** and **project slug** — both from [console.latitude.so/settings/api-keys](https://console.latitude.so/settings/api-keys).
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
Interactive (recommended for first-time setup):
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npx -y @latitude-data/openclaw-telemetry-cli@0.0.7 install
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The CLI prompts for your API key and project slug, installs the plugin, writes the config, validates it, and offers to restart the gateway.
|
|
21
|
+
|
|
22
|
+
Non-interactive / CI:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx -y @latitude-data/openclaw-telemetry-cli@0.0.7 install \
|
|
26
|
+
--api-key="$LATITUDE_API_KEY" \
|
|
27
|
+
--project=my-project \
|
|
28
|
+
--yes \
|
|
29
|
+
--no-restart
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
`--yes` skips all prompts (required when you can't type into a TTY); `--no-restart` keeps the gateway running so you can finish other config first.
|
|
33
|
+
|
|
34
|
+
## What the CLI does
|
|
35
|
+
|
|
36
|
+
In order, on every install:
|
|
37
|
+
|
|
38
|
+
1. **Verifies your OpenClaw version** (`openclaw --version` ≥ 2026.4.25). Aborts with an upgrade message on older versions.
|
|
39
|
+
2. **Verifies the runtime contract** — that `@latitude-data/openclaw-telemetry@0.0.7` exists on npm. (Catches half-published releases.)
|
|
40
|
+
3. **Detects any prior install** via `<configDir>/plugins/installs.json`. Renders `Upgrading 0.0.6 → 0.0.7` (or `Re-applying 0.0.7 (idempotent)`) if found.
|
|
41
|
+
4. **Prompts for your API key and project slug** — interactive only; flags / `--yes` skip the prompts.
|
|
42
|
+
5. **Backs up `openclaw.json`** to `openclaw.json.latitude-bak` before any change.
|
|
43
|
+
6. **Runs `openclaw plugins install @latitude-data/openclaw-telemetry@0.0.7 --force`** — npm fetch, security scan, extension placement, install record, disabled `plugins.entries[id]`.
|
|
44
|
+
7. **Writes the plugin config** atomically (temp + rename): `apiKey`, `project`, `baseUrl` (only if `--staging` / `--dev`), `config.allowConversationAccess` AND `hooks.allowConversationAccess` (always coupled — both `true` by default; `--no-content` to emit structural-only telemetry).
|
|
45
|
+
8. **Adds the plugin id to `plugins.allow`** to silence OpenClaw's "untracked code" warning. Pass `--no-trust` to opt out.
|
|
46
|
+
9. **Validates** the result with `openclaw config validate --json`. If it fails, restores the backup and aborts with the validator's message.
|
|
47
|
+
10. **Restarts the gateway**. Default: prompts on TTY, skips non-TTY (with manual instructions). `--restart` always restarts; `--no-restart` always skips.
|
|
48
|
+
|
|
49
|
+
## Flags
|
|
50
|
+
|
|
51
|
+
| Flag | Effect |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| `--api-key=<key>` | Pass the API key non-interactively. |
|
|
54
|
+
| `--project=<slug>` | Pass the project slug non-interactively. |
|
|
55
|
+
| `--staging` | Target `https://staging.latitude.so` / `https://staging-ingest.latitude.so`. |
|
|
56
|
+
| `--dev` | Target `http://localhost:3000` / `http://localhost:3002`. |
|
|
57
|
+
| `--no-content` | Disable conversation capture (still emits structural-only telemetry — timing, tokens, ids). Mirrored into both `config.allowConversationAccess` and `hooks.allowConversationAccess`. |
|
|
58
|
+
| `--allow-conversation` | Force conversation capture on (overrides existing config). |
|
|
59
|
+
| `--no-trust` | Skip auto-adding the plugin id to `plugins.allow`. |
|
|
60
|
+
| `--openclaw-dir=<path>` | Override the OpenClaw config directory. See [Custom config directory](#custom-config-directory). |
|
|
61
|
+
| `--dry-run` | Preview every change without touching the filesystem or spawning subprocesses. See [Dry run](#dry-run). |
|
|
62
|
+
| `--restart` | Always restart the gateway, even non-TTY. CI escape hatch for "do everything". |
|
|
63
|
+
| `--no-restart` | Never restart the gateway, even on TTY. Always wins over `--restart`. |
|
|
64
|
+
| `--yes` / `--no-prompt` | Skip all prompts. Required when running non-TTY without supplying `--api-key` / `--project`. |
|
|
65
|
+
| `--version`, `-v` | Print the CLI version and exit. |
|
|
66
|
+
| `--help`, `-h` | Print usage. |
|
|
67
|
+
|
|
68
|
+
## Modes
|
|
69
|
+
|
|
70
|
+
### Dry run
|
|
71
|
+
|
|
72
|
+
Preview every change without touching the filesystem or spawning subprocesses:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npx -y @latitude-data/openclaw-telemetry-cli@0.0.7 install --dry-run \
|
|
76
|
+
--api-key=lat_xxx --project=my-project
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Output includes the resolved config dir, the exact `openclaw plugins install` command we'd spawn, and a unified-ish JSON diff between the current `openclaw.json` and the proposed result. Useful for reviewing changes before applying them, or for verifying flag behaviour in CI.
|
|
80
|
+
|
|
81
|
+
### Custom config directory
|
|
82
|
+
|
|
83
|
+
The CLI resolves the OpenClaw config directory in this order, stopping at the first match:
|
|
84
|
+
|
|
85
|
+
1. **`--openclaw-dir=<path>`** flag (absolute, or relative to cwd; the space-separated form `--openclaw-dir <path>` works too).
|
|
86
|
+
2. **`OPENCLAW_HOME`** env var (absolute, or relative to cwd).
|
|
87
|
+
3. **`./openclaw.json`** in the current working directory → use cwd.
|
|
88
|
+
4. **`~/.openclaw`** (default).
|
|
89
|
+
|
|
90
|
+
The resolved path is printed at install start. The CLI passes `OPENCLAW_HOME=<resolved>` to every spawned `openclaw` subprocess, so the runtime side picks up the same dir.
|
|
91
|
+
|
|
92
|
+
> **Caveat.** OpenClaw's CLI may not honor `OPENCLAW_HOME` directly. When that happens, the runtime side may write the install record into `~/.openclaw/`, while we write `openclaw.json` to the custom dir. The post-install `openclaw config validate --json` step catches this — validation fails because the entry is in a different file from the install record, the backup is restored, and the CLI aborts with both paths in the error. **No silent two-place writes.**
|
|
93
|
+
|
|
94
|
+
### Structural-only telemetry
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
npx -y @latitude-data/openclaw-telemetry-cli@0.0.7 install --no-content \
|
|
98
|
+
--api-key=lat_xxx --project=my-project
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The plugin still emits the full span tree — timings, token usage, model name, agent name, ids — just with content attributes (`gen_ai.input.messages`, `gen_ai.output.messages`, `gen_ai.system_instructions`, tool args/results) scrubbed. Each span carries `latitude.captured.content: false` so the gate state is visible in the Latitude UI.
|
|
102
|
+
|
|
103
|
+
### Targeting staging or local dev
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# Staging
|
|
107
|
+
npx -y @latitude-data/openclaw-telemetry-cli@0.0.7 install --staging --yes \
|
|
108
|
+
--api-key=lat_xxx --project=my-project
|
|
109
|
+
|
|
110
|
+
# Local dev
|
|
111
|
+
npx -y @latitude-data/openclaw-telemetry-cli@0.0.7 install --dev --yes \
|
|
112
|
+
--api-key=lat_xxx --project=my-project
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`--staging` writes `baseUrl: https://staging-ingest.latitude.so`; `--dev` writes `baseUrl: http://localhost:3002`. Without either flag, the runtime defaults to production (`https://ingest.latitude.so`).
|
|
116
|
+
|
|
117
|
+
## Uninstall
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
npx -y @latitude-data/openclaw-telemetry-cli@0.0.7 uninstall
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
The uninstall flow:
|
|
124
|
+
|
|
125
|
+
1. Confirms with the operator (TTY only — pass `--yes` to skip).
|
|
126
|
+
2. Backs up `openclaw.json` to `openclaw.json.latitude-bak`.
|
|
127
|
+
3. Runs `openclaw plugins uninstall @latitude-data/openclaw-telemetry --force`. OpenClaw removes the extension files, the install record, `plugins.entries[id]`, and the `plugins.allow` entry.
|
|
128
|
+
4. Defensive cleanup of any lingering state in `openclaw.json` (idempotent — safe to re-run).
|
|
129
|
+
5. Restart prompt (same TTY-vs-CI logic as install; `--restart` / `--no-restart` override).
|
|
130
|
+
|
|
131
|
+
The backup at `openclaw.json.latitude-bak` is kept after uninstall — delete it manually when you don't need it anymore.
|
|
132
|
+
|
|
133
|
+
## Lockstep policy
|
|
134
|
+
|
|
135
|
+
This CLI installs **exactly** `@latitude-data/openclaw-telemetry@0.0.7` (pinned in source as `RUNTIME_VERSION`). Every CLI release is paired with a runtime release of the same version number; bumping the runtime requires bumping the CLI in the same commit and re-publishing both.
|
|
136
|
+
|
|
137
|
+
If npm doesn't have the exact pinned version (half-published release), the CLI aborts with `Upgrade the CLI: npm install -g @latitude-data/openclaw-telemetry-cli@latest`.
|
|
138
|
+
|
|
139
|
+
Pinning to an exact version also satisfies OpenClaw's `Pin install specs to exact versions` supply-chain audit warning automatically.
|
|
140
|
+
|
|
141
|
+
## Why this is a separate package
|
|
142
|
+
|
|
143
|
+
OpenClaw 2026.4.25+ runs an install-time security scan on `openclaw plugins install` (`plugins.code_safety`, looking for `dangerous-exec` / `env-harvesting` patterns). This CLI uses `child_process.spawn` to invoke OpenClaw — a `dangerous-exec` flag. Keeping the CLI in a **separate npm package** that's installed via `npx` / `npm install -g` rather than `openclaw plugins install` means the CLI never goes through OpenClaw's scanner. The runtime plugin ([`@latitude-data/openclaw-telemetry`](https://github.com/latitude-dev/latitude-llm/tree/main/packages/telemetry/openclaw)) is installed by this CLI on the operator's behalf and is itself scanner-clean (no `child_process`, no `node:fs` runtime reads).
|
|
144
|
+
|
|
145
|
+
See the [runtime CHANGELOG](https://github.com/latitude-dev/latitude-llm/blob/main/packages/telemetry/openclaw/CHANGELOG.md) for the wider history of the split.
|
|
146
|
+
|
|
147
|
+
## License
|
|
148
|
+
|
|
149
|
+
MIT
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|