@openlatch/client 0.1.14 → 0.1.18

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 (2) hide show
  1. package/README.md +123 -43
  2. package/package.json +7 -7
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- <img src="https://raw.githubusercontent.com/OpenLatch/openlatch-client/main/assets/banner.jpg" alt="OpenLatch — Security infrastructure for AI agents" width="600" />
2
+ <img src="https://raw.githubusercontent.com/OpenLatch/openlatch-client/main/assets/banner.jpg" alt="OpenLatch — runtime enforcement node for the AI Operations Platform" width="600" />
3
3
  </p>
4
4
 
5
5
  <h3 align="center">See what your agent does. Block what it shouldn't.</h3>
@@ -15,13 +15,13 @@
15
15
 
16
16
  ---
17
17
 
18
- **OpenLatch** is a thin, open-source security forwarder that plugs into AI agents via their **native lifecycle hooks**. One command installs protection across all your agents — no proxies, no code changes, no configuration.
18
+ **OpenLatch** is the open-source **runtime enforcement node** for the [OpenLatch AI Operations Platform](https://openlatch.ai). It plugs into AI agents via their **native lifecycle hooks** — capturing every action inside the agent's own lifecycle and positioned to enforce policy deterministically before an action executes. One command installs it across all your agents — no code changes, no configuration.
19
19
 
20
20
  ```bash
21
21
  npx @openlatch/client init
22
22
  ```
23
23
 
24
- That's it. `init` auto-detects your installed agents, writes the hook configs, and starts the daemon that forwards events to the cloud for real-time security analysis.
24
+ That's it. `init` auto-detects your installed agents, writes the hook configs, and starts the daemon that captures agent activity and forwards it to the OpenLatch control plane.
25
25
 
26
26
  <!-- TODO: Replace with VHS terminal recording once available -->
27
27
  <!-- <p align="center">
@@ -35,28 +35,36 @@ AI agents execute shell commands, read files, call APIs, and install tools — a
35
35
  OpenLatch gives you:
36
36
 
37
37
  - **Visibility** — audit logs of every tool call, shell command, and file access across all your agents
38
- - **Protection** — real-time detection of tool poisoning, credential leakage, prompt injection, and dangerous shell commands
39
- - **Zero friction** — deploys from inside your agent in one command, auto-detects platforms, requires no security expertise
38
+ - **Control** — actions run through the agent's own lifecycle, the point where OpenLatch is positioned to enforce policy deterministically before they execute
39
+ - **Zero friction** — deploys from inside your agent in one command, auto-detects platforms, no code changes
40
40
 
41
- ## Supported Platforms
41
+ ## Supported Agents
42
42
 
43
- OpenLatch works across **3 operating systems** and **8 agent platforms** from day one.
43
+ OpenLatch attaches in three flavors, one per class of agent:
44
44
 
45
- | Agent Platform | macOS | Windows | Linux | Hook Events |
46
- | -------------- | :---: | :-----: | :---: | ----------: |
47
- | Claude Code | :white_check_mark: | :white_check_mark: | :white_check_mark: | 24 |
48
- | Cursor | :white_check_mark: | :white_check_mark: | :white_check_mark: | 5 |
49
- | Windsurf | :white_check_mark: | :white_check_mark: | :white_check_mark: | 5 |
50
- | GitHub Copilot | :white_check_mark: | :white_check_mark: | :white_check_mark: | 6 |
51
- | Codex CLI | :white_check_mark: | :white_check_mark: | :white_check_mark: | 4 |
52
- | Gemini CLI | :white_check_mark: | :white_check_mark: | :white_check_mark: | 4 |
53
- | Cline | :white_check_mark: | :white_check_mark: | :white_check_mark: | 4 |
54
- | OpenClaw | :white_check_mark: | :white_check_mark: | :white_check_mark: | 4 |
45
+ | Flavor | Agents | How it attaches | Status |
46
+ | ------ | ------ | --------------- | ------ |
47
+ | Coding agents | Claude Code | Native lifecycle hooks | **Shipping** |
48
+ | Coding agents | Cursor, Windsurf, GitHub Copilot, Codex CLI, Gemini CLI, Cline, OpenClaw | Native lifecycle hooks | Planned |
49
+ | Cloud agent platforms | Azure AI Foundry, AWS Bedrock | SDK + tool/MCP gate | Planned |
50
+ | Agentic Python frameworks | LangChain / LangGraph-class | Framework middleware | Planned |
55
51
 
56
- ## Threat Coverage
52
+ Claude Code is the only integration that attaches today, across **macOS, Windows, and Linux**. It is the reference implementation the remaining coding agents will follow.
57
53
 
58
- | Threat Category | What it catches |
59
- | --------------- | --------------- |
54
+ | Coding Agent | macOS | Windows | Linux | Hook Events |
55
+ | ------------ | :---: | :-----: | :---: | ----------: |
56
+ | Claude Code | :white_check_mark: | :white_check_mark: | :white_check_mark: | 12 |
57
+
58
+ Nine runtime lifecycle events — `PreToolUse`, `PostToolUse`, `UserPromptSubmit`, `Notification`, `Stop`, `SubagentStop`, `PreCompact`, `SessionStart`, `SessionEnd` — plus three configuration-plane events, `ConfigChange`, `InstructionsLoaded` and `FileChanged`, which the daemon dedupes against its own filesystem watcher.
59
+
60
+ The other coding agents are recognized as envelope `agent_type` values, so events forwarded on their behalf are stored and attributed correctly — but `openlatch init` cannot yet install their hooks, and `openlatch doctor` reports them as `not_supported_in_v1`. Adding one means a new `AgentBinding` in `src/hooks/bindings/` plus a verdict translator in `src/hook_output/`; without the translator a `deny` is discarded before the developer sees it.
61
+
62
+ ## Behavioral Coverage
63
+
64
+ OpenLatch captures the agent behaviors that matter — the raw signal the platform's modules act on:
65
+
66
+ | Category | Behaviors captured |
67
+ | -------- | ------------------ |
60
68
  | **Tool Poisoning** | Malicious MCP servers, tampered tool definitions, supply chain attacks on agent tooling |
61
69
  | **PII & Credential Leakage** | API keys, tokens, passwords, and personal data leaving your machine via agent actions |
62
70
  | **Prompt Injection** | Injected instructions hidden in files, tool outputs, or web content that hijack agent behavior |
@@ -89,6 +97,11 @@ Pre-built binaries for macOS (ARM, Intel), Linux (x86_64, ARM), and Windows are
89
97
  # Auto-detect agents, install hooks, and start the daemon
90
98
  openlatch init
91
99
 
100
+ # Point the client at a self-hosted platform (persisted to config.toml).
101
+ # Use the console origin, not the API port: it proxies /api/v1 AND serves
102
+ # the /cli-auth page that browser login opens.
103
+ openlatch init --api-url http://127.0.0.1:5183
104
+
92
105
  # Check daemon status, uptime, and event counts
93
106
  openlatch status
94
107
 
@@ -138,6 +151,7 @@ openlatch docs
138
151
  | `openlatch doctor --rescue [--since 24h] [--output PATH] [--yes]` | Bundle a redacted diagnostic ZIP for sharing with support. Privacy filter runs on every text file; tokens are hard-redacted. |
139
152
  | `openlatch uninstall [--purge] [--yes]` | Remove hooks and stop daemon. `--purge` deletes all data |
140
153
  | `openlatch supervision {install,uninstall,enable,disable,status}` | Manage the OS-native supervisor that keeps the daemon alive after reboot (launchd / systemd --user / Task Scheduler). Installed by default during `openlatch init`; opt out with `openlatch init --no-persistence`. |
154
+ | `openlatch inventory {list,log,rescan,status,inspect,projects,ack}` | Inspect configuration monitoring: list observed config sources (MCP servers, skills, commands, hooks, rules), tail `ai.openlatch.config.*` events from the audit log, force a rescan, report monitor health, drill down on a single source (`inspect`), enumerate observed project roots (`projects`), and acknowledge pending alerts (`ack`). |
141
155
  | `openlatch docs` | Open documentation in browser |
142
156
 
143
157
  Noun-verb aliases are also available: `openlatch hooks install` = `init`, `openlatch hooks uninstall` = `uninstall`, `openlatch daemon start` = `start`, etc.
@@ -188,35 +202,66 @@ OpenLatch ships two binaries:
188
202
 
189
203
  ## How It Works
190
204
 
191
- OpenLatch uses a **three-layer architecture** — hooks live inside your agents, the client forwards events, and the cloud runs detection:
205
+ OpenLatch uses a **three-layer architecture** — hooks live inside your agent, the client decides locally and forwards events, and the cloud authors the rules and runs analysis:
192
206
 
193
207
  ```
194
208
  ┌─────────────────────────────────────────────────────────────────┐
195
209
  │ Your Machine │
196
210
  │ │
197
211
  │ ┌──────────┐ hook event ┌──────────────────────────────┐ │
198
- │ │ Claude │─────────────▶│ │ │
199
- │ │ Code │ │ OpenLatch Client │ │
200
- │ ├──────────┤ │ (localhost:7443) │ │
201
- │ │ Cursor │─────────────▶│ │ │
202
- │ ├──────────┤ │ 1. Wrap in envelope │ │
203
- │ │ Copilot │─────────────▶│ 2. Redact credentials │ │
204
- │ ├──────────┤ │ 3. Forward to cloud │────┼──▶ OpenLatch Cloud
205
- │ │ Gemini │─────────────▶│ 4. Return verdict │◀───┼── (allow / deny)
206
- │ │ CLI │ │ 5. Write local audit log │ │
207
- │ ├──────────┤ │ │ │
208
- │ │ ... │─────────────▶│ │ │
209
- │ └──────────┘ ◀─ verdict ─ └──────────────────────────────┘ │
210
- │ │
212
+ │ │ Claude │─────────────▶│ OpenLatch Client │ │
213
+ │ │ Code │ │ (localhost:7443) │ │
214
+ │ │ │ │ │ │
215
+ │ │ │ │ 1. Wrap in envelope │ │
216
+ │ │ │ │ 2. Evaluate resident │ │
217
+ │ │ │ │ policy in-process │ │
218
+ │ │ │ ◀─ verdict ─│ 3. Redact credentials │ │
219
+ │ └──────────┘ (allow/deny) │ 4. Write local audit log │ │
220
+ │ │ 5. Batch → forward │────┼──▶ OpenLatch Cloud
221
+ │ │ ◀── policy bundle │◀───┼── (rules + analysis)
222
+ │ └──────────────────────────────┘ │
211
223
  └─────────────────────────────────────────────────────────────────┘
212
224
  ```
213
225
 
214
226
  **Key design decisions:**
215
227
 
216
- - **Hook-native** — OpenLatch plugs into each agent's official hook/extension system. It runs inside the agent runtime, not as a network proxy. Events cannot be bypassed.
217
- - **Thin client, smart cloud** — the client wraps events in a standard envelope and forwards them. All detection, normalization, and analysis happens cloud-side.
228
+ - **Hook-native** — OpenLatch plugs into the agent's official hook/extension system. The enforcement path runs inside the agent runtime, never as a network proxy; events cannot be bypassed. (Model-call economics capture additionally uses a loopback listener on `127.0.0.1` — on by default, see `[boundary]`.)
229
+ - **Local-authoritative verdicts** — the daemon evaluates a resident policy bundle in-process, so the verdict path never touches the network. The cloud authors and serves the rules; it does not decide. Correlation, cross-host analysis, and scanning stay cloud-side. Policy evaluation ships **on** (secure-by-default); `[policy] enabled = false` opts out — a complete off switch, not observe mode.
218
230
  - **Privacy-first** — credentials and secrets are redacted locally via regex-based filtering before anything leaves your machine.
219
- - **Fail-open** — if the cloud is unreachable, agents continue working normally. Events are logged locally and synced later.
231
+ - **Fail-static, not fail-open** — a resident bundle keeps enforcing offline forever, and a failed refresh keeps the last-known-good bundle. Genuine fail-open is limited to two cases: no bundle was ever fetched, and the hook binary being unable to reach the daemon. Event forwarding is separately durable — events spool to `outbox.jsonl` and sync later.
232
+
233
+ ## Updating openlatch
234
+
235
+ `openlatch` auto-updates itself silently in the background. By default the running daemon polls the npm registry every six hours, downloads + verifies + applies new releases during quiet moments (no agent activity for sixty seconds AND no hook in flight), and re-execs into the new binary. The `min_supported_client` and `cargo install` gates from the manual path apply equally to the worker.
236
+
237
+ ```bash
238
+ # Disable the worker (env or config):
239
+ export OPENLATCH_AUTO_UPDATE=false
240
+ # or, persistently:
241
+ echo -e "[update]\nauto_update = false" >> ~/.openlatch/config.toml
242
+ ```
243
+
244
+ If the supervisor restarts the daemon at least three times within sixty seconds after a fresh update (sentinel + `.bak` siblings both present), the next start auto-rolls-back from the `.bak` files — running before logging is initialised, with output through stderr only. CI environments and `cargo install`-installed binaries are auto-detected and skip the worker entirely.
245
+
246
+ `openlatch update` is the manual escape hatch and works whether or not the worker is enabled:
247
+
248
+ ```bash
249
+ # Probe the registry; never modifies anything.
250
+ openlatch update --check --json
251
+
252
+ # Apply the update if one is available.
253
+ openlatch update --apply --yes
254
+ ```
255
+
256
+ When a daemon is running, the CLI routes the apply through the daemon's authenticated `POST /admin/update` RPC; the daemon downloads the tarball, verifies the SHA-512 integrity hash and minisign signatures against the trusted key baked into the binary, performs an atomic swap, drains in-flight HTTP traffic, and re-execs into the new binary. With no daemon running, the CLI performs the same swap in-process.
257
+
258
+ The pipeline refuses to apply when:
259
+
260
+ - The binary was installed via `cargo install` (run `cargo install --force --locked openlatch-client` instead — exit 5, OL-1505).
261
+ - The new release's `min_supported_client` is greater than the running version (run `npm install -g @openlatch/client@latest` to resync).
262
+ - A signature does not verify against the trusted key bundled into the running binary (exit 1, OL-1504).
263
+
264
+ The supported install paths are `npm install -g @openlatch/client` and `npx @openlatch/client …`. Direct curl-installs work but disable the npm-vs-actual drift detection in `openlatch status`. Releases marked `Severity: critical` (in the release commit footer) bypass the activity-aware deferral and apply on the next poll regardless of in-flight hook traffic.
220
265
 
221
266
  ## Configuration
222
267
 
@@ -226,9 +271,8 @@ OpenLatch works with zero configuration. For advanced use cases:
226
271
  # Configuration precedence (highest to lowest):
227
272
  # 1. CLI flags
228
273
  # 2. Environment variables (OPENLATCH_*)
229
- # 3. Project config (.openlatch.json)
230
- # 4. User config (~/.openlatch/config.toml)
231
- # 5. Defaults
274
+ # 3. User config (~/.openlatch/config.toml)
275
+ # 4. Defaults
232
276
  ```
233
277
 
234
278
  | Environment Variable | Description | Default |
@@ -236,18 +280,54 @@ OpenLatch works with zero configuration. For advanced use cases:
236
280
  | `OPENLATCH_API_KEY` | Your OpenLatch API key | — |
237
281
  | `OPENLATCH_API_URL` | Cloud API base URL. Callers append `/api/v1/...` path segments. | `https://app.openlatch.ai` |
238
282
  | `OPENLATCH_APP_URL` | Web app URL used for browser auth. Falls back to `OPENLATCH_API_URL` (with a trailing `/api` stripped, for back-compat with overrides). | `https://app.openlatch.ai` |
239
- | `OPENLATCH_LOG_LEVEL` | Logging verbosity | `info` |
240
- | `OPENLATCH_FAIL_MODE` | Behavior when cloud is unreachable | `open` |
283
+ | `OPENLATCH_LOG` | Logging verbosity (`error` / `warn` / `info` / `debug` / `trace`) | `info` |
284
+ | `OPENLATCH_DIR` | State directory — config, logs, outbox, daemon port/token. Override to run a second isolated instance. | `~/.openlatch` |
285
+ | `OPENLATCH_PORT` | Local daemon port. `init` binds this exact port and fails with OL-1500 if it is taken; unset, it probes 7443-7543 for the first free one. | `7443` |
286
+ | `OPENLATCH_SKIP_KEYRING` | Treat the OS keychain as unavailable, so `OPENLATCH_API_KEY` is used instead. The credential chain is keychain → env var → encrypted file, so a stale keychain entry otherwise wins over the env var. | unset |
287
+ | `OPENLATCH_CLOUD_ENABLED` | Set to `false` to stop forwarding events to the cloud | `true` |
288
+ | `OPENLATCH_CLOUD_BATCH_MAX_EVENTS` | Events per ingest batch. Clamped to `1..=100`; `1` restores one POST per event. | `50` |
289
+ | `OPENLATCH_CLOUD_BATCH_MAX_WAIT_MS` | Flush deadline, anchored to the first buffered event | `5000` |
290
+ | `OPENLATCH_POLICY_ENABLED` | Local policy evaluation. Set to `false` to opt out — a complete off switch, not observe mode. | `true` |
291
+ | `OPENLATCH_BOUNDARY_ENABLED` | Model-boundary listener (the loopback proxy that captures model-call economics + attribution). Set to `false` to stop binding the pinned loopback port. While enabled, the daemon points the agent at the listener via `ANTHROPIC_BASE_URL` — but only once a synthetic request has proven the listener can actually reach the provider, and it removes the pointer again if that stops being true. Being wired disables Claude Code Remote Control. | `true` |
292
+ | `OPENLATCH_BOUNDARY_UPSTREAM` | Where the boundary forwards. Every model call and every provider credential on this host goes here, so change it only for a local harness or a deliberate gateway. | `https://api.anthropic.com` |
293
+ | `OPENLATCH_INVENTORY_ENABLED` | Configuration-plane monitoring (MCP servers, skills, rules, hooks) | `true` |
294
+ | `OPENLATCH_TELEMETRY_DISABLED` | Set to `1` to opt out of anonymous usage telemetry | unset |
295
+ | `OPENLATCH_NPM_REGISTRY` | npm registry origin used by `openlatch update` (override for testing) | `https://registry.npmjs.org` |
296
+ | `OPENLATCH_UPDATE_CHECK` | Set to `false` to disable the daemon's startup version check | `true` |
297
+ | `OPENLATCH_AUTO_UPDATE` | Set to `false` to disable the background auto-update worker | `true` |
298
+ | `OPENLATCH_UPDATE_CHECK_INTERVAL_SECS` | Worker poll cadence (E2E override; production keeps the default) | `21600` (6h) |
299
+ | `OPENLATCH_UPDATE_QUIET_WINDOW_SECS` | Seconds of hook silence required before a non-critical apply | `60` |
300
+ | `OPENLATCH_UPDATE_MAX_DEFER_SECS` | Hard cap on cumulative deferral before applying anyway | `86400` (24h) |
301
+ | `OPENLATCH_CLOUD_OUTBOX_MAX_BYTES` | Cap on `~/.openlatch/outbox.jsonl` size before drop-oldest eviction (0 disables) | `104857600` (100 MB) |
302
+ | `OPENLATCH_CLOUD_FALLBACK_MAX_BYTES` | Cap on `~/.openlatch/logs/fallback.jsonl` size before drop-oldest via offset advance (0 disables) | `52428800` (50 MB) |
241
303
 
242
304
  ## Security
243
305
 
244
- OpenLatch is a security product — we hold ourselves to a high standard:
306
+ OpenLatch is the on-host runtime enforcement node of the AI Operations Platform — and we hold our own code to the same standard the platform is built to enforce for your agents:
245
307
 
246
308
  - **Responsible disclosure** — report vulnerabilities to **security@openlatch.ai**
247
309
  - **Private vulnerability reporting** enabled on this repository
248
310
  - All releases are built with **SLSA provenance** via GitHub Actions
249
311
  - See [SECURITY.md](SECURITY.md) for our full security policy
250
312
 
313
+ ## Releases
314
+
315
+ This repository publishes two artifacts on **independent version lines**:
316
+
317
+ | Artifact | Tag | Where |
318
+ | -------- | --- | ----- |
319
+ | The client itself | `v1.2.3` | GitHub Releases, [`openlatch`](https://www.npmjs.com/package/openlatch) (npm), [`openlatch-client`](https://crates.io/crates/openlatch-client) (crates.io) |
320
+ | The wire-format JSON Schemas | `schemas-v1.2.3` | [`@openlatch/client-schemas`](https://www.npmjs.com/package/@openlatch/client-schemas) (npm), [`openlatch-client-schemas`](https://pypi.org/project/openlatch-client-schemas/) (PyPI) |
321
+
322
+ The schema packages are versioned **only** by changes under `schemas/`, so a
323
+ major bump means a breaking change to the events exchanged between the client
324
+ and the platform — and nothing else. Pin them independently of the client
325
+ version; they carry no dependency on it.
326
+
327
+ Both lines are cut by [release-please](https://github.com/googleapis/release-please)
328
+ from Conventional Commits. Contributor-facing details are in
329
+ [AGENT.md](AGENT.md#releasing--two-independent-version-lines).
330
+
251
331
  ## Contributing
252
332
 
253
333
  We welcome contributions! Whether it's bug fixes, new agent integrations, or documentation improvements.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@openlatch/client",
3
- "version": "0.1.14",
4
- "description": "OpenLatch — the open-source security layer for AI agents",
3
+ "version": "0.1.18",
4
+ "description": "OpenLatch runtime enforcement node — the capture-and-enforce client for the AI Operations Platform",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -20,10 +20,10 @@
20
20
  "postinstall": "node lib/postinstall.js"
21
21
  },
22
22
  "optionalDependencies": {
23
- "@openlatch/client-darwin-arm64": "0.1.14",
24
- "@openlatch/client-darwin-x64": "0.1.14",
25
- "@openlatch/client-linux-x64": "0.1.14",
26
- "@openlatch/client-linux-arm64": "0.1.14",
27
- "@openlatch/client-win32-x64": "0.1.14"
23
+ "@openlatch/client-darwin-arm64": "0.1.18",
24
+ "@openlatch/client-darwin-x64": "0.1.18",
25
+ "@openlatch/client-linux-x64": "0.1.18",
26
+ "@openlatch/client-linux-arm64": "0.1.18",
27
+ "@openlatch/client-win32-x64": "0.1.18"
28
28
  }
29
29
  }