@rahularya01/pi-cursor 1.2.3 → 1.3.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.
- package/CHANGELOG.md +32 -0
- package/README.md +36 -13
- package/dist/index.js +17 -17
- package/package.json +8 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.3.1] - 2026-07-25
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **Tool continuation was unrecoverable after the first tool round.** Losing the upstream bridge mid-tool failed with `Cursor tool continuation was lost … skipReason=pending_tool_call_mismatch` on every round after the first. The mid-pause snapshot records only the round that was parked, but the client re-sends every tool result in the in-flight user turn, and recovery demanded the two sets be equal. The parked set must instead be _covered by_ what arrived; the in-flight turn is still matched exactly, which is what pins the replayed transcript to the client's view.
|
|
8
|
+
- **Parallel tool calls beyond the first never reached the client.** Cursor can frame several execs in one chunk, but the response was closed on the first, so the rest were silently dropped and only re-offered if the bridge happened to survive. The pause is now deferred to the end of the chunk. Only execs the client was actually told about are recorded as pending, since recovery can only expect back what the client saw.
|
|
9
|
+
- **Checkpoints delivered during a tool pause were discarded.** The latest checkpoint was held in per-round state while the bridge outlived the round, so anything arriving mid-pause was stranded in the previous round's closure — a recurring cause of `hadStoredCheckpoint=false` diagnostics. It now lives on the bridge.
|
|
10
|
+
- **An oversized or unsupported image broke every later turn.** The whole history is re-parsed on each request and an image failing Cursor's 5 MiB / format check threw, so one bad screenshot — typically from a tool result — permanently failed the conversation. Images already in the transcript are now decoded leniently; the message being sent still errors, since that one the caller can fix.
|
|
11
|
+
- **An undecodable checkpoint was never discarded**, failing every subsequent turn in the conversation. It is now decoded once during staleness validation and dropped on failure, degrading to a rebuild.
|
|
12
|
+
- **The most load-bearing blob was first to be evicted.** `trimBlobStore` drops oldest-first, but merging used `Map.set`, which leaves an existing key at its original position — so the system-prompt blob, written first on every build and referenced by every checkpoint, was permanently the oldest entry. Merging now re-inserts, making eviction genuinely least-recently-referenced.
|
|
13
|
+
- **Tool-result images were dropped on checkpoint recovery**, though the full-history rebuild path preserved them.
|
|
14
|
+
- Tool results with no `tool_call_id` are excluded from recovery's set matching instead of reading as duplicates and failing an otherwise sound recovery.
|
|
15
|
+
- A live bridge is no longer resumed when the request's history does not match the one it was parked on. Without a Pi session id the bridge key is only a hash of the opening user message, so two conversations that start alike shared a key.
|
|
16
|
+
|
|
17
|
+
## [1.3.0] - 2026-07-24
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- **Wire-drift detection.** Unrecognized `agent.v1` 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` (`lastDriftSignal`, `wireDrift`, `wireDriftStranding` plus a detail block). `wireDriftStranding=yes` distinguishes an unanswered message that could have parked the turn from a merely out-of-date schema — previously both surfaced as a bare idle timeout.
|
|
22
|
+
- **Reproducible protobuf codegen.** `proto/agent.proto` is now vendored as the source of truth for `src/proto/agent_pb.ts`, with `npm run proto:gen` (regenerate), `npm run proto:sync` (recover the `.proto` from an updated generated file — protoc-gen-es embeds the full descriptor), and `npm run proto:check` (fails the build when the two drift apart, and is part of `npm run check`). Uses `buf` + `protoc-gen-es` from devDependencies, so no system `protoc` is required. See [`proto/README.md`](proto/README.md).
|
|
23
|
+
- `npm run smoke:wire` performs the real Connect/HTTP2 handshake against the configured endpoint and reports schema drift without starting a chat turn.
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- **`src/stream/native-core.ts` split into focused modules** (5,696 → ~1,650 lines): `types`, `tuning`, `debug-log`, `images`, `model-discovery`, `message-parsing`, `pi-adapter`, `request-build`, `bridge-session`, `session-state`, `server-messages`, `thinking-filter`, and `drift`. The public surface of `src/stream/index.ts` is unchanged.
|
|
28
|
+
- `native-core.ts` is now covered by ESLint and Prettier (it was previously exempted for being too large), which removed a large amount of dead code and unused imports.
|
|
29
|
+
- Shared structural types are declared once in `src/stream/types.ts`; `recovery.ts` and `native-core.ts` previously carried duplicate copies of `ParsedTurn`, `StoredConversation`, and friends.
|
|
30
|
+
|
|
31
|
+
### Removed
|
|
32
|
+
|
|
33
|
+
- **The quarantined OpenAI-compatible local proxy.** `startProxy`/`stopProxy` and the entire parallel request path (`handleChatCompletion`, `writeSSEStream`, `handleToolResultResume`, `handleNonStreamingResponse`, and helpers) are gone — roughly 1,250 lines that were unreachable from the provider. Native `streamSimple` was already the only chat path; `/cursor.doctor` now reports `proxyPath=removed`.
|
|
34
|
+
|
|
3
35
|
## [1.2.3] - 2026-07-24
|
|
4
36
|
|
|
5
37
|
### Fixed
|
package/README.md
CHANGED
|
@@ -163,23 +163,40 @@ Pi Coding Agent → streamSimple (cursor-native)
|
|
|
163
163
|
|
|
164
164
|
Stream modules are split under `src/stream/`:
|
|
165
165
|
|
|
166
|
-
| Module | Responsibility
|
|
167
|
-
| ---------------------- |
|
|
168
|
-
| `
|
|
169
|
-
| `
|
|
170
|
-
| `
|
|
171
|
-
| `
|
|
172
|
-
| `
|
|
173
|
-
| `
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
`
|
|
166
|
+
| Module | Responsibility |
|
|
167
|
+
| ---------------------- | --------------------------------------------------------------------- |
|
|
168
|
+
| `types.ts` | Shared structural types (no runtime code — safe for anyone to import) |
|
|
169
|
+
| `config.ts` | Agent URL + client version resolution |
|
|
170
|
+
| `tuning.ts` | Timeouts, retry budgets, and the stream idle watchdog |
|
|
171
|
+
| `debug-log.ts` | Debug / lifecycle / metric sinks with secret redaction |
|
|
172
|
+
| `images.ts` | Image decode + Cursor CLI format and size validation |
|
|
173
|
+
| `model-routing.ts` | Effort suffix / requested model resolution |
|
|
174
|
+
| `model-discovery.ts` | `GetUsableModels` unary RPCs + per-token model cache |
|
|
175
|
+
| `context-normalize.ts` | Context-mode side-channel folding |
|
|
176
|
+
| `message-parsing.ts` | Pi/OpenAI message list → Cursor turn structures |
|
|
177
|
+
| `pi-adapter.ts` | Pi context/model types ↔ OpenAI-shaped request, usage accounting |
|
|
178
|
+
| `request-build.ts` | `AgentRunRequest` protobuf construction + blob store |
|
|
179
|
+
| `bridge-session.ts` | Active-bridge registry + h2-bridge lifecycle |
|
|
180
|
+
| `session-state.ts` | Conversation store, checkpoints, key derivation, session locks |
|
|
181
|
+
| `server-messages.ts` | Inbound KV / exec / interaction dispatch |
|
|
182
|
+
| `thinking-filter.ts` | Strips inline `<think>`-style tags from the text channel |
|
|
183
|
+
| `recovery.ts` | Tool-continuation recovery planner |
|
|
184
|
+
| `protocol.ts` | Auth/protocol error enhancement |
|
|
185
|
+
| `drift.ts` | Wire-drift detection (unknown message cases and protobuf fields) |
|
|
186
|
+
| `native-core.ts` | Native streamSimple runtime that drives all of the above |
|
|
187
|
+
|
|
188
|
+
Native `streamSimple` is the only chat path. The OpenAI-compatible local proxy that
|
|
189
|
+
used to sit alongside it was removed in favour of a single code path.
|
|
190
|
+
|
|
191
|
+
`src/proto/agent_pb.ts` is a large generated Connect/protobuf surface used by the wire
|
|
192
|
+
layer. Never hand-edit it — regenerate with `npm run proto:gen` (see
|
|
193
|
+
[`proto/README.md`](proto/README.md)) when Cursor changes the agent schema.
|
|
178
194
|
|
|
179
195
|
## Troubleshooting
|
|
180
196
|
|
|
181
197
|
- **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.
|
|
182
198
|
- **Empty / hung stream:** Cursor may have updated wire headers; verify network connectivity or bump `PI_CURSOR_CLIENT_VERSION`. `/cursor.doctor` prints the active `clientVersion`.
|
|
199
|
+
- **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=... npm 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.
|
|
183
200
|
- **Stuck / dies after a few minutes of work:** v1.2.2 answers all Cursor `InteractionQuery` permission prompts (web search / ask-question / etc.) that previously parked the stream. Inspect `$TMPDIR/pi-cursor-lifecycle.jsonl` for `interaction_query` / `bridge_close` events, and `/cursor.doctor` for `lastStreamEvent`. Full debug: `PI_CURSOR_PROVIDER_DEBUG=1`.
|
|
184
201
|
- **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.
|
|
185
202
|
- **WSL credential detection:** Ensure your Windows user profile folder exists under `/mnt/c/Users/` and is readable from WSL. Disable with `PI_CURSOR_SYSTEM_CREDENTIALS=0` if undesired.
|
|
@@ -191,7 +208,13 @@ npm install
|
|
|
191
208
|
npm run check
|
|
192
209
|
```
|
|
193
210
|
|
|
194
|
-
`npm run check` runs TypeScript typechecking, ESLint, Prettier format verification, security checks, and unit tests.
|
|
211
|
+
`npm run check` runs TypeScript typechecking, ESLint, Prettier format verification, security checks, the protobuf staleness check, and unit tests.
|
|
212
|
+
|
|
213
|
+
| Script | Purpose |
|
|
214
|
+
| --------------------- | --------------------------------------------------------------------------------- |
|
|
215
|
+
| `npm run proto:gen` | Regenerate `src/proto/agent_pb.ts` from `proto/agent.proto`. |
|
|
216
|
+
| `npm run proto:sync` | Rebuild `proto/agent.proto` from an updated generated file obtained upstream. |
|
|
217
|
+
| `npm run proto:check` | Fail if the generated protobuf is stale or hand-edited (part of `npm run check`). |
|
|
195
218
|
|
|
196
219
|
## Attributions
|
|
197
220
|
|