@rahularya01/pi-cursor 1.4.30 → 1.4.32

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/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## [Unreleased]
4
+
5
+ ## [1.4.32] - 2026-09-06
6
+
7
+ ### Fixed
8
+
9
+ - **Fable requests no longer fail with `Connect error not_found`.** The Run request now sends model selection only through `requested_model`; `model_details` is a legacy alternative, and populating both fields made Cursor reject valid `claude-fable-5-1` requests. Fixes [#23](https://github.com/Rahularya01/pi-cursor/issues/23).
10
+
11
+ ## [1.4.31] - 2026-09-04
12
+
13
+ ### Changed
14
+
15
+ - **Cursor-native tools now run on the open stream** (read, ls, grep, write, delete, shell, fetch) instead of being rejected back to MCP. The model keeps generating on the same Run RPC; Pi MCP tools remain for anything called that way. Paths stay inside the workspace.
16
+ - **Prompt history is always rebuilt from Pi's transcript**, even when a checkpoint exists, so empty server-side placeholders cannot wipe earlier turns. Pi's system prompt stays on `root_prompt_messages_json` (`<rules>`). `customSystemPrompt` is not sent — Cursor maps that field to a `--system-prompt` CLI option this client path rejects (`invalid_argument: unknown option '--system-prompt'`).
17
+ - **Hosted web search / fetch permission prompts are approved by default** so those turns complete instead of forcing a re-plan. Pass `approveWeb: false` to reject.
18
+ - Default `x-cursor-client-version` is `cli-2026.07.23-e383d2b`. Client heartbeats go out every 5s. HTTP CONNECT proxy support via `PI_PROXY_CURSOR` / `PI_PROXY` / `HTTPS_PROXY`.
19
+
20
+ ### Fixed
21
+
22
+ - **A Connect `invalid_argument` is no longer labeled as wire-protocol drift.** The protocol-hint used to match any `Connect error`, so a rejected `--system-prompt` option told people to bump `PI_CURSOR_CLIENT_VERSION`.
23
+ - **`resource_exhausted` no longer retries the same dead conversation id.** The conversation is rotated before the next attempt.
24
+ - **A transient Cursor `internal` or `unavailable` end-stream error no longer kills the turn.** These arrive as an end-stream frame with `exitCode: 0`, so `classifyBridgeExit` matched no bucket, fell through to `Unknown` with `retryable: false`, and the end-stream path called `writer.error()` without ever reaching `onClose` — failing a turn that an identical bridge exit would have recovered. A new `upstream_internal` failure kind covers `internal`, `unavailable`, and `deadline_exceeded`, classified after the protocol-drift check so a wire mismatch Cursor wraps in `internal` stays terminal. The end-stream handler now stages the error and kills the bridge so the existing `onClose` recovery owns the retry budget and checkpoint rules; `canRecoverAfterTransportLoss` and the idle-retry budget are unchanged.
25
+ - **A checkpoint whose blobs the entry bound evicted is no longer kept and replayed with blank history.** The 512-entry blob store evicts oldest-first, but a checkpoint addresses its history by blob id and Cursor answers a request for a blob we no longer hold with an empty result rather than an error, so the conversation came back structurally intact with the evicted turns silently blank. `markBlobMiss` only caught this one turn late, after Cursor had already asked. `mergeBlobStore` now drops the checkpoint whenever its trim evicts anything — the same call `journal.checkpoint_dropped_incomplete_blobs` already makes at restore time — which also covers the merge paths that write no new checkpoint but can still evict blobs an earlier turn's checkpoint references. Costs one full-history rebuild from pi's transcript.
26
+
3
27
  ## [1.4.30] - 2026-09-02
4
28
 
5
29
  ### Fixed
package/README.md CHANGED
@@ -192,28 +192,29 @@ for tuning timeouts, debugging, and edge-case overrides.
192
192
  <details>
193
193
  <summary><strong>Full environment variable reference</strong></summary>
194
194
 
195
- | Variable | Purpose |
196
- | ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
197
- | `PI_CURSOR_AGENT_URL` / `CURSOR_AGENT_URL` | Override agent base URL (default: `https://agentn.us.api5.cursor.sh`). |
198
- | `CURSOR_ACCESS_TOKEN` | Static access token override. |
199
- | `PI_CURSOR_CLIENT_VERSION` | Pin `x-cursor-client-version` header sent by the HTTP/2 bridge. |
200
- | `PI_CURSOR_SYSTEM_CREDENTIALS` | `0`/`false` to disable Keychain/IDE credential reuse (default: allow). |
201
- | `PI_CURSOR_RAW_MODELS` | Disable effort-suffix model collapse. |
202
- | `PI_CURSOR_PROVIDER_DEBUG` | Enable verbose JSONL debug logging. |
203
- | `PI_CURSOR_LIFECYCLE_LOG` | Always-on compact lifecycle log path (default: `$TMPDIR/pi-cursor-lifecycle.jsonl`). |
204
- | `CURSOR_USAGE_SESSION_TOKEN` | Optional `WorkosCursorSessionToken` fallback cookie for `/cursor.usage`. |
205
- | `PI_OFFLINE` | Skip live model discovery entirely; always use the bundled fallback catalog. |
206
- | `PI_CURSOR_CACHE_DIR` | Where the model catalog and refresh back-off are cached (default: `$XDG_CACHE_HOME/pi-cursor` or `~/.cache/pi-cursor`). Delete it to force a full rediscovery. |
207
- | `PI_CURSOR_UNARY_BRIDGE` | `1` forces unary RPCs (model discovery) through the general-purpose bridge transport instead of the dedicated one-shot in-process HTTP/2 client. Diagnostic escape hatch. |
208
- | `PI_CURSOR_STREAM_IDLE_TIMEOUT_MS` | Silence safety net: ms with **no upstream work** before recover/retry/error. **Default `180000` (3 min)**; `0` disables (turns run unbounded). Text/thinking/token deltas, tool-call events, and answered execs/queries reset it; heartbeats only prove the socket and do not hide an unanswered exec. It is paused during tool execution. On timeout, recovery continues from checkpoint even after partial output. |
209
- | `PI_CURSOR_RESUME_IDLE_TIMEOUT_MS` | Same silence safety net after tool-result resume. **Default `180000` (3 min)**; `0` disables. |
210
- | `PI_CURSOR_STREAM_IDLE_MAX_RETRIES` | Auto-recovery attempts after silence/transport loss. Blind restart is skipped once text/thinking streamed unless a checkpoint is available for continuation. **Default `5`**; `0` disables. |
211
- | `PI_CURSOR_ACTIVE_BRIDGE_TTL_MS` | How long a mid-tool bridge stays parked waiting for tool results (default: 1 hour). |
212
- | `PI_CURSOR_H2_CONNECT_TIMEOUT_MS` | h2-bridge initial connect kill (default: `30000`; `0` disables). |
213
- | `PI_CURSOR_H2_IDLE_TIMEOUT_MS` | h2-bridge activity idle kill. **Default `0` (disabled)**. Parent heartbeats reset it when enabled. |
214
- | `PI_CURSOR_SLIM_TOOLS` | Compact Cursor MCP tool definitions: concise function purpose, no annotation-only parameter prose, full callable schema constraints preserved. **Default on**; set `0`/`false` for verbatim schemas. |
215
- | `PI_CURSOR_MIDPAUSE_REBUILD_MAX_AGE_MS` | Max age of mid-pause metadata used for full-history rebuild (default: 15 min). |
216
- | `PI_CURSOR_PROMPT_HISTORY` | Publish the system prompt and completed turns as Cursor prompt messages when a request is built without an upstream checkpoint. **Default on**; `0`/`false` restores the pre-1.4.24 behavior, where a rebuilt conversation reached the model with no history and no Pi system prompt. |
195
+ | Variable | Purpose |
196
+ | ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
197
+ | `PI_CURSOR_AGENT_URL` / `CURSOR_AGENT_URL` | Override agent base URL (default: `https://agentn.us.api5.cursor.sh`). |
198
+ | `CURSOR_ACCESS_TOKEN` | Static access token override. |
199
+ | `PI_CURSOR_CLIENT_VERSION` | Pin `x-cursor-client-version` header sent by the HTTP/2 bridge. |
200
+ | `PI_PROXY_CURSOR` / `PI_PROXY` / `HTTPS_PROXY` | HTTP CONNECT proxy for Cursor HTTP/2. `PI_PROXY_CURSOR` wins, then `PI_PROXY`, then `HTTPS_PROXY`. |
201
+ | `PI_CURSOR_SYSTEM_CREDENTIALS` | `0`/`false` to disable Keychain/IDE credential reuse (default: allow). |
202
+ | `PI_CURSOR_RAW_MODELS` | Disable effort-suffix model collapse. |
203
+ | `PI_CURSOR_PROVIDER_DEBUG` | Enable verbose JSONL debug logging. |
204
+ | `PI_CURSOR_LIFECYCLE_LOG` | Always-on compact lifecycle log path (default: `$TMPDIR/pi-cursor-lifecycle.jsonl`). |
205
+ | `CURSOR_USAGE_SESSION_TOKEN` | Optional `WorkosCursorSessionToken` fallback cookie for `/cursor.usage`. |
206
+ | `PI_OFFLINE` | Skip live model discovery entirely; always use the bundled fallback catalog. |
207
+ | `PI_CURSOR_CACHE_DIR` | Where the model catalog and refresh back-off are cached (default: `$XDG_CACHE_HOME/pi-cursor` or `~/.cache/pi-cursor`). Delete it to force a full rediscovery. |
208
+ | `PI_CURSOR_UNARY_BRIDGE` | `1` forces unary RPCs (model discovery) through the general-purpose bridge transport instead of the dedicated one-shot in-process HTTP/2 client. Diagnostic escape hatch. |
209
+ | `PI_CURSOR_STREAM_IDLE_TIMEOUT_MS` | Silence safety net: ms with **no upstream work** before recover/retry/error. **Default `180000` (3 min)**; `0` disables (turns run unbounded). Text/thinking/token deltas, tool-call events, and answered execs/queries reset it; heartbeats only prove the socket and do not hide an unanswered exec. It is paused during tool execution. On timeout, recovery continues from checkpoint even after partial output. |
210
+ | `PI_CURSOR_RESUME_IDLE_TIMEOUT_MS` | Same silence safety net after tool-result resume. **Default `180000` (3 min)**; `0` disables. |
211
+ | `PI_CURSOR_STREAM_IDLE_MAX_RETRIES` | Auto-recovery attempts after silence/transport loss. Blind restart is skipped once text/thinking streamed unless a checkpoint is available for continuation. **Default `5`**; `0` disables. |
212
+ | `PI_CURSOR_ACTIVE_BRIDGE_TTL_MS` | How long a mid-tool bridge stays parked waiting for tool results (default: 1 hour). |
213
+ | `PI_CURSOR_H2_CONNECT_TIMEOUT_MS` | h2-bridge initial connect kill (default: `30000`; `0` disables). |
214
+ | `PI_CURSOR_H2_IDLE_TIMEOUT_MS` | h2-bridge activity idle kill. **Default `0` (disabled)**. Parent heartbeats reset it when enabled. |
215
+ | `PI_CURSOR_SLIM_TOOLS` | Compact Cursor MCP tool definitions: concise function purpose, no annotation-only parameter prose, full callable schema constraints preserved. **Default on**; set `0`/`false` for verbatim schemas. |
216
+ | `PI_CURSOR_MIDPAUSE_REBUILD_MAX_AGE_MS` | Max age of mid-pause metadata used for full-history rebuild (default: 15 min). |
217
+ | `PI_CURSOR_PROMPT_HISTORY` | Publish the system prompt and completed turns as Cursor prompt messages when a request is built without an upstream checkpoint. **Default on**; `0`/`false` restores the pre-1.4.24 behavior, where a rebuilt conversation reached the model with no history and no Pi system prompt. |
217
218
 
218
219
  </details>
219
220
 
@@ -276,7 +277,7 @@ layer. Never hand-edit it — regenerate with `bun run proto:gen` (see
276
277
  - **Not logged in / 401:** Ensure Cursor CLI or app is logged in, or run `/login cursor` again. Check `/cursor.doctor` to verify your `tokenSource`. Tokens from CLI/IDE are re-resolved when near expiry; idle stream retries also force-refresh credentials.
277
278
  - **Empty / hung stream:** Cursor may have updated wire headers; verify network connectivity or bump `PI_CURSOR_CLIENT_VERSION`. `/cursor.doctor` prints the active `clientVersion`.
278
279
  - **Wire-protocol drift:** Cursor can change `agent.v1` at any time. Unrecognized server messages and unknown protobuf fields are no longer skipped silently — they are counted, written to the lifecycle log as `wire_drift`, appended to the failing turn's error message, and listed by `/cursor.doctor` under `wireDrift`. `wireDriftStranding=yes` means an unanswered message could have parked the turn, which is the difference between "our schema is a bit behind" and "this is why it hung". Run `CURSOR_ACCESS_TOKEN=... bun run smoke:wire` to check the handshake and schema against the live endpoint without starting a chat turn, then see [`proto/README.md`](proto/README.md) to resync the schema.
279
- - **Stuck / dies after a few minutes of work:** Cursor `InteractionQuery` prompts are answered so the stream does not park. Web/search and unnamed proto fields are rejected (use Pi tools instead). Inspect `$TMPDIR/pi-cursor-lifecycle.jsonl` for `interaction_query` / `bridge_close` events, and `/cursor.doctor` for `lastStreamEvent`. Full debug: `PI_CURSOR_PROVIDER_DEBUG=1`.
280
+ - **Stuck / dies after a few minutes of work:** Cursor `InteractionQuery` prompts are answered so the stream does not park. Web/search and hosted fetch are approved by default. Inspect `$TMPDIR/pi-cursor-lifecycle.jsonl` for `interaction_query` / `bridge_close` events, and `/cursor.doctor` for `lastStreamEvent`. Full debug: `PI_CURSOR_PROVIDER_DEBUG=1`.
280
281
  - **Tool continuation lost:** The provider now prefers full-history rebuild when checkpoints are stale/mismatched. If recovery still skips, `/cursor.doctor` shows `lastRecoverySkipReason`. Retry the turn or start a new chat.
281
282
  - **WSL credential detection:** Set `USERPROFILE` or `USERNAME` so the Windows home directory is known, and ensure `/mnt/c/Users/<you>/AppData/...` is readable. Disable with `PI_CURSOR_SYSTEM_CREDENTIALS=0` if undesired.
282
283
  - **Slow startup:** Activation should be a few milliseconds. `/cursor.doctor` reports `catalogCache` (`none(using bundled fallback)` means every launch is starting cold — check that `catalogCacheDir` is writable) and `unaryTransport`. A stale Cursor CLI keychain entry no longer blocks startup: a refresh token that fails is remembered for 10 minutes so it is not retried on the next launch, and any valid locally stored token is always preferred over a network exchange.