@raindrop-ai/cursor 0.0.1

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.
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "raindrop",
3
+ "version": "0.0.1",
4
+ "description": "Session, tool call, and token tracing for Cursor agents",
5
+ "author": { "name": "Raindrop AI", "email": "support@raindrop.ai" },
6
+ "license": "MIT",
7
+ "hooks": "./hooks/hooks.json",
8
+ "mcpServers": "./.mcp.json"
9
+ }
package/.mcp.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "mcpServers": {
3
+ "raindrop-diagnostics": {
4
+ "command": "node",
5
+ "args": ["${CURSOR_PLUGIN_ROOT}/dist/cli.js", "mcp-serve"]
6
+ }
7
+ }
8
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Raindrop AI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,110 @@
1
+ # @raindrop-ai/cursor
2
+
3
+ Capture Cursor IDE, `cursor-agent` CLI, and Cloud Agent turns in Raindrop using Cursor hooks. No application code changes are required.
4
+
5
+ ## Install
6
+
7
+ Requires Node.js 20 or later.
8
+
9
+ ```bash
10
+ npm install -g @raindrop-ai/cursor
11
+ raindrop-cursor setup
12
+ export RAINDROP_WRITE_KEY="your-write-key"
13
+ ```
14
+
15
+ Setup merges hooks into `~/.cursor/hooks.json` and adds a self-diagnostics MCP server to `~/.cursor/mcp.json`. Existing hooks and other MCP servers are preserved. Setup asks for a Raindrop write key and an optional project slug; a blank project uses the org default Production project.
16
+
17
+ For a repository and its Cloud Agents:
18
+
19
+ ```bash
20
+ npx -y @raindrop-ai/cursor setup --scope project
21
+ ```
22
+
23
+ Commit `.cursor/hooks.json` and `.cursor/mcp.json`. Project hooks use `npx -y @raindrop-ai/cursor@<version> hook`, pinned to the CLI version that ran setup; rerunning setup refreshes the pin. The machine needs Node.js, npm, and package registry access. Set `RAINDROP_WRITE_KEY` and `RAINDROP_LOCAL_DEBUGGER=false` in the Cloud Agent's runtime secrets. For a named project, also set `RAINDROP_PROJECT_ID` there. Setup saves your project choice in local shared configuration, which is unavailable on Cloud Agent VMs.
24
+
25
+ Install in one scope per conversation to avoid duplicate hook deliveries.
26
+
27
+ ## Captured data
28
+
29
+ Each `generation_id` gets one `ai_generation` event. `beforeSubmitPrompt` opens it, `afterAgentResponse` patches output, and `stop` finalizes it. A turn can also begin from later hooks when lifecycle events are absent.
30
+
31
+ The integration records:
32
+
33
+ - Generic tool success and failure spans, using Cursor's duration. Permission denials also produce `ai.permissionDenied`.
34
+ - `ai.thinking` spans.
35
+ - One model span per turn, with input, output, cache-read, and cache-write usage when Cursor provides it.
36
+ - Session usage totals, compaction metadata, and session-end metadata.
37
+
38
+ `stop` counts are cumulative for the turn. They replace response counts rather than being added again. Missing counts remain absent. Duplicate `stop` hooks do not add another model span or double session totals.
39
+
40
+ At `sessionEnd`, turns missing a `stop` receive a cancelled model span and a final event patch with their captured usage. This includes earlier unfinished generations. Their usage enters the final session totals once. Already completed turns do not get another model span.
41
+
42
+ Generic tool hooks avoid double-counting shell, file, and MCP tool operations. Specialized tool hooks and Tab hooks are not installed.
43
+
44
+ ## Configuration
45
+
46
+ Configuration is shared with the Claude Code integration at `~/.config/raindrop/config.json`.
47
+
48
+ | Environment variable | Purpose |
49
+ | --- | --- |
50
+ | `RAINDROP_WRITE_KEY` | Raindrop write key |
51
+ | `RAINDROP_API_URL` | Ingest base URL; defaults to `https://api.raindrop.ai/v1` |
52
+ | `RAINDROP_PROJECT_ID` | Project override |
53
+ | `RAINDROP_USER_ID` | User ID fallback; Cursor's `user_email` takes precedence |
54
+ | `RAINDROP_CONVO_ID` | Conversation ID override |
55
+ | `RAINDROP_EVENT_NAME` | Event name; defaults to `ai_generation` |
56
+ | `RAINDROP_PROPERTIES` | JSON object merged with configured custom properties |
57
+ | `RAINDROP_ENABLED` | `false` or `0` disables telemetry |
58
+ | `RAINDROP_DEBUG` | `true` enables debug logging |
59
+ | `RAINDROP_HOOK_FLUSH_DEADLINE_MS` | Whole hook deadline; defaults to 8000 ms |
60
+ | `RAINDROP_LOCAL_DEBUGGER` | Local debugger URL, or `false` to disable discovery |
61
+ | `RAINDROP_SELF_DIAGNOSTICS` | JSON object with optional `signals`, `guidance`, and `toolName` |
62
+
63
+ ```bash
64
+ raindrop-cursor status
65
+ raindrop-cursor disable
66
+ raindrop-cursor enable
67
+ raindrop-cursor debug-on
68
+ raindrop-cursor debug-off
69
+ raindrop-cursor uninstall
70
+ raindrop-cursor uninstall --scope project
71
+ ```
72
+
73
+ Enable, disable, and debug commands update shared Raindrop configuration, including its use by the Claude Code integration.
74
+
75
+ ## Local debugger
76
+
77
+ Start the Raindrop local debugger on port 5899, or set `RAINDROP_LOCAL_DEBUGGER` to its URL. Hooks probe for it with a short timeout and cache discovery for five seconds. Event patches and OTLP spans appear without a cloud write key. Debugger HTTP requests run with tracing suppressed to prevent recursive instrumentation.
78
+
79
+ `setup --local-only` skips requiring a write key. It preserves an existing saved write key unless you supply a replacement. To run hooks without cloud delivery, set `RAINDROP_WRITE_KEY` to an empty string in the hook environment; this overrides the saved key.
80
+
81
+ ## Self-diagnostics
82
+
83
+ `raindrop-cursor mcp-serve` exposes the `__raindrop_report` tool. Its default categories are missing context, repeated tool failures, capability gaps, complete task failure, and noteworthy observations. Signals target the most recently updated Cursor event on that machine. Concurrent conversations can make this fallback ambiguous.
84
+
85
+ ## Cursor plugin
86
+
87
+ The npm package includes `.cursor-plugin/plugin.json`, `hooks/hooks.json`, `hooks/hook.cjs`, and `.mcp.json`. Each plugin hook is a one-line `node -e` command that runs `hooks/hook.cjs`; the launcher resolves the bundled CLI relative to its own file, skips missing builds, and always exits zero. The package build synchronizes the plugin version with the npm version.
88
+
89
+ ## Limits
90
+
91
+ Hook commands always exit zero and write no control response to stdout. Slow network requests cannot extend the CLI's whole-invocation deadline. Inputs over 16 MB are dropped; captured text is capped at 1,000,000 characters and serialized span strings at 32,768 characters.
92
+
93
+ State and debugger discovery cache live in `~/.raindrop-cursor`, with hashed conversation and generation keys and bounded file locking. On POSIX, the directory must belong to the current user with no group or other permissions; files use mode `0600`. Unsafe directories and linked files are rejected on reads. Writes replace files atomically without following existing links. Windows relies on the user's home-directory ACLs. The old shared temporary directory is not read or migrated; restart active Cursor sessions when upgrading.
94
+
95
+ `sessionEnd` cleans up conversation state. Cloud Agents may omit `sessionStart` and `sessionEnd`; `stop` still finalizes events, but session metadata can be incomplete and state remains until removed. You can remove `~/.raindrop-cursor` when no Cursor sessions are active. No transcript files are parsed.
96
+
97
+ Cached auto-detection accepts only `http://localhost:5899/v1/`; custom debugger URLs require explicit `RAINDROP_LOCAL_DEBUGGER` configuration. Auto-detection trusts the service listening on that local port. Set `RAINDROP_LOCAL_DEBUGGER=false` on shared hosts where that service cannot be trusted.
98
+
99
+ ## Development
100
+
101
+ ```bash
102
+ pnpm --filter @raindrop-ai/core build
103
+ pnpm --filter @raindrop-ai/cursor build
104
+ pnpm --filter @raindrop-ai/cursor test
105
+ pnpm --filter @raindrop-ai/cursor lint
106
+ ```
107
+
108
+ The conformance driver at `conformance/cursor-driver.mjs` exercises the public mapper and real telemetry transport with synthetic hook payloads. Live Cursor IDE and Cloud Agent validation is separate from these fixtures.
109
+
110
+ Run it using the [pinned harness instructions](../../conformance/README.md), with `--driver 'node /absolute/path/to/raindrop-js/conformance/cursor-driver.mjs'` and `--failures /absolute/path/to/raindrop-js/conformance/cursor-failures.txt`. The initial fault-lane baseline has 2 passes, 10 expected failures, and 48 unsupported scenarios. [DEV-1661](https://linear.app/raindrop-ai/issue/DEV-1661/cursor-hooks-conformance-gaps-and-live-integration-verification) tracks those gaps, CLI hook availability, subagent token attribution, and CI onboarding.